dsh-vibe-math 2.6.0 → 2.7.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 (59) hide show
  1. package/README.en.md +161 -389
  2. package/README.md +161 -390
  3. package/cordis.patch.yml +62 -14
  4. package/docs/AUDIT-CHECKLIST.md +2 -2
  5. package/docs/final-paper.md +1 -0
  6. package/docs/formal-verification.md +184 -29
  7. package/docs/math-computation.md +163 -0
  8. package/docs/release-notes/RELEASE-NOTES-2.7.0.en.md +151 -0
  9. package/docs/release-notes/RELEASE-NOTES-2.7.0.md +115 -0
  10. package/docs/release-notes/RELEASE-NOTES-2.7.1.en.md +86 -0
  11. package/docs/release-notes/RELEASE-NOTES-2.7.1.md +86 -0
  12. package/docs/test-timing.md +24 -12
  13. package/installer.js +7 -4
  14. package/package.json +21 -3
  15. package/prompt-corpus-persona/persona-corpus.json +12 -12
  16. package/prompt-corpus-persona/persona-corpus.md +128 -32
  17. package/prompt-corpus-v2/formal-verify-v2.json +182 -92
  18. package/prompt-corpus-v2/formal-verify-v2.md +2379 -55
  19. package/prompt-corpus-v3/formal-verify-v3.json +215 -53
  20. package/prompt-corpus-v3/formal-verify-v3.md +2147 -22
  21. package/prompt-corpus-v4/formal-verify-v4.json +14 -14
  22. package/prompt-corpus-v4/formal-verify-v4.md +267 -14
  23. package/prompt-corpus-v5/prompt-corpus-v5.json +62 -62
  24. package/prompt-corpus-v5/prompt-corpus-v5.md +631 -3
  25. package/tests/audit-math-computation-contract.mjs +204 -0
  26. package/tests/audit-math-computation-parity.mjs +198 -0
  27. package/tests/audit-math-computation-sensitivity.mjs +231 -0
  28. package/tests/audit-persona-sensitivity.mjs +4 -4
  29. package/tests/audit-persona-surface.test.mjs +38 -10
  30. package/tests/audit-v5-integrity.mjs +14 -0
  31. package/tests/e2e-v5-round2.test.mjs +459 -2
  32. package/tests/formal-verify-v2.test.mjs +362 -8
  33. package/tests/formal-verify-v3.test.mjs +355 -6
  34. package/tests/formal-verify-v4.test.mjs +295 -6
  35. package/tests/formal-verify-v5.test.mjs +9 -1
  36. package/tests/helpers/math-computation-fake-seam.mjs +163 -0
  37. package/tests/math-computation-shared.test.mjs +806 -0
  38. package/tests/prompt-v5-integrity.test.mjs +5 -5
  39. package/vibe-math-v2/agent.cordis.yml +22 -8
  40. package/vibe-math-v2/math-computation.js +1279 -0
  41. package/vibe-math-v2/math-engines.js +197 -0
  42. package/vibe-math-v2/vibe-math-v2.js +853 -40
  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 +22 -8
  45. package/vibe-math-v3/math-computation.js +1279 -0
  46. package/vibe-math-v3/math-engines.js +197 -0
  47. package/vibe-math-v3/vibe-math-v3.js +844 -47
  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 +38 -6
  50. package/vibe-math-v4/math-computation.js +1279 -0
  51. package/vibe-math-v4/math-engines.js +197 -0
  52. package/vibe-math-v4/vibe-math-v4.js +816 -31
  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 +42 -6
  55. package/vibe-math-v5/math-computation.js +1279 -0
  56. package/vibe-math-v5/math-engines.js +197 -0
  57. package/vibe-math-v5/vibe-math-v5.js +1132 -37
  58. package/vibe-math-v5//345/256/236/347/216/260/346/226/271/346/241/210.md +83 -3
  59. package/vibe-math-v5//346/236/266/346/236/204/345/233/276.md +251 -0
