clearotron 0.6.0 → 0.7.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/INSTALL.md +7 -4
- package/QUICKSTART.md +1 -0
- package/README.md +5 -2
- package/THIRD-PARTY-NOTICES.md +1 -1
- package/bin/clearotron.mjs +4 -2
- package/bin/onboard.mjs +158 -29
- package/build-info.json +2 -2
- package/docs/CLIENT-MCP.md +3 -1
- package/docs/DELIVERY.md +6 -3
- package/docs/architecture/02-architecture.md +1 -1
- package/docs/architecture/04-configuration-reference.md +105 -8
- package/docs/branding.md +4 -4
- package/docs/report-data/clearance-1.schema.json +320 -0
- package/docs/report-data/knockout-1.schema.json +268 -0
- package/driver/CHANGELOG.md +77 -0
- package/driver/cancel.mjs +19 -0
- package/driver/connotation-search.mjs +1 -1
- package/driver/contract-e3-backlog.mjs +41 -41
- package/driver/contract-vocabulary.mjs +1 -1
- package/driver/coverage-ledger.mjs +18 -2
- package/driver/deferral-row.mjs +1 -1
- package/driver/degraded-parts.mjs +1 -0
- package/driver/driver.config.mjs +5 -5
- package/driver/effective-scope.mjs +3 -1
- package/driver/engagement-receipt.mjs +3 -3
- package/driver/engine/anthropic-agent.mjs +15 -1
- package/driver/engine/common.mjs +7 -0
- package/driver/engine/mcp/band-server.mjs +7 -16
- package/driver/engine/mcp/codex-config.mjs +3 -0
- package/driver/engine/mcp/recording-server.mjs +45 -34
- package/driver/engine/openai-agent.mjs +74 -7
- package/driver/engine/session-record.mjs +44 -2
- package/driver/findings-model.mjs +14 -2
- package/driver/follow-up-twins.mjs +86 -0
- package/driver/gateway.mjs +77 -12
- package/driver/jx-units.mjs +3 -1
- package/driver/jx.mjs +13 -5
- package/driver/manuals-inline.mjs +98 -0
- package/driver/manuals-seen.mjs +134 -0
- package/driver/mark-logos.mjs +174 -0
- package/driver/methodology-witness.mjs +2 -1
- package/driver/owner-use-check.mjs +8 -4
- package/driver/package.json +1 -1
- package/driver/pipeline-knockout.mjs +23 -4
- package/driver/pipeline.mjs +128 -15
- package/driver/portal-local-auth.mjs +6 -2
- package/driver/portal-report.mjs +45 -14
- package/driver/portal-routes/me.mjs +4 -1
- package/driver/portal-runs.mjs +19 -16
- package/driver/predelivery-lint.mjs +7 -5
- package/driver/profiles.mjs +4 -4
- package/driver/publish/README.md +9 -7
- package/driver/publish/email-conditions.mjs +22 -5
- package/driver/publish/evidence-words.mjs +21 -0
- package/driver/publish/index.mjs +304 -211
- package/driver/publish/knockout.mjs +297 -247
- package/driver/publish/office-record-links.mjs +11 -9
- package/driver/publish/page-shell.mjs +98 -0
- package/driver/publish/pool-admin.mjs +2 -2
- package/driver/publish/publish-inputs.mjs +4 -0
- package/driver/publish/regions.mjs +28 -3
- package/driver/publish/register-record-html.mjs +105 -0
- package/driver/publish/register-record.mjs +165 -0
- package/driver/publish/render-knockout.mjs +299 -671
- package/driver/publish/render.mjs +561 -492
- package/driver/publish/report-data.mjs +226 -13
- package/driver/publish/report-document.mjs +353 -0
- package/driver/publish/search-depth.mjs +88 -7
- package/driver/publish/shell.mjs +41 -1
- package/driver/publish/strings.mjs +810 -0
- package/driver/publish/templates/clearance-print.css +23 -0
- package/driver/publish/templates/knockout.css +224 -0
- package/driver/publish/templates/report.css +112 -53
- package/driver/publish/xlsx.mjs +158 -139
- package/driver/record-goods.mjs +42 -0
- package/driver/reference-score.mjs +4 -1
- package/driver/register-count.mjs +5 -1
- package/driver/register-reach.mjs +39 -0
- package/driver/registry-fidelity.mjs +155 -37
- package/driver/repair-composers.mjs +7 -3
- package/driver/repair-targets.mjs +4 -1
- package/driver/replay-archive.mjs +4 -3
- package/driver/run-delivered.mjs +14 -8
- package/driver/run-record.mjs +1 -0
- package/driver/runner.mjs +73 -29
- package/driver/scope-facts.mjs +27 -6
- package/driver/search-policy.mjs +9 -4
- package/driver/skills/clearance-search/report-prose.md +3 -0
- package/driver/skills/knockout-assess/SKILL.md +8 -0
- package/driver/stage-freshness.mjs +8 -5
- package/driver/stages.mjs +69 -43
- package/driver/steps/delivery.mjs +9 -5
- package/driver/steps/overview-and-cards.mjs +54 -15
- package/driver/steps/register-sweep.mjs +5 -4
- package/driver/steps/skeptic-and-follow-up.mjs +3 -2
- package/driver/steps/verdict-gate.mjs +35 -14
- package/driver/suite-census.json +579 -87
- package/driver/synthesis-record.mjs +4 -3
- package/driver/terminal-clamp.mjs +6 -1
- package/driver/withdrawn-rating.mjs +72 -0
- package/mcp-server/CHANGELOG.md +8 -0
- package/mcp-server/lib/audit-view.mjs +5 -2
- package/mcp-server/lib/brief.mjs +6 -2
- package/mcp-server/lib/evidence.mjs +94 -23
- package/mcp-server/lib/findings.mjs +19 -2
- package/mcp-server/lib/knockout.mjs +13 -4
- package/mcp-server/lib/scrub.mjs +1 -1
- package/mcp-server/package.json +1 -1
- package/mcp-server/server.mjs +22 -3
- package/package.json +4 -1
- package/portal-ui/dist/assets/{index-CYaO2ygd.js → index-BBlN4CYq.js} +238 -80
- package/portal-ui/dist/assets/{index-izLa9apq.css → index-CxAkJXIT.css} +25 -5
- package/portal-ui/dist/index.html +2 -2
- package/portal-ui/package.json +3 -3
- package/providers/_shared/ledger.mjs +30 -2
- package/providers/_shared/record-uri.mjs +15 -0
- package/providers/clarivate/src/adapter.js +11 -0
- package/providers/clarivate/src/core.js +17 -1
- package/providers/jx/src/core.js +4 -4
- package/providers/jx/src/judge.js +1 -3
- package/providers/jx/src/nativeread.js +1 -3
- package/providers/oauth-mcp-bridge/CHANGELOG.md +8 -0
- package/providers/oauth-mcp-bridge/package.json +1 -1
- package/scripts/README.md +147 -3
- package/scripts/added-reference-check.mjs +35 -7
- package/scripts/e2e-first-time.mjs +4 -4
- package/scripts/env-audit.mjs +16 -9
- package/scripts/freeze-example-run.mjs +3 -3
- package/scripts/mint-public-residue.mjs +3 -3
- package/scripts/mint-search-level-tags.mjs +61 -0
- package/scripts/mint-source-pin-census.mjs +89 -0
- package/scripts/release-note-required.mjs +65 -6
- package/scripts/test-durations-reporter.mjs +25 -0
- package/scripts/test-full.mjs +72 -18
- package/scripts/test-run.mjs +18 -1
- package/shared/brand.mjs +93 -6
- package/shared/inline-markdown.mjs +53 -0
- package/shared/names-in-force.mjs +0 -1
- package/shared/portal-tokens.mjs +2 -1
- package/shared/reference-guard-classes.mjs +43 -2
- package/shared/register-selection.mjs +8 -3
- package/shared/search-level-tags.json +25 -0
- package/shared/source-spans.mjs +91 -0
- package/shared/tools/derive-band-pairs.mjs +10 -0
- package/driver/own-rights.mjs +0 -83
- package/driver/use-check.mjs +0 -85
|
@@ -171,7 +171,7 @@ export const E3_BACKLOG = [
|
|
|
171
171
|
{
|
|
172
172
|
stage: "common-law",
|
|
173
173
|
kind: "dictated-line-shape",
|
|
174
|
-
where: "driver/stages.mjs:
|
|
174
|
+
where: "driver/stages.mjs:963 (emitted at 1918, 1947, 2127, 2347)",
|
|
175
175
|
surface: "stage-message",
|
|
176
176
|
evidence: "CROSS-CHECK HAND-OFF: … record it on its OWN line in EXACTLY the form \"CROSS-CHECK REQUIRED: <what> — <why>\" (that exact prefix; an em-dash between what and why; name the mark in CAPS in <what>). The driver parses ONLY this exact line shape…",
|
|
177
177
|
reparsedBy: "driver/doubt-ledger.mjs:183 CROSS_CHECK_RE = /^(?:[-*]\\s+)?CROSS-CHECK REQUIRED:\\s*(.+?)\\s+—\\s+(.+?)\\s*$/ → mintCrossCheckDoubts",
|
|
@@ -256,7 +256,7 @@ export const E3_BACKLOG = [
|
|
|
256
256
|
{
|
|
257
257
|
stage: "register-unit",
|
|
258
258
|
kind: "literal-json-skeleton",
|
|
259
|
-
where: "driver/stages.mjs:
|
|
259
|
+
where: "driver/stages.mjs:2147 (the non-supplemental-lane branch)",
|
|
260
260
|
surface: "stage-message",
|
|
261
261
|
evidence: "BAND ARTIFACT (MANDATORY): ALSO write the COMPLETE NAMED BAND for this axis to <path> — a JSON ARRAY, one block per register_enumerate / count-probe call, in the named-band contract: {\"state\":\"enumerated\",\"query\":\"<what was searched>\",\"total_hits\":N,\"records\":[{record_id, mark_text, classes, status,",
|
|
262
262
|
reparsedBy: "driver/named-band.mjs parseNamedBand / bandRecords / bandCrowds / mergeNamedBands (named in driver/skills/clearance-register/unit.md:60-62); validators.registerUnit",
|
|
@@ -265,7 +265,7 @@ export const E3_BACKLOG = [
|
|
|
265
265
|
{
|
|
266
266
|
stage: "register-unit",
|
|
267
267
|
kind: "exactly-these-keys",
|
|
268
|
-
where: "driver/stages.mjs:
|
|
268
|
+
where: "driver/stages.mjs:2112",
|
|
269
269
|
surface: "stage-message",
|
|
270
270
|
evidence: "Every block you append MUST carry \"state\":\"enumerated\" (ONLY if you paged it to has_more:false) or \"state\":\"incomplete\" — EXACTLY those two strings; there is no \"verified\"/\"checked\"/\"complete\"/\"clean\" state, and any other value fails the stage.",
|
|
271
271
|
reparsedBy: "driver/named-band.mjs parseNamedBand (off-enum state fails validators.registerUnit)",
|
|
@@ -283,7 +283,7 @@ export const E3_BACKLOG = [
|
|
|
283
283
|
{
|
|
284
284
|
stage: "register-unit",
|
|
285
285
|
kind: "exactly-these-keys",
|
|
286
|
-
where: "driver/stages.mjs:
|
|
286
|
+
where: "driver/stages.mjs:4136 (the frame-reopen / scoped-retry message builder). A second number stood here and had been stale for some time: it pointed at a contract-element description rather than a builder, at its old line and at every mechanical shift of it. Two candidate builders sit beside 4164 and picking one would be a guess, so the wrong pointer is removed rather than moved a third time — one accurate citation beats one accurate and one invented.",
|
|
287
287
|
surface: "stage-message",
|
|
288
288
|
evidence: "Every block you append MUST carry \"state\":\"enumerated\" (ONLY if paged to has_more:false) or \"state\":\"incomplete\" — EXACTLY those two strings … (re-dispatch builders, which REPLACE def.message)",
|
|
289
289
|
reparsedBy: "driver/named-band.mjs parseNamedBand. Scope warning: these builders replace def.message on every escalation / envelope-close / frame-reopen dispatch, so an E3 lint that walks STAGES[*].message only never sees them",
|
|
@@ -301,7 +301,7 @@ export const E3_BACKLOG = [
|
|
|
301
301
|
{
|
|
302
302
|
stage: "placement-inquiry",
|
|
303
303
|
kind: "exactly-these-keys",
|
|
304
|
-
where: "driver/stages.mjs:
|
|
304
|
+
where: "driver/stages.mjs:2319",
|
|
305
305
|
surface: "stage-message",
|
|
306
306
|
evidence: "· tier EXACTLY one of headline-candidate / sheet-2 / watchlist-annex / out-of-scope-filtered.",
|
|
307
307
|
reparsedBy: "driver/placement-form.mjs / driver/placement-model.mjs via validators.placement",
|
|
@@ -341,7 +341,7 @@ export const E3_BACKLOG = [
|
|
|
341
341
|
// (coverage-form.mjs coverageFormBrief) and the tool schema, with every row receiver-validated at
|
|
342
342
|
// call time. Same dictated vocabulary, same authored site, new route — this row's evidence follows
|
|
343
343
|
// the dictation so the row keeps describing something that exists.
|
|
344
|
-
where: "driver/stages.mjs:
|
|
344
|
+
where: "driver/stages.mjs:2530 (the digest message) + driver/coverage-form.mjs (coverageFormBrief — the dispatch block carrying the enum and the row shape)",
|
|
345
345
|
surface: "stage-message",
|
|
346
346
|
evidence: "Record a \"status\" and a \"reason\" on EVERY row ONLY by calling the … tool — the driver validates each row as it arrives, holds the record itself, and renders both the ## Coverage ledger table and the coverage JSON from it",
|
|
347
347
|
reparsedBy: "driver/coverage-call.mjs validateCoverageCall (receiver-validated at call time, the same predicates the gate judges with) + driver/coverage-form.mjs rowIsSettled via validators.registerFindings over the _driver/ accumulator",
|
|
@@ -424,7 +424,7 @@ export const E3_BACKLOG = [
|
|
|
424
424
|
{
|
|
425
425
|
stage: "frame-diff",
|
|
426
426
|
kind: "exactly-these-keys",
|
|
427
|
-
where: "driver/stages.mjs:
|
|
427
|
+
where: "driver/stages.mjs:2698",
|
|
428
428
|
surface: "stage-message",
|
|
429
429
|
evidence: "For each blind-model variant / field / source the run did NOT scope or search, emit one directive {layer, item, observation, severity} … severity = dominant-element (the omission is ON the spine) | material (a real omission worth a targeted sweep) | minor (already covered, or presentation only).",
|
|
430
430
|
reparsedBy: "driver/verify.mjs validators.frameDiff + driver/pipeline.mjs runSupplementalSweeps (the parser REFUSES a firing variant directive that dictates nothing dispatchable)",
|
|
@@ -448,10 +448,10 @@ export const E3_BACKLOG = [
|
|
|
448
448
|
{
|
|
449
449
|
stage: "synthesis",
|
|
450
450
|
kind: "literal-json-skeleton",
|
|
451
|
-
where: "driver/stages.mjs:
|
|
451
|
+
where: "driver/stages.mjs:3082",
|
|
452
452
|
surface: "stage-message",
|
|
453
453
|
evidence: "MACHINE FINDINGS (MANDATORY): … a JSON OBJECT {\"schema_version\":<FINDINGS_SCHEMA_VERSION>,\"rated_under_framework\":\"…\",\"findings\":[...],\"coverage\":[...],\"context_notes\":[...],\"actions\":[...],\"ask_answers\":[...]} … Each finding object has EXACTLY these keys: {\"ordinal\",\"mark\",\"owner\",\"band\",\"net\",\"bor",
|
|
454
|
-
reparsedBy: "driver/findings-model.mjs:
|
|
454
|
+
reparsedBy: "driver/findings-model.mjs:855 parseFindingsJson via validators.narrative",
|
|
455
455
|
removedByMove: "NOTHING ON THE #850 PLAN REMOVES THIS",
|
|
456
456
|
},
|
|
457
457
|
// RETIRED 2026-08-16 — synthesis's dictated disposition list, and I am the one who left it standing.
|
|
@@ -462,7 +462,7 @@ export const E3_BACKLOG = [
|
|
|
462
462
|
{
|
|
463
463
|
stage: "synthesis",
|
|
464
464
|
kind: "exactly-these-keys",
|
|
465
|
-
where: "driver/stages.mjs:
|
|
465
|
+
where: "driver/stages.mjs:3115",
|
|
466
466
|
surface: "stage-message",
|
|
467
467
|
evidence: "- off_field_ground (MANDATORY on every off-field finding, FORBIDDEN on every other disposition): EXACTLY one bare token of: ${OFF_FIELD_GROUNDS.join(\" / \")}",
|
|
468
468
|
reparsedBy: "driver/findings-model.mjs validateOffFieldGround — the enum is imported from findings-model.mjs and interpolated back into the prompt, so code already holds the list it asks the model to type",
|
|
@@ -471,97 +471,97 @@ export const E3_BACKLOG = [
|
|
|
471
471
|
{
|
|
472
472
|
stage: "synthesis",
|
|
473
473
|
kind: "literal-json-skeleton",
|
|
474
|
-
where: "driver/stages.mjs:
|
|
474
|
+
where: "driver/stages.mjs:3116",
|
|
475
475
|
surface: "stage-message",
|
|
476
476
|
evidence: "- manageable …: {\"category\":\"<EXACTLY one of large-competitor / commercial-partner / troll / well-known-enforcer>\",\"reason\":\"<one-two lines…>\"}",
|
|
477
|
-
reparsedBy: "driver/findings-model.mjs:
|
|
477
|
+
reparsedBy: "driver/findings-model.mjs:855 parseFindingsJson",
|
|
478
478
|
removedByMove: "NOTHING ON THE #850 PLAN REMOVES THIS",
|
|
479
479
|
},
|
|
480
480
|
{
|
|
481
481
|
stage: "synthesis",
|
|
482
482
|
kind: "literal-json-skeleton",
|
|
483
|
-
where: "driver/stages.mjs:
|
|
483
|
+
where: "driver/stages.mjs:3144",
|
|
484
484
|
surface: "stage-message",
|
|
485
485
|
evidence: "- meters: {\"mark_similarity\":{...},\"goods_proximity\":{...},\"use\":{...},\"enforcer\":{...}} — all four present, each {\"token\",\"basis\",\"source\"}. … mark_similarity = high | medium | low. goods_proximity = high | medium | low. enforcer = high | medium | low | unknown. use = confirmed | not-confirmed | un",
|
|
486
|
-
reparsedBy: "driver/findings-model.mjs:
|
|
486
|
+
reparsedBy: "driver/findings-model.mjs:855 parseFindingsJson; driver/verify.mjs:1192 checkFindingsSibling gates meters.*.source; finding_basis_source_missing",
|
|
487
487
|
removedByMove: "NOTHING ON THE #850 PLAN REMOVES THIS",
|
|
488
488
|
},
|
|
489
489
|
{
|
|
490
490
|
stage: "synthesis",
|
|
491
491
|
kind: "literal-json-skeleton",
|
|
492
|
-
where: "driver/stages.mjs:
|
|
492
|
+
where: "driver/stages.mjs:3144",
|
|
493
493
|
surface: "stage-message",
|
|
494
494
|
evidence: "- quadrant: {\"x\",\"y\"} numbers in [0,1]. x = goods/services proximity (0 = distant, 1 = identical). y = mark similarity (0 = distinct, 1 = identical).",
|
|
495
|
-
reparsedBy: "driver/findings-model.mjs:
|
|
495
|
+
reparsedBy: "driver/findings-model.mjs:855 parseFindingsJson",
|
|
496
496
|
removedByMove: "NOTHING ON THE #850 PLAN REMOVES THIS",
|
|
497
497
|
},
|
|
498
498
|
{
|
|
499
499
|
stage: "synthesis",
|
|
500
500
|
kind: "literal-json-skeleton",
|
|
501
|
-
where: "driver/stages.mjs:
|
|
501
|
+
where: "driver/stages.mjs:3134",
|
|
502
502
|
surface: "stage-message",
|
|
503
503
|
evidence: "- source: {\"source_type\",\"resolved_link\"}. source_type EXACTLY one of: register-vendor / register-euipo / common-law-marketplace / common-law-web / case-law",
|
|
504
|
-
reparsedBy: "driver/findings-model.mjs:
|
|
504
|
+
reparsedBy: "driver/findings-model.mjs:855 parseFindingsJson",
|
|
505
505
|
removedByMove: "M1 removes the opaque `resolved_link` URI (ordinal / record-handle selection); the object shape and the source_type enum survive",
|
|
506
506
|
},
|
|
507
507
|
{
|
|
508
508
|
stage: "synthesis",
|
|
509
509
|
kind: "exactly-these-keys",
|
|
510
|
-
where: "driver/stages.mjs:
|
|
510
|
+
where: "driver/stages.mjs:3135",
|
|
511
511
|
surface: "stage-message",
|
|
512
512
|
evidence: "coverage[]: ONE object per coverage AREA, EXACTLY {\"area\",\"state\",\"note\"}. … state EXACTLY one of: confirmed-clean / coverage-limited / open / not-searched / note.",
|
|
513
|
-
reparsedBy: "driver/findings-model.mjs:
|
|
513
|
+
reparsedBy: "driver/findings-model.mjs:855 parseFindingsJson; the render owns the coverage panel from these typed states",
|
|
514
514
|
removedByMove: "NOTHING ON THE #850 PLAN REMOVES THIS",
|
|
515
515
|
},
|
|
516
516
|
{
|
|
517
517
|
stage: "synthesis",
|
|
518
518
|
kind: "literal-json-skeleton",
|
|
519
|
-
where: "driver/stages.mjs:
|
|
519
|
+
where: "driver/stages.mjs:3144",
|
|
520
520
|
surface: "stage-message",
|
|
521
521
|
evidence: "use_check = {\"source\",\"quality\",\"question\"}: … quality: OPTIONAL, EXACTLY one of owner-site / independent / register-mirror … own_rights = {\"source\"}",
|
|
522
|
-
reparsedBy: "driver/verify.mjs checkFindingsSibling (finding_use_check_missing)
|
|
522
|
+
reparsedBy: "driver/verify.mjs checkFindingsSibling (finding_use_check_missing, finding_own_rights_source_missing)",
|
|
523
523
|
removedByMove: "NOTHING ON THE #850 PLAN REMOVES THIS",
|
|
524
524
|
},
|
|
525
525
|
{
|
|
526
526
|
stage: "synthesis",
|
|
527
527
|
kind: "literal-json-skeleton",
|
|
528
|
-
where: "driver/stages.mjs:
|
|
528
|
+
where: "driver/stages.mjs:3201",
|
|
529
529
|
surface: "stage-message",
|
|
530
530
|
evidence: "MARK ASSESSMENT … STRUCTURED FORM …: either field may instead be an OBJECT {\"read\":\"…\",\"spectrum\":\"…\",\"per_class\":[{\"class\":\"5\",\"note\":\"…\"}],\"per_market\":[{\"market\":\"CN\",\"note\":\"…\"}],\"counter_registrations\":[{\"mark\":\"…\",\"uri\":\"/mark/…\",\"note\":\"…\"}],\"acquired\":\"<optional>\",\"note\":\"<optional residual>",
|
|
531
|
-
reparsedBy: "driver/findings-model.mjs:
|
|
531
|
+
reparsedBy: "driver/findings-model.mjs:855 parseFindingsJson; the report collapses the rows behind toggles and the audit workbook renders them",
|
|
532
532
|
removedByMove: "NOTHING ON THE #850 PLAN REMOVES THIS",
|
|
533
533
|
},
|
|
534
534
|
{
|
|
535
535
|
stage: "synthesis",
|
|
536
536
|
kind: "literal-json-skeleton",
|
|
537
|
-
where: "driver/stages.mjs:
|
|
537
|
+
where: "driver/stages.mjs:3207",
|
|
538
538
|
surface: "stage-message",
|
|
539
539
|
evidence: "FOUR ANSWERS …: \"four_answers\": {\"third_party_rights\":{...},\"objection_likelihood\":{...},\"registrability\":{...},\"client_enforceability\":{...}} … Each answer … is {\"read\":\"…\",\"token\":\"…\",\"basis\":\"…\",\"ordinals\":[…]}. Tokens (closed enums …): third_party_rights = strong|moderate|weak; objection_likelih",
|
|
540
|
-
reparsedBy: "driver/findings-model.mjs:
|
|
540
|
+
reparsedBy: "driver/findings-model.mjs:855 parseFindingsJson",
|
|
541
541
|
removedByMove: "NOTHING ON THE #850 PLAN REMOVES THIS",
|
|
542
542
|
},
|
|
543
543
|
{
|
|
544
544
|
stage: "synthesis",
|
|
545
545
|
kind: "literal-json-skeleton",
|
|
546
|
-
where: "driver/stages.mjs:
|
|
546
|
+
where: "driver/stages.mjs:3201",
|
|
547
547
|
surface: "stage-message",
|
|
548
548
|
evidence: "ACTIONS REGISTER …: emit \"actions\": [...] — ONE object per forward step …, each EXACTLY {\"id\",\"kind\",\"text\",\"ordinals\"} plus an OPTIONAL \"deadline\" and an OPTIONAL \"condition\". … kind: EXACTLY one of — consent / coexistence-agreement / territorial-delimitation / goods-amendment / mark-modification /",
|
|
549
|
-
reparsedBy: "driver/findings-model.mjs:
|
|
549
|
+
reparsedBy: "driver/findings-model.mjs:855 parseFindingsJson; pipeline applyCoverageFloor legalActions arm derives the delivered disposition from the closed kind enum",
|
|
550
550
|
removedByMove: "NOTHING ON THE #850 PLAN REMOVES THIS",
|
|
551
551
|
},
|
|
552
552
|
{
|
|
553
553
|
stage: "synthesis",
|
|
554
554
|
kind: "exactly-these-keys",
|
|
555
|
-
where: "driver/stages.mjs:
|
|
555
|
+
where: "driver/stages.mjs:3214",
|
|
556
556
|
surface: "stage-message",
|
|
557
557
|
evidence: "COVERAGE JUDGMENT …: emit \"coverage_judgment\": {\"sufficient\":<bool>, \"reason\":\"<one line…>\"} — EXACTLY those two keys. Do NOT emit \"rows\": the driver writes that register itself … anything you type there is replaced wholesale.",
|
|
558
|
-
reparsedBy: "driver/findings-model.mjs:
|
|
558
|
+
reparsedBy: "driver/findings-model.mjs:855 parseFindingsJson. The \"Do NOT emit rows\" clause is the purest E3 case in the tree — the prompt names a field, dictates its shape and states in the same breath that code overwrites it",
|
|
559
559
|
removedByMove: "NOTHING ON THE #850 PLAN REMOVES THIS",
|
|
560
560
|
},
|
|
561
561
|
{
|
|
562
562
|
stage: "synthesis",
|
|
563
563
|
kind: "literal-json-skeleton",
|
|
564
|
-
where: "driver/stages.mjs:
|
|
564
|
+
where: "driver/stages.mjs:3060",
|
|
565
565
|
surface: "stage-message",
|
|
566
566
|
// RE-QUOTED, NOT PARKED. The writer's conversion reworded this dictation — the
|
|
567
567
|
// ask answers ride the findings RECORD now and the driver renders the labelled line into both the
|
|
@@ -570,7 +570,7 @@ export const E3_BACKLOG = [
|
|
|
570
570
|
// in E3_EVIDENCE_UNRESOLVED instead would have grown the not-checked slice for a row that is
|
|
571
571
|
// perfectly checkable, which is the avoidable coverage loss conversion 9's note names one row up.
|
|
572
572
|
evidence: "SEND ONE \"ask_answers\" ENTRY PER ASK, as a TOP-LEVEL field of the findings record you hand to the call (never as a narrative section — the driver renders the labelled line",
|
|
573
|
-
reparsedBy: "driver/findings-model.mjs:
|
|
573
|
+
reparsedBy: "driver/findings-model.mjs:855 parseFindingsJson (finding_ask_answer_answer_missing); assembleReportMd · buildAskAnswersSection joins on the retyped ask string",
|
|
574
574
|
removedByMove: "NOTHING ON THE #850 PLAN REMOVES THIS",
|
|
575
575
|
},
|
|
576
576
|
// DELETED at conversion 10, recorded rather than absorbed — E3's own rule for a
|
|
@@ -585,25 +585,25 @@ export const E3_BACKLOG = [
|
|
|
585
585
|
{
|
|
586
586
|
stage: "synthesis",
|
|
587
587
|
kind: "exactly-these-keys",
|
|
588
|
-
where: "driver/stages.mjs:
|
|
588
|
+
where: "driver/stages.mjs:3193",
|
|
589
589
|
surface: "stage-message",
|
|
590
590
|
evidence: "add it to the top-level \"context_notes\" array — each object EXACTLY {\"type\":\"famous-neighbour-ungrounded\",\"mark\",\"owner\",\"context\"}",
|
|
591
|
-
reparsedBy: "driver/findings-model.mjs:
|
|
591
|
+
reparsedBy: "driver/findings-model.mjs:855 parseFindingsJson",
|
|
592
592
|
removedByMove: "NOTHING ON THE #850 PLAN REMOVES THIS",
|
|
593
593
|
},
|
|
594
594
|
{
|
|
595
595
|
stage: "synthesis",
|
|
596
596
|
kind: "literal-json-skeleton",
|
|
597
|
-
where: "driver/stages.mjs:
|
|
597
|
+
where: "driver/stages.mjs:3084",
|
|
598
598
|
surface: "stage-message",
|
|
599
599
|
evidence: "- owner: {\"name\",\"country\",\"registrations\":[...]}. … Each registration: {\"uri\", optionally \"classes\":[\"9\",\"41\"],\"status\",\"filed\",\"expiry\",\"jurisdiction\"}. The \"uri\" is the ONLY field that matters: the driver BINDS classes/status/filed/expiry/jurisdiction AND the owner name from the FETCHED record ke",
|
|
600
|
-
reparsedBy: "driver/findings-model.mjs:
|
|
600
|
+
reparsedBy: "driver/findings-model.mjs:855 parseFindingsJson + the record-binding join. Six of the seven keys are stated in the prompt and overwritten by code in the same sentence",
|
|
601
601
|
removedByMove: "M1 removes the opaque `uri` (ordinal / record-handle selection against the band); the object skeleton and the five overwritten keys survive",
|
|
602
602
|
},
|
|
603
603
|
{
|
|
604
604
|
stage: "case-law",
|
|
605
605
|
kind: "literal-json-skeleton",
|
|
606
|
-
where: "driver/stages.mjs:
|
|
606
|
+
where: "driver/stages.mjs:3371",
|
|
607
607
|
surface: "stage-message",
|
|
608
608
|
evidence: "ALSO write the RETRIEVAL RECORD to <path> — a JSON OBJECT with EXACTLY these keys: {\"schema_version\":2,\"queries\":[{\"query\":\"<the search you dispatched, verbatim>\",\"jurisdiction\":\"…\",\"results\":<how many hits it returned, or null when the query never reached a source — never 0 for a query you could not send>}, …],\"citations\":[{\"proceeding\":\"…\",\"forum\":\"…\",\"jurisdiction\":\"…\",\"decided\":\"…\"",
|
|
609
609
|
reparsedBy: "driver/verify.mjs validators.caseLaw — the ledger arm, armed by the stage-contract marker `citations` (the case-law stage's `contract: { citations: 1 }` in stages.mjs)",
|
|
@@ -612,10 +612,10 @@ export const E3_BACKLOG = [
|
|
|
612
612
|
{
|
|
613
613
|
stage: "case-law",
|
|
614
614
|
kind: "dictated-line-shape",
|
|
615
|
-
where: "driver/stages.mjs:
|
|
615
|
+
where: "driver/stages.mjs:3379",
|
|
616
616
|
surface: "stage-message",
|
|
617
617
|
evidence: "EVERY \"Grounded profile\" section MUST start its body with the line \"- ord: <N>\" naming which finding it grounds (use the ordinal from this list; a profile that grounds no listed finding omits the line)",
|
|
618
|
-
reparsedBy: "driver/publish/parse.mjs:339, parseCaseLawProfiles() in parse.mjs (\"the optional '- ord: <N>' first body line … gives an EXACT join\"); driver/findings-model.mjs:
|
|
618
|
+
reparsedBy: "driver/publish/parse.mjs:339, parseCaseLawProfiles() in parse.mjs (\"the optional '- ord: <N>' first body line … gives an EXACT join\"); driver/findings-model.mjs:280 /^-\\s*ord:\\s*(\\d+)\\s*$/m; driver/publish/index.mjs publishReport (joinCaseLawProfiles)",
|
|
619
619
|
removedByMove: "NOTHING ON THE #850 PLAN REMOVES THIS",
|
|
620
620
|
},
|
|
621
621
|
{
|
|
@@ -646,7 +646,7 @@ export const E3_BACKLOG = [
|
|
|
646
646
|
{
|
|
647
647
|
stage: "narrative-refutation",
|
|
648
648
|
kind: "dictated-line-shape",
|
|
649
|
-
where: "driver/stages.mjs:
|
|
649
|
+
where: "driver/stages.mjs:4720",
|
|
650
650
|
surface: "stage-message",
|
|
651
651
|
// RE-QUOTED BY CONVERSION 9. The LINE-TOKEN half is gone — no "anywhere on the line", no "[kind: …]
|
|
652
652
|
// token", no "a line with no token is treated as fact", because a kind is a typed field now and an
|
|
@@ -746,7 +746,7 @@ export const E3_BACKLOG = [
|
|
|
746
746
|
{
|
|
747
747
|
stage: "report-card",
|
|
748
748
|
kind: "literal-json-skeleton",
|
|
749
|
-
where: "driver/stages.mjs:
|
|
749
|
+
where: "driver/stages.mjs:3871",
|
|
750
750
|
surface: "stage-message",
|
|
751
751
|
evidence: "The finding's OWN record — the ONLY source for this card …:\\n```json\\n<JSON.stringify(finding, null, 2)>\\n```",
|
|
752
752
|
reparsedBy: "none — this is the INPUT side, and that is why it belongs in the survey: a full JSON object rendered into the prompt is exactly the mechanism #850 proves produced R-RECEIPT (the model pattern-matches a shown shape). E3's clause 1 as written (\"a code fence or inline example showing the exact object shape the model must emit\") does not reach an injected record, so the lint needs an explicit rule for shown-but-not-owed structure",
|
|
@@ -425,7 +425,7 @@ export const TRIPWIRE_OUT_OF_SCOPE = [
|
|
|
425
425
|
},
|
|
426
426
|
{
|
|
427
427
|
prefix: "knockout_",
|
|
428
|
-
site: "driver/findings-model.mjs:
|
|
428
|
+
site: "driver/findings-model.mjs:2353 validateKnockoutFinding, for `knockout_finding_*` and `knockout_findings_*`",
|
|
429
429
|
reason: "The knockout lane's parser. knockout-frame and knockout-assess live in driver/stages-knockout.mjs, not in STAGES, so they carry no E1 declaration and are outside this partition. RECORDED AS A GAP: #850 audits both stages, and an E1 declaration for the knockout lane is not in this scaffolding.",
|
|
430
430
|
},
|
|
431
431
|
{
|
|
@@ -44,12 +44,28 @@ export const REGISTER_AXES = ["saturation-probe", "primary-sweep", "transliterat
|
|
|
44
44
|
// a structural substitution on a grammar this module owns, not a search through text. The scope tail
|
|
45
45
|
// rides verbatim, which is where a mark actually appears.
|
|
46
46
|
export const AXIS_READER_LABEL = Object.freeze({
|
|
47
|
-
"primary-sweep": "main register
|
|
47
|
+
"primary-sweep": "main register search",
|
|
48
48
|
"saturation-probe": "field-size count",
|
|
49
49
|
"transliteration-numeric": "transliterations and numeric forms",
|
|
50
50
|
"incumbent-class": "owner portfolio sweep",
|
|
51
51
|
});
|
|
52
52
|
|
|
53
|
+
// A ROW HEAD THAT IS AN ENGINE TOKEN, in the reader's words (owner, 2026-11-18). The synthesis
|
|
54
|
+
// writes an open intake question's row under the ask register's own token (`intake-ask`, ask-ledger.mjs), and the page
|
|
55
|
+
// printed it capitalised, "Intake-ask". Same one position as an axis head, read the same way: equality on the head.
|
|
56
|
+
export const ROW_HEAD_READER_LABEL = Object.freeze({
|
|
57
|
+
"intake-ask": "Question from the request",
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
/** A row's area with an engine-token head in the reader's words; any other area rides back unchanged. PURE. */
|
|
61
|
+
export function readerRowHead(area) {
|
|
62
|
+
const a = String(area ?? "");
|
|
63
|
+
const cut = a.indexOf(" / ");
|
|
64
|
+
const head = (cut < 0 ? a : a.slice(0, cut)).trim().toLowerCase();
|
|
65
|
+
const label = Object.hasOwn(ROW_HEAD_READER_LABEL, head) ? ROW_HEAD_READER_LABEL[head] : null;
|
|
66
|
+
return label ? (cut < 0 ? label : `${label}${a.slice(cut)}`) : a;
|
|
67
|
+
}
|
|
68
|
+
|
|
53
69
|
/**
|
|
54
70
|
* A coverage unit in the reader's words. `<axis> / <scope>` → `<label> / <scope>`; a bare axis → its
|
|
55
71
|
* label; anything whose head is not one of the four closed axes rides back UNCHANGED.
|
|
@@ -66,7 +82,7 @@ export function coverageUnitLabel(unit) {
|
|
|
66
82
|
const cut = u.indexOf(" / ");
|
|
67
83
|
const head = cut < 0 ? u : u.slice(0, cut);
|
|
68
84
|
const label = Object.hasOwn(AXIS_READER_LABEL, head) ? AXIS_READER_LABEL[head] : null;
|
|
69
|
-
if (!label) return u;
|
|
85
|
+
if (!label) return readerRowHead(u);
|
|
70
86
|
return cut < 0 ? label : `${label}${u.slice(cut)}`;
|
|
71
87
|
}
|
|
72
88
|
|
package/driver/deferral-row.mjs
CHANGED
|
@@ -55,7 +55,7 @@ export const plainDeferralReason = (r) => {
|
|
|
55
55
|
if (/^not-verified-closed\b/i.test(t))
|
|
56
56
|
return "nothing in the run's own record confirms it was searched, so it is left open rather than assumed done";
|
|
57
57
|
if (/^source-not-swept\b/i.test(t))
|
|
58
|
-
return "the
|
|
58
|
+
return "the source it needed was not searched, so nothing is known about it either way"; // owner, 2026-11-18
|
|
59
59
|
if (/^digest-locked-resume\b/i.test(t))
|
|
60
60
|
return "the earlier pass was still holding the record when the re-run was attempted, so it could not be completed this run";
|
|
61
61
|
if (/^resume-arm-unverifiable\b/i.test(t))
|
|
@@ -419,6 +419,7 @@ export const STORES_WITHOUT_A_PART = {
|
|
|
419
419
|
"status.json": "the pool's mark name and a machine note, neither of them a part of the report",
|
|
420
420
|
"_driver/search-policy.json": "the product's identity, which no shipped name describes",
|
|
421
421
|
"_driver/profile.json": "the pool's profile stamp, not a part of the report",
|
|
422
|
+
"_driver/scope-facts.json": "the register service's reach, which heads the register rows; without it the head keeps its earlier words",
|
|
422
423
|
};
|
|
423
424
|
|
|
424
425
|
// The record set is a folder, not a named store (publish-inputs.mjs NOT_READ_BY_NAME), and is read as one.
|
package/driver/driver.config.mjs
CHANGED
|
@@ -435,10 +435,11 @@ export const config = {
|
|
|
435
435
|
// library reached by CLI entries AND by unit-booted services, and a service read no file of its own.
|
|
436
436
|
// Null there is correct and says nothing — the wizard offer stands alone, as it did.
|
|
437
437
|
const cliEnv = envFileRead();
|
|
438
|
+
// NO DEFAULT, AND WHY. Unset is not "no pool": this used to fall back to /srv/trademark-archive, a
|
|
439
|
+
// deployed server's real client archive, so a forgotten export published into somebody else's matter.
|
|
440
|
+
// That history stays here; the reader is told what to set.
|
|
438
441
|
throw new Error(
|
|
439
|
-
|
|
440
|
-
+ "back to /srv/trademark-archive, a deployed server's real client archive, so a forgotten export "
|
|
441
|
-
+ "published into somebody else's matter. Set it to the pool this install owns, e.g. "
|
|
442
|
+
"CLEAROTRON_REPORTS_DIR is not set, and it has no default. Set it to the folder this install publishes into, e.g. "
|
|
442
443
|
+ `CLEAROTRON_REPORTS_DIR=$HOME/trademark/pool — \`${invoke("install")}\` writes one for you` // backticked: issue 1916 can return a `cd … && npx …` form, which runs into the next words unquoted
|
|
443
444
|
+ (cliEnv ? `, or set it by hand in ${cliEnv} — the file this command reads, and the wizard refuses `
|
|
444
445
|
+ `when stdin is not a terminal.` : "."),
|
|
@@ -1092,8 +1093,7 @@ export const RESEARCH_PROVIDERS = {
|
|
|
1092
1093
|
|
|
1093
1094
|
// ── jx providers (Phase 2b, Stage-1.5 lanes) — the same lazy-import + cred-guard idiom. ONE
|
|
1094
1095
|
// non-agentic schema-enforced completions call per mark×lane turns the mark into native-script
|
|
1095
|
-
// register candidates; tests inject an executor, the dev instance uses CLEAROTRON_JX_FIXTURES.
|
|
1096
|
-
// CLEAROTRON_JX_MODEL — model override (default haiku — cheap structured task)
|
|
1096
|
+
// register candidates; tests inject an executor, the dev instance uses CLEAROTRON_JX_FIXTURES. Knob:
|
|
1097
1097
|
// CLEAROTRON_JX_FIXTURES — dir of <mark-kebab>.<lane>.json canned candidate lists
|
|
1098
1098
|
// ({candidates:[{term,kind,rationale}]}) — the $0 seam
|
|
1099
1099
|
//
|
|
@@ -49,6 +49,8 @@ const FROM = {
|
|
|
49
49
|
project: "this project",
|
|
50
50
|
account: (noun) => `the account's default ${noun}`,
|
|
51
51
|
none: "not set anywhere",
|
|
52
|
+
// No class anywhere, and the request describes its goods: the search is scoped by that description.
|
|
53
|
+
goodsOnly: "none — the goods description sets the scope",
|
|
52
54
|
};
|
|
53
55
|
|
|
54
56
|
const nonEmpty = (a) => Array.isArray(a) && a.length > 0;
|
|
@@ -284,7 +286,7 @@ export function resolveEffectiveScope(job = {}, profile = null, resolved = null)
|
|
|
284
286
|
if (nonEmpty(job.classes)) { classes = job.classes; classesFrom = FROM.request; }
|
|
285
287
|
else if (nonEmpty(saved?.classes)) { classes = saved.classes; classesFrom = FROM.savedSearch; }
|
|
286
288
|
else if (nonEmpty(profile?.defaultClasses)) { classes = profile.defaultClasses; classesFrom = accountClFrom; }
|
|
287
|
-
else { classes = []; classesFrom = FROM.none; }
|
|
289
|
+
else { classes = []; classesFrom = String(job.goods ?? "").trim() ? FROM.goodsOnly : FROM.none; }
|
|
288
290
|
|
|
289
291
|
// Platforms UNION rather than replace, and they union in BOTH directions: the saved search's stores are
|
|
290
292
|
// folded in first so a per-run addition sits on top of them, and neither can remove an account's own.
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
// optimises toward sprinkling anchor tokens into boilerplate without genuine engagement. The pipeline
|
|
13
13
|
// writes the sidecar and moves on; nothing gates on it.
|
|
14
14
|
//
|
|
15
|
-
//
|
|
15
|
+
// The block-scan shape of the retired use-check and own-rights gates, now findings-record fields: PURE over the
|
|
16
16
|
// narrative text (no node imports, tests offline); empty/missing input → no receipts, never throws.
|
|
17
17
|
|
|
18
18
|
const STOP = new Set([
|
|
@@ -20,13 +20,13 @@ const STOP = new Set([
|
|
|
20
20
|
"worldwide", "global", "mark", "marks", "your", "n/a", "none", "class", "classes",
|
|
21
21
|
]);
|
|
22
22
|
|
|
23
|
-
// Composite digit from a finding block —
|
|
23
|
+
// Composite digit from a finding block — the anchor the retired use-check gate used.
|
|
24
24
|
function parseComposite(block) {
|
|
25
25
|
const m = block.match(/\bComposite\b[^\d\n]{0,14}(\d)/i);
|
|
26
26
|
return m ? Number(m[1]) : null;
|
|
27
27
|
}
|
|
28
28
|
// A block is a rated FINDING if its heading names a Finding or its body carries the BOLD Composite
|
|
29
|
-
// marker —
|
|
29
|
+
// marker — the retired use-check gate's test, so the "## Actions" / "## Bottom line" paraphrases (which mention
|
|
30
30
|
// composite in prose but not as the rated finding) never false-trigger.
|
|
31
31
|
// EXPORTED so the write-up check identifies blocks by the same predicate this file already uses.
|
|
32
32
|
// Two answers to "which blocks in narrative.md are per-finding write-ups" would drift, and the one that
|
|
@@ -21,7 +21,7 @@ import { statSync } from "node:fs";
|
|
|
21
21
|
import { tmpdir } from "node:os";
|
|
22
22
|
import { join, dirname } from "node:path";
|
|
23
23
|
import { fileURLToPath } from "node:url";
|
|
24
|
-
import { WRITE_DISCIPLINE, absolutizeSkillRefs, resolveSpawnCwd, spawnGraceMs } from "./common.mjs";
|
|
24
|
+
import { WRITE_DISCIPLINE, absolutizeSkillRefs, resolveSpawnCwd, spawnGraceMs, isRecordTool } from "./common.mjs";
|
|
25
25
|
import { resolveEngineProgram, resolveModel } from "../driver.config.mjs"; // — the one place that finds the program; it reads every spelling of the setting
|
|
26
26
|
import { authorityTrees } from "../authority-trees.mjs";
|
|
27
27
|
import { recordEngineChild, clearEngineChild } from "./child-record.mjs"; //
|
|
@@ -623,6 +623,10 @@ export const anthropicAgentEngine = {
|
|
|
623
623
|
// "omitted" on Opus 5, so an ENGAGED block streams with a zero-length `thinking` string and a real
|
|
624
624
|
// `signature` — reading the text would report "no thinking" on every production turn.
|
|
625
625
|
let thought = false;
|
|
626
|
+
// THE FIRST CALL'S CACHE SPLIT: how much of the opening prompt the provider served from its cache and how much it wrote
|
|
627
|
+
// to it, read off the first assistant message's usage. Every caching claim about a stage was rebuilt from raw streams
|
|
628
|
+
// by hand; this puts the first call's figures on the attempt. null when the stream carried no assistant message.
|
|
629
|
+
let firstCall = null;
|
|
626
630
|
// MODEL GAUGE (corruption 3): which model the PROVIDER says served this turn. Until now
|
|
627
631
|
// nothing on any record was a function of the provider's response — `modelUsed` was
|
|
628
632
|
// `resolveModel(<the alias we asked for>)`, a pure function of the request, so a substitution or a
|
|
@@ -709,6 +713,9 @@ export const anthropicAgentEngine = {
|
|
|
709
713
|
const writeAsks = new Set();
|
|
710
714
|
let toolWaitMs = 0;
|
|
711
715
|
let toolAskedAt = null;
|
|
716
|
+
// The last time this turn asked for a tool, apart from its own record write, and the last time it asked for that write:
|
|
717
|
+
// what the gateway reads to tell a turn killed while still working from one killed silent or finishing (`lastToolAsk`).
|
|
718
|
+
let lastWorkAskAt = null, lastRecordAskAt = null;
|
|
712
719
|
// WHAT THE WAIT IS MADE OF, keyed by the tool(s) that caused it.
|
|
713
720
|
//
|
|
714
721
|
// The total alone cannot answer the question it was collected for. "Exclude tool wait from the kill
|
|
@@ -868,6 +875,7 @@ export const anthropicAgentEngine = {
|
|
|
868
875
|
toolAskedNames = asked.length ? [...new Set(asked)].sort().join("+") : null;
|
|
869
876
|
if (asked.length) {
|
|
870
877
|
const now = Date.now();
|
|
878
|
+
if (asked.some((n) => !isRecordTool(n))) lastWorkAskAt = now; else lastRecordAskAt = now;
|
|
871
879
|
closePeriod(now, false); // the outstanding set is about to change
|
|
872
880
|
const rec = { names: asked.slice() };
|
|
873
881
|
openAsks.push(rec);
|
|
@@ -881,6 +889,7 @@ export const anthropicAgentEngine = {
|
|
|
881
889
|
// This block's usage, folded into its own call: the largest reading wins, so a block's early count
|
|
882
890
|
// never replaces the delta's running total, and a second block of the same call adds nothing twice.
|
|
883
891
|
foldUsage(ev.message?.id ?? openMessage ?? `__assistant_${++anonMessages}`, mapUsage(ev.message?.usage));
|
|
892
|
+
if (!firstCall && ev.message?.usage) firstCall = mapUsage(ev.message.usage);
|
|
884
893
|
progress();
|
|
885
894
|
}
|
|
886
895
|
else if (ev.type === "user") {
|
|
@@ -1192,6 +1201,8 @@ export const anthropicAgentEngine = {
|
|
|
1192
1201
|
// true = the 500-path cap dropped at least one further distinct file (so a `read:false` derived
|
|
1193
1202
|
// from this list is unreliable and the consumer must downgrade it to "not observed").
|
|
1194
1203
|
reads: [...reads], readsTruncated,
|
|
1204
|
+
// The first call's cache read and cache write, in tokens (see `firstCall`); null when it was never seen.
|
|
1205
|
+
firstCallCache: firstCall ? { read: firstCall.cacheRead, creation: firstCall.cacheWrite } : null,
|
|
1195
1206
|
toolCalls, toolWaitMs: settledToolWaitMs, // two integers, no content
|
|
1196
1207
|
// The same calls by tool name (values sum to toolCalls), and what the session went through: every
|
|
1197
1208
|
// result, cut, refusal and restart (session-record.mjs). `stream` is the raw stream's file and size,
|
|
@@ -1209,6 +1220,9 @@ export const anthropicAgentEngine = {
|
|
|
1209
1220
|
// ONLY: nothing branches on it. A recording field is protected by a test or by nothing, so
|
|
1210
1221
|
// engine.anthropic.test.mjs pins it — deleting it must red something.
|
|
1211
1222
|
firstByteMs: firstOutputAt === null ? null : Math.round(firstOutputAt - t0),
|
|
1223
|
+
// ms from spawn to the last tool ask that was not the stage's own record write, and to the last that was; null where
|
|
1224
|
+
// the turn made none. RECORDING, and read by the gateway only to choose how a hard-wall kill is retried.
|
|
1225
|
+
lastToolAsk: { workMs: lastWorkAskAt === null ? null : Math.round(lastWorkAskAt - t0), recordMs: lastRecordAskAt === null ? null : Math.round(lastRecordAskAt - t0) },
|
|
1212
1226
|
// WHICH SIDE OF THE KILL a byte or a tool ask fell on. RECORDING ONLY, like firstByteMs. The
|
|
1213
1227
|
// totals above keep counting after the decision, because what a dying child already wrote is
|
|
1214
1228
|
// still read (streamed usage depends on it). On Windows the kill blocks this process while it
|
package/driver/engine/common.mjs
CHANGED
|
@@ -85,6 +85,13 @@ export const WRITE_DISCIPLINE =
|
|
|
85
85
|
// to a layered overlay-over-base path (driver.config.resolveSkillPath); without it the legacy single-dir
|
|
86
86
|
// behaviour stands.
|
|
87
87
|
const SKILL_REF = /(?<![\w/.])skills\/[A-Za-z0-9._/-]+\.md/g;
|
|
88
|
+
/**
|
|
89
|
+
* Is this tool a stage's own record tool, the call that hands its result back? Any `record_*` tool, by its bare name or under
|
|
90
|
+
* an MCP server (`mcp__recording-<stage>__record_<stage>`). Both engines name a kill's last tool ask with it: a turn whose
|
|
91
|
+
* last asks were only its own record write was finishing, not working, when it was stopped. PURE.
|
|
92
|
+
*/
|
|
93
|
+
export const isRecordTool = (name) => /(^|__)record_/.test(String(name ?? ""));
|
|
94
|
+
|
|
88
95
|
export function absolutizeSkillRefs(message, skillsDir, resolve = null) {
|
|
89
96
|
if (!message || (!skillsDir && !resolve)) return message;
|
|
90
97
|
const base = skillsDir ? dirname(skillsDir) : null; // skillsDir ends in /skills; refs carry their own `skills/` prefix
|
|
@@ -24,6 +24,7 @@ import { answerBudget, quotedBytes } from "../../../shared/answer-parts.mjs";
|
|
|
24
24
|
import { classifyRecord, prepareTargets, SHAPE_TIERS, isLiveRecord, niceClassKey, withoutPlacementOrders } from "../../band-shape.mjs";
|
|
25
25
|
import { recordQids } from "../../named-band.mjs";
|
|
26
26
|
import { normalizeRecordUri } from "../../registry-fidelity.mjs";
|
|
27
|
+
import { recordBodyFromLog } from "../../../providers/_shared/ledger.mjs"; // the run record log's own index, which the fetches write through
|
|
27
28
|
import { bandGoodsIndex, goodsFor, goodsWordCounter, goodsWordsMatched, recordAsServed, untaggedIsEnglish, rowGoods } from "../../record-goods.mjs";
|
|
28
29
|
import { recordGoodsEvidence, heldRecordProvenance, recordFetchOutcomes, readRunCallRows, goodsFromLabel, registerPageLabel } from "../../goods-evidence.mjs";
|
|
29
30
|
import { savedStatusPages } from "../../saved-register-pages.mjs";
|
|
@@ -53,27 +54,17 @@ const recordLedgerPath = () => paths(RUN_DIR).registerRecordBodies;
|
|
|
53
54
|
/**
|
|
54
55
|
* The record body this run has already fetched, or null.
|
|
55
56
|
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
57
|
+
* Asked only on a `_records/` miss, and every record a stage reads before the end-of-run union is one.
|
|
58
|
+
* This read and parsed the whole log on each: a median 0.80 s, up to 147 s, measured on production's 0.4.x
|
|
59
|
+
* clearances, inside serial stages whose model waited for each answer. The answer now comes from the run
|
|
60
|
+
* record log's own index (`recordBodyFromLog`), which reads only what was appended since the last look.
|
|
58
61
|
*
|
|
59
62
|
* LAST WRITE WINS, matching `assembleRunRecords`: the ledger leg overrides the run-dir leg there, so a
|
|
60
63
|
* later body is the current one here too. Two readers of one ledger must not disagree about which row
|
|
61
|
-
* is authoritative.
|
|
64
|
+
* is authoritative, which is why there is one index and not a second one here.
|
|
62
65
|
*/
|
|
63
66
|
function recordFromLedger(uri) {
|
|
64
|
-
|
|
65
|
-
if (!existsSync(p)) return null;
|
|
66
|
-
const want = normalizeRecordUri(uri) || String(uri).toLowerCase();
|
|
67
|
-
let found = null;
|
|
68
|
-
try {
|
|
69
|
-
for (const line of readFileSync(p, "utf8").split("\n")) {
|
|
70
|
-
if (!line.trim()) continue;
|
|
71
|
-
let row; try { row = JSON.parse(line); } catch { continue; }
|
|
72
|
-
const t = normalizeRecordUri(row?.target) || String(row?.target ?? "").toLowerCase();
|
|
73
|
-
if (t && t === want && row?.body) found = row.body;
|
|
74
|
-
}
|
|
75
|
-
} catch { return null; }
|
|
76
|
-
return found;
|
|
67
|
+
return recordBodyFromLog(recordLedgerPath(), uri);
|
|
77
68
|
}
|
|
78
69
|
|
|
79
70
|
// ── the reading log: EVERY lookup lands here, success or failure — the audit is the point ──────────
|
|
@@ -62,6 +62,9 @@ export const TOOL_SERVER_SETTINGS = Object.freeze([
|
|
|
62
62
|
// characters: printed with its escapes and banner it stays under the general answer size below, and so under
|
|
63
63
|
// the cut. An install's own smaller size still wins.
|
|
64
64
|
export const CODEX_BAND_ANSWER_CHARS = 30000;
|
|
65
|
+
// The cut above in bytes, as the product measures it: 10,000 tokens at 4 bytes a token. The model is shown the first
|
|
66
|
+
// and last half of it. driver/manuals-seen.mjs reads a saved session's outputs through it; an estimate, not the vendor's.
|
|
67
|
+
export const CODEX_SHOWN_OUTPUT_BYTES = 10000 * 4;
|
|
65
68
|
export const codexBandAnswerChars = (env = process.env) =>
|
|
66
69
|
Math.min(CODEX_BAND_ANSWER_CHARS, Number(env.CLEAROTRON_BAND_RESPONSE_CHARS) || CODEX_BAND_ANSWER_CHARS);
|
|
67
70
|
|