dsh-vibe-math 2.2.2 → 2.3.1

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 (43) hide show
  1. package/AUDIT-CHECKLIST.md +61 -3
  2. package/README.md +119 -1
  3. package/RELEASE-NOTES-2.3.0.md +207 -0
  4. package/RELEASE-NOTES-2.3.1.md +134 -0
  5. package/audit-formal-sensitivity.mjs +333 -0
  6. package/audit-persona-sensitivity.mjs +249 -0
  7. package/audit-persona-surface.test.mjs +349 -0
  8. package/audit-v5-integrity.mjs +43 -2
  9. package/audit-v5-sensitivity.mjs +77 -6
  10. package/docs/formal-verification.md +401 -0
  11. package/docs/generate_framework_diagram_v5.mjs +22 -16
  12. package/docs/test-timing.md +79 -0
  13. package/formal-verify-v2.test.mjs +951 -0
  14. package/formal-verify-v3.test.mjs +1031 -0
  15. package/formal-verify-v4.test.mjs +882 -0
  16. package/formal-verify-v5.test.mjs +598 -0
  17. package/package.json +22 -2
  18. package/prompt-corpus-persona/persona-corpus.json +32 -0
  19. package/prompt-corpus-persona/persona-corpus.md +674 -0
  20. package/prompt-corpus-v2/formal-verify-v2.json +394 -0
  21. package/prompt-corpus-v2/formal-verify-v2.md +4250 -0
  22. package/prompt-corpus-v3/formal-verify-v3.json +382 -0
  23. package/prompt-corpus-v3/formal-verify-v3.md +3843 -0
  24. package/prompt-corpus-v4/formal-verify-v4.json +84 -0
  25. package/prompt-corpus-v4/formal-verify-v4.md +255 -0
  26. package/prompt-corpus-v5/prompt-corpus-v5.json +109 -5
  27. package/prompt-corpus-v5/prompt-corpus-v5.md +653 -109
  28. package/prompt-v5-integrity.test.mjs +1158 -984
  29. package/run-tests.mjs +99 -0
  30. package/vibe-math-v2/agent.cordis.yml +40 -2
  31. package/vibe-math-v2/vibe-math-v2.js +811 -21
  32. package/vibe-math-v2//345/256/236/347/216/260/346/226/271/346/241/210.md +218 -1
  33. package/vibe-math-v3/agent.cordis.yml +46 -2
  34. package/vibe-math-v3/vibe-math-v3.js +810 -21
  35. package/vibe-math-v3//345/256/236/347/216/260/346/226/271/346/241/210.md +104 -2
  36. package/vibe-math-v4/agent.cordis.yml +46 -4
  37. package/vibe-math-v4/vibe-math-v4.js +744 -15
  38. package/vibe-math-v4//345/256/236/347/216/260/346/226/271/346/241/210.md +255 -0
  39. package/vibe-math-v5/agent.cordis.yml +41 -5
  40. package/vibe-math-v5/vibe-math-v5.js +621 -9
  41. package/vibe-math-v5//345/256/236/347/216/260/346/226/271/346/241/210.md +131 -4
  42. package/vibe-math-v5//346/236/266/346/236/204/345/233/276.md +57 -0
  43. package//347/244/272/344/276/213/345/233/276//346/241/206/346/236/266/345/233/276-v5.svg +51 -46
