@tangle-network/agent-runtime 0.111.0 → 0.113.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 (43) hide show
  1. package/dist/{activation-CsuHCZVN.js → activation-DGozpA_7.js} +2 -2
  2. package/dist/{activation-CsuHCZVN.js.map → activation-DGozpA_7.js.map} +1 -1
  3. package/dist/agent.d.ts +1 -1
  4. package/dist/agent.js +2 -2
  5. package/dist/{environment-provider-CTEMEP9u.d.ts → environment-provider-DG-cSx89.d.ts} +51 -5
  6. package/dist/environment-provider.d.ts +1 -1
  7. package/dist/{improvement-cycle-ryAyCLKN.js → improvement-cycle-DxBZsG33.js} +3 -3
  8. package/dist/{improvement-cycle-ryAyCLKN.js.map → improvement-cycle-DxBZsG33.js.map} +1 -1
  9. package/dist/{index-BmI2uxy5.d.ts → index-B-DkjCqQ.d.ts} +3 -3
  10. package/dist/{index-DlLPNELY.d.ts → index-BdnhmGUH.d.ts} +149 -18
  11. package/dist/{index-sLuBoGud.d.ts → index-DmXPCQ2X.d.ts} +4 -4
  12. package/dist/index.d.ts +5 -5
  13. package/dist/index.js +7 -7
  14. package/dist/intelligence.d.ts +1 -1
  15. package/dist/intelligence.js +2 -2
  16. package/dist/kernel.d.ts +3 -3
  17. package/dist/kernel.js +5 -5
  18. package/dist/{knowledge-DBNAteaC.js → knowledge-h7sDHsnd.js} +3 -3
  19. package/dist/{knowledge-DBNAteaC.js.map → knowledge-h7sDHsnd.js.map} +1 -1
  20. package/dist/knowledge.d.ts +1 -1
  21. package/dist/knowledge.js +1 -1
  22. package/dist/{loop-runner-bin-BLOckrqT.js → loop-runner-bin-D1TTr39X.js} +3 -3
  23. package/dist/{loop-runner-bin-BLOckrqT.js.map → loop-runner-bin-D1TTr39X.js.map} +1 -1
  24. package/dist/{loop-runner-bin-vRo5TZt_.d.ts → loop-runner-bin-DN8491Y_.d.ts} +3 -3
  25. package/dist/loop-runner-bin.d.ts +1 -1
  26. package/dist/loop-runner-bin.js +1 -1
  27. package/dist/mcp/bin.js +1 -1
  28. package/dist/mcp/index.d.ts +1 -1
  29. package/dist/mcp/index.js +4 -4
  30. package/dist/{openai-tools-st-hERvA.js → openai-tools-B1lRpTZr.js} +2 -2
  31. package/dist/{openai-tools-st-hERvA.js.map → openai-tools-B1lRpTZr.js.map} +1 -1
  32. package/dist/primeintellect/index.d.ts +1 -1
  33. package/dist/{runtime-fwz-erxT.js → runtime-Cs2e63LL.js} +4 -4
  34. package/dist/{runtime-fwz-erxT.js.map → runtime-Cs2e63LL.js.map} +1 -1
  35. package/dist/{structural-rollout-CgnNy7_4.js → structural-rollout-DXmSoA9q.js} +2 -2
  36. package/dist/{structural-rollout-CgnNy7_4.js.map → structural-rollout-DXmSoA9q.js.map} +1 -1
  37. package/dist/{supervise-CeZtA1wu.js → supervise-S7glOjJH.js} +323 -30
  38. package/dist/supervise-S7glOjJH.js.map +1 -0
  39. package/dist/{supervisor-ByCPHcp9.js → supervisor-zebR4ICs.js} +53 -7
  40. package/dist/{supervisor-ByCPHcp9.js.map → supervisor-zebR4ICs.js.map} +1 -1
  41. package/dist/testing.js +8 -8
  42. package/package.json +1 -1
  43. package/dist/supervise-CeZtA1wu.js.map +0 -1
@@ -3453,7 +3453,11 @@ function createBudgetPool(root, now = Date.now) {
3453
3453
  ok: false,
3454
3454
  reason: "budget-exhausted"
3455
3455
  };
