@rulvar/core 1.174.0 → 1.175.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.js +25 -18
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -20276,7 +20276,7 @@ function makeOrchestratorWorkflow(goal, opts) {
|
|
|
20276
20276
|
* handing it the prior ordinal's handle would bind the transcript
|
|
20277
20277
|
* to a stranger's child.
|
|
20278
20278
|
*/
|
|
20279
|
-
const
|
|
20279
|
+
const unclaimedRecoveredBySpec = /* @__PURE__ */ new Map();
|
|
20280
20280
|
let nextOrdinal = 0;
|
|
20281
20281
|
/**
|
|
20282
20282
|
* The maxSpawns ledger counts ADMITTED children, never attempt
|
|
@@ -20517,7 +20517,12 @@ function makeOrchestratorWorkflow(goal, opts) {
|
|
|
20517
20517
|
for (const { entrySeq, value } of admissions) {
|
|
20518
20518
|
nextOrdinal = Math.max(nextOrdinal, value.spawnOrdinal + 1);
|
|
20519
20519
|
const decision = value.decision;
|
|
20520
|
-
|
|
20520
|
+
{
|
|
20521
|
+
const specKey = jcsSerialize(value.spec);
|
|
20522
|
+
const queue = unclaimedRecoveredBySpec.get(specKey);
|
|
20523
|
+
if (queue === void 0) unclaimedRecoveredBySpec.set(specKey, [value.spawnOrdinal]);
|
|
20524
|
+
else queue.push(value.spawnOrdinal);
|
|
20525
|
+
}
|
|
20521
20526
|
const recoveredAgentType = value.spec?.agentType ?? "unknown";
|
|
20522
20527
|
if (decision.verdict.kind !== "admit") {
|
|
20523
20528
|
rejectedByOrdinal.set(value.spawnOrdinal, {
|
|
@@ -20680,24 +20685,26 @@ function makeOrchestratorWorkflow(goal, opts) {
|
|
|
20680
20685
|
const orchestratorRuntime = {
|
|
20681
20686
|
async spawn(params) {
|
|
20682
20687
|
await recoveryDone;
|
|
20688
|
+
const specKey = jcsSerialize(params);
|
|
20689
|
+
const recoveredOrdinal = unclaimedRecoveredBySpec.get(specKey)?.shift();
|
|
20690
|
+
if (recoveredOrdinal !== void 0) {
|
|
20691
|
+
const recovered = byOrdinal.get(recoveredOrdinal);
|
|
20692
|
+
if (recovered !== void 0) return { handle: recovered.handle };
|
|
20693
|
+
const recoveredRejection = rejectedByOrdinal.get(recoveredOrdinal);
|
|
20694
|
+
if (recoveredRejection !== void 0) {
|
|
20695
|
+
const reason = recoveredRejection.decision.verdict;
|
|
20696
|
+
emitSpawnRejected(internals.events, {
|
|
20697
|
+
entryRef: recoveredRejection.entrySeq,
|
|
20698
|
+
code: reason.reason?.code ?? "unknown",
|
|
20699
|
+
agentType: params.agentType,
|
|
20700
|
+
spanId: callingState.spanId,
|
|
20701
|
+
replayed: true
|
|
20702
|
+
});
|
|
20703
|
+
throw new AdmissionRejectedError(`admission rejected spawn ordinal ${String(recoveredOrdinal)} (recovered verdict)`, { data: { decision: recoveredRejection.decision } });
|
|
20704
|
+
}
|
|
20705
|
+
}
|
|
20683
20706
|
const spawnOrdinal = nextOrdinal;
|
|
20684
20707
|
nextOrdinal += 1;
|
|
20685
|
-
const priorSpec = recoveredSpecByOrdinal.get(spawnOrdinal);
|
|
20686
|
-
const specMatches = priorSpec === void 0 || priorSpec.agentType === params.agentType && priorSpec.prompt === params.prompt;
|
|
20687
|
-
const recovered = byOrdinal.get(spawnOrdinal);
|
|
20688
|
-
if (recovered !== void 0 && specMatches) return { handle: recovered.handle };
|
|
20689
|
-
const recoveredRejection = rejectedByOrdinal.get(spawnOrdinal);
|
|
20690
|
-
if (recoveredRejection !== void 0 && specMatches) {
|
|
20691
|
-
const reason = recoveredRejection.decision.verdict;
|
|
20692
|
-
emitSpawnRejected(internals.events, {
|
|
20693
|
-
entryRef: recoveredRejection.entrySeq,
|
|
20694
|
-
code: reason.reason?.code ?? "unknown",
|
|
20695
|
-
agentType: params.agentType,
|
|
20696
|
-
spanId: callingState.spanId,
|
|
20697
|
-
replayed: true
|
|
20698
|
-
});
|
|
20699
|
-
throw new AdmissionRejectedError(`admission rejected spawn ordinal ${String(spawnOrdinal)} (recovered verdict)`, { data: { decision: recoveredRejection.decision } });
|
|
20700
|
-
}
|
|
20701
20708
|
if (opts?.maxSpawns !== void 0 && admittedSpawnCount >= opts.maxSpawns) {
|
|
20702
20709
|
internals.events.emit({
|
|
20703
20710
|
type: "spawn:rejected",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rulvar/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.175.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",
|