@andorra-labs/code 0.1.12 → 0.1.13
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/src/account-presentation.d.ts +1 -37
- package/dist/src/account-presentation.js +2 -42
- package/dist/src/activity.d.ts +0 -25
- package/dist/src/activity.js +1 -23
- package/dist/src/agent-definitions.d.ts +0 -26
- package/dist/src/agent-definitions.js +0 -43
- package/dist/src/agent-execution.d.ts +0 -2
- package/dist/src/agent-execution.js +49 -416
- package/dist/src/agent-mcp-catalog.d.ts +0 -8
- package/dist/src/agent-mcp-catalog.js +0 -2
- package/dist/src/agent-mcp.d.ts +0 -56
- package/dist/src/agent-mcp.js +9 -153
- package/dist/src/agent-modifiers.d.ts +0 -1
- package/dist/src/agent-modifiers.js +25 -68
- package/dist/src/analytics.d.ts +0 -66
- package/dist/src/analytics.js +0 -45
- package/dist/src/anthropic-console-auth.d.ts +0 -24
- package/dist/src/anthropic-console-auth.js +0 -37
- package/dist/src/anthropic-credentials.d.ts +0 -25
- package/dist/src/anthropic-credentials.js +0 -28
- package/dist/src/app-server/protocol.d.ts +13 -245
- package/dist/src/app-server/protocol.js +1 -132
- package/dist/src/app-server/reasoning.d.ts +0 -31
- package/dist/src/app-server/reasoning.js +0 -54
- package/dist/src/app-server/terminal.d.ts +0 -36
- package/dist/src/app-server/terminal.js +3 -39
- package/dist/src/app-server/workspace.d.ts +0 -167
- package/dist/src/app-server/workspace.js +4 -406
- package/dist/src/app-server.d.ts +27 -927
- package/dist/src/app-server.js +537 -2992
- package/dist/src/artifacts.d.ts +0 -10
- package/dist/src/artifacts.js +1 -11
- package/dist/src/attachments.d.ts +4 -98
- package/dist/src/attachments.js +10 -130
- package/dist/src/auth/AuthManager.d.ts +0 -93
- package/dist/src/auth/AuthManager.js +3 -165
- package/dist/src/auth/callback-page.d.ts +0 -1
- package/dist/src/auth/callback-page.js +0 -4
- package/dist/src/auth/callback.d.ts +0 -25
- package/dist/src/auth/callback.js +1 -29
- package/dist/src/auth/deployment.d.ts +0 -16
- package/dist/src/auth/deployment.js +0 -16
- package/dist/src/auth/index.d.ts +0 -11
- package/dist/src/auth/index.js +0 -11
- package/dist/src/auth/lock.d.ts +0 -1
- package/dist/src/auth/lock.js +0 -1
- package/dist/src/auth/store.d.ts +7 -108
- package/dist/src/auth/store.js +21 -129
- package/dist/src/auth/types.d.ts +0 -8
- package/dist/src/auth-commands.d.ts +0 -5
- package/dist/src/auth-commands.js +0 -1
- package/dist/src/automation-runner.d.ts +0 -9
- package/dist/src/automation-runner.js +0 -11
- package/dist/src/automation-service.d.ts +0 -10
- package/dist/src/automation-service.js +3 -17
- package/dist/src/automation-tool.js +0 -5
- package/dist/src/automation-worker-shutdown.d.ts +0 -1
- package/dist/src/automation-worker-shutdown.js +0 -3
- package/dist/src/automations.d.ts +23 -2
- package/dist/src/automations.js +91 -12
- package/dist/src/background-tasks.d.ts +0 -23
- package/dist/src/background-tasks.js +0 -11
- package/dist/src/boot-trace.d.ts +0 -13
- package/dist/src/boot-trace.js +1 -14
- package/dist/src/browser-activity.js +0 -2
- package/dist/src/browser-bridge.d.ts +0 -2
- package/dist/src/browser-bridge.js +0 -27
- package/dist/src/browser-captcha-tool.d.ts +0 -13
- package/dist/src/browser-captcha-tool.js +3 -35
- package/dist/src/browser-extensions-tool.d.ts +24 -0
- package/dist/src/browser-extensions-tool.js +137 -0
- package/dist/src/browser-extensions.d.ts +127 -0
- package/dist/src/browser-extensions.js +729 -0
- package/dist/src/browser-observation.d.ts +0 -15
- package/dist/src/browser-observation.js +1 -22
- package/dist/src/browser-panel-tool.d.ts +1 -37
- package/dist/src/browser-panel-tool.js +3 -73
- package/dist/src/browser-runner.d.ts +0 -1
- package/dist/src/browser-runner.js +4 -45
- package/dist/src/browser-server.d.ts +0 -6
- package/dist/src/browser-server.js +6 -229
- package/dist/src/browser-session.d.ts +0 -25
- package/dist/src/browser-session.js +1 -71
- package/dist/src/browser-stealth.d.ts +0 -12
- package/dist/src/browser-stealth.js +0 -36
- package/dist/src/browser-ui/app.js +7 -174
- package/dist/src/browser-ui/style.css +0 -68
- package/dist/src/browser-ui/tokens.css +11 -93
- package/dist/src/browser-view.d.ts +47 -301
- package/dist/src/browser-view.js +333 -582
- package/dist/src/capabilities.d.ts +0 -8
- package/dist/src/capabilities.js +0 -29
- package/dist/src/capsolver.d.ts +0 -13
- package/dist/src/capsolver.js +0 -15
- package/dist/src/clarification-ui.d.ts +0 -7
- package/dist/src/clarification-ui.js +0 -8
- package/dist/src/claude-executable.d.ts +0 -1
- package/dist/src/claude-executable.js +1 -2
- package/dist/src/claude-provider.d.ts +6 -19
- package/dist/src/claude-provider.js +155 -63
- package/dist/src/cli-executable.d.ts +0 -16
- package/dist/src/cli-executable.js +0 -7
- package/dist/src/cli-process.d.ts +0 -26
- package/dist/src/cli-process.js +0 -18
- package/dist/src/cli-sign-in.d.ts +0 -20
- package/dist/src/cli-sign-in.js +1 -17
- package/dist/src/cli.d.ts +1 -55
- package/dist/src/cli.js +80 -721
- package/dist/src/code-intelligence/CodeIntelligenceManager.d.ts +4 -59
- package/dist/src/code-intelligence/CodeIntelligenceManager.js +26 -99
- package/dist/src/code-intelligence/ContextLedger.d.ts +0 -4
- package/dist/src/code-intelligence/ContextLedger.js +0 -10
- package/dist/src/code-intelligence/ContextRouter.d.ts +0 -6
- package/dist/src/code-intelligence/ContextRouter.js +0 -8
- package/dist/src/code-intelligence/codegraph/CodeGraphProjectSession.d.ts +0 -2
- package/dist/src/code-intelligence/codegraph/CodeGraphProjectSession.js +5 -12
- package/dist/src/code-intelligence/codegraph/CodeGraphProvider.d.ts +0 -6
- package/dist/src/code-intelligence/codegraph/CodeGraphProvider.js +0 -6
- package/dist/src/code-intelligence/codegraph/CodeGraphSyncBarrier.d.ts +0 -5
- package/dist/src/code-intelligence/codegraph/CodeGraphSyncBarrier.js +1 -17
- package/dist/src/code-intelligence/codegraph/repoExploreTool.d.ts +0 -5
- package/dist/src/code-intelligence/codegraph/repoExploreTool.js +0 -5
- package/dist/src/code-intelligence/repository.d.ts +0 -9
- package/dist/src/code-intelligence/repository.js +1 -11
- package/dist/src/code-intelligence/types.d.ts +0 -8
- package/dist/src/codex-auth.d.ts +0 -44
- package/dist/src/codex-auth.js +0 -45
- package/dist/src/codex-browser-auth.d.ts +0 -13
- package/dist/src/codex-browser-auth.js +3 -20
- package/dist/src/codex-errors.js +0 -2
- package/dist/src/codex-executable.d.ts +0 -2
- package/dist/src/codex-executable.js +1 -7
- package/dist/src/codex-provider.d.ts +0 -13
- package/dist/src/codex-provider.js +0 -28
- package/dist/src/codex-rpc.d.ts +0 -10
- package/dist/src/codex-rpc.js +0 -12
- package/dist/src/coding-tools.d.ts +4 -26
- package/dist/src/coding-tools.js +161 -181
- package/dist/src/command-metrics.d.ts +0 -4
- package/dist/src/command-output-tap.d.ts +0 -11
- package/dist/src/command-output-tap.js +0 -3
- package/dist/src/command-screens.d.ts +24 -0
- package/dist/src/command-screens.js +132 -100
- package/dist/src/commands.d.ts +6 -63
- package/dist/src/commands.js +20 -100
- package/dist/src/completion-gates.d.ts +0 -47
- package/dist/src/completion-gates.js +0 -14
- package/dist/src/completion.d.ts +0 -98
- package/dist/src/completion.js +2 -239
- package/dist/src/config.d.ts +11 -116
- package/dist/src/config.js +39 -171
- package/dist/src/context-budget.d.ts +0 -22
- package/dist/src/context-budget.js +0 -44
- package/dist/src/context-compaction.d.ts +29 -6
- package/dist/src/context-compaction.js +94 -25
- package/dist/src/context-selection.d.ts +0 -24
- package/dist/src/context-selection.js +0 -34
- package/dist/src/dashboard-view.d.ts +0 -2
- package/dist/src/dashboard-view.js +0 -35
- package/dist/src/dashboard.d.ts +0 -2
- package/dist/src/dashboard.js +0 -9
- package/dist/src/deadline.d.ts +0 -45
- package/dist/src/deadline.js +0 -54
- package/dist/src/decision/ContinuationAdapter.d.ts +0 -5
- package/dist/src/decision/ContinuationAdapter.js +0 -5
- package/dist/src/decision/DecisionEngine.d.ts +0 -4
- package/dist/src/decision/DecisionManager.d.ts +0 -1
- package/dist/src/decision/DecisionManager.js +2 -7
- package/dist/src/decision/DecisionPolicy.d.ts +0 -1
- package/dist/src/decision/DecisionPolicy.js +0 -1
- package/dist/src/decision/FactContinuations.d.ts +11 -43
- package/dist/src/decision/FactContinuations.js +126 -95
- package/dist/src/decision/FactServiceGate.d.ts +0 -1
- package/dist/src/decision/FactServiceGate.js +0 -4
- package/dist/src/decision/PreparedSteps.d.ts +0 -15
- package/dist/src/decision/PreparedSteps.js +0 -10
- package/dist/src/decision/applyToolMenu.d.ts +0 -1
- package/dist/src/decision/applyToolMenu.js +1 -5
- package/dist/src/decision/checks.d.ts +15 -28
- package/dist/src/decision/checks.js +118 -49
- package/dist/src/decision/facts.d.ts +0 -16
- package/dist/src/decision/facts.js +0 -30
- package/dist/src/decision/guidancePolicy.js +0 -1
- package/dist/src/decision/hostedPolicy.d.ts +0 -6
- package/dist/src/decision/hostedPolicy.js +0 -7
- package/dist/src/decision/hostedSkills.d.ts +0 -19
- package/dist/src/decision/hostedSkills.js +0 -19
- package/dist/src/decision/optimizationPolicy.d.ts +0 -3
- package/dist/src/decision/optimizationPolicy.js +1 -4
- package/dist/src/decision/providers/AndorraDecisionProvider.d.ts +0 -7
- package/dist/src/decision/providers/AndorraDecisionProvider.js +4 -27
- package/dist/src/decision/providers/HttpDecisionProvider.d.ts +0 -2
- package/dist/src/decision/providers/HttpDecisionProvider.js +0 -6
- package/dist/src/decision/routeTools.d.ts +0 -8
- package/dist/src/decision/routeTools.js +1 -8
- package/dist/src/decision/toolFamilies.d.ts +0 -1
- package/dist/src/decision/toolFamilies.js +0 -1
- package/dist/src/decision/toolMenu.d.ts +0 -3
- package/dist/src/decision/toolMenu.js +0 -4
- package/dist/src/decision/types.d.ts +0 -6
- package/dist/src/default-graph.d.ts +0 -9
- package/dist/src/default-graph.js +0 -9
- package/dist/src/delegation-changes.d.ts +0 -56
- package/dist/src/delegation-changes.js +4 -130
- package/dist/src/diff-preview.d.ts +0 -1
- package/dist/src/diff-preview.js +0 -17
- package/dist/src/duration.d.ts +0 -50
- package/dist/src/duration.js +0 -50
- package/dist/src/efficiency.d.ts +0 -39
- package/dist/src/efficiency.js +0 -16
- package/dist/src/engine/protocol.d.ts +0 -2
- package/dist/src/engine/protocol.js +0 -2
- package/dist/src/engine-streams.d.ts +0 -9
- package/dist/src/extensions.d.ts +3 -2
- package/dist/src/extensions.js +63 -35
- package/dist/src/favicons.d.ts +0 -26
- package/dist/src/favicons.js +0 -34
- package/dist/src/file-diff.d.ts +2 -58
- package/dist/src/file-diff.js +0 -32
- package/dist/src/file-read-key.d.ts +0 -7
- package/dist/src/file-read-key.js +0 -7
- package/dist/src/file-read-state.d.ts +0 -1
- package/dist/src/file-read-state.js +0 -4
- package/dist/src/firefox-cookies.d.ts +0 -34
- package/dist/src/firefox-cookies.js +1 -55
- package/dist/src/git-identity-audit.d.ts +27 -0
- package/dist/src/git-identity-audit.js +286 -0
- package/dist/src/git-identity-guard.d.ts +4 -0
- package/dist/src/git-identity-guard.js +998 -0
- package/dist/src/git-identity-hold.d.ts +12 -0
- package/dist/src/git-identity-hold.js +81 -0
- package/dist/src/git-summary.d.ts +0 -58
- package/dist/src/git-summary.js +2 -212
- package/dist/src/goal-completion-verification.d.ts +2 -2
- package/dist/src/goal-completion-verification.js +3 -6
- package/dist/src/graph-account.d.ts +0 -21
- package/dist/src/graph-account.js +0 -17
- package/dist/src/graph-editor-session.d.ts +0 -1
- package/dist/src/graph-editor-session.js +0 -3
- package/dist/src/graph-health.d.ts +0 -63
- package/dist/src/graph-health.js +0 -57
- package/dist/src/graph-manager-chat.d.ts +5 -155
- package/dist/src/graph-manager-chat.js +2 -177
- package/dist/src/graph-provider-portability.d.ts +1 -21
- package/dist/src/graph-provider-portability.js +6 -45
- package/dist/src/graph-quota.d.ts +0 -33
- package/dist/src/graph-quota.js +1 -44
- package/dist/src/graph-runner.d.ts +0 -1
- package/dist/src/graph-runner.js +31 -391
- package/dist/src/graph-selection.d.ts +0 -14
- package/dist/src/graph-selection.js +0 -14
- package/dist/src/graph-server.d.ts +2 -10
- package/dist/src/graph-server.js +39 -101
- package/dist/src/graph-studio-features.d.ts +0 -5
- package/dist/src/graph-studio-features.js +2 -42
- package/dist/src/graph-sync.d.ts +0 -78
- package/dist/src/graph-sync.js +5 -201
- package/dist/src/graph-tool.d.ts +0 -18
- package/dist/src/graph-tool.js +0 -27
- package/dist/src/graph-ui/app.js +152 -491
- package/dist/src/graph-ui/compat.js +0 -7
- package/dist/src/graph-ui/controls.css +0 -48
- package/dist/src/graph-ui/controls.js +0 -88
- package/dist/src/graph-ui/drafts.js +0 -12
- package/dist/src/graph-ui/edge-router.js +0 -62
- package/dist/src/graph-ui/embed.js +0 -59
- package/dist/src/graph-ui/icons.js +0 -8
- package/dist/src/graph-ui/library.css +0 -5
- package/dist/src/graph-ui/manager-markdown.js +0 -11
- package/dist/src/graph-ui/manager-state.js +1 -78
- package/dist/src/graph-ui/manager.css +0 -18
- package/dist/src/graph-ui/manager.js +3 -180
- package/dist/src/graph-ui/model-picker.js +0 -29
- package/dist/src/graph-ui/sidebar.js +2 -3
- package/dist/src/graph-ui/skill-picker.js +373 -39
- package/dist/src/graph-ui/studio-canvas.js +3 -38
- package/dist/src/graph-ui/studio.css +0 -18
- package/dist/src/graph-ui/studio.js +3 -71
- package/dist/src/graph-ui/style.css +11 -134
- package/dist/src/graph-ui/theme.js +1 -26
- package/dist/src/graph-ui/tokens.css +15 -114
- package/dist/src/graphs.d.ts +6 -157
- package/dist/src/graphs.js +65 -266
- package/dist/src/grep-regex-worker.js +0 -2
- package/dist/src/grep-regex.d.ts +1 -5
- package/dist/src/grep-regex.js +6 -8
- package/dist/src/grok-provider.d.ts +0 -17
- package/dist/src/grok-provider.js +1 -26
- package/dist/src/handoffs.d.ts +0 -11
- package/dist/src/handoffs.js +0 -13
- package/dist/src/hardened-runtime.d.ts +0 -10
- package/dist/src/hardened-runtime.js +8 -46
- package/dist/src/harness-home.d.ts +21 -0
- package/dist/src/harness-home.js +87 -0
- package/dist/src/host-process-guard.d.ts +0 -50
- package/dist/src/host-process-guard.js +0 -641
- package/dist/src/limits.d.ts +0 -64
- package/dist/src/limits.js +0 -62
- package/dist/src/managed-sign-in.d.ts +0 -12
- package/dist/src/managed-sign-in.js +0 -16
- package/dist/src/markdown.d.ts +0 -28
- package/dist/src/markdown.js +1 -175
- package/dist/src/mcp.d.ts +0 -99
- package/dist/src/mcp.js +4 -170
- package/dist/src/membership-errors.d.ts +0 -14
- package/dist/src/membership-errors.js +0 -13
- package/dist/src/membership.d.ts +2 -60
- package/dist/src/membership.js +0 -85
- package/dist/src/memory/LocalToolMemory.d.ts +0 -1
- package/dist/src/memory/LocalToolMemory.js +2 -7
- package/dist/src/memory/MemoryDistiller.js +0 -15
- package/dist/src/memory/MemoryManager.d.ts +0 -3
- package/dist/src/memory/MemoryManager.js +6 -18
- package/dist/src/memory/MemoryPolicy.d.ts +0 -2
- package/dist/src/memory/MemoryPolicy.js +0 -2
- package/dist/src/memory/MemoryProvider.d.ts +0 -6
- package/dist/src/memory/MemoryRetriever.js +0 -7
- package/dist/src/memory/PermissionMemoryProvider.d.ts +0 -1
- package/dist/src/memory/PermissionMemoryProvider.js +0 -1
- package/dist/src/memory/ProjectMemory.d.ts +5 -40
- package/dist/src/memory/ProjectMemory.js +22 -47
- package/dist/src/memory/ToolFailureLessons.d.ts +0 -3
- package/dist/src/memory/ToolFailureLessons.js +0 -6
- package/dist/src/memory/providers/NoOpMemoryProvider.d.ts +0 -1
- package/dist/src/memory/providers/NoOpMemoryProvider.js +0 -1
- package/dist/src/memory/redaction.d.ts +0 -5
- package/dist/src/memory/redaction.js +0 -11
- package/dist/src/memory/repository.d.ts +0 -6
- package/dist/src/memory/repository.js +2 -12
- package/dist/src/memory/types.d.ts +0 -1
- package/dist/src/model-health-cache.d.ts +0 -38
- package/dist/src/model-health-cache.js +1 -49
- package/dist/src/model-metadata.d.ts +0 -18
- package/dist/src/model-metadata.js +2 -42
- package/dist/src/model-override.d.ts +0 -36
- package/dist/src/model-override.js +0 -43
- package/dist/src/model-tiers.d.ts +0 -13
- package/dist/src/model-tiers.js +0 -23
- package/dist/src/opencode-catalog.d.ts +0 -2
- package/dist/src/opencode-catalog.js +0 -11
- package/dist/src/opencode-cli-provider.d.ts +0 -35
- package/dist/src/opencode-cli-provider.js +1 -44
- package/dist/src/opencode-provider.d.ts +0 -2
- package/dist/src/opencode-provider.js +1 -16
- package/dist/src/package-name.d.ts +0 -2
- package/dist/src/package-name.js +0 -2
- package/dist/src/paged-transcript.d.ts +0 -11
- package/dist/src/paged-transcript.js +2 -20
- package/dist/src/palette.d.ts +0 -63
- package/dist/src/palette.js +0 -63
- package/dist/src/permissions.d.ts +0 -15
- package/dist/src/permissions.js +0 -17
- package/dist/src/powershell-pool.d.ts +0 -9
- package/dist/src/powershell-pool.js +3 -26
- package/dist/src/process-warnings.d.ts +4 -0
- package/dist/src/process-warnings.js +103 -0
- package/dist/src/profile.d.ts +0 -43
- package/dist/src/profile.js +0 -43
- package/dist/src/project-reservation.d.ts +11 -0
- package/dist/src/project-reservation.js +143 -0
- package/dist/src/provider-connection.d.ts +0 -18
- package/dist/src/provider-connection.js +0 -39
- package/dist/src/provider-engine.d.ts +0 -21
- package/dist/src/provider-engine.js +1 -96
- package/dist/src/provider-import.d.ts +0 -49
- package/dist/src/provider-import.js +0 -60
- package/dist/src/provider-keys.d.ts +1 -36
- package/dist/src/provider-keys.js +5 -48
- package/dist/src/provider-settings.d.ts +0 -2
- package/dist/src/provider-settings.js +0 -32
- package/dist/src/providers.d.ts +0 -217
- package/dist/src/providers.js +0 -315
- package/dist/src/pull-requests.d.ts +0 -173
- package/dist/src/pull-requests.js +5 -195
- package/dist/src/qa/browser/PlaywrightRunner.d.ts +0 -7
- package/dist/src/qa/browser/PlaywrightRunner.js +2 -16
- package/dist/src/qa/command-policy.d.ts +0 -23
- package/dist/src/qa/command-policy.js +0 -30
- package/dist/src/qa/guidance.d.ts +0 -21
- package/dist/src/qa/guidance.js +0 -20
- package/dist/src/qa/profile/ProjectInspector.d.ts +0 -4
- package/dist/src/qa/profile/ProjectInspector.js +0 -6
- package/dist/src/qa/profile/QaConfigLoader.d.ts +0 -7
- package/dist/src/qa/profile/QaConfigLoader.js +0 -6
- package/dist/src/qa/profile/QaProfile.d.ts +0 -7
- package/dist/src/qa/profile/QaProfile.js +0 -7
- package/dist/src/qa/profile/yaml.d.ts +0 -9
- package/dist/src/qa/profile/yaml.js +0 -13
- package/dist/src/qa/qa-authorize.d.ts +0 -19
- package/dist/src/qa/qa-authorize.js +4 -11
- package/dist/src/qa/runtime/ProcessManager.d.ts +0 -31
- package/dist/src/qa/runtime/ProcessManager.js +4 -41
- package/dist/src/qa/runtime/PtyManager.d.ts +0 -4
- package/dist/src/qa/runtime/PtyManager.js +1 -7
- package/dist/src/qa/runtime/changes.d.ts +0 -11
- package/dist/src/qa/runtime/changes.js +1 -3
- package/dist/src/qa/tools.d.ts +0 -10
- package/dist/src/qa/tools.js +0 -12
- package/dist/src/qa/types.d.ts +0 -13
- package/dist/src/react-runtime.d.ts +2 -21
- package/dist/src/react-runtime.js +95 -415
- package/dist/src/read-document-doc.d.ts +0 -6
- package/dist/src/read-document-doc.js +0 -55
- package/dist/src/read-document-docx.d.ts +0 -16
- package/dist/src/read-document-docx.js +2 -69
- package/dist/src/read-document-text.d.ts +0 -17
- package/dist/src/read-document-text.js +0 -22
- package/dist/src/read-document-tool.d.ts +0 -31
- package/dist/src/read-document-tool.js +0 -30
- package/dist/src/read-document.d.ts +0 -49
- package/dist/src/read-document.js +1 -67
- package/dist/src/read-image.d.ts +0 -32
- package/dist/src/read-image.js +0 -33
- package/dist/src/remote/cert.d.ts +0 -18
- package/dist/src/remote/cert.js +0 -44
- package/dist/src/remote/client.d.ts +0 -70
- package/dist/src/remote/client.js +1 -116
- package/dist/src/remote/command.js +0 -17
- package/dist/src/remote/engine-pool.d.ts +0 -152
- package/dist/src/remote/engine-pool.js +17 -335
- package/dist/src/remote/errors.d.ts +0 -15
- package/dist/src/remote/errors.js +0 -7
- package/dist/src/remote/network.d.ts +0 -26
- package/dist/src/remote/network.js +1 -34
- package/dist/src/remote/pairing.d.ts +16 -51
- package/dist/src/remote/pairing.js +50 -57
- package/dist/src/remote/pem.d.ts +0 -4
- package/dist/src/remote/pem.js +0 -4
- package/dist/src/remote/roots.d.ts +0 -20
- package/dist/src/remote/roots.js +0 -8
- package/dist/src/remote/serve.d.ts +0 -47
- package/dist/src/remote/serve.js +0 -30
- package/dist/src/remote/server.d.ts +0 -14
- package/dist/src/remote/server.js +1 -79
- package/dist/src/remote/types.d.ts +1 -32
- package/dist/src/remote/types.js +0 -10
- package/dist/src/run-control.d.ts +0 -7
- package/dist/src/run-control.js +0 -7
- package/dist/src/run-progress.d.ts +0 -170
- package/dist/src/run-progress.js +0 -285
- package/dist/src/run-records.d.ts +0 -443
- package/dist/src/run-records.js +14 -687
- package/dist/src/run-temp.d.ts +12 -0
- package/dist/src/run-temp.js +50 -0
- package/dist/src/runtime.d.ts +10 -228
- package/dist/src/runtime.js +0 -127
- package/dist/src/sandbox-child.js +0 -1
- package/dist/src/save-lock.d.ts +0 -12
- package/dist/src/save-lock.js +0 -28
- package/dist/src/screen-selection.d.ts +0 -23
- package/dist/src/screen-selection.js +0 -22
- package/dist/src/secret-redaction.d.ts +0 -12
- package/dist/src/secret-redaction.js +0 -45
- package/dist/src/session-changes.d.ts +4 -80
- package/dist/src/session-changes.js +25 -130
- package/dist/src/session-goal.d.ts +129 -0
- package/dist/src/session-goal.js +230 -0
- package/dist/src/session-monitor.d.ts +1 -10
- package/dist/src/session-monitor.js +2 -39
- package/dist/src/session-reaper.d.ts +0 -15
- package/dist/src/session-reaper.js +0 -14
- package/dist/src/session-skills.d.ts +15 -44
- package/dist/src/session-skills.js +75 -60
- package/dist/src/session-summary.d.ts +0 -26
- package/dist/src/session-summary.js +0 -32
- package/dist/src/session-title.d.ts +0 -1
- package/dist/src/session-title.js +0 -2
- package/dist/src/sessions.d.ts +2 -122
- package/dist/src/sessions.js +7 -178
- package/dist/src/shell.d.ts +3 -20
- package/dist/src/shell.js +8 -72
- package/dist/src/side-panel.d.ts +5 -99
- package/dist/src/side-panel.js +76 -133
- package/dist/src/sign-in-detection.d.ts +0 -39
- package/dist/src/sign-in-detection.js +0 -43
- package/dist/src/sign-in-offer.d.ts +1 -19
- package/dist/src/sign-in-offer.js +0 -13
- package/dist/src/skill-commands.d.ts +0 -1
- package/dist/src/skill-commands.js +1 -4
- package/dist/src/skills/bundled/control-browser/SKILL.md +1 -1
- package/dist/src/skills/bundled/provenance.json +1 -1
- package/dist/src/skills/invocable-skills.d.ts +0 -18
- package/dist/src/skills/invocable-skills.js +0 -17
- package/dist/src/skills/project-skills.d.ts +0 -1
- package/dist/src/skills/project-skills.js +0 -3
- package/dist/src/skills/prompt-skills.js +0 -14
- package/dist/src/skills/runtime-skills.d.ts +0 -13
- package/dist/src/skills/runtime-skills.js +0 -37
- package/dist/src/stall-recovery.d.ts +0 -25
- package/dist/src/stall-recovery.js +0 -38
- package/dist/src/stray-files.d.ts +0 -9
- package/dist/src/stray-files.js +0 -16
- package/dist/src/structured-step.d.ts +0 -22
- package/dist/src/structured-step.js +0 -22
- package/dist/src/subagent-run.d.ts +0 -163
- package/dist/src/subagent-run.js +4 -373
- package/dist/src/subagent-tree.d.ts +32 -0
- package/dist/src/subagent-tree.js +128 -0
- package/dist/src/telemetry/aggregate.d.ts +0 -37
- package/dist/src/telemetry/aggregate.js +0 -40
- package/dist/src/telemetry/capture-core.d.ts +0 -87
- package/dist/src/telemetry/capture-core.js +0 -67
- package/dist/src/telemetry/capture.d.ts +0 -1
- package/dist/src/telemetry/capture.js +0 -3
- package/dist/src/telemetry/classify.d.ts +0 -58
- package/dist/src/telemetry/classify.js +0 -60
- package/dist/src/telemetry/decision-capture.d.ts +0 -1
- package/dist/src/telemetry/emitter.d.ts +0 -30
- package/dist/src/telemetry/emitter.js +1 -62
- package/dist/src/telemetry/gate.d.ts +0 -29
- package/dist/src/telemetry/gate.js +0 -22
- package/dist/src/telemetry/identity.d.ts +0 -13
- package/dist/src/telemetry/identity.js +0 -29
- package/dist/src/telemetry/outbox.d.ts +0 -64
- package/dist/src/telemetry/outbox.js +1 -108
- package/dist/src/telemetry/schema.d.ts +1 -49
- package/dist/src/telemetry/schema.js +1 -82
- package/dist/src/telemetry/state.d.ts +0 -53
- package/dist/src/telemetry/state.js +0 -64
- package/dist/src/telemetry/surface.d.ts +0 -31
- package/dist/src/telemetry/surface.js +1 -39
- package/dist/src/telemetry/uploader.d.ts +0 -11
- package/dist/src/telemetry/uploader.js +0 -46
- package/dist/src/telemetry/uploads.d.ts +0 -11
- package/dist/src/telemetry/uploads.js +0 -11
- package/dist/src/telemetry/version.d.ts +0 -4
- package/dist/src/telemetry/version.js +0 -14
- package/dist/src/telemetry/workspace.d.ts +0 -7
- package/dist/src/telemetry/workspace.js +1 -22
- package/dist/src/terminal-ui.d.ts +14 -523
- package/dist/src/terminal-ui.js +74 -876
- package/dist/src/test-edit-guard.d.ts +74 -0
- package/dist/src/test-edit-guard.js +269 -0
- package/dist/src/text.d.ts +0 -1
- package/dist/src/text.js +0 -1
- package/dist/src/time-limit.d.ts +0 -36
- package/dist/src/time-limit.js +0 -37
- package/dist/src/timers.d.ts +0 -161
- package/dist/src/timers.js +0 -126
- package/dist/src/todos.d.ts +0 -1
- package/dist/src/todos.js +0 -3
- package/dist/src/token-rate.d.ts +0 -94
- package/dist/src/token-rate.js +0 -154
- package/dist/src/tool-activity.d.ts +0 -6
- package/dist/src/tool-activity.js +0 -7
- package/dist/src/tool-availability.d.ts +0 -13
- package/dist/src/tool-availability.js +1 -14
- package/dist/src/tool-call-clock.d.ts +1 -4
- package/dist/src/tool-call-clock.js +0 -13
- package/dist/src/tool-catalog.d.ts +0 -11
- package/dist/src/tool-catalog.js +0 -23
- package/dist/src/tool-dependencies.d.ts +0 -5
- package/dist/src/tool-dependencies.js +0 -4
- package/dist/src/tool-diff-stats.d.ts +0 -23
- package/dist/src/tool-diff-stats.js +0 -49
- package/dist/src/tool-errors.d.ts +9 -7
- package/dist/src/tool-errors.js +13 -6
- package/dist/src/tool-failure-tracker.d.ts +3 -11
- package/dist/src/tool-failure-tracker.js +19 -27
- package/dist/src/tool-names.d.ts +0 -16
- package/dist/src/tool-names.js +0 -12
- package/dist/src/tool-profile.d.ts +6 -0
- package/dist/src/tool-profile.js +23 -0
- package/dist/src/tool-result-filter.d.ts +0 -19
- package/dist/src/tool-result-filter.js +1 -66
- package/dist/src/tool-schema-compatibility.d.ts +0 -6
- package/dist/src/tool-schema-compatibility.js +0 -9
- package/dist/src/tools.d.ts +0 -4
- package/dist/src/tools.js +11 -114
- package/dist/src/trajectory.d.ts +0 -13
- package/dist/src/trajectory.js +23 -79
- package/dist/src/transcript.d.ts +0 -41
- package/dist/src/transcript.js +2 -60
- package/dist/src/types.d.ts +1 -168
- package/dist/src/untracked-file-removal.js +0 -20
- package/dist/src/update-check.d.ts +0 -14
- package/dist/src/update-check.js +1 -15
- package/dist/src/update.d.ts +0 -35
- package/dist/src/update.js +0 -100
- package/dist/src/usage-analytics.d.ts +17 -17
- package/dist/src/usage-analytics.js +168 -209
- package/dist/src/web-search.d.ts +0 -23
- package/dist/src/web-search.js +1 -27
- package/dist/src/widgets.d.ts +0 -25
- package/dist/src/widgets.js +0 -24
- package/dist/src/workspace-facts.d.ts +0 -12
- package/dist/src/workspace-facts.js +1 -18
- package/dist/src/workspace-git-metadata.d.ts +0 -16
- package/dist/src/workspace-git-metadata.js +0 -21
- package/dist/src/workspace-instructions.d.ts +3 -15
- package/dist/src/workspace-instructions.js +6 -19
- package/package.json +2 -2
package/dist/src/mcp.d.ts
CHANGED
|
@@ -3,62 +3,27 @@ import type { Tool, ToolContext } from './types.js';
|
|
|
3
3
|
export type RuntimeMcpServerConfig = McpServerConfig & {
|
|
4
4
|
pluginRoot?: string;
|
|
5
5
|
};
|
|
6
|
-
/** One tool as its server described it, before it is renamed and bounded for a task. */
|
|
7
6
|
export interface McpCatalogTool {
|
|
8
7
|
name: string;
|
|
9
8
|
description?: string;
|
|
10
9
|
inputSchema: Record<string, unknown>;
|
|
11
10
|
}
|
|
12
|
-
/** The tools a server reported the last time it was asked. */
|
|
13
11
|
export type McpCatalogRecord = {
|
|
14
12
|
tools: McpCatalogTool[];
|
|
15
13
|
};
|
|
16
|
-
/**
|
|
17
|
-
* Where the answer a server last gave is kept between tasks.
|
|
18
|
-
*
|
|
19
|
-
* Starting a stdio server and listing its tools takes seconds, and the model's first request needs
|
|
20
|
-
* the list. A server whose answer is remembered is treated by that record at once while the server
|
|
21
|
-
* itself starts beside the first model request; see {@link connectMcpServers}.
|
|
22
|
-
*/
|
|
23
14
|
export interface McpCatalogStore {
|
|
24
15
|
read(key: string): Promise<McpCatalogRecord | undefined>;
|
|
25
16
|
write(key: string, record: McpCatalogRecord): Promise<void>;
|
|
26
17
|
remove(key: string): Promise<void>;
|
|
27
18
|
}
|
|
28
|
-
/**
|
|
29
|
-
* The identity a remembered catalog is filed under.
|
|
30
|
-
*
|
|
31
|
-
* Everything that can change what a server reports is part of it: its name, its whole
|
|
32
|
-
* configuration (command, arguments, environment, address, headers) and the workspace a stdio
|
|
33
|
-
* server is started in. Credentials in the configuration only ever enter the digest.
|
|
34
|
-
*/
|
|
35
19
|
export declare function mcpCatalogKey(id: string, config: RuntimeMcpServerConfig, workspace: string): string;
|
|
36
|
-
/** Remembered catalogs as one small file each under the configuration home. Every failure reads as "not remembered". */
|
|
37
20
|
export declare function mcpCatalogStore(directory: string): McpCatalogStore;
|
|
38
21
|
export declare function mcpToolName(server: string, tool: string): string;
|
|
39
|
-
/**
|
|
40
|
-
* A server definition as an edit form sent it, applied over the saved one.
|
|
41
|
-
*
|
|
42
|
-
* Environment values and header values are secrets the engine never returns, so the form cannot
|
|
43
|
-
* send them back: an entry whose value is `null` keeps the saved value of that name, an entry with
|
|
44
|
-
* a string is the new value, and a name the edit leaves out is removed. An endpoint sent without
|
|
45
|
-
* the query string the saved one carries (the form is shown it without, since a query can hold a
|
|
46
|
-
* credential) keeps the saved endpoint. The transport may change; whether the server is enabled
|
|
47
|
-
* does not — the switch beside it does that.
|
|
48
|
-
*/
|
|
49
22
|
export declare function mergeMcpEdit(saved: McpServerConfig, edit: unknown): McpServerConfig;
|
|
50
|
-
/** Told how a server's connection went, by the task that made it: what the status store records. */
|
|
51
23
|
export type McpStatusReporter = (id: string, config: RuntimeMcpServerConfig, result: McpProbeResult) => void;
|
|
52
|
-
/**
|
|
53
|
-
* A reporter that records what a task's connections answered. A task names a server from the
|
|
54
|
-
* configuration `configured:<id>` (the extension snapshot's namespace, apart from plugins' servers),
|
|
55
|
-
* and the record is filed under the configuration's own id, which is what the settings page lists.
|
|
56
|
-
*/
|
|
57
24
|
export declare function mcpTaskStatusReporter(directory: string): McpStatusReporter;
|
|
58
|
-
/** What a server last answered — to a task's connection or an explicit check — and when. */
|
|
59
25
|
export interface McpStatusRecord {
|
|
60
26
|
id: string;
|
|
61
|
-
/** The definition it answered for (`mcpDefinitionKey`): an edited server has no status yet. */
|
|
62
27
|
definition: string;
|
|
63
28
|
state: 'ready' | 'failed';
|
|
64
29
|
tools?: number;
|
|
@@ -66,23 +31,11 @@ export interface McpStatusRecord {
|
|
|
66
31
|
checkedAt: string;
|
|
67
32
|
source: 'task' | 'check';
|
|
68
33
|
}
|
|
69
|
-
/**
|
|
70
|
-
* The identity of a server's definition — command, arguments, environment, address, headers — and
|
|
71
|
-
* not whether it is turned on, so a status survives the switch but not an edit. Credentials in the
|
|
72
|
-
* definition only enter the digest.
|
|
73
|
-
*/
|
|
74
34
|
export declare function mcpDefinitionKey(config: RuntimeMcpServerConfig): string;
|
|
75
|
-
/**
|
|
76
|
-
* The last thing each server answered, one small file per server under the configuration home, so a
|
|
77
|
-
* settings page can show it without starting anything. A task's connection writes it, and so does an
|
|
78
|
-
* explicit check (`mcp.status`); one file per server keeps two processes recording at once from
|
|
79
|
-
* overwriting each other's servers. Every failure to read reads as "not checked".
|
|
80
|
-
*/
|
|
81
35
|
export declare function mcpStatusStore(directory: string): {
|
|
82
36
|
list(): Promise<McpStatusRecord[]>;
|
|
83
37
|
record(id: string, config: RuntimeMcpServerConfig, result: McpProbeResult, source: McpStatusRecord['source'], at?: Date): Promise<McpStatusRecord>;
|
|
84
38
|
};
|
|
85
|
-
/** What a configured server answered when it was asked for its tools outside a task. */
|
|
86
39
|
export type McpProbeResult = {
|
|
87
40
|
state: 'ready';
|
|
88
41
|
tools: number;
|
|
@@ -90,42 +43,16 @@ export type McpProbeResult = {
|
|
|
90
43
|
state: 'failed';
|
|
91
44
|
error: string;
|
|
92
45
|
};
|
|
93
|
-
/**
|
|
94
|
-
* Start one configured server, list its tools, and stop it again: the check a person asks for from
|
|
95
|
-
* the settings page ("Check Connection"), never one a page makes on its own — a task asks before it
|
|
96
|
-
* connects a server, and opening a page is not that consent.
|
|
97
|
-
*
|
|
98
|
-
* Nothing is kept. The catalog is only counted, and the client — with the process it started, for a
|
|
99
|
-
* stdio server — is closed before this returns, whatever happened. A probe is bounded in time as a
|
|
100
|
-
* task's connection is: 15 seconds to connect, 15 per page of tools, 30 in all.
|
|
101
|
-
*/
|
|
102
46
|
export declare function probeMcpServer(config: RuntimeMcpServerConfig, workspace: string, signal?: AbortSignal): Promise<McpProbeResult>;
|
|
103
|
-
/**
|
|
104
|
-
* Why a probe failed, in words a person can act on.
|
|
105
|
-
*
|
|
106
|
-
* A transport error can carry what the server sent back, and an HTTP one can echo the request's own
|
|
107
|
-
* headers, so the message itself is never passed on: the error is sorted into a known kind, and only
|
|
108
|
-
* the facts that are the configuration's own (its command) or the protocol's (a status code) are named.
|
|
109
|
-
*/
|
|
110
47
|
export declare function probeFailureReason(error: unknown, config: Pick<McpServerConfig, 'transport'> & {
|
|
111
48
|
command?: string;
|
|
112
49
|
}): string;
|
|
113
|
-
/** The tool a model uses to read the descriptions and input schemas of tools that are offered on demand. */
|
|
114
50
|
export declare const MCP_FIND_TOOLS = "mcp_find_tools";
|
|
115
|
-
/** The tool a model uses to run a tool that is offered on demand. */
|
|
116
51
|
export declare const MCP_CALL_TOOL = "mcp_call_tool";
|
|
117
|
-
/**
|
|
118
|
-
* The index of on-demand tools a model is shown: each server with its tool names, within
|
|
119
|
-
* {@link MCP_INDEX_MAX_BYTES}. Names past the bound are counted, and the lookup finds them by query.
|
|
120
|
-
*/
|
|
121
52
|
export declare function deferredIndex(servers: {
|
|
122
53
|
id: string;
|
|
123
54
|
catalog: McpCatalogTool[];
|
|
124
55
|
}[]): string;
|
|
125
|
-
/**
|
|
126
|
-
* The tools of on-demand servers that match a lookup, best first: every named tool, or the tools
|
|
127
|
-
* whose name or description carries the most words of the query, or a server's whole list.
|
|
128
|
-
*/
|
|
129
56
|
export declare function findDeferredTools(servers: {
|
|
130
57
|
id: string;
|
|
131
58
|
catalog: McpCatalogTool[];
|
|
@@ -137,36 +64,10 @@ export declare function findDeferredTools(servers: {
|
|
|
137
64
|
server: string;
|
|
138
65
|
tool: McpCatalogTool;
|
|
139
66
|
}[];
|
|
140
|
-
/**
|
|
141
|
-
* What {@link MCP_FIND_TOOLS} answers, always within {@link MCP_FIND_MAX_CHARS}.
|
|
142
|
-
*
|
|
143
|
-
* Matching tools are described with their schemas, best first, while they fit. A tool whose own
|
|
144
|
-
* description and schema would not fit one answer is named with how many parts it takes; asking
|
|
145
|
-
* for it by exact name with `part` returns that slice of its JSON, and the parts joined in order
|
|
146
|
-
* are the whole entry.
|
|
147
|
-
*/
|
|
148
67
|
export declare function answerFind(servers: {
|
|
149
68
|
id: string;
|
|
150
69
|
catalog: McpCatalogTool[];
|
|
151
70
|
}[], args: Record<string, unknown>): string;
|
|
152
|
-
/**
|
|
153
|
-
* Each task owns its clients; no server tools or spawned processes survive task exit.
|
|
154
|
-
*
|
|
155
|
-
* A server's tools are offered one by one while their advertised metadata fits the task's budget
|
|
156
|
-
* ({@link MCP_CATALOG_MAX_BYTES} across servers, in order). A server whose catalog does not fit is
|
|
157
|
-
* not dropped: its tools are offered on demand, through {@link MCP_FIND_TOOLS} (an index of their
|
|
158
|
-
* names, and their schemas when looked up) and {@link MCP_CALL_TOOL}, which runs them under the
|
|
159
|
-
* same approval as a tool offered by itself.
|
|
160
|
-
*
|
|
161
|
-
* With `catalogs`, a server this home has already heard from does not hold the task back while it
|
|
162
|
-
* starts. Its connection is approved first, as every server's is. Then its last answer decides
|
|
163
|
-
* what the task is told now — its tools, offered from the record, one by one or on demand — and the
|
|
164
|
-
* server itself connects behind the caller, where a call to one of its tools waits for the
|
|
165
|
-
* connection. The record is checked against what the server reports once it is up: a catalog that
|
|
166
|
-
* changed is used from the next task on, and a server that could not be reached is forgotten, so
|
|
167
|
-
* the next task asks it before offering anything, as a server seen for the first time is always
|
|
168
|
-
* asked. `settled` resolves when every server has answered.
|
|
169
|
-
*/
|
|
170
71
|
export declare function connectMcpServers(servers: Record<string, RuntimeMcpServerConfig>, context: ToolContext, notice: (message: string) => void, taskSignal?: AbortSignal, options?: {
|
|
171
72
|
catalogs?: McpCatalogStore;
|
|
172
73
|
status?: McpStatusReporter;
|
package/dist/src/mcp.js
CHANGED
|
@@ -8,35 +8,22 @@ import { authorize } from './tools.js';
|
|
|
8
8
|
import { permissionMode, PLAN_MODE_MUTATION_ERROR } from './permissions.js';
|
|
9
9
|
import { validateMcpServer } from './config.js';
|
|
10
10
|
import { clipText } from './text.js';
|
|
11
|
-
/** The bytes of tool metadata a task lists one by one, across servers. A server past what is left is offered on demand. */
|
|
12
11
|
const MCP_CATALOG_MAX_BYTES = 16_000;
|
|
13
12
|
const MCP_CATALOG_MAX_TOOLS = 500;
|
|
14
|
-
/** The most tools one server may report. */
|
|
15
13
|
const MCP_SERVER_MAX_TOOLS = 1000;
|
|
16
|
-
/** The bytes the index of on-demand tools takes in the lookup tool's description. */
|
|
17
14
|
const MCP_INDEX_MAX_BYTES = 6_000;
|
|
18
15
|
const MCP_STARTUP_MAX_SERVERS = 8;
|
|
19
16
|
const MCP_RESPONSE_MAX_BYTES = 1024 * 1024;
|
|
20
|
-
/** A remembered catalog larger than this was not written by this module, and is not read back. */
|
|
21
17
|
const MCP_CATALOG_FILE_MAX_BYTES = 4 * 1024 * 1024;
|
|
22
|
-
/**
|
|
23
|
-
* The identity a remembered catalog is filed under.
|
|
24
|
-
*
|
|
25
|
-
* Everything that can change what a server reports is part of it: its name, its whole
|
|
26
|
-
* configuration (command, arguments, environment, address, headers) and the workspace a stdio
|
|
27
|
-
* server is started in. Credentials in the configuration only ever enter the digest.
|
|
28
|
-
*/
|
|
29
18
|
export function mcpCatalogKey(id, config, workspace) {
|
|
30
19
|
return createHash('sha256').update(canonical([id, config, workspace])).digest('hex');
|
|
31
20
|
}
|
|
32
|
-
/** JSON with object keys in one order, so two values that say the same thing serialize the same way. */
|
|
33
21
|
function canonical(value) {
|
|
34
22
|
const ordered = (item) => Array.isArray(item) ? item.map(ordered)
|
|
35
23
|
: item && typeof item === 'object' ? Object.fromEntries(Object.entries(item).sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0).map(([name, inner]) => [name, ordered(inner)]))
|
|
36
24
|
: item;
|
|
37
25
|
return JSON.stringify(ordered(value));
|
|
38
26
|
}
|
|
39
|
-
/** Remembered catalogs as one small file each under the configuration home. Every failure reads as "not remembered". */
|
|
40
27
|
export function mcpCatalogStore(directory) {
|
|
41
28
|
const root = join(directory, 'mcp-catalogs');
|
|
42
29
|
const path = (key) => {
|
|
@@ -53,7 +40,6 @@ export function mcpCatalogStore(directory) {
|
|
|
53
40
|
const parsed = JSON.parse(raw);
|
|
54
41
|
if (!parsed || parsed.version !== 1)
|
|
55
42
|
return undefined;
|
|
56
|
-
// An earlier version recorded only that a catalog did not fit; such a server is asked again.
|
|
57
43
|
if (parsed.overBudget === true)
|
|
58
44
|
return undefined;
|
|
59
45
|
return Array.isArray(parsed.tools) ? { tools: parsed.tools } : undefined;
|
|
@@ -78,8 +64,6 @@ export function mcpCatalogStore(directory) {
|
|
|
78
64
|
async remove(key) { await rm(path(key), { force: true }); },
|
|
79
65
|
};
|
|
80
66
|
}
|
|
81
|
-
// Bound bytes before the SDK parses JSON/SSE or materializes a tool result.
|
|
82
|
-
// The same ceiling applies to discovery, error bodies and long-lived SSE streams.
|
|
83
67
|
async function boundedMcpFetch(url, init, overflow) {
|
|
84
68
|
const response = await fetch(url, init?.method === 'DELETE' ? { ...init, signal: AbortSignal.any([...(init.signal ? [init.signal] : []), AbortSignal.timeout(2_000)]) } : init);
|
|
85
69
|
if (!response.body)
|
|
@@ -122,11 +106,8 @@ async function boundedMcpFetch(url, init, overflow) {
|
|
|
122
106
|
export function mcpToolName(server, tool) {
|
|
123
107
|
return `mcp_${server.replace(/\W/g, '_').slice(0, 20)}_${tool.replace(/\W/g, '_').slice(0, 20)}_${createHash('sha256').update(JSON.stringify([server, tool])).digest('hex').slice(0, 12)}`;
|
|
124
108
|
}
|
|
125
|
-
/** What a model is told about one server tool. */
|
|
126
109
|
const advertise = (id, tool) => ({ name: mcpToolName(id, tool.name), description: `MCP ${id} / ${tool.name}: ${tool.description ?? ''}`, parameters: tool.inputSchema });
|
|
127
|
-
/** The bytes one advertised tool takes of a task's catalog budget, array separator included (conservative for the first entry). */
|
|
128
110
|
const advertisedBytes = (id, tool) => Buffer.byteLength(JSON.stringify(advertise(id, tool)), 'utf8') + 1;
|
|
129
|
-
/** The limits one tool's own metadata must meet, whether a server just reported it or a record of it was read back. */
|
|
130
111
|
function checkCatalogTool(id, tool, seen) {
|
|
131
112
|
if (!tool || typeof tool !== 'object' || typeof tool.name !== 'string' || !tool.name || seen.has(mcpToolName(id, tool.name)))
|
|
132
113
|
throw new Error('Invalid or oversized MCP tool catalog');
|
|
@@ -138,14 +119,6 @@ function checkCatalogTool(id, tool, seen) {
|
|
|
138
119
|
throw new Error('MCP tool metadata exceeds limits');
|
|
139
120
|
seen.add(mcpToolName(id, tool.name));
|
|
140
121
|
}
|
|
141
|
-
/**
|
|
142
|
-
* The transport one configured server is reached over.
|
|
143
|
-
*
|
|
144
|
-
* The SDK adds its minimal default environment; only the explicitly configured entries are passed,
|
|
145
|
-
* so unrelated provider and cloud credentials never reach an MCP process. `${NAME}` references in
|
|
146
|
-
* the environment and headers are expanded from this process's environment (and `${PLUGIN_ROOT}`
|
|
147
|
-
* from the plugin that declared the server); a reference that is not set throws.
|
|
148
|
-
*/
|
|
149
122
|
function mcpTransport(config, workspace, overflow) {
|
|
150
123
|
const expand = (value) => value.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (_, name) => { const value = name === 'PLUGIN_ROOT' && config.pluginRoot !== undefined ? config.pluginRoot : process.env[name]; if (value === undefined)
|
|
151
124
|
throw new Error(MISSING_REFERENCE); return value; });
|
|
@@ -155,16 +128,6 @@ function mcpTransport(config, workspace, overflow) {
|
|
|
155
128
|
return transport;
|
|
156
129
|
}
|
|
157
130
|
const MISSING_REFERENCE = 'Missing MCP environment reference';
|
|
158
|
-
/**
|
|
159
|
-
* A server definition as an edit form sent it, applied over the saved one.
|
|
160
|
-
*
|
|
161
|
-
* Environment values and header values are secrets the engine never returns, so the form cannot
|
|
162
|
-
* send them back: an entry whose value is `null` keeps the saved value of that name, an entry with
|
|
163
|
-
* a string is the new value, and a name the edit leaves out is removed. An endpoint sent without
|
|
164
|
-
* the query string the saved one carries (the form is shown it without, since a query can hold a
|
|
165
|
-
* credential) keeps the saved endpoint. The transport may change; whether the server is enabled
|
|
166
|
-
* does not — the switch beside it does that.
|
|
167
|
-
*/
|
|
168
131
|
export function mergeMcpEdit(saved, edit) {
|
|
169
132
|
if (!edit || typeof edit !== 'object' || Array.isArray(edit))
|
|
170
133
|
throw new Error('Invalid MCP server');
|
|
@@ -201,17 +164,12 @@ export function mergeMcpEdit(saved, edit) {
|
|
|
201
164
|
if (new URL(url).href === bare.href)
|
|
202
165
|
url = saved.url;
|
|
203
166
|
}
|
|
204
|
-
catch {
|
|
167
|
+
catch { }
|
|
205
168
|
}
|
|
206
169
|
return validateMcpServer({ transport: 'http', url, ...(headers === undefined ? {} : { headers }), ...enabled });
|
|
207
170
|
}
|
|
208
171
|
throw new Error('MCP transport must be stdio or http');
|
|
209
172
|
}
|
|
210
|
-
/**
|
|
211
|
-
* A reporter that records what a task's connections answered. A task names a server from the
|
|
212
|
-
* configuration `configured:<id>` (the extension snapshot's namespace, apart from plugins' servers),
|
|
213
|
-
* and the record is filed under the configuration's own id, which is what the settings page lists.
|
|
214
|
-
*/
|
|
215
173
|
export function mcpTaskStatusReporter(directory) {
|
|
216
174
|
const store = mcpStatusStore(directory);
|
|
217
175
|
return (id, config, result) => {
|
|
@@ -219,23 +177,11 @@ export function mcpTaskStatusReporter(directory) {
|
|
|
219
177
|
void store.record(configured, config, result, 'task').catch(() => { });
|
|
220
178
|
};
|
|
221
179
|
}
|
|
222
|
-
/**
|
|
223
|
-
* The identity of a server's definition — command, arguments, environment, address, headers — and
|
|
224
|
-
* not whether it is turned on, so a status survives the switch but not an edit. Credentials in the
|
|
225
|
-
* definition only enter the digest.
|
|
226
|
-
*/
|
|
227
180
|
export function mcpDefinitionKey(config) {
|
|
228
181
|
const { enabled: _enabled, ...definition } = config;
|
|
229
182
|
return createHash('sha256').update(canonical(definition)).digest('hex');
|
|
230
183
|
}
|
|
231
|
-
/** Status records are small; a file past this was not written here and is not read. */
|
|
232
184
|
const MCP_STATUS_FILE_MAX_BYTES = 16_000;
|
|
233
|
-
/**
|
|
234
|
-
* The last thing each server answered, one small file per server under the configuration home, so a
|
|
235
|
-
* settings page can show it without starting anything. A task's connection writes it, and so does an
|
|
236
|
-
* explicit check (`mcp.status`); one file per server keeps two processes recording at once from
|
|
237
|
-
* overwriting each other's servers. Every failure to read reads as "not checked".
|
|
238
|
-
*/
|
|
239
185
|
export function mcpStatusStore(directory) {
|
|
240
186
|
const root = join(directory, 'mcp-status');
|
|
241
187
|
const file = (id) => join(root, `${createHash('sha256').update(id).digest('hex')}.json`);
|
|
@@ -264,7 +210,7 @@ export function mcpStatusStore(directory) {
|
|
|
264
210
|
...(typeof parsed.error === 'string' ? { error: parsed.error } : {}),
|
|
265
211
|
});
|
|
266
212
|
}
|
|
267
|
-
catch {
|
|
213
|
+
catch { }
|
|
268
214
|
}
|
|
269
215
|
return records;
|
|
270
216
|
},
|
|
@@ -288,15 +234,6 @@ export function mcpStatusStore(directory) {
|
|
|
288
234
|
},
|
|
289
235
|
};
|
|
290
236
|
}
|
|
291
|
-
/**
|
|
292
|
-
* Start one configured server, list its tools, and stop it again: the check a person asks for from
|
|
293
|
-
* the settings page ("Check Connection"), never one a page makes on its own — a task asks before it
|
|
294
|
-
* connects a server, and opening a page is not that consent.
|
|
295
|
-
*
|
|
296
|
-
* Nothing is kept. The catalog is only counted, and the client — with the process it started, for a
|
|
297
|
-
* stdio server — is closed before this returns, whatever happened. A probe is bounded in time as a
|
|
298
|
-
* task's connection is: 15 seconds to connect, 15 per page of tools, 30 in all.
|
|
299
|
-
*/
|
|
300
237
|
export async function probeMcpServer(config, workspace, signal) {
|
|
301
238
|
const client = new Client({ name: 'andorra-code', version: '0.1.0' }, { capabilities: {} });
|
|
302
239
|
const limit = AbortSignal.timeout(30_000);
|
|
@@ -336,13 +273,6 @@ export async function probeMcpServer(config, workspace, signal) {
|
|
|
336
273
|
await client.close().catch(() => { });
|
|
337
274
|
}
|
|
338
275
|
}
|
|
339
|
-
/**
|
|
340
|
-
* Why a probe failed, in words a person can act on.
|
|
341
|
-
*
|
|
342
|
-
* A transport error can carry what the server sent back, and an HTTP one can echo the request's own
|
|
343
|
-
* headers, so the message itself is never passed on: the error is sorted into a known kind, and only
|
|
344
|
-
* the facts that are the configuration's own (its command) or the protocol's (a status code) are named.
|
|
345
|
-
*/
|
|
346
276
|
export function probeFailureReason(error, config) {
|
|
347
277
|
const message = error instanceof Error ? error.message : String(error);
|
|
348
278
|
const name = error instanceof Error ? error.name : '';
|
|
@@ -370,27 +300,13 @@ export function probeFailureReason(error, config) {
|
|
|
370
300
|
return 'Its answer was larger than 1 MiB.';
|
|
371
301
|
return 'Could not connect or list its tools. Check its command and authentication.';
|
|
372
302
|
}
|
|
373
|
-
// Transport errors can contain server-provided strings or auth headers: report a bounded, non-secret status.
|
|
374
303
|
const unavailableReason = (error) => error instanceof Error && error.message === 'Permission denied' ? 'connection permission denied'
|
|
375
304
|
: 'connection or tool discovery failed; check server configuration and authentication';
|
|
376
|
-
/** The tool a model uses to read the descriptions and input schemas of tools that are offered on demand. */
|
|
377
305
|
export const MCP_FIND_TOOLS = 'mcp_find_tools';
|
|
378
|
-
/** The tool a model uses to run a tool that is offered on demand. */
|
|
379
306
|
export const MCP_CALL_TOOL = 'mcp_call_tool';
|
|
380
|
-
/** The most tools one lookup returns. */
|
|
381
307
|
const MCP_FIND_MAX_RESULTS = 20;
|
|
382
|
-
/**
|
|
383
|
-
* The characters one lookup's answer may take. The runtime clips every tool observation at 24,000
|
|
384
|
-
* characters (`src/react-runtime.ts`), so an answer past that would reach the model as broken JSON.
|
|
385
|
-
*/
|
|
386
308
|
const MCP_FIND_MAX_CHARS = 20_000;
|
|
387
|
-
/** The characters one part of a schema too large for a single answer takes once JSON-encoded in that answer. */
|
|
388
309
|
const MCP_FIND_PART_CHARS = 16_000;
|
|
389
|
-
/**
|
|
390
|
-
* A large entry's JSON cut into parts that each take at most {@link MCP_FIND_PART_CHARS} once
|
|
391
|
-
* encoded again as a string — quotes and backslashes double, control characters grow to six —
|
|
392
|
-
* never splitting a surrogate pair.
|
|
393
|
-
*/
|
|
394
310
|
function schemaChunks(text) {
|
|
395
311
|
const chunks = [];
|
|
396
312
|
let start = 0;
|
|
@@ -411,10 +327,6 @@ function schemaChunks(text) {
|
|
|
411
327
|
chunks.push(text.slice(start));
|
|
412
328
|
return chunks;
|
|
413
329
|
}
|
|
414
|
-
/**
|
|
415
|
-
* The index of on-demand tools a model is shown: each server with its tool names, within
|
|
416
|
-
* {@link MCP_INDEX_MAX_BYTES}. Names past the bound are counted, and the lookup finds them by query.
|
|
417
|
-
*/
|
|
418
330
|
export function deferredIndex(servers) {
|
|
419
331
|
const lines = [];
|
|
420
332
|
let bytes = 0;
|
|
@@ -437,10 +349,6 @@ export function deferredIndex(servers) {
|
|
|
437
349
|
}
|
|
438
350
|
return lines.join('\n');
|
|
439
351
|
}
|
|
440
|
-
/**
|
|
441
|
-
* The tools of on-demand servers that match a lookup, best first: every named tool, or the tools
|
|
442
|
-
* whose name or description carries the most words of the query, or a server's whole list.
|
|
443
|
-
*/
|
|
444
352
|
export function findDeferredTools(servers, request) {
|
|
445
353
|
const scoped = request.server === undefined ? servers : servers.filter(server => server.id === resolveDeferredServer(servers, request.server)?.id);
|
|
446
354
|
const named = (request.tools ?? []).filter(name => typeof name === 'string' && name);
|
|
@@ -457,7 +365,6 @@ export function findDeferredTools(servers, request) {
|
|
|
457
365
|
};
|
|
458
366
|
return all.map(entry => ({ entry, score: score(entry.tool) })).filter(item => item.score > 0).sort((a, b) => b.score - a.score).map(item => item.entry);
|
|
459
367
|
}
|
|
460
|
-
/** The server a model named: its exact id, or the one id whose name after `configured:` or `plugin:` matches. */
|
|
461
368
|
function resolveDeferredServer(servers, name) {
|
|
462
369
|
const exact = servers.find(server => server.id === name);
|
|
463
370
|
if (exact)
|
|
@@ -465,14 +372,6 @@ function resolveDeferredServer(servers, name) {
|
|
|
465
372
|
const short = servers.filter(server => server.id.slice(server.id.lastIndexOf(':') + 1) === name);
|
|
466
373
|
return short.length === 1 ? short[0] : undefined;
|
|
467
374
|
}
|
|
468
|
-
/**
|
|
469
|
-
* What {@link MCP_FIND_TOOLS} answers, always within {@link MCP_FIND_MAX_CHARS}.
|
|
470
|
-
*
|
|
471
|
-
* Matching tools are described with their schemas, best first, while they fit. A tool whose own
|
|
472
|
-
* description and schema would not fit one answer is named with how many parts it takes; asking
|
|
473
|
-
* for it by exact name with `part` returns that slice of its JSON, and the parts joined in order
|
|
474
|
-
* are the whole entry.
|
|
475
|
-
*/
|
|
476
375
|
export function answerFind(servers, args) {
|
|
477
376
|
const server = typeof args.server === 'string' ? args.server : undefined;
|
|
478
377
|
if (server !== undefined && !resolveDeferredServer(servers, server))
|
|
@@ -496,7 +395,7 @@ export function answerFind(servers, args) {
|
|
|
496
395
|
if (matches.length === 0)
|
|
497
396
|
return JSON.stringify({ tools: [], note: 'No tool matched. Try other words, or omit query to list a server\'s tools.' });
|
|
498
397
|
const results = [];
|
|
499
|
-
let used = 200;
|
|
398
|
+
let used = 200;
|
|
500
399
|
for (const match of matches) {
|
|
501
400
|
if (results.length >= MCP_FIND_MAX_RESULTS)
|
|
502
401
|
break;
|
|
@@ -516,7 +415,6 @@ export function answerFind(servers, args) {
|
|
|
516
415
|
const omitted = matches.length - results.length;
|
|
517
416
|
return JSON.stringify({ tools: results, ...(omitted > 0 ? { omitted, note: `${omitted} more matched; narrow the query or name the tools.` } : {}) });
|
|
518
417
|
}
|
|
519
|
-
/** The two tools that reach every on-demand server: one to look tools up, one to run them. */
|
|
520
418
|
function deferredTools(servers) {
|
|
521
419
|
const index = deferredIndex(servers);
|
|
522
420
|
const find = {
|
|
@@ -554,33 +452,13 @@ function deferredTools(servers) {
|
|
|
554
452
|
};
|
|
555
453
|
return [find, call];
|
|
556
454
|
}
|
|
557
|
-
/**
|
|
558
|
-
* Each task owns its clients; no server tools or spawned processes survive task exit.
|
|
559
|
-
*
|
|
560
|
-
* A server's tools are offered one by one while their advertised metadata fits the task's budget
|
|
561
|
-
* ({@link MCP_CATALOG_MAX_BYTES} across servers, in order). A server whose catalog does not fit is
|
|
562
|
-
* not dropped: its tools are offered on demand, through {@link MCP_FIND_TOOLS} (an index of their
|
|
563
|
-
* names, and their schemas when looked up) and {@link MCP_CALL_TOOL}, which runs them under the
|
|
564
|
-
* same approval as a tool offered by itself.
|
|
565
|
-
*
|
|
566
|
-
* With `catalogs`, a server this home has already heard from does not hold the task back while it
|
|
567
|
-
* starts. Its connection is approved first, as every server's is. Then its last answer decides
|
|
568
|
-
* what the task is told now — its tools, offered from the record, one by one or on demand — and the
|
|
569
|
-
* server itself connects behind the caller, where a call to one of its tools waits for the
|
|
570
|
-
* connection. The record is checked against what the server reports once it is up: a catalog that
|
|
571
|
-
* changed is used from the next task on, and a server that could not be reached is forgotten, so
|
|
572
|
-
* the next task asks it before offering anything, as a server seen for the first time is always
|
|
573
|
-
* asked. `settled` resolves when every server has answered.
|
|
574
|
-
*/
|
|
575
455
|
export async function connectMcpServers(servers, context, notice, taskSignal = context.signal, options = {}) {
|
|
576
|
-
// A server still starting behind the task is stopped by the same close that ends the established ones.
|
|
577
456
|
const closed = new AbortController();
|
|
578
457
|
const startupSignal = AbortSignal.any([context.signal, taskSignal, closed.signal]);
|
|
579
458
|
const clients = new Map();
|
|
580
459
|
const tools = [];
|
|
581
460
|
const deferred = [];
|
|
582
|
-
let catalogBytes = 2;
|
|
583
|
-
/** The servers connecting behind the task, one at a time. Never rejects. */
|
|
461
|
+
let catalogBytes = 2;
|
|
584
462
|
let background = Promise.resolve();
|
|
585
463
|
let closing;
|
|
586
464
|
const drop = async (client) => {
|
|
@@ -597,8 +475,6 @@ export async function connectMcpServers(servers, context, notice, taskSignal = c
|
|
|
597
475
|
if (closing)
|
|
598
476
|
return closing;
|
|
599
477
|
closed.abort();
|
|
600
|
-
// A connection that was still being made has either been registered or been torn down by the
|
|
601
|
-
// time this chain settles, so nothing is added to the clients after they are closed.
|
|
602
478
|
closing = background.then(() => {
|
|
603
479
|
const owned = [...clients];
|
|
604
480
|
clients.clear();
|
|
@@ -612,24 +488,13 @@ export async function connectMcpServers(servers, context, notice, taskSignal = c
|
|
|
612
488
|
return closing;
|
|
613
489
|
};
|
|
614
490
|
const abort = () => { void close(); };
|
|
615
|
-
/**
|
|
616
|
-
* Ask for the connection, under the caller's approval policy.
|
|
617
|
-
*
|
|
618
|
-
* Always asked in front of the task, whatever is on record for the server: a prompt raised from
|
|
619
|
-
* behind a task that has already started is one its client may no longer be showing, and a tool
|
|
620
|
-
* call waiting on that connection would then wait on an answer nobody can give.
|
|
621
|
-
*/
|
|
622
491
|
const authorizeConnection = async (id, config) => {
|
|
623
|
-
// Query parameters may contain credentials; show only the endpoint in approval.
|
|
624
|
-
// The transport retains the full configured URL for authentication.
|
|
625
492
|
const approvalUrl = config.transport === 'http' ? new URL(config.url) : undefined;
|
|
626
493
|
if (approvalUrl)
|
|
627
494
|
approvalUrl.search = '';
|
|
628
495
|
await authorize('mcp_connect', { server: id, transport: config.transport, ...(config.transport === 'stdio' ? { command: config.command, args: config.args ?? [] } : { url: approvalUrl.href }) }, context);
|
|
629
|
-
// Approval can finish after task cancellation has already closed clients.
|
|
630
496
|
startupSignal.throwIfAborted();
|
|
631
497
|
};
|
|
632
|
-
/** The limits one server's catalog is held to while it is listed or read back: valid, unique, and at most {@link MCP_SERVER_MAX_TOOLS} tools. */
|
|
633
498
|
const checked = (id) => {
|
|
634
499
|
const seen = new Set();
|
|
635
500
|
return (tool) => {
|
|
@@ -638,10 +503,6 @@ export async function connectMcpServers(servers, context, notice, taskSignal = c
|
|
|
638
503
|
checkCatalogTool(id, tool, seen);
|
|
639
504
|
};
|
|
640
505
|
};
|
|
641
|
-
/**
|
|
642
|
-
* Start one server whose connection was approved and read its catalog. A tool that fails the
|
|
643
|
-
* limits refuses the whole catalog, so a failure never exposes a partially discovered set.
|
|
644
|
-
*/
|
|
645
506
|
const connectServer = async (id, config) => {
|
|
646
507
|
const client = new Client({ name: 'andorra-code', version: '0.1.0' }, { capabilities: {} });
|
|
647
508
|
const accept = checked(id);
|
|
@@ -679,14 +540,9 @@ export async function connectMcpServers(servers, context, notice, taskSignal = c
|
|
|
679
540
|
}
|
|
680
541
|
};
|
|
681
542
|
const callTool = async (client, id, name, args, callContext) => {
|
|
682
|
-
// MCP execution has no read-only enforcement: a call can change the workspace or the
|
|
683
|
-
// host, so plan mode refuses it the way it refuses QA host execution, rather than
|
|
684
|
-
// letting a per-call approval stand in for the plan the mode exists to require.
|
|
685
543
|
if (permissionMode(callContext) === 'plan')
|
|
686
544
|
throw new Error(PLAN_MODE_MUTATION_ERROR);
|
|
687
545
|
await authorize(mcpToolName(id, name), { server: id, tool: name, arguments: args }, callContext);
|
|
688
|
-
// Authorization may have been awaiting an approval when the run entered Plan.
|
|
689
|
-
// A per-call grant must never dispatch an unsandboxed external operation in Plan.
|
|
690
546
|
if (permissionMode(callContext) === 'plan')
|
|
691
547
|
throw new Error(PLAN_MODE_MUTATION_ERROR);
|
|
692
548
|
callContext.signal.throwIfAborted();
|
|
@@ -696,10 +552,6 @@ export async function connectMcpServers(servers, context, notice, taskSignal = c
|
|
|
696
552
|
throw new Error(`MCP tool failed: ${rendered}`);
|
|
697
553
|
return rendered;
|
|
698
554
|
};
|
|
699
|
-
/**
|
|
700
|
-
* Run one tool of a server, once its connection is up. The call's own cancellation ends the wait;
|
|
701
|
-
* the connection carries on for the task. A tool the live server no longer lists is refused.
|
|
702
|
-
*/
|
|
703
555
|
const runTool = async (connection, id, name, args, callContext) => {
|
|
704
556
|
if (permissionMode(callContext) === 'plan')
|
|
705
557
|
throw new Error(PLAN_MODE_MUTATION_ERROR);
|
|
@@ -726,10 +578,6 @@ export async function connectMcpServers(servers, context, notice, taskSignal = c
|
|
|
726
578
|
throw new Error(`MCP ${id} no longer provides ${name}: its tool catalog changed since it was last used. Start a new task to use the current catalog.`);
|
|
727
579
|
return callTool(live.client, id, name, args, callContext);
|
|
728
580
|
};
|
|
729
|
-
/**
|
|
730
|
-
* Offer a server's tools to the task: one by one when their metadata fits what is left of the
|
|
731
|
-
* budget, otherwise on demand. Says which, for the notice.
|
|
732
|
-
*/
|
|
733
581
|
const offer = (id, catalog, connection) => {
|
|
734
582
|
const bytes = catalog.reduce((total, tool) => total + advertisedBytes(id, tool), 0);
|
|
735
583
|
if (tools.length + catalog.length <= MCP_CATALOG_MAX_TOOLS && catalogBytes + bytes <= MCP_CATALOG_MAX_BYTES) {
|
|
@@ -745,7 +593,6 @@ export async function connectMcpServers(servers, context, notice, taskSignal = c
|
|
|
745
593
|
const available = (id, count, how) => how === 'listed'
|
|
746
594
|
? `MCP ${id}: ${count} tools available to agents with shell permission.`
|
|
747
595
|
: `MCP ${id}: ${count} tools available on demand to agents with shell permission (too many to list one by one; agents look them up with ${MCP_FIND_TOOLS} and run them with ${MCP_CALL_TOOL}).`;
|
|
748
|
-
/** The catalog on record, when it holds tools and meets the limits a listed one must: the file is no more trusted than the server. */
|
|
749
596
|
const remembered = (record, id) => {
|
|
750
597
|
if (record === undefined || record.tools.length === 0)
|
|
751
598
|
return undefined;
|
|
@@ -759,7 +606,6 @@ export async function connectMcpServers(servers, context, notice, taskSignal = c
|
|
|
759
606
|
return undefined;
|
|
760
607
|
}
|
|
761
608
|
};
|
|
762
|
-
// Startup may be interrupted by a pause; established clients belong to the task.
|
|
763
609
|
taskSignal.throwIfAborted();
|
|
764
610
|
taskSignal.addEventListener('abort', abort, { once: true });
|
|
765
611
|
try {
|
|
@@ -768,8 +614,6 @@ export async function connectMcpServers(servers, context, notice, taskSignal = c
|
|
|
768
614
|
startupSignal.throwIfAborted();
|
|
769
615
|
if (config.enabled === false)
|
|
770
616
|
continue;
|
|
771
|
-
// Count attempts, including failed and empty catalogs, so per-server timeouts
|
|
772
|
-
// cannot multiply indefinitely with the configured server count.
|
|
773
617
|
if (attemptedServers++ >= MCP_STARTUP_MAX_SERVERS) {
|
|
774
618
|
notice(`MCP startup limited to ${MCP_STARTUP_MAX_SERVERS} enabled servers; remaining servers were skipped.`);
|
|
775
619
|
break;
|
|
@@ -779,8 +623,6 @@ export async function connectMcpServers(servers, context, notice, taskSignal = c
|
|
|
779
623
|
await authorizeConnection(id, config);
|
|
780
624
|
}
|
|
781
625
|
catch (error) {
|
|
782
|
-
// A refusal is the user's answer for this task, not the server's: nothing of the server is
|
|
783
|
-
// offered, as before, and whatever is on record for it stands.
|
|
784
626
|
startupSignal.throwIfAborted();
|
|
785
627
|
notice(`MCP ${id}: unavailable (${unavailableReason(error)}).`);
|
|
786
628
|
continue;
|
|
@@ -789,31 +631,24 @@ export async function connectMcpServers(servers, context, notice, taskSignal = c
|
|
|
789
631
|
const key = store ? mcpCatalogKey(id, config, context.workspace) : undefined;
|
|
790
632
|
const known = store && key !== undefined ? remembered(await store.read(key).catch(() => undefined), id) : undefined;
|
|
791
633
|
if (store && key !== undefined && known !== undefined) {
|
|
792
|
-
// Offered from the record now; the server itself starts behind the task.
|
|
793
634
|
const connection = background.then(() => { startupSignal.throwIfAborted(); return connectServer(id, config); });
|
|
794
|
-
// A connection that fails is reported below and by each call that waits on it.
|
|
795
635
|
connection.catch(() => { });
|
|
796
636
|
const how = offer(id, known, connection);
|
|
797
637
|
background = connection.then(async (live) => {
|
|
798
638
|
options.status?.(id, config, { state: 'ready', tools: live.catalog.length });
|
|
799
|
-
// Key order inside a schema is the server's serializer's business, not a change of catalog.
|
|
800
639
|
if (canonical(live.catalog) === canonical(known)) {
|
|
801
640
|
notice(available(id, known.length, how));
|
|
802
641
|
return;
|
|
803
642
|
}
|
|
804
|
-
// The model was already told the earlier catalog, and a tool list that changed under a
|
|
805
|
-
// running task would describe tools some of its turns never saw.
|
|
806
643
|
if (live.catalog.length > 0)
|
|
807
644
|
await store.write(key, { tools: live.catalog }).catch(() => { });
|
|
808
645
|
else
|
|
809
646
|
await store.remove(key).catch(() => { });
|
|
810
647
|
notice(`MCP ${id}: the server's tool catalog changed since it was last used. This task keeps the earlier catalog (${known.length} tools); the next task uses the current one.`);
|
|
811
648
|
}, async (error) => {
|
|
812
|
-
// A task that is ending says nothing about the server: its record stands.
|
|
813
649
|
if (startupSignal.aborted)
|
|
814
650
|
return;
|
|
815
651
|
options.status?.(id, config, { state: 'failed', error: probeFailureReason(error, config) });
|
|
816
|
-
// The next task asks the server before offering its tools, as for one never seen.
|
|
817
652
|
await store.remove(key).catch(() => { });
|
|
818
653
|
notice(`MCP ${id}: unavailable (${unavailableReason(error)}).`);
|
|
819
654
|
});
|
|
@@ -824,7 +659,6 @@ export async function connectMcpServers(servers, context, notice, taskSignal = c
|
|
|
824
659
|
const how = offer(id, live.catalog, Promise.resolve(live));
|
|
825
660
|
notice(available(id, live.catalog.length, how));
|
|
826
661
|
options.status?.(id, config, { state: 'ready', tools: live.catalog.length });
|
|
827
|
-
// Remembered for the next task. An empty catalog offers nothing to wait for and is asked again.
|
|
828
662
|
if (store && key !== undefined && live.catalog.length > 0)
|
|
829
663
|
await store.write(key, { tools: live.catalog }).catch(() => { });
|
|
830
664
|
}
|
|
@@ -1,24 +1,10 @@
|
|
|
1
|
-
/** What a membership check found, as far as naming the refusal needs. */
|
|
2
1
|
export interface MembershipVerdict {
|
|
3
2
|
paid: boolean;
|
|
4
3
|
unavailable?: boolean;
|
|
5
4
|
failureReason?: 'tls' | 'dns' | 'network';
|
|
6
5
|
subject?: string;
|
|
7
6
|
}
|
|
8
|
-
/**
|
|
9
|
-
* A graph feature the account's membership does not reach.
|
|
10
|
-
*
|
|
11
|
-
* The messages are the CLI's output, so they name `/login`; that advice is always a sentence of its
|
|
12
|
-
* own, which the desktop window replaces with its own way in (Settings › Account) when it shows the
|
|
13
|
-
* refusal (desktop/src/engine/errorWords.ts). Keep it that way when changing the wording.
|
|
14
|
-
*/
|
|
15
7
|
export declare class PaidMembershipRequiredError extends Error {
|
|
16
8
|
constructor(message?: string);
|
|
17
|
-
/**
|
|
18
|
-
* The refusal for one membership answer, naming which of its causes applies.
|
|
19
|
-
*
|
|
20
|
-
* One message used to cover all three, so a dropped connection and a lost sign-in both read as
|
|
21
|
-
* "paid membership is required" and sent people to check a membership they had.
|
|
22
|
-
*/
|
|
23
9
|
static for(access: MembershipVerdict): PaidMembershipRequiredError;
|
|
24
10
|
}
|
|
@@ -4,21 +4,8 @@ const REASONS = {
|
|
|
4
4
|
dns: 'the account service address could not be resolved',
|
|
5
5
|
network: 'the account service could not be reached',
|
|
6
6
|
};
|
|
7
|
-
/**
|
|
8
|
-
* A graph feature the account's membership does not reach.
|
|
9
|
-
*
|
|
10
|
-
* The messages are the CLI's output, so they name `/login`; that advice is always a sentence of its
|
|
11
|
-
* own, which the desktop window replaces with its own way in (Settings › Account) when it shows the
|
|
12
|
-
* refusal (desktop/src/engine/errorWords.ts). Keep it that way when changing the wording.
|
|
13
|
-
*/
|
|
14
7
|
export class PaidMembershipRequiredError extends Error {
|
|
15
8
|
constructor(message = `Paid membership is required for ${FEATURES}. Use /login to sign in. If already signed in, check your membership or connection.`) { super(message); }
|
|
16
|
-
/**
|
|
17
|
-
* The refusal for one membership answer, naming which of its causes applies.
|
|
18
|
-
*
|
|
19
|
-
* One message used to cover all three, so a dropped connection and a lost sign-in both read as
|
|
20
|
-
* "paid membership is required" and sent people to check a membership they had.
|
|
21
|
-
*/
|
|
22
9
|
static for(access) {
|
|
23
10
|
if (access.unavailable) {
|
|
24
11
|
const reason = access.failureReason ? `: ${REASONS[access.failureReason]}` : ' right now';
|