@bastani/atomic 0.9.85-alpha.1 → 0.9.86-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +52 -0
- package/dist/builtin/intercom/CHANGELOG.md +25 -0
- package/dist/builtin/intercom/README.md +10 -9
- package/dist/builtin/intercom/broker/away-asks.ts +260 -0
- package/dist/builtin/intercom/broker/broker.ts +170 -9
- package/dist/builtin/intercom/broker/client.ts +5 -3
- package/dist/builtin/intercom/broker/held-reply-targets.ts +5 -0
- package/dist/builtin/intercom/broker/multinode-router.ts +16 -7
- package/dist/builtin/intercom/broker/paths.ts +5 -0
- package/dist/builtin/intercom/broker/pending-question-index.ts +119 -0
- package/dist/builtin/intercom/broker/released-asker-replies.ts +39 -0
- package/dist/builtin/intercom/broker/send-handler.ts +44 -3
- package/dist/builtin/intercom/broker/terminal-questions.ts +2 -0
- package/dist/builtin/intercom/index.bundle.mjs +799 -177
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/intercom/retry-policy.ts +1 -1
- package/dist/builtin/intercom/skills/intercom/SKILL.md +29 -35
- package/dist/builtin/intercom/types.ts +7 -2
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +20 -0
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/skills/subagent/SKILL.md +1 -1
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +2765 -2719
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +22 -0
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/src/authoring.d.ts +1 -1
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +371 -193
- package/dist/builtin/workflows/src/extension/local-worker-entry.mjs +358 -181
- package/dist/builtin/workflows/src/index.js +356 -183
- package/dist/builtin/workflows/src/local-worker-entry.mjs +358 -181
- package/dist/builtin/workflows/src/shared/worktree-restore-outcome.d.ts +16 -0
- package/dist/builtin/workflows/src/workers/workspace-binding.d.ts +13 -2
- package/dist/core/agent-session-methods.d.ts +1 -0
- package/dist/core/agent-session-methods.d.ts.map +1 -1
- package/dist/core/agent-session-methods.js.map +1 -1
- package/dist/core/agent-session-prompt.d.ts.map +1 -1
- package/dist/core/agent-session-prompt.js +2 -35
- package/dist/core/agent-session-prompt.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +3 -1
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +12 -5
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-state.d.ts.map +1 -1
- package/dist/core/agent-session-state.js +14 -1
- package/dist/core/agent-session-state.js.map +1 -1
- package/dist/core/agent-session.d.ts +2 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +3 -1
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/resume/index.d.ts +1 -1
- package/dist/core/resume/index.d.ts.map +1 -1
- package/dist/core/resume/index.js +1 -1
- package/dist/core/resume/index.js.map +1 -1
- package/dist/core/resume/path-mapping.d.ts +10 -0
- package/dist/core/resume/path-mapping.d.ts.map +1 -1
- package/dist/core/resume/path-mapping.js +20 -0
- package/dist/core/resume/path-mapping.js.map +1 -1
- package/dist/core/resume/session-resume.d.ts +5 -0
- package/dist/core/resume/session-resume.d.ts.map +1 -1
- package/dist/core/resume/session-resume.js +24 -9
- package/dist/core/resume/session-resume.js.map +1 -1
- package/dist/core/session-worktree-snapshots.d.ts +5 -8
- package/dist/core/session-worktree-snapshots.d.ts.map +1 -1
- package/dist/core/session-worktree-snapshots.js +34 -99
- package/dist/core/session-worktree-snapshots.js.map +1 -1
- package/dist/core/skill-catalog.d.ts +11 -0
- package/dist/core/skill-catalog.d.ts.map +1 -1
- package/dist/core/skill-catalog.js +31 -0
- package/dist/core/skill-catalog.js.map +1 -1
- package/dist/core/tasks/agent-adapter.d.ts +2 -0
- package/dist/core/tasks/agent-adapter.d.ts.map +1 -1
- package/dist/core/tasks/agent-adapter.js +5 -1
- package/dist/core/tasks/agent-adapter.js.map +1 -1
- package/dist/core/tasks/supervisor.d.ts +17 -0
- package/dist/core/tasks/supervisor.d.ts.map +1 -1
- package/dist/core/tasks/supervisor.js +12 -6
- package/dist/core/tasks/supervisor.js.map +1 -1
- package/dist/core/tasks/task-view-source.d.ts +10 -0
- package/dist/core/tasks/task-view-source.d.ts.map +1 -1
- package/dist/core/tasks/task-view-source.js +24 -1
- package/dist/core/tasks/task-view-source.js.map +1 -1
- package/dist/core/worktree-snapshot/best-restore.d.ts +45 -0
- package/dist/core/worktree-snapshot/best-restore.d.ts.map +1 -0
- package/dist/core/worktree-snapshot/best-restore.js +92 -0
- package/dist/core/worktree-snapshot/best-restore.js.map +1 -0
- package/dist/core/worktree-snapshot/git.d.ts +2 -2
- package/dist/core/worktree-snapshot/git.d.ts.map +1 -1
- package/dist/core/worktree-snapshot/git.js +2 -5
- package/dist/core/worktree-snapshot/git.js.map +1 -1
- package/dist/core/worktree-snapshot/index.d.ts +1 -0
- package/dist/core/worktree-snapshot/index.d.ts.map +1 -1
- package/dist/core/worktree-snapshot/index.js +1 -0
- package/dist/core/worktree-snapshot/index.js.map +1 -1
- package/dist/core/worktree-snapshot/restore.d.ts.map +1 -1
- package/dist/core/worktree-snapshot/restore.js +18 -2
- package/dist/core/worktree-snapshot/restore.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/modes/interactive/chat-autocomplete.d.ts +7 -0
- package/dist/modes/interactive/chat-autocomplete.d.ts.map +1 -0
- package/dist/modes/interactive/chat-autocomplete.js +85 -0
- package/dist/modes/interactive/chat-autocomplete.js.map +1 -0
- package/dist/modes/interactive/components/task-transcript-page.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-transcript-page.js +8 -0
- package/dist/modes/interactive/components/task-transcript-page.js.map +1 -1
- package/dist/modes/interactive/interactive-autocomplete.js +3 -79
- package/dist/modes/interactive/interactive-autocomplete.js.map +1 -1
- package/dist/modes/interactive/skill-command-autocomplete.d.ts +6 -0
- package/dist/modes/interactive/skill-command-autocomplete.d.ts.map +1 -1
- package/dist/modes/interactive/skill-command-autocomplete.js +18 -2
- package/dist/modes/interactive/skill-command-autocomplete.js.map +1 -1
- package/docs/background-tasks.md +1 -1
- package/docs/intercom/operations.md +4 -4
- package/docs/intercom/reference.md +39 -8
- package/docs/intercom.md +26 -9
- package/docs/skills.md +3 -1
- package/docs/subagents.md +2 -0
- package/docs/workflows/api-reference.md +3 -3
- package/docs/workflows/operations.md +2 -2
- package/docs/worktree-snapshots.md +10 -4
- package/npm-shrinkwrap.json +32 -32
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-transcript-page.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/task-transcript-page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAA2B,UAAU,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAGnG,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,EACN,sBAAsB,GAItB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAG1C,OAAO,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,8BAA8B,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AAyB9E,MAAM,mBAAmB,GAAG,IAAI,OAAO,EAAmD,CAAC;AAE3F,SAAS,WAAW,CAAC,KAAc;IAClC,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,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C,CAAC;IAED,UAAU;QACT,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;IAC5B,CAAC;IAED,OAAO;QACN,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;IACzB,CAAC;CACD","sourcesContent":["import { getKeybindings, type KeybindingsManager, matchesKey, Text } from \"@earendil-works/pi-tui\";\nimport type { ReadonlyFooterDataProvider } from \"../../../core/footer-data-provider.ts\";\nimport type { TaskId } from \"../../../core/tasks/contracts.js\";\nimport { TaskMessageError } from \"../../../core/tasks/message-error.js\";\nimport type { TaskTranscriptSource } from \"../../../core/tasks/supervisor.js\";\nimport {\n\tlaunchedTaskViewSource,\n\ttype TaskTranscriptView,\n\ttype TaskViewResult,\n\ttype TaskViewSource,\n} from \"../../../core/tasks/task-view-source.js\";\nimport { theme } from \"../theme/theme.js\";\nimport type { ChatSessionHost } from \"./chat-session-host.ts\";\nimport type { ChatSessionHostOpts, ChatSessionHostStyle } from \"./chat-session-host-types.ts\";\nimport { ScrollableComponentViewport } from \"./chat-transcript.js\";\nimport { applyInputLabelToEditorTopRule } from \"./input-label.ts\";\nimport { taskDisplayText } from \"./task-row.js\";\nimport { TRANSCRIPT_JUMP_TO_END_URL } from \"./transcript-follow-indicator.ts\";\n\n/** Where a task's transcript view is mounted: the chat host it builds on and the render settings it inherits. */\nexport interface TaskTranscriptEnvironment {\n\tcreateChat(opts: ChatSessionHostOpts): ChatSessionHost;\n\treadonly tui?: ChatSessionHostOpts[\"tui\"];\n\treadonly keybindings?: unknown;\n\treadonly editorTheme: ChatSessionHostOpts[\"editorTheme\"];\n\treadonly editorFactory?: ChatSessionHostOpts[\"editorFactory\"];\n\treadonly style: ChatSessionHostStyle;\n\treadonly getChatRenderSettings?: ChatSessionHostOpts[\"getChatRenderSettings\"];\n\t/** What the transcript chat's footer reads of git and providers; without it the footer counts tasks only. */\n\treadonly footerData?: ChatSessionHostOpts[\"footerData\"];\n\treadonly getToolsExpanded?: () => boolean;\n\treadonly setToolsExpanded?: (expanded: boolean) => void;\n\t/** Tells the reader about a message that failed after they left its transcript and the task pages. */\n\treadonly notify?: (message: string) => void;\n}\n\n/** A message that failed after its reader left the transcript, kept for when they open it again. */\ninterface UndeliveredMessage {\n\treadonly text: string;\n\treadonly reason: string;\n}\n\nconst undeliveredMessages = new WeakMap<TaskViewSource, Map<TaskId, UndeliveredMessage>>();\n\nfunction failureText(error: unknown): string {\n\treturn error instanceof Error ? error.message : String(error);\n}\n\n/** What the task inspector shows under a task's title while its transcript is open. */\nexport interface TaskTranscriptPage {\n\t/** Loading, retention and failure notes for the page's footer. */\n\treadonly status: string;\n\tload(): Promise<void>;\n\t/** The task changed: follow its session again or read its latest page again. */\n\trefresh(): void;\n\thandleInput(data: string): boolean;\n\t/** Whether the reader is typing, so a key such as Left edits instead of leaving. */\n\thasDraft(): boolean;\n\t/** Whether the page takes Escape and Left itself, as while its own task list is open. */\n\thandlesBack(): boolean;\n\trender(width: number, rows: number): string[];\n\tinvalidate(): void;\n\tdispose(): void;\n}\n\n/** Atomic's global theme, as the shared chat host's style. */\nexport function themedChatHostStyle(): ChatSessionHostStyle {\n\treturn {\n\t\tdim: (text) => theme.fg(\"dim\", text),\n\t\ttext: (text) => theme.fg(\"text\", text),\n\t\ttextMuted: (text) => theme.fg(\"muted\", text),\n\t\taccent: (text) => theme.fg(\"accent\", text),\n\t\taccentBold: (text) => theme.bold(theme.fg(\"accent\", text)),\n\t\tworkingIndicatorUseGlobalTheme: true,\n\t\trule: (_hex, text) => theme.fg(\"borderMuted\", text),\n\t\tcursor: () => \"\\x1b[7m \\x1b[27m\",\n\t\tblank: (width) => \" \".repeat(Math.max(0, width)),\n\t\teditorRuleColor: () => \"\",\n\t};\n}\n\nfunction keybindingsOf(candidate: unknown): Pick<KeybindingsManager, \"matches\"> {\n\tconst keybindings = candidate as Partial<Pick<KeybindingsManager, \"matches\">> | undefined;\n\treturn typeof keybindings?.matches === \"function\"\n\t\t? (keybindings as Pick<KeybindingsManager, \"matches\">)\n\t\t: getKeybindings();\n}\n\n/** The subagent's footer shows its own session: the extension statuses of the chat that opened it are not its own. */\nfunction withoutExtensionStatuses(data: ReadonlyFooterDataProvider): ReadonlyFooterDataProvider {\n\treturn {\n\t\tgetGitBranch: (cwd) => data.getGitBranch(cwd),\n\t\tgetAvailableProviderCount: () => data.getAvailableProviderCount(),\n\t\tonBranchChange: (callback, cwd) => data.onBranchChange(callback, cwd),\n\t\tgetExtensionStatuses: () => new Map(),\n\t};\n}\n\nasync function settled<T>(read: T | Promise<T>): Promise<T> {\n\treturn read instanceof Promise ? await read : read;\n}\n\n/**\n * An agent task's transcript on the shared chat host: it opens at the latest page, follows the task's live session\n * where it has one, loads earlier retained history as the reader nears the top, and sends what the reader types to\n * the task through its Intercom target.\n */\nexport class TaskAgentTranscriptPage implements TaskTranscriptPage {\n\treadonly chat: ChatSessionHost;\n\tstatus = \"Loading transcript…\";\n\tprivate readonly source: TaskViewSource;\n\tprivate readonly taskId: TaskId;\n\tprivate readonly env: TaskTranscriptEnvironment;\n\tprivate readonly requestRender: () => void;\n\tprivate followed?: TaskTranscriptSource;\n\tprivate unsubscribe?: () => void;\n\tprivate cursor?: string;\n\tprivate loading = false;\n\tprivate reloadPending = false;\n\tprivate loadingEarlier = false;\n\t/** A history-only transcript changed while the reader was away from its end; it is read again when they return. */\n\tprivate behind = false;\n\tprivate disposed = false;\n\n\tprivate readonly reportLate: (reason: string) => void;\n\n\t/** `reportLate` shows the reason a message failed after the reader left this transcript. */\n\tconstructor(\n\t\tsource: TaskViewSource,\n\t\ttaskId: TaskId,\n\t\tenv: TaskTranscriptEnvironment,\n\t\trequestRender: () => void,\n\t\treportLate: (reason: string) => void = (reason) => env.notify?.(reason),\n\t) {\n\t\tthis.source = source;\n\t\tthis.taskId = taskId;\n\t\tthis.env = env;\n\t\tthis.requestRender = requestRender;\n\t\tthis.reportLate = reportLate;\n\t\tthis.chat = env.createChat({\n\t\t\tstyle: env.style,\n\t\t\ttui: env.tui,\n\t\t\tkeybindings: env.keybindings,\n\t\t\teditorTheme: env.editorTheme,\n\t\t\teditorFactory: env.editorFactory,\n\t\t\tgetChatRenderSettings: env.getChatRenderSettings,\n\t\t\t...(env.footerData === undefined ? {} : { footerData: withoutExtensionStatuses(env.footerData) }),\n\t\t\tgetChatBoxSession: () => this.followed?.chatSession,\n\t\t\trequestRender,\n\t\t\ttaskRowsInChat: false,\n\t\t\tisStreaming: () => this.followed?.getStreamingMessage?.() !== undefined,\n\t\t\tisDisabled: () => source.sendTaskMessage === undefined,\n\t\t\tonNearTop: () => this.loadEarlier(),\n\t\t\t// A subagent's `/tasks` lists the tasks it launched, as a stage chat's lists the stage's own.\n\t\t\tgetTaskSource: () => launchedTaskViewSource(source, taskId),\n\t\t\tcommands: {\n\t\t\t\tsend: (text) => this.send(text),\n\t\t\t\thandleSlashCommand: (text) => this.chat.openTasks(text.split(/\\s+/)[1]),\n\t\t\t},\n\t\t});\n\t\tthis.restoreUndelivered();\n\t}\n\n\tasync load(): Promise<void> {\n\t\tif (this.loading) {\n\t\t\tthis.reloadPending = true;\n\t\t\treturn;\n\t\t}\n\t\tthis.loading = true;\n\t\ttry {\n\t\t\t// A synchronous read subscribes in the same turn, so no event queued during the read is missed.\n\t\t\tconst read = this.source.readTaskTranscript(this.taskId);\n\t\t\tconst page = read instanceof Promise ? await read : read;\n\t\t\tif (this.disposed) return;\n\t\t\tthis.adoptLatestPage(page);\n\t\t} catch (error) {\n\t\t\tif (!this.disposed) this.status = error instanceof Error ? error.message : String(error);\n\t\t} finally {\n\t\t\tthis.loading = false;\n\t\t\tthis.requestRender();\n\t\t\tif (this.reloadPending && !this.disposed) {\n\t\t\t\tthis.reloadPending = false;\n\t\t\t\tthis.refresh();\n\t\t\t}\n\t\t}\n\t}\n\n\trefresh(): void {\n\t\tif (this.disposed) return;\n\t\tconst follow = this.source.followTaskTranscript(this.taskId);\n\t\tif (follow?.session !== undefined && follow.session === this.followed) return;\n\t\t// Reading a history-only transcript again replaces what is shown, so it waits while the reader is above the end.\n\t\tif (follow?.historyOnly === true && this.chat.bodyScrollFromBottom() > 0) {\n\t\t\tthis.behind = true;\n\t\t\treturn;\n\t\t}\n\t\tvoid this.load();\n\t}\n\n\thandleInput(data: string): boolean {\n\t\tconst handled = this.route(data);\n\t\tif (this.behind && this.chat.bodyScrollFromBottom() === 0) {\n\t\t\tthis.behind = false;\n\t\t\tvoid this.load();\n\t\t}\n\t\treturn handled;\n\t}\n\n\tprivate route(data: string): boolean {\n\t\tif (data === TRANSCRIPT_JUMP_TO_END_URL) {\n\t\t\tthis.chat.scrollToBottom();\n\t\t\tthis.requestRender();\n\t\t\treturn true;\n\t\t}\n\t\tconst keybindings = keybindingsOf(this.env.keybindings);\n\t\t// The host owns thinking display; only its default physical key leaves the composer, as in a stage chat.\n\t\tif (matchesKey(data, \"ctrl+t\") && keybindings.matches(data, \"app.thinking.toggle\")) return false;\n\t\tif (keybindings.matches(data, \"app.tools.expand\")) {\n\t\t\tif (this.env.setToolsExpanded === undefined) return false;\n\t\t\tthis.env.setToolsExpanded(this.env.getToolsExpanded?.() !== true);\n\t\t\tthis.chat.invalidate();\n\t\t\tthis.requestRender();\n\t\t\treturn true;\n\t\t}\n\t\t// The subagent's own task list is modal while it is open, as in a stage chat.\n\t\tconst handled = this.chat.hasTaskInspector ? this.chat.handleTaskInput(data) : this.chat.handleInput(data);\n\t\tthis.requestRender();\n\t\treturn handled;\n\t}\n\n\t/** The chat box of a stage chat: the transcript, then pending, working, usage, the named editor and the footer. */\n\trender(width: number, rows: number): string[] {\n\t\tconst viewport = Math.max(1, rows);\n\t\tif (this.chat.hasTaskInspector) {\n\t\t\tconst footer = this.chat.taskInspectorFullscreen ? [] : this.chat.renderFooter(width);\n\t\t\tconst shownFooter = footer.slice(0, viewport - 1);\n\t\t\treturn [...this.chat.renderBody(width, viewport - shownFooter.length), ...shownFooter];\n\t\t}\n\t\tlet remaining = viewport;\n\t\t// The editor keeps its rows first, then the footer, then the status rows; the transcript takes what is left.\n\t\tconst reserve = (lines: string[], fromEnd = false): string[] => {\n\t\t\tconst shown = fromEnd ? lines.slice(Math.max(0, lines.length - remaining)) : lines.slice(0, remaining);\n\t\t\tremaining -= shown.length;\n\t\t\treturn shown;\n\t\t};\n\t\tconst editor = reserve(\n\t\t\tapplyInputLabelToEditorTopRule(this.env.style, \"subagent\", this.sessionName(), this.chat.renderEditor(width)),\n\t\t);\n\t\tconst footer = reserve(this.chat.renderFooter(width));\n\t\tconst pending = reserve(this.chat.renderPendingMessages(width));\n\t\tconst working = reserve(this.chat.renderWorkingStatus(width), true);\n\t\tconst usage = reserve(this.chat.renderUsage(width));\n\t\tconst body = remaining > 0 ? this.chat.renderBody(width, remaining) : [];\n\t\treturn [...body, ...pending, ...working, ...usage, ...editor, ...footer];\n\t}\n\n\t/** What the subagent's session is called: its Intercom name, else its agent's name. */\n\tprivate sessionName(): string | undefined {\n\t\treturn (\n\t\t\tthis.source.followTaskTranscript(this.taskId)?.session?.completionSource?.intercomTarget ??\n\t\t\tthis.source.tasks.find((task) => task.ref.taskId === this.taskId)?.agentName\n\t\t);\n\t}\n\n\tinvalidate(): void {\n\t\tthis.chat.invalidate();\n\t}\n\n\tdispose(): void {\n\t\tthis.disposed = true;\n\t\tthis.unsubscribe?.();\n\t\tthis.unsubscribe = undefined;\n\t\tthis.chat.dispose();\n\t}\n\n\thasDraft(): boolean {\n\t\treturn this.chat.hasInputText();\n\t}\n\n\thandlesBack(): boolean {\n\t\treturn this.chat.hasTaskInspector;\n\t}\n\n\tprivate adoptLatestPage(page: TaskViewResult<TaskTranscriptView>): void {\n\t\tif (!page.ok) {\n\t\t\tthis.status = page.error.message;\n\t\t\treturn;\n\t\t}\n\t\tconst follow = this.source.followTaskTranscript(this.taskId);\n\t\t// A reader who moved above the end while this read was on its way keeps their rows until they return.\n\t\tif (follow?.historyOnly === true && this.chat.bodyScrollFromBottom() > 0) {\n\t\t\tthis.behind = true;\n\t\t\treturn;\n\t\t}\n\t\tconst session = follow?.session?.subscribe === undefined ? undefined : follow.session;\n\t\tthis.chat.replaceMessages(page.value.messages);\n\t\tthis.chat.hydrateCompactionStatus(page.value.compactionReason);\n\t\tthis.cursor = page.value.nextCursor;\n\t\tthis.status = \"\";\n\t\tif (session === this.followed) return;\n\t\tthis.unsubscribe?.();\n\t\tthis.unsubscribe = undefined;\n\t\tthis.followed = session;\n\t\tif (session === undefined) return;\n\t\tthis.chat.hydrateStreamingAssistantMessage(session.getStreamingMessage?.());\n\t\tthis.hydrateRunningTurn(session);\n\t\tthis.unsubscribe = session.subscribe?.((event) => {\n\t\t\tthis.chat.applyAgentEvent(event);\n\t\t\tthis.requestRender();\n\t\t});\n\t}\n\n\t/** A page opened mid-turn missed `agent_start` and `queue_update`, so it reads the turn and the queue now. */\n\tprivate hydrateRunningTurn(session: TaskTranscriptSource): void {\n\t\tif (session.isRunning?.() === true) this.chat.beginExternalPromptLifecycle();\n\t\tconst queued = session.getQueuedMessages?.();\n\t\tif (queued === undefined) return;\n\t\tthis.chat.applyAgentEvent({ type: \"queue_update\", steering: queued.steering, followUp: queued.followUp });\n\t}\n\n\tprivate loadEarlier(): void {\n\t\tconst cursor = this.cursor;\n\t\tif (cursor === undefined || this.loadingEarlier || this.loading || this.disposed) return;\n\t\tthis.loadingEarlier = true;\n\t\tvoid (async () => {\n\t\t\ttry {\n\t\t\t\tconst page = await settled(this.source.readTaskTranscript(this.taskId, cursor));\n\t\t\t\tif (this.disposed || cursor !== this.cursor) return;\n\t\t\t\tif (!page.ok) {\n\t\t\t\t\tthis.cursor = undefined;\n\t\t\t\t\tthis.status = page.error.message;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthis.cursor = page.value.nextCursor;\n\t\t\t\tthis.chat.prependMessages(page.value.messages);\n\t\t\t} catch (error) {\n\t\t\t\tif (this.disposed) return;\n\t\t\t\tthis.cursor = undefined;\n\t\t\t\tthis.status = error instanceof Error ? error.message : String(error);\n\t\t\t} finally {\n\t\t\t\tthis.loadingEarlier = false;\n\t\t\t\tthis.requestRender();\n\t\t\t}\n\t\t})();\n\t}\n\n\tprivate async send(text: string): Promise<void> {\n\t\tconst send = this.source.sendTaskMessage;\n\t\tif (send === undefined) throw new TaskMessageError(\"messages-unsupported\", { taskId: this.taskId });\n\t\ttry {\n\t\t\tawait send.call(this.source, this.taskId, text);\n\t\t} catch (error) {\n\t\t\tif (!this.disposed) throw error;\n\t\t\tthis.keepUndelivered(text, failureText(error));\n\t\t}\n\t}\n\n\t/** The reader left before the answer: report it once, and give the text back when they return. */\n\tprivate keepUndelivered(text: string, reason: string): void {\n\t\tconst kept = undeliveredMessages.get(this.source) ?? new Map<TaskId, UndeliveredMessage>();\n\t\tconst earlier = kept.get(this.taskId);\n\t\tkept.set(this.taskId, { text: earlier === undefined ? text : `${earlier.text}\\n${text}`, reason });\n\t\tundeliveredMessages.set(this.source, kept);\n\t\tthis.reportLate(reason);\n\t}\n\n\tprivate restoreUndelivered(): void {\n\t\tconst kept = undeliveredMessages.get(this.source);\n\t\tconst message = kept?.get(this.taskId);\n\t\tif (message === undefined) return;\n\t\tkept?.delete(this.taskId);\n\t\tthis.chat.setInputText(message.text);\n\t\tthis.chat.showWarning(message.reason);\n\t}\n}\n\n/** The retained tail of a shell task's output on the shared viewport. */\nexport class TaskCommandOutputPage implements TaskTranscriptPage {\n\tstatic readonly TAIL_BYTES = 8192;\n\tstatus = \"Loading output…\";\n\tprivate readonly source: TaskViewSource;\n\tprivate readonly taskId: TaskId;\n\tprivate readonly byteCount: () => bigint;\n\tprivate readonly requestRender: () => void;\n\tprivate readonly viewport: ScrollableComponentViewport;\n\tprivate output = new Text(\"\", 0, 0);\n\tprivate loading = false;\n\tprivate reloadPending = false;\n\tprivate disposed = false;\n\n\tconstructor(\n\t\tsource: TaskViewSource,\n\t\ttaskId: TaskId,\n\t\tbyteCount: () => bigint,\n\t\tenv: Pick<TaskTranscriptEnvironment, \"keybindings\" | \"getChatRenderSettings\"> | undefined,\n\t\trequestRender: () => void,\n\t) {\n\t\tthis.source = source;\n\t\tthis.taskId = taskId;\n\t\tthis.byteCount = byteCount;\n\t\tthis.requestRender = requestRender;\n\t\tthis.viewport = new ScrollableComponentViewport(env?.keybindings, {\n\t\t\twheelScrollLines: () => env?.getChatRenderSettings?.()?.fullscreenWheelScrollLines,\n\t\t\tscrollbar: () => env?.getChatRenderSettings?.()?.fullscreenScrollbar,\n\t\t\tscrollbarThumbStyle: (text) => theme.bg(\"scrollbarThumb\", text),\n\t\t\trequestRender,\n\t\t});\n\t\tthis.viewport.setComponents([this.output]);\n\t}\n\n\tasync load(): Promise<void> {\n\t\tif (this.loading) {\n\t\t\tthis.reloadPending = true;\n\t\t\treturn;\n\t\t}\n\t\tthis.loading = true;\n\t\tconst count = this.byteCount();\n\t\tconst tail = BigInt(TaskCommandOutputPage.TAIL_BYTES);\n\t\ttry {\n\t\t\tconst page = await this.source.readTaskOutput(this.taskId, {\n\t\t\t\tstart: String(count > tail ? count - tail : 0n),\n\t\t\t\tmaximumBytes: TaskCommandOutputPage.TAIL_BYTES,\n\t\t\t});\n\t\t\tif (this.disposed) return;\n\t\t\tconst text = page.ok ? page.value.text : page.error.message;\n\t\t\tthis.output = new Text(text.split(\"\\n\").map(taskDisplayText).join(\"\\n\") || \"No output available\", 0, 0);\n\t\t\tthis.viewport.setComponents([this.output]);\n\t\t\tthis.status = count > tail ? \"Earlier output omitted · showing retained 8 KiB tail\" : \"Retained shell output\";\n\t\t} catch (error) {\n\t\t\tif (!this.disposed) this.status = error instanceof Error ? error.message : String(error);\n\t\t} finally {\n\t\t\tthis.loading = false;\n\t\t\tthis.requestRender();\n\t\t\tif (this.reloadPending && !this.disposed) {\n\t\t\t\tthis.reloadPending = false;\n\t\t\t\tvoid this.load();\n\t\t\t}\n\t\t}\n\t}\n\n\trefresh(): void {\n\t\tif (!this.disposed) void this.load();\n\t}\n\n\thandleInput(data: string): boolean {\n\t\tconst handled = this.viewport.handleInput(data);\n\t\tif (handled) this.requestRender();\n\t\treturn handled;\n\t}\n\n\thasDraft(): boolean {\n\t\treturn false;\n\t}\n\n\thandlesBack(): boolean {\n\t\treturn false;\n\t}\n\n\trender(width: number, rows: number): string[] {\n\t\tthis.viewport.setVisibleRows(Math.max(1, rows));\n\t\treturn this.viewport.render(width);\n\t}\n\n\tinvalidate(): void {\n\t\tthis.viewport.invalidate();\n\t}\n\n\tdispose(): void {\n\t\tthis.disposed = true;\n\t\tthis.viewport.dispose();\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"task-transcript-page.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/task-transcript-page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAA2B,UAAU,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAGnG,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,EACN,sBAAsB,GAItB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,sCAAsC,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AACnH,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAG1C,OAAO,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,8BAA8B,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AAyB9E,MAAM,mBAAmB,GAAG,IAAI,OAAO,EAAmD,CAAC;AAE3F,SAAS,WAAW,CAAC,KAAc;IAClC,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC/D,CAAC;AAmBD,8DAA8D;AAC9D,MAAM,UAAU,mBAAmB;IAClC,OAAO;QACN,GAAG,EAAE,CA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AC;IAED,WAAW;QACV,OAAO,KAAK,CAAC;IACd,CAAC;IAED,MAAM,CAAC,KAAa,EAAE,IAAY;QACjC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;QAChD,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAED,UAAU;QACT,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;IAC5B,CAAC;IAED,OAAO;QACN,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;IACzB,CAAC;CACD","sourcesContent":["import { getKeybindings, type KeybindingsManager, matchesKey, Text } from \"@earendil-works/pi-tui\";\nimport type { ReadonlyFooterDataProvider } from \"../../../core/footer-data-provider.ts\";\nimport type { TaskId } from \"../../../core/tasks/contracts.js\";\nimport { TaskMessageError } from \"../../../core/tasks/message-error.js\";\nimport type { TaskTranscriptSource } from \"../../../core/tasks/supervisor.js\";\nimport {\n\tlaunchedTaskViewSource,\n\ttype TaskTranscriptView,\n\ttype TaskViewResult,\n\ttype TaskViewSource,\n} from \"../../../core/tasks/task-view-source.js\";\nimport { createSessionSkillAutocompleteProvider, getSkillCatalogCommands } from \"../skill-command-autocomplete.ts\";\nimport { theme } from \"../theme/theme.js\";\nimport type { ChatSessionHost } from \"./chat-session-host.ts\";\nimport type { ChatSessionHostOpts, ChatSessionHostStyle } from \"./chat-session-host-types.ts\";\nimport { ScrollableComponentViewport } from \"./chat-transcript.js\";\nimport { applyInputLabelToEditorTopRule } from \"./input-label.ts\";\nimport { taskDisplayText } from \"./task-row.js\";\nimport { TRANSCRIPT_JUMP_TO_END_URL } from \"./transcript-follow-indicator.ts\";\n\n/** Where a task's transcript view is mounted: the chat host it builds on and the render settings it inherits. */\nexport interface TaskTranscriptEnvironment {\n\tcreateChat(opts: ChatSessionHostOpts): ChatSessionHost;\n\treadonly tui?: ChatSessionHostOpts[\"tui\"];\n\treadonly keybindings?: unknown;\n\treadonly editorTheme: ChatSessionHostOpts[\"editorTheme\"];\n\treadonly editorFactory?: ChatSessionHostOpts[\"editorFactory\"];\n\treadonly style: ChatSessionHostStyle;\n\treadonly getChatRenderSettings?: ChatSessionHostOpts[\"getChatRenderSettings\"];\n\t/** What the transcript chat's footer reads of git and providers; without it the footer counts tasks only. */\n\treadonly footerData?: ChatSessionHostOpts[\"footerData\"];\n\treadonly getToolsExpanded?: () => boolean;\n\treadonly setToolsExpanded?: (expanded: boolean) => void;\n\t/** Tells the reader about a message that failed after they left its transcript and the task pages. */\n\treadonly notify?: (message: string) => void;\n}\n\n/** A message that failed after its reader left the transcript, kept for when they open it again. */\ninterface UndeliveredMessage {\n\treadonly text: string;\n\treadonly reason: string;\n}\n\nconst undeliveredMessages = new WeakMap<TaskViewSource, Map<TaskId, UndeliveredMessage>>();\n\nfunction failureText(error: unknown): string {\n\treturn error instanceof Error ? error.message : String(error);\n}\n\n/** What the task inspector shows under a task's title while its transcript is open. */\nexport interface TaskTranscriptPage {\n\t/** Loading, retention and failure notes for the page's footer. */\n\treadonly status: string;\n\tload(): Promise<void>;\n\t/** The task changed: follow its session again or read its latest page again. */\n\trefresh(): void;\n\thandleInput(data: string): boolean;\n\t/** Whether the reader is typing, so a key such as Left edits instead of leaving. */\n\thasDraft(): boolean;\n\t/** Whether the page takes Escape and Left itself, as while its own task list is open. */\n\thandlesBack(): boolean;\n\trender(width: number, rows: number): string[];\n\tinvalidate(): void;\n\tdispose(): void;\n}\n\n/** Atomic's global theme, as the shared chat host's style. */\nexport function themedChatHostStyle(): ChatSessionHostStyle {\n\treturn {\n\t\tdim: (text) => theme.fg(\"dim\", text),\n\t\ttext: (text) => theme.fg(\"text\", text),\n\t\ttextMuted: (text) => theme.fg(\"muted\", text),\n\t\taccent: (text) => theme.fg(\"accent\", text),\n\t\taccentBold: (text) => theme.bold(theme.fg(\"accent\", text)),\n\t\tworkingIndicatorUseGlobalTheme: true,\n\t\trule: (_hex, text) => theme.fg(\"borderMuted\", text),\n\t\tcursor: () => \"\\x1b[7m \\x1b[27m\",\n\t\tblank: (width) => \" \".repeat(Math.max(0, width)),\n\t\teditorRuleColor: () => \"\",\n\t};\n}\n\nfunction keybindingsOf(candidate: unknown): Pick<KeybindingsManager, \"matches\"> {\n\tconst keybindings = candidate as Partial<Pick<KeybindingsManager, \"matches\">> | undefined;\n\treturn typeof keybindings?.matches === \"function\"\n\t\t? (keybindings as Pick<KeybindingsManager, \"matches\">)\n\t\t: getKeybindings();\n}\n\n/** The subagent's footer shows its own session: the extension statuses of the chat that opened it are not its own. */\nfunction withoutExtensionStatuses(data: ReadonlyFooterDataProvider): ReadonlyFooterDataProvider {\n\treturn {\n\t\tgetGitBranch: (cwd) => data.getGitBranch(cwd),\n\t\tgetAvailableProviderCount: () => data.getAvailableProviderCount(),\n\t\tonBranchChange: (callback, cwd) => data.onBranchChange(callback, cwd),\n\t\tgetExtensionStatuses: () => new Map(),\n\t};\n}\n\nasync function settled<T>(read: T | Promise<T>): Promise<T> {\n\treturn read instanceof Promise ? await read : read;\n}\n\n/**\n * An agent task's transcript on the shared chat host: it opens at the latest page, follows the task's live session\n * where it has one, loads earlier retained history as the reader nears the top, and sends what the reader types to\n * the task through its Intercom target.\n */\nexport class TaskAgentTranscriptPage implements TaskTranscriptPage {\n\treadonly chat: ChatSessionHost;\n\tstatus = \"Loading transcript…\";\n\tprivate readonly source: TaskViewSource;\n\tprivate readonly taskId: TaskId;\n\tprivate readonly env: TaskTranscriptEnvironment;\n\tprivate readonly requestRender: () => void;\n\tprivate followed?: TaskTranscriptSource;\n\tprivate unsubscribe?: () => void;\n\tprivate cursor?: string;\n\tprivate loading = false;\n\tprivate reloadPending = false;\n\tprivate loadingEarlier = false;\n\t/** A history-only transcript changed while the reader was away from its end; it is read again when they return. */\n\tprivate behind = false;\n\tprivate disposed = false;\n\n\tprivate readonly reportLate: (reason: string) => void;\n\n\t/** `reportLate` shows the reason a message failed after the reader left this transcript. */\n\tconstructor(\n\t\tsource: TaskViewSource,\n\t\ttaskId: TaskId,\n\t\tenv: TaskTranscriptEnvironment,\n\t\trequestRender: () => void,\n\t\treportLate: (reason: string) => void = (reason) => env.notify?.(reason),\n\t) {\n\t\tthis.source = source;\n\t\tthis.taskId = taskId;\n\t\tthis.env = env;\n\t\tthis.requestRender = requestRender;\n\t\tthis.reportLate = reportLate;\n\t\tthis.chat = env.createChat({\n\t\t\tstyle: env.style,\n\t\t\ttui: env.tui,\n\t\t\tkeybindings: env.keybindings,\n\t\t\teditorTheme: env.editorTheme,\n\t\t\teditorFactory: env.editorFactory,\n\t\t\tgetChatRenderSettings: env.getChatRenderSettings,\n\t\t\t...(env.footerData === undefined ? {} : { footerData: withoutExtensionStatuses(env.footerData) }),\n\t\t\tgetChatBoxSession: () => this.followed?.chatSession,\n\t\t\trequestRender,\n\t\t\ttaskRowsInChat: false,\n\t\t\tisStreaming: () => this.followed?.getStreamingMessage?.() !== undefined,\n\t\t\tisDisabled: () => source.sendTaskMessage === undefined,\n\t\t\tonNearTop: () => this.loadEarlier(),\n\t\t\t// A subagent's `/tasks` lists the tasks it launched, as a stage chat's lists the stage's own.\n\t\t\tgetTaskSource: () => launchedTaskViewSource(source, taskId),\n\t\t\t// The completion a stage chat offers, from the subagent's own cwd and skills.\n\t\t\tautocompleteProvider: createSessionSkillAutocompleteProvider(async () => {\n\t\t\t\tconst commands = await source.taskCommands?.(taskId);\n\t\t\t\treturn commands === undefined\n\t\t\t\t\t? undefined\n\t\t\t\t\t: { cwd: commands.cwd, skillCommands: getSkillCatalogCommands(commands.skillCommands) };\n\t\t\t}),\n\t\t\tcommands: {\n\t\t\t\tsend: (text) => this.send(text),\n\t\t\t\thandleSlashCommand: (text) => this.chat.openTasks(text.split(/\\s+/)[1]),\n\t\t\t},\n\t\t});\n\t\tthis.restoreUndelivered();\n\t}\n\n\tasync load(): Promise<void> {\n\t\tif (this.loading) {\n\t\t\tthis.reloadPending = true;\n\t\t\treturn;\n\t\t}\n\t\tthis.loading = true;\n\t\ttry {\n\t\t\t// A synchronous read subscribes in the same turn, so no event queued during the read is missed.\n\t\t\tconst read = this.source.readTaskTranscript(this.taskId);\n\t\t\tconst page = read instanceof Promise ? await read : read;\n\t\t\tif (this.disposed) return;\n\t\t\tthis.adoptLatestPage(page);\n\t\t} catch (error) {\n\t\t\tif (!this.disposed) this.status = error instanceof Error ? error.message : String(error);\n\t\t} finally {\n\t\t\tthis.loading = false;\n\t\t\tthis.requestRender();\n\t\t\tif (this.reloadPending && !this.disposed) {\n\t\t\t\tthis.reloadPending = false;\n\t\t\t\tthis.refresh();\n\t\t\t}\n\t\t}\n\t}\n\n\trefresh(): void {\n\t\tif (this.disposed) return;\n\t\tconst follow = this.source.followTaskTranscript(this.taskId);\n\t\tif (follow?.session !== undefined && follow.session === this.followed) return;\n\t\t// Reading a history-only transcript again replaces what is shown, so it waits while the reader is above the end.\n\t\tif (follow?.historyOnly === true && this.chat.bodyScrollFromBottom() > 0) {\n\t\t\tthis.behind = true;\n\t\t\treturn;\n\t\t}\n\t\tvoid this.load();\n\t}\n\n\thandleInput(data: string): boolean {\n\t\tconst handled = this.route(data);\n\t\tif (this.behind && this.chat.bodyScrollFromBottom() === 0) {\n\t\t\tthis.behind = false;\n\t\t\tvoid this.load();\n\t\t}\n\t\treturn handled;\n\t}\n\n\tprivate route(data: string): boolean {\n\t\tif (data === TRANSCRIPT_JUMP_TO_END_URL) {\n\t\t\tthis.chat.scrollToBottom();\n\t\t\tthis.requestRender();\n\t\t\treturn true;\n\t\t}\n\t\tconst keybindings = keybindingsOf(this.env.keybindings);\n\t\t// The host owns thinking display; only its default physical key leaves the composer, as in a stage chat.\n\t\tif (matchesKey(data, \"ctrl+t\") && keybindings.matches(data, \"app.thinking.toggle\")) return false;\n\t\tif (keybindings.matches(data, \"app.tools.expand\")) {\n\t\t\tif (this.env.setToolsExpanded === undefined) return false;\n\t\t\tthis.env.setToolsExpanded(this.env.getToolsExpanded?.() !== true);\n\t\t\tthis.chat.invalidate();\n\t\t\tthis.requestRender();\n\t\t\treturn true;\n\t\t}\n\t\t// The subagent's own task list is modal while it is open, as in a stage chat.\n\t\tconst handled = this.chat.hasTaskInspector ? this.chat.handleTaskInput(data) : this.chat.handleInput(data);\n\t\tthis.requestRender();\n\t\treturn handled;\n\t}\n\n\t/** The chat box of a stage chat: the transcript, then pending, working, usage, the named editor and the footer. */\n\trender(width: number, rows: number): string[] {\n\t\tconst viewport = Math.max(1, rows);\n\t\tif (this.chat.hasTaskInspector) {\n\t\t\tconst footer = this.chat.taskInspectorFullscreen ? [] : this.chat.renderFooter(width);\n\t\t\tconst shownFooter = footer.slice(0, viewport - 1);\n\t\t\treturn [...this.chat.renderBody(width, viewport - shownFooter.length), ...shownFooter];\n\t\t}\n\t\tlet remaining = viewport;\n\t\t// The editor keeps its rows first, then the footer, then the status rows; the transcript takes what is left.\n\t\tconst reserve = (lines: string[], fromEnd = false): string[] => {\n\t\t\tconst shown = fromEnd ? lines.slice(Math.max(0, lines.length - remaining)) : lines.slice(0, remaining);\n\t\t\tremaining -= shown.length;\n\t\t\treturn shown;\n\t\t};\n\t\tconst editor = reserve(\n\t\t\tapplyInputLabelToEditorTopRule(this.env.style, \"subagent\", this.sessionName(), this.chat.renderEditor(width)),\n\t\t);\n\t\tconst footer = reserve(this.chat.renderFooter(width));\n\t\tconst pending = reserve(this.chat.renderPendingMessages(width));\n\t\tconst working = reserve(this.chat.renderWorkingStatus(width), true);\n\t\tconst usage = reserve(this.chat.renderUsage(width));\n\t\tconst body = remaining > 0 ? this.chat.renderBody(width, remaining) : [];\n\t\treturn [...body, ...pending, ...working, ...usage, ...editor, ...footer];\n\t}\n\n\t/** What the subagent's session is called: its Intercom name, else its agent's name. */\n\tprivate sessionName(): string | undefined {\n\t\treturn (\n\t\t\tthis.source.followTaskTranscript(this.taskId)?.session?.completionSource?.intercomTarget ??\n\t\t\tthis.source.tasks.find((task) => task.ref.taskId === this.taskId)?.agentName\n\t\t);\n\t}\n\n\tinvalidate(): void {\n\t\tthis.chat.invalidate();\n\t}\n\n\tdispose(): void {\n\t\tthis.disposed = true;\n\t\tthis.unsubscribe?.();\n\t\tthis.unsubscribe = undefined;\n\t\tthis.chat.dispose();\n\t}\n\n\thasDraft(): boolean {\n\t\treturn this.chat.hasInputText();\n\t}\n\n\thandlesBack(): boolean {\n\t\treturn this.chat.hasTaskInspector;\n\t}\n\n\tprivate adoptLatestPage(page: TaskViewResult<TaskTranscriptView>): void {\n\t\tif (!page.ok) {\n\t\t\tthis.status = page.error.message;\n\t\t\treturn;\n\t\t}\n\t\tconst follow = this.source.followTaskTranscript(this.taskId);\n\t\t// A reader who moved above the end while this read was on its way keeps their rows until they return.\n\t\tif (follow?.historyOnly === true && this.chat.bodyScrollFromBottom() > 0) {\n\t\t\tthis.behind = true;\n\t\t\treturn;\n\t\t}\n\t\tconst session = follow?.session?.subscribe === undefined ? undefined : follow.session;\n\t\tthis.chat.replaceMessages(page.value.messages);\n\t\tthis.chat.hydrateCompactionStatus(page.value.compactionReason);\n\t\tthis.cursor = page.value.nextCursor;\n\t\tthis.status = \"\";\n\t\tif (session === this.followed) return;\n\t\tthis.unsubscribe?.();\n\t\tthis.unsubscribe = undefined;\n\t\tthis.followed = session;\n\t\tif (session === undefined) return;\n\t\tthis.chat.hydrateStreamingAssistantMessage(session.getStreamingMessage?.());\n\t\tthis.hydrateRunningTurn(session);\n\t\tthis.unsubscribe = session.subscribe?.((event) => {\n\t\t\tthis.chat.applyAgentEvent(event);\n\t\t\tthis.requestRender();\n\t\t});\n\t}\n\n\t/** A page opened mid-turn missed `agent_start` and `queue_update`, so it reads the turn and the queue now. */\n\tprivate hydrateRunningTurn(session: TaskTranscriptSource): void {\n\t\tif (session.isRunning?.() === true) this.chat.beginExternalPromptLifecycle();\n\t\tconst queued = session.getQueuedMessages?.();\n\t\tif (queued === undefined) return;\n\t\tthis.chat.applyAgentEvent({ type: \"queue_update\", steering: queued.steering, followUp: queued.followUp });\n\t}\n\n\tprivate loadEarlier(): void {\n\t\tconst cursor = this.cursor;\n\t\tif (cursor === undefined || this.loadingEarlier || this.loading || this.disposed) return;\n\t\tthis.loadingEarlier = true;\n\t\tvoid (async () => {\n\t\t\ttry {\n\t\t\t\tconst page = await settled(this.source.readTaskTranscript(this.taskId, cursor));\n\t\t\t\tif (this.disposed || cursor !== this.cursor) return;\n\t\t\t\tif (!page.ok) {\n\t\t\t\t\tthis.cursor = undefined;\n\t\t\t\t\tthis.status = page.error.message;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthis.cursor = page.value.nextCursor;\n\t\t\t\tthis.chat.prependMessages(page.value.messages);\n\t\t\t} catch (error) {\n\t\t\t\tif (this.disposed) return;\n\t\t\t\tthis.cursor = undefined;\n\t\t\t\tthis.status = error instanceof Error ? error.message : String(error);\n\t\t\t} finally {\n\t\t\t\tthis.loadingEarlier = false;\n\t\t\t\tthis.requestRender();\n\t\t\t}\n\t\t})();\n\t}\n\n\tprivate async send(text: string): Promise<void> {\n\t\tconst send = this.source.sendTaskMessage;\n\t\tif (send === undefined) throw new TaskMessageError(\"messages-unsupported\", { taskId: this.taskId });\n\t\ttry {\n\t\t\tawait send.call(this.source, this.taskId, text);\n\t\t} catch (error) {\n\t\t\tif (!this.disposed) throw error;\n\t\t\tthis.keepUndelivered(text, failureText(error));\n\t\t}\n\t}\n\n\t/** The reader left before the answer: report it once, and give the text back when they return. */\n\tprivate keepUndelivered(text: string, reason: string): void {\n\t\tconst kept = undeliveredMessages.get(this.source) ?? new Map<TaskId, UndeliveredMessage>();\n\t\tconst earlier = kept.get(this.taskId);\n\t\tkept.set(this.taskId, { text: earlier === undefined ? text : `${earlier.text}\\n${text}`, reason });\n\t\tundeliveredMessages.set(this.source, kept);\n\t\tthis.reportLate(reason);\n\t}\n\n\tprivate restoreUndelivered(): void {\n\t\tconst kept = undeliveredMessages.get(this.source);\n\t\tconst message = kept?.get(this.taskId);\n\t\tif (message === undefined) return;\n\t\tkept?.delete(this.taskId);\n\t\tthis.chat.setInputText(message.text);\n\t\tthis.chat.showWarning(message.reason);\n\t}\n}\n\n/** The retained tail of a shell task's output on the shared viewport. */\nexport class TaskCommandOutputPage implements TaskTranscriptPage {\n\tstatic readonly TAIL_BYTES = 8192;\n\tstatus = \"Loading output…\";\n\tprivate readonly source: TaskViewSource;\n\tprivate readonly taskId: TaskId;\n\tprivate readonly byteCount: () => bigint;\n\tprivate readonly requestRender: () => void;\n\tprivate readonly viewport: ScrollableComponentViewport;\n\tprivate output = new Text(\"\", 0, 0);\n\tprivate loading = false;\n\tprivate reloadPending = false;\n\tprivate disposed = false;\n\n\tconstructor(\n\t\tsource: TaskViewSource,\n\t\ttaskId: TaskId,\n\t\tbyteCount: () => bigint,\n\t\tenv: Pick<TaskTranscriptEnvironment, \"keybindings\" | \"getChatRenderSettings\"> | undefined,\n\t\trequestRender: () => void,\n\t) {\n\t\tthis.source = source;\n\t\tthis.taskId = taskId;\n\t\tthis.byteCount = byteCount;\n\t\tthis.requestRender = requestRender;\n\t\tthis.viewport = new ScrollableComponentViewport(env?.keybindings, {\n\t\t\twheelScrollLines: () => env?.getChatRenderSettings?.()?.fullscreenWheelScrollLines,\n\t\t\tscrollbar: () => env?.getChatRenderSettings?.()?.fullscreenScrollbar,\n\t\t\tscrollbarThumbStyle: (text) => theme.bg(\"scrollbarThumb\", text),\n\t\t\trequestRender,\n\t\t});\n\t\tthis.viewport.setComponents([this.output]);\n\t}\n\n\tasync load(): Promise<void> {\n\t\tif (this.loading) {\n\t\t\tthis.reloadPending = true;\n\t\t\treturn;\n\t\t}\n\t\tthis.loading = true;\n\t\tconst count = this.byteCount();\n\t\tconst tail = BigInt(TaskCommandOutputPage.TAIL_BYTES);\n\t\ttry {\n\t\t\tconst page = await this.source.readTaskOutput(this.taskId, {\n\t\t\t\tstart: String(count > tail ? count - tail : 0n),\n\t\t\t\tmaximumBytes: TaskCommandOutputPage.TAIL_BYTES,\n\t\t\t});\n\t\t\tif (this.disposed) return;\n\t\t\tconst text = page.ok ? page.value.text : page.error.message;\n\t\t\tthis.output = new Text(text.split(\"\\n\").map(taskDisplayText).join(\"\\n\") || \"No output available\", 0, 0);\n\t\t\tthis.viewport.setComponents([this.output]);\n\t\t\tthis.status = count > tail ? \"Earlier output omitted · showing retained 8 KiB tail\" : \"Retained shell output\";\n\t\t} catch (error) {\n\t\t\tif (!this.disposed) this.status = error instanceof Error ? error.message : String(error);\n\t\t} finally {\n\t\t\tthis.loading = false;\n\t\t\tthis.requestRender();\n\t\t\tif (this.reloadPending && !this.disposed) {\n\t\t\t\tthis.reloadPending = false;\n\t\t\t\tvoid this.load();\n\t\t\t}\n\t\t}\n\t}\n\n\trefresh(): void {\n\t\tif (!this.disposed) void this.load();\n\t}\n\n\thandleInput(data: string): boolean {\n\t\tconst handled = this.viewport.handleInput(data);\n\t\tif (handled) this.requestRender();\n\t\treturn handled;\n\t}\n\n\thasDraft(): boolean {\n\t\treturn false;\n\t}\n\n\thandlesBack(): boolean {\n\t\treturn false;\n\t}\n\n\trender(width: number, rows: number): string[] {\n\t\tthis.viewport.setVisibleRows(Math.max(1, rows));\n\t\treturn this.viewport.render(width);\n\t}\n\n\tinvalidate(): void {\n\t\tthis.viewport.invalidate();\n\t}\n\n\tdispose(): void {\n\t\tthis.disposed = true;\n\t\tthis.viewport.dispose();\n\t}\n}\n"]}
|
|
@@ -1,87 +1,12 @@
|
|
|
1
1
|
import { formatModelLabel } from "../../core/model-label.js";
|
|
2
2
|
import { getSkillCatalog } from "../../core/skill-catalog.js";
|
|
3
3
|
import { getInteractiveEngineRemoteCommandCompletions, getInteractiveEngineRemoteCommands, } from "../interactive-engine/extension-ui-bridge.js";
|
|
4
|
+
import { createChatAutocompleteProvider } from "./chat-autocomplete.js";
|
|
4
5
|
import { InteractiveModeBase } from "./interactive-mode-base.js";
|
|
5
|
-
import { BUILTIN_SLASH_COMMANDS, BUNDLED_EXTENSION_SLASH_COMMANDS,
|
|
6
|
+
import { BUILTIN_SLASH_COMMANDS, BUNDLED_EXTENSION_SLASH_COMMANDS, fuzzyFilter, getModelSearchText, } from "./interactive-mode-deps.js";
|
|
6
7
|
import { BUILTIN_SLASH_COMMAND_NAMES } from "./interactive-mode-helpers.js";
|
|
7
8
|
import { getLoginProviderCompletions } from "./login-provider-options.js";
|
|
8
9
|
import { getAutocompleteSourceTag, getSessionSkillCommands, prefixAutocompleteDescription, } from "./skill-command-autocomplete.js";
|
|
9
|
-
const AT_MENTION_PATH_DELIMITERS = new Set([" ", "\t", '"', "'", "="]);
|
|
10
|
-
function findLastAtMentionDelimiter(text) {
|
|
11
|
-
for (let index = text.length - 1; index >= 0; index -= 1) {
|
|
12
|
-
if (AT_MENTION_PATH_DELIMITERS.has(text[index] ?? ""))
|
|
13
|
-
return index;
|
|
14
|
-
}
|
|
15
|
-
return -1;
|
|
16
|
-
}
|
|
17
|
-
function isAtMentionTokenStart(text, index) {
|
|
18
|
-
return index === 0 || AT_MENTION_PATH_DELIMITERS.has(text[index - 1] ?? "");
|
|
19
|
-
}
|
|
20
|
-
function findUnclosedAtMentionQuoteStart(text) {
|
|
21
|
-
let quoteStart = -1;
|
|
22
|
-
let inQuotes = false;
|
|
23
|
-
for (let index = 0; index < text.length; index += 1) {
|
|
24
|
-
if (text[index] === '"') {
|
|
25
|
-
inQuotes = !inQuotes;
|
|
26
|
-
if (inQuotes)
|
|
27
|
-
quoteStart = index;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
return inQuotes ? quoteStart : null;
|
|
31
|
-
}
|
|
32
|
-
function extractAtMentionPrefix(textBeforeCursor) {
|
|
33
|
-
const quoteStart = findUnclosedAtMentionQuoteStart(textBeforeCursor);
|
|
34
|
-
if (quoteStart !== null && quoteStart > 0 && textBeforeCursor[quoteStart - 1] === "@") {
|
|
35
|
-
return isAtMentionTokenStart(textBeforeCursor, quoteStart - 1) ? textBeforeCursor.slice(quoteStart - 1) : null;
|
|
36
|
-
}
|
|
37
|
-
const lastDelimiterIndex = findLastAtMentionDelimiter(textBeforeCursor);
|
|
38
|
-
const tokenStart = lastDelimiterIndex === -1 ? 0 : lastDelimiterIndex + 1;
|
|
39
|
-
return textBeforeCursor[tokenStart] === "@" ? textBeforeCursor.slice(tokenStart) : null;
|
|
40
|
-
}
|
|
41
|
-
function atMentionPrefixToPathPrefix(atPrefix) {
|
|
42
|
-
return atPrefix.startsWith('@"') ? `"${atPrefix.slice(2)}` : atPrefix.slice(1);
|
|
43
|
-
}
|
|
44
|
-
function toAtMentionCompletion(item) {
|
|
45
|
-
return {
|
|
46
|
-
...item,
|
|
47
|
-
value: item.value.startsWith("@") ? item.value : `@${item.value}`,
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
class AtMentionFallbackAutocompleteProvider {
|
|
51
|
-
primary;
|
|
52
|
-
pathFallback;
|
|
53
|
-
constructor(primary, pathFallback) {
|
|
54
|
-
this.primary = primary;
|
|
55
|
-
this.pathFallback = pathFallback;
|
|
56
|
-
}
|
|
57
|
-
async getSuggestions(lines, cursorLine, cursorCol, options) {
|
|
58
|
-
const primarySuggestions = await this.primary.getSuggestions(lines, cursorLine, cursorCol, options);
|
|
59
|
-
if (primarySuggestions || options.signal.aborted)
|
|
60
|
-
return primarySuggestions;
|
|
61
|
-
const currentLine = lines[cursorLine] ?? "";
|
|
62
|
-
const textBeforeCursor = currentLine.slice(0, cursorCol);
|
|
63
|
-
const atPrefix = extractAtMentionPrefix(textBeforeCursor);
|
|
64
|
-
if (!atPrefix)
|
|
65
|
-
return null;
|
|
66
|
-
const pathPrefix = atMentionPrefixToPathPrefix(atPrefix);
|
|
67
|
-
const prefixStart = cursorCol - atPrefix.length;
|
|
68
|
-
const fallbackLines = [...lines];
|
|
69
|
-
fallbackLines[cursorLine] = `${currentLine.slice(0, prefixStart)}${pathPrefix}${currentLine.slice(cursorCol)}`;
|
|
70
|
-
const fallbackSuggestions = await this.pathFallback.getSuggestions(fallbackLines, cursorLine, prefixStart + pathPrefix.length, { ...options, force: true });
|
|
71
|
-
if (!fallbackSuggestions)
|
|
72
|
-
return null;
|
|
73
|
-
return {
|
|
74
|
-
prefix: atPrefix,
|
|
75
|
-
items: fallbackSuggestions.items.map(toAtMentionCompletion),
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
applyCompletion(lines, cursorLine, cursorCol, item, prefix) {
|
|
79
|
-
return this.primary.applyCompletion(lines, cursorLine, cursorCol, item, prefix);
|
|
80
|
-
}
|
|
81
|
-
shouldTriggerFileCompletion(lines, cursorLine, cursorCol) {
|
|
82
|
-
return this.primary.shouldTriggerFileCompletion?.(lines, cursorLine, cursorCol) ?? true;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
10
|
InteractiveModeBase.prototype.getAutocompleteSourceTag = function (sourceInfo) {
|
|
86
11
|
return getAutocompleteSourceTag(sourceInfo);
|
|
87
12
|
};
|
|
@@ -258,8 +183,7 @@ InteractiveModeBase.prototype.createBaseAutocompleteProvider = function () {
|
|
|
258
183
|
...skillCommandList,
|
|
259
184
|
...remoteCommandList,
|
|
260
185
|
];
|
|
261
|
-
|
|
262
|
-
return new AtMentionFallbackAutocompleteProvider(new CombinedAutocompleteProvider(commands, cwd, this.fdPath), new CombinedAutocompleteProvider(commands, cwd, null));
|
|
186
|
+
return createChatAutocompleteProvider(commands, this.sessionManager.getCwd(), this.fdPath);
|
|
263
187
|
};
|
|
264
188
|
InteractiveModeBase.prototype.setupAutocompleteProvider = function () {
|
|
265
189
|
let provider = this.createBaseAutocompleteProvider();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-autocomplete.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-autocomplete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EACN,4CAA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QACnB,GAAG,iBAAiB;QACpB,GAAG,gBAAgB;KACnB,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG;QAChB,GAAG,aAAa;QAChB,GAAG,gBAAgB;QACnB,GAAG,iBAAiB;QACpB,GAAG,gBAAgB;QACnB,GAAG,iBAAiB;KACpB,CAAC;IACF,MAAM,GAAG,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC;IACzC,OAAO,IAAI,qCAAqC,CAC/C,IAAI,4BAA4B,CAAC,QAAQ,EAAE,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,EAC5D,IAAI,4BAA4B,CAAC,QAAQ,EAAE,GAAG,EAAE,IAAI,CAAC,CACrD,CAAC;AACH,CAAC,CAAC;AAEF,mBAAmB,CAAC,SAAS,CAAC,yBAAyB,GAAG;IACzD,IAAI,QAAQ,GAAG,IAAI,CAAC,8BAA8B,EAAE,CAAC;IACrD,KAAK,MAAM,YAAY,IAAI,IAAI,CAAC,4BAA4B,EAAE,CAAC;QAC9D,QAAQ,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC;IAED,IAAI,CAAC,oBAAoB,GAAG,QAAQ,CAAC;IACrC,IAAI,CAAC,aAAa,CAAC,uBAAuB,CAAC,QAAQ,CAAC,CAAC;IACrD,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,aAAa,EAAE,CAAC;QACxC,IAAI,CAAC,MAAM,CAAC,uBAAuB,EAAE,CAAC,QAAQ,CAAC,CAAC;IACjD,CAAC;AACF,CAAC,CAAC","sourcesContent":["import { formatModelLabel } from \"../../core/model-label.ts\";\nimport { getSkillCatalog } from \"../../core/skill-catalog.ts\";\nimport {\n\tgetInteractiveEngineRemoteCommandCompletions,\n\tgetInteractiveEngineRemoteCommands,\n} from \"../interactive-engine/extension-ui-bridge.ts\";\nimport { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport {\n\ttype AutocompleteItem,\n\ttype AutocompleteProvider,\n\ttype AutocompleteSuggestions,\n\tBUILTIN_SLASH_COMMANDS,\n\tBUNDLED_EXTENSION_SLASH_COMMANDS,\n\tCombinedAutocompleteProvider,\n\ttype ExtensionRunner,\n\tfuzzyFilter,\n\tgetModelSearchText,\n\ttype ResourceDiagnostic,\n\ttype SlashCommand,\n\ttype SourceInfo,\n} from \"./interactive-mode-deps.ts\";\nimport { BUILTIN_SLASH_COMMAND_NAMES } from \"./interactive-mode-helpers.ts\";\nimport { getLoginProviderCompletions } from \"./login-provider-options.ts\";\nimport {\n\tgetAutocompleteSourceTag,\n\tgetSessionSkillCommands,\n\tprefixAutocompleteDescription,\n} from \"./skill-command-autocomplete.ts\";\n\nconst AT_MENTION_PATH_DELIMITERS = new Set([\" \", \"\\t\", '\"', \"'\", \"=\"]);\n\nfunction findLastAtMentionDelimiter(text: string): number {\n\tfor (let index = text.length - 1; index >= 0; index -= 1) {\n\t\tif (AT_MENTION_PATH_DELIMITERS.has(text[index] ?? \"\")) return index;\n\t}\n\treturn -1;\n}\n\nfunction isAtMentionTokenStart(text: string, index: number): boolean {\n\treturn index === 0 || AT_MENTION_PATH_DELIMITERS.has(text[index - 1] ?? \"\");\n}\n\nfunction findUnclosedAtMentionQuoteStart(text: string): number | null {\n\tlet quoteStart = -1;\n\tlet inQuotes = false;\n\tfor (let index = 0; index < text.length; index += 1) {\n\t\tif (text[index] === '\"') {\n\t\t\tinQuotes = !inQuotes;\n\t\t\tif (inQuotes) quoteStart = index;\n\t\t}\n\t}\n\treturn inQuotes ? quoteStart : null;\n}\n\nfunction extractAtMentionPrefix(textBeforeCursor: string): string | null {\n\tconst quoteStart = findUnclosedAtMentionQuoteStart(textBeforeCursor);\n\tif (quoteStart !== null && quoteStart > 0 && textBeforeCursor[quoteStart - 1] === \"@\") {\n\t\treturn isAtMentionTokenStart(textBeforeCursor, quoteStart - 1) ? textBeforeCursor.slice(quoteStart - 1) : null;\n\t}\n\tconst lastDelimiterIndex = findLastAtMentionDelimiter(textBeforeCursor);\n\tconst tokenStart = lastDelimiterIndex === -1 ? 0 : lastDelimiterIndex + 1;\n\treturn textBeforeCursor[tokenStart] === \"@\" ? textBeforeCursor.slice(tokenStart) : null;\n}\n\nfunction atMentionPrefixToPathPrefix(atPrefix: string): string {\n\treturn atPrefix.startsWith('@\"') ? `\"${atPrefix.slice(2)}` : atPrefix.slice(1);\n}\n\nfunction toAtMentionCompletion(item: AutocompleteItem): AutocompleteItem {\n\treturn {\n\t\t...item,\n\t\tvalue: item.value.startsWith(\"@\") ? item.value : `@${item.value}`,\n\t};\n}\n\nclass AtMentionFallbackAutocompleteProvider implements AutocompleteProvider {\n\tprivate readonly primary: AutocompleteProvider;\n\tprivate readonly pathFallback: AutocompleteProvider;\n\n\tconstructor(primary: AutocompleteProvider, pathFallback: AutocompleteProvider) {\n\t\tthis.primary = primary;\n\t\tthis.pathFallback = pathFallback;\n\t}\n\n\tasync getSuggestions(\n\t\tlines: string[],\n\t\tcursorLine: number,\n\t\tcursorCol: number,\n\t\toptions: { signal: AbortSignal; force?: boolean },\n\t): Promise<AutocompleteSuggestions | null> {\n\t\tconst primarySuggestions = await this.primary.getSuggestions(lines, cursorLine, cursorCol, options);\n\t\tif (primarySuggestions || options.signal.aborted) return primarySuggestions;\n\n\t\tconst currentLine = lines[cursorLine] ?? \"\";\n\t\tconst textBeforeCursor = currentLine.slice(0, cursorCol);\n\t\tconst atPrefix = extractAtMentionPrefix(textBeforeCursor);\n\t\tif (!atPrefix) return null;\n\n\t\tconst pathPrefix = atMentionPrefixToPathPrefix(atPrefix);\n\t\tconst prefixStart = cursorCol - atPrefix.length;\n\t\tconst fallbackLines = [...lines];\n\t\tfallbackLines[cursorLine] = `${currentLine.slice(0, prefixStart)}${pathPrefix}${currentLine.slice(cursorCol)}`;\n\t\tconst fallbackSuggestions = await this.pathFallback.getSuggestions(\n\t\t\tfallbackLines,\n\t\t\tcursorLine,\n\t\t\tprefixStart + pathPrefix.length,\n\t\t\t{ ...options, force: true },\n\t\t);\n\t\tif (!fallbackSuggestions) return null;\n\n\t\treturn {\n\t\t\tprefix: atPrefix,\n\t\t\titems: fallbackSuggestions.items.map(toAtMentionCompletion),\n\t\t};\n\t}\n\n\tapplyCompletion(\n\t\tlines: string[],\n\t\tcursorLine: number,\n\t\tcursorCol: number,\n\t\titem: AutocompleteItem,\n\t\tprefix: string,\n\t): { lines: string[]; cursorLine: number; cursorCol: number } {\n\t\treturn this.primary.applyCompletion(lines, cursorLine, cursorCol, item, prefix);\n\t}\n\n\tshouldTriggerFileCompletion(lines: string[], cursorLine: number, cursorCol: number): boolean {\n\t\treturn this.primary.shouldTriggerFileCompletion?.(lines, cursorLine, cursorCol) ?? true;\n\t}\n}\n\nInteractiveModeBase.prototype.getAutocompleteSourceTag = function (\n\tthis: InteractiveModeBase,\n\tsourceInfo?: SourceInfo,\n): string | undefined {\n\treturn getAutocompleteSourceTag(sourceInfo);\n};\n\nInteractiveModeBase.prototype.prefixAutocompleteDescription = function (\n\tthis: InteractiveModeBase,\n\tdescription: string | undefined,\n\tsourceInfo?: SourceInfo,\n): string | undefined {\n\treturn prefixAutocompleteDescription(description, sourceInfo);\n};\n\nInteractiveModeBase.prototype.getBuiltInCommandConflictDiagnostics = function (\n\tthis: InteractiveModeBase,\n\textensionRunner: ExtensionRunner,\n): ResourceDiagnostic[] {\n\treturn extensionRunner\n\t\t.getRegisteredCommands()\n\t\t.filter((command) => BUILTIN_SLASH_COMMAND_NAMES.has(command.name))\n\t\t.map((command) => ({\n\t\t\ttype: \"warning\" as const,\n\t\t\tmessage:\n\t\t\t\tcommand.invocationName === command.name\n\t\t\t\t\t? `Extension command '/${command.name}' conflicts with built-in interactive command. Skipping in autocomplete.`\n\t\t\t\t\t: `Extension command '/${command.name}' conflicts with built-in interactive command. Available as '/${command.invocationName}'.`,\n\t\t\tpath: command.sourceInfo.path,\n\t\t}));\n};\n\nInteractiveModeBase.prototype.buildRemoteSlashCommands = function (\n\tthis: InteractiveModeBase,\n\tlocalCommands: SlashCommand[],\n): SlashCommand[] {\n\tconst remote = getInteractiveEngineRemoteCommands(this.runtimeHost);\n\tif (remote.length === 0) return [];\n\n\t// Names already present locally (built-ins, prompt templates, skills) win, so\n\t// the child catalog only contributes commands the host is genuinely missing.\n\tconst takenNames = new Set<string>(localCommands.map((command) => command.name));\n\tconst skillCommandsEnabled = this.settingsManager.getEnableSkillCommands();\n\t// Reuse bundled argument-completion providers (e.g. /workflow subcommands and\n\t// input schemas) for their matching child commands; RPC cannot serialize the\n\t// completion callbacks themselves.\n\tconst bundledArgumentCompletions = new Map(\n\t\tBUNDLED_EXTENSION_SLASH_COMMANDS.map((command) => [command.name, command.getArgumentCompletions] as const),\n\t);\n\n\tconst remoteCommands: SlashCommand[] = [];\n\tfor (const command of remote) {\n\t\t// Built-in interactive command names stay reserved regardless of source.\n\t\tif (BUILTIN_SLASH_COMMAND_NAMES.has(command.name)) continue;\n\t\t// Honor the skill-commands setting for child-provided skills too.\n\t\tif (command.source === \"skill\" && !skillCommandsEnabled) continue;\n\t\tif (takenNames.has(command.name)) continue;\n\t\ttakenNames.add(command.name);\n\t\tconst bundledCompletions = bundledArgumentCompletions.get(command.name);\n\t\tconst getArgumentCompletions = command.hasArgumentCompletions\n\t\t\t? async (prefix: string): Promise<AutocompleteItem[] | null> => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\treturn await getInteractiveEngineRemoteCommandCompletions(this.runtimeHost, command.name, prefix);\n\t\t\t\t\t} catch {\n\t\t\t\t\t\treturn (await bundledCompletions?.(prefix)) ?? null;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t: bundledCompletions;\n\t\tremoteCommands.push({\n\t\t\tname: command.name,\n\t\t\tdescription: this.prefixAutocompleteDescription(command.description, command.sourceInfo),\n\t\t\t...(getArgumentCompletions ? { getArgumentCompletions } : {}),\n\t\t});\n\t}\n\treturn remoteCommands;\n};\n\nInteractiveModeBase.prototype.createBaseAutocompleteProvider = function (\n\tthis: InteractiveModeBase,\n): AutocompleteProvider {\n\t// Define commands for autocomplete\n\tconst slashCommands: SlashCommand[] = BUILTIN_SLASH_COMMANDS.map((command) => ({\n\t\tname: command.name,\n\t\targumentHint: command.argumentHint,\n\t\tdescription: command.description,\n\t\tgetArgumentCompletions: command.getArgumentCompletions,\n\t}));\n\n\tconst modelCommand = slashCommands.find((command) => command.name === \"model\");\n\tif (modelCommand) {\n\t\tmodelCommand.getArgumentCompletions = (prefix: string): AutocompleteItem[] | null => {\n\t\t\t// Get available models (scoped or from registry)\n\t\t\tconst models =\n\t\t\t\tthis.session.scopedModels.length > 0\n\t\t\t\t\t? this.session.scopedModels.map((s) => s.model)\n\t\t\t\t\t: this.session.modelRuntime.getAvailableSnapshot();\n\n\t\t\tif (models.length === 0) return null;\n\n\t\t\t// Create items with provider/id format\n\t\t\tconst items = models.map((m) => ({\n\t\t\t\tid: m.id,\n\t\t\t\tprovider: m.provider,\n\t\t\t\tname: m.name,\n\t\t\t\tlabel: formatModelLabel(m),\n\t\t\t}));\n\n\t\t\t// Fuzzy filter by model ID + provider in either order, or by display name.\n\t\t\tconst filtered = fuzzyFilter(items, prefix, getModelSearchText);\n\n\t\t\tif (filtered.length === 0) return null;\n\n\t\t\t// The label is the raw provider/id the completion inserts; a display name is secondary metadata (#4269).\n\t\t\treturn filtered.map((item) => ({\n\t\t\t\tvalue: item.label,\n\t\t\t\tlabel: item.label,\n\t\t\t\t...(item.name ? { description: item.name } : {}),\n\t\t\t}));\n\t\t};\n\t}\n\n\tconst thinkingCommand = slashCommands.find((command) => command.name === \"thinking\");\n\tif (thinkingCommand) {\n\t\tthinkingCommand.getArgumentCompletions = (prefix: string): AutocompleteItem[] | null => {\n\t\t\tconst levels = fuzzyFilter(this.session.getAvailableThinkingLevels(), prefix, (level) => level);\n\t\t\tif (levels.length === 0) return null;\n\t\t\treturn levels.map((level) => ({ value: level, label: level }));\n\t\t};\n\t}\n\n\tconst loginCommand = slashCommands.find((command) => command.name === \"login\");\n\tif (loginCommand) {\n\t\tloginCommand.getArgumentCompletions = (prefix: string) =>\n\t\t\tgetLoginProviderCompletions(this.getLoginProviderOptions(), prefix);\n\t}\n\n\tconst logoutCommand = slashCommands.find((command) => command.name === \"logout\");\n\tif (logoutCommand) {\n\t\tlogoutCommand.getArgumentCompletions = (prefix: string) =>\n\t\t\tgetLoginProviderCompletions(this.getLogoutProviderOptions(), prefix);\n\t}\n\n\t// Convert prompt templates to SlashCommand format for autocomplete\n\tconst templateCommands: SlashCommand[] = this.session.promptTemplates.map((cmd) => ({\n\t\tname: cmd.name,\n\t\tdescription: this.prefixAutocompleteDescription(cmd.description, cmd.sourceInfo),\n\t\t...(cmd.argumentHint && { argumentHint: cmd.argumentHint }),\n\t}));\n\n\t// Convert extension commands to SlashCommand format. Built-in command names\n\t// stay reserved even when a built-in is contextually hidden, so extension\n\t// visibility cannot change as auth/model state changes. While extension\n\t// loading is deferred,\n\t// expose lightweight bundled command metadata without importing heavy\n\t// implementations; the submit path loads the implementation on demand.\n\tconst registeredExtensionCommands = this.session.extensionRunner\n\t\t.getRegisteredCommands()\n\t\t.filter((cmd) => !BUILTIN_SLASH_COMMAND_NAMES.has(cmd.name));\n\tconst registeredNames = new Set(registeredExtensionCommands.map((cmd) => cmd.invocationName));\n\tconst extensionCommands: SlashCommand[] = [\n\t\t...(this.deferredStartupPending\n\t\t\t? BUNDLED_EXTENSION_SLASH_COMMANDS.filter(\n\t\t\t\t\t(cmd) => !BUILTIN_SLASH_COMMAND_NAMES.has(cmd.name) && !registeredNames.has(cmd.name),\n\t\t\t\t).map((cmd) => ({\n\t\t\t\t\tname: cmd.name,\n\t\t\t\t\tdescription: cmd.description,\n\t\t\t\t\tgetArgumentCompletions: cmd.getArgumentCompletions,\n\t\t\t\t}))\n\t\t\t: []),\n\t\t...registeredExtensionCommands.map((cmd) => ({\n\t\t\tname: cmd.invocationName,\n\t\t\tdescription: this.prefixAutocompleteDescription(cmd.description, cmd.sourceInfo),\n\t\t\tgetArgumentCompletions: cmd.getArgumentCompletions,\n\t\t})),\n\t];\n\n\t// Build skill commands from session.skills (if enabled)\n\tthis.skillCommands.clear();\n\tconst skillCommandList = getSessionSkillCommands({\n\t\tresourceLoader: this.session.resourceLoader,\n\t\tsettingsManager: this.settingsManager,\n\t});\n\tif (this.settingsManager.getEnableSkillCommands()) {\n\t\tfor (const command of getSkillCatalog(this.session.resourceLoader).commands) {\n\t\t\tthis.skillCommands.set(`skill:${command.name}`, command.skill.filePath);\n\t\t}\n\t}\n\n\t// In the isolated interactive host (isolateInteractiveHost) the host session\n\t// loads no extensions, so extension slash commands (/workflow, /workflows,\n\t// /run, /mcp, …) exist only in the engine child. Merge the child's command\n\t// catalog — fetched asynchronously after engine bind — so autocomplete lists\n\t// them. Built-in names stay reserved and anything already present locally\n\t// (built-ins, prompt templates, skills the host also loaded) is deduped, so\n\t// only genuinely engine-only commands are added. Execution keeps routing\n\t// through the child via the patched session.prompt(); nothing is handled\n\t// twice on the host.\n\tconst remoteCommandList = this.buildRemoteSlashCommands([\n\t\t...slashCommands,\n\t\t...templateCommands,\n\t\t...extensionCommands,\n\t\t...skillCommandList,\n\t]);\n\n\tconst commands = [\n\t\t...slashCommands,\n\t\t...templateCommands,\n\t\t...extensionCommands,\n\t\t...skillCommandList,\n\t\t...remoteCommandList,\n\t];\n\tconst cwd = this.sessionManager.getCwd();\n\treturn new AtMentionFallbackAutocompleteProvider(\n\t\tnew CombinedAutocompleteProvider(commands, cwd, this.fdPath),\n\t\tnew CombinedAutocompleteProvider(commands, cwd, null),\n\t);\n};\n\nInteractiveModeBase.prototype.setupAutocompleteProvider = function (this: InteractiveModeBase): void {\n\tlet provider = this.createBaseAutocompleteProvider();\n\tfor (const wrapProvider of this.autocompleteProviderWrappers) {\n\t\tprovider = wrapProvider(provider);\n\t}\n\n\tthis.autocompleteProvider = provider;\n\tthis.defaultEditor.setAutocompleteProvider(provider);\n\tif (this.editor !== this.defaultEditor) {\n\t\tthis.editor.setAutocompleteProvider?.(provider);\n\t}\n};\n"]}
|
|
1
|
+
{"version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AG,iBAAiB;QACpB,GAAG,gBAAgB;QACnB,GAAG,iBAAiB;KACpB,CAAC;IACF,OAAO,8BAA8B,CAAC,QAAQ,EAAE,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;AAC5F,CAAC,CAAC;AAEF,mBAAmB,CAAC,SAAS,CAAC,yBAAyB,GAAG;IACzD,IAAI,QAAQ,GAAG,IAAI,CAAC,8BAA8B,EAAE,CAAC;IACrD,KAAK,MAAM,YAAY,IAAI,IAAI,CAAC,4BAA4B,EAAE,CAAC;QAC9D,QAAQ,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC;IAED,IAAI,CAAC,oBAAoB,GAAG,QAAQ,CAAC;IACrC,IAAI,CAAC,aAAa,CAAC,uBAAuB,CAAC,QAAQ,CAAC,CAAC;IACrD,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,aAAa,EAAE,CAAC;QACxC,IAAI,CAAC,MAAM,CAAC,uBAAuB,EAAE,CAAC,QAAQ,CAAC,CAAC;IACjD,CAAC;AACF,CAAC,CAAC","sourcesContent":["import { formatModelLabel } from \"../../core/model-label.ts\";\nimport { getSkillCatalog } from \"../../core/skill-catalog.ts\";\nimport {\n\tgetInteractiveEngineRemoteCommandCompletions,\n\tgetInteractiveEngineRemoteCommands,\n} from \"../interactive-engine/extension-ui-bridge.ts\";\nimport { createChatAutocompleteProvider } from \"./chat-autocomplete.ts\";\nimport { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport {\n\ttype AutocompleteItem,\n\ttype AutocompleteProvider,\n\tBUILTIN_SLASH_COMMANDS,\n\tBUNDLED_EXTENSION_SLASH_COMMANDS,\n\ttype ExtensionRunner,\n\tfuzzyFilter,\n\tgetModelSearchText,\n\ttype ResourceDiagnostic,\n\ttype SlashCommand,\n\ttype SourceInfo,\n} from \"./interactive-mode-deps.ts\";\nimport { BUILTIN_SLASH_COMMAND_NAMES } from \"./interactive-mode-helpers.ts\";\nimport { getLoginProviderCompletions } from \"./login-provider-options.ts\";\nimport {\n\tgetAutocompleteSourceTag,\n\tgetSessionSkillCommands,\n\tprefixAutocompleteDescription,\n} from \"./skill-command-autocomplete.ts\";\n\nInteractiveModeBase.prototype.getAutocompleteSourceTag = function (\n\tthis: InteractiveModeBase,\n\tsourceInfo?: SourceInfo,\n): string | undefined {\n\treturn getAutocompleteSourceTag(sourceInfo);\n};\n\nInteractiveModeBase.prototype.prefixAutocompleteDescription = function (\n\tthis: InteractiveModeBase,\n\tdescription: string | undefined,\n\tsourceInfo?: SourceInfo,\n): string | undefined {\n\treturn prefixAutocompleteDescription(description, sourceInfo);\n};\n\nInteractiveModeBase.prototype.getBuiltInCommandConflictDiagnostics = function (\n\tthis: InteractiveModeBase,\n\textensionRunner: ExtensionRunner,\n): ResourceDiagnostic[] {\n\treturn extensionRunner\n\t\t.getRegisteredCommands()\n\t\t.filter((command) => BUILTIN_SLASH_COMMAND_NAMES.has(command.name))\n\t\t.map((command) => ({\n\t\t\ttype: \"warning\" as const,\n\t\t\tmessage:\n\t\t\t\tcommand.invocationName === command.name\n\t\t\t\t\t? `Extension command '/${command.name}' conflicts with built-in interactive command. Skipping in autocomplete.`\n\t\t\t\t\t: `Extension command '/${command.name}' conflicts with built-in interactive command. Available as '/${command.invocationName}'.`,\n\t\t\tpath: command.sourceInfo.path,\n\t\t}));\n};\n\nInteractiveModeBase.prototype.buildRemoteSlashCommands = function (\n\tthis: InteractiveModeBase,\n\tlocalCommands: SlashCommand[],\n): SlashCommand[] {\n\tconst remote = getInteractiveEngineRemoteCommands(this.runtimeHost);\n\tif (remote.length === 0) return [];\n\n\t// Names already present locally (built-ins, prompt templates, skills) win, so\n\t// the child catalog only contributes commands the host is genuinely missing.\n\tconst takenNames = new Set<string>(localCommands.map((command) => command.name));\n\tconst skillCommandsEnabled = this.settingsManager.getEnableSkillCommands();\n\t// Reuse bundled argument-completion providers (e.g. /workflow subcommands and\n\t// input schemas) for their matching child commands; RPC cannot serialize the\n\t// completion callbacks themselves.\n\tconst bundledArgumentCompletions = new Map(\n\t\tBUNDLED_EXTENSION_SLASH_COMMANDS.map((command) => [command.name, command.getArgumentCompletions] as const),\n\t);\n\n\tconst remoteCommands: SlashCommand[] = [];\n\tfor (const command of remote) {\n\t\t// Built-in interactive command names stay reserved regardless of source.\n\t\tif (BUILTIN_SLASH_COMMAND_NAMES.has(command.name)) continue;\n\t\t// Honor the skill-commands setting for child-provided skills too.\n\t\tif (command.source === \"skill\" && !skillCommandsEnabled) continue;\n\t\tif (takenNames.has(command.name)) continue;\n\t\ttakenNames.add(command.name);\n\t\tconst bundledCompletions = bundledArgumentCompletions.get(command.name);\n\t\tconst getArgumentCompletions = command.hasArgumentCompletions\n\t\t\t? async (prefix: string): Promise<AutocompleteItem[] | null> => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\treturn await getInteractiveEngineRemoteCommandCompletions(this.runtimeHost, command.name, prefix);\n\t\t\t\t\t} catch {\n\t\t\t\t\t\treturn (await bundledCompletions?.(prefix)) ?? null;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t: bundledCompletions;\n\t\tremoteCommands.push({\n\t\t\tname: command.name,\n\t\t\tdescription: this.prefixAutocompleteDescription(command.description, command.sourceInfo),\n\t\t\t...(getArgumentCompletions ? { getArgumentCompletions } : {}),\n\t\t});\n\t}\n\treturn remoteCommands;\n};\n\nInteractiveModeBase.prototype.createBaseAutocompleteProvider = function (\n\tthis: InteractiveModeBase,\n): AutocompleteProvider {\n\t// Define commands for autocomplete\n\tconst slashCommands: SlashCommand[] = BUILTIN_SLASH_COMMANDS.map((command) => ({\n\t\tname: command.name,\n\t\targumentHint: command.argumentHint,\n\t\tdescription: command.description,\n\t\tgetArgumentCompletions: command.getArgumentCompletions,\n\t}));\n\n\tconst modelCommand = slashCommands.find((command) => command.name === \"model\");\n\tif (modelCommand) {\n\t\tmodelCommand.getArgumentCompletions = (prefix: string): AutocompleteItem[] | null => {\n\t\t\t// Get available models (scoped or from registry)\n\t\t\tconst models =\n\t\t\t\tthis.session.scopedModels.length > 0\n\t\t\t\t\t? this.session.scopedModels.map((s) => s.model)\n\t\t\t\t\t: this.session.modelRuntime.getAvailableSnapshot();\n\n\t\t\tif (models.length === 0) return null;\n\n\t\t\t// Create items with provider/id format\n\t\t\tconst items = models.map((m) => ({\n\t\t\t\tid: m.id,\n\t\t\t\tprovider: m.provider,\n\t\t\t\tname: m.name,\n\t\t\t\tlabel: formatModelLabel(m),\n\t\t\t}));\n\n\t\t\t// Fuzzy filter by model ID + provider in either order, or by display name.\n\t\t\tconst filtered = fuzzyFilter(items, prefix, getModelSearchText);\n\n\t\t\tif (filtered.length === 0) return null;\n\n\t\t\t// The label is the raw provider/id the completion inserts; a display name is secondary metadata (#4269).\n\t\t\treturn filtered.map((item) => ({\n\t\t\t\tvalue: item.label,\n\t\t\t\tlabel: item.label,\n\t\t\t\t...(item.name ? { description: item.name } : {}),\n\t\t\t}));\n\t\t};\n\t}\n\n\tconst thinkingCommand = slashCommands.find((command) => command.name === \"thinking\");\n\tif (thinkingCommand) {\n\t\tthinkingCommand.getArgumentCompletions = (prefix: string): AutocompleteItem[] | null => {\n\t\t\tconst levels = fuzzyFilter(this.session.getAvailableThinkingLevels(), prefix, (level) => level);\n\t\t\tif (levels.length === 0) return null;\n\t\t\treturn levels.map((level) => ({ value: level, label: level }));\n\t\t};\n\t}\n\n\tconst loginCommand = slashCommands.find((command) => command.name === \"login\");\n\tif (loginCommand) {\n\t\tloginCommand.getArgumentCompletions = (prefix: string) =>\n\t\t\tgetLoginProviderCompletions(this.getLoginProviderOptions(), prefix);\n\t}\n\n\tconst logoutCommand = slashCommands.find((command) => command.name === \"logout\");\n\tif (logoutCommand) {\n\t\tlogoutCommand.getArgumentCompletions = (prefix: string) =>\n\t\t\tgetLoginProviderCompletions(this.getLogoutProviderOptions(), prefix);\n\t}\n\n\t// Convert prompt templates to SlashCommand format for autocomplete\n\tconst templateCommands: SlashCommand[] = this.session.promptTemplates.map((cmd) => ({\n\t\tname: cmd.name,\n\t\tdescription: this.prefixAutocompleteDescription(cmd.description, cmd.sourceInfo),\n\t\t...(cmd.argumentHint && { argumentHint: cmd.argumentHint }),\n\t}));\n\n\t// Convert extension commands to SlashCommand format. Built-in command names\n\t// stay reserved even when a built-in is contextually hidden, so extension\n\t// visibility cannot change as auth/model state changes. While extension\n\t// loading is deferred,\n\t// expose lightweight bundled command metadata without importing heavy\n\t// implementations; the submit path loads the implementation on demand.\n\tconst registeredExtensionCommands = this.session.extensionRunner\n\t\t.getRegisteredCommands()\n\t\t.filter((cmd) => !BUILTIN_SLASH_COMMAND_NAMES.has(cmd.name));\n\tconst registeredNames = new Set(registeredExtensionCommands.map((cmd) => cmd.invocationName));\n\tconst extensionCommands: SlashCommand[] = [\n\t\t...(this.deferredStartupPending\n\t\t\t? BUNDLED_EXTENSION_SLASH_COMMANDS.filter(\n\t\t\t\t\t(cmd) => !BUILTIN_SLASH_COMMAND_NAMES.has(cmd.name) && !registeredNames.has(cmd.name),\n\t\t\t\t).map((cmd) => ({\n\t\t\t\t\tname: cmd.name,\n\t\t\t\t\tdescription: cmd.description,\n\t\t\t\t\tgetArgumentCompletions: cmd.getArgumentCompletions,\n\t\t\t\t}))\n\t\t\t: []),\n\t\t...registeredExtensionCommands.map((cmd) => ({\n\t\t\tname: cmd.invocationName,\n\t\t\tdescription: this.prefixAutocompleteDescription(cmd.description, cmd.sourceInfo),\n\t\t\tgetArgumentCompletions: cmd.getArgumentCompletions,\n\t\t})),\n\t];\n\n\t// Build skill commands from session.skills (if enabled)\n\tthis.skillCommands.clear();\n\tconst skillCommandList = getSessionSkillCommands({\n\t\tresourceLoader: this.session.resourceLoader,\n\t\tsettingsManager: this.settingsManager,\n\t});\n\tif (this.settingsManager.getEnableSkillCommands()) {\n\t\tfor (const command of getSkillCatalog(this.session.resourceLoader).commands) {\n\t\t\tthis.skillCommands.set(`skill:${command.name}`, command.skill.filePath);\n\t\t}\n\t}\n\n\t// In the isolated interactive host (isolateInteractiveHost) the host session\n\t// loads no extensions, so extension slash commands (/workflow, /workflows,\n\t// /run, /mcp, …) exist only in the engine child. Merge the child's command\n\t// catalog — fetched asynchronously after engine bind — so autocomplete lists\n\t// them. Built-in names stay reserved and anything already present locally\n\t// (built-ins, prompt templates, skills the host also loaded) is deduped, so\n\t// only genuinely engine-only commands are added. Execution keeps routing\n\t// through the child via the patched session.prompt(); nothing is handled\n\t// twice on the host.\n\tconst remoteCommandList = this.buildRemoteSlashCommands([\n\t\t...slashCommands,\n\t\t...templateCommands,\n\t\t...extensionCommands,\n\t\t...skillCommandList,\n\t]);\n\n\tconst commands = [\n\t\t...slashCommands,\n\t\t...templateCommands,\n\t\t...extensionCommands,\n\t\t...skillCommandList,\n\t\t...remoteCommandList,\n\t];\n\treturn createChatAutocompleteProvider(commands, this.sessionManager.getCwd(), this.fdPath);\n};\n\nInteractiveModeBase.prototype.setupAutocompleteProvider = function (this: InteractiveModeBase): void {\n\tlet provider = this.createBaseAutocompleteProvider();\n\tfor (const wrapProvider of this.autocompleteProviderWrappers) {\n\t\tprovider = wrapProvider(provider);\n\t}\n\n\tthis.autocompleteProvider = provider;\n\tthis.defaultEditor.setAutocompleteProvider(provider);\n\tif (this.editor !== this.defaultEditor) {\n\t\tthis.editor.setAutocompleteProvider?.(provider);\n\t}\n};\n"]}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { type AutocompleteProvider, type SlashCommand } from "@earendil-works/pi-tui";
|
|
2
2
|
import type { AgentSession } from "../../core/agent-session.js";
|
|
3
|
+
import { type SkillCatalogCommand } from "../../core/skill-catalog.ts";
|
|
3
4
|
import type { SourceInfo } from "../../core/source-info.ts";
|
|
4
5
|
export declare function getAutocompleteSourceTag(sourceInfo?: SourceInfo): string | undefined;
|
|
5
6
|
export declare function prefixAutocompleteDescription(description: string | undefined, sourceInfo?: SourceInfo): string | undefined;
|
|
6
7
|
/** Discovery only. Typed commands still use the session's ordinary expansion path. */
|
|
7
8
|
export declare function getSessionSkillCommands(session: Pick<AgentSession, "settingsManager" | "resourceLoader">): SlashCommand[];
|
|
9
|
+
/** Skill commands as a chat's completion lists them: `skill:<name>`, described with their source. */
|
|
10
|
+
export declare function getSkillCatalogCommands(commands: readonly Pick<SkillCatalogCommand, "name" | "description" | "sourceInfo">[]): SlashCommand[];
|
|
8
11
|
/**
|
|
9
12
|
* The slash commands a session offers to a chat that shows it from another process, such as a
|
|
10
13
|
* workflow stage running on a local worker: plain data, so it can cross a process boundary.
|
|
@@ -22,6 +25,9 @@ export interface PendingSessionCommandCatalog {
|
|
|
22
25
|
/** Captures a live session's command catalog where the session runs. */
|
|
23
26
|
export declare function getSessionCommandCatalog(session: Pick<AgentSession, "settingsManager" | "resourceLoader" | "sessionManager">): SessionCommandCatalog;
|
|
24
27
|
/**
|
|
28
|
+
* The completion of a chat whose session the main chat does not own, such as a workflow stage's or a subagent's:
|
|
29
|
+
* `/tasks`, the session's skill commands, and `@` and Tab paths under the session's cwd.
|
|
30
|
+
*
|
|
25
31
|
* Resolve again for every completion so lazy attachment and resource reload cannot leave a stale catalog.
|
|
26
32
|
* `resolveSession` returns the live session, or the command catalog of a session that runs elsewhere, or a
|
|
27
33
|
* pending catalog while that session is still starting.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-command-autocomplete.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/skill-command-autocomplete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,oBAAoB,EAAgC,KAAK,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACpH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"skill-command-autocomplete.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/skill-command-autocomplete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,oBAAoB,EAAgC,KAAK,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACpH,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C,OAAO,EAAE,MAAM,KAAK,IAAI,GACvC,oBAAoB,CA2CtB;AAED,kGAAkG;AAClG,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAG7E"}
|
|
@@ -2,6 +2,8 @@ import { CombinedAutocompleteProvider } from "@earendil-works/pi-tui";
|
|
|
2
2
|
import { getSkillCatalog } from "../../core/skill-catalog.js";
|
|
3
3
|
import { BUILTIN_SLASH_COMMANDS } from "../../core/slash-commands.js";
|
|
4
4
|
import { parseGitUrl } from "../../utils/git.js";
|
|
5
|
+
import { getToolPath } from "../../utils/tools-manager.js";
|
|
6
|
+
import { createChatAutocompleteProvider } from "./chat-autocomplete.js";
|
|
5
7
|
export function getAutocompleteSourceTag(sourceInfo) {
|
|
6
8
|
if (!sourceInfo)
|
|
7
9
|
return undefined;
|
|
@@ -22,7 +24,11 @@ export function prefixAutocompleteDescription(description, sourceInfo) {
|
|
|
22
24
|
export function getSessionSkillCommands(session) {
|
|
23
25
|
if (!session.settingsManager.getEnableSkillCommands())
|
|
24
26
|
return [];
|
|
25
|
-
return getSkillCatalog(session.resourceLoader).commands
|
|
27
|
+
return getSkillCatalogCommands(getSkillCatalog(session.resourceLoader).commands);
|
|
28
|
+
}
|
|
29
|
+
/** Skill commands as a chat's completion lists them: `skill:<name>`, described with their source. */
|
|
30
|
+
export function getSkillCatalogCommands(commands) {
|
|
31
|
+
return commands.map((command) => ({
|
|
26
32
|
name: `skill:${command.name}`,
|
|
27
33
|
description: prefixAutocompleteDescription(command.description, command.sourceInfo),
|
|
28
34
|
}));
|
|
@@ -34,7 +40,17 @@ export function getSessionCommandCatalog(session) {
|
|
|
34
40
|
function isCommandCatalog(value) {
|
|
35
41
|
return "skillCommands" in value && Array.isArray(value.skillCommands);
|
|
36
42
|
}
|
|
43
|
+
let fdPath;
|
|
44
|
+
/** Located once per process: finding fd on `PATH` runs it, which a keystroke must not wait on each time. */
|
|
45
|
+
function sharedFdPath() {
|
|
46
|
+
if (fdPath === undefined)
|
|
47
|
+
fdPath = getToolPath("fd");
|
|
48
|
+
return fdPath;
|
|
49
|
+
}
|
|
37
50
|
/**
|
|
51
|
+
* The completion of a chat whose session the main chat does not own, such as a workflow stage's or a subagent's:
|
|
52
|
+
* `/tasks`, the session's skill commands, and `@` and Tab paths under the session's cwd.
|
|
53
|
+
*
|
|
38
54
|
* Resolve again for every completion so lazy attachment and resource reload cannot leave a stale catalog.
|
|
39
55
|
* `resolveSession` returns the live session, or the command catalog of a session that runs elsewhere, or a
|
|
40
56
|
* pending catalog while that session is still starting.
|
|
@@ -73,7 +89,7 @@ export function createSessionSkillAutocompleteProvider(resolveSession, onUnavail
|
|
|
73
89
|
}
|
|
74
90
|
catalog = getSessionCommandCatalog(session);
|
|
75
91
|
}
|
|
76
|
-
return
|
|
92
|
+
return createChatAutocompleteProvider([...BUILTIN_SLASH_COMMANDS.filter((command) => command.name === "tasks"), ...catalog.skillCommands], catalog.cwd, sharedFdPath()).getSuggestions(lines, cursorLine, cursorCol, options);
|
|
77
93
|
},
|
|
78
94
|
applyCompletion: (...args) => completion.applyCompletion(...args),
|
|
79
95
|
shouldTriggerFileCompletion: (...args) => completion.shouldTriggerFileCompletion(...args),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-command-autocomplete.js","sourceRoot":"","sources":["../../../src/modes/interactive/skill-command-autocomplete.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,4BAA4B,EAAqB,MAAM,wBAAwB,CAAC;AAEpH,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAEtE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,UAAU,wBAAwB,CAAC,UAAuB;IAC/D,IAAI,CAAC,UAAU;QAAE,OAAO,SAAS,CAAC;IAClC,MAAM,KAAK,GAAG,UAAU,CAA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AC/C,IAAI,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,OAAO,CAAC;IAClD,OAAO,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;AACvD,CAAC","sourcesContent":["import { type AutocompleteProvider, CombinedAutocompleteProvider, type SlashCommand } from \"@earendil-works/pi-tui\";\nimport type { AgentSession } from \"../../core/agent-session.js\";\nimport { getSkillCatalog } from \"../../core/skill-catalog.ts\";\nimport { BUILTIN_SLASH_COMMANDS } from \"../../core/slash-commands.js\";\nimport type { SourceInfo } from \"../../core/source-info.ts\";\nimport { parseGitUrl } from \"../../utils/git.ts\";\n\nexport function getAutocompleteSourceTag(sourceInfo?: SourceInfo): string | undefined {\n\tif (!sourceInfo) return undefined;\n\tconst scope = sourceInfo.scope === \"user\" ? \"u\" : sourceInfo.scope === \"project\" ? \"p\" : \"t\";\n\tconst source = sourceInfo.source.trim();\n\tif (source === \"auto\" || source === \"local\" || source === \"cli\") return scope;\n\tif (source.startsWith(\"npm:\")) return `${scope}:${source}`;\n\tconst git = parseGitUrl(source);\n\treturn git ? `${scope}:git:${git.host}/${git.path}${git.ref ? `@${git.ref}` : \"\"}` : scope;\n}\n\nexport function prefixAutocompleteDescription(\n\tdescription: string | undefined,\n\tsourceInfo?: SourceInfo,\n): string | undefined {\n\tconst tag = getAutocompleteSourceTag(sourceInfo);\n\treturn tag ? (description ? `[${tag}] ${description}` : `[${tag}]`) : description;\n}\n\n/** Discovery only. Typed commands still use the session's ordinary expansion path. */\nexport function getSessionSkillCommands(\n\tsession: Pick<AgentSession, \"settingsManager\" | \"resourceLoader\">,\n): SlashCommand[] {\n\tif (!session.settingsManager.getEnableSkillCommands()) return [];\n\treturn getSkillCatalog(session.resourceLoader).commands.map((command) => ({\n\t\tname: `skill:${command.name}`,\n\t\tdescription: prefixAutocompleteDescription(command.description, command.sourceInfo),\n\t}));\n}\n\n/**\n * The slash commands a session offers to a chat that shows it from another process, such as a\n * workflow stage running on a local worker: plain data, so it can cross a process boundary.\n */\nexport interface SessionCommandCatalog {\n\t/** Working directory that path completion resolves against. */\n\treadonly cwd: string;\n\t/** The session's `skill:<name>` commands, as {@link getSessionSkillCommands} lists them. */\n\treadonly skillCommands: readonly SlashCommand[];\n}\n\n/** The catalog of a session whose commands are not known yet, with a notice that says why. */\nexport interface PendingSessionCommandCatalog {\n\treadonly loading: string;\n}\n\n/** Captures a live session's command catalog where the session runs. */\nexport function getSessionCommandCatalog(\n\tsession: Pick<AgentSession, \"settingsManager\" | \"resourceLoader\" | \"sessionManager\">,\n): SessionCommandCatalog {\n\treturn { cwd: session.sessionManager.getCwd(), skillCommands: getSessionSkillCommands(session) };\n}\n\nfunction isCommandCatalog(\n\tvalue: AgentSession | SessionCommandCatalog | PendingSessionCommandCatalog,\n): value is SessionCommandCatalog {\n\treturn \"skillCommands\" in value && Array.isArray(value.skillCommands);\n}\n\n/**\n * Resolve again for every completion so lazy attachment and resource reload cannot leave a stale catalog.\n * `resolveSession` returns the live session, or the command catalog of a session that runs elsewhere, or a\n * pending catalog while that session is still starting.\n */\nexport function createSessionSkillAutocompleteProvider(\n\tresolveSession: () => Promise<AgentSession | SessionCommandCatalog | PendingSessionCommandCatalog | undefined>,\n\tonUnavailable?: (message: string) => void,\n): AutocompleteProvider {\n\t// Applying a selected slash completion needs no filesystem or session lookup.\n\tconst completion = new CombinedAutocompleteProvider([], \"\", null);\n\treturn {\n\t\tasync getSuggestions(lines, cursorLine, cursorCol, options) {\n\t\t\tif (options.signal.aborted) return null;\n\t\t\tlet resolved: AgentSession | SessionCommandCatalog | PendingSessionCommandCatalog | undefined;\n\t\t\ttry {\n\t\t\t\tresolved = await resolveSession();\n\t\t\t} catch (error) {\n\t\t\t\tif (!options.signal.aborted) {\n\t\t\t\t\tonUnavailable?.(\n\t\t\t\t\t\t`Skill discovery unavailable: ${error instanceof Error ? error.message : String(error)}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tif (options.signal.aborted) return null;\n\t\t\tif (resolved !== undefined && \"loading\" in resolved && typeof resolved.loading === \"string\") {\n\t\t\t\tonUnavailable?.(resolved.loading);\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tlet catalog: SessionCommandCatalog;\n\t\t\tif (resolved !== undefined && isCommandCatalog(resolved)) catalog = resolved;\n\t\t\telse {\n\t\t\t\tconst session = resolved as AgentSession | undefined;\n\t\t\t\tif (!session?.resourceLoader || !session.settingsManager) {\n\t\t\t\t\tonUnavailable?.(\n\t\t\t\t\t\t\"Skill discovery unavailable: this stage host does not expose its session command metadata.\",\n\t\t\t\t\t);\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t\tcatalog = getSessionCommandCatalog(session);\n\t\t\t}\n\t\t\treturn new CombinedAutocompleteProvider(\n\t\t\t\t[...BUILTIN_SLASH_COMMANDS.filter((command) => command.name === \"tasks\"), ...catalog.skillCommands],\n\t\t\t\tcatalog.cwd,\n\t\t\t\tnull,\n\t\t\t).getSuggestions(lines, cursorLine, cursorCol, options);\n\t\t},\n\t\tapplyCompletion: (...args) => completion.applyCompletion(...args),\n\t\tshouldTriggerFileCompletion: (...args) => completion.shouldTriggerFileCompletion(...args),\n\t};\n}\n\n/** Local view actions never become model input; skills are session messages, not UI execution. */\nexport function classifyChatCommand(text: string): \"tasks\" | \"skill\" | \"other\" {\n\tif (/^\\/tasks(?:\\s|$)/.test(text)) return \"tasks\";\n\treturn text.startsWith(\"/skill:\") ? \"skill\" : \"other\";\n}\n"]}
|
|
1
|
+
{"version":3,"file":"skill-command-autocomplete.js","sourceRoot":"","sources":["../../../src/modes/interactive/skill-command-autocomplete.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,4BAA4B,EAAqB,MAAM,wBAAwB,CAAC;AAEpH,OAAO,EAAE,eAAe,EAA4B,MAAM,6BAA6B,CAAC;AACxF,OAAO,EAAE,sBAAsB,EAA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CAAC;YAC7C,CAAC;YACD,OAAO,8BAA8B,CACpC,CAAC,GAAG,sBAAsB,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,OAAO,CAAC,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC,EACnG,OAAO,CAAC,GAAG,EACX,YAAY,EAAE,CACd,CAAC,cAAc,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QACzD,CAAC;QACD,eAAe,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC,GAAG,IAAI,CAAC;QACjE,2BAA2B,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,2BAA2B,CAAC,GAAG,IAAI,CAAC;KACzF,CAAC;AACH,CAAC;AAED,kGAAkG;AAClG,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC/C,IAAI,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,OAAO,CAAC;IAClD,OAAO,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;AACvD,CAAC","sourcesContent":["import { type AutocompleteProvider, CombinedAutocompleteProvider, type SlashCommand } from \"@earendil-works/pi-tui\";\nimport type { AgentSession } from \"../../core/agent-session.js\";\nimport { getSkillCatalog, type SkillCatalogCommand } from \"../../core/skill-catalog.ts\";\nimport { BUILTIN_SLASH_COMMANDS } from \"../../core/slash-commands.js\";\nimport type { SourceInfo } from \"../../core/source-info.ts\";\nimport { parseGitUrl } from \"../../utils/git.ts\";\nimport { getToolPath } from \"../../utils/tools-manager.ts\";\nimport { createChatAutocompleteProvider } from \"./chat-autocomplete.ts\";\n\nexport function getAutocompleteSourceTag(sourceInfo?: SourceInfo): string | undefined {\n\tif (!sourceInfo) return undefined;\n\tconst scope = sourceInfo.scope === \"user\" ? \"u\" : sourceInfo.scope === \"project\" ? \"p\" : \"t\";\n\tconst source = sourceInfo.source.trim();\n\tif (source === \"auto\" || source === \"local\" || source === \"cli\") return scope;\n\tif (source.startsWith(\"npm:\")) return `${scope}:${source}`;\n\tconst git = parseGitUrl(source);\n\treturn git ? `${scope}:git:${git.host}/${git.path}${git.ref ? `@${git.ref}` : \"\"}` : scope;\n}\n\nexport function prefixAutocompleteDescription(\n\tdescription: string | undefined,\n\tsourceInfo?: SourceInfo,\n): string | undefined {\n\tconst tag = getAutocompleteSourceTag(sourceInfo);\n\treturn tag ? (description ? `[${tag}] ${description}` : `[${tag}]`) : description;\n}\n\n/** Discovery only. Typed commands still use the session's ordinary expansion path. */\nexport function getSessionSkillCommands(\n\tsession: Pick<AgentSession, \"settingsManager\" | \"resourceLoader\">,\n): SlashCommand[] {\n\tif (!session.settingsManager.getEnableSkillCommands()) return [];\n\treturn getSkillCatalogCommands(getSkillCatalog(session.resourceLoader).commands);\n}\n\n/** Skill commands as a chat's completion lists them: `skill:<name>`, described with their source. */\nexport function getSkillCatalogCommands(\n\tcommands: readonly Pick<SkillCatalogCommand, \"name\" | \"description\" | \"sourceInfo\">[],\n): SlashCommand[] {\n\treturn commands.map((command) => ({\n\t\tname: `skill:${command.name}`,\n\t\tdescription: prefixAutocompleteDescription(command.description, command.sourceInfo),\n\t}));\n}\n\n/**\n * The slash commands a session offers to a chat that shows it from another process, such as a\n * workflow stage running on a local worker: plain data, so it can cross a process boundary.\n */\nexport interface SessionCommandCatalog {\n\t/** Working directory that path completion resolves against. */\n\treadonly cwd: string;\n\t/** The session's `skill:<name>` commands, as {@link getSessionSkillCommands} lists them. */\n\treadonly skillCommands: readonly SlashCommand[];\n}\n\n/** The catalog of a session whose commands are not known yet, with a notice that says why. */\nexport interface PendingSessionCommandCatalog {\n\treadonly loading: string;\n}\n\n/** Captures a live session's command catalog where the session runs. */\nexport function getSessionCommandCatalog(\n\tsession: Pick<AgentSession, \"settingsManager\" | \"resourceLoader\" | \"sessionManager\">,\n): SessionCommandCatalog {\n\treturn { cwd: session.sessionManager.getCwd(), skillCommands: getSessionSkillCommands(session) };\n}\n\nfunction isCommandCatalog(\n\tvalue: AgentSession | SessionCommandCatalog | PendingSessionCommandCatalog,\n): value is SessionCommandCatalog {\n\treturn \"skillCommands\" in value && Array.isArray(value.skillCommands);\n}\n\nlet fdPath: string | null | undefined;\n\n/** Located once per process: finding fd on `PATH` runs it, which a keystroke must not wait on each time. */\nfunction sharedFdPath(): string | null {\n\tif (fdPath === undefined) fdPath = getToolPath(\"fd\");\n\treturn fdPath;\n}\n\n/**\n * The completion of a chat whose session the main chat does not own, such as a workflow stage's or a subagent's:\n * `/tasks`, the session's skill commands, and `@` and Tab paths under the session's cwd.\n *\n * Resolve again for every completion so lazy attachment and resource reload cannot leave a stale catalog.\n * `resolveSession` returns the live session, or the command catalog of a session that runs elsewhere, or a\n * pending catalog while that session is still starting.\n */\nexport function createSessionSkillAutocompleteProvider(\n\tresolveSession: () => Promise<AgentSession | SessionCommandCatalog | PendingSessionCommandCatalog | undefined>,\n\tonUnavailable?: (message: string) => void,\n): AutocompleteProvider {\n\t// Applying a selected slash completion needs no filesystem or session lookup.\n\tconst completion = new CombinedAutocompleteProvider([], \"\", null);\n\treturn {\n\t\tasync getSuggestions(lines, cursorLine, cursorCol, options) {\n\t\t\tif (options.signal.aborted) return null;\n\t\t\tlet resolved: AgentSession | SessionCommandCatalog | PendingSessionCommandCatalog | undefined;\n\t\t\ttry {\n\t\t\t\tresolved = await resolveSession();\n\t\t\t} catch (error) {\n\t\t\t\tif (!options.signal.aborted) {\n\t\t\t\t\tonUnavailable?.(\n\t\t\t\t\t\t`Skill discovery unavailable: ${error instanceof Error ? error.message : String(error)}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tif (options.signal.aborted) return null;\n\t\t\tif (resolved !== undefined && \"loading\" in resolved && typeof resolved.loading === \"string\") {\n\t\t\t\tonUnavailable?.(resolved.loading);\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tlet catalog: SessionCommandCatalog;\n\t\t\tif (resolved !== undefined && isCommandCatalog(resolved)) catalog = resolved;\n\t\t\telse {\n\t\t\t\tconst session = resolved as AgentSession | undefined;\n\t\t\t\tif (!session?.resourceLoader || !session.settingsManager) {\n\t\t\t\t\tonUnavailable?.(\n\t\t\t\t\t\t\"Skill discovery unavailable: this stage host does not expose its session command metadata.\",\n\t\t\t\t\t);\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t\tcatalog = getSessionCommandCatalog(session);\n\t\t\t}\n\t\t\treturn createChatAutocompleteProvider(\n\t\t\t\t[...BUILTIN_SLASH_COMMANDS.filter((command) => command.name === \"tasks\"), ...catalog.skillCommands],\n\t\t\t\tcatalog.cwd,\n\t\t\t\tsharedFdPath(),\n\t\t\t).getSuggestions(lines, cursorLine, cursorCol, options);\n\t\t},\n\t\tapplyCompletion: (...args) => completion.applyCompletion(...args),\n\t\tshouldTriggerFileCompletion: (...args) => completion.shouldTriggerFileCompletion(...args),\n\t};\n}\n\n/** Local view actions never become model input; skills are session messages, not UI execution. */\nexport function classifyChatCommand(text: string): \"tasks\" | \"skill\" | \"other\" {\n\tif (/^\\/tasks(?:\\s|$)/.test(text)) return \"tasks\";\n\treturn text.startsWith(\"/skill:\") ? \"skill\" : \"other\";\n}\n"]}
|
package/docs/background-tasks.md
CHANGED
|
@@ -84,7 +84,7 @@ subagent({
|
|
|
84
84
|
|
|
85
85
|
Parallel tasks have independent identities. Accepted work beyond the concurrency limit stays queued. Use `/agents` to browse available definitions before choosing an agent.
|
|
86
86
|
|
|
87
|
-
Intercom communication does not cancel a parallel batch.
|
|
87
|
+
Intercom communication does not cancel a parallel batch. An `intercom` ask returns at delivery and its reply arrives as a message in the requesting child; a supervisor decision waits only in the requesting child and resumes that same execution after the matching reply. Sends and progress updates remain nonblocking. Foreground observations may yield so the parent can reply; execution concurrency, queued siblings, and task identities are preserved. Stop a selected task explicitly, or close its owner to cancel all owned work.
|
|
88
88
|
|
|
89
89
|
A launch result says **Launched in background**. This records what happened at launch; it is not a permanently live status label. The below-prompt indicator and `/tasks` show the current state.
|
|
90
90
|
|
|
@@ -16,7 +16,7 @@ Start with the state you can observe. The existing sections below explain the co
|
|
|
16
16
|
| Reconnect backoff | The session remains disconnected between attempts. | No extra call is required to keep recovery moving. Retries use 1, 2, 5, 10, then 30 seconds until the session connects or shuts down. See [How it works](#how-it-works). |
|
|
17
17
|
| Exhausted workflow-stage warm-up | The stage ends `failed` and names the run, stage id, and stage name. Queued messages remain queued. | Treat the failure as terminal for that stage and restore broker availability before another delivery attempt. See [How it works](#how-it-works). |
|
|
18
18
|
| Terminal stage delivery failure | The stage fails without spending a model retry or fallback. | Fix the delivery failure rather than changing models. The typed failure applies to every model candidate. See [How it works](#how-it-works). |
|
|
19
|
-
| Destination-side admission failure | A
|
|
19
|
+
| Destination-side admission failure | A non-parent asker receives a correlated failed-ask message (or an error while its call still waits) instead of a reply. | Act on the returned destination error, then send again when the destination can admit the message. See [Workflow and subagent notifications](#workflow-and-subagent-notifications). |
|
|
20
20
|
| Broker restart or concurrent startup | Sessions disappear briefly, or several sessions invoke Intercom at the same time. | Usually no action is needed. Clients reconnect, and the spawn lock prevents duplicate brokers. See [How it works](#how-it-works). |
|
|
21
21
|
| Broker started by an older Atomic | After an update, the first session of the new version replaces the older broker; sessions of both versions disconnect for a moment and reconnect to the new one. If the broker cannot be replaced, the session shows one warning that it uses the broker on this machine only. | Usually nothing. If the warning appears, run `atomic intercom restart` when a brief reconnect is acceptable. See [Upgrading Atomic with sessions running](#upgrading-atomic-with-sessions-running). |
|
|
22
22
|
| Broker accepts connections but stops answering | List, send, or workflow route requests time out. | Allow about a minute for automatic broker replacement, then reconnect backoff. A request timeout can add up to five seconds for a health check. Check the logs below if it repeats. See [How it works](#how-it-works). |
|
|
@@ -149,7 +149,7 @@ workflow({
|
|
|
149
149
|
|
|
150
150
|
When neither `enabled` nor `delivery` is set, direct `parallel` runs default to `control-and-result` when Intercom is available; otherwise delivery is off. Treat Intercom payloads from direct runs as user-visible workflow output.
|
|
151
151
|
|
|
152
|
-
Live workflow stages receive incoming messages according to the sender's `delivery` option: `"steer"` (default) after the current tool calls finish, `"followUp"` after the stage's agent stops, and `"interrupt"` by cancelling its current model call or cancellable tool first. See [Intercom](/intercom) for when to use each. A child's message releases its parent's foreground wait without cancelling the child. Admission failures
|
|
152
|
+
Live workflow stages receive incoming messages according to the sender's `delivery` option: `"steer"` (default) after the current tool calls finish, `"followUp"` after the stage's agent stops, and `"interrupt"` by cancelling its current model call or cancellable tool first. See [Intercom](/intercom) for when to use each. A child's message releases its parent's foreground wait without cancelling the child. Admission failures come back to the asker as an actionable failed-ask message. Claimed single-child parent handoffs still end that child.
|
|
153
153
|
|
|
154
154
|
### Messages to workflow stages that have not started
|
|
155
155
|
|
|
@@ -170,7 +170,7 @@ For live peer coordination, call `intercom({ action: "status" })` in the parent
|
|
|
170
170
|
|
|
171
171
|
### Delivery Ordering
|
|
172
172
|
|
|
173
|
-
Parallel communication does not cancel the batch.
|
|
173
|
+
Parallel communication does not cancel the batch. An `intercom` ask returns at delivery and its reply arrives as a message in the same child; a `contact_supervisor` decision waits only in its requesting child and the correlated reply continues that same execution. Sends and progress updates remain nonblocking. Claimed single-child parent asks retain their terminal fresh-start handoff.
|
|
174
174
|
|
|
175
175
|
Queued messages from a child arrive before its completion notice. Delivery retries do not rerun work or change its outcome.
|
|
176
176
|
|
|
@@ -292,7 +292,7 @@ When a whole machine or its broker stops, its sessions still look connected for
|
|
|
292
292
|
|
|
293
293
|
**The database is unavailable.** Messages between sessions on the same machine keep working. A send to a session on another machine fails with `Session not found on this node, and Intercom could not reach the shared storage database to look for it on other nodes. Try again once the database is available.` If the database cannot be opened when the broker starts, the broker logs `Intercom multi-node routing is unavailable: <reason>` and retries after 1 second, doubling up to every 30 seconds. Intercom never falls back to in-memory storage. If sends keep failing after the database is back, run `atomic intercom restart` so that a new broker starts.
|
|
294
294
|
|
|
295
|
-
**An ask to a session on another machine never gets an answer.** If that session disconnects before it answers, the asker is not told, and
|
|
295
|
+
**An ask to a session on another machine never gets an answer.** If that session disconnects before it answers, the asker is not told, and the ask stays pending. Cancel it with `intercom({ action: "cancel", askId })` and ask again once the session is back.
|
|
296
296
|
|
|
297
297
|
## Keyboard Shortcuts
|
|
298
298
|
|