clearotron 0.5.0 → 0.5.1-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 (123) hide show
  1. package/CONTRIBUTING.md +2 -2
  2. package/INSTALL.md +334 -302
  3. package/QUICKSTART.md +12 -4
  4. package/README.md +12 -7
  5. package/THIRD-PARTY-NOTICES.md +4 -4
  6. package/bin/README.md +14 -11
  7. package/bin/clearotron.mjs +1 -1
  8. package/bin/connect.mjs +73 -25
  9. package/bin/example.mjs +4 -2
  10. package/bin/onboard.mjs +562 -336
  11. package/bin/start.mjs +184 -36
  12. package/bin/update.mjs +26 -13
  13. package/build-info.json +2 -2
  14. package/docs/PORTAL.md +2 -2
  15. package/docs/architecture/02-architecture.md +3 -3
  16. package/docs/architecture/04-configuration-reference.md +1 -2
  17. package/docs/architecture/05-config-governance.md +1 -1
  18. package/docs/architecture/06-operations-runbook.md +1 -1
  19. package/driver/CHANGELOG.md +77 -0
  20. package/driver/README.md +2 -2
  21. package/driver/config-inventory.mjs +20 -11
  22. package/driver/contract-e3-backlog.mjs +27 -27
  23. package/driver/contract-e3-baseline.json +2 -2
  24. package/driver/contract-vocabulary.mjs +1 -1
  25. package/driver/degraded-parts.mjs +67 -3
  26. package/driver/dev-portal.mjs +1 -1
  27. package/driver/digest-queue.mjs +5 -5
  28. package/driver/driver.config.mjs +9 -9
  29. package/driver/engine/CONTRACT.md +1 -1
  30. package/driver/engine/anthropic-agent.mjs +4 -2
  31. package/driver/engine/mcp/band-server.mjs +1 -21
  32. package/driver/engine/mcp/clarivate-propose-tool.mjs +26 -0
  33. package/driver/engine/mcp/clarivate-server.mjs +2 -18
  34. package/driver/engine/mcp/fixture-register-server.mjs +33 -0
  35. package/driver/engine/mcp/gather-config.mjs +48 -7
  36. package/driver/engine/mcp/recording-server.mjs +206 -14
  37. package/driver/engine/mcp/supplemental.mjs +4 -2
  38. package/driver/engine/openai-agent.mjs +3 -1
  39. package/driver/engine/probe.mjs +10 -0
  40. package/driver/filing-goods.mjs +95 -0
  41. package/driver/findings-model.mjs +3 -0
  42. package/driver/gateway.mjs +42 -40
  43. package/driver/knockout-assess-record.mjs +54 -4
  44. package/driver/knockout-correction-record.mjs +342 -0
  45. package/driver/knockout-frame-record.mjs +4 -2
  46. package/driver/knockout-register-read.mjs +705 -0
  47. package/driver/knockout-register-record.mjs +222 -0
  48. package/driver/knockout-review-record.mjs +96 -25
  49. package/driver/narrative-refutation-record.mjs +87 -1
  50. package/driver/order-tables.mjs +23 -0
  51. package/driver/owner-use-check.mjs +5 -2
  52. package/driver/package.json +1 -1
  53. package/driver/partial-payload-baseline.json +8 -0
  54. package/driver/pipeline-knockout.mjs +506 -313
  55. package/driver/pipeline.mjs +179 -86
  56. package/driver/portal-local-auth.mjs +7 -1
  57. package/driver/portal-service.mjs +62 -6
  58. package/driver/progress.mjs +2 -2
  59. package/driver/publish/index.mjs +18 -21
  60. package/driver/publish/knockout.mjs +40 -18
  61. package/driver/publish/render-knockout.mjs +40 -27
  62. package/driver/publish/report-dates.mjs +43 -0
  63. package/driver/recall-reconciliation.mjs +2 -2
  64. package/driver/record-goods.mjs +50 -9
  65. package/driver/register-count.mjs +12 -59
  66. package/driver/register-fixture-marker.mjs +22 -0
  67. package/driver/register-plan.mjs +48 -0
  68. package/driver/register-records.mjs +84 -266
  69. package/driver/register-taint.mjs +2 -2
  70. package/driver/repair-composers.mjs +15 -8
  71. package/driver/result-noun-fields.mjs +6 -2
  72. package/driver/run-requirements.mjs +54 -4
  73. package/driver/runner.mjs +4 -13
  74. package/driver/skills/clearance-register/providers/clarivate.md +2 -2
  75. package/driver/skills/knockout-assess/SKILL.md +101 -100
  76. package/driver/skills/knockout-frame/SKILL.md +3 -1
  77. package/driver/skills/knockout-register-read/SKILL.md +77 -0
  78. package/driver/stages-knockout.mjs +159 -98
  79. package/driver/stages.mjs +4 -2
  80. package/driver/suite-census.json +389 -71
  81. package/driver/systemd/README.md +2 -2
  82. package/driver/verify-knockout.mjs +175 -39
  83. package/driver/verify.mjs +10 -9
  84. package/mcp-server/CHANGELOG.md +4 -0
  85. package/mcp-server/CONNECT.md +4 -0
  86. package/mcp-server/demo-mode.mjs +6 -0
  87. package/mcp-server/lib/demo-texts.mjs +38 -0
  88. package/mcp-server/lib/http-handler.mjs +7 -1
  89. package/mcp-server/lib/knockout.mjs +3 -2
  90. package/mcp-server/lib/options.mjs +3 -1
  91. package/mcp-server/lib/plan.mjs +6 -1
  92. package/mcp-server/mint-token.mjs +1 -1
  93. package/mcp-server/package.json +1 -1
  94. package/mcp-server/serve.mjs +11 -0
  95. package/mcp-server/server.mjs +13 -5
  96. package/package.json +1 -1
  97. package/portal-ui/dist/assets/{index-D2wrw9cH.css → index-AtB9ZpDH.css} +29 -0
  98. package/portal-ui/dist/assets/{index-DcLbvFmQ.js → index-C1oE78Wk.js} +161 -195
  99. package/portal-ui/dist/index.html +2 -2
  100. package/portal-ui/package.json +4 -4
  101. package/providers/README.md +4 -4
  102. package/providers/_shared/execute-plan.mjs +45 -1
  103. package/providers/_shared/term-shape.mjs +1 -1
  104. package/providers/clarivate/src/capabilities.js +7 -6
  105. package/providers/clarivate/src/core.js +11 -7
  106. package/providers/clarivate/src/wider-list.js +104 -0
  107. package/providers/oauth-mcp-bridge/CHANGELOG.md +4 -0
  108. package/providers/oauth-mcp-bridge/package.json +1 -1
  109. package/providers/signa/src/capabilities.js +0 -9
  110. package/scripts/e2e-first-time.mjs +8 -7
  111. package/scripts/freeze-example-run.mjs +2 -2
  112. package/scripts/settings-render-check.mjs +5 -3
  113. package/scripts/test-run.mjs +8 -2
  114. package/shared/client-door.mjs +11 -8
  115. package/shared/connect-clients.mjs +10 -4
  116. package/shared/demo-connection.mjs +43 -0
  117. package/shared/demo-start-args.mjs +7 -2
  118. package/shared/invocation.mjs +18 -3
  119. package/shared/permanent-install.mjs +14 -0
  120. package/shared/scope.mjs +8 -1
  121. package/shared/stdio-connect.mjs +43 -21
  122. package/shared/trigger-lane.mjs +7 -0
  123. package/shared/tty-style.mjs +21 -5
