dsh-vibe-math 2.7.1 → 2.7.3

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 (114) hide show
  1. package/README.en.md +682 -690
  2. package/README.md +19 -27
  3. package/cordis.patch.yml +112 -16
  4. package/docs/AUDIT-CHECKLIST.md +744 -518
  5. package/docs/COMPAT-AUDIT-ROUND2.md +35 -9
  6. package/docs/COMPAT-AUDIT-ROUND3.md +154 -154
  7. package/docs/final-paper.md +172 -172
  8. package/docs/formal-verification.md +588 -588
  9. package/docs/math-computation.md +194 -163
  10. package/docs/parameter-schema.md +37 -0
  11. package/docs/release-notes/README.en.md +49 -0
  12. package/docs/release-notes/README.md +48 -0
  13. package/docs/release-notes/RELEASE-NOTES-2.7.2.en.md +72 -0
  14. package/docs/release-notes/RELEASE-NOTES-2.7.2.md +72 -0
  15. package/docs/release-notes/RELEASE-NOTES-2.7.3.en.md +67 -0
  16. package/docs/release-notes/RELEASE-NOTES-2.7.3.md +67 -0
  17. package/docs/release-notes/TEMPLATE.md +126 -0
  18. package/docs/status-report-fields.md +167 -0
  19. package/docs/test-timing.md +157 -154
  20. package/installer.js +27 -17
  21. package/package.json +55 -3
  22. package/prompt-corpus-persona/persona-corpus.json +9 -9
  23. package/prompt-corpus-persona/persona-corpus.md +225 -33
  24. package/prompt-corpus-v2/formal-verify-v2.json +305 -113
  25. package/prompt-corpus-v2/formal-verify-v2.md +2399 -279
  26. package/prompt-corpus-v3/formal-verify-v3.json +134 -110
  27. package/prompt-corpus-v3/formal-verify-v3.md +409 -141
  28. package/prompt-corpus-v4/formal-verify-v4.json +18 -18
  29. package/prompt-corpus-v4/formal-verify-v4.md +49 -44
  30. package/prompt-corpus-v5/prompt-corpus-v5.json +82 -82
  31. package/prompt-corpus-v5/prompt-corpus-v5.md +513 -259
  32. package/scripts/update-doc-counts.mjs +71 -0
  33. package/tests/audit-artifact-docs.mjs +72 -0
  34. package/tests/audit-artifact-docs.mutants.mjs +58 -0
  35. package/tests/audit-installer-assertions.mutants.mjs +63 -0
  36. package/tests/audit-installer-compat.test.mjs +52 -4
  37. package/tests/audit-installer-policy.test.mjs +41 -8
  38. package/tests/audit-math-computation-contract.mjs +107 -9
  39. package/tests/audit-math-computation-contract.mutants.mjs +106 -0
  40. package/tests/audit-math-computation-parity.mjs +164 -3
  41. package/tests/audit-math-computation-sensitivity.mjs +6 -4
  42. package/tests/audit-package-membership.mjs +57 -0
  43. package/tests/audit-package-membership.mutants.mjs +28 -0
  44. package/tests/audit-participant-set-parity.mjs +160 -0
  45. package/tests/audit-path-discipline.mjs +83 -0
  46. package/tests/audit-path-discipline.mutants.mjs +51 -0
  47. package/tests/audit-persona-sensitivity.mjs +14 -0
  48. package/tests/audit-persona-surface.mutants.mjs +69 -0
  49. package/tests/audit-persona-surface.test.mjs +63 -22
  50. package/tests/audit-prompt-duplication.mjs +143 -0
  51. package/tests/audit-prompt-duplication.mutants.mjs +50 -0
  52. package/tests/audit-prompt-invariants.mjs +43 -5
  53. package/tests/audit-readme-bilingual.test.mjs +152 -0
  54. package/tests/audit-readme-counts.mjs +95 -0
  55. package/tests/audit-readme-counts.mutants.mjs +52 -0
  56. package/tests/audit-registration.mjs +78 -0
  57. package/tests/audit-status-report-fields.mjs +172 -0
  58. package/tests/audit-status-report-fields.mutants.mjs +64 -0
  59. package/tests/audit-v3-registration-parity.mjs +156 -0
  60. package/tests/audit-v5-integrity.mjs +300 -13
  61. package/tests/audit-v5-lean-abstention.mjs +392 -0
  62. package/tests/audit-v5-lean-abstention.mutants.mjs +106 -0
  63. package/tests/audit-v5-prompt-duplication.mjs +88 -0
  64. package/tests/audit-v5-prompt-duplication.mutants.mjs +34 -0
  65. package/tests/audit-v5-sensitivity.mjs +15 -8
  66. package/tests/e2e-identity-a6.mutants.mjs +65 -0
  67. package/tests/e2e-v5-round2.test.mjs +566 -12
  68. package/tests/formal-verify-v2.test.mjs +91 -5
  69. package/tests/formal-verify-v3.mutants.mjs +117 -0
  70. package/tests/formal-verify-v3.test.mjs +85 -6
  71. package/tests/formal-verify-v4.mutants.mjs +152 -0
  72. package/tests/formal-verify-v4.test.mjs +628 -9
  73. package/tests/formal-verify-v5.test.mjs +68 -9
  74. package/tests/helpers/doc-counts-format.mjs +41 -0
  75. package/tests/helpers/math-computation-fake-seam.mjs +4 -0
  76. package/tests/math-computation-a1.mutants.mjs +72 -0
  77. package/tests/math-computation-archive-rerun.mutants.mjs +65 -0
  78. package/tests/math-computation-discovery.mutants.mjs +76 -0
  79. package/tests/math-computation-shared.test.mjs +396 -2
  80. package/tests/math-computation-v2.test.mjs +767 -0
  81. package/tests/math-computation-v3.test.mjs +759 -0
  82. package/tests/math-computation-v4.mutants.mjs +133 -0
  83. package/tests/math-computation-v4.test.mjs +739 -0
  84. package/tests/prompt-v5-integrity.test.mjs +13 -2
  85. package/tests/run-tests.mjs +139 -9
  86. package/tests/run-tests.mutants.mjs +70 -0
  87. package/tests/selfdrive-v5.mjs +53 -1
  88. package/tests/selfdrive-v5.mutants.mjs +132 -0
  89. package/tests/v2-fix-probes.mutants.mjs +100 -0
  90. package/tests/v2-fix-probes.test.mjs +1039 -0
  91. package/tests/v2-list-agents-and-next-step.mutants.mjs +106 -0
  92. package/tests/v3-fix-probes.mutants.mjs +95 -0
  93. package/tests/v3-fix-probes.test.mjs +891 -0
  94. package/tests/v5-institute-fixes.mutants.mjs +190 -0
  95. package/vibe-math-v2/agent.cordis.yml +62 -6
  96. package/vibe-math-v2/math-computation.js +229 -29
  97. package/vibe-math-v2/math-engines.js +12 -12
  98. package/vibe-math-v2/vibe-math-v2.js +458 -119
  99. package/vibe-math-v2//345/256/236/347/216/260/346/226/271/346/241/210.md +5 -1
  100. package/vibe-math-v3/agent.cordis.yml +72 -6
  101. package/vibe-math-v3/math-computation.js +229 -29
  102. package/vibe-math-v3/math-engines.js +12 -12
  103. package/vibe-math-v3/vibe-math-v3.js +482 -139
  104. package/vibe-math-v4/agent.cordis.yml +44 -8
  105. package/vibe-math-v4/math-computation.js +229 -29
  106. package/vibe-math-v4/math-engines.js +12 -12
  107. package/vibe-math-v4/vibe-math-v4.js +245 -52
  108. package/vibe-math-v4//345/256/236/347/216/260/346/226/271/346/241/210.md +2 -0
  109. package/vibe-math-v5/agent.cordis.yml +46 -12
  110. package/vibe-math-v5/math-computation.js +229 -29
  111. package/vibe-math-v5/math-engines.js +12 -12
  112. package/vibe-math-v5/vibe-math-v5.js +1307 -243
  113. package/vibe-math-v5//345/256/236/347/216/260/346/226/271/346/241/210.md +1728 -1655
  114. package/vibe-math-v5//346/236/266/346/236/204/345/233/276.md +693 -693
