@rulvar/core 1.213.0 → 1.214.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 +32 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -23931,13 +23931,40 @@ function makeOrchestratorWorkflow(goal, opts) {
23931
23931
  const stragglers = [...byOrdinal.values()].filter((record) => record.settled === void 0);
23932
23932
  for (const record of stragglers) record.abort();
23933
23933
  await Promise.all(stragglers.map((record) => record.result));
23934
- try {
23934
+ const synthesisTerminalOf = (declined) => {
23935
+ if (!(declined instanceof BudgetExhaustedError)) return;
23936
+ const entryRef = declined.data?.entryRef;
23937
+ if (typeof entryRef !== "number") return;
23938
+ return internals.replayer.snapshot().find((entry) => entry.seq === entryRef);
23939
+ };
23940
+ let synthesisTransportRetried = false;
23941
+ for (;;) try {
23935
23942
  const synthesized = await runSynthesis(void 0);
23936
23943
  return {
23937
23944
  ...foldEnvelope(),
23938
23945
  result: synthesized
23939
23946
  };
23940
23947
  } catch (declined) {
23948
+ const terminal = synthesisTerminalOf(declined);
23949
+ if (!synthesisTransportRetried && terminal !== void 0 && terminal.error !== void 0 && terminal.error.data?.kind === "transport" && terminal.error.retryable === true) {
23950
+ synthesisTransportRetried = true;
23951
+ const retryKey = deriverV2.deriveKey({ kind: "orchestrator-synthesis-redemption-retry" });
23952
+ if (!internals.replayer.snapshot().some((entry) => entry.kind === "decision" && entry.key === retryKey)) await internals.replayer.appendSinglePhase({
23953
+ scope: callingState.scope,
23954
+ key: retryKey,
23955
+ kind: "decision",
23956
+ status: "ok",
23957
+ spanId: internals.spans.mint(callingState.spanId),
23958
+ site: "orchestrator-budget",
23959
+ value: {
23960
+ decisionType: "orchestrator_synthesis_redemption_retry",
23961
+ reason: terminal.error.message.slice(0, 300),
23962
+ terminalRef: terminal.seq,
23963
+ remainingUsd: internals.budget.remainingUsd() ?? null
23964
+ }
23965
+ });
23966
+ continue;
23967
+ }
23941
23968
  const declineKey = deriverV2.deriveKey({ kind: "orchestrator-synthesis-redemption-declined" });
23942
23969
  if (!internals.replayer.snapshot().some((entry) => entry.kind === "decision" && entry.key === declineKey)) await internals.replayer.appendSinglePhase({
23943
23970
  scope: callingState.scope,
@@ -23948,9 +23975,11 @@ function makeOrchestratorWorkflow(goal, opts) {
23948
23975
  site: "orchestrator-budget",
23949
23976
  value: {
23950
23977
  decisionType: "orchestrator_synthesis_redemption_declined",
23951
- reason: declined instanceof Error ? declined.message.slice(0, 300) : String(declined).slice(0, 300),
23978
+ reason: (terminal?.error?.message ?? (declined instanceof Error ? declined.message : String(declined))).slice(0, 300),
23979
+ ...terminal === void 0 ? {} : { terminalRef: terminal.seq },
23952
23980
  remainingUsd: internals.budget.remainingUsd() ?? null,
23953
- stragglersDrained: stragglers.length
23981
+ stragglersDrained: stragglers.length,
23982
+ transportRetries: synthesisTransportRetried ? 1 : 0
23954
23983
  }
23955
23984
  });
23956
23985
  return foldEnvelope();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulvar/core",
3
- "version": "1.213.0",
3
+ "version": "1.214.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",