c4reqber 5.6.0__py3-none-any.whl

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 (1439) hide show
  1. c4reqber-5.6.0.dist-info/METADATA +381 -0
  2. c4reqber-5.6.0.dist-info/RECORD +1439 -0
  3. c4reqber-5.6.0.dist-info/WHEEL +4 -0
  4. c4reqber-5.6.0.dist-info/entry_points.txt +3 -0
  5. c4reqber-5.6.0.dist-info/licenses/LICENSE +165 -0
  6. c4reqber-5.6.0.dist-info/licenses/LICENSE-COMMERCIAL.md +193 -0
  7. c4reqber-5.6.0.dist-info/licenses/NOTICE +9 -0
  8. src/__init__.py +8 -0
  9. src/__main__.py +17 -0
  10. src/adapters/__init__.py +1 -0
  11. src/adapters/arxiv_adapter.py +238 -0
  12. src/adapters/ollama_adapter.py +330 -0
  13. src/adapters/pubmed_adapter.py +294 -0
  14. src/agenda/__init__.py +8 -0
  15. src/agenda/feasibility.py +66 -0
  16. src/agenda/generator.py +131 -0
  17. src/agenda/priority.py +48 -0
  18. src/agenda/progress.py +57 -0
  19. src/agent/__init__.py +11 -0
  20. src/agent/config.py +128 -0
  21. src/agent/core.py +797 -0
  22. src/agent/daemon.py +194 -0
  23. src/agent/discovery_agent.py +527 -0
  24. src/agent/skills.py +201 -0
  25. src/agent/sub_agent.py +97 -0
  26. src/agents/__init__.py +27 -0
  27. src/agents/discovery/__init__.py +39 -0
  28. src/agents/discovery/core.py +319 -0
  29. src/agents/discovery/strategies.py +251 -0
  30. src/agents/discovery_agent.py +35 -0
  31. src/agents/discovery_loop.py +67 -0
  32. src/agents/functor_orchestrator.py +230 -0
  33. src/agents/functors/__init__.py +29 -0
  34. src/agents/functors/abstraction.py +31 -0
  35. src/agents/functors/base.py +76 -0
  36. src/agents/functors/composite.py +108 -0
  37. src/agents/functors/concretization.py +31 -0
  38. src/agents/functors/context.py +31 -0
  39. src/agents/functors/distinction.py +38 -0
  40. src/agents/functors/integration.py +31 -0
  41. src/agents/functors/inversion.py +38 -0
  42. src/agents/functors/meta_reflection.py +31 -0
  43. src/agents/functors/prompts.py +134 -0
  44. src/agents/functors/resonance.py +31 -0
  45. src/agents/functors/temporal.py +31 -0
  46. src/agents/mp_llm_generator.py +197 -0
  47. src/agents/multi/__init__.py +28 -0
  48. src/agents/multi/agents.py +398 -0
  49. src/agents/multi/core.py +123 -0
  50. src/agents/multi/orchestrator.py +109 -0
  51. src/agents/multi_agent.py +729 -0
  52. src/agents/orchestrator.py +186 -0
  53. src/agents/paradigm_coordinator.py +348 -0
  54. src/agents/pipeline/__init__.py +27 -0
  55. src/agents/pipeline/executor.py +628 -0
  56. src/agents/pipeline/steps/__init__.py +12 -0
  57. src/agents/pipeline/steps/base.py +51 -0
  58. src/agents/pipeline/steps/step_01_impact.py +70 -0
  59. src/agents/pipeline/steps/step_02_prior_art.py +125 -0
  60. src/agents/pipeline/steps/step_02b_gap_analysis.py +56 -0
  61. src/agents/pipeline/steps/step_02c_quality_gate.py +81 -0
  62. src/agents/pipeline/steps/step_02d_reality_check.py +184 -0
  63. src/agents/pipeline/steps/step_03_c4_fingerprint.py +72 -0
  64. src/agents/pipeline/steps/step_04_mp_rotation.py +138 -0
  65. src/agents/pipeline/steps/step_05_qzrf.py +59 -0
  66. src/agents/pipeline/steps/step_05b_cross_domain_transfer.py +82 -0
  67. src/agents/pipeline/steps/step_06_isomorphism.py +213 -0
  68. src/agents/pipeline/steps/step_07_plugins.py +63 -0
  69. src/agents/pipeline/steps/step_08_synthesis.py +434 -0
  70. src/agents/pipeline/steps/step_09_tote.py +407 -0
  71. src/agents/pipeline/steps/step_10_simulation.py +66 -0
  72. src/agents/plugin_synthesis_integrator.py +66 -0
  73. src/agents/policy.py +302 -0
  74. src/agents/prompts/__init__.py +13 -0
  75. src/agents/prompts/paradigm.py +48 -0
  76. src/agents/qa.py +333 -0
  77. src/agents/solve_pipeline.py +219 -0
  78. src/agents/soul.py +219 -0
  79. src/agents/synthesis/core.py +53 -0
  80. src/analogy/__init__.py +18 -0
  81. src/analogy/core.py +294 -0
  82. src/analogy/data.py +160 -0
  83. src/analogy/engine.py +25 -0
  84. src/analogy/operations.py +302 -0
  85. src/analogy/structural.py +634 -0
  86. src/analogy/utils.py +109 -0
  87. src/api/__init__.py +47 -0
  88. src/api/agents_router.py +325 -0
  89. src/api/auth.py +334 -0
  90. src/api/cache.py +179 -0
  91. src/api/data/__init__.py +7 -0
  92. src/api/db_manager.py +460 -0
  93. src/api/dependencies.py +94 -0
  94. src/api/dev_mode.py +94 -0
  95. src/api/errors.py +92 -0
  96. src/api/health.py +105 -0
  97. src/api/lifespan.py +181 -0
  98. src/api/main.py +7 -0
  99. src/api/middleware/__init__.py +29 -0
  100. src/api/middleware/auth.py +104 -0
  101. src/api/middleware/cors.py +31 -0
  102. src/api/middleware/csrf.py +152 -0
  103. src/api/middleware/security.py +266 -0
  104. src/api/models.py +182 -0
  105. src/api/rate_limiter.py +263 -0
  106. src/api/routers/__init__.py +33 -0
  107. src/api/routers/auth.py +220 -0
  108. src/api/routers/bridge.py +93 -0
  109. src/api/routers/discoveries.py +116 -0
  110. src/api/routers/discovery_list.py +41 -0
  111. src/api/routers/graph.py +58 -0
  112. src/api/routers/health.py +134 -0
  113. src/api/routers/metrics.py +117 -0
  114. src/api/routers/patterns.py +195 -0
  115. src/api/routers/search.py +64 -0
  116. src/api/routers/theorems.py +130 -0
  117. src/api/routers/validation_single.py +32 -0
  118. src/api/routers/validations.py +146 -0
  119. src/api/routers/websocket.py +235 -0
  120. src/api/server.py +139 -0
  121. src/api/v7_schemas.py +475 -0
  122. src/api/v8_router.py +37 -0
  123. src/api/v8_routers/__init__.py +37 -0
  124. src/api/v8_routers/agenda.py +159 -0
  125. src/api/v8_routers/arxiv_v8.py +44 -0
  126. src/api/v8_routers/discovery/__init__.py +70 -0
  127. src/api/v8_routers/discovery/export.py +118 -0
  128. src/api/v8_routers/discovery/job_store_redis.py +169 -0
  129. src/api/v8_routers/discovery/jobs.py +252 -0
  130. src/api/v8_routers/discovery/pipeline.py +587 -0
  131. src/api/v8_routers/discovery/search.py +11 -0
  132. src/api/v8_routers/discovery_core.py +318 -0
  133. src/api/v8_routers/discovery_pipeline.py +351 -0
  134. src/api/v8_routers/discovery_utils.py +445 -0
  135. src/api/v8_routers/discovery_v8.py +215 -0
  136. src/api/v8_routers/exploration.py +229 -0
  137. src/api/v8_routers/knowledge_v8.py +161 -0
  138. src/api/v8_routers/news_v8.py +49 -0
  139. src/api/v8_routers/newton_v8.py +74 -0
  140. src/api/v8_routers/novelty_v8.py +476 -0
  141. src/api/v8_routers/scimatic_v8.py +73 -0
  142. src/api/v8_routers/social_v8.py +123 -0
  143. src/api/v8_routers/turbo_v8.py +245 -0
  144. src/api/v8_routers/verification_v8.py +326 -0
  145. src/api/v8_schemas.py +119 -0
  146. src/api/websocket.py +51 -0
  147. src/archetypes/__init__.py +29 -0
  148. src/archetypes/data.py +382 -0
  149. src/archetypes/engine.py +313 -0
  150. src/architecture/__init__.py +72 -0
  151. src/architecture/cqrs.py +167 -0
  152. src/architecture/event_sourcing.py +302 -0
  153. src/architecture/saga.py +246 -0
  154. src/auth/__init__.py +1 -0
  155. src/auth/supabase_anon.py +392 -0
  156. src/auth/telegram_wallet.py +350 -0
  157. src/auth/web3.py +358 -0
  158. src/bayesian/__init__.py +78 -0
  159. src/bayesian/bma.py +353 -0
  160. src/bayesian/core.py +279 -0
  161. src/bayesian/dempster_shafer.py +168 -0
  162. src/bayesian/dst.py +190 -0
  163. src/bayesian/fuzzy.py +210 -0
  164. src/bayesian/mcmc.py +420 -0
  165. src/bayesian/models.py +57 -0
  166. src/bayesian/optimization.py +229 -0
  167. src/bayesian/router.py +182 -0
  168. src/benchmarks/__init__.py +56 -0
  169. src/benchmarks/falsification_benchmark.py +393 -0
  170. src/benchmarks/isomorphism_benchmark.py +545 -0
  171. src/benchmarks/novelty_benchmark.py +544 -0
  172. src/benchmarks/triz_benchmark.py +482 -0
  173. src/bibliography/__init__.py +1 -0
  174. src/bibliography/manager.py +367 -0
  175. src/c4/__init__.py +6 -0
  176. src/c4/alert_taxonomy.py +57 -0
  177. src/c4/cognitive_load.py +114 -0
  178. src/c4/cognitive_router.py +160 -0
  179. src/c4/constraint_solver.py +253 -0
  180. src/c4/core.py +42 -0
  181. src/c4/core_operators.py +57 -0
  182. src/c4/engine.py +285 -0
  183. src/c4/extended_operators.py +44 -0
  184. src/c4/formal_citations.py +102 -0
  185. src/c4/gated_pipeline.py +69 -0
  186. src/c4/history_graph.py +76 -0
  187. src/c4/hypothesis_sandbox.py +59 -0
  188. src/c4/injection_hook.py +84 -0
  189. src/c4/invariant_engine.py +365 -0
  190. src/c4/layer_stream.py +89 -0
  191. src/c4/metrics.py +60 -0
  192. src/c4/navigation.py +213 -0
  193. src/c4/neural_classifier/__init__.py +33 -0
  194. src/c4/neural_classifier/architectures/__init__.py +1 -0
  195. src/c4/neural_classifier/architectures/c4_router.py +488 -0
  196. src/c4/neural_classifier/c4_types.py +136 -0
  197. src/c4/neural_classifier/heuristic_classifier.py +60 -0
  198. src/c4/neural_classifier/llm_classifier.py +465 -0
  199. src/c4/neural_classifier/neural_fingerprint.py +351 -0
  200. src/c4/neural_classifier/types.py +19 -0
  201. src/c4/observer.py +142 -0
  202. src/c4/path_manifest.py +90 -0
  203. src/c4/result.py +42 -0
  204. src/c4/routing.py +443 -0
  205. src/c4/scientist_paths.py +369 -0
  206. src/c4/state.py +569 -0
  207. src/c4/state_journal.py +66 -0
  208. src/c4/stratified_blocks.py +67 -0
  209. src/c4/structured_input.py +62 -0
  210. src/c4/transformer.py +343 -0
  211. src/c4/types.py +42 -0
  212. src/c4_analysis/__init__.py +10 -0
  213. src/c4_analysis/abstraction_ladder.py +152 -0
  214. src/c4_analysis/extended_engines.py +413 -0
  215. src/c4_analysis/llm_classifier.py +102 -0
  216. src/c4_analysis/multi_prompt_router.py +143 -0
  217. src/c4_analysis/system_analyzer.py +296 -0
  218. src/c4_analysis/system_synthesizer.py +237 -0
  219. src/c4_analysis/transfer_pipeline.py +711 -0
  220. src/c4_analysis/unified_entry.py +75 -0
  221. src/causal/__init__.py +22 -0
  222. src/causal/counterfactual.py +265 -0
  223. src/causal/counterfactual_derivation.py +132 -0
  224. src/causal/discovery.py +437 -0
  225. src/causal/discovery_engine.py +185 -0
  226. src/causal/do_calculus.py +325 -0
  227. src/causal/estimation_engine.py +208 -0
  228. src/causal/gp_scm.py +193 -0
  229. src/causal/scm.py +375 -0
  230. src/cli/__init__.py +15 -0
  231. src/cli/beep.py +16 -0
  232. src/cli/blast_app.py +1657 -0
  233. src/cli/blast_core.py +829 -0
  234. src/cli/config_init.py +229 -0
  235. src/cli/core.py +82 -0
  236. src/cli/cube_mascot.py +345 -0
  237. src/cli/display.py +34 -0
  238. src/cli/header.py +122 -0
  239. src/cli/layout_manager.py +182 -0
  240. src/cli/mode_router.py +59 -0
  241. src/cli/package_manager.py +266 -0
  242. src/cli/timeline.py +101 -0
  243. src/cli/tui_launcher.py +129 -0
  244. src/cli/typer_analogy.py +47 -0
  245. src/cli/typer_app.py +297 -0
  246. src/cli/typer_c4.py +107 -0
  247. src/cli/typer_core.py +216 -0
  248. src/cli/typer_graph.py +54 -0
  249. src/cli/typer_research.py +129 -0
  250. src/cli/typer_system.py +71 -0
  251. src/cli/typer_triz.py +91 -0
  252. src/cli/typer_validate.py +43 -0
  253. src/codegen/__init__.py +1 -0
  254. src/codegen/mcp_tool.py +533 -0
  255. src/collaboration/__init__.py +0 -0
  256. src/compat.py +5 -0
  257. src/compliance/__init__.py +1 -0
  258. src/compliance/license_checker.py +32 -0
  259. src/compute/__init__.py +18 -0
  260. src/compute/gpu_dashboard.py +217 -0
  261. src/compute/gpu_providers.py +91 -0
  262. src/compute/vastai_runner.py +50 -0
  263. src/conceptual_blending/__init__.py +3 -0
  264. src/conceptual_blending/blender.py +76 -0
  265. src/conceptual_blending/examples.py +76 -0
  266. src/conceptual_blending/router.py +131 -0
  267. src/config/__init__.py +39 -0
  268. src/config/db_config.py +129 -0
  269. src/config/paths.py +247 -0
  270. src/config/variants/__init__.py +53 -0
  271. src/config/variants/detector.py +29 -0
  272. src/contracts/__init__.py +4 -0
  273. src/contracts/c4_types.py +65 -0
  274. src/contracts/llm_types.py +39 -0
  275. src/contracts/pipeline_config.py +167 -0
  276. src/contracts/pipeline_types.py +70 -0
  277. src/contracts/verification_types.py +31 -0
  278. src/contradiction_miner/__init__.py +16 -0
  279. src/contradiction_miner/detector.py +144 -0
  280. src/contradiction_miner/extractor.py +97 -0
  281. src/contradiction_miner/router.py +118 -0
  282. src/core/__init__.py +19 -0
  283. src/core/c4_state.py +28 -0
  284. src/core/cdi_engine.py +331 -0
  285. src/core/complexity_adapter.py +152 -0
  286. src/core/complexity_cache.py +268 -0
  287. src/core/disclosure_filter.py +168 -0
  288. src/core/domains.py +51 -0
  289. src/core/flywheel.py +123 -0
  290. src/core/logging.py +308 -0
  291. src/core/manifest.py +66 -0
  292. src/core/operators.py +324 -0
  293. src/core/profile_manager.py +99 -0
  294. src/core/user_profile.py +83 -0
  295. src/dashboard/__init__.py +18 -0
  296. src/dashboard/metrics.py +418 -0
  297. src/data/__init__.py +7 -0
  298. src/data/connection_pool.py +294 -0
  299. src/data/database.py +453 -0
  300. src/data/database_pg.py +234 -0
  301. src/data/ingestion/__init__.py +5 -0
  302. src/data/ingestion/base.py +167 -0
  303. src/data/orchestrator.py +805 -0
  304. src/data/orm.py +102 -0
  305. src/decisions/__init__.py +14 -0
  306. src/decisions/ahp.py +66 -0
  307. src/decisions/router.py +107 -0
  308. src/decisions/topsis.py +72 -0
  309. src/design/__init__.py +75 -0
  310. src/design/cli_output/__init__.py +31 -0
  311. src/design/cli_output/_displays.py +195 -0
  312. src/design/cli_output/_panels.py +115 -0
  313. src/design/cli_output/_tables.py +101 -0
  314. src/design/cli_output/_widgets.py +107 -0
  315. src/design/cli_output.py +609 -0
  316. src/design/tokens.py +350 -0
  317. src/di/__init__.py +4 -0
  318. src/di/container.py +41 -0
  319. src/discovery/__init__.py +120 -0
  320. src/discovery/abduction.py +519 -0
  321. src/discovery/already_shifted.py +452 -0
  322. src/discovery/autoscanner.py +259 -0
  323. src/discovery/chainer.py +258 -0
  324. src/discovery/closed_loop/__init__.py +6 -0
  325. src/discovery/closed_loop/bayesian_tracker.py +92 -0
  326. src/discovery/closed_loop/convergence.py +46 -0
  327. src/discovery/closed_loop/ensemble_runner.py +47 -0
  328. src/discovery/closed_loop/experiment_designer.py +74 -0
  329. src/discovery/closed_loop/orchestrator.py +108 -0
  330. src/discovery/closed_loop/refiner.py +81 -0
  331. src/discovery/contradiction.py +452 -0
  332. src/discovery/contradiction_engine.py +235 -0
  333. src/discovery/derivation_chain.py +96 -0
  334. src/discovery/falsification.py +612 -0
  335. src/discovery/falsifier.py +879 -0
  336. src/discovery/gap_analyzer.py +173 -0
  337. src/discovery/gap_analyzer_base.py +75 -0
  338. src/discovery/gap_miner.py +647 -0
  339. src/discovery/kuhn_criteria.py +251 -0
  340. src/discovery/novelty_validator.py +406 -0
  341. src/discovery/paradigm_shift.py +353 -0
  342. src/discovery/parsimony.py +88 -0
  343. src/discovery/pipeline_logic.py +1516 -0
  344. src/discovery/ranking/__init__.py +8 -0
  345. src/discovery/ranking/cost_model.py +52 -0
  346. src/discovery/ranking/eig_estimator.py +99 -0
  347. src/discovery/ranking/mcdm_ranker.py +123 -0
  348. src/discovery/ranking/orchestrator.py +78 -0
  349. src/discovery/ranking/prior_scorer.py +127 -0
  350. src/discovery/recursive_validation.py +78 -0
  351. src/discovery/search.py +33 -0
  352. src/discovery/strong_inference.py +581 -0
  353. src/discovery/temporal_kg.py +350 -0
  354. src/discovery/web_enhanced.py +96 -0
  355. src/effects/__init__.py +18 -0
  356. src/effects/database.py +172 -0
  357. src/effects/effects_db.py +167 -0
  358. src/enhanced_cdi.py +94 -0
  359. src/experiment_design/__init__.py +85 -0
  360. src/experiment_design/doe.py +279 -0
  361. src/experiment_design/power.py +273 -0
  362. src/experiment_design/reproducibility.py +296 -0
  363. src/experiment_design/router.py +188 -0
  364. src/explainability/__init__.py +19 -0
  365. src/explainability/core.py +375 -0
  366. src/explainability/engine.py +26 -0
  367. src/explainability/renderers.py +58 -0
  368. src/exploration/__init__.py +7 -0
  369. src/exploration/anomaly_detector.py +90 -0
  370. src/exploration/formal_extender.py +140 -0
  371. src/exploration/question_generator.py +96 -0
  372. src/export/__init__.py +18 -0
  373. src/export/manager.py +279 -0
  374. src/export/presentation.py +222 -0
  375. src/extractors/__init__.py +9 -0
  376. src/extractors/contradiction.py +386 -0
  377. src/falsification/__init__.py +16 -0
  378. src/falsification/lakatos.py +45 -0
  379. src/falsification/popper.py +50 -0
  380. src/falsification/router.py +117 -0
  381. src/game_theory/__init__.py +13 -0
  382. src/game_theory/nash.py +54 -0
  383. src/game_theory/router.py +77 -0
  384. src/game_theory/shapley.py +28 -0
  385. src/graph/__init__.py +58 -0
  386. src/graph/core.py +343 -0
  387. src/graph/graph_view.py +18 -0
  388. src/graph/io.py +50 -0
  389. src/graph/knowledge_graph.py +261 -0
  390. src/graph/operations/__init__.py +33 -0
  391. src/graph/operations/core.py +184 -0
  392. src/graph/operations/mutations.py +209 -0
  393. src/graph/operations/utils.py +90 -0
  394. src/graph/operations.py +38 -0
  395. src/graph/queries.py +217 -0
  396. src/graph/seed_data.py +127 -0
  397. src/graph/view/__init__.py +1 -0
  398. src/graph/view/core.py +377 -0
  399. src/graph/view/renderers.py +193 -0
  400. src/infrastructure/__init__.py +19 -0
  401. src/infrastructure/cache/__init__.py +23 -0
  402. src/infrastructure/cache/tiered.py +339 -0
  403. src/infrastructure/events.py +112 -0
  404. src/infrastructure/logging/__init__.py +21 -0
  405. src/infrastructure/logging/config.py +110 -0
  406. src/infrastructure/logging/middleware.py +71 -0
  407. src/integrations/__init__.py +40 -0
  408. src/integrations/balance_checker.py +96 -0
  409. src/integrations/brev_client.py +161 -0
  410. src/integrations/eigent.py +170 -0
  411. src/integrations/exa_client.py +70 -0
  412. src/integrations/langchain.py +12 -0
  413. src/integrations/liquid_ai.py +71 -0
  414. src/integrations/n8n.py +39 -0
  415. src/integrations/nvidia.py +86 -0
  416. src/integrations/nvidia_cloud_client.py +57 -0
  417. src/integrations/openfang.py +148 -0
  418. src/integrations/scientific_bridges.py +118 -0
  419. src/integrations/tavily_budget.py +95 -0
  420. src/integrations/tavily_client.py +66 -0
  421. src/integrations/yandex.py +95 -0
  422. src/intel/__init__.py +4 -0
  423. src/intel/live_feed.py +396 -0
  424. src/knowledge/__init__.py +52 -0
  425. src/knowledge/arxiv_client.py +325 -0
  426. src/knowledge/arxivgg_client.py +138 -0
  427. src/knowledge/base_client.py +300 -0
  428. src/knowledge/cache.py +57 -0
  429. src/knowledge/chroma_store.py +237 -0
  430. src/knowledge/cinii_client.py +238 -0
  431. src/knowledge/citation_chaser.py +488 -0
  432. src/knowledge/citation_verifier.py +199 -0
  433. src/knowledge/config.py +620 -0
  434. src/knowledge/core_client.py +114 -0
  435. src/knowledge/crossref_client.py +312 -0
  436. src/knowledge/dataset_clients.py +281 -0
  437. src/knowledge/github_client.py +210 -0
  438. src/knowledge/local_files.py +132 -0
  439. src/knowledge/mega_db.py +274 -0
  440. src/knowledge/multi_source.py +16 -0
  441. src/knowledge/novelty_scorer.py +85 -0
  442. src/knowledge/openalex_client.py +124 -0
  443. src/knowledge/orchestrator.py +691 -0
  444. src/knowledge/orcid_client.py +479 -0
  445. src/knowledge/preprint_clients.py +207 -0
  446. src/knowledge/pubmed_client.py +382 -0
  447. src/knowledge/rsci_client.py +224 -0
  448. src/knowledge/scholarapi_client.py +62 -0
  449. src/knowledge/scimatic_client.py +61 -0
  450. src/knowledge/semantic_client.py +117 -0
  451. src/knowledge/semantic_scholar.py +377 -0
  452. src/knowledge/sources/__init__.py +59 -0
  453. src/knowledge/sources/aflow.py +79 -0
  454. src/knowledge/sources/allen_brain.py +76 -0
  455. src/knowledge/sources/arxiv.py +92 -0
  456. src/knowledge/sources/base.py +20 -0
  457. src/knowledge/sources/base_p6.py +178 -0
  458. src/knowledge/sources/base_p6_adapter.py +86 -0
  459. src/knowledge/sources/base_search.py +79 -0
  460. src/knowledge/sources/bibsonomy.py +189 -0
  461. src/knowledge/sources/brave.py +52 -0
  462. src/knowledge/sources/cern_opendata.py +48 -0
  463. src/knowledge/sources/chembl.py +49 -0
  464. src/knowledge/sources/clinicaltrials.py +63 -0
  465. src/knowledge/sources/conceptnet.py +79 -0
  466. src/knowledge/sources/core.py +67 -0
  467. src/knowledge/sources/crossref.py +60 -0
  468. src/knowledge/sources/cyberleninka.py +61 -0
  469. src/knowledge/sources/datacite.py +51 -0
  470. src/knowledge/sources/dblp.py +55 -0
  471. src/knowledge/sources/doaj.py +62 -0
  472. src/knowledge/sources/drugbank.py +93 -0
  473. src/knowledge/sources/europe_pmc.py +47 -0
  474. src/knowledge/sources/exa.py +33 -0
  475. src/knowledge/sources/extra_adapters.py +215 -0
  476. src/knowledge/sources/figshare.py +51 -0
  477. src/knowledge/sources/gbif.py +72 -0
  478. src/knowledge/sources/gtex.py +85 -0
  479. src/knowledge/sources/harvard_dataverse.py +84 -0
  480. src/knowledge/sources/huggingface_datasets.py +57 -0
  481. src/knowledge/sources/inspire_hep.py +59 -0
  482. src/knowledge/sources/kaggle.py +90 -0
  483. src/knowledge/sources/lens_org.py +50 -0
  484. src/knowledge/sources/materials_project.py +57 -0
  485. src/knowledge/sources/mathnet_ru.py +57 -0
  486. src/knowledge/sources/nasa_earthdata.py +85 -0
  487. src/knowledge/sources/ncbi_eutils.py +76 -0
  488. src/knowledge/sources/noaa.py +81 -0
  489. src/knowledge/sources/oa_mg.py +47 -0
  490. src/knowledge/sources/oeis.py +49 -0
  491. src/knowledge/sources/openalex.py +153 -0
  492. src/knowledge/sources/openfda.py +82 -0
  493. src/knowledge/sources/openreview.py +61 -0
  494. src/knowledge/sources/orcid.py +114 -0
  495. src/knowledge/sources/p6_adapters.py +425 -0
  496. src/knowledge/sources/pubchem.py +47 -0
  497. src/knowledge/sources/pubmed.py +107 -0
  498. src/knowledge/sources/re3data.py +76 -0
  499. src/knowledge/sources/semantic_scholar.py +53 -0
  500. src/knowledge/sources/string_db.py +83 -0
  501. src/knowledge/sources/tavily.py +33 -0
  502. src/knowledge/sources/uci_ml.py +69 -0
  503. src/knowledge/sources/uniprot.py +97 -0
  504. src/knowledge/sources/unpaywall.py +50 -0
  505. src/knowledge/sources/usgs.py +63 -0
  506. src/knowledge/sources/uspto_patentsview.py +53 -0
  507. src/knowledge/sources/wikidata.py +107 -0
  508. src/knowledge/sources/wolfram.py +62 -0
  509. src/knowledge/sources/zenodo.py +62 -0
  510. src/knowledge/zettelkasten.py +174 -0
  511. src/litintel/__init__.py +43 -0
  512. src/llm/__init__.py +55 -0
  513. src/llm/async_client.py +429 -0
  514. src/llm/cache.py +349 -0
  515. src/llm/client.py +188 -0
  516. src/llm/complexity.py +45 -0
  517. src/llm/config.py +117 -0
  518. src/llm/cost_tracker.py +201 -0
  519. src/llm/council.py +285 -0
  520. src/llm/depth_router.py +83 -0
  521. src/llm/embeddings.py +403 -0
  522. src/llm/fallback.py +6 -0
  523. src/llm/falsifiability.py +253 -0
  524. src/llm/gateway.py +225 -0
  525. src/llm/guarded_call.py +269 -0
  526. src/llm/local/__init__.py +11 -0
  527. src/llm/local/client.py +322 -0
  528. src/llm/local/core.py +29 -0
  529. src/llm/local_client.py +14 -0
  530. src/llm/local_discovery.py +176 -0
  531. src/llm/local_fallback.py +42 -0
  532. src/llm/model_assignment.py +259 -0
  533. src/llm/model_catalog.py +379 -0
  534. src/llm/multi_provider.py +83 -0
  535. src/llm/providers/__init__.py +25 -0
  536. src/llm/providers/base.py +204 -0
  537. src/llm/providers/lmstudio_cli.py +95 -0
  538. src/llm/providers/mlx_provider.py +172 -0
  539. src/llm/providers/ollama.py +32 -0
  540. src/llm/providers/openrouter.py +41 -0
  541. src/llm/providers/others.py +135 -0
  542. src/llm/providers/unified.py +213 -0
  543. src/llm/reasoner_client.py +281 -0
  544. src/llm/retry_pkg/__init__.py +28 -0
  545. src/llm/retry_pkg/core.py +89 -0
  546. src/llm/retry_pkg/policies.py +310 -0
  547. src/llm/router.py +368 -0
  548. src/llm/sync_provider_chain.py +227 -0
  549. src/llm/synthesizer.py +190 -0
  550. src/llm/types.py +17 -0
  551. src/main.py +821 -0
  552. src/main_refactored.py +821 -0
  553. src/mcp_server/__init__.py +4 -0
  554. src/mcp_server/fallback_protocol.py +237 -0
  555. src/mcp_server/fastmcp_bridge.py +133 -0
  556. src/mcp_server/server.py +1069 -0
  557. src/mcp_server/tool_schemas.py +84 -0
  558. src/memory/__init__.py +10 -0
  559. src/memory/bank.py +43 -0
  560. src/memory/core.py +399 -0
  561. src/memory/isomorphism_seed.py +229 -0
  562. src/memory/llm_isomorphisms.py +320 -0
  563. src/memory/operations.py +162 -0
  564. src/memory/skill.py +467 -0
  565. src/meta_layer/__init__.py +20 -0
  566. src/meta_layer/collaboration.py +84 -0
  567. src/meta_layer/ethics.py +95 -0
  568. src/meta_layer/provenance.py +98 -0
  569. src/meta_layer/router.py +233 -0
  570. src/metamodels/__init__.py +40 -0
  571. src/metamodels/compass.py +211 -0
  572. src/metamodels/hypercube.py +28 -0
  573. src/metamodels/impact.py +690 -0
  574. src/metamodels/matrix_dream.py +251 -0
  575. src/metamodels/mp/__init__.py +7 -0
  576. src/metamodels/mp/core.py +76 -0
  577. src/metamodels/mp/data.py +249 -0
  578. src/metamodels/mp/library.py +14 -0
  579. src/metamodels/mp/patterns.py +139 -0
  580. src/metamodels/mp/profiles.py +314 -0
  581. src/metamodels/qzrf/__init__.py +1 -0
  582. src/metamodels/qzrf/operators.py +340 -0
  583. src/metamodels/qzrf/projections.py +85 -0
  584. src/metamodels/tote.py +212 -0
  585. src/metaprograms/__init__.py +74 -0
  586. src/metaprograms/attractors.py +207 -0
  587. src/metaprograms/core.py +673 -0
  588. src/metaprograms/dynamics.py +153 -0
  589. src/metaprograms/profiler.py +320 -0
  590. src/news/__init__.py +7 -0
  591. src/news/aggregator.py +222 -0
  592. src/news/storage.py +115 -0
  593. src/novelty/__init__.py +1 -0
  594. src/novelty/validator.py +78 -0
  595. src/operators/__init__.py +0 -0
  596. src/operators/autoresearch.py +961 -0
  597. src/operators/fra.py +561 -0
  598. src/operators/matrix_dream.py +1120 -0
  599. src/operators/qzrf.py +600 -0
  600. src/operators/uta.py +139 -0
  601. src/operators/uta_bridge.py +84 -0
  602. src/paradigm/__init__.py +20 -0
  603. src/paradigm/anomaly.py +82 -0
  604. src/paradigm/detector.py +161 -0
  605. src/paradigm/models.py +50 -0
  606. src/paradigm/router.py +95 -0
  607. src/paradigm/temporal.py +129 -0
  608. src/patents/__init__.py +18 -0
  609. src/patents/client.py +11 -0
  610. src/patents/uspto_client.py +117 -0
  611. src/patterns/__init__.py +51 -0
  612. src/patterns/core.py +180 -0
  613. src/patterns/format/__init__.py +1 -0
  614. src/patterns/format/core.py +314 -0
  615. src/patterns/format/utils.py +293 -0
  616. src/patterns/formatter.py +14 -0
  617. src/patterns/library/__init__.py +695 -0
  618. src/patterns/library/acoustic_waves.py +493 -0
  619. src/patterns/library/adaptive_filter.py +468 -0
  620. src/patterns/library/age_structured.py +465 -0
  621. src/patterns/library/agent_based.py +742 -0
  622. src/patterns/library/air_quality.py +688 -0
  623. src/patterns/library/base.py +232 -0
  624. src/patterns/library/biogeochemistry.py +646 -0
  625. src/patterns/library/bootstrap.py +303 -0
  626. src/patterns/library/cellular_automata.py +345 -0
  627. src/patterns/library/cfd.py +451 -0
  628. src/patterns/library/circuit_simulation/__init__.py +24 -0
  629. src/patterns/library/circuit_simulation/config.py +84 -0
  630. src/patterns/library/circuit_simulation/core.py +447 -0
  631. src/patterns/library/circuit_simulation/pattern.py +280 -0
  632. src/patterns/library/climate_gcm.py +512 -0
  633. src/patterns/library/cloud_microphysics.py +645 -0
  634. src/patterns/library/collaborative_filtering.py +525 -0
  635. src/patterns/library/composite_mechanics.py +646 -0
  636. src/patterns/library/conflict.py +496 -0
  637. src/patterns/library/connectome/__init__.py +16 -0
  638. src/patterns/library/connectome/config.py +81 -0
  639. src/patterns/library/connectome/core.py +346 -0
  640. src/patterns/library/connectome/pattern.py +353 -0
  641. src/patterns/library/continuum_mechanics.py +572 -0
  642. src/patterns/library/credit_risk.py +447 -0
  643. src/patterns/library/crystal_growth.py +618 -0
  644. src/patterns/library/cultural_diffusion.py +428 -0
  645. src/patterns/library/dft.py +544 -0
  646. src/patterns/library/discrete_event.py +406 -0
  647. src/patterns/library/double_pendulum.py +364 -0
  648. src/patterns/library/dsge.py +356 -0
  649. src/patterns/library/economic_growth.py +557 -0
  650. src/patterns/library/elasticity_3d.py +650 -0
  651. src/patterns/library/enzyme_kinetics/__init__.py +16 -0
  652. src/patterns/library/enzyme_kinetics/config.py +82 -0
  653. src/patterns/library/enzyme_kinetics/core.py +383 -0
  654. src/patterns/library/enzyme_kinetics/pattern.py +331 -0
  655. src/patterns/library/epidemic_seir.py +506 -0
  656. src/patterns/library/epidemic_sir.py +315 -0
  657. src/patterns/library/evolutionary.py +497 -0
  658. src/patterns/library/fem.py +414 -0
  659. src/patterns/library/fisheries.py +634 -0
  660. src/patterns/library/flocking.py +455 -0
  661. src/patterns/library/forest_gap.py +633 -0
  662. src/patterns/library/fractal_julia.py +317 -0
  663. src/patterns/library/fractal_mandelbrot.py +311 -0
  664. src/patterns/library/game_theory.py +248 -0
  665. src/patterns/library/garch.py +223 -0
  666. src/patterns/library/gene_regulatory.py +681 -0
  667. src/patterns/library/geomagnetic.py +695 -0
  668. src/patterns/library/gravity_trade.py +515 -0
  669. src/patterns/library/groundwater.py +621 -0
  670. src/patterns/library/herding.py +598 -0
  671. src/patterns/library/heterogeneous_agents.py +505 -0
  672. src/patterns/library/hodgkin_huxley.py +532 -0
  673. src/patterns/library/innovation_diffusion.py +485 -0
  674. src/patterns/library/input_output.py +242 -0
  675. src/patterns/library/inverse_kinematics/__init__.py +44 -0
  676. src/patterns/library/inverse_kinematics/config.py +94 -0
  677. src/patterns/library/inverse_kinematics/core.py +517 -0
  678. src/patterns/library/inverse_kinematics/tests.py +235 -0
  679. src/patterns/library/ising_model.py +523 -0
  680. src/patterns/library/kalman_filter/__init__.py +449 -0
  681. src/patterns/library/kalman_filter/config.py +106 -0
  682. src/patterns/library/kalman_filter/core.py +306 -0
  683. src/patterns/library/kalman_filter/utils.py +145 -0
  684. src/patterns/library/land_surface.py +605 -0
  685. src/patterns/library/land_use.py +418 -0
  686. src/patterns/library/language_evolution.py +422 -0
  687. src/patterns/library/lotka_volterra.py +419 -0
  688. src/patterns/library/mantle_convection.py +671 -0
  689. src/patterns/library/market_microstructure.py +686 -0
  690. src/patterns/library/markov_chain.py +305 -0
  691. src/patterns/library/maxwell_fdtd.py +536 -0
  692. src/patterns/library/metapopulation.py +701 -0
  693. src/patterns/library/migration.py +405 -0
  694. src/patterns/library/model_predictive/__init__.py +24 -0
  695. src/patterns/library/model_predictive/config.py +119 -0
  696. src/patterns/library/model_predictive/core.py +343 -0
  697. src/patterns/library/model_predictive/solvers.py +161 -0
  698. src/patterns/library/model_predictive/tests.py +216 -0
  699. src/patterns/library/model_predictive/types.py +22 -0
  700. src/patterns/library/molecular_dynamics.py +503 -0
  701. src/patterns/library/monte_carlo.py +433 -0
  702. src/patterns/library/monte_carlo_pi.py +293 -0
  703. src/patterns/library/n_body.py +473 -0
  704. src/patterns/library/neural_mass.py +663 -0
  705. src/patterns/library/neural_network.py +370 -0
  706. src/patterns/library/ocean_circulation.py +658 -0
  707. src/patterns/library/open_quantum.py +661 -0
  708. src/patterns/library/opinion_dynamics.py +437 -0
  709. src/patterns/library/optimization.py +397 -0
  710. src/patterns/library/option_pricing.py +521 -0
  711. src/patterns/library/overlapping_generations.py +400 -0
  712. src/patterns/library/path_planning/__init__.py +19 -0
  713. src/patterns/library/path_planning/config.py +109 -0
  714. src/patterns/library/path_planning/core.py +361 -0
  715. src/patterns/library/path_planning/pattern.py +135 -0
  716. src/patterns/library/path_planning.py +343 -0
  717. src/patterns/library/pedestrian.py +466 -0
  718. src/patterns/library/percolation.py +540 -0
  719. src/patterns/library/pharmacokinetics.py +434 -0
  720. src/patterns/library/phase_field.py +384 -0
  721. src/patterns/library/pid_tuning/__init__.py +24 -0
  722. src/patterns/library/pid_tuning/config.py +63 -0
  723. src/patterns/library/pid_tuning/core.py +493 -0
  724. src/patterns/library/pid_tuning/utils.py +93 -0
  725. src/patterns/library/plasma_pic/__init__.py +18 -0
  726. src/patterns/library/plasma_pic/config.py +69 -0
  727. src/patterns/library/plasma_pic/core.py +270 -0
  728. src/patterns/library/plasma_pic/pattern.py +477 -0
  729. src/patterns/library/poisson_solver.py +648 -0
  730. src/patterns/library/population_genetics.py +332 -0
  731. src/patterns/library/portfolio_optimization.py +553 -0
  732. src/patterns/library/projectile_motion.py +330 -0
  733. src/patterns/library/prospect_theory.py +531 -0
  734. src/patterns/library/protein_folding.py +743 -0
  735. src/patterns/library/qft_lattice.py +578 -0
  736. src/patterns/library/quantum.py +644 -0
  737. src/patterns/library/quantum_harmonic_oscillator.py +291 -0
  738. src/patterns/library/queueing_networks/__init__.py +25 -0
  739. src/patterns/library/queueing_networks/config.py +80 -0
  740. src/patterns/library/queueing_networks/core.py +471 -0
  741. src/patterns/library/queueing_networks/pattern.py +159 -0
  742. src/patterns/library/reaction_diffusion.py +407 -0
  743. src/patterns/library/rigid_body.py +444 -0
  744. src/patterns/library/rumor_spreading.py +504 -0
  745. src/patterns/library/sea_ice.py +672 -0
  746. src/patterns/library/search_matching.py +449 -0
  747. src/patterns/library/seismic_waves.py +746 -0
  748. src/patterns/library/signal_transduction/__init__.py +20 -0
  749. src/patterns/library/signal_transduction/config.py +90 -0
  750. src/patterns/library/signal_transduction/models.py +431 -0
  751. src/patterns/library/signal_transduction/pattern.py +358 -0
  752. src/patterns/library/slam/__init__.py +18 -0
  753. src/patterns/library/slam/config.py +79 -0
  754. src/patterns/library/slam/core.py +418 -0
  755. src/patterns/library/slam/pattern.py +122 -0
  756. src/patterns/library/slam.py +276 -0
  757. src/patterns/library/social_network.py +298 -0
  758. src/patterns/library/spatial_ecology.py +501 -0
  759. src/patterns/library/spectral_estimation.py +602 -0
  760. src/patterns/library/spring_mass.py +327 -0
  761. src/patterns/library/state_space.py +730 -0
  762. src/patterns/library/supply_chain.py +267 -0
  763. src/patterns/library/surface_water.py +579 -0
  764. src/patterns/library/synaptic_plasticity.py +683 -0
  765. src/patterns/library/system_dynamics/__init__.py +21 -0
  766. src/patterns/library/system_dynamics/analysis.py +209 -0
  767. src/patterns/library/system_dynamics/core.py +320 -0
  768. src/patterns/library/system_dynamics/models.py +168 -0
  769. src/patterns/library/system_dynamics/results.py +119 -0
  770. src/patterns/library/system_dynamics/solver.py +68 -0
  771. src/patterns/library/system_dynamics/types.py +66 -0
  772. src/patterns/library/thermal.py +446 -0
  773. src/patterns/library/traffic_flow.py +698 -0
  774. src/patterns/library/urban_growth.py +552 -0
  775. src/patterns/library/wave_equation.py +461 -0
  776. src/patterns/library/wave_optics.py +589 -0
  777. src/patterns/library/wavelet_analysis.py +634 -0
  778. src/patterns/library/wildfire.py +696 -0
  779. src/patterns/resource_estimator.py +271 -0
  780. src/patterns/runner.py +353 -0
  781. src/patterns/topic_router.py +133 -0
  782. src/pipeline/__init__.py +44 -0
  783. src/pipeline/ab_testing.py +174 -0
  784. src/pipeline/auto_fix.py +154 -0
  785. src/pipeline/base.py +172 -0
  786. src/pipeline/config.py +298 -0
  787. src/pipeline/coordinated_discovery.py +270 -0
  788. src/pipeline/discovery_memory.py +225 -0
  789. src/pipeline/discovery_phases/__init__.py +0 -0
  790. src/pipeline/discovery_phases/phase_1_cognitive.py +79 -0
  791. src/pipeline/discovery_phases/phase_2_knowledge.py +60 -0
  792. src/pipeline/discovery_phases/phase_3_analysis.py +248 -0
  793. src/pipeline/discovery_phases/phase_4_detection.py +96 -0
  794. src/pipeline/discovery_phases/phase_5_verification.py +93 -0
  795. src/pipeline/discovery_phases/phase_6_quality.py +228 -0
  796. src/pipeline/events.py +14 -0
  797. src/pipeline/final_verifier.py +106 -0
  798. src/pipeline/hil_phases/__init__.py +23 -0
  799. src/pipeline/hil_phases/phase_a_usp.py +174 -0
  800. src/pipeline/hil_phases/phase_b_knowledge.py +75 -0
  801. src/pipeline/hil_phases/phase_c_gaps.py +91 -0
  802. src/pipeline/hil_phases/phase_d_agents.py +101 -0
  803. src/pipeline/hil_phases/phase_e_simulation.py +231 -0
  804. src/pipeline/hil_phases/phase_f_dissertation.py +212 -0
  805. src/pipeline/hil_phases/phase_g_quality.py +116 -0
  806. src/pipeline/hil_pipeline.py +391 -0
  807. src/pipeline/iterative_quality.py +189 -0
  808. src/pipeline/meta_pipeline.py +205 -0
  809. src/pipeline/observer.py +62 -0
  810. src/pipeline/output_profiles.py +187 -0
  811. src/pipeline/plugin_stage_router.py +90 -0
  812. src/pipeline/progress.py +137 -0
  813. src/pipeline/provider_coordinator.py +286 -0
  814. src/pipeline/quality.py +536 -0
  815. src/pipeline/redundant_gates.py +738 -0
  816. src/pipeline/result.py +41 -0
  817. src/pipeline/self_correcting.py +135 -0
  818. src/pipeline/smart_scheduler.py +125 -0
  819. src/pipeline/steps/__init__.py +1 -0
  820. src/pipeline/steps/step_10_verify.py +30 -0
  821. src/pipeline/ucos_qzrf.py +353 -0
  822. src/plugins/__init__.py +1 -0
  823. src/plugins/_llm_base.py +38 -0
  824. src/plugins/analogical_reasoning.py +76 -0
  825. src/plugins/bayesian_update.py +71 -0
  826. src/plugins/constraint_relaxation.py +62 -0
  827. src/plugins/dag.py +167 -0
  828. src/plugins/delphi.py +51 -0
  829. src/plugins/design_thinking.py +43 -0
  830. src/plugins/dim_reduction.py +129 -0
  831. src/plugins/dist_analyzer.py +187 -0
  832. src/plugins/first_principles.py +82 -0
  833. src/plugins/five_whys.py +42 -0
  834. src/plugins/graph_metrics.py +162 -0
  835. src/plugins/info_theory.py +145 -0
  836. src/plugins/inversion.py +64 -0
  837. src/plugins/ishikawa.py +53 -0
  838. src/plugins/lateral_thinking.py +47 -0
  839. src/plugins/morphological.py +58 -0
  840. src/plugins/ooda.py +42 -0
  841. src/plugins/optimization.py +192 -0
  842. src/plugins/pareto.py +70 -0
  843. src/plugins/persistence.py +147 -0
  844. src/plugins/pre_mortem.py +72 -0
  845. src/plugins/red_team.py +78 -0
  846. src/plugins/scamper.py +45 -0
  847. src/plugins/second_order.py +77 -0
  848. src/plugins/signal_processing.py +169 -0
  849. src/plugins/six_hats.py +44 -0
  850. src/plugins/stat_tests.py +226 -0
  851. src/plugins/swot.py +38 -0
  852. src/plugins/timeseries.py +186 -0
  853. src/plugins/triz_bridge.py +78 -0
  854. src/plugins/unified_registry.py +765 -0
  855. src/projects/__init__.py +1 -0
  856. src/projects/manager.py +484 -0
  857. src/publishing/__init__.py +7 -0
  858. src/publishing/blueprint.py +33 -0
  859. src/publishing/dissertation.py +477 -0
  860. src/publishing/experiment_design.py +237 -0
  861. src/publishing/latex_compiler.py +100 -0
  862. src/publishing/submitter.py +154 -0
  863. src/py.typed +0 -0
  864. src/references/__init__.py +22 -0
  865. src/references/manager.py +201 -0
  866. src/repl/__init__.py +15 -0
  867. src/repl/commands.py +299 -0
  868. src/repl/core.py +201 -0
  869. src/repl/input_handler.py +210 -0
  870. src/repl.py +14 -0
  871. src/reproducibility/__init__.py +19 -0
  872. src/reproducibility/router.py +81 -0
  873. src/reproducibility/validator.py +120 -0
  874. src/robust_decisions/__init__.py +15 -0
  875. src/robust_decisions/prim.py +68 -0
  876. src/robust_decisions/router.py +158 -0
  877. src/robust_decisions/xlrm.py +77 -0
  878. src/search/__init__.py +18 -0
  879. src/search/semantic_scholar.py +323 -0
  880. src/security/__init__.py +23 -0
  881. src/security/audit_log.py +433 -0
  882. src/security/credential_guard.py +59 -0
  883. src/security/guardian.py +196 -0
  884. src/security/prompt_sanitizer.py +93 -0
  885. src/simulations/__init__.py +213 -0
  886. src/simulations/amuse_bridge.py +43 -0
  887. src/simulations/auto_engine.py +157 -0
  888. src/simulations/base_adapter.py +169 -0
  889. src/simulations/boolnet_bridge.py +132 -0
  890. src/simulations/brian2_bridge.py +56 -0
  891. src/simulations/cobra_bridge.py +54 -0
  892. src/simulations/config.py +170 -0
  893. src/simulations/copasi_bridge.py +46 -0
  894. src/simulations/diffeqpy_bridge.py +49 -0
  895. src/simulations/domain_selector.py +13 -0
  896. src/simulations/fenicsx_bridge.py +78 -0
  897. src/simulations/gromacs_bridge.py +39 -0
  898. src/simulations/jaxlab_bridge.py +54 -0
  899. src/simulations/jaxley_bridge.py +68 -0
  900. src/simulations/jaxmd_bridge.py +58 -0
  901. src/simulations/jaxsim_bridge.py +641 -0
  902. src/simulations/lammps_bridge.py +60 -0
  903. src/simulations/matlab_bridge.py +61 -0
  904. src/simulations/mdanalysis_bridge.py +54 -0
  905. src/simulations/mesa_bridge.py +98 -0
  906. src/simulations/mirrorfish_bridge.py +50 -0
  907. src/simulations/modelingtoolkit_bridge.py +52 -0
  908. src/simulations/mujoco_bridge.py +67 -0
  909. src/simulations/neuron_bridge.py +56 -0
  910. src/simulations/newton_bridge.py +645 -0
  911. src/simulations/newton_runner.py +68 -0
  912. src/simulations/nvidia_bridge.py +1093 -0
  913. src/simulations/openfoam_bridge.py +47 -0
  914. src/simulations/openmm_bridge.py +150 -0
  915. src/simulations/pattern_engine_map.py +520 -0
  916. src/simulations/psi4_bridge.py +51 -0
  917. src/simulations/pybullet_bridge.py +56 -0
  918. src/simulations/pyscf_bridge.py +49 -0
  919. src/simulations/quantum_espresso_bridge.py +37 -0
  920. src/simulations/rebound_bridge.py +56 -0
  921. src/simulations/runner_v2.py +573 -0
  922. src/simulations/schr_bridge.py +791 -0
  923. src/simulations/simpy_bridge.py +65 -0
  924. src/simulations/slim_bridge.py +81 -0
  925. src/simulations/taichi_bridge.py +72 -0
  926. src/simulations/tellurium_bridge.py +52 -0
  927. src/simulations/torchsim_bridge.py +556 -0
  928. src/simulations/vastai_delegate.py +306 -0
  929. src/simulations/vina_bridge.py +83 -0
  930. src/simulations/virtual_bio.py +203 -0
  931. src/simulations/wrf_bridge.py +47 -0
  932. src/simulations/xarray_bridge.py +53 -0
  933. src/social/__init__.py +8 -0
  934. src/social/ai_archive_client.py +64 -0
  935. src/social/arxiv_client.py +69 -0
  936. src/social/auto_poster.py +474 -0
  937. src/social/discord_webhook.py +51 -0
  938. src/social/grok_client.py +85 -0
  939. src/social/health_checker.py +121 -0
  940. src/social/i18n_templates.py +95 -0
  941. src/social/keyring.py +126 -0
  942. src/social/mastodon_client.py +120 -0
  943. src/social/orcid_client.py +72 -0
  944. src/social/profile_manager.py +84 -0
  945. src/social/publisher.py +128 -0
  946. src/social/reddit_client.py +68 -0
  947. src/social/researchgate_client.py +170 -0
  948. src/social/scimatic_export.py +59 -0
  949. src/social/slack_webhook.py +51 -0
  950. src/social/social_bridge.py +47 -0
  951. src/social/social_history.py +73 -0
  952. src/social/telegram_bot.py +201 -0
  953. src/social/twitter_client.py +120 -0
  954. src/social/zenodo_client.py +162 -0
  955. src/solver/__init__.py +18 -0
  956. src/solver/core.py +187 -0
  957. src/solver/one_shot.py +200 -0
  958. src/solver/strategies.py +320 -0
  959. src/system_dynamics/__init__.py +81 -0
  960. src/system_dynamics/archetypes.py +424 -0
  961. src/system_dynamics/causal_loop.py +247 -0
  962. src/system_dynamics/dsl.py +142 -0
  963. src/system_dynamics/dsl_archetypes.py +59 -0
  964. src/system_dynamics/models.py +102 -0
  965. src/system_dynamics/router.py +226 -0
  966. src/system_dynamics/simulator.py +174 -0
  967. src/system_dynamics/stock_flow.py +355 -0
  968. src/system_dynamics/visualizer.py +123 -0
  969. src/terminal_/__init__.py +19 -0
  970. src/terminal_/cyberpunk_theme.py +241 -0
  971. src/terminal_/ui.py +152 -0
  972. src/theorem/__init__.py +1 -0
  973. src/theorem/prover.py +352 -0
  974. src/trends/__init__.py +20 -0
  975. src/trends/evolution.py +330 -0
  976. src/triz/__init__.py +109 -0
  977. src/triz/ariz.py +884 -0
  978. src/triz/bridge.py +240 -0
  979. src/triz/contradiction_matrix.py +422 -0
  980. src/triz/matrix.py +52 -0
  981. src/triz/matrix_core.py +1761 -0
  982. src/triz/matrix_resolver.py +24 -0
  983. src/triz/matrix_utils.py +20 -0
  984. src/triz/physical_contradiction.py +599 -0
  985. src/triz/principles.py +1136 -0
  986. src/triz/solver.py +315 -0
  987. src/triz/standard_solutions.py +1289 -0
  988. src/triz/standard_solutions_data.py +1210 -0
  989. src/triz/sufield.py +706 -0
  990. src/tui/IMPLEMENTATION.md +135 -0
  991. src/tui/README.md +61 -0
  992. src/tui/__init__.py +9 -0
  993. src/tui/alert_widget.py +49 -0
  994. src/tui/animation.py +79 -0
  995. src/tui/app.py +8 -0
  996. src/tui/article_canvas.py +113 -0
  997. src/tui/breathing.py +122 -0
  998. src/tui/budget_gauge.py +38 -0
  999. src/tui/config_screen.py +125 -0
  1000. src/tui/cube_navigator.py +87 -0
  1001. src/tui/cube_viz.py +173 -0
  1002. src/tui/dashboard.py +64 -0
  1003. src/tui/delight.py +235 -0
  1004. src/tui/delta_renderer.py +265 -0
  1005. src/tui/depth_ladder.py +50 -0
  1006. src/tui/diagnostics.py +165 -0
  1007. src/tui/easing.py +104 -0
  1008. src/tui/entry.py +79 -0
  1009. src/tui/export_helpers.py +175 -0
  1010. src/tui/folder_panel.py +63 -0
  1011. src/tui/ghost_tui.py +261 -0
  1012. src/tui/gpu_display.py +193 -0
  1013. src/tui/gradient_bar.py +181 -0
  1014. src/tui/header_footer.py +73 -0
  1015. src/tui/i18n.py +311 -0
  1016. src/tui/keyboard_handler.py +67 -0
  1017. src/tui/language_manager.py +63 -0
  1018. src/tui/layout_manager.py +134 -0
  1019. src/tui/live_feed_ticker.py +81 -0
  1020. src/tui/living_cube.py +304 -0
  1021. src/tui/living_cube_v2.py +406 -0
  1022. src/tui/local_llm.py +30 -0
  1023. src/tui/main_loop.py +271 -0
  1024. src/tui/mascot.py +77 -0
  1025. src/tui/micro_animations.py +188 -0
  1026. src/tui/module_status.py +116 -0
  1027. src/tui/onboarding.py +82 -0
  1028. src/tui/package_installer.py +150 -0
  1029. src/tui/particles.py +217 -0
  1030. src/tui/pipeline_runner.py +185 -0
  1031. src/tui/pipeline_stories.py +61 -0
  1032. src/tui/plugin_manager.py +123 -0
  1033. src/tui/proof_graph.py +96 -0
  1034. src/tui/provider_dashboard.py +71 -0
  1035. src/tui/renderer.py +87 -0
  1036. src/tui/results_display.py +179 -0
  1037. src/tui/smart_prompt.py +199 -0
  1038. src/tui/sound_system.py +69 -0
  1039. src/tui/sounds/complete.wav +0 -0
  1040. src/tui/sounds/error.wav +0 -0
  1041. src/tui/sounds/rare.wav +0 -0
  1042. src/tui/sounds/step.wav +0 -0
  1043. src/tui/sounds/welcome.wav +0 -0
  1044. src/tui/staged_error.py +110 -0
  1045. src/tui/system_stats.py +33 -0
  1046. src/tui/thinking_indicator.py +75 -0
  1047. src/tui/token_counter.py +20 -0
  1048. src/tui/v8/README.md +113 -0
  1049. src/tui/v8/backend/bridge.go +151 -0
  1050. src/tui/v8/backend/client.go +427 -0
  1051. src/tui/v8/backend/client_test.go +247 -0
  1052. src/tui/v8/backend/cmd.go +325 -0
  1053. src/tui/v8/backend/error_test.go +82 -0
  1054. src/tui/v8/backend/integration_test.go +110 -0
  1055. src/tui/v8/backend/rate_limiter.go +104 -0
  1056. src/tui/v8/backend/rate_limiter_test.go +74 -0
  1057. src/tui/v8/backend/sse.go +157 -0
  1058. src/tui/v8/backend/sse_integration_test.go +69 -0
  1059. src/tui/v8/backend/sse_test.go +110 -0
  1060. src/tui/v8/config/config.go +123 -0
  1061. src/tui/v8/config/config_test.go +64 -0
  1062. src/tui/v8/constants.go +5 -0
  1063. src/tui/v8/debug_view_test.go +43 -0
  1064. src/tui/v8/go.mod +34 -0
  1065. src/tui/v8/go.sum +58 -0
  1066. src/tui/v8/integration_test.go +103 -0
  1067. src/tui/v8/internal/i18n.go +408 -0
  1068. src/tui/v8/internal/lang.go +77 -0
  1069. src/tui/v8/internal/lang_test.go +32 -0
  1070. src/tui/v8/internal/mascot_memory.go +102 -0
  1071. src/tui/v8/internal/sanitize.go +31 -0
  1072. src/tui/v8/internal/sanitize_test.go +22 -0
  1073. src/tui/v8/internal/store.go +162 -0
  1074. src/tui/v8/internal/store_test.go +73 -0
  1075. src/tui/v8/internal/text.go +116 -0
  1076. src/tui/v8/layout.go +215 -0
  1077. src/tui/v8/layout_test.go +205 -0
  1078. src/tui/v8/main.go +160 -0
  1079. src/tui/v8/main_test.go +165 -0
  1080. src/tui/v8/model.go +111 -0
  1081. src/tui/v8/model_test.go +52 -0
  1082. src/tui/v8/screens/agenda.go +220 -0
  1083. src/tui/v8/screens/bibliography.go +121 -0
  1084. src/tui/v8/screens/cache.go +83 -0
  1085. src/tui/v8/screens/dashboard.go +203 -0
  1086. src/tui/v8/screens/diagnostic.go +217 -0
  1087. src/tui/v8/screens/dissertation.go +181 -0
  1088. src/tui/v8/screens/export.go +281 -0
  1089. src/tui/v8/screens/export_test.go +103 -0
  1090. src/tui/v8/screens/fireworks.go +156 -0
  1091. src/tui/v8/screens/gpu.go +162 -0
  1092. src/tui/v8/screens/help.go +178 -0
  1093. src/tui/v8/screens/history.go +127 -0
  1094. src/tui/v8/screens/knowledge_graph.go +162 -0
  1095. src/tui/v8/screens/matrix.go +102 -0
  1096. src/tui/v8/screens/onboarding.go +223 -0
  1097. src/tui/v8/screens/packages.go +121 -0
  1098. src/tui/v8/screens/palette.go +207 -0
  1099. src/tui/v8/screens/provider.go +97 -0
  1100. src/tui/v8/screens/social.go +96 -0
  1101. src/tui/v8/screens/triz.go +122 -0
  1102. src/tui/v8/screens/types.go +39 -0
  1103. src/tui/v8/screens/types_test.go +39 -0
  1104. src/tui/v8/signals.go +21 -0
  1105. src/tui/v8/splash/art.go +111 -0
  1106. src/tui/v8/splash/ascii_art.go +156 -0
  1107. src/tui/v8/splash/splash.go +823 -0
  1108. src/tui/v8/splash/splash_test.go +759 -0
  1109. src/tui/v8/styles/theme.go +295 -0
  1110. src/tui/v8/styles/theme_test.go +58 -0
  1111. src/tui/v8/update.go +943 -0
  1112. src/tui/v8/view.go +199 -0
  1113. src/tui/v8/widgets/c4grid.go +312 -0
  1114. src/tui/v8/widgets/c4grid_test.go +53 -0
  1115. src/tui/v8/widgets/chat.go +142 -0
  1116. src/tui/v8/widgets/chat_test.go +75 -0
  1117. src/tui/v8/widgets/header.go +307 -0
  1118. src/tui/v8/widgets/header_test.go +120 -0
  1119. src/tui/v8/widgets/help.go +115 -0
  1120. src/tui/v8/widgets/help_test.go +31 -0
  1121. src/tui/v8/widgets/inputbar.go +486 -0
  1122. src/tui/v8/widgets/inputbar_test.go +56 -0
  1123. src/tui/v8/widgets/mascot.go +410 -0
  1124. src/tui/v8/widgets/mascot_test.go +118 -0
  1125. src/tui/v8/widgets/pipeline.go +391 -0
  1126. src/tui/v8/widgets/pipeline_test.go +76 -0
  1127. src/tui/v8/widgets/result.go +454 -0
  1128. src/tui/v8/widgets/result_test.go +36 -0
  1129. src/tui/v8/widgets/toast.go +108 -0
  1130. src/tui/v8/widgets/toast_test.go +47 -0
  1131. src/tui/v9/ARCHITECTURE.md +72 -0
  1132. src/tui/v9/Makefile +59 -0
  1133. src/tui/v9/README.md +212 -0
  1134. src/tui/v9/achievements.go +375 -0
  1135. src/tui/v9/achievements_test.go +241 -0
  1136. src/tui/v9/api/api.go +455 -0
  1137. src/tui/v9/api/api_test.go +323 -0
  1138. src/tui/v9/api/auth_env.go +25 -0
  1139. src/tui/v9/api/openapi_contract_test.go +60 -0
  1140. src/tui/v9/api/sse_typed.go +120 -0
  1141. src/tui/v9/api/sse_typed_test.go +83 -0
  1142. src/tui/v9/auth_cmd.go +31 -0
  1143. src/tui/v9/benchview_test.go +39 -0
  1144. src/tui/v9/bio_aurora.go +233 -0
  1145. src/tui/v9/bio_aurora_test.go +227 -0
  1146. src/tui/v9/capsim/capsim.go +235 -0
  1147. src/tui/v9/capsim/capsim_test.go +59 -0
  1148. src/tui/v9/capsim/overlay.go +180 -0
  1149. src/tui/v9/capsim/overlay_test.go +55 -0
  1150. src/tui/v9/capsim_cmd.go +32 -0
  1151. src/tui/v9/card_helpers.go +78 -0
  1152. src/tui/v9/card_helpers_test.go +88 -0
  1153. src/tui/v9/cards/cards.go +259 -0
  1154. src/tui/v9/cards/cards_test.go +107 -0
  1155. src/tui/v9/cmd/c4tui-v9/keyfilter.go +108 -0
  1156. src/tui/v9/cmd/c4tui-v9/keyfilter_test.go +166 -0
  1157. src/tui/v9/cmd/c4tui-v9/main.go +240 -0
  1158. src/tui/v9/cmd/c4tui-v9-probe/main.go +26 -0
  1159. src/tui/v9/colorprofile.go +193 -0
  1160. src/tui/v9/commands/palette.go +138 -0
  1161. src/tui/v9/commands.go +107 -0
  1162. src/tui/v9/config.go +237 -0
  1163. src/tui/v9/config_test.go +235 -0
  1164. src/tui/v9/cost_test.go +37 -0
  1165. src/tui/v9/cyber_polish.go +231 -0
  1166. src/tui/v9/debug_overlay.go +134 -0
  1167. src/tui/v9/debug_test.go +94 -0
  1168. src/tui/v9/demo/demo.go +183 -0
  1169. src/tui/v9/demo/demo_test.go +102 -0
  1170. src/tui/v9/dream.go +176 -0
  1171. src/tui/v9/dream_test.go +156 -0
  1172. src/tui/v9/effects/bugfix_test.go +156 -0
  1173. src/tui/v9/effects/effects.go +602 -0
  1174. src/tui/v9/effects/effects_test.go +128 -0
  1175. src/tui/v9/empty_widgets.go +193 -0
  1176. src/tui/v9/empty_widgets_test.go +101 -0
  1177. src/tui/v9/expansion_test.go +95 -0
  1178. src/tui/v9/feed_persist_test.go +70 -0
  1179. src/tui/v9/go.mod +33 -0
  1180. src/tui/v9/go.sum +73 -0
  1181. src/tui/v9/golden_snapshots_test.go +389 -0
  1182. src/tui/v9/golden_test.go +182 -0
  1183. src/tui/v9/history.go +286 -0
  1184. src/tui/v9/i18n/README.md +91 -0
  1185. src/tui/v9/i18n/ar.toml +194 -0
  1186. src/tui/v9/i18n/de.toml +194 -0
  1187. src/tui/v9/i18n/en.toml +211 -0
  1188. src/tui/v9/i18n/hi.toml +194 -0
  1189. src/tui/v9/i18n/i18n.go +121 -0
  1190. src/tui/v9/i18n/i18n_test.go +236 -0
  1191. src/tui/v9/i18n/ja.toml +194 -0
  1192. src/tui/v9/i18n/pipeline/c4_science_terms.json +668 -0
  1193. src/tui/v9/i18n/pipeline/nllb_check.py +178 -0
  1194. src/tui/v9/i18n/pipeline/quality_report_v9.4.json +1661 -0
  1195. src/tui/v9/i18n/pipeline/quality_score.py +210 -0
  1196. src/tui/v9/i18n/pipeline/regen_i18n.py +183 -0
  1197. src/tui/v9/i18n/pipeline/translate_hymt.py +204 -0
  1198. src/tui/v9/i18n/ru.toml +194 -0
  1199. src/tui/v9/i18n/zh.toml +194 -0
  1200. src/tui/v9/internal/oapi/openapi.gen.go +1812 -0
  1201. src/tui/v9/keymap.go +378 -0
  1202. src/tui/v9/keymap_test.go +330 -0
  1203. src/tui/v9/lang_helper_test.go +23 -0
  1204. src/tui/v9/langs.go +101 -0
  1205. src/tui/v9/langs_test.go +131 -0
  1206. src/tui/v9/layout.go +125 -0
  1207. src/tui/v9/layout_test.go +96 -0
  1208. src/tui/v9/main_test.go +28 -0
  1209. src/tui/v9/model.go +772 -0
  1210. src/tui/v9/oapi-codegen.yaml +8 -0
  1211. src/tui/v9/palette_test.go +195 -0
  1212. src/tui/v9/persist/feed.go +295 -0
  1213. src/tui/v9/persist/feed_test.go +292 -0
  1214. src/tui/v9/persist/persist.go +211 -0
  1215. src/tui/v9/persist/persist_test.go +208 -0
  1216. src/tui/v9/probe/probe.go +182 -0
  1217. src/tui/v9/registry.go +412 -0
  1218. src/tui/v9/resume_test.go +68 -0
  1219. src/tui/v9/settings_menu.go +116 -0
  1220. src/tui/v9/sim_handlers_test.go +143 -0
  1221. src/tui/v9/sim_summary.go +107 -0
  1222. src/tui/v9/sim_summary_test.go +71 -0
  1223. src/tui/v9/splash.go +1423 -0
  1224. src/tui/v9/splash_align_forms_test.go +167 -0
  1225. src/tui/v9/splash_align_test.go +119 -0
  1226. src/tui/v9/splash_test.go +248 -0
  1227. src/tui/v9/sse_reconnect.go +81 -0
  1228. src/tui/v9/state_machine_test.go +528 -0
  1229. src/tui/v9/status_bar.go +137 -0
  1230. src/tui/v9/status_bar_test.go +74 -0
  1231. src/tui/v9/telemetry/telemetry.go +119 -0
  1232. src/tui/v9/telemetry/telemetry_test.go +144 -0
  1233. src/tui/v9/telemetry_wiring_test.go +182 -0
  1234. src/tui/v9/test_helpers.go +97 -0
  1235. src/tui/v9/tests/golden/T0-tmux-achievement-shown.txt +24 -0
  1236. src/tui/v9/tests/golden/T0-tmux-bookmark.txt +24 -0
  1237. src/tui/v9/tests/golden/T0-tmux-capsim.txt +23 -0
  1238. src/tui/v9/tests/golden/T0-tmux-debug.txt +25 -0
  1239. src/tui/v9/tests/golden/T0-tmux-empty.txt +24 -0
  1240. src/tui/v9/tests/golden/T0-tmux-error.txt +24 -0
  1241. src/tui/v9/tests/golden/T0-tmux-expanded.txt +24 -0
  1242. src/tui/v9/tests/golden/T0-tmux-focused-expanded.txt +24 -0
  1243. src/tui/v9/tests/golden/T0-tmux-focused.txt +24 -0
  1244. src/tui/v9/tests/golden/T0-tmux-full-hypothesis.txt +24 -0
  1245. src/tui/v9/tests/golden/T0-tmux-help-shown.txt +25 -0
  1246. src/tui/v9/tests/golden/T0-tmux-hypothesis.txt +24 -0
  1247. src/tui/v9/tests/golden/T0-tmux-mixed-feed.txt +24 -0
  1248. src/tui/v9/tests/golden/T0-tmux-multi-paper.txt +24 -0
  1249. src/tui/v9/tests/golden/T0-tmux-palette.txt +24 -0
  1250. src/tui/v9/tests/golden/T0-tmux-settings-open.txt +24 -0
  1251. src/tui/v9/tests/golden/T0-tmux-sim-inconclusive.txt +24 -0
  1252. src/tui/v9/tests/golden/T0-tmux-sim-refutes.txt +24 -0
  1253. src/tui/v9/tests/golden/T0-tmux-sim-skipped.txt +24 -0
  1254. src/tui/v9/tests/golden/T0-tmux-sim-supports.txt +24 -0
  1255. src/tui/v9/tests/golden/T0-tmux-sim.txt +24 -0
  1256. src/tui/v9/tests/golden/T0-tmux-verdict-chips.txt +24 -0
  1257. src/tui/v9/tests/golden/T1-mbp13-achievement-shown.txt +39 -0
  1258. src/tui/v9/tests/golden/T1-mbp13-bookmark.txt +39 -0
  1259. src/tui/v9/tests/golden/T1-mbp13-capsim.txt +39 -0
  1260. src/tui/v9/tests/golden/T1-mbp13-debug.txt +25 -0
  1261. src/tui/v9/tests/golden/T1-mbp13-empty.txt +39 -0
  1262. src/tui/v9/tests/golden/T1-mbp13-error.txt +39 -0
  1263. src/tui/v9/tests/golden/T1-mbp13-expanded.txt +39 -0
  1264. src/tui/v9/tests/golden/T1-mbp13-focused-expanded.txt +39 -0
  1265. src/tui/v9/tests/golden/T1-mbp13-focused.txt +39 -0
  1266. src/tui/v9/tests/golden/T1-mbp13-full-hypothesis.txt +39 -0
  1267. src/tui/v9/tests/golden/T1-mbp13-help-shown.txt +25 -0
  1268. src/tui/v9/tests/golden/T1-mbp13-hypothesis.txt +39 -0
  1269. src/tui/v9/tests/golden/T1-mbp13-mixed-feed.txt +39 -0
  1270. src/tui/v9/tests/golden/T1-mbp13-multi-paper.txt +39 -0
  1271. src/tui/v9/tests/golden/T1-mbp13-palette.txt +40 -0
  1272. src/tui/v9/tests/golden/T1-mbp13-settings-open.txt +40 -0
  1273. src/tui/v9/tests/golden/T1-mbp13-sim-inconclusive.txt +39 -0
  1274. src/tui/v9/tests/golden/T1-mbp13-sim-refutes.txt +39 -0
  1275. src/tui/v9/tests/golden/T1-mbp13-sim-skipped.txt +39 -0
  1276. src/tui/v9/tests/golden/T1-mbp13-sim-supports.txt +39 -0
  1277. src/tui/v9/tests/golden/T1-mbp13-sim.txt +39 -0
  1278. src/tui/v9/tests/golden/T1-mbp13-verdict-chips.txt +39 -0
  1279. src/tui/v9/tests/golden/T2-1080p-achievement-shown.txt +49 -0
  1280. src/tui/v9/tests/golden/T2-1080p-bookmark.txt +49 -0
  1281. src/tui/v9/tests/golden/T2-1080p-capsim.txt +49 -0
  1282. src/tui/v9/tests/golden/T2-1080p-debug.txt +25 -0
  1283. src/tui/v9/tests/golden/T2-1080p-empty.txt +49 -0
  1284. src/tui/v9/tests/golden/T2-1080p-error.txt +49 -0
  1285. src/tui/v9/tests/golden/T2-1080p-expanded.txt +49 -0
  1286. src/tui/v9/tests/golden/T2-1080p-focused-expanded.txt +49 -0
  1287. src/tui/v9/tests/golden/T2-1080p-focused.txt +49 -0
  1288. src/tui/v9/tests/golden/T2-1080p-full-hypothesis.txt +49 -0
  1289. src/tui/v9/tests/golden/T2-1080p-help-shown.txt +25 -0
  1290. src/tui/v9/tests/golden/T2-1080p-hypothesis.txt +49 -0
  1291. src/tui/v9/tests/golden/T2-1080p-mixed-feed.txt +49 -0
  1292. src/tui/v9/tests/golden/T2-1080p-multi-paper.txt +49 -0
  1293. src/tui/v9/tests/golden/T2-1080p-palette.txt +41 -0
  1294. src/tui/v9/tests/golden/T2-1080p-settings-open.txt +50 -0
  1295. src/tui/v9/tests/golden/T2-1080p-sim-inconclusive.txt +49 -0
  1296. src/tui/v9/tests/golden/T2-1080p-sim-refutes.txt +49 -0
  1297. src/tui/v9/tests/golden/T2-1080p-sim-skipped.txt +49 -0
  1298. src/tui/v9/tests/golden/T2-1080p-sim-supports.txt +49 -0
  1299. src/tui/v9/tests/golden/T2-1080p-sim.txt +49 -0
  1300. src/tui/v9/tests/golden/T2-1080p-verdict-chips.txt +49 -0
  1301. src/tui/v9/tests/golden/T2-mbp16-achievement-shown.txt +47 -0
  1302. src/tui/v9/tests/golden/T2-mbp16-bookmark.txt +47 -0
  1303. src/tui/v9/tests/golden/T2-mbp16-capsim.txt +47 -0
  1304. src/tui/v9/tests/golden/T2-mbp16-debug.txt +25 -0
  1305. src/tui/v9/tests/golden/T2-mbp16-empty.txt +47 -0
  1306. src/tui/v9/tests/golden/T2-mbp16-error.txt +47 -0
  1307. src/tui/v9/tests/golden/T2-mbp16-expanded.txt +47 -0
  1308. src/tui/v9/tests/golden/T2-mbp16-focused-expanded.txt +47 -0
  1309. src/tui/v9/tests/golden/T2-mbp16-focused.txt +47 -0
  1310. src/tui/v9/tests/golden/T2-mbp16-full-hypothesis.txt +47 -0
  1311. src/tui/v9/tests/golden/T2-mbp16-help-shown.txt +25 -0
  1312. src/tui/v9/tests/golden/T2-mbp16-hypothesis.txt +47 -0
  1313. src/tui/v9/tests/golden/T2-mbp16-mixed-feed.txt +47 -0
  1314. src/tui/v9/tests/golden/T2-mbp16-multi-paper.txt +47 -0
  1315. src/tui/v9/tests/golden/T2-mbp16-palette.txt +41 -0
  1316. src/tui/v9/tests/golden/T2-mbp16-settings-open.txt +48 -0
  1317. src/tui/v9/tests/golden/T2-mbp16-sim-inconclusive.txt +47 -0
  1318. src/tui/v9/tests/golden/T2-mbp16-sim-refutes.txt +47 -0
  1319. src/tui/v9/tests/golden/T2-mbp16-sim-skipped.txt +47 -0
  1320. src/tui/v9/tests/golden/T2-mbp16-sim-supports.txt +47 -0
  1321. src/tui/v9/tests/golden/T2-mbp16-sim.txt +47 -0
  1322. src/tui/v9/tests/golden/T2-mbp16-verdict-chips.txt +47 -0
  1323. src/tui/v9/tests/golden/T3-4k-achievement-shown.txt +59 -0
  1324. src/tui/v9/tests/golden/T3-4k-bookmark.txt +59 -0
  1325. src/tui/v9/tests/golden/T3-4k-capsim.txt +59 -0
  1326. src/tui/v9/tests/golden/T3-4k-debug.txt +25 -0
  1327. src/tui/v9/tests/golden/T3-4k-empty.txt +59 -0
  1328. src/tui/v9/tests/golden/T3-4k-error.txt +59 -0
  1329. src/tui/v9/tests/golden/T3-4k-expanded.txt +59 -0
  1330. src/tui/v9/tests/golden/T3-4k-focused-expanded.txt +59 -0
  1331. src/tui/v9/tests/golden/T3-4k-focused.txt +59 -0
  1332. src/tui/v9/tests/golden/T3-4k-full-hypothesis.txt +59 -0
  1333. src/tui/v9/tests/golden/T3-4k-help-shown.txt +25 -0
  1334. src/tui/v9/tests/golden/T3-4k-hypothesis.txt +59 -0
  1335. src/tui/v9/tests/golden/T3-4k-mixed-feed.txt +59 -0
  1336. src/tui/v9/tests/golden/T3-4k-multi-paper.txt +59 -0
  1337. src/tui/v9/tests/golden/T3-4k-palette.txt +41 -0
  1338. src/tui/v9/tests/golden/T3-4k-settings-open.txt +60 -0
  1339. src/tui/v9/tests/golden/T3-4k-sim-inconclusive.txt +59 -0
  1340. src/tui/v9/tests/golden/T3-4k-sim-refutes.txt +59 -0
  1341. src/tui/v9/tests/golden/T3-4k-sim-skipped.txt +59 -0
  1342. src/tui/v9/tests/golden/T3-4k-sim-supports.txt +59 -0
  1343. src/tui/v9/tests/golden/T3-4k-sim.txt +59 -0
  1344. src/tui/v9/tests/golden/T3-4k-verdict-chips.txt +59 -0
  1345. src/tui/v9/tests/golden/T3-ultrawide-achievement-shown.txt +49 -0
  1346. src/tui/v9/tests/golden/T3-ultrawide-bookmark.txt +49 -0
  1347. src/tui/v9/tests/golden/T3-ultrawide-capsim.txt +49 -0
  1348. src/tui/v9/tests/golden/T3-ultrawide-debug.txt +25 -0
  1349. src/tui/v9/tests/golden/T3-ultrawide-empty.txt +49 -0
  1350. src/tui/v9/tests/golden/T3-ultrawide-error.txt +49 -0
  1351. src/tui/v9/tests/golden/T3-ultrawide-expanded.txt +49 -0
  1352. src/tui/v9/tests/golden/T3-ultrawide-focused-expanded.txt +49 -0
  1353. src/tui/v9/tests/golden/T3-ultrawide-focused.txt +49 -0
  1354. src/tui/v9/tests/golden/T3-ultrawide-full-hypothesis.txt +49 -0
  1355. src/tui/v9/tests/golden/T3-ultrawide-help-shown.txt +25 -0
  1356. src/tui/v9/tests/golden/T3-ultrawide-hypothesis.txt +49 -0
  1357. src/tui/v9/tests/golden/T3-ultrawide-mixed-feed.txt +49 -0
  1358. src/tui/v9/tests/golden/T3-ultrawide-multi-paper.txt +49 -0
  1359. src/tui/v9/tests/golden/T3-ultrawide-palette.txt +41 -0
  1360. src/tui/v9/tests/golden/T3-ultrawide-settings-open.txt +50 -0
  1361. src/tui/v9/tests/golden/T3-ultrawide-sim-inconclusive.txt +49 -0
  1362. src/tui/v9/tests/golden/T3-ultrawide-sim-refutes.txt +49 -0
  1363. src/tui/v9/tests/golden/T3-ultrawide-sim-skipped.txt +49 -0
  1364. src/tui/v9/tests/golden/T3-ultrawide-sim-supports.txt +49 -0
  1365. src/tui/v9/tests/golden/T3-ultrawide-sim.txt +49 -0
  1366. src/tui/v9/tests/golden/T3-ultrawide-verdict-chips.txt +49 -0
  1367. src/tui/v9/theme.go +83 -0
  1368. src/tui/v9/theme_test.go +90 -0
  1369. src/tui/v9/tier.go +88 -0
  1370. src/tui/v9/tier_test.go +363 -0
  1371. src/tui/v9/update.go +993 -0
  1372. src/tui/v9/v8_art_embedded.go +178 -0
  1373. src/tui/v9/v910_test.go +253 -0
  1374. src/tui/v9/verdict_chips.go +64 -0
  1375. src/tui/v9/verdict_chips_test.go +77 -0
  1376. src/tui/v9/view.go +472 -0
  1377. src/tui/v9/view_test.go +154 -0
  1378. src/tui/v9/wizard.go +97 -0
  1379. src/tui/v9/wizard_render_test.go +87 -0
  1380. src/tui/v9/wizard_sse_test.go +311 -0
  1381. src/utils/__init__.py +27 -0
  1382. src/utils/error_handlers.py +290 -0
  1383. src/utils/error_taxonomy.py +140 -0
  1384. src/utils/formatting.py +160 -0
  1385. src/utils/math_utils.py +27 -0
  1386. src/utils/retry/__init__.py +47 -0
  1387. src/utils/retry/core.py +200 -0
  1388. src/utils/retry/policies.py +202 -0
  1389. src/utils/retry/utils.py +90 -0
  1390. src/utils/retry.py +53 -0
  1391. src/utils/safe_eval.py +206 -0
  1392. src/utils/safe_subprocess.py +171 -0
  1393. src/utils/safety_guards.py +110 -0
  1394. src/utils/security_middleware.py +132 -0
  1395. src/utils/translation.py +110 -0
  1396. src/utils/validation.py +86 -0
  1397. src/utils/validators.py +377 -0
  1398. src/validation/__init__.py +31 -0
  1399. src/validation/consensus_meter.py +393 -0
  1400. src/validation/core.py +290 -0
  1401. src/validation/empirical_layer.py +137 -0
  1402. src/validation/monte_carlo.py +24 -0
  1403. src/validation/rules.py +324 -0
  1404. src/validation/tracker.py +32 -0
  1405. src/verification/__init__.py +19 -0
  1406. src/verification/agda_bridge.py +326 -0
  1407. src/verification/auto_theorem.py +296 -0
  1408. src/verification/calibrator.py +211 -0
  1409. src/verification/claim_matcher.py +317 -0
  1410. src/verification/config.py +85 -0
  1411. src/verification/consensus_engine.py +142 -0
  1412. src/verification/coq_client.py +416 -0
  1413. src/verification/dafny_client.py +394 -0
  1414. src/verification/examples/agda_examples.json +47 -0
  1415. src/verification/examples/coq_examples.json +50 -0
  1416. src/verification/examples/dafny_examples.json +54 -0
  1417. src/verification/examples/lean4_examples.json +58 -0
  1418. src/verification/examples/z3_examples.json +52 -0
  1419. src/verification/formalization_engine.py +187 -0
  1420. src/verification/guardrails.py +297 -0
  1421. src/verification/haskell_bridge.py +131 -0
  1422. src/verification/hoare_client.py +491 -0
  1423. src/verification/hoare_verifier.py +524 -0
  1424. src/verification/hybrid_verifier.py +473 -0
  1425. src/verification/lean4_client.py +349 -0
  1426. src/verification/lean4lean_client.py +62 -0
  1427. src/verification/lean_dojo_adapter.py +149 -0
  1428. src/verification/llm_prover.py +439 -0
  1429. src/verification/math_detector.py +72 -0
  1430. src/verification/rag_retriever.py +107 -0
  1431. src/verification/semantic_alignment.py +172 -0
  1432. src/verification/stats_validator.py +300 -0
  1433. src/verification/timer.py +241 -0
  1434. src/verification/unified_score.py +150 -0
  1435. src/visualization/__init__.py +1 -0
  1436. src/visualization/c4_viz.py +191 -0
  1437. src/wasm/__init__.py +12 -0
  1438. src/wasm/build_plugins.py +196 -0
  1439. src/wasm/runtime.py +245 -0
