@rulvar/core 1.192.0 → 1.193.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.
package/dist/index.d.ts CHANGED
@@ -12553,6 +12553,14 @@ interface PreflightOrchestratorSpec {
12553
12553
  };
12554
12554
  acceptPartialChildren?: boolean;
12555
12555
  acceptValidatedTerminalOutputOnLimit?: boolean;
12556
+ /**
12557
+ * Mirrors OrchestrateAcceptance.minSpawnedChildren (RV1901, the
12558
+ * four-role benchmark's primary defect): declaring it lets the
12559
+ * admission projection judge whether the declared wave can seat
12560
+ * the roster the acceptance policy demands, instead of green-
12561
+ * lighting a wave the settle verdict is bound to reject.
12562
+ */
12563
+ minSpawnedChildren?: number;
12556
12564
  };
12557
12565
  /**
12558
12566
  * The separate synthesis invocation (RV-211), when the orchestration
@@ -12714,6 +12722,15 @@ interface PreflightAdmissionRow {
12714
12722
  reserveUsd: number;
12715
12723
  admitted: boolean;
12716
12724
  deniedBy?: "budget" | "spawn-cap" | "orchestrator-max-spawns";
12725
+ /**
12726
+ * The run-root money already held when this row was evaluated:
12727
+ * committed reserves of the earlier rows plus the finalization and
12728
+ * synthesis carve-outs (RV1901). The row admits iff held + reserveUsd
12729
+ * fits the ceiling (children strictly below it at exact fill), so a
12730
+ * denied row's arithmetic is auditable term by term. Present only
12731
+ * under a USD ceiling.
12732
+ */
12733
+ heldAtEvaluationUsd?: number;
12717
12734
  }
12718
12735
  /** The machine-readable preflight report; JSON-serializable throughout. */