@@ -36,8 +36,8 @@
36
36
  chosen anywhere in the product holds everywhere in it.
37
37
  -->
38
38
  <script>(function(){try{var t=localStorage.getItem('cordillera-theme');if(t==='dark'||t==='light')document.documentElement.setAttribute('data-theme',t);}catch(e){}})();</script>
39
- <script type="module" crossorigin src="/portal/assets/index-DcLbvFmQ.js"></script>
40
- <link rel="stylesheet" crossorigin href="/portal/assets/index-D2wrw9cH.css">
39
+ <script type="module" crossorigin src="/portal/assets/index-C1oE78Wk.js"></script>
40
+ <link rel="stylesheet" crossorigin href="/portal/assets/index-AtB9ZpDH.css">
41
41
  </head>
42
42
  <body>
43
43
  <div id="root"></div>
@@ -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.1-beta.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": {
@@ -16,14 +16,14 @@
16
16
  "test:full": "npm run test"
17
17
  },
18
18
  "dependencies": {
19
- "react": "^19.3.0",
20
- "react-dom": "^19.3.0"
19
+ "react": "^19.3.1",
20
+ "react-dom": "^19.3.1"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@types/react": "^19.3.0",
24
24
  "@types/react-dom": "^19.3.0",
25
25
  "@vitejs/plugin-react": "^6.1.2",
26
26
  "typescript": "^7.0.2",
27
- "vite": "^8.3.4"
27
+ "vite": "^8.3.5"
28
28
  }
29
29
  }
@@ -5,8 +5,8 @@ This directory holds one adapter per external data source. Two kinds live here:
5
5
  - **Registers** — the trademark offices a clearance searches. **Exactly one is active per install**, chosen
6
6
  by `CLEAROTRON_DATABASE`. There is no default and no fallback: unset, a run refuses and names the
7
7
  variable.
8
- - **Research and support** — the marketplace/common-law sweep (`perplexity`), the search-engine grid
9
- (`serpapi`), the native-script candidate lane (`jx`), and an OAuth bridge to case-law sources
8
+ - **Research and support** — the marketplace/common-law sweep (`perplexity`), the Chinese marketplace
9
+ search (`serpapi`), the native-script candidate lane (`jx`), and an OAuth bridge to case-law sources
10
10
  (`oauth-mcp-bridge`).
11
11
 
12
12
  `_shared/` is the register kernel every register adapter is built from — paging, counting, screening,
@@ -129,10 +129,10 @@ costs coverage and says so; over-claiming produces a thin answer that reads as c
129
129
 
130
130
  | Source | Needs | Used by | Without it |
131
131
  |---|---|---|---|
132
- | `perplexity` | `PERPLEXITY_API_KEY` — metered, prepaid credits, no free tier | The common-law and marketplace sweep, on **every** product | A clearance refuses at preflight, before a stage has spent; a knockout runs, delivers its register half, and states on the report that the open-web half did not run |
132
+ | `perplexity` | `PERPLEXITY_API_KEY` — metered, prepaid credits, no free tier | The common-law and marketplace sweep, on the three clearance searches | A clearance refuses at preflight, before a stage has spent; a Knockout search runs, delivers its register half, and states on the report that the open-web half did not run |
133
133
  | `oauth-mcp-bridge` | A one-time OAuth login per source (CourtListener, LegalDataHunter) — **free, immediate access** | The case-law reading, on a Full country search only | The lane stays dark and the run's ledger records that it did not dispatch, so no report can claim "no adverse case law" |
134
134
  | `jx` | none of its own — runs on the program the run chose | Native-script (CJK) register candidates | The lane degrades and says so |
135
- | `serpapi` | `SERPAPI_API_KEY` — free tier available | The search-engine grid inside the CJK lane | Grid cells gap with one named cause |
135
+ | `serpapi` | `SERPAPI_API_KEY` — free tier available | Only the native-language investigation of China, Hong Kong, Taiwan or Macau: it searches the Chinese marketplaces through Baidu | Those marketplaces come back as a disclosed gap, with one named cause |
136
136
 
137
137
  Case-law setup is an OAuth flow, **not** an environment variable — see
138
138
  [`oauth-mcp-bridge/README.md`](oauth-mcp-bridge/README.md).
@@ -347,6 +347,9 @@ export function makeExecutePlan(deps) {
347
347
  // silent zero, and a caller who wired an executor without a contract has declared even less
348
348
  // than one who left the field null.
349
349
  capabilities = null,
350
+ // What a question asked in another form (`exact_substituted`) takes from the answers the run already holds, or null
351
+ // to send it: (compiled query, [{entry, query, block}], entry) → a block. A provider with no such reader always sends.
352
+ answerFromHeld = null,
350
353
  } = deps;
351
354
 
352
355
  // ── the I/O seam (see ./transport-guard.mjs) ──────────────────────────────────────────────────────
