clearotron 0.5.0-beta.8 → 0.5.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/.env.example +2 -1
- package/INSTALL.md +4 -3
- package/QUICKSTART.md +78 -0
- package/bin/onboard.mjs +9 -4
- package/build-info.json +2 -2
- package/docs/releases/0.5.0.md +77 -0
- package/driver/CHANGELOG.md +103 -0
- package/driver/contract-vocabulary.mjs +3 -3
- package/driver/corrections-delivered.mjs +7 -5
- package/driver/corrections-feedforward.mjs +89 -3
- package/driver/coverage-form.mjs +61 -2
- package/driver/degraded-parts.mjs +4 -0
- package/driver/engine/mcp/band-server.mjs +16 -6
- package/driver/engine/openai-agent.mjs +24 -1
- package/driver/engine/probe.mjs +64 -9
- package/driver/goods-evidence.mjs +33 -6
- package/driver/narrative-refutation-record.mjs +17 -2
- package/driver/package.json +1 -1
- package/driver/pipeline.mjs +373 -38
- package/driver/predelivery-lint.mjs +160 -10
- package/driver/publish/index.mjs +2 -2
- package/driver/record-fold.mjs +17 -0
- package/driver/record-goods.mjs +24 -8
- package/driver/register-plan.mjs +8 -3
- package/driver/repair-composers.mjs +61 -7
- package/driver/saved-register-pages.mjs +144 -0
- package/driver/stage-context.mjs +4 -0
- package/driver/suite-census.json +122 -14
- package/driver/terminal-clamp.mjs +21 -0
- package/driver/verify.mjs +6 -3
- package/mcp-server/CHANGELOG.md +12 -0
- package/mcp-server/package.json +1 -1
- package/package.json +2 -1
- package/portal-ui/package.json +1 -1
- package/providers/oauth-mcp-bridge/CHANGELOG.md +12 -0
- package/providers/oauth-mcp-bridge/package.json +1 -1
- package/providers/signa/src/core.js +18 -4
- package/scripts/e2e-first-time.mjs +10 -6
- package/scripts/release-duplicate-notes.mjs +5 -0
|
@@ -29,7 +29,8 @@ import { searchedCovers } from "./frame-diff-model.mjs"; // one c
|
|
|
29
29
|
import { partyFactSources, partyFactViolations, partyFactMessage, canJudgePartyFacts } from "./party-facts.mjs"; //
|
|
30
30
|
import { writeUpViolations, writeUpMessage } from "./narrative-write-ups.mjs"; //
|
|
31
31
|
|
|
32
|
-
import { findRegistryArithmeticIssues, findRegistryViolations, splitBlocks } from "./registry-fidelity.mjs";
|
|
32
|
+
import { findRegistryArithmeticIssues, findRegistryViolations, splitBlocks, normalizeRecordUri } from "./registry-fidelity.mjs";
|
|
33
|
+
import { recordGoods, untaggedIsEnglish } from "./record-goods.mjs"; // a held record's goods, read as the band reads them
|
|
33
34
|
import { parseFront } from "./publish/parse.mjs";
|
|
34
35
|
import { citedFindingNumbers } from "./finding-citations.mjs"; // every written form of a citation, read one way
|
|
35
36
|
export { citedFindingNumbers };
|
|
@@ -105,7 +106,11 @@ export function properNameCandidates(text, extraVocab = null, { actionBullets =
|
|
|
105
106
|
// extraVocab (WS-B): the run's profile platform names — a customer's marketplaces are standing
|
|
106
107
|
// surfaces for THAT run, not entities needing introduction (else every non-gaming report fires
|
|
107
108
|
// false orphan-reference flags).
|
|
108
|
-
|
|
109
|
+
// A TERRITORY'S OTHER NAMES ARE TERRITORIES TOO. The map names "United Arab Emirates", so "the UAE" in a list of
|
|
110
|
+
// countries was named as a party by both checks. The names prose uses besides the map's are already listed once,
|
|
111
|
+
// for the coverage claims (TERRITORY_NAME_TO_CODE); read at call time, because that list is built further down.
|
|
112
|
+
const inList = (n) => REF_ALLOWLIST.has(n) || (territories && (TERRITORY_VOCAB.has(n) || TERRITORY_NAME_TO_CODE.has(n)))
|
|
113
|
+
|| Boolean(extraVocab?.has?.(n));
|
|
109
114
|
const isVocab = (tok) => {
|
|
110
115
|
const n = norm(tok);
|
|
111
116
|
if (inList(n)) return true; // whole-phrase entries ("apple app store", "epic games store")
|
|
@@ -140,7 +145,14 @@ export function properNameCandidates(text, extraVocab = null, { actionBullets =
|
|
|
140
145
|
bulletOpens.add(b.index + b[0].length);
|
|
141
146
|
for (const m of t.matchAll(/\b([A-Z][a-z]+(?:[ \t]+(?:[A-Z][a-z0-9]+|\d+|&)){1,4}(?:[ \t]+(?:LLC|Inc\.?|GmbH|Ltd\.?|S\.?A\.?|AG|Corp\.?))?)\b/g)) {
|
|
142
147
|
const tok = m[1].trim();
|
|
143
|
-
|
|
148
|
+
// THE VERB GOES, AND THE NAME AFTER IT STAYS. Skipping the whole candidate also skipped the name an item asks
|
|
149
|
+
// about: "Verify <a person>", where the person is named nowhere else, went unread. So only the opening word is
|
|
150
|
+
// dropped, and what follows it is read as any other candidate.
|
|
151
|
+
if (bulletOpens.has(m.index)) {
|
|
152
|
+
const rest = tok.replace(/^\S+[ \t]+/, "");
|
|
153
|
+
if (rest !== tok && rest.split(/\s+/).length >= 2 && !isVocab(rest)) add(rest);
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
144
156
|
if (tok.split(/\s+/).length >= 2 && !isVocab(tok)) add(tok);
|
|
145
157
|
}
|
|
146
158
|
return [...out.values()].filter((tok) => !/^TMP\d+/i.test(tok));
|
|
@@ -152,6 +164,21 @@ function check(id, family, surface, pass, detail) {
|
|
|
152
164
|
return { id, family, surface, pass: Boolean(pass), detail: detail ?? "" };
|
|
153
165
|
}
|
|
154
166
|
|
|
167
|
+
// A row that states a boundary rather than judging the run. It sits among the checks in the run record, and it never
|
|
168
|
+
// fails, so no failure list, delivery line or repair reads it.
|
|
169
|
+
function notice(id, family, surface, detail) {
|
|
170
|
+
return { ...check(id, family, surface, true, detail), notice: true };
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/** The rows written as notices. A run recorded before a row became one carries it as a failure; delivery skips it. */
|
|
174
|
+
export const NOTICE_IDS = new Set(["placement-rows-without-uri"]);
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Whether a delivery surface reports this check as failed: it failed, and it is not a notice. A run recorded before a
|
|
178
|
+
* row became a notice carries it as a failure, and its workbook, rebuilt, would say a check did not pass. PURE.
|
|
179
|
+
*/
|
|
180
|
+
export const deliveredFailure = (c) => Boolean(c) && !c.pass && !NOTICE_IDS.has(c.id);
|
|
181
|
+
|
|
155
182
|
// Template integrity (A2): NAME(S) populated; every searched name has its own assessment row; rating
|
|
156
183
|
// positions hold searched names, never adverse marks. Works on the parsed client-summary structures the
|
|
157
184
|
// email is assembled from (the email assembly itself is code we control).
|
|
@@ -187,11 +214,13 @@ export function templateChecks({ headerName, ratedNames, searchedNames }) {
|
|
|
187
214
|
// rule enumeration against the real texts; gameable by repetition, accepted — a false orphan is
|
|
188
215
|
// reader noise, the worse failure under the lint's posture, and a missed one costs one flag).
|
|
189
216
|
// Orphans are reported in ONE check so a noisy heuristic costs one flag line, not many.
|
|
190
|
-
|
|
217
|
+
// `introducedIn` is text outside the surface that still introduces a party to its reader: for the email, the report
|
|
218
|
+
// it links, outside the report's own action block.
|
|
219
|
+
export function referenceChecks({ actionsText, fullSurface, searchedNames, surface = "report", extraVocab = null, markNames = null, structural = false, introducedIn = "" }) {
|
|
191
220
|
const body = stripHtml(fullSurface);
|
|
192
221
|
const actions = stripHtml(actionsText);
|
|
193
222
|
const rest = body.replace(actions, " ");
|
|
194
|
-
const restN = norm(rest);
|
|
223
|
+
const restN = norm(`${rest} ${stripHtml(introducedIn)}`);
|
|
195
224
|
// sentence-segments for the contextualization rule: sentence ends, em/en-dash asides, semicolons
|
|
196
225
|
const segments = body.split(/(?<=[.!?])\s+|\s+[—–]\s+|;\s+/).map(norm);
|
|
197
226
|
const searchedN = (searchedNames ?? []).map(norm);
|
|
@@ -2000,11 +2029,14 @@ export function placementsChecks({ placements }) {
|
|
|
2000
2029
|
// only ever existed as a placement — and their absence read as a clean pass on all three.
|
|
2001
2030
|
//
|
|
2002
2031
|
// So this NEVER blocks and is never structural. It states the boundary, so a zero from a URI-keyed
|
|
2003
|
-
// gate is not read wider than it was measured.
|
|
2004
|
-
//
|
|
2032
|
+
// gate is not read wider than it was measured.
|
|
2033
|
+
//
|
|
2034
|
+
// A NOTICE, NOT A FAILURE (owner ruling, 2026-11-04). It flagged on presence, as a failing check, and so the
|
|
2035
|
+
// lawyer's workbook said "A machine check on the report did not pass." on runs where nothing had failed. It is now
|
|
2036
|
+
// recorded beside the checks, in the run record, with its count and its words, and no delivery surface reads it.
|
|
2005
2037
|
const withoutUri = placements.filter((e) => !(Array.isArray(e?.records) && e.records.length)).length;
|
|
2006
2038
|
if (placements.length && withoutUri) {
|
|
2007
|
-
out.push(
|
|
2039
|
+
out.push(notice("placement-rows-without-uri", "content-model", "placement",
|
|
2008
2040
|
`${withoutUri} of ${placements.length} placement row(s) name no record URI. This is expected for a common-law candidate (records: [] by contract) and is NOT a defect — it is a COVERAGE BOUNDARY: every URI-keyed carry gate in this driver is silent about these rows rather than clearing them, so a clean result from those gates says nothing about this ${withoutUri}. placement-carry's own join is what covers them; read its classes before treating any of this as carried.`));
|
|
2009
2041
|
}
|
|
2010
2042
|
return out;
|
|
@@ -2275,6 +2307,114 @@ export function actionsRegisterChecks({ actionsRegister, expected }) {
|
|
|
2275
2307
|
// the row ALWAYS PASSES — it exists so the receipt artifact and any reviewer can see where the assembly
|
|
2276
2308
|
// moved words, without triggering a repair loop or a gate. Emitted only when the run actually folded
|
|
2277
2309
|
// (archived/replay runs have no sidecar and never grow a row).
|
|
2310
|
+
// ── A FINDING WRITTEN ON GOODS THE REGISTER CUT, WHOSE WHOLE TEXT THE RUN NOW HOLDS ─────────────────────────
|
|
2311
|
+
//
|
|
2312
|
+
// A writer reads a record's goods as the band holds them, and a register's search answer can hold a long statement
|
|
2313
|
+
// cut, or not establish that it is whole. `goods-evidence.json` is written beside the band shape before the writer
|
|
2314
|
+
// writes, so it says which records the writer had that way. The record's whole body can arrive later: a fetch during
|
|
2315
|
+
// doubt closure, or the record closure just before this check. Measured 2026-11-03 on both engines: findings said a
|
|
2316
|
+
// class was "cut and unread" while the run went on to fetch that class whole, and nothing read the finding again.
|
|
2317
|
+
//
|
|
2318
|
+
// So a delivered finding is named, with the record's whole statements, for the writer's one repair at this check, when
|
|
2319
|
+
// both hold: it rests on such a record, now held whole, and its own text says part of its goods statement is cut or
|
|
2320
|
+
// unread (`claimsGoodsCut`). Both halves bound it. On the two saved runs that prompted this, the record half alone
|
|
2321
|
+
// named 22 and 34 findings, because half the band was cut and every cited record arrives whole by this check, while
|
|
2322
|
+
// the findings that reasoned on the missing part are the ones that say so: 3 and 8. A record whose held body still
|
|
2323
|
+
// says cut, or one the run does not hold, is not named. A record whose whole text was once handed to that repair
|
|
2324
|
+
// (`handed`, by uri) is not handed again: the check after the repair, and a resume, report its outcome instead
|
|
2325
|
+
// (corrected, unresolved, or no outcome established), whatever numbering the repair's save gives the findings.
|
|
2326
|
+
export function goodsHeldWholeChecks({ findings, goodsEvidence, recordsByUri, handed = null }) {
|
|
2327
|
+
const asWritten = new Map();
|
|
2328
|
+
for (const r of Array.isArray(goodsEvidence?.records) ? goodsEvidence.records : []) {
|
|
2329
|
+
const uri = normalizeRecordUri(r?.uri ?? r?.record_id);
|
|
2330
|
+
if (uri && r?.source === "search-row" && (r.state === "cut" || r.state === "unknown")) asWritten.set(uri, r.state);
|
|
2331
|
+
}
|
|
2332
|
+
const named = [], unresolved = [], corrected = [], handedCited = new Set();
|
|
2333
|
+
for (const f of Array.isArray(findings) ? findings : []) {
|
|
2334
|
+
if (!f || String(f.disposition ?? "") === "withdrawn" || !Number.isInteger(f.ordinal)) continue;
|
|
2335
|
+
const claims = claimsGoodsCut(f);
|
|
2336
|
+
for (const reg of Array.isArray(f?.owner?.registrations) ? f.owner.registrations : []) {
|
|
2337
|
+
const uri = normalizeRecordUri(reg?.uri ?? reg);
|
|
2338
|
+
if (!uri || !asWritten.has(uri)) continue;
|
|
2339
|
+
const body = recordsByUri?.get?.(uri) ?? null;
|
|
2340
|
+
const goods = body ? recordGoods(body, { english: untaggedIsEnglish(uri) }) : [];
|
|
2341
|
+
if (!goods.length || goods.some((g) => g?.cut || g?.unknown)) continue;
|
|
2342
|
+
// HANDED ONCE, AND THE OUTCOME KEPT. The repair is not run a second time for a record, and handing the text over
|
|
2343
|
+
// is not the defect resolved: a finding that still says its goods are cut or unread is unresolved, a row that
|
|
2344
|
+
// no repair takes (`structural`), and one that no longer says so is counted as corrected.
|
|
2345
|
+
if (handed?.has?.(uri)) {
|
|
2346
|
+
handedCited.add(uri);
|
|
2347
|
+
if (claims) unresolved.push({ ...check(`goods-held-whole-unresolved:${f.ordinal}:${uri}`, "goods-evidence", "narrative", false,
|
|
2348
|
+
`Finding ${f.ordinal} still says its goods are cut or unread after the delivery repair was given the complete goods statements of ${uri}.`),
|
|
2349
|
+
structural: true, ordinal: f.ordinal, uri });
|
|
2350
|
+
else corrected.push(`${f.ordinal}:${uri}`);
|
|
2351
|
+
continue;
|
|
2352
|
+
}
|
|
2353
|
+
if (!claims) continue;
|
|
2354
|
+
const state = asWritten.get(uri);
|
|
2355
|
+
named.push({ ...check(`goods-held-whole:${f.ordinal}:${uri}`, "goods-evidence", "narrative", false,
|
|
2356
|
+
goodsHeldWholeDetail(f.ordinal, uri, goods, state)), ordinal: f.ordinal, uri, goods, state });
|
|
2357
|
+
}
|
|
2358
|
+
}
|
|
2359
|
+
// A record handed to the repair that no delivered finding cites now has no outcome this check can establish.
|
|
2360
|
+
const noOutcome = [...(handed ?? [])].filter((u) => !handedCited.has(u));
|
|
2361
|
+
const summary = handed?.size
|
|
2362
|
+
? `${corrected.length} finding(s) given complete goods statements by the delivery repair no longer say their goods are cut or unread; `
|
|
2363
|
+
+ `${unresolved.length} still do`
|
|
2364
|
+
+ (noOutcome.length ? `; ${noOutcome.length} record(s) given to it are cited by no delivered finding, so no outcome is established for them` : "")
|
|
2365
|
+
: "no delivered finding says its goods are cut or unread while the run holds them complete";
|
|
2366
|
+
return [...named, ...unresolved, check("goods-held-whole", "goods-evidence", "narrative", true, summary)];
|
|
2367
|
+
}
|
|
2368
|
+
|
|
2369
|
+
const goodsStatements = (goods) => goods.map((g) => `${g.classes.length ? `Class ${g.classes.join(", ")}` : "Goods"}: "${g.text}"`).join(". ");
|
|
2370
|
+
|
|
2371
|
+
/** The line the writer's repair reads for one finding, in the numbering the writer's save takes. PURE. */
|
|
2372
|
+
export function goodsHeldWholeDetail(ordinal, uri, goods, state) {
|
|
2373
|
+
return `Finding ${ordinal} cites ${uri}. Its earlier goods evidence was ${state === "cut" ? "cut by the register" : "of unestablished completeness"}. `
|
|
2374
|
+
+ `The run now holds these complete goods statements from the register record: ${goodsStatements(goods)}. `
|
|
2375
|
+
+ "Reassess this finding's goods comparison on those statements, and correct any claim that they remain cut or unread. Change its rating only if the evidence requires it.";
|
|
2376
|
+
}
|
|
2377
|
+
|
|
2378
|
+
/**
|
|
2379
|
+
* The line for a grouped finding whose displayed text and whose citation of the record come from different members, in
|
|
2380
|
+
* the numbering the writer's save takes (design, 2026-11-04). The report displays the text of the member the fold kept,
|
|
2381
|
+
* so the repair must reach that member, and it names the member the citation comes from beside it. PURE.
|
|
2382
|
+
*/
|
|
2383
|
+
export function goodsHeldWholeGroupedDetail(shown, citing, uri, goods) {
|
|
2384
|
+
return `The displayed goods-text claim comes from finding ${shown}. The grouped finding cites ${uri} through finding ${citing}. `
|
|
2385
|
+
+ `The run now holds these complete goods statements from that register record: ${goodsStatements(goods)}. `
|
|
2386
|
+
+ `Correct the claim in finding ${shown} where these statements resolve it. Reassess finding ${citing}'s goods comparison only where those statements affect it. `
|
|
2387
|
+
+ "Change a rating only if the evidence requires it. Preserve unrelated findings and update only conclusions that depend on these changes.";
|
|
2388
|
+
}
|
|
2389
|
+
|
|
2390
|
+
/**
|
|
2391
|
+
* The goods line for one named finding: the member whose text the report displays (`shown`) and the member whose own
|
|
2392
|
+
* finding cites the record (`citing`), both in the writer's numbering. One finding's line where they are the same
|
|
2393
|
+
* member, both named where they differ, and null where either is not established: a member is never guessed. PURE.
|
|
2394
|
+
*/
|
|
2395
|
+
export function goodsRepairLine({ shown, citing, uri, goods, state }) {
|
|
2396
|
+
if (!Number.isInteger(shown) || !Number.isInteger(citing)) return null;
|
|
2397
|
+
return shown === citing ? goodsHeldWholeDetail(shown, uri, goods, state) : goodsHeldWholeGroupedDetail(shown, citing, uri, goods);
|
|
2398
|
+
}
|
|
2399
|
+
|
|
2400
|
+
/**
|
|
2401
|
+
* Does the finding's own text say part of its goods statement is cut or unread? A sentence that names the cut and a
|
|
2402
|
+
* part of a goods statement: "The consultancy list is cut", "a further research clause … is cut and unread", "before a
|
|
2403
|
+
* cut tail". A sentence that says something else is unread ("international designations are unread") is not one. PURE.
|
|
2404
|
+
*/
|
|
2405
|
+
const CUT_WORD_RE = /\b(?:cut|truncated|unread)\b/i;
|
|
2406
|
+
const GOODS_PART_RE = /\b(?:list|lists|clause|clauses|wording|specification|goods|services|class|classes|tail|remainder|statement|statements)\b/i;
|
|
2407
|
+
export function claimsGoodsCut(finding) {
|
|
2408
|
+
const texts = [];
|
|
2409
|
+
const walk = (v) => {
|
|
2410
|
+
if (typeof v === "string") texts.push(v);
|
|
2411
|
+
else if (Array.isArray(v)) v.forEach(walk);
|
|
2412
|
+
else if (v && typeof v === "object") for (const [k, x] of Object.entries(v)) if (k !== "owner") walk(x);
|
|
2413
|
+
};
|
|
2414
|
+
walk(finding);
|
|
2415
|
+
return texts.some((t) => t.split(/(?<=[.;!?])\s+/).some((sentence) => CUT_WORD_RE.test(sentence) && GOODS_PART_RE.test(sentence)));
|
|
2416
|
+
}
|
|
2417
|
+
|
|
2278
2418
|
export function cardBudgetChecks({ cardFolds }) {
|
|
2279
2419
|
const folds = Array.isArray(cardFolds) ? cardFolds : [];
|
|
2280
2420
|
if (!folds.length) return [];
|
|
@@ -2282,7 +2422,7 @@ export function cardBudgetChecks({ cardFolds }) {
|
|
|
2282
2422
|
`assembly folded ${folds.length} surface(s) to the level budgets (moved, never deleted): ${folds.map((f) => `${f.surface} → +${f.movedSentences} sentence(s)/${f.movedWords} word(s) into depth`).join("; ")}`)];
|
|
2283
2423
|
}
|
|
2284
2424
|
|
|
2285
|
-
export function runLint({ depth, commonLawGrid, matterContext, clientPartyName, reportMd, overviewMd = null, emailConditions = null, clientSummaryMd, narrativeMd, auditMd, recordsByUri, searchedNames, headerName, ratedNames, actionsText, fetchFailures, extraPlatformNames, findings, narrativeFindings = null, findingsRaw, actionsRegister, actionsExpected, intakeAsks, askAnswers, cardFolds, verdictDoc, manifest, seniorRights, seniorRightsExpected, markAssessment, markAssessmentExpected, fourAnswers, contentModelExpected, findingsSchemaVersion, placements, ownerScreen, recordCarry, commonLawCarries, searchedJurisdictions = null }) {
|
|
2425
|
+
export function runLint({ depth, commonLawGrid, matterContext, clientPartyName, reportMd, overviewMd = null, emailConditions = null, clientSummaryMd, narrativeMd, auditMd, recordsByUri, searchedNames, headerName, ratedNames, actionsText, fetchFailures, extraPlatformNames, findings, narrativeFindings = null, findingsRaw, actionsRegister, actionsExpected, intakeAsks, askAnswers, cardFolds, verdictDoc, manifest, seniorRights, seniorRightsExpected, markAssessment, markAssessmentExpected, fourAnswers, contentModelExpected, findingsSchemaVersion, placements, ownerScreen, recordCarry, commonLawCarries, searchedJurisdictions = null, goodsEvidence = null, goodsHanded = null }) {
|
|
2286
2426
|
// WS-B: the run's profile platforms join the vocabulary for this run. Profiles carry store
|
|
2287
2427
|
// DOMAINS by contract, so derive the name tokens a report would actually print: the raw norm
|
|
2288
2428
|
// ("thomasnetcom"), the separator-spaced phrase ("thomasnet com" / "made in china com"), and the
|
|
@@ -2336,10 +2476,17 @@ export function runLint({ depth, commonLawGrid, matterContext, clientPartyName,
|
|
|
2336
2476
|
// It used to be the report's two buckets, the methodology included, and so named a party from a line the email
|
|
2337
2477
|
// never carried. The caller hands the conditions in, from the function the email composes its box with
|
|
2338
2478
|
// (publish/email-conditions.mjs); a caller that hands none is not judged on the email.
|
|
2479
|
+
//
|
|
2480
|
+
// A PARTY THE REPORT INTRODUCES IS INTRODUCED TO THE EMAIL'S READER, who reaches the report from the email (owner
|
|
2481
|
+
// ruling, 2026-11-04). The report counts here as it counts for its own check: everything outside its action block,
|
|
2482
|
+
// so a condition cannot introduce itself through the report's copy of it. A report with no action block adds
|
|
2483
|
+
// nothing. Each condition is an item, written as one, so the word that opens it is read as an item's opening.
|
|
2339
2484
|
if (Array.isArray(emailConditions)) {
|
|
2340
|
-
const emailZone = emailConditions.join("\n");
|
|
2485
|
+
const emailZone = emailConditions.map((c) => `- ${c}`).join("\n");
|
|
2486
|
+
const reportZone = onlyYouZone(reportMd);
|
|
2341
2487
|
checks.push(...referenceChecks({
|
|
2342
2488
|
actionsText: emailZone, fullSurface: [emailZone, parseFront(String(reportMd)).fm.overall_caption, clientSummaryMd].filter(Boolean).join("\n"), searchedNames, surface: "email", extraVocab, markNames, structural: actionsExpected === true,
|
|
2489
|
+
introducedIn: reportZone ? String(reportMd).replace(reportZone, " ") : "",
|
|
2343
2490
|
}).map((c) => ({ ...c, id: `${c.id}:email` })));
|
|
2344
2491
|
}
|
|
2345
2492
|
}
|
|
@@ -2378,6 +2525,9 @@ export function runLint({ depth, commonLawGrid, matterContext, clientPartyName,
|
|
|
2378
2525
|
if (reportMd) checks.push(...permissionProseChecks({ text: reportMd, surface: "report" }));
|
|
2379
2526
|
if (clientSummaryMd) checks.push(...permissionProseChecks({ text: clientSummaryMd, surface: "client-summary", idSuffix: ":client" }));
|
|
2380
2527
|
if (narrativeMd) checks.push(...permissionProseChecks({ text: narrativeMd, surface: "narrative", idSuffix: ":narrative", structural: true }));
|
|
2528
|
+
// A finding written on goods the register cut, whose whole text the run holds now. Live runs only: the replay
|
|
2529
|
+
// harness passes no goods evidence, so an archived run never grows the check.
|
|
2530
|
+
if (goodsEvidence) checks.push(...goodsHeldWholeChecks({ findings, goodsEvidence, recordsByUri, handed: goodsHanded }));
|
|
2381
2531
|
// — the narrative's own depth rules, on the narrative surface so they route to the synthesis redo.
|
|
2382
2532
|
// Its finding headings are in the model's numbering, so they join the record the model wrote when the
|
|
2383
2533
|
// delivered record is folded (`narrativeFindings`), and the delivered record otherwise.
|
package/driver/publish/index.mjs
CHANGED
|
@@ -22,7 +22,7 @@ import { parseFrameworkManifest } from '../framework.mjs'; import { readFrozenMe
|
|
|
22
22
|
import { rollupTokens, servedModels } from '../tokens.mjs';
|
|
23
23
|
import { reportIdentityFor, productCoverageNote, isRegisterOnly } from '../search-policy.mjs';
|
|
24
24
|
import { readRecordArtifacts, bindFindingsToRecords, joinEvidenceStatus } from '../registry-fidelity.mjs';
|
|
25
|
-
import { deliveryFlagLines } from '../predelivery-lint.mjs';
|
|
25
|
+
import { deliveryFlagLines, deliveredFailure } from '../predelivery-lint.mjs';
|
|
26
26
|
import { unrenderableConditions, clientStatement } from '../terminal-clamp.mjs'; // — the conditions that reach no client surface
|
|
27
27
|
import { runLog } from '../log.mjs'; // — one line in the run record when one does
|
|
28
28
|
import { PROVIDERS, config } from '../driver.config.mjs';
|
|
@@ -1038,7 +1038,7 @@ export async function publishReport({ runId, codename, reportMd, auditMd, findin
|
|
|
1038
1038
|
// outcome and the text agree perfectly and both are short of a point. It says what happened on the
|
|
1039
1039
|
// gaps sheet and in the run record now, in the run record's own words, so the borrowed sentence
|
|
1040
1040
|
// comes off rather than being replaced by a better one (ruled 2026-09-17).
|
|
1041
|
-
lint: (lintSink?.checks ?? []).filter(c =>
|
|
1041
|
+
lint: (lintSink?.checks ?? []).filter(c => deliveredFailure(c) && c.id !== 'client-condition-dropped')
|
|
1042
1042
|
.map(c => ({ id: c.id ?? '', family: c.family ?? '', detail: c.detail ?? '' })),
|
|
1043
1043
|
engagement: integritySink?.engagement ?? null,
|
|
1044
1044
|
registryCorrections: Array.isArray(integritySink?.registryCorrections)
|
package/driver/record-fold.mjs
CHANGED
|
@@ -170,6 +170,23 @@ export function keptModelOrdinal(state, ordinal) {
|
|
|
170
170
|
return (state.merges ?? []).find((m) => members.includes(m?.kept))?.kept ?? null;
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
+
/**
|
|
174
|
+
* The model's ordinal behind a folded finding's citation of one record. A folded finding carries the citations of every
|
|
175
|
+
* member the fold merged into it, so the member it kept may not be the one that cites the record: the answer is the
|
|
176
|
+
* member whose own finding, in the model's record, cites `uri`, the kept member first. With no fold in force, or a
|
|
177
|
+
* finding folded with no other, the ordinal is `keptModelOrdinal`'s, whose finding is the one that cites it. Null where
|
|
178
|
+
* no member's finding is read citing the record: a citation the model's record does not show is not asserted.
|
|
179
|
+
* `cites(finding, uri)` says whether a finding of the model's record cites the record. PURE.
|
|
180
|
+
*/
|
|
181
|
+
export function citingModelOrdinal(state, ordinal, uri, modelFindings = [], cites = () => false) {
|
|
182
|
+
const kept = keptModelOrdinal(state, ordinal);
|
|
183
|
+
const members = state?.map?.foldedToModel?.[String(ordinal)];
|
|
184
|
+
if (!Array.isArray(members) || members.length < 2) return kept;
|
|
185
|
+
const byOrdinal = new Map((Array.isArray(modelFindings) ? modelFindings : []).map((f) => [f?.ordinal, f]));
|
|
186
|
+
const order = [...(members.includes(kept) ? [kept] : []), ...members.filter((m) => m !== kept)];
|
|
187
|
+
return order.find((m) => byOrdinal.has(m) && cites(byOrdinal.get(m), uri)) ?? null;
|
|
188
|
+
}
|
|
189
|
+
|
|
173
190
|
/** The fold as it stands, to put back if a pass that changed it is rolled back. Never throws. */
|
|
174
191
|
export function snapshotFold(runDir) {
|
|
175
192
|
const state = readFold(runDir);
|
package/driver/record-goods.mjs
CHANGED
|
@@ -22,6 +22,7 @@ import { normalizeRecordUri } from "./registry-fidelity.mjs";
|
|
|
22
22
|
import { foldDiacritics } from "./form-neighbourhood.mjs";
|
|
23
23
|
import { parseVariantManifestModel } from "./variant-manifest-model.mjs";
|
|
24
24
|
import { canonicalJurisdictionCode } from "./jurisdiction-codes.mjs";
|
|
25
|
+
import { savedStatusPages, savedPageStatement, usSerialOf } from "./saved-register-pages.mjs";
|
|
25
26
|
|
|
26
27
|
/**
|
|
27
28
|
* The registers whose language is English (ruled 2026-10-12): there, a goods statement with no language tag
|
|
@@ -209,23 +210,34 @@ export const goodsFor = (index, record) => index?.get(normalizeRecordUri(record?
|
|
|
209
210
|
* WHOLE ONLY WHERE THE ANSWER SAYS SO. The search answer our request asks for is the register's default, which it
|
|
210
211
|
* documents as "the first 280 characters" of each statement (docs.signa.so, Search Trademarks, "Response options",
|
|
211
212
|
* `include`: "`full_goods_services` returns the full goods and services text instead of the first 280
|
|
212
|
-
* characters")
|
|
213
|
+
* characters"). A row from such an answer reads as before: a statement shorter than 280 characters is whole, a
|
|
213
214
|
* flagged one is cut, and an unflagged one of 280 characters or more is marked `unknown: true`: its completeness is
|
|
214
215
|
* not established, and missing words in it establish nothing.
|
|
216
|
+
*
|
|
217
|
+
* A SEARCH NOW ASKS FOR THE FULL TEXT (providers/signa/src/core.js, buildSearchRequest), and its rows say so
|
|
218
|
+
* (`goods_whole: true`). On such a row an unflagged statement is whole at any length, and a flagged one is still cut.
|
|
219
|
+
*
|
|
220
|
+
* THE REGISTER'S OWN PAGE, WHERE THE RUN'S RESEARCH SAVED IT. `pages` are the status pages the run's research saved
|
|
221
|
+
* (saved-register-pages.mjs `savedStatusPages`). A statement cut or not established whole on a US record's row is read
|
|
222
|
+
* as the page's statement for its class, whole, where that statement begins with the row's own copy, and it carries the
|
|
223
|
+
* question that saved the page (`page: {question}`). A statement whole on the row is left as it is, and so is one no
|
|
224
|
+
* saved page continues.
|
|
215
225
|
*/
|
|
216
226
|
export const DEFAULT_ANSWER_CUT = 280;
|
|
217
|
-
export function rowGoods(row) {
|
|
227
|
+
export function rowGoods(row, pages = null) {
|
|
218
228
|
const classes = Array.isArray(row?.raw?.classifications) ? row.raw.classifications : null;
|
|
219
229
|
if (!classes) return null;
|
|
220
230
|
const english = untaggedIsEnglish(normalizeRecordUri(row?.record_id));
|
|
231
|
+
const serial = pages ? usSerialOf(row) : "";
|
|
221
232
|
const out = [];
|
|
222
233
|
for (const c of classes) {
|
|
223
234
|
const [g] = recordGoods({ _raw: { classifications: [c] } }, { english });
|
|
224
235
|
if (!g) continue;
|
|
225
236
|
const { cut: _cut, unknown: _unknown, ...whole } = g; // the row's own rule below, not the full record's
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
237
|
+
const mark = c?.goods_services_text_truncated === true ? { cut: true }
|
|
238
|
+
: row?.goods_whole !== true && [...String(c?.goods_services_text ?? "")].length >= DEFAULT_ANSWER_CUT ? { unknown: true } : null;
|
|
239
|
+
const page = mark && serial ? savedPageStatement(pages, serial, whole.classes[0], whole.text) : null;
|
|
240
|
+
out.push(page ? { ...whole, text: page.text, page: { question: page.question } } : { ...whole, ...mark });
|
|
229
241
|
}
|
|
230
242
|
return out.length ? out : null;
|
|
231
243
|
}
|
|
@@ -361,8 +373,10 @@ export function instructedOrder(P, job = null) {
|
|
|
361
373
|
* Any part that cannot be read is simply absent, and the shape sorts without it.
|
|
362
374
|
*
|
|
363
375
|
* A record's goods are its held body's, and where the run holds no body, the statements its band row carries
|
|
364
|
-
* (`rowGoods`). `held` says which: a line's goods
|
|
365
|
-
* record `band_record` can open. `records` are the
|
|
376
|
+
* (`rowGoods`), continued from the register's own pages the run's research saved. `held` says which: a line's goods
|
|
377
|
+
* are "on file" only where a body is held, because that is the record `band_record` can open. `records` are the
|
|
378
|
+
* band's, so the shape tests goods whenever either is held. The saved pages are read once, for the first record with
|
|
379
|
+
* no body held.
|
|
366
380
|
*/
|
|
367
381
|
export function bandShapeGoods(P, records = []) {
|
|
368
382
|
let model = null;
|
|
@@ -380,8 +394,10 @@ export function bandShapeGoods(P, records = []) {
|
|
|
380
394
|
const stems = true; // the word list the shape groups on is matched as stems, whichever source it came from
|
|
381
395
|
const hits = goodsWordCounter(words, { stems });
|
|
382
396
|
const held = (r) => goodsFor(index, r);
|
|
397
|
+
let pages = null;
|
|
398
|
+
const saved = () => (pages ??= savedStatusPages(P.runDir)());
|
|
383
399
|
const rowsHold = Array.isArray(records) && records.some((r) => r && typeof r === "object" && rowGoods(r));
|
|
384
|
-
const goods = index.size || rowsHold ? { of: (r) => held(r) ?? rowGoods(r), held: (r) => held(r) != null, hits, matched: goodsWordsMatched(words, { stems }) } : null;
|
|
400
|
+
const goods = index.size || rowsHold ? { of: (r) => held(r) ?? rowGoods(r, saved()), held: (r) => held(r) != null, hits, matched: goodsWordsMatched(words, { stems }) } : null;
|
|
385
401
|
const goodsTest = { source: product ? "product_words" : words.length ? "goods_words" : "none", words };
|
|
386
402
|
return { goods, goodsTest, goodsWordCount: words.length, dominantTerm: searched || manifestDominant, manifestDominant };
|
|
387
403
|
}
|
package/driver/register-plan.mjs
CHANGED
|
@@ -2456,7 +2456,7 @@ export function parseRegisterPlan(raw) {
|
|
|
2456
2456
|
// A NARROWING ASKS THE SAME QUESTION WITH TIGHTER LIMITS: the same predicate and the same terms, classes and markets
|
|
2457
2457
|
// within the parent's, and the parent's goods words or fewer of them (a parent with none takes the client's goods
|
|
2458
2458
|
// words, as the plan holds them), with the same owner. A list counts when its block is `enumerated`: complete, with no
|
|
2459
|
-
// error. Only lists reached through such narrowings count, at any depth.
|
|
2459
|
+
// error. Only lists reached through such narrowings count, at any depth, and a list covers only the markets it asked.
|
|
2460
2460
|
// list-retrieved a wider question with at least one narrowed list retrieved in full (named in `lists`).
|
|
2461
2461
|
// no-list a wider question with none: the reading step decides it, with its count on the record.
|
|
2462
2462
|
// required-covered the identical mark's own question, with a retrieved list in every class it asks, in
|
|
@@ -2558,10 +2558,15 @@ export function crowdNarrowing(plan, byQid, { mainMarkets = [] } = {}) {
|
|
|
2558
2558
|
const inScope = main.length ? (scope.length ? main.filter((m) => scope.includes(m)) : main) : [];
|
|
2559
2559
|
const cellMarkets = inScope.length ? inScope : (scope.length ? scope : [WORLDWIDE]);
|
|
2560
2560
|
const cellClasses = classesOf(e).length ? classesOf(e) : ["*"];
|
|
2561
|
+
// A LIST COVERS ONLY THE MARKETS IT ASKED. A register can answer a list narrowed by goods with offices left out, and
|
|
2562
|
+
// the list's block names them (`offices_without_goods_field`). The list is complete for the offices it asked and read
|
|
2563
|
+
// none of the others, so it covers neither those markets nor a worldwide cell. Counted on its plan's markets, a list
|
|
2564
|
+
// that never asked a client's main market stood as that market's required read.
|
|
2565
|
+
const leftOutOf = (d) => marketsOf(byQid.get(d.qid)?.offices_without_goods_field);
|
|
2561
2566
|
const covers = (c, m) => lists.some((d) => {
|
|
2562
|
-
const dc = classesOf(d), dr = regionsOf(d);
|
|
2567
|
+
const dc = classesOf(d), dr = regionsOf(d), out = leftOutOf(d);
|
|
2563
2568
|
const classOk = c === "*" ? !dc.length : (!dc.length || dc.includes(c));
|
|
2564
|
-
const marketOk = m === WORLDWIDE ? !dr.length : (!dr.length || dr.includes(m));
|
|
2569
|
+
const marketOk = m === WORLDWIDE ? !dr.length && !out.length : (!dr.length || dr.includes(m)) && !out.includes(m);
|
|
2565
2570
|
return classOk && marketOk;
|
|
2566
2571
|
});
|
|
2567
2572
|
const notCovered = [];
|
|
@@ -133,6 +133,9 @@ const restingLine = (r) => {
|
|
|
133
133
|
|
|
134
134
|
// `adds`: the correction answering a review's flags, whose save may add the finding for an excluded position they name;
|
|
135
135
|
// the correction after the review of a repair is handed no positions and keeps the words for a replacement.
|
|
136
|
+
// Step 4 of the correction, and the same step in its re-emit: design's wording (2026-11-03).
|
|
137
|
+
const ANSWERS_STEP = `When you add, change, or withdraw a finding, check the answers in \`four_answers\` that depend on that change. Bring each affected answer's \`ordinals\`, \`basis\`, and \`read\` into line with the corrected findings; change its \`token\` and any registrability \`obstacles\` only if the corrected judgment requires it. A shared risk band alone does not make a finding a basis for an answer. If you update an answer, send the complete \`four_answers\` object in the same PATCH, inside the call's \`findings\` object beside the "corrections" marker, preserving every unaffected answer exactly as it stands in the accepted record. Do not reopen unaffected findings or repeat the investigation.`;
|
|
138
|
+
|
|
136
139
|
const correctiveRules = ({ narrative, findings, placement, rulingsTail, adds = false }) => [
|
|
137
140
|
// ── — THE PASS THAT WRITES THE DEFECT ──────────────────────────────────
|
|
138
141
|
//
|
|
@@ -179,6 +182,11 @@ const correctiveRules = ({ narrative, findings, placement, rulingsTail, adds = f
|
|
|
179
182
|
// rewording a note keeps its claims, and the text says so, or the seat reads the two as a conflict
|
|
180
183
|
// and does nothing, which is what it did.
|
|
181
184
|
`3. A flag about a line the reader sees that is NOT a finding — a coverage row's "note", an action's "text", or the mark assessment's "distinctiveness" or "connotation" — is applied in the same PATCH, inside the call's \`findings\` object beside the "corrections" marker: send the complete \`coverage\` array (every row, the unflagged ones exactly as you last sent them), the complete \`actions\` array, or the complete \`mark_assessment\` object, with the flagged line rewritten. A row left out of the array is a row deleted, so send every row. Rewording a coverage note is NOT reopening the coverage account: keep its area, its state and every fact it states, and change only how it says them. A flagged line you leave as written is named in the "corrections" note with the reason, as the flag names it — for example: the coverage line for "<area>": no-change-because …`,
|
|
185
|
+
// THE ANSWERS THAT NAME THE FINDINGS. The four answers cite the findings they rest on by ordinal, and step 3 names
|
|
186
|
+
// the other registers a correction may send but not this one, so a correction that raised a finding to High left
|
|
187
|
+
// the third-party-rights answer naming findings 1 to 3 (test run, 2026-11-03). The transport always took it. Design's
|
|
188
|
+
// wording (2026-11-03), approved under the owner's delegation; the re-emit below carries the same step.
|
|
189
|
+
`4. ${ANSWERS_STEP}`,
|
|
182
190
|
// ── CONVERTED. `editRepairTail` stood here and ordered targeted Edits of
|
|
183
191
|
// both files. The seat holds no Edit for either any more — but the ECONOMICS that argued for a
|
|
184
192
|
// targeted edit are preserved rather than lost, which is why the call has a patch shape at all:
|
|
@@ -186,7 +194,7 @@ const correctiveRules = ({ narrative, findings, placement, rulingsTail, adds = f
|
|
|
186
194
|
// on the serial critical path, and a conversion that answered it with "re-send everything
|
|
187
195
|
// through a tool" would have paid that cost back in a different currency. The driver holds the
|
|
188
196
|
// accepted values; the seat sends what changed.
|
|
189
|
-
`Send it all in ONE \`record_synthesis\` PATCH call, sending only the change: \`narrative\` carrying only the sections you corrected; \`findings_patch\` carrying ${patchRows(adds)}; and \`findings\` carrying the "corrections" marker and any register from
|
|
197
|
+
`Send it all in ONE \`record_synthesis\` PATCH call, sending only the change: \`narrative\` carrying only the sections you corrected; \`findings_patch\` carrying ${patchRows(adds)}; and \`findings\` carrying the "corrections" marker and any register from steps 3 and 4, complete, and never a \`findings[]\` list. The driver merges this patch into the last accepted record, keeps the values the patch does not replace, and renders both files. There is no file to write or edit and nothing you write by hand is read.`,
|
|
190
198
|
// 2026-07-04 (the VENZY corrective thrash): three attempts died inventing three different keys
|
|
191
199
|
// while trying to EXPRESS a hold. The contract is closed and every correction is expressible
|
|
192
200
|
// inside it — say so.
|
|
@@ -199,6 +207,8 @@ const correctiveRules = ({ narrative, findings, placement, rulingsTail, adds = f
|
|
|
199
207
|
) : "",
|
|
200
208
|
];
|
|
201
209
|
|
|
210
|
+
const andList = (xs) => (xs.length < 2 ? xs.join("") : `${xs.slice(0, -1).join(", ")} and ${xs[xs.length - 1]}`);
|
|
211
|
+
|
|
202
212
|
export const REPAIR_COMPOSERS = [
|
|
203
213
|
{
|
|
204
214
|
trigger: "corrective-findings",
|
|
@@ -211,9 +221,10 @@ export const REPAIR_COMPOSERS = [
|
|
|
211
221
|
// `adds` on the first correction's own follow-up, whose save may add the finding for an excluded position its flags
|
|
212
222
|
// name; the correction after the review of a repair is handed none, and its follow-up keeps the words for a replacement.
|
|
213
223
|
compose: ({ findings, named, seniorEyeReview, adds = false }) => lines(
|
|
214
|
-
`This is a fresh session: your earlier synthesis is not in your context, and the driver holds the record it last accepted from you. Your corrective pass updated the narrative but did NOT re-emit ${findings} — the structured findings
|
|
215
|
-
`Apply each flag to the finding objects it names: correct the fields, or set "disposition": "withdrawn" + "withdrawn_reason" for a killed finding, and add the "corrections": {"applied": true, "note": "…"} marker inside the call's \`findings\` object. Change
|
|
216
|
-
|
|
224
|
+
`This is a fresh session: your earlier synthesis is not in your context, and the driver holds the record it last accepted from you. Your corrective pass updated the narrative but did NOT re-emit ${findings} — the structured findings record this correction updates. The review named: ${named.join(", ")}. Its flags are in ${seniorEyeReview}; open it and ${findings} for the findings it names.`,
|
|
225
|
+
`Apply each flag to the finding objects it names: correct the fields, or set "disposition": "withdrawn" + "withdrawn_reason" for a killed finding, and add the "corrections": {"applied": true, "note": "…"} marker inside the call's \`findings\` object. Change only the flagged findings and the answers that depend on those changes.`,
|
|
226
|
+
`${ANSWERS_STEP}`,
|
|
227
|
+
`Send the correction with \`record_synthesis\`, sending only the change: a PATCH call carrying \`findings_patch\` — ${patchRows(adds)} — and \`findings\` carrying the "corrections" marker and, when affected, the complete \`four_answers\` object. The driver merges this patch into the last accepted record, keeps the values the patch does not replace, and renders both files. There is no file for you to write or edit and nothing you write by hand is read.`,
|
|
217
228
|
),
|
|
218
229
|
samples: [{ name: "the standard re-emit demand", tail: "tool",
|
|
219
230
|
args: { findings: "findings.json", named: ["#1", "#4"], seniorEyeReview: "senior-eye-review.md" } },
|
|
@@ -240,6 +251,40 @@ export const REPAIR_COMPOSERS = [
|
|
|
240
251
|
+ "guard proven at n=1 is proven against nothing about ordering, dedup or cross-composer "
|
|
241
252
|
+ "interaction, and the census reds if this stage gains a second one without this note being read.",
|
|
242
253
|
},
|
|
254
|
+
{
|
|
255
|
+
trigger: "corrective-answers",
|
|
256
|
+
stage: "synthesis",
|
|
257
|
+
key: "synthesis:corrective-answers",
|
|
258
|
+
// THE ONE RE-ASK, WHEN THE FINDINGS MOVED AND AN ANSWER DID NOT. `answersLeftBehind` lists, per answer that cites
|
|
259
|
+
// findings, the findings the correction moved that the answer may depend on. They are possible missing dependencies,
|
|
260
|
+
// not citations owed: the writer updates the answers that depend on them, or says why not. The instruction and save
|
|
261
|
+
// paragraphs are design's wording (2026-11-03), approved under the owner's delegation.
|
|
262
|
+
compose: ({ findings, answers = [] }) => {
|
|
263
|
+
const changed = new Map();
|
|
264
|
+
for (const a of answers) {
|
|
265
|
+
for (const u of a.uncited) changed.set(u.ordinal, `finding ${u.ordinal}, now ${u.band}`);
|
|
266
|
+
for (const w of a.withdrawn) changed.set(w, `finding ${w}, now withdrawn`);
|
|
267
|
+
}
|
|
268
|
+
const facts = answers.map((a) => {
|
|
269
|
+
const parts = [];
|
|
270
|
+
if (a.uncited.length) parts.push(`names finding${a.cited.length === 1 ? "" : "s"} ${andList(a.cited)}, rated ${a.floor} and above, and not finding${a.uncited.length === 1 ? "" : "s"} ${andList(a.uncited.map((u) => u.ordinal))}`);
|
|
271
|
+
if (a.withdrawn.length) parts.push(`still names finding${a.withdrawn.length === 1 ? "" : "s"} ${andList(a.withdrawn)}, which the correction withdrew`);
|
|
272
|
+
return `- \`${a.answer}\` ${parts.join("; ")}.`;
|
|
273
|
+
});
|
|
274
|
+
return lines(
|
|
275
|
+
`This is a fresh session: your earlier synthesis is not in your context, and the driver holds the record it last accepted from you, in ${findings}. Your correction changed ${[...changed.entries()].sort((x, y) => x[0] - y[0]).map(([, t]) => t).join("; ")}. These answers in \`four_answers\` may be missing a dependency on those findings:`,
|
|
276
|
+
...facts,
|
|
277
|
+
`Check which answers in \`four_answers\` depend on these corrected findings. Update each affected answer's \`ordinals\`, \`basis\`, and \`read\`, and its \`token\` and any registrability \`obstacles\` if the corrected judgment requires it. A shared risk band alone does not require a citation. If an answer does not depend on a finding named above, keep that answer and explain why in the "corrections" note. Preserve the correction reasons already recorded. Do not reopen the findings or repeat the investigation.`,
|
|
278
|
+
`Send the answer changes with \`record_synthesis\` in one PATCH call: \`findings\` carrying the complete \`four_answers\` object, with every unaffected answer exactly as it stands in the accepted record, and the "corrections" marker; no \`findings_patch\` and never a \`findings[]\` list. The driver merges this patch into the last accepted record and renders both files. There is no file for you to write or edit and nothing you write by hand is read.`,
|
|
279
|
+
);
|
|
280
|
+
},
|
|
281
|
+
samples: [{ name: "one answer, one finding the correction raised", tail: "tool",
|
|
282
|
+
args: { findings: "findings.json", answers: [{ answer: "third_party_rights", cited: [1, 2, 3], floor: "High", uncited: [{ ordinal: 4, band: "High" }], withdrawn: [] }] } },
|
|
283
|
+
{ name: "several answers, findings raised, added and withdrawn", tail: "tool",
|
|
284
|
+
args: { findings: "findings.json", answers: [
|
|
285
|
+
{ answer: "third_party_rights", cited: [1, 2, 3], floor: "Moderate", uncited: [{ ordinal: 39, band: "Moderate" }, { ordinal: 41, band: "Moderate" }], withdrawn: [] },
|
|
286
|
+
{ answer: "objection_likelihood", cited: [1, 7], floor: "Moderate", uncited: [], withdrawn: [7] }] } }],
|
|
287
|
+
},
|
|
243
288
|
{
|
|
244
289
|
trigger: "schema-downlevel",
|
|
245
290
|
stage: "synthesis",
|
|
@@ -510,9 +555,18 @@ export const REPAIR_COMPOSERS = [
|
|
|
510
555
|
: `This is a fresh session: your earlier ${label} work is not in your context — ${file} is already written and the deterministic pre-delivery lint failed these checks on it:`,
|
|
511
556
|
...failures.map((f) => `- ${f.finding != null ? `finding ${f.finding}: ` : ""}${f.detail || f.id}`),
|
|
512
557
|
toolWritten?.tool === "record_synthesis" ? `Read ${findings} and ${narrative}, then correct the finding or narrative section that owns each fault.` : "",
|
|
558
|
+
// THE ANSWERS RIDE THE WRITER'S ONE REPAIR HERE TOO: a fix that changes a finding (a goods reading refreshed from a
|
|
559
|
+
// record now held whole, among others) reaches the answers that depend on it, in the correction's own step 4.
|
|
560
|
+
toolWritten?.tool === "record_synthesis" ? ANSWERS_STEP : "",
|
|
513
561
|
`Where a check quotes the fetched record's true value, correct the identifier to the record's value EXACTLY (the record is the only permitted source for registry identifiers).`,
|
|
514
|
-
|
|
515
|
-
|
|
562
|
+
// THE WRITER'S RATING LINE ALLOWS A GOODS REASSESSMENT. Read beside a check that hands newly available goods
|
|
563
|
+
// text, "never re-derive" overrode the repair it sits in; the writer's branch says which check does what.
|
|
564
|
+
toolWritten?.tool === "record_synthesis"
|
|
565
|
+
? `Where a check identifies a mismatch in a copied risk tier or Level/Composite label, copy the quoted finding value exactly. Where a check supplies newly available goods text, reassess only the affected finding on that text; change its rating only if the evidence requires it.`
|
|
566
|
+
: `Risk tiers and Level/Composite labels are COPIED from the findings values quoted in the check — never re-derive or re-word them.`,
|
|
567
|
+
toolWritten?.tool === "record_synthesis"
|
|
568
|
+
? `Fix ONLY what the checks name, and the answers that depend on those changes; change nothing else.`
|
|
569
|
+
: `Fix ONLY what the checks name; change nothing else.`,
|
|
516
570
|
// THE WRITER'S SAVE MERGES A PATCH; EVERY OTHER TOOL HERE TAKES ITS WHOLE PAYLOAD. `record_synthesis`
|
|
517
571
|
// holds the record it last accepted and merges a patch into it, so the writer sends only the change, in
|
|
518
572
|
// the shape its correction message uses. The other tools a delivery repair reaches render their artifact
|
|
@@ -925,7 +979,7 @@ export function repairFollowup(key, args) {
|
|
|
925
979
|
if (!c) {
|
|
926
980
|
throw new Error(`[repair-composers] no registered composer for "${key}". A bespoke repair `
|
|
927
981
|
+ `instruction must be registered in driver/repair-composers.mjs before it can reach a seat — an `
|
|
928
|
-
+ `unregistered composer is invisible to the
|
|
982
|
+
+ `unregistered composer is invisible to the recording-agreement guard, which walks only the registry.`);
|
|
929
983
|
}
|
|
930
984
|
return c.compose(args ?? {});
|
|
931
985
|
}
|