@tangle-network/agent-runtime 10.0.2 → 10.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 +8 -0
- package/dist/{activation-B0DHGRtB.js → activation-38MolXIP.js} +2 -2
- package/dist/{activation-B0DHGRtB.js.map → activation-38MolXIP.js.map} +1 -1
- package/dist/{activation-D0Sp7wMc.d.ts → activation-Ckx0yHjT.d.ts} +2 -2
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +3 -3
- package/dist/{continuation-CZaeHEzQ.js → continuation-CL4B1Y4M.js} +3 -3
- package/dist/{continuation-CZaeHEzQ.js.map → continuation-CL4B1Y4M.js.map} +1 -1
- package/dist/{delegate-Co5iUyS0.js → delegate-dhNeiaH_.js} +2 -2
- package/dist/{delegate-Co5iUyS0.js.map → delegate-dhNeiaH_.js.map} +1 -1
- package/dist/{driver-control-acknowledgers-B1Qx2JUz.js → driver-control-acknowledgers-C6GaGBf_.js} +98 -55
- package/dist/{driver-control-acknowledgers-B1Qx2JUz.js.map → driver-control-acknowledgers-C6GaGBf_.js.map} +1 -1
- package/dist/durable-file-DJ3JsA4B.js +1 -0
- package/dist/durable-file-lXnojyij.js +509 -0
- package/dist/durable-file-lXnojyij.js.map +1 -0
- package/dist/durable-writer-thread.d.ts +1 -0
- package/dist/durable-writer-thread.js +86 -0
- package/dist/durable-writer-thread.js.map +1 -0
- package/dist/durable.d.ts +1 -1
- package/dist/durable.js +15 -128
- package/dist/durable.js.map +1 -1
- package/dist/{graph-uc4eT1wR.js → graph-CwLg3LGC.js} +7 -7
- package/dist/{graph-uc4eT1wR.js.map → graph-CwLg3LGC.js.map} +1 -1
- package/dist/{graph-registry-DxhlgHdA.js → graph-registry-Bs6mGKou.js} +1 -1
- package/dist/{graph-registry-j9t9J0KT.js → graph-registry-DtGd03zk.js} +4 -4
- package/dist/{graph-registry-j9t9J0KT.js.map → graph-registry-DtGd03zk.js.map} +1 -1
- package/dist/{improve-BM0HlzMi.js → improve-C_LKfgH9.js} +7 -7
- package/dist/{improve-BM0HlzMi.js.map → improve-C_LKfgH9.js.map} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +9 -9
- package/dist/intelligence.d.ts +2 -2
- package/dist/intelligence.js +4 -4
- package/dist/{jsonl-file-BhuxeejY.js → jsonl-file-DyzefaZ6.js} +53 -11
- package/dist/jsonl-file-DyzefaZ6.js.map +1 -0
- package/dist/kernel.d.ts +2 -2
- package/dist/kernel.js +18 -16
- package/dist/{loop-runner-CRC-RE4D.js → loop-runner-BS3ru-yj.js} +2 -2
- package/dist/{loop-runner-CRC-RE4D.js.map → loop-runner-BS3ru-yj.js.map} +1 -1
- package/dist/{loop-runner-npLkvCU5.d.ts → loop-runner-LWqWf8FD.d.ts} +2 -2
- 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 +1 -1
- package/dist/mcp/index.js +5 -5
- package/dist/profiles.d.ts +1 -1
- package/dist/{provision-supervisor-CJrMGyZW.js → provision-supervisor-D8N0l2DM.js} +6 -6
- package/dist/{provision-supervisor-CJrMGyZW.js.map → provision-supervisor-D8N0l2DM.js.map} +1 -1
- package/dist/result-blob-store-DfTcyQ05.js +76 -0
- package/dist/result-blob-store-DfTcyQ05.js.map +1 -0
- package/dist/{run-cancellation-CBP3Bmad.js → run-cancellation-D3qc9wAD.js} +5 -209
- package/dist/run-cancellation-D3qc9wAD.js.map +1 -0
- package/dist/run-lock-D1xnb9ve.js +193 -0
- package/dist/run-lock-D1xnb9ve.js.map +1 -0
- package/dist/run-reopen-DVM5AEKV.js +134 -0
- package/dist/run-reopen-DVM5AEKV.js.map +1 -0
- package/dist/run-state-tgQ-S9Ln.js +180 -0
- package/dist/run-state-tgQ-S9Ln.js.map +1 -0
- package/dist/{runtime-BqSaWTEY.js → runtime-BTECV05R.js} +21 -19
- package/dist/{runtime-BqSaWTEY.js.map → runtime-BTECV05R.js.map} +1 -1
- package/dist/{search-executor-C9TN-KgI.js → search-executor-Uco2_KTB.js} +3 -3
- package/dist/{search-executor-C9TN-KgI.js.map → search-executor-Uco2_KTB.js.map} +1 -1
- package/dist/{server-CcMa8Lt9.js → server-BMp24-xn.js} +3 -3
- package/dist/{server-CcMa8Lt9.js.map → server-BMp24-xn.js.map} +1 -1
- package/dist/{settle-record-BtjYZabI.js → settle-record-au3w7bQG.js} +5 -4
- package/dist/settle-record-au3w7bQG.js.map +1 -0
- package/dist/{structural-rollout-2oRJjwyM.js → structural-rollout-D8wufVJI.js} +4 -4
- package/dist/{structural-rollout-2oRJjwyM.js.map → structural-rollout-D8wufVJI.js.map} +1 -1
- package/dist/{supervise-BrgtzJf3.js → supervise-DtVdvZpr.js} +9 -8
- package/dist/{supervise-BrgtzJf3.js.map → supervise-DtVdvZpr.js.map} +1 -1
- package/dist/supervise-identity-S5XwgaF3.js +210 -0
- package/dist/supervise-identity-S5XwgaF3.js.map +1 -0
- package/dist/{supervision-discovery-DLMm3UOr.js → supervision-discovery-Cqu4NxPV.js} +3 -3
- package/dist/{supervision-discovery-DLMm3UOr.js.map → supervision-discovery-Cqu4NxPV.js.map} +1 -1
- package/dist/{supervisor-ACffs_W4.js → supervisor-CHgCAMjm.js} +13 -176
- package/dist/supervisor-CHgCAMjm.js.map +1 -0
- package/dist/{supervisor-accounting-BlJqoP3k.js → supervisor-accounting-CZ7i4cd5.js} +171 -153
- package/dist/supervisor-accounting-CZ7i4cd5.js.map +1 -0
- package/dist/supervisor-root-contract-D70KTGXF.js +165 -0
- package/dist/supervisor-root-contract-D70KTGXF.js.map +1 -0
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +11 -11
- package/dist/{top-web-PYyzBMsK.js → top-web-COrMqTRC.js} +7 -6
- package/dist/{top-web-PYyzBMsK.js.map → top-web-COrMqTRC.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-DX1OGeHE.d.ts → types-9xsn2GGY.d.ts} +10 -3
- package/package.json +1 -1
- package/dist/durable-file-CksURHlH.js +0 -1
- package/dist/durable-file-DstVeHcj.js +0 -228
- package/dist/durable-file-DstVeHcj.js.map +0 -1
- package/dist/jsonl-file-BhuxeejY.js.map +0 -1
- package/dist/run-cancellation-CBP3Bmad.js.map +0 -1
- package/dist/run-state-BnhCVbTY.js +0 -357
- package/dist/run-state-BnhCVbTY.js.map +0 -1
- package/dist/settle-record-BtjYZabI.js.map +0 -1
- package/dist/supervisor-ACffs_W4.js.map +0 -1
- package/dist/supervisor-accounting-BlJqoP3k.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ar as attestRuntimeOwnedExecutor, Bn as WORKER_TRACE_PROPAGATION, Cn as RetainedMaterializationTimeoutError, Ct as waitForScopeChildren, Dn as recoverRetainedRun, En as reconnectRetainedRun, Fr as finalizeRuntimeOwnedPendingExecutor, Gr as recordRuntimeOwnedProviderModel, H as nestedScopeSeamKey, Hn as workerTraceHeaders, Hr as recordRuntimeOwnedProviderAttemptStart, I as resolveWorkerSlots, Ir as inheritRuntimeOwnedExecutorAttestation, It as finalizeScopeOwnerMaterialization, Jr as runtimeOwnedExecutorMaterialization, L as prepareScopeResume, On as startRetainedRun, Or as subscriptionUsageLimitSignal, Q as appendTeardownConfirmation, Qr as runtimeOwnedScopeOwnerRuntime, Sn as verifyWorkspaceMarker, St as unconfirmedTeardowns, Tn as mintRetainedIdentity, Ur as recordRuntimeOwnedProviderDispatchNotStarted, Vn as workerTraceEnv, Wn as mergeTraceEnv, Wr as recordRuntimeOwnedProviderIdentityConflict, X as appendSpawnEvents, Yt as scopeRetainedOwnerSettled, Zr as runtimeOwnedScopeOwnerControl, _t as releaseHeldEnvironments, an as scopeOwnerLiabilities, bn as describeRetainedNativeStops, bt as settleManagerWork, ci as assertEventBinding, cn as loadSpawnForest, cr as harnessTranscriptFromLines, ct as closeScopeAdmission, di as freezeControlRef, dn as attestNestedDriverTreeOwner, fi as retainedSessionReplaced, fn as driverRuntime, gn as executorObservation, gt as registerNestedTeardownScope, hi as promptOptionsFromAgentTurnInput, in as owners, ir as HARNESS_TRANSCRIPT_SETTLE_TIMEOUT_MS, jr as attestRuntimeOwnedPendingExecutor, kr as attestRuntimeOwnedDeferredExecutor, kt as RELEASE_DESTROY_MS, li as awaitAbortable, ln as ownedTreeRootSpawn, lr as harnessTranscriptUnavailable, lt as hasRetriableTeardowns, mn as SpawnEventIndex, n as terminalAccounting, ni as executableAgentSpecSnapshot, or as captureHarnessTranscript, ot as boundRetainedReleases, pi as sameControlCoordinates, pn as nestedDriverTreeRoot, qr as runtimeOwnedExecutorExecutionBinding, r as createScope, rn as bindScopeRetainedOwnerProvider, si as RetainedRunProviderContractError, st as closeRetainedSlots, t as isNonEmptySpend, ti as executableAgentProfileSnapshot, tn as scopeRetainedOwnerCheckpointing, tt as assertRecursiveReservationPolicy, ui as exactSession, vn as observeModelRequest, vr as createActivityLog, vt as releaseRetainedEnvironments, wn as assertRetainedRunReplayMaterial, xn as stopRetainedNativeExecution, xr as isLiveNodeStatus, xt as startScopeRecoveries, yr as describeToolArgs, yt as retryUnconfirmedTeardowns, zn as environmentGone, zr as newExecutionAttemptId } from "./supervisor-accounting-CZ7i4cd5.js";
|
|
2
2
|
import { f as RuntimeRunStateError, i as ConfigError, m as ValidationError$1, r as BackendTransportError, t as AgentEvalError } from "./errors-DG8yufqX.js";
|
|
3
|
-
import {
|
|
3
|
+
import { _ as runAbortable, f as sha256, g as linkAbort, m as abortReason, p as RunCancellationReason } from "./jsonl-file-DyzefaZ6.js";
|
|
4
4
|
import { a as ROOT_DEADLINE_REASON, f as teardownSurfaces, l as isDeadlineAbortReason, o as armDeadlineTimer, t as ACCEPTED_RESULT_GRACE_MS } from "./deadline-CySmJ_0S.js";
|
|
5
5
|
import { C as unreportedSpend, D as addResourceSpend, E as zeroTokenUsage, S as unmeteredSpend, T as zeroSpend, _ as roundBoxMinutes, b as throwAbort, c as errorMessage, d as isAbortError, f as isAsyncIterable, g as randomUuid, h as randomSuffix, m as promptCacheTokenClasses, n as addSpend, o as cloneTokenUsage, p as mapWithConcurrency, r as addTokenUsage, s as deleteBoxSafe, v as sleep, w as withTimeout, x as throwIfAborted, y as stringifySafe } from "./util-qsH5cC9S.js";
|
|
6
6
|
import { t as runTaskQueue } from "./task-queue-DbpZAp6C.js";
|
|
@@ -9,17 +9,19 @@ import { a as errMessage, i as causeChain, l as errorText, n as detachedSnapshot
|
|
|
9
9
|
import { _ as reportedServedModel, a as concreteProfileModel, c as profileModelExecutionSettings, d as assertRouterAutoDeclaration, f as assertRouterAutoResponse, g as observedModelMatchesDeclared, l as profileProviderModel, m as mergeObservedModelIdentity, o as enforceTokenLimits, s as profileBridgeWireModel, t as assertExecutableAgentProfile, u as resolveRouterRetryPolicy, v as agentHarness } from "./model-policy-DZnL8Yj9.js";
|
|
10
10
|
import { r as nativeSystemPrompt, t as assertSandboxProfileCompatibility } from "./sandbox-profile-compat-l-SLQnGb.js";
|
|
11
11
|
import { x as hasControlCharacter } from "./workspace-streams-C7PGLAUd.js";
|
|
12
|
-
import { i as checkVerdictOf, s as isFiniteNumber } from "./continuation-
|
|
13
|
-
import {
|
|
12
|
+
import { i as checkVerdictOf, s as isFiniteNumber } from "./continuation-CL4B1Y4M.js";
|
|
13
|
+
import { d as writeAtomicDurableFile, r as appendRunLines } from "./durable-file-lXnojyij.js";
|
|
14
14
|
import { t as PROTOCOL_VERSION } from "./tool-server-DQCdu3am.js";
|
|
15
15
|
import { i as notifyRuntimeHookEvent } from "./runtime-hooks-CsW2pfFk.js";
|
|
16
|
-
import {
|
|
16
|
+
import { n as encodeResultBlob } from "./result-blob-store-DfTcyQ05.js";
|
|
17
|
+
import { a as recordRootReentered, c as rootMaterializationReceipt, i as changesRootProfile, l as rootStartedAtMs, o as recordRootSegment, r as assertRootIdentity, s as rootExecutionBindingReceipt, t as assertResumeContract } from "./supervisor-root-contract-D70KTGXF.js";
|
|
18
|
+
import { AGENT_PROFILE_MATERIALIZATION_AXES, AgentExactRunControlRefSchema, AgentFileOutputPolicySchema, AgentRetainedFilePublicationSchema, AgentRunCancellationRequestSchema, AgentTurnInputSchema, REASONING_EFFORTS, agentProfileSchema, canonicalAgentProfileDigest, canonicalCandidateDigest, canonicalWorkspaceCwd, harnessTypeSchema, mergeProxySecretBindings, nativeReasoningControl, profileMaterializationAxes, profileMaterializationAxes as profileMaterializationAxes$1, renderInputPartsAsText, sameAgentRunControlRef, workspaceCwdPathForBase } from "@tangle-network/agent-interface";
|
|
17
19
|
import { createAgentRunOutcomeTracker } from "@tangle-network/sandbox/runtime";
|
|
18
20
|
import { SDKError, generateIdempotencyKey, isRecord, withRetry } from "@tangle-network/agent-core";
|
|
19
21
|
import { collectAgentFinalMessageText, collectAgentResponseText, isToolBearingEvent } from "@tangle-network/sandbox";
|
|
20
22
|
import { z } from "zod";
|
|
21
23
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
22
|
-
import {
|
|
24
|
+
import { constants, createReadStream, existsSync } from "node:fs";
|
|
23
25
|
import { basename, delimiter, dirname, isAbsolute, join, relative, resolve, sep, win32 } from "node:path";
|
|
24
26
|
import { spawn } from "node:child_process";
|
|
25
27
|
import { access, chmod, copyFile, mkdir, mkdtemp, open, readFile, readdir, realpath, rm, rmdir, stat, symlink, writeFile } from "node:fs/promises";
|
|
@@ -6422,15 +6424,7 @@ function recordLaunch(env, ids, options) {
|
|
|
6422
6424
|
dst: ids.TANGLE_RUN_ID,
|
|
6423
6425
|
attrs: {}
|
|
6424
6426
|
});
|
|
6425
|
-
|
|
6426
|
-
const fd = openSync(join(dir, `${host}.jsonl`), "a", 384);
|
|
6427
|
-
try {
|
|
6428
|
-
appendFileSync(fd, node);
|
|
6429
|
-
appendFileSync(fd, edge);
|
|
6430
|
-
} finally {
|
|
6431
|
-
closeSync(fd);
|
|
6432
|
-
}
|
|
6433
|
-
});
|
|
6427
|
+
appendRunLines(join(dir, `${host}.jsonl`), [node, edge], { mode: 384 });
|
|
6434
6428
|
} catch {}
|
|
6435
6429
|
}
|
|
6436
6430
|
// src/runtime/supervise/bridge-executor.ts
|
|
@@ -15850,164 +15844,6 @@ function deadlinePassed(pool, opts) {
|
|
|
15850
15844
|
const deadlineMs = pool.readout().deadlineMs;
|
|
15851
15845
|
return deadlineMs > 0 && (opts.now ?? Date.now)() >= deadlineMs;
|
|
15852
15846
|
}
|
|
15853
|
-
// src/runtime/supervise/supervisor-root-contract.ts
|
|
15854
|
-
/** A resumed process may continue only the exact root contract first recorded for this run id. Its
|
|
15855
|
-
* budget is the root's, or the one the run's last budget-carrying `reopened` row recorded. */
|
|
15856
|
-
function assertResumeContract(events, opts) {
|
|
15857
|
-
const recorded = assertResumeLimits(events, opts);
|
|
15858
|
-
if (!sameOptionalIdentity(recorded.identity, opts.rootIdentity)) throw new RuntimeRunStateError(`supervisor: resume identity mismatch for run '${opts.runId}'; ${describeIdentityMismatch(recorded.identity, opts.rootIdentity)}`);
|
|
15859
|
-
const receipts = events.filter((event) => event.kind === "materialized" && event.id === opts.runId);
|
|
15860
|
-
const expectedReceipt = rootMaterializationReceipt(opts);
|
|
15861
|
-
if (expectedReceipt === void 0) {
|
|
15862
|
-
if (receipts.length > 1) throw new RuntimeRunStateError(`supervisor: resumed run '${opts.runId}' contains duplicate root materialization evidence`);
|
|
15863
|
-
} else if (receipts.length !== 1 || contentAddress(receipts[0]?.receipt) !== contentAddress(expectedReceipt)) throw new RuntimeRunStateError(`supervisor: resume materialization mismatch for run '${opts.runId}'; backend, model, execution identity, and plan must match`);
|
|
15864
|
-
return recorded;
|
|
15865
|
-
}
|
|
15866
|
-
/**
|
|
15867
|
-
* The limits half of the resume contract: one root identity event, the recorded budget and the
|
|
15868
|
-
* reservation policy. A reopen checks them before it archives anything (`durable/run-reopen.ts`);
|
|
15869
|
-
* `reopenBudget` is the budget that reopen is about to record, which then replaces the recorded one.
|
|
15870
|
-
*/
|
|
15871
|
-
function assertResumeLimits(events, opts, reopenBudget) {
|
|
15872
|
-
const roots = events.filter((event) => event.kind === "spawned" && event.parent === void 0);
|
|
15873
|
-
if (roots.length !== 1 || roots[0]?.id !== opts.runId) throw new RuntimeRunStateError(`supervisor: resumed run '${opts.runId}' must contain exactly one root identity event; found ${roots.length}`);
|
|
15874
|
-
const recorded = roots[0];
|
|
15875
|
-
const reopenedBudget = reopenBudget ?? events.filter((event) => event.kind === "reopened" && event.id === opts.runId && event.budget !== void 0).at(-1)?.budget;
|
|
15876
|
-
if (contentAddress(reopenedBudget ?? recorded.budget) !== contentAddress(opts.budget)) throw new RuntimeRunStateError(`supervisor: resume budget mismatch for run '${opts.runId}'; use a new runId to change limits`);
|
|
15877
|
-
const expectedAdmission = opts.reservationPolicy ? { policy: opts.reservationPolicy } : void 0;
|
|
15878
|
-
if (contentAddress(recorded.recursiveAdmission ?? null) !== contentAddress(expectedAdmission ?? null)) throw new RuntimeRunStateError(`supervisor: resume reservation policy mismatch for run '${opts.runId}'; use a new runId`);
|
|
15879
|
-
return recorded;
|
|
15880
|
-
}
|
|
15881
|
-
/** Mint root evidence at the trusted composition boundary. A generic in-process Agent root has no
|
|
15882
|
-
* executor declaration and remains explicitly unknown rather than inheriting fabricated details. */
|
|
15883
|
-
function rootMaterializationReceipt(opts) {
|
|
15884
|
-
const declaration = opts.rootMaterialization;
|
|
15885
|
-
if (declaration === void 0) return unknownMaterializationReceipt({
|
|
15886
|
-
...opts.rootIdentity?.profileDigest === void 0 ? {} : { authoredProfileDigest: opts.rootIdentity.profileDigest },
|
|
15887
|
-
runtime: "inline",
|
|
15888
|
-
reason: "root-agent-did-not-report"
|
|
15889
|
-
});
|
|
15890
|
-
if (declaration.declaration === "deferred") return void 0;
|
|
15891
|
-
if (opts.rootIdentity?.profileDigest === void 0) throw new RuntimeRunStateError(`supervisor: run '${opts.runId}' cannot record known root materialization without an exact profileDigest`);
|
|
15892
|
-
try {
|
|
15893
|
-
return knownMaterializationReceipt({
|
|
15894
|
-
authoredProfileDigest: opts.rootIdentity.profileDigest,
|
|
15895
|
-
runtime: declaration.runtime,
|
|
15896
|
-
declaration: declaration.declaration
|
|
15897
|
-
});
|
|
15898
|
-
} catch (error) {
|
|
15899
|
-
throw new RuntimeRunStateError(`supervisor: run '${opts.runId}' has invalid root materialization evidence`, { cause: error });
|
|
15900
|
-
}
|
|
15901
|
-
}
|
|
15902
|
-
function rootExecutionBindingReceipt(opts, materialization, attemptId) {
|
|
15903
|
-
const root = opts.rootMaterialization;
|
|
15904
|
-
if (root?.declaration === "deferred") return void 0;
|
|
15905
|
-
if (root === void 0) return unknownExecutionBindingReceipt(materialization, attemptId, "root-agent-did-not-report");
|
|
15906
|
-
try {
|
|
15907
|
-
return knownExecutionBindingReceipt(materialization, {
|
|
15908
|
-
attemptId,
|
|
15909
|
-
...root.binding
|
|
15910
|
-
});
|
|
15911
|
-
} catch (error) {
|
|
15912
|
-
throw new RuntimeRunStateError(`supervisor: run '${opts.runId}' has invalid root execution binding`, { cause: error });
|
|
15913
|
-
}
|
|
15914
|
-
}
|
|
15915
|
-
/** Whether a segment changes what the recorded profile runs, apart from the caller's stack. */
|
|
15916
|
-
function changesRootProfile(entry) {
|
|
15917
|
-
const { stack: _stack, ...current } = entry.current;
|
|
15918
|
-
return contentAddress(current) !== contentAddress(entry.registered);
|
|
15919
|
-
}
|
|
15920
|
-
/**
|
|
15921
|
-
* Append one `root-segment` record when the root enters a segment that differs from the one it
|
|
15922
|
-
* last ran. The last record's `to` is what it last ran; a resumed run with no record last ran its
|
|
15923
|
-
* recorded profile, and a fresh run ran nothing. Every later entry on the same segment appends
|
|
15924
|
-
* nothing, so a resume after a dead supervisor or a lost stream is a boundary, not a segment.
|
|
15925
|
-
*/
|
|
15926
|
-
async function recordRootSegment(opts, events, at, fresh) {
|
|
15927
|
-
const entry = opts.rootSegment;
|
|
15928
|
-
if (entry === void 0) return;
|
|
15929
|
-
const records = events.filter((event) => event.kind === "root-segment" && event.id === opts.runId);
|
|
15930
|
-
const last = records.at(-1)?.to ?? (fresh ? void 0 : entry.registered);
|
|
15931
|
-
if (last !== void 0 && contentAddress(last) === contentAddress(entry.current)) return;
|
|
15932
|
-
await opts.journal.appendEvent(opts.runId, {
|
|
15933
|
-
kind: "root-segment",
|
|
15934
|
-
id: opts.runId,
|
|
15935
|
-
...last === void 0 ? {} : { from: last },
|
|
15936
|
-
to: entry.current,
|
|
15937
|
-
reason: entry.reason,
|
|
15938
|
-
seq: records.length,
|
|
15939
|
-
at
|
|
15940
|
-
});
|
|
15941
|
-
}
|
|
15942
|
-
/**
|
|
15943
|
-
* Append one `root-reentered` record: this process is supervising a run an earlier process drove.
|
|
15944
|
-
* After a host reboot the re-entered root ran two
|
|
15945
|
-
* barren continuations and the run settled `no-result-selected`, with three workers still open in
|
|
15946
|
-
* the journal and no record that a restart had happened.
|
|
15947
|
-
*/
|
|
15948
|
-
async function recordRootReentered(opts, resumeFrom, at) {
|
|
15949
|
-
await opts.journal.appendEvent(opts.runId, {
|
|
15950
|
-
kind: "root-reentered",
|
|
15951
|
-
id: opts.runId,
|
|
15952
|
-
...reenteredWorkers(resumeFrom, opts.runId),
|
|
15953
|
-
seq: resumeFrom.events.filter((event) => event.kind === "root-reentered").length,
|
|
15954
|
-
at
|
|
15955
|
-
});
|
|
15956
|
-
}
|
|
15957
|
-
function sameOptionalIdentity(recorded, requested) {
|
|
15958
|
-
if (recorded === void 0 || requested === void 0) return recorded === requested;
|
|
15959
|
-
return contentAddress(recorded) === contentAddress(requested);
|
|
15960
|
-
}
|
|
15961
|
-
/**
|
|
15962
|
-
* Name the identity fields that actually differ, with both values.
|
|
15963
|
-
*
|
|
15964
|
-
* The identity is compared as one content address, so a mismatch is a single boolean and the
|
|
15965
|
-
* message could only list every field that MIGHT have caused it. A caller then has to diff four
|
|
15966
|
-
* digests by hand to learn which one moved, and the common cause — a task file regenerated with
|
|
15967
|
-
* one character different — is indistinguishable from a genuinely different profile.
|
|
15968
|
-
*
|
|
15969
|
-
* Digests are truncated because the prefix identifies them and the full 64 characters push the
|
|
15970
|
-
* real content off the end of a terminal line.
|
|
15971
|
-
*/
|
|
15972
|
-
function describeIdentityMismatch(recorded, requested) {
|
|
15973
|
-
if (recorded === void 0) return "the recorded root carried no identity but this resume supplies one";
|
|
15974
|
-
if (requested === void 0) return "the recorded root carried an identity but this resume supplies none";
|
|
15975
|
-
const short = (value) => {
|
|
15976
|
-
if (value === void 0) return "(absent)";
|
|
15977
|
-
const text = typeof value === "string" ? value : JSON.stringify(value);
|
|
15978
|
-
return text.length > 20 ? `${text.slice(0, 20)}…` : text;
|
|
15979
|
-
};
|
|
15980
|
-
const differing = [
|
|
15981
|
-
"profileDigest",
|
|
15982
|
-
"taskDigest",
|
|
15983
|
-
"candidateDigest",
|
|
15984
|
-
"correlation"
|
|
15985
|
-
].filter((field) => contentAddress(recorded[field]) !== contentAddress(requested[field])).map((field) => `${field} recorded ${short(recorded[field])} but resumed with ${short(requested[field])}`);
|
|
15986
|
-
if (differing.length === 0) return "the identity objects differ in shape while every known field matches";
|
|
15987
|
-
return `${differing.join("; ")} — a different task or root profile is a new run; a resume may change the root's model, reasoning effort and harness as a new segment of this run (segment)`;
|
|
15988
|
-
}
|
|
15989
|
-
/** Validate caller-supplied root identity before any journal access. Fresh runs may omit identity,
|
|
15990
|
-
* but once supplied it is trusted durable evidence and therefore must be complete and canonical;
|
|
15991
|
-
* resumed runs always require it so the prior root can be matched exactly. */
|
|
15992
|
-
function assertRootIdentity(opts) {
|
|
15993
|
-
const identity = opts.rootIdentity;
|
|
15994
|
-
if (identity === void 0) {
|
|
15995
|
-
if (opts.resume !== true) return;
|
|
15996
|
-
throw new RuntimeRunStateError(`supervisor: resumed run '${opts.runId}' requires an exact rootIdentity with profileDigest and taskDigest`);
|
|
15997
|
-
}
|
|
15998
|
-
const unknownFields = Object.keys(identity).filter((key) => key !== "profileDigest" && key !== "taskDigest" && key !== "candidateDigest" && key !== "correlation");
|
|
15999
|
-
const correlation = identity.correlation;
|
|
16000
|
-
const validCorrelation = correlation === void 0 || typeof correlation === "object" && correlation !== null && !Array.isArray(correlation) && Object.entries(correlation).every(([key, value]) => key.length > 0 && typeof value === "string" && value.length > 0);
|
|
16001
|
-
if (unknownFields.length > 0 || !sha256DigestSchema.safeParse(identity.profileDigest).success || !sha256DigestSchema.safeParse(identity.taskDigest).success || identity.candidateDigest !== void 0 && !sha256DigestSchema.safeParse(identity.candidateDigest).success || !validCorrelation) throw new RuntimeRunStateError(`supervisor: run '${opts.runId}' requires an exact rootIdentity with valid profileDigest, taskDigest, candidateDigest, and correlation`);
|
|
16002
|
-
}
|
|
16003
|
-
/** The instant the run's root was journaled — the anchor for both the absolute deadline and the
|
|
16004
|
-
* terminal wall-clock `ms`, so a resumed run measures from its ORIGINAL start, not this
|
|
16005
|
-
* process's. */
|
|
16006
|
-
function rootStartedAtMs(root) {
|
|
16007
|
-
const startedAt = Date.parse(root.at);
|
|
16008
|
-
if (!Number.isFinite(startedAt)) throw new RuntimeRunStateError(`supervisor: root event for '${root.id}' has an invalid timestamp '${root.at}'`);
|
|
16009
|
-
return startedAt;
|
|
16010
|
-
}
|
|
16011
15847
|
// src/runtime/supervise/run-persistence.ts
|
|
16012
15848
|
/** One failed store operation revokes this controller's writes, never its retained executions. */
|
|
16013
15849
|
function guardRunPersistence(journal, blobs, interrupt) {
|
|
@@ -16294,7 +16130,8 @@ async function openRunTree(opts, now) {
|
|
|
16294
16130
|
return opened;
|
|
16295
16131
|
}
|
|
16296
16132
|
async function resumeRunTree(opts, prior, now, runStartedAt, rootAttemptId) {
|
|
16297
|
-
const
|
|
16133
|
+
const rootEvent = assertResumeContract(prior, opts);
|
|
16134
|
+
const runEpochMs = rootStartedAtMs(rootEvent);
|
|
16298
16135
|
const cancelledAtEntry = opts.signal?.aborted === true && opts.signal.reason instanceof RunCancellationReason;
|
|
16299
16136
|
const { resumeFrom, poolRestore } = await prepareScopeResume(opts, prior, opts.signal ?? new AbortController().signal, now, opts.runId, cancelledAtEntry);
|
|
16300
16137
|
const events = [...resumeFrom.events];
|
|
@@ -16668,6 +16505,6 @@ async function noWinner(settled, rejection) {
|
|
|
16668
16505
|
reason: "no-result-selected"
|
|
16669
16506
|
};
|
|
16670
16507
|
}
|
|
16671
|
-
export {
|
|
16508
|
+
export { AUTHORITY_MARKERS as $, projectSandboxOutcome as $t, createSandboxForSpec as A, createPushTraceSource as At, createRouterTranscript as B, assertProfileMaterialization as Bt, createExecutor as C, bridgeModelRouteRefusal as Ct, runAgentRounds as D, createCodexRolloutStoreReader as Dt, createSteerableSandboxSession as E, addHarnessUsage as Et, codeModeArguments as F, runSettledCommand as Ft, providerOutputOptions as G, profileMaterializationAxes$1 as Gt, createAgentEnvironmentProviderRegistry as H, controlProfileMaterialization as Ht, codeModeModelOutput as I, runWorktreeHarness as It, createWorktreeCliExecutor as J, renderUnsupported as Jt, LEAF_CONTINUATION_TASK as K, promptControlProfileMaterialization as Kt, createCodeModeTools as L, LOCAL_HARNESSES as Lt, acquireSandbox as M, bridgeRuntimeEnvKey as Mt, TERMINAL_DECISIONS as N, bridgeStopSignalKey as Nt, assertBoxlessPromptOptions as O, harnessUsageIsEmpty as Ot, defaultSelectWinner as P, defaultRunCommand as Pt, failPendingAfter as Q, worktreeCliProfileMaterialization as Qt, runCodeMode as R, harnessInvocation as Rt, captureReusableExecutorConfig as S, bridgeAdmissionRefusal as St, DEFAULT_SANDBOX_STEERING_MAX_TURNS as T, ROUTER_PRICE_SOURCE as Tt, resolveAgentEnvironmentProvider as U, defineProfileMaterializationContract as Ut, routerBrain as V, assertProfileMaterializes as Vt, providerAsExecutor as W, fullProfileMaterialization as Wt, INBOX_RECEIPT_KEY as X, sandboxProfileMaterialization as Xt, createInPlaceCliExecutor as Y, sandboxActProfileMaterialization as Yt, createInbox as Z, unsupportedProfileDimensions as Zt, withDriverExecutor as _, CheckUnavailableError as _t, bindScopeParkingDrain as a, peerMailTools as at, createExecutorRegistry as b, mapExecutorResult as bt, sleepScopeWait as c, DriverAttemptsExhaustedError as ct, runFinalizer as d, classifyDriverFailure as dt, readSandboxOutcome as en, DEFAULT_PEER_MAIL_LIMITS as et, runTree as f, summarizeDriverAttempts as ft, isDriverSpec as g, preflightPublicCoordination as gt, driverExecutorFactory as h, upstreamUnavailableSignal as ht, assertRunParking as i, isPeerMailEnvelope as it, createSandboxLineage as j, bridgeRuntimeAttachmentsKey as jt, readPromptOptions as k, readCodexRolloutSession as kt, withRunParking as l, HarnessTurnFailedError as lt, driverChild as m, undispatchedCredentialExit as mt, createSupervisor as n, claimsAuthority as nt, isRunParked as o, peerMailVerbNames as ot, createRootHandle as p, transientFailureKind as pt, providerAsSandboxClient as q, promptModelProfileMaterialization as qt, RunParkedError as r, createPeerMailbox as rt, readRunParking as s, taskToPrompt$1 as st, DEFAULT_MAX_DEPTH as t, PEER_MAIL_WIRE_KEY as tt, bestDelivered as u, abandonablePending as ut, InMemoryResultBlobStore as v, gateFactoryOnDeliverable as vt, snapshotExecutorConfig as w, priceTokens as wt, bindReusableExecutorExecutionId as x, verdictFromJudgeScore as xt, InMemorySpawnJournal as y, gateOnDeliverable as yt, toolResultText as z, terminateProcessTreeAndConfirm as zt };
|
|
16672
16509
|
|
|
16673
|
-
//# sourceMappingURL=supervisor-
|
|
16510
|
+
//# sourceMappingURL=supervisor-CHgCAMjm.js.map
|