@bastani/atomic 0.9.74 → 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 +68 -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 +32 -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":"rpc-types.js","sourceRoot":"","sources":["../../../src/modes/rpc/rpc-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG","sourcesContent":["/**\n * RPC protocol types for headless operation.\n *\n * Commands are sent as JSON lines on stdin.\n * Responses and events are emitted as JSON lines on stdout.\n */\n\nimport type {\n\tAuthInfoLink,\n\tCredential,\n\tOAuthAuthInfo,\n\tOAuthDeviceCodeInfo,\n\tOAuthPrompt,\n\tOAuthSelectPrompt,\n} from \"@bastani/pi-ai\";\nimport type { Api, ImageContent, Model } from \"@bastani/pi-ai/compat\";\nimport type { AgentMessage, ThinkingLevel } from \"@earendil-works/pi-agent-core\";\nimport type {\n\tClearedQueue,\n\tCompactionReason,\n\tPromptDisposition,\n\tQueuedInputDisposition,\n\tSessionRecoveryReport,\n\tSessionStats,\n} from \"../../core/agent-session.js\";\nimport type { BashResult } from \"../../core/bash-executor.ts\";\nimport type { SerializedBackgroundCompactionState } from \"../../core/compaction/background-compaction.ts\";\nimport type { SerializedBackgroundCompactionError } from \"../../core/compaction/background-compaction-errors.ts\";\nimport type { VerbatimCompactionResult } from \"../../core/compaction/index.ts\";\nimport type { SerializedDebugError } from \"../../core/debug-errors.ts\";\nimport type { ResourceOverlap } from \"../../core/diagnostics.ts\";\nimport type { SessionRecoveryReason } from \"../../core/extensions/index.js\";\nimport type {\n\tWorkflowRunDetail,\n\tWorkflowRunFilterStatus,\n\tWorkflowRunSummary,\n} from \"../../core/extensions/workflow-run-control.js\";\nimport type { ModelFallbackReason } from \"../../core/model-resolver-types.ts\";\nimport type { CredentialSynchronizationOperation } from \"../../core/model-runtime.js\";\nimport type { OAuthProviderMetadata } from \"../../core/oauth-login.ts\";\nimport type { AuthStatus } from \"../../core/provider-composer.ts\";\nimport type { SessionEntry, SessionInfo, SessionSummaryEntry, SessionTreeNode } from \"../../core/session-manager.ts\";\nimport type { SourceInfo } from \"../../core/source-info.ts\";\nimport type { ToolStatusReport } from \"../../core/tool-status.js\";\nimport type { QuestionAnswer, QuestionParams } from \"../../core/tools/ask-user-question/tool/types.js\";\nimport type { JsonAgentSessionEvent } from \"../json-event.ts\";\n\n// ============================================================================\n// RPC Commands (stdin)\n// ============================================================================\n\nexport interface RpcModelCatalog {\n\tmodels: Model<Api>[];\n\tscopedModels: Array<{ model: Model<Api>; thinkingLevel?: ThinkingLevel }>;\n\t/** Extension-registered providers that offer API-key login (`login_provider`). */\n\tcustomAuthProviders: Array<{ id: string; name: string }>;\n\toauthProviders?: OAuthProviderMetadata[];\n\t/** Auth status of extension-registered providers that is not a stored credential (environment, configured key, runtime key). */\n\tproviderAuthStatuses?: Array<{ provider: string; status: AuthStatus }>;\n}\n\nexport interface RpcModelRefreshResult extends RpcModelCatalog {\n\taborted: boolean;\n\terrors: Array<{ provider: string; message: string }>;\n}\n/**\n * The host supplied the API key through the login input form, so echoing it\n * back over the stdout pipe would make this response a second credential\n * egress. Only the metadata a caller needs to confirm the login travels.\n */\nexport type RpcLoginProviderResult =\n\t| (RpcModelCatalog & {\n\t\t\tprovider: string;\n\t\t\tcancelled: false;\n\t\t\ttype: \"api_key\";\n\t })\n\t| { provider: string; cancelled: true };\n\nexport type RpcOAuthLoginProviderResult =\n\t| (RpcModelCatalog & { provider: string; cancelled: false })\n\t| { provider: string; cancelled: true };\n\nexport type RpcSessionInfo = Omit<SessionInfo, \"created\" | \"modified\"> & {\n\tcreated: string;\n\tmodified: string;\n};\n\nexport type RpcCommand =\n\t// Prompting\n\t| { id?: string; type: \"prompt\"; message: string; images?: ImageContent[]; streamingBehavior?: \"steer\" | \"followUp\" }\n\t| { id?: string; type: \"steer\"; message: string; images?: ImageContent[] }\n\t| { id?: string; type: \"follow_up\"; message: string; images?: ImageContent[] }\n\t| { id?: string; type: \"abort\" }\n\t| { id?: string; type: \"new_session\"; parentSession?: string }\n\t| { id?: string; type: \"delete_session\"; sessionId?: string }\n\n\t// State\n\t| { id?: string; type: \"get_state\" }\n\t| { id?: string; type: \"get_session_summary\" }\n\t| { id?: string; type: \"list_sessions\" }\n\t| { id?: string; type: \"list_workflow_runs\"; status?: WorkflowRunFilterStatus }\n\t| { id?: string; type: \"get_workflow_run_summary\"; runId: string }\n\t| { id?: string; type: \"open_task_inspector\"; taskId?: string }\n\n\t// Model\n\t| { id?: string; type: \"set_model\"; provider: string; modelId: string; persist?: boolean }\n\t| { id?: string; type: \"cycle_model\"; direction?: \"forward\" | \"backward\"; persist?: boolean }\n\t| { id?: string; type: \"get_available_models\"; allowPartialResources?: boolean }\n\t| { id?: string; type: \"login_provider\"; provider: string; authType?: \"api_key\" | \"oauth\"; loginId?: string }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"save_provider_credential\";\n\t\t\tprovider: string;\n\t\t\tcredential: Credential;\n\t\t\t/** Fetch the remote catalog before publishing the credential. Defaults to true. */\n\t\t\trefreshCatalog?: boolean;\n\t }\n\t| { id?: string; type: \"cancel_login_provider\"; provider: string; loginId?: string }\n\t| { id?: string; type: \"logout_provider\"; provider: string }\n\t| { id?: string; type: \"refresh_models\"; timeoutMs?: number; force?: boolean; allowNetwork?: boolean }\n\n\t// Thinking\n\t| { id?: string; type: \"set_thinking_level\"; level: ThinkingLevel; persist?: boolean }\n\t| { id?: string; type: \"cycle_thinking_level\" }\n\t| { id?: string; type: \"get_available_thinking_levels\" }\n\n\t// Queue modes\n\t| { id?: string; type: \"set_steering_mode\"; mode: \"all\" | \"one-at-a-time\" }\n\t| { id?: string; type: \"set_follow_up_mode\"; mode: \"all\" | \"one-at-a-time\" }\n\n\t// Compaction\n\t| { id?: string; type: \"compact\" }\n\t| { id?: string; type: \"set_auto_compaction\"; enabled: boolean }\n\t| { id?: string; type: \"set_background_compaction\"; enabled: boolean }\n\t| { id?: string; type: \"set_background_compaction_threshold\"; percent: number }\n\t| { id?: string; type: \"abort_compaction\" }\n\n\t// Extension UI\n\t| { id?: string; type: \"set_extension_ui_capabilities\"; questionnaire?: boolean }\n\n\t// Debug\n\t| { id?: string; type: \"set_debug\"; enabled: boolean }\n\n\t// Retry\n\t| { id?: string; type: \"set_auto_retry\"; enabled: boolean }\n\t| { id?: string; type: \"abort_retry\" }\n\t| { id?: string; type: \"clear_queue\" }\n\t| { id?: string; type: \"pause_queued_messages\" }\n\t| { id?: string; type: \"resume_queued_messages\" }\n\n\t// Bash\n\t| { id?: string; type: \"bash\"; command: string; excludeFromContext?: boolean }\n\t| { id?: string; type: \"user_bash\"; command: string; excludeFromContext?: boolean }\n\t| { id?: string; type: \"abort_bash\"; requestId?: string }\n\n\t// Session\n\t| { id?: string; type: \"get_session_stats\" }\n\t| { id?: string; type: \"get_tools\" }\n\t| { id?: string; type: \"export_html\"; outputPath?: string }\n\t| { id?: string; type: \"switch_session\"; sessionId: string; cwdOverride?: string; sessionDirectory?: string }\n\t| { id?: string; type: \"import_session\"; inputPath: string; cwdOverride?: string }\n\t| { id?: string; type: \"fork\"; entryId: string }\n\t| { id?: string; type: \"clone\" }\n\t| { id?: string; type: \"get_fork_messages\" }\n\t| { id?: string; type: \"get_entries\"; since?: string }\n\t| { id?: string; type: \"get_tree\" }\n\t| { id?: string; type: \"get_last_assistant_text\" }\n\t| { id?: string; type: \"set_session_name\"; name: string }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"navigate_tree\";\n\t\t\ttargetId: string;\n\t\t\toptions?: { summarize?: boolean; customInstructions?: string; replaceInstructions?: boolean; label?: string };\n\t }\n\t| { id?: string; type: \"set_label\"; entryId: string; label?: string }\n\t| { id?: string; type: \"reload\" }\n\t| { id?: string; type: \"start_pending_recovery\"; reason?: SessionRecoveryReason }\n\t| { id?: string; type: \"get_shortcuts\" }\n\t| { id?: string; type: \"invoke_shortcut\"; key: string }\n\n\t// Messages\n\t| { id?: string; type: \"get_messages\" }\n\n\t// Commands and their live argument completions\n\t| { id?: string; type: \"get_commands\" }\n\t| { id?: string; type: \"get_command_completions\"; commandName: string; argumentPrefix: string };\n// ============================================================================\n// RPC Argument Completion\n// ============================================================================\n\nexport interface RpcAutocompleteItem {\n\tvalue: string;\n\tlabel: string;\n\tdescription?: string;\n}\n\n// RPC Slash Command (for get_commands response)\n// ============================================================================\n\n/** A command available for invocation via prompt */\nexport interface RpcSlashCommand {\n\t/** Command name (without leading slash) */\n\tname: string;\n\t/** Human-readable description */\n\tdescription?: string;\n\t/** Whether the engine can evaluate argument completions for this command. */\n\thasArgumentCompletions?: boolean;\n\t/** What kind of command this is */\n\tsource: \"extension\" | \"prompt\" | \"skill\";\n\t/** Source metadata for the owning resource */\n\tsourceInfo: SourceInfo;\n}\n\n// ============================================================================\n// RPC State\n// ============================================================================\n\nexport interface RpcResourceExtension {\n\tpath: string;\n\tsourceInfo?: SourceInfo;\n\thidden: boolean;\n}\n\nexport interface RpcSessionState {\n\tmodel?: Model<Api>;\n\tmodelFallbackMessage?: string;\n\tmodelFallbackReason?: ModelFallbackReason;\n\tthinkingLevel: ThinkingLevel;\n\tisStreaming: boolean;\n\tisCompacting: boolean;\n\tcompactionReason?: CompactionReason;\n\tsteeringMode: \"all\" | \"one-at-a-time\";\n\tfollowUpMode: \"all\" | \"one-at-a-time\";\n\tsessionLocation?: string;\n\tsessionId: string;\n\tsessionName?: string;\n\tautoCompactionEnabled: boolean;\n\t/** Background compaction state (#4330), the same shape workflow stage status carries. */\n\tcompaction: SerializedBackgroundCompactionState;\n\tbackgroundCompactionEnabled: boolean;\n\tbackgroundCompactionThresholdPercent: number;\n\tmessageCount: number;\n\tpendingMessageCount: number;\n\tqueuedMessagesPaused: boolean;\n\t/** Authoritative engine trust state; absent on older RPC peers. */\n\tprojectTrusted?: boolean;\n\tresourceOverlaps?: ResourceOverlap[];\n\tresourceExtensions?: RpcResourceExtension[];\n}\n\nexport interface RpcLogoutProviderResult {\n\tprovider: string;\n\tauthStatus: AuthStatus;\n\tmodels: Model<Api>[];\n\tscopedModels?: Array<{ model: Model<Api>; thinkingLevel?: ThinkingLevel }>;\n}\n\n// ============================================================================\n// RPC Responses (stdout)\n// ============================================================================\n\n// Success responses with data\nexport type RpcResponse =\n\t// Prompting\n\t| { id?: string; type: \"response\"; command: \"prompt\"; success: true; data: { disposition: PromptDisposition } }\n\t| { id?: string; type: \"response\"; command: \"steer\"; success: true; data: { disposition: QueuedInputDisposition } }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"follow_up\";\n\t\t\tsuccess: true;\n\t\t\tdata: { disposition: QueuedInputDisposition };\n\t }\n\t| { id?: string; type: \"response\"; command: \"abort\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"new_session\"; success: true; data: { cancelled: boolean } }\n\t| { id?: string; type: \"response\"; command: \"delete_session\"; success: true }\n\n\t// State\n\t| { id?: string; type: \"response\"; command: \"get_state\"; success: true; data: RpcSessionState }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_session_summary\";\n\t\t\tsuccess: true;\n\t\t\tdata: { summary: SessionSummaryEntry | null };\n\t }\n\t| { id?: string; type: \"response\"; command: \"list_sessions\"; success: true; data: { sessions: RpcSessionInfo[] } }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"list_workflow_runs\";\n\t\t\tsuccess: true;\n\t\t\tdata: { runs: readonly WorkflowRunSummary[] };\n\t }\n\t| { id?: string; type: \"response\"; command: \"get_workflow_run_summary\"; success: true; data: WorkflowRunDetail }\n\t| { id?: string; type: \"response\"; command: \"open_task_inspector\"; success: true }\n\n\t// Model\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"set_model\";\n\t\t\tsuccess: true;\n\t\t\tdata: Model<Api>;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"cycle_model\";\n\t\t\tsuccess: true;\n\t\t\tdata: { model: Model<Api>; thinkingLevel: ThinkingLevel; isScoped: boolean } | null;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_available_models\";\n\t\t\tsuccess: true;\n\t\t\tdata: RpcModelCatalog;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"refresh_models\";\n\t\t\tsuccess: true;\n\t\t\tdata: RpcModelRefreshResult;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"login_provider\";\n\t\t\tsuccess: true;\n\t\t\tdata: RpcLoginProviderResult | RpcOAuthLoginProviderResult;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"save_provider_credential\";\n\t\t\tsuccess: true;\n\t\t\tdata: RpcModelCatalog;\n\t }\n\t| { id?: string; type: \"response\"; command: \"cancel_login_provider\"; success: true }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"logout_provider\";\n\t\t\tsuccess: true;\n\t\t\tdata: RpcLogoutProviderResult;\n\t }\n\n\t// Thinking — data-less success remains valid for older clients; isolated persist\n\t// reads the optional ACK when present.\n\t| { id?: string; type: \"response\"; command: \"set_thinking_level\"; success: true }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"set_thinking_level\";\n\t\t\tsuccess: true;\n\t\t\tdata: { level: ThinkingLevel; provider?: string; modelId?: string };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"cycle_thinking_level\";\n\t\t\tsuccess: true;\n\t\t\tdata: { level: ThinkingLevel } | null;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_available_thinking_levels\";\n\t\t\tsuccess: true;\n\t\t\tdata: { levels: ThinkingLevel[] };\n\t }\n\n\t// Queue modes\n\t| { id?: string; type: \"response\"; command: \"set_steering_mode\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"set_follow_up_mode\"; success: true }\n\n\t// Compaction\n\t| { id?: string; type: \"response\"; command: \"compact\"; success: true; data: VerbatimCompactionResult }\n\t| { id?: string; type: \"response\"; command: \"set_auto_compaction\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"set_background_compaction\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"set_background_compaction_threshold\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"abort_compaction\"; success: true }\n\n\t// Extension UI\n\t| { id?: string; type: \"response\"; command: \"set_extension_ui_capabilities\"; success: true }\n\n\t// Debug\n\t| { id?: string; type: \"response\"; command: \"set_debug\"; success: true }\n\n\t// Retry\n\t| { id?: string; type: \"response\"; command: \"set_auto_retry\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"abort_retry\"; success: true }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"clear_queue\";\n\t\t\tsuccess: true;\n\t\t\tdata: ClearedQueue;\n\t }\n\t| { id?: string; type: \"response\"; command: \"pause_queued_messages\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"resume_queued_messages\"; success: true; data: { released: boolean } }\n\n\t// Bash\n\t| { id?: string; type: \"response\"; command: \"bash\"; success: true; data: BashResult }\n\t| { id?: string; type: \"response\"; command: \"user_bash\"; success: true; data: BashResult }\n\t| { id?: string; type: \"response\"; command: \"abort_bash\"; success: true }\n\n\t// Session\n\t| { id?: string; type: \"response\"; command: \"get_session_stats\"; success: true; data: SessionStats }\n\t| { id?: string; type: \"response\"; command: \"get_tools\"; success: true; data: ToolStatusReport }\n\t| { id?: string; type: \"response\"; command: \"import_session\"; success: true; data: { cancelled: boolean } }\n\t| { id?: string; type: \"response\"; command: \"export_html\"; success: true; data: { path: string } }\n\t| { id?: string; type: \"response\"; command: \"switch_session\"; success: true; data: { cancelled: boolean } }\n\t| { id?: string; type: \"response\"; command: \"fork\"; success: true; data: { text: string; cancelled: boolean } }\n\t| { id?: string; type: \"response\"; command: \"clone\"; success: true; data: { cancelled: boolean } }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_fork_messages\";\n\t\t\tsuccess: true;\n\t\t\tdata: { messages: Array<{ entryId: string; text: string }> };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_entries\";\n\t\t\tsuccess: true;\n\t\t\tdata: { entries: SessionEntry[]; leafId: string | null };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_tree\";\n\t\t\tsuccess: true;\n\t\t\tdata: { tree: SessionTreeNode[]; leafId: string | null };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_last_assistant_text\";\n\t\t\tsuccess: true;\n\t\t\tdata: { text: string | null };\n\t }\n\t| { id?: string; type: \"response\"; command: \"set_session_name\"; success: true }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"navigate_tree\";\n\t\t\tsuccess: true;\n\t\t\tdata: { cancelled: boolean; editorText?: string };\n\t }\n\t| { id?: string; type: \"response\"; command: \"set_label\"; success: true; data: { entryId: string } }\n\t| { id?: string; type: \"response\"; command: \"reload\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"start_pending_recovery\"; success: true; data: SessionRecoveryReport }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_shortcuts\";\n\t\t\tsuccess: true;\n\t\t\tdata: { shortcuts: Array<{ key: string; description?: string }> };\n\t }\n\t| { id?: string; type: \"response\"; command: \"invoke_shortcut\"; success: true }\n\n\t// Messages\n\t| { id?: string; type: \"response\"; command: \"get_messages\"; success: true; data: { messages: AgentMessage[] } }\n\n\t// Commands\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_commands\";\n\t\t\tsuccess: true;\n\t\t\tdata: { commands: RpcSlashCommand[] };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_command_completions\";\n\t\t\tsuccess: true;\n\t\t\tdata: { completions: RpcAutocompleteItem[] | null };\n\t }\n\n\t// Error response (any command can fail)\n\t| ({\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: string;\n\t\t\tsuccess: false;\n\t\t\terror: string;\n\t } & RpcErrorDetails);\n\n/** Typed failure details an error response may carry, rehydrated by the RPC client. */\nexport type RpcErrorDetails =\n\t| { errorCode?: undefined; errorDetails?: undefined }\n\t| {\n\t\t\terrorCode: \"credential_synchronization\";\n\t\t\terrorDetails: { providerId: string; operation: CredentialSynchronizationOperation };\n\t }\n\t| { errorCode: \"debug_error\"; errorDetails: SerializedDebugError }\n\t// A rejected background compaction command keeps its typed error (#4330)\n\t| { errorCode: \"background_compaction\"; errorDetails: SerializedBackgroundCompactionError };\n\n// ============================================================================\n// RPC Events (stdout)\n// ============================================================================\n\n/** Events streamed by RPC mode as session activity occurs. */\nexport type RpcEvent = JsonAgentSessionEvent;\n\n// ============================================================================\n// Extension UI Events (stdout)\n// ============================================================================\ntype RpcOAuthUIEnvelope = { type: \"extension_ui_request\"; id: string; provider: string; loginId: string };\n\nexport type RpcExtensionUIRequest =\n\t| { type: \"extension_ui_request\"; id: string; method: \"select\"; title: string; options: string[]; timeout?: number }\n\t| { type: \"extension_ui_request\"; id: string; method: \"confirm\"; title: string; message: string; timeout?: number }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"input\";\n\t\t\ttitle: string;\n\t\t\tplaceholder?: string;\n\t\t\ttimeout?: number;\n\t }\n\t| { type: \"extension_ui_request\"; id: string; method: \"editor\"; title: string; prefill?: string }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"questionnaire\";\n\t\t\tquestions: QuestionParams[\"questions\"];\n\t }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"notify\";\n\t\t\tmessage: string;\n\t\t\tnotifyType?: \"info\" | \"warning\" | \"error\";\n\t }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"setStatus\";\n\t\t\tstatusKey: string;\n\t\t\tstatusText: string | undefined;\n\t }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"setWidget\";\n\t\t\twidgetKey: string;\n\t\t\twidgetLines: string[] | undefined;\n\t\t\twidgetPlacement?: \"aboveEditor\" | \"belowEditor\";\n\t\t\twidgetScroll?: { maxHeight: number; maxHeightFraction?: number };\n\t }\n\t| { type: \"extension_ui_request\"; id: string; method: \"setTitle\"; title: string }\n\t| { type: \"extension_ui_request\"; id: string; method: \"set_editor_text\"; text: string }\n\t| (RpcOAuthUIEnvelope & { method: \"oauth_auth\"; info: OAuthAuthInfo })\n\t| (RpcOAuthUIEnvelope & { method: \"oauth_device_code\"; info: OAuthDeviceCodeInfo })\n\t| (RpcOAuthUIEnvelope & { method: \"oauth_progress\"; message: string })\n\t| (RpcOAuthUIEnvelope & { method: \"oauth_info\"; message: string; links: AuthInfoLink[] })\n\t| (RpcOAuthUIEnvelope & { method: \"oauth_prompt\"; prompt: OAuthPrompt })\n\t| (RpcOAuthUIEnvelope & { method: \"oauth_select\"; prompt: OAuthSelectPrompt })\n\t| (RpcOAuthUIEnvelope & { method: \"oauth_manual_code\" })\n\t| (RpcOAuthUIEnvelope & { method: \"oauth_manual_code_cancel\" });\n\n// ============================================================================\n// Extension UI Commands (stdin)\n// ============================================================================\n\n/** Response to an extension UI request */\nexport type RpcExtensionUIResponse =\n\t| { type: \"extension_ui_response\"; id: string; value: string }\n\t| { type: \"extension_ui_response\"; id: string; confirmed: boolean }\n\t| { type: \"extension_ui_response\"; id: string; answers: QuestionAnswer[] }\n\t| { type: \"extension_ui_response\"; id: string; cancelled: true };\n\n// ============================================================================\n// Helper type for extracting command types\n// ============================================================================\n\nexport type RpcCommandType = RpcCommand[\"type\"];\n"]}
|
|
1
|
+
{"version":3,"file":"rpc-types.js","sourceRoot":"","sources":["../../../src/modes/rpc/rpc-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG","sourcesContent":["/**\n * RPC protocol types for headless operation.\n *\n * Commands are sent as JSON lines on stdin.\n * Responses and events are emitted as JSON lines on stdout.\n */\n\nimport type {\n\tAuthInfoLink,\n\tCredential,\n\tOAuthAuthInfo,\n\tOAuthDeviceCodeInfo,\n\tOAuthPrompt,\n\tOAuthSelectPrompt,\n} from \"@bastani/pi-ai\";\nimport type { Api, ImageContent, Model } from \"@bastani/pi-ai/compat\";\nimport type { AgentMessage, ThinkingLevel } from \"@earendil-works/pi-agent-core\";\nimport type {\n\tClearedQueue,\n\tCompactionReason,\n\tPromptDisposition,\n\tQueuedInputDisposition,\n\tSessionRecoveryReport,\n\tSessionStats,\n} from \"../../core/agent-session.js\";\nimport type { BashResult } from \"../../core/bash-executor.ts\";\nimport type { SerializedBackgroundCompactionState } from \"../../core/compaction/background-compaction.ts\";\nimport type { SerializedBackgroundCompactionError } from \"../../core/compaction/background-compaction-errors.ts\";\nimport type { VerbatimCompactionResult } from \"../../core/compaction/index.ts\";\nimport type { SerializedDebugError } from \"../../core/debug-errors.ts\";\nimport type { ResourceOverlap } from \"../../core/diagnostics.ts\";\nimport type { SessionRecoveryReason } from \"../../core/extensions/index.js\";\nimport type {\n\tWorkflowRunDetail,\n\tWorkflowRunFilterStatus,\n\tWorkflowRunSummary,\n} from \"../../core/extensions/workflow-run-control.js\";\nimport type { ModelFallbackReason } from \"../../core/model-resolver-types.ts\";\nimport type { CredentialSynchronizationOperation } from \"../../core/model-runtime.js\";\nimport type { OAuthProviderMetadata } from \"../../core/oauth-login.ts\";\nimport type { AuthStatus } from \"../../core/provider-composer.ts\";\nimport type { SerializedMissingSessionCwdError } from \"../../core/session-cwd.ts\";\nimport type { SessionEntry, SessionInfo, SessionSummaryEntry, SessionTreeNode } from \"../../core/session-manager.ts\";\nimport type { SourceInfo } from \"../../core/source-info.ts\";\nimport type { ToolStatusReport } from \"../../core/tool-status.js\";\nimport type { QuestionAnswer, QuestionParams } from \"../../core/tools/ask-user-question/tool/types.js\";\nimport type { JsonAgentSessionEvent } from \"../json-event.ts\";\n\n// ============================================================================\n// RPC Commands (stdin)\n// ============================================================================\n\n/** A line a resume shows the user, carried from the engine that prepared the resume to the host that renders it. */\nexport interface RpcResumeNotice {\n\treadonly type: \"info\" | \"warning\";\n\treadonly message: string;\n}\n\nexport interface RpcModelCatalog {\n\tmodels: Model<Api>[];\n\tscopedModels: Array<{ model: Model<Api>; thinkingLevel?: ThinkingLevel }>;\n\t/** Extension-registered providers that offer API-key login (`login_provider`). */\n\tcustomAuthProviders: Array<{ id: string; name: string }>;\n\toauthProviders?: OAuthProviderMetadata[];\n\t/** Auth status of extension-registered providers that is not a stored credential (environment, configured key, runtime key). */\n\tproviderAuthStatuses?: Array<{ provider: string; status: AuthStatus }>;\n}\n\nexport interface RpcModelRefreshResult extends RpcModelCatalog {\n\taborted: boolean;\n\terrors: Array<{ provider: string; message: string }>;\n}\n/**\n * The host supplied the API key through the login input form, so echoing it\n * back over the stdout pipe would make this response a second credential\n * egress. Only the metadata a caller needs to confirm the login travels.\n */\nexport type RpcLoginProviderResult =\n\t| (RpcModelCatalog & {\n\t\t\tprovider: string;\n\t\t\tcancelled: false;\n\t\t\ttype: \"api_key\";\n\t })\n\t| { provider: string; cancelled: true };\n\nexport type RpcOAuthLoginProviderResult =\n\t| (RpcModelCatalog & { provider: string; cancelled: false })\n\t| { provider: string; cancelled: true };\n\nexport type RpcSessionInfo = Omit<SessionInfo, \"created\" | \"modified\"> & {\n\tcreated: string;\n\tmodified: string;\n};\n\nexport type RpcCommand =\n\t// Prompting\n\t| { id?: string; type: \"prompt\"; message: string; images?: ImageContent[]; streamingBehavior?: \"steer\" | \"followUp\" }\n\t| { id?: string; type: \"steer\"; message: string; images?: ImageContent[] }\n\t| { id?: string; type: \"follow_up\"; message: string; images?: ImageContent[] }\n\t| { id?: string; type: \"abort\" }\n\t| { id?: string; type: \"new_session\"; parentSession?: string }\n\t| { id?: string; type: \"delete_session\"; sessionId?: string }\n\n\t// State\n\t| { id?: string; type: \"get_state\" }\n\t| { id?: string; type: \"get_session_summary\" }\n\t| { id?: string; type: \"list_sessions\" }\n\t| { id?: string; type: \"list_workflow_runs\"; status?: WorkflowRunFilterStatus }\n\t| { id?: string; type: \"get_workflow_run_summary\"; runId: string }\n\t| { id?: string; type: \"open_task_inspector\"; taskId?: string }\n\n\t// Model\n\t| { id?: string; type: \"set_model\"; provider: string; modelId: string; persist?: boolean }\n\t| { id?: string; type: \"cycle_model\"; direction?: \"forward\" | \"backward\"; persist?: boolean }\n\t| { id?: string; type: \"get_available_models\"; allowPartialResources?: boolean }\n\t| { id?: string; type: \"login_provider\"; provider: string; authType?: \"api_key\" | \"oauth\"; loginId?: string }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"save_provider_credential\";\n\t\t\tprovider: string;\n\t\t\tcredential: Credential;\n\t\t\t/** Fetch the remote catalog before publishing the credential. Defaults to true. */\n\t\t\trefreshCatalog?: boolean;\n\t }\n\t| { id?: string; type: \"cancel_login_provider\"; provider: string; loginId?: string }\n\t| { id?: string; type: \"logout_provider\"; provider: string }\n\t| { id?: string; type: \"refresh_models\"; timeoutMs?: number; force?: boolean; allowNetwork?: boolean }\n\n\t// Thinking\n\t| { id?: string; type: \"set_thinking_level\"; level: ThinkingLevel; persist?: boolean }\n\t| { id?: string; type: \"cycle_thinking_level\" }\n\t| { id?: string; type: \"get_available_thinking_levels\" }\n\n\t// Queue modes\n\t| { id?: string; type: \"set_steering_mode\"; mode: \"all\" | \"one-at-a-time\" }\n\t| { id?: string; type: \"set_follow_up_mode\"; mode: \"all\" | \"one-at-a-time\" }\n\n\t// Compaction\n\t| { id?: string; type: \"compact\" }\n\t| { id?: string; type: \"set_auto_compaction\"; enabled: boolean }\n\t| { id?: string; type: \"set_background_compaction\"; enabled: boolean }\n\t| { id?: string; type: \"set_background_compaction_threshold\"; percent: number }\n\t| { id?: string; type: \"abort_compaction\" }\n\n\t// Extension UI\n\t| { id?: string; type: \"set_extension_ui_capabilities\"; questionnaire?: boolean }\n\n\t// Debug\n\t| { id?: string; type: \"set_debug\"; enabled: boolean }\n\n\t// Retry\n\t| { id?: string; type: \"set_auto_retry\"; enabled: boolean }\n\t| { id?: string; type: \"abort_retry\" }\n\t| { id?: string; type: \"clear_queue\" }\n\t| { id?: string; type: \"pause_queued_messages\" }\n\t| { id?: string; type: \"resume_queued_messages\" }\n\n\t// Bash\n\t| { id?: string; type: \"bash\"; command: string; excludeFromContext?: boolean }\n\t| { id?: string; type: \"user_bash\"; command: string; excludeFromContext?: boolean }\n\t| { id?: string; type: \"abort_bash\"; requestId?: string }\n\n\t// Session\n\t| { id?: string; type: \"get_session_stats\" }\n\t| { id?: string; type: \"get_tools\" }\n\t| { id?: string; type: \"export_html\"; outputPath?: string }\n\t| { id?: string; type: \"switch_session\"; sessionId: string; cwdOverride?: string; sessionDirectory?: string }\n\t| { id?: string; type: \"import_session\"; inputPath: string; cwdOverride?: string }\n\t| { id?: string; type: \"fork\"; entryId: string }\n\t| { id?: string; type: \"clone\" }\n\t| { id?: string; type: \"get_fork_messages\" }\n\t| { id?: string; type: \"get_entries\"; since?: string }\n\t| { id?: string; type: \"get_tree\" }\n\t| { id?: string; type: \"get_last_assistant_text\" }\n\t| { id?: string; type: \"set_session_name\"; name: string }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"navigate_tree\";\n\t\t\ttargetId: string;\n\t\t\toptions?: { summarize?: boolean; customInstructions?: string; replaceInstructions?: boolean; label?: string };\n\t }\n\t| { id?: string; type: \"set_label\"; entryId: string; label?: string }\n\t| { id?: string; type: \"reload\" }\n\t| { id?: string; type: \"start_pending_recovery\"; reason?: SessionRecoveryReason }\n\t| { id?: string; type: \"get_shortcuts\" }\n\t| { id?: string; type: \"invoke_shortcut\"; key: string }\n\n\t// Messages\n\t| { id?: string; type: \"get_messages\" }\n\n\t// Commands and their live argument completions\n\t| { id?: string; type: \"get_commands\" }\n\t| { id?: string; type: \"get_command_completions\"; commandName: string; argumentPrefix: string };\n// ============================================================================\n// RPC Argument Completion\n// ============================================================================\n\nexport interface RpcAutocompleteItem {\n\tvalue: string;\n\tlabel: string;\n\tdescription?: string;\n}\n\n// RPC Slash Command (for get_commands response)\n// ============================================================================\n\n/** A command available for invocation via prompt */\nexport interface RpcSlashCommand {\n\t/** Command name (without leading slash) */\n\tname: string;\n\t/** Human-readable description */\n\tdescription?: string;\n\t/** Whether the engine can evaluate argument completions for this command. */\n\thasArgumentCompletions?: boolean;\n\t/** What kind of command this is */\n\tsource: \"extension\" | \"prompt\" | \"skill\";\n\t/** Source metadata for the owning resource */\n\tsourceInfo: SourceInfo;\n}\n\n// ============================================================================\n// RPC State\n// ============================================================================\n\nexport interface RpcResourceExtension {\n\tpath: string;\n\tsourceInfo?: SourceInfo;\n\thidden: boolean;\n}\n\nexport interface RpcSessionState {\n\tmodel?: Model<Api>;\n\tmodelFallbackMessage?: string;\n\tmodelFallbackReason?: ModelFallbackReason;\n\tthinkingLevel: ThinkingLevel;\n\tisStreaming: boolean;\n\tisCompacting: boolean;\n\tcompactionReason?: CompactionReason;\n\tsteeringMode: \"all\" | \"one-at-a-time\";\n\tfollowUpMode: \"all\" | \"one-at-a-time\";\n\tsessionLocation?: string;\n\tsessionId: string;\n\tsessionName?: string;\n\tautoCompactionEnabled: boolean;\n\t/** Background compaction state (#4330), the same shape workflow stage status carries. */\n\tcompaction: SerializedBackgroundCompactionState;\n\tbackgroundCompactionEnabled: boolean;\n\tbackgroundCompactionThresholdPercent: number;\n\tmessageCount: number;\n\tpendingMessageCount: number;\n\tqueuedMessagesPaused: boolean;\n\t/** Authoritative engine trust state; absent on older RPC peers. */\n\tprojectTrusted?: boolean;\n\tresourceOverlaps?: ResourceOverlap[];\n\tresourceExtensions?: RpcResourceExtension[];\n}\n\nexport interface RpcLogoutProviderResult {\n\tprovider: string;\n\tauthStatus: AuthStatus;\n\tmodels: Model<Api>[];\n\tscopedModels?: Array<{ model: Model<Api>; thinkingLevel?: ThinkingLevel }>;\n}\n\n// ============================================================================\n// RPC Responses (stdout)\n// ============================================================================\n\n// Success responses with data\nexport type RpcResponse =\n\t// Prompting\n\t| { id?: string; type: \"response\"; command: \"prompt\"; success: true; data: { disposition: PromptDisposition } }\n\t| { id?: string; type: \"response\"; command: \"steer\"; success: true; data: { disposition: QueuedInputDisposition } }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"follow_up\";\n\t\t\tsuccess: true;\n\t\t\tdata: { disposition: QueuedInputDisposition };\n\t }\n\t| { id?: string; type: \"response\"; command: \"abort\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"new_session\"; success: true; data: { cancelled: boolean } }\n\t| { id?: string; type: \"response\"; command: \"delete_session\"; success: true }\n\n\t// State\n\t| { id?: string; type: \"response\"; command: \"get_state\"; success: true; data: RpcSessionState }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_session_summary\";\n\t\t\tsuccess: true;\n\t\t\tdata: { summary: SessionSummaryEntry | null };\n\t }\n\t| { id?: string; type: \"response\"; command: \"list_sessions\"; success: true; data: { sessions: RpcSessionInfo[] } }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"list_workflow_runs\";\n\t\t\tsuccess: true;\n\t\t\tdata: { runs: readonly WorkflowRunSummary[] };\n\t }\n\t| { id?: string; type: \"response\"; command: \"get_workflow_run_summary\"; success: true; data: WorkflowRunDetail }\n\t| { id?: string; type: \"response\"; command: \"open_task_inspector\"; success: true }\n\n\t// Model\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"set_model\";\n\t\t\tsuccess: true;\n\t\t\tdata: Model<Api>;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"cycle_model\";\n\t\t\tsuccess: true;\n\t\t\tdata: { model: Model<Api>; thinkingLevel: ThinkingLevel; isScoped: boolean } | null;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_available_models\";\n\t\t\tsuccess: true;\n\t\t\tdata: RpcModelCatalog;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"refresh_models\";\n\t\t\tsuccess: true;\n\t\t\tdata: RpcModelRefreshResult;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"login_provider\";\n\t\t\tsuccess: true;\n\t\t\tdata: RpcLoginProviderResult | RpcOAuthLoginProviderResult;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"save_provider_credential\";\n\t\t\tsuccess: true;\n\t\t\tdata: RpcModelCatalog;\n\t }\n\t| { id?: string; type: \"response\"; command: \"cancel_login_provider\"; success: true }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"logout_provider\";\n\t\t\tsuccess: true;\n\t\t\tdata: RpcLogoutProviderResult;\n\t }\n\n\t// Thinking — data-less success remains valid for older clients; isolated persist\n\t// reads the optional ACK when present.\n\t| { id?: string; type: \"response\"; command: \"set_thinking_level\"; success: true }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"set_thinking_level\";\n\t\t\tsuccess: true;\n\t\t\tdata: { level: ThinkingLevel; provider?: string; modelId?: string };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"cycle_thinking_level\";\n\t\t\tsuccess: true;\n\t\t\tdata: { level: ThinkingLevel } | null;\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_available_thinking_levels\";\n\t\t\tsuccess: true;\n\t\t\tdata: { levels: ThinkingLevel[] };\n\t }\n\n\t// Queue modes\n\t| { id?: string; type: \"response\"; command: \"set_steering_mode\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"set_follow_up_mode\"; success: true }\n\n\t// Compaction\n\t| { id?: string; type: \"response\"; command: \"compact\"; success: true; data: VerbatimCompactionResult }\n\t| { id?: string; type: \"response\"; command: \"set_auto_compaction\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"set_background_compaction\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"set_background_compaction_threshold\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"abort_compaction\"; success: true }\n\n\t// Extension UI\n\t| { id?: string; type: \"response\"; command: \"set_extension_ui_capabilities\"; success: true }\n\n\t// Debug\n\t| { id?: string; type: \"response\"; command: \"set_debug\"; success: true }\n\n\t// Retry\n\t| { id?: string; type: \"response\"; command: \"set_auto_retry\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"abort_retry\"; success: true }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"clear_queue\";\n\t\t\tsuccess: true;\n\t\t\tdata: ClearedQueue;\n\t }\n\t| { id?: string; type: \"response\"; command: \"pause_queued_messages\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"resume_queued_messages\"; success: true; data: { released: boolean } }\n\n\t// Bash\n\t| { id?: string; type: \"response\"; command: \"bash\"; success: true; data: BashResult }\n\t| { id?: string; type: \"response\"; command: \"user_bash\"; success: true; data: BashResult }\n\t| { id?: string; type: \"response\"; command: \"abort_bash\"; success: true }\n\n\t// Session\n\t| { id?: string; type: \"response\"; command: \"get_session_stats\"; success: true; data: SessionStats }\n\t| { id?: string; type: \"response\"; command: \"get_tools\"; success: true; data: ToolStatusReport }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"import_session\";\n\t\t\tsuccess: true;\n\t\t\tdata: { cancelled: boolean; notices?: readonly RpcResumeNotice[] };\n\t }\n\t| { id?: string; type: \"response\"; command: \"export_html\"; success: true; data: { path: string } }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"switch_session\";\n\t\t\tsuccess: true;\n\t\t\tdata: { cancelled: boolean; notices?: readonly RpcResumeNotice[] };\n\t }\n\t| { id?: string; type: \"response\"; command: \"fork\"; success: true; data: { text: string; cancelled: boolean } }\n\t| { id?: string; type: \"response\"; command: \"clone\"; success: true; data: { cancelled: boolean } }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_fork_messages\";\n\t\t\tsuccess: true;\n\t\t\tdata: { messages: Array<{ entryId: string; text: string }> };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_entries\";\n\t\t\tsuccess: true;\n\t\t\tdata: { entries: SessionEntry[]; leafId: string | null };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_tree\";\n\t\t\tsuccess: true;\n\t\t\tdata: { tree: SessionTreeNode[]; leafId: string | null };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_last_assistant_text\";\n\t\t\tsuccess: true;\n\t\t\tdata: { text: string | null };\n\t }\n\t| { id?: string; type: \"response\"; command: \"set_session_name\"; success: true }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"navigate_tree\";\n\t\t\tsuccess: true;\n\t\t\tdata: { cancelled: boolean; editorText?: string };\n\t }\n\t| { id?: string; type: \"response\"; command: \"set_label\"; success: true; data: { entryId: string } }\n\t| { id?: string; type: \"response\"; command: \"reload\"; success: true }\n\t| { id?: string; type: \"response\"; command: \"start_pending_recovery\"; success: true; data: SessionRecoveryReport }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_shortcuts\";\n\t\t\tsuccess: true;\n\t\t\tdata: { shortcuts: Array<{ key: string; description?: string }> };\n\t }\n\t| { id?: string; type: \"response\"; command: \"invoke_shortcut\"; success: true }\n\n\t// Messages\n\t| { id?: string; type: \"response\"; command: \"get_messages\"; success: true; data: { messages: AgentMessage[] } }\n\n\t// Commands\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_commands\";\n\t\t\tsuccess: true;\n\t\t\tdata: { commands: RpcSlashCommand[] };\n\t }\n\t| {\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: \"get_command_completions\";\n\t\t\tsuccess: true;\n\t\t\tdata: { completions: RpcAutocompleteItem[] | null };\n\t }\n\n\t// Error response (any command can fail)\n\t| ({\n\t\t\tid?: string;\n\t\t\ttype: \"response\";\n\t\t\tcommand: string;\n\t\t\tsuccess: false;\n\t\t\terror: string;\n\t } & RpcErrorDetails);\n\n/** Typed failure details an error response may carry, rehydrated by the RPC client. */\nexport type RpcErrorDetails =\n\t| { errorCode?: undefined; errorDetails?: undefined }\n\t| {\n\t\t\terrorCode: \"credential_synchronization\";\n\t\t\terrorDetails: { providerId: string; operation: CredentialSynchronizationOperation };\n\t }\n\t| { errorCode: \"debug_error\"; errorDetails: SerializedDebugError }\n\t// A rejected background compaction command keeps its typed error (#4330)\n\t| { errorCode: \"background_compaction\"; errorDetails: SerializedBackgroundCompactionError }\n\t// A resume or import whose session's working directory is gone keeps its typed error, so the host can offer\n\t// to continue or fork instead of reporting a failure\n\t| { errorCode: \"missing_session_cwd\"; errorDetails: SerializedMissingSessionCwdError };\n\n// ============================================================================\n// RPC Events (stdout)\n// ============================================================================\n\n/** Events streamed by RPC mode as session activity occurs. */\nexport type RpcEvent = JsonAgentSessionEvent;\n\n// ============================================================================\n// Extension UI Events (stdout)\n// ============================================================================\ntype RpcOAuthUIEnvelope = { type: \"extension_ui_request\"; id: string; provider: string; loginId: string };\n\nexport type RpcExtensionUIRequest =\n\t| { type: \"extension_ui_request\"; id: string; method: \"select\"; title: string; options: string[]; timeout?: number }\n\t| { type: \"extension_ui_request\"; id: string; method: \"confirm\"; title: string; message: string; timeout?: number }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"input\";\n\t\t\ttitle: string;\n\t\t\tplaceholder?: string;\n\t\t\ttimeout?: number;\n\t }\n\t| { type: \"extension_ui_request\"; id: string; method: \"editor\"; title: string; prefill?: string }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"questionnaire\";\n\t\t\tquestions: QuestionParams[\"questions\"];\n\t }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"notify\";\n\t\t\tmessage: string;\n\t\t\tnotifyType?: \"info\" | \"warning\" | \"error\";\n\t }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"setStatus\";\n\t\t\tstatusKey: string;\n\t\t\tstatusText: string | undefined;\n\t }\n\t| {\n\t\t\ttype: \"extension_ui_request\";\n\t\t\tid: string;\n\t\t\tmethod: \"setWidget\";\n\t\t\twidgetKey: string;\n\t\t\twidgetLines: string[] | undefined;\n\t\t\twidgetPlacement?: \"aboveEditor\" | \"belowEditor\";\n\t\t\twidgetScroll?: { maxHeight: number; maxHeightFraction?: number };\n\t }\n\t| { type: \"extension_ui_request\"; id: string; method: \"setTitle\"; title: string }\n\t| { type: \"extension_ui_request\"; id: string; method: \"set_editor_text\"; text: string }\n\t| (RpcOAuthUIEnvelope & { method: \"oauth_auth\"; info: OAuthAuthInfo })\n\t| (RpcOAuthUIEnvelope & { method: \"oauth_device_code\"; info: OAuthDeviceCodeInfo })\n\t| (RpcOAuthUIEnvelope & { method: \"oauth_progress\"; message: string })\n\t| (RpcOAuthUIEnvelope & { method: \"oauth_info\"; message: string; links: AuthInfoLink[] })\n\t| (RpcOAuthUIEnvelope & { method: \"oauth_prompt\"; prompt: OAuthPrompt })\n\t| (RpcOAuthUIEnvelope & { method: \"oauth_select\"; prompt: OAuthSelectPrompt })\n\t| (RpcOAuthUIEnvelope & { method: \"oauth_manual_code\" })\n\t| (RpcOAuthUIEnvelope & { method: \"oauth_manual_code_cancel\" });\n\n// ============================================================================\n// Extension UI Commands (stdin)\n// ============================================================================\n\n/** Response to an extension UI request */\nexport type RpcExtensionUIResponse =\n\t| { type: \"extension_ui_response\"; id: string; value: string }\n\t| { type: \"extension_ui_response\"; id: string; confirmed: boolean }\n\t| { type: \"extension_ui_response\"; id: string; answers: QuestionAnswer[] }\n\t| { type: \"extension_ui_response\"; id: string; cancelled: true };\n\n// ============================================================================\n// Helper type for extracting command types\n// ============================================================================\n\nexport type RpcCommandType = RpcCommand[\"type\"];\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-manager-cli.d.ts","sourceRoot":"","sources":["../src/package-manager-cli.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"package-manager-cli.d.ts","sourceRoot":"","sources":["../src/package-manager-cli.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAOlE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAiC7D,wBAAsB,oBAAoB,CACzC,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,eAAe,CAAC,EAAE,eAAe,CAAC;IAAC,kBAAkB,CAAC,EAAE,eAAe,EAAE,CAAA;CAAO,GACvG,OAAO,CAAC,IAAI,CAAC,CA0Df;AAsJD,MAAM,WAAW,4BAA4B;IAC5C,kBAAkB,CAAC,EAAE,eAAe,EAAE,CAAC;IACvC,oBAAoB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3D;AAyDD,wBAAsB,mBAAmB,CACxC,IAAI,EAAE,MAAM,EAAE,EACd,cAAc,GAAE,4BAAiC,GAC/C,OAAO,CAAC,OAAO,CAAC,CA8DlB;AAED,wBAAsB,oBAAoB,CACzC,IAAI,EAAE,MAAM,EAAE,EACd,cAAc,GAAE,4BAAiC,GAC/C,OAAO,CAAC,OAAO,CAAC,CAoPlB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
|
+
import { ModelsError } from "@bastani/pi-ai";
|
|
2
3
|
import chalk from "chalk";
|
|
3
4
|
import { selectConfig } from "./cli/config-selector.js";
|
|
4
5
|
import { createProjectTrustContext } from "./cli/project-trust.js";
|
|
@@ -73,9 +74,17 @@ export async function refreshModelCatalogs(agentDir, options = {}) {
|
|
|
73
74
|
const result = await Promise.race([refresh, aborted]);
|
|
74
75
|
if (!result || result.aborted)
|
|
75
76
|
throw new Error("Model catalog refresh timed out.");
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
const failures = [];
|
|
78
|
+
for (const [provider, error] of result.errors) {
|
|
79
|
+
if (error instanceof ModelsError && error.code === "oauth") {
|
|
80
|
+
console.warn(chalk.yellow(`Warning: skipped model catalog for ${provider}: ${error.message}\nLog in again with \`${APP_NAME} auth login ${provider}\` to refresh it.`));
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
failures.push(`${provider}: ${error.message}`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (failures.length > 0) {
|
|
87
|
+
throw new Error(`Could not refresh model catalogs: ${failures.join("; ")}`);
|
|
79
88
|
}
|
|
80
89
|
}
|
|
81
90
|
finally {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-manager-cli.js","sourceRoot":"","sources":["../src/package-manager-cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EACN,QAAQ,EACR,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,uBAAuB,EACvB,mBAAmB,EACnB,WAAW,EACX,2BAA2B,EAC3B,WAAW,EACX,aAAa,EACb,oBAAoB,EACpB,mCAAmC,EACnC,+BAA+B,EAC/B,YAAY,EAGZ,OAAO,GACP,MAAM,aAAa,CAA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C,CAAC;QAC9C,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACrB,OAAO,IAAI,CAAC;IACb,CAAC;AACF,CAAC","sourcesContent":["import { join } from \"node:path\";\nimport chalk from \"chalk\";\nimport { selectConfig } from \"./cli/config-selector.ts\";\nimport { createProjectTrustContext } from \"./cli/project-trust.ts\";\nimport {\n\tAPP_NAME,\n\tCONFIG_DIR_NAME,\n\tdetectInstallChange,\n\tdetectInstallMethod,\n\tENV_PACKAGE_DIR,\n\tENV_SELF_UPDATE_COMMAND,\n\tgetAgentConfigPaths,\n\tgetAgentDir,\n\tgetConfiguredSelfUpdateArgv,\n\tgetEnvNames,\n\tgetPackageDir,\n\tgetSelfUpdateCommand,\n\tgetSelfUpdateUnavailableInstruction,\n\tmakeConfiguredSelfUpdateCommand,\n\tPACKAGE_NAME,\n\ttype SelfUpdateCommand,\n\ttype SelfUpdateTarget,\n\tVERSION,\n} from \"./config.js\";\nimport { parseConfigCommand } from \"./config-command-parser.ts\";\nimport { AuthStorage } from \"./core/auth-storage.ts\";\nimport type { InlineExtension } from \"./core/extensions/types.ts\";\nimport { ModelRuntime } from \"./core/model-runtime.js\";\nimport { DefaultPackageManager } from \"./core/package-manager.ts\";\nimport { isOfflineModeEnabled } from \"./core/package-manager-env.ts\";\nimport { type AppMode, resolveProjectTrusted } from \"./core/project-trust.ts\";\nimport { DefaultResourceLoader } from \"./core/resource-loader.ts\";\nimport { formatPackageInstallWarning } from \"./core/resource-loader-extension-warnings.ts\";\nimport { SettingsManager } from \"./core/settings-manager.ts\";\nimport { hasProjectTrustInputs, ProjectTrustStore } from \"./core/trust-manager.ts\";\nimport {\n\tgetPackageCommandUsage,\n\tparsePackageCommand,\n\tprintPackageCommandHelp,\n\ttype UpdateTarget,\n} from \"./package-manager-cli-parser.ts\";\nimport { renderSelfUpdateNote, resolveSelfUpdatePlan, type SelfUpdatePlan } from \"./self-update-plan.ts\";\nimport { spawnProcess, spawnProcessSync } from \"./utils/child-process.ts\";\nimport {\n\tcleanupWindowsSelfUpdateQuarantine,\n\tquarantineWindowsNativeDependencies,\n} from \"./utils/windows-self-update.ts\";\n\nfunction reportSettingsErrors(settingsManager: SettingsManager, context: string): void {\n\tconst errors = settingsManager.drainErrors();\n\tfor (const { scope, error } of errors) {\n\t\tconsole.error(chalk.yellow(`Warning (${context}, ${scope} settings): ${error.message}`));\n\t\tif (error.stack) {\n\t\t\tconsole.error(chalk.dim(error.stack));\n\t\t}\n\t}\n}\n\nfunction updateTargetIncludesSelf(target: UpdateTarget): boolean {\n\treturn target.type === \"all\" || target.type === \"self\";\n}\n\nfunction updateTargetIncludesExtensions(target: UpdateTarget): boolean {\n\treturn target.type === \"all\" || target.type === \"extensions\";\n}\n\nexport async function refreshModelCatalogs(\n\tagentDir: string,\n\toptions: { cwd?: string; settingsManager?: SettingsManager; extensionFactories?: InlineExtension[] } = {},\n): Promise<void> {\n\tconst controller = new AbortController();\n\tconst timeout = setTimeout(() => controller.abort(), 15_000);\n\tconst aborted = new Promise<null>((resolve) => {\n\t\tcontroller.signal.addEventListener(\"abort\", () => resolve(null), { once: true });\n\t});\n\ttry {\n\t\tconst cwd = options.cwd ?? process.cwd();\n\t\tconst settingsManager =\n\t\t\toptions.settingsManager ?? SettingsManager.create(cwd, agentDir, { projectTrusted: true });\n\t\tconst resourceLoader = new DefaultResourceLoader({\n\t\t\tcwd,\n\t\t\tagentDir,\n\t\t\tsettingsManager,\n\t\t\textensionFactories: options.extensionFactories,\n\t\t\tnoSkills: true,\n\t\t\tnoPromptTemplates: true,\n\t\t\tnoThemes: true,\n\t\t});\n\t\tconst loaded = await Promise.race([resourceLoader.reload().then(() => true), aborted]);\n\t\tif (!loaded) throw new Error(\"Model catalog refresh timed out.\");\n\t\tconst authPaths = [join(agentDir, \"auth.json\"), ...getAgentConfigPaths(\"auth.json\")].filter(\n\t\t\t(path, index, paths) => paths.indexOf(path) === index,\n\t\t);\n\t\tconst modelRuntime = await ModelRuntime.create({\n\t\t\tcredentials: AuthStorage.create(authPaths),\n\t\t\tmodelsPath: join(agentDir, \"models.json\"),\n\t\t});\n\t\tconst extensionsResult = resourceLoader.getExtensions();\n\t\tif (extensionsResult.errors.length > 0) {\n\t\t\tconst details = extensionsResult.errors.map(({ path, error }) => `${path}: ${error}`).join(\"; \");\n\t\t\tthrow new Error(`Could not load extensions for model catalog refresh: ${details}`);\n\t\t}\n\t\tfor (const registration of extensionsResult.runtime.pendingProviderRegistrations) {\n\t\t\tif (\"provider\" in registration) modelRuntime.registerNativeProvider(registration.provider);\n\t\t\telse modelRuntime.registerProvider(registration.name, registration.config);\n\t\t}\n\t\tconst refresh = modelRuntime.refresh({ allowNetwork: true, force: true, signal: controller.signal });\n\t\tconst result = await Promise.race([refresh, aborted]);\n\t\tif (!result || result.aborted) throw new Error(\"Model catalog refresh timed out.\");\n\t\tif (result.errors.size > 0) {\n\t\t\tconst details = [...result.errors].map(([provider, error]) => `${provider}: ${error.message}`).join(\"; \");\n\t\t\tthrow new Error(`Could not refresh model catalogs: ${details}`);\n\t\t}\n\t} finally {\n\t\tclearTimeout(timeout);\n\t}\n}\n\nfunction printSelfUpdateUnavailable(npmCommand: string[] | undefined, updateTarget: SelfUpdateTarget): void {\n\tconsole.error(`error: ${APP_NAME} cannot self-update this installation.`);\n\tconsole.error(getSelfUpdateUnavailableInstruction(PACKAGE_NAME, npmCommand, updateTarget));\n\tconsole.error(\n\t\t`To make \\`${APP_NAME} update\\` run your own update command, set ${ENV_SELF_UPDATE_COMMAND} or the selfUpdateCommand setting.`,\n\t);\n\tconst entrypoint = process.argv[1];\n\tif (entrypoint) {\n\t\tconsole.error(\"\");\n\t\tconsole.error(`Location of ${APP_NAME} executable: ${entrypoint}`);\n\t}\n}\n\nfunction printSelfUpdateFallback(command: SelfUpdateCommand): void {\n\tconsole.error(chalk.dim(`If this keeps failing, run this command yourself: ${command.display}`));\n}\n\nfunction printSelfUpdateNote(note: string): void {\n\tconst rendered = renderSelfUpdateNote(note);\n\tif (!rendered) return;\n\tconsole.log(`\\n${chalk.bold(chalk.yellow(\"Update note\"))}`);\n\tconsole.log(rendered);\n\tconsole.log();\n}\n\nasync function runSelfUpdate(command: SelfUpdateCommand): Promise<void> {\n\tconsole.log(chalk.dim(`Updating ${APP_NAME} with ${command.display}...`));\n\tfor (const step of command.steps ?? [command]) {\n\t\tawait new Promise<void>((resolve, reject) => {\n\t\t\tconst child = spawnProcess(step.command, step.args, {\n\t\t\t\tstdio: \"inherit\",\n\t\t\t});\n\t\t\tchild.on(\"error\", (error) => {\n\t\t\t\treject(error);\n\t\t\t});\n\t\t\tchild.on(\"close\", (code, signal) => {\n\t\t\t\tif (code === 0) {\n\t\t\t\t\tresolve();\n\t\t\t\t} else if (signal) {\n\t\t\t\t\treject(new Error(`${step.display} terminated by signal ${signal}`));\n\t\t\t\t} else {\n\t\t\t\t\treject(new Error(`${step.display} exited with code ${code ?? \"unknown\"}`));\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n}\n\n/** Run the user-configured self-update command, then report the version installed on disk. */\nasync function runConfiguredSelfUpdate(argv: string[], plan: SelfUpdatePlan): Promise<void> {\n\tconst command = makeConfiguredSelfUpdateCommand(argv, plan);\n\tif (plan.note) printSelfUpdateNote(plan.note);\n\ttry {\n\t\tawait runSelfUpdate(command);\n\t} catch (error: unknown) {\n\t\tconst message = error instanceof Error ? error.message : \"Unknown self-update command error\";\n\t\tconsole.error(chalk.red(`Error: ${message}`));\n\t\tprocess.exitCode = 1;\n\t\treturn;\n\t}\n\t// Exit code 0 does not prove an update. Wrappers such as mise or Nix install each version into a new\n\t// directory and leave this installation untouched, so fall back to the executable on PATH.\n\tconst change = detectInstallChange();\n\tconst installedVersion =\n\t\tchange?.kind === \"updated\" && change.version === plan.version ? change.version : readVersionOnPath();\n\tif (installedVersion === plan.version) {\n\t\tconsole.log(chalk.green(`Updated ${APP_NAME} from ${VERSION} to ${plan.version}`));\n\t\tawait runIntercomUpgrade();\n\t\treturn;\n\t}\n\tconsole.log(\n\t\tchalk.yellow(\n\t\t\t`Ran ${command.display}, but \\`${APP_NAME} --version\\` reports ${installedVersion ?? \"no version\"}, not ${plan.version}.`,\n\t\t),\n\t);\n}\n\n/** The environment for running the Atomic on PATH, the Atomic the user runs next. */\nfunction getInstalledAtomicEnv(): NodeJS.ProcessEnv {\n\t// The package directory override points at this installation and would make the new Atomic act as the old one.\n\tconst env = { ...process.env };\n\tfor (const name of getEnvNames(ENV_PACKAGE_DIR)) delete env[name];\n\treturn env;\n}\n\n/** Version printed by `atomic --version` as resolved from PATH, the Atomic the user runs next. */\nfunction readVersionOnPath(): string | undefined {\n\tconst result = spawnProcessSync(APP_NAME, [\"--version\"], {\n\t\tencoding: \"utf-8\",\n\t\tstdio: [\"ignore\", \"pipe\", \"pipe\"],\n\t\tenv: getInstalledAtomicEnv(),\n\t});\n\treturn result.status === 0 ? result.stdout.trim() || undefined : undefined;\n}\n\n/**\n * Whether the Atomic on PATH lists `atomic intercom upgrade` in its Intercom help. A release from before the command\n * reads `intercom upgrade` as a prompt for the model (0.9.41 and older) or rejects it (0.9.42 to 0.9.71); `--help` is\n * harmless on every release.\n */\nfunction installedListsIntercomUpgrade(): boolean {\n\tconst result = spawnProcessSync(APP_NAME, [\"intercom\", \"--help\"], {\n\t\tencoding: \"utf-8\",\n\t\tstdio: [\"ignore\", \"pipe\", \"ignore\"],\n\t\tenv: getInstalledAtomicEnv(),\n\t});\n\treturn (\n\t\tresult.status === 0 && result.stdout.split(\"\\n\").some((line) => line.trim() === `${APP_NAME} intercom upgrade`)\n\t);\n}\n\n/**\n * Ask the newly installed Atomic to retire an Intercom broker left running by the previous version, when it has the\n * command. It reads no input. The update has already succeeded, so a failure here only warns and never changes the\n * exit code.\n */\nasync function runIntercomUpgrade(): Promise<void> {\n\tif (!installedListsIntercomUpgrade()) return;\n\tconst failure = await new Promise<string | undefined>((resolve) => {\n\t\tconst child = spawnProcess(APP_NAME, [\"intercom\", \"upgrade\"], {\n\t\t\tstdio: [\"ignore\", \"inherit\", \"inherit\"],\n\t\t\tenv: getInstalledAtomicEnv(),\n\t\t});\n\t\tchild.on(\"error\", (error) => resolve(error.message));\n\t\tchild.on(\"close\", (code, signal) => {\n\t\t\tif (code === 0) resolve(undefined);\n\t\t\telse resolve(signal ? `terminated by signal ${signal}` : `exited with code ${code ?? \"unknown\"}`);\n\t\t});\n\t});\n\tif (failure) {\n\t\tconsole.error(\n\t\t\tchalk.yellow(\n\t\t\t\t`${APP_NAME} intercom upgrade ${failure}. Run \\`${APP_NAME} intercom upgrade\\` yourself if new sessions do not start.`,\n\t\t\t),\n\t\t);\n\t}\n}\n\nfunction prepareWindowsNpmSelfUpdate(): void {\n\tif (process.platform !== \"win32\") {\n\t\treturn;\n\t}\n\n\tconst packageDir = getPackageDir();\n\tcleanupWindowsSelfUpdateQuarantine(packageDir);\n\tquarantineWindowsNativeDependencies(packageDir);\n}\n\nexport interface PackageCommandRuntimeOptions {\n\textensionFactories?: InlineExtension[];\n\trefreshModelCatalogs?: (agentDir: string) => Promise<void>;\n}\n\ninterface CommandSettingsResult {\n\tsettingsManager: SettingsManager;\n\tprojectTrustWarnings: string[];\n}\n\nfunction getCommandAppMode(): AppMode {\n\treturn process.stdin.isTTY && process.stdout.isTTY ? \"interactive\" : \"print\";\n}\n\nfunction reportProjectTrustWarnings(warnings: readonly string[]): void {\n\tfor (const warning of warnings) {\n\t\tconsole.error(chalk.yellow(`Warning: ${warning}`));\n\t}\n}\n\nasync function createCommandSettingsManager(options: {\n\tcwd: string;\n\tagentDir: string;\n\tprojectTrustOverride?: boolean;\n\textensionFactories?: InlineExtension[];\n}): Promise<CommandSettingsResult> {\n\tconst settingsManager = SettingsManager.create(options.cwd, options.agentDir, { projectTrusted: false });\n\tconst projectTrustWarnings: string[] = [];\n\tconst appMode = getCommandAppMode();\n\tconst extensionsResult =\n\t\toptions.projectTrustOverride === undefined && hasProjectTrustInputs(options.cwd)\n\t\t\t? await new DefaultResourceLoader({\n\t\t\t\t\tcwd: options.cwd,\n\t\t\t\t\tagentDir: options.agentDir,\n\t\t\t\t\tsettingsManager,\n\t\t\t\t\textensionFactories: options.extensionFactories,\n\t\t\t\t}).loadProjectTrustExtensions()\n\t\t\t: undefined;\n\tfor (const error of extensionsResult?.errors ?? []) {\n\t\tprojectTrustWarnings.push(`Failed to load extension \"${error.path}\": ${error.error}`);\n\t}\n\n\tconst projectTrusted = await resolveProjectTrusted({\n\t\tcwd: options.cwd,\n\t\ttrustStore: new ProjectTrustStore(options.agentDir),\n\t\ttrustOverride: options.projectTrustOverride,\n\t\tdefaultProjectTrust: settingsManager.getDefaultProjectTrust(),\n\t\textensionsResult,\n\t\tprojectTrustContext: createProjectTrustContext({\n\t\t\tcwd: options.cwd,\n\t\t\tmode: appMode,\n\t\t\tsettingsManager,\n\t\t\thasUI: appMode === \"interactive\",\n\t\t}),\n\t\tonExtensionError: (message) => projectTrustWarnings.push(message),\n\t});\n\tsettingsManager.setProjectTrusted(projectTrusted);\n\treturn { settingsManager, projectTrustWarnings };\n}\n\nexport async function handleConfigCommand(\n\targs: string[],\n\truntimeOptions: PackageCommandRuntimeOptions = {},\n): Promise<boolean> {\n\tconst options = parseConfigCommand(args);\n\tif (!options) return false;\n\tconst usage = `${APP_NAME} config [-l] [--approve|--no-approve]`;\n\tif (options.help) {\n\t\tconsole.log(\n\t\t\t`${chalk.bold(\"Usage:\")}\\n ${usage}\\n\\nOpen the resource configuration TUI. Without -l, starts in global settings (~/${CONFIG_DIR_NAME}/agent/settings.json).\\n\\n${chalk.bold(\"Options:\")}\\n -l, --local Start in project-local settings\\n -a, --approve Trust this project\\n -na, --no-approve Do not trust this project\\n -h, --help Show this help`,\n\t\t);\n\t\treturn true;\n\t}\n\tif (options.invalidOption || options.invalidArgument) {\n\t\tconst message = options.invalidOption\n\t\t\t? `Unknown option ${options.invalidOption} for \"config\".`\n\t\t\t: `Unexpected argument ${options.invalidArgument}.`;\n\t\tconsole.error(chalk.red(message));\n\t\tconsole.error(chalk.dim(`Usage: ${usage}`));\n\t\tprocess.exitCode = 1;\n\t\treturn true;\n\t}\n\tconst cwd = process.cwd();\n\tconst agentDir = getAgentDir();\n\tconst { settingsManager, projectTrustWarnings } = await createCommandSettingsManager({\n\t\tcwd,\n\t\tagentDir,\n\t\tprojectTrustOverride: options.projectTrustOverride,\n\t\textensionFactories: runtimeOptions.extensionFactories,\n\t});\n\treportProjectTrustWarnings(projectTrustWarnings);\n\tif (options.local && !settingsManager.isProjectTrusted()) {\n\t\tconsole.error(chalk.red(\"Project is not trusted. Use --approve to modify local resource config.\"));\n\t\tprocess.exitCode = 1;\n\t\treturn true;\n\t}\n\treportSettingsErrors(settingsManager, \"config command\");\n\tconst globalManager = SettingsManager.create(cwd, agentDir, { projectTrusted: false });\n\tconst builtinExtensions = (runtimeOptions.extensionFactories ?? []).flatMap((input) =>\n\t\ttypeof input !== \"function\" && input.builtin ? [input.name] : [],\n\t);\n\tconst global = await new DefaultPackageManager({\n\t\tcwd,\n\t\tagentDir,\n\t\tsettingsManager: globalManager,\n\t\tbuiltinExtensions,\n\t}).resolve();\n\tconst project = settingsManager.isProjectTrusted()\n\t\t? await new DefaultPackageManager({ cwd, agentDir, settingsManager, builtinExtensions }).resolve()\n\t\t: global;\n\tconst installWarnings = new Set(\n\t\t[...(global.installFailures ?? []), ...(project.installFailures ?? [])].map(formatPackageInstallWarning),\n\t);\n\tfor (const warning of installWarnings) {\n\t\tconsole.error(chalk.yellow(`Warning: ${warning}`));\n\t}\n\tawait selectConfig({\n\t\tresolvedPaths: { global, project },\n\t\tsettingsManager,\n\t\tcwd,\n\t\tagentDir,\n\t\twriteScope: options.local ? \"project\" : \"global\",\n\t\tprojectModeAvailable: settingsManager.isProjectTrusted(),\n\t});\n\tprocess.exit(0);\n}\n\nexport async function handlePackageCommand(\n\targs: string[],\n\truntimeOptions: PackageCommandRuntimeOptions = {},\n): Promise<boolean> {\n\tconst options = parsePackageCommand(args);\n\tif (!options) return false;\n\tif (options.help) {\n\t\tprintPackageCommandHelp(options.command);\n\t\treturn true;\n\t}\n\tif (options.invalidOption) {\n\t\tconsole.error(chalk.red(`Unknown option ${options.invalidOption} for \"${options.command}\".`));\n\t\tconsole.error(chalk.dim(`Use \"${APP_NAME} --help\" or \"${getPackageCommandUsage(options.command)}\".`));\n\t\tprocess.exitCode = 1;\n\t\treturn true;\n\t}\n\tif (options.missingOptionValue) {\n\t\tconsole.error(chalk.red(`Missing value for ${options.missingOptionValue}.`));\n\t\tconsole.error(chalk.dim(`Usage: ${getPackageCommandUsage(options.command)}`));\n\t\tprocess.exitCode = 1;\n\t\treturn true;\n\t}\n\n\tif (options.invalidArgument) {\n\t\tconsole.error(chalk.red(`Unexpected argument ${options.invalidArgument}.`));\n\t\tconsole.error(chalk.dim(`Usage: ${getPackageCommandUsage(options.command)}`));\n\t\tprocess.exitCode = 1;\n\t\treturn true;\n\t}\n\n\tif (options.conflictingOptions) {\n\t\tconsole.error(chalk.red(options.conflictingOptions));\n\t\tconsole.error(chalk.dim(`Usage: ${getPackageCommandUsage(options.command)}`));\n\t\tprocess.exitCode = 1;\n\t\treturn true;\n\t}\n\n\tconst source = options.source;\n\tif ((options.command === \"install\" || options.command === \"remove\") && !source) {\n\t\tconsole.error(chalk.red(`Missing ${options.command} source.`));\n\t\tconsole.error(chalk.dim(`Usage: ${getPackageCommandUsage(options.command)}`));\n\t\tprocess.exitCode = 1;\n\t\treturn true;\n\t}\n\n\tconst cwd = process.cwd();\n\tconst agentDir = getAgentDir();\n\tconst writesProjectPackageConfig = (options.command === \"install\" || options.command === \"remove\") && options.local;\n\tconst { settingsManager, projectTrustWarnings } = await createCommandSettingsManager({\n\t\tcwd,\n\t\tagentDir,\n\t\tprojectTrustOverride: options.projectTrustOverride,\n\t\textensionFactories: runtimeOptions.extensionFactories,\n\t});\n\treportProjectTrustWarnings(projectTrustWarnings);\n\tif (!settingsManager.isProjectTrusted() && writesProjectPackageConfig) {\n\t\tconsole.error(chalk.red(\"Project is not trusted. Use --approve to modify local package config.\"));\n\t\tprocess.exitCode = 1;\n\t\treturn true;\n\t}\n\treportSettingsErrors(settingsManager, \"package command\");\n\tconst selfUpdateNpmCommand = settingsManager.getGlobalSettings().npmCommand;\n\n\tconst packageManager = new DefaultPackageManager({ cwd, agentDir, settingsManager });\n\n\t// Update result events describe a changed package, e.g. \"npm:foo 1.2.0 -> 1.3.0\".\n\tconst updatedPackages: string[] = [];\n\t// Progress messages are warnings, e.g. npm reinstalled the old version from stale registry metadata.\n\tlet warningCount = 0;\n\tpackageManager.setProgressCallback((event) => {\n\t\tif (event.type === \"result\" && event.action === \"update\" && event.message) {\n\t\t\tupdatedPackages.push(event.message);\n\t\t} else if (event.type === \"start\") {\n\t\t\tprocess.stdout.write(chalk.dim(`${event.message}\\n`));\n\t\t} else if (event.type === \"progress\" && event.message) {\n\t\t\twarningCount++;\n\t\t\tprocess.stdout.write(chalk.yellow(`${event.message}\\n`));\n\t\t}\n\t});\n\n\ttry {\n\t\tswitch (options.command) {\n\t\t\tcase \"install\":\n\t\t\t\tawait packageManager.installAndPersist(source!, { local: options.local });\n\t\t\t\tconsole.log(chalk.green(`Installed ${source}`));\n\t\t\t\treturn true;\n\n\t\t\tcase \"remove\": {\n\t\t\t\tconst removed = await packageManager.removeAndPersist(source!, { local: options.local });\n\t\t\t\tif (!removed) {\n\t\t\t\t\tconsole.error(chalk.red(`No matching package found for ${source}`));\n\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tconsole.log(chalk.green(`Removed ${source}`));\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tcase \"list\": {\n\t\t\t\tconst configuredPackages = packageManager.listConfiguredPackages();\n\t\t\t\tconst userPackages = configuredPackages.filter((pkg) => pkg.scope === \"user\");\n\t\t\t\tconst projectPackages = configuredPackages.filter((pkg) => pkg.scope === \"project\");\n\n\t\t\t\tif (configuredPackages.length === 0) {\n\t\t\t\t\tconsole.log(chalk.dim(\"No packages installed.\"));\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\tconst formatPackage = (pkg: (typeof configuredPackages)[number]) => {\n\t\t\t\t\tconst display = pkg.filtered ? `${pkg.source} (filtered)` : pkg.source;\n\t\t\t\t\tconsole.log(` ${display}`);\n\t\t\t\t\tif (pkg.installedPath) {\n\t\t\t\t\t\tconsole.log(chalk.dim(` ${pkg.installedPath}`));\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\tif (userPackages.length > 0) {\n\t\t\t\t\tconsole.log(chalk.bold(\"User packages:\"));\n\t\t\t\t\tfor (const pkg of userPackages) {\n\t\t\t\t\t\tformatPackage(pkg);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (projectPackages.length > 0) {\n\t\t\t\t\tif (userPackages.length > 0) console.log();\n\t\t\t\t\tconsole.log(chalk.bold(\"Project packages:\"));\n\t\t\t\t\tfor (const pkg of projectPackages) {\n\t\t\t\t\t\tformatPackage(pkg);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tcase \"update\": {\n\t\t\t\tconst target = options.updateTarget ?? { type: \"self\" };\n\t\t\t\tif (target.type === \"models\") {\n\t\t\t\t\tif (runtimeOptions.refreshModelCatalogs) {\n\t\t\t\t\t\tawait runtimeOptions.refreshModelCatalogs(agentDir);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tawait refreshModelCatalogs(agentDir, {\n\t\t\t\t\t\t\tcwd,\n\t\t\t\t\t\t\tsettingsManager,\n\t\t\t\t\t\t\textensionFactories: runtimeOptions.extensionFactories,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tconsole.log(chalk.green(\"Model catalogs refreshed\"));\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (options.showExtensionsSkippedNote) {\n\t\t\t\t\tconsole.log(\n\t\t\t\t\t\tchalk.dim(`Extensions are skipped. Run ${APP_NAME} update --extensions to update extensions.`),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (updateTargetIncludesExtensions(target)) {\n\t\t\t\t\tconst updateSource = target.type === \"extensions\" ? target.source : undefined;\n\t\t\t\t\tawait packageManager.update(updateSource);\n\t\t\t\t\t// Only claim \"up to date\" when the update actually checked and nothing warned.\n\t\t\t\t\tif (isOfflineModeEnabled()) {\n\t\t\t\t\t\tconsole.log(chalk.yellow(\"Skipped package updates (offline mode)\"));\n\t\t\t\t\t} else if (updatedPackages.length === 0 && warningCount > 0) {\n\t\t\t\t\t\tconsole.log(\n\t\t\t\t\t\t\tchalk.yellow(\n\t\t\t\t\t\t\t\tupdateSource\n\t\t\t\t\t\t\t\t\t? `${updateSource} was not updated, see the warnings above`\n\t\t\t\t\t\t\t\t\t: \"No packages were updated, see the warnings above\",\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t} else if (updatedPackages.length === 0) {\n\t\t\t\t\t\tconsole.log(\n\t\t\t\t\t\t\tchalk.green(\n\t\t\t\t\t\t\t\tupdateSource ? `${updateSource} is already up to date` : \"Packages are already up to date\",\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst count = updatedPackages.length;\n\t\t\t\t\t\tconsole.log(chalk.green(`Updated ${count} package${count === 1 ? \"\" : \"s\"}:`));\n\t\t\t\t\t\tfor (const message of updatedPackages) {\n\t\t\t\t\t\t\tconsole.log(` ${message}`);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (updateTargetIncludesSelf(target)) {\n\t\t\t\t\tconst selfUpdatePlan = await resolveSelfUpdatePlan(options.force);\n\t\t\t\t\tif (!selfUpdatePlan.shouldRun) {\n\t\t\t\t\t\tconsole.log(chalk.green(`${APP_NAME} is already up to date (v${VERSION})`));\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\t// A configured command is explicit user intent, so it replaces install-method detection.\n\t\t\t\t\tconst configuredSelfUpdateArgv = getConfiguredSelfUpdateArgv(\n\t\t\t\t\t\tsettingsManager.getGlobalSettings().selfUpdateCommand,\n\t\t\t\t\t);\n\t\t\t\t\tif (configuredSelfUpdateArgv) {\n\t\t\t\t\t\tawait runConfiguredSelfUpdate(configuredSelfUpdateArgv, selfUpdatePlan);\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\tconst installMethod = detectInstallMethod();\n\t\t\t\t\tif (process.platform === \"win32\" && installMethod !== \"npm\" && installMethod !== \"pnpm\") {\n\t\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t\tchalk.red(`${APP_NAME} self-update on Windows is only supported for npm and pnpm installs.`),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconsole.error(chalk.dim(`Detected install method: ${installMethod}. Update ${APP_NAME} manually.`));\n\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\tconst selfUpdateTarget = {\n\t\t\t\t\t\tpackageName: selfUpdatePlan.packageName,\n\t\t\t\t\t\tinstallSpec: selfUpdatePlan.installSpec,\n\t\t\t\t\t};\n\t\t\t\t\tconst selfUpdateCommand = getSelfUpdateCommand(PACKAGE_NAME, selfUpdateNpmCommand, selfUpdateTarget);\n\t\t\t\t\tif (!selfUpdateCommand) {\n\t\t\t\t\t\tprintSelfUpdateUnavailable(selfUpdateNpmCommand, selfUpdateTarget);\n\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\tif (selfUpdatePlan.note) printSelfUpdateNote(selfUpdatePlan.note);\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (installMethod === \"npm\") {\n\t\t\t\t\t\t\tprepareWindowsNpmSelfUpdate();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tawait runSelfUpdate(selfUpdateCommand);\n\t\t\t\t\t} catch (error: unknown) {\n\t\t\t\t\t\tconst message = error instanceof Error ? error.message : \"Unknown package command error\";\n\t\t\t\t\t\tconsole.error(chalk.red(`Error: ${message}`));\n\t\t\t\t\t\tprintSelfUpdateFallback(selfUpdateCommand);\n\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\tconsole.log(chalk.green(`Updated ${APP_NAME} from ${VERSION} to ${selfUpdatePlan.version}`));\n\t\t\t\t\tconst installedVersion = readVersionOnPath();\n\t\t\t\t\tif (installedVersion === selfUpdatePlan.version) await runIntercomUpgrade();\n\t\t\t\t\telse\n\t\t\t\t\t\tconsole.log(\n\t\t\t\t\t\t\tchalk.dim(\n\t\t\t\t\t\t\t\t`\\`${APP_NAME} --version\\` on PATH reports ${installedVersion ?? \"no version\"}, not ${selfUpdatePlan.version}, so the Intercom broker was left as it is; run \\`${APP_NAME} intercom upgrade\\` with the new version.`,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t} catch (error: unknown) {\n\t\tconst message = error instanceof Error ? error.message : \"Unknown package command error\";\n\t\tconsole.error(chalk.red(`Error: ${message}`));\n\t\tprocess.exitCode = 1;\n\t\treturn true;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"package-manager-cli.js","sourceRoot":"","sources":["../src/package-manager-cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EACN,QAAQ,EACR,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,uBAAuB,EACvB,mBAAmB,EACnB,WAAW,EACX,2BAA2B,EAC3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QAAQ,gCAAgC,gBAAgB,IAAI,YAAY,SAAS,cAAc,CAAC,OAAO,qDAAqD,QAAQ,2CAA2C,CACpN,CACD,CAAC;gBACJ,CAAC;gBACD,OAAO,IAAI,CAAC;YACb,CAAC;QACF,CAAC;IACF,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACzB,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,+BAA+B,CAAC;QACzF,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,OAAO,EAAE,CAAC,CAAC,CAAC;QAC9C,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACrB,OAAO,IAAI,CAAC;IACb,CAAC;AACF,CAAC","sourcesContent":["import { join } from \"node:path\";\nimport { ModelsError } from \"@bastani/pi-ai\";\nimport chalk from \"chalk\";\nimport { selectConfig } from \"./cli/config-selector.ts\";\nimport { createProjectTrustContext } from \"./cli/project-trust.ts\";\nimport {\n\tAPP_NAME,\n\tCONFIG_DIR_NAME,\n\tdetectInstallChange,\n\tdetectInstallMethod,\n\tENV_PACKAGE_DIR,\n\tENV_SELF_UPDATE_COMMAND,\n\tgetAgentConfigPaths,\n\tgetAgentDir,\n\tgetConfiguredSelfUpdateArgv,\n\tgetEnvNames,\n\tgetPackageDir,\n\tgetSelfUpdateCommand,\n\tgetSelfUpdateUnavailableInstruction,\n\tmakeConfiguredSelfUpdateCommand,\n\tPACKAGE_NAME,\n\ttype SelfUpdateCommand,\n\ttype SelfUpdateTarget,\n\tVERSION,\n} from \"./config.js\";\nimport { parseConfigCommand } from \"./config-command-parser.ts\";\nimport { AuthStorage } from \"./core/auth-storage.ts\";\nimport type { InlineExtension } from \"./core/extensions/types.ts\";\nimport { ModelRuntime } from \"./core/model-runtime.js\";\nimport { DefaultPackageManager } from \"./core/package-manager.ts\";\nimport { isOfflineModeEnabled } from \"./core/package-manager-env.ts\";\nimport { type AppMode, resolveProjectTrusted } from \"./core/project-trust.ts\";\nimport { DefaultResourceLoader } from \"./core/resource-loader.ts\";\nimport { formatPackageInstallWarning } from \"./core/resource-loader-extension-warnings.ts\";\nimport { SettingsManager } from \"./core/settings-manager.ts\";\nimport { hasProjectTrustInputs, ProjectTrustStore } from \"./core/trust-manager.ts\";\nimport {\n\tgetPackageCommandUsage,\n\tparsePackageCommand,\n\tprintPackageCommandHelp,\n\ttype UpdateTarget,\n} from \"./package-manager-cli-parser.ts\";\nimport { renderSelfUpdateNote, resolveSelfUpdatePlan, type SelfUpdatePlan } from \"./self-update-plan.ts\";\nimport { spawnProcess, spawnProcessSync } from \"./utils/child-process.ts\";\nimport {\n\tcleanupWindowsSelfUpdateQuarantine,\n\tquarantineWindowsNativeDependencies,\n} from \"./utils/windows-self-update.ts\";\n\nfunction reportSettingsErrors(settingsManager: SettingsManager, context: string): void {\n\tconst errors = settingsManager.drainErrors();\n\tfor (const { scope, error } of errors) {\n\t\tconsole.error(chalk.yellow(`Warning (${context}, ${scope} settings): ${error.message}`));\n\t\tif (error.stack) {\n\t\t\tconsole.error(chalk.dim(error.stack));\n\t\t}\n\t}\n}\n\nfunction updateTargetIncludesSelf(target: UpdateTarget): boolean {\n\treturn target.type === \"all\" || target.type === \"self\";\n}\n\nfunction updateTargetIncludesExtensions(target: UpdateTarget): boolean {\n\treturn target.type === \"all\" || target.type === \"extensions\";\n}\n\nexport async function refreshModelCatalogs(\n\tagentDir: string,\n\toptions: { cwd?: string; settingsManager?: SettingsManager; extensionFactories?: InlineExtension[] } = {},\n): Promise<void> {\n\tconst controller = new AbortController();\n\tconst timeout = setTimeout(() => controller.abort(), 15_000);\n\tconst aborted = new Promise<null>((resolve) => {\n\t\tcontroller.signal.addEventListener(\"abort\", () => resolve(null), { once: true });\n\t});\n\ttry {\n\t\tconst cwd = options.cwd ?? process.cwd();\n\t\tconst settingsManager =\n\t\t\toptions.settingsManager ?? SettingsManager.create(cwd, agentDir, { projectTrusted: true });\n\t\tconst resourceLoader = new DefaultResourceLoader({\n\t\t\tcwd,\n\t\t\tagentDir,\n\t\t\tsettingsManager,\n\t\t\textensionFactories: options.extensionFactories,\n\t\t\tnoSkills: true,\n\t\t\tnoPromptTemplates: true,\n\t\t\tnoThemes: true,\n\t\t});\n\t\tconst loaded = await Promise.race([resourceLoader.reload().then(() => true), aborted]);\n\t\tif (!loaded) throw new Error(\"Model catalog refresh timed out.\");\n\t\tconst authPaths = [join(agentDir, \"auth.json\"), ...getAgentConfigPaths(\"auth.json\")].filter(\n\t\t\t(path, index, paths) => paths.indexOf(path) === index,\n\t\t);\n\t\tconst modelRuntime = await ModelRuntime.create({\n\t\t\tcredentials: AuthStorage.create(authPaths),\n\t\t\tmodelsPath: join(agentDir, \"models.json\"),\n\t\t});\n\t\tconst extensionsResult = resourceLoader.getExtensions();\n\t\tif (extensionsResult.errors.length > 0) {\n\t\t\tconst details = extensionsResult.errors.map(({ path, error }) => `${path}: ${error}`).join(\"; \");\n\t\t\tthrow new Error(`Could not load extensions for model catalog refresh: ${details}`);\n\t\t}\n\t\tfor (const registration of extensionsResult.runtime.pendingProviderRegistrations) {\n\t\t\tif (\"provider\" in registration) modelRuntime.registerNativeProvider(registration.provider);\n\t\t\telse modelRuntime.registerProvider(registration.name, registration.config);\n\t\t}\n\t\tconst refresh = modelRuntime.refresh({ allowNetwork: true, force: true, signal: controller.signal });\n\t\tconst result = await Promise.race([refresh, aborted]);\n\t\tif (!result || result.aborted) throw new Error(\"Model catalog refresh timed out.\");\n\t\tconst failures: string[] = [];\n\t\tfor (const [provider, error] of result.errors) {\n\t\t\tif (error instanceof ModelsError && error.code === \"oauth\") {\n\t\t\t\tconsole.warn(\n\t\t\t\t\tchalk.yellow(\n\t\t\t\t\t\t`Warning: skipped model catalog for ${provider}: ${error.message}\\nLog in again with \\`${APP_NAME} auth login ${provider}\\` to refresh it.`,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tfailures.push(`${provider}: ${error.message}`);\n\t\t\t}\n\t\t}\n\t\tif (failures.length > 0) {\n\t\t\tthrow new Error(`Could not refresh model catalogs: ${failures.join(\"; \")}`);\n\t\t}\n\t} finally {\n\t\tclearTimeout(timeout);\n\t}\n}\n\nfunction printSelfUpdateUnavailable(npmCommand: string[] | undefined, updateTarget: SelfUpdateTarget): void {\n\tconsole.error(`error: ${APP_NAME} cannot self-update this installation.`);\n\tconsole.error(getSelfUpdateUnavailableInstruction(PACKAGE_NAME, npmCommand, updateTarget));\n\tconsole.error(\n\t\t`To make \\`${APP_NAME} update\\` run your own update command, set ${ENV_SELF_UPDATE_COMMAND} or the selfUpdateCommand setting.`,\n\t);\n\tconst entrypoint = process.argv[1];\n\tif (entrypoint) {\n\t\tconsole.error(\"\");\n\t\tconsole.error(`Location of ${APP_NAME} executable: ${entrypoint}`);\n\t}\n}\n\nfunction printSelfUpdateFallback(command: SelfUpdateCommand): void {\n\tconsole.error(chalk.dim(`If this keeps failing, run this command yourself: ${command.display}`));\n}\n\nfunction printSelfUpdateNote(note: string): void {\n\tconst rendered = renderSelfUpdateNote(note);\n\tif (!rendered) return;\n\tconsole.log(`\\n${chalk.bold(chalk.yellow(\"Update note\"))}`);\n\tconsole.log(rendered);\n\tconsole.log();\n}\n\nasync function runSelfUpdate(command: SelfUpdateCommand): Promise<void> {\n\tconsole.log(chalk.dim(`Updating ${APP_NAME} with ${command.display}...`));\n\tfor (const step of command.steps ?? [command]) {\n\t\tawait new Promise<void>((resolve, reject) => {\n\t\t\tconst child = spawnProcess(step.command, step.args, {\n\t\t\t\tstdio: \"inherit\",\n\t\t\t});\n\t\t\tchild.on(\"error\", (error) => {\n\t\t\t\treject(error);\n\t\t\t});\n\t\t\tchild.on(\"close\", (code, signal) => {\n\t\t\t\tif (code === 0) {\n\t\t\t\t\tresolve();\n\t\t\t\t} else if (signal) {\n\t\t\t\t\treject(new Error(`${step.display} terminated by signal ${signal}`));\n\t\t\t\t} else {\n\t\t\t\t\treject(new Error(`${step.display} exited with code ${code ?? \"unknown\"}`));\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n}\n\n/** Run the user-configured self-update command, then report the version installed on disk. */\nasync function runConfiguredSelfUpdate(argv: string[], plan: SelfUpdatePlan): Promise<void> {\n\tconst command = makeConfiguredSelfUpdateCommand(argv, plan);\n\tif (plan.note) printSelfUpdateNote(plan.note);\n\ttry {\n\t\tawait runSelfUpdate(command);\n\t} catch (error: unknown) {\n\t\tconst message = error instanceof Error ? error.message : \"Unknown self-update command error\";\n\t\tconsole.error(chalk.red(`Error: ${message}`));\n\t\tprocess.exitCode = 1;\n\t\treturn;\n\t}\n\t// Exit code 0 does not prove an update. Wrappers such as mise or Nix install each version into a new\n\t// directory and leave this installation untouched, so fall back to the executable on PATH.\n\tconst change = detectInstallChange();\n\tconst installedVersion =\n\t\tchange?.kind === \"updated\" && change.version === plan.version ? change.version : readVersionOnPath();\n\tif (installedVersion === plan.version) {\n\t\tconsole.log(chalk.green(`Updated ${APP_NAME} from ${VERSION} to ${plan.version}`));\n\t\tawait runIntercomUpgrade();\n\t\treturn;\n\t}\n\tconsole.log(\n\t\tchalk.yellow(\n\t\t\t`Ran ${command.display}, but \\`${APP_NAME} --version\\` reports ${installedVersion ?? \"no version\"}, not ${plan.version}.`,\n\t\t),\n\t);\n}\n\n/** The environment for running the Atomic on PATH, the Atomic the user runs next. */\nfunction getInstalledAtomicEnv(): NodeJS.ProcessEnv {\n\t// The package directory override points at this installation and would make the new Atomic act as the old one.\n\tconst env = { ...process.env };\n\tfor (const name of getEnvNames(ENV_PACKAGE_DIR)) delete env[name];\n\treturn env;\n}\n\n/** Version printed by `atomic --version` as resolved from PATH, the Atomic the user runs next. */\nfunction readVersionOnPath(): string | undefined {\n\tconst result = spawnProcessSync(APP_NAME, [\"--version\"], {\n\t\tencoding: \"utf-8\",\n\t\tstdio: [\"ignore\", \"pipe\", \"pipe\"],\n\t\tenv: getInstalledAtomicEnv(),\n\t});\n\treturn result.status === 0 ? result.stdout.trim() || undefined : undefined;\n}\n\n/**\n * Whether the Atomic on PATH lists `atomic intercom upgrade` in its Intercom help. A release from before the command\n * reads `intercom upgrade` as a prompt for the model (0.9.41 and older) or rejects it (0.9.42 to 0.9.71); `--help` is\n * harmless on every release.\n */\nfunction installedListsIntercomUpgrade(): boolean {\n\tconst result = spawnProcessSync(APP_NAME, [\"intercom\", \"--help\"], {\n\t\tencoding: \"utf-8\",\n\t\tstdio: [\"ignore\", \"pipe\", \"ignore\"],\n\t\tenv: getInstalledAtomicEnv(),\n\t});\n\treturn (\n\t\tresult.status === 0 && result.stdout.split(\"\\n\").some((line) => line.trim() === `${APP_NAME} intercom upgrade`)\n\t);\n}\n\n/**\n * Ask the newly installed Atomic to retire an Intercom broker left running by the previous version, when it has the\n * command. It reads no input. The update has already succeeded, so a failure here only warns and never changes the\n * exit code.\n */\nasync function runIntercomUpgrade(): Promise<void> {\n\tif (!installedListsIntercomUpgrade()) return;\n\tconst failure = await new Promise<string | undefined>((resolve) => {\n\t\tconst child = spawnProcess(APP_NAME, [\"intercom\", \"upgrade\"], {\n\t\t\tstdio: [\"ignore\", \"inherit\", \"inherit\"],\n\t\t\tenv: getInstalledAtomicEnv(),\n\t\t});\n\t\tchild.on(\"error\", (error) => resolve(error.message));\n\t\tchild.on(\"close\", (code, signal) => {\n\t\t\tif (code === 0) resolve(undefined);\n\t\t\telse resolve(signal ? `terminated by signal ${signal}` : `exited with code ${code ?? \"unknown\"}`);\n\t\t});\n\t});\n\tif (failure) {\n\t\tconsole.error(\n\t\t\tchalk.yellow(\n\t\t\t\t`${APP_NAME} intercom upgrade ${failure}. Run \\`${APP_NAME} intercom upgrade\\` yourself if new sessions do not start.`,\n\t\t\t),\n\t\t);\n\t}\n}\n\nfunction prepareWindowsNpmSelfUpdate(): void {\n\tif (process.platform !== \"win32\") {\n\t\treturn;\n\t}\n\n\tconst packageDir = getPackageDir();\n\tcleanupWindowsSelfUpdateQuarantine(packageDir);\n\tquarantineWindowsNativeDependencies(packageDir);\n}\n\nexport interface PackageCommandRuntimeOptions {\n\textensionFactories?: InlineExtension[];\n\trefreshModelCatalogs?: (agentDir: string) => Promise<void>;\n}\n\ninterface CommandSettingsResult {\n\tsettingsManager: SettingsManager;\n\tprojectTrustWarnings: string[];\n}\n\nfunction getCommandAppMode(): AppMode {\n\treturn process.stdin.isTTY && process.stdout.isTTY ? \"interactive\" : \"print\";\n}\n\nfunction reportProjectTrustWarnings(warnings: readonly string[]): void {\n\tfor (const warning of warnings) {\n\t\tconsole.error(chalk.yellow(`Warning: ${warning}`));\n\t}\n}\n\nasync function createCommandSettingsManager(options: {\n\tcwd: string;\n\tagentDir: string;\n\tprojectTrustOverride?: boolean;\n\textensionFactories?: InlineExtension[];\n}): Promise<CommandSettingsResult> {\n\tconst settingsManager = SettingsManager.create(options.cwd, options.agentDir, { projectTrusted: false });\n\tconst projectTrustWarnings: string[] = [];\n\tconst appMode = getCommandAppMode();\n\tconst extensionsResult =\n\t\toptions.projectTrustOverride === undefined && hasProjectTrustInputs(options.cwd)\n\t\t\t? await new DefaultResourceLoader({\n\t\t\t\t\tcwd: options.cwd,\n\t\t\t\t\tagentDir: options.agentDir,\n\t\t\t\t\tsettingsManager,\n\t\t\t\t\textensionFactories: options.extensionFactories,\n\t\t\t\t}).loadProjectTrustExtensions()\n\t\t\t: undefined;\n\tfor (const error of extensionsResult?.errors ?? []) {\n\t\tprojectTrustWarnings.push(`Failed to load extension \"${error.path}\": ${error.error}`);\n\t}\n\n\tconst projectTrusted = await resolveProjectTrusted({\n\t\tcwd: options.cwd,\n\t\ttrustStore: new ProjectTrustStore(options.agentDir),\n\t\ttrustOverride: options.projectTrustOverride,\n\t\tdefaultProjectTrust: settingsManager.getDefaultProjectTrust(),\n\t\textensionsResult,\n\t\tprojectTrustContext: createProjectTrustContext({\n\t\t\tcwd: options.cwd,\n\t\t\tmode: appMode,\n\t\t\tsettingsManager,\n\t\t\thasUI: appMode === \"interactive\",\n\t\t}),\n\t\tonExtensionError: (message) => projectTrustWarnings.push(message),\n\t});\n\tsettingsManager.setProjectTrusted(projectTrusted);\n\treturn { settingsManager, projectTrustWarnings };\n}\n\nexport async function handleConfigCommand(\n\targs: string[],\n\truntimeOptions: PackageCommandRuntimeOptions = {},\n): Promise<boolean> {\n\tconst options = parseConfigCommand(args);\n\tif (!options) return false;\n\tconst usage = `${APP_NAME} config [-l] [--approve|--no-approve]`;\n\tif (options.help) {\n\t\tconsole.log(\n\t\t\t`${chalk.bold(\"Usage:\")}\\n ${usage}\\n\\nOpen the resource configuration TUI. Without -l, starts in global settings (~/${CONFIG_DIR_NAME}/agent/settings.json).\\n\\n${chalk.bold(\"Options:\")}\\n -l, --local Start in project-local settings\\n -a, --approve Trust this project\\n -na, --no-approve Do not trust this project\\n -h, --help Show this help`,\n\t\t);\n\t\treturn true;\n\t}\n\tif (options.invalidOption || options.invalidArgument) {\n\t\tconst message = options.invalidOption\n\t\t\t? `Unknown option ${options.invalidOption} for \"config\".`\n\t\t\t: `Unexpected argument ${options.invalidArgument}.`;\n\t\tconsole.error(chalk.red(message));\n\t\tconsole.error(chalk.dim(`Usage: ${usage}`));\n\t\tprocess.exitCode = 1;\n\t\treturn true;\n\t}\n\tconst cwd = process.cwd();\n\tconst agentDir = getAgentDir();\n\tconst { settingsManager, projectTrustWarnings } = await createCommandSettingsManager({\n\t\tcwd,\n\t\tagentDir,\n\t\tprojectTrustOverride: options.projectTrustOverride,\n\t\textensionFactories: runtimeOptions.extensionFactories,\n\t});\n\treportProjectTrustWarnings(projectTrustWarnings);\n\tif (options.local && !settingsManager.isProjectTrusted()) {\n\t\tconsole.error(chalk.red(\"Project is not trusted. Use --approve to modify local resource config.\"));\n\t\tprocess.exitCode = 1;\n\t\treturn true;\n\t}\n\treportSettingsErrors(settingsManager, \"config command\");\n\tconst globalManager = SettingsManager.create(cwd, agentDir, { projectTrusted: false });\n\tconst builtinExtensions = (runtimeOptions.extensionFactories ?? []).flatMap((input) =>\n\t\ttypeof input !== \"function\" && input.builtin ? [input.name] : [],\n\t);\n\tconst global = await new DefaultPackageManager({\n\t\tcwd,\n\t\tagentDir,\n\t\tsettingsManager: globalManager,\n\t\tbuiltinExtensions,\n\t}).resolve();\n\tconst project = settingsManager.isProjectTrusted()\n\t\t? await new DefaultPackageManager({ cwd, agentDir, settingsManager, builtinExtensions }).resolve()\n\t\t: global;\n\tconst installWarnings = new Set(\n\t\t[...(global.installFailures ?? []), ...(project.installFailures ?? [])].map(formatPackageInstallWarning),\n\t);\n\tfor (const warning of installWarnings) {\n\t\tconsole.error(chalk.yellow(`Warning: ${warning}`));\n\t}\n\tawait selectConfig({\n\t\tresolvedPaths: { global, project },\n\t\tsettingsManager,\n\t\tcwd,\n\t\tagentDir,\n\t\twriteScope: options.local ? \"project\" : \"global\",\n\t\tprojectModeAvailable: settingsManager.isProjectTrusted(),\n\t});\n\tprocess.exit(0);\n}\n\nexport async function handlePackageCommand(\n\targs: string[],\n\truntimeOptions: PackageCommandRuntimeOptions = {},\n): Promise<boolean> {\n\tconst options = parsePackageCommand(args);\n\tif (!options) return false;\n\tif (options.help) {\n\t\tprintPackageCommandHelp(options.command);\n\t\treturn true;\n\t}\n\tif (options.invalidOption) {\n\t\tconsole.error(chalk.red(`Unknown option ${options.invalidOption} for \"${options.command}\".`));\n\t\tconsole.error(chalk.dim(`Use \"${APP_NAME} --help\" or \"${getPackageCommandUsage(options.command)}\".`));\n\t\tprocess.exitCode = 1;\n\t\treturn true;\n\t}\n\tif (options.missingOptionValue) {\n\t\tconsole.error(chalk.red(`Missing value for ${options.missingOptionValue}.`));\n\t\tconsole.error(chalk.dim(`Usage: ${getPackageCommandUsage(options.command)}`));\n\t\tprocess.exitCode = 1;\n\t\treturn true;\n\t}\n\n\tif (options.invalidArgument) {\n\t\tconsole.error(chalk.red(`Unexpected argument ${options.invalidArgument}.`));\n\t\tconsole.error(chalk.dim(`Usage: ${getPackageCommandUsage(options.command)}`));\n\t\tprocess.exitCode = 1;\n\t\treturn true;\n\t}\n\n\tif (options.conflictingOptions) {\n\t\tconsole.error(chalk.red(options.conflictingOptions));\n\t\tconsole.error(chalk.dim(`Usage: ${getPackageCommandUsage(options.command)}`));\n\t\tprocess.exitCode = 1;\n\t\treturn true;\n\t}\n\n\tconst source = options.source;\n\tif ((options.command === \"install\" || options.command === \"remove\") && !source) {\n\t\tconsole.error(chalk.red(`Missing ${options.command} source.`));\n\t\tconsole.error(chalk.dim(`Usage: ${getPackageCommandUsage(options.command)}`));\n\t\tprocess.exitCode = 1;\n\t\treturn true;\n\t}\n\n\tconst cwd = process.cwd();\n\tconst agentDir = getAgentDir();\n\tconst writesProjectPackageConfig = (options.command === \"install\" || options.command === \"remove\") && options.local;\n\tconst { settingsManager, projectTrustWarnings } = await createCommandSettingsManager({\n\t\tcwd,\n\t\tagentDir,\n\t\tprojectTrustOverride: options.projectTrustOverride,\n\t\textensionFactories: runtimeOptions.extensionFactories,\n\t});\n\treportProjectTrustWarnings(projectTrustWarnings);\n\tif (!settingsManager.isProjectTrusted() && writesProjectPackageConfig) {\n\t\tconsole.error(chalk.red(\"Project is not trusted. Use --approve to modify local package config.\"));\n\t\tprocess.exitCode = 1;\n\t\treturn true;\n\t}\n\treportSettingsErrors(settingsManager, \"package command\");\n\tconst selfUpdateNpmCommand = settingsManager.getGlobalSettings().npmCommand;\n\n\tconst packageManager = new DefaultPackageManager({ cwd, agentDir, settingsManager });\n\n\t// Update result events describe a changed package, e.g. \"npm:foo 1.2.0 -> 1.3.0\".\n\tconst updatedPackages: string[] = [];\n\t// Progress messages are warnings, e.g. npm reinstalled the old version from stale registry metadata.\n\tlet warningCount = 0;\n\tpackageManager.setProgressCallback((event) => {\n\t\tif (event.type === \"result\" && event.action === \"update\" && event.message) {\n\t\t\tupdatedPackages.push(event.message);\n\t\t} else if (event.type === \"start\") {\n\t\t\tprocess.stdout.write(chalk.dim(`${event.message}\\n`));\n\t\t} else if (event.type === \"progress\" && event.message) {\n\t\t\twarningCount++;\n\t\t\tprocess.stdout.write(chalk.yellow(`${event.message}\\n`));\n\t\t}\n\t});\n\n\ttry {\n\t\tswitch (options.command) {\n\t\t\tcase \"install\":\n\t\t\t\tawait packageManager.installAndPersist(source!, { local: options.local });\n\t\t\t\tconsole.log(chalk.green(`Installed ${source}`));\n\t\t\t\treturn true;\n\n\t\t\tcase \"remove\": {\n\t\t\t\tconst removed = await packageManager.removeAndPersist(source!, { local: options.local });\n\t\t\t\tif (!removed) {\n\t\t\t\t\tconsole.error(chalk.red(`No matching package found for ${source}`));\n\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tconsole.log(chalk.green(`Removed ${source}`));\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tcase \"list\": {\n\t\t\t\tconst configuredPackages = packageManager.listConfiguredPackages();\n\t\t\t\tconst userPackages = configuredPackages.filter((pkg) => pkg.scope === \"user\");\n\t\t\t\tconst projectPackages = configuredPackages.filter((pkg) => pkg.scope === \"project\");\n\n\t\t\t\tif (configuredPackages.length === 0) {\n\t\t\t\t\tconsole.log(chalk.dim(\"No packages installed.\"));\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\tconst formatPackage = (pkg: (typeof configuredPackages)[number]) => {\n\t\t\t\t\tconst display = pkg.filtered ? `${pkg.source} (filtered)` : pkg.source;\n\t\t\t\t\tconsole.log(` ${display}`);\n\t\t\t\t\tif (pkg.installedPath) {\n\t\t\t\t\t\tconsole.log(chalk.dim(` ${pkg.installedPath}`));\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\tif (userPackages.length > 0) {\n\t\t\t\t\tconsole.log(chalk.bold(\"User packages:\"));\n\t\t\t\t\tfor (const pkg of userPackages) {\n\t\t\t\t\t\tformatPackage(pkg);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (projectPackages.length > 0) {\n\t\t\t\t\tif (userPackages.length > 0) console.log();\n\t\t\t\t\tconsole.log(chalk.bold(\"Project packages:\"));\n\t\t\t\t\tfor (const pkg of projectPackages) {\n\t\t\t\t\t\tformatPackage(pkg);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tcase \"update\": {\n\t\t\t\tconst target = options.updateTarget ?? { type: \"self\" };\n\t\t\t\tif (target.type === \"models\") {\n\t\t\t\t\tif (runtimeOptions.refreshModelCatalogs) {\n\t\t\t\t\t\tawait runtimeOptions.refreshModelCatalogs(agentDir);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tawait refreshModelCatalogs(agentDir, {\n\t\t\t\t\t\t\tcwd,\n\t\t\t\t\t\t\tsettingsManager,\n\t\t\t\t\t\t\textensionFactories: runtimeOptions.extensionFactories,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tconsole.log(chalk.green(\"Model catalogs refreshed\"));\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (options.showExtensionsSkippedNote) {\n\t\t\t\t\tconsole.log(\n\t\t\t\t\t\tchalk.dim(`Extensions are skipped. Run ${APP_NAME} update --extensions to update extensions.`),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (updateTargetIncludesExtensions(target)) {\n\t\t\t\t\tconst updateSource = target.type === \"extensions\" ? target.source : undefined;\n\t\t\t\t\tawait packageManager.update(updateSource);\n\t\t\t\t\t// Only claim \"up to date\" when the update actually checked and nothing warned.\n\t\t\t\t\tif (isOfflineModeEnabled()) {\n\t\t\t\t\t\tconsole.log(chalk.yellow(\"Skipped package updates (offline mode)\"));\n\t\t\t\t\t} else if (updatedPackages.length === 0 && warningCount > 0) {\n\t\t\t\t\t\tconsole.log(\n\t\t\t\t\t\t\tchalk.yellow(\n\t\t\t\t\t\t\t\tupdateSource\n\t\t\t\t\t\t\t\t\t? `${updateSource} was not updated, see the warnings above`\n\t\t\t\t\t\t\t\t\t: \"No packages were updated, see the warnings above\",\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t} else if (updatedPackages.length === 0) {\n\t\t\t\t\t\tconsole.log(\n\t\t\t\t\t\t\tchalk.green(\n\t\t\t\t\t\t\t\tupdateSource ? `${updateSource} is already up to date` : \"Packages are already up to date\",\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst count = updatedPackages.length;\n\t\t\t\t\t\tconsole.log(chalk.green(`Updated ${count} package${count === 1 ? \"\" : \"s\"}:`));\n\t\t\t\t\t\tfor (const message of updatedPackages) {\n\t\t\t\t\t\t\tconsole.log(` ${message}`);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (updateTargetIncludesSelf(target)) {\n\t\t\t\t\tconst selfUpdatePlan = await resolveSelfUpdatePlan(options.force);\n\t\t\t\t\tif (!selfUpdatePlan.shouldRun) {\n\t\t\t\t\t\tconsole.log(chalk.green(`${APP_NAME} is already up to date (v${VERSION})`));\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\t// A configured command is explicit user intent, so it replaces install-method detection.\n\t\t\t\t\tconst configuredSelfUpdateArgv = getConfiguredSelfUpdateArgv(\n\t\t\t\t\t\tsettingsManager.getGlobalSettings().selfUpdateCommand,\n\t\t\t\t\t);\n\t\t\t\t\tif (configuredSelfUpdateArgv) {\n\t\t\t\t\t\tawait runConfiguredSelfUpdate(configuredSelfUpdateArgv, selfUpdatePlan);\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\tconst installMethod = detectInstallMethod();\n\t\t\t\t\tif (process.platform === \"win32\" && installMethod !== \"npm\" && installMethod !== \"pnpm\") {\n\t\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t\tchalk.red(`${APP_NAME} self-update on Windows is only supported for npm and pnpm installs.`),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconsole.error(chalk.dim(`Detected install method: ${installMethod}. Update ${APP_NAME} manually.`));\n\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\tconst selfUpdateTarget = {\n\t\t\t\t\t\tpackageName: selfUpdatePlan.packageName,\n\t\t\t\t\t\tinstallSpec: selfUpdatePlan.installSpec,\n\t\t\t\t\t};\n\t\t\t\t\tconst selfUpdateCommand = getSelfUpdateCommand(PACKAGE_NAME, selfUpdateNpmCommand, selfUpdateTarget);\n\t\t\t\t\tif (!selfUpdateCommand) {\n\t\t\t\t\t\tprintSelfUpdateUnavailable(selfUpdateNpmCommand, selfUpdateTarget);\n\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\tif (selfUpdatePlan.note) printSelfUpdateNote(selfUpdatePlan.note);\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (installMethod === \"npm\") {\n\t\t\t\t\t\t\tprepareWindowsNpmSelfUpdate();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tawait runSelfUpdate(selfUpdateCommand);\n\t\t\t\t\t} catch (error: unknown) {\n\t\t\t\t\t\tconst message = error instanceof Error ? error.message : \"Unknown package command error\";\n\t\t\t\t\t\tconsole.error(chalk.red(`Error: ${message}`));\n\t\t\t\t\t\tprintSelfUpdateFallback(selfUpdateCommand);\n\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\tconsole.log(chalk.green(`Updated ${APP_NAME} from ${VERSION} to ${selfUpdatePlan.version}`));\n\t\t\t\t\tconst installedVersion = readVersionOnPath();\n\t\t\t\t\tif (installedVersion === selfUpdatePlan.version) await runIntercomUpgrade();\n\t\t\t\t\telse\n\t\t\t\t\t\tconsole.log(\n\t\t\t\t\t\t\tchalk.dim(\n\t\t\t\t\t\t\t\t`\\`${APP_NAME} --version\\` on PATH reports ${installedVersion ?? \"no version\"}, not ${selfUpdatePlan.version}, so the Intercom broker was left as it is; run \\`${APP_NAME} intercom upgrade\\` with the new version.`,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t} catch (error: unknown) {\n\t\tconst message = error instanceof Error ? error.message : \"Unknown package command error\";\n\t\tconsole.error(chalk.red(`Error: ${message}`));\n\t\tprocess.exitCode = 1;\n\t\treturn true;\n\t}\n}\n"]}
|
package/docs/background-tasks.md
CHANGED
|
@@ -270,7 +270,7 @@ bash({ action: "wait", id: taskId })
|
|
|
270
270
|
powershell({ action: "wait", id: taskId })
|
|
271
271
|
```
|
|
272
272
|
|
|
273
|
-
Use the original task ID from the same owning session or workflow stage. Omit `budgetMs` to use the owner's command observation policy, or pass `0` to poll. In a workflow stage that releases its session while it waits (see [
|
|
273
|
+
Use the original task ID from the same owning session or workflow stage. Omit `budgetMs` to use the owner's command observation policy, or pass `0` to poll. In a workflow stage that releases its session while it waits (see [Suspended stages](/workflows/operations#suspended-stages)), a wait without `budgetMs` waits until the task ends, and the stage gives up its session and slot meanwhile. A wait returns retained output and a yielded or settled observation; settled results include available exit and failure details. The transcript shows one status line above the output: `✓ completed · exit 0`, `✗ exited 1`, `● still running · showing output so far`, or `○ cancelled`. When the output was cut short, a dim line below it gives the path to the full output. The agent receives the same facts as one sentence after the output, and the structured observation stays in the result details. While running, successive yielded waits advance through retained output in bounded pages, including after a session reload. A caught-up wait returns no output until more arrives. Settled waits return all retained output again, subject to labelled gaps and truncation, so they may repeat output you have already seen.
|
|
274
274
|
|
|
275
275
|
Do not combine `action: "wait"` with `command`, `timeout`, `wait`, `env`, `cwd`, or `pty`. Existing-task waits require a supported task owner, even with custom execution adapters. Unknown or foreign IDs are rejected with `No background task "<id>" in this session` and a hint to run `/tasks`. Cancelling a wait or admitting user/Intercom messages releases observation only, not the command. Waiting never extends the original execution timeout or the owner's lifetime.
|
|
276
276
|
|
package/docs/codemode.md
CHANGED
|
@@ -211,6 +211,7 @@ interface ImagesOptions {
|
|
|
211
211
|
frameCount?: number;
|
|
212
212
|
frameDurationMs?: number;
|
|
213
213
|
complexity?: "low" | "medium" | "high";
|
|
214
|
+
/** Optional. Leave it out unless you choose the model that writes the SVG; see below. */
|
|
214
215
|
svg?: { model: string; reasoning?: { effort?: string } };
|
|
215
216
|
moderation?: "auto" | "low";
|
|
216
217
|
safetyIdentifier?: string;
|
|
@@ -222,6 +223,8 @@ interface ImagesResult {
|
|
|
222
223
|
/** Generated images, and text blocks for models that also return text. */
|
|
223
224
|
output: (TextBlock | ImageBlock)[];
|
|
224
225
|
usage?: ModelUsage;
|
|
226
|
+
/** For SVG output: the model that wrote the SVG. */
|
|
227
|
+
svgModel?: string;
|
|
225
228
|
stopReason: "stop" | "error" | "aborted";
|
|
226
229
|
errorMessage?: string;
|
|
227
230
|
/** A classified failure: `name`, a stable `code`, `retryable`, `hint` and safe `fields`. */
|
|
@@ -235,6 +238,8 @@ type ImageBlock = { type: "image"; data: string; mimeType: string; role?: "marku
|
|
|
235
238
|
|
|
236
239
|
The options are those of OpenAI's GPT Image models under `openai-images`; OpenRouter image models ignore them. The first image without a `role` is the base image to edit and the others are references. An image with `role: "markup"` is a transparent PNG with annotations, sent as `markup` and applied to the first image, which it must match in size; one with `role: "mask"` is an alpha-channel mask for the first image. They cannot be combined. `outputFormat: "gif"` returns an animation (`frameCount` 2-16, `frameDurationMs` 20-2000) and `"svg"` returns SVG; both need a GPT Image 2.6 model and generation without images. A request that cannot succeed does not throw: before anything is sent it returns `stopReason: "error"` with `error.code` `invalid-option` and `error.fields.field` naming the option. `error.code` is also `moderation-blocked`, `user-error`, `quota-exceeded`, `rate-limited`, `server-error`, `timeout` or `api-error`; branch on it, and on `error.retryable`, not on the message. See [Image generation](/extensions/api-reference#ctx-modelregistry-/-ctx-model-/-ctx-scopedmodels) for each code.
|
|
237
240
|
|
|
241
|
+
SVG output needs no other option: `{ outputFormat: "svg" }` works on every account. Some accounts must name the model that writes the SVG. When the API answers that `svg.model` is required and the call set no `svg`, Atomic retries once with `gpt-6.1-sol` and `result.svgModel` reports the model used. OpenAI's API reference lists no authoring models and no default, so `gpt-6.1-sol` is a value that worked in testing, not a documented default. Pass `svg: { model, reasoning }` to choose another model; an `svg` you pass is always sent as given and never retried or replaced. If the API rejects the retry's `svg` as unsupported, Atomic retries once more without it. A rejected `svg.model` or `svg` returns `error.code` `invalid-option` with `error.fields.field` `svg.model` or `svg`, and `error.fields.reason` `required-by-api`, `rejected-by-api` or `unsupported-by-api`. SVG authoring takes tens of seconds (plain requests took 12 to 46 seconds in testing, and OpenAI says complex prompts can take up to 2 minutes), and Atomic sets no request timeout shorter than 10 minutes, so a script that sets `timeout_ms` should allow at least 180000.
|
|
242
|
+
|
|
238
243
|
Show generated images with `image(block)`. Do not print `data` with `text()`, `console`, or `return`: it is large and the model cannot read it as text. A script that generates images without showing any gets a note saying so. `image()` accepts PNG, JPEG, GIF and WebP, so show an animated GIF with `image(block)`. It does not accept SVG: Atomic saves each SVG that `models.generateImages()` returns to a private temp `.svg` file and names its path in the result, as `[SVG saved to <path> (image/svg+xml, <size>)]`. An SVG block (`image/svg+xml`) holds XML text, which a script can read with `atob(block.data)`. `image()` also saves each image to a private temp file and puts its path in the result, so a later turn can copy or move the file.
|
|
239
244
|
|
|
240
245
|
```js
|
|
@@ -250,6 +255,23 @@ for (const block of result.output) {
|
|
|
250
255
|
}
|
|
251
256
|
```
|
|
252
257
|
|
|
258
|
+
A plain SVG request, which Atomic recovers when the account needs `svg.model`, and a four-frame GIF:
|
|
259
|
+
|
|
260
|
+
```js
|
|
261
|
+
// @options: {"timeout_ms": 180000}
|
|
262
|
+
const flare = await models.getModelOfType("image", "openai-images", "gpt-image-2.6-flare");
|
|
263
|
+
const logo = await models.generateImages(flare, {
|
|
264
|
+
input: [{ type: "text", text: "A flat red paper lantern icon" }],
|
|
265
|
+
}, { outputFormat: "svg" });
|
|
266
|
+
if (logo.stopReason !== "stop") return logo.error ?? logo.errorMessage;
|
|
267
|
+
const gif = await models.generateImages(flare, {
|
|
268
|
+
input: [{ type: "text", text: "A paper lantern swinging gently, flat vector style" }],
|
|
269
|
+
}, { outputFormat: "gif", frameCount: 4, frameDurationMs: 200, size: "512x512" });
|
|
270
|
+
if (gif.stopReason !== "stop") return gif.error ?? gif.errorMessage;
|
|
271
|
+
for (const block of gif.output) if (block.type === "image") image(block);
|
|
272
|
+
return { svgModel: logo.svgModel, svg: logo.output.map((block) => block.mimeType) };
|
|
273
|
+
```
|
|
274
|
+
|
|
253
275
|
Extensions call classifiers and image models through `ctx.modelRegistry.classify()` and `ctx.modelRegistry.generateImages()`, without codemode.
|
|
254
276
|
|
|
255
277
|
## Limits
|
|
@@ -69,11 +69,32 @@ Use `ctx.modelRegistry.complete()` for an extension model request that must use
|
|
|
69
69
|
|
|
70
70
|
Use `ctx.modelRegistry.generateImages(model, context, options)` to run an image model with request-time authentication. It resolves to the generated image blocks and usage, and reports provider errors through `stopReason`, `errorMessage` and, for a classified failure, `error` instead of rejecting. For `openai-images` models, `options` takes `size`, `quality`, `n`, `background`, `outputFormat` (`png`, `jpeg`, `webp`, `gif`, `svg`), `outputCompression`, `frameCount`, `frameDurationMs`, `complexity`, `svg`, `moderation` and `safetyIdentifier`; an image block with `role: "markup"` or `role: "mask"` is sent as the `markup` or `mask` field, and the first other image is the base image of an edit. GIF, SVG, `complexity` and the frame options need a GPT Image 2.6 model, which declares them in `model.capabilities`; a provider you register with image models declares them the same way.
|
|
71
71
|
|
|
72
|
+
`outputFormat: "svg"` works without `svg`. Some accounts must name the model that writes the SVG. When the API answers that `svg.model` is required and the request set no `svg`, Atomic retries once with `gpt-6.1-sol` (exported as `DEFAULT_SVG_AUTHOR_MODEL` from `@bastani/pi-ai`), and `result.svgModel` reports the model that wrote the SVG. OpenAI's API reference lists no authoring models and no default, so `gpt-6.1-sol` is a value that worked in testing, not a documented default. Pass `svg: { model, reasoning }` to choose another model. An `svg` you pass is always sent as given and never retried or replaced. If the API rejects the retry's `svg` as unsupported, Atomic retries once more without it, so one call sends at most three requests. SVG authoring takes tens of seconds (plain requests took 12 to 46 seconds in testing, and OpenAI says complex prompts can take up to 2 minutes). Image requests have no deadline shorter than the SDK's 10 minutes unless you set `timeoutMs`, so leave it unset or allow at least 180000 for SVG.
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
const flare = ctx.modelRegistry.getModelOfType("image", "openai-images", "gpt-image-2.6-flare");
|
|
76
|
+
if (!flare) throw new Error("gpt-image-2.6-flare is unavailable");
|
|
77
|
+
const input = [{ type: "text" as const, text: "A flat red paper lantern icon" }];
|
|
78
|
+
|
|
79
|
+
const logo = await ctx.modelRegistry.generateImages(flare, { input }, { outputFormat: "svg", signal: ctx.signal });
|
|
80
|
+
if (logo.stopReason !== "stop") throw new Error(logo.errorMessage);
|
|
81
|
+
const svgBlock = logo.output.find((block) => block.type === "image");
|
|
82
|
+
const svg = svgBlock?.type === "image" ? Buffer.from(svgBlock.data, "base64").toString("utf8") : undefined;
|
|
83
|
+
console.log(logo.svgModel, svg?.slice(0, 60)); // gpt-6.1-sol <svg ...
|
|
84
|
+
|
|
85
|
+
const motion = await ctx.modelRegistry.generateImages(
|
|
86
|
+
flare,
|
|
87
|
+
{ input: [{ type: "text", text: "A paper lantern swinging gently, flat vector style" }] },
|
|
88
|
+
{ outputFormat: "gif", frameCount: 4, frameDurationMs: 200, size: "512x512", signal: ctx.signal },
|
|
89
|
+
);
|
|
90
|
+
if (motion.stopReason !== "stop") throw new Error(motion.errorMessage);
|
|
91
|
+
```
|
|
92
|
+
|
|
72
93
|
`result.error` is a JSON-safe `ImageGenerationErrorData`. Rebuild it with `imageGenerationErrorFromData()` from `@bastani/pi-ai` and branch on its class, guard or `code`, not on the message. A cancelled request resolves with `stopReason: "aborted"` and no `error`.
|
|
73
94
|
|
|
74
95
|
| Error class (guard) | `code` | When it happens | `retryable` | What to do |
|
|
75
96
|
| --- | --- | --- | --- | --- |
|
|
76
|
-
| `ImageGenerationConfigError` (`isImageGenerationConfigError`) | `invalid-option` | An option or input is invalid, for example GIF on an edit, `frameCount` without GIF, markup with a mask, SVG with `n` above 1, compression with `png`, `gif` or `svg`, or a 2.6 feature on an older model. Nothing
|
|
97
|
+
| `ImageGenerationConfigError` (`isImageGenerationConfigError`) | `invalid-option` | An option or input is invalid, for example GIF on an edit, `frameCount` without GIF, markup with a mask, SVG with `n` above 1, compression with `png`, `gif` or `svg`, or a 2.6 feature on an older model. Nothing is billed. Found before a request is sent, except the `reason`s `required-by-api`, `rejected-by-api` and `unsupported-by-api`, which report the API's rejection of `svg` or `svg.model`. Fields: `field`, `reason`, `related`, `model`, `detail`. | No | Fix the option named by `field`; see `hint`. |
|
|
77
98
|
| `ImageGenerationQuotaError` (`isImageGenerationQuotaError`) | `quota-exceeded` | The account is out of quota or credit, although the HTTP status is 429. | No | Add credit or raise the limit. |
|
|
78
99
|
| `ImageGenerationRateLimitError` (`isImageGenerationRateLimitError`) | `rate-limited` | HTTP 429 rate limit. | Yes | Wait, or set `maxRetries`. |
|
|
79
100
|
| `ImageGenerationServerError` (`isImageGenerationServerError`) | `server-error` | HTTP 5xx. | Yes | Retry later, or set `maxRetries`. |
|
|
@@ -95,6 +116,9 @@ An `ImageGenerationConfigError` carries a `reason`:
|
|
|
95
116
|
| `unsupported-by-model` | `complexity`, GIF, SVG or markup on a model whose `capabilities` do not declare it. GPT Image 2.6 declares all four; GPT Image 2.5 declares markup; older models declare none. | Use a model that declares the feature. |
|
|
96
117
|
| `requires-base-image` | An image with `role: "markup"` or `role: "mask"` but no image without a role for it to apply to. | Put the base image first, without a role. |
|
|
97
118
|
| `duplicate-role` | Two images with `role: "markup"`, or two with `role: "mask"`. | Send at most one image per role. |
|
|
119
|
+
| `required-by-api` | The API answered that `svg.model` is required and your own `svg` carried none, or the recovery retry still got that answer. `field` is `svg.model`. | Set `svg: { model }` to an SVG authoring model your account can use. |
|
|
120
|
+
| `rejected-by-api` | The API refused the value of `svg.model` (an empty string or an unknown model, HTTP 400 or 404). `field` is `svg.model`; the `detail` names the default model when Atomic's own retry was refused. | Set `svg.model` to a model your account can use. |
|
|
121
|
+
| `unsupported-by-api` | The API does not accept `svg` or `svg.model` on this account (`unsupported_parameter` or `unknown_parameter`). | Remove `svg`. |
|
|
98
122
|
|
|
99
123
|
All of them extend `ImageGenerationError` (`isImageGenerationError`). A guard checks the value it is given; to look through a `cause` chain, use `findImageGenerationError(error, guard)`. `isRetryableImageGenerationError()` answers whether the nearest one in the chain is retryable. Typed errors name the HTTP status and the provider's codes, never the provider's message, which can quote the prompt. Serialized chains keep up to eight links: typed causes retain their fields, and foreign causes retain a safe name, an optional known errno `code`, and nested `cause`, but their message is always `[foreign error message omitted]`. Rehydration preserves those links and codes.
|
|
100
124
|
|
|
@@ -402,6 +426,8 @@ if (result.cancelled) {
|
|
|
402
426
|
Options:
|
|
403
427
|
- `withSession`: run post-switch work against a fresh replacement-session context. Do not use captured old `pi` / command `ctx`; see [Session replacement lifecycle and footguns](#session-replacement-lifecycle-and-footguns).
|
|
404
428
|
|
|
429
|
+
If the session's recorded working directory does not exist, nothing is opened and the call rejects with a `MissingSessionCwdError` (`code: "session-cwd-missing"`; check it with `isMissingSessionCwdError`). Atomic asks the user whether to continue in the current directory or fork the session there only when it runs the session in the terminal's own process; the default interactive mode runs extensions in a separate process, so the rejection reaches your code. See [Sessions](/sessions#resuming-and-deleting-sessions).
|
|
430
|
+
|
|
405
431
|
To discover available sessions, use the static `SessionManager.list()` or `SessionManager.listAll()` methods:
|
|
406
432
|
|
|
407
433
|
```typescript
|
|
@@ -516,7 +516,7 @@ pi.registerTool({
|
|
|
516
516
|
|
|
517
517
|
**Operations interfaces:** `ReadOperations`, `WriteOperations`, `EditOperations`, `BashOperations`, `LsOperations`, `GrepOperations`, `FindOperations`
|
|
518
518
|
|
|
519
|
-
`GrepOperations` only
|
|
519
|
+
`GrepOperations` only uses the directory check: grep always searches the local filesystem with its native search or `rg`. The optional `readFile` callback is deprecated and ignored, including for context lines. Existing integrations can leave it in place, but to search a remote system, override grep's `execute()` instead.
|
|
520
520
|
|
|
521
521
|
For `user_bash`, extensions can reuse atomic's local shell backend via `createLocalBashOperations()` instead of reimplementing local process spawning, shell resolution, and process-tree termination.
|
|
522
522
|
|
package/docs/extensions/ui.md
CHANGED
|
@@ -101,7 +101,7 @@ ctx.ui.setStatus("my-ext", undefined); // Clear
|
|
|
101
101
|
// Working loader customization (active from accepted prompt startup through the agent turn)
|
|
102
102
|
ctx.ui.setWorkingMessage("Thinking deeply...");
|
|
103
103
|
ctx.ui.setWorkingMessage(); // Restore default
|
|
104
|
-
ctx.ui.setWorkingVisible(false); // Hide the built-in working indicator entirely
|
|
104
|
+
ctx.ui.setWorkingVisible(false); // Hide the built-in working indicator entirely; the compaction indicator stays visible
|
|
105
105
|
ctx.ui.setWorkingVisible(true); // Show the built-in working indicator
|
|
106
106
|
|
|
107
107
|
// Working indicator customization (same lifecycle; see TUI Pattern 4b)
|
|
@@ -120,7 +120,7 @@ Skills are reusable expert instructions. Trigger one with `/skill:<name>` follow
|
|
|
120
120
|
| `liteparse` | Pull text, tables, or values out of PDF, DOCX, PPTX, XLSX, and image files locally. | `/skill:liteparse` |
|
|
121
121
|
| `show-me` | Explain a topic visually with concise diagrams, code-shape sketches, or focused HTML artifacts. HumanLayer, MIT licensed. | `/skill:show-me` |
|
|
122
122
|
|
|
123
|
-
Impeccable 4.
|
|
123
|
+
Impeccable 4.8.1 runs its commands (`context`, `live`, `detect`, hooks, and the rest) through a self-contained engine binary instead of Node scripts. The bundled launcher, `scripts/impeccable` (`impeccable.cmd` on Windows), looks for a binary next to itself, then in `~/.impeccable/bin/`, and otherwise downloads the pinned engine release for your platform into `~/.impeccable/bin/<version>/` and verifies it against the SHA-256 digest that ships with the skill (`scripts/engine-checksums.txt`) before running it, so the first use needs network access. A download or a cached engine that does not match its digest is refused, and a binary next to the launcher that reports a different engine version is skipped. Point `IMPECCABLE_BIN` at a preinstalled engine or set `IMPECCABLE_HOME` to a writable cache when that is not possible. Atomic's launcher keeps the engine's anonymous telemetry pings and its `npx impeccable update` check switched off, since the skill ships with each Atomic release. A concept roll still fetches its catalog with a `GET /api/roll` request to `impeccable.style`, which carries the scope, mode, a short seed key, and a re-roll counter, but no project files, prompts, code, or conversation. Live sessions resolve to the selected app root and support SvelteKit, Nuxt, TanStack Start, Astro, Next.js, Vite, and static HTML injection. The image fallback runs only with `OPENAI_API_KEY`, sends prompts and optional reference images to OpenAI, and spends that account's API credit. Generated image prompts are embedded in the image or a sidecar, so do not include secrets.
|
|
124
124
|
|
|
125
125
|
Use `/skill:research-codebase` for a focused subsystem or question. For repository-wide research, use `fan-out-and-synthesize` with distinct repository partitions and an artifact synthesis barrier. Use Goal for ledger-backed bounded orchestration and Ralph for research-first delegated implementation with iterative review; task size alone does not select either workflow.
|
|
126
126
|
|