@tangle-network/agent-runtime 0.171.0 → 0.172.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.
Files changed (47) hide show
  1. package/dist/{activation-8RxHIo02.js → activation-DTleO7Fl.js} +2 -2
  2. package/dist/{activation-8RxHIo02.js.map → activation-DTleO7Fl.js.map} +1 -1
  3. package/dist/agent.d.ts +1 -1
  4. package/dist/agent.js +2 -2
  5. package/dist/{authoring-U8BvENNa.js → authoring-c9yTIa3G.js} +2 -2
  6. package/dist/{authoring-U8BvENNa.js.map → authoring-c9yTIa3G.js.map} +1 -1
  7. package/dist/durable.d.ts +1 -1
  8. package/dist/durable.js +1 -1
  9. package/dist/{graph-DK_za3yj.js → graph-CtMnqYYC.js} +2 -2
  10. package/dist/{graph-DK_za3yj.js.map → graph-CtMnqYYC.js.map} +1 -1
  11. package/dist/graph.d.ts +1 -1
  12. package/dist/graph.js +5 -7
  13. package/dist/graph.js.map +1 -1
  14. package/dist/{improvement-cycle-BYCnKZ_G.js → improvement-cycle-ipnDcl3P.js} +3 -3
  15. package/dist/{improvement-cycle-BYCnKZ_G.js.map → improvement-cycle-ipnDcl3P.js.map} +1 -1
  16. package/dist/{index-C38CMh7Y.d.ts → index-DEEN055X.d.ts} +2 -2
  17. package/dist/{index-CTIWK6cQ.d.ts → index-cFm21prV.d.ts} +8 -9
  18. package/dist/index.d.ts +3 -3
  19. package/dist/index.js +7 -7
  20. package/dist/intelligence.js +3 -3
  21. package/dist/kernel.d.ts +1 -1
  22. package/dist/kernel.js +6 -6
  23. package/dist/{knowledge-CbSzAeP-.js → knowledge-BHfAAu6C.js} +3 -3
  24. package/dist/{knowledge-CbSzAeP-.js.map → knowledge-BHfAAu6C.js.map} +1 -1
  25. package/dist/knowledge.d.ts +1 -1
  26. package/dist/knowledge.js +1 -1
  27. package/dist/{loop-runner-bin-CglWRAZs.js → loop-runner-bin-B3ju0qWS.js} +3 -3
  28. package/dist/{loop-runner-bin-CglWRAZs.js.map → loop-runner-bin-B3ju0qWS.js.map} +1 -1
  29. package/dist/{loop-runner-bin-CxXDdDd8.d.ts → loop-runner-bin-BGcW6Gm7.d.ts} +2 -2
  30. package/dist/loop-runner-bin.d.ts +1 -1
  31. package/dist/loop-runner-bin.js +1 -1
  32. package/dist/mcp/bin.js +3 -3
  33. package/dist/mcp/index.d.ts +1 -1
  34. package/dist/mcp/index.js +4 -4
  35. package/dist/{openai-tools-B_zjkAey.js → openai-tools-CfsSJ2sn.js} +2 -2
  36. package/dist/{openai-tools-B_zjkAey.js.map → openai-tools-CfsSJ2sn.js.map} +1 -1
  37. package/dist/{runtime-DWs-CucB.js → runtime-ckAefgVV.js} +6 -6
  38. package/dist/{runtime-DWs-CucB.js.map → runtime-ckAefgVV.js.map} +1 -1
  39. package/dist/{structural-rollout-C7nNNhri.js → structural-rollout-DjUoh2aA.js} +2 -2
  40. package/dist/{structural-rollout-C7nNNhri.js.map → structural-rollout-DjUoh2aA.js.map} +1 -1
  41. package/dist/{supervise-CG7JDcEG.js → supervise-CnHd8x54.js} +2 -2
  42. package/dist/{supervise-CG7JDcEG.js.map → supervise-CnHd8x54.js.map} +1 -1
  43. package/dist/{supervisor-B-mmmiOU.js → supervisor-Dw-5mGKr.js} +19 -22
  44. package/dist/{supervisor-B-mmmiOU.js.map → supervisor-Dw-5mGKr.js.map} +1 -1
  45. package/dist/testing.d.ts +1 -1
  46. package/dist/testing.js +11 -11
  47. package/package.json +1 -1
