clearotron 0.6.0 → 0.7.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 (110) 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/branding.md +4 -4
  12. package/docs/report-data/clearance-1.schema.json +320 -0
  13. package/docs/report-data/knockout-1.schema.json +268 -0
  14. package/driver/CHANGELOG.md +39 -0
  15. package/driver/connotation-search.mjs +1 -1
  16. package/driver/contract-e3-backlog.mjs +1 -1
  17. package/driver/coverage-ledger.mjs +18 -2
  18. package/driver/deferral-row.mjs +1 -1
  19. package/driver/degraded-parts.mjs +1 -0
  20. package/driver/driver.config.mjs +4 -3
  21. package/driver/effective-scope.mjs +3 -1
  22. package/driver/engagement-receipt.mjs +3 -3
  23. package/driver/engine/anthropic-agent.mjs +15 -1
  24. package/driver/engine/common.mjs +7 -0
  25. package/driver/engine/mcp/band-server.mjs +7 -16
  26. package/driver/engine/mcp/codex-config.mjs +3 -0
  27. package/driver/engine/mcp/recording-server.mjs +45 -34
  28. package/driver/engine/openai-agent.mjs +74 -7
  29. package/driver/gateway.mjs +67 -10
  30. package/driver/jx.mjs +13 -5
  31. package/driver/manuals-seen.mjs +146 -0
  32. package/driver/mark-logos.mjs +144 -0
  33. package/driver/methodology-witness.mjs +2 -1
  34. package/driver/owner-use-check.mjs +3 -3
  35. package/driver/package.json +1 -1
  36. package/driver/pipeline-knockout.mjs +4 -0
  37. package/driver/pipeline.mjs +92 -7
  38. package/driver/portal-local-auth.mjs +6 -2
  39. package/driver/portal-report.mjs +43 -12
  40. package/driver/portal-routes/me.mjs +4 -1
  41. package/driver/portal-runs.mjs +6 -9
  42. package/driver/profiles.mjs +4 -4
  43. package/driver/publish/README.md +9 -7
  44. package/driver/publish/email-conditions.mjs +2 -2
  45. package/driver/publish/evidence-words.mjs +21 -0
  46. package/driver/publish/index.mjs +104 -90
  47. package/driver/publish/knockout.mjs +75 -49
  48. package/driver/publish/office-record-links.mjs +11 -9
  49. package/driver/publish/page-shell.mjs +98 -0
  50. package/driver/publish/publish-inputs.mjs +4 -0
  51. package/driver/publish/regions.mjs +24 -3
  52. package/driver/publish/register-record.mjs +150 -0
  53. package/driver/publish/render-knockout.mjs +195 -642
  54. package/driver/publish/render.mjs +270 -363
  55. package/driver/publish/report-data.mjs +225 -12
  56. package/driver/publish/strings.mjs +662 -0
  57. package/driver/publish/templates/knockout.css +200 -0
  58. package/driver/publish/templates/report.css +72 -52
  59. package/driver/publish/xlsx.mjs +148 -125
  60. package/driver/record-goods.mjs +42 -0
  61. package/driver/reference-score.mjs +4 -1
  62. package/driver/register-reach.mjs +39 -0
  63. package/driver/registry-fidelity.mjs +3 -8
  64. package/driver/repair-composers.mjs +6 -2
  65. package/driver/repair-targets.mjs +4 -1
  66. package/driver/run-delivered.mjs +6 -1
  67. package/driver/runner.mjs +73 -29
  68. package/driver/scope-facts.mjs +27 -6
  69. package/driver/search-policy.mjs +9 -4
  70. package/driver/stages.mjs +3 -3
  71. package/driver/steps/overview-and-cards.mjs +50 -14
  72. package/driver/steps/verdict-gate.mjs +33 -13
  73. package/driver/suite-census.json +368 -68
  74. package/driver/terminal-clamp.mjs +6 -1
  75. package/mcp-server/CHANGELOG.md +4 -0
  76. package/mcp-server/lib/audit-view.mjs +5 -2
  77. package/mcp-server/lib/brief.mjs +2 -1
  78. package/mcp-server/lib/evidence.mjs +31 -4
  79. package/mcp-server/lib/knockout.mjs +1 -1
  80. package/mcp-server/lib/scrub.mjs +1 -1
  81. package/mcp-server/package.json +1 -1
  82. package/mcp-server/server.mjs +5 -3
  83. package/package.json +4 -1
  84. package/portal-ui/dist/assets/{index-CYaO2ygd.js → index-CtkllKJ2.js} +225 -77
  85. package/portal-ui/dist/assets/{index-izLa9apq.css → index-CxAkJXIT.css} +25 -5
  86. package/portal-ui/dist/index.html +2 -2
  87. package/portal-ui/package.json +3 -3
  88. package/providers/_shared/ledger.mjs +30 -2
  89. package/providers/_shared/record-uri.mjs +15 -0
  90. package/providers/clarivate/src/adapter.js +11 -0
  91. package/providers/clarivate/src/core.js +17 -1
  92. package/providers/oauth-mcp-bridge/CHANGELOG.md +4 -0
  93. package/providers/oauth-mcp-bridge/package.json +1 -1
  94. package/scripts/README.md +147 -3
  95. package/scripts/e2e-first-time.mjs +3 -3
  96. package/scripts/freeze-example-run.mjs +3 -3
  97. package/scripts/mint-search-level-tags.mjs +61 -0
  98. package/scripts/mint-source-pin-census.mjs +89 -0
  99. package/scripts/release-note-required.mjs +65 -6
  100. package/scripts/test-durations-reporter.mjs +25 -0
  101. package/scripts/test-full.mjs +72 -18
  102. package/scripts/test-run.mjs +18 -1
  103. package/shared/brand.mjs +85 -5
  104. package/shared/inline-markdown.mjs +53 -0
  105. package/shared/portal-tokens.mjs +2 -1
  106. package/shared/register-selection.mjs +8 -3
  107. package/shared/search-level-tags.json +25 -0
  108. package/shared/tools/derive-band-pairs.mjs +10 -0
  109. package/driver/own-rights.mjs +0 -83
  110. package/driver/use-check.mjs +0 -85
