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.
Files changed (146) hide show
  1. package/INSTALL.md +7 -4
  2. package/QUICKSTART.md +1 -0
  3. package/README.md +5 -2
  4. package/THIRD-PARTY-NOTICES.md +1 -1
  5. package/bin/clearotron.mjs +4 -2
  6. package/bin/onboard.mjs +158 -29
  7. package/build-info.json +2 -2
  8. package/docs/CLIENT-MCP.md +3 -1
  9. package/docs/DELIVERY.md +6 -3
  10. package/docs/architecture/02-architecture.md +1 -1
  11. package/docs/architecture/04-configuration-reference.md +105 -8
  12. package/docs/branding.md +4 -4
  13. package/docs/report-data/clearance-1.schema.json +320 -0
  14. package/docs/report-data/knockout-1.schema.json +268 -0
  15. package/driver/CHANGELOG.md +77 -0
  16. package/driver/cancel.mjs +19 -0
  17. package/driver/connotation-search.mjs +1 -1
  18. package/driver/contract-e3-backlog.mjs +41 -41
  19. package/driver/contract-vocabulary.mjs +1 -1
  20. package/driver/coverage-ledger.mjs +18 -2
  21. package/driver/deferral-row.mjs +1 -1
  22. package/driver/degraded-parts.mjs +1 -0
  23. package/driver/driver.config.mjs +5 -5
  24. package/driver/effective-scope.mjs +3 -1
  25. package/driver/engagement-receipt.mjs +3 -3
  26. package/driver/engine/anthropic-agent.mjs +15 -1
  27. package/driver/engine/common.mjs +7 -0
  28. package/driver/engine/mcp/band-server.mjs +7 -16
  29. package/driver/engine/mcp/codex-config.mjs +3 -0
  30. package/driver/engine/mcp/recording-server.mjs +45 -34
  31. package/driver/engine/openai-agent.mjs +74 -7
  32. package/driver/engine/session-record.mjs +44 -2
  33. package/driver/findings-model.mjs +14 -2
  34. package/driver/follow-up-twins.mjs +86 -0
  35. package/driver/gateway.mjs +77 -12
  36. package/driver/jx-units.mjs +3 -1
  37. package/driver/jx.mjs +13 -5
  38. package/driver/manuals-inline.mjs +98 -0
  39. package/driver/manuals-seen.mjs +134 -0
  40. package/driver/mark-logos.mjs +174 -0
  41. package/driver/methodology-witness.mjs +2 -1
  42. package/driver/owner-use-check.mjs +8 -4
  43. package/driver/package.json +1 -1
  44. package/driver/pipeline-knockout.mjs +23 -4
  45. package/driver/pipeline.mjs +128 -15
  46. package/driver/portal-local-auth.mjs +6 -2
  47. package/driver/portal-report.mjs +45 -14
  48. package/driver/portal-routes/me.mjs +4 -1
  49. package/driver/portal-runs.mjs +19 -16
  50. package/driver/predelivery-lint.mjs +7 -5
  51. package/driver/profiles.mjs +4 -4
  52. package/driver/publish/README.md +9 -7
  53. package/driver/publish/email-conditions.mjs +22 -5
  54. package/driver/publish/evidence-words.mjs +21 -0
  55. package/driver/publish/index.mjs +304 -211
  56. package/driver/publish/knockout.mjs +297 -247
  57. package/driver/publish/office-record-links.mjs +11 -9
  58. package/driver/publish/page-shell.mjs +98 -0
  59. package/driver/publish/pool-admin.mjs +2 -2
  60. package/driver/publish/publish-inputs.mjs +4 -0
  61. package/driver/publish/regions.mjs +28 -3
  62. package/driver/publish/register-record-html.mjs +105 -0
  63. package/driver/publish/register-record.mjs +165 -0
  64. package/driver/publish/render-knockout.mjs +299 -671
  65. package/driver/publish/render.mjs +561 -492
  66. package/driver/publish/report-data.mjs +226 -13
  67. package/driver/publish/report-document.mjs +353 -0
  68. package/driver/publish/search-depth.mjs +88 -7
  69. package/driver/publish/shell.mjs +41 -1
  70. package/driver/publish/strings.mjs +810 -0
  71. package/driver/publish/templates/clearance-print.css +23 -0
  72. package/driver/publish/templates/knockout.css +224 -0
  73. package/driver/publish/templates/report.css +112 -53
  74. package/driver/publish/xlsx.mjs +158 -139
  75. package/driver/record-goods.mjs +42 -0
  76. package/driver/reference-score.mjs +4 -1
  77. package/driver/register-count.mjs +5 -1
  78. package/driver/register-reach.mjs +39 -0
  79. package/driver/registry-fidelity.mjs +155 -37
  80. package/driver/repair-composers.mjs +7 -3
  81. package/driver/repair-targets.mjs +4 -1
  82. package/driver/replay-archive.mjs +4 -3
  83. package/driver/run-delivered.mjs +14 -8
  84. package/driver/run-record.mjs +1 -0
  85. package/driver/runner.mjs +73 -29
  86. package/driver/scope-facts.mjs +27 -6
  87. package/driver/search-policy.mjs +9 -4
  88. package/driver/skills/clearance-search/report-prose.md +3 -0
  89. package/driver/skills/knockout-assess/SKILL.md +8 -0
  90. package/driver/stage-freshness.mjs +8 -5
  91. package/driver/stages.mjs +69 -43
  92. package/driver/steps/delivery.mjs +9 -5
  93. package/driver/steps/overview-and-cards.mjs +54 -15
  94. package/driver/steps/register-sweep.mjs +5 -4
  95. package/driver/steps/skeptic-and-follow-up.mjs +3 -2
  96. package/driver/steps/verdict-gate.mjs +35 -14
  97. package/driver/suite-census.json +579 -87
  98. package/driver/synthesis-record.mjs +4 -3
  99. package/driver/terminal-clamp.mjs +6 -1
  100. package/driver/withdrawn-rating.mjs +72 -0
  101. package/mcp-server/CHANGELOG.md +8 -0
  102. package/mcp-server/lib/audit-view.mjs +5 -2
  103. package/mcp-server/lib/brief.mjs +6 -2
  104. package/mcp-server/lib/evidence.mjs +94 -23
  105. package/mcp-server/lib/findings.mjs +19 -2
  106. package/mcp-server/lib/knockout.mjs +13 -4
  107. package/mcp-server/lib/scrub.mjs +1 -1
  108. package/mcp-server/package.json +1 -1
  109. package/mcp-server/server.mjs +22 -3
  110. package/package.json +4 -1
  111. package/portal-ui/dist/assets/{index-CYaO2ygd.js → index-BBlN4CYq.js} +238 -80
  112. package/portal-ui/dist/assets/{index-izLa9apq.css → index-CxAkJXIT.css} +25 -5
  113. package/portal-ui/dist/index.html +2 -2
  114. package/portal-ui/package.json +3 -3
  115. package/providers/_shared/ledger.mjs +30 -2
  116. package/providers/_shared/record-uri.mjs +15 -0
  117. package/providers/clarivate/src/adapter.js +11 -0
  118. package/providers/clarivate/src/core.js +17 -1
  119. package/providers/jx/src/core.js +4 -4
  120. package/providers/jx/src/judge.js +1 -3
  121. package/providers/jx/src/nativeread.js +1 -3
  122. package/providers/oauth-mcp-bridge/CHANGELOG.md +8 -0
  123. package/providers/oauth-mcp-bridge/package.json +1 -1
  124. package/scripts/README.md +147 -3
  125. package/scripts/added-reference-check.mjs +35 -7
  126. package/scripts/e2e-first-time.mjs +4 -4
  127. package/scripts/env-audit.mjs +16 -9
  128. package/scripts/freeze-example-run.mjs +3 -3
  129. package/scripts/mint-public-residue.mjs +3 -3
  130. package/scripts/mint-search-level-tags.mjs +61 -0
  131. package/scripts/mint-source-pin-census.mjs +89 -0
  132. package/scripts/release-note-required.mjs +65 -6
  133. package/scripts/test-durations-reporter.mjs +25 -0
  134. package/scripts/test-full.mjs +72 -18
  135. package/scripts/test-run.mjs +18 -1
  136. package/shared/brand.mjs +93 -6
  137. package/shared/inline-markdown.mjs +53 -0
  138. package/shared/names-in-force.mjs +0 -1
  139. package/shared/portal-tokens.mjs +2 -1
  140. package/shared/reference-guard-classes.mjs +43 -2
  141. package/shared/register-selection.mjs +8 -3
  142. package/shared/search-level-tags.json +25 -0
  143. package/shared/source-spans.mjs +91 -0
  144. package/shared/tools/derive-band-pairs.mjs +10 -0
  145. package/driver/own-rights.mjs +0 -83
  146. package/driver/use-check.mjs +0 -85
