clearotron 0.6.0 → 0.7.0-beta.1
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/INSTALL.md +7 -4
- package/QUICKSTART.md +1 -0
- package/README.md +5 -2
- package/THIRD-PARTY-NOTICES.md +1 -1
- package/bin/clearotron.mjs +4 -2
- package/bin/onboard.mjs +158 -29
- package/build-info.json +2 -2
- package/docs/CLIENT-MCP.md +3 -1
- package/docs/DELIVERY.md +6 -3
- package/docs/architecture/02-architecture.md +1 -1
- package/docs/architecture/04-configuration-reference.md +105 -8
- package/docs/branding.md +4 -4
- package/docs/report-data/clearance-1.schema.json +320 -0
- package/docs/report-data/knockout-1.schema.json +268 -0
- package/driver/CHANGELOG.md +77 -0
- package/driver/cancel.mjs +19 -0
- package/driver/connotation-search.mjs +1 -1
- package/driver/contract-e3-backlog.mjs +41 -41
- package/driver/contract-vocabulary.mjs +1 -1
- package/driver/coverage-ledger.mjs +18 -2
- package/driver/deferral-row.mjs +1 -1
- package/driver/degraded-parts.mjs +1 -0
- package/driver/driver.config.mjs +5 -5
- package/driver/effective-scope.mjs +3 -1
- package/driver/engagement-receipt.mjs +3 -3
- package/driver/engine/anthropic-agent.mjs +15 -1
- package/driver/engine/common.mjs +7 -0
- package/driver/engine/mcp/band-server.mjs +7 -16
- package/driver/engine/mcp/codex-config.mjs +3 -0
- package/driver/engine/mcp/recording-server.mjs +45 -34
- package/driver/engine/openai-agent.mjs +74 -7
- package/driver/engine/session-record.mjs +44 -2
- package/driver/findings-model.mjs +14 -2
- package/driver/follow-up-twins.mjs +86 -0
- package/driver/gateway.mjs +77 -12
- package/driver/jx-units.mjs +3 -1
- package/driver/jx.mjs +13 -5
- package/driver/manuals-inline.mjs +98 -0
- package/driver/manuals-seen.mjs +134 -0
- package/driver/mark-logos.mjs +174 -0
- package/driver/methodology-witness.mjs +2 -1
- package/driver/owner-use-check.mjs +8 -4
- package/driver/package.json +1 -1
- package/driver/pipeline-knockout.mjs +23 -4
- package/driver/pipeline.mjs +128 -15
- package/driver/portal-local-auth.mjs +6 -2
- package/driver/portal-report.mjs +45 -14
- package/driver/portal-routes/me.mjs +4 -1
- package/driver/portal-runs.mjs +19 -16
- package/driver/predelivery-lint.mjs +7 -5
- package/driver/profiles.mjs +4 -4
- package/driver/publish/README.md +9 -7
- package/driver/publish/email-conditions.mjs +22 -5
- package/driver/publish/evidence-words.mjs +21 -0
- package/driver/publish/index.mjs +304 -211
- package/driver/publish/knockout.mjs +297 -247
- package/driver/publish/office-record-links.mjs +11 -9
- package/driver/publish/page-shell.mjs +98 -0
- package/driver/publish/pool-admin.mjs +2 -2
- package/driver/publish/publish-inputs.mjs +4 -0
- package/driver/publish/regions.mjs +28 -3
- package/driver/publish/register-record-html.mjs +105 -0
- package/driver/publish/register-record.mjs +165 -0
- package/driver/publish/render-knockout.mjs +299 -671
- package/driver/publish/render.mjs +561 -492
- package/driver/publish/report-data.mjs +226 -13
- package/driver/publish/report-document.mjs +353 -0
- package/driver/publish/search-depth.mjs +88 -7
- package/driver/publish/shell.mjs +41 -1
- package/driver/publish/strings.mjs +810 -0
- package/driver/publish/templates/clearance-print.css +23 -0
- package/driver/publish/templates/knockout.css +224 -0
- package/driver/publish/templates/report.css +112 -53
- package/driver/publish/xlsx.mjs +158 -139
- package/driver/record-goods.mjs +42 -0
- package/driver/reference-score.mjs +4 -1
- package/driver/register-count.mjs +5 -1
- package/driver/register-reach.mjs +39 -0
- package/driver/registry-fidelity.mjs +155 -37
- package/driver/repair-composers.mjs +7 -3
- package/driver/repair-targets.mjs +4 -1
- package/driver/replay-archive.mjs +4 -3
- package/driver/run-delivered.mjs +14 -8
- package/driver/run-record.mjs +1 -0
- package/driver/runner.mjs +73 -29
- package/driver/scope-facts.mjs +27 -6
- package/driver/search-policy.mjs +9 -4
- package/driver/skills/clearance-search/report-prose.md +3 -0
- package/driver/skills/knockout-assess/SKILL.md +8 -0
- package/driver/stage-freshness.mjs +8 -5
- package/driver/stages.mjs +69 -43
- package/driver/steps/delivery.mjs +9 -5
- package/driver/steps/overview-and-cards.mjs +54 -15
- package/driver/steps/register-sweep.mjs +5 -4
- package/driver/steps/skeptic-and-follow-up.mjs +3 -2
- package/driver/steps/verdict-gate.mjs +35 -14
- package/driver/suite-census.json +579 -87
- package/driver/synthesis-record.mjs +4 -3
- package/driver/terminal-clamp.mjs +6 -1
- package/driver/withdrawn-rating.mjs +72 -0
- package/mcp-server/CHANGELOG.md +8 -0
- package/mcp-server/lib/audit-view.mjs +5 -2
- package/mcp-server/lib/brief.mjs +6 -2
- package/mcp-server/lib/evidence.mjs +94 -23
- package/mcp-server/lib/findings.mjs +19 -2
- package/mcp-server/lib/knockout.mjs +13 -4
- package/mcp-server/lib/scrub.mjs +1 -1
- package/mcp-server/package.json +1 -1
- package/mcp-server/server.mjs +22 -3
- package/package.json +4 -1
- package/portal-ui/dist/assets/{index-CYaO2ygd.js → index-BBlN4CYq.js} +238 -80
- package/portal-ui/dist/assets/{index-izLa9apq.css → index-CxAkJXIT.css} +25 -5
- package/portal-ui/dist/index.html +2 -2
- package/portal-ui/package.json +3 -3
- package/providers/_shared/ledger.mjs +30 -2
- package/providers/_shared/record-uri.mjs +15 -0
- package/providers/clarivate/src/adapter.js +11 -0
- package/providers/clarivate/src/core.js +17 -1
- package/providers/jx/src/core.js +4 -4
- package/providers/jx/src/judge.js +1 -3
- package/providers/jx/src/nativeread.js +1 -3
- package/providers/oauth-mcp-bridge/CHANGELOG.md +8 -0
- package/providers/oauth-mcp-bridge/package.json +1 -1
- package/scripts/README.md +147 -3
- package/scripts/added-reference-check.mjs +35 -7
- package/scripts/e2e-first-time.mjs +4 -4
- package/scripts/env-audit.mjs +16 -9
- package/scripts/freeze-example-run.mjs +3 -3
- package/scripts/mint-public-residue.mjs +3 -3
- package/scripts/mint-search-level-tags.mjs +61 -0
- package/scripts/mint-source-pin-census.mjs +89 -0
- package/scripts/release-note-required.mjs +65 -6
- package/scripts/test-durations-reporter.mjs +25 -0
- package/scripts/test-full.mjs +72 -18
- package/scripts/test-run.mjs +18 -1
- package/shared/brand.mjs +93 -6
- package/shared/inline-markdown.mjs +53 -0
- package/shared/names-in-force.mjs +0 -1
- package/shared/portal-tokens.mjs +2 -1
- package/shared/reference-guard-classes.mjs +43 -2
- package/shared/register-selection.mjs +8 -3
- package/shared/search-level-tags.json +25 -0
- package/shared/source-spans.mjs +91 -0
- package/shared/tools/derive-band-pairs.mjs +10 -0
- package/driver/own-rights.mjs +0 -83
- package/driver/use-check.mjs +0 -85
package/scripts/test-run.mjs
CHANGED
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
import { spawn } from "node:child_process";
|
|
49
49
|
import { mkdtempSync, mkdirSync, rmSync, readdirSync, statSync, existsSync, readFileSync, symlinkSync, copyFileSync, chmodSync, writeFileSync, realpathSync } from "node:fs";
|
|
50
50
|
import { delimiter, dirname, join, parse as parsePath, resolve, sep } from "node:path";
|
|
51
|
-
import { fileURLToPath } from "node:url";
|
|
51
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
52
52
|
import { tmpdir, homedir } from "node:os";
|
|
53
53
|
import { snapshotRepo, repoWrites, explainRepoWrites, snapshotHome, explainHomeWrites } from "./repo-writes.mjs";
|
|
54
54
|
|
|
@@ -213,6 +213,23 @@ if (process.env.CT_COVERAGE_DIR && argv.includes("--test")) {
|
|
|
213
213
|
console.error(`[test-run] coverage on — ${join(dir, name)}`);
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
+
// ── — EACH FILE'S DURATION ON REQUEST, SO THE SHARDS CAN BE DEALT BY IT ───────────────────────────
|
|
217
|
+
//
|
|
218
|
+
// `CT_DURATIONS_DIR` adds `scripts/test-durations-reporter.mjs`, which writes one JSON line per test file with its
|
|
219
|
+
// summed test time; `scripts/measure-test-durations.mjs` builds the shard table from what a CI run kept. Additive for
|
|
220
|
+
// the reason coverage is: naming a reporter silences the default TAP, so TAP is named too, once. One file per
|
|
221
|
+
// invocation, by directory and process, because a shard runs several corpora through this wrapper.
|
|
222
|
+
if (process.env.CT_DURATIONS_DIR && argv.includes("--test")) {
|
|
223
|
+
const dir = process.env.CT_DURATIONS_DIR;
|
|
224
|
+
mkdirSync(dir, { recursive: true });
|
|
225
|
+
const name = `${parsePath(process.cwd()).base || "root"}-${process.pid}.jsonl`;
|
|
226
|
+
// A file URL, not a path: on Windows a drive letter reads as a URL scheme.
|
|
227
|
+
const reporter = pathToFileURL(join(dirname(fileURLToPath(import.meta.url)), "test-durations-reporter.mjs")).href;
|
|
228
|
+
const tap = argv.includes("--test-reporter=tap") ? [] : ["--test-reporter=tap", "--test-reporter-destination=stdout"];
|
|
229
|
+
argv.splice(argv.indexOf("--test") + 1, 0, ...tap,
|
|
230
|
+
`--test-reporter=${reporter}`, `--test-reporter-destination=${join(dir, name)}`);
|
|
231
|
+
}
|
|
232
|
+
|
|
216
233
|
// ── THE TEST RUN DECLARES ITS REGISTER PROVIDER ───────────────────────────────────────────
|
|
217
234
|
//
|
|
218
235
|
// `CLEAROTRON_DATABASE` has no default any more. It used to fall back to "corsearch" inside
|
package/shared/brand.mjs
CHANGED
|
@@ -253,6 +253,76 @@ export const PALETTE_DARK = {
|
|
|
253
253
|
codeBg: 'rgba(236,229,216,.08)',// parchment at 8%
|
|
254
254
|
};
|
|
255
255
|
|
|
256
|
+
// — THE RISK RAMP, ONE SOURCE FOR EVERY SURFACE. Five stops, lowest first, keyed as the report's tokens are
|
|
257
|
+
// (--clear … --severe). The report's tokens below read these, and so do the emails, the staff index and the
|
|
258
|
+
// audit workbook, which each used to draw bands in a palette of their own (2026-11-18). A band's TONE picks
|
|
259
|
+
// its stop: minimal → clear, low → low, medium → med, high → high, severe → severe.
|
|
260
|
+
export const BAND_BY_TONE = Object.freeze({ minimal: 'clear', low: 'low', medium: 'med', high: 'high', severe: 'severe' });
|
|
261
|
+
export const BAND_RAMP = Object.freeze({ clear: '#5F8A64', low: '#8A9440', med: '#C8871B', high: '#B23A2E', severe: '#7C1E15' });
|
|
262
|
+
export const BAND_RAMP_DARK = Object.freeze({ clear: '#7EA382', low: '#A8B25A', med: '#DDA13E', high: '#CA594E', severe: '#A22D22' });
|
|
263
|
+
// The text on a band's fill, chosen per stop for contrast, light and dark.
|
|
264
|
+
export const BAND_ON = Object.freeze({ clear: PALETTE.ink, low: PALETTE.ink, med: PALETTE.ink, high: '#fff', severe: '#fff' });
|
|
265
|
+
export const BAND_ON_DARK = Object.freeze({ clear: PALETTE.ink, low: PALETTE.ink, med: PALETTE.ink, high: PALETTE.ink, severe: '#fff' });
|
|
266
|
+
// The soft fill a chip sits on and the text on it, derived from the bases by the rule in
|
|
267
|
+
// shared/tools/derive-band-pairs.mjs.
|
|
268
|
+
export const BAND_SOFT = Object.freeze({ clear: '#E0E8E1', med: '#F4E8D4', high: '#F1DAD8' });
|
|
269
|
+
export const BAND_SOFT_TEXT = Object.freeze({ clear: '#38553B', med: '#82550A', high: '#742018' });
|
|
270
|
+
// A band's word as coloured text on white, as the emails print it: the base itself where it reads 4.5:1 on
|
|
271
|
+
// white, and otherwise its darker text value by the same rule. Darkening every stop would print High and
|
|
272
|
+
// Very High in one dark red.
|
|
273
|
+
export const BAND_TEXT = Object.freeze({ clear: '#38553B', low: '#5E6527', med: '#82550A', high: '#B23A2E', severe: '#7C1E15' });
|
|
274
|
+
|
|
275
|
+
// — THE EMAILS' AND THE WORKBOOK'S OTHER COLOURS, NAMED FOR WHERE THEY ARE USED. Each surface drew with its own
|
|
276
|
+
// literals, so a re-skin that edited this file still missed them.
|
|
277
|
+
|
|
278
|
+
/** The email risk tiers, on the report's ramp: the cell fill, the text on it, and the band's word as text. */
|
|
279
|
+
const emailTier = (stop) => Object.freeze({ bg: BAND_RAMP[stop], fg: BAND_ON[stop], txt: BAND_TEXT[stop] });
|
|
280
|
+
export const EMAIL_TIER = Object.freeze({
|
|
281
|
+
veryHigh: emailTier('severe'),
|
|
282
|
+
high: emailTier('high'),
|
|
283
|
+
medium: emailTier('med'),
|
|
284
|
+
manageable: emailTier('low'),
|
|
285
|
+
low: emailTier('clear'),
|
|
286
|
+
unrated: Object.freeze({ bg: '#bfbfbf', fg: '#000', txt: '#555' }),
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
/** The emails' other colours: the clearance cover note's links, headline and boxes, and the access note. */
|
|
290
|
+
export const EMAIL_COLOURS = Object.freeze({
|
|
291
|
+
reportLink: '#1a4fd6',
|
|
292
|
+
auditLink: '#3b4fd6',
|
|
293
|
+
headline: '#1a1a2e',
|
|
294
|
+
quiet: '#7a8290', // the access note, and the coverage line
|
|
295
|
+
warning: '#7a2b12', // the handling note, and an applicant named mid-run
|
|
296
|
+
closeBoxFill: '#fdeeee', // "Only you can close these"
|
|
297
|
+
closeBoxLine: '#c98a86',
|
|
298
|
+
closeBoxText: '#6e1512',
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
/** The audit workbook's colours, as the spreadsheet library takes them: RRGGBB, or AARRGGBB where it asks for alpha. */
|
|
302
|
+
export const WORKBOOK_COLOURS = Object.freeze({
|
|
303
|
+
headerFill: '11132A',
|
|
304
|
+
headerText: 'FFFFFFFF',
|
|
305
|
+
link: 'FF0563C1',
|
|
306
|
+
sectionFill: 'FFEDEDED',
|
|
307
|
+
// The coverage states take the report's own: a clean search on the clear stop's soft fill, a limited or
|
|
308
|
+
// open one on the medium stop's, as the report colours its coverage cells.
|
|
309
|
+
stateClean: BAND_SOFT.clear.slice(1),
|
|
310
|
+
stateLimited: BAND_SOFT.med.slice(1),
|
|
311
|
+
stateOpen: BAND_SOFT.med.slice(1),
|
|
312
|
+
stateNote: 'EDEDED',
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
/** The clearance report's quadrant, which stays a fixed light surface in both themes: its markers, the pending marker's
|
|
316
|
+
* fill, the grid, the axis titles and the zone label. Its ink and its zone's red are PALETTE.ink and PALETTE.crimson. */
|
|
317
|
+
export const QUADRANT_COLOURS = Object.freeze({
|
|
318
|
+
onField: '#C8871B',
|
|
319
|
+
secondary: '#5F8A64',
|
|
320
|
+
pendingFill: '#FFFDF9',
|
|
321
|
+
grid: '#E4DACA',
|
|
322
|
+
axisText: '#6B5D52',
|
|
323
|
+
zoneLabel: '#B89A6E',
|
|
324
|
+
});
|
|
325
|
+
|
|
256
326
|
// The typefaces themselves are not linked from anywhere: brand-fonts.mjs embeds them in each page that
|
|
257
327
|
// sets text, and this module only names them, so it stays free of file reads for the tools that import it.
|
|
258
328
|
|
|
@@ -408,7 +478,9 @@ const D = PALETTE_DARK;
|
|
|
408
478
|
export const WARM_ROOT =
|
|
409
479
|
`:root{--bg:${P.cream};--card:${P.cardWarm};--ink:${P.ink};--muted:${P.muted};--line:${P.line};` +
|
|
410
480
|
`--crimson:${P.crimson};--crimson-deep:${P.crimsonDeep};--crimson-mid:${P.crimsonMid};--accent:${P.crimson};` +
|
|
411
|
-
`--h-green:${P.sage};--h-amber:${P.ochre};--h-red:${P.crimson};--h-grey:${P.warmGrey}
|
|
481
|
+
`--h-green:${P.sage};--h-amber:${P.ochre};--h-red:${P.crimson};--h-grey:${P.warmGrey};` +
|
|
482
|
+
// The risk ramp and the text on each stop, for the staff index's band pills (2026-11-18).
|
|
483
|
+
Object.keys(BAND_RAMP).map((k) => `--${k}:${BAND_RAMP[k]};--${k}-on:${BAND_ON[k]};`).join('') + `}`;
|
|
412
484
|
|
|
413
485
|
// :root for the clearance report (templates/report.css). Shared brand colours come from PALETTE;
|
|
414
486
|
// report-specific values (risk scale, soft pairs, neutrals, shadow, mono) are literals. Kept in
|
|
@@ -426,10 +498,14 @@ export const REPORT_ROOT =
|
|
|
426
498
|
// of its own: --high is deliberately NOT --accent any more (the shipped --high was byte-identical to
|
|
427
499
|
// #860F09, so a High risk dot read as a Start button and needed a ring workaround). --accent /
|
|
428
500
|
// --crimson / --maroon above are untouched. The gauge's stop order is clear→low→med→high→severe.
|
|
429
|
-
`--clear
|
|
501
|
+
`--clear:${BAND_RAMP.clear}; --low:${BAND_RAMP.low}; --med:${BAND_RAMP.med}; --high:${BAND_RAMP.high}; --severe:${BAND_RAMP.severe};` +
|
|
502
|
+
// THE TEXT ON A BAND. A band pill printed white on every band, and white scored 3.03:1 on Medium, 3.29 on Low and
|
|
503
|
+
// 3.96 on Clear, under the 4.5 a 14px label needs. Each band names its own text (BAND_ON): the ink on the three light
|
|
504
|
+
// bands, white on the two dark ones (WCAG 2.x: 4.74, 5.71, 6.20, 5.94, 10.23). No single colour clears all five.
|
|
505
|
+
`--clear-on:${BAND_ON.clear}; --low-on:${BAND_ON.low}; --med-on:${BAND_ON.med}; --high-on:${BAND_ON.high}; --severe-on:${BAND_ON.severe};` +
|
|
430
506
|
// Soft/text pairs: re-derived from the five bases by the rule in shared/tools/derive-band-pairs.mjs (same
|
|
431
507
|
// hue, soft at L .895 / S×.78, text at L .275 / S×1.12). Every pair clears WCAG AA on its own chip.
|
|
432
|
-
`--med-soft
|
|
508
|
+
`--med-soft:${BAND_SOFT.med}; --med-tx:${BAND_SOFT_TEXT.med}; --clear-soft:${BAND_SOFT.clear}; --clear-tx:${BAND_SOFT_TEXT.clear}; --high-soft:${BAND_SOFT.high}; --high-tx:${BAND_SOFT_TEXT.high};` +
|
|
433
509
|
`--taupe:#A99A82;` +
|
|
434
510
|
// The mark-itself disclosure toggles. A DEDICATED token: --crimson has no dark variant, and
|
|
435
511
|
// reusing it left the toggles barely legible on the dark ground.
|
|
@@ -473,7 +549,8 @@ const darkBlock = (tokens, rules, { auto = true } = {}) => {
|
|
|
473
549
|
const WARM_DARK_TOKENS =
|
|
474
550
|
`color-scheme:dark;--bg:${D.ground};--card:${D.cardWarm};--ink:${D.ink};--muted:${D.muted};--line:${D.line};` +
|
|
475
551
|
`--crimson:${P.crimson};--crimson-deep:${D.crimsonDeep};--crimson-mid:${D.crimsonMid};--accent:${P.crimson};` +
|
|
476
|
-
`--h-green:#6f9463;--h-amber:#d6a24a;--h-red:${P.crimson};--h-grey:#9a8c7a;--web-glow:rgba(94,7,14,.5);--surface-high:#25201b
|
|
552
|
+
`--h-green:#6f9463;--h-amber:#d6a24a;--h-red:${P.crimson};--h-grey:#9a8c7a;--web-glow:rgba(94,7,14,.5);--surface-high:#25201b;` +
|
|
553
|
+
Object.keys(BAND_RAMP_DARK).map((k) => `--${k}:${BAND_RAMP_DARK[k]};--${k}-on:${BAND_ON_DARK[k]}`).join(';');
|
|
477
554
|
|
|
478
555
|
// Scoped warm-surface overrides — a SUPERSET across the warm pages (like WARM_ROOT itself): crimson-TEXT
|
|
479
556
|
// recolors + the hardcoded light-background islands (#fff/#efe6d8/#faf5ec chips, tracks, forms) that would
|
|
@@ -513,7 +590,10 @@ const REPORT_DARK_TOKENS =
|
|
|
513
590
|
`--line:#322c24;--line2:#3d362c;` +
|
|
514
591
|
`--crimson:${P.crimson};--maroon:${D.crimsonDeep};--rose:${D.crimsonMid};--rose2:#cf8681;--tan:#c8b89a;--mark:${D.ink};` +
|
|
515
592
|
`--crimson-deep:${D.crimsonDeep};--crimson-mid:${D.crimsonMid};` +
|
|
516
|
-
`--clear
|
|
593
|
+
`--clear:${BAND_RAMP_DARK.clear};--low:${BAND_RAMP_DARK.low};--med:${BAND_RAMP_DARK.med};--high:${BAND_RAMP_DARK.high};--severe:${BAND_RAMP_DARK.severe};` +
|
|
594
|
+
// The dark bands are lighter, so the light ink stays (it does not flip with the theme) and covers High too: white
|
|
595
|
+
// on dark High is 4.16, the ink 4.51. Severe keeps white (7.16).
|
|
596
|
+
`--clear-on:${BAND_ON_DARK.clear};--low-on:${BAND_ON_DARK.low};--med-on:${BAND_ON_DARK.med};--high-on:${BAND_ON_DARK.high};--severe-on:${BAND_ON_DARK.severe};` +
|
|
517
597
|
`--med-soft:#352915;--med-tx:#E4BF81;--clear-soft:#212922;--clear-tx:#A7BEA9;--high-soft:#311B19;--high-tx:#D8938D;` +
|
|
518
598
|
`--taupe:#8f8570;` +
|
|
519
599
|
`--ma-toggle:#E8A87C;` +
|
|
@@ -525,10 +605,17 @@ const REPORT_DARK_TOKENS =
|
|
|
525
605
|
// dark; the near-white islands (.covcell.warn / .firstUp / .cm-mark / .ccl) flip to dark equivalents.
|
|
526
606
|
const REPORT_DARK_RULES = [
|
|
527
607
|
['.lockup .lk-mark', `color:${D.crimsonMid}`],
|
|
528
|
-
|
|
608
|
+
// A drop-down's title ("The read", "Register record", "Full detail") and a long goods list's "Show all" toggle
|
|
609
|
+
// are crimson text like a link: on the dark ground --crimson measured 1.77:1, so they take the links' colour.
|
|
610
|
+
['a,.wm,details.drill>summary,.rr-all>summary', `color:${D.crimsonText}`],
|
|
529
611
|
['.wm .ridge path', `fill:${D.crimsonText}`],
|
|
530
612
|
['.tbbtn:hover,.util:hover,.tb-back:hover,.theme-toggle.tt-page:hover', `color:${D.crimsonText};border-color:${D.crimsonText}`],
|
|
531
613
|
['.rep-stickyhead', 'background:rgba(15,14,12,.82)'],
|
|
614
|
+
// The section strip's current entry is set in the light ink with a dark tint, which on the dark bar left it the
|
|
615
|
+
// one entry nobody could read. Both report pages draw the strip, and both take this block.
|
|
616
|
+
['.strip a.now', `color:${D.ink};background:rgba(255,255,255,.08)`],
|
|
617
|
+
// "Logo not retrieved" is a link that stays grey: it marks an absence, not a destination to read first.
|
|
618
|
+
['a.rr-nologo', 'color:var(--slate)'],
|
|
532
619
|
['.panel.land', 'background:#FFFDF9'],
|
|
533
620
|
['.panel.land .legend,.panel.land .legend *', 'color:#250902'],
|
|
534
621
|
['.covcell.warn', 'background:#2a2418;border-color:#4a3d22'],
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
// Copyright 2026 Cordillera Sàrl. Additional terms under section 7 of the AGPL-3.0 apply — see ADDITIONAL-TERMS.md
|
|
3
|
+
// shared/inline-markdown.mjs — the one inline-markdown dialect the report pages read model-written prose in.
|
|
4
|
+
//
|
|
5
|
+
// The model writes markdown because every other surface it feeds renders markdown. The clearance renderer read links,
|
|
6
|
+
// bold and italic; the Knockout renderer read bold, italic and code; and several clearance fields were escaped and
|
|
7
|
+
// nothing else. So a model-written `[label](https://…)` reached a delivered page as those characters on some fields
|
|
8
|
+
// and as a link on others, and the same sentence printed differently on a clearance and on a Knockout. Both renderers
|
|
9
|
+
// now read the same four forms through this function. The portal's span reader
|
|
10
|
+
// (portal-ui/src/contract/inlineMd.ts) mirrors it without ever building HTML.
|
|
11
|
+
//
|
|
12
|
+
// IT TAKES TEXT ITS CALLER HAS ALREADY ESCAPED. Each renderer escapes as it always has (both escape & < >; the
|
|
13
|
+
// Knockout also escapes quotes), so a page's existing text keeps its bytes and only the markdown forms change.
|
|
14
|
+
// Nothing here may be handed raw model text.
|
|
15
|
+
//
|
|
16
|
+
// THE FORMS, IN ORDER: links, then bold, then italic, then code. Bold runs before italic so the inner asterisks of a
|
|
17
|
+
// `**bold**` run are never read as a pair of italics, and an unmatched marker stays visible: `2 * 3` is a
|
|
18
|
+
// multiplication, and swallowing the character would silently edit a client's document.
|
|
19
|
+
|
|
20
|
+
const LINK = /\[([^\]]+)\]\(([^)]+)\)/g;
|
|
21
|
+
|
|
22
|
+
/** Does a link target open anything safely? http(s), mailto and an in-page `#` anchor; any other scheme is text. */
|
|
23
|
+
export const isSafeLinkTarget = (href) => /^https?:\/\//i.test(href) || /^mailto:/i.test(href) || String(href).startsWith('#');
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Escaped text → the same text with its inline markdown as HTML.
|
|
27
|
+
*
|
|
28
|
+
* Links: an external link opens in a new tab; an in-page anchor keeps same-tab navigation. A target with any other
|
|
29
|
+
* scheme (javascript:, data:, vbscript:, …) renders as its label alone, as plain text.
|
|
30
|
+
*
|
|
31
|
+
* Provenance honesty: an authored 'Corsearch · <name>' label whose href is NOT a Corsearch page (live case: storefront
|
|
32
|
+
* links labelled as the register vendor) gets its vendor token replaced by the link's actual host — a lawyer must never
|
|
33
|
+
* cite a storefront as a register record.
|
|
34
|
+
*/
|
|
35
|
+
export function inlineMarkdown(escaped) {
|
|
36
|
+
return String(escaped ?? '')
|
|
37
|
+
.replace(LINK, (mm, txt, href) => {
|
|
38
|
+
let label = txt;
|
|
39
|
+
const vend = /^(Corsearch)\s*·\s*(.+)$/i.exec(txt);
|
|
40
|
+
if (vend && /^https?:\/\//i.test(href) && !/corsearch\./i.test(href)) {
|
|
41
|
+
try { label = `${new URL(href.replace(/&/g, '&')).host.replace(/^www\./, '')} · ${vend[2]}`; } catch { /* keep authored label */ }
|
|
42
|
+
}
|
|
43
|
+
if (!isSafeLinkTarget(href)) return label;
|
|
44
|
+
// XSS: the caller's escaping may not cover quotes, and a `"` in the href would break out of the attribute, so
|
|
45
|
+
// quotes are escaped here. Not a second full escape: that would double-encode `&` in query strings
|
|
46
|
+
// (?a=1&b=2 → &amp;).
|
|
47
|
+
const safeHref = href.replace(/"/g, '"');
|
|
48
|
+
return /^https?:\/\//i.test(href) ? `<a href="${safeHref}" target="_blank" rel="noopener noreferrer">${label}</a>` : `<a href="${safeHref}">${label}</a>`;
|
|
49
|
+
})
|
|
50
|
+
.replace(/\*\*([^*]+)\*\*/g, '<b>$1</b>')
|
|
51
|
+
.replace(/(^|[^*])\*([^*]+)\*/g, '$1<i>$2</i>')
|
|
52
|
+
.replace(/`([^`]+)`/g, '<span class="mono">$1</span>');
|
|
53
|
+
}
|
package/shared/portal-tokens.mjs
CHANGED
|
@@ -87,7 +87,8 @@ const semantic = () => {
|
|
|
87
87
|
// borders + focus
|
|
88
88
|
["--border-hairline", L("--line"), D("--line"), "brand --line"],
|
|
89
89
|
["--border-strong", L("--line2"), D("--line2"), "brand --line2"],
|
|
90
|
-
["--focus-ring", L("--crimson"),
|
|
90
|
+
["--focus-ring", L("--crimson"), "#e0736b",
|
|
91
|
+
"brand --crimson; dark takes the dark --text-accent, since crimson on the dark page is too faint to see a focus by"],
|
|
91
92
|
|
|
92
93
|
// type, shadow, motion
|
|
93
94
|
["--font-body", L("--font"), L("--font"), "brand --font"],
|
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
|
|
58
58
|
import { execFileSync } from "node:child_process";
|
|
59
59
|
import { CUT_RECORD_PRESENT, isWithheld } from "./withheld-paths-access.mjs";
|
|
60
|
+
import { sourceSpans, isScript } from "./source-spans.mjs";
|
|
60
61
|
|
|
61
62
|
// ── A COLOUR IS NOT A CITATION, AND ONE PROPERTY LIST SETTLES BOTH READINGS ──────────────────────
|
|
62
63
|
//
|
|
@@ -315,6 +316,14 @@ export const WRAPPED_CLASS = "spelled-citation";
|
|
|
315
316
|
|
|
316
317
|
export function offendingClasses(path, line) {
|
|
317
318
|
if (!isScannable(path) || !isProse(path, line)) return [];
|
|
319
|
+
return classesIn(line);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Every class `text` carries, as `{ id, token, why }` rows. The caller has already decided this text is read: a prose line,
|
|
324
|
+
* a comment after code, or a string. PURE.
|
|
325
|
+
*/
|
|
326
|
+
export function classesIn(line) {
|
|
318
327
|
const text = withoutColourValues(withoutLinkTargets(line));
|
|
319
328
|
const out = [];
|
|
320
329
|
for (const c of CLASSES) {
|
|
@@ -341,6 +350,36 @@ export function offendingClasses(path, line) {
|
|
|
341
350
|
*/
|
|
342
351
|
const COLUMN = new Map(CLASSES.map((c, i) => [c.id, i]));
|
|
343
352
|
|
|
353
|
+
// ── A COMMENT AFTER CODE IS PROSE, AND A STRING IS COUNTED IN A COLUMN OF ITS OWN ─────────────────
|
|
354
|
+
//
|
|
355
|
+
// The guard read a script line only when it started as a comment, so `foo(); // tracker …` was never read, and nothing in
|
|
356
|
+
// a string was. A comment after code is prose like any other: the census counts it under its class, and the diff guard
|
|
357
|
+
// refuses it in an added line. A string is different: test titles and user-facing strings that other tests assert on
|
|
358
|
+
// carry most of it, and changing them is its own work. So a string's hits are counted in one more column, after the
|
|
359
|
+
// classes, and floored like the rest, and the diff guard does not refuse them. The audit that found the gap set exactly
|
|
360
|
+
// this (2026-11-11): widen the prose to trailing comments, count strings as their own column, strip nothing.
|
|
361
|
+
export const STRING_COLUMN = "in-a-string";
|
|
362
|
+
/** The census's columns: the classes, in their order, then the string column. */
|
|
363
|
+
export const CENSUS_COLUMNS = [...CLASSES.map((c) => c.id), STRING_COLUMN];
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Per line of one file, the classes its prose carries and the classes its strings carry. A script is read by its
|
|
367
|
+
* comments, trailing ones included, and its strings; any other file by the line rule. PURE.
|
|
368
|
+
* @returns {{ prose: {id: string, token: string, why: string}[], strings: {id: string, token: string, why: string}[] }[]}
|
|
369
|
+
*/
|
|
370
|
+
export function offendingInFile(path, text) {
|
|
371
|
+
const lines = String(text ?? "").split("\n");
|
|
372
|
+
if (!isScannable(path)) return lines.map(() => ({ prose: [], strings: [] }));
|
|
373
|
+
if (!isScript(path)) return lines.map((l) => ({ prose: offendingClasses(path, l), strings: [] }));
|
|
374
|
+
const spans = sourceSpans(text);
|
|
375
|
+
return lines.map((l, i) => {
|
|
376
|
+
// A line that starts as a comment is read whole, as before; a comment after code is read for its comment text.
|
|
377
|
+
const prose = isProse(path, l) ? classesIn(l) : spans[i]?.comment ? classesIn(spans[i].comment) : [];
|
|
378
|
+
const strings = !isProse(path, l) && spans[i]?.strings ? classesIn(spans[i].strings) : [];
|
|
379
|
+
return { prose, strings };
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
|
|
344
383
|
// ── THE CENSUS IS A STATEMENT ABOUT THE PUBLISHED TREE, AND IT CAN BE RUN OVER A BIGGER ONE ──────
|
|
345
384
|
//
|
|
346
385
|
// The withheld corpus is laid back over this tree at its pre-cut paths to run the suite with it. Under
|
|
@@ -374,10 +413,12 @@ export function censusOf(files, read) {
|
|
|
374
413
|
let text;
|
|
375
414
|
try { text = read(path); } catch { continue; }
|
|
376
415
|
if (text.includes("\0")) continue; // a binary blob is not prose
|
|
377
|
-
const counts =
|
|
416
|
+
const counts = CENSUS_COLUMNS.map(() => 0);
|
|
378
417
|
const lines = text.split("\n");
|
|
418
|
+
const rows = offendingInFile(path, text);
|
|
379
419
|
for (let i = 0; i < lines.length; i++) {
|
|
380
|
-
for (const { id } of
|
|
420
|
+
for (const { id } of rows[i].prose) counts[COLUMN.get(id)]++;
|
|
421
|
+
counts[CENSUS_COLUMNS.length - 1] += rows[i].strings.length;
|
|
381
422
|
// AND THE PAIR, which no per-line rule can see. Counted on the HEAD line and once: the head ends
|
|
382
423
|
// mid-citation, so this can never be the same hit the loop above just counted.
|
|
383
424
|
if (isProse(path, lines[i]) && wrapsInto(lines[i], lines[i + 1])) counts[COLUMN.get(WRAPPED_CLASS)]++;
|
|
@@ -110,9 +110,14 @@ export const PROVIDERS = [
|
|
|
110
110
|
id: "uspto-local", label: "USPTO (local index) — the US register only", cost: "free",
|
|
111
111
|
covers: "the US register, and nothing else, from an index you build and hold locally.",
|
|
112
112
|
credentials: ["USPTO_LOCAL_DB"],
|
|
113
|
-
|
|
113
|
+
// NO EU HALF: setup says nothing about the EU register for this row.
|
|
114
|
+
warnings: USPTO_WARNINGS.filter((w) => !/^The EU register /.test(w)),
|
|
114
115
|
uspToLocalKey: "USPTO_LOCAL_DB",
|
|
116
|
+
euHalf: false,
|
|
115
117
|
},
|
|
116
|
-
|
|
117
|
-
{ id: "
|
|
118
|
+
// NO VENDOR STEPS ARE WRITTEN for these two: the shipped sentence says where the key comes from.
|
|
119
|
+
{ id: "corsearch", label: "Corsearch — global", cost: "subscription", covers: "a global sweep.", credentials: ["CORSEARCH_SESSION_KEY"],
|
|
120
|
+
signup: ["The key arrives through your Corsearch sales agreement, not a signup form."] },
|
|
121
|
+
{ id: "clarivate", label: "Clarivate — global", cost: "subscription", covers: "a global sweep.", credentials: ["CLARIVATE_API_KEY"],
|
|
122
|
+
signup: ["The key arrives through your Clarivate sales agreement, not a signup form."] },
|
|
118
123
|
];
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_generated": "by scripts/mint-search-level-tags.mjs from driver/search-policy.mjs PRODUCT_POLICIES — do not edit; re-mint",
|
|
3
|
+
"levels": [
|
|
4
|
+
{
|
|
5
|
+
"product": "knockout-search",
|
|
6
|
+
"tag": "KO",
|
|
7
|
+
"name": "Knockout search"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"product": "global-preliminary-search",
|
|
11
|
+
"tag": "Prelim",
|
|
12
|
+
"name": "Global preliminary search"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"product": "multi-country-focus-search",
|
|
16
|
+
"tag": "Multi",
|
|
17
|
+
"name": "Multi-country focus search"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"product": "full-country-search",
|
|
21
|
+
"tag": "Full",
|
|
22
|
+
"name": "Full country search"
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
// Copyright 2026 Cordillera Sàrl. Additional terms under section 7 of the AGPL-3.0 apply — see ADDITIONAL-TERMS.md
|
|
3
|
+
//
|
|
4
|
+
// WHICH PART OF EACH LINE OF A SCRIPT IS COMMENT, AND WHICH IS A STRING. The public-text guards read comments as prose
|
|
5
|
+
// and judged a line by how it starts: a line opening with `//` or `*` was read, and a comment after code on the same line
|
|
6
|
+
// was not. Strings were not read at all. This reads a whole JavaScript file once and hands back, per line, the comment
|
|
7
|
+
// text and the string text it holds, so a guard can read a trailing comment as the prose it is and count a string as
|
|
8
|
+
// what it is.
|
|
9
|
+
//
|
|
10
|
+
// NO DEPENDENCY, ON PURPOSE. The pattern guards run in CI without an install, so this cannot lean on a parser package.
|
|
11
|
+
// It is a small scanner instead: line and block comments, the three quote forms, template literals with their `${}`
|
|
12
|
+
// holes, and regular-expression literals, told from division by the token before them. Its test checks it against a
|
|
13
|
+
// real parser over the repository's own scripts.
|
|
14
|
+
//
|
|
15
|
+
// PURE. Never throws: text it cannot follow leaves the rest of the file read as code, which reads less, never more.
|
|
16
|
+
|
|
17
|
+
const REGEX_AFTER = /[(,=:[!&|?{};+\-*%<>~^]$|^$|\b(?:return|typeof|instanceof|in|of|new|delete|void|throw|case|do|else|yield|await)$/;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Per line (0-based), the comment text and the string text it holds.
|
|
21
|
+
* @param {string} text a JavaScript source file
|
|
22
|
+
* @returns {{ comment: string, strings: string }[]}
|
|
23
|
+
*/
|
|
24
|
+
export function sourceSpans(text) {
|
|
25
|
+
const src = String(text ?? "");
|
|
26
|
+
const lines = src.split("\n");
|
|
27
|
+
const out = lines.map(() => ({ comment: "", strings: "" }));
|
|
28
|
+
let line = 0;
|
|
29
|
+
const add = (kind, ch) => { out[line][kind] += ch; };
|
|
30
|
+
// A stack of contexts: "code" (with the template depth it closes), or a template literal.
|
|
31
|
+
const stack = [{ kind: "code", braces: 0 }];
|
|
32
|
+
let prev = ""; // the last significant code text, to tell a regular expression from a division
|
|
33
|
+
let i = 0;
|
|
34
|
+
// A `#!` first line is the interpreter's, and a parser reads it as a comment.
|
|
35
|
+
if (src.startsWith("#!")) { const j = src.indexOf("\n"); out[0].comment = src.slice(2, j < 0 ? src.length : j); i = j < 0 ? src.length : j; }
|
|
36
|
+
const n = src.length;
|
|
37
|
+
while (i < n) {
|
|
38
|
+
const c = src[i], d = src[i + 1];
|
|
39
|
+
const top = stack[stack.length - 1];
|
|
40
|
+
if (c === "\n") { line++; i++; continue; }
|
|
41
|
+
if (top.kind === "template") {
|
|
42
|
+
if (c === "\\") { add("strings", c); if (d !== undefined && d !== "\n") add("strings", d); if (d === "\n") line++; i += 2; continue; }
|
|
43
|
+
if (c === "`") { stack.pop(); prev = "`"; i++; continue; }
|
|
44
|
+
if (c === "$" && d === "{") { stack.push({ kind: "code", braces: 0 }); prev = "{"; i += 2; continue; }
|
|
45
|
+
add("strings", c); i++; continue;
|
|
46
|
+
}
|
|
47
|
+
// code
|
|
48
|
+
if (c === "/" && d === "/") {
|
|
49
|
+
let j = i + 2;
|
|
50
|
+
while (j < n && src[j] !== "\n") j++;
|
|
51
|
+
out[line].comment += src.slice(i + 2, j);
|
|
52
|
+
i = j; continue;
|
|
53
|
+
}
|
|
54
|
+
if (c === "/" && d === "*") {
|
|
55
|
+
let j = i + 2;
|
|
56
|
+
while (j < n && !(src[j] === "*" && src[j + 1] === "/")) { if (src[j] === "\n") line++; else add("comment", src[j]); j++; }
|
|
57
|
+
i = Math.min(n, j + 2); continue;
|
|
58
|
+
}
|
|
59
|
+
if (c === "'" || c === '"') {
|
|
60
|
+
let j = i + 1;
|
|
61
|
+
while (j < n && src[j] !== c && src[j] !== "\n") { if (src[j] === "\\") { add("strings", src[j + 1] ?? ""); j += 2; continue; } add("strings", src[j]); j++; }
|
|
62
|
+
prev = c; i = j + 1; continue;
|
|
63
|
+
}
|
|
64
|
+
if (c === "`") { stack.push({ kind: "template" }); i++; continue; }
|
|
65
|
+
if (c === "/" && REGEX_AFTER.test(prev.trimEnd())) {
|
|
66
|
+
// A regular-expression literal: skip it whole, classes and escapes included, to the closing slash and flags.
|
|
67
|
+
let j = i + 1, inClass = false;
|
|
68
|
+
while (j < n && src[j] !== "\n") {
|
|
69
|
+
if (src[j] === "\\") { j += 2; continue; }
|
|
70
|
+
if (src[j] === "[") inClass = true;
|
|
71
|
+
else if (src[j] === "]") inClass = false;
|
|
72
|
+
else if (src[j] === "/" && !inClass) break;
|
|
73
|
+
j++;
|
|
74
|
+
}
|
|
75
|
+
j++;
|
|
76
|
+
while (j < n && /[a-z]/i.test(src[j])) j++;
|
|
77
|
+
prev = "/x/"; i = j; continue;
|
|
78
|
+
}
|
|
79
|
+
if (c === "{") top.braces++;
|
|
80
|
+
if (c === "}") {
|
|
81
|
+
if (top.braces === 0 && stack.length > 1) { stack.pop(); prev = "}"; i++; continue; } // a template hole closes
|
|
82
|
+
top.braces--;
|
|
83
|
+
}
|
|
84
|
+
if (!/\s/.test(c)) prev = /[\w$]/.test(c) ? (/[\w$]$/.test(prev) ? prev + c : c) : c;
|
|
85
|
+
i++;
|
|
86
|
+
}
|
|
87
|
+
return out;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** Is this path a JavaScript source the scanner reads? */
|
|
91
|
+
export const isScript = (path) => /\.(m?js|cjs)$/.test(String(path));
|
|
@@ -102,3 +102,13 @@ for (const [k, base] of Object.entries(NEW)) {
|
|
|
102
102
|
const OLD_HIGH = '#860F09';
|
|
103
103
|
console.log(`\naccent-collision check: old --high ${OLD_HIGH} vs --accent #860F09 -> contrast ${contrast(OLD_HIGH, '#860F09').toFixed(2)} (identical)`);
|
|
104
104
|
console.log(` new --high ${NEW.high} vs --accent #860F09 -> contrast ${contrast(NEW.high, '#860F09').toFixed(2)}`);
|
|
105
|
+
|
|
106
|
+
// THE EMAILS PRINT A BAND'S WORD AS COLOURED TEXT ON WHITE, so every stop needs a text value, low and severe
|
|
107
|
+
// included, which the report's chips never asked for. A base that reads 4.5:1 on white is used as it is;
|
|
108
|
+
// otherwise the light rule darkens it. Darkening all five would print High and Very High in one dark red.
|
|
109
|
+
const TEXT_ONLY = { low: '#8A9440', severe: '#7C1E15' };
|
|
110
|
+
console.log('\n=== a band\'s word on white, all five stops (brand.mjs BAND_TEXT) ===');
|
|
111
|
+
for (const [k, base] of Object.entries({ ...NEW, ...TEXT_ONLY })) {
|
|
112
|
+
const word = contrast(base, '#FFFFFF') >= 4.5 ? base : txLight(hsl(base));
|
|
113
|
+
console.log(`${k.padEnd(6)} base ${base} on #FFFFFF ${contrast(base, '#FFFFFF').toFixed(2)} word ${word} on #FFFFFF ${contrast(word, '#FFFFFF').toFixed(2)}`);
|
|
114
|
+
}
|
package/driver/own-rights.mjs
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
-
// Copyright 2026 Cordillera Sàrl. Additional terms under section 7 of the AGPL-3.0 apply — see ADDITIONAL-TERMS.md
|
|
3
|
-
// own-rights.mjs — spec A4: the own-rights evidence gate for house-mark-dependent candidates.
|
|
4
|
-
//
|
|
5
|
-
// When a candidate's clearance reasoning RELIES on the client's own house mark or franchise root ("the
|
|
6
|
-
// prefix is the client's own registered mark", "covered by the applicant's AGE OF EMPIRES registrations"),
|
|
7
|
-
// that supporting claim must itself be EVIDENCED: an own-portfolio register sweep confirming the
|
|
8
|
-
// registrations (existence, classes, key jurisdictions), cited in the narrative. The affiliate-exclusion
|
|
9
|
-
// mandate governs CONFLICTS (don't flag the client against itself); it must never suppress this
|
|
10
|
-
// supporting-evidence sweep — those are different things.
|
|
11
|
-
//
|
|
12
|
-
// Same enforcement substrate and shape as use-check.mjs: pure over the narrative document; a reliance
|
|
13
|
-
// without its evidence line fails validators.narrative and drives the existing corrective-retry loop
|
|
14
|
-
// (PR-8: synthesis holds the READ-ONLY band tools, so the check runs inline as an owner-scoped
|
|
15
|
-
// band_lookup over the run's frozen register material — exactly like the inline use-check; synthesis
|
|
16
|
-
// no longer carries live register tools). Because that frozen material is scoped to the matter's
|
|
17
|
-
// dispatched slices, an empty owner lookup is NOT a register-negative about the client's portfolio —
|
|
18
|
-
// the honest negative names what was consulted, and the missing owner query is raised as an open
|
|
19
|
-
// Coverage/open-item row for the escalation lane (supplemental mint), never asserted as a sweep that
|
|
20
|
-
// found nothing. The satisfying line is:
|
|
21
|
-
// **Own-rights source:** /mark/<cc>/<id>[, /mark/...] (record URIs from the owner-scoped lookup)
|
|
22
|
-
// or the honest scoped negative that removes the crutch:
|
|
23
|
-
// **Own-rights source:** no applicant-owned registrations in the searched register material
|
|
24
|
-
// (This module only requires the "Own-rights source:" line to exist — the source text is free-form,
|
|
25
|
-
// so archived runs carrying the retired "own-portfolio sweep — no registrations found" still lint.)
|
|
26
|
-
|
|
27
|
-
// Reasoning that leans on the client's/applicant's own rights. Anchored on the stock vocabulary; the
|
|
28
|
-
// possessive forms ("client's own", "applicant's own", "its own registered") are the load-bearing signal.
|
|
29
|
-
const OWN_RIGHTS_RELIANCE_RE = new RegExp([
|
|
30
|
-
"(?:client|applicant|customer)'?s? own (?:live |registered |prior )?(?:mark|registration|rights|portfolio|family)",
|
|
31
|
-
"house[- ]mark",
|
|
32
|
-
"franchise (?:root|prefix|family)",
|
|
33
|
-
"own[- ]rights (?:cover|protect|shield)",
|
|
34
|
-
"(?:prefix|root|element) is (?:the )?(?:client|applicant|customer)'?s?(?: own)? (?:registered|live)",
|
|
35
|
-
].join("|"), "i");
|
|
36
|
-
|
|
37
|
-
const OWN_RIGHTS_SOURCE_RE = /own-?rights source\s*:/i;
|
|
38
|
-
|
|
39
|
-
// Applicant-own hypothesis: on an applicant-unknown run an identical hit carries a neutral
|
|
40
|
-
// "if this is the applicant's own prior filing, disregard" note (2026-06-18 — replaces the retired
|
|
41
|
-
// candidate-self treatment). That note is a HYPOTHESIS about identity, not clearance reasoning relying on
|
|
42
|
-
// the client's rights — there is nothing to evidence until the applicant is named (the late-bind re-classify
|
|
43
|
-
// resolves it). Without this exemption such a finding tripped own_rights_missing (caught by the B5 e2e suite).
|
|
44
|
-
// Matches the new note AND the retired phrasing, defensively.
|
|
45
|
-
const CANDIDATE_SELF_RE = /candidate-?self\s*:|is this you\?|if this is the applicant'?s own|own prior filing,?\s*disregard/i;
|
|
46
|
-
|
|
47
|
-
function isFinding(heading, block) {
|
|
48
|
-
return /\bfinding\b/i.test(heading) || /\*\*\s*composite\b/i.test(block) || /\bcandidate\b/i.test(heading);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Find findings whose clearance reasoning relies on the client's own house mark/franchise root without
|
|
53
|
-
* citing the own-portfolio sweep evidence. Pure: empty/missing input → no violations, never throws.
|
|
54
|
-
*
|
|
55
|
-
* @param {string} narrativeContent the narrative.md text
|
|
56
|
-
* @returns {Array<{finding:string}>} offending findings (empty ⇒ clean)
|
|
57
|
-
*/
|
|
58
|
-
export function findOwnRightsViolations(narrativeContent) {
|
|
59
|
-
const lines = (narrativeContent || "").split("\n");
|
|
60
|
-
const blocks = [];
|
|
61
|
-
let cur = null;
|
|
62
|
-
for (const ln of lines) {
|
|
63
|
-
const h = ln.match(/^(#{2,4})\s+(.*)/);
|
|
64
|
-
if (h) {
|
|
65
|
-
if (cur) blocks.push(cur);
|
|
66
|
-
cur = { heading: h[2].trim(), body: [] };
|
|
67
|
-
} else if (cur) {
|
|
68
|
-
cur.body.push(ln);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
if (cur) blocks.push(cur);
|
|
72
|
-
|
|
73
|
-
const violations = [];
|
|
74
|
-
for (const b of blocks) {
|
|
75
|
-
const block = `${b.heading}\n${b.body.join("\n")}`;
|
|
76
|
-
if (!isFinding(b.heading, block)) continue;
|
|
77
|
-
if (CANDIDATE_SELF_RE.test(block)) continue; // B5c conditional treatment — hypothesis, not reliance
|
|
78
|
-
if (!OWN_RIGHTS_RELIANCE_RE.test(block)) continue; // reasoning doesn't lean on the client's own rights
|
|
79
|
-
if (OWN_RIGHTS_SOURCE_RE.test(block)) continue; // the sweep evidence (or honest negative) is cited
|
|
80
|
-
violations.push({ finding: b.heading });
|
|
81
|
-
}
|
|
82
|
-
return violations;
|
|
83
|
-
}
|