@humain/terminal 0.0.6 → 0.0.7
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 +52 -0
- package/README.md +10 -4
- package/dist/bundle/chunks/anthropic-messages-GDMGYAZB.js +6 -0
- package/dist/bundle/chunks/anthropic.js +75 -0
- package/dist/bundle/chunks/azure-openai-responses-ZN52D6YC.js +2 -0
- package/dist/bundle/chunks/bedrock-converse-stream.js +77 -0
- package/dist/bundle/chunks/chunk-3D3G2X5U.js +6 -0
- package/dist/bundle/chunks/chunk-3VI4HD7D.js +31 -0
- package/dist/bundle/chunks/chunk-6R7UI4IY.js +2 -0
- package/dist/bundle/chunks/chunk-72KO4OMP.js +2 -0
- package/dist/bundle/chunks/chunk-7DDKXS2Q.js +2 -0
- package/dist/bundle/chunks/chunk-ARF4OE6X.js +105 -0
- package/dist/bundle/chunks/chunk-BOW22LW6.js +42 -0
- package/dist/bundle/chunks/chunk-BZQ53VGE.js +70 -0
- package/dist/bundle/chunks/chunk-CBHC6EL7.js +133 -0
- package/dist/bundle/chunks/chunk-D7XAASZM.js +4 -0
- package/dist/bundle/chunks/chunk-ECWELYBH.js +17 -0
- package/dist/bundle/chunks/chunk-GMWCTUPB.js +2 -0
- package/dist/bundle/chunks/chunk-H2O6VOXT.js +11 -0
- package/dist/bundle/chunks/chunk-HNVPY4LZ.js +5995 -0
- package/dist/bundle/chunks/chunk-JUUC5AZY.js +2 -0
- package/dist/bundle/chunks/chunk-JXWJOIH4.js +2 -0
- package/dist/bundle/chunks/chunk-L2ZPNLYD.js +2 -0
- package/dist/bundle/chunks/chunk-LVVZS2NO.js +12 -0
- package/dist/bundle/chunks/chunk-M2GYSCCG.js +44 -0
- package/dist/bundle/chunks/chunk-MA4UUCYX.js +18 -0
- package/dist/bundle/chunks/chunk-PGXDEOVV.js +2 -0
- package/dist/bundle/chunks/chunk-PJACZCIR.js +2 -0
- package/dist/bundle/chunks/chunk-PRRNXB7S.js +2 -0
- package/dist/bundle/chunks/chunk-SGTGQNNP.js +4 -0
- package/dist/bundle/chunks/chunk-TEPMHNKQ.js +2 -0
- package/dist/bundle/chunks/chunk-TXBQIIIO.js +2 -0
- package/dist/bundle/chunks/chunk-WJZ4KLGL.js +2 -0
- package/dist/bundle/chunks/chunk-XNGRGP62.js +2 -0
- package/dist/bundle/chunks/dist-7DSXV2TY.js +9 -0
- package/dist/bundle/chunks/dist-BXEVYJIO.js +7 -0
- package/dist/bundle/chunks/es-P2KNSZYR.js +9 -0
- package/dist/bundle/chunks/es5-FGTJ7ZFW.js +2 -0
- package/dist/bundle/chunks/event-streams-JOSQQSII.js +2 -0
- package/dist/bundle/chunks/extract-2L7ZVN7F.js +106 -0
- package/dist/bundle/chunks/github-copilot.js +2 -0
- package/dist/bundle/chunks/google-generative-ai-XT7NQJ2E.js +2 -0
- package/dist/bundle/chunks/google-vertex-IDQ6Z53W.js +2 -0
- package/dist/bundle/chunks/image-resize-worker.js +2 -0
- package/dist/bundle/chunks/kimi-coding.js +2 -0
- package/dist/bundle/chunks/mistral-conversations-HHDZ4FHR.js +5 -0
- package/dist/bundle/chunks/multipart-parser-FMGQ7342.js +3 -0
- package/dist/bundle/chunks/node-XY3CBY3C.js +294 -0
- package/dist/bundle/chunks/node-ZHY4LHC7.js +15 -0
- package/dist/bundle/chunks/openai-codex-responses-HRVCDY54.js +8 -0
- package/dist/bundle/chunks/openai-codex.js +75 -0
- package/dist/bundle/chunks/openai-completions-6QBYTBXY.js +7 -0
- package/dist/bundle/chunks/openai-responses-4MWLJHIK.js +2 -0
- package/dist/bundle/chunks/openrouter-images-Y2PCWAQH.js +2 -0
- package/dist/bundle/chunks/openrouter.js +75 -0
- package/dist/bundle/chunks/pdfjs-UKQT3OWY.js +107 -0
- package/dist/bundle/chunks/pi-messages-57K43J6J.js +8 -0
- package/dist/bundle/chunks/promise-J5TGSM32.js +2 -0
- package/dist/bundle/chunks/radius.js +75 -0
- package/dist/bundle/chunks/src-QKGKDFSU.js +4 -0
- package/dist/bundle/chunks/undici-D6ABF53Q.js +2 -0
- package/dist/bundle/chunks/webapi-AFS5FDJJ.js +5 -0
- package/dist/bundle/chunks/xai.js +2 -0
- package/dist/bundle/cli.js +3 -0
- package/dist/bundle/client.js +2 -0
- package/dist/bundle/index.js +2 -0
- package/dist/bundle/rpc-entry.js +3 -0
- package/dist/cli/args.d.ts +1 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +29 -9
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/file-processor.d.ts.map +1 -1
- package/dist/cli/file-processor.js +2 -1
- package/dist/cli/file-processor.js.map +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +19 -11
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session.d.ts +50 -14
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +163 -95
- 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 +6 -7
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +3 -0
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +4 -3
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +41 -32
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/defaults.d.ts +1 -0
- package/dist/core/defaults.d.ts.map +1 -1
- package/dist/core/defaults.js +9 -0
- package/dist/core/defaults.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 +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 +115 -48
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/types.d.ts +38 -9
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js +3 -0
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/footer-data-provider.d.ts +1 -1
- package/dist/core/footer-data-provider.js +1 -1
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/keybindings.d.ts +20 -19
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +26 -5
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/model-config.d.ts +5 -0
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +3 -1
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-resolver.d.ts +1 -0
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +14 -8
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/models-store.d.ts.map +1 -1
- package/dist/core/models-store.js +2 -1
- package/dist/core/models-store.js.map +1 -1
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +22 -14
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/pi-manifest.d.ts.map +1 -1
- package/dist/core/pi-manifest.js +2 -1
- package/dist/core/pi-manifest.js.map +1 -1
- package/dist/core/remote-catalog-provider.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.js +2 -1
- package/dist/core/remote-catalog-provider.js.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +3 -2
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/sdk.d.ts +2 -2
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +10 -3
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-export.d.ts +4 -0
- package/dist/core/session-export.d.ts.map +1 -0
- package/dist/core/session-export.js +32 -0
- package/dist/core/session-export.js.map +1 -0
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +2 -1
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-diagnostics.d.ts +9 -0
- package/dist/core/settings-diagnostics.d.ts.map +1 -0
- package/dist/core/settings-diagnostics.js +21 -0
- package/dist/core/settings-diagnostics.js.map +1 -0
- package/dist/core/settings-manager.d.ts +9 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +51 -10
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +51 -33
- package/dist/core/skills.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +2 -1
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +11 -2
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/bash.d.ts +16 -3
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +62 -29
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit-diff.d.ts +0 -5
- package/dist/core/tools/edit-diff.d.ts.map +1 -1
- package/dist/core/tools/edit-diff.js +2 -5
- package/dist/core/tools/edit-diff.js.map +1 -1
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +20 -4
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/index.d.ts +4 -1
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +19 -1
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/powershell.d.ts +16 -0
- package/dist/core/tools/powershell.d.ts.map +1 -0
- package/dist/core/tools/powershell.js +39 -0
- package/dist/core/tools/powershell.js.map +1 -0
- package/dist/core/tools/subagent.d.ts.map +1 -1
- package/dist/core/tools/subagent.js +4 -1
- package/dist/core/tools/subagent.js.map +1 -1
- package/dist/core/trust-manager.d.ts.map +1 -1
- package/dist/core/trust-manager.js +2 -1
- package/dist/core/trust-manager.js.map +1 -1
- package/dist/extensions/llama/index.d.ts.map +1 -1
- package/dist/extensions/llama/index.js +2 -0
- package/dist/extensions/llama/index.js.map +1 -1
- package/dist/extensions/llama/provider.d.ts.map +1 -1
- package/dist/extensions/llama/provider.js +6 -2
- package/dist/extensions/llama/provider.js.map +1 -1
- package/dist/humain/agent-execution-protocol.d.ts +1 -217
- package/dist/humain/agent-execution-protocol.d.ts.map +1 -1
- package/dist/humain/agent-execution-protocol.js +1 -203
- package/dist/humain/agent-execution-protocol.js.map +1 -1
- package/dist/humain/bedrock-provider/vendor/index.bundle.mjs +107 -16
- package/dist/humain/mcp-adapter/vendor/CHANGELOG.md +82 -0
- package/dist/humain/mcp-adapter/vendor/README.md +47 -15
- package/dist/humain/mcp-adapter/vendor/cli.js +4 -4
- package/dist/humain/mcp-adapter/vendor/commands.ts +5 -3
- package/dist/humain/mcp-adapter/vendor/config.ts +46 -5
- package/dist/humain/mcp-adapter/vendor/direct-tools.ts +103 -92
- package/dist/humain/mcp-adapter/vendor/dist/agent-dir.d.ts +10 -0
- package/dist/humain/mcp-adapter/vendor/dist/agent-dir.js +63 -0
- package/dist/humain/mcp-adapter/vendor/dist/agent-dir.js.map +1 -0
- package/dist/humain/mcp-adapter/vendor/dist/agent-plugin-loader.d.ts +8 -0
- package/dist/humain/mcp-adapter/vendor/dist/agent-plugin-loader.js +356 -0
- package/dist/humain/mcp-adapter/vendor/dist/agent-plugin-loader.js.map +1 -0
- package/dist/humain/mcp-adapter/vendor/dist/config.d.ts +123 -0
- package/dist/humain/mcp-adapter/vendor/dist/config.js +1088 -0
- package/dist/humain/mcp-adapter/vendor/dist/config.js.map +1 -0
- package/dist/humain/mcp-adapter/vendor/dist/mcp-bearer-store.d.ts +24 -0
- package/dist/humain/mcp-adapter/vendor/dist/mcp-bearer-store.js +336 -0
- package/dist/humain/mcp-adapter/vendor/dist/mcp-bearer-store.js.map +1 -0
- package/dist/humain/mcp-adapter/vendor/dist/metadata-cache.d.ts +19 -0
- package/dist/humain/mcp-adapter/vendor/dist/metadata-cache.js +319 -0
- package/dist/humain/mcp-adapter/vendor/dist/metadata-cache.js.map +1 -0
- package/dist/humain/mcp-adapter/vendor/dist/package-mcp-loader.d.ts +2 -0
- package/dist/humain/mcp-adapter/vendor/dist/package-mcp-loader.js +156 -0
- package/dist/humain/mcp-adapter/vendor/dist/package-mcp-loader.js.map +1 -0
- package/dist/humain/mcp-adapter/vendor/dist/resource-tools.d.ts +1 -0
- package/dist/humain/mcp-adapter/vendor/dist/resource-tools.js +15 -0
- package/dist/humain/mcp-adapter/vendor/dist/resource-tools.js.map +1 -0
- package/dist/humain/mcp-adapter/vendor/dist/types.d.ts +566 -0
- package/dist/humain/mcp-adapter/vendor/dist/types.js +287 -0
- package/dist/humain/mcp-adapter/vendor/dist/types.js.map +1 -0
- package/dist/humain/mcp-adapter/vendor/dist/ui-app-bridge-helpers.d.ts +6 -0
- package/dist/humain/mcp-adapter/vendor/dist/ui-app-bridge-helpers.js +37 -0
- package/dist/humain/mcp-adapter/vendor/dist/ui-app-bridge-helpers.js.map +1 -0
- package/dist/humain/mcp-adapter/vendor/dist/ui-stream-types.d.ts +104 -0
- package/dist/humain/mcp-adapter/vendor/dist/ui-stream-types.js +59 -0
- package/dist/humain/mcp-adapter/vendor/dist/ui-stream-types.js.map +1 -0
- package/dist/humain/mcp-adapter/vendor/dist/ui-tool-visibility.d.ts +4 -0
- package/dist/humain/mcp-adapter/vendor/dist/ui-tool-visibility.js +27 -0
- package/dist/humain/mcp-adapter/vendor/dist/ui-tool-visibility.js.map +1 -0
- package/dist/humain/mcp-adapter/vendor/dist/utils.d.ts +32 -0
- package/dist/humain/mcp-adapter/vendor/dist/utils.js +338 -0
- package/dist/humain/mcp-adapter/vendor/dist/utils.js.map +1 -0
- package/dist/humain/mcp-adapter/vendor/failure-backoff.ts +23 -0
- package/dist/humain/mcp-adapter/vendor/index.bundle.mjs +4870 -3878
- package/dist/humain/mcp-adapter/vendor/index.ts +294 -88
- package/dist/humain/mcp-adapter/vendor/init.ts +41 -30
- package/dist/humain/mcp-adapter/vendor/lifecycle.ts +16 -8
- package/dist/humain/mcp-adapter/vendor/mcp-auth-flow.ts +124 -32
- package/dist/humain/mcp-adapter/vendor/mcp-bearer-store.ts +0 -2
- package/dist/humain/mcp-adapter/vendor/mcp-code.ts +2 -0
- package/dist/humain/mcp-adapter/vendor/mcp-oauth-provider.ts +155 -16
- package/dist/humain/mcp-adapter/vendor/mcp-output-guard.ts +95 -7
- package/dist/humain/mcp-adapter/vendor/mcp-probe.ts +18 -4
- package/dist/humain/mcp-adapter/vendor/mcp-references.ts +376 -0
- package/dist/humain/mcp-adapter/vendor/mcp-status.ts +8 -19
- package/dist/humain/mcp-adapter/vendor/metadata-cache.ts +20 -12
- package/dist/humain/mcp-adapter/vendor/namespace-tools.ts +276 -0
- package/dist/humain/mcp-adapter/vendor/package.json +26 -8
- package/dist/humain/mcp-adapter/vendor/proxy-modes.ts +128 -32
- package/dist/humain/mcp-adapter/vendor/request-headers-command.ts +1 -1
- package/dist/humain/mcp-adapter/vendor/search-ranking.ts +2 -0
- package/dist/humain/mcp-adapter/vendor/server-manager.ts +69 -12
- package/dist/humain/mcp-adapter/vendor/state.ts +1 -3
- package/dist/humain/mcp-adapter/vendor/tool-result-renderer.ts +16 -2
- package/dist/humain/mcp-adapter/vendor/types.ts +51 -2
- package/dist/humain/mcp-adapter/vendor/ui-server.ts +3 -19
- package/dist/humain/mcp-adapter/vendor/ui-session.ts +2 -1
- package/dist/humain/mcp-adapter/vendor/utils.ts +21 -19
- package/dist/humain/mcp-adapter.d.ts.map +1 -1
- package/dist/humain/mcp-adapter.js +4 -0
- package/dist/humain/mcp-adapter.js.map +1 -1
- package/dist/humain/web-access/vendor/chrome-cookies.d.ts +14 -0
- package/dist/humain/web-access/vendor/chrome-cookies.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/chrome-cookies.js +85 -33
- package/dist/humain/web-access/vendor/chrome-cookies.js.map +1 -1
- package/dist/humain/web-access/vendor/credential-source.d.ts +1 -1
- package/dist/humain/web-access/vendor/credential-source.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/credential-source.js +3 -1
- package/dist/humain/web-access/vendor/credential-source.js.map +1 -1
- package/dist/humain/web-access/vendor/curator-page.d.ts +2 -29
- package/dist/humain/web-access/vendor/curator-page.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/curator-page.js +10 -1
- package/dist/humain/web-access/vendor/curator-page.js.map +1 -1
- package/dist/humain/web-access/vendor/curator-server.d.ts +2 -29
- package/dist/humain/web-access/vendor/curator-server.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/curator-server.js +4 -0
- package/dist/humain/web-access/vendor/curator-server.js.map +1 -1
- package/dist/humain/web-access/vendor/extract.d.ts +11 -0
- package/dist/humain/web-access/vendor/extract.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/extract.js +163 -20
- package/dist/humain/web-access/vendor/extract.js.map +1 -1
- package/dist/humain/web-access/vendor/fetch-params.d.ts +2 -0
- package/dist/humain/web-access/vendor/fetch-params.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/fetch-params.js +11 -0
- package/dist/humain/web-access/vendor/fetch-params.js.map +1 -1
- package/dist/humain/web-access/vendor/gemini-adc.d.ts +10 -0
- package/dist/humain/web-access/vendor/gemini-adc.d.ts.map +1 -0
- package/dist/humain/web-access/vendor/gemini-adc.js +268 -0
- package/dist/humain/web-access/vendor/gemini-adc.js.map +1 -0
- package/dist/humain/web-access/vendor/gemini-api.d.ts +7 -1
- package/dist/humain/web-access/vendor/gemini-api.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/gemini-api.js +51 -15
- package/dist/humain/web-access/vendor/gemini-api.js.map +1 -1
- package/dist/humain/web-access/vendor/gemini-search.d.ts +9 -4
- package/dist/humain/web-access/vendor/gemini-search.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/gemini-search.js +63 -21
- package/dist/humain/web-access/vendor/gemini-search.js.map +1 -1
- package/dist/humain/web-access/vendor/gemini-url-context.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/gemini-url-context.js +3 -2
- package/dist/humain/web-access/vendor/gemini-url-context.js.map +1 -1
- package/dist/humain/web-access/vendor/gemini-web-config.d.ts +8 -1
- package/dist/humain/web-access/vendor/gemini-web-config.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/gemini-web-config.js +49 -4
- package/dist/humain/web-access/vendor/gemini-web-config.js.map +1 -1
- package/dist/humain/web-access/vendor/gemini-web.d.ts +2 -1
- package/dist/humain/web-access/vendor/gemini-web.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/gemini-web.js +8 -3
- package/dist/humain/web-access/vendor/gemini-web.js.map +1 -1
- package/dist/humain/web-access/vendor/github-api.d.ts +1 -1
- package/dist/humain/web-access/vendor/github-api.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/github-api.js +6 -4
- package/dist/humain/web-access/vendor/github-api.js.map +1 -1
- package/dist/humain/web-access/vendor/github-extract.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/github-extract.js +50 -3
- package/dist/humain/web-access/vendor/github-extract.js.map +1 -1
- package/dist/humain/web-access/vendor/github-issue-pr.d.ts +27 -0
- package/dist/humain/web-access/vendor/github-issue-pr.d.ts.map +1 -0
- package/dist/humain/web-access/vendor/github-issue-pr.js +701 -0
- package/dist/humain/web-access/vendor/github-issue-pr.js.map +1 -0
- package/dist/humain/web-access/vendor/index.d.ts +3 -31
- package/dist/humain/web-access/vendor/index.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/index.js +643 -530
- package/dist/humain/web-access/vendor/index.js.map +1 -1
- package/dist/humain/web-access/vendor/kimi-search.d.ts +5 -0
- package/dist/humain/web-access/vendor/kimi-search.d.ts.map +1 -0
- package/dist/humain/web-access/vendor/kimi-search.js +228 -0
- package/dist/humain/web-access/vendor/kimi-search.js.map +1 -0
- package/dist/humain/web-access/vendor/openai-search.d.ts +3 -0
- package/dist/humain/web-access/vendor/openai-search.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/openai-search.js +89 -16
- package/dist/humain/web-access/vendor/openai-search.js.map +1 -1
- package/dist/humain/web-access/vendor/page-query.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/page-query.js +56 -8
- package/dist/humain/web-access/vendor/page-query.js.map +1 -1
- package/dist/humain/web-access/vendor/ssrf-protection.js +6 -1
- package/dist/humain/web-access/vendor/ssrf-protection.js.map +1 -1
- package/dist/humain/web-access/vendor/utils.d.ts +12 -0
- package/dist/humain/web-access/vendor/utils.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/utils.js +343 -1
- package/dist/humain/web-access/vendor/utils.js.map +1 -1
- package/dist/humain/web-access/vendor/xcrawl.d.ts +4 -0
- package/dist/humain/web-access/vendor/xcrawl.d.ts.map +1 -0
- package/dist/humain/web-access/vendor/xcrawl.js +251 -0
- package/dist/humain/web-access/vendor/xcrawl.js.map +1 -0
- package/dist/humain/web-access/vendor/youtube-extract.js +2 -2
- package/dist/humain/web-access/vendor/youtube-extract.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts +3 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +17 -14
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +4 -3
- package/dist/migrations.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts +9 -3
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +53 -10
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +7 -2
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +118 -55
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-submenu.d.ts +72 -0
- package/dist/modes/interactive/components/settings-submenu.d.ts.map +1 -0
- package/dist/modes/interactive/components/settings-submenu.js +151 -0
- package/dist/modes/interactive/components/settings-submenu.js.map +1 -0
- package/dist/modes/interactive/components/thinking-selector.d.ts +15 -3
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +68 -17
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/external-editor.d.ts.map +1 -1
- package/dist/modes/interactive/external-editor.js +2 -1
- package/dist/modes/interactive/external-editor.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +11 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +176 -106
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/session-share.d.ts +16 -0
- package/dist/modes/interactive/session-share.d.ts.map +1 -0
- package/dist/modes/interactive/session-share.js +188 -0
- package/dist/modes/interactive/session-share.js.map +1 -0
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +6 -5
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/json-event.d.ts +16 -13
- package/dist/modes/json-event.d.ts.map +1 -1
- package/dist/modes/json-event.js +20 -6
- package/dist/modes/json-event.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +3 -2
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +2 -7
- 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 +1 -0
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +189 -3
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/utils/changelog.d.ts +1 -1
- package/dist/utils/changelog.d.ts.map +1 -1
- package/dist/utils/changelog.js +12 -2
- package/dist/utils/changelog.js.map +1 -1
- package/dist/utils/frontmatter.d.ts.map +1 -1
- package/dist/utils/frontmatter.js +2 -1
- package/dist/utils/frontmatter.js.map +1 -1
- package/dist/utils/management-http.d.ts +5 -3
- package/dist/utils/management-http.d.ts.map +1 -1
- package/dist/utils/management-http.js +14 -10
- package/dist/utils/management-http.js.map +1 -1
- package/dist/utils/shell.d.ts +3 -0
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +17 -5
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/syntax-highlight.d.ts +1 -0
- package/dist/utils/syntax-highlight.d.ts.map +1 -1
- package/dist/utils/syntax-highlight.js +64 -1
- package/dist/utils/syntax-highlight.js.map +1 -1
- package/dist/utils/text.d.ts +8 -0
- package/dist/utils/text.d.ts.map +1 -0
- package/dist/utils/text.js +9 -0
- package/dist/utils/text.js.map +1 -0
- package/dist/utils/version-check.js +4 -4
- package/dist/utils/version-check.js.map +1 -1
- package/docs/compaction.md +15 -0
- package/docs/custom-provider.md +5 -2
- package/docs/environment-variables.md +7 -7
- package/docs/extensions.md +17 -7
- package/docs/json.md +7 -2
- package/docs/keybindings.md +8 -8
- package/docs/llama-cpp.md +2 -0
- package/docs/models.md +8 -2
- package/docs/packages.md +2 -2
- package/docs/rpc.md +9 -3
- package/docs/sdk.md +7 -2
- package/docs/settings.md +11 -3
- package/docs/skills.md +3 -2
- package/docs/terminal-setup.md +8 -0
- package/docs/usage.md +10 -7
- package/docs/windows.md +15 -1
- package/examples/extensions/border-status-editor.ts +1 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +70 -8
- package/examples/extensions/custom-provider-anthropic/package.json +2 -2
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/git-checkpoint.ts +2 -2
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/notify.ts +3 -1
- package/examples/extensions/sandbox/package-lock.json +14 -40
- package/examples/extensions/sandbox/package.json +2 -2
- package/examples/extensions/titlebar-spinner.ts +1 -1
- package/examples/extensions/with-deps/package-lock.json +4 -4
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/rpc-extension-ui.ts +1 -1
- package/examples/sdk/06-extensions.ts +1 -1
- package/examples/sdk/README.md +1 -1
- package/npm-shrinkwrap.json +293 -221
- package/package.json +21 -18
- package/src/humain/mcp-adapter/UPSTREAM.md +15 -5
- package/src/humain/mcp-adapter/upstream.json +4 -3
- package/src/humain/mcp-adapter/vendor/CHANGELOG.md +82 -0
- package/src/humain/web-access/UPSTREAM.md +1 -1
- package/src/humain/web-access/upstream.json +6 -4
|
@@ -42,6 +42,16 @@ export const KNOWN_SERVER_PRESETS: readonly KnownServerPreset[] = [
|
|
|
42
42
|
summary: "Look up current library documentation and examples.",
|
|
43
43
|
entry: { url: "https://mcp.context7.com/mcp", protocolVersion: "auto" },
|
|
44
44
|
},
|
|
45
|
+
{
|
|
46
|
+
id: "parallel-search",
|
|
47
|
+
name: "Parallel Search",
|
|
48
|
+
summary: "Search the web and fetch pages without an API key.",
|
|
49
|
+
entry: {
|
|
50
|
+
url: "https://search.parallel.ai/mcp",
|
|
51
|
+
protocolVersion: "auto",
|
|
52
|
+
directTools: true,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
45
55
|
{
|
|
46
56
|
id: "notion",
|
|
47
57
|
name: "Notion",
|
|
@@ -190,6 +200,7 @@ export function getConfigDiscoveryPaths(overridePath?: string, cwd = process.cwd
|
|
|
190
200
|
}
|
|
191
201
|
|
|
192
202
|
export function findAvailableImportConfigs(cwd = process.cwd()): DiscoveredImportConfig[] {
|
|
203
|
+
if (isExclusiveConfigMode()) return [];
|
|
193
204
|
const discovered: DiscoveredImportConfig[] = [];
|
|
194
205
|
|
|
195
206
|
for (const importKind of Object.keys(IMPORT_PATHS) as ImportKind[]) {
|
|
@@ -235,8 +246,11 @@ export function getMcpDiscoverySummary(
|
|
|
235
246
|
const sources = getConfigSourceSummaries(sourceSpecs);
|
|
236
247
|
const includeHostConfigs = options.includeHostConfigs !== false;
|
|
237
248
|
|
|
249
|
+
const importKinds = isExclusiveConfigMode()
|
|
250
|
+
? (readValidatedConfig(getEffectivePiGlobalConfigPath(overridePath), "MCP exclusive config")?.imports ?? [])
|
|
251
|
+
: (Object.keys(IMPORT_PATHS) as ImportKind[]);
|
|
238
252
|
const imports = includeHostConfigs
|
|
239
|
-
?
|
|
253
|
+
? importKinds
|
|
240
254
|
.map((kind) => {
|
|
241
255
|
const imported = loadImportedConfig(kind, cwd, `Failed to inspect imported MCP config from ${kind}:`);
|
|
242
256
|
if (!imported) return null;
|
|
@@ -248,10 +262,14 @@ export function getMcpDiscoverySummary(
|
|
|
248
262
|
})
|
|
249
263
|
.filter((value): value is ImportConfigSummary => value !== null)
|
|
250
264
|
: [];
|
|
251
|
-
const hostConfigDiscovery =
|
|
265
|
+
const hostConfigDiscovery = isExclusiveConfigMode()
|
|
266
|
+
? "off"
|
|
267
|
+
: getConfiguredHostConfigDiscovery(overridePath, cwd);
|
|
252
268
|
const hostConfigs = imports.map((entry) => ({ ...entry, active: hostConfigDiscovery === "on" }));
|
|
253
269
|
const settings = getMergedSettings(overridePath, cwd);
|
|
254
|
-
const agentPlugins =
|
|
270
|
+
const agentPlugins = isExclusiveConfigMode()
|
|
271
|
+
? []
|
|
272
|
+
: getAgentPluginSummaries(settings?.agentPluginPaths, cwd);
|
|
255
273
|
const totalServerCount = sources.reduce((sum, source) => sum + source.serverCount, 0) + agentPlugins.reduce((sum, plugin) => sum + plugin.serverCount, 0);
|
|
256
274
|
const hasSharedServers = sources.some((source) => source.kind === "shared" && source.serverCount > 0) || agentPlugins.some(plugin => plugin.serverCount > 0);
|
|
257
275
|
const hasPiOwnedServers = sources.some((source) => source.kind === "pi" && source.serverCount > 0);
|
|
@@ -297,7 +315,7 @@ export function loadMcpConfig(overridePath?: string, cwd = process.cwd()): McpCo
|
|
|
297
315
|
// Host files are a lower-precedence fallback. This ordering means an opt-in
|
|
298
316
|
// discovery cannot override a shared or Pi-owned definition, and all normal
|
|
299
317
|
// URL-bound credential stripping remains in mergeServerMaps.
|
|
300
|
-
let config: McpConfig = hostConfigDiscovery === "on"
|
|
318
|
+
let config: McpConfig = !isExclusiveConfigMode() && hostConfigDiscovery === "on"
|
|
301
319
|
? loadDiscoveredHostConfigs(cwd)
|
|
302
320
|
: { mcpServers: {} };
|
|
303
321
|
|
|
@@ -307,6 +325,8 @@ export function loadMcpConfig(overridePath?: string, cwd = process.cwd()): McpCo
|
|
|
307
325
|
config = mergeConfigs(config, expandImports(loaded, cwd));
|
|
308
326
|
}
|
|
309
327
|
|
|
328
|
+
if (isExclusiveConfigMode()) return config;
|
|
329
|
+
|
|
310
330
|
const packageConfig = loadPackageMcpConfigs(cwd);
|
|
311
331
|
const pluginConfig = loadAgentPluginConfigs(config.settings?.agentPluginPaths, cwd);
|
|
312
332
|
const packageServers = Object.fromEntries(
|
|
@@ -392,11 +412,23 @@ function getConfigConflicts(
|
|
|
392
412
|
}
|
|
393
413
|
|
|
394
414
|
function getConfigSources(overridePath?: string, cwd = process.cwd()): ConfigSourceSpec[] {
|
|
395
|
-
const userPath =
|
|
415
|
+
const userPath = getEffectivePiGlobalConfigPath(overridePath);
|
|
396
416
|
const projectPath = getProjectConfigPath(cwd);
|
|
397
417
|
const projectPiPath = getProjectPiConfigPath(cwd);
|
|
398
418
|
const sources: ConfigSourceSpec[] = [];
|
|
399
419
|
|
|
420
|
+
if (isExclusiveConfigMode()) {
|
|
421
|
+
return [{
|
|
422
|
+
id: "pi-global",
|
|
423
|
+
label: "Pi exclusive config",
|
|
424
|
+
readPath: userPath,
|
|
425
|
+
writePath: userPath,
|
|
426
|
+
kind: "user",
|
|
427
|
+
shared: false,
|
|
428
|
+
scope: "global",
|
|
429
|
+
}];
|
|
430
|
+
}
|
|
431
|
+
|
|
400
432
|
if (GENERIC_GLOBAL_CONFIG_PATH !== userPath) {
|
|
401
433
|
sources.push({
|
|
402
434
|
id: "shared-global",
|
|
@@ -461,6 +493,14 @@ function getConfigSources(overridePath?: string, cwd = process.cwd()): ConfigSou
|
|
|
461
493
|
return sources;
|
|
462
494
|
}
|
|
463
495
|
|
|
496
|
+
function isExclusiveConfigMode(): boolean {
|
|
497
|
+
return process.env.PI_MCP_CONFIG_MODE?.trim().toLowerCase() === "exclusive";
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
function getEffectivePiGlobalConfigPath(overridePath?: string): string {
|
|
501
|
+
return getPiGlobalConfigPath(isExclusiveConfigMode() ? undefined : overridePath);
|
|
502
|
+
}
|
|
503
|
+
|
|
464
504
|
function mergeConfigs(base: McpConfig, next: McpConfig): McpConfig {
|
|
465
505
|
const imports = mergeImports(base.imports, next.imports);
|
|
466
506
|
const settings = next.settings ? { ...base.settings, ...next.settings } : base.settings;
|
|
@@ -805,6 +845,7 @@ function extractServers(config: unknown, kind: ImportKind): Record<string, Serve
|
|
|
805
845
|
...(typeof oauth.clientId === "string" ? { clientId: oauth.clientId } : {}),
|
|
806
846
|
...(typeof oauth.clientSecret === "string" ? { clientSecret: oauth.clientSecret } : {}),
|
|
807
847
|
...(typeof oauth.scope === "string" ? { scope: oauth.scope } : {}),
|
|
848
|
+
...(typeof oauth.authServerMetadataUrl === "string" ? { authServerMetadataUrl: oauth.authServerMetadataUrl } : {}),
|
|
808
849
|
...(typeof oauth.skipIssuerMetadataValidation === "boolean"
|
|
809
850
|
? { skipIssuerMetadataValidation: oauth.skipIssuerMetadataValidation }
|
|
810
851
|
: {}),
|
|
@@ -15,16 +15,16 @@ import { createToolSelectorCandidateIndex, formatToolName, getToolNameCandidates
|
|
|
15
15
|
import { isUiToolVisibleToModel } from "./ui-tool-visibility.ts";
|
|
16
16
|
import { resourceNameToToolName } from "./resource-tools.ts";
|
|
17
17
|
import { authenticate, supportsOAuth } from "./mcp-auth-flow.ts";
|
|
18
|
-
import { formatAuthRequiredMessage, normalizeToolArguments, resolveServerUrl
|
|
18
|
+
import { formatAuthRequiredMessage, normalizeToolArguments, resolveServerUrl } from "./utils.ts";
|
|
19
19
|
import { SessionRecoveryAuthRequiredError, withSessionRecovery } from "./session-recovery.ts";
|
|
20
20
|
import { combineAbortSignals, isAbortError } from "./runtime-owner.ts";
|
|
21
21
|
import { ensureToolCallApproved } from "./tool-approval.ts";
|
|
22
|
+
import { Check, Errors } from "typebox/value";
|
|
22
23
|
|
|
23
24
|
type ClientCallToolResult = Awaited<ReturnType<Client["callTool"]>>;
|
|
24
25
|
type ClientReadResourceResult = Awaited<ReturnType<Client["readResource"]>>;
|
|
25
26
|
|
|
26
27
|
const BUILTIN_NAMES = new Set(["read", "bash", "edit", "write", "grep", "find", "ls", "mcp"]);
|
|
27
|
-
const INSTRUCTIONS_SNIPPET_LENGTH = 150;
|
|
28
28
|
export const DIRECT_TOOLS_ADVISORY_THRESHOLD = 75;
|
|
29
29
|
|
|
30
30
|
type DirectAutoAuthResult =
|
|
@@ -32,6 +32,58 @@ type DirectAutoAuthResult =
|
|
|
32
32
|
| { status: "success" }
|
|
33
33
|
| { status: "failed"; message: string };
|
|
34
34
|
|
|
35
|
+
/**
|
|
36
|
+
* Recover one model-emitted JSON layer for schema-declared object and array
|
|
37
|
+
* properties, then validate the complete input against the same schema.
|
|
38
|
+
*/
|
|
39
|
+
export function prepareDirectToolArguments(inputSchema: unknown, args: unknown): unknown {
|
|
40
|
+
if (!inputSchema || typeof inputSchema !== "object" || Array.isArray(inputSchema)) return args;
|
|
41
|
+
const schema = inputSchema as Record<string, unknown>;
|
|
42
|
+
if (schema.type !== "object") return args;
|
|
43
|
+
const input = args && typeof args === "object" && !Array.isArray(args)
|
|
44
|
+
? args as Record<string, unknown>
|
|
45
|
+
: null;
|
|
46
|
+
const properties = schema.properties;
|
|
47
|
+
let prepared: Record<string, unknown> | undefined;
|
|
48
|
+
|
|
49
|
+
if (input && properties && typeof properties === "object" && !Array.isArray(properties)) {
|
|
50
|
+
for (const [name, propertySchema] of Object.entries(properties)) {
|
|
51
|
+
if (!Object.hasOwn(input, name) || typeof input[name] !== "string"
|
|
52
|
+
|| !propertySchema || typeof propertySchema !== "object" || Array.isArray(propertySchema)) continue;
|
|
53
|
+
const expectedType = (propertySchema as Record<string, unknown>).type;
|
|
54
|
+
if (expectedType !== "object" && expectedType !== "array") continue;
|
|
55
|
+
try {
|
|
56
|
+
const parsed: unknown = JSON.parse(input[name] as string);
|
|
57
|
+
const matches = expectedType === "array"
|
|
58
|
+
? Array.isArray(parsed)
|
|
59
|
+
: parsed !== null && typeof parsed === "object" && !Array.isArray(parsed);
|
|
60
|
+
if (matches) {
|
|
61
|
+
prepared ??= { ...input };
|
|
62
|
+
prepared[name] = parsed;
|
|
63
|
+
}
|
|
64
|
+
} catch {
|
|
65
|
+
// Validation below reports malformed or shape-incompatible values.
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const candidate = prepared ?? args;
|
|
71
|
+
if (!Check(inputSchema as never, candidate)) {
|
|
72
|
+
const errors = Errors(inputSchema as never, candidate);
|
|
73
|
+
const issues = errors.slice(0, 8).map((error) => ({
|
|
74
|
+
instancePath: error.instancePath || "/",
|
|
75
|
+
keyword: error.keyword,
|
|
76
|
+
message: error.message,
|
|
77
|
+
}));
|
|
78
|
+
throw new TypeError(`MCP direct tool arguments do not match the advertised input schema: ${JSON.stringify({
|
|
79
|
+
issues,
|
|
80
|
+
total: errors.length,
|
|
81
|
+
truncated: errors.length > issues.length,
|
|
82
|
+
})}`);
|
|
83
|
+
}
|
|
84
|
+
return candidate;
|
|
85
|
+
}
|
|
86
|
+
|
|
35
87
|
function getDirectAuthRequiredMessage(
|
|
36
88
|
state: McpExtensionState,
|
|
37
89
|
serverName: string,
|
|
@@ -117,6 +169,8 @@ export function resolveDirectTools(
|
|
|
117
169
|
cache: MetadataCache | null,
|
|
118
170
|
prefix: ToolPrefix,
|
|
119
171
|
envOverride?: string[],
|
|
172
|
+
unavailableServers: ReadonlySet<string> = new Set(),
|
|
173
|
+
reservedNames?: Set<string>,
|
|
120
174
|
): DirectToolSpec[] {
|
|
121
175
|
const specs: DirectToolSpec[] = [];
|
|
122
176
|
if (!cache) return specs;
|
|
@@ -224,82 +278,33 @@ export function resolveDirectTools(
|
|
|
224
278
|
}
|
|
225
279
|
}
|
|
226
280
|
|
|
227
|
-
|
|
228
|
-
|
|
281
|
+
for (const spec of specs) reservedNames?.add(spec.prefixedName);
|
|
282
|
+
|
|
283
|
+
const emittedSpecs = unavailableServers.size === 0
|
|
284
|
+
? specs
|
|
285
|
+
: specs.filter((spec) => !unavailableServers.has(spec.serverName));
|
|
286
|
+
|
|
287
|
+
if (config.settings?.warnOnLargeDirectTools !== false && emittedSpecs.length >= DIRECT_TOOLS_ADVISORY_THRESHOLD) {
|
|
288
|
+
console.warn(`MCP: ${emittedSpecs.length} direct tools resolved. Each direct tool adds prompt context; README guidance recommends targeted sets of 5-20 tools and using the proxy or an explicit string[] when 75+ direct tools would be registered. Set settings.warnOnLargeDirectTools to false to hide this advisory.`);
|
|
229
289
|
}
|
|
230
290
|
|
|
231
|
-
return
|
|
291
|
+
return emittedSpecs;
|
|
232
292
|
}
|
|
233
293
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
)
|
|
239
|
-
|
|
294
|
+
/**
|
|
295
|
+
* Pure function of config: the description must stay byte-stable across
|
|
296
|
+
* runtime metadata changes (tool counts, instructions, connection state) so
|
|
297
|
+
* re-registering the proxy tool never rewrites the cached prompt prefix.
|
|
298
|
+
* Live counts/status belong to `mcp({ })`, full instructions to
|
|
299
|
+
* `mcp({ instructions })`.
|
|
300
|
+
*/
|
|
301
|
+
export function buildProxyDescription(config: McpConfig): string {
|
|
240
302
|
let desc = `MCP gateway — server status, tool search/describe, auth, and single MCP tool calls. When one request needs several MCP calls with logic between them, use mcpScript. Non-MCP Pi tools should be called directly, not through mcp.\n`;
|
|
241
303
|
|
|
242
|
-
const
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
if (directByServer.size > 0) {
|
|
247
|
-
const parts = [...directByServer.entries()].map(
|
|
248
|
-
([server, count]) => `${server} (${count})`,
|
|
249
|
-
);
|
|
250
|
-
desc += `\nDirect tools available (call as normal tools): ${parts.join(", ")}\n`;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
const serverSummaries: string[] = [];
|
|
254
|
-
for (const serverName of Object.keys(config.mcpServers)) {
|
|
255
|
-
const definition = config.mcpServers[serverName];
|
|
256
|
-
if (!definition || isServerDisabled(definition)) continue;
|
|
257
|
-
const cachedEntry = cache?.servers?.[serverName];
|
|
258
|
-
const entry = cachedEntry && isServerCacheValid(cachedEntry, definition) ? cachedEntry : undefined;
|
|
259
|
-
const effectivePrefix = resolveToolPrefix(definition, prefix);
|
|
260
|
-
const hasToolFilters =
|
|
261
|
-
(Array.isArray(definition.includeTools) && definition.includeTools.length > 0) ||
|
|
262
|
-
(Array.isArray(definition.excludeTools) && definition.excludeTools.length > 0);
|
|
263
|
-
const selectorCandidateIndex = hasToolFilters && cache ? (() => {
|
|
264
|
-
const candidates = new Set<string>();
|
|
265
|
-
for (const [otherServerName, otherDefinition] of Object.entries(config.mcpServers)) {
|
|
266
|
-
const otherEntry = cache.servers[otherServerName];
|
|
267
|
-
if (!otherEntry || !isServerCacheValid(otherEntry, otherDefinition) || isServerDisabled(otherDefinition)) continue;
|
|
268
|
-
const otherPrefix = resolveToolPrefix(otherDefinition, prefix);
|
|
269
|
-
for (const otherTool of otherEntry.tools ?? []) {
|
|
270
|
-
if (!isUiToolVisibleToModel(otherTool.uiVisibility)) continue;
|
|
271
|
-
for (const candidate of getToolNameCandidates(otherTool.name, otherServerName, otherPrefix, false)) candidates.add(candidate);
|
|
272
|
-
}
|
|
273
|
-
if (otherDefinition.exposeResources !== false) {
|
|
274
|
-
for (const resource of otherEntry.resources ?? []) {
|
|
275
|
-
const baseName = `read_${resourceNameToToolName(resource.name)}`;
|
|
276
|
-
for (const candidate of getToolNameCandidates(baseName, otherServerName, otherPrefix, false)) candidates.add(candidate);
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
return createToolSelectorCandidateIndex(candidates);
|
|
281
|
-
})() : undefined;
|
|
282
|
-
const toolCount = (entry?.tools ?? []).filter(
|
|
283
|
-
(tool) => isUiToolVisibleToModel(tool.uiVisibility)
|
|
284
|
-
&& isToolAllowed(tool.name, serverName, effectivePrefix, definition.includeTools, definition.excludeTools, selectorCandidateIndex),
|
|
285
|
-
).length;
|
|
286
|
-
const resourceCount = definition?.exposeResources !== false
|
|
287
|
-
? (entry?.resources ?? []).filter((resource) => {
|
|
288
|
-
const baseName = `read_${resourceNameToToolName(resource.name)}`;
|
|
289
|
-
return isToolAllowed(baseName, serverName, effectivePrefix, definition.includeTools, definition.excludeTools, selectorCandidateIndex);
|
|
290
|
-
}).length
|
|
291
|
-
: 0;
|
|
292
|
-
const totalItems = toolCount + resourceCount;
|
|
293
|
-
if (totalItems === 0) continue;
|
|
294
|
-
const directCount = directByServer.get(serverName) ?? 0;
|
|
295
|
-
const proxyCount = totalItems - directCount;
|
|
296
|
-
if (proxyCount > 0) {
|
|
297
|
-
serverSummaries.push(`${serverName} (${proxyCount} tools)`);
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
if (serverSummaries.length > 0) {
|
|
302
|
-
desc += `\nServers: ${serverSummaries.join(", ")}\n`;
|
|
304
|
+
const serverNames = Object.keys(config.mcpServers)
|
|
305
|
+
.filter((serverName) => !isServerDisabled(config.mcpServers[serverName]));
|
|
306
|
+
if (serverNames.length > 0) {
|
|
307
|
+
desc += `\nServers: ${serverNames.join(", ")}\n`;
|
|
303
308
|
}
|
|
304
309
|
|
|
305
310
|
const disabledServers = Object.entries(config.mcpServers)
|
|
@@ -309,22 +314,8 @@ export function buildProxyDescription(
|
|
|
309
314
|
desc += `\nDisabled servers (enable with /mcp enable <server> and /reload): ${disabledServers.join(", ")}\n`;
|
|
310
315
|
}
|
|
311
316
|
|
|
312
|
-
const instructionSummaries: string[] = [];
|
|
313
|
-
for (const serverName of Object.keys(config.mcpServers)) {
|
|
314
|
-
if (isServerDisabled(config.mcpServers[serverName])) continue;
|
|
315
|
-
const definition = config.mcpServers[serverName];
|
|
316
|
-
const entry = definition && cache?.servers?.[serverName];
|
|
317
|
-
const instructions = entry && definition && isServerCacheValid(entry, definition) ? entry.instructions : undefined;
|
|
318
|
-
if (!instructions) continue;
|
|
319
|
-
const snippet = truncateAtWord(instructions.replace(/\s+/g, " ").trim(), INSTRUCTIONS_SNIPPET_LENGTH);
|
|
320
|
-
instructionSummaries.push(` ${serverName}: ${snippet}`);
|
|
321
|
-
}
|
|
322
|
-
if (instructionSummaries.length > 0) {
|
|
323
|
-
desc += `\nServer instructions (truncated - full text via mcp({ instructions: "name" })):\n${instructionSummaries.join("\n")}\n`;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
317
|
desc += `\nUsage:\n`;
|
|
327
|
-
desc += ` mcp({ }) → Show server status\n`;
|
|
318
|
+
desc += ` mcp({ }) → Show server status and tool counts\n`;
|
|
328
319
|
desc += ` mcp({ server: "name" }) → List tools from server\n`;
|
|
329
320
|
desc += ` mcp({ search: "query" }) → Search MCP tools by name/description\n`;
|
|
330
321
|
desc += ` mcp({ describe: "tool_name" }) → Show tool details and parameters\n`;
|
|
@@ -498,7 +489,10 @@ export function createDirectToolExecutor(
|
|
|
498
489
|
(conn) => conn.client.readResource({ uri: spec.resourceUri! }, requestOptions),
|
|
499
490
|
);
|
|
500
491
|
const content = transformMcpResourceContents(result.contents ?? [], state.owner?.signal);
|
|
501
|
-
const guarded = await guardMcpOutput(content.length > 0 ? content : [{ type: "text" as const, text: "(empty resource)" }],
|
|
492
|
+
const guarded = await guardMcpOutput(content.length > 0 ? content : [{ type: "text" as const, text: "(empty resource)" }], {
|
|
493
|
+
...outputGuardOptions,
|
|
494
|
+
...(state.config.settings?.directToolResultDetails === "bounded" ? { rawMcpResult: result } : {}),
|
|
495
|
+
});
|
|
502
496
|
return {
|
|
503
497
|
content: guarded.content,
|
|
504
498
|
details: { server: spec.serverName, resourceUri: spec.resourceUri, ...guardedMcpDetails(guarded) },
|
|
@@ -539,7 +533,13 @@ export function createDirectToolExecutor(
|
|
|
539
533
|
const content = transformMcpContent(mcpContent, state.owner?.signal);
|
|
540
534
|
const outputContent = content.length > 0 ? content : [{ type: "text" as const, text: "(empty result)" }];
|
|
541
535
|
const schemaText = spec.inputSchema ? `\n\nExpected parameters:\n${formatSchema(spec.inputSchema)}` : "";
|
|
542
|
-
const guarded = await guardMcpOutput(outputContent, {
|
|
536
|
+
const guarded = await guardMcpOutput(outputContent, {
|
|
537
|
+
...outputGuardOptions,
|
|
538
|
+
prefix: "Error: ",
|
|
539
|
+
suffix: schemaText,
|
|
540
|
+
emptyTextFallback: "Tool execution failed",
|
|
541
|
+
...(state.config.settings?.directToolResultDetails === "bounded" ? { rawMcpResult: result } : {}),
|
|
542
|
+
});
|
|
543
543
|
return {
|
|
544
544
|
content: guarded.content,
|
|
545
545
|
details: { error: "tool_error", server: spec.serverName, ...guardedMcpDetails(guarded) },
|
|
@@ -550,7 +550,11 @@ export function createDirectToolExecutor(
|
|
|
550
550
|
const outputContent = content.length > 0 ? content : [{ type: "text" as const, text: "(empty result)" }];
|
|
551
551
|
if (hasUi) {
|
|
552
552
|
const uiSummary = summarizeUiSessionResult(uiSession);
|
|
553
|
-
const guarded = await guardMcpOutput(outputContent, {
|
|
553
|
+
const guarded = await guardMcpOutput(outputContent, {
|
|
554
|
+
...outputGuardOptions,
|
|
555
|
+
suffix: `\n\n${uiSummary.message}`,
|
|
556
|
+
...(state.config.settings?.directToolResultDetails === "bounded" ? { rawMcpResult: result } : {}),
|
|
557
|
+
});
|
|
554
558
|
return {
|
|
555
559
|
content: guarded.content,
|
|
556
560
|
details: {
|
|
@@ -564,7 +568,10 @@ export function createDirectToolExecutor(
|
|
|
564
568
|
};
|
|
565
569
|
}
|
|
566
570
|
|
|
567
|
-
const guarded = await guardMcpOutput(outputContent, {
|
|
571
|
+
const guarded = await guardMcpOutput(outputContent, {
|
|
572
|
+
...outputGuardOptions,
|
|
573
|
+
...(state.config.settings?.directToolResultDetails === "bounded" ? { rawMcpResult: result } : {}),
|
|
574
|
+
});
|
|
568
575
|
return {
|
|
569
576
|
content: guarded.content,
|
|
570
577
|
details: { server: spec.serverName, tool: spec.originalName, ...guardedMcpDetails(guarded) },
|
|
@@ -590,12 +597,16 @@ export function createDirectToolExecutor(
|
|
|
590
597
|
};
|
|
591
598
|
}
|
|
592
599
|
const message = error instanceof Error ? error.message : String(error);
|
|
600
|
+
const aborted = isAbortError(error, ownedSignal);
|
|
601
|
+
if (!aborted) {
|
|
602
|
+
await state.manager.close(spec.serverName).catch(() => {});
|
|
603
|
+
}
|
|
593
604
|
uiSession?.sendToolCancelled(message);
|
|
594
605
|
const schemaText = spec.inputSchema ? `\n\nExpected parameters:\n${formatSchema(spec.inputSchema)}` : "";
|
|
595
606
|
const guarded = await guardMcpOutput([{ type: "text" as const, text: message }], { ...outputGuardOptions, prefix: "Failed to call tool: ", suffix: schemaText });
|
|
596
607
|
return {
|
|
597
608
|
content: guarded.content,
|
|
598
|
-
details: { error:
|
|
609
|
+
details: { error: aborted ? "aborted" : "call_failed", server: spec.serverName, ...guardedMcpDetails(guarded) },
|
|
599
610
|
};
|
|
600
611
|
} finally {
|
|
601
612
|
if (uiSession?.reused) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function getConfigDirName(): string;
|
|
2
|
+
export declare function getAgentDir(): string;
|
|
3
|
+
export declare function getAgentPath(...segments: string[]): string;
|
|
4
|
+
export declare function getAppName(): string;
|
|
5
|
+
/**
|
|
6
|
+
* Home page the host declares for itself, via `piConfig.clientUri` in the same
|
|
7
|
+
* manifest that carries `piConfig.name`. Only the distribution knows its own
|
|
8
|
+
* URL, so this is the one place it can come from without guessing.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getAppClientUri(): string | undefined;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { join, resolve } from "node:path";
|
|
4
|
+
export function getConfigDirName() {
|
|
5
|
+
const configDir = readPiConfig()?.configDir;
|
|
6
|
+
return typeof configDir === "string" && configDir.trim() ? configDir.trim() : ".pi";
|
|
7
|
+
}
|
|
8
|
+
export function getAgentDir() {
|
|
9
|
+
const piConfig = readPiConfig();
|
|
10
|
+
const name = piConfig?.name;
|
|
11
|
+
const appName = typeof name === "string" && name.trim() ? name.trim() : "pi";
|
|
12
|
+
const configured = process.env[`${appName.toUpperCase()}_CODING_AGENT_DIR`]?.trim();
|
|
13
|
+
if (!configured) {
|
|
14
|
+
return join(homedir(), getConfigDirName(), "agent");
|
|
15
|
+
}
|
|
16
|
+
if (configured === "~") {
|
|
17
|
+
return homedir();
|
|
18
|
+
}
|
|
19
|
+
if (configured.startsWith("~/")) {
|
|
20
|
+
return resolve(homedir(), configured.slice(2));
|
|
21
|
+
}
|
|
22
|
+
return resolve(configured);
|
|
23
|
+
}
|
|
24
|
+
export function getAgentPath(...segments) {
|
|
25
|
+
return join(getAgentDir(), ...segments);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* What the host calls itself.
|
|
29
|
+
*
|
|
30
|
+
* pi supports rebranding through `piConfig.name` in the package.json that its
|
|
31
|
+
* `getPackageDir()` resolves, and distributions built on pi (arc, tau, …) point
|
|
32
|
+
* `PI_PACKAGE_DIR` at their own manifest. Read that manifest directly rather
|
|
33
|
+
* than importing pi: this package deliberately depends on pi-ai and pi-tui
|
|
34
|
+
* only, and `getAgentDir()` above reads its env var the same self-contained way.
|
|
35
|
+
*
|
|
36
|
+
* Falls back to "pi", which is what pi's own APP_NAME resolves to.
|
|
37
|
+
*/
|
|
38
|
+
function readPiConfig() {
|
|
39
|
+
const dir = process.env.PI_PACKAGE_DIR?.trim();
|
|
40
|
+
if (!dir)
|
|
41
|
+
return undefined;
|
|
42
|
+
try {
|
|
43
|
+
const manifest = JSON.parse(readFileSync(join(resolve(dir), "package.json"), "utf8"));
|
|
44
|
+
return manifest.piConfig;
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
export function getAppName() {
|
|
51
|
+
const name = readPiConfig()?.name;
|
|
52
|
+
return typeof name === "string" && name.trim() ? name.trim() : "pi";
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Home page the host declares for itself, via `piConfig.clientUri` in the same
|
|
56
|
+
* manifest that carries `piConfig.name`. Only the distribution knows its own
|
|
57
|
+
* URL, so this is the one place it can come from without guessing.
|
|
58
|
+
*/
|
|
59
|
+
export function getAppClientUri() {
|
|
60
|
+
const uri = readPiConfig()?.clientUri;
|
|
61
|
+
return typeof uri === "string" && uri.trim() ? uri.trim() : undefined;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=agent-dir.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-dir.js","sourceRoot":"","sources":["../agent-dir.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,UAAU,gBAAgB;IAC9B,MAAM,SAAS,GAAG,YAAY,EAAE,EAAE,SAAS,CAAC;IAC5C,OAAO,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;AACtF,CAAC;AAED,MAAM,UAAU,WAAW;IACzB,MAAM,QAAQ,GAAG,YAAY,EAAE,CAAC;IAChC,MAAM,IAAI,GAAG,QAAQ,EAAE,IAAI,CAAC;IAC5B,MAAM,OAAO,GAAG,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IAC7E,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,WAAW,EAAE,mBAAmB,CAAC,EAAE,IAAI,EAAE,CAAC;IACpF,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,IAAI,CAAC,OAAO,EAAE,EAAE,gBAAgB,EAAE,EAAE,OAAO,CAAC,CAAC;IACtD,CAAC;IACD,IAAI,UAAU,KAAK,GAAG,EAAE,CAAC;QACvB,OAAO,OAAO,EAAE,CAAC;IACnB,CAAC;IACD,IAAI,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QAChC,OAAO,OAAO,CAAC,OAAO,EAAE,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACjD,CAAC;IACD,OAAO,OAAO,CAAC,UAAU,CAAC,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,GAAG,QAAkB;IAChD,OAAO,IAAI,CAAC,WAAW,EAAE,EAAE,GAAG,QAAQ,CAAC,CAAC;AAC1C,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAS,YAAY;IACnB,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,IAAI,EAAE,CAAA;IAC9C,IAAI,CAAC,GAAG;QAAE,OAAO,SAAS,CAAA;IAC1B,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAEnF,CAAA;QACD,OAAO,QAAQ,CAAC,QAAQ,CAAA;IAC1B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAA;IAClB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,MAAM,IAAI,GAAG,YAAY,EAAE,EAAE,IAAI,CAAA;IACjC,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;AACrE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe;IAC7B,MAAM,GAAG,GAAG,YAAY,EAAE,EAAE,SAAS,CAAA;IACrC,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;AACvE,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { McpConfig } from "./types.ts";
|
|
2
|
+
export interface AgentPluginSummary {
|
|
3
|
+
path: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
serverCount: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function loadAgentPluginConfigs(paths: unknown, cwd?: string): McpConfig;
|
|
8
|
+
export declare function getAgentPluginSummaries(paths: unknown, cwd?: string): AgentPluginSummary[];
|