@tangle-network/agent-runtime 3.0.41 → 3.0.42

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.
@@ -1,7 +1,7 @@
1
1
  import { $n as persistHarnessTranscript, At as beginScopeRetainedOwnerDrive, B as beginScopeOwnerAttempt, Ci as meterUsageEvent, Cr as inheritRuntimeOwnedExecutorAttestation, Di as assertValidBudget, Dr as providerAttemptEvidence, Dt as prepareScopeRetainedOwnerTask, Ei as spendFromUsageTotals, Et as consumeScopeRetainedOwnerResult, Fr as runtimeOwnedExecutorMaterialization, Ft as scopeRetainedOwnerRestorePoint, G as scopeOwnerExecutorNodeContext, Gr as runtimeFlowBrain, H as noteScopeOwnerPlannedExecution, Ht as scopeRetainedOwnerJournalRoot, Ir as runtimeOwnedExecutorProviderEvidence, It as noteScopeRetainedOwnerCoordination, J as providerVisibleProfile, K as coordinationMcpAlias, Lr as runtimeOwnedPendingExecutorMaterialization, Mt as scopeRetainedOwnerTurnEnded, Nr as runtimeOwnedDriveHarnessProviderEvidence, Nt as assertRetainedOwnerCoordinationRekey, O as parseWorkerToolTraceArtifact, Or as recordRuntimeOwnedDriveHarnessProviderEvidence, Ot as scopeRetainedOwnerPriorSpend, Pr as runtimeOwnedExecutorExecutionBinding, Pt as reconcileScopeRetainedOwnerEnvironment, Q as assertRecursiveReservationPolicy, Rr as runtimeOwnedScopeOwnerRuntime, Rt as bindScopeRetainedOwnerEnvironmentId, St as scopeRetainedOwnerResourceReader, Tt as abandonScopeRetainedOwnerInvocation, U as recordScopeOwnerMaterialization, Ur as isRuntimeFlowBrain, Vn as generateSpanId, Vt as scopeRetainedOwnerContext, W as restoreScopeOwnerAcceptedExecution, Wr as runtimeFlowAgent, Xi as recordValue, Y as runtimeGraphMetadataKey, a as readRootStream, br as authoredAgentIdentity, bt as prepareScopeRetainedOwnerSeatSwitch, ct as recordScopeOwnerBarrenPause, di as unavailablePauseMs, dr as SeatChain, ei as RetainedExecutionPendingError, er as readHarnessTranscript, fi as unavailableResumeAt, fr as SeatChainExhaustedError, gi as contentAddress, ia as RunCancellationReason, ii as registerRetainedExecutorPreparation, kn as WORKER_TRACE_PROPAGATION, kt as scopeRetainedOwnerResult, li as cappedDoublingMs, lr as isLiveNodeStatus, lt as recordScopeOwnerDriverAttempt, mr as seatExecutionProfile, n as ROOT_STREAM_FILE, oa as linkAbort, oi as retainedExecutorSeamKey, or as createActivityLog, ot as meterRuntimeOwnedAccounting, pr as authoredSeatStages, q as coordinationProfileToolPrefix, r as createRootStreamSink, sa as runAbortable, st as meterRuntimeOwnedProviderAttempt, ui as jitteredMs, ur as isTerminalNodeStatus, ut as recordScopeOwnerPause, vi as executorFailure, wi as newUsageTotals, xt as releaseScopeRetainedOwnerForSeatPause, yr as attestRuntimeOwnedScopeOwner, zn as createOtelExporter, zt as bindScopeRetainedOwnerProvider } from "./scope-D04GkJ6P.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 } from "./jsonl-file-CbxMVnUj.js";
