clearotron 0.6.0 → 0.7.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.
- package/INSTALL.md +7 -4
- package/QUICKSTART.md +1 -0
- package/README.md +5 -2
- package/THIRD-PARTY-NOTICES.md +1 -1
- package/bin/clearotron.mjs +4 -2
- package/bin/onboard.mjs +158 -29
- package/build-info.json +2 -2
- package/docs/CLIENT-MCP.md +3 -1
- package/docs/DELIVERY.md +6 -3
- package/docs/architecture/02-architecture.md +1 -1
- package/docs/architecture/04-configuration-reference.md +105 -8
- package/docs/branding.md +4 -4
- package/docs/report-data/clearance-1.schema.json +320 -0
- package/docs/report-data/knockout-1.schema.json +268 -0
- package/driver/CHANGELOG.md +77 -0
- package/driver/cancel.mjs +19 -0
- package/driver/connotation-search.mjs +1 -1
- package/driver/contract-e3-backlog.mjs +41 -41
- package/driver/contract-vocabulary.mjs +1 -1
- package/driver/coverage-ledger.mjs +18 -2
- package/driver/deferral-row.mjs +1 -1
- package/driver/degraded-parts.mjs +1 -0
- package/driver/driver.config.mjs +5 -5
- package/driver/effective-scope.mjs +3 -1
- package/driver/engagement-receipt.mjs +3 -3
- package/driver/engine/anthropic-agent.mjs +15 -1
- package/driver/engine/common.mjs +7 -0
- package/driver/engine/mcp/band-server.mjs +7 -16
- package/driver/engine/mcp/codex-config.mjs +3 -0
- package/driver/engine/mcp/recording-server.mjs +45 -34
- package/driver/engine/openai-agent.mjs +74 -7
- package/driver/engine/session-record.mjs +44 -2
- package/driver/findings-model.mjs +14 -2
- package/driver/follow-up-twins.mjs +86 -0
- package/driver/gateway.mjs +77 -12
- package/driver/jx-units.mjs +3 -1
- package/driver/jx.mjs +13 -5
- package/driver/manuals-inline.mjs +98 -0
- package/driver/manuals-seen.mjs +134 -0
- package/driver/mark-logos.mjs +174 -0
- package/driver/methodology-witness.mjs +2 -1
- package/driver/owner-use-check.mjs +8 -4
- package/driver/package.json +1 -1
- package/driver/pipeline-knockout.mjs +23 -4
- package/driver/pipeline.mjs +128 -15
- package/driver/portal-local-auth.mjs +6 -2
- package/driver/portal-report.mjs +45 -14
- package/driver/portal-routes/me.mjs +4 -1
- package/driver/portal-runs.mjs +19 -16
- package/driver/predelivery-lint.mjs +7 -5
- package/driver/profiles.mjs +4 -4
- package/driver/publish/README.md +9 -7
- package/driver/publish/email-conditions.mjs +22 -5
- package/driver/publish/evidence-words.mjs +21 -0
- package/driver/publish/index.mjs +304 -211
- package/driver/publish/knockout.mjs +297 -247
- package/driver/publish/office-record-links.mjs +11 -9
- package/driver/publish/page-shell.mjs +98 -0
- package/driver/publish/pool-admin.mjs +2 -2
- package/driver/publish/publish-inputs.mjs +4 -0
- package/driver/publish/regions.mjs +28 -3
- package/driver/publish/register-record-html.mjs +105 -0
- package/driver/publish/register-record.mjs +165 -0
- package/driver/publish/render-knockout.mjs +299 -671
- package/driver/publish/render.mjs +561 -492
- package/driver/publish/report-data.mjs +226 -13
- package/driver/publish/report-document.mjs +353 -0
- package/driver/publish/search-depth.mjs +88 -7
- package/driver/publish/shell.mjs +41 -1
- package/driver/publish/strings.mjs +810 -0
- package/driver/publish/templates/clearance-print.css +23 -0
- package/driver/publish/templates/knockout.css +224 -0
- package/driver/publish/templates/report.css +112 -53
- package/driver/publish/xlsx.mjs +158 -139
- package/driver/record-goods.mjs +42 -0
- package/driver/reference-score.mjs +4 -1
- package/driver/register-count.mjs +5 -1
- package/driver/register-reach.mjs +39 -0
- package/driver/registry-fidelity.mjs +155 -37
- package/driver/repair-composers.mjs +7 -3
- package/driver/repair-targets.mjs +4 -1
- package/driver/replay-archive.mjs +4 -3
- package/driver/run-delivered.mjs +14 -8
- package/driver/run-record.mjs +1 -0
- package/driver/runner.mjs +73 -29
- package/driver/scope-facts.mjs +27 -6
- package/driver/search-policy.mjs +9 -4
- package/driver/skills/clearance-search/report-prose.md +3 -0
- package/driver/skills/knockout-assess/SKILL.md +8 -0
- package/driver/stage-freshness.mjs +8 -5
- package/driver/stages.mjs +69 -43
- package/driver/steps/delivery.mjs +9 -5
- package/driver/steps/overview-and-cards.mjs +54 -15
- package/driver/steps/register-sweep.mjs +5 -4
- package/driver/steps/skeptic-and-follow-up.mjs +3 -2
- package/driver/steps/verdict-gate.mjs +35 -14
- package/driver/suite-census.json +579 -87
- package/driver/synthesis-record.mjs +4 -3
- package/driver/terminal-clamp.mjs +6 -1
- package/driver/withdrawn-rating.mjs +72 -0
- package/mcp-server/CHANGELOG.md +8 -0
- package/mcp-server/lib/audit-view.mjs +5 -2
- package/mcp-server/lib/brief.mjs +6 -2
- package/mcp-server/lib/evidence.mjs +94 -23
- package/mcp-server/lib/findings.mjs +19 -2
- package/mcp-server/lib/knockout.mjs +13 -4
- package/mcp-server/lib/scrub.mjs +1 -1
- package/mcp-server/package.json +1 -1
- package/mcp-server/server.mjs +22 -3
- package/package.json +4 -1
- package/portal-ui/dist/assets/{index-CYaO2ygd.js → index-BBlN4CYq.js} +238 -80
- package/portal-ui/dist/assets/{index-izLa9apq.css → index-CxAkJXIT.css} +25 -5
- package/portal-ui/dist/index.html +2 -2
- package/portal-ui/package.json +3 -3
- package/providers/_shared/ledger.mjs +30 -2
- package/providers/_shared/record-uri.mjs +15 -0
- package/providers/clarivate/src/adapter.js +11 -0
- package/providers/clarivate/src/core.js +17 -1
- package/providers/jx/src/core.js +4 -4
- package/providers/jx/src/judge.js +1 -3
- package/providers/jx/src/nativeread.js +1 -3
- package/providers/oauth-mcp-bridge/CHANGELOG.md +8 -0
- package/providers/oauth-mcp-bridge/package.json +1 -1
- package/scripts/README.md +147 -3
- package/scripts/added-reference-check.mjs +35 -7
- package/scripts/e2e-first-time.mjs +4 -4
- package/scripts/env-audit.mjs +16 -9
- package/scripts/freeze-example-run.mjs +3 -3
- package/scripts/mint-public-residue.mjs +3 -3
- package/scripts/mint-search-level-tags.mjs +61 -0
- package/scripts/mint-source-pin-census.mjs +89 -0
- package/scripts/release-note-required.mjs +65 -6
- package/scripts/test-durations-reporter.mjs +25 -0
- package/scripts/test-full.mjs +72 -18
- package/scripts/test-run.mjs +18 -1
- package/shared/brand.mjs +93 -6
- package/shared/inline-markdown.mjs +53 -0
- package/shared/names-in-force.mjs +0 -1
- package/shared/portal-tokens.mjs +2 -1
- package/shared/reference-guard-classes.mjs +43 -2
- package/shared/register-selection.mjs +8 -3
- package/shared/search-level-tags.json +25 -0
- package/shared/source-spans.mjs +91 -0
- package/shared/tools/derive-band-pairs.mjs +10 -0
- package/driver/own-rights.mjs +0 -83
- package/driver/use-check.mjs +0 -85
package/driver/runner.mjs
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
import "../shared/env-local.mjs"; // side effect: apply <repo>/.env when THIS file is the CLI entry (never on library import)
|
|
22
22
|
import "./engine/mcp/http-dispatcher.mjs"; // side effect: raise undici headersTimeout (code-side fetches)
|
|
23
|
-
import { readdirSync, renameSync, existsSync, mkdirSync, readFileSync, writeFileSync, appendFileSync, rmSync, statSync } from "node:fs";
|
|
23
|
+
import { readdirSync, renameSync, existsSync, mkdirSync, readFileSync, writeFileSync, appendFileSync, rmSync, statSync, watch as watchFolder } from "node:fs";
|
|
24
24
|
import { join, dirname, basename } from "node:path"; import { studioDirFor } from "../shared/pre-rename-spellings.mjs";
|
|
25
25
|
import { crossBuildResumeRefusal } from "./one-build-per-run.mjs"; // a run is finished on the build it started on (owner, 2026-11-09)
|
|
26
26
|
// The queue's filename vocabulary, in ONE place — the rule, extended by to the prose-sidecar and
|
|
@@ -2392,6 +2392,36 @@ const WATCH_WAKE_JUMP_MS = 15_000; // wall clock outrunning a slice by this mu
|
|
|
2392
2392
|
// same trap the gateway-preflight hold documents.
|
|
2393
2393
|
const sleepRefd = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
2394
2394
|
|
|
2395
|
+
// ── A JOB FILE WAKES THE LOOP; THE TICK STAYS THE GUARANTEE ─────────────────────────────────────────────
|
|
2396
|
+
//
|
|
2397
|
+
// Between ticks an order waited for the next one: up to 90 s, about 45 s on average, before a search it was
|
|
2398
|
+
// accepted for began, and it fell before the run's own start time, so no record showed it. Measured on the two
|
|
2399
|
+
// production clearances whose order carries `enqueuedAt`: 1.1 and 1.4 minutes from queue to start. So each
|
|
2400
|
+
// queue folder the drain reads is watched, and a `.json` landing in one ends the wait. The watch only says when
|
|
2401
|
+
// to LOOK: the tick that follows reads the folders exactly as a timed tick does, whole job files only.
|
|
2402
|
+
//
|
|
2403
|
+
// `fs.watch` misses events on network filesystems and in some macOS and Windows cases, and a folder can fail
|
|
2404
|
+
// to be watched at all; each of those leaves the 90 s tick, as before. The watchers never keep the process
|
|
2405
|
+
// alive, and the folder list is re-read every tick, because a workspace created after start has a queue too.
|
|
2406
|
+
const WATCH_SETTLE_MS = 250; // a burst of arrivals inside this window starts one drain, not one per file
|
|
2407
|
+
|
|
2408
|
+
/** Watch every queue folder the drain reads; `onJob` on a `.json` arrival. Returns `{ rearm, close }`. */
|
|
2409
|
+
export function watchQueueFolders(onJob, folders = () => config.queueDirs) {
|
|
2410
|
+
const watchers = new Map();
|
|
2411
|
+
const rearm = () => {
|
|
2412
|
+
for (const q of folders()) {
|
|
2413
|
+
if (watchers.has(q)) continue;
|
|
2414
|
+
try {
|
|
2415
|
+
const w = watchFolder(q, { persistent: false }, (_kind, name) => { if (!name || String(name).endsWith(".json")) onJob(); });
|
|
2416
|
+
w.on("error", () => { w.close(); watchers.delete(q); });
|
|
2417
|
+
watchers.set(q, w);
|
|
2418
|
+
} catch { /* not watchable here: the tick reads it */ }
|
|
2419
|
+
}
|
|
2420
|
+
};
|
|
2421
|
+
rearm();
|
|
2422
|
+
return { rearm, close: () => { for (const w of watchers.values()) w.close(); watchers.clear(); } };
|
|
2423
|
+
}
|
|
2424
|
+
|
|
2395
2425
|
// WAKE FROM SUSPEND. A closed lid is the normal condition for a multi-hour job, and a single
|
|
2396
2426
|
// setTimeout(90s) handles it badly in both directions depending on the platform: timers run on a
|
|
2397
2427
|
// MONOTONIC clock that stops while a Linux laptop is suspended, while `resetsAt` and postponedDueAt are
|
|
@@ -2422,39 +2452,53 @@ export async function watch({
|
|
|
2422
2452
|
// thing keeping this process alive.
|
|
2423
2453
|
beatEveryMs = WATCH_TICK_MS,
|
|
2424
2454
|
startBeating = (fn, everyMs) => { const t = setInterval(fn, everyMs); t.unref?.(); return () => clearInterval(t); },
|
|
2455
|
+
// A job file arriving ends the wait early (see watchQueueFolders). Injectable so the arms can watch a folder
|
|
2456
|
+
// of their own, or none.
|
|
2457
|
+
queueWatch = (onJob) => watchQueueFolders(onJob), settleMs = WATCH_SETTLE_MS,
|
|
2425
2458
|
} = {}) {
|
|
2426
2459
|
note(`[runner] watch: checking every ${Math.round(tickMs / 1000)}s for a search to start or to resume. Ctrl-C to stop.`);
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
// leave a freshly-started worker looking absent for its whole first tick — which is exactly the window
|
|
2434
|
-
// a user watches after pressing Start.
|
|
2435
|
-
heartbeat();
|
|
2436
|
-
const stopBeating = startBeating(heartbeat, beatEveryMs);
|
|
2437
|
-
try { await run({ once: true }); }
|
|
2438
|
-
catch (e) { note(`[runner] watch tick FAILED (isolated — retrying next tick): ${e?.message ?? e}`); }
|
|
2439
|
-
// Reached on every path out of the tick, including the one where the catch above swallows a
|
|
2440
|
-
// failure. A timer left running would go on beating for a worker that had stopped — the one
|
|
2441
|
-
// direction this file's fail-safe rule forbids, because it is the reading nobody checks twice.
|
|
2442
|
-
finally { stopBeating(); }
|
|
2443
|
-
if (n + 1 >= ticks) break;
|
|
2444
|
-
const due = now() + tickMs;
|
|
2445
|
-
for (;;) {
|
|
2460
|
+
// Arrivals during a drain are not lost and not raced: they leave `woken` set, and the drain's next pass starts as
|
|
2461
|
+
// soon as this one ends. Never a second main() beside one in flight.
|
|
2462
|
+
let woken = false, rouse = null;
|
|
2463
|
+
const watcher = queueWatch(() => { woken = true; rouse?.(); });
|
|
2464
|
+
try {
|
|
2465
|
+
for (let n = 0; ; n++) {
|
|
2446
2466
|
if (stopped()) break;
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2467
|
+
watcher?.rearm?.();
|
|
2468
|
+
woken = false;
|
|
2469
|
+
// One bad tick must never end the loop — that would put us back where a laptop started, with nothing
|
|
2470
|
+
// re-invoking anything. main() already isolates per-queue failures; this catches everything above them.
|
|
2471
|
+
// — the beat goes BEFORE the tick's work, not after. The portal reads this to tell "waiting for
|
|
2472
|
+
// a worker that is not running" from "waiting its turn", and a beat written only on completion would
|
|
2473
|
+
// leave a freshly-started worker looking absent for its whole first tick — which is exactly the window
|
|
2474
|
+
// a user watches after pressing Start.
|
|
2475
|
+
heartbeat();
|
|
2476
|
+
const stopBeating = startBeating(heartbeat, beatEveryMs);
|
|
2477
|
+
try { await run({ once: true }); }
|
|
2478
|
+
catch (e) { note(`[runner] watch tick FAILED (isolated — retrying next tick): ${e?.message ?? e}`); }
|
|
2479
|
+
// Reached on every path out of the tick, including the one where the catch above swallows a
|
|
2480
|
+
// failure. A timer left running would go on beating for a worker that had stopped — the one
|
|
2481
|
+
// direction this file's fail-safe rule forbids, because it is the reading nobody checks twice.
|
|
2482
|
+
finally { stopBeating(); }
|
|
2483
|
+
if (n + 1 >= ticks) break;
|
|
2484
|
+
const due = now() + tickMs;
|
|
2485
|
+
for (;;) {
|
|
2486
|
+
if (stopped()) break;
|
|
2487
|
+
if (woken) { await sleep(settleMs); break; } // let a burst of arrivals land, then one drain reads them all
|
|
2488
|
+
const before = now();
|
|
2489
|
+
const asked = Math.min(sliceMs, due - before);
|
|
2490
|
+
if (asked <= 0) break;
|
|
2491
|
+
await Promise.race([sleep(asked), new Promise((r) => { rouse = r; })]);
|
|
2492
|
+
rouse = null;
|
|
2493
|
+
if (woken) continue;
|
|
2494
|
+
const elapsed = now() - before;
|
|
2495
|
+
if (elapsed > asked + wakeJumpMs) {
|
|
2496
|
+
note(`[runner] watch: ${Math.round(elapsed / 1000)}s of wall clock passed during a ${Math.round(asked / 1000)}s sleep — treating this as wake-from-suspend and ticking now, so a window that elapsed while asleep is not waited out again`);
|
|
2497
|
+
break;
|
|
2498
|
+
}
|
|
2455
2499
|
}
|
|
2456
2500
|
}
|
|
2457
|
-
}
|
|
2501
|
+
} finally { watcher?.close?.(); }
|
|
2458
2502
|
note(`[runner] watch: stopped${stopSignal ? ` (${stopSignal})` : ""} — anything still parked resumes the next time this runs.`);
|
|
2459
2503
|
}
|
|
2460
2504
|
|
package/driver/scope-facts.mjs
CHANGED
|
@@ -27,6 +27,8 @@
|
|
|
27
27
|
|
|
28
28
|
import { classTokensFromScopeText, isCapabilityGapReason } from "./coverage-ledger.mjs";
|
|
29
29
|
import { capabilitiesFor } from "./register-capabilities.mjs";
|
|
30
|
+
import { registerReach } from "./register-reach.mjs";
|
|
31
|
+
import { regionName } from "./publish/regions.mjs";
|
|
30
32
|
|
|
31
33
|
const clsStr = (c) => String(c ?? "").trim();
|
|
32
34
|
|
|
@@ -66,7 +68,7 @@ const entryIsNonLatinScript = (e) => {
|
|
|
66
68
|
* `classes_line`/`coverage_line` are null when there is genuinely nothing to compute — the caller
|
|
67
69
|
* (applyScopeFrontMatter) then leaves the surface untouched rather than stamping an empty claim.
|
|
68
70
|
*/
|
|
69
|
-
export function deriveScopeFacts({ instructedScope = null, plan = null, planExecution = null, coverageRows = [], withheldQids = [] } = {}) {
|
|
71
|
+
export function deriveScopeFacts({ instructedScope = null, plan = null, planExecution = null, coverageRows = [], withheldQids = [], markets = [] } = {}) {
|
|
70
72
|
const instructedClasses = (Array.isArray(instructedScope?.classes) ? instructedScope.classes : (plan?.nice_classes ?? []))
|
|
71
73
|
.map(clsStr).filter((c) => c);
|
|
72
74
|
const entries = Array.isArray(plan?.entries) ? plan.entries : [];
|
|
@@ -222,10 +224,13 @@ export function deriveScopeFacts({ instructedScope = null, plan = null, planExec
|
|
|
222
224
|
const searched_jurisdictions = Array.isArray(plan?.regions) ? plan.regions.map(String) : [];
|
|
223
225
|
const scope_basis = plan?.scope_basis === "worldwide" ? "worldwide" : null;
|
|
224
226
|
const register_service = registerServiceOf(plan);
|
|
227
|
+
// A worldwide order's reach, against the markets the order is for (register-reach.mjs). Null for a named list, and for
|
|
228
|
+
// a service that declares no office list, which keep the lines they had.
|
|
229
|
+
const register_reach = scope_basis === "worldwide" ? registerReach(plan?.provider, markets) : null;
|
|
225
230
|
|
|
226
231
|
const classes_line = instructedClasses.length ? instructedClasses.join(", ") : null;
|
|
227
232
|
const coverage_line = instructedClasses.length && entries.length
|
|
228
|
-
? buildCoverageLine(instructedClasses, per_class, { searched_jurisdictions, scope_basis, instructedScope, register_service })
|
|
233
|
+
? buildCoverageLine(instructedClasses, per_class, { searched_jurisdictions, scope_basis, instructedScope, register_service, register_reach })
|
|
229
234
|
: null;
|
|
230
235
|
|
|
231
236
|
return {
|
|
@@ -237,6 +242,7 @@ export function deriveScopeFacts({ instructedScope = null, plan = null, planExec
|
|
|
237
242
|
per_class,
|
|
238
243
|
searched_jurisdictions,
|
|
239
244
|
...(scope_basis ? { scope_basis } : {}),
|
|
245
|
+
...(register_reach ? { register_reach } : {}),
|
|
240
246
|
classes_line,
|
|
241
247
|
coverage_line,
|
|
242
248
|
};
|
|
@@ -262,7 +268,7 @@ export function deriveScopeFacts({ instructedScope = null, plan = null, planExec
|
|
|
262
268
|
// clause is word-for-word the same are stated ONCE, over the classes they are about. Nothing is pooled
|
|
263
269
|
// and no number moves: the grouping is on the rendered text, so two classes only share a line when the
|
|
264
270
|
// line they would each have printed is already the same string.
|
|
265
|
-
function buildCoverageLine(classes, per_class, { searched_jurisdictions = [], scope_basis = null, instructedScope = null, register_service = null } = {}) {
|
|
271
|
+
function buildCoverageLine(classes, per_class, { searched_jurisdictions = [], scope_basis = null, instructedScope = null, register_service = null, register_reach = null } = {}) {
|
|
266
272
|
const sorted = [...classes].sort((a, b) => (Number(a) || 0) - (Number(b) || 0));
|
|
267
273
|
const byBody = new Map();
|
|
268
274
|
for (const c of sorted) {
|
|
@@ -275,7 +281,7 @@ function buildCoverageLine(classes, per_class, { searched_jurisdictions = [], sc
|
|
|
275
281
|
// bodies A, B, A renders "Classes 5 and 32: A; Class 9: B", not A twice.
|
|
276
282
|
const groups = [...byBody.entries()].map(([body, classes]) => ({ body, classes }));
|
|
277
283
|
const head = (cs) => (cs.length === 1 ? `Class ${cs[0]}` : `Classes ${joinAnd(cs.map(String))}`);
|
|
278
|
-
return `${groups.map((g) => `${head(g.classes)}: ${g.body}`).join("; ")}${jurisdictionTail({ searched_jurisdictions, scope_basis, instructedScope, register_service })}`;
|
|
284
|
+
return `${groups.map((g) => `${head(g.classes)}: ${g.body}`).join("; ")}${jurisdictionTail({ searched_jurisdictions, scope_basis, instructedScope, register_service, register_reach })}`;
|
|
279
285
|
}
|
|
280
286
|
|
|
281
287
|
// One plain-language clause per class, routed on the COUNTS (state-agnostic), not on the state label.
|
|
@@ -359,17 +365,32 @@ const WORLDWIDE_TOKEN_RE = /^(worldwide|world|ww|global)$/i;
|
|
|
359
365
|
// installation and 186 on another, and a reader can only tell which by being told the service. The name is
|
|
360
366
|
// the provider's own label from its capabilities contract — the same name the order form shows — read off
|
|
361
367
|
// the provider the frozen plan records. A plan that records none, or one this build does not know, keeps
|
|
362
|
-
// the bare word: a guessed name would be worse than none.
|
|
368
|
+
// the bare word: a guessed name would be worse than none.
|
|
369
|
+
// AND NOW ITS REACH (owner, 2026-11-18, replacing "never a list of offices, never a count"): where the service
|
|
370
|
+
// declares its office list, the line states how many offices it searched and names the order's markets outside them,
|
|
371
|
+
// "registers: Signa, 15 offices; <the markets, by name> not covered", and ends after the count when none is.
|
|
372
|
+
// THE ARTICLE, IN THIS LINE ONLY (owner, 2026-11-18). The shared country names carry none, so the approved line
|
|
373
|
+
// "Japan, the Philippines, Indonesia and Vietnam not covered" printed "Philippines". A name that takes "the" in English
|
|
374
|
+
// gets it here: a union or kingdom of states, a group of islands, a republic or territory named as one, and the plural
|
|
375
|
+
// names. The test is on the name, not the code, so a name the shared table changes still reads right. Rows and
|
|
376
|
+
// other surfaces keep the bare name.
|
|
377
|
+
const TAKES_THE = /^(United |(Philippines|Bahamas|Gambia|Maldives|Comoros|Seychelles|European Union|Isle of Man)$)|(Islands|Republic|Netherlands|Territories|Territory)$/;
|
|
378
|
+
const withArticle = (name) => (TAKES_THE.test(name) ? `the ${name}` : name);
|
|
379
|
+
|
|
363
380
|
function registerServiceOf(plan) {
|
|
364
381
|
if (!plan?.provider) return null;
|
|
365
382
|
try { return capabilitiesFor(plan.provider).label ?? null; } catch { return null; }
|
|
366
383
|
}
|
|
367
384
|
|
|
368
|
-
function jurisdictionTail({ searched_jurisdictions = [], scope_basis = null, instructedScope = null, register_service = null } = {}) {
|
|
385
|
+
function jurisdictionTail({ searched_jurisdictions = [], scope_basis = null, instructedScope = null, register_service = null, register_reach = null } = {}) {
|
|
369
386
|
const list = (searched_jurisdictions.length
|
|
370
387
|
? searched_jurisdictions
|
|
371
388
|
: (Array.isArray(instructedScope?.jurisdictions) ? instructedScope.jurisdictions : [])).map((j) => String(j).trim()).filter((j) => j);
|
|
372
389
|
if (scope_basis === "worldwide" || list.some((j) => WORLDWIDE_TOKEN_RE.test(j))) {
|
|
390
|
+
if (register_reach) {
|
|
391
|
+
const outside = register_reach.uncovered.map((c) => withArticle(regionName(c)));
|
|
392
|
+
return ` · registers: ${register_reach.service}, ${register_reach.offices} office${register_reach.offices === 1 ? "" : "s"}${outside.length ? `; ${joinAnd(outside)} not covered` : ""}`;
|
|
393
|
+
}
|
|
373
394
|
return ` · registers: worldwide${register_service ? ` (${register_service})` : ""}`;
|
|
374
395
|
}
|
|
375
396
|
if (!list.length) return "";
|
package/driver/search-policy.mjs
CHANGED
|
@@ -170,6 +170,11 @@ export const COMPONENTS = {
|
|
|
170
170
|
// queries included. Grids stay on the tier they run on today; this is their lever.
|
|
171
171
|
// The run freezes the pair in its search policy, which is its record of what it ran on; a run frozen
|
|
172
172
|
// before this rule carries none and runs as every run did before it.
|
|
173
|
+
// `report.tag` IS THE SHORT NAME the Clearances list prints under a name and offers as a filter: "KO",
|
|
174
|
+
// "Prelim", "Multi", "Full". It sits beside `identity` so a product cannot ship without naming its own,
|
|
175
|
+
// and the page reads it from shared/search-level-tags.json, minted from this table
|
|
176
|
+
// (scripts/mint-search-level-tags.mjs), never from a list of its own. A retired product has none: its runs
|
|
177
|
+
// carry no tag and show only under All.
|
|
173
178
|
export const PRODUCT_POLICIES = {
|
|
174
179
|
// ONE knockout, and it carries the register hit-counts. There used to be two levels here — a plain
|
|
175
180
|
// screen and the same screen plus a filing count per name — and the offering has one Knockout search.
|
|
@@ -180,7 +185,7 @@ export const PRODUCT_POLICIES = {
|
|
|
180
185
|
// those words ("register-cannot-count") instead of the release-note sentence that would be a lie.
|
|
181
186
|
"knockout-search": {
|
|
182
187
|
product: "knockout-search", stageLabel: "Knockout search", pipeline: "knockout",
|
|
183
|
-
report: { template: "knockout", identity: "Knockout search" },
|
|
188
|
+
report: { template: "knockout", identity: "Knockout search", tag: "KO" },
|
|
184
189
|
components: { registerProbe: true, jxLanes: false, commonLawGrid: false },
|
|
185
190
|
web: { questionPreset: "pro-search", resultsPerCell: 10 },
|
|
186
191
|
// — NO DEPTH ROW ON PURPOSE. Product 1 is out of scope by the spec: the knockout lane has its
|
|
@@ -189,7 +194,7 @@ export const PRODUCT_POLICIES = {
|
|
|
189
194
|
},
|
|
190
195
|
"global-preliminary-search": {
|
|
191
196
|
product: "global-preliminary-search", stageLabel: "Global preliminary search", pipeline: "clearance",
|
|
192
|
-
report: { template: "clearance", identity: "Global preliminary search" },
|
|
197
|
+
report: { template: "clearance", identity: "Global preliminary search", tag: "Prelim" },
|
|
193
198
|
// WORLDWIDE — the higher bar everywhere it is graded.
|
|
194
199
|
depth: {
|
|
195
200
|
narrativeProse: "adversarial", // per-finding prose in narrative.md: `adversarial` findings only
|
|
@@ -239,7 +244,7 @@ export const PRODUCT_POLICIES = {
|
|
|
239
244
|
// multi-country search whether or not anybody bought one.
|
|
240
245
|
"multi-country-focus-search": {
|
|
241
246
|
product: "multi-country-focus-search", stageLabel: "Multi-country focus search", pipeline: "clearance",
|
|
242
|
-
report: { template: "clearance", identity: "Multi-country focus search" },
|
|
247
|
+
report: { template: "clearance", identity: "Multi-country focus search", tag: "Multi" },
|
|
243
248
|
// MULTI-COUNTRY — the same instructions, a lower bar than worldwide.
|
|
244
249
|
depth: {
|
|
245
250
|
narrativeProse: "adversarial+floors", // `adversarial` findings plus tier-`identical` floor marks
|
|
@@ -289,7 +294,7 @@ export const PRODUCT_POLICIES = {
|
|
|
289
294
|
// only where one was asked for, so this can never refuse a request we ourselves shaped.
|
|
290
295
|
"full-country-search": {
|
|
291
296
|
product: "full-country-search", stageLabel: "Full country search", pipeline: "clearance",
|
|
292
|
-
report: { template: "clearance", identity: "Full country search" },
|
|
297
|
+
report: { template: "clearance", identity: "Full country search", tag: "Full" },
|
|
293
298
|
// ONE COUNTRY — every value is TODAY'S BEHAVIOUR, declared. This row is the byte-identical guard.
|
|
294
299
|
depth: {
|
|
295
300
|
narrativeProse: "every-finding",
|
|
@@ -213,6 +213,9 @@ context on the page supplies one.
|
|
|
213
213
|
**Where there is no reader-facing word for the thing, describe the thing.** The description is the
|
|
214
214
|
finished sentence, not a stand-in for the term you meant.
|
|
215
215
|
|
|
216
|
+
Name the evidence you found, the places you searched, or the wording you compared. Use the terms the
|
|
217
|
+
reader knows for those things.
|
|
218
|
+
|
|
216
219
|
> ✗ The full variant band enumerated to zero.
|
|
217
220
|
>
|
|
218
221
|
> ✓ We searched every spelling of the name and found no live rights.
|
|
@@ -116,6 +116,8 @@ Everything below follows from writing only what your evidence supports.
|
|
|
116
116
|
`findings[]` — cite that evidence. It is never a claim about filings, families, or how many marks
|
|
117
117
|
share a token. `crowdedField: true` means "the payload I read
|
|
118
118
|
shows a crowded field", and if the payload does not show one, it is `false`.
|
|
119
|
+
5. Describe only the activity the held source shows. Attribute a listing’s claim of registration to the
|
|
120
|
+
listing unless a held register record confirms it.
|
|
119
121
|
|
|
120
122
|
The engine appends the depth boundary to `batch.standardCaveats` itself, and the standing caveat where
|
|
121
123
|
one is owed, so never write your own version of either.
|
|
@@ -140,6 +142,9 @@ nouns, one idea per sentence, no sentence over 25 words, the conclusion first. O
|
|
|
140
142
|
finding's `basis`, the provenance, the long `assessment`. Even there, a term is explained the first time
|
|
141
143
|
it appears on the page.
|
|
142
144
|
|
|
145
|
+
Name the evidence you found, the places you searched, or the wording you compared. Use the terms the
|
|
146
|
+
reader knows for those things.
|
|
147
|
+
|
|
143
148
|
The rule is the test, not the list. Ask of every noun: *does the reader already own this word?* These
|
|
144
149
|
are worked examples of the one failure, not its boundary:
|
|
145
150
|
|
|
@@ -255,6 +260,9 @@ Every mark carries the read as typed fields, not as a paragraph:
|
|
|
255
260
|
Each is a standalone line: no semicolon chains, no clause stacking, no restating the band word. Write
|
|
256
261
|
each observation ONCE: a point made in `factors` is not repeated in `bullets`.
|
|
257
262
|
|
|
263
|
+
Give the short answer in the summary. Use the reasons to explain the rating and uncertainties to say what
|
|
264
|
+
remains open. Add a detail to the assessment when it helps the reader understand the result.
|
|
265
|
+
|
|
258
266
|
## What the register reading hands you
|
|
259
267
|
|
|
260
268
|
The step before you read the register name by name, and its work is yours to build on. On each name in the file you are
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
// accrues enforcement as it writes its own stamps.
|
|
47
47
|
|
|
48
48
|
import { createHash } from "node:crypto";
|
|
49
|
-
import { readFileSync,
|
|
49
|
+
import { readFileSync, existsSync, readdirSync, unlinkSync } from "node:fs";
|
|
50
50
|
import { join, basename } from "node:path";
|
|
51
51
|
import { atomicWrite, driverDir, ensureDriverDir, paths, readJson } from "./run-record.mjs"; // — one definition of where `_driver/` is
|
|
52
52
|
import { runLog, note } from "./log.mjs";
|
|
@@ -131,7 +131,10 @@ export function writeStamp(runDir, label, inputPaths, { project = null, values =
|
|
|
131
131
|
export function writeFingerprint(runDir, label, inputs) {
|
|
132
132
|
try {
|
|
133
133
|
ensureDriverDir(runDir, STAMP_DIR);
|
|
134
|
-
|
|
134
|
+
// WHOLE OR NOT AT ALL. A stamp that exists but does not parse reads as no record, and the stage runs again on a resume;
|
|
135
|
+
// a process killed while writing one in place left exactly that. Written beside the file and renamed over it, a stamp
|
|
136
|
+
// is either there whole or not there, so its presence means the stage recorded what it read.
|
|
137
|
+
atomicWrite(stampPath(runDir, label), JSON.stringify({ label, ts: new Date().toISOString(), inputs }, null, 2) + "\n");
|
|
135
138
|
} catch { /* a stamp we could not write just means "not stale" downstream — never worse than today */ }
|
|
136
139
|
}
|
|
137
140
|
|
|
@@ -176,7 +179,7 @@ export function restamp(runDir, absPath, { project = null } = {}) {
|
|
|
176
179
|
else if ("proj" in e) { delete e.proj; hit = true; } // no longer projectable ⇒ whole-file fallback
|
|
177
180
|
}
|
|
178
181
|
}
|
|
179
|
-
if (hit) {
|
|
182
|
+
if (hit) { atomicWrite(p, JSON.stringify(doc, null, 2) + "\n"); touched++; }
|
|
180
183
|
}
|
|
181
184
|
} catch { /* best-effort */ }
|
|
182
185
|
return touched;
|
|
@@ -226,7 +229,7 @@ export function restampStage(runDir, label, absPath, { project = null } = {}) {
|
|
|
226
229
|
else if ("proj" in e) { delete e.proj; changed = true; }
|
|
227
230
|
}
|
|
228
231
|
}
|
|
229
|
-
if (changed)
|
|
232
|
+
if (changed) atomicWrite(p, JSON.stringify(doc, null, 2) + "\n");
|
|
230
233
|
return { stamped: true, matched, changed };
|
|
231
234
|
} catch { return miss; /* best-effort — a miss just means the delivery gate stays as strict as today */ }
|
|
232
235
|
}
|
|
@@ -300,7 +303,7 @@ export function reconcileStamps(runDir, inputsFor, exclude = null, { project = n
|
|
|
300
303
|
if (JSON.stringify(fresh) === JSON.stringify(doc.inputs)) continue;
|
|
301
304
|
doc.inputs = fresh;
|
|
302
305
|
doc.reconciledAt = new Date().toISOString();
|
|
303
|
-
try {
|
|
306
|
+
try { atomicWrite(p, JSON.stringify(doc, null, 2) + "\n"); touched++; } catch { /* best-effort */ }
|
|
304
307
|
}
|
|
305
308
|
} catch { /* best-effort */ }
|
|
306
309
|
return touched;
|