feat: slash system / input service / agent scope

This commit is contained in:
imccyu
2026-07-27 03:17:52 +08:00
parent f3a4833dbf
commit a27be43ac1
210 changed files with 15969 additions and 2213 deletions
@@ -56,8 +56,12 @@ export interface SidebarSettingsOwnerProps {
* the New Session button and toggling the column.
*/
export type SidebarRootInjected = {
/** Start or replace the current frontend Session Intent. */
startSession: (workspaceId?: WorkspaceId, prompt?: string) => void
/**
* Start a New Session: with a workspace, reuse-or-create its blank session
* and open it; without one, clear the selection into the New Session pure
* view state (the conversation.empty seat).
*/
startSession: (workspaceId?: WorkspaceId) => void
/** Toggle the sidebar column through the layout service. */
toggleSidebar: () => void
}
+14 -2
View File
@@ -6,14 +6,26 @@ import { SidebarRoot } from './SidebarRoot.tsx'
export type { SidebarRootComponentProps, SidebarRootInjected, SidebarSectionOwnerProps, SidebarSettingsOwnerProps } from './contract/slots.ts'
/** Services required by the sidebar plugin. */
export const inject = ['slots', 'layout', 'workspaces']
export const inject = ['slots', 'layout', 'sessions', 'workspaces']
/** Registers the sidebar shell and its service callbacks.
* @param ctx - Client root context.
*/
export function apply(ctx: ClientContext): void {
const injectProps = (): SidebarRootInjected => ({
startSession: (workspaceId, prompt) => { ctx.workspaces.startSession(workspaceId, prompt) },
// The shell's New Session button targets the most recently active
// Workspace; an explicit Workspace still wins for scoped create actions.
startSession: (workspaceId) => {
const target = workspaceId ?? ctx.workspaces.list.getSnapshot().recentWorkspaceId
if (target === undefined) {
ctx.sessions.clear()
return
}
void ctx.workspaces.connectWorkspace(target).then(
(sessionId) => { ctx.sessions.open(sessionId) },
(reason: unknown) => { console.warn('new session failed:', reason) },
)
},
toggleSidebar: () => { ctx.layout.toggleSidebar() },
})
ctx.effect(