@ai-agent-forge/agent-forge 0.88.2 → 0.88.4
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 +33 -0
- package/README.md +1 -1
- package/bundled-plugins/agent-loop-policy/agent-forge.json +1 -1
- package/bundled-plugins/agent-loop-policy/plugin.json +1 -1
- package/bundled-plugins/coding-tools/agent-forge.json +1 -1
- package/bundled-plugins/coding-tools/plugin.json +1 -1
- package/bundled-plugins/compaction-policy/agent-forge.json +1 -1
- package/bundled-plugins/compaction-policy/plugin.json +1 -1
- package/bundled-plugins/overflow-policy/agent-forge.json +1 -1
- package/bundled-plugins/overflow-policy/plugin.json +1 -1
- package/bundled-plugins/provider-failover/agent-forge.json +1 -1
- package/bundled-plugins/provider-failover/plugin.json +1 -1
- package/bundled-plugins/retry-policy/agent-forge.json +1 -1
- package/bundled-plugins/retry-policy/plugin.json +1 -1
- package/dist/artifacts/paged-read.d.ts +6 -1
- package/dist/artifacts/paged-read.d.ts.map +1 -1
- package/dist/artifacts/paged-read.js.map +1 -1
- package/dist/bundle/.build-manifest.json +244 -234
- package/dist/bundle/chunks/{anthropic-messages-PLAKXR73.js → anthropic-messages-3FJHRAJL.js} +2 -2
- package/dist/bundle/chunks/anthropic.js +1 -1
- package/dist/bundle/chunks/{azure-openai-responses-OUWQ2AZD.js → azure-openai-responses-GCL47IDS.js} +1 -1
- package/dist/bundle/chunks/bedrock-converse-stream.js +1 -1
- package/dist/bundle/chunks/{chunk-6F5JWGKE.js → chunk-32YDZI4J.js} +1 -1
- package/dist/bundle/chunks/{chunk-LSP24WNH.js → chunk-755VNWIF.js} +12 -12
- package/dist/bundle/chunks/{chunk-DRQDKNXA.js → chunk-BVVSHK6W.js} +1 -1
- package/dist/bundle/chunks/{chunk-HTC5K5SM.js → chunk-HEL6TAWE.js} +95 -90
- package/dist/bundle/chunks/{chunk-6R7UI4IY.js → chunk-QDLOMKF6.js} +1 -1
- package/dist/bundle/chunks/{chunk-44I47ACN.js → chunk-V3ACW7VD.js} +1 -1
- package/dist/bundle/chunks/{google-generative-ai-DLII6DAT.js → google-generative-ai-6BMXWA44.js} +1 -1
- package/dist/bundle/chunks/{google-vertex-G7BZL7GM.js → google-vertex-6H7NLRTK.js} +1 -1
- package/dist/bundle/chunks/image-resize-worker.js +1 -1
- package/dist/bundle/chunks/{mistral-conversations-JXUK24ID.js → mistral-conversations-IXUHSFSJ.js} +1 -1
- package/dist/bundle/chunks/{openai-codex-responses-5GSGFIPG.js → openai-codex-responses-YHUAEVCM.js} +1 -1
- package/dist/bundle/chunks/openai-codex.js +1 -1
- package/dist/bundle/chunks/{openai-completions-EI2I6DTG.js → openai-completions-ULQCFC72.js} +1 -1
- package/dist/bundle/chunks/openai-responses-NLLAJDPS.js +2 -0
- package/dist/bundle/chunks/{openrouter-images-G4GQRUSG.js → openrouter-images-GZZQZXMS.js} +1 -1
- package/dist/bundle/chunks/openrouter.js +1 -1
- package/dist/bundle/chunks/{pi-messages-PWU2VJMR.js → pi-messages-EJTI2EJ3.js} +1 -1
- package/dist/bundle/chunks/virtual-modules-TQWEGNNZ.js +5 -0
- package/dist/bundle/cli.js +1 -1
- package/dist/bundle/client.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/cli/args.d.ts +0 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +1 -4
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/config-selector.d.ts.map +1 -1
- package/dist/cli/config-selector.js +1 -1
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/cli/experimental/cli.d.ts +3 -3
- package/dist/cli/experimental/cli.d.ts.map +1 -1
- package/dist/cli/experimental/cli.js +2 -2
- package/dist/cli/experimental/cli.js.map +1 -1
- package/dist/cli/experimental/commands/agent-forge.d.ts +15 -0
- package/dist/cli/experimental/commands/agent-forge.d.ts.map +1 -0
- package/dist/cli/experimental/commands/{pi.js → agent-forge.js} +4 -4
- package/dist/cli/experimental/commands/agent-forge.js.map +1 -0
- package/dist/cli/startup-ui.d.ts.map +1 -1
- package/dist/cli/startup-ui.js +1 -1
- package/dist/cli/startup-ui.js.map +1 -1
- package/dist/config.d.ts +4 -4
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +7 -7
- package/dist/config.js.map +1 -1
- package/dist/core/agent-forge-manifest.d.ts +7 -0
- package/dist/core/agent-forge-manifest.d.ts.map +1 -0
- package/dist/core/{pi-manifest.js → agent-forge-manifest.js} +4 -4
- package/dist/core/agent-forge-manifest.js.map +1 -0
- package/dist/core/agent-session-compaction.d.ts +1 -1
- package/dist/core/agent-session-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-compaction.js +3 -3
- package/dist/core/agent-session-compaction.js.map +1 -1
- package/dist/core/agent-session-lifecycle.d.ts.map +1 -1
- package/dist/core/agent-session-lifecycle.js +12 -1
- package/dist/core/agent-session-lifecycle.js.map +1 -1
- package/dist/core/agent-session-projection.d.ts.map +1 -1
- package/dist/core/agent-session-projection.js +3 -3
- package/dist/core/agent-session-projection.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +1 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +1 -1
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +1 -1
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/experimental.d.ts.map +1 -1
- package/dist/core/experimental.js +1 -3
- package/dist/core/experimental.js.map +1 -1
- package/dist/core/extensions/capability-plugin.d.ts.map +1 -1
- package/dist/core/extensions/capability-plugin.js +15 -8
- package/dist/core/extensions/capability-plugin.js.map +1 -1
- package/dist/core/extensions/capability-runtime-store.d.ts +20 -1
- package/dist/core/extensions/capability-runtime-store.d.ts.map +1 -1
- package/dist/core/extensions/capability-runtime-store.js +67 -0
- package/dist/core/extensions/capability-runtime-store.js.map +1 -1
- package/dist/core/extensions/capability-runtime-types.d.ts +14 -0
- package/dist/core/extensions/capability-runtime-types.d.ts.map +1 -1
- package/dist/core/extensions/capability-runtime-types.js +7 -1
- package/dist/core/extensions/capability-runtime-types.js.map +1 -1
- package/dist/core/extensions/capability-runtime.d.ts.map +1 -1
- package/dist/core/extensions/capability-runtime.js +144 -42
- package/dist/core/extensions/capability-runtime.js.map +1 -1
- package/dist/core/extensions/virtual-modules.d.ts.map +1 -1
- package/dist/core/extensions/virtual-modules.js +12 -4
- package/dist/core/extensions/virtual-modules.js.map +1 -1
- package/dist/core/facade/coding-agent-facade.d.ts +1 -1
- package/dist/core/facade/coding-agent-facade.d.ts.map +1 -1
- package/dist/core/facade/coding-agent-facade.js +1 -1
- package/dist/core/facade/coding-agent-facade.js.map +1 -1
- package/dist/core/i18n/locales/zh-cn/core-contract-final.d.ts +1 -1
- package/dist/core/i18n/locales/zh-cn/core-contract-final.d.ts.map +1 -1
- package/dist/core/i18n/locales/zh-cn/core-contract-final.js +3 -3
- package/dist/core/i18n/locales/zh-cn/core-contract-final.js.map +1 -1
- package/dist/core/i18n/locales/zh-cn/core-contract-plugins.d.ts.map +1 -1
- package/dist/core/i18n/locales/zh-cn/core-contract-plugins.js +1 -1
- package/dist/core/i18n/locales/zh-cn/core-contract-plugins.js.map +1 -1
- package/dist/core/i18n/locales/zh-cn/core-errors.d.ts.map +1 -1
- package/dist/core/i18n/locales/zh-cn/core-errors.js +1 -1
- package/dist/core/i18n/locales/zh-cn/core-errors.js.map +1 -1
- package/dist/core/i18n/locales/zh-cn/tui-components-misc.d.ts.map +1 -1
- package/dist/core/i18n/locales/zh-cn/tui-components-misc.js +2 -0
- package/dist/core/i18n/locales/zh-cn/tui-components-misc.js.map +1 -1
- package/dist/core/model-resolver.d.ts +2 -0
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +4 -1
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/package-resource-collection.d.ts.map +1 -1
- package/dist/core/package-resource-collection.js +5 -5
- package/dist/core/package-resource-collection.js.map +1 -1
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +3 -3
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +1 -1
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/sdk.d.ts +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +6 -7
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +4 -4
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +5 -10
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/timings.d.ts.map +1 -1
- package/dist/core/timings.js +1 -3
- package/dist/core/timings.js.map +1 -1
- package/dist/core/tools/render-utils.d.ts +1 -1
- package/dist/core/tools/render-utils.d.ts.map +1 -1
- package/dist/core/tools/render-utils.js.map +1 -1
- package/dist/core/tools/tool-definition.d.ts +1 -1
- package/dist/core/tools/tool-definition.d.ts.map +1 -1
- package/dist/core/tools/tool-definition.js.map +1 -1
- package/dist/core/trace-retention.d.ts +16 -1
- package/dist/core/trace-retention.d.ts.map +1 -1
- package/dist/core/trace-retention.js +43 -20
- package/dist/core/trace-retention.js.map +1 -1
- package/dist/export-html/ansi-to-html.d.ts.map +1 -0
- package/dist/export-html/ansi-to-html.js.map +1 -0
- package/dist/{core/export-html → export-html}/index.d.ts +1 -1
- package/dist/export-html/index.d.ts.map +1 -0
- package/dist/{core/export-html → export-html}/index.js +5 -5
- package/dist/export-html/index.js.map +1 -0
- package/dist/{core/export-html → export-html}/tool-renderer.d.ts +2 -2
- package/dist/export-html/tool-renderer.d.ts.map +1 -0
- package/dist/export-html/tool-renderer.js.map +1 -0
- package/dist/{modes/interactive → host}/model-catalog-refresh.d.ts +1 -1
- package/dist/host/model-catalog-refresh.d.ts.map +1 -0
- package/dist/{modes/interactive → host}/model-catalog-refresh.js +1 -1
- package/dist/host/model-catalog-refresh.js.map +1 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -12
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +25 -14
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/agents-view.d.ts.map +1 -1
- package/dist/modes/interactive/components/agents-view.js +1 -1
- package/dist/modes/interactive/components/agents-view.js.map +1 -1
- package/dist/modes/interactive/components/armin.d.ts.map +1 -1
- package/dist/modes/interactive/components/armin.js +1 -1
- package/dist/modes/interactive/components/armin.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts +3 -0
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +83 -24
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js +1 -1
- package/dist/modes/interactive/components/bash-execution.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.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.js +1 -1
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.js +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +1 -1
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-entry.js +1 -1
- package/dist/modes/interactive/components/custom-entry.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-message.js +1 -1
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/daxnuts.d.ts.map +1 -1
- package/dist/modes/interactive/components/daxnuts.js +1 -1
- package/dist/modes/interactive/components/daxnuts.js.map +1 -1
- package/dist/modes/interactive/components/dialog-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/dialog-editor.js +1 -1
- package/dist/modes/interactive/components/dialog-editor.js.map +1 -1
- package/dist/modes/interactive/components/dialog-input.d.ts.map +1 -1
- package/dist/modes/interactive/components/dialog-input.js +1 -1
- package/dist/modes/interactive/components/dialog-input.js.map +1 -1
- package/dist/modes/interactive/components/dialog-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/dialog-selector.js +1 -1
- package/dist/modes/interactive/components/dialog-selector.js.map +1 -1
- package/dist/modes/interactive/components/diff.d.ts.map +1 -1
- package/dist/modes/interactive/components/diff.js +1 -1
- package/dist/modes/interactive/components/diff.js.map +1 -1
- package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -1
- package/dist/modes/interactive/components/dynamic-border.js +1 -1
- package/dist/modes/interactive/components/dynamic-border.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 +1 -1
- package/dist/modes/interactive/components/first-time-setup.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts.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/keybinding-hints.d.ts.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.js +1 -1
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +1 -1
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/mermaid.d.ts +1 -1
- package/dist/modes/interactive/components/mermaid.d.ts.map +1 -1
- package/dist/modes/interactive/components/mermaid.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +2 -2
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +1 -1
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/plugin-manager-entry.d.ts.map +1 -1
- package/dist/modes/interactive/components/plugin-manager-entry.js +1 -1
- package/dist/modes/interactive/components/plugin-manager-entry.js.map +1 -1
- package/dist/modes/interactive/components/plugin-selection-entry.d.ts.map +1 -1
- package/dist/modes/interactive/components/plugin-selection-entry.js +1 -1
- package/dist/modes/interactive/components/plugin-selection-entry.js.map +1 -1
- package/dist/modes/interactive/components/queue-manager-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/queue-manager-selector.js +1 -1
- package/dist/modes/interactive/components/queue-manager-selector.js.map +1 -1
- package/dist/modes/interactive/components/render-types.d.ts +1 -1
- package/dist/modes/interactive/components/render-types.d.ts.map +1 -1
- package/dist/modes/interactive/components/render-types.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +2 -2
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +1 -1
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-submenu.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-submenu.js +1 -1
- package/dist/modes/interactive/components/settings-submenu.js.map +1 -1
- package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/show-images-selector.js +1 -1
- package/dist/modes/interactive/components/show-images-selector.js.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.js +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
- package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
- package/dist/modes/interactive/components/status-indicator.js +1 -1
- package/dist/modes/interactive/components/status-indicator.js.map +1 -1
- package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/theme-selector.js +1 -1
- package/dist/modes/interactive/components/theme-selector.js.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +1 -1
- package/dist/modes/interactive/components/thinking-selector.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 +96 -4
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tool-run-group.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-run-group.js +1 -1
- package/dist/modes/interactive/components/tool-run-group.js.map +1 -1
- package/dist/modes/interactive/components/tree-list.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-list.js +1 -1
- package/dist/modes/interactive/components/tree-list.js.map +1 -1
- package/dist/modes/interactive/components/tree-render.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-render.js +1 -1
- package/dist/modes/interactive/components/tree-render.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +1 -1
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.js +1 -1
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message.js +1 -1
- package/dist/modes/interactive/components/user-message.js.map +1 -1
- package/dist/modes/interactive/components/workflow-view.d.ts.map +1 -1
- package/dist/modes/interactive/components/workflow-view.js +1 -1
- package/dist/modes/interactive/components/workflow-view.js.map +1 -1
- package/dist/modes/interactive/interactive-auth.d.ts +1 -1
- package/dist/modes/interactive/interactive-auth.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-auth.js +1 -1
- package/dist/modes/interactive/interactive-auth.js.map +1 -1
- package/dist/modes/interactive/interactive-commands.d.ts +123 -6
- package/dist/modes/interactive/interactive-commands.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-commands.js +691 -4
- package/dist/modes/interactive/interactive-commands.js.map +1 -1
- package/dist/modes/interactive/interactive-events.d.ts +174 -0
- package/dist/modes/interactive/interactive-events.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-events.js +704 -0
- package/dist/modes/interactive/interactive-events.js.map +1 -0
- package/dist/modes/interactive/interactive-format.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-format.js +1 -1
- package/dist/modes/interactive/interactive-format.js.map +1 -1
- package/dist/modes/interactive/interactive-lifecycle.d.ts +94 -0
- package/dist/modes/interactive/interactive-lifecycle.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-lifecycle.js +177 -0
- package/dist/modes/interactive/interactive-lifecycle.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +240 -133
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +251 -2159
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/interactive-queues.d.ts +96 -0
- package/dist/modes/interactive/interactive-queues.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-queues.js +183 -0
- package/dist/modes/interactive/interactive-queues.js.map +1 -0
- package/dist/modes/interactive/interactive-selectors.d.ts +95 -5
- package/dist/modes/interactive/interactive-selectors.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-selectors.js +517 -6
- package/dist/modes/interactive/interactive-selectors.js.map +1 -1
- package/dist/modes/interactive/startup-services.d.ts +31 -0
- package/dist/modes/interactive/startup-services.d.ts.map +1 -0
- package/dist/modes/interactive/startup-services.js +123 -0
- package/dist/modes/interactive/startup-services.js.map +1 -0
- package/dist/modes/memory-preheat.d.ts +11 -0
- package/dist/modes/memory-preheat.d.ts.map +1 -0
- package/dist/modes/memory-preheat.js +20 -0
- package/dist/modes/memory-preheat.js.map +1 -0
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +3 -1
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/plugins/ecosystem/node-package-install-host.d.ts +9 -1
- package/dist/plugins/ecosystem/node-package-install-host.d.ts.map +1 -1
- package/dist/plugins/ecosystem/node-package-install-host.js +79 -0
- package/dist/plugins/ecosystem/node-package-install-host.js.map +1 -1
- package/dist/remote/server-assembly.d.ts.map +1 -1
- package/dist/remote/server-assembly.js +7 -2
- package/dist/remote/server-assembly.js.map +1 -1
- package/dist/suites/builtin-suites.d.ts.map +1 -0
- package/dist/suites/builtin-suites.js.map +1 -0
- package/dist/suites/resolved-agent-profile.d.ts.map +1 -0
- package/dist/suites/resolved-agent-profile.js.map +1 -0
- package/dist/suites/suite-lifecycle.d.ts.map +1 -0
- package/dist/suites/suite-lifecycle.js.map +1 -0
- package/dist/suites/suite-loader.d.ts.map +1 -0
- package/dist/suites/suite-loader.js.map +1 -0
- package/dist/{modes/interactive/theme → theme}/dark.json +1 -1
- package/dist/{modes/interactive/theme → theme}/light.json +1 -1
- package/dist/{modes/interactive/theme → theme}/theme-controller.d.ts +1 -1
- package/dist/theme/theme-controller.d.ts.map +1 -0
- package/dist/{modes/interactive/theme → theme}/theme-controller.js +1 -1
- package/dist/theme/theme-controller.js.map +1 -0
- package/dist/{modes/interactive/theme → theme}/theme.d.ts +1 -1
- package/dist/theme/theme.d.ts.map +1 -0
- package/dist/{modes/interactive/theme → theme}/theme.js +5 -5
- package/dist/theme/theme.js.map +1 -0
- package/docs/compaction.md +7 -7
- package/docs/environment-variables.md +10 -4
- package/docs/keybindings.md +3 -3
- package/docs/models.md +17 -17
- package/docs/packages.md +1 -1
- package/docs/prompt-templates.md +1 -1
- package/docs/rpc.md +2 -2
- package/docs/sdk.md +5 -5
- package/docs/session-format.md +3 -3
- package/docs/settings.md +15 -1
- package/docs/shell-aliases.md +1 -1
- package/docs/skills.md +1 -1
- package/docs/terminal-setup.md +17 -17
- package/docs/themes.md +5 -5
- package/docs/tmux.md +4 -4
- package/docs/tui.md +1 -1
- package/docs/usage.md +292 -292
- package/docs/windows.md +1 -1
- package/examples/extensions/bash-spawn-hook/index.ts +1 -1
- package/examples/extensions/dynamic-resources/dynamic.json +1 -1
- package/examples/extensions/mcp-stdio/index.d.ts +64 -0
- package/examples/extensions/mcp-stdio/index.d.ts.map +1 -0
- package/examples/extensions/mcp-stdio/index.js +292 -0
- package/examples/extensions/mcp-stdio/index.js.map +1 -0
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -6
- package/examples/extensions/with-deps/plugin.json +1 -1
- package/package.json +2 -2
- package/dist/bundle/chunks/openai-responses-AUJQ3NWT.js +0 -2
- package/dist/bundle/chunks/virtual-modules-MRXD3RWG.js +0 -5
- package/dist/cli/experimental/commands/pi.d.ts +0 -15
- package/dist/cli/experimental/commands/pi.d.ts.map +0 -1
- package/dist/cli/experimental/commands/pi.js.map +0 -1
- package/dist/core/export-html/ansi-to-html.d.ts.map +0 -1
- package/dist/core/export-html/ansi-to-html.js.map +0 -1
- package/dist/core/export-html/index.d.ts.map +0 -1
- package/dist/core/export-html/index.js.map +0 -1
- package/dist/core/export-html/tool-renderer.d.ts.map +0 -1
- package/dist/core/export-html/tool-renderer.js.map +0 -1
- package/dist/core/pi-manifest.d.ts +0 -7
- package/dist/core/pi-manifest.d.ts.map +0 -1
- package/dist/core/pi-manifest.js.map +0 -1
- package/dist/modes/interactive/model-catalog-refresh.d.ts.map +0 -1
- package/dist/modes/interactive/model-catalog-refresh.js.map +0 -1
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +0 -1
- package/dist/modes/interactive/theme/theme-controller.js.map +0 -1
- package/dist/modes/interactive/theme/theme.d.ts.map +0 -1
- package/dist/modes/interactive/theme/theme.js.map +0 -1
- package/dist/profiles/builtin-suites.d.ts.map +0 -1
- package/dist/profiles/builtin-suites.js.map +0 -1
- package/dist/profiles/resolved-agent-profile.d.ts.map +0 -1
- package/dist/profiles/resolved-agent-profile.js.map +0 -1
- package/dist/profiles/suite-lifecycle.d.ts.map +0 -1
- package/dist/profiles/suite-lifecycle.js.map +0 -1
- package/dist/profiles/suite-loader.d.ts.map +0 -1
- package/dist/profiles/suite-loader.js.map +0 -1
- package/dist/utils/deprecation.d.ts +0 -4
- package/dist/utils/deprecation.d.ts.map +0 -1
- package/dist/utils/deprecation.js +0 -13
- package/dist/utils/deprecation.js.map +0 -1
- /package/dist/{core/export-html → export-html}/ansi-to-html.d.ts +0 -0
- /package/dist/{core/export-html → export-html}/ansi-to-html.js +0 -0
- /package/dist/{core/export-html → export-html}/template.css +0 -0
- /package/dist/{core/export-html → export-html}/template.html +0 -0
- /package/dist/{core/export-html → export-html}/template.js +0 -0
- /package/dist/{core/export-html → export-html}/tool-renderer.js +0 -0
- /package/dist/{core/export-html → export-html}/vendor/highlight.min.js +0 -0
- /package/dist/{core/export-html → export-html}/vendor/marked.min.js +0 -0
- /package/dist/{profiles → suites}/builtin-suites.d.ts +0 -0
- /package/dist/{profiles → suites}/builtin-suites.js +0 -0
- /package/dist/{profiles → suites}/resolved-agent-profile.d.ts +0 -0
- /package/dist/{profiles → suites}/resolved-agent-profile.js +0 -0
- /package/dist/{profiles → suites}/suite-lifecycle.d.ts +0 -0
- /package/dist/{profiles → suites}/suite-lifecycle.js +0 -0
- /package/dist/{profiles → suites}/suite-loader.d.ts +0 -0
- /package/dist/{profiles → suites}/suite-loader.js +0 -0
- /package/dist/{modes/interactive/theme → theme}/theme-schema.json +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-auth.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAIlC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAErE,OAAO,EAAE,CAAC,EAAE,MAAM,0BAA0B,CAAC;AAC7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAA6B,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACnG,OAAO,EAAE,uBAAuB,EAAE,cAAc,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAE9G,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAoEzC,MAAM,UAAU,uBAAuB,CAAC,IAAgB,EAAE,QAA8B,EAA0B;IACjH,MAAM,OAAO,GAA2B,EAAE,CAAC;IAC3C,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,mBAAmB,EAAE,CAAC,YAAY,EAAE,EAAE,CAAC;QAClE,MAAM,UAAU,GAAG,IAAI,CAAC,mBAAmB,EAAE,CAAC,qBAAqB,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACjF,M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AAE,CAAC;QACzB,aAAa,EAAE,CAAC;QAChB,MAAM,QAAQ,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACxE,IAAI,KAAK,YAAY,8BAA8B,EAAE,CAAC;YACrD,IAAI,CAAC,SAAS,CACb,CAAC,CAAC,+EAA+E,EAAE;gBAClF,IAAI,EAAE,YAAY;gBAClB,KAAK,EAAE,QAAQ;aACf,CAAC,CACF,CAAC;QACH,CAAC;aAAM,IAAI,QAAQ,KAAK,CAAC,CAAC,iBAAiB,CAAC,EAAE,CAAC;YAC9C,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,oCAAoC,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;QAClG,CAAC;IACF,CAAC;AAAA,CACD","sourcesContent":["/**\n * Login/authentication flow for interactive mode (S5 slice 3): provider\n * option collection, the /login and /logout selectors, the OAuth and API-key\n * login dialogs, auth prompt plumbing, and post-login completion.\n *\n * InteractiveMode implements AuthUiHost and keeps same-name delegate methods\n * so prototype-level tests and the command dispatch table keep working; the\n * functions below receive the mode through AuthUiHost and route every call —\n * including steps between auth methods — through the host, mirroring the\n * DialogUiHost pattern in ./interactive-dialog-ui.ts. Credential/provider\n * auth, model snapshot, catalog refresh, facade, and session-identity access go\n * through narrow host accessors (D-048: facade projections) so this module\n * never reads session internals directly.\n *\n * Internal collaboration interface (same pattern as CommandDispatchHost): not\n * a plugin API and not exported from the package root.\n */\nimport * as path from \"node:path\";\nimport type { AuthEvent, AuthPrompt } from \"@agent-forge/ai\";\nimport type { Api, Model } from \"@agent-forge/ai/compat\";\nimport type { Component, Container, EditorComponent, TUI } from \"@agent-forge/tui\";\nimport { APP_NAME, getAuthPath, getDocsPath } from \"../../config.ts\";\nimport type { ModelAuthRuntime } from \"../../core/facade/coding-agent-facade.ts\";\nimport { t } from \"../../core/i18n/index.ts\";\nimport { defaultModelPerProvider } from \"../../core/model-resolver.ts\";\nimport { CredentialSynchronizationError } from \"../../core/model-runtime.ts\";\nimport { DialogSelectorComponent } from \"./components/dialog-selector.ts\";\nimport { LoginDialogComponent } from \"./components/login-dialog.ts\";\nimport { type AuthSelectorProvider, OAuthSelectorComponent } from \"./components/oauth-selector.ts\";\nimport { hasDefaultModelProvider, isUnknownModel, llamaCppPostLoginGuidance } from \"./interactive-helpers.ts\";\nimport type { ModelCatalogRuntime } from \"./model-catalog-refresh.ts\";\nimport { theme } from \"./theme/theme.ts\";\n\n/**\n * Host surface InteractiveMode exposes to this module: the auth-flow methods\n * (which stay on the mode for dispatch and prototype-level tests) plus narrow\n * accessors for the session runtime, facade operations, and selector surface.\n *\n * Internal collaboration interface (same pattern as CommandDispatchHost): not\n * a plugin API and not exported from the package root.\n */\nexport interface AuthUiHost {\n\t/**\n\t * Narrow credential/provider auth projection through the stable facade\n\t * (D-048); the full runtime stays on the session.\n\t */\n\tgetModelAuthRuntime(): ModelAuthRuntime;\n\t/** Narrow catalog-refresh projection through the stable facade (D-048). */\n\tgetModelCatalog(): ModelCatalogRuntime;\n\t/** Available model snapshot through the stable facade (D-048). */\n\tgetAvailableModels(): readonly Model<Api>[];\n\t/** Opaque current-session identity token for post-login rebind checks. */\n\tgetSessionIdentity(): unknown;\n\tisSameSessionIdentity(identity: unknown): boolean;\n\t/** Selected model through the stable facade. */\n\tgetSelectedModel(): Model<Api> | undefined;\n\t/** Persists a model selection through the stable facade. */\n\tsetSelectedModel(model: Model<Api>): Promise<void>;\n\n\tui: TUI;\n\teditor: EditorComponent;\n\teditorContainer: Container;\n\n\tshowStatus(message: string): void;\n\tshowError(message: string): void;\n\tshowWarning(message: string): void;\n\t/** Selector surface; the implementation stays in the mode's selector area. */\n\tshowAuthSelector(\n\t\tcreate: (done: () => void) => { component: Component; focus: Component; dispose?: () => void },\n\t): void;\n\tupdateAvailableProviderCount(): void;\n\tmaybeWarnAboutAnthropicSubscriptionAuth(model?: Model<Api>): Promise<void>;\n\tcheckDaxnutsEasterEgg(model: { provider: string; id: string }): void;\n\tinvalidateFooter(): void;\n\tupdateEditorBorderColor(): void;\n\n\tgetLoginProviderOptions(authType?: \"oauth\" | \"api_key\"): AuthSelectorProvider[];\n\tgetLogoutProviderOptions(): Promise<AuthSelectorProvider[]>;\n\tfindLoginProviderOptions(providerRef: string): AuthSelectorProvider[];\n\thandleLoginCommand(providerRef?: string): Promise<void>;\n\tstartProviderLogin(providerOption: AuthSelectorProvider): Promise<void>;\n\tshowLoginAuthTypeSelector(providerOptions?: AuthSelectorProvider[]): void;\n\tshowLoginProviderSelector(authType?: AuthSelectorProvider[\"authType\"], initialSearchInput?: string): void;\n\tshowOAuthSelector(mode: \"login\" | \"logout\"): Promise<void>;\n\tcompleteProviderAuthentication(\n\t\tproviderId: string,\n\t\tproviderName: string,\n\t\tauthType: \"oauth\" | \"api_key\",\n\t\tpreviousModel: Model<Api> | undefined,\n\t): Promise<void>;\n\tshowAmbientAuthDialog(providerOption: AuthSelectorProvider): void;\n\tshowApiKeyLoginDialog(providerId: string, providerName: string): Promise<void>;\n\tshowAuthSelect(dialog: LoginDialogComponent, prompt: Extract<AuthPrompt, { type: \"select\" }>): Promise<string>;\n\tshowAuthPrompt(dialog: LoginDialogComponent, prompt: AuthPrompt): Promise<string>;\n\tnotifyAuthDialog(dialog: LoginDialogComponent, event: AuthEvent): void;\n\tloginProvider(dialog: LoginDialogComponent, providerId: string, method: \"api_key\" | \"oauth\"): Promise<void>;\n\tshowLoginDialog(providerId: string, providerName: string): Promise<void>;\n}\n\nexport function getLoginProviderOptions(host: AuthUiHost, authType?: \"oauth\" | \"api_key\"): AuthSelectorProvider[] {\n\tconst options: AuthSelectorProvider[] = [];\n\tfor (const provider of host.getModelAuthRuntime().getProviders()) {\n\t\tconst authStatus = host.getModelAuthRuntime().getProviderAuthStatus(provider.id);\n\t\tconst status = authStatus.configured\n\t\t\t? {\n\t\t\t\t\ttype: host.getModelAuthRuntime().isUsingOAuth(provider.id) ? (\"oauth\" as const) : (\"api_key\" as const),\n\t\t\t\t\tsource: authStatus.label ?? authStatus.source,\n\t\t\t\t}\n\t\t\t: undefined;\n\t\tif ((!authType || authType === \"oauth\") && provider.auth.oauth) {\n\t\t\toptions.push({\n\t\t\t\tid: provider.id,\n\t\t\t\tname: provider.name,\n\t\t\t\tauthType: \"oauth\",\n\t\t\t\tmethod: provider.auth.oauth,\n\t\t\t\tstatus,\n\t\t\t});\n\t\t}\n\t\tif ((!authType || authType === \"api_key\") && provider.auth.apiKey) {\n\t\t\toptions.push({\n\t\t\t\tid: provider.id,\n\t\t\t\tname: provider.name,\n\t\t\t\tauthType: \"api_key\",\n\t\t\t\tmethod: provider.auth.apiKey,\n\t\t\t\tstatus,\n\t\t\t});\n\t\t}\n\t}\n\treturn options.sort((a, b) => a.name.localeCompare(b.name));\n}\n\nexport async function getLogoutProviderOptions(host: AuthUiHost): Promise<AuthSelectorProvider[]> {\n\treturn (await host.getModelAuthRuntime().listCredentials({ signal: AbortSignal.timeout(15_000) }))\n\t\t.map(({ providerId, type }) => ({\n\t\t\tid: providerId,\n\t\t\tname: host.getModelAuthRuntime().getProvider(providerId)?.name ?? providerId,\n\t\t\tauthType: type,\n\t\t\tstatus: { type, source: \"stored credential\" },\n\t\t}))\n\t\t.sort((a, b) => a.name.localeCompare(b.name));\n}\n\nexport function findLoginProviderOptions(host: AuthUiHost, providerRef: string): AuthSelectorProvider[] {\n\tconst normalizedProviderRef = providerRef.trim().toLowerCase();\n\tif (!normalizedProviderRef) {\n\t\treturn [];\n\t}\n\n\treturn host\n\t\t.getLoginProviderOptions()\n\t\t.filter(\n\t\t\t(provider) =>\n\t\t\t\tprovider.id.toLowerCase() === normalizedProviderRef ||\n\t\t\t\tprovider.name.toLowerCase() === normalizedProviderRef,\n\t\t);\n}\n\nexport async function handleLoginCommand(host: AuthUiHost, providerRef?: string): Promise<void> {\n\tif (!providerRef) {\n\t\thost.showLoginAuthTypeSelector();\n\t\treturn;\n\t}\n\n\tconst providerOptions = host.findLoginProviderOptions(providerRef);\n\tif (providerOptions.length === 1) {\n\t\tawait host.startProviderLogin(providerOptions[0]!);\n\t\treturn;\n\t}\n\n\tif (providerOptions.length > 1) {\n\t\tconst providerIds = new Set(providerOptions.map((provider) => provider.id));\n\t\tif (providerIds.size === 1) {\n\t\t\thost.showLoginAuthTypeSelector(providerOptions);\n\t\t\treturn;\n\t\t}\n\t}\n\n\thost.showLoginProviderSelector(undefined, providerRef);\n}\n\nexport async function startProviderLogin(host: AuthUiHost, providerOption: AuthSelectorProvider): Promise<void> {\n\tif (providerOption.authType === \"oauth\") {\n\t\tawait host.showLoginDialog(providerOption.id, providerOption.name);\n\t} else if (providerOption.method?.login) {\n\t\tawait host.showApiKeyLoginDialog(providerOption.id, providerOption.name);\n\t} else {\n\t\thost.showAmbientAuthDialog(providerOption);\n\t}\n}\n\nexport function showLoginAuthTypeSelector(host: AuthUiHost, providerOptions?: AuthSelectorProvider[]): void {\n\tconst oauthProvider = providerOptions?.find((provider) => provider.authType === \"oauth\");\n\tconst oauthLoginLabel =\n\t\toauthProvider?.method && \"loginLabel\" in oauthProvider.method ? oauthProvider.method.loginLabel : undefined;\n\tconst subscriptionLabel = oauthLoginLabel ?? t(\"Sign in with an account\");\n\tconst apiKeyLabel = t(\"Sign in with an API key\");\n\tconst availableAuthTypes = providerOptions\n\t\t? new Set(providerOptions.map((provider) => provider.authType))\n\t\t: new Set<AuthSelectorProvider[\"authType\"]>([\"oauth\", \"api_key\"]);\n\tconst options: string[] = [];\n\tif (availableAuthTypes.has(\"oauth\")) {\n\t\toptions.push(subscriptionLabel);\n\t}\n\tif (availableAuthTypes.has(\"api_key\")) {\n\t\toptions.push(apiKeyLabel);\n\t}\n\n\tif (options.length === 0) {\n\t\thost.showStatus(t(\"No login methods available.\"));\n\t\treturn;\n\t}\n\n\tif (providerOptions && options.length === 1) {\n\t\tconst providerOption = providerOptions[0];\n\t\t// v8 ignore next -- options.length === 1 已保证 providerOptions 非空,[0] 恒存在\n\t\tif (providerOption) {\n\t\t\tvoid host.startProviderLogin(providerOption);\n\t\t}\n\t\treturn;\n\t}\n\n\tconst title = providerOptions?.[0]\n\t\t? t(\"Select authentication method for {name}:\", { name: providerOptions[0].name })\n\t\t: t(\"Select authentication method:\");\n\thost.showAuthSelector((done) => {\n\t\tconst selector = new DialogSelectorComponent(\n\t\t\ttitle,\n\t\t\toptions,\n\t\t\t(option) => {\n\t\t\t\tdone();\n\t\t\t\tconst authType = option === subscriptionLabel ? \"oauth\" : \"api_key\";\n\t\t\t\tif (providerOptions) {\n\t\t\t\t\tconst providerOption = providerOptions.find((provider) => provider.authType === authType);\n\t\t\t\t\t// v8 ignore next -- 选项列表由 providerOptions 的 authTypes 派生,必能找到\n\t\t\t\t\tif (providerOption) {\n\t\t\t\t\t\tvoid host.startProviderLogin(providerOption);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\thost.showLoginProviderSelector(authType);\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tdone();\n\t\t\t\thost.ui.requestRender();\n\t\t\t},\n\t\t);\n\t\treturn { component: selector, focus: selector };\n\t});\n}\n\nexport function showLoginProviderSelector(\n\thost: AuthUiHost,\n\tauthType?: AuthSelectorProvider[\"authType\"],\n\tinitialSearchInput?: string,\n): void {\n\tconst providerOptions = host.getLoginProviderOptions(authType);\n\tif (providerOptions.length === 0) {\n\t\tconst message =\n\t\t\tauthType === \"oauth\"\n\t\t\t\t? t(\"No subscription providers available.\")\n\t\t\t\t: authType === \"api_key\"\n\t\t\t\t\t? t(\"No API key providers available.\")\n\t\t\t\t\t: t(\"No login providers available.\");\n\t\thost.showStatus(message);\n\t\treturn;\n\t}\n\n\thost.showAuthSelector((done) => {\n\t\tconst selector = new OAuthSelectorComponent(\n\t\t\t\"login\",\n\t\t\tproviderOptions,\n\t\t\tasync (providerId, selectedAuthType) => {\n\t\t\t\tdone();\n\n\t\t\t\tconst providerOption = providerOptions.find(\n\t\t\t\t\t(provider) => provider.id === providerId && provider.authType === selectedAuthType,\n\t\t\t\t);\n\t\t\t\tif (!providerOption) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tawait host.startProviderLogin(providerOption);\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tdone();\n\t\t\t\tif (authType) {\n\t\t\t\t\thost.showLoginAuthTypeSelector();\n\t\t\t\t} else {\n\t\t\t\t\thost.ui.requestRender();\n\t\t\t\t}\n\t\t\t},\n\t\t\tinitialSearchInput,\n\t\t);\n\t\treturn { component: selector, focus: selector };\n\t});\n}\n\nexport async function showOAuthSelector(host: AuthUiHost, mode: \"login\" | \"logout\"): Promise<void> {\n\tif (mode === \"login\") {\n\t\thost.showLoginAuthTypeSelector();\n\t\treturn;\n\t}\n\n\tlet providerOptions: AuthSelectorProvider[];\n\ttry {\n\t\tproviderOptions = await host.getLogoutProviderOptions();\n\t} catch (error) {\n\t\thost.showError(\n\t\t\tt(\"Could not read stored credentials: {error}\", {\n\t\t\t\terror: error instanceof Error ? error.message : String(error),\n\t\t\t}),\n\t\t);\n\t\treturn;\n\t}\n\tif (providerOptions.length === 0) {\n\t\thost.showStatus(\n\t\t\tt(\n\t\t\t\t\"No stored credentials to remove. /logout only removes credentials saved by /login; environment variables and models.json config are unchanged.\",\n\t\t\t),\n\t\t);\n\t\treturn;\n\t}\n\n\thost.showAuthSelector((done) => {\n\t\tconst selector = new OAuthSelectorComponent(\n\t\t\tmode,\n\t\t\tproviderOptions,\n\t\t\tasync (providerId: string) => {\n\t\t\t\tdone();\n\n\t\t\t\tconst providerOption = providerOptions.find((provider) => provider.id === providerId);\n\t\t\t\tif (!providerOption) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tawait host.getModelAuthRuntime().logout(providerOption.id, {\n\t\t\t\t\t\tsignal: AbortSignal.timeout(15_000),\n\t\t\t\t\t});\n\t\t\t\t\tawait host.updateAvailableProviderCount();\n\t\t\t\t\tconst message =\n\t\t\t\t\t\tproviderOption.authType === \"oauth\"\n\t\t\t\t\t\t\t? t(\"Logged out of {name}\", { name: providerOption.name })\n\t\t\t\t\t\t\t: t(\n\t\t\t\t\t\t\t\t\t\"Removed stored API key for {name}. Environment variables and models.json config are unchanged.\",\n\t\t\t\t\t\t\t\t\t{ name: providerOption.name },\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\thost.showStatus(message);\n\t\t\t\t} catch (error: unknown) {\n\t\t\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\t\t\thost.showError(\n\t\t\t\t\t\terror instanceof CredentialSynchronizationError\n\t\t\t\t\t\t\t? t(\"Credentials removed for {name}, but local model state could not be synchronized: {error}\", {\n\t\t\t\t\t\t\t\t\tname: providerOption.name,\n\t\t\t\t\t\t\t\t\terror: message,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t: t(\"Logout failed: {error}\", { error: message }),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tdone();\n\t\t\t\thost.ui.requestRender();\n\t\t\t},\n\t\t);\n\t\treturn { component: selector, focus: selector };\n\t});\n}\n\nexport async function completeProviderAuthentication(\n\thost: AuthUiHost,\n\tproviderId: string,\n\tproviderName: string,\n\tauthType: \"oauth\" | \"api_key\",\n\tpreviousModel: Model<Api> | undefined,\n): Promise<void> {\n\tconst actionLabel =\n\t\tauthType === \"oauth\"\n\t\t\t? t(\"Logged in to {name}\", { name: providerName })\n\t\t\t: t(\"Saved API key for {name}\", { name: providerName });\n\n\t// Opaque identity of the session that started this login; the rebind check\n\t// below compares against it through the host.\n\tconst sessionIdentity = host.getSessionIdentity();\n\t// Dynamic catalogs may be empty until the first authenticated network refresh.\n\tconst deferSelection =\n\t\tisUnknownModel(previousModel) &&\n\t\thasDefaultModelProvider(providerId) &&\n\t\t!host\n\t\t\t.getAvailableModels()\n\t\t\t.some((model) => model.provider === providerId && model.id === defaultModelPerProvider[providerId]);\n\tconst finishAuthentication = async () => {\n\t\tlet selectedModel: Model<Api> | undefined;\n\t\tlet selectionError: string | undefined;\n\t\tif (isUnknownModel(previousModel)) {\n\t\t\tconst availableModels = host.getAvailableModels();\n\t\t\tconst providerModels = availableModels.filter((model) => model.provider === providerId);\n\t\t\t// Matches LLAMA_PROVIDER_ID from extensions/llama/provider.ts; kept inline to avoid coupling interactive mode to the built-in extension.\n\t\t\tif (providerId === \"llama.cpp\") {\n\t\t\t\tselectionError = llamaCppPostLoginGuidance(actionLabel, providerModels.length);\n\t\t\t} else if (!hasDefaultModelProvider(providerId)) {\n\t\t\t\tselectionError = t(\n\t\t\t\t\t'{action}, but no default model is configured for provider \"{providerId}\". Use /model to select a model.',\n\t\t\t\t\t{ action: actionLabel, providerId },\n\t\t\t\t);\n\t\t\t} else if (providerModels.length === 0) {\n\t\t\t\tselectionError = t(\n\t\t\t\t\t\"{action}, but no models are available for that provider. Use /model to select a model.\",\n\t\t\t\t\t{\n\t\t\t\t\t\taction: actionLabel,\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tconst defaultModelId = defaultModelPerProvider[providerId];\n\t\t\t\tselectedModel = providerModels.find((model) => model.id === defaultModelId);\n\t\t\t\tif (!selectedModel) {\n\t\t\t\t\tselectionError = t(\n\t\t\t\t\t\t'{action}, but its default model \"{modelId}\" is not available. Use /model to select a model.',\n\t\t\t\t\t\t{ action: actionLabel, modelId: defaultModelId },\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait host.setSelectedModel(selectedModel);\n\t\t\t\t\t} catch (error: unknown) {\n\t\t\t\t\t\tselectedModel = undefined;\n\t\t\t\t\t\tconst errorMessage = error instanceof Error ? error.message : String(error);\n\t\t\t\t\t\tselectionError = t(\n\t\t\t\t\t\t\t\"{action}, but selecting its default model failed: {error}. Use /model to select a model.\",\n\t\t\t\t\t\t\t{ action: actionLabel, error: errorMessage },\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tawait host.updateAvailableProviderCount();\n\t\thost.invalidateFooter();\n\t\thost.updateEditorBorderColor();\n\t\tif (selectedModel) {\n\t\t\thost.showStatus(\n\t\t\t\tt(\"{action}. Selected {modelId}. Credentials saved to {path}\", {\n\t\t\t\t\taction: actionLabel,\n\t\t\t\t\tmodelId: selectedModel.id,\n\t\t\t\t\tpath: getAuthPath(),\n\t\t\t\t}),\n\t\t\t);\n\t\t\tvoid host.maybeWarnAboutAnthropicSubscriptionAuth(selectedModel);\n\t\t\thost.checkDaxnutsEasterEgg(selectedModel);\n\t\t} else {\n\t\t\thost.showStatus(t(\"{action}. Credentials saved to {path}\", { action: actionLabel, path: getAuthPath() }));\n\t\t\tif (selectionError) {\n\t\t\t\thost.showError(selectionError);\n\t\t\t} else {\n\t\t\t\tvoid host.maybeWarnAboutAnthropicSubscriptionAuth();\n\t\t\t}\n\t\t}\n\t};\n\tif (deferSelection) {\n\t\thost.showStatus(\n\t\t\tt(\"{action}. Credentials saved to {path}. Refreshing model catalog…\", {\n\t\t\t\taction: actionLabel,\n\t\t\t\tpath: getAuthPath(),\n\t\t\t}),\n\t\t);\n\t} else {\n\t\tawait finishAuthentication();\n\t}\n\n\tconst controller = new AbortController();\n\tconst timeout = setTimeout(() => controller.abort(), 15_000);\n\tvoid host\n\t\t.getModelCatalog()\n\t\t.refresh({ providers: [providerId], signal: controller.signal })\n\t\t.then(async (result) => {\n\t\t\tif (result.aborted) {\n\t\t\t\thost.showWarning(\n\t\t\t\t\tt(\"{action}, but its model catalog refresh timed out; using cached models.\", { action: actionLabel }),\n\t\t\t\t);\n\t\t\t} else if (result.errors.size > 0) {\n\t\t\t\thost.showWarning(\n\t\t\t\t\tt(\"{action}, but its model catalog could not be refreshed; using cached models.\", {\n\t\t\t\t\t\taction: actionLabel,\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\t\t\t// Do not replace a model or session selected while the refresh was running.\n\t\t\tif (\n\t\t\t\tdeferSelection &&\n\t\t\t\thost.isSameSessionIdentity(sessionIdentity) &&\n\t\t\t\thost.getSelectedModel() === previousModel\n\t\t\t) {\n\t\t\t\tawait finishAuthentication();\n\t\t\t}\n\t\t\thost.updateAvailableProviderCount();\n\t\t\thost.invalidateFooter();\n\t\t\thost.ui.requestRender();\n\t\t})\n\t\t.catch((error: unknown) => {\n\t\t\thost.showWarning(\n\t\t\t\tt(\"{action}, but its model catalog could not be refreshed: {error}\", {\n\t\t\t\t\taction: actionLabel,\n\t\t\t\t\terror: error instanceof Error ? error.message : String(error),\n\t\t\t\t}),\n\t\t\t);\n\t\t})\n\t\t.finally(() => clearTimeout(timeout));\n}\n\nexport function showAmbientAuthDialog(host: AuthUiHost, providerOption: AuthSelectorProvider): void {\n\tconst restoreEditor = () => {\n\t\thost.editorContainer.clear();\n\t\thost.editorContainer.addChild(host.editor);\n\t\thost.ui.setFocus(host.editor);\n\t\thost.ui.requestRender();\n\t};\n\n\tconst dialog = new LoginDialogComponent(\n\t\thost.ui,\n\t\tproviderOption.id,\n\t\t() => restoreEditor(),\n\t\tproviderOption.name,\n\t\tt(\"{name} setup\", { name: providerOption.name }),\n\t);\n\tdialog.showInfo(\n\t\tt(\"{method} is configured outside {appName}.\", {\n\t\t\tmethod: providerOption.method?.name ?? t(\"Authentication\"),\n\t\t\tappName: APP_NAME,\n\t\t}),\n\t\t[],\n\t\ttrue,\n\t);\n\n\thost.editorContainer.clear();\n\thost.editorContainer.addChild(dialog);\n\thost.ui.setFocus(dialog);\n\thost.ui.requestRender();\n}\n\nexport async function showApiKeyLoginDialog(host: AuthUiHost, providerId: string, providerName: string): Promise<void> {\n\tconst previousModel = host.getSelectedModel();\n\n\tconst dialog = new LoginDialogComponent(\n\t\thost.ui,\n\t\tproviderId,\n\t\t(_success, _message) => {\n\t\t\t// Completion handled below\n\t\t},\n\t\tproviderName,\n\t);\n\n\tif (providerId === \"amazon-bedrock\") {\n\t\tdialog.showDetails([\n\t\t\ttheme.fg(\"text\", t(\"You can also use an AWS profile, IAM keys, or role-based credentials.\")),\n\t\t\ttheme.fg(\"muted\", t(\"See:\")),\n\t\t\ttheme.fg(\"accent\", ` ${path.join(getDocsPath(), \"providers.md\")}`),\n\t\t]);\n\t}\n\n\thost.editorContainer.clear();\n\thost.editorContainer.addChild(dialog);\n\thost.ui.setFocus(dialog);\n\thost.ui.requestRender();\n\n\tconst restoreEditor = () => {\n\t\thost.editorContainer.clear();\n\t\thost.editorContainer.addChild(host.editor);\n\t\thost.ui.setFocus(host.editor);\n\t\thost.ui.requestRender();\n\t};\n\n\ttry {\n\t\tawait host.loginProvider(dialog, providerId, \"api_key\");\n\t\trestoreEditor();\n\t\tawait host.completeProviderAuthentication(providerId, providerName, \"api_key\", previousModel);\n\t} catch (error: unknown) {\n\t\trestoreEditor();\n\t\tconst errorMsg = error instanceof Error ? error.message : String(error);\n\t\tif (error instanceof CredentialSynchronizationError) {\n\t\t\thost.showError(\n\t\t\t\tt(\"Saved API key for {name}, but local model state could not be synchronized: {error}\", {\n\t\t\t\t\tname: providerName,\n\t\t\t\t\terror: errorMsg,\n\t\t\t\t}),\n\t\t\t);\n\t\t} else if (errorMsg !== t(\"Login cancelled\")) {\n\t\t\thost.showError(t(\"Failed to save API key for {name}: {error}\", { name: providerName, error: errorMsg }));\n\t\t}\n\t}\n}\n\nexport function showAuthSelect(\n\thost: AuthUiHost,\n\tdialog: LoginDialogComponent,\n\tprompt: Extract<AuthPrompt, { type: \"select\" }>,\n): Promise<string> {\n\treturn new Promise((resolve, reject) => {\n\t\tconst restoreDialog = () => {\n\t\t\thost.editorContainer.clear();\n\t\t\thost.editorContainer.addChild(dialog);\n\t\t\thost.ui.setFocus(dialog);\n\t\t\thost.ui.requestRender();\n\t\t};\n\t\tconst labels = prompt.options.map((option) => option.label);\n\t\tconst selector = new DialogSelectorComponent(\n\t\t\tprompt.message,\n\t\t\tlabels,\n\t\t\t(optionLabel) => {\n\t\t\t\trestoreDialog();\n\t\t\t\tconst id = prompt.options.find((option) => option.label === optionLabel)?.id;\n\t\t\t\t// v8 ignore next -- 选项列表由 prompt.options 派生,选中项必能找到\n\t\t\t\tif (id) resolve(id);\n\t\t\t\telse reject(new Error(t(\"Login cancelled\")));\n\t\t\t},\n\t\t\t() => {\n\t\t\t\trestoreDialog();\n\t\t\t\treject(new Error(t(\"Login cancelled\")));\n\t\t\t},\n\t\t);\n\t\thost.editorContainer.clear();\n\t\thost.editorContainer.addChild(selector);\n\t\thost.ui.setFocus(selector);\n\t\thost.ui.requestRender();\n\t});\n}\n\nexport async function showAuthPrompt(\n\thost: AuthUiHost,\n\tdialog: LoginDialogComponent,\n\tprompt: AuthPrompt,\n): Promise<string> {\n\tlet response: Promise<string>;\n\tif (prompt.type === \"select\") {\n\t\tresponse = host.showAuthSelect(dialog, prompt);\n\t} else if (prompt.type === \"manual_code\") {\n\t\tresponse = dialog.showManualInput(prompt.message);\n\t} else {\n\t\tresponse = dialog.showPrompt(prompt.message, prompt.placeholder);\n\t}\n\tif (!prompt.signal) return response;\n\tif (prompt.signal.aborted) throw new Error(t(\"Login cancelled\"));\n\tconst signal = prompt.signal;\n\tlet onAbort: (() => void) | undefined;\n\tconst aborted = new Promise<string>((_resolve, reject) => {\n\t\tonAbort = () => reject(new Error(t(\"Login cancelled\")));\n\t\tsignal.addEventListener(\"abort\", onAbort, { once: true });\n\t});\n\ttry {\n\t\treturn await Promise.race([response, aborted]);\n\t} finally {\n\t\t// v8 ignore next -- onAbort 在 Promise executor 中同步赋值,恒已定义\n\t\tif (onAbort) signal.removeEventListener(\"abort\", onAbort);\n\t}\n}\n\nexport function notifyAuthDialog(_host: AuthUiHost, dialog: LoginDialogComponent, event: AuthEvent): void {\n\tif (event.type === \"auth_url\") {\n\t\tdialog.showAuth(event.url, event.instructions);\n\t} else if (event.type === \"device_code\") {\n\t\tdialog.showDeviceCode(event);\n\t\tdialog.showWaiting(t(\"Waiting for authentication...\"));\n\t} else if (event.type === \"info\") {\n\t\tdialog.showInfo(event.message, event.links);\n\t} else {\n\t\tdialog.showProgress(event.message);\n\t}\n}\n\nexport async function loginProvider(\n\thost: AuthUiHost,\n\tdialog: LoginDialogComponent,\n\tproviderId: string,\n\tmethod: \"api_key\" | \"oauth\",\n): Promise<void> {\n\tawait host.getModelAuthRuntime().login(providerId, method, {\n\t\tsignal: dialog.signal,\n\t\tprompt: (prompt) => host.showAuthPrompt(dialog, prompt),\n\t\tnotify: (event) => host.notifyAuthDialog(dialog, event),\n\t});\n}\n\nexport async function showLoginDialog(host: AuthUiHost, providerId: string, providerName: string): Promise<void> {\n\tconst previousModel = host.getSelectedModel();\n\tconst dialog = new LoginDialogComponent(host.ui, providerId, (_success, _message) => {}, providerName);\n\thost.editorContainer.clear();\n\thost.editorContainer.addChild(dialog);\n\thost.ui.setFocus(dialog);\n\thost.ui.requestRender();\n\n\tconst restoreEditor = () => {\n\t\thost.editorContainer.clear();\n\t\thost.editorContainer.addChild(host.editor);\n\t\thost.ui.setFocus(host.editor);\n\t\thost.ui.requestRender();\n\t};\n\n\ttry {\n\t\tawait host.loginProvider(dialog, providerId, \"oauth\");\n\t\trestoreEditor();\n\t\tawait host.completeProviderAuthentication(providerId, providerName, \"oauth\", previousModel);\n\t} catch (error: unknown) {\n\t\trestoreEditor();\n\t\tconst errorMsg = error instanceof Error ? error.message : String(error);\n\t\tif (error instanceof CredentialSynchronizationError) {\n\t\t\thost.showError(\n\t\t\t\tt(\"Logged in to {name}, but local model state could not be synchronized: {error}\", {\n\t\t\t\t\tname: providerName,\n\t\t\t\t\terror: errorMsg,\n\t\t\t\t}),\n\t\t\t);\n\t\t} else if (errorMsg !== t(\"Login cancelled\")) {\n\t\t\thost.showError(t(\"Failed to login to {name}: {error}\", { name: providerName, error: errorMsg }));\n\t\t}\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interactive-auth.js","sourceRoot":"","sources":["../../../src/modes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EAAE,QAAQ;aACf,CAAC,CACF,CAAC;QACH,CAAC;aAAM,IAAI,QAAQ,KAAK,CAAC,CAAC,iBAAiB,CAAC,EAAE,CAAC;YAC9C,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,oCAAoC,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;QAClG,CAAC;IACF,CAAC;AAAA,CACD","sourcesContent":["/**\n * Login/authentication flow for interactive mode (S5 slice 3): provider\n * option collection, the /login and /logout selectors, the OAuth and API-key\n * login dialogs, auth prompt plumbing, and post-login completion.\n *\n * InteractiveMode implements AuthUiHost and keeps same-name delegate methods\n * so prototype-level tests and the command dispatch table keep working; the\n * functions below receive the mode through AuthUiHost and route every call —\n * including steps between auth methods — through the host, mirroring the\n * DialogUiHost pattern in ./interactive-dialog-ui.ts. Credential/provider\n * auth, model snapshot, catalog refresh, facade, and session-identity access go\n * through narrow host accessors (D-048: facade projections) so this module\n * never reads session internals directly.\n *\n * Internal collaboration interface (same pattern as CommandDispatchHost): not\n * a plugin API and not exported from the package root.\n */\nimport * as path from \"node:path\";\nimport type { AuthEvent, AuthPrompt } from \"@agent-forge/ai\";\nimport type { Api, Model } from \"@agent-forge/ai/compat\";\nimport type { Component, Container, EditorComponent, TUI } from \"@agent-forge/tui\";\nimport { APP_NAME, getAuthPath, getDocsPath } from \"../../config.ts\";\nimport type { ModelAuthRuntime } from \"../../core/facade/coding-agent-facade.ts\";\nimport { t } from \"../../core/i18n/index.ts\";\nimport { defaultModelPerProvider } from \"../../core/model-resolver.ts\";\nimport { CredentialSynchronizationError } from \"../../core/model-runtime.ts\";\nimport type { ModelCatalogRuntime } from \"../../host/model-catalog-refresh.ts\";\nimport { theme } from \"../../theme/theme.ts\";\nimport { DialogSelectorComponent } from \"./components/dialog-selector.ts\";\nimport { LoginDialogComponent } from \"./components/login-dialog.ts\";\nimport { type AuthSelectorProvider, OAuthSelectorComponent } from \"./components/oauth-selector.ts\";\nimport { hasDefaultModelProvider, isUnknownModel, llamaCppPostLoginGuidance } from \"./interactive-helpers.ts\";\n\n/**\n * Host surface InteractiveMode exposes to this module: the auth-flow methods\n * (which stay on the mode for dispatch and prototype-level tests) plus narrow\n * accessors for the session runtime, facade operations, and selector surface.\n *\n * Internal collaboration interface (same pattern as CommandDispatchHost): not\n * a plugin API and not exported from the package root.\n */\nexport interface AuthUiHost {\n\t/**\n\t * Narrow credential/provider auth projection through the stable facade\n\t * (D-048); the full runtime stays on the session.\n\t */\n\tgetModelAuthRuntime(): ModelAuthRuntime;\n\t/** Narrow catalog-refresh projection through the stable facade (D-048). */\n\tgetModelCatalog(): ModelCatalogRuntime;\n\t/** Available model snapshot through the stable facade (D-048). */\n\tgetAvailableModels(): readonly Model<Api>[];\n\t/** Opaque current-session identity token for post-login rebind checks. */\n\tgetSessionIdentity(): unknown;\n\tisSameSessionIdentity(identity: unknown): boolean;\n\t/** Selected model through the stable facade. */\n\tgetSelectedModel(): Model<Api> | undefined;\n\t/** Persists a model selection through the stable facade. */\n\tsetSelectedModel(model: Model<Api>): Promise<void>;\n\n\tui: TUI;\n\teditor: EditorComponent;\n\teditorContainer: Container;\n\n\tshowStatus(message: string): void;\n\tshowError(message: string): void;\n\tshowWarning(message: string): void;\n\t/** Selector surface; the implementation stays in the mode's selector area. */\n\tshowAuthSelector(\n\t\tcreate: (done: () => void) => { component: Component; focus: Component; dispose?: () => void },\n\t): void;\n\tupdateAvailableProviderCount(): void;\n\tmaybeWarnAboutAnthropicSubscriptionAuth(model?: Model<Api>): Promise<void>;\n\tcheckDaxnutsEasterEgg(model: { provider: string; id: string }): void;\n\tinvalidateFooter(): void;\n\tupdateEditorBorderColor(): void;\n\n\tgetLoginProviderOptions(authType?: \"oauth\" | \"api_key\"): AuthSelectorProvider[];\n\tgetLogoutProviderOptions(): Promise<AuthSelectorProvider[]>;\n\tfindLoginProviderOptions(providerRef: string): AuthSelectorProvider[];\n\thandleLoginCommand(providerRef?: string): Promise<void>;\n\tstartProviderLogin(providerOption: AuthSelectorProvider): Promise<void>;\n\tshowLoginAuthTypeSelector(providerOptions?: AuthSelectorProvider[]): void;\n\tshowLoginProviderSelector(authType?: AuthSelectorProvider[\"authType\"], initialSearchInput?: string): void;\n\tshowOAuthSelector(mode: \"login\" | \"logout\"): Promise<void>;\n\tcompleteProviderAuthentication(\n\t\tproviderId: string,\n\t\tproviderName: string,\n\t\tauthType: \"oauth\" | \"api_key\",\n\t\tpreviousModel: Model<Api> | undefined,\n\t): Promise<void>;\n\tshowAmbientAuthDialog(providerOption: AuthSelectorProvider): void;\n\tshowApiKeyLoginDialog(providerId: string, providerName: string): Promise<void>;\n\tshowAuthSelect(dialog: LoginDialogComponent, prompt: Extract<AuthPrompt, { type: \"select\" }>): Promise<string>;\n\tshowAuthPrompt(dialog: LoginDialogComponent, prompt: AuthPrompt): Promise<string>;\n\tnotifyAuthDialog(dialog: LoginDialogComponent, event: AuthEvent): void;\n\tloginProvider(dialog: LoginDialogComponent, providerId: string, method: \"api_key\" | \"oauth\"): Promise<void>;\n\tshowLoginDialog(providerId: string, providerName: string): Promise<void>;\n}\n\nexport function getLoginProviderOptions(host: AuthUiHost, authType?: \"oauth\" | \"api_key\"): AuthSelectorProvider[] {\n\tconst options: AuthSelectorProvider[] = [];\n\tfor (const provider of host.getModelAuthRuntime().getProviders()) {\n\t\tconst authStatus = host.getModelAuthRuntime().getProviderAuthStatus(provider.id);\n\t\tconst status = authStatus.configured\n\t\t\t? {\n\t\t\t\t\ttype: host.getModelAuthRuntime().isUsingOAuth(provider.id) ? (\"oauth\" as const) : (\"api_key\" as const),\n\t\t\t\t\tsource: authStatus.label ?? authStatus.source,\n\t\t\t\t}\n\t\t\t: undefined;\n\t\tif ((!authType || authType === \"oauth\") && provider.auth.oauth) {\n\t\t\toptions.push({\n\t\t\t\tid: provider.id,\n\t\t\t\tname: provider.name,\n\t\t\t\tauthType: \"oauth\",\n\t\t\t\tmethod: provider.auth.oauth,\n\t\t\t\tstatus,\n\t\t\t});\n\t\t}\n\t\tif ((!authType || authType === \"api_key\") && provider.auth.apiKey) {\n\t\t\toptions.push({\n\t\t\t\tid: provider.id,\n\t\t\t\tname: provider.name,\n\t\t\t\tauthType: \"api_key\",\n\t\t\t\tmethod: provider.auth.apiKey,\n\t\t\t\tstatus,\n\t\t\t});\n\t\t}\n\t}\n\treturn options.sort((a, b) => a.name.localeCompare(b.name));\n}\n\nexport async function getLogoutProviderOptions(host: AuthUiHost): Promise<AuthSelectorProvider[]> {\n\treturn (await host.getModelAuthRuntime().listCredentials({ signal: AbortSignal.timeout(15_000) }))\n\t\t.map(({ providerId, type }) => ({\n\t\t\tid: providerId,\n\t\t\tname: host.getModelAuthRuntime().getProvider(providerId)?.name ?? providerId,\n\t\t\tauthType: type,\n\t\t\tstatus: { type, source: \"stored credential\" },\n\t\t}))\n\t\t.sort((a, b) => a.name.localeCompare(b.name));\n}\n\nexport function findLoginProviderOptions(host: AuthUiHost, providerRef: string): AuthSelectorProvider[] {\n\tconst normalizedProviderRef = providerRef.trim().toLowerCase();\n\tif (!normalizedProviderRef) {\n\t\treturn [];\n\t}\n\n\treturn host\n\t\t.getLoginProviderOptions()\n\t\t.filter(\n\t\t\t(provider) =>\n\t\t\t\tprovider.id.toLowerCase() === normalizedProviderRef ||\n\t\t\t\tprovider.name.toLowerCase() === normalizedProviderRef,\n\t\t);\n}\n\nexport async function handleLoginCommand(host: AuthUiHost, providerRef?: string): Promise<void> {\n\tif (!providerRef) {\n\t\thost.showLoginAuthTypeSelector();\n\t\treturn;\n\t}\n\n\tconst providerOptions = host.findLoginProviderOptions(providerRef);\n\tif (providerOptions.length === 1) {\n\t\tawait host.startProviderLogin(providerOptions[0]!);\n\t\treturn;\n\t}\n\n\tif (providerOptions.length > 1) {\n\t\tconst providerIds = new Set(providerOptions.map((provider) => provider.id));\n\t\tif (providerIds.size === 1) {\n\t\t\thost.showLoginAuthTypeSelector(providerOptions);\n\t\t\treturn;\n\t\t}\n\t}\n\n\thost.showLoginProviderSelector(undefined, providerRef);\n}\n\nexport async function startProviderLogin(host: AuthUiHost, providerOption: AuthSelectorProvider): Promise<void> {\n\tif (providerOption.authType === \"oauth\") {\n\t\tawait host.showLoginDialog(providerOption.id, providerOption.name);\n\t} else if (providerOption.method?.login) {\n\t\tawait host.showApiKeyLoginDialog(providerOption.id, providerOption.name);\n\t} else {\n\t\thost.showAmbientAuthDialog(providerOption);\n\t}\n}\n\nexport function showLoginAuthTypeSelector(host: AuthUiHost, providerOptions?: AuthSelectorProvider[]): void {\n\tconst oauthProvider = providerOptions?.find((provider) => provider.authType === \"oauth\");\n\tconst oauthLoginLabel =\n\t\toauthProvider?.method && \"loginLabel\" in oauthProvider.method ? oauthProvider.method.loginLabel : undefined;\n\tconst subscriptionLabel = oauthLoginLabel ?? t(\"Sign in with an account\");\n\tconst apiKeyLabel = t(\"Sign in with an API key\");\n\tconst availableAuthTypes = providerOptions\n\t\t? new Set(providerOptions.map((provider) => provider.authType))\n\t\t: new Set<AuthSelectorProvider[\"authType\"]>([\"oauth\", \"api_key\"]);\n\tconst options: string[] = [];\n\tif (availableAuthTypes.has(\"oauth\")) {\n\t\toptions.push(subscriptionLabel);\n\t}\n\tif (availableAuthTypes.has(\"api_key\")) {\n\t\toptions.push(apiKeyLabel);\n\t}\n\n\tif (options.length === 0) {\n\t\thost.showStatus(t(\"No login methods available.\"));\n\t\treturn;\n\t}\n\n\tif (providerOptions && options.length === 1) {\n\t\tconst providerOption = providerOptions[0];\n\t\t// v8 ignore next -- options.length === 1 已保证 providerOptions 非空,[0] 恒存在\n\t\tif (providerOption) {\n\t\t\tvoid host.startProviderLogin(providerOption);\n\t\t}\n\t\treturn;\n\t}\n\n\tconst title = providerOptions?.[0]\n\t\t? t(\"Select authentication method for {name}:\", { name: providerOptions[0].name })\n\t\t: t(\"Select authentication method:\");\n\thost.showAuthSelector((done) => {\n\t\tconst selector = new DialogSelectorComponent(\n\t\t\ttitle,\n\t\t\toptions,\n\t\t\t(option) => {\n\t\t\t\tdone();\n\t\t\t\tconst authType = option === subscriptionLabel ? \"oauth\" : \"api_key\";\n\t\t\t\tif (providerOptions) {\n\t\t\t\t\tconst providerOption = providerOptions.find((provider) => provider.authType === authType);\n\t\t\t\t\t// v8 ignore next -- 选项列表由 providerOptions 的 authTypes 派生,必能找到\n\t\t\t\t\tif (providerOption) {\n\t\t\t\t\t\tvoid host.startProviderLogin(providerOption);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\thost.showLoginProviderSelector(authType);\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tdone();\n\t\t\t\thost.ui.requestRender();\n\t\t\t},\n\t\t);\n\t\treturn { component: selector, focus: selector };\n\t});\n}\n\nexport function showLoginProviderSelector(\n\thost: AuthUiHost,\n\tauthType?: AuthSelectorProvider[\"authType\"],\n\tinitialSearchInput?: string,\n): void {\n\tconst providerOptions = host.getLoginProviderOptions(authType);\n\tif (providerOptions.length === 0) {\n\t\tconst message =\n\t\t\tauthType === \"oauth\"\n\t\t\t\t? t(\"No subscription providers available.\")\n\t\t\t\t: authType === \"api_key\"\n\t\t\t\t\t? t(\"No API key providers available.\")\n\t\t\t\t\t: t(\"No login providers available.\");\n\t\thost.showStatus(message);\n\t\treturn;\n\t}\n\n\thost.showAuthSelector((done) => {\n\t\tconst selector = new OAuthSelectorComponent(\n\t\t\t\"login\",\n\t\t\tproviderOptions,\n\t\t\tasync (providerId, selectedAuthType) => {\n\t\t\t\tdone();\n\n\t\t\t\tconst providerOption = providerOptions.find(\n\t\t\t\t\t(provider) => provider.id === providerId && provider.authType === selectedAuthType,\n\t\t\t\t);\n\t\t\t\tif (!providerOption) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tawait host.startProviderLogin(providerOption);\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tdone();\n\t\t\t\tif (authType) {\n\t\t\t\t\thost.showLoginAuthTypeSelector();\n\t\t\t\t} else {\n\t\t\t\t\thost.ui.requestRender();\n\t\t\t\t}\n\t\t\t},\n\t\t\tinitialSearchInput,\n\t\t);\n\t\treturn { component: selector, focus: selector };\n\t});\n}\n\nexport async function showOAuthSelector(host: AuthUiHost, mode: \"login\" | \"logout\"): Promise<void> {\n\tif (mode === \"login\") {\n\t\thost.showLoginAuthTypeSelector();\n\t\treturn;\n\t}\n\n\tlet providerOptions: AuthSelectorProvider[];\n\ttry {\n\t\tproviderOptions = await host.getLogoutProviderOptions();\n\t} catch (error) {\n\t\thost.showError(\n\t\t\tt(\"Could not read stored credentials: {error}\", {\n\t\t\t\terror: error instanceof Error ? error.message : String(error),\n\t\t\t}),\n\t\t);\n\t\treturn;\n\t}\n\tif (providerOptions.length === 0) {\n\t\thost.showStatus(\n\t\t\tt(\n\t\t\t\t\"No stored credentials to remove. /logout only removes credentials saved by /login; environment variables and models.json config are unchanged.\",\n\t\t\t),\n\t\t);\n\t\treturn;\n\t}\n\n\thost.showAuthSelector((done) => {\n\t\tconst selector = new OAuthSelectorComponent(\n\t\t\tmode,\n\t\t\tproviderOptions,\n\t\t\tasync (providerId: string) => {\n\t\t\t\tdone();\n\n\t\t\t\tconst providerOption = providerOptions.find((provider) => provider.id === providerId);\n\t\t\t\tif (!providerOption) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tawait host.getModelAuthRuntime().logout(providerOption.id, {\n\t\t\t\t\t\tsignal: AbortSignal.timeout(15_000),\n\t\t\t\t\t});\n\t\t\t\t\tawait host.updateAvailableProviderCount();\n\t\t\t\t\tconst message =\n\t\t\t\t\t\tproviderOption.authType === \"oauth\"\n\t\t\t\t\t\t\t? t(\"Logged out of {name}\", { name: providerOption.name })\n\t\t\t\t\t\t\t: t(\n\t\t\t\t\t\t\t\t\t\"Removed stored API key for {name}. Environment variables and models.json config are unchanged.\",\n\t\t\t\t\t\t\t\t\t{ name: providerOption.name },\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\thost.showStatus(message);\n\t\t\t\t} catch (error: unknown) {\n\t\t\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\t\t\thost.showError(\n\t\t\t\t\t\terror instanceof CredentialSynchronizationError\n\t\t\t\t\t\t\t? t(\"Credentials removed for {name}, but local model state could not be synchronized: {error}\", {\n\t\t\t\t\t\t\t\t\tname: providerOption.name,\n\t\t\t\t\t\t\t\t\terror: message,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t: t(\"Logout failed: {error}\", { error: message }),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tdone();\n\t\t\t\thost.ui.requestRender();\n\t\t\t},\n\t\t);\n\t\treturn { component: selector, focus: selector };\n\t});\n}\n\nexport async function completeProviderAuthentication(\n\thost: AuthUiHost,\n\tproviderId: string,\n\tproviderName: string,\n\tauthType: \"oauth\" | \"api_key\",\n\tpreviousModel: Model<Api> | undefined,\n): Promise<void> {\n\tconst actionLabel =\n\t\tauthType === \"oauth\"\n\t\t\t? t(\"Logged in to {name}\", { name: providerName })\n\t\t\t: t(\"Saved API key for {name}\", { name: providerName });\n\n\t// Opaque identity of the session that started this login; the rebind check\n\t// below compares against it through the host.\n\tconst sessionIdentity = host.getSessionIdentity();\n\t// Dynamic catalogs may be empty until the first authenticated network refresh.\n\tconst deferSelection =\n\t\tisUnknownModel(previousModel) &&\n\t\thasDefaultModelProvider(providerId) &&\n\t\t!host\n\t\t\t.getAvailableModels()\n\t\t\t.some((model) => model.provider === providerId && model.id === defaultModelPerProvider[providerId]);\n\tconst finishAuthentication = async () => {\n\t\tlet selectedModel: Model<Api> | undefined;\n\t\tlet selectionError: string | undefined;\n\t\tif (isUnknownModel(previousModel)) {\n\t\t\tconst availableModels = host.getAvailableModels();\n\t\t\tconst providerModels = availableModels.filter((model) => model.provider === providerId);\n\t\t\t// Matches LLAMA_PROVIDER_ID from extensions/llama/provider.ts; kept inline to avoid coupling interactive mode to the built-in extension.\n\t\t\tif (providerId === \"llama.cpp\") {\n\t\t\t\tselectionError = llamaCppPostLoginGuidance(actionLabel, providerModels.length);\n\t\t\t} else if (!hasDefaultModelProvider(providerId)) {\n\t\t\t\tselectionError = t(\n\t\t\t\t\t'{action}, but no default model is configured for provider \"{providerId}\". Use /model to select a model.',\n\t\t\t\t\t{ action: actionLabel, providerId },\n\t\t\t\t);\n\t\t\t} else if (providerModels.length === 0) {\n\t\t\t\tselectionError = t(\n\t\t\t\t\t\"{action}, but no models are available for that provider. Use /model to select a model.\",\n\t\t\t\t\t{\n\t\t\t\t\t\taction: actionLabel,\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tconst defaultModelId = defaultModelPerProvider[providerId];\n\t\t\t\tselectedModel = providerModels.find((model) => model.id === defaultModelId);\n\t\t\t\tif (!selectedModel) {\n\t\t\t\t\tselectionError = t(\n\t\t\t\t\t\t'{action}, but its default model \"{modelId}\" is not available. Use /model to select a model.',\n\t\t\t\t\t\t{ action: actionLabel, modelId: defaultModelId },\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait host.setSelectedModel(selectedModel);\n\t\t\t\t\t} catch (error: unknown) {\n\t\t\t\t\t\tselectedModel = undefined;\n\t\t\t\t\t\tconst errorMessage = error instanceof Error ? error.message : String(error);\n\t\t\t\t\t\tselectionError = t(\n\t\t\t\t\t\t\t\"{action}, but selecting its default model failed: {error}. Use /model to select a model.\",\n\t\t\t\t\t\t\t{ action: actionLabel, error: errorMessage },\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tawait host.updateAvailableProviderCount();\n\t\thost.invalidateFooter();\n\t\thost.updateEditorBorderColor();\n\t\tif (selectedModel) {\n\t\t\thost.showStatus(\n\t\t\t\tt(\"{action}. Selected {modelId}. Credentials saved to {path}\", {\n\t\t\t\t\taction: actionLabel,\n\t\t\t\t\tmodelId: selectedModel.id,\n\t\t\t\t\tpath: getAuthPath(),\n\t\t\t\t}),\n\t\t\t);\n\t\t\tvoid host.maybeWarnAboutAnthropicSubscriptionAuth(selectedModel);\n\t\t\thost.checkDaxnutsEasterEgg(selectedModel);\n\t\t} else {\n\t\t\thost.showStatus(t(\"{action}. Credentials saved to {path}\", { action: actionLabel, path: getAuthPath() }));\n\t\t\tif (selectionError) {\n\t\t\t\thost.showError(selectionError);\n\t\t\t} else {\n\t\t\t\tvoid host.maybeWarnAboutAnthropicSubscriptionAuth();\n\t\t\t}\n\t\t}\n\t};\n\tif (deferSelection) {\n\t\thost.showStatus(\n\t\t\tt(\"{action}. Credentials saved to {path}. Refreshing model catalog…\", {\n\t\t\t\taction: actionLabel,\n\t\t\t\tpath: getAuthPath(),\n\t\t\t}),\n\t\t);\n\t} else {\n\t\tawait finishAuthentication();\n\t}\n\n\tconst controller = new AbortController();\n\tconst timeout = setTimeout(() => controller.abort(), 15_000);\n\tvoid host\n\t\t.getModelCatalog()\n\t\t.refresh({ providers: [providerId], signal: controller.signal })\n\t\t.then(async (result) => {\n\t\t\tif (result.aborted) {\n\t\t\t\thost.showWarning(\n\t\t\t\t\tt(\"{action}, but its model catalog refresh timed out; using cached models.\", { action: actionLabel }),\n\t\t\t\t);\n\t\t\t} else if (result.errors.size > 0) {\n\t\t\t\thost.showWarning(\n\t\t\t\t\tt(\"{action}, but its model catalog could not be refreshed; using cached models.\", {\n\t\t\t\t\t\taction: actionLabel,\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\t\t\t// Do not replace a model or session selected while the refresh was running.\n\t\t\tif (\n\t\t\t\tdeferSelection &&\n\t\t\t\thost.isSameSessionIdentity(sessionIdentity) &&\n\t\t\t\thost.getSelectedModel() === previousModel\n\t\t\t) {\n\t\t\t\tawait finishAuthentication();\n\t\t\t}\n\t\t\thost.updateAvailableProviderCount();\n\t\t\thost.invalidateFooter();\n\t\t\thost.ui.requestRender();\n\t\t})\n\t\t.catch((error: unknown) => {\n\t\t\thost.showWarning(\n\t\t\t\tt(\"{action}, but its model catalog could not be refreshed: {error}\", {\n\t\t\t\t\taction: actionLabel,\n\t\t\t\t\terror: error instanceof Error ? error.message : String(error),\n\t\t\t\t}),\n\t\t\t);\n\t\t})\n\t\t.finally(() => clearTimeout(timeout));\n}\n\nexport function showAmbientAuthDialog(host: AuthUiHost, providerOption: AuthSelectorProvider): void {\n\tconst restoreEditor = () => {\n\t\thost.editorContainer.clear();\n\t\thost.editorContainer.addChild(host.editor);\n\t\thost.ui.setFocus(host.editor);\n\t\thost.ui.requestRender();\n\t};\n\n\tconst dialog = new LoginDialogComponent(\n\t\thost.ui,\n\t\tproviderOption.id,\n\t\t() => restoreEditor(),\n\t\tproviderOption.name,\n\t\tt(\"{name} setup\", { name: providerOption.name }),\n\t);\n\tdialog.showInfo(\n\t\tt(\"{method} is configured outside {appName}.\", {\n\t\t\tmethod: providerOption.method?.name ?? t(\"Authentication\"),\n\t\t\tappName: APP_NAME,\n\t\t}),\n\t\t[],\n\t\ttrue,\n\t);\n\n\thost.editorContainer.clear();\n\thost.editorContainer.addChild(dialog);\n\thost.ui.setFocus(dialog);\n\thost.ui.requestRender();\n}\n\nexport async function showApiKeyLoginDialog(host: AuthUiHost, providerId: string, providerName: string): Promise<void> {\n\tconst previousModel = host.getSelectedModel();\n\n\tconst dialog = new LoginDialogComponent(\n\t\thost.ui,\n\t\tproviderId,\n\t\t(_success, _message) => {\n\t\t\t// Completion handled below\n\t\t},\n\t\tproviderName,\n\t);\n\n\tif (providerId === \"amazon-bedrock\") {\n\t\tdialog.showDetails([\n\t\t\ttheme.fg(\"text\", t(\"You can also use an AWS profile, IAM keys, or role-based credentials.\")),\n\t\t\ttheme.fg(\"muted\", t(\"See:\")),\n\t\t\ttheme.fg(\"accent\", ` ${path.join(getDocsPath(), \"providers.md\")}`),\n\t\t]);\n\t}\n\n\thost.editorContainer.clear();\n\thost.editorContainer.addChild(dialog);\n\thost.ui.setFocus(dialog);\n\thost.ui.requestRender();\n\n\tconst restoreEditor = () => {\n\t\thost.editorContainer.clear();\n\t\thost.editorContainer.addChild(host.editor);\n\t\thost.ui.setFocus(host.editor);\n\t\thost.ui.requestRender();\n\t};\n\n\ttry {\n\t\tawait host.loginProvider(dialog, providerId, \"api_key\");\n\t\trestoreEditor();\n\t\tawait host.completeProviderAuthentication(providerId, providerName, \"api_key\", previousModel);\n\t} catch (error: unknown) {\n\t\trestoreEditor();\n\t\tconst errorMsg = error instanceof Error ? error.message : String(error);\n\t\tif (error instanceof CredentialSynchronizationError) {\n\t\t\thost.showError(\n\t\t\t\tt(\"Saved API key for {name}, but local model state could not be synchronized: {error}\", {\n\t\t\t\t\tname: providerName,\n\t\t\t\t\terror: errorMsg,\n\t\t\t\t}),\n\t\t\t);\n\t\t} else if (errorMsg !== t(\"Login cancelled\")) {\n\t\t\thost.showError(t(\"Failed to save API key for {name}: {error}\", { name: providerName, error: errorMsg }));\n\t\t}\n\t}\n}\n\nexport function showAuthSelect(\n\thost: AuthUiHost,\n\tdialog: LoginDialogComponent,\n\tprompt: Extract<AuthPrompt, { type: \"select\" }>,\n): Promise<string> {\n\treturn new Promise((resolve, reject) => {\n\t\tconst restoreDialog = () => {\n\t\t\thost.editorContainer.clear();\n\t\t\thost.editorContainer.addChild(dialog);\n\t\t\thost.ui.setFocus(dialog);\n\t\t\thost.ui.requestRender();\n\t\t};\n\t\tconst labels = prompt.options.map((option) => option.label);\n\t\tconst selector = new DialogSelectorComponent(\n\t\t\tprompt.message,\n\t\t\tlabels,\n\t\t\t(optionLabel) => {\n\t\t\t\trestoreDialog();\n\t\t\t\tconst id = prompt.options.find((option) => option.label === optionLabel)?.id;\n\t\t\t\t// v8 ignore next -- 选项列表由 prompt.options 派生,选中项必能找到\n\t\t\t\tif (id) resolve(id);\n\t\t\t\telse reject(new Error(t(\"Login cancelled\")));\n\t\t\t},\n\t\t\t() => {\n\t\t\t\trestoreDialog();\n\t\t\t\treject(new Error(t(\"Login cancelled\")));\n\t\t\t},\n\t\t);\n\t\thost.editorContainer.clear();\n\t\thost.editorContainer.addChild(selector);\n\t\thost.ui.setFocus(selector);\n\t\thost.ui.requestRender();\n\t});\n}\n\nexport async function showAuthPrompt(\n\thost: AuthUiHost,\n\tdialog: LoginDialogComponent,\n\tprompt: AuthPrompt,\n): Promise<string> {\n\tlet response: Promise<string>;\n\tif (prompt.type === \"select\") {\n\t\tresponse = host.showAuthSelect(dialog, prompt);\n\t} else if (prompt.type === \"manual_code\") {\n\t\tresponse = dialog.showManualInput(prompt.message);\n\t} else {\n\t\tresponse = dialog.showPrompt(prompt.message, prompt.placeholder);\n\t}\n\tif (!prompt.signal) return response;\n\tif (prompt.signal.aborted) throw new Error(t(\"Login cancelled\"));\n\tconst signal = prompt.signal;\n\tlet onAbort: (() => void) | undefined;\n\tconst aborted = new Promise<string>((_resolve, reject) => {\n\t\tonAbort = () => reject(new Error(t(\"Login cancelled\")));\n\t\tsignal.addEventListener(\"abort\", onAbort, { once: true });\n\t});\n\ttry {\n\t\treturn await Promise.race([response, aborted]);\n\t} finally {\n\t\t// v8 ignore next -- onAbort 在 Promise executor 中同步赋值,恒已定义\n\t\tif (onAbort) signal.removeEventListener(\"abort\", onAbort);\n\t}\n}\n\nexport function notifyAuthDialog(_host: AuthUiHost, dialog: LoginDialogComponent, event: AuthEvent): void {\n\tif (event.type === \"auth_url\") {\n\t\tdialog.showAuth(event.url, event.instructions);\n\t} else if (event.type === \"device_code\") {\n\t\tdialog.showDeviceCode(event);\n\t\tdialog.showWaiting(t(\"Waiting for authentication...\"));\n\t} else if (event.type === \"info\") {\n\t\tdialog.showInfo(event.message, event.links);\n\t} else {\n\t\tdialog.showProgress(event.message);\n\t}\n}\n\nexport async function loginProvider(\n\thost: AuthUiHost,\n\tdialog: LoginDialogComponent,\n\tproviderId: string,\n\tmethod: \"api_key\" | \"oauth\",\n): Promise<void> {\n\tawait host.getModelAuthRuntime().login(providerId, method, {\n\t\tsignal: dialog.signal,\n\t\tprompt: (prompt) => host.showAuthPrompt(dialog, prompt),\n\t\tnotify: (event) => host.notifyAuthDialog(dialog, event),\n\t});\n}\n\nexport async function showLoginDialog(host: AuthUiHost, providerId: string, providerName: string): Promise<void> {\n\tconst previousModel = host.getSelectedModel();\n\tconst dialog = new LoginDialogComponent(host.ui, providerId, (_success, _message) => {}, providerName);\n\thost.editorContainer.clear();\n\thost.editorContainer.addChild(dialog);\n\thost.ui.setFocus(dialog);\n\thost.ui.requestRender();\n\n\tconst restoreEditor = () => {\n\t\thost.editorContainer.clear();\n\t\thost.editorContainer.addChild(host.editor);\n\t\thost.ui.setFocus(host.editor);\n\t\thost.ui.requestRender();\n\t};\n\n\ttry {\n\t\tawait host.loginProvider(dialog, providerId, \"oauth\");\n\t\trestoreEditor();\n\t\tawait host.completeProviderAuthentication(providerId, providerName, \"oauth\", previousModel);\n\t} catch (error: unknown) {\n\t\trestoreEditor();\n\t\tconst errorMsg = error instanceof Error ? error.message : String(error);\n\t\tif (error instanceof CredentialSynchronizationError) {\n\t\t\thost.showError(\n\t\t\t\tt(\"Logged in to {name}, but local model state could not be synchronized: {error}\", {\n\t\t\t\t\tname: providerName,\n\t\t\t\t\terror: errorMsg,\n\t\t\t\t}),\n\t\t\t);\n\t\t} else if (errorMsg !== t(\"Login cancelled\")) {\n\t\t\thost.showError(t(\"Failed to login to {name}: {error}\", { name: providerName, error: errorMsg }));\n\t\t}\n\t}\n}\n"]}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import type { Component, EditorComponent, Keybinding, MarkdownTheme, TUI } from "@agent-forge/tui";
|
|
2
|
+
import { Container } from "@agent-forge/tui";
|
|
3
|
+
import type { CodingAgentFacadeV1, CodingAgentRuntimeFacadeV1 } from "../../core/facade/index.ts";
|
|
4
|
+
import type { AppKeybinding, KeybindingsManager } from "../../core/keybindings.ts";
|
|
5
|
+
import type { ThemeMetaV1 } from "../../core/resource-loader.ts";
|
|
6
|
+
import { MissingSessionCwdError } from "../../core/session-cwd.ts";
|
|
7
|
+
import type { SettingsManager } from "../../core/settings-manager.ts";
|
|
8
|
+
import type { MetricsSnapshotV1, ObservabilityMetricsOptions } from "../../plugins/observability-types.ts";
|
|
9
|
+
import { type Theme } from "../../theme/theme.ts";
|
|
10
|
+
import type { InteractiveThemeController } from "../../theme/theme-controller.ts";
|
|
11
|
+
import { BashExecutionComponent } from "./components/bash-execution.ts";
|
|
7
12
|
/**
|
|
8
13
|
* Narrow facade InteractiveMode exposes to the dispatch table. Entries resolve
|
|
9
14
|
* handlers through this interface at dispatch time, so instance-level
|
|
@@ -54,6 +59,60 @@ export interface CommandDispatchHost {
|
|
|
54
59
|
}): Promise<void>;
|
|
55
60
|
showWorkflowView(): void;
|
|
56
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Host surface for the command-handler implementations in this module (拆分
|
|
64
|
+
* slice 1): everything the handler bodies touch on the mode beyond the
|
|
65
|
+
* dispatch signatures CommandDispatchHost already declares. InteractiveMode
|
|
66
|
+
* implements this interface; its same-name delegate methods keep
|
|
67
|
+
* prototype-level test bindings and the dispatch table working.
|
|
68
|
+
*
|
|
69
|
+
* Internal collaboration interface (same pattern as CommandDispatchHost): not
|
|
70
|
+
* a plugin API and not exported from the package root.
|
|
71
|
+
*/
|
|
72
|
+
export interface CommandHandlersHost extends CommandDispatchHost {
|
|
73
|
+
/** Stable facade (阶段 1 slice 1). */
|
|
74
|
+
facade: CodingAgentFacadeV1;
|
|
75
|
+
/** Stable runtime facade (阶段 4 slice 3). */
|
|
76
|
+
runtimeFacade: CodingAgentRuntimeFacadeV1;
|
|
77
|
+
/** Constructor-injected settings (D-047). */
|
|
78
|
+
settingsManager: SettingsManager;
|
|
79
|
+
/** Mode options; /metrics reads the observability plugin source here. */
|
|
80
|
+
options: {
|
|
81
|
+
getMetrics?: (options?: ObservabilityMetricsOptions) => MetricsSnapshotV1 | undefined;
|
|
82
|
+
};
|
|
83
|
+
keybindings: KeybindingsManager;
|
|
84
|
+
themeController: InteractiveThemeController;
|
|
85
|
+
ui: TUI;
|
|
86
|
+
editor: EditorComponent;
|
|
87
|
+
editorContainer: Container;
|
|
88
|
+
chatContainer: Container;
|
|
89
|
+
pendingMessagesContainer: Container;
|
|
90
|
+
builtInHeader: Component | undefined;
|
|
91
|
+
toolOutputExpanded: boolean;
|
|
92
|
+
hideThinkingBlock: boolean;
|
|
93
|
+
outputPad: number;
|
|
94
|
+
bashComponent: BashExecutionComponent | undefined;
|
|
95
|
+
pendingBashComponents: BashExecutionComponent[];
|
|
96
|
+
showStatus(message: string): void;
|
|
97
|
+
showError(message: string): void;
|
|
98
|
+
showWarning(message: string): void;
|
|
99
|
+
clearStatusIndicator(): void;
|
|
100
|
+
resetDialogUI(): void;
|
|
101
|
+
rebuildChatFromMessages(): void;
|
|
102
|
+
applyRuntimeSettings(): void;
|
|
103
|
+
setupAutocompleteProvider(): void;
|
|
104
|
+
showLoadedResources(options?: {
|
|
105
|
+
force?: boolean;
|
|
106
|
+
showDiagnosticsWhenQuiet?: boolean;
|
|
107
|
+
}): void;
|
|
108
|
+
showDialogConfirm(title: string, message: string): Promise<boolean>;
|
|
109
|
+
promptForMissingSessionCwd(error: MissingSessionCwdError): Promise<string | undefined>;
|
|
110
|
+
handleFatalRuntimeError(title: string, error: unknown): Promise<void>;
|
|
111
|
+
getMarkdownThemeWithSettings(): MarkdownTheme;
|
|
112
|
+
/** Daxnuts easter-egg render; resolved through the host so instance-level
|
|
113
|
+
* overrides keep working (original called this.handleDaxnuts()). */
|
|
114
|
+
handleDaxnuts(): void;
|
|
115
|
+
}
|
|
57
116
|
export interface CommandDispatchEntry {
|
|
58
117
|
/** Command word including the leading slash, e.g. "/model". */
|
|
59
118
|
command: string;
|
|
@@ -90,4 +149,62 @@ export interface CompletionCommandInput {
|
|
|
90
149
|
* their own paths; neither is offered as an ambiguous completion).
|
|
91
150
|
*/
|
|
92
151
|
export declare function filterCapabilityCommandsForCompletions(capabilityCommands: readonly CompletionCommandInput[], reservedNames: readonly Iterable<string>[]): CompletionCommandInput[];
|
|
152
|
+
/**
|
|
153
|
+
* Rebuilds real Theme instances from the resource loader's ThemeMetaV1
|
|
154
|
+
* projection for the theme registry (B-S2b v1). Registration points
|
|
155
|
+
* (constructor, runtime session start, reload) need loadable instances —
|
|
156
|
+
* setRegisteredThemes stores what it is given and getThemeByName returns the
|
|
157
|
+
* registered instance first — while the loader surface now projects only
|
|
158
|
+
* metadata. Re-loading is synchronous and deterministic per sourcePath;
|
|
159
|
+
* theme names come from the same JSON the loader parsed, so meta.name ===
|
|
160
|
+
* Theme.name and the registry keeps its own name-filter/dedupe semantics.
|
|
161
|
+
*
|
|
162
|
+
* Contract: a meta without a sourcePath (or one whose file no longer parses)
|
|
163
|
+
* throws — themesOverride host inputs must always carry a loadable
|
|
164
|
+
* sourcePath. This adds one extra parse per theme at registration time
|
|
165
|
+
* (constructor / session start / reload, not per turn).
|
|
166
|
+
*
|
|
167
|
+
* Re-exported from ./interactive-mode.ts for existing consumers of that module.
|
|
168
|
+
*/
|
|
169
|
+
export declare function buildRegisteredThemes(themes: readonly ThemeMetaV1[]): Theme[];
|
|
170
|
+
export declare function handleReloadCommand(host: CommandHandlersHost): Promise<void>;
|
|
171
|
+
export declare function handleExportCommand(host: CommandHandlersHost, text: string): Promise<void>;
|
|
172
|
+
export declare function getPathCommandArgument(text: string, command: "/export" | "/import"): string | undefined;
|
|
173
|
+
export declare function handleImportCommand(host: CommandHandlersHost, text: string): Promise<void>;
|
|
174
|
+
export declare function handleCopyCommand(host: CommandHandlersHost, options?: {
|
|
175
|
+
flashConfirmation?: boolean;
|
|
176
|
+
preferSelection?: boolean;
|
|
177
|
+
}): Promise<void>;
|
|
178
|
+
export declare function handleNameCommand(host: CommandHandlersHost, text: string): void;
|
|
179
|
+
/**
|
|
180
|
+
* 中断分级(设计 子代理运行时 §4.2,2026-10-02):/stop-agents 的唯一执行
|
|
181
|
+
* 面——终止全部后台子代理(不触当前回合)。Esc 从不做这件事。
|
|
182
|
+
*/
|
|
183
|
+
export declare function handleStopAgentsCommand(host: CommandHandlersHost): void;
|
|
184
|
+
export declare function handleSessionCommand(host: CommandHandlersHost): void;
|
|
185
|
+
export declare function handleMetricsCommand(host: CommandHandlersHost, turnsArg: string | undefined): void;
|
|
186
|
+
export declare function handleChangelogCommand(host: CommandHandlersHost): void;
|
|
187
|
+
/**
|
|
188
|
+
* Get capitalized display string for an app keybinding action.
|
|
189
|
+
*/
|
|
190
|
+
export declare function getAppKeyDisplay(action: AppKeybinding): string;
|
|
191
|
+
/**
|
|
192
|
+
* Get capitalized display string for an editor keybinding action.
|
|
193
|
+
*/
|
|
194
|
+
export declare function getEditorKeyDisplay(action: Keybinding): string;
|
|
195
|
+
export declare function handleHelpCommand(host: CommandHandlersHost): void;
|
|
196
|
+
export declare function handleHotkeysCommand(host: CommandHandlersHost): void;
|
|
197
|
+
export declare function handleClearCommand(host: CommandHandlersHost): Promise<void>;
|
|
198
|
+
export declare function handleDebugCommand(host: CommandHandlersHost): void;
|
|
199
|
+
export declare function handleArminSaysHi(host: CommandHandlersHost): void;
|
|
200
|
+
export declare function handleDaxnuts(host: CommandHandlersHost): void;
|
|
201
|
+
/** Host-visible for ./interactive-auth.ts (S5 slice 3). */
|
|
202
|
+
export declare function checkDaxnutsEasterEgg(host: CommandHandlersHost, model: {
|
|
203
|
+
provider: string;
|
|
204
|
+
id: string;
|
|
205
|
+
}): void;
|
|
206
|
+
export declare function handleBashCommand(host: CommandHandlersHost, command: string, excludeFromContext?: boolean): Promise<void>;
|
|
207
|
+
export declare function handleCompactCommand(host: CommandHandlersHost, customInstructions?: string): Promise<void>;
|
|
208
|
+
/** /clean-sessions:会话清理两阶段流程;输出/确认走宿主既有机制(设计 §7)。 */
|
|
209
|
+
export declare function handleCleanSessionsCommand(host: CommandHandlersHost, arg: string | undefined): Promise<void>;
|
|
93
210
|
//# sourceMappingURL=interactive-commands.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-commands.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-commands.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IACnC,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,oBAAoB,IAAI,IAAI,CAAC;IAC7B,kBAAkB,IAAI,IAAI,CAAC;IAC3B,kBAAkB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvD,qBAAqB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjD,kBAAkB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3C,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,iBAAiB,CAAC,OAAO,CAAC,EAAE;QAAE,iBAAiB,CAAC,EAAE,OAAO,CAAC;QAAC,eAAe,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvG,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,oBAAoB,IAAI,IAAI,CAAC;IAC7B;uDACmD;IACnD,uBAAuB,IAAI,IAAI,CAAC;IAChC,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IACzD,sBAAsB,IAAI,IAAI,CAAC;IAC/B,iBAAiB,IAAI,IAAI,CAAC;IAC1B,oBAAoB,IAAI,IAAI,CAAC;IAC7B,uBAAuB,IAAI,IAAI,CAAC;IAChC,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,gBAAgB,CAAC,iBAAiB,CAA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AAG,EAAE,CAAC,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CAChG;AAED,MAAM,WAAW,oBAAoB;IACpC,KAAK,EAAE,oBAAoB,CAAC;IAC5B,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;CACxB;AAED,eAAO,MAAM,wBAAwB,EAAE,SAAS,oBAAoB,EAqLnE,CAAC;AAEF,oFAAoF;AACpF,wBAAgB,yBAAyB,CACxC,OAAO,EAAE,SAAS,oBAAoB,EAAE,EACxC,IAAI,EAAE,MAAM,GACV,oBAAoB,GAAG,SAAS,CAYlC;AAED,mFAAmF;AACnF,MAAM,WAAW,sBAAsB;IACtC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;;;;;GAMG;AACH,wBAAgB,sCAAsC,CACrD,kBAAkB,EAAE,SAAS,sBAAsB,EAAE,EACrD,aAAa,EAAE,SAAS,QAAQ,CAAC,MAAM,CAAC,EAAE,GACxC,sBAAsB,EAAE,CAU1B","sourcesContent":["/**\n * Slash-command dispatch table for the interactive mode editor submit handler.\n * Extracted from InteractiveMode.setupEditorSubmitHandler; entry order mirrors\n * the original if-chain and each run body mirrors its branch verbatim\n * (await/no-await and editor clearing order included).\n */\n\n/**\n * Narrow facade InteractiveMode exposes to the dispatch table. Entries resolve\n * handlers through this interface at dispatch time, so instance-level\n * overrides keep working.\n */\nexport interface CommandDispatchHost {\n\tsetEditorText(text: string): void;\n\tshowSettingsSelector(): void;\n\tshowModelsSelector(): void;\n\thandleModelCommand(searchTerm?: string): Promise<void>;\n\thandleThinkingCommand(searchTerm?: string): void;\n\thandleSuiteCommand(suiteId?: string): void;\n\thandleExportCommand(text: string): Promise<void>;\n\thandleImportCommand(text: string): Promise<void>;\n\thandleCopyCommand(options?: { flashConfirmation?: boolean; preferSelection?: boolean }): Promise<void>;\n\thandleNameCommand(text: string): void;\n\thandleSessionCommand(): void;\n\t/** Interrupt grading (§4.2): terminate every background subagent; the\n\t * /stop-agents command's single execution face. */\n\thandleStopAgentsCommand(): void;\n\thandleMetricsCommand(turnsArg: string | undefined): void;\n\thandleChangelogCommand(): void;\n\thandleHelpCommand(): void;\n\thandleHotkeysCommand(): void;\n\tshowUserMessageSelector(): void;\n\thandleCloneCommand(): Promise<void>;\n\tshowTreeSelector(initialSelectedId?: string): void;\n\thandleLoginCommand(providerRef?: string): Promise<void>;\n\tshowOAuthSelector(mode: \"login\" | \"logout\"): Promise<void>;\n\thandleClearCommand(): Promise<void>;\n\thandleCompactCommand(customInstructions?: string): Promise<void>;\n\t/** /clean-sessions:会话清理两阶段流程(预览 → 宿主确认 → 执行,设计 §7)。 */\n\thandleCleanSessionsCommand(arg: string | undefined): Promise<void>;\n\thandleReloadCommand(): Promise<void>;\n\thandleDebugCommand(): void;\n\thandleArminSaysHi(): void;\n\tshowSessionSelector(): void;\n\tshowAgentsView(): void;\n\thandleQueueCommand(text: string | undefined): Promise<void>;\n\thandleDequeueCommand(): void;\n\thandleQueueListCommand(): void;\n\thandleEditorCommand(): Promise<void>;\n\tshutdown(options?: { fromSignal?: boolean }): Promise<void>;\n\tshowWorkflowView(): void;\n}\n\nexport interface CommandDispatchEntry {\n\t/** Command word including the leading slash, e.g. \"/model\". */\n\tcommand: string;\n\t/**\n\t * Slice offset of the optional argument for prefix commands\n\t * (\"/model claude\" -> text.slice(7).trim()); omit for exact-match commands.\n\t */\n\targOffset?: number;\n\t/** Report a blank (empty after trim) argument as undefined. */\n\tblankArgToUndefined?: boolean;\n\t/** Clear the editor text before running the handler instead of after. */\n\tclearEditorBeforeRun?: boolean;\n\t/** Handler; receives the full submitted text and the extracted argument. */\n\trun: (host: CommandDispatchHost, text: string, arg: string | undefined) => Promise<void> | void;\n}\n\nexport interface CommandDispatchMatch {\n\tentry: CommandDispatchEntry;\n\targ: string | undefined;\n}\n\nexport const COMMAND_DISPATCH_ENTRIES: readonly CommandDispatchEntry[] = [\n\t{\n\t\tcommand: \"/settings\",\n\t\trun: (host) => {\n\t\t\thost.showSettingsSelector();\n\t\t},\n\t},\n\t{\n\t\tcommand: \"/scoped-models\",\n\t\tclearEditorBeforeRun: true,\n\t\trun: async (host) => {\n\t\t\tawait host.showModelsSelector();\n\t\t},\n\t},\n\t{\n\t\tcommand: \"/model\",\n\t\targOffset: 7,\n\t\tclearEditorBeforeRun: true,\n\t\trun: (host, _text, arg) => host.handleModelCommand(arg),\n\t},\n\t{\n\t\tcommand: \"/thinking\",\n\t\targOffset: 10,\n\t\tclearEditorBeforeRun: true,\n\t\trun: (host, _text, arg) => {\n\t\t\thost.handleThinkingCommand(arg);\n\t\t},\n\t},\n\t{\n\t\tcommand: \"/suite\",\n\t\targOffset: 7,\n\t\tblankArgToUndefined: true,\n\t\tclearEditorBeforeRun: true,\n\t\trun: (host, _text, arg) => {\n\t\t\thost.handleSuiteCommand(arg);\n\t\t},\n\t},\n\t// /export, /import and /name are prefix commands whose handlers parse the\n\t// full text themselves; argOffset only enables prefix matching here.\n\t{ command: \"/export\", argOffset: 8, run: (host, text) => host.handleExportCommand(text) },\n\t{ command: \"/import\", argOffset: 8, run: (host, text) => host.handleImportCommand(text) },\n\t{ command: \"/copy\", run: (host) => host.handleCopyCommand() },\n\t{\n\t\tcommand: \"/name\",\n\t\targOffset: 6,\n\t\trun: (host, text) => {\n\t\t\thost.handleNameCommand(text);\n\t\t},\n\t},\n\t{\n\t\tcommand: \"/session\",\n\t\trun: (host) => {\n\t\t\thost.handleSessionCommand();\n\t\t},\n\t},\n\t// Interrupt grading (设计 子代理运行时 §4.2, 2026-10-02): the only explicit\n\t// face for terminating background subagents — Esc never cancels them.\n\t{\n\t\tcommand: \"/stop-agents\",\n\t\trun: (host) => {\n\t\t\thost.handleStopAgentsCommand();\n\t\t},\n\t},\n\t{\n\t\tcommand: \"/metrics\",\n\t\targOffset: 9,\n\t\tblankArgToUndefined: true,\n\t\tclearEditorBeforeRun: true,\n\t\trun: (host, _text, arg) => {\n\t\t\thost.handleMetricsCommand(arg);\n\t\t},\n\t},\n\t{\n\t\tcommand: \"/changelog\",\n\t\trun: (host) => {\n\t\t\thost.handleChangelogCommand();\n\t\t},\n\t},\n\t{\n\t\tcommand: \"/help\",\n\t\trun: (host) => {\n\t\t\thost.handleHelpCommand();\n\t\t},\n\t},\n\t{\n\t\tcommand: \"/hotkeys\",\n\t\trun: (host) => {\n\t\t\thost.handleHotkeysCommand();\n\t\t},\n\t},\n\t{\n\t\tcommand: \"/fork\",\n\t\trun: (host) => {\n\t\t\thost.showUserMessageSelector();\n\t\t},\n\t},\n\t{ command: \"/clone\", clearEditorBeforeRun: true, run: (host) => host.handleCloneCommand() },\n\t{\n\t\tcommand: \"/tree\",\n\t\trun: (host) => {\n\t\t\thost.showTreeSelector();\n\t\t},\n\t},\n\t{\n\t\tcommand: \"/login\",\n\t\targOffset: 7,\n\t\tclearEditorBeforeRun: true,\n\t\trun: (host, _text, arg) => host.handleLoginCommand(arg),\n\t},\n\t// Original branch does not await showOAuthSelector; keep it fire-and-forget.\n\t{\n\t\tcommand: \"/logout\",\n\t\trun: (host) => {\n\t\t\tvoid host.showOAuthSelector(\"logout\");\n\t\t},\n\t},\n\t{ command: \"/new\", clearEditorBeforeRun: true, run: (host) => host.handleClearCommand() },\n\t{\n\t\tcommand: \"/compact\",\n\t\targOffset: 9,\n\t\tclearEditorBeforeRun: true,\n\t\trun: (host, _text, arg) => host.handleCompactCommand(arg),\n\t},\n\t{\n\t\tcommand: \"/clean-sessions\",\n\t\targOffset: 16,\n\t\tblankArgToUndefined: true,\n\t\tclearEditorBeforeRun: true,\n\t\trun: (host, _text, arg) => host.handleCleanSessionsCommand(arg),\n\t},\n\t{ command: \"/reload\", clearEditorBeforeRun: true, run: (host) => host.handleReloadCommand() },\n\t{\n\t\tcommand: \"/debug\",\n\t\trun: (host) => {\n\t\t\thost.handleDebugCommand();\n\t\t},\n\t},\n\t{\n\t\tcommand: \"/arminsayshi\",\n\t\trun: (host) => {\n\t\t\thost.handleArminSaysHi();\n\t\t},\n\t},\n\t{\n\t\tcommand: \"/resume\",\n\t\trun: (host) => {\n\t\t\thost.showSessionSelector();\n\t\t},\n\t},\n\t// Read-only subagent session browser (view-family command: sync, no editor\n\t// clearing), grouped with /resume ahead of the /workflow view overlay.\n\t{\n\t\tcommand: \"/agents\",\n\t\trun: (host) => {\n\t\t\thost.showAgentsView();\n\t\t},\n\t},\n\t// Follow-up queue face (single-entry iron law: /queue replaces the shipped\n\t// ctrl+q default). A bare /queue prints usage — the editor buffer is\n\t// cleared on submit before the command runs, so there is no editor\n\t// content to queue (the configurable keybinding keeps that behavior).\n\t{\n\t\tcommand: \"/queue\",\n\t\targOffset: 7,\n\t\tblankArgToUndefined: true,\n\t\trun: (host, _text, arg) => host.handleQueueCommand(arg),\n\t},\n\t{ command: \"/dequeue\", run: (host) => host.handleDequeueCommand() },\n\t// Queue manager overlay (single entry point: the /queue-list command;\n\t// reorder/remove/restore are in-component keys of the overlay itself).\n\t{ command: \"/queue-list\", run: (host) => host.handleQueueListCommand() },\n\t{ command: \"/editor\", run: (host) => host.handleEditorCommand() },\n\t{ command: \"/quit\", clearEditorBeforeRun: true, run: (host) => host.shutdown() },\n\t// Exact-match only: every other /workflow subcommand (why/log/...) keeps\n\t// flowing to the plugin's text command path untouched (§9 L2).\n\t{\n\t\tcommand: \"/workflow view\",\n\t\trun: (host) => {\n\t\t\thost.showWorkflowView();\n\t\t},\n\t},\n];\n\n/** Find the entry matching text: exact command, or command prefix plus argument. */\nexport function matchCommandDispatchEntry(\n\tentries: readonly CommandDispatchEntry[],\n\ttext: string,\n): CommandDispatchMatch | undefined {\n\tfor (const entry of entries) {\n\t\tif (text === entry.command) {\n\t\t\treturn { entry, arg: undefined };\n\t\t}\n\t\tif (entry.argOffset === undefined || !text.startsWith(`${entry.command} `)) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst arg = text.slice(entry.argOffset).trim();\n\t\treturn { entry, arg: entry.blankArgToUndefined && arg.length === 0 ? undefined : arg };\n\t}\n\treturn undefined;\n}\n\n/** Minimal command shape the completion filter works on (mirrors SlashCommand). */\nexport interface CompletionCommandInput {\n\treadonly name: string;\n\treadonly description: string;\n\treadonly argumentHint?: string;\n}\n\n/**\n * Capability commands that collide with a builtin, prompt-template, or skill\n * command name are rejected by AgentSession at invocation time rather than\n * silently resolving to one source, so the colliding capability command is\n * withheld from the completion list entirely (both sides stay executable via\n * their own paths; neither is offered as an ambiguous completion).\n */\nexport function filterCapabilityCommandsForCompletions(\n\tcapabilityCommands: readonly CompletionCommandInput[],\n\treservedNames: readonly Iterable<string>[],\n): CompletionCommandInput[] {\n\tconst reserved = new Set<string>();\n\tfor (const names of reservedNames) for (const name of names) reserved.add(name);\n\treturn capabilityCommands\n\t\t.filter((command) => !reserved.has(command.name))\n\t\t.map((command) => ({\n\t\t\tname: command.name,\n\t\t\tdescription: command.description,\n\t\t\t...(command.argumentHint !== undefined ? { argumentHint: command.argumentHint } : {}),\n\t\t}));\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interactive-commands.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-commands.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,UAAU,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACnG,OAAO,EAAE,SAAS,EAAsD,MAAM,kBAAkB,CAAC;AAIjG,OAAO,KAAK,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAElG,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACnF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAEjE,OAAO,EAAE,sB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command-handler implementations behind it (拆分 slice 1).\n *\n * The dispatch table was extracted from InteractiveMode.setupEditorSubmitHandler;\n * entry order mirrors the original if-chain and each run body mirrors its\n * branch verbatim (await/no-await and editor clearing order included). The\n * handler functions below were moved verbatim out of InteractiveMode (拆分\n * slice 1, docs/plans/interactive-mode拆分计划.md); the mode keeps same-name\n * delegate methods so prototype-level tests and the dispatch table keep\n * working.\n */\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport type { Component, EditorComponent, Keybinding, MarkdownTheme, TUI } from \"@agent-forge/tui\";\nimport { Container, Markdown, Spacer, Text, TuiAltScreen, visibleWidth } from \"@agent-forge/tui\";\nimport { getDebugLogPath } from \"../../config.ts\";\nimport { SessionImportFileNotFoundError } from \"../../core/agent-session-runtime.ts\";\nimport { computeCacheWaste } from \"../../core/cache-stats.ts\";\nimport type { CodingAgentFacadeV1, CodingAgentRuntimeFacadeV1 } from \"../../core/facade/index.ts\";\nimport { t } from \"../../core/i18n/index.ts\";\nimport type { AppKeybinding, KeybindingsManager } from \"../../core/keybindings.ts\";\nimport type { ThemeMetaV1 } from \"../../core/resource-loader.ts\";\nimport { runCleanSessions } from \"../../core/session-cleanup.ts\";\nimport { MissingSessionCwdError } from \"../../core/session-cwd.ts\";\nimport type { SettingsManager } from \"../../core/settings-manager.ts\";\nimport { BUILTIN_SLASH_COMMANDS } from \"../../core/slash-commands.ts\";\nimport type { TruncationResult } from \"../../core/tools/truncate.ts\";\nimport { getUsageCostBreakdown } from \"../../core/usage-totals.ts\";\nimport type { MetricsSnapshotV1, ObservabilityMetricsOptions } from \"../../plugins/observability-types.ts\";\nimport { loadThemeFromPath, setRegisteredThemes, type Theme, theme } from \"../../theme/theme.ts\";\nimport type { InteractiveThemeController } from \"../../theme/theme-controller.ts\";\nimport { getChangelogPath, normalizeChangelogLinks, parseChangelog } from \"../../utils/changelog.ts\";\nimport { copyToClipboard } from \"../../utils/clipboard.ts\";\nimport { ArminComponent } from \"./components/armin.ts\";\nimport { BashExecutionComponent } from \"./components/bash-execution.ts\";\nimport { DaxnutsComponent } from \"./components/daxnuts.ts\";\nimport { DynamicBorder } from \"./components/dynamic-border.ts\";\nimport { formatTokens } from \"./components/footer.ts\";\nimport { keyDisplayText } from \"./components/keybinding-hints.ts\";\nimport { isExpandable } from \"./interactive-dialog-ui.ts\";\nimport { formatMetricsSnapshot } from \"./interactive-format.ts\";\n\n/**\n * Narrow facade InteractiveMode exposes to the dispatch table. Entries resolve\n * handlers through this interface at dispatch time, so instance-level\n * overrides keep working.\n */\nexport interface CommandDispatchHost {\n\tsetEditorText(text: string): void;\n\tshowSettingsSelector(): void;\n\tshowModelsSelector(): void;\n\thandleModelCommand(searchTerm?: string): Promise<void>;\n\thandleThinkingCommand(searchTerm?: string): void;\n\thandleSuiteCommand(suiteId?: string): void;\n\thandleExportCommand(text: string): Promise<void>;\n\thandleImportCommand(text: string): Promise<void>;\n\thandleCopyCommand(options?: { flashConfirmation?: boolean; preferSelection?: boolean }): Promise<void>;\n\thandleNameCommand(text: string): void;\n\thandleSessionCommand(): void;\n\t/** Interrupt grading (§4.2): terminate every background subagent; the\n\t * /stop-agents command's single execution face. */\n\thandleStopAgentsCommand(): void;\n\thandleMetricsCommand(turnsArg: string | undefined): void;\n\thandleChangelogCommand(): void;\n\thandleHelpCommand(): void;\n\thandleHotkeysCommand(): void;\n\tshowUserMessageSelector(): void;\n\thandleCloneCommand(): Promise<void>;\n\tshowTreeSelector(initialSelectedId?: string): void;\n\thandleLoginCommand(providerRef?: string): Promise<void>;\n\tshowOAuthSelector(mode: \"login\" | \"logout\"): Promise<void>;\n\thandleClearCommand(): Promise<void>;\n\thandleCompactCommand(customInstructions?: string): Promise<void>;\n\t/** /clean-sessions:会话清理两阶段流程(预览 → 宿主确认 → 执行,设计 §7)。 */\n\thandleCleanSessionsCommand(arg: string | undefined): Promise<void>;\n\thandleReloadCommand(): Promise<void>;\n\thandleDebugCommand(): void;\n\thandleArminSaysHi(): void;\n\tshowSessionSelector(): void;\n\tshowAgentsView(): void;\n\thandleQueueCommand(text: string | undefined): Promise<void>;\n\thandleDequeueCommand(): void;\n\thandleQueueListCommand(): void;\n\thandleEditorCommand(): Promise<void>;\n\tshutdown(options?: { fromSignal?: boolean }): Promise<void>;\n\tshowWorkflowView(): void;\n}\n\n/**\n * Host surface for the command-handler implementations in this module (拆分\n * slice 1): everything the handler bodies touch on the mode beyond the\n * dispatch signatures CommandDispatchHost already declares. InteractiveMode\n * implements this interface; its same-name delegate methods keep\n * prototype-level test bindings and the dispatch table working.\n *\n * Internal collaboration interface (same pattern as CommandDispatchHost): not\n * a plugin API and not exported from the package root.\n */\nexport interface CommandHandlersHost extends CommandDispatchHost {\n\t/** Stable facade (阶段 1 slice 1). */\n\tfacade: CodingAgentFacadeV1;\n\t/** Stable runtime facade (阶段 4 slice 3). */\n\truntimeFacade: CodingAgentRuntimeFacadeV1;\n\t/** Constructor-injected settings (D-047). */\n\tsettingsManager: SettingsManager;\n\t/** Mode options; /metrics reads the observability plugin source here. */\n\toptions: { getMetrics?: (options?: ObservabilityMetricsOptions) => MetricsSnapshotV1 | undefined };\n\tkeybindings: KeybindingsManager;\n\tthemeController: InteractiveThemeController;\n\n\t// UI surfaces.\n\tui: TUI;\n\teditor: EditorComponent;\n\teditorContainer: Container;\n\tchatContainer: Container;\n\tpendingMessagesContainer: Container;\n\n\t// Mutable mode state the handler bodies read or write.\n\tbuiltInHeader: Component | undefined;\n\ttoolOutputExpanded: boolean;\n\thideThinkingBlock: boolean;\n\toutputPad: number;\n\tbashComponent: BashExecutionComponent | undefined;\n\tpendingBashComponents: BashExecutionComponent[];\n\n\t// Status, dialog, and rebuild helpers.\n\tshowStatus(message: string): void;\n\tshowError(message: string): void;\n\tshowWarning(message: string): void;\n\tclearStatusIndicator(): void;\n\tresetDialogUI(): void;\n\trebuildChatFromMessages(): void;\n\tapplyRuntimeSettings(): void;\n\tsetupAutocompleteProvider(): void;\n\tshowLoadedResources(options?: { force?: boolean; showDiagnosticsWhenQuiet?: boolean }): void;\n\tshowDialogConfirm(title: string, message: string): Promise<boolean>;\n\tpromptForMissingSessionCwd(error: MissingSessionCwdError): Promise<string | undefined>;\n\thandleFatalRuntimeError(title: string, error: unknown): Promise<void>;\n\tgetMarkdownThemeWithSettings(): MarkdownTheme;\n\t/** Daxnuts easter-egg render; resolved through the host so instance-level\n\t * overrides keep working (original called this.handleDaxnuts()). */\n\thandleDaxnuts(): void;\n}\n\nexport interface CommandDispatchEntry {\n\t/** Command word including the leading slash, e.g. \"/model\". */\n\tcommand: string;\n\t/**\n\t * Slice offset of the optional argument for prefix commands\n\t * (\"/model claude\" -> text.slice(7).trim()); omit for exact-match commands.\n\t */\n\targOffset?: number;\n\t/** Report a blank (empty after trim) argument as undefined. */\n\tblankArgToUndefined?: boolean;\n\t/** Clear the editor text before running the handler instead of after. */\n\tclearEditorBeforeRun?: boolean;\n\t/** Handler; receives the full submitted text and the extracted argument. */\n\trun: (host: CommandDispatchHost, text: string, arg: string | undefined) => Promise<void> | void;\n}\n\nexport interface CommandDispatchMatch {\n\tentry: CommandDispatchEntry;\n\targ: string | undefined;\n}\n\nexport const COMMAND_DISPATCH_ENTRIES: readonly CommandDispatchEntry[] = [\n\t{\n\t\tcommand: \"/settings\",\n\t\trun: (host) => {\n\t\t\thost.showSettingsSelector();\n\t\t},\n\t},\n\t{\n\t\tcommand: \"/scoped-models\",\n\t\tclearEditorBeforeRun: true,\n\t\trun: async (host) => {\n\t\t\tawait host.showModelsSelector();\n\t\t},\n\t},\n\t{\n\t\tcommand: \"/model\",\n\t\targOffset: 7,\n\t\tclearEditorBeforeRun: true,\n\t\trun: (host, _text, arg) => host.handleModelCommand(arg),\n\t},\n\t{\n\t\tcommand: \"/thinking\",\n\t\targOffset: 10,\n\t\tclearEditorBeforeRun: true,\n\t\trun: (host, _text, arg) => {\n\t\t\thost.handleThinkingCommand(arg);\n\t\t},\n\t},\n\t{\n\t\tcommand: \"/suite\",\n\t\targOffset: 7,\n\t\tblankArgToUndefined: true,\n\t\tclearEditorBeforeRun: true,\n\t\trun: (host, _text, arg) => {\n\t\t\thost.handleSuiteCommand(arg);\n\t\t},\n\t},\n\t// /export, /import and /name are prefix commands whose handlers parse the\n\t// full text themselves; argOffset only enables prefix matching here.\n\t{ command: \"/export\", argOffset: 8, run: (host, text) => host.handleExportCommand(text) },\n\t{ command: \"/import\", argOffset: 8, run: (host, text) => host.handleImportCommand(text) },\n\t{ command: \"/copy\", run: (host) => host.handleCopyCommand() },\n\t{\n\t\tcommand: \"/name\",\n\t\targOffset: 6,\n\t\trun: (host, text) => {\n\t\t\thost.handleNameCommand(text);\n\t\t},\n\t},\n\t{\n\t\tcommand: \"/session\",\n\t\trun: (host) => {\n\t\t\thost.handleSessionCommand();\n\t\t},\n\t},\n\t// Interrupt grading (设计 子代理运行时 §4.2, 2026-10-02): the only explicit\n\t// face for terminating background subagents — Esc never cancels them.\n\t{\n\t\tcommand: \"/stop-agents\",\n\t\trun: (host) => {\n\t\t\thost.handleStopAgentsCommand();\n\t\t},\n\t},\n\t{\n\t\tcommand: \"/metrics\",\n\t\targOffset: 9,\n\t\tblankArgToUndefined: true,\n\t\tclearEditorBeforeRun: true,\n\t\trun: (host, _text, arg) => {\n\t\t\thost.handleMetricsCommand(arg);\n\t\t},\n\t},\n\t{\n\t\tcommand: \"/changelog\",\n\t\trun: (host) => {\n\t\t\thost.handleChangelogCommand();\n\t\t},\n\t},\n\t{\n\t\tcommand: \"/help\",\n\t\trun: (host) => {\n\t\t\thost.handleHelpCommand();\n\t\t},\n\t},\n\t{\n\t\tcommand: \"/hotkeys\",\n\t\trun: (host) => {\n\t\t\thost.handleHotkeysCommand();\n\t\t},\n\t},\n\t{\n\t\tcommand: \"/fork\",\n\t\trun: (host) => {\n\t\t\thost.showUserMessageSelector();\n\t\t},\n\t},\n\t{ command: \"/clone\", clearEditorBeforeRun: true, run: (host) => host.handleCloneCommand() },\n\t{\n\t\tcommand: \"/tree\",\n\t\trun: (host) => {\n\t\t\thost.showTreeSelector();\n\t\t},\n\t},\n\t{\n\t\tcommand: \"/login\",\n\t\targOffset: 7,\n\t\tclearEditorBeforeRun: true,\n\t\trun: (host, _text, arg) => host.handleLoginCommand(arg),\n\t},\n\t// Original branch does not await showOAuthSelector; keep it fire-and-forget.\n\t{\n\t\tcommand: \"/logout\",\n\t\trun: (host) => {\n\t\t\tvoid host.showOAuthSelector(\"logout\");\n\t\t},\n\t},\n\t{ command: \"/new\", clearEditorBeforeRun: true, run: (host) => host.handleClearCommand() },\n\t{\n\t\tcommand: \"/compact\",\n\t\targOffset: 9,\n\t\tclearEditorBeforeRun: true,\n\t\trun: (host, _text, arg) => host.handleCompactCommand(arg),\n\t},\n\t{\n\t\tcommand: \"/clean-sessions\",\n\t\targOffset: 16,\n\t\tblankArgToUndefined: true,\n\t\tclearEditorBeforeRun: true,\n\t\trun: (host, _text, arg) => host.handleCleanSessionsCommand(arg),\n\t},\n\t{ command: \"/reload\", clearEditorBeforeRun: true, run: (host) => host.handleReloadCommand() },\n\t{\n\t\tcommand: \"/debug\",\n\t\trun: (host) => {\n\t\t\thost.handleDebugCommand();\n\t\t},\n\t},\n\t{\n\t\tcommand: \"/arminsayshi\",\n\t\trun: (host) => {\n\t\t\thost.handleArminSaysHi();\n\t\t},\n\t},\n\t{\n\t\tcommand: \"/resume\",\n\t\trun: (host) => {\n\t\t\thost.showSessionSelector();\n\t\t},\n\t},\n\t// Read-only subagent session browser (view-family command: sync, no editor\n\t// clearing), grouped with /resume ahead of the /workflow view overlay.\n\t{\n\t\tcommand: \"/agents\",\n\t\trun: (host) => {\n\t\t\thost.showAgentsView();\n\t\t},\n\t},\n\t// Follow-up queue face (single-entry iron law: /queue replaces the shipped\n\t// ctrl+q default). A bare /queue prints usage — the editor buffer is\n\t// cleared on submit before the command runs, so there is no editor\n\t// content to queue (the configurable keybinding keeps that behavior).\n\t{\n\t\tcommand: \"/queue\",\n\t\targOffset: 7,\n\t\tblankArgToUndefined: true,\n\t\trun: (host, _text, arg) => host.handleQueueCommand(arg),\n\t},\n\t{ command: \"/dequeue\", run: (host) => host.handleDequeueCommand() },\n\t// Queue manager overlay (single entry point: the /queue-list command;\n\t// reorder/remove/restore are in-component keys of the overlay itself).\n\t{ command: \"/queue-list\", run: (host) => host.handleQueueListCommand() },\n\t{ command: \"/editor\", run: (host) => host.handleEditorCommand() },\n\t{ command: \"/quit\", clearEditorBeforeRun: true, run: (host) => host.shutdown() },\n\t// Exact-match only: every other /workflow subcommand (why/log/...) keeps\n\t// flowing to the plugin's text command path untouched (§9 L2).\n\t{\n\t\tcommand: \"/workflow view\",\n\t\trun: (host) => {\n\t\t\thost.showWorkflowView();\n\t\t},\n\t},\n];\n\n/** Find the entry matching text: exact command, or command prefix plus argument. */\nexport function matchCommandDispatchEntry(\n\tentries: readonly CommandDispatchEntry[],\n\ttext: string,\n): CommandDispatchMatch | undefined {\n\tfor (const entry of entries) {\n\t\tif (text === entry.command) {\n\t\t\treturn { entry, arg: undefined };\n\t\t}\n\t\tif (entry.argOffset === undefined || !text.startsWith(`${entry.command} `)) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst arg = text.slice(entry.argOffset).trim();\n\t\treturn { entry, arg: entry.blankArgToUndefined && arg.length === 0 ? undefined : arg };\n\t}\n\treturn undefined;\n}\n\n/** Minimal command shape the completion filter works on (mirrors SlashCommand). */\nexport interface CompletionCommandInput {\n\treadonly name: string;\n\treadonly description: string;\n\treadonly argumentHint?: string;\n}\n\n/**\n * Capability commands that collide with a builtin, prompt-template, or skill\n * command name are rejected by AgentSession at invocation time rather than\n * silently resolving to one source, so the colliding capability command is\n * withheld from the completion list entirely (both sides stay executable via\n * their own paths; neither is offered as an ambiguous completion).\n */\nexport function filterCapabilityCommandsForCompletions(\n\tcapabilityCommands: readonly CompletionCommandInput[],\n\treservedNames: readonly Iterable<string>[],\n): CompletionCommandInput[] {\n\tconst reserved = new Set<string>();\n\tfor (const names of reservedNames) for (const name of names) reserved.add(name);\n\treturn capabilityCommands\n\t\t.filter((command) => !reserved.has(command.name))\n\t\t.map((command) => ({\n\t\t\tname: command.name,\n\t\t\tdescription: command.description,\n\t\t\t...(command.argumentHint !== undefined ? { argumentHint: command.argumentHint } : {}),\n\t\t}));\n}\n\n/**\n * Rebuilds real Theme instances from the resource loader's ThemeMetaV1\n * projection for the theme registry (B-S2b v1). Registration points\n * (constructor, runtime session start, reload) need loadable instances —\n * setRegisteredThemes stores what it is given and getThemeByName returns the\n * registered instance first — while the loader surface now projects only\n * metadata. Re-loading is synchronous and deterministic per sourcePath;\n * theme names come from the same JSON the loader parsed, so meta.name ===\n * Theme.name and the registry keeps its own name-filter/dedupe semantics.\n *\n * Contract: a meta without a sourcePath (or one whose file no longer parses)\n * throws — themesOverride host inputs must always carry a loadable\n * sourcePath. This adds one extra parse per theme at registration time\n * (constructor / session start / reload, not per turn).\n *\n * Re-exported from ./interactive-mode.ts for existing consumers of that module.\n */\nexport function buildRegisteredThemes(themes: readonly ThemeMetaV1[]): Theme[] {\n\treturn themes.map((meta) => loadThemeFromPath(meta.sourcePath));\n}\n\nexport async function handleReloadCommand(host: CommandHandlersHost): Promise<void> {\n\tif (host.facade.isStreaming()) {\n\t\thost.showWarning(t(\"Wait for the current response to finish before reloading.\"));\n\t\treturn;\n\t}\n\tif (host.facade.isCompacting()) {\n\t\thost.showWarning(t(\"Wait for compaction to finish before reloading.\"));\n\t\treturn;\n\t}\n\n\thost.resetDialogUI();\n\n\tconst reloadBox = new Container();\n\tconst borderColor = (s: string) => theme.fg(\"border\", s);\n\treloadBox.addChild(new DynamicBorder(borderColor));\n\treloadBox.addChild(new Spacer(1));\n\treloadBox.addChild(\n\t\tnew Text(theme.fg(\"muted\", t(\"Reloading keybindings, skills, prompts, themes, and context files...\")), 1, 0),\n\t);\n\treloadBox.addChild(new Spacer(1));\n\treloadBox.addChild(new DynamicBorder(borderColor));\n\n\tconst previousEditor = host.editor;\n\thost.editorContainer.clear();\n\thost.editorContainer.addChild(reloadBox);\n\thost.ui.setFocus(reloadBox);\n\thost.ui.requestRender(true);\n\tawait new Promise((resolve) => process.nextTick(resolve));\n\n\tconst dismissReloadBox = (editor: Component) => {\n\t\thost.editorContainer.clear();\n\t\thost.editorContainer.addChild(editor);\n\t\thost.ui.setFocus(editor);\n\t\thost.ui.requestRender();\n\t};\n\n\tlet chatRestoredBeforeSessionStart = false;\n\tlet reloadBoxDismissed = false;\n\tconst restoreChatBeforeSessionStart = () => {\n\t\tif (chatRestoredBeforeSessionStart) {\n\t\t\treturn;\n\t\t}\n\t\thost.hideThinkingBlock = host.settingsManager.getHideThinkingBlock();\n\t\thost.outputPad = host.settingsManager.getOutputPad();\n\t\thost.rebuildChatFromMessages();\n\t\tchatRestoredBeforeSessionStart = true;\n\t};\n\n\ttry {\n\t\tawait host.facade.reload({ beforeSessionStart: restoreChatBeforeSessionStart });\n\t\trestoreChatBeforeSessionStart();\n\t\thost.keybindings.reload();\n\t\tconst activeHeader = host.builtInHeader;\n\t\tif (isExpandable(activeHeader)) {\n\t\t\tactiveHeader.setExpanded(host.toolOutputExpanded);\n\t\t}\n\t\tsetRegisteredThemes(buildRegisteredThemes(host.facade.getThemes().themes));\n\t\thost.applyRuntimeSettings();\n\t\tawait host.themeController.applyFromSettings();\n\t\thost.setupAutocompleteProvider();\n\t\thost.showLoadedResources({\n\t\t\tforce: false,\n\t\t\tshowDiagnosticsWhenQuiet: true,\n\t\t});\n\t\tconst modelsJsonError = host.facade.getModelsError();\n\t\tif (modelsJsonError) {\n\t\t\thost.showError(t(\"models.json error: {error}\", { error: modelsJsonError }));\n\t\t}\n\t\thost.showStatus(t(\"Reloaded keybindings, skills, prompts, themes, and context files\"));\n\t\tdismissReloadBox(host.editor as Component);\n\t\treloadBoxDismissed = true;\n\t} catch (error) {\n\t\t// v8 ignore next -- reloadBoxDismissed 置位后 catch 前无可抛出点,恒走 dismiss 分支\n\t\tif (!reloadBoxDismissed) {\n\t\t\tdismissReloadBox(previousEditor as Component);\n\t\t}\n\t\thost.showError(t(\"Reload failed: {error}\", { error: error instanceof Error ? error.message : String(error) }));\n\t}\n}\n\nexport async function handleExportCommand(host: CommandHandlersHost, text: string): Promise<void> {\n\tconst outputPath = getPathCommandArgument(text, \"/export\");\n\n\ttry {\n\t\tif (outputPath?.endsWith(\".jsonl\")) {\n\t\t\tconst filePath = host.facade.exportToJsonl(outputPath);\n\t\t\thost.showStatus(t(\"Session exported to: {path}\", { path: filePath }));\n\t\t} else {\n\t\t\tconst filePath = await host.facade.exportToHtml(outputPath, {\n\t\t\t\tthemeName: theme.name,\n\t\t\t});\n\t\t\thost.showStatus(t(\"Session exported to: {path}\", { path: filePath }));\n\t\t}\n\t} catch (error: unknown) {\n\t\thost.showError(\n\t\t\tt(\"Failed to export session: {error}\", {\n\t\t\t\terror: error instanceof Error ? error.message : t(\"Unknown error\"),\n\t\t\t}),\n\t\t);\n\t}\n}\n\nexport function getPathCommandArgument(text: string, command: \"/export\" | \"/import\"): string | undefined {\n\tif (text === command) {\n\t\treturn undefined;\n\t}\n\tif (!text.startsWith(`${command} `)) {\n\t\treturn undefined;\n\t}\n\n\tconst argsString = text.slice(command.length + 1).trimStart();\n\tif (!argsString) {\n\t\treturn undefined;\n\t}\n\n\tconst firstChar = argsString[0];\n\tif (firstChar === '\"' || firstChar === \"'\") {\n\t\tconst closingQuoteIndex = argsString.indexOf(firstChar, 1);\n\t\tif (closingQuoteIndex < 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn argsString.slice(1, closingQuoteIndex);\n\t}\n\n\tconst firstWhitespaceIndex = argsString.search(/\\s/);\n\tif (firstWhitespaceIndex < 0) {\n\t\treturn argsString;\n\t}\n\treturn argsString.slice(0, firstWhitespaceIndex);\n}\n\nexport async function handleImportCommand(host: CommandHandlersHost, text: string): Promise<void> {\n\tconst inputPath = getPathCommandArgument(text, \"/import\");\n\tif (!inputPath) {\n\t\thost.showError(t(\"Usage: /import <path.jsonl>\"));\n\t\treturn;\n\t}\n\n\tconst confirmed = await host.showDialogConfirm(\n\t\tt(\"Import session\"),\n\t\tt(\"Replace current session with {path}?\", { path: inputPath }),\n\t);\n\tif (!confirmed) {\n\t\thost.showStatus(t(\"Import cancelled\"));\n\t\treturn;\n\t}\n\n\ttry {\n\t\thost.clearStatusIndicator();\n\t\tconst result = await host.runtimeFacade.importFromJsonl(inputPath);\n\t\tif (result.cancelled) {\n\t\t\thost.showStatus(t(\"Import cancelled\"));\n\t\t\treturn;\n\t\t}\n\t\thost.showStatus(t(\"Session imported from: {path}\", { path: inputPath }));\n\t} catch (error: unknown) {\n\t\tif (error instanceof MissingSessionCwdError) {\n\t\t\tconst selectedCwd = await host.promptForMissingSessionCwd(error);\n\t\t\tif (!selectedCwd) {\n\t\t\t\thost.showStatus(t(\"Import cancelled\"));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst result = await host.runtimeFacade.importFromJsonl(inputPath, selectedCwd);\n\t\t\tif (result.cancelled) {\n\t\t\t\thost.showStatus(t(\"Import cancelled\"));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\thost.showStatus(t(\"Session imported from: {path}\", { path: inputPath }));\n\t\t\treturn;\n\t\t}\n\t\tif (error instanceof SessionImportFileNotFoundError) {\n\t\t\thost.showError(t(\"Failed to import session: {error}\", { error: error.message }));\n\t\t\treturn;\n\t\t}\n\t\tawait host.handleFatalRuntimeError(t(\"Failed to import session\"), error);\n\t}\n}\n\nexport async function handleCopyCommand(\n\thost: CommandHandlersHost,\n\toptions: { flashConfirmation?: boolean; preferSelection?: boolean } = {},\n): Promise<void> {\n\tif (\n\t\toptions.preferSelection &&\n\t\thost.ui instanceof TuiAltScreen &&\n\t\t!host.ui.getCopyOnSelect() &&\n\t\thost.ui.hasActiveSelection()\n\t) {\n\t\tawait host.ui.copyActiveSelectionToClipboard();\n\t\treturn;\n\t}\n\n\tconst text = host.facade.getLastAssistantText();\n\tif (!text) {\n\t\thost.showError(t(\"No agent messages to copy yet.\"));\n\t\treturn;\n\t}\n\n\ttry {\n\t\tawait copyToClipboard(text);\n\t\tif (options.flashConfirmation && host.ui instanceof TuiAltScreen) {\n\t\t\thost.ui.flash(t(\"Copied!\"));\n\t\t} else {\n\t\t\thost.showStatus(t(\"Copied last agent message to clipboard\"));\n\t\t}\n\t} catch (error) {\n\t\thost.showError(error instanceof Error ? error.message : String(error));\n\t}\n}\n\nexport function handleNameCommand(host: CommandHandlersHost, text: string): void {\n\tconst name = text.replace(/^\\/name\\s*/, \"\").trim();\n\tif (!name) {\n\t\tconst currentName = host.facade.getSessionName();\n\t\tif (currentName) {\n\t\t\thost.chatContainer.addChild(new Spacer(1));\n\t\t\thost.chatContainer.addChild(new Text(theme.fg(\"dim\", t(\"Session name: {name}\", { name: currentName })), 1, 0));\n\t\t} else {\n\t\t\thost.showWarning(t(\"Usage: /name <name>\"));\n\t\t}\n\t\thost.ui.requestRender();\n\t\treturn;\n\t}\n\n\thost.facade.setSessionName(name);\n\tconst sessionName = host.facade.getSessionName();\n\tif (sessionName !== name) {\n\t\thost.showWarning(\n\t\t\tt(\"Session name was normalized from {from} to {to}\", {\n\t\t\t\tfrom: JSON.stringify(name),\n\t\t\t\tto: JSON.stringify(sessionName),\n\t\t\t}),\n\t\t);\n\t}\n\thost.chatContainer.addChild(new Spacer(1));\n\thost.chatContainer.addChild(\n\t\tnew Text(theme.fg(\"dim\", t(\"Session name set: {name}\", { name: sessionName ?? name })), 1, 0),\n\t);\n\thost.ui.requestRender();\n}\n\n/**\n * 中断分级(设计 子代理运行时 §4.2,2026-10-02):/stop-agents 的唯一执行\n * 面——终止全部后台子代理(不触当前回合)。Esc 从不做这件事。\n */\nexport function handleStopAgentsCommand(host: CommandHandlersHost): void {\n\tconst active = host.facade.getActiveAgentTaskCount();\n\tif (active === 0) {\n\t\thost.showStatus(t(\"No background subagents running\"));\n\t\treturn;\n\t}\n\thost.facade.abortAgentTasks();\n\thost.showStatus(\n\t\tactive === 1\n\t\t\t? t(\"Terminated {count} background subagent\", { count: active })\n\t\t\t: t(\"Terminated {count} background subagents\", { count: active }),\n\t);\n}\n\nexport function handleSessionCommand(host: CommandHandlersHost): void {\n\tconst stats = host.facade.getSessionStats();\n\tconst sessionName = host.facade.getSessionName();\n\tconst entries = host.facade.getEntries();\n\tconst cacheWaste = computeCacheWaste(entries, host.facade.getModelPriceSource());\n\n\t// Cost/token totals per provider/model actually used (e.g. OpenRouter `auto`\n\t// resolves to a concrete responseModel). Usage without model attribution is\n\t// grouped separately so the breakdown reconciles with the session total.\n\tconst usageBreakdown = getUsageCostBreakdown(entries);\n\n\tlet info = `${theme.bold(t(\"Session Info\"))}\\n\\n`;\n\tif (sessionName) {\n\t\tinfo += `${theme.fg(\"dim\", t(\"Name:\"))} ${sessionName}\\n`;\n\t}\n\tinfo += `${theme.fg(\"dim\", t(\"File:\"))} ${stats.sessionFile ?? t(\"In-memory\")}\\n`;\n\tinfo += `${theme.fg(\"dim\", t(\"ID:\"))} ${stats.sessionId}\\n\\n`;\n\tinfo += `${theme.bold(t(\"Messages\"))}\\n`;\n\tinfo += `${theme.fg(\"dim\", t(\"Total:\"))} ${stats.totalMessages}\\n`;\n\tinfo += `${theme.fg(\"dim\", t(\"User:\"))} ${stats.userMessages}\\n`;\n\tinfo += `${theme.fg(\"dim\", t(\"Assistant:\"))} ${stats.assistantMessages}\\n`;\n\tinfo += `${theme.fg(\"dim\", t(\"Tools:\"))} ${t(\"{calls} calls, {results} results\", {\n\t\tcalls: stats.toolCalls,\n\t\tresults: stats.toolResults,\n\t})}\\n\\n`;\n\tinfo += `${theme.bold(t(\"Tokens\"))}\\n`;\n\t// \"Input\" is the full prompt volume. With cache activity, split it into\n\t// cached (served from cache) vs uncached (everything else) - the only\n\t// provider-independent split. Cache writes, where reported, are a detail\n\t// of the uncached portion.\n\tconst { input, cacheRead, cacheWrite } = stats.tokens;\n\tconst promptTokens = input + cacheRead + cacheWrite;\n\tinfo += `${theme.fg(\"dim\", t(\"Input:\"))} ${promptTokens.toLocaleString()}\\n`;\n\tif (promptTokens > 0 && (cacheRead > 0 || cacheWrite > 0)) {\n\t\tconst hitRate = theme.fg(\"dim\", `(${((cacheRead / promptTokens) * 100).toFixed(1)}%)`);\n\t\tinfo += ` ${theme.fg(\"dim\", t(\"Cached:\"))} ${cacheRead.toLocaleString()} ${hitRate}\\n`;\n\t\tconst written =\n\t\t\tcacheWrite > 0\n\t\t\t\t? ` ${theme.fg(\"dim\", t(\"({count} written to cache)\", { count: cacheWrite.toLocaleString() }))}`\n\t\t\t\t: \"\";\n\t\tinfo += ` ${theme.fg(\"dim\", t(\"Uncached:\"))} ${(input + cacheWrite).toLocaleString()}${written}\\n`;\n\t}\n\tinfo += `${theme.fg(\"dim\", t(\"Output:\"))} ${stats.tokens.output.toLocaleString()}\\n`;\n\tinfo += `${theme.fg(\"dim\", t(\"Total:\"))} ${stats.tokens.total.toLocaleString()}\\n`;\n\n\t// 双维度统计(用户裁决 2026-09-25):总计之外按供应商/模型分桶——缓存读/写、\n\t// 命中率、费用逐桶可见。此前该拆分门控在 cost>0 且多桶才渲染,单价为 0 的\n\t// 自定义供应商(如自建代理)永远看不到。\n\tif (usageBreakdown.length > 0) {\n\t\tinfo += `\\n${theme.bold(t(\"By Provider/Model\"))}\\n`;\n\t\tfor (const entry of usageBreakdown) {\n\t\t\tconst bucket = entry.totals;\n\t\t\tconst promptBucket = bucket.input + bucket.cacheRead + bucket.cacheWrite;\n\t\t\tlet line = ` ${theme.bold(entry.key)}`;\n\t\t\tif (promptBucket > 0) {\n\t\t\t\tline += `\\n ${theme.fg(\"dim\", t(\"Input:\"))} ${promptBucket.toLocaleString()}`;\n\t\t\t\tif (bucket.cacheRead > 0 || bucket.cacheWrite > 0) {\n\t\t\t\t\tconst rate = promptBucket > 0 ? ((bucket.cacheRead / promptBucket) * 100).toFixed(1) : \"0.0\";\n\t\t\t\t\tline += ` ${theme.fg(\"dim\", t(\"(cache {rate}%, W {written})\", { rate, written: bucket.cacheWrite.toLocaleString() }))}`;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (bucket.output > 0) line += `\\n ${theme.fg(\"dim\", t(\"Output:\"))} ${bucket.output.toLocaleString()}`;\n\t\t\tif (entry.cost > 0) line += ` ${theme.fg(\"dim\", `$${entry.cost.toFixed(3)}`)}`;\n\t\t\tinfo += `${line}\\n`;\n\t\t}\n\t}\n\n\tif (stats.cost > 0 || cacheWaste.missedTokens > 0) {\n\t\tinfo += `\\n${theme.bold(t(\"Cost\"))}\\n`;\n\t\tinfo += `${theme.fg(\"dim\", t(\"Total:\"))} $${stats.cost.toFixed(3)}`;\n\t\tif (usageBreakdown.length > 1) {\n\t\t\tfor (const entry of usageBreakdown) {\n\t\t\t\tinfo += `\\n ${theme.fg(\"dim\", `${entry.key}:`)} $${entry.cost.toFixed(3)} ${theme.fg(\"dim\", t(\"({tokens} tokens)\", { tokens: formatTokens(entry.tokens) }))}`;\n\t\t\t}\n\t\t}\n\t\tif (cacheWaste.missedTokens > 0) {\n\t\t\tconst missLabel =\n\t\t\t\tcacheWaste.missCount === 1\n\t\t\t\t\t? t(\"{count} miss\", { count: cacheWaste.missCount })\n\t\t\t\t\t: t(\"{count} misses\", { count: cacheWaste.missCount });\n\t\t\tconst detail = t(\"{tokens} tokens, {misses}\", {\n\t\t\t\ttokens: cacheWaste.missedTokens.toLocaleString(),\n\t\t\t\tmisses: missLabel,\n\t\t\t});\n\t\t\tinfo +=\n\t\t\t\tcacheWaste.missedCost >= 0.0001\n\t\t\t\t\t? `\\n${theme.fg(\"dim\", t(\"Cache Re-billed:\"))} $${cacheWaste.missedCost.toFixed(3)} ${theme.fg(\"dim\", `(${detail})`)}`\n\t\t\t\t\t: `\\n${theme.fg(\"dim\", t(\"Cache Re-billed:\"))} ${detail}`;\n\t\t}\n\t}\n\n\thost.chatContainer.addChild(new Spacer(1));\n\thost.chatContainer.addChild(new Text(info, 1, 0));\n\thost.ui.requestRender();\n}\n\nexport function handleMetricsCommand(host: CommandHandlersHost, turnsArg: string | undefined): void {\n\tconst provider = host.options.getMetrics;\n\tif (!provider) {\n\t\thost.showWarning(t(\"Metrics are not available: the observability plugin is not mounted in this session\"));\n\t\treturn;\n\t}\n\n\tlet windowTurns: number | undefined;\n\tif (turnsArg !== undefined) {\n\t\tconst parsed = Number.parseInt(turnsArg, 10);\n\t\tif (!Number.isSafeInteger(parsed) || parsed < 1) {\n\t\t\thost.showWarning(t(\"Invalid turns: {turns}. Usage: /metrics [turns]\", { turns: turnsArg }));\n\t\t\treturn;\n\t\t}\n\t\twindowTurns = parsed;\n\t}\n\n\tlet snapshot: MetricsSnapshotV1;\n\ttry {\n\t\tconst result = provider({ windowTurns });\n\t\tif (result === undefined) {\n\t\t\thost.showWarning(t(\"Metrics are not available: the observability plugin is not mounted in this session\"));\n\t\t\treturn;\n\t\t}\n\t\tsnapshot = result;\n\t} catch (error) {\n\t\thost.showError(error instanceof Error ? error.message : String(error));\n\t\treturn;\n\t}\n\n\thost.chatContainer.addChild(new Spacer(1));\n\thost.chatContainer.addChild(new Text(formatMetricsSnapshot(snapshot), 1, 0));\n\thost.ui.requestRender();\n}\n\nexport function handleChangelogCommand(host: CommandHandlersHost): void {\n\tconst changelogPath = getChangelogPath();\n\tconst allEntries = parseChangelog(changelogPath);\n\n\tconst changelogMarkdown =\n\t\tallEntries.length > 0\n\t\t\t? allEntries\n\t\t\t\t\t.reverse()\n\t\t\t\t\t.map((e) => normalizeChangelogLinks(e.content, e))\n\t\t\t\t\t.join(\"\\n\\n\")\n\t\t\t: t(\"No changelog entries found.\");\n\n\thost.chatContainer.addChild(new Spacer(1));\n\thost.chatContainer.addChild(new DynamicBorder());\n\thost.chatContainer.addChild(new Text(theme.bold(theme.fg(\"accent\", t(\"What's New\"))), 1, 0));\n\thost.chatContainer.addChild(new Spacer(1));\n\thost.chatContainer.addChild(new Markdown(changelogMarkdown, 1, 1, host.getMarkdownThemeWithSettings()));\n\thost.chatContainer.addChild(new DynamicBorder());\n\thost.ui.requestRender();\n}\n\n/**\n * Get capitalized display string for an app keybinding action.\n */\nexport function getAppKeyDisplay(action: AppKeybinding): string {\n\treturn keyDisplayText(action);\n}\n\n/**\n * Get capitalized display string for an editor keybinding action.\n */\nexport function getEditorKeyDisplay(action: Keybinding): string {\n\treturn keyDisplayText(action);\n}\n\nexport function handleHelpCommand(host: CommandHandlersHost): void {\n\tconst section = (title: string, rows: Array<{ name: string; hint?: string; description?: string }>) => {\n\t\tif (rows.length === 0) return \"\";\n\t\tlet table = `\\n**${title}**\\n| ${t(\"Command\")} | ${t(\"Description\")} |\\n|---------|-------------|\\n`;\n\t\tfor (const row of rows) {\n\t\t\tconst command = row.hint ? `\\`/${row.name} ${row.hint}\\`` : `\\`/${row.name}\\``;\n\t\t\ttable += `| ${command} | ${row.description ?? \"\"} |\\n`;\n\t\t}\n\t\treturn table;\n\t};\n\n\tconst builtinRows = BUILTIN_SLASH_COMMANDS.map((command) => ({\n\t\tname: command.name,\n\t\thint: command.argumentHint,\n\t\tdescription: command.description,\n\t}));\n\tconst promptRows = host.facade.getPromptTemplates().map((template) => ({\n\t\tname: template.name,\n\t\thint: template.argumentHint,\n\t\tdescription: template.description,\n\t}));\n\tconst skillRows = host.facade.getSkills().skills.map((skill) => ({\n\t\tname: `skill:${skill.name}`,\n\t\tdescription: skill.description,\n\t}));\n\n\tconst help =\n\t\tsection(t(\"Built-in commands\"), builtinRows) +\n\t\tsection(t(\"Prompt templates\"), promptRows) +\n\t\tsection(t(\"Skills\"), skillRows) +\n\t\t`\\n${t(\"Type `/` for autocomplete. Use `/hotkeys` for keyboard shortcuts.\")}`;\n\n\thost.chatContainer.addChild(new Spacer(1));\n\thost.chatContainer.addChild(new DynamicBorder());\n\thost.chatContainer.addChild(new Text(theme.bold(theme.fg(\"accent\", t(\"Available Commands\"))), 1, 0));\n\thost.chatContainer.addChild(new Markdown(help.trim(), 1, 1, host.getMarkdownThemeWithSettings()));\n\thost.chatContainer.addChild(new DynamicBorder());\n\thost.ui.requestRender();\n}\n\nexport function handleHotkeysCommand(host: CommandHandlersHost): void {\n\t// Navigation keybindings\n\tconst cursorUp = getEditorKeyDisplay(\"tui.editor.cursorUp\");\n\tconst cursorDown = getEditorKeyDisplay(\"tui.editor.cursorDown\");\n\tconst cursorLeft = getEditorKeyDisplay(\"tui.editor.cursorLeft\");\n\tconst cursorRight = getEditorKeyDisplay(\"tui.editor.cursorRight\");\n\tconst cursorWordLeft = getEditorKeyDisplay(\"tui.editor.cursorWordLeft\");\n\tconst cursorWordRight = getEditorKeyDisplay(\"tui.editor.cursorWordRight\");\n\tconst cursorLineStart = getEditorKeyDisplay(\"tui.editor.cursorLineStart\");\n\tconst cursorLineEnd = getEditorKeyDisplay(\"tui.editor.cursorLineEnd\");\n\tconst jumpForward = getEditorKeyDisplay(\"tui.editor.jumpForward\");\n\tconst jumpBackward = getEditorKeyDisplay(\"tui.editor.jumpBackward\");\n\tconst pageUp = getEditorKeyDisplay(\"tui.editor.pageUp\");\n\tconst pageDown = getEditorKeyDisplay(\"tui.editor.pageDown\");\n\n\t// Editing keybindings\n\tconst submit = getEditorKeyDisplay(\"tui.input.submit\");\n\tconst newLine = getEditorKeyDisplay(\"tui.input.newLine\");\n\tconst deleteWordBackward = getEditorKeyDisplay(\"tui.editor.deleteWordBackward\");\n\tconst deleteWordForward = getEditorKeyDisplay(\"tui.editor.deleteWordForward\");\n\tconst deleteToLineStart = getEditorKeyDisplay(\"tui.editor.deleteToLineStart\");\n\tconst deleteToLineEnd = getEditorKeyDisplay(\"tui.editor.deleteToLineEnd\");\n\tconst yank = getEditorKeyDisplay(\"tui.editor.yank\");\n\tconst yankPop = getEditorKeyDisplay(\"tui.editor.yankPop\");\n\tconst undo = getEditorKeyDisplay(\"tui.editor.undo\");\n\tconst tab = getEditorKeyDisplay(\"tui.input.tab\");\n\n\t// App keybindings\n\tconst interrupt = getAppKeyDisplay(\"app.interrupt\");\n\tconst clear = getAppKeyDisplay(\"app.clear\");\n\tconst exit = getAppKeyDisplay(\"app.exit\");\n\tconst suspend = getAppKeyDisplay(\"app.suspend\");\n\tconst cycleThinkingLevel = getAppKeyDisplay(\"app.thinking.cycle\");\n\tconst cycleModelForward = getAppKeyDisplay(\"app.model.cycleForward\");\n\tconst selectModel = getAppKeyDisplay(\"app.model.select\");\n\tconst expandTools = getAppKeyDisplay(\"app.tools.expand\");\n\tconst toggleThinking = getAppKeyDisplay(\"app.thinking.toggle\");\n\tconst externalEditor = getAppKeyDisplay(\"app.editor.external\");\n\tconst cycleModelBackward = getAppKeyDisplay(\"app.model.cycleBackward\");\n\tconst copyMessage = getAppKeyDisplay(\"app.message.copy\");\n\tconst followUp = getAppKeyDisplay(\"app.message.followUp\");\n\tconst dequeue = getAppKeyDisplay(\"app.message.dequeue\");\n\tconst pasteImage = getAppKeyDisplay(\"app.clipboard.pasteImage\");\n\t// Iron law (2026-10-01): these shipped defaults were cleared in favor of\n\t// the /model command; the row only appears when a user re-configures a key.\n\tconst selectModelRow = selectModel ? `| \\`${selectModel}\\` | ${t(\"Open model selector\")} |\\n` : \"\";\n\t// Iron law (2026-10-02 复审): ctrl+g/ctrl+x stay bound only for the\n\t// components without a command channel — the main editor ignores them\n\t// (/editor and /copy are its single entries), so the rows say where\n\t// each key actually acts.\n\tconst copyMessageRow = copyMessage ? `| \\`${copyMessage}\\` | ${t(\"Copy selection in /tree\")} |\\n` : \"\";\n\tconst externalEditorRow = externalEditor\n\t\t? `| \\`${externalEditor}\\` | ${t(\"External editor (inside dialog inputs)\")} |\\n`\n\t\t: \"\";\n\t// Iron law (2026-10-01): the message queue is the /queue and /dequeue\n\t// commands' feature; rows only appear when a user re-configures a key.\n\tconst followUpRow = followUp ? `| \\`${followUp}\\` | ${t(\"Queue follow-up message\")} |\\n` : \"\";\n\tconst dequeueRow = dequeue ? `| \\`${dequeue}\\` | ${t(\"Restore queued messages\")} |\\n` : \"\";\n\tconst cycleThinkingRow = cycleThinkingLevel ? `| \\`${cycleThinkingLevel}\\` | ${t(\"Cycle thinking level\")} |\\n` : \"\";\n\tconst cycleModelsRow =\n\t\tcycleModelForward || cycleModelBackward\n\t\t\t? `| \\`${cycleModelForward}\\` / \\`${cycleModelBackward}\\` | ${t(\"Cycle models\")} |\\n`\n\t\t\t: \"\";\n\t// Suspend has no default key on native Windows; hide the row there.\n\tconst suspendRow = suspend ? `| \\`${suspend}\\` | ${t(\"Suspend to background\")} |\\n` : \"\";\n\n\tconst hotkeys = `\n**${t(\"Navigation\")}**\n| ${t(\"Key\")} | ${t(\"Action\")} |\n|-----|--------|\n| \\`${cursorUp}\\` / \\`${cursorDown}\\` / \\`${cursorLeft}\\` / \\`${cursorRight}\\` | ${t(\"Move cursor / browse history\")} |\n| \\`${cursorWordLeft}\\` / \\`${cursorWordRight}\\` | ${t(\"Move by word\")} |\n| \\`${cursorLineStart}\\` | ${t(\"Start of line\")} |\n| \\`${cursorLineEnd}\\` | ${t(\"End of line\")} |\n| \\`${jumpForward}\\` | ${t(\"Jump forward to character\")} |\n| \\`${jumpBackward}\\` | ${t(\"Jump backward to character\")} |\n| \\`${pageUp}\\` / \\`${pageDown}\\` | ${t(\"Scroll by page\")} |\n\n**${t(\"Editing\")}**\n| ${t(\"Key\")} | ${t(\"Action\")} |\n|-----|--------|\n| \\`${submit}\\` | ${t(\"Send message\")} |\n| \\`${newLine}\\` | ${process.platform === \"win32\" ? t(\"New line (Ctrl+Enter on Windows Terminal)\") : t(\"New line\")} |\n| \\`${deleteWordBackward}\\` | ${t(\"Delete word backwards\")} |\n| \\`${deleteWordForward}\\` | ${t(\"Delete word forwards\")} |\n| \\`${deleteToLineStart}\\` | ${t(\"Delete to start of line\")} |\n| \\`${deleteToLineEnd}\\` | ${t(\"Delete to end of line\")} |\n| \\`${yank}\\` | ${t(\"Paste the most-recently-deleted text\")} |\n| \\`${yankPop}\\` | ${t(\"Cycle through the deleted text after pasting\")} |\n| \\`${undo}\\` | ${t(\"Undo\")} |\n\n**${t(\"Other\")}**\n| ${t(\"Key\")} | ${t(\"Action\")} |\n|-----|--------|\n| \\`${tab}\\` | ${t(\"Path completion / accept autocomplete\")} |\n| \\`${interrupt}\\` | ${t(\"Cancel autocomplete / abort streaming\")} |\n| \\`${clear}\\` | ${t(\"Clear editor (first) / exit (second)\")} |\n| \\`${exit}\\` | ${t(\"Exit (when editor is empty)\")} |\n${suspendRow}${cycleThinkingRow}${cycleModelsRow}${selectModelRow}| \\`${expandTools}\\` | ${t(\"Toggle tool output expansion\")} |\n| \\`${toggleThinking}\\` | ${t(\"Toggle thinking block visibility\")} |\n${externalEditorRow}${copyMessageRow}${followUpRow}${dequeueRow}\n| \\`${pasteImage}\\` | ${t(\"Paste image or text from clipboard\")} |\n| \\`/\\` | ${t(\"Slash commands\")} |\n| \\`!\\` | ${t(\"Run bash command\")} |\n| \\`!!\\` | ${t(\"Run bash command (excluded from context)\")} |\n`;\n\n\thost.chatContainer.addChild(new Spacer(1));\n\thost.chatContainer.addChild(new DynamicBorder());\n\thost.chatContainer.addChild(new Text(theme.bold(theme.fg(\"accent\", t(\"Keyboard Shortcuts\"))), 1, 0));\n\thost.chatContainer.addChild(new Spacer(1));\n\thost.chatContainer.addChild(new Markdown(hotkeys.trim(), 1, 1, host.getMarkdownThemeWithSettings()));\n\thost.chatContainer.addChild(new DynamicBorder());\n\thost.ui.requestRender();\n}\n\nexport async function handleClearCommand(host: CommandHandlersHost): Promise<void> {\n\thost.clearStatusIndicator();\n\ttry {\n\t\tconst result = await host.runtimeFacade.newSession();\n\t\tif (result.cancelled) {\n\t\t\treturn;\n\t\t}\n\t\thost.chatContainer.addChild(new Spacer(1));\n\t\thost.chatContainer.addChild(new Text(`${theme.fg(\"accent\", t(\"✓ New session started\"))}`, 1, 1));\n\t\thost.ui.requestRender();\n\t} catch (error: unknown) {\n\t\tawait host.handleFatalRuntimeError(\"Failed to create session\", error);\n\t}\n}\n\nexport function handleDebugCommand(host: CommandHandlersHost): void {\n\tconst width = host.ui.terminal.columns;\n\tconst height = host.ui.terminal.rows;\n\tconst allLines = host.ui.render(width);\n\n\tconst debugLogPath = getDebugLogPath();\n\tconst debugData = [\n\t\tt(\"Debug output at {date}\", { date: new Date().toISOString() }),\n\t\tt(\"Terminal: {columns}x{rows}\", { columns: width, rows: height }),\n\t\tt(\"Total lines: {count}\", { count: allLines.length }),\n\t\t\"\",\n\t\tt(\"=== All rendered lines with visible widths ===\"),\n\t\t...allLines.map((line, idx) => {\n\t\t\tconst vw = visibleWidth(line);\n\t\t\tconst escaped = JSON.stringify(line);\n\t\t\treturn `[${idx}] (w=${vw}) ${escaped}`;\n\t\t}),\n\t\t\"\",\n\t\tt(\"=== Agent messages (JSONL) ===\"),\n\t\t...host.facade\n\t\t\t.getSessionAPI()\n\t\t\t.getMessages()\n\t\t\t.map((msg) => JSON.stringify(msg)),\n\t\t\"\",\n\t].join(\"\\n\");\n\n\tfs.mkdirSync(path.dirname(debugLogPath), { recursive: true });\n\tfs.writeFileSync(debugLogPath, debugData);\n\n\thost.chatContainer.addChild(new Spacer(1));\n\thost.chatContainer.addChild(\n\t\tnew Text(`${theme.fg(\"accent\", t(\"✓ Debug log written\"))}\\n${theme.fg(\"muted\", debugLogPath)}`, 1, 1),\n\t);\n\thost.ui.requestRender();\n}\n\nexport function handleArminSaysHi(host: CommandHandlersHost): void {\n\thost.chatContainer.addChild(new Spacer(1));\n\thost.chatContainer.addChild(new ArminComponent(host.ui));\n\thost.ui.requestRender();\n}\n\nexport function handleDaxnuts(host: CommandHandlersHost): void {\n\thost.chatContainer.addChild(new Spacer(1));\n\thost.chatContainer.addChild(new DaxnutsComponent(host.ui));\n\thost.ui.requestRender();\n}\n\n/** Host-visible for ./interactive-auth.ts (S5 slice 3). */\nexport function checkDaxnutsEasterEgg(host: CommandHandlersHost, model: { provider: string; id: string }): void {\n\tif (model.provider === \"opencode\" && model.id.toLowerCase().includes(\"kimi-k2.5\")) {\n\t\thost.handleDaxnuts();\n\t}\n}\n\nexport async function handleBashCommand(\n\thost: CommandHandlersHost,\n\tcommand: string,\n\texcludeFromContext = false,\n): Promise<void> {\n\t// Dispatch the user.bash lifecycle facts, then execute locally.\n\thost.facade.emitUserBash(excludeFromContext);\n\n\t// Normal execution path\n\tconst isDeferred = host.facade.isStreaming();\n\thost.bashComponent = new BashExecutionComponent(command, host.ui, excludeFromContext);\n\n\tif (isDeferred) {\n\t\t// Show in pending area when agent is streaming\n\t\thost.pendingMessagesContainer.addChild(host.bashComponent);\n\t\thost.pendingBashComponents.push(host.bashComponent);\n\t} else {\n\t\t// Show in chat immediately when agent is idle\n\t\thost.chatContainer.addChild(host.bashComponent);\n\t}\n\thost.ui.requestRender();\n\n\ttry {\n\t\tconst result = await host.facade.executeBash(\n\t\t\tcommand,\n\t\t\t(chunk) => {\n\t\t\t\tif (host.bashComponent) {\n\t\t\t\t\thost.bashComponent.appendOutput(chunk);\n\t\t\t\t\thost.ui.requestRender();\n\t\t\t\t}\n\t\t\t},\n\t\t\t{ excludeFromContext },\n\t\t);\n\n\t\tif (host.bashComponent) {\n\t\t\thost.bashComponent.setComplete(\n\t\t\t\tresult.exitCode,\n\t\t\t\tresult.cancelled,\n\t\t\t\tresult.truncated ? ({ truncated: true, content: result.output } as TruncationResult) : undefined,\n\t\t\t\tresult.fullOutputPath,\n\t\t\t);\n\t\t}\n\t} catch (error) {\n\t\tif (host.bashComponent) {\n\t\t\thost.bashComponent.setComplete(undefined, false);\n\t\t}\n\t\thost.showError(\n\t\t\tt(\"Bash command failed: {error}\", {\n\t\t\t\terror: error instanceof Error ? error.message : t(\"Unknown error\"),\n\t\t\t}),\n\t\t);\n\t}\n\n\thost.bashComponent = undefined;\n\thost.ui.requestRender();\n}\n\nexport async function handleCompactCommand(host: CommandHandlersHost, customInstructions?: string): Promise<void> {\n\thost.clearStatusIndicator();\n\n\ttry {\n\t\tawait host.facade.compact(customInstructions);\n\t} catch {\n\t\t// Ignore, will be emitted as an event\n\t}\n}\n\n/** /clean-sessions:会话清理两阶段流程;输出/确认走宿主既有机制(设计 §7)。 */\nexport async function handleCleanSessionsCommand(host: CommandHandlersHost, arg: string | undefined): Promise<void> {\n\tawait runCleanSessions(\n\t\t{\n\t\t\tshowMessage: (text) => host.showStatus(text),\n\t\t\tshowError: (text) => host.showError(text),\n\t\t\tconfirm: (title, message) => host.showDialogConfirm(title, message),\n\t\t},\n\t\targ,\n\t);\n}\n"]}
|