@tangle-network/agent-runtime 3.0.42 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{activation-C1_GUwX8.d.ts → activation-B49A14V5.d.ts} +2 -2
- package/dist/{activation-CiM6hSrn.js → activation-BiQYCayd.js} +2 -2
- package/dist/{activation-CiM6hSrn.js.map → activation-BiQYCayd.js.map} +1 -1
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +4 -4
- package/dist/{coordination-manager-_PcKOR-S.js → coordination-manager-C-ZoeZ73.js} +6 -6
- package/dist/{coordination-manager-_PcKOR-S.js.map → coordination-manager-C-ZoeZ73.js.map} +1 -1
- package/dist/{coordination-map-routing-2_hUlTnz.js → coordination-map-routing-SnsZp287.js} +2 -2
- package/dist/{coordination-map-routing-2_hUlTnz.js.map → coordination-map-routing-SnsZp287.js.map} +1 -1
- package/dist/{delegate--q1zCR-1.js → delegate-d9HcOFC5.js} +2 -2
- package/dist/{delegate--q1zCR-1.js.map → delegate-d9HcOFC5.js.map} +1 -1
- package/dist/durable.d.ts +1 -1
- package/dist/durable.js +7 -7
- package/dist/{graph-oFhKT5Ad.js → graph-C_Z0Ua10.js} +6 -6
- package/dist/{graph-oFhKT5Ad.js.map → graph-C_Z0Ua10.js.map} +1 -1
- package/dist/{graph-registry-EGeo_moB.js → graph-registry-BU7pcrUW.js} +1 -1
- package/dist/{graph-registry-BoaUV5g8.js → graph-registry-CI1o16DH.js} +3 -3
- package/dist/{graph-registry-BoaUV5g8.js.map → graph-registry-CI1o16DH.js.map} +1 -1
- package/dist/{improve-DhTBR1p-.js → improve-B4v4S8jY.js} +7 -7
- package/dist/{improve-DhTBR1p-.js.map → improve-B4v4S8jY.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 +5 -5
- package/dist/{jsonl-file-CbxMVnUj.js → jsonl-file-CvPuwM0a.js} +5 -2
- package/dist/jsonl-file-CvPuwM0a.js.map +1 -0
- package/dist/kernel.d.ts +1 -1
- package/dist/kernel.js +12 -12
- package/dist/{loop-runner-DMBWRkx0.d.ts → loop-runner-DKvA0JJr.d.ts} +2 -2
- package/dist/{loop-runner-BmtOiAiq.js → loop-runner-DMZkwlND.js} +2 -2
- package/dist/{loop-runner-BmtOiAiq.js.map → loop-runner-DMZkwlND.js.map} +1 -1
- 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-wJp8ECNK.js → provision-supervisor-Cjs4SQ9Q.js} +5 -5
- package/dist/{provision-supervisor-wJp8ECNK.js.map → provision-supervisor-Cjs4SQ9Q.js.map} +1 -1
- package/dist/{run-cancellation-Xh0hv_aO.js → run-cancellation-CGgk54Md.js} +3 -3
- package/dist/{run-cancellation-Xh0hv_aO.js.map → run-cancellation-CGgk54Md.js.map} +1 -1
- package/dist/{runtime-BsXRlG8W.js → runtime-BmxmsaNz.js} +15 -15
- package/dist/{runtime-BsXRlG8W.js.map → runtime-BmxmsaNz.js.map} +1 -1
- package/dist/{scope-D04GkJ6P.js → scope-CJ7xtrs8.js} +134 -71
- package/dist/scope-CJ7xtrs8.js.map +1 -0
- package/dist/{search-executor-Dzhi0WRa.js → search-executor-DSB6XAl1.js} +3 -3
- package/dist/{search-executor-Dzhi0WRa.js.map → search-executor-DSB6XAl1.js.map} +1 -1
- package/dist/{server-WKv4YNcI.js → server-FWT2Nt_w.js} +3 -3
- package/dist/{server-WKv4YNcI.js.map → server-FWT2Nt_w.js.map} +1 -1
- package/dist/{structural-rollout-xXWwKM4G.js → structural-rollout-Bl23HSOd.js} +3 -3
- package/dist/{structural-rollout-xXWwKM4G.js.map → structural-rollout-Bl23HSOd.js.map} +1 -1
- package/dist/{supervise-BO9acmsB.js → supervise-MAzd0hOk.js} +110 -55
- package/dist/supervise-MAzd0hOk.js.map +1 -0
- package/dist/{supervision-discovery-CcTLSYff.js → supervision-discovery-6EtvKCsU.js} +3 -3
- package/dist/{supervision-discovery-CcTLSYff.js.map → supervision-discovery-6EtvKCsU.js.map} +1 -1
- package/dist/{supervisor-BQz8lkcd.js → supervisor-CwANBb9-.js} +53 -16
- package/dist/supervisor-CwANBb9-.js.map +1 -0
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +11 -11
- package/dist/{top-web-D-QEIh-x.js → top-web-CZP3RRhD.js} +5 -5
- package/dist/{top-web-D-QEIh-x.js.map → top-web-CZP3RRhD.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-CRCOBzGj.d.ts → types-ooyUaxq_.d.ts} +21 -3
- package/package.json +2 -2
- package/dist/jsonl-file-CbxMVnUj.js.map +0 -1
- package/dist/scope-D04GkJ6P.js.map +0 -1
- package/dist/supervise-BO9acmsB.js.map +0 -1
- package/dist/supervisor-BQz8lkcd.js.map +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { $n as persistHarnessTranscript,
|
|
1
|
+
import { $n as persistHarnessTranscript, Ai as spendFromUsageTotals, At as beginScopeRetainedOwnerDrive, B as beginScopeOwnerAttempt, Di as meterUsageEvent, Dt as prepareScopeRetainedOwnerTask, Et as consumeScopeRetainedOwnerResult, Fr as runtimeOwnedExecutorExecutionBinding, Ft as scopeRetainedOwnerRestorePoint, G as scopeOwnerExecutorNodeContext, Gr as runtimeFlowAgent, H as noteScopeOwnerPlannedExecution, Ht as scopeRetainedOwnerJournalRoot, Ir as runtimeOwnedExecutorMaterialization, It as noteScopeRetainedOwnerCoordination, J as providerVisibleProfile, K as coordinationMcpAlias, Kr as runtimeFlowBrain, Lr as runtimeOwnedExecutorProviderEvidence, Mt as scopeRetainedOwnerTurnEnded, Nt as assertRetainedOwnerCoordinationRekey, O as parseWorkerToolTraceArtifact, Oi as newUsageTotals, Or as providerAttemptEvidence, Ot as scopeRetainedOwnerPriorSpend, Pr as runtimeOwnedDriveHarnessProviderEvidence, Pt as reconcileScopeRetainedOwnerEnvironment, Q as assertRecursiveReservationPolicy, Rr as runtimeOwnedPendingExecutorMaterialization, Rt as bindScopeRetainedOwnerEnvironmentId, St as scopeRetainedOwnerResourceReader, Tt as abandonScopeRetainedOwnerInvocation, U as recordScopeOwnerMaterialization, Vn as generateSpanId, Vt as scopeRetainedOwnerContext, W as restoreScopeOwnerAcceptedExecution, Wr as isRuntimeFlowBrain, Y as runtimeGraphMetadataKey, a as readRootStream, ai as registerRetainedExecutorPreparation, br as attestRuntimeOwnedScopeOwner, bt as prepareScopeRetainedOwnerSeatSwitch, ca as RunCancellationReason, ct as recordScopeOwnerBarrenPause, da as runAbortable, di as jitteredMs, dr as SEAT_RECHECK_MS, ea as recordValue, er as readHarnessTranscript, fr as SeatChain, hi as unavailableResumeAt, hr as seatExecutionProfile, ji as assertValidBudget, kn as WORKER_TRACE_PROPAGATION, kr as recordRuntimeOwnedDriveHarnessProviderEvidence, kt as scopeRetainedOwnerResult, lr as isLiveNodeStatus, lt as recordScopeOwnerDriverAttempt, mi as unavailablePauseMs, mr as authoredSeatStages, n as ROOT_STREAM_FILE, or as createActivityLog, ot as meterRuntimeOwnedAccounting, pi as reportedResetAt, pr as SeatPauseError, q as coordinationProfileToolPrefix, r as createRootStreamSink, si as retainedExecutorSeamKey, st as meterRuntimeOwnedProviderAttempt, ti as RetainedExecutionPendingError, ua as linkAbort, ui as cappedDoublingMs, ur as isTerminalNodeStatus, ut as recordScopeOwnerPause, wr as inheritRuntimeOwnedExecutorAttestation, xi as executorFailure, xr as authoredAgentIdentity, xt as releaseScopeRetainedOwnerForSeatPause, yi as contentAddress, zn as createOtelExporter, zr as runtimeOwnedScopeOwnerRuntime, zt as bindScopeRetainedOwnerProvider } from "./scope-CJ7xtrs8.js";
|
|
2
2
|
import { f as RuntimeRunStateError, i as ConfigError, m as ValidationError } from "./errors-AzSuGI23.js";
|
|
3
3
|
import { $ as isAsyncIterable, Dt as teardownExecutor, G as chargedTokens, Ot as teardownSurfaces, St as armDeadlineTimer, Tt as isDeadlineAbortReason, U as addSpend, Y as errorMessage, at as sleep, bt as DEFAULT_SUCCESSFUL_SHUTDOWN_MS, dt as zeroSpend, gt as withBudgetResources, ht as resourceTelemetry, lt as unmeteredSpend, pt as addResourceSpend, tt as promptCacheTokenClasses, ut as withTimeout } from "./workspace-streams-8ALHaZzx.js";
|
|
4
|
-
import { d as detachedSnapshot, h as errorHttpStatus, m as errMessage, p as causeChain } from "./jsonl-file-
|
|
5
|
-
import { $t as promptModelProfileMaterialization, At as bridgeModelRouteRefusal, B as createRouterTranscript, C as createExecutor, Ct as admitContinuationPolicy, Et as createContinuationKeeper, F as codeModeArguments, I as codeModeModelOutput, Jt as controlProfileMaterialization, Kt as assertProfileMaterialization, L as createCodeModeTools, Qt as promptControlProfileMaterialization, Rt as bridgeRuntimeAttachmentsKey, S as captureReusableExecutorConfig, St as CONTINUATIONS_DIR, Tt as checkVerdictOf, U as resolveAgentEnvironmentProvider, V as routerBrain, X as createInbox, Xt as fullProfileMaterialization, Y as INBOX_RECEIPT_KEY, Yt as defineProfileMaterializationContract, Zt as profileMaterializationAxes$1, _t as CheckUnavailableError, a as assertRunParking, c as sleepScopeWait, ct as HarnessTurnFailedError, d as runFinalizer, dt as
|
|
4
|
+
import { _ as errorText, d as detachedSnapshot, h as errorHttpStatus, m as errMessage, p as causeChain } from "./jsonl-file-CvPuwM0a.js";
|
|
5
|
+
import { $t as promptModelProfileMaterialization, At as bridgeModelRouteRefusal, B as createRouterTranscript, C as createExecutor, Ct as admitContinuationPolicy, Et as createContinuationKeeper, F as codeModeArguments, I as codeModeModelOutput, Jt as controlProfileMaterialization, Kt as assertProfileMaterialization, L as createCodeModeTools, Qt as promptControlProfileMaterialization, Rt as bridgeRuntimeAttachmentsKey, S as captureReusableExecutorConfig, St as CONTINUATIONS_DIR, Tt as checkVerdictOf, U as resolveAgentEnvironmentProvider, V as routerBrain, X as createInbox, Xt as fullProfileMaterialization, Y as INBOX_RECEIPT_KEY, Yt as defineProfileMaterializationContract, Zt as profileMaterializationAxes$1, _t as CheckUnavailableError, a as assertRunParking, c as sleepScopeWait, ct as HarnessTurnFailedError, d as runFinalizer, dt as isContentFilterRefusal, en as renderUnsupported, et as PEER_MAIL_WIRE_KEY, f as runTree, ft as summarizeDriverAttempts, g as isDriverSpec, gt as preflightPublicCoordination, h as driverExecutorFactory, ht as upstreamUnavailableSignal, i as RunParkedError, in as worktreeCliProfileMaterialization, kt as bridgeAdmissionRefusal, l as withRunParking, lt as abandonablePending, m as driverChild, mt as undispatchedCredentialExit, n as createSupervisor, nn as sandboxProfileMaterialization, o as bindScopeParkingDrain, p as createRootHandle, pt as transientFailureKind, rn as unsupportedProfileDimensions, rt as isPeerMailEnvelope, st as DriverAttemptsExhaustedError, u as bestDelivered, ut as classifyDriverFailure, vt as gateFactoryOnDeliverable, w as snapshotExecutorConfig, wt as bestComposite, x as bindReusableExecutorExecutionId, z as toolResultText, zt as bridgeStopSignalKey } from "./supervisor-CwANBb9-.js";
|
|
6
6
|
import { _ as agentHarness, a as concreteProfileModel, c as profileModelExecutionSettings, l as profileProviderModel, n as assertModelAllowed, o as enforceTokenLimits, r as assertProfileModelsAllowed, s as profileBridgeWireModel, t as assertExecutableAgentProfile, v as harnessRunsAgent } from "./model-policy-JOcg3NRs.js";
|
|
7
7
|
import { n as createStdioToolServer } from "./tool-server-CZWd_Opp.js";
|
|
8
8
|
import { t as composeRuntimeHooks } from "./runtime-hooks-CsW2pfFk.js";
|
|
9
|
-
import { _ as workerAssignmentNamespace, c as writeRunCancellation, d as coordinationEventId, f as externalExecutionId, g as supervisionRunNamespace, h as rootCoordinationOwner, i as readRunCancellation, l as canonicalExecution, m as freezeDetachedProfile, p as freezeDetached, r as readRunCancelRequest, s as watchRunCancellation, t as applyRunCancellation, u as childCoordinationOwner } from "./run-cancellation-
|
|
10
|
-
import { c as createSteerAcknowledger, d as coordinationVerbNames, f as createFileRunContext, l as budgetOverspendText, m as withRunContext, n as createCoordinationToolsForManager, p as createInMemoryRunContext, s as createCancelAcknowledger, t as createCoordinationTools, u as normalizeAnalyzeOnSettle } from "./coordination-manager-
|
|
11
|
-
import { o as safeJsonText } from "./coordination-map-routing-
|
|
12
|
-
import { a as graphRegistry, c as loadGraph } from "./graph-registry-
|
|
9
|
+
import { _ as workerAssignmentNamespace, c as writeRunCancellation, d as coordinationEventId, f as externalExecutionId, g as supervisionRunNamespace, h as rootCoordinationOwner, i as readRunCancellation, l as canonicalExecution, m as freezeDetachedProfile, p as freezeDetached, r as readRunCancelRequest, s as watchRunCancellation, t as applyRunCancellation, u as childCoordinationOwner } from "./run-cancellation-CGgk54Md.js";
|
|
10
|
+
import { c as createSteerAcknowledger, d as coordinationVerbNames, f as createFileRunContext, l as budgetOverspendText, m as withRunContext, n as createCoordinationToolsForManager, p as createInMemoryRunContext, s as createCancelAcknowledger, t as createCoordinationTools, u as normalizeAnalyzeOnSettle } from "./coordination-manager-C-ZoeZ73.js";
|
|
11
|
+
import { o as safeJsonText } from "./coordination-map-routing-SnsZp287.js";
|
|
12
|
+
import { a as graphRegistry, c as loadGraph } from "./graph-registry-CI1o16DH.js";
|
|
13
13
|
import { ATTR, agentIdentityAttributes } from "@tangle-network/agent-trace-contract";
|
|
14
14
|
import { ProxySecretScopeSchema, ProxySecretsSchema, agentProfileSchema, canonicalAgentProfileDigest, canonicalCandidateDigest, canonicalCandidateJson, mergeProxySecretBindings, validateAgentProfileSecurity } from "@tangle-network/agent-interface";
|
|
15
15
|
import { toolSpansToTraceAnalysisStore } from "@tangle-network/agent-eval";
|
|
@@ -2451,11 +2451,13 @@ function assertPerWorkerAdmittable(perWorker, pool, ownerShare) {
|
|
|
2451
2451
|
].filter((x) => x !== null);
|
|
2452
2452
|
if (unadmittable.length > 0) throw new ValidationError(`${unadmittable.join("; ")} — lower perWorker on that channel so a child fits beside the owner's own turns; otherwise children are refused or starve at spawn hours into the run.`);
|
|
2453
2453
|
}
|
|
2454
|
-
/** The slice a child gets when its manager names none:
|
|
2455
|
-
*
|
|
2456
|
-
*
|
|
2457
|
-
|
|
2458
|
-
|
|
2454
|
+
/** The slice a child gets when its manager names none: the part of the manager's budget its
|
|
2455
|
+
* children may reserve, divided by the run's worker slots (four with none), so the slots, not the
|
|
2456
|
+
* budget, set how many run at once. A quarter share capped managers with 8-15 slots at 2-4
|
|
2457
|
+
* children (zro-w4a16-hopper-20261104b held 4 of 8; canary-soak-20261104a queued s5-s7 163-176 s). */
|
|
2458
|
+
function defaultPerWorker(budget, ownerShare, workerSlots) {
|
|
2459
|
+
const slots = typeof workerSlots === "number" ? workerSlots : workerSlots?.max;
|
|
2460
|
+
const share = (1 - ownerShare) / (slots !== void 0 && slots > 0 ? slots : 4);
|
|
2459
2461
|
return {
|
|
2460
2462
|
...budget.resources === void 0 ? {} : { resources: Object.fromEntries(Object.entries(budget.resources).map(([name, value]) => [name, {
|
|
2461
2463
|
unit: value.unit,
|
|
@@ -3590,23 +3592,24 @@ function createCoordinationCredentials(input) {
|
|
|
3590
3592
|
current = next;
|
|
3591
3593
|
staged = void 0;
|
|
3592
3594
|
};
|
|
3595
|
+
let installing = false;
|
|
3593
3596
|
const rotate = () => {
|
|
3594
|
-
if (
|
|
3597
|
+
if (installing) throw new ConfigError("coordination credential replacement is pending");
|
|
3598
|
+
if (staged) revoked.set(staged.token.toString(), staged.expiresAt);
|
|
3595
3599
|
commit(issue());
|
|
3596
3600
|
readerToken = randomToken();
|
|
3597
3601
|
controllerToken = randomToken();
|
|
3598
3602
|
};
|
|
3599
3603
|
const replace = async (install) => {
|
|
3600
|
-
if (
|
|
3601
|
-
|
|
3602
|
-
|
|
3604
|
+
if (installing) throw new ConfigError("coordination credential replacement is pending");
|
|
3605
|
+
if (!staged || staged.expiresAt <= Date.now()) staged = issue();
|
|
3606
|
+
const next = staged;
|
|
3607
|
+
installing = true;
|
|
3603
3608
|
try {
|
|
3604
3609
|
await install(next.headers);
|
|
3605
3610
|
commit(next, true);
|
|
3606
|
-
}
|
|
3607
|
-
|
|
3608
|
-
revoked.set(next.token.toString(), next.expiresAt);
|
|
3609
|
-
throw error;
|
|
3611
|
+
} finally {
|
|
3612
|
+
installing = false;
|
|
3610
3613
|
}
|
|
3611
3614
|
};
|
|
3612
3615
|
const matches = (supplied, expected) => supplied.length === expected.length && timingSafeEqual(supplied, expected);
|
|
@@ -4291,6 +4294,7 @@ function assertCoordinationTransport(options) {
|
|
|
4291
4294
|
}
|
|
4292
4295
|
/** Response hold cap, under the 60 s MCP tool-call timeout Claude Code and Codex apply. */
|
|
4293
4296
|
const RESPONSE_FENCE_CAP_MS = 45e3;
|
|
4297
|
+
const RENEWAL_RETRY_MAX_MS = 6e4;
|
|
4294
4298
|
/** The longest a fenced call (`submit_result`, node tools) holds its response before answering with
|
|
4295
4299
|
* a receipt: half of `requestTimeoutMs` (beating the transport's 504), at most {@link RESPONSE_FENCE_CAP_MS}. */
|
|
4296
4300
|
function coordinationResponseFenceMs(requestTimeoutMs) {
|
|
@@ -4350,6 +4354,7 @@ async function serveCoordinationMcpForManager(opts, lifetime) {
|
|
|
4350
4354
|
} });
|
|
4351
4355
|
if ((opts.authentication || opts.onAudit) && (!identity.runId.trim() || !identity.actorId.trim())) throw new ConfigError("authenticated coordination requires a trusted run and actor identity");
|
|
4352
4356
|
const state = openCoordinationListenerState();
|
|
4357
|
+
let renewing = false;
|
|
4353
4358
|
const stopUnreachable = (reason) => {
|
|
4354
4359
|
state.closed = true;
|
|
4355
4360
|
try {
|
|
@@ -4364,7 +4369,9 @@ async function serveCoordinationMcpForManager(opts, lifetime) {
|
|
|
4364
4369
|
lifetimeSignal: lifetime,
|
|
4365
4370
|
lifetimeExpiresAt: opts.scope.rootDeadlineAtMs,
|
|
4366
4371
|
isClosed: () => state.closed,
|
|
4367
|
-
onExpiredBearer: () =>
|
|
4372
|
+
onExpiredBearer: () => {
|
|
4373
|
+
if (!renewing) stopUnreachable("coordination credential expired in its holder: no renewal reached it");
|
|
4374
|
+
}
|
|
4368
4375
|
});
|
|
4369
4376
|
const ctx = {
|
|
4370
4377
|
opts,
|
|
@@ -4440,15 +4447,25 @@ async function serveCoordinationMcpForManager(opts, lifetime) {
|
|
|
4440
4447
|
await pending;
|
|
4441
4448
|
};
|
|
4442
4449
|
stopCredentialBinding = stop;
|
|
4450
|
+
let failures = 0;
|
|
4443
4451
|
const schedule = () => {
|
|
4452
|
+
failures = 0;
|
|
4453
|
+
renewing = false;
|
|
4444
4454
|
const expiry = credentials.expiresAt;
|
|
4445
4455
|
if (!active || state.closed || opts.scope.signal.aborted || lifetime?.aborted || opts.scope.rootDeadlineAtMs !== void 0 && expiry >= opts.scope.rootDeadlineAtMs) return;
|
|
4446
4456
|
cancelTimer = armDeadlineTimer(Math.max(1, Math.floor((expiry - Date.now()) / 2)), renew);
|
|
4447
4457
|
};
|
|
4458
|
+
const stopped = () => !active || state.closed || opts.scope.signal.aborted || lifetime?.aborted;
|
|
4459
|
+
const retry = (error) => {
|
|
4460
|
+
if (stopped()) return;
|
|
4461
|
+
const paced = error.retryAfterMs ?? 1e3 * 2 ** failures++;
|
|
4462
|
+
console.warn(`[coordination] credential renewal retries: ${errMessage(error)}`);
|
|
4463
|
+
cancelTimer = armDeadlineTimer(Math.min(paced, RENEWAL_RETRY_MAX_MS), renew);
|
|
4464
|
+
};
|
|
4448
4465
|
const renew = () => {
|
|
4449
|
-
if (
|
|
4450
|
-
|
|
4451
|
-
pending.then(schedule,
|
|
4466
|
+
if (stopped()) return;
|
|
4467
|
+
renewing = true;
|
|
4468
|
+
pending = credentials.replace(install).then(schedule, retry);
|
|
4452
4469
|
};
|
|
4453
4470
|
refreshBoundCredential = () => {
|
|
4454
4471
|
cancelTimer?.();
|
|
@@ -4901,14 +4918,12 @@ const CONTENT_FILTER_REFUSAL_LIMIT = 8;
|
|
|
4901
4918
|
/** Consecutive identical reconciliation failures of one pending invocation that resolve it. */
|
|
4902
4919
|
const SAME_PENDING_LIMIT = 2;
|
|
4903
4920
|
/**
|
|
4904
|
-
*
|
|
4905
|
-
*
|
|
4906
|
-
*
|
|
4921
|
+
* Invocations in a row ending in one deterministic failure with nothing gained that stop the agent
|
|
4922
|
+
* with no window, so its parent acts at once: a second proves what a third repeats. Over the week
|
|
4923
|
+
* to 2026-11-04, us-legal-exploits-20261103b:s1 retried one harness refusal for 2 hours and
|
|
4924
|
+
* queens21-h22-capture-root-1-20261019c re-entered four failed boxes 154 times in 37 minutes.
|
|
4907
4925
|
*/
|
|
4908
|
-
const
|
|
4909
|
-
/** A nested manager's harness turns that ended failed alike, gaining nothing, stop it here with
|
|
4910
|
-
* no window, so its parent acts at once (us-legal-exploits-20261103b:s1 retried one 2 hours). */
|
|
4911
|
-
const SAME_HARNESS_FAILURE_LIMIT = 3;
|
|
4926
|
+
const SAME_DETERMINISTIC_LIMIT = 2;
|
|
4912
4927
|
/** `deadline` when a deadline cut the run, else `aborted`. Read before classification, which calls
|
|
4913
4928
|
* every failure after an abort terminal: 61 of 62 `terminal-error` runs were a cut deadline. */
|
|
4914
4929
|
function abortStop(signal) {
|
|
@@ -4956,11 +4971,13 @@ function driverRetryLimits(run) {
|
|
|
4956
4971
|
transientOutage: Math.max(0, policy.transientOutageMs ?? DEFAULT_TRANSIENT_OUTAGE_MS)
|
|
4957
4972
|
};
|
|
4958
4973
|
}
|
|
4959
|
-
|
|
4960
|
-
|
|
4974
|
+
/** A failure compares by the first cause under any pending-reconciliation wrapper. The stream
|
|
4975
|
+
* codes a refusal and the exact result does not, so an absent code matches any. */
|
|
4961
4976
|
function extend(streak, error, at) {
|
|
4962
|
-
const
|
|
4963
|
-
const
|
|
4977
|
+
const chain = causeChain(error);
|
|
4978
|
+
const root = chain.find((cause) => !(cause instanceof RetainedExecutionPendingError)) ?? error;
|
|
4979
|
+
const code = chain.find((cause) => cause instanceof HarnessTurnFailedError)?.errorCode;
|
|
4980
|
+
const text = (code ? errMessage(root).replace(` (${code})`, "") : errMessage(root)).replace(/\d{4}-\d\d-\d\dT[\d:.]+Z?/gu, "<time>").replace(/\b(?=[\da-f-]*\d)[\da-f]{8,}(?:-[\da-f]{4,})*\b/giu, "<id>").replace(/\d{6,}/gu, "<n>");
|
|
4964
4981
|
if (streak?.error !== text || (streak.code ?? code) !== (code ?? streak.code)) return {
|
|
4965
4982
|
error: text,
|
|
4966
4983
|
code,
|
|
@@ -5118,6 +5135,7 @@ var DriverRetryLoop = class {
|
|
|
5118
5135
|
durationMs: failure.durationMs,
|
|
5119
5136
|
error: errMessage(failure.error),
|
|
5120
5137
|
classification: failure.classification,
|
|
5138
|
+
...failure.classification === "transient" ? { failureKind: transientFailureKind(failure.error) } : {},
|
|
5121
5139
|
madeProgress: failure.progressed
|
|
5122
5140
|
};
|
|
5123
5141
|
}
|
|
@@ -5174,7 +5192,10 @@ var DriverRetryLoop = class {
|
|
|
5174
5192
|
const stop = (() => {
|
|
5175
5193
|
if (run.signal.aborted) return abortStop(run.signal);
|
|
5176
5194
|
if (!limits.retryEnabled) return "retry-disabled";
|
|
5177
|
-
|
|
5195
|
+
const byBudget = budgetStop(run.budget(), limits.now());
|
|
5196
|
+
if (byBudget) return byBudget;
|
|
5197
|
+
const deadline = run.budget().deadlineMs;
|
|
5198
|
+
return deadline > 0 && (reportedResetAt(error) ?? 0) >= deadline ? "deadline" : void 0;
|
|
5178
5199
|
})();
|
|
5179
5200
|
const unavailableSignal = upstreamUnavailableSignal(error) ?? "unavailable";
|
|
5180
5201
|
if (stop !== void 0) {
|
|
@@ -5187,7 +5208,7 @@ var DriverRetryLoop = class {
|
|
|
5187
5208
|
this.pauses += 1;
|
|
5188
5209
|
this.consecutivePauses = progressed ? 1 : this.consecutivePauses + 1;
|
|
5189
5210
|
const pausedAt = limits.now();
|
|
5190
|
-
const resetAt = unavailableResumeAt(
|
|
5211
|
+
const resetAt = unavailableResumeAt(reportedResetAt(error), pausedAt);
|
|
5191
5212
|
const deadlineMs = run.budget().deadlineMs;
|
|
5192
5213
|
const pause = resetAt === void 0 ? jitteredMs(unavailablePauseMs(this.consecutivePauses, limits.policy), limits.random) : Math.max(1e3, Math.min(resetAt, deadlineMs > 0 ? deadlineMs : resetAt) - pausedAt);
|
|
5193
5214
|
const exitCode = undispatchedCredentialExit(error);
|
|
@@ -5255,15 +5276,17 @@ var DriverRetryLoop = class {
|
|
|
5255
5276
|
if (!inOutage) this.chargedFailures += 1;
|
|
5256
5277
|
const sameFailure = failure.durationMs >= INSTANT_FAILURE_MS ? void 0 : extend(this.sameFailure, error, failedAt);
|
|
5257
5278
|
this.sameFailure = sameFailure;
|
|
5258
|
-
const
|
|
5259
|
-
if (
|
|
5279
|
+
const kind = classification === "transient" ? transientFailureKind(error) : void 0;
|
|
5280
|
+
if (progressed || kind === void 0 || isContentFilterRefusal(error)) this.sameIdle = void 0;
|
|
5281
|
+
else if (failure.pending === void 0) this.sameIdle = extend(this.sameIdle, error, failedAt);
|
|
5282
|
+
const sameIdle = this.sameIdle;
|
|
5260
5283
|
if (run.signal.aborted) return abortStop(run.signal);
|
|
5261
5284
|
if (classification === "terminal") return "terminal-error";
|
|
5262
5285
|
if (!limits.retryEnabled) return "retry-disabled";
|
|
5263
5286
|
const byBudget = budgetStop(run.budget(), failedAt);
|
|
5264
5287
|
if (byBudget) return byBudget;
|
|
5265
5288
|
if (this.refusals >= CONTENT_FILTER_REFUSAL_LIMIT) return "repeated-failure";
|
|
5266
|
-
if (sameIdle !== void 0 && (
|
|
5289
|
+
if (sameIdle !== void 0 && (kind === "deterministic" ? sameIdle.count >= SAME_DETERMINISTIC_LIMIT : run.nested === true && repeatedBy(sameIdle, failedAt))) return "repeated-failure";
|
|
5267
5290
|
if (inOutage) return void 0;
|
|
5268
5291
|
if (this.chargedFailures >= limits.maxAttempts) return "max-attempts";
|
|
5269
5292
|
if (progressed) return repeatedBy(sameFailure, failedAt) ? "repeated-failure" : void 0;
|
|
@@ -6763,7 +6786,7 @@ function automaticDriverBackendSupported(backend, coordination) {
|
|
|
6763
6786
|
function buildNestedManagerDeps(child) {
|
|
6764
6787
|
const { env, seat, admitted, spawnContext } = child;
|
|
6765
6788
|
const { options, ownerShare, authorizeDownFor, peerAuditFor } = env.setup;
|
|
6766
|
-
const nestedPerWorker = defaultPerWorker(spawnContext.budget, ownerShare);
|
|
6789
|
+
const nestedPerWorker = defaultPerWorker(spawnContext.budget, ownerShare, options.workerSlots);
|
|
6767
6790
|
const runMessageAuthority = authorizeDownFor(admitted.authorized, seat.depth + 1);
|
|
6768
6791
|
const authorizeNestedMessage = child.subtreeGraph && runMessageAuthority ? child.subtreeGraph.observeMessages(runMessageAuthority) : runMessageAuthority;
|
|
6769
6792
|
const policy = nestedSettlementPolicy(child);
|
|
@@ -6920,7 +6943,7 @@ async function storeCoordinationSecret(provider, secrets, name, bind, policy) {
|
|
|
6920
6943
|
if (!(date instanceof Date) || !Number.isFinite(date.getTime())) throw new ValidationError("provider secret receipt has no valid updatedAt");
|
|
6921
6944
|
return date.toISOString();
|
|
6922
6945
|
};
|
|
6923
|
-
let revision;
|
|
6946
|
+
let revision, adopted = false;
|
|
6924
6947
|
const prior = secrets.get(name);
|
|
6925
6948
|
if (prior?.binding === bind && prior.ready) return prior.policy;
|
|
6926
6949
|
if (prior?.binding === bind) throw new ValidationError("coordination binding is not ready");
|
|
@@ -6959,16 +6982,26 @@ async function storeCoordinationSecret(provider, secrets, name, bind, policy) {
|
|
|
6959
6982
|
const authority = (bindings) => canonicalCandidateDigest(bindings?.map(({ ttlSeconds: _, ...binding }) => binding));
|
|
6960
6983
|
if (stored.exposeInBox || authority(recovered) !== authority(policy.proxySecrets)) throw new ValidationError("stored coordination policy has different authority");
|
|
6961
6984
|
entry.policy = { proxySecrets: recovered };
|
|
6985
|
+
adopted = true;
|
|
6962
6986
|
}
|
|
6963
6987
|
}
|
|
6964
|
-
|
|
6965
|
-
|
|
6966
|
-
|
|
6967
|
-
|
|
6988
|
+
try {
|
|
6989
|
+
revision = stamp(await store.update(name, value, {
|
|
6990
|
+
...entry.policy,
|
|
6991
|
+
expectedUpdatedAt
|
|
6992
|
+
}));
|
|
6993
|
+
} catch (error) {
|
|
6994
|
+
if (entry.ready) revision = await store.list().then((rows) => stamp(rows.find((row) => row.name === name)), () => revision);
|
|
6995
|
+
throw error;
|
|
6996
|
+
}
|
|
6968
6997
|
});
|
|
6969
6998
|
entry.ready = true;
|
|
6970
6999
|
return entry.policy;
|
|
6971
7000
|
} catch (cause) {
|
|
7001
|
+
if (adopted) {
|
|
7002
|
+
secrets.delete(name);
|
|
7003
|
+
throw cause;
|
|
7004
|
+
}
|
|
6972
7005
|
await entry.release().catch((cleanup) => {
|
|
6973
7006
|
throw new AggregateError([cause, cleanup], "coordination binding and cleanup failed");
|
|
6974
7007
|
});
|
|
@@ -8345,10 +8378,14 @@ var ManagerDriveSession = class {
|
|
|
8345
8378
|
}
|
|
8346
8379
|
const seatJournalRoot = scopeRetainedOwnerJournalRoot(scope) ?? seatSelection.rootId;
|
|
8347
8380
|
this.seatChain ??= new SeatChain(authoredProfile, scope.view.root, seatJournalRoot, seatSelection.journal, seatSelection.select, now, (segment, phase) => seatSelection.onSegment(scope.view.root, segment, phase), async (selection, previous) => {
|
|
8348
|
-
if (previous
|
|
8349
|
-
|
|
8350
|
-
|
|
8351
|
-
|
|
8381
|
+
if (!previous || previous.seat === selection.seat) return;
|
|
8382
|
+
const sameEnvironment = previous.provider === selection.stage.provider && previous.harness === selection.stage.harness;
|
|
8383
|
+
try {
|
|
8384
|
+
const checkpointAt = await prepareScopeRetainedOwnerSeatSwitch(scope, sameEnvironment ? "same-environment" : "replace-environment");
|
|
8385
|
+
if (!sameEnvironment) this.switchedProviderCheckpointAt = checkpointAt;
|
|
8386
|
+
} catch (error) {
|
|
8387
|
+
scope.signal.throwIfAborted();
|
|
8388
|
+
throw new SeatPauseError(new Date(now() + SEAT_RECHECK_MS).toISOString(), `seat switch waits: ${errorText(error instanceof Error ? error.message : error)}`);
|
|
8352
8389
|
}
|
|
8353
8390
|
});
|
|
8354
8391
|
const usageLimit = reentry?.reason.reason === "upstream-unavailable" && reentry.reason.signal === "subscription-usage-limit";
|
|
@@ -8371,13 +8408,14 @@ var ManagerDriveSession = class {
|
|
|
8371
8408
|
if (afterRecheck) await seatSelection.onPause(scope.view.root, "", "resumed");
|
|
8372
8409
|
return seat;
|
|
8373
8410
|
} catch (error) {
|
|
8374
|
-
if (!(error instanceof
|
|
8411
|
+
if (!(error instanceof SeatPauseError)) throw error;
|
|
8375
8412
|
if (error.resumeAt !== pausedUntil) {
|
|
8376
8413
|
pausedUntil = error.resumeAt;
|
|
8377
8414
|
await seatSelection.journal.appendEvent(seatJournalRoot, {
|
|
8378
8415
|
kind: "seat-paused",
|
|
8379
8416
|
id: scope.view.root,
|
|
8380
8417
|
resumeAt: error.resumeAt,
|
|
8418
|
+
...error.detail === void 0 ? {} : { detail: error.detail },
|
|
8381
8419
|
seq: Date.parse(error.resumeAt),
|
|
8382
8420
|
at: new Date(now()).toISOString()
|
|
8383
8421
|
});
|
|
@@ -8848,7 +8886,7 @@ function providerSpawnPreflight(provider) {
|
|
|
8848
8886
|
const validate = provider.validateProfile?.bind(provider);
|
|
8849
8887
|
if (validate === void 0) return void 0;
|
|
8850
8888
|
return async (profile) => {
|
|
8851
|
-
const result = await validate(profile);
|
|
8889
|
+
const result = await validate(providerVisibleProfile(profile));
|
|
8852
8890
|
const errors = result.issues.filter((issue) => issue.level === "error");
|
|
8853
8891
|
if (result.ok && errors.length === 0) return void 0;
|
|
8854
8892
|
const named = errors.map((issue) => `${issue.code}${issue.path === void 0 ? "" : ` at ${issue.path}`}: ${issue.message}`);
|
|
@@ -8858,6 +8896,23 @@ function providerSpawnPreflight(provider) {
|
|
|
8858
8896
|
};
|
|
8859
8897
|
};
|
|
8860
8898
|
}
|
|
8899
|
+
/** Refuse a Runtime-managed child whose model controls its executor would refuse at its first
|
|
8900
|
+
* attempt (an unknown `model.metadata` key, an ambiguous `maxTokens`): the same check, at the call. */
|
|
8901
|
+
function modelSettingsSpawnPreflight(runtimeOwnsManager, path) {
|
|
8902
|
+
if (!runtimeOwnsManager) return void 0;
|
|
8903
|
+
return async (profile) => {
|
|
8904
|
+
try {
|
|
8905
|
+
profileModelExecutionSettings(profile, "spawn_worker", path);
|
|
8906
|
+
return;
|
|
8907
|
+
} catch (error) {
|
|
8908
|
+
if (!(error instanceof ConfigError)) throw error;
|
|
8909
|
+
return {
|
|
8910
|
+
cause: "unprovisionable-profile",
|
|
8911
|
+
detail: error.message
|
|
8912
|
+
};
|
|
8913
|
+
}
|
|
8914
|
+
};
|
|
8915
|
+
}
|
|
8861
8916
|
/** Refuse a Runtime-managed child whose declared tools cannot exist on its execution path. */
|
|
8862
8917
|
function profileToolSpawnPreflight(runtimeOwnsManager, canResolveProductTools) {
|
|
8863
8918
|
return async (profile) => {
|
|
@@ -9120,7 +9175,7 @@ function resolveRunRegistry(options) {
|
|
|
9120
9175
|
function admitPerWorker(options) {
|
|
9121
9176
|
assertRecursiveReservationPolicy(options.reservationPolicy);
|
|
9122
9177
|
const ownerShare = options.reservationPolicy?.ownerShare ?? 0;
|
|
9123
|
-
const perWorker = options.perWorker ?? defaultPerWorker(options.budget, ownerShare);
|
|
9178
|
+
const perWorker = options.perWorker ?? defaultPerWorker(options.budget, ownerShare, options.workerSlots);
|
|
9124
9179
|
assertValidBudget(perWorker, "supervise perWorker");
|
|
9125
9180
|
assertPerWorkerWithinPool(perWorker, options.budget);
|
|
9126
9181
|
if (options.perWorker !== void 0) assertPerWorkerAdmittable(perWorker, options.budget, ownerShare);
|
|
@@ -9151,7 +9206,7 @@ function managerDriverPlan(options, canonicalProfile, externalRoot) {
|
|
|
9151
9206
|
if (authoredSeatStages(canonicalProfile) && !hasCustomDriveHarness && !options.selectSeat) throw new ValidationError("supervise: AgentProfile.seats requires selectSeat before execution");
|
|
9152
9207
|
const automaticDriver = managerBackend !== void 0 && automaticDriverBackendSupported(managerBackend, options.coordination);
|
|
9153
9208
|
const spawnResourceRoot = hasCustomDriveHarness ? void 0 : rootSpawnResourceRoot(managerBackend);
|
|
9154
|
-
const spawnPreflight = composeSpawnPreflights(profileToolSpawnPreflight(options.makeWorkerAgent === void 0, options.resolveSupervisorTools !== void 0), coordinationChannelSpawnPreflight(options.makeWorkerAgent === void 0, hasCustomDriveHarness, managerBackend, options.coordination), options.backend?.backend === "bridge" ? bridgeSpawnPreflight(options.backend) : void 0, options.backend?.backend === "provider" && typeof options.backend.provider === "object" ? providerSpawnPreflight(options.backend.provider) : void 0);
|
|
9209
|
+
const spawnPreflight = composeSpawnPreflights(modelSettingsSpawnPreflight(options.makeWorkerAgent === void 0, options.backend?.backend === "provider" ? "provider" : "router"), profileToolSpawnPreflight(options.makeWorkerAgent === void 0, options.resolveSupervisorTools !== void 0), coordinationChannelSpawnPreflight(options.makeWorkerAgent === void 0, hasCustomDriveHarness, managerBackend, options.coordination), options.backend?.backend === "bridge" ? bridgeSpawnPreflight(options.backend) : void 0, options.backend?.backend === "provider" && typeof options.backend.provider === "object" ? providerSpawnPreflight(options.backend.provider) : void 0);
|
|
9155
9210
|
const driverMaterialization = hasCustomDriveHarness ? options.driveHarnessMaterialization ?? fullProfileMaterialization : managerBackend && automaticDriver ? backendProfileMaterialization(managerBackend) : void 0;
|
|
9156
9211
|
if (externalRoot && !hasCustomDriveHarness && !automaticDriver) throw new ValidationError(`supervise: external supervisor profile.harness=${JSON.stringify(canonicalProfile.harness)} requires a local bridge, a provider with authenticated coordination.publicUrl and runtime MCP attachments, or an explicit driveHarness with reachable coordination transport`);
|
|
9157
9212
|
return {
|
|
@@ -9439,4 +9494,4 @@ function superviseWithContext(profile, task, opts, brain) {
|
|
|
9439
9494
|
}
|
|
9440
9495
|
export { analyzesFindingsReportPrompt as A, anyOf as B, flowRootProfile as C, defaultEdgeTraversalCap as D, validateFlowGraph as E, formatPromptHandle as F, bestSoFar as G, plateau as H, kernelPromptRegistry as I, createSupervisorSpanRecorder as J, plateauLength as K, naiveContinuationPrompt as L, delegatesWorkerBriefPrompt as M, dumbContinuationFailPrompt as N, graphRootProfile as O, dumbContinuationPassPrompt as P, promptHandle as R, createFlowRun as S, routeFlowOf as T, anytimeReport as U, noProgressFor as V, areaUnderCurve as W, coordinationControlToolNames as _, superviseRootProfile as a, createGraphOverlay as b, retryPreSpawnRefusals as c, supervisorAgent as d, supervisorAgentWithTestBrain as f, serveCoordinationMcp as g, composeReentryTask as h, profileGuidanceComposer as i, createPromptRegistry as j, validateGraphTopology as k, withWorkerSpawnRetry as l, UNPROVEN_CONTINUITY as m, superviseFleetCapabilities as n, isPreSpawnExecutorFailure as o, runToolSpans as p, renderAnytimeTable as q, superviseWithTestBrain as r, resolveWorkerSpawnRetry as s, supervise as t, workerFromBackend as u, driverAgent as v, journaledGateDecider as w, GraphRouteError as x, runBrainLoop as y, allWorkersStalled as z };
|
|
9441
9496
|
|
|
9442
|
-
//# sourceMappingURL=supervise-
|
|
9497
|
+
//# sourceMappingURL=supervise-MAzd0hOk.js.map
|