@tangle-network/agent-runtime 0.116.0 → 0.117.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 (81) hide show
  1. package/README.md +7 -1
  2. package/dist/{activation-DuqQhee6.js → activation-BZ2FyX0O.js} +3 -3
  3. package/dist/{activation-DuqQhee6.js.map → activation-BZ2FyX0O.js.map} +1 -1
  4. package/dist/agent.d.ts +3 -64
  5. package/dist/agent.js +5 -207
  6. package/dist/agent.js.map +1 -1
  7. package/dist/{analyst-loop-BoNIG2hA.js → analyst-loop-DvSciOfB.js} +2 -2
  8. package/dist/{analyst-loop-BoNIG2hA.js.map → analyst-loop-DvSciOfB.js.map} +1 -1
  9. package/dist/analyst-loop.js +1 -1
  10. package/dist/candidate-execution/index.d.ts +3 -3
  11. package/dist/candidate-execution/index.js +5 -5
  12. package/dist/{candidate-execution-CfpJrd3o.js → candidate-execution-PX61zXd2.js} +4 -4
  13. package/dist/{candidate-execution-CfpJrd3o.js.map → candidate-execution-PX61zXd2.js.map} +1 -1
  14. package/dist/{environment-provider-CWsRh6Uz.d.ts → environment-provider-CTZjdIUg.d.ts} +298 -32
  15. package/dist/{environment-provider-CCaEhA-l.js → environment-provider-CzcEyRL7.js} +140 -31
  16. package/dist/environment-provider-CzcEyRL7.js.map +1 -0
  17. package/dist/environment-provider.d.ts +1 -1
  18. package/dist/environment-provider.js +1 -1
  19. package/dist/{improvement-cycle-C1cmjvPD.js → improvement-cycle-Bcqz8rZI.js} +160 -19
  20. package/dist/improvement-cycle-Bcqz8rZI.js.map +1 -0
  21. package/dist/{index-CYkDeM5L.d.ts → index-BHSYaWrC.d.ts} +3 -3
  22. package/dist/{index-DcLMNnG5.d.ts → index-BTUG4Xln.d.ts} +6 -6
  23. package/dist/{index-COumPQka.d.ts → index-DPWJxSRa.d.ts} +847 -275
  24. package/dist/{index-C-FYUuFG.d.ts → index-X2YwyWkc.d.ts} +2 -2
  25. package/dist/index.d.ts +8 -8
  26. package/dist/index.js +12 -12
  27. package/dist/intelligence.d.ts +8 -7
  28. package/dist/intelligence.js +15 -9
  29. package/dist/intelligence.js.map +1 -1
  30. package/dist/kernel.d.ts +3 -3
  31. package/dist/kernel.js +8 -8
  32. package/dist/{knowledge-DOzbywZT.js → knowledge-CDlrayRc.js} +7 -7
  33. package/dist/knowledge-CDlrayRc.js.map +1 -0
  34. package/dist/knowledge.d.ts +1 -1
  35. package/dist/knowledge.js +1 -1
  36. package/dist/{loop-runner-bin-BuQjc5DR.js → loop-runner-bin-BxhhDtmG.js} +4 -4
  37. package/dist/{loop-runner-bin-BuQjc5DR.js.map → loop-runner-bin-BxhhDtmG.js.map} +1 -1
  38. package/dist/{loop-runner-bin-BFrhPLKt.d.ts → loop-runner-bin-oyL7it5O.d.ts} +3 -3
  39. package/dist/loop-runner-bin.d.ts +1 -1
  40. package/dist/loop-runner-bin.js +1 -1
  41. package/dist/mcp/bin.js +43 -10
  42. package/dist/mcp/bin.js.map +1 -1
  43. package/dist/mcp/index.d.ts +3 -43
  44. package/dist/mcp/index.js +5 -204
  45. package/dist/mcp/index.js.map +1 -1
  46. package/dist/{openai-tools-_Wyp4udO.js → openai-tools-CO9X36zy.js} +2 -2
  47. package/dist/{openai-tools-_Wyp4udO.js.map → openai-tools-CO9X36zy.js.map} +1 -1
  48. package/dist/{prepare-BHQBb02e.js → prepare-BbI6qGOW.js} +5 -2
  49. package/dist/prepare-BbI6qGOW.js.map +1 -0
  50. package/dist/primeintellect/index.d.ts +1 -1
  51. package/dist/{protected-model-port-BP6Z4eau.d.ts → protected-model-port-B0yXMpLL.d.ts} +10 -2
  52. package/dist/{protected-model-port-DqAH1Z2M.js → protected-model-port-COnyZfML.js} +2 -2
  53. package/dist/{protected-model-port-DqAH1Z2M.js.map → protected-model-port-COnyZfML.js.map} +1 -1
  54. package/dist/{runtime-Ut1pkd2n.js → runtime-Ce39zfqn.js} +145 -53
  55. package/dist/runtime-Ce39zfqn.js.map +1 -0
  56. package/dist/{sandbox-events-DeI5xX8P.js → sandbox-events-Yhd1GYWl.js} +4 -2
  57. package/dist/sandbox-events-Yhd1GYWl.js.map +1 -0
  58. package/dist/spawn-journal-B_mu_oH2.js +857 -0
  59. package/dist/spawn-journal-B_mu_oH2.js.map +1 -0
  60. package/dist/{structural-rollout-CVY_0hJp.js → structural-rollout-DLwW69R4.js} +4 -4
  61. package/dist/structural-rollout-DLwW69R4.js.map +1 -0
  62. package/dist/{supervise-BUR9ByF7.js → supervise-U7_K5yuV.js} +2598 -821
  63. package/dist/supervise-U7_K5yuV.js.map +1 -0
  64. package/dist/{supervisor-BBbPBXpe.js → supervisor-CAXiCKnX.js} +2808 -973
  65. package/dist/supervisor-CAXiCKnX.js.map +1 -0
  66. package/dist/testing.js +98 -76
  67. package/dist/testing.js.map +1 -1
  68. package/dist/{workspace-archive-DXzJq7WP.js → workspace-archive-CqPIijFA.js} +2 -2
  69. package/dist/{workspace-archive-DXzJq7WP.js.map → workspace-archive-CqPIijFA.js.map} +1 -1
  70. package/package.json +1 -1
  71. package/dist/environment-provider-CCaEhA-l.js.map +0 -1
  72. package/dist/improvement-cycle-C1cmjvPD.js.map +0 -1
  73. package/dist/knowledge-DOzbywZT.js.map +0 -1
  74. package/dist/prepare-BHQBb02e.js.map +0 -1
  75. package/dist/runtime-Ut1pkd2n.js.map +0 -1
  76. package/dist/sandbox-events-DeI5xX8P.js.map +0 -1
  77. package/dist/spawn-journal-DCPbicXB.js +0 -457
  78. package/dist/spawn-journal-DCPbicXB.js.map +0 -1
  79. package/dist/structural-rollout-CVY_0hJp.js.map +0 -1
  80. package/dist/supervise-BUR9ByF7.js.map +0 -1
  81. package/dist/supervisor-BBbPBXpe.js.map +0 -1
