@tangle-network/agent-runtime 0.232.0 → 0.233.1
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-LJ33ygpS.d.ts → activation-C8fPmjWa.d.ts} +2 -2
- package/dist/{activation-BXjgjus6.js → activation-D0_qcEXf.js} +2 -2
- package/dist/{activation-BXjgjus6.js.map → activation-D0_qcEXf.js.map} +1 -1
- package/dist/agent.d.ts +2 -2
- package/dist/agent.js +2 -2
- package/dist/{coordination-driver-hXWuo-1n.js → coordination-driver-BR52Rt39.js} +2 -2
- package/dist/{coordination-driver-hXWuo-1n.js.map → coordination-driver-BR52Rt39.js.map} +1 -1
- package/dist/{delegate-B8b6oHnj.js → delegate-CA-Tnr1_.js} +2 -2
- package/dist/{delegate-B8b6oHnj.js.map → delegate-CA-Tnr1_.js.map} +1 -1
- package/dist/durable.d.ts +11 -2
- package/dist/durable.js +6 -2
- package/dist/durable.js.map +1 -1
- package/dist/{graph-Ce7g744w.js → graph-BtMQMQin.js} +3 -3
- package/dist/{graph-Ce7g744w.js.map → graph-BtMQMQin.js.map} +1 -1
- package/dist/{improvement-cycle-CGAPVMst.js → improvement-cycle-WJJALdil.js} +3 -3
- package/dist/{improvement-cycle-CGAPVMst.js.map → improvement-cycle-WJJALdil.js.map} +1 -1
- package/dist/{index-BnEWL76W.d.ts → index-BwWBXoyq.d.ts} +17 -8
- 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-Q47flacp.js → loop-runner-bin-7cS9NAmk.js} +3 -3
- package/dist/{loop-runner-bin-Q47flacp.js.map → loop-runner-bin-7cS9NAmk.js.map} +1 -1
- package/dist/{loop-runner-bin-BdobVmHx.d.ts → loop-runner-bin-DaOd42mA.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-Dl5AKEtq.d.ts → openai-tools-BdFqNlha.d.ts} +2 -2
- package/dist/profiles.d.ts +2 -2
- package/dist/{provision-supervisor-BXnC4uwd.js → provision-supervisor-BME3OgTk.js} +3 -3
- package/dist/{provision-supervisor-BXnC4uwd.js.map → provision-supervisor-BME3OgTk.js.map} +1 -1
- package/dist/{runtime-CcMvprwa.js → runtime-CcfA_ElB.js} +9 -8
- package/dist/{runtime-CcMvprwa.js.map → runtime-CcfA_ElB.js.map} +1 -1
- package/dist/{server-ClTO4X79.js → server-DU3nDuDb.js} +3 -3
- package/dist/{server-ClTO4X79.js.map → server-DU3nDuDb.js.map} +1 -1
- package/dist/{stream-agent-turn-nAvemLZR.d.ts → stream-agent-turn-aXpd9b_N.d.ts} +2 -2
- package/dist/{structural-rollout-C9z5pjxN.js → structural-rollout-YlkrevWE.js} +2 -2
- package/dist/{structural-rollout-C9z5pjxN.js.map → structural-rollout-YlkrevWE.js.map} +1 -1
- package/dist/{substrate-ijm9h_79.d.ts → substrate-B2Os0b0f.d.ts} +2 -2
- package/dist/{supervise-CLkM45VY.js → supervise-CAJWyXQ-.js} +3 -3
- package/dist/{supervise-CLkM45VY.js.map → supervise-CAJWyXQ-.js.map} +1 -1
- package/dist/{supervisor-BVAM5glY.js → supervisor-C2xWmESG.js} +144 -37
- package/dist/supervisor-C2xWmESG.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-C8Fj6hNL.d.ts → types-F5MG_7Qq.d.ts} +94 -5
- package/package.json +3 -3
- package/dist/supervisor-BVAM5glY.js.map +0 -1
|
@@ -5846,9 +5846,12 @@ function harnessTranscriptUnavailable(reason) {
|
|
|
5846
5846
|
/**
|
|
5847
5847
|
* Enumerate candidate transcript paths inside the environment.
|
|
5848
5848
|
*
|
|
5849
|
-
* `find` is given the roots and prints one `size<TAB>path` line per file. A missing root
|
|
5850
|
-
* an error: a child that never used a harness has no directory for it.
|
|
5851
|
-
*
|
|
5849
|
+
* `find -printf` is given the roots and prints one `size<TAB>path` line per file. A missing root
|
|
5850
|
+
* is not an error: a child that never used a harness has no directory for it. GNU find is the
|
|
5851
|
+
* target (the Tangle Linux box); BSD and BusyBox `find` have no `-printf`, their error is
|
|
5852
|
+
* discarded by `2>/dev/null`, and the empty listing then reads as `no-transcript` — that is a
|
|
5853
|
+
* known limit, not a fallback. A path-only line (no size) is still accepted and bounded after
|
|
5854
|
+
* the read, which is what a stub or a wrapped `find` produces, not what BSD does.
|
|
5852
5855
|
*
|
|
5853
5856
|
* Two omissions used to be silent, so `skippedCount` could read 0 on an incomplete capture: a
|
|
5854
5857
|
* `-size` filter dropped oversized files before they were ever listed, and `head` cut the listing
|
|
@@ -16080,6 +16083,8 @@ async function replaySpawnTree(journal, blobs, root) {
|
|
|
16080
16083
|
status: "unavailable",
|
|
16081
16084
|
reason: "execution-did-not-start"
|
|
16082
16085
|
},
|
|
16086
|
+
...ev.harnessTranscript === void 0 ? {} : { harnessTranscript: ev.harnessTranscript },
|
|
16087
|
+
...ev.retainedExecution === void 0 ? {} : { retainedExecution: ev.retainedExecution },
|
|
16083
16088
|
...settlementTime(ev.at),
|
|
16084
16089
|
seq: ev.seq
|
|
16085
16090
|
});
|
|
@@ -16098,6 +16103,7 @@ async function replaySpawnTree(journal, blobs, root) {
|
|
|
16098
16103
|
...budgetViolationOf(ev),
|
|
16099
16104
|
trace,
|
|
16100
16105
|
...ev.harnessTranscript === void 0 ? {} : { harnessTranscript: ev.harnessTranscript },
|
|
16106
|
+
...ev.retainedExecution === void 0 ? {} : { retainedExecution: ev.retainedExecution },
|
|
16101
16107
|
...settlementTime(ev.at),
|
|
16102
16108
|
seq: ev.seq
|
|
16103
16109
|
});
|
|
@@ -16199,6 +16205,7 @@ function materializeTreeView(events) {
|
|
|
16199
16205
|
node.outRef = ev.outRef;
|
|
16200
16206
|
node.trace = traceEvidenceFor(ev);
|
|
16201
16207
|
node.budgetViolation = budgetViolationOf(ev).budgetViolation;
|
|
16208
|
+
if (ev.retainedExecution !== void 0) node.retainedExecution = ev.retainedExecution;
|
|
16202
16209
|
const settledAt = Date.parse(ev.at);
|
|
16203
16210
|
if (Number.isFinite(settledAt)) node.settledAt = settledAt;
|
|
16204
16211
|
} else if (ev.kind === "woken") {
|
|
@@ -16222,6 +16229,7 @@ function materializeTreeView(events) {
|
|
|
16222
16229
|
node.providerModel = copyProviderModelEvidence(ev.providerModel);
|
|
16223
16230
|
node.outRef = ev.outRef;
|
|
16224
16231
|
node.budgetViolation = budgetViolationOf(ev).budgetViolation;
|
|
16232
|
+
if (ev.retainedExecution !== void 0) node.retainedExecution = ev.retainedExecution;
|
|
16225
16233
|
const settledAt = Date.parse(ev.at);
|
|
16226
16234
|
if (Number.isFinite(settledAt)) node.settledAt = settledAt;
|
|
16227
16235
|
}
|
|
@@ -16327,6 +16335,7 @@ function freezeSnapshot(node) {
|
|
|
16327
16335
|
outRef: node.outRef,
|
|
16328
16336
|
trace: node.trace,
|
|
16329
16337
|
...node.budgetViolation === void 0 ? {} : { budgetViolation: node.budgetViolation },
|
|
16338
|
+
...node.retainedExecution === void 0 ? {} : { retainedExecution: node.retainedExecution },
|
|
16330
16339
|
settledAt: node.settledAt,
|
|
16331
16340
|
spawnedAt: node.spawnedAt
|
|
16332
16341
|
};
|
|
@@ -21572,7 +21581,40 @@ function createScope(args) {
|
|
|
21572
21581
|
clearTimeout(timer);
|
|
21573
21582
|
}
|
|
21574
21583
|
}));
|
|
21575
|
-
|
|
21584
|
+
const prior = released.length > 0 ? await args.journal.loadTree(args.root) ?? [] : [];
|
|
21585
|
+
for (const { child, receipts } of released) {
|
|
21586
|
+
for (const receipt of receipts) await appendEnvironmentTeardown(args.journal, args.root, child.id, receipt, new Date(now()).toISOString());
|
|
21587
|
+
if (child.cleanupConfirmed && child.recoveryPending === true && child.resolved?.kind === "down" && child.settledSeq !== void 0 && child.settledAt !== void 0 && !prior.some((event) => event.id === child.id && closesCursorSlot(event))) {
|
|
21588
|
+
child.budgetViolation = child.retainedViolation;
|
|
21589
|
+
const settledAt = child.settledAt;
|
|
21590
|
+
await args.journal.appendEvent(args.root, terminalDownEvent(child, child.resolved, child.settledSeq, new Date(settledAt).toISOString(), "released"));
|
|
21591
|
+
child.retainedExecution = "released";
|
|
21592
|
+
const releasedAt = now();
|
|
21593
|
+
notifyRuntimeHookEvent(args.hooks, {
|
|
21594
|
+
id: `${child.id}:released`,
|
|
21595
|
+
runId: args.root,
|
|
21596
|
+
target: "agent.child",
|
|
21597
|
+
phase: "after",
|
|
21598
|
+
timestamp: releasedAt,
|
|
21599
|
+
stepIndex: child.settledSeq,
|
|
21600
|
+
parentId: args.parentId,
|
|
21601
|
+
payload: {
|
|
21602
|
+
childId: child.id,
|
|
21603
|
+
status: "down",
|
|
21604
|
+
retainedExecution: "released",
|
|
21605
|
+
releasedAt,
|
|
21606
|
+
...child.resolved.outRef === void 0 ? {} : { outRef: child.resolved.outRef },
|
|
21607
|
+
reason: child.resolved.reason,
|
|
21608
|
+
infra: child.resolved.infra,
|
|
21609
|
+
spent: child.spent,
|
|
21610
|
+
...settledNodeEvidence(child, {
|
|
21611
|
+
...child.resolved,
|
|
21612
|
+
metered: void 0
|
|
21613
|
+
}, settledAt)
|
|
21614
|
+
}
|
|
21615
|
+
}, { signal: args.signal });
|
|
21616
|
+
}
|
|
21617
|
+
}
|
|
21576
21618
|
});
|
|
21577
21619
|
registerScopeRetainedOwner(scope, {
|
|
21578
21620
|
rootId: args.root,
|
|
@@ -21899,35 +21941,21 @@ async function finalizeSettlement(child, settlement, seq, args, now) {
|
|
|
21899
21941
|
if (child.wait) return finalizeWait(child, settlement, seq, args, now, handle);
|
|
21900
21942
|
const settledAt = now();
|
|
21901
21943
|
child.settledAt = settledAt;
|
|
21944
|
+
child.settledSeq = seq;
|
|
21902
21945
|
const at = new Date(settledAt).toISOString();
|
|
21903
21946
|
if (settlement.metered) await appendSettlementMetering(args.journal, args.root, child.id, settlement.metered, at);
|
|
21904
21947
|
if (settlement.kind === "down") {
|
|
21905
|
-
|
|
21906
|
-
child.status = cancellation === void 0 ? "failed" : "cancelled";
|
|
21948
|
+
child.status = child.cancellationReason === void 0 ? "failed" : "cancelled";
|
|
21907
21949
|
child.outRef = settlement.outRef;
|
|
21908
21950
|
child.trace = settlement.trace;
|
|
21909
21951
|
child.providerModel = settlement.providerModel;
|
|
21910
|
-
|
|
21911
|
-
|
|
21912
|
-
|
|
21913
|
-
|
|
21914
|
-
|
|
21915
|
-
|
|
21916
|
-
|
|
21917
|
-
},
|
|
21918
|
-
id: child.id,
|
|
21919
|
-
spent: child.spent,
|
|
21920
|
-
infra: settlement.infra,
|
|
21921
|
-
reason: settlement.reason,
|
|
21922
|
-
...settlement.outRef ? { outRef: settlement.outRef } : {},
|
|
21923
|
-
...settlement.providerModel ? { providerModel: settlement.providerModel } : {},
|
|
21924
|
-
...child.budgetViolation ? { budgetViolation: child.budgetViolation } : {},
|
|
21925
|
-
trace: settlement.trace,
|
|
21926
|
-
...settlement.harnessTranscript ? { harnessTranscript: settlement.harnessTranscript } : {},
|
|
21927
|
-
seq,
|
|
21928
|
-
at
|
|
21929
|
-
});
|
|
21930
|
-
else if (settlement.reconciled !== void 0) await appendReconciledFloor(args.journal, args.root, child.id, settlement.reconciled, at, settlement.harnessTranscript);
|
|
21952
|
+
const retainedPending = child.recoveryPending === true;
|
|
21953
|
+
if (!retainedPending) await args.journal.appendEvent(args.root, terminalDownEvent(child, settlement, seq, at));
|
|
21954
|
+
else {
|
|
21955
|
+
child.retainedExecution = "pending";
|
|
21956
|
+
if (settlement.reconciled !== void 0) await appendReconciledFloor(args.journal, args.root, child.id, settlement.reconciled, at, settlement.harnessTranscript);
|
|
21957
|
+
}
|
|
21958
|
+
const retainedExecution = retainedPending ? { retainedExecution: "pending" } : {};
|
|
21931
21959
|
notifyRuntimeHookEvent(args.hooks, {
|
|
21932
21960
|
id: `${child.id}:settled`,
|
|
21933
21961
|
runId: args.root,
|
|
@@ -21942,6 +21970,7 @@ async function finalizeSettlement(child, settlement, seq, args, now) {
|
|
|
21942
21970
|
...settlement.outRef === void 0 ? {} : { outRef: settlement.outRef },
|
|
21943
21971
|
reason: settlement.reason,
|
|
21944
21972
|
infra: settlement.infra,
|
|
21973
|
+
...retainedExecution,
|
|
21945
21974
|
spent: child.spent,
|
|
21946
21975
|
...settledNodeEvidence(child, settlement, settledAt)
|
|
21947
21976
|
}
|
|
@@ -21951,6 +21980,7 @@ async function finalizeSettlement(child, settlement, seq, args, now) {
|
|
|
21951
21980
|
handle,
|
|
21952
21981
|
reason: settlement.reason,
|
|
21953
21982
|
infra: settlement.infra,
|
|
21983
|
+
...retainedExecution,
|
|
21954
21984
|
...settlement.outRef === void 0 ? {} : { outRef: settlement.outRef },
|
|
21955
21985
|
...settlement.providerModel ? { providerModel: settlement.providerModel } : {},
|
|
21956
21986
|
...child.budgetViolation ? { budgetViolation: child.budgetViolation } : {},
|
|
@@ -22020,6 +22050,35 @@ async function finalizeSettlement(child, settlement, seq, args, now) {
|
|
|
22020
22050
|
* absent — an unreported receipt must not read as an empty one. Snapshots are detached because
|
|
22021
22051
|
* an observer may serialize them after the live child has moved on.
|
|
22022
22052
|
*/
|
|
22053
|
+
/** The one builder of a down child's terminal record, for both its writers: the settle path at
|
|
22054
|
+
* the reconcile and the release sweep closing a retained slot later. Two hand-written literals
|
|
22055
|
+
* for one record shape is how a field lands on one path and not the other (#1244 was exactly
|
|
22056
|
+
* that for `harnessTranscript`). `cancelled` keeps its `source` from the child's own
|
|
22057
|
+
* cancellation reason, so a released cancelled child records the same source it settled with. */
|
|
22058
|
+
function terminalDownEvent(child, settlement, seq, at, retainedExecution) {
|
|
22059
|
+
const cancellation = child.cancellationReason;
|
|
22060
|
+
return {
|
|
22061
|
+
...cancellation === void 0 ? {
|
|
22062
|
+
kind: "settled",
|
|
22063
|
+
status: "down"
|
|
22064
|
+
} : {
|
|
22065
|
+
kind: "cancelled",
|
|
22066
|
+
source: cancellation.source
|
|
22067
|
+
},
|
|
22068
|
+
id: child.id,
|
|
22069
|
+
spent: child.spent,
|
|
22070
|
+
infra: settlement.infra,
|
|
22071
|
+
reason: settlement.reason,
|
|
22072
|
+
...settlement.outRef ? { outRef: settlement.outRef } : {},
|
|
22073
|
+
...settlement.providerModel ? { providerModel: settlement.providerModel } : {},
|
|
22074
|
+
...child.budgetViolation ? { budgetViolation: child.budgetViolation } : {},
|
|
22075
|
+
trace: settlement.trace,
|
|
22076
|
+
...settlement.harnessTranscript ? { harnessTranscript: settlement.harnessTranscript } : {},
|
|
22077
|
+
...retainedExecution === void 0 ? {} : { retainedExecution },
|
|
22078
|
+
seq,
|
|
22079
|
+
at
|
|
22080
|
+
};
|
|
22081
|
+
}
|
|
22023
22082
|
function settledNodeEvidence(child, settlement, settledAt) {
|
|
22024
22083
|
return {
|
|
22025
22084
|
runtime: child.runtime,
|
|
@@ -22307,6 +22366,7 @@ async function runChild(live, executor, childAbort, task, opts, pool, ticket, bl
|
|
|
22307
22366
|
ms
|
|
22308
22367
|
});
|
|
22309
22368
|
}
|
|
22369
|
+
live.retainedViolation = live.budgetViolation;
|
|
22310
22370
|
live.budgetViolation = void 0;
|
|
22311
22371
|
return {
|
|
22312
22372
|
...downRecord(errMessage(err), true, trace, executor.metered?.(), void 0, retainedOutputRef, await persistTranscriptOnce()),
|
|
@@ -22401,7 +22461,8 @@ function makeTreeView(root, children) {
|
|
|
22401
22461
|
...c.outRef ? { outRef: c.outRef } : {},
|
|
22402
22462
|
...c.trace ? { trace: c.trace } : {},
|
|
22403
22463
|
...c.providerModel ? { providerModel: c.providerModel } : {},
|
|
22404
|
-
...c.budgetViolation ? { budgetViolation: c.budgetViolation } : {}
|
|
22464
|
+
...c.budgetViolation ? { budgetViolation: c.budgetViolation } : {},
|
|
22465
|
+
...c.retainedExecution ? { retainedExecution: c.retainedExecution } : {}
|
|
22405
22466
|
}));
|
|
22406
22467
|
return {
|
|
22407
22468
|
root,
|
|
@@ -23843,7 +23904,7 @@ function createSupervisor() {
|
|
|
23843
23904
|
pool.assertNoOpenTickets();
|
|
23844
23905
|
const outRef = contentAddress(out);
|
|
23845
23906
|
await opts.blobs.put(outRef, out);
|
|
23846
|
-
const { spentTotal, childWork, driverInference, gaps, providerModel } = await terminalAccounting(journal, opts.runId, now() - runEpochMs);
|
|
23907
|
+
const { spentTotal, childWork, driverInference, gaps, providerModel, fleetYield } = await terminalAccounting(journal, opts.runId, now() - runEpochMs);
|
|
23847
23908
|
return {
|
|
23848
23909
|
kind: "winner",
|
|
23849
23910
|
out,
|
|
@@ -23853,6 +23914,7 @@ function createSupervisor() {
|
|
|
23853
23914
|
providerModel,
|
|
23854
23915
|
...teardownUnconfirmed.length > 0 ? { teardownUnconfirmed } : {},
|
|
23855
23916
|
...gaps.length > 0 ? { spendGaps: gaps } : {},
|
|
23917
|
+
fleetYield,
|
|
23856
23918
|
...isNonEmptySpend(driverInference) ? { spentBreakdown: {
|
|
23857
23919
|
driverInference,
|
|
23858
23920
|
childWork
|
|
@@ -23863,7 +23925,7 @@ function createSupervisor() {
|
|
|
23863
23925
|
}
|
|
23864
23926
|
return noWinner({ error: actOutcome.error });
|
|
23865
23927
|
async function noWinner(rejection) {
|
|
23866
|
-
const { spentTotal, gaps, providerModel } = await terminalAccounting(journal, opts.runId, now() - runEpochMs);
|
|
23928
|
+
const { spentTotal, gaps, providerModel, fleetYield } = await terminalAccounting(journal, opts.runId, now() - runEpochMs);
|
|
23867
23929
|
const common = {
|
|
23868
23930
|
kind: "no-winner",
|
|
23869
23931
|
tree,
|
|
@@ -23872,7 +23934,8 @@ function createSupervisor() {
|
|
|
23872
23934
|
providerModel,
|
|
23873
23935
|
...teardownUnconfirmed.length > 0 ? { teardownUnconfirmed } : {},
|
|
23874
23936
|
...leakedReservations.length > 0 ? { leakedReservations } : {},
|
|
23875
|
-
...gaps.length > 0 ? { spendGaps: gaps } : {}
|
|
23937
|
+
...gaps.length > 0 ? { spendGaps: gaps } : {},
|
|
23938
|
+
fleetYield
|
|
23876
23939
|
};
|
|
23877
23940
|
const lifecycle = classifyNoWinner(executionAborted, pool, opts, breaker, deadlineExceeded, allChildrenDownAtSettle, downCountAtSettle);
|
|
23878
23941
|
if (controller.signal.reason instanceof RunCancellationReason) {
|
|
@@ -24004,13 +24067,21 @@ function createIntensityBreaker(opts, trip) {
|
|
|
24004
24067
|
}
|
|
24005
24068
|
/** Decorate the journal so the breaker observes every `settled`-`down` event the scope
|
|
24006
24069
|
* appends, without the supervisor intercepting `scope.next()`. The decorator is
|
|
24007
|
-
* transparent — it forwards every method verbatim and only reads the down events.
|
|
24070
|
+
* transparent — it forwards every method verbatim and only reads the down events.
|
|
24071
|
+
*
|
|
24072
|
+
* A record marked `retainedExecution: 'released'` is skipped: it is the driver's earlier down
|
|
24073
|
+
* re-stated by the release sweep, which runs AFTER the join barrier and before the result is
|
|
24074
|
+
* classified. Counting it would trip an armed breaker on a run that has already settled and turn
|
|
24075
|
+
* a delivered winner into `all-children-down`, and its backdated `at` (the settlement instant)
|
|
24076
|
+
* would sit out of order in the sliding window. A retained child was never counted at its
|
|
24077
|
+
* settlement either (it writes no `settled` record then), so `downCount` stays what it was:
|
|
24078
|
+
* ordinary downs only; `fleetYield.down` is where a retained child is counted. */
|
|
24008
24079
|
function wrapJournalForBreaker(journal, breaker) {
|
|
24009
24080
|
return {
|
|
24010
24081
|
loadTree: (root) => journal.loadTree(root),
|
|
24011
24082
|
beginTree: (root, at) => journal.beginTree(root, at),
|
|
24012
24083
|
appendEvent: (root, ev) => {
|
|
24013
|
-
if (ev.kind === "settled" && ev.status === "down") breaker.recordDown(Date.parse(ev.at));
|
|
24084
|
+
if (ev.kind === "settled" && ev.status === "down" && ev.retainedExecution === void 0) breaker.recordDown(Date.parse(ev.at));
|
|
24014
24085
|
return journal.appendEvent(root, ev);
|
|
24015
24086
|
}
|
|
24016
24087
|
};
|
|
@@ -24120,7 +24191,9 @@ async function terminalAccounting(journal, root, elapsedMs) {
|
|
|
24120
24191
|
if (events === void 0) throw new RuntimeRunStateError(`supervisor: spawn tree '${root}' is missing from the journal after run (corrupted log)`);
|
|
24121
24192
|
const { childWork, driverInference } = sumSpendFromEvents(events);
|
|
24122
24193
|
const gaps = spendGapsFromEvents(events);
|
|
24123
|
-
const
|
|
24194
|
+
const forest = await loadSpawnForest(journal, root);
|
|
24195
|
+
const providerModel = aggregateProviderModelEvidence(forest);
|
|
24196
|
+
const fleetYield = fleetYieldFromForest(forest);
|
|
24124
24197
|
const summed = addSpend(childWork, driverInference);
|
|
24125
24198
|
return {
|
|
24126
24199
|
spentTotal: {
|
|
@@ -24132,8 +24205,42 @@ async function terminalAccounting(journal, root, elapsedMs) {
|
|
|
24132
24205
|
childWork,
|
|
24133
24206
|
driverInference,
|
|
24134
24207
|
gaps,
|
|
24135
|
-
providerModel
|
|
24136
|
-
|
|
24208
|
+
providerModel,
|
|
24209
|
+
fleetYield
|
|
24210
|
+
};
|
|
24211
|
+
}
|
|
24212
|
+
/** How the run's spawned children ended, by node id across every tree of the forest. Read after
|
|
24213
|
+
* the join barrier and the release sweep, so the terminal records the sweep wrote are in it.
|
|
24214
|
+
* Spawned records without a parent are exempt: the run root, and the re-rooted owner copy a
|
|
24215
|
+
* nested driver writes as its tree's first record (`ownedTreeRootSpawn` strips the parent), so
|
|
24216
|
+
* a manager is counted once, in its parent's tree. Buckets are id sets rather than record counts
|
|
24217
|
+
* because the journal guards seq uniqueness, not one-terminal-per-node, and the invariant
|
|
24218
|
+
* `spawned === done + down + cancelled + neverSettled` must not rest on scope discipline alone;
|
|
24219
|
+
* it is asserted here so a future root-id terminal record cannot silently break the tally. */
|
|
24220
|
+
function fleetYieldFromForest(forest) {
|
|
24221
|
+
const spawned = /* @__PURE__ */ new Set();
|
|
24222
|
+
const terminal = /* @__PURE__ */ new Map();
|
|
24223
|
+
const released = /* @__PURE__ */ new Set();
|
|
24224
|
+
for (const { event } of forest.events) if (event.kind === "spawned") {
|
|
24225
|
+
if (event.parent !== void 0) spawned.add(event.id);
|
|
24226
|
+
} else if (event.kind === "settled" || event.kind === "cancelled") {
|
|
24227
|
+
const bucket = event.kind === "cancelled" ? "cancelled" : event.status;
|
|
24228
|
+
terminal.set(event.id, bucket);
|
|
24229
|
+
if (event.retainedExecution === "released" && bucket !== "done") released.add(event.id);
|
|
24230
|
+
else released.delete(event.id);
|
|
24231
|
+
}
|
|
24232
|
+
const count = (bucket) => [...terminal.values()].filter((value) => value === bucket).length;
|
|
24233
|
+
const fleetYield = {
|
|
24234
|
+
spawned: spawned.size,
|
|
24235
|
+
done: count("done"),
|
|
24236
|
+
down: count("down"),
|
|
24237
|
+
cancelled: count("cancelled"),
|
|
24238
|
+
neverSettled: forest.inDoubt.length,
|
|
24239
|
+
releasedUnrecovered: released.size
|
|
24240
|
+
};
|
|
24241
|
+
if (fleetYield.done + fleetYield.down + fleetYield.cancelled + fleetYield.neverSettled !== fleetYield.spawned) throw new RuntimeRunStateError(`supervisor: fleet yield does not partition the spawned children of '${forest.root}' (${JSON.stringify(fleetYield)})`);
|
|
24242
|
+
if (fleetYield.releasedUnrecovered > fleetYield.down + fleetYield.cancelled) throw new RuntimeRunStateError(`supervisor: released children exceed down + cancelled for '${forest.root}' (${JSON.stringify(fleetYield)})`);
|
|
24243
|
+
return fleetYield;
|
|
24137
24244
|
}
|
|
24138
24245
|
/** The journaled nodes whose usage accounting is incomplete — one `SpendGap` per node+kind,
|
|
24139
24246
|
* channels merged. A spawn with no terminal record (`settled`/`cancelled`/`woken`) is
|
|
@@ -24199,4 +24306,4 @@ function isNonEmptySpend(s) {
|
|
|
24199
24306
|
//#endregion
|
|
24200
24307
|
export { bindReusableExecutorExecutionId as $, providerMessageText as $i, buildRuntimeEventOtelSpans as $n, providerAttemptEvidence as $r, addHarnessUsage as $t, waitUntil as A, deleteBoxSafe as Ai, RunCancellationReason as An, profileMaterializationAxes$1 as Ar, spendFromUsageTotals as At, attachWorker as B, withTimeout as Bi, defaultRedactorIdentityMaterial as Bn, worktreeCliProfileMaterialization as Br, createInbox as Bt, scopeOwnerExecutorNodeContext as C, notifySandboxEventObserver as Ci, resolveAgentEnvironmentProvider as Cn, parseCodexTokenUsage as Cr, workerTraceAnalysisStore as Ct, pollFor as D, addSpend as Di, sandboxSessionTraceSource as Dn, controlProfileMaterialization as Dr, meterUsageEvent as Dt, isWaitOutcome as E, sumSandboxUsage as Ei, decodeToolPart as En, assertProfileMaterialization as Er, createBudgetPool as Et, scopeRetainedOwnerPriorSpend as F, sleep as Fi, recoverRetainedRun as Fn, renderProfileMaterializationIssues as Fr, workerTraceSeamKey as Ft, recoverRetainedInteractiveRun as G, decodeHarnessUsage as Gi, contentAddress as Gn, attestRuntimeOwnedPendingExecutor as Gr, createPeerMailbox as Gt, workerInteractiveBindingFile as H, addResourceSpend as Hi, captureHarnessTranscript as Hn, parseCommittedJsonLines as Hr, DEFAULT_PEER_MAIL_LIMITS as Ht, scopeRetainedOwnerResult as I, stringifySafe as Ii, startRetainedRun as In, renderUnsupported as Ir, taskToPrompt as It, errMessage as J, DEFAULT_SUCCESSFUL_SHUTDOWN_MS as Ji, readTraceContextFromEnv as Jn, finalizeRuntimeOwnedPendingExecutor as Jr, peerMailVerbNames as Jt, startRetainedInteractiveRun as K, abortError$2 as Ki, createPropagatingTraceEmitter as Kn, attestRuntimeOwnedScopeOwner as Kr, isPeerMailEnvelope as Kt, interactiveAdmissionSeamKey as L, throwAbort as Li, startRetainedRunInEnvironment as Ln, sandboxActProfileMaterialization as Lr, DEFAULT_STALL_AFTER_MS as Lt, consumeScopeRetainedOwnerResult as M, isAbortError$2 as Mi, linkAbort as Mn, promptModelProfileMaterialization as Mr, readWorkerTraceContext as Mt, prepareScopeRetainedOwnerTask as N, promptCacheTokenClasses as Ni, runAbortable as Nn, promptOnlyProfileMaterialization as Nr, workerTraceEnv as Nt, timerAt as O, chargedTokens as Oi, registerRetainedExecutorPreparation as On, defineProfileMaterializationContract as Or, newUsageTotals as Ot, scopeRetainedOwnerContext as P, randomSuffix as Pi, reconnectRetainedRun as Pn, promptResourceProfileMaterialization as Pr, workerTraceHeaders as Pt, rollingDispatch as Q, promptOptionsFromAgentTurnInput as Qi, buildLoopSpanNodes as Qn, newExecutionAttemptId as Qr, bridgeModelRouteRefusal as Qt, readWorkerInteractiveAdmissions as R, throwIfAborted as Ri, retainedCreateMaterial as Rn, unsupportedProfileDimensions as Rr, createActivityLog as Rt, restoreScopeOwnerAcceptedExecution as S, mapSandboxToolEvent as Si, providerAsSandboxClient as Sn, localHarnessExecutable as Sr, parseWorkerToolTraceArtifact as St, createWaitProbes as T, sandboxProgressEvents as Ti, createPushTraceSource as Tn, AGENT_PROFILE_MATERIALIZATION_AXES as Tr, assertValidBudget as Tt, workerInteractiveBindingsDir as U, resourceTelemetry as Ui, harnessTranscriptArtifact as Un, prepareJsonlAppend as Ur, PEER_MAIL_WIRE_KEY as Ut, readWorkerInteractiveBinding as V, zeroSpend as Vi, resolveRedactor as Vn, isNoEntError as Vr, AUTHORITY_MARKERS as Vt, reconnectRetainedInteractiveRun as W, withBudgetResources as Wi, persistHarnessTranscript as Wn, writeAllBytes as Wr, claimsAuthority as Wt, freeSlots as X, teardownExecutor as Xi, INTELLIGENCE_WIRE_VERSION as Xn, knownExecutionBindingReceipt as Xr, isTerminalNodeStatus as Xt, effectiveConcurrency as Y, armDeadlineTimer as Yi, traceContextToEnv as Yn, inheritRuntimeOwnedExecutorAttestation as Yr, isLiveNodeStatus as Yt, queueOf as Z, promptFromAgentTurnInput as Zi, buildLoopOtelSpans as Zn, knownMaterializationReceipt as Zr, bridgeAdmissionRefusal as Zt, createScope as _, createSandboxToolPartState as _i, canonicalObservedModelParts as _n, createWorktree as _r, pendingWaits as _t, pickBestDelivered as a, runtimeOwnedPendingExecutorMaterialization as ai, TERMINAL_DECISIONS as an, loopEventToOtelSpan as ar, snapshotExecutorConfig as at, meterRuntimeOwnedProviderAttempt as b, isSandboxTerminalEvent as bi, createAgentEnvironmentProviderRegistry as bn, LOCAL_HARNESSES as br, captureWorkerTraceEvidence as bt, DriverAttemptsExhaustedError as c, unknownMaterializationReceipt as ci, isTerminalDecision as cn, toOtelAttributes as cr, createSteerableSandboxSession as ct, runDriverWithRetry as d, detachedFrozen as di, probeSandboxCapabilities as dn, sanitizeAgentRuntimeEvent as dr, FileSpawnJournal as dt, recordRuntimeOwnedDriveHarnessProviderEvidence as ei, createCodexRolloutStoreReader as en, createOpenInferenceFileExporter as er, captureReusableExecutorConfig as et, driverChild as f, detachedSnapshot as fi, acquireSandbox as fn, sanitizeKnowledgeReadinessReport as fr, InMemoryResultBlobStore as ft, beginScopeOwnerAttempt as g, canonicalStreamEventFromSandboxEvent as gi, runBrainLoop as gn, captureWorktreeDiff as gr, materializeTreeView as gt, withDriverExecutor as h, assertSandboxServedModel as hi, routerBrain as hn, runWorktreeHarness as hr, loadSpawnForest as ht, collectDelivered as i, runtimeOwnedExecutorProviderEvidence as ii, bridgeStopSignalKey as in, generateSpanId as ir, createExecutorRegistry as it, bindScopeRetainedOwnerProvider as j, hasCompleteCacheBreakdown as ji, abortError as jn, promptControlProfileMaterialization as jr, WORKER_TRACE_PROPAGATION as jt, validateWaitSpec as k, cloneSpend as ki, retainedExecutorSeamKey as kn, fullProfileMaterialization as kr, spendFromUsageEvents as kt, classifyDriverFailure as l, executableAgentProfileSnapshot as li, runAgentRounds as ln, createRuntimeEventCollector as lr, createInPlaceCliExecutor as lt, isDriverSpec as m, readSandboxOutcome as mi, readPromptOptions as mn, runSettledCommand as mr, insideCursorNamespace as mt, createSupervisor as n, runtimeOwnedExecutorExecutionBinding as ni, readCodexRolloutSession as nn, exportEvalRuns as nr, cliWorktreeExecutor as nt, runFinalizer as o, runtimeOwnedScopeOwnerRuntime as oi, createSandboxForSpec as on, padSpanId as or, createWorktreeCliExecutor as ot, driverExecutorFactory as p, projectSandboxOutcome as pi, assertBoxlessPromptOptions as pn, sanitizeRuntimeStreamEvent as pr, InMemorySpawnJournal as pt, destroyInteractiveEnvironment as q, awaitAbortable$1 as qi, mergeTraceEnv as qn, authoredProfileDigest as qr, peerMailTools as qt, bestDelivered as r, runtimeOwnedExecutorMaterialization as ri, bridgeRuntimeAttachmentsKey as rn, flatOtelSpan as rr, createExecutor as rt, runTree as s, unknownExecutionBindingReceipt as si, defaultSelectWinner as sn, padTraceId as sr, DEFAULT_SANDBOX_STEERING_MAX_TURNS as st, createRootHandle as t, runtimeOwnedDriveHarnessProviderEvidence as ti, harnessUsageIsEmpty as tn, createOtelExporter as tr, cliInPlaceExecutor as tt, defaultUnmetContractSteer as u, executableAgentSpecSnapshot as ui, createSandboxLineage as un, createRuntimeStreamEventCollector as ur, FileResultBlobStore as ut, deriveNodeExecutionIdentity as v, createSandboxUsageLedger as vi, observedModelMatchesDeclared as vn, removeWorktree as vr, replaySpawnTree as vt, settledToIteration as w, sandboxEventServedBackend as wi, sandboxClientAsProvider as wn, CodexExecutionDiagnosticError as wr, BudgetReconcileFault as wt, recordScopeOwnerMaterialization as x, mapSandboxEvent as xi, providerAsExecutor as xn, harnessSupportsReasoningEffort as xr, isTraceAnalysisStore as xt, meterRuntimeOwnedAccounting as y, extractLlmCallEvent as yi, DEFAULT_SANDBOX_IDLE_TIMEOUT_SECONDS as yn, DEFAULT_LOCAL_HARNESS as yr, WORKER_TOOL_TRACE_SCHEMA_VERSION as yt, workerInteractiveAdmissionFile as z, unmeteredSpend as zi, defaultRedactor as zn, validateProfileMaterialization as zr, readWorkerProgress as zt };
|
|
24201
24308
|
|
|
24202
|
-
//# sourceMappingURL=supervisor-
|
|
24309
|
+
//# sourceMappingURL=supervisor-C2xWmESG.js.map
|