@rulvar/core 1.212.0 → 1.213.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 +31 -11
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -23919,24 +23919,44 @@ function makeOrchestratorWorkflow(goal, opts) {
23919
23919
  }
23920
23920
  });
23921
23921
  internals.budget.markExhausted();
23922
- const fold = {
23922
+ const foldEnvelope = () => ({
23923
23923
  forcedFinishFallback: true,
23924
23924
  completion: "partial",
23925
23925
  planHash: "",
23926
23926
  completed: [...byOrdinal.values()].filter((record) => record.settled !== void 0).sort((a, b) => a.spawnOrdinal - b.spawnOrdinal).map((record) => digestOf(record, record.settled))
23927
- };
23927
+ });
23928
23928
  const synthesisReserveStillCommitted = orchestratorAccount !== void 0 && (internals.budget.accountView(orchestratorAccount)?.synthesisReserveUsd ?? 0) > 0;
23929
23929
  const anySettled = [...byOrdinal.values()].some((record) => record.settled !== void 0);
23930
- if (opts?.synthesis !== void 0 && synthesisReserveStillCommitted && anySettled) try {
23931
- const synthesized = await runSynthesis(void 0);
23932
- return {
23933
- ...fold,
23934
- result: synthesized
23935
- };
23936
- } catch {
23937
- return fold;
23930
+ if (opts?.synthesis !== void 0 && synthesisReserveStillCommitted && anySettled) {
23931
+ const stragglers = [...byOrdinal.values()].filter((record) => record.settled === void 0);
23932
+ for (const record of stragglers) record.abort();
23933
+ await Promise.all(stragglers.map((record) => record.result));
23934
+ try {
23935
+ const synthesized = await runSynthesis(void 0);
23936
+ return {
23937
+ ...foldEnvelope(),
23938
+ result: synthesized
23939
+ };
23940
+ } catch (declined) {
23941
+ const declineKey = deriverV2.deriveKey({ kind: "orchestrator-synthesis-redemption-declined" });
23942
+ if (!internals.replayer.snapshot().some((entry) => entry.kind === "decision" && entry.key === declineKey)) await internals.replayer.appendSinglePhase({
23943
+ scope: callingState.scope,
23944
+ key: declineKey,
23945
+ kind: "decision",
23946
+ status: "ok",
23947
+ spanId: internals.spans.mint(callingState.spanId),
23948
+ site: "orchestrator-budget",
23949
+ value: {
23950
+ decisionType: "orchestrator_synthesis_redemption_declined",
23951
+ reason: declined instanceof Error ? declined.message.slice(0, 300) : String(declined).slice(0, 300),
23952
+ remainingUsd: internals.budget.remainingUsd() ?? null,
23953
+ stragglersDrained: stragglers.length
23954
+ }
23955
+ });
23956
+ return foldEnvelope();
23957
+ }
23938
23958
  }
23939
- return fold;
23959
+ return foldEnvelope();
23940
23960
  }
23941
23961
  const liveTermination = extensionTermination;
23942
23962
  if (liveTermination !== void 0) throw liveTermination;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulvar/core",
3
- "version": "1.212.0",
3
+ "version": "1.213.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",