@ai-agent-forge/agent-forge 0.86.6 → 0.87.0
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 +19 -1
- package/README.md +8 -9
- package/dist/artifacts/artifact-store.d.ts.map +1 -1
- package/dist/artifacts/artifact-store.js +9 -5
- package/dist/artifacts/artifact-store.js.map +1 -1
- package/dist/bundle/.build-manifest.json +410 -371
- package/dist/bundle/chunks/{chunk-A7GUOX2H.js → chunk-6ZKDNZHA.js} +5 -1
- package/dist/bundle/chunks/chunk-BFC2BDVJ.js +13 -0
- package/dist/bundle/chunks/chunk-MOHOLL3F.js +1456 -0
- package/dist/bundle/chunks/image-resize-worker.js +12 -1
- package/dist/bundle/chunks/{virtual-modules-3IZ4MYSQ.js → virtual-modules-KZ5DRH7Q.js} +1 -1
- package/dist/bundle/cli.js +1 -1
- package/dist/bundle/client.js +1 -1
- package/dist/bundle/index.js +2 -2
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +231 -185
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/auth-check.d.ts.map +1 -1
- package/dist/cli/auth-check.js +3 -2
- package/dist/cli/auth-check.js.map +1 -1
- package/dist/cli/auth-command.d.ts.map +1 -1
- package/dist/cli/auth-command.js +15 -9
- package/dist/cli/auth-command.js.map +1 -1
- package/dist/cli/credential-print.d.ts.map +1 -1
- package/dist/cli/credential-print.js +14 -7
- package/dist/cli/credential-print.js.map +1 -1
- package/dist/cli/experimental/command.d.ts.map +1 -1
- package/dist/cli/experimental/command.js +6 -5
- package/dist/cli/experimental/command.js.map +1 -1
- package/dist/cli/list-models.d.ts.map +1 -1
- package/dist/cli/list-models.js +9 -8
- package/dist/cli/list-models.js.map +1 -1
- package/dist/cli/plugin-manager-controller.d.ts.map +1 -1
- package/dist/cli/plugin-manager-controller.js +2 -1
- package/dist/cli/plugin-manager-controller.js.map +1 -1
- package/dist/cli/serve.d.ts.map +1 -1
- package/dist/cli/serve.js +8 -5
- package/dist/cli/serve.js.map +1 -1
- package/dist/client/remote-session.d.ts.map +1 -1
- package/dist/client/remote-session.js +16 -9
- package/dist/client/remote-session.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +2 -1
- package/dist/config.js.map +1 -1
- package/dist/core/agent-capability-contract.d.ts +0 -7
- package/dist/core/agent-capability-contract.d.ts.map +1 -1
- package/dist/core/agent-capability-contract.js +72 -68
- package/dist/core/agent-capability-contract.js.map +1 -1
- package/dist/core/agent-session-bash.d.ts.map +1 -1
- package/dist/core/agent-session-bash.js +5 -4
- package/dist/core/agent-session-bash.js.map +1 -1
- package/dist/core/agent-session-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-compaction.js +28 -22
- package/dist/core/agent-session-compaction.js.map +1 -1
- package/dist/core/agent-session-context.d.ts.map +1 -1
- package/dist/core/agent-session-context.js +18 -13
- package/dist/core/agent-session-context.js.map +1 -1
- package/dist/core/agent-session-model.d.ts.map +1 -1
- package/dist/core/agent-session-model.js +2 -1
- package/dist/core/agent-session-model.js.map +1 -1
- package/dist/core/agent-session-retry.d.ts.map +1 -1
- package/dist/core/agent-session-retry.js +3 -2
- package/dist/core/agent-session-retry.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +7 -6
- package/dist/core/agent-session-runtime.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.map +1 -1
- package/dist/core/agent-session-tools.d.ts.map +1 -1
- package/dist/core/agent-session-tools.js +3 -2
- package/dist/core/agent-session-tools.js.map +1 -1
- package/dist/core/agent-session.d.ts +40 -2
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +142 -34
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-guidance.d.ts.map +1 -1
- package/dist/core/auth-guidance.js +11 -5
- package/dist/core/auth-guidance.js.map +1 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +9 -6
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +2 -1
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/embedded-sdk.d.ts.map +1 -1
- package/dist/core/embedded-sdk.js +10 -6
- package/dist/core/embedded-sdk.js.map +1 -1
- package/dist/core/export-html/index.d.ts.map +1 -1
- package/dist/core/export-html/index.js +9 -4
- package/dist/core/export-html/index.js.map +1 -1
- package/dist/core/extensions/agent-composition.d.ts.map +1 -1
- package/dist/core/extensions/agent-composition.js +26 -19
- package/dist/core/extensions/agent-composition.js.map +1 -1
- package/dist/core/extensions/bootstrap-agent-loop.d.ts.map +1 -1
- package/dist/core/extensions/bootstrap-agent-loop.js +3 -2
- package/dist/core/extensions/bootstrap-agent-loop.js.map +1 -1
- package/dist/core/extensions/bootstrap-lifecycle.d.ts.map +1 -1
- package/dist/core/extensions/bootstrap-lifecycle.js +20 -17
- package/dist/core/extensions/bootstrap-lifecycle.js.map +1 -1
- package/dist/core/extensions/bootstrap-overflow-policy.d.ts.map +1 -1
- package/dist/core/extensions/bootstrap-overflow-policy.js +2 -1
- package/dist/core/extensions/bootstrap-overflow-policy.js.map +1 -1
- package/dist/core/extensions/bootstrap-retry-policy.d.ts.map +1 -1
- package/dist/core/extensions/bootstrap-retry-policy.js +2 -1
- package/dist/core/extensions/bootstrap-retry-policy.js.map +1 -1
- package/dist/core/extensions/bootstrap-skills.d.ts.map +1 -1
- package/dist/core/extensions/bootstrap-skills.js +7 -6
- package/dist/core/extensions/bootstrap-skills.js.map +1 -1
- package/dist/core/extensions/bootstrap-tools.d.ts.map +1 -1
- package/dist/core/extensions/bootstrap-tools.js +2 -1
- package/dist/core/extensions/bootstrap-tools.js.map +1 -1
- package/dist/core/extensions/capability-plugin.d.ts.map +1 -1
- package/dist/core/extensions/capability-plugin.js +37 -13
- package/dist/core/extensions/capability-plugin.js.map +1 -1
- package/dist/core/extensions/capability-runtime-events.d.ts.map +1 -1
- package/dist/core/extensions/capability-runtime-events.js +17 -13
- package/dist/core/extensions/capability-runtime-events.js.map +1 -1
- package/dist/core/extensions/capability-runtime-guards.d.ts.map +1 -1
- package/dist/core/extensions/capability-runtime-guards.js +16 -15
- package/dist/core/extensions/capability-runtime-guards.js.map +1 -1
- package/dist/core/extensions/capability-runtime-manifest.d.ts.map +1 -1
- package/dist/core/extensions/capability-runtime-manifest.js +52 -30
- package/dist/core/extensions/capability-runtime-manifest.js.map +1 -1
- package/dist/core/extensions/capability-runtime-validation.d.ts.map +1 -1
- package/dist/core/extensions/capability-runtime-validation.js +66 -65
- package/dist/core/extensions/capability-runtime-validation.js.map +1 -1
- package/dist/core/extensions/capability-runtime.d.ts.map +1 -1
- package/dist/core/extensions/capability-runtime.js +147 -127
- package/dist/core/extensions/capability-runtime.js.map +1 -1
- package/dist/core/extensions/compaction-memory-failure-mode.d.ts.map +1 -1
- package/dist/core/extensions/compaction-memory-failure-mode.js +3 -2
- package/dist/core/extensions/compaction-memory-failure-mode.js.map +1 -1
- package/dist/core/extensions/context-strategy-binding.d.ts.map +1 -1
- package/dist/core/extensions/context-strategy-binding.js +7 -4
- package/dist/core/extensions/context-strategy-binding.js.map +1 -1
- package/dist/core/extensions/lifecycle-catalog.d.ts.map +1 -1
- package/dist/core/extensions/lifecycle-catalog.js +290 -279
- package/dist/core/extensions/lifecycle-catalog.js.map +1 -1
- package/dist/core/extensions/lifecycle-delivery-queue.d.ts.map +1 -1
- package/dist/core/extensions/lifecycle-delivery-queue.js +3 -2
- package/dist/core/extensions/lifecycle-delivery-queue.js.map +1 -1
- package/dist/core/facade/coding-agent-facade.d.ts +6 -0
- package/dist/core/facade/coding-agent-facade.d.ts.map +1 -1
- package/dist/core/facade/coding-agent-facade.js +2 -0
- package/dist/core/facade/coding-agent-facade.js.map +1 -1
- package/dist/core/http-dispatcher.d.ts.map +1 -1
- package/dist/core/http-dispatcher.js +2 -1
- package/dist/core/http-dispatcher.js.map +1 -1
- package/dist/core/i18n/index.d.ts +14 -0
- package/dist/core/i18n/index.d.ts.map +1 -0
- package/dist/core/i18n/index.js +67 -0
- package/dist/core/i18n/index.js.map +1 -0
- package/dist/core/i18n/locales/en/example.d.ts +7 -0
- package/dist/core/i18n/locales/en/example.d.ts.map +1 -0
- package/dist/core/i18n/locales/en/example.js +7 -0
- package/dist/core/i18n/locales/en/example.js.map +1 -0
- package/dist/core/i18n/locales/zh-cn/cli.d.ts +8 -0
- package/dist/core/i18n/locales/zh-cn/cli.d.ts.map +1 -0
- package/dist/core/i18n/locales/zh-cn/cli.js +227 -0
- package/dist/core/i18n/locales/zh-cn/cli.js.map +1 -0
- package/dist/core/i18n/locales/zh-cn/common.d.ts +6 -0
- package/dist/core/i18n/locales/zh-cn/common.d.ts.map +1 -0
- package/dist/core/i18n/locales/zh-cn/common.js +6 -0
- package/dist/core/i18n/locales/zh-cn/common.js.map +1 -0
- package/dist/core/i18n/locales/zh-cn/core-contract-core.d.ts +13 -0
- package/dist/core/i18n/locales/zh-cn/core-contract-core.d.ts.map +1 -0
- package/dist/core/i18n/locales/zh-cn/core-contract-core.js +173 -0
- package/dist/core/i18n/locales/zh-cn/core-contract-core.js.map +1 -0
- package/dist/core/i18n/locales/zh-cn/core-contract-extensions.d.ts +12 -0
- package/dist/core/i18n/locales/zh-cn/core-contract-extensions.d.ts.map +1 -0
- package/dist/core/i18n/locales/zh-cn/core-contract-extensions.js +582 -0
- package/dist/core/i18n/locales/zh-cn/core-contract-extensions.js.map +1 -0
- package/dist/core/i18n/locales/zh-cn/core-contract-final.d.ts +9 -0
- package/dist/core/i18n/locales/zh-cn/core-contract-final.d.ts.map +1 -0
- package/dist/core/i18n/locales/zh-cn/core-contract-final.js +55 -0
- package/dist/core/i18n/locales/zh-cn/core-contract-final.js.map +1 -0
- package/dist/core/i18n/locales/zh-cn/core-contract-plugins.d.ts +11 -0
- package/dist/core/i18n/locales/zh-cn/core-contract-plugins.d.ts.map +1 -0
- package/dist/core/i18n/locales/zh-cn/core-contract-plugins.js +455 -0
- package/dist/core/i18n/locales/zh-cn/core-contract-plugins.js.map +1 -0
- package/dist/core/i18n/locales/zh-cn/core-errors.d.ts +9 -0
- package/dist/core/i18n/locales/zh-cn/core-errors.d.ts.map +1 -0
- package/dist/core/i18n/locales/zh-cn/core-errors.js +191 -0
- package/dist/core/i18n/locales/zh-cn/core-errors.js.map +1 -0
- package/dist/core/i18n/locales/zh-cn/example.d.ts +7 -0
- package/dist/core/i18n/locales/zh-cn/example.d.ts.map +1 -0
- package/dist/core/i18n/locales/zh-cn/example.js +10 -0
- package/dist/core/i18n/locales/zh-cn/example.js.map +1 -0
- package/dist/core/i18n/locales/zh-cn/index.d.ts +2 -0
- package/dist/core/i18n/locales/zh-cn/index.d.ts.map +1 -0
- package/dist/core/i18n/locales/zh-cn/index.js +41 -0
- package/dist/core/i18n/locales/zh-cn/index.js.map +1 -0
- package/dist/core/i18n/locales/zh-cn/interactive-mode.d.ts +10 -0
- package/dist/core/i18n/locales/zh-cn/interactive-mode.d.ts.map +1 -0
- package/dist/core/i18n/locales/zh-cn/interactive-mode.js +265 -0
- package/dist/core/i18n/locales/zh-cn/interactive-mode.js.map +1 -0
- package/dist/core/i18n/locales/zh-cn/keybindings.d.ts +11 -0
- package/dist/core/i18n/locales/zh-cn/keybindings.d.ts.map +1 -0
- package/dist/core/i18n/locales/zh-cn/keybindings.js +67 -0
- package/dist/core/i18n/locales/zh-cn/keybindings.js.map +1 -0
- package/dist/core/i18n/locales/zh-cn/slash-commands.d.ts +7 -0
- package/dist/core/i18n/locales/zh-cn/slash-commands.d.ts.map +1 -0
- package/dist/core/i18n/locales/zh-cn/slash-commands.js +39 -0
- package/dist/core/i18n/locales/zh-cn/slash-commands.js.map +1 -0
- package/dist/core/i18n/locales/zh-cn/tui-builtin.d.ts +10 -0
- package/dist/core/i18n/locales/zh-cn/tui-builtin.d.ts.map +1 -0
- package/dist/core/i18n/locales/zh-cn/tui-builtin.js +15 -0
- package/dist/core/i18n/locales/zh-cn/tui-builtin.js.map +1 -0
- package/dist/core/i18n/locales/zh-cn/tui-components-misc.d.ts +13 -0
- package/dist/core/i18n/locales/zh-cn/tui-components-misc.d.ts.map +1 -0
- package/dist/core/i18n/locales/zh-cn/tui-components-misc.js +102 -0
- package/dist/core/i18n/locales/zh-cn/tui-components-misc.js.map +1 -0
- package/dist/core/i18n/locales/zh-cn/tui-components-selectors.d.ts +12 -0
- package/dist/core/i18n/locales/zh-cn/tui-components-selectors.d.ts.map +1 -0
- package/dist/core/i18n/locales/zh-cn/tui-components-selectors.js +288 -0
- package/dist/core/i18n/locales/zh-cn/tui-components-selectors.js.map +1 -0
- package/dist/core/i18n/locales/zh-cn/tui-interactive-misc.d.ts +9 -0
- package/dist/core/i18n/locales/zh-cn/tui-interactive-misc.d.ts.map +1 -0
- package/dist/core/i18n/locales/zh-cn/tui-interactive-misc.js +79 -0
- package/dist/core/i18n/locales/zh-cn/tui-interactive-misc.js.map +1 -0
- package/dist/core/i18n/locales/zh-cn/tui-self-owned.d.ts +8 -0
- package/dist/core/i18n/locales/zh-cn/tui-self-owned.d.ts.map +1 -0
- package/dist/core/i18n/locales/zh-cn/tui-self-owned.js +72 -0
- package/dist/core/i18n/locales/zh-cn/tui-self-owned.js.map +1 -0
- package/dist/core/keybindings.d.ts +15 -0
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +18 -0
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/logger.d.ts.map +1 -1
- package/dist/core/logger.js +5 -1
- package/dist/core/logger.js.map +1 -1
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +2 -1
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +8 -4
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/package-install-host.d.ts.map +1 -1
- package/dist/core/package-install-host.js +4 -3
- package/dist/core/package-install-host.js.map +1 -1
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +15 -10
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/package-resource-collection.d.ts.map +1 -1
- package/dist/core/package-resource-collection.js +2 -1
- package/dist/core/package-resource-collection.js.map +1 -1
- package/dist/core/package-source.d.ts.map +1 -1
- package/dist/core/package-source.js +3 -2
- package/dist/core/package-source.js.map +1 -1
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +22 -13
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/remote-catalog-provider.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.js +6 -2
- package/dist/core/remote-catalog-provider.js.map +1 -1
- package/dist/core/resolve-config-value.d.ts.map +1 -1
- package/dist/core/resolve-config-value.js +15 -5
- package/dist/core/resolve-config-value.js.map +1 -1
- package/dist/core/sdk.d.ts +19 -5
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +74 -54
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-cwd.d.ts.map +1 -1
- package/dist/core/session-cwd.js +5 -2
- package/dist/core/session-cwd.js.map +1 -1
- package/dist/core/session-export.d.ts.map +1 -1
- package/dist/core/session-export.js +2 -1
- package/dist/core/session-export.js.map +1 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +39 -29
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/session-storage.d.ts.map +1 -1
- package/dist/core/session-storage.js +3 -3
- package/dist/core/session-storage.js.map +1 -1
- package/dist/core/settings-manager.d.ts +11 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +27 -5
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +53 -32
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +25 -2
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +11 -7
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit-diff.d.ts.map +1 -1
- package/dist/core/tools/edit-diff.js +9 -4
- package/dist/core/tools/edit-diff.js.map +1 -1
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +4 -3
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +3 -2
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/dist/core/tools/output-accumulator.js +2 -1
- package/dist/core/tools/output-accumulator.js.map +1 -1
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +6 -2
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +2 -1
- package/dist/core/tools/write.js.map +1 -1
- package/dist/durable/durable-service.d.ts.map +1 -1
- package/dist/durable/durable-service.js +25 -18
- package/dist/durable/durable-service.js.map +1 -1
- package/dist/host/checkpoint-commit.d.ts.map +1 -1
- package/dist/host/checkpoint-commit.js +2 -1
- package/dist/host/checkpoint-commit.js.map +1 -1
- package/dist/host/manual-compaction.d.ts.map +1 -1
- package/dist/host/manual-compaction.js +2 -1
- package/dist/host/manual-compaction.js.map +1 -1
- package/dist/host/output-projection.d.ts +0 -13
- package/dist/host/output-projection.d.ts.map +1 -1
- package/dist/host/output-projection.js +16 -2
- package/dist/host/output-projection.js.map +1 -1
- package/dist/host/summary-retry.d.ts.map +1 -1
- package/dist/host/summary-retry.js +3 -2
- package/dist/host/summary-retry.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +94 -58
- 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 +18 -15
- package/dist/modes/interactive/components/agents-view.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +6 -5
- 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 +12 -7
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -1
- package/dist/modes/interactive/components/bordered-loader.js +2 -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 +6 -5
- 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 +9 -5
- 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 +18 -15
- 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 +2 -1
- package/dist/modes/interactive/components/custom-entry.js.map +1 -1
- package/dist/modes/interactive/components/dialog-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/dialog-editor.js +5 -4
- 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 +2 -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 +4 -3
- package/dist/modes/interactive/components/dialog-selector.js.map +1 -1
- package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -1
- package/dist/modes/interactive/components/first-time-setup.js +11 -10
- 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 +7 -4
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/index.d.ts +1 -0
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/index.js +1 -0
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.js +3 -2
- 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 +12 -11
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/mermaid.d.ts.map +1 -1
- package/dist/modes/interactive/components/mermaid.js +6 -2
- 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 +28 -16
- 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 +10 -9
- 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 +22 -13
- 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 +27 -12
- package/dist/modes/interactive/components/plugin-selection-entry.js.map +1 -1
- package/dist/modes/interactive/components/queue-manager-selector.d.ts +60 -0
- package/dist/modes/interactive/components/queue-manager-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/queue-manager-selector.js +166 -0
- package/dist/modes/interactive/components/queue-manager-selector.js.map +1 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +16 -14
- 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 +43 -31
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +2 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +113 -96
- 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 +5 -4
- 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 +3 -2
- 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 +4 -3
- 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 +14 -5
- 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 +2 -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 +11 -4
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +8 -3
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tree-list.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-list.js +7 -6
- 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 +28 -23
- 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 +9 -7
- 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 +5 -4
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
- package/dist/modes/interactive/components/workflow-view.d.ts.map +1 -1
- package/dist/modes/interactive/components/workflow-view.js +36 -21
- package/dist/modes/interactive/components/workflow-view.js.map +1 -1
- package/dist/modes/interactive/external-editor.d.ts.map +1 -1
- package/dist/modes/interactive/external-editor.js +2 -1
- package/dist/modes/interactive/external-editor.js.map +1 -1
- package/dist/modes/interactive/interactive-auth.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-auth.js +71 -40
- package/dist/modes/interactive/interactive-auth.js.map +1 -1
- package/dist/modes/interactive/interactive-commands.d.ts +1 -0
- package/dist/modes/interactive/interactive-commands.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-commands.js +3 -0
- package/dist/modes/interactive/interactive-commands.js.map +1 -1
- package/dist/modes/interactive/interactive-dialog-ui.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-dialog-ui.js +5 -5
- package/dist/modes/interactive/interactive-dialog-ui.js.map +1 -1
- package/dist/modes/interactive/interactive-format.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-format.js +34 -18
- package/dist/modes/interactive/interactive-format.js.map +1 -1
- package/dist/modes/interactive/interactive-helpers.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-helpers.js +7 -2
- package/dist/modes/interactive/interactive-helpers.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +4 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +327 -243
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/interactive-selectors.d.ts +9 -0
- package/dist/modes/interactive/interactive-selectors.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-selectors.js +79 -25
- package/dist/modes/interactive/interactive-selectors.js.map +1 -1
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-controller.js +5 -1
- package/dist/modes/interactive/theme/theme-controller.js.map +1 -1
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +26 -23
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/json-event.d.ts.map +1 -1
- package/dist/modes/json-event.js +3 -2
- package/dist/modes/json-event.js.map +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +3 -2
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +3 -2
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +28 -13
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/plugins/ecosystem/catalog.d.ts.map +1 -1
- package/dist/plugins/ecosystem/catalog.js +3 -2
- package/dist/plugins/ecosystem/catalog.js.map +1 -1
- package/dist/plugins/ecosystem/cli.d.ts.map +1 -1
- package/dist/plugins/ecosystem/cli.js +2 -1
- package/dist/plugins/ecosystem/cli.js.map +1 -1
- package/dist/plugins/ecosystem/default-plugin-market.d.ts.map +1 -1
- package/dist/plugins/ecosystem/default-plugin-market.js +3 -2
- package/dist/plugins/ecosystem/default-plugin-market.js.map +1 -1
- package/dist/plugins/ecosystem/distribution.d.ts.map +1 -1
- package/dist/plugins/ecosystem/distribution.js +2 -1
- package/dist/plugins/ecosystem/distribution.js.map +1 -1
- package/dist/plugins/ecosystem/installer.d.ts.map +1 -1
- package/dist/plugins/ecosystem/installer.js +3 -2
- package/dist/plugins/ecosystem/installer.js.map +1 -1
- package/dist/plugins/ecosystem/node-disk-registry-source.d.ts.map +1 -1
- package/dist/plugins/ecosystem/node-disk-registry-source.js +20 -17
- package/dist/plugins/ecosystem/node-disk-registry-source.js.map +1 -1
- package/dist/plugins/ecosystem/node-distribution-host.d.ts.map +1 -1
- package/dist/plugins/ecosystem/node-distribution-host.js +35 -34
- package/dist/plugins/ecosystem/node-distribution-host.js.map +1 -1
- package/dist/plugins/ecosystem/node-npm-registry-source.d.ts.map +1 -1
- package/dist/plugins/ecosystem/node-npm-registry-source.js +35 -34
- package/dist/plugins/ecosystem/node-npm-registry-source.js.map +1 -1
- package/dist/plugins/ecosystem/node-package-install-host.d.ts.map +1 -1
- package/dist/plugins/ecosystem/node-package-install-host.js +9 -8
- package/dist/plugins/ecosystem/node-package-install-host.js.map +1 -1
- package/dist/plugins/ecosystem/node-package-install-persistence.d.ts.map +1 -1
- package/dist/plugins/ecosystem/node-package-install-persistence.js +4 -3
- package/dist/plugins/ecosystem/node-package-install-persistence.js.map +1 -1
- package/dist/plugins/ecosystem/node-plugin-bootstrap.d.ts.map +1 -1
- package/dist/plugins/ecosystem/node-plugin-bootstrap.js +21 -5
- package/dist/plugins/ecosystem/node-plugin-bootstrap.js.map +1 -1
- package/dist/plugins/ecosystem/node-plugin-trust-root.d.ts.map +1 -1
- package/dist/plugins/ecosystem/node-plugin-trust-root.js +10 -9
- package/dist/plugins/ecosystem/node-plugin-trust-root.js.map +1 -1
- package/dist/plugins/ecosystem/node-registry-source.d.ts.map +1 -1
- package/dist/plugins/ecosystem/node-registry-source.js +31 -30
- package/dist/plugins/ecosystem/node-registry-source.js.map +1 -1
- package/dist/plugins/ecosystem/node-release-package-source.d.ts.map +1 -1
- package/dist/plugins/ecosystem/node-release-package-source.js +30 -29
- package/dist/plugins/ecosystem/node-release-package-source.js.map +1 -1
- package/dist/plugins/ecosystem/node-tar-writer.d.ts.map +1 -1
- package/dist/plugins/ecosystem/node-tar-writer.js +11 -10
- package/dist/plugins/ecosystem/node-tar-writer.js.map +1 -1
- package/dist/plugins/ecosystem/node-url-package-source.d.ts.map +1 -1
- package/dist/plugins/ecosystem/node-url-package-source.js +21 -20
- package/dist/plugins/ecosystem/node-url-package-source.js.map +1 -1
- package/dist/plugins/ecosystem/plugin-acquisition.d.ts.map +1 -1
- package/dist/plugins/ecosystem/plugin-acquisition.js +3 -2
- package/dist/plugins/ecosystem/plugin-acquisition.js.map +1 -1
- package/dist/plugins/ecosystem/registry-cli-adapter.d.ts.map +1 -1
- package/dist/plugins/ecosystem/registry-cli-adapter.js +2 -1
- package/dist/plugins/ecosystem/registry-cli-adapter.js.map +1 -1
- package/dist/plugins/ecosystem/registry.d.ts.map +1 -1
- package/dist/plugins/ecosystem/registry.js +35 -32
- package/dist/plugins/ecosystem/registry.js.map +1 -1
- package/dist/plugins/ecosystem/resolver.d.ts.map +1 -1
- package/dist/plugins/ecosystem/resolver.js +3 -2
- package/dist/plugins/ecosystem/resolver.js.map +1 -1
- package/dist/plugins/ecosystem/selection-store.d.ts.map +1 -1
- package/dist/plugins/ecosystem/selection-store.js +11 -10
- package/dist/plugins/ecosystem/selection-store.js.map +1 -1
- package/dist/plugins/ecosystem/selection.d.ts.map +1 -1
- package/dist/plugins/ecosystem/selection.js +8 -7
- package/dist/plugins/ecosystem/selection.js.map +1 -1
- package/dist/plugins/ecosystem/state.d.ts.map +1 -1
- package/dist/plugins/ecosystem/state.js +24 -23
- package/dist/plugins/ecosystem/state.js.map +1 -1
- package/dist/plugins/ecosystem/updates.d.ts.map +1 -1
- package/dist/plugins/ecosystem/updates.js +5 -4
- package/dist/plugins/ecosystem/updates.js.map +1 -1
- package/dist/plugins/mcp-http.d.ts +0 -17
- package/dist/plugins/mcp-http.d.ts.map +1 -1
- package/dist/plugins/mcp-http.js +30 -7
- package/dist/plugins/mcp-http.js.map +1 -1
- package/dist/plugins/plugin-supervisor.d.ts.map +1 -1
- package/dist/plugins/plugin-supervisor.js +19 -1
- package/dist/plugins/plugin-supervisor.js.map +1 -1
- package/dist/profile/first-roles.d.ts.map +1 -1
- package/dist/profile/first-roles.js +10 -1
- package/dist/profile/first-roles.js.map +1 -1
- package/dist/profile/goal-plugin.d.ts.map +1 -1
- package/dist/profile/goal-plugin.js +24 -5
- package/dist/profile/goal-plugin.js.map +1 -1
- package/dist/profile/identity.d.ts.map +1 -1
- package/dist/profile/identity.js +7 -6
- package/dist/profile/identity.js.map +1 -1
- package/dist/profile/lock.d.ts.map +1 -1
- package/dist/profile/lock.js +15 -1
- package/dist/profile/lock.js.map +1 -1
- package/dist/profile/plan-plugin.d.ts.map +1 -1
- package/dist/profile/plan-plugin.js +26 -13
- package/dist/profile/plan-plugin.js.map +1 -1
- package/dist/profile/plugin-profiles.d.ts.map +1 -1
- package/dist/profile/plugin-profiles.js +2 -1
- package/dist/profile/plugin-profiles.js.map +1 -1
- package/dist/profile/policy-manifest.d.ts.map +1 -1
- package/dist/profile/policy-manifest.js +5 -4
- package/dist/profile/policy-manifest.js.map +1 -1
- package/dist/profile/profile-registry.d.ts +0 -12
- package/dist/profile/profile-registry.d.ts.map +1 -1
- package/dist/profile/profile-registry.js +14 -1
- package/dist/profile/profile-registry.js.map +1 -1
- package/dist/profile/role-catalog.d.ts +0 -1
- package/dist/profile/role-catalog.d.ts.map +1 -1
- package/dist/profile/role-catalog.js +17 -15
- package/dist/profile/role-catalog.js.map +1 -1
- package/dist/profile/role-orchestrator.d.ts.map +1 -1
- package/dist/profile/role-orchestrator.js +8 -7
- package/dist/profile/role-orchestrator.js.map +1 -1
- package/dist/profile/role-runner.d.ts.map +1 -1
- package/dist/profile/role-runner.js +3 -2
- package/dist/profile/role-runner.js.map +1 -1
- package/dist/profile/root-facade.d.ts.map +1 -1
- package/dist/profile/root-facade.js +2 -1
- package/dist/profile/root-facade.js.map +1 -1
- package/dist/profile/skill-discovery-wiring.d.ts.map +1 -1
- package/dist/profile/skill-discovery-wiring.js +7 -2
- package/dist/profile/skill-discovery-wiring.js.map +1 -1
- package/dist/profile/state-store.d.ts.map +1 -1
- package/dist/profile/state-store.js +13 -9
- package/dist/profile/state-store.js.map +1 -1
- package/dist/profile/todo-plugin.d.ts.map +1 -1
- package/dist/profile/todo-plugin.js +9 -4
- package/dist/profile/todo-plugin.js.map +1 -1
- package/dist/profiles/builtin-suites.d.ts +13 -6
- package/dist/profiles/builtin-suites.d.ts.map +1 -1
- package/dist/profiles/builtin-suites.js +15 -6
- package/dist/profiles/builtin-suites.js.map +1 -1
- package/dist/profiles/suite-loader.d.ts +25 -1
- package/dist/profiles/suite-loader.d.ts.map +1 -1
- package/dist/profiles/suite-loader.js +34 -9
- package/dist/profiles/suite-loader.js.map +1 -1
- package/dist/remote/server-entry.d.ts.map +1 -1
- package/dist/remote/server-entry.js +3 -2
- package/dist/remote/server-entry.js.map +1 -1
- package/dist/remote/session-source.d.ts.map +1 -1
- package/dist/remote/session-source.js +8 -4
- package/dist/remote/session-source.js.map +1 -1
- package/dist/share/session-share.d.ts.map +1 -1
- package/dist/share/session-share.js +14 -2
- package/dist/share/session-share.js.map +1 -1
- package/dist/testing/plugin-testkit.d.ts.map +1 -1
- package/dist/testing/plugin-testkit.js +4 -3
- package/dist/testing/plugin-testkit.js.map +1 -1
- package/dist/testing/runtime-delivery-queue.d.ts.map +1 -1
- package/dist/testing/runtime-delivery-queue.js +2 -1
- package/dist/testing/runtime-delivery-queue.js.map +1 -1
- package/dist/testing/session-plugin-testkit.d.ts.map +1 -1
- package/dist/testing/session-plugin-testkit.js +10 -7
- package/dist/testing/session-plugin-testkit.js.map +1 -1
- package/dist/utils/ansi.d.ts.map +1 -1
- package/dist/utils/ansi.js +2 -1
- package/dist/utils/ansi.js.map +1 -1
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +7 -6
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/image-resize-worker.d.ts.map +1 -1
- package/dist/utils/image-resize-worker.js +3 -2
- package/dist/utils/image-resize-worker.js.map +1 -1
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +9 -8
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +23 -13
- package/dist/utils/tools-manager.js.map +1 -1
- package/dist/utils/version-check.d.ts.map +1 -1
- package/dist/utils/version-check.js +5 -1
- package/dist/utils/version-check.js.map +1 -1
- package/docs/keybindings.md +3 -0
- package/docs/quickstart.md +1 -1
- package/docs/settings.md +1 -0
- package/docs/terminal-setup.md +2 -3
- package/docs/usage.md +6 -5
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/extensions/with-deps/plugin.json +1 -1
- package/package.json +1 -1
- package/dist/bundle/chunks/chunk-EALJ5DDX.js +0 -1452
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import * as path from "node:path";
|
|
19
19
|
import { APP_NAME, getAuthPath, getDocsPath } from "../../config.js";
|
|
20
|
+
import { t } from "../../core/i18n/index.js";
|
|
20
21
|
import { defaultModelPerProvider } from "../../core/model-resolver.js";
|
|
21
22
|
import { CredentialSynchronizationError } from "../../core/model-runtime.js";
|
|
22
23
|
import { DialogSelectorComponent } from "./components/dialog-selector.js";
|
|
@@ -108,8 +109,8 @@ export async function startProviderLogin(host, providerOption) {
|
|
|
108
109
|
export function showLoginAuthTypeSelector(host, providerOptions) {
|
|
109
110
|
const oauthProvider = providerOptions?.find((provider) => provider.authType === "oauth");
|
|
110
111
|
const oauthLoginLabel = oauthProvider?.method && "loginLabel" in oauthProvider.method ? oauthProvider.method.loginLabel : undefined;
|
|
111
|
-
const subscriptionLabel = oauthLoginLabel ?? "Sign in with an account";
|
|
112
|
-
const apiKeyLabel = "Sign in with an API key";
|
|
112
|
+
const subscriptionLabel = oauthLoginLabel ?? t("Sign in with an account");
|
|
113
|
+
const apiKeyLabel = t("Sign in with an API key");
|
|
113
114
|
const availableAuthTypes = providerOptions
|
|
114
115
|
? new Set(providerOptions.map((provider) => provider.authType))
|
|
115
116
|
: new Set(["oauth", "api_key"]);
|
|
@@ -121,7 +122,7 @@ export function showLoginAuthTypeSelector(host, providerOptions) {
|
|
|
121
122
|
options.push(apiKeyLabel);
|
|
122
123
|
}
|
|
123
124
|
if (options.length === 0) {
|
|
124
|
-
host.showStatus("No login methods available.");
|
|
125
|
+
host.showStatus(t("No login methods available."));
|
|
125
126
|
return;
|
|
126
127
|
}
|
|
127
128
|
if (providerOptions && options.length === 1) {
|
|
@@ -133,8 +134,8 @@ export function showLoginAuthTypeSelector(host, providerOptions) {
|
|
|
133
134
|
return;
|
|
134
135
|
}
|
|
135
136
|
const title = providerOptions?.[0]
|
|
136
|
-
?
|
|
137
|
-
: "Select authentication method:";
|
|
137
|
+
? t("Select authentication method for {name}:", { name: providerOptions[0].name })
|
|
138
|
+
: t("Select authentication method:");
|
|
138
139
|
host.showAuthSelector((done) => {
|
|
139
140
|
const selector = new DialogSelectorComponent(title, options, (option) => {
|
|
140
141
|
done();
|
|
@@ -159,10 +160,10 @@ export function showLoginProviderSelector(host, authType, initialSearchInput) {
|
|
|
159
160
|
const providerOptions = host.getLoginProviderOptions(authType);
|
|
160
161
|
if (providerOptions.length === 0) {
|
|
161
162
|
const message = authType === "oauth"
|
|
162
|
-
? "No subscription providers available."
|
|
163
|
+
? t("No subscription providers available.")
|
|
163
164
|
: authType === "api_key"
|
|
164
|
-
? "No API key providers available."
|
|
165
|
-
: "No login providers available.";
|
|
165
|
+
? t("No API key providers available.")
|
|
166
|
+
: t("No login providers available.");
|
|
166
167
|
host.showStatus(message);
|
|
167
168
|
return;
|
|
168
169
|
}
|
|
@@ -196,11 +197,13 @@ export async function showOAuthSelector(host, mode) {
|
|
|
196
197
|
providerOptions = await host.getLogoutProviderOptions();
|
|
197
198
|
}
|
|
198
199
|
catch (error) {
|
|
199
|
-
host.showError(
|
|
200
|
+
host.showError(t("Could not read stored credentials: {error}", {
|
|
201
|
+
error: error instanceof Error ? error.message : String(error),
|
|
202
|
+
}));
|
|
200
203
|
return;
|
|
201
204
|
}
|
|
202
205
|
if (providerOptions.length === 0) {
|
|
203
|
-
host.showStatus("No stored credentials to remove. /logout only removes credentials saved by /login; environment variables and models.json config are unchanged.");
|
|
206
|
+
host.showStatus(t("No stored credentials to remove. /logout only removes credentials saved by /login; environment variables and models.json config are unchanged."));
|
|
204
207
|
return;
|
|
205
208
|
}
|
|
206
209
|
host.showAuthSelector((done) => {
|
|
@@ -216,15 +219,18 @@ export async function showOAuthSelector(host, mode) {
|
|
|
216
219
|
});
|
|
217
220
|
await host.updateAvailableProviderCount();
|
|
218
221
|
const message = providerOption.authType === "oauth"
|
|
219
|
-
?
|
|
220
|
-
:
|
|
222
|
+
? t("Logged out of {name}", { name: providerOption.name })
|
|
223
|
+
: t("Removed stored API key for {name}. Environment variables and models.json config are unchanged.", { name: providerOption.name });
|
|
221
224
|
host.showStatus(message);
|
|
222
225
|
}
|
|
223
226
|
catch (error) {
|
|
224
227
|
const message = error instanceof Error ? error.message : String(error);
|
|
225
228
|
host.showError(error instanceof CredentialSynchronizationError
|
|
226
|
-
?
|
|
227
|
-
|
|
229
|
+
? t("Credentials removed for {name}, but local model state could not be synchronized: {error}", {
|
|
230
|
+
name: providerOption.name,
|
|
231
|
+
error: message,
|
|
232
|
+
})
|
|
233
|
+
: t("Logout failed: {error}", { error: message }));
|
|
228
234
|
}
|
|
229
235
|
}, () => {
|
|
230
236
|
done();
|
|
@@ -234,7 +240,9 @@ export async function showOAuthSelector(host, mode) {
|
|
|
234
240
|
});
|
|
235
241
|
}
|
|
236
242
|
export async function completeProviderAuthentication(host, providerId, providerName, authType, previousModel) {
|
|
237
|
-
const actionLabel = authType === "oauth"
|
|
243
|
+
const actionLabel = authType === "oauth"
|
|
244
|
+
? t("Logged in to {name}", { name: providerName })
|
|
245
|
+
: t("Saved API key for {name}", { name: providerName });
|
|
238
246
|
// Opaque identity of the session that started this login; the rebind check
|
|
239
247
|
// below compares against it through the host.
|
|
240
248
|
const sessionIdentity = host.getSessionIdentity();
|
|
@@ -255,16 +263,18 @@ export async function completeProviderAuthentication(host, providerId, providerN
|
|
|
255
263
|
selectionError = llamaCppPostLoginGuidance(actionLabel, providerModels.length);
|
|
256
264
|
}
|
|
257
265
|
else if (!hasDefaultModelProvider(providerId)) {
|
|
258
|
-
selectionError =
|
|
266
|
+
selectionError = t('{action}, but no default model is configured for provider "{providerId}". Use /model to select a model.', { action: actionLabel, providerId });
|
|
259
267
|
}
|
|
260
268
|
else if (providerModels.length === 0) {
|
|
261
|
-
selectionError =
|
|
269
|
+
selectionError = t("{action}, but no models are available for that provider. Use /model to select a model.", {
|
|
270
|
+
action: actionLabel,
|
|
271
|
+
});
|
|
262
272
|
}
|
|
263
273
|
else {
|
|
264
274
|
const defaultModelId = defaultModelPerProvider[providerId];
|
|
265
275
|
selectedModel = providerModels.find((model) => model.id === defaultModelId);
|
|
266
276
|
if (!selectedModel) {
|
|
267
|
-
selectionError =
|
|
277
|
+
selectionError = t('{action}, but its default model "{modelId}" is not available. Use /model to select a model.', { action: actionLabel, modelId: defaultModelId });
|
|
268
278
|
}
|
|
269
279
|
else {
|
|
270
280
|
try {
|
|
@@ -273,7 +283,7 @@ export async function completeProviderAuthentication(host, providerId, providerN
|
|
|
273
283
|
catch (error) {
|
|
274
284
|
selectedModel = undefined;
|
|
275
285
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
276
|
-
selectionError =
|
|
286
|
+
selectionError = t("{action}, but selecting its default model failed: {error}. Use /model to select a model.", { action: actionLabel, error: errorMessage });
|
|
277
287
|
}
|
|
278
288
|
}
|
|
279
289
|
}
|
|
@@ -282,12 +292,16 @@ export async function completeProviderAuthentication(host, providerId, providerN
|
|
|
282
292
|
host.invalidateFooter();
|
|
283
293
|
host.updateEditorBorderColor();
|
|
284
294
|
if (selectedModel) {
|
|
285
|
-
host.showStatus(
|
|
295
|
+
host.showStatus(t("{action}. Selected {modelId}. Credentials saved to {path}", {
|
|
296
|
+
action: actionLabel,
|
|
297
|
+
modelId: selectedModel.id,
|
|
298
|
+
path: getAuthPath(),
|
|
299
|
+
}));
|
|
286
300
|
void host.maybeWarnAboutAnthropicSubscriptionAuth(selectedModel);
|
|
287
301
|
host.checkDaxnutsEasterEgg(selectedModel);
|
|
288
302
|
}
|
|
289
303
|
else {
|
|
290
|
-
host.showStatus(
|
|
304
|
+
host.showStatus(t("{action}. Credentials saved to {path}", { action: actionLabel, path: getAuthPath() }));
|
|
291
305
|
if (selectionError) {
|
|
292
306
|
host.showError(selectionError);
|
|
293
307
|
}
|
|
@@ -297,7 +311,10 @@ export async function completeProviderAuthentication(host, providerId, providerN
|
|
|
297
311
|
}
|
|
298
312
|
};
|
|
299
313
|
if (deferSelection) {
|
|
300
|
-
host.showStatus(
|
|
314
|
+
host.showStatus(t("{action}. Credentials saved to {path}. Refreshing model catalog…", {
|
|
315
|
+
action: actionLabel,
|
|
316
|
+
path: getAuthPath(),
|
|
317
|
+
}));
|
|
301
318
|
}
|
|
302
319
|
else {
|
|
303
320
|
await finishAuthentication();
|
|
@@ -309,10 +326,12 @@ export async function completeProviderAuthentication(host, providerId, providerN
|
|
|
309
326
|
.refresh({ providers: [providerId], signal: controller.signal })
|
|
310
327
|
.then(async (result) => {
|
|
311
328
|
if (result.aborted) {
|
|
312
|
-
host.showWarning(
|
|
329
|
+
host.showWarning(t("{action}, but its model catalog refresh timed out; using cached models.", { action: actionLabel }));
|
|
313
330
|
}
|
|
314
331
|
else if (result.errors.size > 0) {
|
|
315
|
-
host.showWarning(
|
|
332
|
+
host.showWarning(t("{action}, but its model catalog could not be refreshed; using cached models.", {
|
|
333
|
+
action: actionLabel,
|
|
334
|
+
}));
|
|
316
335
|
}
|
|
317
336
|
// Do not replace a model or session selected while the refresh was running.
|
|
318
337
|
if (deferSelection &&
|
|
@@ -325,7 +344,10 @@ export async function completeProviderAuthentication(host, providerId, providerN
|
|
|
325
344
|
host.ui.requestRender();
|
|
326
345
|
})
|
|
327
346
|
.catch((error) => {
|
|
328
|
-
host.showWarning(
|
|
347
|
+
host.showWarning(t("{action}, but its model catalog could not be refreshed: {error}", {
|
|
348
|
+
action: actionLabel,
|
|
349
|
+
error: error instanceof Error ? error.message : String(error),
|
|
350
|
+
}));
|
|
329
351
|
})
|
|
330
352
|
.finally(() => clearTimeout(timeout));
|
|
331
353
|
}
|
|
@@ -336,8 +358,11 @@ export function showAmbientAuthDialog(host, providerOption) {
|
|
|
336
358
|
host.ui.setFocus(host.editor);
|
|
337
359
|
host.ui.requestRender();
|
|
338
360
|
};
|
|
339
|
-
const dialog = new LoginDialogComponent(host.ui, providerOption.id, () => restoreEditor(), providerOption.name,
|
|
340
|
-
dialog.showInfo(
|
|
361
|
+
const dialog = new LoginDialogComponent(host.ui, providerOption.id, () => restoreEditor(), providerOption.name, t("{name} setup", { name: providerOption.name }));
|
|
362
|
+
dialog.showInfo(t("{method} is configured outside {appName}.", {
|
|
363
|
+
method: providerOption.method?.name ?? t("Authentication"),
|
|
364
|
+
appName: APP_NAME,
|
|
365
|
+
}), [], true);
|
|
341
366
|
host.editorContainer.clear();
|
|
342
367
|
host.editorContainer.addChild(dialog);
|
|
343
368
|
host.ui.setFocus(dialog);
|
|
@@ -350,8 +375,8 @@ export async function showApiKeyLoginDialog(host, providerId, providerName) {
|
|
|
350
375
|
}, providerName);
|
|
351
376
|
if (providerId === "amazon-bedrock") {
|
|
352
377
|
dialog.showDetails([
|
|
353
|
-
theme.fg("text", "You can also use an AWS profile, IAM keys, or role-based credentials."),
|
|
354
|
-
theme.fg("muted", "See:"),
|
|
378
|
+
theme.fg("text", t("You can also use an AWS profile, IAM keys, or role-based credentials.")),
|
|
379
|
+
theme.fg("muted", t("See:")),
|
|
355
380
|
theme.fg("accent", ` ${path.join(getDocsPath(), "providers.md")}`),
|
|
356
381
|
]);
|
|
357
382
|
}
|
|
@@ -374,10 +399,13 @@ export async function showApiKeyLoginDialog(host, providerId, providerName) {
|
|
|
374
399
|
restoreEditor();
|
|
375
400
|
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
376
401
|
if (error instanceof CredentialSynchronizationError) {
|
|
377
|
-
host.showError(
|
|
402
|
+
host.showError(t("Saved API key for {name}, but local model state could not be synchronized: {error}", {
|
|
403
|
+
name: providerName,
|
|
404
|
+
error: errorMsg,
|
|
405
|
+
}));
|
|
378
406
|
}
|
|
379
|
-
else if (errorMsg !== "Login cancelled") {
|
|
380
|
-
host.showError(
|
|
407
|
+
else if (errorMsg !== t("Login cancelled")) {
|
|
408
|
+
host.showError(t("Failed to save API key for {name}: {error}", { name: providerName, error: errorMsg }));
|
|
381
409
|
}
|
|
382
410
|
}
|
|
383
411
|
}
|
|
@@ -397,10 +425,10 @@ export function showAuthSelect(host, dialog, prompt) {
|
|
|
397
425
|
if (id)
|
|
398
426
|
resolve(id);
|
|
399
427
|
else
|
|
400
|
-
reject(new Error("Login cancelled"));
|
|
428
|
+
reject(new Error(t("Login cancelled")));
|
|
401
429
|
}, () => {
|
|
402
430
|
restoreDialog();
|
|
403
|
-
reject(new Error("Login cancelled"));
|
|
431
|
+
reject(new Error(t("Login cancelled")));
|
|
404
432
|
});
|
|
405
433
|
host.editorContainer.clear();
|
|
406
434
|
host.editorContainer.addChild(selector);
|
|
@@ -422,11 +450,11 @@ export async function showAuthPrompt(host, dialog, prompt) {
|
|
|
422
450
|
if (!prompt.signal)
|
|
423
451
|
return response;
|
|
424
452
|
if (prompt.signal.aborted)
|
|
425
|
-
throw new Error("Login cancelled");
|
|
453
|
+
throw new Error(t("Login cancelled"));
|
|
426
454
|
const signal = prompt.signal;
|
|
427
455
|
let onAbort;
|
|
428
456
|
const aborted = new Promise((_resolve, reject) => {
|
|
429
|
-
onAbort = () => reject(new Error("Login cancelled"));
|
|
457
|
+
onAbort = () => reject(new Error(t("Login cancelled")));
|
|
430
458
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
431
459
|
});
|
|
432
460
|
try {
|
|
@@ -444,7 +472,7 @@ export function notifyAuthDialog(_host, dialog, event) {
|
|
|
444
472
|
}
|
|
445
473
|
else if (event.type === "device_code") {
|
|
446
474
|
dialog.showDeviceCode(event);
|
|
447
|
-
dialog.showWaiting("Waiting for authentication...");
|
|
475
|
+
dialog.showWaiting(t("Waiting for authentication..."));
|
|
448
476
|
}
|
|
449
477
|
else if (event.type === "info") {
|
|
450
478
|
dialog.showInfo(event.message, event.links);
|
|
@@ -482,10 +510,13 @@ export async function showLoginDialog(host, providerId, providerName) {
|
|
|
482
510
|
restoreEditor();
|
|
483
511
|
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
484
512
|
if (error instanceof CredentialSynchronizationError) {
|
|
485
|
-
host.showError(
|
|
513
|
+
host.showError(t("Logged in to {name}, but local model state could not be synchronized: {error}", {
|
|
514
|
+
name: providerName,
|
|
515
|
+
error: errorMsg,
|
|
516
|
+
}));
|
|
486
517
|
}
|
|
487
|
-
else if (errorMsg !== "Login cancelled") {
|
|
488
|
-
host.showError(
|
|
518
|
+
else if (errorMsg !== t("Login cancelled")) {
|
|
519
|
+
host.showError(t("Failed to login to {name}: {error}", { name: providerName, error: errorMsg }));
|
|
489
520
|
}
|
|
490
521
|
}
|
|
491
522
|
}
|
|
@@ -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,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EA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;QAC7B,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC3C,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC9B,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC;IAAA,CACxB,CAAC;IAEF,IAAI,CAAC;QACJ,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;QACtD,aAAa,EAAE,CAAC;QAChB,MAAM,IAAI,CAAC,8BAA8B,CAAC,UAAU,EAAE,YAAY,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;IAC7F,CAAC;IAAC,OAAO,KAAc,EAAE,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,CAAC,gBAAgB,YAAY,sDAAsD,QAAQ,EAAE,CAAC,CAAC;QAC9G,CAAC;aAAM,IAAI,QAAQ,KAAK,iBAAiB,EAAE,CAAC;YAC3C,IAAI,CAAC,SAAS,CAAC,sBAAsB,YAAY,KAAK,QAAQ,EAAE,CAAC,CAAC;QACnE,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 { 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 ?? \"Sign in with an account\";\n\tconst apiKeyLabel = \"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(\"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? `Select authentication method for ${providerOptions[0].name}:`\n\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? \"No subscription providers available.\"\n\t\t\t\t: authType === \"api_key\"\n\t\t\t\t\t? \"No API key providers available.\"\n\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(`Could not read stored credentials: ${error instanceof Error ? error.message : String(error)}`);\n\t\treturn;\n\t}\n\tif (providerOptions.length === 0) {\n\t\thost.showStatus(\n\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);\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? `Logged out of ${providerOption.name}`\n\t\t\t\t\t\t\t: `Removed stored API key for ${providerOption.name}. Environment variables and models.json config are unchanged.`;\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? `Credentials removed for ${providerOption.name}, but local model state could not be synchronized: ${message}`\n\t\t\t\t\t\t\t: `Logout failed: ${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 = authType === \"oauth\" ? `Logged in to ${providerName}` : `Saved API key for ${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 = `${actionLabel}, but no default model is configured for provider \"${providerId}\". Use /model to select a model.`;\n\t\t\t} else if (providerModels.length === 0) {\n\t\t\t\tselectionError = `${actionLabel}, but no models are available for that provider. Use /model to select a model.`;\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 = `${actionLabel}, but its default model \"${defaultModelId}\" is not available. Use /model to select a model.`;\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 = `${actionLabel}, but selecting its default model failed: ${errorMessage}. Use /model to select a model.`;\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(`${actionLabel}. Selected ${selectedModel.id}. Credentials saved to ${getAuthPath()}`);\n\t\t\tvoid host.maybeWarnAboutAnthropicSubscriptionAuth(selectedModel);\n\t\t\thost.checkDaxnutsEasterEgg(selectedModel);\n\t\t} else {\n\t\t\thost.showStatus(`${actionLabel}. Credentials saved to ${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(`${actionLabel}. Credentials saved to ${getAuthPath()}. Refreshing model catalog…`);\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(`${actionLabel}, but its model catalog refresh timed out; using cached models.`);\n\t\t\t} else if (result.errors.size > 0) {\n\t\t\t\thost.showWarning(`${actionLabel}, but its model catalog could not be refreshed; using cached models.`);\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\t`${actionLabel}, but its model catalog could not be refreshed: ${error instanceof Error ? error.message : String(error)}`,\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\t`${providerOption.name} setup`,\n\t);\n\tdialog.showInfo(`${providerOption.method?.name ?? \"Authentication\"} is configured outside ${APP_NAME}.`, [], true);\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\", \"You can also use an AWS profile, IAM keys, or role-based credentials.\"),\n\t\t\ttheme.fg(\"muted\", \"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\t`Saved API key for ${providerName}, but local model state could not be synchronized: ${errorMsg}`,\n\t\t\t);\n\t\t} else if (errorMsg !== \"Login cancelled\") {\n\t\t\thost.showError(`Failed to save API key for ${providerName}: ${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(\"Login cancelled\"));\n\t\t\t},\n\t\t\t() => {\n\t\t\t\trestoreDialog();\n\t\t\t\treject(new Error(\"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(\"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(\"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(\"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(`Logged in to ${providerName}, but local model state could not be synchronized: ${errorMsg}`);\n\t\t} else if (errorMsg !== \"Login cancelled\") {\n\t\t\thost.showError(`Failed to login to ${providerName}: ${errorMsg}`);\n\t\t}\n\t}\n}\n"]}
|
|
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;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KAAc,EAAE,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"]}
|
|
@@ -45,6 +45,7 @@ export interface CommandDispatchHost {
|
|
|
45
45
|
showAgentsView(): void;
|
|
46
46
|
handleQueueCommand(text: string | undefined): Promise<void>;
|
|
47
47
|
handleDequeueCommand(): void;
|
|
48
|
+
handleQueueListCommand(): void;
|
|
48
49
|
handleEditorCommand(): Promise<void>;
|
|
49
50
|
shutdown(options?: {
|
|
50
51
|
fromSignal?: boolean;
|
|
@@ -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,IAA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;IACzE,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,4EAA4E;IAC5E,GAAG,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,EA2KnE,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\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\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{ 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{ 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":"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,CAA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,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5D,gBAAgB,IAAI,IAAI,CAAC;CACzB;AAED,MAAM,WAAW,oBAAoB;IACpC,+DAA+D;IAC/D,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,yEAAyE;IACzE,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,4EAA4E;IAC5E,GAAG,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,EA8KnE,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\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{ 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"]}
|
|
@@ -165,6 +165,9 @@ export const COMMAND_DISPATCH_ENTRIES = [
|
|
|
165
165
|
run: (host, _text, arg) => host.handleQueueCommand(arg),
|
|
166
166
|
},
|
|
167
167
|
{ command: "/dequeue", run: (host) => host.handleDequeueCommand() },
|
|
168
|
+
// Queue manager overlay (single entry point: the /queue-list command;
|
|
169
|
+
// reorder/remove/restore are in-component keys of the overlay itself).
|
|
170
|
+
{ command: "/queue-list", run: (host) => host.handleQueueListCommand() },
|
|
168
171
|
{ command: "/editor", run: (host) => host.handleEditorCommand() },
|
|
169
172
|
{ command: "/quit", clearEditorBeforeRun: true, run: (host) => host.shutdown() },
|
|
170
173
|
// Exact-match only: every other /workflow subcommand (why/log/...) keeps
|