@humain/terminal 0.0.3-beta.3 → 0.0.4-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/README.md +1 -0
- package/dist/bun/cli.d.ts.map +1 -1
- package/dist/bun/cli.js.map +1 -1
- package/dist/bun/restore-sandbox-env.d.ts.map +1 -1
- package/dist/bun/restore-sandbox-env.js.map +1 -1
- package/dist/cli/args.d.ts +1 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +11 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/auth-check.d.ts.map +1 -1
- package/dist/cli/auth-check.js.map +1 -1
- package/dist/cli/auth-command.d.ts.map +1 -1
- package/dist/cli/auth-command.js.map +1 -1
- package/dist/cli/config-selector.d.ts.map +1 -1
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/cli/credential-print.d.ts.map +1 -1
- package/dist/cli/credential-print.js.map +1 -1
- package/dist/cli/experimental/auth.d.ts.map +1 -1
- package/dist/cli/experimental/auth.js.map +1 -1
- package/dist/cli/experimental/cli.d.ts.map +1 -1
- package/dist/cli/experimental/command-options.d.ts.map +1 -1
- package/dist/cli/experimental/command-options.js.map +1 -1
- package/dist/cli/experimental/command.d.ts.map +1 -1
- package/dist/cli/experimental/command.js +2 -5
- package/dist/cli/experimental/command.js.map +1 -1
- package/dist/cli/experimental/commands/client.d.ts.map +1 -1
- package/dist/cli/experimental/commands/client.js.map +1 -1
- package/dist/cli/experimental/commands/pi.d.ts.map +1 -1
- package/dist/cli/experimental/commands/pi.js.map +1 -1
- package/dist/cli/experimental/commands/server.d.ts.map +1 -1
- package/dist/cli/experimental/commands/server.js.map +1 -1
- package/dist/cli/experimental/transport-address.d.ts.map +1 -1
- package/dist/cli/experimental/transport-address.js.map +1 -1
- package/dist/cli/file-processor.d.ts.map +1 -1
- package/dist/cli/file-processor.js.map +1 -1
- package/dist/cli/initial-message.d.ts +1 -1
- package/dist/cli/initial-message.d.ts.map +1 -1
- package/dist/cli/initial-message.js.map +1 -1
- package/dist/cli/list-models.d.ts.map +1 -1
- package/dist/cli/list-models.js.map +1 -1
- package/dist/cli/project-trust.d.ts.map +1 -1
- package/dist/cli/project-trust.js.map +1 -1
- package/dist/cli/session-picker.d.ts.map +1 -1
- package/dist/cli/session-picker.js.map +1 -1
- package/dist/cli/startup-ui.d.ts.map +1 -1
- package/dist/cli/startup-ui.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/remote-session.d.ts.map +1 -1
- package/dist/client/remote-session.js.map +1 -1
- package/dist/client/transcript.d.ts.map +1 -1
- package/dist/client/transcript.js +1 -1
- package/dist/client/transcript.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +0 -8
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +36 -2
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +107 -129
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-guidance.d.ts.map +1 -1
- package/dist/core/auth-guidance.js.map +1 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +3 -8
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/cache-stats.d.ts.map +1 -1
- package/dist/core/cache-stats.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/compaction/index.d.ts.map +1 -1
- package/dist/core/compaction/utils.d.ts.map +1 -1
- package/dist/core/compaction/utils.js.map +1 -1
- package/dist/core/defaults.d.ts.map +1 -1
- package/dist/core/diagnostics.d.ts.map +1 -1
- package/dist/core/event-bus.d.ts.map +1 -1
- package/dist/core/event-bus.js.map +1 -1
- package/dist/core/exec.d.ts.map +1 -1
- package/dist/core/exec.js.map +1 -1
- package/dist/core/experimental.d.ts +4 -0
- package/dist/core/experimental.d.ts.map +1 -1
- package/dist/core/experimental.js +4 -0
- package/dist/core/experimental.js.map +1 -1
- package/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
- package/dist/core/export-html/ansi-to-html.js.map +1 -1
- package/dist/core/export-html/index.d.ts.map +1 -1
- package/dist/core/export-html/index.js.map +1 -1
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
- package/dist/core/export-html/tool-renderer.js.map +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +22 -30
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +4 -0
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/extensions/wrapper.d.ts.map +1 -1
- package/dist/core/extensions/wrapper.js.map +1 -1
- package/dist/core/footer-data-provider.d.ts.map +1 -1
- package/dist/core/footer-data-provider.js +17 -18
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/http-dispatcher.d.ts.map +1 -1
- package/dist/core/http-dispatcher.js.map +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/keybindings.d.ts +24 -0
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +0 -1
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.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 +1 -2
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +0 -1
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +15 -25
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/models-store.d.ts.map +1 -1
- package/dist/core/models-store.js +3 -4
- package/dist/core/models-store.js.map +1 -1
- package/dist/core/output-guard.d.ts.map +1 -1
- package/dist/core/output-guard.js.map +1 -1
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +0 -7
- 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.map +1 -1
- package/dist/core/project-trust.d.ts.map +1 -1
- package/dist/core/project-trust.js.map +1 -1
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/provider-attribution.d.ts.map +1 -1
- package/dist/core/provider-attribution.js.map +1 -1
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/radius.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.js.map +1 -1
- package/dist/core/resolve-config-value.d.ts.map +1 -1
- package/dist/core/resolve-config-value.js.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +0 -44
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/runtime-credentials.d.ts.map +1 -1
- package/dist/core/runtime-credentials.js +1 -2
- package/dist/core/runtime-credentials.js.map +1 -1
- package/dist/core/sdk.d.ts +5 -3
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +3 -2
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-cwd.d.ts.map +1 -1
- package/dist/core/session-cwd.js +0 -1
- package/dist/core/session-cwd.js.map +1 -1
- package/dist/core/session-manager.d.ts +4 -0
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +55 -35
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +6 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +19 -17
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/source-info.d.ts.map +1 -1
- package/dist/core/source-info.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +1 -1
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/telemetry.d.ts.map +1 -1
- package/dist/core/telemetry.js.map +1 -1
- package/dist/core/timings.d.ts.map +1 -1
- package/dist/core/timings.js.map +1 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +10 -5
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit-diff.d.ts.map +1 -1
- 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 +2 -0
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/file-mutation-queue.d.ts.map +1 -1
- package/dist/core/tools/file-mutation-queue.js.map +1 -1
- package/dist/core/tools/find.d.ts +1 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +1 -1
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +1 -1
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/index.d.ts +2 -1
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +9 -1
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/dist/core/tools/output-accumulator.js +12 -18
- package/dist/core/tools/output-accumulator.js.map +1 -1
- package/dist/core/tools/path-utils.d.ts.map +1 -1
- package/dist/core/tools/path-utils.js.map +1 -1
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +2 -0
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/render-utils.d.ts.map +1 -1
- package/dist/core/tools/render-utils.js.map +1 -1
- package/dist/core/tools/subagent.d.ts +82 -0
- package/dist/core/tools/subagent.d.ts.map +1 -0
- package/dist/core/tools/subagent.js +980 -0
- package/dist/core/tools/subagent.js.map +1 -0
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
- package/dist/core/tools/truncate.d.ts.map +1 -1
- package/dist/core/tools/truncate.js.map +1 -1
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +2 -1
- package/dist/core/tools/write.js.map +1 -1
- package/dist/core/trust-manager.d.ts.map +1 -1
- package/dist/core/trust-manager.js +0 -1
- package/dist/core/trust-manager.js.map +1 -1
- package/dist/core/usage-totals.d.ts.map +1 -1
- package/dist/core/usage-totals.js.map +1 -1
- package/dist/extensions/index.d.ts.map +1 -1
- package/dist/extensions/llama/client.d.ts.map +1 -1
- package/dist/extensions/llama/client.js +0 -2
- package/dist/extensions/llama/client.js.map +1 -1
- package/dist/extensions/llama/huggingface.d.ts.map +1 -1
- package/dist/extensions/llama/huggingface.js +0 -2
- package/dist/extensions/llama/huggingface.js.map +1 -1
- package/dist/extensions/llama/index.d.ts.map +1 -1
- 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.map +1 -1
- package/dist/extensions/llama/ui.d.ts.map +1 -1
- package/dist/extensions/llama/ui.js +12 -28
- package/dist/extensions/llama/ui.js.map +1 -1
- package/dist/humain/agent-execution-protocol.d.ts.map +1 -1
- package/dist/humain/agent-execution-protocol.js.map +1 -1
- package/dist/humain/agent-execution-runtime.d.ts.map +1 -1
- package/dist/humain/agent-execution-runtime.js.map +1 -1
- package/dist/humain/bedrock-provider/vendor/index.bundle.mjs +127 -7
- package/dist/humain/brand-logo.d.ts.map +1 -1
- package/dist/humain/index.d.ts.map +1 -1
- package/dist/humain/index.js.map +1 -1
- package/dist/humain/legacy-workflow-tiers.d.ts.map +1 -1
- package/dist/humain/legacy-workflow-tiers.js.map +1 -1
- package/dist/humain/mcp-adapter/vendor/CHANGELOG.md +36 -0
- package/dist/humain/mcp-adapter/vendor/README.md +47 -5
- package/dist/humain/mcp-adapter/vendor/cli.js +163 -1
- package/dist/humain/mcp-adapter/vendor/commands.ts +128 -22
- package/dist/humain/mcp-adapter/vendor/config.ts +25 -7
- package/dist/humain/mcp-adapter/vendor/direct-tools.ts +5 -4
- package/dist/humain/mcp-adapter/vendor/index.bundle.mjs +1663 -458
- package/dist/humain/mcp-adapter/vendor/index.ts +219 -32
- package/dist/humain/mcp-adapter/vendor/init.ts +36 -4
- package/dist/humain/mcp-adapter/vendor/lifecycle.ts +315 -24
- package/dist/humain/mcp-adapter/vendor/mcp-auth-flow.ts +39 -6
- package/dist/humain/mcp-adapter/vendor/mcp-bearer-store.ts +387 -0
- package/dist/humain/mcp-adapter/vendor/mcp-callback-server.ts +27 -3
- package/dist/humain/mcp-adapter/vendor/mcp-code.ts +4 -0
- package/dist/humain/mcp-adapter/vendor/mcp-panel.ts +42 -13
- package/dist/humain/mcp-adapter/vendor/metadata-cache.ts +32 -21
- package/dist/humain/mcp-adapter/vendor/package-mcp-loader.ts +168 -0
- package/dist/humain/mcp-adapter/vendor/package.json +179 -177
- package/dist/humain/mcp-adapter/vendor/proxy-modes.ts +5 -4
- package/dist/humain/mcp-adapter/vendor/request-headers-command.ts +31 -37
- package/dist/humain/mcp-adapter/vendor/search-ranking.ts +92 -22
- package/dist/humain/mcp-adapter/vendor/server-manager.ts +140 -2
- package/dist/humain/mcp-adapter/vendor/session-recovery.ts +7 -0
- package/dist/humain/mcp-adapter/vendor/tool-approval.ts +15 -2
- package/dist/humain/mcp-adapter/vendor/tool-result-renderer.ts +44 -4
- package/dist/humain/mcp-adapter/vendor/types.ts +2 -0
- package/dist/humain/mcp-adapter/vendor/ui-server.ts +18 -16
- package/dist/humain/mcp-adapter/vendor/utils.ts +70 -0
- package/dist/humain/mcp-adapter.d.ts.map +1 -1
- package/dist/humain/mcp-adapter.js.map +1 -1
- package/dist/humain/pi-agent-execution-host.d.ts.map +1 -1
- package/dist/humain/pi-agent-execution-host.js.map +1 -1
- package/dist/humain/web-access/host.d.ts.map +1 -1
- package/dist/humain/web-access/index.d.ts.map +1 -1
- package/dist/humain/web-access/index.js.map +1 -1
- package/dist/humain/web-access/vendor/activity.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/activity.js +7 -5
- package/dist/humain/web-access/vendor/activity.js.map +1 -1
- package/dist/humain/web-access/vendor/anysearch.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/anysearch.js +3 -2
- package/dist/humain/web-access/vendor/anysearch.js.map +1 -1
- package/dist/humain/web-access/vendor/auth-fetch.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/auth-fetch.js.map +1 -1
- package/dist/humain/web-access/vendor/bocha.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/bocha.js.map +1 -1
- package/dist/humain/web-access/vendor/brave.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/brave.js +14 -4
- package/dist/humain/web-access/vendor/brave.js.map +1 -1
- package/dist/humain/web-access/vendor/brightdata-unlocker.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/brightdata-unlocker.js.map +1 -1
- package/dist/humain/web-access/vendor/brightdata.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/brightdata.js.map +1 -1
- package/dist/humain/web-access/vendor/chrome-cookies.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/chrome-cookies.js +92 -14
- package/dist/humain/web-access/vendor/chrome-cookies.js.map +1 -1
- package/dist/humain/web-access/vendor/content-find.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/content-find.js.map +1 -1
- package/dist/humain/web-access/vendor/credential-source.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/credential-source.js +0 -2
- package/dist/humain/web-access/vendor/credential-source.js.map +1 -1
- package/dist/humain/web-access/vendor/curator-page.d.ts +3 -0
- package/dist/humain/web-access/vendor/curator-page.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/curator-page.js +4 -1
- package/dist/humain/web-access/vendor/curator-page.js.map +1 -1
- package/dist/humain/web-access/vendor/curator-server.d.ts +3 -0
- package/dist/humain/web-access/vendor/curator-server.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/curator-server.js +6 -0
- package/dist/humain/web-access/vendor/curator-server.js.map +1 -1
- package/dist/humain/web-access/vendor/data-uri-sanitize.d.ts +21 -0
- package/dist/humain/web-access/vendor/data-uri-sanitize.d.ts.map +1 -0
- package/dist/humain/web-access/vendor/data-uri-sanitize.js +373 -0
- package/dist/humain/web-access/vendor/data-uri-sanitize.js.map +1 -0
- package/dist/humain/web-access/vendor/datalab-pdf-extract.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/datalab-pdf-extract.js.map +1 -1
- package/dist/humain/web-access/vendor/declared-web-links.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/declared-web-links.js.map +1 -1
- package/dist/humain/web-access/vendor/duckduckgo.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/duckduckgo.js.map +1 -1
- package/dist/humain/web-access/vendor/exa.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/exa.js +16 -7
- package/dist/humain/web-access/vendor/exa.js.map +1 -1
- package/dist/humain/web-access/vendor/extract.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/extract.js +45 -5
- package/dist/humain/web-access/vendor/extract.js.map +1 -1
- package/dist/humain/web-access/vendor/feature-config.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/feature-config.js.map +1 -1
- package/dist/humain/web-access/vendor/fetch-params.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/fetch-params.js.map +1 -1
- package/dist/humain/web-access/vendor/firecrawl.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/firecrawl.js +15 -2
- package/dist/humain/web-access/vendor/firecrawl.js.map +1 -1
- package/dist/humain/web-access/vendor/gemini-api.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/gemini-api.js.map +1 -1
- package/dist/humain/web-access/vendor/gemini-pdf-extract.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/gemini-pdf-extract.js.map +1 -1
- package/dist/humain/web-access/vendor/gemini-search.d.ts +2 -2
- package/dist/humain/web-access/vendor/gemini-search.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/gemini-search.js +25 -8
- 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.map +1 -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.map +1 -1
- package/dist/humain/web-access/vendor/gemini-web.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/gemini-web.js.map +1 -1
- package/dist/humain/web-access/vendor/github-api.d.ts.map +1 -1
- 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 +69 -35
- package/dist/humain/web-access/vendor/github-extract.js.map +1 -1
- package/dist/humain/web-access/vendor/index.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/index.js +58 -54
- package/dist/humain/web-access/vendor/index.js.map +1 -1
- package/dist/humain/web-access/vendor/jina-search.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/jina-search.js.map +1 -1
- package/dist/humain/web-access/vendor/kagi.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/kagi.js.map +1 -1
- package/dist/humain/web-access/vendor/ollama.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/ollama.js.map +1 -1
- package/dist/humain/web-access/vendor/openai-search.d.ts +1 -1
- package/dist/humain/web-access/vendor/openai-search.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/openai-search.js +15 -5
- package/dist/humain/web-access/vendor/openai-search.js.map +1 -1
- package/dist/humain/web-access/vendor/page-query.d.ts +1 -2
- package/dist/humain/web-access/vendor/page-query.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/page-query.js +5 -2
- package/dist/humain/web-access/vendor/page-query.js.map +1 -1
- package/dist/humain/web-access/vendor/parallel-mcp.d.ts +10 -0
- package/dist/humain/web-access/vendor/parallel-mcp.d.ts.map +1 -0
- package/dist/humain/web-access/vendor/parallel-mcp.js +224 -0
- package/dist/humain/web-access/vendor/parallel-mcp.js.map +1 -0
- package/dist/humain/web-access/vendor/parallel.d.ts +1 -0
- package/dist/humain/web-access/vendor/parallel.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/parallel.js +2 -2
- package/dist/humain/web-access/vendor/parallel.js.map +1 -1
- package/dist/humain/web-access/vendor/pdf-extract.d.ts +1 -0
- package/dist/humain/web-access/vendor/pdf-extract.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/pdf-extract.js +15 -5
- package/dist/humain/web-access/vendor/pdf-extract.js.map +1 -1
- package/dist/humain/web-access/vendor/perplexity.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/perplexity.js.map +1 -1
- package/dist/humain/web-access/vendor/querit.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/querit.js.map +1 -1
- package/dist/humain/web-access/vendor/query-rewrite.d.ts +3 -0
- package/dist/humain/web-access/vendor/query-rewrite.d.ts.map +1 -0
- package/dist/humain/web-access/vendor/query-rewrite.js +42 -0
- package/dist/humain/web-access/vendor/query-rewrite.js.map +1 -0
- package/dist/humain/web-access/vendor/render-search-error.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/render-search-error.js.map +1 -1
- package/dist/humain/web-access/vendor/rsc-extract.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/rsc-extract.js.map +1 -1
- package/dist/humain/web-access/vendor/search1api.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/search1api.js.map +1 -1
- package/dist/humain/web-access/vendor/searchinfinity.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/searchinfinity.js.map +1 -1
- package/dist/humain/web-access/vendor/searxng.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/searxng.js.map +1 -1
- package/dist/humain/web-access/vendor/serpbase.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/serpbase.js.map +1 -1
- package/dist/humain/web-access/vendor/serpdive.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/serpdive.js.map +1 -1
- package/dist/humain/web-access/vendor/serper.d.ts +4 -0
- package/dist/humain/web-access/vendor/serper.d.ts.map +1 -0
- package/dist/humain/web-access/vendor/serper.js +206 -0
- package/dist/humain/web-access/vendor/serper.js.map +1 -0
- package/dist/humain/web-access/vendor/source-check.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/source-check.js.map +1 -1
- package/dist/humain/web-access/vendor/ssrf-protection.d.ts +2 -0
- package/dist/humain/web-access/vendor/ssrf-protection.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/ssrf-protection.js +11 -2
- package/dist/humain/web-access/vendor/ssrf-protection.js.map +1 -1
- package/dist/humain/web-access/vendor/storage.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/storage.js.map +1 -1
- package/dist/humain/web-access/vendor/summary-model-scope.d.ts +5 -0
- package/dist/humain/web-access/vendor/summary-model-scope.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/summary-model-scope.js +10 -5
- package/dist/humain/web-access/vendor/summary-model-scope.js.map +1 -1
- package/dist/humain/web-access/vendor/summary-review.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/summary-review.js +40 -14
- package/dist/humain/web-access/vendor/summary-review.js.map +1 -1
- package/dist/humain/web-access/vendor/tavily.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/tavily.js +14 -4
- package/dist/humain/web-access/vendor/tavily.js.map +1 -1
- package/dist/humain/web-access/vendor/tinyfish.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/tinyfish.js.map +1 -1
- package/dist/humain/web-access/vendor/utils.d.ts +10 -0
- package/dist/humain/web-access/vendor/utils.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/utils.js +70 -0
- package/dist/humain/web-access/vendor/utils.js.map +1 -1
- package/dist/humain/web-access/vendor/valyu.d.ts +6 -0
- package/dist/humain/web-access/vendor/valyu.d.ts.map +1 -0
- package/dist/humain/web-access/vendor/valyu.js +194 -0
- package/dist/humain/web-access/vendor/valyu.js.map +1 -0
- package/dist/humain/web-access/vendor/video-extract.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/video-extract.js.map +1 -1
- package/dist/humain/web-access/vendor/xai-search.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/xai-search.js.map +1 -1
- package/dist/humain/web-access/vendor/youtube-extract.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/youtube-extract.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +4 -0
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js.map +1 -1
- package/dist/modes/agent-exec-mode.d.ts.map +1 -1
- package/dist/modes/agent-exec-mode.js.map +1 -1
- package/dist/modes/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/armin.d.ts.map +1 -1
- package/dist/modes/interactive/components/armin.js +6 -10
- package/dist/modes/interactive/components/armin.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +2 -9
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js +4 -9
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -1
- package/dist/modes/interactive/components/bordered-loader.js +0 -3
- package/dist/modes/interactive/components/bordered-loader.js.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.js +1 -3
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.js +1 -3
- package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +5 -22
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -1
- package/dist/modes/interactive/components/countdown-timer.js +0 -5
- package/dist/modes/interactive/components/countdown-timer.js.map +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js +1 -8
- package/dist/modes/interactive/components/custom-editor.js.map +1 -1
- package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-entry.js +1 -4
- package/dist/modes/interactive/components/custom-entry.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-message.js +1 -7
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/daxnuts.d.ts.map +1 -1
- package/dist/modes/interactive/components/daxnuts.js +6 -8
- package/dist/modes/interactive/components/daxnuts.js.map +1 -1
- package/dist/modes/interactive/components/diff.d.ts.map +1 -1
- package/dist/modes/interactive/components/diff.js +2 -2
- package/dist/modes/interactive/components/diff.js.map +1 -1
- package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -1
- package/dist/modes/interactive/components/dynamic-border.js +0 -1
- package/dist/modes/interactive/components/dynamic-border.js.map +1 -1
- package/dist/modes/interactive/components/earendil-announcement.d.ts.map +1 -1
- package/dist/modes/interactive/components/earendil-announcement.js.map +1 -1
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-editor.js +1 -7
- package/dist/modes/interactive/components/extension-editor.js.map +1 -1
- package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-input.js +2 -8
- package/dist/modes/interactive/components/extension-input.js.map +1 -1
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-selector.js +1 -9
- package/dist/modes/interactive/components/extension-selector.js.map +1 -1
- package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -1
- package/dist/modes/interactive/components/first-time-setup.js +2 -4
- package/dist/modes/interactive/components/first-time-setup.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +1 -3
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +3 -9
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/markdown-transform.d.ts.map +1 -1
- package/dist/modes/interactive/components/markdown-transform.js.map +1 -1
- package/dist/modes/interactive/components/mermaid.d.ts.map +1 -1
- package/dist/modes/interactive/components/mermaid.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +14 -26
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +3 -11
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +9 -14
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector-search.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +33 -57
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +3 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +10 -14
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/show-images-selector.js +0 -1
- package/dist/modes/interactive/components/show-images-selector.js.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.js +1 -3
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
- package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
- package/dist/modes/interactive/components/status-indicator.js +0 -2
- package/dist/modes/interactive/components/status-indicator.js.map +1 -1
- package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/theme-selector.js +0 -2
- package/dist/modes/interactive/components/theme-selector.js.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +0 -1
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +19 -25
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +18 -34
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/components/trust-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/trust-selector.js +0 -6
- package/dist/modes/interactive/components/trust-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.js +3 -6
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message.js +0 -4
- package/dist/modes/interactive/components/user-message.js.map +1 -1
- package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -1
- package/dist/modes/interactive/components/visual-truncate.js.map +1 -1
- package/dist/modes/interactive/external-editor.d.ts.map +1 -1
- package/dist/modes/interactive/external-editor.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +18 -2
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +147 -137
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/model-catalog-refresh.d.ts +7 -0
- package/dist/modes/interactive/model-catalog-refresh.d.ts.map +1 -0
- package/dist/modes/interactive/model-catalog-refresh.js +36 -0
- package/dist/modes/interactive/model-catalog-refresh.js.map +1 -0
- package/dist/modes/interactive/model-search.d.ts.map +1 -1
- package/dist/modes/interactive/model-search.js.map +1 -1
- package/dist/modes/interactive/theme/dark.json +2 -0
- package/dist/modes/interactive/theme/light.json +2 -0
- package/dist/modes/interactive/theme/theme-controller.d.ts +10 -2
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-controller.js +25 -18
- package/dist/modes/interactive/theme/theme-controller.js.map +1 -1
- package/dist/modes/interactive/theme/theme-schema.json +9 -1
- package/dist/modes/interactive/theme/theme.d.ts +7 -5
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +12 -8
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/json-event.d.ts +4 -1
- package/dist/modes/json-event.d.ts.map +1 -1
- package/dist/modes/json-event.js +5 -2
- package/dist/modes/json-event.js.map +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/jsonl.d.ts.map +1 -1
- package/dist/modes/rpc/jsonl.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +9 -10
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/rpc-entry.d.ts.map +1 -1
- package/dist/rpc-entry.js.map +1 -1
- package/dist/server/create-harness.d.ts.map +1 -1
- package/dist/server/create-harness.js +2 -0
- package/dist/server/create-harness.js.map +1 -1
- package/dist/utils/abort.d.ts.map +1 -1
- package/dist/utils/abort.js.map +1 -1
- package/dist/utils/ansi.d.ts.map +1 -1
- package/dist/utils/ansi.js.map +1 -1
- package/dist/utils/changelog.d.ts.map +1 -1
- package/dist/utils/changelog.js.map +1 -1
- package/dist/utils/child-process.d.ts.map +1 -1
- package/dist/utils/child-process.js.map +1 -1
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js +1 -1
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/clipboard-native.d.ts.map +1 -1
- package/dist/utils/clipboard-native.js.map +1 -1
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/deprecation.d.ts.map +1 -1
- package/dist/utils/deprecation.js.map +1 -1
- package/dist/utils/exif-orientation.d.ts.map +1 -1
- package/dist/utils/exif-orientation.js.map +1 -1
- package/dist/utils/frontmatter.d.ts.map +1 -1
- package/dist/utils/frontmatter.js.map +1 -1
- package/dist/utils/fs-watch.d.ts.map +1 -1
- package/dist/utils/fs-watch.js.map +1 -1
- package/dist/utils/git.d.ts.map +1 -1
- package/dist/utils/git.js.map +1 -1
- package/dist/utils/html.d.ts.map +1 -1
- package/dist/utils/html.js.map +1 -1
- package/dist/utils/image-convert.d.ts.map +1 -1
- package/dist/utils/image-convert.js.map +1 -1
- package/dist/utils/image-process.d.ts.map +1 -1
- package/dist/utils/image-process.js.map +1 -1
- package/dist/utils/image-resize-core.d.ts.map +1 -1
- package/dist/utils/image-resize-core.js.map +1 -1
- package/dist/utils/image-resize-worker.d.ts.map +1 -1
- package/dist/utils/image-resize-worker.js.map +1 -1
- package/dist/utils/image-resize.d.ts.map +1 -1
- package/dist/utils/image-resize.js.map +1 -1
- package/dist/utils/json.d.ts.map +1 -1
- package/dist/utils/json.js.map +1 -1
- package/dist/utils/management-http.d.ts.map +1 -1
- package/dist/utils/management-http.js.map +1 -1
- package/dist/utils/mime.d.ts.map +1 -1
- package/dist/utils/mime.js.map +1 -1
- package/dist/utils/open-browser.d.ts.map +1 -1
- package/dist/utils/open-browser.js.map +1 -1
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/photon.d.ts.map +1 -1
- package/dist/utils/photon.js.map +1 -1
- package/dist/utils/pi-user-agent.d.ts.map +1 -1
- package/dist/utils/pi-user-agent.js.map +1 -1
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/sleep.d.ts.map +1 -1
- package/dist/utils/sleep.js.map +1 -1
- package/dist/utils/syntax-highlight.d.ts.map +1 -1
- package/dist/utils/syntax-highlight.js +1 -1
- package/dist/utils/syntax-highlight.js.map +1 -1
- package/dist/utils/tool-result-images.d.ts.map +1 -1
- package/dist/utils/tool-result-images.js.map +1 -1
- package/dist/utils/tools-manager.d.ts +10 -1
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +14 -19
- package/dist/utils/tools-manager.js.map +1 -1
- package/dist/utils/version-check.d.ts.map +1 -1
- package/dist/utils/version-check.js.map +1 -1
- package/dist/utils/windows-self-update.d.ts.map +1 -1
- package/dist/utils/windows-self-update.js.map +1 -1
- package/docs/compaction.md +3 -3
- package/docs/custom-provider.md +1 -1
- package/docs/environment-variables.md +1 -0
- package/docs/extensions.md +5 -1
- package/docs/json.md +6 -4
- package/docs/keybindings.md +8 -2
- package/docs/rpc.md +15 -4
- package/docs/sdk.md +9 -0
- package/docs/settings.md +31 -0
- package/docs/terminal-setup.md +23 -2
- package/docs/themes.md +23 -3
- package/docs/tui.md +2 -2
- package/docs/usage.md +3 -2
- package/examples/extensions/README.md +1 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +2 -2
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/minimal-mode.ts +6 -6
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +2 -2
- package/examples/extensions/subagent/README.md +24 -147
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +853 -661
- package/package.json +33 -33
- package/src/humain/mcp-adapter/UPSTREAM.md +1 -1
- package/src/humain/mcp-adapter/upstream.json +3 -3
- package/src/humain/mcp-adapter/vendor/CHANGELOG.md +36 -0
- package/src/humain/web-access/UPSTREAM.md +1 -1
- package/src/humain/web-access/upstream.json +4 -4
- package/examples/extensions/subagent/agents.ts +0 -126
- package/examples/extensions/subagent/index.ts +0 -1015
|
@@ -1,11 +1,26 @@
|
|
|
1
|
+
import { SdkError, SdkErrorCode } from "@modelcontextprotocol/client";
|
|
1
2
|
import { isServerDisabled, type ServerDefinition } from "./types.ts";
|
|
2
|
-
import type { McpServerManager } from "./server-manager.ts";
|
|
3
|
+
import type { McpServerManager, ServerConnection } from "./server-manager.ts";
|
|
3
4
|
import { hasPendingAuth } from "./mcp-auth-flow.ts";
|
|
4
5
|
import { logger } from "./logger.ts";
|
|
5
|
-
import { formatTerminalError, sanitizeTerminalText } from "./utils.ts";
|
|
6
|
+
import { formatTerminalError, parallelLimit, sanitizeTerminalText } from "./utils.ts";
|
|
7
|
+
import { isTerminatedSession } from "./session-recovery.ts";
|
|
6
8
|
|
|
7
|
-
export type ReconnectCallback = (serverName: string) => void
|
|
9
|
+
export type ReconnectCallback = (serverName: string) => void | Promise<void>;
|
|
8
10
|
export type ReconnectFailureCallback = (serverName: string, error: unknown) => void;
|
|
11
|
+
export type HealthRestoredCallback = (serverName: string) => void | Promise<void>;
|
|
12
|
+
export type AuthRequiredCallback = (serverName: string) => void | Promise<void>;
|
|
13
|
+
|
|
14
|
+
const KEEP_ALIVE_RETRY_BASE_MS = 30_000;
|
|
15
|
+
const KEEP_ALIVE_RETRY_MAX_MS = 5 * 60_000;
|
|
16
|
+
const KEEP_ALIVE_CHECK_CONCURRENCY = 10;
|
|
17
|
+
|
|
18
|
+
interface RetryState {
|
|
19
|
+
attempts: number;
|
|
20
|
+
nextAttemptAt: number;
|
|
21
|
+
connection: ServerConnection | undefined;
|
|
22
|
+
status: ServerConnection["status"] | undefined;
|
|
23
|
+
}
|
|
9
24
|
|
|
10
25
|
export class McpLifecycleManager {
|
|
11
26
|
private keepAliveServers = new Map<string, ServerDefinition>();
|
|
@@ -15,9 +30,14 @@ export class McpLifecycleManager {
|
|
|
15
30
|
private healthCheckInterval: NodeJS.Timeout | undefined;
|
|
16
31
|
private onReconnect: ReconnectCallback | undefined;
|
|
17
32
|
private onReconnectFailure: ReconnectFailureCallback | undefined;
|
|
33
|
+
private onHealthRestored: HealthRestoredCallback | undefined;
|
|
34
|
+
private onAuthRequired: AuthRequiredCallback | undefined;
|
|
18
35
|
private onIdleShutdown: ((serverName: string) => void) | undefined;
|
|
19
36
|
private activeHealthCheck: Promise<void> | undefined;
|
|
37
|
+
private activeConvergence: Promise<void> | undefined;
|
|
20
38
|
private shutdownPromise: Promise<void> | undefined;
|
|
39
|
+
private retryStates = new Map<string, RetryState>();
|
|
40
|
+
private pendingMetadataPublications = new Set<string>();
|
|
21
41
|
private stopped = false;
|
|
22
42
|
private removeHealthAbortListener: (() => void) | undefined;
|
|
23
43
|
|
|
@@ -34,6 +54,14 @@ export class McpLifecycleManager {
|
|
|
34
54
|
this.onReconnectFailure = callback;
|
|
35
55
|
}
|
|
36
56
|
|
|
57
|
+
setHealthRestoredCallback(callback: HealthRestoredCallback): void {
|
|
58
|
+
this.onHealthRestored = callback;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
setAuthRequiredCallback(callback: AuthRequiredCallback): void {
|
|
62
|
+
this.onAuthRequired = callback;
|
|
63
|
+
}
|
|
64
|
+
|
|
37
65
|
markKeepAlive(name: string, definition: ServerDefinition): void {
|
|
38
66
|
if (isServerDisabled(definition)) return;
|
|
39
67
|
this.keepAliveServers.set(name, definition);
|
|
@@ -45,6 +73,14 @@ export class McpLifecycleManager {
|
|
|
45
73
|
if (settings?.idleTimeout !== undefined) this.serverSettings.set(name, settings);
|
|
46
74
|
}
|
|
47
75
|
|
|
76
|
+
unregisterServer(name: string): void {
|
|
77
|
+
this.allServers.delete(name);
|
|
78
|
+
this.keepAliveServers.delete(name);
|
|
79
|
+
this.serverSettings.delete(name);
|
|
80
|
+
this.retryStates.delete(name);
|
|
81
|
+
this.pendingMetadataPublications.delete(name);
|
|
82
|
+
}
|
|
83
|
+
|
|
48
84
|
setGlobalIdleTimeout(minutes: number): void {
|
|
49
85
|
this.globalIdleTimeout = minutes * 60 * 1000;
|
|
50
86
|
}
|
|
@@ -82,29 +118,23 @@ export class McpLifecycleManager {
|
|
|
82
118
|
this.healthCheckInterval.unref();
|
|
83
119
|
}
|
|
84
120
|
|
|
85
|
-
|
|
121
|
+
async ensureConverged(signal?: AbortSignal): Promise<void> {
|
|
86
122
|
if (this.stopped || signal?.aborted) return;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
try {
|
|
96
|
-
await this.manager.connect(name, definition, signal);
|
|
97
|
-
if (this.stopped || signal?.aborted) return;
|
|
98
|
-
logger.debug(`Reconnected to ${name}`);
|
|
99
|
-
this.onReconnect?.(name);
|
|
100
|
-
} catch (error) {
|
|
101
|
-
if (this.stopped || signal?.aborted) return;
|
|
102
|
-
this.onReconnectFailure?.(name, error);
|
|
103
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
104
|
-
console.error(`MCP: Failed to reconnect to ${name}: ${sanitizeTerminalText(message)}`);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
123
|
+
if (this.activeConvergence) return this.activeConvergence;
|
|
124
|
+
|
|
125
|
+
const check = this.checkKeepAliveConnections(signal);
|
|
126
|
+
this.activeConvergence = check;
|
|
127
|
+
try {
|
|
128
|
+
await check;
|
|
129
|
+
} finally {
|
|
130
|
+
if (this.activeConvergence === check) this.activeConvergence = undefined;
|
|
107
131
|
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
private async checkConnections(signal?: AbortSignal): Promise<void> {
|
|
135
|
+
if (this.stopped || signal?.aborted) return;
|
|
136
|
+
await this.ensureConverged(signal);
|
|
137
|
+
if (this.stopped || signal?.aborted) return;
|
|
108
138
|
|
|
109
139
|
for (const [name] of this.allServers) {
|
|
110
140
|
if (this.keepAliveServers.has(name)) continue;
|
|
@@ -117,6 +147,255 @@ export class McpLifecycleManager {
|
|
|
117
147
|
}
|
|
118
148
|
}
|
|
119
149
|
|
|
150
|
+
private async checkKeepAliveConnections(signal?: AbortSignal): Promise<void> {
|
|
151
|
+
if (this.stopped || signal?.aborted) return;
|
|
152
|
+
await parallelLimit(
|
|
153
|
+
[...this.keepAliveServers],
|
|
154
|
+
KEEP_ALIVE_CHECK_CONCURRENCY,
|
|
155
|
+
([name, definition]) => this.checkKeepAliveConnection(name, definition, signal),
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
private async checkKeepAliveConnection(
|
|
160
|
+
name: string,
|
|
161
|
+
definition: ServerDefinition,
|
|
162
|
+
signal?: AbortSignal,
|
|
163
|
+
retrySuperseded = true,
|
|
164
|
+
): Promise<void> {
|
|
165
|
+
if (isServerDisabled(definition) || this.stopped || signal?.aborted) return;
|
|
166
|
+
// Fence against unregisterServer racing an in-flight convergence pass.
|
|
167
|
+
// Identity comparison also rejects stale passes after a same-name
|
|
168
|
+
// replacement registration, which a name check would wrongly accept.
|
|
169
|
+
if (this.keepAliveServers.get(name) !== definition) return;
|
|
170
|
+
const connection = this.manager.getConnection(name);
|
|
171
|
+
if (connection?.status === "needs-auth") {
|
|
172
|
+
this.pendingMetadataPublications.delete(name);
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
if (!this.shouldAttemptConnection(name, connection)) return;
|
|
176
|
+
if (!connection || connection.status !== "connected") {
|
|
177
|
+
if (this.hasPendingAuthForServer(name)) {
|
|
178
|
+
logger.debug(`Skipping reconnect for ${name} while OAuth authorization is pending`);
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
let freshConnection: ServerConnection;
|
|
182
|
+
try {
|
|
183
|
+
freshConnection = await this.manager.connect(name, definition, signal);
|
|
184
|
+
} catch (error) {
|
|
185
|
+
if (this.stopped || signal?.aborted) return;
|
|
186
|
+
this.reportConnectionFailure(name, definition, error, "reconnect", this.manager.getConnection(name));
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
if (this.stopped || signal?.aborted) return;
|
|
190
|
+
if (freshConnection.status === "needs-auth") {
|
|
191
|
+
await this.notifyAuthRequired(name, definition, freshConnection);
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
if (freshConnection.status !== "connected") {
|
|
195
|
+
this.reportConnectionFailure(
|
|
196
|
+
name,
|
|
197
|
+
definition,
|
|
198
|
+
new Error(`MCP server ${name} did not return a connected session`),
|
|
199
|
+
"reconnect",
|
|
200
|
+
freshConnection,
|
|
201
|
+
);
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
logger.debug(`Reconnected to ${name}`);
|
|
205
|
+
await this.publishConnectedMetadata(name, definition, freshConnection);
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
if (this.pendingMetadataPublications.has(name)) {
|
|
210
|
+
await this.publishConnectedMetadata(name, definition, connection);
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
if (!definition.url) return;
|
|
214
|
+
const hadSessionId = (connection.transport as { sessionId?: string } | undefined)?.sessionId != null;
|
|
215
|
+
let refreshResult: Awaited<ReturnType<McpServerManager["refreshTools"]>>;
|
|
216
|
+
try {
|
|
217
|
+
refreshResult = await this.manager.refreshTools(name, connection, signal);
|
|
218
|
+
} catch (error) {
|
|
219
|
+
if (this.stopped || signal?.aborted) return;
|
|
220
|
+
const current = this.manager.getConnection(name);
|
|
221
|
+
if (current !== connection || connection.status !== "connected") {
|
|
222
|
+
await this.handleSupersededConnection(name, definition, connection, signal, retrySuperseded);
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
if (!shouldReconnectAfterRefresh(error, hadSessionId)) {
|
|
226
|
+
this.reportConnectionFailure(name, definition, error, "refresh", connection);
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
if (this.hasPendingAuthForServer(name)) {
|
|
230
|
+
logger.debug(`Skipping reconnect for ${name} while OAuth authorization is pending`);
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
let freshConnection: ServerConnection;
|
|
234
|
+
try {
|
|
235
|
+
freshConnection = await this.manager.reconnect(name, definition, connection, signal);
|
|
236
|
+
} catch (reconnectError) {
|
|
237
|
+
if (this.stopped || signal?.aborted) return;
|
|
238
|
+
this.reportConnectionFailure(name, definition, reconnectError, "reconnect", this.manager.getConnection(name));
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
if (this.stopped || signal?.aborted) return;
|
|
242
|
+
if (freshConnection.status === "needs-auth") {
|
|
243
|
+
await this.notifyAuthRequired(name, definition, freshConnection);
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
if (freshConnection.status !== "connected") {
|
|
247
|
+
this.reportConnectionFailure(
|
|
248
|
+
name,
|
|
249
|
+
definition,
|
|
250
|
+
new Error(`MCP server ${name} did not return a connected session`),
|
|
251
|
+
"reconnect",
|
|
252
|
+
freshConnection,
|
|
253
|
+
);
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
logger.debug(`Reconnected stale MCP session for ${name}`);
|
|
257
|
+
await this.publishConnectedMetadata(name, definition, freshConnection);
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
if (refreshResult === "superseded") {
|
|
262
|
+
await this.handleSupersededConnection(name, definition, connection, signal, retrySuperseded);
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
if (refreshResult === "refresh-timeout") {
|
|
266
|
+
this.deferRefreshTimeout(name, definition, connection);
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
if (this.keepAliveServers.get(name) !== definition) return;
|
|
270
|
+
if (this.retryStates.delete(name)) {
|
|
271
|
+
await this.onHealthRestored?.(name);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
private async handleSupersededConnection(
|
|
276
|
+
name: string,
|
|
277
|
+
definition: ServerDefinition,
|
|
278
|
+
staleConnection: ServerConnection,
|
|
279
|
+
signal: AbortSignal | undefined,
|
|
280
|
+
retrySuperseded: boolean,
|
|
281
|
+
): Promise<void> {
|
|
282
|
+
const current = this.manager.getConnection(name);
|
|
283
|
+
if (this.keepAliveServers.get(name) !== definition) return;
|
|
284
|
+
if (current === staleConnection && current.status === "connected") {
|
|
285
|
+
if (this.retryStates.delete(name)) await this.onHealthRestored?.(name);
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
if (current?.status === "connected") {
|
|
289
|
+
await this.publishConnectedMetadata(name, definition, current);
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
if (current?.status === "needs-auth") {
|
|
293
|
+
await this.notifyAuthRequired(name, definition, current);
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
if (retrySuperseded) {
|
|
297
|
+
await this.checkKeepAliveConnection(name, definition, signal, false);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
private async publishConnectedMetadata(name: string, definition: ServerDefinition, connection: ServerConnection): Promise<void> {
|
|
302
|
+
// Fence stale convergence passes by definition identity so disposal, and
|
|
303
|
+
// disposal followed by a same-name replacement, never re-track this
|
|
304
|
+
// server. Close the pass's own connection only when it is still current,
|
|
305
|
+
// so a replacement's connection is never touched.
|
|
306
|
+
if (this.keepAliveServers.get(name) !== definition) {
|
|
307
|
+
if (this.manager.getConnection(name) === connection) await this.manager.close(name);
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
this.pendingMetadataPublications.add(name);
|
|
311
|
+
try {
|
|
312
|
+
await this.onReconnect?.(name);
|
|
313
|
+
this.pendingMetadataPublications.delete(name);
|
|
314
|
+
this.retryStates.delete(name);
|
|
315
|
+
} catch (error) {
|
|
316
|
+
if (this.stopped) return;
|
|
317
|
+
this.reportConnectionFailure(name, definition, error, "publish", connection);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
private async notifyAuthRequired(name: string, definition: ServerDefinition, connection: ServerConnection): Promise<void> {
|
|
322
|
+
// Fence stale convergence passes by definition identity. Close the
|
|
323
|
+
// leftover needs-auth connection only while it is still the manager's
|
|
324
|
+
// current entry, so a replacement's connection is never touched and the
|
|
325
|
+
// stale client/transport cannot leak when a replacement connects later.
|
|
326
|
+
if (this.keepAliveServers.get(name) !== definition) {
|
|
327
|
+
if (this.manager.getConnection(name) === connection) await this.manager.close(name);
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
this.pendingMetadataPublications.delete(name);
|
|
331
|
+
this.retryStates.delete(name);
|
|
332
|
+
try {
|
|
333
|
+
await this.onAuthRequired?.(name);
|
|
334
|
+
} catch (error) {
|
|
335
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
336
|
+
logger.debug(`MCP: auth-required callback failed for ${name}: ${sanitizeTerminalText(message)}`);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
private shouldAttemptConnection(name: string, connection: ServerConnection | undefined): boolean {
|
|
341
|
+
const retry = this.retryStates.get(name);
|
|
342
|
+
if (!retry) return true;
|
|
343
|
+
if (retry.connection !== connection || retry.status !== connection?.status) {
|
|
344
|
+
this.retryStates.delete(name);
|
|
345
|
+
return true;
|
|
346
|
+
}
|
|
347
|
+
return Date.now() >= retry.nextAttemptAt;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
private reportConnectionFailure(
|
|
351
|
+
name: string,
|
|
352
|
+
definition: ServerDefinition,
|
|
353
|
+
error: unknown,
|
|
354
|
+
action: "refresh" | "reconnect" | "publish",
|
|
355
|
+
connection: ServerConnection | undefined,
|
|
356
|
+
): void {
|
|
357
|
+
if (!this.recordRetry(name, definition, connection)) return;
|
|
358
|
+
this.onReconnectFailure?.(name, error);
|
|
359
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
360
|
+
const target = action === "reconnect"
|
|
361
|
+
? `reconnect to ${name}`
|
|
362
|
+
: action === "publish"
|
|
363
|
+
? `publish metadata for ${name}`
|
|
364
|
+
: `refresh ${name}`;
|
|
365
|
+
console.error(`MCP: Failed to ${target}: ${sanitizeTerminalText(message)}`);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
private deferRefreshTimeout(
|
|
369
|
+
name: string,
|
|
370
|
+
definition: ServerDefinition,
|
|
371
|
+
connection: ServerConnection | undefined,
|
|
372
|
+
): void {
|
|
373
|
+
if (!this.recordRetry(name, definition, connection)) return;
|
|
374
|
+
logger.debug(`MCP: keep-alive tools/list refresh timed out for ${name}; retrying after backoff`);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
private recordRetry(
|
|
378
|
+
name: string,
|
|
379
|
+
definition: ServerDefinition,
|
|
380
|
+
connection: ServerConnection | undefined,
|
|
381
|
+
): boolean {
|
|
382
|
+
// Do not recreate retry/failure state from a stale convergence pass after
|
|
383
|
+
// disposal or a same-name replacement registration.
|
|
384
|
+
if (this.keepAliveServers.get(name) !== definition) return false;
|
|
385
|
+
const attempts = (this.retryStates.get(name)?.attempts ?? 0) + 1;
|
|
386
|
+
const delay = Math.min(
|
|
387
|
+
KEEP_ALIVE_RETRY_BASE_MS * 2 ** Math.min(attempts - 1, 10),
|
|
388
|
+
KEEP_ALIVE_RETRY_MAX_MS,
|
|
389
|
+
);
|
|
390
|
+
this.retryStates.set(name, {
|
|
391
|
+
attempts,
|
|
392
|
+
nextAttemptAt: Date.now() + delay,
|
|
393
|
+
connection,
|
|
394
|
+
status: connection?.status,
|
|
395
|
+
});
|
|
396
|
+
return true;
|
|
397
|
+
}
|
|
398
|
+
|
|
120
399
|
private getIdleTimeout(name: string): number {
|
|
121
400
|
const perServer = this.serverSettings.get(name)?.idleTimeout;
|
|
122
401
|
if (perServer !== undefined) return perServer * 60 * 1000;
|
|
@@ -137,11 +416,23 @@ export class McpLifecycleManager {
|
|
|
137
416
|
this.removeHealthAbortListener = undefined;
|
|
138
417
|
await this.activeHealthCheck;
|
|
139
418
|
this.activeHealthCheck = undefined;
|
|
419
|
+
await this.activeConvergence;
|
|
420
|
+
this.activeConvergence = undefined;
|
|
140
421
|
this.onReconnect = undefined;
|
|
141
422
|
this.onReconnectFailure = undefined;
|
|
423
|
+
this.onHealthRestored = undefined;
|
|
424
|
+
this.onAuthRequired = undefined;
|
|
142
425
|
this.onIdleShutdown = undefined;
|
|
426
|
+
this.retryStates.clear();
|
|
427
|
+
this.pendingMetadataPublications.clear();
|
|
143
428
|
if (typeof this.manager.closeAll === "function") {
|
|
144
429
|
await this.manager.closeAll();
|
|
145
430
|
}
|
|
146
431
|
}
|
|
147
432
|
}
|
|
433
|
+
|
|
434
|
+
function shouldReconnectAfterRefresh(error: unknown, hadSessionId: boolean): boolean {
|
|
435
|
+
if (isTerminatedSession(error, hadSessionId)) return true;
|
|
436
|
+
return error instanceof SdkError
|
|
437
|
+
&& (error.code === SdkErrorCode.NotConnected || error.code === SdkErrorCode.ConnectionClosed);
|
|
438
|
+
}
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
waitForCallback,
|
|
19
19
|
cancelPendingCallback,
|
|
20
20
|
stopCallbackServer,
|
|
21
|
+
stopCallbackServerIfIdle,
|
|
21
22
|
releaseCallbackServer,
|
|
22
23
|
} from "./mcp-callback-server.ts"
|
|
23
24
|
import {
|
|
@@ -387,7 +388,7 @@ export async function startAuth(
|
|
|
387
388
|
} catch (error) {
|
|
388
389
|
releaseCallbackServer(oauthState)
|
|
389
390
|
try {
|
|
390
|
-
await clearOAuthState(serverName, authStorageOptions)
|
|
391
|
+
await cleanupAndReleaseCallbackServerIfIdle(() => clearOAuthState(serverName, authStorageOptions))
|
|
391
392
|
} catch (cleanupError) {
|
|
392
393
|
throw new AggregateError([error, cleanupError], "OAuth startup cleanup failed")
|
|
393
394
|
}
|
|
@@ -429,6 +430,7 @@ export async function startAuth(
|
|
|
429
430
|
authProvider.deactivate()
|
|
430
431
|
releaseCallbackServer(oauthState)
|
|
431
432
|
await clearOAuthState(serverName, authStorageOptions)
|
|
433
|
+
await stopCallbackServerIfIdle()
|
|
432
434
|
return { authorizationUrl: "" }
|
|
433
435
|
}
|
|
434
436
|
if (!capturedUrl) {
|
|
@@ -439,7 +441,7 @@ export async function startAuth(
|
|
|
439
441
|
} catch (error) {
|
|
440
442
|
authProvider.deactivate()
|
|
441
443
|
try {
|
|
442
|
-
await
|
|
444
|
+
await clearPendingAuthAndReleaseIfIdle(runtime, serverName, oauthState, authStorageOptions)
|
|
443
445
|
} catch (cleanupError) {
|
|
444
446
|
throw new AggregateError([error, cleanupError], "OAuth startup cleanup failed")
|
|
445
447
|
}
|
|
@@ -463,7 +465,7 @@ async function setPendingAuth(
|
|
|
463
465
|
state.pendingAuths.set(key, pendingAuth)
|
|
464
466
|
state.pendingAuthStates.set(key, oauthState)
|
|
465
467
|
const cleanupTimer = setTimeout(() => {
|
|
466
|
-
void
|
|
468
|
+
void clearPendingAuthAndReleaseIfIdle(runtime, serverName, oauthState, pendingAuth.authStorageOptions).catch(error => {
|
|
467
469
|
console.error(`MCP Auth: Timed-out flow cleanup failed: ${formatTerminalError(error)}`)
|
|
468
470
|
})
|
|
469
471
|
}, MANUAL_AUTH_TIMEOUT_MS)
|
|
@@ -498,6 +500,37 @@ async function clearPendingAuth(runtime: McpOAuthRuntime, serverName: string, oa
|
|
|
498
500
|
}
|
|
499
501
|
}
|
|
500
502
|
|
|
503
|
+
async function clearPendingAuthAndReleaseIfIdle(
|
|
504
|
+
runtime: McpOAuthRuntime,
|
|
505
|
+
serverName: string,
|
|
506
|
+
oauthState: string | undefined,
|
|
507
|
+
fallbackStorageOptions: AuthStorageOptions = {},
|
|
508
|
+
): Promise<void> {
|
|
509
|
+
await cleanupAndReleaseCallbackServerIfIdle(
|
|
510
|
+
() => clearPendingAuth(runtime, serverName, oauthState, fallbackStorageOptions),
|
|
511
|
+
)
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
async function cleanupAndReleaseCallbackServerIfIdle(cleanup: () => void | Promise<void>): Promise<void> {
|
|
515
|
+
let cleanupFailure: { error: unknown } | undefined
|
|
516
|
+
try {
|
|
517
|
+
await cleanup()
|
|
518
|
+
} catch (error) {
|
|
519
|
+
cleanupFailure = { error }
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
try {
|
|
523
|
+
await stopCallbackServerIfIdle()
|
|
524
|
+
} catch (releaseError) {
|
|
525
|
+
if (cleanupFailure) {
|
|
526
|
+
throw new AggregateError([cleanupFailure.error, releaseError], "OAuth callback cleanup failed")
|
|
527
|
+
}
|
|
528
|
+
throw releaseError
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
if (cleanupFailure) throw cleanupFailure.error
|
|
532
|
+
}
|
|
533
|
+
|
|
501
534
|
function getSearchParamsFromInput(input: string): URLSearchParams | undefined {
|
|
502
535
|
try {
|
|
503
536
|
const url = new URL(input)
|
|
@@ -701,7 +734,7 @@ export async function completeAuth(
|
|
|
701
734
|
} finally {
|
|
702
735
|
if (!keepPendingForRetry) {
|
|
703
736
|
try {
|
|
704
|
-
await
|
|
737
|
+
await clearPendingAuthAndReleaseIfIdle(runtime, serverName, oauthState, authStorageOptions)
|
|
705
738
|
} catch (cleanupError) {
|
|
706
739
|
if (caughtError !== undefined) {
|
|
707
740
|
throw new AggregateError([caughtError, cleanupError], "OAuth completion cleanup failed")
|
|
@@ -801,7 +834,7 @@ export async function authenticate(
|
|
|
801
834
|
} catch (error) {
|
|
802
835
|
if (oauthState) cancelPendingCallback(oauthState)
|
|
803
836
|
try {
|
|
804
|
-
await
|
|
837
|
+
await clearPendingAuthAndReleaseIfIdle(runtime, serverName, oauthState, authStorageOptions)
|
|
805
838
|
} catch (cleanupError) {
|
|
806
839
|
throw new AggregateError([error, cleanupError], "OAuth cancellation cleanup failed")
|
|
807
840
|
}
|
|
@@ -922,7 +955,7 @@ export async function removeAuth(serverName: string, options: AuthenticateOption
|
|
|
922
955
|
if (oauthState) {
|
|
923
956
|
cancelPendingCallback(oauthState)
|
|
924
957
|
}
|
|
925
|
-
await
|
|
958
|
+
await clearPendingAuthAndReleaseIfIdle(runtime, serverName, oauthState, authStorageOptions)
|
|
926
959
|
throwIfAborted(signal)
|
|
927
960
|
clearAllCredentials(serverName, authStorageOptions)
|
|
928
961
|
await clearOAuthState(serverName, authStorageOptions)
|