@rulvar/core 1.206.0 → 1.207.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 +47 -1
- package/dist/index.js +40 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -6818,6 +6818,25 @@ type AdmitRejectReason = {
|
|
|
6818
6818
|
code: "osc_guard";
|
|
6819
6819
|
spawnKey: SpawnKey;
|
|
6820
6820
|
oscillationCount: number;
|
|
6821
|
+
} | {
|
|
6822
|
+
/**
|
|
6823
|
+
* The sequential roster feasibility refusal (RV2005): under a
|
|
6824
|
+
* declared acceptance.minSpawnedChildren, the whole remaining
|
|
6825
|
+
* roster (priced at this seat's own projection) plus the live
|
|
6826
|
+
* in-flight exposure does not fit the parent remainder, so the
|
|
6827
|
+
* FIRST infeasible seat refuses before any child is paid. The
|
|
6828
|
+
* batchGate symmetry (RV1908) on the seat-by-seat path the
|
|
6829
|
+
* parity rerun's model actually took, where three seats were
|
|
6830
|
+
* paid in full under a floor of four the money could never
|
|
6831
|
+
* reach.
|
|
6832
|
+
*/
|
|
6833
|
+
code: "roster_floor";
|
|
6834
|
+
floor: number;
|
|
6835
|
+
admittedChildren: number;
|
|
6836
|
+
seatsRemaining: number;
|
|
6837
|
+
perSeatProjectionUsd: number;
|
|
6838
|
+
liveExposureUsd: number;
|
|
6839
|
+
remainderUsd: number;
|
|
6821
6840
|
} | {
|
|
6822
6841
|
/**
|
|
6823
6842
|
* The declared estimate cannot fit the child's own ceiling: the
|
|
@@ -6859,6 +6878,20 @@ interface AdmitSpec {
|
|
|
6859
6878
|
*/
|
|
6860
6879
|
pendingReserveUsd?: number;
|
|
6861
6880
|
/**
|
|
6881
|
+
* The sequential roster feasibility inputs (RV2005), passed by the
|
|
6882
|
+
* SINGLE spawn_agent path when acceptance.minSpawnedChildren is
|
|
6883
|
+
* declared: the admission projects the whole REMAINING roster at
|
|
6884
|
+
* this seat's own dispatch projection, live in-flight exposure
|
|
6885
|
+
* included, and refuses the first infeasible seat typed
|
|
6886
|
+
* 'roster_floor' before any child is paid. Batch seats never carry
|
|
6887
|
+
* this: the RV1908 batchGate already judged their batch entire.
|
|
6888
|
+
*/
|
|
6889
|
+
roster?: {
|
|
6890
|
+
floor: number;
|
|
6891
|
+
admittedChildren: number;
|
|
6892
|
+
liveExposureUsd: number;
|
|
6893
|
+
};
|
|
6894
|
+
/**
|
|
6862
6895
|
* Lineage continuation (DEF-3); absence mints a fresh lineage root. A
|
|
6863
6896
|
* continuation demands a causeRef: the seq of the entry that caused the
|
|
6864
6897
|
* rebirth.
|
|
@@ -8751,7 +8784,7 @@ interface OrchestratorRuntime {
|
|
|
8751
8784
|
causeRef: number;
|
|
8752
8785
|
};
|
|
8753
8786
|
taskClass?: string;
|
|
8754
|
-
}): Promise<{
|
|
8787
|
+
}, origin?: "spawn_agent" | "parallel_agents"): Promise<{
|
|
8755
8788
|
handle: number;
|
|
8756
8789
|
}>;
|
|
8757
8790
|
awaitAny(handles: number[]): Promise<TaskDigest>;
|
|
@@ -9552,6 +9585,19 @@ interface OrchestrateOptions {
|
|
|
9552
9585
|
*/
|
|
9553
9586
|
parallelAdmission?: "fail-fast" | "try-all" | "all-or-none";
|
|
9554
9587
|
/**
|
|
9588
|
+
* The batch-spawn discipline (RV2005). The third parity rerun's
|
|
9589
|
+
* model ignored the instruction to spawn its roster in one
|
|
9590
|
+
* parallel_agents call and spawned seat by seat through spawn_agent,
|
|
9591
|
+
* so the RV1908 batchGate never saw a batch and the roster
|
|
9592
|
+
* feasibility rode on per-seat luck. 'reject-spawn-agent' refuses
|
|
9593
|
+
* every SINGLE spawn_agent call typed (code 'batch_required',
|
|
9594
|
+
* nothing journaled, nothing paid) so model disobedience cannot
|
|
9595
|
+
* split the policy: the model reads the refusal and re-issues the
|
|
9596
|
+
* wave as one parallel_agents batch. Absent, both tools behave as
|
|
9597
|
+
* documented.
|
|
9598
|
+
*/
|
|
9599
|
+
requireBatchSpawn?: "reject-spawn-agent";
|
|
9600
|
+
/**
|
|
9555
9601
|
* The opt in deterministic host validation of the finish result, with
|
|
9556
9602
|
* bounded repair; see {@link FinishValidationSpec}.
|
|
9557
9603
|
*/
|
package/dist/index.js
CHANGED
|
@@ -16047,6 +16047,28 @@ var AdmissionController = class {
|
|
|
16047
16047
|
},
|
|
16048
16048
|
statsBefore
|
|
16049
16049
|
};
|
|
16050
|
+
if (spec.roster !== void 0) {
|
|
16051
|
+
const seatsRemaining = spec.roster.floor - spec.roster.admittedChildren;
|
|
16052
|
+
if (seatsRemaining > 0) {
|
|
16053
|
+
const perSeatProjectionUsd = this.projectedDispatchReserveUsd(spec);
|
|
16054
|
+
const remainder = this.budget.remainderOf(spec.parentAccountScope);
|
|
16055
|
+
if (remainder !== void 0 && remainder < seatsRemaining * perSeatProjectionUsd + spec.roster.liveExposureUsd) return {
|
|
16056
|
+
verdict: {
|
|
16057
|
+
kind: "reject",
|
|
16058
|
+
reason: {
|
|
16059
|
+
code: "roster_floor",
|
|
16060
|
+
floor: spec.roster.floor,
|
|
16061
|
+
admittedChildren: spec.roster.admittedChildren,
|
|
16062
|
+
seatsRemaining,
|
|
16063
|
+
perSeatProjectionUsd,
|
|
16064
|
+
liveExposureUsd: spec.roster.liveExposureUsd,
|
|
16065
|
+
remainderUsd: remainder
|
|
16066
|
+
}
|
|
16067
|
+
},
|
|
16068
|
+
statsBefore
|
|
16069
|
+
};
|
|
16070
|
+
}
|
|
16071
|
+
}
|
|
16050
16072
|
const spawnToolOrigin = spec.origin === "spawn_agent" || spec.origin === "parallel_agents";
|
|
16051
16073
|
let childCeilingUsd;
|
|
16052
16074
|
const parentRemainder = this.budget.remainderOf(spec.parentAccountScope);
|
|
@@ -19247,7 +19269,7 @@ function buildOrchestratorTools(runtime, profileCardText, options) {
|
|
|
19247
19269
|
for (const [index, task] of tasks.entries()) {
|
|
19248
19270
|
let spawned;
|
|
19249
19271
|
try {
|
|
19250
|
-
spawned = await runtime.spawn(task);
|
|
19272
|
+
spawned = await runtime.spawn(task, "parallel_agents");
|
|
19251
19273
|
} catch (thrown) {
|
|
19252
19274
|
const failure = {
|
|
19253
19275
|
index,
|
|
@@ -21872,8 +21894,16 @@ function makeOrchestratorWorkflow(goal, opts) {
|
|
|
21872
21894
|
};
|
|
21873
21895
|
const executionFactsEnabled = opts?.executionFacts === true;
|
|
21874
21896
|
const orchestratorRuntime = {
|
|
21875
|
-
async spawn(params) {
|
|
21897
|
+
async spawn(params, origin = "spawn_agent") {
|
|
21876
21898
|
await recoveryDone;
|
|
21899
|
+
if (origin === "spawn_agent" && opts?.requireBatchSpawn === "reject-spawn-agent") {
|
|
21900
|
+
internals.events.emit({
|
|
21901
|
+
type: "spawn:rejected",
|
|
21902
|
+
code: "batch_required",
|
|
21903
|
+
agentType: params.agentType
|
|
21904
|
+
}, callingState.spanId);
|
|
21905
|
+
throw new AdmissionRejectedError("orchestrate requireBatchSpawn 'reject-spawn-agent': single spawn_agent calls are refused; submit the whole wave as ONE parallel_agents call so the batch roster feasibility gate sees it entire", { data: { reason: { code: "batch_required" } } });
|
|
21906
|
+
}
|
|
21877
21907
|
const specKey = jcsSerialize(params);
|
|
21878
21908
|
const recoveredOrdinal = unclaimedRecoveredBySpec.get(specKey)?.shift();
|
|
21879
21909
|
if (recoveredOrdinal !== void 0) {
|
|
@@ -21907,14 +21937,20 @@ function makeOrchestratorWorkflow(goal, opts) {
|
|
|
21907
21937
|
const profile = Object.hasOwn(advertisedProfiles, params.agentType) ? advertisedProfiles[params.agentType] : void 0;
|
|
21908
21938
|
const profileModel = profile?.model;
|
|
21909
21939
|
if (profileModel !== void 0 && typeof profileModel !== "string" && "ladder" in profileModel) throw new ConfigError(`agentType '${params.agentType}' declares a ladder; ladder execution is owned by the plan extension, which resolves each rung attempt to a concrete model override; spawn a concrete profile instead`);
|
|
21940
|
+
const rosterFloor = (opts?.acceptance)?.minSpawnedChildren;
|
|
21910
21941
|
const decision = admission.admit({
|
|
21911
|
-
origin
|
|
21942
|
+
origin,
|
|
21912
21943
|
name: params.agentType,
|
|
21913
21944
|
childScope: scope,
|
|
21914
21945
|
parentAccountScope: callingState.budgetScope ?? "run",
|
|
21915
21946
|
nodeKey: scope,
|
|
21916
21947
|
...params.budgetUsd === void 0 ? {} : { budgetUsd: params.budgetUsd },
|
|
21917
21948
|
...profile?.estCost === void 0 ? {} : { estCostUsd: profile.estCost },
|
|
21949
|
+
...origin === "spawn_agent" && rosterFloor !== void 0 ? { roster: {
|
|
21950
|
+
floor: rosterFloor,
|
|
21951
|
+
admittedChildren: admittedSpawnCount,
|
|
21952
|
+
liveExposureUsd: internals.budget.liveExposureUsd
|
|
21953
|
+
} } : {},
|
|
21918
21954
|
...params.lineage === void 0 ? {} : { lineage: {
|
|
21919
21955
|
continues: params.lineage.continues,
|
|
21920
21956
|
causeRef: params.lineage.causeRef,
|
|
@@ -21928,7 +21964,7 @@ function makeOrchestratorWorkflow(goal, opts) {
|
|
|
21928
21964
|
}, { commitReserve: false });
|
|
21929
21965
|
const admissionValue = {
|
|
21930
21966
|
decisionType: "spawn-admission",
|
|
21931
|
-
origin
|
|
21967
|
+
origin,
|
|
21932
21968
|
orchestratorScope: scope,
|
|
21933
21969
|
spawnOrdinal,
|
|
21934
21970
|
name: params.agentType,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rulvar/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.207.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",
|