@tangle-network/agent-runtime 0.45.0 → 0.47.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/README.md +3 -3
  2. package/dist/agent.d.ts +5 -5
  3. package/dist/agent.js +2 -2
  4. package/dist/agent.js.map +1 -1
  5. package/dist/analyst-loop.d.ts +5 -40
  6. package/dist/analyst-loop.js +2 -4
  7. package/dist/{chunk-IJ6FGOPO.js → chunk-5YDS7BLC.js} +12 -7
  8. package/dist/chunk-5YDS7BLC.js.map +1 -0
  9. package/dist/{chunk-KEWO4KI6.js → chunk-72JQCHOZ.js} +850 -131
  10. package/dist/chunk-72JQCHOZ.js.map +1 -0
  11. package/dist/{chunk-PRX45WE2.js → chunk-GSUO5QS6.js} +1 -119
  12. package/dist/chunk-GSUO5QS6.js.map +1 -0
  13. package/dist/{chunk-FK53TXOP.js → chunk-HNUXAZIJ.js} +4 -27
  14. package/dist/chunk-HNUXAZIJ.js.map +1 -0
  15. package/dist/{chunk-IJGS6J7X.js → chunk-JNPK46YH.js} +2 -2
  16. package/dist/{chunk-QR4UUC5P.js → chunk-KADIJAD4.js} +33 -19
  17. package/dist/chunk-KADIJAD4.js.map +1 -0
  18. package/dist/{chunk-NYN5RTLP.js → chunk-MGFEUYOH.js} +7 -7
  19. package/dist/chunk-MGFEUYOH.js.map +1 -0
  20. package/dist/{chunk-Z2QXVBA6.js → chunk-T4OQQEE3.js} +4 -4
  21. package/dist/chunk-T4OQQEE3.js.map +1 -0
  22. package/dist/{chunk-KSMX62JF.js → chunk-VR4JIC5H.js} +2 -2
  23. package/dist/{coder-CczgMqFx.d.ts → coder-CVZNGbyg.d.ts} +1 -1
  24. package/dist/{dynamic-BvllHV6M.d.ts → driver-DYU2sgHr.d.ts} +6 -6
  25. package/dist/{improvement-adapter-CWegd3vw.d.ts → improvement-adapter-BC4HhuAR.d.ts} +1 -1
  26. package/dist/improvement.d.ts +2 -2
  27. package/dist/index.d.ts +8 -8
  28. package/dist/index.js +8 -8
  29. package/dist/{kb-gate-D9GBocLN.d.ts → kb-gate-51BlLlVM.d.ts} +13 -7
  30. package/dist/{loop-runner-bin-CPrCoKqC.d.ts → loop-runner-bin-DEm4roYF.d.ts} +11 -11
  31. package/dist/loop-runner-bin.d.ts +6 -6
  32. package/dist/loop-runner-bin.js +6 -6
  33. package/dist/loops.d.ts +5 -5
  34. package/dist/loops.js +18 -10
  35. package/dist/mcp/bin.js +6 -6
  36. package/dist/mcp/bin.js.map +1 -1
  37. package/dist/mcp/index.d.ts +75 -74
  38. package/dist/mcp/index.js +203 -31
  39. package/dist/mcp/index.js.map +1 -1
  40. package/dist/{otel-export-Dy2DyUCU.d.ts → otel-export-EzfsVUhh.d.ts} +1 -1
  41. package/dist/profiles.d.ts +8 -8
  42. package/dist/profiles.js +1 -1
  43. package/dist/profiles.js.map +1 -1
  44. package/dist/{run-loop--hSoIknW.d.ts → run-loop-DvD4aGiE.d.ts} +2 -2
  45. package/dist/runtime.d.ts +244 -57
  46. package/dist/runtime.js +18 -10
  47. package/dist/{types-1HbsFa7H.d.ts → types-Cbx3dNK5.d.ts} +23 -23
  48. package/dist/{types-DdzkffAm.d.ts → types-nBMuollC.d.ts} +34 -5
  49. package/dist/{types-BtRLF2U3.d.ts → types-p8dWBIXL.d.ts} +1 -1
  50. package/dist/workflow.d.ts +3 -3
  51. package/dist/workflow.js +2 -2
  52. package/dist/workflow.js.map +1 -1
  53. package/package.json +1 -1
  54. package/skills/agent-runtime-adoption/SKILL.md +3 -3
  55. package/skills/generate-eval/SKILL.md +60 -0
  56. package/skills/loop-writer/SKILL.md +163 -0
  57. package/dist/chunk-FK53TXOP.js.map +0 -1
  58. package/dist/chunk-IJ6FGOPO.js.map +0 -1
  59. package/dist/chunk-KEWO4KI6.js.map +0 -1
  60. package/dist/chunk-NYN5RTLP.js.map +0 -1
  61. package/dist/chunk-PRX45WE2.js.map +0 -1
  62. package/dist/chunk-QR4UUC5P.js.map +0 -1
  63. package/dist/chunk-Z2QXVBA6.js.map +0 -1
  64. /package/dist/{chunk-IJGS6J7X.js.map → chunk-JNPK46YH.js.map} +0 -0
  65. /package/dist/{chunk-KSMX62JF.js.map → chunk-VR4JIC5H.js.map} +0 -0
package/dist/loops.js CHANGED
@@ -9,11 +9,11 @@ import {
9
9
  assertTraceDerivedFindings,
10
10
  buildSteerContext,
11
11
  builtinShapes,
12
- cliExecutor,
13
12
  completionAuthorizes,
14
13
  contentAddress,
15
14
  createBudgetPool,
16
- createDynamicDriver,
15
+ createDriver,
16
+ createExecutor,
17
17
  createExecutorRegistry,
18
18
  createRootHandle,
19
19
  createSandboxForSpec,
@@ -28,21 +28,25 @@ import {
28
28
  equalKOnCost,
29
29
  fanout,
30
30
  flatWidenGate,
31
+ gitWorkspace,
32
+ inlineSandboxClient,
33
+ localShell,
31
34
  loopDispatch,
32
35
  loopUntil,
33
36
  materializeTreeView,
37
+ observe,
38
+ openSandboxRun,
34
39
  panel,
35
40
  pipeline,
36
41
  probeSandboxCapabilities,
37
42
  registerShape,
38
43
  renderAnalyses,
39
44
  renderCorpusToInstructions,
45
+ renderReport,
40
46
  replaySpawnTree,
41
47
  reportLoopUsage,
42
- routerInlineExecutor,
43
48
  runLoop,
44
49
  runPersonified,
45
- sandboxExecutor,
46
50
  sentinelCompletion,
47
51
  settledToIteration,
48
52
  spendFromUsageEvents,
@@ -50,11 +54,11 @@ import {
50
54
  trajectoryReport,
51
55
  verify,
52
56
  widen
53
- } from "./chunk-KEWO4KI6.js";
57
+ } from "./chunk-72JQCHOZ.js";
54
58
  import {
55
59
  extractLlmCallEvent,
56
60
  mapSandboxEvent
57
- } from "./chunk-PRX45WE2.js";
61
+ } from "./chunk-GSUO5QS6.js";
58
62
  import "./chunk-DGUM43GV.js";
