@bastani/atomic 0.9.5-alpha.7 → 0.9.5-alpha.8
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 +17 -2
- package/dist/builtin/cursor/package.json +2 -2
- package/dist/builtin/intercom/CHANGELOG.md +17 -0
- package/dist/builtin/intercom/README.md +27 -21
- package/dist/builtin/intercom/broker/broker.ts +3 -6
- package/dist/builtin/intercom/broker/paths.ts +42 -5
- package/dist/builtin/intercom/broker/spawn.ts +78 -10
- package/dist/builtin/intercom/config.ts +6 -3
- package/dist/builtin/intercom/contact-supervisor-tool.ts +6 -4
- package/dist/builtin/intercom/index-heavy.ts +1 -1
- package/dist/builtin/intercom/index.ts +162 -130
- package/dist/builtin/intercom/intercom-tool.ts +9 -3
- package/dist/builtin/intercom/package.json +10 -1
- package/dist/builtin/intercom/result-renderers.ts +1 -1
- package/dist/builtin/intercom/ui/compose.ts +2 -2
- package/dist/builtin/intercom/ui/inline-message.ts +2 -2
- package/dist/builtin/intercom/ui/session-list.ts +2 -2
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +6 -0
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/src/tui/render-event-formatting.ts +15 -48
- package/dist/builtin/subagents/src/tui/render-layout.ts +9 -0
- package/dist/builtin/subagents/src/tui/render-widget-graph.ts +27 -25
- package/dist/builtin/subagents/src/tui/render-widget.ts +46 -69
- package/dist/builtin/subagents/src/tui/render.ts +1 -1
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +11 -0
- package/dist/builtin/workflows/README.md +3 -1
- package/dist/builtin/workflows/builtin/goal-artifacts.ts +3 -1
- package/dist/builtin/workflows/builtin/goal-prompts.ts +23 -2
- package/dist/builtin/workflows/builtin/goal-reducer.ts +21 -0
- package/dist/builtin/workflows/builtin/goal-review.ts +60 -6
- package/dist/builtin/workflows/builtin/goal-runner.ts +32 -21
- package/dist/builtin/workflows/builtin/goal-types.ts +7 -1
- package/dist/builtin/workflows/builtin/ralph-core.ts +52 -4
- package/dist/builtin/workflows/builtin/ralph-review-gate.ts +10 -3
- package/dist/builtin/workflows/builtin/ralph-reviewer-prompt.ts +23 -2
- package/dist/builtin/workflows/builtin/ralph-runner.ts +38 -16
- package/dist/builtin/workflows/builtin/review-convergence.ts +111 -0
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/skills/create-spec/SKILL.md +2 -0
- package/dist/builtin/workflows/src/durable/child-primitive.ts +12 -8
- package/dist/builtin/workflows/src/durable/dbos-backend.ts +47 -2
- package/dist/builtin/workflows/src/durable/dbos-envelope.ts +28 -0
- package/dist/builtin/workflows/src/durable/stage-primitive.ts +165 -27
- package/dist/builtin/workflows/src/durable/types.ts +14 -1
- package/dist/builtin/workflows/src/engine/run.ts +12 -13
- package/dist/builtin/workflows/src/extension/workflow-prompts.ts +2 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-continuation.ts +13 -3
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-factory.ts +1 -1
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-controller.ts +18 -19
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-unresolved-overflow.ts +38 -0
- package/dist/builtin/workflows/src/shared/persistence-restore-helpers.ts +18 -1
- package/dist/builtin/workflows/src/shared/persistence-restore.ts +23 -5
- package/dist/builtin/workflows/src/shared/persistence-session-entries.ts +4 -0
- package/dist/bun/internal-intercom-broker.d.ts +6 -0
- package/dist/bun/internal-intercom-broker.d.ts.map +1 -0
- package/dist/bun/internal-intercom-broker.js +39 -0
- package/dist/bun/internal-intercom-broker.js.map +1 -0
- package/dist/bun/split-loader.d.ts.map +1 -1
- package/dist/bun/split-loader.js +21 -8
- package/dist/bun/split-loader.js.map +1 -1
- package/dist/core/agent-session-auto-compaction.d.ts +4 -5
- package/dist/core/agent-session-auto-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-auto-compaction.js +49 -9
- package/dist/core/agent-session-auto-compaction.js.map +1 -1
- package/dist/core/agent-session-events.d.ts.map +1 -1
- package/dist/core/agent-session-events.js +3 -1
- package/dist/core/agent-session-events.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +9 -3
- package/dist/core/agent-session-methods.d.ts.map +1 -1
- package/dist/core/agent-session-methods.js.map +1 -1
- package/dist/core/agent-session-models.d.ts +2 -2
- package/dist/core/agent-session-models.d.ts.map +1 -1
- package/dist/core/agent-session-models.js.map +1 -1
- package/dist/core/agent-session-prompt.d.ts.map +1 -1
- package/dist/core/agent-session-prompt.js +1 -0
- package/dist/core/agent-session-prompt.js.map +1 -1
- package/dist/core/agent-session-retry.d.ts +2 -0
- package/dist/core/agent-session-retry.d.ts.map +1 -1
- package/dist/core/agent-session-retry.js +152 -4
- package/dist/core/agent-session-retry.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +1 -0
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +1 -0
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session-types.d.ts +15 -1
- package/dist/core/agent-session-types.d.ts.map +1 -1
- package/dist/core/agent-session-types.js.map +1 -1
- package/dist/core/agent-session.d.ts +4 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +4 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/compaction/context-compaction-runner.d.ts.map +1 -1
- package/dist/core/compaction/context-compaction-runner.js +36 -20
- package/dist/core/compaction/context-compaction-runner.js.map +1 -1
- package/dist/core/copilot-anthropic-sse-repair.d.ts +23 -0
- package/dist/core/copilot-anthropic-sse-repair.d.ts.map +1 -0
- package/dist/core/copilot-anthropic-sse-repair.js +340 -0
- package/dist/core/copilot-anthropic-sse-repair.js.map +1 -0
- package/dist/core/copilot-gemini-reasoning.d.ts +16 -8
- package/dist/core/copilot-gemini-reasoning.d.ts.map +1 -1
- package/dist/core/copilot-gemini-reasoning.js +27 -22
- package/dist/core/copilot-gemini-reasoning.js.map +1 -1
- package/dist/core/copilot-hosts.d.ts +12 -0
- package/dist/core/copilot-hosts.d.ts.map +1 -0
- package/dist/core/copilot-hosts.js +33 -0
- package/dist/core/copilot-hosts.js.map +1 -0
- package/dist/core/extensions/agent-events.d.ts +1 -1
- package/dist/core/extensions/agent-events.d.ts.map +1 -1
- package/dist/core/extensions/agent-events.js.map +1 -1
- package/dist/core/http-dispatcher.d.ts.map +1 -1
- package/dist/core/http-dispatcher.js +5 -5
- package/dist/core/http-dispatcher.js.map +1 -1
- package/dist/core/sdk-types.d.ts +2 -0
- package/dist/core/sdk-types.d.ts.map +1 -1
- package/dist/core/sdk-types.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +1 -0
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/settings-manager-basic-accessors.d.ts +1 -0
- package/dist/core/settings-manager-basic-accessors.d.ts.map +1 -1
- package/dist/core/settings-manager-basic-accessors.js +6 -0
- package/dist/core/settings-manager-basic-accessors.js.map +1 -1
- package/dist/core/settings-types.d.ts +1 -0
- package/dist/core/settings-types.d.ts.map +1 -1
- package/dist/core/settings-types.js.map +1 -1
- package/dist/index-extensions.d.ts +1 -1
- package/dist/index-extensions.d.ts.map +1 -1
- package/dist/index-extensions.js.map +1 -1
- package/dist/main-deferred-startup.d.ts +12 -0
- package/dist/main-deferred-startup.d.ts.map +1 -1
- package/dist/main-deferred-startup.js +21 -0
- package/dist/main-deferred-startup.js.map +1 -1
- package/dist/main-early-input.d.ts +41 -0
- package/dist/main-early-input.d.ts.map +1 -0
- package/dist/main-early-input.js +147 -0
- package/dist/main-early-input.js.map +1 -0
- package/dist/main.d.ts +0 -6
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +19 -13
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-events.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-events.js +15 -0
- package/dist/modes/interactive/components/chat-session-host-events.js.map +1 -1
- package/dist/modes/interactive/interactive-agent-events.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-agent-events.js +24 -0
- package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.js +279 -181
- package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.d.ts +9 -0
- package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.js +36 -0
- package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.d.ts +4 -0
- package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-types.d.ts +3 -0
- package/dist/modes/interactive/interactive-mode-types.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-types.js.map +1 -1
- package/dist/modes/interactive/interactive-render-chat.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-render-chat.js +21 -9
- package/dist/modes/interactive/interactive-render-chat.js.map +1 -1
- package/dist/modes/interactive/interactive-startup.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-startup.js +6 -1
- package/dist/modes/interactive/interactive-startup.js.map +1 -1
- package/docs/compaction.md +4 -0
- package/docs/json.md +3 -1
- package/docs/providers.md +1 -0
- package/docs/rpc.md +3 -1
- package/docs/settings.md +26 -0
- package/docs/terminal-setup.md +4 -0
- package/docs/usage.md +2 -2
- package/docs/workflows.md +13 -3
- package/npm-shrinkwrap.json +513 -23
- package/package.json +3 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { InteractiveModeBase } from "./interactive-mode-base.js";
|
|
2
2
|
import { Spacer, Text, parseSkillBlock, AssistantMessageComponent, BashExecutionComponent, BranchSummaryMessageComponent, chatEntriesFromAgentMessages, renderChatMessageEntry, addChatTranscriptEntry, ContextCompactionSummaryMessageComponent, CustomMessageComponent, SkillInvocationMessageComponent, ToolExecutionComponent, UserMessageComponent, theme } from "./interactive-mode-deps.js";
|
|
3
|
+
import { yieldToEventLoop } from "../../utils/event-loop.js";
|
|
3
4
|
InteractiveModeBase.prototype.showStatus = function (message) {
|
|
4
5
|
const children = this.chatContainer.children;
|
|
5
6
|
const last = children.length > 0 ? children[children.length - 1] : undefined;
|
|
@@ -208,16 +209,27 @@ InteractiveModeBase.prototype.renderInitialMessages = function () {
|
|
|
208
209
|
}
|
|
209
210
|
};
|
|
210
211
|
InteractiveModeBase.prototype.getUserInput = async function () {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
212
|
+
for (let attempt = 0; !this.startupCookedInputRecovered && attempt < 10; attempt += 1) {
|
|
213
|
+
await yieldToEventLoop();
|
|
214
|
+
if (this.recoverCookedStartupInput?.())
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
217
|
+
while (true) {
|
|
218
|
+
const queuedInput = this.pendingUserInputs.shift();
|
|
219
|
+
if (queuedInput !== undefined) {
|
|
220
|
+
return queuedInput;
|
|
221
|
+
}
|
|
222
|
+
if (this.startupReplayActiveInput) {
|
|
223
|
+
await this.drainStartupReplayCommands();
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
return new Promise((resolve) => {
|
|
227
|
+
this.onInputCallback = (text) => {
|
|
228
|
+
this.onInputCallback = undefined;
|
|
229
|
+
resolve(text);
|
|
230
|
+
};
|
|
231
|
+
});
|
|
214
232
|
}
|
|
215
|
-
return new Promise((resolve) => {
|
|
216
|
-
this.onInputCallback = (text) => {
|
|
217
|
-
this.onInputCallback = undefined;
|
|
218
|
-
resolve(text);
|
|
219
|
-
};
|
|
220
|
-
});
|
|
221
233
|
};
|
|
222
234
|
InteractiveModeBase.prototype.rebuildChatFromMessages = function () {
|
|
223
235
|
this.chatContainer.clear();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"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uB,GAAG;IACpD,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;IAC3B,IAAI,CAAC,6BAA6B,EAAE,CAAC;IACrC,MAAM,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC,mBAAmB,EAAE,CAAC;IAC1D,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;AACrC,CAAC,CAAC","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type AgentMessage, type Component, type ContextCompactionResult, type SessionContext, type TruncationResult, type ChatMessageEntry, type ChatMessageRenderOptions, Spacer, Text, parseSkillBlock, AssistantMessageComponent, BashExecutionComponent, BranchSummaryMessageComponent, chatEntriesFromAgentMessages, renderChatMessageEntry, addChatTranscriptEntry, ContextCompactionSummaryMessageComponent, CustomMessageComponent, SkillInvocationMessageComponent, ToolExecutionComponent, UserMessageComponent, theme } from \"./interactive-mode-deps.ts\";\n\nInteractiveModeBase.prototype.showStatus = function(this: InteractiveModeBase, message: string): void {\n const children = this.chatContainer.children;\n const last =\n children.length > 0 ? children[children.length - 1] : undefined;\n const secondLast =\n children.length > 1 ? children[children.length - 2] : undefined;\n\n if (\n last &&\n secondLast &&\n last === this.lastStatusText &&\n secondLast === this.lastStatusSpacer\n ) {\n this.lastStatusText.setText(theme.fg(\"dim\", message));\n this.ui.requestRender();\n return;\n }\n\n const spacer = new Spacer(1);\n const text = new Text(theme.fg(\"dim\", message), 1, 0);\n this.chatContainer.addChild(spacer);\n this.chatContainer.addChild(text);\n this.lastStatusSpacer = spacer;\n this.lastStatusText = text;\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.renderDeferredUserInput = function(this: InteractiveModeBase, text: string): void {\n this.deferredRenderedUserInputs.push(text);\n const startIndex = this.chatContainer.children.length;\n this.addMessageToChat({ role: \"user\", content: text } as AgentMessage);\n const renderedComponents = this.chatContainer.children.slice(startIndex);\n const trackedComponents = this.deferredRenderedUserInputComponents.get(text) ?? [];\n trackedComponents.push(renderedComponents);\n this.deferredRenderedUserInputComponents.set(text, trackedComponents);\n this.updatePendingMessagesDisplay();\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.consumeDeferredRenderedUserInput = function(this: InteractiveModeBase, text: string): boolean {\n const index = this.deferredRenderedUserInputs.indexOf(text);\n if (index === -1) return false;\n this.deferredRenderedUserInputs.splice(index, 1);\n const trackedComponents = this.deferredRenderedUserInputComponents.get(text);\n trackedComponents?.shift();\n if (trackedComponents && trackedComponents.length === 0) {\n this.deferredRenderedUserInputComponents.delete(text);\n }\n return true;\n };\n\nInteractiveModeBase.prototype.discardDeferredRenderedUserInput = function(this: InteractiveModeBase, text: string): void {\n const index = this.deferredRenderedUserInputs.indexOf(text);\n if (index !== -1) this.deferredRenderedUserInputs.splice(index, 1);\n const trackedComponents = this.deferredRenderedUserInputComponents.get(text);\n const componentsToRemove = trackedComponents?.shift();\n if (trackedComponents && trackedComponents.length === 0) {\n this.deferredRenderedUserInputComponents.delete(text);\n }\n if (!componentsToRemove) return;\n for (const component of componentsToRemove) {\n this.chatContainer.removeChild(component);\n }\n this.updatePendingMessagesDisplay();\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.chatMessageRenderOptions = function(this: InteractiveModeBase): ChatMessageRenderOptions {\n return {\n ui: this.ui,\n cwd: this.sessionManager.getCwd(),\n markdownTheme: this.getMarkdownThemeWithSettings(),\n hideThinkingBlock: this.hideThinkingBlock,\n hiddenThinkingLabel: this.hiddenThinkingLabel,\n toolOutputExpanded: this.toolOutputExpanded,\n showImages: this.settingsManager.getShowImages(),\n imageWidthCells: this.settingsManager.getImageWidthCells(),\n outputPad: this.outputPad,\n getToolDefinition: (toolName) => this.getRegisteredToolDefinition(toolName),\n getCustomMessageRenderer: (customType) =>\n this.session.extensionRunner.getMessageRenderer(customType),\n };\n };\n\nInteractiveModeBase.prototype.addRenderedChatEntry = function(this: InteractiveModeBase, entry: ChatMessageEntry): Component {\n const component = renderChatMessageEntry(entry, this.chatMessageRenderOptions());\n addChatTranscriptEntry(this.chatContainer, component, entry.role);\n return component;\n };\n\nInteractiveModeBase.prototype.addContextCompactionSummaryToChat = function(this: InteractiveModeBase, result: ContextCompactionResult): void {\n this.chatContainer.addChild(new Spacer(1));\n const component = new ContextCompactionSummaryMessageComponent(\n result,\n this.getMarkdownThemeWithSettings(),\n );\n component.setExpanded(this.toolOutputExpanded);\n this.chatContainer.addChild(component);\n };\n\nInteractiveModeBase.prototype.addMessageToChat = function(this: InteractiveModeBase, message: AgentMessage, options?: { populateHistory?: boolean }): void {\n switch (message.role) {\n case \"bashExecution\": {\n const component = new BashExecutionComponent(\n message.command,\n this.ui,\n message.excludeFromContext,\n );\n if (message.output) {\n component.appendOutput(message.output);\n }\n component.setComplete(\n message.exitCode,\n message.cancelled,\n message.truncated\n ? ({ truncated: true } as TruncationResult)\n : undefined,\n message.fullOutputPath,\n );\n this.chatContainer.addChild(component);\n break;\n }\n case \"custom\": {\n if (message.display) {\n const renderer = this.session.extensionRunner.getMessageRenderer(\n message.customType,\n );\n const component = new CustomMessageComponent(\n message,\n renderer,\n this.getMarkdownThemeWithSettings(),\n );\n component.setExpanded(this.toolOutputExpanded);\n this.chatContainer.addChild(component);\n }\n break;\n }\n case \"branchSummary\": {\n this.chatContainer.addChild(new Spacer(1));\n const component = new BranchSummaryMessageComponent(\n message,\n this.getMarkdownThemeWithSettings(),\n );\n component.setExpanded(this.toolOutputExpanded);\n this.chatContainer.addChild(component);\n break;\n }\n case \"user\": {\n const textContent = this.getUserMessageText(message);\n if (textContent) {\n if (this.chatContainer.children.length > 0) {\n this.chatContainer.addChild(new Spacer(1));\n }\n const skillBlock = parseSkillBlock(textContent);\n if (skillBlock) {\n // Render skill block (collapsible)\n const component = new SkillInvocationMessageComponent(\n skillBlock,\n this.getMarkdownThemeWithSettings(),\n );\n component.setExpanded(this.toolOutputExpanded);\n this.chatContainer.addChild(component);\n // Render user message separately if present\n if (skillBlock.userMessage) {\n const userComponent = new UserMessageComponent(\n skillBlock.userMessage,\n this.getMarkdownThemeWithSettings(),\n this.outputPad,\n );\n this.chatContainer.addChild(userComponent);\n }\n } else {\n const userComponent = new UserMessageComponent(\n textContent,\n this.getMarkdownThemeWithSettings(),\n this.outputPad,\n );\n this.chatContainer.addChild(userComponent);\n }\n if (options?.populateHistory) {\n this.editor.addToHistory?.(textContent);\n }\n }\n break;\n }\n case \"assistant\": {\n const assistantComponent = new AssistantMessageComponent(\n message,\n this.hideThinkingBlock,\n this.getMarkdownThemeWithSettings(),\n this.hiddenThinkingLabel,\n this.outputPad,\n );\n this.chatContainer.addChild(assistantComponent);\n break;\n }\n case \"toolResult\": {\n // Tool results are rendered inline with tool calls, handled separately\n break;\n }\n default:\n break;\n }\n };\n\nInteractiveModeBase.prototype.renderSessionContext = function(this: InteractiveModeBase, sessionContext: SessionContext, options: { updateFooter?: boolean; populateHistory?: boolean } = {}): void {\n this.pendingTools.clear();\n const pendingDeferredInputs = [...this.deferredRenderedUserInputs];\n this.deferredRenderedUserInputs = [];\n this.deferredRenderedUserInputComponents.clear();\n\n if (options.updateFooter) {\n this.footer.invalidate();\n this.updateEditorBorderColor();\n }\n\n const entries = chatEntriesFromAgentMessages(sessionContext.messages);\n for (const entry of entries) {\n const component = this.addRenderedChatEntry(entry);\n if (\n entry.kind === \"tool\" &&\n entry.isPartial !== false &&\n component instanceof ToolExecutionComponent\n ) {\n this.pendingTools.set(entry.toolCallId, component);\n }\n if (options.populateHistory && entry.kind === \"user\") {\n this.editor.addToHistory?.(entry.text);\n }\n }\n\n for (const input of pendingDeferredInputs) {\n this.renderDeferredUserInput(input);\n }\n\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.attachStartupNoticesContainer = function(this: InteractiveModeBase, options: { resetDetached?: boolean } = {}): void {\n const isAttached = this.chatContainer.children.includes(this.startupNoticesContainer);\n if (isAttached) return;\n if (options.resetDetached) {\n this.startupNoticesContainer.clear();\n }\n this.chatContainer.addChild(this.startupNoticesContainer);\n };\n\nInteractiveModeBase.prototype.renderInitialMessages = function(this: InteractiveModeBase): void {\n this.attachStartupNoticesContainer({ resetDetached: true });\n // Get aligned messages and entries from session context\n const context = this.sessionManager.buildSessionContext();\n this.renderSessionContext(context, {\n updateFooter: true,\n populateHistory: true,\n });\n\n // Show compaction info if session was compacted\n const allEntries = this.sessionManager.getEntries();\n const compactionCount = allEntries.filter(\n (e) => e.type === \"compaction\",\n ).length;\n if (compactionCount > 0) {\n const times =\n compactionCount === 1 ? \"1 time\" : `${compactionCount} times`;\n this.showStatus(`Session compacted ${times}`);\n }\n };\n\nInteractiveModeBase.prototype.getUserInput = async function(this: InteractiveModeBase): Promise<string> {\n const queuedInput = this.pendingUserInputs.shift();\n if (queuedInput !== undefined) {\n return queuedInput;\n }\n\n return new Promise((resolve) => {\n this.onInputCallback = (text: string) => {\n this.onInputCallback = undefined;\n resolve(text);\n };\n });\n };\n\nInteractiveModeBase.prototype.rebuildChatFromMessages = function(this: InteractiveModeBase): void {\n this.chatContainer.clear();\n this.attachStartupNoticesContainer();\n const context = this.sessionManager.buildSessionContext();\n this.renderSessionContext(context);\n };\n"]}
|
|
1
|
+
{"version":3,"file":"interactive-render-chat.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-render-chat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAqK,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,6BAA6B,EAAE,4BAA4B,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,wCAAwC,EAAE,sBAAsB,EAAE,+BAA+B,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACtiB,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,mBAAmB,CAAC,SAAS,CAAC,UAAU,GAAG,UAAoC,OAAe;IAC1F,MAAM,QAAQ,GAAG,IAAI,CAAC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;IACrC,MAAM,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC,mBAAmB,EAAE,CAAC;IAC1D,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;AACrC,CAAC,CAAC","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type AgentMessage, type Component, type ContextCompactionResult, type SessionContext, type TruncationResult, type ChatMessageEntry, type ChatMessageRenderOptions, Spacer, Text, parseSkillBlock, AssistantMessageComponent, BashExecutionComponent, BranchSummaryMessageComponent, chatEntriesFromAgentMessages, renderChatMessageEntry, addChatTranscriptEntry, ContextCompactionSummaryMessageComponent, CustomMessageComponent, SkillInvocationMessageComponent, ToolExecutionComponent, UserMessageComponent, theme } from \"./interactive-mode-deps.ts\";\nimport { yieldToEventLoop } from \"../../utils/event-loop.ts\";\n\nInteractiveModeBase.prototype.showStatus = function(this: InteractiveModeBase, message: string): void {\n const children = this.chatContainer.children;\n const last =\n children.length > 0 ? children[children.length - 1] : undefined;\n const secondLast =\n children.length > 1 ? children[children.length - 2] : undefined;\n\n if (\n last &&\n secondLast &&\n last === this.lastStatusText &&\n secondLast === this.lastStatusSpacer\n ) {\n this.lastStatusText.setText(theme.fg(\"dim\", message));\n this.ui.requestRender();\n return;\n }\n\n const spacer = new Spacer(1);\n const text = new Text(theme.fg(\"dim\", message), 1, 0);\n this.chatContainer.addChild(spacer);\n this.chatContainer.addChild(text);\n this.lastStatusSpacer = spacer;\n this.lastStatusText = text;\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.renderDeferredUserInput = function(this: InteractiveModeBase, text: string): void {\n this.deferredRenderedUserInputs.push(text);\n const startIndex = this.chatContainer.children.length;\n this.addMessageToChat({ role: \"user\", content: text } as AgentMessage);\n const renderedComponents = this.chatContainer.children.slice(startIndex);\n const trackedComponents = this.deferredRenderedUserInputComponents.get(text) ?? [];\n trackedComponents.push(renderedComponents);\n this.deferredRenderedUserInputComponents.set(text, trackedComponents);\n this.updatePendingMessagesDisplay();\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.consumeDeferredRenderedUserInput = function(this: InteractiveModeBase, text: string): boolean {\n const index = this.deferredRenderedUserInputs.indexOf(text);\n if (index === -1) return false;\n this.deferredRenderedUserInputs.splice(index, 1);\n const trackedComponents = this.deferredRenderedUserInputComponents.get(text);\n trackedComponents?.shift();\n if (trackedComponents && trackedComponents.length === 0) {\n this.deferredRenderedUserInputComponents.delete(text);\n }\n return true;\n };\n\nInteractiveModeBase.prototype.discardDeferredRenderedUserInput = function(this: InteractiveModeBase, text: string): void {\n const index = this.deferredRenderedUserInputs.indexOf(text);\n if (index !== -1) this.deferredRenderedUserInputs.splice(index, 1);\n const trackedComponents = this.deferredRenderedUserInputComponents.get(text);\n const componentsToRemove = trackedComponents?.shift();\n if (trackedComponents && trackedComponents.length === 0) {\n this.deferredRenderedUserInputComponents.delete(text);\n }\n if (!componentsToRemove) return;\n for (const component of componentsToRemove) {\n this.chatContainer.removeChild(component);\n }\n this.updatePendingMessagesDisplay();\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.chatMessageRenderOptions = function(this: InteractiveModeBase): ChatMessageRenderOptions {\n return {\n ui: this.ui,\n cwd: this.sessionManager.getCwd(),\n markdownTheme: this.getMarkdownThemeWithSettings(),\n hideThinkingBlock: this.hideThinkingBlock,\n hiddenThinkingLabel: this.hiddenThinkingLabel,\n toolOutputExpanded: this.toolOutputExpanded,\n showImages: this.settingsManager.getShowImages(),\n imageWidthCells: this.settingsManager.getImageWidthCells(),\n outputPad: this.outputPad,\n getToolDefinition: (toolName) => this.getRegisteredToolDefinition(toolName),\n getCustomMessageRenderer: (customType) =>\n this.session.extensionRunner.getMessageRenderer(customType),\n };\n };\n\nInteractiveModeBase.prototype.addRenderedChatEntry = function(this: InteractiveModeBase, entry: ChatMessageEntry): Component {\n const component = renderChatMessageEntry(entry, this.chatMessageRenderOptions());\n addChatTranscriptEntry(this.chatContainer, component, entry.role);\n return component;\n };\n\nInteractiveModeBase.prototype.addContextCompactionSummaryToChat = function(this: InteractiveModeBase, result: ContextCompactionResult): void {\n this.chatContainer.addChild(new Spacer(1));\n const component = new ContextCompactionSummaryMessageComponent(\n result,\n this.getMarkdownThemeWithSettings(),\n );\n component.setExpanded(this.toolOutputExpanded);\n this.chatContainer.addChild(component);\n };\n\nInteractiveModeBase.prototype.addMessageToChat = function(this: InteractiveModeBase, message: AgentMessage, options?: { populateHistory?: boolean }): void {\n switch (message.role) {\n case \"bashExecution\": {\n const component = new BashExecutionComponent(\n message.command,\n this.ui,\n message.excludeFromContext,\n );\n if (message.output) {\n component.appendOutput(message.output);\n }\n component.setComplete(\n message.exitCode,\n message.cancelled,\n message.truncated\n ? ({ truncated: true } as TruncationResult)\n : undefined,\n message.fullOutputPath,\n );\n this.chatContainer.addChild(component);\n break;\n }\n case \"custom\": {\n if (message.display) {\n const renderer = this.session.extensionRunner.getMessageRenderer(\n message.customType,\n );\n const component = new CustomMessageComponent(\n message,\n renderer,\n this.getMarkdownThemeWithSettings(),\n );\n component.setExpanded(this.toolOutputExpanded);\n this.chatContainer.addChild(component);\n }\n break;\n }\n case \"branchSummary\": {\n this.chatContainer.addChild(new Spacer(1));\n const component = new BranchSummaryMessageComponent(\n message,\n this.getMarkdownThemeWithSettings(),\n );\n component.setExpanded(this.toolOutputExpanded);\n this.chatContainer.addChild(component);\n break;\n }\n case \"user\": {\n const textContent = this.getUserMessageText(message);\n if (textContent) {\n if (this.chatContainer.children.length > 0) {\n this.chatContainer.addChild(new Spacer(1));\n }\n const skillBlock = parseSkillBlock(textContent);\n if (skillBlock) {\n // Render skill block (collapsible)\n const component = new SkillInvocationMessageComponent(\n skillBlock,\n this.getMarkdownThemeWithSettings(),\n );\n component.setExpanded(this.toolOutputExpanded);\n this.chatContainer.addChild(component);\n // Render user message separately if present\n if (skillBlock.userMessage) {\n const userComponent = new UserMessageComponent(\n skillBlock.userMessage,\n this.getMarkdownThemeWithSettings(),\n this.outputPad,\n );\n this.chatContainer.addChild(userComponent);\n }\n } else {\n const userComponent = new UserMessageComponent(\n textContent,\n this.getMarkdownThemeWithSettings(),\n this.outputPad,\n );\n this.chatContainer.addChild(userComponent);\n }\n if (options?.populateHistory) {\n this.editor.addToHistory?.(textContent);\n }\n }\n break;\n }\n case \"assistant\": {\n const assistantComponent = new AssistantMessageComponent(\n message,\n this.hideThinkingBlock,\n this.getMarkdownThemeWithSettings(),\n this.hiddenThinkingLabel,\n this.outputPad,\n );\n this.chatContainer.addChild(assistantComponent);\n break;\n }\n case \"toolResult\": {\n // Tool results are rendered inline with tool calls, handled separately\n break;\n }\n default:\n break;\n }\n };\n\nInteractiveModeBase.prototype.renderSessionContext = function(this: InteractiveModeBase, sessionContext: SessionContext, options: { updateFooter?: boolean; populateHistory?: boolean } = {}): void {\n this.pendingTools.clear();\n const pendingDeferredInputs = [...this.deferredRenderedUserInputs];\n this.deferredRenderedUserInputs = [];\n this.deferredRenderedUserInputComponents.clear();\n\n if (options.updateFooter) {\n this.footer.invalidate();\n this.updateEditorBorderColor();\n }\n\n const entries = chatEntriesFromAgentMessages(sessionContext.messages);\n for (const entry of entries) {\n const component = this.addRenderedChatEntry(entry);\n if (\n entry.kind === \"tool\" &&\n entry.isPartial !== false &&\n component instanceof ToolExecutionComponent\n ) {\n this.pendingTools.set(entry.toolCallId, component);\n }\n if (options.populateHistory && entry.kind === \"user\") {\n this.editor.addToHistory?.(entry.text);\n }\n }\n\n for (const input of pendingDeferredInputs) {\n this.renderDeferredUserInput(input);\n }\n\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.attachStartupNoticesContainer = function(this: InteractiveModeBase, options: { resetDetached?: boolean } = {}): void {\n const isAttached = this.chatContainer.children.includes(this.startupNoticesContainer);\n if (isAttached) return;\n if (options.resetDetached) {\n this.startupNoticesContainer.clear();\n }\n this.chatContainer.addChild(this.startupNoticesContainer);\n };\n\nInteractiveModeBase.prototype.renderInitialMessages = function(this: InteractiveModeBase): void {\n this.attachStartupNoticesContainer({ resetDetached: true });\n // Get aligned messages and entries from session context\n const context = this.sessionManager.buildSessionContext();\n this.renderSessionContext(context, {\n updateFooter: true,\n populateHistory: true,\n });\n\n // Show compaction info if session was compacted\n const allEntries = this.sessionManager.getEntries();\n const compactionCount = allEntries.filter(\n (e) => e.type === \"compaction\",\n ).length;\n if (compactionCount > 0) {\n const times =\n compactionCount === 1 ? \"1 time\" : `${compactionCount} times`;\n this.showStatus(`Session compacted ${times}`);\n }\n };\n\nInteractiveModeBase.prototype.getUserInput = async function(this: InteractiveModeBase): Promise<string> {\n for (let attempt = 0; !this.startupCookedInputRecovered && attempt < 10; attempt += 1) {\n await yieldToEventLoop();\n if (this.recoverCookedStartupInput?.()) break;\n }\n while (true) {\n const queuedInput = this.pendingUserInputs.shift();\n if (queuedInput !== undefined) {\n return queuedInput;\n }\n\n if (this.startupReplayActiveInput) {\n await this.drainStartupReplayCommands();\n continue;\n }\n\n return new Promise((resolve) => {\n this.onInputCallback = (text: string) => {\n this.onInputCallback = undefined;\n resolve(text);\n };\n });\n }\n };\n\nInteractiveModeBase.prototype.rebuildChatFromMessages = function(this: InteractiveModeBase): void {\n this.chatContainer.clear();\n this.attachStartupNoticesContainer();\n const context = this.sessionManager.buildSessionContext();\n this.renderSessionContext(context);\n };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-startup.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-startup.ts"],"names":[],"mappings":"","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type Container, type MarkdownTheme, os, path, Markdown, Spacer, Text, spawn, APP_NAME, APP_TITLE, ENV_OFFLINE, getEnvValue, getAgentDir, VERSION, formatCodexFastModeModelLabel, shouldApplyCodexFastMode, DefaultPackageManager, isInstallTelemetryEnabled, getChangelogPath, getEntriesForVersion, getNewEntries, normalizeChangelogLinks, parseChangelog, getCwdRelativePath, getPiUserAgent, recordTimeSinceReset, ensureTool, checkForNewPiVersion, renderAtomicAnsiBanner, DynamicBorder, getMarkdownTheme, onThemeChange, theme } from \"./interactive-mode-deps.ts\";\nimport { ExpandableText } from \"./interactive-mode-helpers.ts\";\nimport { ONBOARDING_COPY } from \"./interactive-onboarding.ts\";\n\nInteractiveModeBase.prototype.showStartupNoticesIfNeeded = function(this: InteractiveModeBase, targetContainer: Container = this.chatContainer): void {\n if (this.startupNoticesShown) {\n return;\n }\n this.startupNoticesShown = true;\n\n const changelogMarkdown = this.changelogMarkdown;\n if (!changelogMarkdown && !this.firstRunNoticeVisible) {\n return;\n }\n\n if (changelogMarkdown) {\n if (targetContainer.children.length > 0) {\n targetContainer.addChild(new Spacer(1));\n }\n targetContainer.addChild(new DynamicBorder());\n if (this.settingsManager.getCollapseChangelog()) {\n const versionMatch = changelogMarkdown.match(\n /##\\s+\\[?((?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)(?:-(?:alpha\\.)?(?:0|[1-9]\\d*))?)\\]?/,\n );\n const latestVersion = versionMatch ? versionMatch[1] : this.version;\n const condensedText = `Updated to v${latestVersion}. Use ${theme.bold(\"/changelog\")} to view full changelog.`;\n targetContainer.addChild(new Text(condensedText, 1, 0));\n } else {\n targetContainer.addChild(\n new Text(theme.bold(theme.fg(\"accent\", \"What's New\")), 1, 0),\n );\n targetContainer.addChild(new Spacer(1));\n targetContainer.addChild(\n new Markdown(\n changelogMarkdown.trim(),\n 1,\n 0,\n this.getMarkdownThemeWithSettings(),\n ),\n );\n targetContainer.addChild(new Spacer(1));\n }\n targetContainer.addChild(new DynamicBorder());\n }\n\n if (this.firstRunNoticeVisible) {\n this.firstRunOnboardingNoticeComponents = [];\n if (targetContainer.children.length > 0) {\n this.firstRunOnboardingNoticeComponents.push(new Spacer(1));\n }\n this.firstRunOnboardingNoticeComponents.push(\n new DynamicBorder(),\n new Text(ONBOARDING_COPY, 1, 0),\n new DynamicBorder(),\n new Spacer(1),\n );\n for (const component of this.firstRunOnboardingNoticeComponents) {\n targetContainer.addChild(component);\n }\n // Mark completion only after queueing the notice in the chat canvas so\n // launches that skip rendering retry the first-run notice next time.\n this.settingsManager.setOnboardedVersion(this.version);\n }\n\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.init = async function(this: InteractiveModeBase): Promise<void> {\n if (this.isInitialized) return;\n\n this.registerSignalHandlers();\n\n // Load changelog (only show new entries, skip for resumed sessions)\n this.hadLastChangelogVersionAtStartup = Boolean(this.settingsManager.getLastChangelogVersion());\n this.changelogMarkdown = this.getChangelogForDisplay();\n this.initializeFirstRunOnboardingMarkers();\n\n // Add header container as first child. Populate it after theme initialization.\n this.ui.addChild(this.headerContainer);\n\n this.ui.addChild(this.chatContainer);\n this.ui.addChild(this.pendingMessagesContainer);\n this.ui.addChild(this.statusContainer);\n this.renderWidgets(); // Initialize with default spacer\n this.ui.addChild(this.widgetContainerAbove);\n this.ui.addChild(this.usageMeter);\n this.ui.addChild(this.editorContainer);\n // Footer (persistent model + cwd identity) stays pinned directly under the\n // editor; below-editor widgets render after it, at the very bottom. This\n // keeps the session identity line attached to the input and places\n // transient run status (e.g. the workflow companion counter) beneath it.\n // Rendering below-editor widgets last also keeps a live widget at the\n // absolute bottom of the buffer (always within the viewport), so its\n // per-tick updates never sit above the fold — preserving the #1109\n // resize-flicker fix.\n this.ui.addChild(this.footer);\n this.ui.addChild(this.widgetContainerBelow);\n this.ui.setFocus(this.editor);\n\n this.setupKeyHandlers();\n this.setupEditorSubmitHandler();\n\n this.firstRunNoticeVisible = this.isFirstRunOnboardingEligible();\n\n // Start the UI before initializing extensions so session_start handlers can use interactive dialogs.\n // fd/rg readiness is intentionally checked after first paint because ensureTool may spawn\n // or download tools on cold machines.\n this.ui.start();\n recordTimeSinceReset(\"time-to-first-frame\");\n this.isInitialized = true;\n\n await this.themeController.applyFromSettings();\n\n // Add the quiet startup identity (unless silenced). Resource details are\n // disclosed separately in the chat canvas via the tools/resources toggle.\n if (this.options.verbose || !this.settingsManager.getQuietStartup()) {\n this.builtInHeader = new ExpandableText(\n () => this.getStartupIdentityText(),\n () => this.getStartupIdentityText(),\n this.getStartupExpansionState(),\n 1,\n 0,\n );\n\n this.headerContainer.addChild(new Spacer(1));\n this.headerContainer.addChild(this.builtInHeader);\n this.headerContainer.addChild(new Spacer(1));\n } else {\n // Minimal header when silenced\n this.builtInHeader = new Text(\"\", 0, 0);\n this.headerContainer.addChild(this.builtInHeader);\n }\n this.ui.requestRender();\n\n void Promise.all([ensureTool(\"fd\"), ensureTool(\"rg\")])\n .then(([fdPath]) => {\n this.fdPath = fdPath;\n this.setupAutocompleteProvider();\n })\n .catch((error) => {\n const message = error instanceof Error ? error.message : String(error);\n console.error(`Tool readiness check failed: ${message}`);\n });\n\n // When startup resources are deferred, keep the already-painted editor responsive.\n // Extension UI bindings are installed at the deferred reload boundary, not here,\n // so no post-paint resource work can block visible typing.\n if (this.deferredStartupPending) {\n this.applyRuntimeSettings();\n this.subscribeToAgent();\n this.updateEditorBorderColor();\n this.updateTerminalTitle();\n } else {\n await this.rebindCurrentSession();\n }\n\n this.attachStartupNoticesContainer();\n // Render initial messages AFTER the initial session binding is in place.\n this.renderInitialMessages();\n\tif (this.deferredStartupPending) {\n\t\tsetTimeout(() => {\n\t\t\tif (!this.deferredStartupPending || this.deferredStartupPromise) return;\n\t\t\tvoid this.ensureDeferredStartupComplete();\n\t\t}, 2000);\n\t}\n // Set up theme file watcher\n onThemeChange(() => {\n this.ui.invalidate();\n this.updateEditorBorderColor();\n this.ui.requestRender();\n });\n\n // Set up git branch watcher (uses provider instead of footer)\n this.footerDataProvider.onBranchChange(() => {\n this.ui.requestRender();\n });\n\n // Initialize available provider count for footer display without delaying first-frame startup.\n void this.updateAvailableProviderCount().catch((error) => {\n const message = error instanceof Error ? error.message : String(error);\n console.error(`Failed to update provider count: ${message}`);\n });\n };\n\nInteractiveModeBase.prototype.updateTerminalTitle = function(this: InteractiveModeBase): void {\n const cwdBasename = path.basename(this.sessionManager.getCwd());\n const sessionName = this.sessionManager.getSessionName();\n if (sessionName) {\n this.ui.terminal.setTitle(\n `${APP_TITLE} - ${sessionName} - ${cwdBasename}`,\n );\n } else {\n this.ui.terminal.setTitle(`${APP_TITLE} - ${cwdBasename}`);\n }\n };\n\nInteractiveModeBase.prototype.run = async function(this: InteractiveModeBase): Promise<void> {\n await this.init();\n\n\tsetTimeout(() => {\n\t\tvoid this.refreshCopilotModelCatalog();\n const startupNoticesContainer = this.startupNoticesContainer;\n\t\tcheckForNewPiVersion(this.version).then((newVersion) => {\n\t\t\tif (newVersion) this.showNewVersionNotification(newVersion, startupNoticesContainer);\n\t\t});\n\t\tthis.checkForPackageUpdates().then((updates) => {\n\t\t\tif (updates.length > 0) this.showPackageUpdateNotification(updates, startupNoticesContainer);\n\t\t});\n\t\tthis.checkTmuxKeyboardSetup().then((warning) => {\n\t\t\tif (warning) this.showWarning(warning, startupNoticesContainer);\n\t\t});\n\t\t// When startup is deferred, the RESOURCES disclosure renders after the\n\t\t// deferred extension load; hold the subscription warning until then so\n\t\t// the disclosure always appears first.\n\t\tif (!this.deferredStartupPending && !this.deferredStartupPromise && !this.pendingLoadedResourcesDisclosure) {\n\t\t\tvoid this.maybeWarnAboutAnthropicSubscriptionAuth(undefined, startupNoticesContainer);\n\t\t}\n\t}, 500);\n\n // Show startup warnings\n const {\n migratedProviders,\n modelFallbackMessage,\n initialMessage,\n initialImages,\n initialMessages,\n } = this.options;\n\n if (migratedProviders && migratedProviders.length > 0) {\n this.showWarning(\n `Migrated credentials to auth.json: ${migratedProviders.join(\", \")}`,\n );\n }\n\n const modelsJsonError = this.session.modelRegistry.getError();\n if (modelsJsonError) {\n this.showError(`models.json error: ${modelsJsonError}`);\n }\n\n if (modelFallbackMessage && !this.deferredStartupPending) {\n this.showWarning(modelFallbackMessage, this.startupNoticesContainer);\n }\n\n // CLI-provided startup prompts need extension tools/resources; wait before sending them,\n // but do not block the normal no-prompt input loop from becoming ready.\n if (this.deferredStartupPending && (initialMessage || (initialMessages && initialMessages.length > 0))) {\n await this.ensureDeferredStartupComplete();\n }\n\n // Process initial messages\n if (initialMessage) {\n try {\n await this.session.prompt(initialMessage, { images: initialImages });\n } catch (error: unknown) {\n const errorMessage =\n error instanceof Error ? error.message : \"Unknown error occurred\";\n this.showError(errorMessage);\n }\n }\n\n if (initialMessages) {\n for (const message of initialMessages) {\n try {\n await this.session.prompt(message);\n } catch (error: unknown) {\n const errorMessage =\n error instanceof Error ? error.message : \"Unknown error occurred\";\n this.showError(errorMessage);\n }\n }\n }\n\n // Main interactive loop\n while (true) {\n const userInput = await this.getUserInput();\n await this.runUserPromptTurn(userInput);\n }\n };\n\nInteractiveModeBase.prototype.checkForPackageUpdates = async function(this: InteractiveModeBase): Promise<string[]> {\n if (getEnvValue(ENV_OFFLINE)) {\n return [];\n }\n\n try {\n const packageManager = new DefaultPackageManager({\n cwd: this.sessionManager.getCwd(),\n agentDir: getAgentDir(),\n settingsManager: this.settingsManager,\n });\n const updates = await packageManager.checkForAvailableUpdates();\n return updates.map((update) => update.displayName);\n } catch {\n return [];\n }\n };\n\nInteractiveModeBase.prototype.checkTmuxKeyboardSetup = async function(this: InteractiveModeBase): Promise<string | undefined> {\n if (!process.env.TMUX) return undefined;\n\n const runTmuxShow = (option: string): Promise<string | undefined> => {\n return new Promise((resolve) => {\n const proc = spawn(\"tmux\", [\"show\", \"-gv\", option], {\n stdio: [\"ignore\", \"pipe\", \"ignore\"],\n });\n let stdout = \"\";\n const timer = setTimeout(() => {\n proc.kill();\n resolve(undefined);\n }, 2000);\n\n proc.stdout?.on(\"data\", (data) => {\n stdout += data.toString();\n });\n proc.on(\"error\", () => {\n clearTimeout(timer);\n resolve(undefined);\n });\n proc.on(\"close\", (code) => {\n clearTimeout(timer);\n resolve(code === 0 ? stdout.trim() : undefined);\n });\n });\n };\n\n const [extendedKeys, extendedKeysFormat] = await Promise.all([\n runTmuxShow(\"extended-keys\"),\n runTmuxShow(\"extended-keys-format\"),\n ]);\n\n // If we couldn't query tmux (timeout, sandbox, etc.), don't warn\n if (extendedKeys === undefined) return undefined;\n\n if (extendedKeys !== \"on\" && extendedKeys !== \"always\") {\n return \"tmux extended-keys is off. Modified enter keys may not work. Add `set -g extended-keys on` to ~/.tmux.conf and restart tmux.\";\n }\n\n if (extendedKeysFormat === \"xterm\") {\n return \"tmux extended-keys-format is xterm. Pi works best with csi-u. Add `set -g extended-keys-format csi-u` to ~/.tmux.conf and restart tmux.\";\n }\n\n return undefined;\n };\n\nInteractiveModeBase.prototype.getChangelogForDisplay = function(this: InteractiveModeBase): string | undefined {\n // Skip changelog for resumed/continued sessions (already have messages)\n if (this.session.state.messages.length > 0) {\n return undefined;\n }\n\n const lastVersion = this.settingsManager.getLastChangelogVersion();\n const changelogPath = getChangelogPath();\n const entries = parseChangelog(changelogPath);\n\n if (!lastVersion) {\n // Fresh install - record the version, send telemetry, don't show changelog\n this.settingsManager.setLastChangelogVersion(VERSION);\n this.reportInstallTelemetry(VERSION);\n return undefined;\n }\n\n const newEntries = getNewEntries(entries, lastVersion, VERSION);\n const currentEntries = getEntriesForVersion(newEntries, VERSION);\n if (currentEntries.length > 0) {\n this.settingsManager.setLastChangelogVersion(VERSION);\n this.reportInstallTelemetry(VERSION);\n return currentEntries.map((e) => normalizeChangelogLinks(e.content, e)).join(\"\\n\\n\");\n }\n\n return undefined;\n };\n\nInteractiveModeBase.prototype.reportInstallTelemetry = function(this: InteractiveModeBase, version: string): void {\n if (getEnvValue(ENV_OFFLINE)) {\n return;\n }\n\n if (!isInstallTelemetryEnabled(this.settingsManager)) {\n return;\n }\n\n void fetch(\n `https://pi.dev/api/report-install?version=${encodeURIComponent(version)}`,\n {\n headers: {\n \"User-Agent\": getPiUserAgent(version),\n },\n signal: AbortSignal.timeout(5000),\n },\n )\n .then(() => undefined)\n .catch(() => undefined);\n };\n\nInteractiveModeBase.prototype.getMarkdownThemeWithSettings = function(this: InteractiveModeBase): MarkdownTheme {\n return {\n ...getMarkdownTheme(),\n codeBlockIndent: this.settingsManager.getCodeBlockIndent(),\n };\n };\n\nInteractiveModeBase.prototype.formatDisplayPath = function(this: InteractiveModeBase, p: string): string {\n const home = os.homedir();\n let result = p;\n\n // Replace home directory with ~\n if (result.startsWith(home)) {\n result = `~${result.slice(home.length)}`;\n }\n\n return result;\n };\n\nInteractiveModeBase.prototype.formatExtensionDisplayPath = function(this: InteractiveModeBase, path: string): string {\n let result = this.formatDisplayPath(path);\n result = result.replace(/\\/index\\.ts$/, \"\").replace(/\\/index\\.js$/, \"\");\n return result;\n };\n\nInteractiveModeBase.prototype.formatContextPath = function(this: InteractiveModeBase, p: string): string {\n const cwd = path.resolve(this.sessionManager.getCwd());\n const absolutePath = path.isAbsolute(p)\n ? path.resolve(p)\n : path.resolve(cwd, p);\n const relativePath = getCwdRelativePath(absolutePath, cwd);\n if (relativePath !== undefined) {\n return relativePath;\n }\n\n return this.formatDisplayPath(absolutePath);\n };\n\nInteractiveModeBase.prototype.getStartupModelLabel = function(this: InteractiveModeBase): string {\n const model = this.session.state.model;\n let modelLabel = model?.id ?? \"no-model\";\n\n if (model?.reasoning) {\n modelLabel = `${modelLabel} ${this.session.thinkingLevel || \"off\"}`;\n }\n\n if (!model) {\n return modelLabel;\n }\n\n const fastModeEnabled = shouldApplyCodexFastMode(\n model,\n this.session.settingsManager.getCodexFastModeSettings(),\n this.session.orchestrationContext,\n );\n return formatCodexFastModeModelLabel(modelLabel, fastModeEnabled);\n };\n\nInteractiveModeBase.prototype.getStartupIdentityText = function(this: InteractiveModeBase): string {\n const appLabel = APP_NAME.length > 0\n ? `${APP_NAME[0]!.toUpperCase()}${APP_NAME.slice(1)}`\n : \"Atomic\";\n const title = `${theme.bold(theme.fg(\"text\", appLabel))} ${theme.fg(\"muted\", `v${this.version}`)}`;\n const model = this.session.state.model;\n const provider = model ? theme.fg(\"dim\", `(${model.provider})`) : theme.fg(\"dim\", \"(no-provider)\");\n const modelLine = `${provider} ${theme.fg(\"muted\", this.getStartupModelLabel())}`;\n const cwd = theme.fg(\"muted\", this.formatDisplayPath(this.sessionManager.getCwd()));\n const metaLines = [title, modelLine, cwd];\n const markLines = this.getAtomicAnsiMarkLines();\n\n return markLines\n .map((line, index) => `${line} ${metaLines[index] ?? \"\"}`.trimEnd())\n .join(\"\\n\");\n };\n\nInteractiveModeBase.prototype.getAtomicAnsiMarkLines = function(this: InteractiveModeBase): string[] {\n return renderAtomicAnsiBanner(theme, this.session.thinkingLevel || \"off\");\n };\n\nInteractiveModeBase.prototype.getStartupExpansionState = function(this: InteractiveModeBase): boolean {\n return this.options.verbose || this.toolOutputExpanded;\n };\n"]}
|
|
1
|
+
{"version":3,"file":"interactive-startup.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-startup.ts"],"names":[],"mappings":"","sourcesContent":["import { InteractiveModeBase, seedStartupInput } from \"./interactive-mode-base.ts\";\nimport { type Container, type MarkdownTheme, os, path, Markdown, Spacer, Text, spawn, APP_NAME, APP_TITLE, ENV_OFFLINE, getEnvValue, getAgentDir, VERSION, formatCodexFastModeModelLabel, shouldApplyCodexFastMode, DefaultPackageManager, isInstallTelemetryEnabled, getChangelogPath, getEntriesForVersion, getNewEntries, normalizeChangelogLinks, parseChangelog, getCwdRelativePath, getPiUserAgent, recordTimeSinceReset, ensureTool, checkForNewPiVersion, renderAtomicAnsiBanner, DynamicBorder, getMarkdownTheme, onThemeChange, theme } from \"./interactive-mode-deps.ts\";\nimport { ExpandableText } from \"./interactive-mode-helpers.ts\";\nimport { ONBOARDING_COPY } from \"./interactive-onboarding.ts\";\n\nInteractiveModeBase.prototype.showStartupNoticesIfNeeded = function(this: InteractiveModeBase, targetContainer: Container = this.chatContainer): void {\n if (this.startupNoticesShown) {\n return;\n }\n this.startupNoticesShown = true;\n\n const changelogMarkdown = this.changelogMarkdown;\n if (!changelogMarkdown && !this.firstRunNoticeVisible) {\n return;\n }\n\n if (changelogMarkdown) {\n if (targetContainer.children.length > 0) {\n targetContainer.addChild(new Spacer(1));\n }\n targetContainer.addChild(new DynamicBorder());\n if (this.settingsManager.getCollapseChangelog()) {\n const versionMatch = changelogMarkdown.match(\n /##\\s+\\[?((?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)(?:-(?:alpha\\.)?(?:0|[1-9]\\d*))?)\\]?/,\n );\n const latestVersion = versionMatch ? versionMatch[1] : this.version;\n const condensedText = `Updated to v${latestVersion}. Use ${theme.bold(\"/changelog\")} to view full changelog.`;\n targetContainer.addChild(new Text(condensedText, 1, 0));\n } else {\n targetContainer.addChild(\n new Text(theme.bold(theme.fg(\"accent\", \"What's New\")), 1, 0),\n );\n targetContainer.addChild(new Spacer(1));\n targetContainer.addChild(\n new Markdown(\n changelogMarkdown.trim(),\n 1,\n 0,\n this.getMarkdownThemeWithSettings(),\n ),\n );\n targetContainer.addChild(new Spacer(1));\n }\n targetContainer.addChild(new DynamicBorder());\n }\n\n if (this.firstRunNoticeVisible) {\n this.firstRunOnboardingNoticeComponents = [];\n if (targetContainer.children.length > 0) {\n this.firstRunOnboardingNoticeComponents.push(new Spacer(1));\n }\n this.firstRunOnboardingNoticeComponents.push(\n new DynamicBorder(),\n new Text(ONBOARDING_COPY, 1, 0),\n new DynamicBorder(),\n new Spacer(1),\n );\n for (const component of this.firstRunOnboardingNoticeComponents) {\n targetContainer.addChild(component);\n }\n // Mark completion only after queueing the notice in the chat canvas so\n // launches that skip rendering retry the first-run notice next time.\n this.settingsManager.setOnboardedVersion(this.version);\n }\n\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.init = async function(this: InteractiveModeBase): Promise<void> {\n if (this.isInitialized) return;\n\n this.registerSignalHandlers();\n\n // Load changelog (only show new entries, skip for resumed sessions)\n this.hadLastChangelogVersionAtStartup = Boolean(this.settingsManager.getLastChangelogVersion());\n this.changelogMarkdown = this.getChangelogForDisplay();\n this.initializeFirstRunOnboardingMarkers();\n\n // Add header container as first child. Populate it after theme initialization.\n this.ui.addChild(this.headerContainer);\n\n this.ui.addChild(this.chatContainer);\n this.ui.addChild(this.pendingMessagesContainer);\n this.ui.addChild(this.statusContainer);\n this.renderWidgets(); // Initialize with default spacer\n this.ui.addChild(this.widgetContainerAbove);\n this.ui.addChild(this.usageMeter);\n this.ui.addChild(this.editorContainer);\n // Footer (persistent model + cwd identity) stays pinned directly under the\n // editor; below-editor widgets render after it, at the very bottom. This\n // keeps the session identity line attached to the input and places\n // transient run status (e.g. the workflow companion counter) beneath it.\n // Rendering below-editor widgets last also keeps a live widget at the\n // absolute bottom of the buffer (always within the viewport), so its\n // per-tick updates never sit above the fold — preserving the #1109\n // resize-flicker fix.\n this.ui.addChild(this.footer);\n this.ui.addChild(this.widgetContainerBelow);\n this.ui.setFocus(this.editor);\n\n this.setupKeyHandlers();\n this.setupEditorSubmitHandler();\n\n this.firstRunNoticeVisible = this.isFirstRunOnboardingEligible();\n\n seedStartupInput(\n this.pendingUserInputs,\n this.defaultEditor,\n this.options.startupInputCapture?.consume(),\n this.startupReplayInputs,\n (text) => {\n this.startupDraftText = text;\n },\n (text) => {\n this.startupReplayActiveInput = text;\n },\n );\n\n // Start the UI before initializing extensions so session_start handlers can use interactive dialogs.\n // fd/rg readiness is intentionally checked after first paint because ensureTool may spawn\n // or download tools on cold machines.\n this.ui.start();\n recordTimeSinceReset(\"time-to-first-frame\");\n this.isInitialized = true;\n\n await this.themeController.applyFromSettings();\n\n // Add the quiet startup identity (unless silenced). Resource details are\n // disclosed separately in the chat canvas via the tools/resources toggle.\n if (this.options.verbose || !this.settingsManager.getQuietStartup()) {\n this.builtInHeader = new ExpandableText(\n () => this.getStartupIdentityText(),\n () => this.getStartupIdentityText(),\n this.getStartupExpansionState(),\n 1,\n 0,\n );\n\n this.headerContainer.addChild(new Spacer(1));\n this.headerContainer.addChild(this.builtInHeader);\n this.headerContainer.addChild(new Spacer(1));\n } else {\n // Minimal header when silenced\n this.builtInHeader = new Text(\"\", 0, 0);\n this.headerContainer.addChild(this.builtInHeader);\n }\n this.ui.requestRender();\n\n void Promise.all([ensureTool(\"fd\"), ensureTool(\"rg\")])\n .then(([fdPath]) => {\n this.fdPath = fdPath;\n this.setupAutocompleteProvider();\n })\n .catch((error) => {\n const message = error instanceof Error ? error.message : String(error);\n console.error(`Tool readiness check failed: ${message}`);\n });\n\n // When startup resources are deferred, keep the already-painted editor responsive.\n // Extension UI bindings are installed at the deferred reload boundary, not here,\n // so no post-paint resource work can block visible typing.\n if (this.deferredStartupPending) {\n this.applyRuntimeSettings();\n this.subscribeToAgent();\n this.updateEditorBorderColor();\n this.updateTerminalTitle();\n } else {\n await this.rebindCurrentSession();\n }\n\n this.attachStartupNoticesContainer();\n // Render initial messages AFTER the initial session binding is in place.\n this.renderInitialMessages();\n\tif (this.deferredStartupPending) {\n\t\tsetTimeout(() => {\n\t\t\tif (!this.deferredStartupPending || this.deferredStartupPromise) return;\n\t\t\tvoid this.ensureDeferredStartupComplete();\n\t\t}, 2000);\n\t}\n // Set up theme file watcher\n onThemeChange(() => {\n this.ui.invalidate();\n this.updateEditorBorderColor();\n this.ui.requestRender();\n });\n\n // Set up git branch watcher (uses provider instead of footer)\n this.footerDataProvider.onBranchChange(() => {\n this.ui.requestRender();\n });\n\n // Initialize available provider count for footer display without delaying first-frame startup.\n void this.updateAvailableProviderCount().catch((error) => {\n const message = error instanceof Error ? error.message : String(error);\n console.error(`Failed to update provider count: ${message}`);\n });\n };\n\nInteractiveModeBase.prototype.updateTerminalTitle = function(this: InteractiveModeBase): void {\n const cwdBasename = path.basename(this.sessionManager.getCwd());\n const sessionName = this.sessionManager.getSessionName();\n if (sessionName) {\n this.ui.terminal.setTitle(\n `${APP_TITLE} - ${sessionName} - ${cwdBasename}`,\n );\n } else {\n this.ui.terminal.setTitle(`${APP_TITLE} - ${cwdBasename}`);\n }\n };\n\nInteractiveModeBase.prototype.run = async function(this: InteractiveModeBase): Promise<void> {\n await this.init();\n\n\tsetTimeout(() => {\n\t\tvoid this.refreshCopilotModelCatalog();\n const startupNoticesContainer = this.startupNoticesContainer;\n\t\tcheckForNewPiVersion(this.version).then((newVersion) => {\n\t\t\tif (newVersion) this.showNewVersionNotification(newVersion, startupNoticesContainer);\n\t\t});\n\t\tthis.checkForPackageUpdates().then((updates) => {\n\t\t\tif (updates.length > 0) this.showPackageUpdateNotification(updates, startupNoticesContainer);\n\t\t});\n\t\tthis.checkTmuxKeyboardSetup().then((warning) => {\n\t\t\tif (warning) this.showWarning(warning, startupNoticesContainer);\n\t\t});\n\t\t// When startup is deferred, the RESOURCES disclosure renders after the\n\t\t// deferred extension load; hold the subscription warning until then so\n\t\t// the disclosure always appears first.\n\t\tif (!this.deferredStartupPending && !this.deferredStartupPromise && !this.pendingLoadedResourcesDisclosure) {\n\t\t\tvoid this.maybeWarnAboutAnthropicSubscriptionAuth(undefined, startupNoticesContainer);\n\t\t}\n\t}, 500);\n\n // Show startup warnings\n const {\n migratedProviders,\n modelFallbackMessage,\n initialMessage,\n initialImages,\n initialMessages,\n } = this.options;\n\n if (migratedProviders && migratedProviders.length > 0) {\n this.showWarning(\n `Migrated credentials to auth.json: ${migratedProviders.join(\", \")}`,\n );\n }\n\n const modelsJsonError = this.session.modelRegistry.getError();\n if (modelsJsonError) {\n this.showError(`models.json error: ${modelsJsonError}`);\n }\n\n if (modelFallbackMessage && !this.deferredStartupPending) {\n this.showWarning(modelFallbackMessage, this.startupNoticesContainer);\n }\n\n // CLI-provided startup prompts need extension tools/resources; wait before sending them,\n // but do not block the normal no-prompt input loop from becoming ready.\n if (this.deferredStartupPending && (initialMessage || (initialMessages && initialMessages.length > 0))) {\n await this.ensureDeferredStartupComplete();\n }\n\n // Process initial messages\n if (initialMessage) {\n try {\n await this.session.prompt(initialMessage, { images: initialImages });\n } catch (error: unknown) {\n const errorMessage =\n error instanceof Error ? error.message : \"Unknown error occurred\";\n this.showError(errorMessage);\n }\n }\n\n if (initialMessages) {\n for (const message of initialMessages) {\n try {\n await this.session.prompt(message);\n } catch (error: unknown) {\n const errorMessage =\n error instanceof Error ? error.message : \"Unknown error occurred\";\n this.showError(errorMessage);\n }\n }\n }\n\n // Main interactive loop\n while (true) {\n const userInput = await this.getUserInput();\n await this.runUserPromptTurn(userInput);\n }\n };\n\nInteractiveModeBase.prototype.checkForPackageUpdates = async function(this: InteractiveModeBase): Promise<string[]> {\n if (getEnvValue(ENV_OFFLINE)) {\n return [];\n }\n\n try {\n const packageManager = new DefaultPackageManager({\n cwd: this.sessionManager.getCwd(),\n agentDir: getAgentDir(),\n settingsManager: this.settingsManager,\n });\n const updates = await packageManager.checkForAvailableUpdates();\n return updates.map((update) => update.displayName);\n } catch {\n return [];\n }\n };\n\nInteractiveModeBase.prototype.checkTmuxKeyboardSetup = async function(this: InteractiveModeBase): Promise<string | undefined> {\n if (!process.env.TMUX) return undefined;\n\n const runTmuxShow = (option: string): Promise<string | undefined> => {\n return new Promise((resolve) => {\n const proc = spawn(\"tmux\", [\"show\", \"-gv\", option], {\n stdio: [\"ignore\", \"pipe\", \"ignore\"],\n });\n let stdout = \"\";\n const timer = setTimeout(() => {\n proc.kill();\n resolve(undefined);\n }, 2000);\n\n proc.stdout?.on(\"data\", (data) => {\n stdout += data.toString();\n });\n proc.on(\"error\", () => {\n clearTimeout(timer);\n resolve(undefined);\n });\n proc.on(\"close\", (code) => {\n clearTimeout(timer);\n resolve(code === 0 ? stdout.trim() : undefined);\n });\n });\n };\n\n const [extendedKeys, extendedKeysFormat] = await Promise.all([\n runTmuxShow(\"extended-keys\"),\n runTmuxShow(\"extended-keys-format\"),\n ]);\n\n // If we couldn't query tmux (timeout, sandbox, etc.), don't warn\n if (extendedKeys === undefined) return undefined;\n\n if (extendedKeys !== \"on\" && extendedKeys !== \"always\") {\n return \"tmux extended-keys is off. Modified enter keys may not work. Add `set -g extended-keys on` to ~/.tmux.conf and restart tmux.\";\n }\n\n if (extendedKeysFormat === \"xterm\") {\n return \"tmux extended-keys-format is xterm. Pi works best with csi-u. Add `set -g extended-keys-format csi-u` to ~/.tmux.conf and restart tmux.\";\n }\n\n return undefined;\n };\n\nInteractiveModeBase.prototype.getChangelogForDisplay = function(this: InteractiveModeBase): string | undefined {\n // Skip changelog for resumed/continued sessions (already have messages)\n if (this.session.state.messages.length > 0) {\n return undefined;\n }\n\n const lastVersion = this.settingsManager.getLastChangelogVersion();\n const changelogPath = getChangelogPath();\n const entries = parseChangelog(changelogPath);\n\n if (!lastVersion) {\n // Fresh install - record the version, send telemetry, don't show changelog\n this.settingsManager.setLastChangelogVersion(VERSION);\n this.reportInstallTelemetry(VERSION);\n return undefined;\n }\n\n const newEntries = getNewEntries(entries, lastVersion, VERSION);\n const currentEntries = getEntriesForVersion(newEntries, VERSION);\n if (currentEntries.length > 0) {\n this.settingsManager.setLastChangelogVersion(VERSION);\n this.reportInstallTelemetry(VERSION);\n return currentEntries.map((e) => normalizeChangelogLinks(e.content, e)).join(\"\\n\\n\");\n }\n\n return undefined;\n };\n\nInteractiveModeBase.prototype.reportInstallTelemetry = function(this: InteractiveModeBase, version: string): void {\n if (getEnvValue(ENV_OFFLINE)) {\n return;\n }\n\n if (!isInstallTelemetryEnabled(this.settingsManager)) {\n return;\n }\n\n void fetch(\n `https://pi.dev/api/report-install?version=${encodeURIComponent(version)}`,\n {\n headers: {\n \"User-Agent\": getPiUserAgent(version),\n },\n signal: AbortSignal.timeout(5000),\n },\n )\n .then(() => undefined)\n .catch(() => undefined);\n };\n\nInteractiveModeBase.prototype.getMarkdownThemeWithSettings = function(this: InteractiveModeBase): MarkdownTheme {\n return {\n ...getMarkdownTheme(),\n codeBlockIndent: this.settingsManager.getCodeBlockIndent(),\n };\n };\n\nInteractiveModeBase.prototype.formatDisplayPath = function(this: InteractiveModeBase, p: string): string {\n const home = os.homedir();\n let result = p;\n\n // Replace home directory with ~\n if (result.startsWith(home)) {\n result = `~${result.slice(home.length)}`;\n }\n\n return result;\n };\n\nInteractiveModeBase.prototype.formatExtensionDisplayPath = function(this: InteractiveModeBase, path: string): string {\n let result = this.formatDisplayPath(path);\n result = result.replace(/\\/index\\.ts$/, \"\").replace(/\\/index\\.js$/, \"\");\n return result;\n };\n\nInteractiveModeBase.prototype.formatContextPath = function(this: InteractiveModeBase, p: string): string {\n const cwd = path.resolve(this.sessionManager.getCwd());\n const absolutePath = path.isAbsolute(p)\n ? path.resolve(p)\n : path.resolve(cwd, p);\n const relativePath = getCwdRelativePath(absolutePath, cwd);\n if (relativePath !== undefined) {\n return relativePath;\n }\n\n return this.formatDisplayPath(absolutePath);\n };\n\nInteractiveModeBase.prototype.getStartupModelLabel = function(this: InteractiveModeBase): string {\n const model = this.session.state.model;\n let modelLabel = model?.id ?? \"no-model\";\n\n if (model?.reasoning) {\n modelLabel = `${modelLabel} ${this.session.thinkingLevel || \"off\"}`;\n }\n\n if (!model) {\n return modelLabel;\n }\n\n const fastModeEnabled = shouldApplyCodexFastMode(\n model,\n this.session.settingsManager.getCodexFastModeSettings(),\n this.session.orchestrationContext,\n );\n return formatCodexFastModeModelLabel(modelLabel, fastModeEnabled);\n };\n\nInteractiveModeBase.prototype.getStartupIdentityText = function(this: InteractiveModeBase): string {\n const appLabel = APP_NAME.length > 0\n ? `${APP_NAME[0]!.toUpperCase()}${APP_NAME.slice(1)}`\n : \"Atomic\";\n const title = `${theme.bold(theme.fg(\"text\", appLabel))} ${theme.fg(\"muted\", `v${this.version}`)}`;\n const model = this.session.state.model;\n const provider = model ? theme.fg(\"dim\", `(${model.provider})`) : theme.fg(\"dim\", \"(no-provider)\");\n const modelLine = `${provider} ${theme.fg(\"muted\", this.getStartupModelLabel())}`;\n const cwd = theme.fg(\"muted\", this.formatDisplayPath(this.sessionManager.getCwd()));\n const metaLines = [title, modelLine, cwd];\n const markLines = this.getAtomicAnsiMarkLines();\n\n return markLines\n .map((line, index) => `${line} ${metaLines[index] ?? \"\"}`.trimEnd())\n .join(\"\\n\");\n };\n\nInteractiveModeBase.prototype.getAtomicAnsiMarkLines = function(this: InteractiveModeBase): string[] {\n return renderAtomicAnsiBanner(theme, this.session.thinkingLevel || \"off\");\n };\n\nInteractiveModeBase.prototype.getStartupExpansionState = function(this: InteractiveModeBase): boolean {\n return this.options.verbose || this.toolOutputExpanded;\n };\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InteractiveModeBase } from "./interactive-mode-base.js";
|
|
1
|
+
import { InteractiveModeBase, seedStartupInput } from "./interactive-mode-base.js";
|
|
2
2
|
import { os, path, Markdown, Spacer, Text, spawn, APP_NAME, APP_TITLE, ENV_OFFLINE, getEnvValue, getAgentDir, VERSION, formatCodexFastModeModelLabel, shouldApplyCodexFastMode, DefaultPackageManager, isInstallTelemetryEnabled, getChangelogPath, getEntriesForVersion, getNewEntries, normalizeChangelogLinks, parseChangelog, getCwdRelativePath, getPiUserAgent, recordTimeSinceReset, ensureTool, checkForNewPiVersion, renderAtomicAnsiBanner, DynamicBorder, getMarkdownTheme, onThemeChange, theme } from "./interactive-mode-deps.js";
|
|
3
3
|
import { ExpandableText } from "./interactive-mode-helpers.js";
|
|
4
4
|
import { ONBOARDING_COPY } from "./interactive-onboarding.js";
|
|
@@ -76,6 +76,11 @@ InteractiveModeBase.prototype.init = async function () {
|
|
|
76
76
|
this.setupKeyHandlers();
|
|
77
77
|
this.setupEditorSubmitHandler();
|
|
78
78
|
this.firstRunNoticeVisible = this.isFirstRunOnboardingEligible();
|
|
79
|
+
seedStartupInput(this.pendingUserInputs, this.defaultEditor, this.options.startupInputCapture?.consume(), this.startupReplayInputs, (text) => {
|
|
80
|
+
this.startupDraftText = text;
|
|
81
|
+
}, (text) => {
|
|
82
|
+
this.startupReplayActiveInput = text;
|
|
83
|
+
});
|
|
79
84
|
// Start the UI before initializing extensions so session_start handlers can use interactive dialogs.
|
|
80
85
|
// fd/rg readiness is intentionally checked after first paint because ensureTool may spawn
|
|
81
86
|
// or download tools on cold machines.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-startup.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-startup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBA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C,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;IACnG,MAAM,SAAS,GAAG,GAAG,QAAQ,IAAI,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,oBAAoB,EAAE,CAAC,EAAE,CAAC;IAClF,MAAM,GAAG,GAAG,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACpF,MAAM,SAAS,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;IAC1C,MAAM,SAAS,GAAG,IAAI,CAAC,sBAAsB,EAAE,CAAC;IAEhD,OAAO,SAAS;SACb,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,IAAI,KAAK,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,EAAE,CAAC;SACpE,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC,CAAC;AAEJ,mBAAmB,CAAC,SAAS,CAAC,sBAAsB,GAAG;IACnD,OAAO,sBAAsB,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,aAAa,IAAI,KAAK,CAAC,CAAC;AAC5E,CAAC,CAAC;AAEJ,mBAAmB,CAAC,SAAS,CAAC,wBAAwB,GAAG;IACrD,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,IAAI,CAAC,kBAAkB,CAAC;AACzD,CAAC,CAAC","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { type Container, type MarkdownTheme, os, path, Markdown, Spacer, Text, spawn, APP_NAME, APP_TITLE, ENV_OFFLINE, getEnvValue, getAgentDir, VERSION, formatCodexFastModeModelLabel, shouldApplyCodexFastMode, DefaultPackageManager, isInstallTelemetryEnabled, getChangelogPath, getEntriesForVersion, getNewEntries, normalizeChangelogLinks, parseChangelog, getCwdRelativePath, getPiUserAgent, recordTimeSinceReset, ensureTool, checkForNewPiVersion, renderAtomicAnsiBanner, DynamicBorder, getMarkdownTheme, onThemeChange, theme } from \"./interactive-mode-deps.ts\";\nimport { ExpandableText } from \"./interactive-mode-helpers.ts\";\nimport { ONBOARDING_COPY } from \"./interactive-onboarding.ts\";\n\nInteractiveModeBase.prototype.showStartupNoticesIfNeeded = function(this: InteractiveModeBase, targetContainer: Container = this.chatContainer): void {\n if (this.startupNoticesShown) {\n return;\n }\n this.startupNoticesShown = true;\n\n const changelogMarkdown = this.changelogMarkdown;\n if (!changelogMarkdown && !this.firstRunNoticeVisible) {\n return;\n }\n\n if (changelogMarkdown) {\n if (targetContainer.children.length > 0) {\n targetContainer.addChild(new Spacer(1));\n }\n targetContainer.addChild(new DynamicBorder());\n if (this.settingsManager.getCollapseChangelog()) {\n const versionMatch = changelogMarkdown.match(\n /##\\s+\\[?((?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)(?:-(?:alpha\\.)?(?:0|[1-9]\\d*))?)\\]?/,\n );\n const latestVersion = versionMatch ? versionMatch[1] : this.version;\n const condensedText = `Updated to v${latestVersion}. Use ${theme.bold(\"/changelog\")} to view full changelog.`;\n targetContainer.addChild(new Text(condensedText, 1, 0));\n } else {\n targetContainer.addChild(\n new Text(theme.bold(theme.fg(\"accent\", \"What's New\")), 1, 0),\n );\n targetContainer.addChild(new Spacer(1));\n targetContainer.addChild(\n new Markdown(\n changelogMarkdown.trim(),\n 1,\n 0,\n this.getMarkdownThemeWithSettings(),\n ),\n );\n targetContainer.addChild(new Spacer(1));\n }\n targetContainer.addChild(new DynamicBorder());\n }\n\n if (this.firstRunNoticeVisible) {\n this.firstRunOnboardingNoticeComponents = [];\n if (targetContainer.children.length > 0) {\n this.firstRunOnboardingNoticeComponents.push(new Spacer(1));\n }\n this.firstRunOnboardingNoticeComponents.push(\n new DynamicBorder(),\n new Text(ONBOARDING_COPY, 1, 0),\n new DynamicBorder(),\n new Spacer(1),\n );\n for (const component of this.firstRunOnboardingNoticeComponents) {\n targetContainer.addChild(component);\n }\n // Mark completion only after queueing the notice in the chat canvas so\n // launches that skip rendering retry the first-run notice next time.\n this.settingsManager.setOnboardedVersion(this.version);\n }\n\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.init = async function(this: InteractiveModeBase): Promise<void> {\n if (this.isInitialized) return;\n\n this.registerSignalHandlers();\n\n // Load changelog (only show new entries, skip for resumed sessions)\n this.hadLastChangelogVersionAtStartup = Boolean(this.settingsManager.getLastChangelogVersion());\n this.changelogMarkdown = this.getChangelogForDisplay();\n this.initializeFirstRunOnboardingMarkers();\n\n // Add header container as first child. Populate it after theme initialization.\n this.ui.addChild(this.headerContainer);\n\n this.ui.addChild(this.chatContainer);\n this.ui.addChild(this.pendingMessagesContainer);\n this.ui.addChild(this.statusContainer);\n this.renderWidgets(); // Initialize with default spacer\n this.ui.addChild(this.widgetContainerAbove);\n this.ui.addChild(this.usageMeter);\n this.ui.addChild(this.editorContainer);\n // Footer (persistent model + cwd identity) stays pinned directly under the\n // editor; below-editor widgets render after it, at the very bottom. This\n // keeps the session identity line attached to the input and places\n // transient run status (e.g. the workflow companion counter) beneath it.\n // Rendering below-editor widgets last also keeps a live widget at the\n // absolute bottom of the buffer (always within the viewport), so its\n // per-tick updates never sit above the fold — preserving the #1109\n // resize-flicker fix.\n this.ui.addChild(this.footer);\n this.ui.addChild(this.widgetContainerBelow);\n this.ui.setFocus(this.editor);\n\n this.setupKeyHandlers();\n this.setupEditorSubmitHandler();\n\n this.firstRunNoticeVisible = this.isFirstRunOnboardingEligible();\n\n // Start the UI before initializing extensions so session_start handlers can use interactive dialogs.\n // fd/rg readiness is intentionally checked after first paint because ensureTool may spawn\n // or download tools on cold machines.\n this.ui.start();\n recordTimeSinceReset(\"time-to-first-frame\");\n this.isInitialized = true;\n\n await this.themeController.applyFromSettings();\n\n // Add the quiet startup identity (unless silenced). Resource details are\n // disclosed separately in the chat canvas via the tools/resources toggle.\n if (this.options.verbose || !this.settingsManager.getQuietStartup()) {\n this.builtInHeader = new ExpandableText(\n () => this.getStartupIdentityText(),\n () => this.getStartupIdentityText(),\n this.getStartupExpansionState(),\n 1,\n 0,\n );\n\n this.headerContainer.addChild(new Spacer(1));\n this.headerContainer.addChild(this.builtInHeader);\n this.headerContainer.addChild(new Spacer(1));\n } else {\n // Minimal header when silenced\n this.builtInHeader = new Text(\"\", 0, 0);\n this.headerContainer.addChild(this.builtInHeader);\n }\n this.ui.requestRender();\n\n void Promise.all([ensureTool(\"fd\"), ensureTool(\"rg\")])\n .then(([fdPath]) => {\n this.fdPath = fdPath;\n this.setupAutocompleteProvider();\n })\n .catch((error) => {\n const message = error instanceof Error ? error.message : String(error);\n console.error(`Tool readiness check failed: ${message}`);\n });\n\n // When startup resources are deferred, keep the already-painted editor responsive.\n // Extension UI bindings are installed at the deferred reload boundary, not here,\n // so no post-paint resource work can block visible typing.\n if (this.deferredStartupPending) {\n this.applyRuntimeSettings();\n this.subscribeToAgent();\n this.updateEditorBorderColor();\n this.updateTerminalTitle();\n } else {\n await this.rebindCurrentSession();\n }\n\n this.attachStartupNoticesContainer();\n // Render initial messages AFTER the initial session binding is in place.\n this.renderInitialMessages();\n\tif (this.deferredStartupPending) {\n\t\tsetTimeout(() => {\n\t\t\tif (!this.deferredStartupPending || this.deferredStartupPromise) return;\n\t\t\tvoid this.ensureDeferredStartupComplete();\n\t\t}, 2000);\n\t}\n // Set up theme file watcher\n onThemeChange(() => {\n this.ui.invalidate();\n this.updateEditorBorderColor();\n this.ui.requestRender();\n });\n\n // Set up git branch watcher (uses provider instead of footer)\n this.footerDataProvider.onBranchChange(() => {\n this.ui.requestRender();\n });\n\n // Initialize available provider count for footer display without delaying first-frame startup.\n void this.updateAvailableProviderCount().catch((error) => {\n const message = error instanceof Error ? error.message : String(error);\n console.error(`Failed to update provider count: ${message}`);\n });\n };\n\nInteractiveModeBase.prototype.updateTerminalTitle = function(this: InteractiveModeBase): void {\n const cwdBasename = path.basename(this.sessionManager.getCwd());\n const sessionName = this.sessionManager.getSessionName();\n if (sessionName) {\n this.ui.terminal.setTitle(\n `${APP_TITLE} - ${sessionName} - ${cwdBasename}`,\n );\n } else {\n this.ui.terminal.setTitle(`${APP_TITLE} - ${cwdBasename}`);\n }\n };\n\nInteractiveModeBase.prototype.run = async function(this: InteractiveModeBase): Promise<void> {\n await this.init();\n\n\tsetTimeout(() => {\n\t\tvoid this.refreshCopilotModelCatalog();\n const startupNoticesContainer = this.startupNoticesContainer;\n\t\tcheckForNewPiVersion(this.version).then((newVersion) => {\n\t\t\tif (newVersion) this.showNewVersionNotification(newVersion, startupNoticesContainer);\n\t\t});\n\t\tthis.checkForPackageUpdates().then((updates) => {\n\t\t\tif (updates.length > 0) this.showPackageUpdateNotification(updates, startupNoticesContainer);\n\t\t});\n\t\tthis.checkTmuxKeyboardSetup().then((warning) => {\n\t\t\tif (warning) this.showWarning(warning, startupNoticesContainer);\n\t\t});\n\t\t// When startup is deferred, the RESOURCES disclosure renders after the\n\t\t// deferred extension load; hold the subscription warning until then so\n\t\t// the disclosure always appears first.\n\t\tif (!this.deferredStartupPending && !this.deferredStartupPromise && !this.pendingLoadedResourcesDisclosure) {\n\t\t\tvoid this.maybeWarnAboutAnthropicSubscriptionAuth(undefined, startupNoticesContainer);\n\t\t}\n\t}, 500);\n\n // Show startup warnings\n const {\n migratedProviders,\n modelFallbackMessage,\n initialMessage,\n initialImages,\n initialMessages,\n } = this.options;\n\n if (migratedProviders && migratedProviders.length > 0) {\n this.showWarning(\n `Migrated credentials to auth.json: ${migratedProviders.join(\", \")}`,\n );\n }\n\n const modelsJsonError = this.session.modelRegistry.getError();\n if (modelsJsonError) {\n this.showError(`models.json error: ${modelsJsonError}`);\n }\n\n if (modelFallbackMessage && !this.deferredStartupPending) {\n this.showWarning(modelFallbackMessage, this.startupNoticesContainer);\n }\n\n // CLI-provided startup prompts need extension tools/resources; wait before sending them,\n // but do not block the normal no-prompt input loop from becoming ready.\n if (this.deferredStartupPending && (initialMessage || (initialMessages && initialMessages.length > 0))) {\n await this.ensureDeferredStartupComplete();\n }\n\n // Process initial messages\n if (initialMessage) {\n try {\n await this.session.prompt(initialMessage, { images: initialImages });\n } catch (error: unknown) {\n const errorMessage =\n error instanceof Error ? error.message : \"Unknown error occurred\";\n this.showError(errorMessage);\n }\n }\n\n if (initialMessages) {\n for (const message of initialMessages) {\n try {\n await this.session.prompt(message);\n } catch (error: unknown) {\n const errorMessage =\n error instanceof Error ? error.message : \"Unknown error occurred\";\n this.showError(errorMessage);\n }\n }\n }\n\n // Main interactive loop\n while (true) {\n const userInput = await this.getUserInput();\n await this.runUserPromptTurn(userInput);\n }\n };\n\nInteractiveModeBase.prototype.checkForPackageUpdates = async function(this: InteractiveModeBase): Promise<string[]> {\n if (getEnvValue(ENV_OFFLINE)) {\n return [];\n }\n\n try {\n const packageManager = new DefaultPackageManager({\n cwd: this.sessionManager.getCwd(),\n agentDir: getAgentDir(),\n settingsManager: this.settingsManager,\n });\n const updates = await packageManager.checkForAvailableUpdates();\n return updates.map((update) => update.displayName);\n } catch {\n return [];\n }\n };\n\nInteractiveModeBase.prototype.checkTmuxKeyboardSetup = async function(this: InteractiveModeBase): Promise<string | undefined> {\n if (!process.env.TMUX) return undefined;\n\n const runTmuxShow = (option: string): Promise<string | undefined> => {\n return new Promise((resolve) => {\n const proc = spawn(\"tmux\", [\"show\", \"-gv\", option], {\n stdio: [\"ignore\", \"pipe\", \"ignore\"],\n });\n let stdout = \"\";\n const timer = setTimeout(() => {\n proc.kill();\n resolve(undefined);\n }, 2000);\n\n proc.stdout?.on(\"data\", (data) => {\n stdout += data.toString();\n });\n proc.on(\"error\", () => {\n clearTimeout(timer);\n resolve(undefined);\n });\n proc.on(\"close\", (code) => {\n clearTimeout(timer);\n resolve(code === 0 ? stdout.trim() : undefined);\n });\n });\n };\n\n const [extendedKeys, extendedKeysFormat] = await Promise.all([\n runTmuxShow(\"extended-keys\"),\n runTmuxShow(\"extended-keys-format\"),\n ]);\n\n // If we couldn't query tmux (timeout, sandbox, etc.), don't warn\n if (extendedKeys === undefined) return undefined;\n\n if (extendedKeys !== \"on\" && extendedKeys !== \"always\") {\n return \"tmux extended-keys is off. Modified enter keys may not work. Add `set -g extended-keys on` to ~/.tmux.conf and restart tmux.\";\n }\n\n if (extendedKeysFormat === \"xterm\") {\n return \"tmux extended-keys-format is xterm. Pi works best with csi-u. Add `set -g extended-keys-format csi-u` to ~/.tmux.conf and restart tmux.\";\n }\n\n return undefined;\n };\n\nInteractiveModeBase.prototype.getChangelogForDisplay = function(this: InteractiveModeBase): string | undefined {\n // Skip changelog for resumed/continued sessions (already have messages)\n if (this.session.state.messages.length > 0) {\n return undefined;\n }\n\n const lastVersion = this.settingsManager.getLastChangelogVersion();\n const changelogPath = getChangelogPath();\n const entries = parseChangelog(changelogPath);\n\n if (!lastVersion) {\n // Fresh install - record the version, send telemetry, don't show changelog\n this.settingsManager.setLastChangelogVersion(VERSION);\n this.reportInstallTelemetry(VERSION);\n return undefined;\n }\n\n const newEntries = getNewEntries(entries, lastVersion, VERSION);\n const currentEntries = getEntriesForVersion(newEntries, VERSION);\n if (currentEntries.length > 0) {\n this.settingsManager.setLastChangelogVersion(VERSION);\n this.reportInstallTelemetry(VERSION);\n return currentEntries.map((e) => normalizeChangelogLinks(e.content, e)).join(\"\\n\\n\");\n }\n\n return undefined;\n };\n\nInteractiveModeBase.prototype.reportInstallTelemetry = function(this: InteractiveModeBase, version: string): void {\n if (getEnvValue(ENV_OFFLINE)) {\n return;\n }\n\n if (!isInstallTelemetryEnabled(this.settingsManager)) {\n return;\n }\n\n void fetch(\n `https://pi.dev/api/report-install?version=${encodeURIComponent(version)}`,\n {\n headers: {\n \"User-Agent\": getPiUserAgent(version),\n },\n signal: AbortSignal.timeout(5000),\n },\n )\n .then(() => undefined)\n .catch(() => undefined);\n };\n\nInteractiveModeBase.prototype.getMarkdownThemeWithSettings = function(this: InteractiveModeBase): MarkdownTheme {\n return {\n ...getMarkdownTheme(),\n codeBlockIndent: this.settingsManager.getCodeBlockIndent(),\n };\n };\n\nInteractiveModeBase.prototype.formatDisplayPath = function(this: InteractiveModeBase, p: string): string {\n const home = os.homedir();\n let result = p;\n\n // Replace home directory with ~\n if (result.startsWith(home)) {\n result = `~${result.slice(home.length)}`;\n }\n\n return result;\n };\n\nInteractiveModeBase.prototype.formatExtensionDisplayPath = function(this: InteractiveModeBase, path: string): string {\n let result = this.formatDisplayPath(path);\n result = result.replace(/\\/index\\.ts$/, \"\").replace(/\\/index\\.js$/, \"\");\n return result;\n };\n\nInteractiveModeBase.prototype.formatContextPath = function(this: InteractiveModeBase, p: string): string {\n const cwd = path.resolve(this.sessionManager.getCwd());\n const absolutePath = path.isAbsolute(p)\n ? path.resolve(p)\n : path.resolve(cwd, p);\n const relativePath = getCwdRelativePath(absolutePath, cwd);\n if (relativePath !== undefined) {\n return relativePath;\n }\n\n return this.formatDisplayPath(absolutePath);\n };\n\nInteractiveModeBase.prototype.getStartupModelLabel = function(this: InteractiveModeBase): string {\n const model = this.session.state.model;\n let modelLabel = model?.id ?? \"no-model\";\n\n if (model?.reasoning) {\n modelLabel = `${modelLabel} ${this.session.thinkingLevel || \"off\"}`;\n }\n\n if (!model) {\n return modelLabel;\n }\n\n const fastModeEnabled = shouldApplyCodexFastMode(\n model,\n this.session.settingsManager.getCodexFastModeSettings(),\n this.session.orchestrationContext,\n );\n return formatCodexFastModeModelLabel(modelLabel, fastModeEnabled);\n };\n\nInteractiveModeBase.prototype.getStartupIdentityText = function(this: InteractiveModeBase): string {\n const appLabel = APP_NAME.length > 0\n ? `${APP_NAME[0]!.toUpperCase()}${APP_NAME.slice(1)}`\n : \"Atomic\";\n const title = `${theme.bold(theme.fg(\"text\", appLabel))} ${theme.fg(\"muted\", `v${this.version}`)}`;\n const model = this.session.state.model;\n const provider = model ? theme.fg(\"dim\", `(${model.provider})`) : theme.fg(\"dim\", \"(no-provider)\");\n const modelLine = `${provider} ${theme.fg(\"muted\", this.getStartupModelLabel())}`;\n const cwd = theme.fg(\"muted\", this.formatDisplayPath(this.sessionManager.getCwd()));\n const metaLines = [title, modelLine, cwd];\n const markLines = this.getAtomicAnsiMarkLines();\n\n return markLines\n .map((line, index) => `${line} ${metaLines[index] ?? \"\"}`.trimEnd())\n .join(\"\\n\");\n };\n\nInteractiveModeBase.prototype.getAtomicAnsiMarkLines = function(this: InteractiveModeBase): string[] {\n return renderAtomicAnsiBanner(theme, this.session.thinkingLevel || \"off\");\n };\n\nInteractiveModeBase.prototype.getStartupExpansionState = function(this: InteractiveModeBase): boolean {\n return this.options.verbose || this.toolOutputExpanded;\n };\n"]}
|
|
1
|
+
{"version":3,"file":"interactive-startup.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-startup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnF,OAAO,EAAsC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,6BAA6B,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,aAAa,EAAE,uBAAuB,EAAE,cAAc,EAAE,kBAAkB,EAAE,cAAc,EAAE,oBAAoB,EAAE,UAAU,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,aAAa,EAAE,gBAAgB,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACpjB,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,mBAAmB,CAAC,SAAS,CAAC,0BAA0B,GAAG,UAAoC,eAAe,GAAc,IAAI,CAAC,a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AC,CAAC;IACpF,MAAM,SAAS,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;IAC1C,MAAM,SAAS,GAAG,IAAI,CAAC,sBAAsB,EAAE,CAAC;IAEhD,OAAO,SAAS;SACb,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,IAAI,KAAK,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,EAAE,CAAC;SACpE,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC,CAAC;AAEJ,mBAAmB,CAAC,SAAS,CAAC,sBAAsB,GAAG;IACnD,OAAO,sBAAsB,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,aAAa,IAAI,KAAK,CAAC,CAAC;AAC5E,CAAC,CAAC;AAEJ,mBAAmB,CAAC,SAAS,CAAC,wBAAwB,GAAG;IACrD,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,IAAI,CAAC,kBAAkB,CAAC;AACzD,CAAC,CAAC","sourcesContent":["import { InteractiveModeBase, seedStartupInput } from \"./interactive-mode-base.ts\";\nimport { type Container, type MarkdownTheme, os, path, Markdown, Spacer, Text, spawn, APP_NAME, APP_TITLE, ENV_OFFLINE, getEnvValue, getAgentDir, VERSION, formatCodexFastModeModelLabel, shouldApplyCodexFastMode, DefaultPackageManager, isInstallTelemetryEnabled, getChangelogPath, getEntriesForVersion, getNewEntries, normalizeChangelogLinks, parseChangelog, getCwdRelativePath, getPiUserAgent, recordTimeSinceReset, ensureTool, checkForNewPiVersion, renderAtomicAnsiBanner, DynamicBorder, getMarkdownTheme, onThemeChange, theme } from \"./interactive-mode-deps.ts\";\nimport { ExpandableText } from \"./interactive-mode-helpers.ts\";\nimport { ONBOARDING_COPY } from \"./interactive-onboarding.ts\";\n\nInteractiveModeBase.prototype.showStartupNoticesIfNeeded = function(this: InteractiveModeBase, targetContainer: Container = this.chatContainer): void {\n if (this.startupNoticesShown) {\n return;\n }\n this.startupNoticesShown = true;\n\n const changelogMarkdown = this.changelogMarkdown;\n if (!changelogMarkdown && !this.firstRunNoticeVisible) {\n return;\n }\n\n if (changelogMarkdown) {\n if (targetContainer.children.length > 0) {\n targetContainer.addChild(new Spacer(1));\n }\n targetContainer.addChild(new DynamicBorder());\n if (this.settingsManager.getCollapseChangelog()) {\n const versionMatch = changelogMarkdown.match(\n /##\\s+\\[?((?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)(?:-(?:alpha\\.)?(?:0|[1-9]\\d*))?)\\]?/,\n );\n const latestVersion = versionMatch ? versionMatch[1] : this.version;\n const condensedText = `Updated to v${latestVersion}. Use ${theme.bold(\"/changelog\")} to view full changelog.`;\n targetContainer.addChild(new Text(condensedText, 1, 0));\n } else {\n targetContainer.addChild(\n new Text(theme.bold(theme.fg(\"accent\", \"What's New\")), 1, 0),\n );\n targetContainer.addChild(new Spacer(1));\n targetContainer.addChild(\n new Markdown(\n changelogMarkdown.trim(),\n 1,\n 0,\n this.getMarkdownThemeWithSettings(),\n ),\n );\n targetContainer.addChild(new Spacer(1));\n }\n targetContainer.addChild(new DynamicBorder());\n }\n\n if (this.firstRunNoticeVisible) {\n this.firstRunOnboardingNoticeComponents = [];\n if (targetContainer.children.length > 0) {\n this.firstRunOnboardingNoticeComponents.push(new Spacer(1));\n }\n this.firstRunOnboardingNoticeComponents.push(\n new DynamicBorder(),\n new Text(ONBOARDING_COPY, 1, 0),\n new DynamicBorder(),\n new Spacer(1),\n );\n for (const component of this.firstRunOnboardingNoticeComponents) {\n targetContainer.addChild(component);\n }\n // Mark completion only after queueing the notice in the chat canvas so\n // launches that skip rendering retry the first-run notice next time.\n this.settingsManager.setOnboardedVersion(this.version);\n }\n\n this.ui.requestRender();\n };\n\nInteractiveModeBase.prototype.init = async function(this: InteractiveModeBase): Promise<void> {\n if (this.isInitialized) return;\n\n this.registerSignalHandlers();\n\n // Load changelog (only show new entries, skip for resumed sessions)\n this.hadLastChangelogVersionAtStartup = Boolean(this.settingsManager.getLastChangelogVersion());\n this.changelogMarkdown = this.getChangelogForDisplay();\n this.initializeFirstRunOnboardingMarkers();\n\n // Add header container as first child. Populate it after theme initialization.\n this.ui.addChild(this.headerContainer);\n\n this.ui.addChild(this.chatContainer);\n this.ui.addChild(this.pendingMessagesContainer);\n this.ui.addChild(this.statusContainer);\n this.renderWidgets(); // Initialize with default spacer\n this.ui.addChild(this.widgetContainerAbove);\n this.ui.addChild(this.usageMeter);\n this.ui.addChild(this.editorContainer);\n // Footer (persistent model + cwd identity) stays pinned directly under the\n // editor; below-editor widgets render after it, at the very bottom. This\n // keeps the session identity line attached to the input and places\n // transient run status (e.g. the workflow companion counter) beneath it.\n // Rendering below-editor widgets last also keeps a live widget at the\n // absolute bottom of the buffer (always within the viewport), so its\n // per-tick updates never sit above the fold — preserving the #1109\n // resize-flicker fix.\n this.ui.addChild(this.footer);\n this.ui.addChild(this.widgetContainerBelow);\n this.ui.setFocus(this.editor);\n\n this.setupKeyHandlers();\n this.setupEditorSubmitHandler();\n\n this.firstRunNoticeVisible = this.isFirstRunOnboardingEligible();\n\n seedStartupInput(\n this.pendingUserInputs,\n this.defaultEditor,\n this.options.startupInputCapture?.consume(),\n this.startupReplayInputs,\n (text) => {\n this.startupDraftText = text;\n },\n (text) => {\n this.startupReplayActiveInput = text;\n },\n );\n\n // Start the UI before initializing extensions so session_start handlers can use interactive dialogs.\n // fd/rg readiness is intentionally checked after first paint because ensureTool may spawn\n // or download tools on cold machines.\n this.ui.start();\n recordTimeSinceReset(\"time-to-first-frame\");\n this.isInitialized = true;\n\n await this.themeController.applyFromSettings();\n\n // Add the quiet startup identity (unless silenced). Resource details are\n // disclosed separately in the chat canvas via the tools/resources toggle.\n if (this.options.verbose || !this.settingsManager.getQuietStartup()) {\n this.builtInHeader = new ExpandableText(\n () => this.getStartupIdentityText(),\n () => this.getStartupIdentityText(),\n this.getStartupExpansionState(),\n 1,\n 0,\n );\n\n this.headerContainer.addChild(new Spacer(1));\n this.headerContainer.addChild(this.builtInHeader);\n this.headerContainer.addChild(new Spacer(1));\n } else {\n // Minimal header when silenced\n this.builtInHeader = new Text(\"\", 0, 0);\n this.headerContainer.addChild(this.builtInHeader);\n }\n this.ui.requestRender();\n\n void Promise.all([ensureTool(\"fd\"), ensureTool(\"rg\")])\n .then(([fdPath]) => {\n this.fdPath = fdPath;\n this.setupAutocompleteProvider();\n })\n .catch((error) => {\n const message = error instanceof Error ? error.message : String(error);\n console.error(`Tool readiness check failed: ${message}`);\n });\n\n // When startup resources are deferred, keep the already-painted editor responsive.\n // Extension UI bindings are installed at the deferred reload boundary, not here,\n // so no post-paint resource work can block visible typing.\n if (this.deferredStartupPending) {\n this.applyRuntimeSettings();\n this.subscribeToAgent();\n this.updateEditorBorderColor();\n this.updateTerminalTitle();\n } else {\n await this.rebindCurrentSession();\n }\n\n this.attachStartupNoticesContainer();\n // Render initial messages AFTER the initial session binding is in place.\n this.renderInitialMessages();\n\tif (this.deferredStartupPending) {\n\t\tsetTimeout(() => {\n\t\t\tif (!this.deferredStartupPending || this.deferredStartupPromise) return;\n\t\t\tvoid this.ensureDeferredStartupComplete();\n\t\t}, 2000);\n\t}\n // Set up theme file watcher\n onThemeChange(() => {\n this.ui.invalidate();\n this.updateEditorBorderColor();\n this.ui.requestRender();\n });\n\n // Set up git branch watcher (uses provider instead of footer)\n this.footerDataProvider.onBranchChange(() => {\n this.ui.requestRender();\n });\n\n // Initialize available provider count for footer display without delaying first-frame startup.\n void this.updateAvailableProviderCount().catch((error) => {\n const message = error instanceof Error ? error.message : String(error);\n console.error(`Failed to update provider count: ${message}`);\n });\n };\n\nInteractiveModeBase.prototype.updateTerminalTitle = function(this: InteractiveModeBase): void {\n const cwdBasename = path.basename(this.sessionManager.getCwd());\n const sessionName = this.sessionManager.getSessionName();\n if (sessionName) {\n this.ui.terminal.setTitle(\n `${APP_TITLE} - ${sessionName} - ${cwdBasename}`,\n );\n } else {\n this.ui.terminal.setTitle(`${APP_TITLE} - ${cwdBasename}`);\n }\n };\n\nInteractiveModeBase.prototype.run = async function(this: InteractiveModeBase): Promise<void> {\n await this.init();\n\n\tsetTimeout(() => {\n\t\tvoid this.refreshCopilotModelCatalog();\n const startupNoticesContainer = this.startupNoticesContainer;\n\t\tcheckForNewPiVersion(this.version).then((newVersion) => {\n\t\t\tif (newVersion) this.showNewVersionNotification(newVersion, startupNoticesContainer);\n\t\t});\n\t\tthis.checkForPackageUpdates().then((updates) => {\n\t\t\tif (updates.length > 0) this.showPackageUpdateNotification(updates, startupNoticesContainer);\n\t\t});\n\t\tthis.checkTmuxKeyboardSetup().then((warning) => {\n\t\t\tif (warning) this.showWarning(warning, startupNoticesContainer);\n\t\t});\n\t\t// When startup is deferred, the RESOURCES disclosure renders after the\n\t\t// deferred extension load; hold the subscription warning until then so\n\t\t// the disclosure always appears first.\n\t\tif (!this.deferredStartupPending && !this.deferredStartupPromise && !this.pendingLoadedResourcesDisclosure) {\n\t\t\tvoid this.maybeWarnAboutAnthropicSubscriptionAuth(undefined, startupNoticesContainer);\n\t\t}\n\t}, 500);\n\n // Show startup warnings\n const {\n migratedProviders,\n modelFallbackMessage,\n initialMessage,\n initialImages,\n initialMessages,\n } = this.options;\n\n if (migratedProviders && migratedProviders.length > 0) {\n this.showWarning(\n `Migrated credentials to auth.json: ${migratedProviders.join(\", \")}`,\n );\n }\n\n const modelsJsonError = this.session.modelRegistry.getError();\n if (modelsJsonError) {\n this.showError(`models.json error: ${modelsJsonError}`);\n }\n\n if (modelFallbackMessage && !this.deferredStartupPending) {\n this.showWarning(modelFallbackMessage, this.startupNoticesContainer);\n }\n\n // CLI-provided startup prompts need extension tools/resources; wait before sending them,\n // but do not block the normal no-prompt input loop from becoming ready.\n if (this.deferredStartupPending && (initialMessage || (initialMessages && initialMessages.length > 0))) {\n await this.ensureDeferredStartupComplete();\n }\n\n // Process initial messages\n if (initialMessage) {\n try {\n await this.session.prompt(initialMessage, { images: initialImages });\n } catch (error: unknown) {\n const errorMessage =\n error instanceof Error ? error.message : \"Unknown error occurred\";\n this.showError(errorMessage);\n }\n }\n\n if (initialMessages) {\n for (const message of initialMessages) {\n try {\n await this.session.prompt(message);\n } catch (error: unknown) {\n const errorMessage =\n error instanceof Error ? error.message : \"Unknown error occurred\";\n this.showError(errorMessage);\n }\n }\n }\n\n // Main interactive loop\n while (true) {\n const userInput = await this.getUserInput();\n await this.runUserPromptTurn(userInput);\n }\n };\n\nInteractiveModeBase.prototype.checkForPackageUpdates = async function(this: InteractiveModeBase): Promise<string[]> {\n if (getEnvValue(ENV_OFFLINE)) {\n return [];\n }\n\n try {\n const packageManager = new DefaultPackageManager({\n cwd: this.sessionManager.getCwd(),\n agentDir: getAgentDir(),\n settingsManager: this.settingsManager,\n });\n const updates = await packageManager.checkForAvailableUpdates();\n return updates.map((update) => update.displayName);\n } catch {\n return [];\n }\n };\n\nInteractiveModeBase.prototype.checkTmuxKeyboardSetup = async function(this: InteractiveModeBase): Promise<string | undefined> {\n if (!process.env.TMUX) return undefined;\n\n const runTmuxShow = (option: string): Promise<string | undefined> => {\n return new Promise((resolve) => {\n const proc = spawn(\"tmux\", [\"show\", \"-gv\", option], {\n stdio: [\"ignore\", \"pipe\", \"ignore\"],\n });\n let stdout = \"\";\n const timer = setTimeout(() => {\n proc.kill();\n resolve(undefined);\n }, 2000);\n\n proc.stdout?.on(\"data\", (data) => {\n stdout += data.toString();\n });\n proc.on(\"error\", () => {\n clearTimeout(timer);\n resolve(undefined);\n });\n proc.on(\"close\", (code) => {\n clearTimeout(timer);\n resolve(code === 0 ? stdout.trim() : undefined);\n });\n });\n };\n\n const [extendedKeys, extendedKeysFormat] = await Promise.all([\n runTmuxShow(\"extended-keys\"),\n runTmuxShow(\"extended-keys-format\"),\n ]);\n\n // If we couldn't query tmux (timeout, sandbox, etc.), don't warn\n if (extendedKeys === undefined) return undefined;\n\n if (extendedKeys !== \"on\" && extendedKeys !== \"always\") {\n return \"tmux extended-keys is off. Modified enter keys may not work. Add `set -g extended-keys on` to ~/.tmux.conf and restart tmux.\";\n }\n\n if (extendedKeysFormat === \"xterm\") {\n return \"tmux extended-keys-format is xterm. Pi works best with csi-u. Add `set -g extended-keys-format csi-u` to ~/.tmux.conf and restart tmux.\";\n }\n\n return undefined;\n };\n\nInteractiveModeBase.prototype.getChangelogForDisplay = function(this: InteractiveModeBase): string | undefined {\n // Skip changelog for resumed/continued sessions (already have messages)\n if (this.session.state.messages.length > 0) {\n return undefined;\n }\n\n const lastVersion = this.settingsManager.getLastChangelogVersion();\n const changelogPath = getChangelogPath();\n const entries = parseChangelog(changelogPath);\n\n if (!lastVersion) {\n // Fresh install - record the version, send telemetry, don't show changelog\n this.settingsManager.setLastChangelogVersion(VERSION);\n this.reportInstallTelemetry(VERSION);\n return undefined;\n }\n\n const newEntries = getNewEntries(entries, lastVersion, VERSION);\n const currentEntries = getEntriesForVersion(newEntries, VERSION);\n if (currentEntries.length > 0) {\n this.settingsManager.setLastChangelogVersion(VERSION);\n this.reportInstallTelemetry(VERSION);\n return currentEntries.map((e) => normalizeChangelogLinks(e.content, e)).join(\"\\n\\n\");\n }\n\n return undefined;\n };\n\nInteractiveModeBase.prototype.reportInstallTelemetry = function(this: InteractiveModeBase, version: string): void {\n if (getEnvValue(ENV_OFFLINE)) {\n return;\n }\n\n if (!isInstallTelemetryEnabled(this.settingsManager)) {\n return;\n }\n\n void fetch(\n `https://pi.dev/api/report-install?version=${encodeURIComponent(version)}`,\n {\n headers: {\n \"User-Agent\": getPiUserAgent(version),\n },\n signal: AbortSignal.timeout(5000),\n },\n )\n .then(() => undefined)\n .catch(() => undefined);\n };\n\nInteractiveModeBase.prototype.getMarkdownThemeWithSettings = function(this: InteractiveModeBase): MarkdownTheme {\n return {\n ...getMarkdownTheme(),\n codeBlockIndent: this.settingsManager.getCodeBlockIndent(),\n };\n };\n\nInteractiveModeBase.prototype.formatDisplayPath = function(this: InteractiveModeBase, p: string): string {\n const home = os.homedir();\n let result = p;\n\n // Replace home directory with ~\n if (result.startsWith(home)) {\n result = `~${result.slice(home.length)}`;\n }\n\n return result;\n };\n\nInteractiveModeBase.prototype.formatExtensionDisplayPath = function(this: InteractiveModeBase, path: string): string {\n let result = this.formatDisplayPath(path);\n result = result.replace(/\\/index\\.ts$/, \"\").replace(/\\/index\\.js$/, \"\");\n return result;\n };\n\nInteractiveModeBase.prototype.formatContextPath = function(this: InteractiveModeBase, p: string): string {\n const cwd = path.resolve(this.sessionManager.getCwd());\n const absolutePath = path.isAbsolute(p)\n ? path.resolve(p)\n : path.resolve(cwd, p);\n const relativePath = getCwdRelativePath(absolutePath, cwd);\n if (relativePath !== undefined) {\n return relativePath;\n }\n\n return this.formatDisplayPath(absolutePath);\n };\n\nInteractiveModeBase.prototype.getStartupModelLabel = function(this: InteractiveModeBase): string {\n const model = this.session.state.model;\n let modelLabel = model?.id ?? \"no-model\";\n\n if (model?.reasoning) {\n modelLabel = `${modelLabel} ${this.session.thinkingLevel || \"off\"}`;\n }\n\n if (!model) {\n return modelLabel;\n }\n\n const fastModeEnabled = shouldApplyCodexFastMode(\n model,\n this.session.settingsManager.getCodexFastModeSettings(),\n this.session.orchestrationContext,\n );\n return formatCodexFastModeModelLabel(modelLabel, fastModeEnabled);\n };\n\nInteractiveModeBase.prototype.getStartupIdentityText = function(this: InteractiveModeBase): string {\n const appLabel = APP_NAME.length > 0\n ? `${APP_NAME[0]!.toUpperCase()}${APP_NAME.slice(1)}`\n : \"Atomic\";\n const title = `${theme.bold(theme.fg(\"text\", appLabel))} ${theme.fg(\"muted\", `v${this.version}`)}`;\n const model = this.session.state.model;\n const provider = model ? theme.fg(\"dim\", `(${model.provider})`) : theme.fg(\"dim\", \"(no-provider)\");\n const modelLine = `${provider} ${theme.fg(\"muted\", this.getStartupModelLabel())}`;\n const cwd = theme.fg(\"muted\", this.formatDisplayPath(this.sessionManager.getCwd()));\n const metaLines = [title, modelLine, cwd];\n const markLines = this.getAtomicAnsiMarkLines();\n\n return markLines\n .map((line, index) => `${line} ${metaLines[index] ?? \"\"}`.trimEnd())\n .join(\"\\n\");\n };\n\nInteractiveModeBase.prototype.getAtomicAnsiMarkLines = function(this: InteractiveModeBase): string[] {\n return renderAtomicAnsiBanner(theme, this.session.thinkingLevel || \"off\");\n };\n\nInteractiveModeBase.prototype.getStartupExpansionState = function(this: InteractiveModeBase): boolean {\n return this.options.verbose || this.toolOutputExpanded;\n };\n"]}
|
package/docs/compaction.md
CHANGED
|
@@ -108,6 +108,8 @@ You can also trigger compaction manually with `/compact`. Custom summary instruc
|
|
|
108
108
|
|
|
109
109
|
If auto-compaction runs while a turn still has queued work (for example a failed tool-call result or a follow-up queued during compaction), Atomic resumes through the same continuation lifecycle as a normal queued turn: provider retry handling runs, additional queued messages drain, and any post-compaction resume failure is surfaced instead of being swallowed silently.
|
|
110
110
|
|
|
111
|
+
For provider-overflow recovery that succeeds with `willRetry: true`, the public `AgentSession.prompt()` promise remains pending until the post-compaction retry continuation has run through the normal continuation lifecycle. If that continuation exhausts the one compact-and-retry attempt and emits `compaction_end` with `unresolvedOverflow: true`, workflow callers can observe the signal before deciding whether the prompt succeeded or should advance model fallback.
|
|
112
|
+
|
|
111
113
|
### Image Context and Compaction
|
|
112
114
|
|
|
113
115
|
Image content blocks (screenshots, pasted images, image-bearing tool results) are expensive: providers fold image tokens into their reported prompt/input usage, so image-heavy conversations reach the compaction threshold sooner. Atomic accounts for this in two complementary ways:
|
|
@@ -558,6 +560,8 @@ ValidatedContextDeletionResult
|
|
|
558
560
|
| Planner run reaches its 50 real provider-turn cap | No additional provider calls are made for that planner run | The runner evaluates the validated deletions recorded so far against the current tier's acceptance rule, then either escalates or fails terminally with achieved stats |
|
|
559
561
|
| Planner nudge loop reaches its 50 follow-up cap | No extra follow-ups are queued for that planner run | The runner evaluates the best validated state against the current tier's acceptance rule, then either escalates or fails terminally with achieved stats |
|
|
560
562
|
| Provider non-overflow error | Nothing persisted unless an overflow-only later tier succeeds | Error propagates for manual/threshold; overflow recovery can continue to lower tiers unless the request was aborted |
|
|
563
|
+
| Overflow planner request itself exceeds the provider context window before producing a usable plan | No model-generated plan is persisted | Overflow auto-compaction marks both assistant state-message overflow and thrown planner/provider overflow explicitly; when no validated deletion fits the budget, it skips the critical overflow planner model call and goes straight to deterministic eviction instead of throwing or looping on planner calls |
|
|
564
|
+
| Overflow recovery exhausts the compact-and-retry attempt without a fitting result | Nothing more is retried on the same model | The session emits `compaction_end` with `unresolvedOverflow: true`; workflow-owned `fallbackModels` can advance to the next configured model tier, and non-workflow callers see the terminal overflow-recovery error |
|
|
561
565
|
| Extension-provided deletion request invalid | Nothing persisted | Extension/caller sees validation failure; extension-provided requests bypass the internal fallback ladder |
|
|
562
566
|
|
|
563
567
|
|
package/docs/json.md
CHANGED
|
@@ -19,13 +19,15 @@ type AgentSessionEvent =
|
|
|
19
19
|
| { type: "model_changed"; model: Model<Api>; previousModel: Model<Api> | undefined; source: "set" | "cycle" | "restore" }
|
|
20
20
|
| { type: "thinking_level_changed"; level: ThinkingLevel }
|
|
21
21
|
| { type: "context_window_changed"; contextWindow: number }
|
|
22
|
-
| { type: "compaction_end"; reason: "manual" | "threshold" | "overflow"; result: ContextCompactionResult | undefined; aborted: boolean; willRetry: boolean; errorMessage?: string }
|
|
22
|
+
| { type: "compaction_end"; reason: "manual" | "threshold" | "overflow"; result: ContextCompactionResult | undefined; aborted: boolean; willRetry: boolean; unresolvedOverflow?: boolean; errorMessage?: string }
|
|
23
23
|
| { type: "auto_retry_start"; attempt: number; maxAttempts: number; delayMs: number; errorMessage: string }
|
|
24
24
|
| { type: "auto_retry_end"; success: boolean; attempt: number; finalError?: string };
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
`queue_update` emits the full pending steering and follow-up queues whenever they change. `session_info_changed`, `model_changed`, `thinking_level_changed`, and `context_window_changed` report interactive session metadata changes. `context_window_changed` carries the active token budget after `AgentSession.setContextWindow()` or branch navigation replay applies a branch-scoped `context_window_change`; branch replay does not add another session journal entry or write settings. `compaction_start` and `compaction_end` cover both manual and automatic Verbatim Compaction, Atomic's transcript-bound, deletion-only Context Compaction approach inspired by [Morph's Context Compaction](https://www.morphllm.com/context-compaction).
|
|
28
28
|
|
|
29
|
+
For overflow auto-compaction, `compaction_end.willRetry === true` means the agent is retrying the interrupted turn after compaction; `AgentSession.prompt()` waits for that continuation before resolving. If the same-model compact-and-retry path is exhausted, `compaction_end` includes `unresolvedOverflow: true` plus an `errorMessage` so orchestration layers can fallback to another model instead of treating the prompt as successful.
|
|
30
|
+
|
|
29
31
|
Base events come from `AgentEvent` in `@earendil-works/pi-agent-core` (installed as an Atomic dependency):
|
|
30
32
|
|
|
31
33
|
```typescript
|
package/docs/providers.md
CHANGED
|
@@ -44,6 +44,7 @@ Anthropic subscription auth is active for Claude Pro/Max accounts. Third-party h
|
|
|
44
44
|
- Selecting long context sets Atomic's displayed window to the model's full capacity while compaction triggers against the effective prompt-token budget, and makes Copilot requests include `X-GitHub-Api-Version: 2026-06-01`. Atomic does not send a body field, `contextTier`, or model-id variant; GitHub automatically applies the server-side `long_context` tier when prompt tokens exceed the default budget.
|
|
45
45
|
- Long-context Copilot requests consume more AI credits and require Copilot long-context/usage-based billing entitlement. A prompt that reaches the model's normal prompt cap is compacted and retried automatically. Only when GitHub rejects a prompt *below* that cap — for example because the account lacks the long-context/usage-based billing entitlement and is dropped to a smaller server tier — does Atomic surface a friendly entitlement/server-cap/cost hint rather than silently truncating context.
|
|
46
46
|
- **Gemini models** (`github-copilot/gemini-3.1-pro-preview`, `github-copilot/gemini-3.5-flash`, …) are served through Copilot's CAPI gateway, which re-translates the OpenAI request into Google's GenAI format and enforces Gemini's stricter `FunctionDeclaration` schema (it rejects a tool-parameter `anyOf`/`oneOf` whose branch is a complex object, returning `400 invalid request body`). Atomic automatically sanitizes outbound tool/function JSON Schemas for these models into the supported subset — resolving object/array-bearing unions to their most expressive branch, converting `const`/literal unions to `enum`, collapsing nullable unions to `nullable`, and dropping non-portable keywords such as `additionalProperties`, `patternProperties`, `format`, and numeric/length bounds. Gemini also serializes array/object tool-call **arguments** as flattened indexed keys (`keywords[0]`, `keywords[1]`, …); Atomic reconstructs these back into proper arrays/objects before validation so tool calls (including `structured_output` and MCP tools) don't fail and loop. Both transforms are transparent and scoped to GitHub Copilot Gemini models only; no configuration is required and other providers/models are unaffected.
|
|
47
|
+
- **Claude/Anthropic Messages models** served through GitHub Copilot use Copilot SSE transport. If Copilot cleanly ends a `/v1/messages` stream after Anthropic terminal stop-reason evidence but omits the required `message_stop` event, Atomic adds that one terminal event before provider parsing so the turn can finish normally, including when the final complete SSE frame reaches EOF without a trailing blank-line separator. The repair covers public Copilot hosts and GHE tenant routes such as `copilot-api.<enterprise>.ghe.com`, and is otherwise limited to closed, non-error Copilot Anthropic event streams; malformed, truncated, already well-formed, non-Copilot/look-alike host, non-SSE, Gemini, and OpenAI-style streams continue through the normal parser and retry behavior.
|
|
47
48
|
|
|
48
49
|
### Cursor (experimental)
|
|
49
50
|
|
package/docs/rpc.md
CHANGED
|
@@ -1076,12 +1076,14 @@ The `reason` field is `"manual"`, `"threshold"`, or `"overflow"`.
|
|
|
1076
1076
|
}
|
|
1077
1077
|
```
|
|
1078
1078
|
|
|
1079
|
-
If `reason` was `"overflow"` and compaction succeeds, `willRetry` is `true` and the agent will automatically retry the prompt.
|
|
1079
|
+
If `reason` was `"overflow"` and compaction succeeds, `willRetry` is `true` and the agent will automatically retry the prompt. Public prompt/RPC callers wait for that post-compaction continuation before the prompt is considered complete.
|
|
1080
1080
|
|
|
1081
1081
|
If compaction was aborted, `result` is `null` and `aborted` is `true`.
|
|
1082
1082
|
|
|
1083
1083
|
If compaction failed (e.g., API quota exceeded), `result` is `null`, `aborted` is `false`, and `errorMessage` contains the error description.
|
|
1084
1084
|
|
|
1085
|
+
If overflow recovery exhausts the same-model compact-and-retry attempt, `compaction_end` includes `"unresolvedOverflow": true` and an `errorMessage`. Workflow orchestration treats that signal as a context-length failure that can advance configured model fallback tiers.
|
|
1086
|
+
|
|
1085
1087
|
### context_compaction_start / context_compaction_end
|
|
1086
1088
|
|
|
1087
1089
|
The compatibility RPC command `context_compact` emits these events. It uses the same deletion-only Verbatim Compaction path as `compact`, but reports the historical context-compaction event names. The result contains `deletedTargets`, `protectedEntryIds`, `stats`, `promptVersion`, and optional `backupPath`.
|
package/docs/settings.md
CHANGED
|
@@ -36,6 +36,7 @@ Settings and trust JSON files may start with a UTF-8 BOM, as commonly written by
|
|
|
36
36
|
| `defaultThinkingLevel` | string | - | `"off"`, `"minimal"`, `"low"`, `"medium"`, `"high"`, `"xhigh"` |
|
|
37
37
|
| `hideThinkingBlock` | boolean | `false` | Hide thinking blocks in output |
|
|
38
38
|
| `thinkingBudgets` | object | - | Custom token budgets per thinking level |
|
|
39
|
+
| `fallbackModels` | string[] | - | Ordered main-chat fallback models, written as `"provider/model"` with optional reasoning suffixes such as `:high` or `:xhigh` |
|
|
39
40
|
|
|
40
41
|
#### thinkingBudgets
|
|
41
42
|
|
|
@@ -50,6 +51,28 @@ Settings and trust JSON files may start with a UTF-8 BOM, as commonly written by
|
|
|
50
51
|
}
|
|
51
52
|
```
|
|
52
53
|
|
|
54
|
+
#### fallbackModels
|
|
55
|
+
|
|
56
|
+
`fallbackModels` gives ordinary main-chat turns an ordered model fallback chain. Atomic starts with the selected/default model. If that model exhausts the normal same-model auto-retry loop for a retryable provider/model failure, Atomic switches to the next configured fallback model and continues the same turn. If `retry.enabled` is `false`, Atomic skips same-model retries and moves directly to the next fallback for retryable failures. Non-retryable task failures, cancellations, and context-overflow compaction paths do not trigger model fallback.
|
|
57
|
+
|
|
58
|
+
Fallback entries should be fully qualified `provider/model` ids. Add a reasoning suffix to a candidate to override the effort for that fallback only; valid suffixes are `:off`, `:minimal`, `:low`, `:medium`, `:high`, and `:xhigh`.
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"defaultProvider": "openai-codex",
|
|
63
|
+
"defaultModel": "gpt-5.5",
|
|
64
|
+
"defaultThinkingLevel": "high",
|
|
65
|
+
"fallbackModels": [
|
|
66
|
+
"anthropic/claude-opus-4-8:xhigh",
|
|
67
|
+
"github-copilot/gpt-5.5:high"
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Fallback attempts are visible as model changes in the session transcript and as a fallback status in the UI. Switching providers can change latency, billing, data-handling terms, and subscription/credit usage. Configure only providers you are comfortable sending the current conversation and tool context to.
|
|
73
|
+
|
|
74
|
+
`enabledModels` is separate: it only controls the interactive Ctrl+P model cycle list and is not used as an implicit fallback chain.
|
|
75
|
+
|
|
53
76
|
### Codex Fast Mode
|
|
54
77
|
|
|
55
78
|
Use `/fast` in interactive mode to edit these settings. Atomic applies fast mode only to supported `openai/*` and `openai-codex/*` providers, not `github-copilot/*` or other OpenAI-compatible providers. Chat and workflow-stage scopes are independent. When fast mode is active for the current supported model, Atomic shows `fast` after the model name in the chat footer and workflow stage model labels. Enable the workflow scope deliberately for broad fan-outs because each eligible stage can consume priority-tier requests.
|
|
@@ -251,6 +274,7 @@ When multiple sources specify a session directory, precedence is `--session-dir`
|
|
|
251
274
|
```json
|
|
252
275
|
{
|
|
253
276
|
"enabledModels": ["claude-*", "gpt-4o", "gemini-2*"],
|
|
277
|
+
"fallbackModels": ["anthropic/claude-opus-4-8:xhigh", "github-copilot/gpt-5.5:high"],
|
|
254
278
|
"defaultContextWindow": "1m",
|
|
255
279
|
"defaultContextWindows": {
|
|
256
280
|
"github-copilot/claude-opus-4.8": "936k",
|
|
@@ -262,6 +286,8 @@ When multiple sources specify a session directory, precedence is `--session-dir`
|
|
|
262
286
|
|
|
263
287
|
Context-window settings are independent of `defaultThinkingLevel`: selecting a larger context window does not change reasoning effort. Interactive users can change the active model's budget through the `/model` selection flow, which prompts for a context window whenever the chosen model supports more than one window and persists the effective selection under `defaultContextWindows["provider/modelId"]`. Atomic treats `defaultContextWindow` as a broad fallback only: if the active model does not support that value, the model's own default is used without a startup warning; targeted `defaultContextWindows` entries still warn when they become unsupported for their exact model. Larger provider context windows can carry higher usage cost. For catalog-advertised GitHub Copilot long-context models (including dynamically populated plain catalog ids such as `github-copilot/claude-sonnet-5`, while namespaced enterprise deployment ids containing `/` are skipped), selecting `1m` raises Atomic's local prompt budget to the largest advertised long-context tier at or below that rounded request (for example `922k` or `936k`) and sends `X-GitHub-Api-Version: 2026-06-01`; GitHub then applies the long-context tier server-side by prompt token count. That tier consumes more Copilot AI credits and requires Copilot long-context/usage-based billing entitlement, otherwise requests over the server cap are rejected with a friendly hint. Custom providers and explicit model overrides can still declare their own selectable `contextWindowOptions`.
|
|
264
288
|
|
|
289
|
+
`fallbackModels` is independent of both context-window defaults and `enabledModels`: it is consulted only after a retryable main-chat provider/model failure, and each fallback candidate applies its own model-specific context-window defaults when selected.
|
|
290
|
+
|
|
265
291
|
### Markdown
|
|
266
292
|
|
|
267
293
|
| Setting | Type | Default | Description |
|
package/docs/terminal-setup.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Atomic uses the [Kitty keyboard protocol](https://sw.kovidgoyal.net/kitty/keyboard-protocol/) for reliable modifier key detection. Most modern terminals support this protocol, but some require configuration.
|
|
4
4
|
|
|
5
|
+
## Startup typing
|
|
6
|
+
|
|
7
|
+
On normal interactive TTY startup, Atomic starts a short-lived raw keyboard capture before deferred resources finish loading and keeps it active until the TUI input handler is mounted. Text typed before the prompt box is fully mounted is replayed into the editor. Enter-submitted ordinary prompts are queued for the prompt loop once startup is ready; command-like submissions such as `/settings` or `!pwd` are replayed as standalone editor submissions through normal command routing. If a command-like submission is captured, later captured submissions wait behind it and replay in original input order after that command is routed, so a later ordinary prompt cannot run before the earlier command and commands are not merged with following prompts. Startup work that can affect correctness, such as project trust prompts, resume/session selectors, cross-project session confirmations, explicit resource flags, metadata commands, non-TTY input, or explicit provider/model selection, still stays on the synchronous path instead of using this pre-session capture.
|
|
8
|
+
|
|
5
9
|
## Kitty, iTerm2
|
|
6
10
|
|
|
7
11
|
Work out of the box.
|
package/docs/usage.md
CHANGED
|
@@ -281,7 +281,7 @@ atomic --tools read,search,find,ls -p "Review the code"
|
|
|
281
281
|
|
|
282
282
|
| Variable | Description |
|
|
283
283
|
|----------|-------------|
|
|
284
|
-
| `ATOMIC_CODING_AGENT_DIR` | Override config directory; default is `~/.atomic/agent` |
|
|
284
|
+
| `ATOMIC_CODING_AGENT_DIR` | Override config directory; default is `~/.atomic/agent`. Bundled intercom runtime/config files live under its `intercom/` subdirectory |
|
|
285
285
|
| `ATOMIC_CODING_AGENT_SESSION_DIR` | Override session storage directory; overridden by `--session-dir` |
|
|
286
286
|
| `ATOMIC_PACKAGE_DIR` | Override package directory, useful for Nix/Guix store paths |
|
|
287
287
|
| `ATOMIC_OFFLINE` | Disable startup network operations, including update checks, package update checks, and install/update telemetry |
|
|
@@ -290,7 +290,7 @@ atomic --tools read,search,find,ls -p "Review the code"
|
|
|
290
290
|
| `PI_CACHE_RETENTION` | Provider/upstream-specific prompt-cache retention knob; set to `long` where supported |
|
|
291
291
|
| `VISUAL`, `EDITOR` | External editor for CTRL+G |
|
|
292
292
|
|
|
293
|
-
`PI_*` aliases are also supported for app-specific `ATOMIC_*` variables for legacy compatibility. `PI_CACHE_RETENTION` is not one of those aliases and has no `ATOMIC_*` equivalent. Use `PI_CACHE_RETENTION=long` when configuring prompt-cache retention for providers/upstreams that support long-lived caches.
|
|
293
|
+
`PI_*` aliases are also supported for app-specific `ATOMIC_*` variables for legacy compatibility. For example, intercom honors `PI_CODING_AGENT_DIR` when `ATOMIC_CODING_AGENT_DIR` is unset and still reads legacy `~/.pi/agent/intercom/config.json` when the Atomic config is absent. `PI_CACHE_RETENTION` is not one of those aliases and has no `ATOMIC_*` equivalent. Use `PI_CACHE_RETENTION=long` when configuring prompt-cache retention for providers/upstreams that support long-lived caches. Intercom's default broker starter works across Node-based installs, Bun source checkouts, and standalone Atomic binaries without requiring `npx`, `tsx`, or `bun` to be present on `PATH`; custom broker commands remain explicit opt-in overrides.
|
|
294
294
|
|
|
295
295
|
## Design Principles
|
|
296
296
|
|