dsh-vibe-math 2.5.0 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/README.en.md +175 -369
  2. package/README.md +175 -370
  3. package/cordis.patch.yml +78 -22
  4. package/docs/AUDIT-CHECKLIST.md +3 -3
  5. package/docs/final-paper.md +172 -0
  6. package/docs/formal-verification.md +184 -29
  7. package/docs/math-computation.md +121 -0
  8. package/docs/release-notes/RELEASE-NOTES-2.6.0.md +268 -0
  9. package/docs/release-notes/RELEASE-NOTES-2.7.0.en.md +151 -0
  10. package/docs/release-notes/RELEASE-NOTES-2.7.0.md +115 -0
  11. package/docs/test-timing.md +25 -9
  12. package/installer.js +7 -4
  13. package/package.json +21 -3
  14. package/prompt-corpus-persona/persona-corpus.json +16 -16
  15. package/prompt-corpus-persona/persona-corpus.md +164 -52
  16. package/prompt-corpus-v2/formal-verify-v2.json +128 -92
  17. package/prompt-corpus-v2/formal-verify-v2.md +1574 -108
  18. package/prompt-corpus-v3/formal-verify-v3.json +137 -53
  19. package/prompt-corpus-v3/formal-verify-v3.md +1406 -100
  20. package/prompt-corpus-v4/formal-verify-v4.json +14 -14
  21. package/prompt-corpus-v4/formal-verify-v4.md +247 -14
  22. package/prompt-corpus-v5/prompt-corpus-v5.json +62 -62
  23. package/prompt-corpus-v5/prompt-corpus-v5.md +570 -3
  24. package/tests/audit-math-computation-contract.mjs +191 -0
  25. package/tests/audit-math-computation-parity.mjs +169 -0
  26. package/tests/audit-math-computation-sensitivity.mjs +231 -0
  27. package/tests/audit-persona-sensitivity.mjs +64 -11
  28. package/tests/audit-persona-surface.test.mjs +53 -16
  29. package/tests/audit-v5-integrity.mjs +14 -0
  30. package/tests/e2e-v5-round2.test.mjs +923 -3
  31. package/tests/formal-verify-v2.test.mjs +295 -6
  32. package/tests/formal-verify-v3.test.mjs +275 -4
  33. package/tests/formal-verify-v4.test.mjs +295 -6
  34. package/tests/formal-verify-v5.test.mjs +9 -1
  35. package/tests/helpers/math-computation-fake-seam.mjs +135 -0
  36. package/tests/math-computation-shared.test.mjs +504 -0
  37. package/tests/prompt-v5-integrity.test.mjs +14 -8
  38. package/tests/selfdrive-v5.mjs +55 -4
  39. package/vibe-math-v2/agent.cordis.yml +36 -14
  40. package/vibe-math-v2/math-computation.js +936 -0
  41. package/vibe-math-v2/math-engines.js +156 -0
  42. package/vibe-math-v2/vibe-math-v2.js +1653 -48
  43. package/vibe-math-v2//345/256/236/347/216/260/346/226/271/346/241/210.md +6 -0
  44. package/vibe-math-v3/agent.cordis.yml +30 -12
  45. package/vibe-math-v3/math-computation.js +936 -0
  46. package/vibe-math-v3/math-engines.js +156 -0
  47. package/vibe-math-v3/vibe-math-v3.js +1623 -53
  48. package/vibe-math-v3//345/256/236/347/216/260/346/226/271/346/241/210.md +6 -0
  49. package/vibe-math-v4/agent.cordis.yml +44 -8
  50. package/vibe-math-v4/math-computation.js +936 -0
  51. package/vibe-math-v4/math-engines.js +156 -0
  52. package/vibe-math-v4/vibe-math-v4.js +1592 -37
  53. package/vibe-math-v4//345/256/236/347/216/260/346/226/271/346/241/210.md +6 -0
  54. package/vibe-math-v5/agent.cordis.yml +46 -10
  55. package/vibe-math-v5/math-computation.js +936 -0
  56. package/vibe-math-v5/math-engines.js +156 -0
  57. package/vibe-math-v5/vibe-math-v5.js +2233 -42
  58. package/vibe-math-v5//345/256/236/347/216/260/346/226/271/346/241/210.md +153 -4
  59. package/vibe-math-v5//346/236/266/346/236/204/345/233/276.md +251 -0