59
63
  export {
60
64
  FileCorpus,
@@ -67,11 +71,11 @@ export {
67
71
  assertTraceDerivedFindings,
68
72
  buildSteerContext,
69
73
  builtinShapes,
70
- cliExecutor,
71
74
  completionAuthorizes,
72
75
  contentAddress,
73
76
  createBudgetPool,
74
- createDynamicDriver,
77
+ createDriver,
78
+ createExecutor,
75
79
  createExecutorRegistry,
76
80
  createRootHandle,
77
81
  createSandboxForSpec,
@@ -87,22 +91,26 @@ export {
87
91
  extractLlmCallEvent,
88
92
  fanout,
89
93
  flatWidenGate,
94
+ gitWorkspace,
95
+ inlineSandboxClient,
96
+ localShell,
90
97
  loopDispatch,
91
98
  loopUntil,
92
99
  mapSandboxEvent,
93
100
  materializeTreeView,
101
+ observe,
102
+ openSandboxRun,
94
103
  panel,
95
104
  pipeline,
96
105
  probeSandboxCapabilities,
97
106
  registerShape,
98
107
  renderAnalyses,
99
108
  renderCorpusToInstructions,
109
+ renderReport,
100
110
  replaySpawnTree,
101
111
  reportLoopUsage,
102
- routerInlineExecutor,
103
112
  runLoop,
104
113
  runPersonified,
105
- sandboxExecutor,
106
114
  sentinelCompletion,
107
115
  settledToIteration,
108
116
  spendFromUsageEvents,
package/dist/mcp/bin.js CHANGED
@@ -4,18 +4,18 @@ import {
4
4
  createPropagatingTraceEmitter,
5
5
  detectExecutor,
6
6
  readTraceContextFromEnv
7
- } from "../chunk-Z2QXVBA6.js";
7
+ } from "../chunk-T4OQQEE3.js";
8
8
  import "../chunk-WIR4HOOJ.js";
9
- import "../chunk-IJGS6J7X.js";
9
+ import "../chunk-JNPK46YH.js";
10
10
  import {
11
11
  createDefaultCoderDelegate
12
- } from "../chunk-IJ6FGOPO.js";
13
- import "../chunk-QR4UUC5P.js";
12
+ } from "../chunk-5YDS7BLC.js";
13
+ import "../chunk-KADIJAD4.js";
14
14
  import "../chunk-GLR25NG7.js";
15
15
  import {
16
16
  runLoop
17
- } from "../chunk-KEWO4KI6.js";
18
- import "../chunk-PRX45WE2.js";
17
+ } from "../chunk-72JQCHOZ.js";
18
+ import "../chunk-GSUO5QS6.js";
19
19
  import "../chunk-DGUM43GV.js";
20
20
 
