@bastani/atomic 0.10.2 → 0.10.3-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/dist/builtin/intercom/CHANGELOG.md +11 -0
- package/dist/builtin/intercom/broker/broker-instance.ts +2 -13
- package/dist/builtin/intercom/broker/broker.ts +158 -73
- package/dist/builtin/intercom/broker/durable-ended-queue.ts +14 -2
- package/dist/builtin/intercom/broker/host-command-environment.ts +13 -0
- package/dist/builtin/intercom/broker/hosted-session-errors.ts +1 -0
- package/dist/builtin/intercom/broker/multinode-router.ts +111 -16
- package/dist/builtin/intercom/broker/multinode-state-store.ts +50 -4
- package/dist/builtin/intercom/broker/open-broker-state.ts +5 -4
- package/dist/builtin/intercom/broker/spawn.ts +144 -25
- package/dist/builtin/intercom/broker/sql-add-column.ts +33 -0
- package/dist/builtin/intercom/broker/sql-known-session-store.ts +120 -36
- package/dist/builtin/intercom/broker/sql-outbox-store.ts +75 -13
- package/dist/builtin/intercom/broker/start-announcement.ts +55 -10
- package/dist/builtin/intercom/broker/watchdog.ts +10 -7
- package/dist/builtin/intercom/index.bundle.mjs +111 -27
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +13 -0
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/skills/skill-creator/SKILL.md +30 -52
- package/dist/builtin/subagents/skills/skill-creator/eval-viewer/generate_review.py +34 -40
- package/dist/builtin/subagents/skills/skill-creator/eval-viewer/viewer.html +2 -2
- package/dist/builtin/subagents/skills/skill-creator/scripts/atomic_cli.py +668 -0
- package/dist/builtin/subagents/skills/skill-creator/scripts/generate_report.py +3 -3
- package/dist/builtin/subagents/skills/skill-creator/scripts/improve_description.py +42 -38
- package/dist/builtin/subagents/skills/skill-creator/scripts/run_eval.py +268 -176
- package/dist/builtin/subagents/skills/skill-creator/scripts/run_loop.py +20 -11
- package/dist/builtin/subagents/skills/skill-creator/scripts/utils.py +1 -1
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +163 -97
- package/dist/builtin/web-access/CHANGELOG.md +7 -0
- package/dist/builtin/web-access/index.bundle.mjs +5 -4
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/core/agent-session-auto-compaction.d.ts +10 -1
- package/dist/core/agent-session-auto-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-auto-compaction.js +54 -2
- package/dist/core/agent-session-auto-compaction.js.map +1 -1
- package/dist/core/agent-session-compaction.d.ts +4 -0
- package/dist/core/agent-session-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-compaction.js +17 -2
- package/dist/core/agent-session-compaction.js.map +1 -1
- package/dist/core/agent-session-custom-message-commit.d.ts.map +1 -1
- package/dist/core/agent-session-custom-message-commit.js +3 -1
- package/dist/core/agent-session-custom-message-commit.js.map +1 -1
- package/dist/core/agent-session-events.d.ts +2 -0
- package/dist/core/agent-session-events.d.ts.map +1 -1
- package/dist/core/agent-session-events.js +34 -13
- package/dist/core/agent-session-events.js.map +1 -1
- package/dist/core/agent-session-export.d.ts.map +1 -1
- package/dist/core/agent-session-export.js +3 -0
- package/dist/core/agent-session-export.js.map +1 -1
- package/dist/core/agent-session-message-queue.d.ts +27 -0
- package/dist/core/agent-session-message-queue.d.ts.map +1 -1
- package/dist/core/agent-session-message-queue.js +213 -30
- package/dist/core/agent-session-message-queue.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +6 -1
- package/dist/core/agent-session-methods.d.ts.map +1 -1
- package/dist/core/agent-session-methods.js.map +1 -1
- package/dist/core/agent-session-prompt.d.ts.map +1 -1
- package/dist/core/agent-session-prompt.js +35 -3
- package/dist/core/agent-session-prompt.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +2 -2
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-state.d.ts.map +1 -1
- package/dist/core/agent-session-state.js +6 -1
- package/dist/core/agent-session-state.js.map +1 -1
- package/dist/core/agent-session-tool-hooks.d.ts.map +1 -1
- package/dist/core/agent-session-tool-hooks.js +15 -2
- package/dist/core/agent-session-tool-hooks.js.map +1 -1
- package/dist/core/agent-session-typed-queue.d.ts +14 -1
- package/dist/core/agent-session-typed-queue.d.ts.map +1 -1
- package/dist/core/agent-session-typed-queue.js +26 -1
- package/dist/core/agent-session-typed-queue.js.map +1 -1
- package/dist/core/agent-session-types.d.ts +5 -0
- 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.map +1 -1
- package/dist/core/agent-session.js +2 -1
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/async-scope.d.ts +9 -4
- package/dist/core/async-scope.d.ts.map +1 -1
- package/dist/core/async-scope.js +13 -5
- package/dist/core/async-scope.js.map +1 -1
- package/dist/core/builtin-diagnostics.js +2 -2
- package/dist/core/builtin-diagnostics.js.map +1 -1
- package/dist/core/chat-admission-order.d.ts.map +1 -1
- package/dist/core/chat-admission-order.js +2 -1
- package/dist/core/chat-admission-order.js.map +1 -1
- package/dist/core/chat-record-saves.d.ts +4 -0
- package/dist/core/chat-record-saves.d.ts.map +1 -0
- package/dist/core/chat-record-saves.js +25 -0
- package/dist/core/chat-record-saves.js.map +1 -0
- package/dist/core/command-deliveries.d.ts +62 -0
- package/dist/core/command-deliveries.d.ts.map +1 -0
- package/dist/core/command-deliveries.js +139 -0
- package/dist/core/command-deliveries.js.map +1 -0
- package/dist/core/diagnostic-writer.d.ts.map +1 -1
- package/dist/core/diagnostic-writer.js +5 -4
- package/dist/core/diagnostic-writer.js.map +1 -1
- package/dist/core/extension-startup-close.d.ts +1 -2
- package/dist/core/extension-startup-close.d.ts.map +1 -1
- package/dist/core/extension-startup-close.js +2 -2
- package/dist/core/extension-startup-close.js.map +1 -1
- package/dist/core/extensions/jiti-aliases.d.ts +11 -0
- package/dist/core/extensions/jiti-aliases.d.ts.map +1 -0
- package/dist/core/extensions/jiti-aliases.js +28 -0
- package/dist/core/extensions/jiti-aliases.js.map +1 -0
- package/dist/core/extensions/loader-api.js +3 -3
- package/dist/core/extensions/loader-api.js.map +1 -1
- package/dist/core/extensions/loader-bindings.js +2 -2
- package/dist/core/extensions/loader-bindings.js.map +1 -1
- package/dist/core/extensions/loader-rollback.d.ts +1 -2
- package/dist/core/extensions/loader-rollback.d.ts.map +1 -1
- package/dist/core/extensions/loader-rollback.js +2 -2
- package/dist/core/extensions/loader-rollback.js.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.js +53 -9
- package/dist/core/extensions/loader-virtual-modules.js.map +1 -1
- package/dist/core/extensions/native-builtin-entries.d.ts +5 -0
- package/dist/core/extensions/native-builtin-entries.d.ts.map +1 -1
- package/dist/core/extensions/native-builtin-entries.js +8 -1
- package/dist/core/extensions/native-builtin-entries.js.map +1 -1
- package/dist/core/extensions/reloadable-scripts.d.ts +21 -2
- package/dist/core/extensions/reloadable-scripts.d.ts.map +1 -1
- package/dist/core/extensions/reloadable-scripts.js +11 -3
- package/dist/core/extensions/reloadable-scripts.js.map +1 -1
- package/dist/core/extensions/source-builtin-imports.d.ts +40 -0
- package/dist/core/extensions/source-builtin-imports.d.ts.map +1 -0
- package/dist/core/extensions/source-builtin-imports.js +142 -0
- package/dist/core/extensions/source-builtin-imports.js.map +1 -0
- package/dist/core/extensions/transform-graph.d.ts +15 -0
- package/dist/core/extensions/transform-graph.d.ts.map +1 -0
- package/dist/core/extensions/transform-graph.js +85 -0
- package/dist/core/extensions/transform-graph.js.map +1 -0
- package/dist/core/extensions/ts-source-specifiers.d.ts +2 -0
- package/dist/core/extensions/ts-source-specifiers.d.ts.map +1 -1
- package/dist/core/extensions/ts-source-specifiers.js +7 -0
- package/dist/core/extensions/ts-source-specifiers.js.map +1 -1
- package/dist/core/extensions/ts-transform-worker.d.ts +2 -0
- package/dist/core/extensions/ts-transform-worker.d.ts.map +1 -0
- package/dist/core/extensions/ts-transform-worker.js +43 -0
- package/dist/core/extensions/ts-transform-worker.js.map +1 -0
- package/dist/core/message-admission.d.ts.map +1 -1
- package/dist/core/message-admission.js +4 -4
- package/dist/core/message-admission.js.map +1 -1
- package/dist/core/messages.d.ts +5 -0
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js +35 -0
- package/dist/core/messages.js.map +1 -1
- package/dist/core/model-fallback-failures.d.ts +1 -1
- package/dist/core/model-fallback-failures.d.ts.map +1 -1
- package/dist/core/model-fallback-failures.js +18 -1
- package/dist/core/model-fallback-failures.js.map +1 -1
- package/dist/core/process-start-token.d.ts +7 -0
- package/dist/core/process-start-token.d.ts.map +1 -1
- package/dist/core/process-start-token.js +14 -0
- package/dist/core/process-start-token.js.map +1 -1
- package/dist/core/project-trust-electorate.d.ts +24 -0
- package/dist/core/project-trust-electorate.d.ts.map +1 -0
- package/dist/core/project-trust-electorate.js +52 -0
- package/dist/core/project-trust-electorate.js.map +1 -0
- package/dist/core/project-trust-state.d.ts +15 -0
- package/dist/core/project-trust-state.d.ts.map +1 -1
- package/dist/core/project-trust-state.js +15 -0
- package/dist/core/project-trust-state.js.map +1 -1
- package/dist/core/provider-request-admission.d.ts.map +1 -1
- package/dist/core/provider-request-admission.js +2 -2
- package/dist/core/provider-request-admission.js.map +1 -1
- package/dist/core/queued-input-admission.js +2 -2
- package/dist/core/queued-input-admission.js.map +1 -1
- package/dist/core/queued-message-delivery.d.ts +2 -2
- package/dist/core/queued-message-delivery.d.ts.map +1 -1
- package/dist/core/queued-message-delivery.js +6 -3
- package/dist/core/queued-message-delivery.js.map +1 -1
- package/dist/core/resource-admission-scope.js +2 -2
- package/dist/core/resource-admission-scope.js.map +1 -1
- package/dist/core/resume/blueprint/process.d.ts +3 -4
- package/dist/core/resume/blueprint/process.d.ts.map +1 -1
- package/dist/core/resume/blueprint/process.js +33 -17
- package/dist/core/resume/blueprint/process.js.map +1 -1
- package/dist/core/resume/path-mapping.js +4 -4
- package/dist/core/resume/path-mapping.js.map +1 -1
- package/dist/core/resume/session-resume.d.ts +9 -0
- package/dist/core/resume/session-resume.d.ts.map +1 -1
- package/dist/core/resume/session-resume.js +27 -2
- package/dist/core/resume/session-resume.js.map +1 -1
- package/dist/core/resume-cache-checkpoint.d.ts +27 -1
- package/dist/core/resume-cache-checkpoint.d.ts.map +1 -1
- package/dist/core/resume-cache-checkpoint.js +45 -0
- package/dist/core/resume-cache-checkpoint.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +7 -31
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-lifecycle-scope.d.ts +1 -2
- package/dist/core/session-lifecycle-scope.d.ts.map +1 -1
- package/dist/core/session-lifecycle-scope.js +2 -2
- package/dist/core/session-lifecycle-scope.js.map +1 -1
- package/dist/core/session-lifecycle-work.js +2 -2
- package/dist/core/session-lifecycle-work.js.map +1 -1
- package/dist/core/session-manager-core.d.ts.map +1 -1
- package/dist/core/session-manager-core.js +3 -0
- package/dist/core/session-manager-core.js.map +1 -1
- package/dist/core/session-storage.d.ts +12 -0
- package/dist/core/session-storage.d.ts.map +1 -1
- package/dist/core/session-storage.js +68 -1
- package/dist/core/session-storage.js.map +1 -1
- package/dist/core/settings-lock-directory.d.ts.map +1 -1
- package/dist/core/settings-lock-directory.js +4 -3
- package/dist/core/settings-lock-directory.js.map +1 -1
- package/dist/core/settings-write-ownership.d.ts +1 -2
- package/dist/core/settings-write-ownership.d.ts.map +1 -1
- package/dist/core/settings-write-ownership.js +2 -2
- package/dist/core/settings-write-ownership.js.map +1 -1
- package/dist/core/storage/node-sqlite-thread.d.ts.map +1 -1
- package/dist/core/storage/node-sqlite-thread.js +6 -4
- package/dist/core/storage/node-sqlite-thread.js.map +1 -1
- package/dist/core/storage/node-sqlite.d.ts.map +1 -1
- package/dist/core/storage/node-sqlite.js +22 -8
- package/dist/core/storage/node-sqlite.js.map +1 -1
- package/dist/core/system-prompt.d.ts +16 -2
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +33 -6
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tasks/agent-adapter.d.ts.map +1 -1
- package/dist/core/tasks/agent-adapter.js +2 -1
- package/dist/core/tasks/agent-adapter.js.map +1 -1
- package/dist/core/tasks/completion.d.ts +3 -2
- package/dist/core/tasks/completion.d.ts.map +1 -1
- package/dist/core/tasks/completion.js.map +1 -1
- package/dist/core/tasks/execution-scope.js +2 -2
- package/dist/core/tasks/execution-scope.js.map +1 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +2 -1
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/history-regex-worker.d.ts.map +1 -1
- package/dist/core/tools/history-regex-worker.js +3 -2
- package/dist/core/tools/history-regex-worker.js.map +1 -1
- package/dist/core/tools/shell-task-render.d.ts +3 -2
- package/dist/core/tools/shell-task-render.d.ts.map +1 -1
- package/dist/core/tools/shell-task-render.js +7 -5
- package/dist/core/tools/shell-task-render.js.map +1 -1
- package/dist/core/tools/shell-task-status.d.ts +6 -2
- package/dist/core/tools/shell-task-status.d.ts.map +1 -1
- package/dist/core/tools/shell-task-status.js +13 -8
- package/dist/core/tools/shell-task-status.js.map +1 -1
- package/dist/core/tools/sqlite-selector-connection.d.ts.map +1 -1
- package/dist/core/tools/sqlite-selector-connection.js +4 -3
- package/dist/core/tools/sqlite-selector-connection.js.map +1 -1
- package/dist/core/tools/windows-directory-security.d.ts.map +1 -1
- package/dist/core/tools/windows-directory-security.js +2 -1
- package/dist/core/tools/windows-directory-security.js.map +1 -1
- package/dist/core/worktree-snapshot/git.js +2 -2
- package/dist/core/worktree-snapshot/git.js.map +1 -1
- package/dist/extensions/mcp/index.d.ts +6 -1
- package/dist/extensions/mcp/index.d.ts.map +1 -1
- package/dist/extensions/mcp/index.js +150 -18
- package/dist/extensions/mcp/index.js.map +1 -1
- package/dist/extensions/mcp/tool-records.d.ts +44 -9
- package/dist/extensions/mcp/tool-records.d.ts.map +1 -1
- package/dist/extensions/mcp/tool-records.js +58 -16
- package/dist/extensions/mcp/tool-records.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/main-session.d.ts +3 -1
- package/dist/main-session.d.ts.map +1 -1
- package/dist/main-session.js +1 -0
- package/dist/main-session.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +230 -96
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/agent-view/agent-view-bridge.d.ts +5 -0
- package/dist/modes/interactive/agent-view/agent-view-bridge.d.ts.map +1 -1
- package/dist/modes/interactive/agent-view/agent-view-bridge.js.map +1 -1
- package/dist/modes/interactive/agent-view/agent-view-switcher.d.ts +5 -2
- package/dist/modes/interactive/agent-view/agent-view-switcher.d.ts.map +1 -1
- package/dist/modes/interactive/agent-view/agent-view-switcher.js +3 -3
- package/dist/modes/interactive/agent-view/agent-view-switcher.js.map +1 -1
- package/dist/modes/interactive/agent-view/contracts.d.ts +6 -0
- package/dist/modes/interactive/agent-view/contracts.d.ts.map +1 -1
- package/dist/modes/interactive/agent-view/contracts.js.map +1 -1
- package/dist/modes/interactive/agent-view/install.d.ts.map +1 -1
- package/dist/modes/interactive/agent-view/install.js +2 -1
- package/dist/modes/interactive/agent-view/install.js.map +1 -1
- package/dist/modes/interactive/agent-view/open-port.d.ts +4 -2
- package/dist/modes/interactive/agent-view/open-port.d.ts.map +1 -1
- package/dist/modes/interactive/agent-view/open-port.js +4 -3
- package/dist/modes/interactive/agent-view/open-port.js.map +1 -1
- package/dist/modes/interactive/agent-view/prompt-retarget.d.ts.map +1 -1
- package/dist/modes/interactive/agent-view/prompt-retarget.js +18 -5
- package/dist/modes/interactive/agent-view/prompt-retarget.js.map +1 -1
- package/dist/modes/interactive/agent-view/remote-port.d.ts +10 -1
- package/dist/modes/interactive/agent-view/remote-port.d.ts.map +1 -1
- package/dist/modes/interactive/agent-view/remote-port.js +36 -4
- package/dist/modes/interactive/agent-view/remote-port.js.map +1 -1
- package/dist/modes/interactive/agent-view/viewed-keys.d.ts +56 -0
- package/dist/modes/interactive/agent-view/viewed-keys.d.ts.map +1 -0
- package/dist/modes/interactive/agent-view/viewed-keys.js +63 -0
- package/dist/modes/interactive/agent-view/viewed-keys.js.map +1 -0
- package/dist/modes/interactive/agent-view/viewed-submit.d.ts +14 -4
- package/dist/modes/interactive/agent-view/viewed-submit.d.ts.map +1 -1
- package/dist/modes/interactive/agent-view/viewed-submit.js +51 -17
- package/dist/modes/interactive/agent-view/viewed-submit.js.map +1 -1
- package/dist/modes/interactive/components/agent-panel.d.ts.map +1 -1
- package/dist/modes/interactive/components/agent-panel.js +8 -21
- package/dist/modes/interactive/components/agent-panel.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-actions.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-actions.js +18 -5
- package/dist/modes/interactive/components/chat-session-host-actions.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-rendering.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-rendering.js +6 -0
- package/dist/modes/interactive/components/chat-session-host-rendering.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-state.d.ts +1 -0
- package/dist/modes/interactive/components/chat-session-host-state.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-state.js +2 -0
- package/dist/modes/interactive/components/chat-session-host-state.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-types.d.ts +5 -0
- package/dist/modes/interactive/components/chat-session-host-types.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-types.js.map +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts +33 -2
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js +58 -2
- package/dist/modes/interactive/components/custom-editor.js.map +1 -1
- package/dist/modes/interactive/components/host-session-picker.js +2 -2
- package/dist/modes/interactive/components/host-session-picker.js.map +1 -1
- package/dist/modes/interactive/components/main-composer-keys.d.ts +16 -5
- package/dist/modes/interactive/components/main-composer-keys.d.ts.map +1 -1
- package/dist/modes/interactive/components/main-composer-keys.js +27 -8
- package/dist/modes/interactive/components/main-composer-keys.js.map +1 -1
- package/dist/modes/interactive/components/notice-line.d.ts +8 -25
- package/dist/modes/interactive/components/notice-line.d.ts.map +1 -1
- package/dist/modes/interactive/components/notice-line.js +18 -17
- package/dist/modes/interactive/components/notice-line.js.map +1 -1
- package/dist/modes/interactive/components/prompt-slot.d.ts +20 -3
- package/dist/modes/interactive/components/prompt-slot.d.ts.map +1 -1
- package/dist/modes/interactive/components/prompt-slot.js +82 -32
- package/dist/modes/interactive/components/prompt-slot.js.map +1 -1
- package/dist/modes/interactive/components/queued-messages-view.d.ts +5 -2
- package/dist/modes/interactive/components/queued-messages-view.d.ts.map +1 -1
- package/dist/modes/interactive/components/queued-messages-view.js +12 -5
- package/dist/modes/interactive/components/queued-messages-view.js.map +1 -1
- package/dist/modes/interactive/components/task-board.d.ts +5 -8
- package/dist/modes/interactive/components/task-board.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-board.js +5 -49
- package/dist/modes/interactive/components/task-board.js.map +1 -1
- package/dist/modes/interactive/components/task-completion-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-completion-message.js +9 -2
- package/dist/modes/interactive/components/task-completion-message.js.map +1 -1
- package/dist/modes/interactive/components/task-marks.d.ts +19 -0
- package/dist/modes/interactive/components/task-marks.d.ts.map +1 -0
- package/dist/modes/interactive/components/task-marks.js +25 -0
- package/dist/modes/interactive/components/task-marks.js.map +1 -0
- package/dist/modes/interactive/components/task-row.d.ts +10 -2
- package/dist/modes/interactive/components/task-row.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-row.js +39 -32
- package/dist/modes/interactive/components/task-row.js.map +1 -1
- package/dist/modes/interactive/components/task-transcript-page.d.ts +7 -0
- package/dist/modes/interactive/components/task-transcript-page.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-transcript-page.js +106 -10
- package/dist/modes/interactive/components/task-transcript-page.js.map +1 -1
- package/dist/modes/interactive/components/tool-block-families.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-block-families.js +8 -9
- package/dist/modes/interactive/components/tool-block-families.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +5 -1
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/extension-command-hold.d.ts.map +1 -1
- package/dist/modes/interactive/extension-command-hold.js +5 -7
- package/dist/modes/interactive/extension-command-hold.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-dialogs.js +6 -1
- package/dist/modes/interactive/interactive-extension-dialogs.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-runtime.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-extension-runtime.js +21 -7
- package/dist/modes/interactive/interactive-extension-runtime.js.map +1 -1
- package/dist/modes/interactive/interactive-initial-session-binding.d.ts +1 -2
- package/dist/modes/interactive/interactive-initial-session-binding.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-initial-session-binding.js +2 -2
- package/dist/modes/interactive/interactive-initial-session-binding.js.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.js +13 -4
- package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.d.ts +2 -1
- package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.js +6 -1
- package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-helpers.d.ts +4 -2
- package/dist/modes/interactive/interactive-mode-helpers.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-helpers.js +6 -0
- package/dist/modes/interactive/interactive-mode-helpers.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.d.ts +5 -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-process-lifecycle.js +96 -17
- package/dist/modes/interactive/interactive-process-lifecycle.js.map +1 -1
- package/dist/modes/interactive/interactive-queueing.d.ts +5 -0
- package/dist/modes/interactive/interactive-queueing.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-queueing.js +37 -5
- package/dist/modes/interactive/interactive-queueing.js.map +1 -1
- package/dist/modes/interactive/interactive-render-chat.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-render-chat.js +45 -4
- package/dist/modes/interactive/interactive-render-chat.js.map +1 -1
- package/dist/modes/interactive/interactive-resource-disclosure.d.ts +4 -1
- package/dist/modes/interactive/interactive-resource-disclosure.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-resource-disclosure.js +20 -1
- package/dist/modes/interactive/interactive-resource-disclosure.js.map +1 -1
- package/dist/modes/interactive/interactive-resource-rendering.js +3 -0
- package/dist/modes/interactive/interactive-resource-rendering.js.map +1 -1
- package/dist/modes/interactive/interactive-startup.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-startup.js +43 -5
- package/dist/modes/interactive/interactive-startup.js.map +1 -1
- package/dist/modes/interactive-engine/activity-watchdog.d.ts +6 -3
- package/dist/modes/interactive-engine/activity-watchdog.d.ts.map +1 -1
- package/dist/modes/interactive-engine/activity-watchdog.js +3 -2
- package/dist/modes/interactive-engine/activity-watchdog.js.map +1 -1
- package/dist/modes/interactive-engine/engine-health.d.ts +2 -0
- package/dist/modes/interactive-engine/engine-health.d.ts.map +1 -1
- package/dist/modes/interactive-engine/engine-health.js.map +1 -1
- package/dist/modes/interactive-engine/engine-quit-intent.d.ts +10 -0
- package/dist/modes/interactive-engine/engine-quit-intent.d.ts.map +1 -1
- package/dist/modes/interactive-engine/engine-quit-intent.js +33 -0
- package/dist/modes/interactive-engine/engine-quit-intent.js.map +1 -1
- package/dist/modes/interactive-engine/extension-ui-bridge.d.ts +7 -1
- package/dist/modes/interactive-engine/extension-ui-bridge.d.ts.map +1 -1
- package/dist/modes/interactive-engine/extension-ui-bridge.js +15 -2
- package/dist/modes/interactive-engine/extension-ui-bridge.js.map +1 -1
- package/dist/modes/interactive-engine/host-listener-failures.d.ts +24 -0
- package/dist/modes/interactive-engine/host-listener-failures.d.ts.map +1 -0
- package/dist/modes/interactive-engine/host-listener-failures.js +98 -0
- package/dist/modes/interactive-engine/host-listener-failures.js.map +1 -0
- package/dist/modes/interactive-engine/isolated-runtime.d.ts +16 -0
- package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.js +74 -7
- package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
- package/dist/modes/interactive-engine/protocol.d.ts +5 -0
- package/dist/modes/interactive-engine/protocol.d.ts.map +1 -1
- package/dist/modes/interactive-engine/protocol.js +8 -2
- package/dist/modes/interactive-engine/protocol.js.map +1 -1
- package/dist/modes/interactive-engine/remote-component.d.ts +13 -0
- package/dist/modes/interactive-engine/remote-component.d.ts.map +1 -1
- package/dist/modes/interactive-engine/remote-component.js +69 -4
- package/dist/modes/interactive-engine/remote-component.js.map +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +34 -6
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/agent-panel-bridge.d.ts +7 -0
- package/dist/modes/rpc/agent-panel-bridge.d.ts.map +1 -1
- package/dist/modes/rpc/agent-panel-bridge.js +11 -1
- package/dist/modes/rpc/agent-panel-bridge.js.map +1 -1
- package/dist/modes/rpc/agent-view-rpc-panel.d.ts.map +1 -1
- package/dist/modes/rpc/agent-view-rpc-panel.js +11 -5
- package/dist/modes/rpc/agent-view-rpc-panel.js.map +1 -1
- package/dist/modes/rpc/rpc-client-process.d.ts +8 -1
- package/dist/modes/rpc/rpc-client-process.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client-process.js +89 -65
- package/dist/modes/rpc/rpc-client-process.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +21 -0
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +77 -33
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-event-buffer.d.ts +5 -0
- package/dist/modes/rpc/rpc-event-buffer.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-event-buffer.js +8 -2
- package/dist/modes/rpc/rpc-event-buffer.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +9 -2
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/utils/shell.d.ts +5 -1
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +14 -7
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/worker-threads.d.ts +10 -4
- package/dist/utils/worker-threads.d.ts.map +1 -1
- package/dist/utils/worker-threads.js +10 -4
- package/dist/utils/worker-threads.js.map +1 -1
- package/docs/background-tasks.md +10 -10
- package/docs/compaction.md +1 -0
- package/docs/development.md +1 -1
- package/docs/environment-variables.md +4 -0
- package/docs/extensions/api-reference.md +2 -0
- package/docs/extensions/events.md +1 -1
- package/docs/getting-started/installation.md +1 -0
- package/docs/guides/non-interactive.md +2 -0
- package/docs/guides/resume-on-any-machine.md +3 -1
- package/docs/intercom/reference.md +1 -1
- package/docs/keybindings.md +6 -5
- package/docs/libraries/ai.md +2 -1
- package/docs/mcp-servers.md +1 -1
- package/docs/sdk/reference.md +1 -1
- package/docs/sdk.md +6 -0
- package/docs/security.md +4 -2
- package/docs/settings.md +2 -1
- package/docs/storage.md +2 -0
- package/docs/subagents.md +2 -2
- package/docs/tui/reference.md +3 -1
- package/npm-shrinkwrap.json +49 -49
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-mode-surface.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-mode-surface.ts"],"names":[],"mappings":"","sourcesContent":["import type { ThinkingLevel } from \"@bastani/atomic-agent-core\";\nimport type { AssistantMessage, Usage } from \"@bastani/atomic-ai/compat\";\n/** Method surface installed onto InteractiveModeBase by sibling modules. */\n\nimport type { MarkdownTransformer, SessionRecoveryReason, ToolRenderers } from \"../../core/extensions/types.ts\";\nimport type { CustomEntry, SessionEntry } from \"../../core/session-manager.ts\";\nimport type { FullscreenExitOutput } from \"../../core/settings-manager.ts\";\nimport type { ToolStatus } from \"../../utils/tools-manager.ts\";\nimport type { ActivityWatchdogDiagnostic } from \"../interactive-engine/activity-watchdog.ts\";\nimport type { JsonAgentSessionEvent } from \"../json-event.ts\";\nimport type { AtomicWorkingLoader } from \"./components/atomic-working-status.ts\";\nimport type {\n\tAgentMessage,\n\tAgentSessionEvent,\n\tApi,\n\tAppKeybinding,\n\tAuthSelectorProvider,\n\tAutocompleteProvider,\n\tChatMessageEntry,\n\tChatMessageRenderOptions,\n\tComponent,\n\tContainer,\n\tEditorFactory,\n\tExtensionCommandContext,\n\tExtensionRunner,\n\tExtensionUIContext,\n\tExtensionUIDialogOptions,\n\tExtensionWidgetOptions,\n\tHostCustomUiState,\n\tHostCustomUiStateListener,\n\tKeybinding,\n\tKeybindingsManager,\n\tLoaderIndicatorOptions,\n\tLoginDialogComponent,\n\tMarkdown,\n\tMarkdownTheme,\n\tMessage,\n\tMissingSessionCwdChoice,\n\tMissingSessionCwdError,\n\tModel,\n\tOAuthSelectPrompt,\n\tOverlayHandle,\n\tOverlayOptions,\n\tProjectTrustContext,\n\tReadonlyFooterDataProvider,\n\tResourceDiagnostic,\n\tSessionContext,\n\tSlashCommand,\n\tSourceInfo,\n\tTheme,\n\tTUI,\n\tVerbatimCompactionResult,\n} from \"./interactive-mode-deps.ts\";\nimport type { ParkedViewport } from \"./interactive-saved-chat-history.js\";\nimport type { InteractiveSubmission } from \"./interactive-submission.ts\";\nimport type { BlockedStatus } from \"./program-status-reporter.ts\";\n\n/** The session a fork for a missing cwd copies: one the active store holds, or a JSONL export outside it. */\nexport type MissingCwdForkSource =\n\t| { readonly sessionId: string; readonly sessionDirectory?: string }\n\t| { readonly exportPath: string };\n\ndeclare module \"./interactive-mode-base.ts\" {\n\tinterface InteractiveModeBase {\n\t\tgetAutocompleteSourceTag(sourceInfo?: SourceInfo): string | undefined;\n\t\tprefixAutocompleteDescription(description: string | undefined, sourceInfo?: SourceInfo): string | undefined;\n\t\tgetBuiltInCommandConflictDiagnostics(extensionRunner: ExtensionRunner): ResourceDiagnostic[];\n\t\tcreateBaseAutocompleteProvider(): AutocompleteProvider;\n\t\tbuildRemoteSlashCommands(localCommands: SlashCommand[]): SlashCommand[];\n\t\tsetupAutocompleteProvider(options?: { preserveSelection?: boolean }): void;\n\t\tshowStartupNoticesIfNeeded(targetContainer?: Container): void;\n\t\treportModelCatalogWarning(targetContainer?: Container): void;\n\t\treportedModelCatalogWarning: string | undefined;\n\t\thadLastChangelogVersionAtStartup: boolean;\n\t\tfirstRunNoticeVisible: boolean;\n\t\tfirstRunOnboardingNoticeComponents: Component[];\n\t\tinitializeFirstRunOnboardingMarkers(): void;\n\t\tisFirstRunOnboardingEligible(): boolean;\n\t\tclearFirstRunOnboardingUi(): void;\n\t\tinit(): Promise<void>;\n\t\tcompleteDeferredStartup(): Promise<void>;\n\t\tretryDeferredModelRestore(targetContainer?: Container): Promise<void>;\n\t\tupdateTerminalTitle(): void;\n\t\trun(): Promise<void>;\n\t\tcheckForPackageUpdates(): Promise<string[]>;\n\t\tcheckTmuxKeyboardSetup(): Promise<string | undefined>;\n\t\tgetChangelogForDisplay(): string | undefined;\n\t\treportInstallTelemetry(version: string): void;\n\t\tgetMarkdownThemeWithSettings(): MarkdownTheme;\n\t\tgetMarkdownTransformers(): MarkdownTransformer[];\n\t\tcreateChangelogMarkdown(markdown: string, paddingX: number, paddingY: number): Markdown;\n\t\tformatDisplayPath(p: string): string;\n\t\tformatExtensionDisplayPath(path: string): string;\n\t\tformatContextPath(p: string): string;\n\t\tgetStartupModelLabel(): string;\n\t\tgetStartupIdentityText(maxWidth?: number, gap?: number, manifestoPhase?: number): string;\n\t\tgetAtomicAnsiMarkLines(gap?: number): string[];\n\t\tgetStartupExpansionState(): boolean;\n\t\tshowFullscreenModelScopeNotice(): void;\n\t\tshouldShowStartupHeader(): boolean;\n\t\tshouldShowStartupDetails(): boolean;\n\t\tgetShortPath(fullPath: string, sourceInfo?: SourceInfo): string;\n\t\tgetCompactPathLabel(resourcePath: string, sourceInfo?: SourceInfo): string;\n\t\tgetCompactPackageSourceLabel(sourceInfo?: SourceInfo): string;\n\t\tgetCompactExtensionLabel(resourcePath: string, sourceInfo?: SourceInfo): string;\n\t\tgetCompactDisplayPathSegments(resourcePath: string): string[];\n\t\tgetCompactNonPackageExtensionLabel(\n\t\t\tresourcePath: string,\n\t\t\tindex: number,\n\t\t\tallPaths: Array<{ path: string; segments: string[] }>,\n\t\t): string;\n\t\tgetCompactExtensionLabels(extensions: Array<{ path: string; sourceInfo?: SourceInfo }>): string[];\n\t\tgetDisplaySourceInfo(sourceInfo?: SourceInfo): {\n\t\t\tlabel: string;\n\t\t\tscopeLabel?: string;\n\t\t\tcolor: \"accent\" | \"muted\";\n\t\t};\n\t\tgetScopeGroup(sourceInfo?: SourceInfo): \"user\" | \"project\" | \"path\";\n\t\tisPackageSource(sourceInfo?: SourceInfo): boolean;\n\t\tbuildScopeGroups(items: Array<{ path: string; sourceInfo?: SourceInfo }>): Array<{\n\t\t\tscope: \"user\" | \"project\" | \"path\";\n\t\t\tpaths: Array<{ path: string; sourceInfo?: SourceInfo }>;\n\t\t\tpackages: Map<string, Array<{ path: string; sourceInfo?: SourceInfo }>>;\n\t\t}>;\n\t\tformatScopeGroups(\n\t\t\tgroups: Array<{\n\t\t\t\tscope: \"user\" | \"project\" | \"path\";\n\t\t\t\tpaths: Array<{ path: string; sourceInfo?: SourceInfo }>;\n\t\t\t\tpackages: Map<string, Array<{ path: string; sourceInfo?: SourceInfo }>>;\n\t\t\t}>,\n\t\t\toptions: {\n\t\t\t\tformatPath: (item: { path: string; sourceInfo?: SourceInfo }) => string;\n\t\t\t\tformatPackagePath: (item: { path: string; sourceInfo?: SourceInfo }, source: string) => string;\n\t\t\t},\n\t\t): string;\n\t\tfindSourceInfoForPath(p: string, sourceInfos: Map<string, SourceInfo>): SourceInfo | undefined;\n\t\tformatPathWithSource(p: string, sourceInfo?: SourceInfo): string;\n\t\tformatDiagnostics(diagnostics: readonly ResourceDiagnostic[], sourceInfos: Map<string, SourceInfo>): string;\n\t\taddResourceDisclosure(options: {\n\t\t\tcontextFiles: ReadonlyArray<{ path: string }>;\n\t\t\tskills: ReadonlyArray<{ filePath: string; name: string }>;\n\t\t\tprompts: ReadonlyArray<{ filePath: string; name: string }>;\n\t\t\textensions: ReadonlyArray<{ path: string; sourceInfo?: SourceInfo }>;\n\t\t\texpandedSections: {\n\t\t\t\tcontext?: string;\n\t\t\t\tskills?: string;\n\t\t\t\tprompts?: string;\n\t\t\t\textensions?: string;\n\t\t\t};\n\t\t\ttargetContainer?: Container;\n\t\t}): void;\n\t\tshowLoadedResources(options?: {\n\t\t\textensions?: Array<{ path: string; sourceInfo?: SourceInfo }>;\n\t\t\tforce?: boolean;\n\t\t\tshowDiagnosticsWhenQuiet?: boolean;\n\t\t\ttargetContainer?: Container;\n\t\t}): void;\n\t\tbindCurrentSessionExtensions(): Promise<void>;\n\t\tapplyRuntimeSettings(): void;\n\t\trebindCurrentSession(): Promise<void>;\n\t\thandleFatalRuntimeError(prefix: string, error: unknown): Promise<never>;\n\t\thandleEngineDiagnostic(diagnostic: ActivityWatchdogDiagnostic): void;\n\t\trenderCurrentSessionState(): void;\n\t\tstartSessionRecovery(reason: SessionRecoveryReason): void;\n\t\tgetRegisteredToolDefinition(toolName: string): ToolRenderers | undefined;\n\t\tsetupExtensionShortcuts(extensionRunner: ExtensionRunner): void;\n\t\tsetExtensionStatus(key: string, text: string | undefined): void;\n\t\tgetWorkingLoaderMessage(): string;\n\t\tcreateWorkingLoader(): AtomicWorkingLoader;\n\t\tclearWorkingLoader(): void;\n\t\tstopWorkingLoader(): void;\n\t\tshowWorkingLoaderNow(): void;\n\t\tsetWorkingVisible(visible: boolean): void;\n\t\tsetWorkingIndicator(options?: LoaderIndicatorOptions): void;\n\t\tsetHiddenThinkingLabel(label?: string): void;\n\t\tsetExtensionWidget(\n\t\t\tkey: string,\n\t\t\tcontent: string[] | ((tui: TUI, thm: Theme) => Component & { dispose?(): void }) | undefined,\n\t\t\toptions?: ExtensionWidgetOptions,\n\t\t): void;\n\t\tclearExtensionWidgets(): void;\n\t\tresetExtensionUI(): void;\n\t\trenderWidgets(): void;\n\t\trenderWidgetContainer(\n\t\t\tcontainer: Container,\n\t\t\twidgets: Map<string, Component & { dispose?(): void }>,\n\t\t\tleadingSpacer: boolean,\n\t\t): void;\n\t\tsetExtensionFooter(\n\t\t\tfactory:\n\t\t\t\t| ((tui: TUI, thm: Theme, footerData: ReadonlyFooterDataProvider) => Component & { dispose?(): void })\n\t\t\t\t| undefined,\n\t\t): void;\n\t\tsetExtensionHeader(factory: ((tui: TUI, thm: Theme) => Component & { dispose?(): void }) | undefined): void;\n\t\taddExtensionTerminalInputListener(\n\t\t\thandler: (data: string) => { consume?: boolean; data?: string } | undefined,\n\t\t): () => void;\n\t\tclearExtensionTerminalInputListeners(): void;\n\t\tgetHostCustomUiState(): HostCustomUiState;\n\t\tnotifyHostCustomUiStateListeners(): void;\n\t\tbeginHostInlineCustomUi(purpose?: \"prompt\" | \"navigation\"): () => void;\n\t\tbeginInlineCustomUiFocusDeferral(): () => void;\n\t\tshouldDeferInlineCustomUiFocus(): boolean;\n\t\tfocusHostInlineCustomUi(): boolean;\n\t\tonHostCustomUiStateChange(listener: HostCustomUiStateListener): () => void;\n\t\tonExtensionWidgetRelease(key: string, listener: () => void): () => void;\n\t\tnotifyExtensionWidgetRelease(key: string): void;\n\t\tcreateProjectTrustContext(cwd: string): ProjectTrustContext;\n\t\tcreateExtensionUIContext(): ExtensionUIContext;\n\t\tshowExtensionSelector(\n\t\t\ttitle: string,\n\t\t\toptions: string[],\n\t\t\topts?: ExtensionUIDialogOptions,\n\t\t\tblocked?: BlockedStatus,\n\t\t): Promise<string | undefined>;\n\t\tshowExtensionConfirm(title: string, message: string, opts?: ExtensionUIDialogOptions): Promise<boolean>;\n\t\tpromptForMissingSessionCwd(error: MissingSessionCwdError): Promise<MissingSessionCwdChoice | undefined>;\n\t\tshowExtensionInput(\n\t\t\ttitle: string,\n\t\t\tplaceholder?: string,\n\t\t\topts?: ExtensionUIDialogOptions,\n\t\t): Promise<string | undefined>;\n\t\tshowExtensionEditor(\n\t\t\ttitle: string,\n\t\t\tprefill?: string,\n\t\t\topts?: ExtensionUIDialogOptions,\n\t\t): Promise<string | undefined>;\n\t\tsetCustomEditorComponent(factory: EditorFactory | undefined): void;\n\t\tshowExtensionNotify(message: string, type?: \"info\" | \"warning\" | \"error\"): void;\n\t\tshowExtensionCustom<T>(\n\t\t\tfactory: (\n\t\t\t\ttui: TUI,\n\t\t\t\ttheme: Theme,\n\t\t\t\tkeybindings: KeybindingsManager,\n\t\t\t\tdone: (result: T) => void,\n\t\t\t) => (Component & { dispose?(): void }) | Promise<Component & { dispose?(): void }>,\n\t\t\toptions?: {\n\t\t\t\tpurpose?: \"prompt\" | \"navigation\";\n\t\t\t\toverlay?: boolean;\n\t\t\t\tdeferInlineCustomUiFocus?: boolean;\n\t\t\t\thandlesInternalUiAction?: boolean;\n\t\t\t\t/** Overlay-only: bound the overlay and reserve transcript scroll extent. */\n\t\t\t\treserveTranscriptRows?: boolean;\n\t\t\t\tsignal?: AbortSignal;\n\t\t\t\toverlayOptions?: OverlayOptions | (() => OverlayOptions);\n\t\t\t\tonHandle?: (handle: OverlayHandle) => void;\n\t\t\t\tblocked?: BlockedStatus;\n\t\t\t},\n\t\t): Promise<T>;\n\t\tshowExtensionError(extensionPath: string, error: string, stack?: string): void;\n\t\tsetupKeyHandlers(): void;\n\t\thandleClipboardImagePaste(): Promise<void>;\n\t\tsetupEditorSubmitHandler(): void;\n\t\tdeliverStartupReplayPrompt(text: string): void;\n\t\tdrainStartupReplayCommands(): Promise<void>;\n\t\tadvanceStartupInputReplay(submittedText: string): void;\n\t\tsubscribeToAgent(): void;\n\t\thandleEvent(event: AgentSessionEvent | JsonAgentSessionEvent): Promise<void>;\n\t\tgetUserMessageText(message: Message): string;\n\t\tshowStatus(message: string, persist?: boolean): void;\n\t\t/** Report a managed-tool (fd/rg) readiness update inside the transcript. */\n\t\tshowManagedToolStatus(status: ToolStatus): void;\n\t\t/** Bring fd/rg to readiness after first paint; progress lands in the transcript. */\n\t\tensureManagedToolsReady(): Promise<void>;\n\t\tchatMessageRenderOptions(): ChatMessageRenderOptions;\n\t\taddRenderedChatEntry(entry: ChatMessageEntry): Component;\n\t\taddCompactionBoundaryToChat(result: VerbatimCompactionResult): void;\n\t\taddCompactionCostNotice(kind: \"compaction\" | \"branch_summary\", usage: Usage): void;\n\t\tmaybeShowAssistantDiagnostics(message: AssistantMessage): void;\n\t\tmaybeShowInstallChangeWarning(): Promise<boolean>;\n\t\taddMessageToChat(message: AgentMessage, options?: { populateHistory?: boolean }): void;\n\t\taddCustomEntryToChat(entry: CustomEntry): void;\n\t\trenderSessionContext(\n\t\t\tsessionContext: SessionContext,\n\t\t\toptions?: { updateFooter?: boolean; populateHistory?: boolean },\n\t\t): void;\n\t\trenderSessionEntries(\n\t\t\tentries: SessionEntry[],\n\t\t\toptions?: {\n\t\t\t\tupdateFooter?: boolean;\n\t\t\t\tpopulateHistory?: boolean;\n\t\t\t\tpreserveViewportInput?: boolean;\n\t\t\t\tsuppressCompactionBoundary?: VerbatimCompactionResult;\n\t\t\t\tparked?: ParkedViewport;\n\t\t\t},\n\t\t): void;\n\t\trenderInitialMessages(): void;\n\t\t/** Shows, hides or adds the \"project is not trusted\" warning after the session's trust changed. */\n\t\trefreshProjectTrustWarning(): void;\n\t\t/** Adds the \"project is not trusted\" warning at the end of the chat when the session's project is untrusted. */\n\t\tappendProjectTrustWarning(): void;\n\t\tattachStartupNoticesContainer(options?: { resetDetached?: boolean }): void;\n\t\tgetUserInput(): Promise<InteractiveSubmission>;\n\t\trunUserPromptTurn(submission: InteractiveSubmission | string): Promise<void>;\n\t\trenderDeferredUserInput(text: string): void;\n\t\tconsumeDeferredRenderedUserInput(text: string): boolean;\n\t\tdiscardDeferredRenderedUserInput(text: string): void;\n\t\texpectStartedUserInput(text: string, shownBefore: number): void;\n\t\tshowSessionUserMessage(message: Message): void;\n\t\tensureDeferredStartupComplete(): Promise<void>;\n\t\trebuildChatFromMessages(options?: {\n\t\t\tsuppressCompactionBoundary?: VerbatimCompactionResult;\n\t\t\tresetStartupDisclosure?: boolean;\n\t\t\tpreserveViewportInput?: boolean;\n\t\t}): void;\n\t\thandleCtrlC(): void;\n\t\thandleSigintSignal(): void;\n\t\tinterruptActiveOperation(): boolean;\n\t\thandleCtrlD(): void;\n\t\tshutdown(options?: { fromSignal?: boolean }): Promise<void>;\n\t\temergencyTerminalExit(): never;\n\t\tuncaughtCrash(error: Error): never;\n\t\tgetCrashExtensionHint(error: unknown): string | undefined;\n\t\tcheckShutdownRequested(): Promise<void>;\n\t\tregisterSignalHandlers(): void;\n\t\tunregisterSignalHandlers(): void;\n\t\thandleCtrlZ(): void;\n\t\thandleFollowUp(): Promise<void>;\n\t\thandleDequeue(): Promise<void>;\n\t\trefreshBuiltInHeader(): void;\n\t\tupdateEditorBorderColor(): void;\n\t\tcycleThinkingLevel(): Promise<void>;\n\t\tcycleModel(direction: \"forward\" | \"backward\"): Promise<void>;\n\t\ttoggleToolOutputExpansion(): void;\n\t\tsetToolsExpanded(expanded: boolean): void;\n\t\ttoggleThinkingBlockVisibility(): void;\n\t\tupdateThinkingBlockVisibility(): void;\n\t\topenExternalEditor(): Promise<void>;\n\t\tclearEditor(): void;\n\t\tshowError(errorMessage: string): void;\n\t\tshowWarning(warningMessage: string, targetContainer?: Container): void;\n\t\tshowNewVersionNotification(newVersion: string, targetContainer?: Container): void;\n\t\tshowPackageUpdateNotification(packages: string[], targetContainer?: Container): void;\n\t\tgetAllQueuedMessages(): { steering: string[]; followUp: string[] };\n\t\tclearAllQueues(options?: { preserveUnprotectedCustomMessages?: boolean }): Promise<{\n\t\t\tsteering: string[];\n\t\t\tfollowUp: string[];\n\t\t}>;\n\t\tupdatePendingMessagesDisplay(): void;\n\t\t/**\n\t\t * Give back what a lost isolated engine held queued: the main chat's rows to its editor, the subagent chats' rows\n\t\t * in a notice. Answers the function that stops it.\n\t\t */\n\t\tattachSteeringEngineRecovery(): () => void;\n\t\trestoreQueuedMessagesToEditor(options?: {\n\t\t\tabort?: boolean;\n\t\t\tcurrentText?: string;\n\t\t\tpreserveUnprotectedCustomMessages?: boolean;\n\t\t}): Promise<number>;\n\t\tqueueCompactionMessage(text: string, mode: \"steer\" | \"followUp\"): void;\n\t\tisExtensionCommand(text: string): boolean;\n\t\tflushCompactionQueue(options?: { willRetry?: boolean; afterPrompt?: boolean }): Promise<void>;\n\t\tflushPendingBashComponents(): void;\n\t\tshowSelector(\n\t\t\tcreate: (done: () => void) => { component: Component; focus: Component; dispose?: () => void },\n\t\t): void;\n\t\tshowSettingsSelector(): Promise<void>;\n\t\thandleModelCommand(searchTerm?: string): Promise<void>;\n\t\thandleThinkingCommand(searchTerm?: string): Promise<void>;\n\t\tselectThinkingLevel(level: ThinkingLevel): Promise<void>;\n\t\tshowThinkingSelector(): void;\n\t\tfindExactModelMatch(searchTerm: string): Promise<Model<Api> | undefined>;\n\t\tgetModelCandidates(): Promise<Model<Api>[]>;\n\t\tupdateAvailableProviderCount(): Promise<void>;\n\t\tmaybeWarnAboutAnthropicSubscriptionAuth(\n\t\t\tmodel?: Model<Api> | undefined,\n\t\t\ttargetContainer?: Container,\n\t\t): Promise<void>;\n\t\tshowModelSelector(initialSearchInput?: string): void;\n\t\tshowModelsSelector(): void;\n\t\tshowUserMessageSelector(): Promise<void>;\n\t\tshowPromptHistorySearch(): void;\n\t\thandleCloneCommand(): Promise<void>;\n\t\tmaybeSaveImplicitProjectTrustAfterReload(): Promise<boolean>;\n\t\tshowTrustSelector(): Promise<void>;\n\t\tshowTreeSelector(initialSelectedId?: string): Promise<void>;\n\t\tshowSessionSelector(): void;\n\t\thandleResumeTarget(target: string): Promise<void>;\n\t\thandleResumeSession(\n\t\t\tsessionId: string,\n\t\t\toptions?: Parameters<ExtensionCommandContext[\"switchSession\"]>[1],\n\t\t\tsessionDirectory?: string,\n\t\t): Promise<{ cancelled: boolean }>;\n\t\tswitchToForkedSession(\n\t\t\tsource: MissingCwdForkSource,\n\t\t\tcwd: string,\n\t\t\toptions?: Parameters<ExtensionCommandContext[\"switchSession\"]>[1],\n\t\t): Promise<{ cancelled: boolean }>;\n\t\tgetLoginProviderOptions(authType?: \"oauth\" | \"api_key\"): AuthSelectorProvider[];\n\t\tgetLogoutProviderOptions(): AuthSelectorProvider[];\n\t\thandleLoginCommand(providerRef?: string): Promise<void>;\n\t\tstartProviderLogin(providerOption: AuthSelectorProvider, onBack?: () => void): Promise<void>;\n\t\tshowLoginAuthTypeSelector(providerOptions?: AuthSelectorProvider[]): void;\n\t\tshowLoginProviderSelector(authType?: \"oauth\" | \"api_key\", initialSearchInput?: string): void;\n\t\tshowOAuthSelector(mode: \"login\" | \"logout\", initialSearchInput?: string): Promise<void>;\n\t\tcompleteProviderAuthentication(\n\t\t\tproviderId: string,\n\t\t\tproviderName: string,\n\t\t\tauthType: \"oauth\" | \"api_key\",\n\t\t\tpreviousModel: Model<Api> | undefined,\n\t\t\toptions?: { modelsRefreshed?: boolean },\n\t\t): Promise<void>;\n\t\tshowBedrockSetupDialog(providerId: string, providerName: string, onBack?: () => void): void;\n\t\tshowApiKeyLoginDialog(providerId: string, providerName: string, onBack?: () => void): Promise<void>;\n\t\tshowOAuthLoginSelect(dialog: LoginDialogComponent, prompt: OAuthSelectPrompt): Promise<string | undefined>;\n\t\tshowLoginDialog(providerId: string, providerName: string, onBack?: () => void): Promise<void>;\n\t\thandleReloadCommand(): Promise<void>;\n\t\thandleExportCommand(text: string): Promise<void>;\n\t\tgetPathCommandArgument(text: string, command: \"/export\" | \"/import\"): string | undefined;\n\t\thandleImportCommand(text: string): Promise<void>;\n\t\thandleShareCommand(): Promise<void>;\n\t\thandleCopyCommand(): Promise<void>;\n\t\thandleNameCommand(text: string): Promise<void>;\n\t\thandleSessionCommand(): void | Promise<void>;\n\t\thandleSessionSnapshotCommand(): Promise<void>;\n\t\thandleToolsCommand(): Promise<void>;\n\t\thandleChangelogCommand(): Promise<void>;\n\t\tgetAppKeyDisplay(action: AppKeybinding): string;\n\t\tgetEditorKeyDisplay(action: Keybinding): string;\n\t\tjumpToTranscriptEnd(): void;\n\t\tsetFullscreenCopyOnSelect(enabled: boolean): void;\n\t\thandleHotkeysCommand(): void;\n\t\thandleClearCommand(): Promise<void>;\n\t\thandleDebugCommand(): Promise<void>;\n\t\thandleArminSaysHi(): void;\n\t\thandleDementedDelves(): Promise<void>;\n\t\thandleBashCommand(command: string, excludeFromContext?: boolean): Promise<void>;\n\t\thandleCompactCommand(instructions?: string): Promise<void>;\n\t\tstop(fullscreenExitOutput?: FullscreenExitOutput): void;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interactive-mode-surface.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-mode-surface.ts"],"names":[],"mappings":"","sourcesContent":["import type { ThinkingLevel } from \"@bastani/atomic-agent-core\";\nimport type { AssistantMessage, Usage } from \"@bastani/atomic-ai/compat\";\n/** Method surface installed onto InteractiveModeBase by sibling modules. */\n\nimport type { MarkdownTransformer, SessionRecoveryReason, ToolRenderers } from \"../../core/extensions/types.ts\";\nimport type { CustomEntry, SessionEntry } from \"../../core/session-manager.ts\";\nimport type { FullscreenExitOutput } from \"../../core/settings-manager.ts\";\nimport type { ToolStatus } from \"../../utils/tools-manager.ts\";\nimport type { ActivityWatchdogDiagnostic } from \"../interactive-engine/activity-watchdog.ts\";\nimport type { JsonAgentSessionEvent } from \"../json-event.ts\";\nimport type { AtomicWorkingLoader } from \"./components/atomic-working-status.ts\";\nimport type {\n\tAgentMessage,\n\tAgentSessionEvent,\n\tApi,\n\tAppKeybinding,\n\tAuthSelectorProvider,\n\tAutocompleteProvider,\n\tChatMessageEntry,\n\tChatMessageRenderOptions,\n\tComponent,\n\tContainer,\n\tEditorFactory,\n\tExtensionCommandContext,\n\tExtensionRunner,\n\tExtensionUIContext,\n\tExtensionUIDialogOptions,\n\tExtensionWidgetOptions,\n\tHostCustomUiState,\n\tHostCustomUiStateListener,\n\tKeybinding,\n\tKeybindingsManager,\n\tLoaderIndicatorOptions,\n\tLoginDialogComponent,\n\tMarkdown,\n\tMarkdownTheme,\n\tMessage,\n\tMissingSessionCwdChoice,\n\tMissingSessionCwdError,\n\tModel,\n\tOAuthSelectPrompt,\n\tOverlayHandle,\n\tOverlayOptions,\n\tProjectTrustContext,\n\tReadonlyFooterDataProvider,\n\tResourceDiagnostic,\n\tSessionContext,\n\tSlashCommand,\n\tSourceInfo,\n\tTheme,\n\tTUI,\n\tVerbatimCompactionResult,\n} from \"./interactive-mode-deps.ts\";\nimport type { ExpandableText } from \"./interactive-mode-helpers.ts\";\nimport type { ParkedViewport } from \"./interactive-saved-chat-history.js\";\nimport type { InteractiveSubmission } from \"./interactive-submission.ts\";\nimport type { BlockedStatus } from \"./program-status-reporter.ts\";\n\n/** The session a fork for a missing cwd copies: one the active store holds, or a JSONL export outside it. */\nexport type MissingCwdForkSource =\n\t| { readonly sessionId: string; readonly sessionDirectory?: string }\n\t| { readonly exportPath: string };\n\ndeclare module \"./interactive-mode-base.ts\" {\n\tinterface InteractiveModeBase {\n\t\tgetAutocompleteSourceTag(sourceInfo?: SourceInfo): string | undefined;\n\t\tprefixAutocompleteDescription(description: string | undefined, sourceInfo?: SourceInfo): string | undefined;\n\t\tgetBuiltInCommandConflictDiagnostics(extensionRunner: ExtensionRunner): ResourceDiagnostic[];\n\t\tcreateBaseAutocompleteProvider(): AutocompleteProvider;\n\t\tbuildRemoteSlashCommands(localCommands: SlashCommand[]): SlashCommand[];\n\t\tsetupAutocompleteProvider(options?: { preserveSelection?: boolean }): void;\n\t\tshowStartupNoticesIfNeeded(targetContainer?: Container): void;\n\t\treportModelCatalogWarning(targetContainer?: Container): void;\n\t\treportedModelCatalogWarning: string | undefined;\n\t\thadLastChangelogVersionAtStartup: boolean;\n\t\tfirstRunNoticeVisible: boolean;\n\t\tfirstRunOnboardingNoticeComponents: Component[];\n\t\tinitializeFirstRunOnboardingMarkers(): void;\n\t\tisFirstRunOnboardingEligible(): boolean;\n\t\tclearFirstRunOnboardingUi(): void;\n\t\tinit(): Promise<void>;\n\t\tcompleteDeferredStartup(): Promise<void>;\n\t\tretryDeferredModelRestore(targetContainer?: Container): Promise<void>;\n\t\tupdateTerminalTitle(): void;\n\t\trun(): Promise<void>;\n\t\tcheckForPackageUpdates(): Promise<string[]>;\n\t\tcheckTmuxKeyboardSetup(): Promise<string | undefined>;\n\t\tgetChangelogForDisplay(): string | undefined;\n\t\treportInstallTelemetry(version: string): void;\n\t\tgetMarkdownThemeWithSettings(): MarkdownTheme;\n\t\tgetMarkdownTransformers(): MarkdownTransformer[];\n\t\tcreateChangelogMarkdown(markdown: string, paddingX: number, paddingY: number): Markdown;\n\t\tformatDisplayPath(p: string): string;\n\t\tformatExtensionDisplayPath(path: string): string;\n\t\tformatContextPath(p: string): string;\n\t\tgetStartupModelLabel(): string;\n\t\tgetStartupIdentityText(maxWidth?: number, gap?: number, manifestoPhase?: number): string;\n\t\tgetAtomicAnsiMarkLines(gap?: number): string[];\n\t\tgetStartupExpansionState(): boolean;\n\t\tshowFullscreenModelScopeNotice(): void;\n\t\tshouldShowStartupHeader(): boolean;\n\t\tshouldShowStartupDetails(): boolean;\n\t\tgetShortPath(fullPath: string, sourceInfo?: SourceInfo): string;\n\t\tgetCompactPathLabel(resourcePath: string, sourceInfo?: SourceInfo): string;\n\t\tgetCompactPackageSourceLabel(sourceInfo?: SourceInfo): string;\n\t\tgetCompactExtensionLabel(resourcePath: string, sourceInfo?: SourceInfo): string;\n\t\tgetCompactDisplayPathSegments(resourcePath: string): string[];\n\t\tgetCompactNonPackageExtensionLabel(\n\t\t\tresourcePath: string,\n\t\t\tindex: number,\n\t\t\tallPaths: Array<{ path: string; segments: string[] }>,\n\t\t): string;\n\t\tgetCompactExtensionLabels(extensions: Array<{ path: string; sourceInfo?: SourceInfo }>): string[];\n\t\tgetDisplaySourceInfo(sourceInfo?: SourceInfo): {\n\t\t\tlabel: string;\n\t\t\tscopeLabel?: string;\n\t\t\tcolor: \"accent\" | \"muted\";\n\t\t};\n\t\tgetScopeGroup(sourceInfo?: SourceInfo): \"user\" | \"project\" | \"path\";\n\t\tisPackageSource(sourceInfo?: SourceInfo): boolean;\n\t\tbuildScopeGroups(items: Array<{ path: string; sourceInfo?: SourceInfo }>): Array<{\n\t\t\tscope: \"user\" | \"project\" | \"path\";\n\t\t\tpaths: Array<{ path: string; sourceInfo?: SourceInfo }>;\n\t\t\tpackages: Map<string, Array<{ path: string; sourceInfo?: SourceInfo }>>;\n\t\t}>;\n\t\tformatScopeGroups(\n\t\t\tgroups: Array<{\n\t\t\t\tscope: \"user\" | \"project\" | \"path\";\n\t\t\t\tpaths: Array<{ path: string; sourceInfo?: SourceInfo }>;\n\t\t\t\tpackages: Map<string, Array<{ path: string; sourceInfo?: SourceInfo }>>;\n\t\t\t}>,\n\t\t\toptions: {\n\t\t\t\tformatPath: (item: { path: string; sourceInfo?: SourceInfo }) => string;\n\t\t\t\tformatPackagePath: (item: { path: string; sourceInfo?: SourceInfo }, source: string) => string;\n\t\t\t},\n\t\t): string;\n\t\tfindSourceInfoForPath(p: string, sourceInfos: Map<string, SourceInfo>): SourceInfo | undefined;\n\t\tformatPathWithSource(p: string, sourceInfo?: SourceInfo): string;\n\t\tformatDiagnostics(diagnostics: readonly ResourceDiagnostic[], sourceInfos: Map<string, SourceInfo>): string;\n\t\taddResourceDisclosure(options: {\n\t\t\tcontextFiles: ReadonlyArray<{ path: string }>;\n\t\t\tskills: ReadonlyArray<{ filePath: string; name: string }>;\n\t\t\tprompts: ReadonlyArray<{ filePath: string; name: string }>;\n\t\t\textensions: ReadonlyArray<{ path: string; sourceInfo?: SourceInfo }>;\n\t\t\texpandedSections: {\n\t\t\t\tcontext?: string;\n\t\t\t\tskills?: string;\n\t\t\t\tprompts?: string;\n\t\t\t\textensions?: string;\n\t\t\t};\n\t\t\ttargetContainer?: Container;\n\t\t\tkeptSections?: ReadonlyMap<string, ExpandableText>;\n\t\t}): void;\n\t\tshowLoadedResources(options?: {\n\t\t\textensions?: Array<{ path: string; sourceInfo?: SourceInfo }>;\n\t\t\tforce?: boolean;\n\t\t\tshowDiagnosticsWhenQuiet?: boolean;\n\t\t\ttargetContainer?: Container;\n\t\t\t/** Rewrite the mounted resource list keeping each section that stays, with its expansion. */\n\t\t\tkeepSections?: boolean;\n\t\t}): void;\n\t\tbindCurrentSessionExtensions(): Promise<void>;\n\t\tapplyRuntimeSettings(): void;\n\t\trebindCurrentSession(): Promise<void>;\n\t\thandleFatalRuntimeError(prefix: string, error: unknown): Promise<never>;\n\t\thandleEngineDiagnostic(diagnostic: ActivityWatchdogDiagnostic): void;\n\t\trenderCurrentSessionState(): void;\n\t\tstartSessionRecovery(reason: SessionRecoveryReason): void;\n\t\tgetRegisteredToolDefinition(toolName: string): ToolRenderers | undefined;\n\t\tsetupExtensionShortcuts(extensionRunner: ExtensionRunner): void;\n\t\tsetExtensionStatus(key: string, text: string | undefined): void;\n\t\tgetWorkingLoaderMessage(): string;\n\t\tcreateWorkingLoader(): AtomicWorkingLoader;\n\t\tclearWorkingLoader(): void;\n\t\tstopWorkingLoader(): void;\n\t\tshowWorkingLoaderNow(): void;\n\t\tsetWorkingVisible(visible: boolean): void;\n\t\tsetWorkingIndicator(options?: LoaderIndicatorOptions): void;\n\t\tsetHiddenThinkingLabel(label?: string): void;\n\t\tsetExtensionWidget(\n\t\t\tkey: string,\n\t\t\tcontent: string[] | ((tui: TUI, thm: Theme) => Component & { dispose?(): void }) | undefined,\n\t\t\toptions?: ExtensionWidgetOptions,\n\t\t): void;\n\t\tclearExtensionWidgets(): void;\n\t\tresetExtensionUI(): void;\n\t\trenderWidgets(): void;\n\t\trenderWidgetContainer(\n\t\t\tcontainer: Container,\n\t\t\twidgets: Map<string, Component & { dispose?(): void }>,\n\t\t\tleadingSpacer: boolean,\n\t\t): void;\n\t\tsetExtensionFooter(\n\t\t\tfactory:\n\t\t\t\t| ((tui: TUI, thm: Theme, footerData: ReadonlyFooterDataProvider) => Component & { dispose?(): void })\n\t\t\t\t| undefined,\n\t\t): void;\n\t\tsetExtensionHeader(factory: ((tui: TUI, thm: Theme) => Component & { dispose?(): void }) | undefined): void;\n\t\taddExtensionTerminalInputListener(\n\t\t\thandler: (data: string) => { consume?: boolean; data?: string } | undefined,\n\t\t): () => void;\n\t\tclearExtensionTerminalInputListeners(): void;\n\t\tgetHostCustomUiState(): HostCustomUiState;\n\t\tnotifyHostCustomUiStateListeners(): void;\n\t\tbeginHostInlineCustomUi(purpose?: \"prompt\" | \"navigation\"): () => void;\n\t\tbeginInlineCustomUiFocusDeferral(): () => void;\n\t\tshouldDeferInlineCustomUiFocus(): boolean;\n\t\tfocusHostInlineCustomUi(): boolean;\n\t\tonHostCustomUiStateChange(listener: HostCustomUiStateListener): () => void;\n\t\tonExtensionWidgetRelease(key: string, listener: () => void): () => void;\n\t\tnotifyExtensionWidgetRelease(key: string): void;\n\t\tcreateProjectTrustContext(cwd: string): ProjectTrustContext;\n\t\tcreateExtensionUIContext(): ExtensionUIContext;\n\t\tshowExtensionSelector(\n\t\t\ttitle: string,\n\t\t\toptions: string[],\n\t\t\topts?: ExtensionUIDialogOptions,\n\t\t\tblocked?: BlockedStatus,\n\t\t): Promise<string | undefined>;\n\t\tshowExtensionConfirm(title: string, message: string, opts?: ExtensionUIDialogOptions): Promise<boolean>;\n\t\tpromptForMissingSessionCwd(error: MissingSessionCwdError): Promise<MissingSessionCwdChoice | undefined>;\n\t\tshowExtensionInput(\n\t\t\ttitle: string,\n\t\t\tplaceholder?: string,\n\t\t\topts?: ExtensionUIDialogOptions,\n\t\t): Promise<string | undefined>;\n\t\tshowExtensionEditor(\n\t\t\ttitle: string,\n\t\t\tprefill?: string,\n\t\t\topts?: ExtensionUIDialogOptions,\n\t\t): Promise<string | undefined>;\n\t\tsetCustomEditorComponent(factory: EditorFactory | undefined): void;\n\t\tshowExtensionNotify(message: string, type?: \"info\" | \"warning\" | \"error\"): void;\n\t\tshowExtensionCustom<T>(\n\t\t\tfactory: (\n\t\t\t\ttui: TUI,\n\t\t\t\ttheme: Theme,\n\t\t\t\tkeybindings: KeybindingsManager,\n\t\t\t\tdone: (result: T) => void,\n\t\t\t) => (Component & { dispose?(): void }) | Promise<Component & { dispose?(): void }>,\n\t\t\toptions?: {\n\t\t\t\tpurpose?: \"prompt\" | \"navigation\";\n\t\t\t\toverlay?: boolean;\n\t\t\t\tdeferInlineCustomUiFocus?: boolean;\n\t\t\t\thandlesInternalUiAction?: boolean;\n\t\t\t\t/** Overlay-only: bound the overlay and reserve transcript scroll extent. */\n\t\t\t\treserveTranscriptRows?: boolean;\n\t\t\t\tsignal?: AbortSignal;\n\t\t\t\toverlayOptions?: OverlayOptions | (() => OverlayOptions);\n\t\t\t\tonHandle?: (handle: OverlayHandle) => void;\n\t\t\t\tblocked?: BlockedStatus;\n\t\t\t},\n\t\t): Promise<T>;\n\t\tshowExtensionError(extensionPath: string, error: string, stack?: string): void;\n\t\tsetupKeyHandlers(): void;\n\t\thandleClipboardImagePaste(): Promise<void>;\n\t\tsetupEditorSubmitHandler(): void;\n\t\tdeliverStartupReplayPrompt(text: string): void;\n\t\tdrainStartupReplayCommands(): Promise<void>;\n\t\tadvanceStartupInputReplay(submittedText: string): void;\n\t\tsubscribeToAgent(): void;\n\t\thandleEvent(event: AgentSessionEvent | JsonAgentSessionEvent): Promise<void>;\n\t\tgetUserMessageText(message: Message): string;\n\t\tshowStatus(message: string, persist?: boolean): void;\n\t\t/** Report a managed-tool (fd/rg) readiness update inside the transcript. */\n\t\tshowManagedToolStatus(status: ToolStatus): void;\n\t\t/** Bring fd/rg to readiness after first paint; progress lands in the transcript. */\n\t\tensureManagedToolsReady(): Promise<void>;\n\t\tchatMessageRenderOptions(): ChatMessageRenderOptions;\n\t\taddRenderedChatEntry(entry: ChatMessageEntry): Component;\n\t\taddCompactionBoundaryToChat(result: VerbatimCompactionResult): void;\n\t\taddCompactionCostNotice(kind: \"compaction\" | \"branch_summary\", usage: Usage): void;\n\t\tmaybeShowAssistantDiagnostics(message: AssistantMessage): void;\n\t\tmaybeShowInstallChangeWarning(): Promise<boolean>;\n\t\taddMessageToChat(message: AgentMessage, options?: { populateHistory?: boolean }): void;\n\t\taddCustomEntryToChat(entry: CustomEntry): void;\n\t\trenderSessionContext(\n\t\t\tsessionContext: SessionContext,\n\t\t\toptions?: { updateFooter?: boolean; populateHistory?: boolean },\n\t\t): void;\n\t\trenderSessionEntries(\n\t\t\tentries: SessionEntry[],\n\t\t\toptions?: {\n\t\t\t\tupdateFooter?: boolean;\n\t\t\t\tpopulateHistory?: boolean;\n\t\t\t\tpreserveViewportInput?: boolean;\n\t\t\t\tsuppressCompactionBoundary?: VerbatimCompactionResult;\n\t\t\t\tparked?: ParkedViewport;\n\t\t\t},\n\t\t): void;\n\t\trenderInitialMessages(): void;\n\t\t/** Shows, hides or adds the \"project is not trusted\" warning after the session's trust changed. */\n\t\trefreshProjectTrustWarning(): void;\n\t\t/** Adds the \"project is not trusted\" warning at the end of the chat when the session's project is untrusted. */\n\t\tappendProjectTrustWarning(): void;\n\t\tattachStartupNoticesContainer(options?: { resetDetached?: boolean }): void;\n\t\tgetUserInput(): Promise<InteractiveSubmission>;\n\t\trunUserPromptTurn(submission: InteractiveSubmission | string): Promise<void>;\n\t\trenderDeferredUserInput(text: string): void;\n\t\tconsumeDeferredRenderedUserInput(text: string): boolean;\n\t\tdiscardDeferredRenderedUserInput(text: string): void;\n\t\texpectStartedUserInput(text: string, shownBefore: number): void;\n\t\tshowSessionUserMessage(message: Message): void;\n\t\tensureDeferredStartupComplete(): Promise<void>;\n\t\trebuildChatFromMessages(options?: {\n\t\t\tsuppressCompactionBoundary?: VerbatimCompactionResult;\n\t\t\tresetStartupDisclosure?: boolean;\n\t\t\tpreserveViewportInput?: boolean;\n\t\t}): void;\n\t\thandleCtrlC(): void;\n\t\thandleSigintSignal(): void;\n\t\tinterruptActiveOperation(): boolean;\n\t\thandleCtrlD(): void;\n\t\tshutdown(options?: { fromSignal?: boolean }): Promise<void>;\n\t\thandleTerminalLost(): void;\n\t\temergencyTerminalExit(): never;\n\t\tuncaughtCrash(error: Error): never;\n\t\tgetCrashExtensionHint(error: unknown): string | undefined;\n\t\tcheckShutdownRequested(): Promise<void>;\n\t\tregisterSignalHandlers(): void;\n\t\tunregisterSignalHandlers(): void;\n\t\thandleCtrlZ(): void;\n\t\thandleFollowUp(): Promise<void>;\n\t\thandleDequeue(): Promise<void>;\n\t\trefreshBuiltInHeader(): void;\n\t\tupdateEditorBorderColor(): void;\n\t\tcycleThinkingLevel(): Promise<void>;\n\t\tcycleModel(direction: \"forward\" | \"backward\"): Promise<void>;\n\t\ttoggleToolOutputExpansion(): void;\n\t\tsetToolsExpanded(expanded: boolean): void;\n\t\ttoggleThinkingBlockVisibility(): void;\n\t\tupdateThinkingBlockVisibility(): void;\n\t\topenExternalEditor(): Promise<void>;\n\t\tclearEditor(): void;\n\t\tshowError(errorMessage: string): void;\n\t\tshowWarning(warningMessage: string, targetContainer?: Container): void;\n\t\tshowNewVersionNotification(newVersion: string, targetContainer?: Container): void;\n\t\tshowPackageUpdateNotification(packages: string[], targetContainer?: Container): void;\n\t\tgetAllQueuedMessages(): { steering: string[]; followUp: string[] };\n\t\tclearAllQueues(options?: { preserveUnprotectedCustomMessages?: boolean }): Promise<{\n\t\t\tsteering: string[];\n\t\t\tfollowUp: string[];\n\t\t}>;\n\t\tupdatePendingMessagesDisplay(): void;\n\t\t/**\n\t\t * Give back what a lost isolated engine held queued: the main chat's rows to its editor, the subagent chats' rows\n\t\t * in a notice. Answers the function that stops it.\n\t\t */\n\t\tattachSteeringEngineRecovery(): () => void;\n\t\trestoreQueuedMessagesToEditor(options?: {\n\t\t\tabort?: boolean;\n\t\t\tcurrentText?: string;\n\t\t\tpreserveUnprotectedCustomMessages?: boolean;\n\t\t}): Promise<number>;\n\t\tqueueCompactionMessage(text: string, mode: \"steer\" | \"followUp\"): void;\n\t\tisExtensionCommand(text: string): boolean;\n\t\tflushCompactionQueue(options?: { willRetry?: boolean; afterPrompt?: boolean }): Promise<void>;\n\t\tflushPendingBashComponents(): void;\n\t\tshowSelector(\n\t\t\tcreate: (done: () => void) => { component: Component; focus: Component; dispose?: () => void },\n\t\t): void;\n\t\tshowSettingsSelector(): Promise<void>;\n\t\thandleModelCommand(searchTerm?: string): Promise<void>;\n\t\thandleThinkingCommand(searchTerm?: string): Promise<void>;\n\t\tselectThinkingLevel(level: ThinkingLevel): Promise<void>;\n\t\tshowThinkingSelector(): void;\n\t\tfindExactModelMatch(searchTerm: string): Promise<Model<Api> | undefined>;\n\t\tgetModelCandidates(): Promise<Model<Api>[]>;\n\t\tupdateAvailableProviderCount(): Promise<void>;\n\t\tmaybeWarnAboutAnthropicSubscriptionAuth(\n\t\t\tmodel?: Model<Api> | undefined,\n\t\t\ttargetContainer?: Container,\n\t\t): Promise<void>;\n\t\tshowModelSelector(initialSearchInput?: string): void;\n\t\tshowModelsSelector(): void;\n\t\tshowUserMessageSelector(): Promise<void>;\n\t\tshowPromptHistorySearch(): void;\n\t\thandleCloneCommand(): Promise<void>;\n\t\tmaybeSaveImplicitProjectTrustAfterReload(): Promise<boolean>;\n\t\tshowTrustSelector(): Promise<void>;\n\t\tshowTreeSelector(initialSelectedId?: string): Promise<void>;\n\t\tshowSessionSelector(): void;\n\t\thandleResumeTarget(target: string): Promise<void>;\n\t\thandleResumeSession(\n\t\t\tsessionId: string,\n\t\t\toptions?: Parameters<ExtensionCommandContext[\"switchSession\"]>[1],\n\t\t\tsessionDirectory?: string,\n\t\t): Promise<{ cancelled: boolean }>;\n\t\tswitchToForkedSession(\n\t\t\tsource: MissingCwdForkSource,\n\t\t\tcwd: string,\n\t\t\toptions?: Parameters<ExtensionCommandContext[\"switchSession\"]>[1],\n\t\t): Promise<{ cancelled: boolean }>;\n\t\tgetLoginProviderOptions(authType?: \"oauth\" | \"api_key\"): AuthSelectorProvider[];\n\t\tgetLogoutProviderOptions(): AuthSelectorProvider[];\n\t\thandleLoginCommand(providerRef?: string): Promise<void>;\n\t\tstartProviderLogin(providerOption: AuthSelectorProvider, onBack?: () => void): Promise<void>;\n\t\tshowLoginAuthTypeSelector(providerOptions?: AuthSelectorProvider[]): void;\n\t\tshowLoginProviderSelector(authType?: \"oauth\" | \"api_key\", initialSearchInput?: string): void;\n\t\tshowOAuthSelector(mode: \"login\" | \"logout\", initialSearchInput?: string): Promise<void>;\n\t\tcompleteProviderAuthentication(\n\t\t\tproviderId: string,\n\t\t\tproviderName: string,\n\t\t\tauthType: \"oauth\" | \"api_key\",\n\t\t\tpreviousModel: Model<Api> | undefined,\n\t\t\toptions?: { modelsRefreshed?: boolean },\n\t\t): Promise<void>;\n\t\tshowBedrockSetupDialog(providerId: string, providerName: string, onBack?: () => void): void;\n\t\tshowApiKeyLoginDialog(providerId: string, providerName: string, onBack?: () => void): Promise<void>;\n\t\tshowOAuthLoginSelect(dialog: LoginDialogComponent, prompt: OAuthSelectPrompt): Promise<string | undefined>;\n\t\tshowLoginDialog(providerId: string, providerName: string, onBack?: () => void): Promise<void>;\n\t\thandleReloadCommand(): Promise<void>;\n\t\thandleExportCommand(text: string): Promise<void>;\n\t\tgetPathCommandArgument(text: string, command: \"/export\" | \"/import\"): string | undefined;\n\t\thandleImportCommand(text: string): Promise<void>;\n\t\thandleShareCommand(): Promise<void>;\n\t\thandleCopyCommand(): Promise<void>;\n\t\thandleNameCommand(text: string): Promise<void>;\n\t\thandleSessionCommand(): void | Promise<void>;\n\t\thandleSessionSnapshotCommand(): Promise<void>;\n\t\thandleToolsCommand(): Promise<void>;\n\t\thandleChangelogCommand(): Promise<void>;\n\t\tgetAppKeyDisplay(action: AppKeybinding): string;\n\t\tgetEditorKeyDisplay(action: Keybinding): string;\n\t\tjumpToTranscriptEnd(): void;\n\t\tsetFullscreenCopyOnSelect(enabled: boolean): void;\n\t\thandleHotkeysCommand(): void;\n\t\thandleClearCommand(): Promise<void>;\n\t\thandleDebugCommand(): Promise<void>;\n\t\thandleArminSaysHi(): void;\n\t\thandleDementedDelves(): Promise<void>;\n\t\thandleBashCommand(command: string, excludeFromContext?: boolean): Promise<void>;\n\t\thandleCompactCommand(instructions?: string): Promise<void>;\n\t\tstop(fullscreenExitOutput?: FullscreenExitOutput): void;\n\t}\n}\n"]}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { findExtensionStackMatches } from "../../core/crash-log.js";
|
|
2
2
|
import { markEventLoopShutdown } from "../../core/event-loop-monitor.js";
|
|
3
3
|
import { killSupervisedProcessTrees } from "../../core/tasks/supervisor.js";
|
|
4
|
-
import { terminateInteractiveEngine } from "../interactive-engine/extension-ui-bridge.js";
|
|
4
|
+
import { gracefullyStoppedEnginePids, terminateInteractiveEngine } from "../interactive-engine/extension-ui-bridge.js";
|
|
5
|
+
import { ENGINE_SHUTDOWN_GRACE_MS } from "../rpc/rpc-client-process.js";
|
|
5
6
|
import { promptHandle } from "./agent-view/agent-drafts.js";
|
|
6
7
|
import { dequeueViewedAgent, followUpViewedAgent, interruptViewedAgent, leaveViewedAgent, } from "./agent-view/viewed-submit.js";
|
|
7
8
|
import { InteractiveModeBase } from "./interactive-mode-base.js";
|
|
@@ -16,6 +17,30 @@ import { isWindowsSubshellActive, openWindowsSubshell } from "./interactive-wind
|
|
|
16
17
|
const CTRL_C_EXIT_WINDOW_MS = 800;
|
|
17
18
|
const SHUTDOWN_INPUT_DRAIN_MAX_MS = 250;
|
|
18
19
|
const SHUTDOWN_INPUT_DRAIN_IDLE_MS = 50;
|
|
20
|
+
/** Exit status once the terminal is gone, as for a process ended by SIGHUP. */
|
|
21
|
+
const TERMINAL_LOST_EXIT_CODE = 129;
|
|
22
|
+
/**
|
|
23
|
+
* Once the terminal is gone, the longest the session's shutdown may take before Atomic ends anyway: the interactive
|
|
24
|
+
* engine's grace period, then its guardian's and its tree kill's windows.
|
|
25
|
+
*/
|
|
26
|
+
const TERMINAL_LOST_SHUTDOWN_MS = ENGINE_SHUTDOWN_GRACE_MS + 1_000;
|
|
27
|
+
const hostEndings = new WeakMap();
|
|
28
|
+
function hostEnding(mode) {
|
|
29
|
+
let ending = hostEndings.get(mode);
|
|
30
|
+
if (!ending) {
|
|
31
|
+
const { promise, resolve } = Promise.withResolvers();
|
|
32
|
+
ending = { sigterms: 0, terminalLost: false, terminalLoss: promise, settleTerminalLoss: () => resolve() };
|
|
33
|
+
hostEndings.set(mode, ending);
|
|
34
|
+
}
|
|
35
|
+
return ending;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Leave the interactive engine to the shutdown, and end every other child this host tracks at once. The shutdown asks
|
|
39
|
+
* the engine to stop as one whose host was signalled, and the engine then ends its process group itself as it exits.
|
|
40
|
+
*/
|
|
41
|
+
function spareEngineFromKill(mode) {
|
|
42
|
+
killTrackedDetachedChildren(gracefullyStoppedEnginePids(mode.runtimeHost));
|
|
43
|
+
}
|
|
19
44
|
/**
|
|
20
45
|
* Ctrl+C, in order: text in the editor is cleared; otherwise running work stops at once (as Escape does); otherwise
|
|
21
46
|
* the first press says how to exit and a second press within {@link CTRL_C_EXIT_WINDOW_MS} exits. Clearing text or
|
|
@@ -110,30 +135,68 @@ InteractiveModeBase.prototype.shutdown = async function (options) {
|
|
|
110
135
|
// Keep signal handlers registered until terminal cleanup has completed.
|
|
111
136
|
// `signal-exit` checks the listener list during the same SIGTERM/SIGHUP
|
|
112
137
|
// dispatch and re-sends the signal if only its own listeners remain.
|
|
138
|
+
const ending = hostEnding(this);
|
|
113
139
|
if (options?.fromSignal) {
|
|
114
140
|
await this.runtimeHost.dispose({ fromSignal: true });
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
141
|
+
// A terminal that is gone is not restored.
|
|
142
|
+
if (!ending.terminalLost) {
|
|
143
|
+
this.themeController.disableAutoSync();
|
|
144
|
+
// Drain any in-flight Kitty key release events briefly before stopping.
|
|
145
|
+
// Keep this bounded so Ctrl+C exits do not feel stalled on Windows.
|
|
146
|
+
await this.ui.terminal.drainInput(SHUTDOWN_INPUT_DRAIN_MAX_MS, SHUTDOWN_INPUT_DRAIN_IDLE_MS);
|
|
147
|
+
stopTerminal(this);
|
|
148
|
+
}
|
|
149
|
+
process.exit(ending.terminalLost ? TERMINAL_LOST_EXIT_CODE : 0);
|
|
121
150
|
}
|
|
122
151
|
// Drain any in-flight Kitty key release events briefly before stopping.
|
|
123
152
|
// Keep this bounded so Ctrl+C exits do not feel stalled on Windows.
|
|
124
153
|
this.themeController.disableAutoSync();
|
|
125
|
-
|
|
126
|
-
|
|
154
|
+
if (!ending.terminalLost) {
|
|
155
|
+
await this.ui.terminal.drainInput(SHUTDOWN_INPUT_DRAIN_MAX_MS, SHUTDOWN_INPUT_DRAIN_IDLE_MS);
|
|
156
|
+
}
|
|
157
|
+
// Output for a terminal that is gone is never written, so its end is not waited for.
|
|
158
|
+
await Promise.race([chatHistoryBuilt(this.chatContainer), ending.terminalLoss]);
|
|
127
159
|
this.writeExitOutputInSlices = true;
|
|
128
|
-
this
|
|
129
|
-
await this.exitOutputWritten;
|
|
160
|
+
stopTerminal(this);
|
|
161
|
+
await Promise.race([this.exitOutputWritten, ending.terminalLoss]);
|
|
130
162
|
await this.runtimeHost.dispose();
|
|
163
|
+
if (ending.terminalLost)
|
|
164
|
+
process.exit(TERMINAL_LOST_EXIT_CODE);
|
|
131
165
|
const resumeCommand = await formatResumeCommand(this.sessionManager);
|
|
132
166
|
if (resumeCommand) {
|
|
133
167
|
process.stdout.write(`${chalk.dim("To resume this session:")} ${resumeCommand}\n`);
|
|
134
168
|
}
|
|
135
169
|
process.exit(0);
|
|
136
170
|
};
|
|
171
|
+
/** Stop the TUI. When the terminal turns out to be gone, the shutdown goes on without restoring it. */
|
|
172
|
+
function stopTerminal(mode) {
|
|
173
|
+
try {
|
|
174
|
+
mode.stop();
|
|
175
|
+
}
|
|
176
|
+
catch (error) {
|
|
177
|
+
if (!isDeadTerminalError(error))
|
|
178
|
+
throw error;
|
|
179
|
+
mode.handleTerminalLost();
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* The terminal is gone, as when its window is closed. The session shuts down as it does on SIGHUP, which a closing
|
|
184
|
+
* terminal sends too, so the interactive engine (or, without one, the session's own extensions) still runs its
|
|
185
|
+
* shutdown. Other children end at once, nothing is drawn or restored, and Atomic exits with status 129 once the
|
|
186
|
+
* session has shut down, or after {@link TERMINAL_LOST_SHUTDOWN_MS} at the latest.
|
|
187
|
+
*/
|
|
188
|
+
InteractiveModeBase.prototype.handleTerminalLost = function () {
|
|
189
|
+
const ending = hostEnding(this);
|
|
190
|
+
if (ending.terminalLost)
|
|
191
|
+
return;
|
|
192
|
+
ending.terminalLost = true;
|
|
193
|
+
ending.settleTerminalLoss();
|
|
194
|
+
spareEngineFromKill(this);
|
|
195
|
+
killSupervisedProcessTrees();
|
|
196
|
+
setTimeout(() => this.emergencyTerminalExit(), TERMINAL_LOST_SHUTDOWN_MS);
|
|
197
|
+
// A quit or a signal that is already shutting the session down goes on as it started.
|
|
198
|
+
void this.shutdown({ fromSignal: true });
|
|
199
|
+
};
|
|
137
200
|
InteractiveModeBase.prototype.emergencyTerminalExit = function () {
|
|
138
201
|
this.isShuttingDown = true;
|
|
139
202
|
this.unregisterSignalHandlers();
|
|
@@ -141,7 +204,7 @@ InteractiveModeBase.prototype.emergencyTerminalExit = function () {
|
|
|
141
204
|
killSupervisedProcessTrees();
|
|
142
205
|
// The terminal is gone. Do not run normal shutdown because TUI and
|
|
143
206
|
// extension cleanup can write restore sequences and re-trigger EIO.
|
|
144
|
-
process.exit(
|
|
207
|
+
process.exit(TERMINAL_LOST_EXIT_CODE);
|
|
145
208
|
};
|
|
146
209
|
InteractiveModeBase.prototype.uncaughtCrash = function (error) {
|
|
147
210
|
if (isDeadTerminalError(error) && error.syscall === "setRawMode") {
|
|
@@ -192,7 +255,16 @@ InteractiveModeBase.prototype.registerSignalHandlers = function () {
|
|
|
192
255
|
}
|
|
193
256
|
for (const signal of signals) {
|
|
194
257
|
const handler = () => {
|
|
195
|
-
|
|
258
|
+
const ending = hostEnding(this);
|
|
259
|
+
if (signal === "SIGTERM")
|
|
260
|
+
ending.sigterms += 1;
|
|
261
|
+
// The interactive engine is left to the shutdown, which gives it the bounded window a quit gives it to run
|
|
262
|
+
// its extensions' shutdown. A closing terminal sends SIGHUP more than once, as the shell in it passes one on
|
|
263
|
+
// and the kernel sends another when that shell exits, so only a repeated SIGTERM ends every child at once.
|
|
264
|
+
if (ending.sigterms > 1)
|
|
265
|
+
killTrackedDetachedChildren();
|
|
266
|
+
else
|
|
267
|
+
spareEngineFromKill(this);
|
|
196
268
|
void this.shutdown({ fromSignal: true });
|
|
197
269
|
};
|
|
198
270
|
process.prependListener(signal, handler);
|
|
@@ -204,15 +276,22 @@ InteractiveModeBase.prototype.registerSignalHandlers = function () {
|
|
|
204
276
|
process.prependListener("SIGINT", sigintHandler);
|
|
205
277
|
this.signalCleanupHandlers.push(() => process.off("SIGINT", sigintHandler));
|
|
206
278
|
const terminalErrorHandler = (error) => {
|
|
207
|
-
if (isDeadTerminalError(error))
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
throw error;
|
|
279
|
+
if (!isDeadTerminalError(error))
|
|
280
|
+
throw error;
|
|
281
|
+
this.handleTerminalLost();
|
|
211
282
|
};
|
|
212
283
|
for (const stream of [process.stdin, process.stdout, process.stderr]) {
|
|
213
284
|
stream.on("error", terminalErrorHandler);
|
|
214
285
|
this.signalCleanupHandlers.push(() => stream.off("error", terminalErrorHandler));
|
|
215
286
|
}
|
|
287
|
+
// A terminal's input ends only when the terminal is gone: a key never ends it in raw mode. It ends before the
|
|
288
|
+
// closing terminal's signals arrive, and a session with nothing else to do would otherwise end at once.
|
|
289
|
+
const terminalInputEndHandler = () => {
|
|
290
|
+
if (process.stdin.isTTY)
|
|
291
|
+
this.handleTerminalLost();
|
|
292
|
+
};
|
|
293
|
+
process.stdin.on("end", terminalInputEndHandler);
|
|
294
|
+
this.signalCleanupHandlers.push(() => process.stdin.off("end", terminalInputEndHandler));
|
|
216
295
|
// Restore the terminal before the process dies on any uncaught throw.
|
|
217
296
|
// Without this, an unhandled exception from extension code (or anywhere
|
|
218
297
|
// in pi) leaves the terminal in raw mode with no cursor.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-process-lifecycle.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-process-lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EAAE,0BAA0B,EAAE,MAAM,8CAA8C,CAAC;AAC1F,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EACN,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,gBAAgB,GAChB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AAC3F,OAAO,EAAE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AA6B,EAAE,CAAC;QAC5D,IAAI,QAAQ,KAAK,CAAC,EAAE,CAAC;YACpB,IAAI,CAAC,UAAU,CAAC,+BAA+B,CAAC,CAAC;QAClD,CAAC;IACF,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,uBAAuB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACtC,CAAC;AACF,CAAC,CAAC","sourcesContent":["import { findExtensionStackMatches } from \"../../core/crash-log.ts\";\nimport { markEventLoopShutdown } from \"../../core/event-loop-monitor.ts\";\nimport { killSupervisedProcessTrees } from \"../../core/tasks/supervisor.js\";\nimport { terminateInteractiveEngine } from \"../interactive-engine/extension-ui-bridge.ts\";\nimport { promptHandle } from \"./agent-view/agent-drafts.ts\";\nimport {\n\tdequeueViewedAgent,\n\tfollowUpViewedAgent,\n\tinterruptViewedAgent,\n\tleaveViewedAgent,\n} from \"./agent-view/viewed-submit.ts\";\nimport { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { APP_TITLE, chalk, killTrackedDetachedChildren } from \"./interactive-mode-deps.ts\";\nimport { formatCrashExtensionHint, formatResumeCommand, isDeadTerminalError } from \"./interactive-mode-helpers.ts\";\nimport { pauseAndAbortInteractiveSession } from \"./interactive-pause.ts\";\nimport { restoreFailedSubmissionDraft, restoreRefusedSubmission } from \"./interactive-prompt-restore.ts\";\nimport { handOffCompactionQueue, mainSteering, showQueueRestoreFailure } from \"./interactive-queueing.ts\";\nimport { chatHistoryBuilt } from \"./interactive-startup-chat-container.ts\";\nimport { isWindowsSubshellActive, openWindowsSubshell } from \"./interactive-windows-subshell.ts\";\n\n/** A second Ctrl+C on an empty, idle editor within this window exits. */\nconst CTRL_C_EXIT_WINDOW_MS = 800;\nconst SHUTDOWN_INPUT_DRAIN_MAX_MS = 250;\nconst SHUTDOWN_INPUT_DRAIN_IDLE_MS = 50;\n\n/**\n * Ctrl+C, in order: text in the editor is cleared; otherwise running work stops at once (as Escape does); otherwise\n * the first press says how to exit and a second press within {@link CTRL_C_EXIT_WINDOW_MS} exits. Clearing text or\n * stopping work never counts toward the exit, so a press meant for either cannot quit Atomic.\n */\nInteractiveModeBase.prototype.handleCtrlC = function (this: InteractiveModeBase): void {\n\tif (isWindowsSubshellActive(this)) return;\n\tif (this.editor.getText() !== \"\") {\n\t\tthis.clearEditor();\n\t\tthis.lastSigintTime = 0;\n\t\treturn;\n\t}\n\t// While a subagent is shown, an empty prompt's Ctrl+C pauses its work and shows main; it never exits from there.\n\t// An engine that owes an abort is still terminated first, as the watchdog advertises.\n\tif (this.agentView?.viewed.kind === \"agent\" && !terminateInteractiveEngine(this.runtimeHost)) {\n\t\tleaveViewedAgent(this);\n\t\tthis.lastSigintTime = 0;\n\t\treturn;\n\t}\n\tif (this.interruptActiveOperation()) {\n\t\tthis.lastSigintTime = 0;\n\t\treturn;\n\t}\n\tconst now = Date.now();\n\tif (now - this.lastSigintTime < CTRL_C_EXIT_WINDOW_MS) {\n\t\tvoid this.shutdown();\n\t\treturn;\n\t}\n\tthis.lastSigintTime = now;\n\tthis.showStatus(\"Press Ctrl+C again to exit\");\n};\n\n/**\n * A SIGINT signal, as opposed to the Ctrl+C key. In raw mode the keyboard sends Ctrl+C to the\n * editor as input, so a signal came from outside the TUI: on Windows, any process attached to\n * the same console that raises a console control event. It may interrupt running work, as the\n * key does, but never clears the editor or counts toward the double-press exit.\n */\nInteractiveModeBase.prototype.handleSigintSignal = function (this: InteractiveModeBase): void {\n\tif (!process.stdin.isTTY || !process.stdin.isRaw) {\n\t\tthis.handleCtrlC();\n\t\treturn;\n\t}\n\tif (isWindowsSubshellActive(this)) return;\n\tif (this.interruptActiveOperation()) this.lastSigintTime = 0;\n};\n\nInteractiveModeBase.prototype.interruptActiveOperation = function (this: InteractiveModeBase): boolean {\n\t// Mirror the Escape interrupt paths so Ctrl+C aborts whichever operation is\n\t// currently running. Returns true when something was aborted.\n\t//\n\t// Escalate first when the interactive engine owes a cooperative abort or the\n\t// heartbeat watchdog calls it unresponsive: that is the explicit termination\n\t// the watchdog advertises with \"Esc interrupt · Ctrl+C terminate\". Every\n\t// cooperative route below would otherwise queue another request for a child\n\t// that cannot answer.\n\tif (terminateInteractiveEngine(this.runtimeHost)) {\n\t\treturn true;\n\t}\n\t// While a subagent is shown, its running work is the one stopped, as Esc stops it; main's goes on.\n\tconst viewed = interruptViewedAgent(this);\n\tif (viewed !== undefined) return viewed;\n\tif (this.session.isStreaming || this.session.agent.hasQueuedMessages()) {\n\t\tpauseAndAbortInteractiveSession(this);\n\t\treturn true;\n\t}\n\tif (this.session.isBashRunning) {\n\t\tthis.session.abortBash();\n\t\treturn true;\n\t}\n\tif (this.session.isCompacting) {\n\t\tthis.session.abortCompaction();\n\t\treturn true;\n\t}\n\tif (this.session.isRetrying) {\n\t\tthis.session.abortRetry();\n\t\treturn true;\n\t}\n\treturn false;\n};\n\nInteractiveModeBase.prototype.handleCtrlD = function (this: InteractiveModeBase): void {\n\t// Only called when editor is empty (enforced by CustomEditor)\n\tvoid this.shutdown();\n};\n\nInteractiveModeBase.prototype.shutdown = async function (\n\tthis: InteractiveModeBase,\n\toptions?: { fromSignal?: boolean },\n): Promise<void> {\n\tif (this.isShuttingDown) return;\n\tthis.isShuttingDown = true;\n\tmarkEventLoopShutdown();\n\t// Keep signal handlers registered until terminal cleanup has completed.\n\t// `signal-exit` checks the listener list during the same SIGTERM/SIGHUP\n\t// dispatch and re-sends the signal if only its own listeners remain.\n\n\tif (options?.fromSignal) {\n\t\tawait this.runtimeHost.dispose({ fromSignal: true });\n\t\tthis.themeController.disableAutoSync();\n\t\t// Drain any in-flight Kitty key release events briefly before stopping.\n\t\t// Keep this bounded so Ctrl+C exits do not feel stalled on Windows.\n\t\tawait this.ui.terminal.drainInput(SHUTDOWN_INPUT_DRAIN_MAX_MS, SHUTDOWN_INPUT_DRAIN_IDLE_MS);\n\t\tthis.stop();\n\t\tprocess.exit(0);\n\t}\n\n\t// Drain any in-flight Kitty key release events briefly before stopping.\n\t// Keep this bounded so Ctrl+C exits do not feel stalled on Windows.\n\tthis.themeController.disableAutoSync();\n\tawait this.ui.terminal.drainInput(SHUTDOWN_INPUT_DRAIN_MAX_MS, SHUTDOWN_INPUT_DRAIN_IDLE_MS);\n\n\tawait chatHistoryBuilt(this.chatContainer);\n\tthis.writeExitOutputInSlices = true;\n\tthis.stop();\n\tawait this.exitOutputWritten;\n\tawait this.runtimeHost.dispose();\n\tconst resumeCommand = await formatResumeCommand(this.sessionManager);\n\tif (resumeCommand) {\n\t\tprocess.stdout.write(`${chalk.dim(\"To resume this session:\")} ${resumeCommand}\\n`);\n\t}\n\tprocess.exit(0);\n};\n\nInteractiveModeBase.prototype.emergencyTerminalExit = function (this: InteractiveModeBase): never {\n\tthis.isShuttingDown = true;\n\tthis.unregisterSignalHandlers();\n\tkillTrackedDetachedChildren();\n\tkillSupervisedProcessTrees();\n\t// The terminal is gone. Do not run normal shutdown because TUI and\n\t// extension cleanup can write restore sequences and re-trigger EIO.\n\tprocess.exit(129);\n};\n\nInteractiveModeBase.prototype.uncaughtCrash = function (this: InteractiveModeBase, error: Error): never {\n\tif (isDeadTerminalError(error) && (error as NodeJS.ErrnoException).syscall === \"setRawMode\") {\n\t\tthis.emergencyTerminalExit();\n\t}\n\tif (this.isShuttingDown) {\n\t\tprocess.exit(1);\n\t}\n\tthis.isShuttingDown = true;\n\ttry {\n\t\tthis.unregisterSignalHandlers();\n\t} catch {}\n\ttry {\n\t\tkillTrackedDetachedChildren();\n\t} catch {}\n\tkillSupervisedProcessTrees();\n\ttry {\n\t\tthis.ui.stop();\n\t} catch {}\n\tconsole.error(`${APP_TITLE} exiting due to uncaughtException:`);\n\tconsole.error(error);\n\tconst extensionHint = this.getCrashExtensionHint(error);\n\tif (extensionHint) console.error(`\\n${extensionHint}`);\n\tprocess.exit(1);\n};\n\nInteractiveModeBase.prototype.getCrashExtensionHint = function (\n\tthis: InteractiveModeBase,\n\terror: unknown,\n): string | undefined {\n\ttry {\n\t\treturn formatCrashExtensionHint(\n\t\t\tfindExtensionStackMatches(\n\t\t\t\terror instanceof Error ? error.stack : undefined,\n\t\t\t\tthis.session.resourceLoader.getExtensions().extensions,\n\t\t\t),\n\t\t);\n\t} catch {\n\t\treturn undefined;\n\t}\n};\n\nInteractiveModeBase.prototype.checkShutdownRequested = async function (this: InteractiveModeBase): Promise<void> {\n\tif (!this.shutdownRequested) return;\n\tawait this.shutdown();\n};\n\nInteractiveModeBase.prototype.registerSignalHandlers = function (this: InteractiveModeBase): void {\n\tthis.unregisterSignalHandlers();\n\n\tconst signals: NodeJS.Signals[] = [\"SIGTERM\"];\n\tif (process.platform !== \"win32\") {\n\t\tsignals.push(\"SIGHUP\");\n\t}\n\n\tfor (const signal of signals) {\n\t\tconst handler = () => {\n\t\t\tkillTrackedDetachedChildren();\n\t\t\tvoid this.shutdown({ fromSignal: true });\n\t\t};\n\t\tprocess.prependListener(signal, handler);\n\t\tthis.signalCleanupHandlers.push(() => process.off(signal, handler));\n\t}\n\n\tconst sigintHandler = () => {\n\t\tthis.handleSigintSignal();\n\t};\n\tprocess.prependListener(\"SIGINT\", sigintHandler);\n\tthis.signalCleanupHandlers.push(() => process.off(\"SIGINT\", sigintHandler));\n\n\tconst terminalErrorHandler = (error: Error) => {\n\t\tif (isDeadTerminalError(error)) {\n\t\t\tthis.emergencyTerminalExit();\n\t\t}\n\t\tthrow error;\n\t};\n\tfor (const stream of [process.stdin, process.stdout, process.stderr]) {\n\t\tstream.on(\"error\", terminalErrorHandler);\n\t\tthis.signalCleanupHandlers.push(() => stream.off(\"error\", terminalErrorHandler));\n\t}\n\n\t// Restore the terminal before the process dies on any uncaught throw.\n\t// Without this, an unhandled exception from extension code (or anywhere\n\t// in pi) leaves the terminal in raw mode with no cursor.\n\tconst uncaughtExceptionHandler = (error: Error) => this.uncaughtCrash(error);\n\tprocess.prependListener(\"uncaughtException\", uncaughtExceptionHandler);\n\tthis.signalCleanupHandlers.push(() => process.off(\"uncaughtException\", uncaughtExceptionHandler));\n};\n\nInteractiveModeBase.prototype.unregisterSignalHandlers = function (this: InteractiveModeBase): void {\n\tfor (const cleanup of this.signalCleanupHandlers) {\n\t\tcleanup();\n\t}\n\tthis.signalCleanupHandlers = [];\n};\n\nInteractiveModeBase.prototype.handleCtrlZ = function (this: InteractiveModeBase): void {\n\tif (process.platform === \"win32\") {\n\t\tvoid openWindowsSubshell(this).catch((error: Error) =>\n\t\t\tthis.showStatus(`PowerShell subshell failed: ${error.message}`),\n\t\t);\n\t\treturn;\n\t}\n\n\t// Keep the event loop alive while suspended. Without this, stopping the TUI\n\t// can leave Node with no ref'ed handles, causing the process to exit on fg\n\t// before the SIGCONT handler gets a chance to restore the terminal.\n\tconst suspendKeepAlive = setInterval(() => {}, 2 ** 30);\n\n\t// Ignore SIGINT while suspended so Ctrl+C in the terminal does not\n\t// kill the backgrounded process. The handler is removed on resume.\n\tconst ignoreSigint = () => {};\n\tprocess.on(\"SIGINT\", ignoreSigint);\n\n\t// Set up handler to restore TUI when resumed\n\tprocess.once(\"SIGCONT\", () => {\n\t\tclearInterval(suspendKeepAlive);\n\t\tprocess.removeListener(\"SIGINT\", ignoreSigint);\n\t\tthis.ui.start();\n\t\tthis.ui.requestRender(true);\n\t});\n\n\ttry {\n\t\t// Stop the TUI (restore terminal to normal mode)\n\t\tthis.ui.stop();\n\n\t\t// Send SIGTSTP to process group (pid=0 means all processes in group)\n\t\tprocess.kill(0, \"SIGTSTP\");\n\t} catch (error) {\n\t\tclearInterval(suspendKeepAlive);\n\t\tprocess.removeListener(\"SIGINT\", ignoreSigint);\n\t\tthrow error;\n\t}\n};\n\nInteractiveModeBase.prototype.handleFollowUp = async function (this: InteractiveModeBase): Promise<void> {\n\tif (followUpViewedAgent(this)) return;\n\t// Main's prompt, also once the screen shows a subagent while this is on its way.\n\tconst prompt = promptHandle(this, \"main\");\n\tconst rawText = this.editor.getExpandedText?.() ?? this.editor.getText();\n\tconst text = rawText.trim();\n\tif (!text) return;\n\n\t// Alt+Enter dispatches straight to the engine, exactly like the direct\n\t// branches of the Enter handler, so it needs the same send-failure restore:\n\t// otherwise a queued follow-up submitted while the engine is gone is lost.\n\tconst dispatch = async (send: () => Promise<void>): Promise<void> => {\n\t\ttry {\n\t\t\tawait send();\n\t\t} catch (error) {\n\t\t\tif (!restoreFailedSubmissionDraft(this, error, rawText, { prompt })) throw error;\n\t\t}\n\t};\n\n\t// Queue input behind compaction-queued messages (extension commands execute immediately)\n\tif (\n\t\tthis.compactionActive ||\n\t\t(!this.session.queuedMessagesPaused && (this.compactionFlushPending || this.compactionSendFailed))\n\t) {\n\t\tif (this.isExtensionCommand(text)) {\n\t\t\tprompt.addToHistory(text);\n\t\t\tprompt.setText(\"\");\n\t\t\t// Messages the command sends must follow the ones already typed (#4251).\n\t\t\tif (this.compactionActive) handOffCompactionQueue(this);\n\t\t\tawait dispatch(() => this.session.prompt(text));\n\t\t} else {\n\t\t\tthis.queueCompactionMessage(text, \"followUp\");\n\t\t}\n\t\treturn;\n\t}\n\n\t// A paused submission releases the session queue before its own turn, so move held\n\t// messages there first to keep them ahead of this one.\n\tif (this.session.queuedMessagesPaused && this.compactionSendFailed && !this.compactionFlushPending) {\n\t\tawait this.flushCompactionQueue({ willRetry: false });\n\t}\n\n\t// Alt+Enter queues a follow-up message (waits until agent finishes)\n\t// This handles extension commands (execute immediately), prompt template expansion, and queueing\n\tif (this.session.isStreaming) {\n\t\tprompt.addToHistory(text);\n\t\tprompt.setText(\"\");\n\t\tconst submitted = await mainSteering(this).submit(text, \"followUp\", {\n\t\t\troute: \"queue\",\n\t\t\t// An extension command runs at once instead of queueing, so only other input is shown as queued (#4696).\n\t\t\tshowAsQueued: !this.isExtensionCommand(text),\n\t\t});\n\t\tif (submitted.kind === \"failed\") throw submitted.error;\n\t\tif (submitted.kind === \"lost\") {\n\t\t\tthis.showError(submitted.error.message);\n\t\t\treturn;\n\t\t}\n\t\tif (submitted.kind === \"refused\") {\n\t\t\t// A refused follow-up goes back to the editor with the reason, as a refused steering message does (#4696).\n\t\t\trestoreRefusedSubmission(this, submitted.error, rawText, prompt);\n\t\t\treturn;\n\t\t}\n\t\tthis.updatePendingMessagesDisplay();\n\t\tthis.ui.requestRender();\n\t}\n\t// If not streaming, Alt+Enter acts like regular Enter (trigger onSubmit).\n\t// Hand over the raw expanded buffer, not the trimmed text: Alt+Enter is an\n\t// app action, so CustomEditor returns before its own pre-trim snapshot runs\n\t// and the submit handler's only draft is this argument. It trims the value\n\t// itself for delivery, so the agent still receives the normalized prompt.\n\telse if (this.editor.onSubmit) {\n\t\tthis.editor.setText(\"\");\n\t\tthis.editor.onSubmit(rawText);\n\t}\n};\n\nInteractiveModeBase.prototype.handleDequeue = async function (this: InteractiveModeBase): Promise<void> {\n\tif (dequeueViewedAgent(this)) return;\n\ttry {\n\t\tconst restored = await this.restoreQueuedMessagesToEditor();\n\t\tif (restored === 0) {\n\t\t\tthis.showStatus(\"No queued messages to restore\");\n\t\t}\n\t} catch (error) {\n\t\tshowQueueRestoreFailure(this, error);\n\t}\n};\n"]}
|
|
1
|
+
{"version":3,"file":"interactive-process-lifecycle.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-process-lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EAAE,2BAA2B,EAAE,0BAA0B,EAAE,MAAM,8CAA8C,CAAC;AACvH,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EACN,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,gBAAgB,GAChB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE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AO,CAAC,EAAE,CAAC,CAAC;QACxB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;AACF,CAAC,CAAC;AAEF,mBAAmB,CAAC,SAAS,CAAC,aAAa,GAAG,KAAK;IAClD,IAAI,kBAAkB,CAAC,IAAI,CAAC;QAAE,OAAO;IACrC,IAAI,CAAC;QACJ,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,6BAA6B,EAAE,CAAC;QAC5D,IAAI,QAAQ,KAAK,CAAC,EAAE,CAAC;YACpB,IAAI,CAAC,UAAU,CAAC,+BAA+B,CAAC,CAAC;QAClD,CAAC;IACF,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,uBAAuB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACtC,CAAC;AACF,CAAC,CAAC","sourcesContent":["import { findExtensionStackMatches } from \"../../core/crash-log.ts\";\nimport { markEventLoopShutdown } from \"../../core/event-loop-monitor.ts\";\nimport { killSupervisedProcessTrees } from \"../../core/tasks/supervisor.js\";\nimport { gracefullyStoppedEnginePids, terminateInteractiveEngine } from \"../interactive-engine/extension-ui-bridge.ts\";\nimport { ENGINE_SHUTDOWN_GRACE_MS } from \"../rpc/rpc-client-process.js\";\nimport { promptHandle } from \"./agent-view/agent-drafts.ts\";\nimport {\n\tdequeueViewedAgent,\n\tfollowUpViewedAgent,\n\tinterruptViewedAgent,\n\tleaveViewedAgent,\n} from \"./agent-view/viewed-submit.ts\";\nimport { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { APP_TITLE, chalk, killTrackedDetachedChildren } from \"./interactive-mode-deps.ts\";\nimport { formatCrashExtensionHint, formatResumeCommand, isDeadTerminalError } from \"./interactive-mode-helpers.ts\";\nimport { pauseAndAbortInteractiveSession } from \"./interactive-pause.ts\";\nimport { restoreFailedSubmissionDraft, restoreRefusedSubmission } from \"./interactive-prompt-restore.ts\";\nimport { handOffCompactionQueue, mainSteering, showQueueRestoreFailure } from \"./interactive-queueing.ts\";\nimport { chatHistoryBuilt } from \"./interactive-startup-chat-container.ts\";\nimport { isWindowsSubshellActive, openWindowsSubshell } from \"./interactive-windows-subshell.ts\";\n\n/** A second Ctrl+C on an empty, idle editor within this window exits. */\nconst CTRL_C_EXIT_WINDOW_MS = 800;\nconst SHUTDOWN_INPUT_DRAIN_MAX_MS = 250;\nconst SHUTDOWN_INPUT_DRAIN_IDLE_MS = 50;\n/** Exit status once the terminal is gone, as for a process ended by SIGHUP. */\nconst TERMINAL_LOST_EXIT_CODE = 129;\n/**\n * Once the terminal is gone, the longest the session's shutdown may take before Atomic ends anyway: the interactive\n * engine's grace period, then its guardian's and its tree kill's windows.\n */\nconst TERMINAL_LOST_SHUTDOWN_MS = ENGINE_SHUTDOWN_GRACE_MS + 1_000;\n\n/** How an interactive host is ending, beyond whether it has started to shut down. */\ninterface HostEnding {\n\t/** SIGTERM signals received. Only a repeated one ends every child at once. */\n\tsigterms: number;\n\t/** Set once the terminal is gone: the shutdown restores nothing and Atomic exits with status 129. */\n\tterminalLost: boolean;\n\t/** Settles when the terminal is gone, so a shutdown stops waiting on output that can no longer be written. */\n\treadonly terminalLoss: Promise<void>;\n\treadonly settleTerminalLoss: () => void;\n}\n\nconst hostEndings = new WeakMap<InteractiveModeBase, HostEnding>();\n\nfunction hostEnding(mode: InteractiveModeBase): HostEnding {\n\tlet ending = hostEndings.get(mode);\n\tif (!ending) {\n\t\tconst { promise, resolve } = Promise.withResolvers<void>();\n\t\tending = { sigterms: 0, terminalLost: false, terminalLoss: promise, settleTerminalLoss: () => resolve() };\n\t\thostEndings.set(mode, ending);\n\t}\n\treturn ending;\n}\n\n/**\n * Leave the interactive engine to the shutdown, and end every other child this host tracks at once. The shutdown asks\n * the engine to stop as one whose host was signalled, and the engine then ends its process group itself as it exits.\n */\nfunction spareEngineFromKill(mode: InteractiveModeBase): void {\n\tkillTrackedDetachedChildren(gracefullyStoppedEnginePids(mode.runtimeHost));\n}\n\n/**\n * Ctrl+C, in order: text in the editor is cleared; otherwise running work stops at once (as Escape does); otherwise\n * the first press says how to exit and a second press within {@link CTRL_C_EXIT_WINDOW_MS} exits. Clearing text or\n * stopping work never counts toward the exit, so a press meant for either cannot quit Atomic.\n */\nInteractiveModeBase.prototype.handleCtrlC = function (this: InteractiveModeBase): void {\n\tif (isWindowsSubshellActive(this)) return;\n\tif (this.editor.getText() !== \"\") {\n\t\tthis.clearEditor();\n\t\tthis.lastSigintTime = 0;\n\t\treturn;\n\t}\n\t// While a subagent is shown, an empty prompt's Ctrl+C pauses its work and shows main; it never exits from there.\n\t// An engine that owes an abort is still terminated first, as the watchdog advertises.\n\tif (this.agentView?.viewed.kind === \"agent\" && !terminateInteractiveEngine(this.runtimeHost)) {\n\t\tleaveViewedAgent(this);\n\t\tthis.lastSigintTime = 0;\n\t\treturn;\n\t}\n\tif (this.interruptActiveOperation()) {\n\t\tthis.lastSigintTime = 0;\n\t\treturn;\n\t}\n\tconst now = Date.now();\n\tif (now - this.lastSigintTime < CTRL_C_EXIT_WINDOW_MS) {\n\t\tvoid this.shutdown();\n\t\treturn;\n\t}\n\tthis.lastSigintTime = now;\n\tthis.showStatus(\"Press Ctrl+C again to exit\");\n};\n\n/**\n * A SIGINT signal, as opposed to the Ctrl+C key. In raw mode the keyboard sends Ctrl+C to the\n * editor as input, so a signal came from outside the TUI: on Windows, any process attached to\n * the same console that raises a console control event. It may interrupt running work, as the\n * key does, but never clears the editor or counts toward the double-press exit.\n */\nInteractiveModeBase.prototype.handleSigintSignal = function (this: InteractiveModeBase): void {\n\tif (!process.stdin.isTTY || !process.stdin.isRaw) {\n\t\tthis.handleCtrlC();\n\t\treturn;\n\t}\n\tif (isWindowsSubshellActive(this)) return;\n\tif (this.interruptActiveOperation()) this.lastSigintTime = 0;\n};\n\nInteractiveModeBase.prototype.interruptActiveOperation = function (this: InteractiveModeBase): boolean {\n\t// Mirror the Escape interrupt paths so Ctrl+C aborts whichever operation is\n\t// currently running. Returns true when something was aborted.\n\t//\n\t// Escalate first when the interactive engine owes a cooperative abort or the\n\t// heartbeat watchdog calls it unresponsive: that is the explicit termination\n\t// the watchdog advertises with \"Esc interrupt · Ctrl+C terminate\". Every\n\t// cooperative route below would otherwise queue another request for a child\n\t// that cannot answer.\n\tif (terminateInteractiveEngine(this.runtimeHost)) {\n\t\treturn true;\n\t}\n\t// While a subagent is shown, its running work is the one stopped, as Esc stops it; main's goes on.\n\tconst viewed = interruptViewedAgent(this);\n\tif (viewed !== undefined) return viewed;\n\tif (this.session.isStreaming || this.session.agent.hasQueuedMessages()) {\n\t\tpauseAndAbortInteractiveSession(this);\n\t\treturn true;\n\t}\n\tif (this.session.isBashRunning) {\n\t\tthis.session.abortBash();\n\t\treturn true;\n\t}\n\tif (this.session.isCompacting) {\n\t\tthis.session.abortCompaction();\n\t\treturn true;\n\t}\n\tif (this.session.isRetrying) {\n\t\tthis.session.abortRetry();\n\t\treturn true;\n\t}\n\treturn false;\n};\n\nInteractiveModeBase.prototype.handleCtrlD = function (this: InteractiveModeBase): void {\n\t// Only called when editor is empty (enforced by CustomEditor)\n\tvoid this.shutdown();\n};\n\nInteractiveModeBase.prototype.shutdown = async function (\n\tthis: InteractiveModeBase,\n\toptions?: { fromSignal?: boolean },\n): Promise<void> {\n\tif (this.isShuttingDown) return;\n\tthis.isShuttingDown = true;\n\tmarkEventLoopShutdown();\n\t// Keep signal handlers registered until terminal cleanup has completed.\n\t// `signal-exit` checks the listener list during the same SIGTERM/SIGHUP\n\t// dispatch and re-sends the signal if only its own listeners remain.\n\n\tconst ending = hostEnding(this);\n\tif (options?.fromSignal) {\n\t\tawait this.runtimeHost.dispose({ fromSignal: true });\n\t\t// A terminal that is gone is not restored.\n\t\tif (!ending.terminalLost) {\n\t\t\tthis.themeController.disableAutoSync();\n\t\t\t// Drain any in-flight Kitty key release events briefly before stopping.\n\t\t\t// Keep this bounded so Ctrl+C exits do not feel stalled on Windows.\n\t\t\tawait this.ui.terminal.drainInput(SHUTDOWN_INPUT_DRAIN_MAX_MS, SHUTDOWN_INPUT_DRAIN_IDLE_MS);\n\t\t\tstopTerminal(this);\n\t\t}\n\t\tprocess.exit(ending.terminalLost ? TERMINAL_LOST_EXIT_CODE : 0);\n\t}\n\n\t// Drain any in-flight Kitty key release events briefly before stopping.\n\t// Keep this bounded so Ctrl+C exits do not feel stalled on Windows.\n\tthis.themeController.disableAutoSync();\n\tif (!ending.terminalLost) {\n\t\tawait this.ui.terminal.drainInput(SHUTDOWN_INPUT_DRAIN_MAX_MS, SHUTDOWN_INPUT_DRAIN_IDLE_MS);\n\t}\n\n\t// Output for a terminal that is gone is never written, so its end is not waited for.\n\tawait Promise.race([chatHistoryBuilt(this.chatContainer), ending.terminalLoss]);\n\tthis.writeExitOutputInSlices = true;\n\tstopTerminal(this);\n\tawait Promise.race([this.exitOutputWritten, ending.terminalLoss]);\n\tawait this.runtimeHost.dispose();\n\tif (ending.terminalLost) process.exit(TERMINAL_LOST_EXIT_CODE);\n\tconst resumeCommand = await formatResumeCommand(this.sessionManager);\n\tif (resumeCommand) {\n\t\tprocess.stdout.write(`${chalk.dim(\"To resume this session:\")} ${resumeCommand}\\n`);\n\t}\n\tprocess.exit(0);\n};\n\n/** Stop the TUI. When the terminal turns out to be gone, the shutdown goes on without restoring it. */\nfunction stopTerminal(mode: InteractiveModeBase): void {\n\ttry {\n\t\tmode.stop();\n\t} catch (error) {\n\t\tif (!isDeadTerminalError(error)) throw error;\n\t\tmode.handleTerminalLost();\n\t}\n}\n\n/**\n * The terminal is gone, as when its window is closed. The session shuts down as it does on SIGHUP, which a closing\n * terminal sends too, so the interactive engine (or, without one, the session's own extensions) still runs its\n * shutdown. Other children end at once, nothing is drawn or restored, and Atomic exits with status 129 once the\n * session has shut down, or after {@link TERMINAL_LOST_SHUTDOWN_MS} at the latest.\n */\nInteractiveModeBase.prototype.handleTerminalLost = function (this: InteractiveModeBase): void {\n\tconst ending = hostEnding(this);\n\tif (ending.terminalLost) return;\n\tending.terminalLost = true;\n\tending.settleTerminalLoss();\n\tspareEngineFromKill(this);\n\tkillSupervisedProcessTrees();\n\tsetTimeout(() => this.emergencyTerminalExit(), TERMINAL_LOST_SHUTDOWN_MS);\n\t// A quit or a signal that is already shutting the session down goes on as it started.\n\tvoid this.shutdown({ fromSignal: true });\n};\n\nInteractiveModeBase.prototype.emergencyTerminalExit = function (this: InteractiveModeBase): never {\n\tthis.isShuttingDown = true;\n\tthis.unregisterSignalHandlers();\n\tkillTrackedDetachedChildren();\n\tkillSupervisedProcessTrees();\n\t// The terminal is gone. Do not run normal shutdown because TUI and\n\t// extension cleanup can write restore sequences and re-trigger EIO.\n\tprocess.exit(TERMINAL_LOST_EXIT_CODE);\n};\n\nInteractiveModeBase.prototype.uncaughtCrash = function (this: InteractiveModeBase, error: Error): never {\n\tif (isDeadTerminalError(error) && (error as NodeJS.ErrnoException).syscall === \"setRawMode\") {\n\t\tthis.emergencyTerminalExit();\n\t}\n\tif (this.isShuttingDown) {\n\t\tprocess.exit(1);\n\t}\n\tthis.isShuttingDown = true;\n\ttry {\n\t\tthis.unregisterSignalHandlers();\n\t} catch {}\n\ttry {\n\t\tkillTrackedDetachedChildren();\n\t} catch {}\n\tkillSupervisedProcessTrees();\n\ttry {\n\t\tthis.ui.stop();\n\t} catch {}\n\tconsole.error(`${APP_TITLE} exiting due to uncaughtException:`);\n\tconsole.error(error);\n\tconst extensionHint = this.getCrashExtensionHint(error);\n\tif (extensionHint) console.error(`\\n${extensionHint}`);\n\tprocess.exit(1);\n};\n\nInteractiveModeBase.prototype.getCrashExtensionHint = function (\n\tthis: InteractiveModeBase,\n\terror: unknown,\n): string | undefined {\n\ttry {\n\t\treturn formatCrashExtensionHint(\n\t\t\tfindExtensionStackMatches(\n\t\t\t\terror instanceof Error ? error.stack : undefined,\n\t\t\t\tthis.session.resourceLoader.getExtensions().extensions,\n\t\t\t),\n\t\t);\n\t} catch {\n\t\treturn undefined;\n\t}\n};\n\nInteractiveModeBase.prototype.checkShutdownRequested = async function (this: InteractiveModeBase): Promise<void> {\n\tif (!this.shutdownRequested) return;\n\tawait this.shutdown();\n};\n\nInteractiveModeBase.prototype.registerSignalHandlers = function (this: InteractiveModeBase): void {\n\tthis.unregisterSignalHandlers();\n\n\tconst signals: NodeJS.Signals[] = [\"SIGTERM\"];\n\tif (process.platform !== \"win32\") {\n\t\tsignals.push(\"SIGHUP\");\n\t}\n\n\tfor (const signal of signals) {\n\t\tconst handler = () => {\n\t\t\tconst ending = hostEnding(this);\n\t\t\tif (signal === \"SIGTERM\") ending.sigterms += 1;\n\t\t\t// The interactive engine is left to the shutdown, which gives it the bounded window a quit gives it to run\n\t\t\t// its extensions' shutdown. A closing terminal sends SIGHUP more than once, as the shell in it passes one on\n\t\t\t// and the kernel sends another when that shell exits, so only a repeated SIGTERM ends every child at once.\n\t\t\tif (ending.sigterms > 1) killTrackedDetachedChildren();\n\t\t\telse spareEngineFromKill(this);\n\t\t\tvoid this.shutdown({ fromSignal: true });\n\t\t};\n\t\tprocess.prependListener(signal, handler);\n\t\tthis.signalCleanupHandlers.push(() => process.off(signal, handler));\n\t}\n\n\tconst sigintHandler = () => {\n\t\tthis.handleSigintSignal();\n\t};\n\tprocess.prependListener(\"SIGINT\", sigintHandler);\n\tthis.signalCleanupHandlers.push(() => process.off(\"SIGINT\", sigintHandler));\n\n\tconst terminalErrorHandler = (error: Error) => {\n\t\tif (!isDeadTerminalError(error)) throw error;\n\t\tthis.handleTerminalLost();\n\t};\n\tfor (const stream of [process.stdin, process.stdout, process.stderr]) {\n\t\tstream.on(\"error\", terminalErrorHandler);\n\t\tthis.signalCleanupHandlers.push(() => stream.off(\"error\", terminalErrorHandler));\n\t}\n\t// A terminal's input ends only when the terminal is gone: a key never ends it in raw mode. It ends before the\n\t// closing terminal's signals arrive, and a session with nothing else to do would otherwise end at once.\n\tconst terminalInputEndHandler = () => {\n\t\tif (process.stdin.isTTY) this.handleTerminalLost();\n\t};\n\tprocess.stdin.on(\"end\", terminalInputEndHandler);\n\tthis.signalCleanupHandlers.push(() => process.stdin.off(\"end\", terminalInputEndHandler));\n\n\t// Restore the terminal before the process dies on any uncaught throw.\n\t// Without this, an unhandled exception from extension code (or anywhere\n\t// in pi) leaves the terminal in raw mode with no cursor.\n\tconst uncaughtExceptionHandler = (error: Error) => this.uncaughtCrash(error);\n\tprocess.prependListener(\"uncaughtException\", uncaughtExceptionHandler);\n\tthis.signalCleanupHandlers.push(() => process.off(\"uncaughtException\", uncaughtExceptionHandler));\n};\n\nInteractiveModeBase.prototype.unregisterSignalHandlers = function (this: InteractiveModeBase): void {\n\tfor (const cleanup of this.signalCleanupHandlers) {\n\t\tcleanup();\n\t}\n\tthis.signalCleanupHandlers = [];\n};\n\nInteractiveModeBase.prototype.handleCtrlZ = function (this: InteractiveModeBase): void {\n\tif (process.platform === \"win32\") {\n\t\tvoid openWindowsSubshell(this).catch((error: Error) =>\n\t\t\tthis.showStatus(`PowerShell subshell failed: ${error.message}`),\n\t\t);\n\t\treturn;\n\t}\n\n\t// Keep the event loop alive while suspended. Without this, stopping the TUI\n\t// can leave Node with no ref'ed handles, causing the process to exit on fg\n\t// before the SIGCONT handler gets a chance to restore the terminal.\n\tconst suspendKeepAlive = setInterval(() => {}, 2 ** 30);\n\n\t// Ignore SIGINT while suspended so Ctrl+C in the terminal does not\n\t// kill the backgrounded process. The handler is removed on resume.\n\tconst ignoreSigint = () => {};\n\tprocess.on(\"SIGINT\", ignoreSigint);\n\n\t// Set up handler to restore TUI when resumed\n\tprocess.once(\"SIGCONT\", () => {\n\t\tclearInterval(suspendKeepAlive);\n\t\tprocess.removeListener(\"SIGINT\", ignoreSigint);\n\t\tthis.ui.start();\n\t\tthis.ui.requestRender(true);\n\t});\n\n\ttry {\n\t\t// Stop the TUI (restore terminal to normal mode)\n\t\tthis.ui.stop();\n\n\t\t// Send SIGTSTP to process group (pid=0 means all processes in group)\n\t\tprocess.kill(0, \"SIGTSTP\");\n\t} catch (error) {\n\t\tclearInterval(suspendKeepAlive);\n\t\tprocess.removeListener(\"SIGINT\", ignoreSigint);\n\t\tthrow error;\n\t}\n};\n\nInteractiveModeBase.prototype.handleFollowUp = async function (this: InteractiveModeBase): Promise<void> {\n\tif (followUpViewedAgent(this)) return;\n\t// Main's prompt, also once the screen shows a subagent while this is on its way.\n\tconst prompt = promptHandle(this, \"main\");\n\tconst rawText = this.editor.getExpandedText?.() ?? this.editor.getText();\n\tconst text = rawText.trim();\n\tif (!text) return;\n\n\t// Alt+Enter dispatches straight to the engine, exactly like the direct\n\t// branches of the Enter handler, so it needs the same send-failure restore:\n\t// otherwise a queued follow-up submitted while the engine is gone is lost.\n\tconst dispatch = async (send: () => Promise<void>): Promise<void> => {\n\t\ttry {\n\t\t\tawait send();\n\t\t} catch (error) {\n\t\t\tif (!restoreFailedSubmissionDraft(this, error, rawText, { prompt })) throw error;\n\t\t}\n\t};\n\n\t// Queue input behind compaction-queued messages (extension commands execute immediately)\n\tif (\n\t\tthis.compactionActive ||\n\t\t(!this.session.queuedMessagesPaused && (this.compactionFlushPending || this.compactionSendFailed))\n\t) {\n\t\tif (this.isExtensionCommand(text)) {\n\t\t\tprompt.addToHistory(text);\n\t\t\tprompt.setText(\"\");\n\t\t\t// Messages the command sends must follow the ones already typed (#4251).\n\t\t\tif (this.compactionActive) handOffCompactionQueue(this);\n\t\t\tawait dispatch(() => this.session.prompt(text));\n\t\t} else {\n\t\t\tthis.queueCompactionMessage(text, \"followUp\");\n\t\t}\n\t\treturn;\n\t}\n\n\t// A paused submission releases the session queue before its own turn, so move held\n\t// messages there first to keep them ahead of this one.\n\tif (this.session.queuedMessagesPaused && this.compactionSendFailed && !this.compactionFlushPending) {\n\t\tawait this.flushCompactionQueue({ willRetry: false });\n\t}\n\n\t// Alt+Enter queues a follow-up message (waits until agent finishes)\n\t// This handles extension commands (execute immediately), prompt template expansion, and queueing\n\tif (this.session.isStreaming) {\n\t\tprompt.addToHistory(text);\n\t\tprompt.setText(\"\");\n\t\tconst submitted = await mainSteering(this).submit(text, \"followUp\", {\n\t\t\troute: \"queue\",\n\t\t\t// An extension command runs at once instead of queueing, so only other input is shown as queued (#4696).\n\t\t\tshowAsQueued: !this.isExtensionCommand(text),\n\t\t});\n\t\tif (submitted.kind === \"failed\") throw submitted.error;\n\t\tif (submitted.kind === \"lost\") {\n\t\t\tthis.showError(submitted.error.message);\n\t\t\treturn;\n\t\t}\n\t\tif (submitted.kind === \"refused\") {\n\t\t\t// A refused follow-up goes back to the editor with the reason, as a refused steering message does (#4696).\n\t\t\trestoreRefusedSubmission(this, submitted.error, rawText, prompt);\n\t\t\treturn;\n\t\t}\n\t\tthis.updatePendingMessagesDisplay();\n\t\tthis.ui.requestRender();\n\t}\n\t// If not streaming, Alt+Enter acts like regular Enter (trigger onSubmit).\n\t// Hand over the raw expanded buffer, not the trimmed text: Alt+Enter is an\n\t// app action, so CustomEditor returns before its own pre-trim snapshot runs\n\t// and the submit handler's only draft is this argument. It trims the value\n\t// itself for delivery, so the agent still receives the normalized prompt.\n\telse if (this.editor.onSubmit) {\n\t\tthis.editor.setText(\"\");\n\t\tthis.editor.onSubmit(rawText);\n\t}\n};\n\nInteractiveModeBase.prototype.handleDequeue = async function (this: InteractiveModeBase): Promise<void> {\n\tif (dequeueViewedAgent(this)) return;\n\ttry {\n\t\tconst restored = await this.restoreQueuedMessagesToEditor();\n\t\tif (restored === 0) {\n\t\t\tthis.showStatus(\"No queued messages to restore\");\n\t\t}\n\t} catch (error) {\n\t\tshowQueueRestoreFailure(this, error);\n\t}\n};\n"]}
|
|
@@ -45,6 +45,11 @@ export declare function reconcileQueuedSubmissions(mode: InteractiveModeBase, qu
|
|
|
45
45
|
export declare function handOffCompactionQueue(mode: InteractiveModeBase): void;
|
|
46
46
|
/** The notice the main chat shows when a lost engine's queued messages come back to its editor. */
|
|
47
47
|
export declare function engineLossRestoredNotice(count: number): string;
|
|
48
|
+
/**
|
|
49
|
+
* The messages a lost engine had taken and was delivering when nothing tells whether it saved them: each in full, so
|
|
50
|
+
* one that never arrived can be sent again by hand. None is sent again by itself.
|
|
51
|
+
*/
|
|
52
|
+
export declare function engineLossUnconfirmedNotice(messages: readonly string[], agent?: string): string;
|
|
48
53
|
/** What a subagent had queued, or had on its way, when the engine that runs it was lost. */
|
|
49
54
|
export interface LostSubagentQueue {
|
|
50
55
|
readonly agent: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-queueing.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-queueing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAiBnG,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAGN,uBAAuB,EACvB,KAAK,kBAAkB,EAEvB,MAAM,gCAAgC,CAAC;AAaxC,wBAAgB,YAAY,CAAC,IAAI,EAAE,mBAAmB,GAAG,uBAAuB,CAO/E;AAwFD;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,mBAAmB,GAAG,IAAI,CAQ1E;AAuDD,4GAA4G;AAC5G,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,mBAAmB,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAEvF;AAsGD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACrC,IAAI,EAAE,mBAAmB,EACzB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,uBAAuB,CAAC,MAAM,CAAC,GACnC,uBAAuB,CAEzB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,EAAE,uBAAuB,GAAG,IAAI,CAElG;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,EAAE,sBAAsB,GAAG,IAAI,CAGlG;AAED;;;;GAIG;AACH,wB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,EACzB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,uBAAuB,CAAC,MAAM,CAAC,GACnC,uBAAuB,CAEzB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,EAAE,uBAAuB,GAAG,IAAI,CAElG;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,EAAE,sBAAsB,GAAG,IAAI,CAGlG;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,mBAAmB,EAAE,KAAK,EAAE,kBAAkB,GAAG,IAAI,CAErG;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,mBAAmB,GAAG,IAAI,CA2BtE;AA6HD,mGAAmG;AACnG,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAM/F;AAED,4FAA4F;AAC5F,MAAM,WAAW,iBAAiB;IACjC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC;AAED,qGAAqG;AACrG,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,SAAS,CAQrF"}
|
|
@@ -423,6 +423,17 @@ function queuedMessagesPhrase(count) {
|
|
|
423
423
|
export function engineLossRestoredNotice(count) {
|
|
424
424
|
return `Engine restarted; ${queuedMessagesPhrase(count)} ${count === 1 ? "wasn't" : "weren't"} sent and ${count === 1 ? "is" : "are"} back in the editor`;
|
|
425
425
|
}
|
|
426
|
+
/**
|
|
427
|
+
* The messages a lost engine had taken and was delivering when nothing tells whether it saved them: each in full, so
|
|
428
|
+
* one that never arrived can be sent again by hand. None is sent again by itself.
|
|
429
|
+
*/
|
|
430
|
+
export function engineLossUnconfirmedNotice(messages, agent) {
|
|
431
|
+
const count = messages.length;
|
|
432
|
+
return [
|
|
433
|
+
`Engine restarted; ${count === 1 ? "this message" : `these ${count} messages`}${agent === undefined ? "" : ` to ${agent}`} may not have been delivered:`,
|
|
434
|
+
...messages,
|
|
435
|
+
].join("\n");
|
|
436
|
+
}
|
|
426
437
|
/** The notice listing, in full and in order, what a subagent had queued when the engine was lost. */
|
|
427
438
|
export function engineLossSubagentNotice(queue) {
|
|
428
439
|
const messages = [...queue.steering, ...queue.followUp];
|
|
@@ -466,8 +477,10 @@ function withoutEach(after, before) {
|
|
|
466
477
|
/**
|
|
467
478
|
* An isolated engine that is lost and replaced takes its queue with it. The messages the main chat showed as queued
|
|
468
479
|
* come back to its editor, as Alt+Up would restore them, with a notice, unless the replacement's history shows the
|
|
469
|
-
* lost engine delivered them.
|
|
470
|
-
*
|
|
480
|
+
* lost engine delivered them. What it had already taken from its queue and the chat never saw saved (being delivered,
|
|
481
|
+
* or shown without its save) may have been saved: a notice gives each in full, as unconfirmed. (What a shown subagent had queued is listed by
|
|
482
|
+
* `attachLostAgentQueueNotices`.) Nothing is sent again. A deliberate replacement or stop, or a session the engine
|
|
483
|
+
* retires, changes nothing.
|
|
471
484
|
*/
|
|
472
485
|
InteractiveModeBase.prototype.attachSteeringEngineRecovery = function () {
|
|
473
486
|
const runtime = this.runtimeHost;
|
|
@@ -475,11 +488,17 @@ InteractiveModeBase.prototype.attachSteeringEngineRecovery = function () {
|
|
|
475
488
|
return () => { };
|
|
476
489
|
/** The user messages the chat knew when the engine was lost, while its replacement is pending. */
|
|
477
490
|
let knownAtLoss;
|
|
491
|
+
/** What the lost engine was delivering, steering first, each lane in order, while its replacement is pending. */
|
|
492
|
+
let deliveringAtLoss = [];
|
|
478
493
|
const stopEnded = runtime.onGenerationEnded((event) => {
|
|
479
494
|
if (event.expected)
|
|
480
495
|
return;
|
|
481
496
|
mainSteering(this).loseTarget();
|
|
482
497
|
runtime.discardLostQueue();
|
|
498
|
+
// What it took from its queue and the chat never saw saved: being delivered, or shown without its save.
|
|
499
|
+
const delivering = runtime.takeDeliveringAtLoss();
|
|
500
|
+
if (delivering !== undefined)
|
|
501
|
+
deliveringAtLoss.push(...delivering.steering, ...delivering.followUp);
|
|
483
502
|
knownAtLoss ??= userMessageTexts(this.session.messages);
|
|
484
503
|
this.updatePendingMessagesDisplay();
|
|
485
504
|
this.ui.requestRender();
|
|
@@ -491,11 +510,13 @@ InteractiveModeBase.prototype.attachSteeringEngineRecovery = function () {
|
|
|
491
510
|
});
|
|
492
511
|
const stopRecovered = runtime.onEngineRecovered((replaced) => {
|
|
493
512
|
const known = knownAtLoss;
|
|
513
|
+
const delivering = deliveringAtLoss;
|
|
494
514
|
knownAtLoss = undefined;
|
|
515
|
+
deliveringAtLoss = [];
|
|
495
516
|
if (known === undefined)
|
|
496
517
|
return;
|
|
497
518
|
void (async () => {
|
|
498
|
-
let delivered
|
|
519
|
+
let delivered;
|
|
499
520
|
if (replaced) {
|
|
500
521
|
try {
|
|
501
522
|
delivered = withoutEach(await runtime.engineUserMessages(), known);
|
|
@@ -504,9 +525,20 @@ InteractiveModeBase.prototype.attachSteeringEngineRecovery = function () {
|
|
|
504
525
|
// The replacement could not say what it holds: give everything back, nothing is resent.
|
|
505
526
|
}
|
|
506
527
|
}
|
|
507
|
-
|
|
508
|
-
|
|
528
|
+
// What the lost engine had taken from its queue and the chat never saw saved may have been saved, and answered,
|
|
529
|
+
// whatever its replacement's history shows (a compaction can leave it out, and the engine may have saved it after
|
|
530
|
+
// the chat's last line): it is listed in full as unconfirmed, neither given back nor sent again. The replacement's
|
|
531
|
+
// history only accounts for what the chat still listed.
|
|
532
|
+
const remaining = delivered === undefined ? undefined : withoutEach(delivered, delivering);
|
|
533
|
+
const unconfirmed = delivering;
|
|
534
|
+
const messages = mainSteering(this).recoverTarget(remaining ?? []) ?? [];
|
|
535
|
+
if (unconfirmed.length > 0)
|
|
536
|
+
this.showWarning(engineLossUnconfirmedNotice(unconfirmed));
|
|
537
|
+
if (messages.length === 0) {
|
|
538
|
+
if (unconfirmed.length > 0)
|
|
539
|
+
this.ui.requestRender();
|
|
509
540
|
return;
|
|
541
|
+
}
|
|
510
542
|
// Main's prompt, whatever the screen shows by the time the replacement answers.
|
|
511
543
|
const prompt = promptHandle(this, "main");
|
|
512
544
|
prompt.setText(combineQueuedMessagesForEditor(messages, prompt.getExpandedText()));
|