dsh-vibe-math 2.6.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.
- package/README.en.md +156 -389
- package/README.md +156 -390
- package/cordis.patch.yml +56 -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 +121 -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/test-timing.md +24 -12
- package/installer.js +7 -4
- package/package.json +18 -2
- package/prompt-corpus-persona/persona-corpus.json +12 -12
- package/prompt-corpus-persona/persona-corpus.md +116 -32
- package/prompt-corpus-v2/formal-verify-v2.json +116 -92
- package/prompt-corpus-v2/formal-verify-v2.md +1430 -55
- package/prompt-corpus-v3/formal-verify-v3.json +101 -53
- package/prompt-corpus-v3/formal-verify-v3.md +1001 -22
- package/prompt-corpus-v4/formal-verify-v4.json +14 -14
- package/prompt-corpus-v4/formal-verify-v4.md +247 -14
- package/prompt-corpus-v5/prompt-corpus-v5.json +62 -62
- package/prompt-corpus-v5/prompt-corpus-v5.md +570 -3
- package/tests/audit-math-computation-contract.mjs +191 -0
- package/tests/audit-math-computation-parity.mjs +169 -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 +452 -2
- package/tests/formal-verify-v2.test.mjs +292 -6
- package/tests/formal-verify-v3.test.mjs +271 -4
- 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 +135 -0
- package/tests/math-computation-shared.test.mjs +504 -0
- package/tests/prompt-v5-integrity.test.mjs +5 -5
- package/vibe-math-v2/agent.cordis.yml +20 -8
- package/vibe-math-v2/math-computation.js +936 -0
- package/vibe-math-v2/math-engines.js +156 -0
- package/vibe-math-v2/vibe-math-v2.js +837 -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 +20 -8
- package/vibe-math-v3/math-computation.js +936 -0
- package/vibe-math-v3/math-engines.js +156 -0
- package/vibe-math-v3/vibe-math-v3.js +828 -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 +34 -6
- package/vibe-math-v4/math-computation.js +936 -0
- package/vibe-math-v4/math-engines.js +156 -0
- package/vibe-math-v4/vibe-math-v4.js +801 -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 +38 -6
- package/vibe-math-v5/math-computation.js +936 -0
- package/vibe-math-v5/math-engines.js +156 -0
- package/vibe-math-v5/vibe-math-v5.js +1120 -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,121 @@
|
|
|
1
|
+
# 数学计算工具(`math_computation`)—— 契约与用法
|
|
2
|
+
|
|
3
|
+
> 四个预设(v2/v3/v4/v5)共用同一个工具。规格与冻结件在开发检出里:`_oneoff/math-computation-spec-v3.md`(rev-3)、`_oneoff/mc-P1-ready/INTERFACE-FREEZE.md`、`mc-P1-ready/{engines.md,tool-schema.json,receipt.md,prompts.md,guards.md}`。
|
|
4
|
+
> 本文件只讲**已实现的行为**与**明确不能保证的东西**,不含性能或效果承诺。
|
|
5
|
+
|
|
6
|
+
## 1. 它是什么
|
|
7
|
+
|
|
8
|
+
`math_computation` 让成员先在**运行时探测**本机可用的计算引擎与包,再以统一接口执行计算,并把每次执行落成**可复核回执**:脚本原件、完整输出、实际 argv、解释器/引擎版本、退出码与耗时。它比"随手用宿主 shell 跑一条命令"多出来的只有三件事——**探测**、**统一接口**、**归档**。
|
|
9
|
+
|
|
10
|
+
**P1 引擎集合**:`python`、`r`、`octave`、`julia`(自由软件,全功能)+ `matlab`、`maple`、`wolfram`(商业:只探测与许可检查,**永不安装**,有证即可用)+ `cli`(通用逃生口,**默认开启**)。SageMath 属 P2,P1 不注册。
|
|
11
|
+
|
|
12
|
+
## 2. 参数(六个,名字已冻结)
|
|
13
|
+
|
|
14
|
+
| 参数 | 取值 | 默认 | 说明 |
|
|
15
|
+
|---|---|---|---|
|
|
16
|
+
| `mathComputation` | `off` \| `auto` \| `on` | `auto` | `off` 是**真 no-op**:不探测、不执行、不在提示词里出现;`auto` 探测到引擎才工作 |
|
|
17
|
+
| `mathMode` | `typed` \| `typed+shell` | `typed+shell` | **只是提示词策略**(见 §6):允许在工具不可用时用宿主 shell 兜底,但结论必须标注"未经工具归档";`typed` 不提 shell,并禁用 `engine:'cli'` |
|
|
18
|
+
| `mathEngines` | 引擎名数组 | `[python, r, octave, julia, matlab, maple, wolfram, cli]` | 允许的引擎**及其探测顺序**;去掉 `cli` 即关闭逃生口 |
|
|
19
|
+
| `mathTimeoutMs` | 正整数(≥1000) | `60000` | 单次执行上限;超时后**主动终止**进程 |
|
|
20
|
+
| `mathPackages` | 字符串数组 | `[]` | 默认要求存在的包/工具箱(缺包只报告,不安装) |
|
|
21
|
+
| `mathInstallScope` | `user` \| `system` | `user` | **作用域只对当次调用生效,永不记忆**;多数包管理器没有 system 模板,此时 system 请求会被拒绝 |
|
|
22
|
+
|
|
23
|
+
非法值一律回落默认(枚举非白名单 → 默认;`mathTimeoutMs` 非正 → 默认并抬到 ≥1000;`mathEngines` 过滤未知项、去重、空则回落默认)。
|
|
24
|
+
|
|
25
|
+
## 3. 工具接口
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
math_computation {
|
|
29
|
+
op: 'probe' | 'run' | 'receipt' | 'install',
|
|
30
|
+
engine?, mode?: 'code'|'file'|'expr', code?|file?|expr?,
|
|
31
|
+
packages?, timeoutMs?, captureFiles?, record?,
|
|
32
|
+
cli?: { command, argv?, stdin? }, // engine='cli' 必填
|
|
33
|
+
scope?: 'user'|'system', dryRun?, confirm? // op='install'
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
- **`probe`**:只探测引擎/版本/许可与(可选的)包,**不执行用户代码**。没有可用引擎时返回 `MATH_ENGINE_NOT_FOUND` + 逐 OS 的用户安装指引。
|
|
38
|
+
- **`run`**:`mode:'code'` 由工具把源码落成 `script.<ext>` 再执行;`mode:'file'` 只接受**项目内**路径(复制进回执目录后执行);`mode:'expr'` 走该引擎的 eval 模板(表达式只占**一个** argv 元素)。`engine:'cli'` 时 argv = `cli.command` + `cli.argv`,`mode:'expr'` 被拒绝。
|
|
39
|
+
- **`receipt`**:对既有 `Computation/<id>/` **幂等**重渲染 `receipt.md`、补写缺失产物,**不重跑**。
|
|
40
|
+
- **`install`**:两步。先 `dryRun`(默认)返回计划与 `planToken`;执行必须把该 token 原样回传 `confirm`,token 不符即拒绝。**商业引擎一律拒绝**。
|
|
41
|
+
|
|
42
|
+
失败码(11 个,全部 `MATH_` 前缀):`MATH_NOT_AVAILABLE`、`MATH_ENGINE_NOT_FOUND`、`MATH_ENGINE_LICENSE_REQUIRED`、`MATH_ENGINE_UNUSABLE`、`MATH_MISSING_PACKAGES`、`MATH_TIMEOUT`、`MATH_NONZERO_EXIT`、`MATH_ENGINE_BAD_ARGV`、`MATH_REFUSED`、`MATH_INVALID_ARGUMENT`、`MATH_NO_SUBPROCESS`。每个"环境缺失"类失败都带 `next`(自装指引 / 代装计划 / 厂商链接 / 启用建议)。
|
|
43
|
+
|
|
44
|
+
**"没有 subprocess 服务"与"没有引擎"是两件事**(避免误导用户去装 python):
|
|
45
|
+
- 宿主若能声明自己没有 subprocess 服务(预设可选提供 `hasSubprocess:()=>false`),`run` 与 `probe` 一律返回 `MATH_NO_SUBPROCESS` + `next.kind:'note'`;
|
|
46
|
+
- 宿主不提供该声明时:命令**解析不到** ⇒ `MATH_ENGINE_NOT_FOUND`(附逐 OS 安装指引);能解析但 `spawn` 拿不到句柄(返回 `null`)⇒ `MATH_NO_SUBPROCESS`。
|
|
47
|
+
- **机读词汇表(穷举;权威副本在 `_oneoff/mc-P1-ready/tool-schema.json#refusalVocabulary`,由 parity 守卫盯着,改名即红)**:
|
|
48
|
+
- `code`(11 个):`MATH_NOT_AVAILABLE` `MATH_ENGINE_NOT_FOUND` `MATH_ENGINE_LICENSE_REQUIRED` `MATH_ENGINE_UNUSABLE` `MATH_MISSING_PACKAGES` `MATH_TIMEOUT` `MATH_NONZERO_EXIT` `MATH_ENGINE_BAD_ARGV` `MATH_REFUSED` `MATH_INVALID_ARGUMENT` `MATH_NO_SUBPROCESS`;
|
|
49
|
+
- `next.kind`(7 个):`user-install`(用户自装指引)、`agent-install`(代装计划/计划就绪)、`vendor`(商业引擎厂商指引)、`enable`(`mathComputation:'off'` 的启用建议)、`engine-override`(bad-argv ⇒ 用 `mathEngineOverride` 覆盖模板)、`reason`(机读拒绝原因)、`note`(补充说明,如无 subprocess);
|
|
50
|
+
- `next.reason`(12 个,仅当 `next.kind==='reason'`):`policy`、`engine-not-allowed`、`missing-cli-command`、`expr-not-supported`、`mode-not-supported`、`path-outside-project`、`file-not-found`、`system-scope-unsupported`、`plan-token-mismatch`、`archive-missing`、`receipt-unparsable`、`no-subprocess`。
|
|
51
|
+
调用方**不必解析文案**:按 `code` + `next.kind`(必要时 `next.reason`)分支即可;新增或改名必须同时更新这里与 `tool-schema.json`,否则守卫变红。
|
|
52
|
+
|
|
53
|
+
## 4. 回执:可复核的支撑材料
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
<项目或研究所根>/Computation/<runId>/
|
|
57
|
+
script.<ext> # 唯一权威源码(先落盘再执行)
|
|
58
|
+
stdout.txt / stderr.txt # 完整输出(返回体只给 ≤64KB 截断版)
|
|
59
|
+
receipt.json / receipt.md # 机器可读 + 人读
|
|
60
|
+
captured/… # captureFiles 的项目内副本
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
- `runId = <preset>-<projectSlug>-<sha256(engine|mode|规范化的脚本|排序后的包需求)[0:12]>`——**不含墙钟**:同引擎、同脚本、同包要求在同一项目下命中同一目录。
|
|
64
|
+
- `receipt.json` 记录:引擎与版本、脚本路径与哈希、**实际 argv**、cwd、退出码/超时/耗时、截断标记、产物哈希、`network:"not-enforced-by-plugin"`。
|
|
65
|
+
- **复跑**:`math_computation { op:'run', engine:'<e>', mode:'file', file:'Computation/<id>/script.<ext>' }`,或直接照 `receipt.json` 的 `argv` + `cwd` 重放。
|
|
66
|
+
- 报告里"我算过"要给 `Computation/<id>/receipt.json`;**回执是经验证据,不是证明**——对象是否已验证仍由各预设既有的验证/共识路径决定。
|
|
67
|
+
|
|
68
|
+
### 4.1 归档 → 编辑 → 重跑(可发现性与完整性)
|
|
69
|
+
|
|
70
|
+
回执与返回体都带 **`scriptPath`**(归档脚本周相对路径)与 **`scriptHash`**(脚本字节的 sha256),所以"这次跑的到底是哪份代码"是可查的:
|
|
71
|
+
|
|
72
|
+
1. `mode:'code'` 把源码落成 `Computation/<id>/script.<ext>`;agent **可以用普通文件工具打开并编辑它**。
|
|
73
|
+
2. 编辑后用 `mode:'file'` 指向该脚本重跑,会写出**一份新回执**(新 attempt、新 `scriptHash`)。
|
|
74
|
+
3. **旧回执对修改后的代码无效**。`mode:'file'` 的回执按**路径**归属同一个 archive id(不是按内容),所以"同一文件编辑后重跑"落在同一 id 的**新 attempt**,并显式给出:
|
|
75
|
+
- `scriptChanged:true`:该文件当前哈希与**上一份回执**记录的 `scriptHash` 不一致(旧回执不再代表当前代码);
|
|
76
|
+
- `scriptChangedDuringRun:true`:文件在**本次运行期间**被改动(典型是另一个成员同时在编辑)——运行前后各取一次哈希才可能发现;
|
|
77
|
+
- 两者都同时进入 `warnings[]`(`SCRIPT_CHANGED_SINCE_LAST_RECEIPT` / `SCRIPT_CHANGED_DURING_RUN`)与 `receipt.md`,**绝不静默**。
|
|
78
|
+
4. `op:'receipt'` 会重新核对归档脚本的当前哈希与回执记录,返回 `scriptChanged` / `currentScriptHash`;它**只读**返回既有数据,仅补写**缺失**的 `receipt.md`,从不改写已有回执文件。**归档目录不存在**时返回 `MATH_REFUSED` + `next:{kind:'reason', reason:'archive-missing'}`(显式拒绝,不是"参数错误");`receipt.json` 存在但**无法解析**时仍是 `MATH_INVALID_ARGUMENT`(`reason:'receipt-unparsable'`,那确实是坏掉的产物)。
|
|
79
|
+
- **哈希的能力边界(按设计,不是缺陷)**:`scriptHash`/`scriptChanged` 是**内容**哈希——"内容相同但换了 inode/mtime(删了重建、复制覆盖)"与"改了又改回原样"**无法区分**,因此也不会被告警;需要区分"文件被动过"请用宿主的版本守卫(`ctx.fs` 的 `expected.version`)。**每会话模块实例的生命周期**跟随该会话对象(v4 原有生命周期,非本轮引入)。
|
|
80
|
+
- **手改状态文件里的未知键不会被静默丢弃(round-4)**:v5 从研究所状态文件恢复参数时,白名单之外的键会被忽略,但**会记入 `vibe_v5_status` 的 `diagnostics`**(`{kind:'state-dropped-keys', where, keys}`)并打印警告;同一归一化器也服务 `vibe_v5_set` / `vibe_v5_configure`,所以未知键在任何入口都不会无声消失。
|
|
81
|
+
5. **归档是追加式的**:同一 id 的**首次**运行落在 `Computation/<id>/`,之后每次运行落在 `Computation/<id>/attempts/<n>/`(n 从 2 开始,取第一个空位);已有文件**永不覆盖**。**并发**下同一 id 的两个运行由模块按 id 串行分配,因此一定分别拿到 attempt 1 / attempt 2,不会共用目录(跨进程并发见 §6 的限制说明)。
|
|
82
|
+
6. **失败关闭(fail-closed)**:源文件在运行**期间消失** ⇒ `scriptChangedDuringRun:true`;`op:'receipt'` 读不到归档脚本(被删/移走)⇒ `scriptChanged:true` + `currentScriptHash:null`。任何"读不到/对不上"都按"旧回执不可用"处理,绝不静默当真。
|
|
83
|
+
7. **保留上限**:每个 id 最多 `MATH_ARCHIVE_MAX_ATTEMPTS_PER_RUN`=20 个 attempt、每个项目最多 `MATH_ARCHIVE_MAX_RUNS`=200 个 run 目录(后者仅在宿主提供可选 `listDir` 时检查)。**超过只告警**(`ARCHIVE_RETENTION_EXCEEDED`),**永不自动删除**。
|
|
84
|
+
|
|
85
|
+
**验证者(或复核代理)要查的六件事**:① 打开 `receipt.json` 确认 `scriptPath`;② 重新计算该脚本 sha256,与 `scriptHash` **逐字相等**;③ 确认 `scriptChanged` 与 `scriptChangedDuringRun` 均为 `false`(否则该回执不足以支撑结论);④ 确认 `sourceFile`(若有)正是被验证的源码,且 `attempt`/`attemptDir` 是当前代码对应的最新 attempt;⑤ 按 `argv` + `cwd` 重放,结果一致;⑥ 一旦改代码,**必须重跑并引用新回执**,报告里的旧回执撤下。
|
|
86
|
+
|
|
87
|
+
## 5. 安装:两条路径
|
|
88
|
+
|
|
89
|
+
1. **用户自己装**:工具在缺引擎时返回逐 OS 命令(Windows/macOS/Linux)与官方链接;商业引擎只给厂商安装包与激活说明。
|
|
90
|
+
2. **代理代装**:`plan → confirm`(token 绑定该计划,内容变了就失效);默认 **user 作用域**(`pip --user`、用户 depot、`R_LIBS_USER`、Octave 用户包目录…);**system 作用域必须每次显式指定且不被记住**;每次执行写审计 `Computation/installs/<planToken>.json`(计划、作用域、管理器、命令、退出码、before/after、卸载命令模板)。
|
|
91
|
+
|
|
92
|
+
**诚实的回滚说明**:包安装**没有通用回滚**。工具保证的是——记下确切命令与 before/after 版本(卸载**可验证**)、默认 user 作用域限制影响面、提供各管理器的卸载模板;**不做**自动回滚。
|
|
93
|
+
|
|
94
|
+
## 6. 插件**能**与**不能**强制的东西
|
|
95
|
+
|
|
96
|
+
**能强制**:入参 schema(闭合;未知键拒绝)、**词法级**项目内路径守卫(见下)、cwd、超时并终止进程、输出上限、回执落盘、插件自身的写域(只写 `Computation/`)、安装两步与作用域默认、同一 archive id 的**串行分配**(并发运行不会共用 attempt 目录)。
|
|
97
|
+
|
|
98
|
+
**不能强制**(如实声明,勿当成承诺):
|
|
99
|
+
- **路径守卫是字符串级的**:`projectRel` 只做词法规范化(拒绝绝对路径、盘符、`..` 越界),**不做 realpath、不解析符号链接/junction/硬链接**。项目内一个指向外部的链接可以绕过该守卫拿到 `mode:'file'` 的读取与执行;真正的容器化由宿主 `ctx.fs` 后端负责(`resolve`/`contains`),插件不重复实现。审计 A 的用例把这一**限制**钉成了断言(`tests/math-computation-shared.test.mjs` §16c)。
|
|
100
|
+
- 脚本内部的网络访问与文件访问——宿主 `subprocess.spawn` **没有 policy 槽**(`env` 层只做凭据/`DSH_*` 清洗与显式合并,不能限制网络或写盘;参见 `dsh-subprocess-local` 的 `runner-launch-*.js` 与 `vibe-math-v5.js` 中 audit M8 注释),任何被执行的计算进程都在宿主 fs 策略之外;
|
|
101
|
+
- `mathMode` 只是提示词策略:**模型仍可能直接调用宿主 shell**,插件无法阻止,也无法为 shell 路径生成回执。因此默认策略要求:走 shell 得出的结论必须标注"**未经工具归档(shell 路径)**",**只有工具路径的计算才算可复核支撑材料**;
|
|
102
|
+
- 商业引擎的 CLI 模板随版本变化(Maple 尤甚):描述符带 `VERIFY` 标记,**每次运行都回显实际 argv**;若引擎以用法/选项错退出,返回 `MATH_ENGINE_BAD_ARGV` + `next.kind='engine-override'`(指向 `mathEngineOverride` 覆盖模板),而不是裸 `MATH_NONZERO_EXIT`。有许可的机器应验证这三个模板。
|
|
103
|
+
- 真强制(禁网/限权)需要宿主 sandbox/policy 支持——**列为待上游需求**,不在本轮范围。
|
|
104
|
+
|
|
105
|
+
**验证边界(诚实声明)**:引擎执行本身、各引擎的真实 argv/版本/许可路径与安装器命令**只通过假 subprocess seam 验证**(`tests/helpers/math-computation-fake-seam.mjs`),**没有**在真实 python/R/octave/julia/matlab/maple/wolfram 上跑过;真机验证需要一台装有这些引擎的机器(安装计划、模板与许可探测的**静态**面已在 `guards.md` 与 parity 守卫里冻结)。
|
|
106
|
+
|
|
107
|
+
**并发下的完整性**:同一 archive id 的分配与"占用"(receipt.json 落盘)在**一个插件实例内**是串行的,因此两个并发同 id 运行会分别拿到 attempt 1 / attempt 2,绝不会共用目录。**跨进程**并发仍依赖宿主的独占创建原语(当前 fs 接口没有暴露,列为已知限制)。
|
|
108
|
+
|
|
109
|
+
**父目录由宿主创建(round-3 记录,勿再当缺陷)**:宿主的文本写会**自动创建缺失的父目录**——`dsh-fs-local/lib/index.js` 的 `writeFileAtomic` 在落盘前执行 `mkdir(dirname(absolutePath), { recursive: true })`。因此 `Computation/<runId>/`、`Computation/<runId>/attempts/<n>/` 以及异步作业镜像 `Formal/Jobs/` **不需要预先存在**;`ensureDirs()` 仍然列出它们只是为了空项目里的可发现性(v2/v3/v4/v5 现已都含 `Formal/Jobs` 与 `Computation`)。真机上"严格 fs 拒绝创建父目录"的实验与真实宿主行为矛盾,不能作为失败证据。
|
|
110
|
+
|
|
111
|
+
## 7. `cli` 逃生口为什么默认开启
|
|
112
|
+
|
|
113
|
+
模型本来就有宿主 shell 可用(默认 `mathMode='typed+shell'` 就允许把它当兜底),所以 `cli` **不扩大爆炸半径**;区别在于 `cli` 仍在工具内:照样有 cwd、超时、输出上限、路径守卫与回执(`engine` 记为 `cli:<command>`)。要收紧:把 `mathMode` 设为 `typed`,或从 `mathEngines` 去掉 `'cli'`——两种情况下 `engine:'cli'` 都返回 `MATH_REFUSED`。
|
|
114
|
+
|
|
115
|
+
## 8. 与形式化验证(Lean)的关系
|
|
116
|
+
|
|
117
|
+
`math_computation` 产出**经验证据**(回执可复核);形式化证明仍是**可选**的 Lean 路径(`formalVerify: off|encourage|require`,默认 `off`)。计算回执**不能**顶替 Lean 的 `passed`/`blocked`,也不能把对象标为"已验证"。
|
|
118
|
+
|
|
119
|
+
## 9. 参数配置在哪改
|
|
120
|
+
|
|
121
|
+
`vibe_math_set_params`(v2/v3)、`vibe_v4_set`(v4)、`vibe_v5_set`(v5)以及各自的控制面:v2/v3 是 `vibe_math_setup`(交互式 schema)/`vibe_math_status`/`vibe_math_template`/`vibe_math_save_settings`,v4 是 `vibe_v4_configure`/`vibe_v4_status`(**没有** `template`/`setup`),v5 是 `vibe_v5_configure`/`vibe_v5_status`(同样没有 `template`/`setup`);六个参数名在四套、README 双语参数表与本文中拼写一致(由 `tests/audit-math-computation-parity.mjs` 与 `audit-math-computation-contract.mjs` 盯着)。
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# dsh-vibe-math 2.7.0 — Release Notes (English)
|
|
2
|
+
|
|
3
|
+
> Previous release: 2.6.0. This release adds two capabilities: **incremental Lean formalisation
|
|
4
|
+
> (async compilation + `import` reuse)** and the **`math_computation` tool** (one shared
|
|
5
|
+
> implementation for all four presets). Existing parameter defaults, data formats and directory
|
|
6
|
+
> structure are **unchanged** (the release only adds parameters and directories), the DSH support
|
|
7
|
+
> window is unchanged, and no migration is needed.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
- **Incremental Lean formalisation**: `leanAsync` (default `true`) compiles on a per-session
|
|
14
|
+
background queue and returns as soon as the job is queued; new `leanJobsMaxParallel`
|
|
15
|
+
(default `1`), `leanInitiative` (`off|normal|eager`, default `normal`) and `leanSearchPaths`
|
|
16
|
+
(default `[]`). New read-only tools `lean_read` / `lean_job`; jobs are mirrored to
|
|
17
|
+
`Formal/Jobs/<jobId>.json`.
|
|
18
|
+
- **`math_computation` (new tool)**: `op:'probe'` pre-checks engines/packages/licences, `op:'run'`
|
|
19
|
+
computes, and every run is archived as a reviewable receipt; `op:'install'` is a two-step
|
|
20
|
+
plan-then-confirm flow and `op:'receipt'` re-checks a receipt read-only.
|
|
21
|
+
- **Engines**: `python` / `r` / `octave` / `julia` / `matlab` / `maple` / `wolfram` / `cli`.
|
|
22
|
+
The three commercial ones are **detected and licence-checked only and are never installed**;
|
|
23
|
+
`cli` is on by default (two documented ways to disable it).
|
|
24
|
+
- **Archive → edit → re-run**: receipts carry `scriptPath`/`scriptHash`; after editing a script you
|
|
25
|
+
must re-run it with `mode:'file'`, because an old receipt is not evidence for edited code
|
|
26
|
+
(`scriptChanged` / `scriptChangedDuringRun` warn explicitly).
|
|
27
|
+
- **Six new parameters**: `mathComputation` / `mathMode` / `mathEngines` / `mathTimeoutMs` /
|
|
28
|
+
`mathPackages` / `mathInstallScope` (the bilingual README table and `docs/math-computation.md`
|
|
29
|
+
are authoritative).
|
|
30
|
+
- This release went through **four independent audit rounds** plus a **real-host packaging/boot
|
|
31
|
+
certification on the frozen commit**; the gate is `TOTAL 65 PASS 65 FAIL 0`
|
|
32
|
+
(44 suites + 21 probes).
|
|
33
|
+
|
|
34
|
+
## Changes
|
|
35
|
+
|
|
36
|
+
### 1. Incremental Lean formalisation + async compilation + `import` reuse
|
|
37
|
+
|
|
38
|
+
- **New parameters** (identical in all four presets; every default preserves existing behaviour):
|
|
39
|
+
- `leanAsync`: default `true`. `true` = compile on a **per-session background queue** and return
|
|
40
|
+
as soon as it is queued; `false` = synchronous `await` (the old semantics).
|
|
41
|
+
- `leanJobsMaxParallel`: default `1` (serial). Concurrency cap for background compilations.
|
|
42
|
+
- `leanInitiative`: `off | normal | eager`, default `normal`. **How eager the staff are about
|
|
43
|
+
formalising during normal work.**
|
|
44
|
+
- `leanSearchPaths`: default `[]`. Extra `--search-path` roots; when non-empty they are injected
|
|
45
|
+
**first** and the automatic root is injected **after** them.
|
|
46
|
+
- **Queue state machine**: jobs move through explicit states, and **only `settled(ok)` counts as
|
|
47
|
+
passed** - "queued" or "compiling" never counts as proved.
|
|
48
|
+
- **`import` reuse**: the compile command automatically injects `--search-path <VibeMath root>`, so
|
|
49
|
+
`import Formal.Lib.<name>` / `Formal.Proved.<name>` work directly (cross-project reuse of archived
|
|
50
|
+
definitions and lemmas).
|
|
51
|
+
- **New read-only tools**: `lean_read` (read archive/library content) and `lean_job` (job status).
|
|
52
|
+
Both are **read-only** and never trigger a compilation.
|
|
53
|
+
- **Job mirror**: every job keeps a mirror at `Formal/Jobs/<jobId>.json`, so a restart can re-queue
|
|
54
|
+
or explicitly interrupt it.
|
|
55
|
+
- **Honest note**: `leanInitiative` and `formalVerify` are **two independent axes**.
|
|
56
|
+
`formalVerify:'off'` disables the **verification stage**; it does not swallow the initiative axis:
|
|
57
|
+
`off + normal` ⇒ no Lean text at all; `off + eager` ⇒ **only** the daily line (the proactivity
|
|
58
|
+
prompt) appears, while the verification stage stays off.
|
|
59
|
+
|
|
60
|
+
### 2. The new `math_computation` tool
|
|
61
|
+
|
|
62
|
+
- **Six frozen parameters** (the names cannot change; identical spelling across the four presets,
|
|
63
|
+
the bilingual README table and the contract doc):
|
|
64
|
+
| Parameter | Default | Meaning |
|
|
65
|
+
|---|---|---|
|
|
66
|
+
| `mathComputation` | `auto` | `off` (a true no-op) / `auto` (works once an engine is detected) / `on` |
|
|
67
|
+
| `mathMode` | `typed+shell` | **Prompt policy**: `typed` never mentions the shell and disables `engine:'cli'` |
|
|
68
|
+
| `mathEngines` | `[python,r,octave,julia,matlab,maple,wolfram,cli]` | Allowed set and probe order; removing `cli` closes the escape hatch |
|
|
69
|
+
| `mathTimeoutMs` | `60000` | Per-run budget (minimum 1000); on timeout the process is **actively terminated** |
|
|
70
|
+
| `mathPackages` | `[]` | Packages required by default; a missing one is reported with a plan, **never auto-installed** |
|
|
71
|
+
| `mathInstallScope` | `user` | Install scope; `system` must be passed explicitly every time and is **never remembered** |
|
|
72
|
+
- **`op`**: `probe` (engines/versions/packages/licences), `run` (`mode: code|file|expr`),
|
|
73
|
+
`receipt` (read-only re-check), `install` (two-step).
|
|
74
|
+
- **Failure codes (11, frozen)**: `MATH_NOT_AVAILABLE`, `MATH_ENGINE_NOT_FOUND`,
|
|
75
|
+
`MATH_ENGINE_LICENSE_REQUIRED`, `MATH_ENGINE_UNUSABLE`, `MATH_MISSING_PACKAGES`, `MATH_TIMEOUT`,
|
|
76
|
+
`MATH_NONZERO_EXIT`, `MATH_ENGINE_BAD_ARGV`, `MATH_REFUSED`, `MATH_INVALID_ARGUMENT`,
|
|
77
|
+
`MATH_NO_SUBPROCESS`; each carries a machine-readable `next` (`user-install` / `agent-install` /
|
|
78
|
+
`vendor` / `enable` / `engine-override` / `reason` / `note`).
|
|
79
|
+
- **Deterministic receipts**: `runId` is derived only from preset + project + engine + mode + key +
|
|
80
|
+
sorted packages and contains **no wall clock**; `argv` is echoed **both** in the receipt and in the
|
|
81
|
+
return value (copy it to re-run); full `stdout`/`stderr` land on disk while the return value is
|
|
82
|
+
capped at 64 KB.
|
|
83
|
+
- **Engines**: `python`/`r`/`octave`/`julia` are free; `matlab`/`maple`/`wolfram` are **commercial** -
|
|
84
|
+
detected and licence-checked only, **never installed** (vendor guidance only); `cli` runs the
|
|
85
|
+
command you name, still under the tool's timeout, output caps, cwd and receipt.
|
|
86
|
+
- **Two installation routes**: ① user self-install (per-OS commands + official links); ② agent
|
|
87
|
+
install via `plan → planToken → confirm` (the token binds the plan content, so a changed plan
|
|
88
|
+
invalidates it). Scope defaults to **user**; `system` must be confirmed **every time**; each
|
|
89
|
+
execution writes an audit file `Computation/installs/<planToken>.json` (exact commands, exit codes,
|
|
90
|
+
before/after versions and **uninstall templates**). Package installation has **no universal
|
|
91
|
+
rollback** - the tool guarantees verifiable commands/versions plus uninstall templates, not
|
|
92
|
+
automatic rollback.
|
|
93
|
+
- **`cli` is on by default** (it is no broader than the host shell the model already has, but it adds
|
|
94
|
+
receipts and limits); two documented ways to disable it: `mathMode:'typed'`, or removing `'cli'`
|
|
95
|
+
from `mathEngines` - both return `MATH_REFUSED`.
|
|
96
|
+
- **Archive → edit → re-run (integrity rules)**:
|
|
97
|
+
- the return value and the receipt both carry `scriptPath`/`scriptHash`; the script original can be
|
|
98
|
+
opened and edited;
|
|
99
|
+
- re-run it with `mode:'file'` after editing ⇒ a **new receipt** (new attempt, new hash); **an old
|
|
100
|
+
receipt is not evidence for edited code**;
|
|
101
|
+
- `scriptChanged` (the current file differs from the previous receipt) and
|
|
102
|
+
`scriptChangedDuringRun` (the file changed while the run was in flight) **warn explicitly** and
|
|
103
|
+
are recorded in the receipt;
|
|
104
|
+
- archives are **append-only** (`Computation/<id>/`, attempt n≥2 under `attempts/<n>/`) and
|
|
105
|
+
existing files are **never overwritten**;
|
|
106
|
+
- the retention caps (20 attempts / 200 runs) **warn only and never delete**; unknown parameter
|
|
107
|
+
keys in a hand-edited state file are **reported** (`diagnostics`) instead of being dropped
|
|
108
|
+
silently.
|
|
109
|
+
|
|
110
|
+
### 3. Honest boundaries (please read)
|
|
111
|
+
|
|
112
|
+
- **Engine execution is verified only through a fake subprocess seam**: no real python/R/octave/julia/
|
|
113
|
+
matlab/maple/wolfram was run on this machine; real-engine verification needs a machine with those
|
|
114
|
+
engines installed (the **static** surface - templates, licence probes, install plans - is pinned by
|
|
115
|
+
guards).
|
|
116
|
+
- **The plugin cannot enforce network or write restrictions**: the host's `subprocess.spawn` has
|
|
117
|
+
**no policy slot** (its `env` layer only scrubs credentials/`DSH_*` names and cannot restrict
|
|
118
|
+
network or disk access); real enforcement needs host sandbox support and is **recorded as a pending
|
|
119
|
+
upstream requirement**.
|
|
120
|
+
- **Commercial templates are marked `VERIFY`**: the CLI templates for Maple (especially), MATLAB and
|
|
121
|
+
Wolfram change between versions, so their descriptors carry a `VERIFY` flag; every run echoes the
|
|
122
|
+
real argv, and a usage/option error returns `MATH_ENGINE_BAD_ARGV` with a `mathEngineOverride`
|
|
123
|
+
hint instead of a bare `MATH_NONZERO_EXIT`. Machines with licences should verify those three
|
|
124
|
+
templates themselves.
|
|
125
|
+
- **SageMath is P2**: this release only has the descriptor placeholder; it is not wired in.
|
|
126
|
+
- **The two comparison experiments are given as run-books** (sync vs async compilation; without vs
|
|
127
|
+
with `import` reuse): these notes contain **no fabricated numbers** and do not claim that a
|
|
128
|
+
real-Lean-corpus comparison was completed.
|
|
129
|
+
|
|
130
|
+
### 4. Review and verification
|
|
131
|
+
|
|
132
|
+
This release went through **four independent audit rounds** (adversarial re-falsification, cross
|
|
133
|
+
audit, user on-ramp, fresh-lens review) and a **real-host packaging/boot certification on the frozen
|
|
134
|
+
commit**; the gate is `TOTAL 65 PASS 65 FAIL 0` (**44 suites + 21 probes**), plus 22 module-level
|
|
135
|
+
mutation probes that each require a *named* assertion to turn red.
|
|
136
|
+
|
|
137
|
+
## Compatibility
|
|
138
|
+
|
|
139
|
+
- Existing parameter defaults, data formats and directory structure are **unchanged**; every new
|
|
140
|
+
parameter defaults to "does not change existing behaviour" (`leanAsync=true` merely moves
|
|
141
|
+
compilation to a background queue, `leanInitiative='normal'` keeps the previous proactivity).
|
|
142
|
+
- New directories `Computation/` and `Formal/Jobs/`; the host's text write **creates missing parent
|
|
143
|
+
directories**, so nothing has to be pre-created by hand.
|
|
144
|
+
- The DSH support window is unchanged (the `>=0.1.7` patch row and the `<=0.1.6` directory row both
|
|
145
|
+
ship the shared module).
|
|
146
|
+
|
|
147
|
+
## Upgrade
|
|
148
|
+
|
|
149
|
+
- Upgrade directly: **no migration** - no parameter was renamed and no state-file format changed.
|
|
150
|
+
- To turn the new capabilities off: `mathComputation:'off'` (a true no-op), `leanAsync:false` (back to
|
|
151
|
+
synchronous compilation), `leanInitiative:'off'` (no proactive formalisation).
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# dsh-vibe-math 2.7.0 — 发布说明(中文)
|
|
2
|
+
|
|
3
|
+
> 上一版:2.6.0。本版新增两块能力:**Lean 增量形式化(异步编译 + `import` 复用)** 与
|
|
4
|
+
> **`math_computation` 数学计算工具**(四套预设共享同一实现)。既有参数默认值、数据格式与目录结构
|
|
5
|
+
> **未变**(只是新增参数与目录),DSH 支撑窗口不变,无需迁移。
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 概览
|
|
10
|
+
|
|
11
|
+
- **Lean 增量形式化**:`leanAsync`(默认 `true`)把编译放后台队列,入队即返回;新增并发上限
|
|
12
|
+
`leanJobsMaxParallel`(默认 `1`)、日常主动性 `leanInitiative`(`off|normal|eager`,默认 `normal`)
|
|
13
|
+
与额外搜索路径 `leanSearchPaths`(默认 `[]`)。新增只读工具 `lean_read` / `lean_job`,
|
|
14
|
+
作业镜像写 `Formal/Jobs/<jobId>.json`。
|
|
15
|
+
- **`math_computation`(新工具)**:先用 `op:'probe'` 预检引擎/包/许可,再 `op:'run'` 计算,
|
|
16
|
+
每次执行都归档成可复核回执;`op:'install'` 走"计划 → 确认"两段式,`op:'receipt'` 只读复核。
|
|
17
|
+
- **引擎**:`python` / `r` / `octave` / `julia` / `matlab` / `maple` / `wolfram` / `cli`。
|
|
18
|
+
商业三家**只探测与查许可,永不代装**;`cli` 默认开启(两个文档化的关闭路径)。
|
|
19
|
+
- **归档→编辑→重跑**:回执带 `scriptPath`/`scriptHash`;改动脚本后必须用 `mode:'file'` 重跑,
|
|
20
|
+
旧回执对修改后的代码无效(`scriptChanged` / `scriptChangedDuringRun` 显式告警)。
|
|
21
|
+
- **六个新参数**:`mathComputation` / `mathMode` / `mathEngines` / `mathTimeoutMs` / `mathPackages` /
|
|
22
|
+
`mathInstallScope`(README 双语参数表与 `docs/math-computation.md` 为准)。
|
|
23
|
+
- 本版经过**四轮独立审查** + 冻结提交上的**真机打包/启动认证**;门禁 `TOTAL 65 PASS 65 FAIL 0`
|
|
24
|
+
(44 套件 + 21 探针)。
|
|
25
|
+
|
|
26
|
+
## 变更
|
|
27
|
+
|
|
28
|
+
### 1. Lean 增量形式化 + 异步编译 + `import` 复用
|
|
29
|
+
|
|
30
|
+
- **新参数**(四套一致,默认值即"安全且不改变既有行为"):
|
|
31
|
+
- `leanAsync`:默认 `true`。`true` = 编译进**每会话后台队列**,入队即返回;`false` = 同步 `await`(旧语义)。
|
|
32
|
+
- `leanJobsMaxParallel`:默认 `1`(串行)。后台编译的并发上限。
|
|
33
|
+
- `leanInitiative`:`off | normal | eager`,默认 `normal`。**日常流程中的形式化主动性**。
|
|
34
|
+
- `leanSearchPaths`:默认 `[]`。额外的 `--search-path` 根;非空时**先**注入它们,**再**注入自动根。
|
|
35
|
+
- **队列状态机**:作业有明确的状态迁移;**只有 `settled(ok)` 才算 passed**——"入队成功/正在编译"
|
|
36
|
+
一律不计入通过,也不会被当成已证。
|
|
37
|
+
- **`import` 复用**:编译命令自动注入 `--search-path <VibeMath 根>`,因此
|
|
38
|
+
`import Formal.Lib.<name>` 与 `Formal.Proved.<name>` 可以直接工作(跨项目复用已归档的定义/引理)。
|
|
39
|
+
- **新只读工具**:`lean_read`(读归档/库内容)与 `lean_job`(查作业状态),都是**只读**,不会触发编译。
|
|
40
|
+
- **作业镜像**:每个作业在 `Formal/Jobs/<jobId>.json` 留一份镜像,进程重启后可恢复或显式中断。
|
|
41
|
+
- **诚实说明**:`leanInitiative` 与 `formalVerify` 是**两条独立的轴**。
|
|
42
|
+
`formalVerify:'off'` 关闭的是**验证阶段**,不会吞掉主动性轴:
|
|
43
|
+
`off + normal` ⇒ 一个字都不提 Lean;`off + eager` ⇒ **只**出现日线(主动性提示),验证段仍然关闭。
|
|
44
|
+
|
|
45
|
+
### 2. 新工具 `math_computation`
|
|
46
|
+
|
|
47
|
+
- **六个冻结参数**(名字不可改;四套、README 双语表、契约文档拼写一致):
|
|
48
|
+
| 参数 | 默认 | 说明 |
|
|
49
|
+
|---|---|---|
|
|
50
|
+
| `mathComputation` | `auto` | `off`(真 no-op)/ `auto`(探测到才工作)/ `on` |
|
|
51
|
+
| `mathMode` | `typed+shell` | **提示词策略**:`typed` 不提 shell 且禁用 `engine:'cli'` |
|
|
52
|
+
| `mathEngines` | `[python,r,octave,julia,matlab,maple,wolfram,cli]` | 允许/探测顺序;去掉 `cli` 即关闭逃生口 |
|
|
53
|
+
| `mathTimeoutMs` | `60000` | 单次上限(最小 1000);超时**主动终止**进程 |
|
|
54
|
+
| `mathPackages` | `[]` | 默认要求的包;缺包只报告 + 给计划,**不自动装** |
|
|
55
|
+
| `mathInstallScope` | `user` | 安装作用域;`system` 必须每次显式指定、**不被记住** |
|
|
56
|
+
- **`op`**:`probe`(预检引擎/版本/包/许可)、`run`(`mode: code|file|expr`)、`receipt`(只读复核)、
|
|
57
|
+
`install`(两段式安装)。
|
|
58
|
+
- **失败码(11 个,冻结)**:`MATH_NOT_AVAILABLE`、`MATH_ENGINE_NOT_FOUND`、`MATH_ENGINE_LICENSE_REQUIRED`、
|
|
59
|
+
`MATH_ENGINE_UNUSABLE`、`MATH_MISSING_PACKAGES`、`MATH_TIMEOUT`、`MATH_NONZERO_EXIT`、
|
|
60
|
+
`MATH_ENGINE_BAD_ARGV`、`MATH_REFUSED`、`MATH_INVALID_ARGUMENT`、`MATH_NO_SUBPROCESS`;
|
|
61
|
+
每个都带机读 `next`(`user-install` / `agent-install` / `vendor` / `enable` / `engine-override` /
|
|
62
|
+
`reason` / `note`)。
|
|
63
|
+
- **确定性回执**:`runId` 只由"预设 + 项目 + 引擎 + 模式 + 键 + 排序后的包"决定,**不含墙钟**;
|
|
64
|
+
`argv` 在回执与返回体里**双回显**(可照抄复跑);`stdout`/`stderr` 全量落盘、返回体截 64KB。
|
|
65
|
+
- **引擎**:`python`/`r`/`octave`/`julia` 为自由引擎;`matlab`/`maple`/`wolfram` 为**商业**——
|
|
66
|
+
只做探测与许可检查,**永不代装**(只给厂商指引);`cli` 用你指定的命令执行,仍受本工具的超时、
|
|
67
|
+
输出上限、cwd 与回执约束。
|
|
68
|
+
- **两条安装路径**:① 用户自装(逐 OS 命令 + 官方链接);② 代理代装 `plan → planToken → confirm`
|
|
69
|
+
(token 绑定计划内容,内容变了即失效)。默认 **user 作用域**,`system` **每次都要显式确认**;
|
|
70
|
+
每次执行写审计 `Computation/installs/<planToken>.json`(含确切命令、退出码、before/after
|
|
71
|
+
与**卸载命令模板**)。包安装**没有通用回滚**——工具保证的是"命令与版本可核验 + 卸载模板",
|
|
72
|
+
不做自动回滚。
|
|
73
|
+
- **`cli` 默认开启**(它不比模型本来就有的宿主 shell 更大,但多了回执与上限);两个关闭路径:
|
|
74
|
+
`mathMode:'typed'`,或把 `'cli'` 从 `mathEngines` 移除——两者都返回 `MATH_REFUSED`。
|
|
75
|
+
- **归档→编辑→重跑(完整性保证)**:
|
|
76
|
+
- 返回体与回执都带 `scriptPath`/`scriptHash`;脚本原件可以打开/编辑;
|
|
77
|
+
- 编辑后用 `mode:'file'` 重跑 ⇒ **新回执**(新 attempt、新哈希);**旧回执不代表修改后的代码**;
|
|
78
|
+
- `scriptChanged`(与上一份回执的哈希不一致)、`scriptChangedDuringRun`(运行期间被改动)都会
|
|
79
|
+
**显式告警**并写进回执;
|
|
80
|
+
- 归档是**追加式**的(`Computation/<id>/`,第 n≥2 次进 `attempts/<n>/`),已有文件**永不覆盖**;
|
|
81
|
+
- 保留上限(20 attempt / 200 run)**只告警、永不自动删除**;手改状态文件里的未知参数键会被
|
|
82
|
+
**报告**(`diagnostics`),不静默丢弃。
|
|
83
|
+
|
|
84
|
+
### 3. 诚实边界(务必读)
|
|
85
|
+
|
|
86
|
+
- **引擎执行只用假 subprocess seam 验证**:本机**没有**跑过真实的 python/R/octave/julia/matlab/
|
|
87
|
+
maple/wolfram;真机验证需要一台装有这些引擎的机器(模板、许可探测与安装计划的**静态面**已被守卫冻结)。
|
|
88
|
+
- **插件不能强制禁网/限权**:宿主 `subprocess.spawn` **没有 policy 槽**(`env` 层只做凭据/`DSH_*`
|
|
89
|
+
清洗,不能限制网络或写盘);真强制需要宿主 sandbox 支持,**列为待上游需求**。
|
|
90
|
+
- **商业模板标 `VERIFY`**:Maple(尤甚)、MATLAB、Wolfram 的 CLI 模板随版本变化,描述符带 `VERIFY`
|
|
91
|
+
标记;每次运行都回显实际 argv,用法/选项错会返回 `MATH_ENGINE_BAD_ARGV` 并提示用
|
|
92
|
+
`mathEngineOverride` 覆盖模板(而不是裸 `MATH_NONZERO_EXIT`)。有许可的机器应自行验证这三个模板。
|
|
93
|
+
- **SageMath 属于 P2**:本版只有描述符占位,不接入。
|
|
94
|
+
- **两个对照实验以 run-book 形式给出**(同步 vs 异步编译;不使用 vs 使用 `import` 复用):
|
|
95
|
+
本说明**不含**任何编造的实测数字,也不声称已完成真实 Lean 语料的对比。
|
|
96
|
+
|
|
97
|
+
### 4. 审查与验证
|
|
98
|
+
|
|
99
|
+
本版经过 **四轮独立审查**(对抗性再证伪、交叉审计、用户上手路径、新视角复审),
|
|
100
|
+
并在**冻结提交上**完成**真机打包/启动认证**;门禁为 `TOTAL 65 PASS 65 FAIL 0`
|
|
101
|
+
(**44 套件 + 21 探针**),另有 22 个模块级变异探针要求"具名断言变红"。
|
|
102
|
+
|
|
103
|
+
## 兼容性
|
|
104
|
+
|
|
105
|
+
- 既有参数默认值、数据格式与目录结构**未变**;新增参数都取"不改变既有行为"的默认值
|
|
106
|
+
(`leanAsync=true` 只是把编译改为后台队列,`leanInitiative='normal'` 保持原有主动性)。
|
|
107
|
+
- 新增目录 `Computation/` 与 `Formal/Jobs/`;宿主的文本写会**自动创建缺失的父目录**,
|
|
108
|
+
无需预先手工建目录。
|
|
109
|
+
- DSH 支撑窗口不变(`>=0.1.7` 的 patch 行 + `<=0.1.6` 的目录行两条安装线都随包发布共享模块)。
|
|
110
|
+
|
|
111
|
+
## 升级
|
|
112
|
+
|
|
113
|
+
- 直接升级即可,**无需迁移**:没有改名的参数、没有改格式的状态文件。
|
|
114
|
+
- 想关闭新能力:`mathComputation:'off'`(真 no-op)、`leanAsync:false`(回到同步编译)、
|
|
115
|
+
`leanInitiative:'off'`(不主动形式化)。
|
package/docs/test-timing.md
CHANGED
|
@@ -26,17 +26,20 @@ node tests/run-tests.mjs --json # 机器可读汇总(含 skippedN
|
|
|
26
26
|
|
|
27
27
|
### 1.1 随包发布 vs 仅仓库(`npm pack --dry-run --json`)
|
|
28
28
|
|
|
29
|
-
`package.json` 的 `files` 只发 `tests/` 的一个**子集**(发布物共
|
|
29
|
+
`package.json` 的 `files` 只发 `tests/` 的一个**子集**(发布物共 **119** 个文件,其中 `tests/` **23** 项),
|
|
30
30
|
所以安装用户跑 `node tests/run-tests.mjs` 得到的是子集的结果——runner 会把缺失的跳过项打印出来,
|
|
31
31
|
不会静默少跑:
|
|
32
32
|
|
|
33
|
-
- **随包(
|
|
33
|
+
- **随包(23 项)**:`run-tests.mjs`、`audit-formal-sensitivity.mjs`、`audit-persona-sensitivity.mjs`、
|
|
34
34
|
`audit-prompt-invariants.mjs`、`audit-spec-traceability.mjs`、`audit-v5-integrity.mjs`、
|
|
35
|
-
`audit-v5-sensitivity.mjs`、`selfdrive-v5.mjs
|
|
35
|
+
`audit-v5-sensitivity.mjs`、`selfdrive-v5.mjs`、`audit-math-computation-parity.mjs`、
|
|
36
|
+
`audit-math-computation-contract.mjs`、`audit-math-computation-sensitivity.mjs`、
|
|
37
|
+
`helpers/math-computation-fake-seam.mjs`;套件 **11** 个:`audit-installer-compat`、
|
|
36
38
|
`audit-installer-policy`、`audit-persona-surface`、`audit-preset-rows`、`e2e-v5-round2`、
|
|
37
|
-
`formal-verify-v2`、`formal-verify-v3`、`formal-verify-v4`、`formal-verify-v5`、`prompt-v5-integrity
|
|
38
|
-
-
|
|
39
|
-
|
|
39
|
+
`formal-verify-v2`、`formal-verify-v3`、`formal-verify-v4`、`formal-verify-v5`、`prompt-v5-integrity`、
|
|
40
|
+
`math-computation-shared`。
|
|
41
|
+
- **仅仓库(不发)**:其余 33 个套件(v2/v3/v4 的 e2e、`selfdrive-v3`/`v4`、v2/v3 修复探针、
|
|
42
|
+
`math-computation-v2|v3|v4|v5`、`audit-fuzz-helpers` 之外的若干 `audit-*`……)与 7 个脚本(`audit-fuzz-helpers`、
|
|
40
43
|
`audit-registration`、`audit-roundtrip-idempotence`、`audit-tool-exec`、
|
|
41
44
|
`audit-v3-registration-parity`、`selfdrive-v3`、`selfdrive-v4`)。
|
|
42
45
|
- 因此**完整门禁只能在开发检出里跑**;发布物里的子集是"用户可自查"的一部分,不是全部证据。
|
|
@@ -46,8 +49,8 @@ node tests/run-tests.mjs --json # 机器可读汇总(含 skippedN
|
|
|
46
49
|
|
|
47
50
|
| 脚本 | 串行(sum) | 并行(wall) | 实测输出 |
|
|
48
51
|
|---|---|---|---|
|
|
49
|
-
| `tests/run-tests.mjs`(**
|
|
50
|
-
| `tests/audit-formal-sensitivity.mjs`(49 探针,自带并发 4) |
|
|
52
|
+
| `tests/run-tests.mjs`(**65 项** = 44 套件 + 21 探针/变体) | ≈ 424 s | **≈ 121 s**(并发 4,speed-up x3.51) | `TOTAL 65 PASS 65 FAIL 0 (suites 44 · probes 21)`;实测 `wall 120.7s · sum 424.2s`,关键路径 = `e2e-v4-fixes`(≈ 98 s) |
|
|
53
|
+
| `tests/audit-formal-sensitivity.mjs`(49 探针,自带并发 4;v2 12 / v3 12 / v4 12 / v5 13) | ≈ 1035 s | **260.7 s**(实测,x3.97) | 关键路径 = v2/v3 的 `require` 探针(各 ≈75 s);全 49 条按预期变红、0 问题 |
|
|
51
54
|
| `tests/audit-v5-sensitivity.mjs`(39 探针,串行) | ≈ 101 s | — | 每条 = 一次被测套件重跑 |
|
|
52
55
|
| `tests/audit-persona-sensitivity.mjs`(16 探针) | ≈ 4.4 s | — | 本身很快,不需要并行 |
|
|
53
56
|
| `tests/audit-prompt-invariants.mjs`(157 条) | ≈ 1.9 s | — | 静态 |
|
|
@@ -63,10 +66,19 @@ node tests/run-tests.mjs --json # 机器可读汇总(含 skippedN
|
|
|
63
66
|
| `tests/v2-fix-probes.test.mjs` | ≈ 8.6 s | — | v2 的 flat 等权均值 / ≥2 名验证者 / runShell 失败分支(26 条) |
|
|
64
67
|
| `tests/v2-path-escape.test.mjs` | ≈ 2.2 s | — | 验证日志路径逃逸(7 条) |
|
|
65
68
|
| `tests/v2-tool-cap.test.mjs` | ≈ 0.4 s | — | 能力表来自真实组合、*MaxToolCalls 只是提示(10 条) |
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
| `tests/math-computation-v2.test.mjs` | ≈ 1.7 s | — | v2 接线:六参数/双注册层/回执/归档→编辑→重跑/跨会话隔离(含 mutant 说明在文件头) |
|
|
70
|
+
| `tests/math-computation-v3.test.mjs` | ≈ 1.7 s | — | v3 同上(dual-layer + `TOOL_DESC` 描述 parity) |
|
|
71
|
+
| `tests/math-computation-v4.test.mjs` | ≈ 2.5 s | — | v4:每会话一个模块实例 + 隔离断言 + `vibe_v4_set` 闭集 + 单点注册 |
|
|
72
|
+
| `tests/math-computation-v5.test.mjs` | ≈ 1.4 s | — | v5:闭集 `vibe_v5_set`、研究所根回执、会话隔离(7 个 mutant) |
|
|
73
|
+
| `tests/math-computation-shared.test.mjs` | ≈ 0.1 s | — | 共享模块契约(参数/失败码/argv/回执/归档/并发/override/路径守卫),走假 subprocess seam |
|
|
74
|
+
| `tests/audit-math-computation-parity.mjs` | ≈ 0.1 s | — | 四份副本字节一致 + canonical 一致 + 两条安装线 + 描述符不变式(44 条) |
|
|
75
|
+
| `tests/audit-math-computation-contract.mjs` | ≈ 0.2 s | — | 跨预设接线(含 set-schema **属性级**检查与 defaults 漂移检查) |
|
|
76
|
+
| `tests/audit-math-computation-sensitivity.mjs` | ≈ 25 s | — | 21 个模块级变异,每条都要求具名断言变红(控制组必须绿) |
|
|
77
|
+
|
|
78
|
+
> 上表 `run-tests` 的 `≈424 s / ≈121 s` 两列是 **65 项(44 套件 + 21 探针)** 时的实测(2026 年 math_computation
|
|
79
|
+
> P1/P2a + 审计修复轮之后)。`audit-formal-sensitivity`(49 探针,实测 wall 260.7 s)与 `e2e-v4-fixes`(≈ 98 s)
|
|
80
|
+
> 是两条最长的独立路径;两者都不在 `run-tests` 的默认集合里时,整轮 wall 由 `e2e-v4-fixes` 决定。
|
|
81
|
+
> 数字**形状**(`TOTAL 65 … suites 44 · probes 21`)以 runner 每次运行的输出为准。
|
|
70
82
|
|
|
71
83
|
单套件耗时(并行时的关键路径按此排序):
|
|
72
84
|
|
package/installer.js
CHANGED
|
@@ -54,24 +54,27 @@ export const PRESETS = [
|
|
|
54
54
|
{
|
|
55
55
|
src: 'vibe-math-v2',
|
|
56
56
|
dst: 'vibe-math-v2',
|
|
57
|
-
|
|
57
|
+
// math-computation.js + math-engines.js are PER-PRESET copies of the shared module (they must be
|
|
58
|
+
// listed here: on the <=0.1.6 line only these files are copied into .agent-presets/<id>/, and the
|
|
59
|
+
// preset JS imports them relatively). guard: tests/audit-math-computation-parity.mjs
|
|
60
|
+
files: ['agent.cordis.yml', 'preset.yml', 'vibe-math-v2.js', '实现方案.md', 'math-computation.js', 'math-engines.js'],
|
|
58
61
|
},
|
|
59
62
|
{
|
|
60
63
|
src: 'vibe-math-v3',
|
|
61
64
|
dst: 'vibe-math-v3',
|
|
62
|
-
files: ['agent.cordis.yml', 'preset.yml', 'vibe-math-v3.js', '实现方案.md'],
|
|
65
|
+
files: ['agent.cordis.yml', 'preset.yml', 'vibe-math-v3.js', '实现方案.md', 'math-computation.js', 'math-engines.js'],
|
|
63
66
|
},
|
|
64
67
|
{
|
|
65
68
|
src: 'vibe-math-v4',
|
|
66
69
|
dst: 'vibe-math-v4',
|
|
67
|
-
files: ['agent.cordis.yml', 'preset.yml', 'vibe-math-v4.js', '实现方案.md'],
|
|
70
|
+
files: ['agent.cordis.yml', 'preset.yml', 'vibe-math-v4.js', '实现方案.md', 'math-computation.js', 'math-engines.js'],
|
|
68
71
|
},
|
|
69
72
|
{
|
|
70
73
|
src: 'vibe-math-v5',
|
|
71
74
|
dst: 'vibe-math-v5',
|
|
72
75
|
// 架构图.md belongs here for the same reason 实现方案.md does: the installer's policy is to put
|
|
73
76
|
// the preset's documentation next to the preset, and the shipped v5 directory carries both.
|
|
74
|
-
files: ['agent.cordis.yml', 'preset.yml', 'vibe-math-v5.js', '实现方案.md', '架构图.md'],
|
|
77
|
+
files: ['agent.cordis.yml', 'preset.yml', 'vibe-math-v5.js', '实现方案.md', '架构图.md', 'math-computation.js', 'math-engines.js'],
|
|
75
78
|
},
|
|
76
79
|
]
|
|
77
80
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-vibe-math",
|
|
3
3
|
"description": "Multi-agent mathematical problem-solving & verification frameworks for DeepSeek Harness — FOUR agent presets in one install: vibe-math-v2 (probability-driven, classic: qs.json + Propos knowledge base + explorer→solver→review/debate verdict), vibe-math-v3 (THIRD-generation, classic: paper-style Markdown knowledge base with Problems/Progress/Propos/Methods/Verified + planner-agent scheduling that decides the next N actions + universal theory/method invention library + agents write their own Markdown directly via a per-file write lock), and vibe-math-v4 (FOURTH-generation: persistent self-organizing resident subagents that message & meet to decide all tasks, verify only by unanimous consensus, /compact at a context threshold, and stop only when all agree the problem is solved), and vibe-math-v5 (FIFTH-generation research institute: an academician as the organizational centre who decomposes and ASSIGNS work and chairs meetings; permanent researchers who hold the vote and may hire/fire their own temp workers; temp workers with no vote; a group chat and meetings; a durable per-recipient mailbox; a compare-and-set task DAG; and a boolean m-vote consensus rule where an object enters Verified/ only when at least m voting members agree AND every one of them returns exactly 1 or exactly 0). Installing this bundle auto-installs all four presets (v1 was removed at v2.0.0). Each preset also writes a FINAL PAPER by default when its run concludes — and does so BEFORE the run is marked complete: on v4/v5 the team co-authors its parts, merges them, cross-reviews, and the editor named by paperEditor finalises; the output is Paper/<run or institute id>/{paper.md,paper.tex,paper.pdf when a LaTeX engine is detected,paper.meta.json,paper.log.md} (params finalPaper/paperFormat/paperLanguage/paperCompilePdf/paperLatexCommand, plus paperEditor on v4/v5; see docs/final-paper.md).",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.7.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": "^22.19.0 || >=24.0.0",
|
|
@@ -35,6 +35,12 @@
|
|
|
35
35
|
"docs/架构图.md",
|
|
36
36
|
"docs/formal-verification.md",
|
|
37
37
|
"docs/final-paper.md",
|
|
38
|
+
"docs/math-computation.md",
|
|
39
|
+
"tests/audit-math-computation-parity.mjs",
|
|
40
|
+
"tests/audit-math-computation-contract.mjs",
|
|
41
|
+
"tests/audit-math-computation-sensitivity.mjs",
|
|
42
|
+
"tests/math-computation-shared.test.mjs",
|
|
43
|
+
"tests/helpers/math-computation-fake-seam.mjs",
|
|
38
44
|
"docs/generate_framework_diagram_v2.py",
|
|
39
45
|
"docs/generate_framework_diagram_v3.py",
|
|
40
46
|
"docs/generate_framework_diagram_v4.mjs",
|
|
@@ -68,19 +74,27 @@
|
|
|
68
74
|
"vibe-math-v2/preset.yml",
|
|
69
75
|
"vibe-math-v2/v2的额外要求.txt",
|
|
70
76
|
"vibe-math-v2/vibe-math-v2.js",
|
|
77
|
+
"vibe-math-v2/math-computation.js",
|
|
78
|
+
"vibe-math-v2/math-engines.js",
|
|
71
79
|
"vibe-math-v3/实现方案.md",
|
|
72
80
|
"vibe-math-v3/agent.cordis.yml",
|
|
73
81
|
"vibe-math-v3/preset.yml",
|
|
74
82
|
"vibe-math-v3/vibe-math-v3.js",
|
|
83
|
+
"vibe-math-v3/math-computation.js",
|
|
84
|
+
"vibe-math-v3/math-engines.js",
|
|
75
85
|
"vibe-math-v4/实现方案.md",
|
|
76
86
|
"vibe-math-v4/agent.cordis.yml",
|
|
77
87
|
"vibe-math-v4/preset.yml",
|
|
78
88
|
"vibe-math-v4/vibe-math-v4.js",
|
|
89
|
+
"vibe-math-v4/math-computation.js",
|
|
90
|
+
"vibe-math-v4/math-engines.js",
|
|
79
91
|
"vibe-math-v5/架构图.md",
|
|
80
92
|
"vibe-math-v5/实现方案.md",
|
|
81
93
|
"vibe-math-v5/agent.cordis.yml",
|
|
82
94
|
"vibe-math-v5/preset.yml",
|
|
83
95
|
"vibe-math-v5/vibe-math-v5.js",
|
|
96
|
+
"vibe-math-v5/math-computation.js",
|
|
97
|
+
"vibe-math-v5/math-engines.js",
|
|
84
98
|
"docs/release-notes/RELEASE-NOTES-2.0.22.md",
|
|
85
99
|
"docs/release-notes/RELEASE-NOTES-2.1.0.md",
|
|
86
100
|
"docs/release-notes/RELEASE-NOTES-2.2.0.md",
|
|
@@ -98,6 +112,8 @@
|
|
|
98
112
|
"docs/release-notes/RELEASE-NOTES-2.4.0.md",
|
|
99
113
|
"docs/release-notes/RELEASE-NOTES-2.4.1.md",
|
|
100
114
|
"docs/release-notes/RELEASE-NOTES-2.6.0.md",
|
|
115
|
+
"docs/release-notes/RELEASE-NOTES-2.7.0.md",
|
|
116
|
+
"docs/release-notes/RELEASE-NOTES-2.7.0.en.md",
|
|
101
117
|
"docs/release-notes/RELEASE-NOTES-2.5.0.md",
|
|
102
118
|
"docs/release-notes/RELEASE-NOTES-2.3.2.md",
|
|
103
119
|
"docs/release-notes/RELEASE-NOTES-2.3.3.md",
|
|
@@ -151,7 +167,7 @@
|
|
|
151
167
|
},
|
|
152
168
|
"minVersion": "0.1.2-alpha.4",
|
|
153
169
|
"testedVersion": "0.2.0-rc.2",
|
|
154
|
-
"compatNote": "v2.
|
|
170
|
+
"compatNote": "v2.7.0 增量形式化 + 数学计算版本(四套预设新增 Lean 异步编译/import 复用与 math_computation 工具;既有参数默认值、数据格式与目录结构未变,DSH 支撑窗口不变,无需迁移)。① 新参数:leanAsync(默认 true,编译走每会话后台队列、入队即返回)、leanJobsMaxParallel(默认 1)、leanInitiative=off|normal|eager(默认 normal;与 formalVerify 是两条独立轴:off+normal 完全不提 Lean,off+eager 只出主动性日线、验证段仍关)、leanSearchPaths(默认 [],先于自动根注入);编译命令自动注入 --search-path <VibeMath 根>,import Formal.Lib.<name> / Formal.Proved.<name> 可直接复用;新增只读工具 lean_read / lean_job,作业镜像 Formal/Jobs/<jobId>.json;队列状态机下只有 settled(ok) 才算 passed。② 新工具 math_computation:op=probe|run|receipt|install,六个冻结参数 mathComputation(auto|on|off,默认 auto)、mathMode(typed+shell|typed,默认 typed+shell)、mathEngines(默认 python,r,octave,julia,matlab,maple,wolfram,cli)、mathTimeoutMs(默认 60000,最小 1000)、mathPackages(默认 [])、mathInstallScope(默认 user;system 必须每次显式且不被记住);python/r/octave/julia 自由,matlab/maple/wolfram 商业只探测与查许可、永不代装,cli 默认开启(关闭路径:mathMode=typed 或从 mathEngines 移除 cli);11 个失败码带机读 next;回执确定(runId 无墙钟、argv 双回显、stdout/stderr 全量落盘、返回体截 64KB);安装走 plan→planToken→confirm,审计 Computation/installs/<planToken>.json 含卸载模板(无通用自动回滚);归档→编辑→重跑:scriptPath/scriptHash + scriptChanged/scriptChangedDuringRun 显式告警,attempt 追加式永不覆盖,保留上限 20/200 只告警不删除,手改状态文件里的未知键会被报告。③ 诚实边界:引擎执行只用假 subprocess seam 验证(未在本机跑真实引擎);宿主 subprocess.spawn 无 policy 槽,插件不能强制禁网/限权(需宿主 sandbox);Maple/MATLAB/Wolfram 模板标 VERIFY 并提供 mathEngineOverride 覆盖;SageMath 属 P2。④ 本版经四轮独立审查 + 冻结提交上的真机打包/启动认证;门禁 65 项全绿(44 套件 + 21 探针)+ 22 个模块级变异探针。",
|
|
155
171
|
"compatibility": {
|
|
156
172
|
"dshReleases": {
|
|
157
173
|
"0.1.2-alpha.4": "compatible",
|