@rulvar/core 1.215.0 → 1.216.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.
Files changed (2) hide show
  1. package/dist/index.js +22 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -19831,6 +19831,14 @@ const DEFAULT_CITATION_PATTERN = "[\\w./-]+\\.\\w+:\\d+";
19831
19831
  /** The default preserved share, the improvement plan's RV-202 gate. */
19832
19832
  const DEFAULT_EVIDENCE_MIN_SHARE = .95;
19833
19833
  const MAX_LISTED_CITATIONS = 20;
19834
+ /**
19835
+ * The evidence-grade verdict names its offending sentences (RV2105):
19836
+ * bounded so a document written entirely in the graded register cannot
19837
+ * balloon the journaled verdict or the repair prompt, truncated per
19838
+ * sentence for the same reason.
19839
+ */
19840
+ const MAX_NAMED_OFFENDING_SENTENCES = 5;
19841
+ const MAX_OFFENDING_SENTENCE_CHARS = 240;
19834
19842
  function listCitations(values) {
19835
19843
  return values.length <= MAX_LISTED_CITATIONS ? values.join(", ") : `${values.slice(0, MAX_LISTED_CITATIONS).join(", ")} and ${String(values.length - MAX_LISTED_CITATIONS)} more`;
19836
19844
  }
@@ -20048,15 +20056,27 @@ function evidenceGradeValidator(options) {
20048
20056
  name: options?.name ?? "evidence-grade",
20049
20057
  validate: (input) => {
20050
20058
  const unsupported = [];
20059
+ const offenders = [];
20051
20060
  for (const sentence of sentencesOf(input.text)) {
20052
20061
  const haystack = sentence.toLowerCase();
20053
20062
  const found = lowered.filter((phrase) => haystack.includes(phrase));
20054
20063
  if (found.length === 0 || new RegExp(artifactPattern, "").test(sentence)) continue;
20064
+ offenders.push(sentence);
20055
20065
  for (const phrase of found) if (!unsupported.includes(phrase)) unsupported.push(phrase);
20056
20066
  }
20057
- return unsupported.length === 0 ? ok : {
20067
+ if (unsupported.length === 0) return ok;
20068
+ const named = offenders.slice(0, MAX_NAMED_OFFENDING_SENTENCES).map((sentence) => {
20069
+ const flat = sentence.replace(/\s+/gu, " ").trim();
20070
+ return `offending sentence: "${flat.length <= MAX_OFFENDING_SENTENCE_CHARS ? flat : `${flat.slice(0, MAX_OFFENDING_SENTENCE_CHARS)}...`}"`;
20071
+ });
20072
+ const overflow = offenders.length - named.length;
20073
+ return {
20058
20074
  ok: false,
20059
- reasons: [`evidence-grade claims cite no run or repro artifact in their own sentence: ${listCitations(unsupported)}; each such claim must name a run id or a file:line citation beside it`]
20075
+ reasons: [
20076
+ `evidence-grade claims cite no run or repro artifact in their own sentence: ${listCitations(unsupported)}; each such claim must name a run id or a file:line citation beside it`,
20077
+ ...named,
20078
+ ...overflow > 0 ? [`and ${String(overflow)} more offending sentences`] : []
20079
+ ]
20060
20080
  };
20061
20081
  }
20062
20082
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulvar/core",
3
- "version": "1.215.0",
3
+ "version": "1.216.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",