@bastani/atomic 0.9.74-alpha.1 → 0.9.75
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 +162 -0
- package/dist/builtin/intercom/package.json +2 -2
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +21 -0
- package/dist/builtin/subagents/package.json +3 -3
- package/dist/builtin/subagents/skills/agent-browser/SKILL.md +8 -10
- package/dist/builtin/subagents/skills/agent-desktop/SKILL.md +9 -5
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +7 -1
- package/dist/builtin/web-access/package.json +2 -2
- package/dist/builtin/workflows/CHANGELOG.md +80 -0
- package/dist/builtin/workflows/README.md +5 -2
- package/dist/builtin/workflows/builtin/{chunk-m8eg152f.js → chunk-89we7r4p.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-a4fdm2cw.js → chunk-8yfssw01.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-774myqzs.js → chunk-v8mb0005.js} +366 -45
- package/dist/builtin/workflows/builtin/{chunk-d5cxskkp.js → chunk-wh2p4qjg.js} +2 -2
- package/dist/builtin/workflows/builtin/goal.js +2 -2
- package/dist/builtin/workflows/builtin/index.d.ts +10 -0
- package/dist/builtin/workflows/builtin/index.js +4 -4
- package/dist/builtin/workflows/builtin/open-claude-design.d.ts +12 -0
- package/dist/builtin/workflows/builtin/open-claude-design.js +1 -1
- package/dist/builtin/workflows/builtin/ralph.js +2 -2
- package/dist/builtin/workflows/package.json +2 -2
- package/dist/builtin/workflows/skills/impeccable/SKILL.md +4 -4
- package/dist/builtin/workflows/skills/impeccable/reference/android.md +1 -1
- package/dist/builtin/workflows/skills/impeccable/reference/audit.md +2 -2
- package/dist/builtin/workflows/skills/impeccable/reference/craft-floor.md +1 -1
- package/dist/builtin/workflows/skills/impeccable/reference/degraded/asset-producer.md +1 -1
- package/dist/builtin/workflows/skills/impeccable/reference/degraded/documenter.md +4 -4
- package/dist/builtin/workflows/skills/impeccable/reference/degraded/finish-reviewer.md +2 -2
- package/dist/builtin/workflows/skills/impeccable/reference/degraded/manual-edit-applier.md +3 -2
- package/dist/builtin/workflows/skills/impeccable/reference/distill.md +3 -3
- package/dist/builtin/workflows/skills/impeccable/reference/doctor.md +1 -1
- package/dist/builtin/workflows/skills/impeccable/reference/document.md +3 -3
- package/dist/builtin/workflows/skills/impeccable/reference/harden.md +19 -0
- package/dist/builtin/workflows/skills/impeccable/reference/hooks.md +15 -8
- package/dist/builtin/workflows/skills/impeccable/reference/init.md +2 -0
- package/dist/builtin/workflows/skills/impeccable/reference/live.md +8 -6
- package/dist/builtin/workflows/skills/impeccable/reference/new-work.md +4 -4
- package/dist/builtin/workflows/skills/impeccable/reference/optimize.md +0 -1
- package/dist/builtin/workflows/skills/impeccable/reference/visualize.md +1 -1
- package/dist/builtin/workflows/skills/impeccable/scripts/VERSION +1 -1
- package/dist/builtin/workflows/skills/impeccable/scripts/command-metadata.json +2 -2
- package/dist/builtin/workflows/skills/impeccable/scripts/engine-checksums.txt +9 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/impeccable +98 -44
- package/dist/builtin/workflows/skills/impeccable/scripts/impeccable.cmd +101 -34
- package/dist/builtin/workflows/skills/impeccable/scripts/live-browser-ignores.js +6 -2
- package/dist/builtin/workflows/skills/impeccable/scripts/live-browser-session.js +4 -1
- package/dist/builtin/workflows/skills/impeccable/scripts/live-browser.js +444 -144
- package/dist/builtin/workflows/skills/prompt-engineer/SKILL.md +3 -1
- package/dist/builtin/workflows/skills/prompt-engineer/references/advanced_patterns.md +2 -2
- package/dist/builtin/workflows/skills/prompt-engineer/references/claude_fable_5.md +13 -11
- package/dist/builtin/workflows/skills/prompt-engineer/references/claude_fable_5_1.md +10 -8
- package/dist/builtin/workflows/skills/prompt-engineer/references/claude_fable_5_2.md +143 -0
- package/dist/builtin/workflows/skills/prompt-engineer/references/claude_haiku_5_5.md +11 -7
- package/dist/builtin/workflows/skills/prompt-engineer/references/claude_opus_4_8.md +3 -3
- package/dist/builtin/workflows/skills/prompt-engineer/references/claude_opus_5.md +6 -2
- package/dist/builtin/workflows/skills/prompt-engineer/references/claude_opus_5_5.md +7 -7
- package/dist/builtin/workflows/skills/prompt-engineer/references/claude_sonnet_5.md +2 -2
- package/dist/builtin/workflows/skills/prompt-engineer/references/claude_sonnet_5_5.md +3 -3
- package/dist/builtin/workflows/skills/prompt-engineer/references/gpt_5_5.md +2 -2
- package/dist/builtin/workflows/skills/prompt-engineer/references/gpt_5_6.md +2 -2
- package/dist/builtin/workflows/skills/prompt-engineer/references/gpt_6.md +6 -5
- package/dist/builtin/workflows/skills/prompt-engineer/references/gpt_6_1_sol.md +4 -4
- package/dist/builtin/workflows/skills/prompt-engineer/references/gpt_6_1_terra.md +2 -2
- package/dist/builtin/workflows/skills/prompt-engineer/references/quality_improvement.md +4 -3
- package/dist/builtin/workflows/skills/skill-creator/scripts/aggregate_benchmark.py +0 -0
- package/dist/builtin/workflows/skills/skill-creator/scripts/generate_report.py +0 -0
- package/dist/builtin/workflows/skills/skill-creator/scripts/improve_description.py +0 -0
- package/dist/builtin/workflows/skills/skill-creator/scripts/package_skill.py +0 -0
- package/dist/builtin/workflows/skills/skill-creator/scripts/quick_validate.py +0 -0
- package/dist/builtin/workflows/skills/skill-creator/scripts/run_eval.py +0 -0
- package/dist/builtin/workflows/skills/skill-creator/scripts/run_loop.py +0 -0
- package/dist/builtin/workflows/skills/unslop/SKILL.md +15 -34
- package/dist/builtin/workflows/src/durable/journal/memory-run-journal.d.ts +1 -0
- package/dist/builtin/workflows/src/durable/journal/values.d.ts +2 -0
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +809 -410
- package/dist/builtin/workflows/src/extension/local-worker-entry.mjs +695 -305
- package/dist/builtin/workflows/src/index.js +685 -295
- package/dist/builtin/workflows/src/local-worker-entry.mjs +695 -305
- package/dist/builtin/workflows/src/shared/authoring-contract-stage.d.ts +6 -6
- package/dist/builtin/workflows/src/shared/authoring-contract-ui.d.ts +2 -2
- package/dist/builtin/workflows/src/shared/serializable-error-families.d.ts +2 -0
- package/dist/bun/app-host-modules.d.ts +1 -1
- package/dist/bun/app-host-modules.d.ts.map +1 -1
- package/dist/bun/app-host-modules.js.map +1 -1
- package/dist/bun/internal-workflow-worker.d.ts +2 -0
- package/dist/bun/internal-workflow-worker.d.ts.map +1 -1
- package/dist/bun/internal-workflow-worker.js +2 -1
- package/dist/bun/internal-workflow-worker.js.map +1 -1
- package/dist/codemode-worker.js +2 -0
- package/dist/config.d.ts +8 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +14 -0
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session-bash.d.ts.map +1 -1
- package/dist/core/agent-session-bash.js +2 -1
- package/dist/core/agent-session-bash.js.map +1 -1
- package/dist/core/agent-session-blueprint-environment.d.ts +10 -0
- package/dist/core/agent-session-blueprint-environment.d.ts.map +1 -0
- package/dist/core/agent-session-blueprint-environment.js +28 -0
- package/dist/core/agent-session-blueprint-environment.js.map +1 -0
- package/dist/core/agent-session-events.d.ts.map +1 -1
- package/dist/core/agent-session-events.js +2 -0
- package/dist/core/agent-session-events.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +1 -0
- 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-retry.d.ts.map +1 -1
- package/dist/core/agent-session-retry.js +14 -4
- package/dist/core/agent-session-retry.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +20 -0
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +55 -6
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-tool-registry.d.ts.map +1 -1
- package/dist/core/agent-session-tool-registry.js +2 -1
- package/dist/core/agent-session-tool-registry.js.map +1 -1
- package/dist/core/agent-session.d.ts +2 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +2 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/async-scope.d.ts +13 -0
- package/dist/core/async-scope.d.ts.map +1 -0
- package/dist/core/async-scope.js +20 -0
- package/dist/core/async-scope.js.map +1 -0
- package/dist/core/cache-warmer.d.ts +3 -14
- package/dist/core/cache-warmer.d.ts.map +1 -1
- package/dist/core/cache-warmer.js +8 -60
- package/dist/core/cache-warmer.js.map +1 -1
- package/dist/core/extensions/extension-work.js +2 -2
- package/dist/core/extensions/extension-work.js.map +1 -1
- package/dist/core/extensions/loader-host-modules.d.ts.map +1 -1
- package/dist/core/extensions/loader-host-modules.js +3 -1
- package/dist/core/extensions/loader-host-modules.js.map +1 -1
- package/dist/core/extensions/ui-types.d.ts +2 -1
- 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-events.d.ts +1 -1
- package/dist/core/extensions/workflow-events.d.ts.map +1 -1
- package/dist/core/extensions/workflow-events.js.map +1 -1
- package/dist/core/extensions/workflow-run-control.d.ts +4 -2
- 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/model-fallback-failures.d.ts +6 -0
- package/dist/core/model-fallback-failures.d.ts.map +1 -1
- package/dist/core/model-fallback-failures.js +10 -1
- package/dist/core/model-fallback-failures.js.map +1 -1
- package/dist/core/preferred-providers.d.ts +19 -0
- package/dist/core/preferred-providers.d.ts.map +1 -0
- package/dist/core/preferred-providers.js +25 -0
- package/dist/core/preferred-providers.js.map +1 -0
- package/dist/core/provider-alias.d.ts.map +1 -1
- package/dist/core/provider-alias.js +4 -0
- package/dist/core/provider-alias.js.map +1 -1
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +1 -0
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/remote-catalog-provider.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.js +3 -0
- package/dist/core/remote-catalog-provider.js.map +1 -1
- package/dist/core/resume/blueprint/action-expressions.d.ts +32 -0
- package/dist/core/resume/blueprint/action-expressions.d.ts.map +1 -0
- package/dist/core/resume/blueprint/action-expressions.js +389 -0
- package/dist/core/resume/blueprint/action-expressions.js.map +1 -0
- package/dist/core/resume/blueprint/actions.d.ts +90 -0
- package/dist/core/resume/blueprint/actions.d.ts.map +1 -0
- package/dist/core/resume/blueprint/actions.js +818 -0
- package/dist/core/resume/blueprint/actions.js.map +1 -0
- package/dist/core/resume/blueprint/build.d.ts +102 -0
- package/dist/core/resume/blueprint/build.d.ts.map +1 -0
- package/dist/core/resume/blueprint/build.js +535 -0
- package/dist/core/resume/blueprint/build.js.map +1 -0
- package/dist/core/resume/blueprint/context.d.ts +11 -0
- package/dist/core/resume/blueprint/context.d.ts.map +1 -0
- package/dist/core/resume/blueprint/context.js +106 -0
- package/dist/core/resume/blueprint/context.js.map +1 -0
- package/dist/core/resume/blueprint/envrc.d.ts +19 -0
- package/dist/core/resume/blueprint/envrc.d.ts.map +1 -0
- package/dist/core/resume/blueprint/envrc.js +77 -0
- package/dist/core/resume/blueprint/envrc.js.map +1 -0
- package/dist/core/resume/blueprint/errors.d.ts +179 -0
- package/dist/core/resume/blueprint/errors.d.ts.map +1 -0
- package/dist/core/resume/blueprint/errors.js +169 -0
- package/dist/core/resume/blueprint/errors.js.map +1 -0
- package/dist/core/resume/blueprint/ledger.d.ts +51 -0
- package/dist/core/resume/blueprint/ledger.d.ts.map +1 -0
- package/dist/core/resume/blueprint/ledger.js +119 -0
- package/dist/core/resume/blueprint/ledger.js.map +1 -0
- package/dist/core/resume/blueprint/notices.d.ts +14 -0
- package/dist/core/resume/blueprint/notices.d.ts.map +1 -0
- package/dist/core/resume/blueprint/notices.js +44 -0
- package/dist/core/resume/blueprint/notices.js.map +1 -0
- package/dist/core/resume/blueprint/process.d.ts +44 -0
- package/dist/core/resume/blueprint/process.d.ts.map +1 -0
- package/dist/core/resume/blueprint/process.js +142 -0
- package/dist/core/resume/blueprint/process.js.map +1 -0
- package/dist/core/resume/blueprint/resume.d.ts +73 -0
- package/dist/core/resume/blueprint/resume.d.ts.map +1 -0
- package/dist/core/resume/blueprint/resume.js +206 -0
- package/dist/core/resume/blueprint/resume.js.map +1 -0
- package/dist/core/resume/blueprint/schema.d.ts +26 -0
- package/dist/core/resume/blueprint/schema.d.ts.map +1 -0
- package/dist/core/resume/blueprint/schema.js +243 -0
- package/dist/core/resume/blueprint/schema.js.map +1 -0
- package/dist/core/resume/blueprint/steps.d.ts +54 -0
- package/dist/core/resume/blueprint/steps.d.ts.map +1 -0
- package/dist/core/resume/blueprint/steps.js +155 -0
- package/dist/core/resume/blueprint/steps.js.map +1 -0
- package/dist/core/resume/blueprint/types.d.ts +63 -0
- package/dist/core/resume/blueprint/types.d.ts.map +1 -0
- package/dist/core/resume/blueprint/types.js +2 -0
- package/dist/core/resume/blueprint/types.js.map +1 -0
- package/dist/core/resume/errors.d.ts +7 -35
- package/dist/core/resume/errors.d.ts.map +1 -1
- package/dist/core/resume/errors.js +1 -21
- package/dist/core/resume/errors.js.map +1 -1
- package/dist/core/resume/index.d.ts +12 -4
- package/dist/core/resume/index.d.ts.map +1 -1
- package/dist/core/resume/index.js +11 -4
- package/dist/core/resume/index.js.map +1 -1
- package/dist/core/resume/run-setup.d.ts +36 -15
- package/dist/core/resume/run-setup.d.ts.map +1 -1
- package/dist/core/resume/run-setup.js +70 -54
- package/dist/core/resume/run-setup.js.map +1 -1
- package/dist/core/resume/session-resume.d.ts +34 -20
- package/dist/core/resume/session-resume.d.ts.map +1 -1
- package/dist/core/resume/session-resume.js +244 -106
- package/dist/core/resume/session-resume.js.map +1 -1
- package/dist/core/retry-policy.d.ts +19 -1
- package/dist/core/retry-policy.d.ts.map +1 -1
- package/dist/core/retry-policy.js +26 -1
- package/dist/core/retry-policy.js.map +1 -1
- package/dist/core/sdk.js +1 -1
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-cwd.d.ts +56 -1
- package/dist/core/session-cwd.d.ts.map +1 -1
- package/dist/core/session-cwd.js +94 -4
- package/dist/core/session-cwd.js.map +1 -1
- package/dist/core/session-manager-core.d.ts +1 -1
- package/dist/core/session-manager-core.d.ts.map +1 -1
- package/dist/core/session-manager-core.js +10 -5
- package/dist/core/session-manager-core.js.map +1 -1
- package/dist/core/session-worktree-snapshots.d.ts +11 -0
- package/dist/core/session-worktree-snapshots.d.ts.map +1 -1
- package/dist/core/session-worktree-snapshots.js +10 -4
- package/dist/core/session-worktree-snapshots.js.map +1 -1
- package/dist/core/settings-defaults.d.ts +1 -1
- package/dist/core/settings-defaults.d.ts.map +1 -1
- package/dist/core/settings-defaults.js +1 -1
- package/dist/core/settings-defaults.js.map +1 -1
- package/dist/core/settings-manager-basic-accessors.d.ts +3 -2
- package/dist/core/settings-manager-basic-accessors.d.ts.map +1 -1
- package/dist/core/settings-manager-basic-accessors.js.map +1 -1
- package/dist/core/settings-schema.d.ts.map +1 -1
- package/dist/core/settings-schema.js +2 -1
- package/dist/core/settings-schema.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +4 -0
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/storage/write-ahead-log.d.ts +2 -1
- package/dist/core/storage/write-ahead-log.d.ts.map +1 -1
- package/dist/core/storage/write-ahead-log.js +27 -6
- package/dist/core/storage/write-ahead-log.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +10 -0
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/file-tool-errors.d.ts +1 -1
- package/dist/core/tools/file-tool-errors.js +1 -1
- package/dist/core/tools/file-tool-errors.js.map +1 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +52 -26
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts +2 -0
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/powershell.d.ts.map +1 -1
- package/dist/core/tools/powershell.js +10 -2
- package/dist/core/tools/powershell.js.map +1 -1
- package/dist/core/tools/tool-concurrency.d.ts.map +1 -1
- package/dist/core/tools/tool-concurrency.js +2 -2
- package/dist/core/tools/tool-concurrency.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/main-session.d.ts +12 -4
- package/dist/main-session.d.ts.map +1 -1
- package/dist/main-session.js +28 -4
- package/dist/main-session.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +6 -8
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.d.ts +5 -1
- package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.js +6 -1
- package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts +10 -3
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +34 -13
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/provider-brand.d.ts +16 -0
- package/dist/modes/interactive/components/provider-brand.d.ts.map +1 -0
- package/dist/modes/interactive/components/provider-brand.js +67 -0
- package/dist/modes/interactive/components/provider-brand.js.map +1 -0
- package/dist/modes/interactive/interactive-auth-routing.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-auth-routing.js +8 -6
- package/dist/modes/interactive/interactive-auth-routing.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-dialogs.js +4 -3
- package/dist/modes/interactive/interactive-extension-dialogs.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-runtime.js +8 -3
- package/dist/modes/interactive/interactive-extension-runtime.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-surface.d.ts +12 -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-session-routing.js +59 -21
- package/dist/modes/interactive/interactive-session-routing.js.map +1 -1
- package/dist/modes/interactive/interactive-slash-commands.js +23 -12
- package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
- package/dist/modes/interactive/login-provider-options.d.ts.map +1 -1
- package/dist/modes/interactive/login-provider-options.js +2 -1
- package/dist/modes/interactive/login-provider-options.js.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.d.ts +2 -0
- package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.js +8 -3
- package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
- package/dist/modes/rpc/rpc-client-api.d.ts +2 -1
- package/dist/modes/rpc/rpc-client-api.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client-api.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +0 -1
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +2 -18
- 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 +8 -2
- package/dist/modes/rpc/rpc-command-handler.js.map +1 -1
- package/dist/modes/rpc/rpc-error-decoding.d.ts +7 -0
- package/dist/modes/rpc/rpc-error-decoding.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-error-decoding.js +25 -0
- package/dist/modes/rpc/rpc-error-decoding.js.map +1 -0
- package/dist/modes/rpc/rpc-responses.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-responses.js +12 -0
- package/dist/modes/rpc/rpc-responses.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +11 -0
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +12 -3
- package/dist/package-manager-cli.js.map +1 -1
- package/docs/background-tasks.md +1 -1
- package/docs/codemode.md +22 -0
- package/docs/extensions/api-reference.md +27 -1
- package/docs/extensions/authoring.md +1 -1
- package/docs/extensions/ui.md +1 -1
- package/docs/getting-started/first-session.md +1 -1
- package/docs/guides/resume-on-any-machine.md +72 -19
- package/docs/models/evals.md +85 -17
- package/docs/models/reference.md +1 -1
- package/docs/providers.md +38 -5
- package/docs/reference/cli.md +2 -0
- package/docs/rpc/protocol.md +11 -1
- package/docs/sdk/reference.md +36 -4
- package/docs/sdk.md +2 -2
- package/docs/sessions.md +11 -1
- package/docs/settings.md +7 -2
- package/docs/skills.md +3 -3
- package/docs/storage.md +1 -1
- package/docs/tools.md +3 -1
- package/docs/workflows/api-reference.md +14 -12
- package/docs/workflows/authoring.md +29 -1
- package/docs/workflows/builtins.md +9 -1
- package/docs/workflows/operations.md +8 -8
- package/docs/worktree-snapshots.md +3 -2
- package/npm-shrinkwrap.json +83 -67
- package/package.json +7 -7
- package/schemas/settings.schema.json +3 -2
- package/dist/core/resume/setup-hook.d.ts +0 -69
- package/dist/core/resume/setup-hook.d.ts.map +0 -1
- package/dist/core/resume/setup-hook.js +0 -261
- package/dist/core/resume/setup-hook.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/resume/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,eAAe,EACf,2BAA2B,EAC3B,+BAA+B,EAC/B,aAAa,EACb,qBAAqB,EACrB,yBAAyB,EACzB,sBAAsB,EACtB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/resume/index.ts"],"names":[],"mappings":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AAO,EAAE,2BAA2B,EAAE,aAAa,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AACzG,OAAO,EACN,+BAA+B,EAG/B,2BAA2B,GAC3B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAIN,kBAAkB,EAClB,2BAA2B,EAC3B,yBAAyB,EACzB,wBAAwB,GACxB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACN,4BAA4B,EAK5B,oBAAoB,EAEpB,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,GACpB,MAAM,qBAAqB,CAAC","sourcesContent":["export {\n\tACTIONS_GITHUB_BASE_URL_ENV,\n\ttype ActionFetcher,\n\ttype ActionFetchRequest,\n\tparseActionReference,\n\ttype RunActionOptions,\n\trunAction,\n} from \"./blueprint/actions.ts\";\nexport {\n\tBLUEPRINT_FULL_BUILD_MAX_AGE_MS,\n\ttype BlueprintBuildConfig,\n\ttype BlueprintBuildOutcome,\n\ttype BlueprintBuildStatus,\n\ttype BlueprintFailure,\n\ttype BlueprintLayer,\n\ttype BlueprintLayerState,\n\ttype BlueprintRepository,\n\tdescribeBlueprints,\n\tneedsRebuild,\n\trunBlueprintBuild,\n\tSETUP_COMMAND_ALIAS,\n} from \"./blueprint/build.ts\";\nexport { BLUEPRINT_CONTEXT_TYPE, renderBlueprintContext } from \"./blueprint/context.ts\";\nexport {\n\tBlueprintBuildFailedError,\n\ttype BlueprintBuildFailedErrorCode,\n\ttype BlueprintBuildFailedErrorFields,\n\ttype BlueprintBuildPhase,\n\tBlueprintError,\n\ttype BlueprintErrorCode,\n\ttype BlueprintErrorFields,\n\ttype BlueprintErrorFieldValue,\n\ttype BlueprintErrorName,\n\tBlueprintInvalidError,\n\ttype BlueprintInvalidErrorCode,\n\ttype BlueprintInvalidErrorFields,\n\ttype BlueprintInvalidReason,\n\ttype BlueprintScope,\n\ttype BlueprintSection,\n\tBlueprintStepFailedError,\n\ttype BlueprintStepFailedErrorCode,\n\ttype BlueprintStepFailedErrorFields,\n\ttype BlueprintStepLocation,\n\tBlueprintStepTimedOutError,\n\ttype BlueprintStepTimedOutErrorCode,\n\ttype BlueprintStepTimedOutErrorFields,\n\tBlueprintUsesUnsupportedError,\n\ttype BlueprintUsesUnsupportedErrorCode,\n\ttype BlueprintUsesUnsupportedErrorFields,\n\ttype BlueprintUsesUnsupportedReason,\n\tfindBlueprintError,\n\tisBlueprintBuildFailedError,\n\tisBlueprintError,\n\tisBlueprintInvalidError,\n\tisBlueprintStepFailedError,\n\tisBlueprintStepTimedOutError,\n\tisBlueprintUsesUnsupportedError,\n\trehydrateBlueprintError,\n\ttype SerializedBlueprintError,\n\tserializeBlueprintError,\n} from \"./blueprint/errors.ts\";\nexport { type BlueprintNotice, blueprintNotices } from \"./blueprint/notices.ts\";\nexport {\n\ttype BlueprintCheckout,\n\tblueprintRepository,\n\tinheritedRemotes,\n\ttype RestoreLink,\n\ttype ResumedBlueprints,\n\trecordBlueprintContext,\n\trecordRestoredWorktreeContext,\n\ttype SetUpBlueprintsOptions,\n\tsetUpResumedBlueprints,\n} from \"./blueprint/resume.ts\";\nexport { BLUEPRINT_RULES, hostPlatform, parseBlueprint, selectDocument } from \"./blueprint/schema.ts\";\nexport { BLUEPRINT_STEP_TIMEOUT_MS } from \"./blueprint/steps.ts\";\nexport type {\n\tBlueprintDocument,\n\tBlueprintPlatform,\n\tBlueprintShell,\n\tBlueprintStep,\n\tBlueprintWarning,\n\tIncludedWorkspace,\n\tKnowledgeItem,\n\tParsedBlueprint,\n\tRunStep,\n\tUsesStep,\n} from \"./blueprint/types.ts\";\nexport {\n\tfindResumeError,\n\tisResumeCatalogTimeoutError,\n\tisResumeCatalogUnavailableError,\n\tisResumeError,\n\tisResumeNotFoundError,\n\tisResumePreconditionError,\n\tisRetryableResumeError,\n\tResumeCatalogTimeoutError,\n\ttype ResumeCatalogTimeoutErrorCode,\n\ttype ResumeCatalogTimeoutErrorFields,\n\tResumeCatalogUnavailableError,\n\ttype ResumeCatalogUnavailableErrorCode,\n\ttype ResumeCatalogUnavailableErrorFields,\n\ttype ResumeEntryPoint,\n\tResumeError,\n\ttype ResumeErrorCode,\n\ttype ResumeErrorFields,\n\ttype ResumeErrorFieldValue,\n\ttype ResumeErrorName,\n\tResumeNotFoundError,\n\ttype ResumeNotFoundErrorCode,\n\ttype ResumeNotFoundErrorFields,\n\ttype ResumeNotFoundReason,\n\tResumePreconditionError,\n\ttype ResumePreconditionErrorCode,\n\ttype ResumePreconditionErrorFields,\n\ttype ResumePreconditionProblem,\n\ttype ResumePreconditionProblemCode,\n\ttype ResumeSubject,\n\trehydrateResumeError,\n\ttype SerializedResumeError,\n\tserializeResumeError,\n} from \"./errors.ts\";\nexport { isResumeFailure, resumeFailureMessage } from \"./failure.ts\";\nexport {\n\tRESUME_CATALOG_TIMEOUT_MS,\n\ttype ResumeLookupTarget,\n\tresumeLookupError,\n\tresumeNotFoundError,\n\twithResumeLookupDeadline,\n} from \"./not-found.ts\";\nexport { currentWorktreeRootMappings, mapPathForCwd, withWorktreeRootMappings } from \"./path-mapping.ts\";\nexport {\n\tcheckResumeStoragePreconditions,\n\ttype ResumePreflightIo,\n\ttype ResumeStorageTarget,\n\tstoragePreconditionProblems,\n} from \"./preflight.ts\";\nexport {\n\ttype RunRestoreHistory,\n\ttype RunResumeSetupOptions,\n\ttype RunWorktreeTarget,\n\trestoreRunWorktree,\n\trunRestorePreconditionError,\n\tsetUpRestoredRunWorktrees,\n\tsetUpResumedRunWorktrees,\n} from \"./run-setup.ts\";\nexport {\n\tcontinueSessionWhereItWorked,\n\ttype DirtyCheckoutChoice,\n\ttype DirtyCheckoutPrompt,\n\ttype PreparedSessionResume,\n\ttype PrepareSessionResumeOptions,\n\tprepareSessionResume,\n\ttype ResumeNotice,\n\tresumeStoreDir,\n\tsavedProjectTrust,\n\tsessionResumeOptions,\n\tworktreeNeedsRestore,\n} from \"./session-resume.ts\";\n"]}
|
|
@@ -1,34 +1,55 @@
|
|
|
1
|
+
import type { WorktreeRootMapping, WorktreeSnapshot } from "../worktree-snapshot/types.ts";
|
|
2
|
+
import type { BlueprintNotice } from "./blueprint/notices.ts";
|
|
3
|
+
import { type ResumedBlueprints } from "./blueprint/resume.ts";
|
|
1
4
|
import { ResumePreconditionError } from "./errors.ts";
|
|
2
5
|
import { type ResumePreflightIo } from "./preflight.ts";
|
|
3
|
-
/** A checkout a workflow run's resume restores, with the
|
|
6
|
+
/** A checkout a workflow run's resume restores, with the remotes its snapshot recorded. */
|
|
4
7
|
export interface RunWorktreeTarget {
|
|
5
8
|
readonly root: string;
|
|
6
|
-
|
|
9
|
+
/** The repository's remotes; the same repository on this machine builds its blueprints incrementally. */
|
|
10
|
+
readonly remotes: readonly string[];
|
|
7
11
|
}
|
|
8
12
|
export interface RunResumeSetupOptions {
|
|
9
13
|
readonly signal?: AbortSignal;
|
|
10
14
|
readonly io?: ResumePreflightIo;
|
|
11
|
-
/** The agent directory whose worktree store,
|
|
15
|
+
/** The agent directory whose worktree store, blueprint ledger and global settings apply; defaults to Atomic's. */
|
|
12
16
|
readonly agentDir?: string;
|
|
17
|
+
/** Told what a build warns about, once per restored set of worktrees. */
|
|
18
|
+
readonly onNotices?: (notices: readonly BlueprintNotice[]) => void;
|
|
13
19
|
}
|
|
14
20
|
/**
|
|
15
21
|
* The unmet preconditions of restoring a workflow run's `missing` checkouts on this node, checked before the resume
|
|
16
|
-
* claims the run: Git can be started
|
|
17
|
-
*
|
|
22
|
+
* claims the run: Git can be started. A blueprint is never a precondition. Returns one `ResumePreconditionError` (entry
|
|
23
|
+
* point `workflow-resume`) listing every unmet piece, or undefined.
|
|
18
24
|
*/
|
|
19
25
|
export declare function runRestorePreconditionError(runId: string, missing: readonly RunWorktreeTarget[], options?: RunResumeSetupOptions): Promise<ResumePreconditionError | undefined>;
|
|
20
26
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* the
|
|
27
|
+
* Builds the blueprints of the worktrees a workflow run's resume restored (#4588). A blueprint that fails or cannot
|
|
28
|
+
* run never fails the resume and never removes a worktree: the outcome says what failed, and `options.onNotices` is
|
|
29
|
+
* told the warnings. Only `options.signal` aborting rejects, with its reason; the worktrees in `restored` are then
|
|
30
|
+
* removed again (a removal failure is kept as the error's `cleanupCause`), so the next resume restores from scratch.
|
|
24
31
|
*/
|
|
25
|
-
export declare function setUpRestoredRunWorktrees(restored: readonly RunWorktreeTarget[], options?: RunResumeSetupOptions): Promise<
|
|
32
|
+
export declare function setUpRestoredRunWorktrees(restored: readonly RunWorktreeTarget[], options?: RunResumeSetupOptions): Promise<ResumedBlueprints>;
|
|
33
|
+
/** What a workflow run's resume knows about the worktrees it restored now and those earlier resumes restored. */
|
|
34
|
+
export interface RunRestoreHistory {
|
|
35
|
+
/** The restores this resume just made. */
|
|
36
|
+
readonly restored: readonly WorktreeRootMapping[];
|
|
37
|
+
/** Every restore earlier resumes of the run recorded, oldest first. */
|
|
38
|
+
readonly mappings: readonly WorktreeRootMapping[];
|
|
39
|
+
/** The run's snapshots by id; their remotes identify each repository for the build ledger. */
|
|
40
|
+
readonly snapshots: ReadonlyMap<string, WorktreeSnapshot>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Builds the blueprints of a workflow run's worktrees on resume (#4588): each worktree this resume restored, and again
|
|
44
|
+
* each worktree an earlier resume restored here whose last build failed, never finished or left no record, so fixing a
|
|
45
|
+
* blueprint and resuming the run builds it again. A repository is identified by the remotes its restores trace back
|
|
46
|
+
* to, so an unchanged workspace is inherited across resumes. Never fails for a blueprint; see
|
|
47
|
+
* {@link setUpRestoredRunWorktrees}.
|
|
48
|
+
*/
|
|
49
|
+
export declare function setUpResumedRunWorktrees(history: RunRestoreHistory, options?: RunResumeSetupOptions): Promise<ResumedBlueprints>;
|
|
26
50
|
/**
|
|
27
|
-
* Restores a workflow worktree with `restore` and
|
|
28
|
-
*
|
|
29
|
-
* that cannot run for its dependency inputs is then reported as a {@link ResumePreconditionError} before `restore`
|
|
30
|
-
* runs. Without it, the fingerprint is read from the restored worktree. A hook that is missing or fails removes the
|
|
31
|
-
* restored worktree again. Resolves the restored worktree's path.
|
|
51
|
+
* Restores a workflow worktree with `restore` and builds its blueprints, as a run's own resume does for the checkouts
|
|
52
|
+
* it restores. `remotes` are the restored snapshot's, when known. Resolves the restored worktree's path.
|
|
32
53
|
*/
|
|
33
|
-
export declare function restoreRunWorktree(
|
|
54
|
+
export declare function restoreRunWorktree(remotes: readonly string[] | undefined, restore: () => Promise<string>, options?: RunResumeSetupOptions): Promise<string>;
|
|
34
55
|
//# sourceMappingURL=run-setup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-setup.d.ts","sourceRoot":"","sources":["../../../src/core/resume/run-setup.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"run-setup.d.ts","sourceRoot":"","sources":["../../../src/core/resume/run-setup.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAE3F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAGN,KAAK,iBAAiB,EAEtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,uBAAuB,EAAkC,MAAM,aAAa,CAAC;AAEtF,OAAO,EAAmD,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAGzG,2FAA2F;AAC3F,MAAM,WAAW,iBAAiB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,yGAAyG;IACzG,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CACpC;AAED,MAAM,WAAW,qBAAqB;IACrC,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,EAAE,CAAC,EAAE,iBAAiB,CAAC;IAChC,kHAAkH;IAClH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,yEAAyE;IACzE,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,SAAS,eAAe,EAAE,KAAK,IAAI,CAAC;CACnE;AAgBD;;;;GAIG;AACH,wBAAsB,2BAA2B,CAChD,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,SAAS,iBAAiB,EAAE,EACrC,OAAO,GAAE,qBAA0B,GACjC,OAAO,CAAC,uBAAuB,GAAG,SAAS,CAAC,CAgB9C;AAED;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAC9C,QAAQ,EAAE,SAAS,iBAAiB,EAAE,EACtC,OAAO,GAAE,qBAA0B,GACjC,OAAO,CAAC,iBAAiB,CAAC,CAE5B;AAED,iHAAiH;AACjH,MAAM,WAAW,iBAAiB;IACjC,0CAA0C;IAC1C,QAAQ,CAAC,QAAQ,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAClD,uEAAuE;IACvE,QAAQ,CAAC,QAAQ,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAClD,8FAA8F;IAC9F,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CAC1D;AAYD;;;;;;GAMG;AACH,wBAAsB,wBAAwB,CAC7C,OAAO,EAAE,iBAAiB,EAC1B,OAAO,GAAE,qBAA0B,GACjC,OAAO,CAAC,iBAAiB,CAAC,CAwB5B;AAqCD;;;GAGG;AACH,wBAAsB,kBAAkB,CACvC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,EACtC,OAAO,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,EAC9B,OAAO,GAAE,qBAA0B,GACjC,OAAO,CAAC,MAAM,CAAC,CAIjB"}
|
|
@@ -1,75 +1,107 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { stat } from "node:fs/promises";
|
|
2
2
|
import { getAgentDir } from "../../config.js";
|
|
3
3
|
import { SettingsManager } from "../settings-manager.js";
|
|
4
|
-
import { computeEnvironmentHash } from "../worktree-snapshot/env-hash.js";
|
|
5
4
|
import { removeRestoredWorktree } from "../worktree-snapshot/restore.js";
|
|
5
|
+
import { checkoutsNeedingRebuild, inheritedRemotes, setUpResumedBlueprints, } from "./blueprint/resume.js";
|
|
6
6
|
import { ResumePreconditionError } from "./errors.js";
|
|
7
|
+
import { isInside } from "./path-mapping.js";
|
|
7
8
|
import { defaultResumePreflightIo, gitUnavailableProblem } from "./preflight.js";
|
|
8
9
|
import { resumeStoreDir, savedProjectTrust } from "./session-resume.js";
|
|
9
|
-
import { ensureResumeSetup, predictedSetupProblem } from "./setup-hook.js";
|
|
10
10
|
/**
|
|
11
|
-
* The
|
|
12
|
-
*
|
|
11
|
+
* The blueprint build configuration of an agent directory. `resume.setupCommand` and the default project trust are
|
|
12
|
+
* global settings, so no project's settings are read.
|
|
13
13
|
*/
|
|
14
|
-
function
|
|
14
|
+
function runBlueprintConfig(agentDir = getAgentDir()) {
|
|
15
15
|
const settings = SettingsManager.create(agentDir, agentDir, { projectTrusted: false });
|
|
16
16
|
return {
|
|
17
|
+
agentDir,
|
|
17
18
|
storeDir: resumeStoreDir(agentDir),
|
|
18
|
-
|
|
19
|
+
setupCommand: settings.getResumeSetupCommand(),
|
|
20
|
+
trusted: savedProjectTrust(agentDir, settings),
|
|
19
21
|
};
|
|
20
22
|
}
|
|
21
23
|
/**
|
|
22
24
|
* The unmet preconditions of restoring a workflow run's `missing` checkouts on this node, checked before the resume
|
|
23
|
-
* claims the run: Git can be started
|
|
24
|
-
*
|
|
25
|
+
* claims the run: Git can be started. A blueprint is never a precondition. Returns one `ResumePreconditionError` (entry
|
|
26
|
+
* point `workflow-resume`) listing every unmet piece, or undefined.
|
|
25
27
|
*/
|
|
26
28
|
export async function runRestorePreconditionError(runId, missing, options = {}) {
|
|
27
29
|
if (missing.length === 0)
|
|
28
30
|
return undefined;
|
|
29
31
|
const io = options.io ?? defaultResumePreflightIo;
|
|
30
|
-
const { storeDir, setup } = runSetupConfig(options.agentDir);
|
|
31
32
|
const problems = [];
|
|
32
33
|
const git = await io.probeGit(options.signal);
|
|
33
34
|
if (git) {
|
|
34
35
|
problems.push(gitUnavailableProblem(git, `workflow run ${runId} must restore ${missing.map((target) => target.root).join(", ")}, which this node does not have`));
|
|
35
36
|
}
|
|
36
|
-
for (const target of missing) {
|
|
37
|
-
const problem = await predictedSetupProblem(target.envHash, join(storeDir, "worktrees"), setup);
|
|
38
|
-
if (problem) {
|
|
39
|
-
problems.push(problem);
|
|
40
|
-
break;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
37
|
return problems.length === 0
|
|
44
38
|
? undefined
|
|
45
39
|
: new ResumePreconditionError({ entryPoint: "workflow-resume", problems }, git);
|
|
46
40
|
}
|
|
47
41
|
/**
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* the
|
|
42
|
+
* Builds the blueprints of the worktrees a workflow run's resume restored (#4588). A blueprint that fails or cannot
|
|
43
|
+
* run never fails the resume and never removes a worktree: the outcome says what failed, and `options.onNotices` is
|
|
44
|
+
* told the warnings. Only `options.signal` aborting rejects, with its reason; the worktrees in `restored` are then
|
|
45
|
+
* removed again (a removal failure is kept as the error's `cleanupCause`), so the next resume restores from scratch.
|
|
51
46
|
*/
|
|
52
47
|
export async function setUpRestoredRunWorktrees(restored, options = {}) {
|
|
53
|
-
|
|
48
|
+
return buildRunWorktrees(restored, restored, options);
|
|
49
|
+
}
|
|
50
|
+
async function directoryExists(path) {
|
|
51
|
+
try {
|
|
52
|
+
return (await stat(path)).isDirectory();
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
const code = error.code;
|
|
56
|
+
if (code === "ENOENT" || code === "ENOTDIR")
|
|
57
|
+
return false;
|
|
58
|
+
throw error;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Builds the blueprints of a workflow run's worktrees on resume (#4588): each worktree this resume restored, and again
|
|
63
|
+
* each worktree an earlier resume restored here whose last build failed, never finished or left no record, so fixing a
|
|
64
|
+
* blueprint and resuming the run builds it again. A repository is identified by the remotes its restores trace back
|
|
65
|
+
* to, so an unchanged workspace is inherited across resumes. Never fails for a blueprint; see
|
|
66
|
+
* {@link setUpRestoredRunWorktrees}.
|
|
67
|
+
*/
|
|
68
|
+
export async function setUpResumedRunWorktrees(history, options = {}) {
|
|
69
|
+
const storeDir = resumeStoreDir(options.agentDir ?? getAgentDir());
|
|
70
|
+
const links = [...history.mappings, ...history.restored];
|
|
71
|
+
const targetOf = (mapping) => ({
|
|
72
|
+
root: mapping.to,
|
|
73
|
+
remotes: inheritedRemotes(mapping.to, history.snapshots.get(mapping.snapshotId)?.remotes ?? [], links, history.snapshots),
|
|
74
|
+
});
|
|
75
|
+
const restored = history.restored.map(targetOf);
|
|
76
|
+
const current = new Map();
|
|
77
|
+
for (const mapping of links)
|
|
78
|
+
current.set(mapping.from, mapping);
|
|
79
|
+
const restoredRoots = new Set(restored.map((target) => target.root));
|
|
80
|
+
const earlier = [];
|
|
81
|
+
for (const mapping of current.values()) {
|
|
82
|
+
if (restoredRoots.has(mapping.to) || !isInside(storeDir, mapping.to) || !(await directoryExists(mapping.to)))
|
|
83
|
+
continue;
|
|
84
|
+
earlier.push(targetOf(mapping));
|
|
85
|
+
}
|
|
86
|
+
const retried = await checkoutsNeedingRebuild(earlier, storeDir);
|
|
87
|
+
return buildRunWorktrees([...restored, ...retried], restored, options);
|
|
88
|
+
}
|
|
89
|
+
async function buildRunWorktrees(targets, removableOnCancel, options) {
|
|
90
|
+
const config = runBlueprintConfig(options.agentDir);
|
|
54
91
|
try {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
envHash: target.envHash,
|
|
60
|
-
storeDir,
|
|
61
|
-
config: setup,
|
|
62
|
-
signal: options.signal,
|
|
63
|
-
});
|
|
64
|
-
}
|
|
92
|
+
const blueprints = await setUpResumedBlueprints({ restored: targets, config, signal: options.signal });
|
|
93
|
+
if (blueprints.notices.length > 0)
|
|
94
|
+
options.onNotices?.(blueprints.notices);
|
|
95
|
+
return blueprints;
|
|
65
96
|
}
|
|
66
97
|
catch (error) {
|
|
67
|
-
|
|
98
|
+
if (options.signal?.aborted)
|
|
99
|
+
throw await removedAfter(error, removableOnCancel, config.storeDir);
|
|
100
|
+
throw error;
|
|
68
101
|
}
|
|
69
102
|
}
|
|
70
103
|
/**
|
|
71
|
-
* `error`, after every worktree in `restored` is removed again, with any removal failure kept as its `cleanupCause
|
|
72
|
-
* the next resume restores and sets up from scratch.
|
|
104
|
+
* `error`, after every worktree in `restored` is removed again, with any removal failure kept as its `cleanupCause`.
|
|
73
105
|
*/
|
|
74
106
|
async function removedAfter(error, restored, storeDir) {
|
|
75
107
|
const failures = [];
|
|
@@ -87,28 +119,12 @@ async function removedAfter(error, restored, storeDir) {
|
|
|
87
119
|
return error;
|
|
88
120
|
}
|
|
89
121
|
/**
|
|
90
|
-
* Restores a workflow worktree with `restore` and
|
|
91
|
-
*
|
|
92
|
-
* that cannot run for its dependency inputs is then reported as a {@link ResumePreconditionError} before `restore`
|
|
93
|
-
* runs. Without it, the fingerprint is read from the restored worktree. A hook that is missing or fails removes the
|
|
94
|
-
* restored worktree again. Resolves the restored worktree's path.
|
|
122
|
+
* Restores a workflow worktree with `restore` and builds its blueprints, as a run's own resume does for the checkouts
|
|
123
|
+
* it restores. `remotes` are the restored snapshot's, when known. Resolves the restored worktree's path.
|
|
95
124
|
*/
|
|
96
|
-
export async function restoreRunWorktree(
|
|
97
|
-
const { storeDir, setup } = runSetupConfig(options.agentDir);
|
|
98
|
-
if (envHash !== undefined) {
|
|
99
|
-
const problem = await predictedSetupProblem(envHash, join(storeDir, "worktrees"), setup);
|
|
100
|
-
if (problem)
|
|
101
|
-
throw new ResumePreconditionError({ entryPoint: "workflow-resume", problems: [problem] });
|
|
102
|
-
}
|
|
125
|
+
export async function restoreRunWorktree(remotes, restore, options = {}) {
|
|
103
126
|
const root = await restore();
|
|
104
|
-
|
|
105
|
-
try {
|
|
106
|
-
restoredEnvHash = envHash ?? (await computeEnvironmentHash(root));
|
|
107
|
-
}
|
|
108
|
-
catch (error) {
|
|
109
|
-
throw await removedAfter(error, [{ root }], storeDir);
|
|
110
|
-
}
|
|
111
|
-
await setUpRestoredRunWorktrees([{ root, envHash: restoredEnvHash }], options);
|
|
127
|
+
await setUpRestoredRunWorktrees([{ root, remotes: remotes ?? [] }], options);
|
|
112
128
|
return root;
|
|
113
129
|
}
|
|
114
130
|
//# sourceMappingURL=run-setup.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-setup.js","sourceRoot":"","sources":["../../../src/core/resume/run-setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAkC,MAAM,aAAa,CAAC;AACtF,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAA0B,MAAM,gBAAgB,CAAC;AACzG,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAA0B,MAAM,iBAAiB,CAAC;AAenG;;;GAGG;AACH,SAAS,cAAc,CAAC,QAAQ,GAAG,WAAW,EAAE;IAC/C,MAAM,QAAQ,GAAG,eAAe,CAAC,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,CAAC;IACvF,OAAO;QACN,QAAQ,EAAE,cAAc,CAAC,QAAQ,CAAC;QAClC,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,CAAC,qBAAqB,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-manager.ts\";\nimport { computeEnvironmentHash } from \"../worktree-snapshot/env-hash.ts\";\nimport { removeRestoredWorktree } from \"../worktree-snapshot/restore.ts\";\nimport { ResumePreconditionError, type ResumePreconditionProblem } from \"./errors.ts\";\nimport { defaultResumePreflightIo, gitUnavailableProblem, type ResumePreflightIo } from \"./preflight.ts\";\nimport { resumeStoreDir, savedProjectTrust } from \"./session-resume.ts\";\nimport { ensureResumeSetup, predictedSetupProblem, type ResumeSetupConfig } from \"./setup-hook.ts\";\n\n/** A checkout a workflow run's resume restores, with the environment fingerprint its snapshot recorded. */\nexport interface RunWorktreeTarget {\n\treadonly root: string;\n\treadonly envHash: string;\n}\n\nexport interface RunResumeSetupOptions {\n\treadonly signal?: AbortSignal;\n\treadonly io?: ResumePreflightIo;\n\t/** The agent directory whose worktree store, setup ledger and global settings apply; defaults to Atomic's. */\n\treadonly agentDir?: string;\n}\n\n/**\n * The worktree store and setup hook configuration of an agent directory. `resume.setupCommand` and the default\n * project trust are global settings, so no project's settings are read.\n */\nfunction runSetupConfig(agentDir = getAgentDir()): { readonly storeDir: string; readonly setup: ResumeSetupConfig } {\n\tconst settings = SettingsManager.create(agentDir, agentDir, { projectTrusted: false });\n\treturn {\n\t\tstoreDir: resumeStoreDir(agentDir),\n\t\tsetup: { command: settings.getResumeSetupCommand(), trusted: savedProjectTrust(agentDir, settings) },\n\t};\n}\n\n/**\n * The unmet preconditions of restoring a workflow run's `missing` checkouts on this node, checked before the resume\n * claims the run: Git can be started, and a setup hook could run for a snapshot with dependency inputs. Returns one\n * `ResumePreconditionError` (entry point `workflow-resume`) listing every unmet piece, or undefined.\n */\nexport async function runRestorePreconditionError(\n\trunId: string,\n\tmissing: readonly RunWorktreeTarget[],\n\toptions: RunResumeSetupOptions = {},\n): Promise<ResumePreconditionError | undefined> {\n\tif (missing.length === 0) return undefined;\n\tconst io = options.io ?? defaultResumePreflightIo;\n\tconst { storeDir, setup } = runSetupConfig(options.agentDir);\n\tconst problems: ResumePreconditionProblem[] = [];\n\tconst git = await io.probeGit(options.signal);\n\tif (git) {\n\t\tproblems.push(\n\t\t\tgitUnavailableProblem(\n\t\t\t\tgit,\n\t\t\t\t`workflow run ${runId} must restore ${missing.map((target) => target.root).join(\", \")}, which this node does not have`,\n\t\t\t),\n\t\t);\n\t}\n\tfor (const target of missing) {\n\t\tconst problem = await predictedSetupProblem(target.envHash, join(storeDir, \"worktrees\"), setup);\n\t\tif (problem) {\n\t\t\tproblems.push(problem);\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn problems.length === 0\n\t\t? undefined\n\t\t: new ResumePreconditionError({ entryPoint: \"workflow-resume\", problems }, git);\n}\n\n/**\n * Runs the setup hook in each worktree a workflow run's resume restored, once per worktree and environment. When any\n * hook is missing, fails or is cancelled, every worktree in `restored` is removed again (a removal failure is kept as\n * the error's `cleanupCause`) and the error is rethrown, so the next resume restores and sets up from scratch.\n */\nexport async function setUpRestoredRunWorktrees(\n\trestored: readonly RunWorktreeTarget[],\n\toptions: RunResumeSetupOptions = {},\n): Promise<void> {\n\tconst { storeDir, setup } = runSetupConfig(options.agentDir);\n\ttry {\n\t\tfor (const target of restored) {\n\t\t\tawait ensureResumeSetup({\n\t\t\t\tentryPoint: \"workflow-resume\",\n\t\t\t\tworktree: target.root,\n\t\t\t\tenvHash: target.envHash,\n\t\t\t\tstoreDir,\n\t\t\t\tconfig: setup,\n\t\t\t\tsignal: options.signal,\n\t\t\t});\n\t\t}\n\t} catch (error) {\n\t\tthrow await removedAfter(error, restored, storeDir);\n\t}\n}\n\n/**\n * `error`, after every worktree in `restored` is removed again, with any removal failure kept as its `cleanupCause`, so\n * the next resume restores and sets up from scratch.\n */\nasync function removedAfter(error: unknown, restored: readonly { readonly root: string }[], storeDir: string) {\n\tconst failures: unknown[] = [];\n\tfor (const target of restored) {\n\t\tawait removeRestoredWorktree(target.root, { storeDir }).catch((cleanup: unknown) => {\n\t\t\tfailures.push(cleanup);\n\t\t});\n\t}\n\tif (failures.length > 0 && error instanceof Error) {\n\t\tObject.defineProperty(error, \"cleanupCause\", {\n\t\t\tvalue: failures.length === 1 ? failures[0] : new AggregateError(failures, \"worktree cleanup failed\"),\n\t\t\tenumerable: false,\n\t\t});\n\t}\n\treturn error;\n}\n\n/**\n * Restores a workflow worktree with `restore` and runs the setup hook in it, as a run's own resume does for the\n * checkouts it restores. `envHash` is the environment fingerprint of the snapshot being restored, when known: a hook\n * that cannot run for its dependency inputs is then reported as a {@link ResumePreconditionError} before `restore`\n * runs. Without it, the fingerprint is read from the restored worktree. A hook that is missing or fails removes the\n * restored worktree again. Resolves the restored worktree's path.\n */\nexport async function restoreRunWorktree(\n\tenvHash: string | undefined,\n\trestore: () => Promise<string>,\n\toptions: RunResumeSetupOptions = {},\n): Promise<string> {\n\tconst { storeDir, setup } = runSetupConfig(options.agentDir);\n\tif (envHash !== undefined) {\n\t\tconst problem = await predictedSetupProblem(envHash, join(storeDir, \"worktrees\"), setup);\n\t\tif (problem) throw new ResumePreconditionError({ entryPoint: \"workflow-resume\", problems: [problem] });\n\t}\n\tconst root = await restore();\n\tlet restoredEnvHash: string;\n\ttry {\n\t\trestoredEnvHash = envHash ?? (await computeEnvironmentHash(root));\n\t} catch (error) {\n\t\tthrow await removedAfter(error, [{ root }], storeDir);\n\t}\n\tawait setUpRestoredRunWorktrees([{ root, envHash: restoredEnvHash }], options);\n\treturn root;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"run-setup.js","sourceRoot":"","sources":["../../../src/core/resume/run-setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAIzE,OAAO,EACN,uBAAuB,EACvB,gBAAgB,EAEhB,sBAAsB,GACtB,MAAM,uBAAuB,CAAC;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CACvC,OAAsC,EACtC,OAA8B,EAC9B,OAAO,GAA0B,EAAE;IAEnC,MAAM,IAAI,GAAG,MAAM,OAAO,EAAE,CAAC;IAC7B,MAAM,yBAAyB,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,IAAI,EAAE,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC;IAC7E,OAAO,IAAI,CAAC;AACb,CAAC","sourcesContent":["import { stat } from \"node:fs/promises\";\nimport { getAgentDir } from \"../../config.js\";\nimport { SettingsManager } from \"../settings-manager.ts\";\nimport { removeRestoredWorktree } from \"../worktree-snapshot/restore.ts\";\nimport type { WorktreeRootMapping, WorktreeSnapshot } from \"../worktree-snapshot/types.ts\";\nimport type { BlueprintBuildConfig } from \"./blueprint/build.ts\";\nimport type { BlueprintNotice } from \"./blueprint/notices.ts\";\nimport {\n\tcheckoutsNeedingRebuild,\n\tinheritedRemotes,\n\ttype ResumedBlueprints,\n\tsetUpResumedBlueprints,\n} from \"./blueprint/resume.ts\";\nimport { ResumePreconditionError, type ResumePreconditionProblem } from \"./errors.ts\";\nimport { isInside } from \"./path-mapping.ts\";\nimport { defaultResumePreflightIo, gitUnavailableProblem, type ResumePreflightIo } from \"./preflight.ts\";\nimport { resumeStoreDir, savedProjectTrust } from \"./session-resume.ts\";\n\n/** A checkout a workflow run's resume restores, with the remotes its snapshot recorded. */\nexport interface RunWorktreeTarget {\n\treadonly root: string;\n\t/** The repository's remotes; the same repository on this machine builds its blueprints incrementally. */\n\treadonly remotes: readonly string[];\n}\n\nexport interface RunResumeSetupOptions {\n\treadonly signal?: AbortSignal;\n\treadonly io?: ResumePreflightIo;\n\t/** The agent directory whose worktree store, blueprint ledger and global settings apply; defaults to Atomic's. */\n\treadonly agentDir?: string;\n\t/** Told what a build warns about, once per restored set of worktrees. */\n\treadonly onNotices?: (notices: readonly BlueprintNotice[]) => void;\n}\n\n/**\n * The blueprint build configuration of an agent directory. `resume.setupCommand` and the default project trust are\n * global settings, so no project's settings are read.\n */\nfunction runBlueprintConfig(agentDir = getAgentDir()): BlueprintBuildConfig {\n\tconst settings = SettingsManager.create(agentDir, agentDir, { projectTrusted: false });\n\treturn {\n\t\tagentDir,\n\t\tstoreDir: resumeStoreDir(agentDir),\n\t\tsetupCommand: settings.getResumeSetupCommand(),\n\t\ttrusted: savedProjectTrust(agentDir, settings),\n\t};\n}\n\n/**\n * The unmet preconditions of restoring a workflow run's `missing` checkouts on this node, checked before the resume\n * claims the run: Git can be started. A blueprint is never a precondition. Returns one `ResumePreconditionError` (entry\n * point `workflow-resume`) listing every unmet piece, or undefined.\n */\nexport async function runRestorePreconditionError(\n\trunId: string,\n\tmissing: readonly RunWorktreeTarget[],\n\toptions: RunResumeSetupOptions = {},\n): Promise<ResumePreconditionError | undefined> {\n\tif (missing.length === 0) return undefined;\n\tconst io = options.io ?? defaultResumePreflightIo;\n\tconst problems: ResumePreconditionProblem[] = [];\n\tconst git = await io.probeGit(options.signal);\n\tif (git) {\n\t\tproblems.push(\n\t\t\tgitUnavailableProblem(\n\t\t\t\tgit,\n\t\t\t\t`workflow run ${runId} must restore ${missing.map((target) => target.root).join(\", \")}, which this node does not have`,\n\t\t\t),\n\t\t);\n\t}\n\treturn problems.length === 0\n\t\t? undefined\n\t\t: new ResumePreconditionError({ entryPoint: \"workflow-resume\", problems }, git);\n}\n\n/**\n * Builds the blueprints of the worktrees a workflow run's resume restored (#4588). A blueprint that fails or cannot\n * run never fails the resume and never removes a worktree: the outcome says what failed, and `options.onNotices` is\n * told the warnings. Only `options.signal` aborting rejects, with its reason; the worktrees in `restored` are then\n * removed again (a removal failure is kept as the error's `cleanupCause`), so the next resume restores from scratch.\n */\nexport async function setUpRestoredRunWorktrees(\n\trestored: readonly RunWorktreeTarget[],\n\toptions: RunResumeSetupOptions = {},\n): Promise<ResumedBlueprints> {\n\treturn buildRunWorktrees(restored, restored, options);\n}\n\n/** What a workflow run's resume knows about the worktrees it restored now and those earlier resumes restored. */\nexport interface RunRestoreHistory {\n\t/** The restores this resume just made. */\n\treadonly restored: readonly WorktreeRootMapping[];\n\t/** Every restore earlier resumes of the run recorded, oldest first. */\n\treadonly mappings: readonly WorktreeRootMapping[];\n\t/** The run's snapshots by id; their remotes identify each repository for the build ledger. */\n\treadonly snapshots: ReadonlyMap<string, WorktreeSnapshot>;\n}\n\nasync function directoryExists(path: string): Promise<boolean> {\n\ttry {\n\t\treturn (await stat(path)).isDirectory();\n\t} catch (error) {\n\t\tconst code = (error as NodeJS.ErrnoException).code;\n\t\tif (code === \"ENOENT\" || code === \"ENOTDIR\") return false;\n\t\tthrow error;\n\t}\n}\n\n/**\n * Builds the blueprints of a workflow run's worktrees on resume (#4588): each worktree this resume restored, and again\n * each worktree an earlier resume restored here whose last build failed, never finished or left no record, so fixing a\n * blueprint and resuming the run builds it again. A repository is identified by the remotes its restores trace back\n * to, so an unchanged workspace is inherited across resumes. Never fails for a blueprint; see\n * {@link setUpRestoredRunWorktrees}.\n */\nexport async function setUpResumedRunWorktrees(\n\thistory: RunRestoreHistory,\n\toptions: RunResumeSetupOptions = {},\n): Promise<ResumedBlueprints> {\n\tconst storeDir = resumeStoreDir(options.agentDir ?? getAgentDir());\n\tconst links = [...history.mappings, ...history.restored];\n\tconst targetOf = (mapping: WorktreeRootMapping): RunWorktreeTarget => ({\n\t\troot: mapping.to,\n\t\tremotes: inheritedRemotes(\n\t\t\tmapping.to,\n\t\t\thistory.snapshots.get(mapping.snapshotId)?.remotes ?? [],\n\t\t\tlinks,\n\t\t\thistory.snapshots,\n\t\t),\n\t});\n\tconst restored = history.restored.map(targetOf);\n\tconst current = new Map<string, WorktreeRootMapping>();\n\tfor (const mapping of links) current.set(mapping.from, mapping);\n\tconst restoredRoots = new Set(restored.map((target) => target.root));\n\tconst earlier: RunWorktreeTarget[] = [];\n\tfor (const mapping of current.values()) {\n\t\tif (restoredRoots.has(mapping.to) || !isInside(storeDir, mapping.to) || !(await directoryExists(mapping.to)))\n\t\t\tcontinue;\n\t\tearlier.push(targetOf(mapping));\n\t}\n\tconst retried = await checkoutsNeedingRebuild(earlier, storeDir);\n\treturn buildRunWorktrees([...restored, ...retried], restored, options);\n}\n\nasync function buildRunWorktrees(\n\ttargets: readonly RunWorktreeTarget[],\n\tremovableOnCancel: readonly RunWorktreeTarget[],\n\toptions: RunResumeSetupOptions,\n): Promise<ResumedBlueprints> {\n\tconst config = runBlueprintConfig(options.agentDir);\n\ttry {\n\t\tconst blueprints = await setUpResumedBlueprints({ restored: targets, config, signal: options.signal });\n\t\tif (blueprints.notices.length > 0) options.onNotices?.(blueprints.notices);\n\t\treturn blueprints;\n\t} catch (error) {\n\t\tif (options.signal?.aborted) throw await removedAfter(error, removableOnCancel, config.storeDir);\n\t\tthrow error;\n\t}\n}\n\n/**\n * `error`, after every worktree in `restored` is removed again, with any removal failure kept as its `cleanupCause`.\n */\nasync function removedAfter(error: unknown, restored: readonly { readonly root: string }[], storeDir: string) {\n\tconst failures: unknown[] = [];\n\tfor (const target of restored) {\n\t\tawait removeRestoredWorktree(target.root, { storeDir }).catch((cleanup: unknown) => {\n\t\t\tfailures.push(cleanup);\n\t\t});\n\t}\n\tif (failures.length > 0 && error instanceof Error) {\n\t\tObject.defineProperty(error, \"cleanupCause\", {\n\t\t\tvalue: failures.length === 1 ? failures[0] : new AggregateError(failures, \"worktree cleanup failed\"),\n\t\t\tenumerable: false,\n\t\t});\n\t}\n\treturn error;\n}\n\n/**\n * Restores a workflow worktree with `restore` and builds its blueprints, as a run's own resume does for the checkouts\n * it restores. `remotes` are the restored snapshot's, when known. Resolves the restored worktree's path.\n */\nexport async function restoreRunWorktree(\n\tremotes: readonly string[] | undefined,\n\trestore: () => Promise<string>,\n\toptions: RunResumeSetupOptions = {},\n): Promise<string> {\n\tconst root = await restore();\n\tawait setUpRestoredRunWorktrees([{ root, remotes: remotes ?? [] }], options);\n\treturn root;\n}\n"]}
|
|
@@ -2,9 +2,9 @@ import type { SessionManager } from "../session-manager.ts";
|
|
|
2
2
|
import type { SettingsManager } from "../settings-manager.ts";
|
|
3
3
|
import { type VerifyWorktreeOptions } from "../worktree-snapshot/restore.ts";
|
|
4
4
|
import type { WorktreeSnapshot, WorktreeSnapshotSettings } from "../worktree-snapshot/types.ts";
|
|
5
|
-
import type {
|
|
5
|
+
import type { BlueprintBuildConfig } from "./blueprint/build.ts";
|
|
6
|
+
import { type ResumeEntryPoint } from "./errors.ts";
|
|
6
7
|
import { type ResumePreflightIo } from "./preflight.ts";
|
|
7
|
-
import { type ResumeSetupConfig } from "./setup-hook.ts";
|
|
8
8
|
/** What to do when the checkout a resume was started in belongs to the session's repository but differs from it. */
|
|
9
9
|
export type DirtyCheckoutChoice = "restore" | "use" | "cancel";
|
|
10
10
|
export interface DirtyCheckoutPrompt {
|
|
@@ -23,7 +23,8 @@ export interface PrepareSessionResumeOptions {
|
|
|
23
23
|
/** Where the resume was started: the requested target when it is a checkout of the session's repository. */
|
|
24
24
|
readonly launchCwd: string;
|
|
25
25
|
readonly settings: WorktreeSnapshotSettings;
|
|
26
|
-
|
|
26
|
+
/** How the blueprints of worktrees this resume restores are built; the store directory is `storeDir`. */
|
|
27
|
+
readonly blueprint: Omit<BlueprintBuildConfig, "storeDir">;
|
|
27
28
|
/** Host directory for restored worktrees. Default ~/.atomic/agent/worktree-snapshots. */
|
|
28
29
|
readonly storeDir?: string;
|
|
29
30
|
/** Asks the user about a dirty checkout. Without it a fresh worktree is restored, which overwrites nothing. */
|
|
@@ -37,6 +38,17 @@ export interface PrepareSessionResumeOptions {
|
|
|
37
38
|
* never restored, as for checkouts it worked in on this node and changed since.
|
|
38
39
|
*/
|
|
39
40
|
readonly keepInPlace?: ReadonlySet<string>;
|
|
41
|
+
/**
|
|
42
|
+
* `"skip"` restores checkouts but builds and describes no blueprint and records no blueprint context: for a process
|
|
43
|
+
* that serves a resume another process of the same user-level action already prepared and built, so one resume
|
|
44
|
+
* builds once. Default `"build"`.
|
|
45
|
+
*/
|
|
46
|
+
readonly blueprints?: "build" | "skip";
|
|
47
|
+
/**
|
|
48
|
+
* Told the warnings of the blueprint builds a resume ran when its caller gets only a session back, as when a
|
|
49
|
+
* released session is woken ({@link continueSessionWhereItWorked}).
|
|
50
|
+
*/
|
|
51
|
+
readonly onNotices?: (notices: readonly ResumeNotice[]) => void;
|
|
40
52
|
}
|
|
41
53
|
export type PreparedSessionResume = {
|
|
42
54
|
readonly status: "cancelled";
|
|
@@ -45,6 +57,10 @@ export type PreparedSessionResume = {
|
|
|
45
57
|
/** The session opened where it continues: the one passed in when its cwd did not change. */
|
|
46
58
|
readonly sessionManager: SessionManager;
|
|
47
59
|
readonly notices: readonly ResumeNotice[];
|
|
60
|
+
/** The warnings of the blueprint builds this resume ran, also in `notices`. */
|
|
61
|
+
readonly blueprintNotices: readonly ResumeNotice[];
|
|
62
|
+
/** The blueprint context the session's next turn carries, already recorded in it; undefined when none. */
|
|
63
|
+
readonly blueprintContext: string | undefined;
|
|
48
64
|
};
|
|
49
65
|
export interface SessionSnapshotMatch {
|
|
50
66
|
readonly root: string;
|
|
@@ -58,12 +74,15 @@ export declare function latestSessionSnapshot(sessionManager: Pick<SessionManage
|
|
|
58
74
|
* Gets a resumed session's checkouts ready on this node before its runtime starts, and returns the session opened
|
|
59
75
|
* where it continues. When the checkout the session works in is missing or changed here, a checkout of the same
|
|
60
76
|
* repository the resume started in is used as-is if it matches (and, if it differs, only when the user chooses it).
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
77
|
+
* The checkout the session works in is the only one the resume cannot go without: when it must be restored, the
|
|
78
|
+
* precondition of restoring the recorded checkouts, that Git can run, is checked first, and an unmet one refuses the
|
|
79
|
+
* resume before anything is written. Every other checkout the session recorded that is gone or changed here, except
|
|
80
|
+
* those in `keepInPlace`, never blocks the resume: one the session worked in on this node, changed since, continues as
|
|
81
|
+
* it is; the rest are restored into fresh worktrees one by one by #4245's {@link resumeSessionWorktree}, and one that
|
|
82
|
+
* cannot be (Git is unavailable, or its restore fails) is left out with a warning that names its path and why. Each
|
|
83
|
+
* worktree Atomic restored then gets its blueprints built (#4588): a failing step is a warning in `notices` and never
|
|
84
|
+
* stops the resume. The agent gets the blueprints' maintenance and knowledge in the session's next turn. The session's
|
|
85
|
+
* tools resolve paths under every root it recorded into the place that root was restored.
|
|
67
86
|
*/
|
|
68
87
|
export declare function prepareSessionResume(sessionManager: SessionManager, options: PrepareSessionResumeOptions): Promise<PreparedSessionResume>;
|
|
69
88
|
/**
|
|
@@ -76,17 +95,12 @@ export declare function prepareSessionResume(sessionManager: SessionManager, opt
|
|
|
76
95
|
export declare function holdsSnapshotCommit(snapshot: WorktreeSnapshot, root: string, signal?: AbortSignal): Promise<boolean>;
|
|
77
96
|
/**
|
|
78
97
|
* Where a woken session continues. Each checkout it recorded that it worked in on this node stays as it is, since work
|
|
79
|
-
* done in it after the release belongs to the session, and a
|
|
80
|
-
* restored for it runs again. Every other checkout, as when it is missing or another clone sits at its path on another
|
|
98
|
+
* done in it after the release belongs to the session, and a blueprint build that failed or did not finish in a worktree
|
|
99
|
+
* this node restored for it runs again. Every other checkout, as when it is missing or another clone sits at its path on another
|
|
81
100
|
* node, is prepared as `/resume` prepares it. When every checkout stays, it continues in the directory it last worked
|
|
82
101
|
* in, after the restores it recorded, which `reopen` opens it in.
|
|
83
102
|
*/
|
|
84
103
|
export declare function continueSessionWhereItWorked(opened: SessionManager, options: PrepareSessionResumeOptions, reopen?: (cwd: string) => Promise<SessionManager>): Promise<SessionManager>;
|
|
85
|
-
/**
|
|
86
|
-
* Runs the setup hook again in each worktree Atomic restored for the session whose last hook there failed, as a resume
|
|
87
|
-
* that restores nothing does.
|
|
88
|
-
*/
|
|
89
|
-
export declare function retryFailedSessionSetup(sessionManager: SessionManager, options: PrepareSessionResumeOptions): Promise<ResumeNotice[]>;
|
|
90
104
|
/**
|
|
91
105
|
* Whether resuming in `root` restores `snapshot` into a fresh worktree: the checkout is gone, is not a repository of
|
|
92
106
|
* the recorded tree, or no longer matches it. A path that cannot be read fails with its typed `unreadable-path` error
|
|
@@ -95,14 +109,14 @@ export declare function retryFailedSessionSetup(sessionManager: SessionManager,
|
|
|
95
109
|
*/
|
|
96
110
|
export declare function worktreeNeedsRestore(snapshot: WorktreeSnapshot, root: string, options: VerifyWorktreeOptions): Promise<boolean>;
|
|
97
111
|
/**
|
|
98
|
-
* Whether a restored worktree is trusted to run its
|
|
99
|
-
*
|
|
112
|
+
* Whether a restored worktree is trusted to run its blueprints outside the CLI: the decision saved in `agentDir` for
|
|
113
|
+
* that path, else the default trust setting.
|
|
100
114
|
*/
|
|
101
115
|
export declare function savedProjectTrust(agentDir: string, settings: Pick<SettingsManager, "getDefaultProjectTrust">): (worktree: string) => boolean;
|
|
102
|
-
/** Where restored worktrees, the
|
|
116
|
+
/** Where restored worktrees, the blueprint build ledger and logs live for the agent directory `agentDir`. */
|
|
103
117
|
export declare function resumeStoreDir(agentDir: string): string;
|
|
104
118
|
/**
|
|
105
|
-
* The options a resume from `launchCwd` needs: snapshot settings and the
|
|
119
|
+
* The options a resume from `launchCwd` needs: snapshot settings and the blueprint build configuration from
|
|
106
120
|
* `settingsManager`, and the worktree store of `agentDir`.
|
|
107
121
|
*/
|
|
108
122
|
export declare function sessionResumeOptions(entryPoint: ResumeEntryPoint, launchCwd: string, agentDir: string, settingsManager: Pick<SettingsManager, "getWorktreeSnapshotSettings" | "getResumeSetupCommand">, trusted: (worktree: string) => boolean): PrepareSessionResumeOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-resume.d.ts","sourceRoot":"","sources":["../../../src/core/resume/session-resume.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"session-resume.d.ts","sourceRoot":"","sources":["../../../src/core/resume/session-resume.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAu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