2sagaco48 1.0.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/diagnostics.mjs +141 -0
- package/dist/compute.worker-j5ahIpF-.js +1 -0
- package/dist/graph.worker-DG6iGCB9.js +1 -0
- package/dist/index.html +2314 -0
- package/flatten-guide.md +248 -0
- package/index.html +12 -0
- package/package.json +38 -0
- package/src/App.orig.tsx +204 -0
- package/src/App.orig1.tsx +27 -0
- package/src/App.orig2.tsx +25 -0
- package/src/App.tsx +3 -0
- package/src/BaseApp.tsx +18 -0
- package/src/INTEGRATION_LEDGER.md +22 -0
- package/src/PERSIST_CANARY.orig.txt +1 -0
- package/src/PERSIST_CANARY.txt +1 -0
- package/src/REGRESSION_LEDGER.md +651 -0
- package/src/TEMPLATE_PIPELINE_AUDIT.md +208 -0
- package/src/WILLIAMS_PERSONA_GUIDE.md +62 -0
- package/src/chat/VeritasChat.tsx +69 -0
- package/src/chat/synthesis.ts +31 -0
- package/src/chat/tier.ts +45 -0
- package/src/components/AdaptersPage.orig.tsx +99 -0
- package/src/components/AdaptersPage.tsx +3 -0
- package/src/components/AdversarialPanel.tsx +136 -0
- package/src/components/AnchorBaselinePanel.tsx +75 -0
- package/src/components/AnswerPanel.tsx +60 -0
- package/src/components/ArtifactPanel.tsx +43 -0
- package/src/components/ChatApp.orig.tsx +1582 -0
- package/src/components/ChatApp.orig1.tsx +722 -0
- package/src/components/ChatApp.tsx +95 -0
- package/src/components/ChatAugmentPanels.tsx +73 -0
- package/src/components/CitationLedgerPanel.tsx +313 -0
- package/src/components/ComputeSandboxPanel.tsx +130 -0
- package/src/components/ConfigPanel.tsx +110 -0
- package/src/components/ControlPlanePage.tsx +195 -0
- package/src/components/CreativeTreeLifePage.tsx +234 -0
- package/src/components/CreativeTreeOfLifePanel.tsx +149 -0
- package/src/components/DebugTracePanel.tsx +137 -0
- package/src/components/DeepReasoningTrace.tsx +48 -0
- package/src/components/EntitySheetPanel.tsx +51 -0
- package/src/components/FailureModesPanel.tsx +104 -0
- package/src/components/GBSDashboard.tsx +239 -0
- package/src/components/GraphView.tsx +116 -0
- package/src/components/HUD.tsx +125 -0
- package/src/components/HypothesisPanel.tsx +67 -0
- package/src/components/InnovationGenomeEngine.tsx +792 -0
- package/src/components/InnovationPersonaGuide.tsx +348 -0
- package/src/components/InnovationPersonaPanel.tsx +289 -0
- package/src/components/LiveResourceHUD.tsx +109 -0
- package/src/components/LongWriterPanel.tsx +112 -0
- package/src/components/MainPipelineV10Bridge.tsx +72 -0
- package/src/components/MarkdownLite.tsx +63 -0
- package/src/components/MemoryInspector.tsx +38 -0
- package/src/components/MemoryMonitor.tsx +52 -0
- package/src/components/MemoryStressPanel.tsx +176 -0
- package/src/components/ModulesPage.tsx +171 -0
- package/src/components/PipelineDebugConsole.orig.tsx +1856 -0
- package/src/components/PipelineDebugConsole.tsx +3 -0
- package/src/components/PreFlightHUD.tsx +67 -0
- package/src/components/PrismaFetchTracePanel.tsx +87 -0
- package/src/components/ReportOSPanel.tsx +165 -0
- package/src/components/ResourceEstimatorPage.tsx +327 -0
- package/src/components/RichText.tsx +181 -0
- package/src/components/SagaOsPanel.tsx +605 -0
- package/src/components/SagaOsReference.tsx +421 -0
- package/src/components/SagaOsV2Panel.tsx +594 -0
- package/src/components/SagaStyleTab.tsx +382 -0
- package/src/components/SageBlueprintPanel.tsx +416 -0
- package/src/components/SharedChatInput.tsx +77 -0
- package/src/components/StatFinancePanel.tsx +190 -0
- package/src/components/StylePersonaPanel.tsx +128 -0
- package/src/components/TemplatesPage.tsx +300 -0
- package/src/components/TestPanel.tsx +63 -0
- package/src/components/TraceLog.tsx +89 -0
- package/src/components/V15CalibrationAugment.tsx +1134 -0
- package/src/components/V15CalibrationDialog.tsx +1871 -0
- package/src/components/V15Overlay.orig.tsx +120 -0
- package/src/components/V15Overlay.tsx +4 -0
- package/src/components/V15OverlayWrapper.tsx +362 -0
- package/src/components/V15Toggle.tsx +34 -0
- package/src/console/DiagnosticRecoveryPanel.tsx +358 -0
- package/src/console/EngineeringConsole.tsx +103 -0
- package/src/console/FictionSystemPanels.tsx +882 -0
- package/src/console/InspectorPanels.tsx +254 -0
- package/src/console/ManuscriptGraderPanel.tsx +182 -0
- package/src/console/RecursiveReviserPanel.tsx +245 -0
- package/src/console/SeedControlPanel.tsx +135 -0
- package/src/console/StoryControllerPanel.tsx +443 -0
- package/src/console/engineBridge.ts +258 -0
- package/src/console/gemini.ts +106 -0
- package/src/console/grading.ts +250 -0
- package/src/console/util.ts +45 -0
- package/src/fiction/continuity.ts +372 -0
- package/src/fiction/crash-protection.ts +111 -0
- package/src/fiction/diagnostics.ts +208 -0
- package/src/fiction/diff.ts +74 -0
- package/src/fiction/entity-state-machine.ts +214 -0
- package/src/fiction/nive-engine.ts +404 -0
- package/src/fiction/pipeline-selftest.ts +132 -0
- package/src/fiction/seed-control.ts +193 -0
- package/src/fiction/story-engine.ts +326 -0
- package/src/fiction/types.ts +68 -0
- package/src/flatten-guide.md +379 -0
- package/src/index.css +14 -0
- package/src/index.orig.css +13 -0
- package/src/lib/academic-sources.base.ts +188 -0
- package/src/lib/academic-sources.orig.ts +28 -0
- package/src/lib/academic-sources.ts +10 -0
- package/src/lib/advanced-math.ts +119 -0
- package/src/lib/adversarial-engine.base.ts +409 -0
- package/src/lib/adversarial-engine.ts +82 -0
- package/src/lib/ai-revision.ts +623 -0
- package/src/lib/app-state.tsx +426 -0
- package/src/lib/artifact-registry.ts +97 -0
- package/src/lib/artifacts.ts +180 -0
- package/src/lib/atlas-dr.ts +167 -0
- package/src/lib/browser-mtls.ts +127 -0
- package/src/lib/browser-queue.ts +221 -0
- package/src/lib/browser-search-scraper.base.ts +382 -0
- package/src/lib/browser-search-scraper.orig.ts +90 -0
- package/src/lib/browser-search-scraper.ts +10 -0
- package/src/lib/calc-interceptor.ts +82 -0
- package/src/lib/citation-lane-tap.ts +78 -0
- package/src/lib/citation-ledger-store.ts +369 -0
- package/src/lib/citation-ledger.ts +203 -0
- package/src/lib/compute-sandbox.ts +215 -0
- package/src/lib/compute.worker.ts +153 -0
- package/src/lib/connectors/gemini.ts +120 -0
- package/src/lib/connectors/jina.ts +233 -0
- package/src/lib/connectors/marketdata.ts +51 -0
- package/src/lib/connectors/prismafetch.base.ts +175 -0
- package/src/lib/connectors/prismafetch.ts +1 -0
- package/src/lib/connectors/serpapi.ts +65 -0
- package/src/lib/connectors/wikidata.ts +44 -0
- package/src/lib/constraints.ts +331 -0
- package/src/lib/continuation-detector.base.ts +153 -0
- package/src/lib/continuation-detector.ts +48 -0
- package/src/lib/contradraft.ts +168 -0
- package/src/lib/cors-proxy.ts +120 -0
- package/src/lib/coverage.ts +81 -0
- package/src/lib/debug/architecture-prescription.ts +556 -0
- package/src/lib/debug/covea-repair.ts +543 -0
- package/src/lib/debug/helios-ground.ts +319 -0
- package/src/lib/debug/intent-decomposer.ts +281 -0
- package/src/lib/debug/intent-lattice.ts +349 -0
- package/src/lib/debug/pipeline-diagnosis.ts +1149 -0
- package/src/lib/debug/pipeline-trace-bus.ts +424 -0
- package/src/lib/debug/prompt-forge.ts +678 -0
- package/src/lib/debug/repair-sites.ts +513 -0
- package/src/lib/debug/research-phase.ts +266 -0
- package/src/lib/debug/retrieval-context.ts +76 -0
- package/src/lib/debug/retrieval-hardener.ts +142 -0
- package/src/lib/debug/scraper-debug-runner.ts +576 -0
- package/src/lib/debug/scraper-forensics.ts +418 -0
- package/src/lib/debug/scraper-lane-roadmap.ts +136 -0
- package/src/lib/debug/self-test.ts +415 -0
- package/src/lib/debug/step-attribution.ts +211 -0
- package/src/lib/debug/template-rubric.ts +301 -0
- package/src/lib/debug/unified-innovation.ts +126 -0
- package/src/lib/debug/veritas-hybrid-scraper.ts +335 -0
- package/src/lib/defense-registry.ts +104 -0
- package/src/lib/defenses.ts +162 -0
- package/src/lib/deterministic-citation-ledger.ts +174 -0
- package/src/lib/elo-registry.base.ts +117 -0
- package/src/lib/elo-registry.ts +1 -0
- package/src/lib/entity-resolver.ts +291 -0
- package/src/lib/failure-modes.ts +267 -0
- package/src/lib/feature-registry.ts +69 -0
- package/src/lib/flaw-registry.ts +143 -0
- package/src/lib/flaws/_template.ts +52 -0
- package/src/lib/flaws/builtins.ts +63 -0
- package/src/lib/flaws/finance.ts +169 -0
- package/src/lib/flaws/fixers.ts +10 -0
- package/src/lib/flaws/index.ts +32 -0
- package/src/lib/flaws/legal.ts +157 -0
- package/src/lib/flaws/medical.ts +188 -0
- package/src/lib/flaws/original-defenses-pack.ts +81 -0
- package/src/lib/flaws/sample-declarative-pack.json +38 -0
- package/src/lib/flaws/selftest.ts +201 -0
- package/src/lib/flaws/software-extended.ts +125 -0
- package/src/lib/flaws/software-rn-webgl.ts +182 -0
- package/src/lib/flaws/statistics-advanced.ts +46 -0
- package/src/lib/flaws/statistics.ts +61 -0
- package/src/lib/gbse/config.ts +20 -0
- package/src/lib/gbse/engine.ts +226 -0
- package/src/lib/gbse/graph.ts +118 -0
- package/src/lib/gbse/graph.worker.ts +21 -0
- package/src/lib/gbse/tests.ts +117 -0
- package/src/lib/gbse/tiers.ts +65 -0
- package/src/lib/gbse/types.ts +94 -0
- package/src/lib/innovation-genome-engine-v2.orig.ts +1001 -0
- package/src/lib/innovation-genome-engine-v2.ts +3 -0
- package/src/lib/innovation-genome-engine.orig.ts +330 -0
- package/src/lib/innovation-genome-engine.ts +3 -0
- package/src/lib/innovation-genome-v10.orig.ts +314 -0
- package/src/lib/innovation-genome-v10.ts +2 -0
- package/src/lib/innovation-genome-v3.orig.ts +2015 -0
- package/src/lib/innovation-genome-v3.ts +2 -0
- package/src/lib/innovation-genome-v4.orig.ts +1959 -0
- package/src/lib/innovation-genome-v4.ts +2 -0
- package/src/lib/innovation-genome-v5.orig.ts +1210 -0
- package/src/lib/innovation-genome-v5.ts +2 -0
- package/src/lib/innovation-genome-v7.orig.ts +2549 -0
- package/src/lib/innovation-genome-v7.ts +2 -0
- package/src/lib/innovation-genome-v8.orig.ts +1485 -0
- package/src/lib/innovation-genome-v8.ts +2 -0
- package/src/lib/innovation-genome-v9.orig.ts +643 -0
- package/src/lib/innovation-genome-v9.ts +2 -0
- package/src/lib/jina.base.ts +293 -0
- package/src/lib/jina.ts +1 -0
- package/src/lib/live-telemetry.ts +61 -0
- package/src/lib/longwriter.ts +84 -0
- package/src/lib/manuscript-grade-v2.ts +298 -0
- package/src/lib/memory-governor.ts +173 -0
- package/src/lib/memory-stress-tests.ts +248 -0
- package/src/lib/model-intelligence.ts +48 -0
- package/src/lib/model-rotator.ts +75 -0
- package/src/lib/models.orig.ts +513 -0
- package/src/lib/models.ts +151 -0
- package/src/lib/n-deep.base.ts +592 -0
- package/src/lib/n-deep.ts +51 -0
- package/src/lib/nih-simulator.ts +56 -0
- package/src/lib/nih-vulnerability-fixes.ts +460 -0
- package/src/lib/omega-templates.base.ts +294 -0
- package/src/lib/omega-templates.ts +225 -0
- package/src/lib/omni-nexus.ts +64 -0
- package/src/lib/oracle-adapters.ts +67 -0
- package/src/lib/oracle-registry.ts +163 -0
- package/src/lib/orchestrator.ts +357 -0
- package/src/lib/output-boundary.ts +235 -0
- package/src/lib/overrides/vite-native-chaos-harness.ts +154 -0
- package/src/lib/overrides/vite-native-contract-plane.ts +245 -0
- package/src/lib/overrides/vite-native-doctor-plane.ts +208 -0
- package/src/lib/overrides/vite-native-knowledge-store.ts +267 -0
- package/src/lib/overrides/vite-native-policy-plane.ts +190 -0
- package/src/lib/overrides/vite-native-replay-plane.ts +197 -0
- package/src/lib/overrides/vite-native-runtime-plane.ts +106 -0
- package/src/lib/overrides/vite-native-scraper.ts +848 -0
- package/src/lib/overrides/vite-native-selftest-functional.ts +217 -0
- package/src/lib/overrides/vite-native-selftest.ts +183 -0
- package/src/lib/overrides/vite-native-snapshot-plane.ts +123 -0
- package/src/lib/philosophy-toolkit.ts +75 -0
- package/src/lib/pipeline.orig.ts +659 -0
- package/src/lib/pipeline.ts +42 -0
- package/src/lib/precache.ts +128 -0
- package/src/lib/py-sandbox.ts +205 -0
- package/src/lib/quality-score.ts +96 -0
- package/src/lib/quant-engine.ts +231 -0
- package/src/lib/quant-lib.ts +80 -0
- package/src/lib/reportos.ts +175 -0
- package/src/lib/research-os.ts +306 -0
- package/src/lib/resource-estimator.ts +114 -0
- package/src/lib/rpm-governor.ts +93 -0
- package/src/lib/runtime-estimator.ts +135 -0
- package/src/lib/sage/empty-space-v6.ts +560 -0
- package/src/lib/sage/empty-space-v7.ts +222 -0
- package/src/lib/sage/empty-space.ts +733 -0
- package/src/lib/sage/engine.ts +786 -0
- package/src/lib/sage/index.ts +17 -0
- package/src/lib/sage/judge.ts +246 -0
- package/src/lib/sage/prng.ts +53 -0
- package/src/lib/sage/reality-grounding.ts +380 -0
- package/src/lib/sage/repetition.ts +151 -0
- package/src/lib/sage/saga-os-v2-engines.ts +1870 -0
- package/src/lib/sage/saga-os-v2.ts +274 -0
- package/src/lib/sage/saga-os-v3-core.ts +1491 -0
- package/src/lib/sage/saga-os-v3-release.ts +739 -0
- package/src/lib/sage/saga-os-v4-aureate.ts +1161 -0
- package/src/lib/sage/saga-os-v4.ts +212 -0
- package/src/lib/sage/saga-os-v5.ts +205 -0
- package/src/lib/sage/saga-os-v6.ts +346 -0
- package/src/lib/sage/saga-os-v7.ts +314 -0
- package/src/lib/sage/saga-os-v8.ts +505 -0
- package/src/lib/sage/saga-os.ts +329 -0
- package/src/lib/sage/taxonomy.ts +403 -0
- package/src/lib/sage/unified-roll.ts +524 -0
- package/src/lib/sage/worked-sketches.ts +44 -0
- package/src/lib/sage.ts +166 -0
- package/src/lib/scraper-debug-bus.ts +53 -0
- package/src/lib/scraper-enhanced.orig.ts +153 -0
- package/src/lib/scraper-enhanced.ts +10 -0
- package/src/lib/scraper-hardener.base.orig.ts +155 -0
- package/src/lib/scraper-hardener.base.ts +317 -0
- package/src/lib/scraper-hardener.ts +1 -0
- package/src/lib/scraper-palisade/palisade-adjudicator.orig.ts +419 -0
- package/src/lib/scraper-palisade/palisade-adjudicator.ts +13 -0
- package/src/lib/scraper-vnext/arbiter-omega.orig.ts +688 -0
- package/src/lib/scraper-vnext/arbiter-omega.ts +13 -0
- package/src/lib/scraper-vnext/canonical-portfolio-augments.ts +479 -0
- package/src/lib/scraper-vnext/canonical-portfolio-orchestrator.orig.ts +1529 -0
- package/src/lib/scraper-vnext/canonical-portfolio-orchestrator.ts +13 -0
- package/src/lib/scraper-vnext/conclave-omega.ts +1830 -0
- package/src/lib/scraper-vnext/content-extractor-v2.ts +226 -0
- package/src/lib/scraper-vnext/diagnostics-suite.ts +36 -0
- package/src/lib/scraper-vnext/epistemic-packer.ts +97 -0
- package/src/lib/scraper-vnext/fusion-v2.ts +65 -0
- package/src/lib/scraper-vnext/hydra-reader.orig.ts +1216 -0
- package/src/lib/scraper-vnext/hydra-reader.ts +13 -0
- package/src/lib/scraper-vnext/native-scraper-browser-vnext.orig.ts +91 -0
- package/src/lib/scraper-vnext/native-scraper-browser-vnext.ts +13 -0
- package/src/lib/scraper-vnext/nexus-consensus.orig.ts +905 -0
- package/src/lib/scraper-vnext/nexus-consensus.ts +13 -0
- package/src/lib/scraper-vnext/portfolio-consensus-adjudicator.ts +804 -0
- package/src/lib/scraper-vnext/portfolio-consensus-memory.ts +377 -0
- package/src/lib/scraper-vnext/portfolio-terminal-governor.ts +548 -0
- package/src/lib/scraper-vnext/query-strategist.orig.ts +224 -0
- package/src/lib/scraper-vnext/query-strategist.ts +423 -0
- package/src/lib/scraper-vnext/retrieval-accelerator.ts +708 -0
- package/src/lib/scraper-vnext/retrieval-audit-augments.ts +477 -0
- package/src/lib/scraper-vnext/retrieval-control-plane.ts +904 -0
- package/src/lib/scraper-vnext/retrieval-policy-augments.ts +358 -0
- package/src/lib/scraper-vnext/safe-fetch-v2.ts +157 -0
- package/src/lib/scraper-vnext/sentinel-omega.ts +56 -0
- package/src/lib/scraper-vnext/sentinel-orchestrator.ts +69 -0
- package/src/lib/scraper-vnext/sibyl-oracle.orig.ts +413 -0
- package/src/lib/scraper-vnext/sibyl-oracle.ts +13 -0
- package/src/lib/scraper-vnext/smart-read-v2.ts +55 -0
- package/src/lib/scraper-vnext/spa-rescue-bridge.ts +608 -0
- package/src/lib/scraper-vnext/strata-engine.orig.ts +2666 -0
- package/src/lib/scraper-vnext/strata-engine.ts +13 -0
- package/src/lib/scraper-vnext/structured-source-adapter.orig.ts +369 -0
- package/src/lib/scraper-vnext/structured-source-adapter.ts +34 -0
- package/src/lib/scraper-vnext/terminal-complete.ts +224 -0
- package/src/lib/scraper-vnext/terminal-final.ts +277 -0
- package/src/lib/scraper-vnext/terminal-saturation.ts +345 -0
- package/src/lib/scraper-vnext/terminal-wire.ts +425 -0
- package/src/lib/scraper-vnext/vanguard-titanium.orig.ts +467 -0
- package/src/lib/scraper-vnext/vanguard-titanium.ts +17 -0
- package/src/lib/search-cache.ts +138 -0
- package/src/lib/sloop-runner.base.ts +223 -0
- package/src/lib/sloop-runner.ts +104 -0
- package/src/lib/sloop.ts +114 -0
- package/src/lib/small-model-adapters.ts +82 -0
- package/src/lib/sscp.ts +86 -0
- package/src/lib/system-map.ts +54 -0
- package/src/lib/uni-node.ts +86 -0
- package/src/lib/universal-rigor-guard.ts +433 -0
- package/src/lib/v15-gate-testbed.ts +274 -0
- package/src/lib/v15-gemini.base.ts +89 -0
- package/src/lib/v15-gemini.ts +1 -0
- package/src/lib/v15-grounding.orig.ts +241 -0
- package/src/lib/v15-grounding.ts +79 -0
- package/src/lib/v15-pipeline.base.ts +769 -0
- package/src/lib/v15-pipeline.orig.ts +1154 -0
- package/src/lib/v15-pipeline.ts +674 -0
- package/src/lib/v15-questions.ts +64 -0
- package/src/lib/v15-rate-limiter.orig.ts +91 -0
- package/src/lib/v15-rate-limiter.ts +48 -0
- package/src/lib/v15-state.base.ts +87 -0
- package/src/lib/v15-state.ts +28 -0
- package/src/lib/visual-table-generator.tsx +207 -0
- package/src/lib/wasm-runtime.ts +133 -0
- package/src/lib/williams-persona-guide.ts +265 -0
- package/src/lib/williams-style.base.ts +464 -0
- package/src/lib/williams-style.ts +59 -0
- package/src/lib/worker-pool.ts +96 -0
- package/src/lib/writing-tiers.ts +125 -0
- package/src/main.orig.tsx +10 -0
- package/src/main.tsx +10 -0
- package/src/utils/cn.orig.ts +6 -0
- package/src/utils/cn.ts +6 -0
- package/src/vite-env.d.ts +1 -0
- package/tsconfig.json +31 -0
- package/unify.mjs +537 -0
- package/vite.config.ts +18 -0
|
@@ -0,0 +1,556 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* architecture-prescription.ts — NET-NEW (Type C). See flatten-guide.md.
|
|
3
|
+
* ===========================================================================
|
|
4
|
+
* "WHAT ARCHITECTURE DO I ACTUALLY NEED TO SCORE 9+ EVERY TIME?"
|
|
5
|
+
*
|
|
6
|
+
* This is NOT the defect list (that is pipeline-diagnosis.ts). A defect list
|
|
7
|
+
* tells you what went wrong in ONE run. This tells you which ARCHITECTURAL
|
|
8
|
+
* COMPONENTS must exist for 9+ to be reachable AT ALL, independent of run.
|
|
9
|
+
*
|
|
10
|
+
* ═══ THE CEILING MODEL (why this is not "sum of lifts") ═══
|
|
11
|
+
* Prior turns reported `expectedLift` per defect and implicitly summed them.
|
|
12
|
+
* That model is WRONG and it is why the projections never matched reality.
|
|
13
|
+
*
|
|
14
|
+
* The correct model is a MINIMUM OF CEILINGS:
|
|
15
|
+
*
|
|
16
|
+
* achievable_score = min( ceilingWithout(c) : c ∈ ABSENT_COMPONENTS )
|
|
17
|
+
*
|
|
18
|
+
* Rationale: these components are not additive contributors, they are
|
|
19
|
+
* PRECONDITIONS. If retrieval emits `source-3` as a URL, then no downstream
|
|
20
|
+
* repair, no judge, and no template enforcement can produce a 9 — the report
|
|
21
|
+
* is structurally uncitable. Adding a better repair pass to a run with broken
|
|
22
|
+
* provenance does not move the ceiling at all. That is a min, not a sum.
|
|
23
|
+
*
|
|
24
|
+
* Empirical support from the supplied logs (4 runs):
|
|
25
|
+
* guard 4.4 — provenance broken + repair broken + depth abandoned
|
|
26
|
+
* guard 4.88 — provenance broken + repair broken
|
|
27
|
+
* guard 6.25 — provenance broken, repair contained by COVEA
|
|
28
|
+
* guard 8.1 — provenance mostly OK (9/21 real URLs), repair contained
|
|
29
|
+
* In every case the observed score tracks the WEAKEST present precondition,
|
|
30
|
+
* never the sum of the fixed ones. `ceilingWithout` values below are fitted
|
|
31
|
+
* to those four observations and are declared as ESTIMATES, not measurements.
|
|
32
|
+
*
|
|
33
|
+
* ═══ HONESTY ═══
|
|
34
|
+
* `ceilingWithout` is a calibrated estimate from 4 runs. It is not a measured
|
|
35
|
+
* bound. `detect()` is exact — it reads the run record. Never present a
|
|
36
|
+
* projected ceiling as an achieved score.
|
|
37
|
+
* ===========================================================================
|
|
38
|
+
*/
|
|
39
|
+
import type { RunRecord } from "@/lib/debug/pipeline-trace-bus";
|
|
40
|
+
import { buildForensics, isPlaceholderUrl } from "@/lib/debug/scraper-forensics";
|
|
41
|
+
import { loadTemplateRubric } from "@/lib/debug/template-rubric";
|
|
42
|
+
|
|
43
|
+
export type Plane = "retrieval" | "synthesis" | "repair" | "evaluation";
|
|
44
|
+
export type Presence = "present" | "absent" | "degraded" | "unmeasured";
|
|
45
|
+
|
|
46
|
+
export interface ArchPatch {
|
|
47
|
+
/** Where the change lives. Workspace paths are applicable today. */
|
|
48
|
+
file: string;
|
|
49
|
+
/** Verbatim anchor string in that file (durable across line drift). */
|
|
50
|
+
anchor: string;
|
|
51
|
+
/** What to change, in code terms. */
|
|
52
|
+
change: string;
|
|
53
|
+
/** Predicate that must hold after the change. */
|
|
54
|
+
verify: string;
|
|
55
|
+
/** True when this can be done in src/ without materialize.mjs. */
|
|
56
|
+
workspaceReachable: boolean;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface ArchComponent {
|
|
60
|
+
id: string;
|
|
61
|
+
plane: Plane;
|
|
62
|
+
name: string;
|
|
63
|
+
/** One sentence: what this component guarantees. */
|
|
64
|
+
guarantees: string;
|
|
65
|
+
/**
|
|
66
|
+
* Estimated hard ceiling on the guard score when this component is ABSENT.
|
|
67
|
+
* Calibrated from 4 observed runs — an estimate, not a measured bound.
|
|
68
|
+
*/
|
|
69
|
+
ceilingWithout: number;
|
|
70
|
+
/** Exact detection against a run record. Returns presence + evidence. */
|
|
71
|
+
detect: (run: RunRecord) => { presence: Presence; evidence: string };
|
|
72
|
+
/** The patch that installs this component. */
|
|
73
|
+
patch: ArchPatch;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// ── Detection helpers (pure, read-only) ────────────────────────────────────
|
|
77
|
+
|
|
78
|
+
function outcomeOf(run: RunRecord): Record<string, any> {
|
|
79
|
+
return (run.output ?? {}) as Record<string, any>;
|
|
80
|
+
}
|
|
81
|
+
function finalTextOf(run: RunRecord): string {
|
|
82
|
+
return run.finalText ?? "";
|
|
83
|
+
}
|
|
84
|
+
function hasEvent(run: RunRecord, re: RegExp): boolean {
|
|
85
|
+
return run.events.some((e) => re.test(e.message));
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
89
|
+
// THE SPEC — ordered by ceiling (lowest ceiling = most blocking = fix first)
|
|
90
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
91
|
+
|
|
92
|
+
export const ARCHITECTURE_SPEC: ArchComponent[] = [
|
|
93
|
+
// ── RETRIEVAL PLANE ──────────────────────────────────────────────────────
|
|
94
|
+
{
|
|
95
|
+
id: "url-backed-provenance",
|
|
96
|
+
plane: "retrieval",
|
|
97
|
+
name: "URL-Backed Provenance",
|
|
98
|
+
guarantees: "Every ledger entry carries a resolvable absolute http(s) URL. A claim atom is never emitted as if it were a document.",
|
|
99
|
+
ceilingWithout: 6.0,
|
|
100
|
+
detect: (run) => {
|
|
101
|
+
const entries = outcomeOf(run)?.citationAudit?.entries as Array<{ url?: string }> | undefined;
|
|
102
|
+
if (!Array.isArray(entries) || entries.length === 0) {
|
|
103
|
+
return { presence: "unmeasured", evidence: "no citationAudit.entries on this run" };
|
|
104
|
+
}
|
|
105
|
+
const bad = entries.filter((e) => isPlaceholderUrl(e.url));
|
|
106
|
+
if (bad.length === 0) return { presence: "present", evidence: `${entries.length}/${entries.length} entries URL-backed` };
|
|
107
|
+
return {
|
|
108
|
+
presence: bad.length === entries.length ? "absent" : "degraded",
|
|
109
|
+
evidence: `${bad.length}/${entries.length} entries are non-resolvable (source-N / *-attested)`,
|
|
110
|
+
};
|
|
111
|
+
},
|
|
112
|
+
patch: {
|
|
113
|
+
file: "src/lib/scraper-vnext/vanguard-titanium.ts + src/lib/scraper-palisade/palisade-adjudicator.ts",
|
|
114
|
+
anchor: "workspaceProvenanceRejected",
|
|
115
|
+
change:
|
|
116
|
+
"The package still maps vanguard/palisade atoms to `source-N`. Workspace wrappers now preserve both lanes for diagnostics but force `ok=false`, so those mapping branches cannot terminate the chain; grounding falls through to URL-bearing arbiter and later lanes. COVEA remains the post-pass backstop.",
|
|
117
|
+
verify: "citationAudit.entries.every(e => /^https?:\\/\\//.test(e.url)) === true",
|
|
118
|
+
workspaceReachable: true,
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
id: "yield-gated-acceptance",
|
|
123
|
+
plane: "retrieval",
|
|
124
|
+
name: "Yield-Gated Tier Acceptance",
|
|
125
|
+
guarantees: "A retrieval tier is accepted only when it packed at least one real DOCUMENT, never on epistemic-atom count alone.",
|
|
126
|
+
ceilingWithout: 6.5,
|
|
127
|
+
detect: (run) => {
|
|
128
|
+
let f;
|
|
129
|
+
try { f = buildForensics(run); } catch { return { presence: "unmeasured", evidence: "forensics unavailable" }; }
|
|
130
|
+
if (f.lanes.length === 0) return { presence: "unmeasured", evidence: "no lane telemetry" };
|
|
131
|
+
if (f.zeroYieldLanes.length === 0) return { presence: "present", evidence: `${f.lanes.length} lanes, 0 zero-yield` };
|
|
132
|
+
return {
|
|
133
|
+
presence: "absent",
|
|
134
|
+
evidence: `${f.zeroYieldLanes.length} lane(s) packed atoms with 0 sources: ${f.zeroYieldLanes.slice(0, 3).map((l) => `${l.lane}[${l.section ?? "-"}] ${l.atomsPacked}a/0s`).join(", ")}`,
|
|
135
|
+
};
|
|
136
|
+
},
|
|
137
|
+
patch: {
|
|
138
|
+
file: "src/lib/scraper-vnext/vanguard-titanium.ts",
|
|
139
|
+
anchor: "workspaceYieldRejected",
|
|
140
|
+
change:
|
|
141
|
+
"Workspace wrapper now forces vanguard `ok=false` after recording atoms/source counts, preventing atom-only terminal success. Palisade wrapper similarly forces URL-bearing fallthrough because package mapping would synthesize `source-N`.",
|
|
142
|
+
verify: "No lane may report `+N source(s)` for a section while its own telemetry reports `0 sources packed`.",
|
|
143
|
+
workspaceReachable: true,
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
id: "intent-decomposition",
|
|
148
|
+
plane: "retrieval",
|
|
149
|
+
name: "Intent Facet Lattice (per-section query synthesis)",
|
|
150
|
+
guarantees: "Each template section dispatches its own high-signal, domain-anchored keyword query. The raw or truncated user prompt is never used as a search string.",
|
|
151
|
+
ceilingWithout: 7.0,
|
|
152
|
+
detect: (run) => {
|
|
153
|
+
const lattice = hasEvent(run, /Intent Facet Lattice/i);
|
|
154
|
+
const boundary = hasEvent(run, /workspace-relevance-gate|workspace-yield-gate|workspace-provenance-gate/i);
|
|
155
|
+
if (lattice && boundary) {
|
|
156
|
+
const ev = run.events.find((e) => /Intent Facet Lattice/i.test(e.message));
|
|
157
|
+
return { presence: "present", evidence: `${ev?.message ?? "lattice event present"}; lane-boundary gate observed` };
|
|
158
|
+
}
|
|
159
|
+
if (lattice) {
|
|
160
|
+
return { presence: "degraded", evidence: "lattice built, but no lane-boundary workspace gate was observed — prompt-envelope injection alone may be sliced by package query builder" };
|
|
161
|
+
}
|
|
162
|
+
return { presence: "absent", evidence: "no `Intent Facet Lattice` event — grounding received the raw prompt" };
|
|
163
|
+
},
|
|
164
|
+
patch: {
|
|
165
|
+
file: "src/lib/v15-pipeline.ts",
|
|
166
|
+
anchor: "await injectIntentLattice(opts, runId, originalQuestion)",
|
|
167
|
+
change:
|
|
168
|
+
"Build the lattice from the UNTRUNCATED prompt via `buildLatticeQueries`, optionally enrich with `enrichLatticeWithLlm` (fails safe to the deterministic floor), and splice `renderLatticeDirective(lattice)` into the question envelope before the genome block.",
|
|
169
|
+
verify: "Every dispatched grounding query differs from the raw prompt and contains the domain anchor token.",
|
|
170
|
+
workspaceReachable: true,
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
id: "relevance-floor",
|
|
175
|
+
plane: "retrieval",
|
|
176
|
+
name: "Lexical Relevance Floor",
|
|
177
|
+
guarantees: "A source is admitted only if it shares content tokens with the dispatching query. Length alone (>=80 chars) is not admission.",
|
|
178
|
+
ceilingWithout: 7.0,
|
|
179
|
+
detect: (run) => {
|
|
180
|
+
const entries = outcomeOf(run)?.citationAudit?.entries as Array<{ title?: string; snippet?: string }> | undefined;
|
|
181
|
+
if (!Array.isArray(entries) || entries.length === 0) return { presence: "unmeasured", evidence: "no ledger entries" };
|
|
182
|
+
const qTok = new Set((run.question || "").toLowerCase().match(/[a-z]{4,}/g) ?? []);
|
|
183
|
+
if (qTok.size < 3) return { presence: "unmeasured", evidence: "question too short to score overlap" };
|
|
184
|
+
const irrelevant = entries.filter((e) => {
|
|
185
|
+
const hay = `${e.title ?? ""} ${e.snippet ?? ""}`.toLowerCase();
|
|
186
|
+
if (hay.trim().length < 20) return false;
|
|
187
|
+
return ![...qTok].some((t) => hay.includes(t));
|
|
188
|
+
});
|
|
189
|
+
if (irrelevant.length === 0) return { presence: "present", evidence: `all ${entries.length} entries share ≥1 question token` };
|
|
190
|
+
return {
|
|
191
|
+
presence: "absent",
|
|
192
|
+
evidence: `${irrelevant.length}/${entries.length} admitted sources share ZERO content words with the question: ${irrelevant.slice(0, 2).map((e) => `"${String(e.title ?? "").slice(0, 50)}"`).join(", ")}`,
|
|
193
|
+
};
|
|
194
|
+
},
|
|
195
|
+
patch: {
|
|
196
|
+
file: "src/lib/debug/retrieval-hardener.ts + src/lib/scraper-vnext/* lane wrappers",
|
|
197
|
+
anchor: "filterRelevantSources",
|
|
198
|
+
change:
|
|
199
|
+
"All alias-reachable lanes now receive a whole-token IFL query and filter their returned sources by absolute URL, content length, quarantine status, facetCoherence>=0.2, and known drift signatures before the package can accept them.",
|
|
200
|
+
verify: "No admitted source may score facetCoherence < 0.2 against its dispatching lattice query.",
|
|
201
|
+
workspaceReachable: true,
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
id: "evidence-starvation-gate",
|
|
206
|
+
plane: "retrieval",
|
|
207
|
+
name: "Evidence-Starvation Fail-Closed",
|
|
208
|
+
guarantees: "A section with zero URL-backed sources emits an explicit data gap instead of confident unsourced prose.",
|
|
209
|
+
ceilingWithout: 6.5,
|
|
210
|
+
detect: (run) => {
|
|
211
|
+
const txt = finalTextOf(run);
|
|
212
|
+
if (hasEvent(run, /EVIDENCE_STARVED/i) || /\[EVIDENCE_STARVED\]/i.test(txt)) {
|
|
213
|
+
return { presence: "present", evidence: "evidence-starvation marker observed" };
|
|
214
|
+
}
|
|
215
|
+
let f;
|
|
216
|
+
try { f = buildForensics(run); } catch { return { presence: "unmeasured", evidence: "forensics unavailable" }; }
|
|
217
|
+
if (f.totals.realUrlCount === 0 && f.totals.ledgerEntries > 0) {
|
|
218
|
+
return { presence: "absent", evidence: `${f.totals.ledgerEntries} ledger entries, 0 real URLs, and no EVIDENCE_STARVED marker was emitted` };
|
|
219
|
+
}
|
|
220
|
+
return { presence: "present", evidence: "no starved section detected this run" };
|
|
221
|
+
},
|
|
222
|
+
patch: {
|
|
223
|
+
file: "src/lib/v15-grounding.ts",
|
|
224
|
+
anchor: "EVIDENCE_STARVED",
|
|
225
|
+
change:
|
|
226
|
+
"Alias seam already fails closed (returns ok:false, sources:[]). The package V15 draft path imports grounding RELATIVELY so it bypasses this seam; the durable no-materialize cover is `annotateEvidenceStarvedSections` applied post-pass.",
|
|
227
|
+
verify: "A section with 0 URL-backed sources must carry an [EVIDENCE_STARVED] annotation in the final text.",
|
|
228
|
+
workspaceReachable: true,
|
|
229
|
+
},
|
|
230
|
+
},
|
|
231
|
+
|
|
232
|
+
// ── SYNTHESIS PLANE ──────────────────────────────────────────────────────
|
|
233
|
+
{
|
|
234
|
+
id: "citation-integrity-gate",
|
|
235
|
+
plane: "synthesis",
|
|
236
|
+
name: "Citation Integrity Gate",
|
|
237
|
+
guarantees: "No [S#] survives finalization unless it resolves to a trusted, URL-backed ledger entry. Grouped tags are handled id-by-id.",
|
|
238
|
+
ceilingWithout: 6.0,
|
|
239
|
+
detect: (run) => {
|
|
240
|
+
const audit = outcomeOf(run)?.citationAudit;
|
|
241
|
+
const covea = run.covea as { deterministicActions?: string[] } | undefined;
|
|
242
|
+
const untrusted = Number(audit?.untrustedCount ?? 0);
|
|
243
|
+
if (untrusted === 0) return { presence: "present", evidence: "0 untrusted citations" };
|
|
244
|
+
const stripped = (covea?.deterministicActions ?? []).some((a) => /Removed invalid/i.test(a));
|
|
245
|
+
return stripped
|
|
246
|
+
? { presence: "present", evidence: `${untrusted} untrusted citation(s) stripped by COVEA deterministic containment` }
|
|
247
|
+
: { presence: "absent", evidence: `${untrusted} untrusted citation(s) survived to final text` };
|
|
248
|
+
},
|
|
249
|
+
patch: {
|
|
250
|
+
file: "src/lib/debug/covea-repair.ts",
|
|
251
|
+
anchor: "function stripInvalidCitationTags",
|
|
252
|
+
change:
|
|
253
|
+
"Compute bad ids from citationAudit.entries + auditResults (non-http, trusted:false, found:false, overlap<0.2, CSS-reset, zero-overlap), then remove ONLY those ids — including from grouped tags like [S3, S4] — before finalization.",
|
|
254
|
+
verify: "extractCitationIds(finalText) ⊆ { ids whose ledger entry is http-backed and trusted }",
|
|
255
|
+
workspaceReachable: true,
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
id: "template-coverage-enforcement",
|
|
260
|
+
plane: "synthesis",
|
|
261
|
+
name: "Template Coverage Enforcement",
|
|
262
|
+
guarantees: "Every section the template declares is present in the output, or is present as an explicit machine-readable stub.",
|
|
263
|
+
ceilingWithout: 8.5,
|
|
264
|
+
detect: (run) => {
|
|
265
|
+
const settings = outcomeOf(run)?.runSettings ?? {};
|
|
266
|
+
const rubric = loadTemplateRubric(settings.templateId, settings.styleOverride, settings.williamsPersona);
|
|
267
|
+
if (!rubric) return { presence: "unmeasured", evidence: "no template rubric for this run" };
|
|
268
|
+
const txt = finalTextOf(run);
|
|
269
|
+
const missing = rubric.sections.filter(
|
|
270
|
+
(s) => !new RegExp(`##\\s*(?:§\\d+\\s*)?${s.title.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`, "i").test(txt)
|
|
271
|
+
);
|
|
272
|
+
if (missing.length === 0) return { presence: "present", evidence: `${rubric.sections.length}/${rubric.sections.length} sections present` };
|
|
273
|
+
return {
|
|
274
|
+
presence: "absent",
|
|
275
|
+
evidence: `${rubric.sections.length - missing.length}/${rubric.sections.length} present; missing: ${missing.map((s) => s.title).join(", ")}`,
|
|
276
|
+
};
|
|
277
|
+
},
|
|
278
|
+
patch: {
|
|
279
|
+
file: "src/lib/v15-pipeline.ts",
|
|
280
|
+
anchor: "export function insertMissingSectionStubs",
|
|
281
|
+
change:
|
|
282
|
+
"Post-pass, walk rubric.sections; for each absent title insert `## <title>` + `[MISSING SECTION — please supply]` + the section hint. Insertion-only, idempotent, inserted before References when present.",
|
|
283
|
+
verify: "Template coverage == 100% after the post-pass, with stubs counted as explicit open items.",
|
|
284
|
+
workspaceReachable: true,
|
|
285
|
+
},
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
id: "placeholder-resolution-gate",
|
|
289
|
+
plane: "synthesis",
|
|
290
|
+
name: "Placeholder Resolution Gate",
|
|
291
|
+
guarantees: "No bare [DATA GAP]/[ASSUMPTION] token survives as if it were a quantity. Each becomes an explicit open item naming owner, input, and formula.",
|
|
292
|
+
ceilingWithout: 8.0,
|
|
293
|
+
detect: (run) => {
|
|
294
|
+
const txt = finalTextOf(run);
|
|
295
|
+
const bare = (txt.match(/\[(DATA GAP|ASSUMPTION|TBD|PROPOSED)\]/gi) ?? []).length;
|
|
296
|
+
if (bare === 0) return { presence: "present", evidence: "0 bare placeholder tokens" };
|
|
297
|
+
return { presence: "absent", evidence: `${bare} bare placeholder token(s) survived to final text` };
|
|
298
|
+
},
|
|
299
|
+
patch: {
|
|
300
|
+
file: "src/lib/debug/covea-repair.ts",
|
|
301
|
+
anchor: "function normalizeBarePlaceholders",
|
|
302
|
+
change:
|
|
303
|
+
"Convert `[DATA GAP]`/`[TBD]` → `[OPEN_INPUT: owner, source, formula required before decision sign-off]` and `[ASSUMPTION]`/`[PROPOSED]` → `[EXPLICIT_ASSUMPTION: owner, formula, sensitivity required]`. Never synthesize the missing value.",
|
|
304
|
+
verify: "finalText contains zero bare placeholder tokens; every open item names an owner and required input.",
|
|
305
|
+
workspaceReachable: true,
|
|
306
|
+
},
|
|
307
|
+
},
|
|
308
|
+
|
|
309
|
+
// ── REPAIR PLANE ─────────────────────────────────────────────────────────
|
|
310
|
+
{
|
|
311
|
+
id: "anchored-targeted-repair",
|
|
312
|
+
plane: "repair",
|
|
313
|
+
name: "Anchored Targeted Repair (COVEA)",
|
|
314
|
+
guarantees: "A defect is repaired by rewriting only its anchor span. A failed edit costs one defect, never the whole repair.",
|
|
315
|
+
ceilingWithout: 7.5,
|
|
316
|
+
detect: (run) => {
|
|
317
|
+
if (run.covea) {
|
|
318
|
+
const c = run.covea as { acceptedCount?: number; deterministicActions?: string[] };
|
|
319
|
+
return {
|
|
320
|
+
presence: "present",
|
|
321
|
+
evidence: `COVEA ran — ${c.acceptedCount ?? 0} anchored patch(es) accepted, ${(c.deterministicActions ?? []).length} deterministic action(s)`,
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
if (hasEvent(run, /shrank too much/i)) {
|
|
325
|
+
return { presence: "absent", evidence: "package whole-document repair rejected on size and no COVEA pass ran" };
|
|
326
|
+
}
|
|
327
|
+
return { presence: "unmeasured", evidence: "no repair activity recorded" };
|
|
328
|
+
},
|
|
329
|
+
patch: {
|
|
330
|
+
file: "src/lib/debug/covea-repair.ts",
|
|
331
|
+
anchor: "export async function runCoveaRepair",
|
|
332
|
+
change:
|
|
333
|
+
"Post-completion, convert each CoVe failure and adversarial defect into a sentence-anchored target; rewrite ≤1 paragraph per patch under a ≤20% total edit budget with ≥60% region retention and citation-tag preservation. Deterministic containment runs first and needs no API key.",
|
|
334
|
+
verify: "Post-repair blocking-defect count strictly decreases; every accepted edit matches exactly one anchor.",
|
|
335
|
+
workspaceReachable: true,
|
|
336
|
+
},
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
id: "per-defect-depth-acceptance",
|
|
340
|
+
plane: "repair",
|
|
341
|
+
name: "Per-Defect Depth Acceptance",
|
|
342
|
+
guarantees: "The N-Deep loop accepts a patch when the gate it targets clears, and spends its full depth budget instead of breaking on the first flat pass.",
|
|
343
|
+
ceilingWithout: 8.0,
|
|
344
|
+
detect: (run) => {
|
|
345
|
+
const settings = outcomeOf(run)?.runSettings ?? {};
|
|
346
|
+
const requested = Number(settings.depth ?? (run.input as any)?.maxDepth ?? 0);
|
|
347
|
+
const executed = new Set(
|
|
348
|
+
run.events.filter((e) => e.phase === "repair").map((e) => /^depth (\d+)/.exec(e.message)?.[1]).filter(Boolean)
|
|
349
|
+
).size;
|
|
350
|
+
if (requested <= 1 || executed === 0) return { presence: "unmeasured", evidence: "no multi-depth budget on this run" };
|
|
351
|
+
if (executed >= requested) return { presence: "present", evidence: `${executed}/${requested} depths executed` };
|
|
352
|
+
return { presence: "absent", evidence: `maxDepth=${requested} but only ${executed} depth(s) executed — loop broke early` };
|
|
353
|
+
},
|
|
354
|
+
patch: {
|
|
355
|
+
file: "src/lib/debug/covea-repair.ts",
|
|
356
|
+
anchor: "export async function runCoveaRepair",
|
|
357
|
+
change:
|
|
358
|
+
"Package N-Deep still breaks early, but COVEA runs afterward with per-target acceptance: each failed anchor is independently accepted/rejected under bounded-edit and citation-preservation gates, so a rejected package depth no longer terminates repair capability.",
|
|
359
|
+
verify: "A run with maxDepth=N executes N depths or logs an explicit skip reason per depth.",
|
|
360
|
+
workspaceReachable: true,
|
|
361
|
+
},
|
|
362
|
+
},
|
|
363
|
+
|
|
364
|
+
// ── EVALUATION PLANE ─────────────────────────────────────────────────────
|
|
365
|
+
{
|
|
366
|
+
id: "independent-or-floor-signal",
|
|
367
|
+
plane: "evaluation",
|
|
368
|
+
name: "Independent Judge OR Labelled Deterministic Floor",
|
|
369
|
+
guarantees: "Every run carries either a real third-party judge score or a clearly-labelled deterministic floor. A fallback score is never fabricated into judgeScore.",
|
|
370
|
+
ceilingWithout: 8.0,
|
|
371
|
+
detect: (run) => {
|
|
372
|
+
const o = outcomeOf(run);
|
|
373
|
+
if (o.judgeScore != null) return { presence: "present", evidence: `judgeScore=${o.judgeScore}` };
|
|
374
|
+
if (o.deterministicFloor != null) {
|
|
375
|
+
return { presence: "present", evidence: `judge excluded; labelled deterministicFloor=${o.deterministicFloor} (judgeScore correctly null)` };
|
|
376
|
+
}
|
|
377
|
+
const excluded = Array.isArray(o.judgeExcluded) ? o.judgeExcluded.length : 0;
|
|
378
|
+
if (excluded > 0) return { presence: "absent", evidence: `all ${excluded} judge(s) excluded and no deterministic floor was computed` };
|
|
379
|
+
return { presence: "unmeasured", evidence: "no judge activity recorded" };
|
|
380
|
+
},
|
|
381
|
+
patch: {
|
|
382
|
+
file: "src/lib/v15-pipeline.ts",
|
|
383
|
+
anchor: "export function computeDeterministicFloor",
|
|
384
|
+
change:
|
|
385
|
+
"On judge exclusion, compute a floor from template coverage, citation trust ratio, placeholder density, placeholder-URL ratio, and truncation state. Write it to `outcome.deterministicFloor`. NEVER write into judgeScore.",
|
|
386
|
+
verify: "judgeScore stays null on exclusion AND deterministicFloor is a finite number in [1, 9.5].",
|
|
387
|
+
workspaceReachable: true,
|
|
388
|
+
},
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
id: "drift-detection",
|
|
392
|
+
plane: "evaluation",
|
|
393
|
+
name: "Retrieval Drift Detection",
|
|
394
|
+
guarantees: "A retrieved document that shares no facet tokens with its dispatching query is flagged as drift and down-weighted before it can be cited.",
|
|
395
|
+
ceilingWithout: 8.5,
|
|
396
|
+
detect: (run) => {
|
|
397
|
+
if (hasEvent(run, /Intent Facet Lattice/i)) {
|
|
398
|
+
return { presence: "present", evidence: "lattice active — facetCoherence/isLikelyDriftResult available for admitted sources" };
|
|
399
|
+
}
|
|
400
|
+
return { presence: "absent", evidence: "no lattice on this run, so no facet provenance exists to score drift against" };
|
|
401
|
+
},
|
|
402
|
+
patch: {
|
|
403
|
+
file: "src/lib/debug/intent-lattice.ts",
|
|
404
|
+
anchor: "export function isLikelyDriftResult",
|
|
405
|
+
change:
|
|
406
|
+
"Score each admitted source with `facetCoherence(query, title+snippet)`; treat < 0.2 as drift (< 0.34 when a known noise term is present) and exclude it from the citable set.",
|
|
407
|
+
verify: "isLikelyDriftResult returns true for the CHAGEE-tea result against a cannabis query and false for an on-topic cannabis result.",
|
|
408
|
+
workspaceReachable: true,
|
|
409
|
+
},
|
|
410
|
+
},
|
|
411
|
+
];
|
|
412
|
+
|
|
413
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
414
|
+
// ASSESSMENT + PRESCRIPTION
|
|
415
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
416
|
+
|
|
417
|
+
export interface ComponentAssessment {
|
|
418
|
+
component: ArchComponent;
|
|
419
|
+
presence: Presence;
|
|
420
|
+
evidence: string;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
export interface Prescription {
|
|
424
|
+
runId: string;
|
|
425
|
+
observedGuard: number | null;
|
|
426
|
+
observedJudge: number | null;
|
|
427
|
+
deterministicFloor: number | null;
|
|
428
|
+
/** min(ceilingWithout) over absent components. 10 when none absent. */
|
|
429
|
+
projectedCeiling: number;
|
|
430
|
+
/** The component that sets the ceiling — fix this one first. */
|
|
431
|
+
bindingConstraint: ArchComponent | null;
|
|
432
|
+
assessments: ComponentAssessment[];
|
|
433
|
+
/** Absent/degraded components ordered by ceiling ascending (most blocking first). */
|
|
434
|
+
ordered: ComponentAssessment[];
|
|
435
|
+
/** Split by whether the patch can land in src/ today. */
|
|
436
|
+
workspaceToday: ComponentAssessment[];
|
|
437
|
+
needsPackageEdit: ComponentAssessment[];
|
|
438
|
+
/** Components we could not measure from this run's telemetry. */
|
|
439
|
+
unmeasured: ComponentAssessment[];
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
export function assessArchitecture(run: RunRecord): ComponentAssessment[] {
|
|
443
|
+
return ARCHITECTURE_SPEC.map((component) => {
|
|
444
|
+
let presence: Presence = "unmeasured";
|
|
445
|
+
let evidence = "detector threw";
|
|
446
|
+
try {
|
|
447
|
+
const r = component.detect(run);
|
|
448
|
+
presence = r.presence;
|
|
449
|
+
evidence = r.evidence;
|
|
450
|
+
} catch (e) {
|
|
451
|
+
evidence = `detector error: ${e instanceof Error ? e.message : String(e)}`;
|
|
452
|
+
}
|
|
453
|
+
return { component, presence, evidence };
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
export function prescribe(run: RunRecord): Prescription {
|
|
458
|
+
const assessments = assessArchitecture(run);
|
|
459
|
+
const blocking = assessments.filter((a) => a.presence === "absent" || a.presence === "degraded");
|
|
460
|
+
const ordered = [...blocking].sort((a, b) => a.component.ceilingWithout - b.component.ceilingWithout);
|
|
461
|
+
|
|
462
|
+
// THE MIN-OF-CEILINGS MODEL. Not a sum.
|
|
463
|
+
const projectedCeiling = ordered.length === 0 ? 10 : ordered[0].component.ceilingWithout;
|
|
464
|
+
const bindingConstraint = ordered[0]?.component ?? null;
|
|
465
|
+
|
|
466
|
+
const o = outcomeOf(run);
|
|
467
|
+
return {
|
|
468
|
+
runId: run.id,
|
|
469
|
+
observedGuard: run.guardScore ?? null,
|
|
470
|
+
observedJudge: run.judgeScore ?? null,
|
|
471
|
+
deterministicFloor: typeof o.deterministicFloor === "number" ? o.deterministicFloor : null,
|
|
472
|
+
projectedCeiling,
|
|
473
|
+
bindingConstraint,
|
|
474
|
+
assessments,
|
|
475
|
+
ordered,
|
|
476
|
+
workspaceToday: ordered.filter((a) => a.component.patch.workspaceReachable),
|
|
477
|
+
needsPackageEdit: ordered.filter((a) => !a.component.patch.workspaceReachable),
|
|
478
|
+
unmeasured: assessments.filter((a) => a.presence === "unmeasured"),
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
/** Human-readable prescription. This is the artifact the user acts on. */
|
|
483
|
+
export function renderPrescription(p: Prescription): string {
|
|
484
|
+
const L: string[] = [];
|
|
485
|
+
L.push("# ARCHITECTURE PRESCRIPTION — path to a repeatable 9+");
|
|
486
|
+
L.push(`Run: ${p.runId}`);
|
|
487
|
+
L.push(`Observed: guard=${p.observedGuard ?? "n/a"} · judge=${p.observedJudge ?? "unavailable"} · deterministicFloor=${p.deterministicFloor ?? "n/a"}`);
|
|
488
|
+
L.push("");
|
|
489
|
+
L.push("## Ceiling model");
|
|
490
|
+
L.push("achievable = MIN(ceilingWithout) over ABSENT components — these are preconditions, not additive contributors.");
|
|
491
|
+
L.push(`Projected ceiling with the current architecture: **${p.projectedCeiling.toFixed(1)}/10**`);
|
|
492
|
+
if (p.bindingConstraint) {
|
|
493
|
+
L.push(`Binding constraint: **${p.bindingConstraint.name}** (${p.bindingConstraint.plane}) — nothing downstream can raise the score past ${p.bindingConstraint.ceilingWithout.toFixed(1)} while this is absent.`);
|
|
494
|
+
} else {
|
|
495
|
+
L.push("No absent component detected — the architecture required for 9+ is fully installed for this run.");
|
|
496
|
+
}
|
|
497
|
+
L.push("");
|
|
498
|
+
|
|
499
|
+
if (p.ordered.length > 0) {
|
|
500
|
+
L.push(`## Required components, most-blocking first (${p.ordered.length})`);
|
|
501
|
+
p.ordered.forEach((a, i) => {
|
|
502
|
+
const c = a.component;
|
|
503
|
+
L.push("");
|
|
504
|
+
L.push(`### ${i + 1}. ${c.name} — ceiling ${c.ceilingWithout.toFixed(1)} without it [${a.presence.toUpperCase()}]`);
|
|
505
|
+
L.push(`- plane: ${c.plane}`);
|
|
506
|
+
L.push(`- guarantees: ${c.guarantees}`);
|
|
507
|
+
L.push(`- observed: ${a.evidence}`);
|
|
508
|
+
L.push(`- file: \`${c.patch.file}\``);
|
|
509
|
+
L.push(`- anchor: \`${c.patch.anchor}\``);
|
|
510
|
+
L.push(`- change: ${c.patch.change}`);
|
|
511
|
+
L.push(`- verify: ${c.patch.verify}`);
|
|
512
|
+
L.push(`- reachable in src/ today: ${c.patch.workspaceReachable ? "YES" : "NO — requires materialize.mjs or a full flatten"}`);
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
L.push("");
|
|
517
|
+
L.push("## Split by reachability");
|
|
518
|
+
L.push(`- fixable in src/ today: ${p.workspaceToday.length} (${p.workspaceToday.map((a) => a.component.id).join(", ") || "none"})`);
|
|
519
|
+
L.push(`- requires package edit: ${p.needsPackageEdit.length} (${p.needsPackageEdit.map((a) => a.component.id).join(", ") || "none"})`);
|
|
520
|
+
if (p.unmeasured.length > 0) {
|
|
521
|
+
L.push("");
|
|
522
|
+
L.push(`## Unmeasured on this run (${p.unmeasured.length}) — neither passing nor failing`);
|
|
523
|
+
for (const a of p.unmeasured) L.push(`- ${a.component.name}: ${a.evidence}`);
|
|
524
|
+
}
|
|
525
|
+
L.push("");
|
|
526
|
+
L.push("## Honesty");
|
|
527
|
+
L.push("`ceilingWithout` values are estimates calibrated against 4 observed runs (guard 4.4 / 4.88 / 6.25 / 8.1). They are NOT measured bounds. Detection is exact — it reads the run record. Do not report a projected ceiling as an achieved score.");
|
|
528
|
+
return L.join("\n");
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
/** Machine-readable prescription for an IDE agent or external reviewer. */
|
|
532
|
+
export function exportPrescription(p: Prescription): string {
|
|
533
|
+
return JSON.stringify(
|
|
534
|
+
{
|
|
535
|
+
schema: "veritas.architecture-prescription/1",
|
|
536
|
+
runId: p.runId,
|
|
537
|
+
generatedAt: new Date().toISOString(),
|
|
538
|
+
ceilingModel: "achievable = min(ceilingWithout) over absent components; preconditions, not additive lifts",
|
|
539
|
+
observed: { guard: p.observedGuard, judge: p.observedJudge, deterministicFloor: p.deterministicFloor },
|
|
540
|
+
projectedCeiling: p.projectedCeiling,
|
|
541
|
+
bindingConstraint: p.bindingConstraint?.id ?? null,
|
|
542
|
+
components: p.assessments.map((a) => ({
|
|
543
|
+
id: a.component.id,
|
|
544
|
+
plane: a.component.plane,
|
|
545
|
+
name: a.component.name,
|
|
546
|
+
presence: a.presence,
|
|
547
|
+
evidence: a.evidence,
|
|
548
|
+
ceilingWithout: a.component.ceilingWithout,
|
|
549
|
+
patch: a.component.patch,
|
|
550
|
+
})),
|
|
551
|
+
caveat: "ceilingWithout is a calibrated estimate from 4 runs, not a measured bound.",
|
|
552
|
+
},
|
|
553
|
+
null,
|
|
554
|
+
2
|
|
555
|
+
);
|
|
556
|
+
}
|