@astralyn/pi 0.87.6 → 0.99.0
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 +30 -6
- package/README.md +3 -3
- package/dist/bun/runtime-setup.js +4 -1
- package/dist/bun/runtime-setup.js.map +1 -1
- package/dist/bundle/chunks/anthropic-messages-KIXY7EDT.js +6 -0
- package/dist/bundle/chunks/anthropic.js +2 -2
- package/dist/bundle/chunks/azure-openai-responses-RPBERDXD.js +2 -0
- package/dist/bundle/chunks/bedrock-converse-stream.js +8 -8
- package/dist/bundle/chunks/{chunk-LPQCB2VJ.js → chunk-A576H74Y.js} +2 -2
- package/dist/bundle/chunks/{chunk-NW5FIDD7.js → chunk-ABVRAYXT.js} +3 -3
- package/dist/bundle/chunks/{chunk-I5IVW2WS.js → chunk-CLLDCO64.js} +1 -1
- package/dist/bundle/chunks/chunk-DEWXBB6W.js +2 -0
- package/dist/bundle/chunks/chunk-G4RY3GN7.js +11 -0
- package/dist/bundle/chunks/chunk-GCKVOFWP.js +2 -0
- package/dist/bundle/chunks/chunk-MPDALHNJ.js +2 -0
- package/dist/bundle/chunks/chunk-OO6DJ3CL.js +31 -0
- package/dist/bundle/chunks/{chunk-4W4Q2H6W.js → chunk-VW2P3X6P.js} +905 -278
- package/dist/bundle/chunks/chunk-VWCWZD6E.js +2 -0
- package/dist/bundle/chunks/cloudflare-workers-ai-system-one-ZYSAFXXL.js +2 -0
- package/dist/bundle/chunks/codemode-worker.js +295 -0
- package/dist/bundle/chunks/github-copilot.js +1 -1
- package/dist/bundle/chunks/google-generative-ai-SDNQVVXA.js +2 -0
- package/dist/bundle/chunks/google-vertex-LZXOLBIO.js +2 -0
- package/dist/bundle/chunks/llama-cpp-classify-7IYGGPND.js +22 -0
- package/dist/bundle/chunks/meta.js +2 -0
- package/dist/bundle/chunks/mistral-conversations-VYKPSSAM.js +5 -0
- package/dist/bundle/chunks/openai-chatgpt.js +75 -0
- package/dist/bundle/chunks/openai-codex-responses-HZ4VUDXD.js +10 -0
- package/dist/bundle/chunks/openai-codex.js +2 -2
- package/dist/bundle/chunks/openai-completions-SKDGF6OE.js +7 -0
- package/dist/bundle/chunks/openai-responses-FPML4SSG.js +3 -0
- package/dist/bundle/chunks/{openrouter-images-6XDE2CEW.js → openrouter-images-5524IQHX.js} +1 -1
- package/dist/bundle/chunks/openrouter.js +2 -2
- package/dist/bundle/chunks/{pi-messages-MQMPIPNC.js → pi-messages-HZZ7GEEW.js} +2 -2
- package/dist/bundle/chunks/radius.js +2 -2
- package/dist/bundle/chunks/typesafe-system-one-Z2CDLKEY.js +2 -0
- package/dist/bundle/chunks/virtual-modules-TQRORWJQ.js +2 -0
- package/dist/bundle/cli.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +4 -3
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/startup-ui.d.ts.map +1 -1
- package/dist/cli/startup-ui.js +38 -30
- package/dist/cli/startup-ui.js.map +1 -1
- package/dist/config.d.ts +18 -4
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +30 -4
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +1 -1
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +13 -13
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +2 -2
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +14 -1
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +100 -35
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +456 -194
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/bug-report.js +1 -1
- package/dist/core/bug-report.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +1 -22
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/compaction/utils.d.ts +2 -1
- package/dist/core/compaction/utils.d.ts.map +1 -1
- package/dist/core/compaction/utils.js +25 -18
- package/dist/core/compaction/utils.js.map +1 -1
- package/dist/core/crash-log.d.ts.map +1 -1
- package/dist/core/crash-log.js +2 -1
- package/dist/core/crash-log.js.map +1 -1
- package/dist/core/export-html/template.css +10 -0
- package/dist/core/export-html/template.js +66 -17
- package/dist/core/extensions/distribution-api.d.ts +1 -1
- package/dist/core/extensions/distribution-api.d.ts.map +1 -1
- package/dist/core/extensions/distribution-api.js.map +1 -1
- package/dist/core/extensions/index.d.ts +2 -2
- 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 +55 -5
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +22 -3
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +124 -8
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +305 -25
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/extensions/wrapper.d.ts +2 -2
- package/dist/core/extensions/wrapper.d.ts.map +1 -1
- package/dist/core/extensions/wrapper.js +3 -3
- package/dist/core/extensions/wrapper.js.map +1 -1
- package/dist/core/keybindings.d.ts +30 -5
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +7 -1
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/mcp-servers.d.ts +98 -0
- package/dist/core/mcp-servers.d.ts.map +1 -0
- package/dist/core/mcp-servers.js +158 -0
- package/dist/core/mcp-servers.js.map +1 -0
- package/dist/core/model-registry.d.ts +13 -1
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +25 -0
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts +2 -2
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +5 -5
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts +41 -3
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +167 -17
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/nested-tool-calls.d.ts +102 -0
- package/dist/core/nested-tool-calls.d.ts.map +1 -0
- package/dist/core/nested-tool-calls.js +177 -0
- package/dist/core/nested-tool-calls.js.map +1 -0
- package/dist/core/package-manager.d.ts +4 -0
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +58 -12
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/provider-composer.d.ts +40 -21
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +92 -40
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/remote-catalog-provider.d.ts +8 -1
- package/dist/core/remote-catalog-provider.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.js +18 -3
- package/dist/core/remote-catalog-provider.js.map +1 -1
- package/dist/core/resource-loader.d.ts +7 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +160 -35
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/sdk.d.ts +3 -3
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +25 -7
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager.d.ts +9 -0
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +22 -22
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +36 -1
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +108 -2
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +1 -0
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/source-info.d.ts +8 -0
- package/dist/core/source-info.d.ts.map +1 -1
- package/dist/core/source-info.js +16 -0
- package/dist/core/source-info.js.map +1 -1
- package/dist/core/system-prompt.js +1 -1
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tasks/delivery.d.ts +40 -0
- package/dist/core/tasks/delivery.d.ts.map +1 -0
- package/dist/core/tasks/delivery.js +157 -0
- package/dist/core/tasks/delivery.js.map +1 -0
- package/dist/core/tasks/history.d.ts +4 -0
- package/dist/core/tasks/history.d.ts.map +1 -0
- package/dist/core/{background → tasks}/history.js +24 -48
- package/dist/core/tasks/history.js.map +1 -0
- package/dist/core/{background → tasks}/output.d.ts +4 -4
- package/dist/core/tasks/output.d.ts.map +1 -0
- package/dist/core/{background → tasks}/output.js +11 -11
- package/dist/core/tasks/output.js.map +1 -0
- package/dist/core/tasks/presentation.d.ts +9 -0
- package/dist/core/tasks/presentation.d.ts.map +1 -0
- package/dist/core/{background → tasks}/presentation.js +53 -51
- package/dist/core/tasks/presentation.js.map +1 -0
- package/dist/core/{background/service.d.ts → tasks/runtime.d.ts} +22 -23
- package/dist/core/tasks/runtime.d.ts.map +1 -0
- package/dist/core/{background/service.js → tasks/runtime.js} +154 -198
- package/dist/core/tasks/runtime.js.map +1 -0
- package/dist/core/tasks/session.d.ts +49 -0
- package/dist/core/tasks/session.d.ts.map +1 -0
- package/dist/core/tasks/session.js +129 -0
- package/dist/core/tasks/session.js.map +1 -0
- package/dist/core/tasks/store.d.ts +32 -0
- package/dist/core/tasks/store.d.ts.map +1 -0
- package/dist/core/tasks/store.js +135 -0
- package/dist/core/tasks/store.js.map +1 -0
- package/dist/core/{background → tasks}/types.d.ts +80 -62
- package/dist/core/tasks/types.d.ts.map +1 -0
- package/dist/core/{background → tasks}/types.js +9 -9
- package/dist/core/tasks/types.js.map +1 -0
- package/dist/core/tasks/view-data.d.ts +8 -0
- package/dist/core/tasks/view-data.d.ts.map +1 -0
- package/dist/core/tasks/view-data.js +61 -0
- package/dist/core/tasks/view-data.js.map +1 -0
- package/dist/core/tasks/view.d.ts +30 -0
- package/dist/core/tasks/view.d.ts.map +1 -0
- package/dist/core/tasks/view.js +50 -0
- package/dist/core/tasks/view.js.map +1 -0
- package/dist/core/tools/bash.d.ts +8 -93
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +8 -240
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/grep.d.ts +2 -0
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +2 -0
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/index.d.ts +2 -1
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +9 -0
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/output-accumulator.d.ts +11 -0
- package/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/dist/core/tools/output-accumulator.js +36 -0
- package/dist/core/tools/output-accumulator.js.map +1 -1
- package/dist/core/tools/powershell.d.ts +6 -2
- package/dist/core/tools/powershell.d.ts.map +1 -1
- package/dist/core/tools/powershell.js +1 -1
- package/dist/core/tools/powershell.js.map +1 -1
- package/dist/core/tools/render-utils.d.ts +6 -0
- package/dist/core/tools/render-utils.d.ts.map +1 -1
- package/dist/core/tools/render-utils.js +26 -0
- package/dist/core/tools/render-utils.js.map +1 -1
- package/dist/core/tools/renderers/bash.d.ts +1 -1
- package/dist/core/tools/renderers/bash.d.ts.map +1 -1
- package/dist/core/tools/renderers/bash.js +9 -10
- package/dist/core/tools/renderers/bash.js.map +1 -1
- package/dist/core/tools/renderers/index.d.ts.map +1 -1
- package/dist/core/tools/renderers/index.js +5 -7
- package/dist/core/tools/renderers/index.js.map +1 -1
- package/dist/core/tools/renderers/read.d.ts.map +1 -1
- package/dist/core/tools/renderers/read.js +3 -2
- package/dist/core/tools/renderers/read.js.map +1 -1
- package/dist/core/tools/renderers/shell-task.d.ts +4 -0
- package/dist/core/tools/renderers/shell-task.d.ts.map +1 -0
- package/dist/core/tools/renderers/shell-task.js +35 -0
- package/dist/core/tools/renderers/shell-task.js.map +1 -0
- package/dist/core/tools/shell-execution.d.ts +4 -5
- package/dist/core/tools/shell-execution.d.ts.map +1 -1
- package/dist/core/tools/shell-execution.js +19 -3
- package/dist/core/tools/shell-execution.js.map +1 -1
- package/dist/core/tools/shell-tool.d.ts +93 -0
- package/dist/core/tools/shell-tool.d.ts.map +1 -0
- package/dist/core/tools/shell-tool.js +251 -0
- package/dist/core/tools/shell-tool.js.map +1 -0
- package/dist/core/tools/tasks/actions.d.ts +12 -0
- package/dist/core/tools/tasks/actions.d.ts.map +1 -0
- package/dist/{extensions/background → core/tools/tasks}/actions.js +20 -19
- package/dist/core/tools/tasks/actions.js.map +1 -0
- package/dist/{extensions/background → core/tools/tasks}/constants.d.ts +10 -10
- package/dist/core/tools/tasks/constants.d.ts.map +1 -0
- package/dist/{extensions/background → core/tools/tasks}/constants.js +10 -10
- package/dist/core/tools/tasks/constants.js.map +1 -0
- package/dist/{extensions/background → core/tools/tasks}/schema.d.ts +6 -6
- package/dist/core/tools/tasks/schema.d.ts.map +1 -0
- package/dist/{extensions/background → core/tools/tasks}/schema.js +17 -17
- package/dist/core/tools/tasks/schema.js.map +1 -0
- package/dist/{extensions/background → core/tools/tasks}/types.d.ts +15 -17
- package/dist/core/tools/tasks/types.d.ts.map +1 -0
- package/dist/core/tools/tasks/types.js.map +1 -0
- package/dist/core/tools/tasks.d.ts +14 -0
- package/dist/core/tools/tasks.d.ts.map +1 -0
- package/dist/core/tools/tasks.js +40 -0
- package/dist/core/tools/tasks.js.map +1 -0
- package/dist/core/tools/tool-definition-wrapper.d.ts +4 -3
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.js +4 -2
- package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
- package/dist/core/tools/truncate.d.ts +14 -0
- package/dist/core/tools/truncate.d.ts.map +1 -1
- package/dist/core/tools/truncate.js +29 -0
- package/dist/core/tools/truncate.js.map +1 -1
- package/dist/core/trust-manager.d.ts.map +1 -1
- package/dist/core/trust-manager.js +1 -0
- package/dist/core/trust-manager.js.map +1 -1
- package/dist/core/usage-totals.d.ts +5 -3
- package/dist/core/usage-totals.d.ts.map +1 -1
- package/dist/core/usage-totals.js +27 -4
- package/dist/core/usage-totals.js.map +1 -1
- package/dist/core/virtual-models.d.ts +115 -0
- package/dist/core/virtual-models.d.ts.map +1 -0
- package/dist/core/virtual-models.js +117 -0
- package/dist/core/virtual-models.js.map +1 -0
- package/dist/extensions/codemode/execute.d.ts +16 -0
- package/dist/extensions/codemode/execute.d.ts.map +1 -0
- package/dist/extensions/codemode/execute.js +390 -0
- package/dist/extensions/codemode/execute.js.map +1 -0
- package/dist/extensions/codemode/execute.lazy.d.ts +3 -0
- package/dist/extensions/codemode/execute.lazy.d.ts.map +1 -0
- package/dist/extensions/codemode/execute.lazy.js +3 -0
- package/dist/extensions/codemode/execute.lazy.js.map +1 -0
- package/dist/extensions/codemode/index.d.ts +21 -0
- package/dist/extensions/codemode/index.d.ts.map +1 -0
- package/dist/extensions/codemode/index.js +36 -0
- package/dist/extensions/codemode/index.js.map +1 -0
- package/dist/extensions/codemode/renderer.d.ts +12 -0
- package/dist/extensions/codemode/renderer.d.ts.map +1 -0
- package/dist/extensions/codemode/renderer.js +119 -0
- package/dist/extensions/codemode/renderer.js.map +1 -0
- package/dist/extensions/codemode/search.d.ts +33 -0
- package/dist/extensions/codemode/search.d.ts.map +1 -0
- package/dist/extensions/codemode/search.js +117 -0
- package/dist/extensions/codemode/search.js.map +1 -0
- package/dist/extensions/codemode/tool.d.ts +122 -0
- package/dist/extensions/codemode/tool.d.ts.map +1 -0
- package/dist/extensions/codemode/tool.js +324 -0
- package/dist/extensions/codemode/tool.js.map +1 -0
- package/dist/extensions/codemode/worker.d.ts +7 -0
- package/dist/extensions/codemode/worker.d.ts.map +1 -0
- package/dist/extensions/codemode/worker.js +7 -0
- package/dist/extensions/codemode/worker.js.map +1 -0
- package/dist/extensions/deepwiki/schema.d.ts +1 -1
- package/dist/extensions/index.d.ts.map +1 -1
- package/dist/extensions/index.js +14 -12
- package/dist/extensions/index.js.map +1 -1
- package/dist/extensions/llama/provider.d.ts +1 -1
- package/dist/extensions/llama/provider.d.ts.map +1 -1
- package/dist/extensions/llama/provider.js +65 -13
- package/dist/extensions/llama/provider.js.map +1 -1
- package/dist/extensions/mcp/cli.d.ts +21 -0
- package/dist/extensions/mcp/cli.d.ts.map +1 -0
- package/dist/extensions/mcp/cli.js +485 -0
- package/dist/extensions/mcp/cli.js.map +1 -0
- package/dist/extensions/mcp/cli.lazy.d.ts +3 -0
- package/dist/extensions/mcp/cli.lazy.d.ts.map +1 -0
- package/dist/extensions/mcp/cli.lazy.js +3 -0
- package/dist/extensions/mcp/cli.lazy.js.map +1 -0
- package/dist/extensions/mcp/config.d.ts +70 -0
- package/dist/extensions/mcp/config.d.ts.map +1 -0
- package/dist/extensions/mcp/config.js +146 -0
- package/dist/extensions/mcp/config.js.map +1 -0
- package/dist/extensions/mcp/index.d.ts +52 -0
- package/dist/extensions/mcp/index.d.ts.map +1 -0
- package/dist/extensions/mcp/index.js +904 -0
- package/dist/extensions/mcp/index.js.map +1 -0
- package/dist/extensions/mcp/log.d.ts +16 -0
- package/dist/extensions/mcp/log.d.ts.map +1 -0
- package/dist/extensions/mcp/log.js +64 -0
- package/dist/extensions/mcp/log.js.map +1 -0
- package/dist/extensions/mcp/oauth.d.ts +94 -0
- package/dist/extensions/mcp/oauth.d.ts.map +1 -0
- package/dist/extensions/mcp/oauth.js +330 -0
- package/dist/extensions/mcp/oauth.js.map +1 -0
- package/dist/extensions/mcp/resources.d.ts +43 -0
- package/dist/extensions/mcp/resources.d.ts.map +1 -0
- package/dist/extensions/mcp/resources.js +262 -0
- package/dist/extensions/mcp/resources.js.map +1 -0
- package/dist/extensions/mcp/runtime.d.ts +96 -0
- package/dist/extensions/mcp/runtime.d.ts.map +1 -0
- package/dist/extensions/mcp/runtime.js +372 -0
- package/dist/extensions/mcp/runtime.js.map +1 -0
- package/dist/extensions/mcp/runtime.lazy.d.ts +3 -0
- package/dist/extensions/mcp/runtime.lazy.d.ts.map +1 -0
- package/dist/extensions/mcp/runtime.lazy.js +3 -0
- package/dist/extensions/mcp/runtime.lazy.js.map +1 -0
- package/dist/extensions/mcp/tools.d.ts +83 -0
- package/dist/extensions/mcp/tools.d.ts.map +1 -0
- package/dist/extensions/mcp/tools.js +233 -0
- package/dist/extensions/mcp/tools.js.map +1 -0
- package/dist/extensions/mcp/ui.d.ts +60 -0
- package/dist/extensions/mcp/ui.d.ts.map +1 -0
- package/dist/extensions/mcp/ui.js +166 -0
- package/dist/extensions/mcp/ui.js.map +1 -0
- package/dist/extensions/statusline/index.js +2 -2
- package/dist/extensions/statusline/index.js.map +1 -1
- package/dist/extensions/tool-search/index.d.ts +12 -0
- package/dist/extensions/tool-search/index.d.ts.map +1 -0
- package/dist/extensions/tool-search/index.js +20 -0
- package/dist/extensions/tool-search/index.js.map +1 -0
- package/dist/extensions/tool-search/tool.d.ts +72 -0
- package/dist/extensions/tool-search/tool.d.ts.map +1 -0
- package/dist/extensions/tool-search/tool.js +208 -0
- package/dist/extensions/tool-search/tool.js.map +1 -0
- package/dist/index.d.ts +13 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +10 -0
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +13 -3
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-message.js +3 -1
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/first-time-setup.d.ts +4 -4
- package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -1
- package/dist/modes/interactive/components/first-time-setup.js +8 -2
- package/dist/modes/interactive/components/first-time-setup.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +7 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +42 -3
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/pi-logo.d.ts +12 -0
- package/dist/modes/interactive/components/pi-logo.d.ts.map +1 -0
- package/dist/modes/interactive/components/pi-logo.js +25 -0
- package/dist/modes/interactive/components/pi-logo.js.map +1 -0
- package/dist/modes/interactive/components/settings-selector.d.ts +3 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +28 -6
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/status-marker.d.ts +2 -2
- package/dist/modes/interactive/components/status-marker.js +2 -2
- package/dist/modes/interactive/components/status-marker.js.map +1 -1
- package/dist/modes/interactive/components/themed-text.d.ts +17 -0
- package/dist/modes/interactive/components/themed-text.d.ts.map +1 -0
- package/dist/modes/interactive/components/themed-text.js +28 -0
- package/dist/modes/interactive/components/themed-text.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +2 -4
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +214 -163
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/tasks/completion-render.d.ts +8 -0
- package/dist/modes/interactive/tasks/completion-render.d.ts.map +1 -0
- package/dist/{extensions/background → modes/interactive/tasks}/completion-render.js +31 -27
- package/dist/modes/interactive/tasks/completion-render.js.map +1 -0
- package/dist/modes/interactive/tasks/fallback-view.d.ts +4 -0
- package/dist/modes/interactive/tasks/fallback-view.d.ts.map +1 -0
- package/dist/modes/interactive/tasks/fallback-view.js +27 -0
- package/dist/modes/interactive/tasks/fallback-view.js.map +1 -0
- package/dist/modes/interactive/tasks/index.d.ts +12 -0
- package/dist/modes/interactive/tasks/index.d.ts.map +1 -0
- package/dist/modes/interactive/tasks/index.js +97 -0
- package/dist/modes/interactive/tasks/index.js.map +1 -0
- package/dist/modes/interactive/tasks/manager.d.ts +67 -0
- package/dist/modes/interactive/tasks/manager.d.ts.map +1 -0
- package/dist/modes/interactive/tasks/manager.js +380 -0
- package/dist/modes/interactive/tasks/manager.js.map +1 -0
- package/dist/{extensions/background → modes/interactive/tasks}/render.d.ts +13 -13
- package/dist/modes/interactive/tasks/render.d.ts.map +1 -0
- package/dist/{extensions/background → modes/interactive/tasks}/render.js +18 -18
- package/dist/modes/interactive/tasks/render.js.map +1 -0
- package/dist/{extensions/background → modes/interactive/tasks}/task-view.d.ts +7 -7
- package/dist/modes/interactive/tasks/task-view.d.ts.map +1 -0
- package/dist/{extensions/background → modes/interactive/tasks}/task-view.js +4 -4
- package/dist/modes/interactive/tasks/task-view.js.map +1 -0
- package/dist/{extensions/background → modes/interactive/tasks}/text.d.ts +1 -1
- package/dist/modes/interactive/tasks/text.d.ts.map +1 -0
- package/dist/{extensions/background → modes/interactive/tasks}/text.js +1 -1
- package/dist/modes/interactive/tasks/text.js.map +1 -0
- package/dist/modes/interactive/tasks/viewport.d.ts +15 -0
- package/dist/modes/interactive/tasks/viewport.d.ts.map +1 -0
- package/dist/modes/interactive/tasks/viewport.js +49 -0
- package/dist/modes/interactive/tasks/viewport.js.map +1 -0
- package/dist/modes/interactive/theme/dark.json +59 -72
- package/dist/modes/interactive/theme/light.json +57 -69
- package/dist/modes/interactive/theme/system-theme.d.ts +54 -0
- package/dist/modes/interactive/theme/system-theme.d.ts.map +1 -0
- package/dist/modes/interactive/theme/system-theme.js +535 -0
- package/dist/modes/interactive/theme/system-theme.js.map +1 -0
- package/dist/modes/interactive/theme/theme-controller.d.ts +46 -6
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-controller.js +125 -47
- package/dist/modes/interactive/theme/theme-controller.js.map +1 -1
- package/dist/modes/interactive/theme/theme-json.d.ts +1 -0
- package/dist/modes/interactive/theme/theme-json.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-json.js +3 -1
- package/dist/modes/interactive/theme/theme-json.js.map +1 -1
- package/dist/modes/interactive/theme/theme-schema.json +7 -2
- package/dist/modes/interactive/theme/theme.d.ts +70 -39
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +247 -313
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/interactive/tool-view/fallback.d.ts +1 -1
- package/dist/modes/interactive/tool-view/fallback.d.ts.map +1 -1
- package/dist/modes/interactive/tool-view/fallback.js +4 -1
- package/dist/modes/interactive/tool-view/fallback.js.map +1 -1
- package/dist/modes/interactive/tool-view/tool-execution.js +2 -2
- package/dist/modes/interactive/tool-view/tool-execution.js.map +1 -1
- package/dist/modes/interactive/tui-renderer.d.ts +2 -1
- package/dist/modes/interactive/tui-renderer.d.ts.map +1 -1
- package/dist/modes/interactive/tui-renderer.js +1 -0
- package/dist/modes/interactive/tui-renderer.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +6 -6
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +12 -8
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +7 -9
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +10 -1
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +6 -2
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js +14 -17
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/clipboard.d.ts +2 -0
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +5 -0
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/paths.d.ts +3 -3
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +5 -4
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/shell.d.ts +1 -3
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +3 -30
- package/dist/utils/shell.js.map +1 -1
- package/docs/bundled/README.md +22 -8
- package/docs/bundled/extensions/statusline.md +2 -2
- package/docs/bundled/tasks.md +141 -0
- package/docs/bundled/tool-presentation.md +1 -1
- package/docs/custom-provider.md +44 -0
- package/docs/docs.json +10 -6
- package/docs/extensions.md +89 -86
- package/docs/index.md +2 -1
- package/docs/keybindings.md +8 -7
- package/docs/llama-cpp.md +12 -1
- package/docs/mcp.md +188 -0
- package/docs/models.md +35 -0
- package/docs/packages.md +4 -0
- package/docs/providers.md +6 -0
- package/docs/rpc.md +5 -3
- package/docs/sdk.md +26 -16
- package/docs/security.md +4 -0
- package/docs/session-format.md +18 -11
- package/docs/settings.md +26 -2
- package/docs/themes.md +27 -5
- package/docs/tui.md +20 -0
- package/docs/usage.md +61 -3
- package/docs/virtual-models.md +114 -0
- package/docs/windows.md +2 -0
- package/examples/README.md +1 -1
- package/examples/extensions/README.md +2 -0
- 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/custom-provider-gitlab-duo/test.ts +4 -4
- package/examples/extensions/debug-provider.ts +90 -0
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/jev-router.ts +113 -0
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/rpc-client.ts +1 -1
- package/examples/rpc-extension-ui.ts +1 -1
- package/examples/sdk/14-codemode-mcp.ts +61 -0
- package/examples/sdk/README.md +1 -0
- package/npm-shrinkwrap.json +409 -423
- package/package.json +13 -10
- package/dist/bundle/chunks/anthropic-messages-XWFTZP2N.js +0 -6
- package/dist/bundle/chunks/azure-openai-responses-HS35BQV6.js +0 -2
- package/dist/bundle/chunks/chunk-2IO5GDBS.js +0 -11
- package/dist/bundle/chunks/chunk-EDBLK2JQ.js +0 -2
- package/dist/bundle/chunks/chunk-IORR2FW4.js +0 -2
- package/dist/bundle/chunks/chunk-NUHFSC37.js +0 -25
- package/dist/bundle/chunks/google-generative-ai-NOVAJBFC.js +0 -2
- package/dist/bundle/chunks/google-vertex-4VHCZJV5.js +0 -2
- package/dist/bundle/chunks/mistral-conversations-WC6A2WCJ.js +0 -5
- package/dist/bundle/chunks/openai-codex-responses-XCDG75W2.js +0 -10
- package/dist/bundle/chunks/openai-completions-SHS3CAEL.js +0 -7
- package/dist/bundle/chunks/openai-responses-UT6XFKC7.js +0 -2
- package/dist/bundle/chunks/virtual-modules-KUEIEAZN.js +0 -2
- package/dist/core/background/history.d.ts +0 -4
- package/dist/core/background/history.d.ts.map +0 -1
- package/dist/core/background/history.js.map +0 -1
- package/dist/core/background/output.d.ts.map +0 -1
- package/dist/core/background/output.js.map +0 -1
- package/dist/core/background/presentation.d.ts +0 -9
- package/dist/core/background/presentation.d.ts.map +0 -1
- package/dist/core/background/presentation.js.map +0 -1
- package/dist/core/background/service.d.ts.map +0 -1
- package/dist/core/background/service.js.map +0 -1
- package/dist/core/background/session.d.ts +0 -67
- package/dist/core/background/session.d.ts.map +0 -1
- package/dist/core/background/session.js +0 -248
- package/dist/core/background/session.js.map +0 -1
- package/dist/core/background/types.d.ts.map +0 -1
- package/dist/core/background/types.js.map +0 -1
- package/dist/extensions/background/actions.d.ts +0 -11
- package/dist/extensions/background/actions.d.ts.map +0 -1
- package/dist/extensions/background/actions.js.map +0 -1
- package/dist/extensions/background/completion-render.d.ts +0 -8
- package/dist/extensions/background/completion-render.d.ts.map +0 -1
- package/dist/extensions/background/completion-render.js.map +0 -1
- package/dist/extensions/background/constants.d.ts.map +0 -1
- package/dist/extensions/background/constants.js.map +0 -1
- package/dist/extensions/background/index.d.ts +0 -7
- package/dist/extensions/background/index.d.ts.map +0 -1
- package/dist/extensions/background/index.js +0 -135
- package/dist/extensions/background/index.js.map +0 -1
- package/dist/extensions/background/keybindings.d.ts +0 -10
- package/dist/extensions/background/keybindings.d.ts.map +0 -1
- package/dist/extensions/background/keybindings.js +0 -14
- package/dist/extensions/background/keybindings.js.map +0 -1
- package/dist/extensions/background/manager.d.ts +0 -80
- package/dist/extensions/background/manager.d.ts.map +0 -1
- package/dist/extensions/background/manager.js +0 -673
- package/dist/extensions/background/manager.js.map +0 -1
- package/dist/extensions/background/render.d.ts.map +0 -1
- package/dist/extensions/background/render.js.map +0 -1
- package/dist/extensions/background/schema.d.ts.map +0 -1
- package/dist/extensions/background/schema.js.map +0 -1
- package/dist/extensions/background/task-view.d.ts.map +0 -1
- package/dist/extensions/background/task-view.js.map +0 -1
- package/dist/extensions/background/text.d.ts.map +0 -1
- package/dist/extensions/background/text.js.map +0 -1
- package/dist/extensions/background/types.d.ts.map +0 -1
- package/dist/extensions/background/types.js.map +0 -1
- package/dist/extensions/subagent/activity.d.ts +0 -34
- package/dist/extensions/subagent/activity.d.ts.map +0 -1
- package/dist/extensions/subagent/activity.js +0 -192
- package/dist/extensions/subagent/activity.js.map +0 -1
- package/dist/extensions/subagent/agents-command.d.ts +0 -4
- package/dist/extensions/subagent/agents-command.d.ts.map +0 -1
- package/dist/extensions/subagent/agents-command.js +0 -230
- package/dist/extensions/subagent/agents-command.js.map +0 -1
- package/dist/extensions/subagent/agents.d.ts +0 -6
- package/dist/extensions/subagent/agents.d.ts.map +0 -1
- package/dist/extensions/subagent/agents.js +0 -53
- package/dist/extensions/subagent/agents.js.map +0 -1
- package/dist/extensions/subagent/budget.d.ts +0 -15
- package/dist/extensions/subagent/budget.d.ts.map +0 -1
- package/dist/extensions/subagent/budget.js +0 -123
- package/dist/extensions/subagent/budget.js.map +0 -1
- package/dist/extensions/subagent/cancellation.d.ts +0 -29
- package/dist/extensions/subagent/cancellation.d.ts.map +0 -1
- package/dist/extensions/subagent/cancellation.js +0 -91
- package/dist/extensions/subagent/cancellation.js.map +0 -1
- package/dist/extensions/subagent/constants.d.ts +0 -25
- package/dist/extensions/subagent/constants.d.ts.map +0 -1
- package/dist/extensions/subagent/constants.js +0 -50
- package/dist/extensions/subagent/constants.js.map +0 -1
- package/dist/extensions/subagent/index.d.ts +0 -3
- package/dist/extensions/subagent/index.d.ts.map +0 -1
- package/dist/extensions/subagent/index.js +0 -151
- package/dist/extensions/subagent/index.js.map +0 -1
- package/dist/extensions/subagent/model-selection.d.ts +0 -16
- package/dist/extensions/subagent/model-selection.d.ts.map +0 -1
- package/dist/extensions/subagent/model-selection.js +0 -51
- package/dist/extensions/subagent/model-selection.js.map +0 -1
- package/dist/extensions/subagent/render.d.ts +0 -24
- package/dist/extensions/subagent/render.d.ts.map +0 -1
- package/dist/extensions/subagent/render.js +0 -336
- package/dist/extensions/subagent/render.js.map +0 -1
- package/dist/extensions/subagent/resolve.d.ts +0 -31
- package/dist/extensions/subagent/resolve.d.ts.map +0 -1
- package/dist/extensions/subagent/resolve.js +0 -111
- package/dist/extensions/subagent/resolve.js.map +0 -1
- package/dist/extensions/subagent/runner.d.ts +0 -35
- package/dist/extensions/subagent/runner.d.ts.map +0 -1
- package/dist/extensions/subagent/runner.js +0 -255
- package/dist/extensions/subagent/runner.js.map +0 -1
- package/dist/extensions/subagent/schema.d.ts +0 -28
- package/dist/extensions/subagent/schema.d.ts.map +0 -1
- package/dist/extensions/subagent/schema.js +0 -58
- package/dist/extensions/subagent/schema.js.map +0 -1
- package/dist/extensions/subagent/sdk-runner.d.ts +0 -33
- package/dist/extensions/subagent/sdk-runner.d.ts.map +0 -1
- package/dist/extensions/subagent/sdk-runner.js +0 -331
- package/dist/extensions/subagent/sdk-runner.js.map +0 -1
- package/dist/extensions/subagent/settings.d.ts +0 -8
- package/dist/extensions/subagent/settings.d.ts.map +0 -1
- package/dist/extensions/subagent/settings.js +0 -206
- package/dist/extensions/subagent/settings.js.map +0 -1
- package/dist/extensions/subagent/state.d.ts +0 -102
- package/dist/extensions/subagent/state.d.ts.map +0 -1
- package/dist/extensions/subagent/state.js +0 -383
- package/dist/extensions/subagent/state.js.map +0 -1
- package/dist/extensions/subagent/text.d.ts +0 -6
- package/dist/extensions/subagent/text.d.ts.map +0 -1
- package/dist/extensions/subagent/text.js +0 -66
- package/dist/extensions/subagent/text.js.map +0 -1
- package/dist/extensions/subagent/types.d.ts +0 -91
- package/dist/extensions/subagent/types.d.ts.map +0 -1
- package/dist/extensions/subagent/types.js +0 -2
- package/dist/extensions/subagent/types.js.map +0 -1
- package/dist/extensions/subagent/ui/agents-dialog.d.ts +0 -4
- package/dist/extensions/subagent/ui/agents-dialog.d.ts.map +0 -1
- package/dist/extensions/subagent/ui/agents-dialog.js +0 -84
- package/dist/extensions/subagent/ui/agents-dialog.js.map +0 -1
- package/dist/extensions/subagent/ui/choice-menu.d.ts +0 -39
- package/dist/extensions/subagent/ui/choice-menu.d.ts.map +0 -1
- package/dist/extensions/subagent/ui/choice-menu.js +0 -93
- package/dist/extensions/subagent/ui/choice-menu.js.map +0 -1
- package/dist/extensions/subagent/ui/choices.d.ts +0 -36
- package/dist/extensions/subagent/ui/choices.d.ts.map +0 -1
- package/dist/extensions/subagent/ui/choices.js +0 -54
- package/dist/extensions/subagent/ui/choices.js.map +0 -1
- package/dist/extensions/subagent/ui/model-list.d.ts +0 -66
- package/dist/extensions/subagent/ui/model-list.d.ts.map +0 -1
- package/dist/extensions/subagent/ui/model-list.js +0 -235
- package/dist/extensions/subagent/ui/model-list.js.map +0 -1
- package/dist/extensions/subagent/ui/model-picker.d.ts +0 -47
- package/dist/extensions/subagent/ui/model-picker.d.ts.map +0 -1
- package/dist/extensions/subagent/ui/model-picker.js +0 -143
- package/dist/extensions/subagent/ui/model-picker.js.map +0 -1
- package/dist/extensions/subagent/ui/profile-settings-menu.d.ts +0 -41
- package/dist/extensions/subagent/ui/profile-settings-menu.d.ts.map +0 -1
- package/dist/extensions/subagent/ui/profile-settings-menu.js +0 -98
- package/dist/extensions/subagent/ui/profile-settings-menu.js.map +0 -1
- package/docs/bundled/extensions/background.md +0 -132
- package/docs/bundled/extensions/subagent.md +0 -148
- /package/dist/{extensions/background → core/tools/tasks}/types.js +0 -0
package/docs/extensions.md
CHANGED
|
@@ -1152,104 +1152,50 @@ pi.on("tool_result", async (event, ctx) => {
|
|
|
1152
1152
|
});
|
|
1153
1153
|
```
|
|
1154
1154
|
|
|
1155
|
-
### ctx.
|
|
1155
|
+
### ctx.tasks
|
|
1156
1156
|
|
|
1157
|
-
Session-bound `
|
|
1157
|
+
Session-bound `TasksContext` supervises native and extension-owned execution. Foreground work uses the same runtime even when background handoff is disabled. `ctx.tasks.enabled` tells whether this host permits handoff; interactive mode enables it. See [Tasks](bundled/tasks.md) and [SDK host policy](sdk.md#background-execution).
|
|
1158
1158
|
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
Use the optional projection in `control.publish(result, projection)` for portable presentation facts. `BackgroundText` is `{ text: string, truncated: boolean }`; record truncation where it happens instead of embedding a marker for the renderer to parse. Shell projections carry `shell: { name, output }`. Worker projections carry `id`, `label`, `profile`, `description`, observed `status`, `report`, optional `error`, plus `prompt`, `activity` and optional `model`/`usage` display strings. The host bounds each field, retaining at most eight workers, 40 KiB of shell output and 4 KiB per report.
|
|
1162
|
-
|
|
1163
|
-
Automatic completions persist a terminal `BackgroundCompletionSnapshot` in message `details`, independently of the tool's private result details. Completion workers omit live prompt/activity/model/usage fields, and display metadata is never billed. The host generates bounded model prose from the same facts; renderers read the structured snapshot. Executors without a projection get a bounded plain result fallback. See [Background records](session-format.md#background-records) for the complete format and replay rules.
|
|
1164
|
-
|
|
1165
|
-
| Member | Contract |
|
|
1159
|
+
| Method | Contract |
|
|
1166
1160
|
|---|---|
|
|
1167
|
-
| `
|
|
1168
|
-
| `
|
|
1169
|
-
| `
|
|
1170
|
-
| `
|
|
1171
|
-
| `
|
|
1172
|
-
| `
|
|
1173
|
-
| `subscribe(listener)` |
|
|
1174
|
-
| `
|
|
1175
|
-
|
|
1176
|
-
`BackgroundExecution<T>` supplies `kind` (`"bash"` or `"subagent"`), `title`, `toolCallId`, optional `command`, `cwd`, `background`, `signal`, `onUpdate`, and `run(control)`. This is supervision, not a generic executor registry: the extension still implements its own domain execution. `run` returns `{ result, status?, error?, usage? }`. Optional `error` is a bounded terminal diagnostic kept independently of log slices; optional `usage` is authoritative cumulative usage. Explicit terminal statuses are `completed`, `partial`, `failed`, `cancelled`, or `timeout`. Status and foreground/background mode are separate dimensions.
|
|
1161
|
+
| `execute<T>(execution)` | Returns `{ kind: "result", result, status?, error? }` or `{ kind: "background", task }` |
|
|
1162
|
+
| `list()` / `get(id)` | Bounded retained snapshots; IDs support unique prefixes |
|
|
1163
|
+
| `read(id, options?)` | Bounded head, tail, or byte-offset output |
|
|
1164
|
+
| `wait(id, timeoutMs?, signal?)` | Observation only; timeout or cancellation ends the wait, not execution |
|
|
1165
|
+
| `kill(id)` | Requests cancellation; `stopping` is not a terminal status |
|
|
1166
|
+
| `detach(id)` / `detachForeground()` | Hands off one task or all eligible foreground tasks without restarting them |
|
|
1167
|
+
| `subscribe(listener)` | Observes task state and progress |
|
|
1168
|
+
| `retain(id)` | Returns an idempotent release function protecting retained data, without delaying notifications |
|
|
1169
|
+
| `holdDelivery(id)` | Explicitly retains data and delays automatic delivery until released |
|
|
1177
1170
|
|
|
1178
|
-
|
|
1171
|
+
`TaskExecution<T>` supplies `kind`, `title`, `toolCallId`, `run(control)`, optional `format`, `command`, `cwd`, `background`, `signal`, and `onUpdate`. `kind` is an executor-owned source label matching `[a-z][a-z0-9-]{0,63}`; the runtime never dispatches on it. `format` is `"report"` (default) or `"log"`. Foreground log records have a separate history quota and are hidden from the finished panel unless selected.
|
|
1179
1172
|
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
```typescript
|
|
1183
|
-
import type { ExtensionAPI } from "@astralyn/pi";
|
|
1184
|
-
import { truncateHead } from "@astralyn/pi";
|
|
1185
|
-
import { Type } from "typebox";
|
|
1186
|
-
|
|
1187
|
-
export default function (pi: ExtensionAPI) {
|
|
1188
|
-
pi.registerTool({
|
|
1189
|
-
name: "git_status_task",
|
|
1190
|
-
label: "Git status task",
|
|
1191
|
-
description: "Read Git status through the session Background host",
|
|
1192
|
-
parameters: Type.Object({ background: Type.Optional(Type.Boolean()) }),
|
|
1193
|
-
async execute(toolCallId, params, signal, onUpdate, ctx) {
|
|
1194
|
-
if (!ctx.background.enabled) throw new Error("This tool requires an enabled Background host");
|
|
1195
|
-
const outcome = await ctx.background.execute({
|
|
1196
|
-
kind: "bash",
|
|
1197
|
-
title: "Git status",
|
|
1198
|
-
toolCallId,
|
|
1199
|
-
background: params.background,
|
|
1200
|
-
signal,
|
|
1201
|
-
onUpdate,
|
|
1202
|
-
async run(control) {
|
|
1203
|
-
control.signal.throwIfAborted();
|
|
1204
|
-
// All fixed-input preflight is complete; allow handoff.
|
|
1205
|
-
control.accept();
|
|
1206
|
-
const command = await pi.exec("git", ["status", "--short"], {
|
|
1207
|
-
cwd: ctx.cwd,
|
|
1208
|
-
signal: control.signal,
|
|
1209
|
-
timeout: 10_000,
|
|
1210
|
-
});
|
|
1211
|
-
return {
|
|
1212
|
-
status: command.code === 0 ? "completed" : "failed",
|
|
1213
|
-
result: {
|
|
1214
|
-
content: [{ type: "text", text: truncateHead(command.stdout + command.stderr).content }],
|
|
1215
|
-
details: {},
|
|
1216
|
-
},
|
|
1217
|
-
};
|
|
1218
|
-
},
|
|
1219
|
-
});
|
|
1220
|
-
if (outcome.kind === "result") return outcome.result;
|
|
1221
|
-
return {
|
|
1222
|
-
content: [{ type: "text", text: `Accepted: ${outcome.task.id}; use bg to read, wait, or stop.` }],
|
|
1223
|
-
details: { taskId: outcome.task.id },
|
|
1224
|
-
};
|
|
1225
|
-
},
|
|
1226
|
-
});
|
|
1227
|
-
}
|
|
1228
|
-
```
|
|
1173
|
+
`run` returns `TaskCompletion<T>`: `{ result, status?, error?, exitCode?, usage? }`. The original tool result is returned to a foreground caller; private `result.details` is not copied into task history. Explicit terminal statuses are `completed`, `partial`, `failed`, `cancelled`, and `timeout`. Usage is settled by the host once; managed foreground results omit usage to avoid billing it twice.
|
|
1229
1174
|
|
|
1230
|
-
|
|
1175
|
+
`TaskControl<T>` exposes `id`, `signal`, `mode`, `accept()`, `publish(result, projection?)`, `setOutputPath(path, cleanup?)`, `onModeChange(listener)`, and `requestCancel()`. Call `accept()` after whole-invocation preflight, before allowing a background handoff. Use the control's signal throughout execution. Parent-call cancellation is disconnected after handoff, while runtime shutdown still cancels the task. Mode subscriptions concern only this task; executors do not need the global registry to observe their own handoff or cancel themselves.
|
|
1231
1176
|
|
|
1232
|
-
|
|
1177
|
+
`TaskProjection` contains optional bounded `text`, executor-provided `nextStep` guidance, `shell: { name, output }`, and generic report `items`. Each item has `id`, `label`, `category`, `description`, `status`, `report`, optional `error`, live `input`/`activity`, and optional `context`/`usage` display strings. `TaskText` is `{ text, truncated }`. Report groups retain at most eight items, with 4 KiB per report; log output retains at most 40 KiB in the projection. Extensions may translate their reports into these public items; the core does not import executor internals.
|
|
1233
1178
|
|
|
1234
|
-
|
|
1179
|
+
Completion messages store a self-contained `TaskCompletionSnapshot`; only their bounded `content` enters model context. Built-in `tasks wait` binds delivery to the actual tool call, and the host confirms it after successful persistence. Ordinary extension reads/waits do not acknowledge delivery, and arbitrary tool-result detail fields cannot acknowledge a task.
|
|
1235
1180
|
|
|
1236
1181
|
```typescript
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
off = undefined;
|
|
1182
|
+
const outcome = await ctx.tasks.execute({
|
|
1183
|
+
kind: "report-job",
|
|
1184
|
+
title: "Inspect project",
|
|
1185
|
+
toolCallId,
|
|
1186
|
+
signal,
|
|
1187
|
+
background: params.background,
|
|
1188
|
+
async run(control) {
|
|
1189
|
+
control.accept();
|
|
1190
|
+
const report = await inspectProject(control.signal);
|
|
1191
|
+
return { result: { content: [{ type: "text", text: report }], details: undefined } };
|
|
1192
|
+
},
|
|
1249
1193
|
});
|
|
1194
|
+
if (outcome.kind === "result") return outcome.result;
|
|
1195
|
+
return { content: [{ type: "text", text: `Task ${outcome.task.id} continues in the background.` }], details: undefined };
|
|
1250
1196
|
```
|
|
1251
1197
|
|
|
1252
|
-
|
|
1198
|
+
`TaskRuntime`, `TaskRuntimeOptions`, and the public `Task*`/`TasksContext` types are exported from `@astralyn/pi`. Captured capabilities close with their runtime; obtain the replacement from the new session context after reload or session replacement.
|
|
1253
1199
|
|
|
1254
1200
|
### ctx.isIdle() / ctx.abort() / ctx.hasPendingMessages()
|
|
1255
1201
|
|
|
@@ -2277,7 +2223,7 @@ pi.registerTool(myTool);
|
|
|
2277
2223
|
|
|
2278
2224
|
**Constrained sampling:** `constrainedSampling: { type: "json_schema", strict: "prefer" }` requests provider-side schema enforcement when the active provider supports it, otherwise normal tool calling is used. Use `strict: "require"` only when the request should fail on unsupported providers. For provider-specific grammars, use `{ type: "grammar", variants: { openai_lark: "...", openai_regex: "..." } }`; each variant is optional, and unsupported providers fall back to normal function tools. `constrainedSampling: false` explicitly opts out (the same behavior as omitting it).
|
|
2279
2225
|
|
|
2280
|
-
**Usage accounting:** For unmanaged tools, if a tool makes nested LLM calls, return their combined `Usage` as `usage`. Pi persists it on the tool result and includes it in footer, `/session`, and RPC session totals. `tool_result` handlers can inspect or replace this value. Managed executions instead settle usage independently through [`ctx.
|
|
2226
|
+
**Usage accounting:** For unmanaged tools, if a tool makes nested LLM calls, return their combined `Usage` as `usage`. Pi persists it on the tool result and includes it in footer, `/session`, and RPC session totals. `tool_result` handlers can inspect or replace this value. Managed executions instead settle usage independently through [`ctx.tasks`](#ctxtasks); do not duplicate it on the handoff or managed foreground result.
|
|
2281
2227
|
|
|
2282
2228
|
**Signaling errors:** To mark a tool execution as failed (sets `isError: true` on the result and reports it to the LLM), throw an error from `execute`. Returning a value never sets the error flag regardless of what properties you include in the return object.
|
|
2283
2229
|
|
|
@@ -3254,3 +3200,60 @@ Use `ctx.mode === "tui"` before TUI-specific features (`custom()`, component fac
|
|
|
3254
3200
|
## Examples
|
|
3255
3201
|
|
|
3256
3202
|
The complete, maintained catalog is [examples/extensions/README.md](../examples/extensions/README.md). Use it to find a focused starting point by capability.
|
|
3203
|
+
|
|
3204
|
+
## Tool orchestration
|
|
3205
|
+
|
|
3206
|
+
Declare `outputSchema` and return a matching `structuredContent` when the result is data. The model still receives `content`; programmatic callers such as codemode scripts receive `structuredContent` instead of the text. Tools without `outputSchema` are passed to scripts as their text content. To report a failure that still carries data, return the result with `isError: true` instead of throwing: the model sees an error, and scripts still receive `structuredContent`.
|
|
3207
|
+
|
|
3208
|
+
A tool can run other tools with `ctx.executeTool(name, args, { signal, onUpdate })`. Nested calls go through argument validation and the `tool_call` and `tool_result` handlers like model-issued calls, and emit `tool_execution_start`, `tool_execution_update`, and `tool_execution_end`; all of these events carry `parentToolCallId`, and their `toolCallId` is assigned by pi as `<parent id>/<n>`. These ids do not appear as tool calls or tool results in the transcript. Nested calls do not add transcript entries: their results only reach the calling tool, which reports them itself, for example through `onUpdate` and `details`. The session keeps a bounded record of them (name, arguments, status, duration, error; never results) as `nestedCalls` on the calling tool's result message. It is used for compaction file lists and shown in HTML exports. Arguments over 8 KiB per call or 32 KiB per tool result are omitted, at most 256 calls are kept, and `complete: false` marks a record that lost anything. The `usage` of nested results, at every depth, is added to the calling tool's result `usage`, so a tool reports only its own usage, not that of the tools it called. `ctx.tools` lists the tools `ctx.executeTool()` can call. `tool_result` handlers that redact `content` should also replace `structuredContent`; replacing only `content` drops it.
|
|
3209
|
+
|
|
3210
|
+
### Tool exposure
|
|
3211
|
+
|
|
3212
|
+
`exposure` controls how the model reaches a tool. "Callable" means callable from other tools through `ctx.executeTool()` (`ctx.tools`), as the `codemode` tool's scripts do:
|
|
3213
|
+
|
|
3214
|
+
- `direct` (default): declared to the model while active, and callable while active.
|
|
3215
|
+
- `model-only`: declared to the model while active, never callable. Use it for tools that orchestrate other tools or ask the user.
|
|
3216
|
+
- `codemode`: callable whenever registered, and listed by the `codemode` tool. Not declared to the model unless activated explicitly.
|
|
3217
|
+
- `deferred`: like `codemode`, but codemode tools do not list it; `tool_search` can find and activate it.
|
|
3218
|
+
- `hidden`: registered but unreachable. Re-register a tool with `exposure: "hidden"` to withdraw it, since tools cannot be unregistered.
|
|
3219
|
+
|
|
3220
|
+
`namespace: { name, description }` groups related tools, as MCP servers do. Codemode tools list a namespace under one heading.
|
|
3221
|
+
|
|
3222
|
+
Registering a `direct` or `model-only` tool activates it; the other exposures are not activated on registration. The active set (`pi.getActiveTools()`, `pi.setActiveTools()`) is the set of tools declared to the model. `pi.getAllTools()` reports each tool's `exposure`, `namespace`, and `annotations`.
|
|
3223
|
+
|
|
3224
|
+
`annotations` are hints about what a tool does, with the meaning of MCP tool annotations: `readOnlyHint`, `destructiveHint`, `idempotentHint`, and `openWorldHint`. MCP tools carry the hints their server declares. Missing hints take the MCP defaults: a tool is not read-only, and may be destructive and reach an open world. The hints are not verified, but a permission extension can use them to decide which calls to confirm. This confirms the calls Codex asks approval for:
|
|
3225
|
+
|
|
3226
|
+
```typescript
|
|
3227
|
+
pi.on("tool_call", async (event, ctx) => {
|
|
3228
|
+
const hints = pi.getAllTools().find((tool) => tool.name === event.toolName)?.annotations;
|
|
3229
|
+
const needsApproval =
|
|
3230
|
+
hints?.destructiveHint === true ||
|
|
3231
|
+
(!hints?.readOnlyHint && ((hints?.destructiveHint ?? true) || (hints?.openWorldHint ?? true)));
|
|
3232
|
+
if (needsApproval && !(await ctx.ui.confirm("Allow tool call?", event.toolName))) {
|
|
3233
|
+
return { block: true, reason: `${event.toolName} was not approved` };
|
|
3234
|
+
}
|
|
3235
|
+
});
|
|
3236
|
+
```
|
|
3237
|
+
|
|
3238
|
+
A tool that orchestrates other tools can adjust what the model sees while it is active with `prepareLoadout(loadout)`. It runs whenever the active tools change and receives the declared tools, the callable tools, and every registered tool with its exposure and namespace. It returns replacement `descriptions` for declared tools (including its own) and `hiddenDeclarations`: active tools whose declarations requests leave out while they stay active and callable. `codemode` and `tool_search` use only this hook, `exposure`, and `ctx.executeTool()`, so another tool can implement the same behavior under a different name.
|
|
3239
|
+
|
|
3240
|
+
### MCP servers
|
|
3241
|
+
|
|
3242
|
+
`pi.registerMcpServer(name, config)` adds an MCP server for the current session. `config` has the shape of an `mcpServers` entry in [`mcp.json`](mcp.md): `command`, `args`, `env`, and `cwd` for stdio servers, `url`, `headers`, and `oauth` for HTTP servers, plus `exposure`, `toolExposure`, `enabled`, and `timeout`.
|
|
3243
|
+
|
|
3244
|
+
```typescript
|
|
3245
|
+
pi.registerMcpServer("jira", { url: "https://mcp.example.com/jira", exposure: "codemode" });
|
|
3246
|
+
pi.unregisterMcpServer("jira");
|
|
3247
|
+
```
|
|
3248
|
+
|
|
3249
|
+
Servers registered while the extension loads connect when the session starts, together with the `mcp.json` servers; servers registered later connect right away, and `pi.unregisterMcpServer()` closes the connection and makes the server's tools unreachable. Registrations are not saved: register again on every load, for example based on the extension's own settings. A server in `mcp.json` with the same name takes precedence, and `/mcp` shows the override. Registering the same name again replaces the extension's earlier registration; names registered by another extension, invalid names, and invalid configs throw.
|
|
3250
|
+
|
|
3251
|
+
The built-in MCP support connects registered servers. When nothing does, because another extension replaced it (see [MCP](mcp.md#other-mcp-extensions)), each registration is reported as an extension error. Other MCP extensions can connect registered servers too: read them with `pi.getMcpServers()` on `session_start` and handle the `mcp_servers_change` event for later changes.
|
|
3252
|
+
|
|
3253
|
+
### Provider stream events
|
|
3254
|
+
|
|
3255
|
+
<a id="provider_stream_event"></a>
|
|
3256
|
+
|
|
3257
|
+
`provider_stream_event` fires for each parsed provider stream event before Pi normalizes it. The event identifies the provider, API, and model; `event.data` is the earliest structured value available to Pi, not necessarily the original HTTP bytes or SSE frame. Treat it as read-only because mutation can affect normalization. The event is notification-only and is not persisted.
|
|
3258
|
+
|
|
3259
|
+
Handlers are awaited in stream order, so slow handlers delay stream consumption. Handler errors are reported without changing the provider response. See [`debug-provider.ts`](../examples/extensions/debug-provider.ts) for an opt-in viewer that groups raw events by assistant message.
|
package/docs/index.md
CHANGED
|
@@ -16,7 +16,8 @@ A task-oriented map for the installed package.
|
|
|
16
16
|
|
|
17
17
|
## Bundled package features
|
|
18
18
|
|
|
19
|
-
- [Bundled features overview](bundled/README.md) —
|
|
19
|
+
- [Bundled features overview](bundled/README.md) — upstream Pi features and distribution-maintained additions.
|
|
20
|
+
- [llama.cpp](llama-cpp.md), [Codemode](usage.md#enable-codemode), [MCP](mcp.md), and [Tool search](usage.md#tool-search) — official upstream extensions included in this package.
|
|
20
21
|
|
|
21
22
|
## Customize and integrate
|
|
22
23
|
|
package/docs/keybindings.md
CHANGED
|
@@ -128,14 +128,15 @@ This routing remains configurable through the ordinary action bindings. For exam
|
|
|
128
128
|
| `app.suspend` | `ctrl+z` (none on Windows) | Suspend to background |
|
|
129
129
|
| `app.editor.external` | `ctrl+g` | Open in external editor (`externalEditor`, `$VISUAL`, `$EDITOR`, Notepad on Windows, or `nano` elsewhere) |
|
|
130
130
|
| `app.clipboard.pasteImage` | `ctrl+v` (`alt+v` on Windows and WSL) | Paste image or text from clipboard |
|
|
131
|
-
| `app.
|
|
132
|
-
| `app.
|
|
133
|
-
| `app.
|
|
134
|
-
| `app.
|
|
131
|
+
| `app.tasks.detach` | `ctrl+b` | Move all eligible current foreground managed tasks to the background |
|
|
132
|
+
| `app.tasks.focusList` | `left` | Focus the task list in `/tasks` |
|
|
133
|
+
| `app.tasks.focusPreview` | `right` | Focus the selected preview in `/tasks` |
|
|
134
|
+
| `app.tasks.focusInfo` | `i` | Focus the selected task's information in `/tasks` |
|
|
135
|
+
| `app.tasks.kill` | `k` | Ask to stop the selected ongoing task in `/tasks` (confirmed with `y`) |
|
|
135
136
|
|
|
136
|
-
In `/
|
|
137
|
+
In `/tasks`, Up/Down and Page Up/Page Down target the focused pane: row selection/list paging or preview scrolling/paging. Enter focuses the preview; Escape returns to the list before closing. Left/Right focus controls can be rebound independently of editor cursor actions. List paging uses `tui.select.pageUp`/`pageDown`; preview paging uses `tui.editor.pageUp`/`pageDown` (including their default Ctrl+Page Up/Down aliases).
|
|
137
138
|
|
|
138
|
-
Ctrl+B also works while `/
|
|
139
|
+
Ctrl+B also works while `/tasks` owns focus. It does not restart execution, reset shell timeouts, or affect user `!` commands. With no eligible work the key falls through to other bindings. See [Background tasks](bundled/tasks.md).
|
|
139
140
|
|
|
140
141
|
### Question Details
|
|
141
142
|
|
|
@@ -254,7 +255,7 @@ Disable the detach action before restoring Ctrl+B as cursor-left (or rebind deta
|
|
|
254
255
|
{
|
|
255
256
|
"tui.editor.historyPrevious": "ctrl+p",
|
|
256
257
|
"tui.editor.historyNext": "ctrl+n",
|
|
257
|
-
"app.
|
|
258
|
+
"app.tasks.detach": [],
|
|
258
259
|
"tui.editor.cursorLeft": ["left", "ctrl+b"],
|
|
259
260
|
"tui.editor.cursorRight": ["right", "ctrl+f"],
|
|
260
261
|
"tui.editor.cursorWordLeft": ["alt+left", "alt+b"],
|
package/docs/llama-cpp.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# llama.cpp
|
|
2
2
|
|
|
3
|
-
Pi supports the [llama.cpp](https://github.com/ggml-org/llama.cpp) router server
|
|
3
|
+
The llama.cpp integration is provided by [upstream Pi](https://github.com/earendil-works/pi) and included in `@astralyn/pi`. It supports the [llama.cpp](https://github.com/ggml-org/llama.cpp) router server, which discovers multiple GGUF models and loads or unloads them on demand.
|
|
4
4
|
|
|
5
5
|
Use a current llama.cpp build with router support. Follow the [build instructions](https://github.com/ggml-org/llama.cpp/blob/master/docs/build.md) or install a [prebuilt release](https://github.com/ggml-org/llama.cpp/releases) for your platform.
|
|
6
6
|
|
|
@@ -99,3 +99,14 @@ curl http://127.0.0.1:8080/models
|
|
|
99
99
|
- **Model missing from `/model`:** Load it with `/llama` first and wait for loading to finish. Idle-sleeping models remain selectable.
|
|
100
100
|
- **Load fails or uses too much memory:** Lower `-c` or unload another model.
|
|
101
101
|
- **Server is not in router mode:** Start it without `--model`, `-m`, or `-hf`.
|
|
102
|
+
|
|
103
|
+
## Classification
|
|
104
|
+
|
|
105
|
+
Every model listed for chat is also listed as a classifier model with the same ID and the `llama-cpp-classify` API. Classifier models answer typed `choice`, `bool`, and `score` questions about JSON state, like TypeSafe's Jev models. The model reaches them from [`codemode`](usage.md#enable-codemode) scripts, and extensions through `ctx.modelRegistry.classify()`; see [Classifier models](models.md#use-classifier-models).
|
|
106
|
+
|
|
107
|
+
The model does not generate an answer. Each question becomes one chat prompt: the state, every question of the request, the state again, and then the question with its answers under single-token labels. Labels are letters for a choice (up to 62 options), `Yes`/`No` for a bool, and digits for a score (up to 10 levels). The second copy of the state is read with the questions in view, which improved accuracy on JevBench with small models. Pi reads the probabilities of the labels as the next token and normalizes them. A choice returns every option's probability and a confidence of `(n * peak - 1) / (n - 1)`; a score returns the expected level.
|
|
108
|
+
|
|
109
|
+
- Raw label probabilities are usually overconfident. The per-request `temperature` option divides the label logits before normalizing; values above 1 soften the distribution. It changes no answer.
|
|
110
|
+
- Questions run one after another. Everything before the final question is the same for all questions of a request, so the server's prompt cache evaluates it once. The state appears twice, so it needs twice its size in context.
|
|
111
|
+
- Small models may follow instructions written inside the state. The prompt tells the model to judge the state as data, but that is not a guarantee.
|
|
112
|
+
- Hybrid models such as Qwen3.5 cannot rewind a partially cached prompt without context checkpoints. If each question reprocesses the whole state, start the router with `--ctx-checkpoints 32 --checkpoint-min-step 0`.
|
package/docs/mcp.md
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
# MCP Servers
|
|
2
|
+
|
|
3
|
+
The MCP integration is provided by [upstream Pi](https://github.com/earendil-works/pi) and included in `@astralyn/pi`. It connects to [Model Context Protocol](https://modelcontextprotocol.io) servers over stdio or streamable HTTP and makes their tools available to the model.
|
|
4
|
+
|
|
5
|
+
## Configure servers
|
|
6
|
+
|
|
7
|
+
Add servers to `~/.pi/agent/mcp.json`, or to `.pi/mcp.json` in a project. The format matches other MCP clients, so existing `mcpServers` entries can be copied over:
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"mcpServers": {
|
|
12
|
+
"filesystem": {
|
|
13
|
+
"command": "npx",
|
|
14
|
+
"args": ["-y", "@modelcontextprotocol/server-filesystem", "."]
|
|
15
|
+
},
|
|
16
|
+
"docs": {
|
|
17
|
+
"url": "https://example.com/mcp",
|
|
18
|
+
"headers": { "Authorization": "Bearer ${DOCS_TOKEN}" },
|
|
19
|
+
"exposure": "direct"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
- stdio servers take `command`, `args`, `env`, and `cwd`. Relative `cwd` resolves against the session directory. A leading `~/` in `command`, an argument, or `cwd` names the home directory.
|
|
26
|
+
- HTTP servers take `url`, `headers`, and `oauth` (see [Sign in with OAuth](#sign-in-with-oauth)). The legacy SSE transport is not supported.
|
|
27
|
+
- `env` and `headers` values can reference environment variables (`${NAME}`) or commands (`!command`), like provider API keys.
|
|
28
|
+
- `timeout` sets the per-request timeout in seconds (default 60). Progress notifications from the server reset it.
|
|
29
|
+
- `enabled: false` keeps an entry without connecting to it.
|
|
30
|
+
|
|
31
|
+
Project entries replace global entries with the same name. A project `mcp.json` is only read after the project is trusted, because stdio servers run commands.
|
|
32
|
+
|
|
33
|
+
`pi mcp add` and `pi mcp remove` edit the file from a shell (see [MCP commands](usage.md#mcp-commands)):
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pi mcp add filesystem -- npx -y @modelcontextprotocol/server-filesystem .
|
|
37
|
+
pi mcp add docs --url https://example.com/mcp --bearer-token-env-var DOCS_TOKEN --exposure direct
|
|
38
|
+
pi mcp add -l tools --env API_KEY='${TOOLS_KEY}' -- uvx tools-mcp
|
|
39
|
+
pi mcp remove docs
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Rules that are easy to get wrong:
|
|
43
|
+
|
|
44
|
+
- Server names may only contain letters, digits, `_`, and `-`. Tools are named `mcp__<server>__<tool>`.
|
|
45
|
+
- `type` is optional: a `command` makes a stdio server and a `url` a streamable HTTP server. When present, it must be `stdio`, `http`, or `streamable-http`. `sse` is rejected; most servers that document an SSE endpoint also serve streamable HTTP, often at `/mcp` instead of `/sse`.
|
|
46
|
+
- `command` is a single executable and `args` its arguments, not one shell string.
|
|
47
|
+
- Keep secrets out of the file: use `${NAME}` for environment variables, as in `"Authorization": "Bearer ${GITHUB_TOKEN}"`, or `!command` to run a command. A command must make up the whole value, so it has to print the header value itself: `"Authorization": "!echo Bearer $(gh auth token)"`.
|
|
48
|
+
- Invalid entries are skipped and reported; the other servers still connect.
|
|
49
|
+
|
|
50
|
+
## Set up servers
|
|
51
|
+
|
|
52
|
+
When asked to add an MCP server, the agent should:
|
|
53
|
+
|
|
54
|
+
1. Add simple servers with `pi mcp add` (add `-l` for the project file), or edit `mcp.json` directly for settings the command does not cover. Put personal servers and servers with credentials in `~/.pi/agent/mcp.json`. Use the project `.pi/mcp.json` only for servers the project itself needs, and only in trusted projects.
|
|
55
|
+
2. Convert entries written for other clients:
|
|
56
|
+
- Claude Desktop, Claude Code, and Cursor use the same `mcpServers` shape; copy the entry.
|
|
57
|
+
- VS Code uses a top-level `servers` object and `inputs` prompts; move the entry under `mcpServers` and replace `${input:...}` with `${NAME}` environment variables.
|
|
58
|
+
- Codex uses TOML (`[mcp_servers.<name>]` with `command`, `args`, `env`, or `url`); write the same fields as JSON.
|
|
59
|
+
- opencode uses `"type": "local"` with `command` as an array (split it into `command` and `args`), `"type": "remote"` for URLs, `environment` for `env`, and `{env:NAME}` for `${NAME}`.
|
|
60
|
+
3. Run `pi mcp list` to check the entry. It connects to every enabled server and prints the state, the tools, and errors such as the stderr of a stdio server that failed to start. It exits with 1 while anything is wrong.
|
|
61
|
+
4. For a server that needs a sign-in, run `pi mcp login <server>`. It opens the authorization page in the user's browser and waits until the user approves access; tell the user to approve it. A running session uses the new credentials on its next turn.
|
|
62
|
+
5. Tell the user to run `/reload` (or start a new session) so the running session connects to added or changed servers.
|
|
63
|
+
|
|
64
|
+
Pi connects when a session starts. The first prompt waits up to 10 seconds for startup connections; the tools of servers that take longer become available once they connect. HTTP connections that fail with a network error or a transient status (408, 429, 5xx) are retried twice. A server that drops its connection shows as disconnected and is reconnected on the next call. When a server announces that its tool list changed, new tools are added and withdrawn tools become unreachable until the server offers them again.
|
|
65
|
+
|
|
66
|
+
Config errors, servers that failed to connect, and servers that need a sign-in are reported once after startup.
|
|
67
|
+
|
|
68
|
+
Log messages servers send with MCP logging notifications are appended to `~/.pi/agent/mcp.log` as `<time> [<server>] <level> <logger>: <message>`. The file is moved to `mcp.log.1` when it grows past 5 MB.
|
|
69
|
+
|
|
70
|
+
## Manage servers
|
|
71
|
+
|
|
72
|
+
`/mcp` opens the server manager. It lists every configured server with its state, tool count, exposure, and whether it comes from the global or the project `mcp.json`; servers that need attention come first. Select a server to:
|
|
73
|
+
|
|
74
|
+
- sign in, for OAuth servers that need it (see [Sign in with OAuth](#sign-in-with-oauth))
|
|
75
|
+
- see its tools, its command or URL, and the full connection error, including the tail of a stdio server's stderr
|
|
76
|
+
- reconnect
|
|
77
|
+
- sign out, which deletes the stored OAuth credentials
|
|
78
|
+
- change its exposure (see [Exposure](#exposure))
|
|
79
|
+
- disable or enable it
|
|
80
|
+
|
|
81
|
+
Exposure changes and enabling or disabling are saved to the `mcp.json` that defines the server; other content of the file is kept. Disabled servers stay listed so they can be enabled again.
|
|
82
|
+
|
|
83
|
+
Outside the interactive TUI, `/mcp` prints the server status. `/mcp login <server>`, `/mcp logout <server>`, and `/mcp reconnect <server>` run those actions directly.
|
|
84
|
+
|
|
85
|
+
From a shell, `pi mcp add`, `pi mcp remove`, `pi mcp list`, `pi mcp login <server>`, and `pi mcp logout <server>` manage servers without a session (see [MCP commands](usage.md#mcp-commands)).
|
|
86
|
+
|
|
87
|
+
Stopping a stdio server closes its stdin, then sends SIGTERM and finally SIGKILL to its whole process group, so servers started through wrappers such as `npx` or `uvx` do not linger.
|
|
88
|
+
|
|
89
|
+
## Sign in with OAuth
|
|
90
|
+
|
|
91
|
+
Remote servers that use OAuth, such as Sentry, need no credentials in `mcp.json`:
|
|
92
|
+
|
|
93
|
+
```json
|
|
94
|
+
{
|
|
95
|
+
"mcpServers": {
|
|
96
|
+
"sentry": { "url": "https://mcp.sentry.dev/mcp" }
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
When such a server rejects the connection, `/mcp` shows it as needing sign-in. Select it and choose "Sign in" (or run `/mcp login sentry`, or `pi mcp login sentry` in a shell) to open the authorization page in your browser. After you approve access, the browser redirects to a temporary server on `127.0.0.1` and pi connects. If the browser runs on another machine, for example over SSH, paste the URL it was redirected to into the sign-in screen instead.
|
|
102
|
+
|
|
103
|
+
Pi registers itself with the authorization server (dynamic client registration), stores tokens in `~/.pi/agent/mcp-auth.json`, and refreshes access tokens automatically when they expire or the server rejects them. If the server later asks for more scope than was granted, it shows as needing sign-in again, and signing in requests the new scope. "Sign out" in `/mcp` (or `/mcp logout sentry`) deletes the stored credentials.
|
|
104
|
+
|
|
105
|
+
OAuth applies to HTTP servers without an `Authorization` header. For authorization servers that do not support dynamic client registration, configure a pre-registered client:
|
|
106
|
+
|
|
107
|
+
```json
|
|
108
|
+
{
|
|
109
|
+
"mcpServers": {
|
|
110
|
+
"example": {
|
|
111
|
+
"url": "https://mcp.example.com/mcp",
|
|
112
|
+
"oauth": { "clientId": "my-client", "clientSecret": "${EXAMPLE_SECRET}", "callbackPort": 8765 }
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
The redirect URI must match the one registered for the client. `callbackPort` fixes it to `http://127.0.0.1:<port>/callback`. For another redirect URI, set `callbackUrl`, for example `"callbackUrl": "http://localhost:8080/oauth/callback"`. It must be an `http` URI on `localhost`, `127.0.0.1`, or `[::1]`, and is sent exactly as written. Without a port in `callbackUrl`, pi listens on `callbackPort`, or on a free port, and adds it to the URI; authorization servers accept any port for loopback redirects (RFC 8252). `clientSecret` is optional and can reference environment variables or commands.
|
|
119
|
+
|
|
120
|
+
`scope` sets the scopes to request, separated by spaces, for servers that do not advertise the ones they need. Without it, pi requests the scopes the server advertises. When a server later asks for more scope, pi requests those on top of `scope`.
|
|
121
|
+
|
|
122
|
+
## Exposure
|
|
123
|
+
|
|
124
|
+
Each server's tools are registered as `mcp__<server>__<tool>`. The `exposure` setting controls how the model reaches them:
|
|
125
|
+
|
|
126
|
+
- `codemode` (default): the tools are callable from [`codemode`](usage.md#tools) scripts and listed in the `codemode` tool's description, but are not declared to the model. Large MCP tool lists stay out of the model's tool declarations, and scripts can call several MCP tools, in parallel if needed, while returning only the part of the result the model needs. Pi activates the `codemode` tool when such a server connects. Large servers do not fill the description: declarations share a token budget, and scripts find the remaining tools with `searchTools()` (see [`codemode`](usage.md#tools)).
|
|
127
|
+
- `codemode-deferred`: like `codemode`, but the tools are not listed in the `codemode` tool's description either; it only names the server and its tool count. Scripts call them by name and find them with `searchTools()` or in `ALL_TOOLS`. Use it for large servers that codemode scripts use rarely.
|
|
128
|
+
- `deferred`: the tools are not declared to the model until the [`tool_search`](usage.md#tools) tool loads them. The model searches, and the matches are declared from its next call on and called directly, without codemode. Pi activates the `tool_search` tool when such a server connects. Use it for large servers without codemode.
|
|
129
|
+
- `direct`: the tools are declared to the model like built-in tools, and are also callable from codemode.
|
|
130
|
+
- `hidden`: the tools are registered but cannot be called.
|
|
131
|
+
|
|
132
|
+
`toolExposure` sets the exposure of single tools and overrides `exposure` for them. Keys are tool names as the server offers them, or patterns where `*` matches any characters. An exact name wins over patterns; among patterns, the first match in the object wins. With `hidden` as the server's exposure, only the listed tools are reachable:
|
|
133
|
+
|
|
134
|
+
```json
|
|
135
|
+
{
|
|
136
|
+
"mcpServers": {
|
|
137
|
+
"github": {
|
|
138
|
+
"url": "https://api.githubcopilot.com/mcp/",
|
|
139
|
+
"exposure": "deferred",
|
|
140
|
+
"toolExposure": {
|
|
141
|
+
"search_code": "direct",
|
|
142
|
+
"get_*": "codemode",
|
|
143
|
+
"delete_*": "hidden"
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
`pi mcp list` marks tools whose exposure differs from the server's, and the Tools view in `/mcp` shows it too.
|
|
151
|
+
|
|
152
|
+
Tools that are not declared (`codemode`, `codemode-deferred`, and `deferred` exposure) are reachable through either tool: codemode scripts can call all of them, and `tool_search` can load any of them. For example, with `codemode` active, scripts can call the tools of a `deferred` server, and with `tool_search` active, the model can load the tools of a `codemode` server.
|
|
153
|
+
|
|
154
|
+
Tools called from codemode scripts do not depend on the active tool set, so they stay callable after `/tree`, resume, and fork. Tools loaded by `tool_search` are recorded in the transcript like any other tool change and stay declared on that branch. To keep `codemode` active without MCP servers too, add `"defaultTools": ["+codemode"]` to [settings](settings.md#tools). To keep pi from activating the `codemode` tool, set `"autoEnableCodemode": false` at the top level of `mcp.json`, next to `mcpServers`. A project `mcp.json` value overrides the global one. Pi warns once when neither `codemode` nor `tool_search` is active, since the tools then cannot be called.
|
|
155
|
+
|
|
156
|
+
Text results over 20KB reach the model with the middle cut out, in the format Codex uses: the start and end of the text around a `…N chars truncated…` marker. The full text is saved to a temp file whose path the result names. Codemode scripts always receive the whole result, so a script can filter a large result down to what the model needs.
|
|
157
|
+
|
|
158
|
+
Codemode scripts receive an MCP tool's whole `CallToolResult` (`content` blocks as sent by the server, `structuredContent`, and `isError`), and the `codemode` description declares it as `CallToolResult<T>`. A result with `isError` resolves in scripts and is reported to the model as an error for direct calls. `image(result.content[0])` forwards an image block to the model. The server's `instructions` describe its tools in the `codemode` description.
|
|
159
|
+
|
|
160
|
+
## Resources
|
|
161
|
+
|
|
162
|
+
When a connected server offers [resources](https://modelcontextprotocol.io/specification/2025-11-25/server/resources), pi adds the resource tools Codex and opencode use:
|
|
163
|
+
|
|
164
|
+
- `list_mcp_resources` lists resources as JSON: `{ server?, resources: [{ server, uri, name, ... }], nextCursor? }`. With `server`, it lists one page of that server, and `cursor` continues with the next one. Without, it lists every resource of every server.
|
|
165
|
+
- `list_mcp_resource_templates` lists URI templates for resources the servers do not list, in the same way.
|
|
166
|
+
- `read_mcp_resource` reads a resource given `server` and `uri`. Text resources reach the model as text and images as images; other binary resources are saved to temp files, and the model sees the file path. Scripts receive `{ server, uri, contents }`.
|
|
167
|
+
|
|
168
|
+
The tools reach every enabled server with resources whose exposure is not `hidden`, and take the widest exposure among them: `direct` if one of the servers is direct, else `codemode`, else `codemode-deferred`, else `deferred`. Resource links in tool results name `read_mcp_resource` and the server.
|
|
169
|
+
|
|
170
|
+
Resources for MCP Apps (`ui://` URIs or `text/html;profile=mcp-app`) are left out of the listings, since pi does not render them, and so are resource icons.
|
|
171
|
+
|
|
172
|
+
Reading and listing resources is retried once after a transient HTTP error (408, 429, 5xx). Tool calls are not retried, since the server may have run them.
|
|
173
|
+
|
|
174
|
+
## Permissions
|
|
175
|
+
|
|
176
|
+
Every MCP call goes through pi's tool pipeline, so `tool_call` and `tool_result` extension handlers, including permission gates, apply to MCP tools. Calls made from codemode scripts carry the `codemode` call's id as `parentToolCallId`. `pi.getAllTools()` reports the tool annotations servers declare (`readOnlyHint`, `destructiveHint`, `idempotentHint`, `openWorldHint`), so a permission extension can confirm only calls that change something (see [Extensions](extensions.md#tool-exposure)). The resource tools are marked read-only.
|
|
177
|
+
|
|
178
|
+
## Servers from extensions
|
|
179
|
+
|
|
180
|
+
Extensions can add servers for the current session with `pi.registerMcpServer(name, config)`, using the same config shape as `mcp.json` (see [Extensions](extensions.md#mcp-servers)). They connect like configured servers and appear in `/mcp` with the extension as their source. Enabling, disabling, and exposure changes for them apply to the current session only. A server in `mcp.json` with the same name takes precedence; `/mcp` lists the overridden registration. `pi mcp` shell commands do not load extensions and only see `mcp.json` servers.
|
|
181
|
+
|
|
182
|
+
## Other MCP extensions
|
|
183
|
+
|
|
184
|
+
An installed extension that registers the `/mcp` command, such as `pi-mcp-adapter`, replaces the built-in MCP support: pi then neither reads `mcp.json` in sessions nor connects servers, and `/mcp` belongs to that extension. Remove the extension to use the built-in support. To turn off the built-in support without installing another extension, disable `mcp` under Built-in in `pi config`, or set `"extensions": ["-builtin:mcp"]` in [settings](settings.md#resources); `pi mcp` shell commands still work. Likewise, an extension that registers a tool named `codemode` or `tool_search` replaces the built-in tool of that name. `pi mcp` shell commands always use the built-in support.
|
|
185
|
+
|
|
186
|
+
## SDK
|
|
187
|
+
|
|
188
|
+
SDK sessions do not load the built-in extensions. Add the MCP extension, the codemode extension for `codemode` and `codemode-deferred` servers, and the tool search extension for `deferred` servers to the resource loader. See [SDK](sdk.md#codemode-mcp).
|
package/docs/models.md
CHANGED
|
@@ -673,3 +673,38 @@ For `api: "openai-responses"`, the compatible fields are `supportsDeveloperRole`
|
|
|
673
673
|
The public Pi AI model type also exposes the Responses compatibility shape for `azure-openai-responses` and `openai-codex-responses`. The Azure transport uses `supportsDeveloperRole`, `supportsStrictMode`, and `supportsOpenAIGrammarTools`; the Codex transport uses `supportsStrictMode`, `supportsOpenAIGrammarTools`, and `supportsToolSearch`. Other Responses options do not alter those transports.
|
|
674
674
|
|
|
675
675
|
For `bedrock-converse-stream`, `compat.supportsStrictMode` controls Bedrock strict JSON-schema tool definitions and defaults to `false`. The other built-in API tags do not define model compatibility options.
|
|
676
|
+
|
|
677
|
+
## Use classifier models
|
|
678
|
+
|
|
679
|
+
Classifier models do not chat. They answer typed questions about JSON state: pick one of several choices, answer yes or no, or give a score, each with probabilities. Pi includes TypeSafe's Jev model from these providers:
|
|
680
|
+
|
|
681
|
+
| Provider | Model IDs | Authentication |
|
|
682
|
+
|---|---|---|
|
|
683
|
+
| `typesafe` | `jev-latest` | `TYPESAFE_API_KEY` |
|
|
684
|
+
| `openrouter` | `typesafe/jev-1.13`, `~typesafe/jev-latest` | `OPENROUTER_API_KEY` or `/login` |
|
|
685
|
+
| `cloudflare-workers-ai` | `typesafe/jev` | `CLOUDFLARE_API_KEY` and `CLOUDFLARE_ACCOUNT_ID` |
|
|
686
|
+
| `vercel-ai-gateway` | `typesafe-ai/jev` | `AI_GATEWAY_API_KEY` |
|
|
687
|
+
| `opencode` | `jev-1.13`, `jev-1.13-free` | `OPENCODE_API_KEY` |
|
|
688
|
+
|
|
689
|
+
Chat models on a [llama.cpp router](llama-cpp.md#classification) are also listed as classifier models.
|
|
690
|
+
|
|
691
|
+
Classifier models do not appear in `/model`. The model reaches them through the [`codemode`](usage.md#enable-codemode) tool, which is off unless an MCP server turned it on. Enable it with `"defaultTools": ["+codemode"]` in [settings](settings.md#tools). Scripts then list classifier models with `models.getAvailableOfType("classifier")` and call `models.classify(model, { state, questions })`:
|
|
692
|
+
|
|
693
|
+
```js
|
|
694
|
+
const jev = await models.getModelOfType("classifier", "typesafe", "jev-latest");
|
|
695
|
+
const result = await models.classify(jev, {
|
|
696
|
+
state: { message: "The change works, thanks." },
|
|
697
|
+
questions: {
|
|
698
|
+
approved: {
|
|
699
|
+
type: "bool",
|
|
700
|
+
instructions: "Does the user approve of the result?",
|
|
701
|
+
criteria: { true: "Approval", false: "No approval" },
|
|
702
|
+
},
|
|
703
|
+
},
|
|
704
|
+
});
|
|
705
|
+
return result.answers;
|
|
706
|
+
```
|
|
707
|
+
|
|
708
|
+
When the service reports token counts, as all System One services do, `result.usage` carries them with their cost. Pi adds the usage of a script's classifier calls to the `codemode` tool result, so it counts toward the session cost in the footer and `/session`. The cost uses the model's catalog price; models without one, such as TypeSafe's direct `jev-latest`, report tokens at no cost.
|
|
709
|
+
|
|
710
|
+
Extensions call classifiers through `ctx.modelRegistry.classify()`, without codemode. [Virtual models](virtual-models.md#route-requests) can use them to route requests; see the `jev-router.ts` example.
|
package/docs/packages.md
CHANGED
|
@@ -227,3 +227,7 @@ Packages can appear in both global and project settings. If the same package app
|
|
|
227
227
|
- npm: package name
|
|
228
228
|
- git: repository URL without ref
|
|
229
229
|
- local: resolved absolute path
|
|
230
|
+
|
|
231
|
+
## Built-in extensions and host dependencies
|
|
232
|
+
|
|
233
|
+
`pi config` also manages built-in extensions. Managed npm and git packages suppress automatic installation of host-provided Pi peer dependencies. Declare these as peers, not production dependencies: physical copies can create duplicate classes and registries, and Pi warns about that manifest configuration. Local packages keep their own dependency trees.
|
package/docs/providers.md
CHANGED
|
@@ -323,3 +323,9 @@ When resolving credentials for a provider:
|
|
|
323
323
|
2. `auth.json` entry (API key or OAuth token)
|
|
324
324
|
3. Environment variable
|
|
325
325
|
4. Custom provider keys from `models.json`
|
|
326
|
+
|
|
327
|
+
## OpenAI subscriptions and classifiers
|
|
328
|
+
|
|
329
|
+
`/login openai` offers Sign in with ChatGPT. The older OpenAI Codex provider remains available as OpenAI Codex (legacy), with `gpt-6.1-sol` as its default model. GPT-6.1 Sol is also available through OpenAI and Azure OpenAI.
|
|
330
|
+
|
|
331
|
+
TypeSafe classifier models use `TYPESAFE_API_KEY`; see [Classifier models](models.md#use-classifier-models).
|
package/docs/rpc.md
CHANGED
|
@@ -70,7 +70,7 @@ If the agent is streaming and no `streamingBehavior` is specified, the command r
|
|
|
70
70
|
|
|
71
71
|
Response:
|
|
72
72
|
```json
|
|
73
|
-
{"id": "req-1", "type": "response", "command": "prompt", "success": true}
|
|
73
|
+
{"id": "req-1", "type": "response", "command": "prompt", "success": true, "data": {"disposition": "started"}}
|
|
74
74
|
```
|
|
75
75
|
|
|
76
76
|
`success: true` means the prompt was accepted, queued, or handled immediately. `success: false` means the prompt was rejected before acceptance. Failures after acceptance are reported through the normal event and message stream, not as a second `response` for the same request id.
|
|
@@ -94,7 +94,7 @@ The `images` field is optional. Each image uses `ImageContent` format (same as `
|
|
|
94
94
|
|
|
95
95
|
Response:
|
|
96
96
|
```json
|
|
97
|
-
{"type": "response", "command": "steer", "success": true}
|
|
97
|
+
{"type": "response", "command": "steer", "success": true, "data": {"disposition": "queued"}}
|
|
98
98
|
```
|
|
99
99
|
|
|
100
100
|
See [set_steering_mode](#set_steering_mode) for controlling how steering messages are processed.
|
|
@@ -116,7 +116,7 @@ The `images` field is optional. Each image uses `ImageContent` format (same as `
|
|
|
116
116
|
|
|
117
117
|
Response:
|
|
118
118
|
```json
|
|
119
|
-
{"type": "response", "command": "follow_up", "success": true}
|
|
119
|
+
{"type": "response", "command": "follow_up", "success": true, "data": {"disposition": "queued"}}
|
|
120
120
|
```
|
|
121
121
|
|
|
122
122
|
See [set_follow_up_mode](#set_follow_up_mode) for controlling how follow-up messages are processed.
|
|
@@ -1651,3 +1651,5 @@ process.on("SIGINT", () => {
|
|
|
1651
1651
|
agent.stdin.write(JSON.stringify({ type: "abort" }) + "\n");
|
|
1652
1652
|
});
|
|
1653
1653
|
```
|
|
1654
|
+
|
|
1655
|
+
Successful `prompt` responses include `data.disposition`: `handled`, `queued`, or `started`. `steer` and `follow_up` return `handled` or `queued`. This describes the submitted input, not completion. When an extension handles input, do not wait for a run to settle on its behalf.
|