3456
- if (wantUsd > 0 && (!usdCapped || wantUsd > freeUsd)) return {
3456
+ if (wantUsd > 0 && !usdCapped) return {
3457
+ ok: false,
3458
+ reason: "usd-unbudgeted"
3459
+ };
3460
+ if (wantUsd > freeUsd) return {
3457
3461
  ok: false,
3458
3462
  reason: "budget-exhausted"
3459
3463
  };
@@ -3710,6 +3714,29 @@ function maxSeqOf(events, pred) {
3710
3714
  /** The default runtime recursion-depth ceiling, paired with the conserved pool so a
3711
3715
  * runaway recursion hits budget-exhaustion first and depth-exceeded second (R3). */
3712
3716
  const defaultMaxDepth = 4;
3717
+ /**
3718
+ * Normalize an arbitrary rejection into the serializable triple the result carries. A driver may
3719
+ * reject with anything (a string, a plain object, a null-prototype value), and the whole point of
3720
+ * this field is that the failure survives, so every branch produces a message instead of throwing:
3721
+ * a stringification that itself throws (circular, hostile `toString`) falls back to the tag.
3722
+ */
3723
+ function describeRejection(error) {
3724
+ if (error instanceof Error) return {
3725
+ name: error.name,
3726
+ message: error.message,
3727
+ ...error.stack !== void 0 ? { stack: error.stack } : {}
3728
+ };
3729
+ let message;
3730
+ try {
3731
+ message = typeof error === "string" ? error : JSON.stringify(error) ?? String(error);
3732
+ } catch {
3733
+ message = Object.prototype.toString.call(error);
3734
+ }
3735
+ return {
3736
+ name: "NonError",
3737
+ message
3738
+ };
3739
+ }
3713
3740
  /** Create a supervisor that owns one recursive agent execution tree. */
3714
3741
  function createSupervisor() {
3715
3742
  let attached;
@@ -3813,16 +3840,29 @@ function createSupervisor() {
3813
3840
  }
3814
3841
  return noWinner();
3815
3842
  }
3816
- return noWinner();
3817
- async function noWinner() {
3843
+ return noWinner({ error: actOutcome.error });
3844
+ async function noWinner(rejection) {
3818
3845
  const { childWork, driverInference } = await spentFromJournal(journal, opts.runId);
3819
- return {
3846
+ const common = {
3820
3847
  kind: "no-winner",
3821
- reason: classifyNoWinner(controller, pool, opts, breaker),
3822
3848
  tree,
3823
3849
  downCount: breaker.downCount(),
3824
3850
  spentTotal: addSpend(childWork, driverInference)
3825
3851
  };
3852
+ const lifecycle = classifyNoWinner(controller, pool, opts, breaker);
3853
+ if (lifecycle !== void 0) return {
3854
+ ...common,
3855
+ reason: lifecycle
3856
+ };
3857
+ if (rejection !== void 0) return {
3858
+ ...common,
3859
+ reason: "driver-failed",
3860
+ error: describeRejection(rejection.error)
3861
+ };
3862
+ return {
3863
+ ...common,
3864
+ reason: "all-children-down"
3865
+ };
3826
3866
  }
3827
3867
  }
3828
3868
  function attach(h) {
@@ -3905,11 +3945,17 @@ async function drainLiveChildren(scope, controller) {
3905
3945
  async function drainCursor(scope) {
3906
3946
  for (;;) if (await scope.next() === null) return;
3907
3947
  }
3948
+ /**
3949
+ * The lifecycle cause of a no-winner, or `undefined` when the supervisor's own state proves
3950
+ * nothing. Returning `undefined` rather than falling through to `all-children-down` is what lets
3951
+ * the caller decide between the `driver-failed` arm (a rejection was captured) and the residual
3952
+ * bucket — and it is why `driver-failed` cannot be produced without an `error` to attach.
3953
+ */
3908
3954
  function classifyNoWinner(controller, pool, opts, breaker) {
3909
3955
  if (breaker.tripped()) return "all-children-down";
3910
3956
  if (controller.signal.aborted) return "aborted";
3911
3957
  if (poolExhausted(pool, opts)) return "budget-exhausted";
3912
- return "all-children-down";
3958
+ if (breaker.downCount() > 0) return "all-children-down";
3913
3959
  }
3914
3960
  function poolExhausted(pool, opts) {
3915
3961
  const r = pool.readout();
@@ -3991,4 +4037,4 @@ function isNonEmptySpend(s) {
3991
4037
  //#endregion
3992
4038
  export { createWorktree as A, routerChatWithUsage as C, runWorktreeChecks as D, runSettledCommand as E, CodexExecutionDiagnosticError as F, harnessInvocation as M, parseCodexTokenUsage as N, runWorktreeHarness as O, runLocalHarness as P, routerChatWithTools as S, runBrainLoop as T, waitUntil as _, runFinalizer as a, readWorkerProgress as b, spendFromUsageEvents as c, settledToIteration as d, createWaitProbes as f, validateWaitSpec as g, timerAt as h, pickBestDelivered as i, removeWorktree as j, captureWorktreeDiff as k, withDriverExecutor as l, pollFor as m, bestDelivered as n, runTree as o, isWaitOutcome as p, collectDelivered as r, createBudgetPool as s, createSupervisor as t, createScope as u, DEFAULT_STALL_AFTER_MS as v, routerToolLoop as w, routerBrain as x, createActivityLog as y };
3993
4039
 
3994
- //# sourceMappingURL=supervisor-ByCPHcp9.js.map
4040
+ //# sourceMappingURL=supervisor-zebR4ICs.js.map