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
|
@@ -66,6 +66,9 @@ import { searchRunArtifacts, SEARCH_LIMITS } from "../../skeptic-search.mjs";
|
|
|
66
66
|
import { recordKnockoutAssess } from "../../knockout-assess-record.mjs";
|
|
67
67
|
import { recordKnockoutFrame } from "../../knockout-frame-record.mjs";
|
|
68
68
|
import { recordKnockoutReview } from "../../knockout-review-record.mjs";
|
|
69
|
+
import { recordKnockoutCorrection } from "../../knockout-correction-record.mjs";
|
|
70
|
+
import { recordKnockoutRegisterRead } from "../../knockout-register-record.mjs";
|
|
71
|
+
import { knockoutListView, runPrefixOfSession } from "../../knockout-register-read.mjs";
|
|
69
72
|
|
|
70
73
|
async function record_blind_frame(params) {
|
|
71
74
|
const runDir = String(process.env.CLEAROTRON_BAND_RUN_DIR ?? "");
|
|
@@ -121,9 +124,33 @@ async function record_knockout_review(params) {
|
|
|
121
124
|
if (!runDir) {
|
|
122
125
|
return { error: "this server was started without a run — the driver wires it per run; there is no parameter for it and this tool never guesses one" };
|
|
123
126
|
}
|
|
124
|
-
//
|
|
125
|
-
//
|
|
126
|
-
return recordKnockoutReview(runDir, params);
|
|
127
|
+
// THE ORDINAL, WHERE THERE IS ONE, SAYS WHICH PASS AND IS THE DRIVER'S: the first read has none, and the fresh read of a
|
|
128
|
+
// corrected record is bound by its label, so no payload can write over the other's answer.
|
|
129
|
+
return recordKnockoutReview(runDir, params, { boundOrdinal: String(process.env.CLEAROTRON_RECORD_AXIS ?? "") || null });
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
async function record_knockout_correction(params) {
|
|
133
|
+
const runDir = String(process.env.CLEAROTRON_BAND_RUN_DIR ?? "");
|
|
134
|
+
if (!runDir) {
|
|
135
|
+
return { error: "this server was started without a run — the driver wires it per run; there is no parameter for it and this tool never guesses one" };
|
|
136
|
+
}
|
|
137
|
+
return recordKnockoutCorrection(runDir, params, { boundOrdinal: String(process.env.CLEAROTRON_RECORD_AXIS ?? "") || null });
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
async function record_knockout_register_read(params) {
|
|
141
|
+
const runDir = String(process.env.CLEAROTRON_BAND_RUN_DIR ?? "");
|
|
142
|
+
if (!runDir) {
|
|
143
|
+
return { error: "this server was started without a run — the driver wires it per run; there is no parameter for it and this tool never guesses one" };
|
|
144
|
+
}
|
|
145
|
+
return recordKnockoutRegisterRead(runDir, params);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
async function read_register_list(params) {
|
|
149
|
+
const runDir = String(process.env.CLEAROTRON_BAND_RUN_DIR ?? "");
|
|
150
|
+
if (!runDir) {
|
|
151
|
+
return { error: "this server was started without a run — the driver wires it per run; there is no parameter for it and this tool never guesses one" };
|
|
152
|
+
}
|
|
153
|
+
return knockoutListView(runDir, params ?? {}, { runPrefix: runPrefixOfSession(process.env.CLEAROTRON_GATHER_SESSION_KEY) });
|
|
127
154
|
}
|
|
128
155
|
|
|
129
156
|
async function record_clearance_variants(params) {
|
|
@@ -1172,16 +1199,17 @@ serve({
|
|
|
1172
1199
|
"Hand back THIS CHUNK's rated assessment as VALUES. The driver serializes knockout-assess-<n>.json, " +
|
|
1173
1200
|
"so you never format JSON and never write the file. WHICH CHUNK IS NOT YOURS TO SAY — the driver " +
|
|
1174
1201
|
"bound it when it dispatched you, and there is no parameter for it. Rate every mark assigned to " +
|
|
1175
|
-
"this chunk and no others.
|
|
1176
|
-
|
|
1177
|
-
"
|
|
1178
|
-
"mark whole.",
|
|
1202
|
+
"this chunk and no others. " +
|
|
1203
|
+
// The repair contract, in the dispatch's approved words: the recorder merges field by field (knockout-assess-record.mjs).
|
|
1204
|
+
"On the first call, send the complete assessment. Once the tool has confirmed a written record for this chunk, correct a name by sending its exact name and only the fields you changed. Omitted names and omitted fields within a name keep their recorded values. A field you send replaces that whole field: send a changed list or object complete, including unchanged entries. Update the chunk summary when the correction changes it. If the tool has written no record, send the complete corrected assessment.",
|
|
1179
1205
|
inputSchema: {
|
|
1180
1206
|
type: "object",
|
|
1181
1207
|
// `schema_version` is accepted and ignored: the driver writes its own. Declared so a seat that
|
|
1182
1208
|
// sends it is not refused for a field nobody reads — the narrow-refusal rule preserve-merge.mjs
|
|
1183
1209
|
// states, after the strict form killed a stage over exactly that.
|
|
1184
|
-
|
|
1210
|
+
// ONLY THE MARKS ARE REQUIRED OF A CALL, and only the name of a mark: a correction sends what changed. Completeness is the
|
|
1211
|
+
// recorder's check on the assembled record, so a first call that leaves a field out is refused there and writes nothing.
|
|
1212
|
+
required: ["marks"],
|
|
1185
1213
|
additionalProperties: false,
|
|
1186
1214
|
properties: {
|
|
1187
1215
|
schema_version: { type: "integer", description: "Accepted and ignored — the driver stamps its own." },
|
|
@@ -1210,10 +1238,10 @@ serve({
|
|
|
1210
1238
|
},
|
|
1211
1239
|
marks: {
|
|
1212
1240
|
type: "array", minItems: 1,
|
|
1213
|
-
description: "One row per mark assigned to THIS chunk — no invention, no neighbour-chunk overrun
|
|
1241
|
+
description: "One row per mark assigned to THIS chunk — no invention, no neighbour-chunk overrun.",
|
|
1214
1242
|
items: {
|
|
1215
1243
|
type: "object", additionalProperties: false,
|
|
1216
|
-
required: ["name"
|
|
1244
|
+
required: ["name"],
|
|
1217
1245
|
properties: {
|
|
1218
1246
|
ref: { type: ["string", "null"] },
|
|
1219
1247
|
name: { type: "string", description: "The mark, VERBATIM as the plan names it — the join key for everything downstream." },
|
|
@@ -1224,7 +1252,7 @@ serve({
|
|
|
1224
1252
|
basis: { type: "string", description: "ONE sentence: why this band, for this name, in these classes. The report renders it as the lead line — a paragraph in bullets cannot fill it." },
|
|
1225
1253
|
factors: { type: "array", minItems: 2, maxItems: 4, items: { type: "string" }, description: "2–4 one-line load-bearing observations behind the band." },
|
|
1226
1254
|
counterFactors: { type: "array", minItems: 1, maxItems: 3, items: { type: "string" }, description: "1–3 one-line statements of what holds this name at this band rather than the next, either way." },
|
|
1227
|
-
mitigation: { type: "string", description: "May be \"\" when nothing would move the band — but SEND THE KEY, so a considered \"none\" is not confusable with an omission." },
|
|
1255
|
+
mitigation: { type: "string", description: "May be \"\" when nothing would move the band — but SEND THE KEY on the first call, so a considered \"none\" is not confusable with an omission." },
|
|
1228
1256
|
assessment: { type: "string", description: "The opening paragraph a reader of THIS MARK'S own report sees first: what the name is, what the landscape looks like, what drives the rating." },
|
|
1229
1257
|
contextFraming: { type: "string" },
|
|
1230
1258
|
registerEstimate: { type: "string" },
|
|
@@ -1284,6 +1312,11 @@ serve({
|
|
|
1284
1312
|
},
|
|
1285
1313
|
classesSearched: { type: "array", items: { type: "integer", minimum: 1, maximum: 45 } },
|
|
1286
1314
|
classesDriving: { type: "array", items: { type: "integer", minimum: 1, maximum: 45 }, description: "Mandatory at a material band — class-specific ratings." },
|
|
1315
|
+
classGroups: { type: "array", minItems: 2, description: "OPTIONAL: when separating the requested goods changes the advice under the frozen framework. Every class searched belongs to one group, and rating is the highest group's band.", items: { type: "object", required: ["band", "classes"], properties: {
|
|
1316
|
+
band: { type: "string", description: "The band for this group, in the framework's words." },
|
|
1317
|
+
ratingQualifier: { type: ["string", "null"], description: "null or \"low\"." },
|
|
1318
|
+
classes: { type: "array", minItems: 1, items: { type: "integer", minimum: 1, maximum: 45 } },
|
|
1319
|
+
} } },
|
|
1287
1320
|
beltAndBraces: { type: "array", items: { type: "integer", minimum: 1, maximum: 45 } },
|
|
1288
1321
|
negatives: {
|
|
1289
1322
|
type: "array",
|
|
@@ -1331,7 +1364,8 @@ serve({
|
|
|
1331
1364
|
}, {
|
|
1332
1365
|
name: "record_knockout_review",
|
|
1333
1366
|
description:
|
|
1334
|
-
"Hand back your REWRITES of the lines a reader meets first, as VALUES.
|
|
1367
|
+
"Hand back the MATERIAL DEFECTS you found and your REWRITES of the lines a reader meets first, as VALUES. A material " +
|
|
1368
|
+
"defect goes to the step that rated the batch, and you repair nothing. The driver writes a rewrite into " +
|
|
1335
1369
|
"the rated record itself, so you never format JSON and never write a file. Each rewrite names the " +
|
|
1336
1370
|
"line it replaces by the `at` address you were handed in the dispatch, copied verbatim — you do " +
|
|
1337
1371
|
"not quote the sentence and there is no field for one. An address naming no line on this run's " +
|
|
@@ -1347,6 +1381,20 @@ serve({
|
|
|
1347
1381
|
type: "string",
|
|
1348
1382
|
description: "Your answer to the question the dispatch opens with, in your own words.",
|
|
1349
1383
|
},
|
|
1384
|
+
material: {
|
|
1385
|
+
type: "array",
|
|
1386
|
+
description: "What would change what the client is told. Empty or left out where you found nothing of that weight.",
|
|
1387
|
+
items: {
|
|
1388
|
+
type: "object", additionalProperties: false, required: ["kind", "mark", "problem"],
|
|
1389
|
+
properties: {
|
|
1390
|
+
kind: { type: "string", enum: ["band", "missing", "exclusion", "scope", "contradiction"], description: "band: not supported by the framework and evidence. missing: a filing or use a lawyer would raise is left out. exclusion: set aside against the evidence. scope: the request asked for what the answer does not cover. contradiction: a line disagrees with the record beneath it." },
|
|
1391
|
+
mark: { type: "string", description: "The name on the record, verbatim." },
|
|
1392
|
+
finding: { type: "integer", description: "The finding's ordinal, where the defect is about one." },
|
|
1393
|
+
problem: { type: "string", description: "What is wrong and why it matters to the client." },
|
|
1394
|
+
rests_on: { type: "array", items: { type: "string" }, description: "The held evidence behind the defect: recordIds, question qids and URLs copied from what the run holds. Required for missing and exclusion. A defect about scope, the framework or internal agreement may name its source in problem instead." },
|
|
1395
|
+
},
|
|
1396
|
+
},
|
|
1397
|
+
},
|
|
1350
1398
|
rewrites: {
|
|
1351
1399
|
type: "array",
|
|
1352
1400
|
description:
|
|
@@ -1373,8 +1421,7 @@ serve({
|
|
|
1373
1421
|
declined: {
|
|
1374
1422
|
type: "array",
|
|
1375
1423
|
description:
|
|
1376
|
-
"
|
|
1377
|
-
"rewrite nor decline cannot be told afterwards from a line nobody read.",
|
|
1424
|
+
"If no change is needed, record that once; do not explain every unchanged line.",
|
|
1378
1425
|
items: {
|
|
1379
1426
|
type: "object", additionalProperties: false, required: ["at", "why"],
|
|
1380
1427
|
properties: {
|
|
@@ -1393,6 +1440,150 @@ serve({
|
|
|
1393
1440
|
},
|
|
1394
1441
|
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
1395
1442
|
handler: record_knockout_review,
|
|
1443
|
+
}, {
|
|
1444
|
+
name: "record_knockout_correction",
|
|
1445
|
+
schemaNow: (schema) => knockoutAssessSchemaFor(schema, process.env.CLEAROTRON_BAND_RUN_DIR),
|
|
1446
|
+
description:
|
|
1447
|
+
"Hand back your repair of the defects you were given, as VALUES, sending only what changes. The driver merges it onto " +
|
|
1448
|
+
"the chunk it holds and checks the result as it checks a rated chunk. It refuses a change to a name no defect concerns, " +
|
|
1449
|
+
"a moved finding no answer accounts for, and a rating that moves without its dependent answers. A repair turn may send " +
|
|
1450
|
+
"only what it corrects, and what it has repaired is kept.",
|
|
1451
|
+
inputSchema: {
|
|
1452
|
+
type: "object",
|
|
1453
|
+
required: ["answers"],
|
|
1454
|
+
additionalProperties: false,
|
|
1455
|
+
properties: {
|
|
1456
|
+
answers: {
|
|
1457
|
+
type: "array",
|
|
1458
|
+
description: "One row per defect.",
|
|
1459
|
+
items: { type: "object", additionalProperties: false, required: ["defect", "outcome", "why"], properties: {
|
|
1460
|
+
defect: { type: "integer", description: "The defect's number." },
|
|
1461
|
+
outcome: { type: "string", enum: ["changed", "stands"], description: "changed: you repaired it. stands: the evidence does not support the defect, and the record stays." },
|
|
1462
|
+
why: { type: "string", description: "What you changed, or why the record stands." },
|
|
1463
|
+
findings: { type: "array", items: { type: "integer" }, description: "OPTIONAL: the ordinal of any finding this repair moved beyond the one the defect names." },
|
|
1464
|
+
} },
|
|
1465
|
+
},
|
|
1466
|
+
chunkSummary: { type: "string", description: "The whole of this chunk's summary as it now reads, where the repair changes it. Required when a rating moves." },
|
|
1467
|
+
marks: {
|
|
1468
|
+
type: "array",
|
|
1469
|
+
description: "One row per name you repair, carrying only the fields that change.",
|
|
1470
|
+
items: {
|
|
1471
|
+
type: "object", required: ["name"],
|
|
1472
|
+
properties: {
|
|
1473
|
+
name: { type: "string", description: "The name, verbatim." },
|
|
1474
|
+
rating: { type: "string", description: "The band, in the framework's words." },
|
|
1475
|
+
ratingQualifier: { type: ["string", "null"], description: "null or \"low\"." },
|
|
1476
|
+
classesDriving: { type: "array", items: { type: "integer" }, description: "The classes behind the band." },
|
|
1477
|
+
classGroups: { type: "array", minItems: 2, description: "Where this repair changes the conclusion by class group: every row as it now reads.", items: { type: "object", required: ["band", "classes"], properties: {
|
|
1478
|
+
band: { type: "string", description: "The band for this group, in the framework's words." },
|
|
1479
|
+
ratingQualifier: { type: ["string", "null"], description: "null or \"low\"." },
|
|
1480
|
+
classes: { type: "array", minItems: 1, items: { type: "integer", minimum: 1, maximum: 45 } },
|
|
1481
|
+
} } },
|
|
1482
|
+
basis: { type: "string", description: "One sentence: why this band, for this name, in these classes." },
|
|
1483
|
+
factors: { type: "array", items: { type: "string" }, description: "2 to 4 load-bearing observations, one line each." },
|
|
1484
|
+
counterFactors: { type: "array", items: { type: "string" }, description: "1 to 3: what holds it at this band." },
|
|
1485
|
+
mitigation: { type: "string", description: "One line: the single thing that would move it, or empty." },
|
|
1486
|
+
assessment: { type: "string", description: "This name's opening read, whole." },
|
|
1487
|
+
bullets: { type: "array", items: { type: "string" }, description: "Replaces the name's bullets." },
|
|
1488
|
+
purpleNotes: { type: "array", items: { type: "string" }, description: "Replaces the name's notes." },
|
|
1489
|
+
registerReads: { type: "array", items: { type: "object" }, description: "Replaces the name's rows of {recordId, read, band?, inputs?}." },
|
|
1490
|
+
setAside: { type: "array", items: { type: "object" }, description: "Replaces the name's rows of {url, ground}." },
|
|
1491
|
+
negatives: { type: "array", items: { type: "object" }, description: "Replaces the name's rows of {term, source, note}." },
|
|
1492
|
+
findings: {
|
|
1493
|
+
type: "array",
|
|
1494
|
+
description: "Only the findings you change or add, each whole.",
|
|
1495
|
+
items: { type: "object", required: ["ordinal", "name", "owner", "band", "net", "type", "evidence", "basis"], properties: {
|
|
1496
|
+
ordinal: { type: "integer", description: "An existing finding's ordinal, or the next one for a new finding." },
|
|
1497
|
+
name: { type: "string", description: "The conflicting name, verbatim." },
|
|
1498
|
+
owner: { type: "string", description: "The party behind it, or \"not established on the searched material\"." },
|
|
1499
|
+
band: { type: "string", description: "A word from the framework's ladder." },
|
|
1500
|
+
inputs: { type: "object", description: "The framework's own inputs for this finding, where it states a method." },
|
|
1501
|
+
net: { type: "string", description: "One conclusion sentence." },
|
|
1502
|
+
type: { type: "string", description: "Famous Brand, Active Business, Cultural Reference, Domain, Descriptive Use, Negative Association or Competitor Intelligence." },
|
|
1503
|
+
evidence: { type: "array", items: { type: "string" }, description: "URLs held for this name." },
|
|
1504
|
+
basis: { type: "string", description: "The ground the band rests on." },
|
|
1505
|
+
weighedFilings: { type: "array", items: { type: "string" }, description: "The register record ids this finding's reasoning used." },
|
|
1506
|
+
} },
|
|
1507
|
+
},
|
|
1508
|
+
remove_findings: { type: "array", items: { type: "integer" }, description: "Ordinals the evidence shows should not be there." },
|
|
1509
|
+
},
|
|
1510
|
+
},
|
|
1511
|
+
},
|
|
1512
|
+
},
|
|
1513
|
+
},
|
|
1514
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
1515
|
+
handler: record_knockout_correction,
|
|
1516
|
+
}, {
|
|
1517
|
+
name: "read_register_list",
|
|
1518
|
+
description:
|
|
1519
|
+
"Read the held answer to one question by `qid`, with its filings and goods evidence. A row's `goods_state` " +
|
|
1520
|
+
"distinguishes complete, cut, unknown, absent, unavailable, and not-held wording. Pass `record_id` as well to read " +
|
|
1521
|
+
"all wording held for that filing. This reads existing evidence and makes no register call. Full wording is available " +
|
|
1522
|
+
"only where this run holds it.",
|
|
1523
|
+
inputSchema: {
|
|
1524
|
+
type: "object",
|
|
1525
|
+
required: ["qid"],
|
|
1526
|
+
properties: {
|
|
1527
|
+
qid: { type: "string", description: "The question whose list you are reading." },
|
|
1528
|
+
record_id: { type: "string", description: "OPTIONAL: one filing of that list, to read all wording held for it." },
|
|
1529
|
+
},
|
|
1530
|
+
},
|
|
1531
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
1532
|
+
handler: read_register_list,
|
|
1533
|
+
}, {
|
|
1534
|
+
name: "record_knockout_register_read",
|
|
1535
|
+
description:
|
|
1536
|
+
"Hand back your reading as VALUES, one row per instructed name, names verbatim. The driver checks every record " +
|
|
1537
|
+
"id against what the name's questions returned and writes knockout-register.json. A repair turn may send only the " +
|
|
1538
|
+
"names it corrects; a name you send replaces its stored row whole. It is refused while a list you read, a crowd or " +
|
|
1539
|
+
"a count has nothing saying what became of it, and the refusal names the question.",
|
|
1540
|
+
inputSchema: {
|
|
1541
|
+
type: "object",
|
|
1542
|
+
required: ["marks"],
|
|
1543
|
+
properties: {
|
|
1544
|
+
schema_version: { type: "number", description: "Accepted and ignored — the driver writes the schema version it owns." },
|
|
1545
|
+
marks: {
|
|
1546
|
+
type: "array",
|
|
1547
|
+
description: "One row per instructed name.",
|
|
1548
|
+
items: {
|
|
1549
|
+
type: "object",
|
|
1550
|
+
required: ["name", "carried", "set_aside", "not_asked"],
|
|
1551
|
+
properties: {
|
|
1552
|
+
name: { type: "string", description: "The instructed name, verbatim." },
|
|
1553
|
+
carried: {
|
|
1554
|
+
type: "array",
|
|
1555
|
+
description: "The filings selected for assessment, grouped by reason. An empty list means none were selected; it does not state that the register holds no filings.",
|
|
1556
|
+
items: { type: "object", required: ["records", "why"], properties: {
|
|
1557
|
+
records: { type: "array", items: { type: "string" }, description: "record_id values, copied from the list you read." },
|
|
1558
|
+
why: { type: "string", description: "Why this group is carried forward, in one reason." },
|
|
1559
|
+
check_owner: { type: "boolean", description: "OPTIONAL: true where what these filings' owners actually sell would change how they are read. The driver then runs one web search per owner before the rating step." },
|
|
1560
|
+
} },
|
|
1561
|
+
},
|
|
1562
|
+
set_aside: {
|
|
1563
|
+
type: "array",
|
|
1564
|
+
description: "What you set aside and why, by question. One row answers for the rows of that question you did not carry, unless `records` names some of them. A count or crowd you did not read belongs here too.",
|
|
1565
|
+
items: { type: "object", required: ["question", "why"], properties: {
|
|
1566
|
+
question: { type: "string", description: "The question's qid." },
|
|
1567
|
+
records: { type: "array", items: { type: "string" }, description: "OPTIONAL: these filings only, where the question's rows were set aside for different reasons." },
|
|
1568
|
+
why: { type: "string", description: "Why it was set aside." },
|
|
1569
|
+
} },
|
|
1570
|
+
},
|
|
1571
|
+
not_asked: {
|
|
1572
|
+
type: "array",
|
|
1573
|
+
description: "Questions you considered and did not ask, and why.",
|
|
1574
|
+
items: { type: "object", required: ["question", "why"], properties: {
|
|
1575
|
+
question: { type: "string", description: "The question, in words. An added class's question goes by the qid your opening message gives it." },
|
|
1576
|
+
why: { type: "string", description: "Why you did not ask it." },
|
|
1577
|
+
} },
|
|
1578
|
+
},
|
|
1579
|
+
open_questions: { type: "array", items: { type: "string" }, description: "OPTIONAL: what this reading could not settle, for the step that rates the name." },
|
|
1580
|
+
},
|
|
1581
|
+
},
|
|
1582
|
+
},
|
|
1583
|
+
},
|
|
1584
|
+
},
|
|
1585
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
1586
|
+
handler: record_knockout_register_read,
|
|
1396
1587
|
}, {
|
|
1397
1588
|
name: "record_knockout_frame",
|
|
1398
1589
|
description:
|
|
@@ -1462,6 +1653,7 @@ serve({
|
|
|
1462
1653
|
// resolves whichever way it happens to trust.
|
|
1463
1654
|
places: { type: "array", items: { type: "string" }, description: "The places THIS name is searched on: two or more, one of them \"web\" (the whole web) and each other a site's bare host. No upper limit — name as many as this name needs, and no more, because every place is another search of every spelling. Two names in one batch may have different lists." },
|
|
1464
1655
|
spellings: { type: "array", items: { type: "string" }, description: "2 or 3 ways this name is written, the name as instructed among them. Each is searched on every place THIS name names." },
|
|
1656
|
+
alternatives: { type: "array", items: { type: "string" }, description: "Each written form of this one item, where the request gives more than one spelling or word order. Omit otherwise." },
|
|
1465
1657
|
priorKnowledge: { type: "string", description: "What the requester already told you about this name, or omit it." },
|
|
1466
1658
|
priority: { type: "number", description: "This mark's position in the execution order." },
|
|
1467
1659
|
},
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
import { readFileSync, writeFileSync, renameSync, existsSync, mkdirSync } from "node:fs";
|
|
33
33
|
import { dirname, join } from "node:path";
|
|
34
34
|
import { driverDir } from "../../../shared/driver-dir.mjs"; //
|
|
35
|
-
import { PLAN_PREDICATES, PLAN_MAX_OR_WIDTH, PLAN_MAX_NAME_LENGTH, planExactOrWidth, planPhoneticOrWidth, fingerprint, ownerIntersectionGap, goodsTextGap, resolveRegions, houseElementOf, withoutHouseElementTerms, containsFormSubstitution } from "../../register-plan.mjs";
|
|
35
|
+
import { PLAN_PREDICATES, PLAN_MAX_OR_WIDTH, PLAN_MAX_NAME_LENGTH, planExactOrWidth, planPhoneticOrWidth, fingerprint, exactOperatorEntries, ownerIntersectionGap, goodsTextGap, resolveRegions, houseElementOf, withoutHouseElementTerms, containsFormSubstitution } from "../../register-plan.mjs";
|
|
36
36
|
import { entryTermIssues } from "../../../providers/_shared/term-shape.mjs";
|
|
37
37
|
import { OUTSTANDING_REASON, runDriverDirOf } from "../../../providers/_shared/follow-up-searches.mjs";
|
|
38
38
|
import { pathInRun } from "../../../shared/inside-run.mjs"; // the band path is served only inside this run
|
|
@@ -123,7 +123,8 @@ export function mintSupplementalEntries(axis, proposals, { existingQids = new Se
|
|
|
123
123
|
const splitOf = names.length > 1 && names.length <= PLAN_MAX_OR_WIDTH
|
|
124
124
|
? fingerprint({ axis, predicate: String(p?.predicate ?? "default"), names: [...names].sort(), i }) : null;
|
|
125
125
|
const byName = splitOf ? splitBatch(p, names, capabilities) : [p ?? {}];
|
|
126
|
-
|
|
126
|
+
// An exact phrase this register cannot state takes its own entry, on its words in order (exactOperatorEntries).
|
|
127
|
+
return byName.flatMap((b) => exactOperatorEntries(b, capabilities) ?? [b]).flatMap((q) => {
|
|
127
128
|
const words = perWord && Array.isArray(q?.goods_words) ? q.goods_words.map((w) => String(w ?? "").trim()).filter(Boolean) : [];
|
|
128
129
|
return words.length > 1
|
|
129
130
|
? words.map((w, k) => ({ p: { ...q, goods_words: [w] }, i, slot: `${i}:${k}`, splitOf }))
|
|
@@ -321,6 +322,7 @@ export function mintSupplementalEntries(axis, proposals, { existingQids = new Se
|
|
|
321
322
|
const entry = {
|
|
322
323
|
qid, axis, predicate: askedPredicate,
|
|
323
324
|
...(substituted ? { contains_substituted: substituted } : {}),
|
|
325
|
+
...(p.exact_substituted ? { exact_substituted: p.exact_substituted } : {}),
|
|
324
326
|
...(terms ? { terms } : { term }),
|
|
325
327
|
...(romanizedTerms ? { romanizedTerms } : {}),
|
|
326
328
|
...(owner ? { owner } : {}),
|
|
@@ -953,7 +953,7 @@ export const openaiAgentEngine = {
|
|
|
953
953
|
if (mode === "subscription") {
|
|
954
954
|
const af = authFilePath(process.env);
|
|
955
955
|
if (!existsSync(af))
|
|
956
|
-
throw new Error(`
|
|
956
|
+
throw new Error(`Codex has no sign-in on this machine (${af} does not exist): run \`codex login\`, or set CLEAROTRON_OPENAI_AUTH_FILE to the file it wrote. To pay per use instead, set CLEAROTRON_AI_BILLING=api-key and CODEX_API_KEY.`);
|
|
957
957
|
// The REAL path, so a master that is itself a link is written where its login actually lives.
|
|
958
958
|
authMaster = realpathSync(af);
|
|
959
959
|
seeded = seedAuth(authMaster, codexHome);
|
|
@@ -1014,6 +1014,8 @@ export const openaiAgentEngine = {
|
|
|
1014
1014
|
if (!ev.model) ev.model = readServedModel(codexHome, spawnedAtMs);
|
|
1015
1015
|
// A turn cut off before turn.completed: what it spent, from the same rollout (readRolloutUsage).
|
|
1016
1016
|
if (!ev.usage) { ev.usage = readRolloutUsage(codexHome, spawnedAtMs); ev.usageFromRollout = ev.usage != null; }
|
|
1017
|
+
// A resumed turn's turn.completed states its thread's running total, earlier turns included. Its own share is in the same rollout; where that cannot be read the total stands, overstated and never understated.
|
|
1018
|
+
else if (resumeRef) ev.usage = readRolloutUsage(codexHome, spawnedAtMs) ?? ev.usage;
|
|
1017
1019
|
return settleTuple({ r, ev, resumeRef });
|
|
1018
1020
|
} finally {
|
|
1019
1021
|
// BEFORE the home can be deleted, here or by the ladder that owns it. A failed write-back leaves the
|
package/driver/engine/probe.mjs
CHANGED
|
@@ -187,6 +187,16 @@ export function namingProgram(text, eng, bin) {
|
|
|
187
187
|
return String(text).replace(new RegExp(`(^|\`)${eng.fallback}(?=[\\s\`]|$)`, "g"), (_, before) => `${before}${program}`);
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
+
/**
|
|
191
|
+
* The rewrite the connect surfaces apply to a `claude` command: the copy setup installed by its path, and any
|
|
192
|
+
* other copy as the bare word. Setup installs Claude into its own engines folder, which is not on PATH.
|
|
193
|
+
*/
|
|
194
|
+
export function claudeNamer(env = process.env) {
|
|
195
|
+
const engine = Object.keys(ENGINE_BINARIES).find((k) => ENGINE_BINARIES[k].fallback === "claude");
|
|
196
|
+
const program = resolveEngineProgram(engine, { env });
|
|
197
|
+
return (text) => namingProgram(text, ENGINE_BINARIES[engine], { source: program?.source ?? null, path: program?.resolved ?? null });
|
|
198
|
+
}
|
|
199
|
+
|
|
190
200
|
// THE HEADLESS ROUTE, WHERE THE ENGINE HAS ONE. The interactive sign-in is the one thing a server with no
|
|
191
201
|
// browser cannot do, and it was the only remedy this offered — including to a box that had configured the
|
|
192
202
|
// route built for servers. The engine table already carries that route; this reads it rather than a copy.
|
|
@@ -0,0 +1,95 @@
|
|
|
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
|
+
// filing-goods.mjs — the goods each filing covers, carried from what the run already holds onto the neutral record a
|
|
5
|
+
// knockout's assessment reads. No register call: the listing logged every record body it fetched.
|
|
6
|
+
//
|
|
7
|
+
// WHY. A saved eight-name knockout, 2026-10-28, fetched 160 record bodies, and all but one carried goods. None of its 160
|
|
8
|
+
// neutral records did, because the record listed the fields a search row names and goods is not one of them for a register
|
|
9
|
+
// whose goods come with the full record. The assessment did not open the bodies, and 14 of its 15 recorded reads of a filing
|
|
10
|
+
// named goods wording as missing. The run had paid for that wording already.
|
|
11
|
+
//
|
|
12
|
+
// A SHORT VIEW, AND THE WHOLE TEXT ONE READ AWAY. A long statement is cut in the view and the record says so
|
|
13
|
+
// (`goodsShortened`), and the whole held record is written to its own file (`fullRecord`, relative to the run), with the
|
|
14
|
+
// duplicate raw goods list left out where the normalised list carries it. On that batch the view at this length is 106 KB
|
|
15
|
+
// of 153 KB, and it shortens 39 of 394 statements, on 16 of 160 records. Pasting every record whole into every read is what
|
|
16
|
+
// this avoids; hiding wording the run holds is what it must not do.
|
|
17
|
+
//
|
|
18
|
+
// WHAT THE GOODS REST ON IS THE FULL ENGINE'S RECORD, not a new one: `goodsState` and `goodsFrom` are goods-evidence.mjs's
|
|
19
|
+
// states and labels, read through the same reader. So complete, cut by the register, not established whole, absent, failed
|
|
20
|
+
// and not held stay six different facts. None of the last five means the goods are unrelated.
|
|
21
|
+
import { createHash } from "node:crypto";
|
|
22
|
+
import { mkdirSync, writeFileSync } from "node:fs";
|
|
23
|
+
import { join } from "node:path";
|
|
24
|
+
import { normalizeRecordUri } from "./registry-fidelity.mjs";
|
|
25
|
+
import { recordGoods, recordAsServed, untaggedIsEnglish } from "./record-goods.mjs";
|
|
26
|
+
import { heldBodiesOf, heldRecordProvenance, readRunCallRows, recordFetchOutcomes, recordGoodsEvidence, goodsFromLabel } from "./goods-evidence.mjs";
|
|
27
|
+
import { DEFAULT_LEDGER_PATH } from "./provider-usage.mjs";
|
|
28
|
+
|
|
29
|
+
/** The folder under the run that holds one whole record per filing, for a reader who needs more than the short view. */
|
|
30
|
+
export const FILING_RECORDS_DIR = "register-filings";
|
|
31
|
+
/** The longest statement the short view carries whole. */
|
|
32
|
+
export const GOODS_VIEW_CHARS = 1200;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Statements as the short view carries them: one line each, its classes first ("9, 35: computer software"), and whether any
|
|
36
|
+
* was cut. A plain line because this view is read whole by a model on every chunk: as typed objects the sidecar of the saved
|
|
37
|
+
* batch came to 330 KB, and as lines to 282 KB. What the goods rest on is the record's own `goodsState`. PURE.
|
|
38
|
+
*/
|
|
39
|
+
export function shortGoodsView(statements, limit = GOODS_VIEW_CHARS) {
|
|
40
|
+
let shortened = false;
|
|
41
|
+
const goods = (Array.isArray(statements) ? statements : []).map((g) => {
|
|
42
|
+
const chars = [...String(g?.text ?? "")];
|
|
43
|
+
const cut = chars.length > limit;
|
|
44
|
+
if (cut) shortened = true;
|
|
45
|
+
const text = cut ? `${chars.slice(0, limit).join("")}…` : chars.join("");
|
|
46
|
+
const where = [Array.isArray(g?.classes) && g.classes.length ? g.classes.join(", ") : "", g?.language ? `(${g.language})` : ""].filter(Boolean).join(" ");
|
|
47
|
+
return where ? `${where}: ${text}` : text;
|
|
48
|
+
});
|
|
49
|
+
return { goods, shortened };
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** A filing's file under FILING_RECORDS_DIR, named as `_records/` names one where its id is an address. PURE. */
|
|
53
|
+
export function filingRecordName(recordId) {
|
|
54
|
+
const id = String(recordId ?? "");
|
|
55
|
+
const key = normalizeRecordUri(id);
|
|
56
|
+
if (key) return `${key.replace(/^\/mark\//, "").replace(/[^a-z0-9]+/gi, "-")}.json`;
|
|
57
|
+
return `${id.replace(/[^a-z0-9]+/gi, "-").slice(0, 60)}-${createHash("sha256").update(id).digest("hex").slice(0, 8)}.json`;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The sidecar with each record's goods on it: `goods`, `goodsState`, `goodsFrom`, `goodsShortened` and `fullRecord`. A record's
|
|
62
|
+
* own statements are read from the body the run holds for it, or otherwise from what its search row carried (`goods` on the
|
|
63
|
+
* way in: register-records.mjs `toRecord`). Writes the filings' files and sends nothing. Never throws: a file that cannot be
|
|
64
|
+
* read or written leaves that record the less on it, and a failure here must not cost the run its filings.
|
|
65
|
+
*/
|
|
66
|
+
export function withFilingGoods(doc, runDir, { runPrefix = null, callLog = DEFAULT_LEDGER_PATH, limit = GOODS_VIEW_CHARS } = {}) {
|
|
67
|
+
const marks = Array.isArray(doc?.marks) ? doc.marks : null;
|
|
68
|
+
if (!marks) return doc;
|
|
69
|
+
const ids = marks.flatMap((m) => (Array.isArray(m?.records) ? m.records : [])).map((r) => r?.recordId).filter(Boolean);
|
|
70
|
+
let bodies = new Map(), held = new Map(), fetches = null;
|
|
71
|
+
try { bodies = heldBodiesOf(runDir, ids); held = heldRecordProvenance(runDir); } catch { /* nothing held reads as nothing held */ }
|
|
72
|
+
try { if (runPrefix) fetches = recordFetchOutcomes(readRunCallRows(callLog, runPrefix).rows, { runPrefix }); } catch { fetches = null; }
|
|
73
|
+
const dir = join(runDir, FILING_RECORDS_DIR);
|
|
74
|
+
const keep = (recordId, content) => {
|
|
75
|
+
try {
|
|
76
|
+
const name = filingRecordName(recordId);
|
|
77
|
+
mkdirSync(dir, { recursive: true });
|
|
78
|
+
writeFileSync(join(dir, name), content);
|
|
79
|
+
return `${FILING_RECORDS_DIR}/${name}`;
|
|
80
|
+
} catch { return null; }
|
|
81
|
+
};
|
|
82
|
+
const carried = (rec) => {
|
|
83
|
+
const key = normalizeRecordUri(rec?.recordId);
|
|
84
|
+
const body = key ? bodies.get(key) ?? null : null;
|
|
85
|
+
const fromBody = body ? recordGoods(body, { english: untaggedIsEnglish(key) }) : [];
|
|
86
|
+
const statements = fromBody.length ? fromBody : (Array.isArray(rec?.goods) ? rec.goods : []);
|
|
87
|
+
const evidence = recordGoodsEvidence({ record_id: rec?.recordId }, { goods: { of: () => statements, held: () => fromBody.length > 0 }, held, fetches });
|
|
88
|
+
const view = shortGoodsView(statements, limit);
|
|
89
|
+
const fullRecord = !rec?.recordId ? null
|
|
90
|
+
: body ? keep(rec.recordId, recordAsServed(`${JSON.stringify(body, null, 2)}\n`).text)
|
|
91
|
+
: view.shortened ? keep(rec.recordId, `${JSON.stringify({ recordId: rec.recordId, goods: statements }, null, 2)}\n`) : null;
|
|
92
|
+
return { ...rec, goods: view.goods, goodsState: evidence.state, goodsFrom: goodsFromLabel(evidence), goodsShortened: view.shortened, fullRecord };
|
|
93
|
+
};
|
|
94
|
+
return { ...doc, marks: marks.map((m) => (Array.isArray(m?.records) ? { ...m, records: m.records.map(carried) } : m)) };
|
|
95
|
+
}
|
|
@@ -2307,6 +2307,9 @@ export const KNOCKOUT_FINDING_TYPES = [
|
|
|
2307
2307
|
// from. `weighedFilings` is optional; verify-knockout.mjs joins every id against the run's own records.
|
|
2308
2308
|
// `inputs` — the framework's own inputs behind the band, when the run froze a framework METHOD
|
|
2309
2309
|
// (framework-method.mjs). Required on every knockout finding then, refused otherwise; checked below.
|
|
2310
|
+
// How a knockout run's page lists a name's cards: filing evidence first, then web use. Recorded on the run, because a
|
|
2311
|
+
// run recorded without it was delivered with its findings first and must re-render that way.
|
|
2312
|
+
export const KNOCKOUT_CARD_ORDER = "filings-first";
|
|
2310
2313
|
export const KNOCKOUT_FINDING_KEYS = Object.freeze(["ordinal", "name", "owner", "band", "inputs", "net", "type", "evidence", "basis", "weighedFilings"]);
|
|
2311
2314
|
// The throw family is `knockout_`, NOT `findings_`, and that is deliberate: gateway.mjs's
|
|
2312
2315
|
// repairSiblingName routes every `/findings?_/` token to **findings.json**, which is the clearance
|