4
+ import { d as detachedSnapshot, h as errorHttpStatus, m as errMessage, p as causeChain } from "./jsonl-file-CbxMVnUj.js";
5
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 classifyDriverFailure, en as renderUnsupported, et as PEER_MAIL_WIRE_KEY, f as runTree, ft as isContentFilterRefusal, 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 summarizeDriverAttempts, rn as unsupportedProfileDimensions, rt as isPeerMailEnvelope, st as DriverAttemptsExhaustedError, u as bestDelivered, ut as causedByPartialFailure, vt as gateFactoryOnDeliverable, w as snapshotExecutorConfig, wt as bestComposite, x as bindReusableExecutorExecutionId, z as toolResultText, zt as bridgeStopSignalKey } from "./supervisor-BQz8lkcd.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";
@@ -4906,6 +4906,9 @@ const SAME_PENDING_LIMIT = 2;
4906
4906
  * queens21-h22-capture-root-1-20261019c re-entered four such boxes 154 times in 37 minutes.
4907
4907
  */
4908
4908
  const SAME_PARTIAL_FAILURE_LIMIT = 2;
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;
4909
4912
  /** `deadline` when a deadline cut the run, else `aborted`. Read before classification, which calls
4910
4913
  * every failure after an abort terminal: 61 of 62 `terminal-error` runs were a cut deadline. */
4911
4914
  function abortStop(signal) {
@@ -4953,6 +4956,23 @@ function driverRetryLimits(run) {
4953
4956
  transientOutage: Math.max(0, policy.transientOutageMs ?? DEFAULT_TRANSIENT_OUTAGE_MS)
4954
4957
  };
4955
4958
  }
4959
+ const harnessFailure = (error) => causeChain(error).find((cause) => cause instanceof HarnessTurnFailedError);
4960
+ /** The stream codes a refusal and the exact result does not, so an absent code matches any. */
4961
+ function extend(streak, error, at) {
4962
+ const code = harnessFailure(error)?.errorCode;
4963
+ const text = (code ? errMessage(error).replace(` (${code})`, "") : errMessage(error)).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
+ if (streak?.error !== text || (streak.code ?? code) !== (code ?? streak.code)) return {
4965
+ error: text,
4966
+ code,
4967
+ count: 1,
4968
+ since: at
4969
+ };
4970
+ return {
4971
+ ...streak,
4972
+ code: code ?? streak.code,
4973
+ count: streak.count + 1
4974
+ };
4975
+ }
4956
4976
  /** True once a streak has run {@link REPEATED_FAILURE_LIMIT} alike over the window by `at`. */
4957
4977
  const repeatedBy = (streak, at) => streak !== void 0 && streak.count >= REPEATED_FAILURE_LIMIT && at - streak.since >= REPEATED_FAILURE_WINDOW_MS;
4958
4978
  /** The retry loop's streaks and counters, and the decision each drive's outcome makes with them. */
