clearotron 0.7.0 → 0.8.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/THIRD-PARTY-NOTICES.md +71 -2
  2. package/build-info.json +2 -2
  3. package/demo/multi-country-focus-search/run/common-law-grid.json +1 -1
  4. package/docs/CLIENT-MCP.md +17 -0
  5. package/docs/assets/README.md +19 -3
  6. package/docs/assets/portal-clearance-report.jpg +0 -0
  7. package/docs/assets/portal-conflict-landscape.jpg +0 -0
  8. package/docs/assets/portal-new-clearance.png +0 -0
  9. package/driver/CHANGELOG.md +48 -0
  10. package/driver/config-inventory.mjs +15 -2
  11. package/driver/dev-portal.mjs +2 -0
  12. package/driver/effort-model.mjs +34 -4
  13. package/driver/engine/CONTRACT.md +8 -0
  14. package/driver/engine/anthropic-agent.mjs +74 -16
  15. package/driver/engine/jx-turn.mjs +11 -3
  16. package/driver/engine/openai-agent.mjs +33 -7
  17. package/driver/engine/run-choices.mjs +28 -7
  18. package/driver/engine/speed.mjs +107 -0
  19. package/driver/enqueue-schema.mjs +8 -0
  20. package/driver/enqueue.mjs +14 -2
  21. package/driver/jx-units.mjs +2 -2
  22. package/driver/jx.mjs +1 -1
  23. package/driver/knockout-plain-language.mjs +96 -0
  24. package/driver/ladder/attempt-record.mjs +14 -2
  25. package/driver/ladder/dispatch.mjs +2 -2
  26. package/driver/ladder/form-repair.mjs +1 -1
  27. package/driver/ladder/stage.mjs +7 -1
  28. package/driver/mark-logos.mjs +6 -1
  29. package/driver/order-receipt.mjs +184 -0
  30. package/driver/package.json +4 -1
  31. package/driver/picture-shrink-worker.mjs +21 -0
  32. package/driver/picture-thumbnail.mjs +132 -0
  33. package/driver/pipeline-knockout.mjs +14 -0
  34. package/driver/portal-confirmation.mjs +3 -0
  35. package/driver/portal-report.mjs +44 -1
  36. package/driver/portal-routes/run.mjs +19 -9
  37. package/driver/portal-runs.mjs +118 -63
  38. package/driver/portal-service.mjs +17 -2
  39. package/driver/predelivery-lint.mjs +3 -3
  40. package/driver/progress.mjs +33 -5
  41. package/driver/publish/column-queries.mjs +86 -0
  42. package/driver/publish/index.mjs +4 -4
  43. package/driver/publish/knockout.mjs +35 -8
  44. package/driver/publish/page-shell.mjs +5 -1
  45. package/driver/publish/read-document.mjs +3 -0
  46. package/driver/publish/render-knockout.mjs +61 -16
  47. package/driver/publish/render.mjs +171 -30
  48. package/driver/publish/search-depth.mjs +45 -1
  49. package/driver/publish/strings.mjs +23 -0
  50. package/driver/publish/templates/report.css +73 -0
  51. package/driver/research-answers.mjs +17 -6
  52. package/driver/research-checks.mjs +22 -4
  53. package/driver/research-records.mjs +81 -0
  54. package/driver/run-quote.mjs +3 -0
  55. package/driver/run-speed.mjs +89 -0
  56. package/driver/runner.mjs +50 -21
  57. package/driver/saved-register-pages.mjs +23 -22
  58. package/driver/stage-freshness.mjs +5 -0
  59. package/driver/stages.mjs +2 -2
  60. package/driver/steps/open-run.mjs +12 -1
  61. package/driver/suite-census.json +199 -37
  62. package/driver/tokens.mjs +3 -0
  63. package/driver/urgent-count.mjs +54 -0
  64. package/driver/usage-ledger.mjs +8 -2
  65. package/driver/web-pictures.mjs +532 -0
  66. package/mcp-server/CHANGELOG.md +16 -0
  67. package/mcp-server/lib/document-reads.mjs +28 -0
  68. package/mcp-server/lib/events.mjs +21 -12
  69. package/mcp-server/lib/findings.mjs +2 -1
  70. package/mcp-server/lib/knockout.mjs +3 -2
  71. package/mcp-server/lib/ops.mjs +103 -6
  72. package/mcp-server/lib/options.mjs +4 -0
  73. package/mcp-server/lib/plan.mjs +38 -4
  74. package/mcp-server/lib/result-shapes.mjs +66 -0
  75. package/mcp-server/lib/runs.mjs +46 -44
  76. package/mcp-server/lib/urgent.mjs +29 -0
  77. package/mcp-server/package.json +1 -1
  78. package/mcp-server/result-shapes.json +2978 -0
  79. package/mcp-server/server.mjs +67 -14
  80. package/package.json +4 -1
  81. package/portal-ui/dist/assets/{index-qNDhqCw9.js → index-DEkVU2FD.js} +1909 -766
  82. package/portal-ui/dist/assets/{index-CxAkJXIT.css → index-W6SAoDkS.css} +238 -1
  83. package/portal-ui/dist/index.html +2 -2
  84. package/portal-ui/package.json +1 -1
  85. package/providers/jx/src/turn-envelope.mjs +3 -1
  86. package/providers/oauth-mcp-bridge/CHANGELOG.md +4 -0
  87. package/providers/oauth-mcp-bridge/package.json +1 -1
  88. package/providers/signa/src/core.js +54 -12
  89. package/scripts/README.md +3 -0
  90. package/scripts/e2e-first-time.mjs +2 -2
  91. package/scripts/mint-result-shapes.mjs +199 -0
  92. package/scripts/readme-pictures.mjs +227 -0
  93. package/scripts/render-check.mjs +4 -1
  94. package/scripts/report-sections-render-check.mjs +191 -0
  95. package/scripts/settings-render-check.mjs +68 -11
  96. package/shared/brand.mjs +8 -0
  97. package/skills/clearotron-account/SKILL.md +24 -0
  98. package/skills/clearotron-ops/SKILL.md +23 -9
