@tangle-network/agent-runtime 0.87.0 → 0.88.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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  extractLlmCallEvent
3
- } from "./chunk-QUXZBZCS.js";
3
+ } from "./chunk-FVJ7M3DA.js";
4
4
  import {
5
5
  AnalystError
6
6
  } from "./chunk-YEJR7IXO.js";
@@ -579,4 +579,4 @@ export {
579
579
  iterationsToTraceStore,
580
580
  runAnalystLoop
581
581
  };
582
- //# sourceMappingURL=chunk-LCXXIL3U.js.map
582
+ //# sourceMappingURL=chunk-ZQZX77MM.js.map
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  mcpToolsForRuntimeMcp,
3
3
  mcpToolsForRuntimeMcpSubset
4
- } from "./chunk-MHYF2LIP.js";
4
+ } from "./chunk-JHULWWQD.js";
5
5
  import {
6
6
  DEFAULT_ROUTER_BASE_URL,
7
7
  cleanModelId,
@@ -20,7 +20,7 @@ import {
20
20
  runLoopRunnerCli,
21
21
  selfImproveLoopRunner,
22
22
  worktreeLoopRunner
23
- } from "./chunk-FLVVVBWV.js";
23
+ } from "./chunk-HBE77SWV.js";
24
24
  import "./chunk-SGKPNBXE.js";
