@tangle-network/agent-runtime 0.61.0 → 0.62.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.
- package/dist/agent.d.ts +2 -1
- package/dist/agent.js +2 -2
- package/dist/agent.js.map +1 -1
- package/dist/{chunk-7IXF3VUJ.js → chunk-DVQGYDN5.js} +1 -1
- package/dist/chunk-DVQGYDN5.js.map +1 -0
- package/dist/{chunk-AU5MCNHO.js → chunk-E4X4FNQZ.js} +2 -2
- package/dist/{chunk-VCOT7XEQ.js → chunk-MT4XM3G6.js} +2 -2
- package/dist/chunk-MT4XM3G6.js.map +1 -0
- package/dist/{chunk-GLMFBUKT.js → chunk-O2UPHN7X.js} +1 -1
- package/dist/chunk-O2UPHN7X.js.map +1 -0
- package/dist/{chunk-Q5R33I7Y.js → chunk-RTNMMHWR.js} +3 -3
- package/dist/{chunk-IBRJTG7O.js → chunk-RYD7ND4A.js} +3 -3
- package/dist/chunk-RYD7ND4A.js.map +1 -0
- package/dist/{chunk-5V343QPB.js → chunk-YWO4H64E.js} +3 -3
- package/dist/{coder-DD5J5Onk.d.ts → coder-2leJPOvC.d.ts} +1 -1
- package/dist/{coordination-k29badiX.d.ts → coordination-Curpzeyc.d.ts} +1 -1
- package/dist/{delegates-CWMv_rKL.d.ts → delegates-CLFNAKyi.d.ts} +3 -2
- package/dist/improvement.js +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.js +6 -6
- package/dist/intelligence.d.ts +2 -1
- package/dist/intelligence.js.map +1 -1
- package/dist/{loop-runner-bin-Bqt0hiNY.d.ts → loop-runner-bin-B6dzNZC8.d.ts} +2 -2
- package/dist/loop-runner-bin.d.ts +5 -4
- package/dist/loop-runner-bin.js +5 -5
- package/dist/loops.d.ts +5 -4
- package/dist/loops.js +2 -2
- package/dist/mcp/bin.js +5 -5
- package/dist/mcp/index.d.ts +6 -5
- package/dist/mcp/index.js +6 -6
- package/dist/profiles.d.ts +3 -2
- package/dist/profiles.js +1 -1
- package/dist/profiles.js.map +1 -1
- package/dist/runtime.d.ts +9 -8
- package/dist/runtime.js +2 -2
- package/dist/workflow.js +2 -2
- package/dist/{worktree-fanout-CBULEoVe.d.ts → worktree-fanout-DUiKPApb.d.ts} +3 -2
- package/package.json +6 -2
- package/dist/chunk-7IXF3VUJ.js.map +0 -1
- package/dist/chunk-GLMFBUKT.js.map +0 -1
- package/dist/chunk-IBRJTG7O.js.map +0 -1
- package/dist/chunk-VCOT7XEQ.js.map +0 -1
- /package/dist/{chunk-AU5MCNHO.js.map → chunk-E4X4FNQZ.js.map} +0 -0
- /package/dist/{chunk-Q5R33I7Y.js.map → chunk-RTNMMHWR.js.map} +0 -0
- /package/dist/{chunk-5V343QPB.js.map → chunk-YWO4H64E.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/mcp/local-harness.ts"],"sourcesContent":["/**\n * @experimental\n *\n * Subprocess wrappers for the local coding-harness CLIs installed in the\n * sandbox image (claude-code, codex, opencode). Used by the in-process\n * delegation executor (`createInProcessExecutor`) so a `delegate_code` call\n * spawns a real harness on a real git worktree instead of provisioning a\n * sibling sandbox.\n *\n * All harness invocations:\n * - run with `cwd` set to the worktree\n * - inherit env from the parent (the MCP server inside the sandbox has\n * the harness's auth already)\n * - capture stdout/stderr\n * - support cancellation via AbortSignal\n * - enforce a wall-clock timeout\n */\n\nimport { type ChildProcess, spawn } from 'node:child_process'\nimport type { AgentProfile } from '@tangle-network/agent-interface'\n\n/** Local coding harness available inside the sandbox. */\nexport type LocalHarness = 'claude' | 'codex' | 'opencode'\n\n/**\n * Default per-harness command + arg shape. `buildArgs` takes ONLY the task prompt and\n * emits the prompt-only invocation (no model, no system prompt) — the historical shape\n * the in-process executor's `streamPrompt` drives. `modelArgs` maps a resolved model to\n * the harness's selector flag (every supported harness takes `-m <model>`). The §1.5\n * profile-aware mapper `harnessInvocation` composes these to thread the full\n * supervisor-authored profile (systemPrompt + model) into argv.\n */\nconst HARNESS_INVOCATIONS: Record<\n LocalHarness,\n {\n command: string\n buildArgs: (taskPrompt: string) => string[]\n /** Map a resolved model to the harness's model-selector flag. */\n modelArgs: (model: string) => string[]\n }\n> = {\n claude: {\n command: 'claude',\n buildArgs: (taskPrompt) => ['--headless', '-p', taskPrompt],\n modelArgs: (model) => ['-m', model],\n },\n codex: {\n command: 'codex',\n buildArgs: (taskPrompt) => ['run', taskPrompt],\n modelArgs: (model) => ['-m', model],\n },\n opencode: {\n command: 'opencode',\n buildArgs: (taskPrompt) => ['run', taskPrompt],\n modelArgs: (model) => ['-m', model],\n },\n}\n\n/** Result of mapping an `AgentProfile` + task prompt onto a harness invocation. */\nexport interface HarnessInvocation {\n command: string\n args: string[]\n}\n\n/**\n * Map a supervisor-authored `AgentProfile` + the per-task prompt onto a concrete harness\n * `command` + `args` (the §1.5 fix). UNLIKE the prompt-only `HARNESS_INVOCATIONS.buildArgs`\n * — which drops both the authored model and the system prompt — this threads the FULL\n * profile payload into argv:\n *\n * - `profile.prompt.systemPrompt` → the PROMPT channel: a portable, harness-agnostic\n * default that prepends the system prompt above the task prompt (`<system>\\n\\n<task>`),\n * so the authored standing instructions reach EVERY harness (none of the three CLIs\n * expose a portable replace-system-prompt flag for a one-shot non-interactive run).\n * - `profile.model.default` → the harness's `-m <model>` selector.\n *\n * The task prompt alone is the floor; an empty/absent profile yields exactly the legacy\n * `buildArgs(taskPrompt)` shape so existing callers are byte-identical.\n */\nexport function harnessInvocation(\n harness: LocalHarness,\n profile: AgentProfile,\n taskPrompt: string,\n): HarnessInvocation {\n const invocation = HARNESS_INVOCATIONS[harness]\n if (!invocation) {\n throw new Error(`harnessInvocation: unknown harness ${String(harness)}`)\n }\n\n const systemPrompt = profile.prompt?.systemPrompt\n const composedPrompt =\n typeof systemPrompt === 'string' && systemPrompt.trim().length > 0\n ? `${systemPrompt}\\n\\n${taskPrompt}`\n : taskPrompt\n\n const args = invocation.buildArgs(composedPrompt)\n\n const model = profile.model?.default\n if (typeof model === 'string' && model.length > 0) {\n args.push(...invocation.modelArgs(model))\n }\n\n return { command: invocation.command, args }\n}\n\n/** @experimental */\nexport interface RunLocalHarnessOptions {\n harness: LocalHarness\n /** Working directory for the subprocess (typically a worktree path). */\n cwd: string\n /** Prompt forwarded as the harness CLI's task argument. */\n taskPrompt: string\n /**\n * Pre-built command + args (e.g. from `harnessInvocation` so the full authored\n * `AgentProfile` — systemPrompt + model — reaches the harness). When set it OVERRIDES the\n * default prompt-only `buildArgs(taskPrompt)` path; `command` defaults to the harness's\n * default binary when only `args` is supplied. When absent the legacy prompt-only shape\n * is used unchanged.\n */\n invocation?: { command?: string; args: ReadonlyArray<string> }\n /** Wall-clock kill deadline (ms). Default 5 min. Subprocess SIGTERMed on expiry. */\n timeoutMs?: number\n /** Caller cancellation. SIGTERM is sent on abort. */\n signal?: AbortSignal\n /** Override env (defaults to inheriting from the parent). */\n env?: NodeJS.ProcessEnv\n /**\n * Test seam — inject a custom spawner so unit tests can mock the\n * subprocess without touching the OS. Defaults to node's `child_process.spawn`.\n */\n spawn?: (\n command: string,\n args: ReadonlyArray<string>,\n opts: {\n cwd: string\n env: NodeJS.ProcessEnv\n stdio: 'pipe'\n },\n ) => ChildProcess\n}\n\n/** @experimental */\nexport interface LocalHarnessResult {\n /** OS exit code. `null` when killed before exit. */\n exitCode: number | null\n /** Concatenated stdout. */\n stdout: string\n /** Concatenated stderr. */\n stderr: string\n /** Set when the process exited via signal (timeout / abort). */\n killedBySignal: NodeJS.Signals | null\n /** Wall-clock duration ms (spawn → exit). */\n durationMs: number\n /** Set when timeoutMs elapsed before exit. */\n timedOut: boolean\n}\n\nconst DEFAULT_TIMEOUT_MS = 5 * 60 * 1000\n\n/**\n * Spawn a local coding harness CLI as a subprocess + collect its output.\n *\n * NOT responsible for parsing the harness's output or extracting a diff —\n * the in-process executor's `streamPrompt` orchestrates `git diff` against\n * the worktree after this resolves. This function is intentionally narrow:\n * spawn, wait, capture, return.\n *\n * Fails loud — throws when:\n * - `cwd` doesn't exist (subprocess emits ENOENT; surfaced as Error)\n * - the harness binary is not on PATH (ENOENT)\n *\n * Does NOT throw when:\n * - the subprocess exits non-zero (`result.exitCode` carries the code)\n * - the subprocess is aborted / timed out (`result.killedBySignal` /\n * `result.timedOut` carries the reason)\n *\n * @experimental\n */\nexport function runLocalHarness(options: RunLocalHarnessOptions): Promise<LocalHarnessResult> {\n const { harness, cwd, taskPrompt } = options\n const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS\n const env = options.env ?? process.env\n const spawnImpl = options.spawn ?? spawn\n\n const invocation = HARNESS_INVOCATIONS[harness]\n if (!invocation) {\n return Promise.reject(new Error(`runLocalHarness: unknown harness ${String(harness)}`))\n }\n\n const startedAt = Date.now()\n const command = options.invocation?.command ?? invocation.command\n const args = options.invocation ? [...options.invocation.args] : invocation.buildArgs(taskPrompt)\n\n return new Promise<LocalHarnessResult>((resolve, reject) => {\n let child: ChildProcess\n try {\n child = spawnImpl(command, args, { cwd, env, stdio: 'pipe' })\n } catch (err) {\n reject(err instanceof Error ? err : new Error(String(err)))\n return\n }\n\n // The harness takes its task as an argv arg, not on stdin. Leaving stdin\n // OPEN makes a non-TTY `opencode run` (and likely the other harnesses)\n // BLOCK forever waiting on input — zero output, SIGTERM at the wall cap,\n // empty patch -> \"no candidate passed validation\". Close stdin so the\n // subprocess sees EOF and proceeds (the `cliExecutor` leaf does the same).\n child.stdin?.end()\n\n let stdout = ''\n let stderr = ''\n let timedOut = false\n let settled = false\n\n const timer =\n timeoutMs > 0\n ? setTimeout(() => {\n timedOut = true\n if (!child.killed) child.kill('SIGTERM')\n }, timeoutMs)\n : null\n if (timer && typeof (timer as { unref?: () => void }).unref === 'function') {\n ;(timer as { unref: () => void }).unref()\n }\n\n const onAbort = () => {\n if (!child.killed) child.kill('SIGTERM')\n }\n if (options.signal) {\n if (options.signal.aborted) onAbort()\n else options.signal.addEventListener('abort', onAbort, { once: true })\n }\n\n child.stdout?.on('data', (chunk) => {\n stdout += String(chunk)\n })\n child.stderr?.on('data', (chunk) => {\n stderr += String(chunk)\n })\n\n const finalize = (result: LocalHarnessResult) => {\n if (settled) return\n settled = true\n if (timer) clearTimeout(timer)\n options.signal?.removeEventListener('abort', onAbort)\n resolve(result)\n }\n\n child.on('error', (err) => {\n if (settled) return\n settled = true\n if (timer) clearTimeout(timer)\n options.signal?.removeEventListener('abort', onAbort)\n reject(err)\n })\n\n child.on('close', (code, signal) => {\n finalize({\n exitCode: code,\n stdout,\n stderr,\n killedBySignal: signal,\n durationMs: Date.now() - startedAt,\n timedOut,\n })\n })\n })\n}\n"],"mappings":";AAkBA,SAA4B,aAAa;AAczC,IAAM,sBAQF;AAAA,EACF,QAAQ;AAAA,IACN,SAAS;AAAA,IACT,WAAW,CAAC,eAAe,CAAC,cAAc,MAAM,UAAU;AAAA,IAC1D,WAAW,CAAC,UAAU,CAAC,MAAM,KAAK;AAAA,EACpC;AAAA,EACA,OAAO;AAAA,IACL,SAAS;AAAA,IACT,WAAW,CAAC,eAAe,CAAC,OAAO,UAAU;AAAA,IAC7C,WAAW,CAAC,UAAU,CAAC,MAAM,KAAK;AAAA,EACpC;AAAA,EACA,UAAU;AAAA,IACR,SAAS;AAAA,IACT,WAAW,CAAC,eAAe,CAAC,OAAO,UAAU;AAAA,IAC7C,WAAW,CAAC,UAAU,CAAC,MAAM,KAAK;AAAA,EACpC;AACF;AAuBO,SAAS,kBACd,SACA,SACA,YACmB;AACnB,QAAM,aAAa,oBAAoB,OAAO;AAC9C,MAAI,CAAC,YAAY;AACf,UAAM,IAAI,MAAM,sCAAsC,OAAO,OAAO,CAAC,EAAE;AAAA,EACzE;AAEA,QAAM,eAAe,QAAQ,QAAQ;AACrC,QAAM,iBACJ,OAAO,iBAAiB,YAAY,aAAa,KAAK,EAAE,SAAS,IAC7D,GAAG,YAAY;AAAA;AAAA,EAAO,UAAU,KAChC;AAEN,QAAM,OAAO,WAAW,UAAU,cAAc;AAEhD,QAAM,QAAQ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MAAM;AAAA,IAC1C;AAEA,UAAM,UAAU,MAAM;AACpB,UAAI,CAAC,MAAM,OAAQ,OAAM,KAAK,SAAS;AAAA,IACzC;AACA,QAAI,QAAQ,QAAQ;AAClB,UAAI,QAAQ,OAAO,QAAS,SAAQ;AAAA,UAC/B,SAAQ,OAAO,iBAAiB,SAAS,SAAS,EAAE,MAAM,KAAK,CAAC;AAAA,IACvE;AAEA,UAAM,QAAQ,GAAG,QAAQ,CAAC,UAAU;AAClC,gBAAU,OAAO,KAAK;AAAA,IACxB,CAAC;AACD,UAAM,QAAQ,GAAG,QAAQ,CAAC,UAAU;AAClC,gBAAU,OAAO,KAAK;AAAA,IACxB,CAAC;AAED,UAAM,WAAW,CAAC,WAA+B;AAC/C,UAAI,QAAS;AACb,gBAAU;AACV,UAAI,MAAO,cAAa,KAAK;AAC7B,cAAQ,QAAQ,oBAAoB,SAAS,OAAO;AACpD,cAAQ,MAAM;AAAA,IAChB;AAEA,UAAM,GAAG,SAAS,CAAC,QAAQ;AACzB,UAAI,QAAS;AACb,gBAAU;AACV,UAAI,MAAO,cAAa,KAAK;AAC7B,cAAQ,QAAQ,oBAAoB,SAAS,OAAO;AACpD,aAAO,GAAG;AAAA,IACZ,CAAC;AAED,UAAM,GAAG,SAAS,CAAC,MAAM,WAAW;AAClC,eAAS;AAAA,QACP,UAAU;AAAA,QACV;AAAA,QACA;AAAA,QACA,gBAAgB;AAAA,QAChB,YAAY,KAAK,IAAI,IAAI;AAAA,QACzB;AAAA,MACF,CAAC;AAAA,IACH,CAAC;AAAA,EACH,CAAC;AACH;","names":[]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createFleetWorkspaceExecutor,
|
|
3
3
|
createSiblingSandboxExecutor
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-RYD7ND4A.js";
|
|
5
5
|
import {
|
|
6
6
|
runWorktreeHarness
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-MT4XM3G6.js";
|
|
8
8
|
import {
|
|
9
9
|
buildLoopOtelSpans,
|
|
10
10
|
createOtelExporter
|
|
@@ -275,4 +275,4 @@ export {
|
|
|
275
275
|
createPropagatingTraceEmitter,
|
|
276
276
|
traceContextToEnv
|
|
277
277
|
};
|
|
278
|
-
//# sourceMappingURL=chunk-
|
|
278
|
+
//# sourceMappingURL=chunk-RTNMMHWR.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
coderProfile,
|
|
3
3
|
coderTaskToPrompt
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-DVQGYDN5.js";
|
|
5
5
|
import {
|
|
6
6
|
composeLoopTraceEmitters,
|
|
7
7
|
detachedTurnEvents,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
runDetachedTurn,
|
|
12
12
|
runLoop,
|
|
13
13
|
selectValidWinner
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-MT4XM3G6.js";
|
|
15
15
|
|
|
16
16
|
// src/mcp/executor.ts
|
|
17
17
|
function createSiblingSandboxExecutor(options) {
|
|
@@ -472,4 +472,4 @@ export {
|
|
|
472
472
|
coderTaskFromArgs,
|
|
473
473
|
settleDetachedCoderTurn
|
|
474
474
|
};
|
|
475
|
-
//# sourceMappingURL=chunk-
|
|
475
|
+
//# sourceMappingURL=chunk-RYD7ND4A.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/mcp/executor.ts","../src/mcp/detached-coder.ts","../src/mcp/delegates.ts"],"sourcesContent":["/**\n * @experimental\n *\n * Delegation executors — the layer between MCP delegates and the sandbox\n * substrate. Each executor exposes a {@link SandboxClient} the kernel\n * consumes plus a placement tag so the trace pipeline can correlate workers\n * with their physical placement.\n *\n * Two implementations ship in-box:\n *\n * - {@link createSiblingSandboxExecutor} — every delegation spawns a fresh\n * sandbox sibling to the caller. Default when the MCP server runs as a\n * standalone CLI mounted outside a fleet.\n *\n * - {@link createFleetWorkspaceExecutor} — delegations dispatch onto machines\n * in the caller's existing fleet so worker diffs land directly on the\n * caller's filesystem (the fleet's shared workspace). Selected when the\n * parent sandbox passes `TANGLE_FLEET_ID` into the MCP server's env.\n */\n\nimport type { CreateSandboxOptions, SandboxInstance } from '@tangle-network/sandbox'\nimport type { LoopSandboxPlacement, SandboxClient } from '../runtime'\n\n/** @experimental */\nexport interface DelegationExecutor {\n /** Sandbox client the kernel calls. Returned with `describePlacement` set. */\n readonly client: SandboxClient\n /** Best-effort one-liner used in stderr boot logs and diagnostics. */\n describe(): string\n /**\n * Where delegated work physically runs. `sibling` and `fleet` placements are\n * session-backed (boxes expose `driveTurn`, so detached dispatch + resume\n * apply); `in-process` spawns local harness CLIs with no sandbox session to\n * detach. Optional so consumer-implemented executors stay source-compatible;\n * absent means \"unknown\" and detached dispatch is not enabled for it.\n */\n readonly placement?: 'sibling' | 'fleet' | 'in-process'\n}\n\n/** @experimental */\nexport interface SiblingSandboxExecutorOptions {\n client: SandboxClient\n}\n\n/**\n * Wrap a raw sandbox SDK client so the kernel emits\n * `loop.iteration.dispatch` events with `{ placement: 'sibling', sandboxId }`.\n *\n * The returned client `.create()` delegates to the underlying client; the\n * only added behavior is a `describePlacement` tag the kernel reads.\n *\n * @experimental\n */\nexport function createSiblingSandboxExecutor(\n options: SiblingSandboxExecutorOptions,\n): DelegationExecutor {\n const underlying = options.client\n const client: SandboxClient = {\n create(opts?: CreateSandboxOptions): Promise<SandboxInstance> {\n return underlying.create(opts)\n },\n describePlacement(box: SandboxInstance): LoopSandboxPlacement {\n return { kind: 'sibling', sandboxId: readId(box) }\n },\n }\n return {\n client,\n placement: 'sibling',\n describe(): string {\n return 'sibling-sandbox (each delegation = fresh sandbox via client.create)'\n },\n }\n}\n\n/**\n * Minimal `SandboxFleet` surface the fleet executor calls. Declared\n * structurally so tests can pass an in-memory stub without instantiating the\n * sandbox SDK.\n *\n * @experimental\n */\nexport interface FleetHandle {\n readonly fleetId: string\n /** Machine ids in dispatch-eligible order. The executor round-robins. */\n readonly ids: ReadonlyArray<string>\n /** Resolve a machine id to its `SandboxInstance` — that machine is mounted\n * on the fleet's shared workspace, so any diff the worker writes lands on\n * every other fleet machine's filesystem too. */\n sandbox(machineId: string): Promise<SandboxInstance>\n}\n\n/** @experimental */\nexport interface FleetWorkspaceExecutorOptions {\n fleet: FleetHandle\n /**\n * Override the machine-selection policy. Default = round-robin across\n * `fleet.ids`, skipping the optional `excludeMachineIds` set (typically the\n * coordinator machine the MCP server is running on).\n */\n selectMachine?: (call: { callIndex: number; ids: ReadonlyArray<string> }) => string\n /**\n * Machine ids to skip during default round-robin. Set to the caller's own\n * machineId so workers don't compete with the orchestrator on the same VM.\n */\n excludeMachineIds?: ReadonlyArray<string>\n}\n\n/**\n * Build an executor that resolves each delegated iteration to an existing\n * machine in `fleet`. The fleet's shared-workspace policy means the worker\n * machine sees the caller's filesystem — diffs land in-place with no\n * cross-sandbox copy step.\n *\n * @experimental\n */\nexport function createFleetWorkspaceExecutor(\n options: FleetWorkspaceExecutorOptions,\n): DelegationExecutor {\n const fleet = options.fleet\n const exclude = new Set(options.excludeMachineIds ?? [])\n let callIndex = 0\n // machineId-by-sandboxId, populated as we resolve machines so\n // `describePlacement` can recover the assignment from the SandboxInstance\n // the kernel hands back.\n const placementBySandboxId = new Map<string, { machineId: string }>()\n\n const client: SandboxClient = {\n async create(): Promise<SandboxInstance> {\n const ids = fleet.ids.filter((id) => !exclude.has(id))\n if (ids.length === 0) {\n throw new Error(\n `agent-runtime: fleet ${fleet.fleetId} has no eligible worker machines (ids=[${fleet.ids.join(',')}], excluded=[${[...exclude].join(',')}])`,\n )\n }\n const selector = options.selectMachine\n const machineId = selector ? selector({ callIndex, ids }) : ids[callIndex % ids.length]\n callIndex += 1\n if (typeof machineId !== 'string' || machineId.length === 0) {\n throw new Error('agent-runtime: fleet executor selectMachine returned an empty machine id')\n }\n const box = await fleet.sandbox(machineId)\n const sandboxId = readId(box)\n if (sandboxId) placementBySandboxId.set(sandboxId, { machineId })\n return box\n },\n describePlacement(box: SandboxInstance): LoopSandboxPlacement {\n const sandboxId = readId(box)\n const recorded = sandboxId ? placementBySandboxId.get(sandboxId) : undefined\n return {\n kind: 'fleet',\n sandboxId,\n fleetId: fleet.fleetId,\n machineId: recorded?.machineId,\n }\n },\n }\n\n return {\n client,\n placement: 'fleet',\n describe(): string {\n const excluded = exclude.size > 0 ? ` (excluded=[${[...exclude].join(',')}])` : ''\n return `fleet-workspace (fleetId=${fleet.fleetId}, machines=[${fleet.ids.join(',')}]${excluded})`\n },\n }\n}\n\nfunction readId(box: SandboxInstance): string | undefined {\n const raw = (box as unknown as { id?: unknown }).id\n return typeof raw === 'string' && raw.length > 0 ? raw : undefined\n}\n","/**\n * @experimental\n *\n * Sandbox-session coder decode layer. The sandbox-session delegate (`./delegates`) and the\n * cross-restart resume driver (`./bin`) run the in-box harness over a `SandboxClient` and need to\n * (a) build an `AgentRunSpec` from the authored coder profile, (b) decode the harness event stream\n * into a structured `CoderOutput`, and (c) gate it with the shared mechanical checks. This is the\n * MCP server's built-in `delegate_code` path — it is the live default delegate, NOT dormant — and is\n * kept separate from the generic recursive path: `worktreeFanout` instead settles the raw\n * `WorktreePatchArtifact` and gates via `patchDelivered`. Only the OPTIONAL cross-restart resume\n * (the `driveTurn` tick) is opt-in (`MCP_ENABLE_DETACHED_RESUME`); the held-stream delegate is\n * always live. Prefer `worktreeFanout` / `worktreeLoopRunner` for NEW local-repo coding.\n *\n * The decode tolerates two `result`-event shapes:\n * 1. the in-process executor's raw worktree-harness result (`{ branch, patch, stats, checks }`),\n * projected onto `CoderOutput`; and\n * 2. an LLM-emitted JSON block (`{ branch, patch, testResult, typecheckResult, diffStats }`),\n * lifted onto `data.result` or scanned out of the assistant transcript (any harness shape).\n */\n\nimport type { AgentProfile } from '@tangle-network/agent-interface'\nimport type { SandboxEvent } from '@tangle-network/sandbox'\nimport { type CoderTask, coderProfile, coderTaskToPrompt } from '../profiles/coder'\nimport { type CoderCheckConstraints, runCoderChecks } from '../runtime/supervise/patch-checks'\nimport type { AgentRunSpec, Driver, OutputAdapter, Validator } from '../runtime/types'\n\nconst DEFAULT_MAX_DIFF_LINES = 400\n\n/** @experimental The structured coder result the sandbox-session path decodes + gates. */\nexport interface CoderOutput {\n /** Branch the agent wrote the patch on. */\n branch: string\n /** Unified diff (`git diff <base>..HEAD`). */\n patch: string\n testResult: { passed: boolean; output: string }\n typecheckResult: { passed: boolean; output: string }\n diffStats: { filesChanged: number; insertions: number; deletions: number }\n /** Optional reviewer commentary surfaced by the agent. */\n reviewerNotes?: string\n}\n\n/** @experimental Overrides for one authored coder run on the sandbox-session path. */\nexport interface CoderRunSpecOptions {\n /** Sandbox-SDK backend.type. Default `'claude-code'`. */\n harness?: string\n /** Default model id passed in `AgentProfile.model.default`. */\n model?: string\n /** Custom system prompt replacement. Default = the `coderProfile` constant's prompt. */\n systemPrompt?: string\n /** Stable name for `AgentRunSpec.name`. Default = `coder-${harness}`. */\n name?: string\n}\n\n/** Build the authored `AgentProfile` for one harness on the sandbox-session path, applying the\n * optional per-run overrides over the `coderProfile` constant. */\nfunction coderRunProfile(options: CoderRunSpecOptions): AgentProfile {\n const harness = options.harness ?? 'claude-code'\n const name = options.name ?? `coder-${harness}`\n return {\n ...coderProfile,\n name,\n ...(options.systemPrompt ? { prompt: { systemPrompt: options.systemPrompt } } : {}),\n model: options.model ? { default: options.model } : undefined,\n metadata: { ...coderProfile.metadata, backendType: harness },\n }\n}\n\n/** @experimental Build the `AgentRunSpec<CoderTask>` the sandbox-session `runLoop` path drives. */\nexport function coderRunSpec(options: CoderRunSpecOptions = {}): AgentRunSpec<CoderTask> {\n return {\n name: options.name ?? `coder-${options.harness ?? 'claude-code'}`,\n profile: coderRunProfile(options),\n taskToPrompt: coderTaskToPrompt,\n }\n}\n\n/** @experimental The output adapter the sandbox-session path decodes the harness stream with. */\nexport const coderOutputAdapter: OutputAdapter<CoderOutput> = { parse: parseCoderEvents }\n\n/** @experimental */\nexport interface MultiHarnessCoderFanoutOptions {\n /**\n * Sandbox-SDK backend.type identifiers, one per parallel agent. Default:\n * `['claude-code', 'codex', 'opencode/zai-coding-plan/glm-5.1']`.\n */\n harnesses?: string[]\n /** Optional per-harness model override. Indexed parallel to `harnesses`. */\n models?: (string | undefined)[]\n}\n\n/**\n * The multi-harness coder fanout driving the sandbox-session delegate's `variants>1` path.\n * (`worktreeFanout` is the local-repo generic counterpart for new code.)\n *\n * @experimental\n */\nexport function multiHarnessCoderFanout(options: MultiHarnessCoderFanoutOptions = {}): {\n agentRuns: AgentRunSpec<CoderTask>[]\n output: OutputAdapter<CoderOutput>\n validator: Validator<CoderOutput>\n driver: Driver<CoderTask, CoderOutput, 'pick-winner' | 'fail'>\n} {\n const harnesses =\n options.harnesses && options.harnesses.length > 0\n ? options.harnesses\n : ['claude-code', 'codex', 'opencode/zai-coding-plan/glm-5.1']\n const models = options.models ?? []\n const agentRuns = harnesses.map((harness, i) => coderRunSpec({ harness, model: models[i] }))\n const driver: Driver<CoderTask, CoderOutput, 'pick-winner' | 'fail'> = {\n name: 'fanout',\n plan: async (task, history) => (history.length === 0 ? agentRuns.map(() => task) : []),\n decide: (history) => (history.some((i) => i.verdict?.valid === true) ? 'pick-winner' : 'fail'),\n }\n return { agentRuns, output: coderOutputAdapter, validator: defaultCoderValidator(), driver }\n}\n\n/**\n * The sandbox `CoderOutput` validator. A thin shim over the shared {@link runCoderChecks} gate,\n * adapting the parsed `CoderOutput` into the gate inputs.\n *\n * @experimental\n */\nexport function createCoderValidator(task: CoderTask): Validator<CoderOutput> {\n const constraints: CoderCheckConstraints = {\n maxDiffLines: task.maxDiffLines ?? DEFAULT_MAX_DIFF_LINES,\n forbiddenPaths: task.forbiddenPaths ?? [],\n }\n return {\n async validate(output) {\n return runCoderChecks(\n {\n patch: output.patch,\n testsPassed: output.testResult.passed,\n typecheckPassed: output.typecheckResult.passed,\n },\n constraints,\n )\n },\n }\n}\n\nfunction defaultCoderValidator(): Validator<CoderOutput> {\n return createCoderValidator({\n goal: '',\n repoRoot: '',\n forbiddenPaths: [],\n maxDiffLines: DEFAULT_MAX_DIFF_LINES,\n })\n}\n\n/**\n * Walk the event stream and return the structured coder payload.\n *\n * A `result` / `final` event lifts the structured payload onto `data.result`. That payload is\n * either the in-process executor's raw worktree-harness result (projected onto `CoderOutput`) or an\n * LLM-emitted `CoderOutput`-shaped JSON. When neither is present, the scan accumulates ALL assistant\n * text in stream order (any harness shape) and takes the last fenced JSON block that coerces —\n * claude-code lifts whole text onto `data.text`/`data.delta`; opencode streams `message.part.updated`\n * fragments, so the final block is split across many events and never whole in one.\n */\nfunction parseCoderEvents(events: SandboxEvent[]): CoderOutput {\n for (let i = events.length - 1; i >= 0; i -= 1) {\n const event = events[i]\n if (!event) continue\n const type = String(event.type ?? '')\n const data = isRecord(event.data) ? event.data : {}\n if (type === 'result' || type === 'final' || type === 'coder.result') {\n const payload = data.result ?? data.output ?? data\n const projected = projectWorktreeArtifact(payload)\n if (projected) return projected\n const direct = coerceCoderOutput(payload)\n if (direct) return direct\n }\n }\n const transcript = collectAssistantText(events)\n for (const candidate of fencedJsonBlocks(transcript)) {\n const coerced = coerceCoderOutput(candidate)\n if (coerced) return coerced\n }\n return {\n branch: '',\n patch: '',\n testResult: { passed: false, output: '' },\n typecheckResult: { passed: false, output: '' },\n diffStats: { filesChanged: 0, insertions: 0, deletions: 0 },\n }\n}\n\n/** Project the in-process executor's raw worktree-harness result (`{ branch, patch, stats, checks,\n * harness }`) onto `CoderOutput`. A check that did not run is treated as passing (the executor\n * simply didn't run that command). Returns undefined when the payload is not a worktree artifact. */\nfunction projectWorktreeArtifact(value: unknown): CoderOutput | undefined {\n if (!isRecord(value)) return undefined\n const stats = value.stats\n if (!isRecord(stats)) return undefined // not the raw artifact shape\n const branch = pickString(value.branch) ?? ''\n const patch = pickString(value.patch) ?? ''\n const checks = isRecord(value.checks) ? value.checks : {}\n const tests = isRecord(checks.tests) ? checks.tests : undefined\n const typecheck = isRecord(checks.typecheck) ? checks.typecheck : undefined\n const harness = isRecord(value.harness) ? value.harness : undefined\n const exitCode = harness ? toFiniteInt(harness.exitCode) : 0\n const timedOut = harness?.timedOut === true\n const harnessName = harness ? (pickString(harness.name) ?? 'harness') : 'harness'\n return {\n branch,\n patch,\n testResult: {\n passed: tests ? tests.passed === true : true,\n output: tail(pickString(tests?.output) ?? '', 4000),\n },\n typecheckResult: {\n passed: typecheck ? typecheck.passed === true : true,\n output: tail(pickString(typecheck?.output) ?? '', 4000),\n },\n diffStats: {\n filesChanged: toFiniteInt(stats.filesChanged),\n insertions: toFiniteInt(stats.insertions),\n deletions: toFiniteInt(stats.deletions),\n },\n ...(exitCode !== 0\n ? {\n reviewerNotes: `harness ${harnessName} exited ${exitCode}${timedOut ? ' (timed out)' : ''}`,\n }\n : {}),\n }\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === 'object' && !Array.isArray(value)\n}\n\n/** Keep the last `max` chars of a diagnostic string — harness stdout can be large; the gate reads\n * `passed`, not this text, so only the tail is retained for traces/logs. */\nfunction tail(text: string, max: number): string {\n return text.length <= max ? text : text.slice(text.length - max)\n}\n\nfunction pickString(value: unknown): string | undefined {\n return typeof value === 'string' && value.length > 0 ? value : undefined\n}\n\n/**\n * Concatenate assistant text across the event stream in arrival order, tolerating every harness\n * shape: claude-code lifts text onto `data.text`/`data.delta`; opencode streams\n * `message.part.updated` with `data.part.type === 'text'` carrying `data.delta`/`data.part.text`.\n * Reasoning/thinking parts are excluded — only the final answer text carries the result JSON.\n */\nfunction collectAssistantText(events: SandboxEvent[]): string {\n const chunks: string[] = []\n for (const event of events) {\n if (!event) continue\n const data = isRecord(event.data) ? event.data : {}\n if (String(event.type ?? '') === 'message.part.updated') {\n const part = isRecord(data.part) ? data.part : {}\n const partType = String(part.type ?? '')\n if (partType !== 'text' && partType !== '') continue\n const text = pickString(data.delta) ?? pickString(part.text)\n if (text) chunks.push(text)\n continue\n }\n const text = pickString(data.text) ?? pickString(data.delta)\n if (text) chunks.push(text)\n }\n return chunks.join('')\n}\n\n/** All parseable fenced JSON blocks in `text`, last-first (the final result block the agent emits\n * is the one we want). */\nfunction fencedJsonBlocks(text: string): unknown[] {\n const out: unknown[] = []\n const matches = [...text.matchAll(/```(?:json)?\\s*([\\s\\S]*?)```/gi)]\n for (let i = matches.length - 1; i >= 0; i -= 1) {\n const body = (matches[i]?.[1] ?? '').trim()\n if (!body) continue\n try {\n out.push(JSON.parse(body))\n } catch {\n // not JSON — keep scanning earlier blocks\n }\n }\n return out\n}\n\nfunction coerceCoderOutput(value: unknown): CoderOutput | undefined {\n if (!isRecord(value)) return undefined\n const branch = pickString(value.branch)\n const patch = pickString(value.patch) ?? ''\n if (branch === undefined) return undefined\n return {\n branch,\n patch,\n testResult: coerceCmdResult(value.testResult),\n typecheckResult: coerceCmdResult(value.typecheckResult),\n diffStats: coerceDiffStats(value.diffStats),\n reviewerNotes: pickString(value.reviewerNotes),\n }\n}\n\nfunction coerceCmdResult(value: unknown): { passed: boolean; output: string } {\n if (!isRecord(value)) return { passed: false, output: '' }\n return { passed: value.passed === true, output: pickString(value.output) ?? '' }\n}\n\nfunction coerceDiffStats(value: unknown): {\n filesChanged: number\n insertions: number\n deletions: number\n} {\n if (!isRecord(value)) return { filesChanged: 0, insertions: 0, deletions: 0 }\n return {\n filesChanged: toFiniteInt(value.filesChanged),\n insertions: toFiniteInt(value.insertions),\n deletions: toFiniteInt(value.deletions),\n }\n}\n\nfunction toFiniteInt(value: unknown): number {\n if (typeof value !== 'number') return 0\n if (!Number.isFinite(value)) return 0\n return Math.max(0, Math.trunc(value))\n}\n","/**\n * @experimental\n *\n * Delegate factories — the layer between MCP tool handlers and the\n * underlying `runLoop` runners.\n *\n * The MCP server is profile-agnostic: it owns the task queue + feedback\n * store + transport. Each `*Delegate` is the closure that the queue\n * invokes when a task runs. Consumers can override either delegate to\n * inject custom drivers, mocks, fleet-aware dispatchers, etc.\n *\n * The `detachedSessionDelegate` here is the built-in SANDBOX-SESSION coder path — the live default\n * `delegate_code` delegate: workers run the in-box harness over a `SandboxClient`. By default it\n * holds the stream; single-variant turns can OPTIONALLY dispatch DETACHED (`driveTurn` ticks) so a\n * durable queue resumes them across an MCP restart — that resume tick is the only part gated behind\n * `MCP_ENABLE_DETACHED_RESUME` (default off) in `bin.ts`, a capability the recursive\n * `Scope`/worktree-CLI leaf has no durable equivalent for yet. For NEW local-repo coding use\n * `worktreeFanout` / `worktreeLoopRunner`. The default researcher delegate is **not** wired in this\n * file — `agent-knowledge` cannot be imported from `agent-runtime` without inducing a cycle.\n * Consumers pass `researcherDelegate` explicitly.\n */\n\nimport type { CoderTask } from '../profiles/coder'\nimport type {\n AgentRunSpec,\n Iteration,\n LoopTraceEmitter,\n Outcome,\n SandboxClient,\n WinnerStrategy,\n} from '../runtime'\nimport { runLoop, selectValidWinner } from '../runtime'\nimport { composeLoopTraceEmitters } from './delegation-trace'\nimport {\n type CoderOutput,\n coderOutputAdapter,\n coderRunSpec,\n createCoderValidator,\n multiHarnessCoderFanout,\n} from './detached-coder'\nimport {\n type DetachedTurn,\n detachedTurnEvents,\n formatDetachedSessionRef,\n parseDetachedSessionRef,\n runDetachedTurn,\n} from './detached-turn'\nimport { createSiblingSandboxExecutor, type DelegationExecutor } from './executor'\nimport type {\n DelegateCodeArgs,\n DelegateResearchArgs,\n DelegateUiAuditArgs,\n DelegationProgress,\n ResearchOutputShape,\n UiAuditorDelegationOutput,\n} from './types'\n\n/** @experimental */\nexport interface DelegateRunCtx {\n signal: AbortSignal\n report(progress: DelegationProgress): void\n /**\n * Detached-run resume key recorded on the queue record at submit time\n * (`formatDetachedSessionRef`). Present only when the submit path requested\n * detached dispatch — its presence is what routes a session-backed delegate\n * onto the `driveTurn` tick path instead of holding a stream.\n */\n detachedSessionRef?: string\n /** Rebind the record's resume key (e.g. once the sandbox id is known). */\n updateDetachedSessionRef?(ref: string): void\n /**\n * Per-delegation trace sink supplied by the queue — loop events emitted\n * here land on the delegation record as a compact span tree. Delegates\n * compose it with their configured OTEL emitter so both sinks observe\n * the same stream.\n */\n traceEmitter?: LoopTraceEmitter\n}\n\n/** @experimental The server's coder-profile delegate slot — the closure the queue invokes for a\n * `delegate_code` task. `detachedSessionDelegate` is the built-in implementation. */\nexport type CoderDelegate = (args: DelegateCodeArgs, ctx: DelegateRunCtx) => Promise<CoderOutput>\n\n/** @experimental */\nexport type ResearcherDelegate = (\n args: DelegateResearchArgs,\n ctx: DelegateRunCtx,\n) => Promise<ResearchOutputShape>\n\n/**\n * UI-auditor delegate — fully consumer-injected. agent-runtime ships no\n * default factory because the inputs are workspace path + judge function\n * + (optionally) a `SandboxClient`, and the judge is the consumer's\n * model seam. See `createInProcessUiAuditClient` + `uiAuditorProfile` in\n * `@tangle-network/agent-runtime/profiles` for the canonical wiring.\n *\n * @experimental\n */\nexport type UiAuditorDelegate = (\n args: DelegateUiAuditArgs,\n ctx: DelegateRunCtx,\n) => Promise<UiAuditorDelegationOutput>\n\n/** @experimental Structured review verdict over a coder candidate. */\nexport interface CoderReview {\n /** Gate: only approved candidates are eligible to win. */\n approved: boolean\n /** Reviewer's recommendation — surfaced in traces. */\n recommendation: 'ship' | 'approve-with-nits' | 'changes-requested' | 'reject'\n /** Readiness 0..1, used by the `highest-readiness` winner-selection strategy. */\n readiness: number\n notes?: string\n}\n\n/**\n * @experimental\n *\n * Optional adversarial reviewer over a coder candidate that already passed\n * mechanical validation (tests/typecheck/forbidden/diff/no-op/secrets). Folded\n * from the ai-trading-blueprint delegation MCP: a candidate is only eligible to\n * win if the reviewer approves it. The reviewer is the consumer's seam — an LLM\n * judge, a `pnpm review` command, anything returning a `CoderReview`.\n */\nexport type CoderReviewer = (\n output: CoderOutput,\n task: CoderTask,\n ctx: { signal: AbortSignal },\n) => Promise<CoderReview> | CoderReview\n\n/**\n * @experimental Winner-selection strategy among validated (+ reviewed) candidates on the\n * sandbox-session path. The base strategies (`highest-score` / `smallest-diff` /\n * `first-approved`) delegate to the shared `selectValidWinner`; `highest-readiness` is the\n * reviewer-only strategy this path keeps that the generic selector does not express. Default\n * `highest-score`.\n */\nexport type DetachedWinnerSelection =\n | 'highest-score'\n | 'smallest-diff'\n | 'highest-readiness'\n | 'first-approved'\n\n/** @experimental */\nexport interface DetachedSessionDelegateOptions {\n /**\n * Execution placement. Pass a {@link DelegationExecutor} (sibling or fleet)\n * to control where worker iterations land. `sandboxClient` is a\n * convenience shorthand that wraps the client in a sibling executor — pass\n * one or the other, not both.\n */\n executor?: DelegationExecutor\n /**\n * Convenience shorthand for sibling placement. Equivalent to\n * `executor: createSiblingSandboxExecutor({ client: sandboxClient })`.\n */\n sandboxClient?: SandboxClient\n /** Backend harness for the single-coder path. Default comes from `coderProfile`. */\n harness?: string\n /** Model override for the single-coder path. */\n model?: string\n /**\n * The worker's authored system prompt (§1.5). Flows onto `coderProfile`'s\n * `profile.prompt.systemPrompt` → through `runLoop` → the executor's `harnessInvocation`, so the\n * harness runs under this stance, not just the default coder prompt. Omit to keep the default.\n */\n systemPrompt?: string\n /** Default `['claude-code', 'codex', 'opencode/zai-coding-plan/glm-5.1']` when variants > 1. */\n fanoutHarnesses?: string[]\n /** Optional per-harness model override for `variants > 1`. */\n fanoutModels?: (string | undefined)[]\n /** Hard cap on the kernel's per-batch concurrency. Default 4. */\n maxConcurrency?: number\n /**\n * Optional adversarial reviewer. When set, a candidate must pass mechanical\n * validation AND `reviewer.approved` to be eligible to win — empty/secret/\n * test-failing patches are already gone; this catches the \"compiles + passes\n * but wrong/unsafe\" class the deterministic validator can't see.\n */\n reviewer?: CoderReviewer\n /** Winner-selection strategy among eligible candidates. Default `highest-score`. */\n winnerSelection?: DetachedWinnerSelection\n /**\n * Loop trace emitter forwarded into every delegated `runLoop`. Wire\n * `createPropagatingTraceEmitter(readTraceContextFromEnv())` here (the bin\n * does) so delegated build-loops export their topology spans to the OTLP /\n * Tangle Intelligence sink when `OTEL_EXPORTER_OTLP_ENDPOINT` is set — and\n * are a cheap no-op when it isn't. Configurable by construction.\n *\n * Detached single-variant turns (taken when `ctx.detachedSessionRef` is set)\n * bypass `runLoop`; `runDetachedTurn` synthesizes a single-iteration loop\n * event stream for them so this emitter observes detached work too.\n */\n traceEmitter?: LoopTraceEmitter\n /** Tick cadence (ms) for the detached single-variant path. Default 5000. */\n detachedTickIntervalMs?: number\n /** Wall-clock cap (ms) forwarded to `driveTurn` for detached turns. */\n detachedWallCapMs?: number\n}\n\n/**\n * Build the sandbox-session coder delegate. It drives `runLoop` against the project's\n * sandbox client + coder profile; when `args.variants > 1` it switches to the multi-harness fanout\n * topology.\n *\n * This is the SANDBOX-SESSION coder path: workers run the in-box harness via the\n * `SandboxClient`'s `streamPrompt`, and single-variant turns can dispatch DETACHED\n * (driveTurn ticks) so a durable queue resumes them across an MCP restart — a substrate\n * the recursive worktree-CLI leaf does not yet have a journal-replay equivalent for.\n *\n * For NEW local-repo coding use `worktreeFanout` / `worktreeLoopRunner` (author an `AgentProfile`\n * per harness → `createWorktreeCliExecutor` leaves → `gateOnDeliverable`). This delegate stays as the\n * MCP server's built-in `delegate_code` path; it runs held-stream by default and only its OPTIONAL\n * cross-restart resume (the `driveTurn` tick) is opt-in behind `MCP_ENABLE_DETACHED_RESUME`.\n *\n * @experimental\n */\nexport function detachedSessionDelegate(options: DetachedSessionDelegateOptions): CoderDelegate {\n const executor = resolveExecutor(options)\n const sandboxClient = executor.client\n const fanoutHarnesses = options.fanoutHarnesses\n const maxConcurrency = options.maxConcurrency ?? 4\n const traceEmitter = options.traceEmitter\n return async (args, ctx) => {\n const task = coderTaskFromArgs(args)\n const variants = Math.max(1, Math.trunc(args.variants ?? 1))\n const loopEmitter = composeLoopTraceEmitters(traceEmitter, ctx.traceEmitter)\n ctx.report({ iteration: 0, phase: 'starting' })\n if (variants <= 1) {\n const agentRunSpec = coderRunSpec({\n ...(options.harness ? { harness: options.harness } : {}),\n ...(options.model ? { model: options.model } : {}),\n ...(options.systemPrompt ? { systemPrompt: options.systemPrompt } : {}),\n })\n const output = coderOutputAdapter\n const validator = createCoderValidator(task)\n // Detached dispatch: one session on one box, driven by `driveTurn` ticks\n // instead of a held stream, so the run survives an MCP-process restart\n // (the resume driver re-attaches via the persisted ref). Only the\n // single-variant path detaches — fanout needs N sessions + winner\n // selection over every candidate, which one resume key cannot express.\n if (ctx.detachedSessionRef !== undefined && ctx.updateDetachedSessionRef) {\n const { sessionId } = parseDetachedSessionRef(ctx.detachedSessionRef)\n const rebind = ctx.updateDetachedSessionRef\n const turn = await runDetachedTurn({\n client: sandboxClient,\n spec: agentRunSpec as AgentRunSpec<unknown>,\n prompt: agentRunSpec.taskToPrompt(task),\n sessionId,\n bindSandbox: (sandboxId) => rebind(formatDetachedSessionRef({ sandboxId, sessionId })),\n signal: ctx.signal,\n report: ctx.report,\n ...(loopEmitter ? { traceEmitter: loopEmitter } : {}),\n ...(executor.placement === 'fleet' ? { placement: 'fleet' as const } : {}),\n ...(options.detachedTickIntervalMs !== undefined\n ? { tickIntervalMs: options.detachedTickIntervalMs }\n : {}),\n ...(options.detachedWallCapMs !== undefined\n ? { wallCapMs: options.detachedWallCapMs }\n : {}),\n })\n const chosen = await settleDetachedCoderTurn(turn, {\n task,\n sessionId,\n signal: ctx.signal,\n ...(options.harness ? { harness: options.harness } : {}),\n ...(options.model ? { model: options.model } : {}),\n ...(options.reviewer ? { reviewer: options.reviewer } : {}),\n })\n ctx.report({ iteration: 1, phase: 'completed' })\n return chosen\n }\n const result = await runLoop({\n driver: singleShotDriver,\n agentRun: agentRunSpec,\n output,\n validator,\n task,\n ctx: {\n sandboxClient,\n signal: ctx.signal,\n ...(loopEmitter ? { traceEmitter: loopEmitter } : {}),\n },\n maxIterations: 1,\n maxConcurrency,\n })\n const chosen = await pickCoderWinner({\n iterations: result.iterations,\n reviewer: options.reviewer,\n selection: options.winnerSelection ?? 'highest-score',\n task,\n signal: ctx.signal,\n })\n if (!chosen) throw new Error(noWinnerMessage(options.reviewer))\n ctx.report({ iteration: 1, phase: 'completed' })\n return chosen\n }\n const fanout = multiHarnessCoderFanout({\n ...(fanoutHarnesses && fanoutHarnesses.length > 0\n ? { harnesses: fanoutHarnesses.slice(0, variants) }\n : {}),\n ...(options.fanoutModels ? { models: options.fanoutModels.slice(0, variants) } : {}),\n })\n const agentRuns = fanout.agentRuns.slice(0, variants)\n const result = await runLoop({\n driver: fanout.driver,\n agentRuns,\n output: fanout.output,\n validator: fanout.validator,\n task,\n ctx: {\n sandboxClient,\n signal: ctx.signal,\n ...(loopEmitter ? { traceEmitter: loopEmitter } : {}),\n },\n maxIterations: variants,\n maxConcurrency: Math.min(maxConcurrency, variants),\n })\n const chosen = await pickCoderWinner({\n iterations: result.iterations,\n reviewer: options.reviewer,\n selection: options.winnerSelection ?? 'highest-score',\n task,\n signal: ctx.signal,\n })\n if (!chosen) throw new Error(noWinnerMessage(options.reviewer))\n ctx.report({ iteration: agentRuns.length, phase: 'completed' })\n return chosen\n }\n}\n\ninterface PickCoderWinnerArgs {\n iterations: ReadonlyArray<Iteration<CoderTask, CoderOutput>>\n reviewer: CoderReviewer | undefined\n selection: DetachedWinnerSelection\n task: CoderTask\n signal: AbortSignal\n}\n\n/** A valid (and, when a reviewer is wired, approved) candidate kept for selection. */\ninterface EligibleCandidate {\n iter: Iteration<CoderTask, CoderOutput>\n /** Reviewer readiness (defaults to the verdict score when no reviewer ran). */\n readiness: number\n}\n\n/**\n * Pick the winning coder candidate from a finished loop's iterations:\n * 1. keep only mechanically-VALID candidates (the validator already gated\n * tests/typecheck/forbidden/diff/no-op/secrets),\n * 2. if a `reviewer` is wired, keep only those it APPROVES,\n * 3. select among survivors via the shared `selectValidWinner` (base strategies) or, for the\n * reviewer-only `highest-readiness`, a readiness sort (the one strategy the generic selector\n * does not express — a documented capability of this sandbox-session path).\n * Returns `undefined` when nothing survives — the delegate fails loud.\n */\nasync function pickCoderWinner(args: PickCoderWinnerArgs): Promise<CoderOutput | undefined> {\n const eligible: EligibleCandidate[] = []\n for (const iter of args.iterations) {\n if (iter.output === undefined || iter.error || iter.verdict?.valid !== true) continue\n const readiness = iter.verdict.score ?? 0\n if (args.reviewer) {\n const review = await args.reviewer(iter.output, args.task, { signal: args.signal })\n if (!review.approved) continue\n eligible.push({ iter, readiness: review.readiness })\n } else {\n eligible.push({ iter, readiness })\n }\n }\n if (eligible.length === 0) return undefined\n\n // `highest-readiness` ranks on the reviewer's readiness — a reviewer-only metric the generic\n // valid-only selector does not carry. Ties → earliest iteration.\n if (args.selection === 'highest-readiness') {\n const sorted = [...eligible].sort(\n (a, b) => b.readiness - a.readiness || a.iter.index - b.iter.index,\n )\n return sorted[0]!.iter.output\n }\n\n // Base strategies route through the SHARED valid-only selector. Wrap each survivor's raw\n // `CoderOutput` in the `Outcome<D>` shape `selectValidWinner` reads, preserving verdict/index.\n const wrapped: Iteration<unknown, Outcome<CoderOutput>>[] = eligible.map(({ iter }) => ({\n ...iter,\n output: { kind: 'done', deliverable: iter.output as CoderOutput },\n }))\n const winner = selectValidWinner<CoderOutput>({\n strategy: baseStrategy(args.selection),\n sizeOf: (o) => o.diffStats.insertions + o.diffStats.deletions,\n })(wrapped)\n const out = winner?.output\n if (!out || out.kind !== 'done') return undefined\n return out.deliverable\n}\n\n/** Map the detached-session selection enum onto the shared `WinnerStrategy`. `first-approved`\n * reduces to `first-valid` over the already-approved set; `smallest-diff` to `smallest-artifact`. */\nfunction baseStrategy(\n selection: Exclude<DetachedWinnerSelection, 'highest-readiness'>,\n): WinnerStrategy {\n switch (selection) {\n case 'smallest-diff':\n return 'smallest-artifact'\n case 'first-approved':\n return 'first-valid'\n default:\n return 'highest-score'\n }\n}\n\nfunction noWinnerMessage(reviewer: CoderReviewer | undefined): string {\n return reviewer\n ? 'coder delegate: no candidate passed validation + review'\n : 'coder delegate: no candidate passed validation'\n}\n\n/**\n * Canonical `DelegateCodeArgs` → `CoderTask` mapping — the single source for\n * the delegate's live dispatch AND the resume driver's settle/message\n * rebuilding, so a resumed record reproduces exactly the task the original\n * process dispatched.\n *\n * @experimental\n */\nexport function coderTaskFromArgs(args: DelegateCodeArgs): CoderTask {\n return {\n goal: buildCoderGoal(args),\n repoRoot: args.repoRoot,\n testCmd: args.config?.testCmd,\n typecheckCmd: args.config?.typecheckCmd,\n forbiddenPaths: args.config?.forbiddenPaths,\n maxDiffLines: args.config?.maxDiffLines,\n }\n}\n\n/** @experimental */\nexport interface SettleDetachedCoderTurnOptions {\n task: CoderTask\n /** Session id of the detached turn — used as the synthesized event id. */\n sessionId: string\n signal: AbortSignal\n harness?: string\n model?: string\n /** Same gate as the streaming path: an unapproved candidate cannot win. */\n reviewer?: CoderReviewer\n}\n\n/**\n * Settle a completed detached coder turn through the same gate the streaming\n * path applies: parse the terminal payload with the coder output adapter,\n * run the mechanical validator (tests/typecheck/forbidden/diff/no-op/secrets),\n * then the optional reviewer. Throws when nothing survives — a resumed or\n * detached run must not return an unvalidated patch.\n *\n * SCOPE NOTE (detached/resume): the detached `driveTurn`-tick + cross-restart resume path is\n * bound to the `runLoop` + sandbox-session substrate. The recursive `Scope`/worktree-CLI leaf has\n * journal→replay but no driveTurn-over-a-detached-sandbox-session equivalent yet, so resume is NOT\n * advertised on the generic `worktreeFanout` path. This helper (with `coderTaskFromArgs` and\n * `createDriveTurnResumeDriver`) stays as the resume seam `bin.ts` wires for in-flight records.\n *\n * @experimental\n */\nexport async function settleDetachedCoderTurn(\n turn: DetachedTurn,\n options: SettleDetachedCoderTurnOptions,\n): Promise<CoderOutput> {\n const parsed = coderOutputAdapter.parse(detachedTurnEvents(options.sessionId, turn))\n const validator = createCoderValidator(options.task)\n const verdict = await validator.validate(parsed, { iteration: 0, signal: options.signal })\n if (verdict.valid !== true) throw new Error(noWinnerMessage(options.reviewer))\n if (options.reviewer) {\n const review = await options.reviewer(parsed, options.task, { signal: options.signal })\n if (!review.approved) throw new Error(noWinnerMessage(options.reviewer))\n }\n return parsed\n}\n\nfunction buildCoderGoal(args: DelegateCodeArgs): string {\n if (!args.contextHint) return args.goal\n return [args.goal, '', '## Context', args.contextHint].join('\\n')\n}\n\nfunction resolveExecutor(options: DetachedSessionDelegateOptions): DelegationExecutor {\n if (options.executor && options.sandboxClient) {\n throw new Error('detachedSessionDelegate: pass exactly one of `executor` or `sandboxClient`')\n }\n if (options.executor) return options.executor\n if (options.sandboxClient) {\n return createSiblingSandboxExecutor({ client: options.sandboxClient })\n }\n throw new Error('detachedSessionDelegate: `executor` or `sandboxClient` is required')\n}\n\n/**\n * Single-shot driver — plan one task on iteration 0, stop after one\n * iteration. Used by the coder delegate when `variants <= 1`. Keeps the\n * runLoop kernel-level accounting (timing, cost, trace emission) while\n * skipping fanout/refine topology overhead.\n */\nconst singleShotDriver = {\n name: 'mcp-single-shot',\n async plan<Task>(task: Task, history: ReadonlyArray<unknown>): Promise<Task[]> {\n return history.length === 0 ? [task] : []\n },\n decide(history: ReadonlyArray<unknown>): 'pick-winner' | 'fail' {\n return history.length > 0 ? 'pick-winner' : 'fail'\n },\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAqDO,SAAS,6BACd,SACoB;AACpB,QAAM,aAAa,QAAQ;AAC3B,QAAM,SAAwB;AAAA,IAC5B,OAAO,MAAuD;AAC5D,aAAO,WAAW,OAAO,IAAI;AAAA,IAC/B;AAAA,IACA,kBAAkB,KAA4C;AAC5D,aAAO,EAAE,MAAM,WAAW,WAAW,OAAO,GAAG,EAAE;AAAA,IACnD;AAAA,EACF;AACA,SAAO;AAAA,IACL;AAAA,IACA,WAAW;AAAA,IACX,WAAmB;AACjB,aAAO;AAAA,IACT;AAAA,EACF;AACF;AA2CO,SAAS,6BACd,SACoB;AACpB,QAAM,QAAQ,QAAQ;AACtB,QAAM,UAAU,IAAI,IAAI,QAAQ,qBAAqB,CAAC,CAAC;AACvD,MAAI,YAAY;AAIhB,QAAM,uBAAuB,oBAAI,IAAmC;AAEpE,QAAM,SAAwB;AAAA,IAC5B,MAAM,SAAmC;AACvC,YAAM,MAAM,MAAM,IAAI,OAAO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,QAAQ,UAAU,KAAM,OAAM,IAAI,MAAM,gBAAgB,QAAQ,QAAQ,CAAC;AAC7E,MAAI,QAAQ,UAAU;AACpB,UAAM,SAAS,MAAM,QAAQ,SAAS,QAAQ,QAAQ,MAAM,EAAE,QAAQ,QAAQ,OAAO,CAAC;AACtF,QAAI,CAAC,OAAO,SAAU,OAAM,IAAI,MAAM,gBAAgB,QAAQ,QAAQ,CAAC;AAAA,EACzE;AACA,SAAO;AACT;AAEA,SAAS,eAAe,MAAgC;AACtD,MAAI,CAAC,KAAK,YAAa,QAAO,KAAK;AACnC,SAAO,CAAC,KAAK,MAAM,IAAI,cAAc,KAAK,WAAW,EAAE,KAAK,IAAI;AAClE;AAEA,SAAS,gBAAgB,SAA6D;AACpF,MAAI,QAAQ,YAAY,QAAQ,eAAe;AAC7C,UAAM,IAAI,MAAM,4EAA4E;AAAA,EAC9F;AACA,MAAI,QAAQ,SAAU,QAAO,QAAQ;AACrC,MAAI,QAAQ,eAAe;AACzB,WAAO,6BAA6B,EAAE,QAAQ,QAAQ,cAAc,CAAC;AAAA,EACvE;AACA,QAAM,IAAI,MAAM,oEAAoE;AACtF;AAQA,IAAM,mBAAmB;AAAA,EACvB,MAAM;AAAA,EACN,MAAM,KAAW,MAAY,SAAkD;AAC7E,WAAO,QAAQ,WAAW,IAAI,CAAC,IAAI,IAAI,CAAC;AAAA,EAC1C;AAAA,EACA,OAAO,SAAyD;AAC9D,WAAO,QAAQ,SAAS,IAAI,gBAAgB;AAAA,EAC9C;AACF;","names":["text","chosen","result"]}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-FNMGYYSS.js";
|
|
4
4
|
import {
|
|
5
5
|
detachedSessionDelegate
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-RYD7ND4A.js";
|
|
7
7
|
import {
|
|
8
8
|
runAnalystLoop
|
|
9
9
|
} from "./chunk-P5OKDSLB.js";
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
definePersona,
|
|
13
13
|
runPersonified,
|
|
14
14
|
worktreeFanout
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-MT4XM3G6.js";
|
|
16
16
|
import {
|
|
17
17
|
ConfigError
|
|
18
18
|
} from "./chunk-VLF5RHEQ.js";
|
|
@@ -211,4 +211,4 @@ export {
|
|
|
211
211
|
runLoopRunnerCli,
|
|
212
212
|
parseLoopRunnerArgv
|
|
213
213
|
};
|
|
214
|
-
//# sourceMappingURL=chunk-
|
|
214
|
+
//# sourceMappingURL=chunk-YWO4H64E.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as DelegateFeedbackArgs, d as DelegationFeedbackSnapshot, e as DelegationTaskQueue, f as CoderDelegate, R as ResearcherDelegate, U as UiAuditorDelegate, T as TraceContext, A as Agent, S as Scope, g as ResultBlobStore, B as Budget } from './delegates-
|
|
1
|
+
import { c as DelegateFeedbackArgs, d as DelegationFeedbackSnapshot, e as DelegationTaskQueue, f as CoderDelegate, R as ResearcherDelegate, U as UiAuditorDelegate, T as TraceContext, A as Agent, S as Scope, g as ResultBlobStore, B as Budget } from './delegates-CLFNAKyi.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @experimental
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { DefaultVerdict, AgentEvalError } from '@tangle-network/agent-eval';
|
|
2
|
-
import { AgentProfile
|
|
2
|
+
import { AgentProfile } from '@tangle-network/agent-interface';
|
|
3
|
+
import { BackendType, SandboxEvent, SandboxInstance } from '@tangle-network/sandbox';
|
|
3
4
|
import { R as RuntimeHooks } from './runtime-hooks-C7JwKb9E.js';
|
|
4
5
|
import { f as LoopTokenUsage, g as LoopTraceEmitter, d as LoopTraceEvent, S as SandboxClient, A as AgentRunSpec } from './types-Crxftafi.js';
|
|
5
|
-
import { C as CoderTask } from './coder-
|
|
6
|
+
import { C as CoderTask } from './coder-2leJPOvC.js';
|
|
6
7
|
import { a as UiLens, U as UiFinding } from './substrate-CUgk7F7s.js';
|
|
7
8
|
|
|
8
9
|
/**
|
package/dist/improvement.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -3,19 +3,20 @@ export { AgentEvalError, AgentEvalErrorCode, ConfigError, ControlBudget, Control
|
|
|
3
3
|
import { h as AgentBackendInput, i as AgentExecutionBackend, c as OpenAIChatTool, j as OpenAIChatToolChoice, k as AgentBackendContext, R as RuntimeStreamEvent, K as KnowledgeReadinessDecision, l as RunAgentTaskOptions, m as AgentTaskRunResult, n as RunAgentTaskStreamOptions, o as AgentRuntimeEvent, p as AgentTaskStatus, q as RuntimeSessionStore, r as RuntimeSession } from './types-Crxftafi.js';
|
|
4
4
|
export { s as AgentAdapter, t as AgentKnowledgeProvider, u as AgentRuntimeEventSink, v as AgentTaskContext, w as AgentTaskSpec, B as BackendErrorDetail, x as RuntimeRunHandle, y as RuntimeRunPersistenceAdapter, z as RuntimeRunRow, C as startRuntimeRun } from './types-Crxftafi.js';
|
|
5
5
|
import { Scenario, ProfileDispatchFn } from '@tangle-network/agent-eval/campaign';
|
|
6
|
-
export { C as CoderLoopRunnerOptions, D as DELEGATED_LOOP_MODES, a as DelegatedLoopMode, b as DelegatedLoopRegistry, c as DelegatedLoopResult, d as DelegatedLoopRunner, L as LoopRunnerCliArgs, e as LoopRunnerCliResult, R as ResearchLoopResult, f as ResearchLoopRunnerOptions, g as RunDelegatedLoopOptions, V as VetoedFact, W as WorktreeLoopRunnerOptions, h as auditLoopRunner, i as coderLoopRunner, j as isDelegatedLoopMode, p as parseLoopRunnerArgv, r as researchLoopRunner, k as runDelegatedLoop, l as runLoopRunnerCli, s as selfImproveLoopRunner, w as worktreeLoopRunner } from './loop-runner-bin-
|
|
6
|
+
export { C as CoderLoopRunnerOptions, D as DELEGATED_LOOP_MODES, a as DelegatedLoopMode, b as DelegatedLoopRegistry, c as DelegatedLoopResult, d as DelegatedLoopRunner, L as LoopRunnerCliArgs, e as LoopRunnerCliResult, R as ResearchLoopResult, f as ResearchLoopRunnerOptions, g as RunDelegatedLoopOptions, V as VetoedFact, W as WorktreeLoopRunnerOptions, h as auditLoopRunner, i as coderLoopRunner, j as isDelegatedLoopMode, p as parseLoopRunnerArgv, r as researchLoopRunner, k as runDelegatedLoop, l as runLoopRunnerCli, s as selfImproveLoopRunner, w as worktreeLoopRunner } from './loop-runner-bin-B6dzNZC8.js';
|
|
7
7
|
export { m as mcpToolsForRuntimeMcp, a as mcpToolsForRuntimeMcpSubset } from './openai-tools-CA2N3-Ak.js';
|
|
8
|
-
export { aU as EvalRunEvent, aV as EvalRunGeneration, aW as EvalRunsExportConfig, aX as EvalRunsExportResult, aY as INTELLIGENCE_WIRE_VERSION, aZ as LoopSpanNode, a_ as OtelAttribute, a$ as OtelExportConfig, b0 as OtelExporter, b1 as OtelSpan, b2 as buildLoopOtelSpans, b3 as buildLoopSpanNodes, b4 as createOtelExporter, b5 as exportEvalRuns, b6 as loopEventToOtelSpan } from './delegates-
|
|
8
|
+
export { aU as EvalRunEvent, aV as EvalRunGeneration, aW as EvalRunsExportConfig, aX as EvalRunsExportResult, aY as INTELLIGENCE_WIRE_VERSION, aZ as LoopSpanNode, a_ as OtelAttribute, a$ as OtelExportConfig, b0 as OtelExporter, b1 as OtelSpan, b2 as buildLoopOtelSpans, b3 as buildLoopSpanNodes, b4 as createOtelExporter, b5 as exportEvalRuns, b6 as loopEventToOtelSpan } from './delegates-CLFNAKyi.js';
|
|
9
9
|
import { R as RuntimeHooks } from './runtime-hooks-C7JwKb9E.js';
|
|
10
10
|
export { b as RuntimeDecisionEvidenceRef, c as RuntimeDecisionKind, d as RuntimeDecisionPoint, e as RuntimeHookContext, f as RuntimeHookErrorContext, a as RuntimeHookEvent, g as RuntimeHookPhase, h as RuntimeHookTarget, i as composeRuntimeHooks, j as defineRuntimeHooks, n as notifyRuntimeDecisionPoint, k as notifyRuntimeHookEvent } from './runtime-hooks-C7JwKb9E.js';
|
|
11
11
|
import '@tangle-network/sandbox';
|
|
12
12
|
import '@tangle-network/agent-eval/contract';
|
|
13
13
|
import './types-p8dWBIXL.js';
|
|
14
14
|
import './kb-gate-CuzMYGYM.js';
|
|
15
|
-
import './worktree-fanout-
|
|
15
|
+
import './worktree-fanout-DUiKPApb.js';
|
|
16
|
+
import '@tangle-network/agent-interface';
|
|
16
17
|
import './local-harness-BE_h8szs.js';
|
|
17
18
|
import 'node:child_process';
|
|
18
|
-
import './coder-
|
|
19
|
+
import './coder-2leJPOvC.js';
|
|
19
20
|
import './substrate-CUgk7F7s.js';
|
|
20
21
|
|
|
21
22
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
mcpToolsForRuntimeMcp,
|
|
3
3
|
mcpToolsForRuntimeMcpSubset
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-E4X4FNQZ.js";
|
|
5
5
|
import {
|
|
6
6
|
DEFAULT_ROUTER_BASE_URL,
|
|
7
7
|
cleanModelId,
|
|
@@ -21,17 +21,17 @@ import {
|
|
|
21
21
|
runLoopRunnerCli,
|
|
22
22
|
selfImproveLoopRunner,
|
|
23
23
|
worktreeLoopRunner
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-YWO4H64E.js";
|
|
25
25
|
import "./chunk-FNMGYYSS.js";
|
|
26
|
-
import "./chunk-
|
|
27
|
-
import "./chunk-
|
|
26
|
+
import "./chunk-RYD7ND4A.js";
|
|
27
|
+
import "./chunk-DVQGYDN5.js";
|
|
28
28
|
import "./chunk-P5OKDSLB.js";
|
|
29
29
|
import {
|
|
30
30
|
composeRuntimeHooks,
|
|
31
31
|
defineRuntimeHooks,
|
|
32
32
|
notifyRuntimeDecisionPoint,
|
|
33
33
|
notifyRuntimeHookEvent
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-MT4XM3G6.js";
|
|
35
35
|
import "./chunk-WIR4HOOJ.js";
|
|
36
36
|
import {
|
|
37
37
|
AgentEvalError,
|
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
SessionMismatchError,
|
|
45
45
|
ValidationError
|
|
46
46
|
} from "./chunk-VLF5RHEQ.js";
|
|
47
|
-
import "./chunk-
|
|
47
|
+
import "./chunk-O2UPHN7X.js";
|
|
48
48
|
import {
|
|
49
49
|
INTELLIGENCE_WIRE_VERSION,
|
|
50
50
|
buildLoopOtelSpans,
|
package/dist/intelligence.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { d as LoopTraceEvent } from './types-Crxftafi.js';
|
|
2
|
-
import { AgentProfileMcpServer } from '@tangle-network/
|
|
2
|
+
import { AgentProfileMcpServer } from '@tangle-network/agent-interface';
|
|
3
3
|
import { T as ToolSpec } from './router-client-30Y_pca8.js';
|
|
4
4
|
import '@tangle-network/agent-eval';
|
|
5
|
+
import '@tangle-network/sandbox';
|
|
5
6
|
import './runtime-hooks-C7JwKb9E.js';
|
|
6
7
|
|
|
7
8
|
/**
|