@@ -0,0 +1,133 @@
1
+ // Registered mutant harness for the v4 math-computation WIRING suite — the suite's header documents the
2
+ // five mutants it "must kill"; this file makes that claim executable.
3
+ //
4
+ // F3 NOTE (measured, 2026-xx, `git rev-parse HEAD` at the time of the fix): the header's original M1
5
+ // anchor was STALE - it said "drop 'cli' from DEFAULT_PARAMS.mathEngines (or defaultOn)", but
6
+ // · v4's DEFAULT_PARAMS has no literal engine list (it is `MATH_PARAM_DEFAULTS.mathEngines.slice()`),
7
+ // · the real list is `MATH_ENGINE_ORDER` in `vibe-math-v4/math-engines.js:12`,
8
+ // · and `defaultOn` does not exist anywhere in the tree (a phantom identifier).
9
+ // The header text is corrected accordingly, and the anchor below is the real site. Also measured: a
10
+ // first measurement pointed the seam at the mutated MODULE (`math-engines.js`) and the suite died with
11
+ // "apply is not a function" => `fails=0` was a measurement bug, not a product finding; a mutant must
12
+ // always be fed through the seam pointing at the PLUGIN file.
13
+ //
14
+ // Usage: node tests/math-computation-v4.mutants.mjs
15
+ import { readFileSync, writeFileSync, mkdirSync, copyFileSync, rmSync, readdirSync } from 'node:fs'
16
+ import { execFileSync } from 'node:child_process'
17
+ import { dirname, join } from 'node:path'
18
+ import { tmpdir } from 'node:os'
19
+ import { fileURLToPath } from 'node:url'
20
+ const HERE = dirname(fileURLToPath(import.meta.url))
21
+ const REPO = join(HERE, '..')
22
+ const PRESET = 'vibe-math-v4'
23
+ const MAIN = PRESET + '.js'
24
+ const SUITE = 'tests/math-computation-v4.test.mjs'
25
+ const ENV = 'V4_PLUGIN'
26
+ const CHILD_TIMEOUT_MS = Number(process.env.MUTANT_CHILD_TIMEOUT_MS || 300000)
27
+ const TIMES = []
28
+ const hangs = []
29
+ const skipped = []
30
+ function copyGraph(file, dest) {
31
+ const src = join(REPO, PRESET, file)
32
+ copyFileSync(src, join(dest, file))
33
+ for (const m of readFileSync(src, 'utf8').matchAll(/from\s+'(\.\/[A-Za-z0-9_.-]+\.js)'/g)) {
34
+ const dep = m[1].slice(2)
35
+ if (!readdirSync(dest).includes(dep)) copyGraph(dep, dest)
36
+ }
37
+ }
38
+ function runFamily(f) {
39
+ const dest = join(tmpdir(), 'v4math-mut-' + Math.random().toString(36).slice(2, 10))
40
+ mkdirSync(dest, { recursive: true })
41
+ copyGraph(MAIN, dest)
42
+ const target = join(dest, f.editFile || MAIN)
43
+ const before = readFileSync(target, 'utf8')
44
+ let mutated = null
45
+ if (f.fromRe) {
46
+ const re = new RegExp(f.fromRe)
47
+ const m = re.exec(before)
48
+ if (!m) { skipped.push(f.name + ' (regex missed)'); console.error(' SKIP - ' + f.name + ' (regex missed)'); rmSync(dest, { recursive: true, force: true }); return false }
49
+ mutated = before.replace(re, f.to)
50
+ } else {
51
+ const n = before.split(f.from).length - 1
52
+ if (n !== 1) { skipped.push(f.name + ' (anchor x' + n + ')'); console.error(' SKIP - ' + f.name + ' (anchor x' + n + ')'); rmSync(dest, { recursive: true, force: true }); return false }
53
+ mutated = before.replace(f.from, f.to)
54
+ }
55
+ writeFileSync(target, mutated, 'utf8')
56
+ try { execFileSync(process.execPath, ['--check', target], { stdio: 'pipe' }) }
57
+ catch (e) {
58
+ writeFileSync(target, before, 'utf8')
59
+ skipped.push(f.name + ' (mutation did not compile)')
60
+ console.error(' SKIP - ' + f.name + ' (mutation did not compile; restored)')
61
+ rmSync(dest, { recursive: true, force: true })
62
+ return false
63
+ }
64
+ const t0 = Date.now()
65
+ let out = ''
66
+ let code = 0
67
+ let hang = false
68
+ try {
69
+ // ALWAYS point the seam at the PLUGIN file, even when the mutated file is a dependency (measured
70
+ // trap: pointing it at math-engines.js made the suite die with "apply is not a function").
71
+ out = execFileSync(process.execPath, [SUITE], {
72
+ cwd: REPO, encoding: 'utf8', timeout: CHILD_TIMEOUT_MS, killSignal: 'SIGKILL',
73
+ env: Object.assign({}, process.env, { [ENV]: join(dest, MAIN) }),
74
+ })
75
+ } catch (e) {
76
+ if (e && (e.killed || e.signal === 'SIGKILL')) hang = true
77
+ code = (e && e.status) || 1
78
+ out = String((e && e.stdout) || '') + String((e && e.stderr) || '')
79
+ }
80
+ const ms = Date.now() - t0
81
+ TIMES.push([f.name, ms])
82
+ if (hang) hangs.push(f.name + '(' + Math.round(ms / 1000) + 's)')
83
+ const named = out.split(/\r?\n/).filter((l) => /^\s*(FAIL - | {2}- )/.test(l) && f.expect.test(l)).map((l) => l.trim())
84
+ const ok = !hang && code !== 0 && named.length > 0
85
+ console.log((hang ? ' HANG - ' : (ok ? ' ok - ' : ' FAIL - ')) + f.name + ' [' + ms + 'ms]' + (named.length ? ' :: ' + named[0].slice(0, 150) : ' :: no named red (exit=' + code + ')'))
86
+ rmSync(dest, { recursive: true, force: true })
87
+ return ok
88
+ }
89
+ const FAMILIES = [
90
+ {
91
+ // The header's M1, with the CORRECTED site (math-engines.js, not DEFAULT_PARAMS.mathEngines).
92
+ name: 'M1 default-engines-dropped: cli removed from MATH_ENGINE_ORDER',
93
+ editFile: 'math-engines.js',
94
+ from: "export const MATH_ENGINE_ORDER = ['python', 'r', 'octave', 'julia', 'matlab', 'maple', 'wolfram', 'cli']",
95
+ to: "export const MATH_ENGINE_ORDER = ['python', 'r', 'octave', 'julia', 'matlab', 'maple', 'wolfram']",
96
+ expect: /engine=cli runs with the DEFAULT parameters/,
97
+ },
98
+ {
99
+ name: 'M2 typed-still-shell: the availability line is forced to typed+shell',
100
+ from: "mathAvailabilityLine(probe,'zh',params.mathMode)",
101
+ to: "mathAvailabilityLine(probe,'zh','typed+shell')",
102
+ expect: /mathMode=typed injects NO shell-fallback sentence/,
103
+ },
104
+ {
105
+ name: 'M3 timeout-no-kill: the timeout path no longer terminates the handle',
106
+ fromRe: "killedByUs=true(\\s*)try \\{ if\\(typeof handle\\.terminate==='function'\\) handle\\.terminate\\(\\) \\} catch\\(e\\)\\{ /\\* best effort \\*/ \\}",
107
+ to: 'killedByUs=true$1try { if(false) handle.terminate() } catch(e){ /* best effort */ }',
108
+ expect: /the timeout path really called handle\.terminate\(\)/,
109
+ },
110
+ {
111
+ name: 'M4 registration-dropped: the tool is registered under a different name',
112
+ from: 'registerTool(mathToolFace.name, mathToolFace.description',
113
+ to: "registerTool(mathToolFace.name + '_x', mathToolFace.description",
114
+ expect: /math_computation is registered exactly once/,
115
+ },
116
+ {
117
+ name: 'M5 params-not-normalized: normalizeParam returns the raw value',
118
+ from: 'function normalizeParam(k, v){',
119
+ to: 'function normalizeParam(k, v){ return v // MUTANT: raw',
120
+ expect: /mathTimeoutMs=5 was clamped by the shared normalizer|an unknown mathMode degrades to typed\+shell/,
121
+ },
122
+ ]
123
+ let red = 0
124
+ for (const f of FAMILIES) { const ok = runFamily(f); if (ok) red++ }
125
+ const totalMs = TIMES.reduce((a, t) => a + t[1], 0)
126
+ console.log('')
127
+ console.log('mutant families reddening the v4 math-computation wiring suite by name: ' + red + '/' + FAMILIES.length)
128
+ console.log('timings (per family): ' + TIMES.map((t) => String(t[0]).split(':')[0] + '=' + t[1] + 'ms').join(' '))
129
+ console.log('TOTAL WALL TIME (all families + setup): ' + totalMs + 'ms (' + Math.round(totalMs / 1000) + 's)')
130
+ console.log('hangs=[' + hangs.join(' | ') + ']')
131
+ console.log('skipped=[' + skipped.join(' | ') + ']')
132
+ if (red !== FAMILIES.length || skipped.length || hangs.length) process.exit(1)
133
+ console.log('ALL MUTANTS RED AS REQUIRED')