25
25
  import {
26
26
  InMemoryRuntimeSessionStore,
@@ -31,14 +31,14 @@ import {
31
31
  normalizeBackendStreamEvent,
32
32
  nowIso,
33
33
  touchSession
34
- } from "./chunk-VKVNDNG4.js";
34
+ } from "./chunk-22HPUH77.js";
35
35
  import {
36
36
  assertModelAllowed,
37
37
  composeRuntimeHooks,
38
38
  defineRuntimeHooks,
39
39
  notifyRuntimeDecisionPoint,
40
40
  notifyRuntimeHookEvent
41
- } from "./chunk-6XCW3M7W.js";
41
+ } from "./chunk-LRNRPJAV.js";
42
42
  import {
43
43
  INTELLIGENCE_WIRE_VERSION,
44
44
  buildLoopOtelSpans,
@@ -48,8 +48,8 @@ import {
48
48
  loopEventToOtelSpan
49
49
  } from "./chunk-UD4BHQMI.js";
50
50
  import "./chunk-BZF3KQ6G.js";
51
- import "./chunk-LCXXIL3U.js";
52
- import "./chunk-QUXZBZCS.js";
51
+ import "./chunk-ZQZX77MM.js";
52
+ import "./chunk-FVJ7M3DA.js";
53
53
  import {
54
54
  agenticGenerator,
55
55
  commandVerifier,
@@ -2,14 +2,14 @@
2
2
  import {
3
3
  parseLoopRunnerArgv,
4
4
  runLoopRunnerCli
5
- } from "./chunk-FLVVVBWV.js";
5
+ } from "./chunk-HBE77SWV.js";
6
6
  import "./chunk-SGKPNBXE.js";
7
- import "./chunk-VKVNDNG4.js";
8
- import "./chunk-6XCW3M7W.js";
7
+ import "./chunk-22HPUH77.js";
8
+ import "./chunk-LRNRPJAV.js";
9
9
  import "./chunk-UD4BHQMI.js";
10
10
  import "./chunk-BZF3KQ6G.js";
11
- import "./chunk-LCXXIL3U.js";
12
- import "./chunk-QUXZBZCS.js";
11
+ import "./chunk-ZQZX77MM.js";
12
+ import "./chunk-FVJ7M3DA.js";
13
13
  import "./chunk-7LO5GMAO.js";
14
14
  import "./chunk-YEJR7IXO.js";
15
15
  import "./chunk-DPEUKJRO.js";
package/dist/loops.d.ts CHANGED
@@ -2,7 +2,7 @@ import { ChatClient, RunRecord, HarnessType, AgentProfile, AnalystFinding, Analy
2
2
  export { AnalystFinding, DefaultVerdict, computeFindingId, makeFinding } from '@tangle-network/agent-eval';
3
3
  import { SandboxEvent, SandboxInstance, CreateSandboxOptions, PromptOptions, TaskOptions } from '@tangle-network/sandbox';
4
4
  export { AgentProfile, CreateSandboxOptions, SandboxEvent, SandboxInstance } from '@tangle-network/sandbox';
5
- import { d as ResultBlobStore, S as SpawnJournal, N as NodeId, j as SpawnEvent, E as ExecutorFactory, c as Agent, B as Budget, i as Scope, g as Settled, f as SupervisedResult, h as Spend, U as UsageEvent, b as ExecutorRegistry, k as Supervisor } from './types-Driepl87.js';
5
+ import { d as ResultBlobStore, S as SpawnJournal, N as NodeId, j as SpawnEvent, E as ExecutorFactory, i as Scope, c as Agent, b as ExecutorRegistry, B as Budget, g as Settled, f as SupervisedResult, h as Spend, U as UsageEvent, k as Supervisor } from './types-Driepl87.js';
6
6
  export { A as AgentSpec, a as Executor, l as ExecutorContext, m as ExecutorResult, R as Runtime, n as SupervisorOpts, T as TreeView, W as WidenGate } from './types-Driepl87.js';
7
7
  import { ak as MakeWorkerAgent, A as AnalystRegistry, o as CoordinationTools, n as CoordinationEvent, ar as QuestionPolicy, a$ as ExecutorConfig } from './coordination-CuDLO8wj.js';
8
8
  export { b0 as BusEvent, b1 as BusRecord, b2 as BusStats, b3 as EventBus, b4 as ProviderSeam, b5 as PublishOptions, b6 as cliWorktreeExecutor, b7 as createEventBus, b8 as createExecutor, b9 as createExecutorRegistry } from './coordination-CuDLO8wj.js';
@@ -679,6 +679,11 @@ interface DefinedLeaderboard<TCase, TArtifact = string> {
679
679
  /** The same domain surface in the structural `BenchmarkAdapter` shape. */
680
680
  toBenchmarkAdapter(): LeaderboardBenchmarkAdapter<TArtifact>;
681
681
  }
682
+ /**
683
+ * Assemble a declarative spec (`cases` + `prompt` + `score`) into a runnable
684
+ * harness×model leaderboard — `run()` executes the matrix, `toBenchmarkAdapter()`
685
+ * exposes the same domain as a structural `BenchmarkAdapter`.
686
+ */
682
687
  declare function defineLeaderboard<TCase, TArtifact = string>(spec: LeaderboardSpec<TCase, TArtifact>): DefinedLeaderboard<TCase, TArtifact>;
683
688
 
684
689
  /**
@@ -874,6 +879,182 @@ declare function inProcessSandboxClient(options: InProcessSandboxClientOptions):
874
879
  */
875
880
  declare function inlineSandboxClient(factory: ExecutorFactory<unknown>): SandboxClient;
876
881
 
882
+ /**
883
+ *
884
+ * The loop-executor — a spawnable, budget-conserving, gated, STEERABLE multi-round loop
885
+ * as a first-class atom, the sibling of the recursive driver-executor.
886
+ *
887
+ * A leaf worker runs one turn and settles. A driver child (driver-executor.ts) runs an
888
+ * LLM brain that spawns children and reacts. A LOOP child is the third shape: a CODED loop
889
+ * whose control flow is written, not left to a model's judgment. On `execute` it mounts a
890
+ * NESTED `Scope` (via the same `nested-scope` seam the driver-executor uses) one `depth`
891
+ * deeper over the SAME conserved pool + shared journal/blobs + open registry, then runs the
892
+ * authored loop's `round(ctx)` up to `maxRounds` times. Each round may spawn children into
893
+ * that nested scope (conserved budget, depth-bounded), and the runtime — not the authored
894
+ * body — owns the three guarantees a "loop" must make:
895
+ *
896
+ * - BOUNDED: at most `maxRounds` rounds; the run-wide conserved pool still fails a spawn
897
+ * closed at any depth, so a loop can never overspend the root ceiling.
898
+ * - GATED: the loop settles `valid` iff its deployable `check(out)` passes (the completion
899
+ * oracle, same discipline as `gateOnDeliverable`). A loop that exhausts `maxRounds`
900
+ * without the check ever passing settles `valid: false` — ran, did not deliver.
901
+ * - STEERABLE: the executor owns an `Inbox` and exposes `deliver`, so a supervisor's
902
+ * `steer_agent` (→ `Scope.send` → this `deliver`) lands between rounds. Queued messages
903
+ * fold into the next round's `ctx.steer`; a forceful `interrupt` aborts the in-flight
904
+ * round's linked signal so the loop re-plans immediately with the message folded in.
905
+ *
906
+ * Why this preserves every keystone invariant: identical to the driver-executor — the SCOPE
907
+ * owns the sharing (nested scope over `args.pool`, one `SpawnJournal` tree per child), this
908
+ * executor only runs the coded loop over what the scope mounts and rolls the sub-tree's
909
+ * conserved spend up on settle. It builds NO new budget, journal, or selection logic.
910
+ *
911
+ * The authored loop body is `defineLoop(name, { maxRounds, round, check })`. `round` is
912
+ * ordinary code — arbitrary composition inside a round (spawn one child, fan out many,
913
+ * pipeline) — while the runtime owns iteration, the budget, the gate, and steer-folding.
914
+ * So a loop is "codemode" (the author writes control flow) yet structurally bounded.
915
+ *
916
+ * @experimental
917
+ */
918
+
919
+ /** The runtime tag the registry maps a loop child to. */
920
+ declare const loopRuntime: "loop";
921
+ /** What one round of a loop receives. The scope is the NESTED scope — spawn conserved
922
+ * children here; budget/depth are enforced by the scope, not the body. */
923
+ interface LoopRoundCtx {
924
+ /** The spawn task, verbatim. */
925
+ readonly task: unknown;
926
+ /** The nested, conserved scope. Spawn children with `scope.spawn`, react with `scope.next`. */
927
+ readonly scope: Scope<unknown>;
928
+ /** 1-based round index. */
929
+ readonly round: number;
930
+ /** The declared ceiling on rounds. */
931
+ readonly maxRounds: number;
932
+ /** Supervisor `steer_agent` messages that arrived since the last round, folded to text. */
933
+ readonly steer: readonly string[];
934
+ /** Conserved-pool readouts (post-reservation) for in-body budget-awareness. */
935
+ readonly budget: Scope<unknown>['budget'];
936
+ /** Abort signal: the spawn signal + nested-scope signal + a fresh per-round interrupt.
937
+ * A forceful steer during the round aborts THIS signal so the body can break and re-plan. */
938
+ readonly signal: AbortSignal;
939
+ }
940
+ /** What a round returns. `out` is the running result; `done: true` stops the loop early
941
+ * (the author's own stop condition, distinct from the runtime's gate `check`). */
942
+ interface LoopRoundResult {
943
+ readonly out: unknown;
944
+ readonly done?: boolean;
945
+ }
946
+ /** An authored coded loop: a name, a round ceiling, the round body, and an optional
947
+ * deployable gate `check`. `check` decides DELIVERED — the loop settles `valid` iff it
948
+ * passes — and is polled after each round to stop as soon as the loop has delivered. */
949
+ interface LoopDef {
950
+ readonly name: string;
951
+ readonly maxRounds: number;
952
+ round(ctx: LoopRoundCtx): Promise<LoopRoundResult>;
953
+ /** The deployable completion oracle. `settled.valid ⟺ this resolves true`. A throwing
954
+ * check is fail-closed (not delivered). Omit for a loop whose only stop is `done`. */
955
+ check?(out: unknown): boolean | Promise<boolean>;
956
+ /** What the loop was supposed to produce — surfaced in traces. */
957
+ readonly describe?: string;
958
+ }
959
+ /** One named agent in a MULTI-AGENT loop (the `agents` form of `defineLoop`). `run` does the
960
+ * agent's work for a round; `prior` is the previous agent's output, or `ctx.task` for the first.
961
+ * The last agent's return is the round's `out`. So a proposer→verifier loop is just two agents. */
962
+ interface LoopAgent {
963
+ /** A short, human name for the agent this plays (proposer, verifier, engineer). */
964
+ readonly name: string;
965
+ run(ctx: LoopRoundCtx, prior: unknown): Promise<unknown>;
966
+ }
967
+ /**
968
+ * Author a coded loop atom. The returned `LoopDef` is handed to `loopChild` to become a
969
+ * spawnable `Agent`. The runtime owns `maxRounds`, the conserved budget, the gate, and
970
+ * steer-folding; you supply ONE of two round shapes:
971
+ *
972
+ * - `round` — freeform: write the whole round yourself (arbitrary code, may spawn children).
973
+ * - `agents` — declarative MULTI-AGENT: an ordered list of named agents piped each round
974
+ * (`task → agents[0] → agents[1] → … → out`). "How many agents" is self-evident from the
975
+ * list, so a two-agent research loop is `agents: [proposer, verifier]` — no bespoke function.
976
+ *
977
+ * Provide EXACTLY one of `round` / `agents`.
978
+ */
979
+ declare function defineLoop(name: string, spec: {
980
+ maxRounds: number;
981
+ round?: (ctx: LoopRoundCtx) => Promise<LoopRoundResult>;
982
+ agents?: readonly LoopAgent[];
983
+ check?: (out: unknown) => boolean | Promise<boolean>;
984
+ describe?: string;
985
+ }): LoopDef;
986
+ /**
987
+ * Mark + carry an authored loop so the recursive registry resolves it to the
988
+ * loop-executor. The returned agent is SPAWNED (never run directly): its `executorSpec` is
989
+ * marked `role: 'loop'` and carries the `LoopDef` + the shared journal. `act` fails loud if
990
+ * called directly — a loop child runs THROUGH its nested-scope executor, never as a root.
991
+ */
992
+ declare function loopChild<Out>(loop: LoopDef, journal: SpawnJournal): Agent<unknown, Out>;
993
+ /**
994
+ * Register the loop-executor so a child marked `role: 'loop'` resolves to it. Mirrors
995
+ * `withDriverExecutor`: a loop-role spec → the loop-executor; everything else → the base
996
+ * registry's resolution. Compose it WITH `withDriverExecutor` so loops and drivers coexist:
997
+ * `withLoopExecutor(withDriverExecutor(base))`.
998
+ */
999
+ declare function withLoopExecutor(base: ExecutorRegistry): ExecutorRegistry;
1000
+
1001
+ /**
1002
+ * authorLoop — the codemode layer over the loop atom: an LLM reads a goal + the defineLoop
1003
+ * contract and WRITES a coded loop as a module; the caller spawns it as a first-class atom
1004
+ * (`loopChild` → the loop-executor) and it settles gated on its own `check`, budget-conserved
1005
+ * and depth-bounded like any spawned child.
1006
+ *
1007
+ * This is to `defineLoop` what `authorStrategy` is to `defineStrategy`: the "supervisor writes
1008
+ * the loop" seam. The authored body composes real code (spawns children on the nested scope,
1009
+ * fans out, pipelines) while the runtime owns iteration, the conserved budget, the gate, and
1010
+ * steer-between-rounds — so an authored loop can be WRONG but cannot overspend the pool or
1011
+ * skip the completion check.
1012
+ *
1013
+ * Safety is structural, not a sandbox (mirrors `authorStrategy`): the same `assertStrategyContract`
1014
+ * lint bounds the module to the loops import and bans out-of-band compute (require/eval/fetch/
1015
+ * process/node builtins), and the authored module is written to `outDir` and dynamically imported
1016
+ * under a TS-capable loader (tsx) since models emit type annotations.
1017
+ */
1018
+
1019
+ /** The compressed consumable a skill carries: everything an author needs to emit a loop atom. */
1020
+ declare const loopAuthorContract = "\nYou author a LOOP ATOM for an agent supervisor. A loop runs a bounded, multi-round journey\ntoward a deployable check; a supervisor spawns / observes / steers it exactly like a worker.\nYou write ONE round; the runtime owns the round ceiling, the conserved budget, the gate, and\nfolding a supervisor's steer into the next round. So write real control flow inside a round,\nbut never write the loop's stop condition as \"hope the model stops\" \u2014 that is the runtime's job.\n\nYou export ONE module of EXACTLY this shape (no other imports, no commentary outside the code):\n\nimport { defineLoop } from '@tangle-network/agent-runtime/loops'\nexport default defineLoop('your-loop-name', {\n maxRounds: 3,\n round: async ({ task, scope, round, maxRounds, steer, budget, signal }) => {\n // arbitrary code for ONE round. Do real work by spawning children on the nested scope:\n // const w = scope.spawn(childAgent, subtask, { budget: perRound, label: `r${round}` })\n // if (!w.ok) throw new Error(w.reason) // fail loud: budget-exhausted | depth-exceeded\n // const settled = await scope.next() // conserved child work; settles gated\n // 'steer' is the supervisor's messages since the last round (fold them into what you do next).\n // 'signal' aborts if a forceful steer arrives mid-round \u2014 pass it to your awaited work.\n return { out: /* the running result */ undefined, done: false } // done:true stops early\n },\n check: (out) => /* the deployable completion oracle */ Boolean(out),\n})\n\nFor a MULTI-AGENT loop (a proposer then a verifier, a researcher then an engineer), do NOT\nhand-write the pipeline in 'round' \u2014 use 'agents' instead: an ordered list of named agents piped\neach round (task -> agents[0] -> agents[1] -> ... -> out). \"How many agents\" is then self-evident.\n\nimport { defineLoop } from '@tangle-network/agent-runtime/loops'\nexport default defineLoop('your-loop-name', {\n maxRounds: 3,\n agents: [\n { name: 'proposer', run: async (ctx, prior) => { /* spawn a worker, produce a draft */ return draft } },\n { name: 'verifier', run: async (ctx, prior) => { /* verify/refine the proposer's draft */ return checked } },\n ],\n check: (out) => Boolean(out),\n})\n\nProvide EXACTLY one of 'round' or 'agents'. The round context (for the 'round' form, and passed to\neach agent's run as its first arg):\n task the spawn task, verbatim.\n scope the NESTED conserved scope. scope.spawn(agent, task, { budget, label }) reserves\n budget and fails closed; scope.next() awaits one child settlement. Budget NESTS \u2014\n the pool reserves each spawn's full ceiling until it settles, so give children a\n per-round budget smaller than the loop's own.\n round 1-based round index. maxRounds is the declared ceiling.\n steer readonly string[] \u2014 supervisor steer_agent messages that arrived since last round.\n budget conserved-pool readouts (tokensLeft, usdLeft, deadlineMs) for in-body awareness.\n signal AbortSignal \u2014 the spawn signal + a fresh per-round interrupt; honor it in awaits.\n\nThe round result: { out: unknown; done?: boolean }. 'out' is the running result the gate reads;\n'done: true' is YOUR early stop (distinct from the runtime's gate 'check').\n\ncheck(out): boolean | Promise<boolean>. The DEPLOYABLE oracle \u2014 an executable test, a state\nverifier, a readiness score threshold \u2014 read off 'out', never the model judging itself. The loop\nsettles valid IFF check passes, and the runtime polls it after each round to stop the instant the\nloop has delivered. A loop that exhausts maxRounds without check passing settles valid:false.\n\nRules:\n- ALWAYS await every scope.spawn drain / async call \u2014 a floating rejection crashes the run.\n- Do real work by SPAWNING children; raw un-metered inference in the body is not budget-conserved.\n- Give 'check' a real oracle. A loop whose check is a self-judged score cannot be trusted.\n- The only import allowed is '@tangle-network/agent-runtime/loops'. No require/eval/fetch/process/\n node builtins \u2014 the runtime meters and gates you; out-of-band compute breaks that.\n";
1021
+ interface AuthorLoopOptions {
1022
+ /** The model-call seam (agent-eval `createChatClient`). */
1023
+ chat: ChatClient;
1024
+ model?: string;
1025
+ /** A NAMED fallback author tried once when the primary call fails or returns no code block
1026
+ * (thinking models can time out at the edge on long authoring prompts, or return empty
1027
+ * content without `maxTokens`). Opt-in — absent means the primary's failure propagates. */
1028
+ fallbackModel?: string;
1029
+ /** The contract text shown to the author. Default `loopAuthorContract`. A skill/GEPA loop can
1030
+ * evolve this text and gate each variant on the same check as any loop. */
1031
+ contract?: string;
1032
+ /** What the loop must accomplish — the objective, in plain language (the author's orientation). */
1033
+ goal: string;
1034
+ /** Optional orienting context: the check's shape, the child agents available, prior findings —
1035
+ * never the check's internals (the author stays blind to the oracle, like `authorStrategy`). */
1036
+ context?: string;
1037
+ /** The round ceiling the loop must respect. */
1038
+ maxRounds: number;
1039
+ /** Where the authored module file is written (created if missing). */
1040
+ outDir: string;
1041
+ temperature?: number;
1042
+ /** Completion cap — required by thinking-model authors that stream reasoning first. */
1043
+ maxTokens?: number;
1044
+ signal?: AbortSignal;
1045
+ }
1046
+ interface AuthoredLoop {
1047
+ loop: LoopDef;
1048
+ file: string;
1049
+ code: string;
1050
+ }
1051
+ /**
1052
+ * Author + load a coded loop from a goal. Throws when the author emits no loadable module; with
1053
+ * `fallbackModel` set, the named fallback gets one attempt first. The returned `loop` is handed
1054
+ * to `loopChild(loop, journal)` and spawned as a first-class atom.
1055
+ */
1056
+ declare function authorLoop(opts: AuthorLoopOptions): Promise<AuthoredLoop>;
1057
+
877
1058
  /**
878
1059
  *
879
1060
  * `runLoop` — the topology-agnostic kernel built atop the sandbox SDK.
@@ -2120,7 +2301,12 @@ interface SandboxToolPartState {
2120
2301
  /** Sequence for synthesized call ids when an event carries none. */
2121
2302
  seq: number;
2122
2303
  }
2123
- /** @experimental */
2304
+ /**
2305
+ * Fresh per-turn {@link SandboxToolPartState} for {@link mapSandboxToolEvent} — an
2306
+ * empty call-status map so each turn projects tool frames independently.
2307
+ *
2308
+ * @experimental
2309
+ */
2124
2310
  declare function createSandboxToolPartState(): SandboxToolPartState;
2125
2311
  /**
2126
2312
  * Project one `SandboxEvent` onto the `tool_call` / `tool_result` variants of
@@ -2236,7 +2422,7 @@ interface SandboxLineage {
2236
2422
  * Acquire a fresh box and begin a new session on it. Returns the handle and
2237
2423
  * the live `streamPrompt` iterable for the first turn (caller drains it).
2238
2424
  */
2239
- start(spec: AgentRunSpec<unknown>, prompt: string, signal: AbortSignal): Promise<{
2425
+ start(spec: AgentRunSpec<unknown>, prompt: string, signal: AbortSignal, promptOptions?: Omit<PromptOptions, 'signal' | 'sessionId'>): Promise<{
2240
2426
  handle: SandboxLineageHandle;
2241
2427
  events: AsyncIterable<SandboxEvent>;
2242
2428
  }>;
@@ -2247,7 +2433,7 @@ interface SandboxLineage {
2247
2433
  * silently dropped the client-minted session id surfaces as an error instead
2248
2434
  * of a contextless turn the caller mistakes for a real continuation.
2249
2435
  */
2250
- continue(handle: SandboxLineageHandle, prompt: string, signal: AbortSignal): Promise<AsyncIterable<SandboxEvent>>;
2436
+ continue(handle: SandboxLineageHandle, prompt: string, signal: AbortSignal, promptOptions?: Omit<PromptOptions, 'signal' | 'sessionId'>): Promise<AsyncIterable<SandboxEvent>>;
2251
2437
  /**
2252
2438
  * Branch `count` children from `parent`. When the platform can fork, each
2253
2439
  * child inherits `parent`'s checkpoint — and therefore the parent's IMAGE and
@@ -2414,6 +2600,14 @@ interface SandboxRun<Out> {
2414
2600
  resume(prompt: string): Promise<TurnResult<Out>>;
2415
2601
  close(): Promise<void>;
2416
2602
  }
2603
+ /** Prompt options forwarded to every sandbox prompt turn in this run. The
2604
+ * runtime owns `sessionId` and `signal` so callers cannot accidentally break
2605
+ * resume or cancellation semantics while still setting backend-level prompt
2606
+ * controls such as `timeoutMs`.
2607
+ *
2608
+ * @experimental
2609
+ */
2610
+ type OpenSandboxRunPromptOptions = Omit<PromptOptions, 'signal' | 'sessionId'>;
2417
2611
  /** @experimental */
2418
2612
  interface OpenSandboxRunOptions {
2419
2613
  /** Profile + sandbox env/overrides. `sandboxOverrides.backend.type` is the harness. */
@@ -2425,6 +2619,9 @@ interface OpenSandboxRunOptions {
2425
2619
  runId?: string;
2426
2620
  /** Optional benchmark/scenario id carried into emitted hook events. */
2427
2621
  scenarioId?: string;
2622
+ /** Per-prompt sandbox SDK options forwarded to both `start()` and `resume()`.
2623
+ * The runtime still owns the session id and abort signal for each turn. */
2624
+ promptOptions?: OpenSandboxRunPromptOptions;
2428
2625
  /** Test seam for deterministic hook timestamps. Defaults to `Date.now`. */
2429
2626
  now?: () => number;
2430
2627
  /** Bounds box-creation bursts inside lineage fanout. Default from lineage. */
@@ -3693,6 +3890,13 @@ interface InMemoryRunContextOptions {
3693
3890
  * leaf workers. Default `false`.
3694
3891
  */
3695
3892
  readonly withDriver?: boolean;
3893
+ /**
3894
+ * Wrap the executor registry with `withLoopExecutor` so a spawned child marked
3895
+ * `role: 'loop'` resolves to the loop-executor (a coded, budget-conserving, gated,
3896
+ * steerable multi-round loop over a nested `Scope` on the same pool). Composes with
3897
+ * `withDriver` so loops and drivers coexist. Default `false`.
3898
+ */
3899
+ readonly withLoop?: boolean;
3696
3900
  }
3697
3901
  /**
3698
3902
  * The bundle of stores a supervised run needs, shaped to spread into `SupervisorOpts`.
@@ -4068,4 +4272,4 @@ declare function runInWorkspace<T>(ws: Workspace, body: (cwd: string) => Promise
4068
4272
  commitOnInvalid?: boolean;
4069
4273
  }): Promise<WorkspaceRun<T>>;
4070
4274
 
4071
- export { Agent, AgentRunSpec, type AgentTurnBackend, type AgentTurnUsage, type AgenticOptions, type AgenticRunResult, type AgenticSurface, type AgenticTask, type AgenticTool, AnalystRegistry, type AnytimeReport, type AnytimeStrategySummary, type AnytimeTaskCurve, type ApplyContinuation, type ArtifactHandle, AssertTraceDerivedFindings, type AuditIntentInput, type AuditIntentOptions, type AuthorStrategyOptions, type AuthoredProfile, type AuthoredStrategy, type BenchmarkCell, type BenchmarkConfig, type BenchmarkLift, type BenchmarkReport, type BenchmarkStrategySummary, type BenchmarkTaskRow, Budget, type BudgetPool, type BudgetReadout, type ChampionPick, type ChampionPolicy, type CheckpointCapableBox, type CollectedAgentTurn, CombinatorShape, type CompletionAnalyst, type CompletionEvidence, type CompletionPolicy, type CompletionVerdict, CoordinationEvent, type CoordinationMcpHandle, Corpus, CorpusFilter, CorpusRecord, type CreateScopeAnalystOptions, type CriuCapableClient, DefinePersonaInput, type DefinedLeaderboard, type DelegateOptions, type Deliverable, DeliverableSpec, type DriveHarness, Driver, type DriverAgentOptions, type DumbDriverOptions, type Environment, EqualKArm, EqualKOnCostOptions, EqualKVerdict, type EvolutionArchiveNode, type EvolutionAuthor, type EvolutionBandInfo, type EvolutionCandidate, type EvolutionGeneration, type EvolutionReport, ExecCtx, ExecutorConfig, ExecutorFactory, ExecutorRegistry, FanoutOptions, FanoutWinnerSelector, FileCorpus, type ForkCapableBox, type GitWorkspaceOptions, type HarvestCorpusOptions, type HarvestFailure, type HarvestReport, InMemoryCorpus, InMemoryResultBlobStore, type InMemoryRunContext, type InMemoryRunContextOptions, InMemorySpawnJournal, type InProcessOnPrompt, type InProcessPromptCtx, type InProcessSandboxClientOptions, type Inbox, type InboxMessage, type IntentAudit, type Interval, Iteration, type Leaderboard, type LeaderboardBenchScore, type LeaderboardBenchTask, type LeaderboardBenchmarkAdapter, type LeaderboardFlagSpec, type LeaderboardIterationInfo, type LeaderboardOptions, type LeaderboardRow, type LeaderboardRunContext, type LeaderboardScenario, type LeaderboardScore, type LeaderboardSpec, type LoopCampaignDispatchOptions, type LoopDispatchOptions, LoopLineageOptions, type LoopOptionsForDispatch, LoopResult, LoopShape, LoopTokenUsage, LoopUntilSpec, LoopWinner, MakeWorkerAgent, type McpEndpoint, type McpEnvironmentOptions, MountRecorder, type NaiveDriverOptions, type Observation, type ObserveInput, type ObserveOptions, type OpenSandboxRunOptions, Outcome, OutputAdapter, type PairwiseOptions, type PairwiseVerdict, PanelSpec, Persona, PipelineStage, type ProfileRichness, type ProfileRichnessThresholds, type PromotionGateOptions, type PromotionVerdict, type RegistryAnalyzeProjection, RenderCorpusToInstructionsOptions, type ReservationTicket, type ResolveSandboxClientOptions, ResultBlobStore, RouterConfig, type RunAgenticOptions, RunPersonifiedOptions, type SandboxCapabilities, SandboxClient, type SandboxLineage, type SandboxLineageHandle, type SandboxRun, SandboxRunAbortError, type SandboxToolPartState, Scope, ScopeAnalyst, ScopeAnalyzeInput, ScopeWidenGate, type SessionCapableBox, type SessionTraceBox, Settled, ShapeRegistry, type Shell, type ShotPersona, type ShotSpec, Spend, SteerContext, type SteeringDecision, type Strategy, type StrategyCtx, type StrategyEvolutionConfig, type StrategyResult, type StreamAgentTurnOptions, type SuperviseOptions, type SuperviseSurfaceOptions, type SuperviseSurfaceResult, SupervisedResult, Supervisor, type SupervisorAgentDeps, type SupervisorProfile, type SurfaceScore, type SurfaceWorkerConfig, type SurfaceWorkerOut, ToolLoopChat, ToolLoopCompactionOptions, type TraceSource, type TrajectoryAnalysis, TrajectoryReport, TrajectoryReportOptions, type TurnResult, UsageEvent, type UsageSink, Validator, type VerifierEnvironmentOptions, VerifySpec, type WatchTraceOptions, type WaterfallCollector, type WaterfallReport, type WaterfallSpan, WidenSpec, WinnerStrategy, type Workspace, type WorkspaceCommit, type WorkspaceRun, acquireSandbox, adaptiveRefine, analyzeTrace, anytimeReport, asAuthoredProfile, assertModelAllowed, assertStrategyContract, assertTraceDerivedFindings, assessAuthoredProfile, auditIntent, authorStrategy, authoredWorker, breadthStrategy, buildSteerContext, builtinShapes, collectAgentTurn, completionAuthorizes, contentAddress, createBudgetPool, createInMemoryRunContext, createInbox, createMcpEnvironment, createPushTraceSource, createSandboxLineage, createSandboxToolPartState, createScope, createScopeAnalyst, createShapeRegistry, createSupervisor, createVerifierEnvironment, createWaterfallCollector, decodeToolPart, defaultAnalystInstruction, defaultAuditorInstruction, defaultDelegateBudget, defaultProfileRichnessThresholds, defaultSelectWinner, defaultToolDetectors, defineLeaderboard, definePersona, defineStrategy, delegate, depthStrategy, deterministicCompletion, discriminatingMeans, driverAgent, dumbDriver, equalKOnCost, extractLlmCallEvent, failuresAnalyst, fanout, finalizeBestDelivered, flatWidenGate, gitWorkspace, harvestCorpus, inProcessSandboxClient, inlineSandboxClient, jjWorkspace, leaderboard, localShell, loopCampaignDispatch, loopDispatch, loopUntil, mapSandboxEvent, mapSandboxToolEvent, naiveDriver, observe, openSandboxRun, pairwiseSignificance, panel, pickChampion, pipeline, printBenchmarkReport, probeSandboxCapabilities, profileRichnessFinding, promotionGate, refine, registerShape, registryScopeAnalyst, renderAnytimeTable, renderCorpusToInstructions, renderLeaderboardHtml, renderLeaderboardMarkdown, renderLeaderboardSvg, renderPairwiseMarkdown, renderReport, reportLoopUsage, resolveSandboxClient, runAgentic, runBenchmark, runInWorkspace, runLoop, runPersonified, runStrategyEvolution, sample, sampleThenRefine, sandboxSessionTraceSource, selectChampion, selectValidWinner, sentinelCompletion, serveCoordinationMcp, settledToIteration, spendFromUsageEvents, stopSentinel, strategyAuthorContract, streamAgentTurn, sumSandboxUsage, supervise, superviseSurface, supervisorAgent, supervisorInstructions, trajectoryReport, verify, watchTrace, widen, workerFromBackend };
4275
+ export { Agent, AgentRunSpec, type AgentTurnBackend, type AgentTurnUsage, type AgenticOptions, type AgenticRunResult, type AgenticSurface, type AgenticTask, type AgenticTool, AnalystRegistry, type AnytimeReport, type AnytimeStrategySummary, type AnytimeTaskCurve, type ApplyContinuation, type ArtifactHandle, AssertTraceDerivedFindings, type AuditIntentInput, type AuditIntentOptions, type AuthorLoopOptions, type AuthorStrategyOptions, type AuthoredLoop, type AuthoredProfile, type AuthoredStrategy, type BenchmarkCell, type BenchmarkConfig, type BenchmarkLift, type BenchmarkReport, type BenchmarkStrategySummary, type BenchmarkTaskRow, Budget, type BudgetPool, type BudgetReadout, type ChampionPick, type ChampionPolicy, type CheckpointCapableBox, type CollectedAgentTurn, CombinatorShape, type CompletionAnalyst, type CompletionEvidence, type CompletionPolicy, type CompletionVerdict, CoordinationEvent, type CoordinationMcpHandle, Corpus, CorpusFilter, CorpusRecord, type CreateScopeAnalystOptions, type CriuCapableClient, DefinePersonaInput, type DefinedLeaderboard, type DelegateOptions, type Deliverable, DeliverableSpec, type DriveHarness, Driver, type DriverAgentOptions, type DumbDriverOptions, type Environment, EqualKArm, EqualKOnCostOptions, EqualKVerdict, type EvolutionArchiveNode, type EvolutionAuthor, type EvolutionBandInfo, type EvolutionCandidate, type EvolutionGeneration, type EvolutionReport, ExecCtx, ExecutorConfig, ExecutorFactory, ExecutorRegistry, FanoutOptions, FanoutWinnerSelector, FileCorpus, type ForkCapableBox, type GitWorkspaceOptions, type HarvestCorpusOptions, type HarvestFailure, type HarvestReport, InMemoryCorpus, InMemoryResultBlobStore, type InMemoryRunContext, type InMemoryRunContextOptions, InMemorySpawnJournal, type InProcessOnPrompt, type InProcessPromptCtx, type InProcessSandboxClientOptions, type Inbox, type InboxMessage, type IntentAudit, type Interval, Iteration, type Leaderboard, type LeaderboardBenchScore, type LeaderboardBenchTask, type LeaderboardBenchmarkAdapter, type LeaderboardFlagSpec, type LeaderboardIterationInfo, type LeaderboardOptions, type LeaderboardRow, type LeaderboardRunContext, type LeaderboardScenario, type LeaderboardScore, type LeaderboardSpec, type LoopAgent, type LoopCampaignDispatchOptions, type LoopDef, type LoopDispatchOptions, LoopLineageOptions, type LoopOptionsForDispatch, LoopResult, type LoopRoundCtx, type LoopRoundResult, LoopShape, LoopTokenUsage, LoopUntilSpec, LoopWinner, MakeWorkerAgent, type McpEndpoint, type McpEnvironmentOptions, MountRecorder, type NaiveDriverOptions, type Observation, type ObserveInput, type ObserveOptions, type OpenSandboxRunOptions, type OpenSandboxRunPromptOptions, Outcome, OutputAdapter, type PairwiseOptions, type PairwiseVerdict, PanelSpec, Persona, PipelineStage, type ProfileRichness, type ProfileRichnessThresholds, type PromotionGateOptions, type PromotionVerdict, type RegistryAnalyzeProjection, RenderCorpusToInstructionsOptions, type ReservationTicket, type ResolveSandboxClientOptions, ResultBlobStore, RouterConfig, type RunAgenticOptions, RunPersonifiedOptions, type SandboxCapabilities, SandboxClient, type SandboxLineage, type SandboxLineageHandle, type SandboxRun, SandboxRunAbortError, type SandboxToolPartState, Scope, ScopeAnalyst, ScopeAnalyzeInput, ScopeWidenGate, type SessionCapableBox, type SessionTraceBox, Settled, ShapeRegistry, type Shell, type ShotPersona, type ShotSpec, Spend, SteerContext, type SteeringDecision, type Strategy, type StrategyCtx, type StrategyEvolutionConfig, type StrategyResult, type StreamAgentTurnOptions, type SuperviseOptions, type SuperviseSurfaceOptions, type SuperviseSurfaceResult, SupervisedResult, Supervisor, type SupervisorAgentDeps, type SupervisorProfile, type SurfaceScore, type SurfaceWorkerConfig, type SurfaceWorkerOut, ToolLoopChat, ToolLoopCompactionOptions, type TraceSource, type TrajectoryAnalysis, TrajectoryReport, TrajectoryReportOptions, type TurnResult, UsageEvent, type UsageSink, Validator, type VerifierEnvironmentOptions, VerifySpec, type WatchTraceOptions, type WaterfallCollector, type WaterfallReport, type WaterfallSpan, WidenSpec, WinnerStrategy, type Workspace, type WorkspaceCommit, type WorkspaceRun, acquireSandbox, adaptiveRefine, analyzeTrace, anytimeReport, asAuthoredProfile, assertModelAllowed, assertStrategyContract, assertTraceDerivedFindings, assessAuthoredProfile, auditIntent, authorLoop, authorStrategy, authoredWorker, breadthStrategy, buildSteerContext, builtinShapes, collectAgentTurn, completionAuthorizes, contentAddress, createBudgetPool, createInMemoryRunContext, createInbox, createMcpEnvironment, createPushTraceSource, createSandboxLineage, createSandboxToolPartState, createScope, createScopeAnalyst, createShapeRegistry, createSupervisor, createVerifierEnvironment, createWaterfallCollector, decodeToolPart, defaultAnalystInstruction, defaultAuditorInstruction, defaultDelegateBudget, defaultProfileRichnessThresholds, defaultSelectWinner, defaultToolDetectors, defineLeaderboard, defineLoop, definePersona, defineStrategy, delegate, depthStrategy, deterministicCompletion, discriminatingMeans, driverAgent, dumbDriver, equalKOnCost, extractLlmCallEvent, failuresAnalyst, fanout, finalizeBestDelivered, flatWidenGate, gitWorkspace, harvestCorpus, inProcessSandboxClient, inlineSandboxClient, jjWorkspace, leaderboard, localShell, loopAuthorContract, loopCampaignDispatch, loopChild, loopDispatch, loopRuntime, loopUntil, mapSandboxEvent, mapSandboxToolEvent, naiveDriver, observe, openSandboxRun, pairwiseSignificance, panel, pickChampion, pipeline, printBenchmarkReport, probeSandboxCapabilities, profileRichnessFinding, promotionGate, refine, registerShape, registryScopeAnalyst, renderAnytimeTable, renderCorpusToInstructions, renderLeaderboardHtml, renderLeaderboardMarkdown, renderLeaderboardSvg, renderPairwiseMarkdown, renderReport, reportLoopUsage, resolveSandboxClient, runAgentic, runBenchmark, runInWorkspace, runLoop, runPersonified, runStrategyEvolution, sample, sampleThenRefine, sandboxSessionTraceSource, selectChampion, selectValidWinner, sentinelCompletion, serveCoordinationMcp, settledToIteration, spendFromUsageEvents, stopSentinel, strategyAuthorContract, streamAgentTurn, sumSandboxUsage, supervise, superviseSurface, supervisorAgent, supervisorInstructions, trajectoryReport, verify, watchTrace, widen, withLoopExecutor, workerFromBackend };
package/dist/loops.js CHANGED
@@ -8,6 +8,7 @@ import {
8
8
  assertStrategyContract,
9
9
  assertTraceDerivedFindings,
10
10
  auditIntent,
11
+ authorLoop,
11
12
  authorStrategy,
12
13
  breadthStrategy,
13
14
  buildSteerContext,
@@ -43,6 +44,7 @@ import {
43
44
  jjWorkspace,
44
45
  leaderboard,
45
46
  localShell,
47
+ loopAuthorContract,
46
48
  loopCampaignDispatch,
47
49
  loopDispatch,
48
50
  loopUntil,
@@ -89,7 +91,7 @@ import {
89
91
  watchTrace,
90
92
  widen,
91
93
  worktreeFanout
92
- } from "./chunk-VKVNDNG4.js";
94
+ } from "./chunk-22HPUH77.js";
93
95
  import {
94
96
  InMemoryResultBlobStore,
95
97
  InMemorySpawnJournal,
@@ -113,10 +115,13 @@ import {
113
115
  defaultDelegateBudget,
114
116
  defaultProfileRichnessThresholds,
115
117
  defaultSelectWinner,
118
+ defineLoop,
116
119
  delegate,
117
120
  driverAgent,
118
121
  finalizeBestDelivered,
119
122
  gateOnDeliverable,
123
+ loopChild,
124
+ loopRuntime,
120
125
  probeSandboxCapabilities,
121
126
  profileRichnessFinding,
122
127
  routerBrain,
@@ -130,8 +135,9 @@ import {
130
135
  supervise,
131
136
  supervisorAgent,
132
137
  supervisorInstructions,
138
+ withLoopExecutor,
133
139
  workerFromBackend
134
- } from "./chunk-6XCW3M7W.js";
140
+ } from "./chunk-LRNRPJAV.js";
135
141
  import "./chunk-UD4BHQMI.js";
136
142
  import {
137
143
  createAgentEnvironmentProviderRegistry,
@@ -146,7 +152,7 @@ import {
146
152
  mapSandboxEvent,
147
153
  mapSandboxToolEvent,
148
154
  sumSandboxUsage
149
- } from "./chunk-QUXZBZCS.js";
155
+ } from "./chunk-FVJ7M3DA.js";
150
156
  import "./chunk-7LO5GMAO.js";
151
157
  import "./chunk-YEJR7IXO.js";
152
158
  import "./chunk-DPEUKJRO.js";
@@ -167,6 +173,7 @@ export {
167
173
  assertTraceDerivedFindings,
168
174
  assessAuthoredProfile,
169
175
  auditIntent,
176
+ authorLoop,
170
177
  authorStrategy,
171
178
  authoredWorker,
172
179
  breadthStrategy,
@@ -203,6 +210,7 @@ export {
203
210
  defaultSelectWinner,
204
211
  defaultToolDetectors,
205
212
  defineLeaderboard,
213
+ defineLoop,
206
214
  definePersona,
207
215
  defineStrategy,
208
216
  delegate,
@@ -225,8 +233,11 @@ export {
225
233
  jjWorkspace,
226
234
  leaderboard,
227
235
  localShell,
236
+ loopAuthorContract,
228
237
  loopCampaignDispatch,
238
+ loopChild,
229
239
  loopDispatch,
240
+ loopRuntime,
230
241
  loopUntil,
231
242
  makeFinding,
232
243
  mapSandboxEvent,
@@ -290,6 +301,7 @@ export {
290
301
  verify,
291
302
  watchTrace,
292
303
  widen,
304
+ withLoopExecutor,
293
305
  workerFromBackend,
294
306
  worktreeFanout
295
307
  };
package/dist/mcp/bin.js CHANGED
@@ -9,10 +9,10 @@ import {
9
9
  DelegationTaskQueue,
10
10
  FileDelegationStore,
11
11
  createMcpServer
12
- } from "../chunk-6XCW3M7W.js";
12
+ } from "../chunk-LRNRPJAV.js";
13
13
  import "../chunk-UD4BHQMI.js";
14
14
  import "../chunk-BZF3KQ6G.js";
15
- import "../chunk-QUXZBZCS.js";
15
+ import "../chunk-FVJ7M3DA.js";
16
16
  import "../chunk-7LO5GMAO.js";
17
17
  import "../chunk-YEJR7IXO.js";
18
18
  import "../chunk-DPEUKJRO.js";
package/dist/mcp/index.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  import {
7
7
  mcpToolsForRuntimeMcp,
8
8
  mcpToolsForRuntimeMcpSubset
9
- } from "../chunk-MHYF2LIP.js";
9
+ } from "../chunk-JHULWWQD.js";
10
10
  import {
11
11
  createKbGate
12
12
  } from "../chunk-SGKPNBXE.js";
@@ -14,7 +14,7 @@ import {
14
14
  assertTraceDerivedFindings,
15
15
  runCoderChecks,
16
16
  selectValidWinner
17
- } from "../chunk-VKVNDNG4.js";
17
+ } from "../chunk-22HPUH77.js";
18
18
  import {
19
19
  DELEGATE_DESCRIPTION,
20
20
  DELEGATE_FEEDBACK_DESCRIPTION,
@@ -64,7 +64,7 @@ import {
64
64
  validateDelegateUiAuditArgs,
65
65
  validateDelegationHistoryArgs,
66
66
  validateDelegationStatusArgs
67
- } from "../chunk-6XCW3M7W.js";
67
+ } from "../chunk-LRNRPJAV.js";
68
68
  import "../chunk-UD4BHQMI.js";
69
69
  import {
70
70
  deleteBoxSafe,
@@ -72,7 +72,7 @@ import {
72
72
  throwAbort,
73
73
  throwIfAborted
74
74
  } from "../chunk-BZF3KQ6G.js";
75
- import "../chunk-QUXZBZCS.js";
75
+ import "../chunk-FVJ7M3DA.js";
76
76
  import {
77
77
  runLocalHarness
78
78
  } from "../chunk-7LO5GMAO.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-runtime",
3
- "version": "0.87.0",
3
+ "version": "0.88.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": {
@@ -94,7 +94,7 @@
94
94
  },
95
95
  "devDependencies": {
96
96
  "@biomejs/biome": "^2.4.15",
97
- "@tangle-network/agent-eval": "^0.103.1",
97
+ "@tangle-network/agent-eval": "^0.103.2",
98
98
  "@tangle-network/agent-interface": ">=0.14.0 <1.0.0",
99
99
  "@tangle-network/sandbox": ">=0.8.0 <1.0.0",
100
100
  "@types/node": "^25.9.3",
@@ -78,6 +78,8 @@ to its native default (`HARNESS_NATIVE_MODEL`) — never silently dropped.
78
78
  | **Produce-then-gate / multi-judge quorum / fixed chain** | `verify` / `panel` / `pipeline` — `/loops` | canonical-api §3.1 |
79
79
  | **Run depth-vs-breadth (or a custom strategy) over a stateful tool domain** | `runAgentic({ surface, task, mode\|strategy, budget })` — `/loops` | canonical-api §3.3 |
80
80
  | **Author a new topology/strategy compactly** | `defineStrategy(name, body)` w/ `ctx.shot()`+`ctx.critique()` — `/loops` | canonical-api §3.3 |
81
+ | **Spawn a coded loop as a first-class atom** (bounded/gated/steerable, spawned + steered like a worker — the 3rd shape beside leaf worker + driver child) | `defineLoop(name, { maxRounds, round | agents, check })` + `loopChild`, wired via `createInMemoryRunContext({ withLoop: true })` — `/loops` — multi-agent = `agents: [proposer, verifier]` (declarative chain, not a bespoke `runTwoAgent…` fn); NOT a hand-driver looping in the model's head; the loop-executor owns maxRounds + conserved budget + gate + steer-between-rounds | canonical-api decision table |
82
+ | **Have an LLM AUTHOR a loop at runtime** (codemode: the supervisor writes a `defineLoop` module for a novel goal) | `authorLoop({ chat, goal, maxRounds, outDir })` → a `LoopDef` for `loopChild` — `/loops` — NOT a per-product loop-code generator or a VM around authored code; the sibling of `authorStrategy`, safety is the conserved pool + gate + `assertStrategyContract` lint | `src/runtime/loop-author.ts` |
81
83
  | **Add a stateful tool-using domain** | implement `AgenticSurface` (5 hooks) — `/loops` | canonical-api §3.3 |
82
84
  | **Drive a team of agents over a graded `AgenticSurface` task** (workers settle on its check, driver self-improves from the failing tests) | `superviseSurface(profile, task, { surface, worker })` — `/loops` | canonical-api §2 |
83
85
  | **Benchmark: compare strategies + significance + Pareto on a domain** | `runBenchmark({ environment, tasks, worker, strategies })` — `/loops` | canonical-api §3.3 |
@@ -148,6 +150,10 @@ holds the load-bearing invariant the parallel breaks:
148
150
  - a per-provider stream→event mapper for a single agent turn **≈**
149
151
  `streamAgentTurn` + `collectAgentTurn` (0.85+; one `RuntimeStreamEvent`
150
152
  contract over box / executor / chat, guaranteed terminal result+usage).
153
+ - a supervisor `act` with a `for (round…)` loop that spawns + checks + continues
154
+ in the model's reasoning **≈** `defineLoop` + `loopChild` (the loop-executor
155
+ enforces the round ceiling, the conserved pool, the completion gate, and
156
+ steer-between-rounds; a hand-driver loop enforces none of them).
151
157
 
152
158
  ## End-to-end recipe
153
159