@tangle-network/agent-runtime 0.56.0 → 0.57.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 (45) hide show
  1. package/dist/agent.d.ts +1 -1
  2. package/dist/agent.js +2 -2
  3. package/dist/analyst-loop.d.ts +1 -1
  4. package/dist/{chunk-5ZOYQWEB.js → chunk-6BOIKGSU.js} +2 -2
  5. package/dist/{chunk-3BI6PSP3.js → chunk-7QYOXFCD.js} +1 -1
  6. package/dist/chunk-7QYOXFCD.js.map +1 -0
  7. package/dist/{chunk-A265AJ2Q.js → chunk-NJST5D2G.js} +2 -2
  8. package/dist/{chunk-ZADWPBOE.js → chunk-RLDUT4JL.js} +759 -192
  9. package/dist/chunk-RLDUT4JL.js.map +1 -0
  10. package/dist/{chunk-UIQTCS6H.js → chunk-TVBXDW7C.js} +59 -79
  11. package/dist/chunk-TVBXDW7C.js.map +1 -0
  12. package/dist/{chunk-GFDCNQRO.js → chunk-WFEQCRQP.js} +5 -4
  13. package/dist/chunk-WFEQCRQP.js.map +1 -0
  14. package/dist/{coder-CdsknxGF.d.ts → coder-CybltHEm.d.ts} +4 -7
  15. package/dist/{coordination-CfMk-RpQ.d.ts → coordination-BydGBQCZ.d.ts} +164 -4
  16. package/dist/{delegates-htF7l_H6.d.ts → delegates-C94qchkz.d.ts} +12 -8
  17. package/dist/index.d.ts +6 -6
  18. package/dist/index.js +5 -5
  19. package/dist/intelligence.d.ts +1 -1
  20. package/dist/{loop-runner-bin-C4YyFGdT.d.ts → loop-runner-bin-Noz7P-mS.d.ts} +3 -3
  21. package/dist/loop-runner-bin.d.ts +4 -4
  22. package/dist/loop-runner-bin.js +4 -4
  23. package/dist/loops.d.ts +7 -6
  24. package/dist/loops.js +14 -2
  25. package/dist/mcp/bin.js +4 -4
  26. package/dist/mcp/index.d.ts +20 -82
  27. package/dist/mcp/index.js +5 -5
  28. package/dist/{openai-tools-CoeLQ7Uo.d.ts → openai-tools-d4GKwgya.d.ts} +1 -1
  29. package/dist/profiles.d.ts +2 -2
  30. package/dist/profiles.js +1 -1
  31. package/dist/{run-loop-DluzfJ2h.d.ts → run-loop-CcqfR_gy.d.ts} +1 -1
  32. package/dist/runtime.d.ts +255 -67
  33. package/dist/runtime.js +14 -2
  34. package/dist/{types-C8rNlxfV.d.ts → types-CUzjRFZ3.d.ts} +1 -1
  35. package/dist/workflow.d.ts +2 -2
  36. package/dist/workflow.js +2 -2
  37. package/package.json +2 -2
  38. package/skills/loop-writer/SKILL.md +1 -1
  39. package/skills/supervise/SKILL.md +1 -1
  40. package/dist/chunk-3BI6PSP3.js.map +0 -1
  41. package/dist/chunk-GFDCNQRO.js.map +0 -1
  42. package/dist/chunk-UIQTCS6H.js.map +0 -1
  43. package/dist/chunk-ZADWPBOE.js.map +0 -1
  44. /package/dist/{chunk-5ZOYQWEB.js.map → chunk-6BOIKGSU.js.map} +0 -0
  45. /package/dist/{chunk-A265AJ2Q.js.map → chunk-NJST5D2G.js.map} +0 -0
package/dist/runtime.d.ts CHANGED
@@ -1,21 +1,22 @@
1
1
  import { AgentProfile, BackendType, CreateSandboxOptions, SandboxInstance, SandboxEvent } from '@tangle-network/sandbox';
2
2
  export { AgentProfile, CreateSandboxOptions, SandboxEvent, SandboxInstance } from '@tangle-network/sandbox';
3
- import { u as ResultBlobStore, v as SpawnJournal, N as NodeId, w as SpawnEvent, T as TreeView, x as Settled, y as AgentSpec, E as ExecutorRegistry, B as Budget, z as Agent, H as RootHandle, K as SupervisedResult, L as Spend, O as Scope, P as ExecutorFactory, U as Executor, V as UsageEvent, G as GitRunner, M as MakeWorkerAgent, X as Supervisor } from './coordination-CfMk-RpQ.js';
4
- export { Y as ExecutorContext, Z as ExecutorResult, _ as Handle, $ as NodeSnapshot, a0 as NodeStatus, a1 as Restart, a2 as RootSignal, a3 as Runtime, a4 as SpawnOpts, a5 as SupervisorOpts, a6 as WidenGate } from './coordination-CfMk-RpQ.js';
3
+ import { u as ResultBlobStore, v as SpawnJournal, N as NodeId, w as SpawnEvent, T as TreeView, x as Settled, y as AgentSpec, E as ExecutorRegistry, B as Budget, z as Agent, H as RootHandle, K as SupervisedResult, L as Spend, O as Scope, P as ExecutorFactory, U as Executor, V as UsageEvent, G as GitRunner, M as MakeWorkerAgent, a as CoordinationTools, A as AnalystRegistry, C as CoordinationEvent, l as QuestionPolicy, X as Supervisor } from './coordination-BydGBQCZ.js';
4
+ export { Y as BusEvent, Z as BusRecord, _ as BusStats, $ as EventBus, a0 as ExecutorContext, a1 as ExecutorResult, a2 as Handle, a3 as NodeSnapshot, a4 as NodeStatus, a5 as PublishOptions, a6 as Restart, a7 as RootSignal, a8 as Runtime, a9 as SpawnOpts, aa as SupervisorOpts, ab as WidenGate, ac as createEventBus } from './coordination-BydGBQCZ.js';
5
5
  import { R as RuntimeHooks } from './runtime-hooks-C7JwKb9E.js';
6
- import { ChatClient, AnalystFinding, DefaultVerdict, AgentProfile as AgentProfile$1, AnalystRunInputs } from '@tangle-network/agent-eval';
6
+ import { ChatClient, AnalystFinding, DefaultVerdict, AgentProfile as AgentProfile$1, AnalystRunInputs, DetectorSignal, StreamingDetector, buildTrajectory } from '@tangle-network/agent-eval';
7
7
  export { DefaultVerdict } from '@tangle-network/agent-eval';
8
- import { I as Iteration, S as SandboxClient, b as LoopResult, d as LoopTokenUsage, R as RuntimeStreamEvent, A as AgentRunSpec, E as ExecCtx } from './types-C8rNlxfV.js';
9
- export { D as Driver, F as LoopDecisionPayload, G as LoopEndedPayload, H as LoopIterationDispatchPayload, J as LoopIterationEndedPayload, M as LoopIterationStartedPayload, a as LoopLineageOptions, N as LoopPlanDescription, P as LoopPlanPayload, f as LoopSandboxPlacement, Q as LoopStartedPayload, T as LoopTeardownFailedPayload, g as LoopTraceEmitter, e as LoopTraceEvent, L as LoopWinner, O as OutputAdapter, U as ValidationCtx, V as Validator } from './types-C8rNlxfV.js';
8
+ import { I as Iteration, S as SandboxClient, b as LoopResult, e as LoopTokenUsage, R as RuntimeStreamEvent, A as AgentRunSpec, E as ExecCtx } from './types-CUzjRFZ3.js';
9
+ export { D as Driver, F as LoopDecisionPayload, G as LoopEndedPayload, H as LoopIterationDispatchPayload, J as LoopIterationEndedPayload, M as LoopIterationStartedPayload, a as LoopLineageOptions, N as LoopPlanDescription, P as LoopPlanPayload, f as LoopSandboxPlacement, Q as LoopStartedPayload, T as LoopTeardownFailedPayload, g as LoopTraceEmitter, d as LoopTraceEvent, L as LoopWinner, O as OutputAdapter, U as ValidationCtx, V as Validator } from './types-CUzjRFZ3.js';
10
10
  import { Scenario, ProfileDispatchFn } from '@tangle-network/agent-eval/campaign';
