@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
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
serializeTools,
|
|
21
21
|
type ServerCacheEntry,
|
|
22
22
|
} from "./metadata-cache.ts";
|
|
23
|
-
import { McpServerManager } from "./server-manager.ts";
|
|
23
|
+
import { McpServerManager, isTransientHttpConnectError } from "./server-manager.ts";
|
|
24
24
|
import { buildToolMetadata, totalToolCount } from "./tool-metadata.ts";
|
|
25
25
|
import { resourceNameToToolName } from "./resource-tools.ts";
|
|
26
26
|
import { UiResourceHandler } from "./ui-resource-handler.ts";
|
|
@@ -37,8 +37,9 @@ import {
|
|
|
37
37
|
type McpRuntimeOwner,
|
|
38
38
|
} from "./runtime-owner.ts";
|
|
39
39
|
import { publishMcpStatusSnapshot } from "./mcp-status.ts";
|
|
40
|
+
import { FAILURE_BACKOFF_MS, getFailureAgeSeconds } from "./failure-backoff.ts";
|
|
41
|
+
export { getFailureAgeSeconds, getFailureMessage, isServerInActiveFailureBackoff } from "./failure-backoff.ts";
|
|
40
42
|
|
|
41
|
-
const FAILURE_BACKOFF_MS = 60 * 1000;
|
|
42
43
|
const MAX_FAILURE_MESSAGE_CHARS = 8 * 1024;
|
|
43
44
|
const failureExpiryTimers = new WeakMap<McpExtensionState, Map<string, ReturnType<typeof setTimeout>>>();
|
|
44
45
|
|
|
@@ -51,13 +52,19 @@ function getFailureExpiryTimers(state: McpExtensionState): Map<string, ReturnTyp
|
|
|
51
52
|
return timers;
|
|
52
53
|
}
|
|
53
54
|
|
|
54
|
-
export function clearFailure(state: McpExtensionState, serverName: string):
|
|
55
|
+
export function clearFailure(state: McpExtensionState, serverName: string, restoredReason?: string): boolean {
|
|
56
|
+
const wasActive = getFailureAgeSeconds(state, serverName) !== null;
|
|
55
57
|
state.failureTracker.delete(serverName);
|
|
56
58
|
state.failureMessages?.delete(serverName);
|
|
57
59
|
const timers = failureExpiryTimers.get(state);
|
|
58
60
|
const timer = timers?.get(serverName);
|
|
59
61
|
if (timer) clearTimeout(timer);
|
|
60
62
|
timers?.delete(serverName);
|
|
63
|
+
if (restoredReason && wasActive) {
|
|
64
|
+
notifyToolMetadataUpdated(state, serverName, restoredReason);
|
|
65
|
+
publishMcpStatusSnapshot(state);
|
|
66
|
+
}
|
|
67
|
+
return wasActive;
|
|
61
68
|
}
|
|
62
69
|
|
|
63
70
|
export function recordFailure(state: McpExtensionState, serverName: string, message: string): void {
|
|
@@ -73,12 +80,15 @@ export function recordFailure(state: McpExtensionState, serverName: string, mess
|
|
|
73
80
|
if (state.failureTracker.get(serverName) === failedAt) {
|
|
74
81
|
state.failureTracker.delete(serverName);
|
|
75
82
|
state.failureMessages?.delete(serverName);
|
|
83
|
+
notifyToolMetadataUpdated(state, serverName, "failure-backoff-expired");
|
|
76
84
|
publishMcpStatusSnapshot(state);
|
|
77
85
|
}
|
|
78
86
|
getFailureExpiryTimers(state).delete(serverName);
|
|
79
87
|
}, FAILURE_BACKOFF_MS);
|
|
80
88
|
timer.unref?.();
|
|
81
89
|
getFailureExpiryTimers(state).set(serverName, timer);
|
|
90
|
+
notifyToolMetadataUpdated(state, serverName, "failure-backoff-started");
|
|
91
|
+
publishMcpStatusSnapshot(state);
|
|
82
92
|
}
|
|
83
93
|
|
|
84
94
|
export function isTuiMode(ctx: Pick<ExtensionContext, "hasUI" | "mode">): boolean {
|
|
@@ -293,16 +303,17 @@ export async function initializeMcp(
|
|
|
293
303
|
try {
|
|
294
304
|
const connection = await manager.connect(name, definition, runtimeSignal);
|
|
295
305
|
if (connection.status === "needs-auth") {
|
|
296
|
-
return { name, definition, connection: null, error: `OAuth authentication required. Run /mcp-auth ${name}
|
|
306
|
+
return { name, definition, connection: null, error: `OAuth authentication required. Run /mcp-auth ${name}.`, transient: false };
|
|
297
307
|
}
|
|
298
|
-
return { name, definition, connection, error: null };
|
|
308
|
+
return { name, definition, connection, error: null, transient: false };
|
|
299
309
|
} catch (error) {
|
|
300
310
|
if (isAbortError(error, runtimeSignal)) {
|
|
301
311
|
if (owner.signal.aborted) throw error;
|
|
302
|
-
return { name, definition, connection: null, error: null };
|
|
312
|
+
return { name, definition, connection: null, error: null, transient: false };
|
|
303
313
|
}
|
|
314
|
+
const transient = isTransientHttpConnectError(error);
|
|
304
315
|
const message = error instanceof Error ? error.message : String(error);
|
|
305
|
-
return { name, definition, connection: null, error: message };
|
|
316
|
+
return { name, definition, connection: null, error: message, transient };
|
|
306
317
|
}
|
|
307
318
|
});
|
|
308
319
|
|
|
@@ -332,11 +343,18 @@ export async function initializeMcp(
|
|
|
332
343
|
startupKnownMetadata.set(name, metadata);
|
|
333
344
|
}
|
|
334
345
|
|
|
335
|
-
for (const { name, definition, connection, error } of results) {
|
|
346
|
+
for (const { name, definition, connection, error, transient } of results) {
|
|
336
347
|
owner.throwIfInactive();
|
|
337
348
|
if (error || !connection) {
|
|
338
349
|
if (initialSignal?.aborted) continue;
|
|
339
350
|
if (error) recordFailure(state, name, error);
|
|
351
|
+
if (transient) {
|
|
352
|
+
const notice = `MCP: ${name} temporarily unavailable (HTTP 503); retry later`;
|
|
353
|
+
logger.debug(`MCP: startup connect hit transient upstream outage for ${name}; will retry`);
|
|
354
|
+
if (ui) ui.notify(notice, "warning");
|
|
355
|
+
else console.error(notice);
|
|
356
|
+
continue;
|
|
357
|
+
}
|
|
340
358
|
const displayError = sanitizeTerminalText(error ?? "Unknown connection failure");
|
|
341
359
|
if (ui) {
|
|
342
360
|
ui.notify(`MCP: Failed to connect to ${name}: ${displayError}`, "error");
|
|
@@ -399,9 +417,9 @@ export async function initializeMcp(
|
|
|
399
417
|
}
|
|
400
418
|
updateServerMetadata(state, name);
|
|
401
419
|
updateMetadataCache(state, name);
|
|
402
|
-
|
|
420
|
+
const restored = clearFailure(state, name, "direct-tools-bootstrap");
|
|
421
|
+
if (!restored) notifyToolMetadataUpdated(state, name, "direct-tools-bootstrap");
|
|
403
422
|
markKeepAliveAfterConnect(state, name);
|
|
404
|
-
clearFailure(state, name);
|
|
405
423
|
return { name, ok: true };
|
|
406
424
|
} catch (error) {
|
|
407
425
|
if (isAbortError(error, runtimeSignal)) {
|
|
@@ -427,8 +445,8 @@ export async function initializeMcp(
|
|
|
427
445
|
if (!owner.isActive()) return;
|
|
428
446
|
updateServerMetadata(state, serverName);
|
|
429
447
|
updateMetadataCache(state, serverName);
|
|
430
|
-
|
|
431
|
-
|
|
448
|
+
const restored = clearFailure(state, serverName, "lifecycle-reconnect");
|
|
449
|
+
if (!restored) notifyToolMetadataUpdated(state, serverName, "lifecycle-reconnect");
|
|
432
450
|
updateStatusBar(state);
|
|
433
451
|
});
|
|
434
452
|
|
|
@@ -441,13 +459,13 @@ export async function initializeMcp(
|
|
|
441
459
|
|
|
442
460
|
lifecycle.setHealthRestoredCallback((serverName) => {
|
|
443
461
|
if (!owner.isActive()) return;
|
|
444
|
-
clearFailure(state, serverName);
|
|
462
|
+
clearFailure(state, serverName, "health-restored");
|
|
445
463
|
updateStatusBar(state);
|
|
446
464
|
});
|
|
447
465
|
|
|
448
466
|
lifecycle.setAuthRequiredCallback((serverName) => {
|
|
449
467
|
if (!owner.isActive()) return;
|
|
450
|
-
clearFailure(state, serverName);
|
|
468
|
+
clearFailure(state, serverName, "auth-required");
|
|
451
469
|
updateStatusBar(state);
|
|
452
470
|
});
|
|
453
471
|
|
|
@@ -544,6 +562,8 @@ export function updateMetadataCache(
|
|
|
544
562
|
resources,
|
|
545
563
|
...(prompts !== undefined ? { prompts } : {}),
|
|
546
564
|
...(connection.instructions !== undefined ? { instructions: connection.instructions } : {}),
|
|
565
|
+
...(connection.toolListHints?.ttlMs !== undefined ? { ttlMs: connection.toolListHints.ttlMs } : {}),
|
|
566
|
+
...(connection.toolListHints?.cacheScope !== undefined ? { cacheScope: connection.toolListHints.cacheScope } : {}),
|
|
547
567
|
cachedAt: Date.now(),
|
|
548
568
|
};
|
|
549
569
|
|
|
@@ -606,20 +626,11 @@ export function updateStatusBar(state: McpExtensionState): void {
|
|
|
606
626
|
ui.setStatus("mcp", undefined);
|
|
607
627
|
return;
|
|
608
628
|
}
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
if (!failedAt) return null;
|
|
615
|
-
const ageMs = Date.now() - failedAt;
|
|
616
|
-
if (ageMs > FAILURE_BACKOFF_MS) return null;
|
|
617
|
-
return Math.round(ageMs / 1000);
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
export function getFailureMessage(state: McpExtensionState, serverName: string): string | null {
|
|
621
|
-
if (getFailureAgeSeconds(state, serverName) === null) return null;
|
|
622
|
-
return state.failureMessages?.get(serverName) ?? null;
|
|
629
|
+
const theme = ui.theme;
|
|
630
|
+
const styledStatus = typeof theme?.fg === "function"
|
|
631
|
+
? theme.fg("accent", formattedStatus)
|
|
632
|
+
: formattedStatus;
|
|
633
|
+
ui.setStatus("mcp", styledStatus);
|
|
623
634
|
}
|
|
624
635
|
|
|
625
636
|
export async function lazyConnect(state: McpExtensionState, serverName: string, signal?: AbortSignal): Promise<boolean> {
|
|
@@ -650,10 +661,10 @@ export async function lazyConnect(state: McpExtensionState, serverName: string,
|
|
|
650
661
|
if (newConnection.status === "needs-auth") {
|
|
651
662
|
return false;
|
|
652
663
|
}
|
|
653
|
-
clearFailure(state, serverName);
|
|
654
664
|
updateServerMetadata(state, serverName);
|
|
655
665
|
updateMetadataCache(state, serverName);
|
|
656
|
-
|
|
666
|
+
const restored = clearFailure(state, serverName, "lazy-connect");
|
|
667
|
+
if (!restored) notifyToolMetadataUpdated(state, serverName, "lazy-connect");
|
|
657
668
|
markKeepAliveAfterConnect(state, serverName);
|
|
658
669
|
updateStatusBar(state);
|
|
659
670
|
return true;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SdkError, SdkErrorCode } from "@modelcontextprotocol/client";
|
|
2
2
|
import { isServerDisabled, type ServerDefinition } from "./types.ts";
|
|
3
|
-
import type
|
|
3
|
+
import { isTransientHttpConnectError, type McpServerManager, type ServerConnection } from "./server-manager.ts";
|
|
4
4
|
import { hasPendingAuth } from "./mcp-auth-flow.ts";
|
|
5
5
|
import { logger } from "./logger.ts";
|
|
6
6
|
import { formatTerminalError, parallelLimit, sanitizeTerminalText } from "./utils.ts";
|
|
@@ -20,6 +20,7 @@ interface RetryState {
|
|
|
20
20
|
nextAttemptAt: number;
|
|
21
21
|
connection: ServerConnection | undefined;
|
|
22
22
|
status: ServerConnection["status"] | undefined;
|
|
23
|
+
warningReported: boolean;
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
export class McpLifecycleManager {
|
|
@@ -347,6 +348,12 @@ export class McpLifecycleManager {
|
|
|
347
348
|
return Date.now() >= retry.nextAttemptAt;
|
|
348
349
|
}
|
|
349
350
|
|
|
351
|
+
private connectionFailureTarget(action: "refresh" | "reconnect" | "publish", name: string): string {
|
|
352
|
+
if (action === "reconnect") return `reconnect to ${name}`;
|
|
353
|
+
if (action === "publish") return `publish metadata for ${name}`;
|
|
354
|
+
return `refresh ${name}`;
|
|
355
|
+
}
|
|
356
|
+
|
|
350
357
|
private reportConnectionFailure(
|
|
351
358
|
name: string,
|
|
352
359
|
definition: ServerDefinition,
|
|
@@ -356,13 +363,12 @@ export class McpLifecycleManager {
|
|
|
356
363
|
): void {
|
|
357
364
|
if (!this.recordRetry(name, definition, connection)) return;
|
|
358
365
|
this.onReconnectFailure?.(name, error);
|
|
366
|
+
if (isTransientHttpConnectError(error)) return;
|
|
367
|
+
const retry = this.retryStates.get(name);
|
|
368
|
+
if (retry?.warningReported) return;
|
|
369
|
+
if (retry) retry.warningReported = true;
|
|
359
370
|
const message = error instanceof Error ? error.message : String(error);
|
|
360
|
-
|
|
361
|
-
? `reconnect to ${name}`
|
|
362
|
-
: action === "publish"
|
|
363
|
-
? `publish metadata for ${name}`
|
|
364
|
-
: `refresh ${name}`;
|
|
365
|
-
console.error(`MCP: Failed to ${target}: ${sanitizeTerminalText(message)}`);
|
|
371
|
+
console.error(`MCP: Failed to ${this.connectionFailureTarget(action, name)}: ${sanitizeTerminalText(message)}`);
|
|
366
372
|
}
|
|
367
373
|
|
|
368
374
|
private deferRefreshTimeout(
|
|
@@ -382,7 +388,8 @@ export class McpLifecycleManager {
|
|
|
382
388
|
// Do not recreate retry/failure state from a stale convergence pass after
|
|
383
389
|
// disposal or a same-name replacement registration.
|
|
384
390
|
if (this.keepAliveServers.get(name) !== definition) return false;
|
|
385
|
-
const
|
|
391
|
+
const previous = this.retryStates.get(name);
|
|
392
|
+
const attempts = (previous?.attempts ?? 0) + 1;
|
|
386
393
|
const delay = Math.min(
|
|
387
394
|
KEEP_ALIVE_RETRY_BASE_MS * 2 ** Math.min(attempts - 1, 10),
|
|
388
395
|
KEEP_ALIVE_RETRY_MAX_MS,
|
|
@@ -392,6 +399,7 @@ export class McpLifecycleManager {
|
|
|
392
399
|
nextAttemptAt: Date.now() + delay,
|
|
393
400
|
connection,
|
|
394
401
|
status: connection?.status,
|
|
402
|
+
warningReported: previous?.warningReported ?? false,
|
|
395
403
|
});
|
|
396
404
|
return true;
|
|
397
405
|
}
|
|
@@ -75,6 +75,8 @@ type PendingAuth = {
|
|
|
75
75
|
authProvider: McpOAuthProvider
|
|
76
76
|
serverUrl: string
|
|
77
77
|
authorizationUrl: string
|
|
78
|
+
manualRedirect: boolean
|
|
79
|
+
manualCompletionController?: AbortController
|
|
78
80
|
discovery: AuthDiscovery
|
|
79
81
|
authStorageOptions: AuthStorageOptions
|
|
80
82
|
}
|
|
@@ -238,6 +240,25 @@ export function extractOAuthConfig(definition: ServerEntry): McpOAuthConfig {
|
|
|
238
240
|
}
|
|
239
241
|
config.logoUri = logoUri
|
|
240
242
|
}
|
|
243
|
+
if (definition.oauth?.authServerMetadataUrl !== undefined) {
|
|
244
|
+
if (typeof definition.oauth.authServerMetadataUrl !== "string") {
|
|
245
|
+
throw new Error("OAuth authServerMetadataUrl must be a string")
|
|
246
|
+
}
|
|
247
|
+
const authServerMetadataUrl = interpolateEnvVars(definition.oauth.authServerMetadataUrl).trim()
|
|
248
|
+
if (!authServerMetadataUrl) {
|
|
249
|
+
throw new Error("OAuth authServerMetadataUrl must not be empty")
|
|
250
|
+
}
|
|
251
|
+
let parsed: URL
|
|
252
|
+
try {
|
|
253
|
+
parsed = new URL(authServerMetadataUrl)
|
|
254
|
+
} catch {
|
|
255
|
+
throw new Error("OAuth authServerMetadataUrl must be an absolute https:// URL")
|
|
256
|
+
}
|
|
257
|
+
if (parsed.protocol !== "https:") {
|
|
258
|
+
throw new Error("OAuth authServerMetadataUrl must be an absolute https:// URL")
|
|
259
|
+
}
|
|
260
|
+
config.authServerMetadataUrl = authServerMetadataUrl
|
|
261
|
+
}
|
|
241
262
|
if (definition.oauth?.skipIssuerMetadataValidation !== undefined) {
|
|
242
263
|
if (typeof definition.oauth.skipIssuerMetadataValidation !== "boolean") {
|
|
243
264
|
throw new Error("OAuth skipIssuerMetadataValidation must be a boolean")
|
|
@@ -288,7 +309,11 @@ async function probeAuthDiscovery(serverUrl: string, definition?: ServerEntry, s
|
|
|
288
309
|
}
|
|
289
310
|
}
|
|
290
311
|
|
|
291
|
-
|
|
312
|
+
type OAuthRedirectTarget =
|
|
313
|
+
| { mode: "local"; port: number; callbackHost: string; callbackPath: string }
|
|
314
|
+
| { mode: "manual" }
|
|
315
|
+
|
|
316
|
+
function parseOAuthRedirectUri(redirectUri: string): OAuthRedirectTarget {
|
|
292
317
|
let url: URL
|
|
293
318
|
try {
|
|
294
319
|
url = new URL(redirectUri)
|
|
@@ -296,12 +321,6 @@ function parseOAuthRedirectUri(redirectUri: string): { port: number; callbackHos
|
|
|
296
321
|
throw new Error(`Invalid OAuth redirectUri: ${redirectUri}`, { cause: error })
|
|
297
322
|
}
|
|
298
323
|
|
|
299
|
-
const hostname = url.hostname.toLowerCase()
|
|
300
|
-
const isLocalhost = hostname === "localhost" || hostname === "127.0.0.1" || hostname === "[::1]" || hostname === "::1"
|
|
301
|
-
if (url.protocol !== "http:" || !isLocalhost) {
|
|
302
|
-
throw new Error("OAuth redirectUri must be an http:// localhost or loopback URI")
|
|
303
|
-
}
|
|
304
|
-
|
|
305
324
|
if (url.username || url.password) {
|
|
306
325
|
throw new Error("OAuth redirectUri must not include username or password")
|
|
307
326
|
}
|
|
@@ -310,17 +329,32 @@ function parseOAuthRedirectUri(redirectUri: string): { port: number; callbackHos
|
|
|
310
329
|
throw new Error("OAuth redirectUri must not include a fragment")
|
|
311
330
|
}
|
|
312
331
|
|
|
332
|
+
const hostname = url.hostname.toLowerCase()
|
|
333
|
+
const isLocalhost = hostname === "localhost" || hostname === "127.0.0.1" || hostname === "[::1]" || hostname === "::1"
|
|
334
|
+
if (url.port) {
|
|
335
|
+
const parsedPort = Number.parseInt(url.port, 10)
|
|
336
|
+
if (!Number.isInteger(parsedPort) || parsedPort <= 0 || parsedPort > 65535) {
|
|
337
|
+
throw new Error("OAuth redirectUri port must be a positive numeric port")
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
if (url.protocol === "https:" && !isLocalhost) {
|
|
341
|
+
return { mode: "manual" }
|
|
342
|
+
}
|
|
343
|
+
if (url.protocol !== "http:" || !isLocalhost) {
|
|
344
|
+
throw new Error("OAuth redirectUri must be an https:// URI or an http:// localhost or loopback URI")
|
|
345
|
+
}
|
|
346
|
+
|
|
313
347
|
if (!url.port) {
|
|
314
|
-
throw new Error("OAuth redirectUri must include an explicit numeric port")
|
|
348
|
+
throw new Error("OAuth localhost redirectUri must include an explicit numeric port")
|
|
315
349
|
}
|
|
316
350
|
|
|
317
351
|
const port = Number.parseInt(url.port, 10)
|
|
318
352
|
if (!Number.isInteger(port) || port <= 0 || port > 65535) {
|
|
319
|
-
throw new Error("OAuth redirectUri must include an explicit numeric port")
|
|
353
|
+
throw new Error("OAuth localhost redirectUri must include an explicit numeric port")
|
|
320
354
|
}
|
|
321
355
|
|
|
322
356
|
const callbackHost = hostname === "[::1]" ? "::1" : hostname
|
|
323
|
-
return { port, callbackHost, callbackPath: url.pathname }
|
|
357
|
+
return { mode: "local", port, callbackHost, callbackPath: url.pathname }
|
|
324
358
|
}
|
|
325
359
|
|
|
326
360
|
/**
|
|
@@ -374,25 +408,30 @@ export async function startAuth(
|
|
|
374
408
|
return { authorizationUrl: existingPendingAuth.authorizationUrl }
|
|
375
409
|
}
|
|
376
410
|
|
|
377
|
-
const
|
|
411
|
+
const redirectTarget = config.redirectUri !== undefined ? parseOAuthRedirectUri(config.redirectUri) : undefined
|
|
412
|
+
const manualRedirect = redirectTarget?.mode === "manual"
|
|
378
413
|
const oauthState = generateState()
|
|
379
414
|
|
|
380
|
-
|
|
381
|
-
await ensureCallbackServer({
|
|
382
|
-
strictPort: Boolean(config.clientId) || config.redirectUri !== undefined,
|
|
383
|
-
oauthState,
|
|
384
|
-
reserveState: true,
|
|
385
|
-
...(redirectCallback ? { port: redirectCallback.port, callbackHost: redirectCallback.callbackHost, callbackPath: redirectCallback.callbackPath } : {}),
|
|
386
|
-
})
|
|
387
|
-
throwIfAborted(signal)
|
|
388
|
-
} catch (error) {
|
|
389
|
-
releaseCallbackServer(oauthState)
|
|
415
|
+
if (!manualRedirect) {
|
|
390
416
|
try {
|
|
391
|
-
await
|
|
392
|
-
|
|
393
|
-
|
|
417
|
+
await ensureCallbackServer({
|
|
418
|
+
strictPort: Boolean(config.clientId) || config.redirectUri !== undefined,
|
|
419
|
+
oauthState,
|
|
420
|
+
reserveState: true,
|
|
421
|
+
...(redirectTarget?.mode === "local"
|
|
422
|
+
? { port: redirectTarget.port, callbackHost: redirectTarget.callbackHost, callbackPath: redirectTarget.callbackPath }
|
|
423
|
+
: {}),
|
|
424
|
+
})
|
|
425
|
+
throwIfAborted(signal)
|
|
426
|
+
} catch (error) {
|
|
427
|
+
releaseCallbackServer(oauthState)
|
|
428
|
+
try {
|
|
429
|
+
await cleanupAndReleaseCallbackServerIfIdle(() => clearOAuthState(serverName, authStorageOptions))
|
|
430
|
+
} catch (cleanupError) {
|
|
431
|
+
throw new AggregateError([error, cleanupError], "OAuth startup cleanup failed")
|
|
432
|
+
}
|
|
433
|
+
throw error
|
|
394
434
|
}
|
|
395
|
-
throw error
|
|
396
435
|
}
|
|
397
436
|
|
|
398
437
|
let capturedUrl: URL | undefined
|
|
@@ -436,7 +475,16 @@ export async function startAuth(
|
|
|
436
475
|
if (!capturedUrl) {
|
|
437
476
|
throw new UnauthorizedError("OAuth authorization URL was not provided")
|
|
438
477
|
}
|
|
439
|
-
await setPendingAuth(runtime, serverName, {
|
|
478
|
+
await setPendingAuth(runtime, serverName, {
|
|
479
|
+
serverName,
|
|
480
|
+
authProvider,
|
|
481
|
+
serverUrl,
|
|
482
|
+
authorizationUrl: capturedUrl.toString(),
|
|
483
|
+
manualRedirect,
|
|
484
|
+
...(manualRedirect ? { manualCompletionController: new AbortController() } : {}),
|
|
485
|
+
discovery,
|
|
486
|
+
authStorageOptions,
|
|
487
|
+
}, oauthState, signal, generation)
|
|
440
488
|
return { authorizationUrl: capturedUrl.toString() }
|
|
441
489
|
} catch (error) {
|
|
442
490
|
authProvider.deactivate()
|
|
@@ -465,7 +513,13 @@ async function setPendingAuth(
|
|
|
465
513
|
state.pendingAuths.set(key, pendingAuth)
|
|
466
514
|
state.pendingAuthStates.set(key, oauthState)
|
|
467
515
|
const cleanupTimer = setTimeout(() => {
|
|
468
|
-
void clearPendingAuthAndReleaseIfIdle(
|
|
516
|
+
void clearPendingAuthAndReleaseIfIdle(
|
|
517
|
+
runtime,
|
|
518
|
+
serverName,
|
|
519
|
+
oauthState,
|
|
520
|
+
pendingAuth.authStorageOptions,
|
|
521
|
+
new Error("OAuth authorization timeout - authorization took too long"),
|
|
522
|
+
).catch(error => {
|
|
469
523
|
console.error(`MCP Auth: Timed-out flow cleanup failed: ${formatTerminalError(error)}`)
|
|
470
524
|
})
|
|
471
525
|
}, MANUAL_AUTH_TIMEOUT_MS)
|
|
@@ -473,7 +527,13 @@ async function setPendingAuth(
|
|
|
473
527
|
state.pendingAuthCleanupTimers.set(key, cleanupTimer)
|
|
474
528
|
}
|
|
475
529
|
|
|
476
|
-
async function clearPendingAuth(
|
|
530
|
+
async function clearPendingAuth(
|
|
531
|
+
runtime: McpOAuthRuntime,
|
|
532
|
+
serverName: string,
|
|
533
|
+
oauthState?: string,
|
|
534
|
+
fallbackStorageOptions: AuthStorageOptions = {},
|
|
535
|
+
reason: Error = new Error("Authorization cancelled"),
|
|
536
|
+
): Promise<void> {
|
|
477
537
|
const state = getRuntimeState(runtime)
|
|
478
538
|
const key = getPendingAuthKey(serverName, fallbackStorageOptions)
|
|
479
539
|
const pendingAuth = state.pendingAuths.get(key)
|
|
@@ -487,6 +547,7 @@ async function clearPendingAuth(runtime: McpOAuthRuntime, serverName: string, oa
|
|
|
487
547
|
state.pendingAuthCleanupTimers.delete(key)
|
|
488
548
|
}
|
|
489
549
|
|
|
550
|
+
pendingAuth?.manualCompletionController?.abort(reason)
|
|
490
551
|
pendingAuth?.authProvider.deactivate()
|
|
491
552
|
state.pendingAuths.delete(key)
|
|
492
553
|
state.pendingAuthStates.delete(key)
|
|
@@ -505,9 +566,10 @@ async function clearPendingAuthAndReleaseIfIdle(
|
|
|
505
566
|
serverName: string,
|
|
506
567
|
oauthState: string | undefined,
|
|
507
568
|
fallbackStorageOptions: AuthStorageOptions = {},
|
|
569
|
+
reason?: Error,
|
|
508
570
|
): Promise<void> {
|
|
509
571
|
await cleanupAndReleaseCallbackServerIfIdle(
|
|
510
|
-
() => clearPendingAuth(runtime, serverName, oauthState, fallbackStorageOptions),
|
|
572
|
+
() => clearPendingAuth(runtime, serverName, oauthState, fallbackStorageOptions, reason),
|
|
511
573
|
)
|
|
512
574
|
}
|
|
513
575
|
|
|
@@ -610,6 +672,19 @@ type AuthorizationResponse = {
|
|
|
610
672
|
source: "callback" | "manual"
|
|
611
673
|
}
|
|
612
674
|
|
|
675
|
+
function waitForManualCompletionCancellation(signal: AbortSignal): Promise<AuthorizationCodeInput> {
|
|
676
|
+
return new Promise((_, reject) => {
|
|
677
|
+
const rejectFromSignal = () => {
|
|
678
|
+
reject(signal.reason instanceof Error ? signal.reason : new Error("Authorization cancelled"))
|
|
679
|
+
}
|
|
680
|
+
if (signal.aborted) {
|
|
681
|
+
rejectFromSignal()
|
|
682
|
+
return
|
|
683
|
+
}
|
|
684
|
+
signal.addEventListener("abort", rejectFromSignal, { once: true })
|
|
685
|
+
})
|
|
686
|
+
}
|
|
687
|
+
|
|
613
688
|
/**
|
|
614
689
|
* Wait for either the localhost callback or a manually pasted redirect URL.
|
|
615
690
|
* The manual input prompt is dismissed as soon as either path finishes.
|
|
@@ -667,7 +742,11 @@ export async function completeAuthFromInput(
|
|
|
667
742
|
throwIfAborted(signal)
|
|
668
743
|
const key = getPendingAuthKey(serverName, fallbackAuthStorageOptions)
|
|
669
744
|
const oauthState = runtimeState.pendingAuthStates.get(key)
|
|
745
|
+
const pendingAuth = runtimeState.pendingAuths.get(key)
|
|
670
746
|
throwIfAborted(signal)
|
|
747
|
+
if (pendingAuth?.manualRedirect && !getSearchParamsFromInput(input.trim())) {
|
|
748
|
+
throw new Error("Paste the full OAuth callback URL, including its code and state parameters")
|
|
749
|
+
}
|
|
671
750
|
const parsed = parseAuthorizationRedirectInput(input, oauthState)
|
|
672
751
|
return completeAuth(serverName, parsed, options)
|
|
673
752
|
}
|
|
@@ -786,15 +865,28 @@ export async function authenticate(
|
|
|
786
865
|
try {
|
|
787
866
|
// Get the state that was already generated and stored in startAuth().
|
|
788
867
|
// Keep this lookup and its abort check inside the cleanup boundary because
|
|
789
|
-
// startAuth
|
|
868
|
+
// startAuth already owns the pending flow at this point.
|
|
790
869
|
oauthState = runtimeState.pendingAuthStates.get(getPendingAuthKey(serverName, authStorageOptions))
|
|
791
870
|
throwIfAborted(signal)
|
|
792
871
|
if (!oauthState) {
|
|
793
872
|
throw new Error("OAuth state not found - this should not happen")
|
|
794
873
|
}
|
|
795
874
|
|
|
796
|
-
|
|
797
|
-
|
|
875
|
+
const pendingAuth = runtimeState.pendingAuths.get(getPendingAuthKey(serverName, authStorageOptions))
|
|
876
|
+
if (!pendingAuth) {
|
|
877
|
+
throw new Error(`No pending OAuth flow for server: ${serverName}`)
|
|
878
|
+
}
|
|
879
|
+
if (pendingAuth.manualRedirect && !options.onAuthorizationInput) {
|
|
880
|
+
throw new Error(
|
|
881
|
+
`OAuth for ${serverName} uses a remote redirect URI. Complete it with auth-start/auth-complete or /mcp-auth.`,
|
|
882
|
+
)
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
// Register the localhost callback before opening the browser. Remote
|
|
886
|
+
// pre-registered callbacks are completed by pasting their full URL.
|
|
887
|
+
const callbackPromise: Promise<AuthorizationCodeInput> = pendingAuth.manualRedirect
|
|
888
|
+
? waitForManualCompletionCancellation(pendingAuth.manualCompletionController!.signal)
|
|
889
|
+
: waitForCallback(oauthState)
|
|
798
890
|
void callbackPromise.catch(() => {})
|
|
799
891
|
|
|
800
892
|
// Open browser. Always surface the URL first so remote/headless users can copy it
|
|
@@ -43,8 +43,6 @@ export class BearerCredentialStoreError extends Error {
|
|
|
43
43
|
readonly code = "BEARER_CREDENTIAL_STORE_UNAVAILABLE";
|
|
44
44
|
readonly operation: "read" | "write" | "remove";
|
|
45
45
|
|
|
46
|
-
// No parameter properties: cli.js loads this module under plain Node
|
|
47
|
-
// type stripping, which rejects non-erasable TypeScript syntax.
|
|
48
46
|
constructor(message: string, operation: "read" | "write" | "remove", cause: unknown) {
|
|
49
47
|
super(message, { cause });
|
|
50
48
|
this.name = "BearerCredentialStoreError";
|
|
@@ -5,6 +5,7 @@ import { guardMcpOutput, guardedMcpDetails, resolveMcpOutputGuardOptions } from
|
|
|
5
5
|
import { executeCall } from "./proxy-modes.ts";
|
|
6
6
|
import { combineAbortSignals } from "./runtime-owner.ts";
|
|
7
7
|
import { paginate, rankSuggestions, rankToolMatches } from "./search-ranking.ts";
|
|
8
|
+
import { isServerInActiveFailureBackoff } from "./failure-backoff.ts";
|
|
8
9
|
import type { McpExtensionState } from "./state.ts";
|
|
9
10
|
import { findToolByName, formatSchema } from "./tool-metadata.ts";
|
|
10
11
|
import { renderTsShape } from "./ts-shape.ts";
|
|
@@ -202,6 +203,7 @@ export async function runMcpScript(
|
|
|
202
203
|
let error: unknown;
|
|
203
204
|
try {
|
|
204
205
|
for (const [server, metadata] of state.toolMetadata) {
|
|
206
|
+
if (isServerInActiveFailureBackoff(state, server)) continue;
|
|
205
207
|
const tool = findToolByName(metadata, path);
|
|
206
208
|
if (!tool) continue;
|
|
207
209
|
const inputTypeScript = tool.inputSchema
|