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
package/driver/repairs.mjs
CHANGED
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
// 3. createRepairLedger — persistent per-run attempt bookkeeping (_driver/repairs.json) so a
|
|
19
19
|
// park/resume can never re-arm an exhausted repair and repairs can never loop.
|
|
20
20
|
|
|
21
|
-
import {
|
|
21
|
+
import { writeFileSync, mkdirSync } from "node:fs";
|
|
22
22
|
import { createHash } from "node:crypto";
|
|
23
23
|
import { join, dirname } from "node:path";
|
|
24
|
-
import {
|
|
24
|
+
import { paths, readJson } from "./run-record.mjs";
|
|
25
25
|
|
|
26
26
|
// ── the terminal kind that is not a failure ───────────────────────────────────────────────
|
|
27
27
|
//
|
|
@@ -302,8 +302,6 @@ export function bareStage(stage) {
|
|
|
302
302
|
// The table is an ALLOWLIST, not a find-a-digit heuristic: a bare \d+ grab would read the exit code out
|
|
303
303
|
// of nonzero_exit_1, or the ordinal out of finding_use_check_missing:12, and call it progress. An entry
|
|
304
304
|
// joins this table only with the throw site's literal template in hand and a test.
|
|
305
|
-
const OVERFLOW_RE = /\(\+(\d+) more\)\s*$/;
|
|
306
|
-
const overflowOf = (tail) => { const m = OVERFLOW_RE.exec(tail.trim()); return m ? Number(m[1]) : 0; };
|
|
307
305
|
|
|
308
306
|
// verify.mjs connotationDispositionFail, since:
|
|
309
307
|
// `connotation_no_ruling:no_ruling=<n>;<row-id> [<query|receipt>],…[ (+N more)]`
|
|
@@ -311,10 +309,8 @@ const overflowOf = (tail) => { const m = OVERFLOW_RE.exec(tail.trim()); return m
|
|
|
311
309
|
// `connotation_quote_unbound:quote_unbound=<n>;<row-id> [<query>] <state> <R-id>,…[ (+N more)]`
|
|
312
310
|
// The leading CAUSE CENSUS is the exact count stamped at the throw site, so the total is the sum of its
|
|
313
311
|
// numbers — no comma-splitting, and therefore immune to the over-count a query containing a comma used to
|
|
314
|
-
// cause.
|
|
315
|
-
//
|
|
316
|
-
// (`connotation_undisposed:<census>;…`, `<q1,q2,…>[ (+N more)]`). A stale token that stopped counting
|
|
317
|
-
// would read as a MISSING quantity, which is what a converged run looks like.
|
|
312
|
+
// cause. A tail with no census is ABSENT: every token in the table below is written with one, and a run
|
|
313
|
+
// is only ever continued on the build that started it, so no older shape reaches this reader.
|
|
318
314
|
// The validator's exact count still rides as `quantity` at the throw site and always wins.
|
|
319
315
|
const CENSUS_RE = /^((?:[a-z_]+=\d+)(?:,[a-z_]+=\d+)*)(?:[;\s]|$)/;
|
|
320
316
|
function undisposedCount(tail) {
|
|
@@ -325,19 +321,7 @@ function undisposedCount(tail) {
|
|
|
325
321
|
// ABSENT, not converged (see the ABSENT IS NOT ZERO block above).
|
|
326
322
|
return total || null;
|
|
327
323
|
}
|
|
328
|
-
|
|
329
|
-
const listed = tail.replace(OVERFLOW_RE, "").trim();
|
|
330
|
-
const named = listed ? listed.split(",").map((s) => s.trim()).filter(Boolean).length : 0;
|
|
331
|
-
// The token cannot fire with zero outstanding rows, so a zero here means the string reaching us
|
|
332
|
-
// was cut short of its payload — ABSENT, not converged.
|
|
333
|
-
return named ? named + overflow : null;
|
|
334
|
-
}
|
|
335
|
-
// A pre-change archived token: `connotation_recurrent_uncited:<one result, ≤80 chars>[ (+N more)]` — ONE
|
|
336
|
-
// named result plus the overflow. Never split on commas: that payload is a copied result title, not a
|
|
337
|
-
// joined list. Nothing emits this shape any more; it is kept so a resumed run's own history still counts.
|
|
338
|
-
function recurrentCount(tail) {
|
|
339
|
-
const named = tail.replace(OVERFLOW_RE, "").trim();
|
|
340
|
-
return named ? 1 + overflowOf(tail) : null;
|
|
324
|
+
return null;
|
|
341
325
|
}
|
|
342
326
|
|
|
343
327
|
// FIRST MATCH WINS, so the live tokens lead. Every entry's `count` reads a census when there is one, and
|
|
@@ -345,28 +329,10 @@ function recurrentCount(tail) {
|
|
|
345
329
|
const PROGRESS_TOKENS = [
|
|
346
330
|
{ token: "connotation_no_ruling", count: undisposedCount }, //, live
|
|
347
331
|
{ token: "connotation_form_damaged", count: undisposedCount }, //, live
|
|
348
|
-
//
|
|
349
|
-
//
|
|
350
|
-
// progressQuantity, `progress.kind` becomes "unknown", and a seat converging 75 → 40 → 0 reads as
|
|
351
|
-
// stuck — so the ladder breaks on the attempt that was working. Same census shape (`<reason>=<n>;`),
|
|
352
|
-
// so the same counter. FIRST MATCH WINS on indexOf and none of these three names contains another,
|
|
353
|
-
// so position among themselves is free; they sit with their family because a token added away from
|
|
354
|
-
// this comment is a token added without it in view.
|
|
355
|
-
// `form_untouched` signs the POPULATION, not 1 — verify.mjs emits `form_untouched=<row count>` for
|
|
356
|
-
// exactly this reader, so a 75-row failure followed by `token_absent=40` reads as convergence and not
|
|
357
|
-
// as a 40x regression.
|
|
358
|
-
// RETIRED, kept so archived and replayed runs still count. `form_untouched` left CONNOTATION_REASONS
|
|
359
|
-
// with the hand-edited form path (owner ruling 2026-08-17, recorded at contract-vocabulary.mjs:85) and
|
|
360
|
-
// nothing emits it now; its subject matter is `call_never_made`. Delete the ENTRY and a resumed run's
|
|
361
|
-
// own history stops counting — a dead allowlist row costs nothing, a missing one costs a ladder.
|
|
362
|
-
{ token: "connotation_form_untouched", count: undisposedCount }, //, retired 2026-08-17
|
|
363
|
-
// — same census shape (`<reason>=<n>;`) and the same counter. It signs the POPULATION for the
|
|
364
|
-
// reason stated just above: an unparseable submission recorded nothing, so every obligation is still
|
|
365
|
-
// owed, and `=1` here would make the next attempt's real progress read as a regression. FIRST MATCH
|
|
366
|
-
// WINS on indexOf and neither this name nor `connotation_form_untouched` contains the other.
|
|
367
|
-
{ token: "connotation_form_unparseable", count: undisposedCount }, //, retired 2026-08-17 (as above)
|
|
332
|
+
// A token with no entry here returns null from progressQuantity, `progress.kind` becomes "unknown", and a
|
|
333
|
+
// seat converging 75 → 40 → 0 reads as stuck — so the ladder breaks on the attempt that was working.
|
|
368
334
|
// B — the four TRANSPORT states. Same census shape (`<reason>=<n>;`), so the same counter. Three of them
|
|
369
|
-
// sign the POPULATION
|
|
335
|
+
// sign the POPULATION: when a call never landed, nothing was
|
|
370
336
|
// recorded, every obligation is still owed, and `=1` would make the next attempt's real progress read as
|
|
371
337
|
// a regression.
|
|
372
338
|
//
|
|
@@ -380,18 +346,9 @@ const PROGRESS_TOKENS = [
|
|
|
380
346
|
{ token: "connotation_call_truncated", count: undisposedCount },
|
|
381
347
|
{ token: "connotation_call_schema_violation", count: undisposedCount },
|
|
382
348
|
{ token: "connotation_call_partial", count: undisposedCount },
|
|
383
|
-
// A DIFFERENT KIND OF STALE from the two above, and the distinction is the whole point of writing it
|
|
384
|
-
// down. `token_absent` and `cite_absent` are still LIVE row-level reasons (CONNOTATION_REASONS carries
|
|
385
|
-
// both; findConnotationViolations still pushes them) — but they never mint a TOP-LEVEL fail token any
|
|
386
|
-
// more. connotationDispositionFail reports the four call_* transport states, then form_damaged, then
|
|
387
|
-
// quote_unbound, and returns null; under the typed transport an unruled residual surfaces as a call
|
|
388
|
-
// state instead. So these two can only ever match an ARCHIVED reason string, and a test pinning either
|
|
389
|
-
// as a live token would pin nothing. Kept for exactly that archived traffic.
|
|
390
|
-
{ token: "connotation_token_absent", count: undisposedCount }, //, row-level only — never a top-level token
|
|
391
|
-
{ token: "connotation_cite_absent", count: undisposedCount }, //, row-level only — never a top-level token
|
|
392
349
|
//. Without an entry here the quote ladder's residual is invisible: progressQuantity returns null,
|
|
393
350
|
// `progress.kind` becomes "unknown", and a run converging 3 → 1 → 0 reads as stuck — the silent failure
|
|
394
|
-
// the
|
|
351
|
+
// the head of this table describes, on the one token added since it was written. Same census shape, so the
|
|
395
352
|
// same counter. FIRST MATCH WINS on `indexOf` and this name contains neither of the two above it, so
|
|
396
353
|
// the position is free; it sits with its family because a token added away from them is a token added
|
|
397
354
|
// without this comment in view.
|
|
@@ -407,8 +364,6 @@ const PROGRESS_TOKENS = [
|
|
|
407
364
|
{ token: "coverage_form_axis_invalid", count: undisposedCount }, // fix round, live
|
|
408
365
|
{ token: "coverage_no_status", count: undisposedCount }, //, live
|
|
409
366
|
{ token: "coverage_form_damaged", count: undisposedCount }, //, live
|
|
410
|
-
{ token: "connotation_undisposed", count: undisposedCount }, // pre-, archived runs only
|
|
411
|
-
{ token: "connotation_recurrent_uncited", count: recurrentCount }, // pre-, archived runs only
|
|
412
367
|
];
|
|
413
368
|
|
|
414
369
|
// The reason must arrive UNTRUNCATED — feed this the fail string as thrown, never a display slice.
|
|
@@ -471,6 +426,37 @@ export function failureSignature(stage, reason, { codes } = {}) {
|
|
|
471
426
|
return { sig, stage: s, norm, quantity, quantityToken, kindToken };
|
|
472
427
|
}
|
|
473
428
|
|
|
429
|
+
// Failure causes that are TRANSIENT INFRASTRUCTURE (provider overload / idle-timeout / transport) — the only
|
|
430
|
+
// ones a caller may re-run without risking a quality drop, because a repeat is the actual remedy and it
|
|
431
|
+
// CANNOT paper over a recall gap. Everything NOT matched here is a content/coverage failure (validator
|
|
432
|
+
// reject, missing output, unparseable, self-reported incomplete) — those never earn a re-run beyond the
|
|
433
|
+
// same-model ladder inside runStage; they hard-stop, loudly. ⚠️ `status_timeout` is the 2026-06-07
|
|
434
|
+
// incident itself (the gateway's ~120s LLM idle-timeout surfaced as a clean-JSON status:"timeout" → the soft
|
|
435
|
+
// `status_<json.status>` bucket) and MUST stay eligible.
|
|
436
|
+
//
|
|
437
|
+
// NAME: the model-failover chain this predicate was written for is deleted. The predicate is not —
|
|
438
|
+
// it is live at the common-law half-join (steps/register-sweep.mjs) and it is what `isContentShapedFail` is defined against.
|
|
439
|
+
// Renaming it would touch the retry-ladder tests, so the name stays and this note says why.
|
|
440
|
+
const FALLBACK_ELIGIBLE = [
|
|
441
|
+
/^timeout$/, /^lane_wedge$/, /^embedded_fallback$/, /^nonzero_exit/,
|
|
442
|
+
/^status_timeout$/, /^status_overloaded$/, /^status_error$/, /^status_aborted$/, /^status_rate_limited$/,
|
|
443
|
+
];
|
|
444
|
+
export function isFallbackEligible(fail) { // @internal
|
|
445
|
+
return Boolean(fail) && FALLBACK_ELIGIBLE.some((re) => re.test(fail));
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
// A5 strike predicate — is this run.jsonl stage-row failure a CONTENT verdict (counts toward the
|
|
449
|
+
// invalid-artifact strike cap) rather than infra weather (breaks the streak)? isFallbackEligible alone
|
|
450
|
+
// is NOT enough: it matches only the transient-infrastructure token set, but the trail also carries
|
|
451
|
+
// transient shapes that set does not match — `rate_limited` (the subscription 5h cap), bare
|
|
452
|
+
// `unparseable_json`, and prose transport causes from code-side units ("… direct execution failed:
|
|
453
|
+
// HTTP 502 …"). This module's own doctrine says those are sampling noise, not a content verdict — so
|
|
454
|
+
// anything classifyFailureReason calls transient breaks the streak too. Exported so the strike tests
|
|
455
|
+
// exercise THIS predicate, not a hand-rolled stand-in.
|
|
456
|
+
export function isContentShapedFail(fail) { // @internal
|
|
457
|
+
return classifyFailureReason(String(fail ?? "")) !== "transient" && !isFallbackEligible(fail);
|
|
458
|
+
}
|
|
459
|
+
|
|
474
460
|
// ── invalid-artifact strikes (A5, 2026-07-28 postmortem) ───────────────────────────────────────────────────
|
|
475
461
|
// A stage that repeatedly produces an INVALID output never went terminal: the idempotency skip can't
|
|
476
462
|
// fire over an invalid artifact, so every resume re-ran it — and with the reclaim/resume lanes feeding
|
|
@@ -478,7 +464,7 @@ export function failureSignature(stage, reason, { codes } = {}) {
|
|
|
478
464
|
// every resume while the operator watched "running 7/9"). This counts the TRAILING CONSECUTIVE failed
|
|
479
465
|
// executions of one stage from the append-only run.jsonl spine ("stage" events only — skips and other
|
|
480
466
|
// stages are transparent). Only CONTENT-SHAPED failures count (the caller passes an isContentShaped
|
|
481
|
-
// predicate —
|
|
467
|
+
// predicate — isContentShapedFail, below: not transient-classified AND not fallback-eligible): a
|
|
482
468
|
// flapping provider, a rate-limit trail, or a timeout streak must never convert to deterministic —
|
|
483
469
|
// waiting/re-sampling is a real remedy there, and any infra-shaped failure in the trail breaks the
|
|
484
470
|
// streak. A success ends the streak too, by definition.
|
|
@@ -794,9 +780,9 @@ export function repairVerdict(row, { max = 1 } = {}) {
|
|
|
794
780
|
}
|
|
795
781
|
|
|
796
782
|
export function createRepairLedger(runDir, { log } = {}) {
|
|
797
|
-
const file =
|
|
783
|
+
const file = paths(runDir).repairs;
|
|
798
784
|
const load = () => {
|
|
799
|
-
try { return
|
|
785
|
+
try { return readJson(file) ?? {}; } catch { return {}; }
|
|
800
786
|
};
|
|
801
787
|
const save = (o) => {
|
|
802
788
|
mkdirSync(dirname(file), { recursive: true });
|
|
@@ -833,7 +819,7 @@ export function createRepairLedger(runDir, { log } = {}) {
|
|
|
833
819
|
// `effect` is the caller's measured answer to "did it close?", because THIS is not the layer that
|
|
834
820
|
// can know — only the caller re-joins. It is `{asked, closed}`; a caller that does not measure gets
|
|
835
821
|
// `effect: "unmeasured"` in the row rather than silence, so the row never reads as a verified repair
|
|
836
|
-
// by omission.
|
|
822
|
+
// by omission. `bandChanged` (steps/skeptic-and-follow-up.mjs) already had this shape right
|
|
837
823
|
// (`outcome === "ok" && bandAfter != null && bandBefore !== bandAfter`); this makes it the rule rather
|
|
838
824
|
// than one site's good judgment. CITED BY SYMBOL, not by number alone: the old citation pointed at a
|
|
839
825
|
// `writeFileSync` three thousand lines away, and the number had been wrong long enough that the blank
|
|
@@ -30,13 +30,13 @@ import "../shared/env-local.mjs"; // — FIRST: the CLEAROTRON_* translation m
|
|
|
30
30
|
// would run too late — that was the repair that left this open.
|
|
31
31
|
import { readFileSync, writeFileSync, readdirSync, existsSync, statSync } from "node:fs";
|
|
32
32
|
import { join, basename } from "node:path"; import { studioDirFor } from "../shared/pre-rename-spellings.mjs";
|
|
33
|
-
import { DRIVER_DIR, driverDir } from "../shared/driver-dir.mjs"; //
|
|
34
33
|
import { homedir } from "node:os";
|
|
35
34
|
import { validators } from "./verify.mjs";
|
|
36
35
|
import { runLint, clientSummaryShape } from "./predelivery-lint.mjs"; import { emailConditionsOfReport } from "./publish/email-conditions.mjs"; // what the cover email carries
|
|
37
36
|
import { config } from "./driver.config.mjs";
|
|
38
37
|
import { GRID_HALVES } from "./common-law-receipts.mjs";
|
|
39
38
|
import { isEntrypoint } from "../shared/is-entrypoint.mjs"; // — one entry-point test, all spellings
|
|
39
|
+
import { DRIVER_DIR, paths, readJson } from "./run-record.mjs";
|
|
40
40
|
|
|
41
41
|
// Artifact filename → verify.mjs validator key. notify receipts are trivial and skipped.
|
|
42
42
|
const FILE_CHECKS = {
|
|
@@ -105,14 +105,14 @@ function recordsFor(runDir, reportMd) {
|
|
|
105
105
|
if (!isDir(dir)) return map;
|
|
106
106
|
for (const uri of new Set((reportMd.match(URI_RE) ?? []).map((u) => u.toLowerCase()))) {
|
|
107
107
|
const file = join(dir, uri.replace(/^\/mark\//, "").replace(/[^a-z0-9]+/gi, "-") + ".json");
|
|
108
|
-
try { map.set(uri,
|
|
108
|
+
try { map.set(uri, readJson(file)); } catch { /* unfetched/missing → lint flags it */ }
|
|
109
109
|
}
|
|
110
110
|
return map;
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
function searchedNamesFor(runDir) {
|
|
114
114
|
try {
|
|
115
|
-
const st =
|
|
115
|
+
const st = readJson(join(runDir, "status.json"));
|
|
116
116
|
return [...new Set([st.markName, ...((st.marks ?? []).map((m) => m?.name))].filter(Boolean))];
|
|
117
117
|
} catch { return []; }
|
|
118
118
|
}
|
|
@@ -164,7 +164,7 @@ export function replayRun(runDir) {
|
|
|
164
164
|
catch (e) { v = { ok: false, reason: `validator_threw:${e.message}` }; }
|
|
165
165
|
out[`registerUnit:${basename(f, ".md")}`] = verdict(v);
|
|
166
166
|
}
|
|
167
|
-
// pre-delivery lint replay (the NAME(S) / client-summary class) — mirrors
|
|
167
|
+
// pre-delivery lint replay (the NAME(S) / client-summary class) — mirrors lintNow() in steps/delivery.mjs
|
|
168
168
|
const reportPath = join(runDir, "report.md");
|
|
169
169
|
if (existsSync(reportPath)) {
|
|
170
170
|
try {
|
|
@@ -177,12 +177,12 @@ export function replayRun(runDir) {
|
|
|
177
177
|
// mirror it from the archived sidecar or post-WS-B runs flip live-vs-replay (pre-WS-B runs
|
|
178
178
|
// have no sidecar → empty extras, verdicts unchanged).
|
|
179
179
|
let extraPlatformNames = [];
|
|
180
|
-
try { extraPlatformNames =
|
|
180
|
+
try { extraPlatformNames = readJson(paths(runDir).profile).platforms ?? []; }
|
|
181
181
|
catch { /* legacy run */ }
|
|
182
182
|
const narrativeMd = existsSync(join(runDir, "narrative.md")) ? readFileSync(join(runDir, "narrative.md"), "utf8") : ""; // R.1: narrative plumbing
|
|
183
183
|
// wp50/wi2 — mirror the live lint's verdict-sidecar read (pre-49 runs have none → check skipped).
|
|
184
184
|
let verdictDoc = null;
|
|
185
|
-
try { verdictDoc =
|
|
185
|
+
try { verdictDoc = readJson(paths(runDir).verdict); } catch { /* legacy run */ }
|
|
186
186
|
const lint = runLint({
|
|
187
187
|
reportMd, clientSummaryMd: csMd, narrativeMd,
|
|
188
188
|
recordsByUri: recordsFor(runDir, reportMd + "\n" + csMd),
|
|
@@ -249,7 +249,7 @@ function main() {
|
|
|
249
249
|
return;
|
|
250
250
|
}
|
|
251
251
|
let prev;
|
|
252
|
-
try { prev =
|
|
252
|
+
try { prev = readJson(snapshotPath).runs; }
|
|
253
253
|
catch {
|
|
254
254
|
console.error(`no snapshot at ${snapshotPath} — run with --update first (on the BASE code state)`);
|
|
255
255
|
process.exit(1);
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
import { readFileSync, writeFileSync, mkdirSync } from "node:fs";
|
|
35
35
|
import { captureCall, stampVerdict } from "./call-capture.mjs";
|
|
36
36
|
import { join } from "node:path";
|
|
37
|
-
import { driverDir } from "../shared/driver-dir.mjs"; //
|
|
38
37
|
// — ONE definition of "present but not a link", imported rather than restated. The rule belongs to
|
|
39
38
|
// findings-model.mjs, which owns the record-URL contract; a second copy here would drift and the two
|
|
40
39
|
// would then disagree about the same value while both reporting themselves clean.
|
|
41
40
|
import { isDeadRecordLink } from "./findings-model.mjs";
|
|
41
|
+
import { paths, readJson } from "./run-record.mjs";
|
|
42
42
|
|
|
43
43
|
export const CARDS_DIR = "report-cards";
|
|
44
44
|
const SCHEMA_VERSION = 1;
|
|
@@ -48,7 +48,7 @@ export const cardFile = (runDir, ordinal) => join(String(runDir ?? ""), CARDS_DI
|
|
|
48
48
|
|
|
49
49
|
/** Where the call's evidence lives, PER ORDINAL — 26 cards mean 26 captures, never one overwritten. */
|
|
50
50
|
export function reportCardCallPaths(runDir, ordinal) {
|
|
51
|
-
const dir =
|
|
51
|
+
const dir = paths(String(runDir ?? "")).reportCardCalls;
|
|
52
52
|
return { dir, payload: join(dir, `call-${ordinal}.json`) };
|
|
53
53
|
}
|
|
54
54
|
|
|
@@ -96,7 +96,7 @@ export function findingForOrdinal(runDir, ordinal) {
|
|
|
96
96
|
*/
|
|
97
97
|
export function findingsDocFor(runDir, ordinal) {
|
|
98
98
|
let doc;
|
|
99
|
-
try { doc =
|
|
99
|
+
try { doc = readJson(join(String(runDir ?? ""), "findings.json")); }
|
|
100
100
|
catch { return { readable: false, finding: null }; }
|
|
101
101
|
if (!doc || typeof doc !== "object") return { readable: false, finding: null };
|
|
102
102
|
return { readable: true, finding: (doc.findings ?? []).find((f) => String(f?.ordinal) === String(ordinal)) ?? null };
|
|
@@ -47,11 +47,11 @@
|
|
|
47
47
|
// THE VALIDATOR IS NOT DELETED. Archived and replayed shells were hand-written under the old dictation
|
|
48
48
|
// and must keep parsing — the archive-validator trap, ruled binding on every conversion: a new way in,
|
|
49
49
|
// never a replacement. The strict boundary binds new writes; the permissive read path stays.
|
|
50
|
-
import { readFileSync, writeFileSync
|
|
50
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
51
51
|
import { captureCall, stampVerdict } from "./call-capture.mjs";
|
|
52
52
|
import { join } from "node:path";
|
|
53
|
-
import { driverDir, driverRel } from "../shared/driver-dir.mjs"; //
|
|
54
53
|
import { refuseUndeclared as refuseUndeclaredShared, keepIfAbsent, lastAccepted, acceptedEnvelope } from "./preserve-merge.mjs";
|
|
54
|
+
import { driverRel, paths, readJson } from "./run-record.mjs";
|
|
55
55
|
|
|
56
56
|
export const PROSE_FILE = "report-overview.md";
|
|
57
57
|
const SCHEMA_VERSION = 1;
|
|
@@ -61,7 +61,7 @@ export const IDENTITY_FILE = driverRel("report-identity.json");
|
|
|
61
61
|
|
|
62
62
|
/** Where the call's evidence lives — the driver's own record of what the seat handed it. */
|
|
63
63
|
export function reportOverviewCallPaths(runDir) {
|
|
64
|
-
const dir =
|
|
64
|
+
const dir = paths(runDir).reportOverviewCalls;
|
|
65
65
|
return { dir, payload: join(dir, "call-001.json"), accepted: join(dir, "accepted.json") };
|
|
66
66
|
}
|
|
67
67
|
|
|
@@ -159,7 +159,7 @@ const countSentences = (s) => (String(s).match(/[.!?](?=\s|$)/g) ?? []).length;
|
|
|
159
159
|
* `null` when absent: an archived or replayed run has no sidecar, and the caller renders what it holds.
|
|
160
160
|
*/
|
|
161
161
|
export function readReportIdentity(runDir) {
|
|
162
|
-
try { return
|
|
162
|
+
try { return readJson(join(String(runDir ?? ""), IDENTITY_FILE)); }
|
|
163
163
|
catch { return null; }
|
|
164
164
|
}
|
|
165
165
|
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
import { appendFileSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
29
29
|
import { createHash } from "node:crypto";
|
|
30
30
|
import { basename, dirname, join } from "node:path";
|
|
31
|
-
import { driverDir } from "
|
|
31
|
+
import { driverDir, paths, readJson } from "./run-record.mjs";
|
|
32
32
|
|
|
33
33
|
export const RESEARCH_ANSWERS_FILE = "research-answers.jsonl";
|
|
34
34
|
|
|
@@ -50,18 +50,50 @@ export const isResearchAnswer = (text) => typeof text === "string" && text.trim(
|
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* Keep one research answer beside its question, under the run's `_driver/`. Nothing is kept for a reply that is not an
|
|
53
|
-
* answer, or outside a run.
|
|
53
|
+
* answer, or outside a run. `request` is the fingerprint of the request that got it (`researchRequestKey`). Best-effort:
|
|
54
|
+
* a failed write never fails a lookup. IMPURE.
|
|
54
55
|
*/
|
|
55
|
-
export function keepResearchAnswer(runDir, { session = null, agent = null, task, preset = null, text }) {
|
|
56
|
+
export function keepResearchAnswer(runDir, { session = null, agent = null, task, preset = null, request = null, text }) {
|
|
56
57
|
if (!runDir || !isResearchAnswer(text) || typeof task !== "string" || !task.trim()) return;
|
|
57
58
|
try {
|
|
58
59
|
const p = driverDir(runDir, RESEARCH_ANSWERS_FILE);
|
|
59
60
|
mkdirSync(dirname(p), { recursive: true });
|
|
60
61
|
appendFileSync(p, JSON.stringify({ ts: new Date().toISOString(), ...(session ? { session } : {}), ...(agent ? { agent } : {}),
|
|
61
|
-
task, ...(preset ? { preset } : {}), text }) + "\n");
|
|
62
|
+
task, ...(preset ? { preset } : {}), ...(request ? { request } : {}), text }) + "\n");
|
|
62
63
|
} catch { /* best-effort — a failed write must never break a lookup */ }
|
|
63
64
|
}
|
|
64
65
|
|
|
66
|
+
// ── A STAGE RUN AGAIN IS ANSWERED WHAT IT ALREADY ASKED ───────────────────────────────────────────────────────────────
|
|
67
|
+
//
|
|
68
|
+
// A stage runs again after a retry, a park, a correction or a stale input, and each time it sent its research questions
|
|
69
|
+
// again: the run kept their answers but answered from them only in a replay. A research answer is paid for, so a
|
|
70
|
+
// question the stage already got an answer to is answered from that answer and not sent again.
|
|
71
|
+
//
|
|
72
|
+
// ONLY THE SAME REQUEST. The fingerprint is the whole request the service would be sent: the question's words, the tier
|
|
73
|
+
// it resolved to, its tools and filters, the model, a response schema and the instructions. A question worded
|
|
74
|
+
// differently, asked at another depth or with another option, is a new question; so is one the product now asks with
|
|
75
|
+
// different instructions. ONLY THE SAME STAGE: its session and its retries (`sameStageSession`), never another stage's
|
|
76
|
+
// answer. ONLY AN ANSWER: a failed call or an unreadable reply was never kept, so it is asked again. An answer kept
|
|
77
|
+
// before the fingerprint existed carries none, and is asked again.
|
|
78
|
+
|
|
79
|
+
/** The fingerprint of one research request: the body the service would be sent. PURE. */
|
|
80
|
+
export const researchRequestKey = (body) => createHash("sha256").update(JSON.stringify(body ?? null)).digest("hex").slice(0, 24);
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* The latest answer this stage already holds to exactly this request, or null. `sessionKey` is the asking session; every
|
|
84
|
+
* session of its stage counts. IMPURE (reads the record).
|
|
85
|
+
* @returns {{ text: string, ts: string, session: string }|null}
|
|
86
|
+
*/
|
|
87
|
+
export function heldAnswerToRequest(runDir, sessionKey, request) {
|
|
88
|
+
if (!runDir || !sessionKey || typeof request !== "string" || !request) return null;
|
|
89
|
+
let found = null;
|
|
90
|
+
for (const row of rows(driverDir(runDir, RESEARCH_ANSWERS_FILE))) {
|
|
91
|
+
if (row?.request !== request || !sameStageSession(row.session, sessionKey) || !isResearchAnswer(row.text)) continue;
|
|
92
|
+
if (!found || String(row.ts ?? "") >= found.ts) found = { text: row.text, ts: String(row.ts ?? ""), session: row.session };
|
|
93
|
+
}
|
|
94
|
+
return found;
|
|
95
|
+
}
|
|
96
|
+
|
|
65
97
|
/**
|
|
66
98
|
* The research answers the session `sessionKey` and its retries got, oldest first, one per question: the latest answer
|
|
67
99
|
* to each exact question. [] when there are none, or no record. A torn line is skipped. IMPURE (reads the record).
|
|
@@ -194,7 +226,7 @@ export const researchReplayOn = (runDir) => Boolean(runDir) && existsSync(driver
|
|
|
194
226
|
/** The answers file a replay answers from, as its marker names it, or null: then it answers nothing. IMPURE. */
|
|
195
227
|
export function replayAnswersFrom(runDir) {
|
|
196
228
|
try {
|
|
197
|
-
const from =
|
|
229
|
+
const from = readJson(driverDir(runDir, RESEARCH_REPLAY_FILE))?.answersFrom;
|
|
198
230
|
return typeof from === "string" && from.trim() ? from : null;
|
|
199
231
|
} catch { return null; }
|
|
200
232
|
}
|
|
@@ -265,7 +297,7 @@ export function heldResearchAnswers(runDir, sessionKey = null) {
|
|
|
265
297
|
for (const r of kept) if (own(r?.session) && typeof r.task === "string" && isResearchAnswer(r.text)) put(r.task, oneLine(r.text), "asked");
|
|
266
298
|
// A replayed answer is the run's own, read from the copy of its answers the replay's marker names, outside the arm.
|
|
267
299
|
const replayFrom = replayAnswersFrom(runDir);
|
|
268
|
-
for (const r of rows(
|
|
300
|
+
for (const r of rows(paths(runDir).readingLog)) {
|
|
269
301
|
if (r?.tool !== "perplexity_research" || r.ok !== true || !own(r.session) || r.args?.grid || typeof r.args?.task !== "string") continue;
|
|
270
302
|
const text = (r.args.replay && replayFrom ? savedResearchAnswer(replayFrom, r.args.task)?.text : null)
|
|
271
303
|
?? kept.filter((x) => typeof x?.task === "string" && x.task.trim() === r.args.task.trim() && isResearchAnswer(x.text)).pop()?.text ?? null;
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
// experiment's copy of the review carries it (stages.mjs, the review's inputs).
|
|
13
13
|
import { readFileSync, writeFileSync, renameSync } from "node:fs";
|
|
14
14
|
import { join } from "node:path";
|
|
15
|
-
import { driverDir } from "../shared/driver-dir.mjs";
|
|
16
15
|
import { isUseCheckNoResult } from "./findings-model.mjs";
|
|
17
16
|
import { questionKey, sameStageSession } from "./research-answers.mjs";
|
|
17
|
+
import { RESEARCH_CHECKS_FILE, paths, readJson } from "./run-record.mjs";
|
|
18
18
|
|
|
19
|
-
export
|
|
19
|
+
export { RESEARCH_CHECKS_FILE };
|
|
20
20
|
|
|
21
21
|
// The reviewer's instruction (design, 2026-10-28), word for word. Model-facing: it changes only as model-facing wording does.
|
|
22
22
|
export const REVIEW_RESEARCH_CHECK = "Check a claimed research result against the relevant saved answer and its completion record. "
|
|
@@ -71,9 +71,9 @@ export function researchChecksText(findings, held, asked) {
|
|
|
71
71
|
*/
|
|
72
72
|
export function writeResearchChecks(runDir, { findingsAt, held = null, sessionKey = null } = {}) {
|
|
73
73
|
try {
|
|
74
|
-
const doc =
|
|
74
|
+
const doc = readJson(findingsAt);
|
|
75
75
|
const own = (s) => sameStageSession(s, sessionKey);
|
|
76
|
-
const asked = rows(
|
|
76
|
+
const asked = rows(paths(runDir).readingLog)
|
|
77
77
|
.filter((r) => r?.tool === "perplexity_research" && own(r.session) && !r.args?.grid && typeof r.args?.task === "string" && r.args.task.trim())
|
|
78
78
|
.map((r) => ({ question: r.args.task, ok: r.ok === true, error: r.error ?? null }));
|
|
79
79
|
const at = join(runDir, RESEARCH_CHECKS_FILE);
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
//
|
|
20
20
|
// `atWriteSite` is how many of a pair's sites sit inside a call that actually writes one of those two
|
|
21
21
|
// artifact families — `runLog`/`stageLog`/`log`/`appendLine`/`recordSpan`, or `writeFileSync`/
|
|
22
|
-
// `atomicWrite` against a `driverDir()` path or a `P.<key>` built with `driverRel()`.
|
|
23
|
-
// REPORTED, never dropped: it is a result noun in a module that writes these artifacts,
|
|
24
|
-
// is out of scope is a fact worth stating rather than a filter nobody can see.
|
|
22
|
+
// `atomicWrite` against a `driverDir()` path, or a `P.<key>` or `paths(run).<key>` built with `driverRel()`.
|
|
23
|
+
// A pair with zero is REPORTED, never dropped: it is a result noun in a module that writes these artifacts,
|
|
24
|
+
// and the reason it is out of scope is a fact worth stating rather than a filter nobody can see.
|
|
25
25
|
//
|
|
26
26
|
// ── WHAT THIS CANNOT SEE, SO THE NUMBER IS NOT READ AS COVERAGE ─────────────────────────────────────
|
|
27
27
|
//
|
|
@@ -70,23 +70,39 @@ export const RESULT_NOUN_FIELDS = Object.freeze([
|
|
|
70
70
|
+ "the record had no line a reader meets first, `applied` after the rewrite passed the merged gate and was "
|
|
71
71
|
+ "written, and the `keep()` forms after the artifact or the gate refused it. Every one is a fact "
|
|
72
72
|
+ "about what already happened to the record, never the return of the call being logged" },
|
|
73
|
-
{ file: "driver/
|
|
73
|
+
{ file: "driver/steps/register-sweep.mjs", noun: "closed", sites: 6, atWriteSite: 4, verdict: "result",
|
|
74
74
|
why: "closure counts derived from the landed set (`qids.filter(q => landed.has(q)).length`) and from the receipt" },
|
|
75
|
-
{ file: "driver/
|
|
75
|
+
{ file: "driver/steps/register-sweep.mjs", noun: "executed", sites: 3, atWriteSite: 3, verdict: "result",
|
|
76
76
|
why: "lengths of the executed set as the join computed it" },
|
|
77
|
-
{ file: "driver/pipeline.mjs", noun: "
|
|
77
|
+
{ file: "driver/pipeline.mjs", noun: "executed", sites: 1, atWriteSite: 0, verdict: "result",
|
|
78
|
+
why: "lengths of the executed set as the join computed it" },
|
|
79
|
+
{ file: "driver/steps/frame-comparison.mjs", noun: "outcome", sites: 1, atWriteSite: 0, verdict: "result",
|
|
80
|
+
why: "the frame-reopen sweep hands back what dispatchPlanQids answered for the axis, in process; nothing writes it under this name" },
|
|
81
|
+
{ file: "driver/steps/skeptic-and-follow-up.mjs", noun: "outcome", sites: 1, atWriteSite: 1, verdict: "result",
|
|
82
|
+
why: "the escalation recheck logs what dispatchPlanQids answered for the axis, or that the repair budget was spent" },
|
|
83
|
+
{ file: "driver/steps/skeptic-and-follow-up.mjs", noun: "recovered", sites: 2, atWriteSite: 2, verdict: "result",
|
|
84
|
+
why: "each sits on the branch reached only after the screen gate read clean again" },
|
|
85
|
+
{ file: "driver/steps/register-sweep.mjs", noun: "outcome", sites: 4, atWriteSite: 2, verdict: "result",
|
|
86
|
+
why: "what a fan-in repair's dispatch answered for the axis, logged beside the slices it closed, which are counted apart" },
|
|
87
|
+
{ file: "driver/steps/open-run.mjs", noun: "outcome", sites: 3, atWriteSite: 3, verdict: "result",
|
|
88
|
+
why: "the skills-store, profile-store and engine-build receipts, each logging the result its own check returned" },
|
|
89
|
+
{ file: "driver/pipeline.mjs", noun: "outcome", sites: 3, atWriteSite: 0, verdict: "result",
|
|
78
90
|
why: "the one member that reported an invocation — taint-rerun's `r.ok ? \"ok\" : …`, which travels on a StageFailure packet — now carries a `cleared` sibling read from the taint, the remedy 10/5 -> 11/6 at the profile-store receipt's `outcome: pr.outcome`. Classified by READING ITS WRITING SITE, which is profiles.mjs and not this file: the value is one of three literals chosen by a situation the resolver decided (`overlay` and `bundled-fallback` are `pass`, `env-arrived-late` is `blocked`), never a call's return read as a verdict. `bundled-fallback` being `pass` is the point of the whole receipt — a legitimate install that nobody was told about is what this row says out loud. 11/6 -> 12/6 at the reviewing lawyer's record, where a read review whose one correction never ran prints its points with `outcome: \"not-checkable\"`: a literal the situation decides (no correction is on record to compare), never a call's return." },
|
|
79
91
|
{ file: "driver/pipeline.mjs", noun: "permanent", sites: 1, atWriteSite: 1, verdict: "result",
|
|
80
92
|
why: "`permanent.length` — a count of the classified set" },
|
|
81
|
-
{ file: "driver/
|
|
93
|
+
{ file: "driver/steps/register-sweep.mjs", noun: "recovered", sites: 3, atWriteSite: 3, verdict: "result",
|
|
82
94
|
why: "each sits on a branch reached only after the gap was cleared; one follows a `throw` that guarantees the ledger exists. "
|
|
83
95
|
+ "The two newest record what an engine-side re-issue of a missing meaning search actually brought back, counted off the rows "
|
|
84
96
|
+ "in hand at the write site rather than from anything the call promised — an attempt that recovered nothing writes 0, which "
|
|
85
97
|
+ "is the fact the disclosure downstream depends on" },
|
|
86
|
-
{ file: "driver/pipeline.mjs", noun: "settled", sites:
|
|
87
|
-
why: "counts off the union
|
|
88
|
-
{ file: "driver/
|
|
89
|
-
why: "
|
|
98
|
+
{ file: "driver/pipeline.mjs", noun: "settled", sites: 4, atWriteSite: 2, verdict: "result",
|
|
99
|
+
why: "counts off the union" },
|
|
100
|
+
{ file: "driver/steps/overview-and-cards.mjs", noun: "settled", sites: 2, atWriteSite: 2, verdict: "result",
|
|
101
|
+
why: "counts off the doubt ledger" },
|
|
102
|
+
{ file: "driver/pipeline.mjs", noun: "verified", sites: 1, atWriteSite: 1, verdict: "result",
|
|
103
|
+
why: "a measured state rather than a call returning. The house-element ownership row's `verified: receipt.verified`, which the verifier sets only where a returned register record matched the client's own name AND was live AND carried an instructed class; the lookup CALL returning is a separate field on the same receipt (`reason`), and an unanswered lookup writes this false" },
|
|
104
|
+
{ file: "driver/steps/verdict-gate.mjs", noun: "verified", sites: 3, atWriteSite: 1, verdict: "result",
|
|
105
|
+
why: "a measured state rather than a call returning. `rows.filter(r => r.verified).length`, where each row's flag is `srRecords.has(senior.uri)` — a lookup, not a call" },
|
|
90
106
|
{ file: "driver/repairs.mjs", noun: "closed", sites: 2, atWriteSite: 1, verdict: "result",
|
|
91
107
|
why: "`effect.closed`, measured against `effect.asked`" },
|
|
92
108
|
{ file: "driver/repairs.mjs", noun: "outcome", sites: 1, atWriteSite: 1, verdict: "result",
|
|
@@ -107,6 +123,7 @@ export const RESULT_NOUN_FIELDS = Object.freeze([
|
|
|
107
123
|
{ file: "driver/remedy-accounting.mjs", noun: "executed", sites: 1, atWriteSite: 0, verdict: "out-of-scope" },
|
|
108
124
|
{ file: "driver/runner.mjs", noun: "recovered", sites: 1, atWriteSite: 0, verdict: "out-of-scope" },
|
|
109
125
|
{ file: "driver/skills-store-provenance.mjs", noun: "outcome", sites: 6, atWriteSite: 0, verdict: "out-of-scope" },
|
|
126
|
+
{ file: "driver/stage-freshness.mjs", noun: "settled", sites: 1, atWriteSite: 0, verdict: "out-of-scope" },
|
|
110
127
|
{ file: "driver/status-snapshot.mjs", noun: "outcome", sites: 1, atWriteSite: 0, verdict: "out-of-scope" },
|
|
111
128
|
{ file: "mcp-server/lib/events.mjs", noun: "recovered", sites: 1, atWriteSite: 0, verdict: "out-of-scope" },
|
|
112
129
|
// Read at the writing site, as this table requires. All three sites are in `knockoutSearches`, a
|