clearotron 0.5.1 → 0.6.0-beta.0
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/.env.example +7 -7
- package/INSTALL.md +10 -10
- package/QUICKSTART.md +6 -6
- package/README.md +2 -2
- package/THIRD-PARTY-NOTICES.md +4 -4
- package/bin/README.md +2 -2
- package/bin/clearotron.mjs +1 -1
- package/bin/connect.mjs +1 -1
- package/bin/disconnect.mjs +1 -1
- package/bin/example.mjs +2 -2
- package/bin/grant.mjs +1 -1
- package/bin/onboard.mjs +78 -23
- package/bin/start.mjs +49 -18
- package/bin/update.mjs +13 -3
- package/build-info.json +2 -2
- package/docs/DELIVERY.md +1 -1
- package/docs/PORTAL.md +1 -1
- package/docs/RELEASES.md +1 -1
- package/docs/architecture/02-architecture.md +10 -2
- package/docs/architecture/03-run-lifecycle.md +6 -2
- package/docs/architecture/04-configuration-reference.md +3 -3
- package/docs/architecture/05-config-governance.md +5 -4
- package/docs/architecture/08-development-guide.md +4 -4
- package/docs/architecture/09-security-and-data.md +1 -1
- package/{driver/skills/clearance-search/SKILL.md → docs/architecture/retired-manuals/clearance-search-spine.md} +17 -30
- package/{driver/skills/clearance-search/templates/email/generic.md → docs/architecture/retired-manuals/email-generic.md} +1 -1
- package/{driver/skills/clearance-search → docs/architecture/retired-manuals}/template-formatting.md +3 -4
- package/docs/configuration.md +1 -1
- package/docs/decisions/0002-no-dark-functionality.md +5 -0
- package/driver/CHANGELOG.md +60 -0
- package/driver/README.md +11 -1
- package/driver/accepted-order.mjs +13 -5
- package/driver/attempt-rows.mjs +64 -0
- package/driver/attributed-span.mjs +1 -1
- package/driver/authority-trees.mjs +1 -1
- package/driver/best-draft.mjs +3 -3
- package/driver/blind-frame-record.mjs +2 -2
- package/driver/cancel.mjs +3 -2
- package/driver/carry-through.mjs +2 -2
- package/driver/citation-census.json +3 -3
- package/driver/clearance-variants-record.mjs +4 -10
- package/driver/common-law-coverage-status.mjs +3 -3
- package/driver/common-law-receipts.mjs +2 -2
- package/driver/compare.mjs +1 -1
- package/driver/config-inventory.mjs +6 -79
- package/driver/consumption-ledger.mjs +2 -1
- package/driver/contract-dictation-registry.mjs +5 -0
- package/driver/contract-e3-backlog.mjs +45 -66
- package/driver/contract-e3-baseline.json +16 -16
- package/driver/contract-vocabulary.mjs +8 -6
- package/driver/corrections-feedforward.mjs +3 -1
- package/driver/coverage-form-io.mjs +7 -8
- package/driver/coverage-tool.mjs +1 -1
- package/driver/declination-tool.mjs +2 -2
- package/driver/degraded-parts.mjs +9 -9
- package/driver/demo-container.mjs +5 -4
- package/driver/deploy-live-run-guard.mjs +19 -7
- package/driver/derived-state.mjs +2 -2
- package/driver/dev-portal.mjs +2 -1
- package/driver/dispatch-record.mjs +1 -1
- package/driver/disposition-tool.mjs +2 -1
- package/driver/doubt-closure-tool.mjs +2 -2
- package/driver/driver.config.mjs +35 -724
- package/driver/e2e-rounds.mjs +3 -4
- package/driver/engine/CONTRACT.md +3 -0
- package/driver/engine/README.md +2 -0
- package/driver/engine/anthropic-agent.mjs +8 -37
- package/driver/engine/auth.mjs +74 -0
- package/driver/engine/child-record.mjs +1 -1
- package/driver/engine/deny-authority-write.mjs +2 -2
- package/driver/engine/jx-turn.mjs +10 -2
- package/driver/engine/mcp/README.md +1 -1
- package/driver/engine/mcp/band-server.mjs +6 -6
- package/driver/engine/mcp/codex-config.mjs +1 -1
- package/driver/engine/mcp/declination-server.mjs +2 -3
- package/driver/engine/mcp/dispositions-server.mjs +3 -3
- package/driver/engine/mcp/gather-config.mjs +24 -19
- package/driver/engine/mcp/grid-provenance.mjs +1 -1
- package/driver/engine/mcp/held-answers.mjs +5 -5
- package/driver/engine/mcp/perplexity-server.mjs +16 -7
- package/driver/engine/mcp/recording-server.mjs +7 -6
- package/driver/engine/mcp/register-server.mjs +29 -0
- package/driver/engine/mcp/stdio-server.mjs +5 -5
- package/driver/engine/mcp/supplemental.mjs +9 -9
- package/driver/engine/openai-agent.mjs +5 -2
- package/driver/engine/registry.mjs +103 -0
- package/driver/engine/run-choices.mjs +162 -0
- package/driver/engine/stamps.mjs +35 -0
- package/driver/enqueue-schema.mjs +4 -4
- package/driver/envelope-settle.mjs +3 -2
- package/driver/feedback-issues.mjs +1 -1
- package/driver/feedback-mint.mjs +3 -2
- package/driver/feedback-store.mjs +3 -2
- package/driver/findings-model.mjs +1 -1
- package/driver/flag-snapshot.mjs +5 -4
- package/driver/floor-duty.mjs +3 -3
- package/driver/foreign-record-links.mjs +1 -1
- package/driver/frame-diff-record.mjs +2 -8
- package/driver/framework.mjs +1 -1
- package/driver/gate-metrics.mjs +10 -11
- package/driver/gateway.mjs +220 -839
- package/driver/goods-evidence.mjs +10 -6
- package/driver/jx-lanes.mjs +3 -3
- package/driver/jx-units.mjs +31 -37
- package/driver/jx.mjs +44 -59
- package/driver/knockout-assess-record.mjs +3 -3
- package/driver/knockout-caveats.mjs +21 -0
- package/driver/knockout-correction-record.mjs +58 -28
- package/driver/knockout-frame-record.mjs +2 -2
- package/driver/knockout-register-read.mjs +38 -21
- package/driver/knockout-register-record.mjs +5 -6
- package/driver/knockout-review-record.mjs +12 -11
- package/driver/ladder/model-gauge.mjs +88 -0
- package/driver/ladder/next-rung.mjs +296 -0
- package/driver/ladder/rescue.mjs +146 -0
- package/driver/ladder/stage-tools.mjs +57 -0
- package/driver/ladder/turn-failure.mjs +166 -0
- package/driver/log.mjs +2 -2
- package/driver/matter-frame-record.mjs +4 -4
- package/driver/methodology-witness.mjs +2 -2
- package/driver/narrative-refutation-record.mjs +145 -42
- package/driver/one-build-per-run.mjs +62 -0
- package/driver/outbox-backoff.mjs +4 -4
- package/driver/owner-screen.mjs +0 -10
- package/driver/owner-use-check.mjs +2 -28
- package/driver/package.json +1 -1
- package/driver/partial-payload-baseline.json +1 -1
- package/driver/parts-not-completed.mjs +1 -1
- package/driver/pipeline-knockout.mjs +1015 -1001
- package/driver/pipeline.mjs +511 -9265
- package/driver/placement-decisions.mjs +2 -2
- package/driver/placement-form-io.mjs +7 -9
- package/driver/placement-union.mjs +0 -6
- package/driver/plan-stability.mjs +7 -10
- package/driver/portal-acks.mjs +3 -2
- package/driver/portal-confirmation.mjs +48 -0
- package/driver/portal-families.mjs +3 -2
- package/driver/portal-local-auth.mjs +1 -2
- package/driver/portal-routes/README.md +24 -0
- package/driver/portal-routes/admin.mjs +425 -0
- package/driver/portal-routes/compose.mjs +66 -0
- package/driver/portal-routes/config.mjs +118 -0
- package/driver/portal-routes/connect.mjs +283 -0
- package/driver/portal-routes/feedback.mjs +178 -0
- package/driver/portal-routes/me.mjs +165 -0
- package/driver/portal-routes/queue.mjs +64 -0
- package/driver/portal-routes/report.mjs +106 -0
- package/driver/portal-routes/run.mjs +508 -0
- package/driver/portal-routes/runs.mjs +127 -0
- package/driver/portal-routes/usage.mjs +82 -0
- package/driver/portal-runs.mjs +588 -0
- package/driver/portal-service.mjs +78 -2592
- package/driver/portal-static.mjs +3 -1
- package/driver/predelivery-lint.mjs +92 -9
- package/driver/production-pool-guard.mjs +1 -1
- package/driver/profiles.mjs +5 -4
- package/driver/progress.mjs +29 -24
- package/driver/publish/README.md +10 -5
- package/driver/publish/archive-tags.mjs +3 -2
- package/driver/publish/demo-marking.mjs +2 -2
- package/driver/publish/index.mjs +215 -140
- package/driver/publish/knockout.mjs +153 -107
- package/driver/publish/office-record-links.mjs +22 -0
- package/driver/publish/parse.mjs +20 -5
- package/driver/publish/pool-admin.mjs +9 -3
- package/driver/publish/render.mjs +11 -3
- package/driver/publish/report-dates.mjs +3 -4
- package/driver/publish/report-registry.mjs +7 -10
- package/driver/publish/seed-pool.mjs +3 -2
- package/driver/publish/shell.mjs +106 -0
- package/driver/publish/templates/report.css +3 -1
- package/driver/queue-order.mjs +4 -3
- package/driver/record-carry.mjs +0 -9
- package/driver/record-discard.mjs +1 -4
- package/driver/record-fold.mjs +3 -3
- package/driver/record-goods.mjs +5 -5
- package/driver/reference-score.mjs +2 -3
- package/driver/register-capabilities.mjs +0 -6
- package/driver/register-count.mjs +3 -2
- package/driver/register-digest-record.mjs +7 -7
- package/driver/register-fixture-marker.mjs +3 -3
- package/driver/register-plan.mjs +2 -2
- package/driver/register-records.mjs +2 -2
- package/driver/register-taint.mjs +3 -3
- package/driver/register-unit-record.mjs +48 -9
- package/driver/register-unreachable.mjs +4 -3
- package/driver/registry-fidelity.mjs +79 -34
- package/driver/repair-composers.mjs +14 -9
- package/driver/repair-digest.mjs +4 -6
- package/driver/repair-scope.mjs +3 -3
- package/driver/repair-targets.mjs +24 -9
- package/driver/repairs.mjs +44 -58
- package/driver/replay-archive.mjs +7 -7
- package/driver/report-card-record.mjs +3 -3
- package/driver/report-overview-record.mjs +4 -4
- package/driver/research-answers.mjs +38 -6
- package/driver/research-checks.mjs +4 -4
- package/driver/result-noun-fields.mjs +28 -11
- package/driver/review-addresses.mjs +163 -0
- package/driver/rule-shape.mjs +1 -1
- package/driver/run-delivered.mjs +340 -0
- package/driver/run-economics.mjs +8 -26
- package/driver/run-failed.mjs +545 -0
- package/driver/run-integrity.mjs +1 -1
- package/driver/run-outcome.mjs +314 -0
- package/driver/run-park.mjs +23 -0
- package/driver/run-quote.mjs +32 -0
- package/driver/run-record.mjs +352 -0
- package/driver/run-requirements.mjs +22 -0
- package/driver/run-shell.mjs +55 -0
- package/driver/runner.mjs +71 -33
- package/driver/saved-register-pages.mjs +4 -4
- package/driver/score-redaction.mjs +2 -2
- package/driver/search-policy.mjs +12 -13
- package/driver/settle-stamp.mjs +4 -3
- package/driver/skeptic-record.mjs +2 -2
- package/driver/skeptic-search.mjs +1 -1
- package/driver/skills/README.md +7 -7
- package/driver/skills/blind-frame/SKILL.md +1 -2
- package/driver/skills/case-law-citation/SKILL.md +9 -37
- package/driver/skills/case-law-citation/sources/courtlistener.md +1 -3
- package/driver/skills/case-law-citation/sources/eurlex.md +8 -11
- package/driver/skills/case-law-citation/sources/legaldatahunter.md +1 -1
- package/driver/skills/clearance-common-law/SKILL.md +45 -111
- package/driver/skills/clearance-common-law/perplexity-prompts.md +7 -79
- package/driver/skills/clearance-register/SKILL.md +15 -33
- package/driver/skills/clearance-register/digest.md +31 -92
- package/driver/skills/clearance-register/providers/clarivate.md +2 -2
- package/driver/skills/clearance-register/providers/corsearch.md +5 -5
- package/driver/skills/clearance-register/providers/euipo.md +1 -2
- package/driver/skills/clearance-register/providers/free-tier.md +0 -19
- package/driver/skills/clearance-register/providers/signa.md +6 -25
- package/driver/skills/clearance-register/providers/uspto-local.md +0 -24
- package/driver/skills/clearance-register/register-recipes.md +8 -15
- package/driver/skills/clearance-register/status-rules.md +6 -24
- package/driver/skills/clearance-register/unit.md +11 -20
- package/driver/skills/clearance-search/delivery-contract.md +24 -120
- package/driver/skills/clearance-search/field-doctrine-pharma.md +1 -5
- package/driver/skills/clearance-search/firm-wide-reasoning.md +24 -43
- package/driver/skills/clearance-search/phase2-execution.md +29 -77
- package/driver/skills/clearance-search/report-prose.md +3 -4
- package/driver/skills/clearance-search/risk-framework-demo.md +1 -1
- package/driver/skills/clearance-search/risk-framework-triage.manifest.json +3 -3
- package/driver/skills/clearance-search/risk-framework-triage.md +7 -9
- package/driver/skills/clearance-search/risk-framework.manifest.json +1 -1
- package/driver/skills/clearance-search/risk-framework.md +1 -1
- package/driver/skills/clearance-search/synthesis-rules.md +30 -107
- package/driver/skills/clearance-search/worked-examples.md +5 -5
- package/driver/skills/clearance-variants/SKILL.md +46 -45
- package/driver/skills/clearance-variants/transliteration-scripts.md +4 -4
- package/driver/skills/frame-diff/SKILL.md +1 -1
- package/driver/skills/knockout-assess/SKILL.md +6 -14
- package/driver/skills/knockout-frame/SKILL.md +1 -1
- package/driver/skills/matter-frame/SKILL.md +7 -12
- package/driver/skills/matter-frame/watchlist-reference.md +1 -4
- package/driver/skills/narrative-refutation/SKILL.md +20 -30
- package/driver/skills/placement-inquiry/SKILL.md +8 -18
- package/driver/skills-store-provenance.mjs +1 -1
- package/driver/stage-context.mjs +32 -35
- package/driver/stage-freshness.mjs +127 -11
- package/driver/stages-knockout.mjs +49 -22
- package/driver/stages.mjs +88 -283
- package/driver/status-snapshot.mjs +2 -1
- package/driver/steps/correction-cycle.mjs +311 -0
- package/driver/steps/corrections.mjs +644 -0
- package/driver/steps/delivery.mjs +1287 -0
- package/driver/steps/frame-comparison.mjs +922 -0
- package/driver/steps/intake.mjs +84 -0
- package/driver/steps/open-run.mjs +419 -0
- package/driver/steps/overview-and-cards.mjs +899 -0
- package/driver/steps/placement-and-digest.mjs +23 -0
- package/driver/steps/register-sweep.mjs +1563 -0
- package/driver/steps/skeptic-and-follow-up.mjs +831 -0
- package/driver/steps/synthesis.mjs +261 -0
- package/driver/steps/verdict-gate.mjs +968 -0
- package/driver/suite-census.json +403 -91
- package/driver/surface-exit-verdict.mjs +0 -8
- package/driver/synthesis-record.mjs +72 -6
- package/driver/terminal-clamp.mjs +10 -0
- package/driver/tokens.mjs +8 -62
- package/driver/tool-calls.mjs +2 -2
- package/driver/unit-state-verdict.mjs +1 -1
- package/driver/usage-ledger.mjs +2 -1
- package/driver/verify-knockout.mjs +20 -35
- package/driver/verify.mjs +47 -36
- package/driver/web-grid.mjs +3 -4
- package/driver/whatif-memo-run.mjs +2 -2
- package/driver/whatif-queue.mjs +4 -3
- package/driver/withheld-families.mjs +14 -15
- package/driver/worker-heartbeat.mjs +3 -2
- package/driver/write-up-form.mjs +0 -3
- package/mcp-server/CHANGELOG.md +4 -0
- package/mcp-server/http-server.mjs +1 -1
- package/mcp-server/lib/brief.mjs +22 -4
- package/mcp-server/lib/events.mjs +2 -2
- package/mcp-server/lib/evidence.mjs +3 -2
- package/mcp-server/lib/findings.mjs +2 -1
- package/mcp-server/lib/knockout.mjs +9 -10
- package/mcp-server/lib/ops.mjs +9 -9
- package/mcp-server/lib/runs.mjs +9 -10
- package/mcp-server/lib/trace.mjs +1 -1
- package/mcp-server/lib/whatif.mjs +2 -3
- package/mcp-server/package.json +1 -1
- package/mcp-server/server.mjs +5 -5
- package/package.json +2 -1
- package/portal-ui/dist/assets/{index-fPqAU0sx.js → index-D5rkCjDc.js} +26 -14
- package/portal-ui/dist/index.html +1 -1
- package/portal-ui/package.json +3 -3
- package/providers/README.md +1 -1
- package/providers/_shared/answer-memory.mjs +4 -5
- package/providers/_shared/execute-plan.mjs +48 -1
- package/providers/_shared/records-from-search.mjs +46 -0
- package/providers/clarivate/README.md +2 -2
- package/providers/clarivate/src/adapter.js +147 -0
- package/providers/clarivate/src/core.js +1 -14
- package/{driver/engine/mcp/clarivate-server.mjs → providers/clarivate/src/mount.js} +5 -10
- package/providers/corsearch/README.md +3 -3
- package/providers/corsearch/src/adapter.js +80 -0
- package/providers/corsearch/src/core.js +14 -11
- package/{driver/engine/mcp/corsearch-server.mjs → providers/corsearch/src/mount.js} +5 -10
- package/providers/euipo/README.md +2 -2
- package/providers/euipo/src/adapter.js +85 -0
- package/providers/euipo/src/core.js +1 -1
- package/providers/euipo/src/euipo-client.js +1 -2
- package/{driver/engine/mcp/euipo-server.mjs → providers/euipo/src/mount.js} +5 -10
- package/providers/free-tier/README.md +2 -2
- package/providers/free-tier/src/adapter.js +127 -0
- package/{driver/engine/mcp/free-tier-server.mjs → providers/free-tier/src/mount.js} +5 -10
- package/providers/jx-subclass/coverage.mjs +1 -6
- package/providers/jx-subclass/score-truth.mjs +2 -1
- package/providers/oauth-mcp-bridge/CHANGELOG.md +4 -0
- package/providers/oauth-mcp-bridge/package.json +1 -1
- package/providers/perplexity/src/core.js +2 -2
- package/providers/signa/README.md +2 -2
- package/providers/signa/src/adapter.js +157 -0
- package/providers/signa/src/capabilities.js +0 -3
- package/providers/signa/src/core.js +2 -2
- package/{driver/engine/mcp/signa-server.mjs → providers/signa/src/mount.js} +7 -12
- package/providers/signa/src/offices.generated.js +17 -15
- package/providers/uspto-local/README.md +1 -1
- package/providers/uspto-local/bin/verify-index.mjs +1 -1
- package/providers/uspto-local/src/adapter.js +75 -0
- package/{driver/engine/mcp/uspto-local-server.mjs → providers/uspto-local/src/mount.js} +5 -10
- package/scripts/band-shape-probe.mjs +2 -2
- package/scripts/citation-line-check.mjs +7 -7
- package/scripts/compare.mjs +1 -1
- package/scripts/dead-names.mjs +2 -2
- package/scripts/e2e-first-time.mjs +19 -7
- package/scripts/e2e.mjs +13 -13
- package/scripts/engine-probe.mjs +1 -1
- package/scripts/env-audit.mjs +7 -4
- package/scripts/env-classify.mjs +5 -1
- package/scripts/feedback-mint.mjs +1 -1
- package/scripts/freeze-example-run.mjs +7 -7
- package/scripts/mint-suite-census.mjs +2 -2
- package/scripts/nightly-notice.mjs +1 -1
- package/scripts/release-cut-decision.mjs +7 -2
- package/scripts/release-note-required.mjs +26 -9
- package/scripts/release-notes-lint.mjs +3 -2
- package/scripts/release-version-pr-checks.mjs +1 -1
- package/scripts/settings-render-check.mjs +23 -3
- package/scripts/test-run.mjs +5 -5
- package/scripts/travelling-predicates.mjs +1 -1
- package/scripts/undeclared-field-census.mjs +1 -1
- package/scripts/unexecuted-asserts.mjs +1 -1
- package/scripts/verify-publishable.mjs +1 -1
- package/shared/client-door.mjs +1 -1
- package/shared/connect-clients.mjs +1 -1
- package/shared/connector-signin-probe.mjs +1 -1
- package/shared/env-aliases.mjs +1 -1
- package/shared/invocation.mjs +14 -2
- package/shared/names-in-force.mjs +2 -0
- package/shared/register-selection.mjs +2 -2
- package/shared/store-in-repo.mjs +3 -3
- package/shared/summary-blocks.mjs +0 -3
- package/shared/trigger-lane.mjs +1 -1
- package/shared/vacuous-pass.mjs +2 -2
- package/shared/verb-shim.mjs +4 -2
- package/node_modules/exceljs/README.md +0 -3023
|
@@ -48,11 +48,3 @@ export function exitFor({ failed = 0, couldNotLook = 0 } = {}) {
|
|
|
48
48
|
if (couldNotLook) return 3;
|
|
49
49
|
return 0;
|
|
50
50
|
}
|
|
51
|
-
|
|
52
|
-
/** What each code means, for a caller printing it or a reader wondering. Keyed by the code itself. */
|
|
53
|
-
export const EXIT_MEANING = Object.freeze({
|
|
54
|
-
0: "every surface was read and none disagreed",
|
|
55
|
-
1: "a surface drifted — redeploy; the report names which",
|
|
56
|
-
2: "the instance did not say where its pool or its doors are, so nothing was examined",
|
|
57
|
-
3: "nothing drifted, and a surface could not be read — nothing is known about it either way",
|
|
58
|
-
});
|
|
@@ -45,7 +45,6 @@
|
|
|
45
45
|
import { writeFileSync, appendFileSync, mkdirSync, readFileSync, existsSync, renameSync, rmSync } from "node:fs";
|
|
46
46
|
import { captureCall, stampVerdict } from "./call-capture.mjs";
|
|
47
47
|
import { join, dirname } from "node:path";
|
|
48
|
-
import { driverDir } from "../shared/driver-dir.mjs";
|
|
49
48
|
import { parseFindingsJson, COVERAGE_AREA_STATES, topKeysForVersion, validateFindingForSave, isUseCheckNoResult, findingOrdinalInvalid } from "./findings-model.mjs";
|
|
50
49
|
import { heldResearchAnswers, isResearchAnswer, questionKey, NO_SEARCH_RESULT } from "./research-answers.mjs"; // a "no result" names a question that completed
|
|
51
50
|
import { writeResearchChecks } from "./research-checks.mjs"; // the research behind the use checks, written for the review
|
|
@@ -58,7 +57,9 @@ import { findingUris } from "./record-carry.mjs"; // one derivation of "which
|
|
|
58
57
|
import { foldAfterSave } from "./record-fold.mjs"; // once the delivery seam is passed, the saved record is folded again
|
|
59
58
|
import { SAVED_FINDINGS_FILE } from "./saved-findings-block.mjs"; // the file a later attempt is handed the saved findings in
|
|
60
59
|
import { runLog } from "./log.mjs"; // what the transport read a call as goes to the run's record, never to the model's answer
|
|
60
|
+
import { pageNameLines, stepPartyNames, textNamesParty } from "./predelivery-lint.mjs"; // a step's parties, read as the reference check reads them
|
|
61
61
|
import { recordOriginsOr, blankOnRepeat, recordBlanking, FOREIGN_HOST_TOKEN } from "./foreign-record-links.mjs"; // a foreign record link: refused once, then blanked
|
|
62
|
+
import { driverDir, paths, readJson } from "./run-record.mjs";
|
|
62
63
|
export const NARRATIVE_FILE = "narrative.md";
|
|
63
64
|
export const FINDINGS_FILE = "findings.json";
|
|
64
65
|
|
|
@@ -67,7 +68,7 @@ export const NARRATIVE_SECTIONS = ["verdict", "coverage", "spine", "calibration"
|
|
|
67
68
|
|
|
68
69
|
/** Where the call's evidence lives — the driver's own record of what the seat handed it. */
|
|
69
70
|
export function synthesisCallPaths(runDir) {
|
|
70
|
-
const dir =
|
|
71
|
+
const dir = paths(runDir).synthesisCalls;
|
|
71
72
|
// TWO FILES, AND THE SPLIT IS LOAD-BEARING. `payload` is what ARRIVED, written before the decision —
|
|
72
73
|
// the forensic record, including calls that were refused. `accepted` is the last call that PASSED,
|
|
73
74
|
// and it is the merge base a repair patches onto. Reading the forensic file as the merge base would
|
|
@@ -314,7 +315,7 @@ const withoutUseCheck = (f) => { const { use_check: _taken, ...rest } = f; retur
|
|
|
314
315
|
/** What a repeat took off, kept beside the run with one run-log row. Never throws. */
|
|
315
316
|
function recordNoResultRemoval(runDir, { layer, removed, now }) {
|
|
316
317
|
try {
|
|
317
|
-
appendFileSync(
|
|
318
|
+
appendFileSync(paths(runDir).noResultRemoved, removed.map((r) => JSON.stringify({ at: now(), stage: "synthesis", layer, ...r })).join("\n") + "\n");
|
|
318
319
|
} catch { /* the file is forensics; the run-log row below is the record */ }
|
|
319
320
|
try { runLog(runDir, { event: "no-result-without-a-completed-search-removed", stage: "synthesis", layer, ordinals: removed.map((r) => r.ordinal ?? null) }); }
|
|
320
321
|
catch { /* a log that cannot be written must not stop the record it describes */ }
|
|
@@ -494,7 +495,7 @@ export function acceptSynthesis(params, { asks = [], ledger = null, manifest = n
|
|
|
494
495
|
export function lastAcceptedCall(runDir) {
|
|
495
496
|
try {
|
|
496
497
|
const { accepted } = synthesisCallPaths(String(runDir ?? ""));
|
|
497
|
-
return
|
|
498
|
+
return readJson(accepted)?.params ?? null;
|
|
498
499
|
} catch { return null; }
|
|
499
500
|
}
|
|
500
501
|
|
|
@@ -936,6 +937,64 @@ export function mergeSynthesisPatch(stored, patch, { positions = null } = {}) {
|
|
|
936
937
|
return { ok: true, merged: out, lifted: asRegisters?.lifted ?? 0 };
|
|
937
938
|
}
|
|
938
939
|
|
|
940
|
+
/**
|
|
941
|
+
* A STEP WHOSE ONLY SUPPORT WAS WITHDRAWN DOES NOT COME BACK AS A RUN-LEVEL STEP. PURE.
|
|
942
|
+
*
|
|
943
|
+
* A step whose cited findings are all withdrawn renders nowhere, and a step that cites none renders as a run-level step
|
|
944
|
+
* (findings-model.mjs deriveActionConditions). The delivery check sends a step resting on a withdrawn finding to the
|
|
945
|
+
* writer's repair, and the ruling for that repair is to cite a surviving finding where its evidence supports the step,
|
|
946
|
+
* or to correct the step, never to remove the broken link and keep the conclusion. In testing, 2026-11-17, the repair
|
|
947
|
+
* removed every citation of a step whose only support was withdrawn and kept the step, so the step reached the page as a
|
|
948
|
+
* run-level one, naming the parties of the withdrawn findings, which no card introduces.
|
|
949
|
+
*
|
|
950
|
+
* So a save that sends such a step back with no citation at all leaves it resting on the findings it cited: it stays off
|
|
951
|
+
* the page, as the withdrawn findings do, and the writer's text stays in the record. A step the save cites to a live
|
|
952
|
+
* finding, still cites to a withdrawn one, or leaves out is the writer's as sent. "Withdrawn" is read on the record the
|
|
953
|
+
* save produces, so a save that withdraws a finding and uncites its step in one call is read the same way.
|
|
954
|
+
*
|
|
955
|
+
* THE OPEN IDENTIFICATION STEP IS THE ONE EXCEPTION. A lead whose proprietor nothing the run holds identifies carries no
|
|
956
|
+
* band: it leaves as a run-level step naming the lead and what must be identified, with an open coverage row naming the
|
|
957
|
+
* lead and its source declined as `owner-unidentified`. A first draft can rate such a lead, and the correction then
|
|
958
|
+
* withdraws the rating and sends the step that cited it back as that identification step, under its own id, with no
|
|
959
|
+
* citation. Its support is then the open row, not the withdrawn rating. So a step the save uncites is the writer's as
|
|
960
|
+
* sent when a party it names is named by an open coverage row of the saved record, and no party it names is one that
|
|
961
|
+
* only a withdrawn finding carries, as owner or mark, and nothing else on the page introduces. A step that still names
|
|
962
|
+
* a withdrawn finding's party is held whole, with any identification it also carries. The names are read as the
|
|
963
|
+
* delivery check's reference check reads them (predelivery-lint.mjs).
|
|
964
|
+
*
|
|
965
|
+
* `stored` and `saved` are the findings documents before and after the save. Returns `{actions, kept}`: `kept` names
|
|
966
|
+
* each step held, as `{id, ordinals}`, and `actions` is the saved list with those steps' citations put back.
|
|
967
|
+
*/
|
|
968
|
+
export function stepsOnWithdrawnSupport(stored, saved) {
|
|
969
|
+
const actions = saved?.actions;
|
|
970
|
+
if (!Array.isArray(actions) || !Array.isArray(stored?.actions)) return { actions, kept: [] };
|
|
971
|
+
const rows = Array.isArray(saved?.findings) ? saved.findings : [];
|
|
972
|
+
const withdrawn = new Set(rows.filter((f) => f?.disposition === "withdrawn").map((f) => f.ordinal));
|
|
973
|
+
if (!withdrawn.size) return { actions, kept: [] };
|
|
974
|
+
const before = new Map(stored.actions.filter((a) => Number.isInteger(a?.id)).map((a) => [a.id, a]));
|
|
975
|
+
const parties = (list) => list.flatMap((f) => [typeof f?.owner === "string" ? f.owner : f?.owner?.name, f?.mark])
|
|
976
|
+
.filter((t) => typeof t === "string" && t.trim()).join("\n");
|
|
977
|
+
const coverage = Array.isArray(saved?.coverage) ? saved.coverage : [];
|
|
978
|
+
const openRows = coverage.filter((c) => c?.state === "open").map((c) => `${c.area ?? ""} ${c.note ?? ""}`).join("\n");
|
|
979
|
+
const introduced = [...pageNameLines({ coverage }), parties(rows.filter((f) => f?.disposition !== "withdrawn"))].join("\n");
|
|
980
|
+
const withdrawnOnly = parties(rows.filter((f) => f?.disposition === "withdrawn"));
|
|
981
|
+
const identifies = (a) => {
|
|
982
|
+
const names = stepPartyNames(a);
|
|
983
|
+
return names.some((n) => textNamesParty(openRows, n))
|
|
984
|
+
&& !names.some((n) => textNamesParty(withdrawnOnly, n) && !textNamesParty(introduced, n));
|
|
985
|
+
};
|
|
986
|
+
const kept = [];
|
|
987
|
+
const held = actions.map((a) => {
|
|
988
|
+
const cited = Array.isArray(before.get(a?.id)?.ordinals) ? before.get(a.id).ordinals : [];
|
|
989
|
+
if (!cited.length || !cited.every((n) => withdrawn.has(n))) return a;
|
|
990
|
+
if (!Array.isArray(a?.ordinals) || a.ordinals.length) return a;
|
|
991
|
+
if (identifies(a)) return a;
|
|
992
|
+
kept.push({ id: a.id, ordinals: [...cited] });
|
|
993
|
+
return { ...a, ordinals: [...cited] };
|
|
994
|
+
});
|
|
995
|
+
return { actions: kept.length ? held : actions, kept };
|
|
996
|
+
}
|
|
997
|
+
|
|
939
998
|
/**
|
|
940
999
|
* The DRIVER's reads, gathered in one place: what this run committed at intake, what its plan actually
|
|
941
1000
|
* executed, and the framework it froze.
|
|
@@ -960,14 +1019,14 @@ function frozenMethodFor(dir0, manifest) {
|
|
|
960
1019
|
export function driverReadsFor(runDir) {
|
|
961
1020
|
const dir0 = String(runDir ?? "");
|
|
962
1021
|
const read = (name) => {
|
|
963
|
-
try { return
|
|
1022
|
+
try { return readJson(driverDir(dir0, name)); }
|
|
964
1023
|
catch { return null; }
|
|
965
1024
|
};
|
|
966
1025
|
// The digest's coverage ledger sits in the RUN ROOT, not under `_driver/` — it is the WS-A machine
|
|
967
1026
|
// contract the digest publishes, and the writer is one of its readers.
|
|
968
1027
|
const readLedger = (d) => {
|
|
969
1028
|
try {
|
|
970
|
-
const doc =
|
|
1029
|
+
const doc = readJson(join(d, "register-coverage-ledger.json"));
|
|
971
1030
|
return Array.isArray(doc) ? doc : (Array.isArray(doc?.rows) ? doc.rows : null);
|
|
972
1031
|
} catch { return null; }
|
|
973
1032
|
};
|
|
@@ -1146,6 +1205,9 @@ export function recordSynthesis(runDir, received, opts = {}) {
|
|
|
1146
1205
|
}
|
|
1147
1206
|
call = merged.merged;
|
|
1148
1207
|
}
|
|
1208
|
+
// A STEP WHOSE ONLY SUPPORT WAS WITHDRAWN keeps its citations when the save sends it back with none (`stepsOnWithdrawnSupport`).
|
|
1209
|
+
const held = stored ? stepsOnWithdrawnSupport(stored.findings, call?.findings) : { kept: [] };
|
|
1210
|
+
if (held.kept.length) call = { ...call, findings: { ...call.findings, actions: held.actions } };
|
|
1149
1211
|
|
|
1150
1212
|
// A RECORD LINK ON A HOST THIS REGISTER DOES NOT PUBLISH is gated here as verify.mjs gates the saved
|
|
1151
1213
|
// file. The run's first such call is refused, naming every finding, so the seat can fix them in this
|
|
@@ -1210,6 +1272,10 @@ export function recordSynthesis(runDir, received, opts = {}) {
|
|
|
1210
1272
|
// The review is handed the research behind the use checks of the record that now stands (research-checks.mjs).
|
|
1211
1273
|
writeResearchChecks(dir0, { findingsAt, held: heldAnswers, sessionKey });
|
|
1212
1274
|
recordReading(true);
|
|
1275
|
+
if (held.kept.length) {
|
|
1276
|
+
try { runLog(dir0, { event: "step-kept-on-withdrawn-support", stage: "synthesis", seq: cap.seq ?? null, kept: held.kept }); }
|
|
1277
|
+
catch { /* the record stands without its log row */ }
|
|
1278
|
+
}
|
|
1213
1279
|
// The parts this record took are consumed; a part saved after it waits for the next completing call.
|
|
1214
1280
|
if (savedBefore.length) {
|
|
1215
1281
|
try { appendFileSync(savedFindingsPath(dir0), JSON.stringify({ at: now(), consumed: true, findings: savedBefore.length }) + "\n"); }
|
|
@@ -51,6 +51,16 @@ export function verdictWithoutTheClosedGap({ verdict, assessed, reasons = [] } =
|
|
|
51
51
|
return verdict === "CONDITIONAL" && assessed === "CLEAR" && !reasons.length ? "CLEAR" : verdict;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
/**
|
|
55
|
+
* THE RESULT WHEN A REVIEW ASKED AGAIN RETURNS CLEAR OVER A CONDITION STILL STANDING. A guard that met a BLOCKING moved
|
|
56
|
+
* nothing, since BLOCKING is already the most cautious result, but its condition stands. A CLEAR with any condition left
|
|
57
|
+
* is CONDITIONAL on it, which is the recomputation a closed gap gets, from the assessment and the conditions that still
|
|
58
|
+
* stand, and the assessment stays CLEAR so a gap later closed can give that result back. PURE.
|
|
59
|
+
*/
|
|
60
|
+
export function verdictWithConditionsStanding({ verdict, reasons = [] } = {}) {
|
|
61
|
+
return verdict === "CLEAR" && reasons.length ? "CONDITIONAL" : verdict;
|
|
62
|
+
}
|
|
63
|
+
|
|
54
64
|
/**
|
|
55
65
|
* THE RESULT ONCE A CORRECTION WITHDRAWS EVERY FORWARD LEGAL STEP THAT ALONE MADE IT CONDITIONAL (the owner's decision,
|
|
56
66
|
* 2026-11-04). The review said CLEAR and the floor raised it to CONDITIONAL on the record's steps (`raisedBySteps`). The
|
package/driver/tokens.mjs
CHANGED
|
@@ -46,74 +46,20 @@
|
|
|
46
46
|
|
|
47
47
|
import { readdirSync, readFileSync } from "node:fs";
|
|
48
48
|
import { join } from "node:path";
|
|
49
|
-
import { driverDir, labelOfDriverFile } from "
|
|
49
|
+
import { driverDir, labelOfDriverFile } from "./run-record.mjs"; //
|
|
50
50
|
import { resolveModel, modelFamily } from "./driver.config.mjs";
|
|
51
51
|
import { runLog, note } from "./log.mjs";
|
|
52
52
|
import { writeRunStatus } from "./progress.mjs";
|
|
53
|
-
import { stampRunEconomics, isCodeSide
|
|
53
|
+
import { stampRunEconomics, isCodeSide } from "./run-economics.mjs";
|
|
54
|
+
import { engineStamp, vendorOf } from "./engine/stamps.mjs";
|
|
55
|
+
import { isAttemptRow, modelKey } from "./attempt-rows.mjs";
|
|
56
|
+
|
|
57
|
+
export { isAttemptRow, modelKey };
|
|
54
58
|
|
|
55
59
|
function emptyAcc() {
|
|
56
60
|
return { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, attempts: 0, thoughtTurns: 0 };
|
|
57
61
|
}
|
|
58
62
|
|
|
59
|
-
/**
|
|
60
|
-
* WHICH MODEL ACTUALLY SERVED THE TURN — the key `byModel` buckets under.
|
|
61
|
-
*
|
|
62
|
-
* `rec.model` is the TIER the stage asked for ("opus", "haiku"), and `resolveModel` is the ANTHROPIC
|
|
63
|
-
* catalog. Resolving one through the other is right for an Anthropic turn and wrong for every other
|
|
64
|
-
* engine: a codex run rolled up as `anthropic/claude-opus-5` while its own `byEngine` said
|
|
65
|
-
* `openai-agent` and its attempt rows said `gpt-5.6-sol`. The two halves of the same rollup contradicted
|
|
66
|
-
* each other, and the wrong half is the one the consumption ledger carries.
|
|
67
|
-
*
|
|
68
|
-
* The engine already answers this. gateway.mjs resolves the tier through the engine that served the
|
|
69
|
-
* turn (`engine.resolveModelId ?? resolveModel`) and stamps the answer on the row as `modelUsed`. So
|
|
70
|
-
* this reads the stamp rather than re-deriving it — one resolution, at the point that knows.
|
|
71
|
-
*/
|
|
72
|
-
export function modelKey(rec) {
|
|
73
|
-
if (typeof rec.modelUsed === "string" && rec.modelUsed) return rec.modelUsed;
|
|
74
|
-
|
|
75
|
-
// NO STAMP. Two different situations, and guessing the same way for both is what caused the bug.
|
|
76
|
-
const engine = typeof rec.engine === "string" ? rec.engine : "";
|
|
77
|
-
|
|
78
|
-
// A TURN THAT NAMED NO MODEL, a native-language row recording `modelActual: null` (see isAttemptRow),
|
|
79
|
-
// has no id at all. Its tokens still account, under a key that says the model is missing rather than
|
|
80
|
-
// one built from the absent field. Asked FIRST, so no row keys as `undefined` because the catalog was
|
|
81
|
-
// handed nothing to resolve.
|
|
82
|
-
if (typeof rec.model !== "string") return `${engine || "unknown"}/no-model-reported`;
|
|
83
|
-
|
|
84
|
-
// Rows predating the stamp are Anthropic — that was the only engine when they were written — and
|
|
85
|
-
// resolving keeps every historical rollup keyed exactly as it was.
|
|
86
|
-
//
|
|
87
|
-
// A NATIVE-LANGUAGE ROW IS STAMPED WITH ITS VENDOR, NOT AN ENGINE (jxBillingStamp in jx-lanes.mjs), and
|
|
88
|
-
// its `model` is the id that served the turn. An Anthropic one is normalised through the catalog like
|
|
89
|
-
// any served Claude id, so it keys as `anthropic/claude-haiku-4-5`, apart from a stage's
|
|
90
|
-
// `anthropic/claude-haiku` — the split ruled on and accepted with recording the tier. It used to fall
|
|
91
|
-
// to the branch below and key as `anthropic/unstamped:<id>`, a name for a missing stamp on a row that
|
|
92
|
-
// carries one. An OpenAI one keys as its served id, which is what an openai-agent stage row carries.
|
|
93
|
-
if (!engine || engine === "anthropic-agent" || engine === "anthropic") return resolveModel(rec.model);
|
|
94
|
-
if (engine === "openai") return rec.model;
|
|
95
|
-
|
|
96
|
-
// Any OTHER engine with no stamp. The tier is not a model id and this catalog is not that engine's,
|
|
97
|
-
// so there is no honest id to key under. Name the gap instead: the tokens still account (dropping
|
|
98
|
-
// them would break byModel summing to total, and an invisible gap is the failure this file already
|
|
99
|
-
// fixed once for byEngine), and the key says what is missing rather than asserting an Anthropic
|
|
100
|
-
// model produced them.
|
|
101
|
-
return `${engine}/unstamped:${rec.model}`;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* WHETHER A ROW IS A PROVIDER ATTEMPT, the one test rollupTokens and servedModels both apply. A row that
|
|
106
|
-
* names a model is one: every stage attempt row carries the tier it asked for, and a native-language row
|
|
107
|
-
* the id its turn reported. So is a native-language row whose turn ran and named no model, which records
|
|
108
|
-
* `modelActual: null` instead (jxModelFields in jx-lanes.mjs). Without that second half, such a turn's
|
|
109
|
-
* attempt and the tokens it reported were dropped from every total, and a run made only of such turns
|
|
110
|
-
* read as one where nothing was looked at. A row with neither field is not a turn: the run log's events,
|
|
111
|
-
* a tool call, a native-language call no provider served.
|
|
112
|
-
*/
|
|
113
|
-
export function isAttemptRow(rec) {
|
|
114
|
-
return Boolean(rec) && (typeof rec.model === "string" || rec.modelActual === null);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
63
|
// usage shape (gateway.mjs): {input,output,cacheRead,cacheWrite}. There is deliberately NO reasoning-token
|
|
118
64
|
// field: the old `reasoning`/`reasoningTokens` pair was an unfillable slot — no reasoning count exists
|
|
119
65
|
// anywhere in the claude payload (not result.usage, not usage.iterations), so no shipped adapter ever
|
|
@@ -312,7 +258,7 @@ function claudeModelId(id) {
|
|
|
312
258
|
* it asked for instead, which is what the company deployed under that name.
|
|
313
259
|
*
|
|
314
260
|
* WHOSE TURN IT WAS IS THE VENDOR'S QUESTION, answered by the one closed table of engines (vendorOf in
|
|
315
|
-
*
|
|
261
|
+
* engine/stamps.mjs), not by a list kept here. An OpenAI turn's id is listed as reported: a Codex id is the
|
|
316
262
|
* model's own name. An Anthropic turn under any engine name is mapped as above; a second list of Claude
|
|
317
263
|
* engines here printed a deployment name, as reported, for every engine it left out. An engine the table
|
|
318
264
|
* does not name is left off: printing its id would make a vendor claim nobody can check.
|
|
@@ -338,7 +284,7 @@ function servedName(rec, id) {
|
|
|
338
284
|
// names first. modelFamily reads opus, sonnet and haiku, and requestedTier adds fable, for the report
|
|
339
285
|
// alone. A tier neither can place returns null and the id is left off: listing nothing is honest, and
|
|
340
286
|
// listing the name is the leak this prevents.
|
|
341
|
-
const asked = engine
|
|
287
|
+
const asked = engineStamp(engine).nativeLanguage ? JX_TIER : rec.model;
|
|
342
288
|
const tier = requestedTier(claudeModelId(asked) ?? asked);
|
|
343
289
|
return CLAUDE_TIERS.has(tier) ? tier[0].toUpperCase() + tier.slice(1) : null;
|
|
344
290
|
}
|
package/driver/tool-calls.mjs
CHANGED
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
|
|
33
33
|
import { readFileSync, existsSync } from "node:fs";
|
|
34
34
|
|
|
35
|
-
import {
|
|
35
|
+
import { paths } from "./run-record.mjs";
|
|
36
36
|
|
|
37
37
|
/** Where the MCP servers write it. One per run, beside the other _driver artifacts. */
|
|
38
|
-
export const toolCallsPath = (runDir) =>
|
|
38
|
+
export const toolCallsPath = (runDir) => paths(String(runDir ?? "")).toolCalls;
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* Every call that STARTED and never SETTLED, newest first.
|
|
@@ -116,7 +116,7 @@ export function unitsActiveVerdict({ units, probe }) {
|
|
|
116
116
|
// red on a deploy gate; it must also never pass silently. It is named, as itself, as a warn.
|
|
117
117
|
if (by.unrecognised.length)
|
|
118
118
|
return { state: "warn", message: `${by.unrecognised.map(label).join(", ")} — this check does not recognise that ActiveState. `
|
|
119
|
-
+ `It is NOT being called a fault
|
|
119
|
+
+ `It is NOT being called a fault and it is NOT being called healthy either: `
|
|
120
120
|
+ `the vocabulary here is systemd 255's six documented states, and this box reports one that is not among them` };
|
|
121
121
|
|
|
122
122
|
// A unit that reported no ActiveState at all did not answer. The bus WAS reachable (probe.ok above),
|
package/driver/usage-ledger.mjs
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
import { readFileSync, readdirSync } from "node:fs";
|
|
22
22
|
import { join, dirname } from "node:path";
|
|
23
23
|
import { isLiveQueueMarker } from "./queue-markers.mjs"; // the wall's live-state vocabulary, not a fourth copy
|
|
24
|
+
import { readJson } from "./run-record.mjs";
|
|
24
25
|
|
|
25
26
|
// The daily allowance a brand owner gets when its profile names no runCaps. THE ONE DECLARATION, here in
|
|
26
27
|
// the leaf because a request path must not pull the runner (and its queue/dispatch machinery) in;
|
|
@@ -134,7 +135,7 @@ export function accountUsage({ queueDirs, account, organisation = null, now = Da
|
|
|
134
135
|
// which the old inline regex here missed (isLiveQueueMarker is the one definition;).
|
|
135
136
|
try {
|
|
136
137
|
for (const f of readdirSync(qdir).filter(isLiveQueueMarker)) {
|
|
137
|
-
try { const j =
|
|
138
|
+
try { const j = readJson(join(qdir, f)); if (inLane(j.profileKey, j.tenant)) queued++; }
|
|
138
139
|
catch { /* mid-rename — skip */ }
|
|
139
140
|
}
|
|
140
141
|
} catch { /* no queue dir */ }
|
|
@@ -10,8 +10,7 @@
|
|
|
10
10
|
// failure mode this lane's gates exist to refuse.
|
|
11
11
|
import { readFileSync, readdirSync, existsSync } from "node:fs";
|
|
12
12
|
import { join, dirname, basename } from "node:path";
|
|
13
|
-
import {
|
|
14
|
-
import { kebab, kebabCollisions, CAPABILITY_SKIPPED_NOTE } from "./search-policy.mjs";
|
|
13
|
+
import { kebab, kebabCollisions } from "./search-policy.mjs";
|
|
15
14
|
import { validateKnockoutFindings } from "./findings-model.mjs";
|
|
16
15
|
import { checkRatingInputs, readFrozenMethod, FROZEN_METHOD_FILE } from "./framework-method.mjs";
|
|
17
16
|
import { normalizeBand } from "./framework.mjs";
|
|
@@ -25,6 +24,8 @@ import { runLog } from "./log.mjs"; // — the empty-ladder observable; valida
|
|
|
25
24
|
// the delivery surfaces as flags; nothing about the gate below moved, and this file is the only place on
|
|
26
25
|
// this lane where a check can stop a delivery.
|
|
27
26
|
import { permissionProseChecks } from "./predelivery-lint.mjs";
|
|
27
|
+
import { SURVIVOR_BOUNDARY_RE, isEngineAppendedCaveat } from "./knockout-caveats.mjs";
|
|
28
|
+
import { DRIVER_DIR, driverDir, paths, readJson, readJsonOrNull } from "./run-record.mjs";
|
|
28
29
|
|
|
29
30
|
const norm = (s) => String(s ?? "").trim();
|
|
30
31
|
const nameKey = (s) => norm(s).toLowerCase().replace(/\s+/g, " ");
|
|
@@ -106,11 +107,11 @@ const OWNER_PAYLOAD = /^owner-.+-[0-9a-f]{10}\.md$/; // the name `ownerPayload
|
|
|
106
107
|
export function urlHeldFor(runDir) {
|
|
107
108
|
let filings = null;
|
|
108
109
|
try {
|
|
109
|
-
const doc =
|
|
110
|
+
const doc = readJson(paths(runDir).registerRecords);
|
|
110
111
|
filings = JSON.stringify((Array.isArray(doc?.marks) ? doc.marks : []).flatMap((x) => [...(Array.isArray(x?.records) ? x.records : []), ...(Array.isArray(x?.setAsideRecords) ? x.setAsideRecords : [])]));
|
|
111
112
|
} catch { filings = null; }
|
|
112
113
|
let checks = [];
|
|
113
|
-
try { checks =
|
|
114
|
+
try { checks = readJson(paths(runDir).ownerChecks).checks ?? []; } catch { checks = []; }
|
|
114
115
|
const heldIds = registerRecordIdsHeld(runDir);
|
|
115
116
|
const linked = new Set(checks.filter((c) => (c?.recordIds ?? []).some((id) => heldIds.has(String(id)))).map((c) => c?.payloadFile));
|
|
116
117
|
const researchDir = join(runDir, "research");
|
|
@@ -151,7 +152,7 @@ export function knockoutReceipts(runDir, marks) {
|
|
|
151
152
|
// rating field is a second vocabulary waiting to happen, which is exactly what rules out.
|
|
152
153
|
//
|
|
153
154
|
// THE SET IS ONE WORD, and it is one word because ONE is what the doctrine attests. knockout-assess
|
|
154
|
-
// SKILL.md exemplifies "
|
|
155
|
+
// SKILL.md exemplifies "Moderate (low)" and calibration rule 4 says enforcer profiling "can cap a middle
|
|
155
156
|
// band at its '(low)' qualifier". Nothing in the doctrine, and no artifact in this repo, carries any
|
|
156
157
|
// other value. So the qualifier can SOFTEN a band and never sharpen it — minting "high" or "mid" to make
|
|
157
158
|
// the set look like a scale would be this build inventing vocabulary in the change that forbids it.
|
|
@@ -234,7 +235,7 @@ export function isUnbrokenWall(s) {
|
|
|
234
235
|
// line, which is true — so this can never cost a client a report over a field the run did not need.
|
|
235
236
|
/** Every register recordId this run holds for `markName`. Empty set when the lane did not run. PURE-ish (reads disk). */
|
|
236
237
|
export function registerRecordIdsFor(runDir, markName) {
|
|
237
|
-
const doc =
|
|
238
|
+
const doc = readJsonOrNull(paths(runDir).registerRecords);
|
|
238
239
|
const want = String(markName ?? "").trim().toLowerCase();
|
|
239
240
|
const entry = (Array.isArray(doc?.marks) ? doc.marks : []).find((e) => String(e?.name ?? "").trim().toLowerCase() === want);
|
|
240
241
|
return new Set([...(Array.isArray(entry?.records) ? entry.records : []), ...(Array.isArray(entry?.setAsideRecords) ? entry.setAsideRecords : [])]
|
|
@@ -243,7 +244,7 @@ export function registerRecordIdsFor(runDir, markName) {
|
|
|
243
244
|
|
|
244
245
|
/** Every register recordId this run holds, under any name: what a check may rest a defect on. Empty set when the lane did not run. */
|
|
245
246
|
export function registerRecordIdsHeld(runDir) {
|
|
246
|
-
const doc =
|
|
247
|
+
const doc = readJsonOrNull(paths(runDir).registerRecords);
|
|
247
248
|
return new Set((Array.isArray(doc?.marks) ? doc.marks : []).flatMap((e) => [...(Array.isArray(e?.records) ? e.records : []), ...(Array.isArray(e?.setAsideRecords) ? e.setAsideRecords : [])])
|
|
248
249
|
.map((r) => String(r?.recordId ?? "").trim()).filter(Boolean));
|
|
249
250
|
}
|
|
@@ -292,11 +293,11 @@ export function heldCitationsOnly(runDir, mark) {
|
|
|
292
293
|
*/
|
|
293
294
|
export const REGISTER_LANE_FILE = "register-lane.json";
|
|
294
295
|
export function registerLaneState(runDir) {
|
|
295
|
-
if (
|
|
296
|
-
const doc =
|
|
296
|
+
if (readJsonOrNull(driverDir(runDir, REGISTER_LANE_FILE))?.skipped === true) return { state: "skipped" };
|
|
297
|
+
const doc = readJsonOrNull(paths(runDir).registerRecords);
|
|
297
298
|
if (doc?.unavailable) return { state: "unavailable", reason: String(doc.unavailable) };
|
|
298
299
|
if (doc) return { state: "held" };
|
|
299
|
-
return { state: existsSync(
|
|
300
|
+
return { state: existsSync(paths(runDir).registerCounts) ? "unavailable" : "unknown", reason: null };
|
|
300
301
|
}
|
|
301
302
|
|
|
302
303
|
export const KNOCKOUT_RATING_QUALIFIERS = ["low"];
|
|
@@ -306,7 +307,6 @@ export function normalizeKnockoutQualifier(v) {
|
|
|
306
307
|
}
|
|
307
308
|
|
|
308
309
|
// ── Ladder helpers over the frozen framework manifest ────────────────────────────────────────────────
|
|
309
|
-
const readJson = (p) => { try { return JSON.parse(readFileSync(p, "utf8")); } catch { return null; } };
|
|
310
310
|
const ladderOf = (fw) => (Array.isArray(fw?.bands) ? fw.bands.map((b) => String(b.label)) : []);
|
|
311
311
|
|
|
312
312
|
// ── THE FRAMEWORK'S METHOD, READ THE WAY THE LADDER IS ──────────────────────────────────────────────
|
|
@@ -339,7 +339,7 @@ const bandIdx = (ladder, word) => ladder.findIndex((l) => l.toLowerCase() === St
|
|
|
339
339
|
const materialIdxMax = (ladder) => ladder.length - 3; // inclusive index bound for "material"
|
|
340
340
|
|
|
341
341
|
/** The frozen ladder of a run, worst first, or none where the run holds no framework. */
|
|
342
|
-
export const frozenLadder = (runDir) => ladderOf(
|
|
342
|
+
export const frozenLadder = (runDir) => ladderOf(readJsonOrNull(paths(runDir).framework));
|
|
343
343
|
|
|
344
344
|
// ── A NAME'S CONCLUSION BY CLASS GROUP ───────────────────────────────────────────────
|
|
345
345
|
//
|
|
@@ -523,7 +523,7 @@ export const validators = {
|
|
|
523
523
|
if (collisions.length)
|
|
524
524
|
return { ok: false, reason: `marks ${collisions.map(([a, b]) => `"${a}"/"${b}"`).join(", ")} collide to the same research key — a batch cannot carry two marks that differ only in spacing/punctuation/case; drop or reword one` };
|
|
525
525
|
// name parity vs the instructed scope (the paraphrase-drift gate)
|
|
526
|
-
const scope =
|
|
526
|
+
const scope = readJsonOrNull(paths(dirname(file)).instructedScope);
|
|
527
527
|
const instructed = Array.isArray(scope?.marks) ? scope.marks : (scope?.marks ? [scope.marks] : null);
|
|
528
528
|
if (instructed?.length) {
|
|
529
529
|
const want = new Set(instructed.map(nameKey));
|
|
@@ -560,7 +560,7 @@ export const validators = {
|
|
|
560
560
|
// before the move.
|
|
561
561
|
const chunkDir = dirname(file);
|
|
562
562
|
const runDir = basename(chunkDir) === DRIVER_DIR ? dirname(chunkDir) : chunkDir;
|
|
563
|
-
const fw =
|
|
563
|
+
const fw = readJsonOrNull(paths(runDir).framework);
|
|
564
564
|
const ladder = ladderOf(fw);
|
|
565
565
|
// The frozen method, when the framework states one. A corrupt copy is a driver fault, as an unreadable
|
|
566
566
|
// ladder is below: recorded, and its checks left to the merged gate, which refuses to publish on it —
|
|
@@ -575,7 +575,7 @@ export const validators = {
|
|
|
575
575
|
// read that failed must not re-ask a seat for something no seat can repair (the same ruling the
|
|
576
576
|
// ladder read below carries).
|
|
577
577
|
const batchIsMultiMark = (() => {
|
|
578
|
-
const plan =
|
|
578
|
+
const plan = readJsonOrNull(join(runDir, "knockout-plan.json"));
|
|
579
579
|
return Array.isArray(plan?.marks) && plan.marks.length > 1;
|
|
580
580
|
})();
|
|
581
581
|
// — AN EMPTY LADDER IS NOW AN OBSERVABLE, NOT A SILENT SKIP. The three band checks below are
|
|
@@ -589,13 +589,13 @@ export const validators = {
|
|
|
589
589
|
// What belongs HERE is the record that this chunk's ratings were never constrained.
|
|
590
590
|
if (!ladder.length) {
|
|
591
591
|
runLog(runDir, { event: "knockout-band-checks-inert", stage: "knockout-assess", chunk: file,
|
|
592
|
-
framework:
|
|
592
|
+
framework: paths(runDir).framework,
|
|
593
593
|
detail: "empty band ladder — knockout_band_unknown, classesDriving and registerEstimate all passed without checking anything" });
|
|
594
594
|
}
|
|
595
595
|
const chunkNo = Number(file.match(/knockout-assess-(\d+)\.json$/)?.[1] ?? NaN);
|
|
596
596
|
// membership: the chunk may rate exactly its assigned marks — no invention, no neighbour-chunk
|
|
597
597
|
// overrun (a duplicate row across chunks would double-render in the report), no omission.
|
|
598
|
-
const chunksSidecar =
|
|
598
|
+
const chunksSidecar = readJsonOrNull(paths(runDir).knockoutChunks);
|
|
599
599
|
const assigned = Number.isInteger(chunkNo) && Array.isArray(chunksSidecar?.chunks) ? chunksSidecar.chunks[chunkNo] : null;
|
|
600
600
|
if (Array.isArray(assigned)) {
|
|
601
601
|
const want = new Set(assigned.map(nameKey));
|
|
@@ -849,22 +849,7 @@ export function registerSurfacedFilings(recordsPath, { read = readFileSync } = {
|
|
|
849
849
|
* `pipeline-knockout.mjs` re-exports `SURVIVOR_BOUNDARY_RE` so its existing importers are untouched; the
|
|
850
850
|
* import direction is producer -> verifier, and it cannot be the other way without a cycle.
|
|
851
851
|
*/
|
|
852
|
-
export
|
|
853
|
-
|
|
854
|
-
/**
|
|
855
|
-
* Is this caveat the ENGINE'S OWN WORDS rather than the rater's?
|
|
856
|
-
*
|
|
857
|
-
* The engine appends two, both stated in code because the assessing model cannot see the facts behind
|
|
858
|
-
* them: the survivor boundary, and the capability-skipped note. Neither is something "the rater
|
|
859
|
-
* supplied", and telling them apart is the whole of — the standing-caveat lint asked
|
|
860
|
-
* "did the rater supply caveats?" of an array the engine had already written into, so from the moment
|
|
861
|
-
* the survivor sentence was appended the answer was always yes and the check could never fire again.
|
|
862
|
-
*/
|
|
863
|
-
export function isEngineAppendedCaveat(text) {
|
|
864
|
-
const t = String(text ?? "");
|
|
865
|
-
if (SURVIVOR_BOUNDARY_RE.test(t)) return true;
|
|
866
|
-
return Object.values(CAPABILITY_SKIPPED_NOTE).some((note) => t.trim() === String(note).trim());
|
|
867
|
-
}
|
|
852
|
+
export { SURVIVOR_BOUNDARY_RE, isEngineAppendedCaveat };
|
|
868
853
|
|
|
869
854
|
/**
|
|
870
855
|
* What the RATER actually supplied: non-blank, and none of the engine's own sentences.
|
|
@@ -912,7 +897,7 @@ export function validateMergedFindings(runDir, merged, plan) {
|
|
|
912
897
|
// it counts wherever it sits. `supplied` answers "does this run owe one"; this answers "is one there".
|
|
913
898
|
const caveats = (merged?.batch?.standardCaveats ?? []).map((c) => String(c ?? "")).join(" ");
|
|
914
899
|
const owed = supplied.length === 0
|
|
915
|
-
&& !registerSurfacedFilings(
|
|
900
|
+
&& !registerSurfacedFilings(paths(runDir).registerRecords);
|
|
916
901
|
if (owed && !/register analysis may adjust/i.test(caveats)) {
|
|
917
902
|
failures.push('the standing caveat ("Register analysis may adjust ratings in either direction") is '
|
|
918
903
|
+ "missing, and this run owes it: the rater supplied no caveats of its own and the register "
|
|
@@ -970,7 +955,7 @@ export function validateMergedFindings(runDir, merged, plan) {
|
|
|
970
955
|
// THIS IS THE ONE DOOR THE RENUMBER LANDS AT, and it is why the ranked array is assigned back here
|
|
971
956
|
// while the chunk gate discards it: a chunk file is the audit record of what the model wrote, and
|
|
972
957
|
// nothing publishes from it. Everything a reader sees is rendered from `merged`.
|
|
973
|
-
const manifest =
|
|
958
|
+
const manifest = readJsonOrNull(paths(runDir).framework);
|
|
974
959
|
// The frozen method, as the chunk gate reads it. Here a corrupt copy refuses: this is the artifact that
|
|
975
960
|
// ships, and a method nobody could read has checked nothing.
|
|
976
961
|
const fm = frozenMethodOf(runDir, manifest);
|