@tangle-network/agent-runtime 3.0.28 → 3.0.30

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.
Files changed (46) hide show
  1. package/dist/{activation-S-j21Taq.js → activation-BspipHFs.js} +2 -2
  2. package/dist/{activation-S-j21Taq.js.map → activation-BspipHFs.js.map} +1 -1
  3. package/dist/agent.js +3 -3
  4. package/dist/{coordination-manager-BLBx2kRA.js → coordination-manager-CIeVgZcp.js} +4 -4
  5. package/dist/{coordination-manager-BLBx2kRA.js.map → coordination-manager-CIeVgZcp.js.map} +1 -1
  6. package/dist/{delegate-Dn0kRN_B.js → delegate-C6e7UJNA.js} +2 -2
  7. package/dist/{delegate-Dn0kRN_B.js.map → delegate-C6e7UJNA.js.map} +1 -1
  8. package/dist/durable.js +6 -6
  9. package/dist/{graph-De6rZ7m3.js → graph-CIAsV8GC.js} +5 -5
  10. package/dist/{graph-De6rZ7m3.js.map → graph-CIAsV8GC.js.map} +1 -1
  11. package/dist/{improve-B8uP78z5.js → improve-DVJMU8wm.js} +6 -6
  12. package/dist/{improve-B8uP78z5.js.map → improve-DVJMU8wm.js.map} +1 -1
  13. package/dist/index.js +8 -8
  14. package/dist/intelligence.js +4 -4
  15. package/dist/kernel.js +11 -11
  16. package/dist/{loop-runner-DEyxw1yO.js → loop-runner-BbWD5f9L.js} +2 -2
  17. package/dist/{loop-runner-DEyxw1yO.js.map → loop-runner-BbWD5f9L.js.map} +1 -1
  18. package/dist/loop-runner-bin.js +1 -1
  19. package/dist/mcp/bin.js +3 -3
  20. package/dist/mcp/index.js +5 -5
  21. package/dist/{provision-supervisor-D_ulxheH.js → provision-supervisor-RUefSoIS.js} +4 -4
  22. package/dist/{provision-supervisor-D_ulxheH.js.map → provision-supervisor-RUefSoIS.js.map} +1 -1
  23. package/dist/{run-cancellation-CR__IFPB.js → run-cancellation-s3uzwrd6.js} +2 -2
  24. package/dist/{run-cancellation-CR__IFPB.js.map → run-cancellation-s3uzwrd6.js.map} +1 -1
  25. package/dist/{runtime-BrmgtGp5.js → runtime-BpQ8jOYP.js} +11 -11
  26. package/dist/{runtime-BrmgtGp5.js.map → runtime-BpQ8jOYP.js.map} +1 -1
  27. package/dist/{scope-CO9ZhnIA.js → scope-D5T_q60y.js} +33 -30
  28. package/dist/{scope-CO9ZhnIA.js.map → scope-D5T_q60y.js.map} +1 -1
  29. package/dist/{search-executor-CvjTlr_S.js → search-executor-9mTYFafI.js} +3 -3
  30. package/dist/{search-executor-CvjTlr_S.js.map → search-executor-9mTYFafI.js.map} +1 -1
  31. package/dist/{server-CQfmSsGW.js → server-DBy7Ev8_.js} +3 -3
  32. package/dist/{server-CQfmSsGW.js.map → server-DBy7Ev8_.js.map} +1 -1
  33. package/dist/{structural-rollout-nHduSfDO.js → structural-rollout-DkMKSOOb.js} +3 -3
  34. package/dist/{structural-rollout-nHduSfDO.js.map → structural-rollout-DkMKSOOb.js.map} +1 -1
  35. package/dist/{supervise-BgoGHI7a.js → supervise-Cz5gaGDW.js} +5 -5
  36. package/dist/{supervise-BgoGHI7a.js.map → supervise-Cz5gaGDW.js.map} +1 -1
  37. package/dist/{supervision-discovery-C9wL1Iik.js → supervision-discovery-BS5k2s-A.js} +2 -2
  38. package/dist/{supervision-discovery-C9wL1Iik.js.map → supervision-discovery-BS5k2s-A.js.map} +1 -1
  39. package/dist/{supervisor-BpJizPbJ.js → supervisor-CIsucL58.js} +2 -2
  40. package/dist/{supervisor-BpJizPbJ.js.map → supervisor-CIsucL58.js.map} +1 -1
  41. package/dist/testing.js +11 -11
  42. package/dist/{top-web-CtLgM8cu.js → top-web-B981CLsj.js} +4 -4
  43. package/dist/{top-web-CtLgM8cu.js.map → top-web-B981CLsj.js.map} +1 -1
  44. package/dist/tui/bin.js +3 -3
  45. package/dist/tui/index.js +2 -2
  46. package/package.json +1 -1