12719
12736
  interface PreflightReport {
@@ -12756,6 +12773,15 @@ interface PreflightReport {
12756
12773
  admission: {
12757
12774
  ceilingUsd?: number;
12758
12775
  reservedForFinalizationUsd: number;
12776
+ /**
12777
+ * The synthesis payload carve-out the projection holds against the
12778
+ * run root, exactly the live commitSynthesisReserve mirror (RV1901):
12779
+ * a capped orchestrator with budget.synthesisReserveUsd registers it
12780
+ * on the root before any spawn admits, so the wave arithmetic must
12781
+ * hold it too. Zero when the orchestrator is uncapped or declares no
12782
+ * synthesis reserve, matching the runtime that then commits none.
12783
+ */
12784
+ synthesisReserveUsd: number;
12759
12785
  wave: PreflightAdmissionRow[];
12760
12786
  admitted: number;
12761
12787
  denied: number;
package/dist/index.js CHANGED
@@ -23784,9 +23784,11 @@ function preflightEstimate(input) {
23784
23784
  const coordinationRepairReserve = input.orchestrator?.synthesis === void 0 ? finishRepairReserve : 0;
23785
23785
  let orchestratorEcho;
23786
23786
  let reservedForFinalizationUsd = 0;
23787
+ let synthesisHoldUsd = 0;
23787
23788
  let effectiveCapUsd;
23788
23789
  if (input.orchestrator !== void 0) {
23789
23790
  if (input.orchestrator.estInputTokens !== void 0) requireNonNegativeInteger(input.orchestrator.estInputTokens, "preflight.orchestrator.estInputTokens");
23791
+ if (input.orchestrator.acceptance?.minSpawnedChildren !== void 0) requirePositiveInteger$2(input.orchestrator.acceptance.minSpawnedChildren, "preflight.orchestrator.acceptance.minSpawnedChildren");
23790
23792
  const spec = input.orchestrator.budget;
23791
23793
  const fraction = spec?.capFraction ?? .2;
23792
23794
  const fromFraction = ceilingUsd === void 0 ? void 0 : fraction * ceilingUsd;
@@ -23796,6 +23798,7 @@ function preflightEstimate(input) {
23796
23798
  const finalizeReserveUsd = spec?.finalizeReserveUsd ?? finalizeTurns * flatReserveUsd;
23797
23799
  const reserveCommitted = input.orchestrator.extension === true;
23798
23800
  if (reserveCommitted) reservedForFinalizationUsd = finalizeReserveUsd;
23801
+ if (effectiveCapUsd !== void 0) synthesisHoldUsd = Math.max(0, spec?.synthesisReserveUsd ?? 0);
23799
23802
  const echoLimits = mergeUsageLimits(input.orchestrator.limits, void 0, defaults.limits);
23800
23803
  orchestratorEcho = {
23801
23804
  ...effectiveCapUsd === void 0 ? {} : { effectiveCapUsd },
@@ -24208,9 +24211,11 @@ function preflightEstimate(input) {
24208
24211
  let committed = 0;
24209
24212
  let spawned = 0;
24210
24213
  let children = 0;
24214
+ let childrenDeniedByBudget = 0;
24215
+ const heldAgainstRoot = () => committed + reservedForFinalizationUsd + synthesisHoldUsd;
24211
24216
  const admitAgainstRoot = (reserveUsd, strictAtFill = false) => {
24212
24217
  if (ceilingUsd === void 0) return true;
24213
- const held = committed + reservedForFinalizationUsd;
24218
+ const held = heldAgainstRoot();
24214
24219
  if (held >= ceilingUsd) return false;
24215
24220
  const fill = held + reserveUsd;
24216
24221
  return strictAtFill ? fill < ceilingUsd : fill <= ceilingUsd;
@@ -24224,7 +24229,8 @@ function preflightEstimate(input) {
24224
24229
  label: "orchestrator",
24225
24230
  reserveUsd,
24226
24231
  admitted: deniedBy === void 0,
24227
- ...deniedBy === void 0 ? {} : { deniedBy }
24232
+ ...deniedBy === void 0 ? {} : { deniedBy },
24233
+ ...ceilingUsd === void 0 ? {} : { heldAtEvaluationUsd: heldAgainstRoot() }
24228
24234
  });
24229
24235
  if (deniedBy === void 0) {
24230
24236
  committed += reserveUsd;
@@ -24243,7 +24249,7 @@ function preflightEstimate(input) {
24243
24249
  else if (maxSpawns !== void 0 && children >= maxSpawns) deniedBy = "orchestrator-max-spawns";
24244
24250
  else {
24245
24251
  if (orchestrateWave && ceilingUsd !== void 0) {
24246
- const remainder = ceilingUsd - committed - reservedForFinalizationUsd;
24252
+ const remainder = ceilingUsd - heldAgainstRoot();
24247
24253
  const projection = dispatchProjectionReserveUsd(gate, flatReserveUsd);
24248
24254
  if (remainder <= 0 || remainder <= projection) deniedBy = "budget";
24249
24255
  }
@@ -24253,13 +24259,14 @@ function preflightEstimate(input) {
24253
24259
  label,
24254
24260
  reserveUsd,
24255
24261
  admitted: deniedBy === void 0,
24256
- ...deniedBy === void 0 ? {} : { deniedBy }
24262
+ ...deniedBy === void 0 ? {} : { deniedBy },
24263
+ ...ceilingUsd === void 0 ? {} : { heldAtEvaluationUsd: heldAgainstRoot() }
24257
24264
  });
24258
24265
  if (deniedBy === void 0) {
24259
24266
  committed += reserveUsd;
24260
24267
  spawned += 1;
24261
24268
  children += 1;
24262
- }
24269
+ } else if (deniedBy === "budget") childrenDeniedByBudget += 1;
24263
24270
  }
24264
24271
  }
24265
24272
  const admitted = wave.filter((row) => row.admitted).length;
@@ -24277,6 +24284,19 @@ function preflightEstimate(input) {
24277
24284
  message: `the declared wave admits ${String(admitted)} of ${String(wave.length)} spawns; denied before any work: ${deniedLabels.join(", ")}`
24278
24285
  });
24279
24286
  }
24287
+ {
24288
+ const acceptance = input.orchestrator?.acceptance;
24289
+ const minSuccessfulFloor = acceptance?.childPolicy !== void 0 && acceptance.childPolicy !== "all-ok" ? acceptance.childPolicy.minSuccessful : void 0;
24290
+ const rosterFloor = Math.max(acceptance?.minSpawnedChildren ?? 0, minSuccessfulFloor ?? 0);
24291
+ if (rosterFloor > 0 && children < rosterFloor && childrenDeniedByBudget > 0) {
24292
+ const demandedBy = (acceptance?.minSpawnedChildren ?? 0) >= (minSuccessfulFloor ?? 0) ? "acceptance.minSpawnedChildren" : "acceptance.childPolicy.minSuccessful";
24293
+ say({
24294
+ severity: "error",
24295
+ code: "admission-below-roster-floor",
24296
+ message: `the declared wave seats ${String(children)} of the ${String(rosterFloor)} children ${demandedBy} demands (${String(childrenDeniedByBudget)} denied by budget): the run would pay for the seated work and still settle rejected; re-admission after a child settles frees money only when its settled spend stays below the released reserve`
24297
+ });
24298
+ }
24299
+ }
24280
24300
  if (ceilingUsd === void 0 && wave.length > 0) say({
24281
24301
  severity: "info",
24282
24302
  code: "no-usd-ceiling",
@@ -24500,6 +24520,7 @@ function preflightEstimate(input) {
24500
24520
  admission: {
24501
24521
  ...ceilingUsd === void 0 ? {} : { ceilingUsd },
24502
24522
  reservedForFinalizationUsd,
24523
+ synthesisReserveUsd: synthesisHoldUsd,
24503
24524
  wave,
24504
24525
  admitted,
24505
24526
  denied
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulvar/core",
3
- "version": "1.192.0",
3
+ "version": "1.193.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",