clearotron 0.7.0-beta.2 → 0.7.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/INSTALL.md +5 -5
- package/QUICKSTART.md +4 -4
- package/README.md +2 -2
- package/bin/README.md +3 -4
- package/bin/clearotron.mjs +1 -1
- package/bin/onboard.mjs +28 -40
- package/bin/status.mjs +11 -0
- package/build-info.json +2 -2
- package/docs/DELIVERY.md +30 -6
- package/docs/architecture/04-configuration-reference.md +1 -0
- package/driver/CHANGELOG.md +21 -0
- package/driver/compose-read.mjs +4 -3
- package/driver/contract-arm2-baseline.json +1 -2
- package/driver/contract-dictation-registry.mjs +7 -48
- package/driver/contract-e3-backlog.mjs +55 -52
- package/driver/contract-e3-baseline.json +22 -7
- package/driver/contract-vocabulary.mjs +4 -2
- package/driver/coverage-form.mjs +4 -0
- package/driver/coverage-rows-run.mjs +68 -4
- package/driver/engine/anthropic-agent.mjs +10 -13
- package/driver/engine/common.mjs +34 -22
- package/driver/engine/health.mjs +251 -0
- package/driver/engine/jx-turn.mjs +2 -1
- package/driver/engine/mcp/codex-config.mjs +16 -1
- package/driver/engine/mcp/crowd-note.mjs +1 -1
- package/driver/engine/mcp/gather-config.mjs +34 -9
- package/driver/engine/mcp/perplexity-server.mjs +33 -23
- package/driver/engine/mcp/recording-server.mjs +67 -58
- package/driver/engine/mcp/unit-note-server.mjs +2 -0
- package/driver/engine/openai-agent.mjs +9 -24
- package/driver/engine/probe.mjs +24 -7
- package/driver/findings-model.mjs +54 -0
- package/driver/jx-units.mjs +139 -30
- package/driver/knockout-assess-record.mjs +2 -2
- package/driver/knockout-correction-check.mjs +119 -0
- package/driver/knockout-correction-record.mjs +1 -1
- package/driver/knockout-frame-record.mjs +24 -10
- package/driver/knockout-review-record.mjs +35 -430
- package/driver/ladder/dispatch.mjs +4 -2
- package/driver/ladder/form-repair.mjs +5 -5
- package/driver/ladder/form-sync.mjs +4 -6
- package/driver/ladder/next-rung.mjs +10 -0
- package/driver/ladder/repair-messages.mjs +37 -65
- package/driver/ladder/stage.mjs +3 -3
- package/driver/ladder/turn-signals.mjs +4 -14
- package/driver/manual-paragraphs.mjs +22 -2
- package/driver/mark-logos.mjs +20 -5
- package/driver/package.json +1 -1
- package/driver/pipeline-knockout.mjs +2 -2
- package/driver/predelivery-lint.mjs +39 -7
- package/driver/product-fault.mjs +53 -0
- package/driver/publish/knockout.mjs +2 -1
- package/driver/publish/render.mjs +13 -7
- package/driver/recording-agreement.mjs +6 -4
- package/driver/register-band-run.mjs +2 -2
- package/driver/register-digest-record.mjs +31 -9
- package/driver/register-unit-record.mjs +10 -1
- package/driver/repair-composers.mjs +12 -11
- package/driver/repair-contract.mjs +6 -6
- package/driver/repair-targets.mjs +7 -6
- package/driver/run-outcome.mjs +8 -0
- package/driver/runner.mjs +42 -3
- package/driver/skills/README.md +5 -4
- package/driver/skills/blind-frame/SKILL.md +1 -1
- package/driver/skills/case-law-citation/SKILL.md +1 -1
- package/driver/skills/clearance-common-law/SKILL.md +6 -423
- package/driver/skills/clearance-common-law/grid.md +272 -0
- package/driver/skills/clearance-common-law/meaning.md +142 -0
- package/driver/skills/clearance-common-law/perplexity-prompts.md +4 -2
- package/driver/skills/clearance-register/SKILL.md +7 -174
- package/driver/skills/clearance-register/digest.md +89 -25
- package/driver/skills/clearance-register/providers/clarivate-questions.md +154 -0
- package/driver/skills/clearance-register/providers/clarivate.md +5 -149
- package/driver/skills/clearance-register/providers/signa-questions.md +120 -0
- package/driver/skills/clearance-register/providers/signa.md +3 -114
- package/driver/skills/clearance-register/providers/uspto-local.md +3 -3
- package/driver/skills/clearance-register/register-recipes.md +10 -10
- package/driver/skills/clearance-register/status-rules.md +2 -2
- package/driver/skills/clearance-register/unit.md +96 -54
- package/driver/skills/clearance-search/delivery-contract.md +11 -49
- package/driver/skills/clearance-search/firm-wide-reasoning.md +10 -13
- package/driver/skills/clearance-search/look-at-what-you-have.md +7 -0
- package/driver/skills/clearance-search/phase2-execution.md +12 -117
- package/driver/skills/clearance-search/report-card-rules.md +2 -2
- package/driver/skills/clearance-search/report-prose.md +30 -23
- package/driver/skills/clearance-search/synthesis-rules.md +27 -69
- package/driver/skills/clearance-search/worked-examples.md +11 -16
- package/driver/skills/clearance-variants/SKILL.md +7 -7
- package/driver/skills/clearance-variants/transliteration-scripts.md +2 -2
- package/driver/skills/frame-diff/SKILL.md +1 -1
- package/driver/skills/knockout-assess/SKILL.md +54 -41
- package/driver/skills/knockout-frame/SKILL.md +13 -12
- package/driver/skills/knockout-register-read/SKILL.md +2 -10
- package/driver/skills/matter-frame/SKILL.md +2 -2
- package/driver/skills/narrative-refutation/SKILL.md +7 -6
- package/driver/skills/placement-inquiry/SKILL.md +3 -3
- package/driver/skills/skeptic/SKILL.md +111 -0
- package/driver/skills/whatif-memo/SKILL.md +5 -2
- package/driver/stage-declarations.mjs +6 -0
- package/driver/stages-knockout.mjs +36 -38
- package/driver/stages.mjs +69 -64
- package/driver/steps/delivery.mjs +6 -4
- package/driver/steps/open-run.mjs +2 -0
- package/driver/steps/overview-and-cards.mjs +2 -2
- package/driver/steps/register-sweep.mjs +20 -1
- package/driver/steps/synthesis.mjs +28 -11
- package/driver/suite-census.json +213 -57
- package/driver/synthesis-record.mjs +24 -2
- package/driver/verify-knockout.mjs +23 -3
- package/driver/whatif-memo-run.mjs +39 -10
- package/driver/whatif-queue.mjs +53 -7
- package/mcp-server/CHANGELOG.md +4 -0
- package/mcp-server/lib/ops.mjs +19 -10
- package/mcp-server/lib/whatif.mjs +7 -6
- package/mcp-server/package.json +1 -1
- package/mcp-server/server.mjs +55 -19
- package/package.json +1 -1
- package/portal-ui/package.json +1 -1
- package/providers/clarivate/src/adapter.js +3 -0
- package/providers/jx/src/nativeread.js +5 -3
- package/providers/oauth-mcp-bridge/CHANGELOG.md +4 -0
- package/providers/oauth-mcp-bridge/package.json +1 -1
- package/providers/perplexity/src/core.js +7 -2
- package/providers/signa/src/adapter.js +3 -0
- package/scripts/e2e-first-time.mjs +2 -2
- package/shared/connector-signin-probe.mjs +1 -1
- package/shared/names-in-force.mjs +1 -0
- package/skills/clearotron-account/SKILL.md +21 -11
- package/skills/clearotron-client/SKILL.md +15 -15
- package/skills/clearotron-ops/COURIER.md +5 -1
- package/skills/clearotron-ops/SKILL.md +21 -14
|
@@ -14,7 +14,7 @@ import { answerBudget } from "../../../shared/answer-parts.mjs";
|
|
|
14
14
|
import {
|
|
15
15
|
isKnownPreset, questionPresetFor, buildRequestBody, callAgentAPI, formatResponse, formatSandboxResponse,
|
|
16
16
|
validateGridSpec, buildGridProgramTask, captureGridFromResponse, requiredLedgerRefusal,
|
|
17
|
-
reconcileGridLedger, findUnrecordedConnotationQueries, candidatesForJudgment, candidateParts, rawResultItems,
|
|
17
|
+
reconcileGridLedger, findUnrecordedConnotationQueries, candidatesForJudgment, candidateParts, rawResultItems, withoutProviderCharge,
|
|
18
18
|
} from "../../../providers/perplexity/src/core.js";
|
|
19
19
|
// — the seat's meaning-receipt obligations, told here because this is the first instant they exist.
|
|
20
20
|
// The SAME function the validator judges with (driver/connotation-search.mjs); see its doc block for why
|
|
@@ -205,10 +205,14 @@ const GRID_PART_CHARS = answerBudget() ? Math.min(70000, Math.floor(answerBudget
|
|
|
205
205
|
|
|
206
206
|
// `reserve` is what part 1's reply also carries (the meaning obligations): part 1 is that much smaller,
|
|
207
207
|
// and every call passes the same reserve for the same ledger, so every call splits it the same way.
|
|
208
|
+
// What a grid answer says about the cells it does not list (design, 2026-11-24, word for word).
|
|
209
|
+
const LEDGER_HOLDS_EVERY_CELL = "The ledger records each requested cell as a result or a gap. Read it for completed searches with no hits "
|
|
210
|
+
+ "and for gaps. The list below contains only cells with candidates.";
|
|
211
|
+
|
|
208
212
|
function judgeBlock(cands, part, gridSpecPath, reserve = 0) {
|
|
209
|
-
if (!cands.length) return "\n\nNo
|
|
213
|
+
if (!cands.length) return "\n\nNo candidates to review.";
|
|
210
214
|
const parts = candidateParts(cands, GRID_PART_CHARS, Math.max(GRID_PART_CHARS - reserve, 10000));
|
|
211
|
-
if (parts.length === 1) return `\n\
|
|
215
|
+
if (parts.length === 1) return `\n\nCandidates from ${cands.length} cells, the whole result:\n` + JSON.stringify(cands, null, 2);
|
|
212
216
|
const total = parts.length;
|
|
213
217
|
const p = Math.min(Math.max(1, Math.floor(Number(part)) || 1), total);
|
|
214
218
|
const head = `[perplexity_research part ${p}/${total} — these candidates exceed one tool response, so they are served in ${total} parts`
|
|
@@ -216,7 +220,8 @@ function judgeBlock(cands, part, gridSpecPath, reserve = 0) {
|
|
|
216
220
|
const tail = p < total
|
|
217
221
|
? `[end of part ${p}/${total} — call perplexity_research again with {"grid_spec_path": ${JSON.stringify(gridSpecPath)}, "part": ${p + 1}} for the next part]`
|
|
218
222
|
: `[end of part ${total}/${total} — the candidates are complete once parts 1..${total} are all read]`;
|
|
219
|
-
return `\n\n${head}\
|
|
223
|
+
return `\n\n${head}\nCandidates from ${parts[p - 1].length} cells on this page, of ${cands.length} cells in the whole result:\n`
|
|
224
|
+
+ JSON.stringify(parts[p - 1], null, 2) + `\n${tail}`;
|
|
220
225
|
}
|
|
221
226
|
|
|
222
227
|
async function research(params) {
|
|
@@ -230,7 +235,13 @@ async function research(params) {
|
|
|
230
235
|
{ ok: false, error: "refused: no research credential" });
|
|
231
236
|
return "ERROR: PERPLEXITY_API_KEY not set — marketplace research unavailable.";
|
|
232
237
|
}
|
|
233
|
-
|
|
238
|
+
// THE STEP CHOOSES THE QUESTION AND ITS SEARCH CONTROLS, NEVER THE TIER, THE MODEL OR AN OUTPUT SCHEMA: the run's frozen
|
|
239
|
+
// settings decide those. A depth, model or schema a step still sends (an older call shape) is read and ignored.
|
|
240
|
+
const { task, allow_fetch = false, domain_filter, enable_sandbox = false, grid_spec_path, part } = params;
|
|
241
|
+
const depth = null, modelOverride = null;
|
|
242
|
+
// A LATER PAGE IS A PAGE OF A GRID: it names the grid it pages, or it is no request at all.
|
|
243
|
+
if (!grid_spec_path && Number(part) > 1)
|
|
244
|
+
return "ERROR: a later page takes the same `grid_spec_path` as the first page, with `part`.";
|
|
234
245
|
|
|
235
246
|
// ── Deterministic grid mode: the caller dictates the cells; the tool runs + captures them. ──
|
|
236
247
|
if (grid_spec_path) {
|
|
@@ -253,18 +264,19 @@ async function research(params) {
|
|
|
253
264
|
const cands = candidatesForJudgment(already.ledger);
|
|
254
265
|
// A later part is part 1's answer read on: the obligations and the provenance record stay with
|
|
255
266
|
// part 1, and the split reserves the same room for them, so every call cuts the same parts.
|
|
256
|
-
if (Number(part) > 1)
|
|
257
|
-
return `Grid ALREADY RECORDED for this spec (${already.present}/${already.requested} cells present) at ${spec.output_path} — every dictated cell is accounted and every dictated meaning query carries a receipt, so it was NOT run again. The sweep is a fact of this run, not of this attempt.\n` +
|
|
258
|
-
`Do NOT write the grid ledger yourself — it is already saved. Use the candidates below for judgment only.` +
|
|
259
|
-
judgeBlock(cands, part, grid_spec_path, obligationsReserve(spec, ledgerJson));
|
|
267
|
+
if (Number(part) > 1) return judgeBlock(cands, part, grid_spec_path, obligationsReserve(spec, ledgerJson)).trimStart();
|
|
260
268
|
let owed = "";
|
|
261
269
|
try { owed = tellObligations(spec, ledgerJson); } catch { /* best-effort — see tellObligations */ }
|
|
262
270
|
writeGridProvenance(spec, { ran: false, present: already.present, requested: already.requested, model: modelOverride });
|
|
263
271
|
return `Grid ALREADY RECORDED for this spec (${already.present}/${already.requested} cells present) at ${spec.output_path} — every dictated cell is accounted and every dictated meaning query carries a receipt, so it was NOT run again. The sweep is a fact of this run, not of this attempt.\n` +
|
|
264
|
-
`Do NOT write the grid ledger yourself — it is already saved.
|
|
272
|
+
`Do NOT write the grid ledger yourself — it is already saved. ${LEDGER_HOLDS_EVERY_CELL}` +
|
|
265
273
|
judgeBlock(cands, 1, grid_spec_path, owed ? owed.length + 2 : 0) +
|
|
266
274
|
(owed ? `\n\n${owed}` : "");
|
|
267
275
|
}
|
|
276
|
+
// A LATER PAGE ONLY READS THE SAVED RESULT. With none saved there is no page to serve, and the request never
|
|
277
|
+
// becomes a new search: that is the first page's call, made with the path alone.
|
|
278
|
+
if (Number(part) > 1)
|
|
279
|
+
return requiredLedgerRefusal(`ERROR: page ${Math.floor(Number(part))} of this grid cannot be served: no saved result was found at ${spec.output_path}. Call perplexity_research with grid_spec_path alone for the first page.`, { spec, gridSpecPath: grid_spec_path });
|
|
268
280
|
const gridTask = buildGridProgramTask(spec);
|
|
269
281
|
try {
|
|
270
282
|
const data = await callAgentAPI(API_KEY, buildRequestBody({ task: gridTask, preset: "pro-search", modelOverride, enableSandbox: true }));
|
|
@@ -292,14 +304,14 @@ async function research(params) {
|
|
|
292
304
|
let owed = "";
|
|
293
305
|
try { owed = tellObligations(spec, cap.ledgerJson); } catch { /* best-effort, all of them: never cost a completed grid */ }
|
|
294
306
|
return `Grid complete. The tool wrote the verbatim grid ledger (${cap.present}/${cap.requested} cells present) to ${spec.output_path}.${note}\n` +
|
|
295
|
-
`Do NOT write the grid ledger yourself — it is already saved.
|
|
307
|
+
`Do NOT write the grid ledger yourself — it is already saved. ${LEDGER_HOLDS_EVERY_CELL}` +
|
|
296
308
|
judge + (owed ? `\n\n${owed}` : "");
|
|
297
309
|
} catch (err) { return requiredLedgerRefusal(`ERROR: grid research failed — ${err.message}${err?.cause ? ` (${err.cause.code || err.cause.name || err.cause})` : ""}`, { spec, gridSpecPath: grid_spec_path }); }
|
|
298
310
|
}
|
|
299
311
|
|
|
300
312
|
if (!task || task.trim().length === 0) {
|
|
301
|
-
logCall("perplexity_research", { task: "", depth:
|
|
302
|
-
return "ERROR: task
|
|
313
|
+
logCall("perplexity_research", { task: "", depth: null }, { ok: false, error: "empty task" });
|
|
314
|
+
return "ERROR: `task` is required for research. A grid call needs only `grid_spec_path`.";
|
|
303
315
|
}
|
|
304
316
|
const preset = questionPresetFor({ pinned: PINNED_QUESTION_PRESET, depth, task });
|
|
305
317
|
// The resolved preset, not the requested one: `depth` is often absent and detectPreset decides, so
|
|
@@ -307,7 +319,7 @@ async function research(params) {
|
|
|
307
319
|
// setting decided it rather than the question.
|
|
308
320
|
const asked = { task, depth: depth ?? null, preset, ...(PINNED_QUESTION_PRESET ? { pinned: true } : {}), allow_fetch, enable_sandbox,
|
|
309
321
|
...(domain_filter ? { domain_filter } : {}), ...(modelOverride ? { model: modelOverride } : {}) };
|
|
310
|
-
const body = buildRequestBody({ task, preset, allowFetch: allow_fetch, domainFilter: domain_filter, modelOverride, enableSandbox: enable_sandbox
|
|
322
|
+
const body = buildRequestBody({ task, preset, allowFetch: allow_fetch, domainFilter: domain_filter, modelOverride, enableSandbox: enable_sandbox });
|
|
311
323
|
// A QUESTION THIS STAGE ALREADY GOT AN ANSWER TO IS NOT SENT AGAIN (research-answers.mjs): the same request, from
|
|
312
324
|
// this stage or a retry of it, answered by what the run kept. It is logged as a lookup is, marked as reused, so the
|
|
313
325
|
// run's record says which questions were paid for on this pass.
|
|
@@ -315,7 +327,7 @@ async function research(params) {
|
|
|
315
327
|
const held = heldAnswerToRequest(RUN_DIR, SESSION, request);
|
|
316
328
|
if (held) {
|
|
317
329
|
logCall("perplexity_research", asked, { ok: true, bytes: held.text.length, reused: true });
|
|
318
|
-
return held.text;
|
|
330
|
+
return withoutProviderCharge(held.text);
|
|
319
331
|
}
|
|
320
332
|
try {
|
|
321
333
|
const data = await callAgentAPI(API_KEY, body);
|
|
@@ -356,7 +368,7 @@ function replayResearch(params) {
|
|
|
356
368
|
return "ERROR: replay — the run asked no question worded exactly like this one, so there is no saved answer to give; nothing was sent to the research service.";
|
|
357
369
|
}
|
|
358
370
|
logCall("perplexity_research", { task, replay: true }, { ok: true, bytes: saved.text.length, replayed: true });
|
|
359
|
-
return saved.text;
|
|
371
|
+
return withoutProviderCharge(saved.text);
|
|
360
372
|
}
|
|
361
373
|
|
|
362
374
|
serve({
|
|
@@ -367,16 +379,14 @@ serve({
|
|
|
367
379
|
// would be ignored, and a parameter that is ignored is one the model spends a thought on for nothing.
|
|
368
380
|
description: PINNED_QUESTION_PRESET
|
|
369
381
|
? "Web/marketplace research via Perplexity's agent API, at the depth this search is set to. For deterministic marketplace grids, pass `grid_spec_path` (absolute, the driver writes it) — the tool runs every (term × platform) cell and saves the verbatim ledger to the spec's output_path; you get back only candidates needing judgment (never write the grid yourself)."
|
|
370
|
-
: "Web/marketplace research via Perplexity's agent API.
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
382
|
+
: "Web/marketplace research via Perplexity's agent API. For deterministic marketplace grids, pass `grid_spec_path` (absolute, the driver writes it) — the tool runs every (term × platform) cell and saves the verbatim ledger to the spec's output_path; you get back only candidates needing judgment (never write the grid yourself).",
|
|
383
|
+
// NO FIELD IS REQUIRED BY THE SCHEMA: a grid's first page takes `grid_spec_path`, a later page that and `part`, and
|
|
384
|
+
// research a nonblank `task`. The handler checks the route before anything is sent.
|
|
385
|
+
inputSchema: { type: "object", properties: {
|
|
386
|
+
task: { type: "string", description: "Sanitized research query (~200 tokens max). Not used with grid_spec_path." },
|
|
375
387
|
allow_fetch: { type: "boolean", default: false },
|
|
376
388
|
domain_filter: { type: "array", items: { type: "string" }, description: "Restrict/exclude domains (max 20), e.g. ['nature.com','-reddit.com']." },
|
|
377
389
|
enable_sandbox: { type: "boolean", default: false, description: "Search-as-code mode." },
|
|
378
|
-
response_schema: { type: "object", description: "JSON Schema for structured output." },
|
|
379
|
-
schema_name: { type: "string" },
|
|
380
390
|
grid_spec_path: { type: "string", description: "Absolute path to the driver-written grid spec (implies enable_sandbox)." },
|
|
381
391
|
part: { type: "number", description: "1-based part number when a grid's candidates are served in parts (default 1)" },
|
|
382
392
|
} },
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
import { serve } from "./stdio-server.mjs";
|
|
39
39
|
import { recordSynthesis } from "../../synthesis-record.mjs"; // the writer
|
|
40
40
|
import { correctionPositionsFrom } from "./correction-positions.mjs"; // the positions a correction's dispatch hands its save
|
|
41
|
-
import { recordRegisterDigest } from "../../register-digest-record.mjs"; // conversion 11 — the findings document
|
|
42
|
-
import {
|
|
41
|
+
import { recordRegisterDigest, DIGEST_DROP_REASON_TOKENS, VERIFY_VALUES, ADJUDICATION_DECISIONS } from "../../register-digest-record.mjs"; // conversion 11 — the findings document
|
|
42
|
+
import { FINDING_FIELDS, COVERAGE_AREA_STATES, KNOCKOUT_FINDING_KEYS, KNOCKOUT_FINDING_TYPES } from "../../findings-model.mjs";
|
|
43
43
|
import { recordBlindFrame } from "../../blind-frame-record.mjs";
|
|
44
44
|
import { VARIANT_DIRECTIONS, RANKING_BASES } from "../../blind-frame-model.mjs";
|
|
45
45
|
import { recordSkeptic } from "../../skeptic-record.mjs";
|
|
@@ -65,7 +65,7 @@ import { REGISTER_AXES } from "../../coverage-ledger.mjs";
|
|
|
65
65
|
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
|
-
import { USE_PHRASE } from "../../verify-knockout.mjs"; // the use phrase, defined once
|
|
68
|
+
import { USE_PHRASE, FAMILIES_RULE, FRAME_REPAIR_RULE, KNOCKOUT_RATING_QUALIFIERS } from "../../verify-knockout.mjs"; // the use phrase, the families and the repair rule, each defined once
|
|
69
69
|
import { recordKnockoutReview } from "../../knockout-review-record.mjs";
|
|
70
70
|
import { recordKnockoutCorrection } from "../../knockout-correction-record.mjs";
|
|
71
71
|
import { recordKnockoutRegisterRead } from "../../knockout-register-record.mjs";
|
|
@@ -292,7 +292,7 @@ const KNOCKOUT_ASSESS_FINDING_FIELDS = {
|
|
|
292
292
|
// then, refused otherwise (findings-model.mjs validateKnockoutFinding).
|
|
293
293
|
inputs: { type: "object", additionalProperties: { type: "string" }, description: "The framework's own inputs for this finding, keyed by its labels, each one of the values it lists." },
|
|
294
294
|
net: { type: "string", description: "One conclusion sentence." },
|
|
295
|
-
type: { type: "string" },
|
|
295
|
+
type: { type: "string", enum: [...KNOCKOUT_FINDING_TYPES] },
|
|
296
296
|
evidence: { type: "array", items: { type: "string" } },
|
|
297
297
|
basis: { type: "string", description: "The ground THIS FINDING's band rests on — not the mark's `basis`, which is a different field one level up." },
|
|
298
298
|
// The ninth key. This schema once said "all eight, no others" and forbade it while the recorder enforced
|
|
@@ -309,14 +309,26 @@ const KNOCKOUT_CORRECTION_FINDING_FIELDS = {
|
|
|
309
309
|
band: { type: "string", description: "A word from the framework's ladder." },
|
|
310
310
|
inputs: { type: "object", description: "The framework's own inputs for this finding, where it states a method." },
|
|
311
311
|
net: { type: "string", description: "One conclusion sentence." },
|
|
312
|
-
type: { type: "string", description: "Famous Brand, Active Business, Cultural Reference, Domain, Descriptive Use, Negative Association or Competitor Intelligence." },
|
|
312
|
+
type: { type: "string", enum: [...KNOCKOUT_FINDING_TYPES], description: "Famous Brand, Active Business, Cultural Reference, Domain, Descriptive Use, Negative Association or Competitor Intelligence." },
|
|
313
313
|
evidence: { type: "array", items: { type: "string" }, description: "URLs held for this name." },
|
|
314
314
|
basis: { type: "string", description: "The ground the band rests on." },
|
|
315
315
|
weighedFilings: { type: "array", items: { type: "string" }, description: "The register record ids this finding's reasoning used." },
|
|
316
316
|
};
|
|
317
|
+
// The qualifier values both Knockout operations take, from the list the validator closes on.
|
|
318
|
+
const QUALIFIER_VALUES = `null or ${KNOCKOUT_RATING_QUALIFIERS.map((q) => `"${q}"`).join(" or ")}`;
|
|
317
319
|
const knockoutFindingProperties = (fields) =>
|
|
318
320
|
Object.fromEntries(KNOCKOUT_FINDING_KEYS.filter((k) => k in fields).map((k) => [k, fields[k]]));
|
|
319
321
|
|
|
322
|
+
// ── THE CLEARANCE FINDING, DECLARED FROM ITS ONE DEFINITION ────────────────────────────────────────────
|
|
323
|
+
//
|
|
324
|
+
// Both lists that carry a finding (`save_findings`, `findings_patch`) declare each key with its type and the words
|
|
325
|
+
// findings-model.mjs `FINDING_FIELDS` gives it: when it is required, its shape and the values it takes. A patch row
|
|
326
|
+
// keeps its own `ordinal`, which names the finding it replaces. No key is `required` here: the record's own checks
|
|
327
|
+
// refuse a missing field by name, in the turn, and a refusal at the schema leaves no call file.
|
|
328
|
+
const FINDING_ITEM = "One complete finding object, as the findings record carries it. It takes the keys below and no others.";
|
|
329
|
+
const findingProperties = (except = []) => Object.fromEntries(Object.entries(FINDING_FIELDS)
|
|
330
|
+
.filter(([k]) => !except.includes(k)).map(([k, f]) => [k, { type: f.type, description: f.about }]));
|
|
331
|
+
|
|
320
332
|
serve({
|
|
321
333
|
name: "recording",
|
|
322
334
|
tools: [{
|
|
@@ -600,7 +612,7 @@ serve({
|
|
|
600
612
|
type: "array",
|
|
601
613
|
description:
|
|
602
614
|
"One row per scope decision. The driver renders the ledger table AND writes scope-ledger.json " +
|
|
603
|
-
"from these rows — it
|
|
615
|
+
"from these rows — it does not recover them by parsing the table back out of the prose.",
|
|
604
616
|
items: {
|
|
605
617
|
type: "object", required: ["layer", "item", "status"],
|
|
606
618
|
properties: {
|
|
@@ -657,7 +669,7 @@ serve({
|
|
|
657
669
|
properties: {
|
|
658
670
|
uri: { type: "string", description: "The record's `/mark/…` uri, as the band carries it. The driver joins on it; a uri the band cannot resolve is refused." },
|
|
659
671
|
flag_reason: { type: "string", description: "WHY this position is risk-relevant — the judgment the row exists to carry." },
|
|
660
|
-
verify: { type: "string", enum: [
|
|
672
|
+
verify: { type: "string", enum: [...VERIFY_VALUES], description: "EXACTLY one bare token: does this row still need verification against the live register?" },
|
|
661
673
|
},
|
|
662
674
|
},
|
|
663
675
|
},
|
|
@@ -669,7 +681,7 @@ serve({
|
|
|
669
681
|
properties: {
|
|
670
682
|
uri: { type: "string", description: "The record's `/mark/…` uri, as the band carries it." },
|
|
671
683
|
flag_reason: { type: "string", description: "WHY this position is incumbent context rather than a risk-relevant conflict." },
|
|
672
|
-
verify: { type: "string", enum: [
|
|
684
|
+
verify: { type: "string", enum: [...VERIFY_VALUES], description: "EXACTLY one bare token." },
|
|
673
685
|
},
|
|
674
686
|
},
|
|
675
687
|
},
|
|
@@ -680,13 +692,13 @@ serve({
|
|
|
680
692
|
"screen_verdict, class, status) is rendered from the band record, not typed: a batch-dropped " +
|
|
681
693
|
"candidate with no entry here vanishes from the published audit, which is a silent recall loss.",
|
|
682
694
|
items: {
|
|
683
|
-
type: "object", required: ["uri", "drop_reason"],
|
|
695
|
+
type: "object", required: ["uri", "drop_reason", "ground"],
|
|
684
696
|
properties: {
|
|
685
697
|
uri: { type: "string", description: "The dropped record's `/mark/…` uri." },
|
|
686
698
|
drop_reason: { type: "string", description: "The one-line WHY — the judgment about THIS record. Never a bare status word." },
|
|
687
699
|
ground: {
|
|
688
700
|
type: "string",
|
|
689
|
-
enum: [
|
|
701
|
+
enum: [...DIGEST_DROP_REASON_TOKENS],
|
|
690
702
|
description:
|
|
691
703
|
"REQUIRED. EXACTLY one bare token saying under WHICH RULE the drop is made — the prose " +
|
|
692
704
|
"in drop_reason says why this record, the token says under which rule. `off-field` " +
|
|
@@ -704,14 +716,19 @@ serve({
|
|
|
704
716
|
instructed_checks: {
|
|
705
717
|
type: "array",
|
|
706
718
|
description:
|
|
707
|
-
"One entry per requester ask this stage owns, answered from the FROZEN material.
|
|
708
|
-
"
|
|
709
|
-
"genuinely cannot answer is answered honestly here AND recorded as an open coverage row.",
|
|
719
|
+
"One entry per requester ask this stage owns, answered from the FROZEN material. A check the " +
|
|
720
|
+
"frozen material genuinely cannot answer is answered honestly here AND recorded as an open coverage row.",
|
|
710
721
|
items: {
|
|
711
722
|
type: "object", required: ["ask", "answer"],
|
|
712
723
|
properties: {
|
|
713
724
|
ask: { type: "string", description: "The requester's ask, as dispatched." },
|
|
714
725
|
answer: { type: "string", description: "Your answer — including the honest \"the frozen material cannot answer this\"." },
|
|
726
|
+
records: {
|
|
727
|
+
type: "array", items: { type: "string" },
|
|
728
|
+
description: "OPTIONAL. The held record identifiers this answer relies on, where applicable: each record's `/mark/…` " +
|
|
729
|
+
"uri, as the band carries it. A uri the band does not hold is refused. Name none where the answer rests " +
|
|
730
|
+
"on a search's count, a verified zero or an open question.",
|
|
731
|
+
},
|
|
715
732
|
},
|
|
716
733
|
},
|
|
717
734
|
},
|
|
@@ -722,7 +739,7 @@ serve({
|
|
|
722
739
|
type: "object", required: ["subject", "decision", "reason"],
|
|
723
740
|
properties: {
|
|
724
741
|
subject: { type: "string", description: "Which placement — the mark and, where it helps a reader, its uri." },
|
|
725
|
-
decision: { type: "string", enum: [
|
|
742
|
+
decision: { type: "string", enum: [...ADJUDICATION_DECISIONS], description: "EXACTLY one bare token." },
|
|
726
743
|
reason: { type: "string", description: "An override QUOTES the reason it contradicts; a kept tier still says why." },
|
|
727
744
|
},
|
|
728
745
|
},
|
|
@@ -1157,8 +1174,8 @@ serve({
|
|
|
1157
1174
|
"COMPLETED FINDINGS, saved before the whole record exists. Send one or a few complete finding objects as the findings record carries them, and nothing else on the call. Each is checked as the record checks a finding and kept as soon as it passes; one that is refused leaves the others saved. A finding saved again for the same position replaces the earlier one. Saving writes no report: the record is complete only when you send `narrative` with `findings`, and that call takes every saved finding for a position it does not carry.",
|
|
1158
1175
|
items: {
|
|
1159
1176
|
type: "object",
|
|
1160
|
-
description:
|
|
1161
|
-
properties:
|
|
1177
|
+
description: FINDING_ITEM,
|
|
1178
|
+
properties: findingProperties(),
|
|
1162
1179
|
},
|
|
1163
1180
|
},
|
|
1164
1181
|
findings_patch: {
|
|
@@ -1180,11 +1197,9 @@ serve({
|
|
|
1180
1197
|
// schema without refusing the traffic it was meant to police.
|
|
1181
1198
|
//
|
|
1182
1199
|
// DERIVED, NEVER COPIED. The authority for what a finding carries is findings-model.mjs's
|
|
1183
|
-
// key ladder. A hand-written list here would be a second
|
|
1184
|
-
// and the two would drift the first time that ladder gains a key.
|
|
1185
|
-
|
|
1186
|
-
...Object.fromEntries(FINDING_KEYS_CURRENT.filter((k) => k !== "ordinal")
|
|
1187
|
-
.map((k) => [k, { description: `Part of the finding record; see findings-model.mjs for what \`${k}\` carries.` }])),
|
|
1200
|
+
// `FINDING_FIELDS`, held to the key ladder by a test. A hand-written list here would be a second
|
|
1201
|
+
// definition of the record's shape, and the two would drift the first time that ladder gains a key.
|
|
1202
|
+
...findingProperties(["ordinal"]),
|
|
1188
1203
|
},
|
|
1189
1204
|
},
|
|
1190
1205
|
},
|
|
@@ -1232,12 +1247,12 @@ serve({
|
|
|
1232
1247
|
// offered a field it may not use can fill it, and the check that refuses it runs after the whole step.
|
|
1233
1248
|
schemaNow: (schema) => knockoutAssessSchemaFor(schema, process.env.CLEAROTRON_BAND_RUN_DIR),
|
|
1234
1249
|
description:
|
|
1235
|
-
"Hand back THIS
|
|
1236
|
-
"so you never format JSON and never write the file. WHICH
|
|
1250
|
+
"Hand back THIS GROUP's rated assessment as VALUES. The driver serializes knockout-assess-<n>.json, " +
|
|
1251
|
+
"so you never format JSON and never write the file. WHICH GROUP IS NOT YOURS TO SAY — the driver " +
|
|
1237
1252
|
"bound it when it dispatched you, and there is no parameter for it. Rate every mark assigned to " +
|
|
1238
|
-
"this
|
|
1253
|
+
"this group and no others. " +
|
|
1239
1254
|
// The repair contract, in the dispatch's approved words: the recorder merges field by field (knockout-assess-record.mjs).
|
|
1240
|
-
"On the first call, send the complete assessment. Once the tool has confirmed a written record for this
|
|
1255
|
+
"On the first call, send the complete assessment. Once the tool has confirmed a written record for this group, 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 group summary when the correction changes it. If the tool has written no record, send the complete corrected assessment.",
|
|
1241
1256
|
inputSchema: {
|
|
1242
1257
|
type: "object",
|
|
1243
1258
|
// `schema_version` is accepted and ignored: the driver writes its own. Declared so a seat that
|
|
@@ -1252,13 +1267,12 @@ serve({
|
|
|
1252
1267
|
chunkSummary: {
|
|
1253
1268
|
type: "string",
|
|
1254
1269
|
description:
|
|
1255
|
-
"The
|
|
1256
|
-
"
|
|
1257
|
-
"without one vanishes from the summary a client reads.",
|
|
1270
|
+
"The summary of THIS group's names. Open with a line for each name and its band, then one \"## <MARK NAME>\" sub-header per name with the one or two things that drive its band, bullets where they help. " +
|
|
1271
|
+
"Every group sends one, and code joins them into the order's summary once every name is rated, so a name missing here is missing from what the client reads.",
|
|
1258
1272
|
},
|
|
1259
1273
|
framework: {
|
|
1260
1274
|
type: "object", additionalProperties: false,
|
|
1261
|
-
description: "
|
|
1275
|
+
description: "Not needed: the driver records the frozen framework. If you send it, it must name that framework and its ladder.",
|
|
1262
1276
|
properties: {
|
|
1263
1277
|
source: { type: "string", description: "The framework key." },
|
|
1264
1278
|
ladder: { type: "array", items: { type: "string" }, description: "Band words, highest first." },
|
|
@@ -1266,15 +1280,15 @@ serve({
|
|
|
1266
1280
|
},
|
|
1267
1281
|
batch: {
|
|
1268
1282
|
type: "object", additionalProperties: false,
|
|
1269
|
-
description: "
|
|
1283
|
+
description: "Optional, from any group. Use `batch.standardCaveats` only for a qualification the brief establishes for every name in the order. Put a qualification specific to an assigned name in that name’s assessment.",
|
|
1270
1284
|
properties: {
|
|
1271
|
-
productContext: { type: "string", description: "
|
|
1285
|
+
productContext: { type: "string", description: "Not needed: the driver takes the product context from the plan." },
|
|
1272
1286
|
standardCaveats: { type: "array", items: { type: "string" } },
|
|
1273
1287
|
},
|
|
1274
1288
|
},
|
|
1275
1289
|
marks: {
|
|
1276
1290
|
type: "array", minItems: 1,
|
|
1277
|
-
description: "One row per mark assigned to THIS
|
|
1291
|
+
description: "One row per mark assigned to THIS group — no invention, no neighbour-group overrun.",
|
|
1278
1292
|
items: {
|
|
1279
1293
|
type: "object", additionalProperties: false,
|
|
1280
1294
|
required: ["name"],
|
|
@@ -1282,14 +1296,14 @@ serve({
|
|
|
1282
1296
|
ref: { type: ["string", "null"] },
|
|
1283
1297
|
name: { type: "string", description: "The mark, VERBATIM as the plan names it — the join key for everything downstream." },
|
|
1284
1298
|
rating: { type: "string", description: "The band word from the framework in force, verbatim. Not a numeral, not a letter code." },
|
|
1285
|
-
ratingQualifier: { type: ["string", "null"], description:
|
|
1299
|
+
ratingQualifier: { type: ["string", "null"], description: `A closed sub-gradation that can only CAP a band; anything else belongs in the band word itself. It is ${QUALIFIER_VALUES}.` },
|
|
1286
1300
|
degraded: { type: ["boolean", "null"], description: "True only when the driver holds NO research payload for this mark. A degraded mark can never read as silently clean." },
|
|
1287
1301
|
bullets: { type: "array", minItems: 1, maxItems: 5, items: { type: "string" }, description: "1–5 evidence bullets." },
|
|
1288
1302
|
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." },
|
|
1289
1303
|
factors: { type: "array", minItems: 2, maxItems: 4, items: { type: "string" }, description: "2–4 one-line load-bearing observations behind the band." },
|
|
1290
1304
|
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." },
|
|
1291
1305
|
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." },
|
|
1292
|
-
assessment: { type: "string", description: "The opening
|
|
1306
|
+
assessment: { type: "string", description: "The opening read a reader of THIS MARK'S own report sees first. In the first substantive paragraph, give the overall band and name the goods or services that drive it." },
|
|
1293
1307
|
contextFraming: { type: "string" },
|
|
1294
1308
|
registerEstimate: { type: "string" },
|
|
1295
1309
|
parodyNote: { type: ["string", "null"] },
|
|
@@ -1350,7 +1364,7 @@ serve({
|
|
|
1350
1364
|
classesDriving: { type: "array", items: { type: "integer", minimum: 1, maximum: 45 }, description: "Mandatory at a material band — class-specific ratings." },
|
|
1351
1365
|
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: {
|
|
1352
1366
|
band: { type: "string", description: "The band for this group, in the framework's words." },
|
|
1353
|
-
ratingQualifier: { type: ["string", "null"], description:
|
|
1367
|
+
ratingQualifier: { type: ["string", "null"], description: `${QUALIFIER_VALUES}.` },
|
|
1354
1368
|
classes: { type: "array", minItems: 1, items: { type: "integer", minimum: 1, maximum: 45 } },
|
|
1355
1369
|
} } },
|
|
1356
1370
|
beltAndBraces: { type: "array", items: { type: "integer", minimum: 1, maximum: 45 } },
|
|
@@ -1381,7 +1395,7 @@ serve({
|
|
|
1381
1395
|
name: "record_knockout_review",
|
|
1382
1396
|
description:
|
|
1383
1397
|
"Hand back the MATERIAL DEFECTS you found, as VALUES, and your answer to the question the dispatch opens with. A material " +
|
|
1384
|
-
"defect goes to the step that rated the
|
|
1398
|
+
"defect goes to the step that rated the order, and you repair nothing. Send an empty `material` list when you found none.",
|
|
1385
1399
|
inputSchema: {
|
|
1386
1400
|
type: "object",
|
|
1387
1401
|
additionalProperties: false,
|
|
@@ -1414,7 +1428,7 @@ serve({
|
|
|
1414
1428
|
schemaNow: (schema) => knockoutAssessSchemaFor(schema, process.env.CLEAROTRON_BAND_RUN_DIR),
|
|
1415
1429
|
description:
|
|
1416
1430
|
"Hand back your repair of the defects you were given, as VALUES, sending only what changes. The driver merges it onto " +
|
|
1417
|
-
"the
|
|
1431
|
+
"the group it holds and checks the result as it checks a rated group. It refuses a change to a name no defect concerns, except a finding a defect names that also stands on that name. " +
|
|
1418
1432
|
"It refuses a moved finding no answer accounts for, and a rating that moves without its dependent answers. A repair turn may send " +
|
|
1419
1433
|
"only what it corrects, and what it has repaired is kept.",
|
|
1420
1434
|
inputSchema: {
|
|
@@ -1432,7 +1446,7 @@ serve({
|
|
|
1432
1446
|
findings: { type: "array", items: { type: "integer" }, description: "OPTIONAL: the ordinal of any finding this repair moved beyond the one the defect names." },
|
|
1433
1447
|
} },
|
|
1434
1448
|
},
|
|
1435
|
-
chunkSummary: { type: "string", description: "The whole of this
|
|
1449
|
+
chunkSummary: { type: "string", description: "The whole of this group's summary as it now reads, where the repair changes it. Required when a rating moves." },
|
|
1436
1450
|
marks: {
|
|
1437
1451
|
type: "array",
|
|
1438
1452
|
description: "One row per name you repair, carrying only the fields that change.",
|
|
@@ -1441,11 +1455,11 @@ serve({
|
|
|
1441
1455
|
properties: {
|
|
1442
1456
|
name: { type: "string", description: "The name, verbatim." },
|
|
1443
1457
|
rating: { type: "string", description: "The band, in the framework's words." },
|
|
1444
|
-
ratingQualifier: { type: ["string", "null"], description:
|
|
1458
|
+
ratingQualifier: { type: ["string", "null"], description: `${QUALIFIER_VALUES}.` },
|
|
1445
1459
|
classesDriving: { type: "array", items: { type: "integer" }, description: "The classes behind the band." },
|
|
1446
1460
|
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: {
|
|
1447
1461
|
band: { type: "string", description: "The band for this group, in the framework's words." },
|
|
1448
|
-
ratingQualifier: { type: ["string", "null"], description:
|
|
1462
|
+
ratingQualifier: { type: ["string", "null"], description: `${QUALIFIER_VALUES}.` },
|
|
1449
1463
|
classes: { type: "array", minItems: 1, items: { type: "integer", minimum: 1, maximum: 45 } },
|
|
1450
1464
|
} } },
|
|
1451
1465
|
basis: { type: "string", description: "One sentence: why this band, for this name, in these classes." },
|
|
@@ -1548,23 +1562,19 @@ serve({
|
|
|
1548
1562
|
}, {
|
|
1549
1563
|
name: "record_knockout_frame",
|
|
1550
1564
|
description:
|
|
1551
|
-
"Hand back the
|
|
1565
|
+
"Hand back the order's FRAME as VALUES: the plan, and the scope note. The driver serializes " +
|
|
1552
1566
|
"knockout-plan.json and writes knockout-frame.md, so you never format JSON and never write either " +
|
|
1553
1567
|
"file. `scope_note` is written EXACTLY as you send it, so write the finished 2-3 sentences — the " +
|
|
1554
1568
|
"driver adds no heading and composes nothing into it. One row per instructed mark, names verbatim " +
|
|
1555
|
-
|
|
1556
|
-
"marks onto what it already accepted BY MARK NAME, so the marks you omit survive — but a mark you " +
|
|
1557
|
-
"DO send replaces its stored row key by key, so send that mark whole.",
|
|
1569
|
+
`from the instructed scope. ${FRAME_REPAIR_RULE}`,
|
|
1558
1570
|
inputSchema: {
|
|
1559
1571
|
type: "object",
|
|
1560
|
-
// THE
|
|
1561
|
-
//
|
|
1562
|
-
//
|
|
1563
|
-
//
|
|
1572
|
+
// NOTHING IS REQUIRED AT THE TOP OR ON THE BATCH, because the gate cannot tell a first call from a repair (design,
|
|
1573
|
+
// 2026-11-24). The seat is handed this schema once, at the start of its session, and the gate checks every call
|
|
1574
|
+
// against it; required fields here refused the repair the description asks for, a batch field or a name row sent
|
|
1575
|
+
// alone, before the recorder saw it. The recorder holds the two states instead: the complete plan before its first
|
|
1576
|
+
// save, and the plan a repair leaves after it. A name row stays required whole, because a row sent replaces its row.
|
|
1564
1577
|
//
|
|
1565
|
-
// A REPAIR turn may still omit all three: the acceptor validates the MERGED result, so the stored
|
|
1566
|
-
// value stands. `required` describes the call that has nothing to merge onto — the first one.
|
|
1567
|
-
required: ["scope_note", "batch", "marks"],
|
|
1568
1578
|
// `schema` is accepted and ignored: the driver writes its own. Declared so a seat that sends it is
|
|
1569
1579
|
// not refused for a field nobody reads — the narrow-refusal rule preserve-merge.mjs states.
|
|
1570
1580
|
properties: {
|
|
@@ -1572,18 +1582,17 @@ serve({
|
|
|
1572
1582
|
scope_note: {
|
|
1573
1583
|
type: "string",
|
|
1574
1584
|
description:
|
|
1575
|
-
"The 2-3 sentence scope note, written to knockout-frame.md EXACTLY as sent. What the
|
|
1585
|
+
"The 2-3 sentence scope note, written to knockout-frame.md EXACTLY as sent. What the order " +
|
|
1576
1586
|
"is, which classes, anything flagged. Name the search that was configured — this document is " +
|
|
1577
1587
|
"read to check that what ran is what the client ordered.",
|
|
1578
1588
|
},
|
|
1579
1589
|
batch: {
|
|
1580
1590
|
type: "object",
|
|
1581
|
-
required: ["productContext", "inUseAs", "useKind"], // places are per name (ruling 570): the batch list is optional, as in the acceptor and the manual
|
|
1582
1591
|
properties: {
|
|
1583
|
-
productContext: { type: "string", description: "One sentence: what the
|
|
1592
|
+
productContext: { type: "string", description: "One sentence: what the order is for. Every mark's contextFraming is read against it." },
|
|
1584
1593
|
// THE ORDER'S USE PHRASE (design, 2026-11-24): one for the names with the order's proposed use, so two runs of one order ask the same questions.
|
|
1585
1594
|
useKind: { type: "string", description: USE_PHRASE },
|
|
1586
|
-
inUseAs: { type: "string", description: "The kinds of use off the register that could conflict in this client's field, as one phrase completing \"Is this name already in use as …?\". The places the
|
|
1595
|
+
inUseAs: { type: "string", description: "The kinds of use off the register that could conflict in this client's field, as one phrase completing \"Is this name already in use as …?\". The places the order is searched on include the sites where these uses are listed." },
|
|
1587
1596
|
places: {
|
|
1588
1597
|
type: "array", items: { type: "string" },
|
|
1589
1598
|
description: "THE PLACES ARE PER NAME (task 2d) and go on each mark, not here.",
|
|
@@ -1595,7 +1604,7 @@ serve({
|
|
|
1595
1604
|
},
|
|
1596
1605
|
families: {
|
|
1597
1606
|
type: "array", items: { type: "array", items: { type: "string" } },
|
|
1598
|
-
description:
|
|
1607
|
+
description: FAMILIES_RULE,
|
|
1599
1608
|
},
|
|
1600
1609
|
},
|
|
1601
1610
|
},
|
|
@@ -1613,12 +1622,12 @@ serve({
|
|
|
1613
1622
|
classes: { type: "array", items: { type: "number" }, description: "Nice classes, integers 1-45." },
|
|
1614
1623
|
beltAndBraces: { type: "array", items: { type: "number" }, description: "Adjacent Nice classes swept as a precaution, integers 1-45." },
|
|
1615
1624
|
classesPlain: { type: "string", description: "The plain-language class line — what these classes are, in words the rating step reads beside the numbers." },
|
|
1616
|
-
contextFraming: { type: "string", description: "What THIS name is for — a character, a location, a product line. The rating hangs off it: the assess stage is told to rate WITH this field, per mark, and two names in one
|
|
1625
|
+
contextFraming: { type: "string", description: "What THIS name is for — a character, a location, a product line. The rating hangs off it: the assess stage is told to rate WITH this field, per mark, and two names in one order can sit at different bands on identical evidence because they are used differently." },
|
|
1617
1626
|
useKind: { type: "string", description: "A different use the request gives this name, copied as batch.useKind is (task 2c). Leave it out otherwise." },
|
|
1618
1627
|
// PER NAME, NOT PER BATCH (ruling 570). Declared here as well as in the driver's allowlist
|
|
1619
1628
|
// because a field the prose asks for and the schema omits is a contradiction the seat
|
|
1620
1629
|
// resolves whichever way it happens to trust.
|
|
1621
|
-
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
|
|
1630
|
+
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 order may have different lists." },
|
|
1622
1631
|
// NO SPELLINGS: the driver builds them from the name (task 2e). A held answer that sends them is accepted, as the record says.
|
|
1623
1632
|
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." },
|
|
1624
1633
|
priorKnowledge: { type: "string", description: "What the requester already told you about this name, or omit it." },
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
import { serve } from "./stdio-server.mjs";
|
|
42
42
|
import { recordUnitNote } from "../../register-unit-record.mjs";
|
|
43
43
|
import { recordWithheldFamilies, recordReleasedFamilies, WITHHELD_REASON_MAX } from "../../withheld-families.mjs";
|
|
44
|
+
import { PRODUCT_FAULT_MESSAGE } from "../../product-fault.mjs";
|
|
44
45
|
|
|
45
46
|
async function record_unit_note(params) {
|
|
46
47
|
const runDir = String(process.env.CLEAROTRON_BAND_RUN_DIR ?? "");
|
|
@@ -57,6 +58,7 @@ async function record_unit_note(params) {
|
|
|
57
58
|
try {
|
|
58
59
|
const r = recordUnitNote(runDir, { ...(params ?? {}), axis: bound });
|
|
59
60
|
if (r.refused) return { isError: true, text: `REFUSED: ${r.refused}` };
|
|
61
|
+
if (r.product_fault) return { isError: true, text: PRODUCT_FAULT_MESSAGE };
|
|
60
62
|
if (r.write_failed) return { isError: true, text: `ERROR: the driver could not store this note (${r.write_failed}). This is a driver fault, not a fault in your observation — do not re-type it.` };
|
|
61
63
|
// THE COUNTS ARE REPORTED BACK, because they are the note's substance and the seat never saw them:
|
|
62
64
|
// they are derived from the band the tools wrote. A seat that reads them back can tell at once that
|
|
@@ -28,7 +28,7 @@ import { newSessionRecord, noteCodexEvent, sessionSummary, countTool, streamSink
|
|
|
28
28
|
import { writeSecretFile } from "../../shared/secret-file.mjs"; // the rotated login goes back the way every credential is written
|
|
29
29
|
import { tmpdir, homedir } from "node:os";
|
|
30
30
|
import { join, dirname, sep } from "node:path";
|
|
31
|
-
import { runStreamingChild, absolutizeSkillRefs,
|
|
31
|
+
import { runStreamingChild, absolutizeSkillRefs, outputRule, FILE_OUTPUT, EVIDENCE_RULE, buildEnvelope, resolveSpawnCwd, isRecordTool } from "./common.mjs";
|
|
32
32
|
import { renderCodexConfigToml } from "./mcp/codex-config.mjs";
|
|
33
33
|
import { resolveAuthMode } from "./auth.mjs";
|
|
34
34
|
import { engineEnv, codexCommandWithheld } from "./engine-env.mjs";
|
|
@@ -405,29 +405,14 @@ export function withWorkFolder(env, dir) {
|
|
|
405
405
|
// WHAT THE MODEL IS TOLD, as the design ruling of 2026-10-27 approved it (its section on isolation). It describes the
|
|
406
406
|
// mechanism and replaces nothing: the profile is what keeps another run's files out of reach. Codex alone carries it,
|
|
407
407
|
// since only a Codex stage runs commands and only a Codex turn has a working folder of its own.
|
|
408
|
-
export const TEMP_FOLDER_RULE =
|
|
409
|
-
// THE OUTPUT RULE FOR A TURN THAT WRITES A FILE, in design's words of 2026-11-21, character for character. Claude's
|
|
410
|
-
// rule (common.mjs, WRITE_DISCIPLINE) names Claude's Write and Edit tools, which a Codex turn does not have, so a
|
|
411
|
-
// Codex turn that authors a file is given the same obligation in terms of its own file-writing operation: the whole
|
|
412
|
-
// file at the exact path, checked before it is reported, and a repair that edits only what the correction names.
|
|
413
|
-
export const CODEX_WRITE_RULE =
|
|
414
|
-
"When the task asks you to write output to an absolute file path, use your file-writing operation to write the " +
|
|
415
|
-
"complete content at that exact path, replacing the previous content if necessary. Text in your reply is discarded. " +
|
|
416
|
-
"Write every required file and verify that it exists before reporting it as written. Reply with just the path or " +
|
|
417
|
-
"paths you wrote and a two- or three-line summary. When the task asks you to fix an existing file, edit only what " +
|
|
418
|
-
"the correction names. If the file is missing, create it in full.";
|
|
419
|
-
/** What a Codex turn that writes a file carries: its output rule, then the temp-folder rule. */
|
|
420
|
-
export const CODEX_FILE_INSTRUCTIONS = `${CODEX_WRITE_RULE} ${TEMP_FOLDER_RULE}`;
|
|
421
|
-
/** What a Codex turn whose result goes through its recording tool carries: the rule it had before, then the temp-folder rule. */
|
|
422
|
-
export const CODEX_RECORDING_INSTRUCTIONS = `${WRITE_DISCIPLINE} ${TEMP_FOLDER_RULE}`;
|
|
408
|
+
export const TEMP_FOLDER_RULE = `Keep temporary working files in the directory given by TMPDIR. ${EVIDENCE_RULE}`;
|
|
423
409
|
/**
|
|
424
|
-
* The developer instructions for one Codex turn
|
|
425
|
-
*
|
|
426
|
-
*
|
|
427
|
-
* which keeps Claude's write grant, on a recording stage. Any other turn authors a file. PURE.
|
|
410
|
+
* The developer instructions for one Codex turn: its output rule, by how it returns its result (common.mjs,
|
|
411
|
+
* `outputRule`), then the temp-folder rule. The same output rule Claude carries; a turn whose reply is its result
|
|
412
|
+
* carries the temp-folder rule alone. PURE.
|
|
428
413
|
*/
|
|
429
|
-
export const codexDeveloperInstructions = ({
|
|
430
|
-
(
|
|
414
|
+
export const codexDeveloperInstructions = ({ output = FILE_OUTPUT } = {}) =>
|
|
415
|
+
[outputRule(output), TEMP_FOLDER_RULE].filter(Boolean).join(" ");
|
|
431
416
|
|
|
432
417
|
/**
|
|
433
418
|
* The folder holding codex's own programs, which the stage's profile must let it read. codex runs every
|
|
@@ -1023,7 +1008,7 @@ export const openaiAgentEngine = {
|
|
|
1023
1008
|
// `thread/resume failed: no rollout found for thread id ... (code -32600)`, exit 1 — with the control
|
|
1024
1009
|
// (same id, same binary, its own home) resuming cleanly. So every warm-patch retry and every
|
|
1025
1010
|
// form-repair sub-turn on the codex arm has been failing.
|
|
1026
|
-
async runTurn({ message, model, thinking, timeoutSec, resumeRef, mcpConfig, allowedTools, cwd, skillsDir, skillsGrantRoots, profilesDir, resolveSkill, runDir,
|
|
1011
|
+
async runTurn({ message, model, thinking, timeoutSec, resumeRef, mcpConfig, allowedTools, cwd, skillsDir, skillsGrantRoots, profilesDir, resolveSkill, runDir, output = FILE_OUTPUT, stallSec, stageHome: providedHome, streamFile = null } = {}) {
|
|
1027
1012
|
if (!message) throw new Error("openai-agent.runTurn: message is required");
|
|
1028
1013
|
const t0 = Date.now();
|
|
1029
1014
|
let codexHome;
|
|
@@ -1070,7 +1055,7 @@ export const openaiAgentEngine = {
|
|
|
1070
1055
|
const fence = codexSandboxBypassed() ? null
|
|
1071
1056
|
: { runDir, workDir, readRoots: [...(skillsGrantRoots?.length ? skillsGrantRoots : [skillsDir]), codexProgramRoot(codexBin())].filter(Boolean) };
|
|
1072
1057
|
writeFileSync(join(codexHome, "config.toml"),
|
|
1073
|
-
renderCodexConfigToml({ mcpConfig, allowedTools, developerInstructions: codexDeveloperInstructions({
|
|
1058
|
+
renderCodexConfigToml({ mcpConfig, allowedTools, developerInstructions: codexDeveloperInstructions({ output }), toolTimeoutSec: timeoutSec, fence,
|
|
1074
1059
|
withheldFromCommands: codexCommandWithheld() }));
|
|
1075
1060
|
|
|
1076
1061
|
const input = absolutizeSkillRefs(message, skillsDir, resolveSkill);
|