@chances-ai/engine 24.0.0
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/dist/agents/discover.d.ts +30 -0
- package/dist/agents/discover.d.ts.map +1 -0
- package/dist/agents/discover.js +183 -0
- package/dist/agents/discover.js.map +1 -0
- package/dist/agents/index.d.ts +20 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +52 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/parse.d.ts +61 -0
- package/dist/agents/parse.d.ts.map +1 -0
- package/dist/agents/parse.js +527 -0
- package/dist/agents/parse.js.map +1 -0
- package/dist/agents/types.d.ts +52 -0
- package/dist/agents/types.d.ts.map +1 -0
- package/dist/agents/types.js +8 -0
- package/dist/agents/types.js.map +1 -0
- package/dist/ai/adapters/ai-sdk-stream.d.ts +19 -0
- package/dist/ai/adapters/ai-sdk-stream.d.ts.map +1 -0
- package/dist/ai/adapters/ai-sdk-stream.js +125 -0
- package/dist/ai/adapters/ai-sdk-stream.js.map +1 -0
- package/dist/ai/adapters/ai-sdk.d.ts +56 -0
- package/dist/ai/adapters/ai-sdk.d.ts.map +1 -0
- package/dist/ai/adapters/ai-sdk.js +112 -0
- package/dist/ai/adapters/ai-sdk.js.map +1 -0
- package/dist/ai/adapters/mock.d.ts +13 -0
- package/dist/ai/adapters/mock.d.ts.map +1 -0
- package/dist/ai/adapters/mock.js +54 -0
- package/dist/ai/adapters/mock.js.map +1 -0
- package/dist/ai/adapters/openai-compatible.d.ts +23 -0
- package/dist/ai/adapters/openai-compatible.d.ts.map +1 -0
- package/dist/ai/adapters/openai-compatible.js +45 -0
- package/dist/ai/adapters/openai-compatible.js.map +1 -0
- package/dist/ai/cost.d.ts +3 -0
- package/dist/ai/cost.d.ts.map +1 -0
- package/dist/ai/cost.js +5 -0
- package/dist/ai/cost.js.map +1 -0
- package/dist/ai/index.d.ts +12 -0
- package/dist/ai/index.d.ts.map +1 -0
- package/dist/ai/index.js +11 -0
- package/dist/ai/index.js.map +1 -0
- package/dist/ai/known-models.d.ts +20 -0
- package/dist/ai/known-models.d.ts.map +1 -0
- package/dist/ai/known-models.js +129 -0
- package/dist/ai/known-models.js.map +1 -0
- package/dist/ai/registry.d.ts +12 -0
- package/dist/ai/registry.d.ts.map +1 -0
- package/dist/ai/registry.js +24 -0
- package/dist/ai/registry.js.map +1 -0
- package/dist/ai/retry.d.ts +11 -0
- package/dist/ai/retry.d.ts.map +1 -0
- package/dist/ai/retry.js +14 -0
- package/dist/ai/retry.js.map +1 -0
- package/dist/ai/router.d.ts +25 -0
- package/dist/ai/router.d.ts.map +1 -0
- package/dist/ai/router.js +36 -0
- package/dist/ai/router.js.map +1 -0
- package/dist/ai/setup.d.ts +23 -0
- package/dist/ai/setup.d.ts.map +1 -0
- package/dist/ai/setup.js +47 -0
- package/dist/ai/setup.js.map +1 -0
- package/dist/ai/summarizer.d.ts +24 -0
- package/dist/ai/summarizer.d.ts.map +1 -0
- package/dist/ai/summarizer.js +56 -0
- package/dist/ai/summarizer.js.map +1 -0
- package/dist/ai/types.d.ts +83 -0
- package/dist/ai/types.d.ts.map +1 -0
- package/dist/ai/types.js +2 -0
- package/dist/ai/types.js.map +1 -0
- package/dist/core/compaction/circuit-breaker.d.ts +32 -0
- package/dist/core/compaction/circuit-breaker.d.ts.map +1 -0
- package/dist/core/compaction/circuit-breaker.js +42 -0
- package/dist/core/compaction/circuit-breaker.js.map +1 -0
- package/dist/core/compaction/compactor.d.ts +75 -0
- package/dist/core/compaction/compactor.d.ts.map +1 -0
- package/dist/core/compaction/compactor.js +261 -0
- package/dist/core/compaction/compactor.js.map +1 -0
- package/dist/core/compaction/estimate.d.ts +39 -0
- package/dist/core/compaction/estimate.d.ts.map +1 -0
- package/dist/core/compaction/estimate.js +74 -0
- package/dist/core/compaction/estimate.js.map +1 -0
- package/dist/core/compaction/index.d.ts +5 -0
- package/dist/core/compaction/index.d.ts.map +1 -0
- package/dist/core/compaction/index.js +5 -0
- package/dist/core/compaction/index.js.map +1 -0
- package/dist/core/compaction/prune.d.ts +43 -0
- package/dist/core/compaction/prune.d.ts.map +1 -0
- package/dist/core/compaction/prune.js +51 -0
- package/dist/core/compaction/prune.js.map +1 -0
- package/dist/core/engine.d.ts +268 -0
- package/dist/core/engine.d.ts.map +1 -0
- package/dist/core/engine.js +767 -0
- package/dist/core/engine.js.map +1 -0
- package/dist/core/index.d.ts +6 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +6 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/task-tool.d.ts +175 -0
- package/dist/core/task-tool.d.ts.map +1 -0
- package/dist/core/task-tool.js +901 -0
- package/dist/core/task-tool.js.map +1 -0
- package/dist/core/workspace-query.d.ts +83 -0
- package/dist/core/workspace-query.d.ts.map +1 -0
- package/dist/core/workspace-query.js +217 -0
- package/dist/core/workspace-query.js.map +1 -0
- package/dist/core/worktree/active-marker.d.ts +31 -0
- package/dist/core/worktree/active-marker.d.ts.map +1 -0
- package/dist/core/worktree/active-marker.js +109 -0
- package/dist/core/worktree/active-marker.js.map +1 -0
- package/dist/core/worktree/create.d.ts +40 -0
- package/dist/core/worktree/create.d.ts.map +1 -0
- package/dist/core/worktree/create.js +121 -0
- package/dist/core/worktree/create.js.map +1 -0
- package/dist/core/worktree/errors.d.ts +7 -0
- package/dist/core/worktree/errors.d.ts.map +1 -0
- package/dist/core/worktree/errors.js +11 -0
- package/dist/core/worktree/errors.js.map +1 -0
- package/dist/core/worktree/gc.d.ts +39 -0
- package/dist/core/worktree/gc.d.ts.map +1 -0
- package/dist/core/worktree/gc.js +146 -0
- package/dist/core/worktree/gc.js.map +1 -0
- package/dist/core/worktree/git.d.ts +53 -0
- package/dist/core/worktree/git.d.ts.map +1 -0
- package/dist/core/worktree/git.js +166 -0
- package/dist/core/worktree/git.js.map +1 -0
- package/dist/core/worktree/index.d.ts +8 -0
- package/dist/core/worktree/index.d.ts.map +1 -0
- package/dist/core/worktree/index.js +8 -0
- package/dist/core/worktree/index.js.map +1 -0
- package/dist/core/worktree/paths.d.ts +26 -0
- package/dist/core/worktree/paths.d.ts.map +1 -0
- package/dist/core/worktree/paths.js +57 -0
- package/dist/core/worktree/paths.js.map +1 -0
- package/dist/core/worktree/slug.d.ts +6 -0
- package/dist/core/worktree/slug.d.ts.map +1 -0
- package/dist/core/worktree/slug.js +21 -0
- package/dist/core/worktree/slug.js.map +1 -0
- package/dist/local-vault/file-store.d.ts +64 -0
- package/dist/local-vault/file-store.d.ts.map +1 -0
- package/dist/local-vault/file-store.js +225 -0
- package/dist/local-vault/file-store.js.map +1 -0
- package/dist/local-vault/index.d.ts +57 -0
- package/dist/local-vault/index.d.ts.map +1 -0
- package/dist/local-vault/index.js +68 -0
- package/dist/local-vault/index.js.map +1 -0
- package/dist/local-vault/keychain.d.ts +58 -0
- package/dist/local-vault/keychain.d.ts.map +1 -0
- package/dist/local-vault/keychain.js +200 -0
- package/dist/local-vault/keychain.js.map +1 -0
- package/dist/local-vault/mutex.d.ts +20 -0
- package/dist/local-vault/mutex.d.ts.map +1 -0
- package/dist/local-vault/mutex.js +44 -0
- package/dist/local-vault/mutex.js.map +1 -0
- package/dist/local-vault/passphrase.d.ts +30 -0
- package/dist/local-vault/passphrase.d.ts.map +1 -0
- package/dist/local-vault/passphrase.js +72 -0
- package/dist/local-vault/passphrase.js.map +1 -0
- package/dist/lsp/config.d.ts +34 -0
- package/dist/lsp/config.d.ts.map +1 -0
- package/dist/lsp/config.js +68 -0
- package/dist/lsp/config.js.map +1 -0
- package/dist/lsp/detect.d.ts +7 -0
- package/dist/lsp/detect.d.ts.map +1 -0
- package/dist/lsp/detect.js +78 -0
- package/dist/lsp/detect.js.map +1 -0
- package/dist/lsp/errors.d.ts +11 -0
- package/dist/lsp/errors.d.ts.map +1 -0
- package/dist/lsp/errors.js +11 -0
- package/dist/lsp/errors.js.map +1 -0
- package/dist/lsp/formatters.d.ts +147 -0
- package/dist/lsp/formatters.d.ts.map +1 -0
- package/dist/lsp/formatters.js +259 -0
- package/dist/lsp/formatters.js.map +1 -0
- package/dist/lsp/index.d.ts +31 -0
- package/dist/lsp/index.d.ts.map +1 -0
- package/dist/lsp/index.js +31 -0
- package/dist/lsp/index.js.map +1 -0
- package/dist/lsp/instance.d.ts +72 -0
- package/dist/lsp/instance.d.ts.map +1 -0
- package/dist/lsp/instance.js +489 -0
- package/dist/lsp/instance.js.map +1 -0
- package/dist/lsp/lazy-load.d.ts +27 -0
- package/dist/lsp/lazy-load.d.ts.map +1 -0
- package/dist/lsp/lazy-load.js +57 -0
- package/dist/lsp/lazy-load.js.map +1 -0
- package/dist/lsp/manager.d.ts +59 -0
- package/dist/lsp/manager.d.ts.map +1 -0
- package/dist/lsp/manager.js +242 -0
- package/dist/lsp/manager.js.map +1 -0
- package/dist/lsp/ops.d.ts +13 -0
- package/dist/lsp/ops.d.ts.map +1 -0
- package/dist/lsp/ops.js +225 -0
- package/dist/lsp/ops.js.map +1 -0
- package/dist/lsp/rpc.d.ts +47 -0
- package/dist/lsp/rpc.d.ts.map +1 -0
- package/dist/lsp/rpc.js +134 -0
- package/dist/lsp/rpc.js.map +1 -0
- package/dist/lsp/safe-uri.d.ts +18 -0
- package/dist/lsp/safe-uri.d.ts.map +1 -0
- package/dist/lsp/safe-uri.js +96 -0
- package/dist/lsp/safe-uri.js.map +1 -0
- package/dist/lsp/types.d.ts +70 -0
- package/dist/lsp/types.d.ts.map +1 -0
- package/dist/lsp/types.js +16 -0
- package/dist/lsp/types.js.map +1 -0
- package/dist/mcp/bridge.d.ts +57 -0
- package/dist/mcp/bridge.d.ts.map +1 -0
- package/dist/mcp/bridge.js +98 -0
- package/dist/mcp/bridge.js.map +1 -0
- package/dist/mcp/category.d.ts +22 -0
- package/dist/mcp/category.d.ts.map +1 -0
- package/dist/mcp/category.js +11 -0
- package/dist/mcp/category.js.map +1 -0
- package/dist/mcp/client.d.ts +228 -0
- package/dist/mcp/client.d.ts.map +1 -0
- package/dist/mcp/client.js +352 -0
- package/dist/mcp/client.js.map +1 -0
- package/dist/mcp/content.d.ts +86 -0
- package/dist/mcp/content.d.ts.map +1 -0
- package/dist/mcp/content.js +147 -0
- package/dist/mcp/content.js.map +1 -0
- package/dist/mcp/env.d.ts +19 -0
- package/dist/mcp/env.d.ts.map +1 -0
- package/dist/mcp/env.js +50 -0
- package/dist/mcp/env.js.map +1 -0
- package/dist/mcp/host.d.ts +199 -0
- package/dist/mcp/host.d.ts.map +1 -0
- package/dist/mcp/host.js +530 -0
- package/dist/mcp/host.js.map +1 -0
- package/dist/mcp/index.d.ts +18 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +17 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/load-mcp-host.d.ts +32 -0
- package/dist/mcp/load-mcp-host.d.ts.map +1 -0
- package/dist/mcp/load-mcp-host.js +49 -0
- package/dist/mcp/load-mcp-host.js.map +1 -0
- package/dist/mcp/oauth/callback-server.d.ts +73 -0
- package/dist/mcp/oauth/callback-server.d.ts.map +1 -0
- package/dist/mcp/oauth/callback-server.js +280 -0
- package/dist/mcp/oauth/callback-server.js.map +1 -0
- package/dist/mcp/oauth/config-hash.d.ts +24 -0
- package/dist/mcp/oauth/config-hash.d.ts.map +1 -0
- package/dist/mcp/oauth/config-hash.js +55 -0
- package/dist/mcp/oauth/config-hash.js.map +1 -0
- package/dist/mcp/oauth/error-normalize.d.ts +39 -0
- package/dist/mcp/oauth/error-normalize.d.ts.map +1 -0
- package/dist/mcp/oauth/error-normalize.js +91 -0
- package/dist/mcp/oauth/error-normalize.js.map +1 -0
- package/dist/mcp/oauth/provider.d.ts +190 -0
- package/dist/mcp/oauth/provider.d.ts.map +1 -0
- package/dist/mcp/oauth/provider.js +305 -0
- package/dist/mcp/oauth/provider.js.map +1 -0
- package/dist/mcp/oauth/refresh-coalescer.d.ts +46 -0
- package/dist/mcp/oauth/refresh-coalescer.d.ts.map +1 -0
- package/dist/mcp/oauth/refresh-coalescer.js +77 -0
- package/dist/mcp/oauth/refresh-coalescer.js.map +1 -0
- package/dist/mcp/oauth/sdk-shapes.d.ts +77 -0
- package/dist/mcp/oauth/sdk-shapes.d.ts.map +1 -0
- package/dist/mcp/oauth/sdk-shapes.js +21 -0
- package/dist/mcp/oauth/sdk-shapes.js.map +1 -0
- package/dist/mcp/parse.d.ts +28 -0
- package/dist/mcp/parse.d.ts.map +1 -0
- package/dist/mcp/parse.js +209 -0
- package/dist/mcp/parse.js.map +1 -0
- package/dist/mcp/prompts.d.ts +31 -0
- package/dist/mcp/prompts.d.ts.map +1 -0
- package/dist/mcp/prompts.js +71 -0
- package/dist/mcp/prompts.js.map +1 -0
- package/dist/mcp/redact.d.ts +62 -0
- package/dist/mcp/redact.d.ts.map +1 -0
- package/dist/mcp/redact.js +87 -0
- package/dist/mcp/redact.js.map +1 -0
- package/dist/mcp/resources.d.ts +70 -0
- package/dist/mcp/resources.d.ts.map +1 -0
- package/dist/mcp/resources.js +170 -0
- package/dist/mcp/resources.js.map +1 -0
- package/dist/mcp/types.d.ts +123 -0
- package/dist/mcp/types.d.ts.map +1 -0
- package/dist/mcp/types.js +2 -0
- package/dist/mcp/types.js.map +1 -0
- package/dist/memory/frontmatter.d.ts +18 -0
- package/dist/memory/frontmatter.d.ts.map +1 -0
- package/dist/memory/frontmatter.js +81 -0
- package/dist/memory/frontmatter.js.map +1 -0
- package/dist/memory/index.d.ts +5 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +5 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/memory/store.d.ts +44 -0
- package/dist/memory/store.d.ts.map +1 -0
- package/dist/memory/store.js +237 -0
- package/dist/memory/store.js.map +1 -0
- package/dist/memory/tools.d.ts +11 -0
- package/dist/memory/tools.d.ts.map +1 -0
- package/dist/memory/tools.js +159 -0
- package/dist/memory/tools.js.map +1 -0
- package/dist/memory/types.d.ts +32 -0
- package/dist/memory/types.d.ts.map +1 -0
- package/dist/memory/types.js +20 -0
- package/dist/memory/types.js.map +1 -0
- package/dist/plugin-api/index.d.ts +167 -0
- package/dist/plugin-api/index.d.ts.map +1 -0
- package/dist/plugin-api/index.js +151 -0
- package/dist/plugin-api/index.js.map +1 -0
- package/dist/plugin-logger/index.d.ts +21 -0
- package/dist/plugin-logger/index.d.ts.map +1 -0
- package/dist/plugin-logger/index.js +59 -0
- package/dist/plugin-logger/index.js.map +1 -0
- package/dist/session/index.d.ts +125 -0
- package/dist/session/index.d.ts.map +1 -0
- package/dist/session/index.js +202 -0
- package/dist/session/index.js.map +1 -0
- package/dist/tools/approval.d.ts +33 -0
- package/dist/tools/approval.d.ts.map +1 -0
- package/dist/tools/approval.js +53 -0
- package/dist/tools/approval.js.map +1 -0
- package/dist/tools/builtins/_shared.d.ts +94 -0
- package/dist/tools/builtins/_shared.d.ts.map +1 -0
- package/dist/tools/builtins/_shared.js +246 -0
- package/dist/tools/builtins/_shared.js.map +1 -0
- package/dist/tools/builtins/ask-user-question.d.ts +27 -0
- package/dist/tools/builtins/ask-user-question.d.ts.map +1 -0
- package/dist/tools/builtins/ask-user-question.js +191 -0
- package/dist/tools/builtins/ask-user-question.js.map +1 -0
- package/dist/tools/builtins/bash.d.ts +3 -0
- package/dist/tools/builtins/bash.d.ts.map +1 -0
- package/dist/tools/builtins/bash.js +158 -0
- package/dist/tools/builtins/bash.js.map +1 -0
- package/dist/tools/builtins/diff.d.ts +3 -0
- package/dist/tools/builtins/diff.d.ts.map +1 -0
- package/dist/tools/builtins/diff.js +83 -0
- package/dist/tools/builtins/diff.js.map +1 -0
- package/dist/tools/builtins/edit.d.ts +3 -0
- package/dist/tools/builtins/edit.d.ts.map +1 -0
- package/dist/tools/builtins/edit.js +40 -0
- package/dist/tools/builtins/edit.js.map +1 -0
- package/dist/tools/builtins/glob.d.ts +3 -0
- package/dist/tools/builtins/glob.d.ts.map +1 -0
- package/dist/tools/builtins/glob.js +37 -0
- package/dist/tools/builtins/glob.js.map +1 -0
- package/dist/tools/builtins/grep.d.ts +3 -0
- package/dist/tools/builtins/grep.d.ts.map +1 -0
- package/dist/tools/builtins/grep.js +81 -0
- package/dist/tools/builtins/grep.js.map +1 -0
- package/dist/tools/builtins/lsp.d.ts +3 -0
- package/dist/tools/builtins/lsp.d.ts.map +1 -0
- package/dist/tools/builtins/lsp.js +102 -0
- package/dist/tools/builtins/lsp.js.map +1 -0
- package/dist/tools/builtins/pty.d.ts +64 -0
- package/dist/tools/builtins/pty.d.ts.map +1 -0
- package/dist/tools/builtins/pty.js +536 -0
- package/dist/tools/builtins/pty.js.map +1 -0
- package/dist/tools/builtins/read.d.ts +3 -0
- package/dist/tools/builtins/read.d.ts.map +1 -0
- package/dist/tools/builtins/read.js +18 -0
- package/dist/tools/builtins/read.js.map +1 -0
- package/dist/tools/builtins/web-fetch.d.ts +4 -0
- package/dist/tools/builtins/web-fetch.d.ts.map +1 -0
- package/dist/tools/builtins/web-fetch.js +353 -0
- package/dist/tools/builtins/web-fetch.js.map +1 -0
- package/dist/tools/builtins/write.d.ts +3 -0
- package/dist/tools/builtins/write.d.ts.map +1 -0
- package/dist/tools/builtins/write.js +48 -0
- package/dist/tools/builtins/write.js.map +1 -0
- package/dist/tools/builtins.d.ts +9 -0
- package/dist/tools/builtins.d.ts.map +1 -0
- package/dist/tools/builtins.js +29 -0
- package/dist/tools/builtins.js.map +1 -0
- package/dist/tools/diff.d.ts +18 -0
- package/dist/tools/diff.d.ts.map +1 -0
- package/dist/tools/diff.js +57 -0
- package/dist/tools/diff.js.map +1 -0
- package/dist/tools/index.d.ts +10 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +9 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/permission.d.ts +120 -0
- package/dist/tools/permission.d.ts.map +1 -0
- package/dist/tools/permission.js +208 -0
- package/dist/tools/permission.js.map +1 -0
- package/dist/tools/registry.d.ts +12 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +19 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/types.d.ts +244 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +15 -0
- package/dist/tools/types.js.map +1 -0
- package/package.json +109 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { McpResourceContent } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* (5.4) An MCP content part — the shape carried by tool results, prompt
|
|
4
|
+
* messages, and embedded resources. Moved here (from `bridge.ts`) so the
|
|
5
|
+
* renderer can be shared by the bridge, the resource tools, and the prompt
|
|
6
|
+
* commands; `bridge.ts` re-exports it for backwards compatibility.
|
|
7
|
+
*/
|
|
8
|
+
export type McpContentPart = {
|
|
9
|
+
type: "text";
|
|
10
|
+
text: string;
|
|
11
|
+
} | {
|
|
12
|
+
type: "image";
|
|
13
|
+
data?: string;
|
|
14
|
+
mimeType?: string;
|
|
15
|
+
} | {
|
|
16
|
+
type: "audio";
|
|
17
|
+
data?: string;
|
|
18
|
+
mimeType?: string;
|
|
19
|
+
} | {
|
|
20
|
+
type: "resource";
|
|
21
|
+
resource?: {
|
|
22
|
+
uri?: string;
|
|
23
|
+
text?: string;
|
|
24
|
+
blob?: string;
|
|
25
|
+
mimeType?: string;
|
|
26
|
+
};
|
|
27
|
+
} | {
|
|
28
|
+
type: "resource_link";
|
|
29
|
+
uri?: string;
|
|
30
|
+
name?: string;
|
|
31
|
+
} | {
|
|
32
|
+
type: string;
|
|
33
|
+
[k: string]: unknown;
|
|
34
|
+
};
|
|
35
|
+
export interface RenderOptions {
|
|
36
|
+
/** Per-server secret scrubber. Applied to ALL rendered content (5.4 codex
|
|
37
|
+
* R1 S1 — successful content is redacted too, not just errors: a server can
|
|
38
|
+
* echo a bearer token in a normal prompt message / resource body). */
|
|
39
|
+
redact?: (msg: string) => string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* (5.4) Render MCP content parts to model/TUI-safe text. Text-first: `text`
|
|
43
|
+
* and embedded-resource `text` inline; `resource_link` and binary
|
|
44
|
+
* (`image`/`audio`/blob) become bracketed placeholders — v1 does not forward
|
|
45
|
+
* binary media into the model message (providers vary; the bridge has always
|
|
46
|
+
* done this for tool results). Strips terminal control sequences, then applies
|
|
47
|
+
* the caller's per-server redactor.
|
|
48
|
+
*/
|
|
49
|
+
export declare function renderMcpContentParts(content: ReadonlyArray<McpContentPart> | undefined, opts?: RenderOptions): string;
|
|
50
|
+
/**
|
|
51
|
+
* Cap a string at `maxBytes` UTF-8 bytes WITHOUT splitting a code point (CJK-
|
|
52
|
+
* safe). Iterates by code point (`for…of`), stopping before the budget is
|
|
53
|
+
* exceeded; only runs the loop when truncation is actually needed.
|
|
54
|
+
*/
|
|
55
|
+
export declare function capUtf8(text: string, maxBytes: number): {
|
|
56
|
+
text: string;
|
|
57
|
+
truncated: boolean;
|
|
58
|
+
fullBytes: number;
|
|
59
|
+
};
|
|
60
|
+
/** Resolve a SAFE extension for a blob's mime type. Strips any `;params`, then
|
|
61
|
+
* looks up the allowlist; anything unknown → `bin`. */
|
|
62
|
+
export declare function safeBlobExt(mimeType: string | undefined): string;
|
|
63
|
+
/**
|
|
64
|
+
* Persist a binary blob under `<root>/.chances/tool-results/<id>/resource.<ext>`
|
|
65
|
+
* (0o700 dir, 0o600 file). `root` MUST be `ctx.parentWorkspaceRoot ?? ctx.workspaceRoot`
|
|
66
|
+
* (M6 — isolated-subagent artifacts survive worktree removal). Returns the path,
|
|
67
|
+
* or null on any fs failure (best-effort, like `persistFullOutput`).
|
|
68
|
+
*/
|
|
69
|
+
export declare function persistResourceBlob(root: string, data: Buffer, mimeType: string | undefined): string | null;
|
|
70
|
+
export interface FormatResourceOptions {
|
|
71
|
+
redact?: (msg: string) => string;
|
|
72
|
+
/** Per-content-item UTF-8 byte cap for inline text. */
|
|
73
|
+
maxBytes: number;
|
|
74
|
+
/** Called for blob content; returns the persisted path (or null). When
|
|
75
|
+
* omitted, blobs are summarised without persistence. */
|
|
76
|
+
persistBlob?: (data: Buffer, mimeType?: string) => string | null;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* (5.4) Format `resources/read` content items into model-safe text. Text items
|
|
80
|
+
* are stripped + redacted + byte-capped (with a truncation note pointing at no
|
|
81
|
+
* file — callers that need the full body use the larger tool cap); blob items
|
|
82
|
+
* are persisted to disk and replaced with a bracketed path reference (claude-
|
|
83
|
+
* code parity). Never inlines base64.
|
|
84
|
+
*/
|
|
85
|
+
export declare function formatResourceContents(contents: McpResourceContent[], opts: FormatResourceOptions): string;
|
|
86
|
+
//# sourceMappingURL=content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../src/mcp/content.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAGrD;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GACtB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GACnD;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GACnD;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,GAClG;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GACtD;IAAE,IAAI,EAAE,MA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from "node:path";
|
|
3
|
+
import { createId } from "@chances-ai/runtime";
|
|
4
|
+
import { stripTerminalControls } from "./redact.js";
|
|
5
|
+
const identity = (m) => m;
|
|
6
|
+
/**
|
|
7
|
+
* (5.4) Render MCP content parts to model/TUI-safe text. Text-first: `text`
|
|
8
|
+
* and embedded-resource `text` inline; `resource_link` and binary
|
|
9
|
+
* (`image`/`audio`/blob) become bracketed placeholders — v1 does not forward
|
|
10
|
+
* binary media into the model message (providers vary; the bridge has always
|
|
11
|
+
* done this for tool results). Strips terminal control sequences, then applies
|
|
12
|
+
* the caller's per-server redactor.
|
|
13
|
+
*/
|
|
14
|
+
export function renderMcpContentParts(content, opts = {}) {
|
|
15
|
+
const redact = opts.redact ?? identity;
|
|
16
|
+
if (!content || content.length === 0)
|
|
17
|
+
return "";
|
|
18
|
+
const parts = [];
|
|
19
|
+
for (const part of content) {
|
|
20
|
+
if (part.type === "text" && typeof part.text === "string") {
|
|
21
|
+
parts.push(part.text);
|
|
22
|
+
}
|
|
23
|
+
else if (part.type === "resource") {
|
|
24
|
+
const r = part.resource;
|
|
25
|
+
if (r?.text)
|
|
26
|
+
parts.push(r.text);
|
|
27
|
+
else if (r?.uri)
|
|
28
|
+
parts.push(`[resource ${r.uri}]`);
|
|
29
|
+
}
|
|
30
|
+
else if (part.type === "resource_link") {
|
|
31
|
+
const p = part;
|
|
32
|
+
parts.push(p.name ? `[resource ${p.uri ?? "?"} — ${p.name}]` : `[resource ${p.uri ?? "?"}]`);
|
|
33
|
+
}
|
|
34
|
+
else if (part.type === "image") {
|
|
35
|
+
parts.push(`[image ${part.mimeType ?? "unknown"}]`);
|
|
36
|
+
}
|
|
37
|
+
else if (part.type === "audio") {
|
|
38
|
+
parts.push(`[audio ${part.mimeType ?? "unknown"}]`);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
parts.push(`[${part.type} content]`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return redact(stripTerminalControls(parts.join("\n")));
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Cap a string at `maxBytes` UTF-8 bytes WITHOUT splitting a code point (CJK-
|
|
48
|
+
* safe). Iterates by code point (`for…of`), stopping before the budget is
|
|
49
|
+
* exceeded; only runs the loop when truncation is actually needed.
|
|
50
|
+
*/
|
|
51
|
+
export function capUtf8(text, maxBytes) {
|
|
52
|
+
const fullBytes = Buffer.byteLength(text, "utf8");
|
|
53
|
+
if (fullBytes <= maxBytes)
|
|
54
|
+
return { text, truncated: false, fullBytes };
|
|
55
|
+
let bytes = 0;
|
|
56
|
+
let out = "";
|
|
57
|
+
for (const ch of text) {
|
|
58
|
+
const b = Buffer.byteLength(ch, "utf8");
|
|
59
|
+
if (bytes + b > maxBytes)
|
|
60
|
+
break;
|
|
61
|
+
bytes += b;
|
|
62
|
+
out += ch;
|
|
63
|
+
}
|
|
64
|
+
return { text: out, truncated: true, fullBytes };
|
|
65
|
+
}
|
|
66
|
+
/** mime → safe file extension allowlist (5.4 codex R1 M6 — never derive a path
|
|
67
|
+
* segment from raw MIME, which can carry `/`, params, or hostile text). */
|
|
68
|
+
const MIME_EXT = {
|
|
69
|
+
"image/png": "png",
|
|
70
|
+
"image/jpeg": "jpg",
|
|
71
|
+
"image/gif": "gif",
|
|
72
|
+
"image/webp": "webp",
|
|
73
|
+
"image/svg+xml": "svg",
|
|
74
|
+
"application/pdf": "pdf",
|
|
75
|
+
"application/json": "json",
|
|
76
|
+
"application/octet-stream": "bin",
|
|
77
|
+
"text/plain": "txt",
|
|
78
|
+
"text/csv": "csv",
|
|
79
|
+
"text/html": "html",
|
|
80
|
+
"audio/mpeg": "mp3",
|
|
81
|
+
"audio/wav": "wav",
|
|
82
|
+
};
|
|
83
|
+
/** Resolve a SAFE extension for a blob's mime type. Strips any `;params`, then
|
|
84
|
+
* looks up the allowlist; anything unknown → `bin`. */
|
|
85
|
+
export function safeBlobExt(mimeType) {
|
|
86
|
+
if (!mimeType)
|
|
87
|
+
return "bin";
|
|
88
|
+
const base = mimeType.split(";")[0].trim().toLowerCase();
|
|
89
|
+
return MIME_EXT[base] ?? "bin";
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Persist a binary blob under `<root>/.chances/tool-results/<id>/resource.<ext>`
|
|
93
|
+
* (0o700 dir, 0o600 file). `root` MUST be `ctx.parentWorkspaceRoot ?? ctx.workspaceRoot`
|
|
94
|
+
* (M6 — isolated-subagent artifacts survive worktree removal). Returns the path,
|
|
95
|
+
* or null on any fs failure (best-effort, like `persistFullOutput`).
|
|
96
|
+
*/
|
|
97
|
+
export function persistResourceBlob(root, data, mimeType) {
|
|
98
|
+
try {
|
|
99
|
+
const dir = join(root, ".chances", "tool-results", createId("mcpres"));
|
|
100
|
+
mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
101
|
+
const path = join(dir, `resource.${safeBlobExt(mimeType)}`);
|
|
102
|
+
writeFileSync(path, data, { mode: 0o600 });
|
|
103
|
+
return path;
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* (5.4) Format `resources/read` content items into model-safe text. Text items
|
|
111
|
+
* are stripped + redacted + byte-capped (with a truncation note pointing at no
|
|
112
|
+
* file — callers that need the full body use the larger tool cap); blob items
|
|
113
|
+
* are persisted to disk and replaced with a bracketed path reference (claude-
|
|
114
|
+
* code parity). Never inlines base64.
|
|
115
|
+
*/
|
|
116
|
+
export function formatResourceContents(contents, opts) {
|
|
117
|
+
const redact = opts.redact ?? identity;
|
|
118
|
+
const out = [];
|
|
119
|
+
for (const c of contents) {
|
|
120
|
+
if (typeof c.text === "string") {
|
|
121
|
+
const cleaned = redact(stripTerminalControls(c.text));
|
|
122
|
+
const capped = capUtf8(cleaned, opts.maxBytes);
|
|
123
|
+
out.push(capped.truncated
|
|
124
|
+
? `${capped.text}\n[…truncated — ${capped.fullBytes} bytes total]`
|
|
125
|
+
: capped.text);
|
|
126
|
+
}
|
|
127
|
+
else if (typeof c.blob === "string") {
|
|
128
|
+
let buf;
|
|
129
|
+
try {
|
|
130
|
+
buf = Buffer.from(c.blob, "base64");
|
|
131
|
+
}
|
|
132
|
+
catch {
|
|
133
|
+
buf = undefined;
|
|
134
|
+
}
|
|
135
|
+
const path = buf && opts.persistBlob ? opts.persistBlob(buf, c.mimeType) : null;
|
|
136
|
+
const mime = c.mimeType ?? "application/octet-stream";
|
|
137
|
+
// (5.4 R2 S1) `mimeType` is server-controlled — strip + redact BOTH the
|
|
138
|
+
// persisted and the not-persisted notes, not just the persisted one.
|
|
139
|
+
const note = path
|
|
140
|
+
? `[binary resource (${mime}) saved to ${path}]`
|
|
141
|
+
: `[binary resource (${mime})${buf ? `, ${buf.length} bytes` : ""} — not persisted]`;
|
|
142
|
+
out.push(redact(stripTerminalControls(note)));
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return out.join("\n\n");
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content.js","sourceRoot":"","sources":["../../src/mcp/content.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAuBpD,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC;AAElC;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CACnC,OAAkD,EAClD,OAAsB,EAAE;IAExB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,QAAQ,CAAC;IACvC,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC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+
/**
|
|
3
|
+
* Expands `${VAR}` and `${VAR:-default}` references inside a single string.
|
|
4
|
+
* No `$VAR` (without braces) on purpose — too many MCP commands contain
|
|
5
|
+
* unbraced dollars in URLs and we don't want false positives.
|
|
6
|
+
*
|
|
7
|
+
* Unknown variables without a `:-default` fallback throw `AppError(Config)`
|
|
8
|
+
* so misconfigured env doesn't silently produce a string with an unresolved
|
|
9
|
+
* `${VAR}` literal that the MCP server can't parse.
|
|
10
|
+
*/
|
|
11
|
+
export declare function expandEnv(raw: string, env: Record<string, string | undefined>): string;
|
|
12
|
+
/**
|
|
13
|
+
* Walks a config entry and expands every string field that could meaningfully
|
|
14
|
+
* carry an env reference: command, args[], env values, cwd, url, header
|
|
15
|
+
* values. Leaves booleans / numbers / undefined alone. Returns a new object —
|
|
16
|
+
* never mutates the input.
|
|
17
|
+
*/
|
|
18
|
+
export declare function expandServerEnv(config: McpServerConfig, env: Record<string, string | undefined>): McpServerConfig;
|
|
19
|
+
//# sourceMappingURL=env.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/mcp/env.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,MAAM,CAUtF;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,eAAe,EACvB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GACtC,eAAe,CAgBjB"}
|
package/dist/mcp/env.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { AppError, ErrorCode } from "@chances-ai/runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Expands `${VAR}` and `${VAR:-default}` references inside a single string.
|
|
4
|
+
* No `$VAR` (without braces) on purpose — too many MCP commands contain
|
|
5
|
+
* unbraced dollars in URLs and we don't want false positives.
|
|
6
|
+
*
|
|
7
|
+
* Unknown variables without a `:-default` fallback throw `AppError(Config)`
|
|
8
|
+
* so misconfigured env doesn't silently produce a string with an unresolved
|
|
9
|
+
* `${VAR}` literal that the MCP server can't parse.
|
|
10
|
+
*/
|
|
11
|
+
export function expandEnv(raw, env) {
|
|
12
|
+
return raw.replace(/\$\{([A-Z_][A-Z0-9_]*)(?::-([^}]*))?\}/gi, (_match, name, fallback) => {
|
|
13
|
+
const value = env[name];
|
|
14
|
+
if (value !== undefined && value !== "")
|
|
15
|
+
return value;
|
|
16
|
+
if (fallback !== undefined)
|
|
17
|
+
return fallback;
|
|
18
|
+
throw new AppError(ErrorCode.Config, `mcp env: required variable \${${name}} is not set (use \${${name}:-default} to provide a fallback)`);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Walks a config entry and expands every string field that could meaningfully
|
|
23
|
+
* carry an env reference: command, args[], env values, cwd, url, header
|
|
24
|
+
* values. Leaves booleans / numbers / undefined alone. Returns a new object —
|
|
25
|
+
* never mutates the input.
|
|
26
|
+
*/
|
|
27
|
+
export function expandServerEnv(config, env) {
|
|
28
|
+
const exp = (s) => expandEnv(s, env);
|
|
29
|
+
if (config.type === "stdio") {
|
|
30
|
+
return {
|
|
31
|
+
...config,
|
|
32
|
+
command: exp(config.command),
|
|
33
|
+
args: config.args?.map(exp),
|
|
34
|
+
env: config.env ? mapValues(config.env, exp) : undefined,
|
|
35
|
+
cwd: config.cwd ? exp(config.cwd) : undefined,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
...config,
|
|
40
|
+
url: exp(config.url),
|
|
41
|
+
headers: config.headers ? mapValues(config.headers, exp) : undefined,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function mapValues(obj, f) {
|
|
45
|
+
const out = {};
|
|
46
|
+
for (const [k, v] of Object.entries(obj))
|
|
47
|
+
out[k] = f(v);
|
|
48
|
+
return out;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=env.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/mcp/env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAG1D;;;;;;;;GAQG;AACH,MAAM,UAAU,SAAS,CAAC,GAAW,EAAE,GAAuC;IAC5E,OAAO,GAAG,CAAC,OAAO,CAAC,0CAA0C,EAAE,CAAC,MAAM,EAAE,IAAY,EAAE,QAAiB,EAAE,EAAE;QACzG,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC;QACxB,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,EAAE;YAAE,OAAO,KAAK,CAAC;QACtD,IAAI,QAAQ,KAAK,SAAS;YAAE,OAAO,QAAQ,CAAC;QAC5C,MAAM,IAAI,QAAQ,CAChB,SAAS,CAAC,MAAM,EAChB,iCAAiC,IAAI,wBAAwB,IAAI,mCAAmC,CACrG,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAC7B,MAAuB,EACvB,GAAuC;IAEvC,MAAM,GAAG,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACrD,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC5B,OAAO;YACL,GAAG,MAAM;YACT,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC;YAC5B,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC;YAC3B,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS;YACxD,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS;SAC9C,CAAC;IACJ,CAAC;IACD,OAAO;QACL,GAAG,MAAM;QACT,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC;QACpB,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS;KACrE,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAI,GAAsB,EAAE,CAAc;IAC1D,MAAM,GAAG,GAAsB,EAAE,CAAC;IAClC,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC;QAAE,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACxD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import type { EventBus, Logger } from "@chances-ai/runtime";
|
|
2
|
+
import type { ToolRegistry } from "../tools/index.js";
|
|
3
|
+
import { type ClientIdentity } from "./client.js";
|
|
4
|
+
import { type RuntimeRedactor } from "./redact.js";
|
|
5
|
+
import type { HttpMcpConfig, McpPrompt, McpPromptMessage, McpResource, McpResourceContent, McpServerConfig, McpServerStatus, McpTestResult } from "./types.js";
|
|
6
|
+
import type { McpResourceProvider } from "./resources.js";
|
|
7
|
+
import { ChancesOAuthClientProvider } from "./oauth/provider.js";
|
|
8
|
+
import { LoopbackCallbackServer } from "./oauth/callback-server.js";
|
|
9
|
+
/**
|
|
10
|
+
* (3.7) Narrow vault surface the host depends on. Mirrored from
|
|
11
|
+
* `@chances-ai/local-vault#LocalVault` so this package does NOT hard-import
|
|
12
|
+
* the optional peer (which is loaded via computed specifier in
|
|
13
|
+
* `loadMcp({withVault})` — see `index.ts`).
|
|
14
|
+
*/
|
|
15
|
+
export interface LocalVaultLike {
|
|
16
|
+
read<T = unknown>(key: string): Promise<T | undefined>;
|
|
17
|
+
list(): Promise<readonly string[]>;
|
|
18
|
+
remove(key: string): Promise<void>;
|
|
19
|
+
mergeMutate<T>(key: string, mutator: (current: T | undefined) => T | undefined | Promise<T | undefined>, allowDelete?: boolean): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
export interface McpHostOptions {
|
|
22
|
+
/** Map keyed by server id (used in `mcp__<server>__<tool>` names). */
|
|
23
|
+
servers: Record<string, McpServerConfig>;
|
|
24
|
+
bus: EventBus;
|
|
25
|
+
logger: Logger;
|
|
26
|
+
registry: ToolRegistry;
|
|
27
|
+
/** Optional env source for `${VAR}` expansion. Defaults to `process.env`. */
|
|
28
|
+
env?: Record<string, string | undefined>;
|
|
29
|
+
/** Connection-attempt timeout, in ms. Caps a single server's startup so a
|
|
30
|
+
* wedged spawn doesn't block the whole boot. Defaults to 10 000 ms. */
|
|
31
|
+
connectTimeoutMs?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Identity the host announces to each MCP server during the initialize
|
|
34
|
+
* handshake. Callers (the CLI) thread `{ name: pkg.name, version: pkg.version }`
|
|
35
|
+
* read from their own `package.json` — keeping the version read out of
|
|
36
|
+
* `@chances-ai/mcp` itself avoids the unverified "Bun embeds a transitive
|
|
37
|
+
* workspace JSON import" path under `bun build --compile`. When omitted,
|
|
38
|
+
* the library falls back to a `0.0.0-dev` default.
|
|
39
|
+
*/
|
|
40
|
+
clientIdentity?: ClientIdentity;
|
|
41
|
+
/**
|
|
42
|
+
* (3.7) Encrypted credential store. Required for OAuth-configured
|
|
43
|
+
* servers; absent means OAuth servers fail with a clear "vault
|
|
44
|
+
* unavailable" message and the rest keep working. Routed in by
|
|
45
|
+
* `loadMcp({withVault: true})` — see `index.ts`. `apps/cli` never
|
|
46
|
+
* imports `@chances-ai/local-vault` directly (boundary decision).
|
|
47
|
+
*/
|
|
48
|
+
vault?: LocalVaultLike;
|
|
49
|
+
/**
|
|
50
|
+
* (3.7) Platform-agnostic browser launcher used by `/mcp login`.
|
|
51
|
+
* Default delegates to `open` / `xdg-open` / `start.exe`. Tests inject
|
|
52
|
+
* a stub.
|
|
53
|
+
*/
|
|
54
|
+
openBrowser?: (url: URL) => Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* (5.4 D6′) Absolute workspace root advertised to servers via `roots/list`
|
|
57
|
+
* when `advertiseRoots` is true. Threaded from the CLI boot.
|
|
58
|
+
*/
|
|
59
|
+
workspaceRoot?: string;
|
|
60
|
+
/**
|
|
61
|
+
* (5.4 D6′ / S5) Advertise the `roots` capability (workspace path) to
|
|
62
|
+
* servers. `listChanged` is always false. Default false at the library layer;
|
|
63
|
+
* the CLI passes `config.mcp.advertiseRoots` (default true).
|
|
64
|
+
*/
|
|
65
|
+
advertiseRoots?: boolean;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* (3.7) Per-server OAuth state held by the host across restart cycles.
|
|
69
|
+
* The redactor outlives any single connect cycle so tokens written
|
|
70
|
+
* during connect-N stay scrubbed in errors from connect-N+1.
|
|
71
|
+
*
|
|
72
|
+
* **(codex Round-2 MUST-FIX #3 + #4)** The provider + callbackServer
|
|
73
|
+
* pair is recreated whenever the vault generation bumps (e.g. on
|
|
74
|
+
* `/mcp logout`), since the provider holds an immutable snapshot of
|
|
75
|
+
* that generation. The previous V1 also held a `RefreshCoalescer` but
|
|
76
|
+
* no production codepath called `coalescer.refresh(...)` — the SDK
|
|
77
|
+
* owns refresh through `auth()` and we never intercepted it — so the
|
|
78
|
+
* field has been removed. Coalescing the SDK's refresh path is a
|
|
79
|
+
* 3.7.1 follow-up (would require taking ownership of refresh in the
|
|
80
|
+
* provider's `tokens()` and re-issuing the IdP call ourselves).
|
|
81
|
+
*/
|
|
82
|
+
export interface OAuthServerState {
|
|
83
|
+
provider: ChancesOAuthClientProvider;
|
|
84
|
+
callbackServer: LoopbackCallbackServer;
|
|
85
|
+
redactor: RuntimeRedactor;
|
|
86
|
+
/** The OAuth-configured HTTP server config — the slash command's
|
|
87
|
+
* `/mcp login` flow needs the URL + scopes to drive `auth()`. */
|
|
88
|
+
config: HttpMcpConfig & {
|
|
89
|
+
auth: {
|
|
90
|
+
kind: "oauth";
|
|
91
|
+
scopes?: readonly string[];
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Lifecycle orchestrator for one or more MCP servers. Connects them in
|
|
97
|
+
* parallel on `start()`, surfaces per-server failures as `failed` status
|
|
98
|
+
* instead of crashing the whole boot, and registers each server's discovered
|
|
99
|
+
* tools into the host `ToolRegistry`.
|
|
100
|
+
*
|
|
101
|
+
* Not a Plugin — MCP integration lives at the runtime layer because the
|
|
102
|
+
* engine consumes tools, not plugin hooks. Slash commands and CLI glue talk
|
|
103
|
+
* to the host directly.
|
|
104
|
+
*
|
|
105
|
+
* **Lifecycle serialization.** Every method that mutates host state
|
|
106
|
+
* (`startServer` / `restart` / `remove` / `dispose`) is chained behind a
|
|
107
|
+
* single `opsLock` promise so concurrent calls observe a consistent state
|
|
108
|
+
* machine. Two concurrent `restart(x)` calls run sequentially; a
|
|
109
|
+
* `dispose()` interleaved with a `restart()` always wins (because each
|
|
110
|
+
* step re-checks `disposed`). This guards against the codex-flagged race
|
|
111
|
+
* where a floating `/mcp restart` could resurrect a server after global
|
|
112
|
+
* teardown.
|
|
113
|
+
*/
|
|
114
|
+
export declare class McpHost implements McpResourceProvider {
|
|
115
|
+
private readonly opts;
|
|
116
|
+
private readonly states;
|
|
117
|
+
private disposed;
|
|
118
|
+
private opsLock;
|
|
119
|
+
private constructor();
|
|
120
|
+
/**
|
|
121
|
+
* Constructs and starts the host. Returns once every server has either
|
|
122
|
+
* connected (and its tools are in the registry) or failed (status
|
|
123
|
+
* `failed`, error message logged). Always resolves — never throws — so a
|
|
124
|
+
* misconfigured MCP server can't take down the agent.
|
|
125
|
+
*/
|
|
126
|
+
static start(opts: McpHostOptions): Promise<McpHost>;
|
|
127
|
+
status(): McpServerStatus[];
|
|
128
|
+
/**
|
|
129
|
+
* Tears down the named server (if any), wipes its registered tools, then
|
|
130
|
+
* reconnects from its current config. Surfaces the new status. Caller is
|
|
131
|
+
* the `/mcp restart` slash command.
|
|
132
|
+
*/
|
|
133
|
+
restart(id: string): Promise<McpServerStatus>;
|
|
134
|
+
/**
|
|
135
|
+
* Tears down the named server and unregisters its tools, but leaves no
|
|
136
|
+
* trace in host state — callers (typically `/mcp remove`) own the config
|
|
137
|
+
* mutation. Throws if no such server is known.
|
|
138
|
+
*/
|
|
139
|
+
remove(id: string): Promise<void>;
|
|
140
|
+
/**
|
|
141
|
+
* One-shot validation: connect, list tools, dispose. Doesn't register any
|
|
142
|
+
* tools or mutate host state. Caller is `/mcp test`.
|
|
143
|
+
*/
|
|
144
|
+
test(id: string): Promise<McpTestResult>;
|
|
145
|
+
/**
|
|
146
|
+
* Tears down every server and unregisters their tools. Safe to call
|
|
147
|
+
* repeatedly; subsequent calls are no-ops.
|
|
148
|
+
*/
|
|
149
|
+
dispose(): Promise<void>;
|
|
150
|
+
/**
|
|
151
|
+
* Serializes a lifecycle operation behind `opsLock` so concurrent
|
|
152
|
+
* `restart`/`remove`/`dispose` calls run one at a time. The lock is a
|
|
153
|
+
* promise chain — every new op `.then`s itself onto the previous one.
|
|
154
|
+
*/
|
|
155
|
+
private runOp;
|
|
156
|
+
private startServer;
|
|
157
|
+
private discoverResources;
|
|
158
|
+
private discoverPrompts;
|
|
159
|
+
private disposeServer;
|
|
160
|
+
/** Cached `resources/list` snapshot across servers (optional filter). */
|
|
161
|
+
resources(server?: string): McpResource[];
|
|
162
|
+
/** Cached `prompts/list` snapshot across servers (optional filter). */
|
|
163
|
+
prompts(server?: string): McpPrompt[];
|
|
164
|
+
readResource(server: string, uri: string, signal: AbortSignal): Promise<{
|
|
165
|
+
contents: McpResourceContent[];
|
|
166
|
+
redact: (msg: string) => string;
|
|
167
|
+
}>;
|
|
168
|
+
getPrompt(server: string, name: string, args: Record<string, string>, signal: AbortSignal): Promise<{
|
|
169
|
+
messages: McpPromptMessage[];
|
|
170
|
+
description?: string;
|
|
171
|
+
redact: (msg: string) => string;
|
|
172
|
+
}>;
|
|
173
|
+
/** (5.4 S3) Throw if the server's client was swapped/disposed during an await. */
|
|
174
|
+
private assertSameGeneration;
|
|
175
|
+
/**
|
|
176
|
+
* Test/slash seam — returns the per-server OAuth bag (provider,
|
|
177
|
+
* callback server, coalescer, redactor). Returns undefined when the
|
|
178
|
+
* server isn't OAuth-configured or hasn't been started yet.
|
|
179
|
+
*/
|
|
180
|
+
getOAuthState(id: string): OAuthServerState | undefined;
|
|
181
|
+
/**
|
|
182
|
+
* (3.7) Logs out a single OAuth-configured server:
|
|
183
|
+
* 1. Bumps the vault payload's generation (via `invalidateCredentials("all")`)
|
|
184
|
+
* so late-arriving `saveTokens` from a refresh that escaped the
|
|
185
|
+
* teardown drops on the generation guard inside `mergeMutate`
|
|
186
|
+
* (codex Round-1 MUST-FIX #5).
|
|
187
|
+
* 2. Restarts the server. **(codex Round-2 MUST-FIX #3)** `startServer`
|
|
188
|
+
* constructs a FRESH `ChancesOAuthClientProvider` with the new
|
|
189
|
+
* generation snapshot, so the next `/mcp login` can persist tokens
|
|
190
|
+
* and the old provider's cached state can't resurface.
|
|
191
|
+
*
|
|
192
|
+
* No-op when the server isn't OAuth-configured.
|
|
193
|
+
*/
|
|
194
|
+
logout(id: string): Promise<void>;
|
|
195
|
+
/** (3.7) Logs out every OAuth-configured server. Per-server failures
|
|
196
|
+
* don't abort the loop. */
|
|
197
|
+
logoutAll(): Promise<void>;
|
|
198
|
+
}
|
|
199
|
+
//# sourceMappingURL=host.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../src/mcp/host.ts"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