@@ -7,10 +7,11 @@
7
7
  // self-reported trail), meta.json batch stamps, and the email composer. Deliberately separate from publishReport (single-clearance-shaped); shares the exported
8
8
  // palette (TONE_TIER, resolved against the run's FROZEN framework) so driver and interactive output
9
9
  // can never drift and a knockout never reads the clearance composer's module state.
10
- import { readFileSync, writeFileSync, existsSync } from 'node:fs';
10
+ import { readFileSync, writeFileSync, existsSync, readdirSync } from 'node:fs';
11
11
  import { publishRun } from './shell.mjs';
12
12
  import { plainDeferralReason, plainCause } from '../deferral-row.mjs'; import { knockoutStepFailures, PART_NAMES, RULED_WORDS, NOT_COMPLETED, linkNotOnRegisterSite } from '../degraded-parts.mjs'; import { ownersOwedACheck, composeOwnerQuery } from '../owner-use-check.mjs'; import { KNOCKOUT_WEB } from '../stages-knockout.mjs'; // — the reader's words for a search left open; and the parts that failed as a whole
13
- import { join } from 'node:path';
13
+ import { join, dirname } from 'node:path';
14
+ import { recordFromSearchRow as signaSearchRow } from '../../providers/signa/src/core.js'; // a Signa search row is a whole record
14
15
  import { EMAIL_TIER } from '../../shared/brand.mjs';
15
16
  import { riskTier, TONE_TIER, regenIndex, regenSurfaces, auditRouteFor, markReportRouteFor, reportRouteFor } from './index.mjs';
16
17
  import { runKnockoutLint, deliveryFlagLines } from '../predelivery-lint.mjs';
