@louisultra/dsh-verymath 0.0.0-stage → 0.3.2

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 (284) hide show
  1. package/CHANGELOG.md +133 -0
  2. package/LICENSE +21 -0
  3. package/NOTICE.md +35 -0
  4. package/README.md +108 -2
  5. package/README_EN.md +105 -0
  6. package/UPSTREAM.json +106 -0
  7. package/cordis.patch.yml +12 -0
  8. package/docs/capability-examples.md +581 -0
  9. package/docs/examples/README.md +32 -0
  10. package/docs/examples/bad_scan.md +10 -0
  11. package/docs/examples/broken-proof.lean +9 -0
  12. package/docs/examples/claims.md +7 -0
  13. package/docs/examples/knapsack.json +10 -0
  14. package/docs/examples/matrix.json +1 -0
  15. package/docs/examples/points.csv +21 -0
  16. package/docs/examples/qp.json +8 -0
  17. package/docs/examples/research-ws/project/GOALS.yaml +4 -0
  18. package/docs/examples/research-ws/workstreams/ws-lsa/report.md +13 -0
  19. package/docs/examples/research-ws/workstreams/ws-lsa/reviews/r1.json +1 -0
  20. package/docs/examples/research-ws/workstreams/ws-lsa/status.yaml +1 -0
  21. package/docs/examples/source.csv +4 -0
  22. package/lib/core/error.d.ts +20 -0
  23. package/lib/core/error.js +25 -0
  24. package/lib/core/gates.d.ts +42 -0
  25. package/lib/core/gates.js +217 -0
  26. package/lib/core/glossary.d.ts +101 -0
  27. package/lib/core/glossary.js +243 -0
  28. package/lib/core/graph.d.ts +118 -0
  29. package/lib/core/graph.js +460 -0
  30. package/lib/core/index.d.ts +120 -0
  31. package/lib/core/index.js +197 -0
  32. package/lib/core/paper.d.ts +163 -0
  33. package/lib/core/paper.js +73 -0
  34. package/lib/core/paths.d.ts +2 -0
  35. package/lib/core/paths.js +12 -0
  36. package/lib/core/sage.d.ts +61 -0
  37. package/lib/core/sage.js +212 -0
  38. package/lib/core/skills.d.ts +11 -0
  39. package/lib/core/skills.js +110 -0
  40. package/lib/tool/index.d.ts +21 -0
  41. package/lib/tool/index.js +1144 -0
  42. package/package.json +92 -4
  43. package/skills/after-ocr/SKILL.md +123 -0
  44. package/skills/after-ocr/references/audit-schema.md +94 -0
  45. package/skills/after-ocr/references/error-taxonomy.md +179 -0
  46. package/skills/after-ocr/scripts/merge_audit_logs.py +329 -0
  47. package/skills/after-ocr/scripts/scan_markdown_ocr.py +350 -0
  48. package/skills/after-ocr/tests/test_scripts.py +84 -0
  49. package/skills/discover-math-problems/SKILL.md +115 -0
  50. package/skills/discover-math-problems/references/artifact-contract.md +93 -0
  51. package/skills/discover-math-problems/references/autonomous-research-protocol.md +86 -0
  52. package/skills/discover-math-problems/references/conjecture-generation-protocol.md +63 -0
  53. package/skills/discover-math-problems/references/extremal-graph-variants.md +53 -0
  54. package/skills/graph-theory-paper-reading/SKILL.md +600 -0
  55. package/skills/invariant-computation/SKILL.md +169 -0
  56. package/skills/invariant-computation/examples/invariant_summary.example.json +51 -0
  57. package/skills/invariant-computation/manifest.yaml +46 -0
  58. package/skills/invariant-computation/references/INDEX.md +20 -0
  59. package/skills/invariant-computation/references/failure_modes.md +40 -0
  60. package/skills/invariant-computation/references/method_route_map.md +177 -0
  61. package/skills/invariant-computation/references/source_notes.md +19 -0
  62. package/skills/invariant-computation/references/tool_catalog.md +65 -0
  63. package/skills/invariant-computation/references/validation_checks.md +52 -0
  64. package/skills/invariant-computation/schema/invariant_summary.schema.json +260 -0
  65. package/skills/lean-formalization/SKILL.md +111 -0
  66. package/skills/lean-formalization/lean-runtime/config/env.example +5 -0
  67. package/skills/lean-formalization/lean-runtime/config/lean_agent.example.toml +28 -0
  68. package/skills/lean-formalization/lean-runtime/config/numina_runtime.example.toml +12 -0
  69. package/skills/lean-formalization/lean-runtime/examples/smoke/LocalLeanSmoke.lean +7 -0
  70. package/skills/lean-formalization/lean-runtime/prompts/complete_sorries.md +3 -0
  71. package/skills/lean-formalization/lean-runtime/prompts/formalize_statement.md +3 -0
  72. package/skills/lean-formalization/lean-runtime/prompts/prove_theorem.md +3 -0
  73. package/skills/lean-formalization/lean-runtime/prompts/repair_lean_file.md +3 -0
  74. package/skills/lean-formalization/lean-runtime/references/backend_adapter_checklist.md +36 -0
  75. package/skills/lean-formalization/lean-runtime/references/direct_lean_workflow.md +48 -0
  76. package/skills/lean-formalization/lean-runtime/references/failure_taxonomy.md +17 -0
  77. package/skills/lean-formalization/lean-runtime/references/interactive_orchestration.md +83 -0
  78. package/skills/lean-formalization/lean-runtime/references/lean_agent_capability_map.md +116 -0
  79. package/skills/lean-formalization/lean-runtime/references/lean_lsp_mcp_adapter.md +219 -0
  80. package/skills/lean-formalization/lean-runtime/references/lean_runtime_configuration.md +92 -0
  81. package/skills/lean-formalization/lean-runtime/references/numina_reverse_analysis.md +80 -0
  82. package/skills/lean-formalization/lean-runtime/references/numina_runtime.md +41 -0
  83. package/skills/lean-formalization/lean-runtime/references/numina_subagent_troubleshooting.md +77 -0
  84. package/skills/lean-formalization/lean-runtime/references/review_checklist.md +10 -0
  85. package/skills/lean-formalization/lean-runtime/references/specialist_agent_patterns.md +65 -0
  86. package/skills/lean-formalization/lean-runtime/schemas/config.schema.json +12 -0
  87. package/skills/lean-formalization/lean-runtime/schemas/result.schema.json +33 -0
  88. package/skills/lean-formalization/lean-runtime/schemas/task.schema.json +30 -0
  89. package/skills/lean-formalization/lean-runtime/scripts/ai4m_lean.py +222 -0
  90. package/skills/lean-formalization/lean-runtime/scripts/check_lean_project.py +134 -0
  91. package/skills/lean-formalization/lean-runtime/scripts/common.py +296 -0
  92. package/skills/lean-formalization/lean-runtime/scripts/configure_lean.py +222 -0
  93. package/skills/lean-formalization/lean-runtime/scripts/detect_sorry.py +49 -0
  94. package/skills/lean-formalization/lean-runtime/scripts/direct_task.py +100 -0
  95. package/skills/lean-formalization/lean-runtime/scripts/extract_minimal_failure.py +74 -0
  96. package/skills/lean-formalization/lean-runtime/scripts/numina_runtime.py +414 -0
  97. package/skills/lean-formalization/lean-runtime/scripts/smoke_test.py +75 -0
  98. package/skills/lean-formalization/lean-runtime/scripts/tool_status.py +79 -0
  99. package/skills/lean-formalization/lean-runtime/scripts/validate_patch.py +81 -0
  100. package/skills/lean-formalization/lean-runtime/scripts/verify_delivery.py +484 -0
  101. package/skills/lean-formalization/lean-runtime/tests/fixtures/after_bad.lean +4 -0
  102. package/skills/lean-formalization/lean-runtime/tests/fixtures/after_statement_changed.lean +4 -0
  103. package/skills/lean-formalization/lean-runtime/tests/fixtures/before.lean +4 -0
  104. package/skills/lean-formalization/lean-runtime/tests/fixtures/failure.lean +7 -0
  105. package/skills/lean-formalization/lean-runtime/tests/test_check_lean_project.py +59 -0
  106. package/skills/lean-formalization/lean-runtime/tests/test_cli.py +377 -0
  107. package/skills/lean-formalization/lean-runtime/tests/test_common_config.py +84 -0
  108. package/skills/lean-formalization/lean-runtime/tests/test_configure_lean.py +138 -0
  109. package/skills/lean-formalization/lean-runtime/tests/test_detect_sorry.py +24 -0
  110. package/skills/lean-formalization/lean-runtime/tests/test_direct_task.py +69 -0
  111. package/skills/lean-formalization/lean-runtime/tests/test_numina_runtime.py +168 -0
  112. package/skills/lean-formalization/lean-runtime/tests/test_validate_patch.py +29 -0
  113. package/skills/lean-setup/SKILL.md +99 -0
  114. package/skills/least-squares/README.md +85 -0
  115. package/skills/least-squares/SKILL.md +613 -0
  116. package/skills/least-squares/examples.md +380 -0
  117. package/skills/math-beamer/SKILL.md +325 -0
  118. package/skills/math-beamer/references/build-and-layout-audit.md +63 -0
  119. package/skills/math-beamer/references/math-domain-patterns.md +56 -0
  120. package/skills/math-beamer/references/template-policy.md +43 -0
  121. package/skills/math-beamer/references/template-source-index.md +51 -0
  122. package/skills/math-beamer/templates/catalog.yaml +235 -0
  123. package/skills/math-beamer/templates/packs/algebra-number-theory-talk/main.tex +45 -0
  124. package/skills/math-beamer/templates/packs/algebra-number-theory-talk/template.yaml +9 -0
  125. package/skills/math-beamer/templates/packs/algorithm-talk/main.tex +43 -0
  126. package/skills/math-beamer/templates/packs/algorithm-talk/template.yaml +9 -0
  127. package/skills/math-beamer/templates/packs/analysis-core-talk/main.tex +49 -0
  128. package/skills/math-beamer/templates/packs/analysis-core-talk/template.yaml +19 -0
  129. package/skills/math-beamer/templates/packs/backup-heavy-talk/main.tex +40 -0
  130. package/skills/math-beamer/templates/packs/backup-heavy-talk/template.yaml +9 -0
  131. package/skills/math-beamer/templates/packs/beamerposter-a0/main.tex +45 -0
  132. package/skills/math-beamer/templates/packs/beamerposter-a0/template.yaml +12 -0
  133. package/skills/math-beamer/templates/packs/combinatorics-graph-talk/main.tex +53 -0
  134. package/skills/math-beamer/templates/packs/combinatorics-graph-talk/template.yaml +18 -0
  135. package/skills/math-beamer/templates/packs/control-systems-talk/main.tex +51 -0
  136. package/skills/math-beamer/templates/packs/control-systems-talk/template.yaml +18 -0
  137. package/skills/math-beamer/templates/packs/course-lecture-zh/main.tex +43 -0
  138. package/skills/math-beamer/templates/packs/course-lecture-zh/template.yaml +9 -0
  139. package/skills/math-beamer/templates/packs/data-experiment-results/main.tex +45 -0
  140. package/skills/math-beamer/templates/packs/data-experiment-results/template.yaml +9 -0
  141. package/skills/math-beamer/templates/packs/dynamical-systems-talk/main.tex +42 -0
  142. package/skills/math-beamer/templates/packs/dynamical-systems-talk/template.yaml +9 -0
  143. package/skills/math-beamer/templates/packs/geometry-topology-talk/main.tex +43 -0
  144. package/skills/math-beamer/templates/packs/geometry-topology-talk/template.yaml +9 -0
  145. package/skills/math-beamer/templates/packs/information-coding-crypto-talk/main.tex +49 -0
  146. package/skills/math-beamer/templates/packs/information-coding-crypto-talk/template.yaml +18 -0
  147. package/skills/math-beamer/templates/packs/logic-foundations-category-talk/main.tex +51 -0
  148. package/skills/math-beamer/templates/packs/logic-foundations-category-talk/template.yaml +18 -0
  149. package/skills/math-beamer/templates/packs/numerical-analysis-talk/main.tex +51 -0
  150. package/skills/math-beamer/templates/packs/numerical-analysis-talk/template.yaml +9 -0
  151. package/skills/math-beamer/templates/packs/optimization-talk/main.tex +58 -0
  152. package/skills/math-beamer/templates/packs/optimization-talk/template.yaml +9 -0
  153. package/skills/math-beamer/templates/packs/pde-analysis-talk/main.tex +49 -0
  154. package/skills/math-beamer/templates/packs/pde-analysis-talk/template.yaml +9 -0
  155. package/skills/math-beamer/templates/packs/probability-statistics-talk/main.tex +52 -0
  156. package/skills/math-beamer/templates/packs/probability-statistics-talk/template.yaml +9 -0
  157. package/skills/math-beamer/templates/packs/reading-group-paper/main.tex +46 -0
  158. package/skills/math-beamer/templates/packs/reading-group-paper/template.yaml +9 -0
  159. package/skills/math-beamer/templates/packs/seminar-minimal-en/main.tex +60 -0
  160. package/skills/math-beamer/templates/packs/seminar-minimal-en/template.yaml +13 -0
  161. package/skills/math-beamer/templates/packs/seminar-minimal-zh/main.tex +60 -0
  162. package/skills/math-beamer/templates/packs/seminar-minimal-zh/template.yaml +13 -0
  163. package/skills/math-beamer/templates/packs/theorem-proof-talk/main.tex +60 -0
  164. package/skills/math-beamer/templates/packs/theorem-proof-talk/template.yaml +9 -0
  165. package/skills/math-beamer/templates/packs/thesis-defense/main.tex +42 -0
  166. package/skills/math-beamer/templates/packs/thesis-defense/template.yaml +9 -0
  167. package/skills/math-beamer/templates/packs/workshop-tutorial/main.tex +32 -0
  168. package/skills/math-beamer/templates/packs/workshop-tutorial/template.yaml +9 -0
  169. package/skills/math-beamer/templates/preview-gallery.md +32 -0
  170. package/skills/math-beamer/templates/previews/algebra-number-theory-talk-content.png +0 -0
  171. package/skills/math-beamer/templates/previews/algebra-number-theory-talk-cover.png +0 -0
  172. package/skills/math-beamer/templates/previews/algorithm-talk-content.png +0 -0
  173. package/skills/math-beamer/templates/previews/algorithm-talk-cover.png +0 -0
  174. package/skills/math-beamer/templates/previews/analysis-core-talk-content.png +0 -0
  175. package/skills/math-beamer/templates/previews/analysis-core-talk-cover.png +0 -0
  176. package/skills/math-beamer/templates/previews/backup-heavy-talk-content.png +0 -0
  177. package/skills/math-beamer/templates/previews/backup-heavy-talk-cover.png +0 -0
  178. package/skills/math-beamer/templates/previews/beamerposter-a0-content.png +0 -0
  179. package/skills/math-beamer/templates/previews/beamerposter-a0-cover.png +0 -0
  180. package/skills/math-beamer/templates/previews/combinatorics-graph-talk-content.png +0 -0
  181. package/skills/math-beamer/templates/previews/combinatorics-graph-talk-cover.png +0 -0
  182. package/skills/math-beamer/templates/previews/control-systems-talk-content.png +0 -0
  183. package/skills/math-beamer/templates/previews/control-systems-talk-cover.png +0 -0
  184. package/skills/math-beamer/templates/previews/course-lecture-zh-content.png +0 -0
  185. package/skills/math-beamer/templates/previews/course-lecture-zh-cover.png +0 -0
  186. package/skills/math-beamer/templates/previews/data-experiment-results-content.png +0 -0
  187. package/skills/math-beamer/templates/previews/data-experiment-results-cover.png +0 -0
  188. package/skills/math-beamer/templates/previews/dynamical-systems-talk-content.png +0 -0
  189. package/skills/math-beamer/templates/previews/dynamical-systems-talk-cover.png +0 -0
  190. package/skills/math-beamer/templates/previews/geometry-topology-talk-content.png +0 -0
  191. package/skills/math-beamer/templates/previews/geometry-topology-talk-cover.png +0 -0
  192. package/skills/math-beamer/templates/previews/information-coding-crypto-talk-content.png +0 -0
  193. package/skills/math-beamer/templates/previews/information-coding-crypto-talk-cover.png +0 -0
  194. package/skills/math-beamer/templates/previews/logic-foundations-category-talk-content.png +0 -0
  195. package/skills/math-beamer/templates/previews/logic-foundations-category-talk-cover.png +0 -0
  196. package/skills/math-beamer/templates/previews/numerical-analysis-talk-content.png +0 -0
  197. package/skills/math-beamer/templates/previews/numerical-analysis-talk-cover.png +0 -0
  198. package/skills/math-beamer/templates/previews/optimization-talk-content.png +0 -0
  199. package/skills/math-beamer/templates/previews/optimization-talk-cover.png +0 -0
  200. package/skills/math-beamer/templates/previews/pde-analysis-talk-content.png +0 -0
  201. package/skills/math-beamer/templates/previews/pde-analysis-talk-cover.png +0 -0
  202. package/skills/math-beamer/templates/previews/probability-statistics-talk-content.png +0 -0
  203. package/skills/math-beamer/templates/previews/probability-statistics-talk-cover.png +0 -0
  204. package/skills/math-beamer/templates/previews/reading-group-paper-content.png +0 -0
  205. package/skills/math-beamer/templates/previews/reading-group-paper-cover.png +0 -0
  206. package/skills/math-beamer/templates/previews/seminar-minimal-en-content.png +0 -0
  207. package/skills/math-beamer/templates/previews/seminar-minimal-en-cover.png +0 -0
  208. package/skills/math-beamer/templates/previews/seminar-minimal-zh-content.png +0 -0
  209. package/skills/math-beamer/templates/previews/seminar-minimal-zh-cover.png +0 -0
  210. package/skills/math-beamer/templates/previews/theorem-proof-talk-content.png +0 -0
  211. package/skills/math-beamer/templates/previews/theorem-proof-talk-cover.png +0 -0
  212. package/skills/math-beamer/templates/previews/thesis-defense-content.png +0 -0
  213. package/skills/math-beamer/templates/previews/thesis-defense-cover.png +0 -0
  214. package/skills/math-beamer/templates/previews/workshop-tutorial-content.png +0 -0
  215. package/skills/math-beamer/templates/previews/workshop-tutorial-cover.png +0 -0
  216. package/skills/math-beamer/templates/review-report.md +54 -0
  217. package/skills/math-beamer/templates/slide-source-ledger.md +22 -0
  218. package/skills/math-beamer/templates/source-packet.md +50 -0
  219. package/skills/math-glossary/SKILL.md +347 -0
  220. package/skills/math-glossary/references/glossary-schema.md +71 -0
  221. package/skills/math-glossary/references/glossary-usage-guide.md +176 -0
  222. package/skills/math-glossary/references/glossary-web-template.md +127 -0
  223. package/skills/math-glossary/references/glossary.schema.json +76 -0
  224. package/skills/math-glossary/references/user-manual.md +435 -0
  225. package/skills/math-glossary/requirements-ai.txt +3 -0
  226. package/skills/math-glossary/requirements.txt +3 -0
  227. package/skills/math-glossary/scripts/glossary_backup.py +42 -0
  228. package/skills/math-glossary/scripts/glossary_build.py +467 -0
  229. package/skills/math-glossary/scripts/glossary_enrich_examples.py +283 -0
  230. package/skills/math-glossary/scripts/glossary_export.py +333 -0
  231. package/skills/math-glossary/scripts/glossary_web.py +1265 -0
  232. package/skills/math-paper-reading/README.md +163 -0
  233. package/skills/math-paper-reading/SKILL.md +48 -0
  234. package/skills/math-paper-reading/agent_router.md +36 -0
  235. package/skills/math-paper-reading/references/proof_pattern_taxonomy.md +123 -0
  236. package/skills/math-paper-reading/references/quality_rubric.md +36 -0
  237. package/skills/math-paper-reading/skill_base.md +627 -0
  238. package/skills/math-paper-reading/skill_literature_search.md +866 -0
  239. package/skills/math-paper-reading/skill_paper_deep_read.md +1024 -0
  240. package/skills/math-paper-reading/skill_pathway_proof.md +718 -0
  241. package/skills/math-paper-reading/skill_reference_manager.md +746 -0
  242. package/skills/matlab-runner/SKILL.md +217 -0
  243. package/skills/matlab-runner/examples/README.md +33 -0
  244. package/skills/matlab-runner/examples/matrix_report.m +28 -0
  245. package/skills/matlab-runner/examples/plot_damped_sine.m +64 -0
  246. package/skills/matlab-runner/examples/test_vector_norm.m +12 -0
  247. package/skills/matlab-runner/references/client-setup.md +24 -0
  248. package/skills/matlab-runner/references/file-session-safety.md +86 -0
  249. package/skills/matlab-runner/references/numerical-safety.md +126 -0
  250. package/skills/matlab-runner/references/resource-safety.md +125 -0
  251. package/skills/mixed-integer-programming/SKILL.md +119 -0
  252. package/skills/mixed-integer-programming/lp-examples.md +251 -0
  253. package/skills/mixed-integer-programming/mip-examples-verified.md +118 -0
  254. package/skills/open-problem-research-pipeline/SKILL.md +76 -0
  255. package/skills/open-problem-research-pipeline/skill_literature_analysis.md +201 -0
  256. package/skills/open-problem-research-pipeline/skill_literature_proof_framework.md +206 -0
  257. package/skills/open-problem-research-pipeline/skill_literature_search.md +172 -0
  258. package/skills/open-problem-research-pipeline/skill_qskill.md +177 -0
  259. package/skills/osqp-solver/SKILL.md +245 -0
  260. package/skills/osqp-solver/references/citation.md +25 -0
  261. package/skills/osqp-solver/references/dual-infeasible-example.json +14 -0
  262. package/skills/osqp-solver/references/feasible-example.json +21 -0
  263. package/skills/osqp-solver/references/primal-infeasible-example.json +17 -0
  264. package/skills/osqp-solver/references/python-api.md +95 -0
  265. package/skills/osqp-solver/references/verification.md +94 -0
  266. package/skills/osqp-solver/scripts/check_osqp_environment.py +120 -0
  267. package/skills/osqp-solver/scripts/solve_qp.py +943 -0
  268. package/skills/paper-writing/SKILL.md +115 -0
  269. package/skills/paper-writing/skill_claim_evidence_ledger.md +55 -0
  270. package/skills/paper-writing/skill_formula_environment_and_readability.md +41 -0
  271. package/skills/paper-writing/skill_latex_build_and_layout_audit.md +73 -0
  272. package/skills/paper-writing/skill_notation_and_variable_consistency.md +42 -0
  273. package/skills/paper-writing/skill_paper_skeleton_and_logical_architecture.md +54 -0
  274. package/skills/paper-writing/skill_proof_obligation_and_assumption_audit.md +57 -0
  275. package/skills/paper-writing/templates/claim-evidence-ledger.md +23 -0
  276. package/skills/paper-writing/templates/proof-obligation-ledger.md +22 -0
  277. package/skills/paper-writing/templates/rapid-prototype-paper-skeleton.md +46 -0
  278. package/skills/paper-writing/templates/source-packet.md +37 -0
  279. package/skills/paper-writing/templates/submission-readiness.md +41 -0
  280. package/skills/proof-blueprint-review/SKILL.md +129 -0
  281. package/skills/proof-blueprint-review/references/agent-mediated-proof-protocol.md +57 -0
  282. package/skills/proof-blueprint-review/references/generation-agent.md +45 -0
  283. package/skills/proof-blueprint-review/references/proof-acceptance-contract.md +41 -0
  284. package/skills/proof-blueprint-review/references/verification-agent.md +37 -0
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "tiny-qp",
3
+ "P": [[4.0, 1.0], [1.0, 2.0]],
4
+ "q": [1.0, 1.0],
5
+ "A": [[1.0, 1.0]],
6
+ "l": [1.0],
7
+ "u": [1.0]
8
+ }
@@ -0,0 +1,4 @@
1
+ goals:
2
+ - id: g1
3
+ title: LSA convergence analysis
4
+ status: approved
@@ -0,0 +1,13 @@
1
+ # LSA Workstream Report
2
+
3
+ ## Provenance
4
+
5
+ All results derived from the referenced papers.
6
+
7
+ ## Uncertainty
8
+
9
+ Convergence rate constants estimated numerically.
10
+
11
+ ## Failed Explorations
12
+
13
+ Direct spectral method failed (documented).
@@ -0,0 +1 @@
1
+ {"reviewer": "reviewer_independent", "approved": true}
@@ -0,0 +1 @@
1
+ coordinator: main_agent
@@ -0,0 +1,4 @@
1
+ en,cn,pos,field
2
+ homology,同调,名词,代数拓扑
3
+ homotopy group,同伦群,名词,代数拓扑
4
+ fiber bundle,纤维丛,名词,微分几何
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Structured error type for the VeryMath capability seam.
3
+ * @module @louisultra/dsh-verymath/core
4
+ */
5
+ /** Machine-readable error codes carried by every {@link VeryMathError}. */
6
+ export type VeryMathErrorCode = 'VERYMATH_GLOSSARY_UNAVAILABLE' | 'VERYMATH_GLOSSARY_INVALID' | 'VERYMATH_PAPER_INVALID' | 'VERYMATH_PYTHON_UNAVAILABLE' | 'VERYMATH_SAGE_CORPUS_MISSING' | 'VERYMATH_IO';
7
+ /**
8
+ * Error with a stable code from the {@link VeryMathErrorCode} taxonomy.
9
+ * The seam routes on `code`, so a duplicated package copy must still be
10
+ * recognizable by `name` plus the `code` field.
11
+ */
12
+ export declare class VeryMathError extends Error {
13
+ /** Stable machine-readable code. */
14
+ readonly code: VeryMathErrorCode;
15
+ constructor(message: string, code: VeryMathErrorCode, options?: {
16
+ cause?: unknown;
17
+ });
18
+ }
19
+ /** Whether a value looks like a {@link VeryMathError}, even from a duplicated package copy. */
20
+ export declare function isVeryMathError(error: unknown): error is VeryMathError;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Structured error type for the VeryMath capability seam.
3
+ * @module @louisultra/dsh-verymath/core
4
+ */
5
+ /**
6
+ * Error with a stable code from the {@link VeryMathErrorCode} taxonomy.
7
+ * The seam routes on `code`, so a duplicated package copy must still be
8
+ * recognizable by `name` plus the `code` field.
9
+ */
10
+ export class VeryMathError extends Error {
11
+ /** Stable machine-readable code. */
12
+ code;
13
+ constructor(message, code, options) {
14
+ super(message, options);
15
+ this.name = 'VeryMathError';
16
+ this.code = code;
17
+ }
18
+ }
19
+ /** Whether a value looks like a {@link VeryMathError}, even from a duplicated package copy. */
20
+ export function isVeryMathError(error) {
21
+ return error instanceof VeryMathError || (typeof error === 'object' &&
22
+ error !== null &&
23
+ error.name === 'VeryMathError' &&
24
+ typeof error.code === 'string');
25
+ }
@@ -0,0 +1,42 @@
1
+ /** Result of one gate check. */
2
+ export interface GateResult {
3
+ readonly gate: 'goal_approval' | 'workstream_completion' | 'final_render';
4
+ readonly passed: boolean;
5
+ readonly issues: readonly string[];
6
+ readonly details: Readonly<Record<string, unknown>>;
7
+ }
8
+ /** The workspace root containing `project/` and `workstreams/`. */
9
+ export declare function workspaceRoots(workspace: string): {
10
+ projectDir: string;
11
+ workstreamsDir: string;
12
+ };
13
+ /** Read `project/GOALS.yaml`; a missing file means "no goals recorded". */
14
+ export declare function loadGoals(workspace: string): Promise<{
15
+ goals: Array<Record<string, unknown>>;
16
+ }>;
17
+ /** List workstream directories (recognized by their marker files). */
18
+ export declare function listWorkstreams(workspace: string, workstreamId?: string): Promise<string[]>;
19
+ /** Whether a report body contains the `## <section>` heading (case-insensitive, exact line). */
20
+ export declare function hasSection(text: string, section: string): boolean;
21
+ /** Issues for one workstream per the upstream completion contract. */
22
+ export declare function workstreamIssues(workstream: string): Promise<string[]>;
23
+ /**
24
+ * Gate 1: at least one goal in `project/GOALS.yaml` has `status: approved`
25
+ * (or the named goal does).
26
+ */
27
+ export declare function checkGoalApproval(workspace: string, goalId?: string): Promise<GateResult>;
28
+ /**
29
+ * Gate 2: every (selected) workstream has report.md, an independent reviewer
30
+ * approval, no unresolved blocking reviews, and the three mandatory sections.
31
+ */
32
+ export declare function checkWorkstreamCompletion(workspace: string, workstreamId?: string): Promise<GateResult>;
33
+ /**
34
+ * Gate 3: which workstreams would pass the completion gate (final render
35
+ * approval set).
36
+ */
37
+ export declare function checkFinalRender(workspace: string): Promise<GateResult>;
38
+ /** Dispatch one gate by name (upstream `check_gate` shape). */
39
+ export declare function checkGate(workspace: string, gate: 'goal_approval' | 'workstream_completion' | 'final_render', options?: {
40
+ readonly goalId?: string;
41
+ readonly workstreamId?: string;
42
+ }): Promise<GateResult>;
@@ -0,0 +1,217 @@
1
+ /**
2
+ * Co-Mathematician research-workspace gate checks — TypeScript port of the
3
+ * documented workspace contract (upstream `harness/co_math/gating.py`):
4
+ * three gates over a plain-file workspace layout
5
+ * (`project/GOALS.yaml`, `workstreams/<id>/{status.yaml, report.md, reviews/}`).
6
+ * Pure file-contract validation, no upstream code copied.
7
+ * @module @louisultra/dsh-verymath/core
8
+ */
9
+ import { readFile, readdir, stat } from 'node:fs/promises';
10
+ import { join } from 'node:path';
11
+ import { VeryMathError } from "./error.js";
12
+ import { load as loadYaml } from 'js-yaml';
13
+ /** The workspace root containing `project/` and `workstreams/`. */
14
+ export function workspaceRoots(workspace) {
15
+ return { projectDir: join(workspace, 'project'), workstreamsDir: join(workspace, 'workstreams') };
16
+ }
17
+ /** Read `project/GOALS.yaml`; a missing file means "no goals recorded". */
18
+ export async function loadGoals(workspace) {
19
+ const { projectDir } = workspaceRoots(workspace);
20
+ try {
21
+ const raw = await readFile(join(projectDir, 'GOALS.yaml'), 'utf8');
22
+ const data = (loadYaml(raw) ?? {});
23
+ const goals = Array.isArray(data.goals) ? data.goals : [];
24
+ return { goals };
25
+ }
26
+ catch {
27
+ return { goals: [] };
28
+ }
29
+ }
30
+ /** List workstream directories (recognized by their marker files). */
31
+ export async function listWorkstreams(workspace, workstreamId) {
32
+ const { workstreamsDir } = workspaceRoots(workspace);
33
+ if (workstreamId !== undefined) {
34
+ return [join(workstreamsDir, workstreamId)];
35
+ }
36
+ try {
37
+ const entries = await readdir(workstreamsDir, { withFileTypes: true });
38
+ const dirs = [];
39
+ for (const entry of entries.sort((left, right) => left.name.localeCompare(right.name))) {
40
+ if (!entry.isDirectory())
41
+ continue;
42
+ const dir = join(workstreamsDir, entry.name);
43
+ if (await isWorkstreamDir(dir))
44
+ dirs.push(dir);
45
+ }
46
+ return dirs;
47
+ }
48
+ catch {
49
+ return [];
50
+ }
51
+ }
52
+ async function isWorkstreamDir(dir) {
53
+ for (const marker of ['status.yaml', 'WORKSTREAM.md', 'report.md', 'messages.jsonl']) {
54
+ try {
55
+ await stat(join(dir, marker));
56
+ return true;
57
+ }
58
+ catch {
59
+ // try next marker
60
+ }
61
+ }
62
+ return false;
63
+ }
64
+ async function loadStatus(workstream) {
65
+ try {
66
+ const raw = await readFile(join(workstream, 'status.yaml'), 'utf8');
67
+ return (loadYaml(raw) ?? {});
68
+ }
69
+ catch {
70
+ return {};
71
+ }
72
+ }
73
+ async function loadReviews(workstream) {
74
+ let files;
75
+ try {
76
+ files = (await readdir(join(workstream, 'reviews'))).filter(name => name.endsWith('.json')).sort();
77
+ }
78
+ catch {
79
+ return [];
80
+ }
81
+ const reviews = [];
82
+ for (const file of files) {
83
+ try {
84
+ const data = JSON.parse(await readFile(join(workstream, 'reviews', file), 'utf8'));
85
+ reviews.push({
86
+ file,
87
+ reviewer: String(data.reviewer ?? file.replace(/\.json$/u, '')),
88
+ approved: data.approved === true,
89
+ // Upstream contract: only an explicit severity === 'blocking' blocks.
90
+ severity: String(data.severity ?? ''),
91
+ resolved: data.resolved === true,
92
+ resolves: Array.isArray(data.resolves) ? data.resolves.map(item => String(item)) : [],
93
+ });
94
+ }
95
+ catch {
96
+ reviews.push({ file, reviewer: file.replace(/\.json$/u, ''), approved: false, severity: 'blocking', resolved: false, resolves: [] });
97
+ }
98
+ }
99
+ return reviews;
100
+ }
101
+ /** Whether a report body contains the `## <section>` heading (case-insensitive, exact line). */
102
+ export function hasSection(text, section) {
103
+ const expected = `## ${section}`.toLowerCase();
104
+ return text.split('\n').some(line => line.trim().toLowerCase() === expected);
105
+ }
106
+ /** Issues for one workstream per the upstream completion contract. */
107
+ export async function workstreamIssues(workstream) {
108
+ const label = workstream.split('/').pop() ?? workstream;
109
+ const issues = [];
110
+ const status = await loadStatus(workstream);
111
+ const reviews = await loadReviews(workstream);
112
+ let reportText;
113
+ try {
114
+ reportText = await readFile(join(workstream, 'report.md'), 'utf8');
115
+ }
116
+ catch {
117
+ reportText = undefined;
118
+ }
119
+ if (reportText === undefined)
120
+ issues.push(`${label}: report.md is missing.`);
121
+ const approvedReviewers = reviews.filter(review => review.approved).map(review => review.reviewer);
122
+ const coordinator = String(status.coordinator ?? 'workstream_coordinator');
123
+ const independentApprovals = approvedReviewers.filter(reviewer => reviewer !== coordinator);
124
+ if (independentApprovals.length === 0) {
125
+ issues.push(`${label}: missing independent reviewer approval.`);
126
+ }
127
+ const resolvedNames = new Set();
128
+ for (const review of reviews) {
129
+ if (review.resolved) {
130
+ resolvedNames.add(review.file);
131
+ resolvedNames.add(review.file.replace(/\.json$/u, ''));
132
+ }
133
+ for (const target of review.resolves) {
134
+ resolvedNames.add(target);
135
+ resolvedNames.add(target.split('/').pop() ?? target);
136
+ resolvedNames.add(target.replace(/\.json$/u, ''));
137
+ }
138
+ }
139
+ for (const review of reviews) {
140
+ if (review.severity === 'blocking' && !resolvedNames.has(review.file) && !resolvedNames.has(review.file.replace(/\.json$/u, ''))) {
141
+ issues.push(`${label}: blocking review in ${review.file}.`);
142
+ }
143
+ }
144
+ if (reportText !== undefined) {
145
+ if (!hasSection(reportText, 'Provenance'))
146
+ issues.push(`${label}: report.md is missing a Provenance section.`);
147
+ if (!hasSection(reportText, 'Uncertainty'))
148
+ issues.push(`${label}: report.md is missing an Uncertainty section.`);
149
+ if (!hasSection(reportText, 'Failed Explorations'))
150
+ issues.push(`${label}: report.md is missing a Failed Explorations section.`);
151
+ }
152
+ return issues;
153
+ }
154
+ /**
155
+ * Gate 1: at least one goal in `project/GOALS.yaml` has `status: approved`
156
+ * (or the named goal does).
157
+ */
158
+ export async function checkGoalApproval(workspace, goalId) {
159
+ const { goals } = await loadGoals(workspace);
160
+ const issues = [];
161
+ if (goalId !== undefined) {
162
+ const goal = goals.find(goal => String(goal.id ?? '') === goalId);
163
+ if (goal === undefined) {
164
+ issues.push(`Goal ${goalId} was not found.`);
165
+ }
166
+ else if (String(goal.status ?? '').toLowerCase() !== 'approved') {
167
+ issues.push(`Goal ${goalId} is not approved (status: ${String(goal.status ?? 'missing')}).`);
168
+ }
169
+ }
170
+ else if (!goals.some(goal => String(goal.status ?? '').toLowerCase() === 'approved')) {
171
+ issues.push('No approved goals are recorded.');
172
+ }
173
+ return { gate: 'goal_approval', passed: issues.length === 0, issues, details: goalId !== undefined ? { goalId } : {} };
174
+ }
175
+ /**
176
+ * Gate 2: every (selected) workstream has report.md, an independent reviewer
177
+ * approval, no unresolved blocking reviews, and the three mandatory sections.
178
+ */
179
+ export async function checkWorkstreamCompletion(workspace, workstreamId) {
180
+ const workstreams = await listWorkstreams(workspace, workstreamId);
181
+ const issues = [];
182
+ const details = { workstreams: workstreams.map(path => path.split('/').pop()) };
183
+ if (workstreams.length === 0)
184
+ issues.push('No workstream directories were found.');
185
+ for (const workstream of workstreams)
186
+ issues.push(...(await workstreamIssues(workstream)));
187
+ return { gate: 'workstream_completion', passed: issues.length === 0, issues, details };
188
+ }
189
+ /**
190
+ * Gate 3: which workstreams would pass the completion gate (final render
191
+ * approval set).
192
+ */
193
+ export async function checkFinalRender(workspace) {
194
+ const workstreams = await listWorkstreams(workspace);
195
+ const approved = [];
196
+ const rejected = {};
197
+ for (const workstream of workstreams) {
198
+ const label = workstream.split('/').pop() ?? workstream;
199
+ const issues = await workstreamIssues(workstream);
200
+ if (issues.length === 0)
201
+ approved.push(label);
202
+ else
203
+ rejected[label] = issues;
204
+ }
205
+ const issues = approved.length > 0 ? [] : ['No reviewed workstream reports are ready to render.'];
206
+ return { gate: 'final_render', passed: issues.length === 0, issues, details: { approved_workstreams: approved, rejected_workstreams: rejected } };
207
+ }
208
+ /** Dispatch one gate by name (upstream `check_gate` shape). */
209
+ export async function checkGate(workspace, gate, options = {}) {
210
+ if (gate === 'goal_approval')
211
+ return checkGoalApproval(workspace, options.goalId);
212
+ if (gate === 'workstream_completion')
213
+ return checkWorkstreamCompletion(workspace, options.workstreamId);
214
+ if (gate === 'final_render')
215
+ return checkFinalRender(workspace);
216
+ throw new VeryMathError(`Unsupported gate: ${String(gate)}`, 'VERYMATH_IO');
217
+ }
@@ -0,0 +1,101 @@
1
+ /** One bilingual term entry (upstream `math-glossary` contract). */
2
+ export interface GlossaryTerm {
3
+ /** Unique id: lowercased `en`, with an `__N` suffix on alias rows. */
4
+ readonly term_id: string;
5
+ /** English term as written in the source. */
6
+ readonly en: string;
7
+ /** Chinese translation; on alias rows this is the alias. */
8
+ readonly cn: string;
9
+ /** Optional 1-based contiguous position after sorting. */
10
+ readonly idx?: number;
11
+ /** Optional part of speech in Chinese (名词 / 动词 / …). */
12
+ readonly pos?: string;
13
+ /** Optional subfields, multi-value (代数拓扑, 拓扑学…). */
14
+ readonly field?: readonly string[];
15
+ /** Optional source reference label. */
16
+ readonly source?: string;
17
+ /** Optional bilingual example sentences. */
18
+ readonly examples?: readonly {
19
+ readonly en: string;
20
+ readonly cn: string;
21
+ }[];
22
+ /** ISO date (YYYY-MM-DD). */
23
+ readonly created_at: string;
24
+ /** ISO date (YYYY-MM-DD). */
25
+ readonly updated_at: string;
26
+ }
27
+ /** Whether a value parses as a complete validated glossary document. */
28
+ export declare function parseGlossary(value: unknown): GlossaryTerm[];
29
+ /**
30
+ * Sort terms by (en, cn) using stable code-point order and reassign
31
+ * contiguous 1-based `idx` values, the upstream write-path invariant.
32
+ * @param terms - terms in any order; the input is not mutated.
33
+ * @returns a new sorted array with `idx` reassigned.
34
+ */
35
+ export declare function sortGlossary(terms: readonly GlossaryTerm[]): GlossaryTerm[];
36
+ /** Validate the cross-entry invariants of a stored glossary document. */
37
+ export declare function validateGlossaryInvariants(terms: readonly GlossaryTerm[]): void;
38
+ /** One glossary query hit. */
39
+ export interface GlossaryHit {
40
+ readonly term: GlossaryTerm;
41
+ /** Which field matched: en (exact), en-prefix, cn, field, or term_id. */
42
+ readonly matchedBy: 'en' | 'en-prefix' | 'cn' | 'field' | 'term_id';
43
+ }
44
+ /** Options for {@link queryGlossary}. */
45
+ export interface GlossaryQueryOptions {
46
+ /** Maximum hits returned (default 20). */
47
+ readonly limit?: number;
48
+ /** Restrict candidates to terms whose `field` array contains this subfield exactly (upstream usage-guide disambiguation strategy 2). */
49
+ readonly field?: string;
50
+ }
51
+ /**
52
+ * Query a parsed glossary: exact en/cn match first, then prefix, substring,
53
+ * and subfield hits. `total` is the deduplicated candidate count before the
54
+ * limit cut, so callers can detect truncation.
55
+ * @param terms - validated glossary terms.
56
+ * @param query - an English/Chinese term, a term_id, or a subfield name.
57
+ * @param options - limit and optional subfield disambiguation filter; a bare
58
+ * number is accepted as the limit for backwards compatibility.
59
+ */
60
+ export declare function queryGlossary(terms: readonly GlossaryTerm[], query: string, options?: GlossaryQueryOptions | number): {
61
+ hits: GlossaryHit[];
62
+ total: number;
63
+ };
64
+ /** One term upsert request for {@link upsertTerms}. */
65
+ export interface TermUpsert {
66
+ /** English term. */
67
+ readonly en: string;
68
+ /** Chinese translation (or alias). */
69
+ readonly cn: string;
70
+ /** Optional part of speech in Chinese. */
71
+ readonly pos?: string;
72
+ /** Optional subfields. */
73
+ readonly field?: readonly string[];
74
+ /** Optional source label. */
75
+ readonly source?: string;
76
+ /** Optional bilingual example. */
77
+ readonly example?: {
78
+ readonly en: string;
79
+ readonly cn: string;
80
+ };
81
+ }
82
+ /** Result of one upsert batch. */
83
+ export interface UpsertResult {
84
+ /** New terms that did not exist before (by term_id). */
85
+ readonly added: readonly string[];
86
+ /** Existing terms whose cn/pos/field/source/examples were overwritten. */
87
+ readonly updated: readonly string[];
88
+ /** The complete re-sorted document ready to write (idx reassigned, today's dates on changed rows). */
89
+ readonly document: GlossaryTerm[];
90
+ }
91
+ /**
92
+ * Merge upsert requests into an existing glossary per the upstream contract:
93
+ * term_id is the lowercased en for the primary translation and `en__N` for
94
+ * additional alias rows of the same en; an existing term with the same
95
+ * (term_id) is updated in place; the merged document is re-sorted by
96
+ * (en, cn) with contiguous idx. The input document is never mutated.
97
+ * @param terms - current glossary terms (any order).
98
+ * @param upserts - terms to add or update.
99
+ * @throws VeryMathError when the merged document breaks an invariant.
100
+ */
101
+ export declare function upsertTerms(terms: readonly GlossaryTerm[], upserts: readonly TermUpsert[]): UpsertResult;