clearotron 0.5.1 → 0.6.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (379) 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 +49 -18
  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 +60 -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/best-draft.mjs +3 -3
  37. package/driver/blind-frame-record.mjs +2 -2
  38. package/driver/cancel.mjs +3 -2
  39. package/driver/carry-through.mjs +2 -2
  40. package/driver/citation-census.json +3 -3
  41. package/driver/clearance-variants-record.mjs +4 -10
  42. package/driver/common-law-coverage-status.mjs +3 -3
  43. package/driver/common-law-receipts.mjs +2 -2
  44. package/driver/compare.mjs +1 -1
  45. package/driver/config-inventory.mjs +6 -79
  46. package/driver/consumption-ledger.mjs +2 -1
  47. package/driver/contract-dictation-registry.mjs +5 -0
  48. package/driver/contract-e3-backlog.mjs +45 -66
  49. package/driver/contract-e3-baseline.json +16 -16
  50. package/driver/contract-vocabulary.mjs +8 -6
  51. package/driver/corrections-feedforward.mjs +3 -1
  52. package/driver/coverage-form-io.mjs +7 -8
  53. package/driver/coverage-tool.mjs +1 -1
  54. package/driver/declination-tool.mjs +2 -2
  55. package/driver/degraded-parts.mjs +9 -9
  56. package/driver/demo-container.mjs +5 -4
  57. package/driver/deploy-live-run-guard.mjs +19 -7
  58. package/driver/derived-state.mjs +2 -2
  59. package/driver/dev-portal.mjs +2 -1
  60. package/driver/dispatch-record.mjs +1 -1
  61. package/driver/disposition-tool.mjs +2 -1
  62. package/driver/doubt-closure-tool.mjs +2 -2
  63. package/driver/driver.config.mjs +35 -724
  64. package/driver/e2e-rounds.mjs +3 -4
  65. package/driver/engine/CONTRACT.md +3 -0
  66. package/driver/engine/README.md +2 -0
  67. package/driver/engine/anthropic-agent.mjs +8 -37
  68. package/driver/engine/auth.mjs +74 -0
  69. package/driver/engine/child-record.mjs +1 -1
  70. package/driver/engine/deny-authority-write.mjs +2 -2
  71. package/driver/engine/jx-turn.mjs +10 -2
  72. package/driver/engine/mcp/README.md +1 -1
  73. package/driver/engine/mcp/band-server.mjs +6 -6
  74. package/driver/engine/mcp/codex-config.mjs +1 -1
  75. package/driver/engine/mcp/declination-server.mjs +2 -3
  76. package/driver/engine/mcp/dispositions-server.mjs +3 -3
  77. package/driver/engine/mcp/gather-config.mjs +24 -19
  78. package/driver/engine/mcp/grid-provenance.mjs +1 -1
  79. package/driver/engine/mcp/held-answers.mjs +5 -5
  80. package/driver/engine/mcp/perplexity-server.mjs +16 -7
  81. package/driver/engine/mcp/recording-server.mjs +7 -6
  82. package/driver/engine/mcp/register-server.mjs +29 -0
  83. package/driver/engine/mcp/stdio-server.mjs +5 -5
  84. package/driver/engine/mcp/supplemental.mjs +9 -9
  85. package/driver/engine/openai-agent.mjs +5 -2
  86. package/driver/engine/registry.mjs +103 -0
  87. package/driver/engine/run-choices.mjs +162 -0
  88. package/driver/engine/stamps.mjs +35 -0
  89. package/driver/enqueue-schema.mjs +4 -4
  90. package/driver/envelope-settle.mjs +3 -2
  91. package/driver/feedback-issues.mjs +1 -1
  92. package/driver/feedback-mint.mjs +3 -2
  93. package/driver/feedback-store.mjs +3 -2
  94. package/driver/findings-model.mjs +1 -1
  95. package/driver/flag-snapshot.mjs +5 -4
  96. package/driver/floor-duty.mjs +3 -3
  97. package/driver/foreign-record-links.mjs +1 -1
  98. package/driver/frame-diff-record.mjs +2 -8
  99. package/driver/framework.mjs +1 -1
  100. package/driver/gate-metrics.mjs +10 -11
  101. package/driver/gateway.mjs +220 -839
  102. package/driver/goods-evidence.mjs +10 -6
  103. package/driver/jx-lanes.mjs +3 -3
  104. package/driver/jx-units.mjs +31 -37
  105. package/driver/jx.mjs +44 -59
  106. package/driver/knockout-assess-record.mjs +3 -3
  107. package/driver/knockout-caveats.mjs +21 -0
  108. package/driver/knockout-correction-record.mjs +58 -28
  109. package/driver/knockout-frame-record.mjs +2 -2
  110. package/driver/knockout-register-read.mjs +38 -21
  111. package/driver/knockout-register-record.mjs +5 -6
  112. package/driver/knockout-review-record.mjs +12 -11
  113. package/driver/ladder/model-gauge.mjs +88 -0
  114. package/driver/ladder/next-rung.mjs +296 -0
  115. package/driver/ladder/rescue.mjs +146 -0
  116. package/driver/ladder/stage-tools.mjs +57 -0
  117. package/driver/ladder/turn-failure.mjs +166 -0
  118. package/driver/log.mjs +2 -2
  119. package/driver/matter-frame-record.mjs +4 -4
  120. package/driver/methodology-witness.mjs +2 -2
  121. package/driver/narrative-refutation-record.mjs +145 -42
  122. package/driver/one-build-per-run.mjs +62 -0
  123. package/driver/outbox-backoff.mjs +4 -4
  124. package/driver/owner-screen.mjs +0 -10
  125. package/driver/owner-use-check.mjs +2 -28
  126. package/driver/package.json +1 -1
  127. package/driver/partial-payload-baseline.json +1 -1
  128. package/driver/parts-not-completed.mjs +1 -1
  129. package/driver/pipeline-knockout.mjs +1015 -1001
  130. package/driver/pipeline.mjs +511 -9265
  131. package/driver/placement-decisions.mjs +2 -2
  132. package/driver/placement-form-io.mjs +7 -9
  133. package/driver/placement-union.mjs +0 -6
  134. package/driver/plan-stability.mjs +7 -10
  135. package/driver/portal-acks.mjs +3 -2
  136. package/driver/portal-confirmation.mjs +48 -0
  137. package/driver/portal-families.mjs +3 -2
  138. package/driver/portal-local-auth.mjs +1 -2
  139. package/driver/portal-routes/README.md +24 -0
  140. package/driver/portal-routes/admin.mjs +425 -0
  141. package/driver/portal-routes/compose.mjs +66 -0
  142. package/driver/portal-routes/config.mjs +118 -0
  143. package/driver/portal-routes/connect.mjs +283 -0
  144. package/driver/portal-routes/feedback.mjs +178 -0
  145. package/driver/portal-routes/me.mjs +165 -0
  146. package/driver/portal-routes/queue.mjs +64 -0
  147. package/driver/portal-routes/report.mjs +106 -0
  148. package/driver/portal-routes/run.mjs +508 -0
  149. package/driver/portal-routes/runs.mjs +127 -0
  150. package/driver/portal-routes/usage.mjs +82 -0
  151. package/driver/portal-runs.mjs +588 -0
  152. package/driver/portal-service.mjs +78 -2592
  153. package/driver/portal-static.mjs +3 -1
  154. package/driver/predelivery-lint.mjs +92 -9
  155. package/driver/production-pool-guard.mjs +1 -1
  156. package/driver/profiles.mjs +5 -4
  157. package/driver/progress.mjs +29 -24
  158. package/driver/publish/README.md +10 -5
  159. package/driver/publish/archive-tags.mjs +3 -2
  160. package/driver/publish/demo-marking.mjs +2 -2
  161. package/driver/publish/index.mjs +215 -140
  162. package/driver/publish/knockout.mjs +153 -107
  163. package/driver/publish/office-record-links.mjs +22 -0
  164. package/driver/publish/parse.mjs +20 -5
  165. package/driver/publish/pool-admin.mjs +9 -3
  166. package/driver/publish/render.mjs +11 -3
  167. package/driver/publish/report-dates.mjs +3 -4
  168. package/driver/publish/report-registry.mjs +7 -10
  169. package/driver/publish/seed-pool.mjs +3 -2
  170. package/driver/publish/shell.mjs +106 -0
  171. package/driver/publish/templates/report.css +3 -1
  172. package/driver/queue-order.mjs +4 -3
  173. package/driver/record-carry.mjs +0 -9
  174. package/driver/record-discard.mjs +1 -4
  175. package/driver/record-fold.mjs +3 -3
  176. package/driver/record-goods.mjs +5 -5
  177. package/driver/reference-score.mjs +2 -3
  178. package/driver/register-capabilities.mjs +0 -6
  179. package/driver/register-count.mjs +3 -2
  180. package/driver/register-digest-record.mjs +7 -7
  181. package/driver/register-fixture-marker.mjs +3 -3
  182. package/driver/register-plan.mjs +2 -2
  183. package/driver/register-records.mjs +2 -2
  184. package/driver/register-taint.mjs +3 -3
  185. package/driver/register-unit-record.mjs +48 -9
  186. package/driver/register-unreachable.mjs +4 -3
  187. package/driver/registry-fidelity.mjs +79 -34
  188. package/driver/repair-composers.mjs +14 -9
  189. package/driver/repair-digest.mjs +4 -6
  190. package/driver/repair-scope.mjs +3 -3
  191. package/driver/repair-targets.mjs +24 -9
  192. package/driver/repairs.mjs +44 -58
  193. package/driver/replay-archive.mjs +7 -7
  194. package/driver/report-card-record.mjs +3 -3
  195. package/driver/report-overview-record.mjs +4 -4
  196. package/driver/research-answers.mjs +38 -6
  197. package/driver/research-checks.mjs +4 -4
  198. package/driver/result-noun-fields.mjs +28 -11
  199. package/driver/review-addresses.mjs +163 -0
  200. package/driver/rule-shape.mjs +1 -1
  201. package/driver/run-delivered.mjs +340 -0
  202. package/driver/run-economics.mjs +8 -26
  203. package/driver/run-failed.mjs +545 -0
  204. package/driver/run-integrity.mjs +1 -1
  205. package/driver/run-outcome.mjs +314 -0
  206. package/driver/run-park.mjs +23 -0
  207. package/driver/run-quote.mjs +32 -0
  208. package/driver/run-record.mjs +352 -0
  209. package/driver/run-requirements.mjs +22 -0
  210. package/driver/run-shell.mjs +55 -0
  211. package/driver/runner.mjs +71 -33
  212. package/driver/saved-register-pages.mjs +4 -4
  213. package/driver/score-redaction.mjs +2 -2
  214. package/driver/search-policy.mjs +12 -13
  215. package/driver/settle-stamp.mjs +4 -3
  216. package/driver/skeptic-record.mjs +2 -2
  217. package/driver/skeptic-search.mjs +1 -1
  218. package/driver/skills/README.md +7 -7
  219. package/driver/skills/blind-frame/SKILL.md +1 -2
  220. package/driver/skills/case-law-citation/SKILL.md +9 -37
  221. package/driver/skills/case-law-citation/sources/courtlistener.md +1 -3
  222. package/driver/skills/case-law-citation/sources/eurlex.md +8 -11
  223. package/driver/skills/case-law-citation/sources/legaldatahunter.md +1 -1
  224. package/driver/skills/clearance-common-law/SKILL.md +45 -111
  225. package/driver/skills/clearance-common-law/perplexity-prompts.md +7 -79
  226. package/driver/skills/clearance-register/SKILL.md +15 -33
  227. package/driver/skills/clearance-register/digest.md +31 -92
  228. package/driver/skills/clearance-register/providers/clarivate.md +2 -2
  229. package/driver/skills/clearance-register/providers/corsearch.md +5 -5
  230. package/driver/skills/clearance-register/providers/euipo.md +1 -2
  231. package/driver/skills/clearance-register/providers/free-tier.md +0 -19
  232. package/driver/skills/clearance-register/providers/signa.md +6 -25
  233. package/driver/skills/clearance-register/providers/uspto-local.md +0 -24
  234. package/driver/skills/clearance-register/register-recipes.md +8 -15
  235. package/driver/skills/clearance-register/status-rules.md +6 -24
  236. package/driver/skills/clearance-register/unit.md +11 -20
  237. package/driver/skills/clearance-search/delivery-contract.md +24 -120
  238. package/driver/skills/clearance-search/field-doctrine-pharma.md +1 -5
  239. package/driver/skills/clearance-search/firm-wide-reasoning.md +24 -43
  240. package/driver/skills/clearance-search/phase2-execution.md +29 -77
  241. package/driver/skills/clearance-search/report-prose.md +3 -4
  242. package/driver/skills/clearance-search/risk-framework-demo.md +1 -1
  243. package/driver/skills/clearance-search/risk-framework-triage.manifest.json +3 -3
  244. package/driver/skills/clearance-search/risk-framework-triage.md +7 -9
  245. package/driver/skills/clearance-search/risk-framework.manifest.json +1 -1
  246. package/driver/skills/clearance-search/risk-framework.md +1 -1
  247. package/driver/skills/clearance-search/synthesis-rules.md +30 -107
  248. package/driver/skills/clearance-search/worked-examples.md +5 -5
  249. package/driver/skills/clearance-variants/SKILL.md +46 -45
  250. package/driver/skills/clearance-variants/transliteration-scripts.md +4 -4
  251. package/driver/skills/frame-diff/SKILL.md +1 -1
  252. package/driver/skills/knockout-assess/SKILL.md +6 -14
  253. package/driver/skills/knockout-frame/SKILL.md +1 -1
  254. package/driver/skills/matter-frame/SKILL.md +7 -12
  255. package/driver/skills/matter-frame/watchlist-reference.md +1 -4
  256. package/driver/skills/narrative-refutation/SKILL.md +20 -30
  257. package/driver/skills/placement-inquiry/SKILL.md +8 -18
  258. package/driver/skills-store-provenance.mjs +1 -1
  259. package/driver/stage-context.mjs +32 -35
  260. package/driver/stage-freshness.mjs +127 -11
  261. package/driver/stages-knockout.mjs +49 -22
  262. package/driver/stages.mjs +88 -283
  263. package/driver/status-snapshot.mjs +2 -1
  264. package/driver/steps/correction-cycle.mjs +311 -0
  265. package/driver/steps/corrections.mjs +644 -0
  266. package/driver/steps/delivery.mjs +1287 -0
  267. package/driver/steps/frame-comparison.mjs +922 -0
  268. package/driver/steps/intake.mjs +84 -0
  269. package/driver/steps/open-run.mjs +419 -0
  270. package/driver/steps/overview-and-cards.mjs +899 -0
  271. package/driver/steps/placement-and-digest.mjs +23 -0
  272. package/driver/steps/register-sweep.mjs +1563 -0
  273. package/driver/steps/skeptic-and-follow-up.mjs +831 -0
  274. package/driver/steps/synthesis.mjs +261 -0
  275. package/driver/steps/verdict-gate.mjs +968 -0
  276. package/driver/suite-census.json +403 -91
  277. package/driver/surface-exit-verdict.mjs +0 -8
  278. package/driver/synthesis-record.mjs +72 -6
  279. package/driver/terminal-clamp.mjs +10 -0
  280. package/driver/tokens.mjs +8 -62
  281. package/driver/tool-calls.mjs +2 -2
  282. package/driver/unit-state-verdict.mjs +1 -1
  283. package/driver/usage-ledger.mjs +2 -1
  284. package/driver/verify-knockout.mjs +20 -35
  285. package/driver/verify.mjs +47 -36
  286. package/driver/web-grid.mjs +3 -4
  287. package/driver/whatif-memo-run.mjs +2 -2
  288. package/driver/whatif-queue.mjs +4 -3
  289. package/driver/withheld-families.mjs +14 -15
  290. package/driver/worker-heartbeat.mjs +3 -2
  291. package/driver/write-up-form.mjs +0 -3
  292. package/mcp-server/CHANGELOG.md +4 -0
  293. package/mcp-server/http-server.mjs +1 -1
  294. package/mcp-server/lib/brief.mjs +22 -4
  295. package/mcp-server/lib/events.mjs +2 -2
  296. package/mcp-server/lib/evidence.mjs +3 -2
  297. package/mcp-server/lib/findings.mjs +2 -1
  298. package/mcp-server/lib/knockout.mjs +9 -10
  299. package/mcp-server/lib/ops.mjs +9 -9
  300. package/mcp-server/lib/runs.mjs +9 -10
  301. package/mcp-server/lib/trace.mjs +1 -1
  302. package/mcp-server/lib/whatif.mjs +2 -3
  303. package/mcp-server/package.json +1 -1
  304. package/mcp-server/server.mjs +5 -5
  305. package/package.json +2 -1
  306. package/portal-ui/dist/assets/{index-fPqAU0sx.js → index-D5rkCjDc.js} +26 -14
  307. package/portal-ui/dist/index.html +1 -1
  308. package/portal-ui/package.json +3 -3
  309. package/providers/README.md +1 -1
  310. package/providers/_shared/answer-memory.mjs +4 -5
  311. package/providers/_shared/execute-plan.mjs +48 -1
  312. package/providers/_shared/records-from-search.mjs +46 -0
  313. package/providers/clarivate/README.md +2 -2
  314. package/providers/clarivate/src/adapter.js +147 -0
  315. package/providers/clarivate/src/core.js +1 -14
  316. package/{driver/engine/mcp/clarivate-server.mjs → providers/clarivate/src/mount.js} +5 -10
  317. package/providers/corsearch/README.md +3 -3
  318. package/providers/corsearch/src/adapter.js +80 -0
  319. package/providers/corsearch/src/core.js +14 -11
  320. package/{driver/engine/mcp/corsearch-server.mjs → providers/corsearch/src/mount.js} +5 -10
  321. package/providers/euipo/README.md +2 -2
  322. package/providers/euipo/src/adapter.js +85 -0
  323. package/providers/euipo/src/core.js +1 -1
  324. package/providers/euipo/src/euipo-client.js +1 -2
  325. package/{driver/engine/mcp/euipo-server.mjs → providers/euipo/src/mount.js} +5 -10
  326. package/providers/free-tier/README.md +2 -2
  327. package/providers/free-tier/src/adapter.js +127 -0
  328. package/{driver/engine/mcp/free-tier-server.mjs → providers/free-tier/src/mount.js} +5 -10
  329. package/providers/jx-subclass/coverage.mjs +1 -6
  330. package/providers/jx-subclass/score-truth.mjs +2 -1
  331. package/providers/oauth-mcp-bridge/CHANGELOG.md +4 -0
  332. package/providers/oauth-mcp-bridge/package.json +1 -1
  333. package/providers/perplexity/src/core.js +2 -2
  334. package/providers/signa/README.md +2 -2
  335. package/providers/signa/src/adapter.js +157 -0
  336. package/providers/signa/src/capabilities.js +0 -3
  337. package/providers/signa/src/core.js +2 -2
  338. package/{driver/engine/mcp/signa-server.mjs → providers/signa/src/mount.js} +7 -12
  339. package/providers/signa/src/offices.generated.js +17 -15
  340. package/providers/uspto-local/README.md +1 -1
  341. package/providers/uspto-local/bin/verify-index.mjs +1 -1
  342. package/providers/uspto-local/src/adapter.js +75 -0
  343. package/{driver/engine/mcp/uspto-local-server.mjs → providers/uspto-local/src/mount.js} +5 -10
  344. package/scripts/band-shape-probe.mjs +2 -2
  345. package/scripts/citation-line-check.mjs +7 -7
  346. package/scripts/compare.mjs +1 -1
  347. package/scripts/dead-names.mjs +2 -2
  348. package/scripts/e2e-first-time.mjs +19 -7
  349. package/scripts/e2e.mjs +13 -13
  350. package/scripts/engine-probe.mjs +1 -1
  351. package/scripts/env-audit.mjs +7 -4
  352. package/scripts/env-classify.mjs +5 -1
  353. package/scripts/feedback-mint.mjs +1 -1
  354. package/scripts/freeze-example-run.mjs +7 -7
  355. package/scripts/mint-suite-census.mjs +2 -2
  356. package/scripts/nightly-notice.mjs +1 -1
  357. package/scripts/release-cut-decision.mjs +7 -2
  358. package/scripts/release-note-required.mjs +26 -9
  359. package/scripts/release-notes-lint.mjs +3 -2
  360. package/scripts/release-version-pr-checks.mjs +1 -1
  361. package/scripts/settings-render-check.mjs +23 -3
  362. package/scripts/test-run.mjs +5 -5
  363. package/scripts/travelling-predicates.mjs +1 -1
  364. package/scripts/undeclared-field-census.mjs +1 -1
  365. package/scripts/unexecuted-asserts.mjs +1 -1
  366. package/scripts/verify-publishable.mjs +1 -1
  367. package/shared/client-door.mjs +1 -1
  368. package/shared/connect-clients.mjs +1 -1
  369. package/shared/connector-signin-probe.mjs +1 -1
  370. package/shared/env-aliases.mjs +1 -1
  371. package/shared/invocation.mjs +14 -2
  372. package/shared/names-in-force.mjs +2 -0
  373. package/shared/register-selection.mjs +2 -2
  374. package/shared/store-in-repo.mjs +3 -3
  375. package/shared/summary-blocks.mjs +0 -3
  376. package/shared/trigger-lane.mjs +1 -1
  377. package/shared/vacuous-pass.mjs +2 -2
  378. package/shared/verb-shim.mjs +4 -2
  379. package/node_modules/exceljs/README.md +0 -3023
