@punch-bot/cli 1.5.0 → 1.5.3
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 +168 -1
- package/README.md +6 -8
- package/dist/bundle/chunks/anthropic-messages-WIBS5YKY.js +6 -0
- package/dist/bundle/chunks/azure-openai-responses-GP5GDEGO.js +2 -0
- package/dist/bundle/chunks/bedrock-converse-stream.js +7 -4
- package/dist/bundle/chunks/chunk-35EHANXE.js +2 -0
- package/dist/bundle/chunks/chunk-3IMHRFLG.js +6 -0
- package/dist/bundle/chunks/chunk-77CRE5SV.js +9 -0
- package/dist/bundle/chunks/chunk-CE33JMCE.js +861 -0
- package/dist/bundle/chunks/{chunk-MYNHUMKE.js → chunk-CXY7BILM.js} +2 -44
- package/dist/bundle/chunks/chunk-EISXNXOQ.js +41 -0
- package/dist/bundle/chunks/chunk-ENMVUQHE.js +26 -0
- package/dist/bundle/chunks/chunk-FFMDRXC4.js +10 -0
- package/dist/bundle/chunks/chunk-GFUN2N5K.js +2 -0
- package/dist/bundle/chunks/chunk-HQH636GU.js +361 -0
- package/dist/bundle/chunks/chunk-IEBK4HQA.js +2 -0
- package/dist/bundle/chunks/chunk-JAJLG57O.js +4 -0
- package/dist/bundle/chunks/{chunk-RFVYQ7ZX.js → chunk-LOHGXPCL.js} +2 -2
- package/dist/bundle/chunks/{chunk-NO2FNWW3.js → chunk-OV2VGRRS.js} +1 -1
- package/dist/bundle/chunks/chunk-P7FPUEYA.js +2 -0
- package/dist/bundle/chunks/chunk-PDENR63J.js +16 -0
- package/dist/bundle/chunks/chunk-RHOWRSGK.js +2 -0
- package/dist/bundle/chunks/{chunk-BRECMFDT.js → chunk-UZ3LUZDC.js} +1 -1
- package/dist/bundle/chunks/chunk-WN2D4UD4.js +2 -0
- package/dist/bundle/chunks/chunk-X4T5TGM4.js +82 -0
- package/dist/bundle/chunks/chunk-ZG74NES2.js +2 -0
- package/dist/bundle/chunks/cli-OQNR6ESL.js +53 -0
- package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-FDCKYGTP.js → cloudflare-workers-ai-system-one-36EDUVVN.js} +1 -1
- package/dist/bundle/chunks/codemode-worker.js +2 -0
- package/dist/bundle/chunks/{execute-HXULRBCI.js → execute-EHT55MW7.js} +5 -3
- package/dist/bundle/chunks/github-copilot.js +1 -1
- package/dist/bundle/chunks/{google-generative-ai-2ESDEFYR.js → google-generative-ai-KA6FZCHM.js} +1 -1
- package/dist/bundle/chunks/{google-vertex-YERBWL2T.js → google-vertex-DXKQ4IYR.js} +1 -1
- package/dist/bundle/chunks/image-resize-worker.js +1 -1
- package/dist/bundle/chunks/kimi-coding.js +1 -1
- package/dist/bundle/chunks/{llama-cpp-classify-M4KMJHPS.js → llama-cpp-classify-676UCBOD.js} +1 -1
- package/dist/bundle/chunks/meta.js +1 -1
- package/dist/bundle/chunks/mistral-conversations-PJ56UMXO.js +5 -0
- package/dist/bundle/chunks/openai-codex-responses-DWVG7MAQ.js +10 -0
- package/dist/bundle/chunks/openai-completions-OKI6KBNP.js +7 -0
- package/dist/bundle/chunks/{openai-decisions-PPJMQ3W4.js → openai-decisions-SO57QA6O.js} +1 -1
- package/dist/bundle/chunks/openai-responses-3HV234HB.js +4 -0
- package/dist/bundle/chunks/{openrouter-images-WWPCCAPX.js → openrouter-images-5X6D7HFS.js} +1 -1
- package/dist/bundle/chunks/pi-messages-BS5Z34RE.js +8 -0
- package/dist/bundle/chunks/radius.js +1 -1
- package/dist/bundle/chunks/{runtime-R5GXO4CV.js → runtime-74PFKASL.js} +1 -1
- package/dist/bundle/chunks/{typesafe-system-one-NLWRPIRL.js → typesafe-system-one-IPNULX2M.js} +1 -1
- package/dist/bundle/chunks/virtual-modules-2Y422I6U.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 +0 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +8 -12
- 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 +63 -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/project-trust.js +1 -1
- package/dist/cli/project-trust.js.map +1 -1
- package/dist/config.d.ts +10 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +24 -11
- package/dist/config.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 +20 -5
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session.d.ts +31 -15
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +158 -71
- 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/branch-summarization.d.ts +4 -2
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +16 -4
- package/dist/core/compaction/branch-summarization.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 +9 -1
- package/dist/core/exec.d.ts.map +1 -1
- package/dist/core/exec.js +104 -60
- package/dist/core/exec.js.map +1 -1
- package/dist/core/export-html/template.css +9 -0
- package/dist/core/export-html/template.js +165 -45
- 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 -13
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/pi-ai-extension-view.d.ts +19 -0
- package/dist/core/extensions/pi-ai-extension-view.d.ts.map +1 -0
- package/dist/core/extensions/pi-ai-extension-view.js +22 -0
- package/dist/core/extensions/pi-ai-extension-view.js.map +1 -0
- package/dist/core/extensions/runner.d.ts +1 -4
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +0 -14
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +5 -18
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/extensions/virtual-modules.d.ts.map +1 -1
- package/dist/core/extensions/virtual-modules.js +8 -7
- package/dist/core/extensions/virtual-modules.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/mcp-servers.d.ts +23 -41
- package/dist/core/mcp-servers.d.ts.map +1 -1
- package/dist/core/mcp-servers.js +51 -120
- package/dist/core/mcp-servers.js.map +1 -1
- package/dist/core/model-config.d.ts +1730 -2029
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +2 -3
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +36 -29
- 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 +24 -1
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +210 -51
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/pi-ai-schemas.d.ts +167 -0
- package/dist/core/pi-ai-schemas.d.ts.map +1 -0
- package/dist/core/pi-ai-schemas.js +21 -0
- package/dist/core/pi-ai-schemas.js.map +1 -0
- package/dist/core/pi-manifest.d.ts +1 -0
- package/dist/core/pi-manifest.d.ts.map +1 -1
- package/dist/core/pi-manifest.js +4 -0
- package/dist/core/pi-manifest.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/project-trust.d.ts +1 -1
- package/dist/core/project-trust.d.ts.map +1 -1
- package/dist/core/project-trust.js +1 -1
- package/dist/core/project-trust.js.map +1 -1
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/prompt-templates.js +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 +11 -0
- package/dist/core/provider-matching.d.ts.map +1 -0
- package/dist/core/provider-matching.js +14 -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/radius.d.ts +0 -3
- package/dist/core/radius.d.ts.map +1 -1
- package/dist/core/radius.js +0 -5
- package/dist/core/radius.js.map +1 -1
- 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/resource-loader.d.ts +4 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +40 -25
- 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/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +3 -1
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-cwd.d.ts +0 -1
- package/dist/core/session-cwd.d.ts.map +1 -1
- package/dist/core/session-cwd.js +0 -3
- package/dist/core/session-cwd.js.map +1 -1
- package/dist/core/session-manager.d.ts +7 -0
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +32 -13
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-defaults.d.ts +1 -31
- package/dist/core/settings-defaults.d.ts.map +1 -1
- package/dist/core/settings-defaults.js +1 -31
- package/dist/core/settings-defaults.js.map +1 -1
- package/dist/core/settings-manager.d.ts +4 -56
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +11 -247
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/settings-schema.d.ts +4 -54
- package/dist/core/settings-schema.d.ts.map +1 -1
- package/dist/core/settings-schema.js +7 -101
- package/dist/core/settings-schema.js.map +1 -1
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +6 -14
- package/dist/core/skills.js.map +1 -1
- package/dist/core/slash-commands.d.ts +0 -6
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +1 -27
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/source-info.d.ts +9 -0
- package/dist/core/source-info.d.ts.map +1 -1
- package/dist/core/source-info.js +13 -0
- package/dist/core/source-info.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +5 -6
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/telemetry.js +1 -1
- package/dist/core/telemetry.js.map +1 -1
- package/dist/core/theme/theme.d.ts.map +1 -1
- package/dist/core/theme/theme.js +5 -1
- package/dist/core/theme/theme.js.map +1 -1
- package/dist/core/tools/bash.d.ts +2 -2
- 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 +3 -3
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +10 -11
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/find.d.ts +2 -2
- 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 +7 -5
- 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 +2 -2
- 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 +10 -2
- 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/tool-definition-wrapper.d.ts +11 -1
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.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/core/tools/write.d.ts +2 -2
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js.map +1 -1
- package/dist/core/trust-manager.d.ts.map +1 -1
- package/dist/core/trust-manager.js +14 -8
- package/dist/core/trust-manager.js.map +1 -1
- package/dist/core/usage-totals.d.ts.map +1 -1
- package/dist/core/usage-totals.js +2 -0
- package/dist/core/usage-totals.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 +2 -1
- package/dist/extensions/codemode/tool.d.ts.map +1 -1
- package/dist/extensions/codemode/tool.js +59 -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/index.d.ts.map +1 -1
- package/dist/extensions/llama/index.js +1 -1
- package/dist/extensions/llama/index.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 +83 -22
- 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 +5 -4
- 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 -296
- 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/punch/index.d.ts.map +1 -1
- package/dist/extensions/punch/index.js +1 -1
- package/dist/extensions/punch/index.js.map +1 -1
- package/dist/extensions/punch/todos.js +1 -1
- package/dist/extensions/punch/todos.js.map +1 -1
- package/dist/extensions/subagent/index.d.ts.map +1 -1
- package/dist/extensions/subagent/index.js +278 -129
- package/dist/extensions/subagent/index.js.map +1 -1
- package/dist/extensions/tool-search/tool.d.ts +21 -6
- package/dist/extensions/tool-search/tool.d.ts.map +1 -1
- package/dist/extensions/tool-search/tool.js +122 -42
- package/dist/extensions/tool-search/tool.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +106 -14
- package/dist/main.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 +94 -12
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/utils/ansi.d.ts.map +1 -1
- package/dist/utils/ansi.js +5 -2
- package/dist/utils/ansi.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 -9
- package/dist/utils/changelog.js.map +1 -1
- package/dist/utils/clipboard-command.d.ts.map +1 -1
- package/dist/utils/clipboard-command.js +4 -0
- package/dist/utils/clipboard-command.js.map +1 -1
- package/dist/utils/fuzzy.d.ts.map +1 -1
- package/dist/utils/fuzzy.js +59 -44
- package/dist/utils/fuzzy.js.map +1 -1
- package/dist/utils/git.d.ts +11 -1
- package/dist/utils/git.d.ts.map +1 -1
- package/dist/utils/git.js +44 -0
- package/dist/utils/git.js.map +1 -1
- package/dist/utils/image-resize-core.d.ts.map +1 -1
- package/dist/utils/image-resize-core.js +5 -3
- package/dist/utils/image-resize-core.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/open-browser.d.ts.map +1 -1
- package/dist/utils/open-browser.js +4 -1
- package/dist/utils/open-browser.js.map +1 -1
- package/dist/utils/paths.d.ts +17 -0
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +42 -1
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +14 -0
- package/dist/utils/shell.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/text.d.ts +2 -0
- package/dist/utils/text.d.ts.map +1 -1
- package/dist/utils/text.js +5 -0
- package/dist/utils/text.js.map +1 -1
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +30 -35
- package/dist/utils/tools-manager.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-integration.md +3 -5
- package/docs/cli.md +45 -26
- package/docs/compaction.md +9 -9
- package/docs/configuration.md +1 -2
- package/docs/containerization.md +16 -14
- package/docs/custom-provider.md +5 -3
- package/docs/docs.json +9 -9
- package/docs/environment-variables.md +5 -12
- package/docs/extensions.md +683 -757
- package/docs/how-pi-works.md +5 -5
- package/docs/index.md +5 -5
- package/docs/llama-cpp.md +41 -39
- package/docs/mcp.md +12 -10
- package/docs/message-types.md +1 -1
- package/docs/models-configuration.md +6 -1
- package/docs/models.md +18 -19
- package/docs/nvidia-rtx-llama-cpp.md +1 -1
- package/docs/packages.md +21 -1
- package/docs/prompt-templates.md +11 -9
- package/docs/providers.md +8 -8
- package/docs/quickstart.md +28 -52
- package/docs/rpc-commands.md +2 -2
- package/docs/rpc-extension-ui.md +5 -7
- package/docs/rpc.md +4 -2
- package/docs/sdk.md +1 -1
- package/docs/security.md +9 -5
- package/docs/session-format.md +7 -9
- package/docs/sessions.md +26 -26
- package/docs/settings.md +36 -67
- package/docs/shell-aliases.md +7 -7
- package/docs/skills.md +4 -4
- package/docs/slash-commands.md +50 -58
- package/docs/termux.md +8 -9
- package/docs/themes.md +21 -41
- package/docs/usage.md +59 -177
- package/docs/virtual-models.md +4 -4
- package/docs/windows.md +8 -10
- package/examples/extensions/README.md +3 -2
- package/examples/extensions/custom-provider-anthropic/index.ts +27 -31
- 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 +19 -29
- package/examples/extensions/gondolin/package.json +2 -2
- package/examples/extensions/reload-runtime.ts +17 -5
- package/examples/extensions/rpc-demo.ts +2 -2
- package/examples/extensions/subagent/README.md +14 -11
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/tsconfig.json +208 -0
- package/npm-shrinkwrap.json +58 -53
- package/package.json +15 -17
- package/schemas/models.schema.json +65 -36
- package/schemas/settings.schema.json +17 -243
- package/dist/bundle/chunks/anthropic-messages-WCANLUXE.js +0 -6
- package/dist/bundle/chunks/azure-openai-responses-46GRAI5B.js +0 -2
- package/dist/bundle/chunks/chunk-37OLNCAX.js +0 -16
- package/dist/bundle/chunks/chunk-3V45WARH.js +0 -7
- package/dist/bundle/chunks/chunk-4LBJE4YM.js +0 -14
- package/dist/bundle/chunks/chunk-4NE64BTO.js +0 -82
- package/dist/bundle/chunks/chunk-5NXXRYVM.js +0 -2
- package/dist/bundle/chunks/chunk-7BOHO7TR.js +0 -1190
- package/dist/bundle/chunks/chunk-7XECPCHN.js +0 -2
- package/dist/bundle/chunks/chunk-NJK3U3WK.js +0 -8
- package/dist/bundle/chunks/chunk-PLK2QSUR.js +0 -2
- package/dist/bundle/chunks/chunk-TEPMHNKQ.js +0 -2
- package/dist/bundle/chunks/chunk-UE7JCDFW.js +0 -2
- package/dist/bundle/chunks/chunk-UKVNB6C4.js +0 -2
- package/dist/bundle/chunks/chunk-USJZMAIR.js +0 -2
- package/dist/bundle/chunks/chunk-WZONBDPY.js +0 -11
- package/dist/bundle/chunks/cli-W5KJM7YB.js +0 -51
- package/dist/bundle/chunks/mistral-conversations-D6VQXE7C.js +0 -5
- package/dist/bundle/chunks/openai-codex-responses-QSNSWBYG.js +0 -10
- package/dist/bundle/chunks/openai-completions-72VXSFHQ.js +0 -7
- package/dist/bundle/chunks/openai-responses-PMTL72CY.js +0 -4
- package/dist/bundle/chunks/pi-messages-WVCFUCBL.js +0 -8
- package/dist/bundle/chunks/virtual-modules-7Y5QW4VK.js +0 -2
- package/dist/core/bug-report-upload.d.ts +0 -12
- package/dist/core/bug-report-upload.d.ts.map +0 -1
- package/dist/core/bug-report-upload.js +0 -22
- package/dist/core/bug-report-upload.js.map +0 -1
- package/dist/core/bug-report.d.ts +0 -184
- package/dist/core/bug-report.d.ts.map +0 -1
- package/dist/core/bug-report.js +0 -292
- package/dist/core/bug-report.js.map +0 -1
- package/dist/core/crash-log.d.ts +0 -27
- package/dist/core/crash-log.d.ts.map +0 -1
- package/dist/core/crash-log.js +0 -140
- package/dist/core/crash-log.js.map +0 -1
- package/dist/core/footer-data-provider.d.ts +0 -64
- package/dist/core/footer-data-provider.d.ts.map +0 -1
- package/dist/core/footer-data-provider.js +0 -338
- package/dist/core/footer-data-provider.js.map +0 -1
- package/dist/utils/zip.d.ts +0 -7
- package/dist/utils/zip.d.ts.map +0 -1
- package/dist/utils/zip.js +0 -60
- package/dist/utils/zip.js.map +0 -1
- package/docs/images/interactive-mode.png +0 -0
- package/docs/images/tree-view.png +0 -0
- package/docs/keybindings.md +0 -194
- package/docs/terminal-setup.md +0 -17
- package/docs/tmux.md +0 -55
- package/docs/tui.md +0 -125
- package/examples/extensions/sandbox/index.ts +0 -321
- package/examples/extensions/sandbox/package-lock.json +0 -92
- package/examples/extensions/sandbox/package.json +0 -19
|
@@ -23,7 +23,6 @@ import { sleep } from "../utils/sleep.js";
|
|
|
23
23
|
import { normalizeToolResultImages } from "../utils/tool-result-images.js";
|
|
24
24
|
import { formatNoApiKeyFoundMessage, formatNoModelSelectedMessage } from "./auth-guidance.js";
|
|
25
25
|
import { executeBashWithOperations } from "./bash-executor.js";
|
|
26
|
-
import { generateBugReportSummary } from "./bug-report.js";
|
|
27
26
|
import { calculateContextTokens, collectEntriesForBranchSummary, compact, estimateContextTokens, estimateProjectedContextTokens, estimateTokens, generateBranchSummary, prepareCompaction, shouldCompact, } from "./compaction/index.js";
|
|
28
27
|
import { DEFAULT_THINKING_LEVEL, THINKING_LEVEL_OPTIONS } from "./defaults.js";
|
|
29
28
|
import { exportSessionToHtml } from "./export-html/index.js";
|
|
@@ -46,6 +45,16 @@ import { createAllToolDefinitions } from "./tools/index.js";
|
|
|
46
45
|
import { createToolDefinitionFromAgentTool } from "./tools/tool-definition-wrapper.js";
|
|
47
46
|
import { addUsageToTotals, combineUsage, createUsageTotals } from "./usage-totals.js";
|
|
48
47
|
import { findLatestResponse, getBranchSelection, getVirtualModelState, isVirtualModel, VIRTUAL_MODEL_STATE_ENTRY, } from "./virtual-models.js";
|
|
48
|
+
/**
|
|
49
|
+
* Stream functions that resolve auth through a given ModelRuntime themselves, such as the one
|
|
50
|
+
* createAgentSession installs. Summaries sent through them must not pass pre-resolved credentials:
|
|
51
|
+
* the runtime would take them as an explicit API key instead of the stored OAuth login (#11520).
|
|
52
|
+
*/
|
|
53
|
+
const runtimeStreamFunctions = new WeakMap();
|
|
54
|
+
/** Mark `streamFn` as resolving auth through `modelRuntime` on its own. */
|
|
55
|
+
export function markRuntimeStreamFunction(streamFn, modelRuntime) {
|
|
56
|
+
runtimeStreamFunctions.set(streamFn, modelRuntime);
|
|
57
|
+
}
|
|
49
58
|
/**
|
|
50
59
|
* Parse a skill block from message text.
|
|
51
60
|
* Returns null if the text doesn't contain a skill block.
|
|
@@ -79,6 +88,20 @@ function estimateMessagesTokens(messages) {
|
|
|
79
88
|
// ============================================================================
|
|
80
89
|
// AgentSession Class
|
|
81
90
|
// ============================================================================
|
|
91
|
+
/**
|
|
92
|
+
* Index of the model to cycle to, or undefined when there is nothing to switch to.
|
|
93
|
+
* When the current model is not in the list (currentIndex -1), forward picks the first
|
|
94
|
+
* entry and backward the last, so a one-entry list still selects its only model.
|
|
95
|
+
*/
|
|
96
|
+
function getNextCycleIndex(currentIndex, length, direction) {
|
|
97
|
+
if (length === 0)
|
|
98
|
+
return undefined;
|
|
99
|
+
if (currentIndex === -1)
|
|
100
|
+
return direction === "forward" ? 0 : length - 1;
|
|
101
|
+
if (length === 1)
|
|
102
|
+
return undefined;
|
|
103
|
+
return direction === "forward" ? (currentIndex + 1) % length : (currentIndex - 1 + length) % length;
|
|
104
|
+
}
|
|
82
105
|
export class AgentSession {
|
|
83
106
|
agent;
|
|
84
107
|
sessionManager;
|
|
@@ -88,6 +111,7 @@ export class AgentSession {
|
|
|
88
111
|
_unsubscribeAgent;
|
|
89
112
|
_eventListeners = [];
|
|
90
113
|
_isAgentRunActive = false;
|
|
114
|
+
_promptPreflightCount = 0;
|
|
91
115
|
_agentRunAbortRequested = false;
|
|
92
116
|
_idleWaitPromise;
|
|
93
117
|
_resolveIdleWait;
|
|
@@ -95,6 +119,8 @@ export class AgentSession {
|
|
|
95
119
|
_steeringMessages = [];
|
|
96
120
|
/** Tracks pending follow-up messages for UI display. Removed when delivered. */
|
|
97
121
|
_followUpMessages = [];
|
|
122
|
+
/** Queued user messages whose images are normalized when they are delivered. */
|
|
123
|
+
_queuedMessagesWithImages = new WeakSet();
|
|
98
124
|
/** Messages queued to be included with the next user prompt as context ("asides"). */
|
|
99
125
|
_pendingNextTurnMessages = [];
|
|
100
126
|
/** Context-only custom messages queued during a run, flushed once the current turn's tool results are in. */
|
|
@@ -257,6 +283,9 @@ export class AgentSession {
|
|
|
257
283
|
if (this.agent.streamFunction === streamSimple) {
|
|
258
284
|
return { ...(await this._getRequiredRequestAuth(model, signal)), thinkingLevel };
|
|
259
285
|
}
|
|
286
|
+
if (runtimeStreamFunctions.get(this.agent.streamFunction) === this._modelRuntime) {
|
|
287
|
+
return { model, thinkingLevel };
|
|
288
|
+
}
|
|
260
289
|
try {
|
|
261
290
|
const result = await this._modelRuntime.getAuth(model, { signal });
|
|
262
291
|
if (!result)
|
|
@@ -286,19 +315,25 @@ export class AgentSession {
|
|
|
286
315
|
return this._modelRuntime.getPhysicalModel(message.provider, message.model);
|
|
287
316
|
return model?.provider === message.provider && model.id === message.model ? model : undefined;
|
|
288
317
|
}
|
|
318
|
+
/** Record the live model and thinking level on the current branch, so a resume restores them. */
|
|
319
|
+
_recordSelection() {
|
|
320
|
+
const branch = this.sessionManager.getBranch();
|
|
321
|
+
this._recordModelSelection(branch);
|
|
322
|
+
this._recordThinkingLevel(branch);
|
|
323
|
+
}
|
|
289
324
|
/**
|
|
290
|
-
* Record the
|
|
291
|
-
*
|
|
292
|
-
*
|
|
293
|
-
*
|
|
294
|
-
*
|
|
325
|
+
* Record the model on the current branch when the branch implies another one. Tree navigation
|
|
326
|
+
* can leave the latest `model_change` on another branch; responses cannot record a virtual
|
|
327
|
+
* selection because they name physical models. Responses do record a physical selection unless
|
|
328
|
+
* the branch holds a virtual one; checking a physical selection against responses would record
|
|
329
|
+
* it on every prompt while `prepareRequest` redirects to another model.
|
|
295
330
|
*/
|
|
296
|
-
|
|
331
|
+
_recordModelSelection(branch) {
|
|
297
332
|
const model = this.model;
|
|
298
333
|
if (!model)
|
|
299
334
|
return;
|
|
300
335
|
const getModel = (provider, modelId) => this._modelRuntime.getModel(provider, modelId);
|
|
301
|
-
const recorded = getBranchSelection(
|
|
336
|
+
const recorded = getBranchSelection(branch, getModel);
|
|
302
337
|
if (!recorded || (recorded.provider === model.provider && recorded.modelId === model.id))
|
|
303
338
|
return;
|
|
304
339
|
const recordedModel = getModel(recorded.provider, recorded.modelId);
|
|
@@ -306,6 +341,25 @@ export class AgentSession {
|
|
|
306
341
|
return;
|
|
307
342
|
this.sessionManager.appendModelChange(model.provider, model.id);
|
|
308
343
|
}
|
|
344
|
+
/**
|
|
345
|
+
* Record the thinking level on the current branch when the branch implies another one (#11451).
|
|
346
|
+
* Tree navigation can leave the latest `thinking_level_change` on another branch. The recorded
|
|
347
|
+
* level is compared after clamping to the current model, so a level clamped on resume (e.g.
|
|
348
|
+
* `xhigh` running as `high`) is not recorded over the requested one.
|
|
349
|
+
*/
|
|
350
|
+
_recordThinkingLevel(branch) {
|
|
351
|
+
const recorded = branch.findLast((entry) => entry.type === "thinking_level_change");
|
|
352
|
+
if (!recorded)
|
|
353
|
+
return;
|
|
354
|
+
const recordedLevel = recorded.thinkingLevel;
|
|
355
|
+
const availableLevels = this.getAvailableThinkingLevels();
|
|
356
|
+
const effective = availableLevels.includes(recordedLevel)
|
|
357
|
+
? recordedLevel
|
|
358
|
+
: this._clampThinkingLevel(recordedLevel, availableLevels);
|
|
359
|
+
if (effective === this.thinkingLevel)
|
|
360
|
+
return;
|
|
361
|
+
this.sessionManager.appendThinkingLevelChange(this.thinkingLevel);
|
|
362
|
+
}
|
|
309
363
|
/** The model whose limits apply to the conversation. */
|
|
310
364
|
_limitsModel() {
|
|
311
365
|
return this.routedModel?.model ?? this.model;
|
|
@@ -731,21 +785,25 @@ export class AgentSession {
|
|
|
731
785
|
if (event.type === "message_start" && event.message.role === "user") {
|
|
732
786
|
this._overflowRecoveryAttempted = false;
|
|
733
787
|
const messageText = contentText(event.message.content, "");
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
788
|
+
// Check steering queue first
|
|
789
|
+
const steeringIndex = this._steeringMessages.indexOf(messageText);
|
|
790
|
+
if (steeringIndex !== -1) {
|
|
791
|
+
this._steeringMessages.splice(steeringIndex, 1);
|
|
792
|
+
this._emitQueueUpdate();
|
|
793
|
+
}
|
|
794
|
+
else {
|
|
795
|
+
// Check follow-up queue
|
|
796
|
+
const followUpIndex = this._followUpMessages.indexOf(messageText);
|
|
797
|
+
if (followUpIndex !== -1) {
|
|
798
|
+
this._followUpMessages.splice(followUpIndex, 1);
|
|
739
799
|
this._emitQueueUpdate();
|
|
740
800
|
}
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
}
|
|
748
|
-
}
|
|
801
|
+
}
|
|
802
|
+
// Normalize queued images at delivery, before events and persistence see the message,
|
|
803
|
+
// so they get the same resize as idle prompts with the current model's limits (#11738).
|
|
804
|
+
if (this._queuedMessagesWithImages.has(event.message)) {
|
|
805
|
+
this._queuedMessagesWithImages.delete(event.message);
|
|
806
|
+
await this._normalizeQueuedMessageImages(event.message);
|
|
749
807
|
}
|
|
750
808
|
}
|
|
751
809
|
// Emit to extensions first, then notify public listeners.
|
|
@@ -1171,9 +1229,14 @@ export class AgentSession {
|
|
|
1171
1229
|
* the registered, non-hidden ones; they are declared to the model. Active tools with a
|
|
1172
1230
|
* `prepareLoadout` hook can change the declared descriptions and hide declarations from
|
|
1173
1231
|
* requests (see {@link _installHiddenDeclarationsProjection}).
|
|
1232
|
+
*
|
|
1233
|
+
* The active tools are a set: tools that stay active keep their current order and newly active
|
|
1234
|
+
* ones are appended, so reordering the same names does not change the prompt (#11495).
|
|
1174
1235
|
*/
|
|
1175
1236
|
_applyToolLoadout(toolNames) {
|
|
1176
|
-
const
|
|
1237
|
+
const requested = new Set(toolNames);
|
|
1238
|
+
const kept = this.getActiveToolNames().filter((name) => requested.has(name));
|
|
1239
|
+
const tools = [...new Set([...kept, ...requested])].flatMap((name) => {
|
|
1177
1240
|
const tool = this._toolRegistry.get(name);
|
|
1178
1241
|
return tool && this._getToolExposure(name) !== "hidden" && this._isActivatable(name) ? [tool] : [];
|
|
1179
1242
|
});
|
|
@@ -1645,14 +1708,34 @@ export class AgentSession {
|
|
|
1645
1708
|
return;
|
|
1646
1709
|
}
|
|
1647
1710
|
}
|
|
1648
|
-
if (this._compactionAbortController !== undefined) {
|
|
1711
|
+
if (this._compactionAbortController !== undefined || this._branchSummaryAbortController !== undefined) {
|
|
1649
1712
|
throw new Error("Cannot submit a prompt while compaction is in progress. Wait for compaction to finish and retry.");
|
|
1650
1713
|
}
|
|
1714
|
+
// Reserve the context through async input hooks and auth checks so tree navigation cannot
|
|
1715
|
+
// start meanwhile (#9154). _startRun marks the run active synchronously, so there is no gap.
|
|
1716
|
+
this._promptPreflightCount++;
|
|
1717
|
+
let trigger;
|
|
1718
|
+
try {
|
|
1719
|
+
trigger = await this._preparePrompt(text, options);
|
|
1720
|
+
}
|
|
1721
|
+
finally {
|
|
1722
|
+
this._promptPreflightCount--;
|
|
1723
|
+
}
|
|
1724
|
+
if (trigger)
|
|
1725
|
+
await this._startRun(trigger, () => preflightResult?.("started"));
|
|
1726
|
+
}
|
|
1727
|
+
/**
|
|
1728
|
+
* Run input hooks, expand templates, queue while streaming, and validate model and auth.
|
|
1729
|
+
* Returns the run trigger, or undefined when the prompt was handled or queued.
|
|
1730
|
+
*/
|
|
1731
|
+
async _preparePrompt(text, options) {
|
|
1732
|
+
const expandPromptTemplates = options?.expandPromptTemplates ?? true;
|
|
1733
|
+
const preflightResult = options?.preflightResult;
|
|
1651
1734
|
// Emit input event for extension interception (before skill/template expansion)
|
|
1652
1735
|
const processedInput = await this._runInputHandlers(text, options?.images, options?.source ?? "interactive", this.isStreaming ? options?.streamingBehavior : undefined);
|
|
1653
1736
|
if (!processedInput) {
|
|
1654
1737
|
preflightResult?.("handled");
|
|
1655
|
-
return;
|
|
1738
|
+
return undefined;
|
|
1656
1739
|
}
|
|
1657
1740
|
const { text: currentText, images: currentImages } = processedInput;
|
|
1658
1741
|
// Expand skill commands (/skill:name args) and prompt templates (/template args)
|
|
@@ -1673,7 +1756,7 @@ export class AgentSession {
|
|
|
1673
1756
|
await this._queueSteer(expandedText, currentImages);
|
|
1674
1757
|
}
|
|
1675
1758
|
preflightResult?.("queued");
|
|
1676
|
-
return;
|
|
1759
|
+
return undefined;
|
|
1677
1760
|
}
|
|
1678
1761
|
// Validate model
|
|
1679
1762
|
if (!this.model) {
|
|
@@ -1690,7 +1773,7 @@ export class AgentSession {
|
|
|
1690
1773
|
}
|
|
1691
1774
|
throw new Error(formatNoApiKeyFoundMessage(this.model.provider));
|
|
1692
1775
|
}
|
|
1693
|
-
|
|
1776
|
+
return { messageType: "user", prompt: expandedText, images: currentImages };
|
|
1694
1777
|
}
|
|
1695
1778
|
/**
|
|
1696
1779
|
* Try to execute an extension command. Returns true if command was found and executed.
|
|
@@ -1799,11 +1882,10 @@ export class AgentSession {
|
|
|
1799
1882
|
if (images) {
|
|
1800
1883
|
content.push(...images);
|
|
1801
1884
|
}
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
});
|
|
1885
|
+
const message = { role: "user", content, timestamp: Date.now() };
|
|
1886
|
+
if (images?.length)
|
|
1887
|
+
this._queuedMessagesWithImages.add(message);
|
|
1888
|
+
this.agent.steer(message);
|
|
1807
1889
|
}
|
|
1808
1890
|
/**
|
|
1809
1891
|
* Internal: Queue a follow-up message (already expanded, no extension command check).
|
|
@@ -1815,7 +1897,26 @@ export class AgentSession {
|
|
|
1815
1897
|
if (images) {
|
|
1816
1898
|
content.push(...images);
|
|
1817
1899
|
}
|
|
1818
|
-
|
|
1900
|
+
const message = { role: "user", content, timestamp: Date.now() };
|
|
1901
|
+
if (images?.length)
|
|
1902
|
+
this._queuedMessagesWithImages.add(message);
|
|
1903
|
+
this.agent.followUp(message);
|
|
1904
|
+
}
|
|
1905
|
+
/** Replace a queued user message's images in place with normalized ones, appending hints to its text. */
|
|
1906
|
+
async _normalizeQueuedMessageImages(message) {
|
|
1907
|
+
if (typeof message.content === "string")
|
|
1908
|
+
return;
|
|
1909
|
+
const [first, ...rest] = message.content;
|
|
1910
|
+
if (first?.type !== "text")
|
|
1911
|
+
return;
|
|
1912
|
+
const images = rest.filter((block) => block.type === "image");
|
|
1913
|
+
const normalized = await this._normalizePromptImages(images);
|
|
1914
|
+
const text = normalized.hints.length > 0 ? `${first.text}\n\n${normalized.hints.join("\n")}` : first.text;
|
|
1915
|
+
message.content = [
|
|
1916
|
+
{ type: "text", text },
|
|
1917
|
+
...rest.filter((block) => block.type !== "image"),
|
|
1918
|
+
...normalized.images,
|
|
1919
|
+
];
|
|
1819
1920
|
}
|
|
1820
1921
|
/**
|
|
1821
1922
|
* Throw an error if the text is an extension command.
|
|
@@ -2052,14 +2153,11 @@ export class AgentSession {
|
|
|
2052
2153
|
async _cycleScopedModel(direction, options) {
|
|
2053
2154
|
const availableIds = new Set(this._modelRuntime.getAvailableSnapshot().map((model) => `${model.provider}\0${model.id}`));
|
|
2054
2155
|
const scopedModels = this._scopedModels.filter((scoped) => availableIds.has(`${scoped.model.provider}\0${scoped.model.id}`));
|
|
2055
|
-
if (scopedModels.length <= 1)
|
|
2056
|
-
return undefined;
|
|
2057
2156
|
const currentModel = this.model;
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
const nextIndex = direction === "forward" ? (currentIndex + 1) % len : (currentIndex - 1 + len) % len;
|
|
2157
|
+
const currentIndex = scopedModels.findIndex((sm) => modelsAreEqual(sm.model, currentModel));
|
|
2158
|
+
const nextIndex = getNextCycleIndex(currentIndex, scopedModels.length, direction);
|
|
2159
|
+
if (nextIndex === undefined)
|
|
2160
|
+
return undefined;
|
|
2063
2161
|
const next = scopedModels[nextIndex];
|
|
2064
2162
|
const thinkingLevel = this._getThinkingLevelForModelSwitch(next.model, next.thinkingLevel);
|
|
2065
2163
|
// Apply model
|
|
@@ -2080,14 +2178,11 @@ export class AgentSession {
|
|
|
2080
2178
|
}
|
|
2081
2179
|
async _cycleAvailableModel(direction, options) {
|
|
2082
2180
|
const availableModels = this._modelRuntime.getAvailableSnapshot();
|
|
2083
|
-
if (availableModels.length <= 1)
|
|
2084
|
-
return undefined;
|
|
2085
2181
|
const currentModel = this.model;
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
const nextIndex = direction === "forward" ? (currentIndex + 1) % len : (currentIndex - 1 + len) % len;
|
|
2182
|
+
const currentIndex = availableModels.findIndex((m) => modelsAreEqual(m, currentModel));
|
|
2183
|
+
const nextIndex = getNextCycleIndex(currentIndex, availableModels.length, direction);
|
|
2184
|
+
if (nextIndex === undefined)
|
|
2185
|
+
return undefined;
|
|
2091
2186
|
const nextModel = availableModels[nextIndex];
|
|
2092
2187
|
const thinkingLevel = this._getThinkingLevelForModelSwitch(nextModel);
|
|
2093
2188
|
this.agent.state.model = nextModel;
|
|
@@ -2996,6 +3091,12 @@ export class AgentSession {
|
|
|
2996
3091
|
});
|
|
2997
3092
|
}
|
|
2998
3093
|
async reload(options) {
|
|
3094
|
+
if (this.isStreaming) {
|
|
3095
|
+
throw new Error("Wait for the current response to finish before reloading.");
|
|
3096
|
+
}
|
|
3097
|
+
if (this.isCompacting) {
|
|
3098
|
+
throw new Error("Wait for compaction to finish before reloading.");
|
|
3099
|
+
}
|
|
2999
3100
|
const oldRunner = this._extensionRunner;
|
|
3000
3101
|
const previousFlagValues = oldRunner.getFlagValues();
|
|
3001
3102
|
await emitSessionShutdownEvent(oldRunner, { type: "session_shutdown", reason: "reload" });
|
|
@@ -3259,7 +3360,7 @@ export class AgentSession {
|
|
|
3259
3360
|
* @returns Result with editorText (if user message) and cancelled status
|
|
3260
3361
|
*/
|
|
3261
3362
|
async navigateTree(targetId, options = {}) {
|
|
3262
|
-
if (this.isStreaming) {
|
|
3363
|
+
if (this.isStreaming || this._promptPreflightCount > 0) {
|
|
3263
3364
|
throw new Error("Wait for the current response to finish before navigating the session tree.");
|
|
3264
3365
|
}
|
|
3265
3366
|
if (this.isCompacting) {
|
|
@@ -3295,7 +3396,8 @@ export class AgentSession {
|
|
|
3295
3396
|
label,
|
|
3296
3397
|
};
|
|
3297
3398
|
// Set up abort controller for summarization
|
|
3298
|
-
|
|
3399
|
+
const abortController = new AbortController();
|
|
3400
|
+
this._branchSummaryAbortController = abortController;
|
|
3299
3401
|
try {
|
|
3300
3402
|
let extensionSummary;
|
|
3301
3403
|
let fromExtension = false;
|
|
@@ -3304,7 +3406,7 @@ export class AgentSession {
|
|
|
3304
3406
|
const result = (await this._extensionRunner.emit({
|
|
3305
3407
|
type: "session_before_tree",
|
|
3306
3408
|
preparation,
|
|
3307
|
-
signal:
|
|
3409
|
+
signal: abortController.signal,
|
|
3308
3410
|
}));
|
|
3309
3411
|
if (result?.cancel) {
|
|
3310
3412
|
return { cancelled: true };
|
|
@@ -3329,7 +3431,7 @@ export class AgentSession {
|
|
|
3329
3431
|
let summaryDetails;
|
|
3330
3432
|
let summaryUsage;
|
|
3331
3433
|
if (options.summarize && entriesToSummarize.length > 0 && !extensionSummary) {
|
|
3332
|
-
const signal =
|
|
3434
|
+
const signal = abortController.signal;
|
|
3333
3435
|
const branchSummarySettings = this.settingsManager.getBranchSummarySettings();
|
|
3334
3436
|
const result = await generateBranchSummary(entriesToSummarize, {
|
|
3335
3437
|
...(await this._getSummarizationRequestAuth(this.model, signal)),
|
|
@@ -3403,7 +3505,8 @@ export class AgentSession {
|
|
|
3403
3505
|
// Update finalized context from the canonical session projection.
|
|
3404
3506
|
this._refreshFinalizedContext();
|
|
3405
3507
|
this._restoreToolsFromTranscript();
|
|
3406
|
-
//
|
|
3508
|
+
// The selected context is installed; session_tree handlers may now prompt or navigate again.
|
|
3509
|
+
this._branchSummaryAbortController = undefined;
|
|
3407
3510
|
await this._extensionRunner.emit({
|
|
3408
3511
|
type: "session_tree",
|
|
3409
3512
|
newLeafId: this.sessionManager.getLeafId(),
|
|
@@ -3415,7 +3518,10 @@ export class AgentSession {
|
|
|
3415
3518
|
return { editorText, cancelled: false, summaryEntry };
|
|
3416
3519
|
}
|
|
3417
3520
|
finally {
|
|
3418
|
-
|
|
3521
|
+
// A navigation started from session_tree owns the controller now; do not clear it.
|
|
3522
|
+
if (this._branchSummaryAbortController === abortController) {
|
|
3523
|
+
this._branchSummaryAbortController = undefined;
|
|
3524
|
+
}
|
|
3419
3525
|
this._resolveIdleWaitIfIdle();
|
|
3420
3526
|
}
|
|
3421
3527
|
}
|
|
@@ -3561,25 +3667,6 @@ export class AgentSession {
|
|
|
3561
3667
|
exportToJsonl(outputPath) {
|
|
3562
3668
|
return exportSessionToJsonl(this.sessionManager, outputPath);
|
|
3563
3669
|
}
|
|
3564
|
-
/**
|
|
3565
|
-
* Ask the current model to describe what went wrong in this session for a bug report.
|
|
3566
|
-
* Used when the user declines to share the transcript itself.
|
|
3567
|
-
*/
|
|
3568
|
-
async summarizeForBugReport(options) {
|
|
3569
|
-
const model = this.model;
|
|
3570
|
-
if (!model) {
|
|
3571
|
-
throw new Error("No model selected");
|
|
3572
|
-
}
|
|
3573
|
-
return generateBugReportSummary({
|
|
3574
|
-
...(await this._getSummarizationRequestAuth(model, options.signal)),
|
|
3575
|
-
messages: this.messages,
|
|
3576
|
-
hint: options.hint,
|
|
3577
|
-
signal: options.signal,
|
|
3578
|
-
streamFn: this.agent.streamFunction,
|
|
3579
|
-
retry: this.settingsManager.getRetrySettings(),
|
|
3580
|
-
sessionId: this.sessionId,
|
|
3581
|
-
});
|
|
3582
|
-
}
|
|
3583
3670
|
// =========================================================================
|
|
3584
3671
|
// Utilities
|
|
3585
3672
|
// =========================================================================
|