@@ -13972,27 +13972,29 @@ async function runChild(live, executor, childAbort, task, opts, pool, ticket, bl
13972
13972
  }
13973
13973
  }
13974
13974
  /**
13975
- * Drain a streaming executor, folding usage events as they arrive. Each event republishes the
13976
- * running total and a fresh activity stamp onto the live child, so `scope.progress(id)` sees a
13977
- * worker mid-flight. The fold does not abort when the total crosses the reservation: executors
13978
- * report usage after the call it measures (the sandbox executor in its terminal receipt), so the
13979
- * crossing report is often the last event, and aborting would discard completed work while saving
13980
- * no spend. A cap that prevents spend belongs in the executor; an overspend is recorded at
13981
- * reconciliation.
13975
+ * Fold a streaming executor's running total onto the live child, so `scope.progress(id)` sees it.
13976
+ * The fold never aborts at the reservation: usage arrives after the call it measures, often last,
13977
+ * so aborting would discard completed work and save no spend; reconciliation records overspend.
13978
+ * `progress` rows, replaced by the settlement, publish on a leading-edge second (#2337, #2339);
13979
+ * awaiting-result rows always publish.
13982
13980
  */
13983
13981
  async function foldExecutorStream({ live, childAbort, now }, stream, journal, journalRoot, nextProgressSeq, priorSpent) {
13984
13982
  live.events.start();
13983
+ let publishedAt = Number.NEGATIVE_INFINITY;
13985
13984
  try {
13986
13985
  return await foldStream(stream, async (running, event) => {
13987
13986
  live.spent = running;
13988
13987
  live.lastActivityAt = now();
13988
+ const mark = event.kind === "progress" ? event.progress : void 0;
13989
+ if (mark?.kind !== "awaiting-result" && live.lastActivityAt - publishedAt < 1e3) return;
13990
+ publishedAt = live.lastActivityAt;
13989
13991
  await journal.appendEvent(journalRoot, {
13990
13992
  kind: "progress",
13991
13993
  id: live.id,
13992
13994
  spend: running,
13993
- ...event.kind === "progress" && event.progress.kind === "awaiting-result" ? { awaitingResult: { since: event.progress.since } } : {},
13995
+ ...mark?.kind === "awaiting-result" ? { awaitingResult: { since: mark.since } } : {},
13994
13996
  seq: nextProgressSeq(),
13995
- at: new Date(now()).toISOString()
13997
+ at: new Date(publishedAt).toISOString()
13996
13998
  });
13997
13999
  }, childAbort.signal, priorSpent, (event) => live.events.append(event, now()));
13998
14000
  } finally {
@@ -15323,14 +15325,11 @@ function assertSameSteerRequest(existing, candidate) {
15323
15325
  /**
15324
15326
  * The root manager's own provider stream, retained where Runtime owns it.
15325
15327
  *
15326
- * Measured motive (agent-runtime#1233): a CHILD's full event stream — reasoning, text,
15327
- * and tool parts, 28k to 76k reasoning characters per child — is retained in the blob its
15328
- * `settled` record names as `outRef`. The ROOT's stream reached nobody: `driveHarnessFromBackend`
15329
- * drained the root executor for accounting and discarded every `progress` event, and on a
15330
- * `winner` run `result.outRef` is the SELECTED CHILD's artifact, not the root's. A root that died
15331
- * at its join barrier (fourier-e, 63 children) left a 607-byte `failure.json` and nothing it
15332
- * thought; the Lab's only transcript of a root was a post-hoc scrape of the harness's own
15333
- * database.
15328
+ * Measured motive (agent-runtime#1233): a child's full event stream is retained in the blob its
15329
+ * `settled` record names as `outRef`, but the root's reached nobody: `driveHarnessFromBackend`
15330
+ * discarded every root `progress` event, and a `winner` run's `result.outRef` is the selected
15331
+ * child's. A root that died at its join barrier (fourier-e, 63 children) left a 607-byte
15332
+ * `failure.json` and nothing it thought.
15334
15333
  *
15335
15334
  * `<runDir>/root-stream.jsonl` is the record: one JSONL line per `ExecutorProgressEvent`, written
15336
15335
  * AS IT ARRIVES, so a root whose process is killed mid-turn keeps every line already written. The
@@ -15338,18 +15337,17 @@ function assertSameSteerRequest(existing, candidate) {
15338
15337
  * `events`, its committed line count) is what `result.json` and `failure.json` carry. The winner's
15339
15338
  * `outRef` keeps its meaning; this is a separate reference.
15340
15339
  *
15341
- * Durability boundary: lines appended in one event-loop turn reach an `O_APPEND` descriptor in one
15342
- * fenced `writeSync` when the turn ends; the file is fsynced at each drive-attempt boundary and at
15343
- * close. A fence fsyncs a lock-owner file (one ext4 journal commit): 10-20 ms on SSD and ~400 ms on
15344
- * a busy SMR drive, where a fence per line drained 2.5 events/s while the model streamed hundreds
15345
- * (us-legal-exploits-20261103a, 2026-11-02); grouped, a slow disk grows the groups, not the backlog.
15346
- * A process kill loses at most the turn in progress; a kernel crash or power loss can drop lines
15347
- * written since the last fsync, and the reader's torn-tail rule keeps such a file readable.
15340
+ * Durability boundary: after a quiet second an append reaches an `O_APPEND` descriptor when the
15341
+ * event-loop turn ends; under load, lines group into one fenced `writeSync` per second. A fence
15342
+ * fsyncs a lock-owner file: 10-20 ms on SSD, 150 ms to 1.8 s on a busy SMR drive, where a fence per
15343
+ * line drained 2.5 events/s and one per turn (one upstream page, ~24 lines) ~20/s while the model
15344
+ * streamed ~210 (us-legal-exploits-20261103a and b). The file is fsynced at each drive-attempt
15345
+ * boundary and at close. A process kill loses at most the last second; a kernel crash or power loss
15346
+ * can drop lines since the last fsync, and the reader's torn-tail rule keeps the file readable.
15348
15347
  *
15349
- * The bridge wire carries text and tool calls only: cli-bridge's SSE frames decode
15350
- * `delta.content` and `delta.tool_calls`, never a reasoning delta. A bridge-placed root's retained
15351
- * stream is therefore text plus tool calls; reasoning arrives only on the provider/sandbox path,
15352
- * which projects `message.part.updated` reasoning parts to `reasoning_delta`.
15348
+ * The bridge wire carries text and tool calls only (cli-bridge decodes `delta.content` and
15349
+ * `delta.tool_calls`), so a bridge-placed root's stream has no reasoning; reasoning arrives only on
15350
+ * the provider path, which projects `message.part.updated` reasoning parts to `reasoning_delta`.
15353
15351
  */
15354
15352
  /** The root stream: one JSONL line per progress event the root's executor observed. */
15355
15353
  const ROOT_STREAM_FILE = "root-stream.jsonl";
@@ -15373,10 +15371,12 @@ function createRootStreamSink(runDir, now, file = ROOT_STREAM_FILE, options = {}
15373
15371
  let closed = false;
15374
15372
  const pending = [];
15375
15373
  let failure;
15374
+ let flushedAt = 0;
15376
15375
  const flush = () => withClaim(() => {
15377
15376
  const writer = fd;
15378
15377
  if (pending.length === 0 || writer === void 0) return;
15379
15378
  const lines = pending.splice(0).join("\n");
15379
+ flushedAt = Date.now();
15380
15380
  try {
15381
15381
  fenceRunWrite(() => writeLine(writer, lines));
15382
15382
  } catch (error) {
@@ -15445,7 +15445,10 @@ function createRootStreamSink(runDir, now, file = ROOT_STREAM_FILE, options = {}
15445
15445
  });
15446
15446
  }
15447
15447
  pending.push(line);
15448
- if (pending.length === 1) setImmediate(flush);
15448
+ if (pending.length > 1) return;
15449
+ const wait = flushedAt + 1e3 - Date.now();
15450
+ if (wait > 0) setTimeout(flush, wait).unref();
15451
+ else setImmediate(flush);
15449
15452
  },
15450
15453
  async close() {
15451
15454
  return withClaim(async () => {
@@ -16781,4 +16784,4 @@ async function recoverRetainedChildren(args, children, spawn, next) {
16781
16784
  }
16782
16785
  export { deriveNodeExecutionIdentity as $, exactSession as $i, persistHarnessTranscript as $n, RetainedExecutionPendingError as $r, insideCursorNamespace as $t, nestedScopeSeamKey as A, sandboxLeafOutputFromEvents as Ai, workerTraceEnv as An, recordRuntimeOwnedProviderDispatchNotStarted as Ar, beginScopeRetainedOwnerDrive as At, beginScopeOwnerAttempt as B, extractLlmCallEvent as Bi, flatOtelSpan as Bn, unknownMaterializationReceipt as Br, retainedOwnerWorkspaceRetentionSeamKey as Bt, writeWorkerSteerAcknowledgement as C, newUsageTotals as Ci, nativeCopyDelayMs as Cn, inheritRuntimeOwnedExecutorAttestation as Cr, environmentReader as Ct, isTraceAnalysisStore as D, createSandboxToolPartState as Di, openSlotGroup as Dn, providerAttemptEvidence as Dr, prepareScopeRetainedOwnerTask as Dt, replaySpawnTree as E, assertValidBudget as Ei, createWorkerSlots as En, newExecutionAttemptId as Er, consumeScopeRetainedOwnerResult as Et, recoverRetainedInteractiveRun as F, extractTransportEventIdentity as Fi, buildLoopOtelSpans as Fn, runtimeOwnedExecutorMaterialization as Fr, scopeRetainedOwnerRestorePoint as Ft, scopeOwnerExecutorNodeContext as G, sandboxTerminalUsageField as Gi, sanitizeKnowledgeReadinessReport as Gn, runtimeFlowBrain as Gr, materializeTreeView as Gt, noteScopeOwnerPlannedExecution as H, notifySandboxEventObserver as Hi, loopEventToOtelSpan as Hn, executableAgentSpecSnapshot as Hr, scopeRetainedOwnerJournalRoot as Ht, startRetainedInteractiveRun as I, assertSandboxServedModel as Ii, buildLoopSpanNodes as In, runtimeOwnedExecutorProviderEvidence as Ir, noteScopeRetainedOwnerCoordination as It, providerVisibleProfile as J, parseCodexUsageRecord as Ji, captureBoundHarnessTranscript as Jn, runtimeFailureCauseSchema as Jr, nestedDriverTreeRoot as Jt, coordinationMcpAlias as K, sumSandboxUsage as Ki, sanitizeRuntimeStreamEvent as Kn, reportedFailureCause as Kr, attestNestedDriverTreeOwner as Kt, FileSpawnJournal as L, canonicalSandboxUsageMode as Li, buildRuntimeEventOtelSpans as Ln, runtimeOwnedPendingExecutorMaterialization as Lr, scopeRetainedOwnerCheckpointing as Lt, attachWorker as M, sandboxProgressEvents as Mi, createPropagatingTraceEmitter as Mn, recordRuntimeOwnedProviderModel as Mr, scopeRetainedOwnerTurnEnded as Mt, readWorkerInteractiveBinding as N, terminalTextFromSandboxEvent as Ni, mergeTraceEnv as Nn, runtimeOwnedDriveHarnessProviderEvidence as Nr, assertRetainedOwnerCoordinationRekey as Nt, parseWorkerToolTraceArtifact as O, mapSandboxEvent as Oi, resolveWorkerSlots as On, recordRuntimeOwnedDriveHarnessProviderEvidence as Or, scopeRetainedOwnerPriorSpend as Ot, reconnectRetainedInteractiveRun as P, canonicalStreamEventFromSandboxEvent as Pi, readTraceContextFromEnv as Pn, runtimeOwnedExecutorExecutionBinding as Pr, reconcileScopeRetainedOwnerEnvironment as Pt, assertRecursiveReservationPolicy as Q, awaitAbortable$1 as Qi, harnessTranscriptUnavailable as Qn, DISPATCH_NOT_ADMITTED_CODE as Qr, closesCursorSlot as Qt, appendSpawnEvents as R, createSandboxTurnEventCollector as Ri, createOpenInferenceFileExporter as Rn, runtimeOwnedScopeOwnerRuntime as Rr, bindScopeRetainedOwnerEnvironmentId as Rt, writeWorkerSteer as S, meterUsageEvent as Si, captureProviderWorkspaceSnapshot as Sn, finalizeRuntimeOwnedPendingExecutor as Sr, scopeRetainedOwnerResourceReader as St, sumSpendFromEvents as T, spendFromUsageTotals as Ti, workspaceCaptureReceipt as Tn, knownMaterializationReceipt as Tr, abandonScopeRetainedOwnerInvocation as Tt, recordScopeOwnerMaterialization as U, sameModelId as Ui, createRuntimeEventCollector as Un, isRuntimeFlowBrain as Ur, loadSpawnForest as Ut, finalizeScopeOwnerMaterialization as V, isSandboxTerminalEvent as Vi, generateSpanId as Vn, executableAgentProfileSnapshot as Vr, scopeRetainedOwnerContext as Vt, restoreScopeOwnerAcceptedExecution as W, sandboxEventServedBackend as Wi, createRuntimeStreamEventCollector as Wn, runtimeFlowAgent as Wr, ownedTreeRootSpawn as Wt, reenteredWorkers as X, RetainedRunProviderContractError as Xi, harnessTranscriptArtifact as Xn, runtimeProviderCode as Xr, encodeResultBlob as Xt, runtimeGraphMetadataKey as Y, recordValue as Yi, captureHarnessTranscript as Yn, runtimeFailureRemediationSchema as Yr, FileResultBlobStore as Yt, settledToIteration as Z, assertEventBinding as Zi, harnessTranscriptFromLines as Zn, settlementFailureCause as Zr, SpawnEventIndex as Zt, supervisorRunDir as _, executorFailure as _i, destroyInteractiveEnvironment as _n, attestRuntimeOwnedExecutor as _r, startScopeRecoveries as _t, readRootStream as a, runAbortable as aa, retainedExecutorSeamKey as ai, reconnectRetainedRun as an, DEFAULT_STALL_AFTER_MS as ar, hasRetriableTeardowns as at, workerInboxFileFromEventDir as b, isCredentialRefusal as bi, assertProviderWorkspaceRetentionPort as bn, authoredAgentIdentity as br, prepareScopeRetainedOwnerSeatSwitch as bt, cancelWorker as c, promptOptionsFromAgentTurnInput as ca, cappedDoublingMs as ci, startRetainedRunInEnvironment as cn, readWorkerProgress as cr, recordScopeOwnerBarrenPause as ct, legacySupervisorRunsRoot as d, unavailableResumeAt as di, offerInteractiveControl as dn, SeatChain as dr, registerNestedTeardownScope as dt, freezeControlRef as ea, TRANSPORT_ERROR_CODES as ei, verifyWorkspaceMarker as en, readHarnessTranscript as er, freeSlots as et, readWorkerCancelRequests as f, unavailableSignalOfFailure as fi, prepareInteractiveDelegation as fn, SeatChainExhaustedError as fr, releaseHeldEnvironments as ft, safeWorkerFile as g, contentRef as gi, verifyObserverRecords as gn, attestRuntimeOwnedDeferredExecutor as gr, settleManagerWork as gt, readWorkerSteerRequests as h, contentAddress as hi, observerRecordDigest as hn, subscriptionUsageLimitSignal as hr, retryUnconfirmedTeardowns as ht, nodeStreamFile as i, linkAbort as ia, retainedExecutorContext as ii, mintRetainedIdentity as in, retainHarnessTranscript as ir, closeScopeAdmission as it, interactiveAdmissionSeamKey as j, sandboxOutputMarker as ji, workerTraceHeaders as jn, recordRuntimeOwnedProviderIdentityConflict as jr, scopeRetainedOwnerSettled as jt, workerTraceAnalysisStore as k, mapSandboxToolEvent as ki, WORKER_TRACE_PROPAGATION as kn, recordRuntimeOwnedProviderAttemptStart as kr, scopeRetainedOwnerResult as kt, claimWorkerSteerDelivery as l, providerMessageText as la, jitteredMs as li, retainedCreateMaterial as ln, isLiveNodeStatus as lr, recordScopeOwnerDriverAttempt as lt, readWorkerSteerAcknowledgement as m, TRACE_SUMMARY_SCHEMA as mi, createFileObserverHooks as mn, seatExecutionProfile as mr, releaseRetainedEnvironments as mt, ROOT_STREAM_FILE as n, RunCancellationReason as na, isSchemaRejection as ni, stopRetainedNativeExecution as nn, readBoundHarnessSessions as nr, rollingDispatch as nt, readRootStreamReceipt as o, signalAbortError as oa, UNAVAILABLE_CODES as oi, recoverRetainedRun as on, createActivityLog as or, meterRuntimeOwnedAccounting as ot, readWorkerCancellation as p, TRACE_ROOT_SCHEMA as pi, FileObserverJournal as pn, authoredSeatStages as pr, releaseManagerEnvironment as pt, coordinationProfileToolPrefix as q, decodeHarnessUsage as qi, HARNESS_TRANSCRIPT_SETTLE_TIMEOUT_MS as qn, runtimeFailureCause as qr, driverRuntime as qt, createRootStreamSink as r, abortReason as ra, registerRetainedExecutorPreparation as ri, assertRetainedRunReplayMaterial as rn, resolveHarnessTranscriptCapture as rr, closeRetainedSlots as rt, appendWorkerControlEvent as s, promptFromAgentTurnInput as sa, UNAVAILABLE_STATUSES as si, startRetainedRun as sn, describeToolArgs as sr, meterRuntimeOwnedProviderAttempt as st, createScope as t, sameControlCoordinates as ta, isProvisioningRefusal as ti, describeRetainedNativeStops as tn, HARNESS_TRANSCRIPT_READ_LIMITS as tr, queueOf as tt, legacySupervisorRunDir as u, unavailablePauseMs as ui, acceptedInteractiveControl as un, isTerminalNodeStatus as ur, recordScopeOwnerPause as ut, supervisorRunsRoot as v, hashJson as vi, environmentGone as vn, attestRuntimeOwnedPendingExecutor as vr, unconfirmedTeardowns as vt, prepareScopeResume as w, spendFromUsageEvents as wi, openNativeMirror as wn, knownExecutionBindingReceipt as wr, resolveSpawnResourcePaths as wt, writeWorkerCancellation as x, createBudgetPool as xi, captureProviderLiveWorkspace as xn, authoredProfileDigest as xr, releaseScopeRetainedOwnerForSeatPause as xt, workerCancellationsDir as y, credentialCommandExit as yi, DEFAULT_NATIVE_CAPTURE_INTERVAL_MS as yn, attestRuntimeOwnedScopeOwner as yr, waitForScopeChildren as yt, spawnJournalRecordEvents as z, createSandboxUsageLedger as zi, createOtelExporter as zn, unknownExecutionBindingReceipt as zr, bindScopeRetainedOwnerProvider as zt };
16783
16786
 
16784
- //# sourceMappingURL=scope-CO9ZhnIA.js.map
16787
+ //# sourceMappingURL=scope-D5T_q60y.js.map