@bastani/atomic 0.9.13-alpha.1 → 0.9.13-alpha.2
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 +130 -0
- package/README.md +35 -17
- package/dist/builtin/i-have-adhd/CHANGELOG.md +17 -0
- package/dist/builtin/i-have-adhd/LICENSE +21 -0
- package/dist/builtin/i-have-adhd/README.md +18 -0
- package/dist/builtin/i-have-adhd/index.ts +238 -0
- package/dist/builtin/i-have-adhd/package.json +56 -0
- package/dist/builtin/i-have-adhd/skills/i-have-adhd/SKILL.md +140 -0
- package/dist/builtin/intercom/CHANGELOG.md +19 -0
- package/dist/builtin/intercom/README.md +25 -4
- package/dist/builtin/intercom/broker/bounded-stderr-install.ts +18 -0
- package/dist/builtin/intercom/broker/bounded-stderr.ts +132 -0
- package/dist/builtin/intercom/broker/broker.ts +12 -23
- package/dist/builtin/intercom/broker/client.ts +70 -3
- package/dist/builtin/intercom/broker/paths.ts +9 -0
- package/dist/builtin/intercom/broker/presence-handler.ts +103 -0
- package/dist/builtin/intercom/broker/spawn.ts +128 -29
- package/dist/builtin/intercom/foreground-detach-handoff.ts +30 -14
- package/dist/builtin/intercom/group.ts +64 -25
- package/dist/builtin/intercom/index-heavy.ts +38 -5
- package/dist/builtin/intercom/index.ts +7 -3
- package/dist/builtin/intercom/intercom-tool.ts +82 -5
- package/dist/builtin/intercom/lazy-subagent-ack.ts +11 -6
- package/dist/builtin/intercom/package.json +2 -3
- package/dist/builtin/intercom/runtime-group.ts +13 -0
- package/dist/builtin/intercom/skills/intercom/SKILL.md +30 -2
- package/dist/builtin/intercom/subagent-relay.ts +32 -16
- package/dist/builtin/intercom/terminal-ordering-barrier.ts +21 -4
- package/dist/builtin/intercom/types.ts +3 -1
- package/dist/builtin/intercom/ui/compose.ts +8 -6
- package/dist/builtin/intercom/ui/session-list.ts +7 -5
- package/dist/builtin/mcp/CHANGELOG.md +13 -0
- package/dist/builtin/mcp/glimpse-ui.ts +2 -1
- package/dist/builtin/mcp/index.ts +1 -11
- package/dist/builtin/mcp/mcp-panel.ts +35 -34
- package/dist/builtin/mcp/mcp-setup-panel.ts +35 -33
- package/dist/builtin/mcp/npx-resolver.ts +3 -2
- package/dist/builtin/mcp/package.json +3 -3
- package/dist/builtin/mcp/sampling-handler.ts +5 -1
- package/dist/builtin/mcp/server-manager.ts +4 -7
- package/dist/builtin/subagents/CHANGELOG.md +33 -0
- package/dist/builtin/subagents/README.md +124 -323
- package/dist/builtin/subagents/agents/worker.md +1 -1
- package/dist/builtin/subagents/package.json +5 -5
- package/dist/builtin/subagents/prompts/parallel-context-build.md +2 -2
- package/dist/builtin/subagents/prompts/parallel-handoff-plan.md +4 -4
- package/dist/builtin/subagents/prompts/review-loop.md +1 -1
- package/dist/builtin/subagents/skills/subagent/SKILL.md +39 -102
- package/dist/builtin/subagents/src/agents/agent-discovery.ts +1 -29
- package/dist/builtin/subagents/src/agents/agent-loaders.ts +1 -40
- package/dist/builtin/subagents/src/agents/agent-management-helpers.ts +6 -135
- package/dist/builtin/subagents/src/agents/agent-management.ts +52 -282
- package/dist/builtin/subagents/src/agents/agent-paths.ts +0 -22
- package/dist/builtin/subagents/src/agents/agent-types.ts +0 -40
- package/dist/builtin/subagents/src/agents/agents.ts +0 -3
- package/dist/builtin/subagents/src/agents/identity.ts +2 -4
- package/dist/builtin/subagents/src/agents/skills-paths.ts +8 -1
- package/dist/builtin/subagents/src/extension/doctor.ts +3 -23
- package/dist/builtin/subagents/src/extension/index.ts +9 -7
- package/dist/builtin/subagents/src/extension/prompt-guidance.ts +2 -2
- package/dist/builtin/subagents/src/extension/schemas.ts +1 -157
- package/dist/builtin/subagents/src/extension/startup-maintenance.ts +0 -2
- package/dist/builtin/subagents/src/extension/tool-description.ts +4 -13
- package/dist/builtin/subagents/src/intercom/intercom-bridge.ts +6 -2
- package/dist/builtin/subagents/src/intercom/result-intercom.ts +20 -22
- package/dist/builtin/subagents/src/intercom/supervisor-authorization.ts +9 -2
- package/dist/builtin/subagents/src/runs/background/async-job-tracker.ts +97 -16
- package/dist/builtin/subagents/src/runs/background/completion-notification.ts +8 -3
- package/dist/builtin/subagents/src/runs/background/notify.ts +54 -18
- package/dist/builtin/subagents/src/runs/foreground/execution-updates.ts +0 -5
- package/dist/builtin/subagents/src/runs/foreground/execution.ts +1 -4
- package/dist/builtin/subagents/src/runs/foreground/inprocess-run-sync.ts +117 -15
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-async.ts +11 -40
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-context.ts +11 -22
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-input.ts +10 -173
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-parallel-task.ts +6 -4
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-parallel.ts +9 -2
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-single.ts +9 -2
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-status.ts +32 -12
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-types.ts +2 -6
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-worktree.ts +1 -14
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor.ts +56 -31
- package/dist/builtin/subagents/src/runs/inprocess/background-single.ts +46 -30
- package/dist/builtin/subagents/src/runs/inprocess/background.ts +2 -1
- package/dist/builtin/subagents/src/runs/inprocess/runner.ts +343 -89
- package/dist/builtin/subagents/src/runs/inprocess/runtime-support/nested-projection.ts +0 -2
- package/dist/builtin/subagents/src/runs/inprocess/runtime-support/nested-sanitize.ts +1 -3
- package/dist/builtin/subagents/src/runs/shared/intercom-group.ts +23 -7
- package/dist/builtin/subagents/src/runs/shared/parallel-utils.ts +0 -86
- package/dist/builtin/subagents/src/runs/shared/worktree.ts +7 -2
- package/dist/builtin/subagents/src/shared/formatters.ts +2 -56
- package/dist/builtin/subagents/src/shared/settings.ts +14 -350
- package/dist/builtin/subagents/src/shared/types-async.ts +8 -31
- package/dist/builtin/subagents/src/shared/types-config.ts +20 -22
- package/dist/builtin/subagents/src/shared/types-depth.ts +30 -56
- package/dist/builtin/subagents/src/shared/types-results.ts +9 -58
- package/dist/builtin/subagents/src/shared/types-runtime.ts +0 -1
- package/dist/builtin/subagents/src/shared/utils.ts +5 -0
- package/dist/builtin/subagents/src/slash/bridge-settlement.ts +87 -0
- package/dist/builtin/subagents/src/slash/prompt-template-bridge.ts +47 -7
- package/dist/builtin/subagents/src/slash/slash-bridge.ts +27 -7
- package/dist/builtin/subagents/src/slash/slash-commands.ts +37 -82
- package/dist/builtin/subagents/src/slash/slash-live-state.ts +1 -92
- package/dist/builtin/subagents/src/tui/render-event-formatting.ts +2 -35
- package/dist/builtin/subagents/src/tui/render-progress.ts +89 -0
- package/dist/builtin/subagents/src/tui/render-result-compact.ts +43 -71
- package/dist/builtin/subagents/src/tui/render-result.ts +41 -90
- package/dist/builtin/subagents/src/tui/render-stable-output.ts +0 -5
- package/dist/builtin/subagents/src/tui/render-widget-graph.ts +6 -55
- package/dist/builtin/web-access/CHANGELOG.md +14 -0
- package/dist/builtin/web-access/chrome-cookies.ts +3 -2
- package/dist/builtin/web-access/github-api.ts +7 -6
- package/dist/builtin/web-access/github-extract.ts +2 -1
- package/dist/builtin/web-access/package.json +3 -3
- package/dist/builtin/web-access/subprocess.ts +3 -1
- package/dist/builtin/web-access/summary-review.ts +2 -2
- package/dist/builtin/web-access/web-search-features.ts +38 -22
- package/dist/builtin/web-access/web-search-summary.ts +2 -2
- package/dist/builtin/workflows/CHANGELOG.md +45 -0
- package/dist/builtin/workflows/README.md +41 -1
- package/dist/builtin/workflows/builtin/open-claude-design-utils.ts +3 -0
- package/dist/builtin/workflows/builtin/ralph-models.ts +25 -20
- package/dist/builtin/workflows/builtin/shared-prompts.ts +5 -2
- package/dist/builtin/workflows/package.json +2 -2
- package/dist/builtin/workflows/src/durable/backend.ts +18 -1
- package/dist/builtin/workflows/src/durable/completed-catalog-stage-groups.ts +60 -3
- package/dist/builtin/workflows/src/durable/completed-catalog.ts +67 -1
- package/dist/builtin/workflows/src/durable/completed-subtree.ts +22 -7
- package/dist/builtin/workflows/src/durable/dbos-metadata.ts +4 -0
- package/dist/builtin/workflows/src/durable/local-command.ts +2 -1
- package/dist/builtin/workflows/src/durable/types.ts +17 -1
- package/dist/builtin/workflows/src/durable/workflow-child-result.ts +3 -1
- package/dist/builtin/workflows/src/engine/primitives/workflow.ts +1 -1
- package/dist/builtin/workflows/src/engine/run-durable-finalize.ts +10 -2
- package/dist/builtin/workflows/src/engine/run-durable-topology.ts +9 -2
- package/dist/builtin/workflows/src/extension/atomic-stage-session.ts +7 -1
- package/dist/builtin/workflows/src/extension/companions.ts +1 -1
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +947 -447
- package/dist/builtin/workflows/src/extension/lifecycle-notifications.ts +31 -3
- package/dist/builtin/workflows/src/extension/mcp.ts +13 -2
- package/dist/builtin/workflows/src/extension/render-result.ts +1 -0
- package/dist/builtin/workflows/src/extension/ui-surface.ts +7 -20
- package/dist/builtin/workflows/src/extension/wiring.ts +33 -6
- package/dist/builtin/workflows/src/extension/workflow-ports.ts +14 -6
- package/dist/builtin/workflows/src/extension/workflow-prompts.ts +11 -6
- package/dist/builtin/workflows/src/extension/workflow-run-control-command.ts +8 -0
- package/dist/builtin/workflows/src/extension/workflow-tool-control.ts +2 -0
- package/dist/builtin/workflows/src/intercom/intercom-routing.ts +12 -6
- package/dist/builtin/workflows/src/intercom/result-intercom.ts +35 -4
- package/dist/builtin/workflows/src/runs/background/status.ts +15 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-abort.ts +11 -3
- package/dist/builtin/workflows/src/runs/foreground/executor-child-boundary.ts +2 -1
- package/dist/builtin/workflows/src/runs/foreground/executor-exit-manager.ts +26 -2
- package/dist/builtin/workflows/src/runs/foreground/executor-run-finalizers.ts +3 -2
- package/dist/builtin/workflows/src/runs/shared/worktree-git-runner.ts +5 -2
- package/dist/builtin/workflows/src/runs/shared/worktree-setup.ts +2 -0
- package/dist/builtin/workflows/src/shared/authoring-contract-stage.d.ts +5 -3
- package/dist/builtin/workflows/src/shared/authoring-contract-stage.ts +5 -3
- package/dist/builtin/workflows/src/shared/graph-store-snapshot.ts +34 -2
- package/dist/builtin/workflows/src/shared/persistence-restore-helpers.ts +23 -6
- package/dist/builtin/workflows/src/shared/stage-ui-broker.ts +10 -4
- package/dist/builtin/workflows/src/shared/store-public-types.ts +4 -2
- package/dist/builtin/workflows/src/shared/store-types.ts +1 -1
- package/dist/builtin/workflows/src/shared/workflow-artifact-env.ts +21 -0
- package/dist/builtin/workflows/src/shared/workflow-artifacts.ts +2 -5
- package/dist/builtin/workflows/src/tui/dispatch-confirm.ts +37 -2
- package/dist/builtin/workflows/src/tui/graph-view-constants.ts +0 -15
- package/dist/builtin/workflows/src/tui/graph-view-graph-render.ts +38 -47
- package/dist/builtin/workflows/src/tui/graph-view-input.ts +48 -45
- package/dist/builtin/workflows/src/tui/graph-view-layout.ts +266 -0
- package/dist/builtin/workflows/src/tui/graph-view-render-helpers.ts +1 -86
- package/dist/builtin/workflows/src/tui/graph-view-render.ts +209 -91
- package/dist/builtin/workflows/src/tui/graph-view-state.ts +5 -7
- package/dist/builtin/workflows/src/tui/graph-view-types.ts +13 -7
- package/dist/builtin/workflows/src/tui/inline-form-editor.ts +8 -6
- package/dist/builtin/workflows/src/tui/inline-form-overlay.ts +2 -1
- package/dist/builtin/workflows/src/tui/inputs-overlay.ts +7 -4
- package/dist/builtin/workflows/src/tui/inputs-picker-input.ts +66 -0
- package/dist/builtin/workflows/src/tui/keybindings-adapter.ts +1 -0
- package/dist/builtin/workflows/src/tui/node-card.ts +1 -1
- package/dist/builtin/workflows/src/tui/overlay-adapter.ts +18 -46
- package/dist/builtin/workflows/src/tui/overlay-terminal-modes.ts +15 -26
- package/dist/builtin/workflows/src/tui/session-overlays.ts +5 -2
- package/dist/builtin/workflows/src/tui/session-picker.ts +27 -0
- package/dist/builtin/workflows/src/tui/stage-chat-view-footer-status.ts +5 -14
- package/dist/builtin/workflows/src/tui/stage-chat-view-input.ts +8 -7
- package/dist/builtin/workflows/src/tui/stage-chat-view-state.ts +12 -3
- package/dist/builtin/workflows/src/tui/stage-chat-view-types.ts +1 -11
- package/dist/builtin/workflows/src/tui/stage-chat-view.ts +0 -8
- package/dist/builtin/workflows/src/tui/status-list.ts +1 -0
- package/dist/builtin/workflows/src/tui/store-widget-installer.ts +2 -6
- package/dist/builtin/workflows/src/tui/workflow-attach-pane-types.ts +0 -15
- package/dist/builtin/workflows/src/tui/workflow-attach-pane.ts +2 -26
- package/dist/builtin/workflows/src/tui/workflow-status.ts +3 -3
- package/dist/bun/split-loader.js +2 -0
- package/dist/bun/split-loader.js.map +1 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +6 -2
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/auth-check.d.ts +35 -0
- package/dist/cli/auth-check.d.ts.map +1 -0
- package/dist/cli/auth-check.js +100 -0
- package/dist/cli/auth-check.js.map +1 -0
- package/dist/cli/auth-command.d.ts +27 -0
- package/dist/cli/auth-command.d.ts.map +1 -0
- package/dist/cli/auth-command.js +150 -0
- package/dist/cli/auth-command.js.map +1 -0
- package/dist/cli/config-selector.js +2 -2
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/cli/credential-print.d.ts +18 -23
- package/dist/cli/credential-print.d.ts.map +1 -1
- package/dist/cli/credential-print.js +42 -88
- package/dist/cli/credential-print.js.map +1 -1
- package/dist/cli/experimental/auth.d.ts +16 -0
- package/dist/cli/experimental/auth.d.ts.map +1 -0
- package/dist/cli/experimental/auth.js +13 -0
- package/dist/cli/experimental/auth.js.map +1 -0
- package/dist/cli/experimental/cli.d.ts +6 -0
- package/dist/cli/experimental/cli.d.ts.map +1 -0
- package/dist/cli/experimental/cli.js +5 -0
- package/dist/cli/experimental/cli.js.map +1 -0
- package/dist/cli/experimental/command-options.d.ts +17 -0
- package/dist/cli/experimental/command-options.d.ts.map +1 -0
- package/dist/cli/experimental/command-options.js +35 -0
- package/dist/cli/experimental/command-options.js.map +1 -0
- package/dist/cli/experimental/command.d.ts +63 -0
- package/dist/cli/experimental/command.d.ts.map +1 -0
- package/dist/cli/experimental/command.js +127 -0
- package/dist/cli/experimental/command.js.map +1 -0
- package/dist/cli/experimental/commands/client.d.ts +13 -0
- package/dist/cli/experimental/commands/client.d.ts.map +1 -0
- package/dist/cli/experimental/commands/client.js +25 -0
- package/dist/cli/experimental/commands/client.js.map +1 -0
- package/dist/cli/experimental/commands/pi.d.ts +15 -0
- package/dist/cli/experimental/commands/pi.d.ts.map +1 -0
- package/dist/cli/experimental/commands/pi.js +28 -0
- package/dist/cli/experimental/commands/pi.js.map +1 -0
- package/dist/cli/experimental/commands/server.d.ts +13 -0
- package/dist/cli/experimental/commands/server.d.ts.map +1 -0
- package/dist/cli/experimental/commands/server.js +25 -0
- package/dist/cli/experimental/commands/server.js.map +1 -0
- package/dist/cli/experimental/transport-address.d.ts +10 -0
- package/dist/cli/experimental/transport-address.d.ts.map +1 -0
- package/dist/cli/experimental/transport-address.js +38 -0
- package/dist/cli/experimental/transport-address.js.map +1 -0
- package/dist/cli/session-picker.js +2 -2
- package/dist/cli/session-picker.js.map +1 -1
- package/dist/cli/startup-ui.d.ts.map +1 -1
- package/dist/cli/startup-ui.js +4 -10
- package/dist/cli/startup-ui.js.map +1 -1
- package/dist/cli.js +2 -0
- package/dist/cli.js.map +1 -1
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +3 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/remote-session.d.ts +64 -0
- package/dist/client/remote-session.d.ts.map +1 -0
- package/dist/client/remote-session.js +351 -0
- package/dist/client/remote-session.js.map +1 -0
- package/dist/client/transcript.d.ts +12 -0
- package/dist/client/transcript.d.ts.map +1 -0
- package/dist/client/transcript.js +98 -0
- package/dist/client/transcript.js.map +1 -0
- package/dist/core/agent-session-auto-compaction.d.ts +17 -13
- package/dist/core/agent-session-auto-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-auto-compaction.js +146 -64
- package/dist/core/agent-session-auto-compaction.js.map +1 -1
- package/dist/core/agent-session-bash.d.ts.map +1 -1
- package/dist/core/agent-session-bash.js +2 -0
- package/dist/core/agent-session-bash.js.map +1 -1
- package/dist/core/agent-session-compaction.d.ts +3 -6
- package/dist/core/agent-session-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-compaction.js +64 -28
- package/dist/core/agent-session-compaction.js.map +1 -1
- package/dist/core/agent-session-events.d.ts +1 -11
- package/dist/core/agent-session-events.d.ts.map +1 -1
- package/dist/core/agent-session-events.js +15 -23
- package/dist/core/agent-session-events.js.map +1 -1
- package/dist/core/agent-session-extension-bindings.d.ts.map +1 -1
- package/dist/core/agent-session-extension-bindings.js +4 -2
- package/dist/core/agent-session-extension-bindings.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +6 -2
- package/dist/core/agent-session-methods.d.ts.map +1 -1
- package/dist/core/agent-session-methods.js.map +1 -1
- package/dist/core/agent-session-models.d.ts +1 -0
- package/dist/core/agent-session-models.d.ts.map +1 -1
- package/dist/core/agent-session-models.js +11 -4
- package/dist/core/agent-session-models.js.map +1 -1
- package/dist/core/agent-session-post-tool-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-post-tool-compaction.js +22 -6
- package/dist/core/agent-session-post-tool-compaction.js.map +1 -1
- package/dist/core/agent-session-runtime-auth.d.ts.map +1 -1
- package/dist/core/agent-session-runtime-auth.js +3 -0
- package/dist/core/agent-session-runtime-auth.js.map +1 -1
- package/dist/core/agent-session-tool-hooks.d.ts.map +1 -1
- package/dist/core/agent-session-tool-hooks.js +25 -14
- package/dist/core/agent-session-tool-hooks.js.map +1 -1
- package/dist/core/agent-session-tool-registry.d.ts.map +1 -1
- package/dist/core/agent-session-tool-registry.js +4 -0
- package/dist/core/agent-session-tool-registry.js.map +1 -1
- package/dist/core/agent-session-types.d.ts +2 -0
- package/dist/core/agent-session-types.d.ts.map +1 -1
- package/dist/core/agent-session-types.js.map +1 -1
- package/dist/core/agent-session.d.ts +6 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +30 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/atomic-guide-command.d.ts.map +1 -1
- package/dist/core/atomic-guide-command.js +2 -3
- package/dist/core/atomic-guide-command.js.map +1 -1
- package/dist/core/auth-storage.d.ts +18 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +83 -0
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/bash-executor.d.ts +5 -0
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js +43 -19
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/builtin-packages.d.ts.map +1 -1
- package/dist/core/builtin-packages.js +6 -0
- package/dist/core/builtin-packages.js.map +1 -1
- package/dist/core/codex-fast-mode.d.ts.map +1 -1
- package/dist/core/codex-fast-mode.js +8 -3
- package/dist/core/codex-fast-mode.js.map +1 -1
- package/dist/core/exec.d.ts.map +1 -1
- package/dist/core/exec.js +4 -3
- package/dist/core/exec.js.map +1 -1
- package/dist/core/extensions/agent-events.d.ts +0 -1
- package/dist/core/extensions/agent-events.d.ts.map +1 -1
- package/dist/core/extensions/agent-events.js.map +1 -1
- package/dist/core/extensions/api-types.d.ts +5 -3
- package/dist/core/extensions/api-types.d.ts.map +1 -1
- package/dist/core/extensions/api-types.js.map +1 -1
- package/dist/core/extensions/context-types.d.ts +15 -0
- package/dist/core/extensions/context-types.d.ts.map +1 -1
- package/dist/core/extensions/context-types.js.map +1 -1
- package/dist/core/extensions/event-results.d.ts +5 -0
- package/dist/core/extensions/event-results.d.ts.map +1 -1
- package/dist/core/extensions/event-results.js.map +1 -1
- package/dist/core/extensions/index.d.ts +2 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js +1 -0
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader-api.d.ts.map +1 -1
- package/dist/core/extensions/loader-api.js +14 -1
- package/dist/core/extensions/loader-api.js.map +1 -1
- package/dist/core/extensions/loader-discovery.d.ts.map +1 -1
- package/dist/core/extensions/loader-discovery.js +3 -23
- package/dist/core/extensions/loader-discovery.js.map +1 -1
- package/dist/core/extensions/loader-runtime.d.ts.map +1 -1
- package/dist/core/extensions/loader-runtime.js +20 -3
- package/dist/core/extensions/loader-runtime.js.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.js +7 -1
- package/dist/core/extensions/loader-virtual-modules.js.map +1 -1
- package/dist/core/extensions/message-types.d.ts +6 -0
- package/dist/core/extensions/message-types.d.ts.map +1 -1
- package/dist/core/extensions/message-types.js.map +1 -1
- package/dist/core/extensions/provider-types.d.ts +9 -3
- package/dist/core/extensions/provider-types.d.ts.map +1 -1
- package/dist/core/extensions/provider-types.js.map +1 -1
- package/dist/core/extensions/runner-registries.d.ts +2 -1
- package/dist/core/extensions/runner-registries.d.ts.map +1 -1
- package/dist/core/extensions/runner-registries.js +3 -0
- package/dist/core/extensions/runner-registries.js.map +1 -1
- package/dist/core/extensions/runner-ui.d.ts.map +1 -1
- package/dist/core/extensions/runner-ui.js +1 -0
- package/dist/core/extensions/runner-ui.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +2 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +6 -2
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/runtime-types.d.ts +4 -1
- package/dist/core/extensions/runtime-types.d.ts.map +1 -1
- package/dist/core/extensions/runtime-types.js.map +1 -1
- package/dist/core/extensions/stale-context.d.ts +5 -0
- package/dist/core/extensions/stale-context.d.ts.map +1 -0
- package/dist/core/extensions/stale-context.js +11 -0
- package/dist/core/extensions/stale-context.js.map +1 -0
- package/dist/core/extensions/ui-types.d.ts +14 -11
- package/dist/core/extensions/ui-types.d.ts.map +1 -1
- package/dist/core/extensions/ui-types.js.map +1 -1
- package/dist/core/footer-data-provider.d.ts.map +1 -1
- package/dist/core/footer-data-provider.js +3 -2
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/intercom-runtime-group.d.ts +13 -0
- package/dist/core/intercom-runtime-group.d.ts.map +1 -0
- package/dist/core/intercom-runtime-group.js +23 -0
- package/dist/core/intercom-runtime-group.js.map +1 -0
- package/dist/core/keybindings.d.ts +44 -4
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/model-config.d.ts +39 -5
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +6 -0
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-registry.d.ts +12 -5
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +20 -12
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver-cli.d.ts.map +1 -1
- package/dist/core/model-resolver-cli.js +46 -14
- package/dist/core/model-resolver-cli.js.map +1 -1
- package/dist/core/model-resolver-defaults.d.ts.map +1 -1
- package/dist/core/model-resolver-defaults.js +2 -0
- package/dist/core/model-resolver-defaults.js.map +1 -1
- package/dist/core/model-resolver-scope.d.ts +2 -0
- package/dist/core/model-resolver-scope.d.ts.map +1 -1
- package/dist/core/model-resolver-scope.js +12 -9
- package/dist/core/model-resolver-scope.js.map +1 -1
- package/dist/core/model-resolver.d.ts +1 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +1 -1
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime-snapshot.d.ts +10 -0
- package/dist/core/model-runtime-snapshot.d.ts.map +1 -1
- package/dist/core/model-runtime-snapshot.js +14 -1
- package/dist/core/model-runtime-snapshot.js.map +1 -1
- package/dist/core/model-runtime-streaming.d.ts +3 -1
- package/dist/core/model-runtime-streaming.d.ts.map +1 -1
- package/dist/core/model-runtime-streaming.js +16 -0
- package/dist/core/model-runtime-streaming.js.map +1 -1
- package/dist/core/model-runtime-types.d.ts +2 -0
- package/dist/core/model-runtime-types.d.ts.map +1 -1
- package/dist/core/model-runtime-types.js.map +1 -1
- package/dist/core/model-runtime.d.ts +37 -10
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +312 -113
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/oauth-login.d.ts.map +1 -1
- package/dist/core/oauth-login.js +2 -1
- package/dist/core/oauth-login.js.map +1 -1
- package/dist/core/openai-responses-payload-sanitizer.d.ts.map +1 -1
- package/dist/core/openai-responses-payload-sanitizer.js +18 -2
- package/dist/core/openai-responses-payload-sanitizer.js.map +1 -1
- package/dist/core/package-manager-git.d.ts.map +1 -1
- package/dist/core/package-manager-git.js +56 -10
- package/dist/core/package-manager-git.js.map +1 -1
- package/dist/core/package-manager-manifest.d.ts +1 -1
- package/dist/core/package-manager-manifest.d.ts.map +1 -1
- package/dist/core/package-manager-manifest.js +19 -9
- package/dist/core/package-manager-manifest.js.map +1 -1
- package/dist/core/package-manager-resource-collector.js.map +1 -1
- package/dist/core/package-manager-resource-files.d.ts.map +1 -1
- package/dist/core/package-manager-resource-files.js +1 -2
- package/dist/core/package-manager-resource-files.js.map +1 -1
- package/dist/core/provider-composer-internal.d.ts +10 -2
- package/dist/core/provider-composer-internal.d.ts.map +1 -1
- package/dist/core/provider-composer-internal.js +7 -3
- package/dist/core/provider-composer-internal.js.map +1 -1
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +19 -12
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/provider-display-names.d.ts.map +1 -1
- package/dist/core/provider-display-names.js +2 -0
- package/dist/core/provider-display-names.js.map +1 -1
- package/dist/core/remote-catalog-provider.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.js +77 -67
- package/dist/core/remote-catalog-provider.js.map +1 -1
- package/dist/core/resolve-config-value.d.ts.map +1 -1
- package/dist/core/resolve-config-value.js +3 -0
- package/dist/core/resolve-config-value.js.map +1 -1
- package/dist/core/resource-loader-context-files.d.ts.map +1 -1
- package/dist/core/resource-loader-context-files.js +13 -5
- package/dist/core/resource-loader-context-files.js.map +1 -1
- package/dist/core/runtime-credentials.d.ts +5 -5
- package/dist/core/runtime-credentials.d.ts.map +1 -1
- package/dist/core/runtime-credentials.js +8 -8
- package/dist/core/runtime-credentials.js.map +1 -1
- package/dist/core/session-manager-list.d.ts.map +1 -1
- package/dist/core/session-manager-list.js +3 -1
- package/dist/core/session-manager-list.js.map +1 -1
- package/dist/core/settings-manager-ui-accessors.d.ts +8 -1
- package/dist/core/settings-manager-ui-accessors.d.ts.map +1 -1
- package/dist/core/settings-manager-ui-accessors.js +31 -0
- package/dist/core/settings-manager-ui-accessors.js.map +1 -1
- package/dist/core/settings-manager.d.ts +2 -1
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/settings-merge.d.ts.map +1 -1
- package/dist/core/settings-merge.js +13 -16
- package/dist/core/settings-merge.js.map +1 -1
- package/dist/core/settings-types.d.ts +5 -0
- package/dist/core/settings-types.d.ts.map +1 -1
- package/dist/core/settings-types.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +0 -2
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/tools/ask-user-question/state/questionnaire-session.d.ts +2 -2
- package/dist/core/tools/ask-user-question/state/questionnaire-session.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/state/questionnaire-session.js +39 -2
- package/dist/core/tools/ask-user-question/state/questionnaire-session.js.map +1 -1
- package/dist/core/tools/bash-async-execution.d.ts +2 -0
- package/dist/core/tools/bash-async-execution.d.ts.map +1 -1
- package/dist/core/tools/bash-async-execution.js +4 -1
- package/dist/core/tools/bash-async-execution.js.map +1 -1
- package/dist/core/tools/bash-async-output.d.ts +1 -0
- package/dist/core/tools/bash-async-output.d.ts.map +1 -1
- package/dist/core/tools/bash-async-output.js +62 -27
- package/dist/core/tools/bash-async-output.js.map +1 -1
- package/dist/core/tools/bash-pty-native.d.ts.map +1 -1
- package/dist/core/tools/bash-pty-native.js +2 -1
- package/dist/core/tools/bash-pty-native.js.map +1 -1
- package/dist/core/tools/bash.d.ts +9 -0
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +34 -16
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/directory-tree.d.ts +11 -0
- package/dist/core/tools/directory-tree.d.ts.map +1 -1
- package/dist/core/tools/directory-tree.js +26 -0
- package/dist/core/tools/directory-tree.js.map +1 -1
- package/dist/core/tools/edit.d.ts +4 -0
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +12 -8
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/errno.d.ts +25 -0
- package/dist/core/tools/errno.d.ts.map +1 -0
- package/dist/core/tools/errno.js +29 -0
- package/dist/core/tools/errno.js.map +1 -0
- package/dist/core/tools/find.d.ts +8 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +20 -15
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +5 -1
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/index.d.ts +7 -7
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +7 -7
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/ls.d.ts +4 -0
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js +5 -1
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/output-accumulator.d.ts +8 -1
- package/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/dist/core/tools/output-accumulator.js +50 -28
- package/dist/core/tools/output-accumulator.js.map +1 -1
- package/dist/core/tools/oversized-tool-result.d.ts.map +1 -1
- package/dist/core/tools/oversized-tool-result.js +129 -22
- package/dist/core/tools/oversized-tool-result.js.map +1 -1
- package/dist/core/tools/persisted-output-file.d.ts +80 -0
- package/dist/core/tools/persisted-output-file.d.ts.map +1 -0
- package/dist/core/tools/persisted-output-file.js +284 -0
- package/dist/core/tools/persisted-output-file.js.map +1 -0
- package/dist/core/tools/read.d.ts +10 -0
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +20 -8
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/search.d.ts +4 -0
- package/dist/core/tools/search.d.ts.map +1 -1
- package/dist/core/tools/search.js +5 -1
- package/dist/core/tools/search.js.map +1 -1
- package/dist/core/tools/session-temp-cleanup.d.ts +133 -0
- package/dist/core/tools/session-temp-cleanup.d.ts.map +1 -0
- package/dist/core/tools/session-temp-cleanup.js +669 -0
- package/dist/core/tools/session-temp-cleanup.js.map +1 -0
- package/dist/core/tools/session-temp-dir.d.ts +116 -0
- package/dist/core/tools/session-temp-dir.d.ts.map +1 -0
- package/dist/core/tools/session-temp-dir.js +409 -0
- package/dist/core/tools/session-temp-dir.js.map +1 -0
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.js +2 -0
- package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
- package/dist/core/tools/tool-limits.d.ts +11 -0
- package/dist/core/tools/tool-limits.d.ts.map +1 -1
- package/dist/core/tools/tool-limits.js +11 -0
- package/dist/core/tools/tool-limits.js.map +1 -1
- package/dist/core/tools/windows-directory-security.d.ts +82 -0
- package/dist/core/tools/windows-directory-security.d.ts.map +1 -0
- package/dist/core/tools/windows-directory-security.js +238 -0
- package/dist/core/tools/windows-directory-security.js.map +1 -0
- package/dist/core/tools/write.d.ts +4 -0
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +8 -4
- package/dist/core/tools/write.js.map +1 -1
- package/dist/core/trust-manager.js +1 -1
- package/dist/core/trust-manager.js.map +1 -1
- package/dist/extensions/llama/huggingface-ui.d.ts +1 -1
- package/dist/extensions/llama/huggingface-ui.d.ts.map +1 -1
- package/dist/extensions/llama/huggingface-ui.js +6 -5
- package/dist/extensions/llama/huggingface-ui.js.map +1 -1
- package/dist/extensions/llama/index.d.ts.map +1 -1
- package/dist/extensions/llama/index.js +11 -2
- package/dist/extensions/llama/index.js.map +1 -1
- package/dist/extensions/llama/provider.d.ts.map +1 -1
- package/dist/extensions/llama/provider.js +24 -8
- package/dist/extensions/llama/provider.js.map +1 -1
- package/dist/extensions/llama/ui.d.ts.map +1 -1
- package/dist/extensions/llama/ui.js +5 -2
- package/dist/extensions/llama/ui.js.map +1 -1
- package/dist/index-extensions.d.ts +2 -2
- package/dist/index-extensions.d.ts.map +1 -1
- package/dist/index-extensions.js +1 -1
- package/dist/index-extensions.js.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/main-runtime-api-key.d.ts +2 -2
- package/dist/main-runtime-api-key.d.ts.map +1 -1
- package/dist/main-runtime-api-key.js +7 -2
- package/dist/main-runtime-api-key.js.map +1 -1
- package/dist/main-session.js +2 -2
- package/dist/main-session.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +130 -26
- package/dist/main.js.map +1 -1
- package/dist/modes/index.d.ts +1 -0
- package/dist/modes/index.d.ts.map +1 -1
- package/dist/modes/index.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts +6 -2
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +18 -5
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/bordered-loader.d.ts +1 -1
- package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -1
- package/dist/modes/interactive/components/bordered-loader.js +5 -4
- package/dist/modes/interactive/components/bordered-loader.js.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts +2 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.js +3 -2
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/chat-message-renderer.d.ts +17 -7
- package/dist/modes/interactive/components/chat-message-renderer.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-message-renderer.js +35 -69
- package/dist/modes/interactive/components/chat-message-renderer.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-actions.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-actions.js +11 -3
- package/dist/modes/interactive/components/chat-session-host-actions.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-events.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-events.js +25 -15
- package/dist/modes/interactive/components/chat-session-host-events.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-rendering.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-rendering.js +9 -4
- package/dist/modes/interactive/components/chat-session-host-rendering.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-state.d.ts +2 -0
- package/dist/modes/interactive/components/chat-session-host-state.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-state.js +2 -0
- package/dist/modes/interactive/components/chat-session-host-state.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.d.ts +9 -0
- package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.js +14 -0
- package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
- package/dist/modes/interactive/components/chat-transcript.d.ts +32 -0
- package/dist/modes/interactive/components/chat-transcript.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-transcript.js +173 -5
- package/dist/modes/interactive/components/chat-transcript.js.map +1 -1
- package/dist/modes/interactive/components/config-selector-list.d.ts +1 -1
- package/dist/modes/interactive/components/config-selector-list.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector-list.js +9 -8
- package/dist/modes/interactive/components/config-selector-list.js.map +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js +32 -10
- package/dist/modes/interactive/components/custom-editor.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.d.ts +2 -1
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-message.js +3 -2
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/extension-editor.d.ts +1 -1
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-editor.js +3 -2
- package/dist/modes/interactive/components/extension-editor.js.map +1 -1
- package/dist/modes/interactive/components/extension-input.d.ts +1 -1
- package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-input.js +1 -0
- package/dist/modes/interactive/components/extension-input.js.map +1 -1
- package/dist/modes/interactive/components/extension-selector.d.ts +1 -1
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-selector.js +4 -0
- package/dist/modes/interactive/components/extension-selector.js.map +1 -1
- package/dist/modes/interactive/components/fast-mode-selector.d.ts +1 -1
- package/dist/modes/interactive/components/fast-mode-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/fast-mode-selector.js +7 -5
- package/dist/modes/interactive/components/fast-mode-selector.js.map +1 -1
- package/dist/modes/interactive/components/first-time-setup.d.ts +1 -1
- package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -1
- package/dist/modes/interactive/components/first-time-setup.js +3 -0
- package/dist/modes/interactive/components/first-time-setup.js.map +1 -1
- package/dist/modes/interactive/components/footer.js +1 -1
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/host-input-form.d.ts +1 -1
- package/dist/modes/interactive/components/host-input-form.d.ts.map +1 -1
- package/dist/modes/interactive/components/host-input-form.js +6 -5
- package/dist/modes/interactive/components/host-input-form.js.map +1 -1
- package/dist/modes/interactive/components/index.d.ts +1 -1
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +2 -1
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/markdown-transform.d.ts +3 -0
- package/dist/modes/interactive/components/markdown-transform.d.ts.map +1 -0
- package/dist/modes/interactive/components/markdown-transform.js +19 -0
- package/dist/modes/interactive/components/markdown-transform.js.map +1 -0
- package/dist/modes/interactive/components/mermaid.d.ts +11 -0
- package/dist/modes/interactive/components/mermaid.d.ts.map +1 -0
- package/dist/modes/interactive/components/mermaid.js +81 -0
- package/dist/modes/interactive/components/mermaid.js.map +1 -0
- package/dist/modes/interactive/components/model-selector.d.ts +2 -2
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +9 -6
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +3 -2
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +6 -2
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +39 -13
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector-delete.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector-delete.js +2 -1
- package/dist/modes/interactive/components/session-selector-delete.js.map +1 -1
- package/dist/modes/interactive/components/session-selector-list.d.ts +1 -1
- package/dist/modes/interactive/components/session-selector-list.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector-list.js +12 -11
- package/dist/modes/interactive/components/session-selector-list.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +3 -3
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector-handlers.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector-handlers.js +9 -0
- package/dist/modes/interactive/components/settings-selector-handlers.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector-items.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector-items.js +21 -0
- package/dist/modes/interactive/components/settings-selector-items.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector-submenus.d.ts +3 -3
- package/dist/modes/interactive/components/settings-selector-submenus.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector-submenus.js +6 -1
- package/dist/modes/interactive/components/settings-selector-submenus.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector-types.d.ts +8 -1
- package/dist/modes/interactive/components/settings-selector-types.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector-types.js.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +2 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.js +3 -2
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +2 -0
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +50 -27
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector-component.d.ts +1 -1
- package/dist/modes/interactive/components/tree-selector-component.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector-component.js +2 -3
- package/dist/modes/interactive/components/tree-selector-component.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector-help.d.ts +1 -1
- package/dist/modes/interactive/components/tree-selector-help.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector-help.js +3 -1
- package/dist/modes/interactive/components/tree-selector-help.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector-label-input.d.ts +1 -1
- package/dist/modes/interactive/components/tree-selector-label-input.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector-label-input.js +1 -0
- package/dist/modes/interactive/components/tree-selector-label-input.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector-list.d.ts +1 -1
- package/dist/modes/interactive/components/tree-selector-list.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector-list.js +3 -0
- package/dist/modes/interactive/components/tree-selector-list.js.map +1 -1
- package/dist/modes/interactive/components/trust-selector.d.ts +1 -1
- package/dist/modes/interactive/components/trust-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/trust-selector.js +4 -0
- package/dist/modes/interactive/components/trust-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.d.ts +1 -1
- package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.js +4 -0
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message.d.ts +4 -1
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message.js +10 -2
- package/dist/modes/interactive/components/user-message.js.map +1 -1
- package/dist/modes/interactive/external-editor.d.ts.map +1 -1
- package/dist/modes/interactive/external-editor.js +2 -1
- package/dist/modes/interactive/external-editor.js.map +1 -1
- package/dist/modes/interactive/interactive-agent-events.js +36 -18
- package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
- package/dist/modes/interactive/interactive-auth-login.js +9 -2
- package/dist/modes/interactive/interactive-auth-login.js.map +1 -1
- package/dist/modes/interactive/interactive-auth-routing.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-auth-routing.js +5 -1
- package/dist/modes/interactive/interactive-auth-routing.js.map +1 -1
- package/dist/modes/interactive/interactive-bash-compact.js +16 -4
- package/dist/modes/interactive/interactive-bash-compact.js.map +1 -1
- package/dist/modes/interactive/interactive-deferred-startup.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-deferred-startup.js +3 -0
- package/dist/modes/interactive/interactive-deferred-startup.js.map +1 -1
- package/dist/modes/interactive/interactive-editor-actions.js +2 -0
- package/dist/modes/interactive/interactive-editor-actions.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-context.js +12 -7
- package/dist/modes/interactive/interactive-extension-context.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-custom-ui.js +1 -0
- package/dist/modes/interactive/interactive-extension-custom-ui.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-dialogs.js +7 -0
- package/dist/modes/interactive/interactive-extension-dialogs.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-widgets.js +7 -24
- package/dist/modes/interactive/interactive-extension-widgets.js.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.js +9 -8
- package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.d.ts +52 -3
- package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.js +143 -5
- package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-deps.d.ts +2 -2
- package/dist/modes/interactive/interactive-mode-deps.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-deps.js +2 -2
- package/dist/modes/interactive/interactive-mode-deps.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.d.ts +9 -3
- 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-mode.d.ts +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +1 -0
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/interactive-model-routing.js +107 -41
- package/dist/modes/interactive/interactive-model-routing.js.map +1 -1
- package/dist/modes/interactive/interactive-process-lifecycle.js +1 -1
- package/dist/modes/interactive/interactive-process-lifecycle.js.map +1 -1
- package/dist/modes/interactive/interactive-render-chat.js +24 -6
- package/dist/modes/interactive/interactive-render-chat.js.map +1 -1
- package/dist/modes/interactive/interactive-selectors.js +44 -5
- package/dist/modes/interactive/interactive-selectors.js.map +1 -1
- package/dist/modes/interactive/interactive-session-runtime.js +1 -0
- package/dist/modes/interactive/interactive-session-runtime.js.map +1 -1
- package/dist/modes/interactive/interactive-slash-commands.js +9 -4
- package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
- package/dist/modes/interactive/interactive-startup.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-startup.js +37 -18
- package/dist/modes/interactive/interactive-startup.js.map +1 -1
- package/dist/modes/interactive/interactive-tui.d.ts +21 -0
- package/dist/modes/interactive/interactive-tui.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-tui.js +279 -0
- package/dist/modes/interactive/interactive-tui.js.map +1 -0
- package/dist/modes/interactive/streaming-assistant-message.d.ts +34 -0
- package/dist/modes/interactive/streaming-assistant-message.d.ts.map +1 -0
- package/dist/modes/interactive/streaming-assistant-message.js +76 -0
- package/dist/modes/interactive/streaming-assistant-message.js.map +1 -0
- package/dist/modes/interactive/theme/catppuccin-frappe.json +1 -0
- package/dist/modes/interactive/theme/catppuccin-latte.json +1 -0
- package/dist/modes/interactive/theme/catppuccin-macchiato.json +1 -0
- package/dist/modes/interactive/theme/catppuccin-mocha.json +1 -0
- package/dist/modes/interactive/theme/dark.json +1 -0
- package/dist/modes/interactive/theme/light.json +1 -0
- package/dist/modes/interactive/theme/terminal-detection.d.ts +10 -0
- package/dist/modes/interactive/theme/terminal-detection.d.ts.map +1 -1
- package/dist/modes/interactive/theme/terminal-detection.js +19 -0
- package/dist/modes/interactive/theme/terminal-detection.js.map +1 -1
- package/dist/modes/interactive/theme/theme-class.d.ts +2 -2
- package/dist/modes/interactive/theme/theme-class.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-class.js +5 -1
- package/dist/modes/interactive/theme/theme-class.js.map +1 -1
- package/dist/modes/interactive/theme/theme-controller.d.ts +3 -1
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-controller.js +10 -13
- package/dist/modes/interactive/theme/theme-controller.js.map +1 -1
- package/dist/modes/interactive/theme/theme-loading.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-loading.js +1 -0
- package/dist/modes/interactive/theme/theme-loading.js.map +1 -1
- package/dist/modes/interactive/theme/theme-schema.d.ts +4 -0
- package/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-schema.js +2 -1
- package/dist/modes/interactive/theme/theme-schema.js.map +1 -1
- package/dist/modes/interactive/theme/theme-schema.json +5 -1
- package/dist/modes/interactive/theme/theme.d.ts +1 -1
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +1 -1
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/interactive-engine/engine-custom-ui.d.ts +1 -1
- package/dist/modes/interactive-engine/engine-custom-ui.d.ts.map +1 -1
- package/dist/modes/interactive-engine/engine-custom-ui.js +28 -11
- package/dist/modes/interactive-engine/engine-custom-ui.js.map +1 -1
- package/dist/modes/interactive-engine/engine-render-service.js +3 -3
- package/dist/modes/interactive-engine/engine-render-service.js.map +1 -1
- package/dist/modes/interactive-engine/extension-ui-bridge.d.ts +2 -1
- package/dist/modes/interactive-engine/extension-ui-bridge.d.ts.map +1 -1
- package/dist/modes/interactive-engine/extension-ui-bridge.js +2 -2
- package/dist/modes/interactive-engine/extension-ui-bridge.js.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.d.ts +7 -0
- package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.js +7 -0
- package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
- package/dist/modes/interactive-engine/protocol.d.ts +12 -10
- package/dist/modes/interactive-engine/protocol.d.ts.map +1 -1
- package/dist/modes/interactive-engine/protocol.js +14 -11
- package/dist/modes/interactive-engine/protocol.js.map +1 -1
- package/dist/modes/interactive-engine/remote-component.d.ts +11 -1
- package/dist/modes/interactive-engine/remote-component.d.ts.map +1 -1
- package/dist/modes/interactive-engine/remote-component.js +48 -8
- package/dist/modes/interactive-engine/remote-component.js.map +1 -1
- package/dist/modes/interactive-engine/terminal-mode-controller.d.ts +19 -12
- package/dist/modes/interactive-engine/terminal-mode-controller.d.ts.map +1 -1
- package/dist/modes/interactive-engine/terminal-mode-controller.js +54 -35
- package/dist/modes/interactive-engine/terminal-mode-controller.js.map +1 -1
- package/dist/modes/json-event.d.ts +28 -0
- package/dist/modes/json-event.d.ts.map +1 -0
- package/dist/modes/json-event.js +12 -0
- package/dist/modes/json-event.js.map +1 -0
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +2 -1
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-client-process.d.ts +1 -0
- package/dist/modes/rpc/rpc-client-process.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client-process.js +5 -1
- package/dist/modes/rpc/rpc-client-process.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +7 -2
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-command-handler.js +1 -1
- package/dist/modes/rpc/rpc-command-handler.js.map +1 -1
- package/dist/modes/rpc/rpc-event-buffer.d.ts +9 -0
- package/dist/modes/rpc/rpc-event-buffer.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-event-buffer.js +10 -5
- package/dist/modes/rpc/rpc-event-buffer.js.map +1 -1
- package/dist/modes/rpc/rpc-extension-ui.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-extension-ui.js +3 -0
- package/dist/modes/rpc/rpc-extension-ui.js.map +1 -1
- package/dist/modes/rpc/rpc-input.js +1 -1
- package/dist/modes/rpc/rpc-input.js.map +1 -1
- package/dist/modes/rpc/rpc-output-buffer.d.ts +9 -0
- package/dist/modes/rpc/rpc-output-buffer.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-output-buffer.js +10 -5
- package/dist/modes/rpc/rpc-output-buffer.js.map +1 -1
- package/dist/modes/rpc/rpc-provider-auth.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-provider-auth.js +3 -0
- package/dist/modes/rpc/rpc-provider-auth.js.map +1 -1
- package/dist/modes/rpc/rpc-responses.d.ts +1 -1
- package/dist/modes/rpc/rpc-responses.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-responses.js +13 -1
- package/dist/modes/rpc/rpc-responses.js.map +1 -1
- package/dist/modes/rpc/rpc-session-binding.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-session-binding.js +2 -1
- package/dist/modes/rpc/rpc-session-binding.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +9 -2
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/rpc-entry.js +2 -0
- package/dist/rpc-entry.js.map +1 -1
- package/dist/self-update-plan.d.ts.map +1 -1
- package/dist/self-update-plan.js +5 -4
- package/dist/self-update-plan.js.map +1 -1
- package/dist/server/create-harness.d.ts +53 -0
- package/dist/server/create-harness.d.ts.map +1 -0
- package/dist/server/create-harness.js +349 -0
- package/dist/server/create-harness.js.map +1 -0
- package/dist/utils/agent-attribution.d.ts +2 -0
- package/dist/utils/agent-attribution.d.ts.map +1 -0
- package/dist/utils/agent-attribution.js +2 -0
- package/dist/utils/agent-attribution.js.map +1 -0
- package/dist/utils/child-process.d.ts +3 -1
- package/dist/utils/child-process.d.ts.map +1 -1
- package/dist/utils/child-process.js +24 -4
- package/dist/utils/child-process.js.map +1 -1
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js +2 -1
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +12 -3
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/management-http.d.ts +23 -0
- package/dist/utils/management-http.d.ts.map +1 -0
- package/dist/utils/management-http.js +50 -0
- package/dist/utils/management-http.js.map +1 -0
- package/dist/utils/open-browser.d.ts.map +1 -1
- package/dist/utils/open-browser.js +2 -1
- package/dist/utils/open-browser.js.map +1 -1
- package/dist/utils/paths.d.ts +2 -0
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +13 -0
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +17 -4
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/tool-result-images.d.ts +17 -0
- package/dist/utils/tool-result-images.d.ts.map +1 -0
- package/dist/utils/tool-result-images.js +41 -0
- package/dist/utils/tool-result-images.js.map +1 -0
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +7 -8
- package/dist/utils/tools-manager.js.map +1 -1
- package/dist/utils/version-check.d.ts +4 -0
- package/dist/utils/version-check.d.ts.map +1 -1
- package/dist/utils/version-check.js +20 -2
- package/dist/utils/version-check.js.map +1 -1
- package/docs/compaction.md +2 -1
- package/docs/custom-provider.md +15 -7
- package/docs/development.md +1 -0
- package/docs/docs.json +1 -0
- package/docs/environment-variables.md +4 -0
- package/docs/extensions.md +102 -18
- package/docs/i-have-adhd.md +36 -0
- package/docs/intercom.md +26 -6
- package/docs/json.md +2 -2
- package/docs/keybindings.md +55 -12
- package/docs/models/model-selection.md +34 -8
- package/docs/models.md +28 -3
- package/docs/providers.md +20 -2
- package/docs/quickstart.md +5 -5
- package/docs/rpc.md +18 -12
- package/docs/sdk.md +43 -7
- package/docs/security.md +10 -10
- package/docs/sessions.md +2 -0
- package/docs/settings.md +25 -5
- package/docs/subagents.md +15 -30
- package/docs/themes.md +5 -3
- package/docs/tools.md +21 -1
- package/docs/tui.md +41 -24
- package/docs/usage.md +40 -14
- package/docs/windows.md +2 -0
- package/docs/workflows.md +216 -20
- package/examples/extensions/custom-provider-anthropic/index.ts +9 -2
- package/examples/extensions/custom-provider-gitlab-duo/index.ts +9 -2
- package/examples/extensions/modal-editor.ts +8 -10
- package/examples/extensions/rainbow-editor.ts +3 -2
- package/examples/extensions/subagent/README.md +16 -45
- package/examples/extensions/subagent/index.ts +6 -96
- package/examples/extensions/subagent/render.ts +0 -78
- package/examples/extensions/subagent/runner.ts +0 -3
- package/examples/extensions/subagent/schemas.ts +0 -13
- package/examples/extensions/subagent/types.ts +1 -2
- package/examples/sdk/09-api-keys-and-oauth.ts +6 -2
- package/examples/sdk/12-full-control.ts +8 -2
- package/examples/sdk/README.md +4 -1
- package/npm-shrinkwrap.json +191 -634
- package/package.json +14 -7
- package/dist/builtin/subagents/src/agents/chain-serializer.ts +0 -257
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-details.ts +0 -38
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-dynamic-step.ts +0 -280
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-parallel-runner.ts +0 -217
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-parallel-step.ts +0 -271
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-sequential-step.ts +0 -271
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-types.ts +0 -200
- package/dist/builtin/subagents/src/runs/foreground/chain-execution.ts +0 -184
- package/dist/builtin/subagents/src/runs/foreground/execution-structured-retries.ts +0 -19
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-chain.ts +0 -109
- package/dist/builtin/subagents/src/runs/shared/chain-outputs.ts +0 -126
- package/dist/builtin/subagents/src/runs/shared/dynamic-fanout.ts +0 -393
- package/dist/builtin/subagents/src/runs/shared/structured-output.ts +0 -150
- package/dist/builtin/subagents/src/runs/shared/workflow-graph.ts +0 -232
- package/dist/builtin/subagents/src/slash/saved-chain-mapping.ts +0 -60
- package/dist/builtin/subagents/src/tui/render-chain-graph.ts +0 -341
- package/examples/extensions/subagent/prompts/implement-and-review.md +0 -10
- package/examples/extensions/subagent/prompts/implement.md +0 -10
- package/examples/extensions/subagent/prompts/scout-and-plan.md +0 -9
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { APP_NAME } from "../config.js";
|
|
2
|
+
export class AuthCommandError extends Error {
|
|
3
|
+
constructor(message, exitCode = 1) {
|
|
4
|
+
super(message);
|
|
5
|
+
this.exitCode = exitCode;
|
|
6
|
+
this.name = "AuthCommandError";
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
const AUTH_COMMAND_USAGE = {
|
|
10
|
+
check: `${APP_NAME} auth check [--provider <provider>] [--model <model>] [--json] [--credentials] [--no-refresh]`,
|
|
11
|
+
api_key: `${APP_NAME} auth print-api-key --model <model> [--provider <provider>]`,
|
|
12
|
+
bearer_token: `${APP_NAME} auth print-bearer-token --model <model> [--provider <provider>] [--min-expiry <duration>]`,
|
|
13
|
+
};
|
|
14
|
+
export function getAuthCommandName(kind) {
|
|
15
|
+
return kind === "check" ? "auth check" : kind === "api_key" ? "auth print-api-key" : "auth print-bearer-token";
|
|
16
|
+
}
|
|
17
|
+
export function getAuthCommandUsage(kind) {
|
|
18
|
+
return AUTH_COMMAND_USAGE[kind];
|
|
19
|
+
}
|
|
20
|
+
export function isAuthCommandHelp(args) {
|
|
21
|
+
if (args[0] !== "auth")
|
|
22
|
+
return false;
|
|
23
|
+
if (args[1] === undefined || args[1] === "help" || args[1] === "--help" || args[1] === "-h")
|
|
24
|
+
return true;
|
|
25
|
+
const terminator = args.indexOf("--", 2);
|
|
26
|
+
const flags = args.slice(2, terminator === -1 ? undefined : terminator);
|
|
27
|
+
// Checks accept direct help flags. The print commands reserve every extra
|
|
28
|
+
// parser flag, including --help, as a usage error to keep their export stream narrow.
|
|
29
|
+
return args[1] === "check" && (flags.includes("--help") || flags.includes("-h"));
|
|
30
|
+
}
|
|
31
|
+
export function printAuthCommandHelp() {
|
|
32
|
+
console.error(`Usage:
|
|
33
|
+
${APP_NAME} auth print-api-key --model <model> [--provider <provider>]
|
|
34
|
+
${APP_NAME} auth print-bearer-token --model <model> [--provider <provider>] [--min-expiry <duration>]
|
|
35
|
+
${APP_NAME} auth check [--provider <provider>] [--model <model>] [--json] [--credentials] [--no-refresh]
|
|
36
|
+
|
|
37
|
+
Credential print commands write one configured credential alone on stdout. Everything else —
|
|
38
|
+
warnings, provider selection, refresh notices, and help — goes to stderr. --model is
|
|
39
|
+
required for these exports, so no ambient model can emit a credential you did not name.
|
|
40
|
+
|
|
41
|
+
Auth checks require at least one of --provider or --model. They print ready, not_ready,
|
|
42
|
+
or invalid on stdout and refresh expired OAuth credentials by default; --no-refresh
|
|
43
|
+
prevents a refresh and any auth.json mutation. --json includes the resolved provider
|
|
44
|
+
when one is found, plus auth type and a reason when it is not ready. --credentials is
|
|
45
|
+
an explicit export that needs --provider or an exact --model target; on a ready check
|
|
46
|
+
it writes the credential, or includes it in JSON. A non-ready raw export leaves stdout
|
|
47
|
+
empty and reports status on stderr.
|
|
48
|
+
|
|
49
|
+
--min-expiry accepts ms, s, m, or h (for example 30m) and applies only to
|
|
50
|
+
print-bearer-token, where it defaults to 30m. A token with less than that
|
|
51
|
+
remaining is refreshed first. It remains reserved after --, so print-api-key
|
|
52
|
+
still rejects it in either spelling.
|
|
53
|
+
|
|
54
|
+
Credential-export exit codes:
|
|
55
|
+
0 credential written to stdout
|
|
56
|
+
1 usage error
|
|
57
|
+
2 no credential configured
|
|
58
|
+
3 provider ambiguous
|
|
59
|
+
4 credential kind unsupported for that provider
|
|
60
|
+
5 refresh failed (the stored credential is left untouched)
|
|
61
|
+
6 provider cannot mint a token that lives long enough
|
|
62
|
+
7 the provider's OAuth credential could not be used
|
|
63
|
+
8 the credential could not be written (nothing was emitted)
|
|
64
|
+
9 the credential was written only in part; stdout holds an unusable
|
|
65
|
+
fragment, which the caller must discard rather than use
|
|
66
|
+
|
|
67
|
+
Auth-check exit codes:
|
|
68
|
+
0 provider is ready
|
|
69
|
+
1 provider is not ready
|
|
70
|
+
2 auth state or command is invalid
|
|
71
|
+
8 with --credentials, the credential could not be written
|
|
72
|
+
9 with --credentials, only part of the credential was written`);
|
|
73
|
+
}
|
|
74
|
+
function parseDuration(value, exitCode) {
|
|
75
|
+
const match = value ? /^(\d+)(ms|s|m|h)$/iu.exec(value) : undefined;
|
|
76
|
+
if (!match)
|
|
77
|
+
throw new AuthCommandError("--min-expiry must use a duration such as 30m or 1h", exitCode);
|
|
78
|
+
const unit = match[2].toLowerCase();
|
|
79
|
+
const scale = unit === "ms" ? 1 : unit === "s" ? 1_000 : unit === "m" ? 60_000 : 3_600_000;
|
|
80
|
+
return Number(match[1]) * scale;
|
|
81
|
+
}
|
|
82
|
+
/** Parse the `atomic auth` command surface before normal startup. */
|
|
83
|
+
export function parseAuthCommand(args) {
|
|
84
|
+
if (args[0] !== "auth")
|
|
85
|
+
return undefined;
|
|
86
|
+
const kind = args[1] === "check"
|
|
87
|
+
? "check"
|
|
88
|
+
: args[1] === "print-api-key"
|
|
89
|
+
? "api_key"
|
|
90
|
+
: args[1] === "print-bearer-token"
|
|
91
|
+
? "bearer_token"
|
|
92
|
+
: undefined;
|
|
93
|
+
if (!kind) {
|
|
94
|
+
throw new AuthCommandError(`Unknown auth command "${args[1] ?? ""}". Use "${APP_NAME} auth print-api-key", "${APP_NAME} auth print-bearer-token", or "${APP_NAME} auth check".`);
|
|
95
|
+
}
|
|
96
|
+
const exitCode = kind === "check" ? 2 : 1;
|
|
97
|
+
const commandArgs = [];
|
|
98
|
+
let json = false;
|
|
99
|
+
let credentials = false;
|
|
100
|
+
let noRefresh = false;
|
|
101
|
+
let minExpiryMs;
|
|
102
|
+
let optionsEnded = false;
|
|
103
|
+
for (let index = 2; index < args.length; index++) {
|
|
104
|
+
const arg = args[index];
|
|
105
|
+
if (arg === "--") {
|
|
106
|
+
optionsEnded = true;
|
|
107
|
+
commandArgs.push(arg);
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
const inlineMinExpiry = arg.startsWith("--min-expiry=") ? arg.slice("--min-expiry=".length) : undefined;
|
|
111
|
+
if (arg === "--min-expiry" || inlineMinExpiry !== undefined) {
|
|
112
|
+
if (kind !== "bearer_token") {
|
|
113
|
+
throw new AuthCommandError("--min-expiry is only supported by print-bearer-token", exitCode);
|
|
114
|
+
}
|
|
115
|
+
minExpiryMs = parseDuration(inlineMinExpiry ?? args[++index], exitCode);
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
if (!optionsEnded && (arg === "--json" || arg === "--credentials" || arg === "--no-refresh")) {
|
|
119
|
+
if (kind !== "check")
|
|
120
|
+
throw new AuthCommandError(`${arg} is only supported by auth check`, exitCode);
|
|
121
|
+
if (arg === "--json")
|
|
122
|
+
json = true;
|
|
123
|
+
else if (arg === "--credentials")
|
|
124
|
+
credentials = true;
|
|
125
|
+
else
|
|
126
|
+
noRefresh = true;
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
commandArgs.push(arg);
|
|
130
|
+
}
|
|
131
|
+
return minExpiryMs === undefined
|
|
132
|
+
? { kind, args: commandArgs, json, credentials, noRefresh }
|
|
133
|
+
: { kind, args: commandArgs, json, credentials, noRefresh, minExpiryMs };
|
|
134
|
+
}
|
|
135
|
+
export function validateAuthCheckArgs(args) {
|
|
136
|
+
const provider = args.provider?.trim() || undefined;
|
|
137
|
+
const model = args.model?.trim() || undefined;
|
|
138
|
+
if (args.unknownFlags.size > 0) {
|
|
139
|
+
const option = args.unknownFlags.keys().next().value;
|
|
140
|
+
throw new AuthCommandError(`Unknown option --${option} for "auth check".`);
|
|
141
|
+
}
|
|
142
|
+
if (args.apiKey !== undefined || args.messages.length > 0 || args.fileArgs.length > 0) {
|
|
143
|
+
throw new AuthCommandError("Auth checks only accept --provider and --model");
|
|
144
|
+
}
|
|
145
|
+
if (!provider && !model) {
|
|
146
|
+
throw new AuthCommandError("Auth checks require --provider <provider> or --model <model>");
|
|
147
|
+
}
|
|
148
|
+
return { provider, model };
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=auth-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-command.js","sourceRoot":"","sources":["../../src/cli/auth-command.ts"],"names":[],"mappings":"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","sourcesContent":["import { APP_NAME } from \"../config.ts\";\nimport type { Args } from \"./args.ts\";\n\nexport type AuthCommandKind = \"check\" | \"api_key\" | \"bearer_token\";\n\nexport interface AuthCommand {\n\tkind: AuthCommandKind;\n\t/** Remaining argv for the normal parser. */\n\targs: string[];\n\tjson: boolean;\n\t/** `auth check` emits a resolved credential only with this explicit opt-in. */\n\tcredentials: boolean;\n\tnoRefresh: boolean;\n\tminExpiryMs?: number;\n}\n\nexport class AuthCommandError extends Error {\n\t// Declared and assigned explicitly rather than as a constructor parameter\n\t// property: `tsconfig.base.json` sets `erasableSyntaxOnly`, under which a\n\t// parameter property is TS1294. Root `tsc --noEmit` does not surface it,\n\t// but the shipped build does.\n\treadonly exitCode: number;\n\n\tconstructor(message: string, exitCode = 1) {\n\t\tsuper(message);\n\t\tthis.exitCode = exitCode;\n\t\tthis.name = \"AuthCommandError\";\n\t}\n}\n\nconst AUTH_COMMAND_USAGE: Record<AuthCommandKind, string> = {\n\tcheck: `${APP_NAME} auth check [--provider <provider>] [--model <model>] [--json] [--credentials] [--no-refresh]`,\n\tapi_key: `${APP_NAME} auth print-api-key --model <model> [--provider <provider>]`,\n\tbearer_token: `${APP_NAME} auth print-bearer-token --model <model> [--provider <provider>] [--min-expiry <duration>]`,\n};\n\nexport function getAuthCommandName(kind: AuthCommandKind): string {\n\treturn kind === \"check\" ? \"auth check\" : kind === \"api_key\" ? \"auth print-api-key\" : \"auth print-bearer-token\";\n}\n\nexport function getAuthCommandUsage(kind: AuthCommandKind): string {\n\treturn AUTH_COMMAND_USAGE[kind];\n}\n\nexport function isAuthCommandHelp(args: string[]): boolean {\n\tif (args[0] !== \"auth\") return false;\n\tif (args[1] === undefined || args[1] === \"help\" || args[1] === \"--help\" || args[1] === \"-h\") return true;\n\tconst terminator = args.indexOf(\"--\", 2);\n\tconst flags = args.slice(2, terminator === -1 ? undefined : terminator);\n\t// Checks accept direct help flags. The print commands reserve every extra\n\t// parser flag, including --help, as a usage error to keep their export stream narrow.\n\treturn args[1] === \"check\" && (flags.includes(\"--help\") || flags.includes(\"-h\"));\n}\n\nexport function printAuthCommandHelp(): void {\n\tconsole.error(`Usage:\n ${APP_NAME} auth print-api-key --model <model> [--provider <provider>]\n ${APP_NAME} auth print-bearer-token --model <model> [--provider <provider>] [--min-expiry <duration>]\n ${APP_NAME} auth check [--provider <provider>] [--model <model>] [--json] [--credentials] [--no-refresh]\n\nCredential print commands write one configured credential alone on stdout. Everything else —\nwarnings, provider selection, refresh notices, and help — goes to stderr. --model is\nrequired for these exports, so no ambient model can emit a credential you did not name.\n\nAuth checks require at least one of --provider or --model. They print ready, not_ready,\nor invalid on stdout and refresh expired OAuth credentials by default; --no-refresh\nprevents a refresh and any auth.json mutation. --json includes the resolved provider\nwhen one is found, plus auth type and a reason when it is not ready. --credentials is\nan explicit export that needs --provider or an exact --model target; on a ready check\nit writes the credential, or includes it in JSON. A non-ready raw export leaves stdout\nempty and reports status on stderr.\n\n--min-expiry accepts ms, s, m, or h (for example 30m) and applies only to\nprint-bearer-token, where it defaults to 30m. A token with less than that\nremaining is refreshed first. It remains reserved after --, so print-api-key\nstill rejects it in either spelling.\n\nCredential-export exit codes:\n 0 credential written to stdout\n 1 usage error\n 2 no credential configured\n 3 provider ambiguous\n 4 credential kind unsupported for that provider\n 5 refresh failed (the stored credential is left untouched)\n 6 provider cannot mint a token that lives long enough\n 7 the provider's OAuth credential could not be used\n 8 the credential could not be written (nothing was emitted)\n 9 the credential was written only in part; stdout holds an unusable\n fragment, which the caller must discard rather than use\n\nAuth-check exit codes:\n 0 provider is ready\n 1 provider is not ready\n 2 auth state or command is invalid\n 8 with --credentials, the credential could not be written\n 9 with --credentials, only part of the credential was written`);\n}\n\nfunction parseDuration(value: string | undefined, exitCode: number): number {\n\tconst match = value ? /^(\\d+)(ms|s|m|h)$/iu.exec(value) : undefined;\n\tif (!match) throw new AuthCommandError(\"--min-expiry must use a duration such as 30m or 1h\", exitCode);\n\tconst unit = match[2].toLowerCase();\n\tconst scale = unit === \"ms\" ? 1 : unit === \"s\" ? 1_000 : unit === \"m\" ? 60_000 : 3_600_000;\n\treturn Number(match[1]) * scale;\n}\n\n/** Parse the `atomic auth` command surface before normal startup. */\nexport function parseAuthCommand(args: string[]): AuthCommand | undefined {\n\tif (args[0] !== \"auth\") return undefined;\n\n\tconst kind: AuthCommandKind | undefined =\n\t\targs[1] === \"check\"\n\t\t\t? \"check\"\n\t\t\t: args[1] === \"print-api-key\"\n\t\t\t\t? \"api_key\"\n\t\t\t\t: args[1] === \"print-bearer-token\"\n\t\t\t\t\t? \"bearer_token\"\n\t\t\t\t\t: undefined;\n\tif (!kind) {\n\t\tthrow new AuthCommandError(\n\t\t\t`Unknown auth command \"${args[1] ?? \"\"}\". Use \"${APP_NAME} auth print-api-key\", \"${APP_NAME} auth print-bearer-token\", or \"${APP_NAME} auth check\".`,\n\t\t);\n\t}\n\n\tconst exitCode = kind === \"check\" ? 2 : 1;\n\tconst commandArgs: string[] = [];\n\tlet json = false;\n\tlet credentials = false;\n\tlet noRefresh = false;\n\tlet minExpiryMs: number | undefined;\n\tlet optionsEnded = false;\n\tfor (let index = 2; index < args.length; index++) {\n\t\tconst arg = args[index];\n\t\tif (arg === \"--\") {\n\t\t\toptionsEnded = true;\n\t\t\tcommandArgs.push(arg);\n\t\t\tcontinue;\n\t\t}\n\t\tconst inlineMinExpiry = arg.startsWith(\"--min-expiry=\") ? arg.slice(\"--min-expiry=\".length) : undefined;\n\t\tif (arg === \"--min-expiry\" || inlineMinExpiry !== undefined) {\n\t\t\tif (kind !== \"bearer_token\") {\n\t\t\t\tthrow new AuthCommandError(\"--min-expiry is only supported by print-bearer-token\", exitCode);\n\t\t\t}\n\t\t\tminExpiryMs = parseDuration(inlineMinExpiry ?? args[++index], exitCode);\n\t\t\tcontinue;\n\t\t}\n\t\tif (!optionsEnded && (arg === \"--json\" || arg === \"--credentials\" || arg === \"--no-refresh\")) {\n\t\t\tif (kind !== \"check\") throw new AuthCommandError(`${arg} is only supported by auth check`, exitCode);\n\t\t\tif (arg === \"--json\") json = true;\n\t\t\telse if (arg === \"--credentials\") credentials = true;\n\t\t\telse noRefresh = true;\n\t\t\tcontinue;\n\t\t}\n\t\tcommandArgs.push(arg);\n\t}\n\n\treturn minExpiryMs === undefined\n\t\t? { kind, args: commandArgs, json, credentials, noRefresh }\n\t\t: { kind, args: commandArgs, json, credentials, noRefresh, minExpiryMs };\n}\n\nexport function validateAuthCheckArgs(args: Args): { provider?: string; model?: string } {\n\tconst provider = args.provider?.trim() || undefined;\n\tconst model = args.model?.trim() || undefined;\n\tif (args.unknownFlags.size > 0) {\n\t\tconst option = args.unknownFlags.keys().next().value;\n\t\tthrow new AuthCommandError(`Unknown option --${option} for \"auth check\".`);\n\t}\n\tif (args.apiKey !== undefined || args.messages.length > 0 || args.fileArgs.length > 0) {\n\t\tthrow new AuthCommandError(\"Auth checks only accept --provider and --model\");\n\t}\n\tif (!provider && !model) {\n\t\tthrow new AuthCommandError(\"Auth checks require --provider <provider> or --model <model>\");\n\t}\n\treturn { provider, model };\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* TUI config selector for `pi config` command
|
|
3
3
|
*/
|
|
4
|
-
import { ProcessTerminal,
|
|
4
|
+
import { ProcessTerminal, TuiMainScreen } from "@earendil-works/pi-tui";
|
|
5
5
|
import { ConfigSelectorComponent } from "../modes/interactive/components/config-selector.js";
|
|
6
6
|
import { initTheme, stopThemeWatcher } from "../modes/interactive/theme/theme.js";
|
|
7
7
|
/** Show TUI config selector and return when closed */
|
|
@@ -9,7 +9,7 @@ export async function selectConfig(options) {
|
|
|
9
9
|
// Initialize theme before showing TUI
|
|
10
10
|
initTheme(options.settingsManager.getTheme(), true);
|
|
11
11
|
return new Promise((resolve) => {
|
|
12
|
-
const ui = new
|
|
12
|
+
const ui = new TuiMainScreen(new ProcessTerminal(), undefined, options.agentDir);
|
|
13
13
|
let resolved = false;
|
|
14
14
|
const selector = new ConfigSelectorComponent(options.resolvedPaths, options.settingsManager, options.cwd, options.agentDir, () => {
|
|
15
15
|
if (!resolved) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-selector.js","sourceRoot":"","sources":["../../src/cli/config-selector.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"config-selector.js","sourceRoot":"","sources":["../../src/cli/config-selector.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAExE,OAAO,EAAE,uBAAuB,EAA4B,MAAM,oDAAoD,CAAC;AACvH,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAWlF,sDAAsD;AACtD,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,OAA8B;IAChE,sCAAsC;IACtC,SAAS,CAAC,OAAO,CAAC,eAAe,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,CAAC;IAEpD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC9B,MAAM,EAAE,GAAG,IAAI,aAAa,CAAC,IAAI,eAAe,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;QACjF,IAAI,QAAQ,GAAG,KAAK,CAAC;QAErB,MAAM,QAAQ,GAAG,IAAI,uBAAuB,CAC3C,OAAO,CAAC,aAAa,EACrB,OAAO,CAAC,eAAe,EACvB,OAAO,CAAC,GAAG,EACX,OAAO,CAAC,QAAQ,EAChB,GAAG,EAAE;YACJ,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACf,QAAQ,GAAG,IAAI,CAAC;gBAChB,EAAE,CAAC,IAAI,EAAE,CAAC;gBACV,gBAAgB,EAAE,CAAC;gBACnB,OAAO,EAAE,CAAC;YACX,CAAC;QACF,CAAC,EACD,GAAG,EAAE;YACJ,EAAE,CAAC,IAAI,EAAE,CAAC;YACV,gBAAgB,EAAE,CAAC;YACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACjB,CAAC,EACD,GAAG,EAAE,CAAC,EAAE,CAAC,aAAa,EAAE,EACxB,EAAE,CAAC,QAAQ,CAAC,IAAI,EAChB,OAAO,CAAC,UAAU,EAClB,OAAO,CAAC,oBAAoB,CAC5B,CAAC;QAEF,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACtB,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAC,CAAC;QACxC,EAAE,CAAC,KAAK,EAAE,CAAC;IACZ,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/**\n * TUI config selector for `pi config` command\n */\n\nimport { ProcessTerminal, TuiMainScreen } from \"@earendil-works/pi-tui\";\nimport type { SettingsManager } from \"../core/settings-manager.ts\";\nimport { ConfigSelectorComponent, type ScopedResolvedPaths } from \"../modes/interactive/components/config-selector.ts\";\nimport { initTheme, stopThemeWatcher } from \"../modes/interactive/theme/theme.ts\";\n\nexport interface ConfigSelectorOptions {\n\tresolvedPaths: ScopedResolvedPaths;\n\tsettingsManager: SettingsManager;\n\tcwd: string;\n\tagentDir: string;\n\twriteScope: \"global\" | \"project\";\n\tprojectModeAvailable: boolean;\n}\n\n/** Show TUI config selector and return when closed */\nexport async function selectConfig(options: ConfigSelectorOptions): Promise<void> {\n\t// Initialize theme before showing TUI\n\tinitTheme(options.settingsManager.getTheme(), true);\n\n\treturn new Promise((resolve) => {\n\t\tconst ui = new TuiMainScreen(new ProcessTerminal(), undefined, options.agentDir);\n\t\tlet resolved = false;\n\n\t\tconst selector = new ConfigSelectorComponent(\n\t\t\toptions.resolvedPaths,\n\t\t\toptions.settingsManager,\n\t\t\toptions.cwd,\n\t\t\toptions.agentDir,\n\t\t\t() => {\n\t\t\t\tif (!resolved) {\n\t\t\t\t\tresolved = true;\n\t\t\t\t\tui.stop();\n\t\t\t\t\tstopThemeWatcher();\n\t\t\t\t\tresolve();\n\t\t\t\t}\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tui.stop();\n\t\t\t\tstopThemeWatcher();\n\t\t\t\tprocess.exit(0);\n\t\t\t},\n\t\t\t() => ui.requestRender(),\n\t\t\tui.terminal.rows,\n\t\t\toptions.writeScope,\n\t\t\toptions.projectModeAvailable,\n\t\t);\n\n\t\tui.addChild(selector);\n\t\tui.setFocus(selector.getResourceList());\n\t\tui.start();\n\t});\n}\n"]}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `atomic auth print-api-key` / `atomic auth print-bearer-token
|
|
2
|
+
* `atomic auth print-api-key` / `atomic auth print-bearer-token` and the
|
|
3
|
+
* explicit `atomic auth check --credentials` export path.
|
|
3
4
|
*
|
|
4
5
|
* The only door in Atomic whose purpose is emitting a secret. Everything here
|
|
5
6
|
* exists to keep that egress narrow:
|
|
6
|
-
*
|
|
7
7
|
* - the secret leaves as a `Secret`, which cannot be interpolated, serialized,
|
|
8
8
|
* or inspected, and is consumed exactly once by the stdout writer;
|
|
9
|
-
* -
|
|
10
|
-
*
|
|
9
|
+
* - every export has an explicit target: the print commands require `--model`,
|
|
10
|
+
* and auth checks require `--provider` or an exact `--model` plus
|
|
11
|
+
* `--credentials`;
|
|
11
12
|
* - there is no `--output <file>` and no clipboard path — stdout only;
|
|
12
13
|
* - every failure is a distinct exit code, and stdout stays empty on all of
|
|
13
14
|
* them but one — `CredentialTruncated` (exit 9) exists to report the case
|
|
@@ -73,14 +74,21 @@ export declare class Secret {
|
|
|
73
74
|
[Symbol.toPrimitive](): never;
|
|
74
75
|
[inspect.custom](): string;
|
|
75
76
|
}
|
|
77
|
+
/** Public readiness fields emitted with a credential under `auth check --json --credentials`. */
|
|
78
|
+
export interface CredentialJsonFields {
|
|
79
|
+
status: string;
|
|
80
|
+
provider: string;
|
|
81
|
+
authType?: string;
|
|
82
|
+
}
|
|
76
83
|
/**
|
|
77
84
|
* The single credential egress in `src`.
|
|
78
85
|
*
|
|
79
|
-
* `
|
|
80
|
-
* is the
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
86
|
+
* `credentialPayload` opens the secret only while building this one payload,
|
|
87
|
+
* and this guarded write is the only path that hands it to real stdout. A
|
|
88
|
+
* caller — `main.ts` included — receives a `Secret` it cannot read, print, or
|
|
89
|
+
* serialize, so it cannot add a second export path without crossing this door.
|
|
90
|
+
* `test/credential-print.test.ts` pins both the `take()` sites and every
|
|
91
|
+
* data-bearing real-stdout write in `packages/coding-agent/src`.
|
|
84
92
|
*
|
|
85
93
|
* A failed payload write is answered from the stream rather than from the shape
|
|
86
94
|
* of the error, because `bytesWritten` says how much of the credential actually
|
|
@@ -103,11 +111,8 @@ export declare class Secret {
|
|
|
103
111
|
* the one code in this taxonomy whose contract is *not* an empty stdout —
|
|
104
112
|
* stated as such in `EXIT_CODES` and asserted through `STDOUT_EMPTY_ON_EXIT`,
|
|
105
113
|
* rather than left for a caller to discover.
|
|
106
|
-
*
|
|
107
|
-
* `test/credential-print.test.ts` asserts that chokepoint against the whole of
|
|
108
|
-
* `packages/coding-agent/src`.
|
|
109
114
|
*/
|
|
110
|
-
export declare function emitCredential(secret: Secret): Promise<void>;
|
|
115
|
+
export declare function emitCredential(secret: Secret, jsonFields: CredentialJsonFields | undefined): Promise<void>;
|
|
111
116
|
/**
|
|
112
117
|
* The single place a thrown value becomes an exit code for this door.
|
|
113
118
|
*
|
|
@@ -115,16 +120,6 @@ export declare function emitCredential(secret: Secret): Promise<void>;
|
|
|
115
120
|
* stdout empty, so an exit code from this door never contradicts the stream.
|
|
116
121
|
*/
|
|
117
122
|
export declare function toCredentialPrintError(error: unknown): CredentialPrintError;
|
|
118
|
-
export interface CredentialPrintCommand {
|
|
119
|
-
kind: CredentialPrintKind;
|
|
120
|
-
/** Remaining argv for the normal parser (`--model`, `--provider`). */
|
|
121
|
-
args: string[];
|
|
122
|
-
minExpiryMs?: number;
|
|
123
|
-
}
|
|
124
|
-
export declare function isCredentialPrintHelp(args: string[]): boolean;
|
|
125
|
-
export declare function printCredentialPrintHelp(): void;
|
|
126
|
-
/** Parse the `auth` command surface before normal startup. */
|
|
127
|
-
export declare function parseCredentialPrintCommand(args: string[]): CredentialPrintCommand | undefined;
|
|
128
123
|
export declare function validateCredentialPrintArgs(args: Args): void;
|
|
129
124
|
export declare function redactCredentialShapes(text: string): string;
|
|
130
125
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credential-print.d.ts","sourceRoot":"","sources":["../../src/cli/credential-print.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"credential-print.d.ts","sourceRoot":"","sources":["../../src/cli/credential-print.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,cAAc,CAAC;AAE7D,8EAA8E;AAC9E,eAAO,MAAM,kCAAkC,QAAc,CAAC;AAE9D;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GACjC,OAAO,GACP,wBAAwB,GACxB,mBAAmB,GACnB,4BAA4B,GAC5B,eAAe,GACf,wBAAwB,GACxB,kBAAkB,GAClB,sBAAsB,GACtB,qBAAqB,CAAC;AAEzB;;;;;;;;;GASG;AACH,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,wBAAwB,EAAE,MAAM,CAU/D,CAAC;AAEF,qEAAqE;AACrE,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC,wBAAwB,CAEtE,CAAC;AAEF,qBAAa,oBAAqB,SAAQ,KAAK;IAC9C,QAAQ,CAAC,IAAI,EAAE,wBAAwB,CAAC;IACxC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B,YAAY,IAAI,EAAE,wBAAwB,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,EAKzF;CACD;AAED;;;;;;;;;;GAUG;AACH,qBAAa,MAAM;;IAGlB,YAAY,KAAK,EAAE,MAAM,EAExB;IAED,qEAAqE;IACrE,IAAI,IAAI,MAAM,CAOb;IAED,QAAQ,IAAI,KAAK,CAEhB;IAED,MAAM,IAAI,KAAK,CAEd;IAED,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,KAAK,CAE5B;IAED,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,MAAM,CAEzB;CACD;AAED,iGAAiG;AACjG,MAAM,WAAW,oBAAoB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAmCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAsB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,oBAAoB,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAmChH;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,oBAAoB,CAO3E;AA6BD,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAiB5D;AAsDD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAY3D;AAED;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,6BAA6B,CAAC;AAEtE;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,qBAAqB,CAAC;AAEhE;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,WAAW,GAAG,oBAAoB,CAe7E;AA8CD;;;;;;GAMG;AACH,wBAAsB,yBAAyB,CAC9C,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,mBAAmB,EACzB,WAAW,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,CAAC,CA6GjB"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `atomic auth print-api-key` / `atomic auth print-bearer-token
|
|
2
|
+
* `atomic auth print-api-key` / `atomic auth print-bearer-token` and the
|
|
3
|
+
* explicit `atomic auth check --credentials` export path.
|
|
3
4
|
*
|
|
4
5
|
* The only door in Atomic whose purpose is emitting a secret. Everything here
|
|
5
6
|
* exists to keep that egress narrow:
|
|
6
|
-
*
|
|
7
7
|
* - the secret leaves as a `Secret`, which cannot be interpolated, serialized,
|
|
8
8
|
* or inspected, and is consumed exactly once by the stdout writer;
|
|
9
|
-
* -
|
|
10
|
-
*
|
|
9
|
+
* - every export has an explicit target: the print commands require `--model`,
|
|
10
|
+
* and auth checks require `--provider` or an exact `--model` plus
|
|
11
|
+
* `--credentials`;
|
|
11
12
|
* - there is no `--output <file>` and no clipboard path — stdout only;
|
|
12
13
|
* - every failure is a distinct exit code, and stdout stays empty on all of
|
|
13
14
|
* them but one — `CredentialTruncated` (exit 9) exists to report the case
|
|
@@ -22,7 +23,6 @@
|
|
|
22
23
|
*/
|
|
23
24
|
import { inspect } from "node:util";
|
|
24
25
|
import { ModelsError } from "@earendil-works/pi-ai";
|
|
25
|
-
import { APP_NAME } from "../config.js";
|
|
26
26
|
import { resolveCliModel } from "../core/model-resolver.js";
|
|
27
27
|
import { flushRawStdout, RawStdoutWriteError, writeRawStdoutOnce } from "../core/output-guard.js";
|
|
28
28
|
/** Bearer tokens are refreshed unless they still have this much life left. */
|
|
@@ -96,14 +96,44 @@ export class Secret {
|
|
|
96
96
|
return "[Secret]";
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* The only function in `src` that opens a `Secret`.
|
|
101
|
+
*
|
|
102
|
+
* Its two `Secret.take()` calls are the only call sites in `src`, and the
|
|
103
|
+
* source-wide credential-egress test pins that list. This function builds one
|
|
104
|
+
* payload and returns it only to `emitCredential`; no caller receives a plain
|
|
105
|
+
* credential string.
|
|
106
|
+
*/
|
|
107
|
+
function credentialPayload(secret, jsonFields) {
|
|
108
|
+
if (jsonFields === undefined)
|
|
109
|
+
return `${secret.take()}\n`;
|
|
110
|
+
const { status, provider, authType } = jsonFields;
|
|
111
|
+
if (typeof status !== "string" ||
|
|
112
|
+
typeof provider !== "string" ||
|
|
113
|
+
(authType !== undefined && typeof authType !== "string")) {
|
|
114
|
+
throw new Error("Invalid credential JSON fields");
|
|
115
|
+
}
|
|
116
|
+
// Allowlist the non-secret envelope before opening the Secret. That leaves no
|
|
117
|
+
// formatter, logger, or error path between take() and the guarded stdout write.
|
|
118
|
+
const fields = JSON.stringify({
|
|
119
|
+
status,
|
|
120
|
+
provider,
|
|
121
|
+
...(authType === undefined ? {} : { authType }),
|
|
122
|
+
});
|
|
123
|
+
if (fields === undefined || !fields.startsWith("{") || !fields.endsWith("}")) {
|
|
124
|
+
throw new Error("Invalid credential JSON envelope");
|
|
125
|
+
}
|
|
126
|
+
return `${fields.slice(0, -1)},"credentials":${JSON.stringify(secret.take())}}\n`;
|
|
127
|
+
}
|
|
99
128
|
/**
|
|
100
129
|
* The single credential egress in `src`.
|
|
101
130
|
*
|
|
102
|
-
* `
|
|
103
|
-
* is the
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
131
|
+
* `credentialPayload` opens the secret only while building this one payload,
|
|
132
|
+
* and this guarded write is the only path that hands it to real stdout. A
|
|
133
|
+
* caller — `main.ts` included — receives a `Secret` it cannot read, print, or
|
|
134
|
+
* serialize, so it cannot add a second export path without crossing this door.
|
|
135
|
+
* `test/credential-print.test.ts` pins both the `take()` sites and every
|
|
136
|
+
* data-bearing real-stdout write in `packages/coding-agent/src`.
|
|
107
137
|
*
|
|
108
138
|
* A failed payload write is answered from the stream rather than from the shape
|
|
109
139
|
* of the error, because `bytesWritten` says how much of the credential actually
|
|
@@ -126,13 +156,9 @@ export class Secret {
|
|
|
126
156
|
* the one code in this taxonomy whose contract is *not* an empty stdout —
|
|
127
157
|
* stated as such in `EXIT_CODES` and asserted through `STDOUT_EMPTY_ON_EXIT`,
|
|
128
158
|
* rather than left for a caller to discover.
|
|
129
|
-
*
|
|
130
|
-
* `test/credential-print.test.ts` asserts that chokepoint against the whole of
|
|
131
|
-
* `packages/coding-agent/src`.
|
|
132
159
|
*/
|
|
133
|
-
export async function emitCredential(secret) {
|
|
134
|
-
|
|
135
|
-
const payload = `${secret.take()}\n`;
|
|
160
|
+
export async function emitCredential(secret, jsonFields) {
|
|
161
|
+
const payload = credentialPayload(secret, jsonFields);
|
|
136
162
|
try {
|
|
137
163
|
await writeRawStdoutOnce(payload);
|
|
138
164
|
}
|
|
@@ -166,78 +192,6 @@ export function toCredentialPrintError(error) {
|
|
|
166
192
|
return error;
|
|
167
193
|
return new CredentialPrintError("NoCredentialConfigured", error instanceof Error ? error.message : "Failed to resolve credential", { cause: error });
|
|
168
194
|
}
|
|
169
|
-
export function isCredentialPrintHelp(args) {
|
|
170
|
-
return (args[0] === "auth" && (args[1] === undefined || args[1] === "help" || args[1] === "--help" || args[1] === "-h"));
|
|
171
|
-
}
|
|
172
|
-
export function printCredentialPrintHelp() {
|
|
173
|
-
// Branded through APP_NAME: Atomic's binary is `atomic`, and help output must
|
|
174
|
-
// never render upstream's `pi`.
|
|
175
|
-
console.error(`Usage:
|
|
176
|
-
${APP_NAME} auth print-api-key --model <model> [--provider <provider>]
|
|
177
|
-
${APP_NAME} auth print-bearer-token --model <model> [--provider <provider>] [--min-expiry <duration>]
|
|
178
|
-
|
|
179
|
-
Prints one configured credential alone on stdout. Everything else — warnings,
|
|
180
|
-
provider selection, refresh notices — goes to stderr, and stdout stays empty on
|
|
181
|
-
every failure but exit 9, which reports that it could not be.
|
|
182
|
-
|
|
183
|
-
--model is required: there is no ambient "current model". Provider inference
|
|
184
|
-
uses configured credentials; pass --provider to select one explicitly.
|
|
185
|
-
|
|
186
|
-
--min-expiry accepts ms, s, m, or h (for example 30m) and applies only to
|
|
187
|
-
print-bearer-token, where it defaults to 30m. A token with less than that
|
|
188
|
-
remaining is refreshed first.
|
|
189
|
-
|
|
190
|
-
Exit codes:
|
|
191
|
-
0 credential written to stdout
|
|
192
|
-
1 usage error
|
|
193
|
-
2 no credential configured
|
|
194
|
-
3 provider ambiguous
|
|
195
|
-
4 credential kind unsupported for that provider
|
|
196
|
-
5 refresh failed (the stored credential is left untouched)
|
|
197
|
-
6 provider cannot mint a token that lives long enough
|
|
198
|
-
7 the provider's OAuth credential could not be used
|
|
199
|
-
8 the credential could not be written (nothing was emitted)
|
|
200
|
-
9 the credential was written only in part; stdout holds an unusable
|
|
201
|
-
fragment, which the caller must discard rather than use`);
|
|
202
|
-
}
|
|
203
|
-
function parseDuration(value) {
|
|
204
|
-
const match = value ? /^(\d+)(ms|s|m|h)$/iu.exec(value) : undefined;
|
|
205
|
-
if (!match) {
|
|
206
|
-
throw new CredentialPrintError("Usage", "--min-expiry must use a duration such as 30m or 1h");
|
|
207
|
-
}
|
|
208
|
-
const unit = match[2].toLowerCase();
|
|
209
|
-
const scale = unit === "ms" ? 1 : unit === "s" ? 1_000 : unit === "m" ? 60_000 : 3_600_000;
|
|
210
|
-
return Number(match[1]) * scale;
|
|
211
|
-
}
|
|
212
|
-
/** Parse the `auth` command surface before normal startup. */
|
|
213
|
-
export function parseCredentialPrintCommand(args) {
|
|
214
|
-
if (args[0] !== "auth")
|
|
215
|
-
return undefined;
|
|
216
|
-
const kind = args[1] === "print-api-key" ? "api_key" : args[1] === "print-bearer-token" ? "bearer_token" : undefined;
|
|
217
|
-
if (!kind) {
|
|
218
|
-
throw new CredentialPrintError("Usage", `Unknown auth command "${args[1] ?? ""}". Use "${APP_NAME} auth print-api-key" or "${APP_NAME} auth print-bearer-token".`);
|
|
219
|
-
}
|
|
220
|
-
const INLINE_MIN_EXPIRY = "--min-expiry=";
|
|
221
|
-
const commandArgs = [];
|
|
222
|
-
let minExpiryMs;
|
|
223
|
-
for (let index = 2; index < args.length; index++) {
|
|
224
|
-
const arg = args[index];
|
|
225
|
-
const inline = arg.startsWith(INLINE_MIN_EXPIRY) ? arg.slice(INLINE_MIN_EXPIRY.length) : undefined;
|
|
226
|
-
if (arg !== "--min-expiry" && inline === undefined) {
|
|
227
|
-
commandArgs.push(arg);
|
|
228
|
-
continue;
|
|
229
|
-
}
|
|
230
|
-
// An API key has no expiry, so the option is an error rather than a
|
|
231
|
-
// silently ignored no-op that would imply a guarantee it cannot give.
|
|
232
|
-
// Both spellings are refused: `--min-expiry=30m` reaching the ordinary
|
|
233
|
-
// parser as an unknown flag would report the wrong cause.
|
|
234
|
-
if (kind !== "bearer_token") {
|
|
235
|
-
throw new CredentialPrintError("Usage", "--min-expiry is only supported by print-bearer-token");
|
|
236
|
-
}
|
|
237
|
-
minExpiryMs = parseDuration(inline ?? args[++index]);
|
|
238
|
-
}
|
|
239
|
-
return minExpiryMs === undefined ? { kind, args: commandArgs } : { kind, args: commandArgs, minExpiryMs };
|
|
240
|
-
}
|
|
241
195
|
/**
|
|
242
196
|
* The only two fields of `Args` this door accepts.
|
|
243
197
|
*
|