@@ -156,6 +156,12 @@ const wakeKindOf = (prompt) => {
156
156
  if (/【研究所会议/.test(prompt)) return 'meeting'
157
157
  if (/【求真表决/.test(prompt)) return 'verify'
158
158
  if (/【心跳检查/.test(prompt)) return 'checkpoint'
159
+ // The final paper is a phase of its own (it runs BEFORE the run is marked complete):
160
+ // each member writes its own part, cross-reviews another member's part, and the
161
+ // academician finalises.
162
+ if (/【最终论文·撰写/.test(prompt)) return 'paper-write'
163
+ if (/【最终论文·互审/.test(prompt)) return 'paper-review'
164
+ if (/【最终论文·定稿/.test(prompt)) return 'paper-final'
159
165
  return 'normal'
160
166
  }
161
167
  const memberLabelOf = (childId) => { const s = spawns.find(x => x.childId === childId); const m = s ? /vibe5 (\S+) /.exec(s.label) : null; return m ? m[1] : '' }
@@ -193,6 +199,20 @@ async function answerWake(w) {
193
199
  reply = { verdict: { target, verdict: v, reason: who + ' 的判断:' + (v === 1 ? '成立' : v === 0 ? '不成立' : '不确定') }, contextPct: 20 }
194
200
  } else if (kind === 'meeting') {
195
201
  reply = { input: who + ':我的意见已写在 Progress/ 里。', vote_solved: solvePlan === true, solved: solvePlan === true, contextPct: 20 }
202
+ } else if (kind === 'paper-write') {
203
+ reply = {
204
+ paper_part: {
205
+ title: who + ' 的贡献', solution: who + ':原问题的完整解法——最小反例归约(仅写有证据的部分)。',
206
+ methods: who + ' 的方法与经验:归约 + 边界情形枚举。', rules: who + ' 归纳的规律:先最小反例,再边界。',
207
+ limits: who + ' 的局限:部分边界情形仍未定论(已显式标注)。',
208
+ evidence: ['Members/' + who + '/Propos/p-' + who + '.md'],
209
+ }, contextPct: 20,
210
+ }
211
+ } else if (kind === 'paper-review') {
212
+ const om = /待审部分(([^)]*))/.exec(prompt)
213
+ reply = { paper_review: { of: om ? om[1] : '', deliverable: true, comments: who + ':证据与表决记录一致,术语清楚,可交付。' }, contextPct: 20 }
214
+ } else if (kind === 'paper-final') {
215
+ reply = { paper_final: { decision: 'deliverable', note: who + ':已核对合并稿与互审意见,统一了术语与符号,可定稿。', conclusion: '原问题在题设范围内得证。' }, contextPct: 20 }
196
216
  } else {
197
217
  reply = { progress: who + ':本轮继续推进最小反例路线。', solved: false, contextPct: 20 }
198
218
  }
