@tangle-network/agent-runtime 4.0.0 → 5.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.
Files changed (80) hide show
  1. package/CHANGELOG.md +5263 -0
  2. package/dist/{activation-B49A14V5.d.ts → activation-CtLdCiH3.d.ts} +2 -2
  3. package/dist/{activation-BiQYCayd.js → activation-DGLWxFJu.js} +2 -2
  4. package/dist/{activation-BiQYCayd.js.map → activation-DGLWxFJu.js.map} +1 -1
  5. package/dist/agent.d.ts +1 -1
  6. package/dist/agent.js +4 -4
  7. package/dist/candidate-execution/index.d.ts +1 -1
  8. package/dist/{coordination-manager-C-ZoeZ73.js → coordination-manager-D74AZg7m.js} +7 -7
  9. package/dist/{coordination-manager-C-ZoeZ73.js.map → coordination-manager-D74AZg7m.js.map} +1 -1
  10. package/dist/{coordination-map-routing-SnsZp287.js → coordination-map-routing-DVjW5Gx0.js} +2 -2
  11. package/dist/{coordination-map-routing-SnsZp287.js.map → coordination-map-routing-DVjW5Gx0.js.map} +1 -1
  12. package/dist/{delegate-d9HcOFC5.js → delegate-BVyFJ9AX.js} +2 -2
  13. package/dist/{delegate-d9HcOFC5.js.map → delegate-BVyFJ9AX.js.map} +1 -1
  14. package/dist/durable.d.ts +4 -2
  15. package/dist/durable.js +12 -184
  16. package/dist/durable.js.map +1 -1
  17. package/dist/{graph-C_Z0Ua10.js → graph-r8zcRxbi.js} +6 -8
  18. package/dist/{graph-C_Z0Ua10.js.map → graph-r8zcRxbi.js.map} +1 -1
  19. package/dist/{graph-registry-CI1o16DH.js → graph-registry-B25FxBZN.js} +5 -5
  20. package/dist/graph-registry-B25FxBZN.js.map +1 -0
  21. package/dist/{graph-registry-BU7pcrUW.js → graph-registry-C-hjRx2t.js} +1 -1
  22. package/dist/{improve-B4v4S8jY.js → improve-D12GulmK.js} +7 -7
  23. package/dist/{improve-B4v4S8jY.js.map → improve-D12GulmK.js.map} +1 -1
  24. package/dist/index.d.ts +3 -3
  25. package/dist/index.js +9 -9
  26. package/dist/intelligence.d.ts +3 -3
  27. package/dist/intelligence.js +5 -5
  28. package/dist/{jsonl-file-CvPuwM0a.js → jsonl-file-CeVYTIQJ.js} +41 -32
  29. package/dist/jsonl-file-CeVYTIQJ.js.map +1 -0
  30. package/dist/kernel.d.ts +2 -2
  31. package/dist/kernel.js +14 -13
  32. package/dist/{loop-runner-DKvA0JJr.d.ts → loop-runner-BHBabRIw.d.ts} +2 -2
  33. package/dist/{loop-runner-DMZkwlND.js → loop-runner-CYcN11I4.js} +2 -2
  34. package/dist/{loop-runner-DMZkwlND.js.map → loop-runner-CYcN11I4.js.map} +1 -1
  35. package/dist/loop-runner-bin.d.ts +1 -1
  36. package/dist/loop-runner-bin.js +1 -1
  37. package/dist/mcp/bin.js +3 -3
  38. package/dist/mcp/index.d.ts +1 -1
  39. package/dist/mcp/index.js +5 -5
  40. package/dist/profiles.d.ts +1 -1
  41. package/dist/{provision-supervisor-Cjs4SQ9Q.js → provision-supervisor-BiqHJ-d4.js} +5 -5
  42. package/dist/{provision-supervisor-Cjs4SQ9Q.js.map → provision-supervisor-BiqHJ-d4.js.map} +1 -1
  43. package/dist/{run-cancellation-CGgk54Md.js → run-cancellation-D5R-7UQt.js} +3 -3
  44. package/dist/{run-cancellation-CGgk54Md.js.map → run-cancellation-D5R-7UQt.js.map} +1 -1
  45. package/dist/run-state-DRh8BOFi.js +350 -0
  46. package/dist/run-state-DRh8BOFi.js.map +1 -0
  47. package/dist/{runtime-BmxmsaNz.js → runtime-BX_9-DJB.js} +18 -17
  48. package/dist/runtime-BX_9-DJB.js.map +1 -0
  49. package/dist/{scope-CJ7xtrs8.js → scope-JcCkUy_z.js} +151 -106
  50. package/dist/scope-JcCkUy_z.js.map +1 -0
  51. package/dist/{search-executor-DSB6XAl1.js → search-executor-CdmaS5r4.js} +3 -3
  52. package/dist/{search-executor-DSB6XAl1.js.map → search-executor-CdmaS5r4.js.map} +1 -1
  53. package/dist/{server-FWT2Nt_w.js → server-BY6OluUf.js} +3 -3
  54. package/dist/{server-FWT2Nt_w.js.map → server-BY6OluUf.js.map} +1 -1
  55. package/dist/settle-record-BSDDf9Z4.js +130 -0
  56. package/dist/settle-record-BSDDf9Z4.js.map +1 -0
  57. package/dist/{structural-rollout-Bl23HSOd.js → structural-rollout-BjMUUXLn.js} +3 -3
  58. package/dist/{structural-rollout-Bl23HSOd.js.map → structural-rollout-BjMUUXLn.js.map} +1 -1
  59. package/dist/{supervise-MAzd0hOk.js → supervise-rYEsVVcn.js} +172 -384
  60. package/dist/supervise-rYEsVVcn.js.map +1 -0
  61. package/dist/{supervision-discovery-6EtvKCsU.js → supervision-discovery-D95Ack4J.js} +4 -129
  62. package/dist/supervision-discovery-D95Ack4J.js.map +1 -0
  63. package/dist/{supervisor-CwANBb9-.js → supervisor-B-bX69uL.js} +178 -120
  64. package/dist/supervisor-B-bX69uL.js.map +1 -0
  65. package/dist/testing.d.ts +1 -1
  66. package/dist/testing.js +11 -11
  67. package/dist/{top-web-CZP3RRhD.js → top-web-D-wH9ipn.js} +13 -9
  68. package/dist/{top-web-CZP3RRhD.js.map → top-web-D-wH9ipn.js.map} +1 -1
  69. package/dist/tui/bin.js +3 -3
  70. package/dist/tui/index.d.ts +1 -1
  71. package/dist/tui/index.js +2 -2
  72. package/dist/{types-ooyUaxq_.d.ts → types-DblV14Oe.d.ts} +187 -222
  73. package/package.json +7 -8
  74. package/dist/graph-registry-CI1o16DH.js.map +0 -1
  75. package/dist/jsonl-file-CvPuwM0a.js.map +0 -1
  76. package/dist/runtime-BmxmsaNz.js.map +0 -1
  77. package/dist/scope-CJ7xtrs8.js.map +0 -1
  78. package/dist/supervise-MAzd0hOk.js.map +0 -1
  79. package/dist/supervision-discovery-6EtvKCsU.js.map +0 -1
  80. package/dist/supervisor-CwANBb9-.js.map +0 -1
@@ -1,6 +1,6 @@
1
- import { c as RetainedInteractiveAdmissionError, d as RetainedRunDispatchBindingError, f as RuntimeRunStateError, l as RetainedInteractiveBindingError, m as ValidationError, r as BackendTransportError, u as RetainedRunAdmissionError } from "./errors-AzSuGI23.js";
1
+ import { c as RetainedInteractiveAdmissionError, d as RetainedRunDispatchBindingError, f as RuntimeRunStateError, l as RetainedInteractiveBindingError, m as ValidationError, r as BackendTransportError, t as AgentEvalError$1, u as RetainedRunAdmissionError } from "./errors-AzSuGI23.js";
2
2
  import { $ as isAsyncIterable, Ct as boundedChildDeadlineAt, Dt as teardownExecutor, Et as singleFlightTeardown, F as deepFreezeCandidate, G as chargedTokens, H as abortError, K as cloneSpend, St as armDeadlineTimer, U as addSpend, W as addTokenUsage, X as fnv1a32Hex, Y as errorMessage, Z as hasCompleteCacheBreakdown, a as verifyAgentCandidateWorkspaceArtifacts, at as sleep, dt as zeroSpend, ft as zeroTokenUsage, g as workspaceLimits, gt as withBudgetResources, h as verifyAgentCandidateWorkspaceArchive, ht as resourceTelemetry, i as readAgentCandidateWorkspaceArtifactFiles, j as verifiedArtifactChunks, k as verifyWorkspaceSnapshotArtifacts, m as safeArchivePath, mt as assertResources, o as verifyAgentCandidateWorkspaceTree, pt as addResourceSpend, q as cloneTokenUsage, tt as promptCacheTokenClasses, vt as CHILD_DEADLINE_REASON, wt as checkInIdleMs, z as sha256Bytes$1 } from "./workspace-streams-8ALHaZzx.js";
