@xingular/harness 2.0.0 → 2.0.1-unstable
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +635 -0
- package/LICENSE +202 -0
- package/NOTICE.md +50 -0
- package/README.md +241 -90
- package/THIRD_PARTY_LICENSES.md +942 -0
- package/browser-extension/README.md +32 -0
- package/browser-extension/background.js +612 -0
- package/browser-extension/manifest.json +16 -0
- package/browser-extension/overlay.js +97 -0
- package/browser-extension/popup.css +19 -0
- package/browser-extension/popup.html +30 -0
- package/browser-extension/popup.js +101 -0
- package/browser-extension/site-access.js +63 -0
- package/builtin/skills/plugin-authoring/SKILL.md +53 -0
- package/dist/cli.js +32851 -17155
- package/dist/sdk/accounts/accounts.d.ts +195 -0
- package/dist/sdk/accounts/accounts.js +821 -0
- package/dist/sdk/accounts/choices.d.ts +41 -0
- package/dist/sdk/accounts/choices.js +89 -0
- package/dist/sdk/accounts/env.d.ts +78 -0
- package/dist/sdk/accounts/env.js +294 -0
- package/dist/sdk/accounts/secrets.d.ts +28 -0
- package/dist/sdk/accounts/secrets.js +147 -0
- package/dist/sdk/accounts/store.d.ts +139 -0
- package/dist/sdk/accounts/store.js +255 -0
- package/dist/sdk/agents/builtin.d.ts +2 -0
- package/dist/sdk/agents/builtin.js +50 -0
- package/dist/sdk/agents/narrow.d.ts +13 -0
- package/dist/sdk/agents/narrow.js +29 -0
- package/dist/sdk/agents/planResearch.d.ts +27 -0
- package/dist/sdk/agents/planResearch.js +82 -0
- package/dist/sdk/agents/profiles.d.ts +93 -0
- package/dist/sdk/agents/profiles.js +289 -0
- package/dist/sdk/annotations/bridge.d.ts +44 -0
- package/dist/sdk/annotations/bridge.js +268 -0
- package/dist/sdk/annotations/capture.d.ts +158 -0
- package/dist/sdk/annotations/capture.js +409 -0
- package/dist/sdk/annotations/delivery.d.ts +79 -0
- package/dist/sdk/annotations/delivery.js +163 -0
- package/dist/sdk/annotations/inspect.d.ts +10 -0
- package/dist/sdk/annotations/inspect.js +34 -0
- package/dist/sdk/annotations/isolated.d.ts +6 -0
- package/dist/sdk/annotations/isolated.js +51 -0
- package/dist/sdk/annotations/pageScript.d.ts +28 -0
- package/dist/sdk/annotations/pageScript.js +871 -0
- package/dist/sdk/annotations/part.d.ts +8 -0
- package/dist/sdk/annotations/part.js +126 -0
- package/dist/sdk/annotations/queue.d.ts +4 -0
- package/dist/sdk/annotations/queue.js +45 -0
- package/dist/sdk/annotations/serverMethods.d.ts +3 -0
- package/dist/sdk/annotations/serverMethods.js +66 -0
- package/dist/sdk/annotations/store.d.ts +159 -0
- package/dist/sdk/annotations/store.js +404 -0
- package/dist/sdk/browser/backend.d.ts +16 -0
- package/dist/sdk/browser/backend.js +17 -0
- package/dist/sdk/browser/config.d.ts +19 -0
- package/dist/sdk/browser/config.js +23 -0
- package/dist/sdk/browser/contracts.d.ts +19 -0
- package/dist/sdk/browser/contracts.js +116 -0
- package/dist/sdk/browser/diagnostics.d.ts +4 -0
- package/dist/sdk/browser/diagnostics.js +38 -0
- package/dist/sdk/browser/extension/bridge.d.ts +55 -0
- package/dist/sdk/browser/extension/bridge.js +336 -0
- package/dist/sdk/browser/extension/session.d.ts +50 -0
- package/dist/sdk/browser/extension/session.js +321 -0
- package/dist/sdk/browser/index.d.ts +33 -0
- package/dist/sdk/browser/index.js +105 -0
- package/dist/sdk/browser/network.d.ts +10 -0
- package/dist/sdk/browser/network.js +59 -0
- package/dist/sdk/browser/serverMethods.d.ts +3 -0
- package/dist/sdk/browser/serverMethods.js +10 -0
- package/dist/sdk/browser/session.d.ts +85 -0
- package/dist/sdk/browser/session.js +228 -0
- package/dist/sdk/browser/tools.d.ts +102 -0
- package/dist/sdk/browser/tools.js +257 -0
- package/dist/sdk/capabilities/api.d.ts +22 -0
- package/dist/sdk/capabilities/api.js +54 -0
- package/dist/sdk/capabilities/runSnapshot.d.ts +18 -0
- package/dist/sdk/capabilities/runSnapshot.js +53 -0
- package/dist/sdk/capabilities/types.d.ts +29 -0
- package/dist/sdk/capabilities/types.js +1 -0
- package/dist/sdk/cli.d.ts +2 -0
- package/dist/sdk/cli.js +172 -0
- package/dist/sdk/commands/extensionOwners.d.ts +4 -0
- package/dist/sdk/commands/extensionOwners.js +17 -0
- package/dist/sdk/commands/list.d.ts +3 -0
- package/dist/sdk/commands/list.js +90 -0
- package/dist/sdk/commands/promptLoader.d.ts +5 -0
- package/dist/sdk/commands/promptLoader.js +76 -0
- package/dist/sdk/commands/promptRoutes.d.ts +13 -0
- package/dist/sdk/commands/promptRoutes.js +46 -0
- package/dist/sdk/commands/registry.d.ts +299 -0
- package/dist/sdk/commands/registry.js +54 -0
- package/dist/sdk/commands/routes.d.ts +16 -0
- package/dist/sdk/commands/routes.js +33 -0
- package/dist/sdk/commands/runtimeRouter.d.ts +4 -0
- package/dist/sdk/commands/runtimeRouter.js +48 -0
- package/dist/sdk/computer/boundary.d.ts +40 -0
- package/dist/sdk/computer/boundary.js +79 -0
- package/dist/sdk/computer/contracts.d.ts +127 -0
- package/dist/sdk/computer/contracts.js +13 -0
- package/dist/sdk/computer/control.d.ts +34 -0
- package/dist/sdk/computer/control.js +112 -0
- package/dist/sdk/computer/screenshot.d.ts +32 -0
- package/dist/sdk/computer/screenshot.js +35 -0
- package/dist/sdk/computer/terminalCapture.d.ts +26 -0
- package/dist/sdk/computer/terminalCapture.js +64 -0
- package/dist/sdk/computer/volatileImages.d.ts +9 -0
- package/dist/sdk/computer/volatileImages.js +50 -0
- package/dist/sdk/context/attribution.d.ts +18 -0
- package/dist/sdk/context/attribution.js +295 -0
- package/dist/sdk/context/runDetails.d.ts +16 -0
- package/dist/sdk/context/runDetails.js +22 -0
- package/dist/sdk/context/types.d.ts +94 -0
- package/dist/sdk/context/types.js +10 -0
- package/dist/sdk/core/bus.d.ts +23 -0
- package/dist/sdk/core/bus.js +76 -0
- package/dist/sdk/core/caller.d.ts +22 -0
- package/dist/sdk/core/caller.js +16 -0
- package/dist/sdk/core/changes.d.ts +15 -0
- package/dist/sdk/core/changes.js +15 -0
- package/dist/sdk/core/commandBudget.d.ts +23 -0
- package/dist/sdk/core/commandBudget.js +62 -0
- package/dist/sdk/core/effort.d.ts +2 -0
- package/dist/sdk/core/effort.js +1 -0
- package/dist/sdk/core/env.d.ts +18 -0
- package/dist/sdk/core/env.js +8 -0
- package/dist/sdk/core/errors.d.ts +15 -0
- package/dist/sdk/core/errors.js +24 -0
- package/dist/sdk/core/frontmatter.d.ts +12 -0
- package/dist/sdk/core/frontmatter.js +50 -0
- package/dist/sdk/core/fs.d.ts +18 -0
- package/dist/sdk/core/fs.js +106 -0
- package/dist/sdk/core/index.d.ts +24 -0
- package/dist/sdk/core/index.js +203 -0
- package/dist/sdk/core/interactiveProfile.d.ts +46 -0
- package/dist/sdk/core/interactiveProfile.js +143 -0
- package/dist/sdk/core/links.d.ts +51 -0
- package/dist/sdk/core/links.js +155 -0
- package/dist/sdk/core/path.d.ts +7 -0
- package/dist/sdk/core/path.js +79 -0
- package/dist/sdk/core/projects.d.ts +18 -0
- package/dist/sdk/core/projects.js +67 -0
- package/dist/sdk/core/secrets.d.ts +2 -0
- package/dist/sdk/core/secrets.js +5 -0
- package/dist/sdk/core/shell.d.ts +20 -0
- package/dist/sdk/core/shell.js +73 -0
- package/dist/sdk/core/text.d.ts +7 -0
- package/dist/sdk/core/text.js +40 -0
- package/dist/sdk/core/workspace.d.ts +13 -0
- package/dist/sdk/core/workspace.js +88 -0
- package/dist/sdk/core/workspaceBashTool.d.ts +20 -0
- package/dist/sdk/core/workspaceBashTool.js +50 -0
- package/dist/sdk/core/workspaceSandbox.d.ts +41 -0
- package/dist/sdk/core/workspaceSandbox.js +360 -0
- package/dist/sdk/core/workspaceWriteOperations.d.ts +57 -0
- package/dist/sdk/core/workspaceWriteOperations.js +245 -0
- package/dist/sdk/doctor/checks.d.ts +5 -0
- package/dist/sdk/doctor/checks.js +270 -0
- package/dist/sdk/doctor/probe.d.ts +4 -0
- package/dist/sdk/doctor/probe.js +94 -0
- package/dist/sdk/doctor/serverMethods.d.ts +3 -0
- package/dist/sdk/doctor/serverMethods.js +8 -0
- package/dist/sdk/doctor/service.d.ts +23 -0
- package/dist/sdk/doctor/service.js +144 -0
- package/dist/sdk/doctor/types.d.ts +141 -0
- package/dist/sdk/doctor/types.js +29 -0
- package/dist/sdk/harness.d.ts +172 -0
- package/dist/sdk/harness.js +387 -0
- package/dist/sdk/history/lessonPrompt.d.ts +2 -0
- package/dist/sdk/history/lessonPrompt.js +15 -0
- package/dist/sdk/history/lessons.d.ts +52 -0
- package/dist/sdk/history/lessons.js +173 -0
- package/dist/sdk/history/recall.d.ts +68 -0
- package/dist/sdk/history/recall.js +199 -0
- package/dist/sdk/history/serverMethods.d.ts +3 -0
- package/dist/sdk/history/serverMethods.js +8 -0
- package/dist/sdk/history/trajectory.d.ts +7 -0
- package/dist/sdk/history/trajectory.js +218 -0
- package/dist/sdk/hub/catalog.json +123 -0
- package/dist/sdk/hub/cli.d.ts +7 -0
- package/dist/sdk/hub/cli.js +81 -0
- package/dist/sdk/hub/hub.d.ts +74 -0
- package/dist/sdk/hub/hub.js +476 -0
- package/dist/sdk/hub/schema.d.ts +280 -0
- package/dist/sdk/hub/schema.js +78 -0
- package/dist/sdk/hub/serverMethods.d.ts +3 -0
- package/dist/sdk/hub/serverMethods.js +11 -0
- package/dist/sdk/index.d.ts +80 -0
- package/dist/sdk/index.js +60 -0
- package/dist/sdk/mcp/connections.d.ts +83 -0
- package/dist/sdk/mcp/connections.js +676 -0
- package/dist/sdk/mcp/manager.d.ts +26 -0
- package/dist/sdk/mcp/manager.js +124 -0
- package/dist/sdk/mcp/oauth.d.ts +35 -0
- package/dist/sdk/mcp/oauth.js +171 -0
- package/dist/sdk/mcp/scopeMigration.d.ts +19 -0
- package/dist/sdk/mcp/scopeMigration.js +198 -0
- package/dist/sdk/mcp/serverMethods.d.ts +3 -0
- package/dist/sdk/mcp/serverMethods.js +22 -0
- package/dist/sdk/mcp/service.d.ts +160 -0
- package/dist/sdk/mcp/service.js +510 -0
- package/dist/sdk/mcp/types.d.ts +131 -0
- package/dist/sdk/mcp/types.js +49 -0
- package/dist/sdk/pi/retryPolicy.d.ts +19 -0
- package/dist/sdk/pi/retryPolicy.js +11 -0
- package/dist/sdk/pi/runtime.d.ts +14 -0
- package/dist/sdk/pi/runtime.js +31 -0
- package/dist/sdk/plugins/api.d.ts +66 -0
- package/dist/sdk/plugins/api.js +155 -0
- package/dist/sdk/plugins/attachments.d.ts +46 -0
- package/dist/sdk/plugins/attachments.js +111 -0
- package/dist/sdk/plugins/builtin.d.ts +7 -0
- package/dist/sdk/plugins/builtin.js +182 -0
- package/dist/sdk/plugins/builtinRegistry.d.ts +62 -0
- package/dist/sdk/plugins/builtinRegistry.js +77 -0
- package/dist/sdk/plugins/catalogue.d.ts +29 -0
- package/dist/sdk/plugins/catalogue.js +197 -0
- package/dist/sdk/plugins/cli.d.ts +13 -0
- package/dist/sdk/plugins/cli.js +188 -0
- package/dist/sdk/plugins/commandPrefix.d.ts +8 -0
- package/dist/sdk/plugins/commandPrefix.js +21 -0
- package/dist/sdk/plugins/discover.d.ts +48 -0
- package/dist/sdk/plugins/discover.js +230 -0
- package/dist/sdk/plugins/firstParty.d.ts +50 -0
- package/dist/sdk/plugins/firstParty.js +119 -0
- package/dist/sdk/plugins/hooks.d.ts +94 -0
- package/dist/sdk/plugins/hooks.js +162 -0
- package/dist/sdk/plugins/identity.d.ts +19 -0
- package/dist/sdk/plugins/identity.js +48 -0
- package/dist/sdk/plugins/install.d.ts +24 -0
- package/dist/sdk/plugins/install.js +160 -0
- package/dist/sdk/plugins/inventory.d.ts +22 -0
- package/dist/sdk/plugins/inventory.js +111 -0
- package/dist/sdk/plugins/manifest.d.ts +21 -0
- package/dist/sdk/plugins/manifest.js +94 -0
- package/dist/sdk/plugins/plugins.d.ts +106 -0
- package/dist/sdk/plugins/plugins.js +165 -0
- package/dist/sdk/plugins/proposals.d.ts +17 -0
- package/dist/sdk/plugins/proposals.js +147 -0
- package/dist/sdk/plugins/runtime.d.ts +9 -0
- package/dist/sdk/plugins/runtime.js +95 -0
- package/dist/sdk/plugins/surfaces.d.ts +5 -0
- package/dist/sdk/plugins/surfaces.js +11 -0
- package/dist/sdk/plugins/trust.d.ts +44 -0
- package/dist/sdk/plugins/trust.js +120 -0
- package/dist/sdk/plugins/types.d.ts +174 -0
- package/dist/sdk/plugins/types.js +7 -0
- package/dist/sdk/prompt/compile.d.ts +245 -0
- package/dist/sdk/prompt/compile.js +535 -0
- package/dist/sdk/prompt/reporting.d.ts +2 -0
- package/dist/sdk/prompt/reporting.js +94 -0
- package/dist/sdk/prompt/standard.d.ts +32 -0
- package/dist/sdk/prompt/standard.js +76 -0
- package/dist/sdk/refine/cli.d.ts +4 -0
- package/dist/sdk/refine/cli.js +186 -0
- package/dist/sdk/refine/demo.d.ts +21 -0
- package/dist/sdk/refine/demo.js +114 -0
- package/dist/sdk/refine/evidence.d.ts +55 -0
- package/dist/sdk/refine/evidence.js +330 -0
- package/dist/sdk/refine/host.d.ts +59 -0
- package/dist/sdk/refine/host.js +105 -0
- package/dist/sdk/refine/ledger.d.ts +48 -0
- package/dist/sdk/refine/ledger.js +76 -0
- package/dist/sdk/refine/library.d.ts +55 -0
- package/dist/sdk/refine/library.js +177 -0
- package/dist/sdk/refine/pi.d.ts +72 -0
- package/dist/sdk/refine/pi.js +248 -0
- package/dist/sdk/refine/prompts.d.ts +60 -0
- package/dist/sdk/refine/prompts.js +434 -0
- package/dist/sdk/refine/recursion.d.ts +113 -0
- package/dist/sdk/refine/recursion.js +258 -0
- package/dist/sdk/refine/runner.d.ts +83 -0
- package/dist/sdk/refine/runner.js +151 -0
- package/dist/sdk/refine/selection.d.ts +57 -0
- package/dist/sdk/refine/selection.js +251 -0
- package/dist/sdk/refine/serverMethods.d.ts +3 -0
- package/dist/sdk/refine/serverMethods.js +23 -0
- package/dist/sdk/refine/service.d.ts +115 -0
- package/dist/sdk/refine/service.js +280 -0
- package/dist/sdk/refine/suite.d.ts +67 -0
- package/dist/sdk/refine/suite.js +174 -0
- package/dist/sdk/refine/trajectory.d.ts +9 -0
- package/dist/sdk/refine/trajectory.js +73 -0
- package/dist/sdk/refine/types.d.ts +93 -0
- package/dist/sdk/refine/types.js +10 -0
- package/dist/sdk/remote/addresses.d.ts +19 -0
- package/dist/sdk/remote/addresses.js +52 -0
- package/dist/sdk/remote/pairing.d.ts +59 -0
- package/dist/sdk/remote/pairing.js +160 -0
- package/dist/sdk/remote/seal.d.ts +28 -0
- package/dist/sdk/remote/seal.js +84 -0
- package/dist/sdk/remote/server.d.ts +28 -0
- package/dist/sdk/remote/server.js +158 -0
- package/dist/sdk/remote/service.d.ts +125 -0
- package/dist/sdk/remote/service.js +330 -0
- package/dist/sdk/remote/webClient.d.ts +4 -0
- package/dist/sdk/remote/webClient.js +452 -0
- package/dist/sdk/server/methods.d.ts +3 -0
- package/dist/sdk/server/methods.js +365 -0
- package/dist/sdk/server/params.d.ts +4 -0
- package/dist/sdk/server/params.js +11 -0
- package/dist/sdk/server/remote.d.ts +19 -0
- package/dist/sdk/server/remote.js +109 -0
- package/dist/sdk/server/rpc.d.ts +20 -0
- package/dist/sdk/server/rpc.js +102 -0
- package/dist/sdk/server/serve.d.ts +13 -0
- package/dist/sdk/server/serve.js +25 -0
- package/dist/sdk/server/socket.d.ts +28 -0
- package/dist/sdk/server/socket.js +122 -0
- package/dist/sdk/sessions/approvals.d.ts +47 -0
- package/dist/sdk/sessions/approvals.js +119 -0
- package/dist/sdk/sessions/checkpoint.d.ts +7 -0
- package/dist/sdk/sessions/checkpoint.js +41 -0
- package/dist/sdk/sessions/compactionCheckpoint.d.ts +18 -0
- package/dist/sdk/sessions/compactionCheckpoint.js +79 -0
- package/dist/sdk/sessions/completionCheck.d.ts +51 -0
- package/dist/sdk/sessions/completionCheck.js +161 -0
- package/dist/sdk/sessions/continuation.d.ts +53 -0
- package/dist/sdk/sessions/continuation.js +90 -0
- package/dist/sdk/sessions/contracts.d.ts +991 -0
- package/dist/sdk/sessions/contracts.js +545 -0
- package/dist/sdk/sessions/control.d.ts +72 -0
- package/dist/sdk/sessions/control.js +158 -0
- package/dist/sdk/sessions/extensionUi.d.ts +19 -0
- package/dist/sdk/sessions/extensionUi.js +64 -0
- package/dist/sdk/sessions/goal.d.ts +145 -0
- package/dist/sdk/sessions/goal.js +405 -0
- package/dist/sdk/sessions/goalLoop.d.ts +37 -0
- package/dist/sdk/sessions/goalLoop.js +125 -0
- package/dist/sdk/sessions/goalPrompts.d.ts +4 -0
- package/dist/sdk/sessions/goalPrompts.js +93 -0
- package/dist/sdk/sessions/goalStop.d.ts +27 -0
- package/dist/sdk/sessions/goalStop.js +41 -0
- package/dist/sdk/sessions/history.d.ts +16 -0
- package/dist/sdk/sessions/history.js +68 -0
- package/dist/sdk/sessions/initialBash.d.ts +7 -0
- package/dist/sdk/sessions/initialBash.js +7 -0
- package/dist/sdk/sessions/lineageJoin.d.ts +2 -0
- package/dist/sdk/sessions/lineageJoin.js +61 -0
- package/dist/sdk/sessions/live.d.ts +101 -0
- package/dist/sdk/sessions/live.js +265 -0
- package/dist/sdk/sessions/planMode.d.ts +116 -0
- package/dist/sdk/sessions/planMode.js +281 -0
- package/dist/sdk/sessions/policy.d.ts +43 -0
- package/dist/sdk/sessions/policy.js +1 -0
- package/dist/sdk/sessions/pricing.d.ts +34 -0
- package/dist/sdk/sessions/pricing.js +40 -0
- package/dist/sdk/sessions/reasoningSummaries.d.ts +11 -0
- package/dist/sdk/sessions/reasoningSummaries.js +61 -0
- package/dist/sdk/sessions/registry.d.ts +124 -0
- package/dist/sdk/sessions/registry.js +392 -0
- package/dist/sdk/sessions/runIndex.d.ts +21 -0
- package/dist/sdk/sessions/runIndex.js +65 -0
- package/dist/sdk/sessions/runStore.d.ts +82 -0
- package/dist/sdk/sessions/runStore.js +393 -0
- package/dist/sdk/sessions/runner.d.ts +291 -0
- package/dist/sdk/sessions/runner.js +1040 -0
- package/dist/sdk/sessions/sessionState.d.ts +13 -0
- package/dist/sdk/sessions/sessionState.js +31 -0
- package/dist/sdk/sessions/sessions.d.ts +238 -0
- package/dist/sdk/sessions/sessions.js +923 -0
- package/dist/sdk/sessions/sideQuestionServerMethods.d.ts +3 -0
- package/dist/sdk/sessions/sideQuestionServerMethods.js +19 -0
- package/dist/sdk/sessions/sideQuestions.d.ts +66 -0
- package/dist/sdk/sessions/sideQuestions.js +290 -0
- package/dist/sdk/sessions/stallWatch.d.ts +35 -0
- package/dist/sdk/sessions/stallWatch.js +42 -0
- package/dist/sdk/sessions/subagentServerMethods.d.ts +3 -0
- package/dist/sdk/sessions/subagentServerMethods.js +41 -0
- package/dist/sdk/sessions/subagentService.d.ts +88 -0
- package/dist/sdk/sessions/subagentService.js +546 -0
- package/dist/sdk/sessions/subagents.d.ts +98 -0
- package/dist/sdk/sessions/subagents.js +136 -0
- package/dist/sdk/sessions/workSlice.d.ts +167 -0
- package/dist/sdk/sessions/workSlice.js +266 -0
- package/dist/sdk/sessions/workspaceBoundary.d.ts +15 -0
- package/dist/sdk/sessions/workspaceBoundary.js +46 -0
- package/dist/sdk/terminal/accountsMenu.d.ts +46 -0
- package/dist/sdk/terminal/accountsMenu.js +392 -0
- package/dist/sdk/terminal/browser.d.ts +62 -0
- package/dist/sdk/terminal/browser.js +41 -0
- package/dist/sdk/terminal/browserControl.d.ts +29 -0
- package/dist/sdk/terminal/browserControl.js +187 -0
- package/dist/sdk/terminal/cli.d.ts +20 -0
- package/dist/sdk/terminal/cli.js +121 -0
- package/dist/sdk/terminal/client.d.ts +20 -0
- package/dist/sdk/terminal/client.js +148 -0
- package/dist/sdk/terminal/commandHelp.d.ts +17 -0
- package/dist/sdk/terminal/commandHelp.js +20 -0
- package/dist/sdk/terminal/control.d.ts +4 -0
- package/dist/sdk/terminal/control.js +25 -0
- package/dist/sdk/terminal/controller.d.ts +136 -0
- package/dist/sdk/terminal/controller.js +579 -0
- package/dist/sdk/terminal/credentialStore.d.ts +4 -0
- package/dist/sdk/terminal/credentialStore.js +33 -0
- package/dist/sdk/terminal/daemon.d.ts +44 -0
- package/dist/sdk/terminal/daemon.js +264 -0
- package/dist/sdk/terminal/hubMenu.d.ts +10 -0
- package/dist/sdk/terminal/hubMenu.js +34 -0
- package/dist/sdk/terminal/launch.d.ts +5 -0
- package/dist/sdk/terminal/launch.js +27 -0
- package/dist/sdk/terminal/liveTerminal.d.ts +96 -0
- package/dist/sdk/terminal/liveTerminal.js +436 -0
- package/dist/sdk/terminal/logs.d.ts +14 -0
- package/dist/sdk/terminal/logs.js +59 -0
- package/dist/sdk/terminal/opentui/ansi.d.ts +25 -0
- package/dist/sdk/terminal/opentui/ansi.js +192 -0
- package/dist/sdk/terminal/opentui/model.d.ts +163 -0
- package/dist/sdk/terminal/opentui/model.js +484 -0
- package/dist/sdk/terminal/opentui/subagentsWidget.d.ts +28 -0
- package/dist/sdk/terminal/opentui/subagentsWidget.js +54 -0
- package/dist/sdk/terminal/opentui/theme.d.ts +47 -0
- package/dist/sdk/terminal/opentui/theme.js +93 -0
- package/dist/sdk/terminal/piExtension.d.ts +12 -0
- package/dist/sdk/terminal/piExtension.js +847 -0
- package/dist/sdk/terminal/pluginMenu.d.ts +34 -0
- package/dist/sdk/terminal/pluginMenu.js +101 -0
- package/dist/sdk/terminal/socket.d.ts +73 -0
- package/dist/sdk/terminal/socket.js +287 -0
- package/dist/sdk/terminal/standalone.d.ts +52 -0
- package/dist/sdk/terminal/standalone.js +329 -0
- package/dist/sdk/terminal/subagentMonitor.d.ts +62 -0
- package/dist/sdk/terminal/subagentMonitor.js +176 -0
- package/dist/sdk/terminal/terminals.d.ts +312 -0
- package/dist/sdk/terminal/terminals.js +1782 -0
- package/dist/sdk/terminal/toolName.d.ts +6 -0
- package/dist/sdk/terminal/toolName.js +12 -0
- package/dist/sdk/terminal/trajectory.d.ts +15 -0
- package/dist/sdk/terminal/trajectory.js +38 -0
- package/dist/sdk/terminal/tui/annotateCommand.d.ts +7 -0
- package/dist/sdk/terminal/tui/annotateCommand.js +36 -0
- package/dist/sdk/terminal/tui/annotateSend.d.ts +30 -0
- package/dist/sdk/terminal/tui/annotateSend.js +40 -0
- package/dist/sdk/terminal/tui/chrome.d.ts +68 -0
- package/dist/sdk/terminal/tui/chrome.js +182 -0
- package/dist/sdk/terminal/tui/clipboardFiles.d.ts +11 -0
- package/dist/sdk/terminal/tui/clipboardFiles.js +74 -0
- package/dist/sdk/terminal/tui/commandPages.d.ts +16 -0
- package/dist/sdk/terminal/tui/commandPages.js +136 -0
- package/dist/sdk/terminal/tui/commands.d.ts +71 -0
- package/dist/sdk/terminal/tui/commands.js +496 -0
- package/dist/sdk/terminal/tui/dialogGeometry.d.ts +27 -0
- package/dist/sdk/terminal/tui/dialogGeometry.js +52 -0
- package/dist/sdk/terminal/tui/dialogs.d.ts +81 -0
- package/dist/sdk/terminal/tui/dialogs.js +372 -0
- package/dist/sdk/terminal/tui/goalCommand.d.ts +19 -0
- package/dist/sdk/terminal/tui/goalCommand.js +83 -0
- package/dist/sdk/terminal/tui/harnessRuntime.d.ts +8 -0
- package/dist/sdk/terminal/tui/harnessRuntime.js +771 -0
- package/dist/sdk/terminal/tui/keybindings.d.ts +11 -0
- package/dist/sdk/terminal/tui/keybindings.js +49 -0
- package/dist/sdk/terminal/tui/list.d.ts +86 -0
- package/dist/sdk/terminal/tui/list.js +278 -0
- package/dist/sdk/terminal/tui/markdown.d.ts +16 -0
- package/dist/sdk/terminal/tui/markdown.js +55 -0
- package/dist/sdk/terminal/tui/modeChoices.d.ts +61 -0
- package/dist/sdk/terminal/tui/modeChoices.js +95 -0
- package/dist/sdk/terminal/tui/modelPicker.d.ts +55 -0
- package/dist/sdk/terminal/tui/modelPicker.js +150 -0
- package/dist/sdk/terminal/tui/mouse.d.ts +3 -0
- package/dist/sdk/terminal/tui/mouse.js +3 -0
- package/dist/sdk/terminal/tui/mouseReport.d.ts +30 -0
- package/dist/sdk/terminal/tui/mouseReport.js +80 -0
- package/dist/sdk/terminal/tui/page.d.ts +17 -0
- package/dist/sdk/terminal/tui/page.js +1 -0
- package/dist/sdk/terminal/tui/pageOverlay.d.ts +30 -0
- package/dist/sdk/terminal/tui/pageOverlay.js +183 -0
- package/dist/sdk/terminal/tui/pages/accountsPage.d.ts +76 -0
- package/dist/sdk/terminal/tui/pages/accountsPage.js +409 -0
- package/dist/sdk/terminal/tui/pages/agentsPage.d.ts +74 -0
- package/dist/sdk/terminal/tui/pages/agentsPage.js +193 -0
- package/dist/sdk/terminal/tui/pages/annotatePage.d.ts +148 -0
- package/dist/sdk/terminal/tui/pages/annotatePage.js +576 -0
- package/dist/sdk/terminal/tui/pages/browserPage.d.ts +87 -0
- package/dist/sdk/terminal/tui/pages/browserPage.js +739 -0
- package/dist/sdk/terminal/tui/pages/componentsPage.d.ts +47 -0
- package/dist/sdk/terminal/tui/pages/componentsPage.js +119 -0
- package/dist/sdk/terminal/tui/pages/contextPage.d.ts +91 -0
- package/dist/sdk/terminal/tui/pages/contextPage.js +585 -0
- package/dist/sdk/terminal/tui/pages/doctorPage.d.ts +39 -0
- package/dist/sdk/terminal/tui/pages/doctorPage.js +233 -0
- package/dist/sdk/terminal/tui/pages/followUpQueuePage.d.ts +34 -0
- package/dist/sdk/terminal/tui/pages/followUpQueuePage.js +130 -0
- package/dist/sdk/terminal/tui/pages/hubPage.d.ts +52 -0
- package/dist/sdk/terminal/tui/pages/hubPage.js +292 -0
- package/dist/sdk/terminal/tui/pages/logPage.d.ts +38 -0
- package/dist/sdk/terminal/tui/pages/logPage.js +189 -0
- package/dist/sdk/terminal/tui/pages/permissionsPage.d.ts +44 -0
- package/dist/sdk/terminal/tui/pages/permissionsPage.js +124 -0
- package/dist/sdk/terminal/tui/pages/pluginsPage.d.ts +65 -0
- package/dist/sdk/terminal/tui/pages/pluginsPage.js +519 -0
- package/dist/sdk/terminal/tui/pages/remoteControlPage.d.ts +32 -0
- package/dist/sdk/terminal/tui/pages/remoteControlPage.js +170 -0
- package/dist/sdk/terminal/tui/pages/settingsPage.d.ts +63 -0
- package/dist/sdk/terminal/tui/pages/settingsPage.js +103 -0
- package/dist/sdk/terminal/tui/pages/subagentsPage.d.ts +24 -0
- package/dist/sdk/terminal/tui/pages/subagentsPage.js +155 -0
- package/dist/sdk/terminal/tui/pages/textPage.d.ts +17 -0
- package/dist/sdk/terminal/tui/pages/textPage.js +52 -0
- package/dist/sdk/terminal/tui/pages/trajectoryPage.d.ts +66 -0
- package/dist/sdk/terminal/tui/pages/trajectoryPage.js +490 -0
- package/dist/sdk/terminal/tui/pages/usagePage.d.ts +45 -0
- package/dist/sdk/terminal/tui/pages/usagePage.js +397 -0
- package/dist/sdk/terminal/tui/pages/worktreesPage.d.ts +72 -0
- package/dist/sdk/terminal/tui/pages/worktreesPage.js +203 -0
- package/dist/sdk/terminal/tui/piAdapter.d.ts +17 -0
- package/dist/sdk/terminal/tui/piAdapter.js +46 -0
- package/dist/sdk/terminal/tui/planMode.d.ts +2 -0
- package/dist/sdk/terminal/tui/planMode.js +2 -0
- package/dist/sdk/terminal/tui/pluginCommands.d.ts +16 -0
- package/dist/sdk/terminal/tui/pluginCommands.js +41 -0
- package/dist/sdk/terminal/tui/qr.d.ts +4 -0
- package/dist/sdk/terminal/tui/qr.js +35 -0
- package/dist/sdk/terminal/tui/questionPicker.d.ts +20 -0
- package/dist/sdk/terminal/tui/questionPicker.js +150 -0
- package/dist/sdk/terminal/tui/questions.d.ts +21 -0
- package/dist/sdk/terminal/tui/questions.js +42 -0
- package/dist/sdk/terminal/tui/runtime.d.ts +117 -0
- package/dist/sdk/terminal/tui/runtime.js +544 -0
- package/dist/sdk/terminal/tui/search.d.ts +22 -0
- package/dist/sdk/terminal/tui/search.js +61 -0
- package/dist/sdk/terminal/tui/selection.d.ts +16 -0
- package/dist/sdk/terminal/tui/selection.js +16 -0
- package/dist/sdk/terminal/tui/sessionPicker.d.ts +40 -0
- package/dist/sdk/terminal/tui/sessionPicker.js +141 -0
- package/dist/sdk/terminal/tui/sessionUi.d.ts +3 -0
- package/dist/sdk/terminal/tui/sessionUi.js +30 -0
- package/dist/sdk/terminal/tui/settingsModel.d.ts +14 -0
- package/dist/sdk/terminal/tui/settingsModel.js +195 -0
- package/dist/sdk/terminal/tui/sideQuestion.d.ts +57 -0
- package/dist/sdk/terminal/tui/sideQuestion.js +241 -0
- package/dist/sdk/terminal/tui/skillInvocation.d.ts +28 -0
- package/dist/sdk/terminal/tui/skillInvocation.js +63 -0
- package/dist/sdk/terminal/tui/status.d.ts +18 -0
- package/dist/sdk/terminal/tui/status.js +67 -0
- package/dist/sdk/terminal/tui/theme.d.ts +54 -0
- package/dist/sdk/terminal/tui/theme.js +185 -0
- package/dist/sdk/terminal/tui/thinkingLevels.d.ts +11 -0
- package/dist/sdk/terminal/tui/thinkingLevels.js +31 -0
- package/dist/sdk/terminal/tui/treeModel.d.ts +79 -0
- package/dist/sdk/terminal/tui/treeModel.js +483 -0
- package/dist/sdk/terminal/tui/treePicker.d.ts +49 -0
- package/dist/sdk/terminal/tui/treePicker.js +251 -0
- package/dist/sdk/terminal/tui/ui.d.ts +49 -0
- package/dist/sdk/terminal/tui/ui.js +149 -0
- package/dist/sdk/terminal/tui/variantCommands.d.ts +32 -0
- package/dist/sdk/terminal/tui/variantCommands.js +359 -0
- package/dist/sdk/terminal/tui/workingStatus.d.ts +9 -0
- package/dist/sdk/terminal/tui/workingStatus.js +229 -0
- package/dist/sdk/terminal/variantControl.d.ts +24 -0
- package/dist/sdk/terminal/variantControl.js +145 -0
- package/dist/sdk/tools/askUser.d.ts +6 -0
- package/dist/sdk/tools/askUser.js +92 -0
- package/dist/sdk/tools/defaultSkills.d.ts +23 -0
- package/dist/sdk/tools/defaultSkills.js +46 -0
- package/dist/sdk/tools/definitions.d.ts +32 -0
- package/dist/sdk/tools/definitions.js +133 -0
- package/dist/sdk/tools/dispatch.d.ts +16 -0
- package/dist/sdk/tools/dispatch.js +92 -0
- package/dist/sdk/tools/getCapabilities.d.ts +31 -0
- package/dist/sdk/tools/getCapabilities.js +34 -0
- package/dist/sdk/tools/harnessTools.d.ts +8 -0
- package/dist/sdk/tools/harnessTools.js +20 -0
- package/dist/sdk/tools/sessionName.d.ts +16 -0
- package/dist/sdk/tools/sessionName.js +78 -0
- package/dist/sdk/tools/spawnSubagent.d.ts +4 -0
- package/dist/sdk/tools/spawnSubagent.js +63 -0
- package/dist/sdk/tools/todo.d.ts +15 -0
- package/dist/sdk/tools/todo.js +66 -0
- package/dist/sdk/tools/types.d.ts +48 -0
- package/dist/sdk/tools/types.js +1 -0
- package/dist/sdk/usage/analytics.d.ts +20 -0
- package/dist/sdk/usage/analytics.js +151 -0
- package/dist/sdk/usage/ledger.d.ts +38 -0
- package/dist/sdk/usage/ledger.js +142 -0
- package/dist/sdk/usage/limits/adapters.d.ts +11 -0
- package/dist/sdk/usage/limits/adapters.js +349 -0
- package/dist/sdk/usage/limits/capture.d.ts +8 -0
- package/dist/sdk/usage/limits/capture.js +47 -0
- package/dist/sdk/usage/limits/http.d.ts +12 -0
- package/dist/sdk/usage/limits/http.js +51 -0
- package/dist/sdk/usage/limits/normalize.d.ts +15 -0
- package/dist/sdk/usage/limits/normalize.js +211 -0
- package/dist/sdk/usage/limits/service.d.ts +30 -0
- package/dist/sdk/usage/limits/service.js +176 -0
- package/dist/sdk/usage/limits/types.d.ts +65 -0
- package/dist/sdk/usage/limits/types.js +1 -0
- package/dist/sdk/usage/serverMethods.d.ts +3 -0
- package/dist/sdk/usage/serverMethods.js +22 -0
- package/dist/sdk/usage/service.d.ts +32 -0
- package/dist/sdk/usage/service.js +66 -0
- package/dist/sdk/usage/settings.d.ts +7 -0
- package/dist/sdk/usage/settings.js +28 -0
- package/dist/sdk/usage/types.d.ts +60 -0
- package/dist/sdk/usage/types.js +4 -0
- package/dist/sdk/variant/components.d.ts +34 -0
- package/dist/sdk/variant/components.js +230 -0
- package/dist/sdk/variant/materialise.d.ts +66 -0
- package/dist/sdk/variant/materialise.js +81 -0
- package/dist/sdk/variant/migrate.d.ts +4 -0
- package/dist/sdk/variant/migrate.js +41 -0
- package/dist/sdk/variant/seed.d.ts +20 -0
- package/dist/sdk/variant/seed.js +116 -0
- package/dist/sdk/variant/store.d.ts +114 -0
- package/dist/sdk/variant/store.js +256 -0
- package/dist/sdk/variant/surface.d.ts +56 -0
- package/dist/sdk/variant/surface.js +81 -0
- package/dist/sdk/variant/trust.d.ts +27 -0
- package/dist/sdk/variant/trust.js +64 -0
- package/dist/sdk/variant/variant.d.ts +71 -0
- package/dist/sdk/variant/variant.js +331 -0
- package/dist/sdk/web/markdown.d.ts +10 -0
- package/dist/sdk/web/markdown.js +66 -0
- package/dist/sdk/web/part.d.ts +10 -0
- package/dist/sdk/web/part.js +6 -0
- package/dist/sdk/web/safeRequest.d.ts +34 -0
- package/dist/sdk/web/safeRequest.js +175 -0
- package/dist/sdk/web/search.d.ts +53 -0
- package/dist/sdk/web/search.js +168 -0
- package/dist/sdk/web/serverMethods.d.ts +3 -0
- package/dist/sdk/web/serverMethods.js +7 -0
- package/dist/sdk/web/text.d.ts +2 -0
- package/dist/sdk/web/text.js +7 -0
- package/dist/sdk/web/tools.d.ts +22 -0
- package/dist/sdk/web/tools.js +195 -0
- package/dist/sdk/web/turndown-plugin-gfm.d.ts +4 -0
- package/dist/sdk/wiki/notes.d.ts +68 -0
- package/dist/sdk/wiki/notes.js +297 -0
- package/dist/sdk/wiki/serverMethods.d.ts +3 -0
- package/dist/sdk/wiki/serverMethods.js +26 -0
- package/dist/sdk/worktrees/cli.d.ts +11 -0
- package/dist/sdk/worktrees/cli.js +146 -0
- package/dist/sdk/worktrees/copy.d.ts +9 -0
- package/dist/sdk/worktrees/copy.js +111 -0
- package/dist/sdk/worktrees/git.d.ts +18 -0
- package/dist/sdk/worktrees/git.js +89 -0
- package/dist/sdk/worktrees/serverMethods.d.ts +3 -0
- package/dist/sdk/worktrees/serverMethods.js +30 -0
- package/dist/sdk/worktrees/service.d.ts +73 -0
- package/dist/sdk/worktrees/service.js +483 -0
- package/dist/sdk/worktrees/setup.d.ts +23 -0
- package/dist/sdk/worktrees/setup.js +65 -0
- package/dist/sdk/worktrees/snapshot.d.ts +16 -0
- package/dist/sdk/worktrees/snapshot.js +83 -0
- package/dist/sdk/worktrees/types.d.ts +91 -0
- package/dist/sdk/worktrees/types.js +1 -0
- package/dist/sdk/world/actions.d.ts +23 -0
- package/dist/sdk/world/actions.js +31 -0
- package/dist/sdk/world/cli.d.ts +12 -0
- package/dist/sdk/world/cli.js +166 -0
- package/dist/sdk/world/images.d.ts +20 -0
- package/dist/sdk/world/images.js +48 -0
- package/dist/sdk/world/untrusted.d.ts +12 -0
- package/dist/sdk/world/untrusted.js +20 -0
- package/dist/sdk/world/world.d.ts +75 -0
- package/dist/sdk/world/world.js +117 -0
- package/dist/terminal-opentui.js +30986 -0
- package/dist/terminal-pi.js +3008 -610
- package/docs/README.md +45 -1
- package/docs/architecture/00-overview.md +171 -0
- package/docs/architecture/01-extension-points.md +78 -0
- package/docs/architecture/02-sessions-and-runs.md +505 -0
- package/docs/architecture/03-variants.md +122 -0
- package/docs/architecture/04-prompt.md +277 -0
- package/docs/architecture/05-refinement.md +134 -0
- package/docs/architecture/06-plugins-and-capabilities.md +208 -0
- package/docs/architecture/07-tools-and-gate.md +245 -0
- package/docs/architecture/08-memory-and-history.md +100 -0
- package/docs/architecture/09-accounts-and-connectors.md +153 -0
- package/docs/architecture/10-server-protocol.md +403 -0
- package/docs/architecture/11-terminal.md +555 -0
- package/docs/architecture/12-storage.md +118 -0
- package/docs/architecture/13-world-tools.md +114 -0
- package/docs/architecture/14-surfaces-and-parity.md +151 -0
- package/docs/architecture/15-remote-control.md +120 -0
- package/docs/architecture/README.md +143 -0
- package/docs/architecture/proposals/PROP-0001-reporting-section.md +106 -0
- package/docs/architecture/proposals/PROP-0002-retain-rollout-workspaces.md +104 -0
- package/docs/architecture/proposals/PROP-0003-executor-settings.md +81 -0
- package/docs/architecture/proposals/PROP-0004-flexible-reporting-guidance.md +71 -0
- package/docs/architecture/proposals/PROP-0005-xharness-cli-name.md +78 -0
- package/docs/architecture/proposals/PROP-0006-run-checklist.md +72 -0
- package/docs/architecture/proposals/PROP-0007-run-continuation.md +80 -0
- package/docs/architecture/proposals/PROP-0008-lessons-from-runs.md +80 -0
- package/docs/architecture/proposals/PROP-0009-foundation-and-variants.md +78 -0
- package/docs/architecture/proposals/PROP-0010-session-names.md +73 -0
- package/docs/architecture/proposals/PROP-0011-doctor.md +63 -0
- package/docs/architecture/proposals/PROP-0012-release-baseline.md +56 -0
- package/docs/architecture/proposals/PROP-0013-resource-browser.md +58 -0
- package/docs/architecture/proposals/PROP-0014-fullscreen-browser-tabs.md +58 -0
- package/docs/architecture/proposals/PROP-0015-one-capability-surface.md +88 -0
- package/docs/architecture/proposals/PROP-0016-managed-worktrees.md +156 -0
- package/docs/architecture/proposals/PROP-0017-page-annotations.md +131 -0
- package/docs/architecture/proposals/PROP-0018-annotation-queue-and-app-targets.md +183 -0
- package/docs/architecture/proposals/PROP-0019-contextual-side-questions.md +122 -0
- package/docs/architecture/proposals/PROP-0020-builtin-feature-plugins.md +105 -0
- package/docs/architecture/proposals/PROP-0021-command-namespaces-and-duplicates.md +99 -0
- package/docs/architecture/proposals/PROP-0022-plan-only-questions.md +102 -0
- package/docs/architecture/proposals/PROP-0023-xagent-cli-name.md +61 -0
- package/docs/architecture/proposals/PROP-0024-question-sketch-previews.md +130 -0
- package/docs/architecture/proposals/PROP-0025-contextual-question-wireframes.md +49 -0
- package/docs/architecture/proposals/PROP-0026-connected-sketch-display.md +96 -0
- package/docs/architecture/proposals/PROP-0027-xingular-agent-product-identity.md +60 -0
- package/docs/architecture/proposals/PROP-0028-normalize-question-wireframes.md +55 -0
- package/docs/architecture/proposals/PROP-0029-agent-profiles.md +124 -0
- package/docs/architecture/proposals/PROP-0030-subagent-title.md +86 -0
- package/docs/architecture/proposals/PROP-0031-plugin-command-owner-namespaces.md +54 -0
- package/docs/architecture/proposals/PROP-0032-planning-quality.md +196 -0
- package/docs/architecture/proposals/PROP-0033-compaction-plan-checkpoints.md +75 -0
- package/docs/architecture/proposals/PROP-0034-conversation-fast-mode.md +120 -0
- package/docs/architecture/proposals/PROP-0035-retain-subagent-status.md +47 -0
- package/docs/architecture/proposals/PROP-0036-first-class-harness-commands.md +59 -0
- package/docs/architecture/proposals/PROP-0037-workspace-write-boundary.md +63 -0
- package/docs/architecture/proposals/PROP-0038-annotate-open-shadow-roots.md +73 -0
- package/docs/architecture/proposals/PROP-0039-workspace-boundary-hardening.md +139 -0
- package/docs/architecture/proposals/PROP-0040-one-launch-path.md +87 -0
- package/docs/architecture/proposals/PROP-0041-bounded-work-slices.md +260 -0
- package/docs/architecture/proposals/PROP-0042-usage-and-provider-limits.md +127 -0
- package/docs/architecture/proposals/PROP-0043-read-only-plan-bash.md +74 -0
- package/docs/architecture/proposals/PROP-0044-work-slice-defaults.md +93 -0
- package/docs/architecture/proposals/PROP-0045-rename-checklist-to-todo.md +132 -0
- package/docs/architecture/proposals/PROP-0046-progress-aware-stall-guards.md +82 -0
- package/docs/architecture/proposals/PROP-0047-plugins-hub-separation.md +122 -0
- package/docs/architecture/proposals/PROP-0048-simple-annotate.md +85 -0
- package/docs/architecture/proposals/PROP-0049-context-attribution.md +415 -0
- package/docs/architecture/proposals/PROP-0050-run-stop-codes-and-refusals.md +30 -0
- package/docs/architecture/proposals/PROP-0051-unfinished-run-handoff.md +110 -0
- package/docs/architecture/proposals/PROP-0052-terminal-refine-and-variant-switch.md +111 -0
- package/docs/architecture/proposals/README.md +123 -0
- package/docs/decisions/ADR-0001-owned-terminal.md +10 -3
- package/docs/decisions/ADR-0003-shared-asynchronous-subagents.md +3 -1
- package/docs/decisions/ADR-0004-fullscreen-terminal-layout.md +3 -2
- package/docs/decisions/ADR-0006-opentui-only-terminal.md +47 -0
- package/docs/decisions/ADR-0007-reporting-section.md +33 -0
- package/docs/decisions/ADR-0008-flexible-reporting-guidance.md +41 -0
- package/docs/decisions/ADR-0009-xharness-command.md +39 -0
- package/docs/decisions/ADR-0010-lessons-in-the-wiki.md +31 -0
- package/docs/decisions/ADR-0011-foundation-and-variants.md +28 -0
- package/docs/decisions/ADR-0012-native-session-names.md +34 -0
- package/docs/decisions/ADR-0013-doctor.md +27 -0
- package/docs/decisions/ADR-0014-public-release-baseline.md +22 -0
- package/docs/decisions/ADR-0015-resource-browser.md +28 -0
- package/docs/decisions/ADR-0016-fullscreen-browser-tabs.md +31 -0
- package/docs/decisions/ADR-0017-one-capability-surface.md +34 -0
- package/docs/decisions/ADR-0018-builtin-feature-plugins.md +35 -0
- package/docs/decisions/ADR-0019-managed-git-worktrees.md +31 -0
- package/docs/decisions/ADR-0020-page-annotations.md +37 -0
- package/docs/decisions/ADR-0021-required-command-namespaces.md +40 -0
- package/docs/decisions/ADR-0022-plan-only-question-tools.md +34 -0
- package/docs/decisions/ADR-0023-contextual-side-question-runs.md +35 -0
- package/docs/decisions/ADR-0024-xagent-command.md +40 -0
- package/docs/decisions/ADR-0025-question-choice-sketches.md +49 -0
- package/docs/decisions/ADR-0026-contextual-question-wireframes.md +58 -0
- package/docs/decisions/ADR-0027-connected-sketch-display.md +62 -0
- package/docs/decisions/ADR-0028-xingular-agent-product-identity.md +56 -0
- package/docs/decisions/ADR-0029-normalized-question-wireframe-borders.md +33 -0
- package/docs/decisions/ADR-0030-agent-profiles.md +43 -0
- package/docs/decisions/ADR-0031-plugin-command-owner-namespaces.md +37 -0
- package/docs/decisions/ADR-0032-compaction-run-checkpoints.md +35 -0
- package/docs/decisions/ADR-0033-plan-mode-research-delegation.md +47 -0
- package/docs/decisions/ADR-0034-first-class-harness-terminal-commands.md +25 -0
- package/docs/decisions/ADR-0035-one-launch-path.md +40 -0
- package/docs/decisions/ADR-0036-workspace-write-operation-boundary.md +54 -0
- package/docs/decisions/ADR-0037-usage-ledger-and-provider-limits.md +44 -0
- package/docs/decisions/ADR-0038-plan-bash-os-read-only.md +29 -0
- package/docs/decisions/ADR-0039-progress-aware-stall-guards.md +43 -0
- package/docs/decisions/ADR-0040-architecture-change-workflow.md +31 -0
- package/docs/decisions/ADR-0041-plugins-hub-separation.md +41 -0
- package/docs/decisions/ADR-0042-windows-shell-without-sandbox.md +40 -0
- package/docs/decisions/ADR-0043-parents-continue-stopped-subagents.md +49 -0
- package/docs/decisions/ADR-0044-annotations-pending-or-sent.md +24 -0
- package/docs/decisions/ADR-0045-default-plugin-authoring-skill.md +9 -0
- package/docs/decisions/ADR-0046-hash-bound-plugin-proposals.md +20 -0
- package/docs/decisions/ADR-0047-links-open-with-the-os-handler.md +47 -0
- package/docs/decisions/ADR-0048-required-skills-from-a-message.md +42 -0
- package/docs/decisions/ADR-0050-approved-window-screenshots.md +19 -0
- package/docs/decisions/ADR-0051-terminal-decision-wait.md +10 -0
- package/docs/decisions/ADR-0052-per-profile-subagent-budgets.md +25 -0
- package/docs/decisions/ADR-0053-no-repeated-work-guard.md +45 -0
- package/docs/decisions/ADR-0054-terminal-reply-heartbeat-and-stall.md +52 -0
- package/docs/decisions/ADR-0055-plan-output-repair.md +51 -0
- package/docs/decisions/ADR-0056-remote-control.md +53 -0
- package/docs/decisions/ADR-0057-structured-plan-outcomes.md +39 -0
- package/docs/decisions/ADR-0058-ask-user-only-plan-clarification.md +36 -0
- package/docs/decisions/ADR-0059-run-diagnostic-evidence.md +35 -0
- package/docs/decisions/ADR-0060-approvals-are-controls.md +40 -0
- package/docs/decisions/ADR-0061-strict-plugin-command-namespaces.md +41 -0
- package/docs/decisions/ADR-0062-shared-account-state.md +67 -0
- package/docs/decisions/ADR-0063-unfinished-work-handoffs.md +34 -0
- package/docs/decisions/ADR-0064-account-model-fallback-on-resume.md +79 -0
- package/docs/decisions/ADR-0065-variant-switch-at-turn-boundaries.md +31 -0
- package/docs/decisions/ADR-0066-guided-refinement-from-turn-snapshots.md +37 -0
- package/docs/decisions/ADR-0067-cache-stable-compaction-checkpoint.md +54 -0
- package/docs/decisions/ADR-0068-scope-and-completion-report.md +60 -0
- package/docs/decisions/ADR-0069-stop-gate-and-finish.md +136 -0
- package/docs/decisions/ADR-0070-terminal-slice-continuation.md +49 -0
- package/docs/decisions/ADR-0071-completion-check.md +104 -0
- package/docs/decisions/ADR-0072-codex-prompts-and-goal.md +108 -0
- package/docs/decisions/ADR-0073-large-reporting-prompt.md +89 -0
- package/docs/decisions/ADR-0074-report-content-not-report-blocks.md +90 -0
- package/docs/decisions/ADR-0075-no-todo-gate.md +84 -0
- package/docs/decisions/ADR-0076-codex-final-answer-verbatim.md +98 -0
- package/docs/decisions/ADR-0077-plan-runs-may-conclude-no-plan-needed.md +120 -0
- package/docs/decisions/ADR-0078-child-aware-stall-watch.md +46 -0
- package/docs/decisions/ADR-0079-phase-led-reporting-guidance.md +72 -0
- package/docs/decisions/ADR-0080-fixed-width-question-sketch-canvas.md +50 -0
- package/docs/decisions/ADR-0081-no-work-slice-budget-by-default.md +36 -0
- package/docs/decisions/ADR-0082-connected-brave-browser.md +72 -0
- package/docs/decisions/ADR-0083-one-live-session-runtime.md +256 -0
- package/docs/doctor.md +95 -0
- package/docs/experiments/EXP-0001-terminal-input-latency/plan.md +81 -0
- package/docs/experiments/EXP-0001-terminal-input-latency/results.md +46 -0
- package/docs/experiments/EXP-0002-opentui-typing-latency/plan.md +70 -0
- package/docs/experiments/EXP-0002-opentui-typing-latency/results.md +92 -0
- package/docs/experiments/EXP-0003-performance-audit/data/session-runtime-replication.json +420 -0
- package/docs/experiments/EXP-0003-performance-audit/data/session-runtime.json +420 -0
- package/docs/experiments/EXP-0003-performance-audit/data/terminal-compact.json +376 -0
- package/docs/experiments/EXP-0003-performance-audit/data/terminal-history.json +422 -0
- package/docs/experiments/EXP-0003-performance-audit/data/terminal-question.json +95 -0
- package/docs/experiments/EXP-0003-performance-audit/data/terminal-wide.json +1036 -0
- package/docs/experiments/EXP-0003-performance-audit/plan.md +109 -0
- package/docs/experiments/EXP-0003-performance-audit/results.md +151 -0
- package/docs/features/README.md +46 -0
- package/docs/features/automations/README.md +41 -0
- package/docs/features/cores/README.md +39 -0
- package/docs/features/google-harness2/README.md +52 -0
- package/docs/features/integrations/README.md +40 -0
- package/docs/features/interfaces/README.md +29 -0
- package/docs/features/memory/README.md +28 -0
- package/docs/future-work.md +48 -0
- package/docs/handoff-2026-10-25-app-parity-and-solo-tabs.md +202 -0
- package/docs/parity.md +158 -0
- package/docs/releases/1.0.0.md +40 -0
- package/docs/releases/1.1.1.md +28 -0
- package/docs/releases/1.2.0.md +49 -0
- package/docs/releases/1.3.0.md +21 -0
- package/docs/releases/1.3.1-unstable.1.md +8 -0
- package/docs/releases/1.3.1-unstable.2.md +11 -0
- package/docs/releases/1.3.1-unstable.3.md +54 -0
- package/docs/releases/1.3.1-unstable.4.md +56 -0
- package/docs/releases/1.3.1-unstable.5.md +53 -0
- package/docs/releases/1.3.1-unstable.6.md +31 -0
- package/docs/releases/1.3.1-unstable.7.md +17 -0
- package/docs/releases/1.3.1-unstable.8.md +19 -0
- package/docs/releases/1.3.1-unstable.9.md +54 -0
- package/docs/releases/1.4.0-unstable.md +25 -0
- package/docs/releases/1.5.0-unstable.md +32 -0
- package/docs/releases/1.5.1-unstable.md +24 -0
- package/docs/releases/1.6.0-unstable.md +59 -0
- package/docs/releases/2.0.1-unstable.md +63 -0
- package/docs/releases/4.0.0.md +47 -0
- package/docs/releases/README.md +49 -0
- package/docs/study/00-index.md +112 -0
- package/docs/study/STUDY-0003-long-horizon-runs.md +210 -0
- package/docs/study/STUDY-0004-turn-end-controls.md +130 -0
- package/docs/study/STUDY-0005-skill-installation-guidance.md +146 -0
- package/docs/study/STUDY-0006-reporting-prompts.md +119 -0
- package/docs/study/STUDY-0007-claude-code-prompt.md +162 -0
- package/docs/study/STUDY-0008-browser-control.md +281 -0
- package/docs/study/STUDY-0009-claude-code-reporting.md +205 -0
- package/docs/study/arms/00-matrix.md +20 -0
- package/docs/study/arms/01-system-prompt.md +211 -0
- package/docs/study/arms/02-tools.md +79 -0
- package/docs/study/arms/03-subagents.md +90 -0
- package/docs/study/arms/04-skills.md +81 -0
- package/docs/study/arms/05-context-management.md +90 -0
- package/docs/study/arms/06-memory.md +90 -0
- package/docs/study/arms/07-governance.md +71 -0
- package/docs/study/arms/08-execution.md +69 -0
- package/docs/study/arms/09-observability.md +60 -0
- package/docs/study/arms/10-refinement.md +110 -0
- package/docs/study/autonomous-engineering-sources.md +277 -0
- package/docs/study/autonomy-sources.md +147 -0
- package/docs/study/btw-comparison.md +37 -0
- package/docs/study/feature-gap-review.md +42 -0
- package/docs/study/insights.md +123 -0
- package/docs/study/proactive-autonomy.md +408 -0
- package/docs/study/roadmap.md +72 -0
- package/docs/study/sources/claude-code.md +56 -0
- package/docs/study/sources/deepseek-harness.md +102 -0
- package/docs/study/sources/harness2.md +50 -0
- package/docs/study/sources/kimi-cli.md +42 -0
- package/docs/study/sources/omp.md +93 -0
- package/docs/study/sources/opencode.md +43 -0
- package/docs/study/sources/openhands.md +46 -0
- package/docs/study/sources/smolagents.md +40 -0
- package/docs/study/sources/swe-agent.md +34 -0
- package/docs/study/tui-resource-browser.md +78 -0
- package/docs/system-prompt-design.md +196 -0
- package/docs/terminal-tui.md +887 -109
- package/package.json +46 -13
- package/src/accounts/accounts.test.ts +0 -419
- package/src/accounts/accounts.ts +0 -760
- package/src/accounts/env.test.ts +0 -95
- package/src/accounts/env.ts +0 -338
- package/src/accounts/secrets.ts +0 -50
- package/src/accounts/store.ts +0 -338
- package/src/capabilities/api.ts +0 -75
- package/src/capabilities/runSnapshot.ts +0 -59
- package/src/capabilities/types.ts +0 -34
- package/src/cli.ts +0 -118
- package/src/core/bus.test.ts +0 -22
- package/src/core/bus.ts +0 -49
- package/src/core/changes.ts +0 -33
- package/src/core/env.ts +0 -27
- package/src/core/errors.ts +0 -32
- package/src/core/frontmatter.ts +0 -47
- package/src/core/fs.test.ts +0 -38
- package/src/core/fs.ts +0 -92
- package/src/core/index.ts +0 -193
- package/src/core/path.test.ts +0 -14
- package/src/core/path.ts +0 -79
- package/src/core/projects.ts +0 -90
- package/src/core/text.ts +0 -39
- package/src/harness.ts +0 -322
- package/src/hub/catalog.json +0 -123
- package/src/hub/cli.ts +0 -59
- package/src/hub/hub.test.ts +0 -205
- package/src/hub/hub.ts +0 -256
- package/src/hub/schema.ts +0 -81
- package/src/index.ts +0 -80
- package/src/mcp/connections.ts +0 -641
- package/src/mcp/manager.ts +0 -130
- package/src/mcp/oauth.ts +0 -195
- package/src/mcp/scopeMigration.test.ts +0 -79
- package/src/mcp/scopeMigration.ts +0 -204
- package/src/mcp/service.test.ts +0 -422
- package/src/mcp/service.ts +0 -560
- package/src/mcp/types.ts +0 -118
- package/src/memory/api.test.ts +0 -82
- package/src/memory/api.ts +0 -303
- package/src/memory/blocks.test.ts +0 -78
- package/src/memory/blocks.ts +0 -408
- package/src/memory/caller.ts +0 -69
- package/src/memory/curation.test.ts +0 -206
- package/src/memory/curation.ts +0 -64
- package/src/memory/dispatch.ts +0 -64
- package/src/memory/facts.test.ts +0 -41
- package/src/memory/facts.ts +0 -248
- package/src/memory/graph.ts +0 -103
- package/src/memory/health.test.ts +0 -130
- package/src/memory/health.ts +0 -74
- package/src/memory/maintainer.ts +0 -272
- package/src/memory/maintenance.test.ts +0 -192
- package/src/memory/maintenance.ts +0 -679
- package/src/memory/migrate.ts +0 -79
- package/src/memory/operations.ts +0 -150
- package/src/memory/proposals.test.ts +0 -168
- package/src/memory/proposals.ts +0 -584
- package/src/memory/recall.test.ts +0 -115
- package/src/memory/recall.ts +0 -279
- package/src/memory/references.ts +0 -77
- package/src/memory/runContext.ts +0 -93
- package/src/memory/secrets.ts +0 -6
- package/src/memory/store.test.ts +0 -66
- package/src/memory/store.ts +0 -385
- package/src/memory/trajectory.test.ts +0 -178
- package/src/memory/trajectory.ts +0 -220
- package/src/memory/wiki.test.ts +0 -47
- package/src/memory/wiki.ts +0 -423
- package/src/memory/wikiIndex.test.ts +0 -88
- package/src/memory/wikiIndex.ts +0 -117
- package/src/plugins/api.ts +0 -181
- package/src/plugins/attachments.test.ts +0 -84
- package/src/plugins/attachments.ts +0 -141
- package/src/plugins/builtin.ts +0 -84
- package/src/plugins/catalogue.test.ts +0 -254
- package/src/plugins/catalogue.ts +0 -251
- package/src/plugins/cli.ts +0 -184
- package/src/plugins/discover.ts +0 -151
- package/src/plugins/firstParty.test.ts +0 -143
- package/src/plugins/firstParty.ts +0 -129
- package/src/plugins/hooks.test.ts +0 -250
- package/src/plugins/hooks.ts +0 -239
- package/src/plugins/identity.ts +0 -37
- package/src/plugins/install.test.ts +0 -107
- package/src/plugins/install.ts +0 -106
- package/src/plugins/inventory.ts +0 -123
- package/src/plugins/manifest.ts +0 -76
- package/src/plugins/plugins.test.ts +0 -205
- package/src/plugins/plugins.ts +0 -189
- package/src/plugins/proposal.ts +0 -121
- package/src/plugins/runtime.test.ts +0 -40
- package/src/plugins/runtime.ts +0 -82
- package/src/plugins/trust.ts +0 -142
- package/src/plugins/types.ts +0 -149
- package/src/prompt/compile.test.ts +0 -261
- package/src/prompt/compile.ts +0 -732
- package/src/server/methods.ts +0 -355
- package/src/server/remote.ts +0 -77
- package/src/server/rpc.ts +0 -116
- package/src/server/serve.ts +0 -28
- package/src/server/server.test.ts +0 -193
- package/src/sessions/approvals.test.ts +0 -49
- package/src/sessions/approvals.ts +0 -140
- package/src/sessions/contracts.ts +0 -336
- package/src/sessions/conversation.test.ts +0 -233
- package/src/sessions/extensionSession.test.ts +0 -74
- package/src/sessions/extensionUi.test.ts +0 -65
- package/src/sessions/extensionUi.ts +0 -102
- package/src/sessions/history.ts +0 -51
- package/src/sessions/lineageJoin.ts +0 -75
- package/src/sessions/policy.ts +0 -36
- package/src/sessions/pricing.ts +0 -60
- package/src/sessions/questionBatches.test.ts +0 -110
- package/src/sessions/reasoningSummaries.ts +0 -59
- package/src/sessions/registry.ts +0 -412
- package/src/sessions/runIndex.ts +0 -99
- package/src/sessions/runStore.test.ts +0 -152
- package/src/sessions/runStore.ts +0 -346
- package/src/sessions/runner.ts +0 -610
- package/src/sessions/runtimeResources.test.ts +0 -61
- package/src/sessions/sessions.test.ts +0 -588
- package/src/sessions/sessions.ts +0 -331
- package/src/sessions/subagentService.test.ts +0 -159
- package/src/sessions/subagentService.ts +0 -236
- package/src/sessions/subagents.ts +0 -97
- package/src/skills/registry.test.ts +0 -104
- package/src/skills/registry.ts +0 -413
- package/src/terminal/accountsMenu.test.ts +0 -225
- package/src/terminal/accountsMenu.ts +0 -382
- package/src/terminal/cli.ts +0 -149
- package/src/terminal/client.ts +0 -74
- package/src/terminal/control.test.ts +0 -23
- package/src/terminal/control.ts +0 -23
- package/src/terminal/controller.ts +0 -354
- package/src/terminal/hubMenu.ts +0 -24
- package/src/terminal/launch.test.ts +0 -25
- package/src/terminal/launch.ts +0 -48
- package/src/terminal/piExtension.lifecycle.test.ts +0 -55
- package/src/terminal/piExtension.ts +0 -295
- package/src/terminal/pluginControl.test.ts +0 -146
- package/src/terminal/pluginMenu.ts +0 -112
- package/src/terminal/socket.test.ts +0 -94
- package/src/terminal/socket.ts +0 -256
- package/src/terminal/standalone.test.ts +0 -167
- package/src/terminal/standalone.ts +0 -165
- package/src/terminal/terminal.test.ts +0 -534
- package/src/terminal/terminals.ts +0 -661
- package/src/terminal/trajectory.test.ts +0 -66
- package/src/terminal/trajectory.ts +0 -44
- package/src/terminal/tui/application.test.ts +0 -290
- package/src/terminal/tui/application.ts +0 -653
- package/src/terminal/tui/commands.test.ts +0 -278
- package/src/terminal/tui/commands.ts +0 -443
- package/src/terminal/tui/dialogs.ts +0 -301
- package/src/terminal/tui/editor.test.ts +0 -113
- package/src/terminal/tui/editor.ts +0 -109
- package/src/terminal/tui/keybindings.test.ts +0 -30
- package/src/terminal/tui/keybindings.ts +0 -59
- package/src/terminal/tui/piAdapter.ts +0 -62
- package/src/terminal/tui/planMode.test.ts +0 -10
- package/src/terminal/tui/planMode.ts +0 -12
- package/src/terminal/tui/presentation.test.ts +0 -79
- package/src/terminal/tui/questions.test.ts +0 -41
- package/src/terminal/tui/questions.ts +0 -47
- package/src/terminal/tui/runtime.socket.test.ts +0 -178
- package/src/terminal/tui/runtime.test.ts +0 -225
- package/src/terminal/tui/runtime.ts +0 -403
- package/src/terminal/tui/screen.test.ts +0 -143
- package/src/terminal/tui/screen.ts +0 -121
- package/src/terminal/tui/sessionUi.ts +0 -24
- package/src/terminal/tui/settings.test.ts +0 -150
- package/src/terminal/tui/settings.ts +0 -188
- package/src/terminal/tui/skillInvocation.test.ts +0 -71
- package/src/terminal/tui/skillInvocation.ts +0 -51
- package/src/terminal/tui/status.test.ts +0 -48
- package/src/terminal/tui/status.ts +0 -82
- package/src/terminal/tui/theme.ts +0 -185
- package/src/terminal/tui/tools.test.ts +0 -145
- package/src/terminal/tui/tools.ts +0 -142
- package/src/terminal/tui/trajectoryPanel.test.ts +0 -99
- package/src/terminal/tui/trajectoryPanel.ts +0 -226
- package/src/terminal/tui/transcript.test.ts +0 -39
- package/src/terminal/tui/transcript.ts +0 -135
- package/src/terminal/tui/ui.test.ts +0 -313
- package/src/terminal/tui/ui.ts +0 -166
- package/src/terminal/tui/welcome.ts +0 -102
- package/src/terminal/tui/workingStatus.test.ts +0 -44
- package/src/terminal/tui/workingStatus.ts +0 -238
- package/src/tools/askUser.test.ts +0 -69
- package/src/tools/askUser.ts +0 -59
- package/src/tools/definitions.ts +0 -228
- package/src/tools/maintenance.ts +0 -29
- package/src/tools/memoryTools.ts +0 -22
- package/src/tools/pluginPropose.ts +0 -41
- package/src/tools/registryWrite.test.ts +0 -101
- package/src/tools/registryWrite.ts +0 -182
- package/src/tools/spawnSubagent.ts +0 -47
- package/src/tools/types.ts +0 -41
- package/src/web/safeRequest.ts +0 -171
- package/src/web/text.ts +0 -53
- package/src/web/tools.ts +0 -134
- package/src/web/web.test.ts +0 -141
package/src/mcp/connections.ts
DELETED
|
@@ -1,641 +0,0 @@
|
|
|
1
|
-
// Device-local connected apps: the saved connections, who may reach each one, how each is
|
|
2
|
-
// launched, and what must never be persisted from their results.
|
|
3
|
-
import { chmodSync } from 'node:fs'
|
|
4
|
-
import { isAbsolute, join } from 'node:path'
|
|
5
|
-
|
|
6
|
-
import { secretKey, type SecretStore } from '../accounts/secrets'
|
|
7
|
-
import type { Bus } from '../core/bus'
|
|
8
|
-
import { HarnessError, invalid, notFound } from '../core/errors'
|
|
9
|
-
import { newId, readJson, safeId, writeJson } from '../core/fs'
|
|
10
|
-
import { findBinary, pathVariableName, searchPath } from '../core/path'
|
|
11
|
-
import { isDir } from '../memory/store'
|
|
12
|
-
import type { RunEvent } from '../sessions/contracts'
|
|
13
|
-
import * as attachments from '../plugins/attachments'
|
|
14
|
-
import { connectionScopeMigrationComplete } from './scopeMigration'
|
|
15
|
-
import { connectionCapabilityId, connectionInputSchema, connectionSchema, type AppOAuthClients, type Connection, type ConnectionInput, type LaunchConfig, type Scope } from './types'
|
|
16
|
-
|
|
17
|
-
const OAUTH_STATE = 'oauth'
|
|
18
|
-
const OAUTH_CLIENT_ID = 'oauth_client_id'
|
|
19
|
-
const OAUTH_CLIENT_SECRET = 'oauth_client_secret'
|
|
20
|
-
const headerItem = (name: string): string => `header:${name}`
|
|
21
|
-
|
|
22
|
-
/** Remote servers and sign-in pages must use TLS; plain HTTP is only for servers on this machine. */
|
|
23
|
-
export function webUrl(text: string | null | undefined): URL | null {
|
|
24
|
-
try {
|
|
25
|
-
const url = new URL(text ?? '')
|
|
26
|
-
const loopback = ['127.0.0.1', 'localhost', '[::1]'].includes(url.hostname)
|
|
27
|
-
return url.protocol === 'https:' || (url.protocol === 'http:' && loopback) ? url : null
|
|
28
|
-
} catch {
|
|
29
|
-
return null
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/** Whether a session with this scope may reach the connection. */
|
|
34
|
-
export function allowed(connection: Connection, scope: Scope): boolean {
|
|
35
|
-
if (!connection.enabled) return false
|
|
36
|
-
if (scope.agentId && connection.excludedAgentIds.includes(scope.agentId)) return false
|
|
37
|
-
if (scope.projectId && connection.excludedProjectIds.includes(scope.projectId)) return false
|
|
38
|
-
return connection.global || Boolean(scope.agentId && connection.agentIds.includes(scope.agentId)) || Boolean(scope.projectId && connection.projectIds.includes(scope.projectId))
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/** Gives one agent exactly these connections, leaving every other agent's access as it was. */
|
|
42
|
-
export function setAgentScope(all: Connection[], agentId: string, ids: readonly string[]): void {
|
|
43
|
-
for (const connection of all) {
|
|
44
|
-
connection.agentIds = connection.agentIds.filter((id) => id !== agentId)
|
|
45
|
-
connection.excludedAgentIds = connection.excludedAgentIds.filter((id) => id !== agentId)
|
|
46
|
-
if (ids.includes(connection.id)) {
|
|
47
|
-
if (!connection.global) connection.agentIds.push(agentId)
|
|
48
|
-
} else if (connection.global) {
|
|
49
|
-
connection.excludedAgentIds.push(agentId)
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Switches one connection on or off for everyone, for one agent, or for one project, leaving
|
|
56
|
-
* every other agent's and project's access as it was.
|
|
57
|
-
*/
|
|
58
|
-
export function setScope(connection: Connection, scope: Scope, on: boolean): void {
|
|
59
|
-
const without = (ids: string[], id: string): string[] => ids.filter((item) => item !== id)
|
|
60
|
-
if (scope.agentId) {
|
|
61
|
-
connection.agentIds = without(connection.agentIds, scope.agentId)
|
|
62
|
-
connection.excludedAgentIds = without(connection.excludedAgentIds, scope.agentId)
|
|
63
|
-
if (on && !connection.global) connection.agentIds.push(scope.agentId)
|
|
64
|
-
// Off must hold in a project that has the connection too.
|
|
65
|
-
else if (!on && (connection.global || connection.projectIds.length)) connection.excludedAgentIds.push(scope.agentId)
|
|
66
|
-
} else if (scope.projectId) {
|
|
67
|
-
connection.projectIds = without(connection.projectIds, scope.projectId)
|
|
68
|
-
connection.excludedProjectIds = without(connection.excludedProjectIds, scope.projectId)
|
|
69
|
-
if (on && !connection.global) connection.projectIds.push(scope.projectId)
|
|
70
|
-
else if (!on && connection.global) connection.excludedProjectIds.push(scope.projectId)
|
|
71
|
-
} else {
|
|
72
|
-
connection.global = on
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/** Why these connections cannot be given to a session with this scope, or nothing. */
|
|
77
|
-
export function validateScopeIds(all: readonly Connection[], scope: Scope, ids: readonly string[]): void {
|
|
78
|
-
for (const id of ids) {
|
|
79
|
-
const connection = all.find((item) => item.id === id)
|
|
80
|
-
if (!connection) throw notFound('Connection')
|
|
81
|
-
if (!allowed(connection, scope)) throw new HarnessError('required_connections_unavailable', `${connection.name} is disabled or outside your connection scope.`)
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// ---- Redaction ----------------------------------------------------------------------------------
|
|
86
|
-
|
|
87
|
-
const SENSITIVE_FIELDS = new Set(['approvaltoken', 'token', 'apikey', 'accesstoken', 'refreshtoken', 'idtoken', 'clientsecret', 'secret', 'password', 'passwd', 'authorization', 'cookie', 'setcookie', 'env', 'credentials', 'locators'])
|
|
88
|
-
const SENSITIVE_KEYS = ['approvalToken', 'token', 'apiKey', 'api_key', 'accessToken', 'access_token', 'refreshToken', 'refresh_token', 'clientSecret', 'client_secret', 'password', 'authorization', 'cookie']
|
|
89
|
-
|
|
90
|
-
function sensitiveField(key: string): boolean {
|
|
91
|
-
return SENSITIVE_FIELDS.has(key.replace(/[^A-Za-z0-9]/g, '').toLowerCase())
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/** Replaces the value of every `"key": "…"` in text that is not valid JSON (a truncated summary). */
|
|
95
|
-
export function redactJsonField(text: string, key: string): string {
|
|
96
|
-
const marker = `"${key}"`
|
|
97
|
-
let output = text
|
|
98
|
-
let offset = 0
|
|
99
|
-
for (;;) {
|
|
100
|
-
const found = output.indexOf(marker, offset)
|
|
101
|
-
if (found < 0) return output
|
|
102
|
-
const start = found + marker.length
|
|
103
|
-
const match = /^\s*:\s*"/.exec(output.slice(start))
|
|
104
|
-
if (!match) {
|
|
105
|
-
offset = start
|
|
106
|
-
continue
|
|
107
|
-
}
|
|
108
|
-
const valueStart = start + match[0].length
|
|
109
|
-
const quote = output.indexOf('"', valueStart)
|
|
110
|
-
const end = quote < 0 ? output.length : quote
|
|
111
|
-
output = `${output.slice(0, valueStart)}[redacted]${output.slice(end)}`
|
|
112
|
-
offset = valueStart + '[redacted]'.length
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
function parsedContainer(text: string): unknown {
|
|
117
|
-
try {
|
|
118
|
-
const parsed = JSON.parse(text) as unknown
|
|
119
|
-
return parsed && typeof parsed === 'object' ? parsed : undefined
|
|
120
|
-
} catch {
|
|
121
|
-
return undefined
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/** Drops credential-like fields from a value, including from JSON carried as text. */
|
|
126
|
-
export function scrubSensitive(value: unknown): unknown {
|
|
127
|
-
return scrubWith(value, [])
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/** `scrubSensitive`, and every one of `secrets` replaced wherever it appears in text. */
|
|
131
|
-
export function scrubWith(value: unknown, secrets: readonly string[]): unknown {
|
|
132
|
-
if (Array.isArray(value)) return value.map((item) => scrubWith(item, secrets))
|
|
133
|
-
if (value && typeof value === 'object') return Object.fromEntries(Object.entries(value).filter(([key]) => !sensitiveField(key)).map(([key, item]) => [key, scrubWith(item, secrets)]))
|
|
134
|
-
if (typeof value !== 'string') return value
|
|
135
|
-
let output = value
|
|
136
|
-
for (const secret of secrets) if (secret) output = output.replaceAll(secret, '[redacted]')
|
|
137
|
-
// Text representations of structured previews must not persist approval tokens.
|
|
138
|
-
const parsed = parsedContainer(output)
|
|
139
|
-
if (parsed !== undefined) return JSON.stringify(scrubWith(parsed, secrets))
|
|
140
|
-
// Summaries can contain truncated JSON, which cannot be parsed above.
|
|
141
|
-
for (const key of SENSITIVE_KEYS) output = redactJsonField(output, key)
|
|
142
|
-
return output
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
export function revisionOf(all: readonly Connection[]): unknown[] {
|
|
146
|
-
return all.map((item) => ({ id: item.id, enabled: item.enabled, global: item.global, agents: item.agentIds, projects: item.projectIds, excludedAgents: item.excludedAgentIds, excludedProjects: item.excludedProjectIds, checkedAt: item.checkedAt, error: item.error }))
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
function sameScope(left: Connection, right: Connection): boolean {
|
|
150
|
-
const ids = (values: string[]): string[] => [...values].sort()
|
|
151
|
-
return left.global === right.global
|
|
152
|
-
&& JSON.stringify(ids(left.agentIds)) === JSON.stringify(ids(right.agentIds))
|
|
153
|
-
&& JSON.stringify(ids(left.projectIds)) === JSON.stringify(ids(right.projectIds))
|
|
154
|
-
&& JSON.stringify(ids(left.excludedAgentIds)) === JSON.stringify(ids(right.excludedAgentIds))
|
|
155
|
-
&& JSON.stringify(ids(left.excludedProjectIds)) === JSON.stringify(ids(right.excludedProjectIds))
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
function hasScope(connection: Connection): boolean {
|
|
159
|
-
return connection.global || connection.agentIds.length > 0 || connection.projectIds.length > 0
|
|
160
|
-
|| connection.excludedAgentIds.length > 0 || connection.excludedProjectIds.length > 0
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
function scopeMigrationError(): HarnessError {
|
|
164
|
-
return new HarnessError('connection_scope_migration_pending', 'Connector access settings cannot be changed until their scope migration succeeds. Reopen the data root to retry it.')
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
// ---- The store --------------------------------------------------------------------------------
|
|
168
|
-
|
|
169
|
-
export class Connections {
|
|
170
|
-
private readonly path: string
|
|
171
|
-
/** Every secret value a connection holds, so results can be redacted without waiting on the store. */
|
|
172
|
-
private readonly known = new Map<string, string[]>()
|
|
173
|
-
|
|
174
|
-
constructor(
|
|
175
|
-
stateDir: string,
|
|
176
|
-
private readonly secrets: SecretStore,
|
|
177
|
-
private readonly bus: Bus,
|
|
178
|
-
private readonly attachmentRoot: () => string | null = () => null,
|
|
179
|
-
private readonly appClients: AppOAuthClients | null = null
|
|
180
|
-
) {
|
|
181
|
-
this.path = join(stateDir, 'connections.json')
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
list(): Connection[] {
|
|
185
|
-
const stored = readJson<unknown[]>(this.path) ?? []
|
|
186
|
-
const root = this.attachmentRoot()
|
|
187
|
-
const choices = root ? attachments.load(root) : null
|
|
188
|
-
return stored.flatMap((item) => {
|
|
189
|
-
const parsed = connectionSchema.safeParse(item)
|
|
190
|
-
if (!parsed.success) return []
|
|
191
|
-
const connection = parsed.data
|
|
192
|
-
// Records saved before remote servers existed have no `auth`.
|
|
193
|
-
if (!connection.auth) connection.auth = 'none'
|
|
194
|
-
// The preset was saved as "X Workspace" before the product was renamed.
|
|
195
|
-
if (connection.kind === 'workspace' && connection.name === 'X Workspace') connection.name = 'Xingular Workspace'
|
|
196
|
-
if (choices) {
|
|
197
|
-
const id = connectionCapabilityId(connection.id)
|
|
198
|
-
const hasChoice = choices.global.on.includes(id) || choices.global.off.includes(id)
|
|
199
|
-
|| Object.values(choices.agents).some((entry) => entry.on.includes(id) || entry.off.includes(id))
|
|
200
|
-
|| Object.values(choices.projects).some((entry) => entry.on.includes(id) || entry.off.includes(id))
|
|
201
|
-
// Before the first successful root open, keep old records readable. After migration the
|
|
202
|
-
// returned fields are a view over attachments; they are never written back to connections.json.
|
|
203
|
-
if (hasChoice || !(connection.global || connection.agentIds.length || connection.projectIds.length || connection.excludedAgentIds.length || connection.excludedProjectIds.length)) {
|
|
204
|
-
const attachment = attachments.describe(choices, id, connection.global)
|
|
205
|
-
connection.global = attachment.global
|
|
206
|
-
connection.agentIds = attachment.on.agentIds
|
|
207
|
-
connection.projectIds = attachment.on.projectIds
|
|
208
|
-
connection.excludedAgentIds = attachment.off.agentIds
|
|
209
|
-
connection.excludedProjectIds = attachment.off.projectIds
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
return [connection]
|
|
213
|
-
})
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
find(id: string): Connection {
|
|
217
|
-
const connection = this.list().find((item) => item.id === id)
|
|
218
|
-
if (!connection) throw notFound('Connection')
|
|
219
|
-
return connection
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
forScope(scope: Scope): Connection[] {
|
|
223
|
-
return this.list().filter((connection) => allowed(connection, scope))
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
revision(): unknown[] {
|
|
227
|
-
return revisionOf(this.list())
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
private write(all: Connection[]): void {
|
|
231
|
-
const root = this.attachmentRoot()
|
|
232
|
-
let stored: Connection[] | Omit<Connection, 'global' | 'agentIds' | 'projectIds' | 'excludedAgentIds' | 'excludedProjectIds'>[] = all
|
|
233
|
-
if (root && connectionScopeMigrationComplete(root)) {
|
|
234
|
-
stored = all.map(({ global: _global, agentIds: _agentIds, projectIds: _projectIds, excludedAgentIds: _excludedAgentIds, excludedProjectIds: _excludedProjectIds, ...connection }) => connection)
|
|
235
|
-
} else if (root) {
|
|
236
|
-
// A non-scope edit is allowed while migration is pending, but its legacy scopes must stay
|
|
237
|
-
// in connections.json until the attachment store has been verified.
|
|
238
|
-
const previous = new Map<string, Connection>()
|
|
239
|
-
for (const item of readJson<unknown[]>(this.path) ?? []) {
|
|
240
|
-
const parsed = connectionSchema.safeParse(item)
|
|
241
|
-
if (parsed.success) previous.set(parsed.data.id, parsed.data)
|
|
242
|
-
}
|
|
243
|
-
stored = all.map((connection) => {
|
|
244
|
-
const legacy = previous.get(connection.id)
|
|
245
|
-
return legacy ? {
|
|
246
|
-
...connection,
|
|
247
|
-
global: legacy.global,
|
|
248
|
-
agentIds: legacy.agentIds,
|
|
249
|
-
projectIds: legacy.projectIds,
|
|
250
|
-
excludedAgentIds: legacy.excludedAgentIds,
|
|
251
|
-
excludedProjectIds: legacy.excludedProjectIds
|
|
252
|
-
} : connection
|
|
253
|
-
})
|
|
254
|
-
}
|
|
255
|
-
writeJson(this.path, stored)
|
|
256
|
-
try {
|
|
257
|
-
chmodSync(this.path, 0o600)
|
|
258
|
-
} catch {
|
|
259
|
-
// The file was written; a mode that cannot be set is not worth failing the change.
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
private writeScope(root: string, connection: Connection): void {
|
|
264
|
-
const choices = attachments.load(root)
|
|
265
|
-
const id = connectionCapabilityId(connection.id)
|
|
266
|
-
attachments.forgetId(choices, id)
|
|
267
|
-
attachments.set(choices, [id], {}, connection.global, false)
|
|
268
|
-
for (const agentId of new Set([...connection.agentIds, ...connection.excludedAgentIds])) {
|
|
269
|
-
const on = connection.agentIds.includes(agentId) && !connection.excludedAgentIds.includes(agentId)
|
|
270
|
-
attachments.set(choices, [id], { agentId }, on, connection.global)
|
|
271
|
-
}
|
|
272
|
-
for (const projectId of new Set([...connection.projectIds, ...connection.excludedProjectIds])) {
|
|
273
|
-
const on = connection.projectIds.includes(projectId) && !connection.excludedProjectIds.includes(projectId)
|
|
274
|
-
attachments.set(choices, [id], { projectId }, on, connection.global)
|
|
275
|
-
}
|
|
276
|
-
attachments.save(root, choices)
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
changed(): void {
|
|
280
|
-
this.bus.emit({ type: 'connections.changed' })
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
/** Read-modify-write of one connection. */
|
|
284
|
-
update(id: string, change: (connection: Connection) => void): Connection {
|
|
285
|
-
const all = this.list()
|
|
286
|
-
const connection = all.find((item) => item.id === id)
|
|
287
|
-
if (!connection) throw notFound('Connection')
|
|
288
|
-
const before = { ...connection, agentIds: [...connection.agentIds], projectIds: [...connection.projectIds], excludedAgentIds: [...connection.excludedAgentIds], excludedProjectIds: [...connection.excludedProjectIds] }
|
|
289
|
-
change(connection)
|
|
290
|
-
const root = this.attachmentRoot()
|
|
291
|
-
if (root && !connectionScopeMigrationComplete(root) && !sameScope(before, connection)) throw scopeMigrationError()
|
|
292
|
-
this.write(all)
|
|
293
|
-
return connection
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
/** Read-modify-write of every connection. */
|
|
297
|
-
updateAll(change: (all: Connection[]) => void): void {
|
|
298
|
-
const all = this.list()
|
|
299
|
-
const before = new Map<string, Connection>(all.map((connection): [string, Connection] => [connection.id, {
|
|
300
|
-
...connection,
|
|
301
|
-
agentIds: [...connection.agentIds],
|
|
302
|
-
projectIds: [...connection.projectIds],
|
|
303
|
-
excludedAgentIds: [...connection.excludedAgentIds],
|
|
304
|
-
excludedProjectIds: [...connection.excludedProjectIds]
|
|
305
|
-
}]))
|
|
306
|
-
change(all)
|
|
307
|
-
const root = this.attachmentRoot()
|
|
308
|
-
if (root && !connectionScopeMigrationComplete(root)) {
|
|
309
|
-
const remainingIds = new Set(all.map((connection) => connection.id))
|
|
310
|
-
const scopeChanged = all.some((connection) => {
|
|
311
|
-
const previous = before.get(connection.id)
|
|
312
|
-
return previous ? !sameScope(previous, connection) : hasScope(connection)
|
|
313
|
-
}) || [...before].some(([id, connection]) => !remainingIds.has(id) && hasScope(connection))
|
|
314
|
-
if (scopeChanged) throw scopeMigrationError()
|
|
315
|
-
}
|
|
316
|
-
this.write(all)
|
|
317
|
-
this.changed()
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
/** Switches one connector in the shared attachment store, preserving all other scopes. */
|
|
321
|
-
setScope(connectionId: string, scope: Scope, on: boolean): Connection[] {
|
|
322
|
-
const connection = this.find(connectionId)
|
|
323
|
-
const root = this.attachmentRoot()
|
|
324
|
-
if (root && !connectionScopeMigrationComplete(root)) throw scopeMigrationError()
|
|
325
|
-
if (!root) {
|
|
326
|
-
this.update(connectionId, (item) => setScope(item, scope, on))
|
|
327
|
-
this.changed()
|
|
328
|
-
return this.forScope(scope)
|
|
329
|
-
}
|
|
330
|
-
const choices = attachments.load(root)
|
|
331
|
-
const fallback = connection.global
|
|
332
|
-
attachments.set(choices, [connectionCapabilityId(connectionId)], scope, on, fallback)
|
|
333
|
-
attachments.save(root, choices)
|
|
334
|
-
this.changed()
|
|
335
|
-
return this.forScope(scope)
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
/** Gives one agent an exact connector set without changing project or global choices. */
|
|
339
|
-
setAgentScope(agentId: string, ids: readonly string[]): Connection[] {
|
|
340
|
-
const all = this.list()
|
|
341
|
-
const root = this.attachmentRoot()
|
|
342
|
-
if (root && !connectionScopeMigrationComplete(root)) throw scopeMigrationError()
|
|
343
|
-
if (!root) {
|
|
344
|
-
setAgentScope(all, agentId, ids)
|
|
345
|
-
this.write(all)
|
|
346
|
-
this.changed()
|
|
347
|
-
return this.forScope({ agentId })
|
|
348
|
-
}
|
|
349
|
-
const choices = attachments.load(root)
|
|
350
|
-
for (const connection of all) {
|
|
351
|
-
attachments.set(choices, [connectionCapabilityId(connection.id)], { agentId }, ids.includes(connection.id), connection.global)
|
|
352
|
-
}
|
|
353
|
-
attachments.save(root, choices)
|
|
354
|
-
this.changed()
|
|
355
|
-
return this.forScope({ agentId })
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
/** Removes only connector choices when an agent is deleted; other capability choices are separate. */
|
|
359
|
-
removeAgentScope(agentId: string): void {
|
|
360
|
-
const root = this.attachmentRoot()
|
|
361
|
-
// This is cleanup for a deleted caller. Leave stale ids inert until migration can safely
|
|
362
|
-
// move the remaining scopes; failing helper cleanup must not leave an orphan agent behind.
|
|
363
|
-
if (root && !connectionScopeMigrationComplete(root)) return
|
|
364
|
-
if (!root) {
|
|
365
|
-
this.updateAll((all) => {
|
|
366
|
-
for (const connection of all) {
|
|
367
|
-
connection.agentIds = connection.agentIds.filter((id) => id !== agentId)
|
|
368
|
-
connection.excludedAgentIds = connection.excludedAgentIds.filter((id) => id !== agentId)
|
|
369
|
-
}
|
|
370
|
-
})
|
|
371
|
-
return
|
|
372
|
-
}
|
|
373
|
-
const choices = attachments.load(root)
|
|
374
|
-
const entry = choices.agents[agentId]
|
|
375
|
-
if (!entry) return
|
|
376
|
-
const isConnector = (id: string): boolean => id.startsWith('connected-apps/connection/')
|
|
377
|
-
entry.on = entry.on.filter((id) => !isConnector(id))
|
|
378
|
-
entry.off = entry.off.filter((id) => !isConnector(id))
|
|
379
|
-
if (!entry.on.length && !entry.off.length) delete choices.agents[agentId]
|
|
380
|
-
attachments.save(root, choices)
|
|
381
|
-
this.changed()
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
private secret(connectionId: string, name: string): Promise<string | null> {
|
|
385
|
-
return this.secrets.get(secretKey(`mcp--${connectionId}`, name))
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
private setSecret(connectionId: string, name: string, value: string): Promise<void> {
|
|
389
|
-
return this.secrets.set(secretKey(`mcp--${connectionId}`, name), value)
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
private deleteSecret(connectionId: string, name: string): Promise<void> {
|
|
393
|
-
return this.secrets.delete(secretKey(`mcp--${connectionId}`, name))
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
/** Everything the secret store holds for a connection: environment and header values, and OAuth credentials. */
|
|
397
|
-
private async secretValues(connection: Connection): Promise<string[]> {
|
|
398
|
-
const values: string[] = []
|
|
399
|
-
for (const key of connection.envKeys) {
|
|
400
|
-
const value = await this.secret(connection.id, key)
|
|
401
|
-
if (value) values.push(value)
|
|
402
|
-
}
|
|
403
|
-
for (const key of connection.headerKeys) {
|
|
404
|
-
const value = await this.secret(connection.id, headerItem(key))
|
|
405
|
-
if (!value) continue
|
|
406
|
-
// "Authorization: Bearer <key>" must not leak the key on its own either.
|
|
407
|
-
const space = value.indexOf(' ')
|
|
408
|
-
if (space >= 0) values.push(value.slice(space + 1).trim())
|
|
409
|
-
values.push(value)
|
|
410
|
-
}
|
|
411
|
-
if (connection.auth === 'oauth') {
|
|
412
|
-
const client = await this.secret(connection.id, OAUTH_CLIENT_SECRET)
|
|
413
|
-
if (client) values.push(client)
|
|
414
|
-
const saved = (parsedContainer((await this.secret(connection.id, OAUTH_STATE)) ?? '') ?? {}) as { tokens?: Record<string, unknown> }
|
|
415
|
-
for (const field of ['access_token', 'refresh_token', 'id_token']) if (typeof saved.tokens?.[field] === 'string') values.push(saved.tokens[field] as string)
|
|
416
|
-
}
|
|
417
|
-
return values.filter(Boolean)
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
/** Reloads the secret values used for redaction. Called at start and whenever a connection's secrets change. */
|
|
421
|
-
async refreshSecrets(): Promise<void> {
|
|
422
|
-
const next = new Map<string, string[]>()
|
|
423
|
-
for (const connection of this.list()) next.set(connection.id, await this.secretValues(connection).catch(() => []))
|
|
424
|
-
this.known.clear()
|
|
425
|
-
for (const [id, values] of next) this.known.set(id, values)
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
/** A connection's result, safe to persist. */
|
|
429
|
-
scrub(value: unknown, connectionId: string): unknown {
|
|
430
|
-
return scrubWith(value, this.known.get(connectionId) ?? [])
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
/** Removes credentials from the evidence a run event carries. */
|
|
434
|
-
redactEvent(event: RunEvent): void {
|
|
435
|
-
if (!event.type.startsWith('tool.') && !['context.snapshot', 'retry.started', 'retry.ended', 'compaction.started', 'compaction.ended'].includes(event.type)) return
|
|
436
|
-
const secrets = [...this.known.values()].flat()
|
|
437
|
-
event.payload = scrubWith(event.payload, secrets)
|
|
438
|
-
if (event.native !== undefined) event.native = scrubWith(event.native, secrets)
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
// ---- Launching ----------------------------------------------------------------------------
|
|
442
|
-
|
|
443
|
-
async launch(connection: Connection): Promise<LaunchConfig> {
|
|
444
|
-
if (connection.kind === 'remote') {
|
|
445
|
-
const headers: Record<string, string> = {}
|
|
446
|
-
for (const key of connection.headerKeys) {
|
|
447
|
-
const value = await this.secret(connection.id, headerItem(key))
|
|
448
|
-
if (value !== null) headers[key] = value
|
|
449
|
-
}
|
|
450
|
-
return { id: connection.id, name: connection.name, transport: 'http', url: connection.url ?? '', headers, auth: connection.auth as 'none' | 'headers' | 'oauth', scopes: connection.oauthScopes }
|
|
451
|
-
}
|
|
452
|
-
let command = findBinary(connection.command) ?? (isAbsolute(connection.command) ? connection.command : null)
|
|
453
|
-
if (!command) throw new HarnessError('mcp_unavailable', 'MCP executable was not found. Select its absolute path.')
|
|
454
|
-
const env: Record<string, string> = { [pathVariableName(process.env)]: searchPath() }
|
|
455
|
-
for (const key of ['HOME', 'TMPDIR', 'LANG']) if (process.env[key]) env[key] = process.env[key]!
|
|
456
|
-
for (const key of connection.envKeys) {
|
|
457
|
-
const value = await this.secret(connection.id, key)
|
|
458
|
-
if (value !== null) env[key] = value
|
|
459
|
-
}
|
|
460
|
-
const args = [...connection.args]
|
|
461
|
-
if (connection.kind === 'workspace') {
|
|
462
|
-
// The first-party launcher is JavaScript; run it on this process's Node even where none is on PATH.
|
|
463
|
-
args.unshift(command)
|
|
464
|
-
command = process.execPath
|
|
465
|
-
if (connection.expectedVaultId && !args.includes('--expected-vault-id')) args.push('--expected-vault-id', connection.expectedVaultId)
|
|
466
|
-
}
|
|
467
|
-
return { id: connection.id, name: connection.name, transport: 'stdio', command, args, cwd: connection.cwd, env }
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
// ---- OAuth state --------------------------------------------------------------------------
|
|
471
|
-
|
|
472
|
-
private requireOauth(id: string): Connection {
|
|
473
|
-
const connection = this.list().find((item) => item.id === id && item.kind === 'remote' && item.auth === 'oauth')
|
|
474
|
-
if (!connection) throw notFound('Connection')
|
|
475
|
-
return connection
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
/** The saved sign-in of a connection, with the client the user registered, or the application's own. */
|
|
479
|
-
async oauthLoad(id: string): Promise<Record<string, unknown>> {
|
|
480
|
-
const connection = this.requireOauth(id)
|
|
481
|
-
const saved = (parsedContainer((await this.secret(id, OAUTH_STATE)) ?? '') ?? {}) as Record<string, unknown>
|
|
482
|
-
const state = Array.isArray(saved) ? {} : saved
|
|
483
|
-
delete state.staticClient
|
|
484
|
-
if (connection.oauthClient === 'app') {
|
|
485
|
-
const client = await this.appClient(connection)
|
|
486
|
-
if (client) state.staticClient = { client_id: client.clientId, ...(client.clientSecret ? { client_secret: client.clientSecret } : {}) }
|
|
487
|
-
} else if (connection.oauthClient === 'user' || connection.oauthClient === null) {
|
|
488
|
-
const clientId = await this.secret(id, OAUTH_CLIENT_ID)
|
|
489
|
-
if (clientId) {
|
|
490
|
-
const clientSecret = await this.secret(id, OAUTH_CLIENT_SECRET)
|
|
491
|
-
state.staticClient = { client_id: clientId, ...(clientSecret ? { client_secret: clientSecret } : {}) }
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
return state
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
/** The client this application registered for a catalog entry, if it has one. */
|
|
498
|
-
private async appClient(connection: Connection): Promise<{ clientId: string; clientSecret?: string } | null> {
|
|
499
|
-
if (!connection.catalogId) return null
|
|
500
|
-
return (await this.appClients?.get(connection.catalogId)) ?? null
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
/** Whether a sign-in can be started: a dynamic server registers itself, the others need a client. */
|
|
504
|
-
async hasSignInClient(connection: Connection): Promise<boolean> {
|
|
505
|
-
if (connection.oauthClient === 'user') return (await this.secret(connection.id, OAUTH_CLIENT_ID)) !== null
|
|
506
|
-
if (connection.oauthClient === 'app') return (await this.appClient(connection)) !== null
|
|
507
|
-
return true
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
/** The catalog entries this application can sign in for without asking for a client. */
|
|
511
|
-
availableAppClients(): string[] {
|
|
512
|
-
return this.appClients?.ids() ?? []
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
async oauthSave(id: string, state: Record<string, unknown>): Promise<void> {
|
|
516
|
-
this.requireOauth(id)
|
|
517
|
-
const { staticClient: _static, ...saved } = state ?? {}
|
|
518
|
-
await this.setSecret(id, OAUTH_STATE, JSON.stringify(saved))
|
|
519
|
-
await this.refreshSecrets()
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
async hasOauthClient(id: string): Promise<boolean> {
|
|
523
|
-
return (await this.secret(id, OAUTH_CLIENT_ID)) !== null
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
private forgetSignIn(id: string): Promise<void> {
|
|
527
|
-
return this.deleteSecret(id, OAUTH_STATE)
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
// ---- Changes ------------------------------------------------------------------------------
|
|
531
|
-
|
|
532
|
-
async save(input: ConnectionInput): Promise<Connection> {
|
|
533
|
-
const parsed = connectionInputSchema.safeParse(input)
|
|
534
|
-
if (!parsed.success) throw invalid('A name, executable, and supported connection kind are required.')
|
|
535
|
-
const { env, removeEnv, headers, removeHeaders, oauthCredentials, ...connection } = parsed.data
|
|
536
|
-
if (!connection.id) connection.id = newId()
|
|
537
|
-
safeId(connection.id)
|
|
538
|
-
const remote = connection.kind === 'remote'
|
|
539
|
-
if (!connection.name.trim() || !['workspace', 'local', 'remote'].includes(connection.kind) || (!remote && !connection.command.trim())) {
|
|
540
|
-
throw invalid('A name, executable, and supported connection kind are required.')
|
|
541
|
-
}
|
|
542
|
-
if (remote) {
|
|
543
|
-
if (!webUrl(connection.url)) throw invalid('Server URL must be an https:// address.')
|
|
544
|
-
if (!['none', 'headers', 'oauth'].includes(connection.auth)) throw invalid('Unsupported sign-in method.')
|
|
545
|
-
if (connection.oauthClient && !['dynamic', 'user', 'app'].includes(connection.oauthClient)) throw invalid('Unsupported OAuth client.')
|
|
546
|
-
Object.assign(connection, { command: '', args: [], cwd: null })
|
|
547
|
-
if (connection.auth !== 'oauth') Object.assign(connection, { oauthClient: null, oauthScopes: [] })
|
|
548
|
-
} else {
|
|
549
|
-
Object.assign(connection, { url: null, auth: 'none', oauthClient: null, oauthScopes: [] })
|
|
550
|
-
}
|
|
551
|
-
if (connection.args.some((value) => value.includes('\0')) || connection.command.includes('\0')) throw invalid('Invalid executable or argument.')
|
|
552
|
-
if (connection.cwd && (!isAbsolute(connection.cwd) || !isDir(connection.cwd))) throw invalid('Working directory must be an existing absolute directory.')
|
|
553
|
-
|
|
554
|
-
const all = this.list()
|
|
555
|
-
const existing = all.find((item) => item.id === connection.id)
|
|
556
|
-
const root = this.attachmentRoot()
|
|
557
|
-
if (root && !connectionScopeMigrationComplete(root) && (existing ? !sameScope(existing, connection) : hasScope(connection))) {
|
|
558
|
-
throw scopeMigrationError()
|
|
559
|
-
}
|
|
560
|
-
connection.envKeys = [...(existing?.envKeys ?? [])]
|
|
561
|
-
connection.headerKeys = [...(existing?.headerKeys ?? [])]
|
|
562
|
-
// A sign-in belongs to one server and one client; never carry it to another.
|
|
563
|
-
const sameServer = (existing?.url ?? null) === connection.url && (existing?.auth ?? '') === connection.auth && existing?.oauthClient === connection.oauthClient && existing?.catalogId === connection.catalogId && !oauthCredentials
|
|
564
|
-
if (!sameServer || connection.auth !== 'oauth') await this.forgetSignIn(connection.id)
|
|
565
|
-
connection.authState = connection.auth === 'oauth' ? (sameServer ? (existing?.authState ?? 'signed_out') : 'signed_out') : null
|
|
566
|
-
if (oauthCredentials) {
|
|
567
|
-
if (!oauthCredentials.clientId.trim()) throw invalid('An OAuth client ID is required.')
|
|
568
|
-
await this.setSecret(connection.id, OAUTH_CLIENT_ID, oauthCredentials.clientId.trim())
|
|
569
|
-
if (oauthCredentials.clientSecret) await this.setSecret(connection.id, OAUTH_CLIENT_SECRET, oauthCredentials.clientSecret)
|
|
570
|
-
else await this.deleteSecret(connection.id, OAUTH_CLIENT_SECRET)
|
|
571
|
-
}
|
|
572
|
-
for (const [key, value] of Object.entries(headers ?? {})) {
|
|
573
|
-
if (!/^[A-Za-z0-9_-]+$/.test(key) || /[\r\n\0]/.test(value)) throw invalid('Invalid header name or value.')
|
|
574
|
-
await this.setSecret(connection.id, headerItem(key), value)
|
|
575
|
-
if (!connection.headerKeys.includes(key)) connection.headerKeys.push(key)
|
|
576
|
-
}
|
|
577
|
-
for (const key of removeHeaders ?? []) {
|
|
578
|
-
await this.deleteSecret(connection.id, headerItem(key))
|
|
579
|
-
connection.headerKeys = connection.headerKeys.filter((value) => value !== key)
|
|
580
|
-
}
|
|
581
|
-
for (const [key, value] of Object.entries(env ?? {})) {
|
|
582
|
-
if (!/^[A-Za-z0-9_]+$/.test(key)) throw invalid('Invalid environment variable name.')
|
|
583
|
-
await this.setSecret(connection.id, key, value)
|
|
584
|
-
if (!connection.envKeys.includes(key)) connection.envKeys.push(key)
|
|
585
|
-
}
|
|
586
|
-
for (const key of removeEnv ?? []) {
|
|
587
|
-
await this.deleteSecret(connection.id, key)
|
|
588
|
-
connection.envKeys = connection.envKeys.filter((value) => value !== key)
|
|
589
|
-
}
|
|
590
|
-
Object.assign(connection, { checkedAt: null, tools: [], serverName: null, error: null })
|
|
591
|
-
if (root && connectionScopeMigrationComplete(root)) this.writeScope(root, connection as Connection)
|
|
592
|
-
this.write([...all.filter((item) => item.id !== connection.id), connection])
|
|
593
|
-
await this.refreshSecrets()
|
|
594
|
-
this.changed()
|
|
595
|
-
return connection
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
/**
|
|
599
|
-
* Adds one tool to a connection's no-approval list. Unlike a full save this keeps the
|
|
600
|
-
* connection's pending approvals, so the request the user is answering can still be approved.
|
|
601
|
-
*/
|
|
602
|
-
allowTool(connectionId: string, tool: string): Connection {
|
|
603
|
-
if (!tool.trim()) throw invalid('A tool is required.')
|
|
604
|
-
if (this.list().some((item) => item.id === connectionId && item.kind === 'workspace')) throw invalid('Changes to Xingular Workspace are approved one at a time.')
|
|
605
|
-
const connection = this.update(connectionId, (item) => {
|
|
606
|
-
if (!item.readTools.includes(tool)) item.readTools.push(tool)
|
|
607
|
-
})
|
|
608
|
-
this.changed()
|
|
609
|
-
return connection
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
async remove(connectionId: string): Promise<void> {
|
|
613
|
-
const all = this.list()
|
|
614
|
-
const connection = all.find((item) => item.id === connectionId)
|
|
615
|
-
if (connection) {
|
|
616
|
-
for (const key of connection.envKeys) await this.deleteSecret(connection.id, key)
|
|
617
|
-
for (const key of connection.headerKeys) await this.deleteSecret(connection.id, headerItem(key))
|
|
618
|
-
for (const name of [OAUTH_STATE, OAUTH_CLIENT_ID, OAUTH_CLIENT_SECRET]) await this.deleteSecret(connection.id, name)
|
|
619
|
-
}
|
|
620
|
-
this.write(all.filter((item) => item.id !== connectionId))
|
|
621
|
-
const root = this.attachmentRoot()
|
|
622
|
-
if (root) {
|
|
623
|
-
const choices = attachments.load(root)
|
|
624
|
-
attachments.forgetId(choices, connectionCapabilityId(connectionId))
|
|
625
|
-
attachments.save(root, choices)
|
|
626
|
-
}
|
|
627
|
-
this.known.delete(connectionId)
|
|
628
|
-
this.changed()
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
async signOut(connectionId: string): Promise<Connection> {
|
|
632
|
-
await this.forgetSignIn(connectionId)
|
|
633
|
-
const connection = this.update(connectionId, (item) => {
|
|
634
|
-
if (item.auth === 'oauth') item.authState = 'signed_out'
|
|
635
|
-
Object.assign(item, { checkedAt: null, tools: [], error: null })
|
|
636
|
-
})
|
|
637
|
-
await this.refreshSecrets()
|
|
638
|
-
this.changed()
|
|
639
|
-
return connection
|
|
640
|
-
}
|
|
641
|
-
}
|