@tangle-network/agent-runtime 10.0.3 → 10.0.5
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 +30 -0
- package/dist/{activation-kitznAHo.js → activation-DvvM7gG5.js} +2 -2
- package/dist/{activation-kitznAHo.js.map → activation-DvvM7gG5.js.map} +1 -1
- package/dist/{activation-DbSxPRUW.d.ts → activation-DyFt-GHq.d.ts} +2 -2
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +3 -3
- package/dist/{continuation-BDeKJgV3.js → continuation-Bccak14N.js} +3 -3
- package/dist/{continuation-BDeKJgV3.js.map → continuation-Bccak14N.js.map} +1 -1
- package/dist/{delegate-D8yX_2K7.js → delegate-YBqrrbq7.js} +2 -2
- package/dist/{delegate-D8yX_2K7.js.map → delegate-YBqrrbq7.js.map} +1 -1
- package/dist/{driver-control-acknowledgers-BTSr3Znq.js → driver-control-acknowledgers-CNNRjIo9.js} +99 -57
- package/dist/{driver-control-acknowledgers-BTSr3Znq.js.map → driver-control-acknowledgers-CNNRjIo9.js.map} +1 -1
- package/dist/durable-file-iPCEs_-s.js +1 -0
- package/dist/{durable-file-DUcTDWJD.js → durable-file-pao7FijS.js} +10 -3
- package/dist/{durable-file-DUcTDWJD.js.map → durable-file-pao7FijS.js.map} +1 -1
- package/dist/durable-writer-thread.js +5 -5
- package/dist/durable.d.ts +4 -1
- package/dist/durable.js +21 -15
- package/dist/durable.js.map +1 -1
- package/dist/failure-cause-DoCCGLDH.js.map +1 -1
- package/dist/{graph-4ep9laIH.js → graph-CUUtx7qT.js} +8 -12
- package/dist/{graph-4ep9laIH.js.map → graph-CUUtx7qT.js.map} +1 -1
- package/dist/{graph-registry-B-EGvJ-3.js → graph-registry-CGKyYabE.js} +1 -1
- package/dist/{graph-registry-BxEBeihr.js → graph-registry-CRskE_Yp.js} +4 -4
- package/dist/{graph-registry-BxEBeihr.js.map → graph-registry-CRskE_Yp.js.map} +1 -1
- package/dist/{improve-CJf87tBs.js → improve-Cy8PZUdw.js} +8 -8
- package/dist/{improve-CJf87tBs.js.map → improve-Cy8PZUdw.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/{jsonl-file-CVAWegN-.js → jsonl-file-vE9H9UXa.js} +3 -3
- package/dist/{jsonl-file-CVAWegN-.js.map → jsonl-file-vE9H9UXa.js.map} +1 -1
- package/dist/kernel.d.ts +2 -2
- package/dist/kernel.js +19 -19
- package/dist/{loop-runner-Ckj-Zz3-.js → loop-runner-BwkX4ViS.js} +2 -2
- package/dist/{loop-runner-Ckj-Zz3-.js.map → loop-runner-BwkX4ViS.js.map} +1 -1
- package/dist/{loop-runner-CayC8e9K.d.ts → loop-runner-Icc1iBR-.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 +6 -6
- package/dist/{model-policy-DZnL8Yj9.js → model-policy-DTbTFyOG.js} +12 -6
- package/dist/model-policy-DTbTFyOG.js.map +1 -0
- package/dist/profiles.d.ts +1 -1
- package/dist/profiles.js +1 -1
- package/dist/{provision-supervisor-NjROV7AQ.js → provision-supervisor-Dtn8RjHe.js} +7 -7
- package/dist/{provision-supervisor-NjROV7AQ.js.map → provision-supervisor-Dtn8RjHe.js.map} +1 -1
- package/dist/{result-blob-store-BR-BVZrg.js → result-blob-store-UGXQYACQ.js} +3 -3
- package/dist/{result-blob-store-BR-BVZrg.js.map → result-blob-store-UGXQYACQ.js.map} +1 -1
- package/dist/{run-cancellation-C9V1lYhq.js → run-cancellation-BpUQZqBS.js} +3 -3
- package/dist/{run-cancellation-C9V1lYhq.js.map → run-cancellation-BpUQZqBS.js.map} +1 -1
- package/dist/{run-lock-Y3u9kwM0.js → run-lock-Ckakh1Uq.js} +3 -3
- package/dist/{run-lock-Y3u9kwM0.js.map → run-lock-Ckakh1Uq.js.map} +1 -1
- package/dist/{run-reopen-CHYTHk7x.js → run-reopen-BvF3Gjj9.js} +6 -6
- package/dist/{run-reopen-CHYTHk7x.js.map → run-reopen-BvF3Gjj9.js.map} +1 -1
- package/dist/{run-state-DgKo8_tO.js → run-state-CZcFJjHn.js} +7 -7
- package/dist/{run-state-DgKo8_tO.js.map → run-state-CZcFJjHn.js.map} +1 -1
- package/dist/{runtime-CdthBQUs.js → runtime-BvDaNyFf.js} +44 -53
- package/dist/runtime-BvDaNyFf.js.map +1 -0
- package/dist/{search-executor-Bb0WuI_Z.js → search-executor-DWQW-9WN.js} +4 -4
- package/dist/{search-executor-Bb0WuI_Z.js.map → search-executor-DWQW-9WN.js.map} +1 -1
- package/dist/{server-BCtyL7jH.js → server-D5GpuQnT.js} +3 -3
- package/dist/{server-BCtyL7jH.js.map → server-D5GpuQnT.js.map} +1 -1
- package/dist/{settle-record-Beh-sXBW.js → settle-record-BFhJigPW.js} +4 -4
- package/dist/{settle-record-Beh-sXBW.js.map → settle-record-BFhJigPW.js.map} +1 -1
- package/dist/{structural-rollout-BRfSDPkv.js → structural-rollout-D1pZn6Cu.js} +4 -4
- package/dist/{structural-rollout-BRfSDPkv.js.map → structural-rollout-D1pZn6Cu.js.map} +1 -1
- package/dist/{supervise-DTUYxnoJ.js → supervise-fmugf6Y2.js} +16 -15
- package/dist/supervise-fmugf6Y2.js.map +1 -0
- package/dist/{supervise-identity-eMF-h1uP.js → supervise-identity-7_7DUghQ.js} +4 -4
- package/dist/{supervise-identity-eMF-h1uP.js.map → supervise-identity-7_7DUghQ.js.map} +1 -1
- package/dist/{supervision-discovery-CAUsSDno.js → supervision-discovery-DwRtZNdy.js} +5 -8
- package/dist/supervision-discovery-DwRtZNdy.js.map +1 -0
- package/dist/{supervisor-BtRRFbgF.js → supervisor-BlACe-uO.js} +126 -61
- package/dist/supervisor-BlACe-uO.js.map +1 -0
- package/dist/{supervisor-accounting-Cuehs4te.js → supervisor-accounting-DuFyM-_h.js} +159 -57
- package/dist/supervisor-accounting-DuFyM-_h.js.map +1 -0
- package/dist/{supervisor-root-contract-CmFKzPps.js → supervisor-root-contract-DCMw4u0V.js} +2 -2
- package/dist/{supervisor-root-contract-CmFKzPps.js.map → supervisor-root-contract-DCMw4u0V.js.map} +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +11 -11
- package/dist/{top-web-D-wuEVdM.js → top-web-C5vhiOFA.js} +7 -7
- package/dist/{top-web-D-wuEVdM.js.map → top-web-C5vhiOFA.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-PBoTtcbX.d.ts → types-CFmKHKiN.d.ts} +16 -3
- package/package.json +1 -1
- package/dist/durable-file-XqOyDf7q.js +0 -1
- package/dist/model-policy-DZnL8Yj9.js.map +0 -1
- package/dist/runtime-CdthBQUs.js.map +0 -1
- package/dist/supervise-DTUYxnoJ.js.map +0 -1
- package/dist/supervision-discovery-CAUsSDno.js.map +0 -1
- package/dist/supervisor-BtRRFbgF.js.map +0 -1
- package/dist/supervisor-accounting-Cuehs4te.js.map +0 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { Ar as
|
|
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-DuFyM-_h.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 { _ as runAbortable, f as sha256, g as linkAbort, m as abortReason, p as RunCancellationReason } from "./jsonl-file-
|
|
3
|
+
import { _ as runAbortable, f as sha256, g as linkAbort, m as abortReason, p as RunCancellationReason } from "./jsonl-file-vE9H9UXa.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";
|
|
7
7
|
import { B as turnFailurePolicy, Ct as sandboxEventServedBackend, D as unavailableResumeAt, Dt as parseCodexUsageRecord, E as unavailablePauseMs, F as executorFailureInfra, H as hashJson, M as contentAddress, N as contentRef, O as unavailableSignalOfFailure, Ot as recordValue, R as runtimeFailureRemediationSchema, S as cappedDoublingMs, St as sandboxEventProviderModels, T as reportedResetAt, U as credentialCommandExit, V as turnRemediationOf, W as isCredentialRefusal, X as createBudgetPool, _ as retainedExecutorContext, _t as createSandboxUsageLedger, b as UNAVAILABLE_CODES, bt as notifySandboxEventObserver, c as DISPATCH_NOT_ADMITTED_CODE, ct as sandboxOutputMarker, f as isProvisioningRefusal, ft as extractTransportEventIdentity, gt as createSandboxTurnEventCollector, ht as canonicalSandboxUsageMode, i as runtimeProviderCode, it as createSandboxToolPartState, l as RetainedExecutionPendingError, lt as sandboxProgressEvents, mt as assertSandboxServedModel, n as runtimeFailureCause, p as isSchemaRejection, s as DISPATCH_EXECUTION_CHANGED_CODE, st as sandboxLeafOutputFromEvents, t as reportedFailureCause, u as TRANSPORT_ERROR_CODES, v as retainedExecutorSeamKey, w as printedStatus, wt as sandboxTerminalUsageField, x as UNAVAILABLE_STATUSES, xt as sameModelId, yt as isSandboxTerminalEvent, z as turnFailureOf } from "./failure-cause-DoCCGLDH.js";
|
|
8
8
|
import { a as errMessage, i as causeChain, l as errorText, n as detachedSnapshot, o as errorHttpStatus, s as errorProperty, t as detachedFrozen, u as defaultRedactor } from "./snapshot-BKI_w3JD.js";
|
|
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-
|
|
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-DTbTFyOG.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 { r as appendRunLines, u as writeAtomicDurableFile } from "./durable-file-
|
|
12
|
+
import { i as checkVerdictOf, s as isFiniteNumber } from "./continuation-Bccak14N.js";
|
|
13
|
+
import { r as appendRunLines, u as writeAtomicDurableFile } from "./durable-file-pao7FijS.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 { n as encodeResultBlob } from "./result-blob-store-
|
|
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-
|
|
16
|
+
import { n as encodeResultBlob } from "./result-blob-store-UGXQYACQ.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-DCMw4u0V.js";
|
|
18
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";
|
|
19
19
|
import { createAgentRunOutcomeTracker } from "@tangle-network/sandbox/runtime";
|
|
20
20
|
import { SDKError, generateIdempotencyKey, isRecord, withRetry } from "@tangle-network/agent-core";
|
|
@@ -25,7 +25,7 @@ import { constants, createReadStream, existsSync } from "node:fs";
|
|
|
25
25
|
import { basename, delimiter, dirname, isAbsolute, join, relative, resolve, sep, win32 } from "node:path";
|
|
26
26
|
import { spawn } from "node:child_process";
|
|
27
27
|
import { access, chmod, copyFile, mkdir, mkdtemp, open, readFile, readdir, realpath, rm, rmdir, stat, symlink, writeFile } from "node:fs/promises";
|
|
28
|
-
import { CODEX_DISABLED_FEATURE_ARGS, applyWorkspacePlan, assertWorkspacePlanSupported, hashWorkspacePlan, materializeProfile, resolveAgentProfileResources } from "@tangle-network/agent-profile-materialize";
|
|
28
|
+
import { CODEX_DISABLED_FEATURE_ARGS, applyWorkspacePlan, assertWorkspacePlanSupported, hashWorkspacePlan, materializeProfile, qualifyModelId, resolveAgentProfileResources } from "@tangle-network/agent-profile-materialize";
|
|
29
29
|
import { stripVTControlCharacters } from "node:util";
|
|
30
30
|
import { homedir, hostname, tmpdir } from "node:os";
|
|
31
31
|
import { request } from "node:http";
|
|
@@ -592,7 +592,7 @@ function harnessProfileModel(harness, profile) {
|
|
|
592
592
|
if (!model) return void 0;
|
|
593
593
|
const provider = profile.model?.provider?.trim();
|
|
594
594
|
if (!provider) return model;
|
|
595
|
-
if (harness === "opencode") return
|
|
595
|
+
if (harness === "opencode") return qualifyModelId(provider, model);
|
|
596
596
|
if (harness === "kimi-code") return model;
|
|
597
597
|
const nativeProvider = harness === "codex" ? "openai" : "anthropic";
|
|
598
598
|
if (provider !== nativeProvider) throw new Error(`harnessInvocation: ${harness} cannot materialize model provider ${JSON.stringify(provider)}; expected ${nativeProvider}`);
|
|
@@ -7944,14 +7944,29 @@ function resultFromEvents(events, fallbackText) {
|
|
|
7944
7944
|
events
|
|
7945
7945
|
};
|
|
7946
7946
|
}
|
|
7947
|
-
/**
|
|
7947
|
+
/**
|
|
7948
|
+
* The JSON value that ends the final message settles it: the whole message, a fence ending it, or,
|
|
7949
|
+
* when it has no json fence, a line-start object ending it (the Bridge's rule in cli-bridge
|
|
7950
|
+
* src/runs/final-output.ts). Text after the value, including after a json fence, keeps it refused.
|
|
7951
|
+
*/
|
|
7948
7952
|
function finalJsonValue(text) {
|
|
7949
7953
|
if (text === void 0) return "";
|
|
7950
7954
|
try {
|
|
7951
7955
|
JSON.parse(text);
|
|
7952
7956
|
return text;
|
|
7953
7957
|
} catch {}
|
|
7954
|
-
|
|
7958
|
+
const fenced = /```(?:json)?[ \t]*\r?\n((?:(?!```)[\s\S])*)```\s*$/i.exec(text)?.[1];
|
|
7959
|
+
if (fenced !== void 0) return fenced;
|
|
7960
|
+
if (/```json[ \t]*\r?\n[\s\S]*?\r?\n```/i.test(text)) return text;
|
|
7961
|
+
if (!text.trimEnd().endsWith("}")) return text;
|
|
7962
|
+
for (let i = text.lastIndexOf("\n{"); i > 0; i = text.lastIndexOf("\n{", i - 1)) {
|
|
7963
|
+
const candidate = text.slice(i + 1);
|
|
7964
|
+
try {
|
|
7965
|
+
JSON.parse(candidate);
|
|
7966
|
+
return candidate;
|
|
7967
|
+
} catch {}
|
|
7968
|
+
}
|
|
7969
|
+
return text;
|
|
7955
7970
|
}
|
|
7956
7971
|
/** Decode only the final assistant message, keeping the stream as evidence. A stream not wholly
|
|
7957
7972
|
* read is refused, not left pending: no later read completes an ended turn's stream. */
|
|
@@ -8065,6 +8080,7 @@ var RetainedObservation = class {
|
|
|
8065
8080
|
lastObservedAt = 0;
|
|
8066
8081
|
silenceHandledAt;
|
|
8067
8082
|
exactResult;
|
|
8083
|
+
exactResultFailure;
|
|
8068
8084
|
exactResultSettled = false;
|
|
8069
8085
|
exactResultSettledAt = 0;
|
|
8070
8086
|
observedFrames = 0;
|
|
@@ -8181,11 +8197,14 @@ var RetainedObservation = class {
|
|
|
8181
8197
|
this.exactResult = awaitAbortable(Promise.resolve().then(read), this.signal);
|
|
8182
8198
|
const settle = (...failed) => {
|
|
8183
8199
|
if (this.observedFrames === 0) this.lastObservedAt = Date.now();
|
|
8184
|
-
const
|
|
8200
|
+
const rejected = failed.length > 0;
|
|
8201
|
+
const quotaRefused = rejected && exactQuotaRefusal(failed[0]) !== void 0;
|
|
8202
|
+
const retry = !retried && rejected && !quotaRefused;
|
|
8185
8203
|
if (retry) this.exactResult = void 0;
|
|
8186
8204
|
else {
|
|
8187
8205
|
this.exactResultSettled = true;
|
|
8188
8206
|
this.exactResultSettledAt = Date.now();
|
|
8207
|
+
if (rejected && !quotaRefused) this.exactResultFailure = { error: new Error(`retained provider exact-result read failed: ${observationFailureText({ error: failed[0] })}`, { cause: failed[0] }) };
|
|
8189
8208
|
}
|
|
8190
8209
|
for (const wake of [...this.exactWakers]) wake();
|
|
8191
8210
|
if (retry) this.readExactResult(true);
|
|
@@ -8307,7 +8326,7 @@ var RetainedObservation = class {
|
|
|
8307
8326
|
try {
|
|
8308
8327
|
while (true) {
|
|
8309
8328
|
if (this.framesAfterResult >= RETAINED_OBSERVATION_BATCH_EVENTS) {
|
|
8310
|
-
this.failure ??= { error: streamFailure(`retained provider stream sent ${RETAINED_OBSERVATION_BATCH_EVENTS} frames after its exact result; the rest were not read`) };
|
|
8329
|
+
this.failure ??= this.exactResultFailure ?? { error: streamFailure(`retained provider stream sent ${RETAINED_OBSERVATION_BATCH_EVENTS} frames after its exact result; the rest were not read`) };
|
|
8311
8330
|
return true;
|
|
8312
8331
|
}
|
|
8313
8332
|
if (this.observedFrames % RETAINED_OBSERVATION_BATCH_EVENTS === 0 && this.observedFrames) await awaitAbortable(new Promise((resolve) => setImmediate(resolve)), this.signal);
|
|
@@ -8325,7 +8344,7 @@ var RetainedObservation = class {
|
|
|
8325
8344
|
return false;
|
|
8326
8345
|
}
|
|
8327
8346
|
if (observed.kind === "exact-result") {
|
|
8328
|
-
this.failure ??= { error: streamFailure("retained provider stream remained open after its exact result") };
|
|
8347
|
+
this.failure ??= this.exactResultFailure ?? { error: streamFailure("retained provider stream remained open after its exact result") };
|
|
8329
8348
|
return true;
|
|
8330
8349
|
}
|
|
8331
8350
|
this.pendingRead = void 0;
|
|
@@ -12682,6 +12701,22 @@ const TERMINAL_STATUS = /* @__PURE__ */ new Set([
|
|
|
12682
12701
|
"stopped"
|
|
12683
12702
|
]);
|
|
12684
12703
|
/**
|
|
12704
|
+
* No box reached `running` within the ready budget. The platform did not refuse the shape, so a
|
|
12705
|
+
* later attempt can land: `failure` is the canonical `capacity` classification, which a supervised
|
|
12706
|
+
* node waits out and re-enters instead of failing its run. The message names the last refusal or
|
|
12707
|
+
* the box's last status; `cause` is that refusal.
|
|
12708
|
+
*/
|
|
12709
|
+
var SandboxAcquireTimeoutError = class extends Error {
|
|
12710
|
+
failure = {
|
|
12711
|
+
kind: "capacity",
|
|
12712
|
+
code: "sandbox_acquire_timeout"
|
|
12713
|
+
};
|
|
12714
|
+
constructor(message, options) {
|
|
12715
|
+
super(message, options);
|
|
12716
|
+
this.name = "SandboxAcquireTimeoutError";
|
|
12717
|
+
}
|
|
12718
|
+
};
|
|
12719
|
+
/**
|
|
12685
12720
|
* Cold-start-resilient sandbox acquisition: create by name, observe readiness from the sandbox's own status (not the create call), and re-attach after gateway timeouts.
|
|
12686
12721
|
*
|
|
12687
12722
|
* @experimental
|
|
@@ -12691,7 +12726,7 @@ async function acquireSandbox(client, options, acquire = {}) {
|
|
|
12691
12726
|
const now = acquire.now ?? Date.now;
|
|
12692
12727
|
const sleep$1 = acquire.sleep ?? ((ms) => sleep(ms, acquire.signal));
|
|
12693
12728
|
const pollMs = acquire.pollIntervalMs ?? 3e3;
|
|
12694
|
-
const
|
|
12729
|
+
const budgetMs = acquire.readyTimeoutMs ?? 6e5;
|
|
12695
12730
|
const appearScans = 5;
|
|
12696
12731
|
const name = options.name ?? acquire.name ?? `loop-sbx-${randomUuid()}`;
|
|
12697
12732
|
const createOpts = {
|
|
@@ -12699,53 +12734,60 @@ async function acquireSandbox(client, options, acquire = {}) {
|
|
|
12699
12734
|
name
|
|
12700
12735
|
};
|
|
12701
12736
|
const c = client;
|
|
12702
|
-
let
|
|
12703
|
-
|
|
12704
|
-
while (now() < deadline) {
|
|
12705
|
-
throwIfAborted(acquire.signal);
|
|
12737
|
+
for (let misses = 1;; misses += 1) {
|
|
12738
|
+
let boxed = false;
|
|
12706
12739
|
try {
|
|
12707
|
-
|
|
12708
|
-
|
|
12709
|
-
|
|
12710
|
-
|
|
12711
|
-
|
|
12712
|
-
|
|
12713
|
-
|
|
12714
|
-
|
|
12715
|
-
|
|
12740
|
+
const deadline = now() + budgetMs;
|
|
12741
|
+
let lastErr;
|
|
12742
|
+
let attempt = 0;
|
|
12743
|
+
while (now() < deadline) {
|
|
12744
|
+
throwIfAborted(acquire.signal);
|
|
12745
|
+
try {
|
|
12746
|
+
const box = await client.create(createOpts, acquire.signal === void 0 ? void 0 : { signal: acquire.signal });
|
|
12747
|
+
boxed = true;
|
|
12748
|
+
return await waitReadyOrDestroy(box, deadline, pollMs, acquire.signal, now, sleep$1);
|
|
12749
|
+
} catch (err) {
|
|
12750
|
+
throwIfAborted(acquire.signal);
|
|
12751
|
+
if (!isRetryable(err)) throw err;
|
|
12752
|
+
lastErr = err;
|
|
12753
|
+
if (typeof c.list === "function") for (let scan = 0; scan < appearScans && now() < deadline; scan += 1) {
|
|
12754
|
+
const found = (await c.list().catch(() => []))?.find((b) => b.name === name);
|
|
12755
|
+
if (found) {
|
|
12756
|
+
boxed = true;
|
|
12757
|
+
return await waitReadyOrDestroy(found, deadline, pollMs, acquire.signal, now, sleep$1);
|
|
12758
|
+
}
|
|
12759
|
+
if (scan < 4) await sleep$1(pollMs);
|
|
12760
|
+
}
|
|
12761
|
+
attempt += 1;
|
|
12762
|
+
await sleep$1(Math.min(pollMs * attempt, 15e3));
|
|
12763
|
+
}
|
|
12716
12764
|
}
|
|
12717
|
-
|
|
12718
|
-
|
|
12765
|
+
throw new SandboxAcquireTimeoutError(`acquireSandbox: could not acquire a running sandbox "${name}" within ${budgetMs} ms${lastErr instanceof Error ? `: ${lastErr.message}` : ""}`, { cause: lastErr instanceof Error ? lastErr : void 0 });
|
|
12766
|
+
} catch (error) {
|
|
12767
|
+
if (!(error instanceof SandboxAcquireTimeoutError && !boxed) || misses >= 3) throw error;
|
|
12768
|
+
await sleep$1(unavailablePauseMs(misses));
|
|
12719
12769
|
}
|
|
12720
12770
|
}
|
|
12721
|
-
throw new ValidationError$1(`acquireSandbox: could not acquire a running sandbox "${name}" within budget`, { cause: lastErr instanceof Error ? lastErr : void 0 });
|
|
12722
12771
|
}
|
|
12723
|
-
/**
|
|
12724
|
-
* that never reaches `running` (abort, terminal status,
|
|
12772
|
+
/** Wait for `running`. No status (minimal fakes) = ready. Terminal status throws. Any throw tears
|
|
12773
|
+
* the box down (best-effort) so a box that never reaches `running` (abort, terminal status,
|
|
12774
|
+
* budget) does not leak. */
|
|
12725
12775
|
async function waitReadyOrDestroy(box, deadline, pollMs, signal, now, sleep) {
|
|
12726
12776
|
try {
|
|
12727
|
-
|
|
12777
|
+
for (;;) {
|
|
12778
|
+
throwIfAborted(signal);
|
|
12779
|
+
const status = box.status;
|
|
12780
|
+
if (typeof status !== "string" || status === "running") return box;
|
|
12781
|
+
if (TERMINAL_STATUS.has(status)) throw new ValidationError$1(`acquireSandbox: sandbox ${box.id ?? "(unknown)"} is ${status}${box.error ? `: ${box.error}` : ""}`);
|
|
12782
|
+
if (now() >= deadline) throw new SandboxAcquireTimeoutError(`acquireSandbox: sandbox ${box.id ?? "(unknown)"} not running within budget (last status: ${status}${box.error ? `: ${box.error}` : ""})`);
|
|
12783
|
+
await sleep(pollMs);
|
|
12784
|
+
if (typeof box.refresh === "function") await box.refresh();
|
|
12785
|
+
}
|
|
12728
12786
|
} catch (err) {
|
|
12729
12787
|
await deleteBoxSafe(box);
|
|
12730
12788
|
throw err;
|
|
12731
12789
|
}
|
|
12732
12790
|
}
|
|
12733
|
-
/** Wait for `running`. No status (minimal fakes) = ready. Terminal status throws. */
|
|
12734
|
-
async function waitUntilReady(box, deadline, pollMs, signal, now, sleep) {
|
|
12735
|
-
for (;;) {
|
|
12736
|
-
throwIfAborted(signal);
|
|
12737
|
-
const status = readStatus(box);
|
|
12738
|
-
if (status === void 0 || status === "running") return box;
|
|
12739
|
-
if (TERMINAL_STATUS.has(status)) throw new ValidationError$1(`acquireSandbox: sandbox ${box.id ?? "(unknown)"} is ${status}${box.error ? `: ${box.error}` : ""}`);
|
|
12740
|
-
if (now() >= deadline) throw new ValidationError$1(`acquireSandbox: sandbox ${box.id ?? "(unknown)"} not running within budget (last status: ${status})`);
|
|
12741
|
-
await sleep(pollMs);
|
|
12742
|
-
if (typeof box.refresh === "function") await box.refresh();
|
|
12743
|
-
}
|
|
12744
|
-
}
|
|
12745
|
-
function readStatus(box) {
|
|
12746
|
-
const s = box.status;
|
|
12747
|
-
return typeof s === "string" ? s : void 0;
|
|
12748
|
-
}
|
|
12749
12791
|
function isRetryable(err) {
|
|
12750
12792
|
if (!err || typeof err !== "object") return false;
|
|
12751
12793
|
const e = err;
|
|
@@ -15484,7 +15526,8 @@ async function withRunParking(policy, runDir, runId, journal, now, signal, run)
|
|
|
15484
15526
|
waits: /* @__PURE__ */ new Map(),
|
|
15485
15527
|
parked,
|
|
15486
15528
|
park,
|
|
15487
|
-
handingOff: false
|
|
15529
|
+
handingOff: false,
|
|
15530
|
+
rootWakes: 0
|
|
15488
15531
|
}, run);
|
|
15489
15532
|
}
|
|
15490
15533
|
/** Run the root execution so a park decided by any of the run's waits rejects it at once. */
|
|
@@ -15500,6 +15543,22 @@ function raceRunParking(runId, scope, seal, run) {
|
|
|
15500
15543
|
return Promise.race([running, context.parked]);
|
|
15501
15544
|
}
|
|
15502
15545
|
/**
|
|
15546
|
+
* Await a root's wake on its children's events. Only here, or in its own parkable wait, is a root
|
|
15547
|
+
* free of work of its own, so only here may a child's wait park it. A park ends this wait, and a
|
|
15548
|
+
* wake that lands while the park is published takes no new step.
|
|
15549
|
+
*/
|
|
15550
|
+
async function awaitRootWake(scope, wake) {
|
|
15551
|
+
const context = parkingContext.getStore();
|
|
15552
|
+
if (context === void 0 || context.root?.scope !== scope) return wake;
|
|
15553
|
+
context.rootWakes += 1;
|
|
15554
|
+
try {
|
|
15555
|
+
const woken = await Promise.race([wake, context.parked]);
|
|
15556
|
+
return context.handingOff ? await context.parked : woken;
|
|
15557
|
+
} finally {
|
|
15558
|
+
context.rootWakes -= 1;
|
|
15559
|
+
}
|
|
15560
|
+
}
|
|
15561
|
+
/**
|
|
15503
15562
|
* Sleep through the existing wait path. The run may hand off once every live node is waiting
|
|
15504
15563
|
* here: the root on its own wait, any node on a seat reset at least SEAT_PARK_MIN_MS away. A run
|
|
15505
15564
|
* with other active work keeps its normal wait. No timer survives the handoff, and no provider
|
|
@@ -15565,14 +15624,19 @@ async function parkRun(context, waits, idleSince, events) {
|
|
|
15565
15624
|
wakeAt: new Date(earliest.wakeAt).toISOString()
|
|
15566
15625
|
};
|
|
15567
15626
|
for (const held of heldScopes(context)) closeScopeAdmission(held);
|
|
15568
|
-
|
|
15569
|
-
|
|
15570
|
-
|
|
15571
|
-
|
|
15572
|
-
|
|
15573
|
-
|
|
15574
|
-
|
|
15575
|
-
|
|
15627
|
+
try {
|
|
15628
|
+
await context.journal.appendEvent(context.runId, {
|
|
15629
|
+
kind: "run-parked",
|
|
15630
|
+
id: context.runId,
|
|
15631
|
+
...parking,
|
|
15632
|
+
seq: events.filter((event) => event.kind === "run-parked").length,
|
|
15633
|
+
at: new Date(context.now()).toISOString()
|
|
15634
|
+
});
|
|
15635
|
+
if (context.runDir !== void 0) await writeParkingProjection(context.runDir, context.runId, parking);
|
|
15636
|
+
} catch (failure) {
|
|
15637
|
+
context.park(failure);
|
|
15638
|
+
throw failure;
|
|
15639
|
+
}
|
|
15576
15640
|
const error = new RunParkedError(context.runId, parking);
|
|
15577
15641
|
if (waits.some((wait) => wait.scope !== root.scope)) root.seal(error);
|
|
15578
15642
|
context.park(error);
|
|
@@ -15587,6 +15651,7 @@ function heldScopes(context) {
|
|
|
15587
15651
|
function runIdle(context) {
|
|
15588
15652
|
const root = context.root;
|
|
15589
15653
|
if (root === void 0) return false;
|
|
15654
|
+
if (!context.waits.has(context.runId) && context.rootWakes === 0) return false;
|
|
15590
15655
|
if (heldScopes(context).some((held) => parkingDrains.get(held)?.idle() === false || held.workerCapacity.unconfirmed.length > 0)) return false;
|
|
15591
15656
|
return !(root.scope.observeTree?.() ?? root.scope.view).nodes.some((node) => node.id !== context.runId && isLiveNodeStatus(node.status) && !context.waits.has(node.id));
|
|
15592
15657
|
}
|
|
@@ -16505,6 +16570,6 @@ async function noWinner(settled, rejection) {
|
|
|
16505
16570
|
reason: "no-result-selected"
|
|
16506
16571
|
};
|
|
16507
16572
|
}
|
|
16508
|
-
export {
|
|
16573
|
+
export { failPendingAfter as $, worktreeCliProfileMaterialization as $t, readPromptOptions as A, readCodexRolloutSession as At, toolResultText as B, terminateProcessTreeAndConfirm as Bt, captureReusableExecutorConfig as C, bridgeAdmissionRefusal as Ct, createSteerableSandboxSession as D, addHarnessUsage as Dt, DEFAULT_SANDBOX_STEERING_MAX_TURNS as E, ROUTER_PRICE_SOURCE as Et, defaultSelectWinner as F, defaultRunCommand as Ft, providerAsExecutor as G, fullProfileMaterialization as Gt, routerBrain as H, assertProfileMaterializes as Ht, codeModeArguments as I, runSettledCommand as It, providerAsSandboxClient as J, promptModelProfileMaterialization as Jt, providerOutputOptions as K, profileMaterializationAxes$1 as Kt, codeModeModelOutput as L, runWorktreeHarness as Lt, createSandboxLineage as M, bridgeRuntimeAttachmentsKey as Mt, acquireSandbox as N, bridgeRuntimeEnvKey as Nt, runAgentRounds as O, createCodexRolloutStoreReader as Ot, TERMINAL_DECISIONS as P, bridgeStopSignalKey as Pt, createInbox as Q, unsupportedProfileDimensions as Qt, createCodeModeTools as R, LOCAL_HARNESSES as Rt, bindReusableExecutorExecutionId as S, verdictFromJudgeScore as St, snapshotExecutorConfig as T, priceTokens as Tt, createAgentEnvironmentProviderRegistry as U, controlProfileMaterialization as Ut, createRouterTranscript as V, assertProfileMaterialization as Vt, resolveAgentEnvironmentProvider as W, defineProfileMaterializationContract as Wt, createInPlaceCliExecutor as X, sandboxActProfileMaterialization as Xt, createWorktreeCliExecutor as Y, renderUnsupported as Yt, INBOX_RECEIPT_KEY as Z, sandboxProfileMaterialization as Zt, isDriverSpec as _, preflightPublicCoordination as _t, awaitRootWake as a, isPeerMailEnvelope as at, InMemorySpawnJournal as b, gateOnDeliverable as bt, readRunParking as c, taskToPrompt$1 as ct, bestDelivered as d, abandonablePending as dt, projectSandboxOutcome as en, AUTHORITY_MARKERS as et, runFinalizer as f, classifyDriverFailure as ft, driverExecutorFactory as g, upstreamUnavailableSignal as gt, driverChild as h, undispatchedCredentialExit as ht, assertRunParking as i, createPeerMailbox as it, createSandboxForSpec as j, createPushTraceSource as jt, assertBoxlessPromptOptions as k, harnessUsageIsEmpty as kt, sleepScopeWait as l, DriverAttemptsExhaustedError as lt, createRootHandle as m, transientFailureKind as mt, createSupervisor as n, PEER_MAIL_WIRE_KEY as nt, bindScopeParkingDrain as o, peerMailTools as ot, runTree as p, summarizeDriverAttempts as pt, LEAF_CONTINUATION_TASK as q, promptControlProfileMaterialization as qt, RunParkedError as r, claimsAuthority as rt, isRunParked as s, peerMailVerbNames as st, DEFAULT_MAX_DEPTH as t, readSandboxOutcome as tn, DEFAULT_PEER_MAIL_LIMITS as tt, withRunParking as u, HarnessTurnFailedError as ut, withDriverExecutor as v, CheckUnavailableError as vt, createExecutor as w, bridgeModelRouteRefusal as wt, createExecutorRegistry as x, mapExecutorResult as xt, InMemoryResultBlobStore as y, gateFactoryOnDeliverable as yt, runCodeMode as z, harnessInvocation as zt };
|
|
16509
16574
|
|
|
16510
|
-
//# sourceMappingURL=supervisor-
|
|
16575
|
+
//# sourceMappingURL=supervisor-BlACe-uO.js.map
|