@averyyy/pi-coding-agent 1.5.0-piclient.4 → 1.5.2-piclient.1
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 +134 -0
- package/dist/bundle/chunks/anthropic-messages-KT6DV7MK.js +6 -0
- package/dist/bundle/chunks/{azure-openai-responses-M725JFGO.js → azure-openai-responses-E2Z734ES.js} +1 -1
- package/dist/bundle/chunks/bedrock-converse-stream.js +3 -3
- package/dist/bundle/chunks/chunk-27POX4KP.js +82 -0
- package/dist/bundle/chunks/{chunk-HLEWK4Q5.js → chunk-BWM3ZYWS.js} +1 -1
- package/dist/bundle/chunks/{chunk-GJFZM2RZ.js → chunk-D2CMHQWH.js} +9 -9
- package/dist/bundle/chunks/chunk-DGLLW4Y4.js +1590 -0
- package/dist/bundle/chunks/{chunk-N4CTF6DK.js → chunk-ECEUFETK.js} +1 -1
- package/dist/bundle/chunks/{chunk-3UW3IQIY.js → chunk-FA5D3PPT.js} +1 -1
- package/dist/bundle/chunks/chunk-GFUN2N5K.js +2 -0
- package/dist/bundle/chunks/{chunk-OW4KH7CI.js → chunk-H36DQSY7.js} +1 -1
- package/dist/bundle/chunks/chunk-IEBK4HQA.js +2 -0
- package/dist/bundle/chunks/chunk-IYMNLY6C.js +4 -0
- package/dist/bundle/chunks/chunk-M4NMEBFE.js +2 -0
- package/dist/bundle/chunks/chunk-P4REYYCM.js +55 -0
- package/dist/bundle/chunks/chunk-RRE46THK.js +35 -0
- package/dist/bundle/chunks/chunk-RZHIIJ2O.js +2 -0
- package/dist/bundle/chunks/chunk-SHIWNICN.js +8 -0
- package/dist/bundle/chunks/{chunk-WATJAG5U.js → chunk-TCESBBFS.js} +1 -1
- package/dist/bundle/chunks/{chunk-GO33PKBT.js → chunk-V5KN6SNQ.js} +1 -1
- package/dist/bundle/chunks/chunk-V7WCKBVO.js +19 -0
- package/dist/bundle/chunks/{chunk-OXKIVFVM.js → chunk-VZFAYNKC.js} +1 -1
- package/dist/bundle/chunks/{chunk-JM6XUN2B.js → chunk-YAD6BXOQ.js} +5 -1
- package/dist/bundle/chunks/chunk-ZG74NES2.js +2 -0
- package/dist/bundle/chunks/{cli-2Q4CKMZK.js → cli-OTDOMRGW.js} +7 -7
- package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-JEJELFEJ.js → cloudflare-workers-ai-system-one-6TWKBBSR.js} +1 -1
- package/dist/bundle/chunks/codemode-worker.js +2 -0
- package/dist/bundle/chunks/{easter-egg-3d-UEH5CVEM.js → easter-egg-3d-FREKSIW6.js} +1 -1
- package/dist/bundle/chunks/{execute-BOGNP5CQ.js → execute-MJMW76MP.js} +5 -3
- package/dist/bundle/chunks/github-copilot.js +1 -1
- package/dist/bundle/chunks/google-antigravity-runtime.js +2 -2
- package/dist/bundle/chunks/{google-generative-ai-UTHMOBSC.js → google-generative-ai-YSOYXY5K.js} +1 -1
- package/dist/bundle/chunks/{google-vertex-MKY2BEE7.js → google-vertex-X3ELXR2J.js} +1 -1
- package/dist/bundle/chunks/{llama-cpp-classify-CYHVVBOQ.js → llama-cpp-classify-R6PVLK5I.js} +1 -1
- package/dist/bundle/chunks/{mistral-conversations-U2CRJEWX.js → mistral-conversations-J4IL2HMK.js} +1 -1
- package/dist/bundle/chunks/openai-codex-responses-GULSUKQ4.js +10 -0
- package/dist/bundle/chunks/{openai-completions-VPNLDI5K.js → openai-completions-ZGWBSKNR.js} +3 -3
- package/dist/bundle/chunks/{openai-decisions-UZ6HF7LF.js → openai-decisions-BU2ER6AQ.js} +1 -1
- package/dist/bundle/chunks/openai-responses-WDSDROXC.js +4 -0
- package/dist/bundle/chunks/{openrouter-images-P5CYCO4P.js → openrouter-images-MK6H7N26.js} +1 -1
- package/dist/bundle/chunks/{pi-messages-XPX326L5.js → pi-messages-7PPZFV3U.js} +1 -1
- package/dist/bundle/chunks/{runtime-2Z3FBQRD.js → runtime-X3ZHEI2F.js} +1 -1
- package/dist/bundle/chunks/{typesafe-system-one-NKVLMGFF.js → typesafe-system-one-LXDZKNJW.js} +1 -1
- package/dist/bundle/chunks/virtual-modules-J7Z5J7IR.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 +234 -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 +74 -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 +17 -2
- 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 +137 -54
- 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 -97
- 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 +2 -0
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +8 -4
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/package-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/pi-server-client.d.ts.map +1 -1
- package/dist/core/pi-server-client.js +1 -0
- package/dist/core/pi-server-client.js.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 +1 -6
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +34 -9
- 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 +63 -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/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 +164 -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/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 +7 -7
- package/schemas/models.schema.json +29 -0
- package/schemas/settings.schema.json +1 -1
- package/dist/bundle/chunks/anthropic-messages-WU4RRDFO.js +0 -6
- package/dist/bundle/chunks/chunk-4RKLODCT.js +0 -2
- package/dist/bundle/chunks/chunk-G23G7KNC.js +0 -4
- package/dist/bundle/chunks/chunk-LTLKVIE2.js +0 -65
- package/dist/bundle/chunks/chunk-O5CTLHDX.js +0 -82
- package/dist/bundle/chunks/chunk-OV4EHN3Q.js +0 -2
- package/dist/bundle/chunks/chunk-PWQUNMKT.js +0 -4
- package/dist/bundle/chunks/chunk-TTZH2HU3.js +0 -1590
- package/dist/bundle/chunks/chunk-UKVNB6C4.js +0 -2
- package/dist/bundle/chunks/chunk-USJZMAIR.js +0 -2
- package/dist/bundle/chunks/chunk-YH5RGRHQ.js +0 -7
- package/dist/bundle/chunks/openai-codex-responses-DK2NKO47.js +0 -10
- package/dist/bundle/chunks/openai-responses-S5QT5K5D.js +0 -4
- package/dist/bundle/chunks/virtual-modules-34ID7AB7.js +0 -2
|
@@ -180,6 +180,20 @@ function sanitizeGeneratedSessionName(text) {
|
|
|
180
180
|
}
|
|
181
181
|
// AgentSession Class
|
|
182
182
|
// ============================================================================
|
|
183
|
+
/**
|
|
184
|
+
* Index of the model to cycle to, or undefined when there is nothing to switch to.
|
|
185
|
+
* When the current model is not in the list (currentIndex -1), forward picks the first
|
|
186
|
+
* entry and backward the last, so a one-entry list still selects its only model.
|
|
187
|
+
*/
|
|
188
|
+
function getNextCycleIndex(currentIndex, length, direction) {
|
|
189
|
+
if (length === 0)
|
|
190
|
+
return undefined;
|
|
191
|
+
if (currentIndex === -1)
|
|
192
|
+
return direction === "forward" ? 0 : length - 1;
|
|
193
|
+
if (length === 1)
|
|
194
|
+
return undefined;
|
|
195
|
+
return direction === "forward" ? (currentIndex + 1) % length : (currentIndex - 1 + length) % length;
|
|
196
|
+
}
|
|
183
197
|
export class AgentSession {
|
|
184
198
|
agent;
|
|
185
199
|
sessionManager;
|
|
@@ -193,6 +207,7 @@ export class AgentSession {
|
|
|
193
207
|
_pendingAgentSettlements = 0;
|
|
194
208
|
/** True while before_agent_start and pre-run compaction prepare a run that has sent no request yet. */
|
|
195
209
|
_isPreparingRun = false;
|
|
210
|
+
_promptPreflightCount = 0;
|
|
196
211
|
_agentRunAbortRequested = false;
|
|
197
212
|
_idleWaitPromise;
|
|
198
213
|
_resolveIdleWait;
|
|
@@ -204,6 +219,8 @@ export class AgentSession {
|
|
|
204
219
|
_steeringMessages = [];
|
|
205
220
|
/** Tracks pending follow-up messages for UI display. Removed when delivered. */
|
|
206
221
|
_followUpMessages = [];
|
|
222
|
+
/** Queued image content shared by provisional queue selections and their original messages. */
|
|
223
|
+
_queuedImageContents = new WeakSet();
|
|
207
224
|
/** Messages queued to be included with the next user prompt as context ("asides"). */
|
|
208
225
|
_pendingNextTurnMessages = [];
|
|
209
226
|
/** Context-only custom messages queued during a run, flushed once the current turn's tool results are in. */
|
|
@@ -428,19 +445,25 @@ export class AgentSession {
|
|
|
428
445
|
return this._modelRuntime.getPhysicalModel(message.provider, message.model);
|
|
429
446
|
return model?.provider === message.provider && model.id === message.model ? model : undefined;
|
|
430
447
|
}
|
|
448
|
+
/** Record the live model and thinking level on the current branch, so a resume restores them. */
|
|
449
|
+
_recordSelection() {
|
|
450
|
+
const branch = this.sessionManager.getBranch();
|
|
451
|
+
this._recordModelSelection(branch);
|
|
452
|
+
this._recordThinkingLevel(branch);
|
|
453
|
+
}
|
|
431
454
|
/**
|
|
432
|
-
* Record the
|
|
433
|
-
*
|
|
434
|
-
*
|
|
435
|
-
*
|
|
436
|
-
*
|
|
455
|
+
* Record the model on the current branch when the branch implies another one. Tree navigation
|
|
456
|
+
* can leave the latest `model_change` on another branch; responses cannot record a virtual
|
|
457
|
+
* selection because they name physical models. Responses do record a physical selection unless
|
|
458
|
+
* the branch holds a virtual one; checking a physical selection against responses would record
|
|
459
|
+
* it on every prompt while `prepareRequest` redirects to another model.
|
|
437
460
|
*/
|
|
438
|
-
|
|
461
|
+
_recordModelSelection(branch) {
|
|
439
462
|
const model = this.model;
|
|
440
463
|
if (!model)
|
|
441
464
|
return;
|
|
442
465
|
const getModel = (provider, modelId) => this._modelRuntime.getModel(provider, modelId);
|
|
443
|
-
const recorded = getBranchSelection(
|
|
466
|
+
const recorded = getBranchSelection(branch, getModel);
|
|
444
467
|
if (!recorded || (recorded.provider === model.provider && recorded.modelId === model.id))
|
|
445
468
|
return;
|
|
446
469
|
const recordedModel = getModel(recorded.provider, recorded.modelId);
|
|
@@ -448,6 +471,25 @@ export class AgentSession {
|
|
|
448
471
|
return;
|
|
449
472
|
this.sessionManager.appendModelChange(model.provider, model.id);
|
|
450
473
|
}
|
|
474
|
+
/**
|
|
475
|
+
* Record the thinking level on the current branch when the branch implies another one (#11451).
|
|
476
|
+
* Tree navigation can leave the latest `thinking_level_change` on another branch. The recorded
|
|
477
|
+
* level is compared after clamping to the current model, so a level clamped on resume (e.g.
|
|
478
|
+
* `xhigh` running as `high`) is not recorded over the requested one.
|
|
479
|
+
*/
|
|
480
|
+
_recordThinkingLevel(branch) {
|
|
481
|
+
const recorded = branch.findLast((entry) => entry.type === "thinking_level_change");
|
|
482
|
+
if (!recorded)
|
|
483
|
+
return;
|
|
484
|
+
const recordedLevel = recorded.thinkingLevel;
|
|
485
|
+
const availableLevels = this.getAvailableThinkingLevels();
|
|
486
|
+
const effective = availableLevels.includes(recordedLevel)
|
|
487
|
+
? recordedLevel
|
|
488
|
+
: this._clampThinkingLevel(recordedLevel, availableLevels);
|
|
489
|
+
if (effective === this.thinkingLevel)
|
|
490
|
+
return;
|
|
491
|
+
this.sessionManager.appendThinkingLevelChange(this.thinkingLevel);
|
|
492
|
+
}
|
|
451
493
|
/** The model whose limits apply to the conversation. */
|
|
452
494
|
_limitsModel() {
|
|
453
495
|
return this.routedModel?.model ?? this.model;
|
|
@@ -910,21 +952,25 @@ export class AgentSession {
|
|
|
910
952
|
if (event.type === "message_start" && event.message.role === "user") {
|
|
911
953
|
this._overflowRecoveryAttempted = false;
|
|
912
954
|
const messageText = contentText(event.message.content, "");
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
955
|
+
// Check steering queue first
|
|
956
|
+
const steeringIndex = this._steeringMessages.indexOf(messageText);
|
|
957
|
+
if (steeringIndex !== -1) {
|
|
958
|
+
this._steeringMessages.splice(steeringIndex, 1);
|
|
959
|
+
this._emitQueueUpdate();
|
|
960
|
+
}
|
|
961
|
+
else {
|
|
962
|
+
// Check follow-up queue
|
|
963
|
+
const followUpIndex = this._followUpMessages.indexOf(messageText);
|
|
964
|
+
if (followUpIndex !== -1) {
|
|
965
|
+
this._followUpMessages.splice(followUpIndex, 1);
|
|
918
966
|
this._emitQueueUpdate();
|
|
919
967
|
}
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
}
|
|
927
|
-
}
|
|
968
|
+
}
|
|
969
|
+
// Normalize queued images at delivery, before events and persistence see the message,
|
|
970
|
+
// so they get the same resize as idle prompts with the current model's limits (#11738).
|
|
971
|
+
if (typeof event.message.content !== "string" && this._queuedImageContents.has(event.message.content)) {
|
|
972
|
+
this._queuedImageContents.delete(event.message.content);
|
|
973
|
+
await this._normalizeQueuedMessageImages(event.message);
|
|
928
974
|
}
|
|
929
975
|
}
|
|
930
976
|
// Emit to extensions first, then notify public listeners.
|
|
@@ -1357,6 +1403,7 @@ export class AgentSession {
|
|
|
1357
1403
|
this.isRetrying ||
|
|
1358
1404
|
this.isBashRunning ||
|
|
1359
1405
|
this._compactionCompletionPromise !== undefined ||
|
|
1406
|
+
this._branchSummaryCompletionPromise !== undefined ||
|
|
1360
1407
|
this._pendingAgentSettlements > 0 ||
|
|
1361
1408
|
this._isAborting);
|
|
1362
1409
|
}
|
|
@@ -2086,14 +2133,35 @@ export class AgentSession {
|
|
|
2086
2133
|
return;
|
|
2087
2134
|
}
|
|
2088
2135
|
}
|
|
2089
|
-
if (this._compactionAbortController !== undefined
|
|
2136
|
+
if ((this._compactionAbortController !== undefined || this._branchSummaryAbortController !== undefined) &&
|
|
2137
|
+
!this._isAborting) {
|
|
2090
2138
|
throw new Error("Cannot submit a prompt while compaction is in progress. Wait for compaction to finish and retry.");
|
|
2091
2139
|
}
|
|
2140
|
+
// Reserve the context through async input hooks and auth checks so tree navigation cannot
|
|
2141
|
+
// start meanwhile (#9154). _startRun marks the run active synchronously, so there is no gap.
|
|
2142
|
+
this._promptPreflightCount++;
|
|
2143
|
+
let trigger;
|
|
2144
|
+
try {
|
|
2145
|
+
trigger = await this._preparePrompt(text, options);
|
|
2146
|
+
}
|
|
2147
|
+
finally {
|
|
2148
|
+
this._promptPreflightCount--;
|
|
2149
|
+
}
|
|
2150
|
+
if (trigger)
|
|
2151
|
+
await this._startRun(trigger, () => preflightResult?.("started"));
|
|
2152
|
+
}
|
|
2153
|
+
/**
|
|
2154
|
+
* Run input hooks, expand templates, queue while streaming, and validate model and auth.
|
|
2155
|
+
* Returns the run trigger, or undefined when the prompt was handled or queued.
|
|
2156
|
+
*/
|
|
2157
|
+
async _preparePrompt(text, options) {
|
|
2158
|
+
const expandPromptTemplates = options?.expandPromptTemplates ?? true;
|
|
2159
|
+
const preflightResult = options?.preflightResult;
|
|
2092
2160
|
// Emit input event for extension interception (before skill/template expansion)
|
|
2093
2161
|
const processedInput = await this._runInputHandlers(text, options?.images, options?.source ?? "interactive", this.isStreaming ? options?.streamingBehavior : undefined);
|
|
2094
2162
|
if (!processedInput) {
|
|
2095
2163
|
preflightResult?.("handled");
|
|
2096
|
-
return;
|
|
2164
|
+
return undefined;
|
|
2097
2165
|
}
|
|
2098
2166
|
const { text: currentText, images: currentImages } = processedInput;
|
|
2099
2167
|
// Expand skill commands (/skill:name args) and prompt templates (/template args)
|
|
@@ -2114,7 +2182,7 @@ export class AgentSession {
|
|
|
2114
2182
|
await this._queueSteer(expandedText, currentImages);
|
|
2115
2183
|
}
|
|
2116
2184
|
preflightResult?.("queued");
|
|
2117
|
-
return;
|
|
2185
|
+
return undefined;
|
|
2118
2186
|
}
|
|
2119
2187
|
// Validate model
|
|
2120
2188
|
if (!this.model) {
|
|
@@ -2131,7 +2199,7 @@ export class AgentSession {
|
|
|
2131
2199
|
}
|
|
2132
2200
|
throw new Error(formatNoApiKeyFoundMessage(this.model.provider));
|
|
2133
2201
|
}
|
|
2134
|
-
|
|
2202
|
+
return { messageType: "user", prompt: expandedText, images: currentImages };
|
|
2135
2203
|
}
|
|
2136
2204
|
/**
|
|
2137
2205
|
* Try to execute an extension command. Returns true if command was found and executed.
|
|
@@ -2240,11 +2308,10 @@ export class AgentSession {
|
|
|
2240
2308
|
if (images) {
|
|
2241
2309
|
content.push(...images);
|
|
2242
2310
|
}
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
content
|
|
2246
|
-
|
|
2247
|
-
});
|
|
2311
|
+
const message = { role: "user", content, timestamp: Date.now() };
|
|
2312
|
+
if (images?.length)
|
|
2313
|
+
this._queuedImageContents.add(content);
|
|
2314
|
+
this.agent.steer(message);
|
|
2248
2315
|
if (this._isAborting) {
|
|
2249
2316
|
this._continueAfterAbortRequested = true;
|
|
2250
2317
|
}
|
|
@@ -2259,15 +2326,26 @@ export class AgentSession {
|
|
|
2259
2326
|
if (images) {
|
|
2260
2327
|
content.push(...images);
|
|
2261
2328
|
}
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
content
|
|
2265
|
-
|
|
2266
|
-
});
|
|
2329
|
+
const message = { role: "user", content, timestamp: Date.now() };
|
|
2330
|
+
if (images?.length)
|
|
2331
|
+
this._queuedImageContents.add(content);
|
|
2332
|
+
this.agent.followUp(message);
|
|
2267
2333
|
if (this._isAborting) {
|
|
2268
2334
|
this._continueAfterAbortRequested = true;
|
|
2269
2335
|
}
|
|
2270
2336
|
}
|
|
2337
|
+
/** Replace a queued user message's images in place with normalized ones, appending hints to its text. */
|
|
2338
|
+
async _normalizeQueuedMessageImages(message) {
|
|
2339
|
+
if (typeof message.content === "string")
|
|
2340
|
+
return;
|
|
2341
|
+
const [first, ...rest] = message.content;
|
|
2342
|
+
if (first?.type !== "text")
|
|
2343
|
+
return;
|
|
2344
|
+
const images = rest.filter((block) => block.type === "image");
|
|
2345
|
+
const normalized = await this._normalizePromptImages(images);
|
|
2346
|
+
const text = normalized.hints.length > 0 ? `${first.text}\n\n${normalized.hints.join("\n")}` : first.text;
|
|
2347
|
+
message.content.splice(0, message.content.length, { type: "text", text }, ...rest.filter((block) => block.type !== "image"), ...normalized.images);
|
|
2348
|
+
}
|
|
2271
2349
|
/**
|
|
2272
2350
|
* Throw an error if the text is an extension command.
|
|
2273
2351
|
*/
|
|
@@ -2594,14 +2672,11 @@ export class AgentSession {
|
|
|
2594
2672
|
}
|
|
2595
2673
|
async _cycleScopedModel(direction, options) {
|
|
2596
2674
|
const scopedModels = getAvailableScopedModels(this._scopedModels, this._modelRuntime.getAvailableSnapshot());
|
|
2597
|
-
if (scopedModels.length <= 1)
|
|
2598
|
-
return undefined;
|
|
2599
2675
|
const currentModel = this.model;
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
const nextIndex = direction === "forward" ? (currentIndex + 1) % len : (currentIndex - 1 + len) % len;
|
|
2676
|
+
const currentIndex = scopedModels.findIndex((sm) => modelsAreEqual(sm.model, currentModel));
|
|
2677
|
+
const nextIndex = getNextCycleIndex(currentIndex, scopedModels.length, direction);
|
|
2678
|
+
if (nextIndex === undefined)
|
|
2679
|
+
return undefined;
|
|
2605
2680
|
const next = scopedModels[nextIndex];
|
|
2606
2681
|
const thinkingLevel = this._getThinkingLevelForModelSwitch(next.model, next.thinkingLevel);
|
|
2607
2682
|
// Apply model
|
|
@@ -2622,14 +2697,11 @@ export class AgentSession {
|
|
|
2622
2697
|
}
|
|
2623
2698
|
async _cycleAvailableModel(direction, options) {
|
|
2624
2699
|
const availableModels = this._modelRuntime.getAvailableSnapshot();
|
|
2625
|
-
if (availableModels.length <= 1)
|
|
2626
|
-
return undefined;
|
|
2627
2700
|
const currentModel = this.model;
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
const nextIndex = direction === "forward" ? (currentIndex + 1) % len : (currentIndex - 1 + len) % len;
|
|
2701
|
+
const currentIndex = availableModels.findIndex((m) => modelsAreEqual(m, currentModel));
|
|
2702
|
+
const nextIndex = getNextCycleIndex(currentIndex, availableModels.length, direction);
|
|
2703
|
+
if (nextIndex === undefined)
|
|
2704
|
+
return undefined;
|
|
2633
2705
|
const nextModel = availableModels[nextIndex];
|
|
2634
2706
|
const thinkingLevel = this._getThinkingLevelForModelSwitch(nextModel);
|
|
2635
2707
|
this.agent.state.model = nextModel;
|
|
@@ -3815,6 +3887,12 @@ export class AgentSession {
|
|
|
3815
3887
|
});
|
|
3816
3888
|
}
|
|
3817
3889
|
async reload(options) {
|
|
3890
|
+
if (this.isStreaming) {
|
|
3891
|
+
throw new Error("Wait for the current response to finish before reloading.");
|
|
3892
|
+
}
|
|
3893
|
+
if (this.isCompacting) {
|
|
3894
|
+
throw new Error("Wait for compaction to finish before reloading.");
|
|
3895
|
+
}
|
|
3818
3896
|
const oldRunner = this._extensionRunner;
|
|
3819
3897
|
const previousFlagValues = oldRunner.getFlagValues();
|
|
3820
3898
|
await emitSessionShutdownEvent(oldRunner, { type: "session_shutdown", reason: "reload" });
|
|
@@ -4111,7 +4189,7 @@ export class AgentSession {
|
|
|
4111
4189
|
* @returns Result with editorText (if user message) and cancelled status
|
|
4112
4190
|
*/
|
|
4113
4191
|
async navigateTree(targetId, options = {}) {
|
|
4114
|
-
if (this.isStreaming) {
|
|
4192
|
+
if (this.isStreaming || this._promptPreflightCount > 0) {
|
|
4115
4193
|
throw new Error("Wait for the current response to finish before navigating the session tree.");
|
|
4116
4194
|
}
|
|
4117
4195
|
if (this.isCompacting) {
|
|
@@ -4147,7 +4225,8 @@ export class AgentSession {
|
|
|
4147
4225
|
label,
|
|
4148
4226
|
};
|
|
4149
4227
|
// Set up abort controller for summarization
|
|
4150
|
-
|
|
4228
|
+
const abortController = new AbortController();
|
|
4229
|
+
this._branchSummaryAbortController = abortController;
|
|
4151
4230
|
let resolveBranchSummaryCompletion;
|
|
4152
4231
|
const branchSummaryCompletion = new Promise((resolve) => {
|
|
4153
4232
|
resolveBranchSummaryCompletion = resolve;
|
|
@@ -4162,7 +4241,7 @@ export class AgentSession {
|
|
|
4162
4241
|
const result = (await this._extensionRunner.emit({
|
|
4163
4242
|
type: "session_before_tree",
|
|
4164
4243
|
preparation,
|
|
4165
|
-
signal:
|
|
4244
|
+
signal: abortController.signal,
|
|
4166
4245
|
}));
|
|
4167
4246
|
if (result?.cancel) {
|
|
4168
4247
|
return { cancelled: true };
|
|
@@ -4187,7 +4266,7 @@ export class AgentSession {
|
|
|
4187
4266
|
let summaryDetails;
|
|
4188
4267
|
let summaryUsage;
|
|
4189
4268
|
if (options.summarize && entriesToSummarize.length > 0 && !extensionSummary) {
|
|
4190
|
-
const signal =
|
|
4269
|
+
const signal = abortController.signal;
|
|
4191
4270
|
const branchSummarySettings = this.settingsManager.getBranchSummarySettings();
|
|
4192
4271
|
const result = await generateBranchSummary(entriesToSummarize, {
|
|
4193
4272
|
...(await this._getSummarizationRequestAuth(this.model, signal, this.agent.streamFunction)),
|
|
@@ -4262,7 +4341,8 @@ export class AgentSession {
|
|
|
4262
4341
|
this._refreshFinalizedContext();
|
|
4263
4342
|
this._restoreToolsFromTranscript();
|
|
4264
4343
|
this._emit({ type: "session_tree_changed" });
|
|
4265
|
-
//
|
|
4344
|
+
// The selected context is installed; session_tree handlers may now prompt or navigate again.
|
|
4345
|
+
this._branchSummaryAbortController = undefined;
|
|
4266
4346
|
await this._extensionRunner.emit({
|
|
4267
4347
|
type: "session_tree",
|
|
4268
4348
|
newLeafId: this.sessionManager.getLeafId(),
|
|
@@ -4274,7 +4354,10 @@ export class AgentSession {
|
|
|
4274
4354
|
return { editorText, cancelled: false, summaryEntry };
|
|
4275
4355
|
}
|
|
4276
4356
|
finally {
|
|
4277
|
-
|
|
4357
|
+
// A navigation started from session_tree owns the controller now; do not clear it.
|
|
4358
|
+
if (this._branchSummaryAbortController === abortController) {
|
|
4359
|
+
this._branchSummaryAbortController = undefined;
|
|
4360
|
+
}
|
|
4278
4361
|
if (this._branchSummaryCompletionPromise === branchSummaryCompletion) {
|
|
4279
4362
|
this._branchSummaryCompletionPromise = undefined;
|
|
4280
4363
|
}
|