@@ -113,8 +113,13 @@ export const ENGINE_TOKEN_RE = /\b\w+_\w+(?::\d+)?\b/;
113
113
  * sidecar, because the token shape above has no underscore to find in it. Kept to the coined names, measured
114
114
  * on every stored clause and reason of the saved runs: only that sentence matched. A phrase list over client
115
115
  * text can eat a real mark, so this one withholds a condition and never rewrites one.
116
+ *
117
+ * The coverage floor's three other sentences joined it on 2026-11-18: "the lawyer judged a material slice not fully
118
+ * cleared", "follow-ups left open this run" and "(policy: clamp)", which the floor now stores with no clause. Measured
119
+ * the same day over 234 stored verdicts, 231 on the test, pre-production and production installs and 3 in the demos:
120
+ * the three phrases matched 89 stored texts, and every one was one of those three sentences.
116
121
  */
117
- export const ENGINE_PHRASE_RE = /\b(?:frame[- ]diff|blind frame|re-?open(?:ing)? pass|frame[- ]reopen)\b/i;
122
+ export const ENGINE_PHRASE_RE = /\b(?:frame[- ]diff|blind frame|re-?open(?:ing)? pass|frame[- ]reopen|material slice not fully cleared|follow-ups left open this run)\b|\(policy: clamp\)/i;
118
123
 
119
124
  /** Does a condition's text carry the engine's words? ONE test, read by every reader of a condition. PURE. */
120
125
  export const carriesEngineWords = (text) => ENGINE_TOKEN_RE.test(String(text ?? "")) || ENGINE_PHRASE_RE.test(String(text ?? ""));
@@ -1,5 +1,9 @@
1
1
  # trademark-artifacts-mcp
2
2
 
3
+ ## 0.7.0-beta.0
4
+
5
+ No changes in this release.
6
+
3
7
  ## 0.6.0
4
8
 
5
9
  No changes in this release.