@@ -83,16 +83,16 @@ const probes = [
83
83
  {
84
84
  name: 'v2-lean-tools-line-removed',
85
85
  preset: 'vibe-math-v2', file: 'agent.cordis.yml', nth: 'all', expect: 2,
86
- guarantee: 'the three Lean tools must be named in the persona the main agent receives',
87
- from: ' - vibe_math_lean_run / vibe_math_lean_archive / vibe_math_lean_lib — Lean formal\n verification (execute / archive / list the reuse library). The scheduler\'s child agents\n use them too; they work in every mode.\n',
86
+ guarantee: 'the five Lean tools must be named in the persona the main agent receives',
87
+ from: ' - vibe_math_lean_run / vibe_math_lean_archive / vibe_math_lean_lib / vibe_math_lean_read /\n vibe_math_lean_job — Lean formal verification (execute / archive / list + read the reuse\n library / inspect or wait for a background compile job). leanAsync=true (default) queues the\n compile and returns a jobId; nothing counts as proved until that job settles ok (so "有把握"\n is not the same as "已验证"). The scheduler\'s child agents use them too; they work in every\n mode.\n',
88
88
  to: '',
89
89
  },
90
90
  {
91
91
  name: 'v2-phantom-tool-mentioned',
92
92
  preset: 'vibe-math-v2', file: 'agent.cordis.yml', nth: 'all', expect: 2,
93
93
  guarantee: 'the persona must not advertise a tool that is not registered (the agent would call it and fail)',
94
- from: ' - vibe_math_lean_run / vibe_math_lean_archive / vibe_math_lean_lib — Lean formal',
95
- to: ' - vibe_math_lean_exec / vibe_math_lean_run / vibe_math_lean_archive / vibe_math_lean_lib — Lean formal',
94
+ from: ' - vibe_math_lean_run / vibe_math_lean_archive / vibe_math_lean_lib / vibe_math_lean_read /',
95
+ to: ' - vibe_math_lean_exec / vibe_math_lean_run / vibe_math_lean_archive / vibe_math_lean_lib / vibe_math_lean_read /',
96
96
  },
97
97
 
98
98
  // ── v3 ─────────────────────────────────────────────────────────────────────
@@ -132,29 +132,35 @@ const PRESETS = [
132
132
  dir: 'vibe-math-v2',
133
133
  js: 'vibe-math-v2.js',
134
134
  prefix: 'vibe_math_',
135
- tools: 25,
135
+ tools: 28,
136
136
  // member-facing write-lock / scheduler-metadata tools; the v2 coordinator never
137
137
  // writes Markdown itself, so they stay out of its persona.
138
138
  undocumented: [],
139
- lean: { tools: ['vibe_math_lean_run', 'vibe_math_lean_archive', 'vibe_math_lean_lib'], extra: [] },
139
+ lean: { tools: ['vibe_math_lean_run', 'vibe_math_lean_archive', 'vibe_math_lean_lib', 'vibe_math_lean_read', 'vibe_math_lean_job'], extra: [] },
140
+ // the shared math-computation tool (docs/math-computation.md) is prefix-less by
141
+ // design (INTERFACE-FREEZE.md §3), so it is pinned explicitly here.
142
+ math: { tools: ['math_computation'] },
140
143
  },
141
144
  {
142
145
  dir: 'vibe-math-v3',
143
146
  js: 'vibe-math-v3.js',
144
147
  prefix: 'vibe_math_',
145
- tools: 33,
148
+ tools: 36,
146
149
  // `vibe_math_sync_meta` is no longer undocumented: the promotion-contract line of the
147
150
  // persona now names it as the place to report `lemmas[].价值/关键性` (v3 audit M1 —
148
151
  // without a prompt-side source for that field the promotion main line is unreachable).
149
152
  // The write-lock pair stays out: solver/method-keeper prompts carry it via kcWriteRules().
150
153
  undocumented: ['vibe_math_claim_write', 'vibe_math_release_write'],
151
- lean: { tools: ['vibe_math_lean_run', 'vibe_math_lean_archive', 'vibe_math_lean_lib'], extra: [] },
154
+ lean: { tools: ['vibe_math_lean_run', 'vibe_math_lean_archive', 'vibe_math_lean_lib', 'vibe_math_lean_read', 'vibe_math_lean_job'], extra: [] },
155
+ // the shared math-computation tool (docs/math-computation.md) is prefix-less by
156
+ // design (INTERFACE-FREEZE.md §3), so it is pinned explicitly here.
157
+ math: { tools: ['math_computation'] },
152
158
  },
153
159
  {
154
160
  dir: 'vibe-math-v4',
155
161
  js: 'vibe-math-v4.js',
156
162
  prefix: 'vibe_v4_',
157
- tools: 32,
163
+ tools: 35,
158
164
  // resident-facing tools (mail, library cards, task board, write lock). The
159
165
  // coordinator drives residents through vibe_v4_message / _meeting / _add_member.
160
166
  undocumented: [
@@ -164,13 +170,16 @@ const PRESETS = [
164
170
  'vibe_v4_task_done', 'vibe_v4_list_tasks', 'vibe_v4_report_context',
165
171
  'vibe_v4_claim_write', 'vibe_v4_release_write',
166
172
  ],
167
- lean: { tools: ['vibe_v4_lean_run', 'vibe_v4_lean_archive', 'vibe_v4_lean_lib'], extra: ['vibe_v4_formal_report'] },
173
+ lean: { tools: ['vibe_v4_lean_run', 'vibe_v4_lean_archive', 'vibe_v4_lean_lib', 'vibe_v4_lean_read', 'vibe_v4_lean_job'], extra: ['vibe_v4_formal_report'] },
174
+ // the shared math-computation tool (docs/math-computation.md) is prefix-less by
175
+ // design (INTERFACE-FREEZE.md §3), so it is pinned explicitly here.
176
+ math: { tools: ['math_computation'] },
168
177
  },
169
178
  {
170
179
  dir: 'vibe-math-v5',
171
180
  js: 'vibe-math-v5.js',
172
181
  prefix: 'vibe_v5_',
173
- tools: 37,
182
+ tools: 40,
174
183
  // member- and academician-facing tools; the office (main agent) holds only the
175
184
  // institute-level controls plus the hiring authority. The final-paper pair is an
176
185
  // OFFICE control and IS named in the persona (vibe_v5_paper / vibe_v5_finalize_paper),
@@ -182,11 +191,14 @@ const PRESETS = [
182
191
  'vibe_v5_task_list', 'vibe_v5_task_get', 'vibe_v5_task_update',
183
192
  'vibe_v5_overview', 'vibe_v5_assign', 'vibe_v5_prioritize', 'vibe_v5_nudge',
184
193
  ],
185
- lean: { tools: ['vibe_v5_lean_run', 'vibe_v5_lean_archive', 'vibe_v5_lean_lib'], extra: [] },
194
+ lean: { tools: ['vibe_v5_lean_run', 'vibe_v5_lean_archive', 'vibe_v5_lean_lib', 'vibe_v5_lean_read', 'vibe_v5_lean_job'], extra: [] },
195
+ // the shared math-computation tool (docs/math-computation.md) is prefix-less by
196
+ // design (INTERFACE-FREEZE.md §3), so it is pinned explicitly here.
197
+ math: { tools: ['math_computation'] },
186
198
  },
187
199
  ]
188
200
 
189
- const LEAN_PARAMS = ['formalVerify', 'leanCommand', 'leanArgs', 'leanTimeoutMs']
201
+ const LEAN_PARAMS = ['formalVerify', 'leanCommand', 'leanArgs', 'leanTimeoutMs', 'leanAsync', 'leanJobsMaxParallel', 'leanInitiative', 'leanSearchPaths']
190
202
 
191
203
  for (const P of PRESETS) {
192
204
  const ymlPath = join(BASE, P.dir, 'agent.cordis.yml')
@@ -195,9 +207,19 @@ for (const P of PRESETS) {
195
207
  const src = readFileSync(jsPath, 'utf8')
196
208
 
197
209
  // ---- registered tools -------------------------------------------------
210
+ // Two registration shapes exist now:
211
+ // 1. a literal `registerTool('<name>', …)` (most tools, including the shared math tool in
212
+ // v2/v3, which register it by its frozen prefix-less name);
213
+ // 2. the shared math tool in v4/v5, where the plugin only wires a host callback and the module
214
+ // calls `host.register(MATH_TOOL_NAME, …)`. The module's name is FROZEN
215
+ // (MATH_TOOL_NAME = 'math_computation', INTERFACE-FREEZE.md §3), so a source that wires
216
+ // `registerMathComputation(` contributes exactly that one tool. Without this the shared tool
217
+ // would be invisible to this guard on v4/v5 - a silent coverage hole.
198
218
  const registered = new Set()
199
219
  for (const m of src.matchAll(/registerTool\(\s*'([A-Za-z0-9_]+)'/g)) registered.add(m[1])
220
+ if (/registerMathComputation\s*\(/.test(src)) registered.add('math_computation')
200
221
  eq(registered.size, P.tools, `${P.dir}: registered tool count changed (update this snapshot deliberately)`)
222
+ for (const tool of (P.math ? P.math.tools : [])) ok(registered.has(tool), `${P.dir}: the shared math tool ${tool} is not registered`)
201
223
 
202
224
  // ---- A. both literal blocks exist and are non-empty -------------------
203
225
  const blocks = literalBlocks(yml)
@@ -226,7 +248,13 @@ for (const P of PRESETS) {
226
248
  // Uppercase is part of the token class on purpose: a drifted name such as
227
249
  // `vibe_v4_formal_reportX` must be captured whole and judged unregistered, instead of
228
250
  // being read as a mention of the registered `vibe_v4_formal_report`.
229
- const re = new RegExp('\\b' + P.prefix.replace(/_$/, '') + '_[A-Za-z0-9_]+', 'g')
251
+ // Names that do NOT carry this preset's prefix (the shared `math_computation`) are added to the
252
+ // alternation from the registry, so "every registered tool must be mentioned" stays true for
253
+ // them too instead of forcing them into the `undocumented` snapshot.
254
+ const prefixRoot = P.prefix.replace(/_$/, '')
255
+ const prefixless = [...registered].filter((n) => !new RegExp('^' + prefixRoot + '_').test(n))
256
+ const escapeRe = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
257
+ const re = new RegExp('\\b' + prefixRoot + '_[A-Za-z0-9_]+' + (prefixless.length ? '|\\b' + prefixless.map(escapeRe).join('\\b|\\b') + '\\b' : ''), 'g')
230
258
  for (const m of body.matchAll(re)) {
231
259
  if (body[m.index + m[0].length] === '*') { wildcards.add(m[0]); continue }
232
260
  mentioned.add(m[0])
@@ -90,6 +90,20 @@ for (const m of src.matchAll(/(?:const|let|var)\s+\{([^}]+)\}\s*=/g)) {
90
90
  for (const part of m[1].split(',')) { const n = part.split(':').pop().trim(); if (n) defined.add(n) }
91
91
  }
92
92
  for (const m of src.matchAll(/catch\s*\(\s*([A-Za-z_$][\w$]*)\s*\)/g)) defined.add(m[1])
93
+ // ESM imports are DEFINITIONS too: the preset imports the shared `math_computation` module
94
+ // (INTERFACE-FREEZE §5.1), so calling an imported function is not a ReferenceError. Without
95
+ // this every imported symbol was reported as "called but never defined"; a call to a name that
96
+ // is neither declared nor imported is still flagged.
97
+ for (const m of src.matchAll(/import\s*(?:\*\s*as\s+([A-Za-z_$][\w$]*)|([A-Za-z_$][\w$]*)\s*,?\s*)?(?:\{([^}]*)\}\s*)?from\s*['"][^'"]*['"]/g)) {
98
+ if (m[1]) defined.add(m[1])
99
+ if (m[2]) defined.add(m[2])
100
+ if (m[3]) {
101
+ for (const part of m[3].split(',')) {
102
+ const name = part.split(/\s+as\s+/).pop().trim()
103
+ if (name) defined.add(name)
104
+ }
105
+ }
106
+ }
93
107
  // Function/method PARAMETERS are locally bound identifiers too, not free calls.
94
108
  for (const m of src.matchAll(/function\s*[A-Za-z_$]*\s*\(([^)]*)\)/g)) {
95
109
  for (const raw of m[1].split(',')) {