@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
|
@@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MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,IAAY,EAAE,KAAK,GAAW,cAAc;IACzE,IAAI,CAAC;QACJ,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAC;QACrC,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/E,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,EAAE,CAAC;IACX,CAAC;AACF,CAAC","sourcesContent":["import { AsyncLocalStorage } from \"node:async_hooks\";\nimport { type ChildProcess, spawn } from \"node:child_process\";\nimport { write } from \"node:fs\";\nimport { mkdir, open, readFile } from \"node:fs/promises\";\nimport { dirname } from \"node:path\";\nimport { promisify } from \"node:util\";\nimport { waitForChildProcess } from \"../../../utils/child-process.ts\";\nimport { killChildProcessTree } from \"../../../utils/shell.ts\";\nimport { containProcessTree, type ProcessTreeContainment, processTreeEnded } from \"../../process-tree-containment.ts\";\n\n/** A step's log file, open for appending: the child processes of the step write their output to `fd`. */\nexport interface StepLog {\n\treadonly fd: number;\n\treadonly path: string;\n}\n\n/** One process a step starts. */\nexport interface LoggedProcess {\n\treadonly command: string;\n\treadonly args: readonly string[];\n\treadonly cwd: string;\n\treadonly env: NodeJS.ProcessEnv;\n\t/** Written to the process's stdin, for shells that take the command that way; otherwise stdin is closed. */\n\treadonly stdin?: string;\n}\n\nexport interface ProcessExit {\n\treadonly exitStatus: number | null;\n\treadonly signal: string | null;\n\treadonly timedOut: boolean;\n\treadonly elapsedMs: number;\n\t/** Why the process could not be started, when it could not. */\n\treadonly spawnError?: Error;\n}\n\nexport interface LoggedProcessOptions {\n\treadonly timeoutMs: number;\n\treadonly signal?: AbortSignal;\n}\n\n/**\n * Told of each process a step starts (`running` true) and of its end, for the build that runs the step: a build records\n * them so a later process can stop them when this one dies without stopping them (#4748).\n */\nexport const stepProcessWatcher = new AsyncLocalStorage<(pid: number, running: boolean) => void>();\n\nexport const stepStartingWatcher = new AsyncLocalStorage<() => void>();\n\nexport function buildProcessStarting(): void {\n\tstepStartingWatcher.getStore()?.();\n}\n\nconst STOPPED_PROCESS_TREE_WAIT_MS = 10_000;\n\nasync function settleTree(tree: ProcessTreeContainment | undefined, stopped: boolean): Promise<void> {\n\tif (tree === undefined) return;\n\tif (!stopped) {\n\t\ttree.release();\n\t\treturn;\n\t}\n\tawait processTreeEnded(tree, STOPPED_PROCESS_TREE_WAIT_MS);\n\ttree.close();\n}\n\n/** Whether a process started on `platform` leads its own process group, which is how stopping it stops its children. */\nexport function startsProcessGroup(platform: NodeJS.Platform): boolean {\n\treturn platform !== \"win32\";\n}\n\nexport function copiesOutputToLog(platform: NodeJS.Platform): boolean {\n\treturn platform === \"win32\";\n}\n\n/**\n * How many times, how far apart, and for how long a process the system refuses to start for a moment is tried: no try is\n * scheduled more than half a second after the first, so a program that stays refused fails its step at most that much\n * later. A refused process was never created, so trying again cannot run a step twice.\n */\nconst SPAWN_TRIES = 10;\nconst SPAWN_RETRY_MS = 50;\nconst SPAWN_RETRY_WINDOW_MS = 500;\nconst MAX_TIMER_MS = 2_147_483_647;\n\n/**\n * The refusals that pass once another program lets go of the file, as an antivirus scan or the installer that just wrote\n * it does. Windows refuses with EPERM while no one may execute the file and with EBUSY while a program holds it open for\n * writing; Linux refuses with ETXTBSY while a program holds it open for writing.\n */\nfunction passingRefusals(platform: NodeJS.Platform): readonly string[] {\n\treturn platform === \"win32\" ? [\"EPERM\", \"EBUSY\"] : [\"ETXTBSY\"];\n}\n\n/** Measures whole milliseconds, counting suspend without letting a backward wall-clock change extend a deadline. */\nexport function startElapsedMs(wallStart = Date.now()): () => number {\n\tconst monoStart = performance.now();\n\treturn () => {\n\t\t// Keep the monotonic interval inside the wall interval, even if descheduled between reads.\n\t\tconst activeMs = Math.floor(performance.now() - monoStart);\n\t\treturn Math.max(Date.now() - wallStart, activeMs);\n\t};\n}\n\n/** Whether a start refused with `error` on try `tries`, `elapsedMs` into a step allowed `timeoutMs`, is tried again. */\nfunction triesStartAgain(error: unknown, tries: number, elapsedMs: number, timeoutMs: number): boolean {\n\treturn (\n\t\tpassingRefusals(process.platform).includes((error as NodeJS.ErrnoException).code ?? \"\") &&\n\t\ttries < SPAWN_TRIES &&\n\t\telapsedMs + SPAWN_RETRY_MS <= SPAWN_RETRY_WINDOW_MS &&\n\t\telapsedMs + SPAWN_RETRY_MS < Math.ceil(timeoutMs)\n\t);\n}\n\n/** Waits `ms`, or rejects with the reason of `signal` as soon as it aborts. */\nfunction pause(ms: number, signal: AbortSignal | undefined): Promise<void> {\n\treturn new Promise((resolve, reject) => {\n\t\tif (signal?.aborted) {\n\t\t\treject(signal.reason);\n\t\t\treturn;\n\t\t}\n\t\tconst onAbort = () => {\n\t\t\tclearTimeout(timer);\n\t\t\treject(signal?.reason);\n\t\t};\n\t\tconst timer = setTimeout(() => {\n\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t\tresolve();\n\t\t}, ms);\n\t\tsignal?.addEventListener(\"abort\", onAbort, { once: true });\n\t});\n}\n\n/**\n * Runs `run` with its output appended to `log`, in its own process group (POSIX) so stopping it stops everything it\n * started. Resolves how it ended: exited, stopped by a signal, timed out after `timeoutMs`, or could not be started\n * (`spawnError`), including when the system refuses to start it at once. A refusal that passes by itself (EPERM or\n * EBUSY on Windows, ETXTBSY on Linux) is tried again for up to half a second first, and nothing starts once `timeoutMs`\n * has passed. Rejects with `signal.reason` when `options.signal` aborts, since cancelling is not a failure; nothing\n * starts once it has.\n */\nexport async function runLoggedProcess(\n\trun: LoggedProcess,\n\tlog: StepLog,\n\toptions: LoggedProcessOptions,\n): Promise<ProcessExit> {\n\toptions.signal?.throwIfAborted();\n\tconst elapsedMs = startElapsedMs();\n\tconst copiesOutput = copiesOutputToLog(process.platform);\n\tlet started: ChildProcess;\n\t// How long the step waited to try again before its process started: that time counts toward its timeout.\n\tlet waitedMs = 0;\n\tlet refusal: Error | undefined;\n\tfor (let tries = 1; ; tries++) {\n\t\tbuildProcessStarting();\n\t\t// Also cancelled while it waited to try again, or by what ran in between: then nothing may start.\n\t\toptions.signal?.throwIfAborted();\n\t\tif (refusal !== undefined) {\n\t\t\twaitedMs = elapsedMs();\n\t\t\t// A try that wakes late, as when the event loop was busy, starts nothing once the step's time is up.\n\t\t\tif (waitedMs >= Math.ceil(options.timeoutMs)) {\n\t\t\t\treturn {\n\t\t\t\t\texitStatus: null,\n\t\t\t\t\tsignal: null,\n\t\t\t\t\ttimedOut: false,\n\t\t\t\t\telapsedMs: waitedMs,\n\t\t\t\t\tspawnError: refusal,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\ttry {\n\t\t\tstarted = spawn(run.command, [...run.args], {\n\t\t\t\tcwd: run.cwd,\n\t\t\t\tenv: run.env,\n\t\t\t\tdetached: startsProcessGroup(process.platform),\n\t\t\t\twindowsHide: true,\n\t\t\t\tstdio: [\n\t\t\t\t\trun.stdin === undefined ? \"ignore\" : \"pipe\",\n\t\t\t\t\tcopiesOutput ? \"pipe\" : log.fd,\n\t\t\t\t\tcopiesOutput ? \"pipe\" : log.fd,\n\t\t\t\t],\n\t\t\t});\n\t\t\tbreak;\n\t\t} catch (error) {\n\t\t\t// spawn throws, rather than emitting \"error\", when the system refuses at once (EPERM, EBUSY, ETXTBSY, ENOTDIR).\n\t\t\tconst elapsed = elapsedMs();\n\t\t\trefusal = error as Error;\n\t\t\tif (!triesStartAgain(error, tries, elapsed, options.timeoutMs)) {\n\t\t\t\treturn {\n\t\t\t\t\texitStatus: null,\n\t\t\t\t\tsignal: null,\n\t\t\t\t\ttimedOut: false,\n\t\t\t\t\telapsedMs: elapsed,\n\t\t\t\t\tspawnError: refusal,\n\t\t\t\t};\n\t\t\t}\n\t\t\tawait pause(SPAWN_RETRY_MS, options.signal);\n\t\t}\n\t}\n\tconst child = started;\n\treturn new Promise<ProcessExit>((resolveExit, reject) => {\n\t\tconst tree = child.pid === undefined ? undefined : containProcessTree(child.pid);\n\t\tconst watch = stepProcessWatcher.getStore();\n\t\tif (child.pid !== undefined) watch?.(child.pid, true);\n\t\tlet timedOut = false;\n\t\tlet stopped = false;\n\t\tlet treeTerminated = false;\n\t\tlet warnedAboutDescendants = false;\n\t\tlet writeError: Error | undefined;\n\t\tlet copying = Promise.resolve();\n\t\tconst stop = () => {\n\t\t\tstopped = true;\n\t\t\t// Terminating the tree ends every process in it, and closing it ends any left: it is terminated at most once.\n\t\t\tif (!treeTerminated) treeTerminated = tree?.terminate() === true;\n\t\t\t// A failed spawn can have an exit code even though no process was created.\n\t\t\tif (treeTerminated || child.pid === undefined) return;\n\t\t\t// Once the command's exit is reported, its pid may name another process: nothing is killed by that pid.\n\t\t\tconst exited = child.exitCode !== null || child.signalCode !== null;\n\t\t\tif (process.platform === \"win32\" && tree === undefined && exited && !warnedAboutDescendants) {\n\t\t\t\twarnedAboutDescendants = true;\n\t\t\t\tprocess.emitWarning(\n\t\t\t\t\t\"The blueprint command exited without a Windows Job object; its descendants may still be running.\",\n\t\t\t\t);\n\t\t\t}\n\t\t\tkillChildProcessTree(child, exited);\n\t\t};\n\t\tconst { timeoutMs } = options;\n\t\tconst remainingMs = Math.max(0, timeoutMs - waitedMs);\n\t\t// Clamp finite budgets to the timer range, but let the runtime diagnose an invalid timeout itself.\n\t\tconst delayMs = Number.isFinite(timeoutMs)\n\t\t\t? Math.max(1, Math.min(MAX_TIMER_MS, Math.floor(remainingMs)))\n\t\t\t: remainingMs;\n\t\tconst timer = setTimeout(() => {\n\t\t\ttimedOut = true;\n\t\t\tstop();\n\t\t}, delayMs);\n\t\tconst onAbort = () => stop();\n\t\tif (copiesOutput) {\n\t\t\tconst fail = (what: string, error: Error) => {\n\t\t\t\tif (writeError !== undefined) return;\n\t\t\t\twriteError = new Error(`The output of ${run.command} could not be ${what} the log ${log.path}`, {\n\t\t\t\t\tcause: error,\n\t\t\t\t});\n\t\t\t\tstop();\n\t\t\t};\n\t\t\tconst copy = (chunk: Buffer) => {\n\t\t\t\tif (writeError !== undefined) return;\n\t\t\t\tcopying = copying.then(async () => {\n\t\t\t\t\tif (writeError !== undefined) return;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait appendToLog(log, chunk);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tfail(\"written to\", error as Error);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t};\n\t\t\tfor (const stream of [child.stdout, child.stderr]) {\n\t\t\t\tstream?.on(\"data\", copy);\n\t\t\t\tstream?.on(\"error\", (error) => {\n\t\t\t\t\tif (!timedOut && !options.signal?.aborted) fail(\"read for\", error);\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\tconst settle = () => {\n\t\t\tif (child.pid !== undefined) watch?.(child.pid, false);\n\t\t\tclearTimeout(timer);\n\t\t\toptions.signal?.removeEventListener(\"abort\", onAbort);\n\t\t};\n\t\toptions.signal?.addEventListener(\"abort\", onAbort);\n\t\tconst onSpawnError = (error: Error) => {\n\t\t\tsettle();\n\t\t\ttree?.close();\n\t\t\tif (options.signal?.aborted) {\n\t\t\t\treject(options.signal.reason);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresolveExit({\n\t\t\t\texitStatus: null,\n\t\t\t\tsignal: null,\n\t\t\t\ttimedOut: false,\n\t\t\t\telapsedMs: elapsedMs(),\n\t\t\t\tspawnError: error,\n\t\t\t});\n\t\t};\n\t\tconst ended = async (exitStatus: number | null, exitSignal: NodeJS.Signals | null) => {\n\t\t\tclearTimeout(timer);\n\t\t\toptions.signal?.removeEventListener(\"abort\", onAbort);\n\t\t\tawait settleTree(tree, stopped);\n\t\t\tawait copying;\n\t\t\tsettle();\n\t\t\tif (options.signal?.aborted) {\n\t\t\t\treject(options.signal.reason);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (writeError !== undefined) {\n\t\t\t\treject(writeError);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresolveExit({ exitStatus, signal: exitSignal, timedOut, elapsedMs: elapsedMs() });\n\t\t};\n\t\tif (copiesOutput) {\n\t\t\twaitForChildProcess(child).then((exitStatus) => ended(exitStatus, child.signalCode), onSpawnError);\n\t\t} else {\n\t\t\tchild.once(\"error\", onSpawnError);\n\t\t\tchild.once(\"close\", ended);\n\t\t}\n\t\tif (run.stdin !== undefined) child.stdin?.end(run.stdin);\n\t});\n}\n\nconst writeToFd = promisify(write);\n\nexport async function appendToLog(log: StepLog, data: string | Buffer): Promise<void> {\n\tconst chunk = typeof data === \"string\" ? Buffer.from(data) : data;\n\tlet written = 0;\n\twhile (written < chunk.length) {\n\t\tconst { bytesWritten } = await writeToFd(log.fd, chunk, written, chunk.length - written, null);\n\t\tif (bytesWritten <= 0) throw new Error(\"the log accepted no bytes\");\n\t\twritten += bytesWritten;\n\t}\n}\n\n/** Opens `path` for appending with owner-only permissions; the caller closes it. */\nexport async function openStepLog(path: string): Promise<StepLog & { close(): Promise<void> }> {\n\tawait mkdir(dirname(path), { recursive: true });\n\tconst handle = await open(path, \"a\", 0o600);\n\treturn { fd: handle.fd, path, close: () => handle.close() };\n}\n\n/** How much of a log's end a build outcome keeps. */\nexport const LOG_TAIL_BYTES = 4096;\n\n/** The last `bytes` of the file at `path`, or an empty string when it cannot be read. */\nexport async function logTail(path: string, bytes: number = LOG_TAIL_BYTES): Promise<string> {\n\ttry {\n\t\tconst content = await readFile(path);\n\t\treturn content.subarray(Math.max(0, content.length - bytes)).toString(\"utf8\");\n\t} catch {\n\t\treturn \"\";\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"process.js","sourceRoot":"","sources":["../../../../src/core/resume/blueprint/process.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO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,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IAC5C,OAAO,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC;AAC7D,CAAC;AAED,qDAAqD;AACrD,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC;AAEnC,yFAAyF;AACzF,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,IAAY,EAAE,KAAK,GAAW,cAAc;IACzE,IAAI,CAAC;QACJ,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAC;QACrC,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/E,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,EAAE,CAAC;IACX,CAAC;AACF,CAAC","sourcesContent":["import { type ChildProcess, spawn } from \"node:child_process\";\nimport { write } from \"node:fs\";\nimport { mkdir, open, readFile } from \"node:fs/promises\";\nimport { dirname } from \"node:path\";\nimport { promisify } from \"node:util\";\nimport { waitForChildProcess } from \"../../../utils/child-process.ts\";\nimport { killChildProcessTree } from \"../../../utils/shell.ts\";\nimport { asyncScope } from \"../../async-scope.ts\";\nimport { containProcessTree, type ProcessTreeContainment, processTreeEnded } from \"../../process-tree-containment.ts\";\n\n/** A step's log file, open for appending: the child processes of the step write their output to `fd`. */\nexport interface StepLog {\n\treadonly fd: number;\n\treadonly path: string;\n}\n\n/** One process a step starts. */\nexport interface LoggedProcess {\n\treadonly command: string;\n\treadonly args: readonly string[];\n\treadonly cwd: string;\n\treadonly env: NodeJS.ProcessEnv;\n\t/** Written to the process's stdin, for shells that take the command that way; otherwise stdin is closed. */\n\treadonly stdin?: string;\n}\n\nexport interface ProcessExit {\n\treadonly exitStatus: number | null;\n\treadonly signal: string | null;\n\treadonly timedOut: boolean;\n\treadonly elapsedMs: number;\n\t/** Why the process could not be started, when it could not. */\n\treadonly spawnError?: Error;\n}\n\nexport interface LoggedProcessOptions {\n\treadonly timeoutMs: number;\n\treadonly signal?: AbortSignal;\n}\n\n/**\n * Told of each process a step starts (`running` true) and of its end, for the build that runs the step: a build records\n * them so a later process can stop them when this one dies without stopping them (#4748).\n */\nexport const stepProcessWatcher = asyncScope<(pid: number, running: boolean) => void>();\n\nexport const stepStartingWatcher = asyncScope<() => void>();\n\nexport function buildProcessStarting(): void {\n\tstepStartingWatcher.getStore()?.();\n}\n\nconst STOPPED_PROCESS_TREE_WAIT_MS = 10_000;\n\nasync function settleTree(tree: ProcessTreeContainment | undefined, stopped: boolean): Promise<void> {\n\tif (tree === undefined) return;\n\tif (!stopped) {\n\t\ttree.release();\n\t\treturn;\n\t}\n\tawait processTreeEnded(tree, STOPPED_PROCESS_TREE_WAIT_MS);\n\ttree.close();\n}\n\n/** Whether a process started on `platform` leads its own process group, which is how stopping it stops its children. */\nexport function startsProcessGroup(platform: NodeJS.Platform): boolean {\n\treturn platform !== \"win32\";\n}\n\nexport function copiesOutputToLog(platform: NodeJS.Platform): boolean {\n\treturn platform === \"win32\";\n}\n\n/**\n * How many times, how far apart, and for how long a process the system refuses to start for a moment is tried. The first\n * tries are 50 ms apart for half a second. A busy Windows machine has refused a start for most of a second (#6124), so\n * the tries go on, each after half the time already spent (100 to 400 ms), until two seconds after the first: a\n * program that stays refused fails its step at most that much later. A refused process was never created, so trying\n * again cannot run a step twice.\n */\nconst SPAWN_STEADY_TRIES = 10;\nconst SPAWN_RETRY_MS = 50;\nconst SPAWN_STEADY_WINDOW_MS = 500;\nconst SPAWN_BACKOFF_MIN_MS = 100;\nconst SPAWN_BACKOFF_MAX_MS = 400;\nconst SPAWN_RETRY_WINDOW_MS = 2_000;\nconst MAX_TIMER_MS = 2_147_483_647;\n\n/**\n * The refusals that pass once another program lets go of the file, as an antivirus scan or the installer that just wrote\n * it does. Windows refuses with EPERM while no one may execute the file and with EBUSY while a program holds it open for\n * writing; Linux refuses with ETXTBSY while a program holds it open for writing.\n */\nfunction passingRefusals(platform: NodeJS.Platform): readonly string[] {\n\treturn platform === \"win32\" ? [\"EPERM\", \"EBUSY\"] : [\"ETXTBSY\"];\n}\n\n/** Measures whole milliseconds, counting suspend without letting a backward wall-clock change extend a deadline. */\nexport function startElapsedMs(wallStart = Date.now()): () => number {\n\tconst monoStart = performance.now();\n\treturn () => {\n\t\t// Keep the monotonic interval inside the wall interval, even if descheduled between reads.\n\t\tconst activeMs = Math.floor(performance.now() - monoStart);\n\t\treturn Math.max(Date.now() - wallStart, activeMs);\n\t};\n}\n\n/**\n * How long a start refused with `error` on try `tries`, `elapsedMs` into a step allowed `timeoutMs`, waits before it is\n * tried again; undefined when it is not tried again. A try is made only while the shortest wait still ends inside the\n * window and before the step's timeout, and no wait ends after either.\n */\nfunction retryWaitMs(error: unknown, tries: number, elapsedMs: number, timeoutMs: number): number | undefined {\n\tif (!passingRefusals(process.platform).includes((error as NodeJS.ErrnoException).code ?? \"\")) return undefined;\n\tconst lastStartMs = Math.min(SPAWN_RETRY_WINDOW_MS, Math.ceil(timeoutMs) - 1);\n\t// Written so that a timeout that is not a number, which no try fits, makes none.\n\tif (!(elapsedMs + SPAWN_RETRY_MS <= lastStartMs)) return undefined;\n\tif (tries < SPAWN_STEADY_TRIES && elapsedMs + SPAWN_RETRY_MS <= SPAWN_STEADY_WINDOW_MS) return SPAWN_RETRY_MS;\n\tconst backoffMs = Math.min(SPAWN_BACKOFF_MAX_MS, Math.max(SPAWN_BACKOFF_MIN_MS, Math.floor(elapsedMs / 2)));\n\treturn Math.min(backoffMs, lastStartMs - elapsedMs);\n}\n\n/** Waits `ms`, or rejects with the reason of `signal` as soon as it aborts. */\nfunction pause(ms: number, signal: AbortSignal | undefined): Promise<void> {\n\treturn new Promise((resolve, reject) => {\n\t\tif (signal?.aborted) {\n\t\t\treject(signal.reason);\n\t\t\treturn;\n\t\t}\n\t\tconst onAbort = () => {\n\t\t\tclearTimeout(timer);\n\t\t\treject(signal?.reason);\n\t\t};\n\t\tconst timer = setTimeout(() => {\n\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t\tresolve();\n\t\t}, ms);\n\t\tsignal?.addEventListener(\"abort\", onAbort, { once: true });\n\t});\n}\n\n/**\n * Runs `run` with its output appended to `log`, in its own process group (POSIX) so stopping it stops everything it\n * started. Resolves how it ended: exited, stopped by a signal, timed out after `timeoutMs`, or could not be started\n * (`spawnError`), including when the system refuses to start it at once. A refusal that passes by itself (EPERM or\n * EBUSY on Windows, ETXTBSY on Linux) is tried again for up to two seconds first, and nothing starts once `timeoutMs`\n * has passed. Rejects with `signal.reason` when `options.signal` aborts, since cancelling is not a failure; nothing\n * starts once it has.\n */\nexport async function runLoggedProcess(\n\trun: LoggedProcess,\n\tlog: StepLog,\n\toptions: LoggedProcessOptions,\n): Promise<ProcessExit> {\n\toptions.signal?.throwIfAborted();\n\tconst elapsedMs = startElapsedMs();\n\tconst copiesOutput = copiesOutputToLog(process.platform);\n\tlet started: ChildProcess;\n\t// How long the step waited to try again before its process started: that time counts toward its timeout.\n\tlet waitedMs = 0;\n\tlet refusal: Error | undefined;\n\tfor (let tries = 1; ; tries++) {\n\t\tbuildProcessStarting();\n\t\t// Also cancelled while it waited to try again, or by what ran in between: then nothing may start.\n\t\toptions.signal?.throwIfAborted();\n\t\tif (refusal !== undefined) {\n\t\t\twaitedMs = elapsedMs();\n\t\t\t// A try that wakes late, as when the event loop was busy, starts nothing once the step's time is up.\n\t\t\tif (waitedMs >= Math.ceil(options.timeoutMs)) {\n\t\t\t\treturn {\n\t\t\t\t\texitStatus: null,\n\t\t\t\t\tsignal: null,\n\t\t\t\t\ttimedOut: false,\n\t\t\t\t\telapsedMs: waitedMs,\n\t\t\t\t\tspawnError: refusal,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\ttry {\n\t\t\tstarted = spawn(run.command, [...run.args], {\n\t\t\t\tcwd: run.cwd,\n\t\t\t\tenv: run.env,\n\t\t\t\tdetached: startsProcessGroup(process.platform),\n\t\t\t\twindowsHide: true,\n\t\t\t\tstdio: [\n\t\t\t\t\trun.stdin === undefined ? \"ignore\" : \"pipe\",\n\t\t\t\t\tcopiesOutput ? \"pipe\" : log.fd,\n\t\t\t\t\tcopiesOutput ? \"pipe\" : log.fd,\n\t\t\t\t],\n\t\t\t});\n\t\t\tbreak;\n\t\t} catch (error) {\n\t\t\t// spawn throws, rather than emitting \"error\", when the system refuses at once (EPERM, EBUSY, ETXTBSY, ENOTDIR).\n\t\t\tconst elapsed = elapsedMs();\n\t\t\trefusal = error as Error;\n\t\t\tconst waitMs = retryWaitMs(error, tries, elapsed, options.timeoutMs);\n\t\t\tif (waitMs === undefined) {\n\t\t\t\treturn {\n\t\t\t\t\texitStatus: null,\n\t\t\t\t\tsignal: null,\n\t\t\t\t\ttimedOut: false,\n\t\t\t\t\telapsedMs: elapsed,\n\t\t\t\t\tspawnError: refusal,\n\t\t\t\t};\n\t\t\t}\n\t\t\tawait pause(waitMs, options.signal);\n\t\t}\n\t}\n\tconst child = started;\n\treturn new Promise<ProcessExit>((resolveExit, reject) => {\n\t\tconst tree = child.pid === undefined ? undefined : containProcessTree(child.pid);\n\t\tconst watch = stepProcessWatcher.getStore();\n\t\tif (child.pid !== undefined) watch?.(child.pid, true);\n\t\tlet timedOut = false;\n\t\tlet stopped = false;\n\t\tlet treeTerminated = false;\n\t\tlet warnedAboutDescendants = false;\n\t\tlet writeError: Error | undefined;\n\t\tlet copying = Promise.resolve();\n\t\tconst stop = () => {\n\t\t\tstopped = true;\n\t\t\t// Terminating the tree ends every process in it, and closing it ends any left: it is terminated at most once.\n\t\t\tif (!treeTerminated) treeTerminated = tree?.terminate() === true;\n\t\t\t// A failed spawn can have an exit code even though no process was created.\n\t\t\tif (treeTerminated || child.pid === undefined) return;\n\t\t\t// Once the command's exit is reported, its pid may name another process: nothing is killed by that pid.\n\t\t\tconst exited = child.exitCode !== null || child.signalCode !== null;\n\t\t\tif (process.platform === \"win32\" && tree === undefined && exited && !warnedAboutDescendants) {\n\t\t\t\twarnedAboutDescendants = true;\n\t\t\t\tprocess.emitWarning(\n\t\t\t\t\t\"The blueprint command exited without a Windows Job object; its descendants may still be running.\",\n\t\t\t\t);\n\t\t\t}\n\t\t\tkillChildProcessTree(child, exited);\n\t\t};\n\t\tconst { timeoutMs } = options;\n\t\tconst remainingMs = Math.max(0, timeoutMs - waitedMs);\n\t\t// Clamp finite budgets to the timer range, but let the runtime diagnose an invalid timeout itself.\n\t\tconst delayMs = Number.isFinite(timeoutMs)\n\t\t\t? Math.max(1, Math.min(MAX_TIMER_MS, Math.floor(remainingMs)))\n\t\t\t: remainingMs;\n\t\tconst timer = setTimeout(() => {\n\t\t\ttimedOut = true;\n\t\t\tstop();\n\t\t}, delayMs);\n\t\tconst onAbort = () => stop();\n\t\tif (copiesOutput) {\n\t\t\tconst fail = (what: string, error: Error) => {\n\t\t\t\tif (writeError !== undefined) return;\n\t\t\t\twriteError = new Error(`The output of ${run.command} could not be ${what} the log ${log.path}`, {\n\t\t\t\t\tcause: error,\n\t\t\t\t});\n\t\t\t\tstop();\n\t\t\t};\n\t\t\tconst copy = (chunk: Buffer) => {\n\t\t\t\tif (writeError !== undefined) return;\n\t\t\t\tcopying = copying.then(async () => {\n\t\t\t\t\tif (writeError !== undefined) return;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait appendToLog(log, chunk);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tfail(\"written to\", error as Error);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t};\n\t\t\tfor (const stream of [child.stdout, child.stderr]) {\n\t\t\t\tstream?.on(\"data\", copy);\n\t\t\t\tstream?.on(\"error\", (error) => {\n\t\t\t\t\tif (!timedOut && !options.signal?.aborted) fail(\"read for\", error);\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\tconst settle = () => {\n\t\t\tif (child.pid !== undefined) watch?.(child.pid, false);\n\t\t\tclearTimeout(timer);\n\t\t\toptions.signal?.removeEventListener(\"abort\", onAbort);\n\t\t};\n\t\toptions.signal?.addEventListener(\"abort\", onAbort);\n\t\tconst onSpawnError = (error: Error) => {\n\t\t\tsettle();\n\t\t\ttree?.close();\n\t\t\tif (options.signal?.aborted) {\n\t\t\t\treject(options.signal.reason);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresolveExit({\n\t\t\t\texitStatus: null,\n\t\t\t\tsignal: null,\n\t\t\t\ttimedOut: false,\n\t\t\t\telapsedMs: elapsedMs(),\n\t\t\t\tspawnError: error,\n\t\t\t});\n\t\t};\n\t\tconst ended = async (exitStatus: number | null, exitSignal: NodeJS.Signals | null) => {\n\t\t\tclearTimeout(timer);\n\t\t\toptions.signal?.removeEventListener(\"abort\", onAbort);\n\t\t\tawait settleTree(tree, stopped);\n\t\t\tawait copying;\n\t\t\tsettle();\n\t\t\tif (options.signal?.aborted) {\n\t\t\t\treject(options.signal.reason);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (writeError !== undefined) {\n\t\t\t\treject(writeError);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresolveExit({ exitStatus, signal: exitSignal, timedOut, elapsedMs: elapsedMs() });\n\t\t};\n\t\tif (copiesOutput) {\n\t\t\twaitForChildProcess(child).then((exitStatus) => ended(exitStatus, child.signalCode), onSpawnError);\n\t\t} else {\n\t\t\tchild.once(\"error\", onSpawnError);\n\t\t\tchild.once(\"close\", ended);\n\t\t}\n\t\tif (run.stdin !== undefined) child.stdin?.end(run.stdin);\n\t});\n}\n\nconst writeToFd = promisify(write);\n\nexport async function appendToLog(log: StepLog, data: string | Buffer): Promise<void> {\n\tconst chunk = typeof data === \"string\" ? Buffer.from(data) : data;\n\tlet written = 0;\n\twhile (written < chunk.length) {\n\t\tconst { bytesWritten } = await writeToFd(log.fd, chunk, written, chunk.length - written, null);\n\t\tif (bytesWritten <= 0) throw new Error(\"the log accepted no bytes\");\n\t\twritten += bytesWritten;\n\t}\n}\n\n/** Opens `path` for appending with owner-only permissions; the caller closes it. */\nexport async function openStepLog(path: string): Promise<StepLog & { close(): Promise<void> }> {\n\tawait mkdir(dirname(path), { recursive: true });\n\tconst handle = await open(path, \"a\", 0o600);\n\treturn { fd: handle.fd, path, close: () => handle.close() };\n}\n\n/** How much of a log's end a build outcome keeps. */\nexport const LOG_TAIL_BYTES = 4096;\n\n/** The last `bytes` of the file at `path`, or an empty string when it cannot be read. */\nexport async function logTail(path: string, bytes: number = LOG_TAIL_BYTES): Promise<string> {\n\ttry {\n\t\tconst content = await readFile(path);\n\t\treturn content.subarray(Math.max(0, content.length - bytes)).toString(\"utf8\");\n\t} catch {\n\t\treturn \"\";\n\t}\n}\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
1
|
import { isAbsolute, relative, resolve, sep } from "node:path";
|
|
2
|
+
import { asyncScope } from "../async-scope.js";
|
|
3
3
|
import { mapRestoredPath, mapRestoredPathAsync } from "../session-worktree-snapshots.js";
|
|
4
4
|
/** The restores that apply to the paths resolved by the current work: its own, after those of any work it runs in. */
|
|
5
|
-
const scopedMappings =
|
|
5
|
+
const scopedMappings = asyncScope();
|
|
6
6
|
/** Where the current session continued instead of checkouts it worked in, which its file tools follow (#5379). */
|
|
7
|
-
const scopedContinuations =
|
|
7
|
+
const scopedContinuations = asyncScope();
|
|
8
8
|
/** Whether `child` is `parent` or a path below it. */
|
|
9
9
|
export function isInside(parent, child) {
|
|
10
10
|
const path = relative(parent, child);
|
|
@@ -26,7 +26,7 @@ export function withWorktreeRootMappings(mappings, work, outer = currentWorktree
|
|
|
26
26
|
return continuations === undefined ? scoped() : scopedContinuations.run(continuations, scoped);
|
|
27
27
|
}
|
|
28
28
|
/** The notices of checkouts the current work's sessions and runs hold only part of, or continued without (#4738). */
|
|
29
|
-
const scopedRestoreNotices =
|
|
29
|
+
const scopedRestoreNotices = asyncScope();
|
|
30
30
|
/**
|
|
31
31
|
* The notices of the checkouts that the sessions and runs work started here runs in hold less of than their recorded
|
|
32
32
|
* snapshots, or continued without (#4738), outermost first. A session opened here tells its model about them.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path-mapping.js","sourceRoot":"","sources":["../../../src/core/resume/path-mapping.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"path-mapping.js","sourceRoot":"","sources":["../../../src/core/resume/path-mapping.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAGzF,sHAAsH;AACtH,MAAM,cAAc,GAAG,UAAU,EAAkC,CAAC;AAEpE,kHAAkH;AAClH,MAAM,mBAAmB,GAAG,UAAU,EAA+B,CAAC;AAEtE,sDAAsD;AACtD,MAAM,UAAU,QAAQ,CAAC,MAAc,EAAE,KAAa;IACrD,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,GAAG,EAAE,CAAC,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;AAC3E,CAAC;AAED,gHAAgH;AAChH,MAAM,UAAU,2BAA2B;IAC1C,OAAO,cAAc,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC;AACxC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CACvC,QAAwC,EACxC,IAAa,EACb,KAAK,GAAmC,2BAA2B,EAAE,EACrE,aAA2C;IAE3C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M,MAAM,GAAG,eAAe,CAAC,IAAI,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1D,OAAO,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC;AACjD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,IAAY,EAAE,GAAW;IACjE,MAAM,MAAM,GAAG,MAAM,oBAAoB,CAAC,IAAI,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;IACrE,OAAO,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC;AACjD,CAAC;AAED;;;GAGG;AACH,SAAS,cAAc,CAAC,GAAW;IAClC,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAC1B,MAAM,OAAO,GAAG,CAAC,OAA0C,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;IACvG,OAAO,CAAC,GAAG,2BAA2B,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC,mBAAmB,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;AACtH,CAAC","sourcesContent":["import { isAbsolute, relative, resolve, sep } from \"node:path\";\nimport { asyncScope } from \"../async-scope.ts\";\nimport { mapRestoredPath, mapRestoredPathAsync } from \"../session-worktree-snapshots.ts\";\nimport type { PathContinuation, WorktreeRootMapping } from \"../worktree-snapshot/types.ts\";\n\n/** The restores that apply to the paths resolved by the current work: its own, after those of any work it runs in. */\nconst scopedMappings = asyncScope<readonly WorktreeRootMapping[]>();\n\n/** Where the current session continued instead of checkouts it worked in, which its file tools follow (#5379). */\nconst scopedContinuations = asyncScope<readonly PathContinuation[]>();\n\n/** Whether `child` is `parent` or a path below it. */\nexport function isInside(parent: string, child: string): boolean {\n\tconst path = relative(parent, child);\n\treturn !path.startsWith(`..${sep}`) && path !== \"..\" && !isAbsolute(path);\n}\n\n/** The restores that apply to work started here: those of the sessions and runs it runs in, outermost first. */\nexport function currentWorktreeRootMappings(): readonly WorktreeRootMapping[] {\n\treturn scopedMappings.getStore() ?? [];\n}\n\n/**\n * Runs `work` with `mappings` (one session's or run's restores, oldest first) applying to the paths its tools resolve,\n * after `outer`: the restores of the sessions and runs the work belongs to, by default those of the work it runs in. A\n * checkout that `mappings` restores follows its own restore, never an outer one. The restores of other sessions and\n * runs never apply.\n */\nexport function withWorktreeRootMappings<T>(\n\tmappings: readonly WorktreeRootMapping[],\n\twork: () => T,\n\touter: readonly WorktreeRootMapping[] = currentWorktreeRootMappings(),\n\tcontinuations?: readonly PathContinuation[],\n): T {\n\tconst restoredHere = new Set(mappings.map((mapping) => resolve(mapping.from)));\n\tconst scoped = () =>\n\t\tscopedMappings.run([...outer.filter((mapping) => !restoredHere.has(resolve(mapping.from))), ...mappings], work);\n\treturn continuations === undefined ? scoped() : scopedContinuations.run(continuations, scoped);\n}\n\n/** The notices of checkouts the current work's sessions and runs hold only part of, or continued without (#4738). */\nconst scopedRestoreNotices = asyncScope<readonly string[]>();\n\n/**\n * The notices of the checkouts that the sessions and runs work started here runs in hold less of than their recorded\n * snapshots, or continued without (#4738), outermost first. A session opened here tells its model about them.\n */\nexport function currentWorktreeRestoreNotices(): readonly string[] {\n\treturn scopedRestoreNotices.getStore() ?? [];\n}\n\n/**\n * Runs `work` with `notices`, one per checkout restored with less than its snapshot or not at all, after the outer ones;\n * a notice an outer run already gives is not repeated.\n */\nexport function withWorktreeRestoreNotices<T>(notices: readonly string[], work: () => T): T {\n\tconst outer = currentWorktreeRestoreNotices();\n\tconst added = notices.filter((notice) => !outer.includes(notice));\n\tif (added.length === 0) return work();\n\treturn scopedRestoreNotices.run([...outer, ...added], work);\n}\n\n/**\n * `path` as it resolves for work in `cwd` under the restores of the current session or run: a path under a checkout it\n * recorded elsewhere (on another node, or a checkout it no longer uses here) moves to the same place in the worktree\n * that checkout was restored into, whether or not the old path exists here. Paths in a recorded checkout that `cwd` is\n * in are never redirected. Outside a session's or run's work, every path is returned unchanged.\n */\nexport function mapPathForCwd(path: string, cwd: string): string {\n\tconst mapped = mapRestoredPath(path, mappingsForCwd(cwd));\n\treturn mapped === resolve(path) ? path : mapped;\n}\n\nexport async function mapPathForCwdAsync(path: string, cwd: string): Promise<string> {\n\tconst mapped = await mapRestoredPathAsync(path, mappingsForCwd(cwd));\n\treturn mapped === resolve(path) ? path : mapped;\n}\n\n/**\n * The restores, then the directories the session went on in instead of checkouts it worked in (#5379), that apply to\n * paths resolved in `cwd`: a path under a working directory the session left follows it to where it continued.\n */\nfunction mappingsForCwd(cwd: string): readonly Pick<WorktreeRootMapping, \"from\" | \"to\">[] {\n\tconst base = resolve(cwd);\n\tconst applies = (mapping: Pick<WorktreeRootMapping, \"from\">) => !isInside(resolve(mapping.from), base);\n\treturn [...currentWorktreeRootMappings().filter(applies), ...(scopedContinuations.getStore() ?? []).filter(applies)];\n}\n"]}
|
|
@@ -66,6 +66,15 @@ export interface PrepareSessionResumeOptions {
|
|
|
66
66
|
* reach the agent and the user with that tool's result, not `notices`.
|
|
67
67
|
*/
|
|
68
68
|
readonly waitForBlueprint?: "prompt" | "tools";
|
|
69
|
+
/**
|
|
70
|
+
* Restored worktrees whose trust the session decides only after it starts (#5693): when the resume restores one, it
|
|
71
|
+
* returns once restored, as with `waitForBlueprint: "tools"`, and the build starts when `decided` settles, so no
|
|
72
|
+
* project build step runs before the decision. `blueprint.trusted` answers for them after that.
|
|
73
|
+
*/
|
|
74
|
+
readonly trustDecidedLater?: {
|
|
75
|
+
readonly applies: (root: string) => Promise<boolean>;
|
|
76
|
+
readonly decided: Promise<void>;
|
|
77
|
+
};
|
|
69
78
|
}
|
|
70
79
|
export type PreparedSessionResume = {
|
|
71
80
|
readonly status: "c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
386
386
|
}
|
|
387
|
-
|
|
387
|
+
const trustLater = options.trustDecidedLater;
|
|
388
|
+
let decided;
|
|
389
|
+
if (trustLater !== undefined && options.blueprints !== "skip") {
|
|
390
|
+
for (const root of restoredNow)
|
|
391
|
+
if (await trustLater.applies(root))
|
|
392
|
+
decided = trustLater.decided;
|
|
393
|
+
}
|
|
394
|
+
const awaitsTrust = decided !== undefined;
|
|
395
|
+
if (restoredNow.size > 0 && options.blueprints !== "skip" && (options.waitForBlueprint === "tools" || awaitsTrust)) {
|
|
388
396
|
// The build can be stopped when the process ends before it does (#4748): its steps' process trees end with it,
|
|
389
397
|
// what ran is recorded, and the ledger keeps the worktrees unbuilt for the next resume.
|
|
390
398
|
const stopping = new AbortController();
|
|
391
399
|
const signal = options.signal === undefined ? stopping.signal : AbortSignal.any([options.signal, stopping.signal]);
|
|
392
|
-
|
|
400
|
+
// A build that waits for the session's trust decision claims and locks nothing while it waits.
|
|
401
|
+
const building = (decided ? untilSettled(decided, signal) : Promise.resolve()).then(() => setUpCheckoutBlueprints(opened.sessionManager, restoredNow, storeDir, { ...options, signal }, lfs));
|
|
393
402
|
const result = building.then(async (blueprints) => {
|
|
394
403
|
await buildSettled(opened.sessionManager);
|
|
395
404
|
return { report: blueprintBuildReport(blueprints), notices: blueprints.notices };
|
|
@@ -818,6 +827,22 @@ async function setUpCheckoutBlueprints(sessionManager, restoredNow, storeDir, op
|
|
|
818
827
|
settle(undefined);
|
|
819
828
|
}
|
|
820
829
|
}
|
|
830
|
+
/** `promise`, or `signal`'s reason once it aborts first. */
|
|
831
|
+
function untilSettled(promise, signal) {
|
|
832
|
+
if (signal.aborted)
|
|
833
|
+
return Promise.reject(signal.reason);
|
|
834
|
+
return new Promise((resolvePromise, reject) => {
|
|
835
|
+
const abort = () => reject(signal.reason);
|
|
836
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
837
|
+
promise.then(() => {
|
|
838
|
+
signal.removeEventListener("abort", abort);
|
|
839
|
+
resolvePromise();
|
|
840
|
+
}, (error) => {
|
|
841
|
+
signal.removeEventListener("abort", abort);
|
|
842
|
+
reject(error);
|
|
843
|
+
});
|
|
844
|
+
});
|
|
845
|
+
}
|
|
821
846
|
/** The blueprint builds this process runs, by the restored worktree they build, each settling once its build has. */
|
|
822
847
|
const buildsInProgress = new Map();
|
|
823
848
|
async function setAsideCancelledBuilds(sessionManager, storeDir, options) {
|