@@ -430,16 +450,47 @@ assert(sNo.autoDone === false && sNo.running === true, 'a non-unanimous solve vo
430
450
  solvePlan = true
431
451
  const m2 = await callTool('vibe_v5_meeting', { agenda: '再次表决是否已解决', kind: 'solve-vote' }, childAgent(childOf('acad')))
432
452
  assert(m2.ok === true, 'the second solve-vote meeting is requested (' + JSON.stringify(m2).slice(0, 100) + ')')
453
+ // ★ docs/final-paper.md §3: the unanimous solve vote does NOT flip the completion flags any more. The
454
+ // final-paper phase runs FIRST (after phase='solved' the machinery refuses to wake members,
455
+ // convene meetings or dispatch an end, so the co-writing could never run). This loop must
456
+ // therefore land on "paper active, run still alive" — that IS the contract, and the loop
457
+ // below proves the run concludes only once the paper is finalised.
458
+ let sPaper = null
433
459
  for (let i = 0; i < 60; i++) {
434
460
  const s = await callTool('vibe_v5_status', {})
461
+ if (s.paper && s.paper.status !== 'finalized') { sPaper = s; break }
435
462
  if (s.autoDone) break
436
463
  await drainWakes(6)
437
464
  await sleep(15)
438
465
  }
439
- const sDone = await callTool('vibe_v5_status', {})
440
- assert(sDone.autoDone === true, 'a unanimous solve vote from every voting member DOES stop the institute — ' +
441
- JSON.stringify({ autoDone: sDone.autoDone, running: sDone.running, meeting: sDone.meeting, parked: sDone.parkedMeeting, solveVotes: sDone.solveVotes }))
442
- assert(sDone.running === false, 'scheduling halted after the unanimous solve vote')
466
+ assert(!!sPaper, 'the unanimous solve vote enters the FINAL PAPER phase before completion — ' +
467
+ JSON.stringify({ autoDone: (sPaper || {}).autoDone, paper: (sPaper || {}).paper }))
468
+ assert(sPaper && sPaper.autoDone === false && sPaper.running === true,
469
+ 'the run stays ALIVE while the paper phase runs (a concluded run refuses the wakes it needs)')
470
+ assert(sPaper && sPaper.paper && sPaper.paper.status === 'writing' && sPaper.paper.editor === 'academician',
471
+ 'the automatic paper is in its writing stage with the academician as the default editor (' + JSON.stringify(sPaper && sPaper.paper && { status: sPaper.paper.status, editor: sPaper.paper.editor }) + ')')
472
+ // Drive the paper to completion: parts -> cross-review -> academician finalises -> the run is
473
+ // marked complete and the conclusion record is written.
474
+ let sDone = sPaper
475
+ for (let i = 0; i < 160; i++) {
476
+ sDone = await callTool('vibe_v5_status', {})
477
+ if (sDone.autoDone) break
478
+ await drainWakes(8)
479
+ await sleep(15)
480
+ }
481
+ assert(sDone.autoDone === true, 'the run is marked complete once the final paper is finalised — ' +
482
+ JSON.stringify({ autoDone: sDone.autoDone, running: sDone.running, paper: sDone.paper && { status: sDone.paper.status, compile: sDone.paper.compile } }))
483
+ assert(sDone.running === false, 'scheduling halted after the paper was finalised')
484
+ assert(sDone.paper && sDone.paper.status === 'finalized', 'status reports the paper as finalised (' + JSON.stringify(sDone.paper && sDone.paper.status) + ')')
485
+ const paperDir = join(WS, 'VibeMath', 'Projects', 'default', 'Institutes', 'institute', 'Paper', 'institute')
486
+ const paperMd = existsSync(join(paperDir, 'paper.md')) ? readFileSync(join(paperDir, 'paper.md'), 'utf8') : ''
487
+ const paperTex = existsSync(join(paperDir, 'paper.tex')) ? readFileSync(join(paperDir, 'paper.tex'), 'utf8') : ''
488
+ const paperMeta = existsSync(join(paperDir, 'paper.meta.json')) ? JSON.parse(readFileSync(join(paperDir, 'paper.meta.json'), 'utf8')) : null
489
+ assert(/## 1\. /.test(paperMd) && /## 9\. /.test(paperMd), '★ the delivered paper carries the 9-section skeleton')
490
+ assert(/\\documentclass/.test(paperTex) && /\\begin\{document\}/.test(paperTex), '★ the tex version is produced as well')
491
+ assert(!!paperMeta && paperMeta.compile && paperMeta.compile.status === 'not-detected',
492
+ '★ no LaTeX on this host: the meta records compile=not-detected and the md+tex are still delivered (' + JSON.stringify(paperMeta && paperMeta.compile) + ')')
493
+ assert(existsSync(join(paperDir, 'paper.log.md')), 'the paper log records who wrote and reviewed what')
443
494
  const concl = existsSync(join(WS, 'VibeMath', 'Projects', 'default', 'Institutes', 'institute', 'Problems', 'conclusion.md'))
444
495
  assert(concl, 'a conclusion record was written on completion')
445
496
 
@@ -28,16 +28,27 @@
28
28
  - vibe_math_status / vibe_math_report — read scheduler status / full progress report (report also writes Progress_Logs/report.json).
29
29
  - vibe_math_pause / vibe_math_abort — pause / abort (abort interrupts all children).
30
30
  - vibe_math_set_mode {mode: manual|auto} — switch manual / auto control.
31
- - vibe_math_set_params {...} — tune any parameter (see vibe_math_setup for the full schema; e.g. reportMode file|push|both, promoteValueThreshold, verdictMode flat|forced, formalVerify off|encourage|require).
31
+ - vibe_math_set_params {...} — tune any parameter (see vibe_math_setup for the full schema; e.g. reportMode file|push|both, promoteValueThreshold, verdictMode flat|forced, formalVerify off|encourage|require, finalPaper true|false, paperFormat both|md|tex, paperLanguage zh|en, paperCompilePdf true|false, paperLatexCommand <engine>).
32
32
  - vibe_math_setup / vibe_math_save_settings / vibe_math_template — guided configuration / persist defaults / generate template.
33
33
  - vibe_math_new_project / vibe_math_set_project / vibe_math_list_projects — per-project folders.
34
34
  - vibe_math_list_decisions / vibe_math_decide {id, action: approve|reject|override, verdict?} — resolve manual decisions.
35
35
  - vibe_math_list_agents / vibe_math_message_agent / vibe_math_interrupt_agent — inspect / steer / interrupt subagents.
36
- - vibe_math_lean_run / vibe_math_lean_archive / vibe_math_lean_lib — Lean formal
37
- verification (execute / archive / list the reuse library). The scheduler's child agents
38
- use them too; they work in every mode.
39
-
40
- A /vibe slash command mirrors the main controls. Data lives under {{cwd}}/VibeMath/Projects/<project>/
36
+ - vibe_math_lean_run / vibe_math_lean_archive / vibe_math_lean_lib / vibe_math_lean_read /
37
+ vibe_math_lean_job — Lean formal verification (execute / archive / list + read the reuse
38
+ library / inspect or wait for a background compile job). leanAsync=true (default) queues the
39
+ compile and returns a jobId; nothing counts as proved until that job settles ok (so "有把握"
40
+ is not the same as "已验证"). The scheduler's child agents use them too; they work in every
41
+ mode.
42
+
43
+ - math_computation {op: probe|run|receipt|install, engine, mode: code|file|expr, …} — 先 probe 预检引擎/包/许可,再调引擎计算并把脚本与输出归档成可复核回执;缺引擎/缺包只报告与给安装指引/计划;shell 兜底不算归档。
44
+ - 归档→编辑→重跑:mode:'code' 的脚本原件在回执的 scriptPath(Computation/<id>/script.<ext>),你可以用普通文件工具打开并编辑它;编辑后用 mode:'file' 指向它重跑,会写出一份**新回执/新 attempt**(含新的 scriptHash)。**旧回执对修改后的代码无效**——报告里必须引用与当前代码哈希一致的那份回执;工具会在 scriptChanged / scriptChangedDuringRun 为 true 时显式告警。
45
+
46
+ Final paper: strict termination writes Paper/<project>/{paper.md,paper.tex,paper.pdf,paper.meta.json,paper.log.md}
47
+ automatically — a dedicated paper-writing child assembles the solved material (finalPaper=false disables only that
48
+ automatic run). /vibe paper [lang=zh|en] [format=both|md|tex] [force] writes or rewrites it by hand. md/tex follow
49
+ paperFormat; a PDF is produced only when a LaTeX engine is detected and paperCompilePdf is true.
50
+ A /vibe slash command mirrors the main controls (/vibe start|resume|pause|abort|status|report|mode <auto|manual>|setup|save|template [global|project]|add <id> <desc>|add-proposition <id> <概述>|list-propositions|project [list|new <name>|<name>]|decisions|agents|paper [lang=zh|en] [format=both|md|tex] [force]).
51
+ Data lives under {{cwd}}/VibeMath/Projects/<project>/
41
52
  (qs/qs.json, Propos/<分类>_Propos.json, Reliable/, Verified/, Verification_logs/, Progress_Logs/, VibeMath_State/)
42
53
  and survives restarts via vibe_math_resume.
43
54
 
@@ -69,7 +80,7 @@
69
80
  explicit, reasoned blocker record; the scheduler is never wedged by it).
70
81
  - Paths: work file Formal/<id>.lean; archived proof Verified/Lean/<id>.lean; reusable
71
82
  definitions VibeMath/Formal/Lib/; proved lemmas VibeMath/Formal/Proved/.
72
- - The toolchain knobs leanCommand / leanArgs / leanTimeoutMs are tunable as well
83
+ - The toolchain knobs leanCommand / leanArgs / leanTimeoutMs / leanAsync / leanInitiative / leanSearchPaths / leanJobsMaxParallel are tunable as well
73
84
  (e.g. leanCommand='lake' with leanArgs=['env','lean']); a missing Lean binary is
74
85
  reported as LEAN_NOT_FOUND and still lets the code be written and archived.
75
86
  - vibe_math_status / vibe_math_report show the mode, the per-object formal status and the
@@ -94,16 +105,27 @@
94
105
  - vibe_math_status / vibe_math_report — read scheduler status / full progress report (report also writes Progress_Logs/report.json).
95
106
  - vibe_math_pause / vibe_math_abort — pause / abort (abort interrupts all children).
96
107
  - vibe_math_set_mode {mode: manual|auto} — switch manual / auto control.
97
- - vibe_math_set_params {...} — tune any parameter (see vibe_math_setup for the full schema; e.g. reportMode file|push|both, promoteValueThreshold, verdictMode flat|forced, formalVerify off|encourage|require).
108
+ - vibe_math_set_params {...} — tune any parameter (see vibe_math_setup for the full schema; e.g. reportMode file|push|both, promoteValueThreshold, verdictMode flat|forced, formalVerify off|encourage|require, finalPaper true|false, paperFormat both|md|tex, paperLanguage zh|en, paperCompilePdf true|false, paperLatexCommand <engine>).
98
109
  - vibe_math_setup / vibe_math_save_settings / vibe_math_template — guided configuration / persist defaults / generate template.
99
110
  - vibe_math_new_project / vibe_math_set_project / vibe_math_list_projects — per-project folders.
100
111
  - vibe_math_list_decisions / vibe_math_decide {id, action: approve|reject|override, verdict?} — resolve manual decisions.
101
112
  - vibe_math_list_agents / vibe_math_message_agent / vibe_math_interrupt_agent — inspect / steer / interrupt subagents.
102
- - vibe_math_lean_run / vibe_math_lean_archive / vibe_math_lean_lib — Lean formal
103
- verification (execute / archive / list the reuse library). The scheduler's child agents
104
- use them too; they work in every mode.
105
-
106
- A /vibe slash command mirrors the main controls. Data lives under {{cwd}}/VibeMath/Projects/<project>/
113
+ - vibe_math_lean_run / vibe_math_lean_archive / vibe_math_lean_lib / vibe_math_lean_read /
114
+ vibe_math_lean_job — Lean formal verification (execute / archive / list + read the reuse
115
+ library / inspect or wait for a background compile job). leanAsync=true (default) queues the
116
+ compile and returns a jobId; nothing counts as proved until that job settles ok (so "有把握"
117
+ is not the same as "已验证"). The scheduler's child agents use them too; they work in every
118
+ mode.
119
+
120
+ - math_computation {op: probe|run|receipt|install, engine, mode: code|file|expr, …} — 先 probe 预检引擎/包/许可,再调引擎计算并把脚本与输出归档成可复核回执;缺引擎/缺包只报告与给安装指引/计划;shell 兜底不算归档。
121
+ - 归档→编辑→重跑:mode:'code' 的脚本原件在回执的 scriptPath(Computation/<id>/script.<ext>),你可以用普通文件工具打开并编辑它;编辑后用 mode:'file' 指向它重跑,会写出一份**新回执/新 attempt**(含新的 scriptHash)。**旧回执对修改后的代码无效**——报告里必须引用与当前代码哈希一致的那份回执;工具会在 scriptChanged / scriptChangedDuringRun 为 true 时显式告警。
122
+
123
+ Final paper: strict termination writes Paper/<project>/{paper.md,paper.tex,paper.pdf,paper.meta.json,paper.log.md}
124
+ automatically — a dedicated paper-writing child assembles the solved material (finalPaper=false disables only that
125
+ automatic run). /vibe paper [lang=zh|en] [format=both|md|tex] [force] writes or rewrites it by hand. md/tex follow
126
+ paperFormat; a PDF is produced only when a LaTeX engine is detected and paperCompilePdf is true.
127
+ A /vibe slash command mirrors the main controls (/vibe start|resume|pause|abort|status|report|mode <auto|manual>|setup|save|template [global|project]|add <id> <desc>|add-proposition <id> <概述>|list-propositions|project [list|new <name>|<name>]|decisions|agents|paper [lang=zh|en] [format=both|md|tex] [force]).
128
+ Data lives under {{cwd}}/VibeMath/Projects/<project>/
107
129
  (qs/qs.json, Propos/<分类>_Propos.json, Reliable/, Verified/, Verification_logs/, Progress_Logs/, VibeMath_State/)
108
130
  and survives restarts via vibe_math_resume.
109
131
 
@@ -135,7 +157,7 @@
135
157
  explicit, reasoned blocker record; the scheduler is never wedged by it).
136
158
  - Paths: work file Formal/<id>.lean; archived proof Verified/Lean/<id>.lean; reusable
137
159
  definitions VibeMath/Formal/Lib/; proved lemmas VibeMath/Formal/Proved/.
138
- - The toolchain knobs leanCommand / leanArgs / leanTimeoutMs are tunable as well
160
+ - The toolchain knobs leanCommand / leanArgs / leanTimeoutMs / leanAsync / leanInitiative / leanSearchPaths / leanJobsMaxParallel are tunable as well
139
161
  (e.g. leanCommand='lake' with leanArgs=['env','lean']); a missing Lean binary is
140
162
  reported as LEAN_NOT_FOUND and still lets the code be written and archived.
141
163
  - vibe_math_status / vibe_math_report show the mode, the per-object formal status and the