@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
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
|
|
5
|
+
type KeyringEntry = {
|
|
6
|
+
getPassword(): string | null;
|
|
7
|
+
setPassword(password: string): void;
|
|
8
|
+
deleteCredential(): boolean;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
type KeyringEntryConstructor = new (service: string, account: string) => KeyringEntry;
|
|
12
|
+
type KeyringModule = { Entry: KeyringEntryConstructor };
|
|
13
|
+
type KeyringRequire = ((id: string) => unknown) & { resolve(id: string): string };
|
|
14
|
+
|
|
15
|
+
type BearerSecretStore = {
|
|
16
|
+
read(account: string): string | undefined;
|
|
17
|
+
write(account: string, payload: string): void;
|
|
18
|
+
remove(account: string): void;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
interface StoredBearerTokenRecord {
|
|
22
|
+
token: string;
|
|
23
|
+
serverUrl: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface BearerChunkManifest {
|
|
27
|
+
__piMcpAdapterBearerChunked: 1;
|
|
28
|
+
chunkCount: number;
|
|
29
|
+
chunkDigest: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const require = createRequire(import.meta.url);
|
|
33
|
+
const BEARER_SECRET_SERVICE = "pi-mcp-adapter.bearer";
|
|
34
|
+
const TEST_AUTH_STORE_ENV = "PI_MCP_ADAPTER_TEST_AUTH_STORE";
|
|
35
|
+
const BEARER_SECRET_CHUNK_SIZE = 1000;
|
|
36
|
+
const BEARER_SECRET_VALUE_LIMIT = 1280;
|
|
37
|
+
|
|
38
|
+
let KeyringEntryClass: KeyringEntryConstructor | undefined;
|
|
39
|
+
const memoryBearerEntries = new Map<string, string>();
|
|
40
|
+
let testBearerSecretStoreReadCount = 0;
|
|
41
|
+
|
|
42
|
+
export class BearerCredentialStoreError extends Error {
|
|
43
|
+
readonly code = "BEARER_CREDENTIAL_STORE_UNAVAILABLE";
|
|
44
|
+
readonly operation: "read" | "write" | "remove";
|
|
45
|
+
|
|
46
|
+
// No parameter properties: cli.js loads this module under plain Node
|
|
47
|
+
// type stripping, which rejects non-erasable TypeScript syntax.
|
|
48
|
+
constructor(message: string, operation: "read" | "write" | "remove", cause: unknown) {
|
|
49
|
+
super(message, { cause });
|
|
50
|
+
this.name = "BearerCredentialStoreError";
|
|
51
|
+
this.operation = operation;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export type BearerCredentialStatus =
|
|
56
|
+
| { status: "present" }
|
|
57
|
+
| { status: "missing" }
|
|
58
|
+
| { status: "url-mismatch" }
|
|
59
|
+
| { status: "unavailable"; message: string };
|
|
60
|
+
|
|
61
|
+
const memoryBearerSecretStore: BearerSecretStore = {
|
|
62
|
+
read(account) {
|
|
63
|
+
testBearerSecretStoreReadCount++;
|
|
64
|
+
return memoryBearerEntries.get(account);
|
|
65
|
+
},
|
|
66
|
+
write(account, payload) {
|
|
67
|
+
memoryBearerEntries.set(account, payload);
|
|
68
|
+
},
|
|
69
|
+
remove(account) {
|
|
70
|
+
memoryBearerEntries.delete(account);
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const sizeLimitedBearerSecretStore: BearerSecretStore = {
|
|
75
|
+
read(account) {
|
|
76
|
+
testBearerSecretStoreReadCount++;
|
|
77
|
+
return memoryBearerEntries.get(account);
|
|
78
|
+
},
|
|
79
|
+
write(account, payload) {
|
|
80
|
+
if (payload.length > BEARER_SECRET_VALUE_LIMIT) {
|
|
81
|
+
throw new Error(`Value of 'password encoded as UTF-16' is longer than the platform limit of ${BEARER_SECRET_VALUE_LIMIT * 2} chars`);
|
|
82
|
+
}
|
|
83
|
+
memoryBearerEntries.set(account, payload);
|
|
84
|
+
},
|
|
85
|
+
remove(account) {
|
|
86
|
+
memoryBearerEntries.delete(account);
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const unavailableBearerSecretStore: BearerSecretStore = {
|
|
91
|
+
read() {
|
|
92
|
+
testBearerSecretStoreReadCount++;
|
|
93
|
+
throw new Error("simulated secure credential store unavailable");
|
|
94
|
+
},
|
|
95
|
+
write() {
|
|
96
|
+
throw new Error("simulated secure credential store unavailable");
|
|
97
|
+
},
|
|
98
|
+
remove() {
|
|
99
|
+
throw new Error("simulated secure credential store unavailable");
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const keyringBearerSecretStore: BearerSecretStore = {
|
|
104
|
+
read(account) {
|
|
105
|
+
return getKeyringEntry(account).getPassword() ?? undefined;
|
|
106
|
+
},
|
|
107
|
+
write(account, payload) {
|
|
108
|
+
getKeyringEntry(account).setPassword(payload);
|
|
109
|
+
},
|
|
110
|
+
remove(account) {
|
|
111
|
+
getKeyringEntry(account).deleteCredential();
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
function getBearerSecretStore(): BearerSecretStore {
|
|
116
|
+
if (process.env[TEST_AUTH_STORE_ENV] === "memory") return memoryBearerSecretStore;
|
|
117
|
+
if (process.env[TEST_AUTH_STORE_ENV] === "sizelimited") return sizeLimitedBearerSecretStore;
|
|
118
|
+
if (process.env[TEST_AUTH_STORE_ENV] === "unavailable") return unavailableBearerSecretStore;
|
|
119
|
+
return keyringBearerSecretStore;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function getKeyringEntry(account: string): KeyringEntry {
|
|
123
|
+
try {
|
|
124
|
+
KeyringEntryClass ??= loadKeyringEntryClass();
|
|
125
|
+
return new KeyringEntryClass(BEARER_SECRET_SERVICE, account);
|
|
126
|
+
} catch (error) {
|
|
127
|
+
throw new Error("Bearer token secure credential storage is unavailable. Configure the OS credential store and retry.", { cause: error });
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function loadKeyringEntryClass(keyringRequire: KeyringRequire = require, platform: NodeJS.Platform = process.platform, arch: NodeJS.Architecture = process.arch): KeyringEntryConstructor {
|
|
132
|
+
try {
|
|
133
|
+
return (keyringRequire("@napi-rs/keyring") as KeyringModule).Entry;
|
|
134
|
+
} catch (loaderError) {
|
|
135
|
+
try {
|
|
136
|
+
return loadKeyringNativeBindingFallback(keyringRequire, platform, arch).Entry;
|
|
137
|
+
} catch (fallbackError) {
|
|
138
|
+
const message = fallbackError instanceof Error ? fallbackError.message : String(fallbackError);
|
|
139
|
+
throw new Error(`Failed to load @napi-rs/keyring; absolute-path native binding fallback also failed: ${message}`, { cause: loaderError });
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function loadKeyringNativeBindingFallback(keyringRequire: KeyringRequire, platform: NodeJS.Platform, arch: NodeJS.Architecture): KeyringModule {
|
|
145
|
+
const targets = getKeyringNativeBindingSuffixes(platform, arch).map(suffix => ({
|
|
146
|
+
packageName: `@napi-rs/keyring-${suffix}`,
|
|
147
|
+
bindingFile: `keyring.${suffix}.node`,
|
|
148
|
+
}));
|
|
149
|
+
let lastError: unknown;
|
|
150
|
+
for (const target of targets) {
|
|
151
|
+
try {
|
|
152
|
+
const packageJsonPath = keyringRequire.resolve(`${target.packageName}/package.json`);
|
|
153
|
+
return keyringRequire(join(dirname(packageJsonPath), target.bindingFile)) as KeyringModule;
|
|
154
|
+
} catch (error) {
|
|
155
|
+
lastError = error;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
throw lastError instanceof Error ? lastError : new Error(String(lastError));
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function getKeyringNativeBindingSuffixes(platform: NodeJS.Platform, arch: NodeJS.Architecture): string[] {
|
|
162
|
+
if (platform === "darwin") {
|
|
163
|
+
if (arch === "arm64") return ["darwin-arm64"];
|
|
164
|
+
if (arch === "x64") return ["darwin-x64"];
|
|
165
|
+
}
|
|
166
|
+
if (platform === "win32") {
|
|
167
|
+
if (arch === "arm64") return ["win32-arm64-msvc"];
|
|
168
|
+
if (arch === "x64") return ["win32-x64-msvc"];
|
|
169
|
+
if (arch === "ia32") return ["win32-ia32-msvc"];
|
|
170
|
+
}
|
|
171
|
+
if (platform === "linux") {
|
|
172
|
+
if (arch === "arm64") return ["linux-arm64-gnu", "linux-arm64-musl"];
|
|
173
|
+
if (arch === "arm") return ["linux-arm-gnueabihf"];
|
|
174
|
+
if (arch === "riscv64") return ["linux-riscv64-gnu"];
|
|
175
|
+
if (arch === "x64") return ["linux-x64-gnu", "linux-x64-musl"];
|
|
176
|
+
}
|
|
177
|
+
if (platform === "freebsd" && arch === "x64") return ["freebsd-x64"];
|
|
178
|
+
return [];
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function getBearerAccount(serverName: string): string {
|
|
182
|
+
if (typeof serverName !== "string") {
|
|
183
|
+
throw new Error(`Invalid MCP server name: ${JSON.stringify(serverName)}`);
|
|
184
|
+
}
|
|
185
|
+
return `sha256-${createHash("sha256").update(serverName, "utf8").digest("hex")}`;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function parseBearerPayload(serverName: string, payload: string): StoredBearerTokenRecord {
|
|
189
|
+
const parsed = parseStoredBearerJson(serverName, payload);
|
|
190
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
191
|
+
throw new Error(`Stored bearer token record for ${serverName} has invalid shape`);
|
|
192
|
+
}
|
|
193
|
+
const record = parsed as Partial<StoredBearerTokenRecord>;
|
|
194
|
+
if (typeof record.token !== "string" || typeof record.serverUrl !== "string") {
|
|
195
|
+
throw new Error(`Stored bearer token record for ${serverName} has invalid shape`);
|
|
196
|
+
}
|
|
197
|
+
return { token: record.token, serverUrl: record.serverUrl };
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function parseStoredBearerJson(serverName: string, payload: string): unknown {
|
|
201
|
+
try {
|
|
202
|
+
return JSON.parse(payload) as unknown;
|
|
203
|
+
} catch {
|
|
204
|
+
throw new Error(`Failed to parse stored bearer token record for ${serverName}`);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function isBearerChunkManifest(value: unknown): value is BearerChunkManifest {
|
|
209
|
+
if (typeof value !== "object" || value === null) return false;
|
|
210
|
+
const manifest = value as Partial<BearerChunkManifest>;
|
|
211
|
+
return manifest.__piMcpAdapterBearerChunked === 1
|
|
212
|
+
&& typeof manifest.chunkCount === "number"
|
|
213
|
+
&& Number.isInteger(manifest.chunkCount)
|
|
214
|
+
&& manifest.chunkCount > 0
|
|
215
|
+
&& typeof manifest.chunkDigest === "string"
|
|
216
|
+
&& /^[a-f0-9]{16}$/.test(manifest.chunkDigest);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function readManifest(serverName: string, payload: string): BearerChunkManifest | undefined {
|
|
220
|
+
const parsed = parseStoredBearerJson(serverName, payload);
|
|
221
|
+
return isBearerChunkManifest(parsed) ? parsed : undefined;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
function chunkAccount(account: string, manifest: BearerChunkManifest, index: number): string {
|
|
225
|
+
return `${account}.chunk.${manifest.chunkDigest}.${index}`;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function chunkAccounts(account: string, manifest: BearerChunkManifest): string[] {
|
|
229
|
+
return Array.from({ length: manifest.chunkCount }, (_, index) => chunkAccount(account, manifest, index));
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
function createManifest(payload: string): BearerChunkManifest {
|
|
233
|
+
return {
|
|
234
|
+
__piMcpAdapterBearerChunked: 1,
|
|
235
|
+
chunkCount: Math.ceil(payload.length / BEARER_SECRET_CHUNK_SIZE),
|
|
236
|
+
chunkDigest: createHash("sha256").update(payload, "utf8").digest("hex").slice(0, 16),
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function readExistingManifest(store: BearerSecretStore, serverName: string, account: string): BearerChunkManifest | undefined {
|
|
241
|
+
try {
|
|
242
|
+
const payload = store.read(account);
|
|
243
|
+
return payload === undefined ? undefined : readManifest(serverName, payload);
|
|
244
|
+
} catch {
|
|
245
|
+
return undefined;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
function removeChunks(store: BearerSecretStore, account: string, manifest: BearerChunkManifest | undefined): void {
|
|
250
|
+
if (!manifest) return;
|
|
251
|
+
for (const accountName of chunkAccounts(account, manifest)) store.remove(accountName);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
function tryRemoveChunks(store: BearerSecretStore, account: string, manifest: BearerChunkManifest | undefined): void {
|
|
255
|
+
try {
|
|
256
|
+
removeChunks(store, account, manifest);
|
|
257
|
+
} catch {
|
|
258
|
+
// Stale chunk cleanup must not hide a successful credential write.
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
function readBearerRecordFromStore(store: BearerSecretStore, serverName: string): StoredBearerTokenRecord | undefined {
|
|
263
|
+
const account = getBearerAccount(serverName);
|
|
264
|
+
let payload: string | undefined;
|
|
265
|
+
try {
|
|
266
|
+
payload = store.read(account);
|
|
267
|
+
} catch (error) {
|
|
268
|
+
throw new BearerCredentialStoreError(
|
|
269
|
+
`Failed to read bearer token for ${serverName} from the OS secure credential store`,
|
|
270
|
+
"read",
|
|
271
|
+
error,
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
if (payload === undefined) return undefined;
|
|
275
|
+
try {
|
|
276
|
+
const manifest = readManifest(serverName, payload);
|
|
277
|
+
const recordPayload = manifest
|
|
278
|
+
? chunkAccounts(account, manifest).map((chunkName) => {
|
|
279
|
+
const chunk = store.read(chunkName);
|
|
280
|
+
if (chunk === undefined) throw new Error(`Missing bearer token chunk for ${serverName}`);
|
|
281
|
+
return chunk;
|
|
282
|
+
}).join("")
|
|
283
|
+
: payload;
|
|
284
|
+
return parseBearerPayload(serverName, recordPayload);
|
|
285
|
+
} catch (error) {
|
|
286
|
+
throw new BearerCredentialStoreError(
|
|
287
|
+
`Failed to read bearer token for ${serverName} from the OS secure credential store`,
|
|
288
|
+
"read",
|
|
289
|
+
error,
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
function writeBearerRecordToStore(store: BearerSecretStore, serverName: string, record: StoredBearerTokenRecord): void {
|
|
295
|
+
const account = getBearerAccount(serverName);
|
|
296
|
+
const payload = JSON.stringify(record);
|
|
297
|
+
const previousManifest = readExistingManifest(store, serverName, account);
|
|
298
|
+
const manifest = payload.length > BEARER_SECRET_CHUNK_SIZE ? createManifest(payload) : undefined;
|
|
299
|
+
try {
|
|
300
|
+
if (manifest) {
|
|
301
|
+
for (let index = 0; index < manifest.chunkCount; index++) {
|
|
302
|
+
store.write(chunkAccount(account, manifest, index), payload.slice(index * BEARER_SECRET_CHUNK_SIZE, (index + 1) * BEARER_SECRET_CHUNK_SIZE));
|
|
303
|
+
}
|
|
304
|
+
store.write(account, JSON.stringify(manifest));
|
|
305
|
+
} else {
|
|
306
|
+
store.write(account, payload);
|
|
307
|
+
}
|
|
308
|
+
if (previousManifest?.chunkDigest !== manifest?.chunkDigest) {
|
|
309
|
+
tryRemoveChunks(store, account, previousManifest);
|
|
310
|
+
}
|
|
311
|
+
} catch (error) {
|
|
312
|
+
// An identical payload reuses the previous manifest's digest-keyed chunk
|
|
313
|
+
// accounts. Removing them on a failed rewrite would destroy the still
|
|
314
|
+
// installed previous credential, so clean up only digest-distinct chunks.
|
|
315
|
+
if (previousManifest?.chunkDigest !== manifest?.chunkDigest) {
|
|
316
|
+
tryRemoveChunks(store, account, manifest);
|
|
317
|
+
}
|
|
318
|
+
throw new BearerCredentialStoreError(
|
|
319
|
+
`Failed to write bearer token for ${serverName} to the OS secure credential store`,
|
|
320
|
+
"write",
|
|
321
|
+
error,
|
|
322
|
+
);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
function removeBearerRecordFromStore(store: BearerSecretStore, serverName: string): void {
|
|
327
|
+
const account = getBearerAccount(serverName);
|
|
328
|
+
try {
|
|
329
|
+
const payload = store.read(account);
|
|
330
|
+
const manifest = payload === undefined ? undefined : readManifest(serverName, payload);
|
|
331
|
+
removeChunks(store, account, manifest);
|
|
332
|
+
store.remove(account);
|
|
333
|
+
} catch (error) {
|
|
334
|
+
throw new BearerCredentialStoreError(
|
|
335
|
+
`Failed to remove bearer token for ${serverName} from the OS secure credential store`,
|
|
336
|
+
"remove",
|
|
337
|
+
error,
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
export function getBearerTokenForUrl(serverName: string, serverUrl: string): string | undefined {
|
|
343
|
+
const record = readBearerRecordFromStore(getBearerSecretStore(), serverName);
|
|
344
|
+
if (!record) return undefined;
|
|
345
|
+
return record.serverUrl === serverUrl ? record.token : undefined;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
export function saveBearerTokenForUrl(serverName: string, token: string, serverUrl: string): void {
|
|
349
|
+
writeBearerRecordToStore(getBearerSecretStore(), serverName, { token, serverUrl });
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
export function removeBearerToken(serverName: string): void {
|
|
353
|
+
removeBearerRecordFromStore(getBearerSecretStore(), serverName);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
export function inspectBearerTokenForUrl(serverName: string, serverUrl: string): BearerCredentialStatus {
|
|
357
|
+
try {
|
|
358
|
+
const record = readBearerRecordFromStore(getBearerSecretStore(), serverName);
|
|
359
|
+
if (!record) return { status: "missing" };
|
|
360
|
+
if (record.serverUrl !== serverUrl) return { status: "url-mismatch" };
|
|
361
|
+
return { status: "present" };
|
|
362
|
+
} catch (error) {
|
|
363
|
+
if (!(error instanceof BearerCredentialStoreError)) throw error;
|
|
364
|
+
return { status: "unavailable", message: "Bearer token secure credential store unavailable. Configure or unlock the OS credential store and retry." };
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
export function resetTestBearerTokenStore(): void {
|
|
369
|
+
memoryBearerEntries.clear();
|
|
370
|
+
testBearerSecretStoreReadCount = 0;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
export function getTestBearerTokenStoreEntries(): [string, string][] {
|
|
374
|
+
return [...memoryBearerEntries.entries()];
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
export function removeTestBearerTokenStoreEntry(account: string): void {
|
|
378
|
+
memoryBearerEntries.delete(account);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
export function setTestBearerTokenStoreEntry(account: string, payload: string): void {
|
|
382
|
+
memoryBearerEntries.set(account, payload);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
export function getTestBearerTokenStoreReadCount(): number {
|
|
386
|
+
return testBearerSecretStoreReadCount;
|
|
387
|
+
}
|
|
@@ -180,6 +180,7 @@ interface PendingAuth {
|
|
|
180
180
|
let server: Server | undefined
|
|
181
181
|
let bindingPromise: Promise<void> | undefined
|
|
182
182
|
let stoppingPromise: Promise<void> | undefined
|
|
183
|
+
let restartableStoppingPromise: Promise<void> | undefined
|
|
183
184
|
let callbackGeneration = 0
|
|
184
185
|
const pendingAuths = new Map<string, PendingAuth>()
|
|
185
186
|
const reservedAuthStates = new Set<string>()
|
|
@@ -288,10 +289,16 @@ function handleRequest(req: IncomingMessage, res: ServerResponse): void {
|
|
|
288
289
|
* If strictPort is false, asks the OS for an available local port.
|
|
289
290
|
*/
|
|
290
291
|
export async function ensureCallbackServer(options: EnsureCallbackServerOptions = {}): Promise<void> {
|
|
292
|
+
const generation = callbackGeneration
|
|
291
293
|
if (stoppingPromise) {
|
|
292
|
-
|
|
294
|
+
if (!restartableStoppingPromise) {
|
|
295
|
+
throw new Error("OAuth callback server stopped")
|
|
296
|
+
}
|
|
297
|
+
await restartableStoppingPromise
|
|
298
|
+
if (generation !== callbackGeneration) {
|
|
299
|
+
throw new Error("OAuth callback server stopped")
|
|
300
|
+
}
|
|
293
301
|
}
|
|
294
|
-
const generation = callbackGeneration
|
|
295
302
|
while (bindingPromise) {
|
|
296
303
|
await bindingPromise
|
|
297
304
|
if (generation !== callbackGeneration) {
|
|
@@ -455,7 +462,11 @@ export function cancelPendingCallback(oauthState: string): void {
|
|
|
455
462
|
* Stop the callback server and reject all pending authorizations.
|
|
456
463
|
*/
|
|
457
464
|
export function stopCallbackServer(): Promise<void> {
|
|
458
|
-
if (stoppingPromise)
|
|
465
|
+
if (stoppingPromise) {
|
|
466
|
+
restartableStoppingPromise = undefined
|
|
467
|
+
callbackGeneration += 1
|
|
468
|
+
return stoppingPromise
|
|
469
|
+
}
|
|
459
470
|
|
|
460
471
|
callbackGeneration += 1
|
|
461
472
|
const cleanup = (async () => {
|
|
@@ -495,6 +506,19 @@ export function stopCallbackServer(): Promise<void> {
|
|
|
495
506
|
return operation
|
|
496
507
|
}
|
|
497
508
|
|
|
509
|
+
/** Stop the callback server only when no bind or authorization owns it. */
|
|
510
|
+
export function stopCallbackServerIfIdle(): Promise<void> {
|
|
511
|
+
if (stoppingPromise) return stoppingPromise
|
|
512
|
+
if (bindingPromise || !server || pendingAuths.size > 0 || reservedAuthStates.size > 0) {
|
|
513
|
+
return Promise.resolve()
|
|
514
|
+
}
|
|
515
|
+
const operation = stopCallbackServer().finally(() => {
|
|
516
|
+
if (restartableStoppingPromise === operation) restartableStoppingPromise = undefined
|
|
517
|
+
})
|
|
518
|
+
restartableStoppingPromise = operation
|
|
519
|
+
return operation
|
|
520
|
+
}
|
|
521
|
+
|
|
498
522
|
/**
|
|
499
523
|
* Check if the callback server is running.
|
|
500
524
|
*/
|
|
@@ -249,6 +249,10 @@ export async function runMcpScript(
|
|
|
249
249
|
worker = new Worker(new URL("./mcp-script-worker.mjs", import.meta.url), {
|
|
250
250
|
workerData: { code },
|
|
251
251
|
env: {},
|
|
252
|
+
// The sandbox cannot open files, and the host always terminates this worker.
|
|
253
|
+
// Disable Node's unmanaged FD bookkeeping, which emits false warnings when
|
|
254
|
+
// short-lived workers are terminated on Node 24.
|
|
255
|
+
trackUnmanagedFds: false,
|
|
252
256
|
});
|
|
253
257
|
const activeWorker = worker;
|
|
254
258
|
const execution = new Promise<void>((resolve, reject) => {
|
|
@@ -137,6 +137,8 @@ interface ServerState {
|
|
|
137
137
|
connectionStatus: ConnectionStatus;
|
|
138
138
|
failureMessage?: string | null;
|
|
139
139
|
tools: ToolState[];
|
|
140
|
+
directCount: number;
|
|
141
|
+
directTokens: number;
|
|
140
142
|
hasCachedData: boolean;
|
|
141
143
|
}
|
|
142
144
|
|
|
@@ -241,7 +243,13 @@ class McpPanel {
|
|
|
241
243
|
|
|
242
244
|
const status = callbacks.getConnectionStatus(serverName);
|
|
243
245
|
const failureMessage = callbacks.getFailureMessage?.(serverName) ?? null;
|
|
244
|
-
|
|
246
|
+
let directCount = 0;
|
|
247
|
+
let directTokens = 0;
|
|
248
|
+
for (const tool of tools) {
|
|
249
|
+
if (!tool.isDirect) continue;
|
|
250
|
+
directCount++;
|
|
251
|
+
directTokens += tool.estimatedTokens;
|
|
252
|
+
}
|
|
245
253
|
this.servers.push({
|
|
246
254
|
name: serverName,
|
|
247
255
|
expanded: false,
|
|
@@ -253,6 +261,8 @@ class McpPanel {
|
|
|
253
261
|
connectionStatus: status,
|
|
254
262
|
failureMessage,
|
|
255
263
|
tools,
|
|
264
|
+
directCount,
|
|
265
|
+
directTokens,
|
|
256
266
|
hasCachedData: !!serverCache,
|
|
257
267
|
});
|
|
258
268
|
}
|
|
@@ -444,7 +454,7 @@ class McpPanel {
|
|
|
444
454
|
} else if (item.toolIndex !== undefined) {
|
|
445
455
|
const tool = server.tools[item.toolIndex];
|
|
446
456
|
if (!tool) return;
|
|
447
|
-
|
|
457
|
+
this.toggleToolDirect(server, tool);
|
|
448
458
|
if (tool.isDirect && server.source === "import") {
|
|
449
459
|
this.importNotice = `Imported from ${sanitizeDisplayText(server.importKind ?? "external")} — will copy to user config on save`;
|
|
450
460
|
}
|
|
@@ -595,11 +605,17 @@ class McpPanel {
|
|
|
595
605
|
if (server.source === "import" && newState) {
|
|
596
606
|
this.importNotice = `Imported from ${sanitizeDisplayText(server.importKind ?? "external")} — will copy to user config on save`;
|
|
597
607
|
}
|
|
598
|
-
|
|
608
|
+
let directTokens = 0;
|
|
609
|
+
for (const tool of server.tools) {
|
|
610
|
+
tool.isDirect = newState;
|
|
611
|
+
if (newState) directTokens += tool.estimatedTokens;
|
|
612
|
+
}
|
|
613
|
+
server.directCount = newState ? server.tools.length : 0;
|
|
614
|
+
server.directTokens = directTokens;
|
|
599
615
|
} else if (item.toolIndex !== undefined) {
|
|
600
616
|
const tool = server.tools[item.toolIndex];
|
|
601
617
|
if (!tool) return;
|
|
602
|
-
|
|
618
|
+
this.toggleToolDirect(server, tool);
|
|
603
619
|
if (tool.isDirect && server.source === "import") {
|
|
604
620
|
this.importNotice = `Imported from ${sanitizeDisplayText(server.importKind ?? "external")} — will copy to user config on save`;
|
|
605
621
|
}
|
|
@@ -607,6 +623,12 @@ class McpPanel {
|
|
|
607
623
|
this.updateDirty();
|
|
608
624
|
}
|
|
609
625
|
|
|
626
|
+
private toggleToolDirect(server: ServerState, tool: ToolState): void {
|
|
627
|
+
tool.isDirect = !tool.isDirect;
|
|
628
|
+
server.directCount += tool.isDirect ? 1 : -1;
|
|
629
|
+
server.directTokens += tool.isDirect ? tool.estimatedTokens : -tool.estimatedTokens;
|
|
630
|
+
}
|
|
631
|
+
|
|
610
632
|
private handleDiscardInput(data: string): void {
|
|
611
633
|
if (matchesKey(data, "ctrl+c")) {
|
|
612
634
|
this.cleanup();
|
|
@@ -717,6 +739,13 @@ class McpPanel {
|
|
|
717
739
|
}
|
|
718
740
|
|
|
719
741
|
server.tools = newTools;
|
|
742
|
+
server.directCount = 0;
|
|
743
|
+
server.directTokens = 0;
|
|
744
|
+
for (const tool of newTools) {
|
|
745
|
+
if (!tool.isDirect) continue;
|
|
746
|
+
server.directCount++;
|
|
747
|
+
server.directTokens += tool.estimatedTokens;
|
|
748
|
+
}
|
|
720
749
|
this.rebuildVisibleItems();
|
|
721
750
|
this.updateDirty();
|
|
722
751
|
}
|
|
@@ -826,13 +855,14 @@ class McpPanel {
|
|
|
826
855
|
if (this.authOnly) {
|
|
827
856
|
lines.push(row(fg(t.description, "select a server to authenticate")));
|
|
828
857
|
} else {
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
858
|
+
let directCount = 0;
|
|
859
|
+
let directTokens = 0;
|
|
860
|
+
for (const server of this.servers) {
|
|
861
|
+
directCount += server.directCount;
|
|
862
|
+
directTokens += server.directTokens;
|
|
863
|
+
}
|
|
834
864
|
const stats =
|
|
835
|
-
directCount > 0 ? `${directCount} direct ~${
|
|
865
|
+
directCount > 0 ? `${directCount} direct ~${directTokens.toLocaleString()} tokens` : "no direct tools";
|
|
836
866
|
lines.push(row(fg(t.description, stats + (this.dirty ? fg(t.needsAuth, " (unsaved)") : ""))));
|
|
837
867
|
}
|
|
838
868
|
}
|
|
@@ -900,7 +930,7 @@ class McpPanel {
|
|
|
900
930
|
return `${prefix} ${nameStr}${importLabel} ${fg(t.description, "(not cached)")}${statusLabel}`;
|
|
901
931
|
}
|
|
902
932
|
|
|
903
|
-
const directCount = server.
|
|
933
|
+
const directCount = server.directCount;
|
|
904
934
|
const totalCount = server.tools.length;
|
|
905
935
|
let toggleIcon = fg(t.description, "○");
|
|
906
936
|
if (directCount === totalCount && totalCount > 0) {
|
|
@@ -913,8 +943,7 @@ class McpPanel {
|
|
|
913
943
|
if (totalCount > 0) {
|
|
914
944
|
toolInfo = `${directCount}/${totalCount}`;
|
|
915
945
|
if (directCount > 0) {
|
|
916
|
-
|
|
917
|
-
toolInfo += ` ~${tokens.toLocaleString()}`;
|
|
946
|
+
toolInfo += ` ~${server.directTokens.toLocaleString()}`;
|
|
918
947
|
}
|
|
919
948
|
toolInfo = fg(t.description, toolInfo);
|
|
920
949
|
}
|
|
@@ -19,7 +19,7 @@ import type {
|
|
|
19
19
|
ToolMetadata,
|
|
20
20
|
PromptMetadata,
|
|
21
21
|
} from "./types.ts";
|
|
22
|
-
import { createToolSelectorCandidateIndex, formatPromptCommandName, formatToolName, getToolNameCandidates, isServerDisabled, isToolAllowed, resolveToolPrefix, type ToolPrefix } from "./types.ts";
|
|
22
|
+
import { createToolSelectorCandidateIndex, formatPromptCommandName, formatToolName, getToolNameCandidates, isServerDisabled, isToolAllowed, resolveToolPrefix, type ToolPrefix, type ToolSelectorCandidateIndex } from "./types.ts";
|
|
23
23
|
import { resourceNameToToolName } from "./resource-tools.ts";
|
|
24
24
|
import {
|
|
25
25
|
extractToolUiStreamMode,
|
|
@@ -75,7 +75,7 @@ export function saveMetadataCache(cache: MetadataCache): void {
|
|
|
75
75
|
merged.servers = { ...merged.servers, ...cache.servers };
|
|
76
76
|
|
|
77
77
|
const tmpPath = `${cachePath}.${process.pid}.tmp`;
|
|
78
|
-
writeFileSync(tmpPath, JSON.stringify(merged
|
|
78
|
+
writeFileSync(tmpPath, JSON.stringify(merged), "utf-8");
|
|
79
79
|
renameSync(tmpPath, cachePath);
|
|
80
80
|
}
|
|
81
81
|
|
|
@@ -189,6 +189,7 @@ export function reconstructToolMetadata(
|
|
|
189
189
|
definition: Pick<ServerEntry, "exposeResources" | "includeTools" | "excludeTools" | "toolPrefix">,
|
|
190
190
|
configuredServers?: Record<string, ServerEntry>,
|
|
191
191
|
cache?: MetadataCache,
|
|
192
|
+
sharedSelectorCandidateIndex?: ToolSelectorCandidateIndex,
|
|
192
193
|
): ToolMetadata[] {
|
|
193
194
|
const metadata: ToolMetadata[] = [];
|
|
194
195
|
const seenNames = new Set<string>();
|
|
@@ -196,25 +197,11 @@ export function reconstructToolMetadata(
|
|
|
196
197
|
const hasToolFilters =
|
|
197
198
|
(Array.isArray(definition.includeTools) && definition.includeTools.length > 0) ||
|
|
198
199
|
(Array.isArray(definition.excludeTools) && definition.excludeTools.length > 0);
|
|
199
|
-
const selectorCandidateIndex = hasToolFilters
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
const otherPrefix = resolveToolPrefix(otherDefinition, prefix);
|
|
205
|
-
for (const otherTool of otherEntry.tools ?? []) {
|
|
206
|
-
if (!isUiToolVisibleToModel(otherTool.uiVisibility)) continue;
|
|
207
|
-
for (const candidate of getToolNameCandidates(otherTool.name, otherServerName, otherPrefix, false)) candidates.add(candidate);
|
|
208
|
-
}
|
|
209
|
-
if (otherDefinition.exposeResources !== false) {
|
|
210
|
-
for (const resource of otherEntry.resources ?? []) {
|
|
211
|
-
const baseName = `read_${resourceNameToToolName(resource.name)}`;
|
|
212
|
-
for (const candidate of getToolNameCandidates(baseName, otherServerName, otherPrefix, false)) candidates.add(candidate);
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
return createToolSelectorCandidateIndex(candidates);
|
|
217
|
-
})() : undefined;
|
|
200
|
+
const selectorCandidateIndex = hasToolFilters
|
|
201
|
+
? sharedSelectorCandidateIndex ?? (configuredServers && cache
|
|
202
|
+
? createCachedToolSelectorCandidateIndex(configuredServers, cache, prefix)
|
|
203
|
+
: undefined)
|
|
204
|
+
: undefined;
|
|
218
205
|
|
|
219
206
|
for (const tool of entry.tools ?? []) {
|
|
220
207
|
if (!tool?.name) continue;
|
|
@@ -268,6 +255,30 @@ export function reconstructToolMetadata(
|
|
|
268
255
|
return metadata;
|
|
269
256
|
}
|
|
270
257
|
|
|
258
|
+
export function createCachedToolSelectorCandidateIndex(
|
|
259
|
+
configuredServers: Record<string, ServerEntry>,
|
|
260
|
+
cache: MetadataCache,
|
|
261
|
+
prefix: ToolPrefix,
|
|
262
|
+
): ToolSelectorCandidateIndex {
|
|
263
|
+
const candidates = new Set<string>();
|
|
264
|
+
for (const [serverName, definition] of Object.entries(configuredServers)) {
|
|
265
|
+
const entry = cache.servers[serverName];
|
|
266
|
+
if (!entry || !isServerCacheValid(entry, definition) || isServerDisabled(definition)) continue;
|
|
267
|
+
const effectivePrefix = resolveToolPrefix(definition, prefix);
|
|
268
|
+
for (const tool of entry.tools ?? []) {
|
|
269
|
+
if (!isUiToolVisibleToModel(tool.uiVisibility)) continue;
|
|
270
|
+
for (const candidate of getToolNameCandidates(tool.name, serverName, effectivePrefix, false)) candidates.add(candidate);
|
|
271
|
+
}
|
|
272
|
+
if (definition.exposeResources !== false) {
|
|
273
|
+
for (const resource of entry.resources ?? []) {
|
|
274
|
+
const baseName = `read_${resourceNameToToolName(resource.name)}`;
|
|
275
|
+
for (const candidate of getToolNameCandidates(baseName, serverName, effectivePrefix, false)) candidates.add(candidate);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
return createToolSelectorCandidateIndex(candidates);
|
|
280
|
+
}
|
|
281
|
+
|
|
271
282
|
export function serializeTools(tools: McpTool[]): CachedTool[] {
|
|
272
283
|
return tools
|
|
273
284
|
.filter(t => t?.name)
|