@@ -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 substrate) 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 `TANGLE_API_KEY`. The brain's router reuses the\n * repo's `resolveRouterBaseUrl` convention\n * (`TANGLE_ROUTER_URL` / `TANGLE_ROUTER_BASE_URL`), normalised to an OpenAI-compatible `/v1` endpoint,\n * keyed by `TANGLE_API_KEY`.\n *\n * @experimental\n */\n\nimport type { BackendType } from '@tangle-network/sandbox'\nimport { type RouterEnv, resolveRouterBaseUrl } from '../model-resolution.js'\nimport type { SandboxClient } from '../runtime'\nimport type { RouterConfig } from '../runtime/router-client'\nimport type { ExecutorConfig } from '../runtime/supervise/runtime'\nimport type { DelegateHandlerOptions } from './tools/delegate'\n\nconst DEFAULT_SUPERVISOR_MODEL = 'moonshotai/kimi-k2.6'\nconst DEFAULT_WORKER_HARNESS = 'opencode'\n\nfunction trimmed(value: string | undefined): string | undefined {\n const v = value?.trim()\n return v ? v : undefined\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/** Resolve the supervisor brain's router substrate from env. The key falls back through the platform\n * key the bin already requires; the base reuses `resolveRouterBaseUrl`, normalised to `/v1`. */\nfunction resolveRouter(env: NodeJS.ProcessEnv): RouterConfig {\n const routerKey = trimmed(env.MCP_SUPERVISOR_ROUTER_KEY) ?? trimmed(env.TANGLE_API_KEY) ?? ''\n const base = trimmed(env.MCP_SUPERVISOR_ROUTER_BASE_URL) ?? resolveRouterBaseUrl(env as RouterEnv)\n const routerBaseUrl = /\\/v\\d+\\/?$/.test(base)\n ? base.replace(/\\/$/, '')\n : `${base.replace(/\\/$/, '')}/v1`\n const model =\n trimmed(env.MCP_SUPERVISOR_MODEL) ??\n trimmed(env.MCP_WORKER_MODEL) ??\n trimmed(env.WORKER_MODEL) ??\n DEFAULT_SUPERVISOR_MODEL\n return { routerBaseUrl, routerKey, model }\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` (authored workers run as sub-sandboxes via the same\n * client) on the harness named by `MCP_DELEGATE_WORKER_HARNESS` (default `opencode`).\n */\nexport function resolveDelegateSupervisor(\n sandboxClient: SandboxClient,\n env: NodeJS.ProcessEnv = process.env,\n): DelegateHandlerOptions | undefined {\n if (!delegateEnabled(env)) return undefined\n const router = resolveRouter(env)\n const harness = (trimmed(env.MCP_DELEGATE_WORKER_HARNESS) ??\n DEFAULT_WORKER_HARNESS) as BackendType\n const backend: ExecutorConfig = {\n backend: 'sandbox',\n harness,\n sandboxClient,\n }\n return {\n router,\n backend,\n model: router.model,\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 same `SandboxClient` the bin loads from `TANGLE_API_KEY`. The queue-bound tools\n * (`delegate_feedback`, `delegation_status`, `delegation_history`) are always served.\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 * 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 TANGLE_API_KEY.\n * MCP_SUPERVISOR_MODEL supervisor brain model id (falls back to MCP_WORKER_MODEL, then\n * WORKER_MODEL, then a default). Must be a tool-calling model.\n * MCP_SUPERVISOR_ROUTER_KEY router key for the supervisor brain (defaults to TANGLE_API_KEY)\n * MCP_SUPERVISOR_ROUTER_BASE_URL router base for the supervisor brain (defaults to the repo's\n * resolveRouterBaseUrl, normalized to `/v1`)\n * MCP_DELEGATE_WORKER_HARNESS harness the authored workers run on (default `opencode`)\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 { 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 = 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 to serve `delegate`. 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 const delegateSupervisor =\n wantDelegate && sandboxClient ? resolveDelegateSupervisor(sandboxClient) : undefined\n if (wantDelegate && delegateSupervisor) {\n process.stderr.write('agent-runtime-mcp: delegate enabled — generic authoring supervisor\\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\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: TANGLE_API_KEY is unset; `delegate` is disabled in diagnostic mode. Set TANGLE_API_KEY or unset MCP_ENABLE_DELEGATE to remove the unsupported tool 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 // @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":"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"}
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 substrate) 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 `TANGLE_API_KEY`. The brain's router reuses the\n * repo's `resolveRouterBaseUrl` convention\n * (`TANGLE_ROUTER_URL` / `TANGLE_ROUTER_BASE_URL`), normalised to an OpenAI-compatible `/v1` endpoint,\n * keyed by `TANGLE_API_KEY`.\n *\n * @experimental\n */\n\nimport type { BackendType } from '@tangle-network/sandbox'\nimport { ConfigError } from '../errors'\nimport { type RouterEnv, resolveRouterBaseUrl } from '../model-resolution.js'\nimport type { SandboxClient } from '../runtime'\nimport type { RouterConfig } from '../runtime/router-client'\nimport type { ExecutorConfig } from '../runtime/supervise/runtime'\nimport type { DelegateHandlerOptions } from './tools/delegate'\n\nconst DEFAULT_WORKER_HARNESS = 'opencode'\n\nfunction trimmed(value: string | undefined): string | undefined {\n const v = value?.trim()\n return v ? v : undefined\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 * Resolve the supervisor brain's router substrate from env. The base reuses `resolveRouterBaseUrl`,\n * normalised to `/v1`.\n *\n * The KEY is the one for INFERENCE, which inside a sandbox is not the one for the sandbox. A box\n * carries both: an inference credential for the OpenAI-compatible endpoint the brain calls, and\n * `TANGLE_API_KEY`, which authenticates the sandbox CONTROL API — create a box, run a process —\n * and which the router answers `403`. The brain therefore prefers the inference credential and\n * keeps the platform key as the last rung, for a host that runs one key for both.\n *\n * `TANGLE_INFERENCE_KEY` leads because it is Tangle's own name for that credential. `OPENAI_API_KEY`\n * holds the identical value and stays on the ladder for boxes provisioned before the Tangle-native\n * name existed, and for a BYO OpenAI key — but it is a vendor spelling of a Tangle credential, and\n * naming it first made this ladder read as \"prefer OpenAI over Tangle\" to the people who own the\n * product (agent-dev-container#4614). A name that needs a paragraph to disclaim is the wrong name.\n *\n * The order is not a preference between vendors. It is: what the caller explicitly set, then the\n * inference credential, then the control-plane key as a single-key-host fallback.\n *\n * The MODEL is NAMED, never guessed. Which ids a given router serves is deployment state this\n * package cannot know, and a wrong guess is invisible until the supervisor's first completion\n * rejects — after the tool has been advertised to an agent, from inside a child process whose\n * stderr nobody reads. `TANGLE_ROUTER_MODEL` is on the ladder because the sandbox platform sets it\n * on every box: a delegate child running there inherits the model its own host declared. When\n * nothing names one, fail at startup with the ladder in the message.\n */\nfunction resolveRouter(env: NodeJS.ProcessEnv): RouterConfig {\n const routerKey =\n trimmed(env.MCP_SUPERVISOR_ROUTER_KEY) ??\n trimmed(env.TANGLE_INFERENCE_KEY) ??\n trimmed(env.OPENAI_API_KEY) ??\n trimmed(env.TANGLE_API_KEY) ??\n ''\n const base = trimmed(env.MCP_SUPERVISOR_ROUTER_BASE_URL) ?? resolveRouterBaseUrl(env as RouterEnv)\n const routerBaseUrl = /\\/v\\d+\\/?$/.test(base)\n ? base.replace(/\\/$/, '')\n : `${base.replace(/\\/$/, '')}/v1`\n const model =\n trimmed(env.MCP_SUPERVISOR_MODEL) ??\n trimmed(env.MCP_WORKER_MODEL) ??\n trimmed(env.WORKER_MODEL) ??\n trimmed(env.TANGLE_ROUTER_MODEL)\n if (!model) {\n throw new ConfigError(\n 'agent-runtime-mcp: no supervisor brain model — set MCP_SUPERVISOR_MODEL (or MCP_WORKER_MODEL / ' +\n 'WORKER_MODEL / TANGLE_ROUTER_MODEL) to a tool-calling model the router serves.',\n )\n }\n return { routerBaseUrl, routerKey, model }\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` (authored workers run as sub-sandboxes via the same\n * client) on the harness named by `MCP_DELEGATE_WORKER_HARNESS` (default `opencode`).\n */\nexport function resolveDelegateSupervisor(\n sandboxClient: SandboxClient,\n env: NodeJS.ProcessEnv = process.env,\n): DelegateHandlerOptions | undefined {\n if (!delegateEnabled(env)) return undefined\n const router = resolveRouter(env)\n const harness = (trimmed(env.MCP_DELEGATE_WORKER_HARNESS) ??\n DEFAULT_WORKER_HARNESS) as BackendType\n const backend: ExecutorConfig = {\n backend: 'sandbox',\n harness,\n sandboxClient,\n }\n return {\n router,\n backend,\n model: router.model,\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 same `SandboxClient` the bin loads from `TANGLE_API_KEY`. The queue-bound tools\n * (`delegate_feedback`, `delegation_status`, `delegation_history`) are always served.\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 * 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 TANGLE_API_KEY.\n * MCP_SUPERVISOR_MODEL supervisor brain model id (falls back to MCP_WORKER_MODEL, then\n * WORKER_MODEL, then TANGLE_ROUTER_MODEL). Must be a tool-calling\n * model the router serves; with none named the bin exits 2.\n * MCP_SUPERVISOR_ROUTER_KEY router key for the supervisor brain (falls back to the box's\n * inference credential TANGLE_INFERENCE_KEY, then its vendor\n * spelling OPENAI_API_KEY, then TANGLE_API_KEY — which\n * authenticates the sandbox API, not the router)\n * MCP_SUPERVISOR_ROUTER_BASE_URL router base for the supervisor brain (defaults to the repo's\n * resolveRouterBaseUrl, normalized to `/v1`)\n * MCP_DELEGATE_WORKER_HARNESS harness the authored workers run on (default `opencode`)\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 = 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 to serve `delegate`. 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.router.model}\\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\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: TANGLE_API_KEY is unset; `delegate` is disabled in diagnostic mode. Set TANGLE_API_KEY or unset MCP_ENABLE_DELEGATE to remove the unsupported tool 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 // @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":"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"}
@@ -1,11 +1,10 @@
1
+ import { $c as McpServer, $d as CoderOutput, $l as DiffResult, $u as DelegateCodeArgs, Ac as AuthorizeDownMessage, Ad as DELEGATION_TRACE_MAX_SPANS, Au as createSiblingSandboxExecutor, Bc as DownMessageEvent, Bd as DelegationStore, Bu as parseDetachedSessionRef, Cd as FeedbackRefersTo, Cu as detachedSessionDelegate, Dd as UiAuditorDelegationOutput, Du as FleetWorkspaceExecutorOptions, Ed as UiAuditLensFilter, Eu as FleetHandle, Fc as CoordinationToolsOptions, Fd as capDelegationTrace, Fu as DriveTurnTick, Gc as QuestionOption, Gu as DelegationResumeDriver, Hc as Question, Hd as FileDelegationStoreOptions, Hu as DelegationArgs, Ic as DEFAULT_AWAIT_EVENT_TIMEOUT_MS, Id as composeLoopTraceEmitters, Iu as RunDetachedTurnOptions, Jc as QuestionUrgency, Ju as DelegationTaskQueue, Kc as QuestionPolicy, Ku as DelegationResumeTick, Lc as DownMessageAuthorizationInput, Ld as createDelegationTraceCollector, Lu as createDetachedTurnResumeDriver, Mc as ContinuationInstruction, Md as DelegationTraceCollector, Mu as DetachedTurn, Nc as CoordinationEvent, Nd as DelegationTraceSpan, Nu as DetachedTurnResumeDriverOptions, Oc as AnalystFindingEvent, Od as CappedDelegationTrace, Ou as SiblingSandboxExecutorOptions, Pc as CoordinationTools, Pd as buildDelegationTraceSpans, Pu as DriveTurnCapableBox, Qc as createCoordinationTools, Ql as DiffOptions, Qu as hashIdempotencyInput, Rc as DownMessageDeliveryAttempt, Rd as DelegationPersistenceError, Ru as detachedTurnEvents, Sd as FeedbackRating, Su as coderTaskFromArgs, Td as ResearchSource, Tu as DelegationExecutor, Uc as QuestionDecision, Ud as InMemoryDelegationStore, Uu as DelegationRecord, Vc as MakeWorkerAgent, Vd as FileDelegationStore, Vu as runDetachedTurn, Wc as QuestionLevel, Wu as DelegationResumeContext, Xc as WorkerSpawnContext, Xu as SubmitInput, Yc as SettledWorker, Yu as DelegationTaskQueueOptions, Zc as WorkerWatchOptions, Zl as CreateWorktreeOptions, Zu as SubmitOutput, _d as DelegationProgress, _u as DelegateRunCtx, ad as DelegateResearchConfig, al as DELEGATE_TOOL_NAME, au as removeWorktree, bd as DelegationStatusArgs, bu as SettleDetachedCoderTurnOptions, cd as DelegateUiAuditConfig, cl as DelegateHandlerOptions, cu as McpToolDescriptor, dd as DelegationError, dl as validateDelegateArgs, du as FeedbackStore, ed as DelegateCodeConfig, el as McpServerOptions, eu as GitRunner, fd as DelegationFeedbackSnapshot, fu as InMemoryFeedbackStore, gd as DelegationProfile, gu as CoderReviewer, hd as DelegationHistoryResult, hu as CoderReview, id as DelegateResearchArgs, il as DELEGATE_INPUT_SCHEMA, iu as createWorktree, jc as AuthorizedDownMessage, jd as DelegationTraceCaps, ju as DetachedSessionRefParts, kc as AnalystRegistry, kd as DELEGATION_TRACE_MAX_BYTES, ku as createFleetWorkspaceExecutor, ld as DelegateUiAuditResult, ll as DelegateResult, lu as McpTransport, md as DelegationHistoryEntry, mu as CoderDelegate, nd as DelegateFeedbackArgs, nl as createMcpServer, nu as WorktreeHandle, od as DelegateResearchResult, ol as DelegateArgs, ou as JsonRpcMessage, pd as DelegationHistoryArgs, pu as eventToSnapshot, qc as QuestionRecord, qu as DelegationRunContext, rd as DelegateFeedbackResult, rl as DELEGATE_DESCRIPTION, ru as captureWorktreeDiff, sd as DelegateUiAuditArgs, sl as DelegateError, su as JsonRpcResponse, td as DelegateCodeResult, tl as createInProcessTransport, tu as RemoveWorktreeOptions, ud as DelegateUiAuditRoute, ul as createDelegateHandler, uu as FeedbackEvent, vd as DelegationResultPayload, vu as DetachedSessionDelegateOptions, wd as ResearchOutputShape, wu as settleDetachedCoderTurn, xd as DelegationStatusResult, xu as UiAuditorDelegate, yd as DelegationStatus, yu as DetachedWinnerSelection, zc as DownMessageDeliveryOutcome, zd as DelegationStateCorruptError, zu as formatDetachedSessionRef } from "../index-DPWJxSRa.js";
1
2
  import { E as SandboxClient, h as LoopSandboxPlacement } from "../types-DnNGJ5Gz.js";
2
- import { Ct as TraceContext, Et as traceContextToEnv, Tt as readTraceContextFromEnv, wt as createPropagatingTraceEmitter } from "../environment-provider-CWsRh6Uz.js";
3
- import { $l as createSiblingSandboxExecutor, $u as DELEGATION_TRACE_MAX_SPANS, Ac as DelegateArgs, Al as JsonRpcResponse, Au as DelegateUiAuditArgs, Bl as DelegateRunCtx, Bu as DelegationProgress, Cc as McpServer, Cl as GitRunner, Cu as DelegateCodeConfig, Dc as DELEGATE_DESCRIPTION, Dl as createWorktree, Du as DelegateResearchArgs, Ec as createMcpServer, El as captureWorktreeDiff, Eu as DelegateFeedbackResult, Fl as InMemoryFeedbackStore, Fu as DelegationFeedbackSnapshot, Gl as coderTaskFromArgs, Gu as FeedbackRating, Hl as DetachedWinnerSelection, Hu as DelegationStatus, Il as eventToSnapshot, Iu as DelegationHistoryArgs, Jl as DelegationExecutor, Ju as ResearchSource, Kl as detachedSessionDelegate, Ku as FeedbackRefersTo, Ll as CoderDelegate, Lu as DelegationHistoryEntry, Mc as DelegateResult, Ml as McpTransport, Mu as DelegateUiAuditResult, Nc as createDelegateHandler, Nl as FeedbackEvent, Nu as DelegateUiAuditRoute, Oc as DELEGATE_INPUT_SCHEMA, Ol as removeWorktree, Ou as DelegateResearchConfig, Pc as validateDelegateArgs, Pl as FeedbackStore, Pu as DelegationError, Ql as createFleetWorkspaceExecutor, Qu as DELEGATION_TRACE_MAX_BYTES, Rl as CoderReview, Ru as DelegationHistoryResult, Sc as createCoordinationTools, Sd as CoderOutput, Sl as DiffResult, Su as DelegateCodeArgs, Tc as createInProcessTransport, Tl as WorktreeHandle, Tu as DelegateFeedbackArgs, Ul as SettleDetachedCoderTurnOptions, Uu as DelegationStatusArgs, Vl as DetachedSessionDelegateOptions, Vu as DelegationResultPayload, Wl as UiAuditorDelegate, Wu as DelegationStatusResult, Xl as FleetWorkspaceExecutorOptions, Xu as UiAuditorDelegationOutput, Yl as FleetHandle, Yu as UiAuditLensFilter, Zl as SiblingSandboxExecutorOptions, Zu as CappedDelegationTrace, _c as QuestionPolicy, _u as DelegationTaskQueue, ac as AnalystFindingEvent, ad as composeLoopTraceEmitters, au as RunDetachedTurnOptions, bc as SettledWorker, bl as CreateWorktreeOptions, bu as SubmitOutput, cc as CoordinationTools, cd as DelegationStateCorruptError, cu as formatDetachedSessionRef, dc as DownMessageEvent, dd as FileDelegationStoreOptions, du as DelegationArgs, ed as DelegationTraceCaps, eu as DetachedSessionRefParts, fc as MakeWorkerAgent, fd as InMemoryDelegationStore, fu as DelegationRecord, gc as QuestionOption, gu as DelegationRunContext, hc as QuestionLevel, hu as DelegationResumeTick, id as capDelegationTrace, iu as DriveTurnTick, jc as DelegateHandlerOptions, jl as McpToolDescriptor, ju as DelegateUiAuditConfig, kc as DELEGATE_TOOL_NAME, kl as JsonRpcMessage, ku as DelegateResearchResult, lc as CoordinationToolsOptions, ld as DelegationStore, lu as parseDetachedSessionRef, mc as QuestionDecision, mu as DelegationResumeDriver, nd as DelegationTraceSpan, nu as DetachedTurnResumeDriverOptions, oc as AnalystRegistry, od as createDelegationTraceCollector, ou as createDetachedTurnResumeDriver, pc as Question, pu as DelegationResumeContext, ql as settleDetachedCoderTurn, qu as ResearchOutputShape, rd as buildDelegationTraceSpans, ru as DriveTurnCapableBox, sc as CoordinationEvent, sd as DelegationPersistenceError, su as detachedTurnEvents, td as DelegationTraceCollector, tu as DetachedTurn, uc as DEFAULT_AWAIT_EVENT_TIMEOUT_MS, ud as FileDelegationStore, uu as runDetachedTurn, vc as QuestionRecord, vu as DelegationTaskQueueOptions, wc as McpServerOptions, wl as RemoveWorktreeOptions, wu as DelegateCodeResult, xc as WorkerWatchOptions, xl as DiffOptions, xu as hashIdempotencyInput, yc as QuestionUrgency, yu as SubmitInput, zl as CoderReviewer, zu as DelegationProfile } from "../index-COumPQka.js";
3
+ import { Bt as readTraceContextFromEnv, Rt as TraceContext, Vt as traceContextToEnv, zt as createPropagatingTraceEmitter } from "../environment-provider-CTZjdIUg.js";
4
4
  import { o as UiLens } from "../substrate-BcnuSHXm.js";
5
5
  import { a as LocalHarnessResult, c as runLocalHarness, i as LocalHarness, n as CodexExecutionPolicy, o as RunLocalHarnessOptions, r as CodexTokenUsage, s as parseCodexTokenUsage, t as CodexExecutionEvidence } from "../local-harness-t6cDWDQ2.js";
6
6
  import { a as KbGateResult, i as FactJudgeVerdict, n as FactCandidate, o as createKbGate, r as FactJudge, t as CreateKbGateOptions } from "../kb-gate-C8z2juK8.js";
7
7
  import { n as mcpToolsForRuntimeMcpSubset, t as mcpToolsForRuntimeMcp } from "../openai-tools-B68JaOCx.js";
8
- import { AnalystFinding } from "@tangle-network/agent-eval";
9
8
  import { AgentProfileMcpServer } from "@tangle-network/agent-interface";
10
9
  //#region src/mcp/codex-diagnostics.d.ts
11
10
  /** Bounded, credential-redacted process context attached when reproducible Codex output fails
@@ -207,45 +206,6 @@ interface ResolvedMemoryEnv {
207
206
  */
208
207
  declare function resolveMemoryFromEnv(env: Record<string, string | undefined>): ResolvedMemoryEnv;
209
208
  //#endregion
210
- //#region src/mcp/tools/checks.d.ts
211
- /** One lens — a composable analyst kind. Identity fields mirror `TraceAnalystKindSpec` so a kind is
212
- * upgradeable to the full agentic factory; `lookFor` is the lens question the actor applies. */
213
- interface Check {
214
- readonly id: string;
215
- readonly description: string;
216
- /** Coarse classification stamped on every finding this kind emits (the renderer groups by it). */
217
- readonly area: string;
218
- readonly version: string;
219
- /** The lens — what this analyst looks for in the trace. */
220
- readonly lookFor: string;
221
- }
222
- /** The built-in lens directory. Domain-blind (about any agent trace); compose at test time. */
223
- declare const defaultChecks: Record<string, Check>;
224
- /** Lift validated raw rows into `AnalystFinding`s (agent-eval `makeFinding` stamps `finding_id`/
225
- * `produced_at`), then enforce the trace-derived firewall (selector ≠ judge). Pure — no LLM. */
226
- declare function liftFindings(kind: Check, rows: unknown[], producedAt: string): AnalystFinding[];
227
- /** Render a worker's trace (tool calls + results) into the text an analyst lens reads. Generic over
228
- * the trace shape: a `{ messages }` conversation, a bare message array, else stringified. */
229
- declare function renderTrace(trace: unknown): string;
230
- interface CheckRunnerOptions {
231
- routerBaseUrl: string;
232
- routerKey: string;
233
- model: string;
234
- /** Test/override seam — replace the LLM call. Default: a router chat completion. */
235
- chat?: (system: string, user: string) => Promise<string>;
236
- }
237
- /** Run ONE lens over a trace → findings. Generic over any kind: prompt = the lens + the agent-eval
238
- * finding schema; the model's JSON array is parsed (`parseRawFinding`), lifted, and firewalled. */
239
- declare function runCheck(kind: Check, trace: unknown, opts: CheckRunnerOptions, producedAt: string): Promise<AnalystFinding[]>;
240
- /**
241
- * Build a `run_analyst` runner over a kind directory.
242
- * Returns findings, or a typed error for an unknown kind. `producedAt` is
243
- * passed in because replay-safe paths must not read `Date.now`.
244
- */
245
- declare function makeCheckRunner(kinds: Record<string, Check>, opts: CheckRunnerOptions): (kindId: string, trace: unknown, producedAt: string) => Promise<AnalystFinding[] | {
246
- error: string;
247
- }>;
248
- //#endregion
249
209
  //#region src/mcp/tools/delegate-feedback.d.ts
250
210
  /** MCP tool name for the `delegate_feedback` feedback-recording tool. @experimental */
251
211
  declare const DELEGATE_FEEDBACK_TOOL_NAME = "delegate_feedback";
@@ -487,5 +447,5 @@ declare function createDelegationStatusHandler(options: DelegationStatusHandlerO
487
447
  /** @deprecated Use `McpToolDescriptor`; both names are the same protocol contract. */
488
448
  type StdioToolDescriptor = McpToolDescriptor;
489
449
  //#endregion
490
- export { type AgentMemorySpec, type AnalystFindingEvent, type AnalystRegistry, type CappedDelegationTrace, type Check, type CheckRunnerOptions, type CoderDelegate, type CoderOutput, type CoderReview, type CoderReviewer, CodexExecutionDiagnosticError, type CodexExecutionEvidence, type CodexExecutionFailureDiagnostic, type CodexExecutionPolicy, type CodexTokenUsage, type CoordinationEvent, type CoordinationTools, type CoordinationToolsOptions, type CreateKbGateOptions, type CreateMemoryToolServerOptions, type CreateWorktreeOptions, DEFAULT_AWAIT_EVENT_TIMEOUT_MS, DELEGATE_DESCRIPTION, DELEGATE_FEEDBACK_DESCRIPTION, DELEGATE_FEEDBACK_INPUT_SCHEMA, DELEGATE_FEEDBACK_TOOL_NAME, DELEGATE_INPUT_SCHEMA, DELEGATE_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, DELEGATION_TRACE_MAX_BYTES, DELEGATION_TRACE_MAX_SPANS, type DelegateArgs, type DelegateCodeArgs, type DelegateCodeConfig, type DelegateCodeResult, type DelegateFeedbackArgs, type DelegateFeedbackHandlerOptions, type DelegateFeedbackResult, type DelegateHandlerOptions, type DelegateResearchArgs, type DelegateResearchConfig, type DelegateResearchResult, type DelegateResult, type DelegateRunCtx, type DelegateUiAuditArgs, type DelegateUiAuditConfig, type DelegateUiAuditHandlerOptions, type DelegateUiAuditResult, type DelegateUiAuditRoute, type DelegationArgs, type DelegationError, type DelegationExecutor, type DelegationFeedbackSnapshot, type DelegationHistoryArgs, type DelegationHistoryEntry, type DelegationHistoryHandlerOptions, type DelegationHistoryResult, DelegationPersistenceError, type DelegationProfile, type DelegationProgress, type DelegationRecord, type DelegationResultPayload, type DelegationResumeContext, type DelegationResumeDriver, type DelegationResumeTick, type DelegationRunContext, DelegationStateCorruptError, type DelegationStatus, type DelegationStatusArgs, type DelegationStatusHandlerOptions, type DelegationStatusResult, type DelegationStore, DelegationTaskQueue, type DelegationTaskQueueOptions, type DelegationTraceCaps, type DelegationTraceCollector, type DelegationTraceSpan, type DetachedSessionDelegateOptions, type DetachedSessionRefParts, type DetachedTurn, type DetachedTurnResumeDriverOptions, type DetachedWinnerSelection, type DetectExecutorArgs, type DiffOptions, type DiffResult, type DownMessageEvent, type DriveTurnCapableBox, type DriveTurnTick, type FactCandidate, type FactJudge, type FactJudgeVerdict, type FeedbackEvent, type FeedbackRating, type FeedbackRefersTo, type FeedbackStore, FileDelegationStore, type FileDelegationStoreOptions, type FleetHandle, type FleetWorkspaceExecutorOptions, type GitRunner, InMemoryDelegationStore, InMemoryFeedbackStore, type InProcessExecutorDescribePlacement, type InProcessExecutorOptions, type JsonRpcMessage, type JsonRpcResponse, type KbGateResult, type LocalHarness, type LocalHarnessResult, MEMORY_FILE_ENV, MEMORY_ITEMS_ENV, MEMORY_LOG_ENV, MEMORY_NAME_ENV, type MakeWorkerAgent, type McpServer, type McpServerOptions, type McpToolDescriptor, type McpTransport, type MemoryItem, type Question, type QuestionDecision, type QuestionLevel, type QuestionOption, type QuestionPolicy, type QuestionRecord, type QuestionUrgency, type RemoveWorktreeOptions, type ResearchOutputShape, type ResearchSource, type ResolvedMemoryEnv, type RunDetachedTurnOptions, type RunLocalHarnessOptions, type SettleDetachedCoderTurnOptions, type SettledWorker, type SiblingSandboxExecutorOptions, StdioToolDescriptor, type StdioToolServer, type StdioToolServerOptions, type SubmitInput, type SubmitOutput, type TraceContext, type UiAuditLensFilter, type UiAuditorDelegate, type UiAuditorDelegationOutput, type WorkerWatchOptions, type WorktreeHandle, buildDelegationTraceSpans, capDelegationTrace, captureWorktreeDiff, coderTaskFromArgs, composeLoopTraceEmitters, createCoordinationTools, createDelegateFeedbackHandler, createDelegateHandler, createDelegateUiAuditHandler, createDelegationHistoryHandler, createDelegationStatusHandler, createDelegationTraceCollector, createDetachedTurnResumeDriver, createFleetWorkspaceExecutor, createInProcessExecutor, createInProcessTransport, createKbGate, createMcpServer, createMemoryToolServer, createPropagatingTraceEmitter, createSiblingSandboxExecutor, createStdioToolServer, createWorktree, defaultChecks, detachedSessionDelegate, detachedTurnEvents, detectExecutor, eventToSnapshot, formatDetachedSessionRef, hashIdempotencyInput, liftFindings, makeCheckRunner, mcpToolsForRuntimeMcp, mcpToolsForRuntimeMcpSubset, parseCodexTokenUsage, parseDetachedSessionRef, parseMemoryItems, readMemoryItemsFile, readTraceContextFromEnv, removeWorktree, renderTrace, resolveMemoryFromEnv, runCheck, runDetachedTurn, runLocalHarness, settleDetachedCoderTurn, traceContextToEnv, validateDelegateArgs, validateDelegateFeedbackArgs, validateDelegateUiAuditArgs, validateDelegationHistoryArgs, validateDelegationStatusArgs };
450
+ export { type AgentMemorySpec, type AnalystFindingEvent, type AnalystRegistry, type AuthorizeDownMessage, type AuthorizedDownMessage, type CappedDelegationTrace, type CoderDelegate, type CoderOutput, type CoderReview, type CoderReviewer, CodexExecutionDiagnosticError, type CodexExecutionEvidence, type CodexExecutionFailureDiagnostic, type CodexExecutionPolicy, type CodexTokenUsage, type ContinuationInstruction, type CoordinationEvent, type CoordinationTools, type CoordinationToolsOptions, type CreateKbGateOptions, type CreateMemoryToolServerOptions, type CreateWorktreeOptions, DEFAULT_AWAIT_EVENT_TIMEOUT_MS, DELEGATE_DESCRIPTION, DELEGATE_FEEDBACK_DESCRIPTION, DELEGATE_FEEDBACK_INPUT_SCHEMA, DELEGATE_FEEDBACK_TOOL_NAME, DELEGATE_INPUT_SCHEMA, DELEGATE_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, DELEGATION_TRACE_MAX_BYTES, DELEGATION_TRACE_MAX_SPANS, type DelegateArgs, type DelegateCodeArgs, type DelegateCodeConfig, type DelegateCodeResult, type DelegateError, type DelegateFeedbackArgs, type DelegateFeedbackHandlerOptions, type DelegateFeedbackResult, type DelegateHandlerOptions, type DelegateResearchArgs, type DelegateResearchConfig, type DelegateResearchResult, type DelegateResult, type DelegateRunCtx, type DelegateUiAuditArgs, type DelegateUiAuditConfig, type DelegateUiAuditHandlerOptions, type DelegateUiAuditResult, type DelegateUiAuditRoute, type DelegationArgs, type DelegationError, type DelegationExecutor, type DelegationFeedbackSnapshot, type DelegationHistoryArgs, type DelegationHistoryEntry, type DelegationHistoryHandlerOptions, type DelegationHistoryResult, DelegationPersistenceError, type DelegationProfile, type DelegationProgress, type DelegationRecord, type DelegationResultPayload, type DelegationResumeContext, type DelegationResumeDriver, type DelegationResumeTick, type DelegationRunContext, DelegationStateCorruptError, type DelegationStatus, type DelegationStatusArgs, type DelegationStatusHandlerOptions, type DelegationStatusResult, type DelegationStore, DelegationTaskQueue, type DelegationTaskQueueOptions, type DelegationTraceCaps, type DelegationTraceCollector, type DelegationTraceSpan, type DetachedSessionDelegateOptions, type DetachedSessionRefParts, type DetachedTurn, type DetachedTurnResumeDriverOptions, type DetachedWinnerSelection, type DetectExecutorArgs, type DiffOptions, type DiffResult, type DownMessageAuthorizationInput, type DownMessageDeliveryAttempt, type DownMessageDeliveryOutcome, type DownMessageEvent, type DriveTurnCapableBox, type DriveTurnTick, type FactCandidate, type FactJudge, type FactJudgeVerdict, type FeedbackEvent, type FeedbackRating, type FeedbackRefersTo, type FeedbackStore, FileDelegationStore, type FileDelegationStoreOptions, type FleetHandle, type FleetWorkspaceExecutorOptions, type GitRunner, InMemoryDelegationStore, InMemoryFeedbackStore, type InProcessExecutorDescribePlacement, type InProcessExecutorOptions, type JsonRpcMessage, type JsonRpcResponse, type KbGateResult, type LocalHarness, type LocalHarnessResult, MEMORY_FILE_ENV, MEMORY_ITEMS_ENV, MEMORY_LOG_ENV, MEMORY_NAME_ENV, type MakeWorkerAgent, type McpServer, type McpServerOptions, type McpToolDescriptor, type McpTransport, type MemoryItem, type Question, type QuestionDecision, type QuestionLevel, type QuestionOption, type QuestionPolicy, type QuestionRecord, type QuestionUrgency, type RemoveWorktreeOptions, type ResearchOutputShape, type ResearchSource, type ResolvedMemoryEnv, type RunDetachedTurnOptions, type RunLocalHarnessOptions, type SettleDetachedCoderTurnOptions, type SettledWorker, type SiblingSandboxExecutorOptions, StdioToolDescriptor, type StdioToolServer, type StdioToolServerOptions, type SubmitInput, type SubmitOutput, type TraceContext, type UiAuditLensFilter, type UiAuditorDelegate, type UiAuditorDelegationOutput, type WorkerSpawnContext, type WorkerWatchOptions, type WorktreeHandle, buildDelegationTraceSpans, capDelegationTrace, captureWorktreeDiff, coderTaskFromArgs, composeLoopTraceEmitters, createCoordinationTools, createDelegateFeedbackHandler, createDelegateHandler, createDelegateUiAuditHandler, createDelegationHistoryHandler, createDelegationStatusHandler, createDelegationTraceCollector, createDetachedTurnResumeDriver, createFleetWorkspaceExecutor, createInProcessExecutor, createInProcessTransport, createKbGate, createMcpServer, createMemoryToolServer, createPropagatingTraceEmitter, createSiblingSandboxExecutor, createStdioToolServer, createWorktree, detachedSessionDelegate, detachedTurnEvents, detectExecutor, eventToSnapshot, formatDetachedSessionRef, hashIdempotencyInput, mcpToolsForRuntimeMcp, mcpToolsForRuntimeMcpSubset, parseCodexTokenUsage, parseDetachedSessionRef, parseMemoryItems, readMemoryItemsFile, readTraceContextFromEnv, removeWorktree, resolveMemoryFromEnv, runDetachedTurn, runLocalHarness, settleDetachedCoderTurn, traceContextToEnv, validateDelegateArgs, validateDelegateFeedbackArgs, validateDelegateUiAuditArgs, validateDelegationHistoryArgs, validateDelegationStatusArgs };
491
451
  //# sourceMappingURL=index.d.ts.map
package/dist/mcp/index.js CHANGED
@@ -1,14 +1,13 @@
1
1
  import { u as ValidationError } from "../errors-DEAvWQPy.js";
2
2
  import { c as sleep, d as throwIfAborted, r as deleteBoxSafe, u as throwAbort } from "../util-Cc9g9Y-o.js";
3
- import { $ as removeWorktree, Q as createWorktree, X as runWorktreeHarness, Z as captureWorktreeDiff, _ as traceContextToEnv, g as readTraceContextFromEnv, h as createPropagatingTraceEmitter, nt as runLocalHarness, rt as CodexExecutionDiagnosticError, tt as parseCodexTokenUsage } from "../supervisor-BBbPBXpe.js";
4
- import { A as runCoderChecks, lt as assertTraceDerivedFindings, ot as selectValidWinner } from "../runtime-Ut1pkd2n.js";
5
- import { $ as InMemoryDelegationStore, A as DELEGATE_INPUT_SCHEMA, C as validateDelegateUiAuditArgs, D as createDelegateFeedbackHandler, E as DELEGATE_FEEDBACK_TOOL_NAME, G as DELEGATION_TRACE_MAX_SPANS, H as DelegationTaskQueue, J as composeLoopTraceEmitters, Jt as runAgentRounds, K as buildDelegationTraceSpans, Kt as createSandboxForSpec, M as createDelegateHandler, N as validateDelegateArgs, O as validateDelegateFeedbackArgs, Q as FileDelegationStore, S as createDelegateUiAuditHandler, T as DELEGATE_FEEDBACK_INPUT_SCHEMA, U as hashIdempotencyInput, W as DELEGATION_TRACE_MAX_BYTES, X as DelegationPersistenceError, Y as createDelegationTraceCollector, Z as DelegationStateCorruptError, _ as createDelegationHistoryHandler, _t as createCoordinationTools, b as DELEGATE_UI_AUDIT_INPUT_SCHEMA, c as createMcpServer, d as DELEGATION_STATUS_TOOL_NAME, et as InMemoryFeedbackStore, f as createDelegationStatusHandler, g as DELEGATION_HISTORY_TOOL_NAME, gt as DEFAULT_AWAIT_EVENT_TIMEOUT_MS, h as DELEGATION_HISTORY_INPUT_SCHEMA, j as DELEGATE_TOOL_NAME, k as DELEGATE_DESCRIPTION, l as DELEGATION_STATUS_DESCRIPTION, m as DELEGATION_HISTORY_DESCRIPTION, p as validateDelegationStatusArgs, q as capDelegationTrace, s as createInProcessTransport, tt as eventToSnapshot, u as DELEGATION_STATUS_INPUT_SCHEMA, v as validateDelegationHistoryArgs, w as DELEGATE_FEEDBACK_DESCRIPTION, x as DELEGATE_UI_AUDIT_TOOL_NAME, y as DELEGATE_UI_AUDIT_DESCRIPTION } from "../supervise-BUR9ByF7.js";
3
+ import { It as parseCodexTokenUsage, Lt as runLocalHarness, Rt as CodexExecutionDiagnosticError, b as traceContextToEnv, bt as removeWorktree, gt as runWorktreeHarness, v as createPropagatingTraceEmitter, vt as captureWorktreeDiff, y as readTraceContextFromEnv, yt as createWorktree } from "../supervisor-CAXiCKnX.js";
4
+ import { A as runCoderChecks, ot as selectValidWinner } from "../runtime-Ce39zfqn.js";
5
+ import { A as DELEGATE_DESCRIPTION, B as DELEGATION_TRACE_MAX_SPANS, C as createDelegateUiAuditHandler, D as DELEGATE_FEEDBACK_TOOL_NAME, E as DELEGATE_FEEDBACK_INPUT_SCHEMA, G as DelegationPersistenceError, H as capDelegationTrace, J as InMemoryDelegationStore, K as DelegationStateCorruptError, L as DelegationTaskQueue, Lt as createSandboxForSpec, M as DELEGATE_TOOL_NAME, N as createDelegateHandler, O as createDelegateFeedbackHandler, P as validateDelegateArgs, R as hashIdempotencyInput, S as DELEGATE_UI_AUDIT_TOOL_NAME, T as DELEGATE_FEEDBACK_DESCRIPTION, U as composeLoopTraceEmitters, V as buildDelegationTraceSpans, W as createDelegationTraceCollector, X as eventToSnapshot, Y as InMemoryFeedbackStore, _ as DELEGATION_HISTORY_TOOL_NAME, b as DELEGATE_UI_AUDIT_DESCRIPTION, c as createInProcessTransport, d as DELEGATION_STATUS_INPUT_SCHEMA, dt as DEFAULT_AWAIT_EVENT_TIMEOUT_MS, f as DELEGATION_STATUS_TOOL_NAME, ft as createCoordinationTools, g as DELEGATION_HISTORY_INPUT_SCHEMA, h as DELEGATION_HISTORY_DESCRIPTION, j as DELEGATE_INPUT_SCHEMA, k as validateDelegateFeedbackArgs, l as createMcpServer, m as validateDelegationStatusArgs, p as createDelegationStatusHandler, q as FileDelegationStore, u as DELEGATION_STATUS_DESCRIPTION, v as createDelegationHistoryHandler, w as validateDelegateUiAuditArgs, x as DELEGATE_UI_AUDIT_INPUT_SCHEMA, y as validateDelegationHistoryArgs, z as DELEGATION_TRACE_MAX_BYTES, zt as runAgentRounds } from "../supervise-U7_K5yuV.js";
6
6
  import { t as createStdioToolServer } from "../tool-server-RcWgLIsL.js";
7
7
  import { t as createKbGate } from "../kb-gate-DpaSwXVx.js";
8
- import { n as mcpToolsForRuntimeMcpSubset, t as mcpToolsForRuntimeMcp } from "../openai-tools-_Wyp4udO.js";
8
+ import { n as mcpToolsForRuntimeMcpSubset, t as mcpToolsForRuntimeMcp } from "../openai-tools-CO9X36zy.js";
9
9
  import { t as coderTaskToPrompt } from "../coder-yhVWbdWc.js";
10
10
  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-DL6cE2Ag.js";
11
- import { makeFinding } from "@tangle-network/agent-eval";
12
11
  import { randomUUID } from "node:crypto";
13
12
  //#region src/mcp/executor.ts
14
13
  /**
@@ -1142,204 +1141,6 @@ const singleShotDriver = {
1142
1141
  }
1143
1142
  };
1144
1143
  //#endregion
1145
- //#region src/mcp/tools/checks.ts
1146
- /**
1147
- *
1148
- * The trace-analyst KIND directory — the operator's lenses, as composable DATA.
1149
- *
1150
- * An analyst is not one question. A kind is ONE lens (completeness, correctness, policy, efficiency,
1151
- * tool-use, …); each emits `AnalystFinding`s tagged by its `area`. The driver `list_analysts` to see
1152
- * the menu, `run_analyst(kind, worker)` to apply a lens, and `define_analyst` to author a new one —
1153
- * so at test time you compose the exact lenses a domain needs (maximum specificity), not one generic
1154
- * reviewer. The kinds are data, the runner is generic, and the finding shape + firewall are reused
1155
- * from agent-eval / the keystone — never re-derived.
1156
- *
1157
- * A kind here is a lightweight lens (`Check`); it is a deliberate SUBSET of agent-eval's full
1158
- * `TraceAnalystKindSpec`, so a kind that needs the heavy agentic actor (sub-agent recursion, tools,
1159
- * goldens) upgrades to `createTraceAnalystKind` without changing this directory's surface.
1160
- *
1161
- * @experimental
1162
- */
1163
- const ANALYST_SEVERITIES = [
1164
- "critical",
1165
- "high",
1166
- "medium",
1167
- "low",
1168
- "info"
1169
- ];
1170
- const FINDING_SCHEMA_PROMPT = [
1171
- "Each finding is a JSON object with these fields:",
1172
- "- severity: one of \"critical\" | \"high\" | \"medium\" | \"low\" | \"info\"",
1173
- "- claim: one-sentence statement",
1174
- "- evidence_uri: REQUIRED, never blank — exactly one of \"span://<trace>/<span>\", \"artifact://<path>\",",
1175
- " or \"metric://<name>\"; ALWAYS cite a real id from the trace. No citable id ⇒ omit the finding.",
1176
- "- evidence_excerpt?: a short quote from the cited evidence",
1177
- "- confidence: number 0..1",
1178
- "- rationale?: one sentence of reasoning",
1179
- "- recommended_action?: a concrete imperative (\"Add ...\", \"Replace ...\", \"Stop ...\")",
1180
- "Emit an empty array when there is nothing to report. Never fabricate evidence."
1181
- ].join("\n");
1182
- /** Validate one raw finding row (the lightweight equivalent of agent-eval's `parseRawFinding`):
1183
- * require a claim + a real trace evidence_uri; drop anything else. Returns null to discard. */
1184
- function validateRawFinding(row) {
1185
- if (!row || typeof row !== "object") return null;
1186
- const r = row;
1187
- if (typeof r.claim !== "string" || r.claim.length === 0) return null;
1188
- if (typeof r.evidence_uri !== "string" || !/^(span|artifact|metric):\/\//.test(r.evidence_uri)) return null;
1189
- return {
1190
- severity: ANALYST_SEVERITIES.includes(r.severity) ? r.severity : "medium",
1191
- claim: r.claim,
1192
- evidence_uri: r.evidence_uri,
1193
- confidence: typeof r.confidence === "number" ? r.confidence : .5,
1194
- ...typeof r.evidence_excerpt === "string" ? { evidence_excerpt: r.evidence_excerpt } : {},
1195
- ...typeof r.rationale === "string" ? { rationale: r.rationale } : {},
1196
- ...typeof r.recommended_action === "string" ? { recommended_action: r.recommended_action } : {},
1197
- ...typeof r.subject === "string" ? { subject: r.subject } : {}
1198
- };
1199
- }
1200
- /** The built-in lens directory. Domain-blind (about any agent trace); compose at test time. */
1201
- const defaultChecks = {
1202
- completeness: {
1203
- id: "completeness",
1204
- description: "Required work the trace does not yet show done or verified.",
1205
- area: "failure-mode",
1206
- version: "1",
1207
- lookFor: "every change the task requires that the trace does NOT yet show completed AND verified by a tool result. One finding per missing/unverified requirement."
1208
- },
1209
- correctness: {
1210
- id: "correctness",
1211
- description: "Tool calls that produced wrong, erroring, or contradicted results.",
1212
- area: "correctness",
1213
- version: "1",
1214
- lookFor: "tool calls whose RESULT shows an error, a wrong value, or contradicts what the task required (e.g. set the wrong field, value did not take, an error was ignored)."
1215
- },
1216
- policy: {
1217
- id: "policy",
1218
- description: "Actions that violate a stated policy, constraint, or allow-list.",
1219
- area: "safety",
1220
- version: "1",
1221
- lookFor: "actions in the trace that violate a policy/constraint stated in the task or system prompt (forbidden tool, missing approval, out-of-scope mutation, skipped precondition)."
1222
- },
1223
- efficiency: {
1224
- id: "efficiency",
1225
- description: "Wasted, redundant, or looping work.",
1226
- area: "cost",
1227
- version: "1",
1228
- lookFor: "redundant or wasted actions — repeated identical calls, a stalled line retried the same way, work that produced no progress toward the goal."
1229
- },
1230
- "tool-use": {
1231
- id: "tool-use",
1232
- description: "Malformed or misused tool calls.",
1233
- area: "tool-use",
1234
- version: "1",
1235
- lookFor: "tool calls with malformed/invalid arguments, the wrong tool for the intent, or a tool used against its contract — judged from the call + its result."
1236
- }
1237
- };
1238
- /** Lift validated raw rows into `AnalystFinding`s (agent-eval `makeFinding` stamps `finding_id`/
1239
- * `produced_at`), then enforce the trace-derived firewall (selector ≠ judge). Pure — no LLM. */
1240
- function liftFindings(kind, rows, producedAt) {
1241
- const findings = [];
1242
- for (const row of rows) {
1243
- const raw = validateRawFinding(row);
1244
- if (!raw) continue;
1245
- findings.push(makeFinding({
1246
- analyst_id: kind.id,
1247
- area: kind.area,
1248
- severity: raw.severity,
1249
- claim: raw.claim,
1250
- confidence: raw.confidence,
1251
- produced_at: producedAt,
1252
- evidence_refs: evidenceRefs(raw.evidence_uri, raw.evidence_excerpt),
1253
- ...raw.rationale ? { rationale: raw.rationale } : {},
1254
- ...raw.recommended_action ? { recommended_action: raw.recommended_action } : {},
1255
- ...raw.subject ? { subject: raw.subject } : {},
1256
- metadata: { kind_version: kind.version }
1257
- }));
1258
- }
1259
- assertTraceDerivedFindings(findings);
1260
- return findings;
1261
- }
1262
- /** Map a raw `evidence_uri` (span:// | artifact:// | metric://<name>) to a typed `EvidenceRef`. A
1263
- * metric ref carries the bare NAME (the firewall checks the metric name for judge/verdict/score —
1264
- * so a finding that cites a judge metric is rejected as not trace-derived). */
1265
- function evidenceRefs(uri, excerpt) {
1266
- const scheme = uri.split("://", 1)[0];
1267
- if (scheme === "metric") return [{
1268
- kind: "metric",
1269
- uri: uri.replace(/^metric:\/\//, ""),
1270
- ...excerpt ? { excerpt } : {}
1271
- }];
1272
- return [{
1273
- kind: scheme === "span" ? "span" : "artifact",
1274
- uri,
1275
- ...excerpt ? { excerpt } : {}
1276
- }];
1277
- }
1278
- /** Render a worker's trace (tool calls + results) into the text an analyst lens reads. Generic over
1279
- * the trace shape: a `{ messages }` conversation, a bare message array, else stringified. */
1280
- function renderTrace(trace) {
1281
- const messages = Array.isArray(trace) ? trace : trace && typeof trace === "object" && Array.isArray(trace.messages) ? trace.messages : void 0;
1282
- if (!messages) return JSON.stringify(trace ?? {}).slice(0, 8e3);
1283
- return messages.map((m) => {
1284
- const r = m;
1285
- if (r.role === "tool") return `RESULT ${String(r.content).slice(0, 300)}`;
1286
- const calls = r.tool_calls?.map((c) => `${c.function?.name}(${c.function?.arguments})`).join(", ");
1287
- return calls ? `CALL ${calls}` : `SAY ${String(r.content ?? "").slice(0, 200)}`;
1288
- }).join("\n").slice(0, 8e3);
1289
- }
1290
- /** Run ONE lens over a trace → findings. Generic over any kind: prompt = the lens + the agent-eval
1291
- * finding schema; the model's JSON array is parsed (`parseRawFinding`), lifted, and firewalled. */
1292
- async function runCheck(kind, trace, opts, producedAt) {
1293
- const sys = `You are a trace analyst applying ONE lens: look for ${kind.lookFor}\n\n${FINDING_SCHEMA_PROMPT}\n\nReturn ONLY a fenced \`\`\`json array of finding objects (possibly empty).`;
1294
- const user = `WORKER TRACE:\n${renderTrace(trace)}\n\nApply your lens and emit the findings array.`;
1295
- const content = await (opts.chat ?? defaultChat(opts))(sys, user);
1296
- const match = content.match(/```(?:json)?\s*([\s\S]*?)```/);
1297
- let rows = [];
1298
- try {
1299
- const parsed = JSON.parse((match?.[1] ?? content).trim());
1300
- rows = Array.isArray(parsed) ? parsed : Array.isArray(parsed?.findings) ? parsed.findings : [];
1301
- } catch {
1302
- rows = [];
1303
- }
1304
- return liftFindings(kind, rows, producedAt);
1305
- }
1306
- function defaultChat(opts) {
1307
- return async (system, user) => {
1308
- const res = await fetch(`${opts.routerBaseUrl.replace(/\/$/, "")}/chat/completions`, {
1309
- method: "POST",
1310
- headers: {
1311
- "content-type": "application/json",
1312
- authorization: `Bearer ${opts.routerKey}`
1313
- },
1314
- body: JSON.stringify({
1315
- model: opts.model,
1316
- messages: [{
1317
- role: "system",
1318
- content: system
1319
- }, {
1320
- role: "user",
1321
- content: user
1322
- }],
1323
- temperature: .3
1324
- })
1325
- });
1326
- if (!res.ok) throw new Error(`analyst router ${res.status}`);
1327
- return (await res.json()).choices?.[0]?.message?.content ?? "";
1328
- };
1329
- }
1330
- /**
1331
- * Build a `run_analyst` runner over a kind directory.
1332
- * Returns findings, or a typed error for an unknown kind. `producedAt` is
1333
- * passed in because replay-safe paths must not read `Date.now`.
1334
- */
1335
- function makeCheckRunner(kinds, opts) {
1336
- return async (kindId, trace, producedAt) => {
1337
- const kind = kinds[kindId];
1338
- if (!kind) return { error: `unknown analyst kind ${JSON.stringify(kindId)} (have: ${Object.keys(kinds).join(", ")})` };
1339
- return runCheck(kind, trace, opts, producedAt);
1340
- };
1341
- }
1342
- //#endregion
1343
- export { CodexExecutionDiagnosticError, DEFAULT_AWAIT_EVENT_TIMEOUT_MS, DELEGATE_DESCRIPTION, DELEGATE_FEEDBACK_DESCRIPTION, DELEGATE_FEEDBACK_INPUT_SCHEMA, DELEGATE_FEEDBACK_TOOL_NAME, DELEGATE_INPUT_SCHEMA, DELEGATE_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, DELEGATION_TRACE_MAX_BYTES, DELEGATION_TRACE_MAX_SPANS, DelegationPersistenceError, DelegationStateCorruptError, DelegationTaskQueue, FileDelegationStore, InMemoryDelegationStore, InMemoryFeedbackStore, MEMORY_FILE_ENV, MEMORY_ITEMS_ENV, MEMORY_LOG_ENV, MEMORY_NAME_ENV, buildDelegationTraceSpans, capDelegationTrace, captureWorktreeDiff, coderTaskFromArgs, composeLoopTraceEmitters, createCoordinationTools, createDelegateFeedbackHandler, createDelegateHandler, createDelegateUiAuditHandler, createDelegationHistoryHandler, createDelegationStatusHandler, createDelegationTraceCollector, createDetachedTurnResumeDriver, createFleetWorkspaceExecutor, createInProcessExecutor, createInProcessTransport, createKbGate, createMcpServer, createMemoryToolServer, createPropagatingTraceEmitter, createSiblingSandboxExecutor, createStdioToolServer, createWorktree, defaultChecks, detachedSessionDelegate, detachedTurnEvents, detectExecutor, eventToSnapshot, formatDetachedSessionRef, hashIdempotencyInput, liftFindings, makeCheckRunner, mcpToolsForRuntimeMcp, mcpToolsForRuntimeMcpSubset, parseCodexTokenUsage, parseDetachedSessionRef, parseMemoryItems, readMemoryItemsFile, readTraceContextFromEnv, removeWorktree, renderTrace, resolveMemoryFromEnv, runCheck, runDetachedTurn, runLocalHarness, settleDetachedCoderTurn, traceContextToEnv, validateDelegateArgs, validateDelegateFeedbackArgs, validateDelegateUiAuditArgs, validateDelegationHistoryArgs, validateDelegationStatusArgs };
1144
+ export { CodexExecutionDiagnosticError, DEFAULT_AWAIT_EVENT_TIMEOUT_MS, DELEGATE_DESCRIPTION, DELEGATE_FEEDBACK_DESCRIPTION, DELEGATE_FEEDBACK_INPUT_SCHEMA, DELEGATE_FEEDBACK_TOOL_NAME, DELEGATE_INPUT_SCHEMA, DELEGATE_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, DELEGATION_TRACE_MAX_BYTES, DELEGATION_TRACE_MAX_SPANS, DelegationPersistenceError, DelegationStateCorruptError, DelegationTaskQueue, FileDelegationStore, InMemoryDelegationStore, InMemoryFeedbackStore, MEMORY_FILE_ENV, MEMORY_ITEMS_ENV, MEMORY_LOG_ENV, MEMORY_NAME_ENV, buildDelegationTraceSpans, capDelegationTrace, captureWorktreeDiff, coderTaskFromArgs, composeLoopTraceEmitters, createCoordinationTools, createDelegateFeedbackHandler, createDelegateHandler, createDelegateUiAuditHandler, createDelegationHistoryHandler, createDelegationStatusHandler, createDelegationTraceCollector, createDetachedTurnResumeDriver, createFleetWorkspaceExecutor, createInProcessExecutor, createInProcessTransport, createKbGate, createMcpServer, createMemoryToolServer, createPropagatingTraceEmitter, createSiblingSandboxExecutor, createStdioToolServer, createWorktree, detachedSessionDelegate, detachedTurnEvents, detectExecutor, eventToSnapshot, formatDetachedSessionRef, hashIdempotencyInput, mcpToolsForRuntimeMcp, mcpToolsForRuntimeMcpSubset, parseCodexTokenUsage, parseDetachedSessionRef, parseMemoryItems, readMemoryItemsFile, readTraceContextFromEnv, removeWorktree, resolveMemoryFromEnv, runDetachedTurn, runLocalHarness, settleDetachedCoderTurn, traceContextToEnv, validateDelegateArgs, validateDelegateFeedbackArgs, validateDelegateUiAuditArgs, validateDelegationHistoryArgs, validateDelegationStatusArgs };
1344
1145
 
1345
1146
  //# sourceMappingURL=index.js.map