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.
Files changed (365) hide show
  1. package/diagnostics.mjs +141 -0
  2. package/dist/compute.worker-j5ahIpF-.js +1 -0
  3. package/dist/graph.worker-DG6iGCB9.js +1 -0
  4. package/dist/index.html +2314 -0
  5. package/flatten-guide.md +248 -0
  6. package/index.html +12 -0
  7. package/package.json +38 -0
  8. package/src/App.orig.tsx +204 -0
  9. package/src/App.orig1.tsx +27 -0
  10. package/src/App.orig2.tsx +25 -0
  11. package/src/App.tsx +3 -0
  12. package/src/BaseApp.tsx +18 -0
  13. package/src/INTEGRATION_LEDGER.md +22 -0
  14. package/src/PERSIST_CANARY.orig.txt +1 -0
  15. package/src/PERSIST_CANARY.txt +1 -0
  16. package/src/REGRESSION_LEDGER.md +651 -0
  17. package/src/TEMPLATE_PIPELINE_AUDIT.md +208 -0
  18. package/src/WILLIAMS_PERSONA_GUIDE.md +62 -0
  19. package/src/chat/VeritasChat.tsx +69 -0
  20. package/src/chat/synthesis.ts +31 -0
  21. package/src/chat/tier.ts +45 -0
  22. package/src/components/AdaptersPage.orig.tsx +99 -0
  23. package/src/components/AdaptersPage.tsx +3 -0
  24. package/src/components/AdversarialPanel.tsx +136 -0
  25. package/src/components/AnchorBaselinePanel.tsx +75 -0
  26. package/src/components/AnswerPanel.tsx +60 -0
  27. package/src/components/ArtifactPanel.tsx +43 -0
  28. package/src/components/ChatApp.orig.tsx +1582 -0
  29. package/src/components/ChatApp.orig1.tsx +722 -0
  30. package/src/components/ChatApp.tsx +95 -0
  31. package/src/components/ChatAugmentPanels.tsx +73 -0
  32. package/src/components/CitationLedgerPanel.tsx +313 -0
  33. package/src/components/ComputeSandboxPanel.tsx +130 -0
  34. package/src/components/ConfigPanel.tsx +110 -0
  35. package/src/components/ControlPlanePage.tsx +195 -0
  36. package/src/components/CreativeTreeLifePage.tsx +234 -0
  37. package/src/components/CreativeTreeOfLifePanel.tsx +149 -0
  38. package/src/components/DebugTracePanel.tsx +137 -0
  39. package/src/components/DeepReasoningTrace.tsx +48 -0
  40. package/src/components/EntitySheetPanel.tsx +51 -0
  41. package/src/components/FailureModesPanel.tsx +104 -0
  42. package/src/components/GBSDashboard.tsx +239 -0
  43. package/src/components/GraphView.tsx +116 -0
  44. package/src/components/HUD.tsx +125 -0
  45. package/src/components/HypothesisPanel.tsx +67 -0
  46. package/src/components/InnovationGenomeEngine.tsx +792 -0
  47. package/src/components/InnovationPersonaGuide.tsx +348 -0
  48. package/src/components/InnovationPersonaPanel.tsx +289 -0
  49. package/src/components/LiveResourceHUD.tsx +109 -0
  50. package/src/components/LongWriterPanel.tsx +112 -0
  51. package/src/components/MainPipelineV10Bridge.tsx +72 -0
  52. package/src/components/MarkdownLite.tsx +63 -0
  53. package/src/components/MemoryInspector.tsx +38 -0
  54. package/src/components/MemoryMonitor.tsx +52 -0
  55. package/src/components/MemoryStressPanel.tsx +176 -0
  56. package/src/components/ModulesPage.tsx +171 -0
  57. package/src/components/PipelineDebugConsole.orig.tsx +1856 -0
  58. package/src/components/PipelineDebugConsole.tsx +3 -0
  59. package/src/components/PreFlightHUD.tsx +67 -0
  60. package/src/components/PrismaFetchTracePanel.tsx +87 -0
  61. package/src/components/ReportOSPanel.tsx +165 -0
  62. package/src/components/ResourceEstimatorPage.tsx +327 -0
  63. package/src/components/RichText.tsx +181 -0
  64. package/src/components/SagaOsPanel.tsx +605 -0
  65. package/src/components/SagaOsReference.tsx +421 -0
  66. package/src/components/SagaOsV2Panel.tsx +594 -0
  67. package/src/components/SagaStyleTab.tsx +382 -0
  68. package/src/components/SageBlueprintPanel.tsx +416 -0
  69. package/src/components/SharedChatInput.tsx +77 -0
  70. package/src/components/StatFinancePanel.tsx +190 -0
  71. package/src/components/StylePersonaPanel.tsx +128 -0
  72. package/src/components/TemplatesPage.tsx +300 -0
  73. package/src/components/TestPanel.tsx +63 -0
  74. package/src/components/TraceLog.tsx +89 -0
  75. package/src/components/V15CalibrationAugment.tsx +1134 -0
  76. package/src/components/V15CalibrationDialog.tsx +1871 -0
  77. package/src/components/V15Overlay.orig.tsx +120 -0
  78. package/src/components/V15Overlay.tsx +4 -0
  79. package/src/components/V15OverlayWrapper.tsx +362 -0
  80. package/src/components/V15Toggle.tsx +34 -0
  81. package/src/console/DiagnosticRecoveryPanel.tsx +358 -0
  82. package/src/console/EngineeringConsole.tsx +103 -0
  83. package/src/console/FictionSystemPanels.tsx +882 -0
  84. package/src/console/InspectorPanels.tsx +254 -0
  85. package/src/console/ManuscriptGraderPanel.tsx +182 -0
  86. package/src/console/RecursiveReviserPanel.tsx +245 -0
  87. package/src/console/SeedControlPanel.tsx +135 -0
  88. package/src/console/StoryControllerPanel.tsx +443 -0
  89. package/src/console/engineBridge.ts +258 -0
  90. package/src/console/gemini.ts +106 -0
  91. package/src/console/grading.ts +250 -0
  92. package/src/console/util.ts +45 -0
  93. package/src/fiction/continuity.ts +372 -0
  94. package/src/fiction/crash-protection.ts +111 -0
  95. package/src/fiction/diagnostics.ts +208 -0
  96. package/src/fiction/diff.ts +74 -0
  97. package/src/fiction/entity-state-machine.ts +214 -0
  98. package/src/fiction/nive-engine.ts +404 -0
  99. package/src/fiction/pipeline-selftest.ts +132 -0
  100. package/src/fiction/seed-control.ts +193 -0
  101. package/src/fiction/story-engine.ts +326 -0
  102. package/src/fiction/types.ts +68 -0
  103. package/src/flatten-guide.md +379 -0
  104. package/src/index.css +14 -0
  105. package/src/index.orig.css +13 -0
  106. package/src/lib/academic-sources.base.ts +188 -0
  107. package/src/lib/academic-sources.orig.ts +28 -0
  108. package/src/lib/academic-sources.ts +10 -0
  109. package/src/lib/advanced-math.ts +119 -0
  110. package/src/lib/adversarial-engine.base.ts +409 -0
  111. package/src/lib/adversarial-engine.ts +82 -0
  112. package/src/lib/ai-revision.ts +623 -0
  113. package/src/lib/app-state.tsx +426 -0
  114. package/src/lib/artifact-registry.ts +97 -0
  115. package/src/lib/artifacts.ts +180 -0
  116. package/src/lib/atlas-dr.ts +167 -0
  117. package/src/lib/browser-mtls.ts +127 -0
  118. package/src/lib/browser-queue.ts +221 -0
  119. package/src/lib/browser-search-scraper.base.ts +382 -0
  120. package/src/lib/browser-search-scraper.orig.ts +90 -0
  121. package/src/lib/browser-search-scraper.ts +10 -0
  122. package/src/lib/calc-interceptor.ts +82 -0
  123. package/src/lib/citation-lane-tap.ts +78 -0
  124. package/src/lib/citation-ledger-store.ts +369 -0
  125. package/src/lib/citation-ledger.ts +203 -0
  126. package/src/lib/compute-sandbox.ts +215 -0
  127. package/src/lib/compute.worker.ts +153 -0
  128. package/src/lib/connectors/gemini.ts +120 -0
  129. package/src/lib/connectors/jina.ts +233 -0
  130. package/src/lib/connectors/marketdata.ts +51 -0
  131. package/src/lib/connectors/prismafetch.base.ts +175 -0
  132. package/src/lib/connectors/prismafetch.ts +1 -0
  133. package/src/lib/connectors/serpapi.ts +65 -0
  134. package/src/lib/connectors/wikidata.ts +44 -0
  135. package/src/lib/constraints.ts +331 -0
  136. package/src/lib/continuation-detector.base.ts +153 -0
  137. package/src/lib/continuation-detector.ts +48 -0
  138. package/src/lib/contradraft.ts +168 -0
  139. package/src/lib/cors-proxy.ts +120 -0
  140. package/src/lib/coverage.ts +81 -0
  141. package/src/lib/debug/architecture-prescription.ts +556 -0
  142. package/src/lib/debug/covea-repair.ts +543 -0
  143. package/src/lib/debug/helios-ground.ts +319 -0
  144. package/src/lib/debug/intent-decomposer.ts +281 -0
  145. package/src/lib/debug/intent-lattice.ts +349 -0
  146. package/src/lib/debug/pipeline-diagnosis.ts +1149 -0
  147. package/src/lib/debug/pipeline-trace-bus.ts +424 -0
  148. package/src/lib/debug/prompt-forge.ts +678 -0
  149. package/src/lib/debug/repair-sites.ts +513 -0
  150. package/src/lib/debug/research-phase.ts +266 -0
  151. package/src/lib/debug/retrieval-context.ts +76 -0
  152. package/src/lib/debug/retrieval-hardener.ts +142 -0
  153. package/src/lib/debug/scraper-debug-runner.ts +576 -0
  154. package/src/lib/debug/scraper-forensics.ts +418 -0
  155. package/src/lib/debug/scraper-lane-roadmap.ts +136 -0
  156. package/src/lib/debug/self-test.ts +415 -0
  157. package/src/lib/debug/step-attribution.ts +211 -0
  158. package/src/lib/debug/template-rubric.ts +301 -0
  159. package/src/lib/debug/unified-innovation.ts +126 -0
  160. package/src/lib/debug/veritas-hybrid-scraper.ts +335 -0
  161. package/src/lib/defense-registry.ts +104 -0
  162. package/src/lib/defenses.ts +162 -0
  163. package/src/lib/deterministic-citation-ledger.ts +174 -0
  164. package/src/lib/elo-registry.base.ts +117 -0
  165. package/src/lib/elo-registry.ts +1 -0
  166. package/src/lib/entity-resolver.ts +291 -0
  167. package/src/lib/failure-modes.ts +267 -0
  168. package/src/lib/feature-registry.ts +69 -0
  169. package/src/lib/flaw-registry.ts +143 -0
  170. package/src/lib/flaws/_template.ts +52 -0
  171. package/src/lib/flaws/builtins.ts +63 -0
  172. package/src/lib/flaws/finance.ts +169 -0
  173. package/src/lib/flaws/fixers.ts +10 -0
  174. package/src/lib/flaws/index.ts +32 -0
  175. package/src/lib/flaws/legal.ts +157 -0
  176. package/src/lib/flaws/medical.ts +188 -0
  177. package/src/lib/flaws/original-defenses-pack.ts +81 -0
  178. package/src/lib/flaws/sample-declarative-pack.json +38 -0
  179. package/src/lib/flaws/selftest.ts +201 -0
  180. package/src/lib/flaws/software-extended.ts +125 -0
  181. package/src/lib/flaws/software-rn-webgl.ts +182 -0
  182. package/src/lib/flaws/statistics-advanced.ts +46 -0
  183. package/src/lib/flaws/statistics.ts +61 -0
  184. package/src/lib/gbse/config.ts +20 -0
  185. package/src/lib/gbse/engine.ts +226 -0
  186. package/src/lib/gbse/graph.ts +118 -0
  187. package/src/lib/gbse/graph.worker.ts +21 -0
  188. package/src/lib/gbse/tests.ts +117 -0
  189. package/src/lib/gbse/tiers.ts +65 -0
  190. package/src/lib/gbse/types.ts +94 -0
  191. package/src/lib/innovation-genome-engine-v2.orig.ts +1001 -0
  192. package/src/lib/innovation-genome-engine-v2.ts +3 -0
  193. package/src/lib/innovation-genome-engine.orig.ts +330 -0
  194. package/src/lib/innovation-genome-engine.ts +3 -0
  195. package/src/lib/innovation-genome-v10.orig.ts +314 -0
  196. package/src/lib/innovation-genome-v10.ts +2 -0
  197. package/src/lib/innovation-genome-v3.orig.ts +2015 -0
  198. package/src/lib/innovation-genome-v3.ts +2 -0
  199. package/src/lib/innovation-genome-v4.orig.ts +1959 -0
  200. package/src/lib/innovation-genome-v4.ts +2 -0
  201. package/src/lib/innovation-genome-v5.orig.ts +1210 -0
  202. package/src/lib/innovation-genome-v5.ts +2 -0
  203. package/src/lib/innovation-genome-v7.orig.ts +2549 -0
  204. package/src/lib/innovation-genome-v7.ts +2 -0
  205. package/src/lib/innovation-genome-v8.orig.ts +1485 -0
  206. package/src/lib/innovation-genome-v8.ts +2 -0
  207. package/src/lib/innovation-genome-v9.orig.ts +643 -0
  208. package/src/lib/innovation-genome-v9.ts +2 -0
  209. package/src/lib/jina.base.ts +293 -0
  210. package/src/lib/jina.ts +1 -0
  211. package/src/lib/live-telemetry.ts +61 -0
  212. package/src/lib/longwriter.ts +84 -0
  213. package/src/lib/manuscript-grade-v2.ts +298 -0
  214. package/src/lib/memory-governor.ts +173 -0
  215. package/src/lib/memory-stress-tests.ts +248 -0
  216. package/src/lib/model-intelligence.ts +48 -0
  217. package/src/lib/model-rotator.ts +75 -0
  218. package/src/lib/models.orig.ts +513 -0
  219. package/src/lib/models.ts +151 -0
  220. package/src/lib/n-deep.base.ts +592 -0
  221. package/src/lib/n-deep.ts +51 -0
  222. package/src/lib/nih-simulator.ts +56 -0
  223. package/src/lib/nih-vulnerability-fixes.ts +460 -0
  224. package/src/lib/omega-templates.base.ts +294 -0
  225. package/src/lib/omega-templates.ts +225 -0
  226. package/src/lib/omni-nexus.ts +64 -0
  227. package/src/lib/oracle-adapters.ts +67 -0
  228. package/src/lib/oracle-registry.ts +163 -0
  229. package/src/lib/orchestrator.ts +357 -0
  230. package/src/lib/output-boundary.ts +235 -0
  231. package/src/lib/overrides/vite-native-chaos-harness.ts +154 -0
  232. package/src/lib/overrides/vite-native-contract-plane.ts +245 -0
  233. package/src/lib/overrides/vite-native-doctor-plane.ts +208 -0
  234. package/src/lib/overrides/vite-native-knowledge-store.ts +267 -0
  235. package/src/lib/overrides/vite-native-policy-plane.ts +190 -0
  236. package/src/lib/overrides/vite-native-replay-plane.ts +197 -0
  237. package/src/lib/overrides/vite-native-runtime-plane.ts +106 -0
  238. package/src/lib/overrides/vite-native-scraper.ts +848 -0
  239. package/src/lib/overrides/vite-native-selftest-functional.ts +217 -0
  240. package/src/lib/overrides/vite-native-selftest.ts +183 -0
  241. package/src/lib/overrides/vite-native-snapshot-plane.ts +123 -0
  242. package/src/lib/philosophy-toolkit.ts +75 -0
  243. package/src/lib/pipeline.orig.ts +659 -0
  244. package/src/lib/pipeline.ts +42 -0
  245. package/src/lib/precache.ts +128 -0
  246. package/src/lib/py-sandbox.ts +205 -0
  247. package/src/lib/quality-score.ts +96 -0
  248. package/src/lib/quant-engine.ts +231 -0
  249. package/src/lib/quant-lib.ts +80 -0
  250. package/src/lib/reportos.ts +175 -0
  251. package/src/lib/research-os.ts +306 -0
  252. package/src/lib/resource-estimator.ts +114 -0
  253. package/src/lib/rpm-governor.ts +93 -0
  254. package/src/lib/runtime-estimator.ts +135 -0
  255. package/src/lib/sage/empty-space-v6.ts +560 -0
  256. package/src/lib/sage/empty-space-v7.ts +222 -0
  257. package/src/lib/sage/empty-space.ts +733 -0
  258. package/src/lib/sage/engine.ts +786 -0
  259. package/src/lib/sage/index.ts +17 -0
  260. package/src/lib/sage/judge.ts +246 -0
  261. package/src/lib/sage/prng.ts +53 -0
  262. package/src/lib/sage/reality-grounding.ts +380 -0
  263. package/src/lib/sage/repetition.ts +151 -0
  264. package/src/lib/sage/saga-os-v2-engines.ts +1870 -0
  265. package/src/lib/sage/saga-os-v2.ts +274 -0
  266. package/src/lib/sage/saga-os-v3-core.ts +1491 -0
  267. package/src/lib/sage/saga-os-v3-release.ts +739 -0
  268. package/src/lib/sage/saga-os-v4-aureate.ts +1161 -0
  269. package/src/lib/sage/saga-os-v4.ts +212 -0
  270. package/src/lib/sage/saga-os-v5.ts +205 -0
  271. package/src/lib/sage/saga-os-v6.ts +346 -0
  272. package/src/lib/sage/saga-os-v7.ts +314 -0
  273. package/src/lib/sage/saga-os-v8.ts +505 -0
  274. package/src/lib/sage/saga-os.ts +329 -0
  275. package/src/lib/sage/taxonomy.ts +403 -0
  276. package/src/lib/sage/unified-roll.ts +524 -0
  277. package/src/lib/sage/worked-sketches.ts +44 -0
  278. package/src/lib/sage.ts +166 -0
  279. package/src/lib/scraper-debug-bus.ts +53 -0
  280. package/src/lib/scraper-enhanced.orig.ts +153 -0
  281. package/src/lib/scraper-enhanced.ts +10 -0
  282. package/src/lib/scraper-hardener.base.orig.ts +155 -0
  283. package/src/lib/scraper-hardener.base.ts +317 -0
  284. package/src/lib/scraper-hardener.ts +1 -0
  285. package/src/lib/scraper-palisade/palisade-adjudicator.orig.ts +419 -0
  286. package/src/lib/scraper-palisade/palisade-adjudicator.ts +13 -0
  287. package/src/lib/scraper-vnext/arbiter-omega.orig.ts +688 -0
  288. package/src/lib/scraper-vnext/arbiter-omega.ts +13 -0
  289. package/src/lib/scraper-vnext/canonical-portfolio-augments.ts +479 -0
  290. package/src/lib/scraper-vnext/canonical-portfolio-orchestrator.orig.ts +1529 -0
  291. package/src/lib/scraper-vnext/canonical-portfolio-orchestrator.ts +13 -0
  292. package/src/lib/scraper-vnext/conclave-omega.ts +1830 -0
  293. package/src/lib/scraper-vnext/content-extractor-v2.ts +226 -0
  294. package/src/lib/scraper-vnext/diagnostics-suite.ts +36 -0
  295. package/src/lib/scraper-vnext/epistemic-packer.ts +97 -0
  296. package/src/lib/scraper-vnext/fusion-v2.ts +65 -0
  297. package/src/lib/scraper-vnext/hydra-reader.orig.ts +1216 -0
  298. package/src/lib/scraper-vnext/hydra-reader.ts +13 -0
  299. package/src/lib/scraper-vnext/native-scraper-browser-vnext.orig.ts +91 -0
  300. package/src/lib/scraper-vnext/native-scraper-browser-vnext.ts +13 -0
  301. package/src/lib/scraper-vnext/nexus-consensus.orig.ts +905 -0
  302. package/src/lib/scraper-vnext/nexus-consensus.ts +13 -0
  303. package/src/lib/scraper-vnext/portfolio-consensus-adjudicator.ts +804 -0
  304. package/src/lib/scraper-vnext/portfolio-consensus-memory.ts +377 -0
  305. package/src/lib/scraper-vnext/portfolio-terminal-governor.ts +548 -0
  306. package/src/lib/scraper-vnext/query-strategist.orig.ts +224 -0
  307. package/src/lib/scraper-vnext/query-strategist.ts +423 -0
  308. package/src/lib/scraper-vnext/retrieval-accelerator.ts +708 -0
  309. package/src/lib/scraper-vnext/retrieval-audit-augments.ts +477 -0
  310. package/src/lib/scraper-vnext/retrieval-control-plane.ts +904 -0
  311. package/src/lib/scraper-vnext/retrieval-policy-augments.ts +358 -0
  312. package/src/lib/scraper-vnext/safe-fetch-v2.ts +157 -0
  313. package/src/lib/scraper-vnext/sentinel-omega.ts +56 -0
  314. package/src/lib/scraper-vnext/sentinel-orchestrator.ts +69 -0
  315. package/src/lib/scraper-vnext/sibyl-oracle.orig.ts +413 -0
  316. package/src/lib/scraper-vnext/sibyl-oracle.ts +13 -0
  317. package/src/lib/scraper-vnext/smart-read-v2.ts +55 -0
  318. package/src/lib/scraper-vnext/spa-rescue-bridge.ts +608 -0
  319. package/src/lib/scraper-vnext/strata-engine.orig.ts +2666 -0
  320. package/src/lib/scraper-vnext/strata-engine.ts +13 -0
  321. package/src/lib/scraper-vnext/structured-source-adapter.orig.ts +369 -0
  322. package/src/lib/scraper-vnext/structured-source-adapter.ts +34 -0
  323. package/src/lib/scraper-vnext/terminal-complete.ts +224 -0
  324. package/src/lib/scraper-vnext/terminal-final.ts +277 -0
  325. package/src/lib/scraper-vnext/terminal-saturation.ts +345 -0
  326. package/src/lib/scraper-vnext/terminal-wire.ts +425 -0
  327. package/src/lib/scraper-vnext/vanguard-titanium.orig.ts +467 -0
  328. package/src/lib/scraper-vnext/vanguard-titanium.ts +17 -0
  329. package/src/lib/search-cache.ts +138 -0
  330. package/src/lib/sloop-runner.base.ts +223 -0
  331. package/src/lib/sloop-runner.ts +104 -0
  332. package/src/lib/sloop.ts +114 -0
  333. package/src/lib/small-model-adapters.ts +82 -0
  334. package/src/lib/sscp.ts +86 -0
  335. package/src/lib/system-map.ts +54 -0
  336. package/src/lib/uni-node.ts +86 -0
  337. package/src/lib/universal-rigor-guard.ts +433 -0
  338. package/src/lib/v15-gate-testbed.ts +274 -0
  339. package/src/lib/v15-gemini.base.ts +89 -0
  340. package/src/lib/v15-gemini.ts +1 -0
  341. package/src/lib/v15-grounding.orig.ts +241 -0
  342. package/src/lib/v15-grounding.ts +79 -0
  343. package/src/lib/v15-pipeline.base.ts +769 -0
  344. package/src/lib/v15-pipeline.orig.ts +1154 -0
  345. package/src/lib/v15-pipeline.ts +674 -0
  346. package/src/lib/v15-questions.ts +64 -0
  347. package/src/lib/v15-rate-limiter.orig.ts +91 -0
  348. package/src/lib/v15-rate-limiter.ts +48 -0
  349. package/src/lib/v15-state.base.ts +87 -0
  350. package/src/lib/v15-state.ts +28 -0
  351. package/src/lib/visual-table-generator.tsx +207 -0
  352. package/src/lib/wasm-runtime.ts +133 -0
  353. package/src/lib/williams-persona-guide.ts +265 -0
  354. package/src/lib/williams-style.base.ts +464 -0
  355. package/src/lib/williams-style.ts +59 -0
  356. package/src/lib/worker-pool.ts +96 -0
  357. package/src/lib/writing-tiers.ts +125 -0
  358. package/src/main.orig.tsx +10 -0
  359. package/src/main.tsx +10 -0
  360. package/src/utils/cn.orig.ts +6 -0
  361. package/src/utils/cn.ts +6 -0
  362. package/src/vite-env.d.ts +1 -0
  363. package/tsconfig.json +31 -0
  364. package/unify.mjs +537 -0
  365. package/vite.config.ts +18 -0
