@tangle-network/agent-runtime 0.60.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.
Files changed (58) hide show
  1. package/dist/agent.d.ts +3 -2
  2. package/dist/agent.js +2 -3
  3. package/dist/agent.js.map +1 -1
  4. package/dist/analyst-loop.d.ts +1 -1
  5. package/dist/chunk-DVQGYDN5.js +59 -0
  6. package/dist/chunk-DVQGYDN5.js.map +1 -0
  7. package/dist/{chunk-ZWGEA722.js → chunk-E4X4FNQZ.js} +2 -2
  8. package/dist/{chunk-45D64J7B.js → chunk-MT4XM3G6.js} +191 -100
  9. package/dist/chunk-MT4XM3G6.js.map +1 -0
  10. package/dist/{chunk-GLMFBUKT.js → chunk-O2UPHN7X.js} +1 -1
  11. package/dist/chunk-O2UPHN7X.js.map +1 -0
  12. package/dist/{chunk-MMDIORZY.js → chunk-RTNMMHWR.js} +4 -23
  13. package/dist/chunk-RTNMMHWR.js.map +1 -0
  14. package/dist/chunk-RYD7ND4A.js +475 -0
  15. package/dist/chunk-RYD7ND4A.js.map +1 -0
  16. package/dist/{chunk-IN7WHMGZ.js → chunk-YWO4H64E.js} +47 -7
  17. package/dist/chunk-YWO4H64E.js.map +1 -0
  18. package/dist/coder-2leJPOvC.d.ts +52 -0
  19. package/dist/coordination-Curpzeyc.d.ts +381 -0
  20. package/dist/{delegates-C94qchkz.d.ts → delegates-CLFNAKyi.d.ts} +650 -21
  21. package/dist/improvement.js +1 -1
  22. package/dist/index.d.ts +10 -6
  23. package/dist/index.js +10 -10
  24. package/dist/intelligence.d.ts +3 -2
  25. package/dist/intelligence.js.map +1 -1
  26. package/dist/{loop-runner-bin-Noz7P-mS.d.ts → loop-runner-bin-B6dzNZC8.d.ts} +46 -12
  27. package/dist/loop-runner-bin.d.ts +8 -4
  28. package/dist/loop-runner-bin.js +5 -5
  29. package/dist/loops.d.ts +8 -6
  30. package/dist/loops.js +18 -7
  31. package/dist/mcp/bin.js +11 -11
  32. package/dist/mcp/bin.js.map +1 -1
  33. package/dist/mcp/index.d.ts +13 -12
  34. package/dist/mcp/index.js +8 -8
  35. package/dist/{openai-tools-d4GKwgya.d.ts → openai-tools-CA2N3-Ak.d.ts} +1 -1
  36. package/dist/profiles.d.ts +9 -10
  37. package/dist/profiles.js +5 -7
  38. package/dist/profiles.js.map +1 -1
  39. package/dist/{run-loop-CcqfR_gy.d.ts → run-loop-D3PwlG7J.d.ts} +1 -1
  40. package/dist/runtime.d.ts +31 -1046
  41. package/dist/runtime.js +18 -7
  42. package/dist/{types-CUzjRFZ3.d.ts → types-Crxftafi.d.ts} +2 -2
  43. package/dist/workflow.d.ts +2 -2
  44. package/dist/workflow.js +2 -3
  45. package/dist/workflow.js.map +1 -1
  46. package/dist/worktree-fanout-DUiKPApb.d.ts +1099 -0
  47. package/package.json +6 -2
  48. package/dist/chunk-45D64J7B.js.map +0 -1
  49. package/dist/chunk-4FEUFYOY.js +0 -282
  50. package/dist/chunk-4FEUFYOY.js.map +0 -1
  51. package/dist/chunk-7QYOXFCD.js +0 -293
  52. package/dist/chunk-7QYOXFCD.js.map +0 -1
  53. package/dist/chunk-GLMFBUKT.js.map +0 -1
  54. package/dist/chunk-IN7WHMGZ.js.map +0 -1
  55. package/dist/chunk-MMDIORZY.js.map +0 -1
  56. package/dist/coder-CybltHEm.d.ts +0 -163
  57. package/dist/coordination-Biw19JzN.d.ts +0 -944
  58. /package/dist/{chunk-ZWGEA722.js.map → chunk-E4X4FNQZ.js.map} +0 -0
