@wrongstack/core 0.270.0 → 0.272.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agent-bridge-PcHQl_UQ.d.ts → agent-bridge-DFQYEeXf.d.ts} +1 -1
- package/dist/{agent-subagent-runner-SHJW7t8q.d.ts → agent-subagent-runner-BZa_IEcd.d.ts} +7 -7
- package/dist/{brain-BYcK__Ym.d.ts → brain-etbcbRwV.d.ts} +95 -2
- package/dist/{compactor-C2RKEBtC.d.ts → compactor-72ug-ZRB.d.ts} +1 -1
- package/dist/{config-C_ae2k86.d.ts → config-rRS8yorV.d.ts} +71 -2
- package/dist/{context-Dp87Bcaq.d.ts → context-Dw55zZ_Q.d.ts} +110 -1
- package/dist/coordination/index.d.ts +181 -17
- package/dist/coordination/index.js +1018 -166
- package/dist/coordination/index.js.map +1 -1
- package/dist/defaults/index.d.ts +25 -25
- package/dist/defaults/index.js +804 -222
- package/dist/defaults/index.js.map +1 -1
- package/dist/execution/index.d.ts +23 -18
- package/dist/execution/index.js +136 -41
- package/dist/execution/index.js.map +1 -1
- package/dist/execution/prompt-enhancer.d.ts +36 -6
- package/dist/execution/prompt-enhancer.js +35 -9
- package/dist/execution/prompt-enhancer.js.map +1 -1
- package/dist/extension/index.d.ts +6 -6
- package/dist/{global-mailbox-Bvrz1P3f.d.ts → global-mailbox-DJ4EoRr0.d.ts} +145 -5
- package/dist/{goal-preamble-CA_4yiGQ.d.ts → goal-preamble-hM8BH7TK.d.ts} +9 -9
- package/dist/{goal-store-DhuJoUNG.d.ts → goal-store-CWlbT0TO.d.ts} +1 -1
- package/dist/hq/index.d.ts +95 -6
- package/dist/hq/index.js +628 -50
- package/dist/hq/index.js.map +1 -1
- package/dist/{index-whDfTANu.d.ts → index-2Lhk5v0o.d.ts} +2 -2
- package/dist/{index-W4VJCzHa.d.ts → index-DWm_PE9L.d.ts} +5 -5
- package/dist/{index-CZQ6Pwbs.d.ts → index-DqW4o62H.d.ts} +8 -8
- package/dist/index.d.ts +96 -56
- package/dist/index.js +2464 -519
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/index.d.ts +6 -6
- package/dist/infrastructure/index.js +5 -3
- package/dist/infrastructure/index.js.map +1 -1
- package/dist/kernel/index.d.ts +9 -9
- package/dist/kernel/index.js.map +1 -1
- package/dist/{mcp-servers-DJdZiRcv.d.ts → mcp-servers-BpWHTKlE.d.ts} +3 -3
- package/dist/models/index.d.ts +5 -5
- package/dist/models/index.js +28 -5
- package/dist/models/index.js.map +1 -1
- package/dist/{models-registry-C3a-2-Yd.d.ts → models-registry-CXQFUn5t.d.ts} +1 -1
- package/dist/{multi-agent-coordinator-CJSpTe5O.d.ts → multi-agent-coordinator-jyimfo7D.d.ts} +1 -1
- package/dist/{null-fleet-bus-QVshIsDx.d.ts → null-fleet-bus-DOGQcvrY.d.ts} +6 -6
- package/dist/observability/index.d.ts +2 -2
- package/dist/{parallel-eternal-engine-D9y5Pkcc.d.ts → parallel-eternal-engine-rItJBYp9.d.ts} +9 -9
- package/dist/{path-resolver-CnQ8SIfh.d.ts → path-resolver-DrpF5MGK.d.ts} +3 -3
- package/dist/{permission-CvYQNUqZ.d.ts → permission-CC7XFYWG.d.ts} +1 -1
- package/dist/{permission-policy-D5Ss8j4B.d.ts → permission-policy-cYR4RJmw.d.ts} +2 -2
- package/dist/{pipeline-l_zzFRh3.d.ts → pipeline-Ckkn3AOA.d.ts} +2 -2
- package/dist/{plan-templates-NtPgyeJA.d.ts → plan-templates-BvHw5Znw.d.ts} +33 -9
- package/dist/{provider-model-resolve-d5poT5y0.d.ts → provider-model-resolve-nZqnCeaR.d.ts} +3 -3
- package/dist/{provider-runner-gkctlQV_.d.ts → provider-runner-zVOn1p67.d.ts} +3 -3
- package/dist/{retry-policy-CtFhfwa8.d.ts → retry-policy-BV7nzeAd.d.ts} +1 -1
- package/dist/sdd/index.d.ts +8 -8
- package/dist/sdd/index.js +2 -0
- package/dist/sdd/index.js.map +1 -1
- package/dist/{secret-vault-BLsVmTIK.d.ts → secret-vault-eMBKfheR.d.ts} +9 -1
- package/dist/security/index.d.ts +5 -5
- package/dist/security/index.js +137 -10
- package/dist/security/index.js.map +1 -1
- package/dist/{selector-CXl2_y9W.d.ts → selector-C4ORTOid.d.ts} +1 -1
- package/dist/{session-event-bridge-Ccud20CC.d.ts → session-event-bridge-CeNpUL9w.d.ts} +1 -1
- package/dist/{session-reader-ZeXQmsmE.d.ts → session-reader-BepLSnGL.d.ts} +1 -1
- package/dist/storage/index.d.ts +50 -13
- package/dist/storage/index.js +620 -220
- package/dist/storage/index.js.map +1 -1
- package/dist/tools/index.d.ts +2 -2
- package/dist/tools/index.js +9 -2
- package/dist/tools/index.js.map +1 -1
- package/dist/types/index.d.ts +19 -19
- package/dist/types/index.js +202 -41
- package/dist/types/index.js.map +1 -1
- package/dist/utils/index.d.ts +17 -4
- package/dist/utils/index.js +48 -9
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
package/dist/tools/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as Tool } from '../context-
|
|
2
|
-
import { c as MCPServerConfig, i as Config } from '../config-
|
|
1
|
+
import { T as Tool } from '../context-Dw55zZ_Q.js';
|
|
2
|
+
import { c as MCPServerConfig, i as Config } from '../config-rRS8yorV.js';
|
|
3
3
|
import '../dispatcher-types.d-BBeXBQgS.js';
|
|
4
4
|
import 'node:https';
|
|
5
5
|
import 'undici';
|
package/dist/tools/index.js
CHANGED
|
@@ -321,11 +321,18 @@ function createMcpControlTool(opts) {
|
|
|
321
321
|
};
|
|
322
322
|
return {
|
|
323
323
|
name: "mcp_control",
|
|
324
|
-
description: "Manage MCP server lifecycle: list available servers, search by name or capability, enable or disable servers at runtime, restart running servers. Use activate/deactivate to ephemerally toggle tool registration without disconnecting \u2014 ideal for token-saving mode where MCP tools are lazy-loaded on demand.",
|
|
324
|
+
description: "Manage MCP server lifecycle: list available servers, search by name or capability, enable or disable servers at runtime, restart running servers. Use activate/deactivate to ephemerally toggle tool registration without disconnecting \u2014 ideal for token-saving mode where MCP tools are lazy-loaded on demand. NOTE: `enable`/`restart` start a server process, which for the built-in stdio presets runs `npx -y <package>` \u2014 i.e. it fetches and executes an npm package from the network. Treat it as code execution.",
|
|
325
325
|
category: "mcp",
|
|
326
326
|
permission: "auto",
|
|
327
327
|
mutating: true,
|
|
328
|
-
|
|
328
|
+
// `enable`/`restart` spawn a server process that, for the stdio presets,
|
|
329
|
+
// fetches and runs an npm package (`npx -y <pkg>`) — effectively remote
|
|
330
|
+
// code execution. Marking the tool destructive means the YOLO
|
|
331
|
+
// `confirmDestructive` safety net still prompts before it runs (plain
|
|
332
|
+
// non-YOLO already confirms via the CONFIG_MUTATE dangerous-capability
|
|
333
|
+
// net in the executor). Read-only actions (list/search) ride the same
|
|
334
|
+
// tool but are cheap to confirm/trust once.
|
|
335
|
+
riskTier: "destructive",
|
|
329
336
|
capabilities: [ToolCapabilities.CONFIG_MUTATE],
|
|
330
337
|
inputSchema,
|
|
331
338
|
async execute(raw) {
|
package/dist/tools/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/expect-defined.ts","../../src/utils/error.ts","../../src/security/capabilities.ts","../../src/infrastructure/mcp-servers.ts","../../src/utils/atomic-write.ts","../../src/utils/config-json.ts","../../src/tools/mcp-control.ts"],"names":["stat","fs2","path"],"mappings":";;;;;AAIO,SAAS,aAAA,CAAiB,OAA6B,KAAA,EAAmB;AAC/E,EAAA,IAAI,KAAA,KAAU,IAAA,IAAQ,KAAA,KAAU,MAAA,EAAW;AACzC,IAAA,MAAM,MAAM,IAAI,KAAA,CAAkD,8BAA8B,CAAA;AAChG,IAAA,GAAA,CAAI,IAAA,GAAO,oBAAA;AACX,IAAA,MAAM,GAAA;AAAA,EACR;AACA,EAAA,OAAO,KAAA;AACT;;;ACPO,SAAS,eAAe,GAAA,EAAsB;AACnD,EAAA,OAAO,GAAA,Y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,EAAA,OAAO,IAAA,CAAK,SAAA,EAAU,CAAE,UAAA,IAAc,EAAC;AACzC;AAEA,SAAS,kBAAkB,KAAA,EAA0D;AACnF,EAAA,OAAO,CAAC,CAAC,KAAA,IAAS,OAAO,UAAU,QAAA,IAAY,CAAC,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA;AACrE;AAIA,SAAS,KAAK,CAAA,EAAY;AAAE,EAAA,OAAO,UAAU,CAAC,CAAA,OAAA,CAAA;AAAW;AACzD,SAAS,IAAI,CAAA,EAAY;AAAE,EAAA,OAAO,UAAU,CAAC,CAAA,OAAA,CAAA;AAAW;AACxD,SAAS,MAAM,CAAA,EAAW;AAAE,EAAA,OAAO,WAAW,CAAC,CAAA,OAAA,CAAA;AAAW;AAC1D,SAAS,OAAO,CAAA,EAAU;AAAE,EAAA,OAAO,WAAW,CAAC,CAAA,OAAA,CAAA;AAAW;AAC1D,SAAS,IAAI,CAAA,EAAa;AAAE,EAAA,OAAO,WAAW,CAAC,CAAA,OAAA,CAAA;AAAW;AAE1D,SAAS,MAAM,KAAA,EAAuB;AACpC,EAAA,QAAQ,KAAA;AAAO,IACb,KAAK,WAAA;AAAgB,MAAA,OAAO,MAAM,kBAAa,CAAA;AAAA,IAC/C,KAAK,YAAA;AAAgB,MAAA,OAAO,CAAA,gCAAA,CAAA;AAAA,IAC5B,KAAK,cAAA;AAAgB,MAAA,OAAO,CAAA,kCAAA,CAAA;AAAA,IAC5B,KAAK,cAAA;AAAgB,MAAA,OAAO,IAAI,qBAAgB,CAAA;AAAA,IAChD,KAAK,QAAA;AAAgB,MAAA,OAAO,IAAI,eAAU,CAAA;AAAA,IAC1C;AAAoB,MAAA,OAAO,IAAI,KAAK,CAAA;AAAA;AAExC","file":"index.js","sourcesContent":["/** Assert a value is neither null nor undefined. Throws if it is.\n * Useful after optional chaining and indexed access when the\n * control flow guarantees the value exists but TypeScript can't\n * prove it (e.g. after a check on a related field). */\nexport function expectDefined<T>(value: T | null | undefined, label?: string): T {\n if (value === null || value === undefined) {\n const err = new Error(label ? `Expected ${label} to be defined` : 'Expected value to be defined');\n err.name = 'ExpectDefinedError';\n throw err;\n }\n return value;\n}\n","/**\n * Converts an unknown error value to a human-readable string.\n * Used in 40+ files across the codebase to normalize error messaging.\n */\nexport function toErrorMessage(err: unknown): string {\n return err instanceof Error ? err.message : String(err);\n}\n","/**\n * Well-known tool capabilities used for authorization decisions.\n *\n * These are the preferred values for `Tool.capabilities`.\n * New capabilities should be added here with clear documentation.\n *\n * Philosophy (2026-06+):\n * - Prefer capabilities over exact tool name matching.\n * - Subagent guards and future policies should primarily key off capabilities.\n * - Name-based denylists are legacy and will be phased down.\n */\nexport const ToolCapabilities = {\n /** Can execute arbitrary commands in the user's shell (the `bash` tool). */\n SHELL_ARBITRARY: 'shell.arbitrary',\n\n /** Can execute a restricted set of commands (the `exec` tool). */\n SHELL_RESTRICTED: 'shell.restricted',\n\n /** Can read files inside the project (and possibly outside via symlinks if not guarded). */\n FS_READ: 'fs.read',\n\n /** Can write / modify / delete files inside the project. */\n FS_WRITE: 'fs.write',\n\n /** Can write files outside the current project root (very high risk). */\n FS_WRITE_OUTSIDE_PROJECT: 'fs.write.outside-project',\n\n /** Can perform outbound network requests. */\n NET_OUTBOUND: 'net.outbound',\n\n /** Proxies tools from external MCP servers (unknown capability). */\n MCP_PROXY: 'mcp.proxy',\n\n /** Can spawn or manage subagents / multi-agent tasks. */\n SUBAGENT_SPAWN: 'subagent.spawn',\n\n /** Can mutate global or session configuration / trust state. */\n CONFIG_MUTATE: 'config.mutate',\n\n /** Can install packages or run package managers with side effects. */\n PACKAGE_INSTALL: 'package.install',\n} as const;\n\nexport type ToolCapability = (typeof ToolCapabilities)[keyof typeof ToolCapabilities];\n\n/**\n * Set of capabilities that are considered dangerous for subagents by default.\n * Subagents should not receive these capabilities unless the leader explicitly\n * allows the specific tool at spawn time.\n */\nexport const DANGEROUS_FOR_SUBAGENTS: readonly ToolCapability[] = [\n ToolCapabilities.SHELL_ARBITRARY,\n ToolCapabilities.SHELL_RESTRICTED,\n ToolCapabilities.FS_WRITE,\n ToolCapabilities.FS_WRITE_OUTSIDE_PROJECT,\n ToolCapabilities.MCP_PROXY,\n ToolCapabilities.SUBAGENT_SPAWN,\n ToolCapabilities.CONFIG_MUTATE,\n ToolCapabilities.PACKAGE_INSTALL,\n];\n\n/**\n * Wide capability allowlist for subagents that the user has authorized to act\n * with full developer power (the CLI fleet host applies this to any subagent\n * that isn't given an explicit, narrower grant). It covers everything needed to\n * do real work end-to-end — read, write/edit inside the project, outbound\n * network, and shell/build/install — so a delegated coding or build agent runs\n * the same toolchain the leader would, without per-tool confirmation it cannot\n * answer.\n *\n * Deliberately EXCLUDED (require an explicit per-spawn `allowedCapabilities`\n * grant, because they escape the task's blast radius rather than perform it):\n * - `fs.write.outside-project` — writing outside the repo (e.g. ~/.ssh).\n * - `mcp.proxy` — third-party MCP tools (also hard-blocked by name).\n * - `subagent.spawn` — recursive delegation (the baseline prompt forbids it).\n * - `config.mutate` — rewriting trust/config is privilege escalation, not work.\n */\nexport const WIDE_SUBAGENT_CAPABILITIES: readonly ToolCapability[] = [\n ToolCapabilities.FS_READ,\n ToolCapabilities.FS_WRITE,\n ToolCapabilities.NET_OUTBOUND,\n ToolCapabilities.SHELL_ARBITRARY,\n ToolCapabilities.SHELL_RESTRICTED,\n ToolCapabilities.PACKAGE_INSTALL,\n];\n\n/**\n * Check if a tool (or its capabilities array) includes any dangerous capability\n * for subagent execution.\n */\nexport function hasDangerousCapabilityForSubagents(\n toolOrCaps: { capabilities?: readonly string[] | undefined } | readonly string[] | undefined,\n): boolean {\n if (!toolOrCaps) return false;\n const input = toolOrCaps as never as { capabilities?: readonly string[] | undefined };\n const caps: readonly string[] = Array.isArray(toolOrCaps) ? toolOrCaps : (input.capabilities ?? []);\n return caps.some((c) => DANGEROUS_FOR_SUBAGENTS.includes(c as ToolCapability));\n}\n\n/**\n * Check if a tool declares a specific capability (or any of the provided ones).\n */\nexport function hasCapability(\n toolOrCaps: { capabilities?: readonly string[] | undefined } | readonly string[] | undefined,\n capability: ToolCapability | ToolCapability[],\n): boolean {\n if (!toolOrCaps) return false;\n const input = toolOrCaps as never as { capabilities?: readonly string[] | undefined };\n const caps: readonly string[] = Array.isArray(toolOrCaps) ? toolOrCaps : (input.capabilities ?? []);\n const toCheck = Array.isArray(capability) ? capability : [capability];\n return toCheck.some((c) => caps.includes(c));\n}\n\n/**\n * Returns the intersection of a tool's capabilities with the dangerous set.\n * Useful for logging and audit trails.\n */\nexport function getDangerousCapabilities(\n toolOrCaps: { capabilities?: readonly string[] | undefined } | readonly string[] | undefined,\n): ToolCapability[] {\n if (!toolOrCaps) return [];\n const input = toolOrCaps as never as { capabilities?: readonly string[] | undefined };\n const caps: readonly string[] = Array.isArray(toolOrCaps) ? toolOrCaps : (input.capabilities ?? []);\n return caps.filter((c): c is ToolCapability =>\n DANGEROUS_FOR_SUBAGENTS.includes(c as ToolCapability),\n );\n}\n","import type { MCPServerConfig } from '../types/config.js';\n\n/**\n * Built-in MCP server presets available to all WrongStack users out of the box.\n * These servers must be explicitly enabled in config (disabled by default).\n *\n * To enable: set `mcpServers: { serverName: { enabled: true } }` in your config.\n *\n * Some servers require environment variables or additional config — see notes below.\n *\n * Transport types:\n * stdio — spawns a local npm package binary via child_process\n * sse — HTTP SSE endpoint (client POSTs requests)\n * streamable-http — session-based HTTP with NDJSON responses\n */\n\n/** Filesystem access: read, write, list, search, tree. Good for exploring projects. */\nexport const filesystemServer = (): MCPServerConfig => ({\n name: 'filesystem',\n description: 'Read, write, and navigate the local filesystem (read-heavy tools)',\n transport: 'stdio',\n command: 'npx',\n args: ['-y', '@modelcontextprotocol/server-filesystem', '.'],\n permission: 'confirm',\n});\n\n/** GitHub API: issues, PRs, repos, search, file operations. Requires GITHUB_PERSONAL_ACCESS_TOKEN. */\nexport const githubServer = (): MCPServerConfig => ({\n name: 'github',\n description:\n 'GitHub API — issues, PRs, repos, search, file ops (requires GITHUB_PERSONAL_ACCESS_TOKEN)',\n transport: 'stdio',\n command: 'npx',\n args: ['-y', '@modelcontextprotocol/server-github'],\n permission: 'confirm',\n});\n\n/**\n * Context7 — codebase-aware documentation and Q&A using context from your code.\n * Live documentation for any library, grounded in your actual versions.\n */\nexport const context7Server = (): MCPServerConfig => ({\n name: 'context7',\n description: 'Codebase-aware documentation and Q&A (context7.ai)',\n transport: 'streamable-http',\n url: 'https://mcp.context7.com/mcp',\n permission: 'confirm',\n});\n\n/**\n * Brave Search — web search via Brave Browser's API.\n * Requires BRAVE_SEARCH_API_KEY. Free tier: 2,000 queries/month.\n * Sign up at https://api.search.brave.com/\n */\nexport const braveSearchServer = (): MCPServerConfig => ({\n name: 'brave-search',\n description: 'Web search (Brave). Requires BRAVE_SEARCH_API_KEY — free tier 2k queries/month',\n transport: 'stdio',\n command: 'npx',\n args: ['-y', '@modelcontextprotocol/server-brave-search'],\n permission: 'confirm',\n});\n\n/**\n * Block (Block, Inc.) — Postgres database access via SQL.\n * Useful for running queries against a connected database during development.\n */\nexport const blockServer = (): MCPServerConfig => ({\n name: 'block',\n description: 'Postgres database access via SQL (Block MCP server)',\n transport: 'stdio',\n command: 'npx',\n args: ['-y', '@modelcontextprotocol/server-block'],\n permission: 'confirm',\n});\n\n/**\n * EverArt — AI image generation via various providers.\n * Requires EVERART_API_KEY.\n */\nexport const everArtServer = (): MCPServerConfig => ({\n name: 'everart',\n description: 'AI image generation (EverArt). Requires EVERART_API_KEY',\n transport: 'stdio',\n command: 'npx',\n args: ['-y', '@modelcontextprotocol/server-everart'],\n permission: 'confirm',\n});\n\n/**\n * Slack — messaging, channels, search.\n * Requires SLACK_BOT_TOKEN and either SLACK_TEAM_ID or SLACK_USER_TOKEN.\n */\nexport const slackServer = (): MCPServerConfig => ({\n name: 'slack',\n description: 'Slack — messaging, channels, search. Requires SLACK_BOT_TOKEN + SLACK_TEAM_ID',\n transport: 'stdio',\n command: 'npx',\n args: ['-y', '@modelcontextprotocol/server-slack'],\n permission: 'confirm',\n});\n\n/**\n * AWS knowledge base — EC2, S3, Lambda, IAM, CloudFormation, cost management.\n * Requires AWS access key + secret in environment.\n */\nexport const awsServer = (): MCPServerConfig => ({\n name: 'aws',\n description: 'AWS — EC2, S3, Lambda, IAM, CloudFormation, costs. Requires AWS credentials',\n transport: 'stdio',\n command: 'npx',\n args: ['-y', '@modelcontextprotocol/server-aws'],\n permission: 'confirm',\n});\n\n/**\n * Google Maps — directions, distance matrix, geocoding, places.\n * Requires GOOGLE_MAPS_API_KEY.\n */\nexport const googleMapsServer = (): MCPServerConfig => ({\n name: 'google-maps',\n description: 'Google Maps — directions, geocoding, places. Requires GOOGLE_MAPS_API_KEY',\n transport: 'stdio',\n command: 'npx',\n args: ['-y', '@modelcontextprotocol/server-google-maps'],\n permission: 'confirm',\n});\n\n/** Sentinel — security vulnerability scanning (sentinel-labs). */\nexport const sentinelServer = (): MCPServerConfig => ({\n name: 'sentinel',\n description: 'Security vulnerability scanning (Sentinel)',\n transport: 'streamable-http',\n url: 'https://mcp.sentinel.ai',\n permission: 'deny', // security tool — require explicit confirmation\n});\n\n/**\n * Z.AI Vision MCP — image understanding fallback for text-only models.\n * Requires Z_AI_API_KEY. Tools are read-only and safe to run automatically.\n */\nexport const zaiVisionServer = (): MCPServerConfig => ({\n name: 'zai-vision',\n description: 'Z.AI Vision MCP — image analysis and screenshot understanding',\n transport: 'stdio',\n command: 'npx',\n args: ['-y', '@z_ai/mcp-server@latest'],\n env: { Z_AI_MODE: 'ZAI' },\n allowedTools: [\n 'image_analysis',\n 'extract_text_from_screenshot',\n 'diagnose_error_screenshot',\n 'understand_technical_diagram',\n 'analyze_data_visualization',\n 'ui_diff_check',\n ],\n permission: 'auto',\n});\n\n/**\n * Playwright — browser automation: navigate, click, type, screenshot, evaluate JS.\n * Spawns a headless Chromium browser via @modelcontextprotocol/server-playwright.\n * Tools can read and interact with live web pages — permission defaults to\n * `confirm` because form submission / DOM mutation is possible.\n */\nexport const playwrightServer = (): MCPServerConfig => ({\n name: 'playwright',\n description:\n 'Browser automation — navigate, screenshot, click, type, evaluate JS (headless Chromium)',\n transport: 'stdio',\n command: 'npx',\n args: ['-y', '@modelcontextprotocol/server-playwright'],\n permission: 'confirm',\n});\n\n/**\n * MiniMax Token Plan MCP — web_search + understand_image.\n * This preset exposes only the read-only image understanding tool by default.\n * Requires MINIMAX_API_KEY and uvx on PATH.\n */\nexport const miniMaxVisionServer = (): MCPServerConfig => ({\n name: 'minimax-vision',\n description: 'MiniMax MCP — image understanding via understand_image',\n transport: 'stdio',\n command: 'uvx',\n args: ['minimax-coding-plan-mcp', '-y'],\n env: {\n MINIMAX_MCP_BASE_PATH: './.wrongstack/minimax-output',\n MINIMAX_API_HOST: 'https://api.minimax.io',\n MINIMAX_API_RESOURCE_MODE: 'url',\n },\n allowedTools: ['understand_image'],\n permission: 'auto',\n});\n\n/**\n * SSH Manager — remote SSH execution, file transfer, tunnels, health checks, and deployment ops.\n * Server credentials are intentionally NOT embedded here. Configure hosts via mcp-ssh-manager's\n * env/TOML config (for example SSH_SERVER_<NAME>_HOST, USER, KEYPATH/PASSWORD) or ssh-agent.\n */\nexport const sshManagerServer = (): MCPServerConfig => ({\n name: 'ssh',\n description:\n 'Remote SSH management — execute commands, transfer files, tunnels, health checks (mcp-ssh-manager)',\n transport: 'stdio',\n command: 'npx',\n args: ['-y', 'mcp-ssh-manager'],\n env: {\n MCP_SSH_COMPACT_JSON: 'true',\n MCP_SSH_DEFAULT_TIMEOUT: '120000',\n },\n permission: 'confirm',\n requestTimeoutMs: 180_000,\n});\n\n/** Everything bundled — full set of built-in servers. Useful for `wstack mcp add --all`. */\nexport const allServers = (): Record<string, MCPServerConfig> => ({\n filesystem: { ...filesystemServer(), enabled: false },\n github: { ...githubServer(), enabled: false },\n context7: { ...context7Server(), enabled: false },\n 'brave-search': { ...braveSearchServer(), enabled: false },\n block: { ...blockServer(), enabled: false },\n everart: { ...everArtServer(), enabled: false },\n slack: { ...slackServer(), enabled: false },\n aws: { ...awsServer(), enabled: false },\n 'google-maps': { ...googleMapsServer(), enabled: false },\n sentinel: { ...sentinelServer(), enabled: false },\n 'zai-vision': { ...zaiVisionServer(), enabled: false },\n 'minimax-vision': { ...miniMaxVisionServer(), enabled: false },\n playwright: { ...playwrightServer(), enabled: false },\n ssh: { ...sshManagerServer(), enabled: false },\n});\n","import { randomBytes } from 'node:crypto';\nimport * as fs from 'node:fs/promises';\nimport * as path from 'node:path';\n\nexport interface AtomicWriteOptions {\n mode?: number | undefined;\n encoding?: BufferEncoding | undefined;\n}\n\nexport interface FileLockOptions {\n timeoutMs?: number | undefined;\n staleMs?: number | undefined;\n}\n\nexport async function atomicWrite(\n targetPath: string,\n content: string | Uint8Array,\n opts: AtomicWriteOptions = {},\n): Promise<void> {\n const dir = path.dirname(targetPath);\n await fs.mkdir(dir, { recursive: true });\n const tmp = path.join(dir, `.${path.basename(targetPath)}.${randomBytes(6).toString('hex')}.tmp`);\n\n // Write content to tmp first; 'wx' ensures exclusive creation (fails if\n // tmp already exists — extremely unlikely with 6-byte random suffix).\n try {\n if (typeof content === 'string') {\n await fs.writeFile(tmp, content, { flag: 'wx', encoding: opts.encoding ?? 'utf8' });\n } else {\n await fs.writeFile(tmp, content, { flag: 'wx' });\n }\n try {\n const fh = await fs.open(tmp, 'r+');\n try {\n await fh.sync();\n } finally {\n await fh.close();\n }\n } catch {\n // fsync best-effort\n }\n // Now safely read mode from target (if it exists) and apply to tmp before rename.\n // Prefer opts.mode for new files; for existing files preserve their mode.\n let mode: number | undefined;\n try {\n const stat = await fs.stat(targetPath);\n mode = stat.mode & 0o777;\n } catch {\n mode = opts.mode;\n }\n if (mode !== undefined) {\n await fs.chmod(tmp, mode);\n }\n await renameWithRetry(tmp, targetPath);\n } catch (err) {\n try {\n await fs.unlink(tmp);\n } catch {\n // ignore cleanup error\n }\n throw err;\n }\n}\n\nexport async function ensureDir(dir: string): Promise<void> {\n await fs.mkdir(dir, { recursive: true });\n}\n\nexport async function withFileLock<T>(\n targetPath: string,\n fn: () => Promise<T>,\n opts: FileLockOptions = {},\n): Promise<T> {\n const dir = path.dirname(targetPath);\n await fs.mkdir(dir, { recursive: true });\n const lockPath = path.join(dir, `.${path.basename(targetPath)}.lock`);\n const timeoutMs = opts.timeoutMs ?? 5_000;\n const staleMs = opts.staleMs ?? 30_000;\n const started = Date.now();\n let handle: fs.FileHandle | undefined;\n\n for (;;) {\n try {\n handle = await fs.open(lockPath, 'wx');\n await handle.writeFile(`${process.pid}:${Date.now()}`);\n break;\n } catch (err) {\n const code = (err as NodeJS.ErrnoException).code;\n // ENOENT means the directory was deleted (e.g. by concurrent cleanup).\n // Recreate it and retry acquiring the lock.\n if (code === 'ENOENT') {\n await fs.mkdir(dir, { recursive: true });\n continue;\n }\n if (code !== 'EEXIST') throw err;\n try {\n const stat = await fs.stat(lockPath);\n if (Date.now() - stat.mtimeMs > staleMs) {\n await fs.unlink(lockPath);\n continue;\n }\n } catch {\n continue;\n }\n if (Date.now() - started >= timeoutMs) {\n throw new Error(`Timed out waiting for file lock: ${targetPath}`);\n }\n await new Promise((resolve) => setTimeout(resolve, 25));\n }\n }\n\n try {\n return await fn();\n } finally {\n try {\n await handle?.close();\n } catch {\n // ignore\n }\n try {\n await fs.unlink(lockPath);\n } catch {\n // ignore\n }\n }\n}\n\n// On Windows, fs.rename over an existing file can fail with EPERM/EBUSY/EACCES\n// when antivirus, file indexers, editor file watchers, or a concurrent writer\n// briefly hold a handle on the destination. These are transient — retry with a\n// short backoff before giving up. POSIX renames are atomic and won't hit this.\nconst TRANSIENT_RENAME_CODES = new Set(['EPERM', 'EBUSY', 'EACCES', 'ENOTEMPTY']);\n\nasync function renameWithRetry(from: string, to: string): Promise<void> {\n if (process.platform !== 'win32') {\n await fs.rename(from, to);\n return;\n }\n const delays = [10, 25, 60, 120, 250];\n let lastErr: unknown;\n for (let i = 0; i <= delays.length; i++) {\n try {\n await fs.rename(from, to);\n return;\n } catch (err) {\n lastErr = err;\n const code = (err as NodeJS.ErrnoException)?.code;\n if (!code || !TRANSIENT_RENAME_CODES.has(code) || i === delays.length) {\n throw err;\n }\n await new Promise((resolve) => setTimeout(resolve, delays[i]));\n }\n }\n throw lastErr;\n}\n","import * as fs from 'node:fs/promises';\nimport { atomicWrite } from './atomic-write.js';\n\nexport type JsonObject = Record<string, unknown>;\nexport type JsonPathSegment = string | number;\nexport type JsonPath = readonly JsonPathSegment[];\n\nexport async function readJsonObjectFile(filePath: string): Promise<JsonObject> {\n try {\n const parsed = JSON.parse(await fs.readFile(filePath, 'utf8')) as unknown;\n return isJsonObject(parsed) ? parsed : {};\n } catch {\n return {};\n }\n}\n\nexport async function jsonObjectFileExists(filePath: string): Promise<boolean> {\n try {\n await fs.access(filePath);\n return true;\n } catch {\n return false;\n }\n}\n\nexport async function writeJsonObjectFile(filePath: string, value: JsonObject): Promise<void> {\n await atomicWrite(filePath, JSON.stringify(value, null, 2), { mode: 0o600 });\n}\n\nexport async function updateJsonObjectFile(\n filePath: string,\n mutator: (config: JsonObject) => void | JsonObject | Promise<void | JsonObject>,\n): Promise<JsonObject> {\n const config = await readJsonObjectFile(filePath);\n const maybeNext = await mutator(config);\n const next = maybeNext && isJsonObject(maybeNext) ? maybeNext : config;\n await writeJsonObjectFile(filePath, next);\n return next;\n}\n\nexport function getJsonPath(root: unknown, path: JsonPath): unknown {\n let current = root;\n for (const segment of path) {\n if (typeof segment === 'number') {\n if (!Array.isArray(current)) return undefined;\n current = current[segment];\n continue;\n }\n if (!isJsonObject(current)) return undefined;\n current = current[segment];\n }\n return current;\n}\n\nexport function setJsonPath(root: JsonObject, path: JsonPath, value: unknown): JsonObject {\n if (path.length === 0) {\n if (!isJsonObject(value)) throw new Error('Root config value must be an object');\n return value;\n }\n const parent = ensureJsonParent(root, path);\n const leaf = lastPathSegment(path);\n if (typeof leaf === 'number') {\n if (!Array.isArray(parent)) throw new Error(`Cannot set numeric segment ${leaf} on non-array parent`);\n parent[leaf] = value;\n } else {\n if (!isJsonObject(parent)) throw new Error(`Cannot set property ${leaf} on non-object parent`);\n parent[leaf] = value;\n }\n return root;\n}\n\nexport function removeJsonPath(root: JsonObject, path: JsonPath): boolean {\n if (path.length === 0) return false;\n const parent = getJsonPath(root, path.slice(0, -1));\n const leaf = lastPathSegment(path);\n if (typeof leaf === 'number') {\n if (!Array.isArray(parent) || leaf < 0 || leaf >= parent.length) return false;\n parent.splice(leaf, 1);\n return true;\n }\n if (!isJsonObject(parent) || !(leaf in parent)) return false;\n delete parent[leaf];\n return true;\n}\n\nexport async function setJsonPathInFile(filePath: string, path: JsonPath, value: unknown): Promise<JsonObject> {\n return updateJsonObjectFile(filePath, (config) => setJsonPath(config, path, value));\n}\n\nexport async function removeJsonPathInFile(filePath: string, path: JsonPath): Promise<JsonObject> {\n return updateJsonObjectFile(filePath, (config) => {\n removeJsonPath(config, path);\n });\n}\n\nexport function isJsonObject(value: unknown): value is JsonObject {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction lastPathSegment(path: JsonPath): JsonPathSegment {\n const segment = path[path.length - 1];\n if (segment === undefined) throw new Error('Invalid empty JSON path');\n return segment;\n}\n\nfunction ensureJsonParent(root: JsonObject, path: JsonPath): JsonObject | unknown[] {\n let current: JsonObject | unknown[] = root;\n for (let i = 0; i < path.length - 1; i += 1) {\n const segment = path[i];\n const nextSegment = path[i + 1];\n if (segment === undefined) throw new Error('Invalid empty JSON path segment');\n const nextContainer = typeof nextSegment === 'number' ? [] : {};\n\n if (typeof segment === 'number') {\n if (!Array.isArray(current)) throw new Error(`Cannot traverse numeric segment ${segment} on non-array parent`);\n if (!isJsonObject(current[segment]) && !Array.isArray(current[segment])) current[segment] = nextContainer;\n current = current[segment] as JsonObject | unknown[];\n } else {\n if (!isJsonObject(current)) throw new Error(`Cannot traverse property ${segment} on non-object parent`);\n if (!isJsonObject(current[segment]) && !Array.isArray(current[segment])) current[segment] = nextContainer;\n current = current[segment] as JsonObject | unknown[];\n }\n }\n return current;\n}\n","import { expectDefined } from '../utils/expect-defined.js';\nimport { toErrorMessage } from '../utils/error.js';\nimport { ToolCapabilities } from '../security/capabilities.js';\n/**\n * `mcp_control` — LLM-driven MCP server lifecycle management.\n *\n * The model calls this tool to:\n * list — see all known servers (running or not) without starting any\n * search — filter the server catalog by name or description keyword\n * enable — start a server and register its tools\n * disable — stop a server and unregister its tools\n * restart — stop then re-start a running server\n *\n * This is the primary mechanism by which the LLM autonomously extends its\n * own capabilities at runtime — e.g. \"I need GitHub access, let me enable it.\"\n */\nimport { allServers } from '../infrastructure/mcp-servers.js';\nimport { readJsonObjectFile, setJsonPath, updateJsonObjectFile } from '../utils/config-json.js';\nimport type { Config, JSONSchema, MCPServerConfig, Tool } from '../index.js';\nexport interface MCPRegistryHandle {\n start(cfg: MCPServerConfig): Promise<void>;\n stop(name: string): Promise<void>;\n restart(name: string): Promise<void>;\n describe(): {\n name: string;\n state: string;\n toolCount: number;\n enabled: boolean;\n tools?: string[];\n }[];\n list(): { name: string; state: string; toolCount: number; tools?: string[] }[];\n /**\n * Register all cached tools for a server without restarting it.\n * No-op if the server is not connected or tools are already active.\n * Used in token-saving mode to temporarily expose MCP tools.\n */\n activateServer?(name: string): void;\n /**\n * Unregister all tools for a server without disconnecting it.\n * Returns the number of tools that were deactivated.\n * Used in token-saving mode to hide MCP tools after use.\n */\n deactivateServer?(name: string): number;\n /**\n * Check whether a server's tools are currently registered.\n */\n isActivated?(name: string): boolean;\n}\n\nexport interface CreateMcpControlToolOptions {\n /**\n * Read the current config object. The tool never mutates this directly —\n * writes go to the global config file via `configPath`.\n */\n getConfig: () => Config;\n /**\n * Path to ~/.wrongstack/config.json (or equivalent) for atomic config writes.\n */\n configPath: string;\n /**\n * Live MCP registry for runtime start/stop/restart. The tool calls these\n * immediately so the LLM sees the result of its action in the same turn.\n */\n registry: MCPRegistryHandle;\n}\n\nexport function createMcpControlTool(opts: CreateMcpControlToolOptions): Tool {\n const { getConfig, configPath, registry } = opts;\n\n const inputSchema: JSONSchema = {\n type: 'object',\n properties: {\n action: {\n type: 'string',\n enum: ['list', 'search', 'enable', 'disable', 'restart', 'activate', 'deactivate'],\n description: 'The management action to perform. activate/deactivate toggle tool registration ephemerally without disconnecting.',\n },\n /** Filter for `search`. Matches server name or description case-insensitively. */\n query: {\n type: 'string',\n description: 'Search term for `search` action. Matches server name or description.',\n },\n /** Target server name for `enable`, `disable`, `restart`, `activate`, `deactivate`. */\n server: {\n type: 'string',\n description: 'Server name (e.g. \"github\", \"filesystem\", \"brave-search\").',\n },\n },\n required: ['action'],\n };\n\n return {\n name: 'mcp_control',\n description:\n 'Manage MCP server lifecycle: list available servers, search by name or capability, enable or disable servers at runtime, restart running servers. Use activate/deactivate to ephemerally toggle tool registration without disconnecting — ideal for token-saving mode where MCP tools are lazy-loaded on demand.',\n category: 'mcp',\n permission: 'auto',\n mutating: true,\n riskTier: 'standard',\n capabilities: [ToolCapabilities.CONFIG_MUTATE],\n inputSchema,\n async execute(raw) {\n const input = raw as { action: string; query?: string | undefined; server?: string | undefined };\n return mcpControlDispatch(input, { getConfig, configPath, registry });\n },\n };\n}\n\n// ── Dispatch ──────────────────────────────────────────────────────────────────\n\nasync function mcpControlDispatch(\n input: { action: string; query?: string | undefined; server?: string | undefined },\n deps: { getConfig: () => Config; configPath: string; registry: MCPRegistryHandle },\n): Promise<string> {\n const { action, query, server } = input;\n\n switch (action) {\n case 'list': return renderList(deps);\n case 'search': return renderSearch(query ?? '', deps);\n case 'enable': return server ? runEnable(server, deps) : '`server` is required for enable.';\n case 'disable': return server ? runDisable(server, deps) : '`server` is required for disable.';\n case 'restart': return server ? runRestart(server, deps) : '`server` is required for restart.';\n case 'activate': return server ? runActivate(server, deps) : '`server` is required for activate.';\n case 'deactivate': return server ? runDeactivate(server, deps) : '`server` is required for deactivate.';\n default:\n return `Unknown action \"${action}\". Use one of: list, search, enable, disable, restart, activate, deactivate.`;\n }\n}\n\n// ── Actions ───────────────────────────────────────────────────────────────────\n\nasync function renderList(deps: { getConfig: () => Config; configPath: string; registry: MCPRegistryHandle }): Promise<string> {\n const configured = await getConfiguredMcpServers(deps);\n const live = deps.registry.describe();\n\n if (Object.keys(configured).length === 0) {\n return [\n 'No MCP servers configured.',\n ' Use `mcp_control({ action: \"search\" })` to see available presets,',\n ' then `mcp_control({ action: \"enable\", server: \"<name>\" })` to add one.',\n ].join('\\n');\n }\n\n const lines: string[] = [];\n const liveMap = new Map(live.map((s) => [s.name, s]));\n\n for (const [name, cfg] of Object.entries(configured)) {\n const liveInfo = liveMap.get(name);\n const toolCount = liveInfo ? ` (${liveInfo.toolCount} tools)` : '';\n const stateStr = liveInfo ? badge(liveInfo.state) : dim('○ not loaded');\n const enabled = cfg.enabled === false\n ? `${dim('disabled')} `\n : `${green('● enabled')} `;\n lines.push(` ${bold(name)} ${enabled}${stateStr}${toolCount}`);\n if (cfg.description) lines.push(` ${dim(cfg.description)}`);\n }\n\n lines.push('');\n lines.push(dim(' Use `mcp_control({ action: \"search\", query: \"<keyword>\" })` to find servers.'));\n lines.push(dim(' Use `mcp_control({ action: \"enable\", server: \"<name>\" })` to start a server.'));\n return lines.join('\\n');\n}\n\nasync function renderSearch(\n query: string,\n deps: { getConfig: () => Config; configPath: string; registry: MCPRegistryHandle },\n): Promise<string> {\n const configured = await getConfiguredMcpServers(deps);\n const all = allServers();\n const q = query.toLowerCase();\n\n const configuredNames = new Set(Object.keys(configured));\n\n // Match against configured servers first, then remaining presets\n const configuredEntries = Object.entries(configured).filter(\n ([name, cfg]) =>\n name.toLowerCase().includes(q) ||\n (cfg.description ?? '').toLowerCase().includes(q),\n );\n\n const unconfiguredEntries = Object.entries(all)\n .filter(([name]) => !configuredNames.has(name))\n .filter(\n ([name, cfg]) =>\n name.toLowerCase().includes(q) ||\n (cfg.description ?? '').toLowerCase().includes(q),\n );\n\n const lines: string[] = [];\n\n if (configuredEntries.length > 0) {\n lines.push(bold('Configured servers matching \"') + query + '\":');\n for (const [name, cfg] of configuredEntries) {\n lines.push(` ${bold(name)} ${cfg.description ?? cfg.transport}`);\n }\n lines.push('');\n }\n\n if (unconfiguredEntries.length > 0) {\n lines.push(bold('Available presets matching \"') + query + '\":');\n for (const [name, cfg] of unconfiguredEntries) {\n const warn = cfg.permission === 'deny' ? red(' ⚠ confirm required') : '';\n lines.push(` ${bold(name)} ${cfg.description ?? cfg.transport}${warn}`);\n }\n lines.push('');\n }\n\n if (configuredEntries.length === 0 && unconfiguredEntries.length === 0) {\n return `No servers match \"${query}\". Try a shorter keyword or \\`mcp_control({ action: \"list\" })\\`.`;\n }\n\n const total = configuredEntries.length + unconfiguredEntries.length;\n lines.push(dim(` ${total} server${total !== 1 ? 's' : ''} shown. Run \\`enable\\` on one to activate it.`));\n return lines.join('\\n');\n}\n\nasync function runEnable(\n name: string | undefined,\n deps: { getConfig: () => Config; configPath: string; registry: MCPRegistryHandle },\n): Promise<string> {\n if (!name) return '`server` is required for enable. Example: { action: \"enable\", server: \"github\" }';\n\n const all = allServers();\n const configured = deps.getConfig().mcpServers ?? {};\n\n // Resolve the target config — it may be a preset not yet in config\n const cfg = configured[name] ?? all[name];\n if (!cfg) {\n const known = Object.keys(all).join(', ');\n return `Unknown server \"${name}\". Available presets: ${known}`;\n }\n\n // Write to config (add or update) using the shared JSON path helper.\n await updateJsonObjectFile(deps.configPath, (full) => {\n const current = isMcpServerRecord(full.mcpServers) ? full.mcpServers : {};\n setJsonPath(full, ['mcpServers', name], { ...current[name], ...cfg, enabled: true });\n });\n\n // Start the server in the registry\n try {\n const live = deps.registry.describe().find((s) => s.name === name);\n if (live && live.state === 'connected') {\n return `${green('●')} Server \"${name}\" is already running (${live.toolCount} tools registered).`;\n }\n await deps.registry.start({ ...cfg, enabled: true });\n const updated = deps.registry.describe().find((s) => s.name === name);\n return `${green('✓ Enabled and started')} \"${name}\"${updated ? ` (${updated.toolCount} tools registered).` : '.'}`;\n } catch (err) {\n return `${red('✗ Failed to start')} \"${name}\": ${toErrorMessage(err)}`;\n }\n}\n\nasync function runDisable(\n name: string | undefined,\n deps: { getConfig: () => Config; configPath: string; registry: MCPRegistryHandle },\n): Promise<string> {\n if (!name) return '`server` is required for disable. Example: { action: \"disable\", server: \"github\" }';\n\n const configured = deps.getConfig().mcpServers ?? {};\n if (!configured[name]) {\n return `Server \"${name}\" is not in config. Add it with \\`mcp_control({ action: \"enable\", server: \"${name}\" })\\`.`;\n }\n\n // Write to config using the shared JSON path helper.\n await updateJsonObjectFile(deps.configPath, (full) => {\n const current = isMcpServerRecord(full.mcpServers) ? full.mcpServers : {};\n const existing = expectDefined(current[name]);\n setJsonPath(full, ['mcpServers', name], { ...existing, enabled: false });\n });\n\n // Stop the running server\n try {\n await deps.registry.stop(name);\n return `${yellow('○ Disabled')} \"${name}\". It will not be started on next boot.`;\n } catch {\n return `${yellow('○ Disabled')} \"${name}\" (it was not running). Config updated.`;\n }\n}\n\nasync function runRestart(\n name: string | undefined,\n deps: { getConfig: () => Config; configPath: string; registry: MCPRegistryHandle },\n): Promise<string> {\n if (!name) return '`server` is required for restart. Example: { action: \"restart\", server: \"github\" }';\n\n const configured = deps.getConfig().mcpServers ?? {};\n if (!configured[name]) {\n return `Server \"${name}\" is not configured. Use \\`mcp_control({ action: \"enable\", server: \"${name}\" })\\` first.`;\n }\n\n try {\n await deps.registry.restart(name);\n const updated = deps.registry.describe().find((s) => s.name === name);\n return `${green('✓ Restarted')} \"${name}\"${updated ? ` (${updated.toolCount} tools registered).` : '.'}`;\n } catch (err) {\n return `${red('✗ Restart failed')} for \"${name}\": ${toErrorMessage(err)}`;\n }\n}\n\n/**\n * Ephemerally activate a server's tools without writing to config or\n * restarting the connection. The server must already be connected (lazy mode).\n * Calls `registry.activateServer()` when available; falls back to a message\n * if the registry doesn't support ephemeral activation.\n */\nasync function runActivate(\n name: string | undefined,\n deps: { registry: MCPRegistryHandle },\n): Promise<string> {\n if (!name) return '`server` is required for activate.';\n if (!deps.registry.activateServer) {\n return `Registry does not support ephemeral activation. Use \\`enable\\` to start \"${name}\" instead.`;\n }\n const live = deps.registry.describe().find((s) => s.name === name);\n if (!live) {\n return `Server \"${name}\" is not registered. Use \\`mcp_control({ action: \"enable\", server: \"${name}\" })\\` first.`;\n }\n if (live.state !== 'connected') {\n return `Server \"${name}\" is not connected (state: ${live.state}). Use \\`enable\\` to start it first.`;\n }\n if (deps.registry.isActivated?.(name)) {\n return `${green('●')} Server \"${name}\" tools are already active. Use \\`deactivate\\` to hide them.`;\n }\n deps.registry.activateServer(name);\n const updated = deps.registry.describe().find((s) => s.name === name);\n return `${green('✓ Activated')} \"${name}\" — ${updated?.toolCount ?? 0} tool(s) now registered. Use \\`mcp_control({ action: \"deactivate\", server: \"${name}\" })\\` to hide them when done.`;\n}\n\n/**\n * Ephemerally deactivate a server's tools without disconnecting.\n * Calls `registry.deactivateServer()` when available.\n */\nasync function runDeactivate(\n name: string | undefined,\n deps: { registry: MCPRegistryHandle },\n): Promise<string> {\n if (!name) return '`server` is required for deactivate.';\n if (!deps.registry.deactivateServer) {\n return `Registry does not support ephemeral deactivation. Use \\`disable\\` to stop \"${name}\" instead.`;\n }\n if (!deps.registry.isActivated?.(name)) {\n return `Server \"${name}\" tools are not currently active.`;\n }\n const count = deps.registry.deactivateServer(name);\n return `${yellow('○ Deactivated')} \"${name}\" — ${count} tool(s) unregistered. Server stays connected.`;\n}\n\n// ── Config helpers ──────────────────────────────────────────────────────────────\n\nasync function getConfiguredMcpServers(deps: { getConfig: () => Config; configPath: string }): Promise<Record<string, MCPServerConfig>> {\n const diskConfig = await readJsonObjectFile(deps.configPath);\n if (isMcpServerRecord(diskConfig.mcpServers)) return diskConfig.mcpServers;\n return deps.getConfig().mcpServers ?? {};\n}\n\nfunction isMcpServerRecord(value: unknown): value is Record<string, MCPServerConfig> {\n return !!value && typeof value === 'object' && !Array.isArray(value);\n}\n\n// ── Colour helpers (no dep on core color — inline) ───────────────────────────\n\nfunction bold(s: string) { return `\\x1b[1m${s}\\x1b[0m`; }\nfunction dim(s: string) { return `\\x1b[2m${s}\\x1b[0m`; }\nfunction green(s: string) { return `\\x1b[32m${s}\\x1b[0m`; }\nfunction yellow(s: string){ return `\\x1b[33m${s}\\x1b[0m`; }\nfunction red(s: string) { return `\\x1b[31m${s}\\x1b[0m`; }\n\nfunction badge(state: string): string {\n switch (state) {\n case 'connected': return green('● connected');\n case 'connecting': return `\\x1b[36m◐ connecting\\x1b[0m`;\n case 'reconnecting': return `\\x1b[36m◑ reconnecting\\x1b[0m`;\n case 'disconnected': return dim('○ disconnected');\n case 'failed': return red('✗ failed');\n default: return dim(state);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/utils/expect-defined.ts","../../src/utils/error.ts","../../src/security/capabilities.ts","../../src/infrastructure/mcp-servers.ts","../../src/utils/atomic-write.ts","../../src/utils/config-json.ts","../../src/tools/mcp-control.ts"],"names":["stat","fs2","path"],"mappings":";;;;;AAIO,SAAS,aAAA,CAAiB,OAA6B,KAAA,EAAmB;AAC/E,EAAA,IAAI,KAAA,KAAU,IAAA,IAAQ,KAAA,KAAU,MAAA,EAAW;AACzC,IAAA,MAAM,MAAM,IAAI,KAAA,CAAkD,8BAA8B,CAAA;AAChG,IAAA,GAAA,CAAI,IAAA,GAAO,oBAAA;AACX,IAAA,MAAM,GAAA;AAAA,EACR;AACA,EAAA,OAAO,KAAA;AACT;;;ACPO,SAAS,eAAe,GAAA,EAAsB;AACnD,EAAA,OAAO,GAAA,YAAe,KAAA,GAAQ,GAAA,CAAI,OAAA,GAAU,OAAO,GAAG,CAAA;AACxD;;;ACKO,IAAM,gBAAA,GAAmB;AAAA,EAuBd;AAAA,EAGhB,aAAA,EAAe,eAIjB,CAAA;;;ACxBO,IAAM,mBAAmB,OAAwB;AAAA,EACtD,IAAA,EAAM,YAAA;AAAA,EACN,WAAA,EAAa,mEAAA;AAAA,EACb,SAAA,EAAW,OAAA;AAAA,EACX,OAAA,EAAS,KAAA;AAAA,EACT,IAAA,EAAM,CAAC,IAAA,EAAM,yCAAA,EAA2C,GAAG,CAAA;AAAA,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EAAY;AAAE,EAAA,OAAO,UAAU,CAAC,CAAA,OAAA,CAAA;AAAW;AACxD,SAAS,MAAM,CAAA,EAAW;AAAE,EAAA,OAAO,WAAW,CAAC,CAAA,OAAA,CAAA;AAAW;AAC1D,SAAS,OAAO,CAAA,EAAU;AAAE,EAAA,OAAO,WAAW,CAAC,CAAA,OAAA,CAAA;AAAW;AAC1D,SAAS,IAAI,CAAA,EAAa;AAAE,EAAA,OAAO,WAAW,CAAC,CAAA,OAAA,CAAA;AAAW;AAE1D,SAAS,MAAM,KAAA,EAAuB;AACpC,EAAA,QAAQ,KAAA;AAAO,IACb,KAAK,WAAA;AAAgB,MAAA,OAAO,MAAM,kBAAa,CAAA;AAAA,IAC/C,KAAK,YAAA;AAAgB,MAAA,OAAO,CAAA,gCAAA,CAAA;AAAA,IAC5B,KAAK,cAAA;AAAgB,MAAA,OAAO,CAAA,kCAAA,CAAA;AAAA,IAC5B,KAAK,cAAA;AAAgB,MAAA,OAAO,IAAI,qBAAgB,CAAA;AAAA,IAChD,KAAK,QAAA;AAAgB,MAAA,OAAO,IAAI,eAAU,CAAA;AAAA,IAC1C;AAAoB,MAAA,OAAO,IAAI,KAAK,CAAA;AAAA;AAExC","file":"index.js","sourcesContent":["/** Assert a value is neither null nor undefined. Throws if it is.\n * Useful after optional chaining and indexed access when the\n * control flow guarantees the value exists but TypeScript can't\n * prove it (e.g. after a check on a related field). */\nexport function expectDefined<T>(value: T | null | undefined, label?: string): T {\n if (value === null || value === undefined) {\n const err = new Error(label ? `Expected ${label} to be defined` : 'Expected value to be defined');\n err.name = 'ExpectDefinedError';\n throw err;\n }\n return value;\n}\n","/**\n * Converts an unknown error value to a human-readable string.\n * Used in 40+ files across the codebase to normalize error messaging.\n */\nexport function toErrorMessage(err: unknown): string {\n return err instanceof Error ? err.message : String(err);\n}\n","/**\n * Well-known tool capabilities used for authorization decisions.\n *\n * These are the preferred values for `Tool.capabilities`.\n * New capabilities should be added here with clear documentation.\n *\n * Philosophy (2026-06+):\n * - Prefer capabilities over exact tool name matching.\n * - Subagent guards and future policies should primarily key off capabilities.\n * - Name-based denylists are legacy and will be phased down.\n */\nexport const ToolCapabilities = {\n /** Can execute arbitrary commands in the user's shell (the `bash` tool). */\n SHELL_ARBITRARY: 'shell.arbitrary',\n\n /** Can execute a restricted set of commands (the `exec` tool). */\n SHELL_RESTRICTED: 'shell.restricted',\n\n /** Can read files inside the project (and possibly outside via symlinks if not guarded). */\n FS_READ: 'fs.read',\n\n /** Can write / modify / delete files inside the project. */\n FS_WRITE: 'fs.write',\n\n /** Can write files outside the current project root (very high risk). */\n FS_WRITE_OUTSIDE_PROJECT: 'fs.write.outside-project',\n\n /** Can perform outbound network requests. */\n NET_OUTBOUND: 'net.outbound',\n\n /** Proxies tools from external MCP servers (unknown capability). */\n MCP_PROXY: 'mcp.proxy',\n\n /** Can spawn or manage subagents / multi-agent tasks. */\n SUBAGENT_SPAWN: 'subagent.spawn',\n\n /** Can mutate global or session configuration / trust state. */\n CONFIG_MUTATE: 'config.mutate',\n\n /** Can install packages or run package managers with side effects. */\n PACKAGE_INSTALL: 'package.install',\n} as const;\n\nexport type ToolCapability = (typeof ToolCapabilities)[keyof typeof ToolCapabilities];\n\n/**\n * Set of capabilities that are considered dangerous for subagents by default.\n * Subagents should not receive these capabilities unless the leader explicitly\n * allows the specific tool at spawn time.\n */\nexport const DANGEROUS_FOR_SUBAGENTS: readonly ToolCapability[] = [\n ToolCapabilities.SHELL_ARBITRARY,\n ToolCapabilities.SHELL_RESTRICTED,\n ToolCapabilities.FS_WRITE,\n ToolCapabilities.FS_WRITE_OUTSIDE_PROJECT,\n ToolCapabilities.MCP_PROXY,\n ToolCapabilities.SUBAGENT_SPAWN,\n ToolCapabilities.CONFIG_MUTATE,\n ToolCapabilities.PACKAGE_INSTALL,\n];\n\n/**\n * Wide capability allowlist for subagents that the user has authorized to act\n * with full developer power (the CLI fleet host applies this to any subagent\n * that isn't given an explicit, narrower grant). It covers everything needed to\n * do real work end-to-end — read, write/edit inside the project, outbound\n * network, and shell/build/install — so a delegated coding or build agent runs\n * the same toolchain the leader would, without per-tool confirmation it cannot\n * answer.\n *\n * Deliberately EXCLUDED (require an explicit per-spawn `allowedCapabilities`\n * grant, because they escape the task's blast radius rather than perform it):\n * - `fs.write.outside-project` — writing outside the repo (e.g. ~/.ssh).\n * - `mcp.proxy` — third-party MCP tools (also hard-blocked by name).\n * - `subagent.spawn` — recursive delegation (the baseline prompt forbids it).\n * - `config.mutate` — rewriting trust/config is privilege escalation, not work.\n */\nexport const WIDE_SUBAGENT_CAPABILITIES: readonly ToolCapability[] = [\n ToolCapabilities.FS_READ,\n ToolCapabilities.FS_WRITE,\n ToolCapabilities.NET_OUTBOUND,\n ToolCapabilities.SHELL_ARBITRARY,\n ToolCapabilities.SHELL_RESTRICTED,\n ToolCapabilities.PACKAGE_INSTALL,\n];\n\n/**\n * Check if a tool (or its capabilities array) includes any dangerous capability\n * for subagent execution.\n */\nexport function hasDangerousCapabilityForSubagents(\n toolOrCaps: { capabilities?: readonly string[] | undefined } | readonly string[] | undefined,\n): boolean {\n if (!toolOrCaps) return false;\n const input = toolOrCaps as never as { capabilities?: readonly string[] | undefined };\n const caps: readonly string[] = Array.isArray(toolOrCaps) ? toolOrCaps : (input.capabilities ?? []);\n return caps.some((c) => DANGEROUS_FOR_SUBAGENTS.includes(c as ToolCapability));\n}\n\n/**\n * Check if a tool declares a specific capability (or any of the provided ones).\n */\nexport function hasCapability(\n toolOrCaps: { capabilities?: readonly string[] | undefined } | readonly string[] | undefined,\n capability: ToolCapability | ToolCapability[],\n): boolean {\n if (!toolOrCaps) return false;\n const input = toolOrCaps as never as { capabilities?: readonly string[] | undefined };\n const caps: readonly string[] = Array.isArray(toolOrCaps) ? toolOrCaps : (input.capabilities ?? []);\n const toCheck = Array.isArray(capability) ? capability : [capability];\n return toCheck.some((c) => caps.includes(c));\n}\n\n/**\n * Returns the intersection of a tool's capabilities with the dangerous set.\n * Useful for logging and audit trails.\n */\nexport function getDangerousCapabilities(\n toolOrCaps: { capabilities?: readonly string[] | undefined } | readonly string[] | undefined,\n): ToolCapability[] {\n if (!toolOrCaps) return [];\n const input = toolOrCaps as never as { capabilities?: readonly string[] | undefined };\n const caps: readonly string[] = Array.isArray(toolOrCaps) ? toolOrCaps : (input.capabilities ?? []);\n return caps.filter((c): c is ToolCapability =>\n DANGEROUS_FOR_SUBAGENTS.includes(c as ToolCapability),\n );\n}\n","import type { MCPServerConfig } from '../types/config.js';\n\n/**\n * Built-in MCP server presets available to all WrongStack users out of the box.\n * These servers must be explicitly enabled in config (disabled by default).\n *\n * To enable: set `mcpServers: { serverName: { enabled: true } }` in your config.\n *\n * Some servers require environment variables or additional config — see notes below.\n *\n * Transport types:\n * stdio — spawns a local npm package binary via child_process\n * sse — HTTP SSE endpoint (client POSTs requests)\n * streamable-http — session-based HTTP with NDJSON responses\n */\n\n/** Filesystem access: read, write, list, search, tree. Good for exploring projects. */\nexport const filesystemServer = (): MCPServerConfig => ({\n name: 'filesystem',\n description: 'Read, write, and navigate the local filesystem (read-heavy tools)',\n transport: 'stdio',\n command: 'npx',\n args: ['-y', '@modelcontextprotocol/server-filesystem', '.'],\n permission: 'confirm',\n});\n\n/** GitHub API: issues, PRs, repos, search, file operations. Requires GITHUB_PERSONAL_ACCESS_TOKEN. */\nexport const githubServer = (): MCPServerConfig => ({\n name: 'github',\n description:\n 'GitHub API — issues, PRs, repos, search, file ops (requires GITHUB_PERSONAL_ACCESS_TOKEN)',\n transport: 'stdio',\n command: 'npx',\n args: ['-y', '@modelcontextprotocol/server-github'],\n permission: 'confirm',\n});\n\n/**\n * Context7 — codebase-aware documentation and Q&A using context from your code.\n * Live documentation for any library, grounded in your actual versions.\n */\nexport const context7Server = (): MCPServerConfig => ({\n name: 'context7',\n description: 'Codebase-aware documentation and Q&A (context7.ai)',\n transport: 'streamable-http',\n url: 'https://mcp.context7.com/mcp',\n permission: 'confirm',\n});\n\n/**\n * Brave Search — web search via Brave Browser's API.\n * Requires BRAVE_SEARCH_API_KEY. Free tier: 2,000 queries/month.\n * Sign up at https://api.search.brave.com/\n */\nexport const braveSearchServer = (): MCPServerConfig => ({\n name: 'brave-search',\n description: 'Web search (Brave). Requires BRAVE_SEARCH_API_KEY — free tier 2k queries/month',\n transport: 'stdio',\n command: 'npx',\n args: ['-y', '@modelcontextprotocol/server-brave-search'],\n permission: 'confirm',\n});\n\n/**\n * Block (Block, Inc.) — Postgres database access via SQL.\n * Useful for running queries against a connected database during development.\n */\nexport const blockServer = (): MCPServerConfig => ({\n name: 'block',\n description: 'Postgres database access via SQL (Block MCP server)',\n transport: 'stdio',\n command: 'npx',\n args: ['-y', '@modelcontextprotocol/server-block'],\n permission: 'confirm',\n});\n\n/**\n * EverArt — AI image generation via various providers.\n * Requires EVERART_API_KEY.\n */\nexport const everArtServer = (): MCPServerConfig => ({\n name: 'everart',\n description: 'AI image generation (EverArt). Requires EVERART_API_KEY',\n transport: 'stdio',\n command: 'npx',\n args: ['-y', '@modelcontextprotocol/server-everart'],\n permission: 'confirm',\n});\n\n/**\n * Slack — messaging, channels, search.\n * Requires SLACK_BOT_TOKEN and either SLACK_TEAM_ID or SLACK_USER_TOKEN.\n */\nexport const slackServer = (): MCPServerConfig => ({\n name: 'slack',\n description: 'Slack — messaging, channels, search. Requires SLACK_BOT_TOKEN + SLACK_TEAM_ID',\n transport: 'stdio',\n command: 'npx',\n args: ['-y', '@modelcontextprotocol/server-slack'],\n permission: 'confirm',\n});\n\n/**\n * AWS knowledge base — EC2, S3, Lambda, IAM, CloudFormation, cost management.\n * Requires AWS access key + secret in environment.\n */\nexport const awsServer = (): MCPServerConfig => ({\n name: 'aws',\n description: 'AWS — EC2, S3, Lambda, IAM, CloudFormation, costs. Requires AWS credentials',\n transport: 'stdio',\n command: 'npx',\n args: ['-y', '@modelcontextprotocol/server-aws'],\n permission: 'confirm',\n});\n\n/**\n * Google Maps — directions, distance matrix, geocoding, places.\n * Requires GOOGLE_MAPS_API_KEY.\n */\nexport const googleMapsServer = (): MCPServerConfig => ({\n name: 'google-maps',\n description: 'Google Maps — directions, geocoding, places. Requires GOOGLE_MAPS_API_KEY',\n transport: 'stdio',\n command: 'npx',\n args: ['-y', '@modelcontextprotocol/server-google-maps'],\n permission: 'confirm',\n});\n\n/** Sentinel — security vulnerability scanning (sentinel-labs). */\nexport const sentinelServer = (): MCPServerConfig => ({\n name: 'sentinel',\n description: 'Security vulnerability scanning (Sentinel)',\n transport: 'streamable-http',\n url: 'https://mcp.sentinel.ai',\n permission: 'deny', // security tool — require explicit confirmation\n});\n\n/**\n * Z.AI Vision MCP — image understanding fallback for text-only models.\n * Requires Z_AI_API_KEY. Tools are read-only and safe to run automatically.\n */\nexport const zaiVisionServer = (): MCPServerConfig => ({\n name: 'zai-vision',\n description: 'Z.AI Vision MCP — image analysis and screenshot understanding',\n transport: 'stdio',\n command: 'npx',\n args: ['-y', '@z_ai/mcp-server@latest'],\n env: { Z_AI_MODE: 'ZAI' },\n allowedTools: [\n 'image_analysis',\n 'extract_text_from_screenshot',\n 'diagnose_error_screenshot',\n 'understand_technical_diagram',\n 'analyze_data_visualization',\n 'ui_diff_check',\n ],\n permission: 'auto',\n});\n\n/**\n * Playwright — browser automation: navigate, click, type, screenshot, evaluate JS.\n * Spawns a headless Chromium browser via @modelcontextprotocol/server-playwright.\n * Tools can read and interact with live web pages — permission defaults to\n * `confirm` because form submission / DOM mutation is possible.\n */\nexport const playwrightServer = (): MCPServerConfig => ({\n name: 'playwright',\n description:\n 'Browser automation — navigate, screenshot, click, type, evaluate JS (headless Chromium)',\n transport: 'stdio',\n command: 'npx',\n args: ['-y', '@modelcontextprotocol/server-playwright'],\n permission: 'confirm',\n});\n\n/**\n * MiniMax Token Plan MCP — web_search + understand_image.\n * This preset exposes only the read-only image understanding tool by default.\n * Requires MINIMAX_API_KEY and uvx on PATH.\n */\nexport const miniMaxVisionServer = (): MCPServerConfig => ({\n name: 'minimax-vision',\n description: 'MiniMax MCP — image understanding via understand_image',\n transport: 'stdio',\n command: 'uvx',\n args: ['minimax-coding-plan-mcp', '-y'],\n env: {\n MINIMAX_MCP_BASE_PATH: './.wrongstack/minimax-output',\n MINIMAX_API_HOST: 'https://api.minimax.io',\n MINIMAX_API_RESOURCE_MODE: 'url',\n },\n allowedTools: ['understand_image'],\n permission: 'auto',\n});\n\n/**\n * SSH Manager — remote SSH execution, file transfer, tunnels, health checks, and deployment ops.\n * Server credentials are intentionally NOT embedded here. Configure hosts via mcp-ssh-manager's\n * env/TOML config (for example SSH_SERVER_<NAME>_HOST, USER, KEYPATH/PASSWORD) or ssh-agent.\n */\nexport const sshManagerServer = (): MCPServerConfig => ({\n name: 'ssh',\n description:\n 'Remote SSH management — execute commands, transfer files, tunnels, health checks (mcp-ssh-manager)',\n transport: 'stdio',\n command: 'npx',\n args: ['-y', 'mcp-ssh-manager'],\n env: {\n MCP_SSH_COMPACT_JSON: 'true',\n MCP_SSH_DEFAULT_TIMEOUT: '120000',\n },\n permission: 'confirm',\n requestTimeoutMs: 180_000,\n});\n\n/** Everything bundled — full set of built-in servers. Useful for `wstack mcp add --all`. */\nexport const allServers = (): Record<string, MCPServerConfig> => ({\n filesystem: { ...filesystemServer(), enabled: false },\n github: { ...githubServer(), enabled: false },\n context7: { ...context7Server(), enabled: false },\n 'brave-search': { ...braveSearchServer(), enabled: false },\n block: { ...blockServer(), enabled: false },\n everart: { ...everArtServer(), enabled: false },\n slack: { ...slackServer(), enabled: false },\n aws: { ...awsServer(), enabled: false },\n 'google-maps': { ...googleMapsServer(), enabled: false },\n sentinel: { ...sentinelServer(), enabled: false },\n 'zai-vision': { ...zaiVisionServer(), enabled: false },\n 'minimax-vision': { ...miniMaxVisionServer(), enabled: false },\n playwright: { ...playwrightServer(), enabled: false },\n ssh: { ...sshManagerServer(), enabled: false },\n});\n","import { randomBytes } from 'node:crypto';\nimport * as fs from 'node:fs/promises';\nimport * as path from 'node:path';\n\nexport interface AtomicWriteOptions {\n mode?: number | undefined;\n encoding?: BufferEncoding | undefined;\n}\n\nexport interface FileLockOptions {\n timeoutMs?: number | undefined;\n staleMs?: number | undefined;\n}\n\nexport async function atomicWrite(\n targetPath: string,\n content: string | Uint8Array,\n opts: AtomicWriteOptions = {},\n): Promise<void> {\n const dir = path.dirname(targetPath);\n await fs.mkdir(dir, { recursive: true });\n const tmp = path.join(dir, `.${path.basename(targetPath)}.${randomBytes(6).toString('hex')}.tmp`);\n\n // Write content to tmp first; 'wx' ensures exclusive creation (fails if\n // tmp already exists — extremely unlikely with 6-byte random suffix).\n try {\n if (typeof content === 'string') {\n await fs.writeFile(tmp, content, { flag: 'wx', encoding: opts.encoding ?? 'utf8' });\n } else {\n await fs.writeFile(tmp, content, { flag: 'wx' });\n }\n try {\n const fh = await fs.open(tmp, 'r+');\n try {\n await fh.sync();\n } finally {\n await fh.close();\n }\n } catch {\n // fsync best-effort\n }\n // Now safely read mode from target (if it exists) and apply to tmp before rename.\n // Prefer opts.mode for new files; for existing files preserve their mode.\n let mode: number | undefined;\n try {\n const stat = await fs.stat(targetPath);\n mode = stat.mode & 0o777;\n } catch {\n mode = opts.mode;\n }\n if (mode !== undefined) {\n await fs.chmod(tmp, mode);\n }\n await renameWithRetry(tmp, targetPath);\n } catch (err) {\n try {\n await fs.unlink(tmp);\n } catch {\n // ignore cleanup error\n }\n throw err;\n }\n}\n\nexport async function ensureDir(dir: string): Promise<void> {\n await fs.mkdir(dir, { recursive: true });\n}\n\nexport async function withFileLock<T>(\n targetPath: string,\n fn: () => Promise<T>,\n opts: FileLockOptions = {},\n): Promise<T> {\n const dir = path.dirname(targetPath);\n await fs.mkdir(dir, { recursive: true });\n const lockPath = path.join(dir, `.${path.basename(targetPath)}.lock`);\n const timeoutMs = opts.timeoutMs ?? 5_000;\n const staleMs = opts.staleMs ?? 30_000;\n const started = Date.now();\n let handle: fs.FileHandle | undefined;\n\n for (;;) {\n try {\n handle = await fs.open(lockPath, 'wx');\n await handle.writeFile(`${process.pid}:${Date.now()}`);\n break;\n } catch (err) {\n const code = (err as NodeJS.ErrnoException).code;\n // ENOENT means the directory was deleted (e.g. by concurrent cleanup).\n // Recreate it and retry acquiring the lock.\n if (code === 'ENOENT') {\n await fs.mkdir(dir, { recursive: true });\n continue;\n }\n if (code !== 'EEXIST') throw err;\n try {\n const stat = await fs.stat(lockPath);\n if (Date.now() - stat.mtimeMs > staleMs) {\n await fs.unlink(lockPath);\n continue;\n }\n } catch {\n continue;\n }\n if (Date.now() - started >= timeoutMs) {\n throw new Error(`Timed out waiting for file lock: ${targetPath}`);\n }\n await new Promise((resolve) => setTimeout(resolve, 25));\n }\n }\n\n try {\n return await fn();\n } finally {\n try {\n await handle?.close();\n } catch {\n // ignore\n }\n try {\n await fs.unlink(lockPath);\n } catch {\n // ignore\n }\n }\n}\n\n// On Windows, fs.rename over an existing file can fail with EPERM/EBUSY/EACCES\n// when antivirus, file indexers, editor file watchers, or a concurrent writer\n// briefly hold a handle on the destination. These are transient — retry with a\n// short backoff before giving up. POSIX renames are atomic and won't hit this.\nconst TRANSIENT_RENAME_CODES = new Set(['EPERM', 'EBUSY', 'EACCES', 'ENOTEMPTY']);\n\nasync function renameWithRetry(from: string, to: string): Promise<void> {\n if (process.platform !== 'win32') {\n await fs.rename(from, to);\n return;\n }\n const delays = [10, 25, 60, 120, 250];\n let lastErr: unknown;\n for (let i = 0; i <= delays.length; i++) {\n try {\n await fs.rename(from, to);\n return;\n } catch (err) {\n lastErr = err;\n const code = (err as NodeJS.ErrnoException)?.code;\n if (!code || !TRANSIENT_RENAME_CODES.has(code) || i === delays.length) {\n throw err;\n }\n await new Promise((resolve) => setTimeout(resolve, delays[i]));\n }\n }\n throw lastErr;\n}\n","import * as fs from 'node:fs/promises';\nimport { atomicWrite } from './atomic-write.js';\n\nexport type JsonObject = Record<string, unknown>;\nexport type JsonPathSegment = string | number;\nexport type JsonPath = readonly JsonPathSegment[];\n\nexport async function readJsonObjectFile(filePath: string): Promise<JsonObject> {\n try {\n const parsed = JSON.parse(await fs.readFile(filePath, 'utf8')) as unknown;\n return isJsonObject(parsed) ? parsed : {};\n } catch {\n return {};\n }\n}\n\nexport async function jsonObjectFileExists(filePath: string): Promise<boolean> {\n try {\n await fs.access(filePath);\n return true;\n } catch {\n return false;\n }\n}\n\nexport async function writeJsonObjectFile(filePath: string, value: JsonObject): Promise<void> {\n await atomicWrite(filePath, JSON.stringify(value, null, 2), { mode: 0o600 });\n}\n\nexport async function updateJsonObjectFile(\n filePath: string,\n mutator: (config: JsonObject) => void | JsonObject | Promise<void | JsonObject>,\n): Promise<JsonObject> {\n const config = await readJsonObjectFile(filePath);\n const maybeNext = await mutator(config);\n const next = maybeNext && isJsonObject(maybeNext) ? maybeNext : config;\n await writeJsonObjectFile(filePath, next);\n return next;\n}\n\nexport function getJsonPath(root: unknown, path: JsonPath): unknown {\n let current = root;\n for (const segment of path) {\n if (typeof segment === 'number') {\n if (!Array.isArray(current)) return undefined;\n current = current[segment];\n continue;\n }\n if (!isJsonObject(current)) return undefined;\n current = current[segment];\n }\n return current;\n}\n\nexport function setJsonPath(root: JsonObject, path: JsonPath, value: unknown): JsonObject {\n if (path.length === 0) {\n if (!isJsonObject(value)) throw new Error('Root config value must be an object');\n return value;\n }\n const parent = ensureJsonParent(root, path);\n const leaf = lastPathSegment(path);\n if (typeof leaf === 'number') {\n if (!Array.isArray(parent)) throw new Error(`Cannot set numeric segment ${leaf} on non-array parent`);\n parent[leaf] = value;\n } else {\n if (!isJsonObject(parent)) throw new Error(`Cannot set property ${leaf} on non-object parent`);\n parent[leaf] = value;\n }\n return root;\n}\n\nexport function removeJsonPath(root: JsonObject, path: JsonPath): boolean {\n if (path.length === 0) return false;\n const parent = getJsonPath(root, path.slice(0, -1));\n const leaf = lastPathSegment(path);\n if (typeof leaf === 'number') {\n if (!Array.isArray(parent) || leaf < 0 || leaf >= parent.length) return false;\n parent.splice(leaf, 1);\n return true;\n }\n if (!isJsonObject(parent) || !(leaf in parent)) return false;\n delete parent[leaf];\n return true;\n}\n\nexport async function setJsonPathInFile(filePath: string, path: JsonPath, value: unknown): Promise<JsonObject> {\n return updateJsonObjectFile(filePath, (config) => setJsonPath(config, path, value));\n}\n\nexport async function removeJsonPathInFile(filePath: string, path: JsonPath): Promise<JsonObject> {\n return updateJsonObjectFile(filePath, (config) => {\n removeJsonPath(config, path);\n });\n}\n\nexport function isJsonObject(value: unknown): value is JsonObject {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction lastPathSegment(path: JsonPath): JsonPathSegment {\n const segment = path[path.length - 1];\n if (segment === undefined) throw new Error('Invalid empty JSON path');\n return segment;\n}\n\nfunction ensureJsonParent(root: JsonObject, path: JsonPath): JsonObject | unknown[] {\n let current: JsonObject | unknown[] = root;\n for (let i = 0; i < path.length - 1; i += 1) {\n const segment = path[i];\n const nextSegment = path[i + 1];\n if (segment === undefined) throw new Error('Invalid empty JSON path segment');\n const nextContainer = typeof nextSegment === 'number' ? [] : {};\n\n if (typeof segment === 'number') {\n if (!Array.isArray(current)) throw new Error(`Cannot traverse numeric segment ${segment} on non-array parent`);\n if (!isJsonObject(current[segment]) && !Array.isArray(current[segment])) current[segment] = nextContainer;\n current = current[segment] as JsonObject | unknown[];\n } else {\n if (!isJsonObject(current)) throw new Error(`Cannot traverse property ${segment} on non-object parent`);\n if (!isJsonObject(current[segment]) && !Array.isArray(current[segment])) current[segment] = nextContainer;\n current = current[segment] as JsonObject | unknown[];\n }\n }\n return current;\n}\n","import { expectDefined } from '../utils/expect-defined.js';\nimport { toErrorMessage } from '../utils/error.js';\nimport { ToolCapabilities } from '../security/capabilities.js';\n/**\n * `mcp_control` — LLM-driven MCP server lifecycle management.\n *\n * The model calls this tool to:\n * list — see all known servers (running or not) without starting any\n * search — filter the server catalog by name or description keyword\n * enable — start a server and register its tools\n * disable — stop a server and unregister its tools\n * restart — stop then re-start a running server\n *\n * This is the primary mechanism by which the LLM autonomously extends its\n * own capabilities at runtime — e.g. \"I need GitHub access, let me enable it.\"\n */\nimport { allServers } from '../infrastructure/mcp-servers.js';\nimport { readJsonObjectFile, setJsonPath, updateJsonObjectFile } from '../utils/config-json.js';\nimport type { Config, JSONSchema, MCPServerConfig, Tool } from '../index.js';\nexport interface MCPRegistryHandle {\n start(cfg: MCPServerConfig): Promise<void>;\n stop(name: string): Promise<void>;\n restart(name: string): Promise<void>;\n describe(): {\n name: string;\n state: string;\n toolCount: number;\n enabled: boolean;\n tools?: string[];\n }[];\n list(): { name: string; state: string; toolCount: number; tools?: string[] }[];\n /**\n * Register all cached tools for a server without restarting it.\n * No-op if the server is not connected or tools are already active.\n * Used in token-saving mode to temporarily expose MCP tools.\n */\n activateServer?(name: string): void;\n /**\n * Unregister all tools for a server without disconnecting it.\n * Returns the number of tools that were deactivated.\n * Used in token-saving mode to hide MCP tools after use.\n */\n deactivateServer?(name: string): number;\n /**\n * Check whether a server's tools are currently registered.\n */\n isActivated?(name: string): boolean;\n}\n\nexport interface CreateMcpControlToolOptions {\n /**\n * Read the current config object. The tool never mutates this directly —\n * writes go to the global config file via `configPath`.\n */\n getConfig: () => Config;\n /**\n * Path to ~/.wrongstack/config.json (or equivalent) for atomic config writes.\n */\n configPath: string;\n /**\n * Live MCP registry for runtime start/stop/restart. The tool calls these\n * immediately so the LLM sees the result of its action in the same turn.\n */\n registry: MCPRegistryHandle;\n}\n\nexport function createMcpControlTool(opts: CreateMcpControlToolOptions): Tool {\n const { getConfig, configPath, registry } = opts;\n\n const inputSchema: JSONSchema = {\n type: 'object',\n properties: {\n action: {\n type: 'string',\n enum: ['list', 'search', 'enable', 'disable', 'restart', 'activate', 'deactivate'],\n description: 'The management action to perform. activate/deactivate toggle tool registration ephemerally without disconnecting.',\n },\n /** Filter for `search`. Matches server name or description case-insensitively. */\n query: {\n type: 'string',\n description: 'Search term for `search` action. Matches server name or description.',\n },\n /** Target server name for `enable`, `disable`, `restart`, `activate`, `deactivate`. */\n server: {\n type: 'string',\n description: 'Server name (e.g. \"github\", \"filesystem\", \"brave-search\").',\n },\n },\n required: ['action'],\n };\n\n return {\n name: 'mcp_control',\n description:\n 'Manage MCP server lifecycle: list available servers, search by name or capability, enable or disable servers at runtime, restart running servers. Use activate/deactivate to ephemerally toggle tool registration without disconnecting — ideal for token-saving mode where MCP tools are lazy-loaded on demand. NOTE: `enable`/`restart` start a server process, which for the built-in stdio presets runs `npx -y <package>` — i.e. it fetches and executes an npm package from the network. Treat it as code execution.',\n category: 'mcp',\n permission: 'auto',\n mutating: true,\n // `enable`/`restart` spawn a server process that, for the stdio presets,\n // fetches and runs an npm package (`npx -y <pkg>`) — effectively remote\n // code execution. Marking the tool destructive means the YOLO\n // `confirmDestructive` safety net still prompts before it runs (plain\n // non-YOLO already confirms via the CONFIG_MUTATE dangerous-capability\n // net in the executor). Read-only actions (list/search) ride the same\n // tool but are cheap to confirm/trust once.\n riskTier: 'destructive',\n capabilities: [ToolCapabilities.CONFIG_MUTATE],\n inputSchema,\n async execute(raw) {\n const input = raw as { action: string; query?: string | undefined; server?: string | undefined };\n return mcpControlDispatch(input, { getConfig, configPath, registry });\n },\n };\n}\n\n// ── Dispatch ──────────────────────────────────────────────────────────────────\n\nasync function mcpControlDispatch(\n input: { action: string; query?: string | undefined; server?: string | undefined },\n deps: { getConfig: () => Config; configPath: string; registry: MCPRegistryHandle },\n): Promise<string> {\n const { action, query, server } = input;\n\n switch (action) {\n case 'list': return renderList(deps);\n case 'search': return renderSearch(query ?? '', deps);\n case 'enable': return server ? runEnable(server, deps) : '`server` is required for enable.';\n case 'disable': return server ? runDisable(server, deps) : '`server` is required for disable.';\n case 'restart': return server ? runRestart(server, deps) : '`server` is required for restart.';\n case 'activate': return server ? runActivate(server, deps) : '`server` is required for activate.';\n case 'deactivate': return server ? runDeactivate(server, deps) : '`server` is required for deactivate.';\n default:\n return `Unknown action \"${action}\". Use one of: list, search, enable, disable, restart, activate, deactivate.`;\n }\n}\n\n// ── Actions ───────────────────────────────────────────────────────────────────\n\nasync function renderList(deps: { getConfig: () => Config; configPath: string; registry: MCPRegistryHandle }): Promise<string> {\n const configured = await getConfiguredMcpServers(deps);\n const live = deps.registry.describe();\n\n if (Object.keys(configured).length === 0) {\n return [\n 'No MCP servers configured.',\n ' Use `mcp_control({ action: \"search\" })` to see available presets,',\n ' then `mcp_control({ action: \"enable\", server: \"<name>\" })` to add one.',\n ].join('\\n');\n }\n\n const lines: string[] = [];\n const liveMap = new Map(live.map((s) => [s.name, s]));\n\n for (const [name, cfg] of Object.entries(configured)) {\n const liveInfo = liveMap.get(name);\n const toolCount = liveInfo ? ` (${liveInfo.toolCount} tools)` : '';\n const stateStr = liveInfo ? badge(liveInfo.state) : dim('○ not loaded');\n const enabled = cfg.enabled === false\n ? `${dim('disabled')} `\n : `${green('● enabled')} `;\n lines.push(` ${bold(name)} ${enabled}${stateStr}${toolCount}`);\n if (cfg.description) lines.push(` ${dim(cfg.description)}`);\n }\n\n lines.push('');\n lines.push(dim(' Use `mcp_control({ action: \"search\", query: \"<keyword>\" })` to find servers.'));\n lines.push(dim(' Use `mcp_control({ action: \"enable\", server: \"<name>\" })` to start a server.'));\n return lines.join('\\n');\n}\n\nasync function renderSearch(\n query: string,\n deps: { getConfig: () => Config; configPath: string; registry: MCPRegistryHandle },\n): Promise<string> {\n const configured = await getConfiguredMcpServers(deps);\n const all = allServers();\n const q = query.toLowerCase();\n\n const configuredNames = new Set(Object.keys(configured));\n\n // Match against configured servers first, then remaining presets\n const configuredEntries = Object.entries(configured).filter(\n ([name, cfg]) =>\n name.toLowerCase().includes(q) ||\n (cfg.description ?? '').toLowerCase().includes(q),\n );\n\n const unconfiguredEntries = Object.entries(all)\n .filter(([name]) => !configuredNames.has(name))\n .filter(\n ([name, cfg]) =>\n name.toLowerCase().includes(q) ||\n (cfg.description ?? '').toLowerCase().includes(q),\n );\n\n const lines: string[] = [];\n\n if (configuredEntries.length > 0) {\n lines.push(bold('Configured servers matching \"') + query + '\":');\n for (const [name, cfg] of configuredEntries) {\n lines.push(` ${bold(name)} ${cfg.description ?? cfg.transport}`);\n }\n lines.push('');\n }\n\n if (unconfiguredEntries.length > 0) {\n lines.push(bold('Available presets matching \"') + query + '\":');\n for (const [name, cfg] of unconfiguredEntries) {\n const warn = cfg.permission === 'deny' ? red(' ⚠ confirm required') : '';\n lines.push(` ${bold(name)} ${cfg.description ?? cfg.transport}${warn}`);\n }\n lines.push('');\n }\n\n if (configuredEntries.length === 0 && unconfiguredEntries.length === 0) {\n return `No servers match \"${query}\". Try a shorter keyword or \\`mcp_control({ action: \"list\" })\\`.`;\n }\n\n const total = configuredEntries.length + unconfiguredEntries.length;\n lines.push(dim(` ${total} server${total !== 1 ? 's' : ''} shown. Run \\`enable\\` on one to activate it.`));\n return lines.join('\\n');\n}\n\nasync function runEnable(\n name: string | undefined,\n deps: { getConfig: () => Config; configPath: string; registry: MCPRegistryHandle },\n): Promise<string> {\n if (!name) return '`server` is required for enable. Example: { action: \"enable\", server: \"github\" }';\n\n const all = allServers();\n const configured = deps.getConfig().mcpServers ?? {};\n\n // Resolve the target config — it may be a preset not yet in config\n const cfg = configured[name] ?? all[name];\n if (!cfg) {\n const known = Object.keys(all).join(', ');\n return `Unknown server \"${name}\". Available presets: ${known}`;\n }\n\n // Write to config (add or update) using the shared JSON path helper.\n await updateJsonObjectFile(deps.configPath, (full) => {\n const current = isMcpServerRecord(full.mcpServers) ? full.mcpServers : {};\n setJsonPath(full, ['mcpServers', name], { ...current[name], ...cfg, enabled: true });\n });\n\n // Start the server in the registry\n try {\n const live = deps.registry.describe().find((s) => s.name === name);\n if (live && live.state === 'connected') {\n return `${green('●')} Server \"${name}\" is already running (${live.toolCount} tools registered).`;\n }\n await deps.registry.start({ ...cfg, enabled: true });\n const updated = deps.registry.describe().find((s) => s.name === name);\n return `${green('✓ Enabled and started')} \"${name}\"${updated ? ` (${updated.toolCount} tools registered).` : '.'}`;\n } catch (err) {\n return `${red('✗ Failed to start')} \"${name}\": ${toErrorMessage(err)}`;\n }\n}\n\nasync function runDisable(\n name: string | undefined,\n deps: { getConfig: () => Config; configPath: string; registry: MCPRegistryHandle },\n): Promise<string> {\n if (!name) return '`server` is required for disable. Example: { action: \"disable\", server: \"github\" }';\n\n const configured = deps.getConfig().mcpServers ?? {};\n if (!configured[name]) {\n return `Server \"${name}\" is not in config. Add it with \\`mcp_control({ action: \"enable\", server: \"${name}\" })\\`.`;\n }\n\n // Write to config using the shared JSON path helper.\n await updateJsonObjectFile(deps.configPath, (full) => {\n const current = isMcpServerRecord(full.mcpServers) ? full.mcpServers : {};\n const existing = expectDefined(current[name]);\n setJsonPath(full, ['mcpServers', name], { ...existing, enabled: false });\n });\n\n // Stop the running server\n try {\n await deps.registry.stop(name);\n return `${yellow('○ Disabled')} \"${name}\". It will not be started on next boot.`;\n } catch {\n return `${yellow('○ Disabled')} \"${name}\" (it was not running). Config updated.`;\n }\n}\n\nasync function runRestart(\n name: string | undefined,\n deps: { getConfig: () => Config; configPath: string; registry: MCPRegistryHandle },\n): Promise<string> {\n if (!name) return '`server` is required for restart. Example: { action: \"restart\", server: \"github\" }';\n\n const configured = deps.getConfig().mcpServers ?? {};\n if (!configured[name]) {\n return `Server \"${name}\" is not configured. Use \\`mcp_control({ action: \"enable\", server: \"${name}\" })\\` first.`;\n }\n\n try {\n await deps.registry.restart(name);\n const updated = deps.registry.describe().find((s) => s.name === name);\n return `${green('✓ Restarted')} \"${name}\"${updated ? ` (${updated.toolCount} tools registered).` : '.'}`;\n } catch (err) {\n return `${red('✗ Restart failed')} for \"${name}\": ${toErrorMessage(err)}`;\n }\n}\n\n/**\n * Ephemerally activate a server's tools without writing to config or\n * restarting the connection. The server must already be connected (lazy mode).\n * Calls `registry.activateServer()` when available; falls back to a message\n * if the registry doesn't support ephemeral activation.\n */\nasync function runActivate(\n name: string | undefined,\n deps: { registry: MCPRegistryHandle },\n): Promise<string> {\n if (!name) return '`server` is required for activate.';\n if (!deps.registry.activateServer) {\n return `Registry does not support ephemeral activation. Use \\`enable\\` to start \"${name}\" instead.`;\n }\n const live = deps.registry.describe().find((s) => s.name === name);\n if (!live) {\n return `Server \"${name}\" is not registered. Use \\`mcp_control({ action: \"enable\", server: \"${name}\" })\\` first.`;\n }\n if (live.state !== 'connected') {\n return `Server \"${name}\" is not connected (state: ${live.state}). Use \\`enable\\` to start it first.`;\n }\n if (deps.registry.isActivated?.(name)) {\n return `${green('●')} Server \"${name}\" tools are already active. Use \\`deactivate\\` to hide them.`;\n }\n deps.registry.activateServer(name);\n const updated = deps.registry.describe().find((s) => s.name === name);\n return `${green('✓ Activated')} \"${name}\" — ${updated?.toolCount ?? 0} tool(s) now registered. Use \\`mcp_control({ action: \"deactivate\", server: \"${name}\" })\\` to hide them when done.`;\n}\n\n/**\n * Ephemerally deactivate a server's tools without disconnecting.\n * Calls `registry.deactivateServer()` when available.\n */\nasync function runDeactivate(\n name: string | undefined,\n deps: { registry: MCPRegistryHandle },\n): Promise<string> {\n if (!name) return '`server` is required for deactivate.';\n if (!deps.registry.deactivateServer) {\n return `Registry does not support ephemeral deactivation. Use \\`disable\\` to stop \"${name}\" instead.`;\n }\n if (!deps.registry.isActivated?.(name)) {\n return `Server \"${name}\" tools are not currently active.`;\n }\n const count = deps.registry.deactivateServer(name);\n return `${yellow('○ Deactivated')} \"${name}\" — ${count} tool(s) unregistered. Server stays connected.`;\n}\n\n// ── Config helpers ──────────────────────────────────────────────────────────────\n\nasync function getConfiguredMcpServers(deps: { getConfig: () => Config; configPath: string }): Promise<Record<string, MCPServerConfig>> {\n const diskConfig = await readJsonObjectFile(deps.configPath);\n if (isMcpServerRecord(diskConfig.mcpServers)) return diskConfig.mcpServers;\n return deps.getConfig().mcpServers ?? {};\n}\n\nfunction isMcpServerRecord(value: unknown): value is Record<string, MCPServerConfig> {\n return !!value && typeof value === 'object' && !Array.isArray(value);\n}\n\n// ── Colour helpers (no dep on core color — inline) ───────────────────────────\n\nfunction bold(s: string) { return `\\x1b[1m${s}\\x1b[0m`; }\nfunction dim(s: string) { return `\\x1b[2m${s}\\x1b[0m`; }\nfunction green(s: string) { return `\\x1b[32m${s}\\x1b[0m`; }\nfunction yellow(s: string){ return `\\x1b[33m${s}\\x1b[0m`; }\nfunction red(s: string) { return `\\x1b[31m${s}\\x1b[0m`; }\n\nfunction badge(state: string): string {\n switch (state) {\n case 'connected': return green('● connected');\n case 'connecting': return `\\x1b[36m◐ connecting\\x1b[0m`;\n case 'reconnecting': return `\\x1b[36m◑ reconnecting\\x1b[0m`;\n case 'disconnected': return dim('○ disconnected');\n case 'failed': return red('✗ failed');\n default: return dim(state);\n }\n}\n"]}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
export { A as AgentError,
|
|
2
|
-
export { P as ProviderRunner, R as RunProviderOptions } from '../provider-runner-
|
|
3
|
-
export { A as
|
|
4
|
-
export { a as CompactReport, C as Compactor } from '../compactor-
|
|
5
|
-
export { a as PermissionDecision, P as PermissionPolicy, T as TrustPolicy } from '../permission-
|
|
1
|
+
export { A as AgentError, p as CacheTtl, n as Capabilities, z as ConfigError, i as ContentBlock, C as Context, B as ContextEvidenceState, D as ContextFileEvidence, E as ContextInit, F as ContextIntentEvidence, G as ContextRepeatedReadEvidence, H as ERROR_CODES, I as ErrorCode, K as ErrorSeverity, L as ErrorSubsystem, N as FileSnapshot, O as FsError, Q as ImageBlock, J as JSONSchema, V as JsonSchemaSpec, M as Message, W as MessageRole, h as Permission, X as PluginError, P as Provider, g as ProviderError, Y as ProviderErrorBody, a as ReasoningConfig, o as ReasoningEffort, R as ReasoningRequest, c as Request, _ as RequestCacheControl, d as Response, $ as ResponseFormat, u as ResumedSession, a0 as RiskTier, t as RunOptions, a2 as SafetySetting, a3 as SddError, v as SessionData, a4 as SessionError, S as SessionEvent, j as SessionMetadata, k as SessionStore, w as SessionSummary, b as SessionWriter, a7 as StopReason, a8 as StreamEvent, a9 as StreamHangError, q as TextBlock, aa as ThinkingBlock, x as TodoItem, T as Tool, ab as ToolCallContext, ac as ToolError, ad as ToolErrorCategory, ae as ToolErrorInfo, af as ToolEvidenceStatus, ag as ToolFinalEvent, ah as ToolIconId, m as ToolOutputMetadata, l as ToolProgressEvent, s as ToolResultBlock, ai as ToolStreamEvent, r as ToolUseBlock, U as Usage, aj as WrongStackError, ak as asBlocks, al as asText, an as isAgentError, ao as isConfigError, ap as isFsError, aq as isImageBlock, ar as isPluginError, as as isSddError, at as isSessionError, au as isTextBlock, av as isThinkingBlock, aw as isToolError, ax as isToolResultBlock, ay as isToolUseBlock, az as isWrongStackError, aA as toWrongStackError } from '../context-Dw55zZ_Q.js';
|
|
2
|
+
export { P as ProviderRunner, R as RunProviderOptions } from '../provider-runner-zVOn1p67.js';
|
|
3
|
+
export { A as AdaptiveConcurrencyConfig, o as AutonomyConfig, p as CONTEXT_WINDOW_MODES, q as CircuitBreakerRuntimeConfig, i as Config, k as ConfigLoader, j as ConfigStore, r as ContextConfig, C as ContextWindowAggressiveOn, s as ContextWindowConfigLike, t as ContextWindowMode, u as ContextWindowModeId, h as ContextWindowPolicy, v as ContextWindowThresholds, w as CustomModelDefinition, D as DEFAULT_CONTEXT_WINDOW_MODE_ID, x as DEFAULT_TUI_THINKING_WORD, F as FeaturesConfig, g as HookEntry, H as HookEvent, m as HookInput, f as HookMatcher, n as HookOutcome, y as HqClientConfig, I as InProcessHook, z as IndexingConfig, L as LaunchConfig, B as LogConfig, E as MAX_TUI_THINKING_WORD_LENGTH, c as MCPServerConfig, d as ModelMatrixEntry, G as ModelRuntimeCacheConfig, J as ModelRuntimeConfig, K as ModelRuntimeParametersConfig, N as ModelRuntimeReasoningConfig, e as ModelsDevModel, a as ModelsDevPayload, O as ModelsDevProvider, M as ModelsRegistry, Q as PluginConfig, U as ProviderApiKey, P as ProviderConfig, b as ResolvedModel, R as ResolvedProvider, V as SessionLoggingConfig, S as ShellHook, X as SyncCategory, l as SyncConfig, T as TokenSavingTier, Y as ToolsConfig, W as WireFamily, Z as formatContextWindowModeList, _ as getContextWindowMode, $ as isContextWindowModeId, a0 as listContextWindowModes, a1 as normalizeTokenSavingTier, a2 as normalizeTuiThinkingWord, a3 as resolveContextWindowPolicy } from '../config-rRS8yorV.js';
|
|
4
|
+
export { a as CompactReport, C as Compactor } from '../compactor-72ug-ZRB.js';
|
|
5
|
+
export { a as PermissionDecision, P as PermissionPolicy, T as TrustPolicy } from '../permission-CC7XFYWG.js';
|
|
6
6
|
export { C as CheckpointInfo, R as RewindResult, a as RewindResultExtended, S as SessionRewinder } from '../session-rewinder-C9HnMkhP.js';
|
|
7
|
-
export { a as AddAttachmentInput, c as Attachment, d as AttachmentKind, e as AttachmentMeta, b as AttachmentRef, A as AttachmentStore, D as DefaultSessionReader } from '../session-reader-
|
|
7
|
+
export { a as AddAttachmentInput, c as Attachment, d as AttachmentKind, e as AttachmentMeta, b as AttachmentRef, A as AttachmentStore, D as DefaultSessionReader } from '../session-reader-BepLSnGL.js';
|
|
8
8
|
export { D as DEFAULT_AUTONOMY_CONFIG, a as DEFAULT_CIRCUIT_BREAKER_CONFIG, b as DEFAULT_CONTEXT_CONFIG, c as DEFAULT_SESSION_LOGGING_CONFIG, d as DEFAULT_SESSION_PRUNE_DAYS, e as DEFAULT_TOOLS_CONFIG } from '../default-config-B0cj-Hry.js';
|
|
9
|
-
export { a as DefaultSecretScrubber, D as DefaultSecretVault, S as SecretVaultOptions, d as decryptConfigSecrets, e as encryptConfigSecrets, i as isSecretField, m as migratePlaintextSecrets, r as rewriteConfigEncrypted, b as rotateConfigKeys } from '../secret-vault-
|
|
9
|
+
export { a as DefaultSecretScrubber, D as DefaultSecretVault, S as SecretVaultOptions, d as decryptConfigSecrets, e as encryptConfigSecrets, i as isSecretField, m as migratePlaintextSecrets, r as rewriteConfigEncrypted, b as rotateConfigKeys } from '../secret-vault-eMBKfheR.js';
|
|
10
10
|
export { D as DefaultLogger, a as DefaultLoggerOptions, L as LogFormat, n as noOpLogger } from '../logger-DmmQhf4P.js';
|
|
11
|
-
export { D as DefaultPathResolver, a as DefaultTokenCounter } from '../path-resolver-
|
|
12
|
-
export { o as MEMORY_TYPE_LABELS, p as MemoryClearedPayload, q as MemoryConsolidatedPayload, b as MemoryEntry, r as MemoryForgottenPayload, s as MemoryPriority, d as MemoryRelevanceContext, t as MemoryRememberedPayload, M as MemoryScope, c as MemoryStore, u as MemoryType, S as ScoredEntry } from '../brain-
|
|
13
|
-
import { I as IterationStage, g as ParallelIterationStage } from '../parallel-eternal-engine-
|
|
14
|
-
export { C as CompactorOptions, D as DEFAULT_RECOVERY_STRATEGIES, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, R as RecoveryStrategy, T as ToolExecutor, h as buildRecoveryStrategies } from '../parallel-eternal-engine-
|
|
11
|
+
export { D as DefaultPathResolver, a as DefaultTokenCounter } from '../path-resolver-DrpF5MGK.js';
|
|
12
|
+
export { o as MEMORY_TYPE_LABELS, p as MemoryClearedPayload, q as MemoryConsolidatedPayload, b as MemoryEntry, r as MemoryForgottenPayload, s as MemoryPriority, d as MemoryRelevanceContext, t as MemoryRememberedPayload, M as MemoryScope, c as MemoryStore, u as MemoryType, S as ScoredEntry } from '../brain-etbcbRwV.js';
|
|
13
|
+
import { I as IterationStage, g as ParallelIterationStage } from '../parallel-eternal-engine-rItJBYp9.js';
|
|
14
|
+
export { C as CompactorOptions, D as DEFAULT_RECOVERY_STRATEGIES, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, R as RecoveryStrategy, T as ToolExecutor, h as buildRecoveryStrategies } from '../parallel-eternal-engine-rItJBYp9.js';
|
|
15
15
|
export { b as SkillEntry, S as SkillLoader, a as SkillManifest } from '../skill-DGIXCtdv.js';
|
|
16
|
-
export { B as BuildContext, b as ModelCapabilities, a as Renderer, S as SystemPromptBuilder } from '../pipeline-
|
|
16
|
+
export { B as BuildContext, b as ModelCapabilities, a as Renderer, S as SystemPromptBuilder } from '../pipeline-Ckkn3AOA.js';
|
|
17
17
|
export { I as InputReader, P as PromptOption } from '../input-reader-E-ffP2ee.js';
|
|
18
|
-
export { K as CoordinatorEvents, C as CoordinatorStatus, D as DoneCondition, o as MCPRegistryView, r as MetricsSinkView, c as MultiAgentConfig, M as MultiAgentCoordinator, u as Plugin, P as PluginAPI, s as PluginCapabilities, t as PluginDependency, l as PluginPipelines, a1 as ProviderFactory, n as ProviderRegistryView, q as SessionWriterView, k as SlashCommand, p as SlashCommandRegistryView, e as SpawnResult, S as SubagentConfig, R as SubagentContext, U as SubagentError, V as SubagentErrorKind, W as SubagentRunContext, X as SubagentRunOutcome, d as SubagentRunner, _ as TaskDelegation, f as TaskResult, T as TaskSpec, m as ToolRegistryView } from '../agent-subagent-runner-
|
|
19
|
-
export { D as DefaultModelsRegistry, a as DefaultModelsRegistryOptions, c as classifyFamily } from '../models-registry-
|
|
18
|
+
export { K as CoordinatorEvents, C as CoordinatorStatus, D as DoneCondition, o as MCPRegistryView, r as MetricsSinkView, c as MultiAgentConfig, M as MultiAgentCoordinator, u as Plugin, P as PluginAPI, s as PluginCapabilities, t as PluginDependency, l as PluginPipelines, a1 as ProviderFactory, n as ProviderRegistryView, q as SessionWriterView, k as SlashCommand, p as SlashCommandRegistryView, e as SpawnResult, S as SubagentConfig, R as SubagentContext, U as SubagentError, V as SubagentErrorKind, W as SubagentRunContext, X as SubagentRunOutcome, d as SubagentRunner, _ as TaskDelegation, f as TaskResult, T as TaskSpec, m as ToolRegistryView } from '../agent-subagent-runner-BZa_IEcd.js';
|
|
19
|
+
export { D as DefaultModelsRegistry, a as DefaultModelsRegistryOptions, c as classifyFamily } from '../models-registry-CXQFUn5t.js';
|
|
20
20
|
export { D as DEFAULT_MODES, b as Mode, a as ModeConfig, c as ModeManifest, M as ModeStore } from '../mode-CZlO9iU1.js';
|
|
21
|
-
export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-
|
|
21
|
+
export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-DFQYEeXf.js';
|
|
22
22
|
export { D as DEFAULT_SPEC_TEMPLATE, S as SpecAnalysis, a as SpecApiEndpoint, b as SpecRequirement, c as SpecSection, d as SpecSectionType, e as SpecStatus, f as SpecTemplate, g as SpecValidationResult, h as Specification } from '../spec-TBi3Jr6T.js';
|
|
23
23
|
export { C as CriticalPathResult, f as TaskAssignment, g as TaskDependency, h as TaskEdge, i as TaskFilter, d as TaskGraph, e as TaskNode, a as TaskPriority, c as TaskProgress, j as TaskSort, b as TaskStatus, T as TaskType, k as computeTaskProgress, l as findCriticalPath, t as topologicalSort } from '../task-graph-u1q9Jkyk.js';
|
|
24
24
|
export { A as AggregateHealth, a as HealthCheck, b as HealthCheckResult, H as HealthRegistry, c as HealthStatus, d as MetricLabels, e as MetricSeries, M as MetricsSink, f as MetricsSnapshot, S as Span, T as Tracer } from '../observability-D-HZN_mF.js';
|
|
25
|
-
export { S as SystemPromptContributor } from '../index-
|
|
25
|
+
export { S as SystemPromptContributor } from '../index-DWm_PE9L.js';
|
|
26
26
|
import '../logger-B63L5bTg.js';
|
|
27
|
-
import '../retry-policy-
|
|
27
|
+
import '../retry-policy-BV7nzeAd.js';
|
|
28
28
|
import '../secret-vault-BAKpgFw_.js';
|
|
29
29
|
import '../path-resolver-CPRj4bFY.js';
|
|
30
|
-
import '../goal-store-
|
|
31
|
-
import '../multi-agent-coordinator-
|
|
30
|
+
import '../goal-store-CWlbT0TO.js';
|
|
31
|
+
import '../multi-agent-coordinator-jyimfo7D.js';
|
|
32
32
|
import 'node:events';
|
|
33
33
|
import '../mailbox-types-Ct2hJq0P.js';
|
|
34
34
|
|