@rulvar/core 1.241.0 → 1.243.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 +284 -2
- package/dist/index.js +582 -37
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7972,6 +7972,7 @@ var Replayer = class {
|
|
|
7972
7972
|
if (patch.evidence !== void 0) entry.evidence = patch.evidence;
|
|
7973
7973
|
if (patch.evidenceEntries !== void 0) entry.evidenceEntries = patch.evidenceEntries;
|
|
7974
7974
|
if (patch.toolBudget !== void 0) entry.toolBudget = patch.toolBudget;
|
|
7975
|
+
if (patch.hostRejected !== void 0) entry.hostRejected = patch.hostRejected;
|
|
7975
7976
|
if (patch.artifacts !== void 0) entry.artifacts = toJournalValue(patch.artifacts, "terminal artifacts");
|
|
7976
7977
|
if (patch.escalation !== void 0) entry.escalation = toJournalValue(patch.escalation, "escalation report");
|
|
7977
7978
|
if (patch.memoizeOutcome !== void 0) entry.memoizeOutcome = patch.memoizeOutcome;
|
|
@@ -9311,6 +9312,7 @@ function reduceInvocationTable(events) {
|
|
|
9311
9312
|
row.usageApprox = event.usageApprox === true;
|
|
9312
9313
|
row.retryCount = event.retryCount ?? 0;
|
|
9313
9314
|
if (event.toolBudget !== void 0) row.toolBudget = event.toolBudget;
|
|
9315
|
+
if (event.hostRejected === true) row.hostRejected = true;
|
|
9314
9316
|
totalCostUsd += event.costUsd;
|
|
9315
9317
|
break;
|
|
9316
9318
|
}
|
|
@@ -9331,6 +9333,20 @@ function reduceInvocationTable(events) {
|
|
|
9331
9333
|
*/
|
|
9332
9334
|
const CLAIM_JUDGE_LABEL = "claim-consistency-judge";
|
|
9333
9335
|
/**
|
|
9336
|
+
* The live abort reason of a finish rejection (RV3702): the value
|
|
9337
|
+
* `orchestrate()` aborts a composition invocation's signal with when
|
|
9338
|
+
* the declared finish contract rejects its candidate past the repair
|
|
9339
|
+
* bound, and ONLY then; a defective (throwing) validator aborts with
|
|
9340
|
+
* its own distinct reason, because a host defect is not a verdict on
|
|
9341
|
+
* the candidate. The settle layer reads the reason back and stamps
|
|
9342
|
+
* `hostRejected` onto the terminal agent entry and the live
|
|
9343
|
+
* `agent:end` event, so both span surfaces can tell a host rejection
|
|
9344
|
+
* (wires fine, document refused) from a provider failure without a
|
|
9345
|
+
* journal dig; the third comparison run's reader had exactly that
|
|
9346
|
+
* span (two successful wires, span cancelled) and nothing to name it.
|
|
9347
|
+
*/
|
|
9348
|
+
const FINISH_REJECTION_ABORT_REASON = "rulvar:finish-validation";
|
|
9349
|
+
/**
|
|
9334
9350
|
* Whether a synthesize span's label names a claim-consistency judge
|
|
9335
9351
|
* invocation: the exact {@link CLAIM_JUDGE_LABEL}, or a suffixed
|
|
9336
9352
|
* variant of it (the final pass dispatches under
|
|
@@ -9413,6 +9429,7 @@ function reduceCriticalPath(events) {
|
|
|
9413
9429
|
let finalJudgeMs = 0;
|
|
9414
9430
|
let compositionSpans = 0;
|
|
9415
9431
|
let judgeSpans = 0;
|
|
9432
|
+
let hostRejectedSpans = 0;
|
|
9416
9433
|
let firstCompositionEnd;
|
|
9417
9434
|
let lastCompositionEnd;
|
|
9418
9435
|
const coordinationModel = [];
|
|
@@ -9453,6 +9470,7 @@ function reduceCriticalPath(events) {
|
|
|
9453
9470
|
case "agent:end": {
|
|
9454
9471
|
const started = startBySpan.get(event.spanId);
|
|
9455
9472
|
if (started === void 0) break;
|
|
9473
|
+
if (event.hostRejected === true) hostRejectedSpans += 1;
|
|
9456
9474
|
if (started.role === "synthesize") {
|
|
9457
9475
|
const wall = Math.max(0, at - started.at);
|
|
9458
9476
|
const stage = claimJudgeStageOf(started.label);
|
|
@@ -9491,7 +9509,8 @@ function reduceCriticalPath(events) {
|
|
|
9491
9509
|
finalJudgeMs,
|
|
9492
9510
|
compositionSpans,
|
|
9493
9511
|
judgeSpans,
|
|
9494
|
-
workerSpans
|
|
9512
|
+
workerSpans,
|
|
9513
|
+
hostRejectedSpans
|
|
9495
9514
|
};
|
|
9496
9515
|
if (runStart !== void 0 && runEnd !== void 0) path.runWallMs = Math.max(0, runEnd - runStart);
|
|
9497
9516
|
if (runStart !== void 0 && firstCompositionEnd !== void 0) path.firstCandidateMs = Math.max(0, firstCompositionEnd - runStart);
|
|
@@ -9583,6 +9602,7 @@ function criticalPathFromJournal(entries) {
|
|
|
9583
9602
|
let lastWorkerEnd;
|
|
9584
9603
|
let workerSpans = 0;
|
|
9585
9604
|
let unclassifiedSpans = 0;
|
|
9605
|
+
let hostRejectedSpans = 0;
|
|
9586
9606
|
let synthesisMs = 0;
|
|
9587
9607
|
let finalCompositionMs = 0;
|
|
9588
9608
|
let semanticJudgeMs = 0;
|
|
@@ -9602,6 +9622,7 @@ function criticalPathFromJournal(entries) {
|
|
|
9602
9622
|
const last = endedAt ?? startedAt;
|
|
9603
9623
|
if (last !== void 0) runEnd = runEnd === void 0 ? last : Math.max(runEnd, last);
|
|
9604
9624
|
if (entry.kind !== "agent" || entry.status === "running" || entry.status === "suspended") continue;
|
|
9625
|
+
if (entry.hostRejected === true) hostRejectedSpans += 1;
|
|
9605
9626
|
const role = entry.costAttribution?.role;
|
|
9606
9627
|
if (role === void 0) {
|
|
9607
9628
|
unclassifiedSpans += 1;
|
|
@@ -9649,7 +9670,8 @@ function criticalPathFromJournal(entries) {
|
|
|
9649
9670
|
workerSpans,
|
|
9650
9671
|
synthesisMs,
|
|
9651
9672
|
unclassifiedSpans,
|
|
9652
|
-
segments
|
|
9673
|
+
segments,
|
|
9674
|
+
hostRejectedSpans
|
|
9653
9675
|
};
|
|
9654
9676
|
const splitLegible = labelledSynthesis && !unlabelledSynthesis;
|
|
9655
9677
|
if (splitLegible) {
|
|
@@ -9856,7 +9878,8 @@ function synthesisCandidatesFromJournal(entries, priceUsd) {
|
|
|
9856
9878
|
name: failure.name,
|
|
9857
9879
|
reasons: Array.isArray(failure.reasons) ? failure.reasons.filter((reason) => typeof reason === "string") : []
|
|
9858
9880
|
})) : [],
|
|
9859
|
-
...span.label === void 0 ? {} : { spanLabel: span.label }
|
|
9881
|
+
...span.label === void 0 ? {} : { spanLabel: span.label },
|
|
9882
|
+
spanSeq: span.runningSeq
|
|
9860
9883
|
};
|
|
9861
9884
|
if (boundary.at !== void 0 && verdictAtMs !== void 0) candidate.windowMs = Math.max(0, verdictAtMs - boundary.at);
|
|
9862
9885
|
if (attributable.has(span)) {
|
|
@@ -9889,6 +9912,29 @@ function synthesisCandidatesFromJournal(entries, priceUsd) {
|
|
|
9889
9912
|
tailWires
|
|
9890
9913
|
};
|
|
9891
9914
|
}
|
|
9915
|
+
/**
|
|
9916
|
+
* The observed price of the run's LAST mechanical repair turn
|
|
9917
|
+
* (RV3802): the window of the candidate that FOLLOWED a 'repair'
|
|
9918
|
+
* verdict inside the same settled synthesize span, priced by the same
|
|
9919
|
+
* per-call fold every candidate window uses. This is the fallback the
|
|
9920
|
+
* repair round's mechanical money leg sizes itself from when the host
|
|
9921
|
+
* declared no estimate: by the time the round is admitted the initial
|
|
9922
|
+
* composition has settled, so a mechanical repair it performed is a
|
|
9923
|
+
* priced window in the journal. Fail closed under RV1209: no such
|
|
9924
|
+
* pairing, an unattributed span, or an unpriceable window all return
|
|
9925
|
+
* undefined (never a guessed number), and the caller treats undefined
|
|
9926
|
+
* as an inert zero-size leg.
|
|
9927
|
+
*/
|
|
9928
|
+
function lastMechanicalRepairCostUsd(entries, priceUsd) {
|
|
9929
|
+
const { candidates } = synthesisCandidatesFromJournal(entries, priceUsd);
|
|
9930
|
+
let observed;
|
|
9931
|
+
for (let index = 1; index < candidates.length; index += 1) {
|
|
9932
|
+
const previous = candidates[index - 1];
|
|
9933
|
+
const row = candidates[index];
|
|
9934
|
+
if (previous?.verdict === "repair" && row?.spanSeq !== void 0 && row.spanSeq === previous.spanSeq && row.costUsd !== void 0) observed = row.costUsd;
|
|
9935
|
+
}
|
|
9936
|
+
return observed;
|
|
9937
|
+
}
|
|
9892
9938
|
//#endregion
|
|
9893
9939
|
//#region src/stores/tool-calibration.ts
|
|
9894
9940
|
/**
|
|
@@ -14875,6 +14921,8 @@ var RunBudget = class {
|
|
|
14875
14921
|
committedReserveUsd: 0,
|
|
14876
14922
|
finalizeReserveUsd: 0,
|
|
14877
14923
|
synthesisReserveUsd: 0,
|
|
14924
|
+
convergenceReserveUsd: 0,
|
|
14925
|
+
repairReserveUsd: 0,
|
|
14878
14926
|
controller: new AbortController()
|
|
14879
14927
|
};
|
|
14880
14928
|
if (options.ceilingUsd !== void 0) root.ceilingUsd = options.ceilingUsd;
|
|
@@ -14925,6 +14973,8 @@ var RunBudget = class {
|
|
|
14925
14973
|
committedReserveUsd: 0,
|
|
14926
14974
|
finalizeReserveUsd: options.finalizeReserveUsd ?? 0,
|
|
14927
14975
|
synthesisReserveUsd: 0,
|
|
14976
|
+
convergenceReserveUsd: 0,
|
|
14977
|
+
repairReserveUsd: 0,
|
|
14928
14978
|
parentScope,
|
|
14929
14979
|
controller: new AbortController()
|
|
14930
14980
|
};
|
|
@@ -15025,7 +15075,9 @@ var RunBudget = class {
|
|
|
15025
15075
|
spentUsd: account.spentUsd,
|
|
15026
15076
|
committedReserveUsd: account.committedReserveUsd,
|
|
15027
15077
|
finalizeReserveUsd: account.finalizeReserveUsd,
|
|
15028
|
-
synthesisReserveUsd: account.synthesisReserveUsd
|
|
15078
|
+
synthesisReserveUsd: account.synthesisReserveUsd,
|
|
15079
|
+
convergenceReserveUsd: account.convergenceReserveUsd,
|
|
15080
|
+
repairReserveUsd: account.repairReserveUsd
|
|
15029
15081
|
};
|
|
15030
15082
|
if (account.ceilingUsd !== void 0) view.ceilingUsd = account.ceilingUsd;
|
|
15031
15083
|
if (account.parentScope !== void 0) view.parentScope = account.parentScope;
|
|
@@ -15039,7 +15091,7 @@ var RunBudget = class {
|
|
|
15039
15091
|
remainderOf(scope) {
|
|
15040
15092
|
const account = this.accounts.get(scope);
|
|
15041
15093
|
if (account?.ceilingUsd === void 0) return;
|
|
15042
|
-
return Math.max(0, account.ceilingUsd - account.spentUsd - account.committedReserveUsd - account.finalizeReserveUsd - account.synthesisReserveUsd);
|
|
15094
|
+
return Math.max(0, account.ceilingUsd - account.spentUsd - account.committedReserveUsd - account.finalizeReserveUsd - account.synthesisReserveUsd - account.convergenceReserveUsd - account.repairReserveUsd);
|
|
15043
15095
|
}
|
|
15044
15096
|
/**
|
|
15045
15097
|
* The tightest allowance headroom on the chain of `scope`: the minimum
|
|
@@ -15119,15 +15171,17 @@ var RunBudget = class {
|
|
|
15119
15171
|
}
|
|
15120
15172
|
for (const account of this.chainOf(accountScope)) {
|
|
15121
15173
|
if (account.ceilingUsd === void 0) continue;
|
|
15122
|
-
const committed = account.spentUsd + account.committedReserveUsd + account.finalizeReserveUsd + account.synthesisReserveUsd;
|
|
15174
|
+
const committed = account.spentUsd + account.committedReserveUsd + account.finalizeReserveUsd + account.synthesisReserveUsd + account.convergenceReserveUsd + account.repairReserveUsd;
|
|
15123
15175
|
if (committed >= account.ceilingUsd || committed + reserveUsd > account.ceilingUsd) {
|
|
15124
15176
|
if (account.scope === "run") this.exhaustedInternal = true;
|
|
15125
|
-
throw new BudgetExhaustedError(`budget ceiling reached on account '${account.scope}': spent ${account.spentUsd.toFixed(4)} USD plus committed reserves ${(account.committedReserveUsd + account.finalizeReserveUsd).toFixed(4)} USD ` + (account.synthesisReserveUsd > 0 ? `plus the held synthesis reserve ${account.synthesisReserveUsd.toFixed(4)} USD ` : "") + `plus the proposed reserve ${reserveUsd.toFixed(4)} USD does not fit the ceiling ${account.ceilingUsd.toFixed(4)} USD`, { data: {
|
|
15177
|
+
throw new BudgetExhaustedError(`budget ceiling reached on account '${account.scope}': spent ${account.spentUsd.toFixed(4)} USD plus committed reserves ${(account.committedReserveUsd + account.finalizeReserveUsd).toFixed(4)} USD ` + (account.synthesisReserveUsd > 0 ? `plus the held synthesis reserve ${account.synthesisReserveUsd.toFixed(4)} USD ` : "") + (account.convergenceReserveUsd > 0 ? `plus the held convergence reserve ${account.convergenceReserveUsd.toFixed(4)} USD ` : "") + (account.repairReserveUsd > 0 ? `plus the held repair reserve ${account.repairReserveUsd.toFixed(4)} USD ` : "") + `plus the proposed reserve ${reserveUsd.toFixed(4)} USD does not fit the ceiling ${account.ceilingUsd.toFixed(4)} USD`, { data: {
|
|
15126
15178
|
account: account.scope,
|
|
15127
15179
|
spentUsd: account.spentUsd,
|
|
15128
15180
|
committedReserveUsd: account.committedReserveUsd,
|
|
15129
15181
|
finalizeReserveUsd: account.finalizeReserveUsd,
|
|
15130
15182
|
synthesisReserveUsd: account.synthesisReserveUsd,
|
|
15183
|
+
convergenceReserveUsd: account.convergenceReserveUsd,
|
|
15184
|
+
repairReserveUsd: account.repairReserveUsd,
|
|
15131
15185
|
proposedReserveUsd: reserveUsd,
|
|
15132
15186
|
ceilingUsd: account.ceilingUsd
|
|
15133
15187
|
} });
|
|
@@ -15219,6 +15273,74 @@ var RunBudget = class {
|
|
|
15219
15273
|
account.synthesisReserveUsd = 0;
|
|
15220
15274
|
this.emitUpdate();
|
|
15221
15275
|
}
|
|
15276
|
+
/**
|
|
15277
|
+
* Registers the repair round's verdict reserve (RV3701, the third
|
|
15278
|
+
* comparison experiment's arc): absolute dollars held on the
|
|
15279
|
+
* orchestrator account AND the run root for the verdict pass (the
|
|
15280
|
+
* round's second judge invocation) that must follow a DISPATCHED
|
|
15281
|
+
* claim repair round. The third comparison run
|
|
15282
|
+
* proved the round's two invocation tail is only as convergent as
|
|
15283
|
+
* the money left when the candidate materializes; with the verdict
|
|
15284
|
+
* money held from the moment the round is admitted, the round's own
|
|
15285
|
+
* repair turns (the layer-2b clamp prices output from a remainder
|
|
15286
|
+
* this hold shrinks) and any concurrent admission (the hold joins
|
|
15287
|
+
* the projected admission sum) cannot eat it, so a round the budget
|
|
15288
|
+
* can only START is refused before any wire call instead of being
|
|
15289
|
+
* paid for and left unjudgeable. Exactly the synthesis reserve
|
|
15290
|
+
* mechanics: released to the invocation it was held FOR (the
|
|
15291
|
+
* verdict pass dispatch), never joined to the severing check.
|
|
15292
|
+
* Idempotent per account: registering again adjusts the root by the
|
|
15293
|
+
* delta.
|
|
15294
|
+
*/
|
|
15295
|
+
commitConvergenceReserve(scope, reserveUsd) {
|
|
15296
|
+
const account = this.accounts.get(scope);
|
|
15297
|
+
if (account === void 0) throw new ConfigError(`unknown budget account '${scope}' for the convergence reserve`);
|
|
15298
|
+
const previous = account.convergenceReserveUsd;
|
|
15299
|
+
account.convergenceReserveUsd = reserveUsd;
|
|
15300
|
+
if (account.scope !== "run") this.root.convergenceReserveUsd = Math.max(0, this.root.convergenceReserveUsd + reserveUsd - previous);
|
|
15301
|
+
this.emitUpdate();
|
|
15302
|
+
}
|
|
15303
|
+
/** The verdict pass dispatch consumes its reserve; see commitConvergenceReserve. */
|
|
15304
|
+
releaseConvergenceReserve(scope) {
|
|
15305
|
+
const account = this.accounts.get(scope);
|
|
15306
|
+
if (account === void 0 || account.convergenceReserveUsd === 0) return;
|
|
15307
|
+
if (account.scope !== "run") this.root.convergenceReserveUsd = Math.max(0, this.root.convergenceReserveUsd - account.convergenceReserveUsd);
|
|
15308
|
+
account.convergenceReserveUsd = 0;
|
|
15309
|
+
this.emitUpdate();
|
|
15310
|
+
}
|
|
15311
|
+
/**
|
|
15312
|
+
* Registers the repair round's MECHANICAL leg (RV3802), the money
|
|
15313
|
+
* twin of the RV3602 per-invocation pool: the round's finish
|
|
15314
|
+
* contract can grant one bounded mechanical repair turn, and the
|
|
15315
|
+
* third comparison run's round entered exactly that turn's price
|
|
15316
|
+
* short of certainty (the repair existed by pool and by contract,
|
|
15317
|
+
* but nothing guaranteed the money would still be there when the
|
|
15318
|
+
* candidate materialized). Held beside the verdict leg from the
|
|
15319
|
+
* moment the round is admitted; released EARLY, to the round's own
|
|
15320
|
+
* finish loop, at its first journaled verdict (a 'repair' verdict is
|
|
15321
|
+
* about to spend the freed money on the granted turn, an 'accepted'
|
|
15322
|
+
* one never needed it), where the verdict leg lives until the judge
|
|
15323
|
+
* dispatch. Exactly the convergence reserve mechanics otherwise:
|
|
15324
|
+
* joins the projected admission sum and both remainders, named in
|
|
15325
|
+
* the refusal clause, never joined to the severing check, idempotent
|
|
15326
|
+
* per account with the root adjusted by the delta.
|
|
15327
|
+
*/
|
|
15328
|
+
commitRepairReserve(scope, reserveUsd) {
|
|
15329
|
+
const account = this.accounts.get(scope);
|
|
15330
|
+
if (account === void 0) throw new ConfigError(`unknown budget account '${scope}' for the repair reserve`);
|
|
15331
|
+
const previous = account.repairReserveUsd;
|
|
15332
|
+
account.repairReserveUsd = reserveUsd;
|
|
15333
|
+
if (account.scope !== "run") this.root.repairReserveUsd = Math.max(0, this.root.repairReserveUsd + reserveUsd - previous);
|
|
15334
|
+
this.emitUpdate();
|
|
15335
|
+
}
|
|
15336
|
+
/** The round's finish loop consumes its leg; see commitRepairReserve. */
|
|
15337
|
+
releaseRepairReserve(scope) {
|
|
15338
|
+
const account = this.accounts.get(scope);
|
|
15339
|
+
if (account === void 0 || account.repairReserveUsd === 0) return;
|
|
15340
|
+
if (account.scope !== "run") this.root.repairReserveUsd = Math.max(0, this.root.repairReserveUsd - account.repairReserveUsd);
|
|
15341
|
+
account.repairReserveUsd = 0;
|
|
15342
|
+
this.emitUpdate();
|
|
15343
|
+
}
|
|
15222
15344
|
/** The reserve is replaced by real spend when the spawn settles. */
|
|
15223
15345
|
releaseReserve(reserveUsd, accountScope = "run") {
|
|
15224
15346
|
for (const account of this.chainOf(accountScope)) account.committedReserveUsd = Math.max(0, account.committedReserveUsd - reserveUsd);
|
|
@@ -15426,7 +15548,7 @@ var RunBudget = class {
|
|
|
15426
15548
|
let remaining;
|
|
15427
15549
|
for (const account of this.chainOf(accountScope)) {
|
|
15428
15550
|
if (account.ceilingUsd === void 0) continue;
|
|
15429
|
-
const headroom = account.ceilingUsd - account.spentUsd - account.synthesisReserveUsd;
|
|
15551
|
+
const headroom = account.ceilingUsd - account.spentUsd - account.synthesisReserveUsd - account.convergenceReserveUsd - account.repairReserveUsd;
|
|
15430
15552
|
remaining = remaining === void 0 ? headroom : Math.min(remaining, headroom);
|
|
15431
15553
|
}
|
|
15432
15554
|
return remaining === void 0 ? void 0 : Math.max(0, remaining);
|
|
@@ -15669,6 +15791,27 @@ function foldBuckets(source) {
|
|
|
15669
15791
|
return folded;
|
|
15670
15792
|
}
|
|
15671
15793
|
/**
|
|
15794
|
+
* The scope key rule of the byScope rollup (RV3805). The root's OWN
|
|
15795
|
+
* scope is the empty string BY CONSTRUCTION: present data whose string
|
|
15796
|
+
* happens to be empty, not an absence, so it folds under the
|
|
15797
|
+
* addressable name 'root' instead of the RV3604 'unknown' fallback,
|
|
15798
|
+
* which stays reserved for a scope that is truly missing. Children
|
|
15799
|
+
* keep their scope strings verbatim. One rule for both builders, so
|
|
15800
|
+
* the live report and the journal fold cannot disagree on the key.
|
|
15801
|
+
*/
|
|
15802
|
+
function scopeBucket(scope) {
|
|
15803
|
+
return scope === void 0 ? "unknown" : scope === "" ? "root" : scope;
|
|
15804
|
+
}
|
|
15805
|
+
/** {@link scopeBucket} over a whole live map, merging folded keys. */
|
|
15806
|
+
function foldScopeBuckets(source) {
|
|
15807
|
+
const folded = {};
|
|
15808
|
+
for (const [key, usd] of source) {
|
|
15809
|
+
const bucket = scopeBucket(key);
|
|
15810
|
+
folded[bucket] = (folded[bucket] ?? 0) + usd;
|
|
15811
|
+
}
|
|
15812
|
+
return folded;
|
|
15813
|
+
}
|
|
15814
|
+
/**
|
|
15672
15815
|
* Folds the per-run attribution buckets into the normative CostReport.
|
|
15673
15816
|
* Live attribution buckets never see abandoned subtrees, so a host
|
|
15674
15817
|
* that tracked abandoned spend itself passes it as `abandoned`;
|
|
@@ -15699,6 +15842,7 @@ function buildCostReport(attribution, totalUsd, abandoned = {
|
|
|
15699
15842
|
byPhase: foldBuckets(attribution.byPhase),
|
|
15700
15843
|
byAgentType: foldBuckets(attribution.byAgentType),
|
|
15701
15844
|
byRole,
|
|
15845
|
+
byScope: foldScopeBuckets(attribution.byScope),
|
|
15702
15846
|
orchestrator: {
|
|
15703
15847
|
...orchestrator,
|
|
15704
15848
|
share: orchestrator.spentUsd / Math.max(totalUsd, .01)
|
|
@@ -15724,6 +15868,7 @@ function costReportFromJournal(entries, priceUsd) {
|
|
|
15724
15868
|
const byModel = {};
|
|
15725
15869
|
const byPhase = {};
|
|
15726
15870
|
const byAgentType = {};
|
|
15871
|
+
const byScope = {};
|
|
15727
15872
|
const byRole = emptyByRole();
|
|
15728
15873
|
const unpriced = [];
|
|
15729
15874
|
let totalUsd = 0;
|
|
@@ -15766,6 +15911,8 @@ function costReportFromJournal(entries, priceUsd) {
|
|
|
15766
15911
|
byPhase[phase] = (byPhase[phase] ?? 0) + priced.usd;
|
|
15767
15912
|
const agentType = attributionBucket(facts?.agentType);
|
|
15768
15913
|
byAgentType[agentType] = (byAgentType[agentType] ?? 0) + priced.usd;
|
|
15914
|
+
const scope = scopeBucket(entry.scope);
|
|
15915
|
+
byScope[scope] = (byScope[scope] ?? 0) + priced.usd;
|
|
15769
15916
|
const primaryRole = facts?.role ?? "loop";
|
|
15770
15917
|
for (const unit of priced.units) byRole[unit.role ?? primaryRole] += unit.usd;
|
|
15771
15918
|
if (facts?.budgetAccount !== void 0 && isOrchestratorAccount(facts.budgetAccount)) {
|
|
@@ -15787,6 +15934,7 @@ function costReportFromJournal(entries, priceUsd) {
|
|
|
15787
15934
|
byPhase,
|
|
15788
15935
|
byAgentType,
|
|
15789
15936
|
byRole,
|
|
15937
|
+
byScope,
|
|
15790
15938
|
orchestrator: {
|
|
15791
15939
|
spentUsd: orchestratorSpentUsd,
|
|
15792
15940
|
share: orchestratorSpentUsd / Math.max(totalUsd, .01),
|
|
@@ -16865,6 +17013,33 @@ function persistedTerminalEnvelope(input) {
|
|
|
16865
17013
|
//#endregion
|
|
16866
17014
|
//#region src/engine/pricing-snapshot.ts
|
|
16867
17015
|
/**
|
|
17016
|
+
* The applied-pricing snapshot (RV407, the eighth-experiment review).
|
|
17017
|
+
* `invoiceFromJournal` and `costReportFromJournal` price at fold time
|
|
17018
|
+
* from the table the caller passes, so a live price-table update used
|
|
17019
|
+
* to silently re-price HISTORY: the same journal folded to different
|
|
17020
|
+
* invoices before and after the change. When `createEngine({ pricing })`
|
|
17021
|
+
* is configured, the settling segment now pins what it actually
|
|
17022
|
+
* applied: the resolved pricing row of every model the journal used
|
|
17023
|
+
* (table rows plus the caps-fallback rows of models the table misses),
|
|
17024
|
+
* and the table's version, additively inside the existing run-settle
|
|
17025
|
+
* decision value (the `outputHash` precedent; no journal shape change).
|
|
17026
|
+
* The gate is deliberate: caps-fallback pricing arrives ambiently from
|
|
17027
|
+
* adapters, and a setting the user never enabled must not change the
|
|
17028
|
+
* journal, so table-less runs settle byte for byte as before.
|
|
17029
|
+
* `journalPricingSnapshot` reads the pin back and
|
|
17030
|
+
* rebuilds a `priceUsd` from the pinned rows, so a repeated fold after
|
|
17031
|
+
* the live table changed reproduces the original numbers exactly.
|
|
17032
|
+
*
|
|
17033
|
+
* The snapshot governs REPORTING folds (the CLI invoice and inspect
|
|
17034
|
+
* cost views, and any host that opts in by passing the rebuilt
|
|
17035
|
+
* priceUsd; since RV611 those consumers pass `composedPriceUsd`, the
|
|
17036
|
+
* same pin-plus-current-table composition the engine's outcome mirror
|
|
17037
|
+
* applies, so a stored fold and the settled outcome can never
|
|
17038
|
+
* disagree). The engine's own live pricing, budget admission, and the
|
|
17039
|
+
* journaled spend debits are untouched: they were always priced at
|
|
17040
|
+
* write time and never re-priced by a fold.
|
|
17041
|
+
*/
|
|
17042
|
+
/**
|
|
16868
17043
|
* A pinnable row: every present rate is a finite non-negative number.
|
|
16869
17044
|
* The fold already treats a broken rate as unpriced (a NaN or negative
|
|
16870
17045
|
* price never poisons the CostReport), so the pin mirrors exactly that
|
|
@@ -16902,6 +17077,42 @@ function snapshotJournalPricing(entries, pricingOf) {
|
|
|
16902
17077
|
}
|
|
16903
17078
|
return rows.length === 0 ? void 0 : rows;
|
|
16904
17079
|
}
|
|
17080
|
+
/**
|
|
17081
|
+
* The pin's content hash (RV3703): sha256 over the canonical JSON of
|
|
17082
|
+
* the rows, so the derivation is byte-stable across folds, engines and
|
|
17083
|
+
* platforms; JCS fixes the key order, and the row order is the pin's
|
|
17084
|
+
* own (sorted at write, preserved at read).
|
|
17085
|
+
*/
|
|
17086
|
+
function rowsHashOf(rows) {
|
|
17087
|
+
return createHash("sha256").update(jcsSerialize(rows), "utf8").digest("hex");
|
|
17088
|
+
}
|
|
17089
|
+
/**
|
|
17090
|
+
* The freshness range of a pin's dated rows (RV3703): oldest and
|
|
17091
|
+
* newest parsable `ratesVerifiedAt`, original strings preserved.
|
|
17092
|
+
* Undefined when no row carries a parsable date.
|
|
17093
|
+
*/
|
|
17094
|
+
function ratesVerifiedRangeOf(rows) {
|
|
17095
|
+
let oldest;
|
|
17096
|
+
let newest;
|
|
17097
|
+
for (const row of rows) {
|
|
17098
|
+
const raw = row.rates.ratesVerifiedAt;
|
|
17099
|
+
if (raw === void 0) continue;
|
|
17100
|
+
const at = Date.parse(raw);
|
|
17101
|
+
if (!Number.isFinite(at)) continue;
|
|
17102
|
+
if (oldest === void 0 || at < oldest.at) oldest = {
|
|
17103
|
+
at,
|
|
17104
|
+
raw
|
|
17105
|
+
};
|
|
17106
|
+
if (newest === void 0 || at > newest.at) newest = {
|
|
17107
|
+
at,
|
|
17108
|
+
raw
|
|
17109
|
+
};
|
|
17110
|
+
}
|
|
17111
|
+
return oldest === void 0 || newest === void 0 ? void 0 : {
|
|
17112
|
+
oldest: oldest.raw,
|
|
17113
|
+
newest: newest.raw
|
|
17114
|
+
};
|
|
17115
|
+
}
|
|
16905
17116
|
function pinnedRows(value) {
|
|
16906
17117
|
const candidate = value?.pricing;
|
|
16907
17118
|
if (!Array.isArray(candidate) || candidate.length === 0) return;
|
|
@@ -16953,16 +17164,24 @@ function journalPricingSnapshot(entries) {
|
|
|
16953
17164
|
const rates = ratesFor(servedBy, seq);
|
|
16954
17165
|
return rates === void 0 ? void 0 : priceUsdOf(rates, usage);
|
|
16955
17166
|
};
|
|
17167
|
+
const lastRange = ratesVerifiedRangeOf(last.rows);
|
|
16956
17168
|
return {
|
|
16957
17169
|
...last.pricingVersion === void 0 ? {} : { pricingVersion: last.pricingVersion },
|
|
16958
17170
|
rows: last.rows,
|
|
17171
|
+
rowsHash: rowsHashOf(last.rows),
|
|
17172
|
+
...lastRange === void 0 ? {} : { ratesVerifiedAt: lastRange },
|
|
16959
17173
|
pinnedThroughSeq,
|
|
16960
|
-
segments: pins.map((pin, index) =>
|
|
16961
|
-
|
|
16962
|
-
|
|
16963
|
-
|
|
16964
|
-
|
|
16965
|
-
|
|
17174
|
+
segments: pins.map((pin, index) => {
|
|
17175
|
+
const range = ratesVerifiedRangeOf(pin.rows);
|
|
17176
|
+
return {
|
|
17177
|
+
fromSeq: index === 0 ? 0 : pins[index - 1]?.seq ?? 0,
|
|
17178
|
+
settleSeq: pin.seq,
|
|
17179
|
+
...pin.pricingVersion === void 0 ? {} : { pricingVersion: pin.pricingVersion },
|
|
17180
|
+
rows: pin.rows,
|
|
17181
|
+
rowsHash: rowsHashOf(pin.rows),
|
|
17182
|
+
...range === void 0 ? {} : { ratesVerifiedAt: range }
|
|
17183
|
+
};
|
|
17184
|
+
}),
|
|
16966
17185
|
priceUsd,
|
|
16967
17186
|
composedPriceUsd: (current) => (servedBy, usage, seq) => seq !== void 0 && seq < pinnedThroughSeq ? priceUsd(servedBy, usage, seq) ?? current(servedBy, usage) : current(servedBy, usage)
|
|
16968
17187
|
};
|
|
@@ -18810,6 +19029,7 @@ function createCtx(internals, rootWorkflow) {
|
|
|
18810
19029
|
costBasis: replayBasis,
|
|
18811
19030
|
entryRef: terminal?.seq ?? matched.running.seq,
|
|
18812
19031
|
...terminal?.usageApprox === true ? { usageApprox: true } : {},
|
|
19032
|
+
...terminal?.hostRejected === true ? { hostRejected: true } : {},
|
|
18813
19033
|
...result.exploration === void 0 ? {} : { exploration: result.exploration },
|
|
18814
19034
|
...result.toolBudget === void 0 ? {} : { toolBudget: result.toolBudget }
|
|
18815
19035
|
}, spanId, true);
|
|
@@ -18820,6 +19040,7 @@ function createCtx(internals, rootWorkflow) {
|
|
|
18820
19040
|
});
|
|
18821
19041
|
bump(internals.cost.byPhase, state.phase ?? "", costUsd);
|
|
18822
19042
|
bump(internals.cost.byAgentType, agentType, costUsd);
|
|
19043
|
+
bump(internals.cost.byScope, state.scope, costUsd);
|
|
18823
19044
|
internals.cost.byRole.set(primaryRole, (internals.cost.byRole.get(primaryRole) ?? 0) + costUsd);
|
|
18824
19045
|
if (result.status === "escalated" && result.escalation !== void 0) {
|
|
18825
19046
|
if (internals.replayer.snapshot().find((entry) => entry.kind === "decision" && entry.value?.targetRef === matched.running.seq) === void 0 && opts.result !== "full" && internals.onEscalation !== void 0) {
|
|
@@ -19538,6 +19759,8 @@ function createCtx(internals, rootWorkflow) {
|
|
|
19538
19759
|
}
|
|
19539
19760
|
};
|
|
19540
19761
|
}
|
|
19762
|
+
const settleSignal = state.signal ?? internals.runSignal;
|
|
19763
|
+
if (result.status !== "ok" && settleSignal?.aborted === true && settleSignal.reason === "rulvar:finish-validation") terminalPatch.hostRejected = true;
|
|
19541
19764
|
if (checkpointWritten) terminalPatch.checkpointRef = ckptRef;
|
|
19542
19765
|
const terminal = await internals.replayer.appendTerminal(running.seq, terminalPatch);
|
|
19543
19766
|
internals.events.emit({
|
|
@@ -19551,6 +19774,7 @@ function createCtx(internals, rootWorkflow) {
|
|
|
19551
19774
|
entryRef: terminal.seq,
|
|
19552
19775
|
...resultUsageApprox ? { usageApprox: true } : {},
|
|
19553
19776
|
...result.transportRetries !== void 0 && result.transportRetries > 0 ? { retryCount: result.transportRetries } : {},
|
|
19777
|
+
...terminalPatch.hostRejected === true ? { hostRejected: true } : {},
|
|
19554
19778
|
...result.quotaDenials === void 0 ? {} : { quotaDenials: result.quotaDenials },
|
|
19555
19779
|
...result.exploration === void 0 ? {} : { exploration: result.exploration },
|
|
19556
19780
|
...result.toolBudget === void 0 ? {} : { toolBudget: result.toolBudget }
|
|
@@ -19592,6 +19816,7 @@ function createCtx(internals, rootWorkflow) {
|
|
|
19592
19816
|
}
|
|
19593
19817
|
bump(internals.cost.byPhase, state.phase ?? "", usd);
|
|
19594
19818
|
bump(internals.cost.byAgentType, agentType, usd);
|
|
19819
|
+
bump(internals.cost.byScope, state.scope, usd);
|
|
19595
19820
|
if (result.error?.kind === "budget" || internals.budget.exhausted && result.status !== "ok") {
|
|
19596
19821
|
if (!internals.budget.exhausted && result.errorMessage !== void 0 && result.errorMessage.startsWith("in flight exposure cap reached")) throw new BudgetExhaustedError(result.errorMessage, { data: {
|
|
19597
19822
|
scope: state.scope,
|
|
@@ -21030,6 +21255,50 @@ const MAX_LISTED_CITATIONS = 20;
|
|
|
21030
21255
|
const MAX_NAMED_OFFENDING_SENTENCES = 5;
|
|
21031
21256
|
const MAX_OFFENDING_SENTENCE_CHARS = 240;
|
|
21032
21257
|
/**
|
|
21258
|
+
* The most offending sentences a verdict will hint (RV3801). A
|
|
21259
|
+
* document broken in more places than this needs a model repair
|
|
21260
|
+
* anyway, and an unbounded hint set would carry unbounded sentence
|
|
21261
|
+
* bytes through the live verdict.
|
|
21262
|
+
*/
|
|
21263
|
+
const MAX_REPAIR_HINTS = 20;
|
|
21264
|
+
/**
|
|
21265
|
+
* The deterministic edit behind the `insert-run-id` mechanism
|
|
21266
|
+
* (RV3801): the id lands INSIDE the sentence, before its trailing
|
|
21267
|
+
* terminator run (a `.`, `!`, or `?` with any closing quotes,
|
|
21268
|
+
* brackets, or markdown emphasis after it), or at the very end when
|
|
21269
|
+
* the sentence carries no terminator. Inside matters: appended AFTER
|
|
21270
|
+
* the terminator the id would belong to the NEXT sentence under the
|
|
21271
|
+
* shared `sentencesOf` segmentation and the re-validation would fail
|
|
21272
|
+
* the same sentence again. Exported so tests and hosts can reproduce
|
|
21273
|
+
* the loop's exact bytes.
|
|
21274
|
+
*/
|
|
21275
|
+
function insertRunIdIntoSentence(sentence, insert) {
|
|
21276
|
+
const at = /[.!?]['")\]*_`]*\s*$/u.exec(sentence)?.index ?? sentence.length;
|
|
21277
|
+
return `${sentence.slice(0, at)} (run ${insert})${sentence.slice(at)}`;
|
|
21278
|
+
}
|
|
21279
|
+
/**
|
|
21280
|
+
* Applies `insert-run-id` repair hints to a judged text (RV3801): each
|
|
21281
|
+
* `[start, end)` window is replaced by
|
|
21282
|
+
* {@link insertRunIdIntoSentence}(window, insert), right to left so
|
|
21283
|
+
* earlier offsets stay valid, every other byte identical. Fail closed:
|
|
21284
|
+
* `undefined` (never a partial patch) when the set is empty, any
|
|
21285
|
+
* window is out of bounds or empty, or two windows overlap; the caller
|
|
21286
|
+
* treats a refused patch exactly like an absent one and proceeds to
|
|
21287
|
+
* the model repair pool.
|
|
21288
|
+
*/
|
|
21289
|
+
function applyFinishRepairHints(text, hints) {
|
|
21290
|
+
if (hints.length === 0) return;
|
|
21291
|
+
const ordered = [...hints].sort((a, b) => a.start - b.start);
|
|
21292
|
+
let previousEnd = 0;
|
|
21293
|
+
for (const hint of ordered) {
|
|
21294
|
+
if (!Number.isInteger(hint.start) || !Number.isInteger(hint.end) || hint.start < previousEnd || hint.end <= hint.start || hint.end > text.length) return;
|
|
21295
|
+
previousEnd = hint.end;
|
|
21296
|
+
}
|
|
21297
|
+
let patched = text;
|
|
21298
|
+
for (const hint of [...ordered].reverse()) patched = patched.slice(0, hint.start) + insertRunIdIntoSentence(patched.slice(hint.start, hint.end), hint.insert) + patched.slice(hint.end);
|
|
21299
|
+
return patched;
|
|
21300
|
+
}
|
|
21301
|
+
/**
|
|
21033
21302
|
* The shortest run id {@link evidenceGradeValidator} will accept as an
|
|
21034
21303
|
* artifact (RV2501). The floor mirrors the id half of
|
|
21035
21304
|
* {@link DEFAULT_ARTIFACT_PATTERN}: a two character id would satisfy
|
|
@@ -21341,6 +21610,13 @@ const DEFAULT_ARTIFACT_PATTERN = "(?:run[ -]?[0-9A-HJKMNP-TV-Z]{6,26}|[\\w./-]+\
|
|
|
21341
21610
|
* the repair instruction is executable rather than aspirational. An id
|
|
21342
21611
|
* shorter than `MIN_RUN_ID_ARTIFACT_CHARS` (six) is ignored, and
|
|
21343
21612
|
* without an id the verdict is byte identical to the historical one.
|
|
21613
|
+
*
|
|
21614
|
+
* With the id in hand the failure also carries {@link FinishRepairHint}
|
|
21615
|
+
* rows (RV3801), one per offending sentence, so the finish loop can
|
|
21616
|
+
* perform the verdict's own prescription host side without spending a
|
|
21617
|
+
* provider wire; the reasons stay byte identical either way, and the
|
|
21618
|
+
* hints are bounded (at most `MAX_REPAIR_HINTS` offenders) and fail
|
|
21619
|
+
* closed (an id whose bytes could split a sentence is never hinted).
|
|
21344
21620
|
* Default name 'evidence-grade'.
|
|
21345
21621
|
*/
|
|
21346
21622
|
function evidenceGradeValidator(options) {
|
|
@@ -21360,18 +21636,32 @@ function evidenceGradeValidator(options) {
|
|
|
21360
21636
|
const unsupported = [];
|
|
21361
21637
|
const offenders = [];
|
|
21362
21638
|
const runId = typeof input.runId === "string" && input.runId.trim().length >= MIN_RUN_ID_ARTIFACT_CHARS ? input.runId.trim() : void 0;
|
|
21639
|
+
let cursor = 0;
|
|
21363
21640
|
for (const sentence of sentencesOf(input.text)) {
|
|
21641
|
+
const start = input.text.indexOf(sentence, cursor);
|
|
21642
|
+
cursor = start + sentence.length;
|
|
21364
21643
|
const haystack = sentence.toLowerCase();
|
|
21365
21644
|
const found = lowered.filter((phrase) => haystack.includes(phrase));
|
|
21366
21645
|
if (found.length === 0 || new RegExp(artifactPattern, "").test(sentence) || runId !== void 0 && containsIdentifier(sentence, runId)) continue;
|
|
21367
|
-
offenders.push(
|
|
21646
|
+
offenders.push({
|
|
21647
|
+
sentence,
|
|
21648
|
+
start,
|
|
21649
|
+
end: start + sentence.length
|
|
21650
|
+
});
|
|
21368
21651
|
for (const phrase of found) if (!unsupported.includes(phrase)) unsupported.push(phrase);
|
|
21369
21652
|
}
|
|
21370
21653
|
if (unsupported.length === 0) return ok;
|
|
21371
|
-
const named = offenders.slice(0, MAX_NAMED_OFFENDING_SENTENCES).map((sentence) => {
|
|
21654
|
+
const named = offenders.slice(0, MAX_NAMED_OFFENDING_SENTENCES).map(({ sentence }) => {
|
|
21372
21655
|
const flat = sentence.replace(/\s+/gu, " ").trim();
|
|
21373
21656
|
return `offending sentence: "${flat.length <= MAX_OFFENDING_SENTENCE_CHARS ? flat : `${flat.slice(0, MAX_OFFENDING_SENTENCE_CHARS)}...`}"`;
|
|
21374
21657
|
});
|
|
21658
|
+
const hints = runId !== void 0 && offenders.length <= MAX_REPAIR_HINTS && !/[.!?]\s|[\r\n]/u.test(runId) && offenders.every((offender) => offender.start >= 0) ? offenders.map(({ sentence, start, end }) => ({
|
|
21659
|
+
mechanism: "insert-run-id",
|
|
21660
|
+
start,
|
|
21661
|
+
end,
|
|
21662
|
+
sentence,
|
|
21663
|
+
insert: runId
|
|
21664
|
+
})) : void 0;
|
|
21375
21665
|
const overflow = offenders.length - named.length;
|
|
21376
21666
|
return {
|
|
21377
21667
|
ok: false,
|
|
@@ -21379,7 +21669,8 @@ function evidenceGradeValidator(options) {
|
|
|
21379
21669
|
runId === void 0 ? `evidence-grade claims cite no run or repro artifact in their own sentence: ${listCitations(unsupported)}; give each such claim a file:line citation in its own sentence, or state its run id in a SEPARATE sentence carrying no source citation (a run id written beside a path:line citation is not in the cited window and trades this failure for a cited-value one)` : `evidence-grade claims cite no run or repro artifact in their own sentence: ${listCitations(unsupported)}; write this run's id ${runId} inside each such sentence, or give the claim a file:line citation instead (the id may share a sentence with a source citation: cited-value reads a run id as identity, not as a value asserted about the cited line)`,
|
|
21380
21670
|
...named,
|
|
21381
21671
|
...overflow > 0 ? [`and ${String(overflow)} more offending sentences`] : []
|
|
21382
|
-
]
|
|
21672
|
+
],
|
|
21673
|
+
...hints === void 0 ? {} : { repairHints: hints }
|
|
21383
21674
|
};
|
|
21384
21675
|
}
|
|
21385
21676
|
};
|
|
@@ -22627,6 +22918,72 @@ function selfTestFinishValidation(options) {
|
|
|
22627
22918
|
/** How many rejected finishes are repaired by default: the plan's repair once. */
|
|
22628
22919
|
const DEFAULT_FINISH_MAX_REPAIRS = 1;
|
|
22629
22920
|
/**
|
|
22921
|
+
* The most hinted edits one deterministic repair attempt will apply
|
|
22922
|
+
* (RV3801): a validator caps its own hints well below this, so the
|
|
22923
|
+
* bound only guards against a custom validator flooding the journal
|
|
22924
|
+
* with patch rows; past it the candidate goes to the model pool.
|
|
22925
|
+
*/
|
|
22926
|
+
const MAX_DETERMINISTIC_PATCHES = 64;
|
|
22927
|
+
/**
|
|
22928
|
+
* Plans the sectional claim repair round (RV3803): which H2 sections
|
|
22929
|
+
* of the accepted pre-repair document own the judged findings. The
|
|
22930
|
+
* third comparison run's round regenerated the WHOLE 43k character
|
|
22931
|
+
* document to consume findings that lived in a handful of sentences,
|
|
22932
|
+
* and the tail after fan-in was 80.1 percent of the run's wall. Each
|
|
22933
|
+
* finding's `draftExcerpt` (whitespace collapsed by the pairing fold)
|
|
22934
|
+
* is located in the document through a collapse-aware scan, and its
|
|
22935
|
+
* owning section is the nearest H2 line above it. Fail closed to the
|
|
22936
|
+
* FULL regeneration (undefined, the historical round byte for byte)
|
|
22937
|
+
* whenever the plan cannot be exact: no excerpts, a document without
|
|
22938
|
+
* H2 headings, duplicated markers (the splice grammar needs unique
|
|
22939
|
+
* lines), or any excerpt the scan cannot locate.
|
|
22940
|
+
*/
|
|
22941
|
+
function sectionalRoundPlan(document, excerpts) {
|
|
22942
|
+
if (excerpts.length === 0) return;
|
|
22943
|
+
const markers = [];
|
|
22944
|
+
let offset = 0;
|
|
22945
|
+
for (const line of document.split("\n")) {
|
|
22946
|
+
if (line.trim().startsWith("## ")) markers.push({
|
|
22947
|
+
marker: line.trim(),
|
|
22948
|
+
start: offset
|
|
22949
|
+
});
|
|
22950
|
+
offset += line.length + 1;
|
|
22951
|
+
}
|
|
22952
|
+
if (markers.length === 0 || new Set(markers.map((m) => m.marker)).size !== markers.length) return;
|
|
22953
|
+
const collapsed = [];
|
|
22954
|
+
const rawAt = [];
|
|
22955
|
+
let pendingSpace = false;
|
|
22956
|
+
for (let index = 0; index < document.length; index += 1) {
|
|
22957
|
+
const char = document[index] ?? "";
|
|
22958
|
+
if (/\s/u.test(char)) {
|
|
22959
|
+
pendingSpace = collapsed.length > 0;
|
|
22960
|
+
continue;
|
|
22961
|
+
}
|
|
22962
|
+
if (pendingSpace) {
|
|
22963
|
+
collapsed.push(" ");
|
|
22964
|
+
rawAt.push(index);
|
|
22965
|
+
pendingSpace = false;
|
|
22966
|
+
}
|
|
22967
|
+
collapsed.push(char);
|
|
22968
|
+
rawAt.push(index);
|
|
22969
|
+
}
|
|
22970
|
+
const haystack = collapsed.join("");
|
|
22971
|
+
const targets = [];
|
|
22972
|
+
for (const excerpt of excerpts) {
|
|
22973
|
+
const at = haystack.indexOf(excerpt.trim());
|
|
22974
|
+
if (at < 0) return;
|
|
22975
|
+
const raw = rawAt[at] ?? -1;
|
|
22976
|
+
const owner = [...markers].reverse().find((m) => m.start <= raw);
|
|
22977
|
+
if (owner === void 0) return;
|
|
22978
|
+
if (!targets.includes(owner.marker)) targets.push(owner.marker);
|
|
22979
|
+
}
|
|
22980
|
+
targets.sort((a, b) => markers.findIndex((m) => m.marker === a) - markers.findIndex((m) => m.marker === b));
|
|
22981
|
+
return {
|
|
22982
|
+
sections: markers.map((m) => m.marker),
|
|
22983
|
+
targets
|
|
22984
|
+
};
|
|
22985
|
+
}
|
|
22986
|
+
/**
|
|
22630
22987
|
* Character cap of the HOST VALIDATION LESSONS prompt block (RV3603):
|
|
22631
22988
|
* the bounded repair round's prompt folds the run's journaled finish
|
|
22632
22989
|
* validation failures so the round does not relearn a lesson the run
|
|
@@ -22759,6 +23116,8 @@ function validateOrchestrateOptions(opts) {
|
|
|
22759
23116
|
}
|
|
22760
23117
|
if (fv.maxRepairs !== void 0) requireNonNegativeInteger(fv.maxRepairs, "orchestrate finishValidation.maxRepairs");
|
|
22761
23118
|
if (fv.repairTurnReserve !== void 0) requireNonNegativeInteger(fv.repairTurnReserve, "orchestrate finishValidation.repairTurnReserve");
|
|
23119
|
+
const estRepair = fv.estRepairCostUsd;
|
|
23120
|
+
if (estRepair !== void 0 && (typeof estRepair !== "number" || !Number.isFinite(estRepair) || estRepair < 0)) throw new ConfigError(`orchestrate finishValidation.estRepairCostUsd must be a nonnegative finite number; got ${JSON.stringify(estRepair)}`);
|
|
22762
23121
|
const retain = fv.retainRejectedCandidates;
|
|
22763
23122
|
if (retain !== void 0 && typeof retain !== "boolean") throw new ConfigError("orchestrate finishValidation.retainRejectedCandidates must be a boolean");
|
|
22764
23123
|
const draftPolicy = fv.draftPolicy;
|
|
@@ -24127,6 +24486,31 @@ function makeOrchestratorWorkflow(goal, opts) {
|
|
|
24127
24486
|
*/
|
|
24128
24487
|
let validationInvocationStart = 0;
|
|
24129
24488
|
/**
|
|
24489
|
+
* The staged release of the round's mechanical money leg (RV3802),
|
|
24490
|
+
* armed by the bounded claim repair round right before its
|
|
24491
|
+
* composition dispatches and fired at the round invocation's FIRST
|
|
24492
|
+
* journaled finish verdict: a 'repair' verdict is about to spend
|
|
24493
|
+
* the freed money on the granted turn, an 'accepted' one never
|
|
24494
|
+
* needed it, and a 'rejected' one dies into the round's own
|
|
24495
|
+
* finally, which releases whatever is still armed. Live-only state
|
|
24496
|
+
* on the RV808b doctrine: the hold itself is re-committed by the
|
|
24497
|
+
* re-executed round code on a resume, and full replay never runs
|
|
24498
|
+
* validateFinish at all.
|
|
24499
|
+
*/
|
|
24500
|
+
let releaseRepairLeg;
|
|
24501
|
+
/**
|
|
24502
|
+
* The sectional round context (RV3803), armed by the bounded claim
|
|
24503
|
+
* repair round exactly when {@link sectionalRoundPlan} is exact
|
|
24504
|
+
* over the accepted pre-repair document and the judged findings:
|
|
24505
|
+
* the retained base, its full H2 marker roster, and the target
|
|
24506
|
+
* sections owning the findings. Live state cleared in the round's
|
|
24507
|
+
* finally; a resume re-derives it from replayed material (the
|
|
24508
|
+
* judged findings and the accepted document both replay verbatim),
|
|
24509
|
+
* so the round's prompt bytes stay identical without journaling
|
|
24510
|
+
* anything new.
|
|
24511
|
+
*/
|
|
24512
|
+
let sectionalRoundContext;
|
|
24513
|
+
/**
|
|
24130
24514
|
* The contract generation membership test (cycle 73). Without a
|
|
24131
24515
|
* contract there are no generations and every decision is current
|
|
24132
24516
|
* (the pre 1.77 behavior, byte identical). With one, a decision
|
|
@@ -24159,8 +24543,9 @@ function makeOrchestratorWorkflow(goal, opts) {
|
|
|
24159
24543
|
const rows = [];
|
|
24160
24544
|
const seen = /* @__PURE__ */ new Set();
|
|
24161
24545
|
for (const decision of validationDecisions()) {
|
|
24162
|
-
|
|
24163
|
-
|
|
24546
|
+
const taught = [...decision.failed, ...decision.deterministicRepair?.healed ?? []];
|
|
24547
|
+
if (taught.length === 0 || !contractGenerationCurrent(decision)) continue;
|
|
24548
|
+
for (const failure of taught) {
|
|
24164
24549
|
const key = JSON.stringify([failure.name, failure.reasons]);
|
|
24165
24550
|
if (seen.has(key)) continue;
|
|
24166
24551
|
seen.add(key);
|
|
@@ -24299,7 +24684,45 @@ function makeOrchestratorWorkflow(goal, opts) {
|
|
|
24299
24684
|
if (validationSpec === void 0) return { ok: true };
|
|
24300
24685
|
let effective = call.result ?? null;
|
|
24301
24686
|
let spliced = false;
|
|
24302
|
-
if (
|
|
24687
|
+
if (sectionalRoundContext !== void 0) {
|
|
24688
|
+
const round = sectionalRoundContext;
|
|
24689
|
+
const args = call.args ?? {};
|
|
24690
|
+
const hasSections = Object.hasOwn(args, "sections");
|
|
24691
|
+
const hasResult = Object.hasOwn(args, "result");
|
|
24692
|
+
const guidance = () => ({
|
|
24693
|
+
declaredSections: round.sections,
|
|
24694
|
+
targetSections: round.targets,
|
|
24695
|
+
instruction: "repair ONLY the target sections: call finish({ sections: { \"<marker>\": \"<new section body>\" } }); unchanged sections are spliced from the retained accepted document byte for byte and the spliced whole is validated and judged. Resubmit the full document as result only when a targeted repair is impossible."
|
|
24696
|
+
});
|
|
24697
|
+
if (hasSections && hasResult) return {
|
|
24698
|
+
ok: false,
|
|
24699
|
+
feedback: {
|
|
24700
|
+
error: "pass either result (the full document) or sections (a sectional repair of the retained accepted document), never both",
|
|
24701
|
+
...guidance()
|
|
24702
|
+
}
|
|
24703
|
+
};
|
|
24704
|
+
if (hasSections) {
|
|
24705
|
+
const patch = args.sections;
|
|
24706
|
+
const markers = Object.keys(patch);
|
|
24707
|
+
if (markers.length === 0) return {
|
|
24708
|
+
ok: false,
|
|
24709
|
+
feedback: {
|
|
24710
|
+
error: "sections must name at least one declared section marker",
|
|
24711
|
+
...guidance()
|
|
24712
|
+
}
|
|
24713
|
+
};
|
|
24714
|
+
const unknown = markers.filter((marker) => !round.sections.includes(marker));
|
|
24715
|
+
if (unknown.length > 0) return {
|
|
24716
|
+
ok: false,
|
|
24717
|
+
feedback: {
|
|
24718
|
+
error: `sections names an undeclared section ${unknown.map((marker) => `'${marker}'`).join(", ")}; only the retained document's own markers splice`,
|
|
24719
|
+
...guidance()
|
|
24720
|
+
}
|
|
24721
|
+
};
|
|
24722
|
+
effective = spliceSections(round.base, round.sections, patch);
|
|
24723
|
+
spliced = true;
|
|
24724
|
+
}
|
|
24725
|
+
} else if (finishSectional !== void 0) {
|
|
24303
24726
|
const resolution = finishSectional.resolve(call);
|
|
24304
24727
|
if (resolution.kind === "refused") return {
|
|
24305
24728
|
ok: false,
|
|
@@ -24310,6 +24733,7 @@ function makeOrchestratorWorkflow(goal, opts) {
|
|
|
24310
24733
|
}
|
|
24311
24734
|
const maxRepairs = validationSpec.maxRepairs ?? 1;
|
|
24312
24735
|
const known = validationDecisions();
|
|
24736
|
+
let patchedResult;
|
|
24313
24737
|
let decision = known.find((candidate) => candidate.callId === call.id);
|
|
24314
24738
|
if (decision === void 0) {
|
|
24315
24739
|
const result = effective;
|
|
@@ -24320,25 +24744,79 @@ function makeOrchestratorWorkflow(goal, opts) {
|
|
|
24320
24744
|
runId: internals.runId
|
|
24321
24745
|
};
|
|
24322
24746
|
const failed = [];
|
|
24747
|
+
const failureHints = [];
|
|
24323
24748
|
for (const validator of validationSpec.validators) {
|
|
24324
24749
|
let verdict;
|
|
24325
24750
|
try {
|
|
24326
24751
|
verdict = validator.validate(input);
|
|
24327
24752
|
} catch (thrown) {
|
|
24328
24753
|
validationTermination = new ConfigError(`finish validator '${validator.name}' threw instead of returning a verdict: ` + (thrown instanceof Error ? thrown.message : String(thrown)));
|
|
24329
|
-
validationAbort.abort("rulvar:finish-validation");
|
|
24754
|
+
validationAbort.abort("rulvar:finish-validation-defect");
|
|
24330
24755
|
return {
|
|
24331
24756
|
ok: false,
|
|
24332
24757
|
feedback: { error: `finish validator '${validator.name}' is defective; the run fails` }
|
|
24333
24758
|
};
|
|
24334
24759
|
}
|
|
24335
|
-
if (!verdict.ok)
|
|
24336
|
-
|
|
24337
|
-
|
|
24338
|
-
|
|
24760
|
+
if (!verdict.ok) {
|
|
24761
|
+
failed.push({
|
|
24762
|
+
name: validator.name,
|
|
24763
|
+
reasons: verdict.reasons
|
|
24764
|
+
});
|
|
24765
|
+
failureHints.push(verdict.repairHints);
|
|
24766
|
+
}
|
|
24767
|
+
}
|
|
24768
|
+
let deterministicRepair;
|
|
24769
|
+
if (failed.length > 0 && typeof result === "string" && failureHints.every((hints) => hints !== void 0 && hints.length > 0)) {
|
|
24770
|
+
const merged = [];
|
|
24771
|
+
const seenHints = /* @__PURE__ */ new Set();
|
|
24772
|
+
for (const hints of failureHints) for (const hint of hints ?? []) {
|
|
24773
|
+
const key = `${String(hint.start)}:${String(hint.end)}:${hint.insert}`;
|
|
24774
|
+
if (!seenHints.has(key)) {
|
|
24775
|
+
seenHints.add(key);
|
|
24776
|
+
merged.push(hint);
|
|
24777
|
+
}
|
|
24778
|
+
}
|
|
24779
|
+
const patched = merged.length <= MAX_DETERMINISTIC_PATCHES && merged.every((hint) => hint.mechanism === "insert-run-id" && result.slice(hint.start, hint.end) === hint.sentence) ? applyFinishRepairHints(result, merged) : void 0;
|
|
24780
|
+
if (patched !== void 0) {
|
|
24781
|
+
const patchedInput = {
|
|
24782
|
+
result: patched,
|
|
24783
|
+
text: patched,
|
|
24784
|
+
children: input.children,
|
|
24785
|
+
runId: internals.runId
|
|
24786
|
+
};
|
|
24787
|
+
const residual = [];
|
|
24788
|
+
for (const validator of validationSpec.validators) {
|
|
24789
|
+
let verdict;
|
|
24790
|
+
try {
|
|
24791
|
+
verdict = validator.validate(patchedInput);
|
|
24792
|
+
} catch (thrown) {
|
|
24793
|
+
validationTermination = new ConfigError(`finish validator '${validator.name}' threw instead of returning a verdict: ` + (thrown instanceof Error ? thrown.message : String(thrown)));
|
|
24794
|
+
validationAbort.abort("rulvar:finish-validation-defect");
|
|
24795
|
+
return {
|
|
24796
|
+
ok: false,
|
|
24797
|
+
feedback: { error: `finish validator '${validator.name}' is defective; the run fails` }
|
|
24798
|
+
};
|
|
24799
|
+
}
|
|
24800
|
+
if (!verdict.ok) residual.push(validator.name);
|
|
24801
|
+
}
|
|
24802
|
+
const patchSurvived = residual.length === 0;
|
|
24803
|
+
deterministicRepair = {
|
|
24804
|
+
mechanism: "insert-run-id",
|
|
24805
|
+
patches: merged.map(({ start, end, insert }) => ({
|
|
24806
|
+
start,
|
|
24807
|
+
end,
|
|
24808
|
+
insert
|
|
24809
|
+
})),
|
|
24810
|
+
beforeHash: createHash("sha256").update(jcsSerialize(result), "utf8").digest("hex"),
|
|
24811
|
+
afterHash: createHash("sha256").update(jcsSerialize(patched), "utf8").digest("hex"),
|
|
24812
|
+
outcome: patchSurvived ? "accepted" : "failed",
|
|
24813
|
+
...patchSurvived ? { healed: failed } : { residual }
|
|
24814
|
+
};
|
|
24815
|
+
if (patchSurvived) patchedResult = patched;
|
|
24816
|
+
}
|
|
24339
24817
|
}
|
|
24340
24818
|
const repairsUsed = known.filter((candidate, index) => index >= validationInvocationStart && candidate.verdict !== "accepted" && contractGenerationCurrent(candidate)).length;
|
|
24341
|
-
const rejectedCandidate = failed.length > 0;
|
|
24819
|
+
const rejectedCandidate = failed.length > 0 && deterministicRepair?.outcome !== "accepted";
|
|
24342
24820
|
let candidateRef;
|
|
24343
24821
|
if (rejectedCandidate && validationSpec.retainRejectedCandidates === true) {
|
|
24344
24822
|
const ref = `${internals.runId}/finish-rejected/${call.id}`;
|
|
@@ -24360,10 +24838,11 @@ function makeOrchestratorWorkflow(goal, opts) {
|
|
|
24360
24838
|
decision = {
|
|
24361
24839
|
decisionType: "orchestrator_finish_validation",
|
|
24362
24840
|
callId: call.id,
|
|
24363
|
-
verdict: failed.length === 0 ? "accepted" : repairsUsed < maxRepairs ? "repair" : "rejected",
|
|
24364
|
-
failed,
|
|
24841
|
+
verdict: failed.length === 0 || deterministicRepair?.outcome === "accepted" ? "accepted" : repairsUsed < maxRepairs ? "repair" : "rejected",
|
|
24842
|
+
failed: deterministicRepair?.outcome === "accepted" ? [] : failed,
|
|
24365
24843
|
repairsUsed,
|
|
24366
24844
|
maxRepairs,
|
|
24845
|
+
...deterministicRepair === void 0 ? {} : { deterministicRepair },
|
|
24367
24846
|
...validationSpec.contract === void 0 ? {} : { contractHash: validationSpec.contract.hash },
|
|
24368
24847
|
...rejectedCandidate ? {
|
|
24369
24848
|
candidateHash: createHash("sha256").update(jcsSerialize(result), "utf8").digest("hex"),
|
|
@@ -24380,16 +24859,23 @@ function makeOrchestratorWorkflow(goal, opts) {
|
|
|
24380
24859
|
site: "orchestrator-finish-validation",
|
|
24381
24860
|
value: decision
|
|
24382
24861
|
});
|
|
24862
|
+
releaseRepairLeg?.();
|
|
24863
|
+
}
|
|
24864
|
+
if (decision.verdict === "accepted") {
|
|
24865
|
+
if (patchedResult !== void 0) return {
|
|
24866
|
+
ok: true,
|
|
24867
|
+
resolved: { result: patchedResult }
|
|
24868
|
+
};
|
|
24869
|
+
return spliced ? {
|
|
24870
|
+
ok: true,
|
|
24871
|
+
resolved: { result: effective }
|
|
24872
|
+
} : { ok: true };
|
|
24383
24873
|
}
|
|
24384
|
-
if (decision.verdict === "accepted") return spliced ? {
|
|
24385
|
-
ok: true,
|
|
24386
|
-
resolved: { result: effective }
|
|
24387
|
-
} : { ok: true };
|
|
24388
24874
|
finishSectional?.retain(effective);
|
|
24389
24875
|
if (decision.verdict === "rejected") {
|
|
24390
24876
|
if (contractGenerationCurrent(decision)) {
|
|
24391
24877
|
validationTermination = finishValidationError(decision);
|
|
24392
|
-
validationAbort.abort(
|
|
24878
|
+
validationAbort.abort(FINISH_REJECTION_ABORT_REASON);
|
|
24393
24879
|
}
|
|
24394
24880
|
return {
|
|
24395
24881
|
ok: false,
|
|
@@ -24405,7 +24891,11 @@ function makeOrchestratorWorkflow(goal, opts) {
|
|
|
24405
24891
|
error: "the finish result failed host validation; repair the result and call finish again",
|
|
24406
24892
|
failed: decision.failed,
|
|
24407
24893
|
repairsRemaining: decision.maxRepairs - decision.repairsUsed - 1,
|
|
24408
|
-
...
|
|
24894
|
+
...sectionalRoundContext !== void 0 ? { sectionalRepair: {
|
|
24895
|
+
declaredSections: sectionalRoundContext.sections,
|
|
24896
|
+
targetSections: sectionalRoundContext.targets,
|
|
24897
|
+
instruction: "repair ONLY the target sections: call finish({ sections: { \"<marker>\": \"<new section body>\" } }); unchanged sections are spliced from the retained accepted document byte for byte and the spliced whole is validated and judged. Resubmit the full document as result only when a targeted repair is impossible."
|
|
24898
|
+
} } : finishSectional === void 0 ? {} : { sectionalRepair: finishSectional.guidance() }
|
|
24409
24899
|
}
|
|
24410
24900
|
};
|
|
24411
24901
|
};
|
|
@@ -24924,6 +25414,15 @@ function makeOrchestratorWorkflow(goal, opts) {
|
|
|
24924
25414
|
* not settle ok, because an empty list would claim the pool agreed.
|
|
24925
25415
|
*/
|
|
24926
25416
|
let claimFindingsFound;
|
|
25417
|
+
/**
|
|
25418
|
+
* The observed price of this run's own latest post draft claim
|
|
25419
|
+
* judge pass (RV3701): the fallback sizing of the repair round's
|
|
25420
|
+
* convergence hold when the host declared no `judge.estCost`. By
|
|
25421
|
+
* the time the bounded round can dispatch, a post draft pass has
|
|
25422
|
+
* always settled (the round's findings came from it), so the
|
|
25423
|
+
* fallback is this run's own money, never an invented constant.
|
|
25424
|
+
*/
|
|
25425
|
+
let observedFinalJudgeCostUsd;
|
|
24927
25426
|
/** Set whenever the pass ran, findings or not (the RV1404 pairing). */
|
|
24928
25427
|
let claimConsistencyMeta;
|
|
24929
25428
|
/**
|
|
@@ -25208,6 +25707,7 @@ function makeOrchestratorWorkflow(goal, opts) {
|
|
|
25208
25707
|
try {
|
|
25209
25708
|
judged = await runtime.runInScope(judgeState, () => ctx.agent(judgePrompt, judgeOpts));
|
|
25210
25709
|
noteInternalSettle(judged);
|
|
25710
|
+
if (stage !== "draft" && typeof judged.costUsd === "number") observedFinalJudgeCostUsd = judged.costUsd;
|
|
25211
25711
|
} catch (declined) {
|
|
25212
25712
|
if (!(declined instanceof BudgetExhaustedError)) throw declined;
|
|
25213
25713
|
claimConsistencyMeta = finishMeta({
|
|
@@ -25462,7 +25962,7 @@ function makeOrchestratorWorkflow(goal, opts) {
|
|
|
25462
25962
|
const synthesisToolNames = /* @__PURE__ */ new Set([FINISH_TOOL_NAME, ...exposeTools ? [GET_CHILD_RESULT_TOOL_NAME, READ_CHILD_ARTIFACT_TOOL_NAME] : []]);
|
|
25463
25963
|
const synthesisTools = buildOrchestratorTools(orchestratorRuntime, fullCardText, {
|
|
25464
25964
|
childResultTools: exposeTools,
|
|
25465
|
-
sectionalFinish: synthSectionalFinish
|
|
25965
|
+
sectionalFinish: synthSectionalFinish || sectionalRoundContext !== void 0
|
|
25466
25966
|
}).filter((tool) => synthesisToolNames.has(tool.name));
|
|
25467
25967
|
if (finishSectional !== void 0 && synthSectionalFinish) finishSectional.retain(draft);
|
|
25468
25968
|
const settledEntries = [...byOrdinal.values()].filter((record) => record.settled !== void 0).sort((a, b) => a.spawnOrdinal - b.spawnOrdinal).map((record) => [record.handle, record]);
|
|
@@ -25540,6 +26040,7 @@ function makeOrchestratorWorkflow(goal, opts) {
|
|
|
25540
26040
|
...opts?.contradictions?.onFound !== "carry" || contradictionsFound === void 0 || contradictionsFound.length === 0 ? [] : ["CHILD CONTRADICTIONS: the settled children read these cited locations differently; resolve each one EXPLICITLY in the final result (say which reading holds and why it does) instead of silently picking one. " + JSON.stringify(contradictionsFound)],
|
|
25541
26041
|
...opts?.claimConsistency?.onFound !== "carry" && opts?.claimConsistency?.onFound !== "repair" || claimFindingsFound === void 0 || claimFindingsFound.length === 0 ? [] : ["CLAIM CONTRADICTIONS: the composed draft contradicts the settled child pool at these cited locations; resolve each one EXPLICITLY in the final result (say which reading holds and why) instead of keeping the inverted claim. " + JSON.stringify(claimFindingsFound)],
|
|
25542
26042
|
...opts?.claimConsistency?.onFound !== "carry" && opts?.claimConsistency?.onFound !== "repair" || claimFindingsFound === void 0 || claimFindingsFound.length === 0 ? [] : hostValidationLessons(),
|
|
26043
|
+
...sectionalRoundContext === void 0 ? [] : [`RETAINED FINAL: ${JSON.stringify(sectionalRoundContext.base)}`, "SECTIONAL ROUND: the accepted document above is RETAINED; repair ONLY the sections owning the contradicted claims by calling finish({ sections: { \"<marker>\": \"<new section body>\" } }). Unchanged sections are spliced from the retained document byte for byte and the spliced whole is validated and judged. Target sections: " + JSON.stringify(sectionalRoundContext.targets) + ". Declared markers: " + JSON.stringify(sectionalRoundContext.sections) + ". Resubmit the full document as result only when a targeted repair is impossible."],
|
|
25543
26044
|
...spec.policyFacts === true ? [(() => {
|
|
25544
26045
|
const byStatus = {};
|
|
25545
26046
|
let extensionsGranted = 0;
|
|
@@ -26391,6 +26892,33 @@ function makeOrchestratorWorkflow(goal, opts) {
|
|
|
26391
26892
|
const hashOfDocument = (value) => createHash("sha256").update(jcsSerialize(value ?? null), "utf8").digest("hex");
|
|
26392
26893
|
const preRepairHash = hashOfDocument(synthesizedFinal);
|
|
26393
26894
|
const carried = claimFindingsFound;
|
|
26895
|
+
const convergenceHoldUsd = opts?.claimConsistency?.judge?.estCost ?? observedFinalJudgeCostUsd ?? 0;
|
|
26896
|
+
const convergenceScope = orchestratorAccount ?? "run";
|
|
26897
|
+
if (convergenceHoldUsd > 0) internals.budget.commitConvergenceReserve(convergenceScope, convergenceHoldUsd);
|
|
26898
|
+
const repairHoldUsd = validationSpec === void 0 ? 0 : validationSpec.estRepairCostUsd ?? lastMechanicalRepairCostUsd(internals.replayer.snapshot(), (servedBy, usage) => internals.priceUsd(servedBy, usage)) ?? 0;
|
|
26899
|
+
if (repairHoldUsd > 0) {
|
|
26900
|
+
internals.budget.commitRepairReserve(convergenceScope, repairHoldUsd);
|
|
26901
|
+
releaseRepairLeg = () => {
|
|
26902
|
+
releaseRepairLeg = void 0;
|
|
26903
|
+
internals.budget.releaseRepairReserve(convergenceScope);
|
|
26904
|
+
};
|
|
26905
|
+
}
|
|
26906
|
+
const roundPlan = validationSpec !== void 0 && typeof synthesizedFinal === "string" ? sectionalRoundPlan(synthesizedFinal, carried.map((finding) => finding.draftExcerpt)) : void 0;
|
|
26907
|
+
if (roundPlan !== void 0) {
|
|
26908
|
+
sectionalRoundContext = {
|
|
26909
|
+
base: synthesizedFinal,
|
|
26910
|
+
...roundPlan
|
|
26911
|
+
};
|
|
26912
|
+
internals.events.emit({
|
|
26913
|
+
type: "log",
|
|
26914
|
+
level: "debug",
|
|
26915
|
+
msg: "orchestrator sectional round armed",
|
|
26916
|
+
data: {
|
|
26917
|
+
targets: roundPlan.targets,
|
|
26918
|
+
sections: roundPlan.sections.length
|
|
26919
|
+
}
|
|
26920
|
+
}, callingState.spanId);
|
|
26921
|
+
}
|
|
26394
26922
|
try {
|
|
26395
26923
|
synthesizedFinal = await runSynthesis(result.output);
|
|
26396
26924
|
} catch (thrown) {
|
|
@@ -26422,8 +26950,24 @@ function makeOrchestratorWorkflow(goal, opts) {
|
|
|
26422
26950
|
preRepairHash,
|
|
26423
26951
|
...acceptanceSnapshot
|
|
26424
26952
|
} });
|
|
26953
|
+
} finally {
|
|
26954
|
+
sectionalRoundContext = void 0;
|
|
26955
|
+
releaseRepairLeg = void 0;
|
|
26956
|
+
if (repairHoldUsd > 0) internals.budget.releaseRepairReserve(convergenceScope);
|
|
26957
|
+
if (convergenceHoldUsd > 0) internals.budget.releaseConvergenceReserve(convergenceScope);
|
|
26958
|
+
}
|
|
26959
|
+
try {
|
|
26960
|
+
await runClaimConsistencyPass(synthesizedFinal, acceptanceSnapshot, "final");
|
|
26961
|
+
} catch (thrown) {
|
|
26962
|
+
if (thrown instanceof FailRunError && typeof thrown.data === "object" && thrown.data !== null && !Array.isArray(thrown.data) && thrown.data.source === "orchestrator_claim_consistency") throw new FailRunError(thrown.message, { data: {
|
|
26963
|
+
...thrown.data,
|
|
26964
|
+
...thrown.data.claimContradictions === void 0 ? { claimContradictions: carried } : {},
|
|
26965
|
+
roundDispatched: true,
|
|
26966
|
+
repairsUsed: 1,
|
|
26967
|
+
preRepairHash
|
|
26968
|
+
} });
|
|
26969
|
+
throw thrown;
|
|
26425
26970
|
}
|
|
26426
|
-
await runClaimConsistencyPass(synthesizedFinal, acceptanceSnapshot, "final");
|
|
26427
26971
|
if (claimFindingsFound !== void 0 && claimFindingsFound.length > 0) throw new FailRunError(`the claim-consistency judge still found ${String(claimFindingsFound.length)} contradiction${claimFindingsFound.length === 1 ? "" : "s"} after the bounded repair round: the repaired composition keeps contradicting the settled pool`, { data: {
|
|
26428
26972
|
source: "orchestrator_claim_consistency",
|
|
26429
26973
|
claimContradictions: claimFindingsFound,
|
|
@@ -28613,6 +29157,7 @@ function createEngine(options) {
|
|
|
28613
29157
|
byModel: /* @__PURE__ */ new Map(),
|
|
28614
29158
|
byPhase: /* @__PURE__ */ new Map(),
|
|
28615
29159
|
byAgentType: /* @__PURE__ */ new Map(),
|
|
29160
|
+
byScope: /* @__PURE__ */ new Map(),
|
|
28616
29161
|
byRole: /* @__PURE__ */ new Map(),
|
|
28617
29162
|
unpriced: [],
|
|
28618
29163
|
orchestrator: {
|
|
@@ -29570,4 +30115,4 @@ function createSandboxBridge(ctx, options) {
|
|
|
29570
30115
|
};
|
|
29571
30116
|
}
|
|
29572
30117
|
//#endregion
|
|
29573
|
-
export { AWAIT_SCHEMA, AdmissionController, AdmissionRejectedError, AgentCallError, BUDGET_ABORT_REASON, BudgetExhaustedError, CANCEL_AGENT_SCHEMA, CHECKPOINT_FORMAT_V1, CLAIM_JUDGE_LABEL, CLAIM_STATEMENT_MAX_CHARS, CLAIM_TTL_DAYS, COMPACTION_SUMMARY_PREFIX, CURRENT_HASH_VERSION, ConfigError, DECISION_CHAIN_KINDS, DEFAULT_ANCHOR_PATTERN, DEFAULT_ARTIFACT_PATTERN, DEFAULT_CHILD_BUDGET_FRACTION, DEFAULT_CHILD_RESULT_PAGE_CHARS, DEFAULT_CITATION_PATTERN, DEFAULT_CITATION_SAMPLE, DEFAULT_CLAIM_JUDGE_MAX_TURNS, DEFAULT_COMPACTION_THRESHOLD, DEFAULT_ESCALATION_LIMITS, DEFAULT_EVIDENCE_CALLS_PER_ENTRY, DEFAULT_EVIDENCE_GRADE_PHRASES, DEFAULT_EVIDENCE_MIN_SHARE, DEFAULT_EVIDENCE_OVERHEAD_CALLS, DEFAULT_FINISH_MAX_REPAIRS, DEFAULT_FLAT_RESERVE_USD, DEFAULT_MAX_CHILDREN_PER_NODE, DEFAULT_MAX_CLAIM_PAIRS, DEFAULT_MAX_CONTRADICTIONS, DEFAULT_MAX_DEPTH, DEFAULT_MAX_EXCERPT_CHARS, DEFAULT_MAX_OSCILLATIONS_PER_KEY, DEFAULT_MAX_PAIR_EXCERPT_CHARS, DEFAULT_MAX_PINNED_WORKTREES, DEFAULT_MAX_POOL_PER_PAIR, DEFAULT_MAX_QUOTA_DENIALS, DEFAULT_MAX_REVISIONS_PER_RUN, DEFAULT_MAX_RUN_FACT_PAIRS, DEFAULT_MAX_TOTAL_SPAWNS, DEFAULT_MAX_TURNS, DEFAULT_MODEL_RETRY_ATTEMPTS, DEFAULT_NO_PROGRESS_TURNS, DEFAULT_PER_RUN_CONCURRENCY, DEFAULT_RETRY_POLICY, DEFAULT_STREAM_IDLE_TIMEOUT_MS, DEFAULT_SYNTHESIS_MAX_TURNS, DEFAULT_SYNTHESIS_NOTE_MAX_TURNS, DedupIndex, DeterminismError, EMIT_RESULT_TOOL, EMPTY_AUTHORITY_HASH, EMPTY_SCHEMA_HASH, EMPTY_TOOLSET_HASH, ESCALATE_TOOL_NAME, ESCALATION_REPORT_SCHEMA, ESCALATION_REQUEST_SCHEMA, EVENT_SEGMENT_STRIDE, EXPOSURE_WAIT_SWEEP_MS, EscalationDecisionAbortedError, EventBus, ExternalRegistry, FINALIZE_SYNTHESIS_INSTRUCTION, FINAL_COMPOSITION_LABEL, FINISH_LESSON_CAP_CHARS, FINISH_SCHEMA, FINISH_SECTIONAL_SCHEMA, FINISH_TOOL_NAME, FUTURE_RATES_TOLERANCE_MS, FailRunError, FileModelKnowledgeStore, FileTranscriptStore, GET_CHILD_RESULT_SCHEMA, GET_CHILD_RESULT_TOOL_NAME, GET_SETTLED_CHILD_RESULTS_SCHEMA, GET_SETTLED_CHILD_RESULTS_TOOL_NAME, GitWorktreeProvider, IMPLEMENTATION_PROFILE_LIMITS, INBOX_PROPOSAL_TTL_DAYS, IN_FLIGHT_EXPOSURE_REFUSAL_PREFIX, InMemoryStore, InMemoryTranscriptStore, InProcessRunner, InvalidResolutionError, JOURNAL_ENVELOPE_MARKER, JournalCompatibilityError, JournalIntegrityError, JournalMatcher, JournalMissError, JournalOrderViolation, JournalSealedError, JsonlFileStore, KB_ACTIVE_CLAIMS_CAP, KB_CARD_RENDER_BUDGET_CHARS, KeyedLimiter, KnowledgeCasError, LARGE_VALUE_WARN_BYTES, LEGACY_LTID_PREFIX, LEGACY_SIGNATURE_INPUTS, LINEAGE_SIG_VERSION, LeaseHeldError, LineageIndex, MASKED_SECRET, MAX_CHILD_RESULT_PAGE_CHARS, MAX_CRITICAL_UNCOVERED, MAX_DEPTH_CEILING, MAX_RUN_FACTS_SHEET_CHARS, MAX_RUN_ID_LENGTH, MAX_TIMER_DELAY_MS, ModelRetry, NoProgressDetector, NonSerializableValueError, ORCHESTRATE_WORKFLOW_NAME, OrchestratorCapConfigError, PARALLEL_AGENTS_SCHEMA, PROGRESS_REPORT_TOOL_NAME, ParallelSiteCounter, PlanInvariantError, QUOTA_WINDOW_MS, READ_CHILD_ARTIFACT_SCHEMA, READ_CHILD_ARTIFACT_TOOL_NAME, RESEARCH_PROFILE_LIMITS, REVIEW_PROFILE_LIMITS, ROLE_EFFORT_DEFAULTS, ROOT_ACCOUNT, ROOT_SCOPE, RUN_FACTS_ANCHOR, RUN_PROFILES, RUN_SETTLE_DECISION_TYPE, ReplayPlanHashMismatch, Replayer, ResolutionArbiter, ResolutionFold, RulvarError, RunBudget, SANDBOX_AGENT_OPT_KEYS, SPAWN_ADMISSION_DECISION_TYPE, SPAWN_AGENT_SCHEMA, SYNTHESIS_NOTE_LABEL, SandboxError, ScriptRejected, Semaphore, SettlementError, SpanRegistry, SupersededError, TERMINAL_TELEMETRY_SCOPE, TOOL_NAME_PATTERN, TerminationAccount, WAIT_FOR_EVENTS_SCHEMA, WAIT_FOR_EVENTS_TOOL_NAME, WAKE_SUMMARY_RENDER_BUDGET_CHARS, accountSpendFromJournal, admissionReserveUsd, affordableOutputTokens, agentErrorFromWire, agentErrorToWire, agentResultWire, agentScope, applyClaimOps, applyStructuredOutputTier, approachSigCoarse, approachSigOf, archiveDeprecatedModelOps, assertFencedWrites, assertSafeRunId, atCompactionThreshold, attestToolset, attributionBucket, auditRun, auditRuns, buildAbandonFold, buildAdapterRegistry, buildCostReport, buildDeriverRegistry, buildOrchestratorTools, buildTerminationInitValue, buildToolContext, canRideLoopTurn, canonicalIsolationTag, canonicalizeLadder, canonicalizeSchema, capIssues, capsHashOf, checkFloors, checkpointRefFor, childCoveragePrefix, childRostersFromJournal, citationTargetsValidator, citedValueValidator, claimCoverageOf, claimExpired, claimExpiry, claimIssues, claimJudgeStageOf, claimOpIssues, classifyAgentError, classifyAttemptOutcome, collectDeclaredLadders, compactMessages, compareRates, compilePermissionChain, compilePermissionPreset, compileSecretMasker, compileVerifiedLayer, constantTimeEqual, costReportFromJournal, countsAgainstLimit, createCanonicalIdMinter, createCtx, createEngine, createEnvelopeEncryption, createSandboxBridge, criticalPathFromJournal, currentOnlyKeyRing, decodeCheckpoint, dedupeRepeatedClaims, defineWorkflow, deriveContentKey, deriverV1, deriverV2, digestOf, dispatchProjectionReserveUsd, dispositionHook, emptyDigestBlocks, emptyToolset, encodeCheckpoint, enforceToolsetAttestation, entryUsageSlices, escalateTool, evaluatePermission, evaluateReuse, evidenceGradeValidator, evidencePreservedValidator, executeWorkflow, executionFactsOf, exhaustionCodeOf, extractCandidate, failoverTriggerOf, fallbackTriggerOf, filterClaimsForRun, finalizeFires, findContradictions, finishContract, foldLedger, foldTermination, formatCharacterValidator, formatRePrompt, formatScopePath, hasFencedWrites, hasMetaLookup, hashRunArgs, hashRunOutput, hashWorkflowBody, hashWorkflowSource, headingStructureValidator, identityJcs, implementationAgentProfile, invoiceFromJournal, isClaimJudgeLabel, isEscalated, isSchemaPairSpec, isStandardSchemaSpec, isStrictCompatibleSchema, journalPricingSnapshot, kMaxOf, knowledgeHash, ladderLengthOf, ladderRungChoice, lastRunSettle, latestProgressReport, lexShellCommand, liftRetainedParts, lineageWeightOf, localKeyProvider, logicalRunTelemetry, makeOrchestratorWorkflow, manifestValidators, maskSecrets, maskSecretsDeep, maskSecretsJson, matchArgvPattern, matchShellCommand, mcp, memoryQuotaLimiter, mergeQuotaDenial, mergeUsageLimits, metaMatchesFilter, minMatchesValidator, modelEpochOf, modelKnowledgeCard, modelSpecIdentity, needsSeparateExtract, nextFailover, nodeLinkKey, normalizeApproachTag, normalizeEntry, normalizeFallbacks, orchestrate, orchestratorAdmissionEstCostUsd, pairDraftClaims, pairRunFactClaims, parallelScope, parseModelRef, parseScopePath, persistedTerminalEnvelope, phiInitialOf, pilotAgentProfile, pipelineScope, planNodeScope, preflightEstimate, priceComponentsOf, priceEntryBilling, priceEntryUsage, priceUsdOf, profileCard, profileRegistrySnapshotHash, progressReportTool, projectHistory, projectIdentity, projectToJsonSchema, proposalStatement, providerOf, quotaActualRequestsDelta, quotaActualTokens, quotaEstimateTokens, quotaRuleAdmission, quotaRuleKey, quotaRuleMatches, readRunMeta, readTerminationInit, reconcileRunMeta, reconcileStatement, reduceAuditTrail, reduceCriticalPath, reduceDecisionChain, reduceInvocationTable, registryKeyRing, remeasureQueue, renderContractRequirements, replayDisposition, repositoryResearchToolset, requiredFieldsValidator, requiredMentionsValidator, requiredSectionsValidator, researchAgentProfile, resolveModelInvocation, resolvePricing, resolveToolset, retryClassOf, retryDelayMs, reviewAgentProfile, roleConfiguredInRouting, roundOneDisposition, runAgent, runProfile, sanitizeTerminalText, sanitizeTokenCount, sanitizeUsage, sanitizeUsageDelta, scanJournalCompatibility, schemaHash, schemaHashOfSpec, sectionCitationsValidator, sectionPatternCountValidator, selectStructuredOutputTier, selfTestFinishValidation, shouldCompact, snapshotQuotaRules, snapshotUsage, spawnDepthOf, spliceSections, statementFromRows, statementRowsFromDelimited, stripFencedBlocks, sumUsage, summarizeInstruction, summarizeOutput, synthesisCandidatesFromJournal, terminalEnvelopeOf, terminationConfigDrift, tierWithinCaps, toApprovalDecision, toJournalValue, tool, toolAuthority, toolCalibrationFromJournal, toolContract, toolContractHash, toolsetAuthorityHash, toolsetHash, ttlState, unionOfIntervalsMs, usageViolations, validateDetachedResolution, validateEditorialCommit, validateEngineQuotaConfig, validateEntryShape, validateEscalationLimits, validateEscalationReport, validateQuotaRules, validateRetryPolicy, validateSchemaSpec, validateTerminationLimits, validateToolsetAttestation, validateUsageLimits, wordCountValidator, workflowScope, workflowSourceRef, wrapJournalStore, wrapTranscriptStore };
|
|
30118
|
+
export { AWAIT_SCHEMA, AdmissionController, AdmissionRejectedError, AgentCallError, BUDGET_ABORT_REASON, BudgetExhaustedError, CANCEL_AGENT_SCHEMA, CHECKPOINT_FORMAT_V1, CLAIM_JUDGE_LABEL, CLAIM_STATEMENT_MAX_CHARS, CLAIM_TTL_DAYS, COMPACTION_SUMMARY_PREFIX, CURRENT_HASH_VERSION, ConfigError, DECISION_CHAIN_KINDS, DEFAULT_ANCHOR_PATTERN, DEFAULT_ARTIFACT_PATTERN, DEFAULT_CHILD_BUDGET_FRACTION, DEFAULT_CHILD_RESULT_PAGE_CHARS, DEFAULT_CITATION_PATTERN, DEFAULT_CITATION_SAMPLE, DEFAULT_CLAIM_JUDGE_MAX_TURNS, DEFAULT_COMPACTION_THRESHOLD, DEFAULT_ESCALATION_LIMITS, DEFAULT_EVIDENCE_CALLS_PER_ENTRY, DEFAULT_EVIDENCE_GRADE_PHRASES, DEFAULT_EVIDENCE_MIN_SHARE, DEFAULT_EVIDENCE_OVERHEAD_CALLS, DEFAULT_FINISH_MAX_REPAIRS, DEFAULT_FLAT_RESERVE_USD, DEFAULT_MAX_CHILDREN_PER_NODE, DEFAULT_MAX_CLAIM_PAIRS, DEFAULT_MAX_CONTRADICTIONS, DEFAULT_MAX_DEPTH, DEFAULT_MAX_EXCERPT_CHARS, DEFAULT_MAX_OSCILLATIONS_PER_KEY, DEFAULT_MAX_PAIR_EXCERPT_CHARS, DEFAULT_MAX_PINNED_WORKTREES, DEFAULT_MAX_POOL_PER_PAIR, DEFAULT_MAX_QUOTA_DENIALS, DEFAULT_MAX_REVISIONS_PER_RUN, DEFAULT_MAX_RUN_FACT_PAIRS, DEFAULT_MAX_TOTAL_SPAWNS, DEFAULT_MAX_TURNS, DEFAULT_MODEL_RETRY_ATTEMPTS, DEFAULT_NO_PROGRESS_TURNS, DEFAULT_PER_RUN_CONCURRENCY, DEFAULT_RETRY_POLICY, DEFAULT_STREAM_IDLE_TIMEOUT_MS, DEFAULT_SYNTHESIS_MAX_TURNS, DEFAULT_SYNTHESIS_NOTE_MAX_TURNS, DedupIndex, DeterminismError, EMIT_RESULT_TOOL, EMPTY_AUTHORITY_HASH, EMPTY_SCHEMA_HASH, EMPTY_TOOLSET_HASH, ESCALATE_TOOL_NAME, ESCALATION_REPORT_SCHEMA, ESCALATION_REQUEST_SCHEMA, EVENT_SEGMENT_STRIDE, EXPOSURE_WAIT_SWEEP_MS, EscalationDecisionAbortedError, EventBus, ExternalRegistry, FINALIZE_SYNTHESIS_INSTRUCTION, FINAL_COMPOSITION_LABEL, FINISH_LESSON_CAP_CHARS, FINISH_SCHEMA, FINISH_SECTIONAL_SCHEMA, FINISH_TOOL_NAME, FUTURE_RATES_TOLERANCE_MS, FailRunError, FileModelKnowledgeStore, FileTranscriptStore, GET_CHILD_RESULT_SCHEMA, GET_CHILD_RESULT_TOOL_NAME, GET_SETTLED_CHILD_RESULTS_SCHEMA, GET_SETTLED_CHILD_RESULTS_TOOL_NAME, GitWorktreeProvider, IMPLEMENTATION_PROFILE_LIMITS, INBOX_PROPOSAL_TTL_DAYS, IN_FLIGHT_EXPOSURE_REFUSAL_PREFIX, InMemoryStore, InMemoryTranscriptStore, InProcessRunner, InvalidResolutionError, JOURNAL_ENVELOPE_MARKER, JournalCompatibilityError, JournalIntegrityError, JournalMatcher, JournalMissError, JournalOrderViolation, JournalSealedError, JsonlFileStore, KB_ACTIVE_CLAIMS_CAP, KB_CARD_RENDER_BUDGET_CHARS, KeyedLimiter, KnowledgeCasError, LARGE_VALUE_WARN_BYTES, LEGACY_LTID_PREFIX, LEGACY_SIGNATURE_INPUTS, LINEAGE_SIG_VERSION, LeaseHeldError, LineageIndex, MASKED_SECRET, MAX_CHILD_RESULT_PAGE_CHARS, MAX_CRITICAL_UNCOVERED, MAX_DEPTH_CEILING, MAX_RUN_FACTS_SHEET_CHARS, MAX_RUN_ID_LENGTH, MAX_TIMER_DELAY_MS, ModelRetry, NoProgressDetector, NonSerializableValueError, ORCHESTRATE_WORKFLOW_NAME, OrchestratorCapConfigError, PARALLEL_AGENTS_SCHEMA, PROGRESS_REPORT_TOOL_NAME, ParallelSiteCounter, PlanInvariantError, QUOTA_WINDOW_MS, READ_CHILD_ARTIFACT_SCHEMA, READ_CHILD_ARTIFACT_TOOL_NAME, RESEARCH_PROFILE_LIMITS, REVIEW_PROFILE_LIMITS, ROLE_EFFORT_DEFAULTS, ROOT_ACCOUNT, ROOT_SCOPE, RUN_FACTS_ANCHOR, RUN_PROFILES, RUN_SETTLE_DECISION_TYPE, ReplayPlanHashMismatch, Replayer, ResolutionArbiter, ResolutionFold, RulvarError, RunBudget, SANDBOX_AGENT_OPT_KEYS, SPAWN_ADMISSION_DECISION_TYPE, SPAWN_AGENT_SCHEMA, SYNTHESIS_NOTE_LABEL, SandboxError, ScriptRejected, Semaphore, SettlementError, SpanRegistry, SupersededError, TERMINAL_TELEMETRY_SCOPE, TOOL_NAME_PATTERN, TerminationAccount, WAIT_FOR_EVENTS_SCHEMA, WAIT_FOR_EVENTS_TOOL_NAME, WAKE_SUMMARY_RENDER_BUDGET_CHARS, accountSpendFromJournal, admissionReserveUsd, affordableOutputTokens, agentErrorFromWire, agentErrorToWire, agentResultWire, agentScope, applyClaimOps, applyFinishRepairHints, applyStructuredOutputTier, approachSigCoarse, approachSigOf, archiveDeprecatedModelOps, assertFencedWrites, assertSafeRunId, atCompactionThreshold, attestToolset, attributionBucket, auditRun, auditRuns, buildAbandonFold, buildAdapterRegistry, buildCostReport, buildDeriverRegistry, buildOrchestratorTools, buildTerminationInitValue, buildToolContext, canRideLoopTurn, canonicalIsolationTag, canonicalizeLadder, canonicalizeSchema, capIssues, capsHashOf, checkFloors, checkpointRefFor, childCoveragePrefix, childRostersFromJournal, citationTargetsValidator, citedValueValidator, claimCoverageOf, claimExpired, claimExpiry, claimIssues, claimJudgeStageOf, claimOpIssues, classifyAgentError, classifyAttemptOutcome, collectDeclaredLadders, compactMessages, compareRates, compilePermissionChain, compilePermissionPreset, compileSecretMasker, compileVerifiedLayer, constantTimeEqual, costReportFromJournal, countsAgainstLimit, createCanonicalIdMinter, createCtx, createEngine, createEnvelopeEncryption, createSandboxBridge, criticalPathFromJournal, currentOnlyKeyRing, decodeCheckpoint, dedupeRepeatedClaims, defineWorkflow, deriveContentKey, deriverV1, deriverV2, digestOf, dispatchProjectionReserveUsd, dispositionHook, emptyDigestBlocks, emptyToolset, encodeCheckpoint, enforceToolsetAttestation, entryUsageSlices, escalateTool, evaluatePermission, evaluateReuse, evidenceGradeValidator, evidencePreservedValidator, executeWorkflow, executionFactsOf, exhaustionCodeOf, extractCandidate, failoverTriggerOf, fallbackTriggerOf, filterClaimsForRun, finalizeFires, findContradictions, finishContract, foldLedger, foldTermination, formatCharacterValidator, formatRePrompt, formatScopePath, hasFencedWrites, hasMetaLookup, hashRunArgs, hashRunOutput, hashWorkflowBody, hashWorkflowSource, headingStructureValidator, identityJcs, implementationAgentProfile, insertRunIdIntoSentence, invoiceFromJournal, isClaimJudgeLabel, isEscalated, isSchemaPairSpec, isStandardSchemaSpec, isStrictCompatibleSchema, journalPricingSnapshot, kMaxOf, knowledgeHash, ladderLengthOf, ladderRungChoice, lastMechanicalRepairCostUsd, lastRunSettle, latestProgressReport, lexShellCommand, liftRetainedParts, lineageWeightOf, localKeyProvider, logicalRunTelemetry, makeOrchestratorWorkflow, manifestValidators, maskSecrets, maskSecretsDeep, maskSecretsJson, matchArgvPattern, matchShellCommand, mcp, memoryQuotaLimiter, mergeQuotaDenial, mergeUsageLimits, metaMatchesFilter, minMatchesValidator, modelEpochOf, modelKnowledgeCard, modelSpecIdentity, needsSeparateExtract, nextFailover, nodeLinkKey, normalizeApproachTag, normalizeEntry, normalizeFallbacks, orchestrate, orchestratorAdmissionEstCostUsd, pairDraftClaims, pairRunFactClaims, parallelScope, parseModelRef, parseScopePath, persistedTerminalEnvelope, phiInitialOf, pilotAgentProfile, pipelineScope, planNodeScope, preflightEstimate, priceComponentsOf, priceEntryBilling, priceEntryUsage, priceUsdOf, profileCard, profileRegistrySnapshotHash, progressReportTool, projectHistory, projectIdentity, projectToJsonSchema, proposalStatement, providerOf, quotaActualRequestsDelta, quotaActualTokens, quotaEstimateTokens, quotaRuleAdmission, quotaRuleKey, quotaRuleMatches, readRunMeta, readTerminationInit, reconcileRunMeta, reconcileStatement, reduceAuditTrail, reduceCriticalPath, reduceDecisionChain, reduceInvocationTable, registryKeyRing, remeasureQueue, renderContractRequirements, replayDisposition, repositoryResearchToolset, requiredFieldsValidator, requiredMentionsValidator, requiredSectionsValidator, researchAgentProfile, resolveModelInvocation, resolvePricing, resolveToolset, retryClassOf, retryDelayMs, reviewAgentProfile, roleConfiguredInRouting, roundOneDisposition, runAgent, runProfile, sanitizeTerminalText, sanitizeTokenCount, sanitizeUsage, sanitizeUsageDelta, scanJournalCompatibility, schemaHash, schemaHashOfSpec, scopeBucket, sectionCitationsValidator, sectionPatternCountValidator, sectionalRoundPlan, selectStructuredOutputTier, selfTestFinishValidation, shouldCompact, snapshotQuotaRules, snapshotUsage, spawnDepthOf, spliceSections, statementFromRows, statementRowsFromDelimited, stripFencedBlocks, sumUsage, summarizeInstruction, summarizeOutput, synthesisCandidatesFromJournal, terminalEnvelopeOf, terminationConfigDrift, tierWithinCaps, toApprovalDecision, toJournalValue, tool, toolAuthority, toolCalibrationFromJournal, toolContract, toolContractHash, toolsetAuthorityHash, toolsetHash, ttlState, unionOfIntervalsMs, usageViolations, validateDetachedResolution, validateEditorialCommit, validateEngineQuotaConfig, validateEntryShape, validateEscalationLimits, validateEscalationReport, validateQuotaRules, validateRetryPolicy, validateSchemaSpec, validateTerminationLimits, validateToolsetAttestation, validateUsageLimits, wordCountValidator, workflowScope, workflowSourceRef, wrapJournalStore, wrapTranscriptStore };
|