@tangle-network/agent-runtime 0.86.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.
@@ -2,14 +2,14 @@
2
2
  import {
3
3
  parseLoopRunnerArgv,
4
4
  runLoopRunnerCli
5
- } from "./chunk-EJ7MAQN4.js";
5
+ } from "./chunk-HBE77SWV.js";
6
6
  import "./chunk-SGKPNBXE.js";
7
- import "./chunk-3TZOXS7B.js";
8
- import "./chunk-F7OO2SKB.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-YPA5MLVE.js";
12
- import "./chunk-4J6RBI3K.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
@@ -1,8 +1,8 @@
1
1
  import { ChatClient, RunRecord, HarnessType, AgentProfile, AnalystFinding, AnalystRunInputs, ToolSpan, StreamingDetector, DetectorSignal, buildTrajectory } from '@tangle-network/agent-eval';
2
2
  export { AnalystFinding, DefaultVerdict, computeFindingId, makeFinding } from '@tangle-network/agent-eval';
3
- import { SandboxEvent, SandboxInstance, CreateSandboxOptions } from '@tangle-network/sandbox';
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
  /**
@@ -802,10 +807,11 @@ interface HarvestReport {
802
807
  /** Batch the firewalled `observe()` analyst over completed runs and accrete the trace-derived facts into the durable corpus — the production-traces→corpus write side of the flywheel. */
803
808
  declare function harvestCorpus(opts: HarvestCorpusOptions): Promise<HarvestReport>;
804
809
 
805
- /** Context handed to each `onPrompt` call. */
810
+ /** Context handed to each `onPrompt` / `onTask` call. */
806
811
  interface InProcessPromptCtx {
807
- /** 0-based round index — increments per `streamPrompt` on the SAME box (so a
808
- * refine driver's round N can differ from round N-1). Fresh boxes start at 0. */
812
+ /** 0-based round index — increments per `streamPrompt`/`streamTask` on the
813
+ * SAME box (so a refine driver's round N can differ from round N-1). Fresh
814
+ * boxes start at 0. */
809
815
  round: number;
810
816
  /** Absolute path of this box's workspace, when a `workdir` was configured.
811
817
  * Write the deliverable / fixtures here; `fs.read`/`fs.write`/`exec` operate
@@ -813,6 +819,13 @@ interface InProcessPromptCtx {
813
819
  workdir?: string;
814
820
  /** Cooperative cancellation channel for this turn. */
815
821
  signal: AbortSignal;
822
+ /** Which box verb produced this call: `prompt` = `streamPrompt`,
823
+ * `task` = `streamTask`. */
824
+ mode: 'prompt' | 'task';
825
+ /** The verbatim per-call options the caller passed to the box verb (minus
826
+ * `signal`, surfaced above) — lets an offline test assert an options
827
+ * passthrough (`model`, `sessionId`, `maxTurns`, …) actually arrived. */
828
+ options?: Record<string, unknown>;
816
829
  }
817
830
  /**
818
831
  * The user callback: given a prompt and its round, produce the box's event
@@ -825,6 +838,14 @@ type InProcessOnPrompt = (prompt: string, ctx: InProcessPromptCtx) => SandboxEve
825
838
  interface InProcessSandboxClientOptions {
826
839
  /** The per-turn behavior — see {@link InProcessOnPrompt}. */
827
840
  onPrompt: InProcessOnPrompt;
841
+ /**
842
+ * Task-mode behavior, driven by `box.streamTask` (the verb `streamAgentTurn`'s
843
+ * `box-task` backend calls). When omitted, `streamTask` drives `onPrompt` —
844
+ * the pseudo-box has ONE behavior callback and both verbs exercise it
845
+ * (`ctx.mode` tells them apart). Provide `onTask` when a test must
846
+ * discriminate the verbs or script different task-mode behavior.
847
+ */
848
+ onTask?: InProcessOnPrompt;
828
849
  /**
829
850
  * Opt in to a REAL filesystem-backed box. When set, each `create()` mints a
830
851
  * fresh temp directory (prefixed `<workdir>-`) and the box exposes
@@ -858,6 +879,182 @@ declare function inProcessSandboxClient(options: InProcessSandboxClientOptions):
858
879
  */
