@rulvar/core 1.214.0 → 1.215.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 (2) hide show
  1. package/dist/index.js +30 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -12623,6 +12623,7 @@ async function runAgent(options) {
12623
12623
  kind: "budget",
12624
12624
  retryable: false
12625
12625
  };
12626
+ errorMessage = thrown instanceof Error ? thrown.message : String(thrown);
12626
12627
  break;
12627
12628
  }
12628
12629
  turns += 1;
@@ -12834,12 +12835,13 @@ async function runAgent(options) {
12834
12835
  });
12835
12836
  try {
12836
12837
  options.budget?.beforeTurn();
12837
- } catch {
12838
+ } catch (thrown) {
12838
12839
  status = "error";
12839
12840
  agentError = {
12840
12841
  kind: "budget",
12841
12842
  retryable: false
12842
12843
  };
12844
+ errorMessage = thrown instanceof Error ? thrown.message : String(thrown);
12843
12845
  endPhase(summarizePhase, "error");
12844
12846
  break;
12845
12847
  }
@@ -13006,11 +13008,12 @@ async function runAgent(options) {
13006
13008
  let proceed = true;
13007
13009
  try {
13008
13010
  options.budget?.beforeTurn();
13009
- } catch {
13011
+ } catch (thrown) {
13010
13012
  events?.emit({
13011
13013
  type: "log",
13012
13014
  level: "warn",
13013
- msg: "the finalization reserve turn was skipped: the budget blocks further turns"
13015
+ msg: "the finalization reserve turn was skipped: the budget blocks further turns",
13016
+ data: { reason: thrown instanceof Error ? thrown.message : String(thrown) }
13014
13017
  });
13015
13018
  proceed = false;
13016
13019
  }
@@ -13114,12 +13117,13 @@ async function runAgent(options) {
13114
13117
  let proceed = true;
13115
13118
  try {
13116
13119
  options.budget?.beforeTurn();
13117
- } catch {
13120
+ } catch (thrown) {
13118
13121
  status = "error";
13119
13122
  agentError = {
13120
13123
  kind: "budget",
13121
13124
  retryable: false
13122
13125
  };
13126
+ errorMessage = thrown instanceof Error ? thrown.message : String(thrown);
13123
13127
  proceed = false;
13124
13128
  }
13125
13129
  if (proceed) {
@@ -13266,12 +13270,13 @@ async function runAgent(options) {
13266
13270
  while (status === "ok") {
13267
13271
  try {
13268
13272
  options.budget?.beforeTurn();
13269
- } catch {
13273
+ } catch (thrown) {
13270
13274
  status = "error";
13271
13275
  agentError = {
13272
13276
  kind: "budget",
13273
13277
  retryable: false
13274
13278
  };
13279
+ errorMessage = thrown instanceof Error ? thrown.message : String(thrown);
13275
13280
  break;
13276
13281
  }
13277
13282
  turns += 1;
@@ -24924,6 +24929,26 @@ function preflightEstimate(input) {
24924
24929
  });
24925
24930
  }
24926
24931
  }
24932
+ {
24933
+ const pricing = pricingOf(servedBy);
24934
+ const declared = input.orchestrator?.budget?.synthesisReserveUsd;
24935
+ if (pricing !== void 0 && outputBound !== void 0 && declared !== void 0 && declared > 0) {
24936
+ const compositionUsd = priceUsdOf(pricing, {
24937
+ inputTokens: synthesis.estInputTokens ?? 0,
24938
+ outputTokens: outputBound,
24939
+ cacheReadTokens: 0,
24940
+ cacheWriteTokens: 0
24941
+ });
24942
+ const repairTurns = finishRepairReserve > 0 ? 1 : 0;
24943
+ const requiredUsd = compositionUsd * (1 + repairTurns);
24944
+ if (declared < requiredUsd) say({
24945
+ severity: "warning",
24946
+ code: "synthesis-reserve-below-cap-composition",
24947
+ message: `a synthesis turn writing to its ${String(outputBound)} token output allowance over the declared ${String(synthesis.estInputTokens ?? 0)} input floor prices about ${compositionUsd.toFixed(4)} USD at the rates of '${servedBy}'` + (repairTurns > 0 ? `, and the declared repair reserve prices one more such turn (about ${requiredUsd.toFixed(4)} USD total)` : "") + `; the committed synthesis reserve holds only ${declared.toFixed(4)} USD, so a composition cut at the allowance can fail its validators with no money left for the granted repair; hold the reserve at the cap arithmetic or lower maxOutputTokensPerTurn`,
24948
+ spawn: "synthesis"
24949
+ });
24950
+ }
24951
+ }
24927
24952
  const projected = projectedProviderTurnsOf(merged, overallExecutedCeiling(merged, toolCeilingsOf(merged))) + finishRepairReserve;
24928
24953
  if (orchestratorEcho !== void 0) orchestratorEcho.synthesis = {
24929
24954
  projectedProviderTurns: projected,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulvar/core",
3
- "version": "1.214.0",
3
+ "version": "1.215.0",
4
4
  "description": "Rulvar core: L0 contracts, journal kernel, ctx primitives, agent runtime, model router, tool system, dynamic orchestrator, InMemory and JSONL stores, event stream.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",