3
- import { _ as errorText, a as readCommittedJsonLines, b as resolveRedactor, c as appendCommittedJsonLine, d as detachedSnapshot, f as shareParsedStrings, g as errorProperty, l as sha256, m as errMessage, p as causeChain, r as prepareJsonlAppend, s as withJsonlFileLock, t as isNoEntError, v as defaultRedactor } from "./jsonl-file-CvPuwM0a.js";
3
+ import { _ as errorText, a as readCommittedJsonLines, b as resolveRedactor, c as appendCommittedJsonLine, d as detachedSnapshot, f as shareParsedStrings, g as errorProperty, l as sha256, m as errMessage, p as causeChain, r as prepareJsonlAppend, s as withJsonlFileLock, t as isNoEntError, v as defaultRedactor } from "./jsonl-file-CeVYTIQJ.js";
4
4
  import { t as assertExecutableAgentProfile } from "./model-policy-JOcg3NRs.js";
5
5
  import { a as writeAtomicDurableFile, n as assertNoSymlinkDescendant, o as captureRunWriteContext, r as publishExclusiveDurableFile, s as fenceRunWrite, t as appendDurableFile } from "./durable-file-DstVeHcj.js";
6
6
  import { a as withPursuitContext, i as notifyRuntimeHookEvent } from "./runtime-hooks-CsW2pfFk.js";
@@ -12,6 +12,7 @@ import { isRecord } from "@tangle-network/agent-core";
12
12
  import { collectAgentFinalMessageText, collectAgentResponseText } from "@tangle-network/sandbox";
13
13
  import { z } from "zod";
14
14
  import { redact } from "@tangle-network/agent-eval/traces";
15
+ import { AgentTurnFailureSchema } from "@tangle-network/agent-interface/environment-provider";
15
16
  import { createHash, randomUUID } from "node:crypto";
16
17
  import { setImmediate as setImmediate$1 } from "node:timers/promises";
17
18
  import { LedgerCanonicalizationError, canonicalString, jsonDocument, merkleLeafHash, merkleRoot, merkleSalt } from "@tangle-network/agent-eval/ledger-core";
@@ -1725,8 +1726,8 @@ function assertValidBudget(budget, label = "budget") {
1725
1726
  if (!Number.isFinite(value) || value < 0) throw new Error(`${label}.${field} must be a non-negative finite number`);
1726
1727
  };
1727
1728
  assertResources(budget.resources, "limit", `${label}.resources`);
1728
- safeInteger(budget.maxIterations, "maxIterations");
1729
- safeInteger(budget.maxTokens, "maxTokens");
1729
+ if (budget.maxIterations !== void 0) safeInteger(budget.maxIterations, "maxIterations");
1730
+ if (budget.maxTokens !== void 0) safeInteger(budget.maxTokens, "maxTokens");
1730
1731
  if (budget.maxUsd !== void 0) finiteNonNegative(budget.maxUsd, "maxUsd");
1731
1732
  if (budget.deadlineMs !== void 0) finiteNonNegative(budget.deadlineMs, "deadlineMs");
1732
1733
  }