@@ -0,0 +1,379 @@
1
+ # VERITAS V15 — Authoritative Persistence & Flatten Guide (`flatten-guide.md`)
2
+
3
+ **Author:** Codex (v29.1+ OMEGA-FORGE Adaptive Turn 24+).
4
+ **Source of Truth** for every optimal update across the full chat history and additive VNext extensions.
5
+
6
+ This environment persists ONLY files under `src/`. Everything below documents the persistent `src/` architecture, additive shims, and the exact flattening specification required for any future zero-dependency collapse.
7
+
8
+ ---
9
+
10
+ ## PART 1 — CURRENT PERSISTENT `src/` ARCHITECTURE & SEAMS
11
+
12
+ ### 1. Root & Entry Seams (`src/`)
13
+ - `src/App.tsx` → Compositional sidecar wrapper mounting `src/App.tsx`.
14
+ - `src/main.tsx` → React 19 root renderer.
15
+ - `src/index.css` → `@source "../node_modules/src"` explicitly scanning package Tailwind classes, plus `@import "tailwindcss";` v4 setup.
16
+ - `src/PERSIST_CANARY.txt` → Contains canary timestamp string (`PERSIST_20260523T000000Z_Q7X4M2`).
17
+
18
+ ### 2. UI & Overlay Component Seams (`src/components/`)
19
+ - `src/components/V15Overlay.tsx` → **Workspace Override:** Renders the floating V15 control pill (`V15Toggle`, `📊 Calibrate`, `📖 Guide`, `🔍 SearXNG`, and the interactive `⚡ Titanium: ON/OFF` toggle button controlling Vanguard-Titanium Virtual Egress routes).
20
+ - `src/components/V15CalibrationDialog.tsx` → Shims package dialog (full 1872-line Rigor Guard dialog: title bar, Live Compare / Batch Bank / Web Grounding Guide / Advanced Config / Divergence Log sub-tabs, ProfileBar, Draft Stats, Best-of-N candidates, CoVe, Adversarial Preview, Citation Audit panel, Gate Testbed, 246 Defense).
21
+ - `src/components/V15CalibrationAugment.tsx` → **NEW (durable UI restoration):** MutationObserver-based augment mounted by `V15Overlay`. Injects the origin-baseline header controls the package omits — `Cite [APA/MLA/Chicago/IEEE/AMA]` dropdown (persists to `veritas.v15.citationStyle`), `Native` self-test button, `🎭 Personas` button — plus a full 24-archetype **Persona Guide modal** (rarity/tier + voice/do/avoid/cadence). Runs a one-time-per-open **Default Calibration Controller** (drives real React inputs) enforcing: Williams persona = The Strategist, Template OMEGA-STRATEGY, Style --bain-pe, Best-of-N Models 1 / Hypotheses 7 / Pack outlines ON, Gate Testbed ON (via `setAdvancedGatesEnabled`). Injects a **Calculation Trace** card into the row detail pane that re-derives every `a op b = c` and marks `calc verified` / `no verify`.
22
+ - `src/components/V15Toggle.tsx`, `ChatApp.tsx`, `GBSDashboard.tsx`, `ControlPlanePage.tsx`, `TemplatesPage.tsx`, `ModulesPage.tsx`, `AdaptersPage.tsx`, `AdversarialPanel.tsx`, `MemoryInspector.tsx`, `ResourceEstimatorPage.tsx` → 10 persistent component re-export seams.
23
+
24
+ ### 3. Core Engine Shims & Extensions (`src/lib/`)
25
+ - `src/lib/v15-pipeline.ts` → **Workspace Override:** Wraps `runV15OnQuestion` to pre-ground queries using our upgraded VNext grounding stack (`groundQuestion` from `@/lib/v15-grounding`) whenever web grounding is enabled.
26
+ - `src/lib/v15-grounding.ts` → **Workspace Override:** Primary grounding orchestrator. Exports `getTitaniumEgressEnabled` / `setTitaniumEgressEnabled` and overrides `groundQuestion(opts)` to execute:
27
+ 1. `groundTerminalSaturated` (`terminal-saturation.ts`, Tier -9; supplementary mode is off by default)
28
+ 2. `groundTerminalFinal` (`terminal-final.ts`, Tier -8)
29
+ 3. `groundTerminalComplete` (`terminal-complete.ts`, Tier -7)
30
+ 4. `groundWithPortfolioConsensus` (`portfolio-consensus-adjudicator.ts`, Tier -6)
31
+ 5. `groundWithAuditedPortfolio` (`canonical-portfolio-augments.ts`, Tier -5)
32
+ 6. `terminalWireGround` (`terminal-wire.ts`, Tier -4)
33
+ 7. `vanguardGround` (`vanguard-titanium.ts`, Tier -3)
34
+ 8. Package default `originalGroundQuestion` fallback.
35
+ Also exports `runV15GroundingStackDiagnostics()` running all 7 diagnostic suites.
36
+ - `src/lib/omni-nexus.ts` → **NEW:** Canonical Omni-Nexus grounding lane (`omniNexusGround`).
37
+
38
+ ### 4. Scraper VNext Additive Stack (`src/lib/scraper-vnext/`)
39
+ - `src/lib/scraper-vnext/canonical-portfolio-orchestrator.ts` → **NEW (gpt-5.6-sol-search-xhigh):** Implements canonical portfolio orchestration (`buildLaneSpecs`, `runLane`, `runHedged`, `runAuditAll`, `chooseBest`, `groundWithCanonicalPortfolio`, `runCanonicalPortfolioDiagnostics`).
40
+ - `src/lib/scraper-vnext/portfolio-consensus-adjudicator.ts` → **NEW (claude-opus-4-8-search):** Implements family-aware claim corroboration and strictly-dominant consensus tie-breaking (`ENGINE_FAMILY`, `familyOf`, `groundWithPortfolioConsensus`, `runPortfolioConsensusDiagnostics`).
41
+ - `src/lib/scraper-vnext/canonical-portfolio-augments.ts` → **NEW (Research docs):** Implements yield memory, lane-independence audit, persisted origin backoff, marginal evidence gain stop, and `groundWithAuditedPortfolio` (`runCanonicalPortfolioAugmentDiagnostics`).
42
+ - `src/lib/scraper-vnext/portfolio-consensus-memory.ts` → **NEW (claude-sonnet-5-search):** Honest CanonicalLaneId-keyed cross-session memory and family-pair corroboration ledger (`groundWithAdaptivePortfolioConsensus`, `runPortfolioConsensusMemoryDiagnostics`).
43
+ - `src/lib/scraper-vnext/portfolio-terminal-governor.ts` → **NEW (gpt-5.6-sol-search-xhigh):** Corrective context-scoped memory governor, zero-fulfillment temporary quarantine, aborted-lane censoring, per-run family-pair de-duplication, current-run snapshot (`groundWithTerminalPortfolioGovernor`, `runPortfolioTerminalGovernorDiagnostics`).
44
+ - `src/lib/scraper-vnext/terminal-complete.ts` → **NEW (Research synthesis):** Final terminal synthesis combining structured parallel prefetch, adaptive portfolio consensus memory, terminal governor, real-time family independence, marginal gain advisory, and one-stop diagnostics (`groundTerminalComplete`, `runTerminalCompleteDiagnostics`).
45
+ - `src/lib/scraper-vnext/terminal-final.ts` → **NEW (claude-opus-4-6-search):** Governor-native final facade. Adds strict RFC 9309 helper (`makeRfc9309RobotsDecision`), structured prefetch, real-time family independence, marginal-gain advisory, and a unified diagnostic hub (`groundTerminalFinal`, `runTerminalFinalDiagnostics`).
46
+ - `src/lib/scraper-vnext/terminal-saturation.ts` → **NEW (reviewed research addon):** Optional `off`/`advisory`/`merge` DataCite and Europe PMC metadata supplement with fail-soft public API retrieval, separate local WebCrypto commitment, duplicate suppression, and cooperative yielding. It is off by default (`groundTerminalSaturated`, `runTerminalSaturationDiagnostics`).
47
+ - `src/lib/scraper-vnext/sentinel-orchestrator.ts` → **NEW:** Canonical Sentinel Orchestrator lane (`sentinelGround`).
48
+ - `src/lib/scraper-vnext/sentinel-omega.ts` → **NEW:** Canonical Sentinel Omega lane (`groundWithSentinelOmega`).
49
+ - `src/lib/scraper-vnext/spa-rescue-bridge.ts` → **UPGRADED:** Closes the canonical cause-bridge gap. Exports `detectChallenge`, `isSoftFailure`, `withSpaRescueCause<T>`, `withSpaRescueFromRawResponse<T>`, and `runSpaRescueBridgeDiagnostics()` (all 9 asynchronous test cases).
50
+ - `src/lib/scraper-vnext/vanguard-titanium.ts` → **Workspace Override:** Adds Titanium Virtual Egress (`buildGoogleTranslateUrl`, `buildAmpCacheUrl`, `buildRssGatewayUrl`), SPA Shell Salvage (`salvageMetadata`), 0-1 DP Epistemic Knapsack Packing (`packEvidence`), and `vanguardGround(query, opts)`.
51
+ - `src/lib/scraper-vnext/terminal-wire.ts` → **NEW:** Adds one-shot terminal grounding (`withChallengeGateCause`, `buildTitaniumTranslateLanes`, `buildTitaniumAmpLanes`, `terminalWireGround`).
52
+ - `src/lib/scraper-vnext/retrieval-audit-augments.ts` → **NEW:** Yield-aware queue memory, lane-independence audit, persisted origin backoff, marginal evidence gain stop.
53
+ - `src/lib/scraper-vnext/structured-source-adapter.ts` → **Workspace Override:** Re-exports package structured adapter while exporting `buildAmpCacheUrl`, `fetchViaAmpCache`, and `wrappedStructuredChallengeReader`.
54
+ - `src/lib/scraper-vnext/*` → Shims for `retrieval-control-plane`, `retrieval-policy-augments`, `epistemic-packer`, `retrieval-accelerator`, `conclave-omega`, `content-extractor-v2`, `diagnostics-suite`, `fusion-v2`, `safe-fetch-v2`, `smart-read-v2`.
55
+
56
+ ---
57
+
58
+ ## PART 2 — SYMBOL PRECEDENCE & RESOLUTION TABLE
59
+
60
+ When flattening or overriding, **workspace definitions in `src/` take strict precedence** over `node_modules/src/`:
61
+
62
+ | Symbol | Canonical Winner | Internal Callers to Repoint |
63
+ |---|---|---|
64
+ | `runV15OnQuestion` | `src/lib/v15-pipeline.ts` | All calibration dialog batch & live handlers, chat synthesis |
65
+ | `groundQuestion` | `src/lib/v15-grounding.ts` | `runV15OnQuestion`, `HDIG`, `CoVe`, `N-Deep`, template grounding |
66
+ | `groundTerminalSaturated` | `src/lib/scraper-vnext/terminal-saturation.ts` | `groundQuestion` (Tier -9; default mode off) |
67
+ | `groundTerminalFinal` | `src/lib/scraper-vnext/terminal-final.ts` | `groundQuestion` (Tier -8) |
68
+ | `groundTerminalComplete` | `src/lib/scraper-vnext/terminal-complete.ts` | `groundQuestion` (Tier -7) |
69
+ | `groundWithCanonicalPortfolio` | `src/lib/scraper-vnext/canonical-portfolio-orchestrator.ts` | `portfolio-consensus-adjudicator.ts`, `canonical-portfolio-augments.ts` |
70
+ | `groundWithPortfolioConsensus` | `src/lib/scraper-vnext/portfolio-consensus-adjudicator.ts` | `groundQuestion` (Tier -6) |
71
+ | `groundWithAdaptivePortfolioConsensus` | `src/lib/scraper-vnext/portfolio-consensus-memory.ts` | `terminal-complete.ts`, `portfolio-terminal-governor.ts` |
72
+ | `groundWithTerminalPortfolioGovernor` | `src/lib/scraper-vnext/portfolio-terminal-governor.ts` | `terminal-complete.ts` |
73
+ | `groundWithAuditedPortfolio` | `src/lib/scraper-vnext/canonical-portfolio-augments.ts` | `groundQuestion` (Tier -5) |
74
+ | `vanguardGround` | `src/lib/scraper-vnext/vanguard-titanium.ts` | `groundQuestion` (Tier -3), `terminalWireGround` |
75
+ | `terminalWireGround` | `src/lib/scraper-vnext/terminal-wire.ts` | `groundQuestion` (Tier -4) |
76
+ | `withSpaRescueCause` | `src/lib/scraper-vnext/spa-rescue-bridge.ts` | Bounded crawl readers in `terminal-wire.ts` and portfolio orchestrator |
77
+ | `getTitaniumEgressEnabled` | `src/lib/v15-grounding.ts` | `V15Overlay`, `groundQuestion`, status bar toggles |
78
+
79
+ ---
80
+
81
+ ## PART 3 — LOCALSTORAGE & STATE KEY REGISTRY
82
+
83
+ All V15 settings persist cleanly to `localStorage`:
84
+ - `veritas.v15.enableTitaniumEgress` — `"true"` | `"false"` (controls Titanium Google Translate & AMP virtual egress routes).
85
+ - `veritas.settings.v2` — JSON blob containing `"enableTitaniumEgress": true|false`.
86
+ - `veritas.v15.enabled` — `"true"` | `"false"`.
87
+ - `veritas.v15.defaultsVersion` — Currently versioned at `"20"`.
88
+ - `veritas.v15.searxngUrl` — Custom local search endpoint.
89
+ - IndexedDB stores (`canonical-portfolio-audits-v1` / `retrieval-audit-augments`):
90
+ - ObjectStore `"yield"` (keyPath: `"key"` / `"domainLane"`) for historical domain+lane success rate & latency.
91
+ - ObjectStore `"backoff"` (keyPath: `"origin"`) for 429/503 origin leases.
92
+
93
+ ---
94
+
95
+ ## PART 3B — CANONICAL WILLIAMS PERSONA GUIDE (screenshot 1:1 restore)
96
+
97
+ The origin repo's Persona Guide (personas incl. The Skeptic / Synthesist /
98
+ Pragmatist / Visionary, and the rich detail layout) is **NOT** shipped by the
99
+ `unkbv10` package — its `ARCHETYPES` roster is a different style-only list.
100
+ It is therefore reconstructed as durable workspace source and must be preserved:
101
+
102
+ - `src/lib/williams-persona-guide.ts` → **Canonical data:** `PERSONA_GUIDE`
103
+ (24 entries: `name`, `tier` [Common/Uncommon/Rare/Epic/Legendary],
104
+ `rarityLabel`, `description`, `changes[]`, `suppresses[]`, `cadence`,
105
+ `transformation`, `wordCount`), `SHARED_IDEA` (constant bus sentence),
106
+ `ORACLE_BANNER` (featured Menu-Level Default View), `buildPersonaComparison(a,b)`.
107
+ - `src/components/V15CalibrationAugment.tsx` → **Canonical modal:** `PersonaGuideModal`
108
+ renders the screenshot 1:1 — header (`📋 Williams Persona Guide · 24 archetypes ·
109
+ Source: Joseph M. Williams, Style: Toward Clarity and Grace`), the violet Oracle
110
+ banner, the two-column **Archetype Menu** (tier badges + `rarity:` labels +
111
+ italic descriptions), and the right **Persona Guide** detail panel with
112
+ `WHAT IT CHANGES`, `WHAT IT SUPPRESSES` (+ Cadence), `SHARED IDEA`,
113
+ `50-100 WORD TRANSFORMATION` (word count), and the `Side-by-side comparison`
114
+ A/B dropdowns rendering `buildPersonaComparison`. Opened via the injected
115
+ `🎭 Personas` header button (event `veritas:open-personas`).
116
+
117
+ **Restore procedure if this regresses:** (1) recreate `williams-persona-guide.ts`
118
+ with all 24 entries verbatim from the screenshot menu (tier badge, rarity label,
119
+ italic description) — the first 6 strategic personas (Oracle, Architect, Skeptic,
120
+ Synthesist, Pragmatist, Visionary) have 2-sentence descriptions; the remaining 18
121
+ Williams personas use the terse cadence phrase. (2) Keep `SHARED_IDEA` and The
122
+ Oracle `transformation` verbatim from the screenshot; ALL 24 transformations
123
+ MUST derive from the exact same `SHARED_IDEA` string — never introduce a second
124
+ baseline sentence. (3) Ensure `PersonaGuideModal` renders all five detail
125
+ sections + Side-by-side. (4) Do not duplicate the button — the injector checks
126
+ `document.getElementById("veritas-augment-personas-btn")` before creating a new one.
127
+
128
+ ## PART 3C — FULL-FLEET SCRAPER ACTIVATION (origin package + VNext, no exceptions)
129
+
130
+ `src/lib/v15-grounding.ts` is the **sole** grounding entry point (`groundQuestion`)
131
+ consumed by `runV15OnQuestion` (`v15-pipeline.ts`). It invokes **every** scraper
132
+ lane from both the origin package and the VNext additive stack in parallel on
133
+ **every single call**, with zero omissions:
134
+
135
+ - **Origin package lanes:** `packageGroundQuestion` (aliased import of the
136
+ pristine `src/lib/v15-grounding.ts` export — chains native scraper →
137
+ PrismaFetch → OG browser scraper → SearXNG → Jina), `searchAcademicSources`
138
+ (PubMed, NIH Reporter, Europe PMC, Semantic Scholar, OpenAlex, CrossRef,
139
+ arXiv), `enhancedSearch` (HN Algolia, StackExchange×16, Reddit, GitHub, SEC
140
+ EDGAR, PatentsView, Wayback, Google/Bing/DDG/Wikipedia/Scholar/arXiv),
141
+ `browserScraperSearch` (direct OG scraper call).
142
+ - **VNext additive lanes:** `hydraGround`, `nexusResearch`, `sibylResearch`,
143
+ `strataCollect`, `arbiterResearch`, `palisadeGround`, `groundTerminalFinal`
144
+ (which itself chains the Governor → Portfolio Consensus → Vanguard-Titanium →
145
+ Terminal-Wire → Sentinel-Orchestrator → Sentinel-Omega → Omni-Nexus →
146
+ Structured-Source-Adapter).
147
+ - Every lane emits a line via `src/lib/scraper-debug-bus.ts`
148
+ (`emitScraperDebug(lane, message)`), which **always** echoes to
149
+ `console.log` AND to the live **🛰 Scraper Lane Activity Log** panel
150
+ (`ScraperLaneLogPanel` in `V15CalibrationAugment.tsx`, bottom-right, minimized
151
+ by default, expand to see real-time per-lane activity). This closes the
152
+ "I still don't see them log" gap — every lane's real network activity is
153
+ now visibly provable in both the browser console and the on-screen panel.
154
+ - Sources from all lanes are merged and deduplicated by URL into one combined
155
+ evidence block. Zero mocks/simulations — every call is a real `fetch()`.
156
+
157
+ **Restore procedure if any lane silently drops:** open `v15-grounding.ts` and
158
+ confirm the `laneRunners` array in `groundQuestion()` still contains exactly 10
159
+ entries (package-groundQuestion, academic-sources, enhanced-scraper, og-scraper,
160
+ hydra-reader, nexus-consensus, sibyl-oracle, strata-engine, arbiter-omega,
161
+ palisade-adjudicator) plus the `terminal-final` entry (11 total). Each entry
162
+ must call `dbg(lane, ...)` before and after its `await`, and `addAll(lane, ...)`
163
+ on success so lane counts are provable in the log panel.
164
+
165
+ ## PART 3D — OUTPUT BOX ENHANCER (10x taller, scrollable, expand + copy)
166
+
167
+ `injectOutputBoxEnhancer()` in `V15CalibrationAugment.tsx` scans every `<pre>`
168
+ block in the Rigor Guard dialog (Live Compare / Batch Bank output, revision
169
+ text, SLOOP-chunked output, etc.) with more than 300 characters and:
170
+ 1. Multiplies its existing `max-height` ×10 and forces `overflow-y: auto` so
171
+ long SLOOP-4/OMEGA-STRATEGY/--bain-pe outputs never appear silently
172
+ truncated.
173
+ 2. Injects a toolbar above it with **⛶ Expand** (dispatches
174
+ `veritas:expand-output`, rendered by `ExpandedOutputOverlay` as a
175
+ full-screen lightbox covering the entire Rigor Guard Calibration overlay)
176
+ and **📋 Copy** (copies that exact block's full text via
177
+ `navigator.clipboard`).
178
+ Guarded by `pre.dataset.veritasEnhanced === "1"` so the toolbar is never
179
+ duplicated on re-render.
180
+
181
+ ## PART 3J — INNOVATION GENOME ENGINE v2.0 (additive over v1)
182
+
183
+ `src/lib/innovation-genome-engine-v2.ts` is the persistent TypeScript v2
184
+ extension. **Never replace or edit v1 to restore v2**; v2 imports v1 and adds:
185
+
186
+ - 14 extended personas (25 combined) and 8 cyclic/compound paths (24 combined).
187
+ - Deterministic systematic mutations: `nudge`, `flip`, `block_rotate`,
188
+ `pole_swap`, `dimension_mask` (`applyMutation`).
189
+ - Deterministic crossover: `uniform`, block-level, Pareto-weighted
190
+ (`applyCrossover`).
191
+ - `FitnessVector` (novelty/utility/tractability/robustness), `GenomeEntry`,
192
+ `ParetoArchive` (3D MAP-Elites signature + nondominated front), `Island`,
193
+ `IslandManager`, and `evolveGeneration(parent,evaluator,...)`. Fitness is
194
+ accepted **only** from the caller-supplied evaluator — never fabricated.
195
+ - `AnomalyBuffer` and `FailureArchive`, with localStorage load/save helpers.
196
+ - 16 domain packs: mathematics, algorithms, software, medicine, legal,
197
+ physics, chemistry, ml, engineering, finance, cybersecurity, biology,
198
+ product, policy, operations, general.
199
+ - `SafetyGate` caps `termination_resistance <= 0.5` and `goal_fixity <= 0.3`
200
+ for high-stakes domains; `CapabilityGate` explicitly discloses unavailable
201
+ parallel workers/verifier/formal prover/sandbox rather than fabricating them.
202
+ - `rollV2`, `compileCompactDirectiveV2`, JSON Schema, JSON export, and
203
+ `runInnovationGenomeV2Diagnostics`.
204
+
205
+ **Live integration:** `src/lib/v15-pipeline.ts` rolls v2 for every run, injects
206
+ the compact directive into synthesis/N-Deep/HDIG/adversarial, and writes the
207
+ exact active result to `window._VERITAS_INNOVATION_GENOME_V2`. The LLM query
208
+ strategist consumes the same `compactDirective`, so ideation, retrieval, and
209
+ synthesis share one recorded seed/strategy. The Rigor Guard sub-tab row gets
210
+ exactly one guarded `🧬 Genome v2` button (`id=veritas-augment-genome-btn`);
211
+ its modal shows the active seed/persona/path/domain, all 21 dimension bars,
212
+ capability reality, and a Copy compiled prompt action. No run => it honestly
213
+ says no genome has compiled; it never generates a fake preview.
214
+
215
+ The live directive also includes `buildExplorationPopulationV2(..., 6)`: base
216
+ plus one branch from each of the five systematic mutation families. This makes
217
+ ideation/retrieval/synthesis preserve six mechanism-distinct paths. The prompt
218
+ explicitly states that branches have **no inferred fitness**; MAP-Elites/Pareto
219
+ admission happens only through `evolveGeneration` with a real caller-supplied
220
+ `GenomeEvaluator`.
221
+
222
+ **Restore checks:** keep `innovation-genome-engine.ts` untouched; ensure v2
223
+ imports it, `v15-pipeline.ts` imports v2 (not `roll` from v1), and
224
+ `query-strategist.ts` receives `innovationContext`. Build must transform v2 and
225
+ the button must remain unique by DOM id.
226
+
227
+ ## PART 3I — INNOVATION GENOME ENGINE (seed-driven discovery-strategy diversity)
228
+
229
+ `src/lib/innovation-genome-engine.ts` — Conway-inspired seed→genome prompt
230
+ compiler, the discovery-side analogue of the Williams persona engine.
231
+ - **21 dimensions** across 7 nodes: Problem Choice (P), Anomaly Valuation (A),
232
+ Embodiment (E), Analogy (N), Evaluator Revision (V), Taste (T), Social
233
+ Stabilization (S). Each a 0.0–1.0 axis between two legitimate poles.
234
+ - **Determinism:** `seedToGenome(seed)` uses FNV-1a + xorshift over
235
+ `${seed}:${index}` → same seed always yields the same genome (no `crypto`
236
+ dependency, browser-native).
237
+ - **11 emergent personas** (`classifyPersona`) — Anomaly Hunter, Axiom Breaker,
238
+ Bridge Builder, Tinkerer, Connoisseur, Adversary, Evaluator Inventor,
239
+ Portfolio Manager, Heretic, Methodical Explorer, Plain Dealer (default).
240
+ - **16 dependency-respecting discovery paths** (`selectPath`) — α Full
241
+ Classical, β Analogy-First, γ Anomaly-Driven, δ Tinkerer, ε Theorist,
242
+ ζ Taste-Led, η Evaluator-First, θ Serendipitous Import, ι Builder, κ Dry
243
+ Theorist, λ Community-Initiated, μ Lab Accident, ν Connoisseur, ξ Imported
244
+ Crisis, ο Prototype-First, π Metric-Driven.
245
+ - `compileInnovationPrompt()` → full Kerger-class contract (portfolio breadth,
246
+ negative-space count, adversary type, termination mode, evaluator mutability,
247
+ anomaly buffer, taste filter, goal-space mutation, world-contact) all derived
248
+ from genome values.
249
+ - `compileCompactDirective()` → ~400-token version actually injected into the
250
+ live pipeline.
251
+ - **Wired in `src/lib/v15-pipeline.ts`:** every `runV15OnQuestion` call rolls a
252
+ genome and prepends the compact directive, so N-Deep / HDIG / adversarial
253
+ passes are steered into genuinely different search strategies instead of
254
+ converging on one shape. Toggle key `veritas.v15.innovationGenome`
255
+ (default ON). Exposed at `window._VERITAS_INNOVATION_GENOME`.
256
+ - `runInnovationGenomeDiagnostics()` = 12 pure checks.
257
+
258
+ **Restore procedure:** keep the 21 `DIMENSIONS`, 11 `PERSONAS` (default last),
259
+ 16 `PATH_TABLE` entries with `FALLBACK_PATH` = α, and the `mix32` determinism
260
+ (never swap for `Math.random` per-dimension — that breaks reproducibility).
261
+
262
+ ## PART 3H — DETERMINISTIC CITATION LEDGER (scraper results ARE the verifier)
263
+
264
+ `src/lib/deterministic-citation-ledger.ts` fixes the "Citation Trust Audit 0/2
265
+ valid, coverage 0%, all UNTRUSTED" + "CoVe never verifies" failure. Root cause:
266
+ the package re-verified citations **stochastically** via an LLM against a ledger
267
+ the answer's `[S#]` tags didn't align with. Fix (your insight): every source a
268
+ scraper ACTUALLY fetched is deterministic ground truth, so the fetched set IS a
269
+ verified citation ledger with zero stochastic dependence.
270
+
271
+ - `buildDeterministicLedger(sources)` → assigns stable `S#` ids, an FNV-1a
272
+ content fingerprint (reproducible, canonical-URL dedupe), marks each
273
+ `verified: true` with originating lane provenance, and emits a canonical
274
+ `References` section.
275
+ - `auditAnswerCitations(answerText, ledger)` → trusted/untrusted/coverage by
276
+ pure **set membership** (`method: "deterministic-set-membership"`) — never an
277
+ LLM, so it cannot spuriously fail.
278
+ - Wired in `v15-grounding.ts` `groundQuestion()`: after all lanes complete, it
279
+ builds the ledger from the real merged sources, emits the evidence block with
280
+ per-source `PROVENANCE: retrieved via <lane> · fingerprint <hex> ·
281
+ deterministically VERIFIED` lines + the References section, and exposes it at
282
+ `window._VERITAS_CITATION_LEDGER` for any UI consumer.
283
+ - `runDeterministicLedgerDiagnostics()` = 8 pure checks.
284
+
285
+ **Restore procedure if it regresses:** ensure `groundQuestion` calls
286
+ `buildDeterministicLedger(collected…)` before composing the evidence block and
287
+ returns `ledger.sources`; the References section MUST be appended so inline
288
+ `[S#]` tags resolve to real URLs.
289
+
290
+ ## PART 3G — LLM QUERY-INTELLIGENCE / TRANSLATION LAYER
291
+
292
+ `src/lib/scraper-vnext/query-strategist.ts` inserts an LLM translation stage
293
+ BEFORE any scraper runs, fixing the "asks the same question verbatim" defect.
294
+ `strategizeQuery(question)` returns an optimized PORTFOLIO of search queries:
295
+ - **Keywordization** (stopword strip + proper-noun anchoring; engines match
296
+ tokens, not sentences).
297
+ - **Decomposition** into atomic sub-queries (ReDI / Plan×RAG / Self-Ask).
298
+ - **HyDE** hypothetical-answer keyword anchor.
299
+ - **Step-Back** abstraction to governing principles.
300
+ - **NEGATIVE-SPACE** queries (original extension, MANDATORY): disconfirming
301
+ evidence, failure modes, retractions, counter-thesis — adversarially balances
302
+ the evidence set.
303
+ - **Entity-anchored / temporal / domain-routed** variants.
304
+ LLM path uses `generateWithRotation` (full model roster round-robin). Keyless
305
+ fallback = deterministic algorithmic keyword transformation (honest, not mock).
306
+ `src/lib/v15-grounding.ts` `groundQuestion()` calls `strategizeQuery` first,
307
+ then drives the heavy engines with `primaryQuery` and runs `secondaryQueries`
308
+ (decomposition/HyDE/step-back/negative-space) as extra sweeps on the fast
309
+ keyword lane; all results merge+dedupe. Every step logs to `scraper-debug-bus`.
310
+ `runQueryStrategistDiagnostics()` provides 6 pure checks.
311
+
312
+ **Restore procedure if it regresses:** ensure `groundQuestion` calls
313
+ `strategizeQuery` before building `laneRunners`, and that the enhanced-scraper
314
+ + og-scraper lanes consume `primaryQuery` (not the raw question). Never drop the
315
+ mandatory negative-space query.
316
+
317
+ ## PART 3F — FULL LLM ROSTER (round-robin rotation, every model, every call)
318
+
319
+ `src/lib/v15-rate-limiter.ts` is a **workspace override** that mutates the
320
+ package's exported `MODEL_LIMITS` object at module load time to register the
321
+ FULL user-specified LLM roster with exact per-model RPM/TPM/RPD caps. The
322
+ package's `pickLeastLoaded`, `snapshotAllUsage`, and `tryAcquire` all read
323
+ `MODEL_LIMITS` by reference, so this single override wires every model into
324
+ the round-robin rotation used by both the V15 calibration pipeline and every
325
+ scraper/portfolio LLM call — no exceptions.
326
+
327
+ Roster (durable in `src/lib/v15-rate-limiter.ts` → `FULL_ROSTER`):
328
+ - `gemini-2.5-flash` → RPM 5 / TPM 250K / RPD 20
329
+ - `gemini-2.5-flash-lite` → RPM 10 / TPM 250K / RPD 20
330
+ - `gemini-3-flash` → RPM 5 / TPM 250K / RPD 20
331
+ - `gemini-3.1-flash-lite` → RPM 15 / TPM 250K / RPD 500
332
+ - `gemini-3.5-flash` → RPM 5 / TPM 250K / RPD 20
333
+ - `gemini-3.5-flash-lite` → RPM 15 / TPM 250K / RPD 500
334
+ - `gemini-3.6-flash` → RPM 5 / TPM 250K / RPD 20
335
+ - `gemma-4-26b-it` → RPM 30 / TPM 16K / RPD 14400
336
+ - `gemma-4-31b-it` → RPM 30 / TPM 16K / RPD 14400
337
+
338
+ Also exported: `VERITAS_FULL_LLM_ROSTER` (readonly array of model IDs) so any
339
+ future code can iterate the canonical list directly.
340
+
341
+ **Restore procedure if the roster ever regresses:** open
342
+ `src/lib/v15-rate-limiter.ts` and confirm the `FULL_ROSTER` map contains all 9
343
+ entries with correct RPM/TPM/RPD; the mutation loop at module top
344
+ (`for (const [model, limit] of Object.entries(FULL_ROSTER)) { MODEL_LIMITS[model] = limit; }`)
345
+ must run — do NOT swap for a re-assignment (that would break the shared
346
+ reference the package uses internally).
347
+
348
+ ## PART 3K — OUTPUT BOX ENHANCER (10x taller, scrollable, expand + copy + natural)
349
+
350
+ `injectOutputBoxEnhancer()` in `V15CalibrationAugment.tsx` scans every `<pre>` with >300 chars (answer boxes in Live Compare / Batch Bank, SLOOP-chunked output) and:
351
+ - Multiplies max-height ×10 (default 256 → 2560px) + `overflow-y: auto`.
352
+ - Adds toolbar with **⛶ Expand** (dispatches `veritas:expand-output`, rendered by `ExpandedOutputOverlay` full-screen overlay with **Close** as back control = exit expanded mode), **📋 Copy** (copies entire original text), **Aa Natural** (toggles markdown stripping while preserving LaTeX `$$...$$` and `$...$` delimiters).
353
+ - Guarded by `dataset.veritasEnhanced === "1"` + `dataset.veritasOriginal` so toolbar never duplicates.
354
+ - Formula handling: `stripMarkdownKeepLatex()` extracts LaTeX placeholders before stripping `# ** * _ ` etc., then restores — formulas displayed with full LaTeX notations intact, markdown removed, natural reading.
355
+
356
+ **Restore:** ensure enhancer is called in `tick()` and overlay has Close button.
357
+
358
+ ## PART 3E — BUILD PIPELINE INTEGRITY NOTE
359
+
360
+ This workspace's `package.json` `"build"` script is exactly `"vite build"` —
361
+ there is **no** `copy.cjs`, `postinstall`, or any other file-copy hook that
362
+ overwrites `src/` on build. The reported external bug ("`copy.cjs` overwrote
363
+ `src/components/V15CalibrationDialog.tsx` on every session because
364
+ `node_modules` resets") describes a **different** repository/session, not this
365
+ one; verified by `grep_files` for `copyFileSync`/`copy.cjs` across `.js/.cjs/.ts/.json`
366
+ returning zero matches, and by reading `package.json` directly. If a future
367
+ turn ever adds such a script, it MUST be seed-only (copy only if the
368
+ destination file is missing) to avoid this exact regression class described by
369
+ the user — never modify `vite.config.ts` or add build hooks without explicit
370
+ instruction.
371
+
372
+ ## PART 4 — ZERO-DEPENDENCY FLATTEN INSTRUCTIONS
373
+
374
+ To collapse the sidecar package into a standalone zero-dependency application:
375
+ 1. **Module Copy & Merge:** For any package file in `node_modules/src/**` imported by the app, copy verbatim into `src/`, replacing the matching `export *` shim.
376
+ 2. **Override Winner:** Where a workspace override exists (`src/lib/v15-grounding.ts`, `src/lib/v15-pipeline.ts`, `src/lib/scraper-vnext/*`, `src/components/V15Overlay.tsx`), keep the workspace definition as the sole canonical implementation.
377
+ 3. **Web Worker URLs:** Keep `graph.worker.ts` and `compute.worker.ts` as separate files instantiated with `new Worker(new URL("...", import.meta.url))` so Vite bundles them as independent worker chunks.
378
+ 4. **CSS Verification:** Change `@source "../node_modules/src"` in `src/index.css` to scan `.` once all files are flattened into `src/`.
379
+ 5. **No Regressions:** Verify zero TypeScript errors and ensure 1:1 UI/UX parity.
package/src/index.css ADDED
@@ -0,0 +1,14 @@
1
+ @import "tailwindcss";
2
+
3
+ /* SIDECAR: Tailwind v4 automatic content detection skips `node_modules`, so the
4
+ packaged application source must be registered explicitly or every class used
5
+ inside `unkbv10` would be tree-shaken out of the stylesheet. */
6
+
7
+ @layer base {
8
+ html {
9
+ color-scheme: light;
10
+ }
11
+ body {
12
+ @apply bg-zinc-50 text-zinc-900 antialiased;
13
+ }
14
+ }
@@ -0,0 +1,13 @@
1
+ @import "tailwindcss";
2
+
3
+ /* Sidecar: Tailwind v4 must scan the package sources (node_modules is skipped
4
+ by automatic content detection, so the source is registered explicitly). */
5
+
6
+ @layer base {
7
+ html {
8
+ color-scheme: light;
9
+ }
10
+ body {
11
+ @apply bg-zinc-50 text-zinc-900 antialiased;
12
+ }
13
+ }
@@ -0,0 +1,188 @@
1
+ /**
2
+ * CORS-safe academic/government API endpoints.
3
+ * These return JSON directly — no proxy needed, no HTML parsing.
4
+ * Each function returns results in the same shape as BrowserScraperSearchResult.
5
+ */
6
+
7
+ export interface AcademicResult {
8
+ title: string;
9
+ url: string;
10
+ description: string;
11
+ content: string;
12
+ }
13
+
14
+ // ── PubMed (NCBI E-Utils) ────────────────────────────────────────────────
15
+ async function searchPubMed(query: string, count: number): Promise<AcademicResult[]> {
16
+ const searchUrl = `https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&retmode=json&retmax=${count}&term=${encodeURIComponent(query)}`;
17
+ const searchRes = await fetch(searchUrl);
18
+ if (!searchRes.ok) return [];
19
+ const searchData = await searchRes.json();
20
+ const ids: string[] = searchData?.esearchresult?.idlist ?? [];
21
+ if (ids.length === 0) return [];
22
+ const summaryUrl = `https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?db=pubmed&retmode=json&id=${ids.join(",")}`;
23
+ const summaryRes = await fetch(summaryUrl);
24
+ if (!summaryRes.ok) return [];
25
+ const summaryData = await summaryRes.json();
26
+ const results: AcademicResult[] = [];
27
+ for (const id of ids) {
28
+ const doc = summaryData?.result?.[id];
29
+ if (!doc) continue;
30
+ results.push({
31
+ title: doc.title || `PubMed ${id}`,
32
+ url: `https://pubmed.ncbi.nlm.nih.gov/${id}/`,
33
+ description: `${doc.source || ""} (${doc.pubdate || ""})`,
34
+ content: `${doc.title || ""}. ${doc.source || ""}. ${doc.pubdate || ""}. Authors: ${(doc.authors || []).map((a: any) => a.name).slice(0, 5).join(", ")}. PMID: ${id}`,
35
+ });
36
+ }
37
+ return results;
38
+ }
39
+
40
+ // ── NIH Reporter (funded grants) ─────────────────────────────────────────
41
+ async function searchNihReporter(query: string, count: number): Promise<AcademicResult[]> {
42
+ const res = await fetch("https://api.reporter.nih.gov/v2/projects/search", {
43
+ method: "POST",
44
+ headers: { "Content-Type": "application/json" },
45
+ body: JSON.stringify({
46
+ criteria: { advanced_text_search: { operator: "and", search_field: "projecttitle,terms", search_text: query } },
47
+ offset: 0, limit: Math.min(count, 10), sort_field: "project_start_date", sort_order: "desc",
48
+ }),
49
+ });
50
+ if (!res.ok) return [];
51
+ const data = await res.json();
52
+ return (data?.results ?? []).map((p: any) => ({
53
+ title: p.project_title || "NIH Project",
54
+ url: `https://reporter.nih.gov/project-details/${p.appl_id}`,
55
+ description: `${p.org_name || ""} | ${p.ic_name || ""} | ${p.fiscal_year || ""}`,
56
+ content: `${p.project_title || ""}. ${p.abstract_text?.slice(0, 600) || "No abstract."}. IC: ${p.ic_name || "N/A"}. Mechanism: ${p.activity_code || "N/A"}. PI: [redacted].`,
57
+ }));
58
+ }
59
+
60
+ // ── Europe PMC ───────────────────────────────────────────────────────────
61
+ async function searchEuropePmc(query: string, count: number): Promise<AcademicResult[]> {
62
+ const url = `https://www.ebi.ac.uk/europepmc/webservices/rest/search?query=${encodeURIComponent(query)}&format=json&pageSize=${count}`;
63
+ const res = await fetch(url);
64
+ if (!res.ok) return [];
65
+ const data = await res.json();
66
+ return (data?.resultList?.result ?? []).map((r: any) => ({
67
+ title: r.title || "Europe PMC",
68
+ url: r.doi ? `https://doi.org/${r.doi}` : `https://europepmc.org/article/${r.source}/${r.id}`,
69
+ description: `${r.journalTitle || ""} (${r.pubYear || ""})`,
70
+ content: `${r.title || ""}. ${r.abstractText?.slice(0, 600) || ""}`,
71
+ }));
72
+ }
73
+
74
+ // ── Semantic Scholar ─────────────────────────────────────────────────────
75
+ async function searchSemanticScholar(query: string, count: number): Promise<AcademicResult[]> {
76
+ const url = `https://api.semanticscholar.org/graph/v1/paper/search?query=${encodeURIComponent(query)}&limit=${count}&fields=title,abstract,url,year`;
77
+ const res = await fetch(url);
78
+ if (!res.ok) return [];
79
+ const data = await res.json();
80
+ return (data?.data ?? []).map((p: any) => ({
81
+ title: p.title || "Semantic Scholar",
82
+ url: p.url || `https://www.semanticscholar.org/paper/${p.paperId}`,
83
+ description: `Year: ${p.year || "N/A"}`,
84
+ content: `${p.title || ""}. ${p.abstract?.slice(0, 600) || "No abstract available."}`,
85
+ }));
86
+ }
87
+
88
+ // ── OpenAlex ─────────────────────────────────────────────────────────────
89
+ async function searchOpenAlex(query: string, count: number): Promise<AcademicResult[]> {
90
+ const url = `https://api.openalex.org/works?search=${encodeURIComponent(query)}&per_page=${count}&select=id,doi,title,abstract_inverted_index,publication_year`;
91
+ const res = await fetch(url, { headers: { "User-Agent": "VeritasChat/1.0 (mailto:contact@example.com)" } });
92
+ if (!res.ok) return [];
93
+ const data = await res.json();
94
+ return (data?.results ?? []).map((w: any) => {
95
+ let abstract = "";
96
+ if (w.abstract_inverted_index) {
97
+ const pairs: [string, number[]][] = Object.entries(w.abstract_inverted_index);
98
+ const words: string[] = [];
99
+ for (const [word, positions] of pairs) for (const pos of positions as number[]) words[pos] = word;
100
+ abstract = words.filter(Boolean).join(" ").slice(0, 600);
101
+ }
102
+ return {
103
+ title: w.title || "OpenAlex",
104
+ url: w.doi ? `https://doi.org/${w.doi.replace("https://doi.org/", "")}` : w.id,
105
+ description: `Year: ${w.publication_year || "N/A"}`,
106
+ content: `${w.title || ""}. ${abstract}`,
107
+ };
108
+ });
109
+ }
110
+
111
+ // ── arXiv (CORS-safe XML) ────────────────────────────────────────────────
112
+ async function searchArxiv(query: string, count: number): Promise<AcademicResult[]> {
113
+ const url = `https://export.arxiv.org/api/query?search_query=all:${encodeURIComponent(query)}&start=0&max_results=${count}`;
114
+ const res = await fetch(url);
115
+ if (!res.ok) return [];
116
+ const xml = await res.text();
117
+ const entries = xml.split(/<entry>/).slice(1);
118
+ return entries.map((e) => {
119
+ const title = (e.match(/<title>([\s\S]*?)<\/title>/)?.[1] || "arXiv").replace(/\s+/g, " ").trim();
120
+ const id = e.match(/<id>([\s\S]*?)<\/id>/)?.[1]?.trim() || "";
121
+ const summary = (e.match(/<summary>([\s\S]*?)<\/summary>/)?.[1] || "").replace(/\s+/g, " ").trim();
122
+ return { title, url: id, description: summary.slice(0, 200), content: `${title}. ${summary.slice(0, 600)}` };
123
+ });
124
+ }
125
+
126
+ // ── CrossRef ─────────────────────────────────────────────────────────────
127
+ async function searchCrossRef(query: string, count: number): Promise<AcademicResult[]> {
128
+ const url = `https://api.crossref.org/works?query=${encodeURIComponent(query)}&rows=${count}&select=DOI,title,abstract,published-print`;
129
+ const res = await fetch(url, { headers: { "User-Agent": "VeritasChat/1.0 (mailto:contact@example.com)" } });
130
+ if (!res.ok) return [];
131
+ const data = await res.json();
132
+ return (data?.message?.items ?? []).map((w: any) => ({
133
+ title: (w.title || ["CrossRef"])[0],
134
+ url: `https://doi.org/${w.DOI}`,
135
+ description: `DOI: ${w.DOI}`,
136
+ content: `${(w.title || [""])[0]}. ${(w.abstract || "").replace(/<[^>]+>/g, " ").slice(0, 600)}`,
137
+ }));
138
+ }
139
+
140
+ // ── Aggregator: run all CORS-safe APIs in parallel ───────────────────────
141
+
142
+ /** Strip conversational filler so academic APIs don't match "please", "find me", etc. */
143
+ function normalizeAcademicQuery(query: string): string {
144
+ let q = query
145
+ .replace(/^\s*(please|can you|could you|would you|i need you to|help me|find me|please find me|give me|show me)\b/gi, "")
146
+ .replace(/\b(please|thanks|thank you|for me|the most likely|that is)\b/gi, "")
147
+ .replace(/["“”]/g, "")
148
+ .replace(/\s+/g, " ")
149
+ .trim();
150
+ // Keep only the substantive nouns/keywords for API search (drop stopword-only fragments).
151
+ if (q.length < 8) q = query;
152
+ return q;
153
+ }
154
+
155
+ export async function searchAcademicSources(
156
+ query: string,
157
+ opts?: { count?: number; onDebug?: (msg: string) => void },
158
+ ): Promise<AcademicResult[]> {
159
+ const count = opts?.count ?? 5;
160
+ const t0 = Date.now();
161
+ const original = query;
162
+ query = normalizeAcademicQuery(query);
163
+ if (query !== original) opts?.onDebug?.(`[Academic] normalized query: "${original.slice(0, 60)}" → "${query.slice(0, 60)}"`);
164
+ const results = await Promise.allSettled([
165
+ searchPubMed(query, count),
166
+ searchNihReporter(query, count),
167
+ searchEuropePmc(query, count),
168
+ searchSemanticScholar(query, count),
169
+ searchOpenAlex(query, count),
170
+ searchCrossRef(query, count),
171
+ searchArxiv(query, count),
172
+ ]);
173
+ const all: AcademicResult[] = [];
174
+ const names = ["PubMed", "NIH-Reporter", "EuropePMC", "SemanticScholar", "OpenAlex", "CrossRef", "arXiv"];
175
+ results.forEach((r, i) => {
176
+ if (r.status === "fulfilled" && r.value.length > 0) {
177
+ opts?.onDebug?.(`[Academic] ${names[i]}: ${r.value.length} results`);
178
+ all.push(...r.value);
179
+ } else {
180
+ opts?.onDebug?.(`[Academic] ${names[i]}: ${r.status === "rejected" ? (r.reason as Error)?.message?.slice(0, 60) : "0 results"}`);
181
+ }
182
+ });
183
+ // Dedup by URL
184
+ const seen = new Set<string>();
185
+ const deduped = all.filter(r => { if (seen.has(r.url)) return false; seen.add(r.url); return true; });
186
+ opts?.onDebug?.(`[Academic] Total: ${deduped.length} unique results in ${Date.now() - t0}ms`);
187
+ return deduped;
188
+ }
@@ -0,0 +1,28 @@
1
+ export * from "./academic-sources.base";
2
+ import { searchAcademicSources as baseSearch, type AcademicResult } from "./academic-sources.base";
3
+
4
+ async function openAlex(query: string, count: number): Promise<AcademicResult[]> {
5
+ const res = await fetch(`https://api.openalex.org/works?search=${encodeURIComponent(query)}&per_page=${count}&select=id,doi,title,publication_year,abstract_inverted_index`);
6
+ if (!res.ok) return [];
7
+ const data = await res.json();
8
+ return (data.results ?? []).map((w: any) => {
9
+ const words: string[] = [];
10
+ if (w.abstract_inverted_index) for (const [word, pos] of Object.entries(w.abstract_inverted_index)) for (const p of pos as number[]) words[p] = word;
11
+ return { title: w.title || "OpenAlex work", url: w.doi || w.id, description: `OpenAlex ${w.publication_year || ""}`, content: `${w.title || ""}. ${words.filter(Boolean).join(" ").slice(0, 800)}` };
12
+ });
13
+ }
14
+
15
+ async function crossref(query: string, count: number): Promise<AcademicResult[]> {
16
+ const res = await fetch(`https://api.crossref.org/works?query=${encodeURIComponent(query)}&rows=${count}&select=DOI,title,abstract,published-print`);
17
+ if (!res.ok) return [];
18
+ const data = await res.json();
19
+ return (data.message?.items ?? []).map((w: any) => ({ title: w.title?.[0] || "CrossRef work", url: w.DOI ? `https://doi.org/${w.DOI}` : "", description: `DOI ${w.DOI || ""}`, content: `${w.title?.[0] || ""}. ${String(w.abstract || "").replace(/<[^>]+>/g, " ").slice(0, 800)}` })).filter((r: AcademicResult) => r.url);
20
+ }
21
+
22
+ export async function searchAcademicSources(query: string, opts?: { count?: number; onDebug?: (msg: string) => void }): Promise<AcademicResult[]> {
23
+ const count = opts?.count ?? 6;
24
+ const settled = await Promise.allSettled([baseSearch(query, opts), openAlex(query, count), crossref(query, count)]);
25
+ const all = settled.flatMap((r, i) => { if (r.status === "fulfilled") { opts?.onDebug?.(`[Academic+] source ${i + 1}: ${r.value.length}`); return r.value; } opts?.onDebug?.(`[Academic+] source ${i + 1} failed`); return []; });
26
+ const seen = new Set<string>();
27
+ return all.filter(r => r.url && !seen.has(r.url) && seen.add(r.url)).slice(0, count * 2);
28
+ }
@@ -0,0 +1,10 @@
1
+ // SIDECAR SEAM — see flatten-guide.md.
2
+ // Alias-reachable retrieval lane: the packaged `v15-grounding.ts` imports this
3
+ // module via `@/lib/academic-sources`, so this seam IS on the live path.
4
+ // Adds a provenance tap only; retrieval behaviour is byte-for-byte unchanged.
5
+ export * from "./academic-sources.orig";
6
+
7
+ import { searchAcademicSources as packageSearchAcademicSources } from "./academic-sources.orig";
8
+ import { withLaneTap } from "@/lib/citation-lane-tap";
9
+
10
+ export const searchAcademicSources = withLaneTap("academic-sources", packageSearchAcademicSources);