@@ -0,0 +1,434 @@
1
+ """
2
+ Pharmacokinetics Pattern
3
+ Compartmental PK models for drug concentration simulation
4
+
5
+ Based on:
6
+ - One-compartment and two-compartment models
7
+ - ADME processes (Absorption, Distribution, Metabolism, Excretion)
8
+ - Differential equations for drug concentration
9
+ """
10
+
11
+ import logging
12
+ from dataclasses import dataclass
13
+ from datetime import datetime
14
+ from enum import Enum
15
+ from typing import Any
16
+
17
+ import numpy as np
18
+ from scipy.integrate import solve_ivp
19
+
20
+ from ..core import (
21
+ Hypothesis,
22
+ SimulationParameter,
23
+ SimulationPattern,
24
+ SimulationResult,
25
+ SimulationStatus,
26
+ ValidationLevel,
27
+ simulation_pattern,
28
+ )
29
+
30
+
31
+ logger = logging.getLogger(__name__)
32
+
33
+
34
+ class PKModel(Enum):
35
+ """PKModel."""
36
+ ONE_COMPARTMENT = "one_compartment"
37
+ TWO_COMPARTMENT = "two_compartment"
38
+ MICHAELIS_MENTEN = "michaelis_menten"
39
+
40
+
41
+ @dataclass
42
+ class DosingRegimen:
43
+ """Drug dosing schedule"""
44
+ dose: float # mg
45
+ interval: float # hours
46
+ num_doses: int
47
+ route: str = "oral" # oral, iv, im, sc
48
+ absorption_rate: float = 1.0 # 1/hr for oral
49
+
50
+
51
+ @simulation_pattern(
52
+ id="pharmacokinetics",
53
+ name="Pharmacokinetics",
54
+ category="biology",
55
+ description="Drug concentration simulation using compartmental PK models",
56
+ )
57
+ class PKPattern(SimulationPattern):
58
+ """
59
+ Pharmacokinetics simulation for drug dosing optimization
60
+
61
+ Implements:
62
+ - One-compartment model (oral and IV)
63
+ - Two-compartment model (distribution)
64
+ - Michaelis-Menten elimination
65
+ - Multiple dosing regimens
66
+ - AUC, Cmax, Tmax calculations
67
+ """
68
+
69
+ parameters = [
70
+ SimulationParameter(
71
+ name="model_type",
72
+ type="select",
73
+ default="one_compartment",
74
+ options=["one_compartment", "two_compartment", "michaelis_menten"],
75
+ description="PK model type",
76
+ ),
77
+ SimulationParameter(
78
+ name="dose",
79
+ type="float",
80
+ default=100.0,
81
+ min=0.1,
82
+ max=10000.0,
83
+ description="Dose amount (mg)",
84
+ ),
85
+ SimulationParameter(
86
+ name="interval",
87
+ type="float",
88
+ default=12.0,
89
+ min=1.0,
90
+ max=168.0,
91
+ description="Dosing interval (hours)",
92
+ ),
93
+ SimulationParameter(
94
+ name="num_doses",
95
+ type="int",
96
+ default=5,
97
+ min=1,
98
+ max=100,
99
+ description="Number of doses",
100
+ ),
101
+ SimulationParameter(
102
+ name="halflife",
103
+ type="float",
104
+ default=4.0,
105
+ min=0.1,
106
+ max=1000.0,
107
+ description="Elimination half-life (hours)",
108
+ ),
109
+ SimulationParameter(
110
+ name="volume",
111
+ type="float",
112
+ default=50.0,
113
+ min=1.0,
114
+ max=1000.0,
115
+ description="Volume of distribution (L)",
116
+ ),
117
+ ]
118
+
119
+ def can_simulate(self, hypothesis: Hypothesis) -> bool: # type: ignore[override]
120
+ """Check if PK can simulate this hypothesis"""
121
+ title = hypothesis.title.lower()
122
+ desc = hypothesis.description.lower()
123
+
124
+ keywords = [
125
+ "drug", "pharmacokinetics", "pk", "concentration",
126
+ "dosing", "dose", "regimen", "administration",
127
+ "absorption", "elimination", "clearance",
128
+ "bioavailability", "auc", "cmax", "tmax",
129
+ "half-life", "steady state", "therapeutic",
130
+ "pharmacodynamics", "pd", "exposure",
131
+ ]
132
+
133
+ return any(kw in title or kw in desc for kw in keywords)
134
+
135
+ async def run( # type: ignore[override]
136
+ self, hypothesis: Hypothesis, config: dict[str, Any]
137
+ ) -> SimulationResult:
138
+ """Execute PK simulation"""
139
+ start_time = datetime.now()
140
+ simulation_id = f"pk_{start_time.timestamp()}"
141
+
142
+ logger.info(f"Starting PK simulation {simulation_id}")
143
+
144
+ model_type = config.get("model_type", "one_compartment")
145
+
146
+ try:
147
+ if model_type == "one_compartment":
148
+ results = await self._one_compartment(hypothesis, config)
149
+ elif model_type == "two_compartment":
150
+ results = await self._two_compartment(hypothesis, config)
151
+ else:
152
+ results = await self._michaelis_menten(hypothesis, config)
153
+
154
+ end_time = datetime.now()
155
+
156
+ return SimulationResult(
157
+ simulation_id=simulation_id,
158
+ status=SimulationStatus.COMPLETED,
159
+ start_time=start_time,
160
+ end_time=end_time,
161
+ metrics=results["metrics"],
162
+ logs=results["logs"],
163
+ confidence_score=self._calculate_confidence(results),
164
+ validation_level=ValidationLevel.MONTE_CARLO,
165
+ )
166
+
167
+ except Exception as e:
168
+ logger.exception("PK simulation failed")
169
+ return SimulationResult(
170
+ simulation_id=simulation_id,
171
+ status=SimulationStatus.FAILED,
172
+ start_time=start_time,
173
+ end_time=datetime.now(),
174
+ error_message=str(e),
175
+ )
176
+
177
+ async def _one_compartment(self, hypothesis: Hypothesis, config: dict[str, Any]) -> dict[str, Any]:
178
+ """One-compartment PK model with first-order absorption and elimination"""
179
+
180
+ params = hypothesis.parameters
181
+ dose = config.get("dose", 100.0)
182
+ interval = config.get("interval", 12.0)
183
+ num_doses = config.get("num_doses", 5)
184
+ halflife = config.get("halflife", 4.0)
185
+ volume = config.get("volume", 50.0)
186
+
187
+ # Calculate rate constants
188
+ ke = np.log(2) / halflife # Elimination rate
189
+ ka = params.get("absorption_rate", 2.0) # Absorption rate (oral)
190
+ f = params.get("bioavailability", 1.0) # Bioavailability
191
+
192
+ # Simulation time (cover all doses + washout)
193
+ t_end = num_doses * interval + 5 * halflife
194
+ t_eval = np.linspace(0, t_end, 1000)
195
+
196
+ # Dosing times
197
+ dose_times = np.arange(0, num_doses * interval, interval)
198
+
199
+ # Solve ODE
200
+ def pk_model(t: Any, y: Any) -> Any:
201
+ """dC/dt = (ka * D * exp(-ka*t) / V) - ke * C"""
202
+ # Calculate remaining dose from each administration
203
+ absorption = 0
204
+ for dose_time in dose_times:
205
+ if t >= dose_time:
206
+ time_since_dose = t - dose_time
207
+ absorption += (ka * f * dose / volume) * np.exp(-ka * time_since_dose)
208
+
209
+ elimination = ke * y[0]
210
+ return [absorption - elimination]
211
+
212
+ solution = solve_ivp(
213
+ pk_model,
214
+ [0, t_end],
215
+ [0], # Initial concentration
216
+ t_eval=t_eval,
217
+ method='RK45',
218
+ )
219
+
220
+ concentrations = solution.y[0]
221
+ times = solution.t
222
+
223
+ # Calculate PK parameters
224
+ metrics = self._calculate_pk_metrics(times, concentrations, dose, interval)
225
+
226
+ logs = [
227
+ "One-compartment PK model",
228
+ f"Dosing: {num_doses} doses of {dose}mg every {interval}h",
229
+ f"Half-life: {halflife}h, Volume: {volume}L",
230
+ f"Cmax: {metrics['cmax']:.2f} mg/L",
231
+ f"Tmax: {metrics['tmax']:.2f} h",
232
+ f"AUC: {metrics['auc']:.2f} mg·h/L",
233
+ f"Steady state reached: {'yes' if metrics['steady_state_reached'] else 'no'}",
234
+ ]
235
+
236
+ return {"metrics": metrics, "logs": logs}
237
+
238
+ async def _two_compartment(self, hypothesis: Hypothesis, config: dict[str, Any]) -> dict[str, Any]:
239
+ """Two-compartment model (central + peripheral)"""
240
+
241
+ params = hypothesis.parameters
242
+ dose = config.get("dose", 100.0)
243
+ halflife = config.get("halflife", 4.0)
244
+ volume = config.get("volume", 50.0)
245
+
246
+ # Two-compartment parameters
247
+ k10 = np.log(2) / halflife # Elimination from central
248
+ k12 = params.get("k12", 0.5) # Central to peripheral
249
+ k21 = params.get("k21", 0.3) # Peripheral to central
250
+
251
+ t_end = 10 * halflife
252
+ t_eval = np.linspace(0, t_end, 500)
253
+
254
+ def two_comp_model(t: Any, y: Any) -> Any:
255
+ """Two-compartment ODEs"""
256
+ c1, c2 = y # Central and peripheral concentrations
257
+
258
+ dc1dt = -(k10 + k12) * c1 + k21 * c2
259
+ dc2dt = k12 * c1 - k21 * c2
260
+
261
+ return [dc1dt, dc2dt]
262
+
263
+ # Initial condition (IV bolus)
264
+ c0 = dose / volume
265
+
266
+ solution = solve_ivp(
267
+ two_comp_model,
268
+ [0, t_end],
269
+ [c0, 0],
270
+ t_eval=t_eval,
271
+ method='RK45',
272
+ )
273
+
274
+ central_conc = solution.y[0]
275
+ times = solution.t
276
+
277
+ metrics = self._calculate_pk_metrics(times, central_conc, dose, 0)
278
+ metrics["peripheral_cmax"] = float(np.max(solution.y[1]))
279
+
280
+ logs = [
281
+ "Two-compartment PK model",
282
+ f"Cmax (central): {metrics['cmax']:.2f} mg/L",
283
+ f"Cmax (peripheral): {metrics['peripheral_cmax']:.2f} mg/L",
284
+ f"AUC: {metrics['auc']:.2f} mg·h/L",
285
+ ]
286
+
287
+ return {"metrics": metrics, "logs": logs}
288
+
289
+ async def _michaelis_menten(self, hypothesis: Hypothesis, config: dict[str, Any]) -> dict[str, Any]:
290
+ """Michaelis-Menten elimination (saturable metabolism)"""
291
+
292
+ params = hypothesis.parameters
293
+ dose = config.get("dose", 100.0)
294
+ volume = config.get("volume", 50.0)
295
+
296
+ # Michaelis-Menten parameters
297
+ vmax = params.get("vmax", 10.0) # mg/h
298
+ km = params.get("km", 5.0) # mg/L
299
+
300
+ t_end = 48.0
301
+ t_eval = np.linspace(0, t_end, 500)
302
+
303
+ def mm_model(t: Any, y: Any) -> Any:
304
+ """dC/dt = -Vmax*C / (Km + C)"""
305
+ c = y[0]
306
+ if c < 0:
307
+ return [0]
308
+ elimination = (vmax * c) / (km + c)
309
+ return [-elimination / volume]
310
+
311
+ c0 = dose / volume
312
+
313
+ solution = solve_ivp(
314
+ mm_model,
315
+ [0, t_end],
316
+ [c0],
317
+ t_eval=t_eval,
318
+ method='RK45',
319
+ )
320
+
321
+ concentrations = solution.y[0]
322
+ times = solution.t
323
+
324
+ metrics = self._calculate_pk_metrics(times, concentrations, dose, 0)
325
+ metrics["nonlinear"] = True
326
+
327
+ logs = [
328
+ "Michaelis-Menten elimination model",
329
+ f"Vmax: {vmax} mg/h, Km: {km} mg/L",
330
+ f"Cmax: {metrics['cmax']:.2f} mg/L",
331
+ "Half-life increases with concentration (nonlinear)",
332
+ ]
333
+
334
+ return {"metrics": metrics, "logs": logs}
335
+
336
+ def _calculate_pk_metrics(
337
+ self, times: np.ndarray, concentrations: np.ndarray,
338
+ dose: float, interval: float
339
+ ) -> dict[str, Any]:
340
+ """Calculate standard PK metrics"""
341
+
342
+ # Cmax and Tmax
343
+ cmax_idx = np.argmax(concentrations)
344
+ cmax = float(concentrations[cmax_idx])
345
+ tmax = float(times[cmax_idx])
346
+
347
+ # AUC (trapezoidal rule)
348
+ auc = float(np.trapezoid(concentrations, times))
349
+
350
+ # Clearance (CL = Dose / AUC for IV)
351
+ clearance = dose / auc if auc > 0 else 0
352
+
353
+ # Check for steady state (if multiple doses)
354
+ steady_state_reached = False
355
+ if interval > 0 and len(times) > 100:
356
+ # Compare last two intervals
357
+ last_interval_mask = times > (times[-1] - 2 * interval)
358
+ if np.any(last_interval_mask):
359
+ concentrations[last_interval_mask]
360
+ # Check if fluctuation is stable
361
+ steady_state_reached = True # Simplified
362
+
363
+ return {
364
+ "cmax": cmax,
365
+ "tmax": tmax,
366
+ "auc": auc,
367
+ "clearance": clearance,
368
+ "half_life_estimate": self._estimate_half_life(times, concentrations),
369
+ "steady_state_reached": steady_state_reached,
370
+ "final_concentration": float(concentrations[-1]),
371
+ }
372
+
373
+ def _estimate_half_life(self, times: np.ndarray, concentrations: np.ndarray) -> float:
374
+ """Estimate half-life from elimination phase"""
375
+ # Use last 20% of data
376
+ n = len(times)
377
+ start_idx = int(0.8 * n)
378
+
379
+ if start_idx >= n - 2:
380
+ return 0.0
381
+
382
+ # Log-linear regression on elimination phase
383
+ t_segment = times[start_idx:]
384
+ c_segment = concentrations[start_idx:]
385
+
386
+ # Filter positive concentrations
387
+ mask = c_segment > 0
388
+ if np.sum(mask) < 2:
389
+ return 0.0
390
+
391
+ log_c = np.log(c_segment[mask])
392
+ t = t_segment[mask]
393
+
394
+ # Linear fit: ln(C) = ln(C0) - kt
395
+ k = -np.polyfit(t, log_c, 1)[0]
396
+
397
+ if k > 0:
398
+ return float(np.log(2) / k)
399
+ return 0.0
400
+
401
+ def _calculate_confidence(self, results: dict[str, Any]) -> float:
402
+ """Calculate confidence score"""
403
+ metrics = results["metrics"]
404
+ factors = []
405
+
406
+ # Reasonable Cmax
407
+ if 0 < metrics.get("cmax", -1) < 1000:
408
+ factors.append(0.3)
409
+
410
+ # Reasonable AUC
411
+ if 0 < metrics.get("auc", -1) < 10000:
412
+ factors.append(0.3)
413
+
414
+ # Half-life estimable
415
+ if metrics.get("half_life_estimate", 0) > 0:
416
+ factors.append(0.2)
417
+
418
+ # Steady state info
419
+ if "steady_state_reached" in metrics:
420
+ factors.append(0.2)
421
+
422
+ return min(0.95, sum(factors))
423
+
424
+ def estimate_resources(self, hypothesis: Hypothesis) -> dict[str, Any]: # type: ignore[override]
425
+ """Estimate computational resources"""
426
+ params = hypothesis.parameters
427
+ num_doses = params.get("num_doses", 5)
428
+
429
+ return {
430
+ "cpu_cores": 1,
431
+ "memory_gb": 0.5,
432
+ "gpu_required": False,
433
+ "estimated_time_seconds": 1 + num_doses * 0.1,
434
+ }