11
- import { R as RunLoopOptions } from './run-loop-DluzfJ2h.js';
12
- export { c as createSandboxForSpec, d as defaultSelectWinner, r as runLoop } from './run-loop-DluzfJ2h.js';
11
+ import { R as RunLoopOptions } from './run-loop-CcqfR_gy.js';
12
+ export { c as createSandboxForSpec, d as defaultSelectWinner, r as runLoop } from './run-loop-CcqfR_gy.js';
13
13
  import { b as AnalystRegistryLike } from './types-p8dWBIXL.js';
14
14
  import { R as RouterConfig, T as ToolSpec } from './router-client-30Y_pca8.js';
15
15
  export { a as RouterChatResult, b as RouterChatToolsResult, c as RouterToolCall, d as RouterToolLoopResult, r as routerChatWithTools, e as routerChatWithUsage, f as routerToolLoop } from './router-client-30Y_pca8.js';
16
- import { a as CoderCheckConstraints } from './coder-CdsknxGF.js';
16
+ import { a as CoderCheckConstraints } from './coder-CybltHEm.js';
17
17
  import { L as LocalHarness, r as runLocalHarness } from './local-harness-BE_h8szs.js';
18
- import './delegates-htF7l_H6.js';
18
+ import { stuckLoopView, toolWasteView } from '@tangle-network/agent-eval/pipelines';
19
+ import './delegates-C94qchkz.js';
19
20
  import './substrate-CUgk7F7s.js';
20
21
  import 'node:child_process';
21
22
 