@@ -791,13 +792,13 @@ function readTheRunRecord({ findings, framework, profile }) {
791
792
  /** What readKnockoutDocument returns: the facts every read made, under the names the surfaces take them by. */
792
793
  function knockoutRead(r) {
793
794
  const { receipts, dates, issued, searched, sweepReceipts, registerCounts, registerCountsUnreadable, registerRecords,
794
- registerRecordsUnreadable, filingRecords, logos, ownerChecks, instructedScope, scopeUnreadable, frameworkMethod,
795
+ registerRecordsUnreadable, filingRecords, logos, webPictures, ownerChecks, instructedScope, scopeUnreadable, frameworkMethod,
795
796
  recordLinksDropped, officeLinks, qcFlags, machineChecksFailed, steps, lookupsNotRun, recordsNotKept, openPoints,
796
797
  identity, probeRan, markRows, single, origin, reportUrlFor, demoData, served, statement, markNames, organisation,
797
798
  framework, overall, engineCommit } = r;
798
799
  return {
799
800
  receipts, dates, issued, searched, sweepReceipts, registerCounts, registerCountsUnreadable, registerRecords,
800
- registerRecordsUnreadable, filingRecords, logos, ownerChecks, instructedScope, scopeUnreadable, frameworkMethod, recordLinksDropped,
801
+ registerRecordsUnreadable, filingRecords, logos, webPictures, ownerChecks, instructedScope, scopeUnreadable, frameworkMethod, recordLinksDropped,
801
802
  officeLinks, qcFlags, machineChecksFailed, steps, lookupsNotRun, recordsNotKept, openPoints, identity, probeRan,
802
803
  markRows, single, origin, reportUrlFor, demoData, served, statement, markNames, organisation,
803
804
  // WHICH BUILD produced this, read once for every surface that records it. null off a git checkout.
@@ -883,12 +884,12 @@ const KNOCKOUT_SHAPE = {
883
884
  const w = knockoutWorkbookOf(reportDocument);
884
885
  return buildKnockoutWorkbook(w.findings, w.sweepReceipts, at, w.registerCounts, w.qcFlags, w.framework, w.registerRecords, w.frameworkMethod, w.ownerChecks, w.parts);
885
886
  }),
886
- surfaces({ writeRO, writeDataFile }, reportDocument, { doc: { markRows, single, reportUrlFor, filingRecords, logos, demoData, origin, overallBadge }, named, runId, findings, overall, searchPolicy, delivery }, _kept, { auditFile }) {
887
+ surfaces({ writeRO, writeDataFile }, reportDocument, { doc: { markRows, single, reportUrlFor, filingRecords, logos, webPictures, demoData, origin, overallBadge }, named, runId, findings, overall, searchPolicy, delivery }, _kept, { auditFile }) {
887
888
  const reports = markRows.map((m, at) => {
888
889
  const { slug, file, band: markBand } = named[at];
889
890
  // The page reads the run's report document as written, for this name, with its surface beside it.
890
891
  writeRO(file, renderReport(pageDocument(reportDocument), {
891
- at, filingRecords, logos, demoData, delivery,
892
+ at, filingRecords, logos, webPictures, demoData, delivery,
892
893
  // The page's workbook control links the portal's audit route, the one the cover note links: the pool path to the
893
894
  // file reaches no handler. Null when the workbook could not be written, and then no control is drawn.
894
895
  auditHref: auditFile ? auditRouteFor(origin, runId) : null,
@@ -1087,15 +1088,41 @@ function knockoutMetaOf(document, { reports }) {
1087
1088
  };
1088
1089
  }
1089
1090
 
1090
- function filingRecordBodies(runDir, registerRecords) {
1091
+ // A REGISTER WHOSE SEARCH ROW IS A WHOLE RECORD (design, 2026-11-26: for the page only). Where the run saved no record
1092
+ // body for a listed filing, the page reads the search row the run already holds, through the register's own normaliser.
1093
+ // Nothing is written: what the rater reads (filing-goods.mjs, held bodies) is unchanged on both engines.
1094
+ const SEARCH_ROW_RECORD = { signa: signaSearchRow };
1095
+
1096
+ /** The search rows the run's register units hold, by normalised record id. */
1097
+ function searchRowsOf(runDir) {
1098
+ const out = new Map();
1099
+ let dir, names = [];
1100
+ try { dir = dirname(paths(runDir).registerBand('x')); names = readdirSync(dir).filter((n) => n.endsWith('.json')); } catch { return out; }
1101
+ for (const n of names) {
1102
+ let units = null;
1103
+ try { units = JSON.parse(readFileSync(join(dir, n), 'utf8')); } catch { continue; }
1104
+ for (const u of Array.isArray(units) ? units : [units]) {
1105
+ for (const row of Array.isArray(u?.records) ? u.records : []) {
1106
+ const key = normalizeRecordUri(row?.record_id);
1107
+ if (key && !out.has(key)) out.set(key, row);
1108
+ }
1109
+ }
1110
+ }
1111
+ return out;
1112
+ }
1113
+
1114
+ export function filingRecordBodies(runDir, registerRecords) {
1091
1115
  const out = new Map();
1092
1116
  if (!runDir || !registerRecords) return out;
1093
1117
  const saved = readRecordArtifacts(runDir);
1118
+ const fromRow = SEARCH_ROW_RECORD[registerRecords.provider] ?? null;
1119
+ let rows = null;
1094
1120
  for (const m of Array.isArray(registerRecords.marks) ? registerRecords.marks : []) {
1095
1121
  for (const r of Array.isArray(m?.records) ? m.records : []) {
1096
1122
  const key = normalizeRecordUri(r?.recordId);
1097
1123
  if (!key || out.has(key)) continue;
1098
- const body = saved.get(key) ?? recordBodyFromLog(paths(runDir).registerRecordBodies, r.recordId);
1124
+ let body = saved.get(key) ?? recordBodyFromLog(paths(runDir).registerRecordBodies, r.recordId);
1125
+ if (!body && fromRow) { rows ??= searchRowsOf(runDir); const row = rows.get(key); body = row ? fromRow(row) : null; }
1099
1126
  if (body && typeof body === 'object' && !Array.isArray(body)) out.set(key, body);
1100
1127
  }
1101
1128
  }
@@ -19,11 +19,15 @@ import { REPORT_ROOT, REPORT_ROOT_DARK_EXPLICIT, THEME_INIT_EXPLICIT, FAVICON_LI
19
19
  import { REPORT_FONT_STYLE } from '../../shared/brand-fonts.mjs'; // the typefaces travel inside the report; it fetches nothing to draw its text
20
20
  import { escapeAttr as escHtml } from '../../shared/html-escape.mjs';
21
21
 
22
+ import { withColumnQueries } from './column-queries.mjs';
23
+
22
24
  const HERE = dirname(fileURLToPath(import.meta.url));
23
25
 
24
26
  // Brand :root tokens are sourced from shared/brand.mjs (REPORT_ROOT) and prepended to the report stylesheet, so
25
27
  // report.css carries only rules — the palette lives in ONE place across surfaces.
26
- export const REPORT_BASE = REPORT_ROOT + '\n' + readFileSync(join(HERE, 'templates', 'report.css'), 'utf8');
28
+ // Each width rule carries its column twin (column-queries.mjs), which matches nothing until a column opts in: the
29
+ // conflict panel, and the report's column narrowed beside it.
30
+ export const REPORT_BASE = REPORT_ROOT + '\n' + withColumnQueries(readFileSync(join(HERE, 'templates', 'report.css'), 'utf8'));
27
31
  // Print always renders light: re-assert the REPORT_ROOT light tokens under [data-theme=dark] inside @media
28
32
  // print (a dark-toggled report must never print on near-black — ink/banding + legal-document convention).
29
33
  const PRINT_LIGHT = '\n@media print{' + REPORT_ROOT.replace(':root{', ':root[data-theme="dark"]{color-scheme:light;') + '}';
@@ -17,6 +17,7 @@ import { join } from 'node:path';
17
17
  import { paths, readJson } from '../run-record.mjs';
18
18
  import { engineCommit } from '../engine-build.mjs';
19
19
  import { logosForReport } from '../mark-logos.mjs';
20
+ import { webPicturesForReport } from '../web-pictures.mjs';
20
21
  import { servedModels } from '../tokens.mjs';
21
22
  import { resolveDemoData } from './demo-marking.mjs';
22
23
  import { reportDates, zurichStamp } from './report-dates.mjs';
@@ -54,6 +55,8 @@ function readFrame({ runId, runDir = null, poolRoot, customerKey = null }, base,
54
55
  served,
55
56
  // Each cited or listed registration's saved logo; none on a run that fetched none.
56
57
  logos: logosForReport(runDir),
58
+ // Each card's saved web pictures; none on a run whose picture step did not run.
59
+ webPictures: webPicturesForReport(runDir),
57
60
  profile,
58
61
  // WHICH BUILD produced this, read once for every surface that records it. null off a git checkout.
59
62
  engineCommit: engineCommit(),
@@ -98,6 +98,11 @@ const isHttpUrl = (u) => /^https?:\/\//i.test(String(u ?? '').trim());
98
98
  // The sandbox already permits it: allow-popups allow-popups-to-escape-sandbox have been on that frame
99
99
  // since the Result screen's first commit (3654a76), so the popup is not what was missing. `rel` stays
100
100
  // beside it — noopener severs window.opener, noreferrer withholds the run's URL from the evidence host.
101
+ // COPY LINK, as on a clearance card (owner, 2026-11-25): inside the portal only, shown by the frame bridge, never printed.
102
+ const COPY_ICONS = '<svg class="ci-link" width="12" height="12" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 8a3 3 0 004.2.3l2-2a3 3 0 00-4.2-4.2l-1 1"/><path d="M8 6a3 3 0 00-4.2-.3l-2 2a3 3 0 004.2 4.2l1-1"/></svg><svg class="ci-tick" width="12" height="12" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2.5 7.5l3 3 6-7"/></svg>';
103
+ const copyLinkButton = () => `<button type="button" class="copy-fi no-print" data-copied="${escAttr(K.finding.copied)}">${COPY_ICONS}<span>${esc(K.finding.copyLink)}</span></button>`;
104
+ // A card's own address on the page: a Knockout numbers its findings again for each name, so the name's position leads.
105
+ const koCardId = (markIndex, ordinal) => `k${Number(markIndex)}-${Number(ordinal)}`;
101
106
  const linkOrText = (u) => (isHttpUrl(u) ? `<a href="${escAttr(u)}" target="_blank" rel="noopener noreferrer">${esc(u)}</a>` : esc(u));
102
107
  // The audit workbook's link, attribute-safe: the portal's route where the publisher hands one in, else the workbook's
103
108
  // own file name beside the page, else none.
@@ -698,7 +703,19 @@ function evidenceCell(u, { filings = null, provider = null } = {}) {
698
703
  return link?.label ? officeRecordCell({ officeLink: link }, esc(handle)) : esc(handle);
699
704
  }
700
705
 
701
- function findingBlock(v, framework, markIndex, method = null, cite = {}) {
706
+ // A FINDING CARD'S ONE WEB PICTURE (owner, 2026-11-25): the picture of its earliest candidate page that arrived, saved by
707
+ // the picture step, in an "On the web" frame under the meta line, captioned with its site and opening the page. A card
708
+ // whose pages gave none draws no frame.
709
+ function findingWebFrame(v, markIndex, webPictures = new Map()) {
710
+ const p = (webPictures.get(koCardId(markIndex, v.ordinal)) ?? [])[0];
711
+ if (!p) return '';
712
+ const href = isHttpUrl(p.page) ? escAttr(p.page) : null;
713
+ const img = `<img src="${escAttr(p.src)}" alt="${escAttr(K.pictures.webAlt(v.name ?? '', p.site ?? '', p.fetchedOn ?? ''))}">`;
714
+ return `<div class="pic-line"><div class="pic-set"><div class="pic-head"><span class="pic-lab">${esc(K.pictures.onTheWeb)}</span></div><div class="rr-logos rr-band"><figure class="rr-lg">${
715
+ href ? `<a href="${href}" target="_blank" rel="noopener noreferrer">${img}</a>` : img}<figcaption>${esc(p.site ?? '')}</figcaption></figure></div></div></div>`;
716
+ }
717
+
718
+ function findingBlock(v, framework, markIndex, method = null, cite = {}, webPictures = new Map()) {
702
719
  const meta = [v.type, v.owner].filter(Boolean).map((s) => esc(s)).join(' · ');
703
720
  const ev = v.evidence.map((u) => evidenceCell(u, cite)).join(' · ');
704
721
  // THE CLEARANCE REPORT'S CARD, AND THE KNOCKOUT'S LOCATOR — both classes, deliberately. report.css
@@ -720,16 +737,16 @@ function findingBlock(v, framework, markIndex, method = null, cite = {}) {
720
737
  // manifest and can be any ladder a customer configures. Mapping one onto the other would be a second
721
738
  // table to keep in step — the same inline var the band chip already uses is the honest join.
722
739
  const stop = bandStop(framework, v.band);
723
- return `<div class="card ko-find" data-ko-mark="${Number(markIndex)}" data-ko-ord="${Number(v.ordinal)}">
740
+ return `<div class="card ko-find" id="${koCardId(markIndex, v.ordinal)}" data-ko-mark="${Number(markIndex)}" data-ko-ord="${Number(v.ordinal)}">
724
741
  <div class="top">
725
742
  <div class="rail" style="background:var(${stop})"></div>
726
743
  <div class="body">
727
744
  <div class="cardhead">
728
745
  <span class="fnum">${esc(v.ref)}</span><h3 class="who">${esc(v.name ?? K.finding.unnamed)}</h3>${
729
746
  v.band ? `<span class="ko-findband" style="background:var(${stop});color:var(${stop}-on)">${bandChipText(v.band, method, v.inputs)}</span>` : ''}${sourceChips(v)}
730
- <button class="ask-fi no-print">${K.finding.askAi}</button>
747
+ <span class="fi-acts no-print">${copyLinkButton()}<button class="ask-fi no-print">${K.finding.askAi}</button></span>
731
748
  </div>
732
- ${meta ? `<p class="ko-findmeta">${meta}</p>` : ''}
749
+ ${meta ? `<p class="ko-findmeta">${meta}</p>` : ''}${findingWebFrame(v, markIndex, webPictures)}
733
750
  ${v.lead ? `<p class="ko-findnet">${inlineMd(v.lead)}</p>` : ''}
734
751
  ${/* The 2026-09-16 report redesign — head, meta and the one-line read stay visible; the rest folds, as on
735
752
  a clearance card, so a screen of many names reads as a screen. */''}
@@ -1200,7 +1217,22 @@ function reviewerNotesBlock(m) {
1200
1217
  return '';
1201
1218
  }
1202
1219
 
1203
- function registerFindingBlock(v, markIndex, reads = null, framework = null, ownerChecks = [], method = null) {
1220
+ // THE FILING'S LOGO ON ITS CARD (owner, 2026-11-25): one "Register" frame holding that filing's logo where the run fetched
1221
+ // one, captioned with its register as a clearance card's logo is, with the alt text and the office link the filings table
1222
+ // gives it. A filing the run holds no record of, or whose logo did not arrive, draws no frame.
1223
+ function filingLogoFrame(r, { filingRecords = new Map(), logos = new Map() } = {}) {
1224
+ const key = normalizeRecordUri(r?.recordId);
1225
+ const rec = key ? filingRecords.get(key) : null;
1226
+ const fig = rec ? logoFigureHtml(rec, { uri: key, logo: logos.get(key), href: r.officeLink?.href ? escAttr(r.officeLink.href) : null, caption: true }) : null;
1227
+ return fig ? `<div class="pic-line"><div class="pic-set"><div class="pic-head"><span class="pic-lab">${esc(K.pictures.register)}</span></div><div class="rr-logos rr-band">${fig}</div></div></div>` : '';
1228
+ }
1229
+
1230
+ /** The filings a name's register cards draw, for the logo step to ask about as it asks about the table's rows. */
1231
+ export function cardFilings(registerRecords, mark, framework) {
1232
+ return registerCardsOnPage(registerCardViews(mark, framework, registerRecords).cards, mark, framework).map((v) => v.record);
1233
+ }
1234
+
1235
+ function registerFindingBlock(v, markIndex, reads = null, framework = null, ownerChecks = [], method = null, pictures = {}) {
1204
1236
  const r = v.record;
1205
1237
  // — THE RATER'S OWN READ OF THIS FILING, when it recorded one. `registerReads` is
1206
1238
  // joined to the record store by the validator, so a row that reaches here names a filing this run
@@ -1231,16 +1263,17 @@ function registerFindingBlock(v, markIndex, reads = null, framework = null, owne
1231
1263
  const meta = [r.owner ? esc(r.owner) : K.filingCard.proprietorNotStated, r.territory ? esc(r.territory) : null]
1232
1264
  .filter(Boolean).join(' · ');
1233
1265
  const receipt = officeRecordCell(r, isHttpUrl(r.url) ? linkOrText(r.url) : esc(r.recordId ?? K.filingCard.noRecordAddress));
1234
- return `<div class="card ko-find" data-ko-mark="${Number(markIndex)}" data-ko-ord="${Number(v.ordinal)}">
1266
+ return `<div class="card ko-find" id="${koCardId(markIndex, v.ordinal)}" data-ko-mark="${Number(markIndex)}" data-ko-ord="${Number(v.ordinal)}">
1235
1267
  <div class="top">
1236
1268
  <div class="rail" style="background:var(${stop ?? '--faint'})"></div>
1237
1269
  <div class="body">
1238
1270
  <div class="cardhead">
1239
1271
  <span class="fnum">${esc(v.ref)}</span><h3 class="who">${esc(r.mark ?? K.filingCard.unnamed)}</h3>${
1240
1272
  band ? `<span class="ko-findband" style="background:var(${stop});color:var(${stop}-on)">${bandChipText(band, method, row?.inputs)}</span>` : ''}<span class="src reg">${K.chips.register}</span>
1241
- <button class="ask-fi no-print">${K.finding.askAi}</button>
1273
+ <span class="fi-acts no-print">${copyLinkButton()}<button class="ask-fi no-print">${K.finding.askAi}</button></span>
1242
1274
  </div>
1243
1275
  <p class="ko-findmeta">${meta}</p>
1276
+ ${filingLogoFrame(r, pictures)}
1244
1277
  <p class="ko-findnet">${esc(v.statement)}</p>
1245
1278
  ${/* The 2026-09-16 report redesign — the head, the meta line and the one-line read stay visible; the rest
1246
1279
  sits behind a fold, as it does on a clearance card, so a screen of many names reads as a
@@ -1480,7 +1513,7 @@ function readBlock(m, framework, { opening = '' } = {}) {
1480
1513
  ].filter(Boolean).join('');
1481
1514
  }
1482
1515
 
1483
- function analysisSection(marks, framework, { registerCounts = null, probeRan = false, registerRecords = null, ownerChecks = [], frameworkMethod = null, cardOrder = null, opening = '' } = {}) {
1516
+ function analysisSection(marks, framework, { registerCounts = null, probeRan = false, registerRecords = null, ownerChecks = [], frameworkMethod = null, cardOrder = null, opening = '', filingRecords = new Map(), logos = new Map(), webPictures = new Map() } = {}) {
1484
1517
  const cite = { filings: filingsByHandle(registerRecords), provider: registerRecords?.provider ?? null };
1485
1518
  const cards = marks.map((m, markIndex) => {
1486
1519
  const bullets = readBlock(m, framework, { opening });
@@ -1491,7 +1524,7 @@ function analysisSection(marks, framework, { registerCounts = null, probeRan = f
1491
1524
  // before this order keeps the one it was delivered with: its findings, then its filing cards.
1492
1525
  const reg = registerCardViews(m, framework, registerRecords);
1493
1526
  const drawn = registerCardsOnPage(reg.cards, m, framework);
1494
- const regBlocks = drawn.map((v) => registerFindingBlock(v, markIndex, m?.registerReads, framework, ownerChecks, frameworkMethod)).join('');
1527
+ const regBlocks = drawn.map((v) => registerFindingBlock(v, markIndex, m?.registerReads, framework, ownerChecks, frameworkMethod, { filingRecords, logos })).join('');
1495
1528
  // The overflow counts what is NOT on the page against what met the promotion test — cards held back
1496
1529
  // by the cap and cards the rater put on the lowest rung alike, because from the reader's side they
1497
1530
  // are the same fact: further filings for this name, all of them listed below.
@@ -1506,7 +1539,7 @@ function analysisSection(marks, framework, { registerCounts = null, probeRan = f
1506
1539
  // nothing anywhere saying so. findings-model.mjs's view reads both shapes and drops nothing.
1507
1540
  const views = knockoutFindingViews(m, { manifest: framework });
1508
1541
  const weighsAFiling = (v) => Array.isArray(v?.weighedFilings) && v.weighedFilings.length > 0;
1509
- const findsOf = (list) => list.map((v) => findingBlock(v, framework, markIndex, frameworkMethod, cite)).join('');
1542
+ const findsOf = (list) => list.map((v) => findingBlock(v, framework, markIndex, frameworkMethod, cite, webPictures)).join('');
1510
1543
  // — THE REGISTER CARDS ARE INSIDE `body`, and that is the fall-through guard. A mark whose only
1511
1544
  // conflict is a filing on the register used to reach the sentence below and be published as clean.
1512
1545
  // The guard is deliberately TIGHT: a listed filing that is dead or out of the counted classes does
@@ -1633,7 +1666,17 @@ const CAVEAT_LEAD = K.caveatLead;
1633
1666
  // carries. What the document does not hold is the page's surface (which name, the workbook's portal address, the
1634
1667
  // confidentiality posture, the demo flag) and the two sets it holds by reference (each filing's saved record and each
1635
1668
  // saved logo), which publish resolves from the run. PURE given its inputs.
1636
- function knockoutContextOf(doc, { at, filingRecords = new Map(), logos = new Map(), auditHref = null, delivery = null, demoData = false } = {}) {
1669
+ /**
1670
+ * A name's web pictures as its own page keys them. The run's picture record keys each finding card by the name's place in
1671
+ * the run (`k<at>-<n>`), and a name's page draws its one name at place 0 (`k0-<n>`): read unchanged, every page but the
1672
+ * first would look up the first name's pictures. PURE.
1673
+ */
1674
+ export function picturesForNamePage(webPictures, at) {
1675
+ const from = `k${Number(at)}-`;
1676
+ return new Map([...(webPictures ?? new Map())].filter(([k]) => String(k).startsWith(from)).map(([k, v]) => [`k0-${String(k).slice(from.length)}`, v]));
1677
+ }
1678
+
1679
+ function knockoutContextOf(doc, { at, filingRecords = new Map(), logos = new Map(), webPictures = new Map(), auditHref = null, delivery = null, demoData = false } = {}) {
1637
1680
  const run = doc?.run ?? {}, scope = doc?.scope ?? {}, client = doc?.client ?? {}, framework = doc?.framework ?? {};
1638
1681
  const findings = client.findings ?? {};
1639
1682
  const m = (findings.marks ?? [])[at];
@@ -1651,7 +1694,7 @@ function knockoutContextOf(doc, { at, filingRecords = new Map(), logos = new Map
1651
1694
  identity: { identity: product.name ?? null, stageLabel: product.stageLabel ?? null, template: product.template ?? null, banner: product.banner ?? null },
1652
1695
  matter: run.runId, auditHref,
1653
1696
  leftOpen: knockoutLeftOpenOf(doc, at),
1654
- registerRecordsUnreadable: client.registerRecordsUnreadable, filingRecords, logos, demoData, depthNote: product.depthNote ?? null,
1697
+ registerRecordsUnreadable: client.registerRecordsUnreadable, filingRecords, logos, webPictures: picturesForNamePage(webPictures, at), demoData, depthNote: product.depthNote ?? null,
1655
1698
  searchPolicy: scope.policy ?? null, delivery, servedModels: client.servedModels, frameworkMethod: framework.method,
1656
1699
  });
1657
1700
  }
@@ -1665,7 +1708,7 @@ function knockoutContext(findings, framework, {
1665
1708
  // `registerRecords.unavailable` and anything invented for it would become client-facing wording.
1666
1709
  registerRecordsUnreadable = false,
1667
1710
  // Each listed filing's saved record and logo, by its normalised record id; empty draws the table as before.
1668
- filingRecords = new Map(), logos = new Map(),
1711
+ filingRecords = new Map(), logos = new Map(), webPictures = new Map(),
1669
1712
  // The searches this run did not complete, as Left open rows ({area, state, note}); empty draws no section.
1670
1713
  leftOpen = [],
1671
1714
  // The driver's own record of the owner lookups it ran. Defaults to [] so an
@@ -1766,7 +1809,7 @@ function knockoutContext(findings, framework, {
1766
1809
  // a disclosure, which is the one failure that would matter on a client-facing page. A similarity score
1767
1810
  // could; that is why there isn't one.
1768
1811
  const newCaveats = caveats.filter((c) => saysSomethingNew(c, SCOPE_BLOCK_TEXT));
1769
- const analysis = analysisSection(marks, framework, { registerCounts, probeRan, registerRecords, ownerChecks, frameworkMethod, cardOrder: findings?.cardOrder, opening: findings?.batch?.executiveSummary });
1812
+ const analysis = analysisSection(marks, framework, { registerCounts, probeRan, registerRecords, ownerChecks, frameworkMethod, cardOrder: findings?.cardOrder, opening: findings?.batch?.executiveSummary, filingRecords, logos, webPictures });
1770
1813
  // The request-level notes, gathered across every mark on the document and rendered ONCE at the top.
1771
1814
  // They are about the asking, not about a name, so a batch repeating them per mark would be the same
1772
1815
  // sentence three times. reviewerNotesBlock renders the rest, under that mark's own cards.
@@ -1876,8 +1919,10 @@ export const KNOCKOUT_PAGE = Object.freeze({
1876
1919
  input.pickbox anywhere, so a select-all would tick nothing. The shell reads what is defined here and
1877
1920
  offers only that, so an absent verb is an absent menu item instead of a control that fails.
1878
1921
  NO BACKTICKS IN THIS COMMENT. It sits inside a template literal, and a backtick ends it -- the failure
1879
- arrives at IMPORT time naming a token nobody wrote (portal-report.test.mjs pins the same rule). */
1880
- function openAll(v){document.querySelectorAll('details.ko-full').forEach(function(d){d.open=!!v;});}
1922
+ arrives at IMPORT time naming a token nobody wrote (portal-report.test.mjs pins the same rule).
1923
+ EXPAND ALL MEANS EVERY FOLD. It opened only the full assessment and left 20 of the demo's 21 folds alone, so a
1924
+ search of the page missed every term list and register record. It reads every fold, so a fold added later is in. */
1925
+ function openAll(v){document.querySelectorAll('details').forEach(function(d){d.open=!!v;});}
1881
1926
  /* No tick filter — there is nothing to filter. The beforeprint handler below opens every collapsed
1882
1927
  narrative first, so what prints is the whole document rather than whatever happened to be expanded. */
1883
1928
  function exportPDF(){window.print();}