@tangle-network/agent-runtime 0.116.0 → 0.119.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 +9 -1
- package/dist/{activation-DuqQhee6.js → activation-DdIpwQ0k.js} +3 -3
- package/dist/{activation-DuqQhee6.js.map → activation-DdIpwQ0k.js.map} +1 -1
- package/dist/agent.d.ts +3 -64
- package/dist/agent.js +5 -207
- package/dist/agent.js.map +1 -1
- package/dist/{analyst-loop-BoNIG2hA.js → analyst-loop-DvSciOfB.js} +2 -2
- package/dist/{analyst-loop-BoNIG2hA.js.map → analyst-loop-DvSciOfB.js.map} +1 -1
- package/dist/analyst-loop.js +1 -1
- package/dist/candidate-execution/index.d.ts +3 -3
- package/dist/candidate-execution/index.js +5 -5
- package/dist/{candidate-execution-CfpJrd3o.js → candidate-execution-DDkSRPjY.js} +4 -4
- package/dist/{candidate-execution-CfpJrd3o.js.map → candidate-execution-DDkSRPjY.js.map} +1 -1
- package/dist/{environment-provider-CWsRh6Uz.d.ts → environment-provider-Bh4nX2qt.d.ts} +306 -32
- package/dist/{environment-provider-CCaEhA-l.js → environment-provider-Cr75N-rU.js} +141 -32
- package/dist/environment-provider-Cr75N-rU.js.map +1 -0
- package/dist/environment-provider.d.ts +1 -1
- package/dist/environment-provider.js +1 -1
- package/dist/{improvement-cycle-C1cmjvPD.js → improvement-cycle-zjR-MXwK.js} +163 -22
- package/dist/improvement-cycle-zjR-MXwK.js.map +1 -0
- package/dist/{index-C-FYUuFG.d.ts → index-B3bHsVLw.d.ts} +2 -2
- package/dist/{index-CYkDeM5L.d.ts → index-BLsKcxNd.d.ts} +3 -3
- package/dist/{index-COumPQka.d.ts → index-CGADWaa_.d.ts} +864 -437
- package/dist/{index-DcLMNnG5.d.ts → index-I35151Fr.d.ts} +9 -9
- package/dist/index.d.ts +9 -9
- package/dist/index.js +13 -13
- package/dist/index.js.map +1 -1
- package/dist/intelligence.d.ts +10 -9
- package/dist/intelligence.js +15 -9
- package/dist/intelligence.js.map +1 -1
- package/dist/kernel.d.ts +4 -4
- package/dist/kernel.js +9 -8
- package/dist/{knowledge-DOzbywZT.js → knowledge-I1e9zQGj.js} +7 -7
- package/dist/knowledge-I1e9zQGj.js.map +1 -0
- package/dist/knowledge.d.ts +1 -1
- package/dist/knowledge.js +1 -1
- package/dist/{local-harness-t6cDWDQ2.d.ts → local-harness-BIajef4A.d.ts} +29 -7
- package/dist/{loop-runner-bin-BFrhPLKt.d.ts → loop-runner-bin-BeG9vTdE.d.ts} +3 -3
- package/dist/{loop-runner-bin-BuQjc5DR.js → loop-runner-bin-L996YVPS.js} +4 -4
- package/dist/{loop-runner-bin-BuQjc5DR.js.map → loop-runner-bin-L996YVPS.js.map} +1 -1
- package/dist/loop-runner-bin.d.ts +1 -1
- package/dist/loop-runner-bin.js +1 -1
- package/dist/mcp/bin.js +43 -10
- package/dist/mcp/bin.js.map +1 -1
- package/dist/mcp/index.d.ts +5 -45
- package/dist/mcp/index.js +8 -212
- package/dist/mcp/index.js.map +1 -1
- package/dist/{openai-tools-_Wyp4udO.js → openai-tools-CvFEzw6f.js} +2 -2
- package/dist/{openai-tools-_Wyp4udO.js.map → openai-tools-CvFEzw6f.js.map} +1 -1
- package/dist/{prepare-BHQBb02e.js → prepare-DpV6np9e.js} +47 -34
- package/dist/prepare-DpV6np9e.js.map +1 -0
- package/dist/primeintellect/index.d.ts +1 -1
- package/dist/{protected-model-port-BP6Z4eau.d.ts → protected-model-port-CoJOiINX.d.ts} +11 -3
- package/dist/{protected-model-port-DqAH1Z2M.js → protected-model-port-vQLBRoAQ.js} +2 -2
- package/dist/{protected-model-port-DqAH1Z2M.js.map → protected-model-port-vQLBRoAQ.js.map} +1 -1
- package/dist/{redact-BEtQtvd6.d.ts → redact-PQzmE1Jn.d.ts} +4 -4
- package/dist/run-layout-C2FGmZ3v.js +158 -0
- package/dist/run-layout-C2FGmZ3v.js.map +1 -0
- package/dist/{runtime-Ut1pkd2n.js → runtime-D4e3GP5K.js} +147 -190
- package/dist/runtime-D4e3GP5K.js.map +1 -0
- package/dist/{sandbox-events-DeI5xX8P.js → sandbox-events-Yhd1GYWl.js} +4 -2
- package/dist/sandbox-events-Yhd1GYWl.js.map +1 -0
- package/dist/spawn-journal-IeXpidO2.js +857 -0
- package/dist/spawn-journal-IeXpidO2.js.map +1 -0
- package/dist/{structural-rollout-CVY_0hJp.js → structural-rollout-DQHO3b2Y.js} +4 -4
- package/dist/structural-rollout-DQHO3b2Y.js.map +1 -0
- package/dist/{supervise-BUR9ByF7.js → supervise-Cq50UT5-.js} +2874 -1892
- package/dist/supervise-Cq50UT5-.js.map +1 -0
- package/dist/{supervisor-BBbPBXpe.js → supervisor-CpT9yAxL.js} +2896 -983
- package/dist/supervisor-CpT9yAxL.js.map +1 -0
- package/dist/testing.js +98 -76
- package/dist/testing.js.map +1 -1
- package/dist/top-app-5unxqovu.js +1088 -0
- package/dist/top-app-5unxqovu.js.map +1 -0
- package/dist/tui/bin.d.ts +1 -0
- package/dist/tui/bin.js +19 -0
- package/dist/tui/bin.js.map +1 -0
- package/dist/tui/index.d.ts +209 -0
- package/dist/tui/index.js +2 -0
- package/dist/{util-Cc9g9Y-o.js → util-MVgdwuIS.js} +2 -2
- package/dist/{util-Cc9g9Y-o.js.map → util-MVgdwuIS.js.map} +1 -1
- package/dist/{workspace-archive-DXzJq7WP.js → workspace-archive-B4SkNJjw.js} +2 -2
- package/dist/{workspace-archive-DXzJq7WP.js.map → workspace-archive-B4SkNJjw.js.map} +1 -1
- package/package.json +8 -2
- package/dist/environment-provider-CCaEhA-l.js.map +0 -1
- package/dist/improvement-cycle-C1cmjvPD.js.map +0 -1
- package/dist/knowledge-DOzbywZT.js.map +0 -1
- package/dist/prepare-BHQBb02e.js.map +0 -1
- package/dist/runtime-Ut1pkd2n.js.map +0 -1
- package/dist/sandbox-events-DeI5xX8P.js.map +0 -1
- package/dist/spawn-journal-DCPbicXB.js +0 -457
- package/dist/spawn-journal-DCPbicXB.js.map +0 -1
- package/dist/structural-rollout-CVY_0hJp.js.map +0 -1
- package/dist/supervise-BUR9ByF7.js.map +0 -1
- package/dist/supervisor-BBbPBXpe.js.map +0 -1
|
@@ -2,16 +2,148 @@ import { d as AgentTaskStatus, f as BackendErrorDetail, i as AgentExecutionBacke
|
|
|
2
2
|
import { n as AnalystRegistryLike } from "./types-zWfqDjeL.js";
|
|
3
3
|
import { l as RuntimeHooks } from "./runtime-hooks-sbRpjStq.js";
|
|
4
4
|
import { C as MountRecorder, D as SelectionReceipt, E as SandboxClient, a as Iteration, b as LoopTraceEvent, d as LoopLineageOptions, i as ExecCtx, k as Validator, m as LoopResult, r as Driver, t as AgentRunSpec, w as OutputAdapter, x as LoopWinner, y as LoopTraceEmitter } from "./types-DnNGJ5Gz.js";
|
|
5
|
-
import { B as
|
|
5
|
+
import { B as DefaultVerdict, Cn as WaitProbeRegistry, Ct as SupervisedResult, Et as TreeView, Fn as TraceSource, H as Executor, Hn as ExecutorProgress, I as Agent, K as ExecutorFactory, L as AgentExecutionRef, Nt as WorkerTraceResolver, Ot as UsageEvent, R as AgentSpec, Rt as TraceContext, St as SteerableRootHandle, V as ExecutionBindingReceipt, Wn as WorkerProgress, Xt as OtelExporter, Y as ExecutorRegistry, Yt as OtelExportConfig, _t as SpawnJournal, at as ProfileMaterializationReceipt, bn as PendingWait, ct as ResumedKeyState, gt as SpawnEvent, ht as Settled, i as AgentEnvironmentProvider, jt as WorkerTraceEvidence, mt as Scope, nt as NodeId, o as AgentEnvironmentProviderRegistry, pt as Runtime, rt as NodeSnapshot, st as ResultBlobStore, tt as NodeExecutionIdentity, ut as RootHandle, vt as SpawnOpts, w as ProviderExecutorOptions, wt as Supervisor, xt as Spend, z as Budget } from "./environment-provider-Bh4nX2qt.js";
|
|
6
6
|
import { o as UiLens, r as UiFinding, s as CoderTask } from "./substrate-BcnuSHXm.js";
|
|
7
|
-
import {
|
|
8
|
-
import { AgentEvalError, AgentEvalError as AgentEvalError$1, AgentEvalErrorCode, AgentProfile, AnalystFinding, AnalystFinding as AnalystFinding$1, AnalystFinding as AnalystFinding$2, AnalystRunInputs, ChatClient, ConfigError, DetectorSignal, HarnessType, JudgeError, MaximumCharge, NotFoundError, ProposalFinding, RankTestMethod, RunRecord, StreamingDetector, ToolSpan, ValidationError, buildTrajectory, computeFindingId as computeFindingId$1, makeFinding as makeFinding$1 } from "@tangle-network/agent-eval";
|
|
7
|
+
import { E as ToolLoopCompactionOptions, f as runLocalHarness, h as RouterConfig, n as CodexExecutionPolicy, o as LocalHarness, r as CodexTokenUsage, v as ToolSpec, w as ToolLoopChat } from "./local-harness-BIajef4A.js";
|
|
8
|
+
import { AgentEvalError, AgentEvalError as AgentEvalError$1, AgentEvalErrorCode, AgentProfile, AnalystFinding, AnalystFinding as AnalystFinding$1, AnalystFinding as AnalystFinding$2, AnalystRunInputs, ChatClient, ConfigError, DetectorSignal, HarnessType, JudgeError, MaximumCharge, NotFoundError, ProposalFinding, RankTestMethod, RunRecord, StreamingDetector, ToolSpan, TraceAnalysisStore, ValidationError, buildTrajectory, computeFindingId as computeFindingId$1, makeFinding as makeFinding$1 } from "@tangle-network/agent-eval";
|
|
9
9
|
import { DispatchFn, JudgeConfig, ProfileDispatchFn, RunProfileMatrixOptions, RunProfileMatrixResult, Scenario } from "@tangle-network/agent-eval/campaign";
|
|
10
|
-
import { AgentProfile as AgentProfile$1, AgentProfile as AgentProfile$2, AgentProfile as AgentProfile$3, AgentProfileMcpServer, AgentProfileModelHints, AgentProfilePrompt, AgentProfileResources, AgentProfileSecurityPolicy } from "@tangle-network/agent-interface";
|
|
10
|
+
import { AGENT_PROFILE_MATERIALIZATION_AXES, AgentProfile as AgentProfile$1, AgentProfile as AgentProfile$2, AgentProfile as AgentProfile$3, AgentProfileMcpServer, AgentProfileModelHints, AgentProfilePrompt, AgentProfileResources, AgentProfileSecurityPolicy, CanonicalAgentProfileMaterializationAxis, Sha256Digest, profileMaterializationAxes } from "@tangle-network/agent-interface";
|
|
11
11
|
import { WorkspacePlanReceipt } from "@tangle-network/agent-profile-materialize";
|
|
12
12
|
import { BackendType, CreateSandboxOptions, CreateSandboxOptions as CreateSandboxOptions$1, PromptOptions, SandboxEvent, SandboxEvent as SandboxEvent$1, SandboxInstance, SandboxInstance as SandboxInstance$1 } from "@tangle-network/sandbox";
|
|
13
13
|
import { stuckLoopView, toolWasteView } from "@tangle-network/agent-eval/pipelines";
|
|
14
|
+
//#region src/agent/profile-materialization.d.ts
|
|
15
|
+
type KnownAgentProfileMaterializationAxis = CanonicalAgentProfileMaterializationAxis;
|
|
16
|
+
/** AgentProfile axis name, with `custom:<name>` reserved for caller-owned extensions. */
|
|
17
|
+
type AgentProfileMaterializationAxis = KnownAgentProfileMaterializationAxis | `custom:${string}`;
|
|
18
|
+
/** Declares which AgentProfile axes a concrete run path really carries. */
|
|
19
|
+
interface ProfileMaterializationContract {
|
|
20
|
+
/** Human-readable run path, e.g. `createSandboxAct` or `prompt-only-message`. */
|
|
21
|
+
name: string;
|
|
22
|
+
/** Profile axes this run path actually carries into execution. */
|
|
23
|
+
axes: readonly AgentProfileMaterializationAxis[];
|
|
24
|
+
}
|
|
25
|
+
/** One changed AgentProfile axis that would be dropped by a run path. */
|
|
26
|
+
interface ProfileMaterializationIssue {
|
|
27
|
+
contract: string;
|
|
28
|
+
axis: AgentProfileMaterializationAxis;
|
|
29
|
+
reason: 'unsupported-axis';
|
|
30
|
+
supportedAxes: readonly AgentProfileMaterializationAxis[];
|
|
31
|
+
}
|
|
32
|
+
/** Input for declaring a run path's profile-axis support. */
|
|
33
|
+
interface DefineProfileMaterializationContractOptions {
|
|
34
|
+
name: string;
|
|
35
|
+
axes: readonly AgentProfileMaterializationAxis[];
|
|
36
|
+
}
|
|
37
|
+
/** Input for checking a candidate diff against a run path. */
|
|
38
|
+
interface ValidateProfileMaterializationOptions {
|
|
39
|
+
contract: ProfileMaterializationContract;
|
|
40
|
+
changedAxes: readonly AgentProfileMaterializationAxis[];
|
|
41
|
+
}
|
|
42
|
+
/** Input for throwing on dropped profile axes. */
|
|
43
|
+
interface AssertProfileMaterializationOptions extends ValidateProfileMaterializationOptions {
|
|
44
|
+
/** Extra label included in the thrown error, usually the caller or run id. */
|
|
45
|
+
context?: string;
|
|
46
|
+
}
|
|
47
|
+
/** Materialization contract for a run path that executes every canonical AgentProfile leaf. */
|
|
48
|
+
declare const fullProfileMaterialization: ProfileMaterializationContract;
|
|
49
|
+
/**
|
|
50
|
+
* Materialization contract for an intentionally limited prompt-and-model execution path.
|
|
51
|
+
* Identity, harness, and metadata are control fields consumed for naming, placement,
|
|
52
|
+
* authorization, and durable attribution; they are carried without adding worker behavior.
|
|
53
|
+
* Every behavioral axis other than prompt and model remains unsupported.
|
|
54
|
+
*/
|
|
55
|
+
declare const promptModelProfileMaterialization: ProfileMaterializationContract;
|
|
56
|
+
/**
|
|
57
|
+
* Materialization contract for a local coding CLI in an isolated git worktree.
|
|
58
|
+
* The shared workspace materializer carries native tools, permissions, MCP, hooks, subagents,
|
|
59
|
+
* modes, and file-backed resources when the selected CLI supports their exact values.
|
|
60
|
+
* `resourceFailOnError` is carried: it is the fail-closed policy the pre-worktree resource
|
|
61
|
+
* RESOLUTION step (`resolveAgentProfileResources`) applies to remote profile resources. Runtime
|
|
62
|
+
* placement concerns (hub connections and confidential execution), provider-native extensions,
|
|
63
|
+
* and unused model hints are deliberately absent so they fail before a worktree or executor is
|
|
64
|
+
* created rather than being mistaken for an effective candidate change.
|
|
65
|
+
*/
|
|
66
|
+
declare const worktreeCliProfileMaterialization: ProfileMaterializationContract;
|
|
67
|
+
/** Materialization contract for a raw process path that carries only control/identity fields. */
|
|
68
|
+
declare const controlProfileMaterialization: ProfileMaterializationContract;
|
|
69
|
+
/** Materialization contract for an injected inference function whose surrounding driver still
|
|
70
|
+
* applies the profile prompt, name, placement, and metadata, but not model selection. */
|
|
71
|
+
declare const promptControlProfileMaterialization: ProfileMaterializationContract;
|
|
72
|
+
/**
|
|
73
|
+
* Materialization contract for `createSandboxAct`.
|
|
74
|
+
*
|
|
75
|
+
* `createSandboxAct` hands the whole `AgentProfile` to the sandbox as `backend.profile`, so every
|
|
76
|
+
* profile leaf crosses the boundary. `buildBackendOptions` resolves the runner from an explicit
|
|
77
|
+
* `sandboxOverrides.backend.type`, then `profile.metadata.backendType`, then `profile.harness`,
|
|
78
|
+
* so a candidate that changes only `harness` runs on the harness it declares — and one declaring
|
|
79
|
+
* a harness the sandbox cannot run throws rather than running elsewhere and reporting success.
|
|
80
|
+
*/
|
|
81
|
+
declare const sandboxActProfileMaterialization: ProfileMaterializationContract;
|
|
82
|
+
/** Materialization contract for a run path that only injects prompt text. */
|
|
83
|
+
declare const promptOnlyProfileMaterialization: ProfileMaterializationContract;
|
|
84
|
+
/**
|
|
85
|
+
* Materialization contract for a run path that injects prompt text plus inline resources.
|
|
86
|
+
*
|
|
87
|
+
* `resourceFailOnError` is absent: it is a resolution POLICY the attaching path would have to
|
|
88
|
+
* enforce, and inlining resource content does not carry it.
|
|
89
|
+
*/
|
|
90
|
+
declare const promptResourceProfileMaterialization: ProfileMaterializationContract;
|
|
91
|
+
/** Define the profile axes a concrete run path actually carries into execution. */
|
|
92
|
+
declare function defineProfileMaterializationContract(options: DefineProfileMaterializationContractOptions): ProfileMaterializationContract;
|
|
93
|
+
/** Return every changed profile axis that the selected run path would drop. */
|
|
94
|
+
declare function validateProfileMaterialization(options: ValidateProfileMaterializationOptions): readonly ProfileMaterializationIssue[];
|
|
95
|
+
/** Throw when a candidate changes axes the selected run path cannot carry. */
|
|
96
|
+
declare function assertProfileMaterialization(options: AssertProfileMaterializationOptions): void;
|
|
97
|
+
/** Format profile-axis drop issues into a concise operator-facing error. */
|
|
98
|
+
declare function renderProfileMaterializationIssues(issues: readonly ProfileMaterializationIssue[], context?: string): string;
|
|
99
|
+
//#endregion
|
|
100
|
+
//#region src/durable/content-address.d.ts
|
|
101
|
+
/** Stable content address shared by result and trace artifacts. */
|
|
102
|
+
declare function contentAddress(artifact: unknown): string;
|
|
103
|
+
//#endregion
|
|
14
104
|
//#region src/durable/spawn-journal.d.ts
|
|
105
|
+
/** One journal tree in a recursively loaded supervision forest. */
|
|
106
|
+
interface SpawnForestTree {
|
|
107
|
+
readonly root: NodeId;
|
|
108
|
+
/** Driver node that owns this tree; absent for the requested root tree. */
|
|
109
|
+
readonly ownerNodeId?: NodeId;
|
|
110
|
+
/** Journal tree containing `ownerNodeId`; absent for the requested root tree. */
|
|
111
|
+
readonly parentTreeRoot?: NodeId;
|
|
112
|
+
readonly events: ReadonlyArray<SpawnEvent>;
|
|
113
|
+
readonly view: TreeView;
|
|
114
|
+
}
|
|
115
|
+
/** One event with the journal tree that establishes its cursor namespace. */
|
|
116
|
+
interface SpawnForestEvent {
|
|
117
|
+
readonly treeRoot: NodeId;
|
|
118
|
+
readonly event: SpawnEvent;
|
|
119
|
+
}
|
|
120
|
+
/** One flattened node with the journal tree that owns its records. */
|
|
121
|
+
interface SpawnForestNode extends NodeSnapshot {
|
|
122
|
+
readonly treeRoot: NodeId;
|
|
123
|
+
}
|
|
124
|
+
/** A spawned worker with no terminal record in a cold snapshot. Resume treats the same state as
|
|
125
|
+
* in-doubt and conservatively retains its reservation. Root nodes and armed waits are excluded. */
|
|
126
|
+
interface SpawnForestInDoubtNode {
|
|
127
|
+
readonly treeRoot: NodeId;
|
|
128
|
+
readonly nodeId: NodeId;
|
|
129
|
+
readonly label: string;
|
|
130
|
+
readonly runtime: Runtime;
|
|
131
|
+
}
|
|
132
|
+
/** A driver spawn whose owned journal tree was never begun before the process stopped. */
|
|
133
|
+
interface SpawnForestMissingTree {
|
|
134
|
+
readonly parentTreeRoot: NodeId;
|
|
135
|
+
readonly ownerNodeId: NodeId;
|
|
136
|
+
readonly root: NodeId;
|
|
137
|
+
}
|
|
138
|
+
/** Complete cold-readable view of one recursive supervision run. */
|
|
139
|
+
interface SpawnForest {
|
|
140
|
+
readonly root: NodeId;
|
|
141
|
+
readonly trees: ReadonlyArray<SpawnForestTree>;
|
|
142
|
+
readonly nodes: ReadonlyArray<SpawnForestNode>;
|
|
143
|
+
readonly events: ReadonlyArray<SpawnForestEvent>;
|
|
144
|
+
readonly inDoubt: ReadonlyArray<SpawnForestInDoubtNode>;
|
|
145
|
+
readonly missingTrees: ReadonlyArray<SpawnForestMissingTree>;
|
|
146
|
+
}
|
|
15
147
|
/**
|
|
16
148
|
* Mint the content-addressed `outRef` for a result artifact: `sha256:<hex>` over a
|
|
17
149
|
* stable JSON encoding. Producers call this to derive the `outRef` they journal and
|
|
@@ -21,7 +153,6 @@ import { stuckLoopView, toolWasteView } from "@tangle-network/agent-eval/pipelin
|
|
|
21
153
|
* Stable encoding: object keys are sorted recursively so two structurally-equal
|
|
22
154
|
* artifacts hash identically regardless of key insertion order.
|
|
23
155
|
*/
|
|
24
|
-
declare function contentAddress(artifact: unknown): string;
|
|
25
156
|
/**
|
|
26
157
|
* In-memory `ResultBlobStore`. Content-addressed: `put` verifies the supplied
|
|
27
158
|
* `outRef` matches the artifact's hash so a stale/forged ref fails loud rather than
|
|
@@ -66,13 +197,33 @@ declare class InMemorySpawnJournal implements SpawnJournal {
|
|
|
66
197
|
*/
|
|
67
198
|
declare class FileSpawnJournal implements SpawnJournal {
|
|
68
199
|
private readonly path;
|
|
200
|
+
private appendTail;
|
|
69
201
|
constructor(path: string);
|
|
70
202
|
loadTree(root: NodeId): Promise<SpawnEvent[] | undefined>;
|
|
71
203
|
beginTree(root: NodeId, at: string): Promise<void>;
|
|
72
204
|
appendEvent(root: NodeId, ev: SpawnEvent): Promise<void>;
|
|
73
205
|
private loadTreeBegin;
|
|
74
206
|
private appendRecord;
|
|
207
|
+
private writeRecord;
|
|
75
208
|
}
|
|
209
|
+
/**
|
|
210
|
+
* Load every journal tree owned by one recursive supervision run and flatten its nodes/events.
|
|
211
|
+
*
|
|
212
|
+
* Nested driver tree keys are a Runtime implementation detail; callers should use this reader
|
|
213
|
+
* instead of deriving or scanning keys themselves. The reader follows only the explicit
|
|
214
|
+
* `ownedTreeRoot` written after Runtime privately attested a recursive executor; the open runtime
|
|
215
|
+
* string `driver` is never treated as ownership. Legacy records without `ownedTreeRoot` are
|
|
216
|
+
* intentionally treated as leaves rather than guessing or scanning convention-derived keys.
|
|
217
|
+
* This preserves each tree's independent cursor namespace on flattened events.
|
|
218
|
+
* A driver whose subtree was never begun is reported in `missingTrees`; any spawned non-root node
|
|
219
|
+
* without a terminal record is reported in `inDoubt`, matching resume's conservative lost-work
|
|
220
|
+
* interpretation.
|
|
221
|
+
*
|
|
222
|
+
* This is a cold/quiescent reader, not a transaction across an actively mutating file. Every value
|
|
223
|
+
* returned is a detached immutable snapshot, so later journal writes or caller mutation cannot
|
|
224
|
+
* change the result already observed.
|
|
225
|
+
*/
|
|
226
|
+
declare function loadSpawnForest(journal: SpawnJournal, root: NodeId): Promise<SpawnForest>;
|
|
76
227
|
/**
|
|
77
228
|
* Re-feed a journaled spawn tree in strict `seq` order, rehydrating each settled
|
|
78
229
|
* child's `out` from the blob store by `outRef`, and return the `Settled[]` exactly
|
|
@@ -155,8 +306,8 @@ declare function watchTrace(source: TraceSource, opts?: WatchTraceOptions): () =
|
|
|
155
306
|
* queued settles/findings so the driver sees it first; ties resolve FIFO by publish order.
|
|
156
307
|
*
|
|
157
308
|
* Observability is first-class (A++): every event is stamped with a monotonic `seq` and wall-clock
|
|
158
|
-
* `at`, the full ordered `history()` is retained as
|
|
159
|
-
* published/pulled counts by kind. Subscribers receive the stamped record, not a bare event.
|
|
309
|
+
* `at`, the full ordered `history()` is retained as current-process audit evidence, and `stats()`
|
|
310
|
+
* exposes published/pulled counts by kind. Subscribers receive the stamped record, not a bare event.
|
|
160
311
|
*
|
|
161
312
|
* The interface is transport-agnostic on purpose. Same box → this in-process queue. Cross box →
|
|
162
313
|
* the SAME publish/pull/subscribe surface backed by a durable mailbox on the parent's box (children
|
|
@@ -193,8 +344,9 @@ interface BusStats {
|
|
|
193
344
|
readonly byKind: Readonly<Record<string, number>>;
|
|
194
345
|
}
|
|
195
346
|
interface EventBus<E extends BusEvent> {
|
|
196
|
-
/** Stamp
|
|
197
|
-
*
|
|
347
|
+
/** Stamp the event, await every subscriber in order, then make it pull-visible. A subscriber
|
|
348
|
+
* failure leaves the event invisible and retrying the SAME event object reuses the exact stamp.
|
|
349
|
+
* This lets an awaited product observer commit its record before a supervisor can consume it. */
|
|
198
350
|
publish(event: E, opts?: PublishOptions): Promise<BusRecord<E>>;
|
|
199
351
|
/** Remove and return the highest-priority QUEUED event whose type is in `kinds` (any if omitted),
|
|
200
352
|
* ties broken FIFO by `seq`; `undefined` when nothing matches. */
|
|
@@ -204,7 +356,7 @@ interface EventBus<E extends BusEvent> {
|
|
|
204
356
|
subscribe(handler: (record: BusRecord<E>) => void | Promise<void>): () => void;
|
|
205
357
|
/** Count of queued, not-yet-pulled events (filtered by `kinds` when given). */
|
|
206
358
|
pending(kinds?: ReadonlyArray<E['type']>): number;
|
|
207
|
-
/** The full ordered log of every event
|
|
359
|
+
/** The full ordered log of every event published in this process (audit evidence, not replay). */
|
|
208
360
|
history(): ReadonlyArray<BusRecord<E>>;
|
|
209
361
|
/** Throughput counters for observability dashboards. */
|
|
210
362
|
stats(): BusStats;
|
|
@@ -1734,164 +1886,6 @@ type WorktreeCheckRunner = (opts: {
|
|
|
1734
1886
|
output: string;
|
|
1735
1887
|
}>;
|
|
1736
1888
|
//#endregion
|
|
1737
|
-
//#region src/runtime/supervise/pi-mcp.d.ts
|
|
1738
|
-
/** The pi extension that gives pi MCP at all. Everything here is gated on it being loadable. */
|
|
1739
|
-
declare const PI_MCP_ADAPTER = "pi-mcp-adapter";
|
|
1740
|
-
/** Overrides adapter detection for installs whose path does not carry the adapter's name. */
|
|
1741
|
-
declare const PI_MCP_ADAPTER_ENV = "AGENT_RUNTIME_PI_MCP_ADAPTER";
|
|
1742
|
-
/** The adapter-registered flag that names this run's config file (`pi-mcp-adapter` `index.ts:252`). */
|
|
1743
|
-
declare const PI_MCP_CONFIG_FLAG = "--mcp-config";
|
|
1744
|
-
/** What the caller must call once pi has exited, and where the config landed. */
|
|
1745
|
-
interface PiMcpMount {
|
|
1746
|
-
/** Absolute path of the file passed to `--mcp-config`. Unique to this worker execution. */
|
|
1747
|
-
configPath: string;
|
|
1748
|
-
/** Server names actually written, post-filter — never the raw `profile.mcp` keys. */
|
|
1749
|
-
serverNames: string[];
|
|
1750
|
-
/** Remove the private config directory. Idempotent; safe to call on any exit path. */
|
|
1751
|
-
cleanup(): void;
|
|
1752
|
-
}
|
|
1753
|
-
/**
|
|
1754
|
-
* What pi was actually given, as opposed to what the profile declared. This is the observable that
|
|
1755
|
-
* makes rule 2 above honest: `adapterInjected` is `true` exactly when this module added an extension
|
|
1756
|
-
* the caller did not ask for, because without it the MCP servers the caller DID ask for could not
|
|
1757
|
-
* have mounted.
|
|
1758
|
-
*/
|
|
1759
|
-
interface PiMcpReceipt {
|
|
1760
|
-
/** Server names written into `configPath`, in declaration order. */
|
|
1761
|
-
servers: string[];
|
|
1762
|
-
/** Absolute path of the mounted config. */
|
|
1763
|
-
configPath: string;
|
|
1764
|
-
/** `extensions.pi.load` entries as pi received them, resolved to absolute entry files. */
|
|
1765
|
-
extensions: string[];
|
|
1766
|
-
/** True when `pi-mcp-adapter` was absent from an explicit `load` array and was added here. */
|
|
1767
|
-
adapterInjected: boolean;
|
|
1768
|
-
}
|
|
1769
|
-
/** Everything `piExecutor` needs between "profile in hand" and "pi spawned". */
|
|
1770
|
-
interface PiMcpPreparation {
|
|
1771
|
-
/** Extra argv for `pi`, in flag order: extension flags first, then `--mcp-config <path>`. */
|
|
1772
|
-
args: string[];
|
|
1773
|
-
/** Present only when at least one usable MCP server was declared. */
|
|
1774
|
-
mount: PiMcpMount | null;
|
|
1775
|
-
/** Present only when a mount happened — the derived-versus-declared record. */
|
|
1776
|
-
receipt: PiMcpReceipt | undefined;
|
|
1777
|
-
}
|
|
1778
|
-
/**
|
|
1779
|
-
* True when pi can actually consume MCP config — i.e. `pi-mcp-adapter` is installed. Ported from
|
|
1780
|
-
* cli-bridge `pi.ts:189`: an env override first (for vendored installs whose path does not carry the
|
|
1781
|
-
* adapter's name), then the npm install directory, then a scan of `settings.json` `packages` in
|
|
1782
|
-
* which a local-path entry is resolved by reading the target's `package.json` `name`. An
|
|
1783
|
-
* unreadable or absent `settings.json` reports "not detected"; it never throws and never assumes.
|
|
1784
|
-
*/
|
|
1785
|
-
declare function piMcpAdapterAvailable(): boolean;
|
|
1786
|
-
/**
|
|
1787
|
-
* Build the canonical `{ mcpServers }` body the adapter reads, from `AgentProfile.mcp`.
|
|
1788
|
-
*
|
|
1789
|
-
* Every server is written with `directTools: true` (`pi-mcp-adapter` types.ts:351), which
|
|
1790
|
-
* registers its tools as NATIVE pi tools instead of hiding them behind the generic `mcp` tool.
|
|
1791
|
-
* Without it an agent must discover its own verbs before it can use them — connect to the server,
|
|
1792
|
-
* then describe each tool — and a measured run spent 58 turns and 639,632 input tokens doing that
|
|
1793
|
-
* before it could delegate once. A profile that declares an MCP server is asking for its tools,
|
|
1794
|
-
* not for a directory it has to browse.
|
|
1795
|
-
*
|
|
1796
|
-
* This is cli-bridge's `buildCanonicalMcpServers`
|
|
1797
|
-
* (`/home/drew/code/cli-bridge/src/backends/profile-support.ts:253`) reproduced field for field and
|
|
1798
|
-
* in the same key order — same drop of `enabled:false`, same stdio-versus-remote decision
|
|
1799
|
-
* (`isStdioMcpSpec`, `profile-support.ts:177`), same `{command, args, env}` and `{type, url,
|
|
1800
|
-
* headers}` bodies, same silent drop of an entry with nothing to connect to. For any server both
|
|
1801
|
-
* input types can express, the emitted JSON is byte-identical.
|
|
1802
|
-
*
|
|
1803
|
-
* The two input types are not the same type, so three differences remain and each is a field one
|
|
1804
|
-
* side cannot express:
|
|
1805
|
-
*
|
|
1806
|
-
* 1. **`cwd` (emitted here, absent there).** `AgentProfileLocalMcpServer` has `cwd`; cli-bridge's
|
|
1807
|
-
* `McpServerSpec` (`src/backends/types.ts:53`) has no such field, so it can never emit one. The
|
|
1808
|
-
* adapter honors it (`pi-mcp-adapter` `types.ts:325`, `ServerEntry.cwd`), so dropping it would
|
|
1809
|
-
* silently discard a declared setting. It is emitted where cli-bridge emits `timeout`.
|
|
1810
|
-
* 2. **`timeout` (emitted there, absent here).** `AgentProfileMcpServer` has no timeout field, so
|
|
1811
|
-
* there is nothing to emit. (The adapter's own knob is `requestTimeoutMs`, not `timeout`.)
|
|
1812
|
-
* 3. **A `url` with no declared transport.** cli-bridge DROPS it — its remote branch requires an
|
|
1813
|
-
* explicit `spec.type` — even though its own `McpServerSpec` docstring says "http is implied if
|
|
1814
|
-
* `url` is set" (`types.ts:53-56`). `transport` is optional on `AgentProfileRemoteMcpServer`, so
|
|
1815
|
-
* dropping such a server here would be exactly the silent-drop bug this module exists to fix.
|
|
1816
|
-
* We honor the documented convention and emit `type: 'http'`.
|
|
1817
|
-
*
|
|
1818
|
-
* `sse` is ACCEPTED and forwarded verbatim, as cli-bridge forwards it. The adapter connects a URL
|
|
1819
|
-
* server by probing StreamableHTTP and falling back to `SSEClientTransport` when the probe fails
|
|
1820
|
-
* (`pi-mcp-adapter` `server-manager.ts:765`), so an SSE-only endpoint does connect. Its
|
|
1821
|
-
* `ServerEntry` (`types.ts:319`) carries no transport discriminator at all, which means the `type`
|
|
1822
|
-
* key is inert to the adapter either way — but it is what cli-bridge writes, and a config file that
|
|
1823
|
-
* round-trips the caller's declared transport is the one that stays readable by both.
|
|
1824
|
-
*/
|
|
1825
|
-
declare function buildPiMcpServers(mcp: Record<string, AgentProfileMcpServer> | undefined): Record<string, Record<string, unknown>>;
|
|
1826
|
-
/** Where one worker execution's private config directory is created, and what it is called. */
|
|
1827
|
-
interface PiMcpMountOptions {
|
|
1828
|
-
/**
|
|
1829
|
-
* The worker's own working directory (`PiSeam.cwd`). Omit when the seam names none: the config
|
|
1830
|
-
* then lands in the OS temp directory. It is NEVER written into `process.cwd()` — the operator's
|
|
1831
|
-
* own working directory is not a scratch space for a worker's config.
|
|
1832
|
-
*/
|
|
1833
|
-
cwd?: string;
|
|
1834
|
-
/**
|
|
1835
|
-
* The executor's per-execution run id, folded into the directory name so a directory that somehow
|
|
1836
|
-
* survives names the worker that left it. Uniqueness is NOT taken from this — `mkdtemp` provides
|
|
1837
|
-
* it — because two workers built from one factory in the same millisecond share a run id stem.
|
|
1838
|
-
*/
|
|
1839
|
-
runId: string;
|
|
1840
|
-
}
|
|
1841
|
-
/**
|
|
1842
|
-
* The one call `piExecutor` makes before spawning pi: decide what pi must be told, fail loud if it
|
|
1843
|
-
* cannot work, then mount.
|
|
1844
|
-
*
|
|
1845
|
-
* Order matters and is the point:
|
|
1846
|
-
*
|
|
1847
|
-
* 1. Canonicalize `profile.mcp` first, so the adapter gate keys off servers that would ACTUALLY be
|
|
1848
|
-
* written — a block of `enabled:false` entries must not trip it.
|
|
1849
|
-
* 2. If any server survives and `pi-mcp-adapter` is not installed, throw. No file has been written
|
|
1850
|
-
* and pi has not been spawned.
|
|
1851
|
-
* 3. Lower `extensions.pi.load` (which may itself throw on an unresolvable extension) — still before
|
|
1852
|
-
* any file exists.
|
|
1853
|
-
* 4. Only then create this execution's private config directory and emit `--mcp-config`.
|
|
1854
|
-
*
|
|
1855
|
-
* A profile with no usable MCP server is a pure no-op: no adapter check, no directory, no flags, no
|
|
1856
|
-
* throw. `extensions.pi.load` on its own still produces flags, because reproducible ablation arms
|
|
1857
|
-
* need them whether or not MCP is involved.
|
|
1858
|
-
*
|
|
1859
|
-
* The caller MUST call `mount.cleanup()` on every exit path — settle, throw, abort, timeout, and
|
|
1860
|
-
* spawn failure — so the directory does not outlive the worker that owns it.
|
|
1861
|
-
*/
|
|
1862
|
-
declare function preparePiMcp(profile: AgentProfile$1 | undefined, options: PiMcpMountOptions): PiMcpPreparation;
|
|
1863
|
-
//#endregion
|
|
1864
|
-
//#region src/runtime/supervise/pi-executor.d.ts
|
|
1865
|
-
/** The runtime name `piExecutor` registers under. */
|
|
1866
|
-
declare const PI_RUNTIME: Runtime;
|
|
1867
|
-
/** Seam key the registry threads a `PiSeam` through (`ExecutorContext.seams['pi']`). */
|
|
1868
|
-
declare const piSeamKey = "pi";
|
|
1869
|
-
/** How to launch pi in its out-of-process RPC mode, and how long to wait on it. */
|
|
1870
|
-
interface PiSeam {
|
|
1871
|
-
/** The pi executable (default `'pi'`). Anything on PATH or an absolute path. */
|
|
1872
|
-
bin?: string;
|
|
1873
|
-
/** Extra args appended after `--mode rpc`. `--provider` / `--model` are added from `model`. */
|
|
1874
|
-
args?: ReadonlyArray<string>;
|
|
1875
|
-
/** `provider/model` or just `model` — split on the first `/` into pi's two flags. */
|
|
1876
|
-
model?: string;
|
|
1877
|
-
cwd?: string;
|
|
1878
|
-
env?: Record<string, string>;
|
|
1879
|
-
/** Wall-clock ceiling for one `prompt` (the wait for `agent_settled`). Omit = no timeout. */
|
|
1880
|
-
turnTimeoutMs?: number;
|
|
1881
|
-
/** Newest-last activity window `progress()` reports. Default 12. */
|
|
1882
|
-
activityWindow?: number;
|
|
1883
|
-
}
|
|
1884
|
-
/** Build the `Executor` for one pi worker. Registered as runtime `'pi'`. */
|
|
1885
|
-
declare const piExecutor: ExecutorFactory<unknown>;
|
|
1886
|
-
/** What one pi run reports about the terminal assistant turn, plus any derived MCP mount. */
|
|
1887
|
-
interface PiExecutorOutput {
|
|
1888
|
-
content: string;
|
|
1889
|
-
turns: number;
|
|
1890
|
-
/** Present only when `profile.mcp` declared at least one usable server. Records what pi was
|
|
1891
|
-
* actually given — including an extension this executor added that the profile did not list. */
|
|
1892
|
-
mcp?: PiMcpReceipt;
|
|
1893
|
-
}
|
|
1894
|
-
//#endregion
|
|
1895
1889
|
//#region src/runtime/supervise/inbox.d.ts
|
|
1896
1890
|
/**
|
|
1897
1891
|
*
|
|
@@ -1906,7 +1900,8 @@ interface PiExecutorOutput {
|
|
|
1906
1900
|
* in-flight turn immediately, then re-plan with the message folded in — breaking the worker out
|
|
1907
1901
|
* of a wrong path mid-task instead of waiting for it to finish the step.
|
|
1908
1902
|
*
|
|
1909
|
-
* `deliver` never throws — a malformed message is ignored
|
|
1903
|
+
* `deliver` never throws — a malformed message is ignored and returns `false`, so no caller can
|
|
1904
|
+
* report delivery for bytes this inbox discarded.
|
|
1910
1905
|
*
|
|
1911
1906
|
* @experimental
|
|
1912
1907
|
*/
|
|
@@ -1919,8 +1914,9 @@ interface InboxMessage {
|
|
|
1919
1914
|
readonly questionId?: string;
|
|
1920
1915
|
}
|
|
1921
1916
|
interface Inbox {
|
|
1922
|
-
/** The `Executor.deliver` implementation
|
|
1923
|
-
|
|
1917
|
+
/** The `Executor.deliver` implementation. Returns false when the raw message is malformed and
|
|
1918
|
+
* therefore was not queued; callers must not acknowledge a message this inbox discarded. */
|
|
1919
|
+
deliver(msg: unknown): boolean;
|
|
1924
1920
|
/** Remove and return all pending messages (the flush). */
|
|
1925
1921
|
drain(): InboxMessage[];
|
|
1926
1922
|
pending(): number;
|
|
@@ -2033,7 +2029,9 @@ interface CliSeam {
|
|
|
2033
2029
|
/**
|
|
2034
2030
|
* cli-worktree seam. A supervisor-authored `AgentProfile` driving a local coding-harness CLI
|
|
2035
2031
|
* (claude / codex / opencode) on its own git worktree — the leaf `createWorktreeCliExecutor`
|
|
2036
|
-
* named as data. `harness` + `repoRoot`
|
|
2032
|
+
* named as data. `harness` + `repoRoot` are required; the task comes from `Executor.execute`.
|
|
2033
|
+
* `taskPrompt` remains an optional direct-call fallback for callers that execute with `undefined`.
|
|
2034
|
+
* The authored
|
|
2037
2035
|
* `profile.prompt.systemPrompt` + `profile.model.default` reach the harness via the §1.5
|
|
2038
2036
|
* `harnessInvocation` mapper. Everything else mirrors `WorktreeCliExecutorOptions`.
|
|
2039
2037
|
*/
|
|
@@ -2041,7 +2039,7 @@ interface CliWorktreeSeam {
|
|
|
2041
2039
|
repoRoot: string;
|
|
2042
2040
|
/** Local CLI harness transport. Omit when `bridge` is set. */
|
|
2043
2041
|
harness?: LocalHarness;
|
|
2044
|
-
taskPrompt
|
|
2042
|
+
taskPrompt?: string;
|
|
2045
2043
|
runId?: string;
|
|
2046
2044
|
baseRef?: string;
|
|
2047
2045
|
harnessTimeoutMs?: number;
|
|
@@ -2067,7 +2065,8 @@ interface CliWorktreeBridgeSeam {
|
|
|
2067
2065
|
bridgeBearer: string;
|
|
2068
2066
|
/** Bridge model/harness id. Defaults to the profile's model hint when omitted. */
|
|
2069
2067
|
model?: string;
|
|
2070
|
-
|
|
2068
|
+
/** Canonical profile overlay merged over the spawned profile. */
|
|
2069
|
+
agentProfile?: AgentProfile$1;
|
|
2071
2070
|
timeoutMs?: number;
|
|
2072
2071
|
/** Stable cli-bridge session id. Defaults to `bridge-worktree-${runId}`. */
|
|
2073
2072
|
sessionId?: string;
|
|
@@ -2081,19 +2080,20 @@ interface CliWorktreeBridgeSeam {
|
|
|
2081
2080
|
* forwarded verbatim per request — how an arm disables native tools or injects
|
|
2082
2081
|
* a provider search MCP.
|
|
2083
2082
|
*
|
|
2084
|
-
* The executor opens a
|
|
2085
|
-
*
|
|
2086
|
-
*
|
|
2087
|
-
*
|
|
2088
|
-
* `-s`, claude `--resume`, …). Omit it and the executor mints a stable one per spawn.
|
|
2083
|
+
* The executor opens a resumable cli-bridge session. `sessionId` identifies the
|
|
2084
|
+
* harness conversation across turns; each turn also receives its own durable run id.
|
|
2085
|
+
* A dropped HTTP reader reattaches to that exact run and explicit cancel is the only
|
|
2086
|
+
* operation allowed to stop it. Omit `sessionId` and the executor mints one per spawn.
|
|
2089
2087
|
*/
|
|
2090
2088
|
interface BridgeSeam {
|
|
2091
2089
|
bridgeUrl: string;
|
|
2092
2090
|
bridgeBearer: string;
|
|
2093
|
-
model
|
|
2091
|
+
/** Fallback bridge wire id. A spawned profile may select its own harness and model. */
|
|
2092
|
+
model?: string;
|
|
2094
2093
|
/** Optional working directory forwarded to cli-bridge and persisted with the session. */
|
|
2095
2094
|
cwd?: string;
|
|
2096
|
-
|
|
2095
|
+
/** Canonical profile overlay merged over the spawned profile. */
|
|
2096
|
+
agentProfile?: AgentProfile$1;
|
|
2097
2097
|
timeoutMs?: number;
|
|
2098
2098
|
/** Stable, caller-owned cli-bridge session id for harness-side resume. Defaults
|
|
2099
2099
|
* to a freshly minted per-spawn id so each worker is its own resumable session. */
|
|
@@ -2101,6 +2101,8 @@ interface BridgeSeam {
|
|
|
2101
2101
|
/** Per-resume-turn inference cap before the worker settles on its last output.
|
|
2102
2102
|
* Mirrors `routerToolsInlineExecutor.maxTurns`; default 200 (runaway backstop). */
|
|
2103
2103
|
maxTurns?: number;
|
|
2104
|
+
/** Newest-last activity window `progress()` reports. Default 12 (matches `PiSeam`). */
|
|
2105
|
+
activityWindow?: number;
|
|
2104
2106
|
}
|
|
2105
2107
|
/** Generic environment provider executor config. External packages implement
|
|
2106
2108
|
* `AgentEnvironmentProvider`; this built-in wrapper lets `createExecutor`
|
|
@@ -2108,6 +2110,13 @@ interface BridgeSeam {
|
|
|
2108
2110
|
interface ProviderSeam extends ProviderExecutorOptions {
|
|
2109
2111
|
provider: AgentEnvironmentProvider | string;
|
|
2110
2112
|
registry?: AgentEnvironmentProviderRegistry;
|
|
2113
|
+
/**
|
|
2114
|
+
* Compose the provider through the existing steerable sandbox session.
|
|
2115
|
+
* The exact profile must name its harness, and the provider must expose live
|
|
2116
|
+
* continuation plus session controls. The provider still owns environment
|
|
2117
|
+
* creation and session semantics.
|
|
2118
|
+
*/
|
|
2119
|
+
steering?: SandboxSteeringOptions;
|
|
2111
2120
|
}
|
|
2112
2121
|
/**
|
|
2113
2122
|
* Router seam WITH tool use — the tool-using router backend. Same direct
|
|
@@ -2166,8 +2175,6 @@ type ExecutorConfig = ({
|
|
|
2166
2175
|
} & CliWorktreeSeam) | ({
|
|
2167
2176
|
backend: 'provider';
|
|
2168
2177
|
} & ProviderSeam) | ({
|
|
2169
|
-
backend: 'pi';
|
|
2170
|
-
} & PiSeam) | ({
|
|
2171
2178
|
backend: 'sandbox';
|
|
2172
2179
|
harness?: BackendType;
|
|
2173
2180
|
} & SandboxSeam);
|
|
@@ -2187,8 +2194,8 @@ declare function createExecutor(config: ExecutorConfig): ExecutorFactory<unknown
|
|
|
2187
2194
|
* without touching the registry at all. NOT a closed switch; registration + BYO
|
|
2188
2195
|
* ARE the extension points.
|
|
2189
2196
|
*
|
|
2190
|
-
* `resolve` precedence (frozen in `ExecutorRegistry`): a BYO `spec.
|
|
2191
|
-
* `harness === null` → the `'router'` factory; else a registered factory for the
|
|
2197
|
+
* `resolve` precedence (frozen in `ExecutorRegistry`): a BYO `spec.executorFactory` →
|
|
2198
|
+
* `spec.executor` → `harness === null` → the `'router'` factory; else a registered factory for the
|
|
2192
2199
|
* harness-derived runtime (`'sandbox'` for any `BackendType`); else fail loud.
|
|
2193
2200
|
*/
|
|
2194
2201
|
declare function createExecutorRegistry(): ExecutorRegistry;
|
|
@@ -2236,8 +2243,16 @@ type DelegateResult = {
|
|
|
2236
2243
|
} | {
|
|
2237
2244
|
status: 'no-winner';
|
|
2238
2245
|
reason: string;
|
|
2246
|
+
error?: DelegateError;
|
|
2239
2247
|
spentTotal: Spend;
|
|
2240
2248
|
};
|
|
2249
|
+
/** What killed a delegation, projected for the calling agent: the rejection's name and message.
|
|
2250
|
+
* `reason` is a four-word code (`driver-failed`), and a code alone is not diagnosable — the
|
|
2251
|
+
* supervisor attaches the rejection to the result precisely so a caller can read it. */
|
|
2252
|
+
interface DelegateError {
|
|
2253
|
+
name: string;
|
|
2254
|
+
message: string;
|
|
2255
|
+
}
|
|
2241
2256
|
/** @experimental */
|
|
2242
2257
|
interface DelegateHandlerOptions {
|
|
2243
2258
|
/** The supervisor brain's router substrate (REQUIRED — the default supervisor is router-brained). */
|
|
@@ -2336,13 +2351,26 @@ declare function createInProcessTransport(): {
|
|
|
2336
2351
|
interface SettledWorker {
|
|
2337
2352
|
readonly id: string;
|
|
2338
2353
|
readonly status: 'done' | 'down';
|
|
2354
|
+
/** Stable manager-scoped assignment, including deterministic unkeyed siblings. */
|
|
2355
|
+
readonly assignmentId?: string;
|
|
2356
|
+
/** Exact profile/task/candidate identity authorized for this node. */
|
|
2357
|
+
readonly identity?: NodeExecutionIdentity;
|
|
2358
|
+
/** Stable effective execution plan, or an explicit unknown receipt. */
|
|
2359
|
+
readonly materialization?: ProfileMaterializationReceipt;
|
|
2360
|
+
/** Backend bindings for each attempt, in durable oldest-first order. */
|
|
2361
|
+
readonly executionBindings?: ReadonlyArray<ExecutionBindingReceipt>;
|
|
2362
|
+
/** Conserved spend. Missing means unavailable; unknown accounting remains explicitly unknown. */
|
|
2363
|
+
readonly spent?: Spend;
|
|
2339
2364
|
readonly score?: number;
|
|
2340
2365
|
readonly valid?: boolean;
|
|
2341
2366
|
readonly outRef?: string;
|
|
2342
2367
|
readonly reason?: string;
|
|
2343
|
-
/**
|
|
2344
|
-
|
|
2345
|
-
|
|
2368
|
+
/** Structured tool-call evidence, never the worker's final prose. */
|
|
2369
|
+
readonly trace: WorkerTraceEvidence;
|
|
2370
|
+
/** True when projected from a prior process of the same durable run. */
|
|
2371
|
+
readonly resumed?: boolean;
|
|
2372
|
+
/** Epoch ms from the durable terminal record — the resolution a progress-based stop rule needs
|
|
2373
|
+
* to answer "how long since anything landed?" without inventing a timestamp at read time. */
|
|
2346
2374
|
readonly settledAt?: number;
|
|
2347
2375
|
}
|
|
2348
2376
|
type QuestionLevel = 'worker' | 'driver' | 'loop';
|
|
@@ -2384,7 +2412,7 @@ interface AnalystRegistry {
|
|
|
2384
2412
|
description: string;
|
|
2385
2413
|
area: string;
|
|
2386
2414
|
}>;
|
|
2387
|
-
readonly run: (kindId: string, trace:
|
|
2415
|
+
readonly run: (kindId: string, trace: TraceAnalysisStore) => Promise<unknown>;
|
|
2388
2416
|
}
|
|
2389
2417
|
/** A trace-analyst result re-entered as a message on the bus (the `finding` event kind). */
|
|
2390
2418
|
interface AnalystFindingEvent {
|
|
@@ -2392,16 +2420,63 @@ interface AnalystFindingEvent {
|
|
|
2392
2420
|
readonly analyst: string;
|
|
2393
2421
|
readonly findings: unknown;
|
|
2394
2422
|
}
|
|
2395
|
-
/**
|
|
2396
|
-
|
|
2423
|
+
/** The exact result of one parent→child delivery attempt. */
|
|
2424
|
+
type DownMessageDeliveryOutcome = 'delivered' | 'unknown-worker' | 'already-settled' | 'runtime-has-no-inbox' | 'scope-stopped' | 'runtime-error';
|
|
2425
|
+
/** A durable marker written after authorization and immediately before Runtime calls `Scope.send`.
|
|
2426
|
+
* If a process dies with this marker but no matching outcome, delivery is unknown and is never
|
|
2427
|
+
* replayed automatically. */
|
|
2428
|
+
interface DownMessageDeliveryAttempt {
|
|
2429
|
+
readonly receiptId: string;
|
|
2430
|
+
readonly kind: 'steer' | 'answer';
|
|
2431
|
+
readonly toWorker: string;
|
|
2432
|
+
readonly instructionDigest: string;
|
|
2433
|
+
readonly interrupt: boolean;
|
|
2434
|
+
readonly questionId?: string;
|
|
2435
|
+
}
|
|
2436
|
+
/** A parent→child delivery result (the down-leg): recorded for observability, never pulled back by
|
|
2437
|
+
* the parent. `receiptId` and `instructionDigest` link it to the pre-delivery authorization receipt
|
|
2438
|
+
* and attempt marker. */
|
|
2397
2439
|
interface DownMessageEvent {
|
|
2440
|
+
readonly receiptId: string;
|
|
2398
2441
|
readonly toWorker: string;
|
|
2399
2442
|
readonly instruction: string;
|
|
2443
|
+
readonly instructionDigest: string;
|
|
2400
2444
|
readonly delivered: boolean;
|
|
2445
|
+
readonly outcome: DownMessageDeliveryOutcome;
|
|
2446
|
+
readonly error?: string;
|
|
2401
2447
|
}
|
|
2448
|
+
/** Durable authorization receipt written before a continuation reaches a worker. */
|
|
2449
|
+
interface ContinuationInstruction {
|
|
2450
|
+
readonly receiptId: string;
|
|
2451
|
+
readonly kind: 'steer' | 'answer';
|
|
2452
|
+
readonly toWorker: string;
|
|
2453
|
+
readonly instruction: string;
|
|
2454
|
+
readonly instructionDigest: string;
|
|
2455
|
+
readonly workerIdentity?: NodeExecutionIdentity;
|
|
2456
|
+
readonly interrupt: boolean;
|
|
2457
|
+
readonly questionId?: string;
|
|
2458
|
+
}
|
|
2459
|
+
/** Detached continuation bytes and exact worker identity presented to product authorization before
|
|
2460
|
+
* Runtime records or delivers a steer/answer. */
|
|
2461
|
+
interface DownMessageAuthorizationInput {
|
|
2462
|
+
readonly kind: 'steer' | 'answer';
|
|
2463
|
+
readonly workerId: string;
|
|
2464
|
+
readonly workerIdentity: NodeExecutionIdentity;
|
|
2465
|
+
readonly instruction: string;
|
|
2466
|
+
readonly interrupt: boolean;
|
|
2467
|
+
readonly questionId?: string;
|
|
2468
|
+
}
|
|
2469
|
+
/** Product-authorized continuation bytes. Returning a narrowed instruction replaces the proposed
|
|
2470
|
+
* bytes; throwing refuses delivery. */
|
|
2471
|
+
interface AuthorizedDownMessage {
|
|
2472
|
+
readonly instruction: string;
|
|
2473
|
+
}
|
|
2474
|
+
/** Product decision over an exact continuation before it is durably recorded or delivered. */
|
|
2475
|
+
type AuthorizeDownMessage = (input: DownMessageAuthorizationInput) => AuthorizedDownMessage;
|
|
2402
2476
|
/** Every message on the one typed pipe. UP (child→parent): question / settled / finding — queued for
|
|
2403
|
-
* the driver to `pull`.
|
|
2404
|
-
*
|
|
2477
|
+
* the driver to `pull`. An `instruction` is the pre-delivery authorization receipt and is retained
|
|
2478
|
+
* as evidence. DOWN (parent→child): steer / answer — record-only (history + subscribers), routed
|
|
2479
|
+
* to the child inbox. Receipts are never auto-delivered on restart. New kinds are additive. */
|
|
2405
2480
|
type CoordinationEvent = {
|
|
2406
2481
|
readonly type: 'question';
|
|
2407
2482
|
readonly question: QuestionRecord;
|
|
@@ -2418,8 +2493,34 @@ type CoordinationEvent = {
|
|
|
2418
2493
|
readonly type: 'answer';
|
|
2419
2494
|
readonly down: DownMessageEvent;
|
|
2420
2495
|
readonly questionId: string;
|
|
2496
|
+
} | {
|
|
2497
|
+
readonly type: 'instruction';
|
|
2498
|
+
readonly instruction: ContinuationInstruction;
|
|
2499
|
+
} | {
|
|
2500
|
+
readonly type: 'delivery-attempt';
|
|
2501
|
+
readonly attempt: DownMessageDeliveryAttempt;
|
|
2421
2502
|
};
|
|
2422
|
-
|
|
2503
|
+
/** Immutable task, allocation, identity attribution, and semantic key supplied while a manager's
|
|
2504
|
+
* complete worker profile is prepared for one spawn. */
|
|
2505
|
+
interface WorkerSpawnContext {
|
|
2506
|
+
/** Stable assignment identity within this manager. A semantic key wins; otherwise Runtime mints
|
|
2507
|
+
* the manager's deterministic pre-factory spawn ordinal so identical unkeyed siblings stay
|
|
2508
|
+
* isolated and can recover by issuing the same assignments in the same order. */
|
|
2509
|
+
readonly assignmentId: string;
|
|
2510
|
+
/** Trusted concrete manager node authorizing this spawn. Never accepted from model arguments. */
|
|
2511
|
+
readonly parentNodeId: string;
|
|
2512
|
+
/** The exact allocation this node receives after the tool's optional override is merged. */
|
|
2513
|
+
readonly budget: Budget;
|
|
2514
|
+
/** Detached, deeply immutable task bytes from this spawn request. */
|
|
2515
|
+
readonly task: unknown;
|
|
2516
|
+
/** Exact trace label selected for this spawn. */
|
|
2517
|
+
readonly label: string;
|
|
2518
|
+
/** Semantic restart key, when the manager supplied one. */
|
|
2519
|
+
readonly key?: string;
|
|
2520
|
+
/** Trusted candidate/campaign attribution attached by product authorization. */
|
|
2521
|
+
readonly execution?: AgentExecutionRef;
|
|
2522
|
+
}
|
|
2523
|
+
type MakeWorkerAgent = (profile: AgentProfile$1, context?: WorkerSpawnContext) => Agent<unknown, unknown>;
|
|
2423
2524
|
interface CoordinationToolsOptions {
|
|
2424
2525
|
readonly scope: Scope<unknown>;
|
|
2425
2526
|
readonly blobs: ResultBlobStore;
|
|
@@ -2432,7 +2533,14 @@ interface CoordinationToolsOptions {
|
|
|
2432
2533
|
*/
|
|
2433
2534
|
readonly deliverable?: DeliverableSpec<unknown>;
|
|
2434
2535
|
readonly analysts?: AnalystRegistry;
|
|
2435
|
-
|
|
2536
|
+
/** Event-first for source compatibility; the second argument is its exact bus ordering stamp. */
|
|
2537
|
+
readonly onEvent?: (event: CoordinationEvent, record: BusRecord<CoordinationEvent>) => void | Promise<void>;
|
|
2538
|
+
/** Re-publish resumed settlements through the awaited observer before the driver starts. This is
|
|
2539
|
+
* the crash-window recovery path for product transactions; off preserves low-level legacy reads. */
|
|
2540
|
+
readonly replaySettlements?: boolean;
|
|
2541
|
+
/** Authorize each continuation against the exact worker identity. The returned instruction is
|
|
2542
|
+
* detached, recorded durably through `onEvent`, and only then delivered. */
|
|
2543
|
+
readonly authorizeDownMessage?: AuthorizeDownMessage;
|
|
2436
2544
|
readonly questionPolicy?: QuestionPolicy;
|
|
2437
2545
|
/** Analyst kind ids to run AUTOMATICALLY when a worker settles `done` (the analyst-on-settle
|
|
2438
2546
|
* hook). Each result is published as a `finding` event on the bus — pass-through to subscribers
|
|
@@ -2443,7 +2551,8 @@ interface CoordinationToolsOptions {
|
|
|
2443
2551
|
* counts the scope's non-terminal nodes and fails closed (`error: 'max-live-workers'`) BEFORE
|
|
2444
2552
|
* reserving from the pool when the cap is already met — a concurrency fence on top of the
|
|
2445
2553
|
* conserved-budget fence (the pool bounds total work; this bounds simultaneous work, e.g. live
|
|
2446
|
-
* sandboxes/boxes).
|
|
2554
|
+
* sandboxes/boxes). A tree-wide limit owned by `Scope` takes precedence when present; this field
|
|
2555
|
+
* is the local form for a caller-owned scope. Omit or `<= 0` = no local cap. */
|
|
2447
2556
|
readonly maxLiveWorkers?: number;
|
|
2448
2557
|
/** Max wall-clock ms a single `await_event` call may block waiting on a live worker to settle
|
|
2449
2558
|
* before it returns a non-error `{ pending: true, live }` snapshot and lets the caller re-poll.
|
|
@@ -2503,6 +2612,8 @@ declare const DEFAULT_AWAIT_EVENT_TIMEOUT_MS = 15000;
|
|
|
2503
2612
|
*/
|
|
2504
2613
|
interface CoordinationTools {
|
|
2505
2614
|
readonly tools: McpToolDescriptor$1[];
|
|
2615
|
+
/** Commit any resume-time event replay before a supervisor can reason or an MCP can listen. */
|
|
2616
|
+
ready(): Promise<void>;
|
|
2506
2617
|
isStopped(): boolean;
|
|
2507
2618
|
stopReason(): string | undefined;
|
|
2508
2619
|
/** The first result whose injected independent check passed, if the driver submitted one. */
|
|
@@ -2511,9 +2622,9 @@ interface CoordinationTools {
|
|
|
2511
2622
|
} | undefined;
|
|
2512
2623
|
settled(): ReadonlyArray<SettledWorker>;
|
|
2513
2624
|
questions(): ReadonlyArray<QuestionRecord>;
|
|
2514
|
-
/** The full ordered log of every bus event — UP (settled / question / finding)
|
|
2515
|
-
*
|
|
2516
|
-
* timestamp, and priority. */
|
|
2625
|
+
/** The full ordered log of every bus event — UP (settled / question / finding), authorized
|
|
2626
|
+
* instruction receipts, and DOWN delivery outcomes (steer / answer). Each record carries seq,
|
|
2627
|
+
* timestamp, and priority. A receipt is evidence and is never auto-delivered on restart. */
|
|
2517
2628
|
history(): ReadonlyArray<BusRecord<CoordinationEvent>>;
|
|
2518
2629
|
/** Bus throughput counters (published / pulled / by-kind) for live dashboards. */
|
|
2519
2630
|
stats(): BusStats;
|
|
@@ -6011,24 +6122,40 @@ interface StructuralRolloutConfig {
|
|
|
6011
6122
|
declare function structuralRollout(config?: StructuralRolloutConfig): Strategy<StructuralRolloutResult>;
|
|
6012
6123
|
//#endregion
|
|
6013
6124
|
//#region src/runtime/supervise/authoring.d.ts
|
|
6014
|
-
/** What the supervisor AUTHORS per sub-task
|
|
6015
|
-
|
|
6016
|
-
|
|
6017
|
-
|
|
6018
|
-
|
|
6019
|
-
|
|
6020
|
-
|
|
6021
|
-
}
|
|
6125
|
+
/** What the supervisor AUTHORS per sub-task: one complete canonical profile whose name and
|
|
6126
|
+
* task-specific system prompt are present. Every other `AgentProfile` axis is preserved exactly. */
|
|
6127
|
+
type AuthoredProfile = AgentProfile$1 & {
|
|
6128
|
+
readonly name: string;
|
|
6129
|
+
readonly prompt: AgentProfilePrompt & {
|
|
6130
|
+
readonly systemPrompt: string;
|
|
6131
|
+
};
|
|
6132
|
+
};
|
|
6022
6133
|
/** Narrow an untyped `spawn_agent` profile argument to an `AuthoredProfile`, or null if the
|
|
6023
6134
|
* supervisor failed to author one (empty/placeholder profile — a skill violation worth catching). */
|
|
6024
6135
|
declare function asAuthoredProfile(raw: unknown): AuthoredProfile | null;
|
|
6136
|
+
/**
|
|
6137
|
+
* Lift a profile the supervisor AUTHORED into the canonical shape every executor reads.
|
|
6138
|
+
*
|
|
6139
|
+
* The skill asks for `systemPrompt` and `model` as flat fields — the vocabulary a model writes
|
|
6140
|
+
* well — while `AgentProfile` carries them as `prompt.systemPrompt` and `model.default`. Nothing
|
|
6141
|
+
* downstream reads the flat form: the router and cli-bridge leaves read `profile.prompt
|
|
6142
|
+
* .systemPrompt`, and the sandbox leaf hands the profile to a strict schema that REJECTS the flat
|
|
6143
|
+
* key outright (`Unrecognized key: "systemPrompt"`), which fails the worker's every round. Lift
|
|
6144
|
+
* both here, once, so what the supervisor writes is what the worker runs.
|
|
6145
|
+
*
|
|
6146
|
+
* Purely additive: a profile already canonical is returned untouched, and a flat field is dropped
|
|
6147
|
+
* only after its canonical slot is filled. Both spellings of the same standing instruction, set to
|
|
6148
|
+
* DIFFERENT text, is a contradiction with no safe reading — it fails loud, matching
|
|
6149
|
+
* `resolveSupervisorProfile`'s rule for the supervisor's own profile.
|
|
6150
|
+
*/
|
|
6151
|
+
declare function canonicalizeAuthoredProfile(raw: unknown): AgentProfile$1;
|
|
6025
6152
|
/** The supervisor SKILL — the how-to the supervisor reads (its system prompt). THE optimizable
|
|
6026
6153
|
* surface: editing this changes how the supervisor designs every agent it spawns. */
|
|
6027
6154
|
declare function supervisorInstructions(opts?: {
|
|
6028
6155
|
goal?: string;
|
|
6029
6156
|
}): string;
|
|
6030
|
-
/** Build a worker
|
|
6031
|
-
* `
|
|
6157
|
+
/** Build a router-only worker from an authored profile. This helper executes the prompt/model axes;
|
|
6158
|
+
* use `workerFromBackend` for full materialization of tools, MCP, resources, hooks, and subagents. */
|
|
6032
6159
|
declare function authoredWorker(profile: AuthoredProfile, opts: {
|
|
6033
6160
|
cfg: RouterConfig;
|
|
6034
6161
|
taskPrompt: string;
|
|
@@ -6102,6 +6229,7 @@ interface ReservationTicket {
|
|
|
6102
6229
|
/** Post-reservation pool readout — the shape `Scope.budget` exposes. `tokensLeft`,
|
|
6103
6230
|
* `usdLeft`, and `reservedTokens` reflect committed-but-unsettled reservations;
|
|
6104
6231
|
* `deadlineMs` is the ABSOLUTE wall-clock deadline (0 when the root set none).
|
|
6232
|
+
* `iterationsLeft` is the remaining iteration capacity.
|
|
6105
6233
|
* `usdCapped` distinguishes a real `usdLeft <= 0` exhaustion from an uncapped pool (which always
|
|
6106
6234
|
* reads `usdLeft: 0`) — the in-loop guard needs it to bound a usd-capped driver. */
|
|
6107
6235
|
type BudgetReadout = Readonly<{
|
|
@@ -6112,16 +6240,32 @@ type BudgetReadout = Readonly<{
|
|
|
6112
6240
|
* consumption is at least the debited amount and possibly more. Reading `tokensLeft` without this
|
|
6113
6241
|
* flag would present an under-count as an exact balance.
|
|
6114
6242
|
*/
|
|
6115
|
-
tokensKnown
|
|
6243
|
+
tokensKnown: boolean;
|
|
6116
6244
|
usdLeft: number;
|
|
6117
6245
|
usdCapped: boolean;
|
|
6246
|
+
/** False once any recorded work reported an unknown dollar cost; the dollar totals are then a
|
|
6247
|
+
* lower bound on real spend, not a measurement. */
|
|
6248
|
+
usdKnown: boolean;
|
|
6249
|
+
iterationsLeft: number;
|
|
6118
6250
|
deadlineMs: number;
|
|
6119
6251
|
reservedTokens: number;
|
|
6120
6252
|
}>;
|
|
6121
6253
|
/** Why a reservation was refused. `budget-exhausted` means the pool ran out of a channel it
|
|
6122
|
-
* budgets; `
|
|
6254
|
+
* budgets; `below-runtime-floor` means the request is under the amount that harness needs before
|
|
6255
|
+
* it does any work at all, so it is unsatisfiable at that size and the fix is to RAISE it;
|
|
6256
|
+
* `usd-unbudgeted` means the root declared no dollar ceiling, so a dollar request is
|
|
6123
6257
|
* unsatisfiable at any amount and the fix is to budget the root, not to ask for less. */
|
|
6124
|
-
type ReservationRejection = 'budget-exhausted' | 'usd-unbudgeted';
|
|
6258
|
+
type ReservationRejection = 'budget-exhausted' | 'usd-unbudgeted' | 'below-runtime-floor';
|
|
6259
|
+
/** State recovered from a prior process before new work is admitted. `committed` is measured spend
|
|
6260
|
+
* already present in the durable journal. Each `uncertainReservation` is a child that was recorded
|
|
6261
|
+
* as started but never recorded as settled: its full declared ceiling is charged conservatively,
|
|
6262
|
+
* while the public readout remains explicitly unknown. */
|
|
6263
|
+
interface BudgetPoolRestore {
|
|
6264
|
+
readonly committed?: Spend;
|
|
6265
|
+
readonly uncertainReservations?: ReadonlyArray<Budget>;
|
|
6266
|
+
/** Original absolute deadline from the first process. It may never slide on restart. */
|
|
6267
|
+
readonly absoluteDeadlineMs?: number;
|
|
6268
|
+
}
|
|
6125
6269
|
interface BudgetPool {
|
|
6126
6270
|
/**
|
|
6127
6271
|
* Atomically reserve a child's full ceiling from the free balance. Fails closed
|
|
@@ -6170,31 +6314,52 @@ declare function spendFromUsageEvents(events: UsageEvent[]): Spend;
|
|
|
6170
6314
|
/**
|
|
6171
6315
|
* Create a conserved reservation pool from a root `Budget`. `now()` is injected so the
|
|
6172
6316
|
* deadline readout is deterministic; defaults to `Date.now` for non-test callers. The
|
|
6173
|
-
* absolute deadline is fixed at construction (`now() + budget.deadlineMs`)
|
|
6174
|
-
*
|
|
6317
|
+
* absolute deadline for a fresh pool is fixed at construction (`now() + budget.deadlineMs`). A
|
|
6318
|
+
* restored pool instead retains `restore.absoluteDeadlineMs`, so restart never slides the original
|
|
6319
|
+
* wall-clock limit. The readout is an absolute instant, not a shrinking remainder.
|
|
6175
6320
|
*/
|
|
6176
|
-
declare function createBudgetPool(root: Budget, now?: () => number): BudgetPool;
|
|
6321
|
+
declare function createBudgetPool(root: Budget, now?: () => number, restore?: BudgetPoolRestore): BudgetPool;
|
|
6177
6322
|
//#endregion
|
|
6178
6323
|
//#region src/runtime/supervise/coordination-log.d.ts
|
|
6179
|
-
/**
|
|
6324
|
+
/** Stable identity of the supervisor that owns one coordination stream. High-level supervision
|
|
6325
|
+
* derives it from the exact root/child execution identity plus its parent assignment. */
|
|
6326
|
+
type CoordinationOwnerId = string;
|
|
6327
|
+
/** Durable delivery evidence retained in commit order. An attempt without a later event carrying
|
|
6328
|
+
* the same `receiptId` has an unknown outcome after a crash and is never replayed. */
|
|
6329
|
+
type CoordinationDeliveryEvidence = Extract<CoordinationEvent, {
|
|
6330
|
+
readonly type: 'delivery-attempt' | 'steer' | 'answer';
|
|
6331
|
+
}>;
|
|
6332
|
+
/** Coordination evidence loaded from prior processes of one durable supervised run. */
|
|
6180
6333
|
interface PriorCoordination {
|
|
6334
|
+
/** The owner filter used for this replay. Omitted only for the compatibility all-owner read. */
|
|
6335
|
+
readonly ownerId?: CoordinationOwnerId;
|
|
6181
6336
|
/** Every question the prior process raised, with answer-status folded in, raise order. */
|
|
6182
6337
|
readonly questions: ReadonlyArray<QuestionRecord>;
|
|
6183
6338
|
/** Every analyst finding the prior process published, publish order. */
|
|
6184
6339
|
readonly findings: ReadonlyArray<AnalystFindingEvent>;
|
|
6340
|
+
/** Every authorized continuation, in commit order. These are evidence, never replayed to a new
|
|
6341
|
+
* worker automatically. */
|
|
6342
|
+
readonly continuations: ReadonlyArray<ContinuationInstruction>;
|
|
6343
|
+
/** Delivery intent and result records in commit order, linked to receipts by `receiptId`. */
|
|
6344
|
+
readonly deliveryEvidence: ReadonlyArray<CoordinationDeliveryEvidence>;
|
|
6345
|
+
/** Exact source-bus stamps in durable append order. Bus `seq` restarts with each process; append
|
|
6346
|
+
* order remains the cross-process replay order. */
|
|
6347
|
+
readonly records: ReadonlyArray<BusRecord<CoordinationEvent>>;
|
|
6185
6348
|
}
|
|
6186
6349
|
/** The durable coordination side-log seam. `append` records one bus event (kinds it does not
|
|
6187
6350
|
* persist are ignored); `load` replays a run's prior records folded into `PriorCoordination`. */
|
|
6188
6351
|
interface CoordinationLog {
|
|
6189
|
-
append(runId: string,
|
|
6190
|
-
load(runId: string): Promise<PriorCoordination>;
|
|
6352
|
+
append(runId: string, record: BusRecord<CoordinationEvent>, ownerId?: CoordinationOwnerId): Promise<void>;
|
|
6353
|
+
load(runId: string, ownerId?: CoordinationOwnerId): Promise<PriorCoordination>;
|
|
6191
6354
|
}
|
|
6192
6355
|
/** FS-backed `CoordinationLog`: append-only JSONL, fsynced per record. */
|
|
6193
6356
|
declare class FileCoordinationLog implements CoordinationLog {
|
|
6194
6357
|
private readonly path;
|
|
6358
|
+
private appendTail;
|
|
6195
6359
|
constructor(path: string);
|
|
6196
|
-
append(runId: string,
|
|
6197
|
-
|
|
6360
|
+
append(runId: string, record: BusRecord<CoordinationEvent>, ownerId?: CoordinationOwnerId): Promise<void>;
|
|
6361
|
+
private appendRecord;
|
|
6362
|
+
load(runId: string, ownerId?: CoordinationOwnerId): Promise<PriorCoordination>;
|
|
6198
6363
|
}
|
|
6199
6364
|
//#endregion
|
|
6200
6365
|
//#region src/runtime/supervise/finalizer.d.ts
|
|
@@ -6425,6 +6590,7 @@ interface DriverAgentOptions {
|
|
|
6425
6590
|
readonly blobs: ResultBlobStore;
|
|
6426
6591
|
/** Resolve a spawned `profile` to a worker LEAF or a driver child (the recursion seam). */
|
|
6427
6592
|
readonly makeWorkerAgent: MakeWorkerAgent;
|
|
6593
|
+
readonly authorizeDownMessage?: AuthorizeDownMessage;
|
|
6428
6594
|
/** Per-child budget reserved from the conserved pool on each spawn. */
|
|
6429
6595
|
readonly perWorker: Budget;
|
|
6430
6596
|
/** Independent completion check for work the driver performs itself. When present, the driver
|
|
@@ -6450,6 +6616,9 @@ interface DriverAgentOptions {
|
|
|
6450
6616
|
/** The driver's stance — a string, or built from the task (the worker-driver prompt /
|
|
6451
6617
|
* the generator). INJECTED so the prompt is a pluggable, optimizable role. */
|
|
6452
6618
|
readonly systemPrompt: string | ((task: unknown) => string);
|
|
6619
|
+
/** Product-selected tools already bound to this exact supervisor node. The same descriptors are
|
|
6620
|
+
* served over MCP for external supervisors; this arm projects them into router ToolSpecs. */
|
|
6621
|
+
readonly nodeTools?: ReadonlyArray<McpToolDescriptor$1>;
|
|
6453
6622
|
/** WORK tools the driver may call DIRECTLY (alongside the coordination verbs) — so the driver is
|
|
6454
6623
|
* not a pure manager but a full agent that can ACT (do simple work itself) OR SPAWN (delegate).
|
|
6455
6624
|
* Each is a router tool spec; their names must not collide with the coordination verbs. Pair with
|
|
@@ -6497,18 +6666,24 @@ interface DriverAgentOptions {
|
|
|
6497
6666
|
* off (no behavior change). `distill` defaults to a self-summary authored by the brain combined
|
|
6498
6667
|
* with the factual settled-worker roster; override to supply your own. */
|
|
6499
6668
|
readonly compaction?: ToolLoopCompactionOptions;
|
|
6500
|
-
/** Pass-through subscriber for every coordination bus event
|
|
6501
|
-
* steer
|
|
6502
|
-
|
|
6503
|
-
|
|
6504
|
-
|
|
6505
|
-
|
|
6669
|
+
/** Pass-through subscriber for every coordination bus event: settled/question/finding,
|
|
6670
|
+
* pre-delivery instruction receipts, and steer/answer delivery outcomes. A durable caller uses
|
|
6671
|
+
* this to append the coordination log. Omit = no observer. */
|
|
6672
|
+
readonly onEvent?: (event: CoordinationEvent, record: BusRecord<CoordinationEvent>) => void | Promise<void>;
|
|
6673
|
+
/** Re-publish resume-time settlements through the awaited observer before the first brain turn. */
|
|
6674
|
+
readonly replaySettlements?: boolean;
|
|
6675
|
+
/** Questions, findings, and authorized continuation receipts loaded from a prior process.
|
|
6676
|
+
* Questions seed the ledger (`list_questions`, blocking-stop policy); all three feed the resume
|
|
6677
|
+
* brief. Continuation receipts are evidence only and are never auto-delivered. Omit = fresh. */
|
|
6506
6678
|
readonly priorCoordination?: PriorCoordination;
|
|
6507
6679
|
/** How the settled-worker ledger becomes the run's output. Default `bestDelivered` — the single
|
|
6508
6680
|
* highest-scoring DELIVERED child (the exact keep-best every existing caller had). Runs under
|
|
6509
6681
|
* the delivered-only invariant (`runFinalizer`): whatever the finalizer, an undelivered or
|
|
6510
6682
|
* invalid child's output stays unreachable. */
|
|
6511
6683
|
readonly finalizer?: SupervisorFinalizer;
|
|
6684
|
+
/** Optional shared manager inbox used by a wrapper that must accept messages before async node
|
|
6685
|
+
* setup finishes. Ordinary callers omit it and the driver owns a fresh inbox. */
|
|
6686
|
+
readonly inbox?: Inbox;
|
|
6512
6687
|
}
|
|
6513
6688
|
/**
|
|
6514
6689
|
* Build the intelligent recursive driver. Its `act` is the LLM tool-loop; spawn it as a
|
|
@@ -6542,7 +6717,7 @@ interface CoordinationMcpHandle {
|
|
|
6542
6717
|
* `settled()` for a finalize, so a delivered child the harness never awaited is not lost. */
|
|
6543
6718
|
drainResolved: CoordinationTools['drainResolved'];
|
|
6544
6719
|
isStopped(): boolean;
|
|
6545
|
-
/** The full ordered bus-event log
|
|
6720
|
+
/** The full ordered bus-event log for current-process observability and audit evidence. */
|
|
6546
6721
|
history: CoordinationTools['history'];
|
|
6547
6722
|
/** Bus throughput counters for live dashboards. */
|
|
6548
6723
|
stats: CoordinationTools['stats'];
|
|
@@ -6557,6 +6732,7 @@ declare function serveCoordinationMcp(opts: {
|
|
|
6557
6732
|
scope: Scope<unknown>;
|
|
6558
6733
|
blobs: ResultBlobStore;
|
|
6559
6734
|
makeWorkerAgent: MakeWorkerAgent;
|
|
6735
|
+
authorizeDownMessage?: AuthorizeDownMessage;
|
|
6560
6736
|
perWorker: Budget;
|
|
6561
6737
|
/** Independent completion check exposed to the driver as `submit_result`. */
|
|
6562
6738
|
deliverable?: DeliverableSpec<unknown>;
|
|
@@ -6583,188 +6759,19 @@ declare function serveCoordinationMcp(opts: {
|
|
|
6583
6759
|
watchWorkers?: WorkerWatchOptions;
|
|
6584
6760
|
/** Idle time after which `observe_agent` reports a worker as stalled. */
|
|
6585
6761
|
stallAfterMs?: number;
|
|
6586
|
-
/** Pass-through subscriber for every bus event
|
|
6587
|
-
|
|
6762
|
+
/** Pass-through subscriber for every bus event, including pre-delivery instruction receipts and
|
|
6763
|
+
* steer/answer delivery outcomes. */
|
|
6764
|
+
onEvent?: (event: CoordinationEvent, record: BusRecord<CoordinationEvent>) => void | Promise<void>;
|
|
6765
|
+
/** Re-publish resume-time settlements through the awaited observer before this server listens. */
|
|
6766
|
+
replaySettlements?: boolean;
|
|
6588
6767
|
questionPolicy?: QuestionPolicy;
|
|
6589
6768
|
/** Questions replayed from a prior process of this run — seeds the question ledger. */
|
|
6590
6769
|
priorQuestions?: ReadonlyArray<QuestionRecord>;
|
|
6770
|
+
/** Product-selected tools already bound to this exact supervisor node. They share this server
|
|
6771
|
+
* with the coordination verbs, so the existing MCP duplicate-name guard applies before listen. */
|
|
6772
|
+
nodeTools?: ReadonlyArray<McpToolDescriptor$1>;
|
|
6591
6773
|
}): Promise<CoordinationMcpHandle>;
|
|
6592
6774
|
//#endregion
|
|
6593
|
-
//#region src/runtime/supervise/supervisor-agent.d.ts
|
|
6594
|
-
/**
|
|
6595
|
-
* The supervisor's profile — the subset of an `AgentProfile` that selects + shapes its brain.
|
|
6596
|
-
* `harness` is the backend-as-data discriminant; `systemPrompt` is the standing instruction.
|
|
6597
|
-
*
|
|
6598
|
-
* A canonical `AgentProfile` from `@tangle-network/agent-interface` satisfies this interface
|
|
6599
|
-
* structurally: its `model` is a hints OBJECT and its system prompt lives at `prompt.systemPrompt`,
|
|
6600
|
-
* so both spellings are accepted here and reduced by {@link resolveSupervisorProfile}. Before that,
|
|
6601
|
-
* a canonical profile's model object reached `RouterConfig.model` (a string) as an object and its
|
|
6602
|
-
* `prompt.systemPrompt` was dropped — a request the provider rejects, and a supervisor running the
|
|
6603
|
-
* default strategy while its profile named another.
|
|
6604
|
-
*
|
|
6605
|
-
* WHAT EACH ARM HONORS — the two brains read different amounts of a profile, so state it rather
|
|
6606
|
-
* than let a caller infer that a field took effect:
|
|
6607
|
-
*
|
|
6608
|
-
* - ROUTER arm (`harness` null): only `name`, the resolved model id (`model`, or
|
|
6609
|
-
* `model.default`), and the resolved system prompt (`prompt.systemPrompt`/`systemPrompt` plus
|
|
6610
|
-
* `prompt.instructions` and `resources.instructions`) reach the brain. A full `AgentProfile`'s
|
|
6611
|
-
* `tools`, `mcp`, `permissions`, `resources.skills`/`files`, `hooks`, `modes`, `subagents`,
|
|
6612
|
-
* `model.provider`, `model.small` and `model.reasoningEffort` are NOT honored here: the router
|
|
6613
|
-
* brain is one `ToolLoopChat` over the coordination verbs, and neither of its two tool-calling
|
|
6614
|
-
* transports (`routerChatWithTools` buffered, `streamRouterChatWithTools` when
|
|
6615
|
-
* `RouterConfig.stream` is set) has a parameter for any of them.
|
|
6616
|
-
* - HARNESS arm (`harness` set): the WHOLE profile object is handed to `deps.driveHarness`
|
|
6617
|
-
* untouched, plus the resolved system prompt as a separate argument. Everything the profile
|
|
6618
|
-
* declares is the harness's to materialize; this module changes none of it.
|
|
6619
|
-
*/
|
|
6620
|
-
interface SupervisorProfile {
|
|
6621
|
-
readonly name?: string;
|
|
6622
|
-
/** null/undefined → router brain (in-process tool-loop); a coding-CLI harness → sandboxed brain. */
|
|
6623
|
-
readonly harness?: string | null;
|
|
6624
|
-
/** The router model when the brain is router-driven: a model id, or a canonical profile's model
|
|
6625
|
-
* hints whose `default` IS the id. Absent (including a hints object with no `default`) → the
|
|
6626
|
-
* deps router config's model applies. Other hints (`small`, `provider`, `reasoningEffort`) are
|
|
6627
|
-
* harness-arm material only. */
|
|
6628
|
-
readonly model?: string | AgentProfileModelHints;
|
|
6629
|
-
/** Canonical `AgentProfile` prompt shaping. `prompt.systemPrompt` and the top-level `systemPrompt`
|
|
6630
|
-
* are the same standing instruction in two spellings; disagreeing values are a fault, not a pick.
|
|
6631
|
-
* `prompt.instructions` lines are appended to the resolved prompt, one per line. */
|
|
6632
|
-
readonly prompt?: AgentProfilePrompt;
|
|
6633
|
-
/** Canonical `AgentProfile` resources. Only `instructions` shapes the brain here (appended to the
|
|
6634
|
-
* resolved system prompt); every other resource is the harness's to materialize. */
|
|
6635
|
-
readonly resources?: AgentProfileResources;
|
|
6636
|
-
/** The standing instructions ("you delegate, you do not solve"). */
|
|
6637
|
-
readonly systemPrompt?: string;
|
|
6638
|
-
}
|
|
6639
|
-
/** A `SupervisorProfile` reduced to the scalars the two brain arms consume. `modelId`/`systemPrompt`
|
|
6640
|
-
* stay `undefined` when the profile named none — the caller's fallback (`deps.router.model`,
|
|
6641
|
-
* the built-in default supervisor prompt) then applies, and this type cannot hide which happened.
|
|
6642
|
-
*
|
|
6643
|
-
* There is deliberately no `reasoningEffort` here: the router brain runs on `chatWithTools` (the
|
|
6644
|
-
* buffered/streamed switch in the router client), and neither transport has a `reasoning_effort`
|
|
6645
|
-
* parameter — only the chat-only `routerChatWithUsage` does — so a field carrying it would be a
|
|
6646
|
-
* public promise nothing keeps. `model.reasoningEffort` still reaches the harness arm inside the
|
|
6647
|
-
* profile. */
|
|
6648
|
-
interface ResolvedSupervisorProfile {
|
|
6649
|
-
readonly name: string;
|
|
6650
|
-
readonly harness: string | null;
|
|
6651
|
-
readonly modelId?: string;
|
|
6652
|
-
readonly systemPrompt?: string;
|
|
6653
|
-
}
|
|
6654
|
-
/**
|
|
6655
|
-
* Reduce either profile spelling — a hand-written `SupervisorProfile` or a canonical `AgentProfile`
|
|
6656
|
-
* — to the scalars the brain arms consume:
|
|
6657
|
-
*
|
|
6658
|
-
* - `modelId`: a string `model` verbatim, else `model.default`. Absent or unresolvable → the
|
|
6659
|
-
* router config's own model applies unchanged.
|
|
6660
|
-
* - `systemPrompt`: the system prompt plus the `prompt.instructions` and `resources.instructions`
|
|
6661
|
-
* lines, one per line.
|
|
6662
|
-
*
|
|
6663
|
-
* `supervisorAgent` resolves each piece only where it is consumed (the model id on the router arm
|
|
6664
|
-
* only); this whole-profile reduction is the caller-facing view of the same rules.
|
|
6665
|
-
*/
|
|
6666
|
-
declare function resolveSupervisorProfile(profile: SupervisorProfile): ResolvedSupervisorProfile;
|
|
6667
|
-
/** Where the coordination MCP binds. Omit = an ephemeral port on `127.0.0.1` (the local-harness
|
|
6668
|
-
* default); set `host` when the root or the harness runs off-host. */
|
|
6669
|
-
interface CoordinationBinding {
|
|
6670
|
-
readonly host?: string;
|
|
6671
|
-
readonly port?: number;
|
|
6672
|
-
/** Explicit acknowledgment required to bind a NON-loopback host — see
|
|
6673
|
-
* {@link assertCoordinationBinding} for what is being accepted. */
|
|
6674
|
-
readonly allowUnauthenticatedRemote?: boolean;
|
|
6675
|
-
}
|
|
6676
|
-
/**
|
|
6677
|
-
* Fail closed on a non-loopback coordination bind. `serveCoordinationMcp` mounts spawn_agent /
|
|
6678
|
-
* steer_agent / stop with NO authentication of any kind (it is a bare JSON-RPC-over-HTTP handler),
|
|
6679
|
-
* so a non-loopback bind lets anyone who can reach the port spawn agents and spend the run's
|
|
6680
|
-
* conserved budget. There is no token to require yet, so the only honest options are loopback or an
|
|
6681
|
-
* explicit, recorded acknowledgment — never a silent bind.
|
|
6682
|
-
*/
|
|
6683
|
-
declare function assertCoordinationBinding(binding: CoordinationBinding | undefined): void;
|
|
6684
|
-
/** How to run a sandboxed harness as the DRIVER, with the coordination verbs mounted — the substrate
|
|
6685
|
-
* seam the caller supplies (mirrors `makeWorkerAgent` for spawned children). It runs `profile` on
|
|
6686
|
-
* `task` in its backend (sandbox / cli-bridge) with `coordinationMcpUrl` mounted as an MCP server,
|
|
6687
|
-
* so the harness calls spawn_agent / await_event / stop as native tools over the live scope. */
|
|
6688
|
-
type DriveHarness = (args: {
|
|
6689
|
-
/** The caller's profile, EXACTLY as passed to `supervisorAgent` — never rewritten. A canonical
|
|
6690
|
-
* `AgentProfile` stays schema-valid here (the canonical schema rejects unknown top-level keys,
|
|
6691
|
-
* so hoisting a resolved prompt onto it would make a profile its own validator refuses). */
|
|
6692
|
-
readonly profile: SupervisorProfile;
|
|
6693
|
-
/** The standing instruction assembled from the profile: its system prompt in either spelling,
|
|
6694
|
-
* plus the `prompt.instructions` and `resources.instructions` lines. Absent when the profile
|
|
6695
|
-
* names none — the harness's own default then applies. This, not `profile.systemPrompt`, is what
|
|
6696
|
-
* the harness should run under. */
|
|
6697
|
-
readonly systemPrompt?: string;
|
|
6698
|
-
readonly task: unknown;
|
|
6699
|
-
readonly scope: Scope<unknown>;
|
|
6700
|
-
readonly coordinationMcpUrl: string;
|
|
6701
|
-
}) => Promise<void>;
|
|
6702
|
-
interface SupervisorAgentDeps {
|
|
6703
|
-
readonly blobs: ResultBlobStore;
|
|
6704
|
-
/** Resolve a spawned worker `profile` to a leaf agent — the recursion seam (same for both arms). */
|
|
6705
|
-
readonly makeWorkerAgent: MakeWorkerAgent;
|
|
6706
|
-
/** Per-child budget reserved from the conserved pool on each spawn. */
|
|
6707
|
-
readonly perWorker: Budget;
|
|
6708
|
-
/** Independent completion check for direct driver work (`submit_result`). */
|
|
6709
|
-
readonly deliverable?: DeliverableSpec<unknown>;
|
|
6710
|
-
/** Hard cap on simultaneously-LIVE workers across both arms — `spawn_agent` fails closed once
|
|
6711
|
-
* this many are in flight (a concurrency fence on top of the conserved-pool fence; bounds live
|
|
6712
|
-
* boxes/sandboxes, not total work). Omit/`<= 0` = no cap. */
|
|
6713
|
-
readonly maxLiveWorkers?: number;
|
|
6714
|
-
/** Router substrate for a router-brained supervisor (`harness` null). The profile's model wins. */
|
|
6715
|
-
readonly router?: RouterConfig;
|
|
6716
|
-
/** Inject the brain directly (tests / advanced) instead of resolving `routerBrain` from the profile. */
|
|
6717
|
-
readonly brain?: ToolLoopChat;
|
|
6718
|
-
/** Required for a sandboxed-harness supervisor (`harness` set): runs the harness as the driver. */
|
|
6719
|
-
readonly driveHarness?: DriveHarness;
|
|
6720
|
-
/** WORK tools the supervisor may call DIRECTLY (router arm) — so it can do simple work ITSELF and
|
|
6721
|
-
* only delegate when it needs parallelism. Pair with `executeExtraTool`. */
|
|
6722
|
-
readonly extraTools?: ReadonlyArray<{
|
|
6723
|
-
readonly name: string;
|
|
6724
|
-
readonly description?: string;
|
|
6725
|
-
readonly parameters: Record<string, unknown>;
|
|
6726
|
-
}>;
|
|
6727
|
-
/** Runs an `extraTools` call; null/undefined falls through to the coordination dispatch. */
|
|
6728
|
-
readonly executeExtraTool?: (name: string, args: Record<string, unknown>) => Promise<string | null | undefined>;
|
|
6729
|
-
/** Analyst lenses available to the driver (both arms). Required for `analyzeOnSettle`. */
|
|
6730
|
-
readonly analysts?: AnalystRegistry;
|
|
6731
|
-
/** Analyst kinds run on each worker-settle → a `finding` the driver composes its next steer from
|
|
6732
|
-
* (the self-improving UP-leg). Unset/empty = status quo (no analyst feed). Requires `analysts`. */
|
|
6733
|
-
readonly analyzeOnSettle?: ReadonlyArray<string>;
|
|
6734
|
-
/** Run the ONLINE detector panel over each worker's LIVE tool trace (both arms) so the driver
|
|
6735
|
-
* learns a worker is looping mid-run instead of at settle. Omit = no online watching. */
|
|
6736
|
-
readonly watchWorkers?: WorkerWatchOptions;
|
|
6737
|
-
/** Idle time after which `observe_agent` reports a worker as stalled. Omit = runtime default. */
|
|
6738
|
-
readonly stallAfterMs?: number;
|
|
6739
|
-
/** PROGRESS-derived stop rule (router arm). Ends a run that has stopped learning BEFORE it
|
|
6740
|
-
* exhausts a ceiling; it can never keep a run alive past one. Build it with `plateau` /
|
|
6741
|
-
* `noProgressFor` / `allWorkersStalled` from `supervise/stop-rules` — the thresholds are the
|
|
6742
|
-
* caller's judgment. Omit = ceilings only. */
|
|
6743
|
-
readonly stopRule?: StopRule;
|
|
6744
|
-
/** One-shot notification of WHY a `stopRule` ended the run. */
|
|
6745
|
-
readonly onProgressStop?: (reason: string) => void;
|
|
6746
|
-
readonly maxTurns?: number;
|
|
6747
|
-
/** Give the supervisor brain a chapter-lifecycle on its OWN context window (router arm only) — it
|
|
6748
|
-
* distills its coordination transcript to a compact progress note once it exceeds the threshold,
|
|
6749
|
-
* instead of re-billing the whole thing every turn. See `DriverAgentOptions.compaction`. */
|
|
6750
|
-
readonly compaction?: ToolLoopCompactionOptions;
|
|
6751
|
-
/** Pass-through subscriber for every coordination bus event (both arms) — the seam a durable
|
|
6752
|
-
* caller hooks its coordination log onto. */
|
|
6753
|
-
readonly onEvent?: (event: CoordinationEvent) => void | Promise<void>;
|
|
6754
|
-
/** Questions + findings replayed from a prior process of this run (a durable coordination log).
|
|
6755
|
-
* Router arm: seeds the question ledger + the resume brief. Sandbox arm: seeds the ledger. */
|
|
6756
|
-
readonly priorCoordination?: PriorCoordination;
|
|
6757
|
-
/** How the settled ledger becomes the run's output (both arms). Default `bestDelivered` — the
|
|
6758
|
-
* exact keep-best every existing caller had. Always runs under the delivered-only invariant. */
|
|
6759
|
-
readonly finalizer?: SupervisorFinalizer;
|
|
6760
|
-
/** Where the coordination MCP binds (sandbox arm). Omit = an ephemeral loopback port, which is
|
|
6761
|
-
* unreachable from an off-host harness. A non-loopback host fails closed — see
|
|
6762
|
-
* {@link assertCoordinationBinding}. */
|
|
6763
|
-
readonly coordination?: CoordinationBinding;
|
|
6764
|
-
}
|
|
6765
|
-
/** Build a supervisor `Agent` from its profile: the brain resolves from `profile.harness` (backend-as-data), the same resolution rule as every worker. */
|
|
6766
|
-
declare function supervisorAgent(profile: SupervisorProfile, deps: SupervisorAgentDeps): Agent<unknown, unknown>;
|
|
6767
|
-
//#endregion
|
|
6768
6775
|
//#region src/runtime/supervise/delegate.d.ts
|
|
6769
6776
|
/** The conserved pool a `delegate()` call applies when the caller does not pass its own `budget`.
|
|
6770
6777
|
* A modest token ceiling + a small iteration ceiling — generous enough for a few-worker decompose,
|
|
@@ -6794,7 +6801,10 @@ interface DelegateOptions<Out = unknown> {
|
|
|
6794
6801
|
readonly brain?: ToolLoopChat;
|
|
6795
6802
|
/** Override the default authoring-supervisor profile (name / extra system-prompt stance). The
|
|
6796
6803
|
* default already carries the authoring skill; override only to add a goal or rename. */
|
|
6797
|
-
readonly supervisor?:
|
|
6804
|
+
readonly supervisor?: {
|
|
6805
|
+
readonly name?: string;
|
|
6806
|
+
readonly systemPrompt?: string;
|
|
6807
|
+
};
|
|
6798
6808
|
/** Restrict the run to this subset of models (forwarded to `supervise()`). */
|
|
6799
6809
|
readonly allowedModels?: readonly string[];
|
|
6800
6810
|
readonly runId?: string;
|
|
@@ -6910,6 +6920,9 @@ declare function queueOf<Out>(units: ReadonlyArray<{
|
|
|
6910
6920
|
* `model` is undefined (nothing was configured to check).
|
|
6911
6921
|
*/
|
|
6912
6922
|
declare function assertModelAllowed(model: string | undefined, allowed: readonly string[] | undefined): void;
|
|
6923
|
+
/** Check every canonical model-bearing field in a complete profile, including the models a
|
|
6924
|
+
* backend may select for cheap work, named subagents, or modes. */
|
|
6925
|
+
declare function assertProfileModelsAllowed(profile: AgentProfile$1, allowed: readonly string[] | undefined): void;
|
|
6913
6926
|
//#endregion
|
|
6914
6927
|
//#region src/runtime/supervise/otel-spans.d.ts
|
|
6915
6928
|
/** OTLP span attribute values. Exported because `SupervisorSpanOptions.attributes` is public and
|
|
@@ -7003,16 +7016,16 @@ interface WorktreeCliExecutorOptions {
|
|
|
7003
7016
|
repoRoot: string;
|
|
7004
7017
|
/**
|
|
7005
7018
|
* The supervisor-authored prompt/model plus materializable structural resources.
|
|
7006
|
-
* `model.default` selects the one-shot model
|
|
7007
|
-
*
|
|
7008
|
-
*
|
|
7009
|
-
* Harness-specific nested controls that the pinned materializer cannot preserve also fail closed.
|
|
7019
|
+
* `model.default` selects the one-shot model. Routing-only model hints, placement concerns,
|
|
7020
|
+
* provider extensions, and `resources.failOnError` fail before execution because this path
|
|
7021
|
+
* cannot honor them. Harness-specific values the materializer cannot preserve also fail closed.
|
|
7010
7022
|
*/
|
|
7011
7023
|
profile: AgentProfile$1;
|
|
7012
7024
|
/** Local CLI for this leaf. This explicit choice overrides `profile.harness`. */
|
|
7013
7025
|
harness: LocalHarness;
|
|
7014
|
-
/**
|
|
7015
|
-
|
|
7026
|
+
/** Default instruction for direct `execute(undefined, signal)` calls. An execution-time task
|
|
7027
|
+
* is authoritative. Omit when the caller always supplies the task to `execute`. */
|
|
7028
|
+
taskPrompt?: string;
|
|
7016
7029
|
/** Unique id for the worktree path + branch. Defaults to a fresh UUID. */
|
|
7017
7030
|
runId?: string;
|
|
7018
7031
|
/** Override the base ref the worktree is cut from (default `HEAD`). */
|
|
@@ -7049,13 +7062,16 @@ interface WorktreeCliExecutorOptions {
|
|
|
7049
7062
|
* likewise return `LocalHarnessResult.usage`.
|
|
7050
7063
|
*/
|
|
7051
7064
|
budgetExempt?: boolean;
|
|
7065
|
+
/** @internal Kernel-minted attempt identity threaded by the built-in registry. */
|
|
7066
|
+
executionAttemptId?: string;
|
|
7052
7067
|
}
|
|
7053
7068
|
/**
|
|
7054
7069
|
* Build a worktree-CLI leaf `Executor`. Per-spawn (a fresh worktree + abort + teardown each), so a
|
|
7055
7070
|
* fanout of N profiles = N parallel worktrees that never clobber each other.
|
|
7056
7071
|
*
|
|
7057
|
-
* Fail-loud: an empty `repoRoot`/`harness
|
|
7058
|
-
*
|
|
7072
|
+
* Fail-loud: an empty `repoRoot`/`harness` or an explicitly empty `taskPrompt` throws at
|
|
7073
|
+
* construction. Calling `execute(undefined, signal)` without a configured prompt throws before a
|
|
7074
|
+
* worktree is created. `resultArtifact()` before `execute()` resolves throws.
|
|
7059
7075
|
*
|
|
7060
7076
|
* @experimental
|
|
7061
7077
|
*/
|
|
@@ -7107,10 +7123,11 @@ interface InMemoryRunContext {
|
|
|
7107
7123
|
*/
|
|
7108
7124
|
readonly resume?: boolean;
|
|
7109
7125
|
/**
|
|
7110
|
-
* Present only on a DURABLE context: the coordination side-log
|
|
7111
|
-
*
|
|
7112
|
-
*
|
|
7113
|
-
*
|
|
7126
|
+
* Present only on a DURABLE context: the coordination side-log stores questions, analyst
|
|
7127
|
+
* findings, answer decisions, and authorized continuation receipts that the spawn journal does
|
|
7128
|
+
* not own. `supervise({ runDir })` appends them as they publish and loads them on resume.
|
|
7129
|
+
* Continuation receipts are evidence and are never auto-delivered to a replacement worker.
|
|
7130
|
+
* In-memory contexts have none: nothing outlives the process.
|
|
7114
7131
|
*/
|
|
7115
7132
|
readonly coordinationLog?: CoordinationLog;
|
|
7116
7133
|
}
|
|
@@ -7130,8 +7147,9 @@ declare function createInMemoryRunContext(opts?: InMemoryRunContextOptions): InM
|
|
|
7130
7147
|
* back on `Scope.resume` (rehydrated by `replaySpawnTree`) instead of being re-executed.
|
|
7131
7148
|
*
|
|
7132
7149
|
* Layout: `${dir}/spawn-journal.jsonl` (one JSONL record per event), `${dir}/blobs/` (one
|
|
7133
|
-
* content-addressed JSON file per settled result), and `${dir}/coordination-log.jsonl`
|
|
7134
|
-
*
|
|
7150
|
+
* content-addressed JSON file per settled result), and `${dir}/coordination-log.jsonl`
|
|
7151
|
+
* (questions, findings, answer decisions, and authorized continuation receipts retained as
|
|
7152
|
+
* evidence). The directory is created on first write.
|
|
7135
7153
|
*
|
|
7136
7154
|
* Opt-in by construction — `createInMemoryRunContext()` is unchanged and stays the default, so no
|
|
7137
7155
|
* existing consumer writes to disk or resumes unless it asks for this.
|
|
@@ -7193,12 +7211,25 @@ declare function supervisorRunDir(rootDir: string, id: string): string;
|
|
|
7193
7211
|
* here anymore.
|
|
7194
7212
|
*/
|
|
7195
7213
|
declare function legacySupervisorRunDir(rootDir: string, id: string): string;
|
|
7214
|
+
/**
|
|
7215
|
+
* The pre-rename runs root (`<root>/.loops/supervisor`). Only readers that ENUMERATE historical
|
|
7216
|
+
* runs need this — the per-id form is {@link legacySupervisorRunDir}. Nothing writes here.
|
|
7217
|
+
*/
|
|
7218
|
+
declare function legacySupervisorRunsRoot(rootDir: string): string;
|
|
7196
7219
|
/** A worker label reduced to a safe filename stem. Empty labels get a stable fallback. */
|
|
7197
7220
|
declare function safeWorkerFile(label: string): string;
|
|
7221
|
+
/** The directory holding every per-worker file of one run (inboxes and control-event logs). */
|
|
7222
|
+
declare function supervisorWorkersDir(eventDir: string): string;
|
|
7198
7223
|
/** The durable inbox file for one worker of one run. */
|
|
7199
7224
|
declare function workerInboxFile(rootDir: string, supervisorId: string, worker: string): string;
|
|
7200
7225
|
/** Same, addressed from an already-known run directory (the reader's usual entry point). */
|
|
7201
7226
|
declare function workerInboxFileFromEventDir(eventDir: string, worker: string): string;
|
|
7227
|
+
/**
|
|
7228
|
+
* The best-effort control-event log for one worker (`workers/<label>.ndjson`) — delivery
|
|
7229
|
+
* bookkeeping for steers, plus whatever lifecycle events a writer chooses to append. Distinct from
|
|
7230
|
+
* the inbox: the inbox is the durable down-leg queue, this is the record of what happened to it.
|
|
7231
|
+
*/
|
|
7232
|
+
declare function workerControlLogFile(eventDir: string, worker: string): string;
|
|
7202
7233
|
/**
|
|
7203
7234
|
* Durably append one steer request to a worker's inbox and log the delivery attempt.
|
|
7204
7235
|
*
|
|
@@ -7222,7 +7253,7 @@ interface ScopeArgs {
|
|
|
7222
7253
|
readonly parentId: NodeId;
|
|
7223
7254
|
/** Journal/blob root key the supervisor `beginTree`'d. */
|
|
7224
7255
|
readonly root: NodeId;
|
|
7225
|
-
/** The
|
|
7256
|
+
/** The reservation pool for this scope: the root total or one nested allocated partition. */
|
|
7226
7257
|
readonly pool: BudgetPool;
|
|
7227
7258
|
/** Append-only spawn journal; this scope writes `spawned` + `settled` records. */
|
|
7228
7259
|
readonly journal: SpawnJournal;
|
|
@@ -7241,6 +7272,11 @@ interface ScopeArgs {
|
|
|
7241
7272
|
readonly depth: number;
|
|
7242
7273
|
/** Runtime recursion-depth ceiling — a spawn past it fails closed `depth-exceeded`. */
|
|
7243
7274
|
readonly maxDepth?: number;
|
|
7275
|
+
/** Root-owned limit on live spawned workers across this scope and every nested scope. */
|
|
7276
|
+
readonly maxLiveWorkers?: number;
|
|
7277
|
+
/** @internal Shared counter inherited by nested scopes. Callers set `maxLiveWorkers`; the root
|
|
7278
|
+
* scope creates this state once and passes the same object through its recursion seam. */
|
|
7279
|
+
readonly liveWorkerCapacity?: LiveWorkerCapacityState;
|
|
7244
7280
|
/** Abort signal for this scope; an abort cascades into every live child's executor. */
|
|
7245
7281
|
readonly signal: AbortSignal;
|
|
7246
7282
|
/** Injected clock — keeps the journal `at` timestamp deterministic in tests. */
|
|
@@ -7256,6 +7292,17 @@ interface ScopeArgs {
|
|
|
7256
7292
|
* ⇒ no seam is seeded and no worker environment is touched.
|
|
7257
7293
|
*/
|
|
7258
7294
|
readonly workerTrace?: WorkerTraceResolver;
|
|
7295
|
+
/** @internal Trusted root-adapter publication channel. It is never exposed as a Scope method. */
|
|
7296
|
+
readonly ownerMaterialization?: {
|
|
7297
|
+
readonly runtime: NodeSnapshot['runtime'];
|
|
7298
|
+
readonly authoredProfile?: unknown;
|
|
7299
|
+
readonly attemptId: string;
|
|
7300
|
+
readonly prior?: ProfileMaterializationReceipt;
|
|
7301
|
+
readonly journalRoot?: NodeId;
|
|
7302
|
+
readonly nodeId?: NodeId;
|
|
7303
|
+
readonly requiredKnown?: boolean;
|
|
7304
|
+
readonly onReceipt?: (materialization: ProfileMaterializationReceipt, binding: ExecutionBindingReceipt) => void;
|
|
7305
|
+
};
|
|
7259
7306
|
/**
|
|
7260
7307
|
* Resume seam — set ONLY by the supervisor when `SupervisorOpts.resume` is on AND a non-empty
|
|
7261
7308
|
* journal tree exists for this root. It carries the replayed committed work (so `scope.resume`
|
|
@@ -7283,6 +7330,11 @@ interface ScopeArgs {
|
|
|
7283
7330
|
};
|
|
7284
7331
|
};
|
|
7285
7332
|
}
|
|
7333
|
+
/** Mutable only inside Scope admission/release. Every nested scope receives this exact object. */
|
|
7334
|
+
interface LiveWorkerCapacityState {
|
|
7335
|
+
readonly max: number | undefined;
|
|
7336
|
+
live: number;
|
|
7337
|
+
}
|
|
7286
7338
|
/** 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. */
|
|
7287
7339
|
declare function createScope<Out>(args: ScopeArgs): Scope<Out>;
|
|
7288
7340
|
/**
|
|
@@ -7298,6 +7350,248 @@ declare function createScope<Out>(args: ScopeArgs): Scope<Out>;
|
|
|
7298
7350
|
*/
|
|
7299
7351
|
declare function settledToIteration<Out>(settled: Settled<Out>): Iteration<unknown, Out>;
|
|
7300
7352
|
//#endregion
|
|
7353
|
+
//#region src/runtime/supervise/supervisor-agent.d.ts
|
|
7354
|
+
/**
|
|
7355
|
+
* The supervisor's profile — the subset of an `AgentProfile` that selects + shapes its brain.
|
|
7356
|
+
* `harness` is the backend-as-data discriminant; `systemPrompt` is the standing instruction.
|
|
7357
|
+
*
|
|
7358
|
+
* A canonical `AgentProfile` from `@tangle-network/agent-interface` satisfies this interface
|
|
7359
|
+
* structurally: its `model` is a hints OBJECT and its system prompt lives at `prompt.systemPrompt`,
|
|
7360
|
+
* so both spellings are accepted here and reduced by {@link resolveSupervisorProfile}. Before that,
|
|
7361
|
+
* a canonical profile's model object reached `RouterConfig.model` (a string) as an object and its
|
|
7362
|
+
* `prompt.systemPrompt` was dropped — a request the provider rejects, and a supervisor running the
|
|
7363
|
+
* default strategy while its profile named another.
|
|
7364
|
+
*
|
|
7365
|
+
* WHAT EACH ARM HONORS — the two brains read different amounts of a profile, so state it rather
|
|
7366
|
+
* than let a caller infer that a field took effect:
|
|
7367
|
+
*
|
|
7368
|
+
* - ROUTER arm (`harness` null): only `name`, the resolved model id (`model`, or
|
|
7369
|
+
* `model.default`), and the resolved system prompt (`prompt.systemPrompt`/`systemPrompt` plus
|
|
7370
|
+
* `prompt.instructions` and `resources.instructions`) reach the brain. A full `AgentProfile`'s
|
|
7371
|
+
* `tools`, `mcp`, `permissions`, `resources.skills`/`files`, `hooks`, `modes`, `subagents`,
|
|
7372
|
+
* `model.provider`, `model.small` and `model.reasoningEffort` are NOT honored here: the router
|
|
7373
|
+
* brain is one `ToolLoopChat` over the coordination verbs, and neither of its two tool-calling
|
|
7374
|
+
* transports (`routerChatWithTools` buffered, `streamRouterChatWithTools` when
|
|
7375
|
+
* `RouterConfig.stream` is set) has a parameter for any of them.
|
|
7376
|
+
* - HARNESS arm (`harness` set): the WHOLE profile object is handed to `deps.driveHarness`
|
|
7377
|
+
* untouched, plus the resolved system prompt as a separate argument. Everything the profile
|
|
7378
|
+
* declares is the harness's to materialize; this module changes none of it.
|
|
7379
|
+
*/
|
|
7380
|
+
interface SupervisorProfile {
|
|
7381
|
+
readonly name?: string;
|
|
7382
|
+
/** null/undefined/`cli-base` → router brain (in-process tool-loop); a coding-CLI harness → an
|
|
7383
|
+
* external harness brain. */
|
|
7384
|
+
readonly harness?: string | null;
|
|
7385
|
+
/** The router model when the brain is router-driven: a model id, or a canonical profile's model
|
|
7386
|
+
* hints whose `default` IS the id. Absent (including a hints object with no `default`) → the
|
|
7387
|
+
* deps router config's model applies. Other hints (`small`, `provider`, `reasoningEffort`) are
|
|
7388
|
+
* harness-arm material only. */
|
|
7389
|
+
readonly model?: string | AgentProfileModelHints;
|
|
7390
|
+
/** Canonical `AgentProfile` prompt shaping. `prompt.systemPrompt` and the top-level `systemPrompt`
|
|
7391
|
+
* are the same standing instruction in two spellings; disagreeing values are a fault, not a pick.
|
|
7392
|
+
* `prompt.instructions` lines are appended to the resolved prompt, one per line. */
|
|
7393
|
+
readonly prompt?: AgentProfilePrompt;
|
|
7394
|
+
/** Canonical `AgentProfile` resources. Only `instructions` shapes the brain here (appended to the
|
|
7395
|
+
* resolved system prompt); every other resource is the harness's to materialize. */
|
|
7396
|
+
readonly resources?: AgentProfileResources;
|
|
7397
|
+
/** The standing instructions ("you delegate, you do not solve"). */
|
|
7398
|
+
readonly systemPrompt?: string;
|
|
7399
|
+
}
|
|
7400
|
+
/** A `SupervisorProfile` reduced to the scalars the two brain arms consume. `modelId`/`systemPrompt`
|
|
7401
|
+
* stay `undefined` when the profile named none — the caller's fallback (`deps.router.model`,
|
|
7402
|
+
* the built-in default supervisor prompt) then applies, and this type cannot hide which happened.
|
|
7403
|
+
*
|
|
7404
|
+
* There is deliberately no `reasoningEffort` here: the router brain runs on `chatWithTools` (the
|
|
7405
|
+
* buffered/streamed switch in the router client), and neither transport has a `reasoning_effort`
|
|
7406
|
+
* parameter — only the chat-only `routerChatWithUsage` does — so a field carrying it would be a
|
|
7407
|
+
* public promise nothing keeps. `model.reasoningEffort` still reaches the harness arm inside the
|
|
7408
|
+
* profile. */
|
|
7409
|
+
interface ResolvedSupervisorProfile {
|
|
7410
|
+
readonly name: string;
|
|
7411
|
+
readonly harness: string | null;
|
|
7412
|
+
readonly modelId?: string;
|
|
7413
|
+
readonly systemPrompt?: string;
|
|
7414
|
+
}
|
|
7415
|
+
/**
|
|
7416
|
+
* Reduce either profile spelling — a hand-written `SupervisorProfile` or a canonical `AgentProfile`
|
|
7417
|
+
* — to the scalars the brain arms consume:
|
|
7418
|
+
*
|
|
7419
|
+
* - `modelId`: a string `model` verbatim, else `model.default`. Absent or unresolvable → the
|
|
7420
|
+
* router config's own model applies unchanged.
|
|
7421
|
+
* - `systemPrompt`: the system prompt plus the `prompt.instructions` and `resources.instructions`
|
|
7422
|
+
* lines, one per line.
|
|
7423
|
+
*
|
|
7424
|
+
* `supervisorAgent` resolves each piece only where it is consumed (the model id on the router arm
|
|
7425
|
+
* only); this whole-profile reduction is the caller-facing view of the same rules.
|
|
7426
|
+
*/
|
|
7427
|
+
declare function resolveSupervisorProfile(profile: SupervisorProfile): ResolvedSupervisorProfile;
|
|
7428
|
+
/** Where the coordination MCP binds. Omit = an ephemeral port on `127.0.0.1` (the local-harness
|
|
7429
|
+
* default); set `host` when the root or the harness runs off-host. */
|
|
7430
|
+
interface CoordinationBinding {
|
|
7431
|
+
readonly host?: string;
|
|
7432
|
+
readonly port?: number;
|
|
7433
|
+
/** Explicit acknowledgment required to bind a NON-loopback host — see
|
|
7434
|
+
* {@link assertCoordinationBinding} for what is being accepted. */
|
|
7435
|
+
readonly allowUnauthenticatedRemote?: boolean;
|
|
7436
|
+
}
|
|
7437
|
+
/**
|
|
7438
|
+
* Fail closed on a non-loopback coordination bind. `serveCoordinationMcp` mounts spawn_agent /
|
|
7439
|
+
* steer_agent / stop with NO authentication of any kind (it is a bare JSON-RPC-over-HTTP handler),
|
|
7440
|
+
* so a non-loopback bind lets anyone who can reach the port spawn agents and spend the run's
|
|
7441
|
+
* conserved budget. There is no token to require yet, so the only honest options are loopback or an
|
|
7442
|
+
* explicit, recorded acknowledgment — never a silent bind.
|
|
7443
|
+
*/
|
|
7444
|
+
declare function assertCoordinationBinding(binding: CoordinationBinding | undefined): void;
|
|
7445
|
+
/** Trusted run/node identity Runtime binds to one manager. Model-authored tool arguments cannot
|
|
7446
|
+
* provide or replace any of these fields. */
|
|
7447
|
+
interface SupervisorNodeContext {
|
|
7448
|
+
readonly runId: string;
|
|
7449
|
+
/** Stable across a durable restart; unique per in-memory invocation. */
|
|
7450
|
+
readonly runNamespace: string;
|
|
7451
|
+
/** Concrete Scope node that owns this manager's coordination stream. */
|
|
7452
|
+
readonly nodeId: string;
|
|
7453
|
+
/** Stable identity of this manager's coordination stream. */
|
|
7454
|
+
readonly ownerId: string;
|
|
7455
|
+
readonly depth: number;
|
|
7456
|
+
readonly identity: NodeExecutionIdentity;
|
|
7457
|
+
/** Assignment identity within the parent manager; absent only for the root. */
|
|
7458
|
+
readonly assignmentId?: string;
|
|
7459
|
+
readonly profile: SupervisorProfile;
|
|
7460
|
+
readonly task: unknown;
|
|
7461
|
+
}
|
|
7462
|
+
/** Context known before `Agent.act`; Runtime adds the concrete node, profile, and task. */
|
|
7463
|
+
type SupervisorNodeContextSeed = Omit<SupervisorNodeContext, 'nodeId' | 'profile' | 'task'>;
|
|
7464
|
+
/** Trusted context for one product-tool invocation. The node identity remains the same detached,
|
|
7465
|
+
* immutable snapshot supplied to the resolver; `signal` is the one live control reference Runtime
|
|
7466
|
+
* adds. It aborts when this manager's scope is cancelled by the caller, RootHandle, deadline,
|
|
7467
|
+
* breaker, or a recursive parent. */
|
|
7468
|
+
interface SupervisorToolInvocationContext extends SupervisorNodeContext {
|
|
7469
|
+
readonly signal: AbortSignal;
|
|
7470
|
+
}
|
|
7471
|
+
/** One product-owned tool. It reuses the canonical MCP descriptor fields while Runtime supplies
|
|
7472
|
+
* the trusted invocation context as a separate argument and binds the result for either
|
|
7473
|
+
* transport. Existing handlers remain compatible: the second argument only gains `signal`. */
|
|
7474
|
+
interface SupervisorToolDescriptor extends Omit<McpToolDescriptor$1, 'handler'> {
|
|
7475
|
+
readonly handler: (raw: unknown, context: SupervisorToolInvocationContext) => Promise<unknown>;
|
|
7476
|
+
}
|
|
7477
|
+
/** Product policy for the tools one exact supervisor node may call. Resolved once per node. */
|
|
7478
|
+
type ResolveSupervisorTools = (context: SupervisorNodeContext) => ReadonlyArray<SupervisorToolDescriptor> | Promise<ReadonlyArray<SupervisorToolDescriptor>>;
|
|
7479
|
+
/** Context-aware observer used internally to bind product transactions to the actual live node. */
|
|
7480
|
+
type ObserveSupervisorNodeEvent = (context: SupervisorNodeContext, event: CoordinationEvent, record: BusRecord<CoordinationEvent>) => void | Promise<void>;
|
|
7481
|
+
/** How to run an external harness as the DRIVER, with the coordination verbs mounted — the substrate
|
|
7482
|
+
* seam the caller supplies (mirrors `makeWorkerAgent` for spawned children). It runs `profile` on
|
|
7483
|
+
* `task` in its backend (remote sandbox or local CLI bridge) with `coordinationMcpUrl` mounted as an MCP server,
|
|
7484
|
+
* so the harness calls spawn_agent / await_event / stop as native tools over the live scope. */
|
|
7485
|
+
interface DriveHarness {
|
|
7486
|
+
(args: {
|
|
7487
|
+
/** The caller's profile, EXACTLY as passed to `supervisorAgent` — never rewritten. A canonical
|
|
7488
|
+
* `AgentProfile` stays schema-valid here (the canonical schema rejects unknown top-level keys,
|
|
7489
|
+
* so hoisting a resolved prompt onto it would make a profile its own validator refuses). */
|
|
7490
|
+
readonly profile: SupervisorProfile;
|
|
7491
|
+
/** The standing instruction assembled from the profile: its system prompt in either spelling,
|
|
7492
|
+
* plus the `prompt.instructions` and `resources.instructions` lines. Absent when the profile
|
|
7493
|
+
* names none — the harness's own default then applies. This, not `profile.systemPrompt`, is
|
|
7494
|
+
* what the harness should run under. */
|
|
7495
|
+
readonly systemPrompt?: string;
|
|
7496
|
+
readonly task: unknown;
|
|
7497
|
+
readonly scope: Scope<unknown>;
|
|
7498
|
+
readonly coordinationMcpUrl: string;
|
|
7499
|
+
/** Data-only product tool surface mounted on the coordination MCP. Runtime-owned drivers include
|
|
7500
|
+
* this in their materialization evidence without persisting executable handlers. */
|
|
7501
|
+
readonly coordinationTools: ReadonlyArray<Omit<McpToolDescriptor$1, 'handler'>>;
|
|
7502
|
+
}): Promise<void>;
|
|
7503
|
+
/** Optional live inbox for the manager session this adapter currently drives. Return `false`
|
|
7504
|
+
* when no executor inbox is active instead of claiming a message was delivered. */
|
|
7505
|
+
deliver?(message: unknown): boolean;
|
|
7506
|
+
}
|
|
7507
|
+
/** Trusted manager identity available before its external harness starts. A product uses this to
|
|
7508
|
+
* return one independently steerable harness session per recursive manager. */
|
|
7509
|
+
type DriveHarnessOwnerContext = Omit<SupervisorNodeContext, 'nodeId'>;
|
|
7510
|
+
/** Resolve an external harness for one exact Runtime-owned manager identity. */
|
|
7511
|
+
type ResolveDriveHarness = (context: DriveHarnessOwnerContext) => DriveHarness;
|
|
7512
|
+
interface SupervisorAgentDeps {
|
|
7513
|
+
readonly blobs: ResultBlobStore;
|
|
7514
|
+
/** Resolve a spawned worker `profile` to a leaf agent — the recursion seam (same for both arms). */
|
|
7515
|
+
readonly makeWorkerAgent: MakeWorkerAgent;
|
|
7516
|
+
/** Product authorization for every down-leg continuation to a child. */
|
|
7517
|
+
readonly authorizeDownMessage?: AuthorizeDownMessage;
|
|
7518
|
+
/** Per-child budget reserved from the conserved pool on each spawn. */
|
|
7519
|
+
readonly perWorker: Budget;
|
|
7520
|
+
/** Independent completion check for direct driver work (`submit_result`). */
|
|
7521
|
+
readonly deliverable?: DeliverableSpec<unknown>;
|
|
7522
|
+
/** Hard cap on simultaneously-LIVE workers across both arms — `spawn_agent` fails closed once
|
|
7523
|
+
* this many are in flight (a concurrency fence on top of the conserved-pool fence; bounds live
|
|
7524
|
+
* boxes/sandboxes, not total work). Omit/`<= 0` = no cap. */
|
|
7525
|
+
readonly maxLiveWorkers?: number;
|
|
7526
|
+
/** Router substrate for a router-brained supervisor (`harness` omitted or `cli-base`). The
|
|
7527
|
+
* profile's model wins. */
|
|
7528
|
+
readonly router?: RouterConfig;
|
|
7529
|
+
/** Inject the brain directly (tests / advanced) instead of resolving `routerBrain` from the profile. */
|
|
7530
|
+
readonly brain?: ToolLoopChat;
|
|
7531
|
+
/** Required to run an external-harness supervisor: runs the harness as the driver. */
|
|
7532
|
+
readonly driveHarness?: DriveHarness;
|
|
7533
|
+
/** Trusted identity for this manager. Required with node-scoped tools or observation. */
|
|
7534
|
+
readonly nodeContext?: SupervisorNodeContextSeed;
|
|
7535
|
+
/** Resolve product-owned tools for this exact manager. Static `extraTools` remain a router-only
|
|
7536
|
+
* compatibility seam and deliberately receive no new recursive authority. */
|
|
7537
|
+
readonly resolveSupervisorTools?: ResolveSupervisorTools;
|
|
7538
|
+
/** Awaited product observation, enriched with this manager's actual live node context. */
|
|
7539
|
+
readonly observeNodeEvent?: ObserveSupervisorNodeEvent;
|
|
7540
|
+
/** Replay resume-time settlements through `observeNodeEvent` before the manager starts. */
|
|
7541
|
+
readonly replaySettlements?: boolean;
|
|
7542
|
+
/** WORK tools the supervisor may call DIRECTLY (router arm) — so it can do simple work ITSELF and
|
|
7543
|
+
* only delegate when it needs parallelism. Pair with `executeExtraTool`. */
|
|
7544
|
+
readonly extraTools?: ReadonlyArray<{
|
|
7545
|
+
readonly name: string;
|
|
7546
|
+
readonly description?: string;
|
|
7547
|
+
readonly parameters: Record<string, unknown>;
|
|
7548
|
+
}>;
|
|
7549
|
+
/** Runs an `extraTools` call; null/undefined falls through to the coordination dispatch. */
|
|
7550
|
+
readonly executeExtraTool?: (name: string, args: Record<string, unknown>) => Promise<string | null | undefined>;
|
|
7551
|
+
/** Analyst lenses available to the driver (both arms). Required for `analyzeOnSettle`. */
|
|
7552
|
+
readonly analysts?: AnalystRegistry;
|
|
7553
|
+
/** Analyst kinds run on each worker-settle → a `finding` the driver composes its next steer from
|
|
7554
|
+
* (the self-improving UP-leg). Unset/empty = status quo (no analyst feed). Requires `analysts`. */
|
|
7555
|
+
readonly analyzeOnSettle?: ReadonlyArray<string>;
|
|
7556
|
+
/** Run the ONLINE detector panel over each worker's LIVE tool trace (both arms) so the driver
|
|
7557
|
+
* learns a worker is looping mid-run instead of at settle. Omit = no online watching. */
|
|
7558
|
+
readonly watchWorkers?: WorkerWatchOptions;
|
|
7559
|
+
/** Idle time after which `observe_agent` reports a worker as stalled. Omit = runtime default. */
|
|
7560
|
+
readonly stallAfterMs?: number;
|
|
7561
|
+
/** PROGRESS-derived stop rule (router arm). Ends a run that has stopped learning BEFORE it
|
|
7562
|
+
* exhausts a ceiling; it can never keep a run alive past one. Build it with `plateau` /
|
|
7563
|
+
* `noProgressFor` / `allWorkersStalled` from `supervise/stop-rules` — the thresholds are the
|
|
7564
|
+
* caller's judgment. Omit = ceilings only. */
|
|
7565
|
+
readonly stopRule?: StopRule;
|
|
7566
|
+
/** One-shot notification of WHY a `stopRule` ended the run. */
|
|
7567
|
+
readonly onProgressStop?: (reason: string) => void;
|
|
7568
|
+
readonly maxTurns?: number;
|
|
7569
|
+
/** Give the supervisor brain a chapter-lifecycle on its OWN context window (router arm only) — it
|
|
7570
|
+
* distills its coordination transcript to a compact progress note once it exceeds the threshold,
|
|
7571
|
+
* instead of re-billing the whole thing every turn. See `DriverAgentOptions.compaction`. */
|
|
7572
|
+
readonly compaction?: ToolLoopCompactionOptions;
|
|
7573
|
+
/** Pass-through subscriber for every coordination bus event (both arms) — the seam a durable
|
|
7574
|
+
* caller hooks its coordination log onto. */
|
|
7575
|
+
readonly onEvent?: (event: CoordinationEvent, record: BusRecord<CoordinationEvent>) => void | Promise<void>;
|
|
7576
|
+
/** Questions, findings, and authorized continuation receipts loaded from a prior process.
|
|
7577
|
+
* Router arm: questions seed the ledger and all evidence enters the resume brief. External arm:
|
|
7578
|
+
* questions seed the ledger; receipts remain durable evidence and are never auto-delivered. */
|
|
7579
|
+
readonly priorCoordination?: PriorCoordination;
|
|
7580
|
+
/** Deferred owner-scoped replay for a recursive supervisor. Its stable owner is known while the
|
|
7581
|
+
* parent authorizes the child, but loading remains asynchronous; Runtime calls this before the
|
|
7582
|
+
* nested brain can publish or act on coordination state. */
|
|
7583
|
+
readonly loadPriorCoordination?: () => Promise<PriorCoordination>;
|
|
7584
|
+
/** How the settled ledger becomes the run's output (both arms). Default `bestDelivered` — the
|
|
7585
|
+
* exact keep-best every existing caller had. Always runs under the delivered-only invariant. */
|
|
7586
|
+
readonly finalizer?: SupervisorFinalizer;
|
|
7587
|
+
/** Where the coordination MCP binds (external arm). Omit = an ephemeral loopback port, which is
|
|
7588
|
+
* unreachable from an off-host harness. A non-loopback host fails closed — see
|
|
7589
|
+
* {@link assertCoordinationBinding}. */
|
|
7590
|
+
readonly coordination?: CoordinationBinding;
|
|
7591
|
+
}
|
|
7592
|
+
/** Build a supervisor `Agent` from its profile: the brain resolves from `profile.harness` (backend-as-data), the same resolution rule as every worker. */
|
|
7593
|
+
declare function supervisorAgent(profile: SupervisorProfile, deps: SupervisorAgentDeps): Agent<unknown, unknown>;
|
|
7594
|
+
//#endregion
|
|
7301
7595
|
//#region src/runtime/supervise/supervise.d.ts
|
|
7302
7596
|
/**
|
|
7303
7597
|
* Build the worker seam from a backend (WHERE workers run) + an optional completion oracle (the
|
|
@@ -7313,6 +7607,9 @@ declare function settledToIteration<Out>(settled: Settled<Out>): Iteration<unkno
|
|
|
7313
7607
|
* ahead of the worker seam.
|
|
7314
7608
|
*/
|
|
7315
7609
|
declare function workerFromBackend(backend: ExecutorConfig, deliverable?: DeliverableSpec<unknown>, seams?: () => Readonly<Record<string, unknown>>): MakeWorkerAgent;
|
|
7610
|
+
/** Manager-authored profiles are untrusted until product policy says otherwise. Remote MCP and
|
|
7611
|
+
* ambient connection grants therefore fail closed by default, in addition to local MCP and hooks. */
|
|
7612
|
+
declare const DEFAULT_AUTHORED_PROFILE_SECURITY_POLICY: AgentProfileSecurityPolicy;
|
|
7316
7613
|
/** A name→value table, in this package's resolver-port shape (the same one `WaitProbeRegistry`
|
|
7317
7614
|
* uses): construction stays the caller's, lookup stays lazy, and a table backed by a file, a
|
|
7318
7615
|
* plugin loader, or a plain object all satisfy one interface. */
|
|
@@ -7337,6 +7634,15 @@ interface SuperviseRegistry {
|
|
|
7337
7634
|
interface SuperviseOptions {
|
|
7338
7635
|
/** The conserved compute pool for the whole run. */
|
|
7339
7636
|
readonly budget: Budget;
|
|
7637
|
+
/** Caller-created live handle for observing, steering, or cancelling this root manager. Runtime
|
|
7638
|
+
* attaches it before execution and detaches it after the join barrier. */
|
|
7639
|
+
readonly rootHandle?: RootHandle<unknown>;
|
|
7640
|
+
/** Caller-owned cancellation for the complete recursive run. Aborting it cascades through the
|
|
7641
|
+
* root scope and every live child, including acquisition and backend execution. */
|
|
7642
|
+
readonly signal?: AbortSignal;
|
|
7643
|
+
/** Trusted candidate and pursuit attribution for the root. The runtime derives profile/task
|
|
7644
|
+
* digests itself from the exact detached values it executes. */
|
|
7645
|
+
readonly execution?: AgentExecutionRef;
|
|
7340
7646
|
/** WHERE workers run — derives the worker seam. Provide this OR an explicit `makeWorkerAgent`. */
|
|
7341
7647
|
readonly backend?: ExecutorConfig;
|
|
7342
7648
|
/** The independent completion check for backend-derived workers and direct supervisor
|
|
@@ -7344,6 +7650,10 @@ interface SuperviseOptions {
|
|
|
7344
7650
|
* backend-derived workers fall back to their own validity signal. A `string` names an entry in
|
|
7345
7651
|
* `registry.deliverables`. */
|
|
7346
7652
|
readonly deliverable?: DeliverableSpec<unknown> | string;
|
|
7653
|
+
/** Resolve the completion check for one exact authorized backend-derived leaf. The callback runs
|
|
7654
|
+
* after spawn authorization and driver classification, receives a detached immutable context,
|
|
7655
|
+
* and may return `undefined` to use the run-wide `deliverable`. Driver profiles never call it. */
|
|
7656
|
+
readonly resolveDeliverable?: (input: DeliverableResolutionInput) => DeliverableSpec<unknown> | undefined;
|
|
7347
7657
|
/** Name→value tables for the four code-valued options, so a recorded run configuration can name
|
|
7348
7658
|
* them instead of carrying closures. See {@link SuperviseRegistry}. */
|
|
7349
7659
|
readonly registry?: SuperviseRegistry;
|
|
@@ -7351,17 +7661,76 @@ interface SuperviseOptions {
|
|
|
7351
7661
|
* port on `127.0.0.1`, which an off-host root cannot reach. A non-loopback host is refused
|
|
7352
7662
|
* unless `allowUnauthenticatedRemote` acknowledges that the verbs are unauthenticated. */
|
|
7353
7663
|
readonly coordination?: CoordinationBinding;
|
|
7354
|
-
/** Override the worker seam directly (tests / advanced) instead of deriving it from `backend`.
|
|
7664
|
+
/** Override the worker seam directly (tests / advanced) instead of deriving it from `backend`.
|
|
7665
|
+
* This is caller-owned execution: profile security, spawn authorization, and recursive-driver
|
|
7666
|
+
* selection below apply only to the backend-derived worker path. `authorizeMessage` still
|
|
7667
|
+
* governs continuations sent through Runtime's coordination tools. */
|
|
7355
7668
|
readonly makeWorkerAgent?: MakeWorkerAgent;
|
|
7356
|
-
/**
|
|
7669
|
+
/** Run harness-brained supervisors here. Automatic execution supports a local `bridge`; a remote
|
|
7670
|
+
* sandbox requires an explicit `driveHarness` with a reachable coordination relay or tunnel.
|
|
7671
|
+
* Defaults to `backend`; separate it when managers and workers use different services. */
|
|
7672
|
+
readonly driverBackend?: ExecutorConfig;
|
|
7673
|
+
/** Security policy applied to every manager-authored child profile before budget reservation.
|
|
7674
|
+
* The default blocks local and remote MCP, hooks, and connection grants. Pass an explicit
|
|
7675
|
+
* allowlist to grant remote MCP hosts or other author-controlled capabilities. */
|
|
7676
|
+
readonly profileSecurity?: AgentProfileSecurityPolicy;
|
|
7677
|
+
/** Product authority over one complete manager-authored spawn. The callback sees the detached,
|
|
7678
|
+
* immutable profile, task, budget, label, and key together, so approving a profile cannot
|
|
7679
|
+
* authorize a different task. Return the exact allowed profile (which may be narrowed) plus
|
|
7680
|
+
* trusted candidate/pursuit attribution, or throw to refuse the whole spawn before reservation. */
|
|
7681
|
+
readonly authorizeSpawn?: (input: {
|
|
7682
|
+
readonly profile: AgentProfile$1;
|
|
7683
|
+
readonly parent: AgentProfile$1;
|
|
7684
|
+
/** Trusted identity of the manager authorizing this exact child. */
|
|
7685
|
+
readonly parentIdentity: NodeExecutionIdentity;
|
|
7686
|
+
/** Concrete manager node; never accepted from model-authored tool arguments. */
|
|
7687
|
+
readonly parentNodeId: string;
|
|
7688
|
+
/** Stable manager-scoped assignment, including deterministic unkeyed siblings. */
|
|
7689
|
+
readonly assignmentId: string;
|
|
7690
|
+
readonly task: unknown;
|
|
7691
|
+
readonly budget: Budget;
|
|
7692
|
+
readonly label: string;
|
|
7693
|
+
readonly key?: string;
|
|
7694
|
+
readonly depth: number;
|
|
7695
|
+
}) => AuthorizedSpawn;
|
|
7696
|
+
/** Product authority over every continuation sent to a live child. When spawn authorization is
|
|
7697
|
+
* enabled, omitting this refuses steer/answer instructions instead of silently extending the
|
|
7698
|
+
* authorized task. The exact worker identity and detached bytes are recorded before delivery. */
|
|
7699
|
+
readonly authorizeMessage?: (input: DownMessageAuthorizationInput & {
|
|
7700
|
+
readonly parent: AgentProfile$1;
|
|
7701
|
+
readonly depth: number;
|
|
7702
|
+
}) => AuthorizedDownMessage;
|
|
7703
|
+
/** Decide whether an authorized child becomes another supervisor. By default only
|
|
7704
|
+
* `metadata.role === 'driver'` does. Products receive the same frozen post-authorization
|
|
7705
|
+
* context as `resolveDeliverable`, so trusted execution/assignment authority can override
|
|
7706
|
+
* model-authored metadata without a side channel. */
|
|
7707
|
+
readonly isDriverProfile?: (input: AuthorizedSpawnContext) => boolean;
|
|
7708
|
+
/** The supervisor's router substrate (`profile.harness` omitted or `cli-base`). The profile's
|
|
7709
|
+
* model wins. */
|
|
7357
7710
|
readonly router?: RouterConfig;
|
|
7358
7711
|
/** Inject the supervisor brain directly (tests / advanced). */
|
|
7359
7712
|
readonly brain?: ToolLoopChat;
|
|
7360
|
-
/** Run
|
|
7713
|
+
/** Run an external-harness supervisor explicitly. Required for a remote sandbox; optional as a
|
|
7714
|
+
* caller-owned override for a local bridge. */
|
|
7361
7715
|
readonly driveHarness?: DriveHarness;
|
|
7716
|
+
/** Resolve one custom external-harness session per trusted manager identity. Use this instead of
|
|
7717
|
+
* `driveHarness` when recursive managers must be independently steerable. */
|
|
7718
|
+
readonly resolveDriveHarness?: ResolveDriveHarness;
|
|
7719
|
+
/** Required with a custom `driveHarness` or `resolveDriveHarness`: declares which complete
|
|
7720
|
+
* AgentProfile axes that path really applies. Built-in bridge driving supplies its own
|
|
7721
|
+
* full-profile contract. */
|
|
7722
|
+
readonly driveHarnessMaterialization?: ProfileMaterializationContract;
|
|
7723
|
+
/** Resolve product-owned tools from the exact trusted manager context. The same descriptors and
|
|
7724
|
+
* handlers are bound to router and external-harness managers; resolution happens once per node.
|
|
7725
|
+
* Each handler receives that manager scope's live cancellation signal in its trusted invocation
|
|
7726
|
+
* context, including recursive parent and root cascades. */
|
|
7727
|
+
readonly resolveSupervisorTools?: ResolveSupervisorTools;
|
|
7728
|
+
/** Awaited product transaction hook for every coordination record. `eventId` is stable across a
|
|
7729
|
+
* lost acknowledgement and durable restart; the record is not pull-visible until this commits. */
|
|
7730
|
+
readonly onCoordinationEvent?: (context: SupervisorNodeContext, eventId: Sha256Digest, record: BusRecord<CoordinationEvent>) => void | Promise<void>;
|
|
7362
7731
|
/** WORK tools the supervisor may call DIRECTLY — so a recursive atom can ACT (do simple work
|
|
7363
7732
|
* itself) OR SPAWN (delegate when it needs parallelism), not be a pure manager. Pair with
|
|
7364
|
-
* `executeExtraTool`. Router arm only (`harness`
|
|
7733
|
+
* `executeExtraTool`. Router arm only (`profile.harness` omitted or `cli-base`). */
|
|
7365
7734
|
readonly extraTools?: ReadonlyArray<{
|
|
7366
7735
|
readonly name: string;
|
|
7367
7736
|
readonly description?: string;
|
|
@@ -7371,9 +7740,9 @@ interface SuperviseOptions {
|
|
|
7371
7740
|
readonly executeExtraTool?: (name: string, args: Record<string, unknown>) => Promise<string | null | undefined>;
|
|
7372
7741
|
/** Per-child budget reserved on each spawn. Defaults to a quarter of the pool's tokens. */
|
|
7373
7742
|
readonly perWorker?: Budget;
|
|
7374
|
-
/** Hard cap on simultaneously
|
|
7375
|
-
*
|
|
7376
|
-
*
|
|
7743
|
+
/** Hard cap on simultaneously executing spawned workers across the WHOLE recursive tree. The
|
|
7744
|
+
* root is excluded; nested drivers and leaves share one allocation, so recursion cannot multiply
|
|
7745
|
+
* the cap. Omit/`<= 0` = no cap (the conserved pool stays the only bound). */
|
|
7377
7746
|
readonly maxLiveWorkers?: number;
|
|
7378
7747
|
/** Analyst lenses available to the driver. Required for `analyzeOnSettle`. Unset → status quo
|
|
7379
7748
|
* (the driver receives settled worker outputs, no analyst findings). A `string` names an entry in
|
|
@@ -7402,17 +7771,23 @@ interface SuperviseOptions {
|
|
|
7402
7771
|
/**
|
|
7403
7772
|
* Make the run DURABLE: journal + result blobs + the coordination side-log are file-backed under
|
|
7404
7773
|
* this directory (`createFileRunContext`), fsynced per write, and the supervisor reads the prior
|
|
7405
|
-
* tree first. Re-running with the same `runDir` AND the same `runId` resumes
|
|
7406
|
-
*
|
|
7774
|
+
* tree first. Re-running with the same `runDir` AND the same `runId` resumes only when the exact
|
|
7775
|
+
* root profile/task identity and declared budget match. The original absolute deadline and prior
|
|
7776
|
+
* measured spend are restored before new admission. The built-in driver is resume-aware: children
|
|
7777
|
+
* that already settled, including their exact execution identities, are replayed onto
|
|
7407
7778
|
* `Scope.resume` (and into the driver's settled ledger + its first context), keyed assignments
|
|
7408
7779
|
* (`spawn_agent`'s `key`) resolve to their committed results instead of re-running, pending
|
|
7409
|
-
* waits re-arm on their original deadlines,
|
|
7410
|
-
*
|
|
7411
|
-
*
|
|
7780
|
+
* waits re-arm on their original deadlines, and the coordination log loads prior questions,
|
|
7781
|
+
* findings, and instruction receipts. The router arm receives all three in its resume brief; the
|
|
7782
|
+
* external arm seeds prior questions while findings and receipts remain in the durable log.
|
|
7783
|
+
* Instruction receipts are evidence and are never delivered automatically to a replacement
|
|
7784
|
+
* worker. The final result spans both processes' work. Unset = in-memory, fresh every call.
|
|
7412
7785
|
*
|
|
7413
7786
|
* The boundary that remains: work that was IN FLIGHT when the process died is not recovered —
|
|
7414
|
-
* the built-in executors cannot re-attach to a dead process's executions
|
|
7415
|
-
*
|
|
7787
|
+
* the built-in executors cannot re-attach to a dead process's executions. Each such assignment
|
|
7788
|
+
* resumes as explicitly lost/in-doubt, its full declared reservation is charged conservatively,
|
|
7789
|
+
* and its token/dollar telemetry remains unknown. A retry is admitted only from safely remaining
|
|
7790
|
+
* capacity, so restart cannot mint a fresh budget or slide the original absolute deadline.
|
|
7416
7791
|
*
|
|
7417
7792
|
* `runId` matters here: it defaults to the constant `'supervise'`, which is fine for a single
|
|
7418
7793
|
* resumable run per directory but collides across concurrent runs sharing one `runDir`.
|
|
@@ -7477,12 +7852,57 @@ interface SuperviseOptions {
|
|
|
7477
7852
|
*/
|
|
7478
7853
|
readonly otel?: Omit<SupervisorSpanOptions, 'runId' | 'now'>;
|
|
7479
7854
|
}
|
|
7855
|
+
/** The product-authorized result for one complete spawn request. Attribution is never accepted
|
|
7856
|
+
* from the manager itself; it enters only through this trusted callback. */
|
|
7857
|
+
interface AuthorizedSpawn {
|
|
7858
|
+
readonly profile: AgentProfile$1;
|
|
7859
|
+
readonly execution?: AgentExecutionRef;
|
|
7860
|
+
}
|
|
7861
|
+
/** Exact trusted context after a manager-authored spawn has passed product authorization. */
|
|
7862
|
+
interface AuthorizedSpawnContext {
|
|
7863
|
+
readonly profile: AgentProfile$1;
|
|
7864
|
+
readonly parent: AgentProfile$1;
|
|
7865
|
+
readonly parentIdentity: NodeExecutionIdentity;
|
|
7866
|
+
readonly execution: NodeExecutionIdentity;
|
|
7867
|
+
readonly parentNodeId: string;
|
|
7868
|
+
readonly assignmentId: string;
|
|
7869
|
+
readonly task: unknown;
|
|
7870
|
+
readonly budget: Budget;
|
|
7871
|
+
readonly label: string;
|
|
7872
|
+
readonly key?: string;
|
|
7873
|
+
readonly depth: number;
|
|
7874
|
+
}
|
|
7875
|
+
/** Exact trusted context for selecting one backend-derived leaf's completion check. */
|
|
7876
|
+
type DeliverableResolutionInput = AuthorizedSpawnContext;
|
|
7480
7877
|
/** One-call supervisor: build + run a supervisor from its profile with sensible defaults; the raw `supervisorAgent` + `createSupervisor().run` seams stay available for power use. */
|
|
7481
7878
|
declare function supervise(profile: SupervisorProfile, task: unknown, opts: SuperviseOptions): Promise<SupervisedResult<unknown>>;
|
|
7482
7879
|
//#endregion
|
|
7483
7880
|
//#region src/runtime/supervise/supervisor.d.ts
|
|
7484
7881
|
/** Create a supervisor that owns one recursive agent execution tree. */
|
|
7485
7882
|
declare function createSupervisor<Task, Out>(): Supervisor<Task, Out>;
|
|
7883
|
+
/**
|
|
7884
|
+
* Mint a `RootHandle` plus its supervisor-private control. The handle is the substrate a
|
|
7885
|
+
* chat/pi-viz client attaches to (Q2): `view()` reads the live tree, `signal()` delivers
|
|
7886
|
+
* an out-of-band message, `abort()` cascades. Before `run` binds it (and after `run`
|
|
7887
|
+
* unbinds it) the handle is fail-loud: a client that talks to a handle that is not
|
|
7888
|
+
* driving a live run gets a typed error, never a silent no-op.
|
|
7889
|
+
*/
|
|
7890
|
+
declare function createRootHandle<Out>(): SteerableRootHandle<Out>;
|
|
7891
|
+
//#endregion
|
|
7892
|
+
//#region src/runtime/supervise/trace-evidence.d.ts
|
|
7893
|
+
/** Schema version for content-addressed worker tool-trace artifacts. */
|
|
7894
|
+
declare const WORKER_TOOL_TRACE_SCHEMA_VERSION: 1;
|
|
7895
|
+
/** Bytes stored under `WorkerTraceEvidence.traceRef`. */
|
|
7896
|
+
interface WorkerToolTraceArtifact {
|
|
7897
|
+
readonly schemaVersion: typeof WORKER_TOOL_TRACE_SCHEMA_VERSION;
|
|
7898
|
+
readonly spans: ReadonlyArray<ToolSpan>;
|
|
7899
|
+
}
|
|
7900
|
+
/** Collect and persist one executor's structured tool trace without changing its task outcome. */
|
|
7901
|
+
declare function captureWorkerTraceEvidence(readSource: (() => TraceSource | undefined) | undefined, blobs: ResultBlobStore, executed: boolean): Promise<WorkerTraceEvidence>;
|
|
7902
|
+
/** Rehydrate exact persisted spans through agent-eval's one bounded trace-analysis adapter. */
|
|
7903
|
+
declare function workerTraceAnalysisStore(evidence: WorkerTraceEvidence, blobs: Pick<ResultBlobStore, 'get'>): Promise<TraceAnalysisStore>;
|
|
7904
|
+
/** Validate a stored trace artifact before an analyst or replay trusts it. */
|
|
7905
|
+
declare function parseWorkerToolTraceArtifact(value: unknown, traceRef?: string): WorkerToolTraceArtifact;
|
|
7486
7906
|
//#endregion
|
|
7487
7907
|
//#region src/runtime/supervise/trajectory-recorder.d.ts
|
|
7488
7908
|
interface TrajectoryAnalysis {
|
|
@@ -7649,7 +8069,14 @@ interface AuthoredHarness {
|
|
|
7649
8069
|
/** The supervisor-authored `AgentProfile` (systemPrompt + model reach the harness via §1.5). */
|
|
7650
8070
|
profile: AgentProfile$1;
|
|
7651
8071
|
/** Which local harness CLI drives this leaf. */
|
|
7652
|
-
harness:
|
|
8072
|
+
harness: LocalHarness;
|
|
8073
|
+
/** Require measured usage from this leaf. Budgeted supervision refuses the default unmetered
|
|
8074
|
+
* local-CLI mode; set false only when the selected runner actually returns token usage. */
|
|
8075
|
+
budgetExempt?: WorktreeCliExecutorOptions['budgetExempt'];
|
|
8076
|
+
/** Run Codex through its measured, isolated JSONL path. This implies `budgetExempt: false`. */
|
|
8077
|
+
codexReproducible?: WorktreeCliExecutorOptions['codexReproducible'];
|
|
8078
|
+
/** Host paths denied to a reproducible Codex leaf. */
|
|
8079
|
+
codexReadDeniedPaths?: WorktreeCliExecutorOptions['codexReadDeniedPaths'];
|
|
7653
8080
|
/** Per-harness model/runId/baseRef overrides flow through the profile + these. */
|
|
7654
8081
|
runId?: string;
|
|
7655
8082
|
baseRef?: string;
|
|
@@ -7766,5 +8193,5 @@ interface VerifierEnvironmentOptions {
|
|
|
7766
8193
|
/** Any checkable task as an `Environment`, no tool surface required: the artifact is the worker's answer and the domain is one deployable `check` over it. */
|
|
7767
8194
|
declare function createVerifierEnvironment(opts: VerifierEnvironmentOptions): Environment;
|
|
7768
8195
|
//#endregion
|
|
7769
|
-
export { safeWorkerFile as $, HarvestCorpusOptions as $a, InboxMessage as $c, BenchmarkStrategySummary as $i, createSiblingSandboxExecutor as $l, modelAuthoredChecks as $n, Persona as $o, CheckpointCapableBox as $r, plateauLength as $s, StopDecision as $t, DELEGATION_TRACE_MAX_SPANS as $u, GitWorkspaceOptions as A, LoopDispatchOptions as Aa, DelegateArgs as Ac, defaultToolDetectors as Ad, renderCorpusToInstructions as Ai, JsonRpcResponse as Al, assessAuthoredProfile as An, Pipeline as Ao, strategyAuthorContract as Ar, LeaderboardOptions as As, DelegateOptions as At, DelegateUiAuditArgs as Au, analyzeTrace as B, localSandboxClient as Ba, ProviderSeam as Bc, pendingWaits as Bd, RegistryAnalyzeProjection as Bi, DelegateRunCtx as Bl, CheckSourceCtx as Bn, TrajectoryReportFn as Bo, McpToolDescriptor as Br, renderLeaderboardSvg as Bs, supervisorAgent as Bt, DelegationProgress as Bu, closingWorkerNote as C, defineStrategy as Ca, McpServer as Cc, BusEvent as Cd, builtinShapes as Ci, GitRunner as Cl, ReservationTicket as Cn, LoopUntil as Co, pickChampion as Cr, deterministicCompletion as Cs, DispatchStopReason as Ct, DelegateCodeConfig as Cu, UntrackedCopyStats as D, sample as Da, DELEGATE_DESCRIPTION as Dc, PublishOptions as Dd, runPersonified as Di, createWorktree as Dl, ProfileRichness as Dn, PanelJudge as Do, AuthoredStrategy as Dr, GroupOf as Ds, freeSlots as Dt, DelegateResearchArgs as Du, CopyOptions as E, runAgentic as Ea, createMcpServer as Ec, EventBus as Ed, definePersona as Ei, captureWorktreeDiff as El, AuthoredProfile as En, Panel as Eo, AuthorStrategyOptions as Er, AxisScoresOf as Es, effectiveConcurrency as Et, DelegateFeedbackResult as Eu, gitWorkspace as F, RunLoopOptions as Fa, BridgeSeam as Fc, FileSpawnJournal as Fd, pipeline as Fi, InMemoryFeedbackStore as Fl, CheckExecChannel as Fn, ScopeAnalyzeInput as Fo, dumbDriver as Fr, ScoreOf as Fs, ResolvedSupervisorProfile as Ft, DelegationFeedbackSnapshot as Fu, supervise as G, resolveMcpServerLaunch as Ga, createExecutor as Gc, McpEndpoint as Gi, coderTaskFromArgs as Gl, StructuralRolloutResult as Gn, WidenDecision as Go, Deliverable as Gr, auditIntent as Gs, finalizeBestDelivered as Gt, FeedbackRating as Gu, SuperviseOptions as H, ResolvedMcpServerLaunch as Ha, RouterToolsSeam as Hc, buildSteerContext as Hi, DetachedWinnerSelection as Hl, StructuralRolloutConfig as Hn, Verify as Ho, StdioMcpServerSpec as Hr, AuditIntentInput as Hs, serveCoordinationMcp as Ht, DelegationStatus as Hu, jjWorkspace as I, defaultSelectWinner as Ia, CliSeam as Ic, InMemoryResultBlobStore as Id, selectValidWinner as Ii, eventToSnapshot as Il, CheckOutcome as In, ScopeWidenGate as Io, naiveDriver as Ir, leaderboard as Is, SupervisorAgentDeps as It, DelegationHistoryArgs as Iu, createScope as J, inlineSandboxClient as Ja, SandboxSteeringOptions as Jc, sanitizeMcpToolSchema as Ji, DelegationExecutor as Jl, compareCheckOutcomes as Jn, WinnerStrategy as Jo, OpenSandboxRunPromptOptions as Jr, AnytimeStrategySummary as Js, PlateauOptions as Jt, ResearchSource as Ju, workerFromBackend as K, resolveSecretEnv as Ka, createExecutorRegistry as Kc, McpEnvironmentOptions as Ki, detachedSessionDelegate as Kl, VisibleCheck as Kn, WidenLineage as Ko, OpenSandboxRunBeforeStartContext as Kr, defaultAuditorInstruction as Ks, AllWorkersStalledOptions as Kt, FeedbackRefersTo as Ku, localShell as L, runAgentRounds as La, CliWorktreeBridgeSeam as Lc, InMemorySpawnJournal as Ld, verify as Li, CoderDelegate as Ll, CheckRunContext as Ln, SteerContext as Lo, LocalMcpMaterialization as Lr, pairwiseSignificance as Ls, SupervisorProfile as Lt, DelegationHistoryEntry as Lu, Workspace as M, loopCampaignDispatch as Ma, DelegateResult as Mc, DeliverableSpec as Md, flatWidenGate as Mi, McpTransport as Ml, defaultProfileRichnessThresholds as Mn, RenderCorpusToInstructions as Mo, DumbDriverOptions as Mr, PairwiseOptions as Ms, delegate as Mt, DelegateUiAuditResult as Mu, WorkspaceCommit as N, loopDispatch as Na, createDelegateHandler as Nc, gateOnDeliverable as Nd, loopUntil as Ni, FeedbackEvent as Nl, profileRichnessFinding as Nn, RenderCorpusToInstructionsOptions as No, NaiveDriverOptions as Nr, PairwiseVerdict as Ns, CoordinationBinding as Nt, DelegateUiAuditRoute as Nu, copyUntrackedIntoClone as O, sampleThenRefine as Oa, DELEGATE_INPUT_SCHEMA as Oc, createEventBus as Od, FileCorpus as Oi, removeWorktree as Ol, ProfileRichnessThresholds as On, PanelSpec as Oo, assertStrategyContract as Or, Interval as Os, queueOf as Ot, DelegateResearchConfig as Ou, WorkspaceRun as P, RunAgentRoundsOptions as Pa, validateDelegateArgs as Pc, FileResultBlobStore as Pd, panel as Pi, FeedbackStore as Pl, supervisorInstructions as Pn, ScopeAnalyst as Po, SteeringDecision as Pr, ProfileKeyOf as Ps, DriveHarness as Pt, DelegationError as Pu, readWorkerSteerRequests as Q, inProcessSandboxClient as Qa, Inbox as Qc, BenchmarkReport as Qi, createFleetWorkspaceExecutor as Ql, filterAuthoredAsserts as Qn, Outcome as Qo, openSandboxRun as Qr, bestSoFar as Qs, ProgressView as Qt, DELEGATION_TRACE_MAX_BYTES as Qu, runInWorkspace as R, runLoop as Ra, CliWorktreeSeam as Rc, contentAddress as Rd, widen as Ri, CoderReview as Rl, CheckRunner as Rn, TrajectoryNode as Ro, MaterializeLocalMcpOptions as Rr, renderLeaderboardHtml as Rs, assertCoordinationBinding as Rt, DelegationHistoryResult as Ru, WorkerEvidenceInput as S, breadthStrategy as Sa, createCoordinationTools as Sc, CoderOutput as Sd, trajectoryReport as Si, DiffResult as Sl, ReservationRejection as Sn, FlatWidenGate as So, discriminatingMeans as Sr, completionAuthorizes as Ss, DispatchReport as St, DelegateCodeArgs as Su, settledWorkerOut as T, refine as Ta, createInProcessTransport as Tc, BusStats as Td, registerShape as Ti, WorktreeHandle as Tl, spendFromUsageEvents as Tn, LoopUntilState as To, selectChampion as Tr, stopSentinel as Ts, RollingDispatchOptions as Tt, DelegateFeedbackArgs as Tu, SuperviseRegistry as U, envKeyProvider as Ua, SandboxSeam as Uc, createScopeAnalyst as Ui, SettleDetachedCoderTurnOptions as Ul, StructuralRolloutMessage as Un, VerifySpec as Uo, connectStdioMcp as Ur, AuditIntentOptions as Us, DriverAgentOptions as Ut, DelegationStatusArgs as Uu, createSupervisor as V, KeyProvider as Va, RouterSeam as Vc, replaySpawnTree as Vd, assertTraceDerivedFindings as Vi, DetachedSessionDelegateOptions as Vl, RepairStop as Vn, TrajectoryReportOptions as Vo, StdioMcpConnection as Vr, renderPairwiseMarkdown as Vs, CoordinationMcpHandle as Vt, DelegationResultPayload as Vu, SuperviseRegistryTable as W, mcpSecretEnvMetadataKey as Wa, cliWorktreeExecutor as Wc, registryScopeAnalyst as Wi, UiAuditorDelegate as Wl, StructuralRolloutPolicy as Wn, Widen as Wo, materializeLocalMcp as Wr, IntentAudit as Ws, driverAgent as Wt, DelegationStatusResult as Wu, WorkerSteerRequest as X, InProcessPromptCtx as Xa, SteerableSandboxSession as Xc, BenchmarkConfig as Xi, FleetWorkspaceExecutorOptions as Xl, defaultExtractCandidate as Xn, DefinePersonaInput as Xo, SandboxRunAbortError as Xr, anytimeReport as Xs, ProgressTracker as Xt, UiAuditorDelegationOutput as Xu, settledToIteration as Y, InProcessOnPrompt as Ya, SteerableSandboxArgs as Yc, BenchmarkCell as Yi, FleetHandle as Yl, composeCheckSources as Yn, DefinePersona as Yo, SandboxRun as Yr, AnytimeTaskCurve as Ys, ProgressSample as Yt, UiAuditLensFilter as Yu, legacySupervisorRunDir as Z, InProcessSandboxClientOptions as Za, createSteerableSandboxSession as Zc, BenchmarkLift as Zi, SiblingSandboxExecutorOptions as Zl, defaultStructuralRolloutPolicy as Zn, LoopShape as Zo, TurnResult as Zr, areaUnderCurve as Zs, ProgressTrackerOptions as Zt, CappedDelegationTrace as Zu, WorktreeFanoutOptions as _, StrategyMessage as _a, QuestionPolicy as _c, JudgeError as _d, resolveSandboxClient as _i, WorktreeCommandResult as _l, CoordinationLog as _n, EqualKVerdict as _o, EvolutionCandidate as _r, defineLeaderboard as _s, SupervisorSpanOutcome as _t, DelegationTaskQueue as _u, SandboxInstance$1 as a, AgenticRunResult as aa, AnalystFindingEvent as ac, composeLoopTraceEmitters as ad, SandboxToolPartState as ai, piSeamKey as al, noProgressFor as an, ObserveOptions as ao, visibleCheckScore as ar, ShapeContext as as, InMemoryRunContext as at, RunDetachedTurnOptions as au, NOTE_MAX_CHARS as b, SurfaceScore as ba, SettledWorker as bc, RuntimeRunStateError as bd, promotionGate as bi, CreateWorktreeOptions as bl, BudgetPool as bn, FanoutSynthesis as bo, ReproductionCheck as br, CompletionPolicy as bs, assertModelAllowed as bt, SubmitOutput as bu, VerifierEnvironmentOptions as c, AgenticTool as ca, CoordinationTools as cc, DelegationStateCorruptError as cd, mapSandboxEvent as ci, PI_MCP_CONFIG_FLAG as cl, DeliveredOutput as cn, renderReport as co, CollectedAgentTurn as cr, LeaderboardBenchScore as cs, createFileRunContext as ct, formatDetachedSessionRef as cu, SuperviseSurfaceResult as d, RunAgenticOptions as da, DownMessageEvent as dc, FileDelegationStoreOptions as dd, CriuCapableClient as di, PiMcpPreparation as dl, SupervisorFinalizer as dn, Corpus as do, streamAgentTurn as dr, LeaderboardFlagSpec as ds, patchDelivered as dt, DelegationArgs as du, BenchmarkTaskRow as ea, renderAnytimeTable as ec, DelegationTraceCaps as ed, ForkCapableBox as ei, createInbox as el, StopRule as en, HarvestFailure as eo, officialChecksFromMeta as er, PersonaContext as es, supervisorRunDir as et, DetachedSessionRefParts as eu, SurfaceWorkerConfig as f, ShotPersona as fa, MakeWorkerAgent as fc, InMemoryDelegationStore as fd, SandboxCapabilities as fi, PiMcpReceipt as fl, bestDelivered as fn, CorpusFilter as fo, ChampionPick as fr, LeaderboardIterationInfo as fs, WorktreeCliExecutorOptions as ft, DelegationRecord as fu, AuthoredHarness as g, StrategyCtx as ga, QuestionOption as gc, ConfigError as gd, ResolveSandboxClientOptions as gi, WorktreeCheckRunner as gl, runTree as gn, EqualKOnCostOptions as go, EvolutionBandInfo as gr, LeaderboardSpec as gs, SupervisorSpanOptions as gt, DelegationRunContext as gu, superviseSurface as h, StrategyArtifacts as ha, QuestionLevel as hc, BackendTransportError as hd, acquireSandbox as hi, preparePiMcp as hl, runFinalizer as hn, EqualKOnCost as ho, EvolutionAuthor as hr, LeaderboardScore as hs, SupervisorSpanAttributes as ht, DelegationResumeTick as hu, SandboxEvent$1 as i, AgenticOptions as ia, createWaterfallCollector as ic, capDelegationTrace as id, createSandboxLineage as ii, piExecutor as il, createProgressTracker as in, ObserveInput as io, structuralRollout as ir, ShapeBudget as is, writeWorkerSteer as it, DriveTurnTick as iu, Shell as j, LoopOptionsForDispatch as ja, DelegateHandlerOptions as jc, watchTrace as jd, fanout as ji, McpToolDescriptor$1 as jl, authoredWorker as jn, PipelineStage as jo, ApplyContinuation as jr, LeaderboardRow as js, defaultDelegateBudget as jt, DelegateUiAuditConfig as ju, withUntrackedArtifacts as k, LoopCampaignDispatchOptions as ka, DELEGATE_TOOL_NAME as kc, WatchTraceOptions as kd, InMemoryCorpus as ki, JsonRpcMessage as kl, asAuthoredProfile as kn, PanelVerdict as ko, authorStrategy as kr, Leaderboard as ks, rollingDispatch as kt, DelegateResearchResult as ku, createVerifierEnvironment as l, ArtifactHandle as la, CoordinationToolsOptions as lc, DelegationStore as ld, mapSandboxToolEvent as li, PiMcpMount as ll, FinalizeContext as ln, AssertTraceDerivedFindings as lo, StreamAgentTurnOptions as lr, LeaderboardBenchTask as ls, createInMemoryRunContext as lt, parseDetachedSessionRef as lu, failuresAnalyst as m, Strategy as ma, QuestionDecision as mc, AgentEvalErrorCode as md, AcquireOptions as mi, piMcpAdapterAvailable as ml, pickBestDelivered as mn, EqualKArm as mo, EvolutionArchiveNode as mr, LeaderboardScenario as ms, createWorktreeCliExecutor as mt, DelegationResumeDriver as mu, AnalystFinding$1 as n, printBenchmarkReport as na, WaterfallReport as nc, DelegationTraceSpan as nd, SandboxLineageHandle as ni, PiExecutorOutput as nl, allWorkersStalled as nn, harvestCorpus as no, sandboxCheckRunner as nr, RunPersonified as ns, workerInboxFile as nt, DetachedTurnResumeDriverOptions as nu, computeFindingId$1 as o, AgenticSurface as oa, AnalystRegistry as oc, createDelegationTraceCollector as od, createSandboxToolPartState as oi, PI_MCP_ADAPTER as ol, plateau as on, defaultAnalystInstruction as oo, AgentTurnBackend as or, ShapeRegistry as os, InMemoryRunContextOptions as ot, createDetachedTurnResumeDriver as ou, SurfaceWorkerOut as p, ShotSpec as pa, Question as pc, AgentEvalError$1 as pd, probeSandboxCapabilities as pi, buildPiMcpServers as pl, collectDelivered as pn, CorpusRecord as po, ChampionPolicy as pr, LeaderboardRunContext as ps, WorktreePatchArtifact as pt, DelegationResumeContext as pu, ScopeArgs as q, secretEnvOfMcpServer as qa, DEFAULT_SANDBOX_STEERING_MAX_TURNS as qc, createMcpEnvironment as qi, settleDetachedCoderTurn as ql, canDisplace as qn, WidenSpec as qo, OpenSandboxRunOptions as qr, AnytimeReport as qs, NoProgressForOptions as qt, ResearchOutputShape as qu, CreateSandboxOptions$1 as r, runBenchmark as ra, WaterfallSpan as rc, buildDelegationTraceSpans as rd, SessionCapableBox as ri, PiSeam as rl, anyOf as rn, Observation as ro, selectBestIndex as rr, RunPersonifiedOptions as rs, workerInboxFileFromEventDir as rt, DriveTurnCapableBox as ru, makeFinding$1 as s, AgenticTask as sa, CoordinationEvent as sc, DelegationPersistenceError as sd, extractLlmCallEvent as si, PI_MCP_ADAPTER_ENV as sl, sampleFromSettled as sn, observe as so, AgentTurnUsage as sr, DefinedLeaderboard as ss, RunContext as st, detachedTurnEvents as su, AgentProfile$2 as t, Environment as ta, WaterfallCollector as tc, DelegationTraceCollector as td, SandboxLineage as ti, PI_RUNTIME as tl, allOf as tn, HarvestReport as to, resolveEntrySymbol as tr, PersonaExecutors as ts, supervisorRunsRoot as tt, DetachedTurn as tu, SuperviseSurfaceOptions as u, CorpusReadbackOptions as ua, DEFAULT_AWAIT_EVENT_TIMEOUT_MS as uc, FileDelegationStore as ud, sumSandboxUsage as ui, PiMcpMountOptions as ul, FinalizerSettled as un, CombinatorShape as uo, collectAgentTurn as ur, LeaderboardBenchmarkAdapter as us, PatchDeliverableOptions as ut, runDetachedTurn as uu, worktreeFanout as v, StrategyResult as va, QuestionRecord as vc, NotFoundError as vd, PromotionGateOptions as vi, WorktreeHarnessResult as vl, FileCoordinationLog as vn, Fanout as vo, EvolutionGeneration as vr, CompletionAnalyst as vs, SupervisorSpanRecorder as vt, DelegationTaskQueueOptions as vu, composeWorkerEvidence as w, depthStrategy as wa, McpServerOptions as wc, BusRecord as wd, createShapeRegistry as wi, RemoveWorktreeOptions as wl, createBudgetPool as wn, LoopUntilSpec as wo, runStrategyEvolution as wr, sentinelCompletion as ws, DispatchUnit as wt, DelegateCodeResult as wu, VERIFY_TAIL_CHARS as x, adaptiveRefine as xa, WorkerWatchOptions as xc, ValidationError as xd, equalKOnCost as xi, DiffOptions as xl, BudgetReadout as xn, FanoutWinnerSelector as xo, StrategyEvolutionConfig as xr, CompletionVerdict as xs, ConcurrencyCaps as xt, hashIdempotencyInput as xu, EVIDENCE_MAX_CHARS as y, StrategyShotResult as ya, QuestionUrgency as yc, PlannerError as yd, PromotionVerdict as yi, WorktreeProfileMaterializationReceipt as yl, PriorCoordination as yn, FanoutOptions as yo, EvolutionReport as yr, CompletionEvidence as ys, createSupervisorSpanRecorder as yt, SubmitInput as yu, TrajectoryAnalysis as z, LocalSandboxClientOptions as za, ExecutorConfig as zc, materializeTreeView as zd, CreateScopeAnalystOptions as zi, CoderReviewer as zl, CheckSource as zn, TrajectoryReport as zo, McpSpawnFault as zr, renderLeaderboardMarkdown as zs, resolveSupervisorProfile as zt, DelegationProfile as zu };
|
|
7770
|
-
//# sourceMappingURL=index-
|
|
8196
|
+
export { SuperviseRegistry as $, sample as $a, WorkerSpawnContext as $c, FileResultBlobStore as $d, runPersonified as $i, FeedbackStore as $l, ProfileRichnessThresholds as $n, PanelJudge as $o, AuthoredStrategy as $r, GroupOf as $s, DispatchStopReason as $t, DelegationError as $u, GitWorkspaceOptions as A, AgenticOptions as Aa, createWaterfallCollector as Ac, FileDelegationStoreOptions as Ad, promptOnlyProfileMaterialization as Af, createSandboxLineage as Ai, SteerableSandboxSession as Al, DeliveredOutput as An, ObserveInput as Ao, structuralRollout as Ar, ShapeBudget as As, workerControlLogFile as At, DelegationArgs as Au, analyzeTrace as B, Strategy as Ba, DownMessageAuthorizationInput as Bc, ValidationError as Bd, AcquireOptions as Bi, DiffOptions as Bl, CoordinationLog as Bn, EqualKArm as Bo, EvolutionArchiveNode as Br, LeaderboardScenario as Bs, patchDelivered as Bt, hashIdempotencyInput as Bu, closingWorkerNote as C, BenchmarkLift as Ca, areaUnderCurve as Cc, capDelegationTrace as Cd, assertProfileMaterialization as Cf, TurnResult as Ci, SandboxSeam as Cl, allOf as Cn, InProcessSandboxClientOptions as Co, defaultStructuralRolloutPolicy as Cr, LoopShape as Cs, legacySupervisorRunDir as Ct, DriveTurnTick as Cu, UntrackedCopyStats as D, Environment as Da, WaterfallCollector as Dc, DelegationStateCorruptError as Dd, profileMaterializationAxes as Df, SandboxLineage as Di, DEFAULT_SANDBOX_STEERING_MAX_TURNS as Dl, noProgressFor as Dn, HarvestReport as Do, resolveEntrySymbol as Dr, PersonaExecutors as Ds, supervisorRunDir as Dt, formatDetachedSessionRef as Du, CopyOptions as E, BenchmarkTaskRow as Ea, renderAnytimeTable as Ec, DelegationPersistenceError as Ed, fullProfileMaterialization as Ef, ForkCapableBox as Ei, createExecutorRegistry as El, createProgressTracker as En, HarvestFailure as Eo, officialChecksFromMeta as Er, PersonaContext as Es, safeWorkerFile as Et, detachedTurnEvents as Eu, gitWorkspace as F, ArtifactHandle as Fa, ContinuationInstruction as Fc, ConfigError as Fd, worktreeCliProfileMaterialization as Ff, mapSandboxToolEvent as Fi, WorktreeCheckRunner as Fl, collectDelivered as Fn, AssertTraceDerivedFindings as Fo, StreamAgentTurnOptions as Fr, LeaderboardBenchTask as Fs, InMemoryRunContextOptions as Ft, DelegationRunContext as Fu, workerTraceAnalysisStore as G, StrategyShotResult as Ga, Question as Gc, EventBus as Gd, PromotionVerdict as Gi, captureWorktreeDiff as Gl, BudgetPoolRestore as Gn, FanoutOptions as Go, EvolutionReport as Gr, CompletionEvidence as Gs, SupervisorSpanOptions as Gt, DelegateFeedbackResult as Gu, WorkerToolTraceArtifact as H, StrategyCtx as Ha, DownMessageDeliveryOutcome as Hc, BusEvent as Hd, ResolveSandboxClientOptions as Hi, GitRunner as Hl, FileCoordinationLog as Hn, EqualKOnCostOptions as Ho, EvolutionBandInfo as Hr, LeaderboardSpec as Hs, WorktreePatchArtifact as Ht, DelegateCodeConfig as Hu, jjWorkspace as I, CorpusReadbackOptions as Ia, CoordinationEvent as Ic, JudgeError as Id, sumSandboxUsage as Ii, WorktreeCommandResult as Il, pickBestDelivered as In, CombinatorShape as Io, collectAgentTurn as Ir, LeaderboardBenchmarkAdapter as Is, RunContext as It, DelegationTaskQueue as Iu, AuthorizedSpawn as J, breadthStrategy as Ja, QuestionOption as Jc, WatchTraceOptions as Jd, trajectoryReport as Ji, JsonRpcMessage as Jl, ReservationTicket as Jn, FlatWidenGate as Jo, discriminatingMeans as Jr, completionAuthorizes as Js, createSupervisorSpanRecorder as Jt, DelegateResearchResult as Ju, createRootHandle as K, SurfaceScore as Ka, QuestionDecision as Kc, PublishOptions as Kd, promotionGate as Ki, createWorktree as Kl, BudgetReadout as Kn, FanoutSynthesis as Ko, ReproductionCheck as Kr, CompletionPolicy as Ks, SupervisorSpanOutcome as Kt, DelegateResearchArgs as Ku, localShell as L, RunAgenticOptions as La, CoordinationTools as Lc, NotFoundError as Ld, CriuCapableClient as Li, WorktreeHarnessResult as Ll, runFinalizer as Ln, Corpus as Lo, streamAgentTurn as Lr, LeaderboardFlagSpec as Ls, createFileRunContext as Lt, DelegationTaskQueueOptions as Lu, Workspace as M, AgenticSurface as Ma, AnalystRegistry as Mc, AgentEvalError$1 as Md, renderProfileMaterializationIssues as Mf, createSandboxToolPartState as Mi, Inbox as Ml, FinalizerSettled as Mn, defaultAnalystInstruction as Mo, AgentTurnBackend as Mr, ShapeRegistry as Ms, workerInboxFileFromEventDir as Mt, DelegationResumeContext as Mu, WorkspaceCommit as N, AgenticTask as Na, AuthorizeDownMessage as Nc, AgentEvalErrorCode as Nd, sandboxActProfileMaterialization as Nf, extractLlmCallEvent as Ni, InboxMessage as Nl, SupervisorFinalizer as Nn, observe as No, AgentTurnUsage as Nr, DefinedLeaderboard as Ns, writeWorkerSteer as Nt, DelegationResumeDriver as Nu, copyUntrackedIntoClone as O, printBenchmarkReport as Oa, WaterfallReport as Oc, DelegationStore as Od, promptControlProfileMaterialization as Of, SandboxLineageHandle as Oi, SandboxSteeringOptions as Ol, plateau as On, harvestCorpus as Oo, sandboxCheckRunner as Or, RunPersonified as Os, supervisorRunsRoot as Ot, parseDetachedSessionRef as Ou, WorkspaceRun as P, AgenticTool as Pa, AuthorizedDownMessage as Pc, BackendTransportError as Pd, validateProfileMaterialization as Pf, mapSandboxEvent as Pi, createInbox as Pl, bestDelivered as Pn, renderReport as Po, CollectedAgentTurn as Pr, LeaderboardBenchScore as Ps, InMemoryRunContext as Pt, DelegationResumeTick as Pu, SuperviseOptions as Q, runAgentic as Qa, SettledWorker as Qc, gateOnDeliverable as Qd, definePersona as Qi, FeedbackEvent as Ql, ProfileRichness as Qn, Panel as Qo, AuthorStrategyOptions as Qr, AxisScoresOf as Qs, DispatchReport as Qt, DelegateUiAuditRoute as Qu, runInWorkspace as R, ShotPersona as Ra, CoordinationToolsOptions as Rc, PlannerError as Rd, SandboxCapabilities as Ri, WorktreeProfileMaterializationReceipt as Rl, runTree as Rn, CorpusFilter as Ro, ChampionPick as Rr, LeaderboardIterationInfo as Rs, createInMemoryRunContext as Rt, SubmitInput as Ru, WorkerEvidenceInput as S, BenchmarkConfig as Sa, anytimeReport as Sc, buildDelegationTraceSpans as Sd, ValidateProfileMaterializationOptions as Sf, SandboxRunAbortError as Si, RouterToolsSeam as Sl, StopRule as Sn, InProcessPromptCtx as So, defaultExtractCandidate as Sr, DefinePersonaInput as Ss, WorkerSteerRequest as St, DriveTurnCapableBox as Su, settledWorkerOut as T, BenchmarkStrategySummary as Ta, plateauLength as Tc, createDelegationTraceCollector as Td, defineProfileMaterializationContract as Tf, CheckpointCapableBox as Ti, createExecutor as Tl, anyOf as Tn, HarvestCorpusOptions as To, modelAuthoredChecks as Tr, Persona as Ts, readWorkerSteerRequests as Tt, createDetachedTurnResumeDriver as Tu, captureWorkerTraceEvidence as U, StrategyMessage as Ua, DownMessageEvent as Uc, BusRecord as Ud, resolveSandboxClient as Ui, RemoveWorktreeOptions as Ul, PriorCoordination as Un, EqualKVerdict as Uo, EvolutionCandidate as Ur, defineLeaderboard as Us, createWorktreeCliExecutor as Ut, DelegateCodeResult as Uu, WORKER_TOOL_TRACE_SCHEMA_VERSION as V, StrategyArtifacts as Va, DownMessageDeliveryAttempt as Vc, CoderOutput as Vd, acquireSandbox as Vi, DiffResult as Vl, CoordinationOwnerId as Vn, EqualKOnCost as Vo, EvolutionAuthor as Vr, LeaderboardScore as Vs, WorktreeCliExecutorOptions as Vt, DelegateCodeArgs as Vu, parseWorkerToolTraceArtifact as W, StrategyResult as Wa, MakeWorkerAgent as Wc, BusStats as Wd, PromotionGateOptions as Wi, WorktreeHandle as Wl, BudgetPool as Wn, Fanout as Wo, EvolutionGeneration as Wr, CompletionAnalyst as Ws, SupervisorSpanAttributes as Wt, DelegateFeedbackArgs as Wu, DEFAULT_AUTHORED_PROFILE_SECURITY_POLICY as X, depthStrategy as Xa, QuestionRecord as Xc, watchTrace as Xd, createShapeRegistry as Xi, McpToolDescriptor$1 as Xl, spendFromUsageEvents as Xn, LoopUntilSpec as Xo, runStrategyEvolution as Xr, sentinelCompletion as Xs, assertProfileModelsAllowed as Xt, DelegateUiAuditConfig as Xu, AuthorizedSpawnContext as Y, defineStrategy as Ya, QuestionPolicy as Yc, defaultToolDetectors as Yd, builtinShapes as Yi, JsonRpcResponse as Yl, createBudgetPool as Yn, LoopUntil as Yo, pickChampion as Yr, deterministicCompletion as Ys, assertModelAllowed as Yt, DelegateUiAuditArgs as Yu, DeliverableResolutionInput as Z, refine as Za, QuestionUrgency as Zc, DeliverableSpec as Zd, registerShape as Zi, McpTransport as Zl, AuthoredProfile as Zn, LoopUntilState as Zo, selectChampion as Zr, stopSentinel as Zs, ConcurrencyCaps as Zt, DelegateUiAuditResult as Zu, WorktreeFanoutOptions as _, McpEndpoint as _a, auditIntent as _c, DELEGATION_TRACE_MAX_BYTES as _d, CanonicalAgentProfileMaterializationAxis as _f, Deliverable as _i, CliWorktreeBridgeSeam as _l, ProgressSample as _n, resolveMcpServerLaunch as _o, StructuralRolloutResult as _r, WidenDecision as _s, resolveSupervisorProfile as _t, createFleetWorkspaceExecutor as _u, SandboxInstance$1 as a, loopUntil as aa, PairwiseVerdict as ac, DelegationProgress as ad, SpawnForestInDoubtNode as af, NaiveDriverOptions as ai, createMcpServer as al, rollingDispatch as an, loopDispatch as ao, profileRichnessFinding as ar, RenderCorpusToInstructionsOptions as as, DriveHarnessOwnerContext as at, DelegateRunCtx as au, NOTE_MAX_CHARS as b, sanitizeMcpToolSchema as ba, AnytimeStrategySummary as bc, DelegationTraceCollector as bd, ProfileMaterializationContract as bf, OpenSandboxRunPromptOptions as bi, ProviderSeam as bl, ProgressView as bn, inlineSandboxClient as bo, compareCheckOutcomes as br, WinnerStrategy as bs, createScope as bt, DetachedTurn as bu, VerifierEnvironmentOptions as c, selectValidWinner as ca, leaderboard as cc, DelegationStatusArgs as cd, SpawnForestTree as cf, naiveDriver as ci, DELEGATE_TOOL_NAME as cl, delegate as cn, defaultSelectWinner as co, CheckOutcome as cr, ScopeWidenGate as cs, ResolveSupervisorTools as ct, SettleDetachedCoderTurnOptions as cu, SuperviseSurfaceResult as d, CreateScopeAnalystOptions as da, renderLeaderboardMarkdown as dc, FeedbackRefersTo as dd, pendingWaits as df, McpSpawnFault as di, DelegateHandlerOptions as dl, DriverAgentOptions as dn, LocalSandboxClientOptions as do, CheckSource as dr, TrajectoryReport as ds, SupervisorNodeContext as dt, detachedSessionDelegate as du, FileCorpus as ea, Interval as ec, DelegationFeedbackSnapshot as ed, FileSpawnJournal as ef, assertStrategyContract as ei, WorkerWatchOptions as el, DispatchUnit as en, sampleThenRefine as eo, asAuthoredProfile as er, PanelSpec as es, SuperviseRegistryTable as et, InMemoryFeedbackStore as eu, SurfaceWorkerConfig as f, RegistryAnalyzeProjection as fa, renderLeaderboardSvg as fc, ResearchOutputShape as fd, replaySpawnTree as ff, McpToolDescriptor as fi, DelegateResult as fl, driverAgent as fn, localSandboxClient as fo, CheckSourceCtx as fr, TrajectoryReportFn as fs, SupervisorNodeContextSeed as ft, settleDetachedCoderTurn as fu, AuthoredHarness as g, registryScopeAnalyst as ga, IntentAudit as gc, CappedDelegationTrace as gd, AssertProfileMaterializationOptions as gf, materializeLocalMcp as gi, CliSeam as gl, PlateauOptions as gn, mcpSecretEnvMetadataKey as go, StructuralRolloutPolicy as gr, Widen as gs, assertCoordinationBinding as gt, SiblingSandboxExecutorOptions as gu, superviseSurface as h, createScopeAnalyst as ha, AuditIntentOptions as hc, UiAuditorDelegationOutput as hd, AgentProfileMaterializationAxis as hf, connectStdioMcp as hi, BridgeSeam as hl, NoProgressForOptions as hn, envKeyProvider as ho, StructuralRolloutMessage as hr, VerifySpec as hs, SupervisorToolInvocationContext as ht, FleetWorkspaceExecutorOptions as hu, SandboxEvent$1 as i, flatWidenGate as ia, PairwiseOptions as ic, DelegationProfile as id, SpawnForestEvent as if, DumbDriverOptions as ii, createInProcessTransport as il, queueOf as in, loopCampaignDispatch as io, defaultProfileRichnessThresholds as ir, RenderCorpusToInstructions as is, DriveHarness as it, CoderReviewer as iu, Shell as j, AgenticRunResult as ja, AnalystFindingEvent as jc, InMemoryDelegationStore as jd, promptResourceProfileMaterialization as jf, SandboxToolPartState as ji, createSteerableSandboxSession as jl, FinalizeContext as jn, ObserveOptions as jo, visibleCheckScore as jr, ShapeContext as js, workerInboxFile as jt, DelegationRecord as ju, withUntrackedArtifacts as k, runBenchmark as ka, WaterfallSpan as kc, FileDelegationStore as kd, promptModelProfileMaterialization as kf, SessionCapableBox as ki, SteerableSandboxArgs as kl, sampleFromSettled as kn, Observation as ko, selectBestIndex as kr, RunPersonifiedOptions as ks, supervisorWorkersDir as kt, runDetachedTurn as ku, createVerifierEnvironment as l, verify as la, pairwiseSignificance as lc, DelegationStatusResult as ld, loadSpawnForest as lf, LocalMcpMaterialization as li, DelegateArgs as ll, CoordinationMcpHandle as ln, runAgentRounds as lo, CheckRunContext as lr, SteerContext as ls, ResolvedSupervisorProfile as lt, UiAuditorDelegate as lu, failuresAnalyst as m, buildSteerContext as ma, AuditIntentInput as mc, UiAuditLensFilter as md, AGENT_PROFILE_MATERIALIZATION_AXES as mf, StdioMcpServerSpec as mi, validateDelegateArgs as ml, AllWorkersStalledOptions as mn, ResolvedMcpServerLaunch as mo, StructuralRolloutConfig as mr, Verify as ms, SupervisorToolDescriptor as mt, FleetHandle as mu, AnalystFinding$1 as n, renderCorpusToInstructions as na, LeaderboardOptions as nc, DelegationHistoryEntry as nd, InMemorySpawnJournal as nf, strategyAuthorContract as ni, McpServer as nl, effectiveConcurrency as nn, LoopDispatchOptions as no, authoredWorker as nr, Pipeline as ns, workerFromBackend as nt, CoderDelegate as nu, computeFindingId$1 as o, panel as oa, ProfileKeyOf as oc, DelegationResultPayload as od, SpawnForestMissingTree as of, SteeringDecision as oi, DELEGATE_DESCRIPTION as ol, DelegateOptions as on, RunAgentRoundsOptions as oo, supervisorInstructions as or, ScopeAnalyst as os, ObserveSupervisorNodeEvent as ot, DetachedSessionDelegateOptions as ou, SurfaceWorkerOut as p, assertTraceDerivedFindings as pa, renderPairwiseMarkdown as pc, ResearchSource as pd, contentAddress as pf, StdioMcpConnection as pi, createDelegateHandler as pl, finalizeBestDelivered as pn, KeyProvider as po, RepairStop as pr, TrajectoryReportOptions as ps, SupervisorProfile as pt, DelegationExecutor as pu, createSupervisor as q, adaptiveRefine as qa, QuestionLevel as qc, createEventBus as qd, equalKOnCost as qi, removeWorktree as ql, ReservationRejection as qn, FanoutWinnerSelector as qo, StrategyEvolutionConfig as qr, CompletionVerdict as qs, SupervisorSpanRecorder as qt, DelegateResearchConfig as qu, CreateSandboxOptions$1 as r, fanout as ra, LeaderboardRow as rc, DelegationHistoryResult as rd, SpawnForest as rf, ApplyContinuation as ri, McpServerOptions as rl, freeSlots as rn, LoopOptionsForDispatch as ro, canonicalizeAuthoredProfile as rr, PipelineStage as rs, CoordinationBinding as rt, CoderReview as ru, makeFinding$1 as s, pipeline as sa, ScoreOf as sc, DelegationStatus as sd, SpawnForestNode as sf, dumbDriver as si, DELEGATE_INPUT_SCHEMA as sl, defaultDelegateBudget as sn, RunLoopOptions as so, CheckExecChannel as sr, ScopeAnalyzeInput as ss, ResolveDriveHarness as st, DetachedWinnerSelection as su, AgentProfile$2 as t, InMemoryCorpus as ta, Leaderboard as tc, DelegationHistoryArgs as td, InMemoryResultBlobStore as tf, authorStrategy as ti, createCoordinationTools as tl, RollingDispatchOptions as tn, LoopCampaignDispatchOptions as to, assessAuthoredProfile as tr, PanelVerdict as ts, supervise as tt, eventToSnapshot as tu, SuperviseSurfaceOptions as u, widen as ua, renderLeaderboardHtml as uc, FeedbackRating as ud, materializeTreeView as uf, MaterializeLocalMcpOptions as ui, DelegateError as ul, serveCoordinationMcp as un, runLoop as uo, CheckRunner as ur, TrajectoryNode as us, SupervisorAgentDeps as ut, coderTaskFromArgs as uu, worktreeFanout as v, McpEnvironmentOptions as va, defaultAuditorInstruction as vc, DELEGATION_TRACE_MAX_SPANS as vd, DefineProfileMaterializationContractOptions as vf, OpenSandboxRunBeforeStartContext as vi, CliWorktreeSeam as vl, ProgressTracker as vn, resolveSecretEnv as vo, VisibleCheck as vr, WidenLineage as vs, supervisorAgent as vt, createSiblingSandboxExecutor as vu, composeWorkerEvidence as w, BenchmarkReport as wa, bestSoFar as wc, composeLoopTraceEmitters as wd, controlProfileMaterialization as wf, openSandboxRun as wi, cliWorktreeExecutor as wl, allWorkersStalled as wn, inProcessSandboxClient as wo, filterAuthoredAsserts as wr, Outcome as ws, legacySupervisorRunsRoot as wt, RunDetachedTurnOptions as wu, VERIFY_TAIL_CHARS as x, BenchmarkCell as xa, AnytimeTaskCurve as xc, DelegationTraceSpan as xd, ProfileMaterializationIssue as xf, SandboxRun as xi, RouterSeam as xl, StopDecision as xn, InProcessOnPrompt as xo, composeCheckSources as xr, DefinePersona as xs, settledToIteration as xt, DetachedTurnResumeDriverOptions as xu, EVIDENCE_MAX_CHARS as y, createMcpEnvironment as ya, AnytimeReport as yc, DelegationTraceCaps as yd, KnownAgentProfileMaterializationAxis as yf, OpenSandboxRunOptions as yi, ExecutorConfig as yl, ProgressTrackerOptions as yn, secretEnvOfMcpServer as yo, canDisplace as yr, WidenSpec as ys, ScopeArgs as yt, DetachedSessionRefParts as yu, TrajectoryAnalysis as z, ShotSpec as za, DEFAULT_AWAIT_EVENT_TIMEOUT_MS as zc, RuntimeRunStateError as zd, probeSandboxCapabilities as zi, CreateWorktreeOptions as zl, CoordinationDeliveryEvidence as zn, CorpusRecord as zo, ChampionPolicy as zr, LeaderboardRunContext as zs, PatchDeliverableOptions as zt, SubmitOutput as zu };
|
|
8197
|
+
//# sourceMappingURL=index-CGADWaa_.d.ts.map
|