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
@@ -0,0 +1,156 @@
1
+ // math-engines.js — P1 engine descriptors for the `math_computation` tool.
2
+ //
3
+ // CANONICAL COPY. This file must stay BYTE-IDENTICAL in:
4
+ // vibe-math-v2/math-engines.js, vibe-math-v3/…, vibe-math-v4/…, vibe-math-v5/…
5
+ // Source of truth for the data: _oneoff/mc-P1-ready/engines.md §2.
6
+ // No repo imports — node builtins only (this file imports nothing at all).
7
+ //
8
+ // Placeholders used in the argv templates (each substitutes into ONE argv element only):
9
+ // <script> <expr> <pkgs> <probeCode> <exe> <pkg> <cliArgv...>
10
+ // A descriptor is pure data; every template can be overridden by the user via mathEngineOverride.
11
+
12
+ export const MATH_ENGINE_ORDER = ['python', 'r', 'octave', 'julia', 'matlab', 'maple', 'wolfram', 'cli']
13
+
14
+ // Usage/option-error heuristics: when an engine exits non-zero and its output looks like one of
15
+ // these, the tool returns MATH_ENGINE_BAD_ARGV (pointing at mathEngineOverride) instead of a bare
16
+ // MATH_NONZERO_EXIT. This is what makes a version-mismatched commercial template diagnosable.
17
+ const ARG_ERROR_HINTS = ['unknown option', 'invalid option', 'unrecognized option', 'unrecognized argument', 'usage:', 'Usage:', 'illegal option']
18
+
19
+ export const MATH_ENGINES = {
20
+ python: {
21
+ name: 'python', phase: 'P1',
22
+ candidates: ['python3', 'python', 'py'], winPrefix: ['-3'],
23
+ versionArgv: ['--version'], versionRe: '(\\d+\\.\\d+\\.\\d+)',
24
+ scriptArgv: ['<script>'], evalArgv: ['-c', '<expr>'], stdinArgv: ['-'], ext: '.py',
25
+ probeCode: "import importlib.util,sys;print('|'.join('%s:%s'%(p,'ok' if importlib.util.find_spec(p) else 'missing') for p in sys.argv[1:]))",
26
+ packageProbe: { argv: ['-c', '<probeCode>', '<pkgs>'], parse: 'pairs' },
27
+ license: 'free', argErrorHints: ARG_ERROR_HINTS,
28
+ install: {
29
+ manager: 'pip',
30
+ userArgv: ['<exe>', '-m', 'pip', 'install', '--user', '<pkg>'],
31
+ systemArgv: ['<exe>', '-m', 'pip', 'install', '<pkg>'],
32
+ uninstallArgv: ['<exe>', '-m', 'pip', 'uninstall', '-y', '<pkg>'],
33
+ },
34
+ userInstall: { windows: 'winget install --id Python.Python.3.12', macos: 'brew install python', linux: 'apt install python3' },
35
+ },
36
+ r: {
37
+ name: 'r', phase: 'P1',
38
+ candidates: ['Rscript', 'R'],
39
+ versionArgv: ['--version'], versionRe: '(\\d+\\.\\d+\\.\\d+)',
40
+ scriptArgv: ['<script>'], evalArgv: ['-e', '<expr>'], stdinArgv: ['--no-save', '--slave'], ext: '.R',
41
+ probeCode: "cat(paste(sapply(strsplit('__PKGS__',',')[[1]],function(p) paste0(p,':',requireNamespace(p,quietly=TRUE))),collapse='|'))",
42
+ packageProbe: { argv: ['-e', '<probeCode>'], parse: 'pairs' },
43
+ license: 'free', argErrorHints: ARG_ERROR_HINTS,
44
+ install: {
45
+ manager: 'r',
46
+ userArgv: ['<exe>', '-e', "install.packages('__PKG__',lib=Sys.getenv('R_LIBS_USER'),repos='https://cloud.r-project.org')"],
47
+ uninstallArgv: ['<exe>', '-e', "remove.packages('__PKG__',lib=Sys.getenv('R_LIBS_USER'))"],
48
+ },
49
+ userInstall: { windows: 'winget install --id RProject.R', macos: 'brew install r', linux: 'apt install r-base' },
50
+ },
51
+ octave: {
52
+ name: 'octave', phase: 'P1',
53
+ candidates: ['octave', 'octave-cli'],
54
+ versionArgv: ['--version'], versionRe: '(\\d+\\.\\d+\\.\\d+)',
55
+ scriptArgv: ['--no-gui', '--quiet', '<script>'], evalArgv: ['--no-gui', '--quiet', '--eval', '<expr>'],
56
+ stdinArgv: ['--no-gui', '--quiet'], ext: '.m',
57
+ probeCode: "s=pkg('list'); n={'__QPKGS__'}; for i=1:numel(n); printf('%s:%s|',n{i},merge(any(cellfun(@(x) strcmp(x.name,n{i}),s)),'ok','missing')); end",
58
+ packageProbe: { argv: ['--no-gui', '--quiet', '--eval', '<probeCode>'], parse: 'pairs' },
59
+ license: 'free', argErrorHints: ARG_ERROR_HINTS,
60
+ install: {
61
+ manager: 'octave-pkg',
62
+ userArgv: ['<exe>', '--no-gui', '--quiet', '--eval', "pkg install -forge __PKG__"],
63
+ uninstallArgv: ['<exe>', '--no-gui', '--quiet', '--eval', 'pkg uninstall __PKG__'],
64
+ },
65
+ userInstall: { windows: 'winget install --id GNU.Octave', macos: 'brew install octave', linux: 'apt install octave' },
66
+ },
67
+ julia: {
68
+ name: 'julia', phase: 'P1',
69
+ candidates: ['julia'],
70
+ versionArgv: ['--version'], versionRe: '(\\d+\\.\\d+\\.\\d+)',
71
+ scriptArgv: ['<script>'], evalArgv: ['-e', '<expr>'], stdinArgv: ['-'], ext: '.jl',
72
+ probeCode: 'for p in [__QPKGS__]; println(p, ":", Base.find_package(p) === nothing ? "missing" : "ok"); end',
73
+ packageProbe: { argv: ['-e', '<probeCode>'], parse: 'pairs' },
74
+ license: 'free', argErrorHints: ARG_ERROR_HINTS,
75
+ install: {
76
+ manager: 'julia-pkg',
77
+ userArgv: ['<exe>', '-e', 'using Pkg; Pkg.add("__PKG__")'],
78
+ uninstallArgv: ['<exe>', '-e', 'using Pkg; Pkg.rm("__PKG__")'],
79
+ },
80
+ userInstall: { windows: 'winget install --id Julialang.Julia', macos: 'brew install julia', linux: 'apt install julia' },
81
+ },
82
+ matlab: {
83
+ name: 'matlab', phase: 'P1',
84
+ candidates: ['matlab'],
85
+ versionArgv: ['-batch', 'disp(version)'], versionRe: '(\\d+\\.\\d+)',
86
+ scriptArgv: ['-batch', "run('<script>')"], evalArgv: ['-batch', '<expr>'], stdinArgv: null, ext: '.m',
87
+ probeCode: "t={'__QPKGS__'}; for i=1:numel(t); printf('%s:%d|',t{i},license('test',t{i})); end",
88
+ packageProbe: { argv: ['-batch', '<probeCode>'], parse: 'pairs' },
89
+ license: 'commercial', argErrorHints: ARG_ERROR_HINTS,
90
+ licenseProbe: { argv: ['-batch', "disp(license('test','MATLAB'))"], okWhen: 'trim-1' },
91
+ install: null, vendor: 'https://www.mathworks.com/install',
92
+ userInstall: { windows: 'vendor installer + activation', macos: 'vendor installer + activation', linux: 'vendor installer + activation' },
93
+ },
94
+ maple: {
95
+ name: 'maple', phase: 'P1',
96
+ candidates: ['maple'],
97
+ versionArgv: ['--version'], versionRe: '(\\d+\\.\\d+)',
98
+ scriptArgv: ['-q', '<script>'], evalArgv: ['-q', '-c', '<expr>'], stdinArgv: null, ext: '.mpl',
99
+ probeCode: 'for p in ["__PKGS__"] do try with(p) catch: printf("%s:missing|", p); next end try; printf("%s:ok|", p) end do',
100
+ packageProbe: { argv: ['-q', '-c', '<probeCode>'], parse: 'pairs' },
101
+ license: 'commercial', argErrorHints: ARG_ERROR_HINTS,
102
+ licenseProbe: { argv: ['-q', '-c', 'printf("1")'], okWhen: 'exit-0' },
103
+ install: null, vendor: 'https://www.maplesoft.com/support/installers/',
104
+ verify: true, verifyReason: 'CLI spelling varies by Maple version - confirm on a licensed machine',
105
+ userInstall: { windows: 'vendor installer + activation', macos: 'vendor installer + activation', linux: 'vendor installer + activation' },
106
+ },
107
+ wolfram: {
108
+ name: 'wolfram', phase: 'P1',
109
+ candidates: ['wolframscript', 'WolframKernel', 'math'],
110
+ versionArgv: ['-code', '$Version'], versionRe: '(\\d+\\.\\d+(\\.\\d+)?)',
111
+ scriptArgv: ['-file', '<script>'], evalArgv: ['-code', '<expr>'], stdinArgv: null, ext: '.wl',
112
+ probeCode: 'Do[Print[p,":",If[Quiet[Check[Needs[p];True,False]],"ok","missing"]],{p,{__QPKGS__}}]',
113
+ packageProbe: { argv: ['-code', '<probeCode>'], parse: 'pairs' },
114
+ license: 'commercial', argErrorHints: ARG_ERROR_HINTS,
115
+ licenseProbe: { argv: ['-code', 'Print[$LicenseType]'], okWhen: 'not-unlicensed' },
116
+ install: null, vendor: 'https://www.wolfram.com/engine/',
117
+ userInstall: { windows: 'vendor installer + activation', macos: 'vendor installer + activation', linux: 'vendor installer + activation' },
118
+ },
119
+ cli: {
120
+ name: 'cli', phase: 'P1', defaultOn: true,
121
+ candidates: [], resolveFrom: 'cli.command',
122
+ versionArgv: ['--version'], versionRe: '([^\\s]+)', versionOptional: true,
123
+ scriptArgv: ['<cliArgv...>'], evalArgv: null, stdinArgv: null, ext: '.txt',
124
+ probeCode: null, packageProbe: null,
125
+ license: 'user', argErrorHints: ARG_ERROR_HINTS,
126
+ install: null, vendor: null,
127
+ policy: { requiresMathMode: 'typed+shell', requiresEngineInList: true },
128
+ userInstall: { windows: 'user-provided', macos: 'user-provided', linux: 'user-provided' },
129
+ },
130
+ }
131
+
132
+ // P2 (not registered in P1 - kept here so the descriptor table stays one file).
133
+ export const MATH_P2_ENGINES = {
134
+ sage: {
135
+ name: 'sage', phase: 'P2', candidates: ['sage'],
136
+ versionArgv: ['--version'], versionRe: '(\\d+\\.\\d+)',
137
+ scriptArgv: ['<script>'], evalArgv: ['-c', '<expr>'], stdinArgv: ['-'], ext: '.sage',
138
+ probeCode: null, packageProbe: { argv: ['-pip', 'list'], parse: 'lines' },
139
+ license: 'free', argErrorHints: ARG_ERROR_HINTS, install: null,
140
+ },
141
+ }
142
+
143
+ export function mathEngineCandidates(name) {
144
+ const d = MATH_ENGINES[name]
145
+ if (!d || name === 'cli') return null
146
+ return d.candidates.slice()
147
+ }
148
+
149
+ export function mathEngineArgErrorHints(name) {
150
+ const d = MATH_ENGINES[name]
151
+ return d && Array.isArray(d.argErrorHints) ? d.argErrorHints.slice() : ARG_ERROR_HINTS.slice()
152
+ }
153
+
154
+ export function isKnownMathEngine(name) {
155
+ return typeof name === 'string' && (Object.prototype.hasOwnProperty.call(MATH_ENGINES, name) || Object.prototype.hasOwnProperty.call(MATH_P2_ENGINES, name))
156
+ }