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,792 @@
1
+ /**
2
+ * Innovation Genome Engine v2.0 — Modal UI
3
+ * ============================================================================
4
+ * Deterministic mutation, crossover, safety/capability gates, and domain packs.
5
+ */
6
+ import { useEffect, useState } from "react";
7
+ import { createPortal } from "react-dom";
8
+ import {
9
+ DIMENSIONS,
10
+ classifyPersonaExtended,
11
+ selectPathExtended,
12
+ DOMAIN_PACKS,
13
+ rollV2,
14
+ applyMutation,
15
+ crossoverUniform,
16
+ crossoverBlock,
17
+ CapabilityGate,
18
+ type InnovationGenomeV2,
19
+ type RiskTier,
20
+ type MutationKind,
21
+ type CrossoverKind,
22
+ } from "@/lib/innovation-genome-engine-v2";
23
+ import { seedToGenome, type Genome } from "@/lib/innovation-genome-engine";
24
+ import {
25
+ runInnovationGenomeV3Demo,
26
+ runInnovationGenomeV3Diagnostics,
27
+ type V3Report,
28
+ type DiagnosticCheck,
29
+ } from "@/lib/innovation-genome-v3";
30
+ import {
31
+ runInnovationGenomeV4Demo,
32
+ runInnovationGenomeV4Diagnostics,
33
+ type V4Report,
34
+ type DiagnosticCheck as V4DiagnosticCheck,
35
+ } from "@/lib/innovation-genome-v4";
36
+ import {
37
+ runInnovationGenomeV57Diagnostics,
38
+ compatibilityAuditV7,
39
+ type DiagnosticCheck as V57DiagnosticCheck,
40
+ } from "@/lib/innovation-genome-v7";
41
+ import {
42
+ runInnovationGenomeV8Diagnostics,
43
+ compatibilityAuditV8,
44
+ type DiagnosticCheck as V8DiagnosticCheck,
45
+ } from "@/lib/innovation-genome-v8";
46
+ import {
47
+ runInnovationGenomeV9Diagnostics,
48
+ compatibilityAuditV9,
49
+ type DiagnosticCheck as V9DiagnosticCheck,
50
+ } from "@/lib/innovation-genome-v9";
51
+ import { runInnovationGenomeV10Diagnostics } from "@/lib/innovation-genome-v10";
52
+
53
+ interface Props {
54
+ open: boolean;
55
+ onClose: () => void;
56
+ onUseInV15?: (genome: InnovationGenomeV2) => void;
57
+ }
58
+
59
+ export function InnovationGenomeEngine({ open, onClose, onUseInV15 }: Props) {
60
+ const [seed, setSeed] = useState<number>(() => Math.floor(Math.random() * 0xffffffff));
61
+ const [problem, setProblem] = useState<string>("");
62
+ const [domain, setDomain] = useState<string>("general");
63
+ const [risk, setRisk] = useState<RiskTier>("medium");
64
+ const [genome, setGenome] = useState<InnovationGenomeV2 | null>(null);
65
+ const [compiledPrompt, setCompiledPrompt] = useState<string>("");
66
+ const [mutateKind, setMutateKind] = useState<MutationKind>("nudge");
67
+ const [mutateOpIdx, setMutateOpIdx] = useState<number>(0);
68
+ const [crossKind, setCrossKind] = useState<CrossoverKind>("block");
69
+ const [crossSeed, setCrossSeed] = useState<number>(42);
70
+
71
+ const [capWeb, setCapWeb] = useState(false);
72
+ const [capVerifier, setCapVerifier] = useState(false);
73
+ const [capFormal, setCapFormal] = useState(false);
74
+ const [capSandbox, setCapSandbox] = useState(false);
75
+
76
+ // Innovation Genome Engine V3.0 — verified discovery runtime (see
77
+ // @/lib/innovation-genome-v3.ts). Additive tab alongside the v2 compiler;
78
+ // nothing above this block is touched.
79
+ const [v3Running, setV3Running] = useState(false);
80
+ const [v3Report, setV3Report] = useState<V3Report | null>(null);
81
+ const [v3Error, setV3Error] = useState<string>("");
82
+ const [v3Diagnostics, setV3Diagnostics] = useState<{ ok: boolean; checks: DiagnosticCheck[] } | null>(null);
83
+
84
+ // V4 — Evidence-Governed Discovery Plane (additive over V3)
85
+ const [v4Running, setV4Running] = useState(false);
86
+ const [v4Report, setV4Report] = useState<V4Report | null>(null);
87
+ const [v4Error, setV4Error] = useState<string>("");
88
+ const [v4Diagnostics, setV4Diagnostics] = useState<{ ok: boolean; checks: V4DiagnosticCheck[] } | null>(null);
89
+
90
+ const runV3 = async () => {
91
+ setV3Running(true);
92
+ setV3Error("");
93
+ try {
94
+ const report = await runInnovationGenomeV3Demo({
95
+ problem: problem || "Explore the problem space",
96
+ domain,
97
+ seed,
98
+ });
99
+ setV3Report(report);
100
+ } catch (err) {
101
+ setV3Error(err instanceof Error ? err.message : String(err));
102
+ } finally {
103
+ setV3Running(false);
104
+ }
105
+ };
106
+
107
+ const runV3Diag = async () => {
108
+ setV3Running(true);
109
+ setV3Error("");
110
+ try {
111
+ setV3Diagnostics(await runInnovationGenomeV3Diagnostics());
112
+ } catch (err) {
113
+ setV3Error(err instanceof Error ? err.message : String(err));
114
+ } finally {
115
+ setV3Running(false);
116
+ }
117
+ };
118
+
119
+ const runV4 = async () => {
120
+ setV4Running(true);
121
+ setV4Error("");
122
+ try {
123
+ const report = await runInnovationGenomeV4Demo({
124
+ problem: problem || "Produce an evidence-bound artifact.",
125
+ domain,
126
+ seed,
127
+ });
128
+ setV4Report(report);
129
+ } catch (err) {
130
+ setV4Error(err instanceof Error ? err.message : String(err));
131
+ } finally {
132
+ setV4Running(false);
133
+ }
134
+ };
135
+
136
+ const runV4Diag = async () => {
137
+ setV4Running(true);
138
+ setV4Error("");
139
+ try {
140
+ setV4Diagnostics(await runInnovationGenomeV4Diagnostics());
141
+ } catch (err) {
142
+ setV4Error(err instanceof Error ? err.message : String(err));
143
+ } finally {
144
+ setV4Running(false);
145
+ }
146
+ };
147
+
148
+ // V5 (Production Assurance) + V7 (Production Reliability)
149
+ const [v57Running, setV57Running] = useState(false);
150
+ const [v57Error, setV57Error] = useState<string>("");
151
+ const [v57Diagnostics, setV57Diagnostics] = useState<{ ok: boolean; checks: V57DiagnosticCheck[] } | null>(null);
152
+ const [v7Audit, setV7Audit] = useState<Record<string, unknown> | null>(null);
153
+
154
+ const runV57Diag = async () => {
155
+ setV57Running(true);
156
+ setV57Error("");
157
+ try {
158
+ setV57Diagnostics(await runInnovationGenomeV57Diagnostics());
159
+ setV7Audit(compatibilityAuditV7());
160
+ } catch (err) {
161
+ setV57Error(err instanceof Error ? err.message : String(err));
162
+ } finally {
163
+ setV57Running(false);
164
+ }
165
+ };
166
+
167
+ // V8 (Alpha RC1 Control Plane)
168
+ const [v8Running, setV8Running] = useState(false);
169
+ const [v8Error, setV8Error] = useState<string>("");
170
+ const [v8Diagnostics, setV8Diagnostics] = useState<{ ok: boolean; checks: V8DiagnosticCheck[] } | null>(null);
171
+ const [v8Audit, setV8Audit] = useState<Record<string, unknown> | null>(null);
172
+
173
+ const runV8Diag = async () => {
174
+ setV8Running(true);
175
+ setV8Error("");
176
+ try {
177
+ setV8Diagnostics(await runInnovationGenomeV8Diagnostics());
178
+ setV8Audit(compatibilityAuditV8());
179
+ } catch (err) {
180
+ setV8Error(err instanceof Error ? err.message : String(err));
181
+ } finally {
182
+ setV8Running(false);
183
+ }
184
+ };
185
+
186
+ // V9 (Compliance & Quality Plane)
187
+ const [v9Running, setV9Running] = useState(false);
188
+ const [v9Error, setV9Error] = useState("");
189
+ const [v9Diagnostics, setV9Diagnostics] = useState<{ ok: boolean; checks: V9DiagnosticCheck[] } | null>(null);
190
+ const [v9Audit, setV9Audit] = useState<Record<string, unknown> | null>(null);
191
+
192
+ const runV9Diag = async () => {
193
+ setV9Running(true);
194
+ setV9Error("");
195
+ try {
196
+ setV9Diagnostics(await runInnovationGenomeV9Diagnostics());
197
+ setV9Audit(compatibilityAuditV9());
198
+ } catch (err) {
199
+ setV9Error(err instanceof Error ? err.message : String(err));
200
+ } finally {
201
+ setV9Running(false);
202
+ }
203
+ };
204
+
205
+ const [v10Running, setV10Running] = useState(false);
206
+ const [v10Error, setV10Error] = useState("");
207
+ const [v10Diagnostics, setV10Diagnostics] = useState<{ ok: boolean; checks: Array<{ id: string; passed: boolean; detail: string }> } | null>(null);
208
+
209
+ const runV10Diag = async () => {
210
+ setV10Running(true);
211
+ setV10Error("");
212
+ try {
213
+ setV10Diagnostics(runInnovationGenomeV10Diagnostics());
214
+ } catch (err) {
215
+ setV10Error(err instanceof Error ? err.message : String(err));
216
+ } finally {
217
+ setV10Running(false);
218
+ }
219
+ };
220
+
221
+ useEffect(() => {
222
+ if (!open) return;
223
+ const onKey = (e: KeyboardEvent) => { if (e.key === "Escape") onClose(); };
224
+ window.addEventListener("keydown", onKey);
225
+ return () => window.removeEventListener("keydown", onKey);
226
+ }, [open, onClose]);
227
+
228
+ const randomizeSeed = () => setSeed(Math.floor(Math.random() * 0xffffffff));
229
+
230
+ const compileV2 = async () => {
231
+ const g = await rollV2({
232
+ seed,
233
+ userProblem: problem || "Explore the problem space",
234
+ domain,
235
+ risk,
236
+ capabilityGate: new CapabilityGate({
237
+ runtimeSupportsParallelAgents: false,
238
+ verifierAvailable: capVerifier,
239
+ webRetrieval: capWeb,
240
+ formalProver: capFormal,
241
+ executionSandbox: capSandbox,
242
+ declaredTools: [],
243
+ }),
244
+ });
245
+ setGenome(g);
246
+ setCompiledPrompt(g.prompt);
247
+ if (typeof window !== "undefined") (window as any)._VERITAS_INNOVATION_GENOME_V2 = g;
248
+ };
249
+
250
+ const applyMutate = () => {
251
+ if (!genome) return;
252
+ const mutated = applyMutation(genome.genome, seed, mutateKind, mutateOpIdx);
253
+ const newPersona = classifyPersonaExtended(mutated);
254
+ const newPath = selectPathExtended(mutated);
255
+ setGenome({ ...genome, genome: mutated, persona: newPersona, path: newPath });
256
+ };
257
+
258
+ const applyCross = () => {
259
+ if (!genome) return;
260
+ const other = seedToGenome(crossSeed);
261
+ let crossed: Genome;
262
+ if (crossKind === "uniform") crossed = crossoverUniform(genome.genome, other, seed);
263
+ else if (crossKind === "block") crossed = crossoverBlock(genome.genome, other, seed);
264
+ else crossed = other;
265
+ const newPersona = classifyPersonaExtended(crossed);
266
+ const newPath = selectPathExtended(crossed);
267
+ setGenome({ ...genome, genome: crossed, persona: newPersona, path: newPath });
268
+ };
269
+
270
+ const copyPrompt = async () => {
271
+ if (compiledPrompt) await navigator.clipboard.writeText(compiledPrompt);
272
+ };
273
+
274
+ const copyJSON = async () => {
275
+ if (genome) await navigator.clipboard.writeText(JSON.stringify(genome, null, 2));
276
+ };
277
+
278
+ const useInV15 = () => {
279
+ if (genome && onUseInV15) onUseInV15(genome);
280
+ onClose();
281
+ };
282
+
283
+ if (!open) return null;
284
+
285
+ return createPortal(
286
+ <div className="fixed inset-0 z-[10003] flex items-start justify-center overflow-y-auto bg-black/60 p-4" onClick={onClose}>
287
+ <div className="my-4 flex w-full max-w-7xl flex-col overflow-hidden rounded-2xl bg-white shadow-2xl" onClick={(e) => e.stopPropagation()}>
288
+ {/* Header */}
289
+ <div className="flex-none border-b border-zinc-200 px-6 py-4">
290
+ <div className="flex items-start justify-between">
291
+ <div>
292
+ <h2 className="text-2xl font-bold text-zinc-900"> Innovation Genome Engine v2.0</h2>
293
+ <p className="mt-0.5 text-[12px] text-zinc-500">
294
+ Deterministic mutation, crossover, safety/capability gates, and domain packs. Prompt output is not proof of novelty.
295
+ </p>
296
+ </div>
297
+ <div className="flex gap-2">
298
+ <button onClick={useInV15} className="rounded-lg border border-indigo-300 bg-indigo-50 px-3 py-1.5 text-xs font-bold text-indigo-800 hover:bg-indigo-100">
299
+ Use in V15
300
+ </button>
301
+ <button onClick={onClose} className="rounded-full border border-zinc-300 px-4 py-1.5 text-sm font-semibold text-zinc-700 hover:bg-zinc-100">
302
+ Close
303
+ </button>
304
+ </div>
305
+ </div>
306
+ </div>
307
+
308
+ <div className="flex flex-1 overflow-hidden">
309
+ {/* Left Panel — Controls */}
310
+ <div className="w-80 flex-none overflow-y-auto border-r border-zinc-200 p-4 space-y-4">
311
+ {/* Seed */}
312
+ <div>
313
+ <label className="text-[11px] font-bold uppercase tracking-wider text-zinc-600">Seed</label>
314
+ <div className="mt-1 flex gap-2">
315
+ <input type="number" value={seed} onChange={(e) => setSeed(parseInt(e.target.value, 10) || 0)} className="w-full rounded border border-zinc-300 px-2 py-1 text-sm font-mono" />
316
+ <button onClick={randomizeSeed} className="rounded bg-zinc-100 px-2 py-1 text-xs font-bold text-zinc-700 hover:bg-zinc-200">🎲</button>
317
+ </div>
318
+ </div>
319
+
320
+ {/* Problem */}
321
+ <div>
322
+ <label className="text-[11px] font-bold uppercase tracking-wider text-zinc-600">Problem</label>
323
+ <textarea value={problem} onChange={(e) => setProblem(e.target.value)} rows={3} className="mt-1 w-full rounded border border-zinc-300 px-2 py-1 text-sm" placeholder="Prove X, design Y, explore Z..." />
324
+ </div>
325
+
326
+ {/* Domain & Risk */}
327
+ <div className="grid grid-cols-2 gap-2">
328
+ <div>
329
+ <label className="text-[11px] font-bold uppercase tracking-wider text-zinc-600">Domain</label>
330
+ <select value={domain} onChange={(e) => setDomain(e.target.value)} className="mt-1 w-full rounded border border-zinc-300 px-1 py-1 text-xs">
331
+ {Object.keys(DOMAIN_PACKS).map((d) => <option key={d} value={d}>{d}</option>)}
332
+ </select>
333
+ </div>
334
+ <div>
335
+ <label className="text-[11px] font-bold uppercase tracking-wider text-zinc-600">Risk</label>
336
+ <select value={risk} onChange={(e) => setRisk(e.target.value as RiskTier)} className="mt-1 w-full rounded border border-zinc-300 px-1 py-1 text-xs">
337
+ <option value="low">low</option>
338
+ <option value="medium">medium</option>
339
+ <option value="high">high</option>
340
+ <option value="critical">critical</option>
341
+ </select>
342
+ </div>
343
+ </div>
344
+
345
+ {/* Compile Buttons */}
346
+ <div className="flex gap-2">
347
+ <button onClick={compileV2} className="flex-1 rounded-lg bg-gradient-to-r from-fuchsia-600 to-indigo-600 px-3 py-2 text-xs font-bold text-white shadow hover:from-fuchsia-700 hover:to-indigo-700">
348
+ Compile v2
349
+ </button>
350
+ <button onClick={randomizeSeed} className="rounded-lg border border-zinc-300 bg-zinc-50 px-3 py-2 text-xs font-bold text-zinc-700 hover:bg-zinc-100">
351
+ Random seed
352
+ </button>
353
+ </div>
354
+
355
+ {/* Evolution Operators */}
356
+ <div className="rounded-xl border border-emerald-200 bg-emerald-50/30 p-3">
357
+ <div className="text-[10px] font-bold uppercase tracking-wider text-emerald-700">Evolution Operators</div>
358
+ <div className="mt-2 space-y-2">
359
+ <div className="flex gap-2">
360
+ <select value={mutateKind} onChange={(e) => setMutateKind(e.target.value as MutationKind)} className="flex-1 rounded border border-zinc-300 px-1 py-1 text-xs">
361
+ <option value="nudge">nudge</option>
362
+ <option value="flip">flip</option>
363
+ <option value="block_rotate">block_rotate</option>
364
+ <option value="pole_swap">pole_swap</option>
365
+ <option value="dimension_mask">dimension_mask</option>
366
+ </select>
367
+ <input type="number" value={mutateOpIdx} onChange={(e) => setMutateOpIdx(parseInt(e.target.value, 10) || 0)} className="w-16 rounded border border-zinc-300 px-1 py-1 text-xs" placeholder="opIdx" />
368
+ <button onClick={applyMutate} className="rounded bg-fuchsia-600 px-2 py-1 text-xs font-bold text-white">Mutate</button>
369
+ </div>
370
+ <div className="flex gap-2">
371
+ <select value={crossKind} onChange={(e) => setCrossKind(e.target.value as CrossoverKind)} className="flex-1 rounded border border-zinc-300 px-1 py-1 text-xs">
372
+ <option value="uniform">uniform</option>
373
+ <option value="block">block</option>
374
+ <option value="pareto_weighted">pareto_weighted</option>
375
+ </select>
376
+ <input type="number" value={crossSeed} onChange={(e) => setCrossSeed(parseInt(e.target.value, 10) || 0)} placeholder="seed" className="w-16 rounded border border-zinc-300 px-1 py-1 text-xs" />
377
+ <button onClick={applyCross} className="rounded bg-indigo-600 px-2 py-1 text-xs font-bold text-white">Cross</button>
378
+ </div>
379
+ </div>
380
+ </div>
381
+
382
+ {/* Capability Reality Gate */}
383
+ <div className="rounded-xl border border-amber-200 bg-amber-50/30 p-3">
384
+ <div className="text-[10px] font-bold uppercase tracking-wider text-amber-700">Capability Reality Gate</div>
385
+ <div className="mt-2 space-y-1 text-[11px]">
386
+ <label className="flex items-center gap-2"><input type="checkbox" checked={capWeb} onChange={(e) => setCapWeb(e.target.checked)} /> webRetrieval</label>
387
+ <label className="flex items-center gap-2"><input type="checkbox" checked={capVerifier} onChange={(e) => setCapVerifier(e.target.checked)} /> verifierAvailable</label>
388
+ <label className="flex items-center gap-2"><input type="checkbox" checked={capFormal} onChange={(e) => setCapFormal(e.target.checked)} /> formalProver</label>
389
+ <label className="flex items-center gap-2"><input type="checkbox" checked={capSandbox} onChange={(e) => setCapSandbox(e.target.checked)} /> executionSandbox</label>
390
+ </div>
391
+ </div>
392
+
393
+ {/* Innovation Genome Engine V3.0 — verified discovery runtime */}
394
+ <div className="rounded-xl border border-emerald-300 bg-emerald-50/40 p-3">
395
+ <div className="text-[10px] font-bold uppercase tracking-wider text-emerald-800">
396
+ V3.0 Verified Discovery Runtime
397
+ </div>
398
+ <div className="mt-1 text-[10px] leading-tight text-emerald-700">
399
+ Goal/evaluator versioning · GEPA textual feedback · tamper-evident hash-chained event log ·
400
+ versioned MAP-Elites archive · structural-diversity monitor
401
+ </div>
402
+ <div className="mt-2 flex gap-2">
403
+ <button
404
+ onClick={runV3}
405
+ disabled={v3Running}
406
+ className="flex-1 rounded-lg bg-emerald-700 px-2 py-1.5 text-[11px] font-bold text-white hover:bg-emerald-800 disabled:opacity-50"
407
+ >
408
+ {v3Running ? "Running…" : "▶ Run V3 Epoch"}
409
+ </button>
410
+ <button
411
+ onClick={runV3Diag}
412
+ disabled={v3Running}
413
+ className="rounded-lg border border-emerald-300 bg-white px-2 py-1.5 text-[11px] font-bold text-emerald-800 hover:bg-emerald-50 disabled:opacity-50"
414
+ >
415
+ Diagnostics
416
+ </button>
417
+ </div>
418
+
419
+ {v3Error && (
420
+ <div className="mt-2 rounded-lg border border-rose-300 bg-rose-50 p-2 text-[10px] text-rose-800">
421
+ {v3Error}
422
+ </div>
423
+ )}
424
+
425
+ {v3Diagnostics && (
426
+ <div className="mt-2 rounded-lg border border-zinc-200 bg-white p-2">
427
+ <div className={`text-[11px] font-bold ${v3Diagnostics.ok ? "text-emerald-700" : "text-rose-700"}`}>
428
+ {v3Diagnostics.ok ? "✓ ALL CHECKS PASS" : "✗ CHECKS FAILED"} ({v3Diagnostics.checks.filter((c) => c.passed).length}/{v3Diagnostics.checks.length})
429
+ </div>
430
+ <div className="mt-1 max-h-32 overflow-y-auto text-[9px] leading-tight">
431
+ {v3Diagnostics.checks.map((c) => (
432
+ <div key={c.id} className={c.passed ? "text-zinc-600" : "text-rose-700 font-bold"}>
433
+ {c.passed ? "✓" : "✗"} {c.id}
434
+ </div>
435
+ ))}
436
+ </div>
437
+ </div>
438
+ )}
439
+
440
+ {v3Report && (
441
+ <div className="mt-2 rounded-lg border border-zinc-200 bg-white p-2 text-[10px]">
442
+ <div className="font-bold text-zinc-800">run {v3Report.run_id.slice(0, 12)}…</div>
443
+ <div className="mt-0.5 text-zinc-600">
444
+ seal: <span className={v3Report.tamper_evident_seal ? "text-emerald-700 font-bold" : "text-rose-700 font-bold"}>
445
+ {v3Report.tamper_evident_seal ? "VERIFIED" : "CORRUPTED"}
446
+ </span>
447
+ {" · "}archive: {v3Report.archive_size}
448
+ </div>
449
+ {v3Report.best_candidate && (
450
+ <div className="mt-1 text-zinc-600">
451
+ best: {v3Report.best_candidate.id.slice(0, 12)}… · verified: {String(v3Report.best_candidate.verified)}
452
+ </div>
453
+ )}
454
+ </div>
455
+ )}
456
+ </div>
457
+
458
+ {/* V4 — Evidence-Governed Discovery Plane */}
459
+ <div className="rounded-xl border border-sky-300 bg-sky-50/40 p-3">
460
+ <div className="text-[10px] font-bold uppercase tracking-wider text-sky-800">
461
+ V4.0 Evidence-Governed Discovery
462
+ </div>
463
+ <div className="mt-1 text-[10px] leading-tight text-sky-700">
464
+ Claim-level evidence closure · strict blinding · dev/val/audit tiers ·
465
+ scoped HMAC grants · executable P/A/E/N/V/T/S stages · dual hash chains ·
466
+ DSSE-shaped attestations
467
+ </div>
468
+ <div className="mt-2 flex gap-2">
469
+ <button
470
+ onClick={runV4}
471
+ disabled={v4Running}
472
+ className="flex-1 rounded-lg bg-sky-700 px-2 py-1.5 text-[11px] font-bold text-white hover:bg-sky-800 disabled:opacity-50"
473
+ >
474
+ {v4Running ? "Running…" : "▶ Run V4 Epoch"}
475
+ </button>
476
+ <button
477
+ onClick={runV4Diag}
478
+ disabled={v4Running}
479
+ className="rounded-lg border border-sky-300 bg-white px-2 py-1.5 text-[11px] font-bold text-sky-800 hover:bg-sky-50 disabled:opacity-50"
480
+ >
481
+ Diagnostics
482
+ </button>
483
+ </div>
484
+
485
+ {v4Error && (
486
+ <div className="mt-2 rounded-lg border border-rose-300 bg-rose-50 p-2 text-[10px] text-rose-800">
487
+ {v4Error}
488
+ </div>
489
+ )}
490
+
491
+ {v4Diagnostics && (
492
+ <div className="mt-2 rounded-lg border border-zinc-200 bg-white p-2">
493
+ <div className={`text-[11px] font-bold ${v4Diagnostics.ok ? "text-emerald-700" : "text-rose-700"}`}>
494
+ {v4Diagnostics.ok ? "✓ ALL CHECKS PASS" : "✗ CHECKS FAILED"} ({v4Diagnostics.checks.filter((c) => c.passed).length}/{v4Diagnostics.checks.length})
495
+ </div>
496
+ <div className="mt-1 max-h-32 overflow-y-auto text-[9px] leading-tight">
497
+ {v4Diagnostics.checks.map((c) => (
498
+ <div key={c.id} className={c.passed ? "text-zinc-600" : "text-rose-700 font-bold"}>
499
+ {c.passed ? "✓" : "✗"} {c.id}
500
+ </div>
501
+ ))}
502
+ </div>
503
+ </div>
504
+ )}
505
+
506
+ {v4Report && (
507
+ <div className="mt-2 rounded-lg border border-zinc-200 bg-white p-2 text-[10px]">
508
+ <div className="font-bold text-zinc-800">run {v4Report.run_id.slice(0, 12)}…</div>
509
+ <div className="mt-0.5 text-zinc-600">
510
+ seal: <span className={v4Report.tamper_evident_seal ? "text-emerald-700 font-bold" : "text-rose-700 font-bold"}>
511
+ {v4Report.tamper_evident_seal ? "VERIFIED" : "CORRUPTED"}
512
+ </span>
513
+ {" · "}semantic: <span className={v4Report.semantic_chain_valid ? "text-emerald-700 font-bold" : "text-rose-700 font-bold"}>
514
+ {v4Report.semantic_chain_valid ? "VALID" : "INVALID"}
515
+ </span>
516
+ </div>
517
+ <div className="mt-0.5 text-zinc-600">
518
+ audit_pass: {String(v4Report.audit.audit_pass)} · outcomes: {v4Report.outcomes.length}
519
+ </div>
520
+ {v4Report.outcomes[0] && (
521
+ <div className="mt-1 text-zinc-600">
522
+ top: {v4Report.outcomes[0].candidate_id.slice(0, 12)}… · tier: {v4Report.outcomes[0].highest_tier} ·
523
+ promoted: {String(v4Report.outcomes[0].promoted)} · closed: {String(v4Report.outcomes[0].evidence_closed)}
524
+ </div>
525
+ )}
526
+ </div>
527
+ )}
528
+ </div>
529
+
530
+ {/* V5 + V7 — Production Assurance & Reliability Planes */}
531
+ <div className="rounded-xl border border-violet-300 bg-violet-50/40 p-3">
532
+ <div className="text-[10px] font-bold uppercase tracking-wider text-violet-800">
533
+ V5 Assurance + V7 Reliability
534
+ </div>
535
+ <div className="mt-1 text-[10px] leading-tight text-violet-700">
536
+ V5: policy-as-code · spans · canary taint · sealed suites · verifier protocol ·
537
+ replay matrix · tool drift · SLO health · assurance gateway.
538
+ <br />
539
+ V7: checksummed migrations · WAL-reset guard · atomic units of work ·
540
+ durable leased queue (fencing tokens, dead-letters) · redacted telemetry ·
541
+ exact verifier closure · RFC 9162 Merkle proofs · verified backup · doctor.
542
+ </div>
543
+ <div className="mt-2 flex gap-2">
544
+ <button
545
+ onClick={runV57Diag}
546
+ disabled={v57Running}
547
+ className="flex-1 rounded-lg bg-violet-700 px-2 py-1.5 text-[11px] font-bold text-white hover:bg-violet-800 disabled:opacity-50"
548
+ >
549
+ {v57Running ? "Running…" : "▶ Run V5+V7 Diagnostics"}
550
+ </button>
551
+ </div>
552
+
553
+ {v57Error && (
554
+ <div className="mt-2 rounded-lg border border-rose-300 bg-rose-50 p-2 text-[10px] text-rose-800">
555
+ {v57Error}
556
+ </div>
557
+ )}
558
+
559
+ {v57Diagnostics && (
560
+ <div className="mt-2 rounded-lg border border-zinc-200 bg-white p-2">
561
+ <div className={`text-[11px] font-bold ${v57Diagnostics.ok ? "text-emerald-700" : "text-rose-700"}`}>
562
+ {v57Diagnostics.ok ? "✓ ALL CHECKS PASS" : "✗ CHECKS FAILED"} ({v57Diagnostics.checks.filter((c) => c.passed).length}/{v57Diagnostics.checks.length})
563
+ </div>
564
+ <div className="mt-1 max-h-48 overflow-y-auto text-[9px] leading-tight">
565
+ {v57Diagnostics.checks.map((c) => (
566
+ <div key={c.id} className={c.passed ? "text-zinc-600" : "text-rose-700 font-bold"}>
567
+ {c.passed ? "✓" : "✗"} {c.id}
568
+ {!c.passed && <span className="ml-1 text-rose-500">— {c.detail}</span>}
569
+ </div>
570
+ ))}
571
+ </div>
572
+ </div>
573
+ )}
574
+
575
+ {v7Audit && (
576
+ <details className="mt-2">
577
+ <summary className="cursor-pointer text-[10px] font-bold text-violet-800">
578
+ V7 compatibility audit
579
+ </summary>
580
+ <pre className="mt-1 max-h-40 overflow-auto rounded border border-zinc-200 bg-white p-2 text-[9px] leading-tight text-zinc-700">
581
+ {JSON.stringify(v7Audit, null, 2)}
582
+ </pre>
583
+ </details>
584
+ )}
585
+ </div>
586
+
587
+ {/* V8 — Alpha RC1 Control Plane */}
588
+ <div className="rounded-xl border border-rose-300 bg-rose-50/40 p-3">
589
+ <div className="text-[10px] font-bold uppercase tracking-wider text-rose-800">
590
+ V8.0 Alpha RC1 Control Plane
591
+ </div>
592
+ <div className="mt-1 text-[10px] leading-tight text-rose-700">
593
+ Multi-tenant namespaces · RBAC · recursive attenuation · kill switches ·
594
+ untrusted data context isolation · prompt-injection quarantine ·
595
+ transactional outbox / idempotent inbox · progressive releases ·
596
+ Otel GenAI semantic attributes · Alpha RC1 readiness gate.
597
+ </div>
598
+ <div className="mt-2 flex gap-2">
599
+ <button
600
+ onClick={runV8Diag}
601
+ disabled={v8Running}
602
+ className="flex-1 rounded-lg bg-rose-700 px-2 py-1.5 text-[11px] font-bold text-white hover:bg-rose-800 disabled:opacity-50"
603
+ >
604
+ {v8Running ? "Running…" : "▶ Run V8 Diagnostics"}
605
+ </button>
606
+ </div>
607
+
608
+ {v8Error && (
609
+ <div className="mt-2 rounded-lg border border-rose-300 bg-rose-50 p-2 text-[10px] text-rose-800">
610
+ {v8Error}
611
+ </div>
612
+ )}
613
+
614
+ {v8Diagnostics && (
615
+ <div className="mt-2 rounded-lg border border-zinc-200 bg-white p-2">
616
+ <div className={`text-[11px] font-bold ${v8Diagnostics.ok ? "text-emerald-700" : "text-rose-700"}`}>
617
+ {v8Diagnostics.ok ? "✓ ALL CHECKS PASS" : "✗ CHECKS FAILED"} ({v8Diagnostics.checks.filter((c) => c.passed).length}/{v8Diagnostics.checks.length})
618
+ </div>
619
+ <div className="mt-1 max-h-48 overflow-y-auto text-[9px] leading-tight">
620
+ {v8Diagnostics.checks.map((c) => (
621
+ <div key={c.id} className={c.passed ? "text-zinc-600" : "text-rose-700 font-bold"}>
622
+ {c.passed ? "✓" : "✗"} {c.id}
623
+ {!c.passed && <span className="ml-1 text-rose-500">— {c.detail}</span>}
624
+ </div>
625
+ ))}
626
+ </div>
627
+ </div>
628
+ )}
629
+
630
+ {v8Audit && (
631
+ <details className="mt-2">
632
+ <summary className="cursor-pointer text-[10px] font-bold text-rose-800">
633
+ V8 compatibility audit
634
+ </summary>
635
+ <pre className="mt-1 max-h-40 overflow-auto rounded border border-zinc-200 bg-white p-2 text-[9px] leading-tight text-zinc-700">
636
+ {JSON.stringify(v8Audit, null, 2)}
637
+ </pre>
638
+ </details>
639
+ )}
640
+ </div>
641
+
642
+ {/* V9 — Compliance, GenAI Observability & Continuous Quality */}
643
+ <div className="rounded-xl border border-teal-300 bg-teal-50/40 p-3">
644
+ <div className="text-[10px] font-bold uppercase tracking-wider text-teal-800">
645
+ V9.0 Compliance & Quality Plane
646
+ </div>
647
+ <div className="mt-1 text-[10px] leading-tight text-teal-700">
648
+ EU AI Act Art 11/12/26/72/79 · OTel GenAI v1.41 emitter ·
649
+ PII/secret redactor · LLM-as-Judge panel · golden dataset curator ·
650
+ eval-gated CI · CUSUM drift monitor · MCP audit · deterministic replay ·
651
+ evidence-pack exporter
652
+ </div>
653
+ <div className="mt-2 flex gap-2">
654
+ <button
655
+ onClick={runV9Diag}
656
+ disabled={v9Running}
657
+ className="flex-1 rounded-lg bg-teal-700 px-2 py-1.5 text-[11px] font-bold text-white hover:bg-teal-800 disabled:opacity-50"
658
+ >
659
+ {v9Running ? "Running…" : "▶ Run V9 Diagnostics"}
660
+ </button>
661
+ </div>
662
+ {v9Error && <div className="mt-2 rounded-lg border border-rose-300 bg-rose-50 p-2 text-[10px] text-rose-800">{v9Error}</div>}
663
+ {v9Diagnostics && (
664
+ <div className="mt-2 rounded-lg border border-zinc-200 bg-white p-2">
665
+ <div className={`text-[11px] font-bold ${v9Diagnostics.ok ? "text-emerald-700" : "text-rose-700"}`}>
666
+ {v9Diagnostics.ok ? "✓ ALL CHECKS PASS" : "✗ CHECKS FAILED"} ({v9Diagnostics.checks.filter(c => c.passed).length}/{v9Diagnostics.checks.length})
667
+ </div>
668
+ <div className="mt-1 max-h-48 overflow-y-auto text-[9px] leading-tight">
669
+ {v9Diagnostics.checks.map(c => (
670
+ <div key={c.id} className={c.passed ? "text-zinc-600" : "text-rose-700 font-bold"}>
671
+ {c.passed ? "✓" : "✗"} {c.id}{!c.passed && <span className="ml-1 text-rose-500">— {c.detail}</span>}
672
+ </div>
673
+ ))}
674
+ </div>
675
+ </div>
676
+ )}
677
+ {v9Audit && (
678
+ <details className="mt-2">
679
+ <summary className="cursor-pointer text-[10px] font-bold text-teal-800">V9 compatibility audit</summary>
680
+ <pre className="mt-1 max-h-40 overflow-auto rounded border border-zinc-200 bg-white p-2 text-[9px] leading-tight text-zinc-700">
681
+ {JSON.stringify(v9Audit, null, 2)}
682
+ </pre>
683
+ </details>
684
+ )}
685
+ </div>
686
+
687
+ {/* V10 — Creative Tree of Life */}
688
+ <div className="rounded-xl border border-lime-300 bg-lime-50/40 p-3">
689
+ <div className="text-[10px] font-bold uppercase tracking-wider text-lime-800">
690
+ V10.0 Creative Tree of Life Plane
691
+ </div>
692
+ <div className="mt-1 text-[10px] leading-tight text-lime-700">
693
+ Offline studio · seed → sprout → branch → bloom → fruit → compost ·
694
+ 20 transparent operators · local novelty · cohesion · human confirmation ·
695
+ compost recycling · JSON/tree exports
696
+ </div>
697
+ <button
698
+ onClick={runV10Diag}
699
+ disabled={v10Running}
700
+ className="mt-2 w-full rounded-lg bg-lime-700 px-2 py-1.5 text-[11px] font-bold text-white hover:bg-lime-800 disabled:opacity-50"
701
+ >
702
+ {v10Running ? "Running…" : "▶ Run V10 Diagnostics"}
703
+ </button>
704
+ {v10Error && <div className="mt-2 rounded-lg border border-rose-300 bg-rose-50 p-2 text-[10px] text-rose-800">{v10Error}</div>}
705
+ {v10Diagnostics && (
706
+ <div className="mt-2 rounded-lg border border-zinc-200 bg-white p-2">
707
+ <div className={`text-[11px] font-bold ${v10Diagnostics.ok ? "text-emerald-700" : "text-rose-700"}`}>
708
+ {v10Diagnostics.ok ? "✓ ALL CHECKS PASS" : "✗ CHECKS FAILED"} ({v10Diagnostics.checks.filter(c => c.passed).length}/{v10Diagnostics.checks.length})
709
+ </div>
710
+ <div className="mt-1 max-h-48 overflow-y-auto text-[9px] leading-tight">
711
+ {v10Diagnostics.checks.map(c => (
712
+ <div key={c.id} className={c.passed ? "text-zinc-600" : "text-rose-700 font-bold"}>
713
+ {c.passed ? "✓" : "✗"} {c.id}{!c.passed && <span className="ml-1 text-rose-500">— {c.detail}</span>}
714
+ </div>
715
+ ))}
716
+ </div>
717
+ </div>
718
+ )}
719
+ </div>
720
+
721
+ {/* Genome Summary */}
722
+ {genome && (
723
+ <div className="rounded-xl border border-fuchsia-200 bg-fuchsia-50/30 p-3">
724
+ <div className="text-[10px] font-bold uppercase tracking-wider text-fuchsia-700">Genome Summary</div>
725
+ <div className="mt-2 text-[11px]">
726
+ <div className="font-bold text-fuchsia-900">{genome.persona.name}</div>
727
+ <div className="text-fuchsia-800">{genome.persona.tagline}</div>
728
+ <div className="mt-1 font-mono text-[10px]">Path: {genome.path.id} — {genome.path.name}</div>
729
+ <div className="mt-0.5 font-mono text-[10px]">Domain: {genome.domainPack.name} · Risk: {genome.safetyGate.risk}</div>
730
+ </div>
731
+ </div>
732
+ )}
733
+ </div>
734
+
735
+ {/* Right Panel — Compiled Prompt & Dimensions */}
736
+ <div className="flex-1 overflow-y-auto p-5">
737
+ {compiledPrompt ? (
738
+ <>
739
+ <div className="mb-4 flex items-center justify-between">
740
+ <h3 className="text-sm font-bold text-zinc-900">Compiled v2 Innovation Prompt</h3>
741
+ <div className="flex gap-2">
742
+ <button onClick={copyPrompt} className="rounded border border-zinc-300 bg-zinc-50 px-2 py-1 text-[10px] font-bold text-zinc-700 hover:bg-zinc-100">📋 Copy Prompt</button>
743
+ <button onClick={copyJSON} className="rounded border border-zinc-300 bg-zinc-50 px-2 py-1 text-[10px] font-bold text-zinc-700 hover:bg-zinc-100">📋 Copy JSON</button>
744
+ </div>
745
+ </div>
746
+ <pre className="max-h-[60vh] overflow-auto rounded-xl border border-zinc-200 bg-zinc-900 p-4 text-[10px] font-mono text-emerald-400">
747
+ {compiledPrompt}
748
+ </pre>
749
+
750
+ {/* Dimension Values */}
751
+ {genome && (
752
+ <>
753
+ <h3 className="mt-6 text-sm font-bold text-zinc-900">Dimension Values</h3>
754
+ <div className="mt-2 grid grid-cols-1 gap-2 md:grid-cols-2">
755
+ {DIMENSIONS.map((dim: any) => {
756
+ const val = genome.genome[dim.id] ?? 0;
757
+ return (
758
+ <div key={dim.id} className="rounded-lg border border-zinc-200 bg-white p-2.5">
759
+ <div className="flex items-center justify-between text-[11px]">
760
+ <span className="font-bold text-zinc-800">{dim.name}</span>
761
+ <span className="font-mono text-fuchsia-700">{val.toFixed(2)}</span>
762
+ </div>
763
+ <div className="mt-1 h-1.5 overflow-hidden rounded-full bg-zinc-100">
764
+ <div className="h-full rounded-full bg-gradient-to-r from-indigo-500 to-fuchsia-500" style={{ width: `${Math.round(val * 100)}%` }} />
765
+ </div>
766
+ <div className="mt-1 flex justify-between gap-2 text-[9px] text-zinc-400">
767
+ <span>{dim.lowPole}</span>
768
+ <span className="text-right">{dim.highPole}</span>
769
+ </div>
770
+ </div>
771
+ );
772
+ })}
773
+ </div>
774
+ </>
775
+ )}
776
+ </>
777
+ ) : (
778
+ <div className="grid h-full place-items-center text-center text-sm text-zinc-500">
779
+ <div>
780
+ <div className="text-4xl">🧬</div>
781
+ <div className="mt-2 font-bold">Enter a problem and click "Compile v2"</div>
782
+ <div className="mt-1 text-zinc-400">The engine will roll a deterministic genome from the seed and compile the full innovation prompt.</div>
783
+ </div>
784
+ </div>
785
+ )}
786
+ </div>
787
+ </div>
788
+ </div>
789
+ </div>,
790
+ document.body
791
+ );
792
+ }