@@ -1,944 +0,0 @@
1
- import { DefaultVerdict } from '@tangle-network/agent-eval';
2
- import { AgentProfile, BackendType } from '@tangle-network/sandbox';
3
- import { R as RuntimeHooks } from './runtime-hooks-C7JwKb9E.js';
4
- import { e as LoopTokenUsage } from './types-CUzjRFZ3.js';
5
- import { b as DelegateFeedbackArgs, c as DelegationFeedbackSnapshot, d as DelegationTaskQueue, e as CoderDelegate, R as ResearcherDelegate, U as UiAuditorDelegate, T as TraceContext } from './delegates-C94qchkz.js';
6
-
7
- /**
8
- * @experimental
9
- *
10
- * Recursive execution atom — the FROZEN type surface (the keystone contract).
11
- *
12
- * One self-similar `Agent` atom runs inside a budget-conserving reactive `Scope`,
13
- * orchestrated by a `Supervisor` over an event-sourced `SpawnJournal`. A leaf is an
14
- * `Agent` that never calls `scope.spawn`; a driver is an `Agent` that spawns and runs
15
- * a policy over its children's streaming results.
16
- *
17
- * Two invariants the surface exists to make enforceable:
18
- * - Budget is an atomically-reserved CONSERVED pool, so `Σk(treatment) ≡ Σk(blind)` by
19
- * construction (reserve-on-spawn, refund-unspent-on-settle, fail-closed admission).
20
- * - The journal records a content-addressed `outRef` per child result, so replay
21
- * rehydrates the exact `Settled` the driver branched on (the replay invariant below).
22
- *
23
- * The leaf RUNTIME is one OPEN `Executor` interface, not a closed `inline|sandbox|cli`
24
- * union the call site switches on. The built-ins (router/inline, sandbox, cli) are the
25
- * initial IMPLEMENTATIONS; any user agent is first-class the moment it implements the
26
- * interface. The interface IS the extension point — no per-vendor adapters live here.
27
- *
28
- * Layering: substrate types (`DefaultVerdict`) come from `@tangle-network/agent-eval`;
29
- * runtime-shaped types (everything else) live here. Pure types/interfaces only — this
30
- * module typechecks standalone and is imported by every keystone impl.
31
- */
32
-
33
- /**
34
- * One self-similar atom. A leaf is an `Agent` that never calls `scope.spawn`; a driver
35
- * is an `Agent` whose `act` spawns children and reacts to them via `scope.next()`. An
36
- * analyst is an `Agent` whose task is "read these traces → findings" — `where` it runs
37
- * is its executor, not a separate type.
38
- *
39
- * `act` MUST be replay-safe: it may read `verdict`, `spent`, and `out` (rehydrated by
40
- * `outRef`) off each `Settled`; it MUST NOT read `Date.now`, `Math.random`, or any
41
- * unordered collection. `scope.next()` delivers strictly in recorded `seq` order.
42
- */
43
- interface Agent<Task, Out> {
44
- readonly name: string;
45
- act(task: Task, scope: Scope<Out>): Promise<Out>;
46
- }
47
- /**
48
- * The leaf runtime — ONE open interface, not a closed union. `execute` returns a
49
- * `Promise<ExecutorResult>` for one-shot executors OR an `AsyncIterable<UsageEvent>` for
50
- * streaming ones; a streaming executor reports incremental normalized usage as it runs
51
- * (the budget pool reconciles against it) and exposes its terminal artifact via
52
- * `resultArtifact()`. Both shapes normalize usage to `UsageEvent` so the conserved pool
53
- * meters every runtime identically.
54
- *
55
- * Built-in implementations (in `runtime.ts`, NOT variants here): router/inline (a direct
56
- * Router/HTTP inference call, no box), sandbox (COMPOSES `runLoop` as a leaf, forwarding
57
- * PR #150's optional `lineage` passthrough — does NOT reinvent checkpoint/fork), cli
58
- * (Halo/RLM subprocess; `budgetExempt`, excluded from equal-k by construction). A user's
59
- * own agent (mastra/agno/raw HTTP/anything) is first-class by implementing this interface.
60
- */
61
- interface Executor<Out> {
62
- /** Stable runtime tag for traces + the equal-k exemption check. */
63
- readonly runtime: Runtime;
64
- /**
65
- * When true, this executor's spend is NOT metered against the conserved pool and its
66
- * iterations are excluded from the equal-k assertion (a `cli` subprocess without
67
- * token accounting). Fail-loud everywhere else: a metered executor MUST report usage.
68
- */
69
- readonly budgetExempt?: boolean;
70
- /**
71
- * One-shot → resolves a `ExecutorResult`; streaming → yields incremental `UsageEvent`s and
72
- * the terminal artifact is read from `resultArtifact()` after the stream drains.
73
- * `signal` is the spawn-scoped abort (chains the acquire lifecycle for sandbox).
74
- */
75
- execute(task: unknown, signal: AbortSignal): Promise<ExecutorResult<Out>> | AsyncIterable<UsageEvent>;
76
- /**
77
- * Optional inbox: receive an out-of-band message from the driver mid-run (the `send`/`steer_worker`
78
- * verb). A streaming executor drains pending messages between turns and folds them into the next
79
- * step (a steer / interrupt / resume). A one-shot executor that can't be steered mid-flight omits
80
- * this; `Scope.send` then returns `false` for it. Never throws — a malformed message is the
81
- * executor's to ignore.
82
- */
83
- deliver?(msg: unknown): void;
84
- /**
85
- * Tear the executor's resources down. `grace` mirrors the OTP shutdown spec
86
- * (`'brutalKill'` = immediate, a number = ms grace, `'infinity'` = await clean exit).
87
- */
88
- teardown(grace: number | 'brutalKill' | 'infinity'): Promise<{
89
- destroyed: boolean;
90
- }>;
91
- /**
92
- * The replay source (B1): the content-addressed `outRef` + the materialized output the
93
- * driver branched on, its verdict, and the conserved spend. Read once, after settle.
94
- */
95
- resultArtifact(): {
96
- outRef: string;
97
- out: Out;
98
- verdict?: DefaultVerdict;
99
- spent: Spend;
100
- };
101
- /**
102
- * A driver-executor's OWN-inference subtree total (rolled up from its nested tree's `metered`
103
- * events) — the parent scope journals it as a `metered` event for this node on settle, on BOTH
104
- * the done AND the down/crash paths, so a crashed sub-driver's partial inference still re-homes
105
- * (the pool already debited it via `observe`; the journal must match). NOT reconciled, so it never
106
- * trips the reservation clamp. Read on settle, valid after `execute` resolves OR throws. Leaf
107
- * executors omit it (returns `undefined`).
108
- */
109
- metered?(): Spend | undefined;
110
- }
111
- /** Terminal artifact of a one-shot `Executor.execute`. */
112
- interface ExecutorResult<Out> {
113
- outRef: string;
114
- out: Out;
115
- verdict?: DefaultVerdict;
116
- spent: Spend;
117
- }
118
- /**
119
- * Normalized usage event — the single channel every executor reports through, so the
120
- * conserved pool meters all runtimes identically. `tokens` carries `LoopTokenUsage`'s
121
- * `{ input, output }`; `usd` is a SEPARATE channel (never folded into tokens).
122
- */
123
- type UsageEvent = {
124
- kind: 'tokens';
125
- input: number;
126
- output: number;
127
- } | {
128
- kind: 'cost';
129
- usd: number;
130
- } | {
131
- kind: 'iteration';
132
- };
133
- /** The runtime tag of a `Executor` impl. Open by intent — `string` so a BYO executor
134
- * names its own runtime; the built-ins use these literals. */
135
- type Runtime = 'router' | 'inline' | 'sandbox' | 'cli' | (string & {});
136
- /**
137
- * `AgentProfile` does NOT carry a `harness`/backend field — `harness` lives on the
138
- * sandbox SDK's `BackendConfig`, not the portable profile. So an agent is mapped to its
139
- * executor through this MINIMAL wrapper, never by fabricating a field onto `AgentProfile`.
140
- *
141
- * Resolution (in `runtime.ts`):
142
- * - `executor` present → BYO: use it verbatim (a user's own `Executor`).
143
- * - `harness === null` → router/inline: a direct Router call, no box.
144
- * - `harness` is a `BackendType` → sandbox: compose `runLoop` against `profile` on that backend.
145
- * Fail loud on an unresolvable spec (no executor and an unknown harness).
146
- */
147
- interface AgentSpec {
148
- readonly profile: AgentProfile;
149
- /** `null` selects router/inline; a `BackendType` selects the sandboxed harness. */
150
- readonly harness: BackendType | null;
151
- /** Bring-your-own executor: when set, overrides harness-based resolution entirely. */
152
- readonly executor?: Executor<unknown>;
153
- }
154
- /**
155
- * Builds a fresh `Executor` for one spawn from the resolved spec. Per-spawn (not
156
- * shared) so each child owns its own box/abort/teardown lifecycle. A BYO factory lets a
157
- * user supply construction args without pre-instantiating.
158
- */
159
- type ExecutorFactory<Out> = (spec: AgentSpec, ctx: ExecutorContext) => Executor<Out>;
160
- /** Construction context handed to a `ExecutorFactory` — the seams a built-in needs
161
- * (sandbox client for the sandbox executor, router config for router/inline) without
162
- * the factory reaching into module globals. */
163
- interface ExecutorContext {
164
- readonly signal: AbortSignal;
165
- /** Opaque seams the registry threads through; a built-in narrows what it needs. */
166
- readonly seams: Readonly<Record<string, unknown>>;
167
- }
168
- /**
169
- * The OPEN resolver: maps an `AgentSpec` to a `ExecutorFactory`. The default
170
- * registry resolves the three built-ins AND accepts a BYO `executor`/factory; callers
171
- * register more runtimes by name. NOT a closed switch — registration is the extension
172
- * point, mirroring the open `Executor` interface.
173
- */
174
- interface ExecutorRegistry {
175
- /** Register a factory for a named runtime. Throws on a duplicate name (fail loud). */
176
- register<Out>(runtime: Runtime, factory: ExecutorFactory<Out>): void;
177
- /**
178
- * Resolve a spec to a factory. Precedence: a BYO `spec.executor` → a trivial factory
179
- * returning it; else `harness === null` → the `'router'` factory; else a registered
180
- * factory for the harness-derived runtime. Returns a typed outcome — the caller
181
- * inspects `succeeded` before `value` (no silent fallback).
182
- */
183
- resolve<Out>(spec: AgentSpec): {
184
- succeeded: true;
185
- value: ExecutorFactory<Out>;
186
- } | {
187
- succeeded: false;
188
- error: string;
189
- };
190
- }
191
- /** A budget envelope on a spawn or the root. All ceilings; the pool reserves against them. */
192
- interface Budget {
193
- readonly maxIterations: number;
194
- readonly maxTokens: number;
195
- readonly maxUsd?: number;
196
- readonly deadlineMs?: number;
197
- }
198
- /** Conserved spend, reconciled from the normalized `UsageEvent` stream. Tokens and usd
199
- * are separate channels (never folded). */
200
- interface Spend {
201
- iterations: number;
202
- tokens: LoopTokenUsage;
203
- usd: number;
204
- ms: number;
205
- }
206
- /** OTP child-spec restart class. */
207
- type Restart = 'temporary' | 'transient' | 'permanent';
208
- /** `'acquiring'` is first-class (M1): a node spends real time + reaps an orphan box
209
- * during sandbox acquire BEFORE it is `running`, so abort must be defined over it. */
210
- type NodeStatus = 'pending' | 'acquiring' | 'running' | 'done' | 'failed' | 'cancelled';
211
- /** Deterministic node id — `${parent}:s${seq}` from the cursor order, never wall-clock. */
212
- type NodeId = string;
213
- interface SpawnOpts {
214
- readonly budget: Budget;
215
- readonly label: string;
216
- readonly restart?: Restart;
217
- /** Teardown grace handed to the executor when this node is reaped. */
218
- readonly shutdown?: number | 'brutalKill' | 'infinity';
219
- }
220
- /**
221
- * A live child handle. `abort()` is defined over the ACQUIRE lifecycle: it chains into
222
- * the `acquireSandbox` signal and reaps a find-by-name orphan box, so a node aborted
223
- * mid-acquire never leaks (M1).
224
- */
225
- interface Handle<Out> {
226
- readonly id: NodeId;
227
- readonly label: string;
228
- readonly status: NodeStatus;
229
- abort(reason?: string): void;
230
- /** Phantom: binds the handle to the child's output type so `spawn<C>` returns a
231
- * `Handle<C>` distinct from a `Handle<other>`. Type-only — never present at runtime. */
232
- readonly __out?: Out;
233
- }
234
- /**
235
- * A settled child, delivered by `scope.next()`. `seq` is the monotonic cursor order
236
- * `next()` yielded this settlement (B2) — NOT wall-clock — and replay delivers strictly
237
- * in `seq` order. `outRef` rehydrates `out` from the `ResultBlobStore` on replay.
238
- */
239
- type Settled<Out> = {
240
- kind: 'done';
241
- handle: Handle<Out>;
242
- out: Out;
243
- outRef: string;
244
- verdict?: DefaultVerdict;
245
- spent: Spend;
246
- seq: number;
247
- } | {
248
- kind: 'down';
249
- handle: Handle<Out>;
250
- reason: string;
251
- /** True = infrastructure failure (excluded from merge `n` / equal-k), not a bad result. */
252
- infra: boolean;
253
- restartCount: number;
254
- seq: number;
255
- };
256
- /**
257
- * The budget-conserving reactive scope an `Agent.act` runs inside. `spawn` reserves
258
- * budget atomically from the shared pool and fails closed when the pool cannot cover it.
259
- * `next()` waits for one settlement from this scope's live set; `view` reads live state,
260
- * not the replay log.
261
- */
262
- interface Scope<Out> {
263
- /**
264
- * Spawn a child. Reserves `opts.budget` from the conserved pool atomically; refunds the
265
- * unspent remainder on settle. Returns a typed outcome — fail-closed on an exhausted
266
- * pool or an exceeded depth ceiling (the caller inspects `ok` before `handle`).
267
- */
268
- spawn<C extends Out>(agent: Agent<unknown, C>, task: unknown, opts: SpawnOpts): {
269
- ok: true;
270
- handle: Handle<C>;
271
- } | {
272
- ok: false;
273
- reason: 'budget-exhausted' | 'depth-exceeded';
274
- };
275
- /** ray.wait n=1 over this scope's in-memory live set; resolves as each child settles;
276
- * `null` when the live set is empty. */
277
- next(): Promise<Settled<Out> | null>;
278
- /**
279
- * Steer a RUNNING child out-of-band — deliver a message to its executor's inbox (the driver's
280
- * `send` verb: next-instruction, interrupt, or resume). Returns `true` if the message was
281
- * delivered to a live child whose executor accepts delivery, `false` otherwise (unknown id,
282
- * already settled, or an executor with no inbox). The executor drains its inbox between turns;
283
- * a leaf that does not implement `deliver` simply cannot be steered mid-flight. In-process this
284
- * is a direct call; the sandbox/Agent-Bus transports surface the SAME verb as an MCP tool.
285
- */
286
- send(nodeId: NodeId, msg: unknown): boolean;
287
- /** This scope's abort signal — aborted when the run is cancelled, a breaker trips, the pool
288
- * is exhausted, or a parent scope cascades. A long-running driver `act` over this scope reads
289
- * it to break promptly (the conserved pool + driver-stop are the other bounds). A nested
290
- * scope carries its own signal, chained off its driver child's abort. */
291
- readonly signal: AbortSignal;
292
- /**
293
- * Meter the driver's OWN compute against the conserved pool — its inference turns, which are
294
- * real tokens/usd but not a spawned child (no reserve/reconcile). A direct `free → committed`
295
- * debit, so equal-k counts the driver's tokens AND the in-loop budget guard (`budget.tokensLeft`)
296
- * halts a driver that thinks the pool dry. `detail` rides an `agent.turn` trace event for live
297
- * observability (turn index, tool calls, cumulative spend). It also journals a `metered` event —
298
- * the durable twin of the pool debit (as `settled` is the twin of `reconcile`) — so every
299
- * journal-based cost reader (`spentFromJournal`, `trajectoryReport`) sums driver inference
300
- * automatically. A leaf never calls this; a driver meters each chat turn and awaits it (the
301
- * metered event is cost-critical, so it lands before the join-barrier roll-up).
302
- */
303
- meter(spend: Spend, detail?: Record<string, unknown>): Promise<void>;
304
- /** The live tree — reads the in-memory nursery, not the journal. */
305
- readonly view: TreeView;
306
- /** Conserved-pool readouts (post-reservation). */
307
- readonly budget: Readonly<{
308
- tokensLeft: number;
309
- usdLeft: number;
310
- usdCapped: boolean;
311
- deadlineMs: number;
312
- reservedTokens: number;
313
- }>;
314
- }
315
- interface NodeSnapshot {
316
- readonly id: NodeId;
317
- readonly parent?: NodeId;
318
- readonly label: string;
319
- readonly status: NodeStatus;
320
- readonly runtime: Runtime;
321
- readonly budget: Budget;
322
- /** Conserved spend so far for this node. */
323
- readonly spent: Spend;
324
- /** `outRef` once the node is `done` (the replay/result pointer). */
325
- readonly outRef?: string;
326
- }
327
- /** The live tree — what `scope.view` / `RootHandle.view()` materialize for a viewer. */
328
- interface TreeView {
329
- readonly root: NodeId;
330
- readonly nodes: ReadonlyArray<NodeSnapshot>;
331
- /** Count of nodes in `running` or `acquiring` — the "what's in flow?" answer. */
332
- readonly inFlight: number;
333
- }
334
- /** Journaled spawn-tree events (B1/B2). `seq` is the cursor order; `at` is an ISO
335
- * timestamp for human inspection only (NOT a replay input). */
336
- type SpawnEvent = {
337
- kind: 'spawned';
338
- id: NodeId;
339
- parent?: NodeId;
340
- label: string;
341
- budget: Budget;
342
- runtime: Runtime;
343
- seq: number;
344
- at: string;
345
- } | {
346
- kind: 'settled';
347
- id: NodeId;
348
- status: 'done' | 'down';
349
- /** Content-addressed result pointer; rehydrates `out` from `ResultBlobStore`. */
350
- outRef?: string;
351
- verdict?: DefaultVerdict;
352
- spent: Spend;
353
- infra?: boolean;
354
- seq: number;
355
- at: string;
356
- } | {
357
- kind: 'cancelled';
358
- id: NodeId;
359
- reason: string;
360
- seq: number;
361
- at: string;
362
- } | {
363
- /** A driver's OWN inference spend, journaled separately from spawned-child work — the journal
364
- * TWIN of `BudgetPool.observe`, exactly as `settled` is the twin of `reconcile`. So every
365
- * journal-based cost reader sums it automatically — the journal is the single cost ledger.
366
- * It carries spend only and is NOT a settlement: replay + `materializeTreeView` skip it for
367
- * structure, and its `seq` lives outside the cursor-uniqueness namespace. A
368
- * driver re-homes its nested subtree's metered total up to its parent (like settled spend),
369
- * so summing any sub-tree root yields that sub-tree's true driver-inference cost. */
370
- kind: 'metered';
371
- id: NodeId;
372
- spend: Spend;
373
- seq: number;
374
- at: string;
375
- };
376
- /**
377
- * The spawn-tree event source (mirrors `ConversationJournal`'s begin/append/load shape).
378
- * `loadTree` replays the full ordered event list for resume/replay; `appendEvent` is
379
- * called only AFTER the event is observed-committed (never speculative).
380
- */
381
- interface SpawnJournal {
382
- loadTree(root: NodeId): Promise<SpawnEvent[] | undefined>;
383
- beginTree(root: NodeId, at: string): Promise<void>;
384
- appendEvent(root: NodeId, ev: SpawnEvent): Promise<void>;
385
- }
386
- /** Content-addressed result blobs (the `outRef` → artifact map) backing the replay
387
- * invariant. Split from the journal so the journal stays small (decisions) and the
388
- * payloads (evidence) live where a viewer/replayer rehydrates them. */
389
- interface ResultBlobStore {
390
- put(outRef: string, artifact: unknown): Promise<void>;
391
- get(outRef: string): Promise<unknown | undefined>;
392
- }
393
- /**
394
- * Owns the conserved pool, the spawn log, the abort cascade, the OTP intensity breaker,
395
- * and the root handle. `run` executes the root `Agent` to completion; `attach` wires a
396
- * live `RootHandle` (the Q2 substrate the chat/pi-viz client later consumes).
397
- */
398
- interface Supervisor<Task, Out> {
399
- run(root: Agent<Task, Out>, task: Task, opts: SupervisorOpts): Promise<SupervisedResult<Out>>;
400
- attach(h: RootHandle<Out>): void;
401
- }
402
- interface SupervisorOpts {
403
- /** The root conserved-pool ceiling (tokens + usd + iterations + deadline). */
404
- readonly budget: Budget;
405
- /** Trace-correlation root + the journal/blob root key. */
406
- readonly runId: NodeId;
407
- /** Event source — defaults to the in-memory journal in the impl; pass JSONL/FS for durability. */
408
- readonly journal: SpawnJournal;
409
- /** Result payload store backing `outRef` rehydration. */
410
- readonly blobs: ResultBlobStore;
411
- /** Executor resolution — the open registry mapping `AgentSpec` → `Executor`. */
412
- readonly executors: ExecutorRegistry;
413
- /** Runtime recursion-depth ceiling (paired with the conserved pool per R3). */
414
- readonly maxDepth?: number;
415
- /**
416
- * OTP intensity breaker: more than `maxRestarts` child restarts within `withinMs`
417
- * trips the supervisor to `no-winner` rather than restarting forever.
418
- */
419
- readonly maxRestarts?: number;
420
- readonly withinMs?: number;
421
- readonly now?: () => number;
422
- readonly signal?: AbortSignal;
423
- /** Lifecycle stream sink, threaded into the root `Scope` so every `spawn`/settle emits on the
424
- * same `agent.spawn`/`agent.child` stream `runLoop` feeds — one observable recursive tree. */
425
- readonly hooks?: RuntimeHooks;
426
- }
427
- /** Typed terminal result (M2) — a no-winner is NEVER coerced to a best-effort output. */
428
- type SupervisedResult<Out> = {
429
- kind: 'winner';
430
- out: Out;
431
- outRef: string;
432
- verdict?: DefaultVerdict;
433
- tree: TreeView;
434
- spentTotal: Spend;
435
- /** Where `spentTotal` went: `driverInference` = the drivers' own chat turns (metered via
436
- * `Scope.meter`); `childWork` = every spawned child's reconciled spend (the journal sum).
437
- * `driverInference + childWork === spentTotal`. Present whenever any driver metered. */
438
- spentBreakdown?: {
439
- driverInference: Spend;
440
- childWork: Spend;
441
- };
442
- } | {
443
- kind: 'no-winner';
444
- reason: 'all-children-down' | 'budget-exhausted' | 'aborted';
445
- tree: TreeView;
446
- downCount: number;
447
- };
448
- /** Live root handle — the substrate a chat/pi-viz client attaches to (Q2). `signal`
449
- * delivers an out-of-band message to the running root; `view()` materializes the tree. */
450
- interface RootHandle<Out> {
451
- view(): TreeView;
452
- signal(msg: RootSignal): void;
453
- abort(reason?: string): void;
454
- /** Phantom: binds the handle to the supervised run's output type. Type-only — never
455
- * present at runtime; lets `attach(h: RootHandle<Out>)` stay output-typed. */
456
- readonly __out?: Out;
457
- }
458
- /** Out-of-band message to a running root. Open by intent — a client extends it. */
459
- type RootSignal = {
460
- kind: 'pause';
461
- } | {
462
- kind: 'resume';
463
- } | {
464
- kind: 'cancel';
465
- reason?: string;
466
- } | {
467
- kind: 'ask';
468
- question: string;
469
- };
470
- /**
471
- * The progressive-widening gate (MCTS-PW). Decides whether a settled child is
472
- * `promising` enough to spawn another under the remaining pool. DEFAULTS TO FLAT
473
- * (`shouldWiden` always false) so a gate run never widens and the selector≠judge
474
- * firewall conflict (R2) stays dormant. When widening IS enabled, `promising` MUST be
475
- * derived from TRACE findings (`analyses`), never raw `verdict` — or the gate carries
476
- * an explicit, argued `judgeExempt: true` (the documented escape hatch, off by default).
477
- */
478
- interface WidenGate<Out> {
479
- /** Default impl returns false for every settlement (flat — never widens). */
480
- shouldWiden(settled: Settled<Out>, budget: Scope<Out>['budget']): boolean;
481
- /** When true, widening may read `verdict` directly (collides with the steer firewall —
482
- * must be explicitly argued per cell, never defaulted on). */
483
- readonly judgeExempt?: boolean;
484
- }
485
-
486
- /**
487
- * @experimental
488
- *
489
- * Git worktree helpers for the in-process delegation executor. Each
490
- * delegation runs in its own worktree so multiple parallel harness
491
- * subprocesses (claude / codex / opencode in a 3-way fanout) don't clobber
492
- * each other's edits on the shared workspace.
493
- *
494
- * Worktrees live under `<repoRoot>/.coder-variants/<runId>/`. After the
495
- * harness exits + the diff is captured, the worktree is removed.
496
- *
497
- * All operations spawn `git` via `child_process.spawn` synchronously
498
- * (via a `runGit` helper). Stays narrow on purpose: no commits, no rebases.
499
- * Diff capture stages all changes (`git add -A`) into the ephemeral worktree's
500
- * index so created (untracked) files appear in the `--cached` diff.
501
- */
502
- /** @experimental */
503
- interface WorktreeHandle {
504
- /** Absolute path to the worktree directory. */
505
- path: string;
506
- /** SHA the worktree was created at. */
507
- baseSha: string;
508
- /** Branch name created for this worktree (typically `delegate/<runId>`). */
509
- branch: string;
510
- }
511
- /** @experimental */
512
- interface CreateWorktreeOptions {
513
- /** Absolute path to the main git checkout. */
514
- repoRoot: string;
515
- /** Unique id for the worktree path + branch. Use the delegation run id. */
516
- runId: string;
517
- /** Parent directory the worktree lives under. Defaults to `.coder-variants`. */
518
- variantsDir?: string;
519
- /** Override the base ref (default `HEAD`). */
520
- baseRef?: string;
521
- /** Test seam — inject a custom git runner. */
522
- runGit?: GitRunner;
523
- }
524
- /** @experimental */
525
- interface DiffOptions {
526
- /** Worktree to diff. */
527
- worktree: WorktreeHandle;
528
- /** What to compare against. Default `worktree.baseSha`. */
529
- baseRef?: string;
530
- /** Test seam. */
531
- runGit?: GitRunner;
532
- }
533
- /** @experimental */
534
- interface DiffResult {
535
- patch: string;
536
- stats: {
537
- filesChanged: number;
538
- insertions: number;
539
- deletions: number;
540
- };
541
- }
542
- /** @experimental */
543
- interface RemoveWorktreeOptions {
544
- worktree: WorktreeHandle;
545
- repoRoot: string;
546
- /** Force removal even if dirty (default true; the loser of a fanout has uncommitted changes). */
547
- force?: boolean;
548
- /** Test seam. */
549
- runGit?: GitRunner;
550
- }
551
- /** Pluggable git runner (sync) — replaceable in tests. */
552
- type GitRunner = (args: ReadonlyArray<string>, opts: {
553
- cwd: string;
554
- }) => {
555
- stdout: string;
556
- stderr: string;
557
- exitCode: number;
558
- };
559
- /** @experimental */
560
- declare function createWorktree(options: CreateWorktreeOptions): Promise<WorktreeHandle>;
561
- /** @experimental */
562
- declare function captureWorktreeDiff(options: DiffOptions): Promise<DiffResult>;
563
- /** @experimental */
564
- declare function removeWorktree(options: RemoveWorktreeOptions): Promise<void>;
565
-
566
- /**
567
- * @experimental
568
- *
569
- * The child→parent message bus: the ONE pipe carrying every message a worker, sub-driver, or
570
- * analyst sends up to the driver — settled outputs, questions, and trace-analyst findings. It
571
- * unifies channels that were ad-hoc before (the settled-worker cursor, the ask-parent question
572
- * channel, and analyst results) into a single typed primitive with two lanes:
573
- *
574
- * - PASS-THROUGH (`subscribe`): every published event reaches subscribers immediately — the
575
- * express lane for online steering and live observation (a UI, a hook, the parent's box).
576
- * - STANDBY (`pull`): events also queue so the driver consumes them on its own cadence. The queue
577
- * is PRIORITY-ordered: a higher-`priority` event (a blocking question) is bumped ahead of
578
- * queued settles/findings so the driver sees it first; ties resolve FIFO by publish order.
579
- *
580
- * Observability is first-class (A++): every event is stamped with a monotonic `seq` and wall-clock
581
- * `at`, the full ordered `history()` is retained as an audit/replay trail, and `stats()` exposes
582
- * published/pulled counts by kind. Subscribers receive the stamped record, not a bare event.
583
- *
584
- * The interface is transport-agnostic on purpose. Same box → this in-process queue. Cross box →
585
- * the SAME publish/pull/subscribe surface backed by a durable mailbox on the parent's box (children
586
- * POST events with at-least-once retry; payloads are blob refs so the event stays small). Consumers
587
- * depend only on this interface, so distribution is a transport swap, never an architecture change.
588
- */
589
- /** Every bus event is a discriminated union member keyed by `type`. */
590
- interface BusEvent {
591
- readonly type: string;
592
- }
593
- /** A published event stamped for ordering and observability. `seq` is the monotonic publish index;
594
- * `priority` drives pull order (higher = bumped ahead); `at` is the wall-clock publish time (ms). */
595
- interface BusRecord<E extends BusEvent> {
596
- readonly seq: number;
597
- readonly at: number;
598
- readonly priority: number;
599
- readonly event: E;
600
- }
601
- interface PublishOptions {
602
- /** Higher = pulled ahead of lower-priority queued events (default 0). A blocking question sets
603
- * this so it bumps to the front of the driver's inbox. */
604
- readonly priority?: number;
605
- /** Whether the event enters the pull queue (default true). Set `false` for record-only events —
606
- * the parent→child down-leg (steer / answer / resume): they belong in `history()` and reach
607
- * `subscribe` observers, but the parent must never `pull` its own outbound message back. */
608
- readonly queue?: boolean;
609
- }
610
- interface BusStats {
611
- readonly published: number;
612
- readonly pulled: number;
613
- /** Count published per event `type`. */
614
- readonly byKind: Readonly<Record<string, number>>;
615
- }
616
- interface EventBus<E extends BusEvent> {
617
- /** Stamp + queue the event, then deliver the stamped record to every subscriber in order.
618
- * Returns the stamped record. */
619
- publish(event: E, opts?: PublishOptions): Promise<BusRecord<E>>;
620
- /** Remove and return the highest-priority QUEUED event whose type is in `kinds` (any if omitted),
621
- * ties broken FIFO by `seq`; `undefined` when nothing matches. */
622
- pull(kinds?: ReadonlyArray<E['type']>): E | undefined;
623
- /** Register a pass-through handler; it receives the stamped record of every event published after
624
- * registration. Returns an unsubscribe fn. */
625
- subscribe(handler: (record: BusRecord<E>) => void | Promise<void>): () => void;
626
- /** Count of queued, not-yet-pulled events (filtered by `kinds` when given). */
627
- pending(kinds?: ReadonlyArray<E['type']>): number;
628
- /** The full ordered log of every event ever published (the audit/replay trail). */
629
- history(): ReadonlyArray<BusRecord<E>>;
630
- /** Throughput counters for observability dashboards. */
631
- stats(): BusStats;
632
- }
633
- declare function createEventBus<E extends BusEvent>(now?: () => number): EventBus<E>;
634
-
635
- /**
636
- * @experimental
637
- *
638
- * Feedback persistence surface for the MCP layer.
639
- *
640
- * The substrate cannot import `@tangle-network/agent-knowledge` (it would
641
- * induce a dependency cycle), so the store is an abstract interface. The
642
- * default implementation is in-memory; consumers wire their own adapter
643
- * (a real KbStore-backed sink, an HTTP relay to gtm-agent's knowledge
644
- * service, etc.) via `createMcpServer({ feedbackStore })`.
645
- *
646
- * Feedback events are append-only: every rating is a new event with a
647
- * fresh id, even when the same delegation is rated multiple times. The
648
- * caller decides how to roll up scores downstream.
649
- */
650
-
651
- /** @experimental */
652
- interface FeedbackEvent {
653
- id: string;
654
- refersTo: DelegateFeedbackArgs['refersTo'];
655
- rating: DelegateFeedbackArgs['rating'];
656
- by: DelegateFeedbackArgs['by'];
657
- capturedAt: string;
658
- namespace?: string;
659
- }
660
- /** @experimental */
661
- interface FeedbackStore {
662
- /** Append a new event. Never dedupes — every rating is its own event. */
663
- put(event: FeedbackEvent): Promise<void>;
664
- /**
665
- * List events filtered by `namespace`. When `namespace` is omitted, list
666
- * across all namespaces. Returns events in insertion order.
667
- */
668
- list(filter?: {
669
- namespace?: string;
670
- refersToRef?: string;
671
- }): Promise<FeedbackEvent[]>;
672
- }
673
- /** @experimental */
674
- declare class InMemoryFeedbackStore implements FeedbackStore {
675
- private readonly events;
676
- put(event: FeedbackEvent): Promise<void>;
677
- list(filter?: {
678
- namespace?: string;
679
- refersToRef?: string;
680
- }): Promise<FeedbackEvent[]>;
681
- }
682
- /**
683
- * Project a `FeedbackEvent` down to the snapshot shape carried on
684
- * `delegation_history` entries.
685
- *
686
- * @experimental
687
- */
688
- declare function eventToSnapshot(event: FeedbackEvent): DelegationFeedbackSnapshot;
689
-
690
- /**
691
- * @experimental
692
- *
693
- * Stdio JSON-RPC MCP server exposing the 5 delegation tools to sandbox
694
- * coding-harness agents (claude-code, codex, opencode, ...).
695
- *
696
- * The server is transport-bound but topology-free: tool execution is
697
- * delegated to handler functions composed from a queue, a feedback
698
- * store, and per-profile run delegates. Consumers wire those at
699
- * construction time. The `agent-runtime-mcp` bin spins up a default
700
- * configuration for the common case (real sandbox client + coder).
701
- *
702
- * Wire protocol: line-delimited JSON-RPC 2.0 over stdio. Each line is
703
- * one request; each response is one line. `tools/list` and `tools/call`
704
- * mirror the MCP 2024-11-05 spec; we do not pull in
705
- * `@modelcontextprotocol/sdk` to keep the dependency footprint zero.
706
- */
707
-
708
- /** @experimental */
709
- interface McpServerOptions {
710
- /** Required to enable delegate_code. */
711
- coderDelegate?: CoderDelegate;
712
- /**
713
- * Required to enable delegate_research. The substrate cannot ship a
714
- * default — wire one that closes over your `runLoop` + a
715
- * researcher profile (typically `@tangle-network/agent-knowledge`'s
716
- * `researcherProfile` / `multiHarnessResearcherFanout`).
717
- */
718
- researcherDelegate?: ResearcherDelegate;
719
- /**
720
- * Required to enable delegate_ui_audit. Wire one that closes over your
721
- * `runLoop` + `uiAuditorProfile` + a `SandboxClient` (the
722
- * canonical in-process choice is `createInProcessUiAuditClient` from
723
- * `@tangle-network/agent-runtime/profiles`) + your vision judge.
724
- */
725
- uiAuditorDelegate?: UiAuditorDelegate;
726
- /** Override the default in-memory feedback store. */
727
- feedbackStore?: FeedbackStore;
728
- /** Override the default in-memory task queue. */
729
- queue?: DelegationTaskQueue;
730
- /**
731
- * Record deterministic detached-session resume keys on single-variant
732
- * coder/researcher submissions so a durable queue can resume them after a
733
- * restart. Enable only when the wired delegates dispatch via sandbox
734
- * sessions (`driveTurn`) AND `queue` persists records — the keys are inert
735
- * otherwise. The bin turns this on alongside the durable store for
736
- * session-backed (sibling/fleet) placements.
737
- */
738
- detachedDispatch?: boolean;
739
- /**
740
- * Extra tools to serve alongside the delegation tools, for example
741
- * `createCoordinationTools(...).tools`. Registered after the built-ins; a
742
- * duplicate name throws so delegation tools cannot be shadowed silently.
743
- */
744
- extraTools?: McpToolDescriptor[];
745
- /**
746
- * Inherited trace identity (`readTraceContextFromEnv()`) stamped on every
747
- * record the DEFAULT queue creates. Ignored when `queue` is supplied —
748
- * pass `traceContext` to that queue's constructor instead.
749
- */
750
- traceContext?: TraceContext;
751
- /** Server display name surfaced via `initialize`. Default `'agent-runtime-mcp'`. */
752
- serverName?: string;
753
- /** Server version surfaced via `initialize`. Default = the package version baked at build time. */
754
- serverVersion?: string;
755
- }
756
- /** @experimental */
757
- interface McpToolDescriptor {
758
- name: string;
759
- description: string;
760
- inputSchema: Record<string, unknown>;
761
- handler: (raw: unknown) => Promise<unknown>;
762
- }
763
- /** @experimental */
764
- interface McpServer {
765
- /** Tools currently registered (depend on which delegates were wired). */
766
- readonly tools: ReadonlyMap<string, McpToolDescriptor>;
767
- /** The underlying queue — exposed so tests can introspect it. */
768
- readonly queue: DelegationTaskQueue;
769
- /** The feedback store — exposed for the same reason. */
770
- readonly feedbackStore: FeedbackStore;
771
- /** Handle a single parsed JSON-RPC message. Returns the response object (or `null` for notifications). */
772
- handle(message: JsonRpcMessage): Promise<JsonRpcResponse | null>;
773
- /** Drive the server on a stdio-shaped transport until `stop()` is called. */
774
- serve(transport?: McpTransport): Promise<void>;
775
- /** Stop a `serve` call. Subsequent requests are rejected. */
776
- stop(): void;
777
- }
778
- /** @experimental */
779
- interface McpTransport {
780
- input: NodeJS.ReadableStream;
781
- output: NodeJS.WritableStream;
782
- }
783
- /** @experimental */
784
- interface JsonRpcMessage {
785
- jsonrpc: '2.0';
786
- id?: number | string | null;
787
- method: string;
788
- params?: unknown;
789
- }
790
- /** @experimental */
791
- interface JsonRpcResponse {
792
- jsonrpc: '2.0';
793
- id: number | string | null;
794
- result?: unknown;
795
- error?: {
796
- code: number;
797
- message: string;
798
- data?: unknown;
799
- };
800
- }
801
- /** @experimental */
802
- declare function createMcpServer(options?: McpServerOptions): McpServer;
803
- /**
804
- * In-process pair of `Readable` + `Writable` streams suitable for driving
805
- * `server.serve(...)` from a test. Returns the agent-side stream (the
806
- * client writes to it) and the server-side stream (the test reads from it).
807
- *
808
- * @experimental
809
- */
810
- declare function createInProcessTransport(): {
811
- transport: McpTransport;
812
- clientWrite(line: string): void;
813
- clientClose(): void;
814
- readServer(): Promise<JsonRpcResponse[]>;
815
- };
816
-
817
- /**
818
- * @experimental
819
- *
820
- * MCP binding for a live `Scope`. A sandbox driver gets the same small verbs
821
- * the in-process driver has: spawn, observe, await, steer, ask/answer, analyze,
822
- * and stop. Settled outputs remain Scope artifacts; product code can project
823
- * them into any UI/report envelope it needs.
824
- */
825
-
826
- /** A worker the driver has drained via `await_event`. */
827
- interface SettledWorker {
828
- readonly id: string;
829
- readonly status: 'done' | 'down';
830
- readonly score?: number;
831
- readonly valid?: boolean;
832
- readonly outRef?: string;
833
- readonly reason?: string;
834
- }
835
- type QuestionLevel = 'worker' | 'driver' | 'loop';
836
- type QuestionUrgency = 'continue-without' | 'blocks-step' | 'blocks-run';
837
- interface QuestionOption {
838
- readonly label: string;
839
- readonly tradeoff: string;
840
- }
841
- interface Question {
842
- readonly id: string;
843
- readonly from: string;
844
- readonly level: QuestionLevel;
845
- readonly question: string;
846
- readonly reason: string;
847
- readonly urgency: QuestionUrgency;
848
- readonly options?: ReadonlyArray<QuestionOption>;
849
- }
850
- type QuestionDecision = {
851
- readonly kind: 'answer';
852
- readonly answer: string;
853
- readonly by: string;
854
- } | {
855
- readonly kind: 'defer';
856
- readonly reason: string;
857
- } | {
858
- readonly kind: 'escalate';
859
- readonly to: 'parent' | 'user' | string;
860
- readonly reason: string;
861
- };
862
- interface QuestionRecord extends Question {
863
- readonly status: 'open' | 'answered' | 'deferred' | 'escalated';
864
- readonly decision?: QuestionDecision;
865
- readonly openedAt: number;
866
- }
867
- type QuestionPolicy = 'auto' | 'mustDecide' | 'bubble' | 'failClosed';
868
- interface AnalystRegistry {
869
- readonly kinds: ReadonlyArray<{
870
- id: string;
871
- description: string;
872
- area: string;
873
- }>;
874
- readonly run: (kindId: string, trace: unknown) => Promise<unknown>;
875
- }
876
- /** A trace-analyst result re-entered as a message on the bus (the `finding` event kind). */
877
- interface AnalystFindingEvent {
878
- readonly fromWorker: string;
879
- readonly analyst: string;
880
- readonly findings: unknown;
881
- }
882
- /** A parent→child message (the down-leg): recorded for observability, delivered via the child inbox,
883
- * never pulled back by the parent. `delivered` mirrors whether the live child accepted it. */
884
- interface DownMessageEvent {
885
- readonly toWorker: string;
886
- readonly instruction: string;
887
- readonly delivered: boolean;
888
- }
889
- /** Every message on the one typed pipe. UP (child→parent): question / settled / finding — queued for
890
- * the driver to `pull`. DOWN (parent→child): steer / answer — record-only (history + subscribers),
891
- * routed to the child inbox. New kinds are additive. */
892
- type CoordinationEvent = {
893
- readonly type: 'question';
894
- readonly question: QuestionRecord;
895
- } | {
896
- readonly type: 'settled';
897
- readonly worker: SettledWorker;
898
- } | {
899
- readonly type: 'finding';
900
- readonly finding: AnalystFindingEvent;
901
- } | {
902
- readonly type: 'steer';
903
- readonly down: DownMessageEvent;
904
- } | {
905
- readonly type: 'answer';
906
- readonly down: DownMessageEvent;
907
- readonly questionId: string;
908
- };
909
- type MakeWorkerAgent = (profile: unknown) => Agent<unknown, unknown>;
910
- interface CoordinationToolsOptions {
911
- readonly scope: Scope<unknown>;
912
- readonly blobs: ResultBlobStore;
913
- readonly makeWorkerAgent: MakeWorkerAgent;
914
- readonly perWorker: Budget;
915
- readonly analysts?: AnalystRegistry;
916
- readonly onEvent?: (event: CoordinationEvent) => void | Promise<void>;
917
- readonly questionPolicy?: QuestionPolicy;
918
- /** Analyst kind ids to run AUTOMATICALLY when a worker settles `done` (the analyst-on-settle
919
- * hook). Each result is published as a `finding` event on the bus — pass-through to subscribers
920
- * and queued for the driver to pull via `await_event`. Omit/empty = no auto-analysis (default;
921
- * the driver can still run lenses on demand via `run_analyst`). Requires `analysts`. */
922
- readonly analyzeOnSettle?: ReadonlyArray<string>;
923
- }
924
- interface CoordinationTools {
925
- readonly tools: McpToolDescriptor[];
926
- isStopped(): boolean;
927
- stopReason(): string | undefined;
928
- settled(): ReadonlyArray<SettledWorker>;
929
- questions(): ReadonlyArray<QuestionRecord>;
930
- /** The full ordered log of every bus event — UP (settled / question / finding) and DOWN
931
- * (steer / answer) — the observability audit + replay trail. Each record carries seq,
932
- * timestamp, and priority. */
933
- history(): ReadonlyArray<BusRecord<CoordinationEvent>>;
934
- /** Bus throughput counters (published / pulled / by-kind) for live dashboards. */
935
- stats(): BusStats;
936
- /** Raise a `finding` on the bus from outside the settle hook — the seam an ONLINE detector
937
- * (mid-run, on the worker pipe) uses to tell the driver "this worker is looping/erroring" the
938
- * moment it happens, instead of only at settle. Queued for `await_event` + pass-through. */
939
- raiseFinding(finding: AnalystFindingEvent): Promise<void>;
940
- }
941
- /** Build the driver's MCP tools over a live scope. */
942
- declare function createCoordinationTools(opts: CoordinationToolsOptions): CoordinationTools;
943
-
944
- export { type EventBus as $, type AnalystRegistry as A, type Budget as B, type CoordinationEvent as C, type DiffOptions as D, type ExecutorRegistry as E, type FeedbackStore as F, type GitRunner as G, type RootHandle as H, InMemoryFeedbackStore as I, type JsonRpcMessage as J, type SupervisedResult as K, type Spend as L, type MakeWorkerAgent as M, type NodeId as N, type Scope as O, type ExecutorFactory as P, type Question as Q, type RemoveWorktreeOptions as R, type SettledWorker as S, type TreeView as T, type Executor as U, type UsageEvent as V, type WorktreeHandle as W, type Supervisor as X, type BusEvent as Y, type BusRecord as Z, type BusStats as _, type CoordinationTools as a, type ExecutorContext as a0, type ExecutorResult as a1, type Handle as a2, type NodeSnapshot as a3, type NodeStatus as a4, type PublishOptions as a5, type Restart as a6, type RootSignal as a7, type Runtime as a8, type SpawnOpts as a9, type SupervisorOpts as aa, type WidenGate as ab, createEventBus as ac, type CoordinationToolsOptions as b, type CreateWorktreeOptions as c, type DiffResult as d, type FeedbackEvent as e, type JsonRpcResponse as f, type McpServer as g, type McpServerOptions as h, type McpToolDescriptor as i, type McpTransport as j, type QuestionDecision as k, type QuestionPolicy as l, type QuestionRecord as m, captureWorktreeDiff as n, createCoordinationTools as o, createInProcessTransport as p, createMcpServer as q, createWorktree as r, eventToSnapshot as s, removeWorktree as t, type ResultBlobStore as u, type SpawnJournal as v, type SpawnEvent as w, type Settled as x, type AgentSpec as y, type Agent as z };