@tangle-network/agent-runtime 0.335.0 → 0.336.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.
Files changed (53) hide show
  1. package/dist/{activation-DZbEj4oG.d.ts → activation-D3h2jg6U.d.ts} +2 -2
  2. package/dist/{activation-BT3VoIpg.js → activation-WRMocDPp.js} +2 -2
  3. package/dist/{activation-BT3VoIpg.js.map → activation-WRMocDPp.js.map} +1 -1
  4. package/dist/agent.d.ts +1 -1
  5. package/dist/agent.js +2 -2
  6. package/dist/{coordination-driver-rNoFHYmZ.js → coordination-driver-DIxyUXKr.js} +2 -2
  7. package/dist/{coordination-driver-rNoFHYmZ.js.map → coordination-driver-DIxyUXKr.js.map} +1 -1
  8. package/dist/{delegate-BdwThtY9.js → delegate-DZ_EV8BU.js} +2 -2
  9. package/dist/{delegate-BdwThtY9.js.map → delegate-DZ_EV8BU.js.map} +1 -1
  10. package/dist/durable.d.ts +1 -1
  11. package/dist/durable.js +3 -3
  12. package/dist/{graph-Bph_DX-z.js → graph-DOIziP_V.js} +4 -4
  13. package/dist/{graph-Bph_DX-z.js.map → graph-DOIziP_V.js.map} +1 -1
  14. package/dist/{improvement-cycle-Coj69usO.js → improvement-cycle-DRiKtfty.js} +3 -3
  15. package/dist/{improvement-cycle-Coj69usO.js.map → improvement-cycle-DRiKtfty.js.map} +1 -1
  16. package/dist/index.d.ts +4 -4
  17. package/dist/index.js +7 -7
  18. package/dist/intelligence.d.ts +2 -2
  19. package/dist/intelligence.js +3 -3
  20. package/dist/kernel.d.ts +2 -2
  21. package/dist/kernel.js +8 -8
  22. package/dist/{loop-runner-bin-9MtarSBu.js → loop-runner-bin-DCCieRnZ.js} +3 -3
  23. package/dist/{loop-runner-bin-9MtarSBu.js.map → loop-runner-bin-DCCieRnZ.js.map} +1 -1
  24. package/dist/{loop-runner-bin-BTC2czoj.d.ts → loop-runner-bin-DXMrEOWf.d.ts} +2 -2
  25. package/dist/loop-runner-bin.d.ts +1 -1
  26. package/dist/loop-runner-bin.js +1 -1
  27. package/dist/mcp/bin.js +21 -4
  28. package/dist/mcp/bin.js.map +1 -1
  29. package/dist/mcp/index.d.ts +2 -2
  30. package/dist/mcp/index.js +4 -4
  31. package/dist/{openai-tools-DWuf9K9X.d.ts → openai-tools-mpuNXxBB.d.ts} +2 -2
  32. package/dist/profiles.d.ts +1 -1
  33. package/dist/{provision-supervisor-Ced9EeHy.js → provision-supervisor-BGXehCW5.js} +3 -3
  34. package/dist/{provision-supervisor-Ced9EeHy.js.map → provision-supervisor-BGXehCW5.js.map} +1 -1
  35. package/dist/{runtime-DMVBv34m.js → runtime-B-qPSZyM.js} +74 -11
  36. package/dist/runtime-B-qPSZyM.js.map +1 -0
  37. package/dist/{search-executor-BNTeMygV.js → search-executor-B6X1doWD.js} +2 -2
  38. package/dist/{search-executor-BNTeMygV.js.map → search-executor-B6X1doWD.js.map} +1 -1
  39. package/dist/{server-z7xI_ItY.js → server-BwdkANs5.js} +3 -3
  40. package/dist/{server-z7xI_ItY.js.map → server-BwdkANs5.js.map} +1 -1
  41. package/dist/{supervise-ISaRiWVe.js → supervise-N4Wilrg1.js} +31 -6
  42. package/dist/supervise-N4Wilrg1.js.map +1 -0
  43. package/dist/{supervisor-B-bkXttM.js → supervisor-CLi80MYC.js} +51 -7
  44. package/dist/supervisor-CLi80MYC.js.map +1 -0
  45. package/dist/testing.d.ts +1 -1
  46. package/dist/testing.js +12 -12
  47. package/dist/tui/index.d.ts +1 -1
  48. package/dist/tui/index.js +1 -1
  49. package/dist/{types-BO8kh52C.d.ts → types-C9qQxCd9.d.ts} +47 -3
  50. package/package.json +1 -1
  51. package/dist/runtime-DMVBv34m.js.map +0 -1
  52. package/dist/supervise-ISaRiWVe.js.map +0 -1
  53. package/dist/supervisor-B-bkXttM.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { Ea as WorktreePatchArtifact, L as Budget, ad as WinnerStrategy, ai as WorktreeFanoutOptions, ii as AuthoredHarness } from "./types-BO8kh52C.js";
1
+ import { Da as WorktreePatchArtifact, L as Budget, ai as AuthoredHarness, od as WinnerStrategy, oi as WorktreeFanoutOptions } from "./types-C9qQxCd9.js";
2
2
  import { d as RunAnalystLoopOpts, f as RunAnalystLoopResult } from "./types-zWfqDjeL.js";
3
3
  import { n as FactCandidate, t as CreateKbGateOptions } from "./kb-gate-C8z2juK8.js";
4
4
  import { AgentProfile } from "@tangle-network/agent-interface";
@@ -161,4 +161,4 @@ declare function parseLoopRunnerArgv(argv: string[]): {
161
161
  };
162
162
  //#endregion
163
163
  export { researchLoopRunner as _, DELEGATED_LOOP_MODES as a, DelegatedLoopResult as c, ResearchLoopRunnerOptions as d, RunDelegatedLoopOptions as f, isDelegatedLoopMode as g, auditLoopRunner as h, runLoopRunnerCli as i, DelegatedLoopRunner as l, WorktreeLoopRunnerOptions as m, LoopRunnerCliResult as n, DelegatedLoopMode as o, VetoedFact as p, parseLoopRunnerArgv as r, DelegatedLoopRegistry as s, LoopRunnerCliArgs as t, ResearchLoopResult as u, runDelegatedLoop as v, worktreeLoopRunner as y };
164
- //# sourceMappingURL=loop-runner-bin-BTC2czoj.d.ts.map
164
+ //# sourceMappingURL=loop-runner-bin-DXMrEOWf.d.ts.map
@@ -1,2 +1,2 @@
1
- import { i as runLoopRunnerCli, n as LoopRunnerCliResult, r as parseLoopRunnerArgv, t as LoopRunnerCliArgs } from "./loop-runner-bin-BTC2czoj.js";
1
+ import { i as runLoopRunnerCli, n as LoopRunnerCliResult, r as parseLoopRunnerArgv, t as LoopRunnerCliArgs } from "./loop-runner-bin-DXMrEOWf.js";
2
2
  export { LoopRunnerCliArgs, LoopRunnerCliResult, parseLoopRunnerArgv, runLoopRunnerCli };
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import { n as runLoopRunnerCli, t as parseLoopRunnerArgv } from "./loop-runner-bin-9MtarSBu.js";
2
+ import { n as runLoopRunnerCli, t as parseLoopRunnerArgv } from "./loop-runner-bin-DCCieRnZ.js";
3
3
  export { parseLoopRunnerArgv, runLoopRunnerCli };
package/dist/mcp/bin.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import { Y as coordinationProfileToolPrefix, pr as readTraceContextFromEnv } from "../supervisor-B-bkXttM.js";
2
+ import { Y as coordinationProfileToolPrefix, pr as readTraceContextFromEnv } from "../supervisor-CLi80MYC.js";
3
3
  import { i as ConfigError } from "../errors-DodWX-cb.js";
4
- import { s as supervisorInstructions } from "../delegate-BdwThtY9.js";
5
- import { _ as FileDelegationStore, n as createMcpServer, p as DelegationTaskQueue } from "../server-z7xI_ItY.js";
4
+ import { s as supervisorInstructions } from "../delegate-DZ_EV8BU.js";
5
+ import { _ as FileDelegationStore, n as createMcpServer, p as DelegationTaskQueue } from "../server-BwdkANs5.js";
6
6
  //#region src/mcp/delegate-supervisor-provisioning.ts