21
21
  // src/mcp/bin.ts
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/mcp/bin.ts"],"sourcesContent":["#!/usr/bin/env node\n\n/**\n * @experimental\n *\n * `agent-runtime-mcp` — stdio MCP server entry point.\n *\n * Spins up a server with the default coder delegate (wired against the\n * real `@tangle-network/sandbox` client) and, when the optional\n * `@tangle-network/agent-knowledge` peer is installed, a researcher\n * delegate against `multiHarnessResearcherFanout`.\n *\n * Environment variables:\n * TANGLE_API_KEY required — passed to `new Sandbox({ apiKey })`\n * SANDBOX_BASE_URL optional — sandbox-SDK base URL override\n * TANGLE_FLEET_ID optional — when set, delegations dispatch\n * INTO this fleet's shared workspace instead\n * of creating sibling sandboxes. Set by the\n * parent sandbox when launching this MCP\n * server so worker diffs land on the caller's\n * filesystem with no cross-sandbox boundary.\n * TANGLE_FLEET_EXCLUDE_MACHINES optional — comma-separated machine ids to\n * skip during fleet-mode round-robin\n * (typically the coordinator machine this\n * MCP server is running on).\n * MCP_MAX_CONCURRENT_SANDBOXES default 4 — kernel maxConcurrency cap\n * MCP_CODER_FANOUT_HARNESSES comma-separated harness ids to use for variants > 1\n * MCP_DISABLE_CODER set to `1` to omit `delegate_code`\n * MCP_DISABLE_RESEARCHER set to `1` to omit `delegate_research` even when peer is present\n */\n\nimport type { LoopSandboxClient, LoopTraceEmitter } from '../runtime'\nimport { runLoop } from '../runtime'\nimport { detectExecutor } from './bin-helpers'\nimport { createDefaultCoderDelegate, type ResearcherDelegate } from './delegates'\nimport type { DelegationExecutor } from './executor'\nimport { createMcpServer } from './server'\nimport { createPropagatingTraceEmitter, readTraceContextFromEnv } from './trace-propagation'\nimport type { ResearchOutputShape } from './types'\n\nasync function main(): Promise<void> {\n const fanoutHarnesses = parseHarnesses(process.env.MCP_CODER_FANOUT_HARNESSES)\n const maxConcurrency = parseConcurrency(process.env.MCP_MAX_CONCURRENT_SANDBOXES)\n const wantCoder = !process.env.MCP_DISABLE_CODER\n const wantResearcher = !process.env.MCP_DISABLE_RESEARCHER\n const fleetId = parseFleetId(process.env.TANGLE_FLEET_ID)\n\n // Skip the sandbox client load entirely when no profile delegate needs it —\n // the feedback + status + history tools are queue-bound and require no\n // sandbox. Useful for tooling that mounts the MCP server purely for\n // self-introspection.\n const needsSandbox = wantCoder || wantResearcher\n let sandboxClient: LoopSandboxClient | undefined\n let executor: DelegationExecutor | undefined\n if (needsSandbox) {\n const apiKey = process.env.TANGLE_API_KEY\n if (!apiKey && !process.env.AGENT_RUNTIME_MCP_ALLOW_NO_KEY) {\n process.stderr.write(\n 'agent-runtime-mcp: TANGLE_API_KEY is required. Set AGENT_RUNTIME_MCP_ALLOW_NO_KEY=1 to run without it for diagnostics, or MCP_DISABLE_CODER=1 MCP_DISABLE_RESEARCHER=1 to run the queue-only subset.\\n',\n )\n process.exit(2)\n }\n // Fleet mode against a diagnostic stub is meaningless — the stub can't\n // resolve a real fleet handle. Refuse rather than silently degrading,\n // otherwise a fleet-mounted MCP would behave differently than configured.\n if (fleetId && !apiKey) {\n process.stderr.write(\n 'agent-runtime-mcp: TANGLE_FLEET_ID was set but TANGLE_API_KEY is missing; cannot resolve fleet handle. Provide an api key or unset TANGLE_FLEET_ID.\\n',\n )\n process.exit(2)\n }\n sandboxClient = await loadSandboxClient(apiKey)\n executor = await detectExecutor({ sandboxClient })\n if (fleetId) {\n process.stderr.write(`agent-runtime-mcp: fleet-aware delegation: fleetId=${fleetId}\\n`)\n }\n process.stderr.write(`agent-runtime-mcp: delegation placement → ${executor.describe()}\\n`)\n }\n\n // Export delegated-loop topology spans to the OTLP / Tangle Intelligence sink\n // when OTEL_EXPORTER_OTLP_ENDPOINT is set (+ TRACE_ID / PARENT_SPAN_ID for\n // correlation with the caller's trace). A cheap no-op when the endpoint is\n // unset — the fleet forwards the env into this MCP's process to turn it on.\n const { emitter: traceEmitter, exporter: traceExporter } = createPropagatingTraceEmitter(\n readTraceContextFromEnv(),\n )\n if (process.env.OTEL_EXPORTER_OTLP_ENDPOINT) {\n process.stderr.write(\n `agent-runtime-mcp: exporting loop topology → ${process.env.OTEL_EXPORTER_OTLP_ENDPOINT}\\n`,\n )\n }\n\n const coderDelegate =\n wantCoder && executor\n ? createDefaultCoderDelegate({\n executor,\n fanoutHarnesses,\n maxConcurrency,\n traceEmitter,\n })\n : undefined\n\n const researcherDelegate =\n wantResearcher && executor\n ? await loadResearcherDelegate(executor.client, maxConcurrency, traceEmitter)\n : undefined\n\n const server = createMcpServer({ coderDelegate, researcherDelegate })\n\n const shutdown = () => {\n server.stop()\n void traceExporter?.shutdown().finally(() => process.exit(0))\n if (!traceExporter) process.exit(0)\n }\n process.on('SIGINT', shutdown)\n process.on('SIGTERM', shutdown)\n\n await server.serve()\n}\n\nasync function loadSandboxClient(apiKey: string | undefined): Promise<LoopSandboxClient> {\n // Diagnostic mode: AGENT_RUNTIME_MCP_ALLOW_NO_KEY=1 enables tools/list + the\n // queue-bound tools (status / history / feedback) without sandbox creds.\n // Coder + researcher delegations require a real client; the stub fails loud\n // at create() so the agent observes the cause instead of silent success.\n if (!apiKey) {\n return {\n async create() {\n throw new Error(\n 'agent-runtime-mcp: TANGLE_API_KEY is unset; coder/researcher delegations are disabled in diagnostic mode. Set TANGLE_API_KEY or use MCP_DISABLE_CODER=1 MCP_DISABLE_RESEARCHER=1 to remove the unsupported tools from the tool list.',\n )\n },\n } satisfies LoopSandboxClient\n }\n // Dynamic import keeps the bin importable in environments that haven't\n // installed `@tangle-network/sandbox` yet (the runtime package lists it\n // as a peer dep, not a hard dep).\n const mod = await import('@tangle-network/sandbox').catch((err) => {\n process.stderr.write(\n `agent-runtime-mcp: failed to load @tangle-network/sandbox (${err.message}); install the peer dependency\\n`,\n )\n process.exit(2)\n })\n const SandboxCtor = (mod as { Sandbox?: new (config: unknown) => LoopSandboxClient }).Sandbox\n if (!SandboxCtor) {\n process.stderr.write(\n 'agent-runtime-mcp: @tangle-network/sandbox does not export Sandbox; cannot construct client\\n',\n )\n process.exit(2)\n }\n const baseUrl = process.env.SANDBOX_BASE_URL\n return new SandboxCtor({\n apiKey,\n ...(baseUrl ? { baseUrl } : {}),\n })\n}\n\ninterface ResearcherProfilePreset {\n agentRunSpec: Parameters<typeof runLoop>[0]['agentRun'] extends infer T ? NonNullable<T> : never\n output: Parameters<typeof runLoop>[0]['output']\n validator: Parameters<typeof runLoop>[0]['validator']\n}\n\ninterface ResearcherFanoutPreset {\n agentRuns: NonNullable<Parameters<typeof runLoop>[0]['agentRuns']>\n output: Parameters<typeof runLoop>[0]['output']\n validator: Parameters<typeof runLoop>[0]['validator']\n driver: Parameters<typeof runLoop>[0]['driver']\n}\n\nasync function loadResearcherDelegate(\n sandboxClient: LoopSandboxClient,\n maxConcurrency: number,\n traceEmitter?: LoopTraceEmitter,\n): Promise<ResearcherDelegate | undefined> {\n // Optional peer — when `@tangle-network/agent-knowledge` isn't installed,\n // we silently omit the researcher tool from the advertisement. The\n // dynamic-import path is resolved at runtime; TypeScript cannot see the\n // peer, so we type the module structurally rather than via its own\n // declaration file.\n const profilesSpecifier = '@tangle-network/agent-knowledge/profiles'\n const mod = await import(profilesSpecifier).catch(() => undefined)\n if (!mod) return undefined\n type SingleFactory = (opts: { task: unknown }) => ResearcherProfilePreset\n type FanoutFactory = (opts: { task: unknown }) => ResearcherFanoutPreset\n const fanoutFactory = (mod as { multiHarnessResearcherFanout?: FanoutFactory })\n .multiHarnessResearcherFanout\n const singleFactory = (mod as { researcherProfile?: SingleFactory }).researcherProfile\n if (!fanoutFactory || !singleFactory) return undefined\n\n return async (args, ctx) => {\n const task = {\n question: args.question,\n knowledgeNamespace: args.namespace,\n scope: args.scope,\n sources: args.sources,\n recencyWindow: args.config?.recencyWindow\n ? {\n since: args.config.recencyWindow.since\n ? new Date(args.config.recencyWindow.since)\n : undefined,\n until: args.config.recencyWindow.until\n ? new Date(args.config.recencyWindow.until)\n : undefined,\n }\n : undefined,\n maxItems: args.config?.maxItems,\n minConfidence: args.config?.minConfidence,\n }\n const variants = Math.max(1, Math.trunc(args.variants ?? 1))\n ctx.report({ iteration: 0, phase: 'starting' })\n if (variants <= 1) {\n const preset = singleFactory({ task })\n const result = await runLoop({\n driver: {\n name: 'mcp-researcher-single',\n async plan(t, history) {\n return history.length === 0 ? [t] : []\n },\n decide(history) {\n return history.length > 0 ? 'pick-winner' : 'fail'\n },\n },\n agentRun: preset.agentRunSpec,\n output: preset.output,\n validator: preset.validator,\n task,\n ctx: { sandboxClient, signal: ctx.signal, ...(traceEmitter ? { traceEmitter } : {}) },\n maxIterations: 1,\n maxConcurrency,\n })\n const output = result.winner?.output\n if (!output) throw new Error('researcher delegate produced no winner')\n ctx.report({ iteration: 1, phase: 'completed' })\n return output as ResearchOutputShape\n }\n const fanout = fanoutFactory({ task })\n const result = await runLoop({\n driver: fanout.driver,\n agentRuns: fanout.agentRuns.slice(0, variants),\n output: fanout.output,\n validator: fanout.validator,\n task,\n ctx: { sandboxClient, signal: ctx.signal, ...(traceEmitter ? { traceEmitter } : {}) },\n maxIterations: variants,\n maxConcurrency: Math.min(maxConcurrency, variants),\n })\n const output = result.winner?.output\n if (!output) throw new Error('researcher delegate fanout produced no winner')\n ctx.report({ iteration: result.iterations.length, phase: 'completed' })\n return output as ResearchOutputShape\n }\n}\n\nfunction parseHarnesses(raw: string | undefined): string[] | undefined {\n if (!raw) return undefined\n const list = raw\n .split(',')\n .map((entry) => entry.trim())\n .filter(Boolean)\n return list.length > 0 ? list : undefined\n}\n\nfunction parseFleetId(raw: string | undefined): string | undefined {\n if (typeof raw !== 'string') return undefined\n const trimmed = raw.trim()\n return trimmed.length > 0 ? trimmed : undefined\n}\n\nfunction parseConcurrency(raw: string | undefined): number {\n if (!raw) return 4\n const n = Number(raw)\n if (!Number.isFinite(n) || n < 1) return 4\n return Math.min(Math.trunc(n), 32)\n}\n\nmain().catch((err) => {\n process.stderr.write(`agent-runtime-mcp: ${err instanceof Error ? err.stack : String(err)}\\n`)\n process.exit(1)\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAwCA,eAAe,OAAsB;AACnC,QAAM,kBAAkB,eAAe,Q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usr/bin/env node\n\n/**\n * @experimental\n *\n * `agent-runtime-mcp` — stdio MCP server entry point.\n *\n * Spins up a server with the default coder delegate (wired against the\n * real `@tangle-network/sandbox` client) and, when the optional\n * `@tangle-network/agent-knowledge` peer is installed, a researcher\n * delegate against `multiHarnessResearcherFanout`.\n *\n * Environment variables:\n * TANGLE_API_KEY required — passed to `new Sandbox({ apiKey })`\n * SANDBOX_BASE_URL optional — sandbox-SDK base URL override\n * TANGLE_FLEET_ID optional — when set, delegations dispatch\n * INTO this fleet's shared workspace instead\n * of creating sibling sandboxes. Set by the\n * parent sandbox when launching this MCP\n * server so worker diffs land on the caller's\n * filesystem with no cross-sandbox boundary.\n * TANGLE_FLEET_EXCLUDE_MACHINES optional — comma-separated machine ids to\n * skip during fleet-mode round-robin\n * (typically the coordinator machine this\n * MCP server is running on).\n * MCP_MAX_CONCURRENT_SANDBOXES default 4 — kernel maxConcurrency cap\n * MCP_CODER_FANOUT_HARNESSES comma-separated harness ids to use for variants > 1\n * MCP_DISABLE_CODER set to `1` to omit `delegate_code`\n * MCP_DISABLE_RESEARCHER set to `1` to omit `delegate_research` even when peer is present\n */\n\nimport type { LoopTraceEmitter, SandboxClient } from '../runtime'\nimport { runLoop } from '../runtime'\nimport { detectExecutor } from './bin-helpers'\nimport { createDefaultCoderDelegate, type ResearcherDelegate } from './delegates'\nimport type { DelegationExecutor } from './executor'\nimport { createMcpServer } from './server'\nimport { createPropagatingTraceEmitter, readTraceContextFromEnv } from './trace-propagation'\nimport type { ResearchOutputShape } from './types'\n\nasync function main(): Promise<void> {\n const fanoutHarnesses = parseHarnesses(process.env.MCP_CODER_FANOUT_HARNESSES)\n const maxConcurrency = parseConcurrency(process.env.MCP_MAX_CONCURRENT_SANDBOXES)\n const wantCoder = !process.env.MCP_DISABLE_CODER\n const wantResearcher = !process.env.MCP_DISABLE_RESEARCHER\n const fleetId = parseFleetId(process.env.TANGLE_FLEET_ID)\n\n // Skip the sandbox client load entirely when no profile delegate needs it —\n // the feedback + status + history tools are queue-bound and require no\n // sandbox. Useful for tooling that mounts the MCP server purely for\n // self-introspection.\n const needsSandbox = wantCoder || wantResearcher\n let sandboxClient: SandboxClient | undefined\n let executor: DelegationExecutor | undefined\n if (needsSandbox) {\n const apiKey = process.env.TANGLE_API_KEY\n if (!apiKey && !process.env.AGENT_RUNTIME_MCP_ALLOW_NO_KEY) {\n process.stderr.write(\n 'agent-runtime-mcp: TANGLE_API_KEY is required. Set AGENT_RUNTIME_MCP_ALLOW_NO_KEY=1 to run without it for diagnostics, or MCP_DISABLE_CODER=1 MCP_DISABLE_RESEARCHER=1 to run the queue-only subset.\\n',\n )\n process.exit(2)\n }\n // Fleet mode against a diagnostic stub is meaningless — the stub can't\n // resolve a real fleet handle. Refuse rather than silently degrading,\n // otherwise a fleet-mounted MCP would behave differently than configured.\n if (fleetId && !apiKey) {\n process.stderr.write(\n 'agent-runtime-mcp: TANGLE_FLEET_ID was set but TANGLE_API_KEY is missing; cannot resolve fleet handle. Provide an api key or unset TANGLE_FLEET_ID.\\n',\n )\n process.exit(2)\n }\n sandboxClient = await loadSandboxClient(apiKey)\n executor = await detectExecutor({ sandboxClient })\n if (fleetId) {\n process.stderr.write(`agent-runtime-mcp: fleet-aware delegation: fleetId=${fleetId}\\n`)\n }\n process.stderr.write(`agent-runtime-mcp: delegation placement → ${executor.describe()}\\n`)\n }\n\n // Export delegated-loop topology spans to the OTLP / Tangle Intelligence sink\n // when OTEL_EXPORTER_OTLP_ENDPOINT is set (+ TRACE_ID / PARENT_SPAN_ID for\n // correlation with the caller's trace). A cheap no-op when the endpoint is\n // unset — the fleet forwards the env into this MCP's process to turn it on.\n const { emitter: traceEmitter, exporter: traceExporter } = createPropagatingTraceEmitter(\n readTraceContextFromEnv(),\n )\n if (process.env.OTEL_EXPORTER_OTLP_ENDPOINT) {\n process.stderr.write(\n `agent-runtime-mcp: exporting loop topology → ${process.env.OTEL_EXPORTER_OTLP_ENDPOINT}\\n`,\n )\n }\n\n const coderDelegate =\n wantCoder && executor\n ? createDefaultCoderDelegate({\n executor,\n fanoutHarnesses,\n maxConcurrency,\n traceEmitter,\n })\n : undefined\n\n const researcherDelegate =\n wantResearcher && executor\n ? await loadResearcherDelegate(executor.client, maxConcurrency, traceEmitter)\n : undefined\n\n const server = createMcpServer({ coderDelegate, researcherDelegate })\n\n const shutdown = () => {\n server.stop()\n void traceExporter?.shutdown().finally(() => process.exit(0))\n if (!traceExporter) process.exit(0)\n }\n process.on('SIGINT', shutdown)\n process.on('SIGTERM', shutdown)\n\n await server.serve()\n}\n\nasync function loadSandboxClient(apiKey: string | undefined): Promise<SandboxClient> {\n // Diagnostic mode: AGENT_RUNTIME_MCP_ALLOW_NO_KEY=1 enables tools/list + the\n // queue-bound tools (status / history / feedback) without sandbox creds.\n // Coder + researcher delegations require a real client; the stub fails loud\n // at create() so the agent observes the cause instead of silent success.\n if (!apiKey) {\n return {\n async create() {\n throw new Error(\n 'agent-runtime-mcp: TANGLE_API_KEY is unset; coder/researcher delegations are disabled in diagnostic mode. Set TANGLE_API_KEY or use MCP_DISABLE_CODER=1 MCP_DISABLE_RESEARCHER=1 to remove the unsupported tools from the tool list.',\n )\n },\n } satisfies SandboxClient\n }\n // Dynamic import keeps the bin importable in environments that haven't\n // installed `@tangle-network/sandbox` yet (the runtime package lists it\n // as a peer dep, not a hard dep).\n const mod = await import('@tangle-network/sandbox').catch((err) => {\n process.stderr.write(\n `agent-runtime-mcp: failed to load @tangle-network/sandbox (${err.message}); install the peer dependency\\n`,\n )\n process.exit(2)\n })\n const SandboxCtor = (mod as { Sandbox?: new (config: unknown) => SandboxClient }).Sandbox\n if (!SandboxCtor) {\n process.stderr.write(\n 'agent-runtime-mcp: @tangle-network/sandbox does not export Sandbox; cannot construct client\\n',\n )\n process.exit(2)\n }\n const baseUrl = process.env.SANDBOX_BASE_URL\n return new SandboxCtor({\n apiKey,\n ...(baseUrl ? { baseUrl } : {}),\n })\n}\n\ninterface ResearcherProfilePreset {\n agentRunSpec: Parameters<typeof runLoop>[0]['agentRun'] extends infer T ? NonNullable<T> : never\n output: Parameters<typeof runLoop>[0]['output']\n validator: Parameters<typeof runLoop>[0]['validator']\n}\n\ninterface ResearcherFanoutPreset {\n agentRuns: NonNullable<Parameters<typeof runLoop>[0]['agentRuns']>\n output: Parameters<typeof runLoop>[0]['output']\n validator: Parameters<typeof runLoop>[0]['validator']\n driver: Parameters<typeof runLoop>[0]['driver']\n}\n\nasync function loadResearcherDelegate(\n sandboxClient: SandboxClient,\n maxConcurrency: number,\n traceEmitter?: LoopTraceEmitter,\n): Promise<ResearcherDelegate | undefined> {\n // Optional peer — when `@tangle-network/agent-knowledge` isn't installed,\n // we silently omit the researcher tool from the advertisement. The\n // dynamic-import path is resolved at runtime; TypeScript cannot see the\n // peer, so we type the module structurally rather than via its own\n // declaration file.\n const profilesSpecifier = '@tangle-network/agent-knowledge/profiles'\n const mod = await import(profilesSpecifier).catch(() => undefined)\n if (!mod) return undefined\n type SingleFactory = (opts: { task: unknown }) => ResearcherProfilePreset\n type FanoutFactory = (opts: { task: unknown }) => ResearcherFanoutPreset\n const fanoutFactory = (mod as { multiHarnessResearcherFanout?: FanoutFactory })\n .multiHarnessResearcherFanout\n const singleFactory = (mod as { researcherProfile?: SingleFactory }).researcherProfile\n if (!fanoutFactory || !singleFactory) return undefined\n\n return async (args, ctx) => {\n const task = {\n question: args.question,\n knowledgeNamespace: args.namespace,\n scope: args.scope,\n sources: args.sources,\n recencyWindow: args.config?.recencyWindow\n ? {\n since: args.config.recencyWindow.since\n ? new Date(args.config.recencyWindow.since)\n : undefined,\n until: args.config.recencyWindow.until\n ? new Date(args.config.recencyWindow.until)\n : undefined,\n }\n : undefined,\n maxItems: args.config?.maxItems,\n minConfidence: args.config?.minConfidence,\n }\n const variants = Math.max(1, Math.trunc(args.variants ?? 1))\n ctx.report({ iteration: 0, phase: 'starting' })\n if (variants <= 1) {\n const preset = singleFactory({ task })\n const result = await runLoop({\n driver: {\n name: 'mcp-researcher-single',\n async plan(t, history) {\n return history.length === 0 ? [t] : []\n },\n decide(history) {\n return history.length > 0 ? 'pick-winner' : 'fail'\n },\n },\n agentRun: preset.agentRunSpec,\n output: preset.output,\n validator: preset.validator,\n task,\n ctx: { sandboxClient, signal: ctx.signal, ...(traceEmitter ? { traceEmitter } : {}) },\n maxIterations: 1,\n maxConcurrency,\n })\n const output = result.winner?.output\n if (!output) throw new Error('researcher delegate produced no winner')\n ctx.report({ iteration: 1, phase: 'completed' })\n return output as ResearchOutputShape\n }\n const fanout = fanoutFactory({ task })\n const result = await runLoop({\n driver: fanout.driver,\n agentRuns: fanout.agentRuns.slice(0, variants),\n output: fanout.output,\n validator: fanout.validator,\n task,\n ctx: { sandboxClient, signal: ctx.signal, ...(traceEmitter ? { traceEmitter } : {}) },\n maxIterations: variants,\n maxConcurrency: Math.min(maxConcurrency, variants),\n })\n const output = result.winner?.output\n if (!output) throw new Error('researcher delegate fanout produced no winner')\n ctx.report({ iteration: result.iterations.length, phase: 'completed' })\n return output as ResearchOutputShape\n }\n}\n\nfunction parseHarnesses(raw: string | undefined): string[] | undefined {\n if (!raw) return undefined\n const list = raw\n .split(',')\n .map((entry) => entry.trim())\n .filter(Boolean)\n return list.length > 0 ? list : undefined\n}\n\nfunction parseFleetId(raw: string | undefined): string | undefined {\n if (typeof raw !== 'string') return undefined\n const trimmed = raw.trim()\n return trimmed.length > 0 ? trimmed : undefined\n}\n\nfunction parseConcurrency(raw: string | undefined): number {\n if (!raw) return 4\n const n = Number(raw)\n if (!Number.isFinite(n) || n < 1) return 4\n return Math.min(Math.trunc(n), 32)\n}\n\nmain().catch((err) => {\n process.stderr.write(`agent-runtime-mcp: ${err instanceof Error ? err.stack : String(err)}\\n`)\n process.exit(1)\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAwCA,eAAe,OAAsB;AACnC,QAAM,kBAAkB,eAAe,QAAQ,IAAI,0BAA0B;AAC7E,QAAM,iBAAiB,iBAAiB,QAAQ,IAAI,4BAA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,OAAO;AAAA,MACf,WAAW,OAAO;AAAA,MAClB;AAAA,MACA,KAAK,EAAE,eAAe,QAAQ,IAAI,QAAQ,GAAI,eAAe,EAAE,aAAa,IAAI,CAAC,EAAG;AAAA,MACpF,eAAe;AAAA,MACf,gBAAgB,KAAK,IAAI,gBAAgB,QAAQ;AAAA,IACnD,CAAC;AACD,UAAM,SAAS,OAAO,QAAQ;AAC9B,QAAI,CAAC,OAAQ,OAAM,IAAI,MAAM,+CAA+C;AAC5E,QAAI,OAAO,EAAE,WAAW,OAAO,WAAW,QAAQ,OAAO,YAAY,CAAC;AACtE,WAAO;AAAA,EACT;AACF;AAEA,SAAS,eAAe,KAA+C;AACrE,MAAI,CAAC,IAAK,QAAO;AACjB,QAAM,OAAO,IACV,MAAM,GAAG,EACT,IAAI,CAAC,UAAU,MAAM,KAAK,CAAC,EAC3B,OAAO,OAAO;AACjB,SAAO,KAAK,SAAS,IAAI,OAAO;AAClC;AAEA,SAAS,aAAa,KAA6C;AACjE,MAAI,OAAO,QAAQ,SAAU,QAAO;AACpC,QAAM,UAAU,IAAI,KAAK;AACzB,SAAO,QAAQ,SAAS,IAAI,UAAU;AACxC;AAEA,SAAS,iBAAiB,KAAiC;AACzD,MAAI,CAAC,IAAK,QAAO;AACjB,QAAM,IAAI,OAAO,GAAG;AACpB,MAAI,CAAC,OAAO,SAAS,CAAC,KAAK,IAAI,EAAG,QAAO;AACzC,SAAO,KAAK,IAAI,KAAK,MAAM,CAAC,GAAG,EAAE;AACnC;AAEA,KAAK,EAAE,MAAM,CAAC,QAAQ;AACpB,UAAQ,OAAO,MAAM,sBAAsB,eAAe,QAAQ,IAAI,QAAQ,OAAO,GAAG,CAAC;AAAA,CAAI;AAC7F,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["result","output"]}
@@ -1,17 +1,17 @@
1
- import { b as LoopSandboxClient, g as LoopSandboxPlacement, f as LoopTraceEmitter } from '../types-DdzkffAm.js';
2
- import { c as FleetHandle, d as DelegationExecutor, e as DelegateFeedbackArgs, f as DelegationFeedbackSnapshot, g as DelegationProfile, D as DelegateCodeArgs, h as DelegateResearchArgs, i as DelegateUiAuditArgs, j as DelegationStatus, k as DelegationProgress, l as DelegationResultPayload, m as DelegationError, n as DelegationStatusResult, o as DelegationHistoryArgs, p as DelegationHistoryEntry, q as CoderDelegate, R as ResearcherDelegate, U as UiAuditorDelegate, r as DelegateCodeResult, s as DelegateFeedbackResult, t as ResearchSource, u as DelegateResearchResult, v as DelegateUiAuditResult, w as DelegationHistoryResult, x as DelegationStatusArgs } from '../kb-gate-D9GBocLN.js';
3
- export { y as CoderReview, C as CoderReviewer, a as CoderWinnerSelection, z as CreateDefaultCoderDelegateOptions, b as CreateKbGateOptions, A as DelegateCodeConfig, B as DelegateResearchConfig, E as DelegateRunCtx, G as DelegateUiAuditConfig, H as DelegateUiAuditRoute, F as FactCandidate, I as FactJudge, J as FactJudgeVerdict, K as FeedbackRating, L as FeedbackRefersTo, M as FleetWorkspaceExecutorOptions, N as KbGateResult, O as ResearchOutputShape, S as SiblingSandboxExecutorOptions, P as UiAuditorDelegationOutput, Q as createDefaultCoderDelegate, T as createFleetWorkspaceExecutor, V as createKbGate, W as createSiblingSandboxExecutor } from '../kb-gate-D9GBocLN.js';
1
+ import { S as SandboxClient, f as LoopSandboxPlacement, e as LoopTraceEmitter } from '../types-nBMuollC.js';
2
+ import { c as FleetHandle, d as DelegationExecutor, e as DelegateFeedbackArgs, f as DelegationFeedbackSnapshot, g as DelegationProfile, D as DelegateCodeArgs, h as DelegateResearchArgs, i as DelegateUiAuditArgs, j as DelegationStatus, k as DelegationProgress, l as DelegationResultPayload, m as DelegationError, n as DelegationStatusResult, o as DelegationHistoryArgs, p as DelegationHistoryEntry, q as CoderDelegate, R as ResearcherDelegate, U as UiAuditorDelegate, r as DelegateCodeResult, s as DelegateFeedbackResult, t as ResearchSource, u as DelegateResearchResult, v as DelegateUiAuditResult, w as DelegationHistoryResult, x as DelegationStatusArgs } from '../kb-gate-51BlLlVM.js';
3
+ export { y as CoderReview, C as CoderReviewer, a as CoderWinnerSelection, z as CreateDefaultCoderDelegateOptions, b as CreateKbGateOptions, A as DelegateCodeConfig, B as DelegateResearchConfig, E as DelegateRunCtx, G as DelegateUiAuditConfig, H as DelegateUiAuditRoute, F as FactCandidate, I as FactJudge, J as FactJudgeVerdict, K as FeedbackRating, L as FeedbackRefersTo, M as FleetWorkspaceExecutorOptions, N as KbGateResult, O as ResearchOutputShape, S as SiblingSandboxExecutorOptions, P as UiAuditorDelegationOutput, Q as createDefaultCoderDelegate, T as createFleetWorkspaceExecutor, V as createKbGate, W as createSiblingSandboxExecutor } from '../kb-gate-51BlLlVM.js';
4
4
  export { B as BuildDelegationMcpServerOptions, C as ComposeProductionAgentProfileOptions, D as DELEGATION_MCP_SERVER_KEY, b as buildDelegationMcpServer, c as composeProductionAgentProfile } from '../delegation-profile-1GbW5yA3.js';
