@tangle-network/agent-runtime 9.0.2 → 9.0.4
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/CHANGELOG.md +18 -0
- package/dist/{activation-BrBDs0Yj.js → activation-CHTcCoOU.js} +2 -2
- package/dist/{activation-BrBDs0Yj.js.map → activation-CHTcCoOU.js.map} +1 -1
- package/dist/{activation-CoVktVKr.d.ts → activation-OSYxeVWi.d.ts} +2 -2
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +3 -3
- package/dist/{coordination-manager-DKmQGzBB.js → coordination-manager-C5G6oB-x.js} +68 -38
- package/dist/coordination-manager-C5G6oB-x.js.map +1 -0
- package/dist/{delegate-CHGMIC6s.js → delegate-NEQtLI5w.js} +2 -2
- package/dist/{delegate-CHGMIC6s.js.map → delegate-NEQtLI5w.js.map} +1 -1
- package/dist/durable.d.ts +1 -1
- package/dist/durable.js +9 -9
- package/dist/{failure-cause-CVB-YE88.js → failure-cause-BE3qg7OI.js} +2 -2
- package/dist/failure-cause-BE3qg7OI.js.map +1 -0
- package/dist/{graph-BRlI0CEL.js → graph-pyV29Pei.js} +25 -28
- package/dist/graph-pyV29Pei.js.map +1 -0
- package/dist/{improve-CnTEGkF6.js → improve-98tlsS0O.js} +6 -6
- package/dist/{improve-CnTEGkF6.js.map → improve-98tlsS0O.js.map} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +10 -10
- package/dist/intelligence.d.ts +2 -2
- package/dist/intelligence.js +4 -4
- package/dist/kernel.d.ts +1 -1
- package/dist/kernel.js +13 -13
- package/dist/{loop-runner-DZeXWH78.d.ts → loop-runner-CCdQ1pmE.d.ts} +2 -2
- package/dist/loop-runner-bin.d.ts +1 -1
- package/dist/loop-runner-bin.js +1 -1
- package/dist/{loop-runner-CqPsP7uW.js → loop-runner-hZugKket.js} +2 -2
- package/dist/{loop-runner-CqPsP7uW.js.map → loop-runner-hZugKket.js.map} +1 -1
- package/dist/mcp/bin.js +3 -3
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +6 -6
- package/dist/mcp/memory-bin.js +1 -1
- package/dist/profiles.d.ts +1 -1
- package/dist/{provision-supervisor-B-ULubUf.js → provision-supervisor-BZzh3-qy.js} +5 -5
- package/dist/{provision-supervisor-B-ULubUf.js.map → provision-supervisor-BZzh3-qy.js.map} +1 -1
- package/dist/{run-cancellation-DZn4OSl8.js → run-cancellation-BfOYso1K.js} +2 -2
- package/dist/{run-cancellation-DZn4OSl8.js.map → run-cancellation-BfOYso1K.js.map} +1 -1
- package/dist/{run-state-nbF5NNGy.js → run-state-JBy64gPw.js} +5 -5
- package/dist/{run-state-nbF5NNGy.js.map → run-state-JBy64gPw.js.map} +1 -1
- package/dist/{runtime-9ZCcT0kP.js → runtime-ClVpsN9W.js} +13 -13
- package/dist/{runtime-9ZCcT0kP.js.map → runtime-ClVpsN9W.js.map} +1 -1
- package/dist/{search-executor-2xqDTDNO.js → search-executor-dpFpe2iW.js} +4 -4
- package/dist/{search-executor-2xqDTDNO.js.map → search-executor-dpFpe2iW.js.map} +1 -1
- package/dist/{server-D3RV-84X.js → server-Dj1OZSJE.js} +4 -4
- package/dist/{server-D3RV-84X.js.map → server-Dj1OZSJE.js.map} +1 -1
- package/dist/{settle-record-B95oiypS.js → settle-record-CMcLWmB8.js} +2 -2
- package/dist/{settle-record-B95oiypS.js.map → settle-record-CMcLWmB8.js.map} +1 -1
- package/dist/{structural-rollout-BHNqBUV0.js → structural-rollout-BAr-r83B.js} +4 -4
- package/dist/{structural-rollout-BHNqBUV0.js.map → structural-rollout-BAr-r83B.js.map} +1 -1
- package/dist/{supervise-CULDLjjS.js → supervise-BatPUJkn.js} +34 -10
- package/dist/supervise-BatPUJkn.js.map +1 -0
- package/dist/{supervision-discovery-DUpm_6nQ.js → supervision-discovery-Ch0ZtXCd.js} +3 -3
- package/dist/{supervision-discovery-DUpm_6nQ.js.map → supervision-discovery-Ch0ZtXCd.js.map} +1 -1
- package/dist/{supervisor-BhcXPxAk.js → supervisor-CDxtn00P.js} +80 -20
- package/dist/supervisor-CDxtn00P.js.map +1 -0
- package/dist/{supervisor-accounting-BB22j3hu.js → supervisor-accounting-DIEwaMfr.js} +65 -80
- package/dist/supervisor-accounting-DIEwaMfr.js.map +1 -0
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +11 -11
- package/dist/{tool-server-DYwRbi0I.js → tool-server-CnhRLpwg.js} +2 -2
- package/dist/{tool-server-DYwRbi0I.js.map → tool-server-CnhRLpwg.js.map} +1 -1
- package/dist/{top-web-DsFGyUlS.js → top-web-Cx4U6mkL.js} +6 -6
- package/dist/{top-web-DsFGyUlS.js.map → top-web-Cx4U6mkL.js.map} +1 -1
- package/dist/tui/bin.js +3 -3
- package/dist/tui/index.d.ts +1 -1
- package/dist/tui/index.js +2 -2
- package/dist/{types-CTp7j9jD.d.ts → types-KQkbyDmn.d.ts} +58 -6
- package/package.json +3 -3
- package/skills/profile-authoring/SKILL.md +57 -120
- package/skills/profile-authoring/references/acceptance-examples.md +15 -10
- package/skills/profile-authoring/references/execution-and-credentials.md +2 -7
- package/skills/profile-authoring/references/profile-contract.md +59 -0
- package/skills/profile-authoring/references/research-directors.md +1 -5
- package/dist/coordination-manager-DKmQGzBB.js.map +0 -1
- package/dist/failure-cause-CVB-YE88.js.map +0 -1
- package/dist/graph-BRlI0CEL.js.map +0 -1
- package/dist/supervise-CULDLjjS.js.map +0 -1
- package/dist/supervisor-BhcXPxAk.js.map +0 -1
- package/dist/supervisor-accounting-BB22j3hu.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { c as RetainedInteractiveAdmissionError, d as RetainedRunDispatchBindingError, f as RuntimeRunStateError, l as RetainedInteractiveBindingError, m as ValidationError, r as BackendTransportError, u as RetainedRunAdmissionError } from "./errors-DG8yufqX.js";
|
|
2
2
|
import { A as withBudgetResources, B as singleFlightTeardown, C as unreportedSpend, D as addResourceSpend, I as armDeadlineTimer, L as boundedChildDeadlineAt, M as CHILD_DEADLINE_REASON, R as checkInIdleMs, T as zeroSpend, V as teardownExecutor, a as cloneSpend, c as errorMessage, f as isAsyncIterable, i as chargedTokens, k as resourceTelemetry, n as addSpend, o as cloneTokenUsage, t as abortError, v as sleep } from "./util-fcckrkKp.js";
|
|
3
|
-
import { $ as spendFromUsageTotals, F as executorFailureInfra, G as budgetLeases, I as executorFailureReason, J as createBudgetPool, K as budgetRecoverySeeds, M as contentAddress, P as executorFailure, Tt as recordValue, U as BudgetReconcileFault, W as budgetLeaseUpdates, X as meterUsageEvent, Y as refreshBudgetLease, Z as newUsageTotals, dt as parseCanonicalTransportEvent, et as assertValidBudget, f as executorEvidenceWriter, g as prepareRetainedExecutor, h as leafContinuationExecutionId, j as traceRootWriter, n as runtimeFailureCause, o as settlementFailureCause, q as completedLeafBacking, s as BUDGET_CONTINUATION_TASK, t as reportedFailureCause, tt as assertValidSpend, u as RetainedExecutionPendingError, ut as extractTransportEventIdentity, y as retainedExecutorSeamKey } from "./failure-cause-
|
|
3
|
+
import { $ as spendFromUsageTotals, F as executorFailureInfra, G as budgetLeases, I as executorFailureReason, J as createBudgetPool, K as budgetRecoverySeeds, M as contentAddress, P as executorFailure, Tt as recordValue, U as BudgetReconcileFault, W as budgetLeaseUpdates, X as meterUsageEvent, Y as refreshBudgetLease, Z as newUsageTotals, dt as parseCanonicalTransportEvent, et as assertValidBudget, f as executorEvidenceWriter, g as prepareRetainedExecutor, h as leafContinuationExecutionId, j as traceRootWriter, n as runtimeFailureCause, o as settlementFailureCause, q as completedLeafBacking, s as BUDGET_CONTINUATION_TASK, t as reportedFailureCause, tt as assertValidSpend, u as RetainedExecutionPendingError, ut as extractTransportEventIdentity, y as retainedExecutorSeamKey } from "./failure-cause-BE3qg7OI.js";
|
|
4
4
|
import { a as errMessage, f as resolveRedactor, l as errorText, n as detachedSnapshot, r as shareParsedStrings, u as defaultRedactor } from "./snapshot-BKI_w3JD.js";
|
|
5
5
|
import { t as assertExecutableAgentProfile } from "./model-policy-CZwhXp8O.js";
|
|
6
6
|
import { a as readCommittedJsonLines, c as appendCommittedJsonLine, l as sha256, r as prepareJsonlAppend, s as withJsonlFileLock, t as isNoEntError } from "./jsonl-file-DsxVI0E_.js";
|
|
@@ -4776,7 +4776,7 @@ function assertRetainedCapabilityRequirements(providerName, capabilities) {
|
|
|
4776
4776
|
const WORKSPACE_CHECKPOINT_MARKER_PATH = ".agent-runtime-checkpoint";
|
|
4777
4777
|
/** Bound on one checkpoint: environment lookup, marker write, and the provider operation. */
|
|
4778
4778
|
const WORKSPACE_CHECKPOINT_TIMEOUT_MS = 12e4;
|
|
4779
|
-
/** Bound on the
|
|
4779
|
+
/** Bound on the deletes one checkpoint rotation runs. A turn capture cuts them short; the release deletes the rest. */
|
|
4780
4780
|
const WORKSPACE_CHECKPOINT_ROTATION_CAPTURES_MS = 12e4;
|
|
4781
4781
|
/** Write the marker. False when the environment cannot take it, so no restore can be verified. */
|
|
4782
4782
|
async function writeWorkspaceMarker(environment, marker, signal) {
|
|
@@ -4877,11 +4877,13 @@ async function stopRetainedNativeExecution(options) {
|
|
|
4877
4877
|
* its last turn, so the receipt says so instead of letting a reader take the settled spend as
|
|
4878
4878
|
* complete.
|
|
4879
4879
|
*/
|
|
4880
|
+
/** The phrase a stop description carries when the harness may still be running. */
|
|
4881
|
+
const NATIVE_STOP_UNCONFIRMED = "it may still be running";
|
|
4880
4882
|
function describeRetainedNativeStops(stops) {
|
|
4881
4883
|
return stops.map((stop) => {
|
|
4882
4884
|
if (stop.effect === "cancelled") return `native execution ${stop.executionId} stopped at ${stop.at}; usage unknown: killed at ${stop.at}`;
|
|
4883
4885
|
if (stop.effect === "not_live") return `native execution ${stop.executionId} was not live at ${stop.at}`;
|
|
4884
|
-
return `native execution ${stop.executionId} stop unconfirmed at ${stop.at} (effect ${stop.effect}${stop.error === void 0 ? "" : `: ${stop.error}`});
|
|
4886
|
+
return `native execution ${stop.executionId} stop unconfirmed at ${stop.at} (effect ${stop.effect}${stop.error === void 0 ? "" : `: ${stop.error}`}); ${NATIVE_STOP_UNCONFIRMED}`;
|
|
4885
4887
|
}).join("; ");
|
|
4886
4888
|
}
|
|
4887
4889
|
// src/runtime/supervise/executor-observation.ts
|
|
@@ -5659,30 +5661,14 @@ function pendingCheckpoints(events, state) {
|
|
|
5659
5661
|
return events.filter((event) => event.kind === "workspace-checkpoint" && event.id === state.args.nodeId && event.provider === state.provider?.name && !confirmed.has(JSON.stringify([event.environmentId, event.checkpoint.checkpointId])));
|
|
5660
5662
|
}
|
|
5661
5663
|
// src/runtime/supervise/retained-owner-checkpoint-capture.ts
|
|
5662
|
-
/**
|
|
5663
|
-
|
|
5664
|
+
/**
|
|
5665
|
+
* Delete restore-point checkpoints. A checkpoint is a restore point for a live owner, never
|
|
5666
|
+
* evidence: the turn's workspace capture and native session export are the evidence, and the
|
|
5667
|
+
* release keeps a source whose evidence is incomplete. An aborted parent starts no provider call.
|
|
5668
|
+
*/
|
|
5669
|
+
async function cleanCheckpoints(state, branching, checkpoints, parent) {
|
|
5664
5670
|
const unconfirmed = [];
|
|
5665
|
-
const refused = [];
|
|
5666
5671
|
for (const event of checkpoints) {
|
|
5667
|
-
const captured = captureBeforeCleanup(state, event, events, uncapturable);
|
|
5668
|
-
if ("reason" in captured) {
|
|
5669
|
-
state.captureRefused ??= /* @__PURE__ */ new Set();
|
|
5670
|
-
state.captureRefused.add(event.checkpoint.checkpointId);
|
|
5671
|
-
refused.push(captured);
|
|
5672
|
-
await state.args.journal.appendEvent(state.args.rootId, {
|
|
5673
|
-
kind: "workspace-checkpoint-cleanup",
|
|
5674
|
-
id: state.args.nodeId,
|
|
5675
|
-
provider: event.provider,
|
|
5676
|
-
environmentId: event.environmentId,
|
|
5677
|
-
checkpointId: event.checkpoint.checkpointId,
|
|
5678
|
-
confirmed: false,
|
|
5679
|
-
refused: captured.reason.slice(0, 1e3),
|
|
5680
|
-
seq: state.nextSequence(),
|
|
5681
|
-
at: new Date(state.args.now()).toISOString()
|
|
5682
|
-
});
|
|
5683
|
-
continue;
|
|
5684
|
-
}
|
|
5685
|
-
state.captureRefused?.delete(event.checkpoint.checkpointId);
|
|
5686
5672
|
const material = {
|
|
5687
5673
|
kind: "checkpoint",
|
|
5688
5674
|
targetId: event.checkpoint.checkpointId,
|
|
@@ -5719,28 +5705,11 @@ async function cleanCheckpoints(state, branching, checkpoints, events, parent, u
|
|
|
5719
5705
|
checkpointId: event.checkpoint.checkpointId,
|
|
5720
5706
|
confirmed,
|
|
5721
5707
|
...reason === void 0 ? {} : { refused: reason.slice(0, 1e3) },
|
|
5722
|
-
...captured.digest === void 0 ? {} : { capturedDigest: captured.digest },
|
|
5723
5708
|
seq: state.nextSequence(),
|
|
5724
5709
|
at: new Date(state.args.now()).toISOString()
|
|
5725
5710
|
});
|
|
5726
5711
|
}
|
|
5727
|
-
return
|
|
5728
|
-
unconfirmed,
|
|
5729
|
-
refused
|
|
5730
|
-
};
|
|
5731
|
-
}
|
|
5732
|
-
/** Read the persisted checkpoint capture, or preserve an uncaptured checkpoint. */
|
|
5733
|
-
function captureBeforeCleanup(state, event, events, uncapturable = false) {
|
|
5734
|
-
const { args } = state;
|
|
5735
|
-
const checkpointId = event.checkpoint.checkpointId;
|
|
5736
|
-
const recorded = events.find((prior) => prior.kind === "workspace-checkpoint-capture" && prior.id === args.nodeId && prior.provider === event.provider && prior.environmentId === event.environmentId && prior.checkpointId === checkpointId);
|
|
5737
|
-
if (recorded !== void 0) return { digest: recorded.tree.digest };
|
|
5738
|
-
const refuse = (reason, needsSource) => ({
|
|
5739
|
-
event,
|
|
5740
|
-
reason,
|
|
5741
|
-
needsSource
|
|
5742
|
-
});
|
|
5743
|
-
return uncapturable ? {} : refuse("client checkpoint capture writers are retired; no persisted capture holds this checkpoint", false);
|
|
5712
|
+
return unconfirmed;
|
|
5744
5713
|
}
|
|
5745
5714
|
/** Destroy a capture's fork and journal whether the provider confirmed it. */
|
|
5746
5715
|
async function destroyCaptureFork(state, branching, target, parent) {
|
|
@@ -5926,14 +5895,13 @@ async function checkpointOwnerWorkspace(scope, state) {
|
|
|
5926
5895
|
return;
|
|
5927
5896
|
}
|
|
5928
5897
|
const requestOne = () => requestCheckpoint(scope, state, provider.name, environment, branching, source, signal);
|
|
5929
|
-
if (!await requestOne() && (!await
|
|
5930
|
-
const
|
|
5931
|
-
const owned = pendingCheckpoints(events, state).filter((event) => event.environmentId === environment.id && state.captureRefused?.has(event.checkpoint.checkpointId) !== true);
|
|
5898
|
+
if (!await requestOne() && (!await deleteOldestCheckpoint(state, branching, environment.id, signal) || !await requestOne())) return;
|
|
5899
|
+
const owned = pendingCheckpoints(await args.journal.loadTree(args.rootId) ?? [], state).filter((event) => event.environmentId === environment.id);
|
|
5932
5900
|
const rotation = new AbortController();
|
|
5933
5901
|
state.rotationCaptures = rotation;
|
|
5934
|
-
const timer = setTimeout(() => rotation.abort(/* @__PURE__ */ new Error(`the rotation's ${WORKSPACE_CHECKPOINT_ROTATION_CAPTURES_MS} ms for checkpoint
|
|
5902
|
+
const timer = setTimeout(() => rotation.abort(/* @__PURE__ */ new Error(`the rotation's ${WORKSPACE_CHECKPOINT_ROTATION_CAPTURES_MS} ms for checkpoint deletes ran out; checkpoint kept`)), WORKSPACE_CHECKPOINT_ROTATION_CAPTURES_MS);
|
|
5935
5903
|
try {
|
|
5936
|
-
await cleanCheckpoints(state, branching, owned.slice(0, -2),
|
|
5904
|
+
await cleanCheckpoints(state, branching, owned.slice(0, -2), AbortSignal.any([scope.signal, rotation.signal]));
|
|
5937
5905
|
} finally {
|
|
5938
5906
|
clearTimeout(timer);
|
|
5939
5907
|
if (state.rotationCaptures === rotation) delete state.rotationCaptures;
|
|
@@ -6003,13 +5971,11 @@ async function requestCheckpoint(scope, state, providerName, environment, branch
|
|
|
6003
5971
|
});
|
|
6004
5972
|
return true;
|
|
6005
5973
|
}
|
|
6006
|
-
/** Delete the oldest checkpoint past {@link WORKSPACE_CHECKPOINTS_KEPT}
|
|
6007
|
-
async function
|
|
6008
|
-
const
|
|
6009
|
-
const oldest = pendingCheckpoints(events, state).filter((event) => event.environmentId === environmentId).slice(0, -2).slice(0, 1);
|
|
5974
|
+
/** Delete the oldest checkpoint past {@link WORKSPACE_CHECKPOINTS_KEPT}, so a snapshot limit cannot freeze the restore point. */
|
|
5975
|
+
async function deleteOldestCheckpoint(state, branching, environmentId, signal) {
|
|
5976
|
+
const oldest = pendingCheckpoints(await state.args.journal.loadTree(state.args.rootId) ?? [], state).filter((event) => event.environmentId === environmentId).slice(0, -2).slice(0, 1);
|
|
6010
5977
|
if (oldest.length === 0) return false;
|
|
6011
|
-
|
|
6012
|
-
return unconfirmed.length === 0;
|
|
5978
|
+
return (await cleanCheckpoints(state, branching, oldest, signal)).length === 0;
|
|
6013
5979
|
}
|
|
6014
5980
|
// src/runtime/supervise/retained-owner-evidence.ts
|
|
6015
5981
|
/** Retained-owner capture receipts, source verification before reuse, and accepted-turn evidence debt. */
|
|
@@ -6302,7 +6268,8 @@ async function abandonInputAdmittedIntoDebt(state, indebted) {
|
|
|
6302
6268
|
// src/runtime/supervise/retained-owner-environment-recovery.ts
|
|
6303
6269
|
function restoreBefore(owned, inputIndex) {
|
|
6304
6270
|
const unusable = unusableEnvironmentIds(owned);
|
|
6305
|
-
|
|
6271
|
+
const deleted = new Set(owned.flatMap((event) => event.kind === "workspace-checkpoint-cleanup" && event.confirmed ? [event.checkpointId] : []));
|
|
6272
|
+
return owned.slice(0, inputIndex < 0 ? owned.length : inputIndex).filter((event) => event.kind === "workspace-checkpoint" && unusable.has(event.environmentId) && !deleted.has(event.checkpoint.checkpointId)).at(-1);
|
|
6306
6273
|
}
|
|
6307
6274
|
async function restoreCapable(provider) {
|
|
6308
6275
|
if (provider === void 0) return false;
|
|
@@ -7173,7 +7140,7 @@ function consumeScopeRetainedOwnerResult(scope) {
|
|
|
7173
7140
|
function retainedOwnerReleaseRetriable(scope) {
|
|
7174
7141
|
return owners.get(scope)?.releaseRetriable ?? false;
|
|
7175
7142
|
}
|
|
7176
|
-
/** One budget for every checkpoint lookup, delete and fork this release starts.
|
|
7143
|
+
/** One budget for every checkpoint lookup, delete and fork cleanup this release starts. Work cut short keeps its checkpoint and source. */
|
|
7177
7144
|
const RELEASE_CHECKPOINT_CAPTURES_MS = 9e5;
|
|
7178
7145
|
/**
|
|
7179
7146
|
* Release the owner's environment once no turn of it will run again. A second call joins the one
|
|
@@ -7201,7 +7168,7 @@ async function releaseOwnerEnvironment(state, provider, capturesMs) {
|
|
|
7201
7168
|
const capturesDeadline = Date.now() + capturesMs;
|
|
7202
7169
|
const events = [...await args.journal.loadTree(args.rootId) ?? []];
|
|
7203
7170
|
const captures = new AbortController();
|
|
7204
|
-
const capturesTimer = setTimeout(() => captures.abort(/* @__PURE__ */ new Error(`the release's ${capturesMs} ms for checkpoint
|
|
7171
|
+
const capturesTimer = setTimeout(() => captures.abort(/* @__PURE__ */ new Error(`the release's ${capturesMs} ms for checkpoint cleanup ran out; checkpoint and source kept`)), Math.max(0, capturesDeadline - Date.now()));
|
|
7205
7172
|
let requestFailures = [];
|
|
7206
7173
|
const pendingSources = /* @__PURE__ */ new Set();
|
|
7207
7174
|
const released = new Set(events.flatMap((event) => event.kind === "environment-teardown" && event.id === args.nodeId && event.provider === provider.name && event.destroyed ? [event.environmentId] : []));
|
|
@@ -7212,17 +7179,13 @@ async function releaseOwnerEnvironment(state, provider, capturesMs) {
|
|
|
7212
7179
|
let lastDetail;
|
|
7213
7180
|
let retriable = false;
|
|
7214
7181
|
const checkpointFailures = [];
|
|
7215
|
-
const checkpointsKept = [];
|
|
7216
|
-
const uncapturedSources = /* @__PURE__ */ new Set();
|
|
7217
7182
|
try {
|
|
7218
7183
|
requestFailures = await reconcileCheckpointRequests(state, events, captures.signal);
|
|
7219
7184
|
for (const { event } of requestFailures) pendingSources.add(event.environmentId);
|
|
7220
7185
|
const pending = pendingCheckpoints(events, state).filter((event) => !retentionFailures.has(event.environmentId));
|
|
7221
7186
|
for (const sourceEnvironmentId of new Set(pending.map((event) => event.environmentId))) {
|
|
7222
|
-
const
|
|
7223
|
-
checkpointFailures.push(...
|
|
7224
|
-
checkpointsKept.push(...cleaned.refused);
|
|
7225
|
-
for (const refusal of cleaned.refused) if (refusal.needsSource) uncapturedSources.add(sourceEnvironmentId);
|
|
7187
|
+
const branching = await checkpointHandle(state, sourceEnvironmentId, AbortSignal.any([captures.signal, AbortSignal.timeout(3e4)]));
|
|
7188
|
+
checkpointFailures.push(...await cleanCheckpoints(state, branching, pending.filter((event) => event.environmentId === sourceEnvironmentId), captures.signal));
|
|
7226
7189
|
}
|
|
7227
7190
|
} finally {
|
|
7228
7191
|
clearTimeout(capturesTimer);
|
|
@@ -7235,8 +7198,8 @@ async function releaseOwnerEnvironment(state, provider, capturesMs) {
|
|
|
7235
7198
|
let detail;
|
|
7236
7199
|
const retentionReason = retentionFailures.get(environmentId);
|
|
7237
7200
|
const nativeHold = retentionReason?.startsWith("native session copy incomplete:") === true;
|
|
7238
|
-
if (retentionReason !== void 0 || pendingSources.has(environmentId)
|
|
7239
|
-
detail = nativeHold
|
|
7201
|
+
if (retentionReason !== void 0 || pendingSources.has(environmentId)) {
|
|
7202
|
+
detail = !nativeHold && pendingSources.has(environmentId) ? "checkpoint cleanup unresolved: source preserved for exact lookup and cleanup" : retentionReason;
|
|
7240
7203
|
preserved.push(environmentId);
|
|
7241
7204
|
lastDetail = detail;
|
|
7242
7205
|
} else {
|
|
@@ -7260,8 +7223,8 @@ async function releaseOwnerEnvironment(state, provider, capturesMs) {
|
|
|
7260
7223
|
await environment.destroy();
|
|
7261
7224
|
}, AbortSignal.timeout(3e4), "retained owner cleanup timed out");
|
|
7262
7225
|
destroyed = true;
|
|
7263
|
-
} catch {
|
|
7264
|
-
detail =
|
|
7226
|
+
} catch (error) {
|
|
7227
|
+
detail = `retained owner environment cleanup was not confirmed: ${errMessage(error).slice(0, 500)}`;
|
|
7265
7228
|
unconfirmed.push(environmentId);
|
|
7266
7229
|
lastDetail = detail;
|
|
7267
7230
|
if (!permanent) retriable = true;
|
|
@@ -7307,13 +7270,6 @@ async function releaseOwnerEnvironment(state, provider, capturesMs) {
|
|
|
7307
7270
|
status: "done",
|
|
7308
7271
|
detail: `checkpoint request unresolved: ${event.request.idempotencyKey} from ${event.environmentId} (${reason})`
|
|
7309
7272
|
})),
|
|
7310
|
-
...checkpointsKept.map(({ event, reason }) => ({
|
|
7311
|
-
id: args.nodeId,
|
|
7312
|
-
label: "scope owner workspace checkpoint",
|
|
7313
|
-
runtime: provider.name,
|
|
7314
|
-
status: "done",
|
|
7315
|
-
detail: `checkpoint kept uncaptured: ${event.checkpoint.checkpointId} from ${event.environmentId} (${reason})`
|
|
7316
|
-
})),
|
|
7317
7273
|
...forksUnresolved.length === 0 ? [] : [{
|
|
7318
7274
|
id: args.nodeId,
|
|
7319
7275
|
label: "scope owner checkpoint capture fork",
|
|
@@ -7884,7 +7840,9 @@ function nestedManagerScopes(scope) {
|
|
|
7884
7840
|
async function releaseNestedManagerEnvironments(scope) {
|
|
7885
7841
|
await Promise.all(nestedManagerScopes(scope).map(async (nested) => {
|
|
7886
7842
|
await releaseNestedManagerEnvironments(nested);
|
|
7887
|
-
|
|
7843
|
+
const prior = ownerUnconfirmedByScope.get(nested);
|
|
7844
|
+
if (prior === void 0) await releaseManagerEnvironment(nested);
|
|
7845
|
+
else if (prior.length > 0 && retainedOwnerReleaseRetriable(nested)) ownerUnconfirmedByScope.set(nested, await releaseScopeRetainedOwnerEnvironment(nested));
|
|
7888
7846
|
}));
|
|
7889
7847
|
}
|
|
7890
7848
|
/**
|
|
@@ -12126,7 +12084,7 @@ function parseWorkerSteerRequest(value) {
|
|
|
12126
12084
|
function parseWorkerSteerAcknowledgement(value) {
|
|
12127
12085
|
if (value === null || typeof value !== "object" || Array.isArray(value)) throw new Error("steer acknowledgement is malformed");
|
|
12128
12086
|
const record = value;
|
|
12129
|
-
if (record.schemaVersion !== 1 || typeof record.operationId !== "string" || record.operationId.length === 0 || typeof record.requestDigest !== "string" || typeof record.worker !== "string" || record.worker.length === 0 || record.effect !== "unknown" && record.effect !== "delivered" && record.effect !== "not_live" && record.effect !== "unsupported" && record.effect !== "refused" || typeof record.requestedAt !== "string" || typeof record.observedAt !== "string" || typeof record.detail !== "string") throw new Error("steer acknowledgement is malformed");
|
|
12087
|
+
if (record.schemaVersion !== 1 || typeof record.operationId !== "string" || record.operationId.length === 0 || typeof record.requestDigest !== "string" || typeof record.worker !== "string" || record.worker.length === 0 || record.effect !== "unknown" && record.effect !== "delivered" && record.effect !== "not_live" && record.effect !== "unsupported" && record.effect !== "refused" || typeof record.requestedAt !== "string" || typeof record.observedAt !== "string" || typeof record.detail !== "string" || record.pausedOn !== void 0 && typeof record.pausedOn?.stop !== "string") throw new Error("steer acknowledgement is malformed");
|
|
12130
12088
|
return record;
|
|
12131
12089
|
}
|
|
12132
12090
|
function assertSameSteerRequest(existing, candidate) {
|
|
@@ -13960,7 +13918,7 @@ async function terminalAccounting(journal, root, elapsedMs, profile) {
|
|
|
13960
13918
|
const spend = event.kind === "metered" ? event.spend : event.kind === "settled" || event.kind === "cancelled" || event.kind === "reconciled" ? event.spent : void 0;
|
|
13961
13919
|
if (spend !== void 0) assertValidSpend(spend, `settlement ${event.id}/${event.kind}`);
|
|
13962
13920
|
}
|
|
13963
|
-
const { childWork, driverInference } = sumMeasuredSpendFromEvents([...rootTree.events]);
|
|
13921
|
+
const { childWork, driverInference, owner } = sumMeasuredSpendFromEvents([...rootTree.events], root);
|
|
13964
13922
|
const gaps = spendGapsFromEvents(forest.events.map((entry) => entry.event));
|
|
13965
13923
|
const providerModel = aggregateProviderModelEvidence(forest);
|
|
13966
13924
|
const fleetYield = fleetYieldFromForest(forest);
|
|
@@ -13973,10 +13931,11 @@ async function terminalAccounting(journal, root, elapsedMs, profile) {
|
|
|
13973
13931
|
};
|
|
13974
13932
|
assertValidSpend(spentTotal, "settlement total");
|
|
13975
13933
|
const forestNodes = forest.nodes.filter((node) => node.id !== forest.root);
|
|
13934
|
+
const nodes = withOwnSpent(forestNodes.map(({ treeRoot: _treeRoot, ...node }) => node));
|
|
13976
13935
|
return {
|
|
13977
13936
|
tree: {
|
|
13978
13937
|
root: forest.root,
|
|
13979
|
-
nodes
|
|
13938
|
+
nodes,
|
|
13980
13939
|
inFlight: forestNodes.filter((node) => [
|
|
13981
13940
|
"queued",
|
|
13982
13941
|
"acquiring",
|
|
@@ -13987,11 +13946,37 @@ async function terminalAccounting(journal, root, elapsedMs, profile) {
|
|
|
13987
13946
|
usage: settledUsage(forest, spentTotal, providerModel, profile),
|
|
13988
13947
|
childWork,
|
|
13989
13948
|
driverInference,
|
|
13949
|
+
spentSplit: {
|
|
13950
|
+
root: owner ?? zeroSpend(),
|
|
13951
|
+
children: {
|
|
13952
|
+
...unreportedSpend(spentTotal, owner ?? zeroSpend()),
|
|
13953
|
+
ms: summed.ms
|
|
13954
|
+
}
|
|
13955
|
+
},
|
|
13990
13956
|
gaps,
|
|
13991
13957
|
providerModel,
|
|
13992
13958
|
fleetYield
|
|
13993
13959
|
};
|
|
13994
13960
|
}
|
|
13961
|
+
/** `spent` is a subtree; `ownSpent` drops the direct children's, so its sum counts each node once
|
|
13962
|
+
* (summing `spent` read agent-learning-methods-20261109a's 46.2M input as 75.2M). */
|
|
13963
|
+
function withOwnSpent(nodes) {
|
|
13964
|
+
const children = /* @__PURE__ */ new Map();
|
|
13965
|
+
for (const node of nodes) {
|
|
13966
|
+
if (node.parent === void 0) continue;
|
|
13967
|
+
children.set(node.parent, addSpend(children.get(node.parent) ?? zeroSpend(), node.spent));
|
|
13968
|
+
}
|
|
13969
|
+
return nodes.map((node) => {
|
|
13970
|
+
const below = children.get(node.id) ?? zeroSpend();
|
|
13971
|
+
return {
|
|
13972
|
+
...node,
|
|
13973
|
+
ownSpent: {
|
|
13974
|
+
...unreportedSpend(node.spent, below),
|
|
13975
|
+
ms: node.spent.ms
|
|
13976
|
+
}
|
|
13977
|
+
};
|
|
13978
|
+
});
|
|
13979
|
+
}
|
|
13995
13980
|
/** Count each child by its last terminal record across the owned forest; roots are exempt. */
|
|
13996
13981
|
function fleetYieldFromForest(forest) {
|
|
13997
13982
|
const spawned = /* @__PURE__ */ new Set();
|
|
@@ -14079,6 +14064,6 @@ function unknownChannels(spend) {
|
|
|
14079
14064
|
function isNonEmptySpend(s) {
|
|
14080
14065
|
return s.iterations > 0 || s.tokens.input > 0 || s.tokens.output > 0 || s.usd > 0 || s.ms > 0 || s.tokensKnown === false || s.usdKnown === false || Object.values(s.resources ?? {}).some((resource) => resource.amount > 0 || !resource.known);
|
|
14081
14066
|
}
|
|
14082
|
-
export { queueOf as $,
|
|
14067
|
+
export { queueOf as $, captureHarnessTranscript as $n, RetainedRunProviderContractError as $r, loadSpawnForest as $t, openSlotGroup as A, verifyObserverRecords as An, knownMaterializationReceipt as Ar, noteScopeOwnerPlannedExecution as At, readWorkerInteractiveBinding as B, buildLoopSpanNodes as Bn, runtimeOwnedExecutorMaterialization as Br, scopeRetainedOwnerSettled as Bt, workerCancellationsDir as C, retainedCreateMaterial as Cn, attestRuntimeOwnedPendingExecutor as Cr, abandonScopeRetainedOwnerInvocation as Ct, writeWorkerSteer as D, FileObserverJournal as Dn, finalizeRuntimeOwnedPendingExecutor as Dr, scopeRetainedOwnerResult as Dt, writeWorkerCancellation as E, prepareInteractiveDelegation as En, authoredProfileDigest as Er, scopeRetainedOwnerPriorSpend as Et, parseWorkerToolTraceArtifact as F, workerTraceHeaders as Fn, recordRuntimeOwnedProviderDispatchNotStarted as Fr, coordinationMcpAlias as Ft, appendSpawnEvents as G, generateSpanId as Gn, unknownExecutionBindingReceipt as Gr, noteScopeRetainedOwnerCoordination as Gt, recoverRetainedInteractiveRun as H, createOpenInferenceFileExporter as Hn, runtimeOwnedPendingExecutorMaterialization as Hr, assertRetainedOwnerCoordinationRekey as Ht, workerTraceAnalysisStore as I, createPropagatingTraceEmitter as In, recordRuntimeOwnedProviderIdentityConflict as Ir, coordinationProfileToolPrefix as It, reenteredWorkers as J, createRuntimeStreamEventCollector as Jn, executableAgentSpecSnapshot as Jr, bindScopeRetainedOwnerProvider as Jt, spawnJournalRecordEvents as K, loopEventToOtelSpan as Kn, unknownMaterializationReceipt as Kr, scopeRetainedOwnerCheckpointing as Kt, nestedScopeSeamKey as L, mergeTraceEnv as Ln, recordRuntimeOwnedProviderModel as Lr, providerVisibleProfile as Lt, prepareScopeResume as M, environmentGone as Mn, providerAttemptEvidence as Mr, restoreScopeOwnerAcceptedExecution as Mt, replaySpawnTree as N, WORKER_TRACE_PROPAGATION as Nn, recordRuntimeOwnedDriveHarnessProviderEvidence as Nr, scopeOwnerExecutionObservation as Nt, writeWorkerSteerAcknowledgement as O, createFileObserverHooks as On, inheritRuntimeOwnedExecutorAttestation as Or, beginScopeOwnerAttempt as Ot, isTraceAnalysisStore as P, workerTraceEnv as Pn, recordRuntimeOwnedProviderAttemptStart as Pr, scopeOwnerExecutorNodeContext as Pt, freeSlots as Q, captureBoundHarnessTranscript as Qn, runtimeFlowBrain as Qr, scopeRetainedOwnerJournalRoot as Qt, interactiveAdmissionSeamKey as R, readTraceContextFromEnv as Rn, runtimeOwnedDriveHarnessProviderEvidence as Rr, runtimeGraphMetadataKey as Rt, workerCancelRequestsFile as S, startRetainedRunInEnvironment as Sn, attestRuntimeOwnedExecutor as Sr, resolveSpawnResourcePaths as St, workerSteerRequestsDir as T, offerInteractiveControl as Tn, authoredAgentIdentity as Tr, prepareScopeRetainedOwnerTask as Tt, startRetainedInteractiveRun as U, createOtelExporter as Un, runtimeOwnedScopeOwnerControl as Ur, reconcileScopeRetainedOwnerEnvironment as Ut, reconnectRetainedInteractiveRun as V, buildRuntimeEventOtelSpans as Vn, runtimeOwnedExecutorProviderEvidence as Vr, scopeRetainedOwnerTurnEnded as Vt, FileSpawnJournal as W, flatOtelSpan as Wn, runtimeOwnedScopeOwnerRuntime as Wr, scopeRetainedOwnerRestorePoint as Wt, assertRecursiveReservationPolicy as X, sanitizeRuntimeStreamEvent as Xn, runtimeCheckFactory as Xr, scopeOwnerLiabilities as Xt, settledToIteration as Y, sanitizeKnowledgeReadinessReport as Yn, isRuntimeFlowBrain as Yr, owners as Yt, deriveNodeExecutionIdentity as Z, HARNESS_TRANSCRIPT_SETTLE_TIMEOUT_MS as Zn, runtimeFlowAgent as Zr, scopeRetainedOwnerContext as Zt, readWorkerSteerAcknowledgement as _, assertRetainedRunReplayMaterial as _n, SeatPauseError as _r, waitForScopeChildren as _t, createRootStreamSink as a, sameControlCoordinates as ai, FileResultBlobStore as an, HARNESS_TRANSCRIPT_READ_LIMITS as ar, meterRuntimeOwnedProviderAttempt as at, supervisorRunDir as b, recoverRetainedRun as bn, subscriptionUsageLimitSignal as br, scopeRetainedOwnerResourceReader as bt, readRootStreamReceipt as c, linkAbort as ci, insideCursorNamespace as cn, retainHarnessTranscript as cr, recordScopeOwnerDriverAttempt as ct, claimWorkerSteerDelivery as d, promptFromAgentTurnInput as di, observeModelRequest as dn, describeToolArgs as dr, releaseHeldEnvironments as dt, assertEventBinding as ei, ownedTreeRootSpawn as en, harnessTranscriptArtifact as er, rollingDispatch as et, fileEscalateQuestion as f, promptOptionsFromAgentTurnInput as fi, NATIVE_STOP_UNCONFIRMED as fn, readWorkerProgress as fr, releaseRetainedEnvironments as ft, readWorkerCancellation as g, RetainedMaterializationTimeoutError as gn, SeatChain as gr, unconfirmedTeardowns as gt, readWorkerCancelRequests as h, verifyWorkspaceMarker as hn, SEAT_RECHECK_MS as hr, startScopeRecoveries as ht, ROOT_STREAM_FILE as i, retainedSessionReplaced as ii, nestedDriverTreeRoot as in, readHarnessTranscript as ir, meterRuntimeOwnedAccounting as it, resolveWorkerSlots as j, destroyInteractiveEnvironment as jn, newExecutionAttemptId as jr, recordScopeOwnerMaterialization as jt, createWorkerSlots as k, observerRecordDigest as kn, knownExecutionBindingReceipt as kr, finalizeScopeOwnerMaterialization as kt, appendWorkerControlEvent as l, runAbortable as li, executorObservation as ln, DEFAULT_STALL_AFTER_MS as lr, recordScopeOwnerPause as lt, legacySupervisorRunsRoot as m, stopRetainedNativeExecution as mn, isTerminalNodeStatus as mr, settleManagerWork as mt, terminalAccounting as n, exactSession as ni, attestNestedDriverTreeOwner as nn, harnessTranscriptUnavailable as nr, closeScopeAdmission as nt, nodeStreamFile as o, RunCancellationReason as oi, encodeResultBlob as on, readBoundHarnessSessions as or, pauseScopeSeatAdmission as ot, legacySupervisorRunDir as p, providerMessageText as pi, describeRetainedNativeStops as pn, isLiveNodeStatus as pr, retryUnconfirmedTeardowns as pt, appendTeardownConfirmation as q, createRuntimeEventCollector as qn, executableAgentProfileSnapshot as qr, bindScopeRetainedOwnerEnvironmentId as qt, createScope as r, freezeControlRef as ri, driverRuntime as rn, persistHarnessTranscript as rr, hasRetriableTeardowns as rt, readRootStream as s, abortReason as si, SpawnEventIndex as sn, resolveHarnessTranscriptCapture as sr, recordScopeOwnerBarrenPause as st, isNonEmptySpend as t, awaitAbortable$1 as ti, materializeTreeView as tn, harnessTranscriptFromLines as tr, closeRetainedSlots as tt, cancelWorker as u, signalAbortError as ui, executorObservationSeamKey as un, createActivityLog as ur, registerNestedTeardownScope as ut, readWorkerSteerRequests as v, mintRetainedIdentity as vn, authoredSeatStages as vr, prepareScopeRetainedOwnerSeatSwitch as vt, workerInboxFileFromEventDir as w, acceptedInteractiveControl as wn, attestRuntimeOwnedScopeOwner as wr, consumeScopeRetainedOwnerResult as wt, supervisorRunsRoot as x, startRetainedRun as xn, attestRuntimeOwnedDeferredExecutor as xr, environmentReader as xt, safeWorkerFile as y, reconnectRetainedRun as yn, seatExecutionProfile as yr, releaseScopeRetainedOwnerForSeatPause as yt, attachWorker as z, buildLoopOtelSpans as zn, runtimeOwnedExecutorExecutionBinding as zr, beginScopeRetainedOwnerDrive as zt };
|
|
14083
14068
|
|
|
14084
|
-
//# sourceMappingURL=supervisor-accounting-
|
|
14069
|
+
//# sourceMappingURL=supervisor-accounting-DIEwaMfr.js.map
|