@@ -1767,6 +1768,8 @@ function assertValidSpend(spend, label) {
1767
1768
  */
1768
1769
  function openBudgetLedger(root, runStartedAtMs) {
1769
1770
  return {
1771
+ tokensCapped: root.maxTokens !== void 0,
1772
+ iterationsCapped: root.maxIterations !== void 0,
1770
1773
  usdCapped: root.maxUsd !== void 0,
1771
1774
  absoluteDeadlineMs: root.deadlineMs === void 0 ? 0 : runStartedAtMs + root.deadlineMs,
1772
1775
  resources: new Map(Object.entries(root.resources ?? {}).map(([name, value]) => [name, {
@@ -1776,7 +1779,7 @@ function openBudgetLedger(root, runStartedAtMs) {
1776
1779
  committed: 0,
1777
1780
  known: true
1778
1781
  }])),
1779
- freeTokens: root.maxTokens,
1782
+ freeTokens: root.maxTokens ?? 0,
1780
1783
  reservedTokens: 0,
1781
1784
  committedTokens: 0,
1782
1785
  tokensTainted: false,
@@ -1786,7 +1789,7 @@ function openBudgetLedger(root, runStartedAtMs) {
1786
1789
  committedUsd: 0,
1787
1790
  usdTainted: false,
1788
1791
  usdMeasured: true,
1789
- freeIterations: root.maxIterations,
1792
+ freeIterations: root.maxIterations ?? 0,
1790
1793
  reservedIterations: 0,
1791
1794
  committedIterations: 0,
1792
1795
  ownerSpent: {
@@ -1853,9 +1856,9 @@ function ledgerCommitResources(l, spend, allocations, requireAll = true) {
1853
1856
  }
1854
1857
  /** Every channel `b` does not fit, measured against the free balance less `keep`. */
1855
1858
  function ledgerShortfalls(l, b, keep) {
1856
- const wantTokens = b.maxTokens;
1859
+ const wantTokens = b.maxTokens ?? 0;
1857
1860
  const wantUsd = b.maxUsd ?? 0;
1858
- const wantIterations = b.maxIterations;
1861
+ const wantIterations = b.maxIterations ?? 0;
1859
1862
  const shortfalls = [];
1860
1863
  const short = (channel, requested, free, held, closedByUnknownSpend = false) => {
1861
1864
  shortfalls.push({
@@ -1875,8 +1878,8 @@ function ledgerShortfalls(l, b, keep) {
1875
1878
  const kept = (share = 0, spent) => Math.max(0, share - spent);
1876
1879
  const tokensFree = l.freeTokens - kept(keep?.tokens, chargedTokens(l.ownerSpent.tokens));
1877
1880
  const iterationsFree = l.freeIterations - kept(keep?.iterations, l.ownerSpent.iterations);
1878
- if (wantTokens > tokensFree) short("tokens", wantTokens, tokensFree, l.reservedTokens);
1879
- if (wantIterations > iterationsFree) short("iterations", wantIterations, iterationsFree, l.reservedIterations);
1881
+ if (l.tokensCapped && wantTokens > tokensFree) short("tokens", wantTokens, tokensFree, l.reservedTokens);
1882
+ if (l.iterationsCapped && wantIterations > iterationsFree) short("iterations", wantIterations, iterationsFree, l.reservedIterations);
1880
1883
  const usdFree = l.freeUsd - kept(keep?.usd, l.ownerSpent.usd);
1881
1884
  if (l.usdCapped && !l.usdTainted && wantUsd > usdFree) short("usd", wantUsd, usdFree, l.reservedUsd);
1882
1885
  return shortfalls;
@@ -1888,10 +1891,14 @@ function ledgerTake(l, b) {
1888
1891
  state.remaining -= amount;
1889
1892
  state.reserved += amount;
1890
1893
  }
1891
- l.freeTokens -= b.maxTokens;
1892
- l.reservedTokens += b.maxTokens;
1893
- l.freeIterations -= b.maxIterations;
1894
- l.reservedIterations += b.maxIterations;
1894
+ if (l.tokensCapped) {
1895
+ l.freeTokens -= b.maxTokens ?? 0;
1896
+ l.reservedTokens += b.maxTokens ?? 0;
1897
+ }
1898
+ if (l.iterationsCapped) {
1899
+ l.freeIterations -= b.maxIterations ?? 0;
1900
+ l.reservedIterations += b.maxIterations ?? 0;
1901
+ }
1895
1902
  l.freeUsd -= b.maxUsd ?? 0;
1896
1903
  l.reservedUsd += b.maxUsd ?? 0;
1897
1904
  }
@@ -1902,18 +1909,20 @@ function ledgerTake(l, b) {
1902
1909
  * dollar ceiling: without `maxUsd` it reserved NO dollars, so under a capped root its dollars are
1903
1910
  * OBSERVED spend, committed and debited from `free` like `observe`d inference.
1904
1911
  */
1905
- function ledgerClassifyOverspend(l, held, usdBudgeted, spent) {
1912
+ function ledgerClassifyOverspend(l, held, usdBudgeted, spent, limits) {
1906
1913
  const unknownUnderCap = l.usdCapped && spent.usdKnown === false;
1907
1914
  const spentTokens = chargedTokens(spent.tokens);
1908
1915
  const overspent = [];
1909
- if (spentTokens > held.tokens) overspent.push({
1916
+ const tokens = limits === void 0 ? held.tokens : limits.maxTokens;
1917
+ const iterations = limits === void 0 ? held.iterations : limits.maxIterations;
1918
+ if (tokens !== void 0 && spentTokens > tokens) overspent.push({
1910
1919
  channel: "tokens",
1911
- reserved: held.tokens,
1920
+ reserved: tokens,
1912
1921
  spent: spentTokens
1913
1922
  });
1914
- if (spent.iterations > held.iterations) overspent.push({
1923
+ if (iterations !== void 0 && spent.iterations > iterations) overspent.push({
1915
1924
  channel: "iterations",
1916
- reserved: held.iterations,
1925
+ reserved: iterations,
1917
1926
  spent: spent.iterations
1918
1927
  });
1919
1928
  if (!unknownUnderCap && l.usdCapped && usdBudgeted && spent.usd > held.usd) overspent.push({
@@ -1933,12 +1942,16 @@ function ledgerClassifyOverspend(l, held, usdBudgeted, spent) {
1933
1942
  function ledgerSettle(l, held, spent, unknownUnderCap) {
1934
1943
  noteUnknowns(l, spent);
1935
1944
  const spentTokens = chargedTokens(spent.tokens);
1936
- l.reservedTokens -= held.tokens;
1937
1945
  l.committedTokens += spentTokens;
1938
- l.freeTokens += held.tokens - spentTokens;
1939
- l.reservedIterations -= held.iterations;
1946
+ if (l.tokensCapped) {
1947
+ l.reservedTokens -= held.tokens;
1948
+ l.freeTokens += held.tokens - spentTokens;
1949
+ }
1940
1950
  l.committedIterations += spent.iterations;
1941
- l.freeIterations += held.iterations - spent.iterations;
1951
+ if (l.iterationsCapped) {
1952
+ l.reservedIterations -= held.iterations;
1953
+ l.freeIterations += held.iterations - spent.iterations;
1954
+ }
1942
1955
  if (l.usdCapped) {
1943
1956
  l.reservedUsd -= held.usd;
1944
1957
  l.committedUsd += spent.usd;
@@ -1965,9 +1978,9 @@ function ledgerObserve(l, spend, unknownUnderCap, requireAllResources) {
1965
1978
  function debit(l, spend) {
1966
1979
  noteUnknowns(l, spend);
1967
1980
  const tokens = chargedTokens(spend.tokens);
1968
- l.freeTokens -= tokens;
1981
+ if (l.tokensCapped) l.freeTokens -= tokens;
1969
1982
  l.committedTokens += tokens;
1970
- l.freeIterations -= spend.iterations;
1983
+ if (l.iterationsCapped) l.freeIterations -= spend.iterations;
1971
1984
  l.committedIterations += spend.iterations;
1972
1985
  l.committedUsd += spend.usd;
1973
1986
  if (l.usdCapped) l.freeUsd -= spend.usd;
@@ -2002,14 +2015,16 @@ function ledgerRestore(l, root, restore) {
2002
2015
  }, root));
2003
2016
  l.tokensTainted = true;
2004
2017
  l.usdMeasured = false;
2005
- l.freeTokens -= uncertain.maxTokens;
2006
- l.committedTokens += uncertain.maxTokens;
2007
- l.freeIterations -= uncertain.maxIterations;
2008
- l.committedIterations += uncertain.maxIterations;
2018
+ const tokens = uncertain.maxTokens ?? (l.tokensCapped ? Math.max(0, l.freeTokens) : 0);
2019
+ const iterations = uncertain.maxIterations ?? (l.iterationsCapped ? Math.max(0, l.freeIterations) : 0);
2020
+ l.committedTokens += tokens;
2021
+ l.committedIterations += iterations;
2022
+ if (l.tokensCapped) l.freeTokens -= tokens;
2023
+ if (l.iterationsCapped) l.freeIterations -= iterations;
2009
2024
  if (!l.usdCapped) continue;
2010
2025
  if (uncertain.maxUsd === void 0) {
2011
2026
  l.usdTainted = true;
2012
- l.committedUsd += l.freeUsd > 0 ? l.freeUsd : 0;
2027
+ l.committedUsd += Math.max(0, l.freeUsd);
2013
2028
  l.freeUsd = 0;
2014
2029
  } else {
2015
2030
  l.freeUsd -= uncertain.maxUsd;
@@ -2141,7 +2156,7 @@ async function foldUsage(events) {
2141
2156
  * overspend of a $0 ceiling. Unknowable dollar cost under a dollar limit closes the known
2142
2157
  * token/iteration work, marks the dollar channel unusable and refuses later reservations. An
2143
2158
  * unknowable TOKEN count records the work, debits what is known, and marks
2144
- * `readout().tokensKnown` false (a ceiling, not a measurement); tokens are always capped, so one
2159
+ * `readout().tokensKnown` false (a ceiling, not a measurement); one
2145
2160
  * unreported turn must not end the run.
2146
2161
  *
2147
2162
  * A reservation the free balance cannot cover now can WAIT (`reserve(b, holder, { wait: true })`)
@@ -2217,7 +2232,7 @@ function createBudgetPool(root, runStartedAtMs, restore = {}) {
2217
2232
  function admitToWait(b, holder, keep) {
2218
2233
  const id = nextTicketId++;
2219
2234
  open.set(id, holder);
2220
- const ticket = ticketFor(id, b);
2235
+ const ticket = ticketFor(id, b, ledger);
2221
2236
  let grant;
2222
2237
  let refuse;
2223
2238
  const granted = new Promise((resolve, reject) => {
@@ -2256,7 +2271,7 @@ function createBudgetPool(root, runStartedAtMs, restore = {}) {
2256
2271
  open.set(id, holder);
2257
2272
  return {
2258
2273
  ok: true,
2259
- ticket: ticketFor(id, b)
2274
+ ticket: ticketFor(id, b, ledger)
2260
2275
  };
2261
2276
  }
2262
2277
  if (options.wait !== true || !fitsAfterRefunds(shortfalls)) return {
@@ -2290,7 +2305,10 @@ function createBudgetPool(root, runStartedAtMs, restore = {}) {
2290
2305
  resources: void 0
2291
2306
  } : ticket.reserved;
2292
2307
  const usdBudgeted = ticket.reserved.usdBudgeted !== false;
2293
- const { overspent, unknownUnderCap } = ledgerClassifyOverspend(ledger, held, usdBudgeted, spent);
2308
+ const { overspent, unknownUnderCap } = ledgerClassifyOverspend(ledger, held, usdBudgeted, spent, heldNothing ? {
2309
+ maxTokens: 0,
2310
+ maxIterations: 0
2311
+ } : ticket.limits);
2294
2312
  let fault = unknownUnderCap ? `ticket ${ticket.id} reported unknown dollar cost under a dollar-capped budget` : void 0;
2295
2313
  open.delete(ticket.id);
2296
2314
  const resourceSettlement = ledgerSettle(ledger, held, spent, unknownUnderCap);
@@ -2314,12 +2332,15 @@ function createBudgetPool(root, runStartedAtMs, restore = {}) {
2314
2332
  return {
2315
2333
  ...ledger.resources.size ? { resources: Object.fromEntries([...ledger.resources].map(([name, value]) => [name, { ...value }])) } : {},
2316
2334
  tokensLeft: ledger.freeTokens,
2335
+ tokensCapped: ledger.tokensCapped,
2336
+ committedTokens: ledger.committedTokens,
2317
2337
  tokensKnown: !ledger.tokensTainted,
2318
2338
  cacheBreakdownKnown: !ledger.cacheBreakdownTainted,
2319
2339
  usdLeft: ledger.usdCapped ? ledger.usdTainted ? 0 : ledger.freeUsd : 0,
2320
2340
  usdCapped: ledger.usdCapped,
2321
2341
  usdKnown: ledger.usdMeasured && !ledger.usdTainted,
2322
2342
  iterationsLeft: ledger.freeIterations,
2343
+ iterationsCapped: ledger.iterationsCapped,
2323
2344
  deadlineMs: ledger.absoluteDeadlineMs,
2324
2345
  reservedTokens: ledger.reservedTokens
2325
2346
  };
@@ -2358,14 +2379,18 @@ function assertResourceDeclarations(ledger, b) {
2358
2379
  function fitsAfterRefunds(shortfalls) {
2359
2380
  return shortfalls.every((shortfall) => shortfall.closedByUnknownSpend !== true && shortfall.requested <= shortfall.free + (shortfall.held ?? 0));
2360
2381
  }
2361
- function ticketFor(id, b) {
2382
+ function ticketFor(id, b, ledger) {
2362
2383
  return {
2363
2384
  id,
2385
+ limits: {
2386
+ ...b.maxTokens === void 0 ? {} : { maxTokens: b.maxTokens },
2387
+ ...b.maxIterations === void 0 ? {} : { maxIterations: b.maxIterations }
2388
+ },
2364
2389
  reserved: {
2365
2390
  ...b.resources === void 0 ? {} : { resources: Object.fromEntries(Object.entries(b.resources).map(([name, value]) => [name, { ...value }])) },
2366
- tokens: b.maxTokens,
2391
+ tokens: ledger.tokensCapped ? b.maxTokens ?? 0 : 0,
2367
2392
  usd: b.maxUsd ?? 0,
2368
- iterations: b.maxIterations,
2393
+ iterations: ledger.iterationsCapped ? b.maxIterations ?? 0 : 0,
2369
2394
  usdBudgeted: b.maxUsd !== void 0
2370
2395
  }
2371
2396
  };
@@ -2440,7 +2465,8 @@ function jsonContentText(value) {
2440
2465
  // src/runtime/supervise/executor-outcome.ts
2441
2466
  const outcomeSchema = AgentTurnResultSchema.pick({
2442
2467
  success: true,
2443
- error: true
2468
+ error: true,
2469
+ failure: true
2444
2470
  }).extend({
2445
2471
  errorCode: AgentTurnResultSchema.shape.error,
2446
2472
  statusCode: z.number().int().min(400).max(599).optional()
@@ -2452,6 +2478,7 @@ function executorFailure(result) {
2452
2478
  if (outcome.success) return void 0;
2453
2479
  return {
2454
2480
  error: outcome.error ?? "Agent execution failed",
2481
+ ...outcome.failure === void 0 ? {} : { failure: outcome.failure },
2455
2482
  ...outcome.errorCode === void 0 ? {} : { errorCode: outcome.errorCode },
2456
2483
  ...outcome.statusCode === void 0 ? {} : { statusCode: outcome.statusCode }
2457
2484
  };
@@ -2460,14 +2487,45 @@ function executorFailure(result) {
2460
2487
  function executorFailureReason(result) {
2461
2488
  return executorFailure(result)?.error;
2462
2489
  }
2463
- /**
2464
- * The platform's own failure vocabulary: machine codes and lifecycle messages that the sandbox
2465
- * runtime, the router, or the egress path put in an executor envelope when the platform, not
2466
- * the agent's work, ended the execution. Each entry names its evidence: the count is how many
2467
- * down children carried it on the 2026-09-20 fleet corpus (277 down settlements across 691
2468
- * runs), every one of them stamped `infra: false` by the hard-coded call site this table
2469
- * replaced. The table is deliberately the platform's fixed strings, not the agent's prose.
2470
- */
2490
+ /** Canonical producer classifications take precedence over the legacy code/message vocabulary. */
2491
+ const TURN_FAILURE_POLICY = {
2492
+ capacity: {
2493
+ classification: "unavailable",
2494
+ failureKind: "infra",
2495
+ infra: true,
2496
+ code: "upstream-unavailable",
2497
+ owner: "platform"
2498
+ },
2499
+ caller: {
2500
+ classification: "terminal",
2501
+ failureKind: "deterministic",
2502
+ infra: void 0,
2503
+ code: "request-rejected",
2504
+ owner: "caller"
2505
+ },
2506
+ infra: {
2507
+ classification: "transient",
2508
+ failureKind: "infra",
2509
+ infra: true,
2510
+ code: "transport",
2511
+ owner: "platform"
2512
+ },
2513
+ work: {
2514
+ classification: "transient",
2515
+ failureKind: "deterministic",
2516
+ infra: void 0,
2517
+ code: "work-failed",
2518
+ owner: "work"
2519
+ }
2520
+ };
2521
+ const turnFailurePolicy = (failure) => TURN_FAILURE_POLICY[failure.kind];
2522
+ /** Validate the shared contract on an envelope or any wrapped cause; malformed legacy data falls back. */
2523
+ function turnFailureOf(value) {
2524
+ for (const link of causeChain(value)) try {
2525
+ const parsed = AgentTurnFailureSchema.safeParse(Reflect.get(link, "failure"));
2526
+ if (parsed.success) return parsed.data;
2527
+ } catch {}
2528
+ }
2471
2529
  const PLATFORM_FAILURE_CODES = new Set([
2472
2530
  "QUOTA_EXCEEDED",
2473
2531
  "provider_quota_exceeded",
@@ -2501,18 +2559,9 @@ const PLATFORM_FAILURE_MESSAGES = [
2501
2559
  /OpenCode exited while a model step was still in progress/u,
2502
2560
  /the agent runtime restarted/u
2503
2561
  ];
2504
- /**
2505
- * Whether an executor envelope's failure was the platform's, as far as the envelope can say.
2506
- *
2507
- * `true` when the code or the message is in the platform's own vocabulary above. `undefined`
2508
- * otherwise: the harness reported a failure and nothing in the envelope attributes it, so the
2509
- * settlement carries no `infra` claim at all rather than a false one. This path never answers
2510
- * `false`, because an executor envelope cannot prove the agent's work was at fault; the throw
2511
- * path in `scope.ts` still answers `false` for an ordinary thrown result, where the runtime does
2512
- * know. Until this function existed both envelope sites stamped `infra: false` unconditionally,
2513
- * and the flag caught 1 of the 78 platform losses it was checked against on the fleet corpus.
2514
- */
2562
+ /** Producer-owned classification first; legacy platform codes/messages otherwise leave attribution unknown. */
2515
2563
  function executorFailureInfra(failure) {
2564
+ if (failure.failure) return turnFailurePolicy(failure.failure).infra;
2516
2565
  const code = failure.errorCode?.toLowerCase();
2517
2566
  if (code !== void 0 && PLATFORM_FAILURE_CODES.has(code)) return true;
2518
2567
  return PLATFORM_FAILURE_MESSAGES.some((pattern) => pattern.test(failure.error)) ? true : void 0;
@@ -2717,24 +2766,8 @@ function storedText(event) {
2717
2766
  return JSON.stringify(event) ?? "null";
2718
2767
  }
2719
2768
  // src/runtime/supervise/upstream-unavailable.ts
2720
- /**
2721
- * An upstream that cannot serve NOW: how Runtime recognizes one, and how long an agent waits for it.
2722
- *
2723
- * A model provider's exhausted quota, a rate limit, an overload, or the router's own refused
2724
- * credential is not a fault in the agent: the same request succeeds when capacity returns. A
2725
- * driver that meets one re-enters after a pause (`runDriverWithRetry`), and a leaf continues in
2726
- * its environment after the same pause (`providerAsExecutor`). Both read the refusal and the pause
2727
- * from here, so an outage costs a director and its workers the same number of turns.
2728
- *
2729
- * This module imports nothing, so the provider executor can read it without the error classes of
2730
- * `../../errors`.
2731
- */
2732
- /**
2733
- * Machine codes that say the upstream cannot serve now rather than that the request is wrong.
2734
- * Each is a code an upstream publishes, not prose: the router's
2735
- * (`lib/model-substitution.ts`, `lib/upstream-error-triage.ts`) and the OpenAI- and Anthropic-shaped
2736
- * error types a relayed body carries.
2737
- */
2769
+ /** Shared capacity recognition and pause policy for drivers and retained leaves. */
2770
+ /** Legacy capacity codes for producers without the canonical failure contract. */
2738
2771
  const UNAVAILABLE_CODES = /* @__PURE__ */ new Set([
2739
2772
  "provider_quota_exhausted",
2740
2773
  "provider_quota_exceeded",
@@ -2754,12 +2787,7 @@ const UNAVAILABLE_STATUSES = /* @__PURE__ */ new Set([
2754
2787
  503,
2755
2788
  529
2756
2789
  ]);
2757
- /**
2758
- * A harness that flattens the router's JSON body into its own failure text leaves the router's
2759
- * code in that text: `opencode execution failed: No provider served model "..."
2760
- * (provider_quota_exhausted)`. The code is matched as a whole token, and a status only in the
2761
- * `status code <n>` framing a harness prints, so prose that merely mentions a quota does not match.
2762
- */
2790
+ /** Legacy text fallback reads whole code tokens and explicitly framed HTTP statuses. */
2763
2791
  function unavailableSignalInText(text) {
2764
2792
  for (const token of text.toLowerCase().matchAll(/[a-z_]+/gu)) if (UNAVAILABLE_CODES.has(token[0])) return token[0];
2765
2793
  const status = printedStatus(text);
@@ -2770,13 +2798,7 @@ const printedStatus = (text) => {
2770
2798
  const status = text.match(/\bstatus code (\d{3})\b/u)?.[1];
2771
2799
  return status === void 0 ? void 0 : Number(status);
2772
2800
  };
2773
- /**
2774
- * Sandbox's 409 `NO_HOST_FITS_SHAPE` for a shape that fits its host's ceiling: no exceeded
2775
- * dimension, only `its room is held placeable on <sku>`. It is sent by mistake for "no room now"
2776
- * while new hosts cannot be planned, and the create lands within one autoscaler purchase. Four
2777
- * nodes of Discovery run magnetar-rust-sandbox-20261101a went down on it. A shape over the ceiling
2778
- * names the dimension it exceeds instead, and stays refused.
2779
- */
2801
+ /** Held room for an otherwise placeable shape is temporary capacity; oversized shapes stay refused. */
2780
2802
  const HELD_ROOM_REFUSAL = /\bits room is held placeable\b/u;
2781
2803
  /**
2782
2804
  * The code or status that marks a failed turn outcome as an upstream capacity refusal, or
@@ -2785,6 +2807,8 @@ const HELD_ROOM_REFUSAL = /\bits room is held placeable\b/u;
2785
2807
  * report the router's refusal as text.
2786
2808
  */
2787
2809
  function unavailableSignalOfFailure(failure) {
2810
+ const typed = turnFailureOf(failure);
2811
+ if (typed) return turnFailurePolicy(typed).classification === "unavailable" ? typed.code : void 0;
2788
2812
  const code = failure.errorCode?.toLowerCase();
2789
2813
  if (code !== void 0 && UNAVAILABLE_CODES.has(code)) return code;
2790
2814
  if (code === "no_host_fits_shape" && HELD_ROOM_REFUSAL.test(failure.error)) return "host-room-held";
@@ -2810,13 +2834,10 @@ function cappedDoublingMs(consecutive, first, ceiling) {
2810
2834
  const MAX_RESET_HOLD_MS = 216e5;
2811
2835
  /** How often a refusal whose reset is beyond {@link MAX_RESET_HOLD_MS} is probed again. */
2812
2836
  const FAR_RESET_PROBE_MS = 36e5;
2813
- /**
2814
- * When a capacity refusal says its quota resets, as epoch ms: the `resetAt` field (ISO string or
2815
- * epoch ms) on the error or a cause, as agent-provider-tangle's `TangleCredentialCapacityError`
2816
- * carries it. Text is never read: zro-game-20261104b's children re-probed every 183 s against a
2817
- * seat whose structured reset was 2026-11-10T12:00Z, because only the message was parsed.
2818
- */
2819
- function reportedResetAt(error) {
2837
+ /** Read canonical reset/retry-after before legacy structured reset fields; never parse text. */
2838
+ function reportedResetAt(error, nowMs = Date.now()) {
2839
+ const typed = turnFailureOf(error);
2840
+ if (typed) return typed.resetAt !== void 0 ? Date.parse(typed.resetAt) : typed.retryAfterMs !== void 0 ? nowMs + typed.retryAfterMs : void 0;
2820
2841
  for (const cause of causeChain(error)) {
2821
2842
  let value;
2822
2843
  try {
@@ -3226,6 +3247,8 @@ function runtimeProviderCode(value) {
3226
3247
  return typeof value === "string" && MACHINE_CODE_PATTERN.test(value) ? value : void 0;
3227
3248
  }
3228
3249
  function upstreamMachineCode(links) {
3250
+ const typed = links.map(turnFailureOf).find((value) => value !== void 0);
3251
+ if (typed) return runtimeProviderCode(typed.code);
3229
3252
  return [
3230
3253
  "upstreamCode",
3231
3254
  "errorCode",
@@ -3234,6 +3257,8 @@ function upstreamMachineCode(links) {
3234
3257
  }
3235
3258
  /** The typed HTTP status and retry-after of the link carrying the provider's code. */
3236
3259
  function upstreamResponse(links, providerCode) {
3260
+ const typed = links.map(turnFailureOf).find((value) => value !== void 0);
3261
+ if (typed?.retryAfterMs !== void 0) return { retryAfterMs: typed.retryAfterMs };
3237
3262
  const link = links.find((each) => [
3238
3263
  "upstreamCode",
3239
3264
  "errorCode",
@@ -3272,6 +3297,12 @@ function runtimeFailureCause(error, context = {}) {
3272
3297
  code: caller,
3273
3298
  owner: "caller"
3274
3299
  });
3300
+ for (const link of links) {
3301
+ if (link instanceof RetainedExecutionPendingError && link.pendingCause === "provider-contract") return failure(retainedFailures["provider-contract"]);
3302
+ if (read(link, "name") === "RetainedRunProviderContractError") return failure(retainedFailures[classifyRetainedPendingCause(link)]);
3303
+ }
3304
+ const typed = error instanceof AgentEvalError$1 && !(error instanceof BackendTransportError) ? void 0 : turnFailureOf(error);
3305
+ if (typed) return failure(turnFailurePolicy(typed));
3275
3306
  if (context.signal === void 0 && links.some((link) => read(link, "name") === "AbortError")) return failure({
3276
3307
  code: "aborted",
3277
3308
  owner: "caller"
@@ -3309,7 +3340,8 @@ function runtimeFailureCause(error, context = {}) {
3309
3340
  function reportedFailureCause(outcome) {
3310
3341
  return runtimeFailureCause(Object.assign(new Error(outcome.error ?? "execution reported a failure"), {
3311
3342
  errorCode: outcome.errorCode,
3312
- statusCode: outcome.statusCode
3343
+ statusCode: outcome.statusCode,
3344
+ failure: outcome.failure
3313
3345
  }));
3314
3346
  }
3315
3347
  /**
@@ -3506,14 +3538,21 @@ function runtimeOwnedDeferredExecutorRuntime(executor) {
3506
3538
  return attestation?.kind === "deferred" ? attestation.runtime : void 0;
3507
3539
  }
3508
3540
  /** Propagate trust from a built-in driver adapter to the Agent and recursive executor it owns. */
3509
- function attestRuntimeOwnedScopeOwner(owner, runtime) {
3510
- runtimeOwnedScopeOwners.set(owner, runtime);
3541
+ function attestRuntimeOwnedScopeOwner(owner, runtime, control) {
3542
+ runtimeOwnedScopeOwners.set(owner, {
3543
+ runtime,
3544
+ ...control === void 0 ? {} : { control }
3545
+ });
3511
3546
  return owner;
3512
3547
  }
3548
+ /** A trusted owner's existing provider control remains available before any execution turn. */
3549
+ function runtimeOwnedScopeOwnerControl(owner) {
3550
+ return runtimeOwnedScopeOwners.get(owner)?.control;
3551
+ }
3513
3552
  /** Return a built-in scope owner's expected concrete leaf runtime; caller-owned functions/Agents
3514
3553
  * deliberately have no entry even if they add lookalike fields. */
3515
3554
  function runtimeOwnedScopeOwnerRuntime(owner) {
3516
- return runtimeOwnedScopeOwners.get(owner);
3555
+ return runtimeOwnedScopeOwners.get(owner)?.runtime;
3517
3556
  }
3518
3557
  /** Mark one provider inference attempt on a Runtime-owned executor. */
3519
3558
  function recordRuntimeOwnedProviderAttemptStart(executor) {
@@ -12788,7 +12827,7 @@ function createChildRetention({ args, controller, id, ordinal, identity, recover
12788
12827
  }
12789
12828
  /** Whether a settled spend exceeds the budget it was given, by the channels the pool reconciles. */
12790
12829
  function overBudget(budget, spent) {
12791
- return chargedTokens(spent.tokens) > budget.maxTokens || spent.iterations > budget.maxIterations || budget.maxUsd !== void 0 && spent.usdKnown !== false && spent.usd > budget.maxUsd;
12830
+ return budget.maxTokens !== void 0 && chargedTokens(spent.tokens) > budget.maxTokens || budget.maxIterations !== void 0 && spent.iterations > budget.maxIterations || budget.maxUsd !== void 0 && spent.usdKnown !== false && spent.usd > budget.maxUsd;
12792
12831
  }
12793
12832
  // src/durable/spawn-journal/record-events.ts
12794
12833
  /** Decode the file journal's historical single-event and atomic-group envelopes. @internal */
@@ -14739,12 +14778,18 @@ function reservedCursorFloor(events) {
14739
14778
  function sumSpendFromEvents(events) {
14740
14779
  const totals = sumMeasuredSpendFromEvents(events);
14741
14780
  const rootBudget = events.find((event) => event.kind === "spawned" && event.parent === void 0)?.budget;
14781
+ let remainingRootTokens = Math.max(0, (rootBudget?.maxTokens ?? 0) - chargedTokens(totals.childWork.tokens) - chargedTokens(totals.driverInference.tokens));
14782
+ let remainingRootIterations = Math.max(0, (rootBudget?.maxIterations ?? 0) - totals.childWork.iterations - totals.driverInference.iterations);
14742
14783
  let remainingRootUsd = Math.max(0, (rootBudget?.maxUsd ?? 0) - totals.childWork.usd - totals.driverInference.usd);
14743
14784
  for (const budget of uncertainSpawnBudgets(events)) {
14744
14785
  const unknown = withBudgetResources(zeroSpend(), budget);
14745
14786
  Object.assign(totals.childWork, addResourceSpend(totals.childWork.resources, unknown.resources));
14746
- totals.childWork.iterations += budget.maxIterations;
14747
- totals.childWork.tokens.input += budget.maxTokens;
14787
+ const iterationCharge = budget.maxIterations ?? remainingRootIterations;
14788
+ totals.childWork.iterations += iterationCharge;
14789
+ remainingRootIterations = Math.max(0, remainingRootIterations - iterationCharge);
14790
+ const tokenCharge = budget.maxTokens ?? remainingRootTokens;
14791
+ totals.childWork.tokens.input += tokenCharge;
14792
+ remainingRootTokens = Math.max(0, remainingRootTokens - tokenCharge);
14748
14793
  totals.childWork.tokensKnown = false;
14749
14794
  const usdCharge = budget.maxUsd ?? (rootBudget?.maxUsd !== void 0 ? remainingRootUsd : 0);
14750
14795
  totals.childWork.usd += usdCharge;
@@ -16773,8 +16818,8 @@ function reservationOwnerFloor(args) {
16773
16818
  if (reservationPolicy && !args.ownerBudget) throw new ValidationError("reservationPolicy requires the owning scope budget");
16774
16819
  const ownerBudget = args.ownerBudget;
16775
16820
  return reservationPolicy && ownerBudget ? {
16776
- tokens: Math.ceil(ownerBudget.maxTokens * reservationPolicy.ownerShare),
16777
- iterations: Math.ceil(ownerBudget.maxIterations * reservationPolicy.ownerShare),
16821
+ tokens: Math.ceil((ownerBudget.maxTokens ?? 0) * reservationPolicy.ownerShare),
16822
+ iterations: Math.ceil((ownerBudget.maxIterations ?? 0) * reservationPolicy.ownerShare),
16778
16823
  ...ownerBudget.maxUsd === void 0 ? {} : { usd: ownerBudget.maxUsd * reservationPolicy.ownerShare }
16779
16824
  } : void 0;
16780
16825
  }
@@ -16853,6 +16898,6 @@ async function recoverRetainedChildren(args, children, spawn, next) {
16853
16898
  throw error;
16854
16899
  }
16855
16900
  }
16856
- export { deriveNodeExecutionIdentity as $, parseCodexUsageRecord as $i, persistHarnessTranscript as $n, DISPATCH_EXECUTION_CHANGED_CODE as $r, insideCursorNamespace as $t, nestedScopeSeamKey as A, spendFromUsageTotals as Ai, workerTraceEnv as An, recordRuntimeOwnedProviderAttemptStart as Ar, beginScopeRetainedOwnerDrive as At, beginScopeOwnerAttempt as B, extractTransportEventIdentity as Bi, flatOtelSpan as Bn, unknownExecutionBindingReceipt as Br, retainedOwnerWorkspaceRetentionSeamKey as Bt, writeWorkerSteerAcknowledgement as C, hashJson as Ci, nativeCopyDelayMs as Cn, finalizeRuntimeOwnedPendingExecutor as Cr, environmentReader as Ct, isTraceAnalysisStore as D, meterUsageEvent as Di, openSlotGroup as Dn, newExecutionAttemptId as Dr, prepareScopeRetainedOwnerTask as Dt, replaySpawnTree as E, createBudgetPool as Ei, createWorkerSlots as En, knownMaterializationReceipt as Er, consumeScopeRetainedOwnerResult as Et, recoverRetainedInteractiveRun as F, sandboxLeafOutputFromEvents as Fi, buildLoopOtelSpans as Fn, runtimeOwnedExecutorExecutionBinding as Fr, scopeRetainedOwnerRestorePoint as Ft, scopeOwnerExecutorNodeContext as G, extractLlmCallEvent as Gi, sanitizeKnowledgeReadinessReport as Gn, runtimeFlowAgent as Gr, materializeTreeView as Gt, noteScopeOwnerPlannedExecution as H, canonicalSandboxUsageMode as Hi, loopEventToOtelSpan as Hn, executableAgentProfileSnapshot as Hr, scopeRetainedOwnerJournalRoot as Ht, startRetainedInteractiveRun as I, sandboxOutputMarker as Ii, buildLoopSpanNodes as In, runtimeOwnedExecutorMaterialization as Ir, noteScopeRetainedOwnerCoordination as It, providerVisibleProfile as J, sameModelId as Ji, captureBoundHarnessTranscript as Jn, runtimeFailureCause as Jr, nestedDriverTreeRoot as Jt, coordinationMcpAlias as K, isSandboxTerminalEvent as Ki, sanitizeRuntimeStreamEvent as Kn, runtimeFlowBrain as Kr, attestNestedDriverTreeOwner as Kt, FileSpawnJournal as L, sandboxProgressEvents as Li, buildRuntimeEventOtelSpans as Ln, runtimeOwnedExecutorProviderEvidence as Lr, scopeRetainedOwnerCheckpointing as Lt, attachWorker as M, createSandboxToolPartState as Mi, createPropagatingTraceEmitter as Mn, recordRuntimeOwnedProviderIdentityConflict as Mr, scopeRetainedOwnerTurnEnded as Mt, readWorkerInteractiveBinding as N, mapSandboxEvent as Ni, mergeTraceEnv as Nn, recordRuntimeOwnedProviderModel as Nr, assertRetainedOwnerCoordinationRekey as Nt, parseWorkerToolTraceArtifact as O, newUsageTotals as Oi, resolveWorkerSlots as On, providerAttemptEvidence as Or, scopeRetainedOwnerPriorSpend as Ot, reconnectRetainedInteractiveRun as P, mapSandboxToolEvent as Pi, readTraceContextFromEnv as Pn, runtimeOwnedDriveHarnessProviderEvidence as Pr, reconcileScopeRetainedOwnerEnvironment as Pt, assertRecursiveReservationPolicy as Q, decodeHarnessUsage as Qi, harnessTranscriptUnavailable as Qn, settlementFailureCause as Qr, closesCursorSlot as Qt, appendSpawnEvents as R, terminalTextFromSandboxEvent as Ri, createOpenInferenceFileExporter as Rn, runtimeOwnedPendingExecutorMaterialization as Rr, bindScopeRetainedOwnerEnvironmentId as Rt, writeWorkerSteer as S, executorFailureInfra as Si, captureProviderWorkspaceSnapshot as Sn, authoredProfileDigest as Sr, scopeRetainedOwnerResourceReader as St, sumSpendFromEvents as T, isCredentialRefusal as Ti, workspaceCaptureReceipt as Tn, knownExecutionBindingReceipt as Tr, abandonScopeRetainedOwnerInvocation as Tt, recordScopeOwnerMaterialization as U, createSandboxTurnEventCollector as Ui, createRuntimeEventCollector as Un, executableAgentSpecSnapshot as Ur, loadSpawnForest as Ut, finalizeScopeOwnerMaterialization as V, assertSandboxServedModel as Vi, generateSpanId as Vn, unknownMaterializationReceipt as Vr, scopeRetainedOwnerContext as Vt, restoreScopeOwnerAcceptedExecution as W, createSandboxUsageLedger as Wi, createRuntimeStreamEventCollector as Wn, isRuntimeFlowBrain as Wr, ownedTreeRootSpawn as Wt, reenteredWorkers as X, sandboxTerminalUsageField as Xi, harnessTranscriptArtifact as Xn, runtimeFailureRemediationSchema as Xr, encodeResultBlob as Xt, runtimeGraphMetadataKey as Y, sandboxEventServedBackend as Yi, captureHarnessTranscript as Yn, runtimeFailureCauseSchema as Yr, FileResultBlobStore as Yt, settledToIteration as Z, sumSandboxUsage as Zi, harnessTranscriptFromLines as Zn, runtimeProviderCode as Zr, SpawnEventIndex as Zt, supervisorRunDir as _, TRACE_ROOT_SCHEMA as _i, destroyInteractiveEnvironment as _n, attestRuntimeOwnedDeferredExecutor as _r, startScopeRecoveries as _t, readRootStream as a, freezeControlRef as aa, registerRetainedExecutorPreparation as ai, reconnectRetainedRun as an, DEFAULT_STALL_AFTER_MS as ar, hasRetriableTeardowns as at, workerInboxFileFromEventDir as b, contentRef as bi, assertProviderWorkspaceRetentionPort as bn, attestRuntimeOwnedScopeOwner as br, prepareScopeRetainedOwnerSeatSwitch as bt, cancelWorker as c, RunCancellationReason as ca, UNAVAILABLE_CODES as ci, startRetainedRunInEnvironment as cn, readWorkerProgress as cr, recordScopeOwnerBarrenPause as ct, legacySupervisorRunsRoot as d, runAbortable as da, jitteredMs as di, offerInteractiveControl as dn, SEAT_RECHECK_MS as dr, registerNestedTeardownScope as dt, recordValue as ea, DISPATCH_NOT_ADMITTED_CODE as ei, verifyWorkspaceMarker as en, readHarnessTranscript as er, freeSlots as et, readWorkerCancelRequests as f, signalAbortError as fa, printedStatus as fi, prepareInteractiveDelegation as fn, SeatChain as fr, releaseHeldEnvironments as ft, safeWorkerFile as g, unavailableSignalOfFailure as gi, verifyObserverRecords as gn, subscriptionUsageLimitSignal as gr, settleManagerWork as gt, readWorkerSteerRequests as h, providerMessageText as ha, unavailableResumeAt as hi, observerRecordDigest as hn, seatExecutionProfile as hr, retryUnconfirmedTeardowns as ht, nodeStreamFile as i, exactSession as ia, isSchemaRejection as ii, mintRetainedIdentity as in, retainHarnessTranscript as ir, closeScopeAdmission as it, interactiveAdmissionSeamKey as j, assertValidBudget as ji, workerTraceHeaders as jn, recordRuntimeOwnedProviderDispatchNotStarted as jr, scopeRetainedOwnerSettled as jt, workerTraceAnalysisStore as k, spendFromUsageEvents as ki, WORKER_TRACE_PROPAGATION as kn, recordRuntimeOwnedDriveHarnessProviderEvidence as kr, scopeRetainedOwnerResult as kt, claimWorkerSteerDelivery as l, abortReason as la, UNAVAILABLE_STATUSES as li, retainedCreateMaterial as ln, isLiveNodeStatus as lr, recordScopeOwnerDriverAttempt as lt, readWorkerSteerAcknowledgement as m, promptOptionsFromAgentTurnInput as ma, unavailablePauseMs as mi, createFileObserverHooks as mn, authoredSeatStages as mr, releaseRetainedEnvironments as mt, ROOT_STREAM_FILE as n, assertEventBinding as na, TRANSPORT_ERROR_CODES as ni, stopRetainedNativeExecution as nn, readBoundHarnessSessions as nr, rollingDispatch as nt, readRootStreamReceipt as o, isTerminalSessionStatus as oa, retainedExecutorContext as oi, recoverRetainedRun as on, createActivityLog as or, meterRuntimeOwnedAccounting as ot, readWorkerCancellation as p, promptFromAgentTurnInput as pa, reportedResetAt as pi, FileObserverJournal as pn, SeatPauseError as pr, releaseManagerEnvironment as pt, coordinationProfileToolPrefix as q, notifySandboxEventObserver as qi, HARNESS_TRANSCRIPT_SETTLE_TIMEOUT_MS as qn, reportedFailureCause as qr, driverRuntime as qt, createRootStreamSink as r, awaitAbortable$1 as ra, isProvisioningRefusal as ri, assertRetainedRunReplayMaterial as rn, resolveHarnessTranscriptCapture as rr, closeRetainedSlots as rt, appendWorkerControlEvent as s, sameControlCoordinates as sa, retainedExecutorSeamKey as si, startRetainedRun as sn, describeToolArgs as sr, meterRuntimeOwnedProviderAttempt as st, createScope as t, RetainedRunProviderContractError as ta, RetainedExecutionPendingError as ti, describeRetainedNativeStops as tn, HARNESS_TRANSCRIPT_READ_LIMITS as tr, queueOf as tt, legacySupervisorRunDir as u, linkAbort as ua, cappedDoublingMs as ui, acceptedInteractiveControl as un, isTerminalNodeStatus as ur, recordScopeOwnerPause as ut, supervisorRunsRoot as v, TRACE_SUMMARY_SCHEMA as vi, environmentGone as vn, attestRuntimeOwnedExecutor as vr, unconfirmedTeardowns as vt, prepareScopeResume as w, credentialCommandExit as wi, openNativeMirror as wn, inheritRuntimeOwnedExecutorAttestation as wr, resolveSpawnResourcePaths as wt, writeWorkerCancellation as x, executorFailure as xi, captureProviderLiveWorkspace as xn, authoredAgentIdentity as xr, releaseScopeRetainedOwnerForSeatPause as xt, workerCancellationsDir as y, contentAddress as yi, DEFAULT_NATIVE_CAPTURE_INTERVAL_MS as yn, attestRuntimeOwnedPendingExecutor as yr, waitForScopeChildren as yt, spawnJournalRecordEvents as z, canonicalStreamEventFromSandboxEvent as zi, createOtelExporter as zn, runtimeOwnedScopeOwnerRuntime as zr, bindScopeRetainedOwnerProvider as zt };
16901
+ export { deriveNodeExecutionIdentity as $, sandboxEventServedBackend as $i, harnessTranscriptUnavailable as $n, runtimeProviderCode as $r, closesCursorSlot as $t, nestedScopeSeamKey as A, createBudgetPool as Ai, WORKER_TRACE_PROPAGATION as An, recordRuntimeOwnedDriveHarnessProviderEvidence as Ar, beginScopeRetainedOwnerDrive as At, beginScopeOwnerAttempt as B, sandboxOutputMarker as Bi, createOtelExporter as Bn, runtimeOwnedScopeOwnerControl as Br, bindScopeRetainedOwnerWorkspaceRetention as Bt, writeWorkerSteerAcknowledgement as C, executorFailure as Ci, captureProviderWorkspaceSnapshot as Cn, authoredProfileDigest as Cr, environmentReader as Ct, isTraceAnalysisStore as D, hashJson as Di, createWorkerSlots as Dn, knownMaterializationReceipt as Dr, prepareScopeRetainedOwnerTask as Dt, replaySpawnTree as E, turnFailurePolicy as Ei, workspaceCaptureReceipt as En, knownExecutionBindingReceipt as Er, consumeScopeRetainedOwnerResult as Et, recoverRetainedInteractiveRun as F, assertValidBudget as Fi, readTraceContextFromEnv as Fn, runtimeOwnedDriveHarnessProviderEvidence as Fr, scopeRetainedOwnerRestorePoint as Ft, scopeOwnerExecutorNodeContext as G, assertSandboxServedModel as Gi, createRuntimeStreamEventCollector as Gn, executableAgentSpecSnapshot as Gr, ownedTreeRootSpawn as Gt, noteScopeOwnerPlannedExecution as H, terminalTextFromSandboxEvent as Hi, generateSpanId as Hn, unknownExecutionBindingReceipt as Hr, scopeRetainedOwnerContext as Ht, startRetainedInteractiveRun as I, createSandboxToolPartState as Ii, buildLoopOtelSpans as In, runtimeOwnedExecutorExecutionBinding as Ir, noteScopeRetainedOwnerCoordination as It, providerVisibleProfile as J, createSandboxUsageLedger as Ji, HARNESS_TRANSCRIPT_SETTLE_TIMEOUT_MS as Jn, runtimeFlowBrain as Jr, driverRuntime as Jt, coordinationMcpAlias as K, canonicalSandboxUsageMode as Ki, sanitizeKnowledgeReadinessReport as Kn, isRuntimeFlowBrain as Kr, materializeTreeView as Kt, FileSpawnJournal as L, mapSandboxEvent as Li, buildLoopSpanNodes as Ln, runtimeOwnedExecutorMaterialization as Lr, scopeRetainedOwnerCheckpointing as Lt, attachWorker as M, newUsageTotals as Mi, workerTraceHeaders as Mn, recordRuntimeOwnedProviderDispatchNotStarted as Mr, scopeRetainedOwnerTurnEnded as Mt, readWorkerInteractiveBinding as N, spendFromUsageEvents as Ni, createPropagatingTraceEmitter as Nn, recordRuntimeOwnedProviderIdentityConflict as Nr, assertRetainedOwnerCoordinationRekey as Nt, parseWorkerToolTraceArtifact as O, credentialCommandExit as Oi, openSlotGroup as On, newExecutionAttemptId as Or, scopeRetainedOwnerPriorSpend as Ot, reconnectRetainedInteractiveRun as P, spendFromUsageTotals as Pi, mergeTraceEnv as Pn, recordRuntimeOwnedProviderModel as Pr, reconcileScopeRetainedOwnerEnvironment as Pt, assertRecursiveReservationPolicy as Q, sameModelId as Qi, harnessTranscriptFromLines as Qn, runtimeFailureRemediationSchema as Qr, SpawnEventIndex as Qt, appendSpawnEvents as R, mapSandboxToolEvent as Ri, buildRuntimeEventOtelSpans as Rn, runtimeOwnedExecutorProviderEvidence as Rr, bindScopeRetainedOwnerEnvironmentId as Rt, writeWorkerSteer as S, contentRef as Si, captureProviderLiveWorkspace as Sn, authoredAgentIdentity as Sr, scopeRetainedOwnerResourceReader as St, sumSpendFromEvents as T, turnFailureOf as Ti, openNativeMirror as Tn, inheritRuntimeOwnedExecutorAttestation as Tr, abandonScopeRetainedOwnerInvocation as Tt, recordScopeOwnerMaterialization as U, canonicalStreamEventFromSandboxEvent as Ui, loopEventToOtelSpan as Un, unknownMaterializationReceipt as Ur, scopeRetainedOwnerJournalRoot as Ut, finalizeScopeOwnerMaterialization as V, sandboxProgressEvents as Vi, flatOtelSpan as Vn, runtimeOwnedScopeOwnerRuntime as Vr, retainedOwnerWorkspaceRetentionSeamKey as Vt, restoreScopeOwnerAcceptedExecution as W, extractTransportEventIdentity as Wi, createRuntimeEventCollector as Wn, executableAgentProfileSnapshot as Wr, loadSpawnForest as Wt, reenteredWorkers as X, isSandboxTerminalEvent as Xi, captureHarnessTranscript as Xn, runtimeFailureCause as Xr, FileResultBlobStore as Xt, runtimeGraphMetadataKey as Y, extractLlmCallEvent as Yi, captureBoundHarnessTranscript as Yn, reportedFailureCause as Yr, nestedDriverTreeRoot as Yt, settledToIteration as Z, notifySandboxEventObserver as Zi, harnessTranscriptArtifact as Zn, runtimeFailureCauseSchema as Zr, encodeResultBlob as Zt, supervisorRunDir as _, promptFromAgentTurnInput as _a, unavailableResumeAt as _i, verifyObserverRecords as _n, subscriptionUsageLimitSignal as _r, startScopeRecoveries as _t, readRootStream as a, RetainedRunProviderContractError as aa, isProvisioningRefusal as ai, mintRetainedIdentity as an, retainHarnessTranscript as ar, hasRetriableTeardowns as at, workerInboxFileFromEventDir as b, TRACE_SUMMARY_SCHEMA as bi, DEFAULT_NATIVE_CAPTURE_INTERVAL_MS as bn, attestRuntimeOwnedPendingExecutor as br, prepareScopeRetainedOwnerSeatSwitch as bt, cancelWorker as c, exactSession as ca, retainedExecutorContext as ci, startRetainedRun as cn, describeToolArgs as cr, recordScopeOwnerBarrenPause as ct, legacySupervisorRunsRoot as d, sameControlCoordinates as da, UNAVAILABLE_STATUSES as di, acceptedInteractiveControl as dn, isTerminalNodeStatus as dr, registerNestedTeardownScope as dt, sandboxTerminalUsageField as ea, settlementFailureCause as ei, insideCursorNamespace as en, persistHarnessTranscript as er, freeSlots as et, readWorkerCancelRequests as f, RunCancellationReason as fa, cappedDoublingMs as fi, offerInteractiveControl as fn, SEAT_RECHECK_MS as fr, releaseHeldEnvironments as ft, safeWorkerFile as g, signalAbortError as ga, unavailablePauseMs as gi, observerRecordDigest as gn, seatExecutionProfile as gr, settleManagerWork as gt, readWorkerSteerRequests as h, runAbortable as ha, reportedResetAt as hi, createFileObserverHooks as hn, authoredSeatStages as hr, retryUnconfirmedTeardowns as ht, nodeStreamFile as i, recordValue as ia, TRANSPORT_ERROR_CODES as ii, assertRetainedRunReplayMaterial as in, resolveHarnessTranscriptCapture as ir, closeScopeAdmission as it, interactiveAdmissionSeamKey as j, meterUsageEvent as ji, workerTraceEnv as jn, recordRuntimeOwnedProviderAttemptStart as jr, scopeRetainedOwnerSettled as jt, workerTraceAnalysisStore as k, isCredentialRefusal as ki, resolveWorkerSlots as kn, providerAttemptEvidence as kr, scopeRetainedOwnerResult as kt, claimWorkerSteerDelivery as l, freezeControlRef as la, retainedExecutorSeamKey as li, startRetainedRunInEnvironment as ln, readWorkerProgress as lr, recordScopeOwnerDriverAttempt as lt, readWorkerSteerAcknowledgement as m, linkAbort as ma, printedStatus as mi, FileObserverJournal as mn, SeatPauseError as mr, releaseRetainedEnvironments as mt, ROOT_STREAM_FILE as n, decodeHarnessUsage as na, DISPATCH_NOT_ADMITTED_CODE as ni, describeRetainedNativeStops as nn, HARNESS_TRANSCRIPT_READ_LIMITS as nr, rollingDispatch as nt, readRootStreamReceipt as o, assertEventBinding as oa, isSchemaRejection as oi, reconnectRetainedRun as on, DEFAULT_STALL_AFTER_MS as or, meterRuntimeOwnedAccounting as ot, readWorkerCancellation as p, abortReason as pa, jitteredMs as pi, prepareInteractiveDelegation as pn, SeatChain as pr, releaseManagerEnvironment as pt, coordinationProfileToolPrefix as q, createSandboxTurnEventCollector as qi, sanitizeRuntimeStreamEvent as qn, runtimeFlowAgent as qr, attestNestedDriverTreeOwner as qt, createRootStreamSink as r, parseCodexUsageRecord as ra, RetainedExecutionPendingError as ri, stopRetainedNativeExecution as rn, readBoundHarnessSessions as rr, closeRetainedSlots as rt, appendWorkerControlEvent as s, awaitAbortable$1 as sa, registerRetainedExecutorPreparation as si, recoverRetainedRun as sn, createActivityLog as sr, meterRuntimeOwnedProviderAttempt as st, createScope as t, sumSandboxUsage as ta, DISPATCH_EXECUTION_CHANGED_CODE as ti, verifyWorkspaceMarker as tn, readHarnessTranscript as tr, queueOf as tt, legacySupervisorRunDir as u, isTerminalSessionStatus as ua, UNAVAILABLE_CODES as ui, retainedCreateMaterial as un, isLiveNodeStatus as ur, recordScopeOwnerPause as ut, supervisorRunsRoot as v, promptOptionsFromAgentTurnInput as va, unavailableSignalOfFailure as vi, destroyInteractiveEnvironment as vn, attestRuntimeOwnedDeferredExecutor as vr, unconfirmedTeardowns as vt, prepareScopeResume as w, executorFailureInfra as wi, nativeCopyDelayMs as wn, finalizeRuntimeOwnedPendingExecutor as wr, resolveSpawnResourcePaths as wt, writeWorkerCancellation as x, contentAddress as xi, assertProviderWorkspaceRetentionPort as xn, attestRuntimeOwnedScopeOwner as xr, releaseScopeRetainedOwnerForSeatPause as xt, workerCancellationsDir as y, providerMessageText as ya, TRACE_ROOT_SCHEMA as yi, environmentGone as yn, attestRuntimeOwnedExecutor as yr, waitForScopeChildren as yt, spawnJournalRecordEvents as z, sandboxLeafOutputFromEvents as zi, createOpenInferenceFileExporter as zn, runtimeOwnedPendingExecutorMaterialization as zr, bindScopeRetainedOwnerProvider as zt };
16857
16902
 
16858
- //# sourceMappingURL=scope-CJ7xtrs8.js.map
16903
+ //# sourceMappingURL=scope-JcCkUy_z.js.map