@rulvar/core 1.190.0 → 1.191.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 +53 -0
- package/dist/index.js +32 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -8103,6 +8103,13 @@ interface RunFactPairsFold {
|
|
|
8103
8103
|
pairs: ClaimPair[];
|
|
8104
8104
|
/** True when more sentences matched than `max` allowed to report. */
|
|
8105
8105
|
truncated: boolean;
|
|
8106
|
+
/**
|
|
8107
|
+
* The UNCAPPED count of matched run-claim sentences (RV1809): with
|
|
8108
|
+
* only `truncated` a consumer knew the bound cut the fold but not by
|
|
8109
|
+
* how much, so no run-fact coverage ratio was computable from the
|
|
8110
|
+
* meta alone.
|
|
8111
|
+
*/
|
|
8112
|
+
candidates: number;
|
|
8106
8113
|
}
|
|
8107
8114
|
/**
|
|
8108
8115
|
* Pairs draft sentences that speak about the RUN with the run's own
|
|
@@ -9467,6 +9474,32 @@ interface OrchestrateClaimConsistency {
|
|
|
9467
9474
|
* `runFacts: true`.
|
|
9468
9475
|
*/
|
|
9469
9476
|
runFactTerms?: string[];
|
|
9477
|
+
/**
|
|
9478
|
+
* The declared coverage floor (RV1809): the minimum
|
|
9479
|
+
* coveredCitingSentences over draftCitingSentences ratio, in
|
|
9480
|
+
* (0, 1]. The nineteenth benchmark's pass covered 36 of 122 citing
|
|
9481
|
+
* sentences and graded itself 'partial' honestly, but nothing could
|
|
9482
|
+
* ENFORCE a floor: a consumer had to read the counts and decide
|
|
9483
|
+
* externally. Below the floor, `onLowCoverage` decides. A draft
|
|
9484
|
+
* with zero citing sentences is vacuously full and never trips it.
|
|
9485
|
+
*/
|
|
9486
|
+
minimumCoverageRatio?: number;
|
|
9487
|
+
/**
|
|
9488
|
+
* The run-fact coverage floor (RV1809): the minimum judged run-fact
|
|
9489
|
+
* pairs over matched run-fact candidates ratio, in (0, 1]. Requires
|
|
9490
|
+
* `runFacts: true`; a draft with zero matched run claims never
|
|
9491
|
+
* trips it.
|
|
9492
|
+
*/
|
|
9493
|
+
runFactCoverageRatio?: number;
|
|
9494
|
+
/**
|
|
9495
|
+
* What a below-floor ratio does (RV1809): 'report' (the default)
|
|
9496
|
+
* stamps the machine-readable `lowCoverage` block on the meta;
|
|
9497
|
+
* 'fail' fails the run typed BEFORE the judge dispatch, exactly
|
|
9498
|
+
* like `onUncoveredCritical`, so a run that cannot meet its
|
|
9499
|
+
* declared verification floor never pays for a partial verdict.
|
|
9500
|
+
* Requires at least one declared floor.
|
|
9501
|
+
*/
|
|
9502
|
+
onLowCoverage?: "report" | "fail";
|
|
9470
9503
|
}
|
|
9471
9504
|
/** One judged contradiction: the pair plus the judge's one-sentence reason. */
|
|
9472
9505
|
interface ClaimContradictionFinding extends ClaimPair {
|
|
@@ -9510,6 +9543,26 @@ interface OrchestrateClaimConsistencyMeta {
|
|
|
9510
9543
|
runFactPairs?: number;
|
|
9511
9544
|
/** Present under `runFacts` when more run claims matched than the bound. */
|
|
9512
9545
|
runFactPairsTruncated?: true;
|
|
9546
|
+
/**
|
|
9547
|
+
* Present under `runFacts` (RV1809): the UNCAPPED count of matched
|
|
9548
|
+
* run-claim sentences, so the run-fact coverage ratio is computable
|
|
9549
|
+
* from the meta alone, live or from a persisted outcome.
|
|
9550
|
+
*/
|
|
9551
|
+
runFactCandidates?: number;
|
|
9552
|
+
/**
|
|
9553
|
+
* Present when a declared coverage floor was not met under
|
|
9554
|
+
* `onLowCoverage: 'report'` (RV1809): each ratio beside its floor,
|
|
9555
|
+
* machine-readable, so "complete but under-verified by the declared
|
|
9556
|
+
* floor" is a field, not an external computation. Under 'fail' the
|
|
9557
|
+
* run fails typed instead and the meta stamps this block on the way
|
|
9558
|
+
* out.
|
|
9559
|
+
*/
|
|
9560
|
+
lowCoverage?: {
|
|
9561
|
+
coverageRatio: number;
|
|
9562
|
+
coverageFloor?: number;
|
|
9563
|
+
runFactRatio?: number;
|
|
9564
|
+
runFactFloor?: number;
|
|
9565
|
+
};
|
|
9513
9566
|
/** True when the judge invocation was dispatched. */
|
|
9514
9567
|
judgeInvoked: boolean;
|
|
9515
9568
|
/** Present when the judge invocation did not settle ok. */
|
package/dist/index.js
CHANGED
|
@@ -20179,7 +20179,8 @@ function pairRunFactClaims(draftText, sheet, options) {
|
|
|
20179
20179
|
}
|
|
20180
20180
|
return {
|
|
20181
20181
|
pairs: matched,
|
|
20182
|
-
truncated: total > matched.length
|
|
20182
|
+
truncated: total > matched.length,
|
|
20183
|
+
candidates: total
|
|
20183
20184
|
};
|
|
20184
20185
|
}
|
|
20185
20186
|
/** Derives the {@link ClaimCoverageGrade} of a claim-consistency meta. */
|
|
@@ -20819,6 +20820,10 @@ function validateOrchestrateOptions(opts) {
|
|
|
20819
20820
|
if (consistency.runFacts !== true) throw new ConfigError("orchestrate claimConsistency.runFactTerms rides the runFacts pass; set claimConsistency.runFacts true");
|
|
20820
20821
|
if (!Array.isArray(consistency.runFactTerms) || consistency.runFactTerms.some((term) => typeof term !== "string" || term.length === 0)) throw new ConfigError("orchestrate claimConsistency.runFactTerms must be an array of nonempty strings; got " + JSON.stringify(consistency.runFactTerms));
|
|
20821
20822
|
}
|
|
20823
|
+
for (const [label, ratio] of [["minimumCoverageRatio", consistency.minimumCoverageRatio], ["runFactCoverageRatio", consistency.runFactCoverageRatio]]) if (ratio !== void 0 && (typeof ratio !== "number" || !Number.isFinite(ratio) || ratio <= 0 || ratio > 1)) throw new ConfigError(`orchestrate claimConsistency.${label} must be a number in (0, 1]; got ` + JSON.stringify(ratio));
|
|
20824
|
+
if (consistency.runFactCoverageRatio !== void 0 && consistency.runFacts !== true) throw new ConfigError("orchestrate claimConsistency.runFactCoverageRatio rides the runFacts pass; set claimConsistency.runFacts true");
|
|
20825
|
+
if (consistency.onLowCoverage !== void 0 && consistency.onLowCoverage !== "report" && consistency.onLowCoverage !== "fail") throw new ConfigError("orchestrate claimConsistency.onLowCoverage must be 'report' or 'fail'; got " + JSON.stringify(consistency.onLowCoverage));
|
|
20826
|
+
if (consistency.onLowCoverage !== void 0 && consistency.minimumCoverageRatio === void 0 && consistency.runFactCoverageRatio === void 0) throw new ConfigError("orchestrate claimConsistency.onLowCoverage needs a declared floor; set minimumCoverageRatio or runFactCoverageRatio");
|
|
20822
20827
|
if (consistency.judge !== void 0) {
|
|
20823
20828
|
const judge = consistency.judge;
|
|
20824
20829
|
if (typeof judge !== "object" || judge === null || Array.isArray(judge)) throw new ConfigError(`orchestrate claimConsistency.judge must be an object; got ${JSON.stringify(consistency.judge)}`);
|
|
@@ -22710,8 +22715,22 @@ function makeOrchestratorWorkflow(goal, opts) {
|
|
|
22710
22715
|
},
|
|
22711
22716
|
...runFold === void 0 ? {} : {
|
|
22712
22717
|
runFactPairs: runFold.pairs.length,
|
|
22713
|
-
...runFold.truncated ? { runFactPairsTruncated: true } : {}
|
|
22714
|
-
|
|
22718
|
+
...runFold.truncated ? { runFactPairsTruncated: true } : {},
|
|
22719
|
+
runFactCandidates: runFold.candidates
|
|
22720
|
+
},
|
|
22721
|
+
...(() => {
|
|
22722
|
+
const coverageRatio = fold.draftCitingSentences === 0 ? 1 : fold.coveredCitingSentences / fold.draftCitingSentences;
|
|
22723
|
+
const runFactRatio = runFold === void 0 || runFold.candidates === 0 ? void 0 : runFold.pairs.length / runFold.candidates;
|
|
22724
|
+
const belowCoverage = spec.minimumCoverageRatio !== void 0 && fold.draftCitingSentences > 0 && coverageRatio < spec.minimumCoverageRatio;
|
|
22725
|
+
const belowRunFacts = spec.runFactCoverageRatio !== void 0 && runFactRatio !== void 0 && runFactRatio < spec.runFactCoverageRatio;
|
|
22726
|
+
if (!belowCoverage && !belowRunFacts) return {};
|
|
22727
|
+
return { lowCoverage: {
|
|
22728
|
+
coverageRatio,
|
|
22729
|
+
...spec.minimumCoverageRatio === void 0 ? {} : { coverageFloor: spec.minimumCoverageRatio },
|
|
22730
|
+
...runFactRatio === void 0 ? {} : { runFactRatio },
|
|
22731
|
+
...spec.runFactCoverageRatio === void 0 ? {} : { runFactFloor: spec.runFactCoverageRatio }
|
|
22732
|
+
} };
|
|
22733
|
+
})()
|
|
22715
22734
|
};
|
|
22716
22735
|
const finishMeta = (flags) => {
|
|
22717
22736
|
const bare = {
|
|
@@ -22723,6 +22742,16 @@ function makeOrchestratorWorkflow(goal, opts) {
|
|
|
22723
22742
|
coverage: claimCoverageOf(bare)
|
|
22724
22743
|
};
|
|
22725
22744
|
};
|
|
22745
|
+
if (spec.onLowCoverage === "fail" && metaBase.lowCoverage !== void 0) {
|
|
22746
|
+
claimConsistencyMeta = finishMeta({ judgeInvoked: false });
|
|
22747
|
+
const low = metaBase.lowCoverage;
|
|
22748
|
+
throw new FailRunError(`the claim-consistency pass is below a declared coverage floor (coverage ${low.coverageRatio.toFixed(3)}` + (low.coverageFloor === void 0 ? "" : ` under floor ${String(low.coverageFloor)}`) + (low.runFactRatio === void 0 ? "" : `; run facts ${low.runFactRatio.toFixed(3)}` + (low.runFactFloor === void 0 ? "" : ` under floor ${String(low.runFactFloor)}`)) + "), and the armed onLowCoverage posture cannot pass the draft", { data: {
|
|
22749
|
+
source: "orchestrator_claim_consistency",
|
|
22750
|
+
lowCoverage: low,
|
|
22751
|
+
claimConsistencyMeta,
|
|
22752
|
+
...snapshot ?? {}
|
|
22753
|
+
} });
|
|
22754
|
+
}
|
|
22726
22755
|
if (spec.onUncoveredCritical === "fail" && fold.criticalUncovered !== void 0 && fold.criticalUncovered.length > 0) {
|
|
22727
22756
|
claimConsistencyMeta = finishMeta({ judgeInvoked: false });
|
|
22728
22757
|
throw new FailRunError(`the claim-consistency pass left ${String(fold.criticalUncoveredTotal ?? 0)} critical draft anchor(s) unjudged (${fold.criticalUncovered.join(", ")}), and the armed onUncoveredCritical posture cannot pass the draft`, { data: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rulvar/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.191.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",
|