clearotron 0.5.1 → 0.6.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (390) hide show
  1. package/.env.example +7 -7
  2. package/INSTALL.md +10 -10
  3. package/QUICKSTART.md +6 -6
  4. package/README.md +2 -2
  5. package/THIRD-PARTY-NOTICES.md +4 -4
  6. package/bin/README.md +2 -2
  7. package/bin/clearotron.mjs +1 -1
  8. package/bin/connect.mjs +1 -1
  9. package/bin/disconnect.mjs +1 -1
  10. package/bin/example.mjs +2 -2
  11. package/bin/grant.mjs +1 -1
  12. package/bin/onboard.mjs +78 -23
  13. package/bin/start.mjs +88 -33
  14. package/bin/update.mjs +13 -3
  15. package/build-info.json +2 -2
  16. package/docs/DELIVERY.md +1 -1
  17. package/docs/PORTAL.md +1 -1
  18. package/docs/RELEASES.md +1 -1
  19. package/docs/architecture/02-architecture.md +10 -2
  20. package/docs/architecture/03-run-lifecycle.md +6 -2
  21. package/docs/architecture/04-configuration-reference.md +3 -3
  22. package/docs/architecture/05-config-governance.md +5 -4
  23. package/docs/architecture/08-development-guide.md +4 -4
  24. package/docs/architecture/09-security-and-data.md +1 -1
  25. package/{driver/skills/clearance-search/SKILL.md → docs/architecture/retired-manuals/clearance-search-spine.md} +17 -30
  26. package/{driver/skills/clearance-search/templates/email/generic.md → docs/architecture/retired-manuals/email-generic.md} +1 -1
  27. package/{driver/skills/clearance-search → docs/architecture/retired-manuals}/template-formatting.md +3 -4
  28. package/docs/configuration.md +1 -1
  29. package/docs/decisions/0002-no-dark-functionality.md +5 -0
  30. package/driver/CHANGELOG.md +69 -0
  31. package/driver/README.md +11 -1
  32. package/driver/accepted-order.mjs +13 -5
  33. package/driver/attempt-rows.mjs +64 -0
  34. package/driver/attributed-span.mjs +1 -1
  35. package/driver/authority-trees.mjs +1 -1
  36. package/driver/band-shape.mjs +21 -3
  37. package/driver/best-draft.mjs +3 -3
  38. package/driver/blind-frame-record.mjs +2 -2
  39. package/driver/cancel.mjs +3 -2
  40. package/driver/carry-through.mjs +2 -2
  41. package/driver/citation-census.json +3 -3
  42. package/driver/clearance-variants-record.mjs +4 -10
  43. package/driver/common-law-coverage-status.mjs +3 -3
  44. package/driver/common-law-receipts.mjs +2 -2
  45. package/driver/commonlaw-carry-floor.json +3 -3
  46. package/driver/compare.mjs +1 -1
  47. package/driver/config-inventory.mjs +6 -79
  48. package/driver/consumption-ledger.mjs +2 -1
  49. package/driver/contract-arm2-baseline.json +2 -3
  50. package/driver/contract-dictation-registry.mjs +5 -0
  51. package/driver/contract-e3-backlog.mjs +45 -66
  52. package/driver/contract-e3-baseline.json +16 -16
  53. package/driver/contract-vocabulary.mjs +8 -6
  54. package/driver/corrections-feedforward.mjs +3 -1
  55. package/driver/coverage-form-io.mjs +7 -8
  56. package/driver/coverage-tool.mjs +1 -1
  57. package/driver/declination-tool.mjs +2 -2
  58. package/driver/degraded-parts.mjs +9 -9
  59. package/driver/demo-container.mjs +5 -4
  60. package/driver/demo-posture.mjs +17 -0
  61. package/driver/deploy-live-run-guard.mjs +19 -7
  62. package/driver/derived-state.mjs +2 -2
  63. package/driver/dev-portal.mjs +2 -1
  64. package/driver/dispatch-record.mjs +1 -1
  65. package/driver/disposition-tool.mjs +2 -1
  66. package/driver/doubt-closure-tool.mjs +2 -2
  67. package/driver/driver.config.mjs +35 -724
  68. package/driver/e2e-rounds.mjs +3 -4
  69. package/driver/engine/CONTRACT.md +3 -0
  70. package/driver/engine/README.md +2 -0
  71. package/driver/engine/anthropic-agent.mjs +13 -42
  72. package/driver/engine/auth.mjs +74 -0
  73. package/driver/engine/child-record.mjs +1 -1
  74. package/driver/engine/deny-authority-write.mjs +2 -2
  75. package/driver/engine/jx-turn.mjs +10 -2
  76. package/driver/engine/mcp/README.md +1 -1
  77. package/driver/engine/mcp/band-server.mjs +20 -13
  78. package/driver/engine/mcp/codex-config.mjs +1 -1
  79. package/driver/engine/mcp/declination-server.mjs +2 -3
  80. package/driver/engine/mcp/dispositions-server.mjs +3 -3
  81. package/driver/engine/mcp/gather-config.mjs +24 -19
  82. package/driver/engine/mcp/grid-provenance.mjs +1 -1
  83. package/driver/engine/mcp/held-answers.mjs +5 -5
  84. package/driver/engine/mcp/perplexity-server.mjs +16 -7
  85. package/driver/engine/mcp/recording-server.mjs +7 -6
  86. package/driver/engine/mcp/register-server.mjs +29 -0
  87. package/driver/engine/mcp/stdio-server.mjs +5 -5
  88. package/driver/engine/mcp/supplemental.mjs +9 -9
  89. package/driver/engine/openai-agent.mjs +5 -2
  90. package/driver/engine/registry.mjs +103 -0
  91. package/driver/engine/run-choices.mjs +162 -0
  92. package/driver/engine/stamps.mjs +35 -0
  93. package/driver/enqueue-schema.mjs +4 -4
  94. package/driver/envelope-settle.mjs +3 -2
  95. package/driver/feedback-issues.mjs +1 -1
  96. package/driver/feedback-mint.mjs +3 -2
  97. package/driver/feedback-store.mjs +3 -2
  98. package/driver/findings-model.mjs +1 -1
  99. package/driver/flag-snapshot.mjs +5 -4
  100. package/driver/floor-duty.mjs +3 -3
  101. package/driver/foreign-record-links.mjs +1 -1
  102. package/driver/frame-diff-record.mjs +2 -8
  103. package/driver/framework.mjs +1 -1
  104. package/driver/gate-metrics.mjs +10 -11
  105. package/driver/gateway.mjs +220 -839
  106. package/driver/goods-evidence.mjs +26 -14
  107. package/driver/jx-lanes.mjs +3 -3
  108. package/driver/jx-units.mjs +31 -37
  109. package/driver/jx.mjs +44 -59
  110. package/driver/knockout-assess-record.mjs +3 -3
  111. package/driver/knockout-caveats.mjs +21 -0
  112. package/driver/knockout-correction-record.mjs +58 -28
  113. package/driver/knockout-frame-record.mjs +2 -2
  114. package/driver/knockout-register-read.mjs +38 -21
  115. package/driver/knockout-register-record.mjs +5 -6
  116. package/driver/knockout-review-record.mjs +12 -11
  117. package/driver/ladder/model-gauge.mjs +88 -0
  118. package/driver/ladder/next-rung.mjs +296 -0
  119. package/driver/ladder/rescue.mjs +146 -0
  120. package/driver/ladder/stage-tools.mjs +57 -0
  121. package/driver/ladder/turn-failure.mjs +166 -0
  122. package/driver/log.mjs +2 -2
  123. package/driver/matter-frame-record.mjs +4 -4
  124. package/driver/methodology-witness.mjs +2 -2
  125. package/driver/named-band.mjs +60 -3
  126. package/driver/narrative-refutation-record.mjs +145 -42
  127. package/driver/one-build-per-run.mjs +62 -0
  128. package/driver/outbox-backoff.mjs +4 -4
  129. package/driver/owner-screen.mjs +0 -10
  130. package/driver/owner-use-check.mjs +2 -28
  131. package/driver/package.json +1 -1
  132. package/driver/partial-payload-baseline.json +1 -1
  133. package/driver/parts-not-completed.mjs +1 -1
  134. package/driver/pipeline-knockout.mjs +1015 -1001
  135. package/driver/pipeline.mjs +714 -9351
  136. package/driver/placement-decisions.mjs +2 -2
  137. package/driver/placement-form-io.mjs +7 -9
  138. package/driver/placement-union.mjs +0 -6
  139. package/driver/plan-stability.mjs +7 -10
  140. package/driver/portal-acks.mjs +3 -2
  141. package/driver/portal-confirmation.mjs +48 -0
  142. package/driver/portal-families.mjs +3 -2
  143. package/driver/portal-local-auth.mjs +1 -2
  144. package/driver/portal-routes/README.md +24 -0
  145. package/driver/portal-routes/admin.mjs +425 -0
  146. package/driver/portal-routes/compose.mjs +66 -0
  147. package/driver/portal-routes/config.mjs +118 -0
  148. package/driver/portal-routes/connect.mjs +283 -0
  149. package/driver/portal-routes/feedback.mjs +178 -0
  150. package/driver/portal-routes/me.mjs +165 -0
  151. package/driver/portal-routes/queue.mjs +64 -0
  152. package/driver/portal-routes/report.mjs +106 -0
  153. package/driver/portal-routes/run.mjs +508 -0
  154. package/driver/portal-routes/runs.mjs +127 -0
  155. package/driver/portal-routes/usage.mjs +82 -0
  156. package/driver/portal-runs.mjs +588 -0
  157. package/driver/portal-service.mjs +82 -2593
  158. package/driver/portal-static.mjs +3 -1
  159. package/driver/predelivery-lint.mjs +101 -9
  160. package/driver/production-pool-guard.mjs +1 -1
  161. package/driver/profiles.mjs +5 -4
  162. package/driver/progress.mjs +29 -24
  163. package/driver/publish/README.md +10 -5
  164. package/driver/publish/archive-tags.mjs +3 -2
  165. package/driver/publish/demo-marking.mjs +2 -2
  166. package/driver/publish/index.mjs +215 -140
  167. package/driver/publish/knockout.mjs +153 -107
  168. package/driver/publish/office-record-links.mjs +22 -0
  169. package/driver/publish/parse.mjs +20 -5
  170. package/driver/publish/pool-admin.mjs +9 -3
  171. package/driver/publish/render.mjs +11 -3
  172. package/driver/publish/report-dates.mjs +3 -4
  173. package/driver/publish/report-registry.mjs +7 -10
  174. package/driver/publish/seed-pool.mjs +3 -2
  175. package/driver/publish/shell.mjs +106 -0
  176. package/driver/publish/templates/report.css +9 -7
  177. package/driver/queue-order.mjs +4 -3
  178. package/driver/record-carry.mjs +0 -9
  179. package/driver/record-discard.mjs +1 -4
  180. package/driver/record-fold.mjs +3 -3
  181. package/driver/record-goods.mjs +79 -23
  182. package/driver/reference-score.mjs +2 -3
  183. package/driver/register-capabilities.mjs +0 -6
  184. package/driver/register-count.mjs +3 -2
  185. package/driver/register-digest-record.mjs +7 -7
  186. package/driver/register-fixture-marker.mjs +3 -3
  187. package/driver/register-plan.mjs +2 -2
  188. package/driver/register-records.mjs +2 -2
  189. package/driver/register-taint.mjs +3 -3
  190. package/driver/register-unit-record.mjs +48 -9
  191. package/driver/register-unreachable.mjs +4 -3
  192. package/driver/registry-fidelity.mjs +79 -34
  193. package/driver/repair-composers.mjs +14 -9
  194. package/driver/repair-digest.mjs +4 -6
  195. package/driver/repair-scope.mjs +3 -3
  196. package/driver/repair-targets.mjs +24 -9
  197. package/driver/repairs.mjs +44 -58
  198. package/driver/replay-archive.mjs +7 -7
  199. package/driver/report-card-record.mjs +3 -3
  200. package/driver/report-overview-record.mjs +4 -4
  201. package/driver/research-answers.mjs +38 -6
  202. package/driver/research-checks.mjs +4 -4
  203. package/driver/result-noun-fields.mjs +28 -11
  204. package/driver/review-addresses.mjs +163 -0
  205. package/driver/rule-shape.mjs +1 -1
  206. package/driver/run-delivered.mjs +340 -0
  207. package/driver/run-economics.mjs +8 -26
  208. package/driver/run-failed.mjs +545 -0
  209. package/driver/run-integrity.mjs +1 -1
  210. package/driver/run-outcome.mjs +314 -0
  211. package/driver/run-park.mjs +23 -0
  212. package/driver/run-quote.mjs +32 -0
  213. package/driver/run-record.mjs +352 -0
  214. package/driver/run-requirements.mjs +22 -0
  215. package/driver/run-shell.mjs +55 -0
  216. package/driver/runner.mjs +71 -33
  217. package/driver/saved-register-pages.mjs +4 -4
  218. package/driver/score-redaction.mjs +2 -2
  219. package/driver/search-policy.mjs +12 -13
  220. package/driver/settle-stamp.mjs +4 -3
  221. package/driver/skeptic-record.mjs +2 -2
  222. package/driver/skeptic-search.mjs +1 -1
  223. package/driver/skills/README.md +7 -7
  224. package/driver/skills/blind-frame/SKILL.md +1 -2
  225. package/driver/skills/case-law-citation/SKILL.md +9 -37
  226. package/driver/skills/case-law-citation/sources/courtlistener.md +1 -3
  227. package/driver/skills/case-law-citation/sources/eurlex.md +8 -11
  228. package/driver/skills/case-law-citation/sources/legaldatahunter.md +1 -1
  229. package/driver/skills/clearance-common-law/SKILL.md +45 -111
  230. package/driver/skills/clearance-common-law/perplexity-prompts.md +7 -79
  231. package/driver/skills/clearance-register/SKILL.md +15 -33
  232. package/driver/skills/clearance-register/digest.md +35 -96
  233. package/driver/skills/clearance-register/providers/clarivate.md +2 -2
  234. package/driver/skills/clearance-register/providers/corsearch.md +5 -5
  235. package/driver/skills/clearance-register/providers/euipo.md +1 -2
  236. package/driver/skills/clearance-register/providers/free-tier.md +0 -19
  237. package/driver/skills/clearance-register/providers/signa.md +6 -25
  238. package/driver/skills/clearance-register/providers/uspto-local.md +0 -24
  239. package/driver/skills/clearance-register/register-recipes.md +8 -15
  240. package/driver/skills/clearance-register/status-rules.md +6 -24
  241. package/driver/skills/clearance-register/unit.md +11 -20
  242. package/driver/skills/clearance-search/delivery-contract.md +24 -120
  243. package/driver/skills/clearance-search/field-doctrine-pharma.md +1 -5
  244. package/driver/skills/clearance-search/firm-wide-reasoning.md +24 -43
  245. package/driver/skills/clearance-search/phase2-execution.md +29 -77
  246. package/driver/skills/clearance-search/report-prose.md +3 -4
  247. package/driver/skills/clearance-search/risk-framework-demo.md +1 -1
  248. package/driver/skills/clearance-search/risk-framework-triage.manifest.json +3 -3
  249. package/driver/skills/clearance-search/risk-framework-triage.md +7 -9
  250. package/driver/skills/clearance-search/risk-framework.manifest.json +1 -1
  251. package/driver/skills/clearance-search/risk-framework.md +1 -1
  252. package/driver/skills/clearance-search/synthesis-rules.md +30 -107
  253. package/driver/skills/clearance-search/worked-examples.md +5 -5
  254. package/driver/skills/clearance-variants/SKILL.md +46 -45
  255. package/driver/skills/clearance-variants/transliteration-scripts.md +4 -4
  256. package/driver/skills/frame-diff/SKILL.md +1 -1
  257. package/driver/skills/knockout-assess/SKILL.md +6 -14
  258. package/driver/skills/knockout-frame/SKILL.md +1 -1
  259. package/driver/skills/matter-frame/SKILL.md +7 -12
  260. package/driver/skills/matter-frame/watchlist-reference.md +1 -4
  261. package/driver/skills/narrative-refutation/SKILL.md +20 -30
  262. package/driver/skills/placement-inquiry/SKILL.md +10 -20
  263. package/driver/skills-store-provenance.mjs +1 -1
  264. package/driver/stage-context.mjs +32 -35
  265. package/driver/stage-freshness.mjs +127 -11
  266. package/driver/stages-knockout.mjs +49 -22
  267. package/driver/stages.mjs +89 -288
  268. package/driver/status-snapshot.mjs +2 -1
  269. package/driver/steps/correction-cycle.mjs +311 -0
  270. package/driver/steps/corrections.mjs +644 -0
  271. package/driver/steps/delivery.mjs +1287 -0
  272. package/driver/steps/frame-comparison.mjs +927 -0
  273. package/driver/steps/intake.mjs +84 -0
  274. package/driver/steps/open-run.mjs +419 -0
  275. package/driver/steps/overview-and-cards.mjs +899 -0
  276. package/driver/steps/placement-and-digest.mjs +23 -0
  277. package/driver/steps/register-sweep.mjs +1563 -0
  278. package/driver/steps/skeptic-and-follow-up.mjs +836 -0
  279. package/driver/steps/synthesis.mjs +261 -0
  280. package/driver/steps/verdict-gate.mjs +968 -0
  281. package/driver/suite-census.json +456 -96
  282. package/driver/surface-exit-verdict.mjs +0 -8
  283. package/driver/synthesis-record.mjs +72 -6
  284. package/driver/terminal-clamp.mjs +10 -0
  285. package/driver/tokens.mjs +8 -62
  286. package/driver/tool-calls.mjs +2 -2
  287. package/driver/unexecuted-asserts.json +2 -2
  288. package/driver/unit-state-verdict.mjs +1 -1
  289. package/driver/usage-ledger.mjs +2 -1
  290. package/driver/verify-knockout.mjs +20 -35
  291. package/driver/verify.mjs +47 -36
  292. package/driver/web-grid.mjs +3 -4
  293. package/driver/whatif-memo-run.mjs +2 -2
  294. package/driver/whatif-queue.mjs +4 -3
  295. package/driver/withheld-families.mjs +14 -15
  296. package/driver/worker-heartbeat.mjs +3 -2
  297. package/driver/write-up-form.mjs +0 -3
  298. package/mcp-server/CHANGELOG.md +8 -0
  299. package/mcp-server/http-server.mjs +11 -12
  300. package/mcp-server/lib/brief.mjs +22 -4
  301. package/mcp-server/lib/events.mjs +2 -2
  302. package/mcp-server/lib/evidence.mjs +3 -2
  303. package/mcp-server/lib/findings.mjs +2 -1
  304. package/mcp-server/lib/knockout.mjs +9 -10
  305. package/mcp-server/lib/ops.mjs +9 -9
  306. package/mcp-server/lib/runs.mjs +9 -10
  307. package/mcp-server/lib/trace.mjs +1 -1
  308. package/mcp-server/lib/whatif.mjs +2 -3
  309. package/mcp-server/package.json +1 -1
  310. package/mcp-server/server.mjs +5 -5
  311. package/node_modules/buffers/package.json +1 -1
  312. package/package.json +2 -1
  313. package/portal-ui/dist/assets/{index-fPqAU0sx.js → index-CYaO2ygd.js} +26 -14
  314. package/portal-ui/dist/assets/{index-AtB9ZpDH.css → index-izLa9apq.css} +2 -2
  315. package/portal-ui/dist/index.html +4 -4
  316. package/portal-ui/package.json +3 -3
  317. package/providers/README.md +1 -1
  318. package/providers/_shared/answer-memory.mjs +4 -5
  319. package/providers/_shared/execute-plan.mjs +48 -1
  320. package/providers/_shared/records-from-search.mjs +46 -0
  321. package/providers/clarivate/README.md +2 -2
  322. package/providers/clarivate/src/adapter.js +147 -0
  323. package/providers/clarivate/src/core.js +1 -14
  324. package/{driver/engine/mcp/clarivate-server.mjs → providers/clarivate/src/mount.js} +5 -10
  325. package/providers/corsearch/README.md +3 -3
  326. package/providers/corsearch/src/adapter.js +80 -0
  327. package/providers/corsearch/src/core.js +14 -11
  328. package/{driver/engine/mcp/corsearch-server.mjs → providers/corsearch/src/mount.js} +5 -10
  329. package/providers/euipo/README.md +2 -2
  330. package/providers/euipo/src/adapter.js +85 -0
  331. package/providers/euipo/src/core.js +1 -1
  332. package/providers/euipo/src/euipo-client.js +1 -2
  333. package/{driver/engine/mcp/euipo-server.mjs → providers/euipo/src/mount.js} +5 -10
  334. package/providers/free-tier/README.md +2 -2
  335. package/providers/free-tier/src/adapter.js +127 -0
  336. package/{driver/engine/mcp/free-tier-server.mjs → providers/free-tier/src/mount.js} +5 -10
  337. package/providers/jx-subclass/coverage.mjs +1 -6
  338. package/providers/jx-subclass/score-truth.mjs +2 -1
  339. package/providers/oauth-mcp-bridge/CHANGELOG.md +8 -0
  340. package/providers/oauth-mcp-bridge/package.json +1 -1
  341. package/providers/perplexity/src/core.js +2 -2
  342. package/providers/signa/README.md +2 -2
  343. package/providers/signa/src/adapter.js +157 -0
  344. package/providers/signa/src/capabilities.js +0 -3
  345. package/providers/signa/src/core.js +2 -2
  346. package/{driver/engine/mcp/signa-server.mjs → providers/signa/src/mount.js} +7 -12
  347. package/providers/signa/src/offices.generated.js +17 -15
  348. package/providers/uspto-local/README.md +1 -1
  349. package/providers/uspto-local/bin/verify-index.mjs +1 -1
  350. package/providers/uspto-local/src/adapter.js +75 -0
  351. package/{driver/engine/mcp/uspto-local-server.mjs → providers/uspto-local/src/mount.js} +5 -10
  352. package/scripts/band-shape-probe.mjs +2 -2
  353. package/scripts/citation-line-check.mjs +7 -7
  354. package/scripts/compare.mjs +1 -1
  355. package/scripts/dead-names.mjs +2 -2
  356. package/scripts/e2e-first-time.mjs +19 -7
  357. package/scripts/e2e.mjs +13 -13
  358. package/scripts/engine-probe.mjs +1 -1
  359. package/scripts/env-audit.mjs +7 -4
  360. package/scripts/env-classify.mjs +5 -1
  361. package/scripts/feedback-mint.mjs +1 -1
  362. package/scripts/freeze-example-run.mjs +7 -7
  363. package/scripts/mint-suite-census.mjs +2 -2
  364. package/scripts/nightly-notice.mjs +1 -1
  365. package/scripts/release-cut-decision.mjs +7 -2
  366. package/scripts/release-note-required.mjs +26 -9
  367. package/scripts/release-notes-lint.mjs +3 -2
  368. package/scripts/release-version-pr-checks.mjs +1 -1
  369. package/scripts/render-check.mjs +1 -1
  370. package/scripts/settings-render-check.mjs +23 -3
  371. package/scripts/test-run.mjs +5 -5
  372. package/scripts/travelling-predicates.mjs +1 -1
  373. package/scripts/undeclared-field-census.mjs +1 -1
  374. package/scripts/unexecuted-asserts.mjs +3 -3
  375. package/scripts/verify-publishable.mjs +1 -1
  376. package/shared/client-door.mjs +1 -1
  377. package/shared/connect-clients.mjs +1 -1
  378. package/shared/connector-signin-probe.mjs +1 -1
  379. package/shared/customer-store.mjs +3 -2
  380. package/shared/env-aliases.mjs +1 -1
  381. package/shared/invocation.mjs +14 -2
  382. package/shared/names-in-force.mjs +2 -0
  383. package/shared/register-selection.mjs +2 -2
  384. package/shared/store-in-repo.mjs +3 -3
  385. package/shared/summary-blocks.mjs +0 -3
  386. package/shared/trigger-lane.mjs +1 -1
  387. package/shared/vacuous-pass.mjs +2 -2
  388. package/shared/verb-shim.mjs +4 -2
  389. package/vendor/buffers/package.json +1 -1
  390. package/node_modules/exceljs/README.md +0 -3023
