@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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AgentToolResult, ToolInfo } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
import { UrlElicitationRequiredError, type Client } from "@modelcontextprotocol/client";
|
|
2
|
+
import { UrlElicitationRequiredError, type Client, type Progress, type RequestOptions } from "@modelcontextprotocol/client";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import type { McpExtensionState } from "./state.ts";
|
|
5
5
|
import type { ToolMetadata, McpContent } from "./types.ts";
|
|
@@ -18,6 +18,7 @@ import { authenticate, completeAuthFromInput, startAuth, supportsOAuth } from ".
|
|
|
18
18
|
import { SessionRecoveryAuthRequiredError, withSessionRecovery } from "./session-recovery.ts";
|
|
19
19
|
import { paginate, rankSuggestions, rankToolMatches, resolveSearchKeywords } from "./search-ranking.ts";
|
|
20
20
|
import { ensureToolCallApproved, isToolCallApprovalRequired } from "./tool-approval.ts";
|
|
21
|
+
import { isServerInActiveFailureBackoff } from "./failure-backoff.ts";
|
|
21
22
|
|
|
22
23
|
type ProxyToolResult = AgentToolResult<Record<string, unknown>>;
|
|
23
24
|
type ClientCallToolResult = Awaited<ReturnType<Client["callTool"]>>;
|
|
@@ -37,6 +38,30 @@ type AutoAuthResult =
|
|
|
37
38
|
| { status: "success" }
|
|
38
39
|
| { status: "failed"; message: string };
|
|
39
40
|
|
|
41
|
+
let nextProgressInvocationId = 1;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Bridges SDK request-local progress callbacks to the interactive UI notify
|
|
45
|
+
* path (#437 item 3). The SDK owns `_meta.progressToken` injection when
|
|
46
|
+
* `onprogress` is set; this never writes the token manually.
|
|
47
|
+
*/
|
|
48
|
+
function withUiProgressBridge(
|
|
49
|
+
options: RequestOptions | undefined,
|
|
50
|
+
ui: McpExtensionState["ui"],
|
|
51
|
+
serverName: string,
|
|
52
|
+
toolName: string,
|
|
53
|
+
): RequestOptions | undefined {
|
|
54
|
+
if (!ui) return options;
|
|
55
|
+
const label = `MCP ${serverName}/${toolName}#${nextProgressInvocationId++}`;
|
|
56
|
+
return {
|
|
57
|
+
...options,
|
|
58
|
+
onprogress: (progress: Progress) => {
|
|
59
|
+
const ratio = `${progress.progress}${progress.total === undefined ? "" : `/${progress.total}`}`;
|
|
60
|
+
ui.notify(progress.message ? `${label}: ${progress.message} (${ratio})` : `${label}: ${ratio}`, "info");
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
40
65
|
function getToolMatches(metadata: ToolMetadata[] | undefined, toolName: string, exact: boolean): ToolMetadata[] {
|
|
41
66
|
if (!metadata) return [];
|
|
42
67
|
if (exact) return metadata.filter(tool => tool.name === toolName);
|
|
@@ -53,12 +78,39 @@ function getEnabledToolMatches(state: McpExtensionState, toolName: string, exact
|
|
|
53
78
|
return matches;
|
|
54
79
|
}
|
|
55
80
|
|
|
81
|
+
function serverBackoffResult(state: McpExtensionState, mode: string, serverName: string): ProxyToolResult {
|
|
82
|
+
const failedAgo = getFailureAgeSeconds(state, serverName) ?? 0;
|
|
83
|
+
const message = `Server "${serverName}" not available (last failed ${failedAgo}s ago)`;
|
|
84
|
+
return {
|
|
85
|
+
content: [{ type: "text" as const, text: message }],
|
|
86
|
+
details: { mode, error: "server_backoff", server: serverName },
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
56
90
|
function getSingleToolMatch(metadata: ToolMetadata[] | undefined, toolName: string): ToolMetadata | "ambiguous" | undefined {
|
|
57
91
|
const exactMatches = getToolMatches(metadata, toolName, true);
|
|
58
92
|
const matches = exactMatches.length > 0 ? exactMatches : getToolMatches(metadata, toolName, false);
|
|
59
93
|
return matches.length > 1 ? "ambiguous" : matches[0];
|
|
60
94
|
}
|
|
61
95
|
|
|
96
|
+
type ServerScopedToolMatch = { tool: ToolMetadata; precedence: number } | "ambiguous";
|
|
97
|
+
|
|
98
|
+
function getServerScopedToolMatch(metadata: ToolMetadata[] | undefined, toolName: string): ServerScopedToolMatch | undefined {
|
|
99
|
+
if (!metadata) return undefined;
|
|
100
|
+
const normalizedName = toolName.replace(/-/g, "_");
|
|
101
|
+
const matchesByPrecedence = [
|
|
102
|
+
metadata.filter((tool) => tool.name === toolName),
|
|
103
|
+
metadata.filter((tool) => tool.originalName === toolName),
|
|
104
|
+
metadata.filter((tool) => tool.name.replace(/-/g, "_") === normalizedName),
|
|
105
|
+
metadata.filter((tool) => tool.originalName.replace(/-/g, "_") === normalizedName),
|
|
106
|
+
];
|
|
107
|
+
for (const [precedence, matches] of matchesByPrecedence.entries()) {
|
|
108
|
+
if (matches.length > 1) return "ambiguous";
|
|
109
|
+
if (matches.length === 1) return { tool: matches[0]!, precedence };
|
|
110
|
+
}
|
|
111
|
+
return undefined;
|
|
112
|
+
}
|
|
113
|
+
|
|
62
114
|
function ambiguousToolResult(mode: "call" | "describe", toolName: string): ProxyToolResult {
|
|
63
115
|
const message = `Tool "${toolName}" matches multiple servers. Specify a server.`;
|
|
64
116
|
return {
|
|
@@ -91,22 +143,30 @@ function getAuthFailedMessage(state: McpExtensionState, serverName: string, mess
|
|
|
91
143
|
return `OAuth authentication failed for "${serverName}": ${message}. Run mcp({ action: "auth-start", server: "${serverName}" }) to get a browser URL, or /mcp-auth ${serverName} in an interactive local session.`;
|
|
92
144
|
}
|
|
93
145
|
|
|
94
|
-
function
|
|
146
|
+
function getRedirectDetails(authorizationUrl: string): { port?: number; remote: boolean } {
|
|
95
147
|
try {
|
|
96
148
|
const redirectUri = new URL(authorizationUrl).searchParams.get("redirect_uri");
|
|
97
|
-
if (!redirectUri) return
|
|
98
|
-
const
|
|
99
|
-
|
|
149
|
+
if (!redirectUri) return { remote: false };
|
|
150
|
+
const redirect = new URL(redirectUri);
|
|
151
|
+
const hostname = redirect.hostname.toLowerCase();
|
|
152
|
+
const local = hostname === "localhost" || hostname === "127.0.0.1" || hostname === "[::1]" || hostname === "::1";
|
|
153
|
+
const port = Number.parseInt(redirect.port, 10);
|
|
154
|
+
return {
|
|
155
|
+
...(Number.isInteger(port) ? { port } : {}),
|
|
156
|
+
remote: !local,
|
|
157
|
+
};
|
|
100
158
|
} catch {
|
|
101
|
-
return
|
|
159
|
+
return { remote: false };
|
|
102
160
|
}
|
|
103
161
|
}
|
|
104
162
|
|
|
105
163
|
function formatManualAuthInstructions(serverName: string, authorizationUrl: string): string {
|
|
106
|
-
const
|
|
107
|
-
const
|
|
108
|
-
?
|
|
109
|
-
:
|
|
164
|
+
const redirect = getRedirectDetails(authorizationUrl);
|
|
165
|
+
const redirectNote = redirect.remote
|
|
166
|
+
? "The provider uses a pre-registered HTTPS callback. Copy its full URL from the browser address bar, even if the destination page reports an error."
|
|
167
|
+
: redirect.port
|
|
168
|
+
? `The redirect URL will use local port ${redirect.port}. On a remote server it is expected for that localhost page to fail locally; copy the address bar URL anyway.`
|
|
169
|
+
: "";
|
|
110
170
|
|
|
111
171
|
return [
|
|
112
172
|
`MCP OAuth required for "${serverName}".`,
|
|
@@ -115,11 +175,13 @@ function formatManualAuthInstructions(serverName: string, authorizationUrl: stri
|
|
|
115
175
|
"",
|
|
116
176
|
authorizationUrl,
|
|
117
177
|
"",
|
|
118
|
-
"After approving, copy the full
|
|
178
|
+
"After approving, copy the full callback URL from your browser address bar and send it back with:",
|
|
119
179
|
`mcp({ action: "auth-complete", server: "${serverName}", args: { redirectUrl: "PASTE_REDIRECT_URL_HERE" } })`,
|
|
120
180
|
"",
|
|
121
|
-
|
|
122
|
-
|
|
181
|
+
redirect.remote
|
|
182
|
+
? "Remote HTTPS callbacks must include the full callback URL so the OAuth state can be checked. JSON-string args remain supported."
|
|
183
|
+
: 'You can also pass just the `code` query parameter as `args: { code: "PASTE_CODE_HERE" }`. JSON-string args remain supported.',
|
|
184
|
+
redirectNote,
|
|
123
185
|
].filter(Boolean).join("\n");
|
|
124
186
|
}
|
|
125
187
|
|
|
@@ -284,7 +346,6 @@ export function executeStatus(state: McpExtensionState): ProxyToolResult {
|
|
|
284
346
|
const disabled = isServerDisabled(definition);
|
|
285
347
|
const connection = disabled ? undefined : state.manager.getConnection(name);
|
|
286
348
|
const metadata = disabled ? undefined : state.toolMetadata.get(name);
|
|
287
|
-
const toolCount = metadata?.length ?? 0;
|
|
288
349
|
const failedAgo = disabled ? null : getFailureAgeSeconds(state, name);
|
|
289
350
|
let status = disabled ? "disabled" : "not connected";
|
|
290
351
|
if (!disabled && connection?.status === "connected") {
|
|
@@ -297,6 +358,8 @@ export function executeStatus(state: McpExtensionState): ProxyToolResult {
|
|
|
297
358
|
status = "cached";
|
|
298
359
|
}
|
|
299
360
|
|
|
361
|
+
const toolCount = status === "failed" ? 0 : metadata?.length ?? 0;
|
|
362
|
+
|
|
300
363
|
servers.push({ name, status, toolCount, failedAgo, ...(disabled ? { disabled: true } : {}) });
|
|
301
364
|
}
|
|
302
365
|
|
|
@@ -418,7 +481,7 @@ export async function executeAuthComplete(state: McpExtensionState, serverName:
|
|
|
418
481
|
}
|
|
419
482
|
|
|
420
483
|
await state.manager.close(serverName);
|
|
421
|
-
clearFailure(state, serverName);
|
|
484
|
+
clearFailure(state, serverName, "auth-complete");
|
|
422
485
|
updateStatusBar(state);
|
|
423
486
|
return {
|
|
424
487
|
content: [{ type: "text" as const, text: `OAuth authentication successful for "${serverName}". Run mcp({ connect: "${serverName}" }) to connect with the new token.` }],
|
|
@@ -434,15 +497,17 @@ export async function executeAuthComplete(state: McpExtensionState, serverName:
|
|
|
434
497
|
}
|
|
435
498
|
|
|
436
499
|
export function executeDescribe(state: McpExtensionState, toolName: string): ProxyToolResult {
|
|
437
|
-
const exactMatches = getEnabledToolMatches(state, toolName, true)
|
|
500
|
+
const exactMatches = getEnabledToolMatches(state, toolName, true)
|
|
501
|
+
.filter((match) => !isServerInActiveFailureBackoff(state, match.server));
|
|
438
502
|
if (exactMatches.length > 1) return ambiguousToolResult("describe", toolName);
|
|
439
|
-
if (exactMatches.length === 0 && getEnabledToolMatches(state, toolName, false).length > 1) {
|
|
503
|
+
if (exactMatches.length === 0 && getEnabledToolMatches(state, toolName, false).filter((match) => !isServerInActiveFailureBackoff(state, match.server)).length > 1) {
|
|
440
504
|
return ambiguousToolResult("describe", toolName);
|
|
441
505
|
}
|
|
442
506
|
|
|
443
507
|
let serverName = exactMatches[0]?.server;
|
|
444
508
|
let toolMeta = exactMatches[0]?.tool;
|
|
445
509
|
let disabledMatch: string | undefined;
|
|
510
|
+
let failedMatch: string | undefined;
|
|
446
511
|
|
|
447
512
|
if (!toolMeta) {
|
|
448
513
|
for (const [server, metadata] of state.toolMetadata.entries()) {
|
|
@@ -452,6 +517,10 @@ export function executeDescribe(state: McpExtensionState, toolName: string): Pro
|
|
|
452
517
|
disabledMatch ??= server;
|
|
453
518
|
continue;
|
|
454
519
|
}
|
|
520
|
+
if (isServerInActiveFailureBackoff(state, server)) {
|
|
521
|
+
failedMatch ??= server;
|
|
522
|
+
continue;
|
|
523
|
+
}
|
|
455
524
|
serverName = server;
|
|
456
525
|
toolMeta = found;
|
|
457
526
|
break;
|
|
@@ -460,6 +529,7 @@ export function executeDescribe(state: McpExtensionState, toolName: string): Pro
|
|
|
460
529
|
|
|
461
530
|
if (!serverName || !toolMeta) {
|
|
462
531
|
if (disabledMatch) return disabledResult("describe", disabledMatch);
|
|
532
|
+
if (failedMatch) return serverBackoffResult(state, "describe", failedMatch);
|
|
463
533
|
const suggestions = rankSuggestions(state, toolName, 5);
|
|
464
534
|
const suggestionText = suggestions.length > 0 ? ` Did you mean: ${suggestions.join(", ")}` : "";
|
|
465
535
|
return {
|
|
@@ -504,6 +574,7 @@ export function executeSearch(
|
|
|
504
574
|
): ProxyToolResult {
|
|
505
575
|
const showSchemas = includeSchemas !== false;
|
|
506
576
|
if (server && isServerDisabled(state.config.mcpServers[server])) return disabledResult("search", server);
|
|
577
|
+
if (server && isServerInActiveFailureBackoff(state, server)) return serverBackoffResult(state, "search", server);
|
|
507
578
|
|
|
508
579
|
let matches: Array<{ server: string; tool: ToolMetadata; score: number }>;
|
|
509
580
|
if (regex) {
|
|
@@ -545,6 +616,7 @@ export function executeSearch(
|
|
|
545
616
|
for (const [serverName, metadata] of state.toolMetadata.entries()) {
|
|
546
617
|
const definition = state.config.mcpServers[serverName];
|
|
547
618
|
if (isServerDisabled(definition)) continue;
|
|
619
|
+
if (isServerInActiveFailureBackoff(state, serverName)) continue;
|
|
548
620
|
if (server && serverName !== server) continue;
|
|
549
621
|
for (const tool of metadata) {
|
|
550
622
|
const matched = pattern.test(tool.name) || pattern.test(tool.description)
|
|
@@ -644,6 +716,12 @@ export function executeList(state: McpExtensionState, server: string): ProxyTool
|
|
|
644
716
|
const metadata = state.toolMetadata.get(server);
|
|
645
717
|
const toolNames = metadata?.map(m => m.name) ?? [];
|
|
646
718
|
const connection = state.manager.getConnection(server);
|
|
719
|
+
if (isServerInActiveFailureBackoff(state, server)) {
|
|
720
|
+
return {
|
|
721
|
+
...serverBackoffResult(state, "list", server),
|
|
722
|
+
details: { mode: "list", server, tools: [], count: 0, error: "server_backoff" },
|
|
723
|
+
};
|
|
724
|
+
}
|
|
647
725
|
const instructions = state.serverInstructions.get(server);
|
|
648
726
|
let instructionsText = "";
|
|
649
727
|
if (instructions) {
|
|
@@ -708,6 +786,7 @@ export function executeInstructions(state: McpExtensionState, server: string): P
|
|
|
708
786
|
};
|
|
709
787
|
}
|
|
710
788
|
if (isServerDisabled(definition)) return disabledResult("instructions", server);
|
|
789
|
+
if (isServerInActiveFailureBackoff(state, server)) return serverBackoffResult(state, "instructions", server);
|
|
711
790
|
|
|
712
791
|
const instructions = state.serverInstructions.get(server);
|
|
713
792
|
if (instructions) {
|
|
@@ -787,9 +866,9 @@ export async function executeConnect(state: McpExtensionState, serverName: strin
|
|
|
787
866
|
state.serverInstructions.delete(serverName);
|
|
788
867
|
}
|
|
789
868
|
updateMetadataCache(state, serverName);
|
|
790
|
-
|
|
869
|
+
const restored = clearFailure(state, serverName, "proxy-connect");
|
|
870
|
+
if (!restored) notifyToolMetadataUpdated(state, serverName, "proxy-connect");
|
|
791
871
|
markKeepAliveAfterConnect(state, serverName);
|
|
792
|
-
clearFailure(state, serverName);
|
|
793
872
|
updateStatusBar(state);
|
|
794
873
|
return executeList(state, serverName);
|
|
795
874
|
} catch (error) {
|
|
@@ -843,9 +922,9 @@ export async function executeCall(
|
|
|
843
922
|
};
|
|
844
923
|
}
|
|
845
924
|
if (serverName) {
|
|
846
|
-
const match =
|
|
925
|
+
const match = getServerScopedToolMatch(state.toolMetadata.get(serverName), toolName);
|
|
847
926
|
if (match === "ambiguous") return ambiguousToolResult("call", toolName);
|
|
848
|
-
toolMeta = match;
|
|
927
|
+
toolMeta = match?.tool;
|
|
849
928
|
if (isServerDisabled(state.config.mcpServers[serverName])) {
|
|
850
929
|
return disabledCallResult(serverName, toolMeta);
|
|
851
930
|
}
|
|
@@ -887,9 +966,15 @@ export async function executeCall(
|
|
|
887
966
|
if (serverName && !toolMeta) {
|
|
888
967
|
const connected = await lazyConnect(state, serverName, ownedSignal);
|
|
889
968
|
if (connected) {
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
969
|
+
if (serverOverride) {
|
|
970
|
+
const match = getServerScopedToolMatch(state.toolMetadata.get(serverName), toolName);
|
|
971
|
+
if (match === "ambiguous") return ambiguousToolResult("call", toolName);
|
|
972
|
+
toolMeta = match?.tool;
|
|
973
|
+
} else {
|
|
974
|
+
const match = getSingleToolMatch(state.toolMetadata.get(serverName), toolName);
|
|
975
|
+
if (match === "ambiguous") return ambiguousToolResult("call", toolName);
|
|
976
|
+
toolMeta = match;
|
|
977
|
+
}
|
|
893
978
|
} else {
|
|
894
979
|
const needsAuthConnection = state.manager.getConnection(serverName);
|
|
895
980
|
if (needsAuthConnection?.status === "needs-auth") {
|
|
@@ -907,9 +992,9 @@ export async function executeCall(
|
|
|
907
992
|
clearFailure(state, serverName);
|
|
908
993
|
const connectedAfterAuth = await lazyConnect(state, serverName, ownedSignal);
|
|
909
994
|
if (connectedAfterAuth) {
|
|
910
|
-
const match =
|
|
995
|
+
const match = getServerScopedToolMatch(state.toolMetadata.get(serverName), toolName);
|
|
911
996
|
if (match === "ambiguous") return ambiguousToolResult("call", toolName);
|
|
912
|
-
toolMeta = match;
|
|
997
|
+
toolMeta = match?.tool;
|
|
913
998
|
if (!toolMeta) {
|
|
914
999
|
const suggestions = rankSuggestions(state, toolName, 5);
|
|
915
1000
|
const suggestionText = suggestions.length > 0 ? ` Did you mean: ${suggestions.join(", ")}` : "";
|
|
@@ -1100,15 +1185,21 @@ export async function executeCall(
|
|
|
1100
1185
|
};
|
|
1101
1186
|
}
|
|
1102
1187
|
}
|
|
1103
|
-
clearFailure(state, serverName);
|
|
1104
1188
|
updateServerMetadata(state, serverName);
|
|
1105
1189
|
updateMetadataCache(state, serverName);
|
|
1106
|
-
|
|
1190
|
+
const restored = clearFailure(state, serverName, "proxy-call-reconnect");
|
|
1191
|
+
if (!restored) notifyToolMetadataUpdated(state, serverName, "proxy-call-reconnect");
|
|
1107
1192
|
markKeepAliveAfterConnect(state, serverName);
|
|
1108
1193
|
updateStatusBar(state);
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1194
|
+
if (serverOverride) {
|
|
1195
|
+
const match = getServerScopedToolMatch(state.toolMetadata.get(serverName), toolName);
|
|
1196
|
+
if (match === "ambiguous") return ambiguousToolResult("call", toolName);
|
|
1197
|
+
toolMeta = match?.tool;
|
|
1198
|
+
} else {
|
|
1199
|
+
const match = getSingleToolMatch(state.toolMetadata.get(serverName), toolName);
|
|
1200
|
+
if (match === "ambiguous") return ambiguousToolResult("call", toolName);
|
|
1201
|
+
toolMeta = match;
|
|
1202
|
+
}
|
|
1112
1203
|
if (!toolMeta) {
|
|
1113
1204
|
const available = getToolNames(state, serverName);
|
|
1114
1205
|
const hint = available.length > 0
|
|
@@ -1162,7 +1253,12 @@ export async function executeCall(
|
|
|
1162
1253
|
}
|
|
1163
1254
|
|
|
1164
1255
|
let uiSession: UiSessionRuntime | null = null;
|
|
1165
|
-
const requestOptions =
|
|
1256
|
+
const requestOptions = withUiProgressBridge(
|
|
1257
|
+
state.manager.getRequestOptions?.(serverName, ownedSignal) ?? (ownedSignal ? { signal: ownedSignal } : undefined),
|
|
1258
|
+
state.ui,
|
|
1259
|
+
serverName,
|
|
1260
|
+
toolMeta.originalName,
|
|
1261
|
+
);
|
|
1166
1262
|
|
|
1167
1263
|
const outputGuardOptions = resolveMcpOutputGuardOptions(state.config.settings);
|
|
1168
1264
|
const recoverAuthConnection = async () => {
|
|
@@ -92,7 +92,7 @@ function killRequestHeadersCommand(child: ChildProcess, trackedPosixDescendantPi
|
|
|
92
92
|
encoding: "utf8",
|
|
93
93
|
windowsHide: true,
|
|
94
94
|
});
|
|
95
|
-
if (result.status === 0 || isTaskkillNoSuchProcess(result)) return;
|
|
95
|
+
if (result.status === 0 || result.status === 128 || isTaskkillNoSuchProcess(result)) return;
|
|
96
96
|
throw new Error(`HTTP request headers command cleanup failed: taskkill exited with code ${result.status ?? "unknown"}`);
|
|
97
97
|
}
|
|
98
98
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { McpExtensionState } from "./state.ts";
|
|
2
2
|
import type { ServerEntry, ToolMetadata, ToolPrefix } from "./types.ts";
|
|
3
3
|
import { getServerPrefix, getToolNameCandidates, isServerDisabled, matchesToolPattern, resolveToolPrefix } from "./types.ts";
|
|
4
|
+
import { isServerInActiveFailureBackoff } from "./failure-backoff.ts";
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Shortest field token allowed to stem-match a longer query token.
|
|
@@ -242,6 +243,7 @@ export function rankToolMatches(
|
|
|
242
243
|
if (server && serverName !== server) continue;
|
|
243
244
|
const definition = state.config.mcpServers[serverName];
|
|
244
245
|
if (isServerDisabled(definition)) continue;
|
|
246
|
+
if (isServerInActiveFailureBackoff(state, serverName)) continue;
|
|
245
247
|
for (const prepared of getPreparedTools(state, serverName, metadata, definition, globalPrefix, includeKeywords)) {
|
|
246
248
|
const score = scorePreparedToolMatch(prepared, normalizedQuery, queryTokens);
|
|
247
249
|
if (score !== null) matches.push({ server: serverName, tool: prepared.tool, score });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mkdirSync } from "node:fs";
|
|
1
|
+
import { mkdirSync, statSync } from "node:fs";
|
|
2
2
|
import { isDeepStrictEqual } from "node:util";
|
|
3
3
|
import {
|
|
4
4
|
Client,
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
StreamableHTTPClientTransport,
|
|
10
10
|
UnauthorizedError,
|
|
11
11
|
type GetPromptResult,
|
|
12
|
+
type ListToolsResult,
|
|
12
13
|
type ReadResourceResult,
|
|
13
14
|
type CacheableRequestOptions,
|
|
14
15
|
type RequestOptions,
|
|
@@ -33,6 +34,7 @@ import {
|
|
|
33
34
|
import { resolveNpxBinary } from "./npx-resolver.ts";
|
|
34
35
|
import { createJsonSchemaValidator } from "./json-schema-validator.ts";
|
|
35
36
|
import { logger } from "./logger.ts";
|
|
37
|
+
import { RESOURCE_MIME_TYPE } from "./ui-app-bridge-helpers.ts";
|
|
36
38
|
import { McpOAuthProvider } from "./mcp-oauth-provider.ts";
|
|
37
39
|
import { extractOAuthConfig, supportsOAuth, type McpOAuthRuntime } from "./mcp-auth-flow.ts";
|
|
38
40
|
import { invalidateAuthEntryCache, type AuthStorageOptions } from "./mcp-auth.ts";
|
|
@@ -128,6 +130,8 @@ export interface ServerConnection {
|
|
|
128
130
|
transport: Transport;
|
|
129
131
|
definition: ServerDefinition;
|
|
130
132
|
tools: McpTool[];
|
|
133
|
+
/** Cache hints from the server's aggregated tools/list result. */
|
|
134
|
+
toolListHints?: Partial<Pick<ListToolsResult, "ttlMs" | "cacheScope">> | undefined;
|
|
131
135
|
/** Monotonic guard against older refresh responses replacing newer notifications. */
|
|
132
136
|
toolsRevision?: number;
|
|
133
137
|
resources: McpResource[];
|
|
@@ -148,8 +152,20 @@ type MetadataListChangedListener = (serverName: string, reason: string) => void;
|
|
|
148
152
|
|
|
149
153
|
export type ToolRefreshResult = "updated" | "unchanged" | "superseded" | "refresh-timeout";
|
|
150
154
|
|
|
155
|
+
type ToolListCacheHints = Partial<Pick<ListToolsResult, "ttlMs" | "cacheScope">>;
|
|
156
|
+
type ToolListResult = { tools: McpTool[]; hints?: ToolListCacheHints };
|
|
157
|
+
|
|
151
158
|
const KEEP_ALIVE_REFRESH_TIMEOUT_MS = 5_000;
|
|
152
159
|
|
|
160
|
+
export function isTransientHttpConnectError(error: unknown): boolean {
|
|
161
|
+
let current: unknown = error;
|
|
162
|
+
while (current instanceof Error) {
|
|
163
|
+
if (current instanceof SdkHttpError && current.status === 503) return true;
|
|
164
|
+
current = current.cause;
|
|
165
|
+
}
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
168
|
+
|
|
153
169
|
export class McpServerManager {
|
|
154
170
|
private connections = new Map<string, ServerConnection>();
|
|
155
171
|
private connectPromises = new Map<string, Promise<ServerConnection>>();
|
|
@@ -375,9 +391,9 @@ export class McpServerManager {
|
|
|
375
391
|
|
|
376
392
|
const toolsRevision = expectedConnection.toolsRevision ?? 0;
|
|
377
393
|
const refreshSignal = combineAbortSignals(healthOptions.signal, AbortSignal.timeout(timeout));
|
|
378
|
-
let
|
|
394
|
+
let toolResult: ToolListResult;
|
|
379
395
|
try {
|
|
380
|
-
|
|
396
|
+
toolResult = await this.fetchAllTools(expectedConnection.client, {
|
|
381
397
|
...healthOptions,
|
|
382
398
|
...(refreshSignal ? { signal: refreshSignal } : {}),
|
|
383
399
|
cacheMode: "refresh",
|
|
@@ -401,20 +417,30 @@ export class McpServerManager {
|
|
|
401
417
|
return "superseded";
|
|
402
418
|
}
|
|
403
419
|
|
|
404
|
-
if (
|
|
420
|
+
if (
|
|
421
|
+
isDeepStrictEqual(expectedConnection.tools, toolResult.tools) &&
|
|
422
|
+
isDeepStrictEqual(expectedConnection.toolListHints, toolResult.hints)
|
|
423
|
+
) {
|
|
405
424
|
this.retryPendingMetadataPublication(name, expectedConnection);
|
|
406
425
|
return "unchanged";
|
|
407
426
|
}
|
|
408
427
|
|
|
409
428
|
const previousTools = expectedConnection.tools;
|
|
410
|
-
|
|
429
|
+
const previousToolListHints = expectedConnection.toolListHints;
|
|
430
|
+
expectedConnection.tools = toolResult.tools;
|
|
431
|
+
expectedConnection.toolListHints = toolResult.hints;
|
|
411
432
|
expectedConnection.toolsRevision = toolsRevision + 1;
|
|
412
433
|
try {
|
|
413
434
|
await this.metadataListChangedListener?.(name, "keep-alive-refresh");
|
|
414
435
|
this.pendingMetadataPublications.delete(name);
|
|
415
436
|
} catch (error) {
|
|
416
|
-
if (
|
|
437
|
+
if (
|
|
438
|
+
this.connections.get(name) === expectedConnection &&
|
|
439
|
+
expectedConnection.tools === toolResult.tools &&
|
|
440
|
+
expectedConnection.toolListHints === toolResult.hints
|
|
441
|
+
) {
|
|
417
442
|
expectedConnection.tools = previousTools;
|
|
443
|
+
expectedConnection.toolListHints = previousToolListHints;
|
|
418
444
|
expectedConnection.toolsRevision = toolsRevision;
|
|
419
445
|
}
|
|
420
446
|
throw error;
|
|
@@ -488,7 +514,13 @@ export class McpServerManager {
|
|
|
488
514
|
if (definition.command) {
|
|
489
515
|
client = this.createClient(name, definition);
|
|
490
516
|
let command = definition.command;
|
|
491
|
-
let args = (definition.args ?? []).map(interpolateEnvVars);
|
|
517
|
+
let args = (definition.args ?? []).map((argument) => interpolateEnvVars(argument));
|
|
518
|
+
const cwd = resolveConfigPath(definition.cwd) ?? this.defaultCwd;
|
|
519
|
+
if (cwd !== undefined) {
|
|
520
|
+
const cwdStats = statSync(cwd, { throwIfNoEntry: false });
|
|
521
|
+
if (!cwdStats) throw new Error(`MCP server "${name}" configured cwd does not exist: "${cwd}"`);
|
|
522
|
+
if (!cwdStats.isDirectory()) throw new Error(`MCP server "${name}" configured cwd is not a directory: "${cwd}"`);
|
|
523
|
+
}
|
|
492
524
|
|
|
493
525
|
if (command === "npx" || command === "npm") {
|
|
494
526
|
const resolved = await resolveNpxBinary(command, args, signal);
|
|
@@ -501,7 +533,6 @@ export class McpServerManager {
|
|
|
501
533
|
throwIfAborted(signal);
|
|
502
534
|
|
|
503
535
|
if (definition.pluginDataDir) mkdirSync(definition.pluginDataDir, { recursive: true });
|
|
504
|
-
const cwd = resolveConfigPath(definition.cwd) ?? this.defaultCwd;
|
|
505
536
|
const stdioTransport = new StdioClientTransport({
|
|
506
537
|
command,
|
|
507
538
|
args,
|
|
@@ -588,12 +619,13 @@ export class McpServerManager {
|
|
|
588
619
|
|
|
589
620
|
// Discover tools, resources, and prompts. Resource and prompt listing is
|
|
590
621
|
// optional: only servers advertising the capability are queried.
|
|
591
|
-
const [
|
|
622
|
+
const [toolResult, resources, promptResult] = await Promise.all([
|
|
592
623
|
this.fetchAllTools(client, requestOptions),
|
|
593
624
|
this.fetchAllResources(client, requestOptions),
|
|
594
625
|
this.fetchAllPrompts(client, requestOptions),
|
|
595
626
|
]);
|
|
596
|
-
connection.tools = tools;
|
|
627
|
+
connection.tools = toolResult.tools;
|
|
628
|
+
connection.toolListHints = toolResult.hints;
|
|
597
629
|
connection.resources = resources;
|
|
598
630
|
connection.prompts = promptResult.prompts;
|
|
599
631
|
connection.promptDiscoveryFailed = promptResult.failed;
|
|
@@ -651,6 +683,9 @@ export class McpServerManager {
|
|
|
651
683
|
|
|
652
684
|
private async enrichHttpConnectionError(definition: ServerDefinition, error: unknown): Promise<Error> {
|
|
653
685
|
const originalMessage = error instanceof Error ? error.message : String(error);
|
|
686
|
+
if (isTransientHttpConnectError(error)) {
|
|
687
|
+
return new Error(`${originalMessage} — endpoint is temporarily unavailable (HTTP 503)`, { cause: error });
|
|
688
|
+
}
|
|
654
689
|
try {
|
|
655
690
|
const probe = await probeMcpEndpoint(resolveServerUrl(definition)!);
|
|
656
691
|
return new Error(`${originalMessage} — probe: ${probe.classification}`, { cause: error });
|
|
@@ -691,6 +726,11 @@ export class McpServerManager {
|
|
|
691
726
|
|
|
692
727
|
private buildClientCapabilities() {
|
|
693
728
|
return {
|
|
729
|
+
extensions: {
|
|
730
|
+
"io.modelcontextprotocol/ui": {
|
|
731
|
+
mimeTypes: [RESOURCE_MIME_TYPE],
|
|
732
|
+
},
|
|
733
|
+
},
|
|
694
734
|
...(this.samplingConfig ? { sampling: {} } : {}),
|
|
695
735
|
...(this.elicitationConfig
|
|
696
736
|
? {
|
|
@@ -987,17 +1027,34 @@ export class McpServerManager {
|
|
|
987
1027
|
}
|
|
988
1028
|
}
|
|
989
1029
|
|
|
990
|
-
private async fetchAllTools(client: Client, requestOptions?: CacheableRequestOptions): Promise<
|
|
1030
|
+
private async fetchAllTools(client: Client, requestOptions?: CacheableRequestOptions): Promise<ToolListResult> {
|
|
991
1031
|
const allTools: McpTool[] = [];
|
|
992
1032
|
let cursor: string | undefined;
|
|
1033
|
+
let hints: ToolListCacheHints | undefined;
|
|
1034
|
+
let firstPage = true;
|
|
993
1035
|
|
|
994
1036
|
do {
|
|
995
1037
|
const result = await client.listTools(cursor ? { cursor } : undefined, requestOptions);
|
|
1038
|
+
if (firstPage) {
|
|
1039
|
+
const ttlMs = typeof result.ttlMs === "number" && Number.isSafeInteger(result.ttlMs) && result.ttlMs >= 0
|
|
1040
|
+
? result.ttlMs
|
|
1041
|
+
: undefined;
|
|
1042
|
+
const cacheScope = result.cacheScope === "public" || result.cacheScope === "private"
|
|
1043
|
+
? result.cacheScope
|
|
1044
|
+
: undefined;
|
|
1045
|
+
if (ttlMs !== undefined || cacheScope !== undefined) {
|
|
1046
|
+
hints = {
|
|
1047
|
+
...(ttlMs !== undefined ? { ttlMs } : {}),
|
|
1048
|
+
...(cacheScope !== undefined ? { cacheScope } : {}),
|
|
1049
|
+
};
|
|
1050
|
+
}
|
|
1051
|
+
firstPage = false;
|
|
1052
|
+
}
|
|
996
1053
|
allTools.push(...(result.tools ?? []));
|
|
997
1054
|
cursor = result.nextCursor;
|
|
998
1055
|
} while (cursor);
|
|
999
1056
|
|
|
1000
|
-
return allTools;
|
|
1057
|
+
return { tools: allTools, ...(hints !== undefined ? { hints } : {}) };
|
|
1001
1058
|
}
|
|
1002
1059
|
|
|
1003
1060
|
private async fetchAllPrompts(
|
|
@@ -3,12 +3,10 @@ import type { ConsentManager } from "./consent-manager.ts";
|
|
|
3
3
|
import type { McpLifecycleManager } from "./lifecycle.ts";
|
|
4
4
|
import type { McpServerManager } from "./server-manager.ts";
|
|
5
5
|
import type { AuthStorageOptions } from "./mcp-auth.ts";
|
|
6
|
-
import type { ToolMetadata, PromptMetadata, McpConfig, UiSessionMessages, UiStreamSummary } from "./types.ts";
|
|
6
|
+
import type { ToolMetadata, PromptMetadata, McpConfig, UiSessionMessages, UiStreamSummary, McpStatusEventBus, UiServerHandle } from "./types.ts";
|
|
7
7
|
import type { UiResourceHandler } from "./ui-resource-handler.ts";
|
|
8
|
-
import type { UiServerHandle } from "./ui-server.ts";
|
|
9
8
|
import type { McpRuntimeOwner } from "./runtime-owner.ts";
|
|
10
9
|
import type { McpOAuthRuntime } from "./mcp-auth-flow.ts";
|
|
11
|
-
import type { McpStatusEventBus } from "./mcp-status.ts";
|
|
12
10
|
|
|
13
11
|
export interface CompletedUiSession {
|
|
14
12
|
serverName: string;
|
|
@@ -4,7 +4,7 @@ import { type Component, Text, truncateToWidth, visibleWidth } from "@earendil-w
|
|
|
4
4
|
type McpToolResultDetails = Record<string, unknown> & { error?: unknown };
|
|
5
5
|
type McpToolContentBlock = AgentToolResult<McpToolResultDetails>["content"][number];
|
|
6
6
|
|
|
7
|
-
interface RenderTheme {
|
|
7
|
+
export interface RenderTheme {
|
|
8
8
|
fg: (name: string, text: string) => string;
|
|
9
9
|
bold?: (text: string) => string;
|
|
10
10
|
}
|
|
@@ -28,7 +28,7 @@ interface McpToolRenderState {
|
|
|
28
28
|
compactInputPreview?: string;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
interface McpToolRenderContext {
|
|
31
|
+
export interface McpToolRenderContext {
|
|
32
32
|
isError: boolean;
|
|
33
33
|
isPartial?: boolean;
|
|
34
34
|
expanded?: boolean;
|
|
@@ -250,6 +250,13 @@ export function formatMcpDirectToolCallLines(
|
|
|
250
250
|
return [displayName, formatJsonish(args, maxInputChars)];
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
+
export function formatMcpScriptToolCallLines(
|
|
254
|
+
args: { code: string },
|
|
255
|
+
maxInputChars = DEFAULT_MAX_CALL_INPUT_CHARS,
|
|
256
|
+
): string[] {
|
|
257
|
+
return ["mcpScript", truncateText(args.code, maxInputChars)];
|
|
258
|
+
}
|
|
259
|
+
|
|
253
260
|
function renderToolCallLines(lines: string[], theme?: RenderTheme) {
|
|
254
261
|
const activeTheme = theme ?? plainTheme;
|
|
255
262
|
const [title = "mcp", ...rest] = lines;
|
|
@@ -314,6 +321,13 @@ export function createMcpDirectToolCallRenderer(displayName: string, options = r
|
|
|
314
321
|
};
|
|
315
322
|
}
|
|
316
323
|
|
|
324
|
+
export function createMcpScriptToolCallRenderer(options = resolveMcpToolRenderOptions()) {
|
|
325
|
+
return (args: { code: string }, theme?: RenderTheme, context?: McpToolRenderContext) => {
|
|
326
|
+
if (shouldUseCompactFinalRender(options, context)) return new EmptyComponent();
|
|
327
|
+
return renderToolCallLines(formatMcpScriptToolCallLines(args), theme);
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
|
|
317
331
|
function blockToLines(block: McpToolContentBlock): string[] {
|
|
318
332
|
if (block.type === "text") {
|
|
319
333
|
return block.text.split("\n");
|