@maxmo74/pi-coding-agent 1.5.0-max.7 → 1.5.2-max.15
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 +132 -0
- package/dist/bundle/chunks/anthropic-messages-CA3HHOL3.js +6 -0
- package/dist/bundle/chunks/{azure-openai-responses-FSC6BAW3.js → azure-openai-responses-76TWS6DT.js} +1 -1
- package/dist/bundle/chunks/bedrock-converse-stream.js +3 -3
- package/dist/bundle/chunks/chunk-4KSTFUIK.js +19 -0
- package/dist/bundle/chunks/chunk-4UNPP53I.js +55 -0
- package/dist/bundle/chunks/chunk-AUUCDC7R.js +4 -0
- package/dist/bundle/chunks/{chunk-V6KH5QG4.js → chunk-BAC3QPNW.js} +1 -1
- package/dist/bundle/chunks/{chunk-HK6CSLVH.js → chunk-COKMCNCW.js} +1 -1
- package/dist/bundle/chunks/{chunk-4EYXVSA5.js → chunk-FF6XOTWB.js} +9 -9
- package/dist/bundle/chunks/chunk-FMPAMX2W.js +82 -0
- package/dist/bundle/chunks/chunk-GFUN2N5K.js +2 -0
- package/dist/bundle/chunks/chunk-IEBK4HQA.js +2 -0
- package/dist/bundle/chunks/{chunk-C2WU32PX.js → chunk-IQUU5XIT.js} +1 -1
- package/dist/bundle/chunks/chunk-M6TSYZBS.js +1244 -0
- package/dist/bundle/chunks/{chunk-GN3QYODH.js → chunk-QN4TOIZN.js} +1 -1
- package/dist/bundle/chunks/chunk-RKNK4Y6L.js +2 -0
- package/dist/bundle/chunks/{chunk-B46VJEHW.js → chunk-V7SLUK6A.js} +1 -1
- package/dist/bundle/chunks/chunk-VKJQ6CME.js +8 -0
- package/dist/bundle/chunks/{chunk-3TGLJEWK.js → chunk-WL4TUXY7.js} +1 -1
- package/dist/bundle/chunks/{chunk-YZKQS34S.js → chunk-Y55SJART.js} +5 -1
- package/dist/bundle/chunks/chunk-YTPJCXUB.js +30 -0
- package/dist/bundle/chunks/{chunk-EOO47QGR.js → chunk-ZBIZYD6W.js} +1 -1
- package/dist/bundle/chunks/chunk-ZG74NES2.js +2 -0
- package/dist/bundle/chunks/chunk-ZGYS4UTC.js +2 -0
- package/dist/bundle/chunks/{cli-MCOUW5WS.js → cli-2MK3TR7P.js} +7 -7
- package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-WLAFJSP6.js → cloudflare-workers-ai-system-one-U4J7D646.js} +1 -1
- package/dist/bundle/chunks/codemode-worker.js +2 -0
- package/dist/bundle/chunks/{easter-egg-3d-WMBNSJ4M.js → easter-egg-3d-GEVPKQF6.js} +1 -1
- package/dist/bundle/chunks/{execute-4CEBORGZ.js → execute-L2EEDV3L.js} +5 -3
- package/dist/bundle/chunks/github-copilot.js +1 -1
- package/dist/bundle/chunks/{google-generative-ai-INGKNW72.js → google-generative-ai-D5B6W47J.js} +1 -1
- package/dist/bundle/chunks/{google-vertex-IBTX6MBF.js → google-vertex-U4H5YDEW.js} +1 -1
- package/dist/bundle/chunks/{llama-cpp-classify-V5U3QKXI.js → llama-cpp-classify-EJXCQRUQ.js} +1 -1
- package/dist/bundle/chunks/{mistral-conversations-S4OWXIXQ.js → mistral-conversations-S277EKLB.js} +1 -1
- package/dist/bundle/chunks/openai-codex-responses-TEQRB65N.js +10 -0
- package/dist/bundle/chunks/{openai-completions-EJNYB6IX.js → openai-completions-HRZOSLBO.js} +3 -3
- package/dist/bundle/chunks/{openai-decisions-IXI34BYG.js → openai-decisions-F66BDLOM.js} +1 -1
- package/dist/bundle/chunks/openai-responses-BAKFWTGE.js +4 -0
- package/dist/bundle/chunks/{openrouter-images-PISKSFMS.js → openrouter-images-VXF5TVIK.js} +1 -1
- package/dist/bundle/chunks/{pi-messages-NORUKF4E.js → pi-messages-UBJKNDRN.js} +1 -1
- package/dist/bundle/chunks/{runtime-FQB7RU7U.js → runtime-J5ZSBGTX.js} +1 -1
- package/dist/bundle/chunks/{typesafe-system-one-CHVC2UUI.js → typesafe-system-one-56TEMIHL.js} +1 -1
- package/dist/bundle/chunks/virtual-modules-MRQHQVIQ.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.js +1 -1
- 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 +3 -1
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +5 -0
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +21 -3
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session.d.ts +25 -6
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +139 -50
- 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/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 +10 -5
- 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 +9 -1
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +28 -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.map +1 -1
- package/dist/core/model-resolver.js +20 -19
- 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 +10 -1
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +50 -5
- 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 +2 -0
- package/dist/core/remote-catalog-provider.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/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 +82 -36
- 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/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 +8 -0
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +141 -25
- package/dist/core/tools/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/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 +4 -3
- 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 +59 -11
- package/dist/main.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/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 +14 -6
- 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 +32 -5
- 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 +6 -37
- package/dist/modes/interactive/components/radius-login-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts +13 -0
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +60 -12
- package/dist/modes/interactive/components/session-selector.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/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/interactive-mode.d.ts +13 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +161 -91
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +4 -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 +19 -10
- 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 +53 -23
- 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 +39 -8
- 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 +12 -6
- package/dist/utils/changelog.js.map +1 -1
- 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 +27 -7
- package/docs/keybindings.md +1 -1
- package/docs/llama-cpp.md +5 -8
- package/docs/models-configuration.md +6 -1
- package/docs/models.md +2 -1
- package/docs/prompt-templates.md +1 -1
- package/docs/providers.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 +1 -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/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 +10 -10
- package/schemas/models.schema.json +29 -0
- 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-CHWNPHIS.js +0 -82
- package/dist/bundle/chunks/chunk-MFRYL6YI.js +0 -1239
- 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/openai-codex-responses-QAWLOQSN.js +0 -10
- package/dist/bundle/chunks/openai-responses-MD3562FB.js +0 -4
- package/dist/bundle/chunks/virtual-modules-GVBCPTET.js +0 -2
|
@@ -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. */
|
|
@@ -299,19 +316,25 @@ export class AgentSession {
|
|
|
299
316
|
return this._modelRuntime.getPhysicalModel(message.provider, message.model);
|
|
300
317
|
return model?.provider === message.provider && model.id === message.model ? model : undefined;
|
|
301
318
|
}
|
|
319
|
+
/** Record the live model and thinking level on the current branch, so a resume restores them. */
|
|
320
|
+
_recordSelection() {
|
|
321
|
+
const branch = this.sessionManager.getBranch();
|
|
322
|
+
this._recordModelSelection(branch);
|
|
323
|
+
this._recordThinkingLevel(branch);
|
|
324
|
+
}
|
|
302
325
|
/**
|
|
303
|
-
* Record the
|
|
304
|
-
*
|
|
305
|
-
*
|
|
306
|
-
*
|
|
307
|
-
*
|
|
326
|
+
* Record the model on the current branch when the branch implies another one. Tree navigation
|
|
327
|
+
* can leave the latest `model_change` on another branch; responses cannot record a virtual
|
|
328
|
+
* selection because they name physical models. Responses do record a physical selection unless
|
|
329
|
+
* the branch holds a virtual one; checking a physical selection against responses would record
|
|
330
|
+
* it on every prompt while `prepareRequest` redirects to another model.
|
|
308
331
|
*/
|
|
309
|
-
|
|
332
|
+
_recordModelSelection(branch) {
|
|
310
333
|
const model = this.model;
|
|
311
334
|
if (!model)
|
|
312
335
|
return;
|
|
313
336
|
const getModel = (provider, modelId) => this._modelRuntime.getModel(provider, modelId);
|
|
314
|
-
const recorded = getBranchSelection(
|
|
337
|
+
const recorded = getBranchSelection(branch, getModel);
|
|
315
338
|
if (!recorded || (recorded.provider === model.provider && recorded.modelId === model.id))
|
|
316
339
|
return;
|
|
317
340
|
const recordedModel = getModel(recorded.provider, recorded.modelId);
|
|
@@ -319,6 +342,25 @@ export class AgentSession {
|
|
|
319
342
|
return;
|
|
320
343
|
this.sessionManager.appendModelChange(model.provider, model.id);
|
|
321
344
|
}
|
|
345
|
+
/**
|
|
346
|
+
* Record the thinking level on the current branch when the branch implies another one (#11451).
|
|
347
|
+
* Tree navigation can leave the latest `thinking_level_change` on another branch. The recorded
|
|
348
|
+
* level is compared after clamping to the current model, so a level clamped on resume (e.g.
|
|
349
|
+
* `xhigh` running as `high`) is not recorded over the requested one.
|
|
350
|
+
*/
|
|
351
|
+
_recordThinkingLevel(branch) {
|
|
352
|
+
const recorded = branch.findLast((entry) => entry.type === "thinking_level_change");
|
|
353
|
+
if (!recorded)
|
|
354
|
+
return;
|
|
355
|
+
const recordedLevel = recorded.thinkingLevel;
|
|
356
|
+
const availableLevels = this.getAvailableThinkingLevels();
|
|
357
|
+
const effective = availableLevels.includes(recordedLevel)
|
|
358
|
+
? recordedLevel
|
|
359
|
+
: this._clampThinkingLevel(recordedLevel, availableLevels);
|
|
360
|
+
if (effective === this.thinkingLevel)
|
|
361
|
+
return;
|
|
362
|
+
this.sessionManager.appendThinkingLevelChange(this.thinkingLevel);
|
|
363
|
+
}
|
|
322
364
|
/** The model whose limits apply to the conversation. */
|
|
323
365
|
_limitsModel() {
|
|
324
366
|
return this.routedModel?.model ?? this.model;
|
|
@@ -744,21 +786,25 @@ export class AgentSession {
|
|
|
744
786
|
if (event.type === "message_start" && event.message.role === "user") {
|
|
745
787
|
this._overflowRecoveryAttempted = false;
|
|
746
788
|
const messageText = contentText(event.message.content, "");
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
789
|
+
// Check steering queue first
|
|
790
|
+
const steeringIndex = this._steeringMessages.indexOf(messageText);
|
|
791
|
+
if (steeringIndex !== -1) {
|
|
792
|
+
this._steeringMessages.splice(steeringIndex, 1);
|
|
793
|
+
this._emitQueueUpdate();
|
|
794
|
+
}
|
|
795
|
+
else {
|
|
796
|
+
// Check follow-up queue
|
|
797
|
+
const followUpIndex = this._followUpMessages.indexOf(messageText);
|
|
798
|
+
if (followUpIndex !== -1) {
|
|
799
|
+
this._followUpMessages.splice(followUpIndex, 1);
|
|
752
800
|
this._emitQueueUpdate();
|
|
753
801
|
}
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
}
|
|
761
|
-
}
|
|
802
|
+
}
|
|
803
|
+
// Normalize queued images at delivery, before events and persistence see the message,
|
|
804
|
+
// so they get the same resize as idle prompts with the current model's limits (#11738).
|
|
805
|
+
if (this._queuedMessagesWithImages.has(event.message)) {
|
|
806
|
+
this._queuedMessagesWithImages.delete(event.message);
|
|
807
|
+
await this._normalizeQueuedMessageImages(event.message);
|
|
762
808
|
}
|
|
763
809
|
}
|
|
764
810
|
// Emit to extensions first, then notify public listeners.
|
|
@@ -1663,14 +1709,34 @@ export class AgentSession {
|
|
|
1663
1709
|
return;
|
|
1664
1710
|
}
|
|
1665
1711
|
}
|
|
1666
|
-
if (this._compactionAbortController !== undefined) {
|
|
1712
|
+
if (this._compactionAbortController !== undefined || this._branchSummaryAbortController !== undefined) {
|
|
1667
1713
|
throw new Error("Cannot submit a prompt while compaction is in progress. Wait for compaction to finish and retry.");
|
|
1668
1714
|
}
|
|
1715
|
+
// Reserve the context through async input hooks and auth checks so tree navigation cannot
|
|
1716
|
+
// start meanwhile (#9154). _startRun marks the run active synchronously, so there is no gap.
|
|
1717
|
+
this._promptPreflightCount++;
|
|
1718
|
+
let trigger;
|
|
1719
|
+
try {
|
|
1720
|
+
trigger = await this._preparePrompt(text, options);
|
|
1721
|
+
}
|
|
1722
|
+
finally {
|
|
1723
|
+
this._promptPreflightCount--;
|
|
1724
|
+
}
|
|
1725
|
+
if (trigger)
|
|
1726
|
+
await this._startRun(trigger, () => preflightResult?.("started"));
|
|
1727
|
+
}
|
|
1728
|
+
/**
|
|
1729
|
+
* Run input hooks, expand templates, queue while streaming, and validate model and auth.
|
|
1730
|
+
* Returns the run trigger, or undefined when the prompt was handled or queued.
|
|
1731
|
+
*/
|
|
1732
|
+
async _preparePrompt(text, options) {
|
|
1733
|
+
const expandPromptTemplates = options?.expandPromptTemplates ?? true;
|
|
1734
|
+
const preflightResult = options?.preflightResult;
|
|
1669
1735
|
// Emit input event for extension interception (before skill/template expansion)
|
|
1670
1736
|
const processedInput = await this._runInputHandlers(text, options?.images, options?.source ?? "interactive", this.isStreaming ? options?.streamingBehavior : undefined);
|
|
1671
1737
|
if (!processedInput) {
|
|
1672
1738
|
preflightResult?.("handled");
|
|
1673
|
-
return;
|
|
1739
|
+
return undefined;
|
|
1674
1740
|
}
|
|
1675
1741
|
const { text: currentText, images: currentImages } = processedInput;
|
|
1676
1742
|
// Expand skill commands (/skill:name args) and prompt templates (/template args)
|
|
@@ -1691,7 +1757,7 @@ export class AgentSession {
|
|
|
1691
1757
|
await this._queueSteer(expandedText, currentImages);
|
|
1692
1758
|
}
|
|
1693
1759
|
preflightResult?.("queued");
|
|
1694
|
-
return;
|
|
1760
|
+
return undefined;
|
|
1695
1761
|
}
|
|
1696
1762
|
// Validate model
|
|
1697
1763
|
if (!this.model) {
|
|
@@ -1708,7 +1774,7 @@ export class AgentSession {
|
|
|
1708
1774
|
}
|
|
1709
1775
|
throw new Error(formatNoApiKeyFoundMessage(this.model.provider));
|
|
1710
1776
|
}
|
|
1711
|
-
|
|
1777
|
+
return { messageType: "user", prompt: expandedText, images: currentImages };
|
|
1712
1778
|
}
|
|
1713
1779
|
/**
|
|
1714
1780
|
* Try to execute an extension command. Returns true if command was found and executed.
|
|
@@ -1817,11 +1883,10 @@ export class AgentSession {
|
|
|
1817
1883
|
if (images) {
|
|
1818
1884
|
content.push(...images);
|
|
1819
1885
|
}
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
});
|
|
1886
|
+
const message = { role: "user", content, timestamp: Date.now() };
|
|
1887
|
+
if (images?.length)
|
|
1888
|
+
this._queuedMessagesWithImages.add(message);
|
|
1889
|
+
this.agent.steer(message);
|
|
1825
1890
|
}
|
|
1826
1891
|
/**
|
|
1827
1892
|
* Internal: Queue a follow-up message (already expanded, no extension command check).
|
|
@@ -1833,7 +1898,26 @@ export class AgentSession {
|
|
|
1833
1898
|
if (images) {
|
|
1834
1899
|
content.push(...images);
|
|
1835
1900
|
}
|
|
1836
|
-
|
|
1901
|
+
const message = { role: "user", content, timestamp: Date.now() };
|
|
1902
|
+
if (images?.length)
|
|
1903
|
+
this._queuedMessagesWithImages.add(message);
|
|
1904
|
+
this.agent.followUp(message);
|
|
1905
|
+
}
|
|
1906
|
+
/** Replace a queued user message's images in place with normalized ones, appending hints to its text. */
|
|
1907
|
+
async _normalizeQueuedMessageImages(message) {
|
|
1908
|
+
if (typeof message.content === "string")
|
|
1909
|
+
return;
|
|
1910
|
+
const [first, ...rest] = message.content;
|
|
1911
|
+
if (first?.type !== "text")
|
|
1912
|
+
return;
|
|
1913
|
+
const images = rest.filter((block) => block.type === "image");
|
|
1914
|
+
const normalized = await this._normalizePromptImages(images);
|
|
1915
|
+
const text = normalized.hints.length > 0 ? `${first.text}\n\n${normalized.hints.join("\n")}` : first.text;
|
|
1916
|
+
message.content = [
|
|
1917
|
+
{ type: "text", text },
|
|
1918
|
+
...rest.filter((block) => block.type !== "image"),
|
|
1919
|
+
...normalized.images,
|
|
1920
|
+
];
|
|
1837
1921
|
}
|
|
1838
1922
|
/**
|
|
1839
1923
|
* Throw an error if the text is an extension command.
|
|
@@ -2070,14 +2154,11 @@ export class AgentSession {
|
|
|
2070
2154
|
async _cycleScopedModel(direction, options) {
|
|
2071
2155
|
const availableIds = new Set(this._modelRuntime.getAvailableSnapshot().map((model) => `${model.provider}\0${model.id}`));
|
|
2072
2156
|
const scopedModels = this._scopedModels.filter((scoped) => availableIds.has(`${scoped.model.provider}\0${scoped.model.id}`));
|
|
2073
|
-
if (scopedModels.length <= 1)
|
|
2074
|
-
return undefined;
|
|
2075
2157
|
const currentModel = this.model;
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
const nextIndex = direction === "forward" ? (currentIndex + 1) % len : (currentIndex - 1 + len) % len;
|
|
2158
|
+
const currentIndex = scopedModels.findIndex((sm) => modelsAreEqual(sm.model, currentModel));
|
|
2159
|
+
const nextIndex = getNextCycleIndex(currentIndex, scopedModels.length, direction);
|
|
2160
|
+
if (nextIndex === undefined)
|
|
2161
|
+
return undefined;
|
|
2081
2162
|
const next = scopedModels[nextIndex];
|
|
2082
2163
|
const thinkingLevel = this._getThinkingLevelForModelSwitch(next.model, next.thinkingLevel);
|
|
2083
2164
|
// Apply model
|
|
@@ -2098,14 +2179,11 @@ export class AgentSession {
|
|
|
2098
2179
|
}
|
|
2099
2180
|
async _cycleAvailableModel(direction, options) {
|
|
2100
2181
|
const availableModels = this._modelRuntime.getAvailableSnapshot();
|
|
2101
|
-
if (availableModels.length <= 1)
|
|
2102
|
-
return undefined;
|
|
2103
2182
|
const currentModel = this.model;
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
const nextIndex = direction === "forward" ? (currentIndex + 1) % len : (currentIndex - 1 + len) % len;
|
|
2183
|
+
const currentIndex = availableModels.findIndex((m) => modelsAreEqual(m, currentModel));
|
|
2184
|
+
const nextIndex = getNextCycleIndex(currentIndex, availableModels.length, direction);
|
|
2185
|
+
if (nextIndex === undefined)
|
|
2186
|
+
return undefined;
|
|
2109
2187
|
const nextModel = availableModels[nextIndex];
|
|
2110
2188
|
const thinkingLevel = this._getThinkingLevelForModelSwitch(nextModel);
|
|
2111
2189
|
this.agent.state.model = nextModel;
|
|
@@ -3014,6 +3092,12 @@ export class AgentSession {
|
|
|
3014
3092
|
});
|
|
3015
3093
|
}
|
|
3016
3094
|
async reload(options) {
|
|
3095
|
+
if (this.isStreaming) {
|
|
3096
|
+
throw new Error("Wait for the current response to finish before reloading.");
|
|
3097
|
+
}
|
|
3098
|
+
if (this.isCompacting) {
|
|
3099
|
+
throw new Error("Wait for compaction to finish before reloading.");
|
|
3100
|
+
}
|
|
3017
3101
|
const oldRunner = this._extensionRunner;
|
|
3018
3102
|
const previousFlagValues = oldRunner.getFlagValues();
|
|
3019
3103
|
await emitSessionShutdownEvent(oldRunner, { type: "session_shutdown", reason: "reload" });
|
|
@@ -3277,7 +3361,7 @@ export class AgentSession {
|
|
|
3277
3361
|
* @returns Result with editorText (if user message) and cancelled status
|
|
3278
3362
|
*/
|
|
3279
3363
|
async navigateTree(targetId, options = {}) {
|
|
3280
|
-
if (this.isStreaming) {
|
|
3364
|
+
if (this.isStreaming || this._promptPreflightCount > 0) {
|
|
3281
3365
|
throw new Error("Wait for the current response to finish before navigating the session tree.");
|
|
3282
3366
|
}
|
|
3283
3367
|
if (this.isCompacting) {
|
|
@@ -3313,7 +3397,8 @@ export class AgentSession {
|
|
|
3313
3397
|
label,
|
|
3314
3398
|
};
|
|
3315
3399
|
// Set up abort controller for summarization
|
|
3316
|
-
|
|
3400
|
+
const abortController = new AbortController();
|
|
3401
|
+
this._branchSummaryAbortController = abortController;
|
|
3317
3402
|
try {
|
|
3318
3403
|
let extensionSummary;
|
|
3319
3404
|
let fromExtension = false;
|
|
@@ -3322,7 +3407,7 @@ export class AgentSession {
|
|
|
3322
3407
|
const result = (await this._extensionRunner.emit({
|
|
3323
3408
|
type: "session_before_tree",
|
|
3324
3409
|
preparation,
|
|
3325
|
-
signal:
|
|
3410
|
+
signal: abortController.signal,
|
|
3326
3411
|
}));
|
|
3327
3412
|
if (result?.cancel) {
|
|
3328
3413
|
return { cancelled: true };
|
|
@@ -3347,7 +3432,7 @@ export class AgentSession {
|
|
|
3347
3432
|
let summaryDetails;
|
|
3348
3433
|
let summaryUsage;
|
|
3349
3434
|
if (options.summarize && entriesToSummarize.length > 0 && !extensionSummary) {
|
|
3350
|
-
const signal =
|
|
3435
|
+
const signal = abortController.signal;
|
|
3351
3436
|
const branchSummarySettings = this.settingsManager.getBranchSummarySettings();
|
|
3352
3437
|
const result = await generateBranchSummary(entriesToSummarize, {
|
|
3353
3438
|
...(await this._getSummarizationRequestAuth(this.model, signal)),
|
|
@@ -3421,7 +3506,8 @@ export class AgentSession {
|
|
|
3421
3506
|
// Update finalized context from the canonical session projection.
|
|
3422
3507
|
this._refreshFinalizedContext();
|
|
3423
3508
|
this._restoreToolsFromTranscript();
|
|
3424
|
-
//
|
|
3509
|
+
// The selected context is installed; session_tree handlers may now prompt or navigate again.
|
|
3510
|
+
this._branchSummaryAbortController = undefined;
|
|
3425
3511
|
await this._extensionRunner.emit({
|
|
3426
3512
|
type: "session_tree",
|
|
3427
3513
|
newLeafId: this.sessionManager.getLeafId(),
|
|
@@ -3433,7 +3519,10 @@ export class AgentSession {
|
|
|
3433
3519
|
return { editorText, cancelled: false, summaryEntry };
|
|
3434
3520
|
}
|
|
3435
3521
|
finally {
|
|
3436
|
-
|
|
3522
|
+
// A navigation started from session_tree owns the controller now; do not clear it.
|
|
3523
|
+
if (this._branchSummaryAbortController === abortController) {
|
|
3524
|
+
this._branchSummaryAbortController = undefined;
|
|
3525
|
+
}
|
|
3437
3526
|
this._resolveIdleWaitIfIdle();
|
|
3438
3527
|
}
|
|
3439
3528
|
}
|