@bastani/atomic 0.9.89 → 0.9.90-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 +113 -0
- package/dist/builtin/intercom/CHANGELOG.md +13 -0
- package/dist/builtin/intercom/README.md +3 -1
- package/dist/builtin/intercom/broker/broker.ts +35 -10
- package/dist/builtin/intercom/broker/client.ts +42 -1
- package/dist/builtin/intercom/index.bundle.mjs +400 -67
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/intercom/skills/intercom/SKILL.md +24 -5
- package/dist/builtin/intercom/types.ts +5 -0
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +27 -0
- package/dist/builtin/subagents/README.md +18 -20
- package/dist/builtin/subagents/agents/worker.md +1 -1
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/skills/feedback/SKILL.md +2 -2
- package/dist/builtin/subagents/skills/qlty/SKILL.md +2 -2
- package/dist/builtin/subagents/skills/qlty/references/commands.md +45 -12
- package/dist/builtin/subagents/skills/qlty/references/quickstart.md +102 -21
- package/dist/builtin/subagents/skills/subagent/SKILL.md +18 -17
- package/dist/builtin/subagents/skills/tdd/LICENSE.txt +50 -0
- package/dist/builtin/subagents/skills/tdd/SKILL.md +10 -0
- package/dist/builtin/subagents/skills/tdd/tests.md +16 -0
- package/dist/builtin/subagents/skills/tmux/LICENSE.txt +24 -0
- package/dist/builtin/subagents/skills/tmux/SKILL.md +20 -1
- package/dist/builtin/subagents/skills/tmux/scripts/find-sessions.sh +19 -10
- package/dist/builtin/subagents/skills/tmux/scripts/wait-for-text.sh +231 -19
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +1911 -845
- package/dist/builtin/web-access/CHANGELOG.md +6 -0
- package/dist/builtin/web-access/index.bundle.mjs +158 -34
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +36 -0
- package/dist/builtin/workflows/builtin/{chunk-tjk7jp9a.js → chunk-akmcsx14.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-913nwrzq.js → chunk-erpybg3c.js} +109 -30
- package/dist/builtin/workflows/builtin/{chunk-e07n7en6.js → chunk-wpgpr31s.js} +1 -1
- package/dist/builtin/workflows/builtin/goal.js +2 -2
- package/dist/builtin/workflows/builtin/index.js +3 -3
- package/dist/builtin/workflows/builtin/ralph.js +2 -2
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/skills/bro/SKILL.md +1 -1
- package/dist/builtin/workflows/skills/prompt-engineer/references/claude_fable_5_2.md +19 -19
- package/dist/builtin/workflows/skills/prompt-engineer/references/claude_haiku_5_5.md +2 -2
- package/dist/builtin/workflows/skills/prompt-engineer/references/claude_opus_5_5.md +3 -3
- package/dist/builtin/workflows/skills/prompt-engineer/references/gpt_6.md +2 -2
- package/dist/builtin/workflows/skills/prompt-engineer/references/gpt_6_1_sol.md +2 -2
- package/dist/builtin/workflows/skills/prompt-engineer/references/gpt_6_1_terra.md +3 -3
- package/dist/builtin/workflows/skills/prompt-engineer/references/gpt_6_2.md +3 -2
- package/dist/builtin/workflows/skills/show-me/SKILL.md +2 -2
- package/dist/builtin/workflows/skills/skill-creator/scripts/run_eval.py +29 -24
- package/dist/builtin/workflows/skills/teach/SKILL.md +8 -8
- package/dist/builtin/workflows/skills/unslop/SKILL.md +29 -51
- package/dist/builtin/workflows/src/durable/journal/internal.d.ts +10 -5
- package/dist/builtin/workflows/src/durable/journal/sharded-run-journal.d.ts +6 -3
- package/dist/builtin/workflows/src/durable/journal/sql-run-journal.d.ts +25 -3
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +4444 -1356
- package/dist/builtin/workflows/src/extension/local-worker-entry.mjs +2544 -568
- package/dist/builtin/workflows/src/index.js +2467 -549
- package/dist/builtin/workflows/src/local-worker-entry.mjs +2544 -568
- package/dist/cli/storage-command.d.ts +6 -0
- package/dist/cli/storage-command.d.ts.map +1 -1
- package/dist/cli/storage-command.js +11 -0
- package/dist/cli/storage-command.js.map +1 -1
- package/dist/cli/storage-search-database.d.ts +18 -0
- package/dist/cli/storage-search-database.d.ts.map +1 -0
- package/dist/cli/storage-search-database.js +90 -0
- package/dist/cli/storage-search-database.js.map +1 -0
- package/dist/cli/storage-search-session.d.ts +5 -0
- package/dist/cli/storage-search-session.d.ts.map +1 -0
- package/dist/cli/storage-search-session.js +133 -0
- package/dist/cli/storage-search-session.js.map +1 -0
- package/dist/core/agent-session-accessors.d.ts.map +1 -1
- package/dist/core/agent-session-accessors.js +107 -1
- package/dist/core/agent-session-accessors.js.map +1 -1
- package/dist/core/agent-session-bash.d.ts.map +1 -1
- package/dist/core/agent-session-bash.js +2 -0
- package/dist/core/agent-session-bash.js.map +1 -1
- package/dist/core/agent-session-boundaries.d.ts +2 -0
- package/dist/core/agent-session-boundaries.d.ts.map +1 -1
- package/dist/core/agent-session-boundaries.js +9 -4
- package/dist/core/agent-session-boundaries.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 +2 -1
- package/dist/core/agent-session-custom-message-commit.js.map +1 -1
- package/dist/core/agent-session-detached-tools.d.ts +3 -2
- package/dist/core/agent-session-detached-tools.d.ts.map +1 -1
- package/dist/core/agent-session-detached-tools.js +156 -41
- package/dist/core/agent-session-detached-tools.js.map +1 -1
- package/dist/core/agent-session-events.d.ts +2 -1
- package/dist/core/agent-session-events.d.ts.map +1 -1
- package/dist/core/agent-session-events.js +59 -23
- package/dist/core/agent-session-events.js.map +1 -1
- package/dist/core/agent-session-extension-bindings.d.ts.map +1 -1
- package/dist/core/agent-session-extension-bindings.js +53 -4
- package/dist/core/agent-session-extension-bindings.js.map +1 -1
- package/dist/core/agent-session-message-queue.d.ts.map +1 -1
- package/dist/core/agent-session-message-queue.js +2 -1
- package/dist/core/agent-session-message-queue.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +23 -3
- package/dist/core/agent-session-methods.d.ts.map +1 -1
- package/dist/core/agent-session-methods.js.map +1 -1
- package/dist/core/agent-session-models.d.ts.map +1 -1
- package/dist/core/agent-session-models.js +2 -0
- package/dist/core/agent-session-models.js.map +1 -1
- package/dist/core/agent-session-prompt.d.ts +1 -1
- package/dist/core/agent-session-prompt.d.ts.map +1 -1
- package/dist/core/agent-session-prompt.js +14 -3
- package/dist/core/agent-session-prompt.js.map +1 -1
- package/dist/core/agent-session-queue-pause.d.ts +2 -1
- package/dist/core/agent-session-queue-pause.d.ts.map +1 -1
- package/dist/core/agent-session-queue-pause.js +8 -4
- package/dist/core/agent-session-queue-pause.js.map +1 -1
- package/dist/core/agent-session-retry.d.ts +7 -3
- package/dist/core/agent-session-retry.d.ts.map +1 -1
- package/dist/core/agent-session-retry.js +113 -112
- package/dist/core/agent-session-retry.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +15 -0
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +26 -0
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +5 -2
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +6 -6
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session-tasks.js.map +1 -1
- package/dist/core/agent-session-tool-registry.d.ts.map +1 -1
- package/dist/core/agent-session-tool-registry.js +4 -2
- package/dist/core/agent-session-tool-registry.js.map +1 -1
- package/dist/core/agent-session-types.d.ts +19 -1
- package/dist/core/agent-session-types.d.ts.map +1 -1
- package/dist/core/agent-session-types.js.map +1 -1
- package/dist/core/agent-session.d.ts +11 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +8 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/anthropic-thinking-guard.d.ts +16 -1
- package/dist/core/anthropic-thinking-guard.d.ts.map +1 -1
- package/dist/core/anthropic-thinking-guard.js +124 -7
- package/dist/core/anthropic-thinking-guard.js.map +1 -1
- package/dist/core/auth-storage.d.ts +3 -0
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +10 -0
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/detached-tool-output.d.ts +4 -0
- package/dist/core/detached-tool-output.d.ts.map +1 -0
- package/dist/core/detached-tool-output.js +48 -0
- package/dist/core/detached-tool-output.js.map +1 -0
- package/dist/core/event-loop-monitor.d.ts +4 -1
- package/dist/core/event-loop-monitor.d.ts.map +1 -1
- package/dist/core/event-loop-monitor.js +84 -159
- package/dist/core/event-loop-monitor.js.map +1 -1
- package/dist/core/export-html/index.d.ts.map +1 -1
- package/dist/core/export-html/index.js +26 -4
- package/dist/core/export-html/index.js.map +1 -1
- package/dist/core/export-html/saved-agent-cards.d.ts +15 -0
- package/dist/core/export-html/saved-agent-cards.d.ts.map +1 -0
- package/dist/core/export-html/saved-agent-cards.js +255 -0
- package/dist/core/export-html/saved-agent-cards.js.map +1 -0
- package/dist/core/export-html/saved-agent-viewer.js +101 -0
- package/dist/core/extensions/builtin-subagent-record-writer.d.ts +11 -0
- package/dist/core/extensions/builtin-subagent-record-writer.d.ts.map +1 -0
- package/dist/core/extensions/builtin-subagent-record-writer.js +33 -0
- package/dist/core/extensions/builtin-subagent-record-writer.js.map +1 -0
- package/dist/core/extensions/loader-api.d.ts +1 -1
- package/dist/core/extensions/loader-api.d.ts.map +1 -1
- package/dist/core/extensions/loader-api.js +9 -2
- package/dist/core/extensions/loader-api.js.map +1 -1
- package/dist/core/extensions/loader-bindings.d.ts +7 -0
- package/dist/core/extensions/loader-bindings.d.ts.map +1 -1
- package/dist/core/extensions/loader-bindings.js +42 -1
- package/dist/core/extensions/loader-bindings.js.map +1 -1
- package/dist/core/extensions/loader-core.d.ts.map +1 -1
- package/dist/core/extensions/loader-core.js +33 -12
- package/dist/core/extensions/loader-core.js.map +1 -1
- package/dist/core/extensions/runner-events.d.ts +2 -0
- package/dist/core/extensions/runner-events.d.ts.map +1 -1
- package/dist/core/extensions/runner-events.js +17 -7
- package/dist/core/extensions/runner-events.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +6 -2
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +5 -2
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/ui-types.d.ts +4 -0
- package/dist/core/extensions/ui-types.d.ts.map +1 -1
- package/dist/core/extensions/ui-types.js.map +1 -1
- package/dist/core/extensions/workflow-run-control-hub.d.ts +2 -2
- package/dist/core/extensions/workflow-run-control-hub.d.ts.map +1 -1
- package/dist/core/extensions/workflow-run-control-hub.js +2 -2
- package/dist/core/extensions/workflow-run-control-hub.js.map +1 -1
- package/dist/core/extensions/workflow-run-control.d.ts +10 -3
- package/dist/core/extensions/workflow-run-control.d.ts.map +1 -1
- package/dist/core/extensions/workflow-run-control.js.map +1 -1
- package/dist/core/first-prompt-model.d.ts +22 -0
- package/dist/core/first-prompt-model.d.ts.map +1 -0
- package/dist/core/first-prompt-model.js +84 -0
- package/dist/core/first-prompt-model.js.map +1 -0
- package/dist/core/footer-data-provider.d.ts.map +1 -1
- package/dist/core/footer-data-provider.js +11 -7
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/fork-replay-pair.d.ts +22 -0
- package/dist/core/fork-replay-pair.d.ts.map +1 -0
- package/dist/core/fork-replay-pair.js +174 -0
- package/dist/core/fork-replay-pair.js.map +1 -0
- package/dist/core/fork-replay-wire.d.ts +11 -0
- package/dist/core/fork-replay-wire.d.ts.map +1 -0
- package/dist/core/fork-replay-wire.js +116 -0
- package/dist/core/fork-replay-wire.js.map +1 -0
- package/dist/core/messages.d.ts +2 -0
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js +8 -4
- package/dist/core/messages.js.map +1 -1
- package/dist/core/model-runtime.d.ts +10 -1
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +76 -11
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/package-manager-auto-resources.d.ts.map +1 -1
- package/dist/core/package-manager-auto-resources.js +3 -2
- package/dist/core/package-manager-auto-resources.js.map +1 -1
- package/dist/core/package-manager-resource-files.js +7 -8
- package/dist/core/package-manager-resource-files.js.map +1 -1
- package/dist/core/project-trust-state.d.ts +90 -0
- package/dist/core/project-trust-state.d.ts.map +1 -0
- package/dist/core/project-trust-state.js +65 -0
- package/dist/core/project-trust-state.js.map +1 -0
- package/dist/core/provider-rate-limits.d.ts +6 -0
- package/dist/core/provider-rate-limits.d.ts.map +1 -1
- package/dist/core/provider-rate-limits.js +43 -0
- package/dist/core/provider-rate-limits.js.map +1 -1
- package/dist/core/provider-request-admission.d.ts.map +1 -1
- package/dist/core/provider-request-admission.js +10 -1
- package/dist/core/provider-request-admission.js.map +1 -1
- package/dist/core/remote-catalog-provider.d.ts +6 -1
- package/dist/core/remote-catalog-provider.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.js +22 -1
- package/dist/core/remote-catalog-provider.js.map +1 -1
- package/dist/core/resolve-config-value.d.ts.map +1 -1
- package/dist/core/resolve-config-value.js +5 -2
- package/dist/core/resolve-config-value.js.map +1 -1
- package/dist/core/resource-loader-core.d.ts.map +1 -1
- package/dist/core/resource-loader-core.js +3 -0
- package/dist/core/resource-loader-core.js.map +1 -1
- package/dist/core/resource-loader-extensions.d.ts +2 -2
- package/dist/core/resource-loader-extensions.d.ts.map +1 -1
- package/dist/core/resource-loader-extensions.js +6 -4
- package/dist/core/resource-loader-extensions.js.map +1 -1
- package/dist/core/resource-loader-package-resources.d.ts +1 -0
- package/dist/core/resource-loader-package-resources.d.ts.map +1 -1
- package/dist/core/resource-loader-package-resources.js +2 -1
- package/dist/core/resource-loader-package-resources.js.map +1 -1
- package/dist/core/resource-loader-reload.d.ts +1 -1
- package/dist/core/resource-loader-reload.d.ts.map +1 -1
- package/dist/core/resource-loader-reload.js +3 -2
- package/dist/core/resource-loader-reload.js.map +1 -1
- package/dist/core/resource-loader-types.d.ts +2 -0
- package/dist/core/resource-loader-types.d.ts.map +1 -1
- package/dist/core/resource-loader-types.js.map +1 -1
- package/dist/core/resume/blueprint/actions.d.ts.map +1 -1
- package/dist/core/resume/blueprint/actions.js +15 -15
- package/dist/core/resume/blueprint/actions.js.map +1 -1
- package/dist/core/resume/blueprint/process.d.ts +6 -1
- package/dist/core/resume/blueprint/process.d.ts.map +1 -1
- package/dist/core/resume/blueprint/process.js +132 -21
- package/dist/core/resume/blueprint/process.js.map +1 -1
- package/dist/core/runtime-credentials.d.ts +5 -0
- package/dist/core/runtime-credentials.d.ts.map +1 -1
- package/dist/core/runtime-credentials.js +34 -0
- package/dist/core/runtime-credentials.js.map +1 -1
- package/dist/core/sdk-types.d.ts +2 -0
- package/dist/core/sdk-types.d.ts.map +1 -1
- package/dist/core/sdk-types.js.map +1 -1
- package/dist/core/sdk.d.ts +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +187 -32
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-account-model.d.ts +15 -0
- package/dist/core/session-account-model.d.ts.map +1 -0
- package/dist/core/session-account-model.js +105 -0
- package/dist/core/session-account-model.js.map +1 -0
- package/dist/core/session-lifecycle-scope.d.ts +5 -0
- package/dist/core/session-lifecycle-scope.d.ts.map +1 -1
- package/dist/core/session-lifecycle-scope.js.map +1 -1
- package/dist/core/session-manager-core.d.ts +21 -2
- package/dist/core/session-manager-core.d.ts.map +1 -1
- package/dist/core/session-manager-core.js +64 -8
- package/dist/core/session-manager-core.js.map +1 -1
- package/dist/core/session-manager-history.d.ts +3 -1
- package/dist/core/session-manager-history.d.ts.map +1 -1
- package/dist/core/session-manager-history.js +19 -5
- package/dist/core/session-manager-history.js.map +1 -1
- package/dist/core/session-manager-types.d.ts +2 -0
- package/dist/core/session-manager-types.d.ts.map +1 -1
- package/dist/core/session-manager-types.js.map +1 -1
- package/dist/core/session-retry-status.d.ts +22 -0
- package/dist/core/session-retry-status.d.ts.map +1 -0
- package/dist/core/session-retry-status.js +25 -0
- package/dist/core/session-retry-status.js.map +1 -0
- package/dist/core/session-worktree-snapshots.d.ts +4 -2
- package/dist/core/session-worktree-snapshots.d.ts.map +1 -1
- package/dist/core/session-worktree-snapshots.js +8 -4
- package/dist/core/session-worktree-snapshots.js.map +1 -1
- package/dist/core/settings-manager-core.d.ts +4 -0
- package/dist/core/settings-manager-core.d.ts.map +1 -1
- package/dist/core/settings-manager-core.js +73 -1
- package/dist/core/settings-manager-core.js.map +1 -1
- package/dist/core/settings-schema.js +1 -1
- package/dist/core/settings-schema.js.map +1 -1
- package/dist/core/slash-commands.d.ts +2 -2
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +15 -4
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/storage/database.d.ts +14 -2
- package/dist/core/storage/database.d.ts.map +1 -1
- package/dist/core/storage/database.js.map +1 -1
- package/dist/core/storage/dialect.d.ts +13 -0
- package/dist/core/storage/dialect.d.ts.map +1 -1
- package/dist/core/storage/dialect.js +9 -1
- package/dist/core/storage/dialect.js.map +1 -1
- package/dist/core/storage/errors.d.ts +23 -1
- package/dist/core/storage/errors.d.ts.map +1 -1
- package/dist/core/storage/errors.js +28 -5
- package/dist/core/storage/errors.js.map +1 -1
- package/dist/core/storage/journal-transfer.d.ts.map +1 -1
- package/dist/core/storage/journal-transfer.js +90 -5
- package/dist/core/storage/journal-transfer.js.map +1 -1
- package/dist/core/storage/node-sqlite.d.ts.map +1 -1
- package/dist/core/storage/node-sqlite.js +61 -1
- package/dist/core/storage/node-sqlite.js.map +1 -1
- package/dist/core/storage/session/chunked-resume-projection.d.ts +4 -0
- package/dist/core/storage/session/chunked-resume-projection.d.ts.map +1 -0
- package/dist/core/storage/session/chunked-resume-projection.js +369 -0
- package/dist/core/storage/session/chunked-resume-projection.js.map +1 -0
- package/dist/core/storage/session/legacy-session-store.d.ts +5 -0
- package/dist/core/storage/session/legacy-session-store.d.ts.map +1 -1
- package/dist/core/storage/session/legacy-session-store.js +10 -2
- package/dist/core/storage/session/legacy-session-store.js.map +1 -1
- package/dist/core/storage/session/memory-session-store.d.ts.map +1 -1
- package/dist/core/storage/session/memory-session-store.js +6 -1
- package/dist/core/storage/session/memory-session-store.js.map +1 -1
- package/dist/core/storage/session/snapshot-generation.d.ts +8 -0
- package/dist/core/storage/session/snapshot-generation.d.ts.map +1 -0
- package/dist/core/storage/session/snapshot-generation.js +17 -0
- package/dist/core/storage/session/snapshot-generation.js.map +1 -0
- package/dist/core/storage/session/sql-session-store.d.ts +12 -0
- package/dist/core/storage/session/sql-session-store.d.ts.map +1 -1
- package/dist/core/storage/session/sql-session-store.js +243 -46
- package/dist/core/storage/session/sql-session-store.js.map +1 -1
- package/dist/core/storage/sqlite-facade.d.ts +17 -2
- package/dist/core/storage/sqlite-facade.d.ts.map +1 -1
- package/dist/core/storage/sqlite-facade.js +17 -1
- package/dist/core/storage/sqlite-facade.js.map +1 -1
- package/dist/core/tasks/agent-adapter.d.ts +13 -2
- package/dist/core/tasks/agent-adapter.d.ts.map +1 -1
- package/dist/core/tasks/agent-adapter.js +25 -8
- package/dist/core/tasks/agent-adapter.js.map +1 -1
- package/dist/core/tasks/agent-panel-rules.d.ts +77 -0
- package/dist/core/tasks/agent-panel-rules.d.ts.map +1 -0
- package/dist/core/tasks/agent-panel-rules.js +88 -0
- package/dist/core/tasks/agent-panel-rules.js.map +1 -0
- package/dist/core/tasks/agent-panel-source.d.ts +19 -0
- package/dist/core/tasks/agent-panel-source.d.ts.map +1 -1
- package/dist/core/tasks/agent-panel-source.js +50 -9
- package/dist/core/tasks/agent-panel-source.js.map +1 -1
- package/dist/core/tasks/command-output.d.ts +17 -2
- package/dist/core/tasks/command-output.d.ts.map +1 -1
- package/dist/core/tasks/command-output.js +59 -3
- package/dist/core/tasks/command-output.js.map +1 -1
- package/dist/core/tasks/completion-message.d.ts +8 -3
- package/dist/core/tasks/completion-message.d.ts.map +1 -1
- package/dist/core/tasks/completion-message.js +14 -10
- package/dist/core/tasks/completion-message.js.map +1 -1
- package/dist/core/tasks/completion.d.ts +14 -4
- package/dist/core/tasks/completion.d.ts.map +1 -1
- package/dist/core/tasks/completion.js +58 -17
- package/dist/core/tasks/completion.js.map +1 -1
- package/dist/core/tasks/contracts.d.ts +10 -1
- package/dist/core/tasks/contracts.d.ts.map +1 -1
- package/dist/core/tasks/contracts.js +3 -1
- package/dist/core/tasks/contracts.js.map +1 -1
- package/dist/core/tasks/heartbeat.js +2 -1
- package/dist/core/tasks/heartbeat.js.map +1 -1
- package/dist/core/tasks/live-elapsed.d.ts +16 -1
- package/dist/core/tasks/live-elapsed.d.ts.map +1 -1
- package/dist/core/tasks/live-elapsed.js +43 -4
- package/dist/core/tasks/live-elapsed.js.map +1 -1
- package/dist/core/tasks/owner-store.d.ts +8 -0
- package/dist/core/tasks/owner-store.d.ts.map +1 -1
- package/dist/core/tasks/owner-store.js +34 -4
- package/dist/core/tasks/owner-store.js.map +1 -1
- package/dist/core/tasks/session-scope.d.ts +7 -0
- package/dist/core/tasks/session-scope.d.ts.map +1 -1
- package/dist/core/tasks/session-scope.js +15 -9
- package/dist/core/tasks/session-scope.js.map +1 -1
- package/dist/core/tasks/supervisor.d.ts +7 -3
- package/dist/core/tasks/supervisor.d.ts.map +1 -1
- package/dist/core/tasks/supervisor.js +92 -17
- package/dist/core/tasks/supervisor.js.map +1 -1
- package/dist/core/tasks/task-archive-snapshot.d.ts +7 -0
- package/dist/core/tasks/task-archive-snapshot.d.ts.map +1 -0
- package/dist/core/tasks/task-archive-snapshot.js +33 -0
- package/dist/core/tasks/task-archive-snapshot.js.map +1 -0
- package/dist/core/tasks/task-resumer.d.ts +5 -3
- package/dist/core/tasks/task-resumer.d.ts.map +1 -1
- package/dist/core/tasks/task-resumer.js +37 -13
- package/dist/core/tasks/task-resumer.js.map +1 -1
- package/dist/core/tasks/task-view-source.d.ts +25 -3
- package/dist/core/tasks/task-view-source.d.ts.map +1 -1
- package/dist/core/tasks/task-view-source.js +144 -44
- package/dist/core/tasks/task-view-source.js.map +1 -1
- package/dist/core/tasks/transcript.d.ts +3 -1
- package/dist/core/tasks/transcript.d.ts.map +1 -1
- package/dist/core/tasks/transcript.js +27 -0
- package/dist/core/tasks/transcript.js.map +1 -1
- package/dist/core/tools/ask-user-question/view/dialog-builder.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/view/dialog-builder.js +2 -1
- package/dist/core/tools/ask-user-question/view/dialog-builder.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-protocol.d.ts.map +1 -1
- package/dist/core/tools/history-protocol.js +130 -29
- package/dist/core/tools/history-protocol.js.map +1 -1
- package/dist/core/tools/history-search-position.d.ts +30 -0
- package/dist/core/tools/history-search-position.d.ts.map +1 -0
- package/dist/core/tools/history-search-position.js +161 -0
- package/dist/core/tools/history-search-position.js.map +1 -0
- package/dist/core/tools/history-search-wire.d.ts +25 -0
- package/dist/core/tools/history-search-wire.d.ts.map +1 -0
- package/dist/core/tools/history-search-wire.js +210 -0
- package/dist/core/tools/history-search-wire.js.map +1 -0
- package/dist/core/tools/resource-selectors.d.ts +7 -1
- package/dist/core/tools/resource-selectors.d.ts.map +1 -1
- package/dist/core/tools/resource-selectors.js +18 -11
- package/dist/core/tools/resource-selectors.js.map +1 -1
- package/dist/core/tools/search.d.ts.map +1 -1
- package/dist/core/tools/search.js +24 -3
- package/dist/core/tools/search.js.map +1 -1
- package/dist/core/tools/sqlite-selector-connection.d.ts +3 -0
- package/dist/core/tools/sqlite-selector-connection.d.ts.map +1 -1
- package/dist/core/tools/sqlite-selector-connection.js +4 -0
- package/dist/core/tools/sqlite-selector-connection.js.map +1 -1
- package/dist/core/tools/tool-abort-grace.d.ts +13 -0
- package/dist/core/tools/tool-abort-grace.d.ts.map +1 -0
- package/dist/core/tools/tool-abort-grace.js +72 -0
- package/dist/core/tools/tool-abort-grace.js.map +1 -0
- package/dist/core/tools/tool-concurrency.d.ts +5 -1
- package/dist/core/tools/tool-concurrency.d.ts.map +1 -1
- package/dist/core/tools/tool-concurrency.js +36 -6
- package/dist/core/tools/tool-concurrency.js.map +1 -1
- package/dist/core/workflow-resume.d.ts +1 -1
- package/dist/core/workflow-resume.d.ts.map +1 -1
- package/dist/core/workflow-resume.js +13 -3
- package/dist/core/workflow-resume.js.map +1 -1
- package/dist/core/workflow-summary-lifecycle.d.ts.map +1 -1
- package/dist/core/workflow-summary-lifecycle.js +8 -2
- package/dist/core/workflow-summary-lifecycle.js.map +1 -1
- package/dist/core/workspace/errors.d.ts +5 -2
- package/dist/core/workspace/errors.d.ts.map +1 -1
- package/dist/core/workspace/errors.js +59 -5
- package/dist/core/workspace/errors.js.map +1 -1
- package/dist/core/worktree-snapshot/blob-store.d.ts +138 -17
- package/dist/core/worktree-snapshot/blob-store.d.ts.map +1 -1
- package/dist/core/worktree-snapshot/blob-store.js +788 -82
- package/dist/core/worktree-snapshot/blob-store.js.map +1 -1
- package/dist/core/worktree-snapshot/garbage.d.ts +17 -2
- package/dist/core/worktree-snapshot/garbage.d.ts.map +1 -1
- package/dist/core/worktree-snapshot/garbage.js +20 -4
- package/dist/core/worktree-snapshot/garbage.js.map +1 -1
- package/dist/core/worktree-snapshot/index.d.ts +1 -1
- package/dist/core/worktree-snapshot/index.d.ts.map +1 -1
- package/dist/core/worktree-snapshot/index.js +1 -1
- package/dist/core/worktree-snapshot/index.js.map +1 -1
- package/dist/core/worktree-snapshot/pool.d.ts.map +1 -1
- package/dist/core/worktree-snapshot/pool.js +38 -6
- package/dist/core/worktree-snapshot/pool.js.map +1 -1
- package/dist/core/worktree-snapshot/shared-clock.d.ts +3 -1
- package/dist/core/worktree-snapshot/shared-clock.d.ts.map +1 -1
- package/dist/core/worktree-snapshot/shared-clock.js +116 -26
- package/dist/core/worktree-snapshot/shared-clock.js.map +1 -1
- package/dist/core/worktree-snapshot/types.d.ts +4 -1
- package/dist/core/worktree-snapshot/types.d.ts.map +1 -1
- package/dist/core/worktree-snapshot/types.js.map +1 -1
- package/dist/extensions/llama/huggingface-ui.d.ts.map +1 -1
- package/dist/extensions/llama/huggingface-ui.js +2 -2
- package/dist/extensions/llama/huggingface-ui.js.map +1 -1
- package/dist/extensions/llama/index.d.ts +2 -0
- package/dist/extensions/llama/index.d.ts.map +1 -1
- package/dist/extensions/llama/index.js +19 -2
- package/dist/extensions/llama/index.js.map +1 -1
- package/dist/index.d.ts +9 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -4
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +74 -15
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/agent-panel.d.ts +22 -6
- package/dist/modes/interactive/components/agent-panel.d.ts.map +1 -1
- package/dist/modes/interactive/components/agent-panel.js +80 -23
- package/dist/modes/interactive/components/agent-panel.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts +2 -0
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +11 -0
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/atomic-working-status.d.ts.map +1 -1
- package/dist/modes/interactive/components/atomic-working-status.js +10 -3
- package/dist/modes/interactive/components/atomic-working-status.js.map +1 -1
- package/dist/modes/interactive/components/bash-execution.d.ts +3 -2
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js +7 -7
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts +6 -0
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.js +12 -7
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/chat-message-renderer.d.ts +2 -0
- package/dist/modes/interactive/components/chat-message-renderer.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-message-renderer.js +24 -3
- package/dist/modes/interactive/components/chat-message-renderer.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-actions.d.ts +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 +16 -10
- package/dist/modes/interactive/components/chat-session-host-actions.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-events.d.ts +10 -0
- package/dist/modes/interactive/components/chat-session-host-events.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-events.js +76 -31
- package/dist/modes/interactive/components/chat-session-host-events.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-rendering.d.ts +17 -5
- package/dist/modes/interactive/components/chat-session-host-rendering.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-rendering.js +79 -24
- package/dist/modes/interactive/components/chat-session-host-rendering.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-runtime.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-runtime.js +5 -4
- package/dist/modes/interactive/components/chat-session-host-runtime.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-state.d.ts +16 -1
- package/dist/modes/interactive/components/chat-session-host-state.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-state.js +22 -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 +8 -2
- 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/chat-session-host-utils.d.ts +1 -0
- package/dist/modes/interactive/components/chat-session-host-utils.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-utils.js +2 -1
- package/dist/modes/interactive/components/chat-session-host-utils.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.d.ts +35 -9
- package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.js +129 -35
- package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
- package/dist/modes/interactive/components/chat-transcript.d.ts +13 -2
- package/dist/modes/interactive/components/chat-transcript.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-transcript.js +24 -4
- package/dist/modes/interactive/components/chat-transcript.js.map +1 -1
- package/dist/modes/interactive/components/compaction-boundary-message.d.ts +6 -0
- package/dist/modes/interactive/components/compaction-boundary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/compaction-boundary-message.js +12 -7
- package/dist/modes/interactive/components/compaction-boundary-message.js.map +1 -1
- package/dist/modes/interactive/components/composer-rule.d.ts +0 -2
- package/dist/modes/interactive/components/composer-rule.d.ts.map +1 -1
- package/dist/modes/interactive/components/composer-rule.js +4 -6
- package/dist/modes/interactive/components/composer-rule.js.map +1 -1
- package/dist/modes/interactive/components/countdown-timer.d.ts +5 -9
- package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -1
- package/dist/modes/interactive/components/countdown-timer.js +32 -23
- package/dist/modes/interactive/components/countdown-timer.js.map +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js +4 -3
- package/dist/modes/interactive/components/custom-editor.js.map +1 -1
- package/dist/modes/interactive/components/custom-entry.d.ts +6 -0
- package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-entry.js +15 -0
- package/dist/modes/interactive/components/custom-entry.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.d.ts +7 -3
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-message.js +17 -15
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +10 -3
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +37 -45
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/heartbeat-block.d.ts.map +1 -1
- package/dist/modes/interactive/components/heartbeat-block.js +3 -1
- package/dist/modes/interactive/components/heartbeat-block.js.map +1 -1
- package/dist/modes/interactive/components/host-input-form.d.ts.map +1 -1
- package/dist/modes/interactive/components/host-input-form.js +3 -3
- package/dist/modes/interactive/components/host-input-form.js.map +1 -1
- package/dist/modes/interactive/components/index.d.ts +1 -1
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/components/input-label.d.ts.map +1 -1
- package/dist/modes/interactive/components/input-label.js +4 -5
- package/dist/modes/interactive/components/input-label.js.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.d.ts +7 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.js +27 -6
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
- package/dist/modes/interactive/components/main-composer-keys.d.ts +17 -2
- package/dist/modes/interactive/components/main-composer-keys.d.ts.map +1 -1
- package/dist/modes/interactive/components/main-composer-keys.js +44 -27
- package/dist/modes/interactive/components/main-composer-keys.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts +6 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +13 -7
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/nav-keys.d.ts +7 -2
- package/dist/modes/interactive/components/nav-keys.d.ts.map +1 -1
- package/dist/modes/interactive/components/nav-keys.js +51 -17
- package/dist/modes/interactive/components/nav-keys.js.map +1 -1
- package/dist/modes/interactive/components/notice-line.d.ts +8 -0
- package/dist/modes/interactive/components/notice-line.d.ts.map +1 -1
- package/dist/modes/interactive/components/notice-line.js +6 -1
- package/dist/modes/interactive/components/notice-line.js.map +1 -1
- package/dist/modes/interactive/components/selector.d.ts +3 -0
- package/dist/modes/interactive/components/selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/selector.js +30 -7
- package/dist/modes/interactive/components/selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector-list.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector-list.js +11 -11
- package/dist/modes/interactive/components/session-selector-list.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +2 -2
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-picker.d.ts +5 -0
- package/dist/modes/interactive/components/settings-picker.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-picker.js +36 -2
- package/dist/modes/interactive/components/settings-picker.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector-submenus.d.ts +10 -0
- package/dist/modes/interactive/components/settings-selector-submenus.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector-submenus.js +89 -19
- package/dist/modes/interactive/components/settings-selector-submenus.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector-types.d.ts +6 -0
- package/dist/modes/interactive/components/settings-selector-types.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector-types.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +7 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +12 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +6 -0
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.js +12 -7
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
- package/dist/modes/interactive/components/task-board.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-board.js +9 -2
- package/dist/modes/interactive/components/task-board.js.map +1 -1
- package/dist/modes/interactive/components/task-completion-message.d.ts +10 -3
- package/dist/modes/interactive/components/task-completion-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-completion-message.js +173 -19
- package/dist/modes/interactive/components/task-completion-message.js.map +1 -1
- package/dist/modes/interactive/components/task-inspector.d.ts +1 -1
- package/dist/modes/interactive/components/task-inspector.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-inspector.js +28 -19
- package/dist/modes/interactive/components/task-inspector.js.map +1 -1
- package/dist/modes/interactive/components/task-list.d.ts +7 -3
- package/dist/modes/interactive/components/task-list.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-list.js +60 -33
- package/dist/modes/interactive/components/task-list.js.map +1 -1
- package/dist/modes/interactive/components/task-row.d.ts +7 -0
- package/dist/modes/interactive/components/task-row.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-row.js +25 -11
- package/dist/modes/interactive/components/task-row.js.map +1 -1
- package/dist/modes/interactive/components/task-transcript-notices.d.ts +16 -0
- package/dist/modes/interactive/components/task-transcript-notices.d.ts.map +1 -0
- package/dist/modes/interactive/components/task-transcript-notices.js +74 -0
- package/dist/modes/interactive/components/task-transcript-notices.js.map +1 -0
- package/dist/modes/interactive/components/task-transcript-page.d.ts +11 -6
- package/dist/modes/interactive/components/task-transcript-page.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-transcript-page.js +48 -21
- 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 +2 -1
- package/dist/modes/interactive/components/tool-block-families.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +3 -2
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +23 -9
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/transcript-block-clicks.d.ts +54 -14
- package/dist/modes/interactive/components/transcript-block-clicks.d.ts.map +1 -1
- package/dist/modes/interactive/components/transcript-block-clicks.js +151 -16
- package/dist/modes/interactive/components/transcript-block-clicks.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector-help.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector-help.js +25 -30
- package/dist/modes/interactive/components/tree-selector-help.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector-list.d.ts +4 -0
- package/dist/modes/interactive/components/tree-selector-list.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector-list.js +21 -21
- package/dist/modes/interactive/components/tree-selector-list.js.map +1 -1
- package/dist/modes/interactive/components/working-run-meter.d.ts +31 -2
- package/dist/modes/interactive/components/working-run-meter.d.ts.map +1 -1
- package/dist/modes/interactive/components/working-run-meter.js +81 -10
- package/dist/modes/interactive/components/working-run-meter.js.map +1 -1
- package/dist/modes/interactive/interactive-agent-events.js +67 -14
- package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
- package/dist/modes/interactive/interactive-autocomplete.js +2 -2
- package/dist/modes/interactive/interactive-autocomplete.js.map +1 -1
- package/dist/modes/interactive/interactive-deferred-startup.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-deferred-startup.js +10 -4
- package/dist/modes/interactive/interactive-deferred-startup.js.map +1 -1
- package/dist/modes/interactive/interactive-editor-actions.js +4 -1
- package/dist/modes/interactive/interactive-editor-actions.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-custom-ui.js +13 -3
- package/dist/modes/interactive/interactive-extension-custom-ui.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-runtime.js +4 -2
- package/dist/modes/interactive/interactive-extension-runtime.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-widgets.js +6 -8
- package/dist/modes/interactive/interactive-extension-widgets.js.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.js +43 -3
- package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.d.ts +7 -0
- package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.js +9 -2
- package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-deps.d.ts +1 -1
- package/dist/modes/interactive/interactive-mode-deps.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-deps.js +1 -1
- package/dist/modes/interactive/interactive-mode-deps.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-helpers.d.ts +5 -0
- package/dist/modes/interactive/interactive-mode-helpers.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-helpers.js +9 -0
- package/dist/modes/interactive/interactive-mode-helpers.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.d.ts +10 -2
- 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-model-routing.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-model-routing.js +63 -21
- package/dist/modes/interactive/interactive-model-routing.js.map +1 -1
- package/dist/modes/interactive/interactive-prompt-turn.js +1 -1
- package/dist/modes/interactive/interactive-prompt-turn.js.map +1 -1
- package/dist/modes/interactive/interactive-render-chat.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-render-chat.js +71 -10
- package/dist/modes/interactive/interactive-render-chat.js.map +1 -1
- package/dist/modes/interactive/interactive-resource-rendering.js +9 -18
- package/dist/modes/interactive/interactive-resource-rendering.js.map +1 -1
- package/dist/modes/interactive/interactive-selectors.js +106 -57
- package/dist/modes/interactive/interactive-selectors.js.map +1 -1
- package/dist/modes/interactive/interactive-session-routing.js +10 -5
- package/dist/modes/interactive/interactive-session-routing.js.map +1 -1
- package/dist/modes/interactive/interactive-session-runtime.d.ts +3 -0
- package/dist/modes/interactive/interactive-session-runtime.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-session-runtime.js +11 -0
- package/dist/modes/interactive/interactive-session-runtime.js.map +1 -1
- package/dist/modes/interactive/interactive-slash-commands.js +3 -0
- package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
- package/dist/modes/interactive/interactive-startup-chat-container.d.ts +5 -1
- package/dist/modes/interactive/interactive-startup-chat-container.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-startup-chat-container.js +8 -3
- package/dist/modes/interactive/interactive-startup-chat-container.js.map +1 -1
- package/dist/modes/interactive/interactive-startup-trust.d.ts +2 -0
- package/dist/modes/interactive/interactive-startup-trust.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-startup-trust.js +21 -0
- package/dist/modes/interactive/interactive-startup-trust.js.map +1 -1
- package/dist/modes/interactive/interactive-startup.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-startup.js +39 -17
- package/dist/modes/interactive/interactive-startup.js.map +1 -1
- package/dist/modes/interactive/interactive-task-projection.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-task-projection.js +11 -1
- package/dist/modes/interactive/interactive-task-projection.js.map +1 -1
- package/dist/modes/interactive/resume-catalog.d.ts.map +1 -1
- package/dist/modes/interactive/resume-catalog.js +1 -0
- package/dist/modes/interactive/resume-catalog.js.map +1 -1
- package/dist/modes/interactive/theme/theme-controller.d.ts +6 -1
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-controller.js +19 -1
- package/dist/modes/interactive/theme/theme-controller.js.map +1 -1
- package/dist/modes/interactive-engine/engine-child-liveness.d.ts +2 -0
- package/dist/modes/interactive-engine/engine-child-liveness.d.ts.map +1 -1
- package/dist/modes/interactive-engine/engine-child-liveness.js +2 -0
- package/dist/modes/interactive-engine/engine-child-liveness.js.map +1 -1
- package/dist/modes/interactive-engine/engine-custom-ui.d.ts.map +1 -1
- package/dist/modes/interactive-engine/engine-custom-ui.js +54 -4
- package/dist/modes/interactive-engine/engine-custom-ui.js.map +1 -1
- package/dist/modes/interactive-engine/engine-render-service.d.ts.map +1 -1
- package/dist/modes/interactive-engine/engine-render-service.js +21 -2
- package/dist/modes/interactive-engine/engine-render-service.js.map +1 -1
- package/dist/modes/interactive-engine/extension-ui-bridge.d.ts +4 -2
- package/dist/modes/interactive-engine/extension-ui-bridge.d.ts.map +1 -1
- package/dist/modes/interactive-engine/extension-ui-bridge.js +4 -0
- package/dist/modes/interactive-engine/extension-ui-bridge.js.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.d.ts +39 -3
- package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.js +219 -29
- package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
- package/dist/modes/interactive-engine/protocol.d.ts +33 -1
- package/dist/modes/interactive-engine/protocol.d.ts.map +1 -1
- package/dist/modes/interactive-engine/protocol.js +40 -2
- package/dist/modes/interactive-engine/protocol.js.map +1 -1
- package/dist/modes/interactive-engine/remote-command-catalog.d.ts +2 -2
- package/dist/modes/interactive-engine/remote-command-catalog.d.ts.map +1 -1
- package/dist/modes/interactive-engine/remote-command-catalog.js +7 -3
- package/dist/modes/interactive-engine/remote-command-catalog.js.map +1 -1
- package/dist/modes/interactive-engine/remote-component.d.ts.map +1 -1
- package/dist/modes/interactive-engine/remote-component.js +31 -5
- package/dist/modes/interactive-engine/remote-component.js.map +1 -1
- package/dist/modes/interactive-engine/remote-renderer.d.ts +20 -12
- package/dist/modes/interactive-engine/remote-renderer.d.ts.map +1 -1
- package/dist/modes/interactive-engine/remote-renderer.js +100 -34
- package/dist/modes/interactive-engine/remote-renderer.js.map +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +4 -1
- 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 +119 -114
- package/dist/modes/rpc/agent-panel-bridge.js.map +1 -1
- package/dist/modes/rpc/rpc-client-process.d.ts +2 -1
- package/dist/modes/rpc/rpc-client-process.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client-process.js +2 -1
- package/dist/modes/rpc/rpc-client-process.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +8 -0
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +5 -1
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-command-handler.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-command-handler.js +19 -2
- package/dist/modes/rpc/rpc-command-handler.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +4 -2
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-session-binding.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-session-binding.js +7 -0
- package/dist/modes/rpc/rpc-session-binding.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +13 -1
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/utils/interactive-engine-bootstrap.d.ts +3 -0
- package/dist/utils/interactive-engine-bootstrap.d.ts.map +1 -1
- package/dist/utils/interactive-engine-bootstrap.js +25 -0
- package/dist/utils/interactive-engine-bootstrap.js.map +1 -1
- package/dist/utils/interactive-engine-env.d.ts +3 -0
- package/dist/utils/interactive-engine-env.d.ts.map +1 -1
- package/dist/utils/interactive-engine-env.js +1 -0
- package/dist/utils/interactive-engine-env.js.map +1 -1
- package/dist/utils/shell.d.ts +2 -0
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +3 -3
- package/dist/utils/shell.js.map +1 -1
- package/docs/background-tasks.md +32 -37
- package/docs/compaction.md +2 -2
- package/docs/computer-use.md +2 -0
- package/docs/development.md +11 -1
- package/docs/environment-variables.md +2 -0
- package/docs/extensions/api-reference.md +7 -3
- package/docs/extensions/authoring.md +3 -1
- package/docs/extensions/events.md +3 -1
- package/docs/extensions/ui.md +2 -0
- package/docs/guides/resume-on-any-machine.md +3 -1
- package/docs/intercom/reference.md +1 -1
- package/docs/intercom.md +3 -3
- package/docs/keybindings.md +6 -2
- package/docs/libraries/tui.md +4 -0
- package/docs/providers.md +1 -1
- package/docs/rpc/protocol.md +6 -4
- package/docs/sdk/reference.md +10 -4
- package/docs/sdk.md +5 -2
- package/docs/security.md +5 -1
- package/docs/session-format.md +1 -1
- package/docs/sessions.md +16 -0
- package/docs/settings.md +2 -2
- package/docs/skills.md +3 -3
- package/docs/storage.md +25 -4
- package/docs/subagents.md +42 -45
- package/docs/tui.md +1 -1
- package/docs/usage.md +3 -1
- package/docs/workflows/api-reference.md +3 -1
- package/docs/workflows/authoring.md +1 -1
- package/docs/workflows/operations.md +21 -14
- package/docs/workflows.md +1 -1
- package/docs/worktree-snapshots.md +10 -8
- package/npm-shrinkwrap.json +71 -49
- package/package.json +9 -8
- package/schemas/settings.schema.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/core/workspace/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAEN,mBAAmB,EAEnB,qBAAqB,GACrB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAA2B,mBAAmB,EAA6B,qBAAqB,EAAE,CAAC;AAoH1G,MAAM,eAAe,GAAG,CAAC,CAAC;AAC1B,qFAAqF;AACrF,MAAM,mBAAmB,GAAwB,IAAI,GAAG,CAAC;IACxD,MAAM;IACN,SAAS;IACT,OAAO;IACP,OAAO;IACP,cAAc;IACd,MAAM;IACN,SAAS;IACT,MAAM;IACN,QAAQ;IACR,WAAW;CACX,CAAC,CAAC;AAkBH;;;;GAIG;AACH,MAAM,OAAO,cAAe,SAAQ,KAAK;IACtB,IAAI,CAAS;IACtB,IAAI,CAAqB;IAClC,+EAA+E;IACtE,OAAO,CAAS;IAChB,IAAI,CAAS;IACb,SAAS,CAAU;IACnB,MAAM,CAAuB;IAKtC,YAAY,IAAwB;QACnC,KAAK,CACJ,GAAG,IAAI,CAAC,OAAO,K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/**\n * The workspace error family: worktree snapshot capture, restore and drift (#4245), snapshot blob collection (#4355),\n * and workspace bindings (#3109). One base, `WorkspaceError`, one code union, `WorkspaceErrorCode`, one guard, cause\n * walk and wire form for all of them.\n *\n * Every error carries a stable `code`, JSON-safe `fields` (also set as properties of the error), a `hint`, a `summary`\n * of what failed and an explicit `retryable` flag. Messages are built from them: `<summary> (<code>). <hint>`.\n */\nimport {\n\ttype GitUnavailableCode,\n\tGitUnavailableError,\n\ttype GitUnavailableFields,\n\tisGitUnavailableError,\n} from \"../../utils/git-errors.ts\";\n\nexport { type GitUnavailableCode, GitUnavailableError, type GitUnavailableFields, isGitUnavailableError };\nexport type GitUnavailableErrorCode = GitUnavailableCode;\n\nexport type WorkspaceErrorFieldValue =\n\t| string\n\t| number\n\t| boolean\n\t| null\n\t| readonly WorkspaceErrorFieldValue[]\n\t| { readonly [key: string]: WorkspaceErrorFieldValue | undefined };\nexport type WorkspaceErrorFields = { readonly [key: string]: WorkspaceErrorFieldValue | undefined };\n\nexport type WorkspaceConfigErrorCode = \"invalid-setting\";\nexport type WorkspaceGitErrorCode = \"git-failed\";\nexport type WorkspaceSnapshotErrorCode =\n\t| \"not-a-repository\"\n\t| \"unborn-head\"\n\t| \"blob-store-unsupported\"\n\t| \"blob-store-failed\"\n\t| \"unreadable-path\"\n\t| \"pooled-worktree-lost\"\n\t| \"blobs-collected\";\nexport type WorkspaceRestoreErrorCode =\n\t| \"snapshot-not-found\"\n\t| \"blob-missing\"\n\t| \"blob-corrupt\"\n\t| \"commits-unavailable\"\n\t| \"delta-failed\"\n\t| \"tree-mismatch\"\n\t| \"unsafe-target\"\n\t| \"unwritable-path\"\n\t| \"path-too-long\"\n\t| \"invalid-snapshot\"\n\t| \"restore-failed\";\nexport type WorkspaceDriftErrorCode = \"tree-drift\";\nexport type WorkspaceCollectionErrorCode = \"collection-failed\";\nexport type WorkspaceBindingErrorCode =\n\t| \"wrong-repository\"\n\t| \"wrong-branch\"\n\t| \"conflicting-worktree-input\"\n\t| \"invalid-repository\"\n\t| \"unknown-base\"\n\t| \"cwd-outside-worktree\"\n\t| \"git-unavailable\"\n\t| \"git-failed\"\n\t| \"filesystem-failed\"\n\t| \"drift\"\n\t| \"writer-conflict\"\n\t| \"incomplete-worktree\";\nexport type WorkspacePublicationErrorCode = \"publication-failed\";\nexport type WorkspaceTimeoutErrorCode = \"timeout\";\nexport type WorkspaceSandboxErrorCode = \"write-denied\";\nexport type WorkspaceErrorCode =\n\t| WorkspaceConfigErrorCode\n\t| WorkspaceGitErrorCode\n\t| WorkspaceSnapshotErrorCode\n\t| WorkspaceRestoreErrorCode\n\t| WorkspaceDriftErrorCode\n\t| WorkspaceCollectionErrorCode\n\t| WorkspaceBindingErrorCode\n\t| WorkspacePublicationErrorCode\n\t| WorkspaceTimeoutErrorCode\n\t| WorkspaceSandboxErrorCode;\n\nexport type WorkspaceErrorName =\n\t| \"WorkspaceError\"\n\t| \"WorkspaceConfigError\"\n\t| \"WorkspaceGitError\"\n\t| \"WorkspaceSnapshotError\"\n\t| \"WorkspaceRestoreError\"\n\t| \"WorkspaceDriftError\"\n\t| \"WorkspaceCollectionError\"\n\t| \"WorkspaceBindingError\"\n\t| \"WorkspacePublicationError\"\n\t| \"WorkspaceTimeoutError\"\n\t| \"WorkspaceSandboxError\";\n\nexport type WorkspaceBindingErrorReason =\n\t| \"not-a-worktree\"\n\t| \"not-a-worktree-root\"\n\t| \"different-repository\"\n\t| \"different-branch\"\n\t| \"detached-head\"\n\t| \"not-a-repository\"\n\t| \"not-a-repository-root\"\n\t| \"history-rewritten\"\n\t| \"remote-changed\"\n\t| \"branch-diverged\"\n\t| \"interrupted-add\"\n\t| \"orphaned-directory\"\n\t| \"repair-failed\"\n\t| \"addition-in-progress\"\n\t| \"outdated\";\nexport type WorkspaceConfigErrorReason = \"missing\" | \"invalid-type\" | \"invalid-value\";\n/** Why a recorded workspace binding could not be restored (`restore-failed`). */\nexport type WorkspaceRestoreErrorReason = \"repository-missing\" | \"branch-missing\" | \"commits-unavailable\";\nexport type WorkspacePublicationErrorReason =\n\t| \"no-remote\"\n\t| \"push-failed\"\n\t| \"gh-unavailable\"\n\t| \"gh-unauthenticated\"\n\t| \"gh-failed\";\n\n/** Step that was running when a workspace operation failed or timed out: a git step, or waiting for the repository lock. */\nexport type WorkspaceGitPhase =\n\t| \"probe\"\n\t| \"clone\"\n\t| \"fetch\"\n\t| \"worktree-add\"\n\t| \"validate\"\n\t| \"snapshot\"\n\t| \"change-set\"\n\t| \"push\"\n\t| \"lease\"\n\t| \"repository-lock\";\n\nconst MAX_CAUSE_DEPTH = 8;\n/** Properties of the error itself, which a field of the same name never replaces. */\nconst RESERVED_PROPERTIES: ReadonlySet<string> = new Set([\n\t\"name\",\n\t\"message\",\n\t\"stack\",\n\t\"cause\",\n\t\"cleanupCause\",\n\t\"code\",\n\t\"summary\",\n\t\"hint\",\n\t\"fields\",\n\t\"retryable\",\n]);\n\nexport interface WorkspaceErrorInit {\n\t/** Set only for the family base, such as an error of a class this version does not know; subclasses set their own. */\n\treadonly name?: string;\n\treadonly code: WorkspaceErrorCode;\n\t/** What failed, without the code and the hint: the first part of the message. */\n\treadonly summary: string;\n\treadonly hint: string;\n\treadonly fields: WorkspaceErrorFields;\n\treadonly retryable?: boolean;\n\t/** The sub-case of `code`, when the class has them. */\n\treadonly reason?: string;\n\treadonly cause?: unknown;\n\t/** A cleanup step that failed after this error; the error itself stays the primary failure. */\n\treadonly cleanupCause?: unknown;\n}\n\n/**\n * Base of every workspace binding, worktree snapshot, restore, drift and collection failure. Branch on `code` or the\n * class, never on `message`. `fields` holds the same JSON-safe facts as the typed properties, for logs and process\n * boundaries.\n */\nexport class WorkspaceError extends Error {\n\toverride readonly name: string;\n\treadonly code: WorkspaceErrorCode;\n\t/** What failed, without the code and the hint: the first part of `message`. */\n\treadonly summary: string;\n\treadonly hint: string;\n\treadonly retryable: boolean;\n\treadonly fields: WorkspaceErrorFields;\n\tdeclare readonly reason?: string;\n\t/** A cleanup step that failed after this error; the error itself stays the primary failure. */\n\tdeclare readonly cleanupCause?: unknown;\n\n\tconstructor(init: WorkspaceErrorInit) {\n\t\tsuper(\n\t\t\t`${init.summary} (${init.code}). ${init.hint}`,\n\t\t\tinit.cause === undefined ? undefined : { cause: init.cause },\n\t\t);\n\t\tthis.name = init.name ?? \"WorkspaceError\";\n\t\tthis.code = init.code;\n\t\tthis.summary = init.summary;\n\t\tthis.hint = init.hint;\n\t\tthis.retryable = init.retryable ?? false;\n\t\tthis.fields = Object.freeze({ ...init.fields });\n\t\tfor (const [key, value] of Object.entries(init.fields))\n\t\t\tif (!RESERVED_PROPERTIES.has(key)) Object.defineProperty(this, key, { value, enumerable: true });\n\t\tif (init.reason !== undefined) Object.defineProperty(this, \"reason\", { value: init.reason, enumerable: true });\n\t\tattachCleanupCause(this, init.cleanupCause);\n\t}\n}\n\n/**\n * Keep `primary` as the failure and record a cleanup failure on it as `cleanupCause`. A primary that is not an `Error`\n * cannot carry the field and is returned unchanged; the cleanup failure is then reported only through `primary`.\n */\nexport function attachCleanupCause(primary: unknown, cleanupCause: unknown): unknown {\n\tif (cleanupCause !== undefined && primary instanceof Error)\n\t\tObject.defineProperty(primary, \"cleanupCause\", { value: cleanupCause, enumerable: true, configurable: true });\n\treturn primary;\n}\n\nexport type WorkspaceConfigSource = \"sdk\" | \"cli\" | \"env\" | \"settings\";\n\n/** A workspace option (#3109): how it is wrong, and the value received. */\nexport interface WorkspaceConfigErrorInit {\n\treadonly source: WorkspaceConfigSource;\n\treadonly field: string;\n\treadonly reason: WorkspaceConfigErrorReason;\n\treadonly expected: string;\n\treadonly received: string;\n}\n\nfunction configInit(\n\tsourceOrInit: WorkspaceConfigSource | WorkspaceConfigErrorInit,\n\tfield: string | undefined,\n\texpected: string | undefined,\n): WorkspaceErrorInit {\n\tif (typeof sourceOrInit === \"string\")\n\t\treturn {\n\t\t\tcode: \"invalid-setting\",\n\t\t\tsummary: `Invalid worktree snapshot setting: ${field} from ${sourceOrInit}`,\n\t\t\thint: `Set ${field} to ${expected}.`,\n\t\t\tfields: { source: sourceOrInit, field, expected },\n\t\t};\n\tconst init = sourceOrInit;\n\treturn {\n\t\tcode: \"invalid-setting\",\n\t\treason: init.reason,\n\t\tsummary: `Invalid workspace option: ${init.field} from ${init.source} is ${init.reason === \"missing\" ? \"missing\" : `${init.received}, expected ${init.expected}`}`,\n\t\thint: `Set ${init.field} to ${init.expected}.`,\n\t\tfields: { source: init.source, field: init.field, expected: init.expected, received: init.received },\n\t};\n}\n\n/**\n * A workspace option, a worktree snapshot setting or an SDK option has the wrong type or range. Thrown before any Git\n * or filesystem work. A workspace option also says how it is wrong (`reason`) and what it `received`.\n */\nexport class WorkspaceConfigError extends WorkspaceError {\n\toverride readonly name = \"WorkspaceConfigError\" as const;\n\tdeclare readonly code: WorkspaceConfigErrorCode;\n\tdeclare readonly reason?: WorkspaceConfigErrorReason;\n\tdeclare readonly source: WorkspaceConfigSource;\n\tdeclare readonly field: string;\n\tdeclare readonly expected: string;\n\tdeclare readonly received?: string;\n\n\t/** A workspace option. */\n\tconstructor(init: WorkspaceConfigErrorInit);\n\t/** A worktree snapshot setting or SDK option. */\n\tconstructor(source: WorkspaceConfigSource, field: string, expected: string);\n\tconstructor(sourceOrInit: WorkspaceConfigSource | WorkspaceConfigErrorInit, field?: string, expected?: string) {\n\t\tsuper(configInit(sourceOrInit, field, expected));\n\t}\n}\n\nconst GIT_INSTALL_COMMANDS: Readonly<Partial<Record<NodeJS.Platform, string>>> = {\n\tdarwin: \"xcode-select --install\",\n\twin32: \"winget install --id Git.Git -e\",\n\tlinux: \"sudo apt-get install git\",\n};\n\n/** The command that installs Git on `platform`. */\nexport function gitInstallCommand(platform: NodeJS.Platform = process.platform): string {\n\treturn GIT_INSTALL_COMMANDS[platform] ?? \"install Git from https://git-scm.com/downloads\";\n}\n\nfunction compactFields(fields: object): WorkspaceErrorFields {\n\treturn Object.fromEntries(Object.entries(fields).filter(([, value]) => value !== undefined)) as WorkspaceErrorFields;\n}\n\n/** A Git command failed. `detail` is the first line of its error output with any URL credentials removed. */\nexport class WorkspaceGitError extends WorkspaceError {\n\toverride readonly name = \"WorkspaceGitError\" as const;\n\tdeclare readonly code: WorkspaceGitErrorCode;\n\tdeclare readonly operation: string;\n\tdeclare readonly cwd: string;\n\tdeclare readonly exitCode: number | null;\n\tdeclare readonly detail: string;\n\n\tconstructor(fields: { operation: string; cwd: string; exitCode: number | null; detail: string }, cause?: Error) {\n\t\tsuper({\n\t\t\tcode: \"git-failed\",\n\t\t\tsummary: `Git ${fields.operation} failed in ${fields.cwd}${fields.detail ? `: ${fields.detail}` : \"\"}`,\n\t\t\thint: \"Check that the repository is readable, its disk has free space, and no other Git process holds its lock, then retry.\",\n\t\t\tfields,\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nconst SNAPSHOT_SUMMARIES: Record<WorkspaceSnapshotErrorCode, (subject: string) => readonly [string, string]> = {\n\t\"not-a-repository\": (subject) => [\n\t\t`Worktree snapshot unavailable: ${subject} is not inside a Git repository`,\n\t\t\"Work inside a Git checkout to record snapshots.\",\n\t],\n\t\"unborn-head\": (subject) => [\n\t\t`Worktree snapshot unavailable: ${subject} has no commits yet`,\n\t\t\"Create a first commit to record snapshots.\",\n\t],\n\t\"blob-store-unsupported\": (subject) => [\n\t\t`Worktree snapshot unavailable: ${subject} storage cannot hold snapshot blobs`,\n\t\tsubject === \"workflow journal\"\n\t\t\t? 'Select a SQLite workflow journal, for example `\"workflows\": { \"journal\": { \"path\": \"workflows/journal.sqlite\" } }` in settings.json, to record snapshots.'\n\t\t\t: 'Select a SQLite session store, for example `--session-store <path>` or `\"sessions\": { \"storage\": { \"path\": \"sessions.sqlite\" } }` in settings.json, to record snapshots.',\n\t],\n\t\"blob-store-failed\": (subject) => [\n\t\t`Worktree snapshot not recorded: the ${subject} storage could not store or read its blobs`,\n\t\t\"The turn went on without a snapshot; the cause says why the storage failed (`atomic storage status` shows the store in use). The next turn that changes files tries again.\",\n\t],\n\t\"unreadable-path\": (subject) => [\n\t\t`Worktree snapshot unavailable: ${subject} cannot be read`,\n\t\t`Make ${subject} readable by the current user (for example \\`chmod u+rwX\\` on it and its parent directories), replace a symbolic link that loops or points nowhere, or list the path in .gitignore or .atomic/snapshot-ignore, then retry.`,\n\t],\n\t\"pooled-worktree-lost\": (subject) => [\n\t\t`Worktree snapshot unavailable: this session no longer holds the pooled worktree ${subject}, which another session may be working in now`,\n\t\t\"Stop changing files there, and resume this session (`/resume`) to restore its latest snapshot into a fresh worktree.\",\n\t],\n\t\"blobs-collected\": (subject) => [\n\t\t`Worktree snapshot not recorded: snapshot collection deleted its blob ${subject} before the snapshot was recorded`,\n\t\t\"A collection with a short grace window ran while the snapshot was being recorded, so nothing was recorded rather than a snapshot that cannot be restored. Raise `snapshots.graceSeconds` (default 3600) if this repeats; the next capture tries again.\",\n\t],\n};\n\n/** A snapshot cannot be recorded for a directory or a store. Capture reports it once as the degrade reason. */\nexport class WorkspaceSnapshotError extends WorkspaceError {\n\toverride readonly name = \"WorkspaceSnapshotError\" as const;\n\tdeclare readonly code: WorkspaceSnapshotErrorCode;\n\tdeclare readonly subject: string;\n\n\tconstructor(code: WorkspaceSnapshotErrorCode, subject: string, cause?: Error) {\n\t\tconst [summary, hint] = SNAPSHOT_SUMMARIES[code](subject);\n\t\tsuper({ code, summary, hint, fields: { subject }, cause });\n\t}\n}\n\n/**\n * `error` as an `unreadable-path` snapshot error when it is a filesystem failure on `path`, so it carries a code and\n * a hint and degrades capture instead of failing the caller; any other error is returned unchanged.\n */\nexport function unreadablePathError(path: string, error: unknown): unknown {\n\tif (!(error instanceof Error) || typeof (error as NodeJS.ErrnoException).syscall !== \"string\") return error;\n\treturn new WorkspaceSnapshotError(\"unreadable-path\", path, error);\n}\n\nexport interface WorkspaceRestoreErrorFields {\n\treadonly snapshotId: string | null;\n\treadonly head?: string;\n\treadonly tree?: string;\n\treadonly blob?: string;\n\treadonly role?: \"patch\" | \"bundle\";\n\treadonly deltaIndex?: number;\n\treadonly expectedTree?: string;\n\treadonly actualTree?: string | null;\n\treadonly commits?: readonly string[];\n\treadonly paths?: readonly string[];\n\treadonly reason?:\n\t\t| \"denied-history\"\n\t\t| \"bundle-over-cap\"\n\t\t| \"not-fetched\"\n\t\t| \"not-empty\"\n\t\t| \"not-restored\"\n\t\t| InvalidSnapshotReason;\n\treadonly remotes?: readonly string[];\n\treadonly target?: string;\n\treadonly detail?: string;\n\t/** For `invalid-snapshot`: the record field that failed, such as `remotes[0]` or `chain[2].tree`. */\n\treadonly field?: string;\n\t/** For `path-too-long`: the longest path Windows and Git accept for `target`. */\n\treadonly limit?: number;\n\t/** For `path-too-long`: the directory whose depth puts `target` over `limit`, the agent directory by default. */\n\treadonly agentDir?: string;\n}\n\n/** A recorded workspace binding that could not be restored on resume (#3109): why, and its facts. */\nexport interface WorkspaceRestoreErrorInit {\n\treadonly reason: WorkspaceRestoreErrorReason;\n\treadonly fields: WorkspaceErrorFields;\n\treadonly cause?: unknown;\n\treadonly cleanupCause?: unknown;\n}\n\n/** Why a snapshot or binding record was refused before any Git or filesystem work. */\nexport type InvalidSnapshotReason = \"unsafe-remote\" | \"invalid-object-id\" | \"invalid-snapshot-id\" | \"invalid-blob-hash\";\n\nconst INVALID_SNAPSHOT_EXPECTATIONS: Record<InvalidSnapshotReason, string> = {\n\t\"unsafe-remote\": \"a remote URL Atomic can safely fetch from\",\n\t\"invalid-object-id\": \"a Git object id\",\n\t\"invalid-snapshot-id\": \"a snapshot id\",\n\t\"invalid-blob-hash\": \"a SHA-256 blob hash\",\n};\n\nfunction snapshotRestoreMessage(\n\tcode: Exclude<WorkspaceRestoreErrorCode, \"restore-failed\">,\n\tfields: WorkspaceRestoreErrorFields,\n): readonly [string, string] {\n\tconst snapshot = fields.snapshotId ?? \"binding\";\n\tswitch (code) {\n\t\tcase \"snapshot-not-found\":\n\t\t\treturn fields.tree === undefined\n\t\t\t\t? [\n\t\t\t\t\t\t`Cannot restore snapshot ${snapshot}: the session refers to it but holds no record of it`,\n\t\t\t\t\t\t\"Resume on the machine that recorded it, or import (`atomic --import <file>`) a session saved with `/export <file>.jsonl`, which carries its snapshots.\",\n\t\t\t\t\t]\n\t\t\t\t: [\n\t\t\t\t\t\t`Cannot restore workspace: no retained snapshot or warm object store has tree ${fields.tree}`,\n\t\t\t\t\t\t\"Pass the recorded snapshot, or restore on a host that already materialized this tree.\",\n\t\t\t\t\t];\n\t\tcase \"blob-missing\":\n\t\t\treturn [\n\t\t\t\t`Cannot restore snapshot ${snapshot}: ${fields.role ?? \"snapshot\"} blob ${fields.blob} is missing from storage`,\n\t\t\t\t\"Use the storage the snapshot was recorded in, or import (`atomic --import <file>`) a session saved with `/export <file>.jsonl`, which carries its blobs.\",\n\t\t\t];\n\t\tcase \"blob-corrupt\":\n\t\t\treturn [\n\t\t\t\t`Cannot restore snapshot ${snapshot}: ${fields.role ?? \"snapshot\"} blob ${fields.blob} does not match its hash`,\n\t\t\t\t\"The stored snapshot is damaged; restore an earlier snapshot or re-import the session.\",\n\t\t\t];\n\t\tcase \"commits-unavailable\": {\n\t\t\tconst remotes = fields.remotes?.length ? fields.remotes.join(\", \") : \"no recorded remote\";\n\t\t\tif (fields.reason === \"not-fetched\") {\n\t\t\t\treturn [\n\t\t\t\t\t`Cannot restore snapshot ${snapshot}: commit ${fields.head} could not be fetched from ${remotes}`,\n\t\t\t\t\tfields.remotes?.length\n\t\t\t\t\t\t? `Check access with \\`git ls-remote ${fields.remotes[0]}\\` and that ${fields.head} is pushed, then retry.`\n\t\t\t\t\t\t: `Push ${fields.head} to a remote and record it, then retry.`,\n\t\t\t\t];\n\t\t\t}\n\t\t\tconst push = `Push commit ${fields.head} (with its history) to a recorded remote`;\n\t\t\tconst deniedPaths = fields.paths?.length ? ` ${fields.paths.join(\", \")}` : \"\";\n\t\t\treturn [\n\t\t\t\t`Cannot restore snapshot ${snapshot}: commit ${fields.head} is not on ${remotes} and its unpushed history ${\n\t\t\t\t\tfields.reason === \"denied-history\"\n\t\t\t\t\t\t? `touches denied paths${deniedPaths}`\n\t\t\t\t\t\t: \"exceeded the snapshot size cap\"\n\t\t\t\t}`,\n\t\t\t\tfields.reason === \"denied-history\"\n\t\t\t\t\t? `${push}, then retry.${fields.commits?.length ? ` Commits ${fields.commits.join(\", \")} add or change denied paths${deniedPaths}, so pushing publishes those files.` : \"\"}`\n\t\t\t\t\t: `${push}, or raise snapshots.maxSnapshotBytes and record a new snapshot, then retry.`,\n\t\t\t];\n\t\t}\n\t\tcase \"delta-failed\":\n\t\t\treturn [\n\t\t\t\t`Cannot restore snapshot ${snapshot}: delta ${fields.deltaIndex} (patch ${fields.blob ?? \"none\"}) did not produce tree ${fields.expectedTree}`,\n\t\t\t\t\"The patch chain does not apply to its base; restore an earlier snapshot.\",\n\t\t\t];\n\t\tcase \"tree-mismatch\":\n\t\t\treturn [\n\t\t\t\t`Restored worktree does not match snapshot ${snapshot}: ${fields.target} has tree ${fields.actualTree}, expected ${fields.expectedTree}`,\n\t\t\t\t\"Check the repository's .gitattributes filters, then retry the restore into a new directory.\",\n\t\t\t];\n\t\tcase \"unsafe-target\":\n\t\t\treturn fields.reason === \"not-restored\"\n\t\t\t\t? [\n\t\t\t\t\t\t`Cannot remove ${fields.target}: it is not a worktree that a snapshot restore created`,\n\t\t\t\t\t\t\"Remove only paths returned by restoreWorktreeSnapshot, with the same storeDir.\",\n\t\t\t\t\t]\n\t\t\t\t: [\n\t\t\t\t\t\t`Cannot restore into ${fields.target}: it is not an empty directory`,\n\t\t\t\t\t\t\"Choose a new or empty directory, or omit `into` to restore under Atomic home.\",\n\t\t\t\t\t];\n\t\tcase \"path-too-long\":\n\t\t\treturn [\n\t\t\t\t`Cannot restore${fields.snapshotId === null ? \"\" : ` snapshot ${fields.snapshotId}`}: ${fields.target} would be ${fields.target?.length} characters, over the ${fields.limit} that Windows and Git allow for it`,\n\t\t\t\t`Atomic keeps restored worktrees under ${fields.agentDir} (${fields.agentDir?.length} characters). Set ATOMIC_CODING_AGENT_DIR to a shorter directory, such as C:\\\\atomic, or restore with a shorter storeDir, then retry.`,\n\t\t\t];\n\t\tcase \"unwritable-path\":\n\t\t\treturn [\n\t\t\t\t`Cannot write ${fields.target}${fields.snapshotId === null ? \"\" : ` while restoring snapshot ${fields.snapshotId}`}`,\n\t\t\t\t`Free space on the volume that holds ${fields.target}, or make it and its parent directory writable by the current user (for example \\`chmod u+rwX\\`), then retry.`,\n\t\t\t];\n\t\tcase \"invalid-snapshot\":\n\t\t\treturn [\n\t\t\t\t`Invalid snapshot record${fields.snapshotId === null ? \"\" : ` ${fields.snapshotId}`}: ${fields.field} is not ${INVALID_SNAPSHOT_EXPECTATIONS[fields.reason as InvalidSnapshotReason]}`,\n\t\t\t\t\"The record is malformed or was not written by Atomic. Restore only sessions and runs from storage you trust, or export the session again on the machine that recorded it.\",\n\t\t\t];\n\t}\n}\n\nfunction text(fields: WorkspaceErrorFields, key: string): string {\n\treturn String(fields[key]);\n}\n\nfunction bindingRestoreMessage(\n\treason: WorkspaceRestoreErrorReason,\n\tfields: WorkspaceErrorFields,\n): readonly [string, string] {\n\tswitch (reason) {\n\t\tcase \"repository-missing\":\n\t\t\treturn [\n\t\t\t\t`Workspace restore failed: repository ${text(fields, \"repository\")} is gone`,\n\t\t\t\t`Restore the repository at ${text(fields, \"repository\")}, or start a new run.`,\n\t\t\t];\n\t\tcase \"branch-missing\":\n\t\t\treturn [\n\t\t\t\t`Workspace restore failed: branch ${text(fields, \"branch\")} for ${text(fields, \"worktree\")} is gone`,\n\t\t\t\t`Recreate branch ${text(fields, \"branch\")} or push it to the remote, then resume.`,\n\t\t\t];\n\t\tcase \"commits-unavailable\": {\n\t\t\tconst commits = (fields.missingCommits as readonly string[]).join(\", \");\n\t\t\treturn [\n\t\t\t\t`Workspace restore failed: ${commits}, which completed steps recorded on ${text(fields, \"branch\")}, are neither in ${text(fields, \"repository\")} nor on its remote`,\n\t\t\t\t`Push ${text(fields, \"branch\")} from the machine that made those commits (git -C <its worktree> push origin ${text(fields, \"branch\")}), then resume; resuming without them would skip their work.`,\n\t\t\t];\n\t\t}\n\t}\n}\n\nfunction restoreInit(\n\tcodeOrInit: Exclude<WorkspaceRestoreErrorCode, \"restore-failed\"> | WorkspaceRestoreErrorInit,\n\tfields: WorkspaceRestoreErrorFields | undefined,\n\tcause: Error | undefined,\n): WorkspaceErrorInit {\n\tif (typeof codeOrInit === \"string\") {\n\t\tconst restored = fields as WorkspaceRestoreErrorFields;\n\t\tconst [summary, hint] = snapshotRestoreMessage(codeOrInit, restored);\n\t\treturn { code: codeOrInit, summary, hint, fields: compactFields(restored), cause };\n\t}\n\tconst [summary, hint] = bindingRestoreMessage(codeOrInit.reason, codeOrInit.fields);\n\treturn {\n\t\tcode: \"restore-failed\",\n\t\treason: codeOrInit.reason,\n\t\tsummary,\n\t\thint,\n\t\tfields: codeOrInit.fields,\n\t\tcause: codeOrInit.cause,\n\t\tcleanupCause: codeOrInit.cleanupCause,\n\t};\n}\n\n/**\n * A restore failed before returning a verified worktree: a worktree snapshot that could not be restored (nothing is\n * left at the target), or a recorded workspace binding that could not be restored on resume (`restore-failed`).\n */\nexport class WorkspaceRestoreError extends WorkspaceError {\n\toverride readonly name = \"WorkspaceRestoreError\" as const;\n\tdeclare readonly code: WorkspaceRestoreErrorCode;\n\tdeclare readonly reason?: WorkspaceRestoreErrorFields[\"reason\"] | WorkspaceRestoreErrorReason;\n\tdeclare readonly snapshotId?: string | null;\n\tdeclare readonly head?: string;\n\tdeclare readonly tree?: string;\n\tdeclare readonly blob?: string;\n\tdeclare readonly role?: \"patch\" | \"bundle\";\n\tdeclare readonly deltaIndex?: number;\n\tdeclare readonly expectedTree?: string;\n\tdeclare readonly actualTree?: string | null;\n\tdeclare readonly commits?: readonly string[];\n\tdeclare readonly paths?: readonly string[];\n\tdeclare readonly remotes?: readonly string[];\n\tdeclare readonly target?: string;\n\tdeclare readonly detail?: string;\n\tdeclare readonly field?: string;\n\tdeclare readonly limit?: number;\n\tdeclare readonly agentDir?: string;\n\n\t/** A recorded workspace binding (#3109). */\n\tconstructor(init: WorkspaceRestoreErrorInit);\n\t/** A worktree snapshot (#4245). */\n\tconstructor(\n\t\tcode: Exclude<WorkspaceRestoreErrorCode, \"restore-failed\">,\n\t\tfields: WorkspaceRestoreErrorFields,\n\t\tcause?: Error,\n\t);\n\tconstructor(\n\t\tcodeOrInit: Exclude<WorkspaceRestoreErrorCode, \"restore-failed\"> | WorkspaceRestoreErrorInit,\n\t\tfields?: WorkspaceRestoreErrorFields,\n\t\tcause?: Error,\n\t) {\n\t\tsuper(restoreInit(codeOrInit, fields, cause));\n\t}\n}\n\n/**\n * `error` as an `unwritable-path` restore error when it is a filesystem failure writing `target`, so it carries a code\n * and a hint; any other error is returned unchanged.\n */\nexport function unwritablePathError(target: string, snapshotId: string | null, error: unknown): unknown {\n\tif (!(error instanceof Error) || typeof (error as NodeJS.ErrnoException).syscall !== \"string\") return error;\n\treturn new WorkspaceRestoreError(\"unwritable-path\", { snapshotId, target }, error);\n}\n\nexport interface WorkspaceDriftErrorFields {\n\treadonly root: string;\n\treadonly expectedHead: string;\n\treadonly actualHead: string | null;\n\treadonly expectedTree: string;\n\treadonly actualTree: string | null;\n\treadonly snapshotId: string | null;\n\t/** `restore-failed` when an automatic restore was attempted and failed; the failure is the error's `cause`. */\n\treadonly reason?: \"restore-failed\";\n\t/** The `code` of the typed restore failure, when `reason` is `restore-failed`. */\n\treadonly restoreCode?: string;\n}\n\n/** The code, summary and remediation of a typed restore failure, which a drift error shows in place of its own. */\nfunction restoreFailure(cause: Error | undefined): { code: string; summary: string; hint: string } | undefined {\n\tif (isGitUnavailableError(cause))\n\t\treturn { code: cause.code, summary: `Git is unavailable (${cause.code})`, hint: cause.hint };\n\tconst typed = findWorkspaceError(cause);\n\tif (typed === undefined || typeof typed.summary !== \"string\") return undefined;\n\treturn { code: typed.code, summary: typed.summary, hint: typed.hint };\n}\n\n/**\n * A worktree no longer matches the snapshot work would resume from. Nothing ran against it. When an automatic restore\n * was attempted (`reason: \"restore-failed\"`), the message and hint carry the typed restore failure's summary and fix.\n */\nexport class WorkspaceDriftError extends WorkspaceError implements WorkspaceDriftErrorFields {\n\toverride readonly name = \"WorkspaceDriftError\" as const;\n\tdeclare readonly code: WorkspaceDriftErrorCode;\n\tdeclare readonly root: string;\n\tdeclare readonly expectedHead: string;\n\tdeclare readonly actualHead: string | null;\n\tdeclare readonly expectedTree: string;\n\tdeclare readonly actualTree: string | null;\n\tdeclare readonly snapshotId: string | null;\n\tdeclare readonly reason?: \"restore-failed\";\n\tdeclare readonly restoreCode?: string;\n\n\tconstructor(fields: WorkspaceDriftErrorFields, cause?: Error) {\n\t\tconst failure = fields.reason === \"restore-failed\" ? restoreFailure(cause) : undefined;\n\t\tsuper({\n\t\t\tcode: \"tree-drift\",\n\t\t\tsummary: `Worktree drifted from its recorded snapshot: ${fields.root} has tree ${fields.actualTree ?? \"none\"} at ${fields.actualHead ?? \"no HEAD\"}, expected ${fields.expectedTree} at ${fields.expectedHead}${\n\t\t\t\tfailure ? `, and the automatic restore failed: ${failure.summary}` : \"\"\n\t\t\t}`,\n\t\t\thint: failure?.hint ?? \"Restore the recorded snapshot into a new worktree, or undo the changes, then resume.\",\n\t\t\tfields: compactFields(failure ? { ...fields, restoreCode: failure.code } : fields),\n\t\t\tcause,\n\t\t});\n\t}\n}\n\n/**\n * The step a failed snapshot blob collection was in: taking its claim, indexing references written before the index\n * existed, deleting blobs, or recording its outcome.\n */\nexport type SnapshotCollectionPhase = \"claim\" | \"index\" | \"sweep\" | \"record\";\n\nexport interface WorkspaceCollectionErrorFields {\n\t/** The blob table being collected, such as `snapshot_blobs`. */\n\treadonly table: string;\n\treadonly phase: SnapshotCollectionPhase;\n\t/** Blobs the collection deleted before it failed. */\n\treadonly deleted: number;\n}\n\nconst COLLECTION_PHASES: Record<SnapshotCollectionPhase, string> = {\n\tclaim: \"claiming\",\n\tindex: \"indexing existing snapshot references of\",\n\tsweep: \"deleting unreferenced blobs from\",\n\trecord: \"recording its outcome for\",\n};\n\n/**\n * Collecting unreferenced snapshot blobs failed; the storage failure is the `cause`. No blob a retained snapshot\n * references was deleted, and running the collection again is safe, so it is retryable.\n */\nexport class WorkspaceCollectionError extends WorkspaceError implements WorkspaceCollectionErrorFields {\n\toverride readonly name = \"WorkspaceCollectionError\" as const;\n\tdeclare readonly code: WorkspaceCollectionErrorCode;\n\tdeclare readonly retryable: true;\n\tdeclare readonly table: string;\n\tdeclare readonly phase: SnapshotCollectionPhase;\n\tdeclare readonly deleted: number;\n\n\tconstructor(fields: WorkspaceCollectionErrorFields, cause?: Error) {\n\t\tsuper({\n\t\t\tcode: \"collection-failed\",\n\t\t\tsummary: `Snapshot blob collection failed while ${COLLECTION_PHASES[fields.phase]} ${fields.table}`,\n\t\t\thint: \"No blob a retained snapshot needs was deleted. Check that the database is writable, has free space and is not locked by a stopped process; collection retries after snapshots.collectIntervalSeconds, or call collectSnapshotGarbage to retry now.\",\n\t\t\tfields: { table: fields.table, phase: fields.phase, deleted: fields.deleted },\n\t\t\tretryable: true,\n\t\t\tcause,\n\t\t});\n\t}\n}\n\n/** Git's own last words, which name the actual problem, when the failure recorded any. */\nfunction gitOutput(fields: WorkspaceErrorFields): string {\n\tconst detail = fields.detail;\n\treturn typeof detail === \"string\" && detail !== \"\" ? `: ${detail}` : \"\";\n}\n\ninterface Described {\n\treadonly what: string;\n\treadonly subject: string;\n\treadonly hint: string;\n}\n\nconst OUT_OF_SPACE_ERRNOS: ReadonlySet<string> = new Set([\"ENOSPC\", \"EDQUOT\"]);\nconst IN_THE_WAY_ERRNOS: ReadonlySet<string> = new Set([\"EEXIST\", \"ENOTEMPTY\"]);\n\nfunction describeBinding(\n\tcode: WorkspaceBindingErrorCode,\n\treason: WorkspaceBindingErrorReason | undefined,\n\tfields: WorkspaceErrorFields,\n): Described {\n\tswitch (code) {\n\t\tcase \"wrong-repository\":\n\t\t\treturn {\n\t\t\t\twhat: \"Workspace worktree belongs to another repository\",\n\t\t\t\tsubject:\n\t\t\t\t\treason === \"not-a-worktree\"\n\t\t\t\t\t\t? `${text(fields, \"worktree\")} is not a git worktree`\n\t\t\t\t\t\t: reason === \"not-a-worktree-root\"\n\t\t\t\t\t\t\t? `${text(fields, \"worktree\")} is inside the worktree ${text(fields, \"actual\")}, not its root`\n\t\t\t\t\t\t\t: `${text(fields, \"worktree\")} uses ${text(fields, \"actual\")}, expected ${text(fields, \"expected\")}`,\n\t\t\t\thint: `Pass a worktree of ${text(fields, \"repo\")}, or use worktree: \"auto\".`,\n\t\t\t};\n\t\tcase \"wrong-branch\":\n\t\t\treturn {\n\t\t\t\twhat: \"Workspace worktree is on the wrong branch\",\n\t\t\t\tsubject: `${text(fields, \"worktree\")} is on ${text(fields, \"actual\")}, expected ${text(fields, \"expected\")}`,\n\t\t\t\thint: `Check out ${text(fields, \"expected\")} in that worktree, or pass the branch it is on.`,\n\t\t\t};\n\t\tcase \"conflicting-worktree-input\":\n\t\t\treturn {\n\t\t\t\twhat: \"Workspace conflicts with a worktree input\",\n\t\t\t\tsubject: `${text(fields, \"input\")} is set together with workspace`,\n\t\t\t\thint: `Remove ${text(fields, \"input\")}; the workspace already selects the worktree.`,\n\t\t\t};\n\t\tcase \"invalid-repository\":\n\t\t\treturn {\n\t\t\t\twhat: \"Workspace repository is not usable\",\n\t\t\t\tsubject:\n\t\t\t\t\treason === \"not-a-repository-root\"\n\t\t\t\t\t\t? `${text(fields, \"repo\")} is inside the repository ${text(fields, \"actual\")}, not its root`\n\t\t\t\t\t\t: `${text(fields, \"repo\")} is not a git repository`,\n\t\t\t\thint:\n\t\t\t\t\treason === \"not-a-repository-root\"\n\t\t\t\t\t\t? `Pass the repository root ${text(fields, \"actual\")}.`\n\t\t\t\t\t\t: \"Pass the absolute path of a git repository root, or a remote URL.\",\n\t\t\t};\n\t\tcase \"unknown-base\":\n\t\t\treturn {\n\t\t\t\twhat: \"Workspace base does not resolve\",\n\t\t\t\tsubject: `${text(fields, \"base\")} is not a commit in ${text(fields, \"repo\")}`,\n\t\t\t\thint: \"Pass a base that exists in the repository, for example origin/main.\",\n\t\t\t};\n\t\tcase \"cwd-outside-worktree\":\n\t\t\treturn {\n\t\t\t\twhat: \"Working directory escapes the workspace\",\n\t\t\t\tsubject: `${text(fields, \"cwd\")} is outside ${text(fields, \"worktree\")}`,\n\t\t\t\thint: \"Use a cwd inside the workspace worktree, or a relative path.\",\n\t\t\t};\n\t\tcase \"git-unavailable\":\n\t\t\tif (reason === \"outdated\")\n\t\t\t\treturn {\n\t\t\t\t\twhat: \"Git is too old\",\n\t\t\t\t\tsubject: `${text(fields, \"gitPath\")} is git ${text(fields, \"version\")}, and workspaces need git ${text(fields, \"minimumVersion\")} or later to lock worktrees while adding them`,\n\t\t\t\t\thint: `Install a newer git (${text(fields, \"installCommand\")}) and make sure it is first on PATH.`,\n\t\t\t\t};\n\t\t\treturn {\n\t\t\t\twhat: \"Git is unavailable\",\n\t\t\t\tsubject: `${text(fields, \"gitPath\")} could not be started, and workspaces need git to bind repositories`,\n\t\t\t\thint: `Install git (${text(fields, \"installCommand\")}) and make sure it is on PATH.`,\n\t\t\t};\n\t\tcase \"git-failed\":\n\t\t\treturn {\n\t\t\t\twhat: \"Workspace git command failed\",\n\t\t\t\tsubject: `${text(fields, \"command\")} exited with status ${text(fields, \"status\")} during ${text(fields, \"phase\")}${gitOutput(fields)}`,\n\t\t\t\thint: \"Check the repository, network access and credentials, then retry.\",\n\t\t\t};\n\t\tcase \"filesystem-failed\":\n\t\t\treturn {\n\t\t\t\twhat: \"Workspace filesystem operation failed\",\n\t\t\t\tsubject: `${text(fields, \"operation\")} ${text(fields, \"path\")} failed with ${text(fields, \"errno\")}`,\n\t\t\t\thint: OUT_OF_SPACE_ERRNOS.has(text(fields, \"errno\"))\n\t\t\t\t\t? `Free disk space on the volume that holds ${text(fields, \"path\")}, then retry.`\n\t\t\t\t\t: IN_THE_WAY_ERRNOS.has(text(fields, \"errno\"))\n\t\t\t\t\t\t? `Remove ${text(fields, \"path\")}, which is in the way, then retry.`\n\t\t\t\t\t\t: `Check that ${text(fields, \"path\")} is writable by this user, then retry.`,\n\t\t\t};\n\t\tcase \"drift\":\n\t\t\tif (reason === \"branch-diverged\")\n\t\t\t\treturn {\n\t\t\t\t\twhat: \"Workspace branch diverged from its remote\",\n\t\t\t\t\tsubject: `${text(fields, \"branch\")} in ${text(fields, \"repository\")} is at ${text(fields, \"actual\")}, and origin/${text(fields, \"branch\")} at ${text(fields, \"expected\")} has commits it lacks`,\n\t\t\t\t\thint: `Push or rebase the local commits onto origin/${text(fields, \"branch\")}, or take the remote's history with git -C ${text(fields, \"repository\")} branch --force ${text(fields, \"branch\")} origin/${text(fields, \"branch\")}, then retry.`,\n\t\t\t\t};\n\t\t\treturn {\n\t\t\t\twhat: \"Workspace changed unexpectedly\",\n\t\t\t\tsubject:\n\t\t\t\t\treason === \"remote-changed\"\n\t\t\t\t\t\t? `${text(fields, \"worktree\")} no longer has the recorded remote ${text(fields, \"expected\")}`\n\t\t\t\t\t\t: `${text(fields, \"branch\")} in ${text(fields, \"worktree\")} no longer contains the recorded commit ${text(fields, \"expected\")}`,\n\t\t\t\thint: \"Restore the recorded repository state, or start a new run instead of resuming.\",\n\t\t\t};\n\t\tcase \"incomplete-worktree\":\n\t\t\tif (reason === \"addition-in-progress\")\n\t\t\t\treturn {\n\t\t\t\t\twhat: \"Workspace worktree is still being added\",\n\t\t\t\t\tsubject:\n\t\t\t\t\t\tfields.adderPid === null\n\t\t\t\t\t\t\t? `${text(fields, \"worktree\")} may still be checking out: ${text(fields, \"adminDir\")} holds an index lock, and no record names the git adding it`\n\t\t\t\t\t\t\t: `git (pid ${text(fields, \"adderPid\")} on ${text(fields, \"adderHost\")}) is still adding ${text(fields, \"worktree\")}`,\n\t\t\t\t\thint:\n\t\t\t\t\t\tfields.adderPid === null\n\t\t\t\t\t\t\t? `Wait for that checkout to finish, then bind again. If no git is running, remove the worktree with git -C ${text(fields, \"repository\")} worktree remove --force --force ${text(fields, \"worktree\")}.`\n\t\t\t\t\t\t\t: `Wait for it to finish, or stop it with kill -TERM -${text(fields, \"adderPid\")} (Windows: taskkill /T /PID ${text(fields, \"adderPid\")}), then bind again.`,\n\t\t\t\t};\n\t\t\treturn {\n\t\t\t\twhat: \"Workspace worktree is incomplete\",\n\t\t\t\tsubject:\n\t\t\t\t\treason === \"orphaned-directory\"\n\t\t\t\t\t\t? `${text(fields, \"worktree\")} points at ${text(fields, \"adminDir\")}, which ${text(fields, \"repository\")} no longer has`\n\t\t\t\t\t\t: reason === \"repair-failed\"\n\t\t\t\t\t\t\t? `${text(fields, \"worktree\")} was left by an interrupted checkout and could not be removed`\n\t\t\t\t\t\t\t: `${text(fields, \"worktree\")} was left by an interrupted checkout (${text(fields, \"adminDir\")} is locked: ${text(fields, \"marker\")})`,\n\t\t\t\thint: `Remove it with git -C ${text(fields, \"repository\")} worktree remove --force --force ${text(fields, \"worktree\")} and git -C ${text(fields, \"repository\")} worktree prune, or delete the directory if git no longer lists it, then bind again.`,\n\t\t\t};\n\t\tcase \"writer-conflict\":\n\t\t\treturn {\n\t\t\t\twhat: \"Workspace already has a writer\",\n\t\t\t\tsubject: `${text(fields, \"worktree\")} is held by ${text(fields, \"holder\")} (pid ${text(fields, \"holderPid\")} on ${text(fields, \"holderHost\")})`,\n\t\t\t\thint: `Wait for that writer to finish, use a read-only workspace, or remove ${text(fields, \"lockFile\")} if its process is gone.`,\n\t\t\t};\n\t}\n}\n\nconst RETRYABLE_BINDING_CODES: ReadonlySet<WorkspaceBindingErrorCode> = new Set([\"writer-conflict\"]);\nconst RETRYABLE_GIT_PHASES: ReadonlySet<string> = new Set([\"clone\", \"fetch\", \"push\"]);\nconst RETRYABLE_ERRNOS: ReadonlySet<string> = new Set([...OUT_OF_SPACE_ERRNOS, \"EAGAIN\", \"EBUSY\", \"EMFILE\", \"ENFILE\"]);\n\nexport interface WorkspaceBindingErrorInit {\n\treadonly code: WorkspaceBindingErrorCode;\n\treadonly reason?: WorkspaceBindingErrorReason;\n\treadonly fields: WorkspaceErrorFields;\n\treadonly cause?: unknown;\n}\n\n/** A workspace could not be bound: wrong repository or branch, conflicting inputs, git failures or drift. */\nexport class WorkspaceBindingError extends WorkspaceError {\n\toverride readonly name = \"WorkspaceBindingError\" as const;\n\tdeclare readonly code: WorkspaceBindingErrorCode;\n\tdeclare readonly reason?: WorkspaceBindingErrorReason;\n\n\tconstructor(init: WorkspaceBindingErrorInit) {\n\t\tconst described = describeBinding(init.code, init.reason, init.fields);\n\t\tsuper({\n\t\t\tcode: init.code,\n\t\t\treason: init.reason,\n\t\t\tsummary: `${described.what}: ${described.subject}`,\n\t\t\thint: described.hint,\n\t\t\tfields: init.fields,\n\t\t\tretryable:\n\t\t\t\tRETRYABLE_BINDING_CODES.has(init.code) ||\n\t\t\t\tinit.reason === \"addition-in-progress\" ||\n\t\t\t\t(init.code === \"git-failed\" && RETRYABLE_GIT_PHASES.has(String(init.fields.phase))) ||\n\t\t\t\t(init.code === \"filesystem-failed\" && RETRYABLE_ERRNOS.has(String(init.fields.errno))),\n\t\t\tcause: init.cause,\n\t\t});\n\t}\n}\n\nexport interface WorkspacePublicationErrorInit {\n\treadonly reason: WorkspacePublicationErrorReason;\n\treadonly fields: WorkspaceErrorFields;\n\treadonly cause?: unknown;\n}\n\nconst PUBLICATION_HINTS: Readonly<Record<WorkspacePublicationErrorReason, string>> = {\n\t\"no-remote\": \"Add an origin remote to the repository before publishing.\",\n\t\"push-failed\": \"Check push access to the remote, then retry.\",\n\t\"gh-unavailable\": \"Install the GitHub CLI (https://cli.github.com) and run gh auth login.\",\n\t\"gh-unauthenticated\": \"Run gh auth login, or set GH_TOKEN, then retry.\",\n\t\"gh-failed\": \"Check gh auth status and the repository on GitHub, then retry.\",\n};\n\n/** `publishPullRequest` could not push the branch or open the pull request. */\nexport class WorkspacePublicationError extends WorkspaceError {\n\toverride readonly name = \"WorkspacePublicationError\" as const;\n\tdeclare readonly code: WorkspacePublicationErrorCode;\n\tdeclare readonly reason: WorkspacePublicationErrorReason;\n\n\tconstructor(init: WorkspacePublicationErrorInit) {\n\t\tsuper({\n\t\t\tcode: \"publication-failed\",\n\t\t\treason: init.reason,\n\t\t\tsummary: `Pull request publication failed: ${text(init.fields, \"branch\")} of ${text(init.fields, \"repo\")} (${init.reason})`,\n\t\t\thint: PUBLICATION_HINTS[init.reason],\n\t\t\tfields: init.fields,\n\t\t\tretryable: init.reason === \"push-failed\" || init.reason === \"gh-failed\",\n\t\t\tcause: init.cause,\n\t\t});\n\t}\n}\n\nexport interface WorkspaceTimeoutErrorInit {\n\treadonly phase: WorkspaceGitPhase;\n\treadonly timeoutMs: number;\n\treadonly elapsedMs: number;\n\t/** The git command that ran, or for `repository-lock` the lock file waited for. */\n\treadonly command: string;\n\t/** For `repository-lock`: the process holding the lock, when known. */\n\treadonly holderPid?: number | null;\n\treadonly cause?: unknown;\n}\n\nfunction describeTimeout(init: WorkspaceTimeoutErrorInit): Described {\n\tconst limit = `limit ${init.timeoutMs}ms`;\n\tif (init.phase === \"repository-lock\") {\n\t\tconst holder = init.holderPid == null ? \"another process\" : `process ${init.holderPid}`;\n\t\treturn {\n\t\t\twhat: \"Workspace repository lock wait timed out\",\n\t\t\tsubject: `${holder} held ${init.command} for ${init.elapsedMs}ms, ${limit}`,\n\t\t\thint: `Wait for ${holder} to finish its fetch or worktree change, or stop it if it is stuck, then retry.`,\n\t\t};\n\t}\n\treturn {\n\t\twhat: \"Workspace git command timed out\",\n\t\tsubject: `${init.command} ran ${init.elapsedMs}ms during ${init.phase}, ${limit}`,\n\t\thint:\n\t\t\tinit.phase === \"worktree-add\"\n\t\t\t\t? \"Check free disk space and the repository's checkout size, then retry; the interrupted worktree is repaired on the next bind.\"\n\t\t\t\t: \"Check network access to the remote, then retry.\",\n\t};\n}\n\n/** A git step of a workspace operation exceeded its time limit. */\nexport class WorkspaceTimeoutError extends WorkspaceError {\n\toverride readonly name = \"WorkspaceTimeoutError\" as const;\n\tdeclare readonly code: WorkspaceTimeoutErrorCode;\n\tdeclare readonly phase: WorkspaceGitPhase;\n\tdeclare readonly timeoutMs: number;\n\tdeclare readonly elapsedMs: number;\n\n\tconstructor(init: WorkspaceTimeoutErrorInit) {\n\t\tconst { what, subject, hint } = describeTimeout(init);\n\t\tsuper({\n\t\t\tcode: \"timeout\",\n\t\t\tsummary: `${what}: ${subject}`,\n\t\t\thint,\n\t\t\tfields: {\n\t\t\t\tphase: init.phase,\n\t\t\t\ttimeoutMs: init.timeoutMs,\n\t\t\t\telapsedMs: init.elapsedMs,\n\t\t\t\tcommand: init.command,\n\t\t\t\t...(init.holderPid === undefined ? {} : { holderPid: init.holderPid }),\n\t\t\t},\n\t\t\tcause: init.cause,\n\t\t\tretryable: true,\n\t\t});\n\t}\n}\n\nexport interface WorkspaceSandboxErrorInit {\n\treadonly tool: string;\n\treadonly worktree: string;\n}\n\n/** A file-writing tool was called in a read-only workspace. Reported to the model as the tool's error result. */\nexport class WorkspaceSandboxError extends WorkspaceError {\n\toverride readonly name = \"WorkspaceSandboxError\" as const;\n\tdeclare readonly code: WorkspaceSandboxErrorCode;\n\n\tconstructor(init: WorkspaceSandboxErrorInit) {\n\t\tsuper({\n\t\t\tcode: \"write-denied\",\n\t\t\tsummary: `Write denied in a read-only workspace: ${init.tool} cannot change ${init.worktree}`,\n\t\t\thint: \"This stage is a read-only reviewer; report the change instead of making it.\",\n\t\t\tfields: { tool: init.tool, worktree: init.worktree, sandbox: \"read-only\" },\n\t\t});\n\t}\n}\n\nconst CODES: Readonly<Record<WorkspaceErrorName, readonly WorkspaceErrorCode[]>> = {\n\tWorkspaceError: [],\n\tWorkspaceConfigError: [\"invalid-setting\"],\n\tWorkspaceGitError: [\"git-failed\"],\n\tWorkspaceSnapshotError: [\n\t\t\"not-a-repository\",\n\t\t\"unborn-head\",\n\t\t\"blob-store-unsupported\",\n\t\t\"blob-store-failed\",\n\t\t\"unreadable-path\",\n\t\t\"pooled-worktree-lost\",\n\t\t\"blobs-collected\",\n\t],\n\tWorkspaceRestoreError: [\n\t\t\"snapshot-not-found\",\n\t\t\"blob-missing\",\n\t\t\"blob-corrupt\",\n\t\t\"commits-unavailable\",\n\t\t\"delta-failed\",\n\t\t\"tree-mismatch\",\n\t\t\"unsafe-target\",\n\t\t\"unwritable-path\",\n\t\t\"path-too-long\",\n\t\t\"invalid-snapshot\",\n\t\t\"restore-failed\",\n\t],\n\tWorkspaceDriftError: [\"tree-drift\"],\n\tWorkspaceCollectionError: [\"collection-failed\"],\n\tWorkspaceBindingError: [\n\t\t\"wrong-repository\",\n\t\t\"wrong-branch\",\n\t\t\"conflicting-worktree-input\",\n\t\t\"invalid-repository\",\n\t\t\"unknown-base\",\n\t\t\"cwd-outside-worktree\",\n\t\t\"git-unavailable\",\n\t\t\"git-failed\",\n\t\t\"filesystem-failed\",\n\t\t\"drift\",\n\t\t\"writer-conflict\",\n\t\t\"incomplete-worktree\",\n\t],\n\tWorkspacePublicationError: [\"publication-failed\"],\n\tWorkspaceTimeoutError: [\"timeout\"],\n\tWorkspaceSandboxError: [\"write-denied\"],\n};\nconst ALL_CODES = new Set(Object.values(CODES).flat());\n\n/**\n * A data property of `value` or its prototypes. Accessors are never invoked, so guards stay side-effect free and never\n * throw on hostile or half-built values.\n */\nfunction dataProperty(value: unknown, key: string): unknown {\n\tfor (let owner: unknown = value; typeof owner === \"object\" && owner !== null; owner = Object.getPrototypeOf(owner)) {\n\t\tconst descriptor = Object.getOwnPropertyDescriptor(owner, key);\n\t\tif (descriptor !== undefined) return descriptor.value;\n\t}\n\treturn undefined;\n}\n\nfunction structurallyIs(value: unknown, name: WorkspaceErrorName): boolean {\n\tconst candidateName = dataProperty(value, \"name\");\n\tconst code = dataProperty(value, \"code\");\n\tif (typeof code !== \"string\") return false;\n\tif (name === \"WorkspaceError\")\n\t\treturn (\n\t\t\ttypeof candidateName === \"string\" &&\n\t\t\tObject.hasOwn(CODES, candidateName) &&\n\t\t\tALL_CODES.has(code as WorkspaceErrorCode)\n\t\t);\n\treturn candidateName === name && CODES[name].includes(code as WorkspaceErrorCode);\n}\n\nexport function isWorkspaceError(value: unknown): value is WorkspaceError {\n\treturn value instanceof WorkspaceError || structurallyIs(value, \"WorkspaceError\");\n}\nexport function isWorkspaceConfigError(value: unknown): value is WorkspaceConfigError {\n\treturn value instanceof WorkspaceConfigError || structurallyIs(value, \"WorkspaceConfigError\");\n}\nexport function isWorkspaceGitError(value: unknown): value is WorkspaceGitError {\n\treturn value instanceof WorkspaceGitError || structurallyIs(value, \"WorkspaceGitError\");\n}\nexport function isWorkspaceSnapshotError(value: unknown): value is WorkspaceSnapshotError {\n\treturn value instanceof WorkspaceSnapshotError || structurallyIs(value, \"WorkspaceSnapshotError\");\n}\nexport function isWorkspaceRestoreError(value: unknown): value is WorkspaceRestoreError {\n\treturn value instanceof WorkspaceRestoreError || structurallyIs(value, \"WorkspaceRestoreError\");\n}\nexport function isWorkspaceDriftError(value: unknown): value is WorkspaceDriftError {\n\treturn value instanceof WorkspaceDriftError || structurallyIs(value, \"WorkspaceDriftError\");\n}\nexport function isWorkspaceCollectionError(value: unknown): value is WorkspaceCollectionError {\n\treturn value instanceof WorkspaceCollectionError || structurallyIs(value, \"WorkspaceCollectionError\");\n}\nexport function isWorkspaceBindingError(value: unknown): value is WorkspaceBindingError {\n\treturn value instanceof WorkspaceBindingError || structurallyIs(value, \"WorkspaceBindingError\");\n}\nexport function isWorkspacePublicationError(value: unknown): value is WorkspacePublicationError {\n\treturn value instanceof WorkspacePublicationError || structurallyIs(value, \"WorkspacePublicationError\");\n}\nexport function isWorkspaceTimeoutError(value: unknown): value is WorkspaceTimeoutError {\n\treturn value instanceof WorkspaceTimeoutError || structurallyIs(value, \"WorkspaceTimeoutError\");\n}\nexport function isWorkspaceSandboxError(value: unknown): value is WorkspaceSandboxError {\n\treturn value instanceof WorkspaceSandboxError || structurallyIs(value, \"WorkspaceSandboxError\");\n}\n\n/** The first error in `value`'s cause chain (itself included, at most eight links) that `guard` accepts. */\nexport function findWorkspaceError(value: unknown): WorkspaceError | undefined;\nexport function findWorkspaceError<T>(value: unknown, guard: (candidate: unknown) => candidate is T): T | undefined;\nexport function findWorkspaceError(value: unknown, guard: (candidate: unknown) => boolean = isWorkspaceError): unknown {\n\tlet current: unknown = value;\n\tfor (let depth = 0; depth < MAX_CAUSE_DEPTH && current !== undefined && current !== null; depth++) {\n\t\tif (guard(current)) return current;\n\t\tcurrent = dataProperty(current, \"cause\");\n\t}\n\treturn undefined;\n}\n\n/** Whether `value` or a cause up to eight levels deep is a workspace error that is safe to retry. */\nexport function isRetryableWorkspaceError(value: unknown): boolean {\n\treturn (\n\t\tfindWorkspaceError(\n\t\t\tvalue,\n\t\t\t(candidate): candidate is WorkspaceError =>\n\t\t\t\tisWorkspaceError(candidate) && dataProperty(candidate, \"retryable\") === true,\n\t\t) !== undefined\n\t);\n}\n\n/** Wire form of an error and up to seven of its causes, for crossing worker and IPC boundaries. */\nexport interface SerializedWorkspaceError {\n\treadonly name: string;\n\treadonly message: string;\n\treadonly code?: string;\n\treadonly hint?: string;\n\treadonly fields?: WorkspaceErrorFields;\n\treadonly retryable?: boolean;\n\t/** The sub-case of `code`, when it is not already one of the `fields`. */\n\treadonly reason?: string;\n\treadonly cause?: SerializedWorkspaceError;\n\t/** A cleanup that also failed, recorded beside the failure rather than replacing it. */\n\treadonly cleanupCause?: SerializedWorkspaceError;\n}\n\nfunction serialize(value: unknown, depth: number): SerializedWorkspaceError | undefined {\n\tif (value === undefined || value === null || depth >= MAX_CAUSE_DEPTH) return undefined;\n\tif (typeof value !== \"object\") return { name: \"Error\", message: String(value) };\n\tconst error = value as Partial<WorkspaceError>;\n\tconst typed = isWorkspaceError(value) || isGitUnavailableError(value);\n\tconst reason = typed && typeof error.reason === \"string\" && error.fields?.reason !== error.reason;\n\tconst cause = serialize(error.cause, depth + 1);\n\tconst cleanupCause = serialize(error.cleanupCause, depth + 1);\n\treturn {\n\t\tname: typeof error.name === \"string\" ? error.name : \"Error\",\n\t\t...(typed\n\t\t\t? { code: error.code, hint: error.hint, fields: error.fields, retryable: error.retryable === true }\n\t\t\t: {}),\n\t\t...(reason ? { reason: error.reason } : {}),\n\t\tmessage: typeof error.message === \"string\" ? error.message : String(value),\n\t\t...(cause ? { cause } : {}),\n\t\t...(cleanupCause ? { cleanupCause } : {}),\n\t};\n}\n\n/**\n * A JSON form of `error` and up to seven of its causes, as deep as {@link findWorkspaceError} searches, for crossing\n * worker and IPC boundaries.\n */\nexport function serializeWorkspaceError(error: Error): SerializedWorkspaceError {\n\treturn serialize(error, 0) as SerializedWorkspaceError;\n}\n\ntype Rehydrator = (value: SerializedWorkspaceError, fields: WorkspaceErrorFields, cause?: Error) => Error;\nconst REHYDRATORS: Partial<Record<WorkspaceErrorName | \"GitUnavailableError\", Rehydrator>> = {\n\tWorkspaceConfigError: (value, fields) =>\n\t\tvalue.reason === undefined\n\t\t\t? new WorkspaceConfigError(\n\t\t\t\t\tfields.source as WorkspaceConfigSource,\n\t\t\t\t\tString(fields.field),\n\t\t\t\t\tString(fields.expected),\n\t\t\t\t)\n\t\t\t: new WorkspaceConfigError({\n\t\t\t\t\tsource: fields.source as WorkspaceConfigSource,\n\t\t\t\t\tfield: String(fields.field),\n\t\t\t\t\treason: value.reason as WorkspaceConfigErrorReason,\n\t\t\t\t\texpected: String(fields.expected),\n\t\t\t\t\treceived: String(fields.received),\n\t\t\t\t}),\n\tGitUnavailableError: (value, fields, cause) =>\n\t\tnew GitUnavailableError(\n\t\t\tcompactFields({ ...fields, code: value.code }) as unknown as GitUnavailableFields,\n\t\t\tcause ? { cause } : undefined,\n\t\t),\n\tWorkspaceGitError: (_value, fields, cause) =>\n\t\tnew WorkspaceGitError(\n\t\t\tfields as { operation: string; cwd: string; exitCode: number | null; detail: string },\n\t\t\tcause,\n\t\t),\n\tWorkspaceSnapshotError: (value, fields, cause) =>\n\t\tnew WorkspaceSnapshotError(value.code as WorkspaceSnapshotErrorCode, String(fields.subject), cause),\n\tWorkspaceRestoreError: (value, fields, cause) =>\n\t\tvalue.code === \"restore-failed\"\n\t\t\t? new WorkspaceRestoreError({ reason: value.reason as WorkspaceRestoreErrorReason, fields, cause })\n\t\t\t: new WorkspaceRestoreError(\n\t\t\t\t\tvalue.code as Exclude<WorkspaceRestoreErrorCode, \"restore-failed\">,\n\t\t\t\t\tfields as unknown as WorkspaceRestoreErrorFields,\n\t\t\t\t\tcause,\n\t\t\t\t),\n\tWorkspaceDriftError: (_value, fields, cause) =>\n\t\tnew WorkspaceDriftError(fields as unknown as WorkspaceDriftErrorFields, cause),\n\tWorkspaceCollectionError: (_value, fields, cause) =>\n\t\tnew WorkspaceCollectionError(fields as unknown as WorkspaceCollectionErrorFields, cause),\n\tWorkspaceBindingError: (value, fields, cause) =>\n\t\tnew WorkspaceBindingError({\n\t\t\tcode: value.code as WorkspaceBindingErrorCode,\n\t\t\treason: value.reason as WorkspaceBindingErrorReason | undefined,\n\t\t\tfields,\n\t\t\tcause,\n\t\t}),\n\tWorkspacePublicationError: (value, fields, cause) =>\n\t\tnew WorkspacePublicationError({ reason: value.reason as WorkspacePublicationErrorReason, fields, cause }),\n\tWorkspaceTimeoutError: (_value, fields, cause) =>\n\t\tnew WorkspaceTimeoutError({\n\t\t\tphase: fields.phase as WorkspaceGitPhase,\n\t\t\ttimeoutMs: Number(fields.timeoutMs),\n\t\t\telapsedMs: Number(fields.elapsedMs),\n\t\t\tcommand: String(fields.command),\n\t\t\tholderPid: fields.holderPid as number | null | undefined,\n\t\t\tcause,\n\t\t}),\n\tWorkspaceSandboxError: (_value, fields) =>\n\t\tnew WorkspaceSandboxError({ tool: String(fields.tool), worktree: String(fields.worktree) }),\n};\n\nfunction rebuild(value: SerializedWorkspaceError, cause: Error | undefined): Error {\n\tconst rehydrate = Object.hasOwn(REHYDRATORS, value.name)\n\t\t? REHYDRATORS[value.name as WorkspaceErrorName | \"GitUnavailableError\"]\n\t\t: undefined;\n\tconst known =\n\t\tvalue.name === \"GitUnavailableError\"\n\t\t\t? isGitUnavailableError(value)\n\t\t\t: Object.hasOwn(CODES, value.name) &&\n\t\t\t\tCODES[value.name as WorkspaceErrorName].includes(value.code as WorkspaceErrorCode);\n\tif (rehydrate && value.fields && known) return rehydrate(value, value.fields, cause);\n\tif (value.code !== undefined) {\n\t\tconst error = new WorkspaceError({\n\t\t\tcode: value.code as WorkspaceErrorCode,\n\t\t\tsummary: value.message,\n\t\t\thint: value.hint ?? \"\",\n\t\t\tfields: value.fields ?? {},\n\t\t\tretryable: value.retryable === true,\n\t\t\treason: value.reason,\n\t\t\tcause,\n\t\t});\n\t\tObject.defineProperty(error, \"name\", {\n\t\t\tvalue: value.name,\n\t\t\tenumerable: false,\n\t\t\twritable: true,\n\t\t\tconfigurable: true,\n\t\t});\n\t\t// The wire form has no summary, and a class this version does not know may shape its message differently.\n\t\tdelete (error as { summary?: string }).summary;\n\t\treturn error;\n\t}\n\tconst error = new Error(value.message, cause ? { cause } : undefined);\n\terror.name = value.name;\n\treturn error;\n}\n\n/**\n * Rebuilds an error from {@link serializeWorkspaceError}. Known names become their class with every field intact;\n * other workspace errors become a {@link WorkspaceError} keeping their name and code; anything else a plain Error.\n * The sender's message wins, so a sender on another version renders the same text.\n */\nexport function rehydrateWorkspaceError(value: SerializedWorkspaceError): Error {\n\tconst cause = value.cause ? rehydrateWorkspaceError(value.cause) : undefined;\n\tconst error = rebuild(value, cause);\n\tObject.defineProperty(error, \"message\", { value: value.message, writable: true, configurable: true });\n\treturn attachCleanupCause(\n\t\terror,\n\t\tvalue.cleanupCause ? rehydrateWorkspaceError(value.cleanupCause) : undefined,\n\t) as Error;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/core/workspace/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAEN,mBAAmB,EAEnB,qBAAqB,GACrB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAA2B,mBAAmB,EAA6B,qBAAqB,EAAE,CAAC;AAoH1G,MAAM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,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IACxB,OAAO,KAAK,CAAC;AACd,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,KAA+B;IACtE,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,uBAAuB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC7E,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACpC,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;IACtG,OAAO,kBAAkB,CACxB,KAAK,EACL,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,uBAAuB,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS,CACnE,CAAC;AACZ,CAAC","sourcesContent":["/**\n * The workspace error family: worktree snapshot capture, restore and drift (#4245), snapshot blob collection (#4355),\n * and workspace bindings (#3109). One base, `WorkspaceError`, one code union, `WorkspaceErrorCode`, one guard, cause\n * walk and wire form for all of them.\n *\n * Every error carries a stable `code`, JSON-safe `fields` (also set as properties of the error), a `hint`, a `summary`\n * of what failed and an explicit `retryable` flag. Messages are built from them: `<summary> (<code>). <hint>`.\n */\nimport {\n\ttype GitUnavailableCode,\n\tGitUnavailableError,\n\ttype GitUnavailableFields,\n\tisGitUnavailableError,\n} from \"../../utils/git-errors.ts\";\n\nexport { type GitUnavailableCode, GitUnavailableError, type GitUnavailableFields, isGitUnavailableError };\nexport type GitUnavailableErrorCode = GitUnavailableCode;\n\nexport type WorkspaceErrorFieldValue =\n\t| string\n\t| number\n\t| boolean\n\t| null\n\t| readonly WorkspaceErrorFieldValue[]\n\t| { readonly [key: string]: WorkspaceErrorFieldValue | undefined };\nexport type WorkspaceErrorFields = { readonly [key: string]: WorkspaceErrorFieldValue | undefined };\n\nexport type WorkspaceConfigErrorCode = \"invalid-setting\";\nexport type WorkspaceGitErrorCode = \"git-failed\";\nexport type WorkspaceSnapshotErrorCode =\n\t| \"not-a-repository\"\n\t| \"unborn-head\"\n\t| \"blob-store-unsupported\"\n\t| \"blob-store-failed\"\n\t| \"unreadable-path\"\n\t| \"pooled-worktree-lost\"\n\t| \"blobs-collected\";\nexport type WorkspaceRestoreErrorCode =\n\t| \"snapshot-not-found\"\n\t| \"blob-missing\"\n\t| \"blob-corrupt\"\n\t| \"commits-unavailable\"\n\t| \"delta-failed\"\n\t| \"tree-mismatch\"\n\t| \"unsafe-target\"\n\t| \"unwritable-path\"\n\t| \"path-too-long\"\n\t| \"invalid-snapshot\"\n\t| \"restore-failed\";\nexport type WorkspaceDriftErrorCode = \"tree-drift\";\nexport type WorkspaceCollectionErrorCode = \"collection-failed\";\nexport type WorkspaceBindingErrorCode =\n\t| \"wrong-repository\"\n\t| \"wrong-branch\"\n\t| \"conflicting-worktree-input\"\n\t| \"invalid-repository\"\n\t| \"unknown-base\"\n\t| \"cwd-outside-worktree\"\n\t| \"git-unavailable\"\n\t| \"git-failed\"\n\t| \"filesystem-failed\"\n\t| \"drift\"\n\t| \"writer-conflict\"\n\t| \"incomplete-worktree\";\nexport type WorkspacePublicationErrorCode = \"publication-failed\";\nexport type WorkspaceTimeoutErrorCode = \"timeout\";\nexport type WorkspaceSandboxErrorCode = \"write-denied\";\nexport type WorkspaceErrorCode =\n\t| WorkspaceConfigErrorCode\n\t| WorkspaceGitErrorCode\n\t| WorkspaceSnapshotErrorCode\n\t| WorkspaceRestoreErrorCode\n\t| WorkspaceDriftErrorCode\n\t| WorkspaceCollectionErrorCode\n\t| WorkspaceBindingErrorCode\n\t| WorkspacePublicationErrorCode\n\t| WorkspaceTimeoutErrorCode\n\t| WorkspaceSandboxErrorCode;\n\nexport type WorkspaceErrorName =\n\t| \"WorkspaceError\"\n\t| \"WorkspaceConfigError\"\n\t| \"WorkspaceGitError\"\n\t| \"WorkspaceSnapshotError\"\n\t| \"WorkspaceRestoreError\"\n\t| \"WorkspaceDriftError\"\n\t| \"WorkspaceCollectionError\"\n\t| \"WorkspaceBindingError\"\n\t| \"WorkspacePublicationError\"\n\t| \"WorkspaceTimeoutError\"\n\t| \"WorkspaceSandboxError\";\n\nexport type WorkspaceBindingErrorReason =\n\t| \"not-a-worktree\"\n\t| \"not-a-worktree-root\"\n\t| \"different-repository\"\n\t| \"different-branch\"\n\t| \"detached-head\"\n\t| \"not-a-repository\"\n\t| \"not-a-repository-root\"\n\t| \"history-rewritten\"\n\t| \"remote-changed\"\n\t| \"branch-diverged\"\n\t| \"interrupted-add\"\n\t| \"orphaned-directory\"\n\t| \"repair-failed\"\n\t| \"addition-in-progress\"\n\t| \"outdated\";\nexport type WorkspaceConfigErrorReason = \"missing\" | \"invalid-type\" | \"invalid-value\";\n/** Why a recorded workspace binding could not be restored (`restore-failed`). */\nexport type WorkspaceRestoreErrorReason = \"repository-missing\" | \"branch-missing\" | \"commits-unavailable\";\nexport type WorkspacePublicationErrorReason =\n\t| \"no-remote\"\n\t| \"push-failed\"\n\t| \"gh-unavailable\"\n\t| \"gh-unauthenticated\"\n\t| \"gh-failed\";\n\n/** Step that was running when a workspace operation failed or timed out: a git step, or waiting for the repository lock. */\nexport type WorkspaceGitPhase =\n\t| \"probe\"\n\t| \"clone\"\n\t| \"fetch\"\n\t| \"worktree-add\"\n\t| \"validate\"\n\t| \"snapshot\"\n\t| \"change-set\"\n\t| \"push\"\n\t| \"lease\"\n\t| \"repository-lock\";\n\nconst MAX_CAUSE_DEPTH = 8;\n/** Properties of the error itself, which a field of the same name never replaces. */\nconst RESERVED_PROPERTIES: ReadonlySet<string> = new Set([\n\t\"name\",\n\t\"message\",\n\t\"stack\",\n\t\"cause\",\n\t\"cleanupCause\",\n\t\"code\",\n\t\"summary\",\n\t\"hint\",\n\t\"fields\",\n\t\"retryable\",\n]);\n\nexport interface WorkspaceErrorInit {\n\t/** Set only for the family base, such as an error of a class this version does not know; subclasses set their own. */\n\treadonly name?: string;\n\treadonly code: WorkspaceErrorCode;\n\t/** What failed, without the code and the hint: the first part of the message. */\n\treadonly summary: string;\n\treadonly hint: string;\n\treadonly fields: WorkspaceErrorFields;\n\treadonly retryable?: boolean;\n\t/** The sub-case of `code`, when the class has them. */\n\treadonly reason?: string;\n\treadonly cause?: unknown;\n\t/** A cleanup step that failed after this error; the error itself stays the primary failure. */\n\treadonly cleanupCause?: unknown;\n}\n\n/**\n * Base of every workspace binding, worktree snapshot, restore, drift and collection failure. Branch on `code` or the\n * class, never on `message`. `fields` holds the same JSON-safe facts as the typed properties, for logs and process\n * boundaries.\n */\nexport class WorkspaceError extends Error {\n\toverride readonly name: string;\n\treadonly code: WorkspaceErrorCode;\n\t/** What failed, without the code and the hint: the first part of `message`. */\n\treadonly summary: string;\n\treadonly hint: string;\n\treadonly retryable: boolean;\n\treadonly fields: WorkspaceErrorFields;\n\tdeclare readonly reason?: string;\n\t/** A cleanup step that failed after this error; the error itself stays the primary failure. */\n\tdeclare readonly cleanupCause?: unknown;\n\n\tconstructor(init: WorkspaceErrorInit) {\n\t\tsuper(\n\t\t\t`${init.summary} (${init.code}). ${init.hint}`,\n\t\t\tinit.cause === undefined ? undefined : { cause: init.cause },\n\t\t);\n\t\tthis.name = init.name ?? \"WorkspaceError\";\n\t\tthis.code = init.code;\n\t\tthis.summary = init.summary;\n\t\tthis.hint = init.hint;\n\t\tthis.retryable = init.retryable ?? false;\n\t\tthis.fields = Object.freeze({ ...init.fields });\n\t\tfor (const [key, value] of Object.entries(init.fields))\n\t\t\tif (!RESERVED_PROPERTIES.has(key)) Object.defineProperty(this, key, { value, enumerable: true });\n\t\tif (init.reason !== undefined) Object.defineProperty(this, \"reason\", { value: init.reason, enumerable: true });\n\t\tattachCleanupCause(this, init.cleanupCause);\n\t}\n}\n\n/**\n * Keep `primary` as the failure and record a cleanup failure on it as `cleanupCause`. A primary that is not an `Error`\n * cannot carry the field and is returned unchanged; the cleanup failure is then reported only through `primary`.\n */\nexport function attachCleanupCause(primary: unknown, cleanupCause: unknown): unknown {\n\tif (cleanupCause !== undefined && primary instanceof Error)\n\t\tObject.defineProperty(primary, \"cleanupCause\", { value: cleanupCause, enumerable: true, configurable: true });\n\treturn primary;\n}\n\nexport type WorkspaceConfigSource = \"sdk\" | \"cli\" | \"env\" | \"settings\";\n\n/** A workspace option (#3109): how it is wrong, and the value received. */\nexport interface WorkspaceConfigErrorInit {\n\treadonly source: WorkspaceConfigSource;\n\treadonly field: string;\n\treadonly reason: WorkspaceConfigErrorReason;\n\treadonly expected: string;\n\treadonly received: string;\n}\n\nfunction configInit(\n\tsourceOrInit: WorkspaceConfigSource | WorkspaceConfigErrorInit,\n\tfield: string | undefined,\n\texpected: string | undefined,\n): WorkspaceErrorInit {\n\tif (typeof sourceOrInit === \"string\")\n\t\treturn {\n\t\t\tcode: \"invalid-setting\",\n\t\t\tsummary: `Invalid worktree snapshot setting: ${field} from ${sourceOrInit}`,\n\t\t\thint: `Set ${field} to ${expected}.`,\n\t\t\tfields: { source: sourceOrInit, field, expected },\n\t\t};\n\tconst init = sourceOrInit;\n\treturn {\n\t\tcode: \"invalid-setting\",\n\t\treason: init.reason,\n\t\tsummary: `Invalid workspace option: ${init.field} from ${init.source} is ${init.reason === \"missing\" ? \"missing\" : `${init.received}, expected ${init.expected}`}`,\n\t\thint: `Set ${init.field} to ${init.expected}.`,\n\t\tfields: { source: init.source, field: init.field, expected: init.expected, received: init.received },\n\t};\n}\n\n/**\n * A workspace option, a worktree snapshot setting or an SDK option has the wrong type or range. Thrown before any Git\n * or filesystem work. A workspace option also says how it is wrong (`reason`) and what it `received`.\n */\nexport class WorkspaceConfigError extends WorkspaceError {\n\toverride readonly name = \"WorkspaceConfigError\" as const;\n\tdeclare readonly code: WorkspaceConfigErrorCode;\n\tdeclare readonly reason?: WorkspaceConfigErrorReason;\n\tdeclare readonly source: WorkspaceConfigSource;\n\tdeclare readonly field: string;\n\tdeclare readonly expected: string;\n\tdeclare readonly received?: string;\n\n\t/** A workspace option. */\n\tconstructor(init: WorkspaceConfigErrorInit);\n\t/** A worktree snapshot setting or SDK option. */\n\tconstructor(source: WorkspaceConfigSource, field: string, expected: string);\n\tconstructor(sourceOrInit: WorkspaceConfigSource | WorkspaceConfigErrorInit, field?: string, expected?: string) {\n\t\tsuper(configInit(sourceOrInit, field, expected));\n\t}\n}\n\nconst GIT_INSTALL_COMMANDS: Readonly<Partial<Record<NodeJS.Platform, string>>> = {\n\tdarwin: \"xcode-select --install\",\n\twin32: \"winget install --id Git.Git -e\",\n\tlinux: \"sudo apt-get install git\",\n};\n\n/** The command that installs Git on `platform`. */\nexport function gitInstallCommand(platform: NodeJS.Platform = process.platform): string {\n\treturn GIT_INSTALL_COMMANDS[platform] ?? \"install Git from https://git-scm.com/downloads\";\n}\n\nfunction compactFields(fields: object): WorkspaceErrorFields {\n\treturn Object.fromEntries(Object.entries(fields).filter(([, value]) => value !== undefined)) as WorkspaceErrorFields;\n}\n\n/** A Git command failed. `detail` is the first line of its error output with any URL credentials removed. */\nexport class WorkspaceGitError extends WorkspaceError {\n\toverride readonly name = \"WorkspaceGitError\" as const;\n\tdeclare readonly code: WorkspaceGitErrorCode;\n\tdeclare readonly operation: string;\n\tdeclare readonly cwd: string;\n\tdeclare readonly exitCode: number | null;\n\tdeclare readonly detail: string;\n\n\tconstructor(fields: { operation: string; cwd: string; exitCode: number | null; detail: string }, cause?: Error) {\n\t\tsuper({\n\t\t\tcode: \"git-failed\",\n\t\t\tsummary: `Git ${fields.operation} failed in ${fields.cwd}${fields.detail ? `: ${fields.detail}` : \"\"}`,\n\t\t\thint: \"Check that the repository is readable, its disk has free space, and no other Git process holds its lock, then retry.\",\n\t\t\tfields,\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nconst SNAPSHOT_SUMMARIES: Record<WorkspaceSnapshotErrorCode, (subject: string) => readonly [string, string]> = {\n\t\"not-a-repository\": (subject) => [\n\t\t`Worktree snapshot unavailable: ${subject} is not inside a Git repository`,\n\t\t\"Work inside a Git checkout to record snapshots.\",\n\t],\n\t\"unborn-head\": (subject) => [\n\t\t`Worktree snapshot unavailable: ${subject} has no commits yet`,\n\t\t\"Create a first commit to record snapshots.\",\n\t],\n\t\"blob-store-unsupported\": (subject) => [\n\t\t`Worktree snapshot unavailable: ${subject} storage cannot hold snapshot blobs`,\n\t\tsubject === \"workflow journal\"\n\t\t\t? 'Select a SQLite workflow journal, for example `\"workflows\": { \"journal\": { \"path\": \"workflows/journal.sqlite\" } }` in settings.json, to record snapshots.'\n\t\t\t: 'Select a SQLite session store, for example `--session-store <path>` or `\"sessions\": { \"storage\": { \"path\": \"sessions.sqlite\" } }` in settings.json, to record snapshots.',\n\t],\n\t\"blob-store-failed\": (subject) => [\n\t\t`Worktree snapshot not recorded: the ${subject} storage could not store or read its blobs`,\n\t\t\"The turn went on without a snapshot; the cause says why the storage failed (`atomic storage status` shows the store in use). The next turn that changes files tries again.\",\n\t],\n\t\"unreadable-path\": (subject) => [\n\t\t`Worktree snapshot unavailable: ${subject} cannot be read`,\n\t\t`Make ${subject} readable by the current user (for example \\`chmod u+rwX\\` on it and its parent directories), replace a symbolic link that loops or points nowhere, or list the path in .gitignore or .atomic/snapshot-ignore, then retry.`,\n\t],\n\t\"pooled-worktree-lost\": (subject) => [\n\t\t`Worktree snapshot unavailable: this session no longer holds the pooled worktree ${subject}, which another session may be working in now`,\n\t\t\"Stop changing files there, and resume this session (`/resume`) to restore its latest snapshot into a fresh worktree.\",\n\t],\n\t\"blobs-collected\": (subject) => [\n\t\t`Worktree snapshot not recorded: snapshot collection deleted its blob ${subject} before the snapshot was recorded`,\n\t\t\"A collection with a short grace window ran while the snapshot was being recorded, so nothing was recorded rather than a snapshot that cannot be restored. Raise `snapshots.graceSeconds` (default 3600) if this repeats; the next capture tries again.\",\n\t],\n};\n\n/** A snapshot cannot be recorded for a directory or a store. Capture reports it once as the degrade reason. */\nexport class WorkspaceSnapshotError extends WorkspaceError {\n\toverride readonly name = \"WorkspaceSnapshotError\" as const;\n\tdeclare readonly code: WorkspaceSnapshotErrorCode;\n\tdeclare readonly subject: string;\n\n\tconstructor(code: WorkspaceSnapshotErrorCode, subject: string, cause?: Error) {\n\t\tconst [summary, hint] = SNAPSHOT_SUMMARIES[code](subject);\n\t\tsuper({ code, summary, hint, fields: { subject }, cause });\n\t}\n}\n\n/**\n * `error` as an `unreadable-path` snapshot error when it is a filesystem failure on `path`, so it carries a code and\n * a hint and degrades capture instead of failing the caller; any other error is returned unchanged.\n */\nexport function unreadablePathError(path: string, error: unknown): unknown {\n\tif (!(error instanceof Error) || typeof (error as NodeJS.ErrnoException).syscall !== \"string\") return error;\n\treturn new WorkspaceSnapshotError(\"unreadable-path\", path, error);\n}\n\nexport interface WorkspaceRestoreErrorFields {\n\treadonly snapshotId: string | null;\n\treadonly head?: string;\n\treadonly tree?: string;\n\treadonly blob?: string;\n\treadonly role?: \"patch\" | \"bundle\";\n\treadonly deltaIndex?: number;\n\treadonly expectedTree?: string;\n\treadonly actualTree?: string | null;\n\treadonly commits?: readonly string[];\n\treadonly paths?: readonly string[];\n\treadonly reason?:\n\t\t| \"denied-history\"\n\t\t| \"bundle-over-cap\"\n\t\t| \"not-fetched\"\n\t\t| \"not-empty\"\n\t\t| \"not-restored\"\n\t\t| InvalidSnapshotReason;\n\treadonly remotes?: readonly string[];\n\treadonly target?: string;\n\treadonly detail?: string;\n\t/** For `invalid-snapshot`: the record field that failed, such as `remotes[0]` or `chain[2].tree`. */\n\treadonly field?: string;\n\t/** For `path-too-long`: the longest path Windows and Git accept for `target`. */\n\treadonly limit?: number;\n\t/** For `path-too-long`: the directory whose depth puts `target` over `limit`, the agent directory by default. */\n\treadonly agentDir?: string;\n}\n\n/** A recorded workspace binding that could not be restored on resume (#3109): why, and its facts. */\nexport interface WorkspaceRestoreErrorInit {\n\treadonly reason: WorkspaceRestoreErrorReason;\n\treadonly fields: WorkspaceErrorFields;\n\treadonly cause?: unknown;\n\treadonly cleanupCause?: unknown;\n}\n\n/** Why a snapshot or binding record was refused before any Git or filesystem work. */\nexport type InvalidSnapshotReason = \"unsafe-remote\" | \"invalid-object-id\" | \"invalid-snapshot-id\" | \"invalid-blob-hash\";\n\nconst INVALID_SNAPSHOT_EXPECTATIONS: Record<InvalidSnapshotReason, string> = {\n\t\"unsafe-remote\": \"a remote URL Atomic can safely fetch from\",\n\t\"invalid-object-id\": \"a Git object id\",\n\t\"invalid-snapshot-id\": \"a snapshot id\",\n\t\"invalid-blob-hash\": \"a SHA-256 blob hash\",\n};\n\nfunction snapshotRestoreMessage(\n\tcode: Exclude<WorkspaceRestoreErrorCode, \"restore-failed\">,\n\tfields: WorkspaceRestoreErrorFields,\n): readonly [string, string] {\n\tconst snapshot = fields.snapshotId ?? \"binding\";\n\tswitch (code) {\n\t\tcase \"snapshot-not-found\":\n\t\t\treturn fields.tree === undefined\n\t\t\t\t? [\n\t\t\t\t\t\t`Cannot restore snapshot ${snapshot}: the session refers to it but holds no record of it`,\n\t\t\t\t\t\t\"Resume on the machine that recorded it, or import (`atomic --import <file>`) a session saved with `/export <file>.jsonl`, which carries its snapshots.\",\n\t\t\t\t\t]\n\t\t\t\t: [\n\t\t\t\t\t\t`Cannot restore workspace: no retained snapshot or warm object store has tree ${fields.tree}`,\n\t\t\t\t\t\t\"Pass the recorded snapshot, or restore on a host that already materialized this tree.\",\n\t\t\t\t\t];\n\t\tcase \"blob-missing\":\n\t\t\treturn [\n\t\t\t\t`Cannot restore snapshot ${snapshot}: ${fields.role ?? \"snapshot\"} blob ${fields.blob} is missing from storage`,\n\t\t\t\t\"Use the storage the snapshot was recorded in, or import (`atomic --import <file>`) a session saved with `/export <file>.jsonl`, which carries its blobs.\",\n\t\t\t];\n\t\tcase \"blob-corrupt\":\n\t\t\treturn [\n\t\t\t\t`Cannot restore snapshot ${snapshot}: ${fields.role ?? \"snapshot\"} blob ${fields.blob} does not match its hash`,\n\t\t\t\t\"The stored snapshot is damaged; restore an earlier snapshot or re-import the session.\",\n\t\t\t];\n\t\tcase \"commits-unavailable\": {\n\t\t\tconst remotes = fields.remotes?.length ? fields.remotes.join(\", \") : \"no recorded remote\";\n\t\t\tif (fields.reason === \"not-fetched\") {\n\t\t\t\treturn [\n\t\t\t\t\t`Cannot restore snapshot ${snapshot}: commit ${fields.head} could not be fetched from ${remotes}`,\n\t\t\t\t\tfields.remotes?.length\n\t\t\t\t\t\t? `Check access with \\`git ls-remote ${fields.remotes[0]}\\` and that ${fields.head} is pushed, then retry.`\n\t\t\t\t\t\t: `Push ${fields.head} to a remote and record it, then retry.`,\n\t\t\t\t];\n\t\t\t}\n\t\t\tconst push = `Push commit ${fields.head} (with its history) to a recorded remote`;\n\t\t\tconst deniedPaths = fields.paths?.length ? ` ${fields.paths.join(\", \")}` : \"\";\n\t\t\treturn [\n\t\t\t\t`Cannot restore snapshot ${snapshot}: commit ${fields.head} is not on ${remotes} and its unpushed history ${\n\t\t\t\t\tfields.reason === \"denied-history\"\n\t\t\t\t\t\t? `touches denied paths${deniedPaths}`\n\t\t\t\t\t\t: \"exceeded the snapshot size cap\"\n\t\t\t\t}`,\n\t\t\t\tfields.reason === \"denied-history\"\n\t\t\t\t\t? `${push}, then retry.${fields.commits?.length ? ` Commits ${fields.commits.join(\", \")} add or change denied paths${deniedPaths}, so pushing publishes those files.` : \"\"}`\n\t\t\t\t\t: `${push}, or raise snapshots.maxSnapshotBytes and record a new snapshot, then retry.`,\n\t\t\t];\n\t\t}\n\t\tcase \"delta-failed\":\n\t\t\treturn [\n\t\t\t\t`Cannot restore snapshot ${snapshot}: delta ${fields.deltaIndex} (patch ${fields.blob ?? \"none\"}) did not produce tree ${fields.expectedTree}`,\n\t\t\t\t\"The patch chain does not apply to its base; restore an earlier snapshot.\",\n\t\t\t];\n\t\tcase \"tree-mismatch\":\n\t\t\treturn [\n\t\t\t\t`Restored worktree does not match snapshot ${snapshot}: ${fields.target} has tree ${fields.actualTree}, expected ${fields.expectedTree}`,\n\t\t\t\t\"Check the repository's .gitattributes filters, then retry the restore into a new directory.\",\n\t\t\t];\n\t\tcase \"unsafe-target\":\n\t\t\treturn fields.reason === \"not-restored\"\n\t\t\t\t? [\n\t\t\t\t\t\t`Cannot remove ${fields.target}: it is not a worktree that a snapshot restore created`,\n\t\t\t\t\t\t\"Remove only paths returned by restoreWorktreeSnapshot, with the same storeDir.\",\n\t\t\t\t\t]\n\t\t\t\t: [\n\t\t\t\t\t\t`Cannot restore into ${fields.target}: it is not an empty directory`,\n\t\t\t\t\t\t\"Choose a new or empty directory, or omit `into` to restore under Atomic home.\",\n\t\t\t\t\t];\n\t\tcase \"path-too-long\":\n\t\t\treturn [\n\t\t\t\t`Cannot restore${fields.snapshotId === null ? \"\" : ` snapshot ${fields.snapshotId}`}: ${fields.target} would be ${fields.target?.length} characters, over the ${fields.limit} that Windows and Git allow for it`,\n\t\t\t\t`Atomic keeps restored worktrees under ${fields.agentDir} (${fields.agentDir?.length} characters). Set ATOMIC_CODING_AGENT_DIR to a shorter directory, such as C:\\\\atomic, or restore with a shorter storeDir, then retry.`,\n\t\t\t];\n\t\tcase \"unwritable-path\":\n\t\t\treturn [\n\t\t\t\t`Cannot write ${fields.target}${fields.snapshotId === null ? \"\" : ` while restoring snapshot ${fields.snapshotId}`}`,\n\t\t\t\t`Free space on the volume that holds ${fields.target}, or make it and its parent directory writable by the current user (for example \\`chmod u+rwX\\`), then retry.`,\n\t\t\t];\n\t\tcase \"invalid-snapshot\":\n\t\t\treturn [\n\t\t\t\t`Invalid snapshot record${fields.snapshotId === null ? \"\" : ` ${fields.snapshotId}`}: ${fields.field} is not ${INVALID_SNAPSHOT_EXPECTATIONS[fields.reason as InvalidSnapshotReason]}`,\n\t\t\t\t\"The record is malformed or was not written by Atomic. Restore only sessions and runs from storage you trust, or export the session again on the machine that recorded it.\",\n\t\t\t];\n\t}\n}\n\nfunction text(fields: WorkspaceErrorFields, key: string): string {\n\treturn String(fields[key]);\n}\n\nfunction bindingRestoreMessage(\n\treason: WorkspaceRestoreErrorReason,\n\tfields: WorkspaceErrorFields,\n): readonly [string, string] {\n\tswitch (reason) {\n\t\tcase \"repository-missing\":\n\t\t\treturn [\n\t\t\t\t`Workspace restore failed: repository ${text(fields, \"repository\")} is gone`,\n\t\t\t\t`Restore the repository at ${text(fields, \"repository\")}, or start a new run.`,\n\t\t\t];\n\t\tcase \"branch-missing\":\n\t\t\treturn [\n\t\t\t\t`Workspace restore failed: branch ${text(fields, \"branch\")} for ${text(fields, \"worktree\")} is gone`,\n\t\t\t\t`Recreate branch ${text(fields, \"branch\")} or push it to the remote, then resume.`,\n\t\t\t];\n\t\tcase \"commits-unavailable\": {\n\t\t\tconst commits = (fields.missingCommits as readonly string[]).join(\", \");\n\t\t\treturn [\n\t\t\t\t`Workspace restore failed: ${commits}, which completed steps recorded on ${text(fields, \"branch\")}, are neither in ${text(fields, \"repository\")} nor on its remote`,\n\t\t\t\t`Push ${text(fields, \"branch\")} from the machine that made those commits (git -C <its worktree> push origin ${text(fields, \"branch\")}), then resume; resuming without them would skip their work.`,\n\t\t\t];\n\t\t}\n\t}\n}\n\nfunction restoreInit(\n\tcodeOrInit: Exclude<WorkspaceRestoreErrorCode, \"restore-failed\"> | WorkspaceRestoreErrorInit,\n\tfields: WorkspaceRestoreErrorFields | undefined,\n\tcause: Error | undefined,\n): WorkspaceErrorInit {\n\tif (typeof codeOrInit === \"string\") {\n\t\tconst restored = fields as WorkspaceRestoreErrorFields;\n\t\tconst [summary, hint] = snapshotRestoreMessage(codeOrInit, restored);\n\t\treturn { code: codeOrInit, summary, hint, fields: compactFields(restored), cause };\n\t}\n\tconst [summary, hint] = bindingRestoreMessage(codeOrInit.reason, codeOrInit.fields);\n\treturn {\n\t\tcode: \"restore-failed\",\n\t\treason: codeOrInit.reason,\n\t\tsummary,\n\t\thint,\n\t\tfields: codeOrInit.fields,\n\t\tcause: codeOrInit.cause,\n\t\tcleanupCause: codeOrInit.cleanupCause,\n\t};\n}\n\n/**\n * A restore failed before returning a verified worktree: a worktree snapshot that could not be restored (nothing is\n * left at the target), or a recorded workspace binding that could not be restored on resume (`restore-failed`).\n */\nexport class WorkspaceRestoreError extends WorkspaceError {\n\toverride readonly name = \"WorkspaceRestoreError\" as const;\n\tdeclare readonly code: WorkspaceRestoreErrorCode;\n\tdeclare readonly reason?: WorkspaceRestoreErrorFields[\"reason\"] | WorkspaceRestoreErrorReason;\n\tdeclare readonly snapshotId?: string | null;\n\tdeclare readonly head?: string;\n\tdeclare readonly tree?: string;\n\tdeclare readonly blob?: string;\n\tdeclare readonly role?: \"patch\" | \"bundle\";\n\tdeclare readonly deltaIndex?: number;\n\tdeclare readonly expectedTree?: string;\n\tdeclare readonly actualTree?: string | null;\n\tdeclare readonly commits?: readonly string[];\n\tdeclare readonly paths?: readonly string[];\n\tdeclare readonly remotes?: readonly string[];\n\tdeclare readonly target?: string;\n\tdeclare readonly detail?: string;\n\tdeclare readonly field?: string;\n\tdeclare readonly limit?: number;\n\tdeclare readonly agentDir?: string;\n\n\t/** A recorded workspace binding (#3109). */\n\tconstructor(init: WorkspaceRestoreErrorInit);\n\t/** A worktree snapshot (#4245). */\n\tconstructor(\n\t\tcode: Exclude<WorkspaceRestoreErrorCode, \"restore-failed\">,\n\t\tfields: WorkspaceRestoreErrorFields,\n\t\tcause?: Error,\n\t);\n\tconstructor(\n\t\tcodeOrInit: Exclude<WorkspaceRestoreErrorCode, \"restore-failed\"> | WorkspaceRestoreErrorInit,\n\t\tfields?: WorkspaceRestoreErrorFields,\n\t\tcause?: Error,\n\t) {\n\t\tsuper(restoreInit(codeOrInit, fields, cause));\n\t}\n}\n\n/**\n * `error` as an `unwritable-path` restore error when it is a filesystem failure writing `target`, so it carries a code\n * and a hint; any other error is returned unchanged.\n */\nexport function unwritablePathError(target: string, snapshotId: string | null, error: unknown): unknown {\n\tif (!(error instanceof Error) || typeof (error as NodeJS.ErrnoException).syscall !== \"string\") return error;\n\treturn new WorkspaceRestoreError(\"unwritable-path\", { snapshotId, target }, error);\n}\n\nexport interface WorkspaceDriftErrorFields {\n\treadonly root: string;\n\treadonly expectedHead: string;\n\treadonly actualHead: string | null;\n\treadonly expectedTree: string;\n\treadonly actualTree: string | null;\n\treadonly snapshotId: string | null;\n\t/** `restore-failed` when an automatic restore was attempted and failed; the failure is the error's `cause`. */\n\treadonly reason?: \"restore-failed\";\n\t/** The `code` of the typed restore failure, when `reason` is `restore-failed`. */\n\treadonly restoreCode?: string;\n}\n\n/** The code, summary and remediation of a typed restore failure, which a drift error shows in place of its own. */\nfunction restoreFailure(cause: Error | undefined): { code: string; summary: string; hint: string } | undefined {\n\tif (isGitUnavailableError(cause))\n\t\treturn { code: cause.code, summary: `Git is unavailable (${cause.code})`, hint: cause.hint };\n\tconst typed = findWorkspaceError(cause);\n\tif (typed === undefined || typeof typed.summary !== \"string\") return undefined;\n\treturn { code: typed.code, summary: typed.summary, hint: typed.hint };\n}\n\n/**\n * A worktree no longer matches the snapshot work would resume from. Nothing ran against it. When an automatic restore\n * was attempted (`reason: \"restore-failed\"`), the message and hint carry the typed restore failure's summary and fix.\n */\nexport class WorkspaceDriftError extends WorkspaceError implements WorkspaceDriftErrorFields {\n\toverride readonly name = \"WorkspaceDriftError\" as const;\n\tdeclare readonly code: WorkspaceDriftErrorCode;\n\tdeclare readonly root: string;\n\tdeclare readonly expectedHead: string;\n\tdeclare readonly actualHead: string | null;\n\tdeclare readonly expectedTree: string;\n\tdeclare readonly actualTree: string | null;\n\tdeclare readonly snapshotId: string | null;\n\tdeclare readonly reason?: \"restore-failed\";\n\tdeclare readonly restoreCode?: string;\n\n\tconstructor(fields: WorkspaceDriftErrorFields, cause?: Error) {\n\t\tconst failure = fields.reason === \"restore-failed\" ? restoreFailure(cause) : undefined;\n\t\tsuper({\n\t\t\tcode: \"tree-drift\",\n\t\t\tsummary: `Worktree drifted from its recorded snapshot: ${fields.root} has tree ${fields.actualTree ?? \"none\"} at ${fields.actualHead ?? \"no HEAD\"}, expected ${fields.expectedTree} at ${fields.expectedHead}${\n\t\t\t\tfailure ? `, and the automatic restore failed: ${failure.summary}` : \"\"\n\t\t\t}`,\n\t\t\thint: failure?.hint ?? \"Restore the recorded snapshot into a new worktree, or undo the changes, then resume.\",\n\t\t\tfields: compactFields(failure ? { ...fields, restoreCode: failure.code } : fields),\n\t\t\tcause,\n\t\t});\n\t}\n}\n\n/**\n * The step a failed snapshot blob collection was in: taking its claim, indexing references written before the index\n * existed, deleting blobs, or recording its outcome.\n */\nexport type SnapshotCollectionPhase = \"claim\" | \"index\" | \"sweep\" | \"record\";\n\nexport interface WorkspaceCollectionErrorFields {\n\t/** The blob table being collected, such as `snapshot_blobs`. */\n\treadonly table: string;\n\treadonly phase: SnapshotCollectionPhase;\n\t/** Blobs the collection deleted before it failed. */\n\treadonly deleted: number;\n}\n\nconst COLLECTION_PHASES: Record<SnapshotCollectionPhase, string> = {\n\tclaim: \"claiming\",\n\tindex: \"indexing existing snapshot references of\",\n\tsweep: \"deleting unreferenced blobs from\",\n\trecord: \"recording its outcome for\",\n};\n\nconst COLLECTION_RETRY =\n\t\"collection retries after snapshots.collectIntervalSeconds, or call collectSnapshotGarbage to retry now.\";\n\n/** The non-empty messages of `cause` and of the errors it wraps, outermost first: at most eight. */\nfunction causeMessages(cause: unknown): string[] {\n\tconst messages: string[] = [];\n\tlet current = cause;\n\tfor (let depth = 0; depth < MAX_CAUSE_DEPTH && typeof current === \"object\" && current !== null; depth++) {\n\t\tconst message = dataProperty(current, \"message\");\n\t\tif (typeof message === \"string\" && message.trim() !== \"\") messages.push(message.trim());\n\t\tcurrent = dataProperty(current, \"cause\");\n\t}\n\treturn messages;\n}\n\n/**\n * The key under which a failed rename's storage error carries the trigger or view that stopped it, once the snapshot\n * store confirmed in the database which object SQLite named (#5622). A `Symbol.for` key, so the store sets it without\n * importing this module.\n */\nconst RENAME_BLOCKER = Symbol.for(\"atomic-snapshots/rename-blocker@1\");\n\n/** The trigger or view that `cause` or an error it wraps, at most eight deep, carries under {@link RENAME_BLOCKER}. */\nfunction renameBlockerOf(cause: unknown): { readonly type: \"trigger\" | \"view\"; readonly name: string } | undefined {\n\tlet current = cause;\n\tfor (let depth = 0; depth < MAX_CAUSE_DEPTH && typeof current === \"object\" && current !== null; depth++) {\n\t\tconst blocker = dataProperty(current, RENAME_BLOCKER);\n\t\tconst type = dataProperty(blocker, \"type\");\n\t\tconst name = dataProperty(blocker, \"name\");\n\t\tif ((type === \"trigger\" || type === \"view\") && typeof name === \"string\") return { type, name };\n\t\tcurrent = dataProperty(current, \"cause\");\n\t}\n\treturn undefined;\n}\n\n/**\n * Collecting unreferenced snapshot blobs failed; the storage failure is the `cause`, and the summary ends with its\n * innermost reason, the database's own words. No blob a retained snapshot references was deleted, and running the\n * collection again is safe, so it is retryable. When a trigger or view stops the move of the chunk table to the row\n * layout at its rename (#5541), and the store confirmed which one it is, the hint names it and says to fix or drop it\n * (#5622). SQLite's own words never name one alone: they do not quote the name, so they can mean another object.\n */\nexport class WorkspaceCollectionError extends WorkspaceError implements WorkspaceCollectionErrorFields {\n\toverride readonly name = \"WorkspaceCollectionError\" as const;\n\tdeclare readonly code: WorkspaceCollectionErrorCode;\n\tdeclare readonly retryable: true;\n\tdeclare readonly table: string;\n\tdeclare readonly phase: SnapshotCollectionPhase;\n\tdeclare readonly deleted: number;\n\n\tconstructor(fields: WorkspaceCollectionErrorFields, cause?: Error) {\n\t\tconst messages = causeMessages(cause);\n\t\tconst reason = messages.at(-1);\n\t\t// The sweep is the only phase that renames a table: the chunk table's move ends it.\n\t\tconst blocker = fields.phase === \"sweep\" ? renameBlockerOf(cause) : undefined;\n\t\tsuper({\n\t\t\tcode: \"collection-failed\",\n\t\t\tsummary: `Snapshot blob collection failed while ${COLLECTION_PHASES[fields.phase]} ${fields.table}${reason === undefined ? \"\" : `: ${reason}`}`,\n\t\t\thint: blocker\n\t\t\t\t? `A trigger or view that refers to a missing table blocks moving the snapshot chunk table to its new layout until it is fixed or dropped: SQLite renames no table while one exists. Fix the ${blocker.type} ${blocker.name}, or drop it with DROP ${blocker.type.toUpperCase()} \"${blocker.name.replaceAll('\"', '\"\"')}\", and the next collection finishes the move. No blob a retained snapshot needs was deleted, and snapshots keep working meanwhile; ${COLLECTION_RETRY}`\n\t\t\t\t: `No blob a retained snapshot needs was deleted. Check that the database is writable, has free space and is not locked by a stopped process; ${COLLECTION_RETRY}`,\n\t\t\tfields: { table: fields.table, phase: fields.phase, deleted: fields.deleted },\n\t\t\tretryable: true,\n\t\t\tcause,\n\t\t});\n\t}\n}\n\n/** Git's own last words, which name the actual problem, when the failure recorded any. */\nfunction gitOutput(fields: WorkspaceErrorFields): string {\n\tconst detail = fields.detail;\n\treturn typeof detail === \"string\" && detail !== \"\" ? `: ${detail}` : \"\";\n}\n\ninterface Described {\n\treadonly what: string;\n\treadonly subject: string;\n\treadonly hint: string;\n}\n\nconst OUT_OF_SPACE_ERRNOS: ReadonlySet<string> = new Set([\"ENOSPC\", \"EDQUOT\"]);\nconst IN_THE_WAY_ERRNOS: ReadonlySet<string> = new Set([\"EEXIST\", \"ENOTEMPTY\"]);\n\nfunction describeBinding(\n\tcode: WorkspaceBindingErrorCode,\n\treason: WorkspaceBindingErrorReason | undefined,\n\tfields: WorkspaceErrorFields,\n): Described {\n\tswitch (code) {\n\t\tcase \"wrong-repository\":\n\t\t\treturn {\n\t\t\t\twhat: \"Workspace worktree belongs to another repository\",\n\t\t\t\tsubject:\n\t\t\t\t\treason === \"not-a-worktree\"\n\t\t\t\t\t\t? `${text(fields, \"worktree\")} is not a git worktree`\n\t\t\t\t\t\t: reason === \"not-a-worktree-root\"\n\t\t\t\t\t\t\t? `${text(fields, \"worktree\")} is inside the worktree ${text(fields, \"actual\")}, not its root`\n\t\t\t\t\t\t\t: `${text(fields, \"worktree\")} uses ${text(fields, \"actual\")}, expected ${text(fields, \"expected\")}`,\n\t\t\t\thint: `Pass a worktree of ${text(fields, \"repo\")}, or use worktree: \"auto\".`,\n\t\t\t};\n\t\tcase \"wrong-branch\":\n\t\t\treturn {\n\t\t\t\twhat: \"Workspace worktree is on the wrong branch\",\n\t\t\t\tsubject: `${text(fields, \"worktree\")} is on ${text(fields, \"actual\")}, expected ${text(fields, \"expected\")}`,\n\t\t\t\thint: `Check out ${text(fields, \"expected\")} in that worktree, or pass the branch it is on.`,\n\t\t\t};\n\t\tcase \"conflicting-worktree-input\":\n\t\t\treturn {\n\t\t\t\twhat: \"Workspace conflicts with a worktree input\",\n\t\t\t\tsubject: `${text(fields, \"input\")} is set together with workspace`,\n\t\t\t\thint: `Remove ${text(fields, \"input\")}; the workspace already selects the worktree.`,\n\t\t\t};\n\t\tcase \"invalid-repository\":\n\t\t\treturn {\n\t\t\t\twhat: \"Workspace repository is not usable\",\n\t\t\t\tsubject:\n\t\t\t\t\treason === \"not-a-repository-root\"\n\t\t\t\t\t\t? `${text(fields, \"repo\")} is inside the repository ${text(fields, \"actual\")}, not its root`\n\t\t\t\t\t\t: `${text(fields, \"repo\")} is not a git repository`,\n\t\t\t\thint:\n\t\t\t\t\treason === \"not-a-repository-root\"\n\t\t\t\t\t\t? `Pass the repository root ${text(fields, \"actual\")}.`\n\t\t\t\t\t\t: \"Pass the absolute path of a git repository root, or a remote URL.\",\n\t\t\t};\n\t\tcase \"unknown-base\":\n\t\t\treturn {\n\t\t\t\twhat: \"Workspace base does not resolve\",\n\t\t\t\tsubject: `${text(fields, \"base\")} is not a commit in ${text(fields, \"repo\")}`,\n\t\t\t\thint: \"Pass a base that exists in the repository, for example origin/main.\",\n\t\t\t};\n\t\tcase \"cwd-outside-worktree\":\n\t\t\treturn {\n\t\t\t\twhat: \"Working directory escapes the workspace\",\n\t\t\t\tsubject: `${text(fields, \"cwd\")} is outside ${text(fields, \"worktree\")}`,\n\t\t\t\thint: \"Use a cwd inside the workspace worktree, or a relative path.\",\n\t\t\t};\n\t\tcase \"git-unavailable\":\n\t\t\tif (reason === \"outdated\")\n\t\t\t\treturn {\n\t\t\t\t\twhat: \"Git is too old\",\n\t\t\t\t\tsubject: `${text(fields, \"gitPath\")} is git ${text(fields, \"version\")}, and workspaces need git ${text(fields, \"minimumVersion\")} or later to lock worktrees while adding them`,\n\t\t\t\t\thint: `Install a newer git (${text(fields, \"installCommand\")}) and make sure it is first on PATH.`,\n\t\t\t\t};\n\t\t\treturn {\n\t\t\t\twhat: \"Git is unavailable\",\n\t\t\t\tsubject: `${text(fields, \"gitPath\")} could not be started, and workspaces need git to bind repositories`,\n\t\t\t\thint: `Install git (${text(fields, \"installCommand\")}) and make sure it is on PATH.`,\n\t\t\t};\n\t\tcase \"git-failed\":\n\t\t\treturn {\n\t\t\t\twhat: \"Workspace git command failed\",\n\t\t\t\tsubject: `${text(fields, \"command\")} exited with status ${text(fields, \"status\")} during ${text(fields, \"phase\")}${gitOutput(fields)}`,\n\t\t\t\thint: \"Check the repository, network access and credentials, then retry.\",\n\t\t\t};\n\t\tcase \"filesystem-failed\":\n\t\t\treturn {\n\t\t\t\twhat: \"Workspace filesystem operation failed\",\n\t\t\t\tsubject: `${text(fields, \"operation\")} ${text(fields, \"path\")} failed with ${text(fields, \"errno\")}`,\n\t\t\t\thint: OUT_OF_SPACE_ERRNOS.has(text(fields, \"errno\"))\n\t\t\t\t\t? `Free disk space on the volume that holds ${text(fields, \"path\")}, then retry.`\n\t\t\t\t\t: IN_THE_WAY_ERRNOS.has(text(fields, \"errno\"))\n\t\t\t\t\t\t? `Remove ${text(fields, \"path\")}, which is in the way, then retry.`\n\t\t\t\t\t\t: `Check that ${text(fields, \"path\")} is writable by this user, then retry.`,\n\t\t\t};\n\t\tcase \"drift\":\n\t\t\tif (reason === \"branch-diverged\")\n\t\t\t\treturn {\n\t\t\t\t\twhat: \"Workspace branch diverged from its remote\",\n\t\t\t\t\tsubject: `${text(fields, \"branch\")} in ${text(fields, \"repository\")} is at ${text(fields, \"actual\")}, and origin/${text(fields, \"branch\")} at ${text(fields, \"expected\")} has commits it lacks`,\n\t\t\t\t\thint: `Push or rebase the local commits onto origin/${text(fields, \"branch\")}, or take the remote's history with git -C ${text(fields, \"repository\")} branch --force ${text(fields, \"branch\")} origin/${text(fields, \"branch\")}, then retry.`,\n\t\t\t\t};\n\t\t\treturn {\n\t\t\t\twhat: \"Workspace changed unexpectedly\",\n\t\t\t\tsubject:\n\t\t\t\t\treason === \"remote-changed\"\n\t\t\t\t\t\t? `${text(fields, \"worktree\")} no longer has the recorded remote ${text(fields, \"expected\")}`\n\t\t\t\t\t\t: `${text(fields, \"branch\")} in ${text(fields, \"worktree\")} no longer contains the recorded commit ${text(fields, \"expected\")}`,\n\t\t\t\thint: \"Restore the recorded repository state, or start a new run instead of resuming.\",\n\t\t\t};\n\t\tcase \"incomplete-worktree\":\n\t\t\tif (reason === \"addition-in-progress\")\n\t\t\t\treturn {\n\t\t\t\t\twhat: \"Workspace worktree is still being added\",\n\t\t\t\t\tsubject:\n\t\t\t\t\t\tfields.adderPid === null\n\t\t\t\t\t\t\t? `${text(fields, \"worktree\")} may still be checking out: ${text(fields, \"adminDir\")} holds an index lock, and no record names the git adding it`\n\t\t\t\t\t\t\t: `git (pid ${text(fields, \"adderPid\")} on ${text(fields, \"adderHost\")}) is still adding ${text(fields, \"worktree\")}`,\n\t\t\t\t\thint:\n\t\t\t\t\t\tfields.adderPid === null\n\t\t\t\t\t\t\t? `Wait for that checkout to finish, then bind again. If no git is running, remove the worktree with git -C ${text(fields, \"repository\")} worktree remove --force --force ${text(fields, \"worktree\")}.`\n\t\t\t\t\t\t\t: `Wait for it to finish, or stop it with kill -TERM -${text(fields, \"adderPid\")} (Windows: taskkill /T /PID ${text(fields, \"adderPid\")}), then bind again.`,\n\t\t\t\t};\n\t\t\treturn {\n\t\t\t\twhat: \"Workspace worktree is incomplete\",\n\t\t\t\tsubject:\n\t\t\t\t\treason === \"orphaned-directory\"\n\t\t\t\t\t\t? `${text(fields, \"worktree\")} points at ${text(fields, \"adminDir\")}, which ${text(fields, \"repository\")} no longer has`\n\t\t\t\t\t\t: reason === \"repair-failed\"\n\t\t\t\t\t\t\t? `${text(fields, \"worktree\")} was left by an interrupted checkout and could not be removed`\n\t\t\t\t\t\t\t: `${text(fields, \"worktree\")} was left by an interrupted checkout (${text(fields, \"adminDir\")} is locked: ${text(fields, \"marker\")})`,\n\t\t\t\thint: `Remove it with git -C ${text(fields, \"repository\")} worktree remove --force --force ${text(fields, \"worktree\")} and git -C ${text(fields, \"repository\")} worktree prune, or delete the directory if git no longer lists it, then bind again.`,\n\t\t\t};\n\t\tcase \"writer-conflict\":\n\t\t\treturn {\n\t\t\t\twhat: \"Workspace already has a writer\",\n\t\t\t\tsubject: `${text(fields, \"worktree\")} is held by ${text(fields, \"holder\")} (pid ${text(fields, \"holderPid\")} on ${text(fields, \"holderHost\")})`,\n\t\t\t\thint: `Wait for that writer to finish, use a read-only workspace, or remove ${text(fields, \"lockFile\")} if its process is gone.`,\n\t\t\t};\n\t}\n}\n\nconst RETRYABLE_BINDING_CODES: ReadonlySet<WorkspaceBindingErrorCode> = new Set([\"writer-conflict\"]);\nconst RETRYABLE_GIT_PHASES: ReadonlySet<string> = new Set([\"clone\", \"fetch\", \"push\"]);\nconst RETRYABLE_ERRNOS: ReadonlySet<string> = new Set([...OUT_OF_SPACE_ERRNOS, \"EAGAIN\", \"EBUSY\", \"EMFILE\", \"ENFILE\"]);\n\nexport interface WorkspaceBindingErrorInit {\n\treadonly code: WorkspaceBindingErrorCode;\n\treadonly reason?: WorkspaceBindingErrorReason;\n\treadonly fields: WorkspaceErrorFields;\n\treadonly cause?: unknown;\n}\n\n/** A workspace could not be bound: wrong repository or branch, conflicting inputs, git failures or drift. */\nexport class WorkspaceBindingError extends WorkspaceError {\n\toverride readonly name = \"WorkspaceBindingError\" as const;\n\tdeclare readonly code: WorkspaceBindingErrorCode;\n\tdeclare readonly reason?: WorkspaceBindingErrorReason;\n\n\tconstructor(init: WorkspaceBindingErrorInit) {\n\t\tconst described = describeBinding(init.code, init.reason, init.fields);\n\t\tsuper({\n\t\t\tcode: init.code,\n\t\t\treason: init.reason,\n\t\t\tsummary: `${described.what}: ${described.subject}`,\n\t\t\thint: described.hint,\n\t\t\tfields: init.fields,\n\t\t\tretryable:\n\t\t\t\tRETRYABLE_BINDING_CODES.has(init.code) ||\n\t\t\t\tinit.reason === \"addition-in-progress\" ||\n\t\t\t\t(init.code === \"git-failed\" && RETRYABLE_GIT_PHASES.has(String(init.fields.phase))) ||\n\t\t\t\t(init.code === \"filesystem-failed\" && RETRYABLE_ERRNOS.has(String(init.fields.errno))),\n\t\t\tcause: init.cause,\n\t\t});\n\t}\n}\n\nexport interface WorkspacePublicationErrorInit {\n\treadonly reason: WorkspacePublicationErrorReason;\n\treadonly fields: WorkspaceErrorFields;\n\treadonly cause?: unknown;\n}\n\nconst PUBLICATION_HINTS: Readonly<Record<WorkspacePublicationErrorReason, string>> = {\n\t\"no-remote\": \"Add an origin remote to the repository before publishing.\",\n\t\"push-failed\": \"Check push access to the remote, then retry.\",\n\t\"gh-unavailable\": \"Install the GitHub CLI (https://cli.github.com) and run gh auth login.\",\n\t\"gh-unauthenticated\": \"Run gh auth login, or set GH_TOKEN, then retry.\",\n\t\"gh-failed\": \"Check gh auth status and the repository on GitHub, then retry.\",\n};\n\n/** `publishPullRequest` could not push the branch or open the pull request. */\nexport class WorkspacePublicationError extends WorkspaceError {\n\toverride readonly name = \"WorkspacePublicationError\" as const;\n\tdeclare readonly code: WorkspacePublicationErrorCode;\n\tdeclare readonly reason: WorkspacePublicationErrorReason;\n\n\tconstructor(init: WorkspacePublicationErrorInit) {\n\t\tsuper({\n\t\t\tcode: \"publication-failed\",\n\t\t\treason: init.reason,\n\t\t\tsummary: `Pull request publication failed: ${text(init.fields, \"branch\")} of ${text(init.fields, \"repo\")} (${init.reason})`,\n\t\t\thint: PUBLICATION_HINTS[init.reason],\n\t\t\tfields: init.fields,\n\t\t\tretryable: init.reason === \"push-failed\" || init.reason === \"gh-failed\",\n\t\t\tcause: init.cause,\n\t\t});\n\t}\n}\n\nexport interface WorkspaceTimeoutErrorInit {\n\treadonly phase: WorkspaceGitPhase;\n\treadonly timeoutMs: number;\n\treadonly elapsedMs: number;\n\t/** The git command that ran, or for `repository-lock` the lock file waited for. */\n\treadonly command: string;\n\t/** For `repository-lock`: the process holding the lock, when known. */\n\treadonly holderPid?: number | null;\n\treadonly cause?: unknown;\n}\n\nfunction describeTimeout(init: WorkspaceTimeoutErrorInit): Described {\n\tconst limit = `limit ${init.timeoutMs}ms`;\n\tif (init.phase === \"repository-lock\") {\n\t\tconst holder = init.holderPid == null ? \"another process\" : `process ${init.holderPid}`;\n\t\treturn {\n\t\t\twhat: \"Workspace repository lock wait timed out\",\n\t\t\tsubject: `${holder} held ${init.command} for ${init.elapsedMs}ms, ${limit}`,\n\t\t\thint: `Wait for ${holder} to finish its fetch or worktree change, or stop it if it is stuck, then retry.`,\n\t\t};\n\t}\n\treturn {\n\t\twhat: \"Workspace git command timed out\",\n\t\tsubject: `${init.command} ran ${init.elapsedMs}ms during ${init.phase}, ${limit}`,\n\t\thint:\n\t\t\tinit.phase === \"worktree-add\"\n\t\t\t\t? \"Check free disk space and the repository's checkout size, then retry; the interrupted worktree is repaired on the next bind.\"\n\t\t\t\t: \"Check network access to the remote, then retry.\",\n\t};\n}\n\n/** A git step of a workspace operation exceeded its time limit. */\nexport class WorkspaceTimeoutError extends WorkspaceError {\n\toverride readonly name = \"WorkspaceTimeoutError\" as const;\n\tdeclare readonly code: WorkspaceTimeoutErrorCode;\n\tdeclare readonly phase: WorkspaceGitPhase;\n\tdeclare readonly timeoutMs: number;\n\tdeclare readonly elapsedMs: number;\n\n\tconstructor(init: WorkspaceTimeoutErrorInit) {\n\t\tconst { what, subject, hint } = describeTimeout(init);\n\t\tsuper({\n\t\t\tcode: \"timeout\",\n\t\t\tsummary: `${what}: ${subject}`,\n\t\t\thint,\n\t\t\tfields: {\n\t\t\t\tphase: init.phase,\n\t\t\t\ttimeoutMs: init.timeoutMs,\n\t\t\t\telapsedMs: init.elapsedMs,\n\t\t\t\tcommand: init.command,\n\t\t\t\t...(init.holderPid === undefined ? {} : { holderPid: init.holderPid }),\n\t\t\t},\n\t\t\tcause: init.cause,\n\t\t\tretryable: true,\n\t\t});\n\t}\n}\n\nexport interface WorkspaceSandboxErrorInit {\n\treadonly tool: string;\n\treadonly worktree: string;\n}\n\n/** A file-writing tool was called in a read-only workspace. Reported to the model as the tool's error result. */\nexport class WorkspaceSandboxError extends WorkspaceError {\n\toverride readonly name = \"WorkspaceSandboxError\" as const;\n\tdeclare readonly code: WorkspaceSandboxErrorCode;\n\n\tconstructor(init: WorkspaceSandboxErrorInit) {\n\t\tsuper({\n\t\t\tcode: \"write-denied\",\n\t\t\tsummary: `Write denied in a read-only workspace: ${init.tool} cannot change ${init.worktree}`,\n\t\t\thint: \"This stage is a read-only reviewer; report the change instead of making it.\",\n\t\t\tfields: { tool: init.tool, worktree: init.worktree, sandbox: \"read-only\" },\n\t\t});\n\t}\n}\n\nconst CODES: Readonly<Record<WorkspaceErrorName, readonly WorkspaceErrorCode[]>> = {\n\tWorkspaceError: [],\n\tWorkspaceConfigError: [\"invalid-setting\"],\n\tWorkspaceGitError: [\"git-failed\"],\n\tWorkspaceSnapshotError: [\n\t\t\"not-a-repository\",\n\t\t\"unborn-head\",\n\t\t\"blob-store-unsupported\",\n\t\t\"blob-store-failed\",\n\t\t\"unreadable-path\",\n\t\t\"pooled-worktree-lost\",\n\t\t\"blobs-collected\",\n\t],\n\tWorkspaceRestoreError: [\n\t\t\"snapshot-not-found\",\n\t\t\"blob-missing\",\n\t\t\"blob-corrupt\",\n\t\t\"commits-unavailable\",\n\t\t\"delta-failed\",\n\t\t\"tree-mismatch\",\n\t\t\"unsafe-target\",\n\t\t\"unwritable-path\",\n\t\t\"path-too-long\",\n\t\t\"invalid-snapshot\",\n\t\t\"restore-failed\",\n\t],\n\tWorkspaceDriftError: [\"tree-drift\"],\n\tWorkspaceCollectionError: [\"collection-failed\"],\n\tWorkspaceBindingError: [\n\t\t\"wrong-repository\",\n\t\t\"wrong-branch\",\n\t\t\"conflicting-worktree-input\",\n\t\t\"invalid-repository\",\n\t\t\"unknown-base\",\n\t\t\"cwd-outside-worktree\",\n\t\t\"git-unavailable\",\n\t\t\"git-failed\",\n\t\t\"filesystem-failed\",\n\t\t\"drift\",\n\t\t\"writer-conflict\",\n\t\t\"incomplete-worktree\",\n\t],\n\tWorkspacePublicationError: [\"publication-failed\"],\n\tWorkspaceTimeoutError: [\"timeout\"],\n\tWorkspaceSandboxError: [\"write-denied\"],\n};\nconst ALL_CODES = new Set(Object.values(CODES).flat());\n\n/**\n * A data property of `value` or its prototypes. Accessors are never invoked, so guards stay side-effect free and never\n * throw on hostile or half-built values.\n */\nfunction dataProperty(value: unknown, key: string | symbol): unknown {\n\tfor (let owner: unknown = value; typeof owner === \"object\" && owner !== null; owner = Object.getPrototypeOf(owner)) {\n\t\tconst descriptor = Object.getOwnPropertyDescriptor(owner, key);\n\t\tif (descriptor !== undefined) return descriptor.value;\n\t}\n\treturn undefined;\n}\n\nfunction structurallyIs(value: unknown, name: WorkspaceErrorName): boolean {\n\tconst candidateName = dataProperty(value, \"name\");\n\tconst code = dataProperty(value, \"code\");\n\tif (typeof code !== \"string\") return false;\n\tif (name === \"WorkspaceError\")\n\t\treturn (\n\t\t\ttypeof candidateName === \"string\" &&\n\t\t\tObject.hasOwn(CODES, candidateName) &&\n\t\t\tALL_CODES.has(code as WorkspaceErrorCode)\n\t\t);\n\treturn candidateName === name && CODES[name].includes(code as WorkspaceErrorCode);\n}\n\nexport function isWorkspaceError(value: unknown): value is WorkspaceError {\n\treturn value instanceof WorkspaceError || structurallyIs(value, \"WorkspaceError\");\n}\nexport function isWorkspaceConfigError(value: unknown): value is WorkspaceConfigError {\n\treturn value instanceof WorkspaceConfigError || structurallyIs(value, \"WorkspaceConfigError\");\n}\nexport function isWorkspaceGitError(value: unknown): value is WorkspaceGitError {\n\treturn value instanceof WorkspaceGitError || structurallyIs(value, \"WorkspaceGitError\");\n}\nexport function isWorkspaceSnapshotError(value: unknown): value is WorkspaceSnapshotError {\n\treturn value instanceof WorkspaceSnapshotError || structurallyIs(value, \"WorkspaceSnapshotError\");\n}\nexport function isWorkspaceRestoreError(value: unknown): value is WorkspaceRestoreError {\n\treturn value instanceof WorkspaceRestoreError || structurallyIs(value, \"WorkspaceRestoreError\");\n}\nexport function isWorkspaceDriftError(value: unknown): value is WorkspaceDriftError {\n\treturn value instanceof WorkspaceDriftError || structurallyIs(value, \"WorkspaceDriftError\");\n}\nexport function isWorkspaceCollectionError(value: unknown): value is WorkspaceCollectionError {\n\treturn value instanceof WorkspaceCollectionError || structurallyIs(value, \"WorkspaceCollectionError\");\n}\nexport function isWorkspaceBindingError(value: unknown): value is WorkspaceBindingError {\n\treturn value instanceof WorkspaceBindingError || structurallyIs(value, \"WorkspaceBindingError\");\n}\nexport function isWorkspacePublicationError(value: unknown): value is WorkspacePublicationError {\n\treturn value instanceof WorkspacePublicationError || structurallyIs(value, \"WorkspacePublicationError\");\n}\nexport function isWorkspaceTimeoutError(value: unknown): value is WorkspaceTimeoutError {\n\treturn value instanceof WorkspaceTimeoutError || structurallyIs(value, \"WorkspaceTimeoutError\");\n}\nexport function isWorkspaceSandboxError(value: unknown): value is WorkspaceSandboxError {\n\treturn value instanceof WorkspaceSandboxError || structurallyIs(value, \"WorkspaceSandboxError\");\n}\n\n/** The first error in `value`'s cause chain (itself included, at most eight links) that `guard` accepts. */\nexport function findWorkspaceError(value: unknown): WorkspaceError | undefined;\nexport function findWorkspaceError<T>(value: unknown, guard: (candidate: unknown) => candidate is T): T | undefined;\nexport function findWorkspaceError(value: unknown, guard: (candidate: unknown) => boolean = isWorkspaceError): unknown {\n\tlet current: unknown = value;\n\tfor (let depth = 0; depth < MAX_CAUSE_DEPTH && current !== undefined && current !== null; depth++) {\n\t\tif (guard(current)) return current;\n\t\tcurrent = dataProperty(current, \"cause\");\n\t}\n\treturn undefined;\n}\n\n/** Whether `value` or a cause up to eight levels deep is a workspace error that is safe to retry. */\nexport function isRetryableWorkspaceError(value: unknown): boolean {\n\treturn (\n\t\tfindWorkspaceError(\n\t\t\tvalue,\n\t\t\t(candidate): candidate is WorkspaceError =>\n\t\t\t\tisWorkspaceError(candidate) && dataProperty(candidate, \"retryable\") === true,\n\t\t) !== undefined\n\t);\n}\n\n/** Wire form of an error and up to seven of its causes, for crossing worker and IPC boundaries. */\nexport interface SerializedWorkspaceError {\n\treadonly name: string;\n\treadonly message: string;\n\treadonly code?: string;\n\treadonly hint?: string;\n\treadonly fields?: WorkspaceErrorFields;\n\treadonly retryable?: boolean;\n\t/** The sub-case of `code`, when it is not already one of the `fields`. */\n\treadonly reason?: string;\n\treadonly cause?: SerializedWorkspaceError;\n\t/** A cleanup that also failed, recorded beside the failure rather than replacing it. */\n\treadonly cleanupCause?: SerializedWorkspaceError;\n}\n\nfunction serialize(value: unknown, depth: number): SerializedWorkspaceError | undefined {\n\tif (value === undefined || value === null || depth >= MAX_CAUSE_DEPTH) return undefined;\n\tif (typeof value !== \"object\") return { name: \"Error\", message: String(value) };\n\tconst error = value as Partial<WorkspaceError>;\n\tconst typed = isWorkspaceError(value) || isGitUnavailableError(value);\n\tconst reason = typed && typeof error.reason === \"string\" && error.fields?.reason !== error.reason;\n\tconst cause = serialize(error.cause, depth + 1);\n\tconst cleanupCause = serialize(error.cleanupCause, depth + 1);\n\treturn {\n\t\tname: typeof error.name === \"string\" ? error.name : \"Error\",\n\t\t...(typed\n\t\t\t? { code: error.code, hint: error.hint, fields: error.fields, retryable: error.retryable === true }\n\t\t\t: {}),\n\t\t...(reason ? { reason: error.reason } : {}),\n\t\tmessage: typeof error.message === \"string\" ? error.message : String(value),\n\t\t...(cause ? { cause } : {}),\n\t\t...(cleanupCause ? { cleanupCause } : {}),\n\t};\n}\n\n/**\n * A JSON form of `error` and up to seven of its causes, as deep as {@link findWorkspaceError} searches, for crossing\n * worker and IPC boundaries.\n */\nexport function serializeWorkspaceError(error: Error): SerializedWorkspaceError {\n\treturn serialize(error, 0) as SerializedWorkspaceError;\n}\n\ntype Rehydrator = (value: SerializedWorkspaceError, fields: WorkspaceErrorFields, cause?: Error) => Error;\nconst REHYDRATORS: Partial<Record<WorkspaceErrorName | \"GitUnavailableError\", Rehydrator>> = {\n\tWorkspaceConfigError: (value, fields) =>\n\t\tvalue.reason === undefined\n\t\t\t? new WorkspaceConfigError(\n\t\t\t\t\tfields.source as WorkspaceConfigSource,\n\t\t\t\t\tString(fields.field),\n\t\t\t\t\tString(fields.expected),\n\t\t\t\t)\n\t\t\t: new WorkspaceConfigError({\n\t\t\t\t\tsource: fields.source as WorkspaceConfigSource,\n\t\t\t\t\tfield: String(fields.field),\n\t\t\t\t\treason: value.reason as WorkspaceConfigErrorReason,\n\t\t\t\t\texpected: String(fields.expected),\n\t\t\t\t\treceived: String(fields.received),\n\t\t\t\t}),\n\tGitUnavailableError: (value, fields, cause) =>\n\t\tnew GitUnavailableError(\n\t\t\tcompactFields({ ...fields, code: value.code }) as unknown as GitUnavailableFields,\n\t\t\tcause ? { cause } : undefined,\n\t\t),\n\tWorkspaceGitError: (_value, fields, cause) =>\n\t\tnew WorkspaceGitError(\n\t\t\tfields as { operation: string; cwd: string; exitCode: number | null; detail: string },\n\t\t\tcause,\n\t\t),\n\tWorkspaceSnapshotError: (value, fields, cause) =>\n\t\tnew WorkspaceSnapshotError(value.code as WorkspaceSnapshotErrorCode, String(fields.subject), cause),\n\tWorkspaceRestoreError: (value, fields, cause) =>\n\t\tvalue.code === \"restore-failed\"\n\t\t\t? new WorkspaceRestoreError({ reason: value.reason as WorkspaceRestoreErrorReason, fields, cause })\n\t\t\t: new WorkspaceRestoreError(\n\t\t\t\t\tvalue.code as Exclude<WorkspaceRestoreErrorCode, \"restore-failed\">,\n\t\t\t\t\tfields as unknown as WorkspaceRestoreErrorFields,\n\t\t\t\t\tcause,\n\t\t\t\t),\n\tWorkspaceDriftError: (_value, fields, cause) =>\n\t\tnew WorkspaceDriftError(fields as unknown as WorkspaceDriftErrorFields, cause),\n\tWorkspaceCollectionError: (value, fields, cause) =>\n\t\twithSenderText(new WorkspaceCollectionError(fields as unknown as WorkspaceCollectionErrorFields, cause), value),\n\tWorkspaceBindingError: (value, fields, cause) =>\n\t\tnew WorkspaceBindingError({\n\t\t\tcode: value.code as WorkspaceBindingErrorCode,\n\t\t\treason: value.reason as WorkspaceBindingErrorReason | undefined,\n\t\t\tfields,\n\t\t\tcause,\n\t\t}),\n\tWorkspacePublicationError: (value, fields, cause) =>\n\t\tnew WorkspacePublicationError({ reason: value.reason as WorkspacePublicationErrorReason, fields, cause }),\n\tWorkspaceTimeoutError: (_value, fields, cause) =>\n\t\tnew WorkspaceTimeoutError({\n\t\t\tphase: fields.phase as WorkspaceGitPhase,\n\t\t\ttimeoutMs: Number(fields.timeoutMs),\n\t\t\telapsedMs: Number(fields.elapsedMs),\n\t\t\tcommand: String(fields.command),\n\t\t\tholderPid: fields.holderPid as number | null | undefined,\n\t\t\tcause,\n\t\t}),\n\tWorkspaceSandboxError: (_value, fields) =>\n\t\tnew WorkspaceSandboxError({ tool: String(fields.tool), worktree: String(fields.worktree) }),\n};\n\n/**\n * `error` with the hint `value` was sent with, and the summary its message starts with: a collection error's hint and\n * summary come from causes the wire form may cut short, and from what the sender's database confirmed (#5622).\n */\nfunction withSenderText(error: WorkspaceError, value: SerializedWorkspaceError): WorkspaceError {\n\tif (typeof value.hint !== \"string\") return error;\n\tObject.defineProperty(error, \"hint\", { value: value.hint });\n\tconst tail = ` (${error.code}). ${value.hint}`;\n\tif (typeof value.message === \"string\" && value.message.endsWith(tail))\n\t\tObject.defineProperty(error, \"summary\", { value: value.message.slice(0, -tail.length) });\n\treturn error;\n}\n\nfunction rebuild(value: SerializedWorkspaceError, cause: Error | undefined): Error {\n\tconst rehydrate = Object.hasOwn(REHYDRATORS, value.name)\n\t\t? REHYDRATORS[value.name as WorkspaceErrorName | \"GitUnavailableError\"]\n\t\t: undefined;\n\tconst known =\n\t\tvalue.name === \"GitUnavailableError\"\n\t\t\t? isGitUnavailableError(value)\n\t\t\t: Object.hasOwn(CODES, value.name) &&\n\t\t\t\tCODES[value.name as WorkspaceErrorName].includes(value.code as WorkspaceErrorCode);\n\tif (rehydrate && value.fields && known) return rehydrate(value, value.fields, cause);\n\tif (value.code !== undefined) {\n\t\tconst error = new WorkspaceError({\n\t\t\tcode: value.code as WorkspaceErrorCode,\n\t\t\tsummary: value.message,\n\t\t\thint: value.hint ?? \"\",\n\t\t\tfields: value.fields ?? {},\n\t\t\tretryable: value.retryable === true,\n\t\t\treason: value.reason,\n\t\t\tcause,\n\t\t});\n\t\tObject.defineProperty(error, \"name\", {\n\t\t\tvalue: value.name,\n\t\t\tenumerable: false,\n\t\t\twritable: true,\n\t\t\tconfigurable: true,\n\t\t});\n\t\t// The wire form has no summary, and a class this version does not know may shape its message differently.\n\t\tdelete (error as { summary?: string }).summary;\n\t\treturn error;\n\t}\n\tconst error = new Error(value.message, cause ? { cause } : undefined);\n\terror.name = value.name;\n\treturn error;\n}\n\n/**\n * Rebuilds an error from {@link serializeWorkspaceError}. Known names become their class with every field intact;\n * other workspace errors become a {@link WorkspaceError} keeping their name and code; anything else a plain Error.\n * The sender's message wins, so a sender on another version renders the same text.\n */\nexport function rehydrateWorkspaceError(value: SerializedWorkspaceError): Error {\n\tconst cause = value.cause ? rehydrateWorkspaceError(value.cause) : undefined;\n\tconst error = rebuild(value, cause);\n\tObject.defineProperty(error, \"message\", { value: value.message, writable: true, configurable: true });\n\treturn attachCleanupCause(\n\t\terror,\n\t\tvalue.cleanupCause ? rehydrateWorkspaceError(value.cleanupCause) : undefined,\n\t) as Error;\n}\n"]}
|