@bastani/atomic 0.9.74-alpha.1 → 0.9.75-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 +94 -0
- package/dist/builtin/intercom/package.json +2 -2
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +8 -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 +48 -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
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { BlueprintLayer } from "./build.ts";
|
|
2
|
+
/** The custom message type of the blueprint context a resumed session's first turn carries. */
|
|
3
|
+
export declare const BLUEPRINT_CONTEXT_TYPE = "blueprint-context";
|
|
4
|
+
/**
|
|
5
|
+
* What the agent is told in the first turn of a resumed session: each blueprint's `maintenance` steps and `knowledge`
|
|
6
|
+
* items, labelled with what the build did (ran, or not yet run when it was skipped or partial), and the failing step
|
|
7
|
+
* of a blueprint that failed. Undefined when no blueprint has anything to say, so a project without blueprints adds
|
|
8
|
+
* nothing to the conversation.
|
|
9
|
+
*/
|
|
10
|
+
export declare function renderBlueprintContext(layers: readonly BlueprintLayer[]): string | undefined;
|
|
11
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../src/core/resume/blueprint/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoB,cAAc,EAAuB,MAAM,YAAY,CAAC;AAGxF,+FAA+F;AAC/F,eAAO,MAAM,sBAAsB,sBAAsB,CAAC;AA4F1D;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,cAAc,EAAE,GAAG,MAAM,GAAG,SAAS,CAU5F"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/** The custom message type of the blueprint context a resumed session's first turn carries. */
|
|
2
|
+
export const BLUEPRINT_CONTEXT_TYPE = "blueprint-context";
|
|
3
|
+
const MAX_OUTPUT_LINES = 20;
|
|
4
|
+
const MAX_OUTPUT_CHARACTERS = 1500;
|
|
5
|
+
function describeState(state) {
|
|
6
|
+
switch (state.kind) {
|
|
7
|
+
case "built":
|
|
8
|
+
return state.action === "rebuild"
|
|
9
|
+
? "ran during this resume's build (initialize and maintenance)"
|
|
10
|
+
: "ran during this resume's build: maintenance only, initialize was skipped because this blueprint is unchanged since its last successful build on this machine";
|
|
11
|
+
case "not-run":
|
|
12
|
+
switch (state.reason) {
|
|
13
|
+
case "untrusted":
|
|
14
|
+
return "NOT YET RUN on this machine: the project is not trusted, so the build was skipped";
|
|
15
|
+
case "in-place":
|
|
16
|
+
return "NOT YET RUN on this machine: this checkout is used as it is and no build ran for it";
|
|
17
|
+
case "earlier":
|
|
18
|
+
return "SET UP EARLIER on this machine: a previous resume built this worktree, and maintenance was not run again";
|
|
19
|
+
case "build-failed":
|
|
20
|
+
return "NOT CONFIRMED: the build stopped before it finished (see the failure above), so these steps may not have run";
|
|
21
|
+
case "global-failed":
|
|
22
|
+
return "NOT RUN: the global blueprint failed before this one was built";
|
|
23
|
+
case "skipped":
|
|
24
|
+
return "NOT YET RUN on this machine: the build was skipped";
|
|
25
|
+
}
|
|
26
|
+
return "NOT YET RUN on this machine";
|
|
27
|
+
case "failed":
|
|
28
|
+
return state.section === "maintenance" || state.section === "post-build"
|
|
29
|
+
? "PARTIAL: the build of this blueprint stopped at the failing step below; the maintenance steps before it ran"
|
|
30
|
+
: "NOT RUN: the build of this blueprint failed before its maintenance, see the failing step below";
|
|
31
|
+
case "no-document":
|
|
32
|
+
return "";
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function tailOf(output) {
|
|
36
|
+
const lines = output.trimEnd().split("\n").slice(-MAX_OUTPUT_LINES).join("\n");
|
|
37
|
+
return lines.length > MAX_OUTPUT_CHARACTERS ? lines.slice(lines.length - MAX_OUTPUT_CHARACTERS) : lines;
|
|
38
|
+
}
|
|
39
|
+
function describeFailure(failure) {
|
|
40
|
+
const lines = [`Failure: ${failure.error.message}`];
|
|
41
|
+
if (failure.logPath !== null)
|
|
42
|
+
lines.push(`Build log: ${failure.logPath}`);
|
|
43
|
+
const tail = tailOf(failure.outputTail);
|
|
44
|
+
if (tail !== "")
|
|
45
|
+
lines.push("Output tail:", ...tail.split("\n").map((line) => ` ${line}`));
|
|
46
|
+
return lines;
|
|
47
|
+
}
|
|
48
|
+
function describeSteps(steps) {
|
|
49
|
+
return steps.flatMap((step, index) => [
|
|
50
|
+
` ${index + 1}. ${step.name ?? "maintenance step"}`,
|
|
51
|
+
...step.run
|
|
52
|
+
.trimEnd()
|
|
53
|
+
.split("\n")
|
|
54
|
+
.map((line) => ` ${line}`),
|
|
55
|
+
]);
|
|
56
|
+
}
|
|
57
|
+
function describeDocument(document) {
|
|
58
|
+
const lines = [];
|
|
59
|
+
if (document.maintenance.length > 0)
|
|
60
|
+
lines.push("Maintenance steps:", ...describeSteps(document.maintenance));
|
|
61
|
+
if (document.knowledge.length > 0) {
|
|
62
|
+
lines.push("Knowledge:");
|
|
63
|
+
for (const item of document.knowledge) {
|
|
64
|
+
lines.push(` ${item.name}:`, ...item.contents
|
|
65
|
+
.trimEnd()
|
|
66
|
+
.split("\n")
|
|
67
|
+
.map((line) => ` ${line}`));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return lines;
|
|
71
|
+
}
|
|
72
|
+
function describeLayer(layer) {
|
|
73
|
+
if (layer.state.kind === "no-document")
|
|
74
|
+
return [];
|
|
75
|
+
const header = [
|
|
76
|
+
`scope: ${layer.scope}`,
|
|
77
|
+
`blueprint: ${layer.blueprint}`,
|
|
78
|
+
...(layer.directory === null ? [] : [`workspace: ${layer.directory}`]),
|
|
79
|
+
...(layer.root === null ? [] : [`repository: ${layer.root}`]),
|
|
80
|
+
`state: ${describeState(layer.state)}`,
|
|
81
|
+
];
|
|
82
|
+
const failure = layer.state.kind === "failed" ? describeFailure(layer.state.failure) : [];
|
|
83
|
+
const content = layer.document === undefined ? [] : describeDocument(layer.document);
|
|
84
|
+
if (failure.length === 0 && content.length === 0)
|
|
85
|
+
return [];
|
|
86
|
+
return ["<blueprint>", ...header, ...failure, ...content, "</blueprint>"];
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* What the agent is told in the first turn of a resumed session: each blueprint's `maintenance` steps and `knowledge`
|
|
90
|
+
* items, labelled with what the build did (ran, or not yet run when it was skipped or partial), and the failing step
|
|
91
|
+
* of a blueprint that failed. Undefined when no blueprint has anything to say, so a project without blueprints adds
|
|
92
|
+
* nothing to the conversation.
|
|
93
|
+
*/
|
|
94
|
+
export function renderBlueprintContext(layers) {
|
|
95
|
+
const blocks = layers.flatMap(describeLayer);
|
|
96
|
+
if (blocks.length === 0)
|
|
97
|
+
return undefined;
|
|
98
|
+
return [
|
|
99
|
+
"<blueprint_context>",
|
|
100
|
+
"This session was resumed. The blueprints below (.atomic/blueprint.yaml files) describe how its environment is set up. Maintenance steps are NOT run automatically at session start: re-run the ones you need when dependencies changed or a blueprint says its steps have not run yet. Knowledge items are reference information for this project.",
|
|
101
|
+
"When a blueprint failed or did not run, fix the environment, then update that blueprint in the same change so the next restore succeeds. Never write secrets into a blueprint.",
|
|
102
|
+
...blocks,
|
|
103
|
+
"</blueprint_context>",
|
|
104
|
+
].join("\n");
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../src/core/resume/blueprint/context.ts"],"names":[],"mappings":"AAGA,+FAA+F;AAC/F,MAAM,CAAC,MAAM,sBAAsB,GAAG,mBAAmB,CAAC;AAE1D,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAC5B,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAEnC,SAAS,aAAa,CAAC,KAA0B;IAChD,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,OAAO;YACX,OAAO,KAAK,CAAC,MAAM,KAAK,SAAS;gBAChC,CAAC,CAAC,6DAA6D;gBAC/D,CAAC,CAAC,8JAA8J,CAAC;QACnK,KAAK,SAAS;YACb,QAAQ,KAAK,CAAC,MAAM,EAAE,CAAC;gBACtB,KAAK,WAAW;oBACf,OAAO,mFAAmF,CAAC;gBAC5F,KAAK,UAAU;oBACd,OAAO,qFAAqF,CAAC;gBAC9F,KAAK,SAAS;oBACb,OAAO,0GAA0G,CAAC;gBACnH,KAAK,cAAc;oBAClB,OAAO,8GAA8G,CAAC;gBACvH,KAAK,eAAe;oBACnB,OAAO,gEAAgE,CAAC;gBACzE,KAAK,SAAS;oBACb,OAAO,oDAAoD,CAAC;YAC9D,CAAC;YACD,OAAO,6BAA6B,CAAC;QACtC,KAAK,QAAQ;YACZ,OAAO,KAAK,CAAC,OAAO,KAAK,aAAa,IAAI,KAAK,CAAC,OAAO,KAAK,YA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AAC,EAAE,CAAC,CAAC,CAAC,CAAC,eAAe,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;QAC7D,UAAU,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;KACtC,CAAC;IACF,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1F,MAAM,OAAO,GAAG,KAAK,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,gBAAgB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACrF,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAC5D,OAAO,CAAC,aAAa,EAAE,GAAG,MAAM,EAAE,GAAG,OAAO,EAAE,GAAG,OAAO,EAAE,cAAc,CAAC,CAAC;AAC3E,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAAiC;IACvE,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IAC7C,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAC1C,OAAO;QACN,qBAAqB;QACrB,oVAAoV;QACpV,gLAAgL;QAChL,GAAG,MAAM;QACT,sBAAsB;KACtB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACd,CAAC","sourcesContent":["import type { BlueprintFailure, BlueprintLayer, BlueprintLayerState } from \"./build.ts\";\nimport type { BlueprintDocument, RunStep } from \"./types.ts\";\n\n/** The custom message type of the blueprint context a resumed session's first turn carries. */\nexport const BLUEPRINT_CONTEXT_TYPE = \"blueprint-context\";\n\nconst MAX_OUTPUT_LINES = 20;\nconst MAX_OUTPUT_CHARACTERS = 1500;\n\nfunction describeState(state: BlueprintLayerState): string {\n\tswitch (state.kind) {\n\t\tcase \"built\":\n\t\t\treturn state.action === \"rebuild\"\n\t\t\t\t? \"ran during this resume's build (initialize and maintenance)\"\n\t\t\t\t: \"ran during this resume's build: maintenance only, initialize was skipped because this blueprint is unchanged since its last successful build on this machine\";\n\t\tcase \"not-run\":\n\t\t\tswitch (state.reason) {\n\t\t\t\tcase \"untrusted\":\n\t\t\t\t\treturn \"NOT YET RUN on this machine: the project is not trusted, so the build was skipped\";\n\t\t\t\tcase \"in-place\":\n\t\t\t\t\treturn \"NOT YET RUN on this machine: this checkout is used as it is and no build ran for it\";\n\t\t\t\tcase \"earlier\":\n\t\t\t\t\treturn \"SET UP EARLIER on this machine: a previous resume built this worktree, and maintenance was not run again\";\n\t\t\t\tcase \"build-failed\":\n\t\t\t\t\treturn \"NOT CONFIRMED: the build stopped before it finished (see the failure above), so these steps may not have run\";\n\t\t\t\tcase \"global-failed\":\n\t\t\t\t\treturn \"NOT RUN: the global blueprint failed before this one was built\";\n\t\t\t\tcase \"skipped\":\n\t\t\t\t\treturn \"NOT YET RUN on this machine: the build was skipped\";\n\t\t\t}\n\t\t\treturn \"NOT YET RUN on this machine\";\n\t\tcase \"failed\":\n\t\t\treturn state.section === \"maintenance\" || state.section === \"post-build\"\n\t\t\t\t? \"PARTIAL: the build of this blueprint stopped at the failing step below; the maintenance steps before it ran\"\n\t\t\t\t: \"NOT RUN: the build of this blueprint failed before its maintenance, see the failing step below\";\n\t\tcase \"no-document\":\n\t\t\treturn \"\";\n\t}\n}\n\nfunction tailOf(output: string): string {\n\tconst lines = output.trimEnd().split(\"\\n\").slice(-MAX_OUTPUT_LINES).join(\"\\n\");\n\treturn lines.length > MAX_OUTPUT_CHARACTERS ? lines.slice(lines.length - MAX_OUTPUT_CHARACTERS) : lines;\n}\n\nfunction describeFailure(failure: BlueprintFailure): string[] {\n\tconst lines = [`Failure: ${failure.error.message}`];\n\tif (failure.logPath !== null) lines.push(`Build log: ${failure.logPath}`);\n\tconst tail = tailOf(failure.outputTail);\n\tif (tail !== \"\") lines.push(\"Output tail:\", ...tail.split(\"\\n\").map((line) => ` ${line}`));\n\treturn lines;\n}\n\nfunction describeSteps(steps: readonly RunStep[]): string[] {\n\treturn steps.flatMap((step, index) => [\n\t\t` ${index + 1}. ${step.name ?? \"maintenance step\"}`,\n\t\t...step.run\n\t\t\t.trimEnd()\n\t\t\t.split(\"\\n\")\n\t\t\t.map((line) => ` ${line}`),\n\t]);\n}\n\nfunction describeDocument(document: BlueprintDocument): string[] {\n\tconst lines: string[] = [];\n\tif (document.maintenance.length > 0) lines.push(\"Maintenance steps:\", ...describeSteps(document.maintenance));\n\tif (document.knowledge.length > 0) {\n\t\tlines.push(\"Knowledge:\");\n\t\tfor (const item of document.knowledge) {\n\t\t\tlines.push(\n\t\t\t\t` ${item.name}:`,\n\t\t\t\t...item.contents\n\t\t\t\t\t.trimEnd()\n\t\t\t\t\t.split(\"\\n\")\n\t\t\t\t\t.map((line) => ` ${line}`),\n\t\t\t);\n\t\t}\n\t}\n\treturn lines;\n}\n\nfunction describeLayer(layer: BlueprintLayer): string[] {\n\tif (layer.state.kind === \"no-document\") return [];\n\tconst header = [\n\t\t`scope: ${layer.scope}`,\n\t\t`blueprint: ${layer.blueprint}`,\n\t\t...(layer.directory === null ? [] : [`workspace: ${layer.directory}`]),\n\t\t...(layer.root === null ? [] : [`repository: ${layer.root}`]),\n\t\t`state: ${describeState(layer.state)}`,\n\t];\n\tconst failure = layer.state.kind === \"failed\" ? describeFailure(layer.state.failure) : [];\n\tconst content = layer.document === undefined ? [] : describeDocument(layer.document);\n\tif (failure.length === 0 && content.length === 0) return [];\n\treturn [\"<blueprint>\", ...header, ...failure, ...content, \"</blueprint>\"];\n}\n\n/**\n * What the agent is told in the first turn of a resumed session: each blueprint's `maintenance` steps and `knowledge`\n * items, labelled with what the build did (ran, or not yet run when it was skipped or partial), and the failing step\n * of a blueprint that failed. Undefined when no blueprint has anything to say, so a project without blueprints adds\n * nothing to the conversation.\n */\nexport function renderBlueprintContext(layers: readonly BlueprintLayer[]): string | undefined {\n\tconst blocks = layers.flatMap(describeLayer);\n\tif (blocks.length === 0) return undefined;\n\treturn [\n\t\t\"<blueprint_context>\",\n\t\t\"This session was resumed. The blueprints below (.atomic/blueprint.yaml files) describe how its environment is set up. Maintenance steps are NOT run automatically at session start: re-run the ones you need when dependencies changed or a blueprint says its steps have not run yet. Knowledge items are reference information for this project.\",\n\t\t\"When a blueprint failed or did not run, fix the environment, then update that blueprint in the same change so the next restore succeeds. Never write secrets into a blueprint.\",\n\t\t...blocks,\n\t\t\"</blueprint_context>\",\n\t].join(\"\\n\");\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** `value` as one single-quoted bash word. */
|
|
2
|
+
export declare function shellQuote(value: string): string;
|
|
3
|
+
/** `path` the way bash on `platform` spells it: Git Bash's `/c/...` on Windows, unchanged elsewhere. */
|
|
4
|
+
export declare function bashPathOn(platform: NodeJS.Platform, path: string): string;
|
|
5
|
+
/** `path` the way bash on this platform spells it. */
|
|
6
|
+
export declare function bashPath(path: string): string;
|
|
7
|
+
/** Where the `$ENVRC` of the build that set up the worktree at `root` is kept for the sessions working in it. */
|
|
8
|
+
export declare function sessionEnvrcPath(storeDir: string, root: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* The bash prefix that gives a command the variables the builds of the worktrees at `roots` wrote to `$ENVRC`:
|
|
11
|
+
* undefined when none did. The files are sourced with every assignment exported, as a step sees them.
|
|
12
|
+
*/
|
|
13
|
+
export declare function sessionEnvironmentPrefix(storeDir: string, roots: Iterable<string>): string | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* The environment a process sees after bash sources the `$ENVRC` file at `envrcPath` with every assignment exported,
|
|
16
|
+
* starting from `base`. Used where a step cannot source the file itself: PowerShell and GitHub Actions.
|
|
17
|
+
*/
|
|
18
|
+
export declare function evaluateEnvrc(envrcPath: string, base: NodeJS.ProcessEnv): Promise<NodeJS.ProcessEnv>;
|
|
19
|
+
//# sourceMappingURL=envrc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"envrc.d.ts","sourceRoot":"","sources":["../../../../src/core/resume/blueprint/envrc.ts"],"names":[],"mappings":"AAMA,8CAA8C;AAC9C,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,wGAAwG;AACxG,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAK1E;AAED,sDAAsD;AACtD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED,iHAAiH;AACjH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAGvE;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,MAAM,GAAG,SAAS,CAMtG;AAED;;;GAGG;AACH,wBAAsB,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAsC1G"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
import { existsSync } from "node:fs";
|
|
4
|
+
import { join, resolve, win32 } from "node:path";
|
|
5
|
+
import { getShellConfig } from "../../../utils/shell.js";
|
|
6
|
+
/** `value` as one single-quoted bash word. */
|
|
7
|
+
export function shellQuote(value) {
|
|
8
|
+
return `'${value.replaceAll("'", `'\\''`)}'`;
|
|
9
|
+
}
|
|
10
|
+
/** `path` the way bash on `platform` spells it: Git Bash's `/c/...` on Windows, unchanged elsewhere. */
|
|
11
|
+
export function bashPathOn(platform, path) {
|
|
12
|
+
if (platform !== "win32")
|
|
13
|
+
return path;
|
|
14
|
+
const drive = /^([a-zA-Z]):[\\/]/u.exec(path);
|
|
15
|
+
const normalized = win32.normalize(path).replaceAll("\\", "/");
|
|
16
|
+
return drive === null ? normalized : `/${drive[1].toLowerCase()}${normalized.slice(2)}`;
|
|
17
|
+
}
|
|
18
|
+
/** `path` the way bash on this platform spells it. */
|
|
19
|
+
export function bashPath(path) {
|
|
20
|
+
return bashPathOn(process.platform, path);
|
|
21
|
+
}
|
|
22
|
+
/** Where the `$ENVRC` of the build that set up the worktree at `root` is kept for the sessions working in it. */
|
|
23
|
+
export function sessionEnvrcPath(storeDir, root) {
|
|
24
|
+
const key = createHash("sha256").update(resolve(root)).digest("hex").slice(0, 16);
|
|
25
|
+
return join(storeDir, "blueprint-env", `${key}.envrc`);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The bash prefix that gives a command the variables the builds of the worktrees at `roots` wrote to `$ENVRC`:
|
|
29
|
+
* undefined when none did. The files are sourced with every assignment exported, as a step sees them.
|
|
30
|
+
*/
|
|
31
|
+
export function sessionEnvironmentPrefix(storeDir, roots) {
|
|
32
|
+
const files = [...new Set([...roots].map((root) => sessionEnvrcPath(storeDir, root)))].filter((file) => existsSync(file));
|
|
33
|
+
if (files.length === 0)
|
|
34
|
+
return undefined;
|
|
35
|
+
return ["set -a", ...files.map((file) => `. ${shellQuote(bashPath(file))}`), "set +a"].join("; ");
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The environment a process sees after bash sources the `$ENVRC` file at `envrcPath` with every assignment exported,
|
|
39
|
+
* starting from `base`. Used where a step cannot source the file itself: PowerShell and GitHub Actions.
|
|
40
|
+
*/
|
|
41
|
+
export async function evaluateEnvrc(envrcPath, base) {
|
|
42
|
+
const { shell, args, commandTransport } = getShellConfig();
|
|
43
|
+
const script = [
|
|
44
|
+
"set -ae",
|
|
45
|
+
'. "$1"',
|
|
46
|
+
"set +a",
|
|
47
|
+
process.platform === "win32"
|
|
48
|
+
? 'env -0; atomic_blueprint_native_path=$(cygpath -wp "$PATH"); printf \'PATH=%s\\0\' "$atomic_blueprint_native_path"'
|
|
49
|
+
: "env -0",
|
|
50
|
+
].join("\n");
|
|
51
|
+
const byStdin = commandTransport === "stdin";
|
|
52
|
+
const child = spawn(shell, byStdin ? [...args, "--", bashPath(envrcPath)] : [...args, script, "atomic-blueprint-envrc", bashPath(envrcPath)], { env: base, stdio: [byStdin ? "pipe" : "ignore", "pipe", "pipe"], windowsHide: true });
|
|
53
|
+
if (byStdin)
|
|
54
|
+
child.stdin?.end(script);
|
|
55
|
+
const { stdout, stderr } = child;
|
|
56
|
+
if (stdout === null || stderr === null)
|
|
57
|
+
throw new Error("ENVRC evaluation started without output pipes");
|
|
58
|
+
const chunks = [];
|
|
59
|
+
const errors = [];
|
|
60
|
+
stdout.on("data", (chunk) => chunks.push(chunk));
|
|
61
|
+
stderr.on("data", (chunk) => errors.push(chunk));
|
|
62
|
+
const status = await new Promise((settle, reject) => {
|
|
63
|
+
child.once("error", reject);
|
|
64
|
+
child.once("close", settle);
|
|
65
|
+
});
|
|
66
|
+
if (status !== 0) {
|
|
67
|
+
throw new Error(`Sourcing the ENVRC file failed with status ${status}: ${Buffer.concat(errors).toString("utf8").trim()}`);
|
|
68
|
+
}
|
|
69
|
+
const environment = {};
|
|
70
|
+
for (const entry of Buffer.concat(chunks).toString("utf8").split("\0")) {
|
|
71
|
+
const separator = entry.indexOf("=");
|
|
72
|
+
if (separator > 0)
|
|
73
|
+
environment[entry.slice(0, separator)] = entry.slice(separator + 1);
|
|
74
|
+
}
|
|
75
|
+
return environment;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=envrc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"envrc.js","sourceRoot":"","sources":["../../../../src/core/resume/blueprint/envrc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,M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,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CACxG,CAAC;IACH,CAAC;IACD,MAAM,WAAW,GAAsB,EAAE,CAAC;IAC1C,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QACxE,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACrC,IAAI,SAAS,GAAG,CAAC;YAAE,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;IACxF,CAAC;IACD,OAAO,WAAW,CAAC;AACpB,CAAC","sourcesContent":["import { spawn } from \"node:child_process\";\nimport { createHash } from \"node:crypto\";\nimport { existsSync } from \"node:fs\";\nimport { join, resolve, win32 } from \"node:path\";\nimport { getShellConfig } from \"../../../utils/shell.ts\";\n\n/** `value` as one single-quoted bash word. */\nexport function shellQuote(value: string): string {\n\treturn `'${value.replaceAll(\"'\", `'\\\\''`)}'`;\n}\n\n/** `path` the way bash on `platform` spells it: Git Bash's `/c/...` on Windows, unchanged elsewhere. */\nexport function bashPathOn(platform: NodeJS.Platform, path: string): string {\n\tif (platform !== \"win32\") return path;\n\tconst drive = /^([a-zA-Z]):[\\\\/]/u.exec(path);\n\tconst normalized = win32.normalize(path).replaceAll(\"\\\\\", \"/\");\n\treturn drive === null ? normalized : `/${drive[1]!.toLowerCase()}${normalized.slice(2)}`;\n}\n\n/** `path` the way bash on this platform spells it. */\nexport function bashPath(path: string): string {\n\treturn bashPathOn(process.platform, path);\n}\n\n/** Where the `$ENVRC` of the build that set up the worktree at `root` is kept for the sessions working in it. */\nexport function sessionEnvrcPath(storeDir: string, root: string): string {\n\tconst key = createHash(\"sha256\").update(resolve(root)).digest(\"hex\").slice(0, 16);\n\treturn join(storeDir, \"blueprint-env\", `${key}.envrc`);\n}\n\n/**\n * The bash prefix that gives a command the variables the builds of the worktrees at `roots` wrote to `$ENVRC`:\n * undefined when none did. The files are sourced with every assignment exported, as a step sees them.\n */\nexport function sessionEnvironmentPrefix(storeDir: string, roots: Iterable<string>): string | undefined {\n\tconst files = [...new Set([...roots].map((root) => sessionEnvrcPath(storeDir, root)))].filter((file) =>\n\t\texistsSync(file),\n\t);\n\tif (files.length === 0) return undefined;\n\treturn [\"set -a\", ...files.map((file) => `. ${shellQuote(bashPath(file))}`), \"set +a\"].join(\"; \");\n}\n\n/**\n * The environment a process sees after bash sources the `$ENVRC` file at `envrcPath` with every assignment exported,\n * starting from `base`. Used where a step cannot source the file itself: PowerShell and GitHub Actions.\n */\nexport async function evaluateEnvrc(envrcPath: string, base: NodeJS.ProcessEnv): Promise<NodeJS.ProcessEnv> {\n\tconst { shell, args, commandTransport } = getShellConfig();\n\tconst script = [\n\t\t\"set -ae\",\n\t\t'. \"$1\"',\n\t\t\"set +a\",\n\t\tprocess.platform === \"win32\"\n\t\t\t? 'env -0; atomic_blueprint_native_path=$(cygpath -wp \"$PATH\"); printf \\'PATH=%s\\\\0\\' \"$atomic_blueprint_native_path\"'\n\t\t\t: \"env -0\",\n\t].join(\"\\n\");\n\tconst byStdin = commandTransport === \"stdin\";\n\tconst child = spawn(\n\t\tshell,\n\t\tbyStdin ? [...args, \"--\", bashPath(envrcPath)] : [...args, script, \"atomic-blueprint-envrc\", bashPath(envrcPath)],\n\t\t{ env: base, stdio: [byStdin ? \"pipe\" : \"ignore\", \"pipe\", \"pipe\"], windowsHide: true },\n\t);\n\tif (byStdin) child.stdin?.end(script);\n\tconst { stdout, stderr } = child;\n\tif (stdout === null || stderr === null) throw new Error(\"ENVRC evaluation started without output pipes\");\n\tconst chunks: Buffer[] = [];\n\tconst errors: Buffer[] = [];\n\tstdout.on(\"data\", (chunk: Buffer) => chunks.push(chunk));\n\tstderr.on(\"data\", (chunk: Buffer) => errors.push(chunk));\n\tconst status = await new Promise<number | null>((settle, reject) => {\n\t\tchild.once(\"error\", reject);\n\t\tchild.once(\"close\", settle);\n\t});\n\tif (status !== 0) {\n\t\tthrow new Error(\n\t\t\t`Sourcing the ENVRC file failed with status ${status}: ${Buffer.concat(errors).toString(\"utf8\").trim()}`,\n\t\t);\n\t}\n\tconst environment: NodeJS.ProcessEnv = {};\n\tfor (const entry of Buffer.concat(chunks).toString(\"utf8\").split(\"\\0\")) {\n\t\tconst separator = entry.indexOf(\"=\");\n\t\tif (separator > 0) environment[entry.slice(0, separator)] = entry.slice(separator + 1);\n\t}\n\treturn environment;\n}\n"]}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { type SerializedErrorCause } from "../../error-contract.ts";
|
|
2
|
+
export type BlueprintErrorFieldValue = string | number | boolean | null | readonly BlueprintErrorFieldValue[] | {
|
|
3
|
+
readonly [key: string]: BlueprintErrorFieldValue;
|
|
4
|
+
};
|
|
5
|
+
export type BlueprintErrorFields = {
|
|
6
|
+
readonly [key: string]: BlueprintErrorFieldValue;
|
|
7
|
+
};
|
|
8
|
+
/** Which layer a blueprint belongs to: the global file, a repository root, or an included workspace. */
|
|
9
|
+
export type BlueprintScope = "global" | "repository" | "workspace";
|
|
10
|
+
/** The sections whose steps a build runs. `knowledge` is never run. */
|
|
11
|
+
export type BlueprintSection = "initialize" | "maintenance" | "post-build";
|
|
12
|
+
export type BlueprintInvalidErrorCode = "blueprint-invalid";
|
|
13
|
+
export type BlueprintStepFailedErrorCode = "blueprint-step-failed";
|
|
14
|
+
export type BlueprintStepTimedOutErrorCode = "blueprint-step-timed-out";
|
|
15
|
+
export type BlueprintUsesUnsupportedErrorCode = "blueprint-uses-unsupported";
|
|
16
|
+
export type BlueprintBuildFailedErrorCode = "blueprint-build-failed";
|
|
17
|
+
export type BlueprintErrorCode = BlueprintInvalidErrorCode | BlueprintStepFailedErrorCode | BlueprintStepTimedOutErrorCode | BlueprintUsesUnsupportedErrorCode | BlueprintBuildFailedErrorCode;
|
|
18
|
+
export type BlueprintErrorName = "BlueprintError" | "BlueprintInvalidError" | "BlueprintStepFailedError" | "BlueprintStepTimedOutError" | "BlueprintUsesUnsupportedError" | "BlueprintBuildFailedError";
|
|
19
|
+
/**
|
|
20
|
+
* Why a blueprint file is invalid. `yaml-syntax` is a file that is not YAML; `not-a-mapping` a document that is not a
|
|
21
|
+
* mapping; the rest name the Devin rule that was broken.
|
|
22
|
+
*/
|
|
23
|
+
export type BlueprintInvalidReason = "yaml-syntax" | "not-a-mapping" | "invalid-shell" | "invalid-field" | "uses-in-maintenance" | "run-and-uses" | "missing-run-or-uses" | "with-without-uses" | "invalid-uses-reference" | "duplicate-platform" | "nested-includes" | "include-parent-path" | "duplicate-include" | "post-build-not-global";
|
|
24
|
+
/** Where one step of a blueprint sits, for the errors that name a failing step. */
|
|
25
|
+
export interface BlueprintStepLocation {
|
|
26
|
+
readonly blueprint: string;
|
|
27
|
+
readonly scope: BlueprintScope;
|
|
28
|
+
readonly section: BlueprintSection;
|
|
29
|
+
/** Zero-based position within the section. */
|
|
30
|
+
readonly index: number;
|
|
31
|
+
/** The step's `name`, or `<section> step <n>` when it has none. */
|
|
32
|
+
readonly step: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Base of every failure a blueprint can cause. Resuming never throws these: a build records them in its outcome so a
|
|
36
|
+
* resume continues with a warning. Branch on `code` or the class, never on `message`. `fields` holds the same
|
|
37
|
+
* JSON-safe facts as the typed properties.
|
|
38
|
+
*/
|
|
39
|
+
export declare class BlueprintError extends Error {
|
|
40
|
+
readonly name: BlueprintErrorName;
|
|
41
|
+
readonly code: BlueprintErrorCode;
|
|
42
|
+
readonly hint: string;
|
|
43
|
+
readonly retryable: boolean;
|
|
44
|
+
readonly fields: BlueprintErrorFields;
|
|
45
|
+
constructor(code: BlueprintErrorCode, summary: string, hint: string, fields: BlueprintErrorFields, cause?: Error);
|
|
46
|
+
}
|
|
47
|
+
export interface BlueprintInvalidErrorFields {
|
|
48
|
+
/** The blueprint file. */
|
|
49
|
+
readonly blueprint: string;
|
|
50
|
+
readonly scope: BlueprintScope;
|
|
51
|
+
readonly reason: BlueprintInvalidReason;
|
|
52
|
+
/** The rule that was broken: Devin's own wording for the rules it words, else a short description. */
|
|
53
|
+
readonly rule: string;
|
|
54
|
+
/** The section, include entry or field that broke it, when there is one. */
|
|
55
|
+
readonly subject: string | null;
|
|
56
|
+
}
|
|
57
|
+
/** A blueprint file breaks the schema or a validation rule. The blueprint's setup is skipped; the resume continues. */
|
|
58
|
+
export declare class BlueprintInvalidError extends BlueprintError {
|
|
59
|
+
readonly name: "BlueprintInvalidError";
|
|
60
|
+
readonly code: BlueprintInvalidErrorCode;
|
|
61
|
+
readonly blueprint: string;
|
|
62
|
+
readonly scope: BlueprintScope;
|
|
63
|
+
readonly reason: BlueprintInvalidReason;
|
|
64
|
+
readonly rule: string;
|
|
65
|
+
readonly subject: string | null;
|
|
66
|
+
constructor(fields: BlueprintInvalidErrorFields, cause?: Error);
|
|
67
|
+
}
|
|
68
|
+
export interface BlueprintStepFailedErrorFields extends BlueprintStepLocation {
|
|
69
|
+
readonly exitStatus: number | null;
|
|
70
|
+
readonly signal: string | null;
|
|
71
|
+
/** The step's captured output; null when its log could not be created, so the step was not started. */
|
|
72
|
+
readonly logPath: string | null;
|
|
73
|
+
}
|
|
74
|
+
/** A step exited non-zero, was stopped by a signal or could not be started. The rest of its blueprint did not run. */
|
|
75
|
+
export declare class BlueprintStepFailedError extends BlueprintError {
|
|
76
|
+
readonly name: "BlueprintStepFailedError";
|
|
77
|
+
readonly code: BlueprintStepFailedErrorCode;
|
|
78
|
+
readonly blueprint: string;
|
|
79
|
+
readonly scope: BlueprintScope;
|
|
80
|
+
readonly section: BlueprintSection;
|
|
81
|
+
readonly index: number;
|
|
82
|
+
readonly step: string;
|
|
83
|
+
readonly exitStatus: number | null;
|
|
84
|
+
readonly signal: string | null;
|
|
85
|
+
readonly logPath: string | null;
|
|
86
|
+
constructor(fields: BlueprintStepFailedErrorFields, cause?: Error);
|
|
87
|
+
}
|
|
88
|
+
export interface BlueprintStepTimedOutErrorFields extends BlueprintStepLocation {
|
|
89
|
+
readonly logPath: string;
|
|
90
|
+
readonly timeoutMs: number;
|
|
91
|
+
readonly elapsedMs: number;
|
|
92
|
+
/** The section that was running. */
|
|
93
|
+
readonly phase: BlueprintSection;
|
|
94
|
+
}
|
|
95
|
+
/** A step did not finish within its timeout (3 hours) and was stopped. The rest of its blueprint did not run. */
|
|
96
|
+
export declare class BlueprintStepTimedOutError extends BlueprintError {
|
|
97
|
+
readonly name: "BlueprintStepTimedOutError";
|
|
98
|
+
readonly code: BlueprintStepTimedOutErrorCode;
|
|
99
|
+
readonly blueprint: string;
|
|
100
|
+
readonly scope: BlueprintScope;
|
|
101
|
+
readonly section: BlueprintSection;
|
|
102
|
+
readonly index: number;
|
|
103
|
+
readonly step: string;
|
|
104
|
+
readonly logPath: string;
|
|
105
|
+
readonly timeoutMs: number;
|
|
106
|
+
readonly elapsedMs: number;
|
|
107
|
+
readonly phase: BlueprintSection;
|
|
108
|
+
constructor(fields: BlueprintStepTimedOutErrorFields, cause?: Error);
|
|
109
|
+
}
|
|
110
|
+
/** Why a `uses` step cannot run here. */
|
|
111
|
+
export type BlueprintUsesUnsupportedReason = "docker-action" | "unknown-action-type" | "action-not-found" | "action-fetch-failed" | "action-metadata-invalid" | "node-unavailable" | "required-input-missing" | "unsupported-expression";
|
|
112
|
+
export interface BlueprintUsesUnsupportedErrorFields extends BlueprintStepLocation {
|
|
113
|
+
/** The `github.com/<owner>/<repo>[/<subpath>]@<ref>` reference. */
|
|
114
|
+
readonly uses: string;
|
|
115
|
+
readonly reason: BlueprintUsesUnsupportedReason;
|
|
116
|
+
/** A short, credential-free explanation. */
|
|
117
|
+
readonly detail: string;
|
|
118
|
+
readonly logPath: string;
|
|
119
|
+
}
|
|
120
|
+
/** A `uses` step names an action that Atomic cannot run (Docker, or one it cannot fetch or read). */
|
|
121
|
+
export declare class BlueprintUsesUnsupportedError extends BlueprintError {
|
|
122
|
+
readonly name: "BlueprintUsesUnsupportedError";
|
|
123
|
+
readonly code: BlueprintUsesUnsupportedErrorCode;
|
|
124
|
+
readonly blueprint: string;
|
|
125
|
+
readonly scope: BlueprintScope;
|
|
126
|
+
readonly section: BlueprintSection;
|
|
127
|
+
readonly index: number;
|
|
128
|
+
readonly step: string;
|
|
129
|
+
readonly uses: string;
|
|
130
|
+
readonly reason: BlueprintUsesUnsupportedReason;
|
|
131
|
+
readonly detail: string;
|
|
132
|
+
readonly logPath: string;
|
|
133
|
+
constructor(fields: BlueprintUsesUnsupportedErrorFields, cause?: Error);
|
|
134
|
+
}
|
|
135
|
+
/** What a build was doing when it failed for a reason that is not a step. */
|
|
136
|
+
export type BlueprintBuildPhase = "read-blueprint" | "ledger" | "environment" | "unknown";
|
|
137
|
+
export interface BlueprintBuildFailedErrorFields {
|
|
138
|
+
readonly phase: BlueprintBuildPhase;
|
|
139
|
+
/** A short, credential-free explanation. */
|
|
140
|
+
readonly detail: string;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* The build machinery itself failed (a blueprint file or the build ledger could not be read or written), not a step.
|
|
144
|
+
* The resume continues without the build.
|
|
145
|
+
*/
|
|
146
|
+
export declare class BlueprintBuildFailedError extends BlueprintError {
|
|
147
|
+
readonly name: "BlueprintBuildFailedError";
|
|
148
|
+
readonly code: BlueprintBuildFailedErrorCode;
|
|
149
|
+
readonly phase: BlueprintBuildPhase;
|
|
150
|
+
readonly detail: string;
|
|
151
|
+
constructor(fields: BlueprintBuildFailedErrorFields, cause?: Error);
|
|
152
|
+
}
|
|
153
|
+
export declare function isBlueprintError(value: unknown): value is BlueprintError;
|
|
154
|
+
export declare function isBlueprintInvalidError(value: unknown): value is BlueprintInvalidError;
|
|
155
|
+
export declare function isBlueprintStepFailedError(value: unknown): value is BlueprintStepFailedError;
|
|
156
|
+
export declare function isBlueprintStepTimedOutError(value: unknown): value is BlueprintStepTimedOutError;
|
|
157
|
+
export declare function isBlueprintUsesUnsupportedError(value: unknown): value is BlueprintUsesUnsupportedError;
|
|
158
|
+
export declare function isBlueprintBuildFailedError(value: unknown): value is BlueprintBuildFailedError;
|
|
159
|
+
/** The first error in `error`'s cause chain, itself included, that `guard` accepts. */
|
|
160
|
+
export declare function findBlueprintError<T extends BlueprintError>(error: unknown, guard?: (value: unknown) => value is T): T | undefined;
|
|
161
|
+
/** A {@link BlueprintError} as it crosses a worker, RPC or broker boundary. */
|
|
162
|
+
export interface SerializedBlueprintError {
|
|
163
|
+
readonly name: string;
|
|
164
|
+
readonly code: string;
|
|
165
|
+
readonly message: string;
|
|
166
|
+
readonly hint: string;
|
|
167
|
+
readonly retryable: boolean;
|
|
168
|
+
readonly fields: BlueprintErrorFields;
|
|
169
|
+
readonly cause?: SerializedErrorCause;
|
|
170
|
+
}
|
|
171
|
+
/** The JSON form of `error`, with its cause chain bounded and free of stack traces. */
|
|
172
|
+
export declare function serializeBlueprintError(error: BlueprintError): SerializedBlueprintError;
|
|
173
|
+
/**
|
|
174
|
+
* The error {@link serializeBlueprintError} produced, rebuilt after it crossed a process boundary as the same class.
|
|
175
|
+
* An unknown `name` or `code` rebuilds it as a {@link BlueprintError} that keeps the original `name`, `code`,
|
|
176
|
+
* `message`, `hint`, `retryable` and `fields`.
|
|
177
|
+
*/
|
|
178
|
+
export declare function rehydrateBlueprintError(form: SerializedBlueprintError, cause?: Error): BlueprintError;
|
|
179
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../src/core/resume/blueprint/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,KAAK,oBAAoB,EAEzB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,MAAM,wBAAwB,GACjC,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,wBAAwB,EAAE,GAC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,CAAC,GAAG,SAAS,CAEf;AAED,+EAA+E;AAC/E,MAAM,WAAW,wBAAwB;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAC;IACtC,QAAQ,CAAC,KAAK,CAAC,EAAE,oBAAoB,CAAC;CACtC;AAED,uFAAuF;AACvF,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,cAAc,GAAG,wBAAwB,CAWvF;AAgBD;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,wBAAwB,EAAE,KAAK,CAAC,EAAE,KAAK,GAAG,cAAc,CAqBrG"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { findInCauseChain, rehydrateErrorCause, serializeErrorCause, } from "../../error-contract.js";
|
|
2
|
+
/**
|
|
3
|
+
* Base of every failure a blueprint can cause. Resuming never throws these: a build records them in its outcome so a
|
|
4
|
+
* resume continues with a warning. Branch on `code` or the class, never on `message`. `fields` holds the same
|
|
5
|
+
* JSON-safe facts as the typed properties.
|
|
6
|
+
*/
|
|
7
|
+
export class BlueprintError extends Error {
|
|
8
|
+
name = "BlueprintError";
|
|
9
|
+
code;
|
|
10
|
+
hint;
|
|
11
|
+
retryable = false;
|
|
12
|
+
fields;
|
|
13
|
+
constructor(code, summary, hint, fields, cause) {
|
|
14
|
+
super(`${summary} (${code}). ${hint}`, cause === undefined ? undefined : { cause });
|
|
15
|
+
this.code = code;
|
|
16
|
+
this.hint = hint;
|
|
17
|
+
this.fields = Object.freeze({ ...fields });
|
|
18
|
+
Object.assign(this, fields);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/** A blueprint file breaks the schema or a validation rule. The blueprint's setup is skipped; the resume continues. */
|
|
22
|
+
export class BlueprintInvalidError extends BlueprintError {
|
|
23
|
+
name = "BlueprintInvalidError";
|
|
24
|
+
constructor(fields, cause) {
|
|
25
|
+
super("blueprint-invalid", `The ${fields.scope} blueprint ${fields.blueprint} is invalid: ${fields.rule}${fields.subject === null ? "" : ` (${fields.subject})`}`, "Fix the blueprint; the next build picks the change up.", { ...fields }, cause);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/** A step exited non-zero, was stopped by a signal or could not be started. The rest of its blueprint did not run. */
|
|
29
|
+
export class BlueprintStepFailedError extends BlueprintError {
|
|
30
|
+
name = "BlueprintStepFailedError";
|
|
31
|
+
constructor(fields, cause) {
|
|
32
|
+
const outcome = fields.signal !== null
|
|
33
|
+
? `was stopped by ${fields.signal}`
|
|
34
|
+
: fields.exitStatus === null
|
|
35
|
+
? "could not be started"
|
|
36
|
+
: `exited with status ${fields.exitStatus}`;
|
|
37
|
+
super("blueprint-step-failed", `The ${fields.section} step "${fields.step}" of the ${fields.scope} blueprint ${fields.blueprint} ${outcome}`, fields.logPath === null
|
|
38
|
+
? "Make the build directory under the agent directory writable, then the next build runs the step again."
|
|
39
|
+
: `Check the build log ${fields.logPath} for the exact error, then fix the environment and the blueprint; the next build runs it again.`, { ...fields }, cause);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/** A step did not finish within its timeout (3 hours) and was stopped. The rest of its blueprint did not run. */
|
|
43
|
+
export class BlueprintStepTimedOutError extends BlueprintError {
|
|
44
|
+
name = "BlueprintStepTimedOutError";
|
|
45
|
+
constructor(fields, cause) {
|
|
46
|
+
super("blueprint-step-timed-out", `The ${fields.section} step "${fields.step}" of the ${fields.scope} blueprint ${fields.blueprint} did not finish within ${fields.timeoutMs} ms`, `Check the build log ${fields.logPath}, make the step finish sooner or non-interactive, then fix the blueprint; the next build runs it again.`, { ...fields }, cause);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const USES_REMEDIATION = {
|
|
50
|
+
"docker-action": "Replace the action with a `run` step, or use a Node.js or composite action",
|
|
51
|
+
"unknown-action-type": "Replace the action with a `run` step, or use a Node.js or composite action",
|
|
52
|
+
"required-input-missing": "Add the missing input under `with`",
|
|
53
|
+
"action-not-found": "Check the `github.com/<owner>/<repo>@<ref>` reference and that the action has an action.yml",
|
|
54
|
+
"action-fetch-failed": "Check the `github.com/<owner>/<repo>@<ref>` reference and the network access to GitHub",
|
|
55
|
+
"action-metadata-invalid": "Pin a ref whose action.yml is valid",
|
|
56
|
+
"node-unavailable": "Install Node.js and put it on PATH",
|
|
57
|
+
"unsupported-expression": "Pass the value through `with` instead of the unsupported expression, or use a `run` step",
|
|
58
|
+
};
|
|
59
|
+
/** A `uses` step names an action that Atomic cannot run (Docker, or one it cannot fetch or read). */
|
|
60
|
+
export class BlueprintUsesUnsupportedError extends BlueprintError {
|
|
61
|
+
name = "BlueprintUsesUnsupportedError";
|
|
62
|
+
constructor(fields, cause) {
|
|
63
|
+
super("blueprint-uses-unsupported", `The ${fields.section} step "${fields.step}" of the ${fields.scope} blueprint ${fields.blueprint} cannot run ${fields.uses}: ${fields.detail}`, `${USES_REMEDIATION[fields.reason]}; details are in ${fields.logPath}.`, { ...fields }, cause);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const PHASE_ACTIVITY = {
|
|
67
|
+
"read-blueprint": "reading a blueprint",
|
|
68
|
+
ledger: "reading or writing the build ledger",
|
|
69
|
+
environment: "preparing the build environment",
|
|
70
|
+
unknown: "running",
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* The build machinery itself failed (a blueprint file or the build ledger could not be read or written), not a step.
|
|
74
|
+
* The resume continues without the build.
|
|
75
|
+
*/
|
|
76
|
+
export class BlueprintBuildFailedError extends BlueprintError {
|
|
77
|
+
name = "BlueprintBuildFailedError";
|
|
78
|
+
constructor(fields, cause) {
|
|
79
|
+
super("blueprint-build-failed", `The blueprint build stopped while ${PHASE_ACTIVITY[fields.phase]}: ${fields.detail}`, "Check that the agent directory is readable and writable; the next resume builds again.", { ...fields }, cause);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const CODES = {
|
|
83
|
+
BlueprintError: [],
|
|
84
|
+
BlueprintInvalidError: ["blueprint-invalid"],
|
|
85
|
+
BlueprintStepFailedError: ["blueprint-step-failed"],
|
|
86
|
+
BlueprintStepTimedOutError: ["blueprint-step-timed-out"],
|
|
87
|
+
BlueprintUsesUnsupportedError: ["blueprint-uses-unsupported"],
|
|
88
|
+
BlueprintBuildFailedError: ["blueprint-build-failed"],
|
|
89
|
+
};
|
|
90
|
+
const ALL_CODES = new Set(Object.values(CODES).flat());
|
|
91
|
+
function structurallyIs(value, name) {
|
|
92
|
+
if (typeof value !== "object" || value === null)
|
|
93
|
+
return false;
|
|
94
|
+
const candidate = value;
|
|
95
|
+
if (name === "BlueprintError") {
|
|
96
|
+
return (typeof candidate.name === "string" &&
|
|
97
|
+
candidate.name in CODES &&
|
|
98
|
+
ALL_CODES.has(candidate.code));
|
|
99
|
+
}
|
|
100
|
+
return candidate.name === name && CODES[name].includes(candidate.code);
|
|
101
|
+
}
|
|
102
|
+
export function isBlueprintError(value) {
|
|
103
|
+
return value instanceof BlueprintError || structurallyIs(value, "BlueprintError");
|
|
104
|
+
}
|
|
105
|
+
export function isBlueprintInvalidError(value) {
|
|
106
|
+
return value instanceof BlueprintInvalidError || structurallyIs(value, "BlueprintInvalidError");
|
|
107
|
+
}
|
|
108
|
+
export function isBlueprintStepFailedError(value) {
|
|
109
|
+
return value instanceof BlueprintStepFailedError || structurallyIs(value, "BlueprintStepFailedError");
|
|
110
|
+
}
|
|
111
|
+
export function isBlueprintStepTimedOutError(value) {
|
|
112
|
+
return value instanceof BlueprintStepTimedOutError || structurallyIs(value, "BlueprintStepTimedOutError");
|
|
113
|
+
}
|
|
114
|
+
export function isBlueprintUsesUnsupportedError(value) {
|
|
115
|
+
return value instanceof BlueprintUsesUnsupportedError || structurallyIs(value, "BlueprintUsesUnsupportedError");
|
|
116
|
+
}
|
|
117
|
+
export function isBlueprintBuildFailedError(value) {
|
|
118
|
+
return value instanceof BlueprintBuildFailedError || structurallyIs(value, "BlueprintBuildFailedError");
|
|
119
|
+
}
|
|
120
|
+
/** The first error in `error`'s cause chain, itself included, that `guard` accepts. */
|
|
121
|
+
export function findBlueprintError(error, guard = isBlueprintError) {
|
|
122
|
+
return findInCauseChain(error, guard);
|
|
123
|
+
}
|
|
124
|
+
/** The JSON form of `error`, with its cause chain bounded and free of stack traces. */
|
|
125
|
+
export function serializeBlueprintError(error) {
|
|
126
|
+
const cause = serializeErrorCause(error.cause);
|
|
127
|
+
return {
|
|
128
|
+
name: error.name,
|
|
129
|
+
code: error.code,
|
|
130
|
+
message: error.message,
|
|
131
|
+
hint: error.hint,
|
|
132
|
+
retryable: error.retryable,
|
|
133
|
+
fields: error.fields,
|
|
134
|
+
...(cause === undefined ? {} : { cause }),
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
const REHYDRATORS = {
|
|
138
|
+
BlueprintInvalidError: (fields, cause) => new BlueprintInvalidError(fields, cause),
|
|
139
|
+
BlueprintStepFailedError: (fields, cause) => new BlueprintStepFailedError(fields, cause),
|
|
140
|
+
BlueprintStepTimedOutError: (fields, cause) => new BlueprintStepTimedOutError(fields, cause),
|
|
141
|
+
BlueprintUsesUnsupportedError: (fields, cause) => new BlueprintUsesUnsupportedError(fields, cause),
|
|
142
|
+
BlueprintBuildFailedError: (fields, cause) => new BlueprintBuildFailedError(fields, cause),
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* The error {@link serializeBlueprintError} produced, rebuilt after it crossed a process boundary as the same class.
|
|
146
|
+
* An unknown `name` or `code` rebuilds it as a {@link BlueprintError} that keeps the original `name`, `code`,
|
|
147
|
+
* `message`, `hint`, `retryable` and `fields`.
|
|
148
|
+
*/
|
|
149
|
+
export function rehydrateBlueprintError(form, cause) {
|
|
150
|
+
const rebuiltCause = cause ?? rehydrateErrorCause(form.cause);
|
|
151
|
+
const name = form.name;
|
|
152
|
+
if (name !== "BlueprintError" &&
|
|
153
|
+
Object.hasOwn(REHYDRATORS, name) &&
|
|
154
|
+
CODES[name].includes(form.code)) {
|
|
155
|
+
return REHYDRATORS[name](form.fields, rebuiltCause);
|
|
156
|
+
}
|
|
157
|
+
const error = Object.create(BlueprintError.prototype);
|
|
158
|
+
Object.defineProperties(error, {
|
|
159
|
+
name: { value: form.name, enumerable: false, configurable: true },
|
|
160
|
+
message: { value: form.message, enumerable: false, configurable: true },
|
|
161
|
+
code: { value: form.code, enumerable: true },
|
|
162
|
+
hint: { value: form.hint, enumerable: true },
|
|
163
|
+
retryable: { value: form.retryable, enumerable: true },
|
|
164
|
+
fields: { value: Object.freeze({ ...form.fields }), enumerable: true },
|
|
165
|
+
...(rebuiltCause === undefined ? {} : { cause: { value: rebuiltCause, enumerable: false, configurable: true } }),
|
|
166
|
+
});
|
|
167
|
+
return error;
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=errors.js.map
|