@@ -35,10 +35,11 @@
35
35
  // A model free-typing into `classes:` welded an engine clause onto a class list. Structured KEYS are the
36
36
  // allowlist; structured VALUES still have to be recognised, not trusted.
37
37
 
38
- import { existsSync, readFileSync } from "node:fs";
38
+ import { existsSync } from "node:fs";
39
39
  import { join } from "node:path";
40
40
  import { parseAudit, stripEngineInternals } from "./driver.mjs";
41
41
  import { readRecordArtifacts } from "../../driver/registry-fidelity.mjs";
42
+ import { readJson } from "../../driver/run-record.mjs";
42
43
 
43
44
  // The client report's own display word per coverage state (publish/render.mjs COV_STATE). Carried here so
44
45
  // the connector and the PDF call the same state the same thing; a state absent from the map degrades to
@@ -81,7 +82,7 @@ const clean = (s) => {
81
82
  // below IS the rule, and it lives in exactly one place.
82
83
  function readFindingsJson(runDir) {
83
84
  try {
84
- const doc = JSON.parse(readFileSync(join(runDir, "findings.json"), "utf8"));
85
+ const doc = readJson(join(runDir, "findings.json"));
85
86
  return (doc && typeof doc === "object" && !Array.isArray(doc)) ? doc : null;
86
87
  } catch { return null; }
87
88
  }
@@ -9,6 +9,7 @@
9
9
 
10
10
  import { existsSync, readFileSync } from "node:fs";
11
11
  import { parseAudit, parseReport, parseBlocks, parseFront, parseSections, buildAuditMd, placementAuditRows } from "./driver.mjs";
12
+ import { readJson } from "../../driver/run-record.mjs";
12
13
 
13
14
  // id-stamp the three block lists so callers (get_finding / trace) can address a single record.
14
15
  function idStamp(lists) {
@@ -26,7 +27,7 @@ function idStamp(lists) {
26
27
  function readRunFindings(P) {
27
28
  try {
28
29
  if (!P?.findings || !existsSync(P.findings)) return null;
29
- const j = JSON.parse(readFileSync(P.findings, "utf8"));
30
+ const j = readJson(P.findings);
30
31
  if (Array.isArray(j)) return j;
31
32
  return Array.isArray(j?.findings) ? j.findings : null;
32
33
  } catch { return null; }
@@ -24,13 +24,12 @@
24
24
  //
25
25
  // AND THE RULE THAT MATTERS MOST: a projection with no knockout equivalent returns a STATED refusal, never
26
26
  // an empty list. `[]` reads as "we looked and found nothing" — that reading is the whole incident above.
27
- import { existsSync, readFileSync, readdirSync } from "node:fs";
27
+ import { existsSync, readdirSync } from "node:fs";
28
28
  import { basename, join } from "node:path";
29
29
 
30
30
  import { koPaths, addressListedFilings, declaredRecordOrigins } from "./driver.mjs";
31
- import { driverDir } from "../../shared/driver-dir.mjs";
31
+ import { paths, readJsonOrNull } from "../../driver/run-record.mjs";
32
32
 
33
- const readJson = (p) => { try { return JSON.parse(readFileSync(p, "utf8")); } catch { return null; } };
34
33
 
35
34
  /**
36
35
  * Is this run a knockout? Answered from DISK, never from a stored lane string.
@@ -47,7 +46,7 @@ export function isKnockoutRun(run) {
47
46
 
48
47
  /** The assessment artifact, parsed. `null` when the run has not reached the assess stage (or it failed). */
49
48
  export function knockoutDoc(run) {
50
- return run?.runDir ? readJson(koPaths(run.runDir).findings) : null;
49
+ return run?.runDir ? readJsonOrNull(koPaths(run.runDir).findings) : null;
51
50
  }
52
51
 
53
52
  const marksOf = (doc) => (Array.isArray(doc?.marks) ? doc.marks : []);
@@ -86,7 +85,7 @@ export function knockoutArtifacts(run) {
86
85
  { name: "registerCounts", file: basename(K.registerCounts), path: K.registerCounts },
87
86
  { name: "registerRecords", file: basename(K.registerRecords), path: K.registerRecords },
88
87
  { name: "sweepLedger", file: basename(K.sweepLedger), path: K.sweepLedger },
89
- { name: "runLog", file: "run.jsonl", path: driverDir(run.runDir, "run.jsonl") },
88
+ { name: "runLog", file: "run.jsonl", path: paths(run.runDir).run },
90
89
  ].map((a) => ({ name: a.name, file: a.file, exists: existsSync(a.path) }));
91
90
 
92
91
  // The published half. A knockout's report lives in the pool and NOWHERE in the run dir, so a list built
@@ -126,7 +125,7 @@ export function knockoutArtifactPath(run, name) {
126
125
  const direct = {
127
126
  frame: K.frame, plan: K.plan, findings: K.findings, assessment: K.assessment,
128
127
  registerCounts: K.registerCounts, registerRecords: K.registerRecords,
129
- sweepLedger: K.sweepLedger, "run.jsonl": driverDir(run.runDir, "run.jsonl"),
128
+ sweepLedger: K.sweepLedger, "run.jsonl": paths(run.runDir).run,
130
129
  }[name];
131
130
  if (direct) return direct;
132
131
  if (name?.startsWith("research:")) return K.research(name.slice("research:".length));
@@ -206,7 +205,7 @@ const knockoutNegatives = (doc) => marksOf(doc).flatMap((m) =>
206
205
  */
207
206
  export function knockoutEvidence(run) {
208
207
  const doc = knockoutDoc(run);
209
- const recordsDoc = readJson(koPaths(run.runDir).registerRecords);
208
+ const recordsDoc = readJsonOrNull(koPaths(run.runDir).registerRecords);
210
209
  // EACH FILING ADDRESSED AS PUBLISH ADDRESSES IT, keyed on the sidecar's own register. On a register with
211
210
  // no record pages of its own, the listing's link is the engine's handle, `/mark/<office>/<id>`, which a
212
211
  // reader can open nowhere, and the report never shows it for a filing with an office number: it gives the
@@ -285,7 +284,7 @@ export function knockoutSearches(run) {
285
284
  }
286
285
  // The register lane's own asked-and-unanswered terms, when it ran. `terms[].ok === false` is a search
287
286
  // that did NOT answer — reporting it as a clean no-hit would be the un-run check dressed as a negative.
288
- const recordsDoc = readJson(koPaths(run.runDir).registerRecords);
287
+ const recordsDoc = readJsonOrNull(koPaths(run.runDir).registerRecords);
289
288
  for (const entry of (Array.isArray(recordsDoc?.marks) ? recordsDoc.marks : [])) {
290
289
  for (const t of (Array.isArray(entry.terms) ? entry.terms : [])) {
291
290
  searches.push({
@@ -329,8 +328,8 @@ export function knockoutCoverage(run) {
329
328
  + `${(m.findings ?? []).length} conflict(s) recorded, ${(m.negatives ?? []).length} search(es) recorded as returning nothing.`,
330
329
  }));
331
330
 
332
- const recordsDoc = readJson(koPaths(run.runDir).registerRecords);
333
- const countsDoc = readJson(koPaths(run.runDir).registerCounts);
331
+ const recordsDoc = readJsonOrNull(koPaths(run.runDir).registerRecords);
332
+ const countsDoc = readJsonOrNull(koPaths(run.runDir).registerCounts);
334
333
  if (recordsDoc || countsDoc) {
335
334
  areas.push({
336
335
  area: "Register",
@@ -10,7 +10,6 @@
10
10
 
11
11
  import { writeFileSync, existsSync, mkdirSync, rmSync, renameSync, readFileSync, readdirSync } from "node:fs";
12
12
  import { join, basename } from "node:path";
13
- import { driverDir } from "../../shared/driver-dir.mjs"; // — one definition of where `_driver/` is
14
13
  import { randomUUID } from "node:crypto";
15
14
  import { config } from "./driver.mjs";
16
15
  import { validateJob } from "../../driver/enqueue-schema.mjs";
@@ -23,6 +22,7 @@ import { readEngineChild, engineChildIsLive, endEngineChild } from "../../driver
23
22
  import { killEscalateMs } from "../../driver/engine/common.mjs"; // the watchdogs' grace, reused by an immediate stop
24
23
  import { stopReason } from "../../shared/stop-reason.mjs"; //
25
24
  import { envFrom } from "../../shared/env-aliases.mjs"; // — resolves EITHER spelling; names the retired one because that is the live-writable half
25
+ import { driverDir, paths, readJson } from "../../driver/run-record.mjs"; // — one definition of where `_driver/` is
26
26
 
27
27
  // Queue resolution (mirrors the enqueue CLI, docs/INTAKE.md): with NO explicit agent, a
28
28
  // headless deployment's CLEAROTRON_QUEUE_DIR wins; otherwise the default agent's workspace queue. An
@@ -326,7 +326,7 @@ export async function stopRun(args = {}, { scope, endTurn = endEngineChild } = {
326
326
  const scopedOut = (file) => {
327
327
  if (!Array.isArray(scope?.accounts)) return false;
328
328
  let jobAccount = null;
329
- try { jobAccount = JSON.parse(readFileSync(file, "utf8")).profileKey ?? "generic"; } catch { jobAccount = null; }
329
+ try { jobAccount = readJson(file).profileKey ?? "generic"; } catch { jobAccount = null; }
330
330
  try { assertAccountAccess(scope, jobAccount, `queued job "${args.id}"`); return false; } catch { return true; }
331
331
  };
332
332
  if (existsSync(f)) {
@@ -435,7 +435,7 @@ export async function stopRun(args = {}, { scope, endTurn = endEngineChild } = {
435
435
  let wrote = false;
436
436
  try {
437
437
  const sp = join(run.runDir, "status.json");
438
- const s = JSON.parse(readFileSync(sp, "utf8"));
438
+ const s = readJson(sp);
439
439
  // BOTH due-clock keys are cleared (A4 split: resetsAt = rate-limit cap, recoveryResumesAt =
440
440
  // recovery backoff) — a cancelled recovery-parked run must not keep a stale resume clock.
441
441
  // — the sidecar written just below already carried `via`/`by`; status.json nulled it, so a
@@ -462,7 +462,7 @@ export async function stopRun(args = {}, { scope, endTurn = endEngineChild } = {
462
462
  if (!alreadyStopping) {
463
463
  try {
464
464
  const sp = join(run.runDir, "status.json");
465
- const s = JSON.parse(readFileSync(sp, "utf8"));
465
+ const s = readJson(sp);
466
466
  s.stopRequestedAt = rec?.ts ?? new Date().toISOString();
467
467
  s.updatedAt = new Date().toISOString();
468
468
  writeFileSync(sp, JSON.stringify(s, null, 2) + "\n");
@@ -523,7 +523,7 @@ export function getDeliveryPacket(args = {}) {
523
523
  if (!args.runId) throw new Error("get_delivery_packet: runId is required");
524
524
  const run = resolveRun(String(args.runId));
525
525
  if (!run) throw new Error(`get_delivery_packet: run "${args.runId}" not found`);
526
- const read = (n) => { try { return JSON.parse(readFileSync(driverDir(run.runDir, n), "utf8")); } catch { return null; } };
526
+ const read = (n) => { try { return readJson(driverDir(run.runDir, n)); } catch { return null; } };
527
527
  const delivery = read("delivery.json");
528
528
  const failure = read("failure.json");
529
529
  if (!delivery && !failure)
@@ -623,8 +623,8 @@ export function markSent(args = {}) {
623
623
  if (!args.runId) throw new Error("mark_sent: runId is required");
624
624
  const run = resolveRun(String(args.runId));
625
625
  if (!run) throw new Error(`mark_sent: run "${args.runId}" not found`);
626
- const deliveryPath = driverDir(run.runDir, "delivery.json");
627
- const failurePath = driverDir(run.runDir, "failure.json");
626
+ const deliveryPath = paths(run.runDir).delivery;
627
+ const failurePath = paths(run.runDir).failure;
628
628
  const packetPath = existsSync(deliveryPath) ? deliveryPath : failurePath;
629
629
  if (!existsSync(packetPath))
630
630
  throw new Error(`mark_sent: run "${run.runId}" has no delivery or failure packet — nothing was pending a send`);
@@ -645,7 +645,7 @@ export function markSent(args = {}) {
645
645
  // already applies when it decides a marker is already queued (charter P1 §3): one settle clears every
646
646
  // name that delivery could have been minted under. Best-effort per form; a missing one is a no-op.
647
647
  const clearMarker = () => {
648
- const packet = (() => { try { return JSON.parse(readFileSync(packetPath, "utf8")); } catch { return {}; } })();
648
+ const packet = (() => { try { return readJson(packetPath); } catch { return {}; } })();
649
649
  const sanitize = (s) => String(s).replace(/[^A-Za-z0-9._-]/g, "_"); // rescanOwedRuns' own marker-name gate
650
650
  // The three OBSERVED ids are not the whole set: rescanOwedRuns DERIVES the legacy
651
651
  // `<slug>-<codename>` form (outbox-backoff.mjs), and a marker minted under that name is named by
@@ -702,7 +702,7 @@ export function markSent(args = {}) {
702
702
  let statusFlipped = true;
703
703
  try {
704
704
  const sp = join(run.runDir, "status.json");
705
- const status = JSON.parse(readFileSync(sp, "utf8"));
705
+ const status = readJson(sp);
706
706
  status.sendPending = false;
707
707
  writeFileSync(`${sp}.tmp`, JSON.stringify(status, null, 2) + "\n");
708
708
  renameSync(`${sp}.tmp`, sp);
@@ -6,11 +6,11 @@
6
6
  // importing it, so the MCP stays a pure additive consumer (no edit to the shared driver file the parallel
7
7
  // skill work may also touch). Keep SKIP_DIRS in sync with progress.mjs if that walk ever changes.
8
8
 
9
- import { readdirSync, readFileSync, existsSync } from "node:fs";
9
+ import { readdirSync, existsSync } from "node:fs";
10
10
  import { join } from "node:path";
11
- import { DRIVER_DIR, driverDir } from "../../shared/driver-dir.mjs"; //
12
11
  import { channelPackage } from "../../shared/permanent-install.mjs"; // — the check a reader is sent to, on this install's channel
13
12
  import { config, paths, reportIdentityFor } from "./driver.mjs";
13
+ import { DRIVER_DIR, readJson, readJsonOrNull } from "../../driver/run-record.mjs";
14
14
 
15
15
  // Mirror of progress.mjs SKIP_DIRS — the high-churn leaf dirs that never hold a run-level status.json.
16
16
  const SKIP_DIRS = new Set([DRIVER_DIR, "register-units", "queue", "_history", "_experiments"]);
@@ -53,7 +53,7 @@ export const bandWord = (v) => {
53
53
  export function tierFromRecord(runDir) {
54
54
  if (!runDir) return null;
55
55
  try {
56
- const v = JSON.parse(readFileSync(driverDir(runDir, "verdict.json"), "utf8"));
56
+ const v = readJson(paths(runDir).verdict);
57
57
  const t = String(v?.tier ?? "").trim();
58
58
  return t || null;
59
59
  } catch { return null; }
@@ -90,12 +90,11 @@ export function studioRoots() {
90
90
  return out;
91
91
  }
92
92
 
93
- function readJson(p) { try { return JSON.parse(readFileSync(p, "utf8")); } catch { return null; } }
94
93
 
95
94
  // Build a Run summary from a status.json path. runDir = its parent; location from the path (archive vs live).
96
95
  function runFromStatusFile(statusFile, agent) {
97
96
  const runDir = statusFile.slice(0, -"/status.json".length);
98
- const s = readJson(statusFile);
97
+ const s = readJsonOrNull(statusFile);
99
98
  if (!s || !s.slug || !s.codename) return null; // a torn/partial status.json is skipped, never thrown
100
99
  return {
101
100
  runId: s.runId ?? `${s.slug}-${s.date}-${s.codename}`,
@@ -221,7 +220,7 @@ export function readReportData(run) {
221
220
  let names = [];
222
221
  try { names = readdirSync(dir).filter((n) => /^report-data(-.+)?\.json$/.test(n)).sort(); } catch { return []; }
223
222
  const out = [];
224
- for (const n of names) { const d = readJson(join(dir, n)); if (d && typeof d === "object") out.push(d); }
223
+ for (const n of names) { const d = readJsonOrNull(join(dir, n)); if (d && typeof d === "object") out.push(d); }
225
224
  return out;
226
225
  }
227
226
 
@@ -240,7 +239,7 @@ export function readReportData(run) {
240
239
  // render-knockout.mjs).
241
240
  export function productIdentityFor(run, docs = null) {
242
241
  try {
243
- const pol = JSON.parse(readFileSync(driverDir(run.runDir, "search-policy.json"), "utf8"));
242
+ const pol = readJson(paths(run.runDir).searchPolicy);
244
243
  const id = reportIdentityFor(pol).identity;
245
244
  if (id) return id;
246
245
  } catch { /* no frozen sidecar on this run — fall through to the published level id */ }
@@ -261,7 +260,7 @@ export function productIdentityFor(run, docs = null) {
261
260
  // full-grant sessions.
262
261
  export function runAccountKey(run) {
263
262
  try {
264
- const p = JSON.parse(readFileSync(driverDir(run.runDir, "profile.json"), "utf8"));
263
+ const p = readJson(paths(run.runDir).profile);
265
264
  return p.profileKey ?? p.key ?? null;
266
265
  } catch { return null; }
267
266
  }
@@ -280,7 +279,7 @@ export function runAccountKey(run) {
280
279
  // `known: false` says the engine cannot tell, which is a different sentence and an actionable one.
281
280
  export function runProfileFacts(run) {
282
281
  try {
283
- const p = JSON.parse(readFileSync(driverDir(run.runDir, "profile.json"), "utf8"));
282
+ const p = readJson(paths(run.runDir).profile);
284
283
  const key = p.profileKey ?? p.key ?? null;
285
284
  return {
286
285
  known: true,
@@ -299,7 +298,7 @@ export function runProfileFacts(run) {
299
298
  // visible only to a full-grant session.
300
299
  export function runOrganisation(run) {
301
300
  try {
302
- const p = JSON.parse(readFileSync(driverDir(run.runDir, "profile.json"), "utf8"));
301
+ const p = readJson(paths(run.runDir).profile);
303
302
  return typeof p.organisation === "string" && p.organisation ? p.organisation : null;
304
303
  } catch { return null; }
305
304
  }
@@ -14,7 +14,7 @@
14
14
 
15
15
  import { readFileSync, existsSync, readdirSync } from "node:fs";
16
16
  import { join, basename } from "node:path";
17
- import { driverDir, driverFileName } from "../../shared/driver-dir.mjs"; //
17
+ import { driverDir, driverFileName } from "../../driver/run-record.mjs"; //
18
18
  import { STAGES, STAGE_ORDER, stageInputs, stageOrdinal, REGISTER_AXES, fileMeta, parseVerdict } from "./driver.mjs";
19
19
  import { loadFindings } from "./findings.mjs";
20
20
  import { providerUsage } from "./usage.mjs";
@@ -23,12 +23,11 @@
23
23
  import { STAGES, STAGE_ORDER, stageOrdinal, REGISTER_AXES, axisTier, resolveModel, config, deriveSlug } from "./driver.mjs";
24
24
  import { readCapped } from "./util.mjs";
25
25
  import { join, basename } from "node:path";
26
- import { readFileSync } from "node:fs"; // the canonical run's frozen profile
27
- import { driverDir } from "../../shared/driver-dir.mjs"; //
28
26
  // — the SHARED eligibility composer. A leaf module (fs/path/crypto only), so a
29
27
  // static import here costs the read-only surface nothing and buys the one thing three copies of this
30
28
  // question could not give: the same answer at the door and at the worker.
31
29
  import { whatIfRefusal } from "../../driver/whatif-queue.mjs";
30
+ import { driverDir, paths, readJson } from "../../driver/run-record.mjs";
32
31
 
33
32
  // ── — THE NOTE SAYS WHAT IS TRUE, AND IT IS THE STRONGER SENTENCE ────────
34
33
  //
@@ -294,7 +293,7 @@ export async function whatIfRun({ confirmationToken } = {}, deps = {}) {
294
293
  // resolveProfile THROWS `profile_key_unknown` on a named key it cannot find, so a what-if against a
295
294
  // store that no longer holds the customer now refuses instead of substituting one.
296
295
  const canonicalProfileKey = (() => {
297
- try { return JSON.parse(readFileSync(driverDir(run.runDir, "profile.json"), "utf8"))?.profileKey ?? null; }
296
+ try { return readJson(paths(run.runDir).profile)?.profileKey ?? null; }
298
297
  catch { return null; }
299
298
  })();
300
299
  if (canonicalProfileKey) job.profileKey = canonicalProfileKey;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trademark-artifacts-mcp",
3
- "version": "0.5.1",
3
+ "version": "0.6.0-beta.0",
4
4
  "license": "AGPL-3.0-only",
5
5
  "private": true,
6
6
  "description": "MCP server to interrogate clearotron trademark-clearance runs — list/read artifacts, trace the full decision flow, telemetry/cost, coverage, single-run search, and a gated single-step what-if. Imports the clearotron-driver read-only; touches no driver/template/deploy files.",
@@ -26,9 +26,8 @@ import {
26
26
  ListResourcesRequestSchema, ReadResourceRequestSchema, ListResourceTemplatesRequestSchema,
27
27
  ListPromptsRequestSchema, GetPromptRequestSchema,
28
28
  } from "@modelcontextprotocol/sdk/types.js";
29
- import { existsSync, readdirSync, readFileSync } from "node:fs";
29
+ import { existsSync, readdirSync } from "node:fs";
30
30
  import { join, basename } from "node:path";
31
- import { driverDir } from "../shared/driver-dir.mjs"; //
32
31
  import { fileURLToPath } from "node:url";
33
32
 
34
33
  import { enumerateRuns, resolveRun, runAccountKey, runOrganisation, runProfileFacts, productIdentityFor, unreadableRunsReason } from "./lib/runs.mjs";
@@ -93,6 +92,7 @@ import { instructionsFor } from "./lib/instructions.mjs";
93
92
  import { isEntrypoint } from "../shared/is-entrypoint.mjs"; // — one entry-point test, all spellings
94
93
  import { BRAND } from "../shared/brand.mjs"; // — the operator name a client is told to expect, from the tenant seam
95
94
  import { productIdentity } from "../shared/product-identity.mjs"; // AGPL §13 — one answer, three surfaces
95
+ import { driverDir, readJson } from "../driver/run-record.mjs";
96
96
 
97
97
  const NS = "trademark-artifacts";
98
98
  const log = (...a) => process.stderr.write(`[${NS}] ${a.join(" ")}\n`);
@@ -129,7 +129,7 @@ function artifactPath(run, name) {
129
129
  // That is the defect this issue is about, reappearing one layer down. Returning null instead makes the
130
130
  // tool refuse the name and name the artifacts this run actually has.
131
131
  if (isKnockoutRun(run)) return knockoutArtifactPath(run, name);
132
- if (name === "run.jsonl" || name === "telemetry/run.jsonl") return driverDir(runDir, "run.jsonl");
132
+ if (name === "run.jsonl" || name === "telemetry/run.jsonl") return paths(runDir).run;
133
133
  if (REGISTER_AXES.includes(name)) return P.registerUnit(name);
134
134
  // validate the axis against the known set — never let a "registerUnit:../../x" escape the run-dir
135
135
  if (name.startsWith("registerUnit:")) { const ax = name.split(":")[1]; return REGISTER_AXES.includes(ax) ? P.registerUnit(ax) : null; }
@@ -148,7 +148,7 @@ function listArtifacts(run) {
148
148
  for (const [k, v] of Object.entries(P)) { if (k === "runDir" || typeof v === "function") continue; if (existsSync(v)) out.push({ name: k, file: basename(v) }); }
149
149
  for (const ax of REGISTER_AXES) { const p = P.registerUnit(ax); if (existsSync(p)) out.push({ name: `registerUnit:${ax}`, file: basename(p) }); }
150
150
  if (existsSync(join(run.runDir, "status.json"))) out.push({ name: "status.json", file: "status.json" });
151
- if (existsSync(driverDir(run.runDir, "run.jsonl"))) out.push({ name: "run.jsonl", file: "_driver/run.jsonl" });
151
+ if (existsSync(paths(run.runDir).run)) out.push({ name: "run.jsonl", file: "_driver/run.jsonl" });
152
152
  return out;
153
153
  }
154
154
 
@@ -250,7 +250,7 @@ function runSummary(run) {
250
250
  function channelState(runDir) {
251
251
  const legacySent = existsSync(join(runDir, ".sent"));
252
252
  let receipts = {};
253
- try { receipts = JSON.parse(readFileSync(driverDir(runDir, "send-receipts.json"), "utf8")) ?? {}; }
253
+ try { receipts = readJson(paths(runDir).sendReceipts) ?? {}; }
254
254
  catch { /* absent (fresh/legacy run) or unreadable — fall back to the .sent marker alone */ }
255
255
  const chan = (key, idField) => ({
256
256
  sent: Boolean(receipts[key]) || legacySent,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "clearotron",
3
3
  "mcpName": "io.github.CordilleraSarl/clearotron",
4
4
  "type": "module",
5
- "version": "0.5.1",
5
+ "version": "0.6.0-beta.0",
6
6
  "license": "AGPL-3.0-only",
7
7
  "repository": {
8
8
  "type": "git",
@@ -129,6 +129,7 @@
129
129
  "!driver/skills/clearance-search/worked-examples-*",
130
130
  "driver/skills/clearance-search/worked-examples.md",
131
131
  "driver/skills/clearance-search/worked-examples-demo.md",
132
+ "!scripts/secret-scanner-fetch.mjs",
132
133
  "!scripts/home-render-check.mjs",
133
134
  "!scripts/ai-page-render-check.mjs",
134
135
  "!scripts/composer-render-check.mjs",
@@ -11446,6 +11446,9 @@ function runKey(run) {
11446
11446
  // src/contract/api.ts
11447
11447
  var isOk = (r) => r.kind === "ok";
11448
11448
  var companyRead = (needsOwner, read) => needsOwner ? Promise.resolve({ kind: "pickAccount" }) : read();
11449
+ function mustPickCompany(me, owner) {
11450
+ return owner === null && (me.allAccounts || me.accounts.length !== 1);
11451
+ }
11449
11452
  function saveFailureText(r, fallback = "That change could not be saved.") {
11450
11453
  switch (r.kind) {
11451
11454
  case "ok": return fallback;
@@ -14837,8 +14840,8 @@ function blockers(d, product, names = 0, inheritedTerritories = []) {
14837
14840
  const budget = nameBudget(product, names);
14838
14841
  if (budget) out.push(budget.allowed === 1 ? `A ${product.name} reads one name at a time, and you have ${budget.allowed + budget.over}.` : `A ${product.name} reads ${budget.allowed} names at a time, and you have ${budget.allowed + budget.over}.`);
14839
14842
  const named = product.geography !== "worldwide, and nothing else" && !d.territories.length ? inheritedTerritories : d.territories;
14840
- const countries = named.filter((t) => tierOf(t) === "country");
14841
- const regions = named.filter((t) => tierOf(t) === "region");
14843
+ const countries = named.filter((t) => tierOfPlace(t) === "country");
14844
+ const regions = named.filter((t) => tierOfPlace(t) === "region");
14842
14845
  switch (product.geography) {
14843
14846
  case "worldwide, and nothing else":
14844
14847
  if (named.length) out.push(`A ${product.name} is worldwide and is not narrowed. Remove the territories, or pick a Multi-country focus search to read them.`);
@@ -18947,7 +18950,7 @@ function engineNotice({ programDisputed }) {
18947
18950
  return {
18948
18951
  state: "absent",
18949
18952
  headline: NO_ENGINE,
18950
- before: "Everything else works — the example report, its audit trail and the assistant connection are live right now. The setup wizard offers to install a reasoning CLI if this machine has none, and asks how it is paid for. To start new searches, run the setup wizard",
18953
+ before: "Demo mode — new searches are unavailable. The example report, its audit trail and the assistant connection need no engine. The setup wizard offers to install a reasoning CLI if this machine has none, and asks how it is paid for. To start new searches, run the setup wizard",
18951
18954
  namesSetupCommand: true,
18952
18955
  after: "Then restart the service: this reading was taken when it started, and it will not notice a new install until it starts again."
18953
18956
  };
@@ -19377,9 +19380,9 @@ function useUnsaved(dirty) {
19377
19380
  ref.current = dirty;
19378
19381
  (0, import_react.useEffect)(() => registerGuard(() => ref.current), []);
19379
19382
  }
19380
- function unsavedChanges({ current, empty, saved, submitted }) {
19383
+ function unsavedChanges({ current, empty, saved, submitted, untouched = null }) {
19381
19384
  if (submitted) return false;
19382
- if (current === empty) return false;
19385
+ if (current === empty || current === untouched) return false;
19383
19386
  return current !== saved;
19384
19387
  }
19385
19388
  // src/contract/companyCreated.ts
@@ -19429,7 +19432,7 @@ var EMPTY = {
19429
19432
  };
19430
19433
  function NewClearance({ ctx }) {
19431
19434
  const account = ctx.owner;
19432
- const needsOwner = ctx.me.allAccounts && account === null;
19435
+ const needsOwner = mustPickCompany(ctx.me, account);
19433
19436
  const { result: searches, reload: retrySearches } = useLoad(() => companyRead(needsOwner, () => api.searches(account)), [account, needsOwner]);
19434
19437
  const { result: profileRes } = useLoad(() => companyRead(needsOwner, () => api.profile(account)), [account, needsOwner]);
19435
19438
  const { result: projectsRes } = useLoad(() => companyRead(needsOwner, () => api.projects(account)), [account, needsOwner]);
@@ -19463,6 +19466,7 @@ function NewClearance({ ctx }) {
19463
19466
  const [submitted, setSubmitted] = (0, import_react.useState)(null);
19464
19467
  const [savedDraft, setSavedDraft] = (0, import_react.useState)(null);
19465
19468
  const [landed, setLanded] = (0, import_react.useState)(null);
19469
+ const [autoDraft, setAutoDraft] = (0, import_react.useState)(null);
19466
19470
  const [leaveTo, setLeaveTo] = (0, import_react.useState)(null);
19467
19471
  (0, import_react.useEffect)(() => {
19468
19472
  if (leaveTo) ctx.go(leaveTo);
@@ -19471,12 +19475,14 @@ function NewClearance({ ctx }) {
19471
19475
  current: JSON.stringify(draft),
19472
19476
  empty: JSON.stringify(EMPTY),
19473
19477
  saved: savedDraft,
19474
- submitted: submitted != null || landed != null
19478
+ submitted: submitted != null || landed != null,
19479
+ untouched: autoDraft
19475
19480
  }), [
19476
19481
  draft,
19477
19482
  submitted,
19478
19483
  savedDraft,
19479
- landed
19484
+ landed,
19485
+ autoDraft
19480
19486
  ]));
19481
19487
  const { result: projectRes } = useLoad(() => draft.project ? api.project(account, draft.project) : Promise.resolve({
19482
19488
  kind: "ok",
@@ -19565,7 +19571,13 @@ function NewClearance({ ctx }) {
19565
19571
  (0, import_react.useEffect)(() => {
19566
19572
  if (pickedByHand || draft.savedSearch || editingSlug || !recommendation) return;
19567
19573
  if (draft.pick.product === recommendation.product.key) return;
19568
- edit({ pick: chooseProduct(draft.pick, recommendation.product) });
19574
+ const pick = chooseProduct(draft.pick, recommendation.product);
19575
+ const now = JSON.stringify(draft);
19576
+ setAutoDraft(now === JSON.stringify(EMPTY) || now === autoDraft ? JSON.stringify({
19577
+ ...draft,
19578
+ pick
19579
+ }) : null);
19580
+ edit({ pick });
19569
19581
  }, [
19570
19582
  recommendation?.product.key,
19571
19583
  pickedByHand,
@@ -22536,7 +22548,7 @@ function RowMenu({ actions, disabled = false }) {
22536
22548
  // src/screens/SavedSearches.tsx
22537
22549
  function SavedSearches({ ctx }) {
22538
22550
  const account = ctx.owner;
22539
- const needsOwner = ctx.me.allAccounts && account === null;
22551
+ const needsOwner = mustPickCompany(ctx.me, account);
22540
22552
  const { result, reload } = useLoad(() => companyRead(needsOwner, () => api.savedSearches(account)), [account, needsOwner]);
22541
22553
  const { result: menu } = useLoad(() => companyRead(needsOwner, () => api.searches(account)), [account, needsOwner]);
22542
22554
  const levels = menu?.kind === "ok" ? menu.value.products : [];
@@ -23583,7 +23595,7 @@ function ContextPackEditor({ value, onChange, title, hint, rows = 8, tag = null,
23583
23595
  // src/screens/Profile.tsx
23584
23596
  function Profile({ ctx }) {
23585
23597
  const account = ctx.owner;
23586
- const needsOwner = ctx.me.allAccounts && account === null;
23598
+ const needsOwner = mustPickCompany(ctx.me, account);
23587
23599
  const { result, reload } = useLoad(() => companyRead(needsOwner, () => api.profile(account)), [account, needsOwner]);
23588
23600
  const loaded = result?.kind === "ok" ? result.value : null;
23589
23601
  const { result: searchesResult } = useLoad(() => companyRead(needsOwner, () => api.searches(account)), [account, needsOwner]);
@@ -24116,7 +24128,7 @@ function explain(r) {
24116
24128
  function Projects({ ctx }) {
24117
24129
  const mayChange = canManage(ctx.me);
24118
24130
  const account = ctx.owner;
24119
- const needsOwner = ctx.me.allAccounts && account === null;
24131
+ const needsOwner = mustPickCompany(ctx.me, account);
24120
24132
  const [open, setOpen] = (0, import_react.useState)(() => new URLSearchParams(window.location.search).get("project") || null);
24121
24133
  const [creating, setCreating] = (0, import_react.useState)(false);
24122
24134
  const [rowBusy, setRowBusy] = (0, import_react.useState)(null);
@@ -25382,14 +25394,14 @@ function Row$1({ ok, off = false, name, mono, state, faults, note = null, detail
25382
25394
  className: "cfg-act",
25383
25395
  children: [(0, import_jsx_runtime.jsx)("p", {
25384
25396
  className: "cfg-note bad",
25385
- children: f
25397
+ children: (0, import_jsx_runtime.jsx)(Ticked, { text: f })
25386
25398
  }), (0, import_jsx_runtime.jsx)(GuideButton, {
25387
25399
  guide,
25388
25400
  repo
25389
25401
  })]
25390
25402
  }, f) : (0, import_jsx_runtime.jsx)("p", {
25391
25403
  className: "cfg-note bad",
25392
- children: f
25404
+ children: (0, import_jsx_runtime.jsx)(Ticked, { text: f })
25393
25405
  }, f))
25394
25406
  ]
25395
25407
  });
@@ -36,7 +36,7 @@
36
36
  chosen anywhere in the product holds everywhere in it.
37
37
  -->
38
38
  <script>(function(){try{var t=localStorage.getItem('cordillera-theme');if(t==='dark'||t==='light')document.documentElement.setAttribute('data-theme',t);}catch(e){}})();</script>
39
- <script type="module" crossorigin src="/portal/assets/index-fPqAU0sx.js"></script>
39
+ <script type="module" crossorigin src="/portal/assets/index-D5rkCjDc.js"></script>
40
40
  <link rel="stylesheet" crossorigin href="/portal/assets/index-AtB9ZpDH.css">
41
41
  </head>
42
42
  <body>
@@ -2,7 +2,7 @@
2
2
  "name": "portal-ui",
3
3
  "private": true,
4
4
  "type": "module",
5
- "version": "0.5.1",
5
+ "version": "0.6.0-beta.0",
6
6
  "license": "AGPL-3.0-only",
7
7
  "description": "The unified trademark portal UI. One address, one login: who you are decides what you see. Built as a static bundle, served by driver/portal-service.mjs — the browser never reaches profile-service or recipe-service.",
8
8
  "engines": {
@@ -22,8 +22,8 @@
22
22
  "devDependencies": {
23
23
  "@types/react": "^19.3.0",
24
24
  "@types/react-dom": "^19.3.0",
25
- "@vitejs/plugin-react": "^6.1.2",
25
+ "@vitejs/plugin-react": "^6.2.1",
26
26
  "typescript": "^7.0.2",
27
- "vite": "^8.3.5"
27
+ "vite": "^8.3.6"
28
28
  }
29
29
  }
@@ -44,7 +44,7 @@ the vendor's own site, over either adapter that needs a sales agreement.
44
44
 
45
45
  One API key, issued self-serve from the vendor's own site: no sales call, no contract, no waiting. It
46
46
  covers the **US and EU registers together**, plus WIPO/Madrid, the UK, Switzerland, Canada, Australia,
47
- France, Spain, Mexico, Singapore, Norway and Sweden — **thirteen offices**. Native sound-alike search, exact result counts,
47
+ France, Spain, Italy, Mexico, Brazil, Singapore, Norway and Sweden — **fifteen offices**. Native sound-alike search, exact result counts,
48
48
  opposition state, and one call returns every layer of rights binding a territory, so an EU trade mark that
49
49
  blocks use in France is actually found rather than missed by a national-only search.
50
50
 
@@ -53,15 +53,14 @@ export const ANSWER_MEMORY_MODES = Object.freeze(["off", "watch", "on"]);
53
53
  * The registers whose core consults this memory, the environment switch that sets it for each (`env`, the
54
54
  * table shape the configuration audit reads), and the mode a run takes when that switch is unset. Every other register is `off`, whatever any switch says.
55
55
  *
56
- * SIGNA starts `off`: it goes `on` only after runs in watch mode show no mismatch, by the owner's ruling.
57
- * CLARIVATE starts `on`, with no watch period, also by his ruling: the repeated answers of its past runs
58
- * were already compared and matched.
56
+ * SIGNA and CLARIVATE both start `on`, by the owner's rulings. Clarivate had no watch period: the repeated
57
+ * answers of its past runs were already compared and matched. Signa keeps `watch` for an install that wants
58
+ * the comparison.
59
59
  */
60
60
  export const ANSWER_MEMORY_PROVIDERS = Object.freeze({
61
- signa: Object.freeze({ env: "CLEAROTRON_SIGNA_ANSWER_MEMORY", defaultMode: "off" }),
61
+ signa: Object.freeze({ env: "CLEAROTRON_SIGNA_ANSWER_MEMORY", defaultMode: "on" }),
62
62
  clarivate: Object.freeze({ env: "CLEAROTRON_CLARIVATE_ANSWER_MEMORY", defaultMode: "on" }),
63
63
  });
64
- export const ANSWER_MEMORY_SWITCH = ANSWER_MEMORY_PROVIDERS.signa.env;
65
64
  export const ANSWER_MEMORY_DIR = "register-answers";
66
65
  export const ANSWER_WATCH_LOG = "register-answer-watch.jsonl";
67
66
  const ATTEMPT_FILE = "attempt.json";