package/run-tests.mjs ADDED
@@ -0,0 +1,99 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * PARALLEL TEST RUNNER — run every shipped suite (or a filtered subset) concurrently and report
4
+ * per-suite timings, so the strategy for the next run is chosen from DATA instead of guesswork.
5
+ *
6
+ * Why this exists: the suites are wildly uneven (one suite is ~160 s, most are under 2 s), so a
7
+ * sequential sweep spends almost all of its wall time waiting for the slowest one. Running them
8
+ * with a worker pool makes the sweep bounded by the slowest SUITE rather than by their SUM.
9
+ * On this machine (4 cores) the sweep went from ~5.5 min to ~2 min; see docs/test-timing.md.
10
+ *
11
+ * Every suite already isolates itself (each creates its own mkdtemp workspace), so parallelism is
12
+ * safe. Suites that WRITE a corpus take a per-run corpus dir from an env var; this runner points
13
+ * them at a scratch dir when it runs a suite more than once, which it never does — but the probe
14
+ * runner (audit-formal-sensitivity.mjs) does, and it passes its own dirs.
15
+ *
16
+ * Usage:
17
+ * node run-tests.mjs # every *.test.mjs, concurrency = min(4, cpus)
18
+ * node run-tests.mjs --concurrency=6
19
+ * node run-tests.mjs --only formal # substring match on the file name (repeatable, OR)
20
+ * node run-tests.mjs --exclude e2e-v4 # substring to skip (repeatable)
21
+ * node run-tests.mjs --json # machine-readable summary on stdout
22
+ */
23
+ import { spawn } from 'node:child_process'
24
+ import { readdirSync } from 'node:fs'
25
+ import { cpus } from 'node:os'
26
+ import { join } from 'node:path'
27
+ import { fileURLToPath } from 'node:url'
28
+
29
+ const HERE = fileURLToPath(new URL('./', import.meta.url))
30
+ const argv = process.argv.slice(2)
31
+ const flag = (name) => argv.filter((a) => a.startsWith('--' + name + '=')).map((a) => a.split('=').slice(1).join('='))
32
+ const has = (name) => argv.includes('--' + name)
33
+ const only = flag('only')
34
+ const exclude = flag('exclude')
35
+ const asJson = has('json')
36
+ const concurrency = Math.max(1, Number(flag('concurrency')[0] || Math.min(4, cpus().length)))
37
+
38
+ let suites = readdirSync(HERE).filter((f) => f.endsWith('.test.mjs')).sort()
39
+ if (only.length) suites = suites.filter((f) => only.some((o) => f.includes(o)))
40
+ if (exclude.length) suites = suites.filter((f) => !exclude.some((o) => f.includes(o)))
41
+ if (!suites.length) { console.error('no suites matched'); process.exit(2) }
42
+
43
+ function runSuite(file) {
44
+ return new Promise((resolve) => {
45
+ const t0 = Date.now()
46
+ const child = spawn(process.execPath, [file], { cwd: HERE, stdio: ['ignore', 'pipe', 'pipe'] })
47
+ let out = '', err = ''
48
+ child.stdout.on('data', (d) => { out += d.toString() })
49
+ child.stderr.on('data', (d) => { err += d.toString() })
50
+ child.on('error', (e) => resolve({ file, code: -1, ms: Date.now() - t0, out, err: err + '\n' + String(e) }))
51
+ child.on('close', (code) => resolve({ file, code, ms: Date.now() - t0, out, err }))
52
+ })
53
+ }
54
+
55
+ const results = []
56
+ let cursor = 0
57
+ const started = Date.now()
58
+ async function worker(id) {
59
+ for (;;) {
60
+ const i = cursor++
61
+ if (i >= suites.length) return
62
+ const r = await runSuite(suites[i])
63
+ const tail = String(r.out).trim().split('\n').filter(Boolean).slice(-1)[0] || ''
64
+ results[i] = r
65
+ const mark = r.code === 0 ? 'PASS' : 'FAIL'
66
+ console.log(
67
+ mark + ' ' + r.file.padEnd(38) +
68
+ ' exit=' + String(r.code).padStart(3) +
69
+ ' ' + (r.ms / 1000).toFixed(1).padStart(6) + 's' +
70
+ (tail ? ' ' + tail.slice(0, 78) : '')
71
+ )
72
+ if (r.code !== 0) {
73
+ const lines = (r.out + '\n' + r.err).split('\n').filter(Boolean)
74
+ for (const l of lines.slice(-15)) console.log(' ' + l)
75
+ }
76
+ }
77
+ }
78
+ await Promise.all(Array.from({ length: Math.min(concurrency, suites.length) }, (_, i) => worker(i)))
79
+
80
+ const wall = (Date.now() - started) / 1000
81
+ const sum = results.reduce((a, r) => a + r.ms, 0) / 1000
82
+ const bad = results.filter((r) => r.code !== 0)
83
+ const slowest = results.slice().sort((a, b) => b.ms - a.ms).slice(0, 5)
84
+
85
+ if (asJson) {
86
+ console.log(JSON.stringify({
87
+ concurrency, wallSeconds: Number(wall.toFixed(1)), sumSeconds: Number(sum.toFixed(1)),
88
+ pass: results.length - bad.length, fail: bad.length,
89
+ suites: results.map((r) => ({ file: r.file, exit: r.code, seconds: Number((r.ms / 1000).toFixed(1)) })),
90
+ }, null, 2))
91
+ } else {
92
+ console.log('')
93
+ console.log('concurrency ' + concurrency + ' · wall ' + wall.toFixed(1) + 's · sum of suite times ' + sum.toFixed(1) + 's'
94
+ + ' · speed-up x' + (sum / Math.max(wall, 0.001)).toFixed(2))
95
+ console.log('slowest: ' + slowest.map((r) => r.file.replace('.test.mjs', '') + ' ' + (r.ms / 1000).toFixed(1) + 's').join(' · '))
96
+ console.log('TOTAL ' + results.length + ' PASS ' + (results.length - bad.length) + ' FAIL ' + bad.length)
97
+ for (const b of bad) console.log(' FAILED: ' + b.file + ' (exit ' + b.code + ')')
98
+ }
99
+ process.exit(bad.length === 0 ? 0 : 1)
@@ -28,11 +28,14 @@
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).
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).
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.
36
39
 
37
40
  A /vibe slash command mirrors the main controls. Data lives under {{cwd}}/VibeMath/Projects/<project>/
38
41
  (qs/qs.json, Propos/<分类>_Propos.json, Reliable/, Verified/, Verification_logs/, Progress_Logs/, VibeMath_State/)
@@ -53,6 +56,22 @@
53
56
  with its proofs/refutations transferred into the solution list (verification results sync back to the
54
57
  source proposition); a solver-reported sub-question q_sub registers THREE objects — the q_sub problem,
