@maxmo74/pi-coding-agent 1.5.0-max.8 → 1.6.0-max.16
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 +214 -0
- package/README.md +1 -1
- package/dist/bundle/chunks/anthropic-messages-WAFIHSF7.js +6 -0
- package/dist/bundle/chunks/{azure-openai-responses-FSC6BAW3.js → azure-openai-responses-EB4MRIM4.js} +1 -1
- package/dist/bundle/chunks/bedrock-converse-stream.js +3 -3
- package/dist/bundle/chunks/chunk-E6LJTZYC.js +82 -0
- package/dist/bundle/chunks/chunk-EEBRZED2.js +44 -0
- package/dist/bundle/chunks/chunk-EVSO24NP.js +2 -0
- package/dist/bundle/chunks/chunk-EXXWEFU5.js +1247 -0
- package/dist/bundle/chunks/{chunk-EOO47QGR.js → chunk-F7LEMV2T.js} +1 -1
- package/dist/bundle/chunks/chunk-I6HYYNH6.js +8 -0
- package/dist/bundle/chunks/chunk-IEBK4HQA.js +2 -0
- package/dist/bundle/chunks/{chunk-V6KH5QG4.js → chunk-ILDLA2JW.js} +1 -1
- package/dist/bundle/chunks/chunk-INODY4DR.js +2 -0
- package/dist/bundle/chunks/{chunk-MSIQUO5T.js → chunk-KREOSXD7.js} +1 -1
- package/dist/bundle/chunks/chunk-LWG2CUTI.js +31 -0
- package/dist/bundle/chunks/{chunk-3TGLJEWK.js → chunk-NRLRGOCX.js} +1 -1
- package/dist/bundle/chunks/chunk-NRY4NBZW.js +4 -0
- package/dist/bundle/chunks/chunk-NV3NPOPF.js +20 -0
- package/dist/bundle/chunks/{chunk-C2WU32PX.js → chunk-RCNEHRMW.js} +1 -1
- package/dist/bundle/chunks/{chunk-4EYXVSA5.js → chunk-X26YOAEH.js} +15 -14
- package/dist/bundle/chunks/chunk-X6RQRO3L.js +16 -0
- package/dist/bundle/chunks/chunk-XGGZYFNG.js +55 -0
- package/dist/bundle/chunks/chunk-XJ2YV77J.js +30 -0
- package/dist/bundle/chunks/{chunk-YZKQS34S.js → chunk-Y55SJART.js} +5 -1
- package/dist/bundle/chunks/chunk-YOWSKVK7.js +2 -0
- package/dist/bundle/chunks/chunk-ZG74NES2.js +2 -0
- package/dist/bundle/chunks/{cli-MCOUW5WS.js → cli-QMJEURSM.js} +7 -7
- package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-WLAFJSP6.js → cloudflare-workers-ai-system-one-AMCR7QEI.js} +1 -1
- package/dist/bundle/chunks/codemode-worker.js +2 -0
- package/dist/bundle/chunks/{easter-egg-3d-WMBNSJ4M.js → easter-egg-3d-7CBVPJQ3.js} +1 -1
- package/dist/bundle/chunks/{execute-4CEBORGZ.js → execute-XDNPBEMU.js} +5 -3
- package/dist/bundle/chunks/github-copilot.js +1 -1
- package/dist/bundle/chunks/google-generative-ai-43M4N5LK.js +2 -0
- package/dist/bundle/chunks/google-vertex-2B3PASK2.js +2 -0
- package/dist/bundle/chunks/{llama-cpp-classify-V5U3QKXI.js → llama-cpp-classify-XXZYF3RR.js} +1 -1
- package/dist/bundle/chunks/{mistral-conversations-S4OWXIXQ.js → mistral-conversations-E3D5ZQKB.js} +2 -2
- package/dist/bundle/chunks/{openai-codex-responses-QAWLOQSN.js → openai-codex-responses-MSQDSDUR.js} +2 -2
- package/dist/bundle/chunks/openai-completions-4IC6AGTR.js +7 -0
- package/dist/bundle/chunks/{openai-decisions-IXI34BYG.js → openai-decisions-LZ2RLVRX.js} +1 -1
- package/dist/bundle/chunks/openai-responses-MCO3BHCC.js +4 -0
- package/dist/bundle/chunks/{openrouter-images-PISKSFMS.js → openrouter-images-SHUJ3VSG.js} +1 -1
- package/dist/bundle/chunks/{pi-messages-NORUKF4E.js → pi-messages-NIKOQ4O7.js} +1 -1
- package/dist/bundle/chunks/{runtime-FQB7RU7U.js → runtime-F3SXQONS.js} +1 -1
- package/dist/bundle/chunks/{typesafe-system-one-CHVC2UUI.js → typesafe-system-one-R2CDUWNO.js} +1 -1
- package/dist/bundle/chunks/virtual-modules-2WYTGPJ3.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.map +1 -1
- package/dist/cli/args.js +5 -3
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/auth-command.d.ts.map +1 -1
- package/dist/cli/auth-command.js +26 -2
- package/dist/cli/auth-command.js.map +1 -1
- package/dist/cli/auth-login.d.ts +15 -0
- package/dist/cli/auth-login.d.ts.map +1 -0
- package/dist/cli/auth-login.js +232 -0
- package/dist/cli/auth-login.js.map +1 -0
- package/dist/cli/auth-logout.d.ts +14 -0
- package/dist/cli/auth-logout.d.ts.map +1 -0
- package/dist/cli/auth-logout.js +57 -0
- package/dist/cli/auth-logout.js.map +1 -0
- package/dist/cli/auth-terminal.d.ts +17 -0
- package/dist/cli/auth-terminal.d.ts.map +1 -0
- package/dist/cli/auth-terminal.js +63 -0
- package/dist/cli/auth-terminal.js.map +1 -0
- package/dist/cli/config-selector.d.ts.map +1 -1
- package/dist/cli/config-selector.js +12 -7
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/cli/session-picker.d.ts.map +1 -1
- package/dist/cli/session-picker.js +9 -6
- package/dist/cli/session-picker.js.map +1 -1
- package/dist/cli/startup-ui.d.ts.map +1 -1
- package/dist/cli/startup-ui.js +4 -0
- package/dist/cli/startup-ui.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +16 -0
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +40 -3
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session.d.ts +31 -9
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +160 -63
- 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 +3 -2
- 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 +3 -1
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/cache-warmer.d.ts +4 -37
- package/dist/core/cache-warmer.d.ts.map +1 -1
- package/dist/core/cache-warmer.js +11 -89
- package/dist/core/cache-warmer.js.map +1 -1
- package/dist/core/compaction/utils.d.ts.map +1 -1
- package/dist/core/compaction/utils.js +2 -1
- package/dist/core/compaction/utils.js.map +1 -1
- package/dist/core/exec.d.ts +1 -0
- package/dist/core/exec.d.ts.map +1 -1
- package/dist/core/exec.js +4 -1
- package/dist/core/exec.js.map +1 -1
- package/dist/core/export-html/ansi-to-html.d.ts +6 -1
- package/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
- package/dist/core/export-html/ansi-to-html.js +57 -20
- package/dist/core/export-html/ansi-to-html.js.map +1 -1
- package/dist/core/export-html/template.js +1 -1
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
- package/dist/core/export-html/tool-renderer.js +2 -3
- package/dist/core/export-html/tool-renderer.js.map +1 -1
- 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 +28 -6
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +1 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +14 -1
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +33 -6
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/keybindings.d.ts +2 -2
- package/dist/core/keybindings.js +1 -1
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/mcp-servers.d.ts +12 -37
- package/dist/core/mcp-servers.d.ts.map +1 -1
- package/dist/core/mcp-servers.js +42 -121
- package/dist/core/mcp-servers.js.map +1 -1
- package/dist/core/model-config.d.ts +52 -0
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-resolver.d.ts +0 -8
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +22 -85
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts +5 -0
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +11 -4
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/package-manager.d.ts +26 -1
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +95 -7
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/pi-ai-schemas.d.ts +4 -0
- package/dist/core/pi-ai-schemas.d.ts.map +1 -1
- package/dist/core/preferred-providers.d.ts +17 -0
- package/dist/core/preferred-providers.d.ts.map +1 -0
- package/dist/core/preferred-providers.js +24 -0
- package/dist/core/preferred-providers.js.map +1 -0
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/prompt-templates.js +18 -2
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +3 -1
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/provider-matching.d.ts +6 -0
- package/dist/core/provider-matching.d.ts.map +1 -0
- package/dist/core/provider-matching.js +8 -0
- package/dist/core/provider-matching.js.map +1 -0
- package/dist/core/radius-mcp.d.ts +13 -0
- package/dist/core/radius-mcp.d.ts.map +1 -0
- package/dist/core/radius-mcp.js +29 -0
- package/dist/core/radius-mcp.js.map +1 -0
- package/dist/core/remote-catalog-provider.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.js +9 -0
- package/dist/core/remote-catalog-provider.js.map +1 -1
- package/dist/core/resource-loader.d.ts +5 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +2 -0
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/runtime-credentials.d.ts +8 -0
- package/dist/core/runtime-credentials.d.ts.map +1 -1
- package/dist/core/runtime-credentials.js +15 -1
- package/dist/core/runtime-credentials.js.map +1 -1
- package/dist/core/session-cwd.d.ts +7 -0
- package/dist/core/session-cwd.d.ts.map +1 -1
- package/dist/core/session-cwd.js +9 -1
- package/dist/core/session-cwd.js.map +1 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +45 -36
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/session-ownership.js +15 -1
- package/dist/core/session-ownership.js.map +1 -1
- package/dist/core/settings-defaults.d.ts +1 -1
- package/dist/core/settings-defaults.d.ts.map +1 -1
- package/dist/core/settings-defaults.js +1 -1
- package/dist/core/settings-defaults.js.map +1 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +35 -5
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit-diff.d.ts +23 -14
- package/dist/core/tools/edit-diff.d.ts.map +1 -1
- package/dist/core/tools/edit-diff.js +182 -41
- package/dist/core/tools/edit-diff.js.map +1 -1
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +8 -7
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +96 -39
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts +5 -3
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +87 -75
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js +2 -1
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/dist/core/tools/output-accumulator.js +4 -1
- package/dist/core/tools/output-accumulator.js.map +1 -1
- package/dist/core/tools/powershell.d.ts.map +1 -1
- package/dist/core/tools/powershell.js +15 -2
- package/dist/core/tools/powershell.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 +146 -35
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/renderers/read.d.ts.map +1 -1
- package/dist/core/tools/renderers/read.js +6 -2
- package/dist/core/tools/renderers/read.js.map +1 -1
- package/dist/core/tools/truncate.d.ts +4 -14
- package/dist/core/tools/truncate.d.ts.map +1 -1
- package/dist/core/tools/truncate.js +23 -29
- package/dist/core/tools/truncate.js.map +1 -1
- package/dist/extensions/codemode/execute.js +4 -4
- package/dist/extensions/codemode/execute.js.map +1 -1
- package/dist/extensions/codemode/tool.d.ts.map +1 -1
- package/dist/extensions/codemode/tool.js +34 -12
- package/dist/extensions/codemode/tool.js.map +1 -1
- package/dist/extensions/llama/client.d.ts +2 -0
- package/dist/extensions/llama/client.d.ts.map +1 -1
- package/dist/extensions/llama/client.js +23 -2
- package/dist/extensions/llama/client.js.map +1 -1
- package/dist/extensions/llama/provider.d.ts +1 -1
- package/dist/extensions/llama/provider.d.ts.map +1 -1
- package/dist/extensions/llama/provider.js +6 -4
- package/dist/extensions/llama/provider.js.map +1 -1
- package/dist/extensions/llama/ui.d.ts.map +1 -1
- package/dist/extensions/llama/ui.js +15 -3
- package/dist/extensions/llama/ui.js.map +1 -1
- package/dist/extensions/mcp/cli.d.ts +2 -0
- package/dist/extensions/mcp/cli.d.ts.map +1 -1
- package/dist/extensions/mcp/cli.js +49 -14
- package/dist/extensions/mcp/cli.js.map +1 -1
- package/dist/extensions/mcp/config.d.ts.map +1 -1
- package/dist/extensions/mcp/config.js +4 -7
- package/dist/extensions/mcp/config.js.map +1 -1
- package/dist/extensions/mcp/index.d.ts.map +1 -1
- package/dist/extensions/mcp/index.js +7 -9
- package/dist/extensions/mcp/index.js.map +1 -1
- package/dist/extensions/mcp/oauth.d.ts +11 -49
- package/dist/extensions/mcp/oauth.d.ts.map +1 -1
- package/dist/extensions/mcp/oauth.js +56 -319
- package/dist/extensions/mcp/oauth.js.map +1 -1
- package/dist/extensions/mcp/resources.d.ts +1 -1
- package/dist/extensions/mcp/resources.d.ts.map +1 -1
- package/dist/extensions/mcp/resources.js +4 -3
- package/dist/extensions/mcp/resources.js.map +1 -1
- package/dist/extensions/mcp/runtime.d.ts +4 -3
- package/dist/extensions/mcp/runtime.d.ts.map +1 -1
- package/dist/extensions/mcp/runtime.js +7 -5
- package/dist/extensions/mcp/runtime.js.map +1 -1
- package/dist/extensions/mcp/tools.d.ts +2 -23
- package/dist/extensions/mcp/tools.d.ts.map +1 -1
- package/dist/extensions/mcp/tools.js +6 -58
- package/dist/extensions/mcp/tools.js.map +1 -1
- package/dist/extensions/tool-search/tool.d.ts.map +1 -1
- package/dist/extensions/tool-search/tool.js +18 -6
- package/dist/extensions/tool-search/tool.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +98 -27
- package/dist/main.js.map +1 -1
- package/dist/modes/diagnostics-stderr.d.ts +4 -0
- package/dist/modes/diagnostics-stderr.d.ts.map +1 -0
- package/dist/modes/diagnostics-stderr.js +11 -0
- package/dist/modes/diagnostics-stderr.js.map +1 -0
- package/dist/modes/interactive/components/assistant-message.d.ts +2 -1
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +9 -3
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts +5 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.js +12 -4
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +5 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.js +12 -4
- package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +5 -2
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.d.ts +5 -2
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-message.js +10 -3
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/diff.d.ts.map +1 -1
- package/dist/modes/interactive/components/diff.js +11 -5
- package/dist/modes/interactive/components/diff.js.map +1 -1
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-selector.js +9 -1
- package/dist/modes/interactive/components/extension-selector.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +1 -18
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/mermaid.d.ts +2 -1
- package/dist/modes/interactive/components/mermaid.d.ts.map +1 -1
- package/dist/modes/interactive/components/mermaid.js +25 -20
- package/dist/modes/interactive/components/mermaid.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +19 -8
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts +10 -3
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +39 -8
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/provider-brand.d.ts +14 -0
- package/dist/modes/interactive/components/provider-brand.d.ts.map +1 -0
- package/dist/modes/interactive/components/provider-brand.js +66 -0
- package/dist/modes/interactive/components/provider-brand.js.map +1 -0
- package/dist/modes/interactive/components/radius-login-selector.d.ts +1 -2
- package/dist/modes/interactive/components/radius-login-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/radius-login-selector.js +8 -38
- package/dist/modes/interactive/components/radius-login-selector.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +9 -1
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts +8 -1
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +41 -9
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-submenu.d.ts +1 -1
- package/dist/modes/interactive/components/settings-submenu.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-submenu.js +5 -1
- package/dist/modes/interactive/components/settings-submenu.js.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +5 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.js +12 -4
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
- package/dist/modes/interactive/components/themed-text.d.ts +1 -1
- package/dist/modes/interactive/components/themed-text.d.ts.map +1 -1
- package/dist/modes/interactive/components/themed-text.js.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +5 -1
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +3 -1
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts +1 -0
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +19 -10
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message.d.ts +2 -1
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message.js +9 -3
- package/dist/modes/interactive/components/user-message.js.map +1 -1
- package/dist/modes/interactive/components/visual-truncate.d.ts +2 -2
- package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -1
- package/dist/modes/interactive/components/visual-truncate.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +14 -2
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +232 -127
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/session-share.js +2 -0
- package/dist/modes/interactive/session-share.js.map +1 -1
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +5 -0
- 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 +35 -23
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +67 -45
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +53 -9
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/utils/changelog.d.ts +2 -2
- package/dist/utils/changelog.d.ts.map +1 -1
- package/dist/utils/changelog.js +15 -8
- package/dist/utils/changelog.js.map +1 -1
- package/dist/utils/flush-stdout.d.ts +8 -0
- package/dist/utils/flush-stdout.d.ts.map +1 -0
- package/dist/utils/flush-stdout.js +23 -0
- package/dist/utils/flush-stdout.js.map +1 -0
- package/dist/utils/image-resize.d.ts.map +1 -1
- package/dist/utils/image-resize.js +3 -1
- package/dist/utils/image-resize.js.map +1 -1
- package/dist/utils/terminal-question.d.ts +8 -0
- package/dist/utils/terminal-question.d.ts.map +1 -0
- package/dist/utils/terminal-question.js +24 -0
- package/dist/utils/terminal-question.js.map +1 -0
- package/dist/utils/version-check.js +1 -1
- package/dist/utils/version-check.js.map +1 -1
- package/dist/utils/web-url.d.ts +12 -0
- package/dist/utils/web-url.d.ts.map +1 -0
- package/dist/utils/web-url.js +20 -0
- package/dist/utils/web-url.js.map +1 -0
- package/docs/cli.md +14 -1
- package/docs/extensions.md +31 -11
- package/docs/keybindings.md +1 -1
- package/docs/llama-cpp.md +5 -8
- package/docs/models-configuration.md +9 -3
- package/docs/models.md +2 -1
- package/docs/nvidia-rtx-llama-cpp.md +5 -5
- package/docs/prompt-templates.md +1 -1
- package/docs/providers.md +4 -2
- package/docs/rpc-commands.md +1 -1
- package/docs/rpc.md +4 -2
- package/docs/sessions.md +7 -1
- package/docs/settings.md +1 -1
- package/docs/tui.md +3 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/gondolin/index.ts +4 -7
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/plan-mode/index.ts +23 -13
- package/examples/extensions/plan-mode/utils.ts +42 -16
- package/examples/extensions/subagent/README.md +14 -11
- package/examples/extensions/subagent/index.ts +392 -171
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/tsconfig.json +63 -35
- package/package.json +11 -11
- package/schemas/models.schema.json +30 -1
- package/schemas/settings.schema.json +1 -1
- package/dist/bundle/chunks/anthropic-messages-BWGCKOF4.js +0 -6
- package/dist/bundle/chunks/chunk-62VOPMLK.js +0 -65
- package/dist/bundle/chunks/chunk-7O7QKK6A.js +0 -2
- package/dist/bundle/chunks/chunk-B46VJEHW.js +0 -44
- package/dist/bundle/chunks/chunk-CF5GWZHW.js +0 -31
- package/dist/bundle/chunks/chunk-CHWNPHIS.js +0 -82
- package/dist/bundle/chunks/chunk-FGCQRPD5.js +0 -1239
- package/dist/bundle/chunks/chunk-GN3QYODH.js +0 -16
- package/dist/bundle/chunks/chunk-NL4X6LBY.js +0 -4
- package/dist/bundle/chunks/chunk-NZY7EIPA.js +0 -4
- package/dist/bundle/chunks/chunk-R2EGYMOO.js +0 -7
- package/dist/bundle/chunks/chunk-UKVNB6C4.js +0 -2
- package/dist/bundle/chunks/chunk-USJZMAIR.js +0 -2
- package/dist/bundle/chunks/chunk-VOLAXWGI.js +0 -2
- package/dist/bundle/chunks/google-generative-ai-INGKNW72.js +0 -2
- package/dist/bundle/chunks/google-vertex-IBTX6MBF.js +0 -2
- package/dist/bundle/chunks/openai-completions-EJNYB6IX.js +0 -7
- package/dist/bundle/chunks/openai-responses-MD3562FB.js +0 -4
- package/dist/bundle/chunks/virtual-modules-CLD44EYP.js +0 -2
- package/dist/utils/deprecation.d.ts +0 -4
- package/dist/utils/deprecation.d.ts.map +0 -1
- package/dist/utils/deprecation.js +0 -13
- package/dist/utils/deprecation.js.map +0 -1
|
@@ -89,6 +89,20 @@ function estimateMessagesTokens(messages) {
|
|
|
89
89
|
// ============================================================================
|
|
90
90
|
// AgentSession Class
|
|
91
91
|
// ============================================================================
|
|
92
|
+
/**
|
|
93
|
+
* Index of the model to cycle to, or undefined when there is nothing to switch to.
|
|
94
|
+
* When the current model is not in the list (currentIndex -1), forward picks the first
|
|
95
|
+
* entry and backward the last, so a one-entry list still selects its only model.
|
|
96
|
+
*/
|
|
97
|
+
function getNextCycleIndex(currentIndex, length, direction) {
|
|
98
|
+
if (length === 0)
|
|
99
|
+
return undefined;
|
|
100
|
+
if (currentIndex === -1)
|
|
101
|
+
return direction === "forward" ? 0 : length - 1;
|
|
102
|
+
if (length === 1)
|
|
103
|
+
return undefined;
|
|
104
|
+
return direction === "forward" ? (currentIndex + 1) % length : (currentIndex - 1 + length) % length;
|
|
105
|
+
}
|
|
92
106
|
export class AgentSession {
|
|
93
107
|
agent;
|
|
94
108
|
sessionManager;
|
|
@@ -98,6 +112,7 @@ export class AgentSession {
|
|
|
98
112
|
_unsubscribeAgent;
|
|
99
113
|
_eventListeners = [];
|
|
100
114
|
_isAgentRunActive = false;
|
|
115
|
+
_promptPreflightCount = 0;
|
|
101
116
|
_agentRunAbortRequested = false;
|
|
102
117
|
_idleWaitPromise;
|
|
103
118
|
_resolveIdleWait;
|
|
@@ -105,6 +120,8 @@ export class AgentSession {
|
|
|
105
120
|
_steeringMessages = [];
|
|
106
121
|
/** Tracks pending follow-up messages for UI display. Removed when delivered. */
|
|
107
122
|
_followUpMessages = [];
|
|
123
|
+
/** Queued user messages whose images are normalized when they are delivered. */
|
|
124
|
+
_queuedMessagesWithImages = new WeakSet();
|
|
108
125
|
/** Messages queued to be included with the next user prompt as context ("asides"). */
|
|
109
126
|
_pendingNextTurnMessages = [];
|
|
110
127
|
/** Context-only custom messages queued during a run, flushed once the current turn's tool results are in. */
|
|
@@ -146,9 +163,11 @@ export class AgentSession {
|
|
|
146
163
|
/**
|
|
147
164
|
* Tools of the restored or reloaded loadout that are not registered yet, such as tools of MCP
|
|
148
165
|
* servers that are still connecting. They are activated when they are registered, and dropped when
|
|
149
|
-
* `setActiveToolsByName()` deactivates a tool or the next agent run starts.
|
|
166
|
+
* `setActiveToolsByName()` deactivates a tool of that loadout or the next agent run starts.
|
|
150
167
|
*/
|
|
151
168
|
_pendingToolNames = new Set();
|
|
169
|
+
/** The restored or reloaded loadout that `_pendingToolNames` belongs to. */
|
|
170
|
+
_restoredToolNames = new Set();
|
|
152
171
|
_usesDefaultTools;
|
|
153
172
|
_defaultToolModifiers;
|
|
154
173
|
/** Matches the `--tools` entries: tool names or patterns. */
|
|
@@ -168,6 +187,8 @@ export class AgentSession {
|
|
|
168
187
|
_extensionShutdownHandler;
|
|
169
188
|
_extensionErrorListener;
|
|
170
189
|
_extensionErrorUnsubscriber;
|
|
190
|
+
// Set by bindExtensions(): reload() restarts extensions only if the host started them.
|
|
191
|
+
_extensionsBound = false;
|
|
171
192
|
_modelRuntime;
|
|
172
193
|
_cacheWarmer;
|
|
173
194
|
// Tool registry for extension getTools/setTools
|
|
@@ -299,19 +320,25 @@ export class AgentSession {
|
|
|
299
320
|
return this._modelRuntime.getPhysicalModel(message.provider, message.model);
|
|
300
321
|
return model?.provider === message.provider && model.id === message.model ? model : undefined;
|
|
301
322
|
}
|
|
323
|
+
/** Record the live model and thinking level on the current branch, so a resume restores them. */
|
|
324
|
+
_recordSelection() {
|
|
325
|
+
const branch = this.sessionManager.getBranch();
|
|
326
|
+
this._recordModelSelection(branch);
|
|
327
|
+
this._recordThinkingLevel(branch);
|
|
328
|
+
}
|
|
302
329
|
/**
|
|
303
|
-
* Record the
|
|
304
|
-
*
|
|
305
|
-
*
|
|
306
|
-
*
|
|
307
|
-
*
|
|
330
|
+
* Record the model on the current branch when the branch implies another one. Tree navigation
|
|
331
|
+
* can leave the latest `model_change` on another branch; responses cannot record a virtual
|
|
332
|
+
* selection because they name physical models. Responses do record a physical selection unless
|
|
333
|
+
* the branch holds a virtual one; checking a physical selection against responses would record
|
|
334
|
+
* it on every prompt while `prepareRequest` redirects to another model.
|
|
308
335
|
*/
|
|
309
|
-
|
|
336
|
+
_recordModelSelection(branch) {
|
|
310
337
|
const model = this.model;
|
|
311
338
|
if (!model)
|
|
312
339
|
return;
|
|
313
340
|
const getModel = (provider, modelId) => this._modelRuntime.getModel(provider, modelId);
|
|
314
|
-
const recorded = getBranchSelection(
|
|
341
|
+
const recorded = getBranchSelection(branch, getModel);
|
|
315
342
|
if (!recorded || (recorded.provider === model.provider && recorded.modelId === model.id))
|
|
316
343
|
return;
|
|
317
344
|
const recordedModel = getModel(recorded.provider, recorded.modelId);
|
|
@@ -319,6 +346,25 @@ export class AgentSession {
|
|
|
319
346
|
return;
|
|
320
347
|
this.sessionManager.appendModelChange(model.provider, model.id);
|
|
321
348
|
}
|
|
349
|
+
/**
|
|
350
|
+
* Record the thinking level on the current branch when the branch implies another one (#11451).
|
|
351
|
+
* Tree navigation can leave the latest `thinking_level_change` on another branch. The recorded
|
|
352
|
+
* level is compared after clamping to the current model, so a level clamped on resume (e.g.
|
|
353
|
+
* `xhigh` running as `high`) is not recorded over the requested one.
|
|
354
|
+
*/
|
|
355
|
+
_recordThinkingLevel(branch) {
|
|
356
|
+
const recorded = branch.findLast((entry) => entry.type === "thinking_level_change");
|
|
357
|
+
if (!recorded)
|
|
358
|
+
return;
|
|
359
|
+
const recordedLevel = recorded.thinkingLevel;
|
|
360
|
+
const availableLevels = this.getAvailableThinkingLevels();
|
|
361
|
+
const effective = availableLevels.includes(recordedLevel)
|
|
362
|
+
? recordedLevel
|
|
363
|
+
: this._clampThinkingLevel(recordedLevel, availableLevels);
|
|
364
|
+
if (effective === this.thinkingLevel)
|
|
365
|
+
return;
|
|
366
|
+
this.sessionManager.appendThinkingLevelChange(this.thinkingLevel);
|
|
367
|
+
}
|
|
322
368
|
/** The model whose limits apply to the conversation. */
|
|
323
369
|
_limitsModel() {
|
|
324
370
|
return this.routedModel?.model ?? this.model;
|
|
@@ -744,21 +790,25 @@ export class AgentSession {
|
|
|
744
790
|
if (event.type === "message_start" && event.message.role === "user") {
|
|
745
791
|
this._overflowRecoveryAttempted = false;
|
|
746
792
|
const messageText = contentText(event.message.content, "");
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
793
|
+
// Check steering queue first
|
|
794
|
+
const steeringIndex = this._steeringMessages.indexOf(messageText);
|
|
795
|
+
if (steeringIndex !== -1) {
|
|
796
|
+
this._steeringMessages.splice(steeringIndex, 1);
|
|
797
|
+
this._emitQueueUpdate();
|
|
798
|
+
}
|
|
799
|
+
else {
|
|
800
|
+
// Check follow-up queue
|
|
801
|
+
const followUpIndex = this._followUpMessages.indexOf(messageText);
|
|
802
|
+
if (followUpIndex !== -1) {
|
|
803
|
+
this._followUpMessages.splice(followUpIndex, 1);
|
|
752
804
|
this._emitQueueUpdate();
|
|
753
805
|
}
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
}
|
|
761
|
-
}
|
|
806
|
+
}
|
|
807
|
+
// Normalize queued images at delivery, before events and persistence see the message,
|
|
808
|
+
// so they get the same resize as idle prompts with the current model's limits (#11738).
|
|
809
|
+
if (this._queuedMessagesWithImages.has(event.message)) {
|
|
810
|
+
this._queuedMessagesWithImages.delete(event.message);
|
|
811
|
+
await this._normalizeQueuedMessageImages(event.message);
|
|
762
812
|
}
|
|
763
813
|
}
|
|
764
814
|
// Emit to extensions first, then notify public listeners.
|
|
@@ -1132,11 +1182,14 @@ export class AgentSession {
|
|
|
1132
1182
|
setActiveToolsByName(toolNames) {
|
|
1133
1183
|
const previous = this.getActiveToolNames();
|
|
1134
1184
|
this._setActiveTools(toolNames);
|
|
1135
|
-
// A loadout that deactivates a tool
|
|
1136
|
-
// One that only adds tools, like activating tool_search, keeps them
|
|
1185
|
+
// A loadout that deactivates a tool of the restored one replaces it, and its pending tools are
|
|
1186
|
+
// dropped. One that only adds tools, like activating tool_search, keeps them, and so does one
|
|
1187
|
+
// that only deactivates tools outside the restored loadout, such as an extension's own tool that
|
|
1188
|
+
// the restore or reload activated as newly registered.
|
|
1137
1189
|
const active = new Set(this.getActiveToolNames());
|
|
1138
|
-
if (previous.some((name) => !active.has(name)))
|
|
1190
|
+
if (previous.some((name) => !active.has(name) && this._restoredToolNames.has(name))) {
|
|
1139
1191
|
this._pendingToolNames.clear();
|
|
1192
|
+
}
|
|
1140
1193
|
}
|
|
1141
1194
|
_setActiveTools(toolNames) {
|
|
1142
1195
|
const tools = this._applyToolLoadout(toolNames);
|
|
@@ -1406,6 +1459,7 @@ export class AgentSession {
|
|
|
1406
1459
|
*/
|
|
1407
1460
|
_restoreToolsFromTranscript(modifiers = []) {
|
|
1408
1461
|
this._pendingToolNames.clear();
|
|
1462
|
+
this._restoredToolNames.clear();
|
|
1409
1463
|
// All system messages on the branch, including those before a compaction. Compaction snapshots
|
|
1410
1464
|
// are derived from these, so replaying them gives the current loadout.
|
|
1411
1465
|
const systemMessages = this.sessionManager
|
|
@@ -1426,6 +1480,7 @@ export class AgentSession {
|
|
|
1426
1480
|
// Recorded tools that are not registered yet, such as MCP tools of servers still connecting, are
|
|
1427
1481
|
// activated when they register. Excluded tools never register, so they are not kept pending.
|
|
1428
1482
|
this._pendingToolNames = new Set(names.filter((name) => this._isAllowedTool(name)));
|
|
1483
|
+
this._restoredToolNames = new Set(applyToolModifiers(getCurrentTools(systemMessages).map((tool) => tool.name), modifiers));
|
|
1429
1484
|
// Ignores names that are not registered.
|
|
1430
1485
|
this._setActiveTools(names);
|
|
1431
1486
|
}
|
|
@@ -1663,14 +1718,34 @@ export class AgentSession {
|
|
|
1663
1718
|
return;
|
|
1664
1719
|
}
|
|
1665
1720
|
}
|
|
1666
|
-
if (this._compactionAbortController !== undefined) {
|
|
1721
|
+
if (this._compactionAbortController !== undefined || this._branchSummaryAbortController !== undefined) {
|
|
1667
1722
|
throw new Error("Cannot submit a prompt while compaction is in progress. Wait for compaction to finish and retry.");
|
|
1668
1723
|
}
|
|
1724
|
+
// Reserve the context through async input hooks and auth checks so tree navigation cannot
|
|
1725
|
+
// start meanwhile (#9154). _startRun marks the run active synchronously, so there is no gap.
|
|
1726
|
+
this._promptPreflightCount++;
|
|
1727
|
+
let trigger;
|
|
1728
|
+
try {
|
|
1729
|
+
trigger = await this._preparePrompt(text, options);
|
|
1730
|
+
}
|
|
1731
|
+
finally {
|
|
1732
|
+
this._promptPreflightCount--;
|
|
1733
|
+
}
|
|
1734
|
+
if (trigger)
|
|
1735
|
+
await this._startRun(trigger, () => preflightResult?.("started"));
|
|
1736
|
+
}
|
|
1737
|
+
/**
|
|
1738
|
+
* Run input hooks, expand templates, queue while streaming, and validate model and auth.
|
|
1739
|
+
* Returns the run trigger, or undefined when the prompt was handled or queued.
|
|
1740
|
+
*/
|
|
1741
|
+
async _preparePrompt(text, options) {
|
|
1742
|
+
const expandPromptTemplates = options?.expandPromptTemplates ?? true;
|
|
1743
|
+
const preflightResult = options?.preflightResult;
|
|
1669
1744
|
// Emit input event for extension interception (before skill/template expansion)
|
|
1670
1745
|
const processedInput = await this._runInputHandlers(text, options?.images, options?.source ?? "interactive", this.isStreaming ? options?.streamingBehavior : undefined);
|
|
1671
1746
|
if (!processedInput) {
|
|
1672
1747
|
preflightResult?.("handled");
|
|
1673
|
-
return;
|
|
1748
|
+
return undefined;
|
|
1674
1749
|
}
|
|
1675
1750
|
const { text: currentText, images: currentImages } = processedInput;
|
|
1676
1751
|
// Expand skill commands (/skill:name args) and prompt templates (/template args)
|
|
@@ -1691,7 +1766,7 @@ export class AgentSession {
|
|
|
1691
1766
|
await this._queueSteer(expandedText, currentImages);
|
|
1692
1767
|
}
|
|
1693
1768
|
preflightResult?.("queued");
|
|
1694
|
-
return;
|
|
1769
|
+
return undefined;
|
|
1695
1770
|
}
|
|
1696
1771
|
// Validate model
|
|
1697
1772
|
if (!this.model) {
|
|
@@ -1708,7 +1783,7 @@ export class AgentSession {
|
|
|
1708
1783
|
}
|
|
1709
1784
|
throw new Error(formatNoApiKeyFoundMessage(this.model.provider));
|
|
1710
1785
|
}
|
|
1711
|
-
|
|
1786
|
+
return { messageType: "user", prompt: expandedText, images: currentImages };
|
|
1712
1787
|
}
|
|
1713
1788
|
/**
|
|
1714
1789
|
* Try to execute an extension command. Returns true if command was found and executed.
|
|
@@ -1817,11 +1892,10 @@ export class AgentSession {
|
|
|
1817
1892
|
if (images) {
|
|
1818
1893
|
content.push(...images);
|
|
1819
1894
|
}
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
});
|
|
1895
|
+
const message = { role: "user", content, timestamp: Date.now() };
|
|
1896
|
+
if (images?.length)
|
|
1897
|
+
this._queuedMessagesWithImages.add(message);
|
|
1898
|
+
this.agent.steer(message);
|
|
1825
1899
|
}
|
|
1826
1900
|
/**
|
|
1827
1901
|
* Internal: Queue a follow-up message (already expanded, no extension command check).
|
|
@@ -1833,7 +1907,26 @@ export class AgentSession {
|
|
|
1833
1907
|
if (images) {
|
|
1834
1908
|
content.push(...images);
|
|
1835
1909
|
}
|
|
1836
|
-
|
|
1910
|
+
const message = { role: "user", content, timestamp: Date.now() };
|
|
1911
|
+
if (images?.length)
|
|
1912
|
+
this._queuedMessagesWithImages.add(message);
|
|
1913
|
+
this.agent.followUp(message);
|
|
1914
|
+
}
|
|
1915
|
+
/** Replace a queued user message's images in place with normalized ones, appending hints to its text. */
|
|
1916
|
+
async _normalizeQueuedMessageImages(message) {
|
|
1917
|
+
if (typeof message.content === "string")
|
|
1918
|
+
return;
|
|
1919
|
+
const [first, ...rest] = message.content;
|
|
1920
|
+
if (first?.type !== "text")
|
|
1921
|
+
return;
|
|
1922
|
+
const images = rest.filter((block) => block.type === "image");
|
|
1923
|
+
const normalized = await this._normalizePromptImages(images);
|
|
1924
|
+
const text = normalized.hints.length > 0 ? `${first.text}\n\n${normalized.hints.join("\n")}` : first.text;
|
|
1925
|
+
message.content = [
|
|
1926
|
+
{ type: "text", text },
|
|
1927
|
+
...rest.filter((block) => block.type !== "image"),
|
|
1928
|
+
...normalized.images,
|
|
1929
|
+
];
|
|
1837
1930
|
}
|
|
1838
1931
|
/**
|
|
1839
1932
|
* Throw an error if the text is an extension command.
|
|
@@ -2070,14 +2163,11 @@ export class AgentSession {
|
|
|
2070
2163
|
async _cycleScopedModel(direction, options) {
|
|
2071
2164
|
const availableIds = new Set(this._modelRuntime.getAvailableSnapshot().map((model) => `${model.provider}\0${model.id}`));
|
|
2072
2165
|
const scopedModels = this._scopedModels.filter((scoped) => availableIds.has(`${scoped.model.provider}\0${scoped.model.id}`));
|
|
2073
|
-
if (scopedModels.length <= 1)
|
|
2074
|
-
return undefined;
|
|
2075
2166
|
const currentModel = this.model;
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
const nextIndex = direction === "forward" ? (currentIndex + 1) % len : (currentIndex - 1 + len) % len;
|
|
2167
|
+
const currentIndex = scopedModels.findIndex((sm) => modelsAreEqual(sm.model, currentModel));
|
|
2168
|
+
const nextIndex = getNextCycleIndex(currentIndex, scopedModels.length, direction);
|
|
2169
|
+
if (nextIndex === undefined)
|
|
2170
|
+
return undefined;
|
|
2081
2171
|
const next = scopedModels[nextIndex];
|
|
2082
2172
|
const thinkingLevel = this._getThinkingLevelForModelSwitch(next.model, next.thinkingLevel);
|
|
2083
2173
|
// Apply model
|
|
@@ -2098,14 +2188,11 @@ export class AgentSession {
|
|
|
2098
2188
|
}
|
|
2099
2189
|
async _cycleAvailableModel(direction, options) {
|
|
2100
2190
|
const availableModels = this._modelRuntime.getAvailableSnapshot();
|
|
2101
|
-
if (availableModels.length <= 1)
|
|
2102
|
-
return undefined;
|
|
2103
2191
|
const currentModel = this.model;
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
const nextIndex = direction === "forward" ? (currentIndex + 1) % len : (currentIndex - 1 + len) % len;
|
|
2192
|
+
const currentIndex = availableModels.findIndex((m) => modelsAreEqual(m, currentModel));
|
|
2193
|
+
const nextIndex = getNextCycleIndex(currentIndex, availableModels.length, direction);
|
|
2194
|
+
if (nextIndex === undefined)
|
|
2195
|
+
return undefined;
|
|
2109
2196
|
const nextModel = availableModels[nextIndex];
|
|
2110
2197
|
const thinkingLevel = this._getThinkingLevelForModelSwitch(nextModel);
|
|
2111
2198
|
this.agent.state.model = nextModel;
|
|
@@ -2694,6 +2781,7 @@ export class AgentSession {
|
|
|
2694
2781
|
if (bindings.onError !== undefined) {
|
|
2695
2782
|
this._extensionErrorListener = bindings.onError;
|
|
2696
2783
|
}
|
|
2784
|
+
this._extensionsBound = true;
|
|
2697
2785
|
this._applyExtensionBindings(this._extensionRunner);
|
|
2698
2786
|
await this._extensionRunner.emit(this._sessionStartEvent);
|
|
2699
2787
|
this._extensionRunner.reportUnhandledMcpServers();
|
|
@@ -3014,6 +3102,12 @@ export class AgentSession {
|
|
|
3014
3102
|
});
|
|
3015
3103
|
}
|
|
3016
3104
|
async reload(options) {
|
|
3105
|
+
if (this.isStreaming) {
|
|
3106
|
+
throw new Error("Wait for the current response to finish before reloading.");
|
|
3107
|
+
}
|
|
3108
|
+
if (this.isCompacting) {
|
|
3109
|
+
throw new Error("Wait for compaction to finish before reloading.");
|
|
3110
|
+
}
|
|
3017
3111
|
const oldRunner = this._extensionRunner;
|
|
3018
3112
|
const previousFlagValues = oldRunner.getFlagValues();
|
|
3019
3113
|
await emitSessionShutdownEvent(oldRunner, { type: "session_shutdown", reason: "reload" });
|
|
@@ -3032,16 +3126,13 @@ export class AgentSession {
|
|
|
3032
3126
|
// Tools the new extensions register later, such as MCP tools, are pending until then.
|
|
3033
3127
|
for (const name of this.getActiveToolNames())
|
|
3034
3128
|
this._pendingToolNames.add(name);
|
|
3129
|
+
this._restoredToolNames = new Set(this.getActiveToolNames());
|
|
3035
3130
|
this._buildRuntime({
|
|
3036
3131
|
activeToolNames: [...this.getActiveToolNames(), ...addedDefaultTools],
|
|
3037
3132
|
flagValues: previousFlagValues,
|
|
3038
3133
|
includeAllExtensionTools: true,
|
|
3039
3134
|
});
|
|
3040
|
-
|
|
3041
|
-
this._extensionCommandContextActions ||
|
|
3042
|
-
this._extensionShutdownHandler ||
|
|
3043
|
-
this._extensionErrorListener;
|
|
3044
|
-
if (hasBindings) {
|
|
3135
|
+
if (this._extensionsBound) {
|
|
3045
3136
|
await options?.beforeSessionStart?.();
|
|
3046
3137
|
await this._extensionRunner.emit({ type: "session_start", reason: "reload" });
|
|
3047
3138
|
this._extensionRunner.reportUnhandledMcpServers();
|
|
@@ -3277,7 +3368,7 @@ export class AgentSession {
|
|
|
3277
3368
|
* @returns Result with editorText (if user message) and cancelled status
|
|
3278
3369
|
*/
|
|
3279
3370
|
async navigateTree(targetId, options = {}) {
|
|
3280
|
-
if (this.isStreaming) {
|
|
3371
|
+
if (this.isStreaming || this._promptPreflightCount > 0) {
|
|
3281
3372
|
throw new Error("Wait for the current response to finish before navigating the session tree.");
|
|
3282
3373
|
}
|
|
3283
3374
|
if (this.isCompacting) {
|
|
@@ -3313,7 +3404,8 @@ export class AgentSession {
|
|
|
3313
3404
|
label,
|
|
3314
3405
|
};
|
|
3315
3406
|
// Set up abort controller for summarization
|
|
3316
|
-
|
|
3407
|
+
const abortController = new AbortController();
|
|
3408
|
+
this._branchSummaryAbortController = abortController;
|
|
3317
3409
|
try {
|
|
3318
3410
|
let extensionSummary;
|
|
3319
3411
|
let fromExtension = false;
|
|
@@ -3322,7 +3414,7 @@ export class AgentSession {
|
|
|
3322
3414
|
const result = (await this._extensionRunner.emit({
|
|
3323
3415
|
type: "session_before_tree",
|
|
3324
3416
|
preparation,
|
|
3325
|
-
signal:
|
|
3417
|
+
signal: abortController.signal,
|
|
3326
3418
|
}));
|
|
3327
3419
|
if (result?.cancel) {
|
|
3328
3420
|
return { cancelled: true };
|
|
@@ -3347,7 +3439,7 @@ export class AgentSession {
|
|
|
3347
3439
|
let summaryDetails;
|
|
3348
3440
|
let summaryUsage;
|
|
3349
3441
|
if (options.summarize && entriesToSummarize.length > 0 && !extensionSummary) {
|
|
3350
|
-
const signal =
|
|
3442
|
+
const signal = abortController.signal;
|
|
3351
3443
|
const branchSummarySettings = this.settingsManager.getBranchSummarySettings();
|
|
3352
3444
|
const result = await generateBranchSummary(entriesToSummarize, {
|
|
3353
3445
|
...(await this._getSummarizationRequestAuth(this.model, signal)),
|
|
@@ -3421,7 +3513,8 @@ export class AgentSession {
|
|
|
3421
3513
|
// Update finalized context from the canonical session projection.
|
|
3422
3514
|
this._refreshFinalizedContext();
|
|
3423
3515
|
this._restoreToolsFromTranscript();
|
|
3424
|
-
//
|
|
3516
|
+
// The selected context is installed; session_tree handlers may now prompt or navigate again.
|
|
3517
|
+
this._branchSummaryAbortController = undefined;
|
|
3425
3518
|
await this._extensionRunner.emit({
|
|
3426
3519
|
type: "session_tree",
|
|
3427
3520
|
newLeafId: this.sessionManager.getLeafId(),
|
|
@@ -3433,7 +3526,10 @@ export class AgentSession {
|
|
|
3433
3526
|
return { editorText, cancelled: false, summaryEntry };
|
|
3434
3527
|
}
|
|
3435
3528
|
finally {
|
|
3436
|
-
|
|
3529
|
+
// A navigation started from session_tree owns the controller now; do not clear it.
|
|
3530
|
+
if (this._branchSummaryAbortController === abortController) {
|
|
3531
|
+
this._branchSummaryAbortController = undefined;
|
|
3532
|
+
}
|
|
3437
3533
|
this._resolveIdleWaitIfIdle();
|
|
3438
3534
|
}
|
|
3439
3535
|
}
|
|
@@ -3602,9 +3698,9 @@ export class AgentSession {
|
|
|
3602
3698
|
// Utilities
|
|
3603
3699
|
// =========================================================================
|
|
3604
3700
|
/**
|
|
3605
|
-
* Get text content of last assistant
|
|
3701
|
+
* Get text content of the last assistant reply.
|
|
3606
3702
|
* Useful for /copy command.
|
|
3607
|
-
* @returns Text content, or undefined if no assistant message exists
|
|
3703
|
+
* @returns Text content, or undefined if no assistant message exists or the last reply has no text
|
|
3608
3704
|
*/
|
|
3609
3705
|
getLastAssistantText() {
|
|
3610
3706
|
const lastAssistant = this.messages
|
|
@@ -3614,8 +3710,9 @@ export class AgentSession {
|
|
|
3614
3710
|
if (m.role !== "assistant")
|
|
3615
3711
|
return false;
|
|
3616
3712
|
const msg = m;
|
|
3617
|
-
// Skip aborted
|
|
3618
|
-
|
|
3713
|
+
// Skip messages without text from a turn that did not end normally: aborted, failed or only
|
|
3714
|
+
// calling tools (#12119). A reply that ended normally stays the last reply even without text.
|
|
3715
|
+
if (msg.stopReason !== "stop" && !msg.content.some((c) => c.type === "text" && c.text.trim()))
|
|
3619
3716
|
return false;
|
|
3620
3717
|
return true;
|
|
3621
3718
|
});
|