@@ -1,17 +1,12 @@
1
- #!/usr/bin/env node
2
1
  // SPDX-License-Identifier: AGPL-3.0-only
3
2
  // Copyright 2026 Cordillera Sàrl. Additional terms under section 7 of the AGPL-3.0 apply — see ADDITIONAL-TERMS.md
4
- // Standalone MCP server wrapping the corsearch CORE (pure node+fetch) so a `claude -p` process can
3
+ // The corsearch register's tools, as driver/engine/mcp/register-server.mjs mounts them, wrapping its CORE (pure node+fetch) so a `claude -p` process can
5
4
  // call the register-search tools off-gateway. Pure glue: the cores own all logic. Auth = CORSEARCH_SESSION_KEY
6
5
  // (the cookie). Telemetry: the cores write CLEAROTRON_REGISTER_CALL_LOG / CLEAROTRON_REGISTER_RECORD_LOG keyed by the GATEWAY
7
6
  // session key (tctx.sessionKey) — we thread the run's session key via CLEAROTRON_GATHER_SESSION_KEY so the
8
7
  // $0 provider-usage diff still attributes calls to the run.
9
- import { serve } from "./stdio-server.mjs";
10
- import { sendUntilFromEnv } from "../../../providers/_shared/send-until.mjs";
11
- import { crowdNoteFor } from "./crowd-note.mjs"; // how the unit decides on a crowd, beside an answer that carries one
12
- import { CAPABILITIES, doSearch, doRecordFetch, doImageFetch, doExpandPhoneme, doBatchScreen, doEnumerate, doExecutePlan } from "../../../providers/corsearch/src/core.js";
13
- import { proposeSupplemental } from "./supplemental.mjs";
14
- import { narrowingFields } from "./proposal-fields.mjs";
8
+ import { sendUntilFromEnv } from "../../_shared/send-until.mjs";
9
+ import { CAPABILITIES, doSearch, doRecordFetch, doImageFetch, doExpandPhoneme, doBatchScreen, doEnumerate, doExecutePlan } from "./core.js";
15
10
 
