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,3 @@
1
+ export * from "./innovation-genome-engine-v2.orig";
2
+ // V2 remains an expansion pack; use this combined constructor for live logic.
3
+ export { buildUnifiedInnovationPlan, expandPath, stableSeed } from "@/lib/debug/unified-innovation";
@@ -0,0 +1,330 @@
1
+ /**
2
+ * innovation-genome-engine.ts
3
+ * ============================================================================
4
+ * INNOVATION GENOME ENGINE v1.0 — TypeScript port (browser-native, zero deps).
5
+ *
6
+ * Conway-inspired SEED-DRIVEN prompt compiler: a single integer seed
7
+ * deterministically sets values across 21 innovation dimensions, producing a
8
+ * complete Kerger-class discovery prompt that directs the LLM's approach to
9
+ * novel problem-solving — exactly analogous to the Williams persona engine,
10
+ * but targeting DISCOVERY mechanisms instead of prose style.
11
+ *
12
+ * "Conway" analogy: simple seed → complex emergent behavior. The seed sets the
13
+ * initial configuration; dimension interactions (persona classification + path
14
+ * selection) determine the emergent discovery strategy.
15
+ *
16
+ * 7 discovery nodes: P(roblem Choice) · A(nomaly Valuation) · E(mbodiment) ·
17
+ * N(=Analogy) · V(=Evaluator Revision) · T(aste) · S(ocial Stabilization).
18
+ *
19
+ * Determinism: same seed ⇒ same genome, always (FNV-1a + xorshift mix over
20
+ * `${seed}:${index}`). Reproducible across sessions and machines.
21
+ *
22
+ * HONESTY: this is a real prompt compiler producing real directive text. It
23
+ * makes no claim of solving any open problem; it only shapes search strategy.
24
+ * ============================================================================ */
25
+
26
+ export interface GenomeDimension {
27
+ id: string;
28
+ name: string;
29
+ block: string;
30
+ lowPole: string;
31
+ highPole: string;
32
+ description: string;
33
+ }
34
+
35
+ /** The 21 innovation dimensions — each a continuous 0.0–1.0 axis between two
36
+ * legitimate strategic poles (all positions are valid choices). */
37
+ export const DIMENSIONS: GenomeDimension[] = [
38
+ { id: "problem_source", name: "Problem Source", block: "Problem Choice", lowPole: "externally assigned problem", highPole: "self-discovered / endogenous problem", description: "Where does the problem come from?" },
39
+ { id: "problem_framing", name: "Problem Framing", block: "Problem Choice", lowPole: "accept given framing", highPole: "radically reframe before solving", description: "How much reframing before search begins?" },
40
+ { id: "goal_fixity", name: "Goal Fixity", block: "Problem Choice", lowPole: "fixed objective throughout", highPole: "goal-space mutation allowed", description: "Can the objective itself change during search?" },
41
+ { id: "anomaly_sensitivity", name: "Anomaly Sensitivity", block: "Anomaly Valuation", lowPole: "ignore outliers, seek central tendency", highPole: "maximize anomaly detection and pursuit", description: "How aggressively are surprises pursued?" },
42
+ { id: "failure_treatment", name: "Failure Treatment", block: "Anomaly Valuation", lowPole: "discard failures quickly", highPole: "mine failures as primary data source", description: "Are failures signal or noise?" },
43
+ { id: "anomaly_memory", name: "Anomaly Memory Persistence", block: "Anomaly Valuation", lowPole: "memoryless: each round fresh", highPole: "persistent cross-round anomaly buffer", description: "How long are anomalies remembered?" },
44
+ { id: "world_contact", name: "World Contact", block: "Embodiment", lowPole: "pure symbolic reasoning", highPole: "world-in-the-loop: execute, measure, iterate", description: "How much real-world feedback enters the loop?" },
45
+ { id: "artifact_concreteness", name: "Artifact Concreteness", block: "Embodiment", lowPole: "abstract proposals and sketches", highPole: "runnable code / falsifiable constructions only", description: "How concrete must every output be?" },
46
+ { id: "cheap_falsification", name: "Cheap Falsification Priority", block: "Embodiment", lowPole: "build fully before testing", highPole: "falsify cheaply first, build only survivors", description: "When does testing happen relative to building?" },
47
+ { id: "analogy_distance", name: "Analogy Distance", block: "Analogy", lowPole: "near-domain analogies only", highPole: "maximally distant cross-domain transfer", description: "How far afield should analogies reach?" },
48
+ { id: "representation_diversity", name: "Representation Diversity", block: "Analogy", lowPole: "single representation throughout", highPole: "mandatory multi-representation portfolio", description: "How many different formalisms are tried?" },
49
+ { id: "mechanism_independence", name: "Mechanism Independence", block: "Analogy", lowPole: "converge early on best approach", highPole: "enforce independence across families until late", description: "How long do parallel approaches stay isolated?" },
50
+ { id: "evaluator_source", name: "Evaluator Source", block: "Evaluator Revision", lowPole: "use only externally supplied evaluator", highPole: "construct evaluator endogenously from the problem", description: "Where does the success criterion come from?" },
51
+ { id: "evaluator_mutability", name: "Evaluator Mutability", block: "Evaluator Revision", lowPole: "evaluator is frozen throughout", highPole: "evaluator co-evolves with candidates", description: "Can the evaluator itself change during search?" },
52
+ { id: "adversarial_intensity", name: "Adversarial Intensity", block: "Evaluator Revision", lowPole: "gentle self-check", highPole: "candidate-specific adversary: attacker = f(candidate)", description: "How hostile is the internal critic?" },
53
+ { id: "taste_weight", name: "Taste Weight", block: "Taste", lowPole: "accept any correct solution", highPole: "strong aesthetic/elegance filter on correct solutions", description: "How much does beauty/depth matter beyond correctness?" },
54
+ { id: "novelty_vs_utility", name: "Novelty-Utility Balance", block: "Taste", lowPole: "maximize utility even if conventional", highPole: "maximize novelty even if impractical", description: "Where on the novelty-utility tradeoff?" },
55
+ { id: "termination_resistance", name: "Termination Resistance", block: "Taste", lowPole: "terminate on first valid answer", highPole: "matched-pair only: construction AND impossibility bound", description: "How hard is it to declare 'done'?" },
56
+ { id: "independence_vs_consensus", name: "Independence vs Consensus", block: "Social Stabilization", lowPole: "defer to community consensus", highPole: "protect heretical ideas from premature consensus", description: "How much does community opinion gate acceptance?" },
57
+ { id: "portfolio_breadth", name: "Portfolio Breadth", block: "Social Stabilization", lowPole: "single focused approach", highPole: "8+ independent mechanism families", description: "How many parallel approaches are maintained?" },
58
+ { id: "negative_space_density", name: "Negative Space Density", block: "Social Stabilization", lowPole: "minimal exclusions", highPole: "30+ banned result-shapes with poisoned shortcuts", description: "How many near-miss solutions are explicitly banned?" },
59
+ ];
60
+
61
+ export type Genome = Record<string, number>;
62
+
63
+ /** Deterministic 32-bit mix of `${seed}:${index}` (FNV-1a + xorshift finalizer). */
64
+ function mix32(seed: number, index: number): number {
65
+ const s = `${seed}:${index}`;
66
+ let h = 0x811c9dc5;
67
+ for (let i = 0; i < s.length; i += 1) {
68
+ h ^= s.charCodeAt(i);
69
+ h = Math.imul(h, 0x01000193) >>> 0;
70
+ }
71
+ h ^= h >>> 16; h = Math.imul(h, 0x7feb352d) >>> 0;
72
+ h ^= h >>> 15; h = Math.imul(h, 0x846ca68b) >>> 0;
73
+ h ^= h >>> 16;
74
+ return h >>> 0;
75
+ }
76
+
77
+ /** Convert an integer seed to a deterministic genome (21 values in [0,1]). */
78
+ export function seedToGenome(seed: number): Genome {
79
+ const genome: Genome = {};
80
+ DIMENSIONS.forEach((dim, i) => {
81
+ genome[dim.id] = Math.round((mix32(seed, i) / 0xffffffff) * 100) / 100;
82
+ });
83
+ return genome;
84
+ }
85
+
86
+ export interface InnovationPersona { name: string; tagline: string; }
87
+
88
+ /** Emergent personas from dimension clusters (first match wins; last = default). */
89
+ export const PERSONAS: Array<InnovationPersona & { match: (g: Genome) => boolean }> = [
90
+ { name: "The Anomaly Hunter", tagline: "Chase the outlier. The exception IS the rule.", match: (g) => g.anomaly_sensitivity > 0.75 && g.failure_treatment > 0.7 },
91
+ { name: "The Axiom Breaker", tagline: "What if the obvious assumption is simply false?", match: (g) => g.problem_framing > 0.8 && g.goal_fixity > 0.7 },
92
+ { name: "The Bridge Builder", tagline: "The answer is in a field you haven't looked at yet.", match: (g) => g.analogy_distance > 0.8 && g.representation_diversity > 0.7 },
93
+ { name: "The Tinkerer", tagline: "Build it. Break it. The wreckage is the data.", match: (g) => g.world_contact > 0.75 && g.cheap_falsification > 0.7 },
94
+ { name: "The Connoisseur", tagline: "Correct isn't enough. It must be beautiful.", match: (g) => g.taste_weight > 0.8 && g.termination_resistance > 0.7 },
95
+ { name: "The Adversary", tagline: "Your proof is guilty until proven innocent.", match: (g) => g.adversarial_intensity > 0.8 && g.negative_space_density > 0.7 },
96
+ { name: "The Evaluator Inventor", tagline: "The real discovery is what 'success' means.", match: (g) => g.evaluator_source > 0.75 && g.evaluator_mutability > 0.7 },
97
+ { name: "The Portfolio Manager", tagline: "Eight independent bets. One will be right.", match: (g) => g.portfolio_breadth > 0.8 && g.mechanism_independence > 0.7 },
98
+ { name: "The Heretic", tagline: "Protect the weird idea. Consensus kills discovery.", match: (g) => g.independence_vs_consensus > 0.85 && g.novelty_vs_utility > 0.7 },
99
+ { name: "The Methodical Explorer", tagline: "Every surface, mapped. Every corner, checked.", match: (g) => g.artifact_concreteness > 0.7 && g.anomaly_memory > 0.65 },
100
+ { name: "The Plain Dealer", tagline: "Direct, compressed, no wasted moves.", match: () => true },
101
+ ];
102
+
103
+ export function classifyPersona(genome: Genome): InnovationPersona {
104
+ for (const p of PERSONAS) if (p.match(genome)) return { name: p.name, tagline: p.tagline };
105
+ const last = PERSONAS[PERSONAS.length - 1];
106
+ return { name: last.name, tagline: last.tagline };
107
+ }
108
+
109
+ export interface DiscoveryPath { id: string; name: string; seq: string; }
110
+
111
+ /** 16 canonical dependency-respecting discovery paths through the 7 nodes. */
112
+ const PATH_TABLE: Array<DiscoveryPath & { trigger: (g: Genome) => boolean }> = [
113
+ { id: "γ", name: "Anomaly-Driven", seq: "A→P→E→V→N→T→S", trigger: (g) => g.anomaly_sensitivity > 0.8 },
114
+ { id: "ζ", name: "Taste-Led", seq: "T→P→A→N→V→E→S", trigger: (g) => g.taste_weight > 0.85 },
115
+ { id: "π", name: "Metric-Driven", seq: "V→P→A→E→N→T→S", trigger: (g) => g.evaluator_source > 0.85 && g.evaluator_mutability > 0.6 },
116
+ { id: "ξ", name: "Imported Crisis", seq: "N→A→V→P→E→T→S", trigger: (g) => g.analogy_distance > 0.8 && g.adversarial_intensity > 0.6 },
117
+ { id: "δ", name: "Tinkerer", seq: "E→A→P→N→V→T→S", trigger: (g) => g.world_contact > 0.8 },
118
+ { id: "ο", name: "Prototype-First", seq: "P→E→A→N→V→T→S", trigger: (g) => g.cheap_falsification > 0.8 },
119
+ { id: "ι", name: "Builder", seq: "E→P→A→V→N→T→S", trigger: (g) => g.artifact_concreteness > 0.8 },
120
+ { id: "η", name: "Evaluator-First", seq: "P→V→A→E→N→T→S", trigger: (g) => g.evaluator_source > 0.8 },
121
+ { id: "β", name: "Analogy-First", seq: "P→N→A→V→E→T→S", trigger: (g) => g.analogy_distance > 0.75 },
122
+ { id: "ν", name: "Connoisseur", seq: "T→A→P→N→V→E→S", trigger: (g) => g.taste_weight > 0.8 && g.anomaly_sensitivity > 0.6 },
123
+ { id: "μ", name: "Lab Accident", seq: "A→E→P→V→N→T→S", trigger: (g) => g.anomaly_sensitivity > 0.7 && g.world_contact > 0.7 },
124
+ { id: "ε", name: "Theorist", seq: "N→P→V→A→E→T→S", trigger: (g) => g.analogy_distance > 0.7 && g.world_contact < 0.3 },
125
+ { id: "θ", name: "Serendipitous Import", seq: "A→N→P→V→E→T→S", trigger: (g) => g.anomaly_sensitivity > 0.6 && g.analogy_distance > 0.6 },
126
+ { id: "κ", name: "Dry Theorist", seq: "P→A→N→V→T→E→S", trigger: (g) => g.world_contact < 0.2 && g.taste_weight > 0.6 },
127
+ { id: "λ", name: "Community-Initiated", seq: "S→P→A→E→N→V→T", trigger: (g) => g.independence_vs_consensus < 0.2 },
128
+ { id: "α", name: "Full Classical", seq: "P→A→E→N→V→T→S", trigger: (g) => g.problem_source < 0.4 && g.anomaly_sensitivity > 0.5 },
129
+ ];
130
+
131
+ const FALLBACK_PATH: DiscoveryPath = { id: "α", name: "Full Classical", seq: "P→A→E→N→V→T→S" };
132
+
133
+ export function selectPath(genome: Genome): DiscoveryPath {
134
+ for (const p of PATH_TABLE) if (p.trigger(genome)) return { id: p.id, name: p.name, seq: p.seq };
135
+ return FALLBACK_PATH;
136
+ }
137
+
138
+ function level(v: number): string {
139
+ if (v < 0.2) return "minimal";
140
+ if (v < 0.4) return "low";
141
+ if (v < 0.6) return "moderate";
142
+ if (v < 0.8) return "high";
143
+ return "maximum";
144
+ }
145
+
146
+ function dimInstruction(dim: GenomeDimension, value: number): string {
147
+ const pole = value < 0.5 ? dim.lowPole : dim.highPole;
148
+ return `${dim.name.toUpperCase()} (${dim.block}): Lean toward: ${pole}. Intensity: ${level(value)} (${value.toFixed(2)}).`;
149
+ }
150
+
151
+ /** Compile a full Kerger-class innovation prompt from a genome. */
152
+ export function compileInnovationPrompt(
153
+ genome: Genome,
154
+ persona: InnovationPersona,
155
+ path: DiscoveryPath,
156
+ userProblem = "[INSERT PROBLEM HERE]",
157
+ domain = "general",
158
+ ): string {
159
+ const dimBlock = DIMENSIONS.map((d) => dimInstruction(d, genome[d.id])).join("\n");
160
+ const nFamilies = Math.max(2, Math.min(12, Math.floor(genome.portfolio_breadth * 12) + 1));
161
+ const nBanned = Math.max(5, Math.min(35, Math.floor(genome.negative_space_density * 35) + 1));
162
+ const adversary = genome.adversarial_intensity > 0.6
163
+ ? "candidate-specific adversary: construct attacker as f(candidate)"
164
+ : "structured self-check with itemized audit";
165
+ const termination = genome.termination_resistance > 0.6
166
+ ? "matched-pair termination: accept only construction AND matching bound"
167
+ : "single-sided: accept first verified result";
168
+ const evaluatorClause = genome.evaluator_mutability > 0.6
169
+ ? "You MAY construct new evaluation criteria endogenously from the problem structure. The evaluator itself may evolve as understanding deepens."
170
+ : "Use only the evaluation criteria specified in the problem statement. Do not modify the success criterion.";
171
+ const anomalyClause = genome.anomaly_memory > 0.6
172
+ ? "Maintain a persistent ANOMALY BUFFER across all rounds. Every surprise, outlier, or failed expectation must be logged and revisited. Anomalies are primary data, not noise."
173
+ : "Focus on central results. Note anomalies but do not let them divert the main search.";
174
+ const tasteClause = genome.taste_weight > 0.6
175
+ ? "Apply an aesthetic filter: among correct solutions, prefer those that are deep, surprising, elegant, or maximally explanatory. Reject correct-but-pedestrian when a deeper alternative exists."
176
+ : "Accept any correct solution. Elegance is secondary to correctness.";
177
+ const goalClause = genome.goal_fixity > 0.6
178
+ ? "GOAL-SPACE MUTATION IS PERMITTED. If evidence suggests the objective is ill-posed or has a deeper reformulation, propose a revised objective with explicit justification."
179
+ : "The objective is FIXED. Do not modify the success criterion.";
180
+ const worldClause = genome.world_contact > 0.6
181
+ ? "WORLD-IN-THE-LOOP: Every candidate must be tested against reality (executed code, computed examples, measurements, or formal verification). No candidate survives on plausibility alone."
182
+ : "Symbolic reasoning is the primary mode. Computational testing is encouraged but not mandatory for every candidate.";
183
+
184
+ return `# INNOVATION GENOME: FRACTAL DISCOVERY CONTRACT
185
+
186
+ ## 0. INNOVATION PERSONA: "${persona.name}" — ${persona.tagline}
187
+ DISCOVERY PATH: ${path.id} (${path.name}): ${path.seq}
188
+
189
+ Adopt the following discovery profile. All positions are valid conscious choices for THIS configuration.
190
+
191
+ ${dimBlock}
192
+
193
+ ## 1. PROBLEM SPECIFICATION
194
+ ${userProblem}
195
+ Domain: ${domain}
196
+
197
+ ## 2. STRATEGIC DIRECTIVES (derived from genome)
198
+ PORTFOLIO: Seed ${nFamilies} genuinely different mechanism families. Group by MECHANISM, not vocabulary. Enforce early independence.
199
+ NEGATIVE SPACE: Before searching, enumerate at least ${nBanned} result-shapes that LOOK like solutions but are not. For the most tempting shortcut, explain precisely WHY it fails.
200
+ ADVERSARY: ${adversary}
201
+ TERMINATION: ${termination}
202
+ ${evaluatorClause}
203
+ ${anomalyClause}
204
+ ${tasteClause}
205
+ ${goalClause}
206
+ ${worldClause}
207
+
208
+ ## 3. PROCESS CONSTRAINTS (invariants)
209
+ TERMINATION SUPPRESSION: The fact that a problem is labeled "open" or "hard" is not permission to stop. Continue constructive search through the declared budget. Never claim resolution unless all verification gates pass.
210
+ CONCRETE ARTIFACTS ONLY: Every reasoning round returns a falsifiable object: lemma with proof, explicit construction with verified certificate, counterexample, or quantitative bound. Reject status reports, optimism, and "standard/routine."
211
+ REGISTRY: Maintain one record per approach family: BRANCH_ID | REPRESENTATION | CENTRAL LEMMA | ESTABLISHED | UNRESOLVED | GAP_CLASS (local|theorem-strength) | COUNTEREXAMPLES | STATUS | REOPEN_CONDITION
212
+ REPAIR WITHOUT INHERITANCE: A repaired candidate re-enters audit with zero credit from its previous version, plus a new attacker targeting the repair itself.
213
+ QUANTIFIER ORDER: For any claimed bound or impossibility, state the exact logical form with all quantifiers explicit.
214
+ IMPORTED RESULTS: For every imported theorem: (1) restate ALL hypotheses; (2) map each object to THIS problem; (3) verify parameter/norm/domain/precision alignment; (4) reject the import if any obligation remains unproved.
215
+
216
+ ## 4. RESOLUTION LATTICE (keep ALL live until evidence eliminates)
217
+ 1. direct proof or construction · 2. explicit counterexample · 3. reduction to known result · 4. stronger statement with simpler invariant · 5. weaker bridge theorem · 6. algorithmic construction · 7. lower bound or impossibility · 8. conditional result with explicit assumptions · 9. machine-checkable certificate · 10. specification inconsistency
218
+
219
+ ## 5. FRACTAL BOTTLENECK RECURSION
220
+ For each unresolved bottleneck: restate as a child problem with exact objects and quantifiers; state which parent claim it unlocks; enumerate its near-miss solutions; generate ≥3 representation-distinct attacks; build a candidate-specific attacker; define the strongest available checker; solve, falsify, or block; return only certified results to the parent. Recurse ONLY on the active bottleneck.
221
+
222
+ ## 6. FINAL OUTPUT CONTRACT
223
+ 1. RESULT STATUS: verified | supported partial | counterexample | blocked | unknown
224
+ 2. PRECISE CLAIM · 3. ARTIFACT · 4. CORRECTNESS EVIDENCE · 5. RESOURCE ACCOUNTING
225
+ 6. ADVERSARIAL AUDIT · 7. EVIDENCE AND PROVENANCE · 8. RESIDUAL GAPS · 9. ANOMALY BUFFER`;
226
+ }
227
+
228
+ export interface DimensionReport {
229
+ id: string; name: string; block: string; value: number; level: string; lowPole: string; highPole: string;
230
+ }
231
+
232
+ export interface InnovationGenomeResult {
233
+ seed: number;
234
+ genome: Genome;
235
+ persona: InnovationPersona;
236
+ path: DiscoveryPath;
237
+ prompt: string;
238
+ dimensionReport: DimensionReport[];
239
+ }
240
+
241
+ /** Roll a new innovation genome from a seed (random if omitted). */
242
+ export function roll(seed?: number, userProblem = "[INSERT PROBLEM HERE]", domain = "general"): InnovationGenomeResult {
243
+ const s = seed === undefined || seed === null ? Math.floor(Math.random() * 0xffffffff) : seed;
244
+ const genome = seedToGenome(s);
245
+ const persona = classifyPersona(genome);
246
+ const path = selectPath(genome);
247
+ const dimensionReport: DimensionReport[] = DIMENSIONS.map((d) => ({
248
+ id: d.id, name: d.name, block: d.block, value: genome[d.id], level: level(genome[d.id]), lowPole: d.lowPole, highPole: d.highPole,
249
+ }));
250
+ return { seed: s, genome, persona, path, prompt: compileInnovationPrompt(genome, persona, path, userProblem, domain), dimensionReport };
251
+ }
252
+
253
+ export const reroll = (userProblem?: string, domain?: string) => roll(undefined, userProblem, domain);
254
+ export const pin = (seed: number, userProblem?: string, domain?: string) => roll(seed, userProblem, domain);
255
+
256
+ /** Compact directive (~400 tokens) for injection into the live V15 pipeline. */
257
+ export function compileCompactDirective(result: InnovationGenomeResult): string {
258
+ const g = result.genome;
259
+ const nFamilies = Math.max(2, Math.min(12, Math.floor(g.portfolio_breadth * 12) + 1));
260
+ const nBanned = Math.max(5, Math.min(35, Math.floor(g.negative_space_density * 35) + 1));
261
+ return [
262
+ `INNOVATION GENOME (seed ${result.seed}) — persona "${result.persona.name}": ${result.persona.tagline}`,
263
+ `DISCOVERY PATH ${result.path.id} (${result.path.name}): ${result.path.seq}`,
264
+ `PORTFOLIO: seed ${nFamilies} mechanism-distinct approaches; group by MECHANISM not vocabulary.`,
265
+ `NEGATIVE SPACE: name at least ${nBanned} result-shapes that look like answers but are not, and say why the most tempting one fails.`,
266
+ g.adversarial_intensity > 0.6 ? "ADVERSARY: build a candidate-specific attacker A(C) for each claim." : "ADVERSARY: itemized structured self-check.",
267
+ g.termination_resistance > 0.6 ? "TERMINATION: matched-pair only (construction AND bound)." : "TERMINATION: first verified result acceptable.",
268
+ g.anomaly_memory > 0.6 ? "ANOMALY BUFFER: log every surprise/outlier and revisit it; anomalies are primary data." : "",
269
+ g.analogy_distance > 0.6 ? "ANALOGY: reach into a distant domain for structural transfer, then verify the mapping." : "",
270
+ g.taste_weight > 0.6 ? "TASTE: among correct answers prefer the deeper, more explanatory one." : "",
271
+ "CONCRETE ARTIFACTS ONLY: every section yields a falsifiable object (number, derivation, bound, counterexample). No status reports.",
272
+ ].filter(Boolean).join("\n");
273
+ }
274
+
275
+ const GENOME_KEY = "veritas.v15.innovationGenome";
276
+
277
+ export function isInnovationGenomeEnabled(): boolean {
278
+ try { return localStorage.getItem(GENOME_KEY) !== "false"; } catch { return true; }
279
+ }
280
+ export function setInnovationGenomeEnabled(on: boolean): void {
281
+ try { localStorage.setItem(GENOME_KEY, on ? "true" : "false"); } catch { /* ignore */ }
282
+ }
283
+
284
+ /** Terminal-friendly display. */
285
+ export function display(ig: InnovationGenomeResult): string {
286
+ const lines: string[] = [
287
+ `Innovation Persona: ${ig.persona.name}`,
288
+ `${ig.persona.tagline}`,
289
+ `seed ${ig.seed}`,
290
+ `Discovery Path: ${ig.path.id} (${ig.path.name}): ${ig.path.seq}`,
291
+ `${DIMENSIONS.length} innovation dimensions`,
292
+ "",
293
+ ];
294
+ for (const dr of ig.dimensionReport) {
295
+ const pos = Math.max(0, Math.min(20, Math.round(dr.value * 20)));
296
+ const bar = "─".repeat(pos) + "●" + "─".repeat(20 - pos);
297
+ lines.push(` ${dr.name.padEnd(30)} [${bar}] ${dr.value.toFixed(2)} (${dr.lowPole.slice(0, 25)}...→...${dr.highPole.slice(0, 25)})`);
298
+ }
299
+ return lines.join("\n");
300
+ }
301
+
302
+ export function runInnovationGenomeDiagnostics(): { ok: boolean; checks: Array<{ id: string; passed: boolean; detail: string }> } {
303
+ const checks: Array<{ id: string; passed: boolean; detail: string }> = [];
304
+ const add = (id: string, passed: boolean, detail: string) => checks.push({ id, passed, detail });
305
+
306
+ const g1 = seedToGenome(42);
307
+ const g2 = seedToGenome(42);
308
+ add("same-seed-same-genome", JSON.stringify(g1) === JSON.stringify(g2), "deterministic");
309
+ add("different-seed-differs", JSON.stringify(seedToGenome(42)) !== JSON.stringify(seedToGenome(43)), "entropy spread");
310
+ add("all-21-dimensions", Object.keys(g1).length === 21 && DIMENSIONS.every((d) => typeof g1[d.id] === "number"), `n=${Object.keys(g1).length}`);
311
+ add("values-in-range", Object.values(g1).every((v) => v >= 0 && v <= 1), "0..1 bounded");
312
+
313
+ const flat: Genome = {}; DIMENSIONS.forEach((d) => { flat[d.id] = 0.5; });
314
+ const anomalyG = { ...flat, anomaly_sensitivity: 0.9, failure_treatment: 0.9 };
315
+ add("persona-anomaly-hunter", classifyPersona(anomalyG).name === "The Anomaly Hunter", classifyPersona(anomalyG).name);
316
+ add("persona-always-returns", !!classifyPersona(flat).name, classifyPersona(flat).name);
317
+
318
+ const analogyG = { ...flat, analogy_distance: 0.9, anomaly_sensitivity: 0.3 };
319
+ add("path-analogy-first", selectPath(analogyG).id === "β", selectPath(analogyG).id);
320
+ add("path-always-returns", !!selectPath(flat).seq, selectPath(flat).seq);
321
+
322
+ const r = pin(495915686, "Prove X.", "mathematics");
323
+ const p = r.prompt;
324
+ add("prompt-sections", ["INNOVATION GENOME", "NEGATIVE SPACE", "ADVERSARY", "TERMINATION", "REGISTRY", "QUANTIFIER ORDER", "ANOMALY BUFFER"].every((k) => p.includes(k)), "all sections present");
325
+ add("prompt-contains-problem", p.includes("Prove X."), "problem embedded");
326
+ add("prompt-length-reasonable", p.length > 2000 && p.length < 20000, `len=${p.length}`);
327
+ add("compact-directive", compileCompactDirective(r).length > 200, `len=${compileCompactDirective(r).length}`);
328
+
329
+ return { ok: checks.every((c) => c.passed), checks };
330
+ }
@@ -0,0 +1,3 @@
1
+ export * from "./innovation-genome-engine.orig";
2
+ // Canonical combined entry point: v1 base + v2 expansion, same seed.
3
+ export { buildUnifiedInnovationPlan, expandPath, stableSeed } from "@/lib/debug/unified-innovation";