clearotron 0.5.0 → 0.5.1-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/CONTRIBUTING.md +2 -2
- package/INSTALL.md +351 -308
- package/QUICKSTART.md +12 -4
- package/README.md +12 -7
- package/THIRD-PARTY-NOTICES.md +4 -4
- package/bin/README.md +14 -11
- package/bin/clearotron.mjs +1 -1
- package/bin/connect.mjs +73 -25
- package/bin/example.mjs +4 -2
- package/bin/onboard.mjs +647 -352
- package/bin/start.mjs +213 -66
- package/bin/update.mjs +26 -13
- package/build-info.json +2 -2
- package/docs/CLIENT-MCP.md +1 -1
- package/docs/PORTAL.md +2 -2
- package/docs/architecture/02-architecture.md +3 -3
- package/docs/architecture/04-configuration-reference.md +2 -3
- package/docs/architecture/05-config-governance.md +1 -1
- package/docs/architecture/06-operations-runbook.md +1 -1
- package/driver/CHANGELOG.md +91 -0
- package/driver/README.md +2 -2
- package/driver/config-inventory.mjs +20 -11
- package/driver/contract-e3-backlog.mjs +27 -27
- package/driver/contract-e3-baseline.json +2 -2
- package/driver/contract-vocabulary.mjs +1 -1
- package/driver/degraded-parts.mjs +67 -3
- package/driver/dev-portal.mjs +1 -1
- package/driver/digest-queue.mjs +5 -5
- package/driver/driver.config.mjs +9 -9
- package/driver/engine/CONTRACT.md +1 -1
- package/driver/engine/anthropic-agent.mjs +4 -2
- package/driver/engine/jx-turn.mjs +10 -2
- package/driver/engine/mcp/band-server.mjs +1 -21
- package/driver/engine/mcp/clarivate-propose-tool.mjs +26 -0
- package/driver/engine/mcp/clarivate-server.mjs +2 -18
- package/driver/engine/mcp/fixture-register-server.mjs +33 -0
- package/driver/engine/mcp/gather-config.mjs +48 -7
- package/driver/engine/mcp/recording-server.mjs +206 -14
- package/driver/engine/mcp/supplemental.mjs +4 -2
- package/driver/engine/openai-agent.mjs +3 -1
- package/driver/engine/probe.mjs +10 -0
- package/driver/filing-goods.mjs +95 -0
- package/driver/findings-model.mjs +3 -0
- package/driver/gateway.mjs +42 -40
- package/driver/how-it-runs.mjs +103 -0
- package/driver/knockout-assess-record.mjs +54 -4
- package/driver/knockout-correction-record.mjs +342 -0
- package/driver/knockout-frame-record.mjs +4 -2
- package/driver/knockout-register-read.mjs +705 -0
- package/driver/knockout-register-record.mjs +222 -0
- package/driver/knockout-review-record.mjs +96 -25
- package/driver/narrative-refutation-record.mjs +87 -1
- package/driver/order-tables.mjs +23 -0
- package/driver/owner-use-check.mjs +5 -2
- package/driver/package.json +1 -1
- package/driver/partial-payload-baseline.json +8 -0
- package/driver/pipeline-knockout.mjs +506 -313
- package/driver/pipeline.mjs +179 -86
- package/driver/portal-local-auth.mjs +7 -1
- package/driver/portal-service.mjs +99 -9
- package/driver/progress.mjs +2 -2
- package/driver/publish/index.mjs +18 -21
- package/driver/publish/knockout.mjs +40 -18
- package/driver/publish/render-knockout.mjs +40 -27
- package/driver/publish/report-dates.mjs +43 -0
- package/driver/recall-reconciliation.mjs +2 -2
- package/driver/record-goods.mjs +50 -9
- package/driver/register-count.mjs +12 -59
- package/driver/register-fixture-marker.mjs +22 -0
- package/driver/register-plan.mjs +48 -0
- package/driver/register-records.mjs +84 -266
- package/driver/register-taint.mjs +2 -2
- package/driver/repair-composers.mjs +15 -8
- package/driver/result-noun-fields.mjs +6 -2
- package/driver/run-requirements.mjs +111 -37
- package/driver/runner.mjs +9 -16
- package/driver/skills/clearance-register/providers/clarivate.md +2 -2
- package/driver/skills/knockout-assess/SKILL.md +101 -100
- package/driver/skills/knockout-frame/SKILL.md +3 -1
- package/driver/skills/knockout-register-read/SKILL.md +77 -0
- package/driver/stages-knockout.mjs +159 -98
- package/driver/stages.mjs +4 -2
- package/driver/suite-census.json +435 -81
- package/driver/systemd/README.md +2 -2
- package/driver/unit-environment.mjs +19 -0
- package/driver/verify-knockout.mjs +175 -39
- package/driver/verify.mjs +10 -9
- package/mcp-server/CHANGELOG.md +8 -0
- package/mcp-server/CONNECT.md +4 -0
- package/mcp-server/demo-mode.mjs +6 -0
- package/mcp-server/lib/demo-texts.mjs +38 -0
- package/mcp-server/lib/http-handler.mjs +7 -1
- package/mcp-server/lib/knockout.mjs +3 -2
- package/mcp-server/lib/options.mjs +3 -1
- package/mcp-server/lib/plan.mjs +6 -1
- package/mcp-server/lib/runs.mjs +7 -2
- package/mcp-server/mint-token.mjs +1 -1
- package/mcp-server/package.json +1 -1
- package/mcp-server/serve.mjs +11 -0
- package/mcp-server/server.mjs +13 -5
- package/package.json +1 -1
- package/portal-ui/dist/assets/{index-D2wrw9cH.css → index-AtB9ZpDH.css} +29 -0
- package/portal-ui/dist/assets/{index-DcLbvFmQ.js → index-fPqAU0sx.js} +237 -231
- package/portal-ui/dist/index.html +2 -2
- package/portal-ui/package.json +4 -4
- package/providers/README.md +4 -4
- package/providers/_shared/execute-plan.mjs +45 -1
- package/providers/_shared/term-shape.mjs +1 -1
- package/providers/clarivate/src/capabilities.js +7 -6
- package/providers/clarivate/src/core.js +11 -7
- package/providers/clarivate/src/wider-list.js +104 -0
- package/providers/oauth-mcp-bridge/CHANGELOG.md +8 -0
- package/providers/oauth-mcp-bridge/package.json +1 -1
- package/providers/signa/src/capabilities.js +0 -9
- package/scripts/e2e-first-time.mjs +8 -7
- package/scripts/freeze-example-run.mjs +2 -2
- package/scripts/settings-render-check.mjs +5 -3
- package/scripts/test-run.mjs +8 -2
- package/shared/client-door.mjs +11 -8
- package/shared/connect-clients.mjs +10 -4
- package/shared/demo-connection.mjs +43 -0
- package/shared/demo-start-args.mjs +7 -2
- package/shared/invocation.mjs +18 -3
- package/shared/permanent-install.mjs +24 -0
- package/shared/scope.mjs +8 -1
- package/shared/server-units.mjs +37 -1
- package/shared/stdio-connect.mjs +43 -21
- package/shared/trigger-lane.mjs +7 -0
- package/shared/tty-style.mjs +21 -5
|
@@ -64,6 +64,18 @@ export const NOT_COMPLETED = "unfinished"; // → the row's fallback:
|
|
|
64
64
|
|
|
65
65
|
export const DEGRADED_PARTS_FILE = "degraded-parts.json";
|
|
66
66
|
|
|
67
|
+
// The run-log events of the coverage rows the driver adds once synthesis has settled (pipeline.mjs, the seam):
|
|
68
|
+
// one at the start of each pass, and one for each adder that failed in it. Each adder catches its own failure
|
|
69
|
+
// and the run goes on, so the event is the only trace that the row it exists to add is missing. The pipeline writes
|
|
70
|
+
// these names as literals, because the run log's names are read from the source and classed (scripts/e2e-first-time.mjs).
|
|
71
|
+
export const COVERAGE_ROWS_PASS = "coverage-rows-pass";
|
|
72
|
+
export const COVERAGE_ROW_NOT_ADDED = "coverage-row-not-added";
|
|
73
|
+
|
|
74
|
+
// The run-log events of the verdict's floors (pipeline.mjs, applyCoverageFloor): one at each entry, the floor being
|
|
75
|
+
// re-entered whenever the verdict can move, and one for each floor that threw in it. Written as literals, as above.
|
|
76
|
+
export const VERDICT_FLOORS_PASS = "verdict-floors-pass";
|
|
77
|
+
export const VERDICT_FLOOR_FAILED = "verdict-floor-failed";
|
|
78
|
+
|
|
67
79
|
const readJsonl = (p) => {
|
|
68
80
|
try {
|
|
69
81
|
return readFileSync(p, "utf8").split("\n").filter((l) => l.trim())
|
|
@@ -91,6 +103,12 @@ const lastEvent = (log, names) => {
|
|
|
91
103
|
return null;
|
|
92
104
|
};
|
|
93
105
|
|
|
106
|
+
/** The events after the last `marker`, or the whole log when it holds none. */
|
|
107
|
+
const sinceLast = (log, marker) => {
|
|
108
|
+
for (let i = log.length - 1; i >= 0; i--) if (log[i]?.event === marker) return log.slice(i + 1);
|
|
109
|
+
return log;
|
|
110
|
+
};
|
|
111
|
+
|
|
94
112
|
const reasonFor = (fail) => (/timeout|timed out/i.test(String(fail ?? "")) ? TIMED_OUT : NOT_COMPLETED);
|
|
95
113
|
|
|
96
114
|
// ── The checks. Each returns null, or {part, name, reason, cause}: `cause` is the raw fact for the run's
|
|
@@ -224,11 +242,25 @@ function checks(runDir, log) {
|
|
|
224
242
|
// A re-check that read ok and saved no review verified nothing: the correction stands unreviewed. A later receipt,
|
|
225
243
|
// which only a re-check that saved a review writes, clears it on a resume.
|
|
226
244
|
const unread = failedStep(log, "corrective-cycle-receipt", "verdict-recheck-unread");
|
|
227
|
-
if (unread && !reviewOpen && !recheck) failed.push(["the review's re-check",
|
|
245
|
+
if (unread && !reviewOpen && !recheck) failed.push(["the review's re-check", String(unread.fail ?? "").startsWith("file-save-refused:")
|
|
246
|
+
? `the review it saved as a file was refused (${unread.fail.slice("file-save-refused:".length)}), so the correction was not verified`
|
|
247
|
+
: "it saved no review, so the correction was not verified"]);
|
|
228
248
|
const rollback = failedStep(log, "corrective-cycle-receipt", "corrective-rollback");
|
|
229
249
|
if (rollback) failed.push(["the corrective pass, rolled back", rollback.reason]);
|
|
230
250
|
const crowd = failedStep(log, "crowd-context", "crowd-context-failed");
|
|
231
251
|
if (crowd) failed.push(["the crowd counts", crowd.fail]);
|
|
252
|
+
// The floor duty: whether every live identical or near-identical register record came back on the placement form.
|
|
253
|
+
// A derivation that threw checked nothing. One that could not be computed writes its own `floor-duty` event, which
|
|
254
|
+
// reads as the step's last word here; whether that state is itself a missing part is not settled by this check.
|
|
255
|
+
const floorDuty = failedStep(log, "floor-duty", "floor-duty-failed");
|
|
256
|
+
if (floorDuty) failed.push(["the floor duty", floorDuty.fail]);
|
|
257
|
+
// The comparison after a corrective pass of the record before and after it, which sends a stamp the pass promoted
|
|
258
|
+
// without a register call to the review. One that threw compared nothing.
|
|
259
|
+
const claims = lastEvent(log, ["evidence-claim-invariant"]);
|
|
260
|
+
if (claims?.ok === false) failed.push(["the check of a correction's evidence stamps", claims.why]);
|
|
261
|
+
// A floor of the verdict that threw on its last entry, which could not clamp what it exists to clamp.
|
|
262
|
+
for (const f of sinceLast(log, VERDICT_FLOORS_PASS).filter((e) => e?.event === VERDICT_FLOOR_FAILED))
|
|
263
|
+
failed.push([`the ${f.floor ?? "verdict"} floor`, f.fail]);
|
|
232
264
|
if (!failed.length) return null;
|
|
233
265
|
return { part: "checks", name: PART_NAMES.machineQc, reason: reasonFor(failed.map(([, why]) => why).join("; ")),
|
|
234
266
|
cause: failed.map(([what, why]) => `${what}: ${why ?? "no cause recorded"}`).join("; ") };
|
|
@@ -273,7 +305,36 @@ function officialRecords(runDir, log) {
|
|
|
273
305
|
cause: `the fetch ledger could not be read: ${last.ledgerError}` };
|
|
274
306
|
}
|
|
275
307
|
|
|
276
|
-
|
|
308
|
+
// The coverage rows the driver adds to the report and the workbook once synthesis has settled: the follow-ups left
|
|
309
|
+
// open, the native-language scope, a lane short of its depth, the marks the screen gate left unexamined, the meaning
|
|
310
|
+
// searches that did not complete, and the coverage judgment's own rows. An adder that failed left its row out and
|
|
311
|
+
// the run went on. Only the last pass counts, because a pass follows each rewrite of findings.json and adds the rows
|
|
312
|
+
// again: a later pass in which every adder succeeded clears an earlier failure, and a failure in the last pass stands
|
|
313
|
+
// when no pass came after it.
|
|
314
|
+
function coverageRows(runDir, log) {
|
|
315
|
+
const failed = sinceLast(log, COVERAGE_ROWS_PASS).filter((e) => e?.event === COVERAGE_ROW_NOT_ADDED);
|
|
316
|
+
if (!failed.length) return null;
|
|
317
|
+
return { part: "coverage-rows", name: PART_NAMES.coverage, reason: reasonFor(failed.map((e) => e.fail).join("; ")),
|
|
318
|
+
cause: failed.map((e) => `${e.adder ?? "an adder"}: ${e.fail ?? "no cause recorded"}`).join("; ") };
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
// The evidence stamps on the cards. At each seam the driver demotes a "verified from record" stamp that the reading
|
|
322
|
+
// log cannot back. A demotion it could not write leaves that stamp standing, and its record says how many; a
|
|
323
|
+
// derivation that threw checked none of them. Both leave the cards claiming records they cannot show, so they are
|
|
324
|
+
// the official records' line. A later derivation that wrote every demotion clears both.
|
|
325
|
+
function evidenceStamps(runDir, log) {
|
|
326
|
+
const threw = failedStep(log, "basis-derivation", "basis-derivation-failed");
|
|
327
|
+
let record = null;
|
|
328
|
+
try { record = JSON.parse(readFileSync(driverDir(runDir, "basis-derivation.json"), "utf8")); } catch { record = null; }
|
|
329
|
+
const standing = threw ? 0 : Number(record?.unwritable) || 0;
|
|
330
|
+
if (!threw && !standing) return null;
|
|
331
|
+
return { part: "evidence-stamps", name: RULED_WORDS.officialRecords, reason: NOT_COMPLETED,
|
|
332
|
+
cause: threw ? `the check of the cards' evidence stamps failed: ${threw.fail ?? "no cause recorded"}`
|
|
333
|
+
: `${standing} verified-from-record stamp(s) the reading log cannot back could not be demoted` };
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
const CHECKS = [assessment, overview, courtDecisions, searchLog, register, localLanguage, findingCards, checks, officialRecords,
|
|
337
|
+
coverageRows, evidenceStamps];
|
|
277
338
|
|
|
278
339
|
/**
|
|
279
340
|
* Every part of this clearance run that failed and still ships, read from the run directory as it stands
|
|
@@ -417,7 +478,7 @@ export function mergeDegradedRows(...lists) {
|
|
|
417
478
|
// The listing of filings and the owner lookups each end in one run-log event, a success or a failure, and
|
|
418
479
|
// the last of the pair is the step's state at delivery, so a resume that succeeded clears it. The
|
|
419
480
|
// plain-language review logs its outcome; the three that ship the rater's wording unreviewed are failures.
|
|
420
|
-
const REVIEW_FAILED = ["stage-failed", "artifact-unreadable", "rewrite-refused-by-the-merged-gate"];
|
|
481
|
+
const REVIEW_FAILED = ["stage-failed", "artifact-unreadable", "rewrite-refused-by-the-merged-gate", "correction-failed", "correction-refused-by-the-merged-gate", "correction-moved-what-no-defect-named", "recheck-failed"];
|
|
421
482
|
|
|
422
483
|
/** Which of the knockout's whole steps ended failed, each with its raw cause for the run's record. */
|
|
423
484
|
export function knockoutStepFailures(runDir) {
|
|
@@ -425,10 +486,13 @@ export function knockoutStepFailures(runDir) {
|
|
|
425
486
|
const listing = lastEvent(log, ["knockout-register-records", "knockout-register-records-refused", "knockout-register-records-failed"]);
|
|
426
487
|
const owners = failedStep(log, "knockout-owner-checks", "knockout-owner-checks-failed");
|
|
427
488
|
const review = lastEvent(log, ["knockout-review"]);
|
|
489
|
+
const reading = lastEvent(log, ["knockout-register-read", "knockout-register-read-failed"]);
|
|
428
490
|
const cause = (e) => String(e?.cause ?? e?.reason ?? e?.outcome ?? e?.event ?? "no cause recorded");
|
|
429
491
|
return {
|
|
430
492
|
listing: listing?.event === "knockout-register-records-failed" ? { reason: reasonFor(cause(listing)), cause: cause(listing) } : null,
|
|
431
493
|
ownerChecks: owners ? { reason: reasonFor(cause(owners)), cause: cause(owners) } : null,
|
|
494
|
+
// The reading step failed and the run carried what it held: the questions it had not asked never ran.
|
|
495
|
+
reading: reading?.event === "knockout-register-read-failed" ? { reason: reasonFor(cause(reading)), cause: cause(reading) } : null,
|
|
432
496
|
review: REVIEW_FAILED.includes(review?.outcome) ? { reason: reasonFor(cause(review)), cause: `${review.outcome}: ${cause({ reason: review.reason })}` } : null,
|
|
433
497
|
};
|
|
434
498
|
}
|
package/driver/dev-portal.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// dev-portal.mjs — the DEV-INSTANCE UI portal (docs/E2E.md Tier 1).
|
|
4
4
|
//
|
|
5
5
|
// THIS IS NOT THE PRODUCT, AND IT IS NOT HOW YOU START IT. If you arrived here looking for the way to
|
|
6
|
-
// run this system on one machine, the answer is `npm start` (bin/start.mjs, INSTALL.md §
|
|
6
|
+
// run this system on one machine, the answer is `npm start` (bin/start.mjs, INSTALL.md §5): the real
|
|
7
7
|
// portal with a real sign-in, and a Start button that works. This file is a loopback pool browser and
|
|
8
8
|
// dev cockpit for people working ON the engine — its name is accurate and its security note below is
|
|
9
9
|
// meant literally.
|
package/driver/digest-queue.mjs
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
// the stage-freshness staleness contract, so the cascade multiplies.
|
|
12
12
|
//
|
|
13
13
|
// THE DESIGN (owner-approved): the queue is the ONLY path to a non-fresh re-digest. Mechanisms keep
|
|
14
|
-
// their own cheap unit-level work (
|
|
14
|
+
// their own cheap unit-level work (unit followups, driver code-fetches) but stop calling the
|
|
15
15
|
// digest themselves — they MINT durable queue items instead, and the digest reconciles queued items
|
|
16
16
|
// at defined settlement points: ONCE before synthesis, plus at most one bounded late flush for
|
|
17
17
|
// post-synthesis triggers. Receipts survive resume: an item's receiptKey is minted at most once for
|
|
@@ -119,9 +119,9 @@ export function markFlushed(queue, ids, flushedAt) {
|
|
|
119
119
|
// it. Today the correction fires late; queued, it would never fire at all. `markFlushed` receipts
|
|
120
120
|
// only the items captured BEFORE the pass, so the orphan would sit pending and silent.
|
|
121
121
|
// 2. IT IS NOT THE COST THE FUNNEL BOUNDS. The funnel exists to stop N cold opus passes each
|
|
122
|
-
// invalidating the back half. Reconcile sends a
|
|
123
|
-
// (`sessionKey: r.sessionKey`)
|
|
124
|
-
// exempts for escalation/envelope/screen-gate, not the
|
|
122
|
+
// invalidating the back half. Reconcile sends a followup on the digest's own key
|
|
123
|
+
// (`sessionKey: r.sessionKey`), a fresh session doing scoped unit-level work: the same class the header
|
|
124
|
+
// already exempts for escalation/envelope/screen-gate, not the full pass it forbids.
|
|
125
125
|
// 3. ITS DURABILITY IS SOLVED ELSEWHERE, NOT MISSING. A queued item survives a crash; so does this,
|
|
126
126
|
// by a different mechanism — the followup receipt rides the recall-reconciliation artifact
|
|
127
127
|
// (`carryRecallFollowup`), bounded per unended-set signature by RECALL_FOLLOWUP_MAX, and the
|
|
@@ -153,7 +153,7 @@ export const DIGEST_OWN_PASS_EXEMPTIONS = Object.freeze([
|
|
|
153
153
|
|
|
154
154
|
// ── the consolidated settlement followup ───────────────────────────────────────────────────────────
|
|
155
155
|
|
|
156
|
-
// The standard digest
|
|
156
|
+
// The standard digest preamble every re-digest followup opens with (verbatim from the legacy
|
|
157
157
|
// escalation/envelope/frame-reopen followups — shared so the OFF path stays byte-identical).
|
|
158
158
|
export const DIGEST_RESUME_PREAMBLE =
|
|
159
159
|
"This is a fresh session: your earlier register-digest work is not in your context, and the unit files are among the inputs listed below. Your prior digest is the findings file named below. Do NOT redo it from scratch.";
|
package/driver/driver.config.mjs
CHANGED
|
@@ -1122,7 +1122,7 @@ export const PROVIDERS = {
|
|
|
1122
1122
|
const base = process.env.CLARIVATE_API_BASE || DEFAULT_BASE;
|
|
1123
1123
|
try {
|
|
1124
1124
|
return await doCountHits(process.env.CLARIVATE_API_KEY, base,
|
|
1125
|
-
{ name, match_mode: matchMode, nice_classes: classes ?? [], ...(regions?.length ? { regions } : {}) },
|
|
1125
|
+
{ ...(Array.isArray(name) ? { names: name } : { name }), match_mode: matchMode, nice_classes: classes ?? [], ...(regions?.length ? { regions } : {}) },
|
|
1126
1126
|
{ kind: "count_hits", agentId, sessionKey, sessionId: null, recordLog });
|
|
1127
1127
|
} catch (e) { return { ok: false, total: null, reason: `count threw: ${e.message}` }; }
|
|
1128
1128
|
},
|
|
@@ -1862,7 +1862,7 @@ export const SERP_PROVIDERS = {
|
|
|
1862
1862
|
credEnv: "SERPAPI_API_KEY",
|
|
1863
1863
|
// As above — the field pair setup derives its prompt from (: this key was never
|
|
1864
1864
|
// prompted for, and a reader who finished setup as designed had every marketplace grid cell gap).
|
|
1865
|
-
absentMeans: "
|
|
1865
|
+
absentMeans: "the Chinese marketplaces come back as a disclosed gap",
|
|
1866
1866
|
obtain: "https://serpapi.com/manage-api-key — self-serve, free tier exists",
|
|
1867
1867
|
async search({ engine, term, site, count }) {
|
|
1868
1868
|
if (!process.env.SERPAPI_API_KEY) return { ok: false, cause: "SERPAPI_API_KEY absent from driver env" };
|
|
@@ -2104,11 +2104,11 @@ export const ENGINE_BINARIES = {
|
|
|
2104
2104
|
// it moved to 2.1.284: a stage that asks for haiku is asking for the current haiku.
|
|
2105
2105
|
package: "@anthropic-ai/claude-code", floor: "2.1.293",
|
|
2106
2106
|
// WHAT THE INSTALL TAKES ON DISK, in MB, which setup states before it asks to install. MEASURED, not
|
|
2107
|
-
// declared by the vendor: the engines folder after a fresh install
|
|
2108
|
-
//
|
|
2109
|
-
// on npm 10.9.9
|
|
2110
|
-
// Re-measure when the floor moves.
|
|
2111
|
-
installMB:
|
|
2107
|
+
// declared by the vendor: the engines folder (`du -sm`) after a fresh install into an empty folder with
|
|
2108
|
+
// setup's own command, which fetches the newest release at or above the floor rather than the floor
|
|
2109
|
+
// itself. Measured 2026-11-05 on npm 10.9.9: 323 MB for 2.1.318; 2.1.293 alone is 242. A later release
|
|
2110
|
+
// can be larger or smaller, so setup says "about". Re-measure when the floor moves.
|
|
2111
|
+
installMB: 323,
|
|
2112
2112
|
// The licence setup states wherever it tells a reader what they are about to install or use, as the
|
|
2113
2113
|
// vendor's package declares it: "SEE LICENSE IN README.md", Anthropic's own terms.
|
|
2114
2114
|
licence: "proprietary third-party software",
|
|
@@ -2142,13 +2142,13 @@ export const ENGINE_BINARIES = {
|
|
|
2142
2142
|
// judgment-tier stage (the tiers are in engine/openai-agent.mjs). The old floor, 0.154.0, was the
|
|
2143
2143
|
// permissions feature's (engine/mcp/codex-config.mjs).
|
|
2144
2144
|
package: "@openai/codex", floor: "0.159.0",
|
|
2145
|
-
installMB:
|
|
2145
|
+
installMB: 436, // measured the same way as Claude's, above: setup's command fetched 0.166.0, 2026-11-05; 0.159.0 alone is 424
|
|
2146
2146
|
licence: "third-party software under the Apache-2.0 licence", // the package's own "license" field
|
|
2147
2147
|
label: "OpenAI — each stage runs as a headless `codex exec` turn",
|
|
2148
2148
|
module: "engine/openai-agent.mjs", adapter: "openaiAgentEngine",
|
|
2149
2149
|
signIn: "run `codex login`",
|
|
2150
2150
|
authEnv: "CLEAROTRON_AI_BILLING", apiKeyEnv: "CODEX_API_KEY",
|
|
2151
|
-
subscriptionHow: "sign in once with `codex login`
|
|
2151
|
+
subscriptionHow: "sign in once with `codex login`",
|
|
2152
2152
|
// — codex's headless ending writes its own ~/.codex/auth.json; there is no
|
|
2153
2153
|
// token to capture into an env file, and inventing one would be a route nobody has driven.
|
|
2154
2154
|
headless: { cmd: "codex login --device-auth", tokenEnv: null },
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Engine contract — the engine seam
|
|
2
2
|
|
|
3
3
|
Two engine adapters are implemented: `anthropic-agent` (`claude -p`) and `openai-agent` (`codex exec`).
|
|
4
|
-
`
|
|
4
|
+
`CLEAROTRON_AI` selects one; unset, no engine is chosen and every search is refused.
|
|
5
5
|
|
|
6
6
|
The seam is an explicit **registry**, not a hardcode: `selectEngine()` resolves `CLEAROTRON_AI` against
|
|
7
7
|
the adapters `registerEngine()` holds, and an unknown value fails loud rather than running the wrong
|
|
@@ -818,7 +818,9 @@ export const anthropicAgentEngine = {
|
|
|
818
818
|
if (periodStart === null || openAsks.length === 0) return;
|
|
819
819
|
const k = periodKey() || "?";
|
|
820
820
|
const spent = Math.max(0, now - periodStart);
|
|
821
|
-
|
|
821
|
+
// A period seen across two chunks is measured even when the clock reads it as 0 ms, as a coarse clock can:
|
|
822
|
+
// its ask is named with what the clock gave. Crediting only a positive wait dropped it, unmeasured and undeclared.
|
|
823
|
+
if (spent > 0 || periodChunk !== chunkSeq) {
|
|
822
824
|
toolWaitMs += spent;
|
|
823
825
|
toolWaitByTool[k] = (toolWaitByTool[k] ?? 0) + spent;
|
|
824
826
|
}
|
|
@@ -1170,7 +1172,7 @@ export const anthropicAgentEngine = {
|
|
|
1170
1172
|
// A3 overflow is likewise a hard failure (resultEvent is null → already caught here; kept explicit).
|
|
1171
1173
|
const failed = overflow || killed || !resultEvent || resultEvent.is_error || resultEvent.subtype !== "success";
|
|
1172
1174
|
// stall → make isTimeout fire (killed) AND carry the stall stderr signature the classifier reads, so the
|
|
1173
|
-
// taxonomy is identical; a 0-token stall then classifies as lane_wedge
|
|
1175
|
+
// taxonomy is identical; a 0-token stall then classifies as lane_wedge, which stage()'s lane-wedge retry takes.
|
|
1174
1176
|
// overflow → carry a clear signature (killed stays false so it is a plain nonzero_exit, NOT a timeout/wedge).
|
|
1175
1177
|
const stderrOut = overflow
|
|
1176
1178
|
? (stderr + `\nanthropic-agent output overflow: stdout/stderr exceeded ${maxBuffer} chars — killed the tree and failed the turn (truncated tail never parsed)`)
|
|
@@ -37,8 +37,9 @@
|
|
|
37
37
|
// replaces — today's lanes are simply skipped or billed elsewhere on codex — and it is a real gap, so
|
|
38
38
|
// `truncationObservable` rides every result and a reader can tell which kind of `ok` they are holding.
|
|
39
39
|
|
|
40
|
-
import { ENGINE_BINARIES,
|
|
40
|
+
import { ENGINE_BINARIES, engineAdapterSpecifier } from "../driver.config.mjs";
|
|
41
41
|
import { resolveAuthMode } from "./auth.mjs";
|
|
42
|
+
import { whatIsMissing } from "../run-requirements.mjs"; // — the order-time gate's words for an AI nobody has chosen
|
|
42
43
|
|
|
43
44
|
/** The driver's tier vocabulary, not a wire model id (engine/CONTRACT.md §3) — the cheap rung on both. */
|
|
44
45
|
export const JX_TIER = "haiku";
|
|
@@ -132,7 +133,14 @@ export async function makeJxTurnRunner({
|
|
|
132
133
|
// Names the lane in the one message a caller shows a human when the configuration refuses.
|
|
133
134
|
lane = "the jx lanes",
|
|
134
135
|
} = {}) {
|
|
135
|
-
|
|
136
|
+
// NO AI CHOSEN IS NOT THE DEFAULT AI. With CLEAROTRON_AI unset this door resolved the code's default, so an
|
|
137
|
+
// install with no AI chosen got a turn runner on that AI's program, billed to whatever it was signed in to:
|
|
138
|
+
// the portal booted "brief reading ON — engine=anthropic-agent", and Describe-it would have spent a turn
|
|
139
|
+
// there (measured on a fresh install of 0.5.1-beta.0, 2026-11-07). A search with no AI chosen is refused at
|
|
140
|
+
// order time, before a lane could ask; the portal's reader asks at boot. So the door refuses here, in the
|
|
141
|
+
// order-time gate's own words, and reads the setting as that gate reads it: blank is not chosen.
|
|
142
|
+
if (!String(env.CLEAROTRON_AI ?? "").trim()) return { error: whatIsMissing([{ about: "ai" }]) };
|
|
143
|
+
const id = String(env.CLEAROTRON_AI).trim().toLowerCase();
|
|
136
144
|
if (!ENGINE_BINARIES[id]) return { error: `CLEAROTRON_AI=${id} is not an engine this driver ships` };
|
|
137
145
|
|
|
138
146
|
let auth;
|
|
@@ -24,7 +24,7 @@ import { answerBudget, quotedBytes } from "../../../shared/answer-parts.mjs";
|
|
|
24
24
|
import { classifyRecord, prepareTargets, SHAPE_TIERS, isLiveRecord, niceClassKey, withoutPlacementOrders } from "../../band-shape.mjs";
|
|
25
25
|
import { recordQids } from "../../named-band.mjs";
|
|
26
26
|
import { normalizeRecordUri } from "../../registry-fidelity.mjs";
|
|
27
|
-
import { bandGoodsIndex, goodsFor, goodsWordCounter, goodsWordsMatched,
|
|
27
|
+
import { bandGoodsIndex, goodsFor, goodsWordCounter, goodsWordsMatched, recordAsServed, untaggedIsEnglish, rowGoods } from "../../record-goods.mjs";
|
|
28
28
|
import { recordGoodsEvidence, heldRecordProvenance, recordFetchOutcomes, readRunCallRows, goodsFromLabel, registerPageLabel } from "../../goods-evidence.mjs";
|
|
29
29
|
import { savedStatusPages } from "../../saved-register-pages.mjs";
|
|
30
30
|
import { DEFAULT_LEDGER_PATH } from "../../provider-usage.mjs";
|
|
@@ -462,26 +462,6 @@ function bandLookup(params = {}) {
|
|
|
462
462
|
return out;
|
|
463
463
|
}
|
|
464
464
|
|
|
465
|
-
// A RECORD'S GOODS ARE SERVED ONCE. A Clarivate record carries the register's raw goods list beside the
|
|
466
|
-
// normalised goods the provider maps from it item for item (record-goods.mjs `rawGoodsCarried`), so every goods
|
|
467
|
-
// statement was read twice. On a crowded test run, 2026-10-13, one synthesis attempt read 10.79 MB of record
|
|
468
|
-
// text in 549 calls; served this way, the same records come to 6.04 MB in 398. Where the normalised goods carry
|
|
469
|
-
// the raw list, the record is served without that list, in the file's own layout and field order, and anything
|
|
470
|
-
// else in the raw goods block stays; where they do not, or the text is not a record, it is served as it
|
|
471
|
-
// stands. The file on disk is never touched, and the reading audit says how much was left out.
|
|
472
|
-
function recordAsServed(text) {
|
|
473
|
-
let body;
|
|
474
|
-
try { body = JSON.parse(text); } catch { return { text, audit: {} }; }
|
|
475
|
-
if (!rawGoodsCarried(body)) return { text, audit: {} };
|
|
476
|
-
const goods = { ...body._raw.goodsServices };
|
|
477
|
-
delete goods.intClassDescriptions;
|
|
478
|
-
const raw = { ...body._raw, goodsServices: goods };
|
|
479
|
-
if (!Object.keys(goods).length) delete raw.goodsServices;
|
|
480
|
-
const indent = /^\{\n( +)"/.exec(text)?.[1]?.length ?? 0;
|
|
481
|
-
const served = JSON.stringify({ ...body, _raw: raw }, null, indent) + (text.endsWith("\n") ? "\n" : "");
|
|
482
|
-
return { text: served, audit: { raw_goods_left_out: text.length - served.length } };
|
|
483
|
-
}
|
|
484
|
-
|
|
485
465
|
function bandRecord(params = {}) {
|
|
486
466
|
if (!RUN_DIR) return { isError: true, text: "ERROR: CLEAROTRON_BAND_RUN_DIR not set — band tools are wired per run by the driver." };
|
|
487
467
|
const uri = String(params.record_id ?? "").trim();
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
// Copyright 2026 Cordillera Sàrl. Additional terms under section 7 of the AGPL-3.0 apply — see ADDITIONAL-TERMS.md
|
|
3
|
+
//
|
|
4
|
+
// clarivate-propose-tool.mjs — the words and the schema of Clarivate's `register_propose_supplemental`, one copy: the
|
|
5
|
+
// live server serves them, and the fixture server serves them too, so a replay on saved data reads what a run reads.
|
|
6
|
+
import { narrowingFields } from "./proposal-fields.mjs";
|
|
7
|
+
|
|
8
|
+
export const CLARIVATE_PROPOSE_TOOL = Object.freeze({
|
|
9
|
+
description: "PROPOSE judgment-addition register queries; CODE executes them and writes the band (the supplemental lane — you never run register coverage by hand and never author band blocks). Each proposal: {predicate: exact|default|wildcard|phonetic|owner, term OR terms[] (OR-stack, split anything wider than the plan bound), romanization (MANDATORY beside a single non-Latin term — this register indexes non-Latin filings by their transliteration and refuses bare characters), owner? (a mark-text proposal may add an owner SCOPE FIELD — the owner×term intersection slice, the watchlist-coverage move), nice_classes (REQUIRED — an unscoped sweep is rejected), regions?, rationale?, term_literal? (true asserts the term IS a mark verbatim, bypassing the shape lint)}. Terms must be MARK-SHAPED and agree with the predicate: an anchored `*` needs predicate:wildcard, and a label/prose string (>4 words, parentheticals) is rejected — supply the mark terms it stands for. The tool mints each proposal as a qid'd supplemental plan entry (deterministic qid — re-proposing the same query reuses it, never duplicates; re-proposing a bare non-Latin term WITH its romanization enriches the existing entry and re-executes it), executes them through the same deterministic executor as the dictated plan (count-first per-term truth, ceiling, chunking, error stamping), MERGES the results into the band at output_path itself, and returns per-qid results read back from the band: {state, total_hits, count, term_counts?, reason?, records_preview[≤25]}. Iterate freely: propose → read counts → propose narrower. A crowd result (state:incomplete) is a descriptor for judgment — never a clean.",
|
|
10
|
+
inputSchema: { type: "object", required: ["axis", "output_path", "proposals"], properties: {
|
|
11
|
+
axis: { type: "string", description: "The register axis these supplementals belong to (e.g. primary-sweep)" },
|
|
12
|
+
output_path: { type: "string", description: "Absolute path of the named band to merge into (register-units/<axis>-band.json)" },
|
|
13
|
+
proposals: { type: "array", minItems: 1, items: { type: "object", properties: {
|
|
14
|
+
predicate: { type: "string", enum: ["exact", "default", "wildcard", "phonetic", "owner"] },
|
|
15
|
+
term: { type: "string" }, terms: { type: "array", items: { type: "string" } },
|
|
16
|
+
romanization: { type: "string", description: "The Latin-script form of a NON-LATIN term — plain ASCII letters/digits, syllable-separated by single spaces, no tone marks or diacritics (华威豹 → \"HUA WEI BAO\", ワボスラッシュ → \"WABO SURASSHU\"). MANDATORY beside a non-Latin term: without it this register cannot answer the characters and the slice defers. Single-term proposals only (never an OR-stack, never predicate:owner), and never on a term that is already Latin." },
|
|
17
|
+
owner: { type: "string", description: "OPTIONAL owner scope field on a MARK-TEXT proposal: the query is the owner×term intersection (the owner's filings within the term band). Not allowed on predicate:owner (there the owner name IS the term)." },
|
|
18
|
+
nice_classes: { type: "array", items: {} },
|
|
19
|
+
// The narrowing fields every register serves (proposal-fields.mjs); this register's two facts ride in.
|
|
20
|
+
...narrowingFields({ regions: "OPTIONAL. Omit to inherit the frozen plan's regions (the matter's territorial scope) — this provider REQUIRES at least one office on every request, so an omitted list is backfilled from the plan, never treated as a worldwide sweep. Supply it only to search a NARROWER set than the matter's scope.",
|
|
21
|
+
goodsNote: "One office in this provider's vocabulary refuses the field and fails the whole call, so it is left out of that office's request and recorded as asked-without-goods rather than dropped in silence." }),
|
|
22
|
+
rationale: { type: "string" },
|
|
23
|
+
term_literal: { type: "boolean", description: "TRUE only when the term genuinely IS the mark verbatim (a multi-word slogan mark, a mark carrying an anchored star) — it bypasses the term-shape lint. Never use it to push a label through." },
|
|
24
|
+
} } },
|
|
25
|
+
} },
|
|
26
|
+
});
|
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
CAPABILITIES, doSearch, doRecordFetch, doImageFetch, doBatchScreen, doEnumerate, doExecutePlan, DEFAULT_BASE,
|
|
36
36
|
} from "../../../providers/clarivate/src/core.js";
|
|
37
37
|
import { proposeSupplemental } from "./supplemental.mjs";
|
|
38
|
-
import {
|
|
38
|
+
import { CLARIVATE_PROPOSE_TOOL } from "./clarivate-propose-tool.mjs";
|
|
39
39
|
|
|
40
40
|
const API_KEY = process.env.CLARIVATE_API_KEY || "";
|
|
41
41
|
const BASE = process.env.CLARIVATE_API_BASE || DEFAULT_BASE;
|
|
@@ -131,23 +131,7 @@ serve({
|
|
|
131
131
|
},
|
|
132
132
|
{
|
|
133
133
|
name: "register_propose_supplemental",
|
|
134
|
-
|
|
135
|
-
inputSchema: { type: "object", required: ["axis", "output_path", "proposals"], properties: {
|
|
136
|
-
axis: { type: "string", description: "The register axis these supplementals belong to (e.g. primary-sweep)" },
|
|
137
|
-
output_path: { type: "string", description: "Absolute path of the named band to merge into (register-units/<axis>-band.json)" },
|
|
138
|
-
proposals: { type: "array", minItems: 1, items: { type: "object", properties: {
|
|
139
|
-
predicate: { type: "string", enum: ["exact", "default", "wildcard", "phonetic", "owner"] },
|
|
140
|
-
term: { type: "string" }, terms: { type: "array", items: { type: "string" } },
|
|
141
|
-
romanization: { type: "string", description: "The Latin-script form of a NON-LATIN term — plain ASCII letters/digits, syllable-separated by single spaces, no tone marks or diacritics (华威豹 → \"HUA WEI BAO\", ワボスラッシュ → \"WABO SURASSHU\"). MANDATORY beside a non-Latin term: without it this register cannot answer the characters and the slice defers. Single-term proposals only (never an OR-stack, never predicate:owner), and never on a term that is already Latin." },
|
|
142
|
-
owner: { type: "string", description: "OPTIONAL owner scope field on a MARK-TEXT proposal: the query is the owner×term intersection (the owner's filings within the term band). Not allowed on predicate:owner (there the owner name IS the term)." },
|
|
143
|
-
nice_classes: { type: "array", items: {} },
|
|
144
|
-
// The narrowing fields every register serves (proposal-fields.mjs); this register's two facts ride in.
|
|
145
|
-
...narrowingFields({ regions: "OPTIONAL. Omit to inherit the frozen plan's regions (the matter's territorial scope) — this provider REQUIRES at least one office on every request, so an omitted list is backfilled from the plan, never treated as a worldwide sweep. Supply it only to search a NARROWER set than the matter's scope.",
|
|
146
|
-
goodsNote: "One office in this provider's vocabulary refuses the field and fails the whole call, so it is left out of that office's request and recorded as asked-without-goods rather than dropped in silence." }),
|
|
147
|
-
rationale: { type: "string" },
|
|
148
|
-
term_literal: { type: "boolean", description: "TRUE only when the term genuinely IS the mark verbatim (a multi-word slogan mark, a mark carrying an anchored star) — it bypasses the term-shape lint. Never use it to push a label through." },
|
|
149
|
-
} } },
|
|
150
|
-
} },
|
|
134
|
+
...CLARIVATE_PROPOSE_TOOL,
|
|
151
135
|
// ARITY: proposeSupplemental calls executePlan(auth, params, tctx) — THREE args, because corsearch's
|
|
152
136
|
// doExecutePlan is (sessionKey, params, tctx). Clarivate's is (apiKey, base, params, tctx), so the
|
|
153
137
|
// injected executor MUST close over BASE here. Passing doExecutePlan bare would shift base←params
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
3
|
+
// Copyright 2026 Cordillera Sàrl. Additional terms under section 7 of the AGPL-3.0 apply — see ADDITIONAL-TERMS.md
|
|
4
|
+
// fixture-register-server.mjs — the register tool a fixture run's reading step holds. Same tool, same words, same mint
|
|
5
|
+
// and same band as a live run, answered from the job's fixture directory. It reaches no register: a question the
|
|
6
|
+
// directory holds no answer for comes back as a failure, never as a zero. Mounted by gather-config when the run says so.
|
|
7
|
+
import { serve } from "./stdio-server.mjs";
|
|
8
|
+
import { proposeSupplemental } from "./supplemental.mjs";
|
|
9
|
+
import { CLARIVATE_PROPOSE_TOOL } from "./clarivate-propose-tool.mjs";
|
|
10
|
+
import { crowdNoteFor } from "./crowd-note.mjs"; // how the unit decides on a crowd, as a live register's server says it
|
|
11
|
+
import { capabilitiesFor } from "../../register-capabilities.mjs";
|
|
12
|
+
import { fixtureRecordsDir } from "../../register-fixture-marker.mjs";
|
|
13
|
+
import { fixtureLister } from "../../register-records.mjs";
|
|
14
|
+
import { executeQuestionsWithLister } from "../../knockout-register-read.mjs";
|
|
15
|
+
|
|
16
|
+
const runDir = process.env.CLEAROTRON_BAND_RUN_DIR || "";
|
|
17
|
+
serve({
|
|
18
|
+
name: "register", noteFor: crowdNoteFor,
|
|
19
|
+
tools: [{
|
|
20
|
+
name: "register_propose_supplemental",
|
|
21
|
+
...CLARIVATE_PROPOSE_TOOL,
|
|
22
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
23
|
+
handler: (a) => {
|
|
24
|
+
const dir = fixtureRecordsDir(runDir);
|
|
25
|
+
if (!dir) return { type: "text", text: "ERROR: this run declares no fixture directory, and this server reaches no register." };
|
|
26
|
+
const lister = fixtureLister(dir);
|
|
27
|
+
return proposeSupplemental(a, { kind: "propose_supplemental", recordLog: process.env.CLEAROTRON_REGISTER_RECORD_LOG || null }, {
|
|
28
|
+
executePlan: (params) => executeQuestionsWithLister(lister, params),
|
|
29
|
+
capabilities: capabilitiesFor(process.env.CLEAROTRON_DATABASE),
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
}],
|
|
33
|
+
});
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
import { fileURLToPath } from "node:url";
|
|
11
11
|
import { dirname, join } from "node:path";
|
|
12
12
|
import { requireRegisterProvider } from "../../driver.config.mjs";
|
|
13
|
+
import { fixtureRecordsDir } from "../../register-fixture-marker.mjs";
|
|
13
14
|
import { ledgerPath, runRecordLogPath } from "../../../providers/_shared/ledger-path.mjs";
|
|
14
15
|
import { CORRECTION_POSITIONS_ENV } from "./correction-positions.mjs"; // the positions a correction hands its save
|
|
15
16
|
|
|
@@ -548,7 +549,7 @@ const RECORDING = Object.freeze({
|
|
|
548
549
|
"knockout-assess": {
|
|
549
550
|
seatWrites: false,
|
|
550
551
|
perChunk: true,
|
|
551
|
-
tools: Object.freeze(["record_knockout_assess"]),
|
|
552
|
+
tools: Object.freeze(["record_knockout_assess", "read_register_list"]),
|
|
552
553
|
reason: "hands back the per-chunk rated assessment as VALUES through record_knockout_assess instead "
|
|
553
554
|
+ "of writing knockout-assess-<n>.json itself, so the band, the class arrays and the typed read "
|
|
554
555
|
+ "(basis / factors / counterFactors / mitigation) are accepted or refused BY PATH at the call "
|
|
@@ -558,15 +559,31 @@ const RECORDING = Object.freeze({
|
|
|
558
559
|
+ "CALLS, UNMEASURED PRE-CONVERSION — this lane's seats hold no tools today, so the first "
|
|
559
560
|
+ "converted run is where the count comes from",
|
|
560
561
|
},
|
|
562
|
+
// THE KNOCKOUT'S READING STEP. It holds the register's propose tool beside this key (`toolGroupsForStage` below),
|
|
563
|
+
// reads what its questions returned through `read_register_list`, a read of this run's own bands and held records that
|
|
564
|
+
// dials nothing, and hands its judgment back as VALUES. The questions themselves are the register tool's to record, so
|
|
565
|
+
// this key carries no retrieval.
|
|
566
|
+
"knockout-register-read": {
|
|
567
|
+
seatWrites: false,
|
|
568
|
+
keepsRetrieval: true,
|
|
569
|
+
tools: Object.freeze(["record_knockout_register_read", "read_register_list"]),
|
|
570
|
+
reason: "hands back the filings it carries forward, what it set aside and why, and what it chose not to ask as "
|
|
571
|
+
+ "VALUES through record_knockout_register_read, so the driver joins each record id to the band at the call and "
|
|
572
|
+
+ "refuses a record that leaves a read list, a crowd or a count unaccounted for. Born typed: there was no earlier "
|
|
573
|
+
+ "form of this stage. EXPECTED FROM THE DICTATION'S ORDERED CALLS, UNMEASURED: the first replay on saved data is "
|
|
574
|
+
+ "where the count comes from",
|
|
575
|
+
},
|
|
561
576
|
// THE LANE'S THIRD CONVERSION, and the only stage on it that was born typed — there is no
|
|
562
577
|
// pre-conversion knockout-review that wrote its own file, so nothing here is a migration.
|
|
563
578
|
//
|
|
564
|
-
// NOT FANNED. The pass reads the WHOLE merged record in one turn, because the rule it applies is about
|
|
579
|
+
// NOT FANNED BY NAME. The pass reads the WHOLE merged record in one turn, because the rule it applies is about
|
|
565
580
|
// consistency across the lines a reader meets: two marks' basis lines rewritten in separate turns drift
|
|
566
|
-
// apart in register, which is the defect the pass exists to remove.
|
|
581
|
+
// apart in register, which is the defect the pass exists to remove. The suffix says WHICH PASS: `#1` is the
|
|
582
|
+
// fresh read of a corrected record, under its own artifact.
|
|
567
583
|
"knockout-review": {
|
|
568
584
|
seatWrites: false,
|
|
569
|
-
|
|
585
|
+
perChunk: true,
|
|
586
|
+
tools: Object.freeze(["record_knockout_review", "read_register_list"]),
|
|
570
587
|
reason: "hands back rewrites as VALUES, each naming the line it replaces by the typed address the "
|
|
571
588
|
+ "driver measured and handed over. The address is what makes this a transport rather than a "
|
|
572
589
|
+ "matching problem: prose quoted back has to be found again in the record, and the finder then "
|
|
@@ -575,6 +592,15 @@ const RECORDING = Object.freeze({
|
|
|
575
592
|
+ "DICTATION'S ORDERED CALLS, UNMEASURED PRE-CONVERSION — this lane's seats hold no tools today, "
|
|
576
593
|
+ "so the first converted run is where the count comes from",
|
|
577
594
|
},
|
|
595
|
+
// A MATERIAL DEFECT'S REPAIR, per chunk, dispatched only when the check raised one.
|
|
596
|
+
"knockout-correct": {
|
|
597
|
+
seatWrites: false,
|
|
598
|
+
perChunk: true,
|
|
599
|
+
tools: Object.freeze(["record_knockout_correction", "read_register_list"]),
|
|
600
|
+
reason: "hands back only what a defect's repair changes, as VALUES merged onto the chunk as rated, so a name or a "
|
|
601
|
+
+ "finding no defect names cannot move and the corrected chunk passes the rated chunk's gates at the call. Born "
|
|
602
|
+
+ "typed. EXPECTED FROM THE DICTATION'S ORDERED CALLS, UNMEASURED: the first saved-data run is where the count comes from",
|
|
603
|
+
},
|
|
578
604
|
});
|
|
579
605
|
|
|
580
606
|
// stage → its server key. DERIVED, and the alphabet is checked rather than assumed: an underscore in a
|
|
@@ -810,6 +836,9 @@ function resolveGroup(group) {
|
|
|
810
836
|
// aggregate EUIPO, so the second call buys nothing and costs wall time. EUIPO reaches a run only as
|
|
811
837
|
// the ACTIVE register — or as a member of the `free-tier` composite above.
|
|
812
838
|
case "register": return { local: ["register"], bridges: [], extra: [] };
|
|
839
|
+
// THE REGISTER'S PROPOSE TOOL ALONE, for a stage whose every question must be minted, receipted and joined to its
|
|
840
|
+
// name. The same server under the same key; only the grant is narrower, and it reads the same on both engines.
|
|
841
|
+
case "register-questions": return { local: ["register"], bridges: [], extra: [], only: ["register_propose_supplemental"] };
|
|
813
842
|
case "band": return { local: ["band"], bridges: [], extra: [] };
|
|
814
843
|
// COVERAGE. `bridges: []` is load-bearing exactly as on the recording group below: this group's
|
|
815
844
|
// one promise is that it widens no retrieval surface — it carries the digest's record tool and
|
|
@@ -951,6 +980,8 @@ export function buildGatherMcpConfig(groups = [], { sessionKey, agent, runDir, r
|
|
|
951
980
|
}
|
|
952
981
|
const env = serverEnv({ sessionKey, agent, runDir, recordAxis, bandGroups, correctionPositions });
|
|
953
982
|
for (const k of localKeys) mcpServers[k] = { command: NODE, args: [join(MCP_DIR, localEntry(k).script)], env };
|
|
983
|
+
// A FIXTURE RUN NEVER REACHES A LIVE REGISTER, and its job says so: the same key serves its canned answers.
|
|
984
|
+
if (localKeys.has("register") && runDir && fixtureRecordsDir(runDir)) mcpServers.register.args = [join(MCP_DIR, "fixture-register-server.mjs")];
|
|
954
985
|
// — THE BRIDGES GET THE AUDIT ENV, AND ONLY THAT. Until now they were spawned with no env at
|
|
955
986
|
// all, so a case-law tool call had nowhere to log: `tool-calls.jsonl` recorded server/tool/ok and the
|
|
956
987
|
// bridge could not write what was asked or what came back. That is why a cited authority and an
|
|
@@ -987,6 +1018,9 @@ export function toolGroupsForStage(name = "") {
|
|
|
987
1018
|
// the seat's, and the two are separate artifacts with separate writers. An allowlist growing by one
|
|
988
1019
|
// token on an already-tooled stage, so no argv-surface transition fires.
|
|
989
1020
|
if (name.startsWith("register-unit")) return ["register", "unit-note"];
|
|
1021
|
+
// THE KNOCKOUT'S READING STEP asks the register what the clearance's reading turn asks it, through the same tool, and
|
|
1022
|
+
// hands its judgment back on its own key. RETRIEVAL AND RECORDING, composed as the other two such branches compose it.
|
|
1023
|
+
if (name === "knockout-register-read") return ["register-questions", recordingKey("knockout-register-read")];
|
|
990
1024
|
// PR-8 (reading layer): the band-consuming judgment stages hold the READ-ONLY band tools — the shape,
|
|
991
1025
|
// record lookups over the frozen band, and the run's fetched official records (band_record finally
|
|
992
1026
|
// feeds _records/ to judgment) — every call logged to the reading audit.
|
|
@@ -1306,7 +1340,7 @@ export const RECORDING_TOOLS = Object.freeze({
|
|
|
1306
1340
|
//
|
|
1307
1341
|
// No search tool: this stage's reads are enumerable — its skill doc, the deck, the firm-wide spine, the
|
|
1308
1342
|
// plan, and the per-mark payloads the dispatch names by path. `Read` serves all of them.
|
|
1309
|
-
"knockout-assess": Object.freeze(["Read", "mcp__recording-knockout-assess__record_knockout_assess"]),
|
|
1343
|
+
"knockout-assess": Object.freeze(["Read", "mcp__recording-knockout-assess__read_register_list", "mcp__recording-knockout-assess__record_knockout_assess"]),
|
|
1310
1344
|
// THE LANE'S SECOND AND LAST CONVERSION. BY HAND, like every row here — O1 asserts the resolved grant
|
|
1311
1345
|
// EQUALS this row, so a derived row would compare a value with itself.
|
|
1312
1346
|
//
|
|
@@ -1315,6 +1349,12 @@ export const RECORDING_TOOLS = Object.freeze({
|
|
|
1315
1349
|
// retrieval grant here would contradict its own dispatch. Its reads are the instructed-scope sidecar
|
|
1316
1350
|
// and its skill doc, which the seeded Read grant serves.
|
|
1317
1351
|
"knockout-frame": Object.freeze(["Read", "mcp__recording-knockout-frame__record_knockout_frame"]),
|
|
1352
|
+
// THE READING STEP. BY HAND, like every row here. `Read`, its record tool, its read of the run's own lists, and the
|
|
1353
|
+
// register's propose tool alone, so every question it asks is minted, receipted and joined to its name.
|
|
1354
|
+
"knockout-register-read": Object.freeze(["Read",
|
|
1355
|
+
"mcp__recording-knockout-register-read__read_register_list",
|
|
1356
|
+
"mcp__recording-knockout-register-read__record_knockout_register_read",
|
|
1357
|
+
"mcp__register__register_propose_supplemental"]),
|
|
1318
1358
|
// THE LANE'S THIRD AND LAST CONVERSION. BY HAND, like every row here — O1 asserts the resolved grant
|
|
1319
1359
|
// EQUALS this row, so a derived row would compare a value with itself.
|
|
1320
1360
|
//
|
|
@@ -1322,7 +1362,8 @@ export const RECORDING_TOOLS = Object.freeze({
|
|
|
1322
1362
|
// and no register tools — the pass reads lines and rewrites them, and a retrieval grant would invite a
|
|
1323
1363
|
// rewrite that adds a fact the rating never weighed. Its one read is the merged record the dispatch
|
|
1324
1364
|
// names by path, which the seeded Read grant serves.
|
|
1325
|
-
"knockout-review": Object.freeze(["Read", "mcp__recording-knockout-review__record_knockout_review"]),
|
|
1365
|
+
"knockout-review": Object.freeze(["Read", "mcp__recording-knockout-review__read_register_list", "mcp__recording-knockout-review__record_knockout_review"]),
|
|
1366
|
+
"knockout-correct": Object.freeze(["Read", "mcp__recording-knockout-correct__read_register_list", "mcp__recording-knockout-correct__record_knockout_correction"]),
|
|
1326
1367
|
// THE WRITER. BY HAND, like every row here — O1 asserts the resolved grant EQUALS this row, so a
|
|
1327
1368
|
// derived row would compare a value with itself. This stage keeps three retrieval groups, and O1
|
|
1328
1369
|
// compares the WHOLE grant, so they are listed: a row naming only the recording half would be a row
|
|
@@ -1494,7 +1535,7 @@ export function allowedToolsFor(groups = []) {
|
|
|
1494
1535
|
const tools = seatWritesForGroups(groups) ? new Set(["Read", "Write", "Edit"]) : new Set(["Read"]);
|
|
1495
1536
|
for (const g of groups) {
|
|
1496
1537
|
const r = resolveGroup(g);
|
|
1497
|
-
for (const k of r.local) localEntry(k).tools.forEach((t) => tools.add(`mcp__${k}__${t}`));
|
|
1538
|
+
for (const k of r.local) (r.only ?? localEntry(k).tools).forEach((t) => tools.add(`mcp__${k}__${t}`));
|
|
1498
1539
|
for (const k of r.bridges) tools.add(`mcp__${k}__*`); // whole bridge server (its tools are namespaced)
|
|
1499
1540
|
r.extra.forEach((t) => tools.add(t));
|
|
1500
1541
|
}
|