@@ -5233,25 +5253,9 @@ var DriverRetryLoop = class {
5233
5253
  else this.outageSince ??= failedAt;
5234
5254
  const inOutage = idle && failedAt - (this.outageSince ?? failedAt) < limits.transientOutage;
5235
5255
  if (!inOutage) this.chargedFailures += 1;
5236
- const message = error instanceof HarnessTurnFailedError && error.errorCode !== void 0 ? errMessage(error).replace(` (${error.errorCode})`, "") : errMessage(error);
5237
- const sameFailure = failure.durationMs >= INSTANT_FAILURE_MS ? void 0 : this.sameFailure?.error === message ? {
5238
- error: message,
5239
- count: this.sameFailure.count + 1,
5240
- since: this.sameFailure.since
5241
- } : {
5242
- error: message,
5243
- count: 1,
5244
- since: failedAt
5245
- };
5256
+ const sameFailure = failure.durationMs >= INSTANT_FAILURE_MS ? void 0 : extend(this.sameFailure, error, failedAt);
5246
5257
  this.sameFailure = sameFailure;
5247
- const sameIdle = classification === "transient" && !progressed && failure.pending === void 0 ? this.sameIdle?.error === message ? {
5248
- ...this.sameIdle,
5249
- count: this.sameIdle.count + 1
5250
- } : {
5251
- error: message,
5252
- count: 1,
5253
- since: failedAt
5254
- } : void 0;
5258
+ const sameIdle = classification === "transient" && !progressed && failure.pending === void 0 ? extend(this.sameIdle, error, failedAt) : void 0;
5255
5259
  if (failure.pending === void 0 || progressed) this.sameIdle = sameIdle;
5256
5260
  if (run.signal.aborted) return abortStop(run.signal);
5257
5261
  if (classification === "terminal") return "terminal-error";
@@ -5259,7 +5263,7 @@ var DriverRetryLoop = class {
5259
5263
  const byBudget = budgetStop(run.budget(), failedAt);
5260
5264
  if (byBudget) return byBudget;
5261
5265
  if (this.refusals >= CONTENT_FILTER_REFUSAL_LIMIT) return "repeated-failure";
5262
- if (sameIdle !== void 0 && (causedByPartialFailure(error) ? sameIdle.count >= SAME_PARTIAL_FAILURE_LIMIT : run.nested === true && repeatedBy(sameIdle, failedAt))) return "repeated-failure";
5266
+ if (sameIdle !== void 0 && (causedByPartialFailure(error) ? sameIdle.count >= SAME_PARTIAL_FAILURE_LIMIT : run.nested === true && (harnessFailure(error) !== void 0 ? sameIdle.count >= SAME_HARNESS_FAILURE_LIMIT : repeatedBy(sameIdle, failedAt)))) return "repeated-failure";
5263
5267
  if (inOutage) return void 0;
5264
5268
  if (this.chargedFailures >= limits.maxAttempts) return "max-attempts";
5265
5269
  if (progressed) return repeatedBy(sameFailure, failedAt) ? "repeated-failure" : void 0;
@@ -5496,13 +5500,12 @@ var DriverRetryLoop = class {
5496
5500
  * no word of its three open workers, two barren continuations followed, and the barren bound of the
5497
5501
  * time settled the run `no-result-selected`.
5498
5502
  *
5499
- * A TRANSIENT failure that spent nothing, settled nothing and made no progress is an infrastructure
5500
- * outage until its streak has lasted `transientOutageMs`: within that window it consumes neither
5501
- * `maxAttempts` nor the barren streak, like a pause. After it the failure bounds apply, so a
5502
- * dead-on-arrival driver still stops in minutes rather than hours. The exceptions meet the same
5503
- * failure on every re-entry and stop with `repeated-failure`: a box created and then failed its
5504
- * setup (`PartialFailureError`) at a second identical attempt with no progress, and a `nested`
5505
- * manager at the repeated-failure count and window. A failure that spent tokens keeps the bounds.
5503
+ * A TRANSIENT failure that spent nothing, settled nothing and made no progress is an outage until
5504
+ * its streak has lasted `transientOutageMs`: it consumes neither `maxAttempts` nor the barren
5505
+ * streak, like a pause; after it the failure bounds apply. Failures met alike (ids and times
5506
+ * blanked) on every re-entry with no progress stop with `repeated-failure` inside the window: a
5507
+ * `PartialFailureError` box at the second, a `nested` manager's failed harness turn at the third,
5508
+ * and its other failures at the repeated-failure count and window.
5506
5509
  * A Platform restart answered
5507
5510
  * `HTTP 502 ... Platform key verification unavailable` from 03:04:34 to 03:09:41Z, and the
5508
5511
  * coordinator's twelve attempts ran out at 03:07:12Z with no token spent.
@@ -9436,4 +9439,4 @@ function superviseWithContext(profile, task, opts, brain) {
9436
9439
  }
9437
9440
  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 };
9438
9441
 
9439
- //# sourceMappingURL=supervise-Dh8Mp3v8.js.map
9442
+ //# sourceMappingURL=supervise-BO9acmsB.js.map