@draht/coding-agent 2026.10.20 → 2026.10.23
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 +138 -0
- package/agents/advisor.md +2 -2
- package/agents/architect.md +11 -33
- package/agents/debugger.md +13 -54
- package/agents/git-committer.md +18 -42
- package/agents/implementer.md +14 -36
- package/agents/investigator.md +12 -63
- package/agents/reviewer.md +16 -44
- package/agents/security-auditor.md +22 -56
- package/agents/spec-reviewer.md +13 -53
- package/agents/verifier.md +14 -33
- package/bin/drahtbank.mjs +4 -0
- package/dist/agents/advisor.md +2 -2
- package/dist/agents/architect.md +11 -33
- package/dist/agents/debugger.md +13 -54
- package/dist/agents/git-committer.md +18 -42
- package/dist/agents/implementer.md +14 -36
- package/dist/agents/investigator.md +12 -63
- package/dist/agents/reviewer.md +16 -44
- package/dist/agents/security-auditor.md +22 -56
- package/dist/agents/spec-reviewer.md +13 -53
- package/dist/agents/verifier.md +14 -33
- package/dist/bundle/chunks/anthropic-messages-VEMVBETR.js +6 -0
- package/dist/bundle/chunks/anthropic.js +1 -1
- package/dist/bundle/chunks/azure-openai-responses-EXUP6SLM.js +2 -0
- package/dist/bundle/chunks/bedrock-converse-stream.js +23 -20
- package/dist/bundle/chunks/chunk-2MJ6J5N2.js +6 -0
- package/dist/bundle/chunks/chunk-2RI4GIFP.js +166 -0
- package/dist/bundle/chunks/chunk-57PET6SW.js +82 -0
- package/dist/bundle/chunks/chunk-76YNMQ57.js +2 -0
- package/dist/bundle/chunks/chunk-AACPRSR2.js +9 -0
- package/dist/bundle/chunks/chunk-CHRFWNPF.js +1424 -0
- package/dist/bundle/chunks/chunk-CI37W6HM.js +2 -0
- package/dist/bundle/chunks/chunk-CMKX4CSI.js +6 -0
- package/dist/bundle/chunks/chunk-DHZBWXZK.js +16 -0
- package/dist/bundle/chunks/{chunk-D6TMD5Q2.js → chunk-DLVZ3EK7.js} +4 -4
- package/dist/bundle/chunks/chunk-DQ4G4IS4.js +20 -0
- package/dist/bundle/chunks/chunk-FXCTQRNN.js +2 -0
- package/dist/bundle/chunks/chunk-FXLM6UQV.js +2 -0
- package/dist/bundle/chunks/chunk-ITP6IDBA.js +20 -0
- package/dist/bundle/chunks/chunk-JRHPLIE5.js +11 -0
- package/dist/bundle/chunks/chunk-KINQOWAP.js +4 -0
- package/dist/bundle/chunks/{chunk-IWTUBX6V.js → chunk-LK54N67E.js} +5 -2
- package/dist/bundle/chunks/chunk-MBFTIGLS.js +2 -0
- package/dist/bundle/chunks/chunk-QG2WW2SA.js +2 -0
- package/dist/bundle/chunks/{chunk-KPO5375S.js → chunk-RCRGGYLW.js} +1 -1
- package/dist/bundle/chunks/chunk-RGI7SF5G.js +2 -0
- package/dist/bundle/chunks/{chunk-6ZJKIMU7.js → chunk-SYRVFGYE.js} +1 -1
- package/dist/bundle/chunks/chunk-UQSONZLL.js +479 -0
- package/dist/bundle/chunks/chunk-USCN7R2E.js +2 -0
- package/dist/bundle/chunks/chunk-XB4F3WGD.js +132 -0
- package/dist/bundle/chunks/chunk-YSIQCH4Z.js +2 -0
- package/dist/bundle/chunks/chunk-ZRPAOMVB.js +2 -0
- package/dist/bundle/chunks/{cli-PYJB6AQ3.js → cli-LGOE6EXL.js} +6 -6
- package/dist/bundle/chunks/cloudflare-workers-ai-system-one-47PK45EQ.js +2 -0
- package/dist/bundle/chunks/codemode-worker.js +188 -21
- package/dist/bundle/chunks/execute-ZVQ7ITER.js +31 -0
- package/dist/bundle/chunks/github-copilot.js +1 -1
- package/dist/bundle/chunks/google-generative-ai-PBPH45HB.js +2 -0
- package/dist/bundle/chunks/google-vertex-ZPCFQNU6.js +2 -0
- package/dist/bundle/chunks/image-resize-worker.js +1 -1
- package/dist/bundle/chunks/{llama-cpp-classify-EJ5XMSQL.js → llama-cpp-classify-MWIQKGBR.js} +3 -3
- package/dist/bundle/chunks/mistral-conversations-7ODWQ37T.js +5 -0
- package/dist/bundle/chunks/node-BZAVEWJ3.js +16 -0
- package/dist/bundle/chunks/openai-chatgpt.js +1 -1
- package/dist/bundle/chunks/openai-codex-responses-7Y2SP2GS.js +10 -0
- package/dist/bundle/chunks/openai-codex.js +1 -1
- package/dist/bundle/chunks/openai-completions-QNWYJ4H4.js +7 -0
- package/dist/bundle/chunks/openai-decisions-4PKBAPR3.js +5 -0
- package/dist/bundle/chunks/openai-responses-73WU3TQM.js +4 -0
- package/dist/bundle/chunks/opencode-go.js +1 -1
- package/dist/bundle/chunks/openrouter-images-IMWDSQ5F.js +2 -0
- package/dist/bundle/chunks/pi-messages-AMNZ7HKZ.js +8 -0
- package/dist/bundle/chunks/runtime-7BIFTREJ.js +3 -0
- package/dist/bundle/chunks/runtime-MZVF4MP6.js +2 -0
- package/dist/bundle/chunks/settings-manager-QF6DRH5C.js +2 -0
- package/dist/bundle/chunks/typesafe-system-one-AXQRIVVX.js +2 -0
- package/dist/bundle/chunks/virtual-modules-Z4F3ZUX3.js +2 -0
- package/dist/bundle/cli-runtime.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/cli/args.d.ts +2 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +30 -8
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/credential-print.d.ts.map +1 -1
- package/dist/cli/credential-print.js +4 -4
- package/dist/cli/credential-print.js.map +1 -1
- package/dist/config.d.ts +18 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +44 -6
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session.d.ts +65 -8
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +240 -102
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +20 -13
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js +42 -52
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/bug-report.d.ts +9 -1
- package/dist/core/bug-report.d.ts.map +1 -1
- package/dist/core/builtins/completion-checks.d.ts +3 -0
- package/dist/core/builtins/completion-checks.d.ts.map +1 -0
- package/dist/core/builtins/completion-checks.js +142 -0
- package/dist/core/builtins/completion-checks.js.map +1 -0
- package/dist/core/builtins/duet.d.ts.map +1 -1
- package/dist/core/builtins/duet.js +7 -5
- package/dist/core/builtins/duet.js.map +1 -1
- package/dist/core/builtins/git-safety.d.ts +3 -0
- package/dist/core/builtins/git-safety.d.ts.map +1 -0
- package/dist/core/builtins/git-safety.js +34 -0
- package/dist/core/builtins/git-safety.js.map +1 -0
- package/dist/core/builtins/index.d.ts.map +1 -1
- package/dist/core/builtins/index.js +4 -0
- package/dist/core/builtins/index.js.map +1 -1
- package/dist/core/client-identity.d.ts +8 -0
- package/dist/core/client-identity.d.ts.map +1 -0
- package/dist/core/client-identity.js +15 -0
- package/dist/core/client-identity.js.map +1 -0
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +1 -2
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +2 -2
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +20 -15
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/compaction/utils.d.ts +6 -0
- package/dist/core/compaction/utils.d.ts.map +1 -1
- package/dist/core/compaction/utils.js +7 -8
- package/dist/core/compaction/utils.js.map +1 -1
- package/dist/core/export-html/index.d.ts.map +1 -1
- package/dist/core/export-html/index.js +2 -0
- package/dist/core/export-html/index.js.map +1 -1
- package/dist/core/export-html/template.html +1 -0
- package/dist/core/export-html/template.js +23 -17
- package/dist/core/export-html/tool-renderer.d.ts +3 -3
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
- package/dist/core/export-html/tool-renderer.js +5 -3
- package/dist/core/export-html/tool-renderer.js.map +1 -1
- package/dist/core/export-html/vendor/marked-cjk-friendly.min.js +6 -0
- package/dist/core/export-html/vendor/marked.min.js +30 -29
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +7 -0
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +6 -2
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +16 -4
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +61 -7
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/extensions/virtual-modules.d.ts.map +1 -1
- package/dist/core/extensions/virtual-modules.js +2 -0
- package/dist/core/extensions/virtual-modules.js.map +1 -1
- package/dist/core/key-id-schema.d.ts +6 -0
- package/dist/core/key-id-schema.d.ts.map +1 -0
- package/dist/core/key-id-schema.js +16 -0
- package/dist/core/key-id-schema.js.map +1 -0
- package/dist/core/keybindings-schema.d.ts +4 -0
- package/dist/core/keybindings-schema.d.ts.map +1 -0
- package/dist/core/keybindings-schema.js +16 -0
- package/dist/core/keybindings-schema.js.map +1 -0
- package/dist/core/keybindings.d.ts +242 -75
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +30 -23
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/mcp-servers.d.ts +22 -0
- package/dist/core/mcp-servers.d.ts.map +1 -1
- package/dist/core/mcp-servers.js +72 -11
- package/dist/core/mcp-servers.js.map +1 -1
- package/dist/core/model-config.d.ts +1623 -74
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +70 -184
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-registry.d.ts +3 -1
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +4 -0
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts +56 -43
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +253 -358
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +19 -10
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/nested-tool-calls.d.ts +1 -0
- package/dist/core/nested-tool-calls.d.ts.map +1 -1
- package/dist/core/nested-tool-calls.js +1 -0
- package/dist/core/nested-tool-calls.js.map +1 -1
- package/dist/core/package-manager.js +3 -3
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/polyphase/keyword.js +1 -1
- package/dist/core/polyphase/keyword.js.map +1 -1
- package/dist/core/polyphase/model-selection.d.ts.map +1 -1
- package/dist/core/polyphase/model-selection.js +15 -7
- package/dist/core/polyphase/model-selection.js.map +1 -1
- package/dist/core/polyphase/workflow/prelude.d.ts +2 -0
- package/dist/core/polyphase/workflow/prelude.d.ts.map +1 -1
- package/dist/core/polyphase/workflow/prelude.js +12 -16
- package/dist/core/polyphase/workflow/prelude.js.map +1 -1
- package/dist/core/polyphase/workflow/runtime.d.ts.map +1 -1
- package/dist/core/polyphase/workflow/runtime.js +2 -1
- package/dist/core/polyphase/workflow/runtime.js.map +1 -1
- package/dist/core/project-trust.d.ts.map +1 -1
- package/dist/core/project-trust.js +2 -1
- package/dist/core/project-trust.js.map +1 -1
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/prompt-templates.js +7 -2
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/provider-composer.d.ts +2 -1
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +13 -0
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/radius.d.ts +2 -0
- package/dist/core/radius.d.ts.map +1 -1
- package/dist/core/radius.js +2 -0
- package/dist/core/radius.js.map +1 -1
- package/dist/core/remote-catalog-provider.d.ts +12 -1
- package/dist/core/remote-catalog-provider.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.js +84 -24
- package/dist/core/remote-catalog-provider.js.map +1 -1
- package/dist/core/resource-loader.d.ts +3 -0
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +7 -4
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/sdk.d.ts +13 -4
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +27 -15
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/settings-defaults.d.ts +65 -0
- package/dist/core/settings-defaults.d.ts.map +1 -0
- package/dist/core/settings-defaults.js +66 -0
- package/dist/core/settings-defaults.js.map +1 -0
- package/dist/core/settings-manager.d.ts +17 -178
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +86 -57
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/settings-schema.d.ts +269 -0
- package/dist/core/settings-schema.d.ts.map +1 -0
- package/dist/core/settings-schema.js +318 -0
- package/dist/core/settings-schema.js.map +1 -0
- package/dist/core/skills.d.ts +4 -1
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +6 -1
- package/dist/core/skills.js.map +1 -1
- package/dist/core/system-prompt.d.ts +6 -0
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +10 -5
- 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 +3 -5
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/grep.d.ts +8 -0
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +19 -7
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/index.d.ts +2 -0
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +2 -0
- 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 +4 -10
- package/dist/core/tools/output-accumulator.js.map +1 -1
- package/dist/core/tools/path-utils.d.ts +1 -1
- package/dist/core/tools/path-utils.d.ts.map +1 -1
- package/dist/core/tools/path-utils.js +6 -6
- package/dist/core/tools/path-utils.js.map +1 -1
- package/dist/core/tools/read.d.ts +13 -0
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +32 -2
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/render-utils.d.ts +20 -0
- package/dist/core/tools/render-utils.d.ts.map +1 -1
- package/dist/core/tools/render-utils.js +67 -0
- package/dist/core/tools/render-utils.js.map +1 -1
- package/dist/core/tools/renderers/bash.d.ts.map +1 -1
- package/dist/core/tools/renderers/bash.js +7 -35
- package/dist/core/tools/renderers/bash.js.map +1 -1
- package/dist/core/tools/renderers/edit.d.ts.map +1 -1
- package/dist/core/tools/renderers/edit.js +5 -4
- package/dist/core/tools/renderers/edit.js.map +1 -1
- package/dist/core/tools/renderers/index.d.ts +2 -2
- package/dist/core/tools/renderers/index.d.ts.map +1 -1
- package/dist/core/tools/renderers/index.js.map +1 -1
- package/dist/core/tools/renderers/read.d.ts.map +1 -1
- package/dist/core/tools/renderers/read.js +7 -11
- package/dist/core/tools/renderers/read.js.map +1 -1
- package/dist/extensions/codemode/execute.d.ts.map +1 -1
- package/dist/extensions/codemode/execute.js +391 -80
- package/dist/extensions/codemode/execute.js.map +1 -1
- package/dist/extensions/codemode/index.d.ts.map +1 -1
- package/dist/extensions/codemode/index.js +3 -1
- package/dist/extensions/codemode/index.js.map +1 -1
- package/dist/extensions/codemode/renderer.d.ts +2 -2
- package/dist/extensions/codemode/renderer.d.ts.map +1 -1
- package/dist/extensions/codemode/renderer.js +9 -3
- package/dist/extensions/codemode/renderer.js.map +1 -1
- package/dist/extensions/codemode/tool.d.ts +22 -21
- package/dist/extensions/codemode/tool.d.ts.map +1 -1
- package/dist/extensions/codemode/tool.js +96 -123
- package/dist/extensions/codemode/tool.js.map +1 -1
- package/dist/extensions/llama/provider.d.ts.map +1 -1
- package/dist/extensions/llama/provider.js +34 -11
- package/dist/extensions/llama/provider.js.map +1 -1
- package/dist/extensions/mcp/cli.d.ts.map +1 -1
- package/dist/extensions/mcp/cli.js +27 -33
- package/dist/extensions/mcp/cli.js.map +1 -1
- package/dist/extensions/mcp/config.d.ts +15 -3
- package/dist/extensions/mcp/config.d.ts.map +1 -1
- package/dist/extensions/mcp/config.js +49 -12
- package/dist/extensions/mcp/config.js.map +1 -1
- package/dist/extensions/mcp/index.d.ts +4 -1
- package/dist/extensions/mcp/index.d.ts.map +1 -1
- package/dist/extensions/mcp/index.js +279 -129
- package/dist/extensions/mcp/index.js.map +1 -1
- package/dist/extensions/mcp/oauth.d.ts +21 -11
- package/dist/extensions/mcp/oauth.d.ts.map +1 -1
- package/dist/extensions/mcp/oauth.js +166 -45
- package/dist/extensions/mcp/oauth.js.map +1 -1
- package/dist/extensions/mcp/resources.d.ts +3 -10
- package/dist/extensions/mcp/resources.d.ts.map +1 -1
- package/dist/extensions/mcp/resources.js +4 -5
- package/dist/extensions/mcp/resources.js.map +1 -1
- package/dist/extensions/mcp/runtime.d.ts +7 -7
- package/dist/extensions/mcp/runtime.d.ts.map +1 -1
- package/dist/extensions/mcp/runtime.js +31 -45
- package/dist/extensions/mcp/runtime.js.map +1 -1
- package/dist/extensions/mcp/tools.d.ts +7 -5
- package/dist/extensions/mcp/tools.d.ts.map +1 -1
- package/dist/extensions/mcp/tools.js +87 -29
- package/dist/extensions/mcp/tools.js.map +1 -1
- package/dist/extensions/mcp/ui.d.ts +3 -3
- package/dist/extensions/mcp/ui.d.ts.map +1 -1
- package/dist/extensions/mcp/ui.js +18 -6
- package/dist/extensions/mcp/ui.js.map +1 -1
- package/dist/extensions/tool-search/tool.d.ts +0 -2
- package/dist/extensions/tool-search/tool.d.ts.map +1 -1
- package/dist/extensions/tool-search/tool.js +2 -4
- package/dist/extensions/tool-search/tool.js.map +1 -1
- package/dist/hooks/checks/checks-runtime.cjs +215 -0
- package/dist/hooks/checks/git-safety.cjs +198 -0
- package/dist/hooks/checks/git-safety.d.cts +1 -0
- package/dist/hooks/gsd/draht-post-task.js +78 -39
- package/dist/hooks/gsd/draht-quality-gate.js +210 -122
- package/dist/hooks/gsd/package.json +3 -0
- package/dist/index.d.ts +5 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +11 -3
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/auth-url.d.ts +14 -0
- package/dist/modes/interactive/components/auth-url.d.ts.map +1 -0
- package/dist/modes/interactive/components/auth-url.js +37 -0
- package/dist/modes/interactive/components/auth-url.js.map +1 -0
- package/dist/modes/interactive/components/bash-execution.d.ts +5 -1
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js +17 -14
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts +2 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.js +5 -2
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +2 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.js +5 -2
- package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/custom-entry.d.ts +3 -1
- package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-entry.js +8 -2
- package/dist/modes/interactive/components/custom-entry.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-message.js +1 -0
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts +3 -0
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +38 -10
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts +8 -2
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +24 -21
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/radius-login-selector.d.ts +15 -0
- package/dist/modes/interactive/components/radius-login-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/radius-login-selector.js +85 -0
- package/dist/modes/interactive/components/radius-login-selector.js.map +1 -0
- package/dist/modes/interactive/components/settings-selector.d.ts +3 -3
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +9 -8
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +2 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.js +5 -2
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
- package/dist/modes/interactive/components/status-indicator.d.ts +1 -1
- package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
- package/dist/modes/interactive/components/status-indicator.js +2 -2
- package/dist/modes/interactive/components/status-indicator.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +12 -13
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +32 -45
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +2 -9
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message.js +5 -4
- package/dist/modes/interactive/components/user-message.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +43 -48
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +362 -278
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/program-status-reporter.d.ts +34 -0
- package/dist/modes/interactive/program-status-reporter.d.ts.map +1 -0
- package/dist/modes/interactive/program-status-reporter.js +110 -0
- package/dist/modes/interactive/program-status-reporter.js.map +1 -0
- package/dist/modes/interactive/theme/dark.json +1 -1
- package/dist/modes/interactive/theme/light.json +1 -1
- package/dist/modes/interactive/theme/system-theme.d.ts +2 -1
- package/dist/modes/interactive/theme/system-theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/system-theme.js +16 -5
- package/dist/modes/interactive/theme/system-theme.js.map +1 -1
- package/dist/modes/interactive/theme/theme-schema.d.ts +28 -0
- package/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-schema.js +105 -0
- package/dist/modes/interactive/theme/theme-schema.js.map +1 -0
- package/dist/modes/interactive/theme/theme-tokens.d.ts +257 -0
- package/dist/modes/interactive/theme/theme-tokens.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-tokens.js +94 -0
- package/dist/modes/interactive/theme/theme-tokens.js.map +1 -0
- package/dist/modes/interactive/theme/theme.d.ts +13 -16
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +22 -29
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +4 -0
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +26 -1
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/prompts/commands/atomic-commit.md +8 -6
- package/dist/prompts/commands/brainstorm.md +5 -149
- package/dist/prompts/commands/create-verification-skill.md +8 -48
- package/dist/prompts/commands/discuss-phase.md +6 -10
- package/dist/prompts/commands/execute-phase.md +18 -45
- package/dist/prompts/commands/fix.md +16 -128
- package/dist/prompts/commands/grill.md +6 -53
- package/dist/prompts/commands/init-project.md +13 -18
- package/dist/prompts/commands/map-codebase.md +3 -3
- package/dist/prompts/commands/new-project.md +12 -17
- package/dist/prompts/commands/next-milestone.md +4 -8
- package/dist/prompts/commands/orchestrate-loop.md +12 -12
- package/dist/prompts/commands/orchestrate.md +12 -11
- package/dist/prompts/commands/pause-work.md +1 -1
- package/dist/prompts/commands/plan-phase.md +15 -37
- package/dist/prompts/commands/quick.md +11 -64
- package/dist/prompts/commands/resolve-conflicts.md +2 -15
- package/dist/prompts/commands/triage.md +3 -14
- package/dist/prompts/commands/verify-work.md +15 -63
- package/dist/prompts/commands/why.md +18 -118
- package/dist/skills/atomic-reasoning/SKILL.md +6 -105
- package/dist/skills/blast-radius/SKILL.md +1 -1
- package/dist/skills/epistemics/SKILL.md +12 -87
- package/dist/skills/explainers/SKILL.md +1 -1
- package/dist/skills/typescript-discipline/SKILL.md +12 -42
- package/dist/skills/typescript-discipline/references/patterns.md +25 -266
- package/dist/skills/unslop/SKILL.md +14 -105
- package/dist/utils/ansi.d.ts +8 -0
- package/dist/utils/ansi.d.ts.map +1 -1
- package/dist/utils/ansi.js +30 -11
- package/dist/utils/ansi.js.map +1 -1
- package/dist/utils/clipboard-command.d.ts.map +1 -1
- package/dist/utils/clipboard-command.js +3 -0
- package/dist/utils/clipboard-command.js.map +1 -1
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +18 -12
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/draht-user-agent.d.ts +1 -0
- package/dist/utils/draht-user-agent.d.ts.map +1 -1
- package/dist/utils/draht-user-agent.js +3 -2
- package/dist/utils/draht-user-agent.js.map +1 -1
- package/dist/utils/image-convert.d.ts +12 -0
- package/dist/utils/image-convert.d.ts.map +1 -1
- package/dist/utils/image-convert.js +45 -6
- package/dist/utils/image-convert.js.map +1 -1
- package/dist/utils/image-resize-core.d.ts +12 -0
- package/dist/utils/image-resize-core.d.ts.map +1 -1
- package/dist/utils/image-resize-core.js +5 -0
- package/dist/utils/image-resize-core.js.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/image-resize.d.ts.map +1 -1
- package/dist/utils/image-resize.js +9 -10
- package/dist/utils/image-resize.js.map +1 -1
- package/dist/utils/output-files.d.ts +15 -0
- package/dist/utils/output-files.d.ts.map +1 -0
- package/dist/utils/output-files.js +30 -0
- package/dist/utils/output-files.js.map +1 -0
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +43 -13
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/syntax-highlight.d.ts.map +1 -1
- package/dist/utils/syntax-highlight.js +6 -1
- package/dist/utils/syntax-highlight.js.map +1 -1
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +4 -3
- package/dist/utils/tools-manager.js.map +1 -1
- package/docs/cli-integration.md +1 -1
- package/docs/cli.md +30 -26
- package/docs/codemode.md +230 -0
- package/docs/compaction.md +5 -5
- package/docs/containerization.md +1 -1
- package/docs/custom-provider.md +53 -1
- package/docs/docs.json +17 -1
- package/docs/drahtbank.md +163 -0
- package/docs/environment-variables.md +5 -2
- package/docs/extensions.md +143 -13
- package/docs/index.md +1 -1
- package/docs/json.md +3 -3
- package/docs/keybindings.md +9 -5
- package/docs/llama-cpp.md +9 -2
- package/docs/mcp.md +59 -3
- package/docs/message-types.md +22 -4
- package/docs/models-configuration.md +187 -0
- package/docs/models.md +67 -4
- package/docs/nvidia-rtx-llama-cpp.md +96 -0
- package/docs/providers.md +70 -5
- package/docs/sdk.md +1 -1
- package/docs/settings.md +10 -8
- package/docs/terminal-setup.md +14 -0
- package/docs/themes.md +4 -2
- package/docs/tui.md +71 -1
- package/docs/usage.md +1 -1
- package/docs/windows.md +16 -2
- package/eval/drahtbank/adapters.d.mts +35 -0
- package/eval/drahtbank/adapters.mjs +192 -0
- package/eval/drahtbank/bank.d.mts +141 -0
- package/eval/drahtbank/bank.mjs +515 -0
- package/eval/drahtbank/cases-v2.d.mts +28 -0
- package/eval/drahtbank/cases-v2.mjs +164 -0
- package/eval/drahtbank/cases.d.mts +17 -0
- package/eval/drahtbank/cases.mjs +198 -0
- package/eval/drahtbank/cli.mjs +120 -0
- package/eval/drahtbank/grading-v2.d.mts +26 -0
- package/eval/drahtbank/grading-v2.mjs +227 -0
- package/eval/drahtbank/isolated-tools.ts +223 -0
- package/eval/drahtbank/isolation-worker.mjs +53 -0
- package/eval/drahtbank/isolation.d.mts +52 -0
- package/eval/drahtbank/isolation.mjs +345 -0
- package/eval/drahtbank/runtime-checks.d.mts +15 -0
- package/eval/drahtbank/runtime-checks.mjs +187 -0
- package/examples/extensions/dynamic-resources/dynamic.json +1 -1
- package/examples/extensions/minimal-mode.ts +4 -5
- package/examples/extensions/overlay-test.ts +2 -2
- package/examples/extensions/plan-mode/index.ts +6 -2
- package/examples/extensions/subagent/index.ts +4 -6
- package/hooks/checks/checks-runtime.cjs +215 -0
- package/hooks/checks/git-safety.cjs +198 -0
- package/hooks/checks/git-safety.d.cts +1 -0
- package/hooks/gsd/draht-post-task.js +78 -39
- package/hooks/gsd/draht-quality-gate.js +210 -122
- package/hooks/gsd/package.json +3 -0
- package/package.json +21 -16
- package/prompts/commands/atomic-commit.md +8 -6
- package/prompts/commands/brainstorm.md +5 -149
- package/prompts/commands/create-verification-skill.md +8 -48
- package/prompts/commands/discuss-phase.md +6 -10
- package/prompts/commands/execute-phase.md +18 -45
- package/prompts/commands/fix.md +16 -128
- package/prompts/commands/grill.md +6 -53
- package/prompts/commands/init-project.md +13 -18
- package/prompts/commands/map-codebase.md +3 -3
- package/prompts/commands/new-project.md +12 -17
- package/prompts/commands/next-milestone.md +4 -8
- package/prompts/commands/orchestrate-loop.md +12 -12
- package/prompts/commands/orchestrate.md +12 -11
- package/prompts/commands/pause-work.md +1 -1
- package/prompts/commands/plan-phase.md +15 -37
- package/prompts/commands/quick.md +11 -64
- package/prompts/commands/resolve-conflicts.md +2 -15
- package/prompts/commands/triage.md +3 -14
- package/prompts/commands/verify-work.md +15 -63
- package/prompts/commands/why.md +18 -118
- package/schemas/keybindings.schema.json +433 -0
- package/schemas/models.schema.json +1190 -0
- package/schemas/settings.schema.json +849 -0
- package/schemas/theme.schema.json +365 -0
- package/skills/atomic-reasoning/SKILL.md +6 -105
- package/skills/blast-radius/SKILL.md +1 -1
- package/skills/epistemics/SKILL.md +12 -87
- package/skills/explainers/SKILL.md +1 -1
- package/skills/typescript-discipline/SKILL.md +12 -42
- package/skills/typescript-discipline/references/patterns.md +25 -266
- package/skills/unslop/SKILL.md +14 -105
- package/dist/bundle/chunks/anthropic-messages-GAKYXF65.js +0 -6
- package/dist/bundle/chunks/azure-openai-responses-ZIXMK6JO.js +0 -2
- package/dist/bundle/chunks/chunk-2E5VODES.js +0 -2
- package/dist/bundle/chunks/chunk-2VAF4XJI.js +0 -146
- package/dist/bundle/chunks/chunk-4TVQYRQY.js +0 -2
- package/dist/bundle/chunks/chunk-7TYCZN4Z.js +0 -137
- package/dist/bundle/chunks/chunk-BXSHCX3G.js +0 -11
- package/dist/bundle/chunks/chunk-GVXA72ZA.js +0 -2
- package/dist/bundle/chunks/chunk-I5OKY6RH.js +0 -11
- package/dist/bundle/chunks/chunk-KU5HAKZL.js +0 -4
- package/dist/bundle/chunks/chunk-MO3SCGBN.js +0 -18
- package/dist/bundle/chunks/chunk-N2QZNJT6.js +0 -65
- package/dist/bundle/chunks/chunk-PGJAHC3R.js +0 -107
- package/dist/bundle/chunks/chunk-QVFELZW2.js +0 -312
- package/dist/bundle/chunks/chunk-RZKPFWMH.js +0 -42
- package/dist/bundle/chunks/chunk-SDRCE6OP.js +0 -2
- package/dist/bundle/chunks/chunk-SVNWI7EV.js +0 -8
- package/dist/bundle/chunks/chunk-TOWVIJ2O.js +0 -1623
- package/dist/bundle/chunks/chunk-XBUEMKIY.js +0 -2
- package/dist/bundle/chunks/chunk-ZA4QNPJY.js +0 -82
- package/dist/bundle/chunks/cloudflare-workers-ai-system-one-MJKOAE5S.js +0 -2
- package/dist/bundle/chunks/execute-6N7T7VLY.js +0 -18
- package/dist/bundle/chunks/google-generative-ai-RPUPQ6PM.js +0 -2
- package/dist/bundle/chunks/google-vertex-EZES5QVQ.js +0 -2
- package/dist/bundle/chunks/mistral-conversations-AOYGU43Y.js +0 -5
- package/dist/bundle/chunks/node-LQ52KV6B.js +0 -16
- package/dist/bundle/chunks/openai-codex-responses-M2Y77JEQ.js +0 -10
- package/dist/bundle/chunks/openai-completions-A4OKYOYV.js +0 -7
- package/dist/bundle/chunks/openai-responses-6IXV53T3.js +0 -3
- package/dist/bundle/chunks/openrouter-images-LYV4NKFM.js +0 -2
- package/dist/bundle/chunks/pi-messages-KKMEUT3Z.js +0 -8
- package/dist/bundle/chunks/runtime-363BOYEO.js +0 -3
- package/dist/bundle/chunks/runtime-D3KV73AE.js +0 -2
- package/dist/bundle/chunks/settings-manager-GEOZJXFQ.js +0 -2
- package/dist/bundle/chunks/typesafe-system-one-YBEEY5XU.js +0 -2
- package/dist/bundle/chunks/virtual-modules-RLC4Y5MX.js +0 -2
- package/dist/core/provider-attribution.d.ts +0 -4
- package/dist/core/provider-attribution.d.ts.map +0 -1
- package/dist/core/provider-attribution.js +0 -72
- package/dist/core/provider-attribution.js.map +0 -1
- package/dist/experimental/micro/api.d.ts +0 -81
- package/dist/experimental/micro/api.d.ts.map +0 -1
- package/dist/experimental/micro/api.js +0 -2
- package/dist/experimental/micro/api.js.map +0 -1
- package/dist/experimental/micro/main.d.ts +0 -3
- package/dist/experimental/micro/main.d.ts.map +0 -1
- package/dist/experimental/micro/main.js +0 -21
- package/dist/experimental/micro/main.js.map +0 -1
- package/dist/experimental/micro/models.d.ts +0 -11
- package/dist/experimental/micro/models.d.ts.map +0 -1
- package/dist/experimental/micro/models.js +0 -95
- package/dist/experimental/micro/models.js.map +0 -1
- package/dist/experimental/micro/runtime.d.ts +0 -12
- package/dist/experimental/micro/runtime.d.ts.map +0 -1
- package/dist/experimental/micro/runtime.js +0 -465
- package/dist/experimental/micro/runtime.js.map +0 -1
- package/dist/experimental/micro/sessions.d.ts +0 -10
- package/dist/experimental/micro/sessions.d.ts.map +0 -1
- package/dist/experimental/micro/sessions.js +0 -41
- package/dist/experimental/micro/sessions.js.map +0 -1
- package/dist/experimental/micro/tools.d.ts +0 -10
- package/dist/experimental/micro/tools.d.ts.map +0 -1
- package/dist/experimental/micro/tools.js +0 -96
- package/dist/experimental/micro/tools.js.map +0 -1
- package/dist/experimental/micro/tui.d.ts +0 -3
- package/dist/experimental/micro/tui.d.ts.map +0 -1
- package/dist/experimental/micro/tui.js +0 -510
- package/dist/experimental/micro/tui.js.map +0 -1
- package/dist/experimental/mini/main.d.ts +0 -7
- package/dist/experimental/mini/main.d.ts.map +0 -1
- package/dist/experimental/mini/main.js +0 -21
- package/dist/experimental/mini/main.js.map +0 -1
- package/dist/experimental/mini/server/entry.d.ts +0 -3
- package/dist/experimental/mini/server/entry.d.ts.map +0 -1
- package/dist/experimental/mini/server/entry.js +0 -11
- package/dist/experimental/mini/server/entry.js.map +0 -1
- package/dist/experimental/mini/server/run.d.ts +0 -13
- package/dist/experimental/mini/server/run.d.ts.map +0 -1
- package/dist/experimental/mini/server/run.js +0 -150
- package/dist/experimental/mini/server/run.js.map +0 -1
- package/dist/experimental/mini/shared/protocol.d.ts +0 -127
- package/dist/experimental/mini/shared/protocol.d.ts.map +0 -1
- package/dist/experimental/mini/shared/protocol.js +0 -13
- package/dist/experimental/mini/shared/protocol.js.map +0 -1
- package/dist/experimental/mini/shared/rpc.d.ts +0 -49
- package/dist/experimental/mini/shared/rpc.d.ts.map +0 -1
- package/dist/experimental/mini/shared/rpc.js +0 -171
- package/dist/experimental/mini/shared/rpc.js.map +0 -1
- package/dist/experimental/mini/shared/transport.d.ts +0 -35
- package/dist/experimental/mini/shared/transport.d.ts.map +0 -1
- package/dist/experimental/mini/shared/transport.js +0 -94
- package/dist/experimental/mini/shared/transport.js.map +0 -1
- package/dist/experimental/mini/tui/run.d.ts +0 -9
- package/dist/experimental/mini/tui/run.d.ts.map +0 -1
- package/dist/experimental/mini/tui/run.js +0 -62
- package/dist/experimental/mini/tui/run.js.map +0 -1
- package/dist/experimental/mini/tui/session.d.ts +0 -26
- package/dist/experimental/mini/tui/session.d.ts.map +0 -1
- package/dist/experimental/mini/tui/session.js +0 -94
- package/dist/experimental/mini/tui/session.js.map +0 -1
- package/dist/experimental/mini/tui/view.d.ts +0 -10
- package/dist/experimental/mini/tui/view.d.ts.map +0 -1
- package/dist/experimental/mini/tui/view.js +0 -461
- package/dist/experimental/mini/tui/view.js.map +0 -1
- package/dist/experimental/mini/worker/entry.d.ts +0 -3
- package/dist/experimental/mini/worker/entry.d.ts.map +0 -1
- package/dist/experimental/mini/worker/entry.js +0 -10
- package/dist/experimental/mini/worker/entry.js.map +0 -1
- package/dist/experimental/mini/worker/lane-service.d.ts +0 -44
- package/dist/experimental/mini/worker/lane-service.d.ts.map +0 -1
- package/dist/experimental/mini/worker/lane-service.js +0 -97
- package/dist/experimental/mini/worker/lane-service.js.map +0 -1
- package/dist/experimental/mini/worker/models-service.d.ts +0 -19
- package/dist/experimental/mini/worker/models-service.d.ts.map +0 -1
- package/dist/experimental/mini/worker/models-service.js +0 -136
- package/dist/experimental/mini/worker/models-service.js.map +0 -1
- package/dist/experimental/mini/worker/run.d.ts +0 -14
- package/dist/experimental/mini/worker/run.d.ts.map +0 -1
- package/dist/experimental/mini/worker/run.js +0 -88
- package/dist/experimental/mini/worker/run.js.map +0 -1
- package/dist/modes/interactive/theme/theme-json.d.ts +0 -85
- package/dist/modes/interactive/theme/theme-json.d.ts.map +0 -1
- package/dist/modes/interactive/theme/theme-json.js +0 -132
- package/dist/modes/interactive/theme/theme-json.js.map +0 -1
- package/dist/modes/interactive/theme/theme-schema.json +0 -361
|
@@ -11,7 +11,7 @@ import * as TuiLayouts from "@draht/tui";
|
|
|
11
11
|
import { CombinedAutocompleteProvider, Container, fuzzyFilter, getCapabilities, hyperlink, Markdown, matchesKey, Spacer, setCapabilityOverrides, setKeybindings, Text, TruncatedText, TuiAltScreen, TuiMainScreen, visibleWidth, } from "@draht/tui";
|
|
12
12
|
import chalk from "chalk";
|
|
13
13
|
import { spawn } from "child_process";
|
|
14
|
-
import { APP_NAME, APP_TITLE, CONFIG_DIR_NAME, DISPLAY_VERSION, getAgentDir, getAuthPath, getDebugLogPath, getDocsPath, VERSION, } from "../../config.js";
|
|
14
|
+
import { APP_NAME, APP_TITLE, CONFIG_DIR_NAME, DISPLAY_VERSION, detectInstallChange, getAgentDir, getAuthPath, getDebugLogPath, getDocsPath, VERSION, } from "../../config.js";
|
|
15
15
|
import { parseSkillBlock } from "../../core/agent-session.js";
|
|
16
16
|
import { SessionImportFileNotFoundError } from "../../core/agent-session-runtime.js";
|
|
17
17
|
import { CACHE_TTL_MS, collectCacheMisses, computeCacheWaste, detectCacheMiss, } from "../../core/cache-stats.js";
|
|
@@ -28,6 +28,7 @@ import { createCompactionSummaryMessage, createCustomMessage } from "../../core/
|
|
|
28
28
|
import { defaultModelPerProvider, findExactModelReferenceMatch, resolveModelScopeFromModels, } from "../../core/model-resolver.js";
|
|
29
29
|
import { CredentialSynchronizationError } from "../../core/model-runtime.js";
|
|
30
30
|
import { DefaultPackageManager } from "../../core/package-manager.js";
|
|
31
|
+
import { RADIUS_MCP_URL, RADIUS_PROVIDER_ID } from "../../core/radius.js";
|
|
31
32
|
import { formatMissingSessionCwdPrompt, MissingSessionCwdError } from "../../core/session-cwd.js";
|
|
32
33
|
import { SessionManager, sessionEntryToContextMessages, } from "../../core/session-manager.js";
|
|
33
34
|
import { BUILTIN_SLASH_COMMANDS } from "../../core/slash-commands.js";
|
|
@@ -35,10 +36,12 @@ import { boundedSafeText } from "../../core/socket-server/safe-text.js";
|
|
|
35
36
|
import { withBuiltInRenderers } from "../../core/tools/renderers/index.js";
|
|
36
37
|
import { hasTrustRequiringProjectResources, ProjectTrustStore } from "../../core/trust-manager.js";
|
|
37
38
|
import { getUsageCostBreakdown } from "../../core/usage-totals.js";
|
|
39
|
+
import { addMcpServerConfig, loadMcpConfig } from "../../extensions/mcp/config.js";
|
|
38
40
|
import { getChangelogPath, getNewEntries, normalizeChangelogLinks, parseChangelog } from "../../utils/changelog.js";
|
|
39
41
|
import { copyToClipboard, readClipboardFilePaths, readClipboardText } from "../../utils/clipboard.js";
|
|
40
42
|
import { extensionForImageMimeType, readClipboardImage } from "../../utils/clipboard-image.js";
|
|
41
43
|
import { parseGitUrl } from "../../utils/git.js";
|
|
44
|
+
import { ensurePngTranscoder } from "../../utils/image-convert.js";
|
|
42
45
|
import { sendTerminalNotification } from "../../utils/notify.js";
|
|
43
46
|
import { getCwdRelativePath } from "../../utils/paths.js";
|
|
44
47
|
import { killTrackedDetachedChildren } from "../../utils/shell.js";
|
|
@@ -66,7 +69,8 @@ import { formatKeyText, keyDisplayText, keyHint, keyText, rawKeyHint } from "./c
|
|
|
66
69
|
import { LoginDialogComponent } from "./components/login-dialog.js";
|
|
67
70
|
import { createMermaidMarkdownTransformer } from "./components/mermaid.js";
|
|
68
71
|
import { ModelSelectorComponent } from "./components/model-selector.js";
|
|
69
|
-
import { formatAuthSelectorProviderType, OAuthSelectorComponent, } from "./components/oauth-selector.js";
|
|
72
|
+
import { formatAuthSelectorProviderStatus, formatAuthSelectorProviderType, OAuthSelectorComponent, } from "./components/oauth-selector.js";
|
|
73
|
+
import { createLoginMenuSelector } from "./components/radius-login-selector.js";
|
|
70
74
|
import { ScopedModelsSelectorComponent } from "./components/scoped-models-selector.js";
|
|
71
75
|
import { SessionSelectorComponent } from "./components/session-selector.js";
|
|
72
76
|
import { SettingsSelectorComponent } from "./components/settings-selector.js";
|
|
@@ -82,12 +86,13 @@ import { UserMessageSelectorComponent } from "./components/user-message-selector
|
|
|
82
86
|
import { editInExternalEditor } from "./external-editor.js";
|
|
83
87
|
import { refreshModelCatalogs } from "./model-catalog-refresh.js";
|
|
84
88
|
import { getModelSearchText } from "./model-search.js";
|
|
89
|
+
import { ProgramStatusReporter } from "./program-status-reporter.js";
|
|
85
90
|
import { shareSession } from "./session-share.js";
|
|
86
91
|
import { getAvailableThemes, getAvailableThemesWithPaths, getEditorTheme, getMarkdownTheme, getThemeByName, onThemeChange, SYSTEM_THEME_NAME, setRegisteredThemes, stopThemeWatcher, Theme, theme, } from "./theme/theme.js";
|
|
87
92
|
import { InteractiveThemeController } from "./theme/theme-controller.js";
|
|
88
93
|
import { createInteractiveTui, createInteractiveTuiReference } from "./tui-renderer.js";
|
|
89
94
|
export { createInteractiveTui, createInteractiveTuiReference } from "./tui-renderer.js";
|
|
90
|
-
function
|
|
95
|
+
function isEmbeddedStatus(editor) {
|
|
91
96
|
return ("embedWorkingStatus" in editor &&
|
|
92
97
|
editor.embedWorkingStatus === true &&
|
|
93
98
|
"setWorkingStatusIndicator" in editor &&
|
|
@@ -117,7 +122,9 @@ function isCompactionCostNotice(item) {
|
|
|
117
122
|
function isUsageSessionEntry(item) {
|
|
118
123
|
return "type" in item && item.type === "usage";
|
|
119
124
|
}
|
|
120
|
-
|
|
125
|
+
// EIO: tty reads/ioctls from an orphaned background process group, or writes after hangup.
|
|
126
|
+
// ENOTTY: the tty was revoked (macOS) and stdin is no longer a terminal.
|
|
127
|
+
const DEAD_TERMINAL_ERROR_CODES = new Set(["EIO", "EPIPE", "ENOTCONN", "ENOTTY"]);
|
|
121
128
|
function isDeadTerminalError(error) {
|
|
122
129
|
if (!error || typeof error !== "object" || !("code" in error)) {
|
|
123
130
|
return false;
|
|
@@ -177,6 +184,7 @@ function llamaCppPostLoginGuidance(actionLabel, loadedModelCount) {
|
|
|
177
184
|
? `${actionLabel}. No llama.cpp models are loaded. Use /llama to load a model, then /model to select it.`
|
|
178
185
|
: `${actionLabel}. Use /model to select a loaded llama.cpp model, or /llama to manage models.`;
|
|
179
186
|
}
|
|
187
|
+
const RADIUS_LOGIN_INTRO = "Radius is an AI gateway by Earendil Works.";
|
|
180
188
|
const AUTH_TYPE_ORDER = { oauth: 0, api_key: 1 };
|
|
181
189
|
function createFuzzyAutocompleteItems(items, prefix, getSearchText, toAutocompleteItem) {
|
|
182
190
|
const filtered = fuzzyFilter(items, prefix, getSearchText);
|
|
@@ -199,18 +207,21 @@ function getLoginProviderCompletionOptions(providerOptions) {
|
|
|
199
207
|
id: provider.id,
|
|
200
208
|
name: provider.name,
|
|
201
209
|
authTypes: [provider.authType],
|
|
210
|
+
subscription: provider.subscription,
|
|
202
211
|
});
|
|
203
212
|
}
|
|
204
213
|
return Array.from(byId.values()).sort((a, b) => a.name.localeCompare(b.name));
|
|
205
214
|
}
|
|
206
215
|
function getLoginProviderSearchText(provider) {
|
|
207
216
|
const authTypes = provider.authTypes
|
|
208
|
-
.map((authType) => `${authType} ${formatAuthSelectorProviderType(authType)}`)
|
|
217
|
+
.map((authType) => `${authType} ${formatAuthSelectorProviderType(authType, provider.subscription)}`)
|
|
209
218
|
.join(" ");
|
|
210
219
|
return `${provider.id} ${provider.name} ${authTypes}`;
|
|
211
220
|
}
|
|
212
221
|
function formatLoginProviderCompletionDescription(provider) {
|
|
213
|
-
const authTypes = provider.authTypes
|
|
222
|
+
const authTypes = provider.authTypes
|
|
223
|
+
.map((authType) => formatAuthSelectorProviderType(authType, provider.subscription))
|
|
224
|
+
.join("/");
|
|
214
225
|
return provider.name === provider.id ? authTypes : `${provider.name} · ${authTypes}`;
|
|
215
226
|
}
|
|
216
227
|
export class InteractiveMode {
|
|
@@ -300,26 +311,23 @@ export class InteractiveMode {
|
|
|
300
311
|
compactionQueuedMessages = [];
|
|
301
312
|
// Shutdown state
|
|
302
313
|
shutdownRequested = false;
|
|
314
|
+
/** Reports working, blocked, done, and error states to terminals that support OSC 7501. */
|
|
315
|
+
programStatus = new ProgramStatusReporter(() => this.ui.terminal, () => this.sessionManager.getSessionName());
|
|
303
316
|
/** The `/bug` hint is shown at most once per session so error output stays readable. */
|
|
304
317
|
bugReportHintShown = false;
|
|
318
|
+
installChangeWarningShown = false;
|
|
305
319
|
// Extension UI state
|
|
306
|
-
extensionSelector = undefined;
|
|
307
320
|
/**
|
|
308
|
-
*
|
|
321
|
+
* Extension dialogs in the editor slot (select, confirm, input, editor, inline custom). The last one is visible.
|
|
309
322
|
*
|
|
310
|
-
*
|
|
311
|
-
*
|
|
312
|
-
*
|
|
323
|
+
* A new dialog stacks on top of the visible one instead of replacing it, and closing it shows the previous one
|
|
324
|
+
* again, so dialogs opened from inside another dialog work. Every entry carries its fail-closed answer:
|
|
325
|
+
* {@link closeAllExtensionDialogs} (session invalidate, `/reload`) settles each one, so no promise
|
|
326
|
+
* `beforeToolCall` awaits is ever stranded and an unanswered permission ask is a denial.
|
|
313
327
|
*/
|
|
314
|
-
|
|
328
|
+
extensionDialogs = [];
|
|
315
329
|
/** Label of the surface that decided the open ask elsewhere, pending a one-line notice. */
|
|
316
330
|
extensionDialogDecidedBy = undefined;
|
|
317
|
-
extensionInput = undefined;
|
|
318
|
-
/** Settles the promise `showExtensionInput` returned. See {@link hideExtensionInput}. */
|
|
319
|
-
extensionInputSettle = undefined;
|
|
320
|
-
extensionEditor = undefined;
|
|
321
|
-
/** Settles the promise `showExtensionEditor` returned. See {@link hideExtensionEditor}. */
|
|
322
|
-
extensionEditorSettle = undefined;
|
|
323
331
|
extensionTerminalInputSubscriptions = new Set();
|
|
324
332
|
// Extension widgets (components rendered above/below the editor)
|
|
325
333
|
extensionWidgetsAbove = new Map();
|
|
@@ -655,7 +663,7 @@ export class InteractiveMode {
|
|
|
655
663
|
this.registerSignalHandlers();
|
|
656
664
|
// Load changelog (only show new entries, skip for resumed sessions)
|
|
657
665
|
this.changelogMarkdown = this.getChangelogForDisplay();
|
|
658
|
-
if (this.session.scopedModels.length > 0 &&
|
|
666
|
+
if (this.session.scopedModels.length > 0 && this.shouldShowStartupDetails()) {
|
|
659
667
|
const modelList = this.session.scopedModels
|
|
660
668
|
.map((sm) => {
|
|
661
669
|
const thinkingStr = sm.thinkingLevel ? `:${sm.thinkingLevel}` : "";
|
|
@@ -701,12 +709,15 @@ export class InteractiveMode {
|
|
|
701
709
|
// Start the UI before initializing extensions so session_start handlers can use interactive dialogs
|
|
702
710
|
this.ui.start();
|
|
703
711
|
this.isInitialized = true;
|
|
712
|
+
this.programStatus.report();
|
|
713
|
+
this.ensurePngTranscoder();
|
|
704
714
|
this.themeController.applyFromSettings();
|
|
705
715
|
// The header and startup notices bake theme colors into their text, so build them once the terminal
|
|
706
716
|
// reported its colors. This ends at the terminal's DA1 reply, or after 100 ms if it answers nothing.
|
|
707
717
|
await this.themeController.waitForTerminalColors();
|
|
708
718
|
// Add header with keybindings from config (unless silenced)
|
|
709
|
-
if (this.
|
|
719
|
+
if (this.shouldShowStartupHeader()) {
|
|
720
|
+
const showDetails = this.shouldShowStartupDetails();
|
|
710
721
|
// Built on demand so the header follows theme changes.
|
|
711
722
|
const logo = () => {
|
|
712
723
|
const asciiArt = [
|
|
@@ -757,7 +768,7 @@ export class InteractiveMode {
|
|
|
757
768
|
rawKeyHint("!", "bash"),
|
|
758
769
|
hint("app.tools.expand", "more"),
|
|
759
770
|
].join(theme.fg("muted", " · "));
|
|
760
|
-
const compactOnboarding = () => theme.fg("dim", `Press ${keyText("app.tools.expand")} to show full startup help and loaded resources.`);
|
|
771
|
+
const compactOnboarding = () => theme.fg("dim", `Press ${keyText("app.tools.expand")} to show full startup help${showDetails ? " and loaded resources" : ""}.`);
|
|
761
772
|
const onboarding = () => theme.fg("dim", `${APP_NAME} can explain its own features and look up its docs. Ask it how to use or extend ${APP_NAME}.`);
|
|
762
773
|
this.builtInHeader = new ExpandableText(() => `${withLogo(compactInstructions())}\n${compactOnboarding()}\n\n${onboarding()}`, () => `${withLogo(expandedInstructions())}\n\n${onboarding()}`, this.getStartupExpansionState(), 1, 0);
|
|
763
774
|
// Setup UI layout
|
|
@@ -1040,6 +1051,14 @@ export class InteractiveMode {
|
|
|
1040
1051
|
getStartupExpansionState() {
|
|
1041
1052
|
return this.options.verbose || this.toolOutputExpanded;
|
|
1042
1053
|
}
|
|
1054
|
+
/** Startup header (logo, version, key hints). Hidden only by quietStartup: true. */
|
|
1055
|
+
shouldShowStartupHeader() {
|
|
1056
|
+
return this.options.verbose === true || this.settingsManager.getQuietStartup() !== true;
|
|
1057
|
+
}
|
|
1058
|
+
/** Startup details (model scope, loaded resources). Hidden by quietStartup: true or "header". */
|
|
1059
|
+
shouldShowStartupDetails() {
|
|
1060
|
+
return this.options.verbose === true || this.settingsManager.getQuietStartup() === false;
|
|
1061
|
+
}
|
|
1043
1062
|
/**
|
|
1044
1063
|
* Get a short path relative to the package root for display.
|
|
1045
1064
|
*/
|
|
@@ -1301,7 +1320,7 @@ export class InteractiveMode {
|
|
|
1301
1320
|
showLoadedResources(options) {
|
|
1302
1321
|
// Resource rendering is idempotent; chat clears no longer clear this separate container.
|
|
1303
1322
|
this.loadedResourcesContainer.clear();
|
|
1304
|
-
const showListing = options?.force || this.
|
|
1323
|
+
const showListing = options?.force || this.shouldShowStartupDetails();
|
|
1305
1324
|
const showDiagnostics = showListing || options?.showDiagnosticsWhenQuiet === true;
|
|
1306
1325
|
if (!showListing && !showDiagnostics) {
|
|
1307
1326
|
return;
|
|
@@ -1523,8 +1542,16 @@ export class InteractiveMode {
|
|
|
1523
1542
|
applyFullscreenScrollbarSetting() {
|
|
1524
1543
|
this.transcriptScrollView?.setScrollbar(this.settingsManager.getFullscreenScrollbar());
|
|
1525
1544
|
}
|
|
1545
|
+
/** Lets extension images use the PNG transcoder; tool results register it themselves. */
|
|
1546
|
+
ensurePngTranscoder() {
|
|
1547
|
+
ensurePngTranscoder(() => {
|
|
1548
|
+
this.ui.invalidate();
|
|
1549
|
+
this.ui.requestRender();
|
|
1550
|
+
});
|
|
1551
|
+
}
|
|
1526
1552
|
applyRuntimeSettings() {
|
|
1527
1553
|
setCapabilityOverrides(this.settingsManager.getTerminalCapabilityOverrides());
|
|
1554
|
+
this.ensurePngTranscoder();
|
|
1528
1555
|
configureHttpDispatcher(this.settingsManager.getHttpIdleTimeoutMs());
|
|
1529
1556
|
this.applyFullscreenScrollbarSetting();
|
|
1530
1557
|
if (this.renderer instanceof TuiAltScreen) {
|
|
@@ -1555,6 +1582,7 @@ export class InteractiveMode {
|
|
|
1555
1582
|
const session = this.session;
|
|
1556
1583
|
this.unsubscribe?.();
|
|
1557
1584
|
this.unsubscribe = undefined;
|
|
1585
|
+
this.programStatus.reset();
|
|
1558
1586
|
this.applyRuntimeSettings();
|
|
1559
1587
|
if (options.renderBeforeBind) {
|
|
1560
1588
|
this.renderCurrentSessionState();
|
|
@@ -1626,8 +1654,32 @@ export class InteractiveMode {
|
|
|
1626
1654
|
return;
|
|
1627
1655
|
if (/\b(?:abort(?:ed)?|cancel(?:l?ed)?)\b/i.test(message.errorMessage ?? ""))
|
|
1628
1656
|
return;
|
|
1657
|
+
if (this.maybeShowInstallChangeWarning())
|
|
1658
|
+
return;
|
|
1629
1659
|
this.suggestBugReport();
|
|
1630
1660
|
}
|
|
1661
|
+
/**
|
|
1662
|
+
* After an error, check whether an update replaced or removed this install while the session ran.
|
|
1663
|
+
* Code loaded on demand then fails with missing modules until restart (badlogic/pi-mono#10439). Returns true when
|
|
1664
|
+
* the install changed.
|
|
1665
|
+
*/
|
|
1666
|
+
maybeShowInstallChangeWarning() {
|
|
1667
|
+
if (this.installChangeWarningShown)
|
|
1668
|
+
return true;
|
|
1669
|
+
const change = detectInstallChange();
|
|
1670
|
+
if (!change)
|
|
1671
|
+
return false;
|
|
1672
|
+
this.installChangeWarningShown = true;
|
|
1673
|
+
const cause = change.kind === "updated"
|
|
1674
|
+
? `${APP_NAME} was updated to ${change.version} while this session was running (${VERSION})`
|
|
1675
|
+
: `The ${APP_NAME} installation this session runs from was removed or replaced`;
|
|
1676
|
+
const resumeCommand = formatResumeCommand(this.sessionManager);
|
|
1677
|
+
const restart = resumeCommand
|
|
1678
|
+
? `Restart with \`${resumeCommand}\` to continue this session.`
|
|
1679
|
+
: `Restart ${APP_NAME}.`;
|
|
1680
|
+
this.showWarning(`${cause}. Features that load code on demand can fail until restart. ${restart}`);
|
|
1681
|
+
return true;
|
|
1682
|
+
}
|
|
1631
1683
|
renderCurrentSessionState() {
|
|
1632
1684
|
this.loadedResourcesContainer.clear();
|
|
1633
1685
|
this.chatContainer.clear();
|
|
@@ -1646,7 +1698,7 @@ export class InteractiveMode {
|
|
|
1646
1698
|
* whatever this returns, so they never reach into the tool registry themselves.
|
|
1647
1699
|
*/
|
|
1648
1700
|
getRegisteredToolDefinition(toolName) {
|
|
1649
|
-
return withBuiltInRenderers(toolName, this.session.getToolDefinition(toolName));
|
|
1701
|
+
return this.session.extensionRunner.resolveToolRenderers(toolName, () => withBuiltInRenderers(toolName, this.session.getToolDefinition(toolName)));
|
|
1650
1702
|
}
|
|
1651
1703
|
getMarkdownTransformers() {
|
|
1652
1704
|
return [this.mermaidMarkdownTransformer, ...this.session.extensionRunner.getMarkdownTransformers()];
|
|
@@ -1718,7 +1770,7 @@ export class InteractiveMode {
|
|
|
1718
1770
|
}
|
|
1719
1771
|
setEditorWorkingStatusIndicator(indicator) {
|
|
1720
1772
|
this.defaultEditor.setWorkingStatusIndicator(undefined);
|
|
1721
|
-
if (!
|
|
1773
|
+
if (!isEmbeddedStatus(this.editor))
|
|
1722
1774
|
return false;
|
|
1723
1775
|
this.editor.setWorkingStatusIndicator(indicator);
|
|
1724
1776
|
return true;
|
|
@@ -1754,7 +1806,7 @@ export class InteractiveMode {
|
|
|
1754
1806
|
}
|
|
1755
1807
|
}
|
|
1756
1808
|
showWorkingStatusIndicator() {
|
|
1757
|
-
const colorFn =
|
|
1809
|
+
const colorFn = isEmbeddedStatus(this.editor)
|
|
1758
1810
|
? (text) => (this.editor.borderColor ?? theme.getThinkingBorderColor(this.session.thinkingLevel || "off"))(text)
|
|
1759
1811
|
: undefined;
|
|
1760
1812
|
this.showStatusIndicator(new WorkingStatusIndicator(this.ui, this.workingMessage ?? this.defaultWorkingMessage, this.workingIndicatorOptions, colorFn));
|
|
@@ -1839,15 +1891,7 @@ export class InteractiveMode {
|
|
|
1839
1891
|
this.renderWidgets();
|
|
1840
1892
|
}
|
|
1841
1893
|
resetExtensionUI() {
|
|
1842
|
-
|
|
1843
|
-
this.hideExtensionSelector();
|
|
1844
|
-
}
|
|
1845
|
-
if (this.extensionInput) {
|
|
1846
|
-
this.hideExtensionInput();
|
|
1847
|
-
}
|
|
1848
|
-
if (this.extensionEditor) {
|
|
1849
|
-
this.hideExtensionEditor();
|
|
1850
|
-
}
|
|
1894
|
+
this.closeAllExtensionDialogs();
|
|
1851
1895
|
this.ui.hideOverlay();
|
|
1852
1896
|
this.clearExtensionTerminalInputListeners();
|
|
1853
1897
|
this.setExtensionFooter(undefined);
|
|
@@ -2046,72 +2090,96 @@ export class InteractiveMode {
|
|
|
2046
2090
|
setToolsExpanded: (expanded) => this.setToolsExpanded(expanded),
|
|
2047
2091
|
};
|
|
2048
2092
|
}
|
|
2093
|
+
/** Show an extension dialog on top of the stack. */
|
|
2094
|
+
pushExtensionDialog(dialog) {
|
|
2095
|
+
this.disposeActiveSelector();
|
|
2096
|
+
this.extensionDialogs.push(dialog);
|
|
2097
|
+
this.showTopExtensionDialog();
|
|
2098
|
+
}
|
|
2099
|
+
/**
|
|
2100
|
+
* Remove a dialog WITHOUT settling it; its owner settles it. If it was visible, the previous dialog or the
|
|
2101
|
+
* editor takes the slot. A hidden dialog leaving (say, its signal aborted) never disturbs the visible one.
|
|
2102
|
+
*/
|
|
2103
|
+
removeExtensionDialog(component) {
|
|
2104
|
+
const index = this.extensionDialogs.findIndex((dialog) => dialog.component === component);
|
|
2105
|
+
if (index === -1)
|
|
2106
|
+
return;
|
|
2107
|
+
this.extensionDialogs.splice(index, 1);
|
|
2108
|
+
if (index === this.extensionDialogs.length)
|
|
2109
|
+
this.showTopExtensionDialog();
|
|
2110
|
+
}
|
|
2111
|
+
showTopExtensionDialog() {
|
|
2112
|
+
const top = this.extensionDialogs.at(-1);
|
|
2113
|
+
const component = top?.component ?? this.editor;
|
|
2114
|
+
this.editorContainer.clear();
|
|
2115
|
+
this.editorContainer.addChild(component);
|
|
2116
|
+
this.ui.setFocus(component);
|
|
2117
|
+
// A custom component reports no status of its own; one stacked over a pending ask must not hide it.
|
|
2118
|
+
const blocked = this.extensionDialogs.findLast((dialog) => dialog.blocked !== undefined)?.blocked;
|
|
2119
|
+
this.programStatus.setBlocked("extension-dialog", blocked);
|
|
2120
|
+
this.ui.requestRender();
|
|
2121
|
+
}
|
|
2122
|
+
/**
|
|
2123
|
+
* Tear down every extension dialog, answering each one fail-closed.
|
|
2124
|
+
*
|
|
2125
|
+
* `resetExtensionUI` (reached from `setBeforeSessionInvalidate` and `/reload`) used to drop dialogs
|
|
2126
|
+
* without settling them, which stranded the promise `beforeToolCall` awaits and wedged the agent loop: no
|
|
2127
|
+
* dialog on screen, no tool call, no way out. Hidden dialogs further down the stack need the same treatment.
|
|
2128
|
+
*/
|
|
2129
|
+
closeAllExtensionDialogs() {
|
|
2130
|
+
const dialogs = this.extensionDialogs;
|
|
2131
|
+
if (dialogs.length === 0)
|
|
2132
|
+
return;
|
|
2133
|
+
this.extensionDialogs = [];
|
|
2134
|
+
this.showTopExtensionDialog();
|
|
2135
|
+
// Last, so no continuation can observe a half-torn-down slot. Newest first, the order they were stacked.
|
|
2136
|
+
for (const dialog of dialogs.reverse())
|
|
2137
|
+
dialog.failClosed();
|
|
2138
|
+
}
|
|
2049
2139
|
/**
|
|
2050
2140
|
* Show a selector for extensions.
|
|
2051
2141
|
*/
|
|
2052
|
-
showExtensionSelector(title, options, opts, detailRows) {
|
|
2142
|
+
showExtensionSelector(title, options, opts, detailRows, blocked = { kind: "question", message: title }) {
|
|
2053
2143
|
return new Promise((resolve) => {
|
|
2054
2144
|
if (opts?.signal?.aborted) {
|
|
2055
2145
|
resolve(undefined);
|
|
2056
2146
|
return;
|
|
2057
2147
|
}
|
|
2058
2148
|
let settled = false;
|
|
2059
|
-
const
|
|
2149
|
+
const finish = (value) => {
|
|
2060
2150
|
if (settled)
|
|
2061
2151
|
return;
|
|
2062
2152
|
settled = true;
|
|
2063
2153
|
opts?.signal?.removeEventListener("abort", onAbort);
|
|
2064
|
-
if (this.extensionSelectorSettle === settle)
|
|
2065
|
-
this.extensionSelectorSettle = undefined;
|
|
2066
2154
|
// A deciding-surface label that nothing flushed belongs to THIS ask and dies with it.
|
|
2067
2155
|
// Left standing it is sticky: the next, unrelated dialog's teardown would emit
|
|
2068
2156
|
// "Permission resolved by <whoever>" about an ask that surface never saw.
|
|
2069
2157
|
this.extensionDialogDecidedBy = undefined;
|
|
2158
|
+
selector.dispose();
|
|
2159
|
+
this.removeExtensionDialog(selector);
|
|
2160
|
+
// Last, so the caller's continuation cannot observe a half-torn-down dialog slot.
|
|
2070
2161
|
resolve(value);
|
|
2071
2162
|
};
|
|
2072
2163
|
const onAbort = () => {
|
|
2073
|
-
//
|
|
2074
|
-
if (!settled)
|
|
2075
|
-
// Flush BEFORE settling: `settle` drops the pending label, and `hideExtensionSelector`
|
|
2076
|
-
// now settles this dialog fail-closed on its way out.
|
|
2164
|
+
// Flush BEFORE finishing: `finish` drops the pending label.
|
|
2165
|
+
if (!settled)
|
|
2077
2166
|
this.flushExtensionDialogDecidedNotice();
|
|
2078
|
-
|
|
2079
|
-
}
|
|
2080
|
-
settle(undefined);
|
|
2167
|
+
finish(undefined);
|
|
2081
2168
|
};
|
|
2082
2169
|
opts?.signal?.addEventListener("abort", onAbort, { once: true });
|
|
2083
|
-
|
|
2084
|
-
// cancelled BEFORE the replacement takes over; the previous code overwrote the field and
|
|
2085
|
-
// left the earlier caller awaiting a promise nothing could ever resolve.
|
|
2086
|
-
const displaced = this.extensionSelectorSettle;
|
|
2087
|
-
this.extensionSelector?.dispose();
|
|
2088
|
-
this.extensionSelector = undefined;
|
|
2089
|
-
this.extensionSelectorSettle = undefined;
|
|
2090
|
-
this.extensionSelector = new ExtensionSelectorComponent(title, options,
|
|
2091
|
-
// Settle BEFORE hiding: `hideExtensionSelector` settles whatever is still in the slot
|
|
2092
|
-
// fail-closed, so hiding first would resolve the ask as `undefined` (a denial) and the
|
|
2093
|
-
// human's actual choice would be swallowed by the `settled` guard.
|
|
2094
|
-
(option) => {
|
|
2095
|
-
settle(option);
|
|
2096
|
-
this.hideExtensionSelector();
|
|
2097
|
-
}, () => {
|
|
2098
|
-
settle(undefined);
|
|
2099
|
-
this.hideExtensionSelector();
|
|
2100
|
-
}, {
|
|
2170
|
+
const selector = new ExtensionSelectorComponent(title, options, (option) => finish(option), () => finish(undefined), {
|
|
2101
2171
|
tui: this.ui,
|
|
2102
2172
|
timeout: opts?.timeout,
|
|
2103
2173
|
detailRows,
|
|
2104
2174
|
onToggleToolsExpanded: () => this.toggleToolOutputExpansion(),
|
|
2105
2175
|
});
|
|
2106
|
-
|
|
2107
|
-
this.
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
// cannot observe an empty dialog slot.
|
|
2114
|
-
displaced?.(undefined);
|
|
2176
|
+
// `undefined` is the fail-closed answer: `showExtensionConfirm` maps it to `false`, i.e. denial.
|
|
2177
|
+
this.pushExtensionDialog({
|
|
2178
|
+
component: selector,
|
|
2179
|
+
kind: "selector",
|
|
2180
|
+
blocked,
|
|
2181
|
+
failClosed: () => finish(undefined),
|
|
2182
|
+
});
|
|
2115
2183
|
});
|
|
2116
2184
|
}
|
|
2117
2185
|
/**
|
|
@@ -2124,7 +2192,7 @@ export class InteractiveMode {
|
|
|
2124
2192
|
noteExtensionDialogResolvedElsewhere(label) {
|
|
2125
2193
|
this.extensionDialogDecidedBy = label;
|
|
2126
2194
|
// Nothing is open to abort, so no teardown will flush the notice — emit it now.
|
|
2127
|
-
if (!this.
|
|
2195
|
+
if (!this.extensionDialogs.some((dialog) => dialog.kind === "selector"))
|
|
2128
2196
|
this.flushExtensionDialogDecidedNotice();
|
|
2129
2197
|
}
|
|
2130
2198
|
/** Emit the pending deciding-surface notice at most once, then forget it. */
|
|
@@ -2135,32 +2203,6 @@ export class InteractiveMode {
|
|
|
2135
2203
|
this.extensionDialogDecidedBy = undefined;
|
|
2136
2204
|
this.showExtensionNotify(`Permission resolved by ${label}`, "info");
|
|
2137
2205
|
}
|
|
2138
|
-
/**
|
|
2139
|
-
* Hide the extension selector, settling its promise FAIL-CLOSED if nothing else has.
|
|
2140
|
-
*
|
|
2141
|
-
* Every teardown path FOR THE SELECTOR funnels through here — {@link hideExtensionInput} and
|
|
2142
|
-
* {@link hideExtensionEditor} are the matching, separate ones for the other two dialog types, and
|
|
2143
|
-
* they need the same treatment for the same reason. This one used to drop the component on the
|
|
2144
|
-
* floor without touching {@link extensionSelectorSettle} when `resetExtensionUI` (reached from
|
|
2145
|
-
* `setBeforeSessionInvalidate` and from `/reload`) called it. A session invalidate while a permission ask
|
|
2146
|
-
* was open therefore stranded the promise `beforeToolCall` awaits and wedged the agent loop
|
|
2147
|
-
* forever: no dialog on screen, no tool call, no way out.
|
|
2148
|
-
*
|
|
2149
|
-
* `undefined` is the fail-closed answer — `showExtensionConfirm` maps it to `false`, i.e. denial.
|
|
2150
|
-
* Callers that carry a real answer must `settle(...)` it BEFORE calling this.
|
|
2151
|
-
*/
|
|
2152
|
-
hideExtensionSelector() {
|
|
2153
|
-
const settle = this.extensionSelectorSettle;
|
|
2154
|
-
this.extensionSelectorSettle = undefined;
|
|
2155
|
-
this.extensionSelector?.dispose();
|
|
2156
|
-
this.editorContainer.clear();
|
|
2157
|
-
this.editorContainer.addChild(this.editor);
|
|
2158
|
-
this.extensionSelector = undefined;
|
|
2159
|
-
this.ui.setFocus(this.editor);
|
|
2160
|
-
this.ui.requestRender();
|
|
2161
|
-
// Last, so the caller's continuation cannot observe a half-torn-down dialog slot.
|
|
2162
|
-
settle?.(undefined);
|
|
2163
|
-
}
|
|
2164
2206
|
/**
|
|
2165
2207
|
* Show a confirmation dialog for extensions.
|
|
2166
2208
|
*
|
|
@@ -2196,14 +2238,20 @@ export class InteractiveMode {
|
|
|
2196
2238
|
// it back into `${title}\n${message}` would hand the attacker-influenced command a way to
|
|
2197
2239
|
// forge rows, and the human would be deciding about a string rather than about a call.
|
|
2198
2240
|
const rows = this.buildPermissionDetailRows(detail);
|
|
2199
|
-
const result = await this.showExtensionSelector(safeTitle, ["Yes", "No"], opts, rows
|
|
2241
|
+
const result = await this.showExtensionSelector(safeTitle, ["Yes", "No"], opts, rows, {
|
|
2242
|
+
kind: "permission",
|
|
2243
|
+
message: safeTitle,
|
|
2244
|
+
});
|
|
2200
2245
|
return result === "Yes";
|
|
2201
2246
|
}
|
|
2202
2247
|
// Two rows of the header budget are already spoken for: the single-row title above, and the
|
|
2203
2248
|
// spacer `ExtensionSelectorComponent` draws between the header and the option list when there
|
|
2204
2249
|
// are no detail rows. Both sit above `Yes`, so both have to come out of the same budget.
|
|
2205
2250
|
const safeMessage = boundDialogText(message, columns, MAX_DETAIL_ROWS - 2);
|
|
2206
|
-
const result = await this.showExtensionSelector(`${safeTitle}\n${safeMessage}`, ["Yes", "No"], opts
|
|
2251
|
+
const result = await this.showExtensionSelector(`${safeTitle}\n${safeMessage}`, ["Yes", "No"], opts, undefined, {
|
|
2252
|
+
kind: "permission",
|
|
2253
|
+
message: safeTitle,
|
|
2254
|
+
});
|
|
2207
2255
|
return result === "Yes";
|
|
2208
2256
|
}
|
|
2209
2257
|
/**
|
|
@@ -2255,127 +2303,48 @@ export class InteractiveMode {
|
|
|
2255
2303
|
return;
|
|
2256
2304
|
}
|
|
2257
2305
|
let settled = false;
|
|
2258
|
-
const
|
|
2306
|
+
const finish = (value) => {
|
|
2259
2307
|
if (settled)
|
|
2260
2308
|
return;
|
|
2261
2309
|
settled = true;
|
|
2262
2310
|
opts?.signal?.removeEventListener("abort", onAbort);
|
|
2263
|
-
|
|
2264
|
-
|
|
2311
|
+
input.dispose();
|
|
2312
|
+
this.removeExtensionDialog(input);
|
|
2265
2313
|
resolve(value);
|
|
2266
2314
|
};
|
|
2267
|
-
const onAbort = () =>
|
|
2268
|
-
// A dialog already displaced by a newer one must not tear the newer one down.
|
|
2269
|
-
if (!settled)
|
|
2270
|
-
this.hideExtensionInput();
|
|
2271
|
-
settle(undefined);
|
|
2272
|
-
};
|
|
2315
|
+
const onAbort = () => finish(undefined);
|
|
2273
2316
|
opts?.signal?.addEventListener("abort", onAbort, { once: true });
|
|
2274
|
-
const
|
|
2275
|
-
this.
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
// ask as `undefined` and the human's actual answer would hit the `settled` guard.
|
|
2282
|
-
(value) => {
|
|
2283
|
-
settle(value);
|
|
2284
|
-
this.hideExtensionInput();
|
|
2285
|
-
}, () => {
|
|
2286
|
-
settle(undefined);
|
|
2287
|
-
this.hideExtensionInput();
|
|
2288
|
-
}, { tui: this.ui, timeout: opts?.timeout });
|
|
2289
|
-
this.extensionInputSettle = settle;
|
|
2290
|
-
this.disposeActiveSelector();
|
|
2291
|
-
this.editorContainer.clear();
|
|
2292
|
-
this.editorContainer.addChild(this.extensionInput);
|
|
2293
|
-
this.ui.setFocus(this.extensionInput);
|
|
2294
|
-
this.ui.requestRender();
|
|
2295
|
-
// Only once the replacement is installed, so the displaced caller's continuation cannot
|
|
2296
|
-
// observe an empty dialog slot.
|
|
2297
|
-
displaced?.(undefined);
|
|
2317
|
+
const input = new ExtensionInputComponent(title, placeholder, (value) => finish(value), () => finish(undefined), { tui: this.ui, timeout: opts?.timeout });
|
|
2318
|
+
this.pushExtensionDialog({
|
|
2319
|
+
component: input,
|
|
2320
|
+
kind: "input",
|
|
2321
|
+
blocked: { kind: "question", message: title },
|
|
2322
|
+
failClosed: () => finish(undefined),
|
|
2323
|
+
});
|
|
2298
2324
|
});
|
|
2299
2325
|
}
|
|
2300
|
-
/**
|
|
2301
|
-
* Hide the extension input, settling its promise FAIL-CLOSED if nothing else has.
|
|
2302
|
-
*
|
|
2303
|
-
* Same defect the selector had: this used to dispose and re-focus without touching the `resolve`
|
|
2304
|
-
* captured in {@link showExtensionInput}'s closure, so `resetExtensionUI` — a session invalidate
|
|
2305
|
-
* or `/reload` — left the extension awaiting `ui.input(...)` hanging forever.
|
|
2306
|
-
*
|
|
2307
|
-
* Callers that carry a real answer must `settle(...)` it BEFORE calling this.
|
|
2308
|
-
*/
|
|
2309
|
-
hideExtensionInput() {
|
|
2310
|
-
const settle = this.extensionInputSettle;
|
|
2311
|
-
this.extensionInputSettle = undefined;
|
|
2312
|
-
this.extensionInput?.dispose();
|
|
2313
|
-
this.editorContainer.clear();
|
|
2314
|
-
this.editorContainer.addChild(this.editor);
|
|
2315
|
-
this.extensionInput = undefined;
|
|
2316
|
-
this.ui.setFocus(this.editor);
|
|
2317
|
-
this.ui.requestRender();
|
|
2318
|
-
// Last, so the caller's continuation cannot observe a half-torn-down dialog slot.
|
|
2319
|
-
settle?.(undefined);
|
|
2320
|
-
}
|
|
2321
2326
|
/**
|
|
2322
2327
|
* Show a multi-line editor for extensions (with Ctrl+G support).
|
|
2323
2328
|
*/
|
|
2324
2329
|
showExtensionEditor(title, prefill) {
|
|
2325
2330
|
return new Promise((resolve) => {
|
|
2326
2331
|
let settled = false;
|
|
2327
|
-
const
|
|
2332
|
+
const finish = (value) => {
|
|
2328
2333
|
if (settled)
|
|
2329
2334
|
return;
|
|
2330
2335
|
settled = true;
|
|
2331
|
-
|
|
2332
|
-
this.extensionEditorSettle = undefined;
|
|
2336
|
+
this.removeExtensionDialog(editor);
|
|
2333
2337
|
resolve(value);
|
|
2334
2338
|
};
|
|
2335
|
-
const
|
|
2336
|
-
this.
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
this.hideExtensionEditor();
|
|
2343
|
-
}, () => {
|
|
2344
|
-
settle(undefined);
|
|
2345
|
-
this.hideExtensionEditor();
|
|
2346
|
-
}, undefined, this.settingsManager.getExternalEditorCommand());
|
|
2347
|
-
this.extensionEditorSettle = settle;
|
|
2348
|
-
this.disposeActiveSelector();
|
|
2349
|
-
this.editorContainer.clear();
|
|
2350
|
-
this.editorContainer.addChild(this.extensionEditor);
|
|
2351
|
-
this.ui.setFocus(this.extensionEditor);
|
|
2352
|
-
this.ui.requestRender();
|
|
2353
|
-
// Only once the replacement is installed, so the displaced caller's continuation cannot
|
|
2354
|
-
// observe an empty dialog slot.
|
|
2355
|
-
displaced?.(undefined);
|
|
2339
|
+
const editor = new ExtensionEditorComponent(this.ui, this.keybindings, title, prefill, (value) => finish(value), () => finish(undefined), undefined, this.settingsManager.getExternalEditorCommand());
|
|
2340
|
+
this.pushExtensionDialog({
|
|
2341
|
+
component: editor,
|
|
2342
|
+
kind: "editor",
|
|
2343
|
+
blocked: { kind: "question", message: title },
|
|
2344
|
+
failClosed: () => finish(undefined),
|
|
2345
|
+
});
|
|
2356
2346
|
});
|
|
2357
2347
|
}
|
|
2358
|
-
/**
|
|
2359
|
-
* Hide the extension editor, settling its promise FAIL-CLOSED if nothing else has.
|
|
2360
|
-
*
|
|
2361
|
-
* Same defect the selector had: this used to clear the container and re-focus without touching
|
|
2362
|
-
* the `resolve` captured in {@link showExtensionEditor}'s closure, so `resetExtensionUI` — a
|
|
2363
|
-
* session invalidate or `/reload` — stranded whoever was awaiting the editor forever. `/compact`
|
|
2364
|
-
* with custom instructions is one such caller.
|
|
2365
|
-
*
|
|
2366
|
-
* Callers that carry a real answer must `settle(...)` it BEFORE calling this.
|
|
2367
|
-
*/
|
|
2368
|
-
hideExtensionEditor() {
|
|
2369
|
-
const settle = this.extensionEditorSettle;
|
|
2370
|
-
this.extensionEditorSettle = undefined;
|
|
2371
|
-
this.editorContainer.clear();
|
|
2372
|
-
this.editorContainer.addChild(this.editor);
|
|
2373
|
-
this.extensionEditor = undefined;
|
|
2374
|
-
this.ui.setFocus(this.editor);
|
|
2375
|
-
this.ui.requestRender();
|
|
2376
|
-
// Last, so the caller's continuation cannot observe a half-torn-down dialog slot.
|
|
2377
|
-
settle?.(undefined);
|
|
2378
|
-
}
|
|
2379
2348
|
/**
|
|
2380
2349
|
* Set a custom editor component from an extension.
|
|
2381
2350
|
* Pass undefined to restore the default editor.
|
|
@@ -2465,22 +2434,23 @@ export class InteractiveMode {
|
|
|
2465
2434
|
async showExtensionCustom(factory, options) {
|
|
2466
2435
|
const savedText = this.editor.getText();
|
|
2467
2436
|
const isOverlay = options?.overlay ?? false;
|
|
2468
|
-
const restoreEditor = () => {
|
|
2469
|
-
this.editorContainer.clear();
|
|
2470
|
-
this.editorContainer.addChild(this.editor);
|
|
2471
|
-
this.editor.setText(savedText);
|
|
2472
|
-
this.ui.setFocus(this.editor);
|
|
2473
|
-
this.ui.requestRender();
|
|
2474
|
-
};
|
|
2475
2437
|
return new Promise((resolve, reject) => {
|
|
2476
2438
|
let component;
|
|
2439
|
+
let overlayHandle;
|
|
2477
2440
|
let closed = false;
|
|
2441
|
+
const restoreEditor = () => {
|
|
2442
|
+
if (component)
|
|
2443
|
+
this.removeExtensionDialog(component);
|
|
2444
|
+
this.editor.setText(savedText);
|
|
2445
|
+
this.ui.requestRender();
|
|
2446
|
+
};
|
|
2478
2447
|
const close = (result) => {
|
|
2479
2448
|
if (closed)
|
|
2480
2449
|
return;
|
|
2481
2450
|
closed = true;
|
|
2451
|
+
// Remove this overlay, not the topmost one: another overlay may have opened above it.
|
|
2482
2452
|
if (isOverlay)
|
|
2483
|
-
|
|
2453
|
+
overlayHandle?.hide();
|
|
2484
2454
|
else
|
|
2485
2455
|
restoreEditor();
|
|
2486
2456
|
// Note: both branches above already call requestRender
|
|
@@ -2507,19 +2477,33 @@ export class InteractiveMode {
|
|
|
2507
2477
|
return opts;
|
|
2508
2478
|
}
|
|
2509
2479
|
// Fallback: use component's width property if available
|
|
2510
|
-
const w =
|
|
2480
|
+
const w = c.width;
|
|
2511
2481
|
return w ? { width: w } : undefined;
|
|
2512
2482
|
};
|
|
2513
|
-
|
|
2483
|
+
overlayHandle = this.ui.showOverlay(c, resolveOptions());
|
|
2514
2484
|
// Expose handle to caller for visibility control
|
|
2515
|
-
options?.onHandle?.(
|
|
2485
|
+
options?.onHandle?.(overlayHandle);
|
|
2516
2486
|
}
|
|
2517
2487
|
else {
|
|
2518
|
-
this.
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2488
|
+
this.pushExtensionDialog({
|
|
2489
|
+
component: c,
|
|
2490
|
+
kind: "custom",
|
|
2491
|
+
blocked: undefined,
|
|
2492
|
+
// A custom component has no neutral answer, so a reset rejects rather than strand the caller.
|
|
2493
|
+
failClosed: () => {
|
|
2494
|
+
if (closed)
|
|
2495
|
+
return;
|
|
2496
|
+
closed = true;
|
|
2497
|
+
this.editor.setText(savedText);
|
|
2498
|
+
try {
|
|
2499
|
+
c.dispose?.();
|
|
2500
|
+
}
|
|
2501
|
+
catch {
|
|
2502
|
+
/* ignore dispose errors */
|
|
2503
|
+
}
|
|
2504
|
+
reject(new Error("Extension UI was reset"));
|
|
2505
|
+
},
|
|
2506
|
+
});
|
|
2523
2507
|
}
|
|
2524
2508
|
})
|
|
2525
2509
|
.catch((err) => {
|
|
@@ -2900,6 +2884,7 @@ export class InteractiveMode {
|
|
|
2900
2884
|
await this.init();
|
|
2901
2885
|
}
|
|
2902
2886
|
this.footer.invalidate();
|
|
2887
|
+
this.programStatus.handleEvent(event);
|
|
2903
2888
|
switch (event.type) {
|
|
2904
2889
|
case "agent_start":
|
|
2905
2890
|
this.pendingTools.clear();
|
|
@@ -3009,6 +2994,7 @@ export class InteractiveMode {
|
|
|
3009
2994
|
const component = new ToolExecutionComponent(content.name, content.id, content.arguments, {
|
|
3010
2995
|
showImages: this.settingsManager.getShowImages(),
|
|
3011
2996
|
imageWidthCells: this.settingsManager.getImageWidthCells(),
|
|
2997
|
+
outputPad: this.outputPad,
|
|
3012
2998
|
}, this.getRegisteredToolDefinition(content.name), this.ui, this.sessionManager.getCwd());
|
|
3013
2999
|
component.setExpanded(this.toolOutputExpanded);
|
|
3014
3000
|
this.chatContainer.addChild(component);
|
|
@@ -3079,6 +3065,7 @@ export class InteractiveMode {
|
|
|
3079
3065
|
component = new ToolExecutionComponent(event.toolName, event.toolCallId, event.args, {
|
|
3080
3066
|
showImages: this.settingsManager.getShowImages(),
|
|
3081
3067
|
imageWidthCells: this.settingsManager.getImageWidthCells(),
|
|
3068
|
+
outputPad: this.outputPad,
|
|
3082
3069
|
}, this.getRegisteredToolDefinition(event.toolName), this.ui, this.sessionManager.getCwd());
|
|
3083
3070
|
component.setExpanded(this.toolOutputExpanded);
|
|
3084
3071
|
this.chatContainer.addChild(component);
|
|
@@ -3097,9 +3084,11 @@ export class InteractiveMode {
|
|
|
3097
3084
|
break;
|
|
3098
3085
|
}
|
|
3099
3086
|
case "tool_execution_end": {
|
|
3087
|
+
if (event.isError)
|
|
3088
|
+
this.maybeShowInstallChangeWarning();
|
|
3100
3089
|
const component = this.pendingTools.get(event.toolCallId);
|
|
3101
3090
|
if (component) {
|
|
3102
|
-
component.updateResult({ ...event.result, isError: event.isError });
|
|
3091
|
+
component.updateResult({ ...event.result, isError: event.isError, durationMs: event.durationMs });
|
|
3103
3092
|
this.pendingTools.delete(event.toolCallId);
|
|
3104
3093
|
this.ui.requestRender();
|
|
3105
3094
|
}
|
|
@@ -3131,7 +3120,10 @@ export class InteractiveMode {
|
|
|
3131
3120
|
this.defaultEditor.onEscape = () => {
|
|
3132
3121
|
this.session.abortCompaction();
|
|
3133
3122
|
};
|
|
3134
|
-
|
|
3123
|
+
const colorFn = isEmbeddedStatus(this.editor)
|
|
3124
|
+
? (text) => (this.editor.borderColor ?? theme.getThinkingBorderColor(this.session.thinkingLevel || "off"))(text)
|
|
3125
|
+
: undefined;
|
|
3126
|
+
this.showStatusIndicator(new CompactionStatusIndicator(this.ui, event.reason, colorFn));
|
|
3135
3127
|
this.ui.requestRender();
|
|
3136
3128
|
break;
|
|
3137
3129
|
}
|
|
@@ -3220,7 +3212,10 @@ export class InteractiveMode {
|
|
|
3220
3212
|
this.showStatusIndicator(new BranchSummaryStatusIndicator(this.ui));
|
|
3221
3213
|
}
|
|
3222
3214
|
else {
|
|
3223
|
-
|
|
3215
|
+
const colorFn = isEmbeddedStatus(this.editor)
|
|
3216
|
+
? (text) => (this.editor.borderColor ?? theme.getThinkingBorderColor(this.session.thinkingLevel || "off"))(text)
|
|
3217
|
+
: undefined;
|
|
3218
|
+
this.showStatusIndicator(new CompactionStatusIndicator(this.ui, event.reason, colorFn));
|
|
3224
3219
|
}
|
|
3225
3220
|
this.ui.requestRender();
|
|
3226
3221
|
break;
|
|
@@ -3284,7 +3279,7 @@ export class InteractiveMode {
|
|
|
3284
3279
|
if (!renderer) {
|
|
3285
3280
|
return;
|
|
3286
3281
|
}
|
|
3287
|
-
const component = new CustomEntryComponent(entry, renderer);
|
|
3282
|
+
const component = new CustomEntryComponent(entry, renderer, this.outputPad);
|
|
3288
3283
|
component.setExpanded(this.toolOutputExpanded);
|
|
3289
3284
|
if (!component.hasContent()) {
|
|
3290
3285
|
return;
|
|
@@ -3301,7 +3296,7 @@ export class InteractiveMode {
|
|
|
3301
3296
|
addMessageToChat(message, options) {
|
|
3302
3297
|
switch (message.role) {
|
|
3303
3298
|
case "bashExecution": {
|
|
3304
|
-
const component = new BashExecutionComponent(message.command, this.ui, message.excludeFromContext);
|
|
3299
|
+
const component = new BashExecutionComponent(message.command, this.ui, message.excludeFromContext, this.outputPad);
|
|
3305
3300
|
if (message.output) {
|
|
3306
3301
|
component.appendOutput(message.output);
|
|
3307
3302
|
}
|
|
@@ -3320,14 +3315,14 @@ export class InteractiveMode {
|
|
|
3320
3315
|
}
|
|
3321
3316
|
case "compactionSummary": {
|
|
3322
3317
|
this.chatContainer.addChild(new Spacer(1));
|
|
3323
|
-
const component = new CompactionSummaryMessageComponent(message, this.getMarkdownThemeWithSettings());
|
|
3318
|
+
const component = new CompactionSummaryMessageComponent(message, this.getMarkdownThemeWithSettings(), this.outputPad);
|
|
3324
3319
|
component.setExpanded(this.toolOutputExpanded);
|
|
3325
3320
|
this.chatContainer.addChild(component);
|
|
3326
3321
|
break;
|
|
3327
3322
|
}
|
|
3328
3323
|
case "branchSummary": {
|
|
3329
3324
|
this.chatContainer.addChild(new Spacer(1));
|
|
3330
|
-
const component = new BranchSummaryMessageComponent(message, this.getMarkdownThemeWithSettings());
|
|
3325
|
+
const component = new BranchSummaryMessageComponent(message, this.getMarkdownThemeWithSettings(), this.outputPad);
|
|
3331
3326
|
component.setExpanded(this.toolOutputExpanded);
|
|
3332
3327
|
this.chatContainer.addChild(component);
|
|
3333
3328
|
break;
|
|
@@ -3343,7 +3338,7 @@ export class InteractiveMode {
|
|
|
3343
3338
|
const skillBlock = parseSkillBlock(textContent);
|
|
3344
3339
|
if (skillBlock) {
|
|
3345
3340
|
// Render skill block (collapsible)
|
|
3346
|
-
const component = new SkillInvocationMessageComponent(skillBlock, this.getMarkdownThemeWithSettings());
|
|
3341
|
+
const component = new SkillInvocationMessageComponent(skillBlock, this.getMarkdownThemeWithSettings(), this.outputPad);
|
|
3347
3342
|
component.setExpanded(this.toolOutputExpanded);
|
|
3348
3343
|
this.chatContainer.addChild(component);
|
|
3349
3344
|
// Render user message separately if present
|
|
@@ -3412,6 +3407,7 @@ export class InteractiveMode {
|
|
|
3412
3407
|
const component = new ToolExecutionComponent(content.name, content.id, content.arguments, {
|
|
3413
3408
|
showImages: this.settingsManager.getShowImages(),
|
|
3414
3409
|
imageWidthCells: this.settingsManager.getImageWidthCells(),
|
|
3410
|
+
outputPad: this.outputPad,
|
|
3415
3411
|
}, this.getRegisteredToolDefinition(content.name), this.ui, this.sessionManager.getCwd());
|
|
3416
3412
|
component.setExpanded(this.toolOutputExpanded);
|
|
3417
3413
|
this.chatContainer.addChild(component);
|
|
@@ -3465,6 +3461,9 @@ export class InteractiveMode {
|
|
|
3465
3461
|
* @param options.populateHistory Add user messages to editor history
|
|
3466
3462
|
*/
|
|
3467
3463
|
renderSessionEntries(entries, options = {}) {
|
|
3464
|
+
// Selection coordinates point into the transcript being replaced (#9311).
|
|
3465
|
+
if (this.renderer instanceof TuiAltScreen)
|
|
3466
|
+
this.renderer.resetTextSelection();
|
|
3468
3467
|
const items = entries.flatMap((entry) => {
|
|
3469
3468
|
if (entry.type === "custom" || (entry.type === "usage" && entry.kind === "cache_warm")) {
|
|
3470
3469
|
return [entry];
|
|
@@ -3682,6 +3681,10 @@ export class InteractiveMode {
|
|
|
3682
3681
|
* paste / Kitty / modifyOtherKeys sequences.
|
|
3683
3682
|
*/
|
|
3684
3683
|
uncaughtCrash(error) {
|
|
3684
|
+
// A dead terminal is not a draht crash. Do not try to restore it or record it.
|
|
3685
|
+
if (isDeadTerminalError(error)) {
|
|
3686
|
+
this.emergencyTerminalExit();
|
|
3687
|
+
}
|
|
3685
3688
|
if (this.isShuttingDown) {
|
|
3686
3689
|
process.exit(1);
|
|
3687
3690
|
}
|
|
@@ -3740,10 +3743,13 @@ export class InteractiveMode {
|
|
|
3740
3743
|
}
|
|
3741
3744
|
throw error;
|
|
3742
3745
|
};
|
|
3743
|
-
|
|
3744
|
-
process
|
|
3745
|
-
|
|
3746
|
-
|
|
3746
|
+
// stdin needs the handler too: once the terminal is gone, reads and setRawMode
|
|
3747
|
+
// fail with EIO (orphaned background process group) or ENOTTY (revoked tty).
|
|
3748
|
+
// Node emits these as stream errors, which are uncaught without a listener.
|
|
3749
|
+
for (const stream of [process.stdin, process.stdout, process.stderr]) {
|
|
3750
|
+
stream.on("error", terminalErrorHandler);
|
|
3751
|
+
this.signalCleanupHandlers.push(() => stream.off("error", terminalErrorHandler));
|
|
3752
|
+
}
|
|
3747
3753
|
// Restore the terminal before the process dies on any uncaught throw.
|
|
3748
3754
|
// Without this, an unhandled exception from extension code (or anywhere
|
|
3749
3755
|
// in pi) leaves the terminal in raw mode with no cursor.
|
|
@@ -4364,8 +4370,8 @@ export class InteractiveMode {
|
|
|
4364
4370
|
onEnableInstallTelemetryChange: (enabled) => {
|
|
4365
4371
|
this.settingsManager.setEnableInstallTelemetry(enabled);
|
|
4366
4372
|
},
|
|
4367
|
-
onQuietStartupChange: (
|
|
4368
|
-
this.settingsManager.setQuietStartup(
|
|
4373
|
+
onQuietStartupChange: (quiet) => {
|
|
4374
|
+
this.settingsManager.setQuietStartup(quiet);
|
|
4369
4375
|
},
|
|
4370
4376
|
onAttachableSessionsChange: (enabled) => {
|
|
4371
4377
|
// Takes effect on the next session start: this one already bound (or did not).
|
|
@@ -4394,21 +4400,14 @@ export class InteractiveMode {
|
|
|
4394
4400
|
onOutputPadChange: (padding) => {
|
|
4395
4401
|
this.settingsManager.setOutputPad(padding);
|
|
4396
4402
|
this.outputPad = padding;
|
|
4397
|
-
|
|
4398
|
-
for (const child of
|
|
4399
|
-
if (child
|
|
4400
|
-
child instanceof CustomMessageComponent ||
|
|
4401
|
-
child instanceof UserMessageComponent) {
|
|
4403
|
+
for (const container of [this.chatContainer, this.pendingMessagesContainer]) {
|
|
4404
|
+
for (const child of container.children) {
|
|
4405
|
+
if ("setOutputPad" in child && typeof child.setOutputPad === "function") {
|
|
4402
4406
|
child.setOutputPad(padding);
|
|
4403
4407
|
}
|
|
4404
4408
|
}
|
|
4405
|
-
if (this.streamingComponent) {
|
|
4406
|
-
this.streamingComponent.setOutputPad(padding);
|
|
4407
|
-
}
|
|
4408
|
-
this.ui.requestRender();
|
|
4409
|
-
return;
|
|
4410
4409
|
}
|
|
4411
|
-
this.
|
|
4410
|
+
this.ui.requestRender();
|
|
4412
4411
|
},
|
|
4413
4412
|
onAutocompleteMaxVisibleChange: (maxVisible) => {
|
|
4414
4413
|
this.settingsManager.setAutocompleteMaxVisible(maxVisible);
|
|
@@ -5147,6 +5146,7 @@ export class InteractiveMode {
|
|
|
5147
5146
|
source: authStatus.label ?? authStatus.source,
|
|
5148
5147
|
}
|
|
5149
5148
|
: undefined;
|
|
5149
|
+
const subscription = provider.auth.oauth?.isSubscription === true;
|
|
5150
5150
|
if ((!authType || authType === "oauth") && provider.auth.oauth) {
|
|
5151
5151
|
options.push({
|
|
5152
5152
|
id: provider.id,
|
|
@@ -5154,6 +5154,7 @@ export class InteractiveMode {
|
|
|
5154
5154
|
authType: "oauth",
|
|
5155
5155
|
method: provider.auth.oauth,
|
|
5156
5156
|
status,
|
|
5157
|
+
subscription,
|
|
5157
5158
|
});
|
|
5158
5159
|
}
|
|
5159
5160
|
if ((!authType || authType === "api_key") && provider.auth.apiKey) {
|
|
@@ -5163,6 +5164,7 @@ export class InteractiveMode {
|
|
|
5163
5164
|
authType: "api_key",
|
|
5164
5165
|
method: provider.auth.apiKey,
|
|
5165
5166
|
status,
|
|
5167
|
+
subscription,
|
|
5166
5168
|
});
|
|
5167
5169
|
}
|
|
5168
5170
|
}
|
|
@@ -5170,12 +5172,16 @@ export class InteractiveMode {
|
|
|
5170
5172
|
}
|
|
5171
5173
|
async getLogoutProviderOptions() {
|
|
5172
5174
|
return (await this.session.modelRuntime.listCredentials({ signal: AbortSignal.timeout(15_000) }))
|
|
5173
|
-
.map(({ providerId, type }) =>
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5175
|
+
.map(({ providerId, type }) => {
|
|
5176
|
+
const provider = this.session.modelRuntime.getProvider(providerId);
|
|
5177
|
+
return {
|
|
5178
|
+
id: providerId,
|
|
5179
|
+
name: provider?.name ?? providerId,
|
|
5180
|
+
authType: type,
|
|
5181
|
+
status: { type, source: "stored credential" },
|
|
5182
|
+
subscription: provider?.auth.oauth?.isSubscription === true,
|
|
5183
|
+
};
|
|
5184
|
+
})
|
|
5179
5185
|
.sort((a, b) => a.name.localeCompare(b.name));
|
|
5180
5186
|
}
|
|
5181
5187
|
findLoginProviderOptions(providerRef) {
|
|
@@ -5205,18 +5211,25 @@ export class InteractiveMode {
|
|
|
5205
5211
|
}
|
|
5206
5212
|
this.showLoginProviderSelector(undefined, providerRef);
|
|
5207
5213
|
}
|
|
5208
|
-
|
|
5214
|
+
/** `onBack` reopens the selector the login was started from when the user cancels it. */
|
|
5215
|
+
async startProviderLogin(providerOption, onBack) {
|
|
5209
5216
|
if (providerOption.authType === "oauth") {
|
|
5210
|
-
await this.showLoginDialog(providerOption.id, providerOption.name);
|
|
5217
|
+
await this.showLoginDialog(providerOption.id, providerOption.name, onBack);
|
|
5211
5218
|
}
|
|
5212
5219
|
else if (providerOption.method?.login) {
|
|
5213
|
-
await this.showApiKeyLoginDialog(providerOption.id, providerOption.name);
|
|
5220
|
+
await this.showApiKeyLoginDialog(providerOption.id, providerOption.name, onBack);
|
|
5214
5221
|
}
|
|
5215
5222
|
else {
|
|
5216
|
-
this.showAmbientAuthDialog(providerOption);
|
|
5223
|
+
this.showAmbientAuthDialog(providerOption, onBack);
|
|
5217
5224
|
}
|
|
5218
5225
|
}
|
|
5219
5226
|
showLoginAuthTypeSelector(providerOptions) {
|
|
5227
|
+
// The top-level selector offers Radius directly, as its last option.
|
|
5228
|
+
const radiusOption = providerOptions
|
|
5229
|
+
? undefined
|
|
5230
|
+
: this.getLoginProviderOptions("oauth").find((provider) => provider.id === RADIUS_PROVIDER_ID);
|
|
5231
|
+
const radiusText = radiusOption ? `Sign in with ${radiusOption.name}` : undefined;
|
|
5232
|
+
const radiusLabel = radiusOption ? `${radiusText}${formatAuthSelectorProviderStatus(radiusOption)}` : undefined;
|
|
5220
5233
|
const oauthProvider = providerOptions?.find((provider) => provider.authType === "oauth");
|
|
5221
5234
|
const oauthLoginLabel = oauthProvider?.method && "loginLabel" in oauthProvider.method ? oauthProvider.method.loginLabel : undefined;
|
|
5222
5235
|
const subscriptionLabel = oauthLoginLabel ?? "Sign in with an account";
|
|
@@ -5231,6 +5244,8 @@ export class InteractiveMode {
|
|
|
5231
5244
|
if (availableAuthTypes.has("api_key")) {
|
|
5232
5245
|
options.push(apiKeyLabel);
|
|
5233
5246
|
}
|
|
5247
|
+
if (radiusLabel)
|
|
5248
|
+
options.push(radiusLabel);
|
|
5234
5249
|
if (options.length === 0) {
|
|
5235
5250
|
this.showStatus("No login methods available.");
|
|
5236
5251
|
return;
|
|
@@ -5246,29 +5261,37 @@ export class InteractiveMode {
|
|
|
5246
5261
|
? `Select authentication method for ${providerOptions[0].name}:`
|
|
5247
5262
|
: "Select authentication method:";
|
|
5248
5263
|
this.showSelector((done) => {
|
|
5249
|
-
const
|
|
5264
|
+
const onSelect = (option) => {
|
|
5250
5265
|
done();
|
|
5266
|
+
if (radiusOption && option === radiusLabel) {
|
|
5267
|
+
void this.startProviderLogin(radiusOption, () => this.showLoginAuthTypeSelector());
|
|
5268
|
+
return;
|
|
5269
|
+
}
|
|
5251
5270
|
const authType = option === subscriptionLabel ? "oauth" : "api_key";
|
|
5252
5271
|
if (providerOptions) {
|
|
5253
5272
|
const providerOption = providerOptions.find((provider) => provider.authType === authType);
|
|
5254
5273
|
if (providerOption) {
|
|
5255
|
-
void this.startProviderLogin(providerOption);
|
|
5274
|
+
void this.startProviderLogin(providerOption, () => this.showLoginAuthTypeSelector(providerOptions));
|
|
5256
5275
|
}
|
|
5257
5276
|
return;
|
|
5258
5277
|
}
|
|
5259
5278
|
this.showLoginProviderSelector(authType);
|
|
5260
|
-
}
|
|
5279
|
+
};
|
|
5280
|
+
const onCancel = () => {
|
|
5261
5281
|
done();
|
|
5262
5282
|
this.ui.requestRender();
|
|
5263
|
-
}
|
|
5264
|
-
|
|
5283
|
+
};
|
|
5284
|
+
const selector = radiusLabel && radiusText
|
|
5285
|
+
? createLoginMenuSelector(this.ui, title, options, { label: radiusLabel, text: radiusText }, onSelect, onCancel)
|
|
5286
|
+
: new ExtensionSelectorComponent(title, options, onSelect, onCancel);
|
|
5287
|
+
return { component: selector, focus: selector, dispose: () => selector.dispose() };
|
|
5265
5288
|
});
|
|
5266
5289
|
}
|
|
5267
5290
|
showLoginProviderSelector(authType, initialSearchInput) {
|
|
5268
5291
|
const providerOptions = this.getLoginProviderOptions(authType);
|
|
5269
5292
|
if (providerOptions.length === 0) {
|
|
5270
5293
|
const message = authType === "oauth"
|
|
5271
|
-
? "No
|
|
5294
|
+
? "No account providers available."
|
|
5272
5295
|
: authType === "api_key"
|
|
5273
5296
|
? "No API key providers available."
|
|
5274
5297
|
: "No login providers available.";
|
|
@@ -5282,7 +5305,7 @@ export class InteractiveMode {
|
|
|
5282
5305
|
if (!providerOption) {
|
|
5283
5306
|
return;
|
|
5284
5307
|
}
|
|
5285
|
-
await this.startProviderLogin(providerOption);
|
|
5308
|
+
await this.startProviderLogin(providerOption, () => this.showLoginProviderSelector(authType, initialSearchInput));
|
|
5286
5309
|
}, () => {
|
|
5287
5310
|
done();
|
|
5288
5311
|
if (authType) {
|
|
@@ -5436,21 +5459,24 @@ export class InteractiveMode {
|
|
|
5436
5459
|
})
|
|
5437
5460
|
.finally(() => clearTimeout(timeout));
|
|
5438
5461
|
}
|
|
5439
|
-
showAmbientAuthDialog(providerOption) {
|
|
5462
|
+
showAmbientAuthDialog(providerOption, onBack) {
|
|
5440
5463
|
const restoreEditor = () => {
|
|
5441
5464
|
this.editorContainer.clear();
|
|
5442
5465
|
this.editorContainer.addChild(this.editor);
|
|
5443
5466
|
this.ui.setFocus(this.editor);
|
|
5444
5467
|
this.ui.requestRender();
|
|
5445
5468
|
};
|
|
5446
|
-
const dialog = new LoginDialogComponent(this.ui, providerOption.id, () =>
|
|
5469
|
+
const dialog = new LoginDialogComponent(this.ui, providerOption.id, () => {
|
|
5470
|
+
restoreEditor();
|
|
5471
|
+
onBack?.();
|
|
5472
|
+
}, providerOption.name, `${providerOption.name} setup`);
|
|
5447
5473
|
dialog.showInfo(`${providerOption.method?.name ?? "Authentication"} is configured outside ${APP_NAME}.`, [], true);
|
|
5448
5474
|
this.editorContainer.clear();
|
|
5449
5475
|
this.editorContainer.addChild(dialog);
|
|
5450
5476
|
this.ui.setFocus(dialog);
|
|
5451
5477
|
this.ui.requestRender();
|
|
5452
5478
|
}
|
|
5453
|
-
async showApiKeyLoginDialog(providerId, providerName) {
|
|
5479
|
+
async showApiKeyLoginDialog(providerId, providerName, onBack) {
|
|
5454
5480
|
const previousModel = this.session.model;
|
|
5455
5481
|
const dialog = new LoginDialogComponent(this.ui, providerId, (_success, _message) => {
|
|
5456
5482
|
// Completion handled below
|
|
@@ -5473,7 +5499,7 @@ export class InteractiveMode {
|
|
|
5473
5499
|
this.ui.requestRender();
|
|
5474
5500
|
};
|
|
5475
5501
|
try {
|
|
5476
|
-
await this.loginProvider(dialog, providerId, "api_key");
|
|
5502
|
+
await this.loginProvider(dialog, providerId, providerName, "api_key");
|
|
5477
5503
|
restoreEditor();
|
|
5478
5504
|
await this.completeProviderAuthentication(providerId, providerName, "api_key", previousModel);
|
|
5479
5505
|
}
|
|
@@ -5483,12 +5509,15 @@ export class InteractiveMode {
|
|
|
5483
5509
|
if (error instanceof CredentialSynchronizationError) {
|
|
5484
5510
|
this.showError(`Saved API key for ${providerName}, but local model state could not be synchronized: ${errorMsg}`);
|
|
5485
5511
|
}
|
|
5486
|
-
else if (errorMsg
|
|
5512
|
+
else if (errorMsg === "Login cancelled") {
|
|
5513
|
+
onBack?.();
|
|
5514
|
+
}
|
|
5515
|
+
else {
|
|
5487
5516
|
this.showError(`Failed to save API key for ${providerName}: ${errorMsg}`);
|
|
5488
5517
|
}
|
|
5489
5518
|
}
|
|
5490
5519
|
}
|
|
5491
|
-
showAuthSelect(dialog, prompt) {
|
|
5520
|
+
showAuthSelect(dialog, prompt, providerId) {
|
|
5492
5521
|
return new Promise((resolve, reject) => {
|
|
5493
5522
|
const restoreDialog = () => {
|
|
5494
5523
|
this.editorContainer.clear();
|
|
@@ -5507,17 +5536,17 @@ export class InteractiveMode {
|
|
|
5507
5536
|
}, () => {
|
|
5508
5537
|
restoreDialog();
|
|
5509
5538
|
reject(new Error("Login cancelled"));
|
|
5510
|
-
});
|
|
5539
|
+
}, { description: providerId === RADIUS_PROVIDER_ID ? RADIUS_LOGIN_INTRO : undefined });
|
|
5511
5540
|
this.editorContainer.clear();
|
|
5512
5541
|
this.editorContainer.addChild(selector);
|
|
5513
5542
|
this.ui.setFocus(selector);
|
|
5514
5543
|
this.ui.requestRender();
|
|
5515
5544
|
});
|
|
5516
5545
|
}
|
|
5517
|
-
async showAuthPrompt(dialog, prompt) {
|
|
5546
|
+
async showAuthPrompt(dialog, prompt, providerId) {
|
|
5518
5547
|
let response;
|
|
5519
5548
|
if (prompt.type === "select") {
|
|
5520
|
-
response = this.showAuthSelect(dialog, prompt);
|
|
5549
|
+
response = this.showAuthSelect(dialog, prompt, providerId);
|
|
5521
5550
|
}
|
|
5522
5551
|
else if (prompt.type === "manual_code") {
|
|
5523
5552
|
response = dialog.showManualInput(prompt.message);
|
|
@@ -5558,14 +5587,20 @@ export class InteractiveMode {
|
|
|
5558
5587
|
dialog.showProgress(event.message);
|
|
5559
5588
|
}
|
|
5560
5589
|
}
|
|
5561
|
-
async loginProvider(dialog, providerId, method) {
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
|
|
5590
|
+
async loginProvider(dialog, providerId, providerName, method) {
|
|
5591
|
+
this.programStatus.setBlocked("login", { kind: "auth", message: `Log in to ${providerName}` });
|
|
5592
|
+
try {
|
|
5593
|
+
await this.session.modelRuntime.login(providerId, method, {
|
|
5594
|
+
signal: dialog.signal,
|
|
5595
|
+
prompt: (prompt) => this.showAuthPrompt(dialog, prompt, providerId),
|
|
5596
|
+
notify: (event) => this.notifyAuthDialog(dialog, event),
|
|
5597
|
+
}, { getDeviceId: () => this.settingsManager.getOrCreateDeviceId() });
|
|
5598
|
+
}
|
|
5599
|
+
finally {
|
|
5600
|
+
this.programStatus.setBlocked("login", undefined);
|
|
5601
|
+
}
|
|
5567
5602
|
}
|
|
5568
|
-
async showLoginDialog(providerId, providerName) {
|
|
5603
|
+
async showLoginDialog(providerId, providerName, onBack) {
|
|
5569
5604
|
const previousModel = this.session.model;
|
|
5570
5605
|
const dialog = new LoginDialogComponent(this.ui, providerId, (_success, _message) => { }, providerName);
|
|
5571
5606
|
this.editorContainer.clear();
|
|
@@ -5579,9 +5614,11 @@ export class InteractiveMode {
|
|
|
5579
5614
|
this.ui.requestRender();
|
|
5580
5615
|
};
|
|
5581
5616
|
try {
|
|
5582
|
-
await this.loginProvider(dialog, providerId, "oauth");
|
|
5617
|
+
await this.loginProvider(dialog, providerId, providerName, "oauth");
|
|
5583
5618
|
restoreEditor();
|
|
5584
5619
|
await this.completeProviderAuthentication(providerId, providerName, "oauth", previousModel);
|
|
5620
|
+
if (providerId === RADIUS_PROVIDER_ID)
|
|
5621
|
+
this.offerRadiusMcpServer(providerId, providerName);
|
|
5585
5622
|
}
|
|
5586
5623
|
catch (error) {
|
|
5587
5624
|
restoreEditor();
|
|
@@ -5589,11 +5626,58 @@ export class InteractiveMode {
|
|
|
5589
5626
|
if (error instanceof CredentialSynchronizationError) {
|
|
5590
5627
|
this.showError(`Logged in to ${providerName}, but local model state could not be synchronized: ${errorMsg}`);
|
|
5591
5628
|
}
|
|
5592
|
-
else if (errorMsg
|
|
5629
|
+
else if (errorMsg === "Login cancelled") {
|
|
5630
|
+
onBack?.();
|
|
5631
|
+
}
|
|
5632
|
+
else {
|
|
5593
5633
|
this.showError(`Failed to login to ${providerName}: ${errorMsg}`);
|
|
5594
5634
|
}
|
|
5595
5635
|
}
|
|
5596
5636
|
}
|
|
5637
|
+
/**
|
|
5638
|
+
* Offer to point the Radius MCP server in the global mcp.json at the Radius login, adding the server
|
|
5639
|
+
* when missing. Nothing is asked when a global server already uses this login.
|
|
5640
|
+
*/
|
|
5641
|
+
offerRadiusMcpServer(providerId, providerName) {
|
|
5642
|
+
const mcpPath = path.join(getAgentDir(), "mcp.json");
|
|
5643
|
+
const normalizeUrl = (url) => url.replace(/\/+$/u, "");
|
|
5644
|
+
const { servers } = loadMcpConfig({
|
|
5645
|
+
agentDir: getAgentDir(),
|
|
5646
|
+
cwd: this.sessionManager.getCwd(),
|
|
5647
|
+
projectTrusted: false,
|
|
5648
|
+
});
|
|
5649
|
+
const existing = servers.find((server) => "url" in server.config && normalizeUrl(server.config.url) === normalizeUrl(RADIUS_MCP_URL));
|
|
5650
|
+
if (existing && "url" in existing.config && existing.config.auth?.provider === providerId)
|
|
5651
|
+
return;
|
|
5652
|
+
let name = existing?.name ?? "radius";
|
|
5653
|
+
if (!existing && servers.some((server) => server.name === name))
|
|
5654
|
+
name = "radius-mcp";
|
|
5655
|
+
const config = existing && "url" in existing.config
|
|
5656
|
+
? { ...existing.config, auth: { provider: providerId } }
|
|
5657
|
+
: { url: RADIUS_MCP_URL, auth: { provider: providerId } };
|
|
5658
|
+
// `auth` replaces the MCP OAuth sign-in.
|
|
5659
|
+
delete config.oauth;
|
|
5660
|
+
this.showSelector((done) => {
|
|
5661
|
+
const selector = new ExtensionSelectorComponent(`Configure ${providerName} MCP in ${mcpPath}?`, ["Yes", "No"], (option) => {
|
|
5662
|
+
done();
|
|
5663
|
+
if (option !== "Yes")
|
|
5664
|
+
return;
|
|
5665
|
+
try {
|
|
5666
|
+
addMcpServerConfig(mcpPath, name, config);
|
|
5667
|
+
}
|
|
5668
|
+
catch (error) {
|
|
5669
|
+
this.showError(`Could not update ${mcpPath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
5670
|
+
return;
|
|
5671
|
+
}
|
|
5672
|
+
// The MCP extension reads mcp.json when the session starts.
|
|
5673
|
+
void this.handleReloadCommand();
|
|
5674
|
+
}, () => {
|
|
5675
|
+
done();
|
|
5676
|
+
this.ui.requestRender();
|
|
5677
|
+
});
|
|
5678
|
+
return { component: selector, focus: selector };
|
|
5679
|
+
});
|
|
5680
|
+
}
|
|
5597
5681
|
// =========================================================================
|
|
5598
5682
|
// Command handlers
|
|
5599
5683
|
// =========================================================================
|
|
@@ -6130,7 +6214,7 @@ ${cycleContextWindow ? `| \`${cycleContextWindow}\` | Cycle context window |\n`
|
|
|
6130
6214
|
if (eventResult?.result) {
|
|
6131
6215
|
const result = eventResult.result;
|
|
6132
6216
|
// Create UI component for display
|
|
6133
|
-
this.bashComponent = new BashExecutionComponent(command, this.ui, excludeFromContext);
|
|
6217
|
+
this.bashComponent = new BashExecutionComponent(command, this.ui, excludeFromContext, this.outputPad);
|
|
6134
6218
|
if (this.session.isStreaming) {
|
|
6135
6219
|
this.pendingMessagesContainer.addChild(this.bashComponent);
|
|
6136
6220
|
this.pendingBashComponents.push(this.bashComponent);
|
|
@@ -6151,7 +6235,7 @@ ${cycleContextWindow ? `| \`${cycleContextWindow}\` | Cycle context window |\n`
|
|
|
6151
6235
|
}
|
|
6152
6236
|
// Normal execution path (possibly with custom operations)
|
|
6153
6237
|
const isDeferred = this.session.isStreaming;
|
|
6154
|
-
this.bashComponent = new BashExecutionComponent(command, this.ui, excludeFromContext);
|
|
6238
|
+
this.bashComponent = new BashExecutionComponent(command, this.ui, excludeFromContext, this.outputPad);
|
|
6155
6239
|
if (isDeferred) {
|
|
6156
6240
|
// Show in pending area when agent is streaming
|
|
6157
6241
|
this.pendingMessagesContainer.addChild(this.bashComponent);
|