@tangle-network/agent-runtime 0.306.2 → 0.308.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/dist/{activation-wZ-8vOjV.d.ts → activation-5Usfsfzr.d.ts} +3 -3
- package/dist/{activation-kaJzXM7Y.js → activation-DbnacUhI.js} +2 -2
- package/dist/{activation-kaJzXM7Y.js.map → activation-DbnacUhI.js.map} +1 -1
- package/dist/agent.d.ts +2 -2
- package/dist/agent.js +2 -2
- package/dist/{coordination-driver-Y2gf8pBT.js → coordination-driver-BYIjecHz.js} +2 -2
- package/dist/{coordination-driver-Y2gf8pBT.js.map → coordination-driver-BYIjecHz.js.map} +1 -1
- package/dist/{delegate-B7bwEFQl.js → delegate-KCK7WdZv.js} +2 -2
- package/dist/{delegate-B7bwEFQl.js.map → delegate-KCK7WdZv.js.map} +1 -1
- package/dist/durable.d.ts +2 -2
- package/dist/durable.js +55 -4
- package/dist/durable.js.map +1 -1
- package/dist/{graph-VUwNFYff.js → graph-BUu0KQVW.js} +5 -4
- package/dist/graph-BUu0KQVW.js.map +1 -0
- package/dist/{improvement-cycle-DuIGusyA.js → improvement-cycle-BylwWCcl.js} +7 -3
- package/dist/{improvement-cycle-DuIGusyA.js.map → improvement-cycle-BylwWCcl.js.map} +1 -1
- package/dist/{index-DflDZq_I.d.ts → index-EibbsKsH.d.ts} +72 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +7 -7
- package/dist/intelligence.d.ts +3 -3
- package/dist/intelligence.js +3 -3
- package/dist/kernel.d.ts +4 -4
- package/dist/kernel.js +8 -8
- package/dist/{loop-runner-bin-Dp1V3P2W.js → loop-runner-bin-DcF6ZEWi.js} +3 -3
- package/dist/{loop-runner-bin-Dp1V3P2W.js.map → loop-runner-bin-DcF6ZEWi.js.map} +1 -1
- package/dist/{loop-runner-bin-DZfRUVWy.d.ts → loop-runner-bin-jST1hm-z.d.ts} +3 -3
- package/dist/loop-runner-bin.d.ts +1 -1
- package/dist/loop-runner-bin.js +1 -1
- package/dist/mcp/bin.js +3 -3
- package/dist/mcp/index.d.ts +5 -5
- package/dist/mcp/index.js +4 -4
- package/dist/{openai-tools-YO30D2s3.d.ts → openai-tools-BuFqhp5i.d.ts} +2 -2
- package/dist/profiles.d.ts +1 -1
- package/dist/{provision-supervisor-CfK8fla-.js → provision-supervisor-Cvp4Nm-y.js} +3 -3
- package/dist/{provision-supervisor-CfK8fla-.js.map → provision-supervisor-Cvp4Nm-y.js.map} +1 -1
- package/dist/{runtime-D452tieK.js → runtime-Y46Lwt_d.js} +8 -8
- package/dist/{runtime-D452tieK.js.map → runtime-Y46Lwt_d.js.map} +1 -1
- package/dist/{search-executor-D3AT8_hb.js → search-executor-BPpfxu9c.js} +2 -2
- package/dist/{search-executor-D3AT8_hb.js.map → search-executor-BPpfxu9c.js.map} +1 -1
- package/dist/{server-D1Tfxo-v.js → server-DIrQYUnn.js} +3 -3
- package/dist/{server-D1Tfxo-v.js.map → server-DIrQYUnn.js.map} +1 -1
- package/dist/{stream-agent-turn-B1giFgOg.d.ts → stream-agent-turn-op3m9IEY.d.ts} +2 -2
- package/dist/{substrate-L_sC7jCD.d.ts → substrate-B1VzcyoB.d.ts} +2 -2
- package/dist/{supervise-CtewGpxh.js → supervise-CmeN8ipv.js} +164 -190
- package/dist/supervise-CmeN8ipv.js.map +1 -0
- package/dist/{supervisor-DYKPbcZa.js → supervisor-CSMb8HBU.js} +1796 -1038
- package/dist/supervisor-CSMb8HBU.js.map +1 -0
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +12 -12
- package/dist/tui/index.d.ts +1 -1
- package/dist/tui/index.js +1 -1
- package/dist/{types-DeuEkBhI.d.ts → types-B2IOlN8R.d.ts} +152 -67
- package/package.json +3 -3
- package/skills/profile-authoring/SKILL.md +6 -0
- package/dist/graph-VUwNFYff.js.map +0 -1
- package/dist/supervise-CtewGpxh.js.map +0 -1
- package/dist/supervisor-DYKPbcZa.js.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $n as parseWorkerToolTraceArtifact, A as scopeOwnerExecutorNodeContext, Ai as worktreeCliProfileMaterialization, An as resolveAgentEnvironmentProvider, At as captureReusableExecutorConfig, B as consumeScopeRetainedOwnerResult, Bi as recordRuntimeOwnedDriveHarnessProviderEvidence, C as deriveNodeExecutionIdentity, Ct as createContinuationKeeper, D as recordScopeOwnerMaterialization, E as recordScopeOwnerDriverAttempt, Ei as renderUnsupported, F as seatExecutionProfile, Fi as inheritRuntimeOwnedExecutorAttestation, Fn as retainedExecutorSeamKey, Ft as snapshotExecutorConfig, G as scopeRetainedOwnerContext, Gi as runtimeOwnedPendingExecutorMaterialization, H as prepareScopeRetainedOwnerSeatSwitch, Hi as runtimeOwnedExecutorExecutionBinding, I as abandonScopeRetainedOwnerInvocation, J as scopeRetainedOwnerResourceReader, Jn as readCommittedJsonLines, Jt as createActivityLog, K as scopeRetainedOwnerJournalRoot, Ki as runtimeOwnedScopeOwnerRuntime, Kn as isNoEntError, Kr as generateSpanId, L as beginScopeRetainedOwnerDrive, M as SeatChain, Mi as attestRuntimeOwnedScopeOwner, Mr as contentAddress, N as SeatChainExhaustedError, Nt as createExecutor, O as recordScopeOwnerPause, Oi as unsupportedProfileDimensions, Or as persistHarnessTranscript, P as authoredSeatStages, Pn as registerRetainedExecutorPreparation, Qi as detachedSnapshot, R as bindScopeRetainedOwnerEnvironmentId, Si as promptModelProfileMaterialization, Sr as RunCancellationReason, St as checkVerdictOf, T as meterRuntimeOwnedProviderAttempt, Tr as runAbortable, U as prepareScopeRetainedOwnerTask, Ui as runtimeOwnedExecutorMaterialization, V as noteScopeRetainedOwnerCoordination, Vi as runtimeOwnedDriveHarnessProviderEvidence, Vt as WORKER_TRACE_PROPAGATION, W as reconcileScopeRetainedOwnerEnvironment, Wi as runtimeOwnedExecutorProviderEvidence, Wr as createOtelExporter, X as scopeRetainedOwnerResult, Xr as toOtelAttributes, Xt as createInbox, Y as scopeRetainedOwnerRestorePoint, Z as scopeRetainedOwnerTurnEnded, _ as isDriverSpec, _i as controlProfileMaterialization, an as isLiveNodeStatus, b as assertRecursiveReservationPolicy, bi as profileMaterializationAxes$1, c as runTree, cn as bridgeModelRouteRefusal, dr as bridgeStopSignalKey, f as runDriverWithRetry, fr as errMessage, g as driverExecutorFactory, gi as assertProfileMaterialization, gt as CONTINUATIONS_DIR, h as driverChild, i as bestDelivered, ir as assertValidBudget, it as providerVisibleProfile, k as restoreScopeOwnerAcceptedExecution, kr as readHarnessTranscript, kt as bindReusableExecutorExecutionId, lr as spendFromUsageTotals, mt as gateOnDeliverable, n as createRootHandle, nt as coordinationMcpAlias, or as meterUsageEvent, p as summarizeDriverAttempts, q as scopeRetainedOwnerPriorSpend, qn as prepareJsonlAppend, r as createSupervisor, rt as coordinationProfileToolPrefix, s as runFinalizer, sn as bridgeAdmissionRefusal, sr as newUsageTotals, tr as executorFailure, u as HarnessTurnFailedError, ur as bridgeRuntimeAttachmentsKey, vi as defineProfileMaterializationContract, vt as CheckUnavailableError, w as meterRuntimeOwnedAccounting, wn as routerBrain, wr as linkAbort, x as beginScopeOwnerAttempt, xi as promptControlProfileMaterialization, xt as bestComposite, yi as fullProfileMaterialization, yt as admitContinuationPolicy, z as bindScopeRetainedOwnerProvider, zi as providerAttemptEvidence, zt as createRouterTranscript } from "./supervisor-CSMb8HBU.js";
|
|
2
2
|
import { f as RuntimeRunStateError, i as ConfigError, m as ValidationError } from "./errors-DodWX-cb.js";
|
|
3
3
|
import { G as errorMessage, St as teardownSurfaces, Y as isAsyncIterable$1, at as unmeteredSpend, dt as resourceTelemetry, ft as withBudgetResources, ht as DEFAULT_SUCCESSFUL_SHUTDOWN_MS, lt as addResourceSpend, ot as withTimeout, st as zeroSpend, tt as sleep, xt as teardownExecutor, z as addSpend } from "./workspace-streams-DaQceg2p.js";
|
|
4
4
|
import { _ as agentHarness, a as concreteProfileModel, c as profileModelExecutionSettings, n as assertModelAllowed, o as enforceTokenLimits, r as assertProfileModelsAllowed, s as profileBridgeWireModel, t as assertExecutableAgentProfile, v as harnessRunsAgent } from "./model-policy-DydyWTQg.js";
|
|
5
5
|
import { n as assertNoSymlinkDescendant } from "./durable-file-DWQA4ooo.js";
|
|
6
6
|
import { t as composeRuntimeHooks } from "./runtime-hooks-tXpAarhW.js";
|
|
7
|
-
import { C as createInMemoryRunContext, D as applyRunCancellation, M as coordinationVerbNames, O as watchRunCancellation, P as createCoordinationToolsForManager, S as createFileRunContext, c as resolveWakePolicy, f as createProgressTracker, h as progressStop, m as plateau, n as createSteerAcknowledger, o as composeWakeInput, r as driverAgent, s as deadlineWarningAt, t as createCancelAcknowledger, w as withRunContext } from "./coordination-driver-
|
|
7
|
+
import { C as createInMemoryRunContext, D as applyRunCancellation, M as coordinationVerbNames, O as watchRunCancellation, P as createCoordinationToolsForManager, S as createFileRunContext, c as resolveWakePolicy, f as createProgressTracker, h as progressStop, m as plateau, n as createSteerAcknowledger, o as composeWakeInput, r as driverAgent, s as deadlineWarningAt, t as createCancelAcknowledger, w as withRunContext } from "./coordination-driver-BYIjecHz.js";
|
|
8
8
|
import { r as createStdioToolServer, t as PROTOCOL_VERSION } from "./tool-server-Dqer2M4_.js";
|
|
9
9
|
import { k as writeRunCancellation, o as readRunCancelRequest, s as readRunCancellation } from "./run-layout-DSCWdbX2.js";
|
|
10
10
|
import { agentProfileSchema, canonicalAgentProfileDigest, canonicalCandidateDigest, canonicalCandidateJson, validateAgentProfileSecurity } from "@tangle-network/agent-interface";
|
|
@@ -24,153 +24,6 @@ import { withProfileKb } from "@tangle-network/agent-interface/profile-kb";
|
|
|
24
24
|
* that holds its response for its whole fence is never cut off at the 60 s harness default. */
|
|
25
25
|
const COORDINATION_CLIENT_TOOL_TIMEOUT_MS = 3e5;
|
|
26
26
|
//#endregion
|
|
27
|
-
//#region src/runtime/supervise/completion-gate.ts
|
|
28
|
-
/**
|
|
29
|
-
*
|
|
30
|
-
* The completion-oracle: **settled ⟺ DELIVERED.**
|
|
31
|
-
*
|
|
32
|
-
* Foreman's one hard lesson (0/18 self-improvement deliverables) — "done" must mean a check
|
|
33
|
-
* PASSED, not the agent's say-so. `gateOnDeliverable` wraps an `Executor` so its settlement
|
|
34
|
-
* is `valid` ONLY when the deliverable check passes. The child still RUNS and settles (its
|
|
35
|
-
* spend is conserved into the pool either way), but a child that ran WITHOUT delivering
|
|
36
|
-
* settles `valid:false` — so a keep-best driver never counts it as done, and a gate never
|
|
37
|
-
* inflates with self-judged wins.
|
|
38
|
-
*
|
|
39
|
-
* Dual-purpose by construction:
|
|
40
|
-
* - product: the agent fleet only advances on real, checked deliverables.
|
|
41
|
-
* - proof: the gate's `valid` is the honest settle — equal-k comparisons can't be gamed by an
|
|
42
|
-
* arm that "ran" without producing the artifact.
|
|
43
|
-
*
|
|
44
|
-
* The check is a DEPLOYABLE oracle — a test command, a state verifier, the commit0 judge —
|
|
45
|
-
* read off the child's output, never the model judging itself. A throwing check is
|
|
46
|
-
* fail-closed (not delivered), never a crash.
|
|
47
|
-
*
|
|
48
|
-
* @experimental
|
|
49
|
-
*/
|
|
50
|
-
/**
|
|
51
|
-
* Wrap an `Executor` so its settlement `valid` reflects the deliverable check, not the
|
|
52
|
-
* inner verdict. Handles both `execute` shapes (one-shot `Promise<ExecutorResult>` and
|
|
53
|
-
* streaming `AsyncIterable<UsageEvent>` + `resultArtifact()`); the check runs once the inner
|
|
54
|
-
* executor has produced its output. The inner `score` is preserved; only `valid` is gated.
|
|
55
|
-
*/
|
|
56
|
-
function gateOnDeliverable(inner, deliverable) {
|
|
57
|
-
let gated;
|
|
58
|
-
const check = async (out, baseScore) => {
|
|
59
|
-
let delivered;
|
|
60
|
-
try {
|
|
61
|
-
delivered = checkVerdictOf(await deliverable.check(out)).pass;
|
|
62
|
-
} catch {
|
|
63
|
-
delivered = false;
|
|
64
|
-
}
|
|
65
|
-
return {
|
|
66
|
-
valid: delivered,
|
|
67
|
-
score: baseScore ?? (delivered ? 1 : 0)
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
/**
|
|
71
|
-
* Ask the delivery question once, from whatever the inner executor managed to produce.
|
|
72
|
-
*
|
|
73
|
-
* Fail-closed on the artifact being unavailable: an executor that never produced one delivered
|
|
74
|
-
* nothing, and leaving `gated` unset keeps the existing invalid-by-default reading.
|
|
75
|
-
*/
|
|
76
|
-
const settleVerdict = async () => {
|
|
77
|
-
let art;
|
|
78
|
-
try {
|
|
79
|
-
art = inner.resultArtifact();
|
|
80
|
-
} catch {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
gated = await check(art.out, art.verdict?.score);
|
|
84
|
-
};
|
|
85
|
-
return inheritRuntimeOwnedExecutorAttestation(inner, {
|
|
86
|
-
runtime: inner.runtime,
|
|
87
|
-
...inner.budgetExempt !== void 0 ? { budgetExempt: inner.budgetExempt } : {},
|
|
88
|
-
...inner.deliver ? { deliver: (m) => inner.deliver?.(m) } : {},
|
|
89
|
-
...inner.progress ? { progress: () => inner.progress?.() } : {},
|
|
90
|
-
...inner.traceSource ? { traceSource: () => inner.traceSource?.() } : {},
|
|
91
|
-
...inner.metered ? { metered: () => inner.metered?.() } : {},
|
|
92
|
-
...inner.harnessTranscript ? { harnessTranscript: () => inner.harnessTranscript?.() } : {},
|
|
93
|
-
...inner.harnessTranscriptSettled ? { harnessTranscriptSettled: () => inner.harnessTranscriptSettled?.() ?? Promise.resolve() } : {},
|
|
94
|
-
execute(task, signal) {
|
|
95
|
-
const r = inner.execute(task, signal);
|
|
96
|
-
if (isAsyncIterable$1(r)) return (async function* () {
|
|
97
|
-
try {
|
|
98
|
-
for await (const ev of r) yield ev;
|
|
99
|
-
} finally {
|
|
100
|
-
await settleVerdict();
|
|
101
|
-
}
|
|
102
|
-
})();
|
|
103
|
-
return (async () => {
|
|
104
|
-
let res;
|
|
105
|
-
try {
|
|
106
|
-
res = await r;
|
|
107
|
-
} catch (error) {
|
|
108
|
-
await settleVerdict();
|
|
109
|
-
throw error;
|
|
110
|
-
}
|
|
111
|
-
gated = await check(res.out, res.verdict?.score);
|
|
112
|
-
return {
|
|
113
|
-
...res,
|
|
114
|
-
verdict: gated
|
|
115
|
-
};
|
|
116
|
-
})();
|
|
117
|
-
},
|
|
118
|
-
teardown: (grace) => inner.teardown(grace),
|
|
119
|
-
...teardownSurfaces(inner),
|
|
120
|
-
resultArtifact() {
|
|
121
|
-
const art = inner.resultArtifact();
|
|
122
|
-
return {
|
|
123
|
-
...art,
|
|
124
|
-
verdict: gated ?? art.verdict
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Transform a Runtime executor's terminal artifact without losing its private
|
|
131
|
-
* profile-materialization attestation or altering its measured spend. This is
|
|
132
|
-
* the composition point for deterministic post-processing and grading; callers
|
|
133
|
-
* must not rebuild an Executor around a model transport merely to change `out`.
|
|
134
|
-
*/
|
|
135
|
-
function mapExecutorResult(inner, map) {
|
|
136
|
-
let mapped;
|
|
137
|
-
const settle = async (result, task) => {
|
|
138
|
-
const transformed = await map(result, task);
|
|
139
|
-
mapped = {
|
|
140
|
-
outRef: transformed.outRef,
|
|
141
|
-
out: transformed.out,
|
|
142
|
-
...transformed.verdict ? { verdict: transformed.verdict } : {},
|
|
143
|
-
spent: result.spent
|
|
144
|
-
};
|
|
145
|
-
return mapped;
|
|
146
|
-
};
|
|
147
|
-
return inheritRuntimeOwnedExecutorAttestation(inner, {
|
|
148
|
-
runtime: inner.runtime,
|
|
149
|
-
...inner.budgetExempt !== void 0 ? { budgetExempt: inner.budgetExempt } : {},
|
|
150
|
-
...inner.deliver ? { deliver: (message) => inner.deliver?.(message) } : {},
|
|
151
|
-
...inner.progress ? { progress: () => inner.progress?.() } : {},
|
|
152
|
-
...inner.traceSource ? { traceSource: () => inner.traceSource?.() } : {},
|
|
153
|
-
...inner.accounting ? { accounting: () => inner.accounting?.() } : {},
|
|
154
|
-
...inner.metered ? { metered: () => inner.metered?.() } : {},
|
|
155
|
-
...inner.harnessTranscript ? { harnessTranscript: () => inner.harnessTranscript?.() } : {},
|
|
156
|
-
...inner.harnessTranscriptSettled ? { harnessTranscriptSettled: () => inner.harnessTranscriptSettled?.() ?? Promise.resolve() } : {},
|
|
157
|
-
execute(task, signal) {
|
|
158
|
-
const execution = inner.execute(task, signal);
|
|
159
|
-
if (isAsyncIterable$1(execution)) return (async function* () {
|
|
160
|
-
for await (const event of execution) yield event;
|
|
161
|
-
await settle(inner.resultArtifact(), task);
|
|
162
|
-
})();
|
|
163
|
-
return (async () => settle(await execution, task))();
|
|
164
|
-
},
|
|
165
|
-
teardown: (grace) => inner.teardown(grace),
|
|
166
|
-
...teardownSurfaces(inner),
|
|
167
|
-
resultArtifact() {
|
|
168
|
-
if (!mapped) throw new Error("mapExecutorResult: resultArtifact() read before execute()");
|
|
169
|
-
return mapped;
|
|
170
|
-
}
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
//#endregion
|
|
174
27
|
//#region src/runtime/supervise/coordination-http.ts
|
|
175
28
|
function coordinationHttpLimits(options) {
|
|
176
29
|
const positive = (name, value, fallback) => {
|
|
@@ -1779,10 +1632,6 @@ function observeWorkerControls(options) {
|
|
|
1779
1632
|
* Both arms spawn children through the SAME `makeWorkerAgent` seam and apply the SAME independent
|
|
1780
1633
|
* deliverable check to direct submissions. Raw driver prose is never quality-accepted.
|
|
1781
1634
|
*/
|
|
1782
|
-
/** Runtime-owned coordination is mounted under this MCP alias. */
|
|
1783
|
-
const coordinationMcpAlias = "agent-runtime-coordination";
|
|
1784
|
-
/** A profile declares Runtime-owned tools with this provider-neutral prefix. */
|
|
1785
|
-
const coordinationProfileToolPrefix = `${coordinationMcpAlias.replaceAll("-", "_")}_`;
|
|
1786
1635
|
const coordinationVerbNameSet$1 = new Set(coordinationVerbNames);
|
|
1787
1636
|
/** Bare Runtime tool names explicitly enabled by one exact profile. */
|
|
1788
1637
|
function declaredRuntimeToolNames(profile) {
|
|
@@ -1803,25 +1652,6 @@ function assertNoReservedCoordinationMcpAlias(profile, context) {
|
|
|
1803
1652
|
throw new ValidationError(`${context}: profile MCP alias ${JSON.stringify(coordinationMcpAlias)} is reserved for Runtime coordination`);
|
|
1804
1653
|
}
|
|
1805
1654
|
/**
|
|
1806
|
-
* Project one canonical profile to the profile a provider may receive.
|
|
1807
|
-
*
|
|
1808
|
-
* The reserved prefix is Runtime-owned in its entirety. A `true` declaration must resolve to a
|
|
1809
|
-
* mounted Runtime or product descriptor before execution; a `false` declaration grants nothing.
|
|
1810
|
-
* Neither is a provider-native tool. Stripping the whole namespace keeps a false or refused grant
|
|
1811
|
-
* from becoming an invented harness capability during strict materialization.
|
|
1812
|
-
*/
|
|
1813
|
-
function providerVisibleProfile(profile) {
|
|
1814
|
-
if (profile.tools === void 0) return profile;
|
|
1815
|
-
const providerTools = Object.fromEntries(Object.entries(profile.tools).filter(([name]) => !name.startsWith(coordinationProfileToolPrefix)));
|
|
1816
|
-
if (Object.keys(providerTools).length === Object.keys(profile.tools).length) return profile;
|
|
1817
|
-
if (Object.keys(providerTools).length > 0) return {
|
|
1818
|
-
...profile,
|
|
1819
|
-
tools: providerTools
|
|
1820
|
-
};
|
|
1821
|
-
const { tools: _runtimeTools, ...withoutTools } = profile;
|
|
1822
|
-
return withoutTools;
|
|
1823
|
-
}
|
|
1824
|
-
/**
|
|
1825
1655
|
* The instruction lines a canonical `resources.instructions` contributes. A plain string and an
|
|
1826
1656
|
* `inline` resource are their own text; a `github` reference names bytes that live elsewhere and
|
|
1827
1657
|
* cannot be fetched while building a supervisor synchronously — that fails loud rather than
|
|
@@ -2299,6 +2129,7 @@ function buildSupervisorAgent(profile, deps, testBrain) {
|
|
|
2299
2129
|
continuations: keeper?.entries() ?? []
|
|
2300
2130
|
});
|
|
2301
2131
|
};
|
|
2132
|
+
let driverFailed = true;
|
|
2302
2133
|
try {
|
|
2303
2134
|
await runDriverWithRetry({
|
|
2304
2135
|
drive: async (attempt, reentry) => {
|
|
@@ -2325,6 +2156,7 @@ function buildSupervisorAgent(profile, deps, testBrain) {
|
|
|
2325
2156
|
...profilePrompt !== void 0 ? { systemPrompt: profilePrompt } : {},
|
|
2326
2157
|
task: compose === void 0 ? task : compose(UNPROVEN_CONTINUITY),
|
|
2327
2158
|
...compose === void 0 ? {} : { reentry: {
|
|
2159
|
+
reason: reentry,
|
|
2328
2160
|
compose,
|
|
2329
2161
|
onContinuity: (continuity) => {
|
|
2330
2162
|
if (continuity.environment === "replaced") environmentReplacements += 1;
|
|
@@ -2355,6 +2187,7 @@ function buildSupervisorAgent(profile, deps, testBrain) {
|
|
|
2355
2187
|
progress: readProgress,
|
|
2356
2188
|
budget: () => scope.budget,
|
|
2357
2189
|
signal: scope.signal,
|
|
2190
|
+
resolvePending: (failure, failures) => abandonScopeRetainedOwnerInvocation(scope, failure, failures),
|
|
2358
2191
|
wait: {
|
|
2359
2192
|
open: () => !mcp.submittedResult() && !mcp.isStopped() && progressStopReason === void 0 && controls.hasOpenWork(),
|
|
2360
2193
|
wake: async (nextAttempt) => {
|
|
@@ -2405,7 +2238,9 @@ function buildSupervisorAgent(profile, deps, testBrain) {
|
|
|
2405
2238
|
await deps.onDriverAttempt?.(record);
|
|
2406
2239
|
}
|
|
2407
2240
|
});
|
|
2241
|
+
driverFailed = false;
|
|
2408
2242
|
} finally {
|
|
2243
|
+
await driveHarness.closeSeatSegment?.(scope.signal.aborted ? "cancelled" : driverFailed ? "failed" : "completed");
|
|
2409
2244
|
settleLoop();
|
|
2410
2245
|
}
|
|
2411
2246
|
if (!contractDeclared) await mcp.drainResolved();
|
|
@@ -3205,12 +3040,12 @@ const CLAUDE_CODE_ONE_HOUR_CACHE = "ENABLE_PROMPT_CACHING_1H";
|
|
|
3205
3040
|
/** Run a harness-brained manager through the same executor factory as its children. The manager's
|
|
3206
3041
|
* full profile is preserved, the live coordination server is added under one reserved alias, and
|
|
3207
3042
|
* every streamed turn is charged to the manager's scope before it may continue. */
|
|
3208
|
-
function driveHarnessFromBackend(backend, executionId, now = Date.now, maxTurns, rootStream) {
|
|
3043
|
+
function driveHarnessFromBackend(backend, executionId, now = Date.now, maxTurns, rootStream, seatSelection) {
|
|
3209
3044
|
if (maxTurns !== void 0 && maxTurns < 0) throw new ValidationError("driveHarnessFromBackend: maxTurns must be >= 0 (0 lifts the turn cap; bounds become the conserved pool + deadline + abort)");
|
|
3210
3045
|
const turnCap = maxTurns ?? 0;
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3046
|
+
let boundBackend = bindReusableExecutorExecutionId(managerExecutorConfig(captureReusableExecutorConfig(backend, "driveHarnessFromBackend")), executionId);
|
|
3047
|
+
let baseFactory = createExecutor(boundBackend);
|
|
3048
|
+
let ownerRuntime = boundBackend.backend === "provider" ? boundBackend.runtime ?? resolveAgentEnvironmentProvider(boundBackend.provider, boundBackend.registry).name : "cli";
|
|
3214
3049
|
let activeExecutor;
|
|
3215
3050
|
const driveActivity = createActivityLog();
|
|
3216
3051
|
let driveTurns = 0;
|
|
@@ -3238,8 +3073,79 @@ function driveHarnessFromBackend(backend, executionId, now = Date.now, maxTurns,
|
|
|
3238
3073
|
};
|
|
3239
3074
|
let managerTranscript;
|
|
3240
3075
|
let managerArtifact;
|
|
3076
|
+
const committedTranscriptDigest = (artifact) => {
|
|
3077
|
+
if (artifact === void 0) return "Prior committed transcript: no bounded turn content was captured.";
|
|
3078
|
+
const out = artifact.out;
|
|
3079
|
+
if (out === null || typeof out !== "object") return `Prior committed transcript ref: ${artifact.outRef}; no structured turn content was captured.`;
|
|
3080
|
+
const record = out;
|
|
3081
|
+
const events = Array.isArray(record.events) ? record.events : [];
|
|
3082
|
+
const kinds = events.slice(-16).flatMap((event) => {
|
|
3083
|
+
if (event === null || typeof event !== "object") return [];
|
|
3084
|
+
const kind = event.type;
|
|
3085
|
+
return typeof kind === "string" ? [kind.slice(0, 80)] : [];
|
|
3086
|
+
});
|
|
3087
|
+
const content = typeof record.content === "string" ? record.content.slice(-4e3) : "";
|
|
3088
|
+
return [
|
|
3089
|
+
`Prior committed transcript ref: ${artifact.outRef}; ${events.length} events captured.`,
|
|
3090
|
+
...kinds.length > 0 ? [`Recent event kinds: ${kinds.join(", ")}.`] : [],
|
|
3091
|
+
...content ? [`Last captured answer excerpt: ${content}`] : []
|
|
3092
|
+
].join("\n");
|
|
3093
|
+
};
|
|
3094
|
+
let seatChain;
|
|
3095
|
+
let activeSeat;
|
|
3096
|
+
let switchedProviderCheckpointAt;
|
|
3241
3097
|
const drive = async ({ profile, authoredProfile, task, scope, coordinationMcpUrl, coordinationMcpHeaders, stopSignal, coordinationTools, reentry }) => {
|
|
3098
|
+
const priorCommittedArtifact = managerArtifact;
|
|
3242
3099
|
managerArtifact = void 0;
|
|
3100
|
+
switchedProviderCheckpointAt = void 0;
|
|
3101
|
+
if (authoredSeatStages(authoredProfile) !== void 0) {
|
|
3102
|
+
if (!seatSelection) throw new ValidationError("AgentProfile.seats requires SuperviseOptions.selectSeat");
|
|
3103
|
+
if (activeSeat === void 0) {
|
|
3104
|
+
const accepted = await scopeRetainedOwnerResult(scope);
|
|
3105
|
+
const reported = accepted === void 0 ? void 0 : executorFailure(accepted);
|
|
3106
|
+
if (reported !== void 0) {
|
|
3107
|
+
await restoreScopeOwnerAcceptedExecution(scope);
|
|
3108
|
+
consumeScopeRetainedOwnerResult(scope);
|
|
3109
|
+
managerArtifact = accepted;
|
|
3110
|
+
throw new HarnessTurnFailedError(ownerRuntime, reported);
|
|
3111
|
+
}
|
|
3112
|
+
}
|
|
3113
|
+
const seatJournalRoot = scopeRetainedOwnerJournalRoot(scope) ?? seatSelection.rootId;
|
|
3114
|
+
seatChain ??= new SeatChain(authoredProfile, scope.view.root, seatJournalRoot, seatSelection.journal, seatSelection.select, now, (segment, phase) => seatSelection.onSegment(scope.view.root, segment, phase), async (selection, previous) => {
|
|
3115
|
+
if (previous && previous.seat !== selection.seat) {
|
|
3116
|
+
const sameEnvironment = previous.provider === selection.stage.provider && previous.harness === selection.stage.harness;
|
|
3117
|
+
const checkpoint = await prepareScopeRetainedOwnerSeatSwitch(scope, sameEnvironment ? "same-environment" : "replace-environment");
|
|
3118
|
+
if (!sameEnvironment) switchedProviderCheckpointAt = checkpoint.checkpointAt;
|
|
3119
|
+
}
|
|
3120
|
+
});
|
|
3121
|
+
const usageLimit = reentry?.reason.reason === "upstream-unavailable" && reentry.reason.signal === "subscription-usage-limit";
|
|
3122
|
+
if (activeSeat === void 0 || usageLimit) {
|
|
3123
|
+
let afterRecheck = false;
|
|
3124
|
+
for (;;) try {
|
|
3125
|
+
activeSeat = await seatChain.next(usageLimit && !afterRecheck, afterRecheck);
|
|
3126
|
+
if (afterRecheck) await seatSelection.onPause(scope.view.root, "", "resumed");
|
|
3127
|
+
break;
|
|
3128
|
+
} catch (error) {
|
|
3129
|
+
if (!(error instanceof SeatChainExhaustedError)) throw error;
|
|
3130
|
+
await seatSelection.journal.appendEvent(seatJournalRoot, {
|
|
3131
|
+
kind: "seat-paused",
|
|
3132
|
+
id: scope.view.root,
|
|
3133
|
+
resumeAt: error.resumeAt,
|
|
3134
|
+
seq: Date.parse(error.resumeAt),
|
|
3135
|
+
at: new Date(now()).toISOString()
|
|
3136
|
+
});
|
|
3137
|
+
await seatSelection.onPause(scope.view.root, error.resumeAt, "paused");
|
|
3138
|
+
await sleep(Math.max(1e3, Date.parse(error.resumeAt) - now()), scope.signal, false);
|
|
3139
|
+
afterRecheck = true;
|
|
3140
|
+
}
|
|
3141
|
+
boundBackend = bindReusableExecutorExecutionId(managerExecutorConfig(captureReusableExecutorConfig({
|
|
3142
|
+
...activeSeat.backend,
|
|
3143
|
+
unavailablePause: false
|
|
3144
|
+
}, "selectSeat")), `${executionId}:segment:${activeSeat.segmentIndex}`);
|
|
3145
|
+
baseFactory = createExecutor(boundBackend);
|
|
3146
|
+
ownerRuntime = boundBackend.backend === "provider" ? boundBackend.runtime ?? resolveAgentEnvironmentProvider(boundBackend.provider, boundBackend.registry).name : "cli";
|
|
3147
|
+
}
|
|
3148
|
+
}
|
|
3243
3149
|
const retainedOwner = boundBackend.backend === "provider" ? scopeRetainedOwnerContext(scope) : void 0;
|
|
3244
3150
|
if (retainedOwner && boundBackend.backend === "provider") {
|
|
3245
3151
|
bindScopeRetainedOwnerProvider(scope, resolveAgentEnvironmentProvider(boundBackend.provider, boundBackend.registry), boundBackend.workspaceRetention === void 0 ? void 0 : {
|
|
@@ -3255,9 +3161,26 @@ function driveHarnessFromBackend(backend, executionId, now = Date.now, maxTurns,
|
|
|
3255
3161
|
}
|
|
3256
3162
|
let driveTask = task;
|
|
3257
3163
|
if (reentry !== void 0) {
|
|
3258
|
-
const continuity = await reentryContinuity(boundBackend, scope, retainedOwner !== void 0)
|
|
3164
|
+
const continuity = switchedProviderCheckpointAt === void 0 ? await reentryContinuity(boundBackend, scope, retainedOwner !== void 0) : {
|
|
3165
|
+
session: "new",
|
|
3166
|
+
environment: "replaced",
|
|
3167
|
+
workspace: "restored",
|
|
3168
|
+
checkpointAt: switchedProviderCheckpointAt
|
|
3169
|
+
};
|
|
3170
|
+
if (activeSeat?.previous && activeSeat.previous.seat !== activeSeat.seat && activeSeat.previous.provider === activeSeat.stage.provider && activeSeat.previous.harness === activeSeat.stage.harness && (continuity.session !== "continued" || continuity.environment !== "same")) throw new ValidationError("same-provider seat continuation lost its native environment");
|
|
3259
3171
|
reentry.onContinuity?.(continuity);
|
|
3260
3172
|
driveTask = reentry.compose(continuity);
|
|
3173
|
+
if (activeSeat?.previous && (activeSeat.previous.provider !== activeSeat.stage.provider || activeSeat.previous.harness !== activeSeat.stage.harness)) driveTask = [
|
|
3174
|
+
String(driveTask),
|
|
3175
|
+
"",
|
|
3176
|
+
"## Harness handoff",
|
|
3177
|
+
"",
|
|
3178
|
+
"This is the same logical agent in a different harness or provider. Read the restored workspace,",
|
|
3179
|
+
"especially its STATE, NEXT, and RESULT pages and knowledge pages, before acting.",
|
|
3180
|
+
"A prior tool call may have executed. Check its committed output or workspace effect",
|
|
3181
|
+
"before repeating it.",
|
|
3182
|
+
committedTranscriptDigest(priorCommittedArtifact)
|
|
3183
|
+
].join("\n");
|
|
3261
3184
|
}
|
|
3262
3185
|
const originalTask = retainedOwner ? await prepareScopeRetainedOwnerTask(scope, driveTask) : driveTask;
|
|
3263
3186
|
const acceptedOwner = retainedOwner ? await scopeRetainedOwnerResult(scope) : void 0;
|
|
@@ -3274,8 +3197,13 @@ function driveHarnessFromBackend(backend, executionId, now = Date.now, maxTurns,
|
|
|
3274
3197
|
const canonicalDriverProfile = agentProfileSchema.parse(authoredProfile);
|
|
3275
3198
|
assertNoReservedCoordinationMcpAlias(canonicalDriverProfile, "driveHarnessFromBackend");
|
|
3276
3199
|
const stableCoordinationTools = detachedSnapshot(coordinationTools, "driveHarnessFromBackend coordination tools");
|
|
3277
|
-
const expectedProviderProfile = providerVisibleProfile(canonicalDriverProfile);
|
|
3278
|
-
|
|
3200
|
+
const expectedProviderProfile = providerVisibleProfile(activeSeat ? seatExecutionProfile(canonicalDriverProfile, activeSeat.stage) : canonicalDriverProfile);
|
|
3201
|
+
if (activeSeat) {
|
|
3202
|
+
assertExecutableAgentProfile(expectedProviderProfile, "selected seat");
|
|
3203
|
+
assertBackendProfileMaterialization(expectedProviderProfile, boundBackend, "selected seat");
|
|
3204
|
+
assertBridgeProfileMaterializes(expectedProviderProfile, boundBackend, "selected seat");
|
|
3205
|
+
}
|
|
3206
|
+
const providerDriverProfile = activeSeat ? expectedProviderProfile : agentProfileSchema.parse(profile);
|
|
3279
3207
|
if (canonicalAgentProfileDigest(providerDriverProfile) !== canonicalAgentProfileDigest(expectedProviderProfile)) throw new ValidationError("driveHarnessFromBackend: supervisor passed a provider profile that does not match its canonical profile and mounted coordination tools");
|
|
3280
3208
|
const spec = {
|
|
3281
3209
|
profile: providerDriverProfile,
|
|
@@ -3624,7 +3552,10 @@ function driveHarnessFromBackend(backend, executionId, now = Date.now, maxTurns,
|
|
|
3624
3552
|
endDrive();
|
|
3625
3553
|
}
|
|
3626
3554
|
if (failed) throw failure;
|
|
3627
|
-
if (turnFailure !== void 0)
|
|
3555
|
+
if (turnFailure !== void 0) {
|
|
3556
|
+
managerArtifact = terminalArtifact;
|
|
3557
|
+
throw turnFailure;
|
|
3558
|
+
}
|
|
3628
3559
|
managerArtifact = terminalArtifact;
|
|
3629
3560
|
};
|
|
3630
3561
|
drive.resultArtifact = () => managerArtifact;
|
|
@@ -3649,6 +3580,9 @@ function driveHarnessFromBackend(backend, executionId, now = Date.now, maxTurns,
|
|
|
3649
3580
|
drive.harnessTranscript = () => managerTranscript ?? activeExecutor?.harnessTranscript?.();
|
|
3650
3581
|
drive.harnessTranscriptSettled = () => activeExecutor?.harnessTranscriptSettled?.() ?? Promise.resolve();
|
|
3651
3582
|
}
|
|
3583
|
+
drive.closeSeatSegment = async (reason) => {
|
|
3584
|
+
await seatChain?.close(reason);
|
|
3585
|
+
};
|
|
3652
3586
|
return attestRuntimeOwnedScopeOwner(drive, ownerRuntime);
|
|
3653
3587
|
}
|
|
3654
3588
|
/**
|
|
@@ -3759,6 +3693,7 @@ const superviseOptionKeySet = /* @__PURE__ */ new Set([
|
|
|
3759
3693
|
"authorizeMessage",
|
|
3760
3694
|
"authorizeSpawn",
|
|
3761
3695
|
"backend",
|
|
3696
|
+
"selectSeat",
|
|
3762
3697
|
"blobs",
|
|
3763
3698
|
"budget",
|
|
3764
3699
|
"childSettleGraceMs",
|
|
@@ -3864,6 +3799,7 @@ Object.freeze([...[
|
|
|
3864
3799
|
"resolveDeliverable",
|
|
3865
3800
|
"resolveDriveHarness",
|
|
3866
3801
|
"resolveSpawnProfile",
|
|
3802
|
+
"selectSeat",
|
|
3867
3803
|
"resolveSupervisorTools",
|
|
3868
3804
|
"stopRule"
|
|
3869
3805
|
]]);
|
|
@@ -3898,7 +3834,7 @@ function rootSpawnResourceRoot(backend) {
|
|
|
3898
3834
|
}
|
|
3899
3835
|
function captureSuperviseOptions(opts) {
|
|
3900
3836
|
assertSuperviseOptionKeys(opts, "supervise");
|
|
3901
|
-
const { backend, coordination, driverBackend, deliverable, resolveDeliverable, router, compaction, watchWorkers, analysts, makeWorkerAgent, makeLeafAgent, recoverExecutor, resume, resolveSpawnProfile, blobs, journal, runContext, registry, hooks, otel, authorizeSpawn, authorizeMessage, driveHarness, resolveDriveHarness, resolveSupervisorTools, escalateQuestion, onCoordinationEvent, executeExtraTool, stopRule, onProgressStop, onDriverAttempt, continuation, workerRetry, onWorkerRetry, finalizer, now, signal, rootHandle, workerSlots, ...decisionData } = opts;
|
|
3837
|
+
const { backend, selectSeat, coordination, driverBackend, deliverable, resolveDeliverable, router, compaction, watchWorkers, analysts, makeWorkerAgent, makeLeafAgent, recoverExecutor, resume, resolveSpawnProfile, blobs, journal, runContext, registry, hooks, otel, authorizeSpawn, authorizeMessage, driveHarness, resolveDriveHarness, resolveSupervisorTools, escalateQuestion, onCoordinationEvent, executeExtraTool, stopRule, onProgressStop, onDriverAttempt, continuation, workerRetry, onWorkerRetry, finalizer, now, signal, rootHandle, workerSlots, ...decisionData } = opts;
|
|
3902
3838
|
assertNoUncapturedExecutableOption(decisionData);
|
|
3903
3839
|
const capturedData = detachedSnapshot(decisionData, "supervise options");
|
|
3904
3840
|
const capturedCoordination = coordination === void 0 ? void 0 : (() => {
|
|
@@ -3958,6 +3894,7 @@ function captureSuperviseOptions(opts) {
|
|
|
3958
3894
|
...capturedData,
|
|
3959
3895
|
...capturedCoordination === void 0 ? {} : { coordination: capturedCoordination },
|
|
3960
3896
|
...capturedBackend === void 0 ? {} : { backend: capturedBackend },
|
|
3897
|
+
...selectSeat === void 0 ? {} : { selectSeat },
|
|
3961
3898
|
...capturedDriverBackend === void 0 ? {} : { driverBackend: capturedDriverBackend },
|
|
3962
3899
|
...capturedDeliverable === void 0 ? {} : { deliverable: capturedDeliverable },
|
|
3963
3900
|
...resolveDeliverable === void 0 ? {} : { resolveDeliverable },
|
|
@@ -4231,6 +4168,7 @@ function superviseInternal(profile, task, opts, testBrain) {
|
|
|
4231
4168
|
const composeSpawnProfile = profileGuidanceComposer(options.profileGuidance);
|
|
4232
4169
|
const canonicalProfile = superviseRootProfile(profile, options.profileGuidance);
|
|
4233
4170
|
assertExecutableAgentProfile(canonicalProfile, "supervise root");
|
|
4171
|
+
if (authoredSeatStages(canonicalProfile) !== void 0 && options.selectSeat === void 0) throw new ValidationError("supervise: AgentProfile.seats requires selectSeat before execution");
|
|
4234
4172
|
const canonicalTask = freezeDetached(task);
|
|
4235
4173
|
if (options.makeWorkerAgent && options.authorizeSpawn) throw new ValidationError("supervise: authorizeSpawn cannot be combined with caller-owned makeWorkerAgent; use makeLeafAgent to override leaf execution inside the authorized path, or use backend-derived workers");
|
|
4236
4174
|
if (options.makeWorkerAgent && options.makeLeafAgent) throw new ValidationError("supervise: makeWorkerAgent replaces the worker path and makeLeafAgent overrides a leaf inside it; pass one");
|
|
@@ -4251,6 +4189,7 @@ function superviseInternal(profile, task, opts, testBrain) {
|
|
|
4251
4189
|
const backendModel = options.backend?.model;
|
|
4252
4190
|
const driverBackendModel = options.driverBackend?.model;
|
|
4253
4191
|
assertProfileModelsAllowed(canonicalProfile, options.allowedModels);
|
|
4192
|
+
for (const stage of authoredSeatStages(canonicalProfile) ?? []) assertModelAllowed(stage.model, options.allowedModels);
|
|
4254
4193
|
assertModelAllowed(typeof backendModel === "string" ? backendModel : void 0, options.allowedModels);
|
|
4255
4194
|
assertModelAllowed(typeof driverBackendModel === "string" ? driverBackendModel : void 0, options.allowedModels);
|
|
4256
4195
|
const deliverable = resolveNamed("deliverable", "deliverables", options.deliverable, options.registry?.deliverables);
|
|
@@ -4293,7 +4232,7 @@ function superviseInternal(profile, task, opts, testBrain) {
|
|
|
4293
4232
|
if (options.inheritSpawnRights === false || options.makeWorkerAgent !== void 0 || !childrenCanSubmit) return composeSpawnProfile;
|
|
4294
4233
|
return (authored) => {
|
|
4295
4234
|
const composed = composeSpawnProfile ? composeSpawnProfile(authored) : authored;
|
|
4296
|
-
return canLead(composed) ? withInheritedSpawnRights(parent, composed)
|
|
4235
|
+
return composed.seats || !canLead(composed) ? composed : withInheritedSpawnRights(parent, composed);
|
|
4297
4236
|
};
|
|
4298
4237
|
};
|
|
4299
4238
|
const harnessClaims = /* @__PURE__ */ new WeakMap();
|
|
@@ -4323,7 +4262,41 @@ function superviseInternal(profile, task, opts, testBrain) {
|
|
|
4323
4262
|
return managerBackend && automaticDriverBackendSupported(managerBackend, options.coordination) ? driveHarnessFromBackend(managerBackend, externalExecutionId("supervised-manager", {
|
|
4324
4263
|
runNamespace,
|
|
4325
4264
|
ownerId: context.ownerId
|
|
4326
|
-
}), options.now ?? Date.now, options.maxTurns, context.depth === 0 ? rootStreamSink : void 0
|
|
4265
|
+
}), options.now ?? Date.now, options.maxTurns, context.depth === 0 ? rootStreamSink : void 0, options.selectSeat === void 0 ? void 0 : {
|
|
4266
|
+
select: options.selectSeat,
|
|
4267
|
+
journal,
|
|
4268
|
+
rootId: runId,
|
|
4269
|
+
onSegment: async (nodeId, segment, phase) => {
|
|
4270
|
+
await options.hooks?.onEvent?.({
|
|
4271
|
+
id: `${nodeId}:seat:${segment.startedAt}:${phase}`,
|
|
4272
|
+
runId,
|
|
4273
|
+
target: "agent.seat",
|
|
4274
|
+
phase: "event",
|
|
4275
|
+
timestamp: options.now?.() ?? Date.now(),
|
|
4276
|
+
parentId: nodeId,
|
|
4277
|
+
payload: {
|
|
4278
|
+
nodeId,
|
|
4279
|
+
phase,
|
|
4280
|
+
segment
|
|
4281
|
+
}
|
|
4282
|
+
}, {});
|
|
4283
|
+
},
|
|
4284
|
+
onPause: async (nodeId, resumeAt, phase) => {
|
|
4285
|
+
await options.hooks?.onEvent?.({
|
|
4286
|
+
id: `${nodeId}:seat:${phase}:${resumeAt || (options.now?.() ?? Date.now())}`,
|
|
4287
|
+
runId,
|
|
4288
|
+
target: "agent.seat",
|
|
4289
|
+
phase: "event",
|
|
4290
|
+
timestamp: options.now?.() ?? Date.now(),
|
|
4291
|
+
parentId: nodeId,
|
|
4292
|
+
payload: {
|
|
4293
|
+
nodeId,
|
|
4294
|
+
phase,
|
|
4295
|
+
...resumeAt ? { resumeAt } : {}
|
|
4296
|
+
}
|
|
4297
|
+
}, {});
|
|
4298
|
+
}
|
|
4299
|
+
}) : void 0;
|
|
4327
4300
|
};
|
|
4328
4301
|
const rootDriveHarness = isExternalSupervisor(canonicalProfile) ? driveHarnessForOwner(freezeDetached({
|
|
4329
4302
|
runId,
|
|
@@ -4393,7 +4366,8 @@ function superviseInternal(profile, task, opts, testBrain) {
|
|
|
4393
4366
|
assertProfileModelsAllowed(authorized, options.allowedModels);
|
|
4394
4367
|
const selectedDeliverable = options.resolveDeliverable?.(postAuthorizationContext);
|
|
4395
4368
|
const childDeliverable = selectedDeliverable === void 0 ? deliverable : selectedDeliverable === null ? void 0 : captureDeliverable(selectedDeliverable, `supervise deliverable for ${JSON.stringify(spawnContext.label)}`);
|
|
4396
|
-
|
|
4369
|
+
const seatManagedLeaf = authoredSeatStages(authorized) !== void 0 && declaredRuntimeToolNames(authorized).length === 0 && isExternalSupervisor(authorized);
|
|
4370
|
+
if (!(declaredRuntimeToolNames(authorized).length > 0 || seatManagedLeaf)) {
|
|
4397
4371
|
if (childDeliverable !== deliverable && !options.backend) throw new ValidationError("supervise: resolveDeliverable selected a per-spawn deliverable but there is no backend to derive that leaf from; makeLeafAgent owns its own completion check");
|
|
4398
4372
|
return (childDeliverable === deliverable ? makeLeaf : withRetry(workerFromBackend(options.backend, childDeliverable)))(authorized, Object.freeze({
|
|
4399
4373
|
...authorizedContext,
|
|
@@ -4464,11 +4438,11 @@ function superviseInternal(profile, task, opts, testBrain) {
|
|
|
4464
4438
|
...options.compaction ? { compaction: options.compaction } : {},
|
|
4465
4439
|
...options.driverRetry ? { driverRetry: options.driverRetry } : {},
|
|
4466
4440
|
...options.onDriverAttempt ? { onDriverAttempt: options.onDriverAttempt } : {},
|
|
4467
|
-
...childDeliverable ? { deliverable: childDeliverable } : {},
|
|
4468
|
-
...childDeliverable ? { onAcceptedSubmission: () => {
|
|
4441
|
+
...childDeliverable && !seatManagedLeaf ? { deliverable: childDeliverable } : {},
|
|
4442
|
+
...childDeliverable && !seatManagedLeaf ? { onAcceptedSubmission: () => {
|
|
4469
4443
|
acceptedSubmission = true;
|
|
4470
4444
|
} } : {},
|
|
4471
|
-
...childDeliverable && options.continuation && isExternalSupervisor(authorized) ? {
|
|
4445
|
+
...childDeliverable && !seatManagedLeaf && options.continuation && isExternalSupervisor(authorized) ? {
|
|
4472
4446
|
continuation: options.continuation,
|
|
4473
4447
|
...options.runDir === void 0 ? {} : { continuationDir: resolve(options.runDir, CONTINUATIONS_DIR, "managers", encodeURIComponent(ownerId)) }
|
|
4474
4448
|
} : {},
|
|
@@ -4483,7 +4457,7 @@ function superviseInternal(profile, task, opts, testBrain) {
|
|
|
4483
4457
|
},
|
|
4484
4458
|
...options.steerDir === void 0 ? {} : { steerDir: resolve(options.steerDir) },
|
|
4485
4459
|
...options.runDir === void 0 && options.steerDir === void 0 ? {} : { controlScope: "subtree" }
|
|
4486
|
-
}), journal, childExecution.ref, () => acceptedSubmission, recoveryFactories.get(childFactory), () => unassessedOutput);
|
|
4460
|
+
}), journal, childExecution.ref, () => acceptedSubmission, recoveryFactories.get(childFactory), () => unassessedOutput, seatManagedLeaf ? childDeliverable : void 0);
|
|
4487
4461
|
};
|
|
4488
4462
|
if (options.makeLeafAgent === void 0 && options.backend?.backend === "provider" && !options.backend.steering) {
|
|
4489
4463
|
const factory = registerRetainedExecutorPreparation(createExecutor(options.backend), ({ spawned, profile, task }) => {
|
|
@@ -4712,6 +4686,6 @@ function rootProviderModelEvidenceFromExecution(evidence) {
|
|
|
4712
4686
|
return evidence ?? rootProviderModelEvidence([]);
|
|
4713
4687
|
}
|
|
4714
4688
|
//#endregion
|
|
4715
|
-
export {
|
|
4689
|
+
export { readRootStreamReceipt as _, superviseWithTestBrain as a, createSupervisorSpanRecorder as b, resolveWorkerSpawnRetry as c, assertCoordinationBinding as d, resolveSupervisorProfile as f, readRootStream as g, ROOT_STREAM_FILE as h, superviseRootProfile as i, retryPreSpawnRefusals as l, supervisorAgentWithTestBrain as m, profileGuidanceComposer as n, workerFromBackend as o, supervisorAgent as p, supervise as r, isPreSpawnExecutorFailure as s, DEFAULT_AUTHORED_PROFILE_SECURITY_POLICY as t, withWorkerSpawnRetry as u, UNPROVEN_CONTINUITY as v, serveCoordinationMcp as x, composeReentryTask as y };
|
|
4716
4690
|
|
|
4717
|
-
//# sourceMappingURL=supervise-
|
|
4691
|
+
//# sourceMappingURL=supervise-CmeN8ipv.js.map
|