7
7
  function trimmed(value) {
8
8
  const v = value?.trim();
@@ -32,6 +32,18 @@ const delegateSupervisorVerbs = [
32
32
  "read_journal"
33
33
  ];
34
34
  /**
35
+ * The `delegate` caller asked for a worker to do the task, and only a worker's settled result is
36
+ * delivered. A capable brain otherwise answers a small intent itself (gemini-3.7-flash and kimi-k3
37
+ * both replied to "Reply with exactly DELEGATED-391" directly), which settles `no-children-spawned`
38
+ * and discards the answer.
39
+ */
40
+ const delegateContract = [
41
+ "",
42
+ "This task came through `delegate`: the caller wants a worker to do it. However small the task,",
43
+ "call spawn_worker at least once before you end your turn. Your own reply is never delivered;",
44
+ "only a worker's settled result is."
45
+ ].join("\n");
46
+ /**
35
47
  * Resolve the supervisor brain from dedicated MCP configuration. The model is part of the exact
36
48
  * profile; the URL and key are transport-only. No generic worker/model/key variable may silently
37
49
  * select this paid execution path.
@@ -41,6 +53,7 @@ function resolveRouterSupervisor(env) {
41
53
  const base = requiredEnv(env, "MCP_SUPERVISOR_ROUTER_BASE_URL");
42
54
  const routerBaseUrl = /\/v\d+\/?$/.test(base) ? base.replace(/\/$/, "") : `${base.replace(/\/$/, "")}/v1`;
43
55
  const model = requiredEnv(env, "MCP_SUPERVISOR_MODEL");
56
+ const consumerInstructions = trimmed(env.MCP_SUPERVISOR_INSTRUCTIONS);
44
57
  return {
45
58
  router: {
46
59
  routerBaseUrl,
@@ -53,7 +66,11 @@ function resolveRouterSupervisor(env) {
53
66
  provider: "tangle-router",
54
67
  default: model
55
68
  },
56
- prompt: { systemPrompt: supervisorInstructions() },
69
+ prompt: { systemPrompt: [
70
+ supervisorInstructions(),
71
+ delegateContract,
72
+ ...consumerInstructions ? ["", consumerInstructions] : []
73
+ ].join("\n") },
57
74
  tools: Object.fromEntries(delegateSupervisorVerbs.map((verb) => [`${coordinationProfileToolPrefix}${verb}`, true]))
58
75
  }
59
76
  };
@@ -1 +1 @@
1
- {"version":3,"file":"bin.js","names":[],"sources":["../../src/mcp/delegate-supervisor-provisioning.ts","../../src/mcp/bin.ts"],"sourcesContent":["/**\n *\n * Resolve the `delegate` supervisor substrate (router brain + worker backend) from env, so the\n * `agent-runtime-mcp` bin can serve the ONE generic `delegate` verb by env, over the SAME stdio\n * invocation a consumer already mounts.\n *\n * `delegate` is wired into `createMcpServer` via `McpServerOptions.delegateSupervisor`, which needs a\n * router (the supervisor brain's transport) and a backend (WHERE the authored workers run). Inside a\n * sandbox child the natural backend is `sandbox`: authored workers run as sub-sandboxes through the\n * SAME `SandboxClient` the bin already loads from its sandbox key. Dedicated MCP variables name\n * the supervisor's router connection and exact model; inherited worker/model aliases are rejected.\n *\n * @experimental\n */\n\nimport type { AgentProfile } from '@tangle-network/agent-interface'\nimport { ConfigError } from '../errors'\nimport type { SandboxClient } from '../runtime'\nimport type { RouterTransportConfig } from '../runtime/router-client'\nimport { supervisorInstructions } from '../runtime/supervise/authoring'\nimport { coordinationProfileToolPrefix } from '../runtime/supervise/provider-visible-profile'\nimport type { ExecutorConfig } from '../runtime/supervise/runtime'\nimport type { DelegateHandlerOptions } from './tools/delegate'\n\nfunction trimmed(value: string | undefined): string | undefined {\n const v = value?.trim()\n return v ? v : undefined\n}\n\nfunction requiredEnv(env: NodeJS.ProcessEnv, name: string): string {\n const value = trimmed(env[name])\n if (value) return value\n throw new ConfigError(`agent-runtime-mcp: ${name} is required when MCP_ENABLE_DELEGATE=1`)\n}\n\n/** True when the operator opted the generic `delegate` verb in (`MCP_ENABLE_DELEGATE=1`). Default off:\n * the wiring is additive, so consumers that do not enable it are unaffected. */\nexport function delegateEnabled(env: NodeJS.ProcessEnv = process.env): boolean {\n return env.MCP_ENABLE_DELEGATE === '1'\n}\n\n/**\n * The Runtime verbs the authoring supervisor is granted. A profile gets no coordination tool it does\n * not declare, so without `spawn_worker` the brain is offered no tools and every delegation settles\n * `no-children-spawned`. The rest let it inspect, steer, stop, and re-read what it already spawned,\n * which its authoring instruction tells it to do.\n */\nconst delegateSupervisorVerbs = [\n 'spawn_worker',\n 'observe_agent',\n 'steer_agent',\n 'cancel_worker',\n 'read_journal',\n] as const\n\n/**\n * Resolve the supervisor brain from dedicated MCP configuration. The model is part of the exact\n * profile; the URL and key are transport-only. No generic worker/model/key variable may silently\n * select this paid execution path.\n */\nfunction resolveRouterSupervisor(env: NodeJS.ProcessEnv): {\n router: RouterTransportConfig\n profile: AgentProfile\n} {\n const routerKey = requiredEnv(env, 'MCP_SUPERVISOR_ROUTER_KEY')\n const base = requiredEnv(env, 'MCP_SUPERVISOR_ROUTER_BASE_URL')\n const routerBaseUrl = /\\/v\\d+\\/?$/.test(base)\n ? base.replace(/\\/$/, '')\n : `${base.replace(/\\/$/, '')}/v1`\n const model = requiredEnv(env, 'MCP_SUPERVISOR_MODEL')\n return {\n router: { routerBaseUrl, routerKey },\n profile: {\n name: 'delegate-supervisor',\n harness: 'cli-base',\n model: { provider: 'tangle-router', default: model },\n prompt: { systemPrompt: supervisorInstructions() },\n tools: Object.fromEntries(\n delegateSupervisorVerbs.map((verb) => [`${coordinationProfileToolPrefix}${verb}`, true]),\n ),\n },\n }\n}\n\n/**\n * Build the `delegateSupervisor` substrate for `createMcpServer` from env + the bin's loaded\n * `SandboxClient`. Returns `undefined` when `delegate` is not opted in, so the caller mounts it only\n * when asked. The worker backend is `sandbox`; every authored worker's exact profile selects its\n * own harness/provider/model.\n */\nexport function resolveDelegateSupervisor(\n sandboxClient: SandboxClient,\n env: NodeJS.ProcessEnv = process.env,\n): DelegateHandlerOptions | undefined {\n if (!delegateEnabled(env)) return undefined\n const supervisor = resolveRouterSupervisor(env)\n const backend: ExecutorConfig = {\n backend: 'sandbox',\n sandboxClient,\n }\n return {\n router: supervisor.router,\n supervisorProfile: supervisor.profile,\n backend,\n }\n}\n","#!/usr/bin/env node\n\n/**\n *\n * `agent-runtime-mcp` — stdio MCP server entry point.\n *\n * Serves the ONE generic `delegate` verb (opt-in via `MCP_ENABLE_DELEGATE=1`): one intent → a\n * supervisor that authors + drives its own worker over `supervise()`, returning the delivered output\n * with its cost. The supervisor brain runs on the router; authored workers run as sub-sandboxes\n * through the `SandboxClient` the bin loads from the sandbox key. The queue-bound tools\n * (`delegate_feedback`, `delegation_status`, `delegation_history`) are always served.\n *\n * A platform key serves one product, so the Sandbox API key and the router key are separate\n * variables: the sandbox key only constructs the Sandbox client, and the router key only reaches\n * the supervisor brain. Neither is forwarded into a worker box; each worker's model access comes\n * from the box its profile provisions.\n *\n * Environment variables:\n * TANGLE_SANDBOX_API_KEY Sandbox API key passed to `new Sandbox({ apiKey })`. Falls back\n * to TANGLE_API_KEY when unset, so one key that serves the Sandbox\n * API keeps working.\n * TANGLE_API_KEY Sandbox API key when TANGLE_SANDBOX_API_KEY is unset\n * SANDBOX_BASE_URL optional — sandbox-SDK base URL override\n * MCP_ENABLE_DELEGATE set to `1` to serve the generic `delegate` verb. Its authoring\n * supervisor runs the brain on the router and spawns authored\n * workers as sub-sandboxes via the same client; needs a sandbox key.\n * MCP_SUPERVISOR_MODEL required exact supervisor brain model id\n * MCP_SUPERVISOR_ROUTER_KEY required router key for the supervisor brain\n * MCP_SUPERVISOR_ROUTER_BASE_URL required router base, normalized to `/v1`\n * AGENT_RUNTIME_DELEGATION_STATE_FILE\n * optional — absolute path of a JSON state\n * file. When set, delegation records persist\n * across MCP restarts (FileDelegationStore):\n * status/history survive and idempotency keys\n * dedupe across processes.\n * AGENT_RUNTIME_DELEGATION_STATE_RECOVER\n * set to `1` to archive a corrupt state file\n * (`<file>.corrupt-<ts>`) and start empty\n * instead of refusing to boot.\n * AGENT_RUNTIME_DELEGATION_RETAIN_TERMINAL\n * optional — positive integer cap on retained\n * terminal records. Unset = keep forever.\n *\n * @experimental\n */\n\nimport type { SandboxClient } from '../runtime'\nimport { delegateEnabled, resolveDelegateSupervisor } from './delegate-supervisor-provisioning'\nimport { FileDelegationStore } from './delegation-store'\nimport { createMcpServer } from './server'\nimport { DelegationTaskQueue } from './task-queue'\nimport type { DelegateHandlerOptions } from './tools/delegate'\nimport { readTraceContextFromEnv, type TraceContext } from './trace-propagation'\n\nconst DEFAULT_SANDBOX_BASE_URL = 'https://sandbox.tangle.tools'\n\nasync function main(): Promise<void> {\n const wantDelegate = delegateEnabled(process.env)\n\n // The generic `delegate` verb needs the sandbox client: its authored workers run as sub-sandboxes\n // (the `sandbox` backend). When `delegate` is not opted in, the server runs the queue-only subset\n // (feedback + status + history) with no sandbox.\n let sandboxClient: SandboxClient | undefined\n if (wantDelegate) {\n const apiKey = sandboxApiKey(process.env)\n if (!apiKey && !process.env.AGENT_RUNTIME_MCP_ALLOW_NO_KEY) {\n process.stderr.write(\n 'agent-runtime-mcp: a Sandbox API key is required to serve `delegate`: set TANGLE_SANDBOX_API_KEY (or TANGLE_API_KEY when that key serves the Sandbox API). Set AGENT_RUNTIME_MCP_ALLOW_NO_KEY=1 to run without it for diagnostics, or unset MCP_ENABLE_DELEGATE to run the queue-only subset.\\n',\n )\n process.exit(2)\n }\n sandboxClient = await loadSandboxClient(apiKey)\n }\n\n // The supervisor's loop topology spans export to the OTLP / Tangle Intelligence sink when\n // OTEL_EXPORTER_OTLP_ENDPOINT is set (+ TRACE_ID / PARENT_SPAN_ID for correlation). The same\n // context is stamped onto every delegation record so journal consumers join records into the\n // caller's trace.\n const traceContext = readTraceContextFromEnv()\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 // The ONE generic `delegate` verb — opt-in via MCP_ENABLE_DELEGATE=1. Its authoring supervisor\n // runs the brain on the router and spawns authored workers as sub-sandboxes through the SAME\n // client, so it needs the loaded `sandboxClient`. Gated on the client resolving (no key → no\n // delegate, fail-closed).\n let delegateSupervisor: DelegateHandlerOptions | undefined\n if (wantDelegate && sandboxClient) {\n try {\n delegateSupervisor = resolveDelegateSupervisor(sandboxClient)\n } catch (error) {\n // Refuse to serve a verb that cannot work. Advertising `delegate` on an\n // unresolvable substrate spends an agent's turn on a tool whose first\n // inference is guaranteed to reject.\n process.stderr.write(`${error instanceof Error ? error.message : String(error)}\\n`)\n process.exit(2)\n }\n }\n if (delegateSupervisor) {\n process.stderr.write(\n `agent-runtime-mcp: delegate enabled — generic authoring supervisor on ${delegateSupervisor.supervisorProfile.model?.default}\\n`,\n )\n }\n\n const durableQueue = await buildDurableQueueFromEnv(traceContext)\n const server = createMcpServer({\n ...(delegateSupervisor ? { delegateSupervisor } : {}),\n traceContext,\n ...(durableQueue ? { queue: durableQueue } : {}),\n })\n\n const shutdown = () => {\n server.stop()\n // Drain journal writes so the state file reflects the final record\n // states before the process exits. A persist failure already routed\n // through onPersistError; swallow the duplicate rejection here.\n if (durableQueue) {\n void durableQueue\n .flush()\n .catch(() => {})\n .finally(() => process.exit(0))\n return\n }\n process.exit(0)\n }\n process.on('SIGINT', shutdown)\n process.on('SIGTERM', shutdown)\n\n await server.serve()\n}\n\nasync function buildDurableQueueFromEnv(\n traceContext: TraceContext,\n): Promise<DelegationTaskQueue | undefined> {\n const stateFile = process.env.AGENT_RUNTIME_DELEGATION_STATE_FILE?.trim()\n if (!stateFile) return undefined\n const store = new FileDelegationStore({\n filePath: stateFile,\n recoverCorrupt: process.env.AGENT_RUNTIME_DELEGATION_STATE_RECOVER === '1',\n })\n const maxTerminalRecords = parseRetention(process.env.AGENT_RUNTIME_DELEGATION_RETAIN_TERMINAL)\n const queue = await DelegationTaskQueue.restore({\n store,\n traceContext,\n ...(maxTerminalRecords !== undefined ? { maxTerminalRecords } : {}),\n onPersistError: (error) => {\n // Durable mode that can no longer write is a broken contract: crash\n // loud instead of degrading to memory-only behind the caller's back.\n process.stderr.write(`agent-runtime-mcp: ${error.message}\\n`)\n process.exit(1)\n },\n })\n process.stderr.write(`agent-runtime-mcp: durable delegation state → ${stateFile}\\n`)\n return queue\n}\n\nfunction parseRetention(raw: string | undefined): number | undefined {\n if (raw === undefined || raw.trim() === '') return undefined\n const n = Number(raw)\n if (!Number.isInteger(n) || n < 1) {\n process.stderr.write(\n `agent-runtime-mcp: AGENT_RUNTIME_DELEGATION_RETAIN_TERMINAL must be a positive integer, got \"${raw}\"\\n`,\n )\n process.exit(2)\n }\n return n\n}\n\n/** The Sandbox API key: the dedicated variable when set, else the legacy single key. The router key\n * (`MCP_SUPERVISOR_ROUTER_KEY`) is read only by the supervisor provisioning. */\nfunction sandboxApiKey(env: NodeJS.ProcessEnv): string | undefined {\n return env.TANGLE_SANDBOX_API_KEY?.trim() || env.TANGLE_API_KEY?.trim() || undefined\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 // `delegate` requires a real client; the stub fails loud at create() so the\n // agent observes the cause instead of silent success.\n if (!apiKey) {\n return {\n async create() {\n throw new Error(\n 'agent-runtime-mcp: no Sandbox API key is set; `delegate` is disabled in diagnostic mode. Set TANGLE_SANDBOX_API_KEY (or TANGLE_API_KEY) or unset MCP_ENABLE_DELEGATE to remove the unsupported tool from the tool list.',\n )\n },\n } satisfies SandboxClient\n }\n // Diagnostic mode does not need a client, so defer SDK initialization until\n // delegation is requested. Runtime declares the SDK as a required peer.\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 // @tangle-network/sandbox ≥0.6 makes baseUrl required; default it so the MCP server\n // starts without forcing every caller to set SANDBOX_BASE_URL. Treat empty/whitespace as\n // unset (|| not ??) so `SANDBOX_BASE_URL=` still resolves to the default.\n const baseUrl = process.env.SANDBOX_BASE_URL?.trim() || DEFAULT_SANDBOX_BASE_URL\n return new SandboxCtor({ apiKey, baseUrl })\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":";;;;;;AAwBA,SAAS,QAAQ,OAA+C;CAC9D,MAAM,IAAI,OAAO,KAAK;CACtB,OAAO,IAAI,IAAI,KAAA;AACjB;AAEA,SAAS,YAAY,KAAwB,MAAsB;CACjE,MAAM,QAAQ,QAAQ,IAAI,KAAK;CAC/B,IAAI,OAAO,OAAO;CAClB,MAAM,IAAI,YAAY,sBAAsB,KAAK,wCAAwC;AAC3F;;;AAIA,SAAgB,gBAAgB,MAAyB,QAAQ,KAAc;CAC7E,OAAO,IAAI,wBAAwB;AACrC;;;;;;;AAQA,MAAM,0BAA0B;CAC9B;CACA;CACA;CACA;CACA;AACF;;;;;;AAOA,SAAS,wBAAwB,KAG/B;CACA,MAAM,YAAY,YAAY,KAAK,2BAA2B;CAC9D,MAAM,OAAO,YAAY,KAAK,gCAAgC;CAC9D,MAAM,gBAAgB,aAAa,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B,IAAI,CAAC,OAAO,UAAU,CAAC,KAAK,IAAI,GAAG;EACjC,QAAQ,OAAO,MACb,gGAAgG,IAAI,IACtG;EACA,QAAQ,KAAK,CAAC;CAChB;CACA,OAAO;AACT;;;AAIA,SAAS,cAAc,KAA4C;CACjE,OAAO,IAAI,wBAAwB,KAAK,KAAK,IAAI,gBAAgB,KAAK,KAAK,KAAA;AAC7E;AAEA,eAAe,kBAAkB,QAAoD;CAKnF,IAAI,CAAC,QACH,OAAO,EACL,MAAM,SAAS;EACb,MAAM,IAAI,MACR,yNACF;CACF,EACF;CAUF,MAAM,eAAe,MANH,OAAO,0BAA0B,CAAC,OAAO,QAAQ;EACjE,QAAQ,OAAO,MACb,8DAA8D,IAAI,QAAQ,iCAC5E;EACA,QAAQ,KAAK,CAAC;CAChB,CAAC,EAAA,CACiF;CAClF,IAAI,CAAC,aAAa;EAChB,QAAQ,OAAO,MACb,+FACF;EACA,QAAQ,KAAK,CAAC;CAChB;CAKA,OAAO,IAAI,YAAY;EAAE;EAAQ,SADjB,QAAQ,IAAI,kBAAkB,KAAK,KAAK;CACf,CAAC;AAC5C;AAEA,KAAK,CAAC,CAAC,OAAO,QAAQ;CACpB,QAAQ,OAAO,MAAM,sBAAsB,eAAe,QAAQ,IAAI,QAAQ,OAAO,GAAG,EAAE,GAAG;CAC7F,QAAQ,KAAK,CAAC;AAChB,CAAC"}
1
+ {"version":3,"file":"bin.js","names":[],"sources":["../../src/mcp/delegate-supervisor-provisioning.ts","../../src/mcp/bin.ts"],"sourcesContent":["/**\n *\n * Resolve the `delegate` supervisor substrate (router brain + worker backend) from env, so the\n * `agent-runtime-mcp` bin can serve the ONE generic `delegate` verb by env, over the SAME stdio\n * invocation a consumer already mounts.\n *\n * `delegate` is wired into `createMcpServer` via `McpServerOptions.delegateSupervisor`, which needs a\n * router (the supervisor brain's transport) and a backend (WHERE the authored workers run). Inside a\n * sandbox child the natural backend is `sandbox`: authored workers run as sub-sandboxes through the\n * SAME `SandboxClient` the bin already loads from its sandbox key. Dedicated MCP variables name\n * the supervisor's router connection and exact model; inherited worker/model aliases are rejected.\n *\n * @experimental\n */\n\nimport type { AgentProfile } from '@tangle-network/agent-interface'\nimport { ConfigError } from '../errors'\nimport type { SandboxClient } from '../runtime'\nimport type { RouterTransportConfig } from '../runtime/router-client'\nimport { supervisorInstructions } from '../runtime/supervise/authoring'\nimport { coordinationProfileToolPrefix } from '../runtime/supervise/provider-visible-profile'\nimport type { ExecutorConfig } from '../runtime/supervise/runtime'\nimport type { DelegateHandlerOptions } from './tools/delegate'\n\nfunction trimmed(value: string | undefined): string | undefined {\n const v = value?.trim()\n return v ? v : undefined\n}\n\nfunction requiredEnv(env: NodeJS.ProcessEnv, name: string): string {\n const value = trimmed(env[name])\n if (value) return value\n throw new ConfigError(`agent-runtime-mcp: ${name} is required when MCP_ENABLE_DELEGATE=1`)\n}\n\n/** True when the operator opted the generic `delegate` verb in (`MCP_ENABLE_DELEGATE=1`). Default off:\n * the wiring is additive, so consumers that do not enable it are unaffected. */\nexport function delegateEnabled(env: NodeJS.ProcessEnv = process.env): boolean {\n return env.MCP_ENABLE_DELEGATE === '1'\n}\n\n/**\n * The Runtime verbs the authoring supervisor is granted. A profile gets no coordination tool it does\n * not declare, so without `spawn_worker` the brain is offered no tools and every delegation settles\n * `no-children-spawned`. The rest let it inspect, steer, stop, and re-read what it already spawned,\n * which its authoring instruction tells it to do.\n */\nconst delegateSupervisorVerbs = [\n 'spawn_worker',\n 'observe_agent',\n 'steer_agent',\n 'cancel_worker',\n 'read_journal',\n] as const\n\n/**\n * The `delegate` caller asked for a worker to do the task, and only a worker's settled result is\n * delivered. A capable brain otherwise answers a small intent itself (gemini-3.7-flash and kimi-k3\n * both replied to \"Reply with exactly DELEGATED-391\" directly), which settles `no-children-spawned`\n * and discards the answer.\n */\nconst delegateContract = [\n '',\n 'This task came through `delegate`: the caller wants a worker to do it. However small the task,',\n 'call spawn_worker at least once before you end your turn. Your own reply is never delivered;',\n \"only a worker's settled result is.\",\n].join('\\n')\n\n/**\n * Resolve the supervisor brain from dedicated MCP configuration. The model is part of the exact\n * profile; the URL and key are transport-only. No generic worker/model/key variable may silently\n * select this paid execution path.\n */\nfunction resolveRouterSupervisor(env: NodeJS.ProcessEnv): {\n router: RouterTransportConfig\n profile: AgentProfile\n} {\n const routerKey = requiredEnv(env, 'MCP_SUPERVISOR_ROUTER_KEY')\n const base = requiredEnv(env, 'MCP_SUPERVISOR_ROUTER_BASE_URL')\n const routerBaseUrl = /\\/v\\d+\\/?$/.test(base)\n ? base.replace(/\\/$/, '')\n : `${base.replace(/\\/$/, '')}/v1`\n const model = requiredEnv(env, 'MCP_SUPERVISOR_MODEL')\n // The consumer's own policy for the workers this supervisor authors, such as the only harness and\n // model its worker boxes can run. Without it the brain picks instruments from memory, and on\n // 2026-10-19 every one it picked (claude-code on Anthropic, nanoclaw, cli-base) died in the box.\n const consumerInstructions = trimmed(env.MCP_SUPERVISOR_INSTRUCTIONS)\n return {\n router: { routerBaseUrl, routerKey },\n profile: {\n name: 'delegate-supervisor',\n harness: 'cli-base',\n model: { provider: 'tangle-router', default: model },\n prompt: {\n systemPrompt: [\n supervisorInstructions(),\n delegateContract,\n ...(consumerInstructions ? ['', consumerInstructions] : []),\n ].join('\\n'),\n },\n tools: Object.fromEntries(\n delegateSupervisorVerbs.map((verb) => [`${coordinationProfileToolPrefix}${verb}`, true]),\n ),\n },\n }\n}\n\n/**\n * Build the `delegateSupervisor` substrate for `createMcpServer` from env + the bin's loaded\n * `SandboxClient`. Returns `undefined` when `delegate` is not opted in, so the caller mounts it only\n * when asked. The worker backend is `sandbox`; every authored worker's exact profile selects its\n * own harness/provider/model.\n */\nexport function resolveDelegateSupervisor(\n sandboxClient: SandboxClient,\n env: NodeJS.ProcessEnv = process.env,\n): DelegateHandlerOptions | undefined {\n if (!delegateEnabled(env)) return undefined\n const supervisor = resolveRouterSupervisor(env)\n const backend: ExecutorConfig = {\n backend: 'sandbox',\n sandboxClient,\n }\n return {\n router: supervisor.router,\n supervisorProfile: supervisor.profile,\n backend,\n }\n}\n","#!/usr/bin/env node\n\n/**\n *\n * `agent-runtime-mcp` — stdio MCP server entry point.\n *\n * Serves the ONE generic `delegate` verb (opt-in via `MCP_ENABLE_DELEGATE=1`): one intent → a\n * supervisor that authors + drives its own worker over `supervise()`, returning the delivered output\n * with its cost. The supervisor brain runs on the router; authored workers run as sub-sandboxes\n * through the `SandboxClient` the bin loads from the sandbox key. The queue-bound tools\n * (`delegate_feedback`, `delegation_status`, `delegation_history`) are always served.\n *\n * A platform key serves one product, so the Sandbox API key and the router key are separate\n * variables: the sandbox key only constructs the Sandbox client, and the router key only reaches\n * the supervisor brain. Neither is forwarded into a worker box; each worker's model access comes\n * from the box its profile provisions.\n *\n * Environment variables:\n * TANGLE_SANDBOX_API_KEY Sandbox API key passed to `new Sandbox({ apiKey })`. Falls back\n * to TANGLE_API_KEY when unset, so one key that serves the Sandbox\n * API keeps working.\n * TANGLE_API_KEY Sandbox API key when TANGLE_SANDBOX_API_KEY is unset\n * SANDBOX_BASE_URL optional — sandbox-SDK base URL override\n * MCP_ENABLE_DELEGATE set to `1` to serve the generic `delegate` verb. Its authoring\n * supervisor runs the brain on the router and spawns authored\n * workers as sub-sandboxes via the same client; needs a sandbox key.\n * MCP_SUPERVISOR_MODEL required exact supervisor brain model id\n * MCP_SUPERVISOR_ROUTER_KEY required router key for the supervisor brain\n * MCP_SUPERVISOR_ROUTER_BASE_URL required router base, normalized to `/v1`\n * MCP_SUPERVISOR_INSTRUCTIONS optional text appended to the supervisor's system prompt: the\n * caller's policy for the workers it authors, such as the harness\n * and model its worker boxes can run\n * AGENT_RUNTIME_DELEGATION_STATE_FILE\n * optional — absolute path of a JSON state\n * file. When set, delegation records persist\n * across MCP restarts (FileDelegationStore):\n * status/history survive and idempotency keys\n * dedupe across processes.\n * AGENT_RUNTIME_DELEGATION_STATE_RECOVER\n * set to `1` to archive a corrupt state file\n * (`<file>.corrupt-<ts>`) and start empty\n * instead of refusing to boot.\n * AGENT_RUNTIME_DELEGATION_RETAIN_TERMINAL\n * optional — positive integer cap on retained\n * terminal records. Unset = keep forever.\n *\n * @experimental\n */\n\nimport type { SandboxClient } from '../runtime'\nimport { delegateEnabled, resolveDelegateSupervisor } from './delegate-supervisor-provisioning'\nimport { FileDelegationStore } from './delegation-store'\nimport { createMcpServer } from './server'\nimport { DelegationTaskQueue } from './task-queue'\nimport type { DelegateHandlerOptions } from './tools/delegate'\nimport { readTraceContextFromEnv, type TraceContext } from './trace-propagation'\n\nconst DEFAULT_SANDBOX_BASE_URL = 'https://sandbox.tangle.tools'\n\nasync function main(): Promise<void> {\n const wantDelegate = delegateEnabled(process.env)\n\n // The generic `delegate` verb needs the sandbox client: its authored workers run as sub-sandboxes\n // (the `sandbox` backend). When `delegate` is not opted in, the server runs the queue-only subset\n // (feedback + status + history) with no sandbox.\n let sandboxClient: SandboxClient | undefined\n if (wantDelegate) {\n const apiKey = sandboxApiKey(process.env)\n if (!apiKey && !process.env.AGENT_RUNTIME_MCP_ALLOW_NO_KEY) {\n process.stderr.write(\n 'agent-runtime-mcp: a Sandbox API key is required to serve `delegate`: set TANGLE_SANDBOX_API_KEY (or TANGLE_API_KEY when that key serves the Sandbox API). Set AGENT_RUNTIME_MCP_ALLOW_NO_KEY=1 to run without it for diagnostics, or unset MCP_ENABLE_DELEGATE to run the queue-only subset.\\n',\n )\n process.exit(2)\n }\n sandboxClient = await loadSandboxClient(apiKey)\n }\n\n // The supervisor's loop topology spans export to the OTLP / Tangle Intelligence sink when\n // OTEL_EXPORTER_OTLP_ENDPOINT is set (+ TRACE_ID / PARENT_SPAN_ID for correlation). The same\n // context is stamped onto every delegation record so journal consumers join records into the\n // caller's trace.\n const traceContext = readTraceContextFromEnv()\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 // The ONE generic `delegate` verb — opt-in via MCP_ENABLE_DELEGATE=1. Its authoring supervisor\n // runs the brain on the router and spawns authored workers as sub-sandboxes through the SAME\n // client, so it needs the loaded `sandboxClient`. Gated on the client resolving (no key → no\n // delegate, fail-closed).\n let delegateSupervisor: DelegateHandlerOptions | undefined\n if (wantDelegate && sandboxClient) {\n try {\n delegateSupervisor = resolveDelegateSupervisor(sandboxClient)\n } catch (error) {\n // Refuse to serve a verb that cannot work. Advertising `delegate` on an\n // unresolvable substrate spends an agent's turn on a tool whose first\n // inference is guaranteed to reject.\n process.stderr.write(`${error instanceof Error ? error.message : String(error)}\\n`)\n process.exit(2)\n }\n }\n if (delegateSupervisor) {\n process.stderr.write(\n `agent-runtime-mcp: delegate enabled — generic authoring supervisor on ${delegateSupervisor.supervisorProfile.model?.default}\\n`,\n )\n }\n\n const durableQueue = await buildDurableQueueFromEnv(traceContext)\n const server = createMcpServer({\n ...(delegateSupervisor ? { delegateSupervisor } : {}),\n traceContext,\n ...(durableQueue ? { queue: durableQueue } : {}),\n })\n\n const shutdown = () => {\n server.stop()\n // Drain journal writes so the state file reflects the final record\n // states before the process exits. A persist failure already routed\n // through onPersistError; swallow the duplicate rejection here.\n if (durableQueue) {\n void durableQueue\n .flush()\n .catch(() => {})\n .finally(() => process.exit(0))\n return\n }\n process.exit(0)\n }\n process.on('SIGINT', shutdown)\n process.on('SIGTERM', shutdown)\n\n await server.serve()\n}\n\nasync function buildDurableQueueFromEnv(\n traceContext: TraceContext,\n): Promise<DelegationTaskQueue | undefined> {\n const stateFile = process.env.AGENT_RUNTIME_DELEGATION_STATE_FILE?.trim()\n if (!stateFile) return undefined\n const store = new FileDelegationStore({\n filePath: stateFile,\n recoverCorrupt: process.env.AGENT_RUNTIME_DELEGATION_STATE_RECOVER === '1',\n })\n const maxTerminalRecords = parseRetention(process.env.AGENT_RUNTIME_DELEGATION_RETAIN_TERMINAL)\n const queue = await DelegationTaskQueue.restore({\n store,\n traceContext,\n ...(maxTerminalRecords !== undefined ? { maxTerminalRecords } : {}),\n onPersistError: (error) => {\n // Durable mode that can no longer write is a broken contract: crash\n // loud instead of degrading to memory-only behind the caller's back.\n process.stderr.write(`agent-runtime-mcp: ${error.message}\\n`)\n process.exit(1)\n },\n })\n process.stderr.write(`agent-runtime-mcp: durable delegation state → ${stateFile}\\n`)\n return queue\n}\n\nfunction parseRetention(raw: string | undefined): number | undefined {\n if (raw === undefined || raw.trim() === '') return undefined\n const n = Number(raw)\n if (!Number.isInteger(n) || n < 1) {\n process.stderr.write(\n `agent-runtime-mcp: AGENT_RUNTIME_DELEGATION_RETAIN_TERMINAL must be a positive integer, got \"${raw}\"\\n`,\n )\n process.exit(2)\n }\n return n\n}\n\n/** The Sandbox API key: the dedicated variable when set, else the legacy single key. The router key\n * (`MCP_SUPERVISOR_ROUTER_KEY`) is read only by the supervisor provisioning. */\nfunction sandboxApiKey(env: NodeJS.ProcessEnv): string | undefined {\n return env.TANGLE_SANDBOX_API_KEY?.trim() || env.TANGLE_API_KEY?.trim() || undefined\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 // `delegate` requires a real client; the stub fails loud at create() so the\n // agent observes the cause instead of silent success.\n if (!apiKey) {\n return {\n async create() {\n throw new Error(\n 'agent-runtime-mcp: no Sandbox API key is set; `delegate` is disabled in diagnostic mode. Set TANGLE_SANDBOX_API_KEY (or TANGLE_API_KEY) or unset MCP_ENABLE_DELEGATE to remove the unsupported tool from the tool list.',\n )\n },\n } satisfies SandboxClient\n }\n // Diagnostic mode does not need a client, so defer SDK initialization until\n // delegation is requested. Runtime declares the SDK as a required peer.\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 // @tangle-network/sandbox ≥0.6 makes baseUrl required; default it so the MCP server\n // starts without forcing every caller to set SANDBOX_BASE_URL. Treat empty/whitespace as\n // unset (|| not ??) so `SANDBOX_BASE_URL=` still resolves to the default.\n const baseUrl = process.env.SANDBOX_BASE_URL?.trim() || DEFAULT_SANDBOX_BASE_URL\n return new SandboxCtor({ apiKey, baseUrl })\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":";;;;;;AAwBA,SAAS,QAAQ,OAA+C;CAC9D,MAAM,IAAI,OAAO,KAAK;CACtB,OAAO,IAAI,IAAI,KAAA;AACjB;AAEA,SAAS,YAAY,KAAwB,MAAsB;CACjE,MAAM,QAAQ,QAAQ,IAAI,KAAK;CAC/B,IAAI,OAAO,OAAO;CAClB,MAAM,IAAI,YAAY,sBAAsB,KAAK,wCAAwC;AAC3F;;;AAIA,SAAgB,gBAAgB,MAAyB,QAAQ,KAAc;CAC7E,OAAO,IAAI,wBAAwB;AACrC;;;;;;;AAQA,MAAM,0BAA0B;CAC9B;CACA;CACA;CACA;CACA;AACF;;;;;;;AAQA,MAAM,mBAAmB;CACvB;CACA;CACA;CACA;AACF,CAAC,CAAC,KAAK,IAAI;;;;;;AAOX,SAAS,wBAAwB,KAG/B;CACA,MAAM,YAAY,YAAY,KAAK,2BAA2B;CAC9D,MAAM,OAAO,YAAY,KAAK,gCAAgC;CAC9D,MAAM,gBAAgB,aAAa,KAAK,IAAI,IACxC,KAAK,QAAQ,OAAO,EAAE,IACtB,GAAG,KAAK,QAAQ,OAAO,EAAE,EAAE;CAC/B,MAAM,QAAQ,YAAY,KAAK,sBAAsB;CAIrD,MAAM,uBAAuB,QAAQ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,UAAU,CAAC,KAAK,IAAI,GAAG;EACjC,QAAQ,OAAO,MACb,gGAAgG,IAAI,IACtG;EACA,QAAQ,KAAK,CAAC;CAChB;CACA,OAAO;AACT;;;AAIA,SAAS,cAAc,KAA4C;CACjE,OAAO,IAAI,wBAAwB,KAAK,KAAK,IAAI,gBAAgB,KAAK,KAAK,KAAA;AAC7E;AAEA,eAAe,kBAAkB,QAAoD;CAKnF,IAAI,CAAC,QACH,OAAO,EACL,MAAM,SAAS;EACb,MAAM,IAAI,MACR,yNACF;CACF,EACF;CAUF,MAAM,eAAe,MANH,OAAO,0BAA0B,CAAC,OAAO,QAAQ;EACjE,QAAQ,OAAO,MACb,8DAA8D,IAAI,QAAQ,iCAC5E;EACA,QAAQ,KAAK,CAAC;CAChB,CAAC,EAAA,CACiF;CAClF,IAAI,CAAC,aAAa;EAChB,QAAQ,OAAO,MACb,+FACF;EACA,QAAQ,KAAK,CAAC;CAChB;CAKA,OAAO,IAAI,YAAY;EAAE;EAAQ,SADjB,QAAQ,IAAI,kBAAkB,KAAK,KAAK;CACf,CAAC;AAC5C;AAEA,KAAK,CAAC,CAAC,OAAO,QAAQ;CACpB,QAAQ,OAAO,MAAM,sBAAsB,eAAe,QAAQ,IAAI,QAAQ,OAAO,GAAG,EAAE,GAAG;CAC7F,QAAQ,KAAK,CAAC;AAChB,CAAC"}
@@ -1,6 +1,6 @@
1
- import { $C as runLocalHarness, $n as GraphSubtasks, $v as DelegationExecutor, $y as UiAuditLensFilter, Ab as capDelegationTrace, Ah as McpServer, An as AnalystToolGroupName, Ay as DelegateFeedbackArgs, BC as createWorktree, Bh as DelegateResult, Bv as InMemoryFeedbackStore, By as DelegationFeedbackSnapshot, Cb as CappedDelegationTrace, Ch as SPAWN_RESOURCE_PATH_MAX_BYTES, Cn as AnalystAssignmentRecord, Cy as DelegationTaskQueueOptions, Db as DelegationTraceCollector, Dh as environmentReader, Dr as WorkerSpawnContext, Dy as DelegateCodeArgs, Eb as DelegationTraceCaps, Eh as SpawnResourceReader, En as AnalystKind, Ey as hashIdempotencyInput, FC as DiffResult, Fb as DelegationStore, Fh as DELEGATE_INPUT_SCHEMA, Fn as AuthorizedDownMessage, Fr as questionEscalationTargets, Fv as McpToolAnnotations, Fy as DelegateUiAuditArgs, GC as DEFAULT_LOCAL_HARNESS, Gn as DefinedAnalystRecord, Gv as DelegateRunCtx, Gy as DelegationProgress, HC as CodexExecutionEvidence, Hh as validateDelegateArgs, Hv as CoderDelegate, Hy as DelegationHistoryEntry, IC as GitRunner, Ib as FileDelegationStore, Ih as DELEGATE_TOOL_NAME, In as AwaitWakeInput, Iv as McpToolDescriptor, Iy as DelegateUiAuditConfig, JC as LocalHarnessResult, Jn as DownMessageDeliveryOutcome, Jv as SettleDetachedCoderTurnOptions, Jy as DelegationStatusArgs, KC as LOCAL_HARNESSES, Kn as DownMessageAuthorizationInput, Kv as DetachedSessionDelegateOptions, Ky as DelegationResultPayload, LC as RemoveWorktreeOptions, Lb as FileDelegationStoreOptions, Lh as DelegateArgs, Lv as McpTransport, Ly as DelegateUiAuditResult, Mb as createDelegationTraceCollector, Mh as createInProcessTransport, Mn as AuthoredAnalystDefinition, Mr as downMessageRefusalReasons, My as DelegateResearchArgs, NC as CreateWorktreeOptions, Nb as DelegationPersistenceError, Nh as createMcpServer, Nn as AuthoredAnalystLimits, Nv as JsonRpcMessage, Ny as DelegateResearchConfig, Ob as DelegationTraceSpan, Oh as hostDirectoryReader, On as AnalystRegistry, Or as WorkerWatchOptions, Oy as DelegateCodeConfig, PC as DiffOptions, Pb as DelegationStateCorruptError, Ph as DELEGATE_DESCRIPTION, Pn as AuthorizeDownMessage, Pr as parseAuthoredAnalystDefinition, Pv as JsonRpcResponse, Py as DelegateResearchResult, QC as parseCodexTokenUsage, Qn as GraphSubtaskPreparation, Qv as settleDetachedCoderTurn, Qy as ResearchOutputShape, RC as WorktreeHandle, Rb as InMemoryDelegationStore, Rh as DelegateError, Rn as ChildQuestionInbox, Rv as FeedbackEvent, Ry as DelegateUiAuditRoute, Sb as traceContextToEnv, Sh as ResolvedSpawnResourcePath, Sn as ANALYST_DEFINITION_BOUNDS, Sy as DelegationTaskQueue, Tb as DELEGATION_TRACE_MAX_SPANS, Th as SpawnResourceRead, Tn as AnalystFindingEvent, Tr as ToolOutcomeEvent, Ty as SubmitOutput, UC as CodexExecutionPolicy, Un as CoordinationTools, Uv as CoderReview, Uy as DelegationHistoryResult, VC as removeWorktree, Vh as createDelegateHandler, Vn as CoordinationEvent, Vv as eventToSnapshot, Vy as DelegationHistoryArgs, WC as CodexTokenUsage, Wn as CoordinationToolsOptions, Wv as CoderReviewer, Wy as DelegationProfile, XC as harnessSupportsReasoningEffort, Xn as EscalateQuestion, Xv as coderTaskFromArgs, Xy as FeedbackRating, YC as RunLocalHarnessOptions, Yn as DownMessageEvent, Yv as UiAuditorDelegate, Yy as DelegationStatusResult, ZC as localHarnessExecutable, Zn as EventAcknowledgement, Zv as detachedSessionDelegate, Zy as FeedbackRefersTo, _r as QuestionRecord, _y as DelegationRecord, ay as DetachedSessionRefParts, bb as mergeTraceEnv, by as DelegationResumeTick, cr as PeerAuditAccess, cy as DriveTurnCapableBox, dr as QuestionEscalationOutcome, dy as createDetachedTurnResumeDriver, eb as UiAuditorDelegationOutput, er as LeadMessage, ey as FleetHandle, fb as ResearchSource, fr as QuestionEscalationRecord, fy as detachedTurnEvents, gr as QuestionPolicy, gy as DelegationArgs, hr as QuestionOption, hy as runDetachedTurn, iy as createSiblingSandboxExecutor, jb as composeLoopTraceEmitters, jh as McpServerOptions, jr as createCoordinationTools, jy as DelegateFeedbackResult, kb as buildDelegationTraceSpans, kh as resolveSpawnResourcePaths, kn as AnalystRunContext, kr as analystToolGroupNames, ky as DelegateCodeResult, lr as Question, ly as DriveTurnTick, mr as QuestionLevel, my as parseDetachedSessionRef, nr as ManagerReentryState, ny as SiblingSandboxExecutorOptions, oy as DetachedTurn, pr as QuestionEscalationTarget, py as formatDetachedSessionRef, qC as LocalHarness, qn as DownMessageDeliveryAttempt, qv as DetachedWinnerSelection, qy as DelegationStatus, rr as ManagerWake, ry as createFleetWorkspaceExecutor, sb as UiLens, sy as DetachedTurnResumeDriverOptions, tb as delegationProfiles, tr as MakeWorkerAgent, ty as FleetWorkspaceExecutorOptions, ur as QuestionDecision, uy as RunDetachedTurnOptions, vT as LoopSandboxPlacement, vb as TraceContext, vr as QuestionUrgency, vy as DelegationResumeContext, wb as DELEGATION_TRACE_MAX_BYTES, wh as SpawnResourceBytes, wn as AnalystDefinitionIssue, wy as SubmitInput, xb as readTraceContextFromEnv, xh as ResolveSpawnResourcePathsResult, xy as DelegationRunContext, yb as createPropagatingTraceEmitter, yr as SettledWorker, yy as DelegationResumeDriver, zC as captureWorktreeDiff, zb as CoderOutput, zh as DelegateHandlerOptions, zn as ContinuationInstruction, zv as FeedbackStore, zy as DelegationError } from "../types-BO8kh52C.js";
1
+ import { $C as parseCodexTokenUsage, $n as GraphSubtaskPreparation, $v as settleDetachedCoderTurn, $y as ResearchOutputShape, Ab as buildDelegationTraceSpans, Ah as resolveSpawnResourcePaths, An as AnalystRunContext, Ar as analystToolGroupNames, Ay as DelegateCodeResult, BC as captureWorktreeDiff, Bb as CoderOutput, Bh as DelegateHandlerOptions, Bn as ContinuationInstruction, Bv as FeedbackStore, By as DelegationError, Cb as traceContextToEnv, Ch as ResolvedSpawnResourcePath, Cn as ANALYST_DEFINITION_BOUNDS, Cy as DelegationTaskQueue, Db as DelegationTraceCaps, Dh as SpawnResourceReader, Dn as AnalystKind, Dy as hashIdempotencyInput, Eb as DELEGATION_TRACE_MAX_SPANS, Eh as SpawnResourceRead, En as AnalystFindingEvent, Er as ToolOutcomeEvent, Ey as SubmitOutput, FC as DiffOptions, Fb as DelegationStateCorruptError, Fh as DELEGATE_DESCRIPTION, Fn as AuthorizeDownMessage, Fr as parseAuthoredAnalystDefinition, Fv as JsonRpcResponse, Fy as DelegateResearchResult, GC as CodexTokenUsage, Gn as CoordinationToolsOptions, Gv as CoderReviewer, Gy as DelegationProfile, HC as removeWorktree, Hh as createDelegateHandler, Hn as CoordinationEvent, Hv as eventToSnapshot, Hy as DelegationHistoryArgs, IC as DiffResult, Ib as DelegationStore, Ih as DELEGATE_INPUT_SCHEMA, In as AuthorizedDownMessage, Ir as questionEscalationTargets, Iv as McpToolAnnotations, Iy as DelegateUiAuditArgs, JC as LocalHarness, Jn as DownMessageDeliveryAttempt, Jv as DetachedWinnerSelection, Jy as DelegationStatus, KC as DEFAULT_LOCAL_HARNESS, Kn as DefinedAnalystRecord, Kv as DelegateRunCtx, Ky as DelegationProgress, LC as GitRunner, Lb as FileDelegationStore, Lh as DELEGATE_TOOL_NAME, Ln as AwaitWakeInput, Lv as McpToolDescriptor, Ly as DelegateUiAuditConfig, Mb as composeLoopTraceEmitters, Mh as McpServerOptions, Mr as createCoordinationTools, My as DelegateFeedbackResult, Nb as createDelegationTraceCollector, Nh as createInProcessTransport, Nn as AuthoredAnalystDefinition, Nr as downMessageRefusalReasons, Ny as DelegateResearchArgs, Ob as DelegationTraceCollector, Oh as environmentReader, Or as WorkerSpawnContext, Oy as DelegateCodeArgs, PC as CreateWorktreeOptions, Pb as DelegationPersistenceError, Ph as createMcpServer, Pn as AuthoredAnalystLimits, Pv as JsonRpcMessage, Py as DelegateResearchConfig, QC as localHarnessExecutable, Qn as EventAcknowledgement, Qv as detachedSessionDelegate, Qy as FeedbackRefersTo, RC as RemoveWorktreeOptions, Rb as FileDelegationStoreOptions, Rh as DelegateArgs, Rv as McpTransport, Ry as DelegateUiAuditResult, Sb as readTraceContextFromEnv, Sh as ResolveSpawnResourcePathsResult, Sy as DelegationRunContext, Tb as DELEGATION_TRACE_MAX_BYTES, Th as SpawnResourceBytes, Tn as AnalystDefinitionIssue, Ty as SubmitInput, UC as CodexExecutionEvidence, Uh as validateDelegateArgs, Uv as CoderDelegate, Uy as DelegationHistoryEntry, VC as createWorktree, Vh as DelegateResult, Vv as InMemoryFeedbackStore, Vy as DelegationFeedbackSnapshot, WC as CodexExecutionPolicy, Wn as CoordinationTools, Wv as CoderReview, Wy as DelegationHistoryResult, XC as RunLocalHarnessOptions, Xn as DownMessageEvent, Xv as UiAuditorDelegate, Xy as DelegationStatusResult, YC as LocalHarnessResult, Yn as DownMessageDeliveryOutcome, Yv as SettleDetachedCoderTurnOptions, Yy as DelegationStatusArgs, ZC as harnessSupportsReasoningEffort, Zn as EscalateQuestion, Zv as coderTaskFromArgs, Zy as FeedbackRating, _r as QuestionPolicy, _y as DelegationArgs, ay as createSiblingSandboxExecutor, bb as createPropagatingTraceEmitter, br as SettledWorker, by as DelegationResumeDriver, cb as UiLens, cy as DetachedTurnResumeDriverOptions, dr as QuestionDecision, dy as RunDetachedTurnOptions, eb as UiAuditLensFilter, er as GraphSubtasks, ew as runLocalHarness, ey as DelegationExecutor, fr as QuestionEscalationOutcome, fy as createDetachedTurnResumeDriver, gr as QuestionOption, gy as runDetachedTurn, hr as QuestionLevel, hy as parseDetachedSessionRef, ir as ManagerWake, iy as createFleetWorkspaceExecutor, jb as capDelegationTrace, jh as McpServer, jn as AnalystToolGroupName, jy as DelegateFeedbackArgs, kb as DelegationTraceSpan, kh as hostDirectoryReader, kn as AnalystRegistry, kr as WorkerWatchOptions, ky as DelegateCodeConfig, lr as PeerAuditAccess, ly as DriveTurnCapableBox, mr as QuestionEscalationTarget, my as formatDetachedSessionRef, nb as delegationProfiles, nr as MakeWorkerAgent, ny as FleetWorkspaceExecutorOptions, oy as DetachedSessionRefParts, pb as ResearchSource, pr as QuestionEscalationRecord, py as detachedTurnEvents, qC as LOCAL_HARNESSES, qn as DownMessageAuthorizationInput, qv as DetachedSessionDelegateOptions, qy as DelegationResultPayload, rr as ManagerReentryState, ry as SiblingSandboxExecutorOptions, sy as DetachedTurn, tb as UiAuditorDelegationOutput, tr as LeadMessage, ty as FleetHandle, ur as Question, uy as DriveTurnTick, vr as QuestionRecord, vy as DelegationRecord, wb as CappedDelegationTrace, wh as SPAWN_RESOURCE_PATH_MAX_BYTES, wn as AnalystAssignmentRecord, wy as DelegationTaskQueueOptions, xb as mergeTraceEnv, xy as DelegationResumeTick, yT as LoopSandboxPlacement, yb as TraceContext, yr as QuestionUrgency, yy as DelegationResumeContext, zC as WorktreeHandle, zb as InMemoryDelegationStore, zh as DelegateError, zn as ChildQuestionInbox, zv as FeedbackEvent, zy as DelegateUiAuditRoute } from "../types-C9qQxCd9.js";
2
2
  import { a as KbGateResult, i as FactJudgeVerdict, n as FactCandidate, o as createKbGate, r as FactJudge, t as CreateKbGateOptions } from "../kb-gate-C8z2juK8.js";
3
- import { n as mcpToolsForRuntimeMcpSubset, t as mcpToolsForRuntimeMcp } from "../openai-tools-DWuf9K9X.js";
3
+ import { n as mcpToolsForRuntimeMcpSubset, t as mcpToolsForRuntimeMcp } from "../openai-tools-mpuNXxBB.js";
4
4
  import { l as PlatformConnection } from "../integrations-DopfCC2a.js";
5
5
  import { AgentProfileMcpServer, HarnessType } from "@tangle-network/agent-interface";
6
6
  //#region src/mcp/codex-diagnostics.d.ts
package/dist/mcp/index.js CHANGED
@@ -1,16 +1,16 @@
1
- import { Br as localHarnessExecutable, En as assertBoxlessPromptOptions, Fr as removeWorktree, G as environmentReader, Hr as CodexExecutionDiagnosticError, Ir as DEFAULT_LOCAL_HARNESS, K as hostDirectoryReader, Lr as LOCAL_HARNESSES, Mr as runWorktreeHarness, Nr as captureWorktreeDiff, Pr as createWorktree, Vr as parseCodexTokenUsage, W as SPAWN_RESOURCE_PATH_MAX_BYTES, dr as createPropagatingTraceEmitter, fr as mergeTraceEnv, mr as traceContextToEnv, pr as readTraceContextFromEnv, q as resolveSpawnResourcePaths, vn as createSandboxForSpec, xn as runAgentRounds, zr as harnessSupportsReasoningEffort } from "../supervisor-B-bkXttM.js";
1
+ import { Br as localHarnessExecutable, En as assertBoxlessPromptOptions, Fr as removeWorktree, G as environmentReader, Hr as CodexExecutionDiagnosticError, Ir as DEFAULT_LOCAL_HARNESS, K as hostDirectoryReader, Lr as LOCAL_HARNESSES, Mr as runWorktreeHarness, Nr as captureWorktreeDiff, Pr as createWorktree, Vr as parseCodexTokenUsage, W as SPAWN_RESOURCE_PATH_MAX_BYTES, dr as createPropagatingTraceEmitter, fr as mergeTraceEnv, mr as traceContextToEnv, pr as readTraceContextFromEnv, q as resolveSpawnResourcePaths, vn as createSandboxForSpec, xn as runAgentRounds, zr as harnessSupportsReasoningEffort } from "../supervisor-CLi80MYC.js";
2
2
  import { i as ConfigError, m as ValidationError } from "../errors-DodWX-cb.js";
3
3
  import { J as deleteBoxSafe, at as sleep, ct as throwIfAborted, st as throwAbort } from "../sandbox-profile-compat-D_ZOL80S.js";
4
4
  import { t as assertExecutableAgentProfile } from "../model-policy-CyCUwHed.js";
5
- import { R as runCoderChecks, gt as selectValidWinner } from "../runtime-DMVBv34m.js";
6
- import { A as ANALYST_DEFINITION_BOUNDS, I as downMessageRefusalReasons, P as createCoordinationTools, R as parseAuthoredAnalystDefinition, j as analystToolGroupNames, z as questionEscalationTargets } from "../coordination-driver-rNoFHYmZ.js";
5
+ import { R as runCoderChecks, gt as selectValidWinner } from "../runtime-B-qPSZyM.js";
6
+ import { A as ANALYST_DEFINITION_BOUNDS, I as downMessageRefusalReasons, P as createCoordinationTools, R as parseAuthoredAnalystDefinition, j as analystToolGroupNames, z as questionEscalationTargets } from "../coordination-driver-DIxyUXKr.js";
7
7
  import { n as SUPPORTED_PROTOCOL_VERSIONS, r as createStdioToolServer } from "../tool-server-Dqer2M4_.js";
8
8
  import { t as createKbGate } from "../kb-gate-DpaSwXVx.js";
9
9
  import { _ as InMemoryFeedbackStore, a as validateDelegationStatusArgs, c as DELEGATION_HISTORY_TOOL_NAME, d as delegationProfiles, f as DELEGATE_FEEDBACK_DESCRIPTION, g as validateDelegateFeedbackArgs, h as createDelegateFeedbackHandler, i as createDelegationStatusHandler, l as createDelegationHistoryHandler, m as DELEGATE_FEEDBACK_TOOL_NAME, n as DELEGATION_STATUS_INPUT_SCHEMA, o as DELEGATION_HISTORY_DESCRIPTION, p as DELEGATE_FEEDBACK_INPUT_SCHEMA, r as DELEGATION_STATUS_TOOL_NAME, s as DELEGATION_HISTORY_INPUT_SCHEMA, t as DELEGATION_STATUS_DESCRIPTION, u as validateDelegationHistoryArgs, v as eventToSnapshot } from "../delegation-status-CF4D0NZ_.js";
10
10
  import { n as mcpToolsForRuntimeMcpSubset, t as mcpToolsForRuntimeMcp } from "../openai-tools-DoQ32vpe.js";
11
11
  import { t as coderTaskToPrompt } from "../coder-yhVWbdWc.js";
12
12
  import { n as PlatformHubError } from "../integrations-dFi-ALk7.js";
13
- import { C as composeLoopTraceEmitters, S as capDelegationTrace, _ as FileDelegationStore, a as DELEGATE_UI_AUDIT_TOOL_NAME, b as DELEGATION_TRACE_MAX_SPANS, c as DELEGATE_DESCRIPTION, d as createDelegateHandler, f as validateDelegateArgs, g as DelegationStateCorruptError, h as DelegationPersistenceError, i as DELEGATE_UI_AUDIT_INPUT_SCHEMA, l as DELEGATE_INPUT_SCHEMA, m as hashIdempotencyInput, n as createMcpServer, o as createDelegateUiAuditHandler, p as DelegationTaskQueue, r as DELEGATE_UI_AUDIT_DESCRIPTION, s as validateDelegateUiAuditArgs, t as createInProcessTransport, u as DELEGATE_TOOL_NAME, v as InMemoryDelegationStore, w as createDelegationTraceCollector, x as buildDelegationTraceSpans, y as DELEGATION_TRACE_MAX_BYTES } from "../server-z7xI_ItY.js";
13
+ import { C as composeLoopTraceEmitters, S as capDelegationTrace, _ as FileDelegationStore, a as DELEGATE_UI_AUDIT_TOOL_NAME, b as DELEGATION_TRACE_MAX_SPANS, c as DELEGATE_DESCRIPTION, d as createDelegateHandler, f as validateDelegateArgs, g as DelegationStateCorruptError, h as DelegationPersistenceError, i as DELEGATE_UI_AUDIT_INPUT_SCHEMA, l as DELEGATE_INPUT_SCHEMA, m as hashIdempotencyInput, n as createMcpServer, o as createDelegateUiAuditHandler, p as DelegationTaskQueue, r as DELEGATE_UI_AUDIT_DESCRIPTION, s as validateDelegateUiAuditArgs, t as createInProcessTransport, u as DELEGATE_TOOL_NAME, v as InMemoryDelegationStore, w as createDelegationTraceCollector, x as buildDelegationTraceSpans, y as DELEGATION_TRACE_MAX_BYTES } from "../server-BwdkANs5.js";
14
14
  import { a as createMemoryToolServer, c as resolveMemoryFromEnv, i as MEMORY_NAME_ENV, n as MEMORY_ITEMS_ENV, o as parseMemoryItems, r as MEMORY_LOG_ENV, s as readMemoryItemsFile, t as MEMORY_FILE_ENV } from "../memory-server-DXQ8IxGR.js";
15
15
  import { agentProfileSchema } from "@tangle-network/agent-interface";
16
16
  import { randomUUID } from "node:crypto";
@@ -1,4 +1,4 @@
1
- import { h as OpenAIChatTool } from "./types-BO8kh52C.js";
1
+ import { h as OpenAIChatTool } from "./types-C9qQxCd9.js";
2
2
  //#region src/mcp/openai-tools.d.ts
3
3
  /**
4
4
  *
@@ -21,4 +21,4 @@ declare function mcpToolsForRuntimeMcp(): OpenAIChatTool[];
21
21
  declare function mcpToolsForRuntimeMcpSubset(names: ReadonlyArray<string>): OpenAIChatTool[];
22
22
  //#endregion
23
23
  export { mcpToolsForRuntimeMcpSubset as n, mcpToolsForRuntimeMcp as t };
24
- //# sourceMappingURL=openai-tools-DWuf9K9X.d.ts.map
24
+ //# sourceMappingURL=openai-tools-mpuNXxBB.d.ts.map
@@ -1,4 +1,4 @@
1
- import { Bb as CoderTask, Vb as coderTaskToPrompt, _b as researcherProfile, ab as UiFindingScreenshot, cb as KnowledgeItem, db as ResearchOutput, fb as ResearchSource, gb as multiHarnessResearcherFanout, hb as createResearcherValidator, ib as UiFinding, lb as KnowledgeUpdate, mb as ResearcherProfileOptions, nb as UI_FINDING_SEVERITIES, ob as UiFindingSeverity, pb as ResearchTask, rb as UI_LENSES, sb as UiLens, ub as MultiHarnessResearcherFanoutOptions } from "./types-BO8kh52C.js";
1
+ import { Hb as coderTaskToPrompt, Vb as CoderTask, _b as multiHarnessResearcherFanout, ab as UiFinding, cb as UiLens, db as MultiHarnessResearcherFanoutOptions, fb as ResearchOutput, gb as createResearcherValidator, hb as ResearcherProfileOptions, ib as UI_LENSES, lb as KnowledgeItem, mb as ResearchTask, ob as UiFindingScreenshot, pb as ResearchSource, rb as UI_FINDING_SEVERITIES, sb as UiFindingSeverity, ub as KnowledgeUpdate, vb as researcherProfile } from "./types-C9qQxCd9.js";
2
2
  import { SandboxEvent } from "@tangle-network/sandbox";
3
3
  //#region src/profiles/ui-auditor/lens-prompts.d.ts
4
4
  /** Cross-lens rules injected into every UI audit iteration: finding quality standards and scope limits. @experimental */
@@ -1,8 +1,8 @@
1
1
  import { o as writeAtomicDurableFile } from "./durable-file-B_eJr6Mb.js";
2
- import { At as createInbox, Di as executableAgentProfileSnapshot, Et as taskToPrompt, Gn as destroyInteractiveEnvironment, Kn as environmentGone, Q as interactiveAdmissionSeamKey, Wn as retainedCreateMaterial, Xn as abortError$1, Zn as linkAbort, ci as attestRuntimeOwnedPendingExecutor, et as readWorkerInteractiveBinding, fi as finalizeRuntimeOwnedPendingExecutor, gi as newExecutionAttemptId, ha as detachedSnapshot, ji as abortError, n as createRootHandle, pa as contentAddress, r as createSupervisor, rt as startRetainedInteractiveRun } from "./supervisor-B-bkXttM.js";
2
+ import { At as createInbox, Di as executableAgentProfileSnapshot, Et as taskToPrompt, Gn as destroyInteractiveEnvironment, Kn as environmentGone, Q as interactiveAdmissionSeamKey, Wn as retainedCreateMaterial, Xn as abortError$1, Zn as linkAbort, ci as attestRuntimeOwnedPendingExecutor, et as readWorkerInteractiveBinding, fi as finalizeRuntimeOwnedPendingExecutor, gi as newExecutionAttemptId, ha as detachedSnapshot, ji as abortError, n as createRootHandle, pa as contentAddress, r as createSupervisor, rt as startRetainedInteractiveRun } from "./supervisor-CLi80MYC.js";
3
3
  import { Ct as armDeadlineTimer, at as sleep } from "./sandbox-profile-compat-D_ZOL80S.js";
4
4
  import { a as concreteProfileModel } from "./model-policy-CyCUwHed.js";
5
- import { C as createFileRunContext, P as createCoordinationTools, n as createSteerAcknowledger, t as createCancelAcknowledger } from "./coordination-driver-rNoFHYmZ.js";
5
+ import { C as createFileRunContext, P as createCoordinationTools, n as createSteerAcknowledger, t as createCancelAcknowledger } from "./coordination-driver-DIxyUXKr.js";
6
6
  import { h as supervisorRunDir } from "./run-layout-Cu8H7aeh.js";
7
7
  import { agentInteractiveSessionControlClaimRequestDigest, agentInteractiveSessionPromptRequestDigest, agentInteractiveSessionStopRequestDigest, agentProfileSchema, canonicalAgentProfileDigest, canonicalCandidateDigest } from "@tangle-network/agent-interface";
8
8
  import { randomUUID } from "node:crypto";
@@ -999,4 +999,4 @@ function writeState(path, state) {
999
999
  //#endregion
1000
1000
  export { workerFromInteractiveProvider as n, claimRetainedInteractiveControl as r, provisionSupervisor as t };
1001
1001
 
1002
- //# sourceMappingURL=provision-supervisor-Ced9EeHy.js.map
1002
+ //# sourceMappingURL=provision-supervisor-BGXehCW5.js.map