clearotron 0.5.0-beta.8 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +2 -1
- package/INSTALL.md +4 -3
- package/QUICKSTART.md +78 -0
- package/bin/onboard.mjs +9 -4
- package/build-info.json +2 -2
- package/docs/releases/0.5.0.md +77 -0
- package/driver/CHANGELOG.md +103 -0
- package/driver/contract-vocabulary.mjs +3 -3
- package/driver/corrections-delivered.mjs +7 -5
- package/driver/corrections-feedforward.mjs +89 -3
- package/driver/coverage-form.mjs +61 -2
- package/driver/degraded-parts.mjs +4 -0
- package/driver/engine/mcp/band-server.mjs +16 -6
- package/driver/engine/openai-agent.mjs +24 -1
- package/driver/engine/probe.mjs +64 -9
- package/driver/goods-evidence.mjs +33 -6
- package/driver/narrative-refutation-record.mjs +17 -2
- package/driver/package.json +1 -1
- package/driver/pipeline.mjs +373 -38
- package/driver/predelivery-lint.mjs +160 -10
- package/driver/publish/index.mjs +2 -2
- package/driver/record-fold.mjs +17 -0
- package/driver/record-goods.mjs +24 -8
- package/driver/register-plan.mjs +8 -3
- package/driver/repair-composers.mjs +61 -7
- package/driver/saved-register-pages.mjs +144 -0
- package/driver/stage-context.mjs +4 -0
- package/driver/suite-census.json +122 -14
- package/driver/terminal-clamp.mjs +21 -0
- package/driver/verify.mjs +6 -3
- package/mcp-server/CHANGELOG.md +12 -0
- package/mcp-server/package.json +1 -1
- package/package.json +2 -1
- package/portal-ui/package.json +1 -1
- package/providers/oauth-mcp-bridge/CHANGELOG.md +12 -0
- package/providers/oauth-mcp-bridge/package.json +1 -1
- package/providers/signa/src/core.js +18 -4
- package/scripts/e2e-first-time.mjs +10 -6
- package/scripts/release-duplicate-notes.mjs +5 -0
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
// Copyright 2026 Cordillera Sàrl. Additional terms under section 7 of the AGPL-3.0 apply — see ADDITIONAL-TERMS.md
|
|
3
|
+
//
|
|
4
|
+
// saved-register-pages.mjs — the goods statements on the register's own pages that the run's research saved.
|
|
5
|
+
//
|
|
6
|
+
// WHY. A search answer that did not ask for each goods statement whole holds a long one cut at 280 characters, and the
|
|
7
|
+
// register flags it (record-goods.mjs `rowGoods`). The run's research may already hold that record's own page on the
|
|
8
|
+
// register: the research server keeps every page a question fetched, one file a call, under `_driver/web-results/`
|
|
9
|
+
// (perplexity-server.mjs `keepRaw`). Nothing read those pages for goods, so a statement the run held whole was still
|
|
10
|
+
// read as cut. Measured 2026-11-03: a writer wrote a cited record's classes up as "cut and unread", after a research
|
|
11
|
+
// question of the same run had saved the register's own page for that record.
|
|
12
|
+
//
|
|
13
|
+
// WHAT IS READ, AND NOTHING ELSE. A research question's file, named `<time>-<pid>-<N>.json`, where N is the number of
|
|
14
|
+
// the research server's call; the pages that question fetched (`fetch_url_results`), never a search's snippets; and
|
|
15
|
+
// USPTO's status page for one serial (`https://tsdr.uspto.gov/statusview/sn<serial>`), whose goods and services table
|
|
16
|
+
// gives each class's statement in its last column. The folder also holds files of other shapes (owner checks, meaning
|
|
17
|
+
// searches asked again), which are not a question's and are not read.
|
|
18
|
+
//
|
|
19
|
+
// A PAGE IS READ ONLY WHERE IT IS WHOLE. A fetch can stop part way down a page. A table row counts only where a bar
|
|
20
|
+
// opens and closes it, it has the header's number of cells, and its statement does not end in an ellipsis; a page
|
|
21
|
+
// fetched without the table gives nothing. Any doubt reads as no page, and the statement stays as the search answer
|
|
22
|
+
// gave it, cut or not established whole.
|
|
23
|
+
//
|
|
24
|
+
// A pure leaf: node:fs, node:path and shared/driver-dir.mjs only, so the goods reader and the band tool server can
|
|
25
|
+
// both import it.
|
|
26
|
+
import { readFileSync, readdirSync } from "node:fs";
|
|
27
|
+
import { join } from "node:path";
|
|
28
|
+
import { driverDir } from "../shared/driver-dir.mjs";
|
|
29
|
+
|
|
30
|
+
// The research server's own name for a call's file: the time it was kept, with ":" and "." made "-", the server's
|
|
31
|
+
// process id, and the number of the call.
|
|
32
|
+
const QUESTION_FILE = /^\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}-\d{3}Z-\d+-(\d+)\.json$/;
|
|
33
|
+
const questionOf = (name) => { const m = QUESTION_FILE.exec(name); return m ? Number(m[1]) : null; };
|
|
34
|
+
|
|
35
|
+
// USPTO's status page for one serial. Its other pages (the documents, the search) carry no goods table.
|
|
36
|
+
const STATUS_PAGE = /^https?:\/\/tsdr\.uspto\.gov\/statusview\/sn(\d+)\/?(?:[?#].*)?$/i;
|
|
37
|
+
|
|
38
|
+
// A markdown table row's cells, or null where no bar closes the row. A bar inside a cell is written `\|`, and any
|
|
39
|
+
// punctuation a page's text carries may be written with a backslash before it; the cell reads as the page wrote it.
|
|
40
|
+
const cellsOf = (line) => {
|
|
41
|
+
if (!line.startsWith("|") || !line.endsWith("|") || line.endsWith("\\|") || line.length < 2) return null;
|
|
42
|
+
return line.slice(1, -1).split(/(?<!\\)\|/).map((c) => c.trim().replace(/\\([!-/:-@[-`{-~])/g, "$1"));
|
|
43
|
+
};
|
|
44
|
+
// The first cell names the class, "042 - Primary Class" for class 42, as record-goods.mjs `niceClass` reads one.
|
|
45
|
+
const classOf = (cell) => {
|
|
46
|
+
const m = /^0*(\d{1,2})(?!\d)/.exec(cell);
|
|
47
|
+
const n = m ? Number(m[1]) : 0;
|
|
48
|
+
return n >= 1 && n <= 45 ? String(n) : "";
|
|
49
|
+
};
|
|
50
|
+
const CUT_MARK = /(?:\.\.\.|…)$/;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The statements of a status page's goods and services table, from the page as markdown: [{cls, text}], one per whole
|
|
54
|
+
* row, in the page's order, or [] where the page holds no such table. The table is the first under a "Goods and
|
|
55
|
+
* services" heading, before the next heading, whose header begins with the international class and ends with the
|
|
56
|
+
* goods and services. PURE.
|
|
57
|
+
*/
|
|
58
|
+
export function statusPageGoods(markdown) { // @internal — driven by its test
|
|
59
|
+
const lines = String(markdown ?? "").split(/\r?\n/).map((l) => l.trim());
|
|
60
|
+
for (let at = 0; at < lines.length; at++) {
|
|
61
|
+
if (!/^#{1,6}\s*goods and services\s*#*$/i.test(lines[at])) continue;
|
|
62
|
+
let i = at + 1;
|
|
63
|
+
while (i < lines.length && !lines[i].startsWith("|") && !lines[i].startsWith("#")) i++;
|
|
64
|
+
const table = [];
|
|
65
|
+
while (i < lines.length && lines[i].startsWith("|")) table.push(lines[i++]);
|
|
66
|
+
const head = table.length > 2 ? cellsOf(table[0]) : null;
|
|
67
|
+
const rule = head ? cellsOf(table[1]) : null;
|
|
68
|
+
if (!head || head.length < 2 || !/^international class/i.test(head[0]) || !/^goods and services$/i.test(head.at(-1))
|
|
69
|
+
|| rule?.length !== head.length || !rule.every((c) => /^:?-+:?$/.test(c))) continue;
|
|
70
|
+
const out = [];
|
|
71
|
+
for (const line of table.slice(2)) {
|
|
72
|
+
const cells = cellsOf(line);
|
|
73
|
+
if (cells?.length !== head.length) continue;
|
|
74
|
+
const cls = classOf(cells[0]), text = cells.at(-1);
|
|
75
|
+
if (cls && text && !CUT_MARK.test(text)) out.push({ cls, text });
|
|
76
|
+
}
|
|
77
|
+
if (out.length) return out;
|
|
78
|
+
}
|
|
79
|
+
return [];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** The status pages one saved research result fetched, each with its goods table: [{serial, goods}]. A grid's result and a page without the table give none. PURE. */
|
|
83
|
+
export function statusPagesIn(result) { // @internal — driven by its test
|
|
84
|
+
if (result?.tool !== "perplexity_research" || result?.kind !== "question" || !Array.isArray(result?.items)) return [];
|
|
85
|
+
const out = [];
|
|
86
|
+
for (const item of result.items) {
|
|
87
|
+
if (item?.type !== "fetch_url_results" || !Array.isArray(item.contents)) continue;
|
|
88
|
+
for (const page of item.contents) {
|
|
89
|
+
const serial = STATUS_PAGE.exec(String(page?.url ?? "").trim())?.[1];
|
|
90
|
+
const goods = serial ? statusPageGoods(page?.snippet) : [];
|
|
91
|
+
if (goods.length) out.push({ serial, goods });
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return out;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* A reader of the status pages the run's research saved. Each call returns Map(serial → [{question, goods}]) from the
|
|
99
|
+
* folder as it stands, the pages in the order they were saved. A file is read once, as the research server writes each
|
|
100
|
+
* once; a file that will not parse, as one still being written will not, is read again on the next call. IMPURE.
|
|
101
|
+
*/
|
|
102
|
+
export function savedStatusPages(runDir) {
|
|
103
|
+
if (!runDir) return () => new Map();
|
|
104
|
+
const dir = driverDir(runDir, "web-results");
|
|
105
|
+
const read = new Map();
|
|
106
|
+
return () => {
|
|
107
|
+
let names = [];
|
|
108
|
+
try { names = readdirSync(dir).filter((n) => questionOf(n) != null).sort(); } catch { names = []; }
|
|
109
|
+
const pages = new Map();
|
|
110
|
+
for (const name of names) {
|
|
111
|
+
if (!read.has(name)) {
|
|
112
|
+
let result; try { result = JSON.parse(readFileSync(join(dir, name), "utf8")); } catch { continue; }
|
|
113
|
+
read.set(name, statusPagesIn(result));
|
|
114
|
+
}
|
|
115
|
+
for (const { serial, goods } of read.get(name)) {
|
|
116
|
+
if (!pages.has(serial)) pages.set(serial, []);
|
|
117
|
+
pages.get(serial).push({ question: questionOf(name), goods });
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return pages;
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** The USPTO serial a band row names, where the row is a record of the US office that carries one; "" otherwise. PURE. */
|
|
125
|
+
export const usSerialOf = (row) => (String(row?.raw?.office_code ?? "").trim().toUpperCase() === "US"
|
|
126
|
+
? String(row?.raw?.application_number ?? "").replace(/\D/g, "") : "");
|
|
127
|
+
|
|
128
|
+
const flat = (s) => String(s ?? "").replace(/\s+/g, " ").trim().toLowerCase();
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* The register's own statement for one class of a US record: {text, question} from the first page saved for the serial
|
|
132
|
+
* whose statement for the class begins with the copy the search answer gave, or null. The copy is compared without its
|
|
133
|
+
* case or its spacing, and without an ellipsis it ends in; a statement that does not begin with it is another text,
|
|
134
|
+
* and is not used. PURE.
|
|
135
|
+
*/
|
|
136
|
+
export function savedPageStatement(pages, serial, cls, copy) {
|
|
137
|
+
const start = flat(String(copy ?? "").trim().replace(CUT_MARK, ""));
|
|
138
|
+
if (!start || !serial || !cls) return null;
|
|
139
|
+
for (const { question, goods } of pages?.get?.(serial) ?? []) {
|
|
140
|
+
const hit = goods.find((g) => g.cls === cls && flat(g.text).startsWith(start));
|
|
141
|
+
if (hit) return { text: hit.text, question };
|
|
142
|
+
}
|
|
143
|
+
return null;
|
|
144
|
+
}
|
package/driver/stage-context.mjs
CHANGED
|
@@ -375,6 +375,10 @@ export const CONTEXT_DERIVATIONS = [
|
|
|
375
375
|
{ path: P.crowdContext, why: "the crowd join the shape's crowd descriptors carry" },
|
|
376
376
|
{ path: join(P.runDir, "_records"), dir: true, why: "recordDetailIndex — registration/application numbers, IR↔base linkage, Madrid designations; no search row carries them" },
|
|
377
377
|
{ path: driverDir(P.runDir, "register-record-bodies.jsonl"), why: "record-goods.mjs bandGoodsIndex: each record's goods, which the groups test against the client's goods words" },
|
|
378
|
+
// THE REGISTER'S OWN PAGES THE RUN'S RESEARCH SAVED complete a goods statement a search answer cut, so they are an
|
|
379
|
+
// input of this derivation (saved-register-pages.mjs). Seeded as the canonical run holds the folder, as `_records`
|
|
380
|
+
// is: a page saved after the replayed stage is in the sandbox too. That is this input's stated replay limit.
|
|
381
|
+
{ path: driverDir(P.runDir, "web-results"), dir: true, why: "saved-register-pages.mjs savedStatusPages: the register's own status pages the run's research saved, which complete a goods statement the search answer cut; seeded as the run holds them, so a page saved after the replayed stage is seeded too" },
|
|
378
382
|
{ path: P.registerPlan, why: "record-goods.mjs bandShapeGoods: the word the register's goods-narrowed search asked for, which the shape sorts on" },
|
|
379
383
|
{ path: driverDir(P.runDir, "matter-frame-calls", "accepted.json"), why: "withFrameClasses: the classes the frame added for the client's own goods join the in-scope set and the floors" },
|
|
380
384
|
{ path: P.instructedScope, why: "record-goods.mjs instructedOrder: the order's goods wording and markets, which the groups sort by" },
|
package/driver/suite-census.json
CHANGED
|
@@ -279,6 +279,12 @@
|
|
|
279
279
|
"skips": 1,
|
|
280
280
|
"todos": 0
|
|
281
281
|
},
|
|
282
|
+
"a-codex-renewal-that-fails-for-a-moment-is-not-a-sign-out.test.mjs": {
|
|
283
|
+
"tests": 3,
|
|
284
|
+
"asserts": 9,
|
|
285
|
+
"skips": 0,
|
|
286
|
+
"todos": 0
|
|
287
|
+
},
|
|
282
288
|
"a-codex-stage-runs-without-the-sign-ins-apps.test.mjs": {
|
|
283
289
|
"tests": 1,
|
|
284
290
|
"asserts": 5,
|
|
@@ -351,6 +357,12 @@
|
|
|
351
357
|
"skips": 0,
|
|
352
358
|
"todos": 0
|
|
353
359
|
},
|
|
360
|
+
"a-correction-carries-the-answer-that-names-its-findings.test.mjs": {
|
|
361
|
+
"tests": 9,
|
|
362
|
+
"asserts": 27,
|
|
363
|
+
"skips": 0,
|
|
364
|
+
"todos": 0
|
|
365
|
+
},
|
|
354
366
|
"a-correction-hands-its-positions-to-the-save.test.mjs": {
|
|
355
367
|
"tests": 6,
|
|
356
368
|
"asserts": 23,
|
|
@@ -375,6 +387,12 @@
|
|
|
375
387
|
"skips": 0,
|
|
376
388
|
"todos": 0
|
|
377
389
|
},
|
|
390
|
+
"a-correction-that-withdraws-every-step-gives-the-reviews-clear-back.pipeline.test.mjs": {
|
|
391
|
+
"tests": 15,
|
|
392
|
+
"asserts": 68,
|
|
393
|
+
"skips": 0,
|
|
394
|
+
"todos": 0
|
|
395
|
+
},
|
|
378
396
|
"a-correction-to-a-line-that-is-not-a-finding-is-observed.test.mjs": {
|
|
379
397
|
"tests": 7,
|
|
380
398
|
"asserts": 33,
|
|
@@ -483,6 +501,12 @@
|
|
|
483
501
|
"skips": 0,
|
|
484
502
|
"todos": 0
|
|
485
503
|
},
|
|
504
|
+
"a-cut-statement-is-read-whole-from-the-register-page-the-run-saved.test.mjs": {
|
|
505
|
+
"tests": 9,
|
|
506
|
+
"asserts": 22,
|
|
507
|
+
"skips": 0,
|
|
508
|
+
"todos": 0
|
|
509
|
+
},
|
|
486
510
|
"a-decision-the-repeated-placement-pass-changes-is-the-one-delivered.pipeline.test.mjs": {
|
|
487
511
|
"tests": 3,
|
|
488
512
|
"asserts": 48,
|
|
@@ -735,6 +759,12 @@
|
|
|
735
759
|
"skips": 0,
|
|
736
760
|
"todos": 0
|
|
737
761
|
},
|
|
762
|
+
"a-finding-written-on-goods-the-register-cut-is-handed-the-whole-text.test.mjs": {
|
|
763
|
+
"tests": 10,
|
|
764
|
+
"asserts": 64,
|
|
765
|
+
"skips": 0,
|
|
766
|
+
"todos": 0
|
|
767
|
+
},
|
|
738
768
|
"a-findings-check-names-every-finding-it-fails-at-once.test.mjs": {
|
|
739
769
|
"tests": 2,
|
|
740
770
|
"asserts": 5,
|
|
@@ -777,6 +807,12 @@
|
|
|
777
807
|
"skips": 0,
|
|
778
808
|
"todos": 0
|
|
779
809
|
},
|
|
810
|
+
"a-follow-up-row-is-added-once.test.mjs": {
|
|
811
|
+
"tests": 4,
|
|
812
|
+
"asserts": 9,
|
|
813
|
+
"skips": 0,
|
|
814
|
+
"todos": 0
|
|
815
|
+
},
|
|
780
816
|
"a-follow-up-the-allowance-refused-is-a-question-not-asked.test.mjs": {
|
|
781
817
|
"tests": 4,
|
|
782
818
|
"asserts": 12,
|
|
@@ -855,6 +891,12 @@
|
|
|
855
891
|
"skips": 0,
|
|
856
892
|
"todos": 0
|
|
857
893
|
},
|
|
894
|
+
"a-goods-statement-asked-for-whole-is-read-whole.test.mjs": {
|
|
895
|
+
"tests": 3,
|
|
896
|
+
"asserts": 8,
|
|
897
|
+
"skips": 0,
|
|
898
|
+
"todos": 0
|
|
899
|
+
},
|
|
858
900
|
"a-goods-test-miss-is-not-called-other-goods.test.mjs": {
|
|
859
901
|
"tests": 2,
|
|
860
902
|
"asserts": 7,
|
|
@@ -1077,6 +1119,12 @@
|
|
|
1077
1119
|
"skips": 0,
|
|
1078
1120
|
"todos": 0
|
|
1079
1121
|
},
|
|
1122
|
+
"a-layer-row-names-every-register-not-searched.test.mjs": {
|
|
1123
|
+
"tests": 7,
|
|
1124
|
+
"asserts": 24,
|
|
1125
|
+
"skips": 0,
|
|
1126
|
+
"todos": 0
|
|
1127
|
+
},
|
|
1080
1128
|
"a-link-in-the-workbook-is-not-banned-vocabulary.test.mjs": {
|
|
1081
1129
|
"tests": 2,
|
|
1082
1130
|
"asserts": 5,
|
|
@@ -1233,6 +1281,12 @@
|
|
|
1233
1281
|
"skips": 0,
|
|
1234
1282
|
"todos": 0
|
|
1235
1283
|
},
|
|
1284
|
+
"a-narrowed-list-covers-only-the-markets-it-asked.test.mjs": {
|
|
1285
|
+
"tests": 4,
|
|
1286
|
+
"asserts": 13,
|
|
1287
|
+
"skips": 0,
|
|
1288
|
+
"todos": 0
|
|
1289
|
+
},
|
|
1236
1290
|
"a-near-spelling-no-buyer-could-confuse-is-set-aside-with-its-reason.test.mjs": {
|
|
1237
1291
|
"tests": 5,
|
|
1238
1292
|
"asserts": 25,
|
|
@@ -1329,12 +1383,24 @@
|
|
|
1329
1383
|
"skips": 0,
|
|
1330
1384
|
"todos": 0
|
|
1331
1385
|
},
|
|
1386
|
+
"a-party-the-report-introduces-is-introduced-to-the-email.test.mjs": {
|
|
1387
|
+
"tests": 4,
|
|
1388
|
+
"asserts": 13,
|
|
1389
|
+
"skips": 0,
|
|
1390
|
+
"todos": 0
|
|
1391
|
+
},
|
|
1332
1392
|
"a-pin-change-asks-for-a-bench-replay.test.mjs": {
|
|
1333
1393
|
"tests": 16,
|
|
1334
1394
|
"asserts": 37,
|
|
1335
1395
|
"skips": 0,
|
|
1336
1396
|
"todos": 0
|
|
1337
1397
|
},
|
|
1398
|
+
"a-placement-boundary-is-a-notice-not-a-failed-check.test.mjs": {
|
|
1399
|
+
"tests": 2,
|
|
1400
|
+
"asserts": 13,
|
|
1401
|
+
"skips": 0,
|
|
1402
|
+
"todos": 0
|
|
1403
|
+
},
|
|
1338
1404
|
"a-placement-decision-reads-alike-at-every-count.test.mjs": {
|
|
1339
1405
|
"tests": 7,
|
|
1340
1406
|
"asserts": 22,
|
|
@@ -1353,6 +1419,12 @@
|
|
|
1353
1419
|
"skips": 0,
|
|
1354
1420
|
"todos": 0
|
|
1355
1421
|
},
|
|
1422
|
+
"a-plan-audit-line-cannot-open-a-section.test.mjs": {
|
|
1423
|
+
"tests": 3,
|
|
1424
|
+
"asserts": 9,
|
|
1425
|
+
"skips": 0,
|
|
1426
|
+
"todos": 0
|
|
1427
|
+
},
|
|
1356
1428
|
"a-plan-run-that-was-not-answered-is-not-a-drift.test.mjs": {
|
|
1357
1429
|
"tests": 5,
|
|
1358
1430
|
"asserts": 16,
|
|
@@ -1678,8 +1750,8 @@
|
|
|
1678
1750
|
"todos": 0
|
|
1679
1751
|
},
|
|
1680
1752
|
"a-release-note-cannot-be-counted-twice.test.mjs": {
|
|
1681
|
-
"tests":
|
|
1682
|
-
"asserts":
|
|
1753
|
+
"tests": 14,
|
|
1754
|
+
"asserts": 38,
|
|
1683
1755
|
"skips": 0,
|
|
1684
1756
|
"todos": 0
|
|
1685
1757
|
},
|
|
@@ -1701,6 +1773,12 @@
|
|
|
1701
1773
|
"skips": 0,
|
|
1702
1774
|
"todos": 0
|
|
1703
1775
|
},
|
|
1776
|
+
"a-renamed-line-is-not-a-removed-line.test.mjs": {
|
|
1777
|
+
"tests": 6,
|
|
1778
|
+
"asserts": 15,
|
|
1779
|
+
"skips": 0,
|
|
1780
|
+
"todos": 0
|
|
1781
|
+
},
|
|
1704
1782
|
"a-repair-after-the-cards-keeps-the-record-folded.test.mjs": {
|
|
1705
1783
|
"tests": 1,
|
|
1706
1784
|
"asserts": 6,
|
|
@@ -3226,8 +3304,8 @@
|
|
|
3226
3304
|
"todos": 0
|
|
3227
3305
|
},
|
|
3228
3306
|
"corrective-cycle.test.mjs": {
|
|
3229
|
-
"tests":
|
|
3230
|
-
"asserts":
|
|
3307
|
+
"tests": 11,
|
|
3308
|
+
"asserts": 108,
|
|
3231
3309
|
"skips": 0,
|
|
3232
3310
|
"todos": 0
|
|
3233
3311
|
},
|
|
@@ -3604,8 +3682,8 @@
|
|
|
3604
3682
|
"todos": 0
|
|
3605
3683
|
},
|
|
3606
3684
|
"doctor-reads-the-units-not-the-shell.test.mjs": {
|
|
3607
|
-
"tests":
|
|
3608
|
-
"asserts":
|
|
3685
|
+
"tests": 41,
|
|
3686
|
+
"asserts": 122,
|
|
3609
3687
|
"skips": 3,
|
|
3610
3688
|
"todos": 0
|
|
3611
3689
|
},
|
|
@@ -3856,14 +3934,14 @@
|
|
|
3856
3934
|
"todos": 0
|
|
3857
3935
|
},
|
|
3858
3936
|
"engine-probe.test.mjs": {
|
|
3859
|
-
"tests":
|
|
3860
|
-
"asserts":
|
|
3937
|
+
"tests": 55,
|
|
3938
|
+
"asserts": 289,
|
|
3861
3939
|
"skips": 0,
|
|
3862
3940
|
"todos": 0
|
|
3863
3941
|
},
|
|
3864
3942
|
"engine-turn-door.pipeline.test.mjs": {
|
|
3865
|
-
"tests":
|
|
3866
|
-
"asserts":
|
|
3943
|
+
"tests": 5,
|
|
3944
|
+
"asserts": 23,
|
|
3867
3945
|
"skips": 0,
|
|
3868
3946
|
"todos": 0
|
|
3869
3947
|
},
|
|
@@ -4883,7 +4961,7 @@
|
|
|
4883
4961
|
},
|
|
4884
4962
|
"pipeline.mock.test.mjs": {
|
|
4885
4963
|
"tests": 102,
|
|
4886
|
-
"asserts":
|
|
4964
|
+
"asserts": 865,
|
|
4887
4965
|
"skips": 0,
|
|
4888
4966
|
"todos": 0
|
|
4889
4967
|
},
|
|
@@ -6573,6 +6651,12 @@
|
|
|
6573
6651
|
"skips": 0,
|
|
6574
6652
|
"todos": 0
|
|
6575
6653
|
},
|
|
6654
|
+
"the-delivered-conditions-follow-a-repair-that-rewrites-or-drops-a-step.pipeline.test.mjs": {
|
|
6655
|
+
"tests": 6,
|
|
6656
|
+
"asserts": 36,
|
|
6657
|
+
"skips": 0,
|
|
6658
|
+
"todos": 0
|
|
6659
|
+
},
|
|
6576
6660
|
"the-delivered-files-say-what-was-retrieved-not-what-was-read.test.mjs": {
|
|
6577
6661
|
"tests": 3,
|
|
6578
6662
|
"asserts": 11,
|
|
@@ -6653,7 +6737,7 @@
|
|
|
6653
6737
|
},
|
|
6654
6738
|
"the-doubt-carries-its-placement-tier.test.mjs": {
|
|
6655
6739
|
"tests": 17,
|
|
6656
|
-
"asserts":
|
|
6740
|
+
"asserts": 57,
|
|
6657
6741
|
"skips": 0,
|
|
6658
6742
|
"todos": 0
|
|
6659
6743
|
},
|
|
@@ -6748,8 +6832,8 @@
|
|
|
6748
6832
|
"todos": 0
|
|
6749
6833
|
},
|
|
6750
6834
|
"the-first-hour-reads-true.test.mjs": {
|
|
6751
|
-
"tests":
|
|
6752
|
-
"asserts":
|
|
6835
|
+
"tests": 9,
|
|
6836
|
+
"asserts": 46,
|
|
6753
6837
|
"skips": 0,
|
|
6754
6838
|
"todos": 0
|
|
6755
6839
|
},
|
|
@@ -6813,12 +6897,30 @@
|
|
|
6813
6897
|
"skips": 0,
|
|
6814
6898
|
"todos": 0
|
|
6815
6899
|
},
|
|
6900
|
+
"the-goods-check-reads-the-evidence-the-writer-was-given.test.mjs": {
|
|
6901
|
+
"tests": 5,
|
|
6902
|
+
"asserts": 21,
|
|
6903
|
+
"skips": 0,
|
|
6904
|
+
"todos": 0
|
|
6905
|
+
},
|
|
6906
|
+
"the-goods-evidence-is-kept-where-the-writers-record-comes-from-the-salvage.test.mjs": {
|
|
6907
|
+
"tests": 1,
|
|
6908
|
+
"asserts": 6,
|
|
6909
|
+
"skips": 0,
|
|
6910
|
+
"todos": 0
|
|
6911
|
+
},
|
|
6816
6912
|
"the-goods-record-reads-a-search-rows-goods-through-the-shared-reader.test.mjs": {
|
|
6817
6913
|
"tests": 3,
|
|
6818
6914
|
"asserts": 10,
|
|
6819
6915
|
"skips": 0,
|
|
6820
6916
|
"todos": 0
|
|
6821
6917
|
},
|
|
6918
|
+
"the-goods-repair-reaches-the-text-a-grouped-finding-displays.test.mjs": {
|
|
6919
|
+
"tests": 8,
|
|
6920
|
+
"asserts": 115,
|
|
6921
|
+
"skips": 0,
|
|
6922
|
+
"todos": 0
|
|
6923
|
+
},
|
|
6822
6924
|
"the-grant-sentence-and-its-carve-out-hold-per-provider.test.mjs": {
|
|
6823
6925
|
"tests": 6,
|
|
6824
6926
|
"asserts": 7,
|
|
@@ -9203,6 +9305,12 @@
|
|
|
9203
9305
|
"skips": 0,
|
|
9204
9306
|
"todos": 0
|
|
9205
9307
|
},
|
|
9308
|
+
"providers/signa/test/a-search-asks-for-the-whole-goods-text.test.mjs": {
|
|
9309
|
+
"tests": 2,
|
|
9310
|
+
"asserts": 8,
|
|
9311
|
+
"skips": 0,
|
|
9312
|
+
"todos": 0
|
|
9313
|
+
},
|
|
9206
9314
|
"providers/signa/test/a-search-row-is-a-band-row.test.mjs": {
|
|
9207
9315
|
"tests": 3,
|
|
9208
9316
|
"asserts": 15,
|
|
@@ -51,6 +51,27 @@ export function verdictWithoutTheClosedGap({ verdict, assessed, reasons = [] } =
|
|
|
51
51
|
return verdict === "CONDITIONAL" && assessed === "CLEAR" && !reasons.length ? "CLEAR" : verdict;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
/**
|
|
55
|
+
* THE RESULT ONCE A CORRECTION WITHDRAWS EVERY FORWARD LEGAL STEP THAT ALONE MADE IT CONDITIONAL (the owner's decision,
|
|
56
|
+
* 2026-11-04). The review said CLEAR and the floor raised it to CONDITIONAL on the record's steps (`raisedBySteps`). The
|
|
57
|
+
* withdrawal must be positive: a readable record whose actions register is a list holds none of them (`withdrawnAt`),
|
|
58
|
+
* no step was ever dropped as unreadable (`stepsUnreadable`), the review of that change was read after it
|
|
59
|
+
* (`reviewReadAt`, and no review since went unread), no correction since was rejected (`correctionRejectedAt`), and the
|
|
60
|
+
* recheck after the first review's correction, where one was owed, was accepted (`recheckUnaccepted`).
|
|
61
|
+
* Then the result is recomputed as a closed gap's is, from the assessment and the conditions still standing: CLEAR only
|
|
62
|
+
* when none is left. Anything short of that keeps the result as it stands. Times are ISO strings. PURE.
|
|
63
|
+
*/
|
|
64
|
+
export function verdictWhenTheStepsAreWithdrawn({ verdict, assessed, reasons = [], raisedBySteps = false, stepsUnreadable = false,
|
|
65
|
+
withdrawnAt = null, reviewReadAt = null, reviewUnread = false, correctionRejectedAt = null, recheckUnaccepted = false } = {}) {
|
|
66
|
+
if (verdict !== "CONDITIONAL" || assessed !== "CLEAR" || raisedBySteps !== true || stepsUnreadable !== false) return verdict;
|
|
67
|
+
if (recheckUnaccepted !== false) return verdict;
|
|
68
|
+
const at = (t) => (typeof t === "string" ? Date.parse(t) : NaN);
|
|
69
|
+
const withdrawn = at(withdrawnAt), read = at(reviewReadAt);
|
|
70
|
+
if (!Number.isFinite(withdrawn) || !Number.isFinite(read) || !(read > withdrawn) || reviewUnread !== false) return verdict;
|
|
71
|
+
if (correctionRejectedAt != null && !(at(correctionRejectedAt) < withdrawn)) return verdict;
|
|
72
|
+
return verdictWithoutTheClosedGap({ verdict, assessed, reasons });
|
|
73
|
+
}
|
|
74
|
+
|
|
54
75
|
/**
|
|
55
76
|
* ONE SENTENCE WHEN THE WRITER'S DUTY AND THE RECALL GATE BOTH FIND RECORDS UNADDRESSED. Both state the approved
|
|
56
77
|
* sentence for records neither addressed nor set aside, each out of its own population: the records the writer was
|
package/driver/verify.mjs
CHANGED
|
@@ -812,6 +812,9 @@ export function verdictHardenedTo(carried, reviewMd) {
|
|
|
812
812
|
// a single letter or digit must still be followed by its own `.` or `)`, so `**Note.** …` matches nothing.
|
|
813
813
|
const LIST_MARKER = String.raw`(?:\*{0,2})(?:[-*•]|\d+[.)]|[A-Za-z][.)])(?:\*{0,2})\s+`;
|
|
814
814
|
const LIST_LINE_RE = new RegExp(`^${LIST_MARKER}\\S`);
|
|
815
|
+
/** What every walk below reads as a section heading: a markdown heading, or a line of capitals. One definition,
|
|
816
|
+
* exported so the review's renderer (narrative-refutation-record.mjs) keeps its own lines out of it. */
|
|
817
|
+
export const SECTION_HEADING_RE = /^#{1,6}\s+\S|^[A-Z][A-Z /&-]{5,}$/;
|
|
815
818
|
|
|
816
819
|
export function countCitedDefects(reviewMd) {
|
|
817
820
|
const rest = String(reviewMd ?? "").split("\n").slice(1);
|
|
@@ -819,7 +822,7 @@ export function countCitedDefects(reviewMd) {
|
|
|
819
822
|
let n = 0;
|
|
820
823
|
for (const raw of rest) {
|
|
821
824
|
const ln = raw.trim();
|
|
822
|
-
if (
|
|
825
|
+
if (SECTION_HEADING_RE.test(ln)) inPlanAudit = /PLAN-EXECUTION CHECK/i.test(ln);
|
|
823
826
|
if (inPlanAudit) continue;
|
|
824
827
|
// — SAME LINE SHAPE AS THE PRECISE WALK, ON PURPOSE. These two guards must not share a
|
|
825
828
|
// SELECTOR, and for a while that was read as "must not share anything": this one kept the pre-
|
|
@@ -1008,7 +1011,7 @@ export function correctionsSection(reviewMd) {
|
|
|
1008
1011
|
const rest = String(reviewMd ?? "").split("\n").slice(1);
|
|
1009
1012
|
for (const raw of rest) {
|
|
1010
1013
|
const ln = raw.trim();
|
|
1011
|
-
if (!
|
|
1014
|
+
if (!SECTION_HEADING_RE.test(ln)) continue;
|
|
1012
1015
|
if (CORRECTIONS_SECTION_RE.test(ln)) return { named: true, heading: ln.replace(/^#+\s*/, "").trim() };
|
|
1013
1016
|
}
|
|
1014
1017
|
return { named: false, heading: null };
|
|
@@ -1019,7 +1022,7 @@ export function parseCorrections(reviewMd) {
|
|
|
1019
1022
|
const rest = String(reviewMd ?? "").split("\n").slice(1);
|
|
1020
1023
|
|
|
1021
1024
|
const { named, heading } = correctionsSection(reviewMd);
|
|
1022
|
-
const isHeading = (ln) =>
|
|
1025
|
+
const isHeading = (ln) => SECTION_HEADING_RE.test(ln);
|
|
1023
1026
|
void heading;
|
|
1024
1027
|
|
|
1025
1028
|
const candidates = [];
|
package/mcp-server/CHANGELOG.md
CHANGED
package/mcp-server/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "trademark-artifacts-mcp",
|
|
3
|
-
"version": "0.5.0
|
|
3
|
+
"version": "0.5.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.",
|
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.5.0
|
|
5
|
+
"version": "0.5.0",
|
|
6
6
|
"license": "AGPL-3.0-only",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
@@ -92,6 +92,7 @@
|
|
|
92
92
|
"ADDITIONAL-TERMS.md",
|
|
93
93
|
"THIRD-PARTY-NOTICES.md",
|
|
94
94
|
"INSTALL.md",
|
|
95
|
+
"QUICKSTART.md",
|
|
95
96
|
"CODE_OF_CONDUCT.md",
|
|
96
97
|
"CONTRIBUTING.md",
|
|
97
98
|
"SECURITY.md",
|
package/portal-ui/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "portal-ui",
|
|
3
3
|
"private": true,
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "0.5.0
|
|
5
|
+
"version": "0.5.0",
|
|
6
6
|
"license": "AGPL-3.0-only",
|
|
7
7
|
"description": "The unified trademark portal UI. One address, one login: who you are decides what you see. Built as a static bundle, served by driver/portal-service.mjs — the browser never reaches profile-service or recipe-service.",
|
|
8
8
|
"engines": {
|
|
@@ -425,6 +425,14 @@ function finishSearchRequest(body, p) {
|
|
|
425
425
|
// kernel then cannot test the ceiling and every band returns `incomplete`. So it is not an option
|
|
426
426
|
// the caller may pass; it is a condition of the contract, set here where no call site can forget it.
|
|
427
427
|
body.options = { ...(p.options && typeof p.options === "object" ? p.options : {}), include_total: true };
|
|
428
|
+
// ── the whole goods text, asked for on EVERY call too ───────────────────────────────────────────
|
|
429
|
+
// The register's default answer carries "the first 280 characters" of each goods statement, and
|
|
430
|
+
// `include: ["full_goods_services"]` "returns the full goods and services text instead" (docs.signa.so,
|
|
431
|
+
// Search Trademarks, `include`, top-level as the reference places it; a search is "10 per page" either
|
|
432
|
+
// way). Without it the band held each long statement cut, and the full record arrived only at delivery,
|
|
433
|
+
// so a cited record's classes could be written up as "cut and unread" while the run went on to fetch them
|
|
434
|
+
// whole. The rows say they were asked for it (`goods_whole`, below).
|
|
435
|
+
body.include = ["full_goods_services"];
|
|
428
436
|
return body;
|
|
429
437
|
}
|
|
430
438
|
|
|
@@ -592,7 +600,11 @@ export function normalizeRecord(rec, officeHint = null) {
|
|
|
592
600
|
// near-identical records delivered none of them while reporting success.
|
|
593
601
|
//
|
|
594
602
|
// The signa-named keys stay: rowScreen and the search tool's own output read them.
|
|
595
|
-
|
|
603
|
+
//
|
|
604
|
+
// `goods_whole` says the request asked for each goods statement whole (`include`, buildSearchRequest), so an
|
|
605
|
+
// unflagged statement on this row is the whole of its class at any length (record-goods.mjs, rowGoods). Absent
|
|
606
|
+
// on a row from an answer that did not ask, which keeps the default answer's rule.
|
|
607
|
+
function normalizeSearchRow(rec, { goodsWhole = false } = {}) {
|
|
596
608
|
const owner0 = Array.isArray(rec.owners) ? rec.owners[0] : null;
|
|
597
609
|
const owner = rec.owner_name ?? owner0?.name ?? null;
|
|
598
610
|
const classes = normalizeClasses(rec);
|
|
@@ -617,6 +629,7 @@ function normalizeSearchRow(rec) {
|
|
|
617
629
|
// the channels that found it, and the terms or filter values it matched. It replaced the per-row
|
|
618
630
|
// `match_explanation` and `matched_terms`, which the register removed on 2026-10-05.
|
|
619
631
|
match: rec.match && typeof rec.match === "object" ? rec.match : null,
|
|
632
|
+
...(goodsWhole ? { goods_whole: true } : {}),
|
|
620
633
|
raw: rec,
|
|
621
634
|
};
|
|
622
635
|
}
|
|
@@ -662,7 +675,7 @@ export function readTotal(body) {
|
|
|
662
675
|
return { total: Number.isFinite(p.total_count) ? p.total_count : null, approximate: false };
|
|
663
676
|
}
|
|
664
677
|
|
|
665
|
-
export function normalizeSearchResponse(body, echoQuery) {
|
|
678
|
+
export function normalizeSearchResponse(body, echoQuery, { goodsWhole = false } = {}) {
|
|
666
679
|
// A NON-ANSWER (the response did not parse, or parsed into something with no data[]) reports
|
|
667
680
|
// total_hits NULL, never 0 — the same rule as the corsearch and clarivate normalizers. It matters
|
|
668
681
|
// MORE here, not less: an empty page 0 with has_more:false simply ENDS the loop, so a truncated 200
|
|
@@ -723,7 +736,7 @@ export function normalizeSearchResponse(body, echoQuery) {
|
|
|
723
736
|
has_more: body?.has_more === true,
|
|
724
737
|
next_cursor: body?.pagination?.cursor ?? null,
|
|
725
738
|
took_ms: meta.execution_time_ms ?? null,
|
|
726
|
-
results: data.map(normalizeSearchRow),
|
|
739
|
+
results: data.map((rec) => normalizeSearchRow(rec, { goodsWhole })),
|
|
727
740
|
request_id: body?.request_id ?? null,
|
|
728
741
|
};
|
|
729
742
|
}
|
|
@@ -877,7 +890,8 @@ export async function doSearch(apiKey, base, params, tctx, { mock = false } = {}
|
|
|
877
890
|
+ `${unreadable.join(", ")} filter compares letters as written, so it can match nothing. Its zero is not a count `
|
|
878
891
|
+ `of filings and is not taken as this search's answer. ${searchTargetLabel(params).slice(0, 120)}` };
|
|
879
892
|
}
|
|
880
|
-
return { type: "text", text: JSON.stringify(normalizeSearchResponse(r.body, params.query
|
|
893
|
+
return { type: "text", text: JSON.stringify(normalizeSearchResponse(r.body, params.query,
|
|
894
|
+
{ goodsWhole: Array.isArray(body.include) && body.include.includes("full_goods_services") }), null, 2) };
|
|
881
895
|
}
|
|
882
896
|
|
|
883
897
|
// ── A TEXT FILTER CANNOT READ A TERM THAT MIXES ALPHABETS ─────────────────────────────────────────
|