@@ -739,7 +742,47 @@ export function makeExecutePlan(deps) {
739
742
  // PAST ITS TIME TO STOP SENDING, A CALL SENDS NO NEW QUESTION (send-until.mjs). The question is not reached by
740
743
  // this call and keeps whatever block the band holds for it; the call returns what it has, naming it.
741
744
  const notReached = [];
745
+ // ── A QUESTION ASKED IN ANOTHER FORM READS THE RUN'S ANSWERS FIRST (ruled 2026-11-05) ─────────────────────────────
746
+ // Every answer on record: this call's, and every band in this run's folder, taken-out slices read as open. Axes run in
747
+ // parallel, so an answer that lands later is not seen and the question is sent: that costs its request and loses nothing.
748
+ const heldOnRecord = () => {
749
+ const folder = dirname(outPath);
750
+ let names = [];
751
+ try { names = readdirSync(folder); } catch { names = []; }
752
+ const byQid = new Map();
753
+ const addEntries = (doc) => { for (const x of Array.isArray(doc?.entries) ? doc.entries : []) if (x?.qid && !byQid.has(x.qid)) byQid.set(x.qid, x); };
754
+ addEntries(plan);
755
+ const read = (file) => { try { return JSON.parse(readFileSync(file, "utf8")); } catch { return null; } };
756
+ if (driverDir) addEntries(read(join(driverDir, "register-plan.json")));
757
+ for (const f of names.filter((n) => n.endsWith("-supplemental-plan.json"))) addEntries(read(join(folder, f)));
758
+ const answers = new Map();
759
+ const takenOut = slicesTakenOutByAxis(dirname(folder));
760
+ for (const f of names.filter((n) => n.endsWith("-band.json"))) {
761
+ const prior = read(join(folder, f));
762
+ const ofAxis = takenOut.get(f.slice(0, -"-band.json".length));
763
+ for (const b of Array.isArray(prior) ? bandWithSlicesOut(prior, ofAxis).blocks : []) if (b?.qid) answers.set(b.qid, b);
764
+ }
765
+ for (const b of blocks) if (b?.qid) answers.set(b.qid, b);
766
+ return [...answers.values()].map((block) => ({ entry: byQid.get(block.qid), block })).filter((h) => h.entry);
767
+ };
768
+ const heldAnswer = (e) => {
769
+ if (!e?.exact_substituted || typeof answerFromHeld !== "function") return null;
770
+ try {
771
+ const compile = (x) => withPlanRegions(buildEntryQuery(x, predicateParams(x), plan), plan);
772
+ const held = heldOnRecord().filter((h) => h.entry.qid !== e.qid).flatMap((h) => {
773
+ try { return [{ ...h, query: compile(h.entry) }]; } catch { return []; }
774
+ });
775
+ return answerFromHeld(compile(e), held, e);
776
+ } catch { return null; } // a question that cannot be read against the record is still a question: it is sent
777
+ };
742
778
  const runEntry = async (e) => {
779
+ const held = heldAnswer(e);
780
+ if (held) {
781
+ blocks.push({ ...held, qid: e.qid, query: describeEntry(e) });
782
+ stateByQid.set(e.qid, held.error ? "error" : held.state);
783
+ keepAnswersSoon();
784
+ return;
785
+ }
743
786
  if (pastSendUntil(tctx)) { notReached.push(e.qid); return; }
744
787
  if (driverDir && followUpClass(e, { identicalTerms }) === "counted") {
745
788
  const room = followUpRoom(driverDir, FOLLOW_UP_SEARCH_LIMIT, e, { answered: answeredBefore });
@@ -770,7 +813,8 @@ export function makeExecutePlan(deps) {
770
813
  keepAnswersSoon();
771
814
  };
772
815
 
773
- for (const e of targeted.filter((x) => !x.when)) await runEntry(e);
816
+ // A question asked in another form goes last, so it can read what the others answered.
817
+ for (const e of [...targeted.filter((x) => !x.when && !x.exact_substituted), ...targeted.filter((x) => !x.when && x.exact_substituted)]) await runEntry(e);
774
818
  const skipped = [];
775
819
  for (const e of targeted.filter((x) => x.when)) {
776
820
  // A CROWD IS WHAT HOLDS A CHILD BACK, and only a crowd. `enumerated` is the state of a question
@@ -153,7 +153,7 @@ export function termMarkupIssue(term) {
153
153
  * compiler's manifest-provenance term_literal stamp exists for);
154
154
  * - `(` — a parenthetical is annotation, never mark text;
155
155
  * - `—` (em-dash) or `;` — sentence punctuation;
156
- * - a space-flanked `/` — an enumeration separator ("TIKTOK / TIK- family"), NOT the tight slash
156
+ * - a space-flanked `/` — an enumeration separator ("NOVAPULSE / NOVA- family"), NOT the tight slash
157
157
  * marks legitimately carry (24/7, GUNS N/ROSES).
158
158
  */
159
159
  export function termShapeIssue(term) {
@@ -249,6 +249,10 @@ export const CAPABILITIES = Object.freeze({
249
249
  // `null` means the compiler keeps asking the contains form at every length, which is what this
250
250
  // register has always been sent. A declared number must come from the vendor, not from a guess.
251
251
  containsMinLength: null,
252
+ // The words this register parses as commands inside the exact field, which has no escape syntax (core.js,
253
+ // assertSearchableTerm). A phrase holding one is asked as its words in order, where the same words are
254
+ // dropped and the gap widens (register-plan.mjs, exactOperatorSubstitution).
255
+ exactOperatorWords: Object.freeze(["AND", "OR", "NOT"]),
252
256
  // The operator the goods clause rides. `EQUALS` on WHOLE WORDS: `CONTAINS` is a hard 400 here
253
257
  // exactly as it is on APPLICANT_NAME, and so is a mid-word wildcard. Several words are asked for
254
258
  // with `OR` inside the value.
@@ -285,12 +289,9 @@ export const CAPABILITIES = Object.freeze({
285
289
  // compiled and then deferred, and a deferred look-alike was counted as a search not completed. `false`
286
290
  // leaves those spellings out of the form band and lists them there as not searched, as on Signa.
287
291
  mixedScriptQuery: false,
288
- // A knockout's listing already holds its count. The listing's `/search` asks the count lane's exact
289
- // question, with the same body `/count` takes, and returns every matching id, so its length is the
290
- // register's total. A knockout therefore lists first and takes the identical and close counts from the
291
- // listing (driver/register-count.mjs listingAnswers). A term the listing did not answer, including one
292
- // `/search` refuses for exceeding the result ceiling, is counted with `/count` as before.
293
- listingAnswersCount: true,
292
+ // A joined exact question answers one count over its spellings, and a filing has one spelling, so a knockout counts
293
+ // its mechanical forms in one call (driver/register-count.mjs). Saved runs hold 42 such answers, on lists up to 20 wide.
294
+ exactFormsCountAsOne: true,
294
295
  // No phoneme expansion knob: PHONETIC_WORD_MARK_SPECIFICATION is the whole surface; the client cannot
295
296
  // hand it a variant list. (/similarity/word/* — which would be the expansion surface — is genuinely
296
297
  // not available on this provider; the endpoint answers 403. Do NOT wire it.)
@@ -40,6 +40,7 @@ import {
40
40
  } from "../../_shared/screen.mjs";
41
41
  import { makeEnumerate, ENUMERATE_NAMES_CHUNK_DEFAULT, parseToolText } from "../../_shared/enumerate.mjs";
42
42
  import { makeCountProbe } from "../../_shared/count.mjs";
43
+ import { answerFromHeldList } from "./wider-list.js";
43
44
  import { CAPABILITY_GAP_MARKER, REFUSED_BEFORE_SENDING, defaultBuildEntryQuery, makeExecutePlan, makeRegionRequiredBuildEntryQuery, planPredicateParams } from "../../_shared/execute-plan.mjs";
44
45
  import { isNonLatinTerm } from "../../_shared/script-form.mjs";
45
46
  import { CAPABILITIES, CLARIVATE_OFFICE_CODES } from "./capabilities.js";
@@ -297,12 +298,12 @@ export const MATCH_MODE_TO_FIELD = Object.freeze({
297
298
  // token is dropped from the chain. Kept, it matches nothing and would zero the whole phrase.
298
299
  const PHRASE_OPERATOR = "ADJ";
299
300
  // ── A TERM MUST BE ONE MARK, ON EVERY MARK-FIELD PREDICATE ────────────────────────────────────────
300
- // The supplemental/cross-check lanes sometimes mint a LIST or a DESCRIPTION into the term field. All
301
- // three of these appeared in one frozen plan, EACH minted twice — once `default`,
302
- // once `exact`:
303
- // "SLUSH FREEZE, SLUSH ICE, SLUSH POP" three terms crammed into one
304
- // "TIKTOK / TIK- famous-neighbour family" a description of a family, not a name
305
- // "WAVU, WAPO one-keystroke neighbours of WAVO"
301
+ // The supplemental/cross-check lanes sometimes mint a LIST or a DESCRIPTION into the term field. Terms
302
+ // of all three shapes below appeared in one frozen plan, EACH minted twice — once `default`,
303
+ // once `exact`. These examples are invented:
304
+ // "IRONWHISK SODA, IRONWHISK JUICE, IRONWHISK TONIC" three terms crammed into one
305
+ // "NOVAPULSE / NOVA- famous-neighbour family" a description of a family, not a name
306
+ // "IRONWHIZK, IRONWHISQ one-keystroke neighbours of IRONWHISK"
306
307
  //
307
308
  // Searched, they return 0 — and a 0 here reads as CLEAN, which is the one outcome this contract must
308
309
  // never produce by accident. On that run the `default` twins deferred loudly while the `exact` twins
@@ -711,7 +712,7 @@ export function buildSearchRequest(p) {
711
712
  if (markTerms.length) {
712
713
  const values = markTerms.map((t) => {
713
714
  // SHAPE FIRST, on the RAW term. stripPunctuation dissolves the very separators that mark a term
714
- // out as a list ("SLUSH FREEZE, SLUSH ICE, SLUSH POP" → one long name → 0 → reads as CLEAN), so
715
+ // out as a list ("IRONWHISK SODA, IRONWHISK JUICE, IRONWHISK TONIC" → one long name → 0 → reads as CLEAN), so
715
716
  // an `exact` slice checked after stripping is checked too late. compilePhraseValue re-checks for
716
717
  // the phrase modes; this is the one call that covers `exact`.
717
718
  assertSingleMarkShape(t);
@@ -2045,6 +2046,9 @@ const __executePlan = makeExecutePlan({
2045
2046
  // scope, already translated to office codes at compile time); with no plan regions either, the
2046
2047
  // provider still fails loud rather than sweeping something that was never asked for.
2047
2048
  buildEntryQuery: makeRegionRequiredBuildEntryQuery(substituteRomanizedNames),
2049
+ // An exact phrase asked as its words in order reads the run's answers first (wider-list.js).
2050
+ answerFromHeld: (query, held, entry) => answerFromHeldList({ want: buildSearchRequest(query), literal: entry.term, markField: MARK_FIELD,
2051
+ held: held.flatMap((h) => { try { return [{ qid: h.block.qid, block: h.block, body: buildSearchRequest(h.query) }]; } catch { return []; } }) }),
2048
2052
  // predicateParams → the WILDCARD predicate is Clarivate-shaped, and inheriting the shared default
2049
2053
  // here would silently mis-serve a slice this provider CAN execute.
2050
2054
  //
@@ -0,0 +1,104 @@
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
+ // wider-list.js — whether an answer the run already holds answers a phrase question, so that nothing is sent.
5
+ //
6
+ // A phrase holding AND, OR or NOT cannot be asked on the exact field, and is asked as its words in order
7
+ // (register-plan.mjs, exactOperatorSubstitution). Before that goes out, this reads the run's own answers, on these rules:
8
+ //
9
+ // THE SAME REQUEST, whatever came back. A request already answered is not asked again, and a crowd stays a crowd.
10
+ // A WIDER LIST, ONLY WHEN IT PROVABLY HOLDS THE PHRASE AND WAS COMPLETE. Its request must match the phrase's words
11
+ // whether or not the register indexes the operator word; a phonetic field or a bare one-word pattern proves nothing
12
+ // about a multi-word mark. It asked the same offices or more, offices it left out for the goods field subtracted first,
13
+ // and the same classes or more, or none. Goods, owner and options must be the same: a record here cannot be read
14
+ // against a narrower goods or owner question. Every record must carry usable mark text. A crowded, incomplete or
15
+ // failed list is no answer at all, so the question is asked.
16
+ //
17
+ // What the phrase takes from a wider list is the records in its own offices and classes whose mark reads as its words in
18
+ // order, which is what its own request would have returned as far as the code can establish. The other records stand in
19
+ // the run under the search that found them. The match rules are the ones core.js records from measurement: a wildcard
20
+ // applies within a word, and ADJn means within n words, in order. They are not the vendor's documentation, so anything
21
+ // this cannot establish is asked rather than assumed. PURE.
22
+
23
+ const OPERATOR_WORD = /^(?:AND|OR|NOT)$/i;
24
+ const orLegs = (value) => String(value ?? "").split(/\s+OR\s+/).filter(Boolean);
25
+ const wordsOf = (text) => String(text ?? "").replace(/[^\p{L}\p{N}\s]+/gu, " ").split(/\s+/).filter(Boolean);
26
+ const wordMatches = (pattern, word) => new RegExp(`^${pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*").replace(/\?/g, ".")}$`, "iu").test(word);
27
+
28
+ /** Does one leg of a compiled value (`*A ADJ2 B*`) match a mark whose words are these? null when the leg is not a chain of words. */
29
+ export function legMatches(leg, words) {
30
+ const parts = String(leg).trim().split(/\s+/);
31
+ const wanted = [], gaps = [];
32
+ for (let i = 0; i < parts.length; i++) {
33
+ if (i % 2 === 0) wanted.push(parts[i]);
34
+ else {
35
+ const m = /^ADJ(\d*)$/i.exec(parts[i]);
36
+ if (!m) return null;
37
+ gaps.push(m[1] ? Number(m[1]) : 1);
38
+ }
39
+ }
40
+ const from = (k, at) => {
41
+ for (let i = at; i < words.length; i++) {
42
+ if (k > 0 && i - at + 1 > gaps[k - 1]) return false;
43
+ if (!wordMatches(wanted[k], words[i])) continue;
44
+ if (k === wanted.length - 1 || from(k + 1, i + 1)) return true;
45
+ }
46
+ return false;
47
+ };
48
+ return from(0, 0);
49
+ }
50
+
51
+ /** Does this compiled value hold the literal phrase, whether or not the register indexes its operator word? */
52
+ function holdsThePhrase(value, literal) {
53
+ const all = wordsOf(literal);
54
+ const kept = all.filter((w) => !OPERATOR_WORD.test(w));
55
+ const provable = (leg) => /\sADJ\d*\s/i.test(leg) || /^\*[^\s]*\*$/.test(leg.trim());
56
+ return orLegs(value).some((leg) => provable(leg) && legMatches(leg, all) === true && legMatches(leg, kept) === true);
57
+ }
58
+
59
+ const superset = (a, b) => [...b].every((x) => a.has(x));
60
+ const CLASS_FIELD = "INT_CLASS_NUMBER";
61
+
62
+ /** A compiled request taken apart into what this comparison reads. */
63
+ function partsOf(body, markField) {
64
+ const fields = Array.isArray(body?.searchFields) ? body.searchFields : [];
65
+ const mark = fields.find((f) => f?.name === markField) ?? null;
66
+ const classes = new Set(orLegs(fields.find((f) => f?.name === CLASS_FIELD)?.value));
67
+ const { registrationOfficeCodes, searchFields: _fields, ...options } = body ?? {};
68
+ const others = fields.filter((f) => f?.name !== markField && f?.name !== CLASS_FIELD);
69
+ return { mark, classes, offices: new Set(registrationOfficeCodes ?? []), rest: JSON.stringify({ others, options }) };
70
+ }
71
+
72
+ const markTexts = (r) => [r?.mark_text, r?.screen?.mark_text, r?.screen?.mark_transliteration].filter((t) => wordsOf(t).length);
73
+
74
+ /**
75
+ * The answer a held search gives this question, or null when none does: `{state, total_hits, count, records, reused_from}`,
76
+ * or for the same request the held block itself with `reused_from`. `want` is the question's compiled request, `literal` its
77
+ * term, and `held` the run's answers as `[{qid, query, body, block}]`. `markField` is the contains form's field.
78
+ */
79
+ export function answerFromHeldList({ want, literal, held, markField }) {
80
+ const w = partsOf(want, markField);
81
+ if (!w.mark) return null;
82
+ const legs = orLegs(w.mark.value);
83
+ // A word of the question this comparison cannot read (punctuation inside it) would read as no match, and no match as a zero.
84
+ if (legs.length !== 1 || /[^\p{L}\p{N}*?\s]/u.test(legs[0])) return null;
85
+ const answers = Array.isArray(held) ? held : [];
86
+ const sameRequest = answers.find((h) => h?.block && h.block.error !== true && h.block.deferred !== true && JSON.stringify(h.body) === JSON.stringify(want));
87
+ if (sameRequest) return { ...sameRequest.block, reused_from: { qid: sameRequest.qid, query: sameRequest.block.query ?? null } };
88
+ for (const h of answers) {
89
+ const b = h?.block;
90
+ if (!b || b.error === true || b.deferred === true || b.state !== "enumerated" || !Array.isArray(b.records)) continue;
91
+ const c = partsOf(h.body, markField);
92
+ if (!c.mark || !holdsThePhrase(c.mark.value, literal)) continue;
93
+ if (c.rest !== w.rest) continue;
94
+ const leftOut = new Set(Array.isArray(b.offices_without_goods_field) ? b.offices_without_goods_field : []);
95
+ if (!superset(new Set([...c.offices].filter((o) => !leftOut.has(o))), w.offices)) continue;
96
+ if (c.classes.size && !(w.classes.size && superset(c.classes, w.classes))) continue;
97
+ if (!b.records.every((r) => markTexts(r).length)) continue;
98
+ const records = b.records.filter((r) => w.offices.has(String(r?.office ?? "").toUpperCase())
99
+ && (!w.classes.size || !Array.isArray(r?.classes) || !r.classes.length || r.classes.some((n) => w.classes.has(String(n))))
100
+ && markTexts(r).some((t) => legMatches(legs[0], wordsOf(t)) === true));
101
+ return { state: "enumerated", total_hits: records.length, count: records.length, records, reused_from: { qid: h.qid, query: b.query ?? null } };
102
+ }
103
+ return null;
104
+ }
@@ -1,5 +1,9 @@
1
1
  # trademark-oauth-mcp-bridge
2
2
 
3
+ ## 0.5.1-beta.0
4
+
5
+ No changes in this release.
6
+
3
7
  ## 0.5.0
4
8
 
5
9
  No changes in this release.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trademark-oauth-mcp-bridge",
3
- "version": "0.5.0",
3
+ "version": "0.5.1-beta.0",
4
4
  "license": "AGPL-3.0-only",
5
5
  "private": true,
6
6
  "description": "OAuth 2.1 MCP stdio bridge used by the engine's case-law gather stage (courtlistener / legaldatahunter).",
@@ -379,15 +379,6 @@ export const CAPABILITIES = Object.freeze({
379
379
  // OPTIONAL, like `queryableStatuses`: a provider that does not declare it keeps sending these terms,
380
380
  // as every provider did before the field existed.
381
381
  mixedScriptQuery: false,
382
- // ── A KNOCKOUT'S LISTING ALREADY HOLDS ITS COUNT ─────────────────────────────────────────────────
383
- //
384
- // The knockout listing asks the count lane's exact question (the same term, classes and territories)
385
- // and `include_total` puts the register's own total on the answer. So a knockout lists first and takes
386
- // the identical and close counts from those totals (driver/register-count.mjs listingAnswers), rather
387
- // than asking each of them twice. A term the listing did not answer is counted as before.
388
- //
389
- // OPTIONAL: a provider that does not declare it counts first and lists second, as before.
390
- listingAnswersCount: true,
391
382
  // Opposition data IS on the record, and in three places: `opposition_window` on every search row,
392
383
  // `proceedings_count` on the full record, and the filters `has_proceedings`,
393
384
  // `opposition_status` and `opposition_closes_before/after`. GET /v1/trademarks/{id}/proceedings
@@ -76,10 +76,11 @@ export const COUNTED_EVENTS = {
76
76
  "post-repair-correction-unrecoverable": FAILED, "post-repair-state-not-kept": FAILED,
77
77
  "digest-flush-timeout": FAILED, "document-coverage-render-failed": FAILED, "doubts-failed": FAILED,
78
78
  "evidence-claim-invariant": { kind: FAILED, when: (e) => e.ok === false || Number(e.violations) > 0 },
79
+ "coverage-row-not-added": FAILED, "verdict-floor-failed": FAILED,
79
80
  "floor-duty-failed": FAILED, "frame-reopen-redigest-failed": FAILED, "goods-evidence-failed": FAILED, "placement-decisions-failed": FAILED, "placement-band-ids-failed": FAILED, "late-evidence-failed": FAILED, "band-refused-records-failed": FAILED, "verdict-write-deferred": FAILED, "ranking-read-by-writer-failed": FAILED, "audit-rebuild-failed": FAILED, "audit-build-failed": FAILED, "write-up-goods-from-failed": FAILED, "declination-goods-states-failed": FAILED, "review-exclusions-write-failed": FAILED, "house-element-ownership-failed": FAILED,
80
81
  "intake-asks-missing": FAILED, "invalid-artifact-strikes": FAILED, "knockout-band-checks-inert": FAILED,
81
82
  "knockout-in-use-as-unanswered": FAILED, "knockout-ladder-unreadable": FAILED, "knockout-method-checks-inert": FAILED,
82
- "knockout-owner-checks-failed": FAILED, "knockout-register-records-failed": FAILED, "knockout-sweep-outage": FAILED,
83
+ "knockout-owner-checks-failed": FAILED, "knockout-register-records-failed": FAILED, "knockout-register-read-failed": FAILED, "knockout-sweep-outage": FAILED,
83
84
  "machine-qc-failed": FAILED, "named-band-invalid": FAILED, "owner-screen-failed": FAILED, "placement-carry-failed": FAILED,
84
85
  "plan-qids-provider-hard-error-deferred": FAILED, "predelivery-lint-failed": FAILED, "probe-over-cap-unreadable": FAILED,
85
86
  "profile-mismatch-probe-failed": FAILED, "recall-reconciliation-failed": FAILED,
@@ -109,8 +110,8 @@ export const COUNTED_EVENTS = {
109
110
  // A workbook that failed to build is recorded only here.
110
111
  "publish-gates": { kind: FAILED, when: (e) => e.auditWorkbook === "failed" },
111
112
  // the plain-English pass rewrote the rater's text, or failed and shipped it unrewritten
112
- "knockout-review": [{ kind: REPAIR, when: (e) => e.outcome === "applied" && Number(e.applied) > 0 },
113
- { kind: FAILED, when: (e) => !["applied", "nothing-flagged"].includes(e.outcome) }],
113
+ "knockout-review": [{ kind: REPAIR, when: (e) => e.outcome === "corrected" || (e.outcome === "applied" && Number(e.applied) > 0) },
114
+ { kind: FAILED, when: (e) => !["applied", "corrected", "nothing-flagged"].includes(e.outcome) }],
114
115
  "commonlaw-reconciliation": { kind: FAILED, when: (e) => e.state !== "at-or-above-floor" },
115
116
  "engine-turn-probe": { kind: FAILED, when: (e) => e.ok === false },
116
117
  // a finding still saying its goods are cut or unread after the delivery repair was given their complete statements
@@ -180,7 +181,7 @@ export const NOT_COUNTED_EVENTS = {
180
181
  "common-law-candidates", "common-law-merged", "common-law-path", "common-law-supp-folded",
181
182
  "commonlaw-channels-added", "connotation-receipts",
182
183
  "corrective-worklist-source", "coverage-form-written", "coverage-judgment", "coverage-judgment-rows",
183
- "coverage-ledger-derived", "coverage-ledger-dropped", "coverage-ledger-rendered", "crowd-context", "crowd-context-skips",
184
+ "coverage-ledger-derived", "coverage-ledger-dropped", "coverage-ledger-rendered", "coverage-rows-pass", "crowd-context", "crowd-context-skips",
184
185
  "customer-late-bind", "customer-late-bind-ack", "depth-ladder", "digest-batch-brief",
185
186
  "digest-coverage-form-brief", "digest-flush", "digest-queue-noop", "digest-queued", "digest-rulings-tail",
186
187
  "doctrine-write", "document-coverage-rendered", "document-growth-trip", "doubt-selection", "doubts", "draft-carry",
@@ -193,7 +194,7 @@ export const NOT_COUNTED_EVENTS = {
193
194
  "jx-aim-consumed", "jx-candidate-fold", "jx-nativeread",
194
195
  "jx-serp-grid", "jx-serp-grid-overflow", "jx-serp-grid-spec", "jx-slices-stated",
195
196
  "knockout-published", "knockout-receipts",
196
- "knockout-register-records",
197
+ "knockout-register-records", "knockout-register-read",
197
198
  // The run's own span against the ten-minute target, written at delivery because that is the first
198
199
  // point at which the run's span is known. Same class as the sweep's line below: a RECORD, never a
199
200
  // failure. `overBar: null` on it means the span could not be measured, which is a gap in the record
@@ -221,7 +222,7 @@ export const NOT_COUNTED_EVENTS = {
221
222
  "scope-facts", "scope-frontmatter", "scope-ledger-derived", "scope-ledger-skipped", "screen-gate-clean", "screen-gate-evidence",
222
223
  "seam-reapplied", "search-policy", "searched-jurisdictions", "senior-rights", "skip",
223
224
  "stage-contract", "stage-limit-derived", "stage-stamps-reconciled", "start", "supplemental-fold", "token-rollup",
224
- "turnaround-reconciliation", "verdict", "verdict-conditions-followed", "verdict-conditions-recorded", "verdict-frontmatter",
225
+ "turnaround-reconciliation", "verdict", "verdict-conditions-followed", "verdict-conditions-recorded", "verdict-floors-pass", "verdict-frontmatter",
225
226
  "verdict-recomputed-steps-withdrawn", "whatif-settled-on-archive", "write-up-forms",
226
227
  ],
227
228
  "a note about the answer's content that changes nothing in the run; the quality read judges it": [
@@ -244,7 +245,7 @@ export const NOT_COUNTED_EVENTS = {
244
245
  "frame-reopen-reattempt", "grid-ledger-missing", "knockout-assess-invalidated", "lint-redo-skipped", "lint-redo-skipped-structural",
245
246
  "meaning-gap-coverage", "park-resumed", "plan-qids-sticky-gap", "recall-reconciliation-unended",
246
247
  "recovery-classified", "record-discard", "report-repair-targets", "screen-gate-unresolved", "skeptic-escalation", "stage-stale",
247
- "stale-repair-entry", "taint-disclose", "unsettled-inputs", "verdict-2", "verdict-3", "verdict-recheck-unread",
248
+ "stale-repair-entry", "taint-disclose", "unsettled-inputs", "verdict-2", "verdict-3", "verdict-recheck-file-save-refused", "verdict-recheck-unread",
248
249
  ],
249
250
  "read from its own record: the stage records, the dispatch records and the tool-call log": [
250
251
  "answer-part", "attempt", "stage", "settled", "started",
@@ -173,7 +173,7 @@ const SCRUB = [
173
173
  // what varies and why, and step 5 prints them — a normalisation nobody can see is a normalisation that
174
174
  // hides the next real difference.
175
175
  const VOLATILE = [
176
- { id: "issued", re: /\d{4}-\d{2}-\d{2} · \d{2}:\d{2} [A-Z]{2,5}/g, sub: "<issued>", why: "publish/index.mjs, the generation stamp in the firm locale" },
176
+ { id: "issued", re: /\d{4}-\d{2}-\d{2} · \d{2}:\d{2} [A-Z]{2,5}/g, sub: "<issued>", why: "publish/index.mjs, the issue stamp in the firm locale" },
177
177
  { id: "iso-timestamp", re: /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z/g, sub: "<ts>", why: "publish/index.mjs:669 asOf" },
178
178
  ];
179
179
 
@@ -634,7 +634,7 @@ if (proofOk) {
634
634
  const rawB = readFileSync(join(poolFrozen, runId, name), "utf8");
635
635
  if (name === "meta.json") {
636
636
  const mA = JSON.parse(rawA), mB = JSON.parse(rawB);
637
- for (const k of ["issuedAt"]) { delete mA[k]; delete mB[k]; }
637
+ for (const k of ["issuedAt", "renderedAt"]) { delete mA[k]; delete mB[k]; }
638
638
  const keys = [...new Set([...Object.keys(mA), ...Object.keys(mB)])];
639
639
  for (const k of keys) {
640
640
  if (JSON.stringify(mA[k]) === JSON.stringify(mB[k])) continue;
@@ -52,10 +52,12 @@ const LONG_RESET = 'npx clearotron@0.3.0-beta.5 passphrase --reset --base $HOME/
52
52
  const BLUR_KEY = 'cordillera-blur-names'
53
53
 
54
54
  // The deployment the board draws: a register and the research key set, the open-web key not, no case-law
55
- // sign-in, the engine on a subscription. The values are inert fixture words and never leave this process:
56
- // the inventory records names and states, never a value.
55
+ // sign-in, Claude chosen as the AI and paid by subscription. An AI is named, not left to the code's default: an
56
+ // install with none chosen draws its Engine row as not set. The values are inert fixture words and never leave
57
+ // this process: the inventory records names and states, never a value.
57
58
  const credsDir = mkdtempSync(join(process.env.TMPDIR || '/tmp', 'settings-creds-'))
58
59
  const deployment = {
60
+ CLEAROTRON_AI: 'anthropic-agent',
59
61
  CLEAROTRON_DATABASE: 'corsearch', CORSEARCH_SESSION_KEY: 'fixture-not-a-key', PERPLEXITY_API_KEY: 'fixture-not-a-key',
60
62
  OAUTH_BRIDGE_CREDS_DIR: credsDir, PATH: process.env.PATH ?? '', HOME: process.env.HOME ?? '',
61
63
  }
@@ -381,7 +383,7 @@ const signInProbe = `(() => {
381
383
  const out = {}
382
384
  const SPEC = {
383
385
  signInName: "Through your organisation's sign-in service",
384
- categories: ['Trademark register', 'Common-law and marketplace research', 'Open-web search', 'Case law and oppositions'],
386
+ categories: ['Trademark register', 'Common-law and marketplace research', 'Chinese marketplace search', 'Case law and oppositions'],
385
387
  caseLawGap: 'Until these are set up, a Full country search still runs and its report discloses the case-law gap instead of reporting no adverse case law.',
386
388
  adminLine: 'To change the address, the permissions or the companies on it, contact your Clearotron administrator.',
387
389
  blurLine: 'On the top bar. It covers every mark and company on screen, and an open report whole. It stays as you left it on this computer.',
@@ -747,7 +747,12 @@ if (process.platform !== "win32") {
747
747
  process.env.PATH = npmShimDir + delimiter + process.env.PATH;
748
748
  }
749
749
  }
750
- const repoBefore = snapshotRepo(REPO_ROOT);
750
+ // A RUN INSIDE A RUN ON THE SAME CHECKOUT DOES NOT JUDGE THAT CHECKOUT. The runner's own tests drive nested runs while the rest of
751
+ // the suite is working, so a nested read over the shared tree counts its neighbours' files as its own, and a neighbour's fixture
752
+ // that lives for a moment turned a green command red, in whichever shard the two files happened to land together. The outermost
753
+ // run still reads the whole run, and a test of this guard runs on its own copy of the tree, which it is alone in watching.
754
+ const WATCHES_CHECKOUT = String(process.env.CT_WATCHED_CHECKOUT ?? "") !== REPO_ROOT;
755
+ const repoBefore = WATCHES_CHECKOUT ? snapshotRepo(REPO_ROOT) : null;
751
756
  // AND THE HOME IT RUNS AS, read at the same moment for the same reason (`repo-writes.mjs` says which
752
757
  // folders and why). HOME as the child inherits it, which is the home every unpinned product command in
753
758
  // the run resolves.
@@ -810,6 +815,7 @@ child = spawn(argv[0], argv.slice(1), {
810
815
  // saying nothing about which filesystem locations count as temporary, and conflating the two is what
811
816
  // made a correctly contained sibling read as somebody's live estate.
812
817
  CT_TEST_MACHINE_TMP: MACHINE_TMP,
818
+ CT_WATCHED_CHECKOUT: REPO_ROOT,
813
819
  TRADEMARK_MCP_AUDIT_LOG: String(process.env.TRADEMARK_MCP_AUDIT_LOG ?? "").trim()
814
820
  || join(root, "mcp-access.jsonl"),
815
821
  // AND THE PORTAL'S AUDIT LOG, for the same reason and by the same rule as the line above it.
@@ -842,7 +848,7 @@ child.on("close", (code, signal) => {
842
848
  // fixture proves nothing and re-raising is the honest answer. The guard below never runs on that path.
843
849
  if (signal) { process.kill(process.pid, signal); return; }
844
850
 
845
- const wrote = repoWrites(repoBefore, snapshotRepo(REPO_ROOT), REPO_ROOT);
851
+ const wrote = WATCHES_CHECKOUT ? repoWrites(repoBefore, snapshotRepo(REPO_ROOT), REPO_ROOT) : [];
846
852
  if (wrote.length) for (const line of explainRepoWrites(wrote)) console.error(line);
847
853
  const wroteHome = repoWrites(homeBefore, snapshotHome(RUN_HOME), RUN_HOME);
848
854
  if (wroteHome.length) for (const line of explainHomeWrites(wroteHome, RUN_HOME)) console.error(line);
@@ -153,9 +153,9 @@ export function keyPurposeLine({ email, brand, reset }) {
153
153
  * in one step, so nobody issues a key by hand (owner, 2026-09-19). A demo keeps its own secret and guest
154
154
  * list in its folder, which is why the folder is named.
155
155
  */
156
- export function demoConnectCommand({ prefix = "", base }) {
156
+ export function demoConnectCommand({ prefix = "", base, where = null }) {
157
157
  const q = (d) => (/\s/.test(d) ? `"${d}"` : d);
158
- return `${prefix}clearotron connect --base ${q(base)}`;
158
+ return `${prefix}clearotron connect --base ${q(base)}${where ? ` --where ${where}` : ""}`;
159
159
  }
160
160
 
161
161
  export function keyIssueCommand({ prefix = "", demo = false, user = null, base = null, defaultBase = null } = {}) {
@@ -177,8 +177,8 @@ export function keyIssueCommand({ prefix = "", demo = false, user = null, base =
177
177
  export function ensureDenylistFile(path, io) {
178
178
  if (io.exists(path)) {
179
179
  // PRESENT IS NOT THE SAME AS READABLE, and only one of the two makes revocation work. A list the
180
- // door cannot open is the exact state `isRevoked` turns into "not revoked" — the same landmine as an
181
- // absent one, wearing a passing existence check. Read it here, where the door is still startable.
180
+ // door cannot open makes `isRevoked` refuse every key, so every assistant stops, behind a passing
181
+ // existence check. Read it here, where the door is still startable.
182
182
  if (io.read) io.read(path);
183
183
  return { path, created: false };
184
184
  }
@@ -316,10 +316,13 @@ export function describeDoorState(door, {
316
316
  return { level: "info",
317
317
  text: "a process holds the client door's port, and nothing here shows it is this install's door." };
318
318
  }
319
+ // WHAT EACH COMMAND DOES, AND NO VERDICT ON THE INSTALL. This said `start` writes both and that an
320
+ // installed machine missing them had not finished installing, which a newcomer read right after setup,
321
+ // before their first start (measured on a fresh install of a beta, 2026-11-04). A foreground `start`
322
+ // writes neither: it runs the door as its own child. Only `--background` places the unit and the setting.
319
323
  return { level: "info",
320
- text: `the client door is not set up here — ${missing}. \`${startCmd}\` writes both. Since the `
321
- + "2026-09-03 ruling an install places them, so on an installed box this means the install did "
322
- + "not finish" };
324
+ text: `the client door is not set up here — ${missing}. \`${startCmd}\` starts it, `
325
+ + `and \`${startCmd} --background\` sets up both.` };
323
326
  }
324
327
  if (door.active === null) {
325
328
  // THE PROBE STILL COUNTS HERE. Not asking systemd is not the same as knowing nothing: if the port
@@ -1094,7 +1097,7 @@ export function clientDoorReachability({ url = null, probe = null } = {}) {
1094
1097
  // a reader to skim the arm that catches a broken one.
1095
1098
  if (!raw) {
1096
1099
  return { state: "unset",
1097
- message: "no client connector address is published, so the Use-your-AI page and a report's Ask-AI "
1100
+ message: "no client connector address is published, so the Connect your AI page and a report's Ask AI "
1098
1101
  + "control will say this deployment is not set up. That is correct for a local install." };
1099
1102
  }
1100
1103
  let parsed;
@@ -68,7 +68,7 @@
68
68
  // from memory would be a button that looks like it works and does not. `connect-clients-are-data`
69
69
  // REFUSES a launch URL that carries no date and no name.
70
70
 
71
- import { KEY_SLOT, STDIO_SERVER_NAME, remoteConnectFor } from "./stdio-connect.mjs";
71
+ import { DEMO_SERVER_NAME, KEY_SLOT, STDIO_SERVER_NAME, remoteConnectFor, routeNaming } from "./stdio-connect.mjs";
72
72
 
73
73
  /** The two places Clearotron can be, relative to the reader's app. The page asks; the terminal flags. */
74
74
  export const ROUTES = Object.freeze(["disk", "public-http"]);
@@ -439,7 +439,7 @@ export function whatItNeeds(client, have = {}, route = client?.lead) {
439
439
  if (!client) return null;
440
440
  const author = client.routes?.[route];
441
441
  if (!author) return null;
442
- const { stdioRoutes = {}, publicAddress = null, keyAddress = null, operator = null, door = null } = have;
442
+ const { stdioRoutes = {}, publicAddress = null, keyAddress = null, operator = null, door = null, nameClaude = null, wsl = false, demo = false } = have;
443
443
 
444
444
  // EACH COPY RESOLVES TO ITS OWN SHAPE, never to another's. Handing a Codex user `claude mcp add` is a
445
445
  // command their machine does not have, delivered with confidence — so a shape this deployment cannot
@@ -449,7 +449,8 @@ export function whatItNeeds(client, have = {}, route = client?.lead) {
449
449
  // so its steps resolve there and never at the host that refuses a key.
450
450
  const resolveAt = (address) => route === "disk"
451
451
  ? (shape) => {
452
- const r = Object.hasOwn(stdioRoutes, shape ?? "") ? stdioRoutes[shape] : null;
452
+ const stated = Object.hasOwn(stdioRoutes, shape ?? "") ? stdioRoutes[shape] : null;
453
+ const r = stated && nameClaude ? routeNaming(stated, nameClaude) : stated;
453
454
  return r ? { kind: "block", text: r.text, stdio: r } : null;
454
455
  }
455
456
  : (shape) => {
@@ -464,7 +465,12 @@ export function whatItNeeds(client, have = {}, route = client?.lead) {
464
465
  // WHAT THE DOOR ANSWERS, handed to every row rather than decided per row: one reading, so two apps
465
466
  // on one page cannot describe one deployment two ways — which is the defect this carries.
466
467
  const asked = author.steps({ operator, door: route === "public-http" ? door : null });
467
- const steps = asked.map((s) => (s.copy ? { ...s, copy: resolve(s.copy) } : { ...s }));
468
+ // THE CHECK LINE RUNS WHERE THE COMMAND DID. Under WSL one hint serves both sides, so it keeps the bare word.
469
+ const hinted = (s) => (route === "disk" && nameClaude && !wsl && s.hint ? { ...s, hint: nameClaude(s.hint) } : s);
470
+ // A DEMO'S CONNECTION HAS ITS OWN NAME (stdio-connect.mjs), so a row's words name that one.
471
+ const spoken = (t) => (typeof t === "string" ? t.replaceAll(STDIO_SERVER_NAME, DEMO_SERVER_NAME) : t);
472
+ const named = (s) => (route === "disk" && demo ? { ...s, text: spoken(s.text), ...(s.hint ? { hint: spoken(s.hint) } : {}) } : s);
473
+ const steps = asked.map((s) => (s.copy ? { ...s, copy: resolve(s.copy) } : { ...s })).map(hinted).map(named);
468
474
  const resolved = steps.every((s, i) => !asked[i].copy || s.copy);
469
475
 
470
476
  // ── WHEN THE DOOR COULD NOT BE READ, BOTH WAYS ARE ACTUALLY SHOWN ────────────────────────────────