@@ -115,7 +116,8 @@ declare class FileSpawnJournal implements SpawnJournal {
115
116
  declare function replaySpawnTree(journal: SpawnJournal, blobs: ResultBlobStore, root: NodeId): Promise<Settled<unknown>[]>;
116
117
  /**
117
118
  * Materialize the live tree (`TreeView`) from a journaled event list for resume. Folds
118
- * `spawned`/`settled`/`cancelled` into a per-node snapshot in `seq` order so the
119
+ * `spawned`/`settled`/`cancelled` into a per-node snapshot in `seq` order, then adds each
120
+ * `metered` event's driver-inference spend onto its node in a separate additive pass — so the
119
121
  * resumed view matches what `scope.view` showed at the recorded cursor position.
120
122
  */
121
123
  declare function materializeTreeView(events: SpawnEvent[]): TreeView;
@@ -2928,10 +2930,13 @@ interface ReservationTicket {
2928
2930
  }
2929
2931
  /** Post-reservation pool readout — the shape `Scope.budget` exposes. `tokensLeft`,
2930
2932
  * `usdLeft`, and `reservedTokens` reflect committed-but-unsettled reservations;
2931
- * `deadlineMs` is the ABSOLUTE wall-clock deadline (0 when the root set none). */
2933
+ * `deadlineMs` is the ABSOLUTE wall-clock deadline (0 when the root set none).
2934
+ * `usdCapped` distinguishes a real `usdLeft <= 0` exhaustion from an uncapped pool (which always
2935
+ * reads `usdLeft: 0`) — the in-loop guard needs it to bound a usd-capped driver. */
2932
2936
  type BudgetReadout = Readonly<{
2933
2937
  tokensLeft: number;
2934
2938
  usdLeft: number;
2939
+ usdCapped: boolean;
2935
2940
  deadlineMs: number;
2936
2941
  reservedTokens: number;
2937
2942
  }>;
@@ -2960,6 +2965,17 @@ interface BudgetPool {
2960
2965
  spendFrom(events: AsyncIterable<UsageEvent> | UsageEvent[]): Promise<Spend>;
2961
2966
  /** The current readout, reflecting all outstanding reservations. */
2962
2967
  readout(): BudgetReadout;
2968
+ /**
2969
+ * Record OBSERVED spend that did NOT go through reserve/reconcile — the driver's OWN inference
2970
+ * (its chat turns), which is real compute but not a spawned child. A direct `free → committed`
2971
+ * debit, so `total ≡ free + reserved + committed` is preserved: equal-k counts the driver's
2972
+ * tokens and the in-loop budget guard (`readout().tokensLeft`) sees them. `free` may go negative
2973
+ * when a run overspends — that is honest (the readout then signals exhaustion). It never throws:
2974
+ * the spend already happened, so accounting records reality; the in-loop guard prevents MORE.
2975
+ * The DURABLE record is the journal's `metered` event (written by `Scope.meter`); this debit
2976
+ * only makes the live `readout()` reflect driver inference for the in-loop guard.
2977
+ */
2978
+ observe(spend: Spend): void;
2963
2979
  /** Fail loud if any reservation is still open — the conserved-pool leak detector. Called at the
2964
2980
  * supervisor's join barrier: once every child has settled, no ticket may remain (a leaked
2965
2981
  * reservation would silently break `total ≡ free + reserved + committed`). */
@@ -2980,46 +2996,37 @@ declare function createBudgetPool(root: Budget, now?: () => number): BudgetPool;
2980
2996
  /**
2981
2997
  * @experimental
2982
2998
  *
2983
- * The worktree-CLI leaf executor — a supervisor-authored `AgentProfile` driving a local
2984
- * coding-harness CLI (claude / codex / opencode) on its OWN git worktree, surfaced as the
2985
- * open `Executor<Out>` port (`./types`). It is a LEAF executor, not a `DelegationExecutor`:
2986
- * it plugs straight into the `Scope`/`Supervisor` recursion and `gateOnDeliverable`, so it
2987
- * IS the canonical recursive path (no `runLoop`/virtual-SandboxInstance shim in between).
2988
- *
2989
- * The §1.5 payload reaches the harness: `harnessInvocation` (mcp/local-harness) maps the
2990
- * authored `profile.prompt.systemPrompt` into the prompt channel and `profile.model.default`
2991
- * into the harness's `-m` selector — the prompt-only `buildArgs(taskPrompt)` path dropped
2992
- * both. The subprocess runs through `runLocalHarness` (the stdin-CLOSED spawn shape — the
2993
- * #308 fix that keeps a non-TTY `opencode run` from blocking on input forever).
2999
+ * The ONE worktree-harness execution core. The physical act run a supervisor-authored
3000
+ * `AgentProfile` on a local coding-harness CLI (claude / codex / opencode) against a fresh git
3001
+ * worktree off `repoRoot`, capture the diff, derive the test/typecheck PASS signals, then clean
3002
+ * up lives here ONCE. Two executors adapt it to two ports without re-implementing it:
3003
+ * - `createWorktreeCliExecutor` the `Scope`/`Supervisor` leaf `Executor`.
3004
+ * - `createInProcessExecutor` — the `runLoop` `SandboxClient` / coder-delegate path.
2994
3005
  *
2995
- * Lifecycle per spawn (fresh executor one box/abort/teardown each):
2996
- * 1. `createWorktree` `git worktree add` off `repoRoot` at `baseRef`.
2997
- * 2. `runLocalHarness` spawn the harness, fed the profile-aware invocation.
2998
- * 3. `captureWorktreeDiff` — `git diff` the worktree → the patch artifact.
2999
- * 4. `removeWorktree` — on `teardown` (always; the loser of a fanout is dirty).
3006
+ * §1.5 by construction: the authored `profile.prompt.systemPrompt` + `profile.model.default`
3007
+ * reach the harness through `harnessInvocation` HERE, so neither port can drop them — the exact
3008
+ * bug that existed while the in-process path called `runLocalHarness` with only the task prompt.
3000
3009
  *
3001
- * Reuse, not duplication: `createWorktree` / `captureWorktreeDiff` / `removeWorktree` come
3002
- * straight from `mcp/worktree`; `runLocalHarness` + `LocalHarness` from `mcp/local-harness`.
3003
- * Nothing here reimplements a worktree, a spawn, or a diff.
3004
- *
3005
- * Token accounting: a harness CLI does not surface usage, so this executor is
3006
- * `budgetExempt: true` — its spend is NOT metered against the conserved pool and its
3007
- * iterations are EXCLUDED from the equal-k arms by construction (mirrors `cliExecutor`).
3010
+ * Lifecycle: `createWorktree` `harnessInvocation` + `runLocalHarness` → `captureWorktreeDiff`
3011
+ * (BEFORE checks, so the patch is the harness's output, not polluted by files a test run writes)
3012
+ * the configured test/typecheck commands in the live worktree return the result + a `cleanup`
3013
+ * the caller invokes at its own teardown point. A throw cleans up before propagating, so a failed
3014
+ * run never leaks a worktree.
3008
3015
  */
3009
3016
 
3010
3017
  /** Outcome of one verification command run in the worktree (test or typecheck). */
3011
3018
  interface WorktreeCommandResult {
3012
3019
  /** The shell command line that was run. */
3013
3020
  command: string;
3014
- /** Did the command exit 0? The PASS signal the coder deliverable gates on. */
3021
+ /** Did the command exit 0? The PASS signal a deliverable gate / coder output reads. */
3015
3022
  passed: boolean;
3016
3023
  /** OS exit code, or `null` when killed before exit. */
3017
3024
  exitCode: number | null;
3018
3025
  /** Combined stdout+stderr (capped) — surfaced in traces for diagnosis. */
3019
3026
  output: string;
3020
3027
  }
3021
- /** Terminal artifact of one worktree-CLI run: the captured diff + the harness's run record. */
3022
- interface WorktreePatchArtifact {
3028
+ /** The canonical result of one worktree-harness run, projected by each port to its own shape. */
3029
+ interface WorktreeHarnessResult {
3023
3030
  /** The branch the worktree was cut on (`delegate/<runId>`). */
3024
3031
  branch: string;
3025
3032
  /** `git diff` of the worktree against its base — the unified patch the harness produced. */
@@ -3030,7 +3037,7 @@ interface WorktreePatchArtifact {
3030
3037
  insertions: number;
3031
3038
  deletions: number;
3032
3039
  };
3033
- /** The harness subprocess outcome (exit code, captured streams, timing). */
3040
+ /** The harness subprocess outcome. */
3034
3041
  harness: {
3035
3042
  name: LocalHarness;
3036
3043
  exitCode: number | null;
@@ -3040,17 +3047,46 @@ interface WorktreePatchArtifact {
3040
3047
  stdout: string;
3041
3048
  stderr: string;
3042
3049
  };
3043
- /**
3044
- * Verification signals DERIVED in the live worktree, after the harness ran and before
3045
- * teardown — the PASS signals the old sandbox `CoderOutput` carried, re-derived here by
3046
- * running the configured commands. Present only when `testCmd`/`typecheckCmd` were supplied.
3047
- * The coder deliverable (`coderDeliverable`) reads these to gate the patch.
3048
- */
3050
+ /** Verification signals derived in the live worktree (present only when commands were given). */
3049
3051
  checks?: {
3050
3052
  tests?: WorktreeCommandResult;
3051
3053
  typecheck?: WorktreeCommandResult;
3052
3054
  };
3053
3055
  }
3056
+ /** The single shell-command-in-worktree runner seam (replaces the per-executor copies). */
3057
+ type WorktreeCheckRunner = (opts: {
3058
+ command: string;
3059
+ cwd: string;
3060
+ timeoutMs: number;
3061
+ signal?: AbortSignal;
3062
+ }) => Promise<{
3063
+ exitCode: number | null;
3064
+ output: string;
3065
+ }>;
3066
+
3067
+ /**
3068
+ * @experimental
3069
+ *
3070
+ * The worktree-CLI leaf executor — a supervisor-authored `AgentProfile` driving a local
3071
+ * coding-harness CLI (claude / codex / opencode) on its OWN git worktree, surfaced as the open
3072
+ * `Executor<Out>` port (`./types`). It is a LEAF executor: it plugs straight into the
3073
+ * `Scope`/`Supervisor` recursion and `gateOnDeliverable`, so it IS the canonical recursive path
3074
+ * (no `runLoop`/virtual-SandboxInstance shim in between).
3075
+ *
3076
+ * This is a THIN adapter: the physical act (worktree → profile-aware harness invocation → diff →
3077
+ * checks → cleanup) lives ONCE in `runWorktreeHarness` (`../../mcp/worktree-harness`), shared with
3078
+ * the `runLoop`/coder-delegate `createInProcessExecutor`. This executor only projects that core's
3079
+ * result onto the `Executor` port (artifact + spend) and owns the teardown point. The §1.5 payload
3080
+ * (authored systemPrompt + model) reaches the harness inside the core, not here.
3081
+ *
3082
+ * Token accounting: a harness CLI does not surface usage, so this executor is `budgetExempt: true`
3083
+ * — its spend is NOT metered against the conserved pool and its iterations are EXCLUDED from the
3084
+ * equal-k arms by construction (mirrors `cliExecutor`).
3085
+ */
3086
+
3087
+ /** Terminal artifact of one worktree-CLI run — the canonical worktree-harness result (the captured
3088
+ * diff + the harness's run record + the derived checks). */
3089
+ type WorktreePatchArtifact = WorktreeHarnessResult;
3054
3090
  /** @experimental */
3055
3091
  interface WorktreeCliExecutorOptions {
3056
3092
  /** Absolute path to the git checkout the worktree is cut from. */
@@ -3080,26 +3116,16 @@ interface WorktreeCliExecutorOptions {
3080
3116
  runGit?: GitRunner;
3081
3117
  /** Test seam — inject the harness runner so unit tests script a `LocalHarnessResult`. */
3082
3118
  runHarness?: typeof runLocalHarness;
3083
- /**
3084
- * Test seam inject the verification-command runner so unit tests script test/typecheck
3085
- * outcomes without spawning a real shell. Defaults to a `/bin/sh -c` spawn in the worktree.
3086
- */
3087
- runCommand?: (opts: {
3088
- command: string;
3089
- cwd: string;
3090
- timeoutMs: number;
3091
- signal?: AbortSignal;
3092
- }) => Promise<{
3093
- exitCode: number | null;
3094
- output: string;
3095
- }>;
3119
+ /** Test seam — inject the verification-command runner so unit tests script test/typecheck
3120
+ * outcomes without spawning a real shell. Defaults to a `/bin/sh -c` spawn in the worktree. */
3121
+ runCommand?: WorktreeCheckRunner;
3096
3122
  }
3097
3123
  /**
3098
- * Build a worktree-CLI leaf `Executor`. Per-spawn (a fresh worktree + abort + teardown each),
3099
- * so a fanout of N profiles = N parallel worktrees that never clobber each other.
3124
+ * Build a worktree-CLI leaf `Executor`. Per-spawn (a fresh worktree + abort + teardown each), so a
3125
+ * fanout of N profiles = N parallel worktrees that never clobber each other.
3100
3126
  *
3101
- * Fail-loud: an empty `repoRoot`/`harness`/`taskPrompt` throws at construction (no silent
3102
- * default for a required boundary). `resultArtifact()` before `execute()` resolves throws.
3127
+ * Fail-loud: an empty `repoRoot`/`harness`/`taskPrompt` throws at construction. `resultArtifact()`
3128
+ * before `execute()` resolves throws.
3103
3129
  *
3104
3130
  * @experimental
3105
3131
  */
@@ -3252,6 +3278,15 @@ interface DriverTurn {
3252
3278
  readonly toolCalls?: ReadonlyArray<DriverToolCall>;
3253
3279
  /** The driver's natural-language output — the answer when there are no tool calls. */
3254
3280
  readonly content?: string;
3281
+ /** The driver LLM's OWN token usage for THIS turn — metered against the conserved pool so the
3282
+ * driver's inference counts toward equal-k AND the in-loop budget guard. Omit for a scripted/
3283
+ * mock turn (no real inference); production `routerDriverChat` forwards it from the router. */
3284
+ readonly usage?: {
3285
+ readonly input: number;
3286
+ readonly output: number;
3287
+ };
3288
+ /** The turn's inference cost (usd), when the provider priced it. */
3289
+ readonly costUsd?: number;
3255
3290
  }
3256
3291
  /** The injected driver-LLM seam: one turn over the conversation + the coordination tool specs. */
3257
3292
  interface DriverChat {
@@ -3278,8 +3313,14 @@ interface CoordinationDriverOptions {
3278
3313
  /** The driver's stance — a string, or built from the task (the worker-driver prompt /
3279
3314
  * the generator). INJECTED so the prompt is a pluggable, optimizable role. */
3280
3315
  readonly systemPrompt: string | ((task: unknown) => string);
3281
- /** Max driver turns before the loop force-finalizes on the best settled child. Default 16. */
3316
+ /** Max driver turns before the loop force-finalizes on the best settled child. Default 16.
3317
+ * `0` lifts the turn-COUNT cap: the loop is bounded instead by the conserved budget pool,
3318
+ * an absolute deadline, the driver's own stop, and abort (checked in-loop). A finite
3319
+ * anti-runaway tripwire still guards a degenerate driver that loops on a no-spawn tool. */
3282
3320
  readonly maxTurns?: number;
3321
+ /** Injected clock for the in-loop absolute-deadline guard — keeps the deadline check
3322
+ * deterministic in tests. Defaults to `Date.now`. */
3323
+ readonly now?: () => number;
3283
3324
  }
3284
3325
  /**
3285
3326
  * Build the intelligent recursive driver. Its `act` is the LLM tool-loop; spawn it as a
@@ -3290,7 +3331,7 @@ declare function coordinationDriverAgent(opts: CoordinationDriverOptions): Agent
3290
3331
  /**
3291
3332
  * @experimental
3292
3333
  *
3293
- * Serve the coordination verbs (spawn_worker / await_next / observe_worker / steer_worker / stop)
3334
+ * Serve the coordination verbs (spawn_worker / await_event / observe_worker / steer_worker / stop)
3294
3335
  * as a real HTTP MCP server over a LIVE `Scope`. This is the keystone that lets a coding-harness
3295
3336
  * agent (opencode via the cli-bridge, claude-code, codex) BE the supervisor: it mounts this MCP
3296
3337
  * (`mcp.mcpServers.coordination`) and calls `spawn_worker` as a native tool, which lands on
@@ -3313,6 +3354,12 @@ interface CoordinationMcpHandle {
3313
3354
  outRef?: string;
3314
3355
  }>;
3315
3356
  isStopped(): boolean;
3357
+ /** The full ordered bus-event log — observability audit + replay trail. */
3358
+ history: CoordinationTools['history'];
3359
+ /** Bus throughput counters for live dashboards. */
3360
+ stats: CoordinationTools['stats'];
3361
+ /** Raise a `finding` on the bus from an online detector watching a worker's live pipe. */
3362
+ raiseFinding: CoordinationTools['raiseFinding'];
3316
3363
  close(): Promise<void>;
3317
3364
  }
3318
3365
  /** Stand up the coordination MCP over a live scope. The HOST address is `127.0.0.1` (the bridge runs
@@ -3324,8 +3371,51 @@ declare function serveCoordinationMcp(opts: {
3324
3371
  perWorker: Budget;
3325
3372
  port?: number;
3326
3373
  host?: string;
3374
+ /** Trace-analyst lenses the driver can run (`run_analyst`) or auto-fire on settle. */
3375
+ analysts?: AnalystRegistry;
3376
+ /** Analyst kinds to auto-run when a worker settles `done` — findings flow up the bus. */
3377
+ analyzeOnSettle?: ReadonlyArray<string>;
3378
+ /** Pass-through subscriber for every bus event (settled / question / finding). */
3379
+ onEvent?: (event: CoordinationEvent) => void | Promise<void>;
3380
+ questionPolicy?: QuestionPolicy;
3327
3381
  }): Promise<CoordinationMcpHandle>;
3328
3382
 
3383
+ /**
3384
+ * @experimental
3385
+ *
3386
+ * The online analyst on the worker pipe. As a worker streams its tool calls, this folds each one
3387
+ * through agent-eval's streaming detector kernel (`repeatedActionDetector` etc. — the SAME kernel the
3388
+ * control loop uses, published in @tangle-network/agent-eval) and fires `onSignal` the moment one
3389
+ * trips. The wiring point: `onSignal` raises a `finding` on the coordination bus, so the driver learns
3390
+ * mid-round that its worker is stuck — instead of finding out only at settle.
3391
+ *
3392
+ * Detection logic + the failure taxonomy live in agent-eval (substrate); this module is the thin
3393
+ * runtime adapter that projects a live tool call into a `DetectorEvent` (the tool name + `argHash` of
3394
+ * its args → an action fingerprint) and pumps the detectors. No detection logic is reimplemented here.
3395
+ */
3396
+
3397
+ interface ToolStep {
3398
+ readonly toolName: string;
3399
+ readonly args: unknown;
3400
+ /** Whether the tool call errored (drives error-streak detection). Omit/`'ok'` when unknown. */
3401
+ readonly status?: 'ok' | 'error';
3402
+ }
3403
+ interface DetectorMonitor {
3404
+ /** Fold one tool step through the detectors; returns (and fires `onSignal` for) every signal. */
3405
+ observeToolStep(step: ToolStep): DetectorSignal[];
3406
+ reset(): void;
3407
+ }
3408
+ interface DetectorMonitorOptions {
3409
+ /** The detectors to run online. Defaults to a stuck-loop + error-streak panel. */
3410
+ readonly detectors?: ReadonlyArray<StreamingDetector>;
3411
+ /** Fired for each signal a detector raises — the seam that raises a `finding` on the bus. */
3412
+ readonly onSignal?: (signal: DetectorSignal) => void | Promise<void>;
3413
+ }
3414
+ /** The default online panel for a tool-call pipe: a worker repeating the same call, or hammering
3415
+ * consecutive errors. (No-progress needs a domain progress-probe, so it is opt-in, not default.) */
3416
+ declare function defaultToolDetectors(): StreamingDetector[];
3417
+ declare function createDetectorMonitor(opts?: DetectorMonitorOptions): DetectorMonitor;
3418
+
3329
3419
  /**
3330
3420
  * @experimental
3331
3421
  *
@@ -3407,6 +3497,56 @@ declare const driverExecutorFactory: ExecutorFactory<unknown>;
3407
3497
  */
3408
3498
  declare function withDriverExecutor(base: ExecutorRegistry): ExecutorRegistry;
3409
3499
 
3500
+ /**
3501
+ * @experimental
3502
+ *
3503
+ * The worker-side receive end of the down-leg: a per-worker inbox an executor exposes as
3504
+ * `Executor.deliver`. The driver's `steer_worker` / `answer_question` land here,
3505
+ * and the worker's agent loop drains them at two points (Drew's two delivery modes):
3506
+ *
3507
+ * - QUEUED (default): the message accumulates and is FLUSHED at the next step boundary — folded
3508
+ * into the conversation before the next think. A worker is also forced to flush BEFORE it may
3509
+ * settle, so it can never finish while a steer/answer it never read is still pending.
3510
+ * - FORCEFUL (`interrupt: true`): trips `freshInterrupt()`'s signal so the loop can abort its
3511
+ * in-flight turn immediately, then re-plan with the message folded in — breaking the worker out
3512
+ * of a wrong path mid-task instead of waiting for it to finish the step.
3513
+ *
3514
+ * `deliver` never throws — a malformed message is ignored, per the `Executor.deliver` contract.
3515
+ */
3516
+ interface InboxMessage {
3517
+ readonly kind: 'steer' | 'answer';
3518
+ readonly text: string;
3519
+ /** Forceful messages abort the in-flight turn; queued ones wait for the boundary flush. */
3520
+ readonly interrupt: boolean;
3521
+ /** Present for an `answer` — the question id it resolves. */
3522
+ readonly questionId?: string;
3523
+ }
3524
+ interface Inbox {
3525
+ /** The `Executor.deliver` implementation — accept a raw down-message from `Scope.send`. */
3526
+ deliver(msg: unknown): void;
3527
+ /** Remove and return all pending messages (the flush). */
3528
+ drain(): InboxMessage[];
3529
+ pending(): number;
3530
+ /** Open a fresh per-turn interrupt signal; a later forceful `deliver` aborts it. The loop links
3531
+ * this into the signal it passes to its inference call, then re-plans when it fires. */
3532
+ freshInterrupt(): AbortSignal;
3533
+ /** Render drained messages as ONE operator turn to fold into the worker's conversation. */
3534
+ fold(messages: ReadonlyArray<InboxMessage>): string;
3535
+ }
3536
+ declare function createInbox(): Inbox;
3537
+
3538
+ /**
3539
+ * The router-backed driver-LLM seam: adapt the OpenAI-compatible router's tool-calling chat
3540
+ * to the `DriverChat` port a `coordinationDriverAgent` drives. Tests script a mock `DriverChat`;
3541
+ * production passes `routerDriverChat(cfg)` so the driver's spawn/observe/steer/await/stop turns
3542
+ * are real router tool-calls. This is the one turnkey piece a consumer needs to run an in-process
3543
+ * supervisor (the driver brain) — everything else is `createSupervisor().run(...)`.
3544
+ */
3545
+
3546
+ declare function routerDriverChat(c: RouterConfig, opts?: {
3547
+ temperature?: number;
3548
+ }): DriverChat;
3549
+
3410
3550
  /**
3411
3551
  * @experimental
3412
3552
  *
@@ -3514,6 +3654,13 @@ interface RouterToolsSeam {
3514
3654
  model?: string;
3515
3655
  tools: ReadonlyArray<ToolSpec>;
3516
3656
  executeToolCall: (name: string, args: Record<string, unknown>, task: unknown) => Promise<string>;
3657
+ /** Online observer of each tool step — the seam a `DetectorMonitor` taps to watch the live pipe
3658
+ * (raise a `finding` when the worker loops/errors). Called after every tool call resolves. */
3659
+ onToolStep?: (step: {
3660
+ toolName: string;
3661
+ args: Record<string, unknown>;
3662
+ status: 'ok' | 'error';
3663
+ }) => void;
3517
3664
  /** Max inference turns. Default 200 (runaway backstop — set far above any
3518
3665
  * legitimate workflow). For tighter per-workflow limits use a cost budget
3519
3666
  * or wall-clock deadline at the call site. */
@@ -3687,9 +3834,9 @@ declare function settledToIteration<Out>(settled: Settled<Out>): Iteration<unkno
3687
3834
  * no-winner; it does not restart anything.
3688
3835
  *
3689
3836
  * Selection lives in the driver, not here (selector≠judge): `act` returns the synthesized
3690
- * winner `Out`. The supervisor content-addresses that `Out` for its replay `outRef`,
3691
- * reads `spentTotal` off the conserved pool, and wraps it as a typed `winner` it does
3692
- * not re-rank children behind the driver's back.
3837
+ * winner `Out`. The supervisor content-addresses that `Out` for its replay `outRef`, reads
3838
+ * `spentTotal` off the journal (`settled` child work + `metered` driver inference), and wraps
3839
+ * it as a typed `winner` — it does not re-rank children behind the driver's back.
3693
3840
  */
3694
3841
 
3695
3842
  declare function createSupervisor<Task, Out>(): Supervisor<Task, Out>;
@@ -3702,6 +3849,47 @@ declare function createSupervisor<Task, Out>(): Supervisor<Task, Out>;
3702
3849
  */
3703
3850
  declare function createRootHandle<Out>(): RootHandle<Out>;
3704
3851
 
3852
+ /**
3853
+ * @experimental
3854
+ *
3855
+ * The settle-time trace analyzer. Captures a worker's tool steps and, when it settles, replays them
3856
+ * as agent-eval spans into an in-memory `TraceStore` and runs agent-eval's PUBLISHED batch analyzers
3857
+ * over them — `buildTrajectory` (structured run summary), `stuckLoopView` (full-run repeated-call
3858
+ * view, complementing the ONLINE consecutive detector), and `toolWasteView` (waste ratio). The result
3859
+ * is the "parent runs trace analyzers over the whole loop trace at settle" piece, reusing agent-eval —
3860
+ * no analysis logic is reimplemented here; this is the thin adapter that bridges live tool steps into
3861
+ * the substrate's trace model.
3862
+ *
3863
+ * Pairs with `createDetectorMonitor` (the ONLINE pipe watcher): feed both from the worker's `onToolStep`
3864
+ * seam — the monitor raises findings mid-run, the recorder produces the post-hoc trajectory at settle.
3865
+ */
3866
+
3867
+ interface RecordedToolStep {
3868
+ readonly toolName: string;
3869
+ readonly args: unknown;
3870
+ readonly status?: 'ok' | 'error';
3871
+ readonly result?: unknown;
3872
+ }
3873
+ interface TrajectoryAnalysis {
3874
+ /** Structured run summary (tool-call count, step order). Steps are recorded at a single timestamp
3875
+ * — the moment the tool call resolved — so per-span duration is 0; loop/waste detection keys on
3876
+ * call PATTERNS + cross-span windows, not individual durations. */
3877
+ readonly trajectory: Awaited<ReturnType<typeof buildTrajectory>>;
3878
+ /** Full-run repeated-call view (total occurrences + window), distinct from the online consecutive
3879
+ * detector — catches a loop that is interleaved with other calls. */
3880
+ readonly stuckLoop: Awaited<ReturnType<typeof stuckLoopView>>;
3881
+ /** Wasted-vs-total tool-call ratio for the run. */
3882
+ readonly toolWaste: Awaited<ReturnType<typeof toolWasteView>>;
3883
+ }
3884
+ interface TrajectoryRecorder {
3885
+ /** Capture one tool step (feed from the same `onToolStep` seam as the online monitor). */
3886
+ observeToolStep(step: RecordedToolStep): void;
3887
+ /** Replay the captured steps as agent-eval spans and run the batch analyzers over them. */
3888
+ analyze(): Promise<TrajectoryAnalysis>;
3889
+ reset(): void;
3890
+ }
3891
+ declare function createTrajectoryRecorder(runId: string, now?: () => number): TrajectoryRecorder;
3892
+
3705
3893
  /**
3706
3894
  * createVerifierEnvironment — ANY checkable task as an `Environment`, no tool surface
3707
3895
  * required. The generalization piece: EOPS/commit0-style domains have tools that mutate
@@ -3797,4 +3985,4 @@ declare function runInWorkspace<T>(ws: Workspace, body: (cwd: string) => Promise
3797
3985
  commitOnInvalid?: boolean;
3798
3986
  }): Promise<WorkspaceRun<T>>;
3799
3987
 
3800
- export { Agent, AgentRunSpec, AgentSpec, type AgenticOptions, type AgenticRunResult, type AgenticSurface, type AgenticTask, type AgenticTool, type AnytimeReport, type AnytimeStrategySummary, type AnytimeTaskCurve, type ArtifactHandle, type AssertTraceDerivedFindings, type AuditIntentInput, type AuditIntentOptions, type AuthorStrategyOptions, type AuthoredCoderHarness, type AuthoredProfile, type AuthoredStrategy, type BenchmarkCell, type BenchmarkConfig, type BenchmarkLift, type BenchmarkReport, type BenchmarkStrategySummary, type BenchmarkTaskRow, type BridgeSeam, Budget, type BudgetPool, type BudgetReadout, type ChampionPick, type ChampionPolicy, type CheckpointCapableBox, type CliSeam, type CliWorktreeSeam, type CoderDeliverableOptions, type CoderWinnerStrategy, type CombinatorShape, type CompletionAnalyst, type CompletionEvidence, type CompletionPolicy, type CompletionVerdict, type CoordinationDriverOptions, type CoordinationMcpHandle, type Corpus, type CorpusFilter, type CorpusRecord, type CreateScopeAnalystOptions, type CriuCapableClient, type DefinePersona, type DefinePersonaInput, type Deliverable, type DeliverableSpec, type DriverChat, type DriverMessage, type DriverToolCall, type DriverTurn, type Environment, type EqualKArm, type EqualKOnCost, type EqualKOnCostOptions, type EqualKVerdict, type EvolutionArchiveNode, type EvolutionAuthor, type EvolutionBandInfo, type EvolutionCandidate, type EvolutionGeneration, type EvolutionReport, ExecCtx, Executor, type ExecutorConfig, ExecutorFactory, ExecutorRegistry, type Fanout, type FanoutOptions, type FanoutSynthesis, type FanoutWinnerSelector, FileCorpus, FileResultBlobStore, FileSpawnJournal, type FlatWidenGate, type ForkCapableBox, type GitWorkspaceOptions, type HarvestCorpusOptions, type HarvestFailure, type HarvestReport, InMemoryCorpus, InMemoryResultBlobStore, InMemorySpawnJournal, type IntentAudit, Iteration, type LoopDispatchOptions, type LoopOptionsForDispatch, LoopResult, type LoopShape, LoopTokenUsage, type LoopUntil, type LoopUntilSpec, type LoopUntilState, type McpEndpoint, type McpEnvironmentOptions, type NestedScopeSeam, NodeId, type Observation, type ObserveInput, type ObserveOptions, type OpenSandboxRunOptions, type Outcome, type Panel, type PanelJudge, type PanelSpec, type PanelVerdict, type Persona, type PersonaContext, type PersonaExecutors, type Pipeline, type PipelineStage, type PromotionGateOptions, type PromotionVerdict, type RegistryAnalyzeProjection, type RenderCorpusToInstructions, type RenderCorpusToInstructionsOptions, type ReservationTicket, ResultBlobStore, RootHandle, RouterConfig, type RouterSeam, type RouterToolsSeam, type RunAgenticOptions, RunLoopOptions, type RunPersonified, type RunPersonifiedOptions, type SandboxCapabilities, SandboxClient, type SandboxLineage, type SandboxLineageHandle, type SandboxRun, type SandboxSeam, Scope, type ScopeAnalyst, type ScopeAnalyzeInput, type ScopeWidenGate, type SessionCapableBox, Settled, type ShapeBudget, type ShapeContext, type ShapeRegistry, type Shell, type ShotPersona, type ShotSpec, SpawnEvent, SpawnJournal, Spend, type SteerContext, type Strategy, type StrategyCtx, type StrategyEvolutionConfig, type StrategyResult, SupervisedResult, Supervisor, type SurfaceScore, ToolSpec, type TrajectoryNode, type TrajectoryReport, type TrajectoryReportFn, type TrajectoryReportOptions, TreeView, type TurnResult, UsageEvent, type UsageSink, type VerifierEnvironmentOptions, type Verify, type VerifySpec, type WaterfallCollector, type WaterfallReport, type WaterfallSpan, type Widen, type WidenDecision, type WidenLineage, type WidenSpec, type Workspace, type WorkspaceCommit, type WorkspaceRun, type WorktreeCliExecutorOptions, type WorktreeCoderFanoutOptions, type WorktreeCommandResult, type WorktreePatchArtifact, acquireSandbox, adaptiveRefine, anytimeReport, asAuthoredProfile, assertStrategyContract, assertTraceDerivedFindings, auditIntent, authorStrategy, authoredWorker, breadthDriver, buildSteerContext, builtinShapes, cliWorktreeExecutor, coderDeliverable, completionAuthorizes, contentAddress, coordinationDriverAgent, createBudgetPool, createExecutor, createExecutorRegistry, createMcpEnvironment, createRootHandle, createSandboxLineage, createScope, createScopeAnalyst, createShapeRegistry, createSupervisor, createVerifierEnvironment, createWaterfallCollector, createWorktreeCliExecutor, defaultAnalystInstruction, defaultAuditorInstruction, definePersona, defineStrategy, depthDriver, deterministicCompletion, discriminatingMeans, driverChild, driverExecutorFactory, driverRuntime, equalKOnCost, extractLlmCallEvent, fanout, flatWidenGate, gateOnDeliverable, gitWorkspace, harvestCorpus, inlineSandboxClient, isDriverSpec, jjWorkspace, localShell, loopDispatch, loopUntil, mapSandboxEvent, materializeTreeView, nestedScopeSeamKey, observe, openSandboxRun, panel, pickChampion, pipeline, printBenchmarkReport, probeSandboxCapabilities, promotionGate, refine, registerShape, registryScopeAnalyst, renderAnytimeTable, renderCorpusToInstructions, renderReport, replaySpawnTree, reportLoopUsage, runAgentic, runBenchmark, runInWorkspace, runPersonified, runStrategyEvolution, sample, sampleThenRefine, selectChampion, sentinelCompletion, serveCoordinationMcp, settledToIteration, spendFromUsageEvents, stopSentinel, strategyAuthorContract, supervisorSkill, trajectoryReport, verify, widen, withDriverExecutor, worktreeCoderFanout };
3988
+ export { Agent, AgentRunSpec, AgentSpec, type AgenticOptions, type AgenticRunResult, type AgenticSurface, type AgenticTask, type AgenticTool, type AnytimeReport, type AnytimeStrategySummary, type AnytimeTaskCurve, type ArtifactHandle, type AssertTraceDerivedFindings, type AuditIntentInput, type AuditIntentOptions, type AuthorStrategyOptions, type AuthoredCoderHarness, type AuthoredProfile, type AuthoredStrategy, type BenchmarkCell, type BenchmarkConfig, type BenchmarkLift, type BenchmarkReport, type BenchmarkStrategySummary, type BenchmarkTaskRow, type BridgeSeam, Budget, type BudgetPool, type BudgetReadout, type ChampionPick, type ChampionPolicy, type CheckpointCapableBox, type CliSeam, type CliWorktreeSeam, type CoderDeliverableOptions, type CoderWinnerStrategy, type CombinatorShape, type CompletionAnalyst, type CompletionEvidence, type CompletionPolicy, type CompletionVerdict, type CoordinationDriverOptions, type CoordinationMcpHandle, type Corpus, type CorpusFilter, type CorpusRecord, type CreateScopeAnalystOptions, type CriuCapableClient, type DefinePersona, type DefinePersonaInput, type Deliverable, type DeliverableSpec, type DetectorMonitor, type DetectorMonitorOptions, type DriverChat, type DriverMessage, type DriverToolCall, type DriverTurn, type Environment, type EqualKArm, type EqualKOnCost, type EqualKOnCostOptions, type EqualKVerdict, type EvolutionArchiveNode, type EvolutionAuthor, type EvolutionBandInfo, type EvolutionCandidate, type EvolutionGeneration, type EvolutionReport, ExecCtx, Executor, type ExecutorConfig, ExecutorFactory, ExecutorRegistry, type Fanout, type FanoutOptions, type FanoutSynthesis, type FanoutWinnerSelector, FileCorpus, FileResultBlobStore, FileSpawnJournal, type FlatWidenGate, type ForkCapableBox, type GitWorkspaceOptions, type HarvestCorpusOptions, type HarvestFailure, type HarvestReport, InMemoryCorpus, InMemoryResultBlobStore, InMemorySpawnJournal, type Inbox, type InboxMessage, type IntentAudit, Iteration, type LoopDispatchOptions, type LoopOptionsForDispatch, LoopResult, type LoopShape, LoopTokenUsage, type LoopUntil, type LoopUntilSpec, type LoopUntilState, type McpEndpoint, type McpEnvironmentOptions, type NestedScopeSeam, NodeId, type Observation, type ObserveInput, type ObserveOptions, type OpenSandboxRunOptions, type Outcome, type Panel, type PanelJudge, type PanelSpec, type PanelVerdict, type Persona, type PersonaContext, type PersonaExecutors, type Pipeline, type PipelineStage, type PromotionGateOptions, type PromotionVerdict, type RecordedToolStep, type RegistryAnalyzeProjection, type RenderCorpusToInstructions, type RenderCorpusToInstructionsOptions, type ReservationTicket, ResultBlobStore, RootHandle, RouterConfig, type RouterSeam, type RouterToolsSeam, type RunAgenticOptions, RunLoopOptions, type RunPersonified, type RunPersonifiedOptions, type SandboxCapabilities, SandboxClient, type SandboxLineage, type SandboxLineageHandle, type SandboxRun, type SandboxSeam, Scope, type ScopeAnalyst, type ScopeAnalyzeInput, type ScopeWidenGate, type SessionCapableBox, Settled, type ShapeBudget, type ShapeContext, type ShapeRegistry, type Shell, type ShotPersona, type ShotSpec, SpawnEvent, SpawnJournal, Spend, type SteerContext, type Strategy, type StrategyCtx, type StrategyEvolutionConfig, type StrategyResult, SupervisedResult, Supervisor, type SurfaceScore, ToolSpec, type ToolStep, type TrajectoryAnalysis, type TrajectoryNode, type TrajectoryRecorder, type TrajectoryReport, type TrajectoryReportFn, type TrajectoryReportOptions, TreeView, type TurnResult, UsageEvent, type UsageSink, type VerifierEnvironmentOptions, type Verify, type VerifySpec, type WaterfallCollector, type WaterfallReport, type WaterfallSpan, type Widen, type WidenDecision, type WidenLineage, type WidenSpec, type Workspace, type WorkspaceCommit, type WorkspaceRun, type WorktreeCliExecutorOptions, type WorktreeCoderFanoutOptions, type WorktreeCommandResult, type WorktreePatchArtifact, acquireSandbox, adaptiveRefine, anytimeReport, asAuthoredProfile, assertStrategyContract, assertTraceDerivedFindings, auditIntent, authorStrategy, authoredWorker, breadthDriver, buildSteerContext, builtinShapes, cliWorktreeExecutor, coderDeliverable, completionAuthorizes, contentAddress, coordinationDriverAgent, createBudgetPool, createDetectorMonitor, createExecutor, createExecutorRegistry, createInbox, createMcpEnvironment, createRootHandle, createSandboxLineage, createScope, createScopeAnalyst, createShapeRegistry, createSupervisor, createTrajectoryRecorder, createVerifierEnvironment, createWaterfallCollector, createWorktreeCliExecutor, defaultAnalystInstruction, defaultAuditorInstruction, defaultToolDetectors, definePersona, defineStrategy, depthDriver, deterministicCompletion, discriminatingMeans, driverChild, driverExecutorFactory, driverRuntime, equalKOnCost, extractLlmCallEvent, fanout, flatWidenGate, gateOnDeliverable, gitWorkspace, harvestCorpus, inlineSandboxClient, isDriverSpec, jjWorkspace, localShell, loopDispatch, loopUntil, mapSandboxEvent, materializeTreeView, nestedScopeSeamKey, observe, openSandboxRun, panel, pickChampion, pipeline, printBenchmarkReport, probeSandboxCapabilities, promotionGate, refine, registerShape, registryScopeAnalyst, renderAnytimeTable, renderCorpusToInstructions, renderReport, replaySpawnTree, reportLoopUsage, routerDriverChat, runAgentic, runBenchmark, runInWorkspace, runPersonified, runStrategyEvolution, sample, sampleThenRefine, selectChampion, sentinelCompletion, serveCoordinationMcp, settledToIteration, spendFromUsageEvents, stopSentinel, strategyAuthorContract, supervisorSkill, trajectoryReport, verify, widen, withDriverExecutor, worktreeCoderFanout };
package/dist/runtime.js CHANGED
@@ -23,8 +23,11 @@ import {
23
23
  contentAddress,
24
24
  coordinationDriverAgent,
25
25
  createBudgetPool,
26
+ createDetectorMonitor,
27
+ createEventBus,
26
28
  createExecutor,
27
29
  createExecutorRegistry,
30
+ createInbox,
28
31
  createMcpEnvironment,
29
32
  createRootHandle,
30
33
  createSandboxForSpec,
@@ -33,12 +36,14 @@ import {
33
36
  createScopeAnalyst,
34
37
  createShapeRegistry,
35
38
  createSupervisor,
39
+ createTrajectoryRecorder,
36
40
  createVerifierEnvironment,
37
41
  createWaterfallCollector,
38
42
  createWorktreeCliExecutor,
39
43
  defaultAnalystInstruction,
40
44
  defaultAuditorInstruction,
41
45
  defaultSelectWinner,
46
+ defaultToolDetectors,
42
47
  definePersona,
43
48
  defineStrategy,
44
49
  depthDriver,
@@ -79,6 +84,7 @@ import {
79
84
  reportLoopUsage,
80
85
  routerChatWithTools,
81
86
  routerChatWithUsage,
87
+ routerDriverChat,
82
88
  routerToolLoop,
83
89
  runAgentic,
84
90
  runBenchmark,
@@ -101,8 +107,8 @@ import {
101
107
  widen,
102
108
  withDriverExecutor,
103
109
  worktreeCoderFanout
104
- } from "./chunk-ZADWPBOE.js";
105
- import "./chunk-3BI6PSP3.js";
110
+ } from "./chunk-RLDUT4JL.js";
111
+ import "./chunk-7QYOXFCD.js";
106
112
  import "./chunk-WIR4HOOJ.js";
107
113
  import {
108
114
  extractLlmCallEvent,
@@ -136,8 +142,11 @@ export {
136
142
  contentAddress,
137
143
  coordinationDriverAgent,
138
144
  createBudgetPool,
145
+ createDetectorMonitor,
146
+ createEventBus,
139
147
  createExecutor,
140
148
  createExecutorRegistry,
149
+ createInbox,
141
150
  createMcpEnvironment,
142
151
  createRootHandle,
143
152
  createSandboxForSpec,
@@ -146,12 +155,14 @@ export {
146
155
  createScopeAnalyst,
147
156
  createShapeRegistry,
148
157
  createSupervisor,
158
+ createTrajectoryRecorder,
149
159
  createVerifierEnvironment,
150
160
  createWaterfallCollector,
151
161
  createWorktreeCliExecutor,
152
162
  defaultAnalystInstruction,
153
163
  defaultAuditorInstruction,
154
164
  defaultSelectWinner,
165
+ defaultToolDetectors,
155
166
  definePersona,
156
167
  defineStrategy,
157
168
  depthDriver,
@@ -194,6 +205,7 @@ export {
194
205
  reportLoopUsage,
195
206
  routerChatWithTools,
196
207
  routerChatWithUsage,
208
+ routerDriverChat,
197
209
  routerToolLoop,
198
210
  runAgentic,
199
211
  runBenchmark,
@@ -1097,4 +1097,4 @@ interface ExecCtx {
1097
1097
  parentSpanId?: string;
1098
1098
  }
1099
1099
 
1100
- export { type AgentRunSpec as A, type BackendErrorDetail as B, startRuntimeRun as C, type Driver as D, type ExecCtx as E, type LoopDecisionPayload as F, type LoopEndedPayload as G, type LoopIterationDispatchPayload as H, type Iteration as I, type LoopIterationEndedPayload as J, type KnowledgeReadinessDecision as K, type LoopWinner as L, type LoopIterationStartedPayload as M, type LoopPlanDescription as N, type OutputAdapter as O, type LoopPlanPayload as P, type LoopStartedPayload as Q, type RuntimeStreamEvent as R, type SandboxClient as S, type LoopTeardownFailedPayload as T, type ValidationCtx as U, type Validator as V, type LoopLineageOptions as a, type LoopResult as b, type OpenAIChatTool as c, type LoopTokenUsage as d, type LoopTraceEvent as e, type LoopSandboxPlacement as f, type LoopTraceEmitter as g, type AgentBackendInput as h, type AgentExecutionBackend as i, type OpenAIChatToolChoice as j, type AgentBackendContext as k, type RunAgentTaskOptions as l, type AgentTaskRunResult as m, type RunAgentTaskStreamOptions as n, type AgentRuntimeEvent as o, type AgentTaskStatus as p, type RuntimeSessionStore as q, type RuntimeSession as r, type AgentAdapter as s, type AgentKnowledgeProvider as t, type AgentRuntimeEventSink as u, type AgentTaskContext as v, type AgentTaskSpec as w, type RuntimeRunHandle as x, type RuntimeRunPersistenceAdapter as y, type RuntimeRunRow as z };
1100
+ export { type AgentRunSpec as A, type BackendErrorDetail as B, startRuntimeRun as C, type Driver as D, type ExecCtx as E, type LoopDecisionPayload as F, type LoopEndedPayload as G, type LoopIterationDispatchPayload as H, type Iteration as I, type LoopIterationEndedPayload as J, type KnowledgeReadinessDecision as K, type LoopWinner as L, type LoopIterationStartedPayload as M, type LoopPlanDescription as N, type OutputAdapter as O, type LoopPlanPayload as P, type LoopStartedPayload as Q, type RuntimeStreamEvent as R, type SandboxClient as S, type LoopTeardownFailedPayload as T, type ValidationCtx as U, type Validator as V, type LoopLineageOptions as a, type LoopResult as b, type OpenAIChatTool as c, type LoopTraceEvent as d, type LoopTokenUsage as e, type LoopSandboxPlacement as f, type LoopTraceEmitter as g, type AgentBackendInput as h, type AgentExecutionBackend as i, type OpenAIChatToolChoice as j, type AgentBackendContext as k, type RunAgentTaskOptions as l, type AgentTaskRunResult as m, type RunAgentTaskStreamOptions as n, type AgentRuntimeEvent as o, type AgentTaskStatus as p, type RuntimeSessionStore as q, type RuntimeSession as r, type AgentAdapter as s, type AgentKnowledgeProvider as t, type AgentRuntimeEventSink as u, type AgentTaskContext as v, type AgentTaskSpec as w, type RuntimeRunHandle as x, type RuntimeRunPersistenceAdapter as y, type RuntimeRunRow as z };
@@ -1,6 +1,6 @@
1
1
  import { AgentProfile, CreateSandboxOptions, PromptOptions, TaskOptions, SandboxEvent } from '@tangle-network/sandbox';
2
- import { S as SandboxClient, O as OutputAdapter, f as LoopSandboxPlacement, b as LoopResult } from './types-C8rNlxfV.js';
3
- import { R as RunLoopOptions } from './run-loop-DluzfJ2h.js';
2
+ import { S as SandboxClient, O as OutputAdapter, f as LoopSandboxPlacement, b as LoopResult } from './types-CUzjRFZ3.js';
3
+ import { R as RunLoopOptions } from './run-loop-CcqfR_gy.js';
4
4
  import '@tangle-network/agent-eval';
5
5
  import './runtime-hooks-C7JwKb9E.js';
6
6
 
package/dist/workflow.js CHANGED
@@ -2,8 +2,8 @@ import {
2
2
  createSandboxForSpec,
3
3
  describeSandboxPlacement,
4
4
  runLoop
5
- } from "./chunk-ZADWPBOE.js";
6
- import "./chunk-3BI6PSP3.js";
5
+ } from "./chunk-RLDUT4JL.js";
6
+ import "./chunk-7QYOXFCD.js";
7
7
  import "./chunk-WIR4HOOJ.js";
8
8
  import {
9
9
  ValidationError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-runtime",
3
- "version": "0.56.0",
3
+ "version": "0.57.0",
4
4
  "description": "Shared task-lifecycle skeleton for agents: a recursive loop kernel for chat turns, one-shot tasks, and multi-attempt loops, with trace capture and eval-gated self-improvement. Domain behavior lives in adapters; scoring and ship-gates in @tangle-network/agent-eval.",
5
5
  "homepage": "https://github.com/tangle-network/agent-runtime#readme",
6
6
  "repository": {
@@ -106,7 +106,7 @@
106
106
  },
107
107
  "devDependencies": {
108
108
  "@biomejs/biome": "^2.4.15",
109
- "@tangle-network/agent-eval": "^0.92.0",
109
+ "@tangle-network/agent-eval": "^0.93.0",
110
110
  "@tangle-network/sandbox": "^0.6.0",
111
111
  "@types/node": "^25.9.3",
112
112
  "playwright": "^1.61.0",
@@ -110,7 +110,7 @@ const result = await createSupervisor<Task, Output>().run(driver, task, supervis
110
110
  ```
111
111
 
112
112
  When the driver lives in a sandbox, expose the same verbs through
113
- `createCoordinationTools`: `spawn_worker`, `await_next`, `observe_worker`,
113
+ `createCoordinationTools`: `spawn_worker`, `await_event`, `observe_worker`,
114
114
  `steer_worker`, `list_questions`, `answer_question`, `ask_parent`, `stop`, and
115
115
  optional analyst tools.
116
116