5
5
  import { L as LocalHarness, r as runLocalHarness } from '../local-harness-KrdFTY5R.js';
6
6
  export { a as LocalHarnessResult, R as RunLocalHarnessOptions } from '../local-harness-KrdFTY5R.js';
7
- import { O as OtelExporter } from '../otel-export-Dy2DyUCU.js';
8
- export { m as mcpToolsForRuntimeMcp, a as mcpToolsForRuntimeMcpSubset } from '../otel-export-Dy2DyUCU.js';
7
+ import { O as OtelExporter } from '../otel-export-EzfsVUhh.js';
8
+ export { m as mcpToolsForRuntimeMcp, a as mcpToolsForRuntimeMcpSubset } from '../otel-export-EzfsVUhh.js';
9
9
  import { AnalystFinding } from '@tangle-network/agent-eval';
10
- import { S as Scope, R as ResultBlobStore, A as Agent, B as Budget } from '../types-1HbsFa7H.js';
10
+ import { S as Scope, R as ResultBlobStore, A as Agent, B as Budget } from '../types-Cbx3dNK5.js';
11
11
  import { a as UiLens } from '../substrate-CUgk7F7s.js';
12
12
  import '@tangle-network/sandbox';
13
13
  import '../runtime-hooks-C7JwKb9E.js';
