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,418 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* scraper-forensics.ts — NET-NEW (Type C). See flatten-guide.md.
|
|
3
|
+
* ===========================================================================
|
|
4
|
+
* PER-LANE RETRIEVAL FORENSICS.
|
|
5
|
+
*
|
|
6
|
+
* Turn-5 ask: "exact links scraped per scraper system, and exact citation each
|
|
7
|
+
* scraper added during a specific run, and also clean sources, atoms,
|
|
8
|
+
* quarantined, and any of the scraper specific metadata."
|
|
9
|
+
*
|
|
10
|
+
* The V15 grounding portfolio narrates itself through `onProgress`. Every
|
|
11
|
+
* string below was taken VERBATIM from the package emitters — this module
|
|
12
|
+
* parses only real emissions and never synthesises a lane that did not report.
|
|
13
|
+
*
|
|
14
|
+
* VERIFIED EMITTER COORDINATES (grepped, not assumed):
|
|
15
|
+
* v15-grounding.orig.ts:98 "portfolio: no acceptable result; delegating to vanguard"
|
|
16
|
+
* v15-grounding.orig.ts:117 "vanguard: N claims packed, M sources packed, utilization=X%"
|
|
17
|
+
* v15-grounding.orig.ts:135 "palisade: N attested, M supported, proof=P"
|
|
18
|
+
* v15-grounding.orig.ts:138 "palisade: insufficient attested claims; delegating to arbiter-omega"
|
|
19
|
+
* v15-pipeline.orig.ts:749 "grounded [Section]: +N source(s) for \"query\""
|
|
20
|
+
* v15-pipeline.orig.ts:763 "template-directed grounding complete: N total sources across M queries"
|
|
21
|
+
* v15-pipeline.orig.ts:833 "HDIG: +N source(s) for \"...\" (ledger now K)"
|
|
22
|
+
*
|
|
23
|
+
* CLEAN-SOURCE SEMANTICS (verified in package source, surfaced here so the
|
|
24
|
+
* numbers in the UI mean something precise):
|
|
25
|
+
* arbiter-omega.ts:427 clean := !s.hardQuarantined && s.content.length >= 80
|
|
26
|
+
* strata-engine.ts:2384/2442 clean := !s.quarantined && s.content.length >= 80
|
|
27
|
+
* nexus-consensus.ts:836 clean := !s.quarantined && s.content && length >= 80
|
|
28
|
+
* sibyl-oracle.ts:332 clean := s.content && s.content.length >= 80
|
|
29
|
+
* v15-grounding.orig.ts:221 clean := s.url && s.content.length >= 80
|
|
30
|
+
* → A source is DROPPED (quarantined-equivalent) below 80 chars of body text.
|
|
31
|
+
*
|
|
32
|
+
* ATOM SEMANTICS:
|
|
33
|
+
* vanguard-titanium.ts:421 tokenBudget.sourcesPacked = packedSources.length
|
|
34
|
+
* "claims packed" are epistemic ATOMS, not documents. A lane can pack many
|
|
35
|
+
* atoms and zero sources — that is the D14 zero-yield defect.
|
|
36
|
+
* ===========================================================================
|
|
37
|
+
*/
|
|
38
|
+
import type { TraceEvent, RunRecord, SourceRecord } from "@/lib/debug/pipeline-trace-bus";
|
|
39
|
+
|
|
40
|
+
export type LaneOutcome = "fulfilled" | "quarantined" | "delegated" | "winner" | "running" | "unknown";
|
|
41
|
+
|
|
42
|
+
export interface LaneRecord {
|
|
43
|
+
/** Lane identity as the package names it: portfolio, terminal-wire, vanguard, … */
|
|
44
|
+
lane: string;
|
|
45
|
+
/** Template section this lane was serving, when the emitter carried one. */
|
|
46
|
+
section: string | null;
|
|
47
|
+
/** Query the lane was dispatched against, when carried. */
|
|
48
|
+
query: string | null;
|
|
49
|
+
firstDt: number;
|
|
50
|
+
lastDt: number;
|
|
51
|
+
durationMs: number | null;
|
|
52
|
+
outcome: LaneOutcome;
|
|
53
|
+
/** Epistemic atoms/claims packed by the lane (vanguard/palisade emit this). */
|
|
54
|
+
atomsPacked: number | null;
|
|
55
|
+
/** REAL documents packed. Zero here + nonzero atoms = D14 zero-yield. */
|
|
56
|
+
sourcesPacked: number | null;
|
|
57
|
+
/** Explicit clean-source count reported by nexus/native-vnext/etc. */
|
|
58
|
+
cleanSources: number | null;
|
|
59
|
+
/** Explicit quarantine/drop count reported by lane. */
|
|
60
|
+
quarantined: number | null;
|
|
61
|
+
/** Native-vnext/fusion result counts, when reported. */
|
|
62
|
+
fusedResults: number | null;
|
|
63
|
+
enrichedResults: number | null;
|
|
64
|
+
/** Token-budget utilization percentage reported by the lane. */
|
|
65
|
+
utilizationPct: number | null;
|
|
66
|
+
/** Palisade disposition counts. */
|
|
67
|
+
attested: number | null;
|
|
68
|
+
supported: number | null;
|
|
69
|
+
proof: string | null;
|
|
70
|
+
/** Seeds the crawler expanded. */
|
|
71
|
+
seedsCrawled: number | null;
|
|
72
|
+
/** Sources this lane declared it contributed (from `grounded […]: +N`). */
|
|
73
|
+
sourcesContributed: number;
|
|
74
|
+
/** Structured-adapter provider list, when reported. */
|
|
75
|
+
adapters: string[];
|
|
76
|
+
/** Transport/backend failures parsed from hydraRead/native-vnext diagnostics. */
|
|
77
|
+
failures: string[];
|
|
78
|
+
/** Verbatim emissions attributed to this lane — full audit trail. */
|
|
79
|
+
rawLines: Array<{ dt: number; message: string }>;
|
|
80
|
+
/** Ledger entries whose admission timestamp falls inside this lane's window. */
|
|
81
|
+
citations: SourceRecord[];
|
|
82
|
+
/** Distinct absolute URLs among those citations. */
|
|
83
|
+
realUrls: string[];
|
|
84
|
+
/** Non-resolvable placeholder URLs (`source-N`, `*-attested`) — the bug at :113/:131. */
|
|
85
|
+
placeholderUrls: string[];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface ForensicsReport {
|
|
89
|
+
lanes: LaneRecord[];
|
|
90
|
+
/** Lanes that reported zero real sources despite packing atoms. */
|
|
91
|
+
zeroYieldLanes: LaneRecord[];
|
|
92
|
+
/** Lanes explicitly quarantined / delegated away by the orchestrator. */
|
|
93
|
+
quarantinedLanes: LaneRecord[];
|
|
94
|
+
/** Winner declared by the portfolio, if it declared one. */
|
|
95
|
+
winner: { lane: string; sources: number; lanes: number } | null;
|
|
96
|
+
totals: {
|
|
97
|
+
lanesSeen: number;
|
|
98
|
+
totalSourcesDeclared: number;
|
|
99
|
+
queriesDispatched: number;
|
|
100
|
+
ledgerEntries: number;
|
|
101
|
+
realUrlCount: number;
|
|
102
|
+
placeholderUrlCount: number;
|
|
103
|
+
cleanSourceThresholdChars: 80;
|
|
104
|
+
};
|
|
105
|
+
/** Ledger entries no lane window could claim — surfaced, never hidden. */
|
|
106
|
+
unattributedCitations: SourceRecord[];
|
|
107
|
+
/** Distinct absolute URLs across the whole run, deduped. */
|
|
108
|
+
allRealUrls: string[];
|
|
109
|
+
/** Distinct placeholder URLs across the whole run. */
|
|
110
|
+
allPlaceholderUrls: string[];
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// ── URL classification ─────────────────────────────────────────────────────
|
|
114
|
+
// Verified generator: v15-grounding.orig.ts:113 / :131 emit `source-${n}` or
|
|
115
|
+
// `<lane>-attested` as the *url* field. Those can never resolve.
|
|
116
|
+
const PLACEHOLDER_URL_RE = /^(?:source-\d+|[a-z-]+-attested|unknown|n\/a|)$/i;
|
|
117
|
+
|
|
118
|
+
export function isPlaceholderUrl(url: string | undefined | null): boolean {
|
|
119
|
+
if (!url) return true;
|
|
120
|
+
const u = String(url).trim();
|
|
121
|
+
if (PLACEHOLDER_URL_RE.test(u)) return true;
|
|
122
|
+
return !/^https?:\/\//i.test(u);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// ── Emitter grammar (all patterns taken verbatim from package source) ──────
|
|
126
|
+
|
|
127
|
+
/** `grounding [Section] · lane: message` | `HDIG · lane: message` */
|
|
128
|
+
const PREFIXED_RE = /^(?:grounding\s*\[([^\]]+)\]|HDIG|Re-ground\s*\(([^)]+)\))\s*·\s*([a-z0-9-]+):\s*(.*)$/i;
|
|
129
|
+
/** `grounded [Section]: +N source(s) for "query"` */
|
|
130
|
+
const GROUNDED_RE = /^grounded\s*\[([^\]]+)\]:\s*\+(\d+)\s+source\(s\)\s+for\s+"?(.*?)"?\s*$/i;
|
|
131
|
+
/** `HDIG: +N source(s) for "…" (ledger now K)` */
|
|
132
|
+
const HDIG_YIELD_RE = /^HDIG:\s*\+(\d+)\s+source\(s\)\s+for\s+"?(.*?)"?\s*(?:\(ledger now (\d+)\))?$/i;
|
|
133
|
+
/** `vanguard: 7 claims packed, 0 sources packed, utilization=6.6%` */
|
|
134
|
+
const VANGUARD_RE = /(\d+)\s+claims?\s+packed,\s*(\d+)\s+sources?\s+packed,\s*utilization=([\d.]+)%/i;
|
|
135
|
+
/** `palisade: 3 attested, 2 supported, proof=verified` */
|
|
136
|
+
const PALISADE_RE = /(\d+)\s+attested,\s*(\d+)\s+supported,\s*proof=([a-z-]+)/i;
|
|
137
|
+
/** `nexusResearch: 1 clean sources, 1 atoms, 0 quarantined` */
|
|
138
|
+
const CLEAN_ATOMS_RE = /(\d+)\s+clean\s+sources?,\s*(\d+)\s+atoms?,\s*(\d+)\s+quarantined/i;
|
|
139
|
+
/** `native-vnext: 6/10 fused results; 1 enriched; 0 quarantined` */
|
|
140
|
+
const FUSED_RE = /(\d+)\/(\d+)\s+fused\s+results;\s*(\d+)\s+enriched;\s*(\d+)\s+quarantined/i;
|
|
141
|
+
/** `portfolio: lane fulfilled in 1992ms` */
|
|
142
|
+
const FULFILLED_RE = /^([a-z0-9-]+)\s+fulfilled\s+in\s+(\d+)ms/i;
|
|
143
|
+
/** `portfolio: winner=terminal-wire sources=6 lanes=1` */
|
|
144
|
+
const WINNER_RE = /winner=([a-z0-9-]+)\s+sources=(\d+)\s+lanes=(\d+)/i;
|
|
145
|
+
/** `terminal-wire: crawl 3 seeds` */
|
|
146
|
+
const SEEDS_RE = /crawl\s+(\d+)\s+seeds?/i;
|
|
147
|
+
/** `structured-adapter: integrated 3 item(s) from crossref, semantic-scholar, …` */
|
|
148
|
+
const ADAPTER_RE = /integrated\s+(\d+)\s+items?\s+from\s+(.+)$/i;
|
|
149
|
+
/** `template-directed grounding complete: 12 total sources across 6 queries` */
|
|
150
|
+
const COMPLETE_RE = /grounding complete:\s*(\d+)\s+total sources across\s+(\d+)\s+quer/i;
|
|
151
|
+
/** `portfolio: no acceptable result; delegating to vanguard` (:98 verbatim) */
|
|
152
|
+
const DELEGATE_RE = /no acceptable result;\s*delegating to\s+([a-z0-9-]+)/i;
|
|
153
|
+
/** `palisade: insufficient attested claims; delegating to arbiter-omega` (:138) */
|
|
154
|
+
const INSUFFICIENT_RE = /insufficient[^;]*;\s*delegating to\s+([a-z0-9-]+)/i;
|
|
155
|
+
/** `portfolio: starting sentinel-orchestrator` */
|
|
156
|
+
const STARTING_RE = /^starting\s+([a-z0-9-]+)/i;
|
|
157
|
+
|
|
158
|
+
function blankLane(lane: string, section: string | null, dt: number): LaneRecord {
|
|
159
|
+
return {
|
|
160
|
+
lane, section, query: null,
|
|
161
|
+
firstDt: dt, lastDt: dt, durationMs: null,
|
|
162
|
+
outcome: "running",
|
|
163
|
+
atomsPacked: null, sourcesPacked: null, utilizationPct: null,
|
|
164
|
+
cleanSources: null, quarantined: null, fusedResults: null, enrichedResults: null,
|
|
165
|
+
attested: null, supported: null, proof: null, seedsCrawled: null,
|
|
166
|
+
sourcesContributed: 0, adapters: [], failures: [],
|
|
167
|
+
rawLines: [], citations: [], realUrls: [], placeholderUrls: [],
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Build the forensics report from a run's raw event stream + citation ledger.
|
|
173
|
+
* Pure function — no network, no model, fully reproducible from the run record.
|
|
174
|
+
*/
|
|
175
|
+
export function buildForensics(run: RunRecord): ForensicsReport {
|
|
176
|
+
const byKey = new Map<string, LaneRecord>();
|
|
177
|
+
const key = (lane: string, section: string | null) => `${lane}::${section ?? "-"}`;
|
|
178
|
+
|
|
179
|
+
let winner: ForensicsReport["winner"] = null;
|
|
180
|
+
let totalSourcesDeclared = 0;
|
|
181
|
+
let queriesDispatched = 0;
|
|
182
|
+
|
|
183
|
+
const relevant: TraceEvent[] = run.events.filter(
|
|
184
|
+
(e) => e.source === "scraper" || e.phase === "grounding" || e.phase === "hdig" || e.phase === "reground"
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
for (const ev of relevant) {
|
|
188
|
+
const msg = ev.message;
|
|
189
|
+
|
|
190
|
+
// ── Section-scoped yield line ────────────────────────────────────────
|
|
191
|
+
const g = GROUNDED_RE.exec(msg);
|
|
192
|
+
if (g) {
|
|
193
|
+
const section = g[1];
|
|
194
|
+
const n = Number(g[2]);
|
|
195
|
+
const q = g[3] || null;
|
|
196
|
+
// Attribute the yield to the most recently active lane in that section.
|
|
197
|
+
const candidates = [...byKey.values()].filter((l) => l.section === section);
|
|
198
|
+
const target = candidates.sort((a, b) => b.lastDt - a.lastDt)[0];
|
|
199
|
+
if (target) {
|
|
200
|
+
target.sourcesContributed += n;
|
|
201
|
+
if (q && !target.query) target.query = q;
|
|
202
|
+
}
|
|
203
|
+
totalSourcesDeclared += n;
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
const h = HDIG_YIELD_RE.exec(msg);
|
|
207
|
+
if (h) {
|
|
208
|
+
const n = Number(h[1]);
|
|
209
|
+
const candidates = [...byKey.values()].filter((l) => l.section === "HDIG");
|
|
210
|
+
const target = candidates.sort((a, b) => b.lastDt - a.lastDt)[0];
|
|
211
|
+
if (target) target.sourcesContributed += n;
|
|
212
|
+
totalSourcesDeclared += n;
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
const c = COMPLETE_RE.exec(msg);
|
|
216
|
+
if (c) {
|
|
217
|
+
queriesDispatched = Number(c[2]);
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// ── Lane-prefixed emission ───────────────────────────────────────────
|
|
222
|
+
let lane: string | null = null;
|
|
223
|
+
let section: string | null = null;
|
|
224
|
+
let body = "";
|
|
225
|
+
const p = PREFIXED_RE.exec(msg);
|
|
226
|
+
if (p) {
|
|
227
|
+
section = p[1] ?? p[2] ?? (/^HDIG/i.test(msg) ? "HDIG" : null);
|
|
228
|
+
lane = p[3].toLowerCase();
|
|
229
|
+
body = p[4];
|
|
230
|
+
} else if (ev.source === "scraper" && ev.lane) {
|
|
231
|
+
lane = String(ev.lane).toLowerCase();
|
|
232
|
+
section = null;
|
|
233
|
+
body = msg;
|
|
234
|
+
} else {
|
|
235
|
+
continue;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
const k = key(lane, section);
|
|
239
|
+
let rec = byKey.get(k);
|
|
240
|
+
if (!rec) {
|
|
241
|
+
rec = blankLane(lane, section, ev.dt);
|
|
242
|
+
byKey.set(k, rec);
|
|
243
|
+
}
|
|
244
|
+
rec.lastDt = ev.dt;
|
|
245
|
+
rec.rawLines.push({ dt: ev.dt, message: body });
|
|
246
|
+
|
|
247
|
+
// ── Structured field extraction ──────────────────────────────────────
|
|
248
|
+
const v = VANGUARD_RE.exec(body);
|
|
249
|
+
if (v) {
|
|
250
|
+
rec.atomsPacked = Number(v[1]);
|
|
251
|
+
rec.sourcesPacked = Number(v[2]);
|
|
252
|
+
rec.utilizationPct = Number(v[3]);
|
|
253
|
+
}
|
|
254
|
+
const pl = PALISADE_RE.exec(body);
|
|
255
|
+
if (pl) {
|
|
256
|
+
rec.attested = Number(pl[1]);
|
|
257
|
+
rec.supported = Number(pl[2]);
|
|
258
|
+
rec.proof = pl[3];
|
|
259
|
+
}
|
|
260
|
+
const ca = CLEAN_ATOMS_RE.exec(body);
|
|
261
|
+
if (ca) {
|
|
262
|
+
rec.cleanSources = Number(ca[1]);
|
|
263
|
+
rec.atomsPacked = Number(ca[2]);
|
|
264
|
+
rec.quarantined = Number(ca[3]);
|
|
265
|
+
if (rec.sourcesPacked == null) rec.sourcesPacked = Number(ca[1]);
|
|
266
|
+
}
|
|
267
|
+
const fu = FUSED_RE.exec(body);
|
|
268
|
+
if (fu) {
|
|
269
|
+
rec.fusedResults = Number(fu[1]);
|
|
270
|
+
rec.enrichedResults = Number(fu[3]);
|
|
271
|
+
rec.quarantined = Number(fu[4]);
|
|
272
|
+
if (rec.cleanSources == null) rec.cleanSources = Number(fu[3]);
|
|
273
|
+
if (rec.sourcesPacked == null) rec.sourcesPacked = Number(fu[3]);
|
|
274
|
+
}
|
|
275
|
+
if (/exhausted|failed|circuit_open|too thin|no retrieval path succeeded|failed to fetch|401|403/i.test(body)) {
|
|
276
|
+
rec.failures.push(body);
|
|
277
|
+
}
|
|
278
|
+
const s = SEEDS_RE.exec(body);
|
|
279
|
+
if (s) rec.seedsCrawled = Number(s[1]);
|
|
280
|
+
const a = ADAPTER_RE.exec(body);
|
|
281
|
+
if (a) {
|
|
282
|
+
rec.adapters = a[2].split(/,\s*/).map((x) => x.trim()).filter(Boolean);
|
|
283
|
+
if (rec.sourcesPacked == null) rec.sourcesPacked = Number(a[1]);
|
|
284
|
+
}
|
|
285
|
+
const f = FULFILLED_RE.exec(body);
|
|
286
|
+
if (f) {
|
|
287
|
+
const child = f[1].toLowerCase();
|
|
288
|
+
const ck = key(child, section);
|
|
289
|
+
const childRec = byKey.get(ck) ?? blankLane(child, section, ev.dt);
|
|
290
|
+
childRec.outcome = "fulfilled";
|
|
291
|
+
childRec.durationMs = Number(f[2]);
|
|
292
|
+
childRec.lastDt = ev.dt;
|
|
293
|
+
byKey.set(ck, childRec);
|
|
294
|
+
}
|
|
295
|
+
const w = WINNER_RE.exec(body);
|
|
296
|
+
if (w) {
|
|
297
|
+
winner = { lane: w[1].toLowerCase(), sources: Number(w[2]), lanes: Number(w[3]) };
|
|
298
|
+
const wk = key(w[1].toLowerCase(), section);
|
|
299
|
+
const wr = byKey.get(wk);
|
|
300
|
+
if (wr) wr.outcome = "winner";
|
|
301
|
+
}
|
|
302
|
+
const d = DELEGATE_RE.exec(body) ?? INSUFFICIENT_RE.exec(body);
|
|
303
|
+
if (d) {
|
|
304
|
+
rec.outcome = "quarantined";
|
|
305
|
+
const nk = key(d[1].toLowerCase(), section);
|
|
306
|
+
if (!byKey.has(nk)) byKey.set(nk, blankLane(d[1].toLowerCase(), section, ev.dt));
|
|
307
|
+
}
|
|
308
|
+
const st = STARTING_RE.exec(body);
|
|
309
|
+
if (st) {
|
|
310
|
+
const nk = key(st[1].toLowerCase(), section);
|
|
311
|
+
if (!byKey.has(nk)) byKey.set(nk, blankLane(st[1].toLowerCase(), section, ev.dt));
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
const lanes = [...byKey.values()].sort((a, b) => a.firstDt - b.firstDt);
|
|
316
|
+
|
|
317
|
+
// ── Citation attribution by admission-timestamp window ───────────────────
|
|
318
|
+
// Ledger entries carry the wall-clock ms at which the source was admitted.
|
|
319
|
+
// Match each entry to the lane whose [firstDt,lastDt] window (converted to
|
|
320
|
+
// wall clock via run.startedAt) contains it. Deterministic, no guessing.
|
|
321
|
+
const unattributed: SourceRecord[] = [];
|
|
322
|
+
const entries = (run.output as any)?.citationAudit?.entries as
|
|
323
|
+
| Array<{ url?: string; title?: string; snippet?: string; stage?: string; timestamp?: number }>
|
|
324
|
+
| undefined;
|
|
325
|
+
|
|
326
|
+
const ledger: SourceRecord[] =
|
|
327
|
+
Array.isArray(entries) && entries.length
|
|
328
|
+
? entries.map((e) => ({ stage: String(e.stage ?? "unknown"), title: e.title, url: e.url, snippet: e.snippet }))
|
|
329
|
+
: run.sources;
|
|
330
|
+
|
|
331
|
+
const stamps: number[] = Array.isArray(entries) ? entries.map((e) => Number(e.timestamp ?? 0)) : [];
|
|
332
|
+
|
|
333
|
+
ledger.forEach((src, i) => {
|
|
334
|
+
const ts = stamps[i] ?? 0;
|
|
335
|
+
const dt = ts > 0 ? ts - run.startedAt : -1;
|
|
336
|
+
let owner: LaneRecord | null = null;
|
|
337
|
+
if (dt >= 0) {
|
|
338
|
+
// Prefer the innermost lane window that contains the admission moment.
|
|
339
|
+
const containing = lanes.filter((l) => dt >= l.firstDt - 1500 && dt <= l.lastDt + 1500);
|
|
340
|
+
// Innermost = latest-starting lane in the containing set.
|
|
341
|
+
owner = containing.sort((a, b) => b.firstDt - a.firstDt)[0] ?? null;
|
|
342
|
+
}
|
|
343
|
+
if (owner) {
|
|
344
|
+
owner.citations.push(src);
|
|
345
|
+
if (isPlaceholderUrl(src.url)) {
|
|
346
|
+
if (src.url && !owner.placeholderUrls.includes(src.url)) owner.placeholderUrls.push(src.url);
|
|
347
|
+
} else if (src.url && !owner.realUrls.includes(src.url)) {
|
|
348
|
+
owner.realUrls.push(src.url);
|
|
349
|
+
}
|
|
350
|
+
} else {
|
|
351
|
+
unattributed.push(src);
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
// ── Zero-yield / quarantine classification (D14 / D14B) ──────────────────
|
|
356
|
+
const zeroYieldLanes = lanes.filter(
|
|
357
|
+
(l) => (l.atomsPacked ?? 0) > 0 && (l.sourcesPacked ?? 0) === 0
|
|
358
|
+
);
|
|
359
|
+
const quarantinedLanes = lanes.filter((l) => l.outcome === "quarantined");
|
|
360
|
+
|
|
361
|
+
const allReal = [...new Set(lanes.flatMap((l) => l.realUrls).concat(unattributed.filter((u) => !isPlaceholderUrl(u.url)).map((u) => u.url!)))].filter(Boolean);
|
|
362
|
+
const allPlaceholder = [...new Set(lanes.flatMap((l) => l.placeholderUrls).concat(unattributed.filter((u) => isPlaceholderUrl(u.url) && u.url).map((u) => u.url!)))].filter(Boolean);
|
|
363
|
+
|
|
364
|
+
return {
|
|
365
|
+
lanes,
|
|
366
|
+
zeroYieldLanes,
|
|
367
|
+
quarantinedLanes,
|
|
368
|
+
winner,
|
|
369
|
+
totals: {
|
|
370
|
+
lanesSeen: lanes.length,
|
|
371
|
+
totalSourcesDeclared,
|
|
372
|
+
queriesDispatched,
|
|
373
|
+
ledgerEntries: ledger.length,
|
|
374
|
+
realUrlCount: allReal.length,
|
|
375
|
+
placeholderUrlCount: allPlaceholder.length,
|
|
376
|
+
cleanSourceThresholdChars: 80,
|
|
377
|
+
},
|
|
378
|
+
unattributedCitations: unattributed,
|
|
379
|
+
allRealUrls: allReal,
|
|
380
|
+
allPlaceholderUrls: allPlaceholder,
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/** Deterministic export artefact for handing to an external reviewer. */
|
|
385
|
+
export function exportForensics(run: RunRecord, rep: ForensicsReport): string {
|
|
386
|
+
return JSON.stringify(
|
|
387
|
+
{
|
|
388
|
+
schema: "veritas.scraper-forensics/1",
|
|
389
|
+
runId: run.id,
|
|
390
|
+
question: run.question,
|
|
391
|
+
exportedAt: new Date().toISOString(),
|
|
392
|
+
cleanSourceRule: "clean := !quarantined && !hardQuarantined && content.length >= 80 (verified in package source)",
|
|
393
|
+
placeholderUrlRule: "placeholder := !/^https?:\\/\\// — generated at v15-grounding.orig.ts:113 and :131",
|
|
394
|
+
totals: rep.totals,
|
|
395
|
+
winner: rep.winner,
|
|
396
|
+
lanes: rep.lanes.map((l) => ({
|
|
397
|
+
lane: l.lane, section: l.section, query: l.query,
|
|
398
|
+
outcome: l.outcome, durationMs: l.durationMs,
|
|
399
|
+
atomsPacked: l.atomsPacked, sourcesPacked: l.sourcesPacked, utilizationPct: l.utilizationPct,
|
|
400
|
+
cleanSources: l.cleanSources, quarantined: l.quarantined, fusedResults: l.fusedResults, enrichedResults: l.enrichedResults,
|
|
401
|
+
attested: l.attested, supported: l.supported, proof: l.proof,
|
|
402
|
+
seedsCrawled: l.seedsCrawled, adapters: l.adapters,
|
|
403
|
+
failures: l.failures,
|
|
404
|
+
sourcesContributed: l.sourcesContributed,
|
|
405
|
+
realUrls: l.realUrls, placeholderUrls: l.placeholderUrls,
|
|
406
|
+
citations: l.citations,
|
|
407
|
+
rawLines: l.rawLines,
|
|
408
|
+
})),
|
|
409
|
+
zeroYieldLanes: rep.zeroYieldLanes.map((l) => `${l.lane}[${l.section ?? "-"}]: ${l.atomsPacked} atoms / ${l.sourcesPacked} sources / util=${l.utilizationPct}%`),
|
|
410
|
+
quarantinedLanes: rep.quarantinedLanes.map((l) => `${l.lane}[${l.section ?? "-"}]`),
|
|
411
|
+
unattributedCitations: rep.unattributedCitations,
|
|
412
|
+
allRealUrls: rep.allRealUrls,
|
|
413
|
+
allPlaceholderUrls: rep.allPlaceholderUrls,
|
|
414
|
+
},
|
|
415
|
+
null,
|
|
416
|
+
2
|
|
417
|
+
);
|
|
418
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* scraper-lane-roadmap.ts — code-level repair and verification contract per lane.
|
|
3
|
+
*
|
|
4
|
+
* Each entry names the actual workspace seam that is live today. `test` is a
|
|
5
|
+
* falsifiable predicate, not "inspect manually". Runtime tests require a real
|
|
6
|
+
* browser/network run; pure gates are covered by self-test.ts.
|
|
7
|
+
*/
|
|
8
|
+
export interface LaneRoadmapEntry {
|
|
9
|
+
lane: string;
|
|
10
|
+
role: string;
|
|
11
|
+
observedFailure: string;
|
|
12
|
+
workspaceFile: string;
|
|
13
|
+
intervention: string;
|
|
14
|
+
test: string;
|
|
15
|
+
status: "hardened" | "observability-only" | "transport-limited";
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const SCRAPER_LANE_ROADMAP: LaneRoadmapEntry[] = [
|
|
19
|
+
{
|
|
20
|
+
lane: "structured-adapter",
|
|
21
|
+
role: "Academic/vertical API fan-out: Crossref, Semantic Scholar, arXiv, PubMed, Wikipedia, Internet Archive.",
|
|
22
|
+
observedFailure: "One vague/truncated query returned CSS resets, genome protocols, civil-engineering and tea-market papers.",
|
|
23
|
+
workspaceFile: "src/lib/scraper-vnext/structured-source-adapter.ts",
|
|
24
|
+
intervention: "IFL fan-out over up to 3 whole-token facet queries; URL dedupe; accept only items coherent with at least one dispatched facet query.",
|
|
25
|
+
test: "For cannabis prompt, every accepted item has an absolute URL, >=80 chars, and facetCoherence >=0.2 against at least one dispatched query; CSS reset fixture rejected.",
|
|
26
|
+
status: "hardened",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
lane: "canonical-portfolio",
|
|
30
|
+
role: "Bounded hedged orchestrator across terminal/sentinel/other retrieval lanes.",
|
|
31
|
+
observedFailure: "Winner could report sources while ledger later contained off-topic or placeholder records.",
|
|
32
|
+
workspaceFile: "src/lib/scraper-vnext/canonical-portfolio-orchestrator.ts",
|
|
33
|
+
intervention: "Harden input query through IFL; filter winner sources by URL, content, quarantine and facet coherence; set ok=false if none survive.",
|
|
34
|
+
test: "`portfolio.ok === true` implies `portfolio.sources.length >= 1` and every source passes filterRelevantSources.",
|
|
35
|
+
status: "hardened",
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
lane: "terminal-wire",
|
|
39
|
+
role: "High-priority structured search + arbiter + crawl lane inside canonical portfolio.",
|
|
40
|
+
observedFailure: "Often reports fulfilled/winner while downstream reads abort or final relevance is weak.",
|
|
41
|
+
workspaceFile: "src/lib/scraper-vnext/canonical-portfolio-orchestrator.ts",
|
|
42
|
+
intervention: "Cannot intercept terminal-wire's relative internal adapter directly; canonical-portfolio wrapper gates its final source set and forensics retains every failure.",
|
|
43
|
+
test: "Terminal winner may remain fulfilled, but portfolio return cannot contain a source rejected by the workspace relevance gate.",
|
|
44
|
+
status: "hardened",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
lane: "sentinel-orchestrator / sentinel-omega / vanguard-packer / omni-nexus",
|
|
48
|
+
role: "Internal canonical-portfolio hedge lanes.",
|
|
49
|
+
observedFailure: "Sparse/no direct source metadata; completion status alone is not evidence yield.",
|
|
50
|
+
workspaceFile: "src/lib/scraper-vnext/canonical-portfolio-orchestrator.ts",
|
|
51
|
+
intervention: "Final portfolio source gate; per-lane event retention in scraper-forensics. Internal relative calls are not individually interceptable.",
|
|
52
|
+
test: "No internal lane completion can cause `portfolio.ok=true` unless at least one gated source survives.",
|
|
53
|
+
status: "observability-only",
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
lane: "vanguard",
|
|
57
|
+
role: "Epistemic claim/atom packing.",
|
|
58
|
+
observedFailure: "Repeatedly packed 2–19 atoms and 0 sources; package mapper then fabricated `source-N` URL fields.",
|
|
59
|
+
workspaceFile: "src/lib/scraper-vnext/vanguard-titanium.ts",
|
|
60
|
+
intervention: "Run for diagnostics/atoms but force `ok=false` so it can never terminate the grounding chain until the package exposes absolute source URLs.",
|
|
61
|
+
test: "Workspace vanguard wrapper always returns `ok=false`; subsequent debug log shows palisade/arbiter fallthrough; no new ledger URL matches /^source-\\d+$/. ",
|
|
62
|
+
status: "hardened",
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
lane: "palisade",
|
|
66
|
+
role: "Disposition/provenance adjudication over claims.",
|
|
67
|
+
observedFailure: "Supported/attested claims are also converted to `source-N` by package grounding.",
|
|
68
|
+
workspaceFile: "src/lib/scraper-palisade/palisade-adjudicator.ts",
|
|
69
|
+
intervention: "Run adjudication but force `ok=false`, delegating to URL-bearing arbiter and later lanes.",
|
|
70
|
+
test: "Workspace palisade wrapper always returns `ok=false`; no palisade claim enters citation ledger as `source-N`.",
|
|
71
|
+
status: "hardened",
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
lane: "arbiter-omega",
|
|
75
|
+
role: "Frame-aware contradiction resolution over URL-bearing sources.",
|
|
76
|
+
observedFailure: "Length-only source admission permitted topical drift.",
|
|
77
|
+
workspaceFile: "src/lib/scraper-vnext/arbiter-omega.ts",
|
|
78
|
+
intervention: "IFL query hardening + URL/content/quarantine/facet gate; ok=false when fewer than 2 survive.",
|
|
79
|
+
test: "`arbiter.ok` implies >=2 surviving coherent URL-backed sources.",
|
|
80
|
+
status: "hardened",
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
lane: "sibyl",
|
|
84
|
+
role: "Bayesian confidence + syndication/independence detection.",
|
|
85
|
+
observedFailure: "Could delegate after weak evidence; returned items were only length-gated.",
|
|
86
|
+
workspaceFile: "src/lib/scraper-vnext/sibyl-oracle.ts",
|
|
87
|
+
intervention: "IFL query hardening + final source relevance gate; preserve upstream syndication logic.",
|
|
88
|
+
test: "`sibyl.ok` implies >=2 surviving coherent URL-backed sources; otherwise delegation continues.",
|
|
89
|
+
status: "hardened",
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
lane: "strata",
|
|
93
|
+
role: "Quorum attestation + transport-resolved reconstruction.",
|
|
94
|
+
observedFailure: "Quorum could be computed over documents unrelated to the prompt.",
|
|
95
|
+
workspaceFile: "src/lib/scraper-vnext/strata-engine.ts",
|
|
96
|
+
intervention: "IFL query hardening + post-quorum facet gate; ok=false when fewer than 2 survive.",
|
|
97
|
+
test: "`strata.ok` implies >=2 coherent URL-backed sources after quarantine.",
|
|
98
|
+
status: "hardened",
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
lane: "nexus",
|
|
102
|
+
role: "Cross-source triangulation and consensus clustering.",
|
|
103
|
+
observedFailure: "Logs showed 1 clean source; insufficient independence; downstream still continued through many failed transports.",
|
|
104
|
+
workspaceFile: "src/lib/scraper-vnext/nexus-consensus.ts",
|
|
105
|
+
intervention: "IFL query hardening + post-consensus facet gate; preserve clusters but prevent drift source return.",
|
|
106
|
+
test: "`nexus.ok` implies >=2 coherent URL-backed sources; 1-source result remains false and delegates.",
|
|
107
|
+
status: "hardened",
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
lane: "hydra",
|
|
111
|
+
role: "Text-density cascade and multi-transport reader.",
|
|
112
|
+
observedFailure: "Direct/Jina/proxy/Wayback failures and circuit-open states dominated logs.",
|
|
113
|
+
workspaceFile: "src/lib/scraper-vnext/hydra-reader.ts",
|
|
114
|
+
intervention: "IFL query hardening + source relevance gate. Transport failures remain external constraints and are surfaced unchanged.",
|
|
115
|
+
test: "A transport failure never becomes a source; `hydra.ok` implies >=2 coherent URL-backed sources. Circuit errors remain visible in forensics.",
|
|
116
|
+
status: "transport-limited",
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
lane: "native-vnext",
|
|
120
|
+
role: "Browser retrieval, fusion/RRF, enrichment.",
|
|
121
|
+
observedFailure: "Fused results included irrelevant sources and thin/failed enrichments.",
|
|
122
|
+
workspaceFile: "src/lib/scraper-vnext/native-scraper-browser-vnext.ts",
|
|
123
|
+
intervention: "IFL query hardening + post-fusion URL/content/facet gate. Keeps fusion metadata, removes drift results.",
|
|
124
|
+
test: "Every returned result has resolvable URL, >=80 chars combined text, facetCoherence >=0.2, and no quarantine flag.",
|
|
125
|
+
status: "hardened",
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
lane: "omega reader",
|
|
129
|
+
role: "Read/enrichment attempts for DOI and page content.",
|
|
130
|
+
observedFailure: "Many ABORTED reads; malformed log URL included trailing colon.",
|
|
131
|
+
workspaceFile: "src/lib/debug/scraper-forensics.ts",
|
|
132
|
+
intervention: "Failure observability only; the reader is internal to package portfolio and not separately alias-imported by the live grounding file.",
|
|
133
|
+
test: "Every ABORTED/read-failed event appears under lane failures and is never counted as a clean source.",
|
|
134
|
+
status: "transport-limited",
|
|
135
|
+
},
|
|
136
|
+
];
|