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.
- package/README.en.md +161 -389
- package/README.md +161 -390
- package/cordis.patch.yml +62 -14
- package/docs/AUDIT-CHECKLIST.md +2 -2
- package/docs/final-paper.md +1 -0
- package/docs/formal-verification.md +184 -29
- package/docs/math-computation.md +163 -0
- package/docs/release-notes/RELEASE-NOTES-2.7.0.en.md +151 -0
- package/docs/release-notes/RELEASE-NOTES-2.7.0.md +115 -0
- package/docs/release-notes/RELEASE-NOTES-2.7.1.en.md +86 -0
- package/docs/release-notes/RELEASE-NOTES-2.7.1.md +86 -0
- package/docs/test-timing.md +24 -12
- package/installer.js +7 -4
- package/package.json +21 -3
- package/prompt-corpus-persona/persona-corpus.json +12 -12
- package/prompt-corpus-persona/persona-corpus.md +128 -32
- package/prompt-corpus-v2/formal-verify-v2.json +182 -92
- package/prompt-corpus-v2/formal-verify-v2.md +2379 -55
- package/prompt-corpus-v3/formal-verify-v3.json +215 -53
- package/prompt-corpus-v3/formal-verify-v3.md +2147 -22
- package/prompt-corpus-v4/formal-verify-v4.json +14 -14
- package/prompt-corpus-v4/formal-verify-v4.md +267 -14
- package/prompt-corpus-v5/prompt-corpus-v5.json +62 -62
- package/prompt-corpus-v5/prompt-corpus-v5.md +631 -3
- package/tests/audit-math-computation-contract.mjs +204 -0
- package/tests/audit-math-computation-parity.mjs +198 -0
- package/tests/audit-math-computation-sensitivity.mjs +231 -0
- package/tests/audit-persona-sensitivity.mjs +4 -4
- package/tests/audit-persona-surface.test.mjs +38 -10
- package/tests/audit-v5-integrity.mjs +14 -0
- package/tests/e2e-v5-round2.test.mjs +459 -2
- package/tests/formal-verify-v2.test.mjs +362 -8
- package/tests/formal-verify-v3.test.mjs +355 -6
- package/tests/formal-verify-v4.test.mjs +295 -6
- package/tests/formal-verify-v5.test.mjs +9 -1
- package/tests/helpers/math-computation-fake-seam.mjs +163 -0
- package/tests/math-computation-shared.test.mjs +806 -0
- package/tests/prompt-v5-integrity.test.mjs +5 -5
- package/vibe-math-v2/agent.cordis.yml +22 -8
- package/vibe-math-v2/math-computation.js +1279 -0
- package/vibe-math-v2/math-engines.js +197 -0
- package/vibe-math-v2/vibe-math-v2.js +853 -40
- package/vibe-math-v2//345/256/236/347/216/260/346/226/271/346/241/210.md +6 -0
- package/vibe-math-v3/agent.cordis.yml +22 -8
- package/vibe-math-v3/math-computation.js +1279 -0
- package/vibe-math-v3/math-engines.js +197 -0
- package/vibe-math-v3/vibe-math-v3.js +844 -47
- package/vibe-math-v3//345/256/236/347/216/260/346/226/271/346/241/210.md +6 -0
- package/vibe-math-v4/agent.cordis.yml +38 -6
- package/vibe-math-v4/math-computation.js +1279 -0
- package/vibe-math-v4/math-engines.js +197 -0
- package/vibe-math-v4/vibe-math-v4.js +816 -31
- package/vibe-math-v4//345/256/236/347/216/260/346/226/271/346/241/210.md +6 -0
- package/vibe-math-v5/agent.cordis.yml +42 -6
- package/vibe-math-v5/math-computation.js +1279 -0
- package/vibe-math-v5/math-engines.js +197 -0
- package/vibe-math-v5/vibe-math-v5.js +1132 -37
- package/vibe-math-v5//345/256/236/347/216/260/346/226/271/346/241/210.md +83 -3
- package/vibe-math-v5//346/236/266/346/236/204/345/233/276.md +251 -0
|
@@ -0,0 +1,197 @@
|
|
|
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
|
+
// round-7 (live): NO shell metacharacters (`|`, `%`) in any probe argv - a real host rejected
|
|
26
|
+
// them with a null spawn. One line per package: "name ok|missing".
|
|
27
|
+
probeCode: "import importlib.util,sys\nfor p in sys.argv[1:]: print(p, 'ok' if importlib.util.find_spec(p) is not None else 'missing')",
|
|
28
|
+
// round-7 (finding 6, found on the real bundled python): the probe code iterates `sys.argv[1:]`,
|
|
29
|
+
// so the names must be SEPARATE argv items - the old comma-joined `<pkgs>` made it look up one
|
|
30
|
+
// package literally named "numpy,pandas" and reported everything missing.
|
|
31
|
+
packageProbe: { argv: ['-c', '<probeCode>', '<pkgs...>'], parse: 'pairs' },
|
|
32
|
+
license: 'free', argErrorHints: ARG_ERROR_HINTS,
|
|
33
|
+
install: {
|
|
34
|
+
manager: 'pip',
|
|
35
|
+
userArgv: ['<exe>', '-m', 'pip', 'install', '--user', '<pkg>'],
|
|
36
|
+
systemArgv: ['<exe>', '-m', 'pip', 'install', '<pkg>'],
|
|
37
|
+
uninstallArgv: ['<exe>', '-m', 'pip', 'uninstall', '-y', '<pkg>'],
|
|
38
|
+
// Round-6 (B): DISPATCH by the detected interpreter environment. `pip` is the documented
|
|
39
|
+
// fallback; the module picks conda/mamba/uv only when the interpreter's OWN environment says so
|
|
40
|
+
// (detect, don't guess) and the plan states which manager it assumed.
|
|
41
|
+
managers: {
|
|
42
|
+
conda: {
|
|
43
|
+
detect: 'conda-markers',
|
|
44
|
+
userArgv: ['conda', 'install', '-y', '-c', 'conda-forge', '<pkg>'],
|
|
45
|
+
uninstallArgv: ['conda', 'remove', '-y', '<pkg>'],
|
|
46
|
+
systemUnsupportedReason: 'conda 环境是用户级的;系统级安装不在 conda 的概念里(本工具只出用户级计划)',
|
|
47
|
+
},
|
|
48
|
+
mamba: {
|
|
49
|
+
detect: 'conda-markers',
|
|
50
|
+
userArgv: ['mamba', 'install', '-y', '-c', 'conda-forge', '<pkg>'],
|
|
51
|
+
uninstallArgv: ['mamba', 'remove', '-y', '<pkg>'],
|
|
52
|
+
systemUnsupportedReason: 'mamba 环境是用户级的;系统级安装不在 mamba 的概念里(本工具只出用户级计划)',
|
|
53
|
+
},
|
|
54
|
+
uv: {
|
|
55
|
+
detect: 'uv-next-to-interpreter',
|
|
56
|
+
userArgv: ['uv', 'pip', 'install', '<pkg>'],
|
|
57
|
+
uninstallArgv: ['uv', 'pip', 'uninstall', '<pkg>'],
|
|
58
|
+
systemUnsupportedReason: 'uv 装进当前虚拟环境(用户级);系统级需要发行版包管理器,本工具只出用户级计划',
|
|
59
|
+
},
|
|
60
|
+
pip: {
|
|
61
|
+
detect: 'fallback',
|
|
62
|
+
systemArgv: ['<exe>', '-m', 'pip', 'install', '<pkg>'],
|
|
63
|
+
uninstallArgv: ['<exe>', '-m', 'pip', 'uninstall', '-y', '<pkg>'],
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
userInstall: { windows: 'winget install --id Python.Python.3.12', macos: 'brew install python', linux: 'apt install python3' },
|
|
68
|
+
},
|
|
69
|
+
r: {
|
|
70
|
+
name: 'r', phase: 'P1',
|
|
71
|
+
candidates: ['Rscript', 'R'],
|
|
72
|
+
versionArgv: ['--version'], versionRe: '(\\d+\\.\\d+\\.\\d+)',
|
|
73
|
+
scriptArgv: ['<script>'], evalArgv: ['-e', '<expr>'], stdinArgv: ['--no-save', '--slave'], ext: '.R',
|
|
74
|
+
// round-7 (live): line-per-package, no `|` in the argv.
|
|
75
|
+
probeCode: "for (p in strsplit('__PKGS__',',')[[1]]) cat(p, if (requireNamespace(p, quietly=TRUE)) 'ok' else 'missing', '\\n')",
|
|
76
|
+
packageProbe: { argv: ['-e', '<probeCode>'], parse: 'pairs' },
|
|
77
|
+
license: 'free', argErrorHints: ARG_ERROR_HINTS,
|
|
78
|
+
install: {
|
|
79
|
+
manager: 'r',
|
|
80
|
+
userArgv: ['<exe>', '-e', "install.packages('__PKG__',lib=Sys.getenv('R_LIBS_USER'),repos='https://cloud.r-project.org')"],
|
|
81
|
+
uninstallArgv: ['<exe>', '-e', "remove.packages('__PKG__',lib=Sys.getenv('R_LIBS_USER'))"],
|
|
82
|
+
// Round-6 (C): user-only BY DESIGN, and the refusal now says why per engine.
|
|
83
|
+
systemUnsupportedReason: 'R 的用户库是 R_LIBS_USER;系统级安装要写发行版的包目录(需 root 或发行版包管理器),本工具只出用户级计划',
|
|
84
|
+
},
|
|
85
|
+
userInstall: { windows: 'winget install --id RProject.R', macos: 'brew install r', linux: 'apt install r-base' },
|
|
86
|
+
},
|
|
87
|
+
octave: {
|
|
88
|
+
name: 'octave', phase: 'P1',
|
|
89
|
+
candidates: ['octave', 'octave-cli'],
|
|
90
|
+
versionArgv: ['--version'], versionRe: '(\\d+\\.\\d+\\.\\d+)',
|
|
91
|
+
scriptArgv: ['--no-gui', '--quiet', '<script>'], evalArgv: ['--no-gui', '--quiet', '--eval', '<expr>'],
|
|
92
|
+
stdinArgv: ['--no-gui', '--quiet'], ext: '.m',
|
|
93
|
+
// round-7 (live): line-per-package via disp, no `|` and no `%` in the argv.
|
|
94
|
+
probeCode: "s=pkg('list'); n={'__QPKGS__'}; for i=1:numel(n); if any(cellfun(@(x) strcmp(x.name,n{i}),s)); disp([n{i} ' ok']); else; disp([n{i} ' missing']); end; end",
|
|
95
|
+
packageProbe: { argv: ['--no-gui', '--quiet', '--eval', '<probeCode>'], parse: 'pairs' },
|
|
96
|
+
license: 'free', argErrorHints: ARG_ERROR_HINTS,
|
|
97
|
+
install: {
|
|
98
|
+
manager: 'octave-pkg',
|
|
99
|
+
userArgv: ['<exe>', '--no-gui', '--quiet', '--eval', "pkg install -forge __PKG__"],
|
|
100
|
+
uninstallArgv: ['<exe>', '--no-gui', '--quiet', '--eval', 'pkg uninstall __PKG__'],
|
|
101
|
+
systemUnsupportedReason: 'Octave 的 pkg install 装进用户包目录;系统级要写 Octave 的 share/packages(需 root),本工具只出用户级计划',
|
|
102
|
+
},
|
|
103
|
+
userInstall: { windows: 'winget install --id GNU.Octave', macos: 'brew install octave', linux: 'apt install octave' },
|
|
104
|
+
},
|
|
105
|
+
julia: {
|
|
106
|
+
name: 'julia', phase: 'P1',
|
|
107
|
+
candidates: ['julia'],
|
|
108
|
+
versionArgv: ['--version'], versionRe: '(\\d+\\.\\d+\\.\\d+)',
|
|
109
|
+
scriptArgv: ['<script>'], evalArgv: ['-e', '<expr>'], stdinArgv: ['-'], ext: '.jl',
|
|
110
|
+
probeCode: 'for p in [__QPKGS__]; println(p, ":", Base.find_package(p) === nothing ? "missing" : "ok"); end',
|
|
111
|
+
packageProbe: { argv: ['-e', '<probeCode>'], parse: 'pairs' },
|
|
112
|
+
license: 'free', argErrorHints: ARG_ERROR_HINTS,
|
|
113
|
+
install: {
|
|
114
|
+
manager: 'julia-pkg',
|
|
115
|
+
userArgv: ['<exe>', '-e', 'using Pkg; Pkg.add("__PKG__")'],
|
|
116
|
+
uninstallArgv: ['<exe>', '-e', 'using Pkg; Pkg.rm("__PKG__")'],
|
|
117
|
+
systemUnsupportedReason: 'Julia 的 Pkg.add 装进当前活动环境 / 用户 depot(JULIA_DEPOT_PATH);系统级不是 Julia 的概念,本工具只出用户级计划',
|
|
118
|
+
},
|
|
119
|
+
userInstall: { windows: 'winget install --id Julialang.Julia', macos: 'brew install julia', linux: 'apt install julia' },
|
|
120
|
+
},
|
|
121
|
+
matlab: {
|
|
122
|
+
name: 'matlab', phase: 'P1',
|
|
123
|
+
candidates: ['matlab'],
|
|
124
|
+
versionArgv: ['-batch', 'disp(version)'], versionRe: '(\\d+\\.\\d+)',
|
|
125
|
+
scriptArgv: ['-batch', "run('<script>')"], evalArgv: ['-batch', '<expr>'], stdinArgv: null, ext: '.m',
|
|
126
|
+
// round-7 (live): no `|`/`%` in any probe argv (a real host rejected such argv with a null spawn).
|
|
127
|
+
probeCode: "t={'__QPKGS__'}; for i=1:numel(t); if license('test',t{i}); disp([t{i} ' ok']); else; disp([t{i} ' missing']); end; end",
|
|
128
|
+
packageProbe: { argv: ['-batch', '<probeCode>'], parse: 'pairs' },
|
|
129
|
+
license: 'commercial', argErrorHints: ARG_ERROR_HINTS,
|
|
130
|
+
licenseProbe: { argv: ['-batch', "disp(license('test','MATLAB'))"], okWhen: 'trim-1' },
|
|
131
|
+
install: null, vendor: 'https://www.mathworks.com/install',
|
|
132
|
+
userInstall: { windows: 'vendor installer + activation', macos: 'vendor installer + activation', linux: 'vendor installer + activation' },
|
|
133
|
+
},
|
|
134
|
+
maple: {
|
|
135
|
+
name: 'maple', phase: 'P1',
|
|
136
|
+
candidates: ['maple'],
|
|
137
|
+
versionArgv: ['--version'], versionRe: '(\\d+\\.\\d+)',
|
|
138
|
+
scriptArgv: ['-q', '<script>'], evalArgv: ['-q', '-c', '<expr>'], stdinArgv: null, ext: '.mpl',
|
|
139
|
+
// round-7 (live): `print` instead of printf so the argv carries no `|`/`%`.
|
|
140
|
+
probeCode: 'for p in ["__PKGS__"] do try with(p) catch: print(p, " missing"); next end try; print(p, " ok") end do',
|
|
141
|
+
packageProbe: { argv: ['-q', '-c', '<probeCode>'], parse: 'pairs' },
|
|
142
|
+
license: 'commercial', argErrorHints: ARG_ERROR_HINTS,
|
|
143
|
+
licenseProbe: { argv: ['-q', '-c', 'printf("1")'], okWhen: 'exit-0' },
|
|
144
|
+
install: null, vendor: 'https://www.maplesoft.com/support/installers/',
|
|
145
|
+
verify: true, verifyReason: 'CLI spelling varies by Maple version - confirm on a licensed machine',
|
|
146
|
+
userInstall: { windows: 'vendor installer + activation', macos: 'vendor installer + activation', linux: 'vendor installer + activation' },
|
|
147
|
+
},
|
|
148
|
+
wolfram: {
|
|
149
|
+
name: 'wolfram', phase: 'P1',
|
|
150
|
+
candidates: ['wolframscript', 'WolframKernel', 'math'],
|
|
151
|
+
versionArgv: ['-code', '$Version'], versionRe: '(\\d+\\.\\d+(\\.\\d+)?)',
|
|
152
|
+
scriptArgv: ['-file', '<script>'], evalArgv: ['-code', '<expr>'], stdinArgv: null, ext: '.wl',
|
|
153
|
+
probeCode: 'Do[Print[p,":",If[Quiet[Check[Needs[p];True,False]],"ok","missing"]],{p,{__QPKGS__}}]',
|
|
154
|
+
packageProbe: { argv: ['-code', '<probeCode>'], parse: 'pairs' },
|
|
155
|
+
license: 'commercial', argErrorHints: ARG_ERROR_HINTS,
|
|
156
|
+
licenseProbe: { argv: ['-code', 'Print[$LicenseType]'], okWhen: 'not-unlicensed' },
|
|
157
|
+
install: null, vendor: 'https://www.wolfram.com/engine/',
|
|
158
|
+
userInstall: { windows: 'vendor installer + activation', macos: 'vendor installer + activation', linux: 'vendor installer + activation' },
|
|
159
|
+
},
|
|
160
|
+
cli: {
|
|
161
|
+
name: 'cli', phase: 'P1', defaultOn: true,
|
|
162
|
+
candidates: [], resolveFrom: 'cli.command',
|
|
163
|
+
versionArgv: ['--version'], versionRe: '([^\\s]+)', versionOptional: true,
|
|
164
|
+
scriptArgv: ['<cliArgv...>'], evalArgv: null, stdinArgv: null, ext: '.txt',
|
|
165
|
+
probeCode: null, packageProbe: null,
|
|
166
|
+
license: 'user', argErrorHints: ARG_ERROR_HINTS,
|
|
167
|
+
install: null, vendor: null,
|
|
168
|
+
policy: { requiresMathMode: 'typed+shell', requiresEngineInList: true },
|
|
169
|
+
userInstall: { windows: 'user-provided', macos: 'user-provided', linux: 'user-provided' },
|
|
170
|
+
},
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// P2 (not registered in P1 - kept here so the descriptor table stays one file).
|
|
174
|
+
export const MATH_P2_ENGINES = {
|
|
175
|
+
sage: {
|
|
176
|
+
name: 'sage', phase: 'P2', candidates: ['sage'],
|
|
177
|
+
versionArgv: ['--version'], versionRe: '(\\d+\\.\\d+)',
|
|
178
|
+
scriptArgv: ['<script>'], evalArgv: ['-c', '<expr>'], stdinArgv: ['-'], ext: '.sage',
|
|
179
|
+
probeCode: null, packageProbe: { argv: ['-pip', 'list'], parse: 'lines' },
|
|
180
|
+
license: 'free', argErrorHints: ARG_ERROR_HINTS, install: null,
|
|
181
|
+
},
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export function mathEngineCandidates(name) {
|
|
185
|
+
const d = MATH_ENGINES[name]
|
|
186
|
+
if (!d || name === 'cli') return null
|
|
187
|
+
return d.candidates.slice()
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export function mathEngineArgErrorHints(name) {
|
|
191
|
+
const d = MATH_ENGINES[name]
|
|
192
|
+
return d && Array.isArray(d.argErrorHints) ? d.argErrorHints.slice() : ARG_ERROR_HINTS.slice()
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export function isKnownMathEngine(name) {
|
|
196
|
+
return typeof name === 'string' && (Object.prototype.hasOwnProperty.call(MATH_ENGINES, name) || Object.prototype.hasOwnProperty.call(MATH_P2_ENGINES, name))
|
|
197
|
+
}
|