14
- import '../coder-CczgMqFx.js';
14
+ import '../coder-CVZNGbyg.js';
15
15
  import 'node:child_process';
16
16
 
17
17
  /**
@@ -24,7 +24,7 @@ import 'node:child_process';
24
24
 
25
25
  /** @experimental */
26
26
  interface DetectExecutorArgs {
27
- sandboxClient: LoopSandboxClient;
27
+ sandboxClient: SandboxClient;
28
28
  /** Raw env (defaults to `process.env`). Pass an explicit map for tests. */
29
29
  env?: Record<string, string | undefined>;
30
30
  /**
@@ -32,7 +32,7 @@ interface DetectExecutorArgs {
32
32
  * default reads `client.fleets.get(fleetId)` and validates the returned
33
33
  * shape against the structural `FleetHandle` contract.
34
34
  */
35
- resolveFleet?: (client: LoopSandboxClient, fleetId: string) => Promise<FleetHandle>;
35
+ resolveFleet?: (client: SandboxClient, fleetId: string) => Promise<FleetHandle>;
36
36
  }
37
37
  /**
38
38
  * Pick the right executor for an MCP server invocation based on env vars.
@@ -442,7 +442,7 @@ interface McpServerOptions {
442
442
  researcherDelegate?: ResearcherDelegate;
443
443
  /**
444
444
  * Required to enable delegate_ui_audit. Wire one that closes over your
445
- * `runLoop` + `uiAuditorProfile` + a `LoopSandboxClient` (the
445
+ * `runLoop` + `uiAuditorProfile` + a `SandboxClient` (the
446
446
  * canonical in-process choice is `createInProcessUiAuditClient` from
447
447
  * `@tangle-network/agent-runtime/profiles`) + your vision judge.
448
448
  */
