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
@@ -1122,7 +1122,7 @@ export const PROVIDERS = {
1122
1122
  const base = process.env.CLARIVATE_API_BASE || DEFAULT_BASE;
1123
1123
  try {
1124
1124
  return await doCountHits(process.env.CLARIVATE_API_KEY, base,
1125
- { name, match_mode: matchMode, nice_classes: classes ?? [], ...(regions?.length ? { regions } : {}) },
1125
+ { ...(Array.isArray(name) ? { names: name } : { name }), match_mode: matchMode, nice_classes: classes ?? [], ...(regions?.length ? { regions } : {}) },
1126
1126
  { kind: "count_hits", agentId, sessionKey, sessionId: null, recordLog });
1127
1127
  } catch (e) { return { ok: false, total: null, reason: `count threw: ${e.message}` }; }
1128
1128
  },
@@ -1862,7 +1862,7 @@ export const SERP_PROVIDERS = {
1862
1862
  credEnv: "SERPAPI_API_KEY",
1863
1863
  // As above — the field pair setup derives its prompt from (: this key was never
1864
1864
  // prompted for, and a reader who finished setup as designed had every marketplace grid cell gap).
1865
- absentMeans: "every marketplace grid cell comes back as a disclosed gap instead of a result",
1865
+ absentMeans: "the Chinese marketplaces come back as a disclosed gap",
1866
1866
  obtain: "https://serpapi.com/manage-api-key — self-serve, free tier exists",
1867
1867
  async search({ engine, term, site, count }) {
1868
1868
  if (!process.env.SERPAPI_API_KEY) return { ok: false, cause: "SERPAPI_API_KEY absent from driver env" };
@@ -2104,11 +2104,11 @@ export const ENGINE_BINARIES = {
2104
2104
  // it moved to 2.1.284: a stage that asks for haiku is asking for the current haiku.
2105
2105
  package: "@anthropic-ai/claude-code", floor: "2.1.293",
2106
2106
  // WHAT THE INSTALL TAKES ON DISK, in MB, which setup states before it asks to install. MEASURED, not
2107
- // declared by the vendor: the engines folder after a fresh install of this package into an empty
2108
- // folder. Re-measured when the floor moved to 2.1.293: 242 MB for a fresh install of 2.1.293 itself,
2109
- // on npm 10.9.9, 2026-10-09. A later release can be larger or smaller, so setup says "about".
2110
- // Re-measure when the floor moves.
2111
- installMB: 242,
2107
+ // declared by the vendor: the engines folder (`du -sm`) after a fresh install into an empty folder with
2108
+ // setup's own command, which fetches the newest release at or above the floor rather than the floor
2109
+ // itself. Measured 2026-11-05 on npm 10.9.9: 323 MB for 2.1.318; 2.1.293 alone is 242. A later release
2110
+ // can be larger or smaller, so setup says "about". Re-measure when the floor moves.
2111
+ installMB: 323,
2112
2112
  // The licence setup states wherever it tells a reader what they are about to install or use, as the
2113
2113
  // vendor's package declares it: "SEE LICENSE IN README.md", Anthropic's own terms.
2114
2114
  licence: "proprietary third-party software",
@@ -2142,13 +2142,13 @@ export const ENGINE_BINARIES = {
2142
2142
  // judgment-tier stage (the tiers are in engine/openai-agent.mjs). The old floor, 0.154.0, was the
2143
2143
  // permissions feature's (engine/mcp/codex-config.mjs).
2144
2144
  package: "@openai/codex", floor: "0.159.0",
2145
- installMB: 424, // re-measured the same way as Claude's, above: a fresh install of 0.159.0 itself, 2026-10-09
2145
+ installMB: 436, // measured the same way as Claude's, above: setup's command fetched 0.166.0, 2026-11-05; 0.159.0 alone is 424
2146
2146
  licence: "third-party software under the Apache-2.0 licence", // the package's own "license" field
2147
2147
  label: "OpenAI — each stage runs as a headless `codex exec` turn",
2148
2148
  module: "engine/openai-agent.mjs", adapter: "openaiAgentEngine",
2149
2149
  signIn: "run `codex login`",
2150
2150
  authEnv: "CLEAROTRON_AI_BILLING", apiKeyEnv: "CODEX_API_KEY",
2151
- subscriptionHow: "sign in once with `codex login` — the adapter reads ~/.codex/auth.json and refuses before spending if it is absent",
2151
+ subscriptionHow: "sign in once with `codex login`",
2152
2152
  // — codex's headless ending writes its own ~/.codex/auth.json; there is no
2153
2153
  // token to capture into an env file, and inventing one would be a route nobody has driven.
2154
2154
  headless: { cmd: "codex login --device-auth", tokenEnv: null },
@@ -1,7 +1,7 @@
1
1
  # Engine contract — the engine seam
2
2
 
3
3
  Two engine adapters are implemented: `anthropic-agent` (`claude -p`) and `openai-agent` (`codex exec`).
4
- `anthropic-agent` is the default; `CLEAROTRON_AI` selects the other.
4
+ `CLEAROTRON_AI` selects one; unset, no engine is chosen and every search is refused.
5
5
 
6
6
  The seam is an explicit **registry**, not a hardcode: `selectEngine()` resolves `CLEAROTRON_AI` against
7
7
  the adapters `registerEngine()` holds, and an unknown value fails loud rather than running the wrong
@@ -818,7 +818,9 @@ export const anthropicAgentEngine = {
818
818
  if (periodStart === null || openAsks.length === 0) return;
819
819
  const k = periodKey() || "?";
820
820
  const spent = Math.max(0, now - periodStart);
821
- if (spent > 0) {
821
+ // A period seen across two chunks is measured even when the clock reads it as 0 ms, as a coarse clock can:
822
+ // its ask is named with what the clock gave. Crediting only a positive wait dropped it, unmeasured and undeclared.
823
+ if (spent > 0 || periodChunk !== chunkSeq) {
822
824
  toolWaitMs += spent;
823
825
  toolWaitByTool[k] = (toolWaitByTool[k] ?? 0) + spent;
824
826
  }
@@ -1170,7 +1172,7 @@ export const anthropicAgentEngine = {
1170
1172
  // A3 overflow is likewise a hard failure (resultEvent is null → already caught here; kept explicit).
1171
1173
  const failed = overflow || killed || !resultEvent || resultEvent.is_error || resultEvent.subtype !== "success";
1172
1174
  // stall → make isTimeout fire (killed) AND carry the stall stderr signature the classifier reads, so the
1173
- // taxonomy is identical; a 0-token stall then classifies as lane_wedge and the chain cascades.
1175
+ // taxonomy is identical; a 0-token stall then classifies as lane_wedge, which stage()'s lane-wedge retry takes.
1174
1176
  // overflow → carry a clear signature (killed stays false so it is a plain nonzero_exit, NOT a timeout/wedge).
1175
1177
  const stderrOut = overflow
1176
1178
  ? (stderr + `\nanthropic-agent output overflow: stdout/stderr exceeded ${maxBuffer} chars — killed the tree and failed the turn (truncated tail never parsed)`)
@@ -24,7 +24,7 @@ import { answerBudget, quotedBytes } from "../../../shared/answer-parts.mjs";
24
24
  import { classifyRecord, prepareTargets, SHAPE_TIERS, isLiveRecord, niceClassKey, withoutPlacementOrders } from "../../band-shape.mjs";
25
25
  import { recordQids } from "../../named-band.mjs";
26
26
  import { normalizeRecordUri } from "../../registry-fidelity.mjs";
27
- import { bandGoodsIndex, goodsFor, goodsWordCounter, goodsWordsMatched, rawGoodsCarried, untaggedIsEnglish, rowGoods } from "../../record-goods.mjs";
27
+ import { bandGoodsIndex, goodsFor, goodsWordCounter, goodsWordsMatched, recordAsServed, untaggedIsEnglish, rowGoods } from "../../record-goods.mjs";
28
28
  import { recordGoodsEvidence, heldRecordProvenance, recordFetchOutcomes, readRunCallRows, goodsFromLabel, registerPageLabel } from "../../goods-evidence.mjs";
29
29
  import { savedStatusPages } from "../../saved-register-pages.mjs";
30
30
  import { DEFAULT_LEDGER_PATH } from "../../provider-usage.mjs";
@@ -462,26 +462,6 @@ function bandLookup(params = {}) {
462
462
  return out;
463
463
  }
464
464
 
465
- // A RECORD'S GOODS ARE SERVED ONCE. A Clarivate record carries the register's raw goods list beside the
466
- // normalised goods the provider maps from it item for item (record-goods.mjs `rawGoodsCarried`), so every goods
467
- // statement was read twice. On a crowded test run, 2026-10-13, one synthesis attempt read 10.79 MB of record
468
- // text in 549 calls; served this way, the same records come to 6.04 MB in 398. Where the normalised goods carry
469
- // the raw list, the record is served without that list, in the file's own layout and field order, and anything
470
- // else in the raw goods block stays; where they do not, or the text is not a record, it is served as it
471
- // stands. The file on disk is never touched, and the reading audit says how much was left out.
472
- function recordAsServed(text) {
473
- let body;
474
- try { body = JSON.parse(text); } catch { return { text, audit: {} }; }
475
- if (!rawGoodsCarried(body)) return { text, audit: {} };
476
- const goods = { ...body._raw.goodsServices };
477
- delete goods.intClassDescriptions;
478
- const raw = { ...body._raw, goodsServices: goods };
479
- if (!Object.keys(goods).length) delete raw.goodsServices;
480
- const indent = /^\{\n( +)"/.exec(text)?.[1]?.length ?? 0;
481
- const served = JSON.stringify({ ...body, _raw: raw }, null, indent) + (text.endsWith("\n") ? "\n" : "");
482
- return { text: served, audit: { raw_goods_left_out: text.length - served.length } };
483
- }
484
-
485
465
  function bandRecord(params = {}) {
486
466
  if (!RUN_DIR) return { isError: true, text: "ERROR: CLEAROTRON_BAND_RUN_DIR not set — band tools are wired per run by the driver." };
487
467
  const uri = String(params.record_id ?? "").trim();
@@ -0,0 +1,26 @@
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
+ // clarivate-propose-tool.mjs — the words and the schema of Clarivate's `register_propose_supplemental`, one copy: the
5
+ // live server serves them, and the fixture server serves them too, so a replay on saved data reads what a run reads.
6
+ import { narrowingFields } from "./proposal-fields.mjs";
7
+
8
+ export const CLARIVATE_PROPOSE_TOOL = Object.freeze({
9
+ description: "PROPOSE judgment-addition register queries; CODE executes them and writes the band (the supplemental lane — you never run register coverage by hand and never author band blocks). Each proposal: {predicate: exact|default|wildcard|phonetic|owner, term OR terms[] (OR-stack, split anything wider than the plan bound), romanization (MANDATORY beside a single non-Latin term — this register indexes non-Latin filings by their transliteration and refuses bare characters), owner? (a mark-text proposal may add an owner SCOPE FIELD — the owner×term intersection slice, the watchlist-coverage move), nice_classes (REQUIRED — an unscoped sweep is rejected), regions?, rationale?, term_literal? (true asserts the term IS a mark verbatim, bypassing the shape lint)}. Terms must be MARK-SHAPED and agree with the predicate: an anchored `*` needs predicate:wildcard, and a label/prose string (>4 words, parentheticals) is rejected — supply the mark terms it stands for. The tool mints each proposal as a qid'd supplemental plan entry (deterministic qid — re-proposing the same query reuses it, never duplicates; re-proposing a bare non-Latin term WITH its romanization enriches the existing entry and re-executes it), executes them through the same deterministic executor as the dictated plan (count-first per-term truth, ceiling, chunking, error stamping), MERGES the results into the band at output_path itself, and returns per-qid results read back from the band: {state, total_hits, count, term_counts?, reason?, records_preview[≤25]}. Iterate freely: propose → read counts → propose narrower. A crowd result (state:incomplete) is a descriptor for judgment — never a clean.",
10
+ inputSchema: { type: "object", required: ["axis", "output_path", "proposals"], properties: {
11
+ axis: { type: "string", description: "The register axis these supplementals belong to (e.g. primary-sweep)" },
12
+ output_path: { type: "string", description: "Absolute path of the named band to merge into (register-units/<axis>-band.json)" },
13
+ proposals: { type: "array", minItems: 1, items: { type: "object", properties: {
14
+ predicate: { type: "string", enum: ["exact", "default", "wildcard", "phonetic", "owner"] },
15
+ term: { type: "string" }, terms: { type: "array", items: { type: "string" } },
16
+ romanization: { type: "string", description: "The Latin-script form of a NON-LATIN term — plain ASCII letters/digits, syllable-separated by single spaces, no tone marks or diacritics (华威豹 → \"HUA WEI BAO\", ワボスラッシュ → \"WABO SURASSHU\"). MANDATORY beside a non-Latin term: without it this register cannot answer the characters and the slice defers. Single-term proposals only (never an OR-stack, never predicate:owner), and never on a term that is already Latin." },
17
+ owner: { type: "string", description: "OPTIONAL owner scope field on a MARK-TEXT proposal: the query is the owner×term intersection (the owner's filings within the term band). Not allowed on predicate:owner (there the owner name IS the term)." },
18
+ nice_classes: { type: "array", items: {} },
19
+ // The narrowing fields every register serves (proposal-fields.mjs); this register's two facts ride in.
20
+ ...narrowingFields({ regions: "OPTIONAL. Omit to inherit the frozen plan's regions (the matter's territorial scope) — this provider REQUIRES at least one office on every request, so an omitted list is backfilled from the plan, never treated as a worldwide sweep. Supply it only to search a NARROWER set than the matter's scope.",
21
+ goodsNote: "One office in this provider's vocabulary refuses the field and fails the whole call, so it is left out of that office's request and recorded as asked-without-goods rather than dropped in silence." }),
22
+ rationale: { type: "string" },
23
+ term_literal: { type: "boolean", description: "TRUE only when the term genuinely IS the mark verbatim (a multi-word slogan mark, a mark carrying an anchored star) — it bypasses the term-shape lint. Never use it to push a label through." },
24
+ } } },
25
+ } },
26
+ });
@@ -35,7 +35,7 @@ import {
35
35
  CAPABILITIES, doSearch, doRecordFetch, doImageFetch, doBatchScreen, doEnumerate, doExecutePlan, DEFAULT_BASE,
36
36
  } from "../../../providers/clarivate/src/core.js";
37
37
  import { proposeSupplemental } from "./supplemental.mjs";
38
- import { narrowingFields } from "./proposal-fields.mjs";
38
+ import { CLARIVATE_PROPOSE_TOOL } from "./clarivate-propose-tool.mjs";
39
39
 
40
40
  const API_KEY = process.env.CLARIVATE_API_KEY || "";
41
41
  const BASE = process.env.CLARIVATE_API_BASE || DEFAULT_BASE;
@@ -131,23 +131,7 @@ serve({
131
131
  },
132
132
  {
133
133
  name: "register_propose_supplemental",
134
- description: "PROPOSE judgment-addition register queries; CODE executes them and writes the band (the supplemental lane — you never run register coverage by hand and never author band blocks). Each proposal: {predicate: exact|default|wildcard|phonetic|owner, term OR terms[] (OR-stack, split anything wider than the plan bound), romanization (MANDATORY beside a single non-Latin term — this register indexes non-Latin filings by their transliteration and refuses bare characters), owner? (a mark-text proposal may add an owner SCOPE FIELD — the owner×term intersection slice, the watchlist-coverage move), nice_classes (REQUIRED — an unscoped sweep is rejected), regions?, rationale?, term_literal? (true asserts the term IS a mark verbatim, bypassing the shape lint)}. Terms must be MARK-SHAPED and agree with the predicate: an anchored `*` needs predicate:wildcard, and a label/prose string (>4 words, parentheticals) is rejected — supply the mark terms it stands for. The tool mints each proposal as a qid'd supplemental plan entry (deterministic qid — re-proposing the same query reuses it, never duplicates; re-proposing a bare non-Latin term WITH its romanization enriches the existing entry and re-executes it), executes them through the same deterministic executor as the dictated plan (count-first per-term truth, ceiling, chunking, error stamping), MERGES the results into the band at output_path itself, and returns per-qid results read back from the band: {state, total_hits, count, term_counts?, reason?, records_preview[≤25]}. Iterate freely: propose → read counts → propose narrower. A crowd result (state:incomplete) is a descriptor for judgment — never a clean.",
135
- inputSchema: { type: "object", required: ["axis", "output_path", "proposals"], properties: {
136
- axis: { type: "string", description: "The register axis these supplementals belong to (e.g. primary-sweep)" },
137
- output_path: { type: "string", description: "Absolute path of the named band to merge into (register-units/<axis>-band.json)" },
138
- proposals: { type: "array", minItems: 1, items: { type: "object", properties: {
139
- predicate: { type: "string", enum: ["exact", "default", "wildcard", "phonetic", "owner"] },
140
- term: { type: "string" }, terms: { type: "array", items: { type: "string" } },
141
- romanization: { type: "string", description: "The Latin-script form of a NON-LATIN term — plain ASCII letters/digits, syllable-separated by single spaces, no tone marks or diacritics (华威豹 → \"HUA WEI BAO\", ワボスラッシュ → \"WABO SURASSHU\"). MANDATORY beside a non-Latin term: without it this register cannot answer the characters and the slice defers. Single-term proposals only (never an OR-stack, never predicate:owner), and never on a term that is already Latin." },
142
- owner: { type: "string", description: "OPTIONAL owner scope field on a MARK-TEXT proposal: the query is the owner×term intersection (the owner's filings within the term band). Not allowed on predicate:owner (there the owner name IS the term)." },
143
- nice_classes: { type: "array", items: {} },
144
- // The narrowing fields every register serves (proposal-fields.mjs); this register's two facts ride in.
145
- ...narrowingFields({ regions: "OPTIONAL. Omit to inherit the frozen plan's regions (the matter's territorial scope) — this provider REQUIRES at least one office on every request, so an omitted list is backfilled from the plan, never treated as a worldwide sweep. Supply it only to search a NARROWER set than the matter's scope.",
146
- goodsNote: "One office in this provider's vocabulary refuses the field and fails the whole call, so it is left out of that office's request and recorded as asked-without-goods rather than dropped in silence." }),
147
- rationale: { type: "string" },
148
- term_literal: { type: "boolean", description: "TRUE only when the term genuinely IS the mark verbatim (a multi-word slogan mark, a mark carrying an anchored star) — it bypasses the term-shape lint. Never use it to push a label through." },
149
- } } },
150
- } },
134
+ ...CLARIVATE_PROPOSE_TOOL,
151
135
  // ARITY: proposeSupplemental calls executePlan(auth, params, tctx) — THREE args, because corsearch's
152
136
  // doExecutePlan is (sessionKey, params, tctx). Clarivate's is (apiKey, base, params, tctx), so the
153
137
  // injected executor MUST close over BASE here. Passing doExecutePlan bare would shift base←params
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env node
2
+ // SPDX-License-Identifier: AGPL-3.0-only
3
+ // Copyright 2026 Cordillera Sàrl. Additional terms under section 7 of the AGPL-3.0 apply — see ADDITIONAL-TERMS.md
4
+ // fixture-register-server.mjs — the register tool a fixture run's reading step holds. Same tool, same words, same mint
5
+ // and same band as a live run, answered from the job's fixture directory. It reaches no register: a question the
6
+ // directory holds no answer for comes back as a failure, never as a zero. Mounted by gather-config when the run says so.
7
+ import { serve } from "./stdio-server.mjs";
8
+ import { proposeSupplemental } from "./supplemental.mjs";
9
+ import { CLARIVATE_PROPOSE_TOOL } from "./clarivate-propose-tool.mjs";
10
+ import { crowdNoteFor } from "./crowd-note.mjs"; // how the unit decides on a crowd, as a live register's server says it
11
+ import { capabilitiesFor } from "../../register-capabilities.mjs";
12
+ import { fixtureRecordsDir } from "../../register-fixture-marker.mjs";
13
+ import { fixtureLister } from "../../register-records.mjs";
14
+ import { executeQuestionsWithLister } from "../../knockout-register-read.mjs";
15
+
16
+ const runDir = process.env.CLEAROTRON_BAND_RUN_DIR || "";
17
+ serve({
18
+ name: "register", noteFor: crowdNoteFor,
19
+ tools: [{
20
+ name: "register_propose_supplemental",
21
+ ...CLARIVATE_PROPOSE_TOOL,
22
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
23
+ handler: (a) => {
24
+ const dir = fixtureRecordsDir(runDir);
25
+ if (!dir) return { type: "text", text: "ERROR: this run declares no fixture directory, and this server reaches no register." };
26
+ const lister = fixtureLister(dir);
27
+ return proposeSupplemental(a, { kind: "propose_supplemental", recordLog: process.env.CLEAROTRON_REGISTER_RECORD_LOG || null }, {
28
+ executePlan: (params) => executeQuestionsWithLister(lister, params),
29
+ capabilities: capabilitiesFor(process.env.CLEAROTRON_DATABASE),
30
+ });
31
+ },
32
+ }],
33
+ });
@@ -10,6 +10,7 @@
10
10
  import { fileURLToPath } from "node:url";
11
11
  import { dirname, join } from "node:path";
12
12
  import { requireRegisterProvider } from "../../driver.config.mjs";
13
+ import { fixtureRecordsDir } from "../../register-fixture-marker.mjs";
13
14
  import { ledgerPath, runRecordLogPath } from "../../../providers/_shared/ledger-path.mjs";
14
15
  import { CORRECTION_POSITIONS_ENV } from "./correction-positions.mjs"; // the positions a correction hands its save
15
16
 
@@ -548,7 +549,7 @@ const RECORDING = Object.freeze({
548
549
  "knockout-assess": {
549
550
  seatWrites: false,
550
551
  perChunk: true,
551
- tools: Object.freeze(["record_knockout_assess"]),
552
+ tools: Object.freeze(["record_knockout_assess", "read_register_list"]),
552
553
  reason: "hands back the per-chunk rated assessment as VALUES through record_knockout_assess instead "
553
554
  + "of writing knockout-assess-<n>.json itself, so the band, the class arrays and the typed read "
554
555
  + "(basis / factors / counterFactors / mitigation) are accepted or refused BY PATH at the call "
@@ -558,15 +559,31 @@ const RECORDING = Object.freeze({
558
559
  + "CALLS, UNMEASURED PRE-CONVERSION — this lane's seats hold no tools today, so the first "
559
560
  + "converted run is where the count comes from",
560
561
  },
562
+ // THE KNOCKOUT'S READING STEP. It holds the register's propose tool beside this key (`toolGroupsForStage` below),
563
+ // reads what its questions returned through `read_register_list`, a read of this run's own bands and held records that
564
+ // dials nothing, and hands its judgment back as VALUES. The questions themselves are the register tool's to record, so
565
+ // this key carries no retrieval.
566
+ "knockout-register-read": {
567
+ seatWrites: false,
568
+ keepsRetrieval: true,
569
+ tools: Object.freeze(["record_knockout_register_read", "read_register_list"]),
570
+ reason: "hands back the filings it carries forward, what it set aside and why, and what it chose not to ask as "
571
+ + "VALUES through record_knockout_register_read, so the driver joins each record id to the band at the call and "
572
+ + "refuses a record that leaves a read list, a crowd or a count unaccounted for. Born typed: there was no earlier "
573
+ + "form of this stage. EXPECTED FROM THE DICTATION'S ORDERED CALLS, UNMEASURED: the first replay on saved data is "
574
+ + "where the count comes from",
575
+ },
561
576
  // THE LANE'S THIRD CONVERSION, and the only stage on it that was born typed — there is no
562
577
  // pre-conversion knockout-review that wrote its own file, so nothing here is a migration.
563
578
  //
564
- // NOT FANNED. The pass reads the WHOLE merged record in one turn, because the rule it applies is about
579
+ // NOT FANNED BY NAME. The pass reads the WHOLE merged record in one turn, because the rule it applies is about
565
580
  // consistency across the lines a reader meets: two marks' basis lines rewritten in separate turns drift
566
- // apart in register, which is the defect the pass exists to remove.
581
+ // apart in register, which is the defect the pass exists to remove. The suffix says WHICH PASS: `#1` is the
582
+ // fresh read of a corrected record, under its own artifact.
567
583
  "knockout-review": {
568
584
  seatWrites: false,
569
- tools: Object.freeze(["record_knockout_review"]),
585
+ perChunk: true,
586
+ tools: Object.freeze(["record_knockout_review", "read_register_list"]),
570
587
  reason: "hands back rewrites as VALUES, each naming the line it replaces by the typed address the "
571
588
  + "driver measured and handed over. The address is what makes this a transport rather than a "
572
589
  + "matching problem: prose quoted back has to be found again in the record, and the finder then "
@@ -575,6 +592,15 @@ const RECORDING = Object.freeze({
575
592
  + "DICTATION'S ORDERED CALLS, UNMEASURED PRE-CONVERSION — this lane's seats hold no tools today, "
576
593
  + "so the first converted run is where the count comes from",
577
594
  },
595
+ // A MATERIAL DEFECT'S REPAIR, per chunk, dispatched only when the check raised one.
596
+ "knockout-correct": {
597
+ seatWrites: false,
598
+ perChunk: true,
599
+ tools: Object.freeze(["record_knockout_correction", "read_register_list"]),
600
+ reason: "hands back only what a defect's repair changes, as VALUES merged onto the chunk as rated, so a name or a "
601
+ + "finding no defect names cannot move and the corrected chunk passes the rated chunk's gates at the call. Born "
602
+ + "typed. EXPECTED FROM THE DICTATION'S ORDERED CALLS, UNMEASURED: the first saved-data run is where the count comes from",
603
+ },
578
604
  });
579
605
 
580
606
  // stage → its server key. DERIVED, and the alphabet is checked rather than assumed: an underscore in a
@@ -810,6 +836,9 @@ function resolveGroup(group) {
810
836
  // aggregate EUIPO, so the second call buys nothing and costs wall time. EUIPO reaches a run only as
811
837
  // the ACTIVE register — or as a member of the `free-tier` composite above.
812
838
  case "register": return { local: ["register"], bridges: [], extra: [] };
839
+ // THE REGISTER'S PROPOSE TOOL ALONE, for a stage whose every question must be minted, receipted and joined to its
840
+ // name. The same server under the same key; only the grant is narrower, and it reads the same on both engines.
841
+ case "register-questions": return { local: ["register"], bridges: [], extra: [], only: ["register_propose_supplemental"] };
813
842
  case "band": return { local: ["band"], bridges: [], extra: [] };
814
843
  // COVERAGE. `bridges: []` is load-bearing exactly as on the recording group below: this group's
815
844
  // one promise is that it widens no retrieval surface — it carries the digest's record tool and
@@ -951,6 +980,8 @@ export function buildGatherMcpConfig(groups = [], { sessionKey, agent, runDir, r
951
980
  }
952
981
  const env = serverEnv({ sessionKey, agent, runDir, recordAxis, bandGroups, correctionPositions });
953
982
  for (const k of localKeys) mcpServers[k] = { command: NODE, args: [join(MCP_DIR, localEntry(k).script)], env };
983
+ // A FIXTURE RUN NEVER REACHES A LIVE REGISTER, and its job says so: the same key serves its canned answers.
984
+ if (localKeys.has("register") && runDir && fixtureRecordsDir(runDir)) mcpServers.register.args = [join(MCP_DIR, "fixture-register-server.mjs")];
954
985
  // — THE BRIDGES GET THE AUDIT ENV, AND ONLY THAT. Until now they were spawned with no env at
955
986
  // all, so a case-law tool call had nowhere to log: `tool-calls.jsonl` recorded server/tool/ok and the
956
987
  // bridge could not write what was asked or what came back. That is why a cited authority and an
@@ -987,6 +1018,9 @@ export function toolGroupsForStage(name = "") {
987
1018
  // the seat's, and the two are separate artifacts with separate writers. An allowlist growing by one
988
1019
  // token on an already-tooled stage, so no argv-surface transition fires.
989
1020
  if (name.startsWith("register-unit")) return ["register", "unit-note"];
1021
+ // THE KNOCKOUT'S READING STEP asks the register what the clearance's reading turn asks it, through the same tool, and
1022
+ // hands its judgment back on its own key. RETRIEVAL AND RECORDING, composed as the other two such branches compose it.
1023
+ if (name === "knockout-register-read") return ["register-questions", recordingKey("knockout-register-read")];
990
1024
  // PR-8 (reading layer): the band-consuming judgment stages hold the READ-ONLY band tools — the shape,
991
1025
  // record lookups over the frozen band, and the run's fetched official records (band_record finally
992
1026
  // feeds _records/ to judgment) — every call logged to the reading audit.
@@ -1306,7 +1340,7 @@ export const RECORDING_TOOLS = Object.freeze({
1306
1340
  //
1307
1341
  // No search tool: this stage's reads are enumerable — its skill doc, the deck, the firm-wide spine, the
1308
1342
  // plan, and the per-mark payloads the dispatch names by path. `Read` serves all of them.
1309
- "knockout-assess": Object.freeze(["Read", "mcp__recording-knockout-assess__record_knockout_assess"]),
1343
+ "knockout-assess": Object.freeze(["Read", "mcp__recording-knockout-assess__read_register_list", "mcp__recording-knockout-assess__record_knockout_assess"]),
1310
1344
  // THE LANE'S SECOND AND LAST CONVERSION. BY HAND, like every row here — O1 asserts the resolved grant
1311
1345
  // EQUALS this row, so a derived row would compare a value with itself.
1312
1346
  //
@@ -1315,6 +1349,12 @@ export const RECORDING_TOOLS = Object.freeze({
1315
1349
  // retrieval grant here would contradict its own dispatch. Its reads are the instructed-scope sidecar
1316
1350
  // and its skill doc, which the seeded Read grant serves.
1317
1351
  "knockout-frame": Object.freeze(["Read", "mcp__recording-knockout-frame__record_knockout_frame"]),
1352
+ // THE READING STEP. BY HAND, like every row here. `Read`, its record tool, its read of the run's own lists, and the
1353
+ // register's propose tool alone, so every question it asks is minted, receipted and joined to its name.
1354
+ "knockout-register-read": Object.freeze(["Read",
1355
+ "mcp__recording-knockout-register-read__read_register_list",
1356
+ "mcp__recording-knockout-register-read__record_knockout_register_read",
1357
+ "mcp__register__register_propose_supplemental"]),
1318
1358
  // THE LANE'S THIRD AND LAST CONVERSION. BY HAND, like every row here — O1 asserts the resolved grant
1319
1359
  // EQUALS this row, so a derived row would compare a value with itself.
1320
1360
  //
@@ -1322,7 +1362,8 @@ export const RECORDING_TOOLS = Object.freeze({
1322
1362
  // and no register tools — the pass reads lines and rewrites them, and a retrieval grant would invite a
1323
1363
  // rewrite that adds a fact the rating never weighed. Its one read is the merged record the dispatch
1324
1364
  // names by path, which the seeded Read grant serves.
1325
- "knockout-review": Object.freeze(["Read", "mcp__recording-knockout-review__record_knockout_review"]),
1365
+ "knockout-review": Object.freeze(["Read", "mcp__recording-knockout-review__read_register_list", "mcp__recording-knockout-review__record_knockout_review"]),
1366
+ "knockout-correct": Object.freeze(["Read", "mcp__recording-knockout-correct__read_register_list", "mcp__recording-knockout-correct__record_knockout_correction"]),
1326
1367
  // THE WRITER. BY HAND, like every row here — O1 asserts the resolved grant EQUALS this row, so a
1327
1368
  // derived row would compare a value with itself. This stage keeps three retrieval groups, and O1
1328
1369
  // compares the WHOLE grant, so they are listed: a row naming only the recording half would be a row
@@ -1494,7 +1535,7 @@ export function allowedToolsFor(groups = []) {
1494
1535
  const tools = seatWritesForGroups(groups) ? new Set(["Read", "Write", "Edit"]) : new Set(["Read"]);
1495
1536
  for (const g of groups) {
1496
1537
  const r = resolveGroup(g);
1497
- for (const k of r.local) localEntry(k).tools.forEach((t) => tools.add(`mcp__${k}__${t}`));
1538
+ for (const k of r.local) (r.only ?? localEntry(k).tools).forEach((t) => tools.add(`mcp__${k}__${t}`));
1498
1539
  for (const k of r.bridges) tools.add(`mcp__${k}__*`); // whole bridge server (its tools are namespaced)
1499
1540
  r.extra.forEach((t) => tools.add(t));
1500
1541
  }