@bastani/atomic 0.9.88-alpha.1 → 0.9.88
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 +287 -0
- package/dist/builtin/intercom/CHANGELOG.md +57 -0
- package/dist/builtin/intercom/index.bundle.mjs +62 -38
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/intercom/session-target.ts +15 -3
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +50 -0
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/web-access/CHANGELOG.md +10 -0
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +117 -0
- package/dist/builtin/workflows/README.md +2 -2
- package/dist/builtin/workflows/builtin/{chunk-r9xfx5d0.js → chunk-4h4nh4f1.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-cryf7s3r.js → chunk-jm7redy5.js} +648 -91
- package/dist/builtin/workflows/builtin/{chunk-c7bc4ppx.js → chunk-t661k7hd.js} +1 -1
- package/dist/builtin/workflows/builtin/goal.js +2 -2
- package/dist/builtin/workflows/builtin/index.js +3 -3
- package/dist/builtin/workflows/builtin/ralph.js +2 -2
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/src/durable/fork-errors.d.ts +0 -1
- package/dist/builtin/workflows/src/durable/journal/internal.d.ts +1 -0
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +2515 -1091
- package/dist/builtin/workflows/src/extension/local-worker-entry.mjs +1092 -98
- package/dist/builtin/workflows/src/index.js +1077 -91
- package/dist/builtin/workflows/src/local-worker-entry.mjs +1092 -98
- package/dist/core/storage/session/session-resume.d.ts +8 -1
- package/dist/core/storage/session/session-resume.d.ts.map +1 -1
- package/dist/core/storage/session/session-resume.js +22 -3
- package/dist/core/storage/session/session-resume.js.map +1 -1
- package/dist/core/worktree-snapshot/restore.d.ts +2 -0
- package/dist/core/worktree-snapshot/restore.d.ts.map +1 -1
- package/dist/core/worktree-snapshot/restore.js +41 -5
- package/dist/core/worktree-snapshot/restore.js.map +1 -1
- package/dist/modes/interactive/components/jump-to-latest.d.ts +0 -5
- package/dist/modes/interactive/components/jump-to-latest.d.ts.map +1 -1
- package/dist/modes/interactive/components/jump-to-latest.js +0 -5
- package/dist/modes/interactive/components/jump-to-latest.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.d.ts +1 -0
- package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.js +13 -2
- package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
- package/dist/modes/interactive/interactive-render-chat.d.ts +0 -4
- package/dist/modes/interactive/interactive-render-chat.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-render-chat.js +19 -45
- package/dist/modes/interactive/interactive-render-chat.js.map +1 -1
- package/dist/modes/interactive/interactive-startup-chat-container.d.ts +9 -1
- package/dist/modes/interactive/interactive-startup-chat-container.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-startup-chat-container.js +38 -0
- package/dist/modes/interactive/interactive-startup-chat-container.js.map +1 -1
- package/docs/keybindings.md +1 -1
- package/docs/storage.md +1 -1
- package/docs/workflows/api-reference.md +3 -2
- package/docs/workflows/operations.md +11 -9
- package/npm-shrinkwrap.json +49 -49
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-render-chat.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-render-chat.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClH,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,2BAA2B,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AACpG,OAAO,EAA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AC,OAA4C,CAAC;IACrE,IAAI,OAAO,EAAE,QAAQ,KAAK,gBAAgB;QAAE,OAAO,KAAK,CAAC;IACzD,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC;QAC7C,CAAC,CAAC,OAAO,CAAC,OAAO;aACd,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC;aACxC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC;aAC1B,IAAI,CAAC,IAAI,CAAC;QACb,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IACnB,OAAO,6BAA6B,CAAC,OAAO,CAAC,KAAK,MAAM,CAAC,aAAa,CAAC;AACxE,CAAC","sourcesContent":["import type { AssistantMessage, Usage } from \"@bastani/atomic-ai/compat\";\nimport type { TUI } from \"@bastani/atomic-tui\";\nimport { CONFIG_DIR_NAME } from \"../../config.js\";\nimport { collectCacheMisses, createCacheMissModelSource, formatCacheMissNotice } from \"../../core/cache-stats.ts\";\nimport { markLifecycleTiming } from \"../../core/lifecycle-timings.ts\";\nimport { isVerbatimCompactionMessage, stripVerbatimCompactionPrefix } from \"../../core/messages.ts\";\nimport { serviceTierWarnings } from \"../../core/service-tier-warnings.ts\";\nimport type { CustomEntry } from \"../../core/session-manager.ts\";\nimport { buildContextEntries, type SessionEntry, sessionEntryToContextMessages } from \"../../core/session-manager.ts\";\nimport { yieldToEventLoop } from \"../../utils/event-loop.ts\";\nimport { IsolatedInteractiveRuntime } from \"../interactive-engine/isolated-runtime.js\";\nimport { RemoteCustomMessageComponent, RemoteToolExecutionComponent } from \"../interactive-engine/remote-renderer.ts\";\nimport { appendBoundedStderr } from \"../rpc/rpc-client-process.js\";\nimport { messageComponents, statusComponents } from \"./chat-message-count.ts\";\nimport { CustomEntryComponent } from \"./components/custom-entry.ts\";\nimport type { NewMessageCounter } from \"./components/jump-to-latest.ts\";\nimport { createMarkdownTransform } from \"./components/markdown-transform.ts\";\nimport { createMermaidMarkdownTransformer } from \"./components/mermaid.ts\";\nimport { ThemedText } from \"./components/themed-text.js\";\nimport { appendNewChildrenBeforeAttachedChild } from \"./interactive-child-ordering.ts\";\nimport { InteractiveModeBase, isChatMessageComponent } from \"./interactive-mode-base.ts\";\nimport {\n\ttype AgentMessage,\n\tAPP_NAME,\n\tAssistantMessageComponent,\n\taddChatTranscriptEntry,\n\tBashExecutionComponent,\n\tBranchSummaryMessageComponent,\n\ttype ChatMessageEntry,\n\ttype ChatMessageRenderOptions,\n\tCompactionBoundaryMessageComponent,\n\ttype Component,\n\tCustomMessageComponent,\n\tchatEntriesFromAgentMessages,\n\thasTrustRequiringProjectResources,\n\tMarkdown,\n\ttype Message,\n\ttype PersistedMessageMeta,\n\tparseSkillBlock,\n\trecordTimeSinceReset,\n\trenderChatMessageEntry,\n\ttype SessionContext,\n\tSkillInvocationMessageComponent,\n\tSpacer,\n\tText,\n\tToolExecutionComponent,\n\ttype TruncationResult,\n\ttheme,\n\tUserMessageComponent,\n\ttype VerbatimCompactionResult,\n} from \"./interactive-mode-deps.ts\";\nimport type { InteractiveSubmission } from \"./interactive-submission.ts\";\nimport { refreshInteractiveTasks } from \"./interactive-task-projection.js\";\n\nfunction countDroppedThinkingBlocks(message: AssistantMessage): number {\n\treturn (message.diagnostics ?? []).reduce((count, diagnostic) => {\n\t\tif (diagnostic.type !== \"anthropic_input_transformations\") return count;\n\t\tconst dropped = diagnostic.details?.droppedBlockCount;\n\t\treturn count + (typeof dropped === \"number\" && dropped > 0 ? dropped : 0);\n\t}, 0);\n}\n\nfunction addServiceTierWarnings(mode: InteractiveModeBase, message: AssistantMessage): void {\n\tfor (const warning of serviceTierWarnings(message)) {\n\t\tmode.chatContainer.addChild(new Spacer(1));\n\t\tmode.chatContainer.addChild(new Text(theme.fg(\"warning\", `Warning: ${warning}`), 1, 0));\n\t}\n}\n\nInteractiveModeBase.prototype.maybeShowAssistantDiagnostics = function (\n\tthis: InteractiveModeBase,\n\tmessage: AssistantMessage,\n): void {\n\taddServiceTierWarnings(this, message);\n\tif (!this.settingsManager.getShowCacheMissNotices()) return;\n\n\tconst count = countDroppedThinkingBlocks(message);\n\tif (count === 0) return;\n\tlet previousCount = 0;\n\t// The live message_end notification precedes persistence of this response.\n\tconst branch = this.sessionManager.getBranch();\n\tfor (let i = branch.length - 1; i >= 0; i--) {\n\t\tconst entry = branch[i];\n\t\tif (entry.type === \"message\" && entry.message.role === \"assistant\") {\n\t\t\tpreviousCount = countDroppedThinkingBlocks(entry.message);\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (count <= previousCount) return;\n\tconst noun = count === 1 ? \"thinking block\" : \"thinking blocks\";\n\tthis.chatContainer.addChild(new Spacer(1));\n\tthis.chatContainer.addChild(\n\t\tnew Text(theme.fg(\"warning\", `Anthropic dropped ${count} ${noun} (details in session)`), 1, 0),\n\t);\n};\n\n// Weak keys leave cleared/rebuilt transcripts collectible without separate lifecycle state.\n// Only persistent diagnostic statuses participate; ordinary chat/status is never evicted.\nconst diagnosticStatuses = new WeakMap<Component, { spacer: Spacer; bytes: number }>();\nconst MAX_DIAGNOSTIC_STATUSES = 64;\nconst MAX_DIAGNOSTIC_HISTORY_BYTES = 256 * 1024;\n\nInteractiveModeBase.prototype.showStatus = function (\n\tthis: InteractiveModeBase,\n\tmessage: string,\n\tpersist = false,\n): void {\n\tconst children = this.chatContainer.children;\n\tconst last = children.length > 0 ? children[children.length - 1] : undefined;\n\tconst secondLast = children.length > 1 ? children[children.length - 2] : undefined;\n\n\tif (!persist && last && secondLast && last === this.lastStatusText && secondLast === this.lastStatusSpacer) {\n\t\tthis.lastStatusText.setText(theme.fg(\"dim\", message));\n\t\tthis.ui.requestRender();\n\t\treturn;\n\t}\n\n\tif (persist) message = appendBoundedStderr(\"\", message);\n\tconst spacer = new Spacer(1);\n\tconst text = new Text(theme.fg(\"dim\", message), 1, 0);\n\tstatusComponents.add(text);\n\tthis.chatContainer.addChild(spacer);\n\tthis.chatContainer.addChild(text);\n\tthis.lastStatusSpacer = persist ? undefined : spacer;\n\tthis.lastStatusText = persist ? undefined : text;\n\tif (persist) {\n\t\tdiagnosticStatuses.set(text, { spacer, bytes: Buffer.byteLength(message) });\n\t\tlet count = 0;\n\t\tlet bytes = 0;\n\t\tfor (const child of [...children].reverse()) {\n\t\t\tconst diagnostic = diagnosticStatuses.get(child);\n\t\t\tif (!diagnostic) continue;\n\t\t\tcount++;\n\t\t\tbytes += diagnostic.bytes;\n\t\t\tif (count > MAX_DIAGNOSTIC_STATUSES || bytes > MAX_DIAGNOSTIC_HISTORY_BYTES) {\n\t\t\t\tthis.chatContainer.removeChild(child);\n\t\t\t\tthis.chatContainer.removeChild(diagnostic.spacer);\n\t\t\t}\n\t\t}\n\t}\n\tthis.ui.requestRender();\n};\n\n/**\n * The read epoch of the jump-to-latest counter each echo was shown in. Transcript order is not arrival order: messages\n * go in before a streaming reply, and a re-render shows pending echoes last. So an echo is unread when its epoch is still\n * the counter's, wherever it sits, and a re-render keeps the epoch it was first shown in (#5243).\n */\nconst echoReadEpochs = new WeakMap<Component[], number>();\n\nInteractiveModeBase.prototype.renderDeferredUserInput = function (this: InteractiveModeBase, text: string): void {\n\tthis.deferredRenderedUserInputs.push(text);\n\tconst startIndex = this.chatContainer.children.length;\n\tthis.addMessageToChat({ role: \"user\", content: text } as AgentMessage);\n\tconst renderedComponents = this.chatContainer.children.slice(startIndex);\n\tconst epoch = (this.ui as AltScreenMessageCounterHost).newMessages?.epoch;\n\tif (epoch !== undefined) echoReadEpochs.set(renderedComponents, epoch);\n\tconst trackedComponents = this.deferredRenderedUserInputComponents.get(text) ?? [];\n\ttrackedComponents.push(renderedComponents);\n\tthis.deferredRenderedUserInputComponents.set(text, trackedComponents);\n\tthis.updatePendingMessagesDisplay();\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.consumeDeferredRenderedUserInput = function (\n\tthis: InteractiveModeBase,\n\ttext: string,\n): boolean {\n\tconst index = this.deferredRenderedUserInputs.indexOf(text);\n\tif (index === -1) return false;\n\tthis.deferredRenderedUserInputs.splice(index, 1);\n\tif (this.startedDeferredUserInput === text) this.startedDeferredUserInput = undefined;\n\tconst trackedComponents = this.deferredRenderedUserInputComponents.get(text);\n\ttrackedComponents?.shift();\n\tif (trackedComponents && trackedComponents.length === 0) {\n\t\tthis.deferredRenderedUserInputComponents.delete(text);\n\t}\n\treturn true;\n};\n\n/** Drop the oldest echo of `text` from the books and return its components, which stay in the transcript. */\nfunction forgetDeferredEcho(mode: InteractiveModeBase, text: string): Component[] | undefined {\n\tconst index = mode.deferredRenderedUserInputs.indexOf(text);\n\tif (index !== -1) {\n\t\tmode.deferredRenderedUserInputs.splice(index, 1);\n\t\tif (mode.startedDeferredUserInput === text) mode.startedDeferredUserInput = undefined;\n\t}\n\tconst trackedComponents = mode.deferredRenderedUserInputComponents.get(text);\n\tconst components = trackedComponents?.shift();\n\tif (trackedComponents && trackedComponents.length === 0) {\n\t\tmode.deferredRenderedUserInputComponents.delete(text);\n\t}\n\treturn components;\n}\n\n/** Take every pending echo off the books before a re-render, with the read epoch it was shown in. */\nfunction takeDeferredEchoes(mode: InteractiveModeBase): Array<{ text: string; epoch: number | undefined }> {\n\tconst occurrences = new Map<string, number>();\n\tconst echoes = mode.deferredRenderedUserInputs.map((text) => {\n\t\tconst occurrence = occurrences.get(text) ?? 0;\n\t\toccurrences.set(text, occurrence + 1);\n\t\tconst components = mode.deferredRenderedUserInputComponents.get(text)?.[occurrence];\n\t\treturn { text, epoch: components ? echoReadEpochs.get(components) : undefined };\n\t});\n\tmode.deferredRenderedUserInputs = [];\n\tmode.deferredRenderedUserInputComponents.clear();\n\treturn echoes;\n}\n\n/** Show the echoes a re-render took again, each as read or unread as it was before. */\nfunction restoreDeferredEchoes(\n\tmode: InteractiveModeBase,\n\techoes: ReadonlyArray<{ text: string; epoch: number | undefined }>,\n): void {\n\tfor (const { text, epoch } of echoes) {\n\t\tmode.renderDeferredUserInput(text);\n\t\tconst tracked = mode.deferredRenderedUserInputComponents.get(text);\n\t\tconst components = tracked?.[tracked.length - 1];\n\t\tif (components && epoch !== undefined) echoReadEpochs.set(components, epoch);\n\t}\n}\n\nInteractiveModeBase.prototype.discardDeferredRenderedUserInput = function (\n\tthis: InteractiveModeBase,\n\ttext: string,\n): void {\n\tconst componentsToRemove = forgetDeferredEcho(this, text);\n\tif (!componentsToRemove) return;\n\tconst renderer = this.ui as AltScreenMessageCounterHost;\n\tconst following = renderer.isFollowingOutput !== false;\n\tconst messages = this.chatContainer.children.filter(isChatMessageComponent);\n\t// Count arrivals not painted yet first, so that removing the echo cannot hide them.\n\tif (!following) renderer.newMessages?.observe(false, messages.length);\n\tlet removedMessages = 0;\n\tfor (const component of componentsToRemove) {\n\t\tif (messages.includes(component)) removedMessages += 1;\n\t\tthis.chatContainer.removeChild(component);\n\t}\n\tconst counter = renderer.newMessages;\n\tif (!following && counter && echoReadEpochs.get(componentsToRemove) === counter.epoch) {\n\t\tcounter.retract(removedMessages);\n\t}\n\tcounter?.observe(following, messages.length - removedMessages);\n\tthis.updatePendingMessagesDisplay();\n\tthis.ui.requestRender();\n};\n\n/**\n * The session started a run for a submission this host echoed as `text`. The run begins with the submission's message,\n * as sent: an `input` hook may have rewritten it, so its `message_start` need not match the echo (#4277). An engine's\n * answer can reach the host after that `message_start`, which the session then showed itself (#4272): if it showed any\n * message of its own since `shownBefore`, the echo goes. Otherwise the session's next message that matches no echo\n * takes the echo's place. A run starts only after the one before it showed its message, so an earlier run still\n * waiting here never got to show it, and its echo stays as it is.\n */\nInteractiveModeBase.prototype.expectStartedUserInput = function (\n\tthis: InteractiveModeBase,\n\ttext: string,\n\tshownBefore: number,\n): void {\n\tif (!this.deferredRenderedUserInputs.includes(text)) return;\n\tif (this.userMessagesShownBySession !== shownBefore) this.discardDeferredRenderedUserInput(text);\n\telse this.startedDeferredUserInput = text;\n};\n\n/** Show a user message from the session: in place of its echo, or of the echo of the run it started, or as new. */\nInteractiveModeBase.prototype.showSessionUserMessage = function (this: InteractiveModeBase, message: Message): void {\n\tif (this.consumeDeferredRenderedUserInput(this.getUserMessageText(message))) return;\n\tconst started = this.startedDeferredUserInput;\n\tif (started !== undefined) {\n\t\t// The message takes the echo's place as read or unread as the echo was: count arrivals not painted yet, then\n\t\t// swap it in without counting it or retracting the echo (#5243). A rewrite that shows nothing, such as empty\n\t\t// text, leaves an unread echo's count behind, so that part is retracted.\n\t\tconst renderer = this.ui as AltScreenMessageCounterHost;\n\t\tconst following = renderer.isFollowingOutput !== false;\n\t\tconst countedMessages = (): number => this.chatContainer.children.filter(isChatMessageComponent).length;\n\t\tif (!following) renderer.newMessages?.observe(false, countedMessages());\n\t\tconst echo = forgetDeferredEcho(this, started);\n\t\tconst countedBefore = countedMessages();\n\t\tappendNewChildrenBeforeAttachedChild(this.chatContainer, echo?.[0], () => this.addMessageToChat(message));\n\t\tconst shownMessages = countedMessages() - countedBefore;\n\t\tlet removedMessages = 0;\n\t\tfor (const component of echo ?? []) {\n\t\t\tif (isChatMessageComponent(component) && this.chatContainer.children.includes(component)) removedMessages += 1;\n\t\t\tthis.chatContainer.removeChild(component);\n\t\t}\n\t\tconst counter = renderer.newMessages;\n\t\tif (!following && counter && echo && echoReadEpochs.get(echo) === counter.epoch) {\n\t\t\tcounter.retract(removedMessages - shownMessages);\n\t\t}\n\t\tcounter?.replaced(countedMessages());\n\t\tthis.updatePendingMessagesDisplay();\n\t\tthis.ui.requestRender();\n\t\treturn;\n\t}\n\tthis.userMessagesShownBySession += 1;\n\tthis.addMessageToChat(message);\n};\n\nInteractiveModeBase.prototype.getMarkdownTransformers = function (this: InteractiveModeBase) {\n\tconst mode = this.settingsManager.getMermaidRenderingMode();\n\tif (this.mermaidMarkdownTransformerMode !== mode) {\n\t\tthis.mermaidMarkdownTransformerMode = mode;\n\t\tthis.mermaidMarkdownTransformer = createMermaidMarkdownTransformer({\n\t\t\tgetMode: () => this.settingsManager.getMermaidRenderingMode(),\n\t\t\ttheme,\n\t\t});\n\t}\n\tconst extensionTransformers =\n\t\tthis.runtimeHost instanceof IsolatedInteractiveRuntime\n\t\t\t? []\n\t\t\t: this.session.extensionRunner.getMarkdownTransformers();\n\treturn [this.mermaidMarkdownTransformer, ...extensionTransformers];\n};\n\n/**\n * Markdown of a changelog that runs the Markdown transformers registered for the `changelog` type. Transformers are\n * looked up on each render, so a notice shown before deferred extensions load uses them once it is invalidated.\n */\nInteractiveModeBase.prototype.createChangelogMarkdown = function (\n\tthis: InteractiveModeBase,\n\tmarkdown: string,\n\tpaddingX: number,\n\tpaddingY: number,\n): Markdown {\n\treturn new Markdown(markdown, paddingX, paddingY, this.getMarkdownThemeWithSettings(), undefined, {\n\t\ttransform: (text, width) =>\n\t\t\tcreateMarkdownTransform(\"changelog\", () => false, this.getMarkdownTransformers())(text, width),\n\t});\n};\n\nInteractiveModeBase.prototype.chatMessageRenderOptions = function (\n\tthis: InteractiveModeBase,\n): ChatMessageRenderOptions {\n\tconst isolated = this.runtimeHost instanceof IsolatedInteractiveRuntime;\n\treturn {\n\t\tui: this.ui,\n\t\tcwd: this.sessionManager.getCwd(),\n\t\tmarkdownTheme: this.getMarkdownThemeWithSettings(),\n\t\thideThinkingBlock: this.hideThinkingBlock,\n\t\thiddenThinkingLabel: this.hiddenThinkingLabel,\n\t\ttoolOutputExpanded: this.toolOutputExpanded,\n\t\tshowImages: this.settingsManager.getShowImages(),\n\t\timageWidthCells: this.settingsManager.getImageWidthCells(),\n\t\toutputPad: this.outputPad,\n\t\trenderLatex: this.settingsManager.getLatexRenderingEnabled(),\n\t\tmarkdownTransformers: this.getMarkdownTransformers(),\n\t\tgetToolDefinition: isolated ? undefined : (toolName) => this.getRegisteredToolDefinition(toolName),\n\t\tgetCustomMessageRenderer: isolated\n\t\t\t? undefined\n\t\t\t: (customType) => this.session.extensionRunner.getMessageRenderer(customType),\n\t\tcreateToolComponent: isolated\n\t\t\t? (entry) => {\n\t\t\t\t\tconst component = new RemoteToolExecutionComponent(\n\t\t\t\t\t\tentry.toolName,\n\t\t\t\t\t\tentry.toolCallId,\n\t\t\t\t\t\tentry.args,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tshowImages: this.settingsManager.getShowImages(),\n\t\t\t\t\t\t\timageWidthCells: this.settingsManager.getImageWidthCells(),\n\t\t\t\t\t\t\toutputPad: this.outputPad,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tthis.runtimeHost as IsolatedInteractiveRuntime,\n\t\t\t\t\t\t() => this.ui.requestRender(),\n\t\t\t\t\t);\n\t\t\t\t\tcomponent.setExpanded(this.toolOutputExpanded);\n\t\t\t\t\tif (entry.result) component.updateResult(entry.result, entry.isPartial ?? false);\n\t\t\t\t\treturn component;\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tcreateCustomMessageComponent: isolated\n\t\t\t? (message) => {\n\t\t\t\t\tconst component = new RemoteCustomMessageComponent(\n\t\t\t\t\t\tmessage,\n\t\t\t\t\t\tthis.runtimeHost as IsolatedInteractiveRuntime,\n\t\t\t\t\t\t() => this.ui.requestRender(),\n\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t);\n\t\t\t\t\tcomponent.setExpanded(this.toolOutputExpanded);\n\t\t\t\t\treturn component;\n\t\t\t\t}\n\t\t\t: undefined,\n\t};\n};\n\nInteractiveModeBase.prototype.addRenderedChatEntry = function (\n\tthis: InteractiveModeBase,\n\tentry: ChatMessageEntry,\n): Component {\n\tconst component = renderChatMessageEntry(entry, this.chatMessageRenderOptions());\n\tif (entry.kind !== \"system\" && !(entry.kind === \"custom\" && isVerbatimCompactionMessage(entry.message))) {\n\t\tmessageComponents.add(component);\n\t}\n\taddChatTranscriptEntry(this.chatContainer, component, entry.role);\n\treturn component;\n};\n\nInteractiveModeBase.prototype.addCompactionBoundaryToChat = function (\n\tthis: InteractiveModeBase,\n\tresult: VerbatimCompactionResult,\n): void {\n\tthis.chatContainer.addChild(new Spacer(1));\n\tconst component = new CompactionBoundaryMessageComponent(result, this.outputPad);\n\tcomponent.setExpanded(this.toolOutputExpanded);\n\tthis.chatContainer.addChild(component);\n};\n\nInteractiveModeBase.prototype.addCompactionCostNotice = function (\n\tthis: InteractiveModeBase,\n\tkind: \"compaction\" | \"branch_summary\",\n\tusage: Usage,\n): void {\n\tif (!this.settingsManager.getShowCacheMissNotices()) return;\n\tconst tokens = usage.input + usage.output + usage.cacheRead + usage.cacheWrite;\n\tconst cost = usage.cost.total >= 0.01 ? ` (~$${usage.cost.total.toFixed(2)})` : \"\";\n\tconst label = kind === \"compaction\" ? \"Compaction\" : \"Branch summary\";\n\tthis.chatContainer.addChild(new Spacer(1));\n\tthis.chatContainer.addChild(\n\t\tnew Text(theme.fg(\"warning\", `${label}: ${tokens.toLocaleString()} tokens billed${cost}`), 1, 0),\n\t);\n};\n\nInteractiveModeBase.prototype.addCustomEntryToChat = function (this: InteractiveModeBase, entry: CustomEntry): void {\n\tconst renderer = this.session.extensionRunner.getEntryRenderer(entry.customType);\n\tif (!renderer) return;\n\tconst runner = this.session.extensionRunner;\n\tconst component = new CustomEntryComponent(\n\t\tentry,\n\t\t(...args) => runner.renderEntry(entry.customType, ...args),\n\t\tthis.outputPad,\n\t);\n\tcomponent.setExpanded(this.toolOutputExpanded);\n\tif (!component.hasContent()) return;\n\tmessageComponents.add(component);\n\tconst streamingIndex = this.streamingComponent ? this.chatContainer.children.indexOf(this.streamingComponent) : -1;\n\tif (streamingIndex >= 0) this.chatContainer.children.splice(streamingIndex, 0, component);\n\telse this.chatContainer.addChild(component);\n};\n\ntype AltScreenMessageCounterHost = TUI & {\n\tisFollowingOutput?: boolean;\n\tnewMessages?: NewMessageCounter;\n};\n\nInteractiveModeBase.prototype.addMessageToChat = function (\n\tthis: InteractiveModeBase,\n\tmessage: AgentMessage,\n\toptions?: { populateHistory?: boolean },\n): void {\n\tconst markdownTransformers = this.getMarkdownTransformers();\n\tswitch (message.role) {\n\t\tcase \"bashExecution\": {\n\t\t\tconst component = new BashExecutionComponent(\n\t\t\t\tmessage.command,\n\t\t\t\tthis.ui,\n\t\t\t\tmessage.excludeFromContext,\n\t\t\t\tthis.outputPad,\n\t\t\t);\n\t\t\tif (message.output) {\n\t\t\t\tcomponent.appendOutput(message.output);\n\t\t\t}\n\t\t\tcomponent.setComplete(\n\t\t\t\tmessage.exitCode,\n\t\t\t\tmessage.cancelled,\n\t\t\t\tmessage.truncated ? ({ truncated: true } as TruncationResult) : undefined,\n\t\t\t\tmessage.fullOutputPath,\n\t\t\t);\n\t\t\tmessageComponents.add(component);\n\t\t\tthis.chatContainer.addChild(component);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"custom\": {\n\t\t\tif (message.display) {\n\t\t\t\tconst component =\n\t\t\t\t\tthis.runtimeHost instanceof IsolatedInteractiveRuntime\n\t\t\t\t\t\t? new RemoteCustomMessageComponent(\n\t\t\t\t\t\t\t\tmessage,\n\t\t\t\t\t\t\t\tthis.runtimeHost,\n\t\t\t\t\t\t\t\t() => this.ui.requestRender(),\n\t\t\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: new CustomMessageComponent(\n\t\t\t\t\t\t\t\tmessage,\n\t\t\t\t\t\t\t\tthis.session.extensionRunner.getMessageRenderer(message.customType),\n\t\t\t\t\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t\t\t\t\t\tmarkdownTransformers,\n\t\t\t\t\t\t\t);\n\t\t\t\tcomponent.setExpanded(this.toolOutputExpanded);\n\t\t\t\tmessageComponents.add(component);\n\t\t\t\tthis.chatContainer.addChild(component);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"branchSummary\": {\n\t\t\tthis.chatContainer.addChild(new Spacer(1));\n\t\t\tconst component = new BranchSummaryMessageComponent(\n\t\t\t\tmessage,\n\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t\tthis.outputPad,\n\t\t\t\tmarkdownTransformers,\n\t\t\t);\n\t\t\tcomponent.setExpanded(this.toolOutputExpanded);\n\t\t\tmessageComponents.add(component);\n\t\t\tthis.chatContainer.addChild(component);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"user\": {\n\t\t\tconst textContent = this.getUserMessageText(message);\n\t\t\tif (textContent) {\n\t\t\t\tif (this.chatContainer.children.length > 0) {\n\t\t\t\t\tthis.chatContainer.addChild(new Spacer(1));\n\t\t\t\t}\n\t\t\t\tconst skillBlock = parseSkillBlock(textContent);\n\t\t\t\tif (skillBlock) {\n\t\t\t\t\t// Render skill block (collapsible)\n\t\t\t\t\tconst component = new SkillInvocationMessageComponent(\n\t\t\t\t\t\tskillBlock,\n\t\t\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t\tmarkdownTransformers,\n\t\t\t\t\t);\n\t\t\t\t\tcomponent.setExpanded(this.toolOutputExpanded);\n\t\t\t\t\tthis.chatContainer.addChild(component);\n\t\t\t\t\t// Render user message separately if present\n\t\t\t\t\tif (skillBlock.userMessage) {\n\t\t\t\t\t\tconst userComponent = new UserMessageComponent(\n\t\t\t\t\t\t\tskillBlock.userMessage,\n\t\t\t\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t\t\tmarkdownTransformers,\n\t\t\t\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tmessageComponents.add(userComponent);\n\t\t\t\t\t\tthis.chatContainer.addChild(userComponent);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmessageComponents.add(component);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconst userComponent = new UserMessageComponent(\n\t\t\t\t\t\ttextContent,\n\t\t\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t\tmarkdownTransformers,\n\t\t\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t\t\t);\n\t\t\t\t\tmessageComponents.add(userComponent);\n\t\t\t\t\tthis.chatContainer.addChild(userComponent);\n\t\t\t\t}\n\t\t\t\tif (options?.populateHistory) {\n\t\t\t\t\tthis.editor.addToHistory?.(textContent);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"assistant\": {\n\t\t\tconst assistantComponent = new AssistantMessageComponent(\n\t\t\t\tmessage,\n\t\t\t\tthis.hideThinkingBlock,\n\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\tthis.hiddenThinkingLabel,\n\t\t\t\tthis.outputPad,\n\t\t\t\tmarkdownTransformers,\n\t\t\t\tfalse,\n\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t);\n\t\t\tmessageComponents.add(assistantComponent);\n\t\t\tthis.chatContainer.addChild(assistantComponent);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"toolResult\": {\n\t\t\t// Tool results are rendered inline with tool calls, handled separately\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tbreak;\n\t}\n};\n\nInteractiveModeBase.prototype.renderSessionContext = function (\n\tthis: InteractiveModeBase,\n\tsessionContext: SessionContext,\n\toptions: { updateFooter?: boolean; populateHistory?: boolean } = {},\n): void {\n\tthis.pendingTools.clear();\n\tconst pendingEchoes = takeDeferredEchoes(this);\n\n\tif (options.updateFooter) {\n\t\tthis.footer.invalidate();\n\t\tthis.updateEditorBorderColor();\n\t}\n\n\tconst entries = chatEntriesFromAgentMessages(sessionContext.messages);\n\tfor (const entry of entries) {\n\t\tconst component = this.addRenderedChatEntry(entry);\n\t\tif (entry.kind === \"tool\" && entry.isPartial !== false && component instanceof ToolExecutionComponent) {\n\t\t\tthis.pendingTools.set(entry.toolCallId, component);\n\t\t}\n\t\tif (options.populateHistory && entry.kind === \"user\") {\n\t\t\tthis.editor.addToHistory?.(entry.text);\n\t\t}\n\t}\n\n\trestoreDeferredEchoes(this, pendingEchoes);\n\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.renderSessionEntries = function (\n\tthis: InteractiveModeBase,\n\tsessionEntries: SessionEntry[],\n\toptions: {\n\t\tupdateFooter?: boolean;\n\t\tpopulateHistory?: boolean;\n\t\tsuppressCompactionBoundary?: VerbatimCompactionResult;\n\t} = {},\n): void {\n\tthis.resetTranscriptSelection();\n\tthis.pendingTools.clear();\n\tconst pendingEchoes = takeDeferredEchoes(this);\n\tif (options.updateFooter) {\n\t\tthis.footer.invalidate();\n\t\tthis.updateEditorBorderColor();\n\t}\n\tlet messageBuffer: AgentMessage[] = [];\n\tconst messageMeta = new Map<AgentMessage, PersistedMessageMeta>();\n\tlet firstMessage = true;\n\tconst flushMessages = (): void => {\n\t\tif (\n\t\t\toptions.suppressCompactionBoundary &&\n\t\t\tfirstMessage &&\n\t\t\tisSynthesizedCompactionBoundary(messageBuffer[0], options.suppressCompactionBoundary)\n\t\t) {\n\t\t\tmessageBuffer = messageBuffer.slice(1);\n\t\t}\n\t\tfirstMessage = false;\n\t\tfor (const entry of chatEntriesFromAgentMessages(messageBuffer, messageMeta)) {\n\t\t\tconst component = this.addRenderedChatEntry(entry);\n\t\t\tif (entry.kind === \"assistant\") addServiceTierWarnings(this, entry.message);\n\t\t\tif (entry.kind === \"tool\" && entry.isPartial !== false && component instanceof ToolExecutionComponent) {\n\t\t\t\tthis.pendingTools.set(entry.toolCallId, component);\n\t\t\t}\n\t\t\tif (options.populateHistory && entry.kind === \"user\") this.editor.addToHistory?.(entry.text);\n\t\t}\n\t\tmessageBuffer = [];\n\t};\n\tfor (const entry of sessionEntries) {\n\t\tif (entry.type === \"custom\") {\n\t\t\t// An unrendered record between a tool call and its result must not split them into two cards.\n\t\t\tif (!this.session.extensionRunner.getEntryRenderer(entry.customType)) continue;\n\t\t\tflushMessages();\n\t\t\tthis.addCustomEntryToChat(entry);\n\t\t} else {\n\t\t\tconst messages = sessionEntryToContextMessages(entry);\n\t\t\tfor (const message of messages) messageMeta.set(message, { id: entry.id, timestamp: entry.timestamp });\n\t\t\tmessageBuffer.push(...messages);\n\t\t\tif ((entry.type === \"compaction\" || entry.type === \"branch_summary\") && entry.usage) {\n\t\t\t\tflushMessages();\n\t\t\t\tconst suppressedLiveBoundary =\n\t\t\t\t\tentry.type === \"compaction\" &&\n\t\t\t\t\toptions.suppressCompactionBoundary !== undefined &&\n\t\t\t\t\tentry.summary === options.suppressCompactionBoundary.compactedText &&\n\t\t\t\t\tentry.tokensBefore === options.suppressCompactionBoundary.tokensBefore;\n\t\t\t\tif (!suppressedLiveBoundary) this.addCompactionCostNotice(entry.type, entry.usage);\n\t\t\t}\n\t\t}\n\t}\n\tflushMessages();\n\tif (this.settingsManager.getShowCacheMissNotices()) {\n\t\tfor (const miss of collectCacheMisses(\n\t\t\tsessionEntries,\n\t\t\tcreateCacheMissModelSource(this.session.modelRuntime),\n\t\t).values()) {\n\t\t\tthis.chatContainer.addChild(new Text(theme.fg(\"warning\", formatCacheMissNotice(miss)), 1, 0));\n\t\t}\n\t}\n\trestoreDeferredEchoes(this, pendingEchoes);\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.attachStartupNoticesContainer = function (\n\tthis: InteractiveModeBase,\n\toptions: { resetDetached?: boolean } = {},\n): void {\n\tconst disclosureIndex = this.chatContainer.children.indexOf(this.resourceDisclosureContainer);\n\tconst noticesIndex = this.chatContainer.children.indexOf(this.startupNoticesContainer);\n\tif (disclosureIndex >= 0 && noticesIndex >= 0) return;\n\tif (disclosureIndex < 0) {\n\t\tif (options.resetDetached) this.resourceDisclosureContainer.clear();\n\t\tif (noticesIndex >= 0) this.chatContainer.children.splice(noticesIndex, 0, this.resourceDisclosureContainer);\n\t\telse this.chatContainer.addChild(this.resourceDisclosureContainer);\n\t}\n\tif (noticesIndex < 0) {\n\t\tif (options.resetDetached) this.startupNoticesContainer.clear();\n\t\tthis.chatContainer.addChild(this.startupNoticesContainer);\n\t}\n};\n\nconst renderedSessionIds = new WeakMap<InteractiveModeBase, string>();\n\n/**\n * Clear the transcript to render it again. While the reader is scrolled up, arrivals not painted yet are counted first,\n * so that the re-render, which keeps the unread count, keeps them unread.\n */\nexport function clearChatForRerender(mode: InteractiveModeBase): void {\n\tconst renderer = mode.ui as AltScreenMessageCounterHost;\n\tif (renderer.isFollowingOutput === false && mode.chatContainer.children.length > 0) {\n\t\trenderer.newMessages?.observe(false, mode.chatContainer.children.filter(isChatMessageComponent).length);\n\t}\n\tmode.chatContainer.clear();\n}\n\nInteractiveModeBase.prototype.renderInitialMessages = function (this: InteractiveModeBase): void {\n\tconst sessionId = this.sessionManager.getSessionId();\n\tconst previousSessionId = renderedSessionIds.get(this);\n\trenderedSessionIds.set(this, sessionId);\n\tconst renderer = this.ui as AltScreenMessageCounterHost;\n\tif (previousSessionId !== sessionId) renderer.newMessages?.reset();\n\tthis.attachStartupNoticesContainer({ resetDetached: true });\n\tconst entries = buildContextEntries(this.sessionManager.getEntries(), this.sessionManager.getLeafId());\n\tthis.renderSessionEntries(entries, { updateFooter: true, populateHistory: true });\n\trenderProjectTrustWarningIfNeeded(this);\n\trefreshInteractiveTasks(this);\n\tif (previousSessionId === sessionId) {\n\t\trenderer.newMessages?.replaced(this.chatContainer.children.filter(isChatMessageComponent).length);\n\t}\n};\n\nfunction renderProjectTrustWarningIfNeeded(mode: InteractiveModeBase): void {\n\tif (mode.settingsManager.isProjectTrusted() || !hasTrustRequiringProjectResources(mode.sessionManager.getCwd())) {\n\t\treturn;\n\t}\n\tif (mode.chatContainer.children.length > 0) {\n\t\tmode.chatContainer.addChild(new Spacer(1));\n\t}\n\tmode.chatContainer.addChild(\n\t\tnew ThemedText(\n\t\t\t() =>\n\t\t\t\ttheme.fg(\n\t\t\t\t\t\"warning\",\n\t\t\t\t\t`This project is not trusted. Project ${CONFIG_DIR_NAME} resources and packages are ignored. Use /trust to save a trust decision, then restart ${APP_NAME}.`,\n\t\t\t\t),\n\t\t\t1,\n\t\t\t0,\n\t\t),\n\t);\n}\n\nInteractiveModeBase.prototype.getUserInput = async function (\n\tthis: InteractiveModeBase,\n): Promise<InteractiveSubmission> {\n\twhile (true) {\n\t\tconst queuedInput = this.pendingUserInputs.shift();\n\t\tif (queuedInput !== undefined) {\n\t\t\treturn queuedInput;\n\t\t}\n\n\t\tif (this.startupReplayActiveInput) {\n\t\t\tawait this.drainStartupReplayCommands();\n\t\t\tcontinue;\n\t\t}\n\n\t\treturn new Promise((resolve) => {\n\t\t\tthis.onInputCallback = (submission: InteractiveSubmission) => {\n\t\t\t\tthis.onInputCallback = undefined;\n\t\t\t\tresolve(submission);\n\t\t\t};\n\t\t\tif (!this.inputHandlerReadyRecorded) {\n\t\t\t\tthis.inputHandlerReadyRecorded = true;\n\t\t\t\trecordTimeSinceReset(\"interactive-input-handler-ready\");\n\t\t\t\tmarkLifecycleTiming(\"interactive-input-handler-ready\");\n\t\t\t\tvoid (async () => {\n\t\t\t\t\tawait yieldToEventLoop();\n\t\t\t\t\t// pi parity: the changelog/first-run notices need nothing from\n\t\t\t\t\t// extensions — render them right after the input handler is ready\n\t\t\t\t\t// instead of gating them behind the deferred extension reload (or,\n\t\t\t\t\t// when the user types immediately, behind the whole agent turn).\n\t\t\t\t\tthis.showStartupNoticesIfNeeded(this.startupNoticesContainer);\n\t\t\t\t\tthis.footerDataProvider.startGitWatcher();\n\t\t\t\t\tif (this.deferredStartupPending) {\n\t\t\t\t\t\tawait this.ensureDeferredStartupComplete();\n\t\t\t\t\t}\n\t\t\t\t})().catch((error) => {\n\t\t\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\t\t\tconsole.error(`Deferred input-readiness startup task failed: ${message}`);\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n};\n\nInteractiveModeBase.prototype.rebuildChatFromMessages = function (\n\tthis: InteractiveModeBase,\n\toptions: {\n\t\tsuppressCompactionBoundary?: VerbatimCompactionResult;\n\t\tresetStartupDisclosure?: boolean;\n\t} = {},\n): void {\n\t// Generic rebuilds keep the same session: pending fd/rg callbacks still own\n\t// this transcript. Full session replacements invalidate their generation in\n\t// renderCurrentSessionState() before rebuilding the replacement transcript.\n\tconst renderer = this.ui as AltScreenMessageCounterHost;\n\tthis.managedToolStatusStarted = false;\n\tthis.lastStatusSpacer = undefined;\n\tthis.lastStatusText = undefined;\n\tclearChatForRerender(this);\n\tif (options.resetStartupDisclosure) this.resourceDisclosureContainer.clear();\n\tthis.attachStartupNoticesContainer();\n\tconst entries = buildContextEntries(this.sessionManager.getEntries(), this.sessionManager.getLeafId());\n\tthis.renderSessionEntries(entries, { suppressCompactionBoundary: options.suppressCompactionBoundary });\n\trenderer.newMessages?.replaced(this.chatContainer.children.filter(isChatMessageComponent).length);\n};\n\nfunction isSynthesizedCompactionBoundary(message: AgentMessage | undefined, result: VerbatimCompactionResult): boolean {\n\tif (message?.role !== \"custom\" || message.customType !== \"compaction\" || !message.display) return false;\n\tconst details = message.details as { strategy?: string } | undefined;\n\tif (details?.strategy !== \"verbatim-lines\") return false;\n\tconst content = Array.isArray(message.content)\n\t\t? message.content\n\t\t\t\t.filter((block) => block.type === \"text\")\n\t\t\t\t.map((block) => block.text)\n\t\t\t\t.join(\"\\n\")\n\t\t: message.content;\n\treturn stripVerbatimCompactionPrefix(content) === result.compactedText;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interactive-render-chat.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-render-chat.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClH,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;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_DIR_NAME } from \"../../config.js\";\nimport { collectCacheMisses, createCacheMissModelSource, formatCacheMissNotice } from \"../../core/cache-stats.ts\";\nimport { markLifecycleTiming } from \"../../core/lifecycle-timings.ts\";\nimport { isVerbatimCompactionMessage, stripVerbatimCompactionPrefix } from \"../../core/messages.ts\";\nimport { serviceTierWarnings } from \"../../core/service-tier-warnings.ts\";\nimport type { CustomEntry } from \"../../core/session-manager.ts\";\nimport { buildContextEntries, type SessionEntry, sessionEntryToContextMessages } from \"../../core/session-manager.ts\";\nimport { yieldToEventLoop } from \"../../utils/event-loop.ts\";\nimport { IsolatedInteractiveRuntime } from \"../interactive-engine/isolated-runtime.js\";\nimport { RemoteCustomMessageComponent, RemoteToolExecutionComponent } from \"../interactive-engine/remote-renderer.ts\";\nimport { appendBoundedStderr } from \"../rpc/rpc-client-process.js\";\nimport { messageComponents, statusComponents } from \"./chat-message-count.ts\";\nimport { CustomEntryComponent } from \"./components/custom-entry.ts\";\nimport type { NewMessageCounter } from \"./components/jump-to-latest.ts\";\nimport { createMarkdownTransform } from \"./components/markdown-transform.ts\";\nimport { createMermaidMarkdownTransformer } from \"./components/mermaid.ts\";\nimport { ThemedText } from \"./components/themed-text.js\";\nimport { appendNewChildrenBeforeAttachedChild } from \"./interactive-child-ordering.ts\";\nimport { countChatMessages, InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport {\n\ttype AgentMessage,\n\tAPP_NAME,\n\tAssistantMessageComponent,\n\taddChatTranscriptEntry,\n\tBashExecutionComponent,\n\tBranchSummaryMessageComponent,\n\ttype ChatMessageEntry,\n\ttype ChatMessageRenderOptions,\n\tCompactionBoundaryMessageComponent,\n\ttype Component,\n\tCustomMessageComponent,\n\tchatEntriesFromAgentMessages,\n\thasTrustRequiringProjectResources,\n\tMarkdown,\n\ttype Message,\n\ttype PersistedMessageMeta,\n\tparseSkillBlock,\n\trecordTimeSinceReset,\n\trenderChatMessageEntry,\n\ttype SessionContext,\n\tSkillInvocationMessageComponent,\n\tSpacer,\n\tText,\n\tToolExecutionComponent,\n\ttype TruncationResult,\n\ttheme,\n\tUserMessageComponent,\n\ttype VerbatimCompactionResult,\n} from \"./interactive-mode-deps.ts\";\nimport type { InteractiveSubmission } from \"./interactive-submission.ts\";\nimport { refreshInteractiveTasks } from \"./interactive-task-projection.js\";\n\nfunction countDroppedThinkingBlocks(message: AssistantMessage): number {\n\treturn (message.diagnostics ?? []).reduce((count, diagnostic) => {\n\t\tif (diagnostic.type !== \"anthropic_input_transformations\") return count;\n\t\tconst dropped = diagnostic.details?.droppedBlockCount;\n\t\treturn count + (typeof dropped === \"number\" && dropped > 0 ? dropped : 0);\n\t}, 0);\n}\n\nfunction addServiceTierWarnings(mode: InteractiveModeBase, message: AssistantMessage): void {\n\tfor (const warning of serviceTierWarnings(message)) {\n\t\tmode.chatContainer.addChild(new Spacer(1));\n\t\tmode.chatContainer.addChild(new Text(theme.fg(\"warning\", `Warning: ${warning}`), 1, 0));\n\t}\n}\n\nInteractiveModeBase.prototype.maybeShowAssistantDiagnostics = function (\n\tthis: InteractiveModeBase,\n\tmessage: AssistantMessage,\n): void {\n\taddServiceTierWarnings(this, message);\n\tif (!this.settingsManager.getShowCacheMissNotices()) return;\n\n\tconst count = countDroppedThinkingBlocks(message);\n\tif (count === 0) return;\n\tlet previousCount = 0;\n\t// The live message_end notification precedes persistence of this response.\n\tconst branch = this.sessionManager.getBranch();\n\tfor (let i = branch.length - 1; i >= 0; i--) {\n\t\tconst entry = branch[i];\n\t\tif (entry.type === \"message\" && entry.message.role === \"assistant\") {\n\t\t\tpreviousCount = countDroppedThinkingBlocks(entry.message);\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (count <= previousCount) return;\n\tconst noun = count === 1 ? \"thinking block\" : \"thinking blocks\";\n\tthis.chatContainer.addChild(new Spacer(1));\n\tthis.chatContainer.addChild(\n\t\tnew Text(theme.fg(\"warning\", `Anthropic dropped ${count} ${noun} (details in session)`), 1, 0),\n\t);\n};\n\n// Weak keys leave cleared/rebuilt transcripts collectible without separate lifecycle state.\n// Only persistent diagnostic statuses participate; ordinary chat/status is never evicted.\nconst diagnosticStatuses = new WeakMap<Component, { spacer: Spacer; bytes: number }>();\nconst MAX_DIAGNOSTIC_STATUSES = 64;\nconst MAX_DIAGNOSTIC_HISTORY_BYTES = 256 * 1024;\n\nInteractiveModeBase.prototype.showStatus = function (\n\tthis: InteractiveModeBase,\n\tmessage: string,\n\tpersist = false,\n): void {\n\tconst children = this.chatContainer.children;\n\tconst last = children.length > 0 ? children[children.length - 1] : undefined;\n\tconst secondLast = children.length > 1 ? children[children.length - 2] : undefined;\n\n\tif (!persist && last && secondLast && last === this.lastStatusText && secondLast === this.lastStatusSpacer) {\n\t\tthis.lastStatusText.setText(theme.fg(\"dim\", message));\n\t\tthis.ui.requestRender();\n\t\treturn;\n\t}\n\n\tif (persist) message = appendBoundedStderr(\"\", message);\n\tconst spacer = new Spacer(1);\n\tconst text = new Text(theme.fg(\"dim\", message), 1, 0);\n\tstatusComponents.add(text);\n\tthis.chatContainer.addChild(spacer);\n\tthis.chatContainer.addChild(text);\n\tthis.lastStatusSpacer = persist ? undefined : spacer;\n\tthis.lastStatusText = persist ? undefined : text;\n\tif (persist) {\n\t\tdiagnosticStatuses.set(text, { spacer, bytes: Buffer.byteLength(message) });\n\t\tlet count = 0;\n\t\tlet bytes = 0;\n\t\tfor (const child of [...children].reverse()) {\n\t\t\tconst diagnostic = diagnosticStatuses.get(child);\n\t\t\tif (!diagnostic) continue;\n\t\t\tcount++;\n\t\t\tbytes += diagnostic.bytes;\n\t\t\tif (count > MAX_DIAGNOSTIC_STATUSES || bytes > MAX_DIAGNOSTIC_HISTORY_BYTES) {\n\t\t\t\tthis.chatContainer.removeChild(child);\n\t\t\t\tthis.chatContainer.removeChild(diagnostic.spacer);\n\t\t\t}\n\t\t}\n\t}\n\tthis.ui.requestRender();\n};\n\nconst echoReadEpochs = new WeakMap<Component[], number>();\n\nInteractiveModeBase.prototype.renderDeferredUserInput = function (this: InteractiveModeBase, text: string): void {\n\tthis.deferredRenderedUserInputs.push(text);\n\tconst startIndex = this.chatContainer.children.length;\n\tthis.addMessageToChat({ role: \"user\", content: text } as AgentMessage);\n\tconst renderedComponents = this.chatContainer.children.slice(startIndex);\n\tconst epoch = (this.ui as AltScreenMessageCounterHost).newMessages?.epoch;\n\tif (epoch !== undefined) echoReadEpochs.set(renderedComponents, epoch);\n\tconst trackedComponents = this.deferredRenderedUserInputComponents.get(text) ?? [];\n\ttrackedComponents.push(renderedComponents);\n\tthis.deferredRenderedUserInputComponents.set(text, trackedComponents);\n\tthis.updatePendingMessagesDisplay();\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.consumeDeferredRenderedUserInput = function (\n\tthis: InteractiveModeBase,\n\ttext: string,\n): boolean {\n\tconst index = this.deferredRenderedUserInputs.indexOf(text);\n\tif (index === -1) return false;\n\tthis.deferredRenderedUserInputs.splice(index, 1);\n\tif (this.startedDeferredUserInput === text) this.startedDeferredUserInput = undefined;\n\tconst trackedComponents = this.deferredRenderedUserInputComponents.get(text);\n\ttrackedComponents?.shift();\n\tif (trackedComponents && trackedComponents.length === 0) {\n\t\tthis.deferredRenderedUserInputComponents.delete(text);\n\t}\n\treturn true;\n};\n\nfunction forgetDeferredEcho(mode: InteractiveModeBase, text: string): Component[] | undefined {\n\tconst index = mode.deferredRenderedUserInputs.indexOf(text);\n\tif (index !== -1) {\n\t\tmode.deferredRenderedUserInputs.splice(index, 1);\n\t\tif (mode.startedDeferredUserInput === text) mode.startedDeferredUserInput = undefined;\n\t}\n\tconst trackedComponents = mode.deferredRenderedUserInputComponents.get(text);\n\tconst components = trackedComponents?.shift();\n\tif (trackedComponents && trackedComponents.length === 0) {\n\t\tmode.deferredRenderedUserInputComponents.delete(text);\n\t}\n\treturn components;\n}\n\nfunction takeDeferredEchoes(mode: InteractiveModeBase): Array<{ text: string; epoch: number | undefined }> {\n\tconst occurrences = new Map<string, number>();\n\tconst echoes = mode.deferredRenderedUserInputs.map((text) => {\n\t\tconst occurrence = occurrences.get(text) ?? 0;\n\t\toccurrences.set(text, occurrence + 1);\n\t\tconst components = mode.deferredRenderedUserInputComponents.get(text)?.[occurrence];\n\t\treturn { text, epoch: components ? echoReadEpochs.get(components) : undefined };\n\t});\n\tmode.deferredRenderedUserInputs = [];\n\tmode.deferredRenderedUserInputComponents.clear();\n\treturn echoes;\n}\n\nfunction restoreDeferredEchoes(\n\tmode: InteractiveModeBase,\n\techoes: ReadonlyArray<{ text: string; epoch: number | undefined }>,\n): void {\n\tfor (const { text, epoch } of echoes) {\n\t\tmode.renderDeferredUserInput(text);\n\t\tconst tracked = mode.deferredRenderedUserInputComponents.get(text);\n\t\tconst components = tracked?.[tracked.length - 1];\n\t\tif (components && epoch !== undefined) echoReadEpochs.set(components, epoch);\n\t}\n}\n\nInteractiveModeBase.prototype.discardDeferredRenderedUserInput = function (\n\tthis: InteractiveModeBase,\n\ttext: string,\n): void {\n\tconst componentsToRemove = forgetDeferredEcho(this, text);\n\tif (!componentsToRemove) return;\n\tconst renderer = this.ui as AltScreenMessageCounterHost;\n\tconst following = renderer.isFollowingOutput !== false;\n\tconst countedBefore = countChatMessages(this.chatContainer);\n\tif (!following) renderer.newMessages?.observe(false, countedBefore);\n\tfor (const component of componentsToRemove) this.chatContainer.removeChild(component);\n\tconst counted = countChatMessages(this.chatContainer);\n\tconst counter = renderer.newMessages;\n\tif (!following && counter && echoReadEpochs.get(componentsToRemove) === counter.epoch) {\n\t\tcounter.retract(countedBefore - counted);\n\t}\n\tcounter?.observe(following, counted);\n\tthis.updatePendingMessagesDisplay();\n\tthis.ui.requestRender();\n};\n\n/**\n * The session started a run for a submission this host echoed as `text`. The run begins with the submission's message,\n * as sent: an `input` hook may have rewritten it, so its `message_start` need not match the echo (#4277). An engine's\n * answer can reach the host after that `message_start`, which the session then showed itself (#4272): if it showed any\n * message of its own since `shownBefore`, the echo goes. Otherwise the session's next message that matches no echo\n * takes the echo's place. A run starts only after the one before it showed its message, so an earlier run still\n * waiting here never got to show it, and its echo stays as it is.\n */\nInteractiveModeBase.prototype.expectStartedUserInput = function (\n\tthis: InteractiveModeBase,\n\ttext: string,\n\tshownBefore: number,\n): void {\n\tif (!this.deferredRenderedUserInputs.includes(text)) return;\n\tif (this.userMessagesShownBySession !== shownBefore) this.discardDeferredRenderedUserInput(text);\n\telse this.startedDeferredUserInput = text;\n};\n\n/** Show a user message from the session: in place of its echo, or of the echo of the run it started, or as new. */\nInteractiveModeBase.prototype.showSessionUserMessage = function (this: InteractiveModeBase, message: Message): void {\n\tif (this.consumeDeferredRenderedUserInput(this.getUserMessageText(message))) return;\n\tconst started = this.startedDeferredUserInput;\n\tif (started !== undefined) {\n\t\tconst renderer = this.ui as AltScreenMessageCounterHost;\n\t\tconst following = renderer.isFollowingOutput !== false;\n\t\tconst countedBefore = countChatMessages(this.chatContainer);\n\t\trenderer.newMessages?.observe(following, countedBefore);\n\t\tconst echo = forgetDeferredEcho(this, started);\n\t\tappendNewChildrenBeforeAttachedChild(this.chatContainer, echo?.[0], () => this.addMessageToChat(message));\n\t\tfor (const component of echo ?? []) this.chatContainer.removeChild(component);\n\t\tconst counted = countChatMessages(this.chatContainer);\n\t\tconst counter = renderer.newMessages;\n\t\tif (!following && counter && echo && echoReadEpochs.get(echo) === counter.epoch) {\n\t\t\tcounter.retract(countedBefore - counted);\n\t\t}\n\t\tcounter?.replaced(counted);\n\t\tthis.updatePendingMessagesDisplay();\n\t\tthis.ui.requestRender();\n\t\treturn;\n\t}\n\tthis.userMessagesShownBySession += 1;\n\tthis.addMessageToChat(message);\n};\n\nInteractiveModeBase.prototype.getMarkdownTransformers = function (this: InteractiveModeBase) {\n\tconst mode = this.settingsManager.getMermaidRenderingMode();\n\tif (this.mermaidMarkdownTransformerMode !== mode) {\n\t\tthis.mermaidMarkdownTransformerMode = mode;\n\t\tthis.mermaidMarkdownTransformer = createMermaidMarkdownTransformer({\n\t\t\tgetMode: () => this.settingsManager.getMermaidRenderingMode(),\n\t\t\ttheme,\n\t\t});\n\t}\n\tconst extensionTransformers =\n\t\tthis.runtimeHost instanceof IsolatedInteractiveRuntime\n\t\t\t? []\n\t\t\t: this.session.extensionRunner.getMarkdownTransformers();\n\treturn [this.mermaidMarkdownTransformer, ...extensionTransformers];\n};\n\n/**\n * Markdown of a changelog that runs the Markdown transformers registered for the `changelog` type. Transformers are\n * looked up on each render, so a notice shown before deferred extensions load uses them once it is invalidated.\n */\nInteractiveModeBase.prototype.createChangelogMarkdown = function (\n\tthis: InteractiveModeBase,\n\tmarkdown: string,\n\tpaddingX: number,\n\tpaddingY: number,\n): Markdown {\n\treturn new Markdown(markdown, paddingX, paddingY, this.getMarkdownThemeWithSettings(), undefined, {\n\t\ttransform: (text, width) =>\n\t\t\tcreateMarkdownTransform(\"changelog\", () => false, this.getMarkdownTransformers())(text, width),\n\t});\n};\n\nInteractiveModeBase.prototype.chatMessageRenderOptions = function (\n\tthis: InteractiveModeBase,\n): ChatMessageRenderOptions {\n\tconst isolated = this.runtimeHost instanceof IsolatedInteractiveRuntime;\n\treturn {\n\t\tui: this.ui,\n\t\tcwd: this.sessionManager.getCwd(),\n\t\tmarkdownTheme: this.getMarkdownThemeWithSettings(),\n\t\thideThinkingBlock: this.hideThinkingBlock,\n\t\thiddenThinkingLabel: this.hiddenThinkingLabel,\n\t\ttoolOutputExpanded: this.toolOutputExpanded,\n\t\tshowImages: this.settingsManager.getShowImages(),\n\t\timageWidthCells: this.settingsManager.getImageWidthCells(),\n\t\toutputPad: this.outputPad,\n\t\trenderLatex: this.settingsManager.getLatexRenderingEnabled(),\n\t\tmarkdownTransformers: this.getMarkdownTransformers(),\n\t\tgetToolDefinition: isolated ? undefined : (toolName) => this.getRegisteredToolDefinition(toolName),\n\t\tgetCustomMessageRenderer: isolated\n\t\t\t? undefined\n\t\t\t: (customType) => this.session.extensionRunner.getMessageRenderer(customType),\n\t\tcreateToolComponent: isolated\n\t\t\t? (entry) => {\n\t\t\t\t\tconst component = new RemoteToolExecutionComponent(\n\t\t\t\t\t\tentry.toolName,\n\t\t\t\t\t\tentry.toolCallId,\n\t\t\t\t\t\tentry.args,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tshowImages: this.settingsManager.getShowImages(),\n\t\t\t\t\t\t\timageWidthCells: this.settingsManager.getImageWidthCells(),\n\t\t\t\t\t\t\toutputPad: this.outputPad,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tthis.runtimeHost as IsolatedInteractiveRuntime,\n\t\t\t\t\t\t() => this.ui.requestRender(),\n\t\t\t\t\t);\n\t\t\t\t\tcomponent.setExpanded(this.toolOutputExpanded);\n\t\t\t\t\tif (entry.result) component.updateResult(entry.result, entry.isPartial ?? false);\n\t\t\t\t\treturn component;\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tcreateCustomMessageComponent: isolated\n\t\t\t? (message) => {\n\t\t\t\t\tconst component = new RemoteCustomMessageComponent(\n\t\t\t\t\t\tmessage,\n\t\t\t\t\t\tthis.runtimeHost as IsolatedInteractiveRuntime,\n\t\t\t\t\t\t() => this.ui.requestRender(),\n\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t);\n\t\t\t\t\tcomponent.setExpanded(this.toolOutputExpanded);\n\t\t\t\t\treturn component;\n\t\t\t\t}\n\t\t\t: undefined,\n\t};\n};\n\nInteractiveModeBase.prototype.addRenderedChatEntry = function (\n\tthis: InteractiveModeBase,\n\tentry: ChatMessageEntry,\n): Component {\n\tconst component = renderChatMessageEntry(entry, this.chatMessageRenderOptions());\n\tif (entry.kind !== \"system\" && !(entry.kind === \"custom\" && isVerbatimCompactionMessage(entry.message))) {\n\t\tmessageComponents.add(component);\n\t}\n\taddChatTranscriptEntry(this.chatContainer, component, entry.role);\n\treturn component;\n};\n\nInteractiveModeBase.prototype.addCompactionBoundaryToChat = function (\n\tthis: InteractiveModeBase,\n\tresult: VerbatimCompactionResult,\n): void {\n\tthis.chatContainer.addChild(new Spacer(1));\n\tconst component = new CompactionBoundaryMessageComponent(result, this.outputPad);\n\tcomponent.setExpanded(this.toolOutputExpanded);\n\tthis.chatContainer.addChild(component);\n};\n\nInteractiveModeBase.prototype.addCompactionCostNotice = function (\n\tthis: InteractiveModeBase,\n\tkind: \"compaction\" | \"branch_summary\",\n\tusage: Usage,\n): void {\n\tif (!this.settingsManager.getShowCacheMissNotices()) return;\n\tconst tokens = usage.input + usage.output + usage.cacheRead + usage.cacheWrite;\n\tconst cost = usage.cost.total >= 0.01 ? ` (~$${usage.cost.total.toFixed(2)})` : \"\";\n\tconst label = kind === \"compaction\" ? \"Compaction\" : \"Branch summary\";\n\tthis.chatContainer.addChild(new Spacer(1));\n\tthis.chatContainer.addChild(\n\t\tnew Text(theme.fg(\"warning\", `${label}: ${tokens.toLocaleString()} tokens billed${cost}`), 1, 0),\n\t);\n};\n\nInteractiveModeBase.prototype.addCustomEntryToChat = function (this: InteractiveModeBase, entry: CustomEntry): void {\n\tconst renderer = this.session.extensionRunner.getEntryRenderer(entry.customType);\n\tif (!renderer) return;\n\tconst runner = this.session.extensionRunner;\n\tconst component = new CustomEntryComponent(\n\t\tentry,\n\t\t(...args) => runner.renderEntry(entry.customType, ...args),\n\t\tthis.outputPad,\n\t);\n\tcomponent.setExpanded(this.toolOutputExpanded);\n\tif (!component.hasContent()) return;\n\tmessageComponents.add(component);\n\tconst streamingIndex = this.streamingComponent ? this.chatContainer.children.indexOf(this.streamingComponent) : -1;\n\tif (streamingIndex >= 0) this.chatContainer.children.splice(streamingIndex, 0, component);\n\telse this.chatContainer.addChild(component);\n};\n\ntype AltScreenMessageCounterHost = TUI & {\n\tisFollowingOutput?: boolean;\n\tnewMessages?: NewMessageCounter;\n};\n\nInteractiveModeBase.prototype.addMessageToChat = function (\n\tthis: InteractiveModeBase,\n\tmessage: AgentMessage,\n\toptions?: { populateHistory?: boolean },\n): void {\n\tconst markdownTransformers = this.getMarkdownTransformers();\n\tswitch (message.role) {\n\t\tcase \"bashExecution\": {\n\t\t\tconst component = new BashExecutionComponent(\n\t\t\t\tmessage.command,\n\t\t\t\tthis.ui,\n\t\t\t\tmessage.excludeFromContext,\n\t\t\t\tthis.outputPad,\n\t\t\t);\n\t\t\tif (message.output) {\n\t\t\t\tcomponent.appendOutput(message.output);\n\t\t\t}\n\t\t\tcomponent.setComplete(\n\t\t\t\tmessage.exitCode,\n\t\t\t\tmessage.cancelled,\n\t\t\t\tmessage.truncated ? ({ truncated: true } as TruncationResult) : undefined,\n\t\t\t\tmessage.fullOutputPath,\n\t\t\t);\n\t\t\tmessageComponents.add(component);\n\t\t\tthis.chatContainer.addChild(component);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"custom\": {\n\t\t\tif (message.display) {\n\t\t\t\tconst component =\n\t\t\t\t\tthis.runtimeHost instanceof IsolatedInteractiveRuntime\n\t\t\t\t\t\t? new RemoteCustomMessageComponent(\n\t\t\t\t\t\t\t\tmessage,\n\t\t\t\t\t\t\t\tthis.runtimeHost,\n\t\t\t\t\t\t\t\t() => this.ui.requestRender(),\n\t\t\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: new CustomMessageComponent(\n\t\t\t\t\t\t\t\tmessage,\n\t\t\t\t\t\t\t\tthis.session.extensionRunner.getMessageRenderer(message.customType),\n\t\t\t\t\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t\t\t\t\t\tmarkdownTransformers,\n\t\t\t\t\t\t\t);\n\t\t\t\tcomponent.setExpanded(this.toolOutputExpanded);\n\t\t\t\tmessageComponents.add(component);\n\t\t\t\tthis.chatContainer.addChild(component);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"branchSummary\": {\n\t\t\tthis.chatContainer.addChild(new Spacer(1));\n\t\t\tconst component = new BranchSummaryMessageComponent(\n\t\t\t\tmessage,\n\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t\tthis.outputPad,\n\t\t\t\tmarkdownTransformers,\n\t\t\t);\n\t\t\tcomponent.setExpanded(this.toolOutputExpanded);\n\t\t\tmessageComponents.add(component);\n\t\t\tthis.chatContainer.addChild(component);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"user\": {\n\t\t\tconst textContent = this.getUserMessageText(message);\n\t\t\tif (textContent) {\n\t\t\t\tif (this.chatContainer.children.length > 0) {\n\t\t\t\t\tthis.chatContainer.addChild(new Spacer(1));\n\t\t\t\t}\n\t\t\t\tconst skillBlock = parseSkillBlock(textContent);\n\t\t\t\tif (skillBlock) {\n\t\t\t\t\t// Render skill block (collapsible)\n\t\t\t\t\tconst component = new SkillInvocationMessageComponent(\n\t\t\t\t\t\tskillBlock,\n\t\t\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t\tmarkdownTransformers,\n\t\t\t\t\t);\n\t\t\t\t\tcomponent.setExpanded(this.toolOutputExpanded);\n\t\t\t\t\tif (!skillBlock.userMessage) messageComponents.add(component);\n\t\t\t\t\tthis.chatContainer.addChild(component);\n\t\t\t\t\t// Render user message separately if present\n\t\t\t\t\tif (skillBlock.userMessage) {\n\t\t\t\t\t\tconst userComponent = new UserMessageComponent(\n\t\t\t\t\t\t\tskillBlock.userMessage,\n\t\t\t\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t\t\tmarkdownTransformers,\n\t\t\t\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tmessageComponents.add(userComponent);\n\t\t\t\t\t\tthis.chatContainer.addChild(userComponent);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconst userComponent = new UserMessageComponent(\n\t\t\t\t\t\ttextContent,\n\t\t\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\t\t\tthis.outputPad,\n\t\t\t\t\t\tmarkdownTransformers,\n\t\t\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t\t\t);\n\t\t\t\t\tmessageComponents.add(userComponent);\n\t\t\t\t\tthis.chatContainer.addChild(userComponent);\n\t\t\t\t}\n\t\t\t\tif (options?.populateHistory) {\n\t\t\t\t\tthis.editor.addToHistory?.(textContent);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"assistant\": {\n\t\t\tconst assistantComponent = new AssistantMessageComponent(\n\t\t\t\tmessage,\n\t\t\t\tthis.hideThinkingBlock,\n\t\t\t\tthis.getMarkdownThemeWithSettings(),\n\t\t\t\tthis.hiddenThinkingLabel,\n\t\t\t\tthis.outputPad,\n\t\t\t\tmarkdownTransformers,\n\t\t\t\tfalse,\n\t\t\t\tthis.settingsManager.getLatexRenderingEnabled(),\n\t\t\t);\n\t\t\tmessageComponents.add(assistantComponent);\n\t\t\tthis.chatContainer.addChild(assistantComponent);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"toolResult\": {\n\t\t\t// Tool results are rendered inline with tool calls, handled separately\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tbreak;\n\t}\n};\n\nInteractiveModeBase.prototype.renderSessionContext = function (\n\tthis: InteractiveModeBase,\n\tsessionContext: SessionContext,\n\toptions: { updateFooter?: boolean; populateHistory?: boolean } = {},\n): void {\n\tthis.pendingTools.clear();\n\tconst pendingEchoes = takeDeferredEchoes(this);\n\n\tif (options.updateFooter) {\n\t\tthis.footer.invalidate();\n\t\tthis.updateEditorBorderColor();\n\t}\n\n\tconst entries = chatEntriesFromAgentMessages(sessionContext.messages);\n\tfor (const entry of entries) {\n\t\tconst component = this.addRenderedChatEntry(entry);\n\t\tif (entry.kind === \"tool\" && entry.isPartial !== false && component instanceof ToolExecutionComponent) {\n\t\t\tthis.pendingTools.set(entry.toolCallId, component);\n\t\t}\n\t\tif (options.populateHistory && entry.kind === \"user\") {\n\t\t\tthis.editor.addToHistory?.(entry.text);\n\t\t}\n\t}\n\n\trestoreDeferredEchoes(this, pendingEchoes);\n\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.renderSessionEntries = function (\n\tthis: InteractiveModeBase,\n\tsessionEntries: SessionEntry[],\n\toptions: {\n\t\tupdateFooter?: boolean;\n\t\tpopulateHistory?: boolean;\n\t\tsuppressCompactionBoundary?: VerbatimCompactionResult;\n\t} = {},\n): void {\n\tthis.resetTranscriptSelection();\n\tthis.pendingTools.clear();\n\tconst pendingEchoes = takeDeferredEchoes(this);\n\tif (options.updateFooter) {\n\t\tthis.footer.invalidate();\n\t\tthis.updateEditorBorderColor();\n\t}\n\tlet messageBuffer: AgentMessage[] = [];\n\tconst messageMeta = new Map<AgentMessage, PersistedMessageMeta>();\n\tlet firstMessage = true;\n\tconst flushMessages = (): void => {\n\t\tif (\n\t\t\toptions.suppressCompactionBoundary &&\n\t\t\tfirstMessage &&\n\t\t\tisSynthesizedCompactionBoundary(messageBuffer[0], options.suppressCompactionBoundary)\n\t\t) {\n\t\t\tmessageBuffer = messageBuffer.slice(1);\n\t\t}\n\t\tfirstMessage = false;\n\t\tfor (const entry of chatEntriesFromAgentMessages(messageBuffer, messageMeta)) {\n\t\t\tconst component = this.addRenderedChatEntry(entry);\n\t\t\tif (entry.kind === \"assistant\") addServiceTierWarnings(this, entry.message);\n\t\t\tif (entry.kind === \"tool\" && entry.isPartial !== false && component instanceof ToolExecutionComponent) {\n\t\t\t\tthis.pendingTools.set(entry.toolCallId, component);\n\t\t\t}\n\t\t\tif (options.populateHistory && entry.kind === \"user\") this.editor.addToHistory?.(entry.text);\n\t\t}\n\t\tmessageBuffer = [];\n\t};\n\tfor (const entry of sessionEntries) {\n\t\tif (entry.type === \"custom\") {\n\t\t\t// An unrendered record between a tool call and its result must not split them into two cards.\n\t\t\tif (!this.session.extensionRunner.getEntryRenderer(entry.customType)) continue;\n\t\t\tflushMessages();\n\t\t\tthis.addCustomEntryToChat(entry);\n\t\t} else {\n\t\t\tconst messages = sessionEntryToContextMessages(entry);\n\t\t\tfor (const message of messages) messageMeta.set(message, { id: entry.id, timestamp: entry.timestamp });\n\t\t\tmessageBuffer.push(...messages);\n\t\t\tif ((entry.type === \"compaction\" || entry.type === \"branch_summary\") && entry.usage) {\n\t\t\t\tflushMessages();\n\t\t\t\tconst suppressedLiveBoundary =\n\t\t\t\t\tentry.type === \"compaction\" &&\n\t\t\t\t\toptions.suppressCompactionBoundary !== undefined &&\n\t\t\t\t\tentry.summary === options.suppressCompactionBoundary.compactedText &&\n\t\t\t\t\tentry.tokensBefore === options.suppressCompactionBoundary.tokensBefore;\n\t\t\t\tif (!suppressedLiveBoundary) this.addCompactionCostNotice(entry.type, entry.usage);\n\t\t\t}\n\t\t}\n\t}\n\tflushMessages();\n\tif (this.settingsManager.getShowCacheMissNotices()) {\n\t\tfor (const miss of collectCacheMisses(\n\t\t\tsessionEntries,\n\t\t\tcreateCacheMissModelSource(this.session.modelRuntime),\n\t\t).values()) {\n\t\t\tthis.chatContainer.addChild(new Text(theme.fg(\"warning\", formatCacheMissNotice(miss)), 1, 0));\n\t\t}\n\t}\n\trestoreDeferredEchoes(this, pendingEchoes);\n\tthis.ui.requestRender();\n};\n\nInteractiveModeBase.prototype.attachStartupNoticesContainer = function (\n\tthis: InteractiveModeBase,\n\toptions: { resetDetached?: boolean } = {},\n): void {\n\tconst disclosureIndex = this.chatContainer.children.indexOf(this.resourceDisclosureContainer);\n\tconst noticesIndex = this.chatContainer.children.indexOf(this.startupNoticesContainer);\n\tif (disclosureIndex >= 0 && noticesIndex >= 0) return;\n\tif (disclosureIndex < 0) {\n\t\tif (options.resetDetached) this.resourceDisclosureContainer.clear();\n\t\tif (noticesIndex >= 0) this.chatContainer.children.splice(noticesIndex, 0, this.resourceDisclosureContainer);\n\t\telse this.chatContainer.addChild(this.resourceDisclosureContainer);\n\t}\n\tif (noticesIndex < 0) {\n\t\tif (options.resetDetached) this.startupNoticesContainer.clear();\n\t\tthis.chatContainer.addChild(this.startupNoticesContainer);\n\t}\n};\n\nconst renderedSessionIds = new WeakMap<InteractiveModeBase, string>();\n\nexport function clearChatForRerender(mode: InteractiveModeBase): void {\n\tconst renderer = mode.ui as AltScreenMessageCounterHost;\n\tif (mode.chatContainer.children.length > 0) {\n\t\trenderer.newMessages?.observe(renderer.isFollowingOutput !== false, countChatMessages(mode.chatContainer));\n\t}\n\tmode.chatContainer.clear();\n}\n\nInteractiveModeBase.prototype.renderInitialMessages = function (this: InteractiveModeBase): void {\n\tconst sessionId = this.sessionManager.getSessionId();\n\tconst previousSessionId = renderedSessionIds.get(this);\n\trenderedSessionIds.set(this, sessionId);\n\tconst renderer = this.ui as AltScreenMessageCounterHost;\n\tif (previousSessionId !== sessionId) renderer.newMessages?.reset();\n\tthis.attachStartupNoticesContainer({ resetDetached: true });\n\tconst entries = buildContextEntries(this.sessionManager.getEntries(), this.sessionManager.getLeafId());\n\tthis.renderSessionEntries(entries, { updateFooter: true, populateHistory: true });\n\trenderProjectTrustWarningIfNeeded(this);\n\trefreshInteractiveTasks(this);\n\tif (previousSessionId === sessionId) {\n\t\trenderer.newMessages?.replaced(countChatMessages(this.chatContainer));\n\t}\n};\n\nfunction renderProjectTrustWarningIfNeeded(mode: InteractiveModeBase): void {\n\tif (mode.settingsManager.isProjectTrusted() || !hasTrustRequiringProjectResources(mode.sessionManager.getCwd())) {\n\t\treturn;\n\t}\n\tif (mode.chatContainer.children.length > 0) {\n\t\tmode.chatContainer.addChild(new Spacer(1));\n\t}\n\tmode.chatContainer.addChild(\n\t\tnew ThemedText(\n\t\t\t() =>\n\t\t\t\ttheme.fg(\n\t\t\t\t\t\"warning\",\n\t\t\t\t\t`This project is not trusted. Project ${CONFIG_DIR_NAME} resources and packages are ignored. Use /trust to save a trust decision, then restart ${APP_NAME}.`,\n\t\t\t\t),\n\t\t\t1,\n\t\t\t0,\n\t\t),\n\t);\n}\n\nInteractiveModeBase.prototype.getUserInput = async function (\n\tthis: InteractiveModeBase,\n): Promise<InteractiveSubmission> {\n\twhile (true) {\n\t\tconst queuedInput = this.pendingUserInputs.shift();\n\t\tif (queuedInput !== undefined) {\n\t\t\treturn queuedInput;\n\t\t}\n\n\t\tif (this.startupReplayActiveInput) {\n\t\t\tawait this.drainStartupReplayCommands();\n\t\t\tcontinue;\n\t\t}\n\n\t\treturn new Promise((resolve) => {\n\t\t\tthis.onInputCallback = (submission: InteractiveSubmission) => {\n\t\t\t\tthis.onInputCallback = undefined;\n\t\t\t\tresolve(submission);\n\t\t\t};\n\t\t\tif (!this.inputHandlerReadyRecorded) {\n\t\t\t\tthis.inputHandlerReadyRecorded = true;\n\t\t\t\trecordTimeSinceReset(\"interactive-input-handler-ready\");\n\t\t\t\tmarkLifecycleTiming(\"interactive-input-handler-ready\");\n\t\t\t\tvoid (async () => {\n\t\t\t\t\tawait yieldToEventLoop();\n\t\t\t\t\t// pi parity: the changelog/first-run notices need nothing from\n\t\t\t\t\t// extensions — render them right after the input handler is ready\n\t\t\t\t\t// instead of gating them behind the deferred extension reload (or,\n\t\t\t\t\t// when the user types immediately, behind the whole agent turn).\n\t\t\t\t\tthis.showStartupNoticesIfNeeded(this.startupNoticesContainer);\n\t\t\t\t\tthis.footerDataProvider.startGitWatcher();\n\t\t\t\t\tif (this.deferredStartupPending) {\n\t\t\t\t\t\tawait this.ensureDeferredStartupComplete();\n\t\t\t\t\t}\n\t\t\t\t})().catch((error) => {\n\t\t\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\t\t\tconsole.error(`Deferred input-readiness startup task failed: ${message}`);\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n};\n\nInteractiveModeBase.prototype.rebuildChatFromMessages = function (\n\tthis: InteractiveModeBase,\n\toptions: {\n\t\tsuppressCompactionBoundary?: VerbatimCompactionResult;\n\t\tresetStartupDisclosure?: boolean;\n\t} = {},\n): void {\n\t// Generic rebuilds keep the same session: pending fd/rg callbacks still own\n\t// this transcript. Full session replacements invalidate their generation in\n\t// renderCurrentSessionState() before rebuilding the replacement transcript.\n\tconst renderer = this.ui as AltScreenMessageCounterHost;\n\tthis.managedToolStatusStarted = false;\n\tthis.lastStatusSpacer = undefined;\n\tthis.lastStatusText = undefined;\n\tclearChatForRerender(this);\n\tif (options.resetStartupDisclosure) this.resourceDisclosureContainer.clear();\n\tthis.attachStartupNoticesContainer();\n\tconst entries = buildContextEntries(this.sessionManager.getEntries(), this.sessionManager.getLeafId());\n\tthis.renderSessionEntries(entries, { suppressCompactionBoundary: options.suppressCompactionBoundary });\n\trenderer.newMessages?.replaced(countChatMessages(this.chatContainer));\n};\n\nfunction isSynthesizedCompactionBoundary(message: AgentMessage | undefined, result: VerbatimCompactionResult): boolean {\n\tif (message?.role !== \"custom\" || message.customType !== \"compaction\" || !message.display) return false;\n\tconst details = message.details as { strategy?: string } | undefined;\n\tif (details?.strategy !== \"verbatim-lines\") return false;\n\tconst content = Array.isArray(message.content)\n\t\t? message.content\n\t\t\t\t.filter((block) => block.type === \"text\")\n\t\t\t\t.map((block) => block.text)\n\t\t\t\t.join(\"\\n\")\n\t\t: message.content;\n\treturn stripVerbatimCompactionPrefix(content) === result.compactedText;\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Container } from "./interactive-mode-deps.ts";
|
|
1
|
+
import { type Component, Container } from "./interactive-mode-deps.ts";
|
|
2
2
|
/**
|
|
3
3
|
* Holds startup chat output off-screen until the resource disclosure slot has
|
|
4
4
|
* been filled. Terminal scrollback cannot reorder lines that were painted
|
|
@@ -6,6 +6,14 @@ import { Container } from "./interactive-mode-deps.ts";
|
|
|
6
6
|
*/
|
|
7
7
|
export declare class StartupChatContainer extends Container {
|
|
8
8
|
private startupOutputReleased;
|
|
9
|
+
private counted;
|
|
10
|
+
private readonly isCounted;
|
|
11
|
+
constructor(isCounted?: (child: Component) => boolean);
|
|
12
|
+
countedChildren(): number;
|
|
13
|
+
addChild(component: Component): void;
|
|
14
|
+
removeChild(component: Component): void;
|
|
15
|
+
private current;
|
|
16
|
+
private recount;
|
|
9
17
|
releaseStartupOutput(): void;
|
|
10
18
|
render(width: number): string[];
|
|
11
19
|
/** A cleared transcript is rebuilt from new rows; the engine-rendered rows it drops are disposed. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-startup-chat-container.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-startup-chat-container.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"interactive-startup-chat-container.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-startup-chat-container.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvE;;;;GAIG;AACH,qBAAa,oBAAqB,SAAQ,SAAS;IAClD,OAAO,CAAC,qBAAqB,CAAS;IACtC,OAAO,CAAC,OAAO,CAAuE;IACtF,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAgC;IAE1D,YAAY,SAAS,GAAE,CAAC,KAAK,EAAE,SAAS,KAAK,OAAqB,EAGjE;IAED,eAAe,IAAI,MAAM,CAOxB;IAEQ,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI,CAI5C;IAEQ,WAAW,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI,CAK/C;IAED,OAAO,CAAC,OAAO;IAKf,OAAO,CAAC,OAAO;IAIf,oBAAoB,IAAI,IAAI,CAG3B;IAEQ,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAEvC;IAED,qGAAqG;IAC5F,KAAK,IAAI,IAAI,CAIrB;CACD;AAED,UAAU,qBAAqB;IAC9B,aAAa,EAAE,SAAS,CAAC;IACzB,EAAE,EAAE;QAAE,aAAa,IAAI,IAAI,CAAA;KAAE,CAAC;CAC9B;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,qBAAqB,GAAG,IAAI,CAM1E"}
|
|
@@ -8,6 +8,43 @@ import { Container } from "./interactive-mode-deps.js";
|
|
|
8
8
|
*/
|
|
9
9
|
export class StartupChatContainer extends Container {
|
|
10
10
|
startupOutputReleased = false;
|
|
11
|
+
counted;
|
|
12
|
+
isCounted;
|
|
13
|
+
constructor(isCounted = () => false) {
|
|
14
|
+
super();
|
|
15
|
+
this.isCounted = isCounted;
|
|
16
|
+
}
|
|
17
|
+
countedChildren() {
|
|
18
|
+
const counted = this.counted;
|
|
19
|
+
if (counted?.children === this.children && counted.length === this.children.length)
|
|
20
|
+
return counted.count;
|
|
21
|
+
let count = 0;
|
|
22
|
+
for (const child of this.children)
|
|
23
|
+
if (this.isCounted(child))
|
|
24
|
+
count += 1;
|
|
25
|
+
this.counted = { children: this.children, length: this.children.length, count };
|
|
26
|
+
return count;
|
|
27
|
+
}
|
|
28
|
+
addChild(component) {
|
|
29
|
+
const counted = this.current();
|
|
30
|
+
super.addChild(component);
|
|
31
|
+
if (counted)
|
|
32
|
+
this.recount(counted, this.isCounted(component) ? 1 : 0);
|
|
33
|
+
}
|
|
34
|
+
removeChild(component) {
|
|
35
|
+
const counted = this.current();
|
|
36
|
+
const length = this.children.length;
|
|
37
|
+
super.removeChild(component);
|
|
38
|
+
if (counted && this.children.length < length)
|
|
39
|
+
this.recount(counted, this.isCounted(component) ? -1 : 0);
|
|
40
|
+
}
|
|
41
|
+
current() {
|
|
42
|
+
const counted = this.counted;
|
|
43
|
+
return counted?.children === this.children && counted.length === this.children.length ? counted : undefined;
|
|
44
|
+
}
|
|
45
|
+
recount(counted, change) {
|
|
46
|
+
this.counted = { children: this.children, length: this.children.length, count: counted.count + change };
|
|
47
|
+
}
|
|
11
48
|
releaseStartupOutput() {
|
|
12
49
|
this.startupOutputReleased = true;
|
|
13
50
|
this.invalidate();
|
|
@@ -19,6 +56,7 @@ export class StartupChatContainer extends Container {
|
|
|
19
56
|
clear() {
|
|
20
57
|
disposeRemoteRenderers(this.children);
|
|
21
58
|
super.clear();
|
|
59
|
+
this.counted = { children: this.children, length: 0, count: 0 };
|
|
22
60
|
}
|
|
23
61
|
}
|
|
24
62
|
export function releaseStartupChatOutput(host) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-startup-chat-container.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-startup-chat-container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAClF,OAAO,
|
|
1
|
+
{"version":3,"file":"interactive-startup-chat-container.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-startup-chat-container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAClF,OAAO,EAAkB,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvE;;;;GAIG;AACH,MAAM,OAAO,oBAAqB,SAAQ,SAAS;IAC1C,qBAAqB,GAAG,KAAK,CAAC;IAC9B,OAAO,CAAuE;IACrE,SAAS,CAAgC;IAE1D,YAAY,SAAS,GAAkC,GAAG,EAAE,CAAC,KAAK;QACjE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC5B,CAAC;IAED,eAAe;QACd,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC7B,IAAI,OAAO,EAAE,QAAQ,KAAK,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC,MAAM,KAAK,IAAI,CAAC,QAAQ,CAAC,MAAM;YAAE,OAAO,OAAO,CAAC,KAAK,CAAC;QACzG,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,KAAK,MAAM,KAAK,I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AC7G,CAAC;IAEO,OAAO,CAAC,OAA0B,EAAE,MAAc;QACzD,IAAI,CAAC,OAAO,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,GAAG,MAAM,EAAE,CAAC;IACzG,CAAC;IAED,oBAAoB;QACnB,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;QAClC,IAAI,CAAC,UAAU,EAAE,CAAC;IACnB,CAAC;IAEQ,MAAM,CAAC,KAAa;QAC5B,OAAO,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9D,CAAC;IAED,qGAAqG;IAC5F,KAAK;QACb,sBAAsB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACtC,KAAK,CAAC,KAAK,EAAE,CAAC;QACd,IAAI,CAAC,OAAO,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IACjE,CAAC;CACD;AAOD,MAAM,UAAU,wBAAwB,CAAC,IAA2B;IACnE,IAAI,IAAI,CAAC,aAAa,YAAY,oBAAoB,EAAE,CAAC;QACxD,IAAI,CAAC,aAAa,CAAC,oBAAoB,EAAE,CAAC;QAC1C,mBAAmB,CAAC,qBAAqB,CAAC,CAAC;QAC3C,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC;IACzB,CAAC;AACF,CAAC","sourcesContent":["import { markLifecycleTiming } from \"../../core/lifecycle-timings.ts\";\nimport { disposeRemoteRenderers } from \"../interactive-engine/remote-renderer.ts\";\nimport { type Component, Container } from \"./interactive-mode-deps.ts\";\n\n/**\n * Holds startup chat output off-screen until the resource disclosure slot has\n * been filled. Terminal scrollback cannot reorder lines that were painted\n * before an earlier container received content.\n */\nexport class StartupChatContainer extends Container {\n\tprivate startupOutputReleased = false;\n\tprivate counted: { children: Component[]; length: number; count: number } | undefined;\n\tprivate readonly isCounted: (child: Component) => boolean;\n\n\tconstructor(isCounted: (child: Component) => boolean = () => false) {\n\t\tsuper();\n\t\tthis.isCounted = isCounted;\n\t}\n\n\tcountedChildren(): number {\n\t\tconst counted = this.counted;\n\t\tif (counted?.children === this.children && counted.length === this.children.length) return counted.count;\n\t\tlet count = 0;\n\t\tfor (const child of this.children) if (this.isCounted(child)) count += 1;\n\t\tthis.counted = { children: this.children, length: this.children.length, count };\n\t\treturn count;\n\t}\n\n\toverride addChild(component: Component): void {\n\t\tconst counted = this.current();\n\t\tsuper.addChild(component);\n\t\tif (counted) this.recount(counted, this.isCounted(component) ? 1 : 0);\n\t}\n\n\toverride removeChild(component: Component): void {\n\t\tconst counted = this.current();\n\t\tconst length = this.children.length;\n\t\tsuper.removeChild(component);\n\t\tif (counted && this.children.length < length) this.recount(counted, this.isCounted(component) ? -1 : 0);\n\t}\n\n\tprivate current(): { children: Component[]; length: number; count: number } | undefined {\n\t\tconst counted = this.counted;\n\t\treturn counted?.children === this.children && counted.length === this.children.length ? counted : undefined;\n\t}\n\n\tprivate recount(counted: { count: number }, change: number): void {\n\t\tthis.counted = { children: this.children, length: this.children.length, count: counted.count + change };\n\t}\n\n\treleaseStartupOutput(): void {\n\t\tthis.startupOutputReleased = true;\n\t\tthis.invalidate();\n\t}\n\n\toverride render(width: number): string[] {\n\t\treturn this.startupOutputReleased ? super.render(width) : [];\n\t}\n\n\t/** A cleared transcript is rebuilt from new rows; the engine-rendered rows it drops are disposed. */\n\toverride clear(): void {\n\t\tdisposeRemoteRenderers(this.children);\n\t\tsuper.clear();\n\t\tthis.counted = { children: this.children, length: 0, count: 0 };\n\t}\n}\n\ninterface StartupChatOutputHost {\n\tchatContainer: Container;\n\tui: { requestRender(): void };\n}\n\nexport function releaseStartupChatOutput(host: StartupChatOutputHost): void {\n\tif (host.chatContainer instanceof StartupChatContainer) {\n\t\thost.chatContainer.releaseStartupOutput();\n\t\tmarkLifecycleTiming(\"chat-output-release\");\n\t\thost.ui.requestRender();\n\t}\n}\n"]}
|
package/docs/keybindings.md
CHANGED
|
@@ -231,7 +231,7 @@ The same keys move between the main chat, subagent chats, workflow graphs, stage
|
|
|
231
231
|
|
|
232
232
|
- **Esc** only interrupts the current turn, cancels, closes a dialog or deselects. It never moves you to another chat.
|
|
233
233
|
- **←** on an empty prompt goes back exactly one level, to the chat or list you came from, and the hint line names it (`← tasks`, `← main chat`). With text typed, ← moves the cursor; at the very start of the prompt it leaves too, and what you typed is kept for when you come back.
|
|
234
|
-
-
|
|
234
|
+
- In a workflow graph, **Esc** is the only back key. **←** moves to the previous sibling and does nothing at the leftmost node. In tool and failure details, **←** does nothing and **Esc** returns to the graph. In a stage chat, Esc on a choice or yes/no question closes it back to the chat's prompt: the question stays pending, a line above the prompt shows it, and Enter on the empty prompt reopens it.
|
|
235
235
|
- In a list, **↑↓** select, **Enter** or **→** opens the item's chat (a workflow run's graph), **Space** peeks at its detail, **x** stops the selected item (press it again within 3 seconds to confirm; on a finished item one press dismisses the row), **Esc** or **←** closes the list. If an item finishes between the two presses of `x`, the stop is called off and the list says `<name> finished · x to dismiss`; the press that was meant as the second one is ignored, and only a later `x` dismisses the row.
|
|
236
236
|
- **Ctrl+X Ctrl+K** stops every running background subagent, shell and workflow run of the session, from any view except a dialog that uses Ctrl+X itself (OAuth sign-in, the scoped-model selector). Press it twice within 3 seconds; the first press says what it will do, and any other key calls it off. Stopped subagents stay resumable: their chats read `Stopped · send to resume`, and only a message you send resumes them. Stopped workflow runs stay resumable.
|
|
237
237
|
- **?** on an empty prompt, or in a list, shows the keys of the current screen; typed after text, `?` is just a character. Esc or ? closes it. Each screen also shows one dim hint line with exactly the keys that work there.
|
package/docs/storage.md
CHANGED
|
@@ -188,7 +188,7 @@ Atomic sets nothing on a server connection outside a transaction: the schema (`S
|
|
|
188
188
|
|
|
189
189
|
On PostgreSQL, worker hosts and Intercom brokers learn about new work at once through `LISTEN`/`NOTIFY`. A host's idle workers claim a queued child right away, the root sees a finished child right away, and an Intercom message reaches a broker on another machine without waiting for its next check. Each Atomic process holds one extra connection for this, outside `maxConnections`.
|
|
190
190
|
|
|
191
|
-
Wake-ups
|
|
191
|
+
Wake-ups make Atomic faster and lighter on the database. An idle worker does not poll for work: it waits for a wake-up and checks the database on its own only every 2 seconds. While wake-ups do not arrive, each host instead checks for ready work about every 250 ms while any of its workers is idle, so no work is lost and a queued child is still claimed promptly. That happens when the connection drops or the URL goes through a transaction pooler, and always on SQLite and libSQL / sqld, which have no wake-ups. Atomic checks the connection every 30 seconds and opens it again when it drops or stops delivering. When it finds a transaction pooler, it stops trying until the process restarts, so it leaves nothing behind on the pooler's server connections.
|
|
192
192
|
|
|
193
193
|
`atomic storage status` shows whether wake-ups arrive:
|
|
194
194
|
|
|
@@ -2405,7 +2405,7 @@ For direct durable-backend use, open `JournalDurableBackend` with `await Journal
|
|
|
2405
2405
|
function forkRun(runId: string, options?: ForkRunOptions): Promise<ForkedRun>;
|
|
2406
2406
|
|
|
2407
2407
|
interface ForkRunOptions extends Omit<RunOpts, "runId" | "continuation" | "parentRun" | "cwd"> {
|
|
2408
|
-
fromStage?: string; // dot path
|
|
2408
|
+
fromStage?: string; // dot path of a completed stage (listForkPoints()) or of a failed, blocked or stopped stage; omitted: copy the whole run
|
|
2409
2409
|
inputs?: WorkflowInputValues; // replacement inputs; omitted: the source run's inputs
|
|
2410
2410
|
cwd?: string; // directory the fork runs in; omitted: the source run's directory
|
|
2411
2411
|
carryMessages?: "before" | "all"; // default "before"
|
|
@@ -2431,6 +2431,7 @@ Worker overrides must remain compatible with the source run's saved resources. Y
|
|
|
2431
2431
|
|
|
2432
2432
|
- **What replays.** Every completed `ctx.tool` call, `ctx.ui` answer and stage that finished before `fromStage` replays from its saved result. The stage at `fromStage` and everything after it run again, and prompts asked at or after it fire again. Stages that had started but not finished before `fromStage` run again from scratch.
|
|
2433
2433
|
- **Without `fromStage`.** The fork copies every checkpoint, so recorded stages replay their saved results and `ctx.tool` calls replay when their arguments are unchanged. Replacement `inputs` then reach only tool calls whose arguments use them and work the source had not finished. To run stages again with new inputs, pass `fromStage`.
|
|
2434
|
+
- **From a failed, blocked or stopped stage.** `fromStage` may also name a stage that started but never finished and ended failed, blocked or stopped. The fork cuts at that stage's first record: the stages completed before it replay, and the stage and everything after it run again from scratch, including any `ctx.tool` calls that completed at or after its start, which run again. `listForkPoints` lists only completed stages; a failed stage's path is its name with the same occurrence suffix rules, numbered after the completed stages of that name. A stage still running is not a fork target. In the workflow graph, `f` on a failed stage forks from it this way after a one-line confirmation.
|
|
2434
2435
|
- **Nested workflows.** `fromStage` is a dot path: the `ctx.workflow` stage names from the root, then the stage name, for example `implement-api.review-2`. A nested workflow's own stage name forks before the whole child. A stage name repeated in one run gets an occurrence suffix (`review#2`). Use the exact paths `listForkPoints` returns.
|
|
2435
2436
|
- **Messages.** `carryMessages: "before"` carries Intercom messages and prompt answers recorded before the fork point; `"all"` also carries those recorded after it, so later prompts replay their answers instead of asking again.
|
|
2436
2437
|
- **Lineage.** The fork records `forkedFrom: { runId, stagePath }`, visible in `workflow status` and `RunSnapshot.forkedFrom`. A source run's workspace and snapshot bindings are carried to the fork.
|
|
@@ -2480,7 +2481,7 @@ Every fork failure is a `ForkError` with a stable `code`, readonly JSON-safe fie
|
|
|
2480
2481
|
|
|
2481
2482
|
| Class | `code` | When | Fields | What to do |
|
|
2482
2483
|
| --- | --- | --- | --- | --- |
|
|
2483
|
-
| `ForkTargetNotFoundError` | `target-not-found` | `fromStage` names no completed stage of the run, including a stage the run has not reached yet. | `runId`, `fromStage`, `validStagePaths` (at most 10,
|
|
2484
|
+
| `ForkTargetNotFoundError` | `target-not-found` | `fromStage` names no completed, failed, blocked or stopped stage of the run, including a stage the run has not reached yet or one still running. | `runId`, `fromStage`, `validStagePaths` (at most 10; completed stages first, then eligible unfinished stages), `totalValidStagePaths` | Pass one of `validStagePaths`; `listForkPoints` lists completed stages only. |
|
|
2484
2485
|
| `ForkDefinitionMismatchError` | `definition-mismatch` | The definition cannot replay the run. `reason`: `definition-unavailable` (not found), `name-changed` (a different workflow), `inputs-incompatible` (the recorded inputs fail the current definition), `project-not-trusted` (the workflow is defined in another project folder that is not trusted, so it was not loaded). | `runId`, `workflow`, `reason`, `definition?`, `projectDir?` | Pass the run's definition with `definition` or `registry`, or pass replacement `inputs`. For `project-not-trusted`, start Atomic in `projectDir` and use `/trust`. |
|
|
2485
2486
|
| `ForkSourceBusyError` | `source-busy` | Another fork or resume holds the run, it is executing, or the fork lost its source claim. `reason`: `fork-in-progress`, `resume-in-progress`, `live-execution`, `foreign-lease`, or `lease-lost` (the source no longer matches this fork's lease; `cause` is the stale lease). Retryable. | `runId`, `reason`, `holderId?`, `cause?` | Check the source's status and retry when it is paused or idle; wait for another fork or resume to finish, or pause or quit an active run. |
|
|
2486
2487
|
| `ForkEntryNotFoundError` | `entry-not-found` | A stage's `forkFromEntryId` is not in the session named by `forkFromSessionId`. | `sessionId`, `entryId`, `stageName?` | Pass an entry id from that session, such as a fork point's `entryId`. |
|
|
@@ -180,7 +180,7 @@ Graph node cards show each model stage's effective model and thinking level abov
|
|
|
180
180
|
/workflow inputs <name>
|
|
181
181
|
/workflow <name> --help
|
|
182
182
|
/workflow <name> [key=value ...]
|
|
183
|
-
/workflows [run-id]
|
|
183
|
+
/workflows [run-id] [stage-id-or-name] # the session's runs: only run's graph, stage chat, or list
|
|
184
184
|
/workflow pause [run-id|--all] [stage-id-or-name]
|
|
185
185
|
/workflow status [run-id]
|
|
186
186
|
/workflow status --all
|
|
@@ -194,7 +194,7 @@ Common controls:
|
|
|
194
194
|
|
|
195
195
|
```text
|
|
196
196
|
/workflow status # list retained active and terminal runs
|
|
197
|
-
/workflows
|
|
197
|
+
/workflows [run-id] [stage] # open a run's graph or stage chat, or choose from session runs
|
|
198
198
|
/workflow pause <run-id> # pause resumably
|
|
199
199
|
/workflow pause <run-id> <stage> # pause one stage; the others keep running
|
|
200
200
|
/workflow resume <run-id> [stage] msg # forward a steer message and resume
|
|
@@ -205,13 +205,13 @@ Common controls:
|
|
|
205
205
|
|
|
206
206
|
Surface behavior:
|
|
207
207
|
|
|
208
|
-
- **Graph vs. stage chat** - `/workflows` opens the graph (or ↓ to the run in the agent panel).
|
|
208
|
+
- **Graph vs. stage chat** - `/workflows` opens the graph (or ↓ to the run in the agent panel), and `/workflows <run-id> <stage>` opens a stage's chat directly. In the graph, press Enter on a stage to open its chat. On a failed stage, Enter opens its failure detail; press `t` there for its chat. `/workflow connect` and `/workflow attach` were removed; typing either shows a one-line pointer to `/workflows`.
|
|
209
209
|
- **Run state** - The graph header puts the run's state before its stage counts and colors the ORCHESTRATOR pill to match: `↑ blocked`, followed by the exit reason when the workflow gave one and shortened to fit; `❚❚ paused`; or `○ quit`. A running run shows no state, including one you resumed. `↑ N` counts blocked stages. The stage switcher (`/`), `/workflow status`, and the `/workflows` picker show the same state.
|
|
210
|
-
- **Going back** - In an attached stage chat, `←` on an empty prompt returns to the graph. A choice or yes/no question
|
|
211
|
-
- **Graph keys** - The hint line under the graph lists exactly the keys that work on the focused node, and `?` lists them all. `↑↓←→` move, `enter` opens the focused node (a stage's chat, a tool's detail, or a failed stage's failure detail), `/` finds a stage, and `f` cycles a status filter (all, running, completed, failed) that dims the nodes it doesn't match without moving anything. On a running
|
|
212
|
-
- **Failed stages** - `enter` on a failed stage opens its failure detail
|
|
210
|
+
- **Going back** - In an attached stage chat, `←` on an empty prompt (or at the start of a typed prompt, preserving the draft) returns to the graph. A choice or yes/no question uses `←` to move between answers; `esc` closes that question back to the stage's prompt and leaves it waiting (Enter on the empty prompt reopens it). The graph has no prompt: `esc` goes back one level (it closes a stage's failure detail, a tool detail or the `?` overlay first), and at the top it returns to where you opened the graph from, such as main chat or the `/workflows` list. `←` only moves to a previous sibling. It does nothing at the leftmost node or inside a detail; only Esc goes back. A custom question widget owns every key; `ctrl+c` closes the workflow view from it. `ctrl+x` does not navigate. See [Keybindings](/keybindings#navigation).
|
|
211
|
+
- **Graph keys** - The hint line under the graph lists exactly the keys that work on the focused node, and `?` lists them all. `↑↓←→` move, `enter` opens the focused node (a stage's chat, a tool's detail, or a failed stage's failure detail), `/` finds a stage, and `f` cycles a status filter (all, running, stopped, completed, failed) that dims the nodes it doesn't match without moving anything. On a running stage, `x` then `x` again within 3 seconds stops it so it can be resumed from its stage chat. A stopped stage or run shows `◼` in a muted colour; a failed one shows a red `✗`. The `/workflow status` header counts killed and cancelled runs under `◼`, and failed runs under `✗`.
|
|
212
|
+
- **Failed stages** - `enter` on a failed stage opens its failure detail with the stage, elapsed time and a short reason. `r` retries in place, keeping completed work. `f` asks for confirmation, then forks from that stage into a new run. The confirmation names completed tool steps that will run again and warns if the source must first stop resumably. Enter confirms; Esc cancels. `t` opens the transcript; `l` toggles the error log, including error codes, hints and causes. Long reasons and logs are truncated. Retry keeps focus on the same stage and reports another failure. Fork opens the new run.
|
|
213
213
|
- **Stage input label** - Attached stage chats show `[stage: name]` on the composer top rule, a mounted question's top rule, and awaiting-input prompt borders so you can tell which stage owns the input. Long names truncate with `…`. A subagent's transcript opened from `/tasks` labels its prompt `[subagent: name]` the same way.
|
|
214
|
-
- **Draft preservation** - Leaving a stage preserves unsent composer and prompt drafts and keeps pending custom questions unresolved so they reappear when you attach again.
|
|
214
|
+
- **Draft preservation** - Leaving a stage or opening another run preserves unsent composer and prompt drafts and keeps pending custom questions unresolved so they reappear when you attach again.
|
|
215
215
|
- **Queued-message survival** - Detaching preserves queued steering and follow-up text. Reattach to see the pending messages; the graph shows their count as `✉ N queued`. Queues also survive model fallback and eligible post-mortem reopening. Custom session adapters must publish `queue_update` snapshots and expose pre-attachment queues as described in [authoring](/workflows/authoring#stage-follow-on-user-messages).
|
|
216
216
|
- **Reserved keys** - `ctrl+d` and `q` do not navigate workflow surfaces; `ctrl+d` keeps its ordinary editor or prompt behavior where applicable, and `q` remains printable in text-owning prompts. In a stage chat with a prompt, `esc` only interrupts a running stage; in the graph it closes the stage switcher, a detail or the `?` overlay, then goes back to where the graph was opened from. `ctrl+c` and graph `h` close and hide as before.
|
|
217
217
|
- **Wheel and trackpad** - While the workflow graph is active, vertical wheel/trackpad gestures pan it up and down, and horizontal gestures pan wide graphs left and right when the terminal exposes horizontal wheel events. Focused graph and stage-chat overlays receive those gestures through the fullscreen application route, so scrolling stays inside the active workflow surface instead of falling through to terminal or main-chat scrollback.
|
|
@@ -226,7 +226,7 @@ Surface behavior:
|
|
|
226
226
|
- **Status listing** - `/workflow status` lists all retained active and terminal top-level runs by default; implementation-owned nested child runs are flattened into their parent workflow rather than listed separately. `/workflow status --all` is retained as a compatibility alias.
|
|
227
227
|
- **Status times** - `/workflow status <run-id>` displays `started` and `ended` in the system local timezone as `HH:mm:ss`. If they differ from your expected clock, check the timezone of the machine or container running Atomic and any inherited `TZ` environment setting. Elapsed durations and raw timestamps in structured results are unchanged.
|
|
228
228
|
|
|
229
|
-
`/workflows` browses runs already in this session: it opens the only run's graph directly, lists several runs, or
|
|
229
|
+
`/workflows` browses runs already in this session: it opens the only run's graph directly, lists several runs (restoring the selected row when you return from a graph), or shows "No workflows in this session." in a sheet that Esc closes when there are none. `/workflows <id>` opens that session run's graph without resuming execution, and `/workflows <id> <stage>` opens that stage's chat directly. Use `/workflow resume` for the cross-session durable picker; its resumable section lists only runs the resume path can accept, and its completed section opens read-only inspection. A run with no durable checkpoint, missing/pruned artifacts, or explicit deletion is omitted from the resume picker; an explicit `/workflow resume <id>` still returns an explanatory error. It is intentionally different from `/workflow list`, which lists installed workflow definitions. See [`/workflow resume` — cross-session resume selector](#/workflow-resume-—-cross-session-resume-selector) for the full picker semantics.
|
|
230
230
|
|
|
231
231
|
At the supported 40-column terminal minimum, attached stage chats keep the `← return to graph` hint. The TUI may truncate provider/model context to make room, but it keeps that context separate from the hierarchy hint so the controls stay readable.
|
|
232
232
|
|
|
@@ -562,7 +562,7 @@ Focus a tool node and press Enter, click it, or select it from the switcher to o
|
|
|
562
562
|
|
|
563
563
|
The card starts collapsed, showing the last visual rows. Press `app.tools.expand`, normally Ctrl+O, to see the full bounded result and available callback source. Inspection never executes the callback or reads a source file.
|
|
564
564
|
|
|
565
|
-
The statusline shows the resolved key with `expand` or `collapse`, including remapped keys, alongside return and scroll hints. It omits that hint when expansion is unbound. Scroll with `↑`/`↓`, `PageUp`/`PageDown`, `Home`/`End`, the wheel, or the scrollbar. Escape
|
|
565
|
+
The statusline shows the resolved key with `expand` or `collapse`, including remapped keys, alongside return and scroll hints. It omits that hint when expansion is unbound. Scroll with `↑`/`↓`, `PageUp`/`PageDown`, `Home`/`End`, the wheel, or the scrollbar. Escape returns to the graph; `←` does nothing in this detail. This view offers no chat attachment, steering, pause, or resume.
|
|
566
566
|
|
|
567
567
|
The footer shows `Took` or `Elapsed`; cached results are labelled. Truncation is marked with `… [truncated]`. Unrenderable values show placeholders rather than a complete result. Durable checkpoints retain the actual output.
|
|
568
568
|
|
|
@@ -670,6 +670,8 @@ Fresh completed inspection does not currently persist the workflow's declared ro
|
|
|
670
670
|
```text
|
|
671
671
|
/workflow resume # Mixed picker: resumable + completed
|
|
672
672
|
/workflow resume <full-workflow-uuid> # Resume unfinished work or open completed detail/chat
|
|
673
|
+
/workflows # Open this session's run list or only run's graph
|
|
674
|
+
/workflows <full-workflow-uuid> [stage] # Open a session run's graph or stage chat without resuming it
|
|
673
675
|
```
|
|
674
676
|
|
|
675
677
|
Targets resolve across top-level live, resumable durable, and completed entries as one namespace using full UUIDs or unique 8-hex prefixes. Exact loadable paused live targets retain direct in-session precedence. Prefixes require successful catalog discovery and reject collisions. A root appearing in both resumable and read-only history remains resumable. Nested child runs remain excluded from this top-level resume namespace.
|