16
11
  const COOKIE = process.env.CORSEARCH_SESSION_KEY || "";
17
12
  const tctx = (kind) => ({
@@ -27,8 +22,8 @@ const guard = (fn) => async (args) => {
27
22
  return passthrough(await fn(args));
28
23
  };
29
24
 
30
- serve({
31
- name: "register", version: "0.2.0", noteFor: crowdNoteFor,
25
+ export const mount = ({ proposeSupplemental, narrowingFields }) => ({
26
+ version: "0.2.0",
32
27
  tools: [
33
28
  {
34
29
  name: "register_search",
@@ -19,10 +19,10 @@ nothing downstream can mistake one for the other. Set `production` explicitly.
19
19
 
20
20
  ## What reads it
21
21
 
22
- - `../../driver/driver.config.mjs` — the `euipo` provider entry, which lazily imports `src/core.js`
22
+ - `src/adapter.js` — the `euipo` provider entry, which lazily imports `src/core.js`
23
23
  for `recordFetch`, `countHits`, `listRecords` and `executePlan`. `credEnv` is `EUIPO_CLIENT_ID`
24
24
  with `EUIPO_CLIENT_SECRET` in `credEnvAlso`, so preflight checks the whole pair.
25
- - `../../driver/engine/mcp/euipo-server.mjs` — the model-facing surface, under the neutral
25
+ - `src/mount.js` — the model-facing surface, under the neutral
26
26
  `register_*` names. `register_expand_phoneme` is absent on purpose: the planner stamps a phonetic
27
27
  slice `unsupported` and it is disclosed as a deferred coverage row.
28
28
  - `../../driver/register-capabilities.mjs` — imports `src/capabilities.js` statically at module load,
@@ -0,0 +1,85 @@
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
+ // The euipo register's driver-side adapter: what the driver itself asks this register, with no model in the path.
4
+ // `driver.config.mjs` lists it in PROVIDERS. The core is imported only when a call needs it.
5
+ import { recordsFromSearch } from "../../_shared/records-from-search.mjs";
6
+
7
+ // ── EUIPO — the first FREE register provider ─────────────────────────────────────────────
8
+ // Everything above is a paid vendor with a global sweep. This one covers ONE office (the EU register:
9
+ // EUTMs plus international registrations designating the EU) and is free to query, which is what
10
+ // makes an open-source install possible at all.
11
+ //
12
+ // The auth object is a credential PAIR plus an environment, not a single key — hence the shape
13
+ // difference below. `environment` is load-bearing and not a preference: sandbox and production are
14
+ // separate deployments holding different corpora, and a sandbox cross-check must never be read as a
15
+ // live one. The core refuses an unknown value rather than falling back.
16
+ export const adapter = {
17
+ id: "euipo",
18
+ label: "EUIPO",
19
+ credEnv: "EUIPO_CLIENT_ID",
20
+ // The ONLY provider with more than one required variable. preflightCredentials checks the whole
21
+ // list — without this, an instance holding the id and no secret passes preflight and dies on the
22
+ // first token request, after model spend and reported as a provider fault.
23
+ credEnvAlso: ["EUIPO_CLIENT_SECRET"],
24
+ skillDoc: "skills/clearance-register/providers/euipo.md",
25
+ hasPublicRecordUrl: true,
26
+ publicRecordOrigin: "https://euipo.europa.eu",
27
+ async recordFetch(uri, { agentId, sessionKey, recordLog = null }) {
28
+ if (!process.env.EUIPO_CLIENT_ID || !process.env.EUIPO_CLIENT_SECRET) {
29
+ return { ok: false, cause: "EUIPO_CLIENT_ID / EUIPO_CLIENT_SECRET absent from driver env" };
30
+ }
31
+ let doRecordFetch;
32
+ try { ({ doRecordFetch } = await import("./core.js")); }
33
+ catch (e) { return { ok: false, cause: `plugin core unavailable: ${e.message}` }; }
34
+ try {
35
+ const r = await doRecordFetch(null, // null ⇒ the core reads the credential pair from env
36
+ { record_id: uri }, { kind: "record_fetch", agentId, sessionKey, sessionId: null, recordLog });
37
+ const err = typeof r?.text === "string" && r.text.startsWith("ERROR") ? r.text : null;
38
+ return err ? { ok: false, cause: err.slice(0, 140) } : { ok: true };
39
+ } catch (e) { return { ok: false, cause: `fetch threw: ${e.message}` }; }
40
+ },
41
+ // countProbe "cheap": the total rides page 0 of an ordinary search, so this is ONE call — free in
42
+ // money terms, but it still spends the daily request allowance.
43
+ async countHits({ name, matchMode, classes, regions }, { agentId, sessionKey, recordLog = null }) {
44
+ if (!process.env.EUIPO_CLIENT_ID || !process.env.EUIPO_CLIENT_SECRET) {
45
+ return { ok: false, total: null, reason: "EUIPO_CLIENT_ID / EUIPO_CLIENT_SECRET absent from driver env" };
46
+ }
47
+ let doCountHits;
48
+ try { ({ doCountHits } = await import("./core.js")); }
49
+ catch (e) { return { ok: false, total: null, reason: `plugin core unavailable: ${e.message}` }; }
50
+ try {
51
+ return await doCountHits(null,
52
+ { name, match_mode: matchMode, nice_classes: classes ?? [], ...(regions?.length ? { regions } : {}) },
53
+ { kind: "count_hits", agentId, sessionKey, sessionId: null, recordLog });
54
+ } catch (e) { return { ok: false, total: null, reason: `count threw: ${e.message}` }; }
55
+ },
56
+ // part 5. Free in money, one request against the daily allowance per term. The page knob is
57
+ // `size`, not `limit` — this API has no `limit` at all, which is the exact trap the count kernel's
58
+ // own header warns about, so the neutral cap is translated here rather than passed through.
59
+ async listRecords({ name, matchMode, classes, regions, limit }, { agentId, sessionKey, recordLog = null }) {
60
+ if (!process.env.EUIPO_CLIENT_ID || !process.env.EUIPO_CLIENT_SECRET) {
61
+ return { ok: false, records: null, reason: "EUIPO_CLIENT_ID / EUIPO_CLIENT_SECRET absent from driver env" };
62
+ }
63
+ let doSearch;
64
+ try { ({ doSearch } = await import("./core.js")); }
65
+ catch (e) { return { ok: false, records: null, reason: `plugin core unavailable: ${e.message}` }; }
66
+ return recordsFromSearch((p, t) => doSearch(null, p, t))(
67
+ { name, match_mode: matchMode, nice_classes: classes ?? [], ...(regions?.length ? { regions } : {}), size: limit, page: 0 },
68
+ { kind: "record_list", agentId, sessionKey, sessionId: null, recordLog });
69
+ },
70
+ async executePlan({ planPath, axis, outputPath, qids }, { agentId, sessionKey, recordLog = null, reaskTimedOut = false }) {
71
+ if (!process.env.EUIPO_CLIENT_ID || !process.env.EUIPO_CLIENT_SECRET) {
72
+ return { ok: false, cause: "EUIPO_CLIENT_ID / EUIPO_CLIENT_SECRET absent from driver env" };
73
+ }
74
+ let doExecutePlan;
75
+ try { ({ doExecutePlan } = await import("./core.js")); }
76
+ catch (e) { return { ok: false, cause: `plugin core unavailable: ${e.message}` }; }
77
+ try {
78
+ const r = await doExecutePlan(null,
79
+ { plan_path: planPath, axis, output_path: outputPath, ...(Array.isArray(qids) && qids.length ? { qids } : {}) },
80
+ { kind: "execute_plan", agentId, sessionKey, sessionId: null, recordLog, ...(reaskTimedOut ? { reaskTimedOut: true } : {}) });
81
+ const text = typeof r?.text === "string" ? r.text : "";
82
+ return text.startsWith("ERROR") ? { ok: false, cause: text.slice(0, 200) } : { ok: true, summary: text.slice(0, 400) };
83
+ } catch (e) { return { ok: false, cause: `executePlan threw: ${e.message}` }; }
84
+ },
85
+ };
@@ -112,7 +112,7 @@ export function resolveConfig(auth) {
112
112
  + "run searches, and the two are not interchangeable: `production` is the register; `sandbox` is a "
113
113
  + "frozen snapshot plus synthetic rows, so a clearance against it reports on marks that do not "
114
114
  + "exist. Set EUIPO_ENVIRONMENT=production for a real clearance, or =sandbox deliberately for a "
115
- + "test. This refuses rather than choosing for you (#1149 item 2, ADR-0001).",
115
+ + "test. This refuses rather than choosing for you (ADR-0001).",
116
116
  );
117
117
  }
118
118
  if (!ENV[environment]) {
@@ -48,7 +48,6 @@ export const ENV = {
48
48
  //
49
49
  // This list was surfaced to the model as a tool-schema enum until, so a model could pick a value
50
50
  // the schema advertised and get a 400 back. The neutral server now offers `queryableStatuses`.
51
- export const MARK_FEATURES = ["WORD", "FIGURATIVE", "SHAPE_3D", "COLOUR", "SOUND", "HOLOGRAM", "OLFACTORY", "POSITION", "PATTERN", "MOTION", "MULTIMEDIA", "OTHER"];
52
51
  export const STATUSES = ["RECEIVED", "UNDER_EXAMINATION", "APPLICATION_PUBLISHED", "REGISTRATION_PENDING", "REGISTERED", "WITHDRAWN", "REFUSED", "OPPOSITION_PENDING", "APPEALED", "CANCELLATION_PENDING", "CANCELLED", "SURRENDERED", "EXPIRED", "APPEALABLE", "START_OF_OPPOSITION_PERIOD", "ACCEPTANCE_PENDING", "ACCEPTED", "REMOVED_FROM_REGISTER"];
53
52
 
54
53
  // In-memory token cache, keyed by clientId. Cleared on process restart.
@@ -76,7 +75,7 @@ function hostsFor(cfg, where) {
76
75
  `[euipo] ${where}: EUIPO_ENVIRONMENT is not set and there is NO default. It selects which EU `
77
76
  + "corpus this call searches, and the two are not interchangeable: `production` is the register; "
78
77
  + "`sandbox` is a frozen snapshot plus synthetic rows. Resolve the config through core.js's "
79
- + "resolveConfig, which refuses the same way (#1149 item 2, ADR-0001).",
78
+ + "resolveConfig, which refuses the same way (ADR-0001).",
80
79
  );
81
80
  }
82
81
  if (!ENV[environment]) {
@@ -1,7 +1,6 @@
1
- #!/usr/bin/env node
2
1
  // SPDX-License-Identifier: AGPL-3.0-only
3
2
  // Copyright 2026 Cordillera Sàrl. Additional terms under section 7 of the AGPL-3.0 apply — see ADDITIONAL-TERMS.md
4
- // Standalone MCP server wrapping the EUIPO CORE under the NEUTRAL `register_*` names, so a `claude -p`
3
+ // The EUIPO register's tools, as driver/engine/mcp/register-server.mjs mounts them, wrapping its CORE under the NEUTRAL `register_*` names, so a `claude -p`
5
4
  // process can call the EU register as the active register provider. Pure glue: the core owns all logic.
6
5
  //
7
6
  // ── THIS FILE REPLACED A SIDE-TOOL SERVER, AND THE DIFFERENCE IS THE POINT ────────────────────────
@@ -27,15 +26,11 @@
27
26
  // record's `markImage` carries only `{imageFormat, viennaClasses}` — no bytes, no URL. But
28
27
  // `GET /trademarks/{n}/image` answers 200 with real image bytes. The tool returns metadata + the
29
28
  // Vienna figurative-element codes rather than the bytes; see the core for why.
30
- import { serve } from "./stdio-server.mjs";
31
- import { sendUntilFromEnv } from "../../../providers/_shared/send-until.mjs";
32
- import { crowdNoteFor } from "./crowd-note.mjs"; // how the unit decides on a crowd, beside an answer that carries one
29
+ import { sendUntilFromEnv } from "../../_shared/send-until.mjs";
33
30
  import {
34
31
  CAPABILITIES, CRED_ENV, doSearch, doRecordFetch, doBatchScreen, doImageFetch,
35
32
  doEnumerate, doExecutePlan,
36
- } from "../../../providers/euipo/src/core.js";
37
- import { proposeSupplemental } from "./supplemental.mjs";
38
- import { narrowingFields } from "./proposal-fields.mjs";
33
+ } from "./core.js";
39
34
 
40
35
  // The core resolves credentials from the environment; AUTH stays an object so a future knob (a pinned
41
36
  // environment, a second subscription) does not change every call site.
@@ -82,8 +77,8 @@ const QUERY_PROPS = {
82
77
  regions: { type: "array", items: { type: "string" }, description: "territory codes. This source holds the EU register only (EUTM + IRs designating the EU); anything else is REFUSED as a deferred gap, never filtered away so the search runs EU-wide regardless." },
83
78
  };
84
79
 
85
- serve({
86
- name: "register", version: "0.1.0", noteFor: crowdNoteFor,
80
+ export const mount = ({ proposeSupplemental, narrowingFields }) => ({
81
+ version: "0.1.0",
87
82
  tools: [
88
83
  {
89
84
  name: "register_search",
@@ -31,11 +31,11 @@ instead would plan a query one source cannot run and call the result a clean.
31
31
 
32
32
  ## What reads it
33
33
 
34
- - `../../driver/driver.config.mjs` — the `free-tier` entry. `credEnv` is the EU pair only:
34
+ - `src/adapter.js` — the `free-tier` entry. `credEnv` is the EU pair only:
35
35
  `USPTO_LOCAL_DB` is deliberately not required, so a box without the index still gets its EU
36
36
  coverage. `publicRecordOrigin` is `null` and `composedOf` carries the members, because the two
37
37
  halves have different public hosts.
38
- - `../../driver/engine/mcp/free-tier-server.mjs` — seven of the eight neutral `register_*` tools. The
38
+ - `src/mount.js` — seven of the eight neutral `register_*` tools. The
39
39
  seat is not told there are two sources; it sees only the derived contract.
40
40
  - `../../driver/register-capabilities.mjs` and `../../driver/register-availability.mjs` — the latter
41
41
  joins `composedOf` to each member's credential declaration to decide reachable offices.
@@ -0,0 +1,127 @@
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
+ // The free-tier register's driver-side adapter: what the driver itself asks this register, with no model in the path.
4
+ // `driver.config.mjs` lists it in PROVIDERS. The core is imported only when a call needs it.
5
+ import { recordsFromSearch } from "../../_shared/records-from-search.mjs";
6
+
7
+ // ──: the free tier — EUIPO + the local US index as ONE register ──────────────────────────────
8
+ //
9
+ // WHAT PREFLIGHT REQUIRES IS THE EU HALF, NOT BOTH HALVES.
10
+ //
11
+ // This list used to carry USPTO_LOCAL_DB, and the argument was that joinPlanToBands has three outcomes
12
+ // per qid — executed, missing, deferred — with no shape for "half of this ran", so a two-office slice
13
+ // whose US half is unconfigured would defer WHOLE and take its EU coverage with it. Refusing up front
14
+ // looked like the only honest answer.
15
+ //
16
+ // That invariant is real and is unchanged. What was wrong is where it was enforced. The two offices
17
+ // now part company at PLAN COMPILE (driver/register-availability.mjs → compileRegisterPlan), so every
18
+ // qid the executor sees is already single-office: every entry is EU-only, and nothing is ever
19
+ // half-run. With the split early, refusing the whole run buys nothing and costs the EU coverage the
20
+ // box genuinely has.
21
+ //
22
+ // CORRECTED 2026-08-11. This paragraph used to say "the US entry is a disclosed `deferred_coverage`
23
+ // row". THERE IS NO US ENTRY — the unreachable office produces no plan entry at all, which is exactly
24
+ // why every surviving qid is single-office. The distinction was not pedantic: nothing a reader sees
25
+ // was reading `deferred_coverage`, so the run shipped an EU-only clean with no row saying the US
26
+ // register was never searched, and this comment was the argument for dropping the variable from the
27
+ // list above. The disclosure now exists — coverage-form.mjs reads `plan.deferred_coverage` and emits
28
+ // an `open` row per active axis — so the reasoning below stands on something real. Before that it did
29
+ // not, and this list was right for the wrong reason.
30
+ //
31
+ // It also gated the wrong thing in practice. The US index is the one piece of this tier an operator
32
+ // cannot get in a minute — it is a 41.5 GB build over two bulk products, behind an account with ID.me
33
+ // identity verification, and it takes hours — so requiring it made the free tier unusable for exactly
34
+ // the person it exists for. That CODE was merged; the INDEX is what no box had, and that was enough
35
+ // to keep and from ever being exercised.
36
+ //
37
+ // The EU pair stays REQUIRED: a free tier with no configured member at all is not degraded, it is
38
+ // unconfigured, and it must refuse by name rather than produce a register layer with nothing in it.
39
+ // credEnvAlso is still what makes that a whole check — a single credEnv string cannot express a
40
+ // two-variable OAuth provider, and the half-check that reads credEnv alone is a known second site.
41
+ // The free tier's REQUIRED variables, in one place: the guards in this adapter and preflightCredentials
42
+ // must not drift apart on which ones matter.
43
+ //
44
+ // USPTO_LOCAL_DB left this list with and is deliberately not checked here. These guards front the
45
+ // driver-side record/count calls, and those route BY OFFICE — an EU record fetch on a box with no US
46
+ // index is a call the free tier can serve perfectly well, and refusing it because a variable the call
47
+ // never touches is unset would turn a disclosed US deferral into a run that also cannot cite its EU
48
+ // evidence. The US half's absence is stated once, at plan compile, as a deferred coverage row; a member
49
+ // that IS asked for and is not configured refuses inside its own core, naming its own variable.
50
+ function freeTierMissing(env = process.env) {
51
+ return ["EUIPO_CLIENT_ID", "EUIPO_CLIENT_SECRET"]
52
+ .filter((k) => !String(env[k] ?? "").trim());
53
+ }
54
+
55
+ export const adapter = {
56
+ id: "free-tier",
57
+ label: "Free tier (EUIPO + USPTO local index)",
58
+ credEnv: "EUIPO_CLIENT_ID",
59
+ credEnvAlso: ["EUIPO_CLIENT_SECRET"],
60
+ skillDoc: "skills/clearance-register/providers/free-tier.md",
61
+ hasPublicRecordUrl: true,
62
+ // NULL, deliberately: the two members have DIFFERENT public origins (euipo.europa.eu and the USPTO),
63
+ // so a single origin string here would stamp one office's host onto the other's citations. The
64
+ // record-level link is built from the record itself; publish/index.mjs reads this only as a prefix
65
+ // and treats null as "no prefix", which is the honest answer for a two-office register.
66
+ publicRecordOrigin: null,
67
+ // — WHICH HOSTS THIS PROVIDER MAY LEGITIMATELY PRODUCE. The record-URL gate reads origins
68
+ // through recordOriginsFor(), and a composite's are its MEMBERS'. Keyed on the null above: a gate
69
+ // that took `publicRecordOrigin` at face value here would resolve to an EMPTY allow-list and refuse
70
+ // every free-tier delivery — every one of whose record links is legitimately a EUIPO or a USPTO one.
71
+ composedOf: ["euipo", "uspto-local"],
72
+ async recordFetch(uri, { agentId, sessionKey, recordLog = null }) {
73
+ const missing = freeTierMissing();
74
+ if (missing.length) return { ok: false, cause: `${missing.join(" + ")} absent from driver env` };
75
+ let doRecordFetch;
76
+ try { ({ doRecordFetch } = await import("./core.js")); }
77
+ catch (e) { return { ok: false, cause: `plugin core unavailable: ${e.message}` }; }
78
+ try {
79
+ const r = await doRecordFetch(null, { record_id: uri },
80
+ { kind: "record_fetch", agentId, sessionKey, sessionId: null, recordLog });
81
+ const err = typeof r?.text === "string" && r.text.startsWith("ERROR") ? r.text : null;
82
+ return err ? { ok: false, cause: err.slice(0, 140) } : { ok: true };
83
+ } catch (e) { return { ok: false, cause: `fetch threw: ${e.message}` }; }
84
+ },
85
+ // countProbe "cheap" — the WEAKEST member's mode. EUIPO's total rides page 0 of an ordinary search,
86
+ // so the composite pays that price even though the US index has a true count endpoint.
87
+ async countHits({ name, matchMode, classes, regions }, { agentId, sessionKey, recordLog = null }) {
88
+ const missing = freeTierMissing();
89
+ if (missing.length) return { ok: false, total: null, reason: `${missing.join(" + ")} absent from driver env` };
90
+ let doCountHits;
91
+ try { ({ doCountHits } = await import("./core.js")); }
92
+ catch (e) { return { ok: false, total: null, reason: `plugin core unavailable: ${e.message}` }; }
93
+ try {
94
+ return await doCountHits(null,
95
+ { name, match_mode: matchMode, nice_classes: classes ?? [], ...(regions?.length ? { regions } : {}) },
96
+ { kind: "count_hits", agentId, sessionKey, sessionId: null, recordLog });
97
+ } catch (e) { return { ok: false, total: null, reason: `count threw: ${e.message}` }; }
98
+ },
99
+ // part 5. Free on both members. `size` AND `limit` ride together on purpose: this composite
100
+ // fans out to EUIPO (which pages on `size`) and to the local US index (which pages on `limit`), and
101
+ // its own doSearch hands each member the params it understands. Sending one knob would silently
102
+ // give the other member its default page size — a listing capped somewhere nobody chose.
103
+ async listRecords({ name, matchMode, classes, regions, limit }, { agentId, sessionKey, recordLog = null }) {
104
+ const missing = freeTierMissing();
105
+ if (missing.length) return { ok: false, records: null, reason: `${missing.join(" + ")} absent from driver env` };
106
+ let doSearch;
107
+ try { ({ doSearch } = await import("./core.js")); }
108
+ catch (e) { return { ok: false, records: null, reason: `plugin core unavailable: ${e.message}` }; }
109
+ return recordsFromSearch((p, t) => doSearch(null, p, t))(
110
+ { name, match_mode: matchMode, nice_classes: classes ?? [], ...(regions?.length ? { regions } : {}), size: limit, limit, page: 0 },
111
+ { kind: "record_list", agentId, sessionKey, sessionId: null, recordLog });
112
+ },
113
+ async executePlan({ planPath, axis, outputPath, qids }, { agentId, sessionKey, recordLog = null, reaskTimedOut = false }) {
114
+ const missing = freeTierMissing();
115
+ if (missing.length) return { ok: false, cause: `${missing.join(" + ")} absent from driver env` };
116
+ let doExecutePlan;
117
+ try { ({ doExecutePlan } = await import("./core.js")); }
118
+ catch (e) { return { ok: false, cause: `plugin core unavailable: ${e.message}` }; }
119
+ try {
120
+ const r = await doExecutePlan(null,
121
+ { plan_path: planPath, axis, output_path: outputPath, ...(Array.isArray(qids) && qids.length ? { qids } : {}) },
122
+ { kind: "execute_plan", agentId, sessionKey, sessionId: null, recordLog, ...(reaskTimedOut ? { reaskTimedOut: true } : {}) });
123
+ const text = typeof r?.text === "string" ? r.text : "";
124
+ return text.startsWith("ERROR") ? { ok: false, cause: text.slice(0, 200) } : { ok: true, summary: text.slice(0, 400) };
125
+ } catch (e) { return { ok: false, cause: `executePlan threw: ${e.message}` }; }
126
+ },
127
+ };
@@ -1,7 +1,6 @@
1
- #!/usr/bin/env node
2
1
  // SPDX-License-Identifier: AGPL-3.0-only
3
2
  // Copyright 2026 Cordillera Sàrl. Additional terms under section 7 of the AGPL-3.0 apply — see ADDITIONAL-TERMS.md
4
- // Standalone MCP server wrapping the FREE-TIER COMPOSITE under the neutral `register_*` names — EUIPO
3
+ // The free tier's tools, as driver/engine/mcp/register-server.mjs mounts them, wrapping its COMPOSITE under the neutral `register_*` names — EUIPO
5
4
  // and the local US index serving one clearance as a single register. Pure glue: the core owns the
6
5
  // routing and every merge decision.
7
6
  //
@@ -29,14 +28,10 @@
29
28
  //
30
29
  // Telemetry: the core writes CLEAROTRON_REGISTER_CALL_LOG / CLEAROTRON_REGISTER_RECORD_LOG (the SHARED register
31
30
  // ledger) under the provider id `free-tier`, keyed by the gateway session key.
32
- import { serve } from "./stdio-server.mjs";
33
- import { sendUntilFromEnv } from "../../../providers/_shared/send-until.mjs";
34
- import { crowdNoteFor } from "./crowd-note.mjs"; // how the unit decides on a crowd, beside an answer that carries one
31
+ import { sendUntilFromEnv } from "../../_shared/send-until.mjs";
35
32
  import {
36
33
  CAPABILITIES, doSearch, doRecordFetch, doBatchScreen, doImageFetch, doEnumerate, doExecutePlan,
37
- } from "../../../providers/free-tier/src/core.js";
38
- import { proposeSupplemental } from "./supplemental.mjs";
39
- import { narrowingFields } from "./proposal-fields.mjs";
34
+ } from "./core.js";
40
35
 
41
36
  // NULL, and it is not a placeholder. Each member core resolves its OWN credentials from the environment
42
37
  // — EUIPO its OAuth pair, the index its file path — so there is no single auth object a composite could
@@ -102,8 +97,8 @@ const QUERY_PROPS = {
102
97
  regions: { type: "array", items: { type: "string" }, description: `territory codes. This register covers ${CAPABILITIES.offices.covered.join(", ")} — the EU register (EUTM + IRs designating the EU) and the US register. A code outside that is REFUSED as a deferred gap, never filtered away so the search runs over the rest regardless. Omit for the whole tier.` },
103
98
  };
104
99
 
105
- serve({
106
- name: "register", version: "0.1.0", noteFor: crowdNoteFor,
100
+ export const mount = ({ proposeSupplemental, narrowingFields }) => ({
101
+ version: "0.1.0",
107
102
  tools: [
108
103
  {
109
104
  name: "register_search",
@@ -1,7 +1,7 @@
1
1
  // SPDX-License-Identifier: AGPL-3.0-only
2
2
  // Copyright 2026 Cordillera Sàrl. Additional terms under section 7 of the AGPL-3.0 apply — see ADDITIONAL-TERMS.md
3
3
  // coverage.mjs — what this database has actually READ, as opposed to what it happens to hold rows for.
4
- // Zero dependencies (node:sqlite only), the same pattern as providers/uspto-local/src/index-store.js.
4
+ // Zero dependencies, the same pattern as providers/uspto-local/src/index-store.js.
5
5
  //
6
6
  // ── THE ONE THING THIS FILE EXISTS TO GET RIGHT ────────────────────────────────────────────────────
7
7
  //
@@ -28,7 +28,6 @@
28
28
  //
29
29
  // A MISSING ROW REFUSES. Omission is the failure mode a stated table invites, so absence is never
30
30
  // treated as permission.
31
- import { DatabaseSync } from "node:sqlite";
32
31
 
33
32
  export const COVERAGE_DDL = `
34
33
  CREATE TABLE IF NOT EXISTS coverage (
@@ -114,7 +113,3 @@ export function assertCoverageComplete(db) {
114
113
  }
115
114
  return true;
116
115
  }
117
-
118
- export function openCoverage(path = "similar-groups.db") {
119
- return new DatabaseSync(path, { readOnly: true });
120
- }
@@ -6,7 +6,8 @@ import { DatabaseSync } from "node:sqlite";
6
6
  import { readFileSync } from "node:fs";
7
7
  import { resolveGood, resolveCnGood } from "./terms.mjs";
8
8
 
9
- const KEY = process.argv[2] ?? "/mnt/datadisk1/tmp/haiku-subclass-probe/subclass-truth.json";
9
+ const KEY = process.argv[2];
10
+ if (!KEY) { console.error("usage: node score-truth.mjs <answer-key.json>"); process.exit(2); }
10
11
  const db = new DatabaseSync("similar-groups.db", { readOnly: true });
11
12
  const items = JSON.parse(readFileSync(KEY, "utf8"));
12
13
  const codes = db.prepare("SELECT DISTINCT code FROM group_code WHERE basic_no = ? AND office = 'CN'");
@@ -1,5 +1,13 @@
1
1
  # trademark-oauth-mcp-bridge
2
2
 
3
+ ## 0.6.0-beta.1
4
+
5
+ No changes in this release.
6
+
7
+ ## 0.6.0-beta.0
8
+
9
+ No changes in this release.
10
+
3
11
  ## 0.5.1
4
12
 
5
13
  No changes in this release.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trademark-oauth-mcp-bridge",
3
- "version": "0.5.1",
3
+ "version": "0.6.0-beta.1",
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).",
@@ -514,8 +514,8 @@ export function connotationQueriesOf(spec) {
514
514
  /**
515
515
  * Build the sandbox task from the DICTATED spec — the term and platform keys reach Perplexity's program
516
516
  * from code, never re-typed by the calling model (this is what kills re-typed-key corruption (VIBRANTE→VIBRNTE-class typos)).
517
- * CRITICAL: this carries the PINNED pplx_sdk access idiom (the same one in
518
- * skills/clearance-common-law/perplexity-prompts.md). Without it the sandbox agent free-styles the SDK and
517
+ * CRITICAL: this carries the PINNED pplx_sdk access idiom, and since the manual's hand-written program went it is
518
+ * the only copy. Without it the sandbox agent free-styles the SDK and
519
519
  * dies with "TypeError: 'pplx_sdk.WebHit' object is not iterable" on every cell (the teal-vault /
520
520
  * a 1-of-154 fold failure). The result object supports ITERATION + ATTRIBUTE
521
521
  * access only. The per-cell try/except keeps one bad cell from aborting the whole grid.
@@ -35,9 +35,9 @@ past `OWNER_SCOPED_WINDOW` (400 rows). Approximate totals saturate at 10000 and
35
35
 
36
36
  - [`../../driver/register-capabilities.mjs`](../../driver/register-capabilities.mjs) imports `CAPABILITIES`
37
37
  at module load — the contract is pure (no node imports, no vendor HTTP) so that stays free.
38
- - [`../../driver/driver.config.mjs`](../../driver/driver.config.mjs) lazy-imports `src/core.js` for the
38
+ - [`src/adapter.js`](src/adapter.js) lazy-imports `src/core.js` for the
39
39
  in-process lanes under `credEnv: "SIGNA_API_KEY"`, selected by `CLEAROTRON_DATABASE=signa`.
40
- - [`../../driver/engine/mcp/signa-server.mjs`](../../driver/engine/mcp/signa-server.mjs) wraps the same
40
+ - [`src/mount.js`](src/mount.js) wraps the same
41
41
  core as a standalone MCP server, mounting four tools under the neutral names `register_search`,
42
42
  `register_record_fetch`, `register_enumerate`, `register_execute_plan`. There is no batch-screen tool:
43
43
  search rows already carry status, classes and owner, so screening costs no extra call.
@@ -0,0 +1,157 @@
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
+ // The signa register's driver-side adapter: what the driver itself asks this register, with no model in the path.
4
+ // `driver.config.mjs` lists it in PROVIDERS. The core is imported only when a call needs it.
5
+
6
+ export const adapter = {
7
+ id: "signa",
8
+ label: "Signa",
9
+ credEnv: "SIGNA_API_KEY",
10
+ skillDoc: "skills/clearance-register/providers/signa.md",
11
+ hasPublicRecordUrl: false, // Signa exposes no per-record public URL — cite the office register
12
+ //, ruling 2026-08-20 — no register UI exists to link to at all, so the card points at
13
+ // the artifact that DOES carry the record: the audit workbook. Naming it is the whole of this
14
+ // branch; constructing a per-record URL for a provider that publishes none would be a fabricated
15
+ // citation on a legal deliverable, and the ruling forbids it in those words.
16
+ recordCitation: "workbook",
17
+ async recordFetch(uri, { agentId, sessionKey, recordLog = null }) {
18
+ if (!process.env.SIGNA_API_KEY) return { ok: false, cause: "SIGNA_API_KEY absent from driver env" };
19
+ let doRecordFetch, DEFAULT_BASE;
20
+ try { ({ doRecordFetch, DEFAULT_BASE } = await import("./core.js")); }
21
+ catch (e) { return { ok: false, cause: `plugin core unavailable: ${e.message}` }; }
22
+ const base = process.env.SIGNA_BASE_URL || DEFAULT_BASE;
23
+ try {
24
+ const r = await doRecordFetch(process.env.SIGNA_API_KEY, base,
25
+ { record_id: uri }, { kind: "record_fetch", agentId, sessionKey, sessionId: null, recordLog });
26
+ const err = typeof r?.text === "string" && r.text.startsWith("ERROR") ? r.text : null;
27
+ return err ? { ok: false, cause: err.slice(0, 140) } : { ok: true };
28
+ } catch (e) { return { ok: false, cause: `fetch threw: ${e.message}` }; }
29
+ },
30
+ // ── the three adapters that make this a code-driven provider ─────────────────────────
31
+ //
32
+ // Until these existed signa declared `recordFetch` alone, `planExec` resolved to null, and a run
33
+ // fell to the agent lane — a model asked to page a register by hand. Preflight refuses that
34
+ // outright now, so signa was unrunnable end to end until this landed.
35
+ async countHits({ name, matchMode, classes, regions }, { agentId, sessionKey, recordLog = null }) {
36
+ if (!process.env.SIGNA_API_KEY) return { ok: false, cause: "SIGNA_API_KEY absent from driver env" };
37
+ let core;
38
+ try { core = await import("./core.js"); }
39
+ catch (e) { return { ok: false, cause: `plugin core unavailable: ${e.message}` }; }
40
+ const base = process.env.SIGNA_BASE_URL || core.DEFAULT_BASE;
41
+ try {
42
+ // THROUGH toSignaParams, not around it. `strategies: [matchMode]` is the same defect
43
+ // fixed one layer down: `contains`, `starts_with` and `ends_with` are DETERMINISTIC
44
+ // modes, not strategies, and the API rejects them in the strategies array. These wrappers
45
+ // hand-built the vendor shape and so were untouched by that fix — the translator is the one
46
+ // place that knows which mode rides which request shape, and every caller must go through it.
47
+ // A MODE THIS PROVIDER CANNOT EXPRESS REFUSES THE CELL, rather than being answered by a
48
+ // different predicate's number. The translator names it; this turns it into an honest unknown,
49
+ // which the count kernel already treats as a disclosed gap. The alternative is what this
50
+ // issue was: a narrower query answering under the wider query's label, invisibly.
51
+ const signaParams = core.toSignaParams({ name, match_mode: matchMode || "exact", nice_classes: classes, regions });
52
+ if (signaParams.unsupported_match_mode) {
53
+ return { ok: false, total: null, unsupported: true,
54
+ cause: `this register provider cannot express the "${signaParams.unsupported_match_mode}" match mode, so this count is UNKNOWN — it is not answered with a different predicate's number` };
55
+ }
56
+ const r = await core.doCountHits(process.env.SIGNA_API_KEY, base, signaParams,
57
+ { kind: "count", agentId, sessionKey, sessionId: null, recordLog });
58
+ const text = typeof r?.text === "string" ? r.text : "";
59
+ if (text.startsWith("ERROR")) return { ok: false, cause: text.slice(0, 200) };
60
+ const p = JSON.parse(text);
61
+ // The total is REAL now: `options.include_total` puts the register's own corpus total
62
+ // on the search response, so this no longer has to answer `present` and nothing else. It is
63
+ // still null whenever the vendor would only approximate it — and null there means UNKNOWN,
64
+ // which is the whole reason the field may never be filled in with a figure from anywhere else.
65
+ // `floor` rides beside `approximate` because the two are one fact: the register answered, and the
66
+ // answer is "more than this". Without the number the disclosure is not usable — "approximate"
67
+ // alone says no more than "unknown" does, which is the state this replaces.
68
+ return { ok: true, total: Number.isFinite(p.total_hits) ? p.total_hits : null,
69
+ approximate: p.total_approximate === true, floor: Number.isFinite(p.total_floor) ? p.total_floor : null,
70
+ present: p.present === true, note: p.note };
71
+ } catch (e) { return { ok: false, cause: `countHits threw: ${e.message}` }; }
72
+ },
73
+ // `reason`, not `cause`, on every refusal: the listing reads `reason` (register-records.mjs), so a
74
+ // Signa search that failed reached the workbook as "the search did not run", its cause dropped.
75
+ async listRecords({ name, matchMode, classes, regions, limit }, { agentId, sessionKey, recordLog = null }) {
76
+ if (!process.env.SIGNA_API_KEY) return { ok: false, records: null, reason: "SIGNA_API_KEY absent from driver env" };
77
+ let core;
78
+ try { core = await import("./core.js"); }
79
+ catch (e) { return { ok: false, records: null, reason: `plugin core unavailable: ${e.message}` }; }
80
+ const base = process.env.SIGNA_BASE_URL || core.DEFAULT_BASE;
81
+ try {
82
+ // The listing takes the same refusal as the count above, and for the same reason one level on:
83
+ // a narrower search here returns FEWER records under the wider query's name, so the listing
84
+ // would under-report and read as complete.
85
+ const signaListParams = core.toSignaParams({ name, match_mode: matchMode || "exact", nice_classes: classes, regions });
86
+ if (signaListParams.unsupported_match_mode) {
87
+ return { ok: false, records: null,
88
+ reason: `this register provider cannot express the "${signaListParams.unsupported_match_mode}" match mode, so this listing was not taken — it is not answered with a narrower search` };
89
+ }
90
+ const r = await core.doSearch(process.env.SIGNA_API_KEY, base,
91
+ { ...signaListParams, limit },
92
+ { kind: "search", agentId, sessionKey, sessionId: null, recordLog });
93
+ const text = typeof r?.text === "string" ? r.text : "";
94
+ if (text.startsWith("ERROR")) return { ok: false, records: null, reason: text.slice(0, 200) };
95
+ const p = JSON.parse(text);
96
+ // THE SEARCH ROW IS NOT THE LISTING'S RECORD. The row names the owner `owner`, the classes
97
+ // `nice_classes` and the filing date `filing_date`; the listing reads `owner_name`, `classes` and
98
+ // `application_date`. Handed over unmapped, every Signa filing reached the knockout with no owner,
99
+ // no classes and no filing date. Mapped here, as clarivate's adapter above maps its screen row.
100
+ //
101
+ // The office's own numbers come off the full record Signa returns on search, through the
102
+ // provider's own normaliser, so publish can address the office's page for each filing
103
+ // (publish/office-record-links.mjs) instead of showing the handle.
104
+ //
105
+ // THE TOTAL RIDES THE SAME ANSWER and is carried, not dropped: `include_total` puts the register's
106
+ // own count for this exact question on every search, so the listing of a term already holds the
107
+ // figure the count lane would ask for separately. An approximation stays one: no number in
108
+ // `total`, the floor beside it — the count lane's rule, unchanged.
109
+ return { ok: true,
110
+ total: Number.isFinite(p.total_hits) ? p.total_hits : null,
111
+ ...(p.total_approximate === true ? { approximate: true, floor: Number.isFinite(p.total_floor) ? p.total_floor : null } : {}),
112
+ // The register's own notes on this answer, carried whole as the clearance sweep carries them —
113
+ // `expanded_fallback` among them, which says the total counts records rather than marks. The
114
+ // knockout listing dropped them, so a knockout run could not show what a clearance run shows.
115
+ ...(Array.isArray(p.warnings) && p.warnings.length ? { warnings: p.warnings } : {}),
116
+ records: (Array.isArray(p.results) ? p.results : []).map((row) => {
117
+ const rec = row?.raw && typeof row.raw === "object" ? core.normalizeRecord(row.raw, row.office || null) : null;
118
+ return {
119
+ record_id: row?.record_id ?? null,
120
+ mark_text: row?.mark_text ?? null,
121
+ owner_name: rec?.owner ?? row?.owner ?? null,
122
+ owner_country: rec?.ownerCountry ?? null,
123
+ status: row?.status ?? null,
124
+ classes: Array.isArray(row?.nice_classes) ? row.nice_classes : null,
125
+ office: row?.office || null,
126
+ application_date: row?.filing_date ?? null,
127
+ registration_date: row?.registration_date ?? null,
128
+ application_number: rec?.applicationNumber ?? null,
129
+ registration_number: rec?.registrationNumber ?? null,
130
+ ir_number: rec?.irNumber ?? null,
131
+ filing_route: rec?.filingRoute ?? null,
132
+ // No page per record at Signa (hasPublicRecordUrl: false above), and none is made up here.
133
+ record_url: null,
134
+ // The office's own page as the register gives it, for publish to fall back on where it cannot
135
+ // address the office's page from the numbers above (office-record-links.mjs).
136
+ office_url: rec?.officeUrl ?? null,
137
+ };
138
+ }) };
139
+ } catch (e) { return { ok: false, records: null, reason: `listRecords threw: ${e.message}` }; }
140
+ },
141
+ async executePlan({ planPath, axis, outputPath, qids }, { agentId, sessionKey, recordLog = null, reaskTimedOut = false }) {
142
+ if (!process.env.SIGNA_API_KEY) return { ok: false, cause: "SIGNA_API_KEY absent from driver env" };
143
+ let core;
144
+ try { core = await import("./core.js"); }
145
+ catch (e) { return { ok: false, cause: `plugin core unavailable: ${e.message}` }; }
146
+ const base = process.env.SIGNA_BASE_URL || core.DEFAULT_BASE;
147
+ try {
148
+ const r = await core.doExecutePlan({ apiKey: process.env.SIGNA_API_KEY, base },
149
+ { plan_path: planPath, axis, output_path: outputPath, qids },
150
+ { kind: "execute_plan", agentId, sessionKey, sessionId: null, recordLog, ...(reaskTimedOut ? { reaskTimedOut: true } : {}) });
151
+ const text = typeof r?.text === "string" ? r.text : "";
152
+ if (text.startsWith("ERROR")) return { ok: false, cause: text.slice(0, 200) };
153
+ try { const summary = JSON.parse(text); return { ok: true, states: summary.states ?? {}, executed: summary.executed, skipped: summary.skipped ?? [] }; }
154
+ catch { return { ok: false, cause: `unparseable execute_plan summary: ${text.slice(0, 120)}` }; }
155
+ } catch (e) { return { ok: false, cause: `executePlan threw: ${e.message}` }; }
156
+ },
157
+ };