55
58
  the temporary-assumption proposition p_{q-tmp}, and the problem "判断下述命题是否成立:p_{q-tmp}".
59
+
60
+ LEAN FORMAL VERIFICATION (formalVerify, a tunable parameter):
61
+ - 'off' (default, no extra requirement) | 'encourage' (solver/verifier agents decide by
62
+ implementation difficulty whether to formalize in Lean; once a Lean run passes, the review
63
+ subject becomes FIDELITY — do the Lean definitions/objects/conditions/assumptions/conclusion
64
+ match the proposition as stated) | 'require' (same, plus a gate: a true/false verdict is
65
+ recorded as 未定论 with reason formal-required until the object is Lean-passed or carries an
66
+ explicit, reasoned blocker record; the scheduler is never wedged by it).
67
+ - Paths: work file Formal/<id>.lean; archived proof Verified/Lean/<id>.lean; reusable
68
+ definitions VibeMath/Formal/Lib/; proved lemmas VibeMath/Formal/Proved/.
69
+ - The toolchain knobs leanCommand / leanArgs / leanTimeoutMs are tunable as well
70
+ (e.g. leanCommand='lake' with leanArgs=['env','lean']); a missing Lean binary is
71
+ reported as LEAN_NOT_FOUND and still lets the code be written and archived.
72
+ - vibe_math_status / vibe_math_report show the mode, the per-object formal status and the
73
+ formalization TODO (Formal/TODO.md). The framework never installs Lean and never judges
74
+ fidelity for you.
56
75
  suffix: Your working directory is {{cwd}}.
57
76
  text: |-
58
77
  You are a coding agent powered by the {{model}} model. Your working directory is {{cwd}}.
@@ -72,11 +91,14 @@
72
91
  - vibe_math_status / vibe_math_report — read scheduler status / full progress report (report also writes Progress_Logs/report.json).
73
92
  - vibe_math_pause / vibe_math_abort — pause / abort (abort interrupts all children).
74
93
  - vibe_math_set_mode {mode: manual|auto} — switch manual / auto control.
75
- - 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).
94
+ - 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).
76
95
  - vibe_math_setup / vibe_math_save_settings / vibe_math_template — guided configuration / persist defaults / generate template.
77
96
  - vibe_math_new_project / vibe_math_set_project / vibe_math_list_projects — per-project folders.
78
97
  - vibe_math_list_decisions / vibe_math_decide {id, action: approve|reject|override, verdict?} — resolve manual decisions.
79
98
  - vibe_math_list_agents / vibe_math_message_agent / vibe_math_interrupt_agent — inspect / steer / interrupt subagents.
99
+ - vibe_math_lean_run / vibe_math_lean_archive / vibe_math_lean_lib — Lean formal
100
+ verification (execute / archive / list the reuse library). The scheduler's child agents
101
+ use them too; they work in every mode.
80
102
 
81
103
  A /vibe slash command mirrors the main controls. Data lives under {{cwd}}/VibeMath/Projects/<project>/
82
104
  (qs/qs.json, Propos/<分类>_Propos.json, Reliable/, Verified/, Verification_logs/, Progress_Logs/, VibeMath_State/)
@@ -98,6 +120,22 @@
98
120
  source proposition); a solver-reported sub-question q_sub registers THREE objects — the q_sub problem,
99
121
  the temporary-assumption proposition p_{q-tmp}, and the problem "判断下述命题是否成立:p_{q-tmp}".
100
122
 
123
+ LEAN FORMAL VERIFICATION (formalVerify, a tunable parameter):
124
+ - 'off' (default, no extra requirement) | 'encourage' (solver/verifier agents decide by
125
+ implementation difficulty whether to formalize in Lean; once a Lean run passes, the review
126
+ subject becomes FIDELITY — do the Lean definitions/objects/conditions/assumptions/conclusion
127
+ match the proposition as stated) | 'require' (same, plus a gate: a true/false verdict is
128
+ recorded as 未定论 with reason formal-required until the object is Lean-passed or carries an
129
+ explicit, reasoned blocker record; the scheduler is never wedged by it).
130
+ - Paths: work file Formal/<id>.lean; archived proof Verified/Lean/<id>.lean; reusable
131
+ definitions VibeMath/Formal/Lib/; proved lemmas VibeMath/Formal/Proved/.
132
+ - The toolchain knobs leanCommand / leanArgs / leanTimeoutMs are tunable as well
133
+ (e.g. leanCommand='lake' with leanArgs=['env','lean']); a missing Lean binary is
134
+ reported as LEAN_NOT_FOUND and still lets the code be written and archived.
135
+ - vibe_math_status / vibe_math_report show the mode, the per-object formal status and the
136
+ formalization TODO (Formal/TODO.md). The framework never installs Lean and never judges
137
+ fidelity for you.
138
+
101
139
  - id: agent-instructions
102
140
  name: '@deepseek-ai/dsh-agent-instructions'
103
141
  config: