@tangle-network/agent-runtime 0.102.1 → 0.103.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -10
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +5 -5
- package/dist/analyst-loop.d.ts +1 -1
- package/dist/candidate-execution/index.d.ts +5 -41
- package/dist/candidate-execution/index.js +8 -6
- package/dist/{chunk-KPHTCHQ4.js → chunk-3LJF5XSE.js} +79 -334
- package/dist/chunk-3LJF5XSE.js.map +1 -0
- package/dist/{chunk-3DW5DEKQ.js → chunk-5AITUUHO.js} +3 -3
- package/dist/{chunk-SQ3ZJH3Y.js → chunk-6WZZXQV5.js} +467 -23
- package/dist/chunk-6WZZXQV5.js.map +1 -0
- package/dist/{chunk-RTB3TC73.js → chunk-AAN2MB2X.js} +3 -3
- package/dist/{chunk-KSM6GFHP.js → chunk-B7K7V22Y.js} +2 -2
- package/dist/{chunk-6MR4IJRW.js → chunk-EAQ5YRRY.js} +1383 -63
- package/dist/chunk-EAQ5YRRY.js.map +1 -0
- package/dist/chunk-ISPWRSEC.js +408 -0
- package/dist/chunk-ISPWRSEC.js.map +1 -0
- package/dist/{chunk-7FJJUC73.js → chunk-LFM4JBRW.js} +29 -6
- package/dist/{chunk-7FJJUC73.js.map → chunk-LFM4JBRW.js.map} +1 -1
- package/dist/{chunk-ROILMKDL.js → chunk-QYCKIV6C.js} +3 -3
- package/dist/{chunk-LJLG734E.js → chunk-SBTWKPVR.js} +10 -11
- package/dist/{chunk-LJLG734E.js.map → chunk-SBTWKPVR.js.map} +1 -1
- package/dist/{chunk-CK76OZPM.js → chunk-SNSMRT6H.js} +56 -386
- package/dist/chunk-SNSMRT6H.js.map +1 -0
- package/dist/{chunk-KJ2Q4T7F.js → chunk-TUSOOIDV.js} +2 -2
- package/dist/{chunk-CI7WS6S2.js → chunk-ZOYN3JR5.js} +5 -5
- package/dist/{chunk-377GOJHJ.js → chunk-ZXICDSAK.js} +333 -4
- package/dist/chunk-ZXICDSAK.js.map +1 -0
- package/dist/{completion-gate-C6dhVN-N.d.ts → completion-gate-DLINnrkM.d.ts} +1 -1
- package/dist/{coordination-D9l_YmwW.d.ts → coordination-DTehA977.d.ts} +250 -8
- package/dist/environment-provider.d.ts +2 -2
- package/dist/index.d.ts +12 -12
- package/dist/index.js +17 -15
- package/dist/index.js.map +1 -1
- package/dist/intelligence.d.ts +26 -8
- package/dist/intelligence.js +24 -7
- package/dist/intelligence.js.map +1 -1
- package/dist/knowledge.d.ts +6 -6
- package/dist/knowledge.js +9 -9
- package/dist/{loop-runner-bin-PnWslIw4.d.ts → loop-runner-bin-DhIXsLAd.d.ts} +2 -2
- package/dist/loop-runner-bin.d.ts +5 -5
- package/dist/loop-runner-bin.js +6 -6
- package/dist/loops.d.ts +305 -148
- package/dist/loops.js +82 -14
- package/dist/mcp/bin.js +3 -3
- package/dist/mcp/index.d.ts +6 -6
- package/dist/mcp/index.js +6 -6
- package/dist/profiles.d.ts +1 -1
- package/dist/{profile-DbfaMTdk.d.ts → protected-model-port-DzkUY3HQ.d.ts} +41 -3
- package/dist/{structural-rollout-D7xik9XR.d.ts → structural-rollout-BFPIy3iw.d.ts} +3 -3
- package/dist/supervise-Cp8bNcJi.d.ts +379 -0
- package/dist/testing.js +10 -10
- package/dist/testing.js.map +1 -1
- package/dist/{types-CWqfCO8s.d.ts → types-Cbp72qyu.d.ts} +1 -1
- package/dist/{types-CLat4bT9.d.ts → types-DK11_O4L.d.ts} +1 -1
- package/dist/types-lZTE_LBd.d.ts +957 -0
- package/dist/{worktree-fanout-DsIR4d6w.d.ts → worktree-fanout-DiiJWjJO.d.ts} +17 -5
- package/package.json +3 -2
- package/skills/build-with-agent-runtime/SKILL.md +7 -5
- package/skills/generate-eval/SKILL.md +45 -52
- package/skills/loop-writer/SKILL.md +79 -147
- package/skills/supervise/SKILL.md +33 -14
- package/dist/chunk-377GOJHJ.js.map +0 -1
- package/dist/chunk-6MR4IJRW.js.map +0 -1
- package/dist/chunk-CK76OZPM.js.map +0 -1
- package/dist/chunk-IMSNJSXH.js +0 -73
- package/dist/chunk-IMSNJSXH.js.map +0 -1
- package/dist/chunk-KPHTCHQ4.js.map +0 -1
- package/dist/chunk-SQ3ZJH3Y.js.map +0 -1
- package/dist/supervise-BQdNAXtK.d.ts +0 -131
- package/dist/types-D870JlH0.d.ts +0 -500
- /package/dist/{chunk-3DW5DEKQ.js.map → chunk-5AITUUHO.js.map} +0 -0
- /package/dist/{chunk-RTB3TC73.js.map → chunk-AAN2MB2X.js.map} +0 -0
- /package/dist/{chunk-KSM6GFHP.js.map → chunk-B7K7V22Y.js.map} +0 -0
- /package/dist/{chunk-ROILMKDL.js.map → chunk-QYCKIV6C.js.map} +0 -0
- /package/dist/{chunk-KJ2Q4T7F.js.map → chunk-TUSOOIDV.js.map} +0 -0
- /package/dist/{chunk-CI7WS6S2.js.map → chunk-ZOYN3JR5.js.map} +0 -0
package/dist/loops.d.ts
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { ChatClient, RunRecord, HarnessType, AgentProfile, MaximumCharge, AnalystFinding, AnalystRunInputs,
|
|
1
|
+
import { ChatClient, RunRecord, HarnessType, AgentProfile, MaximumCharge, AnalystFinding, AnalystRunInputs, buildTrajectory } from '@tangle-network/agent-eval';
|
|
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 {
|
|
6
|
-
export {
|
|
7
|
-
import { M as MakeWorkerAgent, A as AnalystRegistry, o as CoordinationTools, n as CoordinationEvent,
|
|
8
|
-
export {
|
|
9
|
-
import { R as RuntimeHooks, I as Iteration, S as SandboxClient, D as Driver, A as AgentRunSpec, O as OutputAdapter, V as Validator, E as ExecCtx, u as LoopWinner, v as LoopLineageOptions, w as LoopResult, L as LoopTokenUsage, M as MountRecorder } from './types-
|
|
10
|
-
export { x as LoopDecisionPayload, y as LoopEndedPayload, z as LoopIterationDispatchPayload, B as LoopIterationEndedPayload, C as LoopIterationStartedPayload, F as LoopPlanDescription, G as LoopPlanPayload, b as LoopSandboxPlacement, H as LoopStartedPayload, J as LoopTeardownFailedPayload,
|
|
5
|
+
import { b as ResultBlobStore, c as SpawnJournal, N as NodeId, l as SpawnEvent, m as TreeView, P as PendingWait, a as Settled, E as ExecutorFactory, A as Agent, B as Budget, S as Scope, e as SupervisedResult, g as Spend, U as UsageEvent, n as SpawnOpts, i as ExecutorRegistry, d as WaitProbeRegistry, o as Supervisor, T as TraceSource } from './types-lZTE_LBd.js';
|
|
6
|
+
export { p as ActivityLog, q as ActivityNote, h as AgentSpec, D as DEFAULT_STALL_AFTER_MS, f as Executor, r as ExecutorContext, k as ExecutorProgress, s as ExecutorResult, t as ResumedWork, R as Runtime, u as ScopeProgressInput, v as SessionTraceBox, w as SupervisorOpts, x as WaitOutcome, y as WaitProbe, z as WaitRejection, C as WaitSpec, F as WidenGate, W as WorkerProgress, G as createActivityLog, H as createPushTraceSource, I as createWaitProbes, J as decodeToolPart, K as isWaitOutcome, L as pollFor, M as readWorkerProgress, O as sandboxSessionTraceSource, Q as timerAt, V as validateWaitSpec, X as waitUntil } from './types-lZTE_LBd.js';
|
|
7
|
+
import { M as MakeWorkerAgent, A as AnalystRegistry, W as WorkerWatchOptions, o as CoordinationTools, n as CoordinationEvent, at as QuestionPolicy, E as ExecutorConfig } from './coordination-DTehA977.js';
|
|
8
|
+
export { bi as BusEvent, bj as BusRecord, bk as BusStats, bl as DEFAULT_SANDBOX_STEERING_MAX_TURNS, bm as EventBus, bn as Inbox, bo as InboxMessage, bp as PI_RUNTIME, bq as PiSeam, br as ProviderSeam, bs as PublishOptions, bt as SandboxSteeringOptions, bu as SteerableSandboxSession, bv as WatchTraceOptions, bw as cliWorktreeExecutor, bx as createEventBus, by as createExecutor, bz as createExecutorRegistry, bA as createInbox, bB as createSteerableSandboxSession, bC as defaultToolDetectors, bD as piExecutor, bE as piSeamKey, bF as watchTrace } from './coordination-DTehA977.js';
|
|
9
|
+
import { R as RuntimeHooks, I as Iteration, S as SandboxClient, D as Driver, A as AgentRunSpec, O as OutputAdapter, V as Validator, E as ExecCtx, u as LoopWinner, v as LoopLineageOptions, w as LoopResult, L as LoopTokenUsage, M as MountRecorder } from './types-DK11_O4L.js';
|
|
10
|
+
export { x as LoopDecisionPayload, y as LoopEndedPayload, z as LoopIterationDispatchPayload, B as LoopIterationEndedPayload, C as LoopIterationStartedPayload, F as LoopPlanDescription, G as LoopPlanPayload, b as LoopSandboxPlacement, H as LoopStartedPayload, J as LoopTeardownFailedPayload, t as LoopTraceEmitter, c as LoopTraceEvent, K as MountManifestEntry, N as RunProvenance, a as SelectionReceipt, P as ValidationCtx } from './types-DK11_O4L.js';
|
|
11
11
|
import { RunProfileMatrixResult, Scenario, ProfileDispatchFn, JudgeConfig, RunProfileMatrixOptions, DispatchFn } from '@tangle-network/agent-eval/campaign';
|
|
12
12
|
export { AgentEnvironmentProviderRef, AgentEnvironmentProviderRegistry, ProviderAsSandboxClientOptions, ProviderExecutorOptions, SandboxClientProviderOptions, createAgentEnvironmentProviderRegistry, providerAsExecutor, providerAsSandboxClient, resolveAgentEnvironmentProvider, sandboxClientAsProvider } from './environment-provider.js';
|
|
13
|
-
import { c as CorpusRecord, C as Corpus, S as ScopeAnalyzeInput, d as AssertTraceDerivedFindings, O as Outcome, e as SteerContext, f as ScopeAnalyst, F as FanoutOptions, g as CombinatorShape, h as ScopeWidenGate, L as LoopUntilSpec, P as PanelSpec, i as PipelineStage, W as WinnerStrategy, j as FanoutWinnerSelector, V as VerifySpec, k as WidenSpec, l as CorpusFilter, R as RenderCorpusToInstructionsOptions, D as DefinePersonaInput, m as Persona, n as RunPersonifiedOptions, o as ShapeRegistry, p as LoopShape, E as EqualKArm, q as EqualKOnCostOptions, r as EqualKVerdict, T as TrajectoryReportOptions, s as TrajectoryReport } from './worktree-fanout-
|
|
14
|
-
export { A as AuthoredHarness, t as DefinePersona, u as EqualKOnCost, v as Fanout, w as FanoutSynthesis, x as FlatWidenGate, y as LoopUntil, z as LoopUntilState, B as Panel, G as PanelJudge, H as PanelVerdict, I as PatchDeliverableOptions, J as PersonaContext, K as PersonaExecutors, M as Pipeline, N as RenderCorpusToInstructions, Q as RunPersonified, U as ShapeBudget, X as ShapeContext, Y as TrajectoryNode, Z as TrajectoryReportFn, _ as Verify, $ as Widen, a0 as WidenDecision, a1 as WidenLineage, a2 as WorktreeCliExecutorOptions, a as WorktreeFanoutOptions, b as WorktreePatchArtifact, a3 as createWorktreeCliExecutor, a4 as patchDelivered, a5 as worktreeFanout } from './worktree-fanout-
|
|
13
|
+
import { c as CorpusRecord, C as Corpus, S as ScopeAnalyzeInput, d as AssertTraceDerivedFindings, O as Outcome, e as SteerContext, f as ScopeAnalyst, F as FanoutOptions, g as CombinatorShape, h as ScopeWidenGate, L as LoopUntilSpec, P as PanelSpec, i as PipelineStage, W as WinnerStrategy, j as FanoutWinnerSelector, V as VerifySpec, k as WidenSpec, l as CorpusFilter, R as RenderCorpusToInstructionsOptions, D as DefinePersonaInput, m as Persona, n as RunPersonifiedOptions, o as ShapeRegistry, p as LoopShape, E as EqualKArm, q as EqualKOnCostOptions, r as EqualKVerdict, T as TrajectoryReportOptions, s as TrajectoryReport } from './worktree-fanout-DiiJWjJO.js';
|
|
14
|
+
export { A as AuthoredHarness, t as DefinePersona, u as EqualKOnCost, v as Fanout, w as FanoutSynthesis, x as FlatWidenGate, y as LoopUntil, z as LoopUntilState, B as Panel, G as PanelJudge, H as PanelVerdict, I as PatchDeliverableOptions, J as PersonaContext, K as PersonaExecutors, M as Pipeline, N as RenderCorpusToInstructions, Q as RunPersonified, U as ShapeBudget, X as ShapeContext, Y as TrajectoryNode, Z as TrajectoryReportFn, _ as Verify, $ as Widen, a0 as WidenDecision, a1 as WidenLineage, a2 as WorktreeCliExecutorOptions, a as WorktreeFanoutOptions, b as WorktreePatchArtifact, a3 as createWorktreeCliExecutor, a4 as patchDelivered, a5 as worktreeFanout } from './worktree-fanout-DiiJWjJO.js';
|
|
15
15
|
import { AgentProfileMcpServer, AgentProfile as AgentProfile$1, AgentProfileSecurityPolicy } from '@tangle-network/agent-interface';
|
|
16
|
-
import { A as AgenticSurface, a as AgenticTask, b as AgenticOptions, c as Strategy, d as ArtifactHandle, e as SurfaceScore, f as AgenticTool } from './structural-rollout-
|
|
17
|
-
export { g as AgenticRunResult, C as CheckExecChannel, h as CheckOutcome, i as CheckRunContext, j as CheckRunner, k as CheckSource, l as CheckSourceCtx, m as CorpusReadbackOptions, R as RepairStop, n as RunAgenticOptions, o as ShotPersona, p as ShotSpec, q as StrategyCtx, r as StrategyResult, s as StructuralRolloutConfig, S as StructuralRolloutPolicy, t as StructuralRolloutResult, V as VisibleCheck, u as adaptiveRefine, v as breadthStrategy, w as canDisplace, x as compareCheckOutcomes, y as composeCheckSources, z as defaultExtractCandidate, B as defaultStructuralRolloutPolicy, D as defineStrategy, E as depthStrategy, F as filterAuthoredAsserts, G as modelAuthoredChecks, H as officialChecksFromMeta, I as refine, J as resolveEntrySymbol, K as runAgentic, L as sample, M as sampleThenRefine, N as sandboxCheckRunner, O as selectBestIndex, P as structuralRollout, Q as visibleCheckScore } from './structural-rollout-
|
|
16
|
+
import { A as AgenticSurface, a as AgenticTask, b as AgenticOptions, c as Strategy, d as ArtifactHandle, e as SurfaceScore, f as AgenticTool } from './structural-rollout-BFPIy3iw.js';
|
|
17
|
+
export { g as AgenticRunResult, C as CheckExecChannel, h as CheckOutcome, i as CheckRunContext, j as CheckRunner, k as CheckSource, l as CheckSourceCtx, m as CorpusReadbackOptions, R as RepairStop, n as RunAgenticOptions, o as ShotPersona, p as ShotSpec, q as StrategyCtx, r as StrategyResult, s as StructuralRolloutConfig, S as StructuralRolloutPolicy, t as StructuralRolloutResult, V as VisibleCheck, u as adaptiveRefine, v as breadthStrategy, w as canDisplace, x as compareCheckOutcomes, y as composeCheckSources, z as defaultExtractCandidate, B as defaultStructuralRolloutPolicy, D as defineStrategy, E as depthStrategy, F as filterAuthoredAsserts, G as modelAuthoredChecks, H as officialChecksFromMeta, I as refine, J as resolveEntrySymbol, K as runAgentic, L as sample, M as sampleThenRefine, N as sandboxCheckRunner, O as selectBestIndex, P as structuralRollout, Q as visibleCheckScore } from './structural-rollout-BFPIy3iw.js';
|
|
18
18
|
import { b as AnalystRegistryLike } from './types-CmYCMbFT.js';
|
|
19
19
|
import { R as RouterConfig, T as ToolLoopChat, a as ToolLoopCompactionOptions } from './sanitize-DEbPNtyI.js';
|
|
20
20
|
export { j as RouterChatResult, k as RouterChatToolsResult, l as RouterToolCall, m as RouterToolLoopResult, n as ToolLoopCompaction, b as ToolSpec, r as routerBrain, o as routerChatWithTools, p as routerChatWithUsage, q as routerToolLoop } from './sanitize-DEbPNtyI.js';
|
|
21
21
|
import { R as RuntimeStreamEvent, c as AgentExecutionBackend, f as AgentTaskStatus, B as BackendErrorDetail } from './types-BwoZWq-i.js';
|
|
22
|
-
import { D as DeliverableSpec } from './completion-gate-
|
|
23
|
-
export { g as WorktreeCommandResult, h as WorktreeProfileMaterializationReceipt, i as gateOnDeliverable } from './completion-gate-
|
|
24
|
-
import { S as SupervisorProfile } from './supervise-
|
|
25
|
-
export { D as DriveHarness,
|
|
22
|
+
import { D as DeliverableSpec } from './completion-gate-DLINnrkM.js';
|
|
23
|
+
export { g as WorktreeCommandResult, h as WorktreeProfileMaterializationReceipt, i as gateOnDeliverable } from './completion-gate-DLINnrkM.js';
|
|
24
|
+
import { S as StopRule, a as SupervisorProfile } from './supervise-Cp8bNcJi.js';
|
|
25
|
+
export { A as AllWorkersStalledOptions, D as DriveHarness, N as NoProgressForOptions, P as PlateauOptions, b as ProgressSample, c as ProgressTracker, d as ProgressTrackerOptions, e as ProgressView, f as StopDecision, g as SuperviseOptions, h as SupervisorAgentDeps, i as allOf, j as allWorkersStalled, k as anyOf, l as createProgressTracker, n as noProgressFor, p as plateau, s as sampleFromSettled, m as supervise, o as supervisorAgent, w as workerFromBackend } from './supervise-Cp8bNcJi.js';
|
|
26
26
|
import { stuckLoopView, toolWasteView } from '@tangle-network/agent-eval/pipelines';
|
|
27
27
|
export { AgentEnvironment, AgentEnvironmentCapabilities, AgentEnvironmentEvent, AgentEnvironmentProvider, AgentEnvironmentQuery, AgentEnvironmentStatus, AgentEnvironmentSummary, AgentProfileRef, AgentSession, AgentSessionRef, AgentSessionStatus, AgentTurnInput, AgentTurnResult, CheckpointRef, CheckpointRequest, CreateAgentEnvironmentInput, ExecRequest, ExecResult, ForkRequest, PlacementInfo, ResourceRequest, WorkspaceRequest } from '@tangle-network/agent-interface/environment-provider';
|
|
28
28
|
import './substrate-Dyiqmd3o.js';
|
|
@@ -72,6 +72,18 @@ declare class InMemoryResultBlobStore implements ResultBlobStore {
|
|
|
72
72
|
put(outRef: string, artifact: unknown): Promise<void>;
|
|
73
73
|
get(outRef: string): Promise<unknown | undefined>;
|
|
74
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* FS `ResultBlobStore`. One JSON file per artifact under `dir`, named by a
|
|
77
|
+
* filesystem-safe encoding of the `outRef` (`sha256:<hex>` → `sha256-<hex>.json`).
|
|
78
|
+
* `put` fsyncs so a crash between writes never loses an acknowledged blob.
|
|
79
|
+
*/
|
|
80
|
+
declare class FileResultBlobStore implements ResultBlobStore {
|
|
81
|
+
private readonly dir;
|
|
82
|
+
constructor(dir: string);
|
|
83
|
+
put(outRef: string, artifact: unknown): Promise<void>;
|
|
84
|
+
get(outRef: string): Promise<unknown | undefined>;
|
|
85
|
+
private blobPath;
|
|
86
|
+
}
|
|
75
87
|
/**
|
|
76
88
|
* In-memory `SpawnJournal`. Appends are observed-committed only; the impl enforces
|
|
77
89
|
* the corruption guards a durable replay rests on:
|
|
@@ -85,6 +97,47 @@ declare class InMemorySpawnJournal implements SpawnJournal {
|
|
|
85
97
|
beginTree(root: NodeId, at: string): Promise<void>;
|
|
86
98
|
appendEvent(root: NodeId, ev: SpawnEvent): Promise<void>;
|
|
87
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* JSONL on disk. One line per record: the first record is `begin`, subsequent records
|
|
102
|
+
* are `event` envelopes wrapping a `SpawnEvent`. `loadTree` replays the whole file,
|
|
103
|
+
* filtering by `root`, and applies the same begin-precedes-events + unique-seq
|
|
104
|
+
* corruption guards as the in-memory impl. Each append fsyncs so a crash between
|
|
105
|
+
* writes never loses an acknowledged event.
|
|
106
|
+
*/
|
|
107
|
+
declare class FileSpawnJournal implements SpawnJournal {
|
|
108
|
+
private readonly path;
|
|
109
|
+
constructor(path: string);
|
|
110
|
+
loadTree(root: NodeId): Promise<SpawnEvent[] | undefined>;
|
|
111
|
+
beginTree(root: NodeId, at: string): Promise<void>;
|
|
112
|
+
appendEvent(root: NodeId, ev: SpawnEvent): Promise<void>;
|
|
113
|
+
private loadTreeBegin;
|
|
114
|
+
private appendRecord;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Re-feed a journaled spawn tree in strict `seq` order, rehydrating each settled
|
|
118
|
+
* child's `out` from the blob store by `outRef`, and return the `Settled[]` exactly
|
|
119
|
+
* as `scope.next()` originally delivered them.
|
|
120
|
+
*
|
|
121
|
+
* Determinism (B2): the events are sorted by `seq` BEFORE any blob `get`, so the
|
|
122
|
+
* replay order is the recorded cursor order regardless of how fast each rehydration
|
|
123
|
+
* resolves. `at` (wall-clock) is never a replay input. Fail loud on a tree that was
|
|
124
|
+
* never begun, a settled-done event missing its `outRef`, or a blob the store can't
|
|
125
|
+
* rehydrate — a silent gap would let `act` branch on the wrong evidence.
|
|
126
|
+
*/
|
|
127
|
+
declare function replaySpawnTree(journal: SpawnJournal, blobs: ResultBlobStore, root: NodeId): Promise<Settled<unknown>[]>;
|
|
128
|
+
/**
|
|
129
|
+
* Materialize a recorded `TreeView` from a journaled event list for inspection. Folds
|
|
130
|
+
* `spawned`/`settled`/`cancelled` into a per-node snapshot in `seq` order, then adds each
|
|
131
|
+
* `metered` event's driver-inference spend onto its node in a separate additive pass so the view
|
|
132
|
+
* matches the recorded cursor. It does not recover live executors or driver state after restart.
|
|
133
|
+
*/
|
|
134
|
+
declare function materializeTreeView(events: SpawnEvent[]): TreeView;
|
|
135
|
+
/**
|
|
136
|
+
* The waits a journaled tree shows as ARMED but never woken — what a resumed run re-arms with the
|
|
137
|
+
* ORIGINAL absolute deadline. Reading it from the journal (rather than from any live state) is
|
|
138
|
+
* what makes "SIGKILL a waiting tree, a new process keeps waiting to the same instant" true.
|
|
139
|
+
*/
|
|
140
|
+
declare function pendingWaits(events: SpawnEvent[]): PendingWait[];
|
|
88
141
|
|
|
89
142
|
/**
|
|
90
143
|
* createWaterfallCollector — 100% trajectory observability from the lifecycle stream:
|
|
@@ -210,6 +263,29 @@ interface AnytimeReport {
|
|
|
210
263
|
/** One summary per (strategy, target) pair — the COCO-style multi-target view. */
|
|
211
264
|
perStrategy: AnytimeStrategySummary[];
|
|
212
265
|
}
|
|
266
|
+
/**
|
|
267
|
+
* The best-so-far fold — the ONE definition of "how good was the run after k results", shared by
|
|
268
|
+
* the post-run anytime report below and by the LIVE progress-based stop rules
|
|
269
|
+
* (`supervise/stop-rules.ts`). Given the observed objective per settled result in order, it returns
|
|
270
|
+
* the running maximum. A result with no objective (`undefined` — it failed, or it was never
|
|
271
|
+
* scored) carries the previous best forward rather than resetting it.
|
|
272
|
+
*
|
|
273
|
+
* It is extracted rather than duplicated on purpose: a stop rule that decides a run has plateaued
|
|
274
|
+
* must agree, number for number, with the report that later says whether stopping was right.
|
|
275
|
+
*/
|
|
276
|
+
declare function bestSoFar(values: ReadonlyArray<number | undefined>): number[];
|
|
277
|
+
/** Mean of a best-so-far curve — the anytime AUC when the curve is normalized to [0,1]. Higher =
|
|
278
|
+
* the run climbed earlier. Shared with the stop rules so "improving" means one thing. */
|
|
279
|
+
declare function areaUnderCurve(curve: ReadonlyArray<number>): number;
|
|
280
|
+
/**
|
|
281
|
+
* How many trailing entries of a best-so-far curve are within `minDelta` of the curve's value
|
|
282
|
+
* `window` steps back — i.e. the length of the current PLATEAU, in settles. `0` means the most
|
|
283
|
+
* recent settle improved the best by more than `minDelta`.
|
|
284
|
+
*
|
|
285
|
+
* The plateau math the live stop rules read. Defined here, beside the report that measures whether
|
|
286
|
+
* the plateau was real, so there is exactly one notion of "not improving".
|
|
287
|
+
*/
|
|
288
|
+
declare function plateauLength(curve: ReadonlyArray<number>, minDelta: number): number;
|
|
213
289
|
/** Derive anytime metrics from waterfall spans. `targets` are the satisficing score
|
|
214
290
|
* bars (default [1] = fully resolved; COCO-style multi-target: [0.5, 0.8, 1]);
|
|
215
291
|
* `targetFor` overrides the bar per task (task-specific satisfaction) — when set, the
|
|
@@ -1468,6 +1544,10 @@ declare function pipeline<Task, D>(stages: ReadonlyArray<PipelineStage<Task, unk
|
|
|
1468
1544
|
* gathered settlements (one SEPARATE synthesis child) or return the best-valid child via the
|
|
1469
1545
|
* single-sourced selector. A round that admitted zero children, or whose synthesis child could
|
|
1470
1546
|
* not be admitted, is a concrete blocker.
|
|
1547
|
+
*
|
|
1548
|
+
* `opts.width` swaps the single round for `rollingDispatch`: at most `width` items live at once,
|
|
1549
|
+
* refilled the instant one settles. Selection, blockers, and the conserved pool are unchanged —
|
|
1550
|
+
* the refill behavior lives in the existing combinator rather than in a rival primitive.
|
|
1471
1551
|
*/
|
|
1472
1552
|
declare function fanout<Task, Item, D>(items: ReadonlyArray<Item>, opts: FanoutOptions<Item, D>): CombinatorShape<Task, D>;
|
|
1473
1553
|
/**
|
|
@@ -3298,6 +3378,13 @@ interface DriverAgentOptions {
|
|
|
3298
3378
|
* `finding` the driver pulls and composes its next steer from. The UP-leg of the self-improving
|
|
3299
3379
|
* loop. Omit/empty = no auto-analysis (status quo). Requires `analysts`. */
|
|
3300
3380
|
readonly analyzeOnSettle?: ReadonlyArray<string>;
|
|
3381
|
+
/** Run the ONLINE detector panel over each worker's LIVE tool trace and raise a `finding` the
|
|
3382
|
+
* moment it loops/error-storms — mid-run evidence to steer on, not a settle-time post-mortem.
|
|
3383
|
+
* Omit = no online watching. */
|
|
3384
|
+
readonly watchWorkers?: WorkerWatchOptions;
|
|
3385
|
+
/** Idle time after which `observe_agent` reports a worker as stalled (a derived read; nothing is
|
|
3386
|
+
* killed). Omit = the runtime default. */
|
|
3387
|
+
readonly stallAfterMs?: number;
|
|
3301
3388
|
/** The driver's stance — a string, or built from the task (the worker-driver prompt /
|
|
3302
3389
|
* the generator). INJECTED so the prompt is a pluggable, optimizable role. */
|
|
3303
3390
|
readonly systemPrompt: string | ((task: unknown) => string);
|
|
@@ -3321,6 +3408,24 @@ interface DriverAgentOptions {
|
|
|
3321
3408
|
/** Injected clock for the in-loop absolute-deadline guard — keeps the deadline check
|
|
3322
3409
|
* deterministic in tests. Defaults to `Date.now`. */
|
|
3323
3410
|
readonly now?: () => number;
|
|
3411
|
+
/**
|
|
3412
|
+
* PROGRESS-derived stop (mechanic D). Today a run ends on a ceiling — iterations, tokens,
|
|
3413
|
+
* dollars, deadline, turn cap — which answers "may it continue?" and never "is it still getting
|
|
3414
|
+
* anywhere?". A stop rule reads the run's own progress (best-so-far over settled work, time
|
|
3415
|
+
* since the last settle, the live worker feed) and ends a run that has stopped learning BEFORE
|
|
3416
|
+
* it exhausts a budget.
|
|
3417
|
+
*
|
|
3418
|
+
* Composes with, and can never override, the hard guards: `poolStarved` / `deadlinePassed` /
|
|
3419
|
+
* abort / the driver's own stop are evaluated first, so a rule can only ADD a stop.
|
|
3420
|
+
*
|
|
3421
|
+
* THRESHOLDS are the caller's judgment, not this module's — build the rule with
|
|
3422
|
+
* `plateau({window, minDelta})` / `noProgressFor({...})` / `allWorkersStalled({...})` from
|
|
3423
|
+
* `supervise/stop-rules`. Omit ⇒ ceilings only (unchanged behavior).
|
|
3424
|
+
*/
|
|
3425
|
+
readonly stopRule?: StopRule;
|
|
3426
|
+
/** Called once with the rule's reason when a `stopRule` ends the run — so a caller can record
|
|
3427
|
+
* WHY a run stopped early instead of inferring it from an unexhausted budget. */
|
|
3428
|
+
readonly onProgressStop?: (reason: string) => void;
|
|
3324
3429
|
/** Give the driver brain a chapter-lifecycle on its OWN context window. The LLM-brain front doors
|
|
3325
3430
|
* lose to a dumb-Ralph respawn because the brain re-bills its whole coordination transcript every
|
|
3326
3431
|
* turn — the same context overflow a single steered agent suffers, one level up. With this set,
|
|
@@ -3413,6 +3518,10 @@ declare function serveCoordinationMcp(opts: {
|
|
|
3413
3518
|
analysts?: AnalystRegistry;
|
|
3414
3519
|
/** Analyst kinds to auto-run when a worker settles `done` — findings flow up the bus. */
|
|
3415
3520
|
analyzeOnSettle?: ReadonlyArray<string>;
|
|
3521
|
+
/** Run the ONLINE detector panel over each worker's live tool trace (raises `finding` events). */
|
|
3522
|
+
watchWorkers?: WorkerWatchOptions;
|
|
3523
|
+
/** Idle time after which `observe_agent` reports a worker as stalled. */
|
|
3524
|
+
stallAfterMs?: number;
|
|
3416
3525
|
/** Pass-through subscriber for every bus event (settled / question / finding). */
|
|
3417
3526
|
onEvent?: (event: CoordinationEvent) => void | Promise<void>;
|
|
3418
3527
|
questionPolicy?: QuestionPolicy;
|
|
@@ -3483,149 +3592,150 @@ declare function delegate<Out = unknown>(intent: string, opts?: DelegateOptions<
|
|
|
3483
3592
|
|
|
3484
3593
|
/**
|
|
3485
3594
|
*
|
|
3486
|
-
* `
|
|
3487
|
-
*
|
|
3488
|
-
*
|
|
3489
|
-
*
|
|
3490
|
-
*
|
|
3491
|
-
*
|
|
3492
|
-
*
|
|
3493
|
-
*
|
|
3494
|
-
*
|
|
3495
|
-
*
|
|
3496
|
-
*
|
|
3497
|
-
*
|
|
3498
|
-
*
|
|
3499
|
-
*
|
|
3595
|
+
* `rollingDispatch` — the REFILLING dispatch policy over a `Scope`. It keeps `width` children in
|
|
3596
|
+
* flight and admits the next queued unit of work the instant one settles, instead of waiting for
|
|
3597
|
+
* a whole round to drain (`fanout`) or for a driver to decide again (`spawn → await → spawn`).
|
|
3598
|
+
*
|
|
3599
|
+
* The gap it closes: `fanout` opens every item at once and then drains — one round, no refill —
|
|
3600
|
+
* and a driver brain's manual loop opens one worker per model turn. Between those two there was
|
|
3601
|
+
* nothing that holds N slots full, which is why a 5-worker run can peak at 2 live workers and sit
|
|
3602
|
+
* ~50% idle. This is a policy over the EXISTING `Scope.spawn` / `Scope.next` primitives: it adds
|
|
3603
|
+
* no second admission path, so the conserved budget pool stays the only fence on total work and
|
|
3604
|
+
* `width` is only a fence on simultaneous work.
|
|
3605
|
+
*
|
|
3606
|
+
* Fail-closed by construction: an admission rejection (`budget-exhausted` / `depth-exceeded`) is
|
|
3607
|
+
* recorded and STOPS further admission — the loop then drains what is already live and returns.
|
|
3608
|
+
* It never retries a rejected spawn against the same pool, and it never spawns past `width`.
|
|
3609
|
+
*
|
|
3610
|
+
* ── The concurrency-cap ledger (read this before adding a fourth cap) ──────────────────────────
|
|
3611
|
+
*
|
|
3612
|
+
* Three unrelated caps bound "how much runs at once" in this stack, at three different layers.
|
|
3613
|
+
* They are NOT aware of each other, and the smallest one silently wins:
|
|
3614
|
+
*
|
|
3615
|
+
* 1. `CoordinationToolsOptions.maxLiveWorkers` (`src/mcp/tools/coordination.ts`) — supervisor
|
|
3616
|
+
* level. How many workers may be spawned-but-not-settled at once; `spawn_agent` fails closed
|
|
3617
|
+
* with `error: 'max-live-workers'` past it. Unset by default ⇒ NO cap at this layer.
|
|
3618
|
+
* 2. `SandboxLineage`'s `maxConcurrency` / `DEFAULT_FORK_CONCURRENCY = 4`
|
|
3619
|
+
* (`src/runtime/sandbox-lineage.ts`) — kernel level. How many BOXES one `runLoop` fork wave
|
|
3620
|
+
* provisions at once. It bounds a single leaf's fanout, not the supervisor's worker count.
|
|
3621
|
+
* 3. A host's own live-box governor (e.g. loops' `ComputeGovernor`, `maxSandboxes = 4`) — fleet
|
|
3622
|
+
* level. How many sandboxes may exist across the whole host process.
|
|
3623
|
+
*
|
|
3624
|
+
* The honest effective limit on simultaneous WORKERS is the minimum of the caps that apply to the
|
|
3625
|
+
* worker layer — (1) and (3). (2) is a different unit (boxes per fork wave inside one leaf) and
|
|
3626
|
+
* must not be min'd into it, or a 4-way fork inside one worker reads as a 4-worker ceiling.
|
|
3627
|
+
* `effectiveConcurrency` computes that minimum in one place so a host derives ONE number and
|
|
3628
|
+
* passes it to BOTH `maxLiveWorkers` and this dispatcher's `width`, instead of leaving a fleet
|
|
3629
|
+
* governor of 4 and an unset worker fence as unrelated numbers.
|
|
3630
|
+
*
|
|
3631
|
+
* ── Why this is not a copy of the kernel's batch loop ──────────────────────────────────────────
|
|
3632
|
+
*
|
|
3633
|
+
* `runBatch` (`src/runtime/run-loop.ts`) runs the same hold-N-slots-full shape over the KERNEL's
|
|
3634
|
+
* substrate: bare promises in a `Set`, raced with `Promise.race`, bounded by `maxConcurrency`.
|
|
3635
|
+
* This one runs it over the SUPERVISOR's substrate — `Scope.spawn`'s atomic reservation against
|
|
3636
|
+
* the conserved pool, `Scope.next`'s journaled settlement cursor, and the blob store behind each
|
|
3637
|
+
* result. Neither can be expressed in the other's terms without dragging its whole substrate
|
|
3638
|
+
* along: the kernel loop has no budget to reserve and no cursor to order settlements by, and this
|
|
3639
|
+
* one cannot race raw promises because a settlement is only real once it is journaled. The shape
|
|
3640
|
+
* repeating across the two deliberate layers is resonance, not duplication — do not "unify" them
|
|
3641
|
+
* into a shared helper that would have to know about both.
|
|
3500
3642
|
*
|
|
3501
3643
|
* @experimental
|
|
3502
3644
|
*/
|
|
3503
3645
|
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
readonly
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
*
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
/**
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
/**
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
/** The box's harness (e.g. 'opencode', 'claude-code') → selects its decoder adapter. */
|
|
3554
|
-
harness?: string;
|
|
3555
|
-
subscribeParts?: (onPart: (part: unknown) => void) => () => void;
|
|
3556
|
-
runId?: string;
|
|
3557
|
-
now?: () => number;
|
|
3558
|
-
}): TraceSource;
|
|
3559
|
-
|
|
3646
|
+
/** One unit of queued work: the agent to run, its task, and the spawn options (budget + label).
|
|
3647
|
+
* `nextUnit` mints these lazily so a queue can be generated, re-ordered, or grown while the
|
|
3648
|
+
* dispatcher runs. */
|
|
3649
|
+
interface DispatchUnit<Out> {
|
|
3650
|
+
readonly agent: Agent<unknown, Out>;
|
|
3651
|
+
readonly task: unknown;
|
|
3652
|
+
readonly opts: SpawnOpts;
|
|
3653
|
+
}
|
|
3654
|
+
/** Why the dispatcher stopped admitting work. `drained` = the queue ran dry (the ordinary end);
|
|
3655
|
+
* `not-admitted` = the conserved pool or the depth ceiling refused a spawn; `stopped` = the
|
|
3656
|
+
* caller's `shouldStop` returned true; `aborted` = the scope's signal fired. */
|
|
3657
|
+
type DispatchStopReason = 'drained' | 'not-admitted' | 'stopped' | 'aborted';
|
|
3658
|
+
interface RollingDispatchOptions<Out> {
|
|
3659
|
+
/**
|
|
3660
|
+
* How many children to hold in flight. Must be a positive integer. This is a SIMULTANEITY fence
|
|
3661
|
+
* only — the conserved pool still bounds total work, and a `width` larger than the pool can
|
|
3662
|
+
* afford simply hits `not-admitted` sooner. Derive it with `effectiveConcurrency` when the host
|
|
3663
|
+
* also runs a fleet-level box governor.
|
|
3664
|
+
*/
|
|
3665
|
+
readonly width: number;
|
|
3666
|
+
/**
|
|
3667
|
+
* Produce the next unit of work, or `undefined` when the queue is dry. Called only when a slot
|
|
3668
|
+
* is free, so a caller may compute the next unit from what has already settled (the point of a
|
|
3669
|
+
* refilling dispatcher: the queue is allowed to react). Never called after a stop.
|
|
3670
|
+
*/
|
|
3671
|
+
nextUnit(): DispatchUnit<Out> | undefined | Promise<DispatchUnit<Out> | undefined>;
|
|
3672
|
+
/**
|
|
3673
|
+
* Called once per settlement, in cursor order, BEFORE the freed slot is refilled — so an
|
|
3674
|
+
* `onSettled` that appends to the caller's queue is visible to the very next `nextUnit`.
|
|
3675
|
+
*/
|
|
3676
|
+
onSettled?(settled: Settled<Out>): void | Promise<void>;
|
|
3677
|
+
/**
|
|
3678
|
+
* Consulted before each admission. `true` stops admitting; the already-live children are still
|
|
3679
|
+
* drained to completion (no orphan, no lost settlement). Use it for a progress/plateau rule.
|
|
3680
|
+
*/
|
|
3681
|
+
shouldStop?(): boolean;
|
|
3682
|
+
}
|
|
3683
|
+
interface DispatchReport<Out> {
|
|
3684
|
+
/** Every settlement, in the order `scope.next()` yielded them. */
|
|
3685
|
+
readonly settled: ReadonlyArray<Settled<Out>>;
|
|
3686
|
+
/** How many children this dispatcher admitted. */
|
|
3687
|
+
readonly admitted: number;
|
|
3688
|
+
/** Admission rejections, in order — `label: reason`. Non-empty ⇒ the pool or depth fenced. */
|
|
3689
|
+
readonly rejected: ReadonlyArray<string>;
|
|
3690
|
+
readonly stopReason: DispatchStopReason;
|
|
3691
|
+
/** The highest simultaneous live count actually reached — the number to compare against
|
|
3692
|
+
* `width` when asking "did the slots really stay full?" */
|
|
3693
|
+
readonly peakLive: number;
|
|
3694
|
+
}
|
|
3560
3695
|
/**
|
|
3696
|
+
* Run the refilling dispatch loop over `scope` until the queue is dry (or a stop fires) and every
|
|
3697
|
+
* admitted child has settled. Returns the settlements in cursor order plus the admission ledger.
|
|
3561
3698
|
*
|
|
3562
|
-
* The
|
|
3563
|
-
*
|
|
3564
|
-
*
|
|
3565
|
-
* agnostic: it consumes spans from any source (owned router/bridge loop OR a sandbox box session),
|
|
3566
|
-
* never the raw tool seam. Detection logic + the failure taxonomy live in agent-eval; not reimplemented.
|
|
3567
|
-
*
|
|
3568
|
-
* @experimental
|
|
3699
|
+
* The loop is: fill free slots from `nextUnit` → `await scope.next()` → deliver the settlement →
|
|
3700
|
+
* refill → repeat. Because the refill happens immediately after each settlement rather than after
|
|
3701
|
+
* a whole round, a slow child never idles the other slots.
|
|
3569
3702
|
*/
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3703
|
+
declare function rollingDispatch<Out>(scope: Scope<Out>, opts: RollingDispatchOptions<Out>): Promise<DispatchReport<Out>>;
|
|
3704
|
+
/**
|
|
3705
|
+
* Free worker slots under a simultaneity cap: `cap - live`, floored at 0, or `null` when there is
|
|
3706
|
+
* no cap (the conserved pool is then the only fence and "free slots" is not a finite number).
|
|
3707
|
+
* The one place the answer is computed, so the driver-facing tool payload and a dispatcher agree.
|
|
3708
|
+
*/
|
|
3709
|
+
declare function freeSlots(liveCount: number, cap: number | undefined): number | null;
|
|
3710
|
+
/** The caps a host can set on simultaneous work. See the ledger in this module's header for what
|
|
3711
|
+
* each one actually bounds. */
|
|
3712
|
+
interface ConcurrencyCaps {
|
|
3713
|
+
/** Supervisor level: max spawned-but-unsettled workers. */
|
|
3714
|
+
readonly maxLiveWorkers?: number;
|
|
3715
|
+
/** Fleet level: max live sandboxes/boxes across the host process (a `ComputeGovernor`-style
|
|
3716
|
+
* cap). Applies to the worker layer, so it participates in the minimum. */
|
|
3717
|
+
readonly maxSandboxes?: number;
|
|
3576
3718
|
}
|
|
3577
|
-
/** The default online panel for a tool-call pipe: a worker repeating the same call, or hammering
|
|
3578
|
-
* consecutive errors. (No-progress needs a domain progress-probe, so it is opt-in, not default.)
|
|
3579
|
-
*
|
|
3580
|
-
* Coverage note: `repeated-action` works for EVERY harness (it needs only tool name + args, which
|
|
3581
|
-
* every adapter provides). `error-streak` needs per-call status — opencode carries it inline
|
|
3582
|
-
* (`state.status`, VALIDATED live), but claude-code/codex tool-call parts do NOT (their errors live
|
|
3583
|
-
* in separate result blocks not yet decoded), so error-streak is silent for those until result-block
|
|
3584
|
-
* decoding is added + live-validated. It is in the panel because it is correct where status exists. */
|
|
3585
|
-
declare function defaultToolDetectors(): StreamingDetector[];
|
|
3586
|
-
/** Subscribe to a `TraceSource` and run the streaming detectors over its live spans. Returns an
|
|
3587
|
-
* unsubscribe. A defensive `argHash` failure (circular args) never throws out of the side-channel. */
|
|
3588
|
-
declare function watchTrace(source: TraceSource, opts?: WatchTraceOptions): () => void;
|
|
3589
|
-
|
|
3590
3719
|
/**
|
|
3720
|
+
* The ONE honest effective limit on simultaneous workers: the minimum of the caps that actually
|
|
3721
|
+
* bound the worker layer. Ignores unset/non-positive caps; returns `undefined` when no cap applies
|
|
3722
|
+
* (uncapped — the conserved pool remains the only fence).
|
|
3591
3723
|
*
|
|
3592
|
-
*
|
|
3593
|
-
*
|
|
3594
|
-
*
|
|
3595
|
-
*
|
|
3596
|
-
* - QUEUED (default): the message accumulates and is FLUSHED at the next step boundary — folded
|
|
3597
|
-
* into the conversation before the next think. A worker is also forced to flush BEFORE it may
|
|
3598
|
-
* settle, so it can never finish while a steer/answer it never read is still pending.
|
|
3599
|
-
* - FORCEFUL (`interrupt: true`): trips `freshInterrupt()`'s signal so the loop can abort its
|
|
3600
|
-
* in-flight turn immediately, then re-plan with the message folded in — breaking the worker out
|
|
3601
|
-
* of a wrong path mid-task instead of waiting for it to finish the step.
|
|
3724
|
+
* Deliberately does NOT fold in `SandboxLineage`'s fork concurrency: that bounds boxes inside ONE
|
|
3725
|
+
* leaf's fork wave, a different unit. Folding it in would report a 4-worker ceiling for what is
|
|
3726
|
+
* really a 4-box fanout inside a single worker.
|
|
3602
3727
|
*
|
|
3603
|
-
*
|
|
3604
|
-
*
|
|
3605
|
-
* @experimental
|
|
3728
|
+
* Use it once, at the top of a run, and pass the result to BOTH `maxLiveWorkers` and a
|
|
3729
|
+
* dispatcher's `width` — that is what turns three unrelated numbers into one.
|
|
3606
3730
|
*/
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
}
|
|
3615
|
-
interface Inbox {
|
|
3616
|
-
/** The `Executor.deliver` implementation — accept a raw down-message from `Scope.send`. */
|
|
3617
|
-
deliver(msg: unknown): void;
|
|
3618
|
-
/** Remove and return all pending messages (the flush). */
|
|
3619
|
-
drain(): InboxMessage[];
|
|
3620
|
-
pending(): number;
|
|
3621
|
-
/** Open a fresh per-turn interrupt signal; a later forceful `deliver` aborts it. The loop links
|
|
3622
|
-
* this into the signal it passes to its inference call, then re-plans when it fires. */
|
|
3623
|
-
freshInterrupt(): AbortSignal;
|
|
3624
|
-
/** Render drained messages as ONE operator turn to fold into the worker's conversation. */
|
|
3625
|
-
fold(messages: ReadonlyArray<InboxMessage>): string;
|
|
3626
|
-
}
|
|
3627
|
-
/** Create the worker-side inbox for the down-leg: the driver's `steer_agent` / `answer_question` messages queue here and the worker's loop drains them at step boundaries and before settle. */
|
|
3628
|
-
declare function createInbox(): Inbox;
|
|
3731
|
+
declare function effectiveConcurrency(caps: ConcurrencyCaps): number | undefined;
|
|
3732
|
+
/** Convenience: a `DispatchUnit` factory over a fixed array of tasks, for the common case where
|
|
3733
|
+
* the queue is known up front and only the refill behavior is wanted. */
|
|
3734
|
+
declare function queueOf<Out>(units: ReadonlyArray<{
|
|
3735
|
+
agent: Agent<unknown, Out>;
|
|
3736
|
+
task: unknown;
|
|
3737
|
+
label: string;
|
|
3738
|
+
}>, budget: Budget): () => DispatchUnit<Out> | undefined;
|
|
3629
3739
|
|
|
3630
3740
|
/**
|
|
3631
3741
|
* Throw a `ConfigError` when `allowed` is set, `model` is defined, and `model` is not a
|
|
@@ -3660,7 +3770,7 @@ declare function assertModelAllowed(model: string | undefined, allowed: readonly
|
|
|
3660
3770
|
* @experimental
|
|
3661
3771
|
*/
|
|
3662
3772
|
|
|
3663
|
-
/** Options for
|
|
3773
|
+
/** Options for a supervised run context. */
|
|
3664
3774
|
interface InMemoryRunContextOptions {
|
|
3665
3775
|
/**
|
|
3666
3776
|
* Wrap the executor registry with `withDriverExecutor` so a spawned child marked
|
|
@@ -3678,12 +3788,35 @@ interface InMemoryRunContext {
|
|
|
3678
3788
|
readonly journal: SpawnJournal;
|
|
3679
3789
|
readonly blobs: ResultBlobStore;
|
|
3680
3790
|
readonly executors: ExecutorRegistry;
|
|
3791
|
+
/**
|
|
3792
|
+
* Present (and `true`) only on a DURABLE context (`createFileRunContext`), so spreading the
|
|
3793
|
+
* context into `SupervisorOpts` also opts the run into resume-first. An in-memory context
|
|
3794
|
+
* leaves it undefined: there is never a prior tree to resume, and the default stays fresh-run.
|
|
3795
|
+
*/
|
|
3796
|
+
readonly resume?: boolean;
|
|
3681
3797
|
}
|
|
3798
|
+
/** The stores a supervised run needs, in-memory or file-backed. `InMemoryRunContext` is the
|
|
3799
|
+
* historical name for the same shape. */
|
|
3800
|
+
type RunContext = InMemoryRunContext;
|
|
3682
3801
|
/**
|
|
3683
3802
|
* Build a fresh in-memory run context. Every call returns NEW stores (no shared global
|
|
3684
3803
|
* state between runs), so two runs never cross-contaminate their journals/blobs.
|
|
3685
3804
|
*/
|
|
3686
3805
|
declare function createInMemoryRunContext(opts?: InMemoryRunContextOptions): InMemoryRunContext;
|
|
3806
|
+
/**
|
|
3807
|
+
* Build a DURABLE run context: the spawn journal and the result blobs are file-backed (fsynced
|
|
3808
|
+
* per append/write) under `dir`, and the context carries `resume: true` so spreading it into
|
|
3809
|
+
* `SupervisorOpts` makes the supervisor `loadTree`-first. A run that dies mid-flight therefore
|
|
3810
|
+
* resumes when it is re-run with the SAME `runId` and the SAME `dir`: the committed children come
|
|
3811
|
+
* back on `Scope.resume` (rehydrated by `replaySpawnTree`) instead of being re-executed.
|
|
3812
|
+
*
|
|
3813
|
+
* Layout: `${dir}/spawn-journal.jsonl` (one JSONL record per event) and `${dir}/blobs/` (one
|
|
3814
|
+
* content-addressed JSON file per settled result). The directory is created on first write.
|
|
3815
|
+
*
|
|
3816
|
+
* Opt-in by construction — `createInMemoryRunContext()` is unchanged and stays the default, so no
|
|
3817
|
+
* existing consumer writes to disk or resumes unless it asks for this.
|
|
3818
|
+
*/
|
|
3819
|
+
declare function createFileRunContext(dir: string, opts?: InMemoryRunContextOptions): RunContext;
|
|
3687
3820
|
|
|
3688
3821
|
/**
|
|
3689
3822
|
*
|
|
@@ -3728,6 +3861,11 @@ interface ScopeArgs {
|
|
|
3728
3861
|
readonly blobs: ResultBlobStore;
|
|
3729
3862
|
/** The open executor resolver (BYO → router/inline → registered harness factory). */
|
|
3730
3863
|
readonly executors: ExecutorRegistry;
|
|
3864
|
+
/** Predicate resolver for `poll` wait-states. Absent ⇒ `wait` refuses a `poll` with
|
|
3865
|
+
* `unknown-probe`; `timer` waits never touch it. */
|
|
3866
|
+
readonly probes?: WaitProbeRegistry;
|
|
3867
|
+
/** Injected sleeper for wait-states — a test drives a week-long timer in microseconds. */
|
|
3868
|
+
readonly waitSleep?: (ms: number, signal: AbortSignal) => Promise<void>;
|
|
3731
3869
|
/** Per-spawn executor-construction seams (sandbox client, router config, cli bin). */
|
|
3732
3870
|
readonly seams: Readonly<Record<string, unknown>>;
|
|
3733
3871
|
/** This scope's recursion depth (root = 0). */
|
|
@@ -3742,6 +3880,25 @@ interface ScopeArgs {
|
|
|
3742
3880
|
* SAME stream `runLoop`/`tool-loop` feed, so the recursive tree is ONE observable stream
|
|
3743
3881
|
* (the topology viewer reads it). Undefined ⇒ the journal stays the only record. */
|
|
3744
3882
|
readonly hooks?: RuntimeHooks;
|
|
3883
|
+
/**
|
|
3884
|
+
* Resume seam — set ONLY by the supervisor when `SupervisorOpts.resume` is on AND a non-empty
|
|
3885
|
+
* journal tree exists for this root. It carries the replayed committed work (so `scope.resume`
|
|
3886
|
+
* exposes it to a resume-aware `act`) and the recorded ordinal/cursor maxima the new counters
|
|
3887
|
+
* continue past, so a freshly-spawned child never reuses a journaled `seq`. Absent ⇒ fresh run.
|
|
3888
|
+
*/
|
|
3889
|
+
readonly resumeFrom?: {
|
|
3890
|
+
readonly settled: ReadonlyArray<Settled<unknown>>;
|
|
3891
|
+
readonly view: TreeView;
|
|
3892
|
+
/** Highest `spawned` ordinal already journaled; new spawns start at `+1`. */
|
|
3893
|
+
readonly maxSpawnOrdinal: number;
|
|
3894
|
+
/** Highest cursor `seq` already journaled; new settlements start at `+1`. */
|
|
3895
|
+
readonly maxCursorSeq: number;
|
|
3896
|
+
/** Highest `waiting` ordinal already journaled; new waits start at `+1`. */
|
|
3897
|
+
readonly maxWaitOrdinal: number;
|
|
3898
|
+
/** Waits journaled as armed but never woken — re-armed (same node id, same absolute deadline)
|
|
3899
|
+
* when `wait` is called again with the SAME label. */
|
|
3900
|
+
readonly waits: ReadonlyArray<PendingWait>;
|
|
3901
|
+
};
|
|
3745
3902
|
}
|
|
3746
3903
|
/** Create the reactive `Scope` a driver's `Agent.act` runs inside: spawn children on an atomically reserved conserved budget, settle via the `next()` cursor, journal for replay. */
|
|
3747
3904
|
declare function createScope<Out>(args: ScopeArgs): Scope<Out>;
|
|
@@ -3979,4 +4136,4 @@ declare function runInWorkspace<T>(ws: Workspace, body: (cwd: string) => Promise
|
|
|
3979
4136
|
commitOnInvalid?: boolean;
|
|
3980
4137
|
}): Promise<WorkspaceRun<T>>;
|
|
3981
4138
|
|
|
3982
|
-
export { Agent, AgentRunSpec, type AgentTurnBackend, type AgentTurnUsage, AgenticOptions, AgenticSurface, AgenticTask, AgenticTool, AnalystRegistry, type AnytimeReport, type AnytimeStrategySummary, type AnytimeTaskCurve, type ApplyContinuation, 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, 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
|
|
4139
|
+
export { Agent, AgentRunSpec, type AgentTurnBackend, type AgentTurnUsage, AgenticOptions, AgenticSurface, AgenticTask, AgenticTool, AnalystRegistry, type AnytimeReport, type AnytimeStrategySummary, type AnytimeTaskCurve, type ApplyContinuation, 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, type ConcurrencyCaps, CoordinationEvent, type CoordinationMcpHandle, Corpus, CorpusFilter, CorpusRecord, type CreateScopeAnalystOptions, type CriuCapableClient, DefinePersonaInput, type DefinedLeaderboard, type DelegateOptions, type Deliverable, DeliverableSpec, type DispatchReport, type DispatchStopReason, type DispatchUnit, 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, FileResultBlobStore, FileSpawnJournal, type ForkCapableBox, type GitWorkspaceOptions, type HarvestCorpusOptions, type HarvestFailure, type HarvestReport, InMemoryCorpus, InMemoryResultBlobStore, type InMemoryRunContext, type InMemoryRunContextOptions, InMemorySpawnJournal, type InProcessOnPrompt, type InProcessPromptCtx, type InProcessSandboxClientOptions, type IntentAudit, type Interval, Iteration, type KeyProvider, 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 LocalMcpMaterialization, type LocalSandboxClientOptions, type LoopCampaignDispatchOptions, type LoopDispatchOptions, LoopLineageOptions, type LoopOptionsForDispatch, LoopResult, LoopShape, LoopTokenUsage, LoopUntilSpec, LoopWinner, MakeWorkerAgent, type MaterializeLocalMcpOptions, type McpEndpoint, type McpEnvironmentOptions, McpSpawnFault, type McpToolDescriptor, MountRecorder, type NaiveDriverOptions, NodeId, type Observation, type ObserveInput, type ObserveOptions, type OpenSandboxRunBeforeStartContext, type OpenSandboxRunOptions, type OpenSandboxRunPromptOptions, Outcome, OutputAdapter, type PairwiseOptions, type PairwiseVerdict, PanelSpec, PendingWait, Persona, PipelineStage, type ProfileRichness, type ProfileRichnessThresholds, type PromotionGateOptions, type PromotionVerdict, type RegistryAnalyzeProjection, RenderCorpusToInstructionsOptions, type ReservationTicket, type ResolveSandboxClientOptions, ResultBlobStore, type RollingDispatchOptions, RouterConfig, type RunContext, RunPersonifiedOptions, type SandboxCapabilities, SandboxClient, type SandboxLineage, type SandboxLineageHandle, type SandboxRun, SandboxRunAbortError, type SandboxToolPartState, Scope, ScopeAnalyst, ScopeAnalyzeInput, ScopeWidenGate, type SessionCapableBox, Settled, ShapeRegistry, type Shell, SpawnEvent, SpawnJournal, SpawnOpts, Spend, type StdioMcpConnection, type StdioMcpServerSpec, SteerContext, type SteeringDecision, StopRule, Strategy, type StrategyEvolutionConfig, type StreamAgentTurnOptions, type SuperviseSurfaceOptions, type SuperviseSurfaceResult, SupervisedResult, Supervisor, SupervisorProfile, SurfaceScore, type SurfaceWorkerConfig, type SurfaceWorkerOut, ToolLoopChat, ToolLoopCompactionOptions, TraceSource, type TrajectoryAnalysis, TrajectoryReport, TrajectoryReportOptions, TreeView, type TurnResult, UsageEvent, type UsageSink, Validator, type VerifierEnvironmentOptions, VerifySpec, WaitProbeRegistry, type WaterfallCollector, type WaterfallReport, type WaterfallSpan, WidenSpec, WinnerStrategy, type Workspace, type WorkspaceCommit, type WorkspaceRun, acquireSandbox, analyzeTrace, anytimeReport, areaUnderCurve, asAuthoredProfile, assertModelAllowed, assertStrategyContract, assertTraceDerivedFindings, assessAuthoredProfile, auditIntent, authorStrategy, authoredWorker, bestSoFar, buildSteerContext, builtinShapes, collectAgentTurn, completionAuthorizes, connectStdioMcp, contentAddress, createBudgetPool, createFileRunContext, createInMemoryRunContext, createMcpEnvironment, createSandboxLineage, createSandboxToolPartState, createScope, createScopeAnalyst, createShapeRegistry, createSupervisor, createVerifierEnvironment, createWaterfallCollector, defaultAnalystInstruction, defaultAuditorInstruction, defaultDelegateBudget, defaultProfileRichnessThresholds, defaultSelectWinner, defineLeaderboard, definePersona, delegate, deterministicCompletion, discriminatingMeans, driverAgent, dumbDriver, effectiveConcurrency, envKeyProvider, equalKOnCost, extractLlmCallEvent, failuresAnalyst, fanout, finalizeBestDelivered, flatWidenGate, freeSlots, gitWorkspace, harvestCorpus, inProcessSandboxClient, inlineSandboxClient, jjWorkspace, leaderboard, localSandboxClient, localShell, loopCampaignDispatch, loopDispatch, loopUntil, mapSandboxEvent, mapSandboxToolEvent, materializeLocalMcp, materializeTreeView, mcpSecretEnvMetadataKey, naiveDriver, observe, openSandboxRun, pairwiseSignificance, panel, pendingWaits, pickChampion, pipeline, plateauLength, printBenchmarkReport, probeSandboxCapabilities, profileRichnessFinding, promotionGate, queueOf, registerShape, registryScopeAnalyst, renderAnytimeTable, renderCorpusToInstructions, renderLeaderboardHtml, renderLeaderboardMarkdown, renderLeaderboardSvg, renderPairwiseMarkdown, renderReport, replaySpawnTree, reportLoopUsage, resolveSandboxClient, resolveSecretEnv, rollingDispatch, runBenchmark, runInWorkspace, runLoop, runPersonified, runStrategyEvolution, sanitizeMcpToolSchema, secretEnvOfMcpServer, selectChampion, selectValidWinner, sentinelCompletion, serveCoordinationMcp, settledToIteration, spendFromUsageEvents, stopSentinel, strategyAuthorContract, streamAgentTurn, sumSandboxUsage, superviseSurface, supervisorInstructions, trajectoryReport, verify, widen };
|