@@ -110,9 +110,12 @@ export function scrubBlocks(items) {
110
110
  */
111
111
  export function accountFinding(f) {
112
112
  if (!f || typeof f !== "object") return f;
113
- const [only] = scrubBlocks([f]);
113
+ // The register's own goods wording is held apart from the scrub: it is the register's text, copied, and every
114
+ // scrub pass rewrites (lib/evidence.mjs, the second exception). A withdrawn block refuses before it travels.
115
+ const { goodsAsRegistered, ...block } = f;
116
+ const [only] = scrubBlocks([block]);
114
117
  if (!only) throw new Error(`finding "${f.id ?? "?"}" was withdrawn during the run and does not appear in the delivered record`);
115
- return only;
118
+ return goodsAsRegistered ? { ...only, goodsAsRegistered } : only;
116
119
  }
117
120
 
118
121
  /** list_findings on the raw path — {source, kind, items}. The cards path never reaches here. */
@@ -80,7 +80,8 @@ export function buildBrief(run) {
80
80
  const product = productIdentityFor(run, docs);
81
81
  const clearance = docs.find((d) => d?.kind === "clearance") ?? null;
82
82
  // The knockout shape carries no `kind` at all and is told apart by `marks[]` — the same discrimination
83
- // portal-service.mjs makes. Both lanes stamp `schema: 'report-data/1'`, so the schema string cannot.
83
+ // portal-service.mjs makes. The schema string names the shape on new runs (`report-data/clearance-1`,
84
+ // `report-data/knockout-1`), but runs stored before that carry `report-data/1` for both, so the shape decides.
84
85
  const koDocs = docs.filter((d) => d?.kind !== "clearance" && Array.isArray(d?.marks));
85
86
  // A NAME WHOSE DATA FILE COULD NOT BE WRITTEN IS STILL A NAME SCREENED. A Knockout batch publishes every name's
86
87
  // report when one name's data file fails, and lists that name in meta.reports with no data file. Read from the
@@ -31,14 +31,22 @@
31
31
  // `coverage_judgment.reason` is NOT forwarded: render.mjs gates it `!CLIENT` as engine wording, so it stays
32
32
  // internal here too.
33
33
  //
34
+ // THE SECOND EXCEPTION, ruled 2026-11-18: a cited register record's goods in the register's own words. The report
35
+ // now prints a registration's goods in English, or the vendor's machine translation marked as one, and points a
36
+ // reader who wants the original wording to their assistant. So get_finding carries, for the one register record
37
+ // its block names, the goods as the register holds them (registrationGoods below). It is the REGISTER's text,
38
+ // copied from the record the run saved, never the firm's: no scrub pass touches it, because each one rewrites.
39
+ // Only a record a delivered block names is read, one file, never the archive at large.
40
+ //
34
41
  // AND THE LESSON THE CORPUS ADDED (see valueField): "structured field" is not a synonym for "safe value".
35
42
  // A model free-typing into `classes:` welded an engine clause onto a class list. Structured KEYS are the
36
43
  // allowlist; structured VALUES still have to be recognised, not trusted.
37
44
 
38
- import { existsSync } from "node:fs";
45
+ import { existsSync, readFileSync } from "node:fs";
39
46
  import { join } from "node:path";
40
47
  import { parseAudit, stripEngineInternals } from "./driver.mjs";
41
- import { readRecordArtifacts } from "../../driver/registry-fidelity.mjs";
48
+ import { readRecordArtifacts, normalizeRecordUri } from "../../driver/registry-fidelity.mjs";
49
+ import { recordGoodsAsRegistered } from "../../driver/record-goods.mjs";
42
50
  import { readJson } from "../../driver/run-record.mjs";
43
51
 
44
52
  // The client report's own display word per coverage state (publish/render.mjs COV_STATE). Carried here so
@@ -48,7 +56,7 @@ const COV_WORD = {
48
56
  "confirmed-clean": "Searched — clean",
49
57
  "coverage-limited": "Partially covered",
50
58
  open: "Open item",
51
- "not-searched": "Not run this run",
59
+ "not-searched": "Not searched",
52
60
  note: "Note",
53
61
  };
54
62
 
@@ -213,8 +221,9 @@ export function evidenceRecords(run) {
213
221
  layer: layerOf(f?.source?.source_type),
214
222
  owner: valueField(f?.owner?.name),
215
223
  ownerCountry: valueField(f?.owner?.country),
224
+ // A run records each registration as its record URI, `{uri}`; an older one wrote the string itself.
216
225
  registrations: Array.isArray(f?.owner?.registrations)
217
- ? f.owner.registrations.filter((r) => typeof r === "string") : [],
226
+ ? f.owner.registrations.map((r) => (typeof r === "string" ? r : r?.uri)).filter((r) => typeof r === "string" && r) : [],
218
227
  classes: [], // findings.json carries no class list; the audit block below may
219
228
  status: null,
220
229
  url,
@@ -479,3 +488,21 @@ export function coverageStatement(run) {
479
488
  : "This run records no coverage ledger.",
480
489
  };
481
490
  }
491
+
492
+ // ---- a cited record's goods, as the register holds them ------------------------------------------
493
+
494
+ /**
495
+ * The goods of the ONE register record a finding's block names, as the register holds them: {registration,
496
+ * statements} or null. `url` is the block's own link; only a register record URI resolves, and only to the file
497
+ * the run saved for it (named as driver/registry-fidelity.mjs writeRecordArtifacts names it). Nothing here
498
+ * reads the archive at large, so nothing the delivered record does not name can be reached.
499
+ */
500
+ export function registrationGoods(run, url) {
501
+ const uri = normalizeRecordUri(url ?? "");
502
+ if (!uri || !run?.runDir) return null;
503
+ const name = uri.replace(/^\/mark\//, "").replace(/[^a-z0-9]+/gi, "-") + ".json";
504
+ let body;
505
+ try { body = JSON.parse(readFileSync(join(run.runDir, "_records", name), "utf8")); } catch { return null; }
506
+ const statements = recordGoodsAsRegistered(body);
507
+ return statements.length ? { registration: uri, statements } : null;
508
+ }
@@ -341,7 +341,7 @@ export function knockoutCoverage(run) {
341
341
  } else {
342
342
  areas.push({
343
343
  area: "Register",
344
- state: "Not run this run",
344
+ state: "Not searched",
345
345
  detail: "This run has no register component — the assessment rests on the common-law and marketplace sweep.",
346
346
  });
347
347
  }
@@ -11,7 +11,7 @@
11
11
  // connector: a signed-in client ACCOUNT can also reach the run's EVIDENCE — the records considered and the
12
12
  // searches run — which the report narrates but does not enumerate. That is deliberately more than the PDF,
13
13
  // because a lawyer defending a filing decision needs the records, and it is bounded by a different
14
- // mechanism (a structured-field projection, never prose) in lib/evidence.mjs. Read that file's header
14
+ // mechanism (a structured-field projection, never the firm's prose; a cited record's goods travel in the register's own words) in lib/evidence.mjs. Read that file's header
15
15
  // before widening anything here; the line it draws is evidence vs METHOD, and method stays sealed.
16
16
  // publish/render.mjs no longer renders a Methodology section to the client (the 2026-09-16 report redesign) and
17
17
  // deliberately names the register provider (provenance honesty, receipts, enforcement telemetry). A scrubber
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trademark-artifacts-mcp",
3
- "version": "0.6.0",
3
+ "version": "0.7.0-beta.0",
4
4
  "license": "AGPL-3.0-only",
5
5
  "private": true,
6
6
  "description": "MCP server to interrogate clearotron trademark-clearance runs — list/read artifacts, trace the full decision flow, telemetry/cost, coverage, single-run search, and a gated single-step what-if. Imports the clearotron-driver read-only; touches no driver/template/deploy files.",
@@ -80,7 +80,7 @@ import { authorize, visibleTools, USER_ARTIFACTS, ACCOUNT_ARTIFACTS, accountMayR
80
80
  import { accountRun, accountTrace, accountTimeline, accountFinding, accountFindingList,
81
81
  accountWhatIfPlan, accountWhatIfQueued, accountWhatIfResult, CLIENT_FAILURE_NOTE as clientFailureNote } from "./lib/audit-view.mjs";
82
82
  import { scrubMarkdown, scrubBody, scrubFrontMatter, scrubCards } from "./lib/scrub.mjs";
83
- import { evidenceRecords, searchLog, coverageStatement } from "./lib/evidence.mjs";
83
+ import { evidenceRecords, searchLog, coverageStatement, registrationGoods } from "./lib/evidence.mjs";
84
84
  // The knockout lane's projections. Every audit tool below branches on `isKnockoutRun` because the
85
85
  // clearance projections read artifacts this product does not write, and returned empty rather than saying
86
86
  // so.
@@ -438,7 +438,9 @@ const tools = {
438
438
  const run = mustRun(runId);
439
439
  const f = getFinding(run.P, id);
440
440
  if (!f) throw new Error(`finding "${id}" not found in ${runId}. Use list_findings to see ids (F#, NR#, AT#).`);
441
- return f;
441
+ // The register record this block names, its goods in the register's own words (lib/evidence.mjs).
442
+ const goods = registrationGoods(run, f.url);
443
+ return goods ? { ...f, goodsAsRegistered: goods } : f;
442
444
  },
443
445
  trace({ runId, target, depth, shallow }) {
444
446
  const run = mustRun(runId);
@@ -662,7 +664,7 @@ const TOOL_DEFS = [
662
664
  { name: "read_artifact", description: "Read a run artifact's raw text (or one '# Section', or its front-matter). For briefing a person, the report is the plain-language layer; the rest are internal working documents. Names: report, audit, narrative, registerFindings, commonLaw, placement, matterContext, variantManifest, skepticFlags, seniorEyeReview, caseLaw, clientSummary (internal cover-note source; ops only), a register axis (e.g. primary-sweep), status.json, run.jsonl.", inputSchema: { type: "object", properties: { ...runIdProp, name: { type: "string" }, section: { type: "string", description: "Return only this '# Section'." }, frontMatterOnly: { type: "boolean" } }, required: ["runId", "name"] } },
663
665
  { name: "list_evidence", description: "The records this search considered — every register and common-law entry, including ones the report does not name individually. Each carries the mark, owner and country, the classes, the register status, the source link, whether the provider record was actually retrieved (`retrieved`), and `superseded: true` if a later pass withdrew it. Use this to answer 'what exactly did you find, and who owns it?'. Filter with layer: register | common-law.", inputSchema: { type: "object", properties: { ...runIdProp, layer: { type: "string", enum: ["register", "common-law"] } }, required: ["runId"] } },
664
666
  { name: "list_searches", description: "What the search looked for and where — the searches that came back empty as well as the ones that surfaced something. Each row carries the term, the match shapes tried (exact, fuzzy, phonetic, transliteration…), the classes and jurisdictions, the register office where one was named, and the outcome (no-hit | found | out-of-scope | screened-out | excluded-own-rights | negligible). This is the defensibility record: proof of where the search looked and found nothing. Filter by outcome.", inputSchema: { type: "object", properties: { ...runIdProp, outcome: { type: "string", enum: ["no-hit", "found", "out-of-scope", "screened-out", "excluded-own-rights", "negligible", "recorded"] } }, required: ["runId"] } },
665
- { name: "get_search_coverage", description: "What the search covered and what is still open, in the report's own words — each area with its state (Searched — clean / Partially covered / Open item / Not run this run). An area that is not clean is NOT cleared: read it as open. Reach for this whenever a result looks clean and the user is about to rely on it.", inputSchema: { type: "object", properties: { ...runIdProp }, required: ["runId"] } },
667
+ { name: "get_search_coverage", description: "What the search covered and what is still open, in the report's own words — each area with its state (Searched — clean / Partially covered / Open item / Not searched). An area that is not clean is NOT cleared: read it as open. Reach for this whenever a result looks clean and the user is about to rely on it.", inputSchema: { type: "object", properties: { ...runIdProp }, required: ["runId"] } },
666
668
  { name: "list_findings", description: "Structured findings from the deterministic audit. kind: findings (default) | negatives | audit (audit-trail). Filter by sourceLayer (Register/Common-law). Pass group (on-field/off-field/out-of-scope) to get the curated report cards instead — the cards' one-liners are already plain-language.", inputSchema: { type: "object", properties: { ...runIdProp, kind: { type: "string", enum: ["findings", "negatives", "audit"] }, sourceLayer: { type: "string" }, group: { type: "string", enum: ["on-field", "off-field", "out-of-scope"] } }, required: ["runId"] } },
667
669
  { name: "get_finding", description: "One finding/negative/audit-trail record by id (F#, NR#, AT#).", inputSchema: { type: "object", properties: { ...runIdProp, id: { type: "string" } }, required: ["runId", "id"] } },
668
670
  { name: "trace", description: "ENGINEERING/AUDIT view — HOW a conclusion was reached; use only when the user asks how/why, not for briefing findings. Walks the full logic flow from any target (a stage, an artifact name, a finding id, or 'verdict') back through the stage that emitted it (and whether a failover occurred), its inputs (with sha-at-consumption vs now), the audit-trail rationale, search terms + record URL, skeptic escalations, and the refutation verdict. Pass shallow:true for a fast skeleton (stage→input lineage + verdict only; skips the findings rebuild and the live provider-usage tally).", inputSchema: { type: "object", properties: { ...runIdProp, target: { type: "string", description: "stage | artifact | finding id (F#/NR#/AT#) | 'verdict' | a mark/owner substring" }, depth: { type: "number", description: "upstream recursion depth (default 2)" }, shallow: { type: "boolean", description: "Fast skeleton: lineage + verdict only, skipping the slow enrichments. Use when a full trace is slow or you only need the chain." } }, required: ["runId", "target"] } },
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "clearotron",
3
3
  "mcpName": "io.github.CordilleraSarl/clearotron",
4
4
  "type": "module",
5
- "version": "0.6.0",
5
+ "version": "0.7.0-beta.0",
6
6
  "license": "AGPL-3.0-only",
7
7
  "repository": {
8
8
  "type": "git",
@@ -130,6 +130,9 @@
130
130
  "driver/skills/clearance-search/worked-examples.md",
131
131
  "driver/skills/clearance-search/worked-examples-demo.md",
132
132
  "!scripts/secret-scanner-fetch.mjs",
133
+ "!scripts/measure-test-durations.mjs",
134
+ "!scripts/count-manual-pins.mjs",
135
+ "!scripts/test-durations.json",
133
136
  "!scripts/home-render-check.mjs",
134
137
  "!scripts/ai-page-render-check.mjs",
135
138
  "!scripts/composer-render-check.mjs",