@@ -160,9 +160,13 @@ export function credentialPathFor(env = process.env, home = null) {
160
160
  * file, names it. That also covers an operator who set `PORTAL_LOCAL_CREDENTIAL` themselves, who had
161
161
  * the same broken line and no demo in sight.
162
162
  */
163
- export function passphraseResetCommand({ prefix = "", credentialPath = null, env = process.env, home = null } = {}) {
164
- const base = `${prefix}clearotron passphrase --reset`;
163
+ export function passphraseResetCommand({ prefix = "", credentialPath = null, env = process.env, home = null, exists = existsSync } = {}) {
165
164
  const path = credentialPath ?? env.PORTAL_LOCAL_CREDENTIAL ?? null;
165
+ // THE DEMO'S OWN PROGRAM, WHERE IT HAS ONE. A demo started through npx keeps a copy of the program in its
166
+ // base (shared/permanent-install.mjs), and a bare `clearotron` names no program that reader has on PATH.
167
+ const demoProgram = path && basename(path) === INSTALL_CREDENTIAL_FILE ? join(dirname(path), "program", "bin", "clearotron") : null;
168
+ const program = demoProgram && exists(demoProgram) ? (/\s/.test(demoProgram) ? `"${demoProgram}"` : demoProgram) : `${prefix}clearotron`;
169
+ const base = `${program} passphrase --reset`;
166
170
  if (!path || path === credentialPathFor({}, home)) return base;
167
171
  // AN INSTALL'S OWN FILE IS NAMED BY ITS INSTALL, the way `clearotron start` names it: `--base`, which the
168
172
  // verb resolves through installCredential exactly as start does, and nothing at all for the default
@@ -197,6 +197,31 @@ const CHROME_RES = [
197
197
  { tag: "div", open: /<div class="[^"]*\bfab-stack\b[^"]*"[^>]*>/ },
198
198
  ];
199
199
 
200
+ // ── the chrome a renderer marks as its own ──────────────────────────────────────────────────────────
201
+ //
202
+ // Both renderers put `data-report-chrome` on the root of each piece of chrome the portal draws for itself:
203
+ // the sticky header on both reports, and the Knockout's floating theme toggle. A report rendered with the
204
+ // marker is stripped by it, element by element and balanced by its own tag, so a renamed class or a
205
+ // reshaped header no longer stops a strip without a sound. The attribute changes nothing a reader sees,
206
+ // and no stylesheet selects on it.
207
+ //
208
+ // THE CLASS RULES ABOVE STAY. Stored reports are served from their own bytes for as long as they are
209
+ // kept, and a report rendered before the marker carries only the classes. A class rule leaves only when
210
+ // no stored report matches it any more. On a marked report they find nothing left to remove.
211
+ const MARKED_CHROME_RE = /<([a-z]+)\b[^>]*\sdata-report-chrome\b[^>]*>/gi;
212
+
213
+ function stripMarkedChrome(html, onUnbalanced = () => {}) {
214
+ const tags = new Set([...html.matchAll(MARKED_CHROME_RE)].map((m) => m[1].toLowerCase()));
215
+ let out = html;
216
+ let removed = 0;
217
+ for (const tag of tags) {
218
+ const r = stripBalanced(out, new RegExp(`<${tag}\\b[^>]*\\sdata-report-chrome\\b[^>]*>`), tag, onUnbalanced);
219
+ out = r.html;
220
+ removed += r.removed;
221
+ }
222
+ return { html: out, removed };
223
+ }
224
+
200
225
  // ── labelled internal tails: the MID-LINE form the element strip cannot see ──────────────────────────
201
226
  //
202
227
  // publish/parse.mjs is the authority on what `[internal] ` means: stripInternal({client:false}) labels
@@ -310,7 +335,7 @@ const REVIEWER_LEGEND_RE =
310
335
 
311
336
  // ── the Ask-your-AI block: STAFF ONLY, and this one IS a boundary ────────────────────────────────────
312
337
  //
313
- // The report embeds a "paste this into your own AI" connector URL. ONE report (spec 2026-07-30 §5):
338
+ // The report embeds a "paste this into your own AI" connector URL. ONE report:
314
339
  // the renderer has one path and always bakes the STAFF surface — CLEAROTRON_MCP_URL plus a run-scoped
315
340
  // read-only token — or FAILS CLOSED and omits the block entirely when the env is unset, rather than
316
341
  // falling back to a placeholder host. That is critic finding 4, written into the renderer as
@@ -359,8 +384,8 @@ const MCP_HOST_RE = /https?:\/\/[A-Za-z0-9.-]+\/mcp/gi;
359
384
  // The footer's "Rated under:" line — the ONE piece of engine scaffolding that is not element-shaped.
360
385
  //
361
386
  // It renders inline in the confidentiality footer as `<br>Rated under: <span class="mono">…</span>.` and
362
- // carries the account key, the framework name and a profile content hash ("Sim Praxis (sim-praxis) · house
363
- // default framework · profile 133826183db4"). The hash is a fingerprint of an internal config file: it
387
+ // carries the account key, the framework name and a profile content hash ("Quillmere Labs (quillmere) · house
388
+ // default framework · profile 5e0c7d21a94f"). The hash is a fingerprint of an internal config file: it
364
389
  // means nothing to a reader, identifies an internal artefact, and travels in a document designed to be
365
390
  // forwarded. Same ruling as the blocks above; a different removal only because the markup gives nothing
366
391
  // balanced to strip.
@@ -378,6 +403,12 @@ const RUN_UNDER_PROJECT_RE = /<br\s*\/?>Run under project:\s*<span class="mono">
378
403
 
379
404
  const CONNECTOR_TOKEN_RE = /([?&])token=v1\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+(&)?/g;
380
405
 
406
+ // WHAT DRIFT LOOKS LIKE, read from the served document rather than from what the strips removed: any
407
+ // `<nav>` carrying a site-nav class, and any `token=` query value of the connector's dotted shape, in any
408
+ // version. Wider than the strips on purpose, so a renamed class or a new token version is still seen.
409
+ const navSurvived = (html) => /<nav\b[^>]*\bclass\s*=\s*["'][^"']*\bsite-?nav\b/i.test(html);
410
+ const tokenSurvived = (html) => /[?&]token=v\d+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/.test(html);
411
+
381
412
  function dropConnectorToken(html) {
382
413
  let dropped = 0;
383
414
  // The separator arithmetic, which is the only fiddly part: a parameter is removed together with ONE
@@ -911,6 +942,7 @@ export function prepareReportForEmbed(html, { staff = false, poolRoot = null, fe
911
942
  let out = nav.html;
912
943
  const strippedNav = nav.removed;
913
944
 
945
+ out = stripMarkedChrome(out, note).html;
914
946
  for (const { open, tag } of CHROME_RES) out = stripBalanced(out, open, tag, note).html;
915
947
 
916
948
  // The baked connector credential comes out for EVERYONE, before the audience branch below decides
@@ -996,7 +1028,7 @@ export function prepareReportForEmbed(html, { staff = false, poolRoot = null, fe
996
1028
  /**
997
1029
  * Read a run's report from the pool and prepare it.
998
1030
  *
999
- * ONE file: `report.html`, the full report. The cutover is complete (spec 2026-07-30 §5):
1031
+ * ONE file: `report.html`, the full report. The cutover is complete:
1000
1032
  * `report.client.html` is no longer produced at publish, the per-customer index pages link
1001
1033
  * `report.html`, and the client-access service at clients.example.com serves reports through THIS
1002
1034
  * function (staff:false) rather than reading any file by path. Old pool dirs may still hold a stale
@@ -1118,17 +1150,16 @@ export function readReport(dir, { log = () => {}, staff = false, poolRoot = null
1118
1150
  if (neutralised > 0) {
1119
1151
  log(`report-embed: ${neutralised} cross-tenant link(s) survived the nav strip in ${dir} — nav markup may have drifted`);
1120
1152
  }
1121
- if (strippedNav === 0) {
1122
- // Not fatal: a report rendered without the shared nav is legitimate (some publish paths omit it).
1123
- // Worth a line, because the other explanation is that the strip stopped working.
1124
- log(`report-embed: no site nav found in ${dir} (fine if it was rendered without one)`);
1153
+ // THE TWO CANARIES SPEAK ONLY ON DRIFT. They used to log whenever nothing was stripped, and no renderer
1154
+ // writes a site nav or a connector token any more, so they logged on every current report and drift read
1155
+ // the same as normal. Now each looks at what is SERVED: a site nav or a token still in it means a report
1156
+ // carried one in a shape the strip no longer matches.
1157
+ if (navSurvived(html)) {
1158
+ log(`report-embed: a site nav survived the strip in ${dir} (stripped ${strippedNav}) — nav markup drifted`);
1125
1159
  }
1126
- if (tokensDropped === 0) {
1127
- // Every report the current renderer publishes carries exactly one. Zero means either a run published
1128
- // before connector tokens existed (fine, and common in the archive) or that the renderer changed shape
1129
- // and this strip is now a no-op — which would put a bearer credential back into a served document with
1130
- // nothing else to catch it. Said at INFO rather than asserted, because the benign case is real.
1131
- log(`report-embed: no connector token found in ${dir} (fine on a pre-connector run; otherwise the renderer's URL shape moved)`);
1160
+ if (tokenSurvived(html)) {
1161
+ // A bearer credential in a served document, with nothing else to catch it.
1162
+ log(`report-embed: a connector token survived the strip in ${dir} (dropped ${tokensDropped}) — the renderer's URL shape moved`);
1132
1163
  }
1133
1164
  return html;
1134
1165
  }
@@ -5,7 +5,7 @@
5
5
  // the searches an account can order.
6
6
  //
7
7
  // One of the portal service's route groups, moved out of its dispatcher unchanged; makePortalService says how it asks them.
8
- import { ADMINISTRATOR_CONTACT, ORGANISATION_NAME } from "../../shared/brand.mjs";
8
+ import { ADMINISTRATOR_CONTACT, ORGANISATION_NAME, BRAND } from "../../shared/brand.mjs";
9
9
  import { browserCommand, installRoute } from "../../shared/invocation.mjs";
10
10
  import { productIdentity } from "../../shared/product-identity.mjs";
11
11
  import { assertPrincipal, principalView, seesEverything } from "../portal-access.mjs";
@@ -106,6 +106,9 @@ export async function meRoutes({ poolRoot, stopControl, demo, orderRefusal, load
106
106
  return { status: 200, json: { email: principal.email, ...principalView(principal, grantsHere, accountNames),
107
107
  accounts: principal.accounts, accountNames, accountFacts,
108
108
  concurrentRuns: concurrentRunsCap(), brand: ORGANISATION_NAME, engineMode: meEngineMode, houseMarketplaces,
109
+ // WHAT THIS INSTALLATION CALLS ITSELF: the logo, the page title and the sentences that name the
110
+ // installation read it. Not `brand`, which is who OPERATES it and is null until somebody names one.
111
+ brandName: BRAND.name,
109
112
  // WHERE A PERSON ASKS FOR A CHANGE TO THEIR SIGN-IN, beside the brand and read where it is read:
110
113
  // an href Preferences links "Clearotron administrator" to, or null, and then the words are plain.
111
114
  administratorContact: ADMINISTRATOR_CONTACT,
@@ -184,16 +184,13 @@ export function scanAccountRuns({ poolRoot, workspaceRoot, account = null, gener
184
184
  ? meta.marks.filter((m) => m && typeof m.name === "string")
185
185
  .map((m) => ({ name: m.name, band: m.band ?? null, tone: toneFor(m.band ?? null) }))
186
186
  : [],
187
- // Present ⇒ the run has a report-data.json and can render natively. Absent ⇒ legacy: the Result
188
- // screen iframes the baked file. Legacy is identified by ABSENCE, so this must stay undefined
189
- // rather than defaulting to 0 or 1.
190
- // BOTH writers (publish/knockout.mjs and the clearance producer) stamp the STRING
191
- // 'report-data/1' — gating on `typeof === "number"` alone meant the native-render flag NEVER
192
- // armed, even for runs with a report-data.json on disk (2026-07-29, filed during PR-9). The
193
- // string form maps to its numeric version; a bare number is honoured; anything else is legacy.
187
+ // The data file's version: present ⇒ the run has a report-data.json beside its report; absent
188
+ // (null) ⇒ it has none. Both writers stamp a STRING: `report-data/clearance-1` or
189
+ // `report-data/knockout-1` since the two shapes were named, `report-data/1` on runs stored before
190
+ // that. Each maps to its number; a bare number is honoured; anything else is null.
194
191
  reportSchema: typeof meta.reportSchema === "number" ? meta.reportSchema
195
- : typeof meta.reportSchema === "string" && /^report-data\/(\d+)$/.test(meta.reportSchema)
196
- ? Number(meta.reportSchema.slice("report-data/".length)) : null,
192
+ : typeof meta.reportSchema === "string" && /^report-data\/(?:(?:clearance|knockout)-)?(\d+)$/.test(meta.reportSchema)
193
+ ? Number(/(\d+)$/.exec(meta.reportSchema)[1]) : null,
197
194
  // `report` is the run-level link and it is NULL for a batch — there is no run-level document
198
195
  // to open. `reports` is the list, one entry per name, and it is what a batch's row renders.
199
196
  // A single-document run carries both, pointing at the same place, so nothing that reads
@@ -228,10 +225,16 @@ export function scanAccountRuns({ poolRoot, workspaceRoot, account = null, gener
228
225
  const readRun = (dir) => {
229
226
  try {
230
227
  const s = readJson(join(dir, "status.json"));
231
- const p = readJson(paths(dir).profile);
228
+ // A DELIVERED RUN IS SKIPPED BEFORE ITS PROFILE IS READ: the pool row is its face, and every path
229
+ // below returns for it either way, so reading the profile first only cost a file per delivered run.
230
+ if (s.state === "delivered") return; // the pool row is the delivered face
231
+ // ONE `paths()` PER RUN STILL IN FLIGHT. It joins every path of a run's record, 164 of them, and this
232
+ // walk called it twice for every workspace run, delivered or not: on a test deployment's 33 workspace runs
233
+ // that was most of this walk's time on every poll (measured 2026-11-19).
234
+ const P = paths(dir);
235
+ const p = readJson(P.profile);
232
236
  const owner = p.profileKey ?? p.key ?? "generic";
233
237
  if (!mine(owner, p.organisation ?? null)) return;
234
- if (s.state === "delivered") return; // the pool row is the delivered face
235
238
  // ── — RETIREMENT REACHES A RUN THAT NEVER PUBLISHED ──────────────────
236
239
  //
237
240
  // The pool branch above has honoured the sidecar since; this branch never did, so a tag
@@ -249,7 +252,7 @@ export function scanAccountRuns({ poolRoot, workspaceRoot, account = null, gener
249
252
  // search-policy sidecar carries the stage. Both are read here so a run does not change identity
250
253
  // when it crosses from live to delivered: same mark, same stage, same thread.
251
254
  let sp = null;
252
- try { sp = readJson(paths(dir).searchPolicy); } catch { /* legacy/early run */ }
255
+ try { sp = readJson(P.searchPolicy); } catch { /* legacy/early run */ }
253
256
  // A PAUSE IS NOT A RUN. The engine writes `postponed` (a rate-limit park, auto-resuming at
254
257
  // `resetsAt`) and `recovering` (an auto-retry backing off), and the portal contract knows neither
255
258
  // — its coercion treats anything unrecognised as `running`. So a run parked for five hours showed
@@ -279,8 +282,8 @@ export function scanAccountRuns({ poolRoot, workspaceRoot, account = null, gener
279
282
  kind: (policyFor(sp?.level)?.pipeline ?? (s.lane === "knockout" ? "knockout" : null)) === "knockout" ? "knockout-batch" : "clearance",
280
283
  markName: typeof s.markName === "string" ? s.markName : null,
281
284
  // The project, straight off the frozen sidecar this branch already reads as `p`. A LIVE run needs
282
- // no publish stamp and no back-fill — the sidecar is right there, and freezeProfile has written
283
- // both fields since spec 62.
285
+ // no publish stamp and no back-fill — the sidecar is right there, and freezeProfile writes
286
+ // both fields.
284
287
  projectKey: typeof p.projectKey === "string" ? p.projectKey : null,
285
288
  projectName: typeof p.projectName === "string" ? p.projectName : null,
286
289
  // Registry first here too — a live run's frozen policy sidecar names WHICH level is running; what
@@ -463,7 +466,7 @@ export function scanAccountRuns({ poolRoot, workspaceRoot, account = null, gener
463
466
  // THE CANONICAL INTAKE FIRST, and it is why this parameter exists. `CLEAROTRON_QUEUE_DIR` is where the
464
467
  // enqueue CLI and ops-MCP `start_run` write — which is where the PORTAL's own submissions land, since
465
468
  // its `trigger` is an ops-MCP hop. The walk below finds only `workspace-*/studio/clearance-search/queue`,
466
- // and a documented headless install has no workspaces at all: measured on the test box, the only queue
469
+ // and a documented headless install has no workspaces at all: measured on a test deployment, the only queue
467
470
  // under the whole tree is the configured one, and it holds portal-prefixed jobs. So this scan ran ZERO
468
471
  // times there, and a submitted search was invisible on the dashboard from submit until claim — a
469
472
  // minute and a half of a client believing their order was lost.
@@ -532,7 +535,7 @@ export const concurrentRunsCap = () => {
532
535
 
533
536
  export function forRole(runs, principal) {
534
537
  // A person who sees everything reads failure reasons verbatim; everyone else gets the plain note. That redaction is the ONLY
535
- // role-shaping left: the held-run suppression is retired (one report, spec 2026-07-30 §5 — a run you
538
+ // role-shaping left: the held-run suppression is retired (one report — a run you
536
539
  // have rights to is always listed; the machine-QC record lives on the audit workbook).
537
540
  if (seesEverything(principal)) return runs;
538
541
  return runs.map((r) => {
@@ -40,6 +40,7 @@ import { normalizeBand } from "./framework.mjs";
40
40
  import { clientConditions, unrenderableConditions, ENGINE_TOKEN_RE, ENGINE_PHRASE_RE } from "./terminal-clamp.mjs"; // the reader's clause per condition, and the token shape it may never carry
41
41
  import { knockoutNoteView, REQUEST_NOTE_WORDS, REQUEST_SUBJECT_WORDS } from "./findings-model.mjs"; // one reader for where a note prints
42
42
  import { isEngineAppendedCaveat } from "./knockout-caveats.mjs"; // ONE derivation for "the engine appended this caveat, not a seat"
43
+ import { axisTwin, kindsForFollowUp } from "./follow-up-twins.mjs"; // when a written row stands in for a Follow-up row, as the page decides
43
44
 
44
45
  // V4-3: diacritics FOLD (NFD strip) instead of being deleted — "Televisión" must normalize to
45
46
  // "television" (deletion made it "televisin", so a diacritic mention never matched its introduction).
@@ -226,13 +227,14 @@ const PAGE_COV_STOPWORDS = new Set(["the", "a", "an", "as", "for", "of", "in", "
226
227
  "was", "it", "its", "this", "that", "with", "by", "at", "be", "been", "run", "search", "searched"]);
227
228
  const pageCovWords = (t) => new Set(String(t || "").toLowerCase().match(/[a-z0-9]+/g)?.filter((w) => !PAGE_COV_STOPWORDS.has(w)) ?? []);
228
229
  /** The coverage rows the page draws: not clean, and not a follow-up row another open row restates (render.mjs dedupeFollowUps). PURE. */
229
- function pageDrawnCoverage(coverage) {
230
+ function pageDrawnCoverage(coverage, followUpKinds = null) {
230
231
  const open = (Array.isArray(coverage) ? coverage : []).filter((c) => c && typeof c === "object" && c.state !== "confirmed-clean");
231
232
  const composed = (c) => String(c?.area || "").startsWith(PAGE_FOLLOW_UP_PREFIX);
232
233
  const written = open.filter((c) => !composed(c));
233
234
  if (!written.length) return open;
234
235
  return open.filter((c) => {
235
236
  if (!composed(c)) return true;
237
+ if (axisTwin(String(c.note || "").split("\u2014")[0], kindsForFollowUp(c, followUpKinds), written)) return false; // the page's rule, follow-up-twins.mjs
236
238
  const directive = pageCovWords(String(c.note || "").split("\u2014")[0]);
237
239
  if (!directive.size) return true;
238
240
  return !written.some((w) => {
@@ -244,9 +246,9 @@ function pageDrawnCoverage(coverage) {
244
246
  });
245
247
  }
246
248
  /** Every line the page draws from the record that can name a party: the drawn coverage rows, and the names it lists. PURE. */
247
- export function pageNameLines({ coverage = [], webNames = [] } = {}) {
249
+ export function pageNameLines({ coverage = [], webNames = [], followUpKinds = null } = {}) {
248
250
  return [
249
- ...pageDrawnCoverage(coverage).map((c) => `${c.area ?? ""} ${c.note ?? ""}`),
251
+ ...pageDrawnCoverage(coverage, followUpKinds).map((c) => `${c.area ?? ""} ${c.note ?? ""}`),
250
252
  ...(Array.isArray(webNames) ? webNames : []).slice(0, PAGE_WEB_NAMES_SHOWN).map((w) => String(w?.title ?? "")),
251
253
  ];
252
254
  }
@@ -2501,7 +2503,7 @@ export function cardBudgetChecks({ cardFolds }) {
2501
2503
  `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("; ")}`)];
2502
2504
  }
2503
2505
 
2504
- 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 }) {
2506
+ export function runLint({ followUpKinds = null, 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 }) {
2505
2507
  // WS-B: the run's profile platforms join the vocabulary for this run. Profiles carry store
2506
2508
  // DOMAINS by contract, so derive the name tokens a report would actually print: the raw norm
2507
2509
  // ("thomasnetcom"), the separator-spaced phrase ("thomasnet com" / "made in china com"), and the
@@ -2541,7 +2543,7 @@ export function runLint({ depth, commonLawGrid, matterContext, clientPartyName,
2541
2543
  try { coverage = JSON.parse(findingsRaw)?.coverage ?? []; } catch { /* no record: the page draws no row from it */ }
2542
2544
  let webNames = [];
2543
2545
  try { webNames = auditMd ? clearedNames(auditMd).web : []; } catch { /* an unreadable audit lists no names */ }
2544
- return pageNameLines({ coverage, webNames }).join("\n");
2546
+ return pageNameLines({ coverage, webNames, followUpKinds }).join("\n");
2545
2547
  })();
2546
2548
  checks.push(...referenceChecks({ actionsText: onlyYou, fullSurface: reportMd, searchedNames, surface: "report", extraVocab, markNames, structural: actionsExpected === true, introducedIn: onThePage }));
2547
2549
  // V4-5 (+ PR-3): with a typed register the reachability check asserts over the STORE the
@@ -414,10 +414,10 @@ export function normalizeDelivery(d) {
414
414
 
415
415
  // delivery.template (Phase 1): a NAMED deliverable-template variant, validated against this closed registry.
416
416
  // One variant exists today — "standard" (the current code-composed report); a profile that omits it gets the
417
- // default. The registry is the un-park point: when a real second format is defined, add its name here AND a
418
- // render branch + meta stamp keyed off it (the publish path already records the chosen name in meta.json, so
419
- // the field is a live consumer, not a dead knob). Keeping it a closed enum means a typo'd template name
420
- // hard-fails at load rather than silently rendering the default.
417
+ // default. A second format, when one is defined, is a SKIN the one renderer reads (its tokens, its section list,
418
+ // its string set), named here; never a second render branch chosen by this value. The publish path records the
419
+ // chosen name in meta.json, so the field is a live consumer, not a dead knob. Keeping it a closed enum means a
420
+ // typo'd template name hard-fails at load rather than silently rendering the default.
421
421
  export const DEFAULT_DELIVERY_TEMPLATE = "standard";
422
422
  export const KNOWN_DELIVERY_TEMPLATES = [DEFAULT_DELIVERY_TEMPLATE];
423
423
 
@@ -30,17 +30,17 @@ field. `publishReport()` writes the pool run dir from that document. `coverNoteO
30
30
  note's options from the run's frozen files, for the document and for the delivery's email.
31
31
  `knockout.mjs` is built the same way: `readKnockoutDocument()`, then `publishKnockout()`.
32
32
 
33
- **`render.mjs`** — but read `../test/render-frozen.test.mjs` first. The renderer is pinned by a sha256
34
- over its exact bytes, because `republishRun` re-renders reports already delivered to clients through it.
35
- Editing it is a decision to argue for in the commit message; almost every visual change belongs in
36
- `templates/report.css` or `../../shared/brand.mjs` instead, neither of which is frozen.
33
+ **`render.mjs`** — but read `../test/render-frozen.test.mjs` first. The four demo runs' report pages are
34
+ compared with a stored record, so a change to what a page prints, from this file, `templates/report.css` or
35
+ `../../shared/brand.mjs`, fails that test until it is re-stamped in the same commit. Republishing a run made
36
+ by another build is refused, so a delivered report keeps the page it was issued with.
37
37
 
38
38
  ## Files
39
39
 
40
40
  | File | Role |
41
41
  |---|---|
42
42
  | `index.mjs` | `readClearanceDocument` and `publishReport` — the clearance publish step; also `regenIndex` (staff + per-customer pool indexes), the email composers, `coverNoteOptions` and `riskTier`/`TONE_TIER` |
43
- | `render.mjs` | `report.md` + `findings.json` → `report.html`. FROZEN — see above |
43
+ | `render.mjs` | `report.md` + `findings.json` → `report.html`. Its page is guarded — see above |
44
44
  | `parse.mjs` | The presentation-agnostic `report.md` parse the clearance renderer and the audit workbook build from |
45
45
  | `publish-inputs.mjs` | The closed table of run-side stores publish reads, and what an absent one means |
46
46
  | `report-data.mjs` | `report-data.json` for a clearance run — the client cut by construction, pure (no IO) |
@@ -48,10 +48,12 @@ Editing it is a decision to argue for in the commit message; almost every visual
48
48
  | `audit-from-spine.mjs` | Builds the `audit.md` contract from the spine's markdown tables — no LLM, count-guarded |
49
49
  | `knockout.mjs` | The knockout publisher: `readKnockoutDocument`, then per-mark reports, its workbook, its cover note |
50
50
  | `shell.mjs` | What publishing does whichever report it is: the run's pool folder and its writers, a part that fails without stopping the report, `meta.json` last with the index refresh, and the staff pages |
51
- | `render-knockout.mjs` | The knockout report's HTML. A sibling of `render.mjs`; imports nothing from it |
51
+ | `render-knockout.mjs` | The knockout report's HTML. A sibling of `render.mjs`: it takes the demo banner and the served-models line from it |
52
+ | `page-shell.mjs` | The document both renderers wrap their page in: head, title, typefaces, favicon, theme script and the base, dark and print styles. Each renderer passes its own title, sheet and chrome address |
52
53
  | `report-registry.mjs` | Template name → publisher, and `republishRun` |
53
54
  | `archive-tags.mjs` | The pool's `archive-tags.json` visibility sidecar, and its single writer |
54
55
  | `pool-admin.mjs` | Operator CLI over the pool: list, archive/unarchive, reassign, regen, republish |
55
56
  | `regions.mjs` | The one country/jurisdiction naming source for every render surface |
56
57
  | `profiles-page.mjs` | Generates the pool's `profiles.html` from `../profile-page.html` |
57
- | `templates/report.css` | The report layout vocabulary, shared by both renderers. Not frozen |
58
+ | `templates/report.css` | The report layout vocabulary, shared by both renderers |
59
+ | `templates/knockout.css` | The layout the knockout report adds on top of `report.css`, every selector `ko-`prefixed |
@@ -4,18 +4,35 @@
4
4
  // email-conditions.mjs — the conditions the cover email carries in its "Only you can close these" box.
5
5
  //
6
6
  // The email composes its box from this list, and the delivery check reads the same list as the email's own action
7
- // lines, so the two cannot differ. It lives beside the renderer rather than in it: render.mjs is frozen
8
- // (render-frozen.test.mjs), and this reads it without changing it.
7
+ // lines, so the two cannot differ. It lives beside the renderer rather than in it: render.mjs was hash-frozen
8
+ // when this was written (render-frozen.test.mjs), and this reads it without changing it.
9
9
  //
10
10
  // The delivery check is HANDED the list, by the run and by the replay, rather than importing this: the check runs inside
11
11
  // the tool servers too, and the renderer would bring the brand settings into every server's environment.
12
12
  import { parseActionBuckets, actYouConditions } from './render.mjs';
13
13
  import { parseFront, parseSections } from './parse.mjs';
14
+ import { EMAIL } from './strings.mjs';
14
15
 
15
- /** The report's only-you items, on a conditional or blocking result only. PURE. */
16
- export function emailConditionsOf(actionsSection, verdict) {
16
+ /**
17
+ * The items the report lists under its own "Before you can rely on this result" heading, in order. That group alone: a
18
+ * question for the client or a watch item is not a condition of reliance. Empty where the report names none. PURE.
19
+ */
20
+ export function relyBeforeOf(actionsSection) {
21
+ const you = parseActionBuckets(actionsSection).you;
22
+ if (!you?.body) return [];
23
+ const groups = String(you.body).split(/^(?=\s*\*\*.+\*\*\s*$)/m);
24
+ const group = groups.find((g) => g.trim().replace(/\n[\s\S]*$/, '').replace(/\*\*/g, '').trim() === EMAIL.beforeYouCanRely);
25
+ return group ? actYouConditions({ body: group }) : [];
26
+ }
27
+
28
+ /**
29
+ * The report's only-you items, on a conditional or blocking result only. Where the assessment did not complete there is
30
+ * no result to condition, and the items are the report's own conditions of reliance (relyBeforeOf). PURE.
31
+ */
32
+ export function emailConditionsOf(actionsSection, verdict, { assessmentNotCompleted = false } = {}) {
33
+ if (assessmentNotCompleted) return relyBeforeOf(actionsSection);
17
34
  return verdict === 'CONDITIONAL' || verdict === 'BLOCKING' ? actYouConditions(parseActionBuckets(actionsSection).you) : [];
18
35
  }
19
36
 
20
37
  /** The same list, from the report's markdown, as the email reads its `# Actions` section. PURE. */
21
- export const emailConditionsOfReport = (reportMd, verdict) => emailConditionsOf(parseSections(parseFront(String(reportMd ?? '')).body).Actions, verdict);
38
+ export const emailConditionsOfReport = (reportMd, verdict, opts = {}) => emailConditionsOf(parseSections(parseFront(String(reportMd ?? '')).body).Actions, verdict, opts);
@@ -0,0 +1,21 @@
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
+ // publish/evidence-words.mjs — how well a meter's value is evidenced, in the report's own words.
4
+ //
5
+ // A meter's evidence is its joined status (registry-fidelity.mjs joinEvidenceStatus stamps `_status` on each
6
+ // meter), said in four words. The report's meters and the audit workbook's driver cells both say it, and they
7
+ // say it from here, so the lawyer reads the same word for the same value in both. On Use no verification word
8
+ // is printed (2026-08-31): its receipt join cannot reach the use surface, so only "inferred" and "not checked"
9
+ // are said there. Under Similarity no evidence word is printed at all (2026-11-18).
10
+ export const EVIDENCE_LABEL = Object.freeze({ confirmed: 'verified', assumed: 'not yet verified', inferred: 'inferred', 'not-checked': 'not checked' });
11
+ export const EVIDENCE_BASIS_LABEL = Object.freeze({ 'verified-from-record': 'verified', 'inferred-from-signal': 'inferred' });
12
+ export const USE_EVIDENCE_LABEL = Object.freeze({ inferred: 'inferred', 'not-checked': 'not checked' });
13
+
14
+ /** The evidence word for one meter, as the report prints it, or '' where it prints none. */
15
+ export function meterEvidence(name, entry) {
16
+ const e = entry || {};
17
+ if (name === 'mark_similarity') return '';
18
+ if (name === 'use') return USE_EVIDENCE_LABEL[e._status] || '';
19
+ // With a joined status the status replaces the raw basis word on the enforcer.
20
+ return EVIDENCE_LABEL[e._status] || (name === 'enforcer' ? EVIDENCE_BASIS_LABEL[e.basis] || '' : '');
21
+ }