@@ -9991,8 +9991,8 @@ function singleShotDriver(maxIterations) {
9991
9991
  * it trusts a reported `input`: the token channel is an accounting unit, not a trust boundary
9992
9992
  * against a provider that misreports its own usage.
9993
9993
  *
9994
- * Pure and deterministic: `now()` is injected, there is no I/O, and no wall-clock or
9995
- * RNG read. A `reserve`/`reconcile` ticket is single-use (fail-loud on double or
9994
+ * Pure and deterministic: the run's start instant is supplied, there is no I/O, and no
9995
+ * wall-clock or RNG read. A `reserve`/`reconcile` ticket is single-use (fail-loud on double or
9996
9996
  * unknown reconcile) so a child can never refund twice. Reconciling an OPEN ticket always
9997
9997
  * closes it: a fail-loud condition settles the reservation first and throws afterwards, so no
9998
9998
  * error path can strand a reservation past the join barrier's `assertNoOpenTickets`.
@@ -10113,15 +10113,16 @@ async function foldUsage(events) {
10113
10113
  return spendFromUsageTotals(totals);
10114
10114
  }
10115
10115
  /**
10116
- * Create a conserved reservation pool from a root `Budget`. `now()` is injected so the
10117
- * deadline readout is deterministic; defaults to `Date.now` for non-test callers. The
10118
- * absolute deadline for a fresh pool is fixed at construction (`now() + budget.deadlineMs`). A
10119
- * restored pool instead retains `restore.absoluteDeadlineMs`, so restart never slides the original
10120
- * wall-clock limit. The readout is an absolute instant, not a shrinking remainder.
10116
+ * Create a conserved reservation pool from a root `Budget`. `runStartedAtMs` is the WALL-CLOCK
10117
+ * instant the run's root was recorded, and it is the only input the deadline is derived from:
10118
+ * `runStartedAtMs + root.deadlineMs`, or `0` when the root declares no deadline. The pool holds no
10119
+ * clock, so a caller cannot hand it a run-relative one and get a duration back where an instant is
10120
+ * expected. A resumed pool passes the ORIGINAL root instant, so restart never slides the limit.
10121
+ * The readout is an absolute instant, not a shrinking remainder.
10121
10122
  */
10122
- function createBudgetPool(root, now = Date.now, restore = {}) {
10123
+ function createBudgetPool(root, runStartedAtMs, restore = {}) {
10123
10124
  assertValidBudget(root, "root budget");
10124
- if (restore.absoluteDeadlineMs !== void 0 && (!Number.isFinite(restore.absoluteDeadlineMs) || restore.absoluteDeadlineMs < 0)) throw new Error("budget restore.absoluteDeadlineMs must be a non-negative finite number");
10125
+ if (!Number.isFinite(runStartedAtMs) || runStartedAtMs < 0) throw new Error("budget runStartedAtMs must be a non-negative finite number");
10125
10126
  let freeTokens = root.maxTokens;
10126
10127
  let reservedTokens = 0;
10127
10128
  let committedTokens = 0;
@@ -10136,7 +10137,7 @@ function createBudgetPool(root, now = Date.now, restore = {}) {
10136
10137
  let freeIterations = root.maxIterations;
10137
10138
  let reservedIterations = 0;
10138
10139
  let committedIterations = 0;
10139
- const absoluteDeadlineMs = restore.absoluteDeadlineMs ?? (root.deadlineMs !== void 0 ? now() + root.deadlineMs : 0);
10140
+ const absoluteDeadlineMs = root.deadlineMs === void 0 ? 0 : runStartedAtMs + root.deadlineMs;
10140
10141
  let nextTicketId = 0;
10141
10142
  const open = /* @__PURE__ */ new Set();
10142
10143
  function reserve(b) {
@@ -10753,14 +10754,15 @@ function makeNestedScopeSeam(args, liveWorkerCapacity, childNodeId, childBudget,
10753
10754
  ...args.maxDepth !== void 0 ? { maxDepth: args.maxDepth } : {},
10754
10755
  journalRoot: args.root,
10755
10756
  mount(nestedRoot, signal) {
10756
- const deadlineMs = childDeadlineAtMs === void 0 ? void 0 : Math.max(0, childDeadlineAtMs - now());
10757
+ const mountedAtMs = now();
10758
+ const deadlineMs = childDeadlineAtMs === void 0 ? void 0 : Math.max(0, childDeadlineAtMs - mountedAtMs);
10757
10759
  return createScope({
10758
10760
  parentId: childNodeId,
10759
10761
  root: nestedRoot,
10760
10762
  pool: createBudgetPool({
10761
10763
  ...childBudget,
10762
10764
  ...deadlineMs !== void 0 ? { deadlineMs } : {}
10763
- }, now),
10765
+ }, mountedAtMs),
10764
10766
  journal: args.journal,
10765
10767
  blobs: args.blobs,
10766
10768
  executors: args.executors,
@@ -12798,9 +12800,6 @@ function rootStartedAtMs(root) {
12798
12800
  if (!Number.isFinite(startedAt)) throw new RuntimeRunStateError(`supervisor: root event for '${root.id}' has an invalid timestamp '${root.at}'`);
12799
12801
  return startedAt;
12800
12802
  }
12801
- function rootDeadline(root) {
12802
- return rootStartedAtMs(root) + (root.budget.deadlineMs ?? 0);
12803
- }
12804
12803
  /** Child reservations whose spawn was durable but whose terminal record never landed. */
12805
12804
  function uncertainSpawnBudgets(events) {
12806
12805
  const terminal = new Set(events.filter(closesCursorSlot).map((event) => event.id));
@@ -12889,14 +12888,12 @@ function createSupervisor() {
12889
12888
  let pool;
12890
12889
  let runEpochMs = runStartedAtMs;
12891
12890
  if (resuming) {
12892
- const rootEvent = assertResumeContract(prior, opts);
12893
- runEpochMs = rootStartedAtMs(rootEvent);
12891
+ runEpochMs = rootStartedAtMs(assertResumeContract(prior, opts));
12894
12892
  const measured = sumMeasuredSpendFromEvents(prior);
12895
12893
  const uncertainReservations = uncertainSpawnBudgets(prior);
12896
- pool = createBudgetPool(opts.budget, now, {
12894
+ pool = createBudgetPool(opts.budget, runEpochMs, {
12897
12895
  committed: addSpend(measured.childWork, measured.driverInference),
12898
- uncertainReservations,
12899
- ...rootEvent.budget.deadlineMs !== void 0 ? { absoluteDeadlineMs: rootDeadline(rootEvent) } : {}
12896
+ uncertainReservations
12900
12897
  });
12901
12898
  const settled = await replaySpawnTree(opts.journal, opts.blobs, opts.runId);
12902
12899
  resumeFrom = {
@@ -12910,7 +12907,7 @@ function createSupervisor() {
12910
12907
  priorSpend: sumSpendFromEvents(prior)
12911
12908
  };
12912
12909
  } else {
12913
- pool = createBudgetPool(opts.budget, now, { ...opts.budget.deadlineMs !== void 0 ? { absoluteDeadlineMs: runStartedAtMs + opts.budget.deadlineMs } : {} });
12910
+ pool = createBudgetPool(opts.budget, runStartedAtMs);
12914
12911
  await opts.journal.beginTree(opts.runId, runStartedAt);
12915
12912
  const rootReceipt = rootMaterializationReceipt(opts);
12916
12913
  const rootRuntime = opts.rootMaterialization?.runtime ?? "inline";
@@ -13413,4 +13410,4 @@ function isNonEmptySpend(s) {
13413
13410
  //#endregion
13414
13411
  export { createPushTraceSource as $, createWorktree as $t, DEFAULT_SUCCESSFUL_SHUTDOWN_MS as A, readTraceContextFromEnv as At, captureReusableExecutorConfig as B, generateSpanId as Bt, timerAt as C, acquireSandbox as Ct, freeSlots as D, observedModelMatchesDeclared as Dt, effectiveConcurrency as E, canonicalObservedModel as Et, bindReusableExecutorExecutionId as F, buildRuntimeEventOtelSpans as Ft, createWorktreeCliExecutor as G, createRuntimeEventCollector as Gt, createExecutor as H, padSpanId as Ht, bridgeAdmissionRead as I, createOpenInferenceFileExporter as It, workerTraceEnv as J, sanitizeKnowledgeReadinessReport as Jt, WORKER_TRACE_PROPAGATION as K, createRuntimeStreamEventCollector as Kt, bridgeModelRouteRefusal as L, createOtelExporter as Lt, assertValidBudget as M, INTELLIGENCE_WIRE_VERSION as Mt, createBudgetPool as N, buildLoopOtelSpans as Nt, queueOf as O, createPropagatingTraceEmitter as Ot, spendFromUsageEvents as P, buildLoopSpanNodes as Pt, createSteerableSandboxSession as Q, captureWorktreeDiff as Qt, bridgeRuntimeAttachmentsKey as R, exportEvalRuns as Rt, pollFor as S, worktreeCliProfileMaterialization as Sn, probeSandboxCapabilities as St, waitUntil as T, runBrainLoop as Tt, createExecutorRegistry as U, padTraceId as Ut, cliWorktreeExecutor as V, loopEventToOtelSpan as Vt, snapshotExecutorConfig as W, toOtelAttributes as Wt, workerTraceSeamKey as X, runSettledCommand as Xt, workerTraceHeaders as Y, sanitizeRuntimeStreamEvent as Yt, DEFAULT_SANDBOX_STEERING_MAX_TURNS as Z, runWorktreeHarness as Zt, recordScopeOwnerMaterialization as _, renderProfileMaterializationIssues as _n, createSandboxForSpec as _t, uncertainSpawnBudgets as a, parseCodexTokenUsage as an, createInbox as at, createWaitProbes as b, unsupportedProfileDimensions as bn, runAgentRounds as bt, pickBestDelivered as c, assertProfileMaterialization as cn, PEER_MAIL_WIRE_KEY as ct, driverChild as d, fullProfileMaterialization as dn, isPeerMailEnvelope as dt, removeWorktree as en, decodeToolPart as et, withDriverExecutor as f, profileMaterializationAxes$1 as fn, peerMailTools as ft, meterRuntimeOwnedProviderAttempt as g, promptResourceProfileMaterialization as gn, TERMINAL_DECISIONS as gt, meterRuntimeOwnedAccounting as h, promptOnlyProfileMaterialization as hn, isTerminalNodeStatus as ht, sumMeasuredSpendFromEvents as i, localHarnessExecutable as in, readWorkerProgress as it, teardownExecutor as j, traceContextToEnv as jt, rollingDispatch as k, mergeTraceEnv as kt, runFinalizer as l, controlProfileMaterialization as ln, claimsAuthority as lt, deriveNodeExecutionIdentity as m, promptModelProfileMaterialization as mn, isLiveNodeStatus as mt, createSupervisor as n, LOCAL_HARNESSES as nn, DEFAULT_STALL_AFTER_MS as nt, bestDelivered as o, CodexExecutionDiagnosticError as on, AUTHORITY_MARKERS as ot, createScope as p, promptControlProfileMaterialization as pn, peerMailVerbNames as pt, readWorkerTraceContext as q, sanitizeAgentRuntimeEvent as qt, maxSeqOf as r, harnessSupportsReasoningEffort as rn, createActivityLog as rt, collectDelivered as s, AGENT_PROFILE_MATERIALIZATION_AXES as sn, DEFAULT_PEER_MAIL_LIMITS as st, createRootHandle as t, DEFAULT_LOCAL_HARNESS as tn, sandboxSessionTraceSource as tt, runTree as u, defineProfileMaterializationContract as un, createPeerMailbox as ut, scopeOwnerExecutorNodeContext as v, renderUnsupported as vn, defaultSelectWinner as vt, validateWaitSpec as w, routerBrain as wt, isWaitOutcome as x, validateProfileMaterialization as xn, createSandboxLineage as xt, settledToIteration as y, sandboxActProfileMaterialization as yn, isTerminalDecision as yt, bridgeStopSignalKey as z, flatOtelSpan as zt };
13415
13412
 
13416
- //# sourceMappingURL=supervisor-B-mmmiOU.js.map
13413
+ //# sourceMappingURL=supervisor-Dw-5mGKr.js.map