man1lab 1.2.2__tar.gz

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 (331) hide show
  1. man1lab-1.2.2/.env.example +7 -0
  2. man1lab-1.2.2/LICENSE +21 -0
  3. man1lab-1.2.2/MANIFEST.in +13 -0
  4. man1lab-1.2.2/PKG-INFO +240 -0
  5. man1lab-1.2.2/README.md +204 -0
  6. man1lab-1.2.2/adapters/__init__.py +4 -0
  7. man1lab-1.2.2/adapters/config_parser_settings.py +18 -0
  8. man1lab-1.2.2/adapters/docling_parser.py +88 -0
  9. man1lab-1.2.2/adapters/factory.py +31 -0
  10. man1lab-1.2.2/adapters/output_export.py +21 -0
  11. man1lab-1.2.2/adapters/pymupdf_parser.py +15 -0
  12. man1lab-1.2.2/agents/__init__.py +8 -0
  13. man1lab-1.2.2/agents/analysis_context.py +147 -0
  14. man1lab-1.2.2/agents/analysis_snapshot.py +20 -0
  15. man1lab-1.2.2/agents/coder.py +743 -0
  16. man1lab-1.2.2/agents/coder_quality.py +554 -0
  17. man1lab-1.2.2/agents/planner.py +46 -0
  18. man1lab-1.2.2/agents/reader.py +66 -0
  19. man1lab-1.2.2/agents/reporter.py +43 -0
  20. man1lab-1.2.2/agents/reviewer.py +48 -0
  21. man1lab-1.2.2/agents/runner.py +25 -0
  22. man1lab-1.2.2/application/__init__.py +13 -0
  23. man1lab-1.2.2/application/facade.py +456 -0
  24. man1lab-1.2.2/application/lifecycle/__init__.py +19 -0
  25. man1lab-1.2.2/application/lifecycle/clean.py +129 -0
  26. man1lab-1.2.2/application/lifecycle/common.py +110 -0
  27. man1lab-1.2.2/application/lifecycle/doctor.py +213 -0
  28. man1lab-1.2.2/application/lifecycle/init.py +123 -0
  29. man1lab-1.2.2/application/lifecycle/init_wizard.py +111 -0
  30. man1lab-1.2.2/application/lifecycle/llm_doctor.py +122 -0
  31. man1lab-1.2.2/application/version.py +3 -0
  32. man1lab-1.2.2/conf/analysis/default.yaml +1 -0
  33. man1lab-1.2.2/conf/coder/default.yaml +1 -0
  34. man1lab-1.2.2/conf/config.yaml +21 -0
  35. man1lab-1.2.2/conf/discovery/default.yaml +1 -0
  36. man1lab-1.2.2/conf/execution_planning/default.yaml +1 -0
  37. man1lab-1.2.2/conf/llm/default.yaml +32 -0
  38. man1lab-1.2.2/conf/logging/default.yaml +2 -0
  39. man1lab-1.2.2/conf/parser/default.yaml +2 -0
  40. man1lab-1.2.2/conf/planner/default.yaml +1 -0
  41. man1lab-1.2.2/conf/reporter/default.yaml +1 -0
  42. man1lab-1.2.2/conf/reviewer/default.yaml +1 -0
  43. man1lab-1.2.2/conf/runner/default.yaml +1 -0
  44. man1lab-1.2.2/conf/tracking/default.yaml +4 -0
  45. man1lab-1.2.2/conf/workflow/default.yaml +1 -0
  46. man1lab-1.2.2/config.py +49 -0
  47. man1lab-1.2.2/configuration/__init__.py +16 -0
  48. man1lab-1.2.2/configuration/bootstrap.py +25 -0
  49. man1lab-1.2.2/configuration/hydra_provider.py +107 -0
  50. man1lab-1.2.2/configuration/legacy_provider.py +71 -0
  51. man1lab-1.2.2/configuration/models.py +83 -0
  52. man1lab-1.2.2/configuration/paths.py +47 -0
  53. man1lab-1.2.2/configuration/provider.py +27 -0
  54. man1lab-1.2.2/discovery/__init__.py +0 -0
  55. man1lab-1.2.2/discovery/empty.py +66 -0
  56. man1lab-1.2.2/discovery/workflow.py +374 -0
  57. man1lab-1.2.2/execution/__init__.py +3 -0
  58. man1lab-1.2.2/execution/execution_planner.py +31 -0
  59. man1lab-1.2.2/execution_planning/__init__.py +6 -0
  60. man1lab-1.2.2/execution_planning/builder.py +151 -0
  61. man1lab-1.2.2/execution_planning/workflow.py +188 -0
  62. man1lab-1.2.2/interfaces/__init__.py +6 -0
  63. man1lab-1.2.2/interfaces/api/__init__.py +3 -0
  64. man1lab-1.2.2/interfaces/cli/__init__.py +1 -0
  65. man1lab-1.2.2/interfaces/cli/app.py +62 -0
  66. man1lab-1.2.2/interfaces/cli/commands/__init__.py +1 -0
  67. man1lab-1.2.2/interfaces/cli/commands/analyze.py +36 -0
  68. man1lab-1.2.2/interfaces/cli/commands/clean.py +88 -0
  69. man1lab-1.2.2/interfaces/cli/commands/config.py +18 -0
  70. man1lab-1.2.2/interfaces/cli/commands/discover.py +36 -0
  71. man1lab-1.2.2/interfaces/cli/commands/doctor.py +34 -0
  72. man1lab-1.2.2/interfaces/cli/commands/execute.py +36 -0
  73. man1lab-1.2.2/interfaces/cli/commands/init.py +113 -0
  74. man1lab-1.2.2/interfaces/cli/commands/model.py +292 -0
  75. man1lab-1.2.2/interfaces/cli/commands/plan.py +36 -0
  76. man1lab-1.2.2/interfaces/cli/commands/reproduce.py +28 -0
  77. man1lab-1.2.2/interfaces/cli/commands/version.py +12 -0
  78. man1lab-1.2.2/interfaces/cli/common.py +60 -0
  79. man1lab-1.2.2/interfaces/mcp/__init__.py +3 -0
  80. man1lab-1.2.2/interfaces/sdk/__init__.py +12 -0
  81. man1lab-1.2.2/interfaces/sdk/client.py +114 -0
  82. man1lab-1.2.2/llm/__init__.py +15 -0
  83. man1lab-1.2.2/llm/anthropic_provider.py +29 -0
  84. man1lab-1.2.2/llm/coder_mock_provider.py +180 -0
  85. man1lab-1.2.2/llm/compat.py +34 -0
  86. man1lab-1.2.2/llm/factory.py +34 -0
  87. man1lab-1.2.2/llm/mock_provider.py +203 -0
  88. man1lab-1.2.2/llm/openai_provider.py +30 -0
  89. man1lab-1.2.2/llm/provider.py +11 -0
  90. man1lab-1.2.2/llm/response_parser.py +39 -0
  91. man1lab-1.2.2/man1lab/__init__.py +12 -0
  92. man1lab-1.2.2/man1lab/__main__.py +6 -0
  93. man1lab-1.2.2/man1lab.egg-info/PKG-INFO +240 -0
  94. man1lab-1.2.2/man1lab.egg-info/SOURCES.txt +329 -0
  95. man1lab-1.2.2/man1lab.egg-info/dependency_links.txt +1 -0
  96. man1lab-1.2.2/man1lab.egg-info/entry_points.txt +2 -0
  97. man1lab-1.2.2/man1lab.egg-info/requires.txt +14 -0
  98. man1lab-1.2.2/man1lab.egg-info/top_level.txt +23 -0
  99. man1lab-1.2.2/models/__init__.py +68 -0
  100. man1lab-1.2.2/models/execution.py +14 -0
  101. man1lab-1.2.2/models/execution_plan.py +11 -0
  102. man1lab-1.2.2/models/execution_planning_runtime.py +385 -0
  103. man1lab-1.2.2/models/execution_strategy.py +632 -0
  104. man1lab-1.2.2/models/paper.py +19 -0
  105. man1lab-1.2.2/models/paper_reproduction_analysis.py +173 -0
  106. man1lab-1.2.2/models/report.py +41 -0
  107. man1lab-1.2.2/models/research_resource_discovery.py +549 -0
  108. man1lab-1.2.2/models/review.py +11 -0
  109. man1lab-1.2.2/models/review_report.py +12 -0
  110. man1lab-1.2.2/models/routing.py +15 -0
  111. man1lab-1.2.2/models/task.py +17 -0
  112. man1lab-1.2.2/models/verification.py +23 -0
  113. man1lab-1.2.2/models/workspace.py +10 -0
  114. man1lab-1.2.2/planning/__init__.py +3 -0
  115. man1lab-1.2.2/planning/patch_planner.py +38 -0
  116. man1lab-1.2.2/ports/__init__.py +12 -0
  117. man1lab-1.2.2/ports/adaptation_provider.py +19 -0
  118. man1lab-1.2.2/ports/collection_provider.py +21 -0
  119. man1lab-1.2.2/ports/document_parser.py +11 -0
  120. man1lab-1.2.2/ports/evidence_provider.py +26 -0
  121. man1lab-1.2.2/ports/generation_provider.py +19 -0
  122. man1lab-1.2.2/ports/output_format.py +9 -0
  123. man1lab-1.2.2/ports/parsed_document.py +21 -0
  124. man1lab-1.2.2/ports/parser_settings.py +19 -0
  125. man1lab-1.2.2/ports/ranking_provider.py +29 -0
  126. man1lab-1.2.2/ports/resource_binding_provider.py +19 -0
  127. man1lab-1.2.2/ports/reuse_provider.py +19 -0
  128. man1lab-1.2.2/ports/risk_provider.py +19 -0
  129. man1lab-1.2.2/ports/strategy_provider.py +18 -0
  130. man1lab-1.2.2/ports/verification_provider.py +32 -0
  131. man1lab-1.2.2/prompt/__init__.py +5 -0
  132. man1lab-1.2.2/prompt/builder.py +33 -0
  133. man1lab-1.2.2/prompt/exceptions.py +2 -0
  134. man1lab-1.2.2/prompt/loader.py +25 -0
  135. man1lab-1.2.2/prompts/coder/config.md +9 -0
  136. man1lab-1.2.2/prompts/coder/dependencies.md +9 -0
  137. man1lab-1.2.2/prompts/coder/script.md +12 -0
  138. man1lab-1.2.2/prompts/coder/source.md +10 -0
  139. man1lab-1.2.2/prompts/coder/system.md +3 -0
  140. man1lab-1.2.2/prompts/patch_planner/examples.md +19 -0
  141. man1lab-1.2.2/prompts/patch_planner/extraction.md +8 -0
  142. man1lab-1.2.2/prompts/patch_planner/schema.md +12 -0
  143. man1lab-1.2.2/prompts/patch_planner/system.md +10 -0
  144. man1lab-1.2.2/prompts/planner/examples.md +1 -0
  145. man1lab-1.2.2/prompts/planner/extraction.md +3 -0
  146. man1lab-1.2.2/prompts/planner/schema.md +16 -0
  147. man1lab-1.2.2/prompts/planner/system.md +10 -0
  148. man1lab-1.2.2/prompts/reader/examples.md +81 -0
  149. man1lab-1.2.2/prompts/reader/extraction.md +61 -0
  150. man1lab-1.2.2/prompts/reader/output.md +14 -0
  151. man1lab-1.2.2/prompts/reader/schema.md +77 -0
  152. man1lab-1.2.2/prompts/reader/system.md +36 -0
  153. man1lab-1.2.2/prompts/reviewer/examples.md +30 -0
  154. man1lab-1.2.2/prompts/reviewer/extraction.md +9 -0
  155. man1lab-1.2.2/prompts/reviewer/schema.md +13 -0
  156. man1lab-1.2.2/prompts/reviewer/system.md +11 -0
  157. man1lab-1.2.2/providers/__init__.py +24 -0
  158. man1lab-1.2.2/providers/embedded/__init__.py +0 -0
  159. man1lab-1.2.2/providers/embedded/adaptation.py +69 -0
  160. man1lab-1.2.2/providers/embedded/decision_foundation/__init__.py +49 -0
  161. man1lab-1.2.2/providers/embedded/decision_foundation/adaptation_decision.py +385 -0
  162. man1lab-1.2.2/providers/embedded/decision_foundation/binding_decision.py +191 -0
  163. man1lab-1.2.2/providers/embedded/decision_foundation/common.py +39 -0
  164. man1lab-1.2.2/providers/embedded/decision_foundation/dimensions.py +87 -0
  165. man1lab-1.2.2/providers/embedded/decision_foundation/facts.py +199 -0
  166. man1lab-1.2.2/providers/embedded/decision_foundation/generation_decision.py +389 -0
  167. man1lab-1.2.2/providers/embedded/decision_foundation/reuse_decision.py +321 -0
  168. man1lab-1.2.2/providers/embedded/decision_foundation/risk_decision.py +545 -0
  169. man1lab-1.2.2/providers/embedded/decision_foundation/strategy_decision.py +161 -0
  170. man1lab-1.2.2/providers/embedded/embedded_evidence_provider.py +133 -0
  171. man1lab-1.2.2/providers/embedded/embedded_ranking_provider.py +142 -0
  172. man1lab-1.2.2/providers/embedded/embedded_resource_provider.py +379 -0
  173. man1lab-1.2.2/providers/embedded/embedded_verification_provider.py +180 -0
  174. man1lab-1.2.2/providers/embedded/generation.py +68 -0
  175. man1lab-1.2.2/providers/embedded/resource_binding.py +58 -0
  176. man1lab-1.2.2/providers/embedded/reuse.py +65 -0
  177. man1lab-1.2.2/providers/embedded/risk.py +83 -0
  178. man1lab-1.2.2/providers/embedded/strategy.py +58 -0
  179. man1lab-1.2.2/providers/github/__init__.py +50 -0
  180. man1lab-1.2.2/providers/github/auth.py +67 -0
  181. man1lab-1.2.2/providers/github/client.py +162 -0
  182. man1lab-1.2.2/providers/github/collection.py +207 -0
  183. man1lab-1.2.2/providers/github/evidence.py +165 -0
  184. man1lab-1.2.2/providers/github/exceptions.py +35 -0
  185. man1lab-1.2.2/providers/github/mapper.py +212 -0
  186. man1lab-1.2.2/providers/github/models.py +126 -0
  187. man1lab-1.2.2/providers/github/ranking.py +373 -0
  188. man1lab-1.2.2/providers/github/verification.py +473 -0
  189. man1lab-1.2.2/providers/llm/__init__.py +35 -0
  190. man1lab-1.2.2/providers/llm/anthropic_provider.py +156 -0
  191. man1lab-1.2.2/providers/llm/base.py +45 -0
  192. man1lab-1.2.2/providers/llm/deepseek_provider.py +48 -0
  193. man1lab-1.2.2/providers/llm/errors.py +19 -0
  194. man1lab-1.2.2/providers/llm/manager.py +305 -0
  195. man1lab-1.2.2/providers/llm/model_management.py +208 -0
  196. man1lab-1.2.2/providers/llm/models.py +65 -0
  197. man1lab-1.2.2/providers/llm/openai_provider.py +93 -0
  198. man1lab-1.2.2/providers/llm/persistence.py +207 -0
  199. man1lab-1.2.2/providers/llm/profiles.py +250 -0
  200. man1lab-1.2.2/providers/llm/provider_registry.py +43 -0
  201. man1lab-1.2.2/providers/llm/registry.py +132 -0
  202. man1lab-1.2.2/providers/noop/__init__.py +0 -0
  203. man1lab-1.2.2/providers/noop/adaptation.py +19 -0
  204. man1lab-1.2.2/providers/noop/collection.py +8 -0
  205. man1lab-1.2.2/providers/noop/evidence.py +3 -0
  206. man1lab-1.2.2/providers/noop/generation.py +20 -0
  207. man1lab-1.2.2/providers/noop/noop_evidence_provider.py +15 -0
  208. man1lab-1.2.2/providers/noop/noop_ranking_provider.py +17 -0
  209. man1lab-1.2.2/providers/noop/noop_verification_provider.py +15 -0
  210. man1lab-1.2.2/providers/noop/ranking.py +3 -0
  211. man1lab-1.2.2/providers/noop/resource_binding.py +17 -0
  212. man1lab-1.2.2/providers/noop/reuse.py +18 -0
  213. man1lab-1.2.2/providers/noop/risk.py +21 -0
  214. man1lab-1.2.2/providers/noop/strategy.py +16 -0
  215. man1lab-1.2.2/providers/noop/verification.py +3 -0
  216. man1lab-1.2.2/pyproject.toml +77 -0
  217. man1lab-1.2.2/routing/__init__.py +3 -0
  218. man1lab-1.2.2/routing/task_router.py +128 -0
  219. man1lab-1.2.2/services/__init__.py +29 -0
  220. man1lab-1.2.2/services/discovery/__init__.py +0 -0
  221. man1lab-1.2.2/services/discovery/candidate_merge.py +112 -0
  222. man1lab-1.2.2/services/discovery/collection_service.py +86 -0
  223. man1lab-1.2.2/services/discovery/evidence_merge.py +64 -0
  224. man1lab-1.2.2/services/discovery/evidence_service.py +53 -0
  225. man1lab-1.2.2/services/discovery/ranking_merge.py +88 -0
  226. man1lab-1.2.2/services/discovery/ranking_service.py +53 -0
  227. man1lab-1.2.2/services/discovery/verification_merge.py +121 -0
  228. man1lab-1.2.2/services/discovery/verification_service.py +51 -0
  229. man1lab-1.2.2/services/environment_service.py +179 -0
  230. man1lab-1.2.2/services/exceptions.py +30 -0
  231. man1lab-1.2.2/services/execution_planning/__init__.py +17 -0
  232. man1lab-1.2.2/services/execution_planning/adaptation_merge.py +24 -0
  233. man1lab-1.2.2/services/execution_planning/adaptation_service.py +43 -0
  234. man1lab-1.2.2/services/execution_planning/generation_merge.py +24 -0
  235. man1lab-1.2.2/services/execution_planning/generation_service.py +48 -0
  236. man1lab-1.2.2/services/execution_planning/protocols.py +69 -0
  237. man1lab-1.2.2/services/execution_planning/resource_binding_merge.py +34 -0
  238. man1lab-1.2.2/services/execution_planning/resource_binding_service.py +43 -0
  239. man1lab-1.2.2/services/execution_planning/reuse_merge.py +22 -0
  240. man1lab-1.2.2/services/execution_planning/reuse_service.py +42 -0
  241. man1lab-1.2.2/services/execution_planning/risk_merge.py +22 -0
  242. man1lab-1.2.2/services/execution_planning/risk_service.py +45 -0
  243. man1lab-1.2.2/services/execution_planning/strategy_merge.py +20 -0
  244. man1lab-1.2.2/services/execution_planning/strategy_service.py +40 -0
  245. man1lab-1.2.2/services/execution_service.py +119 -0
  246. man1lab-1.2.2/services/pdf_service.py +65 -0
  247. man1lab-1.2.2/services/verification_service.py +223 -0
  248. man1lab-1.2.2/setup.cfg +4 -0
  249. man1lab-1.2.2/setup.py +24 -0
  250. man1lab-1.2.2/tests/test_anthropic_provider.py +211 -0
  251. man1lab-1.2.2/tests/test_cleanup.py +325 -0
  252. man1lab-1.2.2/tests/test_cli.py +168 -0
  253. man1lab-1.2.2/tests/test_coder.py +116 -0
  254. man1lab-1.2.2/tests/test_coder_acceptance.py +140 -0
  255. man1lab-1.2.2/tests/test_coder_contract.py +132 -0
  256. man1lab-1.2.2/tests/test_coder_population.py +281 -0
  257. man1lab-1.2.2/tests/test_coder_quality.py +88 -0
  258. man1lab-1.2.2/tests/test_configuration.py +69 -0
  259. man1lab-1.2.2/tests/test_discovery_collection.py +235 -0
  260. man1lab-1.2.2/tests/test_discovery_evidence.py +212 -0
  261. man1lab-1.2.2/tests/test_discovery_ranking.py +333 -0
  262. man1lab-1.2.2/tests/test_discovery_verification.py +209 -0
  263. man1lab-1.2.2/tests/test_document_parser.py +87 -0
  264. man1lab-1.2.2/tests/test_environment_service.py +164 -0
  265. man1lab-1.2.2/tests/test_execution_planning_adaptation_provider.py +178 -0
  266. man1lab-1.2.2/tests/test_execution_planning_binding_provider.py +338 -0
  267. man1lab-1.2.2/tests/test_execution_planning_generation_provider.py +181 -0
  268. man1lab-1.2.2/tests/test_execution_planning_reuse_provider.py +169 -0
  269. man1lab-1.2.2/tests/test_execution_planning_risk_provider.py +302 -0
  270. man1lab-1.2.2/tests/test_execution_planning_runtime.py +213 -0
  271. man1lab-1.2.2/tests/test_execution_planning_services.py +155 -0
  272. man1lab-1.2.2/tests/test_execution_planning_strategy_provider.py +247 -0
  273. man1lab-1.2.2/tests/test_execution_planning_workflow.py +263 -0
  274. man1lab-1.2.2/tests/test_execution_strategy_builder.py +412 -0
  275. man1lab-1.2.2/tests/test_execution_strategy_model.py +389 -0
  276. man1lab-1.2.2/tests/test_execution_strategy_validation.py +308 -0
  277. man1lab-1.2.2/tests/test_experiment_tracking.py +203 -0
  278. man1lab-1.2.2/tests/test_github_client.py +181 -0
  279. man1lab-1.2.2/tests/test_github_collection_provider.py +394 -0
  280. man1lab-1.2.2/tests/test_github_evidence_provider.py +392 -0
  281. man1lab-1.2.2/tests/test_github_mapper.py +135 -0
  282. man1lab-1.2.2/tests/test_github_models.py +126 -0
  283. man1lab-1.2.2/tests/test_github_ranking_provider.py +514 -0
  284. man1lab-1.2.2/tests/test_github_verification_provider.py +434 -0
  285. man1lab-1.2.2/tests/test_init_wizard.py +377 -0
  286. man1lab-1.2.2/tests/test_llm_provider.py +168 -0
  287. man1lab-1.2.2/tests/test_model_cli.py +249 -0
  288. man1lab-1.2.2/tests/test_model_registry.py +276 -0
  289. man1lab-1.2.2/tests/test_package_distribution.py +199 -0
  290. man1lab-1.2.2/tests/test_paper_reproduction_analysis.py +273 -0
  291. man1lab-1.2.2/tests/test_paper_validation.py +58 -0
  292. man1lab-1.2.2/tests/test_patch_plan.py +240 -0
  293. man1lab-1.2.2/tests/test_pdf_service.py +54 -0
  294. man1lab-1.2.2/tests/test_pipeline_integration.py +70 -0
  295. man1lab-1.2.2/tests/test_planner.py +141 -0
  296. man1lab-1.2.2/tests/test_platform_facade.py +305 -0
  297. man1lab-1.2.2/tests/test_platform_integration.py +260 -0
  298. man1lab-1.2.2/tests/test_prompt.py +82 -0
  299. man1lab-1.2.2/tests/test_reader.py +166 -0
  300. man1lab-1.2.2/tests/test_reader_prompt_integration.py +66 -0
  301. man1lab-1.2.2/tests/test_research_resource_discovery.py +269 -0
  302. man1lab-1.2.2/tests/test_response_parser.py +30 -0
  303. man1lab-1.2.2/tests/test_review.py +199 -0
  304. man1lab-1.2.2/tests/test_script_execution.py +154 -0
  305. man1lab-1.2.2/tests/test_sdk.py +159 -0
  306. man1lab-1.2.2/tests/test_smoke.py +58 -0
  307. man1lab-1.2.2/tests/test_task_routing.py +253 -0
  308. man1lab-1.2.2/tests/test_task_validation.py +92 -0
  309. man1lab-1.2.2/tests/test_verification.py +286 -0
  310. man1lab-1.2.2/tracking/__init__.py +17 -0
  311. man1lab-1.2.2/tracking/bootstrap.py +28 -0
  312. man1lab-1.2.2/tracking/mlflow_tracker.py +67 -0
  313. man1lab-1.2.2/tracking/noop_tracker.py +41 -0
  314. man1lab-1.2.2/tracking/protocol.py +41 -0
  315. man1lab-1.2.2/tracking/provider.py +19 -0
  316. man1lab-1.2.2/tracking/workflow.py +85 -0
  317. man1lab-1.2.2/validation/__init__.py +61 -0
  318. man1lab-1.2.2/validation/analysis_builder.py +16 -0
  319. man1lab-1.2.2/validation/exceptions.py +26 -0
  320. man1lab-1.2.2/validation/execution_strategy.py +1252 -0
  321. man1lab-1.2.2/validation/paper.py +79 -0
  322. man1lab-1.2.2/validation/paper_reproduction_analysis.py +582 -0
  323. man1lab-1.2.2/validation/patch.py +71 -0
  324. man1lab-1.2.2/validation/research_resource_discovery.py +1270 -0
  325. man1lab-1.2.2/validation/review.py +63 -0
  326. man1lab-1.2.2/validation/task.py +103 -0
  327. man1lab-1.2.2/workflow/__init__.py +4 -0
  328. man1lab-1.2.2/workflow/orchestrator.py +176 -0
  329. man1lab-1.2.2/workflow/pipeline.py +32 -0
  330. man1lab-1.2.2/workspace/__init__.py +3 -0
  331. man1lab-1.2.2/workspace/manager.py +177 -0