859
880
  declare function inlineSandboxClient(factory: ExecutorFactory<unknown>): SandboxClient;
860
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
+
861
1058
  /**
862
1059
  *
863
1060
  * `runLoop` — the topology-agnostic kernel built atop the sandbox SDK.
@@ -2087,6 +2284,56 @@ declare function sumSandboxUsage(events: readonly SandboxEvent[], agentRunName?:
2087
2284
  output: number;
2088
2285
  costUsd: number;
2089
2286
  };
2287
+ /**
2288
+ * Cross-event state for {@link mapSandboxToolEvent}. Sandbox backends emit a
2289
+ * tool invocation as MANY `message.part.updated` frames on the same call id
2290
+ * (pending → running → completed), so faithful projection needs per-call
2291
+ * status memory: one `tool_call` on first sighting, at most one `tool_result`
2292
+ * on the terminal transition, nothing on intermediate re-frames. Create one
2293
+ * state per turn via {@link createSandboxToolPartState}.
2294
+ *
2295
+ * @experimental
2296
+ */
2297
+ interface SandboxToolPartState {
2298
+ /** Last seen status per tool call id. A terminal status is sticky — later
2299
+ * frames on a settled call project to nothing. */
2300
+ statusByCall: Map<string, string>;
2301
+ /** Sequence for synthesized call ids when an event carries none. */
2302
+ seq: number;
2303
+ }
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
+ */
2310
+ declare function createSandboxToolPartState(): SandboxToolPartState;
2311
+ /**
2312
+ * Project one `SandboxEvent` onto the `tool_call` / `tool_result` variants of
2313
+ * `RuntimeStreamEvent` — the tool-part projection `mapSandboxEvent`
2314
+ * deliberately does NOT perform. Opt-in and additive: `mapSandboxEvent`'s
2315
+ * default vocabulary (text/reasoning deltas + `llm_call`) is unchanged;
2316
+ * consumers that need the tool surface (chat UIs rendering tool activity)
2317
+ * compose this projector alongside it — `streamAgentTurn` does exactly that
2318
+ * under its `preserveToolParts` option.
2319
+ *
2320
+ * Handled shapes (observed on the opencode / claude-code sandbox backends):
2321
+ * - `message.part.updated` with `part.type === 'tool'` — stateful: a
2322
+ * `tool_call` on the call id's first frame (args from `state.input` or
2323
+ * `state.metadata.input`), a `tool_result` when the status transitions to
2324
+ * `completed` (result from `state.output` / `metadata.output`) or to a
2325
+ * terminal failure (result is `{ error, status, output? }` — the error
2326
+ * surfaced in-band, never dropped).
2327
+ * - bare `tool*` event types (`tool.call`, `tool_result`, …) — stateless:
2328
+ * `*result*` types project to `tool_result`, the rest to `tool_call`.
2329
+ *
2330
+ * Returns `[]` for every non-tool event.
2331
+ *
2332
+ * @experimental
2333
+ */
2334
+ declare function mapSandboxToolEvent(event: SandboxEvent, state: SandboxToolPartState): (RuntimeStreamEvent & {
2335
+ type: 'tool_call' | 'tool_result';
2336
+ })[];
2090
2337
  /**
2091
2338
  * Project one `SandboxEvent` onto the `RuntimeStreamEvent` chat-UX vocabulary,
2092
2339
  * for runtimes that bridge a sandbox `streamPrompt` into the
@@ -2100,6 +2347,9 @@ declare function sumSandboxUsage(events: readonly SandboxEvent[], agentRunName?:
2100
2347
  * - `message.part.updated` reasoning/thinking part → `reasoning_delta`
2101
2348
  * - cost-bearing events → `llm_call` (shared with the ledger extractor)
2102
2349
  *
2350
+ * Tool parts are deliberately NOT mapped here (unchanged default) — compose
2351
+ * {@link mapSandboxToolEvent} alongside when a consumer needs them.
2352
+ *
2103
2353
  * The opencode backend emits incremental text as
2104
2354
  * `{ type: 'message.part.updated', data: { part: { type, text }, delta } }`;
2105
2355
  * `delta` is the increment, `part.text` the running accumulation.
@@ -2172,7 +2422,7 @@ interface SandboxLineage {
2172
2422
  * Acquire a fresh box and begin a new session on it. Returns the handle and
2173
2423
  * the live `streamPrompt` iterable for the first turn (caller drains it).
2174
2424
  */
2175
- start(spec: AgentRunSpec<unknown>, prompt: string, signal: AbortSignal): Promise<{
2425
+ start(spec: AgentRunSpec<unknown>, prompt: string, signal: AbortSignal, promptOptions?: Omit<PromptOptions, 'signal' | 'sessionId'>): Promise<{
2176
2426
  handle: SandboxLineageHandle;
2177
2427
  events: AsyncIterable<SandboxEvent>;
2178
2428
  }>;
@@ -2183,7 +2433,7 @@ interface SandboxLineage {
2183
2433
  * silently dropped the client-minted session id surfaces as an error instead
2184
2434
  * of a contextless turn the caller mistakes for a real continuation.
2185
2435
  */
2186
- 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>>;
2187
2437
  /**
2188
2438
  * Branch `count` children from `parent`. When the platform can fork, each
2189
2439
  * child inherits `parent`'s checkpoint — and therefore the parent's IMAGE and
@@ -2350,6 +2600,14 @@ interface SandboxRun<Out> {
2350
2600
  resume(prompt: string): Promise<TurnResult<Out>>;
2351
2601
  close(): Promise<void>;
2352
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'>;
2353
2611
  /** @experimental */
2354
2612
  interface OpenSandboxRunOptions {
2355
2613
  /** Profile + sandbox env/overrides. `sandboxOverrides.backend.type` is the harness. */
@@ -2361,6 +2619,9 @@ interface OpenSandboxRunOptions {
2361
2619
  runId?: string;
2362
2620
  /** Optional benchmark/scenario id carried into emitted hook events. */
2363
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;
2364
2625
  /** Test seam for deterministic hook timestamps. Defaults to `Date.now`. */
2365
2626
  now?: () => number;
2366
2627
  /** Bounds box-creation bursts inside lineage fanout. Default from lineage. */
@@ -2782,7 +3043,8 @@ declare function runStrategyEvolution(cfg: StrategyEvolutionConfig): Promise<Evo
2782
3043
 
2783
3044
  /**
2784
3045
  * `streamAgentTurn` — the ONE run-a-turn event-stream contract over every
2785
- * execution substrate: a sandbox box (`SandboxInstance.streamPrompt`), a
3046
+ * execution substrate: a sandbox box (`SandboxInstance.streamPrompt`, or
3047
+ * `streamTask` via the `box-task` kind for autonomous-task semantics), a
2786
3048
  * one-shot `Executor` (cli-bridge / router / BYO, via `ExecutorFactory`), and
2787
3049
  * an in-process `AgentExecutionBackend` (the `resolveAgentBackend` output).
2788
3050
  *
@@ -2797,6 +3059,10 @@ declare function runStrategyEvolution(cfg: StrategyEvolutionConfig): Promise<Evo
2797
3059
  * adapter over code that already exists and is already hardened:
2798
3060
  * - `box` — `mapSandboxEvent` + `extractLlmCallEvent` (sandbox-events.ts)
2799
3061
  * project the sandbox event stream; nothing is re-mapped here.
3062
+ * - `box-task` — the same projection over `box.streamTask` (the sandbox
3063
+ * SDK's autonomous-task verb: the agent works to completion,
3064
+ * multi-turn, session state maintained) with per-task
3065
+ * `TaskOptions` passthrough.
2800
3066
  * - `executor` — `inlineSandboxClient` (the ONE executor→box adapter) turns
2801
3067
  * the factory into a box, then the box path drives it. The
2802
3068
  * executor's settle/teardown lifecycle stays in that adapter.
@@ -2816,6 +3082,15 @@ declare function runStrategyEvolution(cfg: StrategyEvolutionConfig): Promise<Evo
2816
3082
  * `final.status: 'failed'` — so cancellation stays distinguishable from a
2817
3083
  * blown deadline.
2818
3084
  *
3085
+ * Mid-stream lifecycle work needs NO extra API: the generator is pull-based,
3086
+ * so the producer is suspended between yields and resumes only when the caller
3087
+ * pulls again. A consumer can therefore run arbitrary async work between
3088
+ * events — sync state on each `tool_result`, decide a no-op retry after
3089
+ * draining, run a pre-`done` flush when it receives `final` and BEFORE it
3090
+ * forwards its own terminal event downstream. The interleaving is guaranteed
3091
+ * (and locked by test): nothing is produced past the event the caller is
3092
+ * holding.
3093
+ *
2819
3094
  * @experimental
2820
3095
  */
2821
3096
 
@@ -2829,6 +3104,34 @@ type AgentTurnBackend = {
2829
3104
  /** A live sandbox box: the turn is one `box.streamPrompt(prompt)` call. */
2830
3105
  kind: 'box';
2831
3106
  box: SandboxInstance;
3107
+ /**
3108
+ * Per-turn `PromptOptions` forwarded verbatim to `streamPrompt`
3109
+ * (`sessionId`, `turnId`, `model`, `backend` profile, `timeoutMs`, …).
3110
+ * The turn's derived abort signal (caller `signal` + `timeoutMs`
3111
+ * deadline) is always installed as `signal` — pass cancellation through
3112
+ * `StreamAgentTurnOptions`, not here.
3113
+ */
3114
+ options?: Omit<PromptOptions, 'signal'>;
3115
+ /** Model label stamped on cost-only `llm_call` events. Default `'agent'`. */
3116
+ agentRunName?: string;
3117
+ } | {
3118
+ /**
3119
+ * A live sandbox box in TASK mode: the turn is one
3120
+ * `box.streamTask(prompt)` call — the sandbox SDK's autonomous-task
3121
+ * verb. Unlike `streamPrompt` (one chat turn), the agent works until
3122
+ * the task completes or errors, session state is maintained for
3123
+ * continuity, and `options.maxTurns` bounds the agent's internal turns.
3124
+ * Event projection, usage folding, and the terminal `final` contract
3125
+ * are identical to the `box` kind.
3126
+ */
3127
+ kind: 'box-task';
3128
+ box: SandboxInstance;
3129
+ /**
3130
+ * Per-task `TaskOptions` forwarded verbatim to `streamTask`
3131
+ * (`maxTurns` plus every `PromptOptions` field). The turn's derived
3132
+ * abort signal is always installed as `signal`.
3133
+ */
3134
+ options?: Omit<TaskOptions, 'signal'>;
2832
3135
  /** Model label stamped on cost-only `llm_call` events. Default `'agent'`. */
2833
3136
  agentRunName?: string;
2834
3137
  } | {
@@ -2860,6 +3163,25 @@ interface StreamAgentTurnOptions {
2860
3163
  * (a blown deadline is a turn failure, not a caller cancellation).
2861
3164
  */
2862
3165
  timeoutMs?: number;
3166
+ /**
3167
+ * Opt-in tool-part projection for box-kind backends (`box`, `box-task`,
3168
+ * `executor`): sandbox tool parts additionally surface in-stream as
3169
+ * `tool_call` / `tool_result` events (`mapSandboxToolEvent`), so a consumer
3170
+ * rendering tool activity needs no bespoke sandbox-event parser. Default
3171
+ * off — the stream vocabulary existing consumers see is unchanged. No-op
3172
+ * for the `chat` kind (its backend emits `RuntimeStreamEvent`s directly,
3173
+ * tool events included when the backend produces them).
3174
+ */
3175
+ preserveToolParts?: boolean;
3176
+ /**
3177
+ * Raw-event tap for box-kind backends: called (and awaited) with every
3178
+ * unmapped `SandboxEvent` BEFORE it is projected, so a consumer can read
3179
+ * parts the chat-UX projection drops (part ids, step markers, custom
3180
+ * backend events) without forking the mapper. Purely observational — it
3181
+ * cannot alter the mapped stream. Never called for the `chat` kind, which
3182
+ * has no sandbox events.
3183
+ */
3184
+ onRawEvent?: (event: SandboxEvent) => void | Promise<void>;
2863
3185
  }
2864
3186
  /**
2865
3187
  * Metered usage of one turn, summed over every cost-bearing event the backend
@@ -3568,6 +3890,13 @@ interface InMemoryRunContextOptions {
3568
3890
  * leaf workers. Default `false`.
3569
3891
  */
3570
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;
3571
3900
  }
3572
3901
  /**
3573
3902
  * The bundle of stores a supervised run needs, shaped to spread into `SupervisorOpts`.
@@ -3943,4 +4272,4 @@ declare function runInWorkspace<T>(ws: Workspace, body: (cwd: string) => Promise
3943
4272
  commitOnInvalid?: boolean;
3944
4273
  }): Promise<WorkspaceRun<T>>;
3945
4274
 
3946
- 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, 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, 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, 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-3TZOXS7B.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-F7OO2SKB.js";
140
+ } from "./chunk-LRNRPJAV.js";
135
141
  import "./chunk-UD4BHQMI.js";
136
142
  import {
137
143
  createAgentEnvironmentProviderRegistry,
@@ -141,10 +147,12 @@ import {
141
147
  sandboxClientAsProvider
142
148
  } from "./chunk-BZF3KQ6G.js";
143
149
  import {
150
+ createSandboxToolPartState,
144
151
  extractLlmCallEvent,
145
152
  mapSandboxEvent,
153
+ mapSandboxToolEvent,
146
154
  sumSandboxUsage
147
- } from "./chunk-4J6RBI3K.js";
155
+ } from "./chunk-FVJ7M3DA.js";
148
156
  import "./chunk-7LO5GMAO.js";
149
157
  import "./chunk-YEJR7IXO.js";
150
158
  import "./chunk-DPEUKJRO.js";
@@ -165,6 +173,7 @@ export {
165
173
  assertTraceDerivedFindings,
166
174
  assessAuthoredProfile,
167
175
  auditIntent,
176
+ authorLoop,
168
177
  authorStrategy,
169
178
  authoredWorker,
170
179
  breadthStrategy,
@@ -185,6 +194,7 @@ export {
185
194
  createMcpEnvironment,
186
195
  createPushTraceSource,
187
196
  createSandboxLineage,
197
+ createSandboxToolPartState,
188
198
  createScope,
189
199
  createScopeAnalyst,
190
200
  createShapeRegistry,
@@ -200,6 +210,7 @@ export {
200
210
  defaultSelectWinner,
201
211
  defaultToolDetectors,
202
212
  defineLeaderboard,
213
+ defineLoop,
203
214
  definePersona,
204
215
  defineStrategy,
205
216
  delegate,
@@ -222,11 +233,15 @@ export {
222
233
  jjWorkspace,
223
234
  leaderboard,
224
235
  localShell,
236
+ loopAuthorContract,
225
237
  loopCampaignDispatch,
238
+ loopChild,
226
239
  loopDispatch,
240
+ loopRuntime,
227
241
  loopUntil,
228
242
  makeFinding,
229
243
  mapSandboxEvent,
244
+ mapSandboxToolEvent,
230
245
  naiveDriver,
231
246
  observe,
232
247
  openSandboxRun,
@@ -286,6 +301,7 @@ export {
286
301
  verify,
287
302
  watchTrace,
288
303
  widen,
304
+ withLoopExecutor,
289
305
  workerFromBackend,
290
306
  worktreeFanout
291
307
  };
package/dist/mcp/bin.js CHANGED
@@ -9,10 +9,10 @@ import {
9
9
  DelegationTaskQueue,
10
10
  FileDelegationStore,
11
11
  createMcpServer
12
- } from "../chunk-F7OO2SKB.js";
12
+ } from "../chunk-LRNRPJAV.js";
13
13
  import "../chunk-UD4BHQMI.js";
14
14
  import "../chunk-BZF3KQ6G.js";
15
- import "../chunk-4J6RBI3K.js";
15
+ import "../chunk-FVJ7M3DA.js";
16
16
  import "../chunk-7LO5GMAO.js";
17
17
  import "../chunk-YEJR7IXO.js";
18
18
  import "../chunk-DPEUKJRO.js";