@@ -452,10 +452,9 @@ interface McpServerOptions {
452
452
  /** Override the default in-memory task queue. */
453
453
  queue?: DelegationTaskQueue;
454
454
  /**
455
- * Extra tools to serve alongside the delegation tools e.g. the operator toolbox
456
- * (`createCoordinationTools(...).tools`), which exposes the driver's spawn/observe/steer verbs over
457
- * MCP so a sandbox agent can BE the driver. Registered after the built-ins; a duplicate name
458
- * throws (fail loud — no silent shadowing of a delegation tool).
455
+ * Extra tools to serve alongside the delegation tools, for example
456
+ * `createCoordinationTools(...).tools`. Registered after the built-ins; a
457
+ * duplicate name throws so delegation tools cannot be shadowed silently.
459
458
  */
460
459
  extraTools?: McpToolDescriptor[];
461
460
  /** Server display name surfaced via `initialize`. Default `'agent-runtime-mcp'`. */
@@ -570,9 +569,11 @@ interface CheckRunnerOptions {
570
569
  /** Run ONE lens over a trace → findings. Generic over any kind: prompt = the lens + the agent-eval
571
570
  * finding schema; the model's JSON array is parsed (`parseRawFinding`), lifted, and firewalled. */
572
571
  declare function runCheck(kind: Check, trace: unknown, opts: CheckRunnerOptions, producedAt: string): Promise<AnalystFinding[]>;
573
- /** Build a `run_analyst` runner over a kind directory — the seam the operator toolbox is wired with.
574
- * Returns the findings, or a typed error for an unknown kind. `producedAt` is passed in (the runtime
575
- * forbids `Date.now` in replay-safe paths; the caller stamps it). */
572
+ /**
573
+ * Build a `run_analyst` runner over a kind directory.
574
+ * Returns findings, or a typed error for an unknown kind. `producedAt` is
575
+ * passed in because replay-safe paths must not read `Date.now`.
576
+ */
576
577
  declare function makeCheckRunner(kinds: Record<string, Check>, opts: CheckRunnerOptions): (kindId: string, trace: unknown, producedAt: string) => Promise<AnalystFinding[] | {
577
578
  error: string;
578
579
  }>;
@@ -580,84 +581,84 @@ declare function makeCheckRunner(kinds: Record<string, Check>, opts: CheckRunner
580
581
  /**
581
582
  * @experimental
582
583
  *
583
- * COORDINATION TOOLS the verbs a parent agent uses to coordinate the child agents it spawns,
584
- * exposed as MCP tools backed by a live keystone `Scope`. This is `Scope`-as-MCP.
585
- *
586
- * NOT a transport. The cross-org message bus (`docs/agent-bus-protocol.md`) and the SDK's
587
- * `dispatchPrompt`/`SessionMessage` are the *transports* the `steer` verb rides; THIS file is the
588
- * verb set (the API). One verb, several bindings: in-process `Scope.send` is a direct call; across
589
- * sandboxes it rides SDK session-messaging; across orgs it rides the agent-bus protocol.
590
- *
591
- * spawn_worker → scope.spawn (budget-bounded, fail-closed — equal-k holds even for an LLM driver)
592
- * await_next → scope.next (THE wake event: block until the next spawned child settles)
593
- * observe_worker→ scope.view + the result blob (a child's status, spend, and settled output)
594
- * steer_worker → scope.send (deliver a next-instruction / interrupt to a RUNNING child)
595
- * list_analysts → the check menu (the trace lenses the agent can apply — see checks.ts)
596
- * run_analyst → apply a CHECK (run a kind over a child's trace → trace-derived findings)
597
- * stop → declare the run complete (the terminal move)
598
- *
599
- * The check verbs are present only when the check seam (`analystKinds` + `runAnalyst`) is wired —
600
- * an agent that does not review traces (a pure dispatcher) omits them. A trace check is a SEPARATE
601
- * lens (selector ≠ judge: it reads the trace, never the score); authoring a NEW check at runtime is
602
- * the next addition.
603
- *
604
- * A worker the driver spawns may itself carry the driver profile — `spawn_worker` does not care what
605
- * the profile is, so drivers-of-drivers fall out for free (each sub-driver gets its own sub-scope,
606
- * bounded by `maxDepth` + the conserved pool).
584
+ * MCP binding for a live `Scope`. A sandbox driver gets the same small verbs
585
+ * the in-process driver has: spawn, observe, await, steer, ask/answer, analyze,
586
+ * and stop. Settled outputs remain Scope artifacts; product code can project
587
+ * them into any UI/report envelope it needs.
607
588
  */
608
589
 
609
- /** A worker the driver has drained via `await_next` — the operator's running ledger of settled
610
- * workers + their DEPLOYABLE verdict (the driver IS the selector, so it legitimately reads the
611
- * verdict; the analyst, which reads only the trace, is the separate selector≠judge lens). The
612
- * driver picks its deliverable from this ledger at `stop`. */
590
+ /** A worker the driver has drained via `await_next`. */
613
591
  interface SettledWorker {
614
592
  readonly id: string;
615
593
  readonly status: 'done' | 'down';
616
- /** Deployable score in [0,1] from the worker's verdict (done only). */
617
594
  readonly score?: number;
618
- /** Whether the deployable verdict passed (done only). */
619
595
  readonly valid?: boolean;
620
- /** Result-blob pointer for the worker's output/trace (done only). */
621
596
  readonly outRef?: string;
622
- /** Failure reason (down only). */
623
597
  readonly reason?: string;
624
598
  }
625
- /** How a `spawn_worker` profile becomes a spawnable leaf `Agent`. The caller wires this (e.g. the
626
- * surface registry turns a profile into a shot executor) so the toolbox stays domain-blind. */
599
+ type QuestionLevel = 'worker' | 'driver' | 'loop';
600
+ type QuestionUrgency = 'continue-without' | 'blocks-step' | 'blocks-run';
601
+ interface QuestionOption {
602
+ readonly label: string;
603
+ readonly tradeoff: string;
604
+ }
605
+ interface Question {
606
+ readonly id: string;
607
+ readonly from: string;
608
+ readonly level: QuestionLevel;
609
+ readonly question: string;
610
+ readonly reason: string;
611
+ readonly urgency: QuestionUrgency;
612
+ readonly options?: ReadonlyArray<QuestionOption>;
613
+ }
614
+ type QuestionDecision = {
615
+ readonly kind: 'answer';
616
+ readonly answer: string;
617
+ readonly by: string;
618
+ } | {
619
+ readonly kind: 'defer';
620
+ readonly reason: string;
621
+ } | {
622
+ readonly kind: 'escalate';
623
+ readonly to: 'parent' | 'user' | string;
624
+ readonly reason: string;
625
+ };
626
+ interface QuestionRecord extends Question {
627
+ readonly status: 'open' | 'answered' | 'deferred' | 'escalated';
628
+ readonly decision?: QuestionDecision;
629
+ readonly openedAt: number;
630
+ }
631
+ type QuestionPolicy = 'auto' | 'mustDecide' | 'bubble' | 'failClosed';
632
+ interface AnalystRegistry {
633
+ readonly kinds: ReadonlyArray<{
634
+ id: string;
635
+ description: string;
636
+ area: string;
637
+ }>;
638
+ readonly run: (kindId: string, trace: unknown) => Promise<unknown>;
639
+ }
640
+ type CoordinationEvent = {
641
+ readonly type: 'question';
642
+ readonly question: QuestionRecord;
643
+ };
627
644
  type MakeWorkerAgent = (profile: unknown) => Agent<unknown, unknown>;
628
645
  interface CoordinationToolsOptions {
629
- /** The DRIVER's live scope — spawn/observe/steer all act on this. */
630
646
  readonly scope: Scope<unknown>;
631
- /** Result blobs, so `observe_worker` can rehydrate a settled worker's output. */
632
647
  readonly blobs: ResultBlobStore;
633
- /** Turn a spawn_worker `profile` into a leaf agent (registry-resolved on spawn). */
634
648
  readonly makeWorkerAgent: MakeWorkerAgent;
635
- /** Per-worker conserved budget the driver reserves on each spawn. */
636
649
  readonly perWorker: Budget;
637
- /** The analyst lens menu (for `list_analysts`) — id + one-line + area. Injected so the toolbox
638
- * stays domain-blind; wire it from `analyst-kinds.ts`'s directory. Omit to disable analyst tools. */
639
- readonly analystKinds?: ReadonlyArray<{
640
- id: string;
641
- description: string;
642
- area: string;
643
- }>;
644
- /** Run a lens over a worker's trace → findings (or a typed error). Wire it from
645
- * `makeCheckRunner(...)`. `run_analyst` fetches the worker's settled output and passes it here. */
646
- readonly runAnalyst?: (kindId: string, trace: unknown) => Promise<unknown>;
650
+ readonly analysts?: AnalystRegistry;
651
+ readonly onEvent?: (event: CoordinationEvent) => void | Promise<void>;
652
+ readonly questionPolicy?: QuestionPolicy;
647
653
  }
648
654
  interface CoordinationTools {
649
- /** MCP tools — register on an `McpServer`, or call the handlers directly in-process. */
650
655
  readonly tools: McpToolDescriptor[];
651
- /** True once the driver called `stop` — the operator loop reads this to terminate. */
652
656
  isStopped(): boolean;
653
- /** The reason passed to `stop`, if any. */
654
657
  stopReason(): string | undefined;
655
- /** The workers drained so far via `await_next` (the driver's selection ledger). */
656
658
  settled(): ReadonlyArray<SettledWorker>;
659
+ questions(): ReadonlyArray<QuestionRecord>;
657
660
  }
658
- /** Build the operator toolbox over a live scope. The tools are the driver's verbs; their handlers
659
- * are thin wrappers over the keystone (spawn/view/send), so the budget/journal/abort discipline of
660
- * the Supervisor applies to a sandbox driver exactly as to the in-process one. */
661
+ /** Build the driver's MCP tools over a live scope. */
661
662
  declare function createCoordinationTools(opts: CoordinationToolsOptions): CoordinationTools;
662
663
 
663
664
  /**
@@ -916,7 +917,7 @@ declare function createDelegateResearchHandler(options: DelegateResearchHandlerO
916
917
  * The handler does not import the auditor profile directly — consumers
917
918
  * inject a `UiAuditorDelegate` via `createMcpServer({ uiAuditorDelegate })`.
918
919
  * The delegate is the seam where the consumer chooses the judge (vision
919
- * model) and the `LoopSandboxClient` (in-process Playwright vs fleet vs
920
+ * model) and the `SandboxClient` (in-process Playwright vs fleet vs
920
921
  * remote browser). agent-runtime ships the in-process client under
921
922
  * `./profiles` so consumers who want the canonical setup can wire it
922
923
  * with a few lines.
@@ -1147,4 +1148,4 @@ declare function createPropagatingTraceEmitter(ctx: TraceContext): {
1147
1148
  */
1148
1149
  declare function traceContextToEnv(ctx: TraceContext): Record<string, string>;
1149
1150
 
1150
- export { type Check, type CheckRunnerOptions, CoderDelegate, type CoordinationTools, type CoordinationToolsOptions, type CreateWorktreeOptions, DELEGATE_CODE_DESCRIPTION, DELEGATE_CODE_INPUT_SCHEMA, DELEGATE_CODE_TOOL_NAME, DELEGATE_FEEDBACK_DESCRIPTION, DELEGATE_FEEDBACK_INPUT_SCHEMA, DELEGATE_FEEDBACK_TOOL_NAME, DELEGATE_RESEARCH_DESCRIPTION, DELEGATE_RESEARCH_INPUT_SCHEMA, DELEGATE_RESEARCH_TOOL_NAME, DELEGATE_UI_AUDIT_DESCRIPTION, DELEGATE_UI_AUDIT_INPUT_SCHEMA, DELEGATE_UI_AUDIT_TOOL_NAME, DELEGATION_HISTORY_DESCRIPTION, DELEGATION_HISTORY_INPUT_SCHEMA, DELEGATION_HISTORY_TOOL_NAME, DELEGATION_STATUS_DESCRIPTION, DELEGATION_STATUS_INPUT_SCHEMA, DELEGATION_STATUS_TOOL_NAME, DelegateCodeArgs, DelegateCodeResult, DelegateFeedbackArgs, DelegateFeedbackResult, DelegateResearchArgs, DelegateResearchResult, DelegateUiAuditArgs, DelegateUiAuditResult, DelegationError, DelegationExecutor, DelegationFeedbackSnapshot, DelegationHistoryArgs, DelegationHistoryEntry, DelegationHistoryResult, DelegationProfile, DelegationProgress, type DelegationRecord, DelegationResultPayload, DelegationStatus, DelegationStatusArgs, DelegationStatusResult, DelegationTaskQueue, type DelegationTaskQueueOptions, type DetectExecutorArgs, type DiffOptions, type DiffResult, type FeedbackEvent, type FeedbackStore, FleetHandle, type GitRunner, InMemoryFeedbackStore, type InProcessExecutorDescribePlacement, type InProcessExecutorOptions, type JsonRpcMessage, type JsonRpcResponse, LocalHarness, type MakeWorkerAgent, type McpServer, type McpServerOptions, type McpToolDescriptor, type McpTransport, type RemoveWorktreeOptions, ResearchSource, ResearcherDelegate, type SettledWorker, type SubmitInput, type SubmitOutput, type TraceContext, UiAuditorDelegate, type WorktreeHandle, captureWorktreeDiff, createCoordinationTools, createDelegateCodeHandler, createDelegateFeedbackHandler, createDelegateResearchHandler, createDelegateUiAuditHandler, createDelegationHistoryHandler, createDelegationStatusHandler, createInProcessExecutor, createInProcessTransport, createMcpServer, createPropagatingTraceEmitter, createWorktree, defaultChecks, detectExecutor, eventToSnapshot, hashIdempotencyInput, liftFindings, makeCheckRunner, readTraceContextFromEnv, removeWorktree, renderTrace, runCheck, runLocalHarness, traceContextToEnv, validateDelegateCodeArgs, validateDelegateFeedbackArgs, validateDelegateResearchArgs, validateDelegateUiAuditArgs, validateDelegationHistoryArgs, validateDelegationStatusArgs };
1151
+ export { type AnalystRegistry, type Check, type CheckRunnerOptions, CoderDelegate, type CoordinationEvent, type CoordinationTools, type CoordinationToolsOptions, type CreateWorktreeOptions, DELEGATE_CODE_DESCRIPTION, DELEGATE_CODE_INPUT_SCHEMA, DELEGATE_CODE_TOOL_NAME, DELEGATE_FEEDBACK_DESCRIPTION, DELEGATE_FEEDBACK_INPUT_SCHEMA, DELEGATE_FEEDBACK_TOOL_NAME, DELEGATE_RESEARCH_DESCRIPTION, DELEGATE_RESEARCH_INPUT_SCHEMA, DELEGATE_RESEARCH_TOOL_NAME, DELEGATE_UI_AUDIT_DESCRIPTION, DELEGATE_UI_AUDIT_INPUT_SCHEMA, DELEGATE_UI_AUDIT_TOOL_NAME, DELEGATION_HISTORY_DESCRIPTION, DELEGATION_HISTORY_INPUT_SCHEMA, DELEGATION_HISTORY_TOOL_NAME, DELEGATION_STATUS_DESCRIPTION, DELEGATION_STATUS_INPUT_SCHEMA, DELEGATION_STATUS_TOOL_NAME, DelegateCodeArgs, DelegateCodeResult, DelegateFeedbackArgs, DelegateFeedbackResult, DelegateResearchArgs, DelegateResearchResult, DelegateUiAuditArgs, DelegateUiAuditResult, DelegationError, DelegationExecutor, DelegationFeedbackSnapshot, DelegationHistoryArgs, DelegationHistoryEntry, DelegationHistoryResult, DelegationProfile, DelegationProgress, type DelegationRecord, DelegationResultPayload, DelegationStatus, DelegationStatusArgs, DelegationStatusResult, DelegationTaskQueue, type DelegationTaskQueueOptions, type DetectExecutorArgs, type DiffOptions, type DiffResult, type FeedbackEvent, type FeedbackStore, FleetHandle, type GitRunner, InMemoryFeedbackStore, type InProcessExecutorDescribePlacement, type InProcessExecutorOptions, type JsonRpcMessage, type JsonRpcResponse, LocalHarness, type MakeWorkerAgent, type McpServer, type McpServerOptions, type McpToolDescriptor, type McpTransport, type Question, type QuestionDecision, type QuestionPolicy, type QuestionRecord, type RemoveWorktreeOptions, ResearchSource, ResearcherDelegate, type SettledWorker, type SubmitInput, type SubmitOutput, type TraceContext, UiAuditorDelegate, type WorktreeHandle, captureWorktreeDiff, createCoordinationTools, createDelegateCodeHandler, createDelegateFeedbackHandler, createDelegateResearchHandler, createDelegateUiAuditHandler, createDelegationHistoryHandler, createDelegationStatusHandler, createInProcessExecutor, createInProcessTransport, createMcpServer, createPropagatingTraceEmitter, createWorktree, defaultChecks, detectExecutor, eventToSnapshot, hashIdempotencyInput, liftFindings, makeCheckRunner, readTraceContextFromEnv, removeWorktree, renderTrace, runCheck, runLocalHarness, traceContextToEnv, validateDelegateCodeArgs, validateDelegateFeedbackArgs, validateDelegateResearchArgs, validateDelegateUiAuditArgs, validateDelegationHistoryArgs, validateDelegationStatusArgs };