@@ -0,0 +1,7 @@
1
+ # DeepSeek (OpenAI-compatible) — copy to .env and fill in your key
2
+ OPENAI_API_KEY=sk-your-key-here
3
+ OPENAI_BASE_URL=https://api.deepseek.com
4
+ OPENAI_MODEL=deepseek-v4-pro
5
+
6
+ # Paper parsing backend: docling (default) or pymupdf (legacy fallback)
7
+ PARSER_BACKEND=docling
man1lab-1.2.2/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 maniac1um
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,13 @@
1
+ include LICENSE
2
+ include README.md
3
+ include .env.example
4
+ recursive-include conf *
5
+ recursive-include prompts *
6
+ prune workspace/tasks
7
+ prune outputs
8
+ prune logs
9
+ prune mlruns
10
+ prune .cache
11
+ global-exclude __pycache__
12
+ global-exclude *.py[cod]
13
+ global-exclude .DS_Store
man1lab-1.2.2/PKG-INFO ADDED
@@ -0,0 +1,240 @@
1
+ Metadata-Version: 2.4
2
+ Name: man1lab
3
+ Version: 1.2.2
4
+ Summary: Autonomous research paper reproduction platform
5
+ Author: maniac1um
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/maniac1um/Man1Lab
8
+ Project-URL: Repository, https://github.com/maniac1um/Man1Lab
9
+ Project-URL: Documentation, https://github.com/maniac1um/Man1Lab/blob/main/docs/GETTING_STARTED.md
10
+ Keywords: research,reproduction,machine-learning,agents,pipeline
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
19
+ Requires-Python: >=3.10
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: pydantic>=2.0
23
+ Requires-Dist: pymupdf>=1.24.0
24
+ Requires-Dist: docling>=2.0.0
25
+ Requires-Dist: openai>=1.0.0
26
+ Requires-Dist: anthropic>=0.40.0
27
+ Requires-Dist: python-dotenv>=1.0.0
28
+ Requires-Dist: hydra-core>=1.3.0
29
+ Requires-Dist: mlflow>=2.0.0
30
+ Requires-Dist: httpx>=0.28.0
31
+ Requires-Dist: typer>=0.15.0
32
+ Provides-Extra: dev
33
+ Requires-Dist: pytest>=8.0; extra == "dev"
34
+ Requires-Dist: build>=1.0; extra == "dev"
35
+ Dynamic: license-file
36
+
37
+ # Man1Lab
38
+
39
+ **Engineering-first autonomous research paper reproduction platform.**
40
+
41
+ Man1Lab automates the engineering workflow behind AI paper reproduction — from reading a PDF to discovering official code and checkpoints, planning how to run the work, and driving implementation through a structured pipeline. One command. One platform.
42
+
43
+ [![PyPI version](https://img.shields.io/pypi/v/man1lab)](https://pypi.org/project/man1lab/)
44
+ [![Python Version](https://img.shields.io/pypi/pyversions/man1lab)](https://pypi.org/project/man1lab/)
45
+ [![Latest Release](https://img.shields.io/github/v/release/maniac1um/Man1Lab)](https://github.com/maniac1um/Man1Lab/releases)
46
+ [![Tests](https://img.shields.io/badge/tests-614%20passing-brightgreen)](docs/CURRENT_STATUS.md)
47
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
48
+ [![Documentation](https://img.shields.io/badge/docs-Getting%20Started-blue)](docs/GETTING_STARTED.md)
49
+
50
+ ---
51
+
52
+ ## Why Man1Lab?
53
+
54
+ Reproducing a modern AI paper is an engineering project, not a reading exercise.
55
+
56
+ Researchers and engineers routinely spend days on work that follows the same pattern:
57
+
58
+ | Pain point | What you do today |
59
+ |------------|-------------------|
60
+ | Understand the paper | Read, highlight, and manually extract methods and requirements |
61
+ | Find official resources | Search GitHub, Hugging Face, and project pages by hand |
62
+ | Locate checkpoints and data | Track down weights, configs, and dataset links across sites |
63
+ | Prepare the environment | Create repos, install dependencies, wire configs manually |
64
+ | Bridge paper → code | Map sections of the paper to modules, scripts, and training steps |
65
+ | Connect everything | Stitch analysis, resources, and execution into one coherent plan |
66
+
67
+ **Man1Lab automates this engineering workflow.**
68
+
69
+ Give it a paper. It produces structured analysis, discovers resources, commits an execution strategy, and runs the reproduction pipeline — so you start from engineering decisions, not from scratch.
70
+
71
+ ---
72
+
73
+ ## Core Workflow
74
+
75
+ ```text
76
+ Paper
77
+
78
+ Analysis — Extract reproduction requirements from the PDF
79
+
80
+ Discovery — Find official repositories, checkpoints, and datasets
81
+
82
+ Execution Planning — Commit how the work should be engineered
83
+
84
+ Execution — Plan tasks, generate code, run training, verify, report
85
+ ```
86
+
87
+ Each stage produces a structured artifact that feeds the next. The full pipeline is available through the CLI and Python SDK.
88
+
89
+ ---
90
+
91
+ ## Key Features
92
+
93
+ | Capability | Description | Status |
94
+ |------------|-------------|--------|
95
+ | Paper Analysis | Structured extraction from research PDFs | ✅ |
96
+ | Research Resource Discovery | Evidence-backed search for repos, models, and data | ✅ |
97
+ | Execution Planning | Engineering strategy before implementation | ✅ |
98
+ | CLI | `man1lab` — init, reproduce, model management, and more | ✅ |
99
+ | Python SDK | `from man1lab import Man1Lab` | ✅ |
100
+ | Multi-model Support | Switch LLM providers without editing config files | ✅ |
101
+ | Model Registry | Named profiles, active model, portable export/import | ✅ |
102
+ | OpenAI | GPT-family models | ✅ |
103
+ | DeepSeek | DeepSeek API-compatible models | ✅ |
104
+ | Anthropic | Claude models | ✅ |
105
+ | Package Distribution | `pip install man1lab` | ✅ |
106
+ | Platform Facade | Single entry point for CLI, SDK, and future interfaces | ✅ |
107
+
108
+ ---
109
+
110
+ ## Current Scope
111
+
112
+ Man1Lab targets **engineering-oriented software reproduction** of AI research papers.
113
+
114
+ | Domain | Supported as software reproduction |
115
+ |--------|-------------------------------------|
116
+ | Computer Vision | ✅ |
117
+ | Embodied AI (software stack) | ✅ |
118
+ | LLM Systems | ✅ |
119
+ | Agent Frameworks | ✅ |
120
+ | Reinforcement Learning | ✅ |
121
+
122
+ **What Man1Lab does:** automate analysis, resource discovery, execution planning, and the software reproduction pipeline.
123
+
124
+ **What is outside current scope:** physical robot deployment, hardware setup, calibration, and real-world deployment. Those remain manual engineering work. Man1Lab focuses on the software path from paper to runnable reproduction.
125
+
126
+ ---
127
+
128
+ ## Quick Start
129
+
130
+ ```bash
131
+ pip install man1lab
132
+ man1lab init
133
+ man1lab doctor
134
+ man1lab reproduce paper.pdf
135
+ ```
136
+
137
+ During `init`, you can configure your first LLM provider interactively. Full installation and configuration: [Getting Started](docs/GETTING_STARTED.md).
138
+
139
+ ---
140
+
141
+ ## Example Workflow
142
+
143
+ ```bash
144
+ man1lab reproduce OpenVLA.pdf
145
+ ```
146
+
147
+ ```text
148
+ Analysis completed
149
+
150
+ Official repository discovered
151
+
152
+ Checkpoint and dataset candidates ranked
153
+
154
+ Execution strategy generated
155
+
156
+ Engineering tasks planned → repository built → training run → report
157
+ ```
158
+
159
+ The platform handles the chain from paper to execution. You review outputs and iterate on results.
160
+
161
+ ---
162
+
163
+ ## Project Architecture
164
+
165
+ ```text
166
+ Platform
167
+
168
+ Analysis → Discovery → Execution Planning → Execution
169
+ ```
170
+
171
+ Man1Lab is organized as a single platform with a clear stage-by-stage pipeline. Interfaces (CLI, SDK) delegate to one composition root — no direct coupling to internal agents from user code.
172
+
173
+ Details: [Architecture](docs/architecture/ARCHITECTURE.md)
174
+
175
+ ---
176
+
177
+ ## Roadmap
178
+
179
+ | Version | Focus | Status |
180
+ |---------|-------|--------|
181
+ | **v1.2.x** | Platform foundation, Execution Planning, CLI, SDK, multi-model support | **Completed** |
182
+ | **v1.3** | Repository Understanding — semantic mapping of discovered code to paper modules | Planned |
183
+ | **v1.4** | Repository Adaptation — align discovered repos with paper requirements | Planned |
184
+ | **v1.5** | Knowledge Memory — cross-run reproduction knowledge | Planned |
185
+
186
+ Live status: [Current Status](docs/CURRENT_STATUS.md) · Full roadmap: [ROADMAP.md](ROADMAP.md)
187
+
188
+ ---
189
+
190
+ ## Documentation
191
+
192
+ | Document | Description |
193
+ |----------|-------------|
194
+ | [Getting Started](docs/GETTING_STARTED.md) | Install, configure models, run your first reproduction |
195
+ | [Architecture](docs/architecture/ARCHITECTURE.md) | Platform design and canonical artifacts |
196
+ | [Current Status](docs/CURRENT_STATUS.md) | Capabilities, tests, and known limitations |
197
+ | [Release Notes](docs/releases/v1.2.2.md) | v1.2.2 — LLM platform and first-run experience |
198
+ | [Contributing](CONTRIBUTING.md) | Development setup and contribution guidelines |
199
+ | [Security](SECURITY.md) | Vulnerability reporting |
200
+ | [Support](SUPPORT.md) | Questions, bugs, and feature requests |
201
+
202
+ ---
203
+
204
+ ## Community
205
+
206
+ | Channel | Use for |
207
+ |---------|---------|
208
+ | [GitHub Issues](https://github.com/maniac1um/Man1Lab/issues) | Bug reports and feature requests |
209
+ | [GitHub Discussions](https://github.com/maniac1um/Man1Lab/discussions) | Questions and ideas |
210
+ | [Pull Requests](https://github.com/maniac1um/Man1Lab/pulls) | Code contributions ([guidelines](CONTRIBUTING.md)) |
211
+ | [Security Advisories](https://github.com/maniac1um/Man1Lab/security/advisories/new) | Private vulnerability reports only |
212
+
213
+ Man1Lab is an active research prototype for academic demonstration. See [Contributing](CONTRIBUTING.md) before opening large changes.
214
+
215
+ ---
216
+
217
+ ## Citation
218
+
219
+ ```bibtex
220
+ @software{man1lab_2026,
221
+ author = {maniac1um},
222
+ title = {Man1Lab: An Autonomous Research Paper Reproduction Platform},
223
+ year = {2026},
224
+ version = {1.2.2},
225
+ url = {https://github.com/maniac1um/Man1Lab},
226
+ note = {Engineering-first autonomous research paper reproduction platform.}
227
+ }
228
+ ```
229
+
230
+ Also see [CITATION.cff](CITATION.cff).
231
+
232
+ ---
233
+
234
+ ## License
235
+
236
+ Man1Lab is released under the MIT License. See the `LICENSE` file for details.
237
+
238
+ ---
239
+
240
+ **Maintainer:** [maniac1um](https://github.com/maniac1um)
@@ -0,0 +1,204 @@
1
+ # Man1Lab
2
+
3
+ **Engineering-first autonomous research paper reproduction platform.**
4
+
5
+ Man1Lab automates the engineering workflow behind AI paper reproduction — from reading a PDF to discovering official code and checkpoints, planning how to run the work, and driving implementation through a structured pipeline. One command. One platform.
6
+
7
+ [![PyPI version](https://img.shields.io/pypi/v/man1lab)](https://pypi.org/project/man1lab/)
8
+ [![Python Version](https://img.shields.io/pypi/pyversions/man1lab)](https://pypi.org/project/man1lab/)
9
+ [![Latest Release](https://img.shields.io/github/v/release/maniac1um/Man1Lab)](https://github.com/maniac1um/Man1Lab/releases)
10
+ [![Tests](https://img.shields.io/badge/tests-614%20passing-brightgreen)](docs/CURRENT_STATUS.md)
11
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
12
+ [![Documentation](https://img.shields.io/badge/docs-Getting%20Started-blue)](docs/GETTING_STARTED.md)
13
+
14
+ ---
15
+
16
+ ## Why Man1Lab?
17
+
18
+ Reproducing a modern AI paper is an engineering project, not a reading exercise.
19
+
20
+ Researchers and engineers routinely spend days on work that follows the same pattern:
21
+
22
+ | Pain point | What you do today |
23
+ |------------|-------------------|
24
+ | Understand the paper | Read, highlight, and manually extract methods and requirements |
25
+ | Find official resources | Search GitHub, Hugging Face, and project pages by hand |
26
+ | Locate checkpoints and data | Track down weights, configs, and dataset links across sites |
27
+ | Prepare the environment | Create repos, install dependencies, wire configs manually |
28
+ | Bridge paper → code | Map sections of the paper to modules, scripts, and training steps |
29
+ | Connect everything | Stitch analysis, resources, and execution into one coherent plan |
30
+
31
+ **Man1Lab automates this engineering workflow.**
32
+
33
+ Give it a paper. It produces structured analysis, discovers resources, commits an execution strategy, and runs the reproduction pipeline — so you start from engineering decisions, not from scratch.
34
+
35
+ ---
36
+
37
+ ## Core Workflow
38
+
39
+ ```text
40
+ Paper
41
+
42
+ Analysis — Extract reproduction requirements from the PDF
43
+
44
+ Discovery — Find official repositories, checkpoints, and datasets
45
+
46
+ Execution Planning — Commit how the work should be engineered
47
+
48
+ Execution — Plan tasks, generate code, run training, verify, report
49
+ ```
50
+
51
+ Each stage produces a structured artifact that feeds the next. The full pipeline is available through the CLI and Python SDK.
52
+
53
+ ---
54
+
55
+ ## Key Features
56
+
57
+ | Capability | Description | Status |
58
+ |------------|-------------|--------|
59
+ | Paper Analysis | Structured extraction from research PDFs | ✅ |
60
+ | Research Resource Discovery | Evidence-backed search for repos, models, and data | ✅ |
61
+ | Execution Planning | Engineering strategy before implementation | ✅ |
62
+ | CLI | `man1lab` — init, reproduce, model management, and more | ✅ |
63
+ | Python SDK | `from man1lab import Man1Lab` | ✅ |
64
+ | Multi-model Support | Switch LLM providers without editing config files | ✅ |
65
+ | Model Registry | Named profiles, active model, portable export/import | ✅ |
66
+ | OpenAI | GPT-family models | ✅ |
67
+ | DeepSeek | DeepSeek API-compatible models | ✅ |
68
+ | Anthropic | Claude models | ✅ |
69
+ | Package Distribution | `pip install man1lab` | ✅ |
70
+ | Platform Facade | Single entry point for CLI, SDK, and future interfaces | ✅ |
71
+
72
+ ---
73
+
74
+ ## Current Scope
75
+
76
+ Man1Lab targets **engineering-oriented software reproduction** of AI research papers.
77
+
78
+ | Domain | Supported as software reproduction |
79
+ |--------|-------------------------------------|
80
+ | Computer Vision | ✅ |
81
+ | Embodied AI (software stack) | ✅ |
82
+ | LLM Systems | ✅ |
83
+ | Agent Frameworks | ✅ |
84
+ | Reinforcement Learning | ✅ |
85
+
86
+ **What Man1Lab does:** automate analysis, resource discovery, execution planning, and the software reproduction pipeline.
87
+
88
+ **What is outside current scope:** physical robot deployment, hardware setup, calibration, and real-world deployment. Those remain manual engineering work. Man1Lab focuses on the software path from paper to runnable reproduction.
89
+
90
+ ---
91
+
92
+ ## Quick Start
93
+
94
+ ```bash
95
+ pip install man1lab
96
+ man1lab init
97
+ man1lab doctor
98
+ man1lab reproduce paper.pdf
99
+ ```
100
+
101
+ During `init`, you can configure your first LLM provider interactively. Full installation and configuration: [Getting Started](docs/GETTING_STARTED.md).
102
+
103
+ ---
104
+
105
+ ## Example Workflow
106
+
107
+ ```bash
108
+ man1lab reproduce OpenVLA.pdf
109
+ ```
110
+
111
+ ```text
112
+ Analysis completed
113
+
114
+ Official repository discovered
115
+
116
+ Checkpoint and dataset candidates ranked
117
+
118
+ Execution strategy generated
119
+
120
+ Engineering tasks planned → repository built → training run → report
121
+ ```
122
+
123
+ The platform handles the chain from paper to execution. You review outputs and iterate on results.
124
+
125
+ ---
126
+
127
+ ## Project Architecture
128
+
129
+ ```text
130
+ Platform
131
+
132
+ Analysis → Discovery → Execution Planning → Execution
133
+ ```
134
+
135
+ Man1Lab is organized as a single platform with a clear stage-by-stage pipeline. Interfaces (CLI, SDK) delegate to one composition root — no direct coupling to internal agents from user code.
136
+
137
+ Details: [Architecture](docs/architecture/ARCHITECTURE.md)
138
+
139
+ ---
140
+
141
+ ## Roadmap
142
+
143
+ | Version | Focus | Status |
144
+ |---------|-------|--------|
145
+ | **v1.2.x** | Platform foundation, Execution Planning, CLI, SDK, multi-model support | **Completed** |
146
+ | **v1.3** | Repository Understanding — semantic mapping of discovered code to paper modules | Planned |
147
+ | **v1.4** | Repository Adaptation — align discovered repos with paper requirements | Planned |
148
+ | **v1.5** | Knowledge Memory — cross-run reproduction knowledge | Planned |
149
+
150
+ Live status: [Current Status](docs/CURRENT_STATUS.md) · Full roadmap: [ROADMAP.md](ROADMAP.md)
151
+
152
+ ---
153
+
154
+ ## Documentation
155
+
156
+ | Document | Description |
157
+ |----------|-------------|
158
+ | [Getting Started](docs/GETTING_STARTED.md) | Install, configure models, run your first reproduction |
159
+ | [Architecture](docs/architecture/ARCHITECTURE.md) | Platform design and canonical artifacts |
160
+ | [Current Status](docs/CURRENT_STATUS.md) | Capabilities, tests, and known limitations |
161
+ | [Release Notes](docs/releases/v1.2.2.md) | v1.2.2 — LLM platform and first-run experience |
162
+ | [Contributing](CONTRIBUTING.md) | Development setup and contribution guidelines |
163
+ | [Security](SECURITY.md) | Vulnerability reporting |
164
+ | [Support](SUPPORT.md) | Questions, bugs, and feature requests |
165
+
166
+ ---
167
+
168
+ ## Community
169
+
170
+ | Channel | Use for |
171
+ |---------|---------|
172
+ | [GitHub Issues](https://github.com/maniac1um/Man1Lab/issues) | Bug reports and feature requests |
173
+ | [GitHub Discussions](https://github.com/maniac1um/Man1Lab/discussions) | Questions and ideas |
174
+ | [Pull Requests](https://github.com/maniac1um/Man1Lab/pulls) | Code contributions ([guidelines](CONTRIBUTING.md)) |
175
+ | [Security Advisories](https://github.com/maniac1um/Man1Lab/security/advisories/new) | Private vulnerability reports only |
176
+
177
+ Man1Lab is an active research prototype for academic demonstration. See [Contributing](CONTRIBUTING.md) before opening large changes.
178
+
179
+ ---
180
+
181
+ ## Citation
182
+
183
+ ```bibtex
184
+ @software{man1lab_2026,
185
+ author = {maniac1um},
186
+ title = {Man1Lab: An Autonomous Research Paper Reproduction Platform},
187
+ year = {2026},
188
+ version = {1.2.2},
189
+ url = {https://github.com/maniac1um/Man1Lab},
190
+ note = {Engineering-first autonomous research paper reproduction platform.}
191
+ }
192
+ ```
193
+
194
+ Also see [CITATION.cff](CITATION.cff).
195
+
196
+ ---
197
+
198
+ ## License
199
+
200
+ Man1Lab is released under the MIT License. See the `LICENSE` file for details.
201
+
202
+ ---
203
+
204
+ **Maintainer:** [maniac1um](https://github.com/maniac1um)
@@ -0,0 +1,4 @@
1
+ from adapters.config_parser_settings import ConfigParserSettingsProvider
2
+ from adapters.factory import build_document_parser
3
+
4
+ __all__ = ["ConfigParserSettingsProvider", "build_document_parser"]
@@ -0,0 +1,18 @@
1
+ from configuration.provider import SettingsProvider, get_settings_provider
2
+ from ports.output_format import OutputFormat
3
+ from ports.parser_settings import ParserSettings, ParserSettingsProvider
4
+
5
+
6
+ class ConfigParserSettingsProvider:
7
+ """Read parser settings from the application settings provider."""
8
+
9
+ def __init__(self, settings_provider: SettingsProvider | None = None) -> None:
10
+ self._settings_provider = settings_provider or get_settings_provider()
11
+
12
+ def get_parser_settings(self) -> ParserSettings:
13
+ settings = self._settings_provider.get_settings()
14
+ return ParserSettings(
15
+ backend=settings.parser.backend.strip().lower(),
16
+ output_format=OutputFormat.MARKDOWN,
17
+ max_paper_text_chars=settings.parser.max_paper_text_chars,
18
+ )
@@ -0,0 +1,88 @@
1
+ import logging
2
+ import time
3
+ from pathlib import Path
4
+
5
+ from docling.backend.pypdfium2_backend import PyPdfiumDocumentBackend
6
+ from docling.datamodel.base_models import InputFormat
7
+ from docling.datamodel.pipeline_options import PdfPipelineOptions
8
+ from docling.document_converter import DocumentConverter, PdfFormatOption
9
+
10
+ from adapters.output_export import export_docling_document
11
+ from ports.output_format import OutputFormat
12
+ from ports.parsed_document import ParsedDocument
13
+ from services.exceptions import (
14
+ PDFEmptyError,
15
+ PDFEncryptedError,
16
+ PDFExtractionError,
17
+ PDFNotFoundError,
18
+ )
19
+
20
+ logger = logging.getLogger(__name__)
21
+
22
+
23
+ class DoclingParser:
24
+ """Document parser backed by Docling structured document export."""
25
+
26
+ def __init__(
27
+ self,
28
+ converter: DocumentConverter | None = None,
29
+ *,
30
+ output_format: OutputFormat = OutputFormat.MARKDOWN,
31
+ max_paper_text_chars: int = 80_000,
32
+ ) -> None:
33
+ self._converter = converter or _build_converter()
34
+ self._output_format = output_format
35
+ self._max_paper_text_chars = max_paper_text_chars
36
+
37
+ def parse(self, paper_path: Path) -> ParsedDocument:
38
+ if not paper_path.exists():
39
+ raise PDFNotFoundError(f"PDF not found: {paper_path}")
40
+
41
+ start = time.perf_counter()
42
+ try:
43
+ result = self._converter.convert(str(paper_path))
44
+ except Exception as exc:
45
+ message = str(exc).lower()
46
+ if "encrypt" in message or "password" in message:
47
+ raise PDFEncryptedError(
48
+ f"PDF is encrypted and cannot be read: {paper_path}"
49
+ ) from exc
50
+ raise PDFExtractionError(
51
+ f"Failed to parse PDF with Docling: {paper_path}"
52
+ ) from exc
53
+
54
+ markdown = export_docling_document(
55
+ result.document,
56
+ self._output_format,
57
+ )
58
+ if not markdown:
59
+ raise PDFEmptyError(f"PDF contains no extractable text: {paper_path}")
60
+
61
+ if self._max_paper_text_chars and len(markdown) > self._max_paper_text_chars:
62
+ markdown = markdown[: self._max_paper_text_chars]
63
+
64
+ duration = time.perf_counter() - start
65
+ logger.info(
66
+ "Docling parse complete: chars=%d duration=%.3fs file=%s status=%s format=%s",
67
+ len(markdown),
68
+ duration,
69
+ paper_path.name,
70
+ getattr(result, "status", "unknown"),
71
+ self._output_format.value,
72
+ )
73
+ return ParsedDocument(markdown=markdown)
74
+
75
+
76
+ def _build_converter() -> DocumentConverter:
77
+ pipeline_options = PdfPipelineOptions(
78
+ do_ocr=False,
79
+ do_table_structure=True,
80
+ )
81
+ return DocumentConverter(
82
+ format_options={
83
+ InputFormat.PDF: PdfFormatOption(
84
+ pipeline_options=pipeline_options,
85
+ backend=PyPdfiumDocumentBackend,
86
+ )
87
+ }
88
+ )
@@ -0,0 +1,31 @@
1
+ from adapters.config_parser_settings import ConfigParserSettingsProvider
2
+ from adapters.docling_parser import DoclingParser
3
+ from adapters.pymupdf_parser import PyMuPDFParser
4
+ from ports.document_parser import DocumentParser
5
+ from ports.parser_settings import ParserSettings, ParserSettingsProvider
6
+
7
+ _SUPPORTED_BACKENDS = frozenset({"docling", "pymupdf"})
8
+
9
+
10
+ def build_document_parser(
11
+ settings: ParserSettings | None = None,
12
+ settings_provider: ParserSettingsProvider | None = None,
13
+ ) -> DocumentParser:
14
+ """Construct a document parser from explicit or provider-supplied settings."""
15
+ if settings is None:
16
+ provider = settings_provider or ConfigParserSettingsProvider()
17
+ settings = provider.get_parser_settings()
18
+
19
+ backend = settings.backend.strip().lower()
20
+ if backend not in _SUPPORTED_BACKENDS:
21
+ supported = ", ".join(sorted(_SUPPORTED_BACKENDS))
22
+ raise ValueError(
23
+ f"Unsupported parser backend={settings.backend!r}. "
24
+ f"Expected one of: {supported}"
25
+ )
26
+ if backend == "pymupdf":
27
+ return PyMuPDFParser()
28
+ return DoclingParser(
29
+ output_format=settings.output_format,
30
+ max_paper_text_chars=settings.max_paper_text_chars,
31
+ )
@@ -0,0 +1,21 @@
1
+ from typing import Any
2
+
3
+ from ports.output_format import OutputFormat
4
+
5
+
6
+ def export_docling_document(
7
+ document: Any,
8
+ output_format: OutputFormat,
9
+ ) -> str:
10
+ """Serialize a Docling document using the configured output format."""
11
+ if output_format is OutputFormat.MARKDOWN:
12
+ return document.export_to_markdown().strip()
13
+ if output_format is OutputFormat.JSON:
14
+ raise NotImplementedError(
15
+ "OutputFormat.JSON is reserved for future Docling export support."
16
+ )
17
+ if output_format is OutputFormat.DOCTAGS:
18
+ raise NotImplementedError(
19
+ "OutputFormat.DOCTAGS is reserved for future Docling export support."
20
+ )
21
+ raise ValueError(f"Unsupported output format: {output_format!r}")
@@ -0,0 +1,15 @@
1
+ from pathlib import Path
2
+
3
+ from ports.parsed_document import ParsedDocument
4
+ from services.pdf_service import PDFService
5
+
6
+
7
+ class PyMuPDFParser:
8
+ """Document parser backed by PyMuPDF plain-text extraction (legacy fallback)."""
9
+
10
+ def __init__(self, pdf_service: PDFService | None = None) -> None:
11
+ self._pdf_service = pdf_service or PDFService()
12
+
13
+ def parse(self, paper_path: Path) -> ParsedDocument:
14
+ text = self._pdf_service.extract(paper_path)
15
+ return ParsedDocument(markdown=text)
@@ -0,0 +1,8 @@
1
+ from agents.coder import Coder
2
+ from agents.planner import Planner
3
+ from agents.reader import Reader
4
+ from agents.reporter import Reporter
5
+ from agents.reviewer import Reviewer
6
+ from agents.runner import Runner
7
+
8
+ __all__ = ["Coder", "Planner", "Reader", "Reporter", "Reviewer", "Runner"]