dsh-vibe-math 0.3.5 → 0.3.6

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.md CHANGED
@@ -15,6 +15,24 @@
15
15
 
16
16
  ---
17
17
 
18
+ ## 🧩 架构图(v1 + v2)
19
+
20
+ > 静态架构图;完整流程说明见 [docs/架构图.md](docs/架构图.md);可编辑生成脚本:[v1](docs/generate_framework_diagram.py) / [v2](docs/generate_framework_diagram_v2.py)。
21
+
22
+ ### Vibe Math V1(经典流水线)
23
+
24
+ ![Vibe Math V1 架构图](示例图/框架图-v1.png)
25
+
26
+ **一句话流水线**:`qs.csv` → Brainstorm 拆方向 → 每方向一个 Solver 多轮迭代(卡死则 Derive 派生新方向)→ 输出拆成最小验证单元 → ≥3 个 Verifier 独立审查 → 辩论 → 裁决 → 通过晋升 `Verified/` → Decider 回写 `qs.csv`;全程状态落盘 `VibeMath_State/`,`resume` 断点续跑,`manual` 模式在派发/裁决/晋升处挂起人工决策。
27
+
28
+ ### Vibe Math V2(新架构 · 概率驱动)
29
+
30
+ ![Vibe Math V2 架构图](示例图/框架图-v2.png)
31
+
32
+ **一句话流水线**:`qs.json` 按优先级取问题 → Explorer 拆方向(全死路则重派生)→ 每方向一个 Solver 多轮迭代(引理进 `Propos/`、解法回 `qs.json`,概率均 <1)→ 调度器选 r(命题 / 命题+证明·证伪 / 问题+解法)派 ≥3 验证器独立审查→辩论→裁决 → 概率=1 自动收口(问题 solved、命题 1/0,优先级置 `never`);全程状态落盘,`resume` 断点续跑,`reportMode` 可 file/push/both 汇报。
33
+
34
+ ---
35
+
18
36
  ## ✨ 功能特色
19
37
 
20
38
  - **多代理自动求解**:主代理把问题交给调度器,调度器派发 brainstorm / solver / verifier / decider(v1)或 explorer / solver / verifier(v2)等子代理协同求解,**你无需逐节点手操**。
@@ -93,116 +111,6 @@ dsh plugin --profile <你的 profile> add github:ChongCyrus/Vibe-Mathematics
93
111
 
94
112
  ---
95
113
 
96
- ## 🧩 架构图 · v1(经典)
97
-
98
- > 静态 PNG 预览 + 可编辑 Mermaid 图源(GitHub 原生渲染);完整流程说明见 [docs/架构图.md](docs/架构图.md)。
99
-
100
- ![Vibe Math V1 架构图](示例图/框架图-v1.png)
101
-
102
- ```mermaid
103
- flowchart TB
104
- subgraph L1["👤 交互层"]
105
- U["😀 用户(自然语言)"]
106
- M["🤖 主代理(助手 + 汇报者)<br/>翻译需求 · 汇报进度 · 问答配置<br/>不求解 · 不调度"]
107
- end
108
-
109
- subgraph L2["⚙️ 调度层(插件代码)"]
110
- SCHED["调度器 Scheduler<br/>唯一文件写者<br/>读 qs.csv · 派发子代理 · 推进状态机"]
111
- end
112
-
113
- subgraph L3["🧠 子代理层(continuable 持久会话)"]
114
- BRAIN["🧭 Brainstorm<br/>拆解多个求解方向"]
115
- SOLV["✍️ Solver × N<br/>逐方向多轮迭代"]
116
- DERI["🔀 Derive<br/>死路时派生新方向"]
117
- VERI["🔬 Verifier × ≥3<br/>独立审查 → 辩论 → 裁决"]
118
- DECI["⚖️ Decider<br/>判定是否解决"]
119
- end
120
-
121
- subgraph L4["💾 数据层 · VibeMath/Projects/&lt;项目&gt;/"]
122
- QS["📋 qs.csv"]
123
- PEND["📥 Pending_Verification/"]
124
- UNDR["📂 Under_Verification/"]
125
- TVAL["✅ Temp_Validated/"]
126
- KNOW["📚 Verified/ 可信知识库"]
127
- STATE["🗄️ Progress_Logs/ · VibeMath_State/"]
128
- end
129
-
130
- U -->|"求解 XX / 查进度 / 干预"| M
131
- M -->|"vibe_math_* 工具"| SCHED
132
-
133
- SCHED -->|"① 派发"| BRAIN
134
- BRAIN -->|"多个大相径庭的方向"| SCHED
135
- SCHED -->|"② 每方向一个"| SOLV
136
- SOLV -->|"结构化结果 JSON"| SCHED
137
- SOLV -.->|"迭代至卡死"| DERI
138
- DERI -->|"派生 1~3 个新方向"| SCHED
139
- SCHED -->|"③ 写盘"| PEND
140
- SCHED -->|"④ 拆解为最小验证单元"| UNDR
141
- SCHED -->|"⑤ 派发 ≥3 个"| VERI
142
- VERI -->|"裁决 JSON"| SCHED
143
- SCHED -->|"⑥ 通过"| TVAL
144
- SCHED -->|"⑦ 晋升"| KNOW
145
- SCHED -->|"⑧ 派发"| DECI
146
- DECI -->|"⑨ 已解决 → 回写"| QS
147
- SCHED <-->|"读取问题"| QS
148
- SCHED <-->|"状态落盘 / 断点恢复"| STATE
149
- ```
150
-
151
- **一句话流水线**:`qs.csv` → Brainstorm 拆方向 → 每方向一个 Solver 多轮迭代(卡死则 Derive 派生新方向)→ 输出拆成最小验证单元 → ≥3 个 Verifier 独立审查 → 辩论 → 裁决 → 通过晋升 `Verified/` → Decider 回写 `qs.csv`;全程状态落盘 `VibeMath_State/`,`resume` 断点续跑,`manual` 模式在派发/裁决/晋升处挂起人工决策。
152
-
153
- ---
154
-
155
- ## 🧩 架构图 · v2(新架构 · 概率驱动)
156
-
157
- > 静态 PNG 预览 + 可编辑 Mermaid 图源(GitHub 原生渲染);生成脚本见 [docs/generate_framework_diagram_v2.py](docs/generate_framework_diagram_v2.py)。
158
-
159
- ![Vibe Math V2 架构图](示例图/框架图-v2.png)
160
-
161
- ```mermaid
162
- flowchart TB
163
- subgraph L1["👤 交互层"]
164
- U["😀 用户(自然语言)"]
165
- M["🤖 主代理(助手 + 汇报者)<br/>翻译需求 · 汇报进度 · 问答配置<br/>不求解 · 不调度"]
166
- end
167
-
168
- subgraph L2["⚙️ 调度层(插件代码 · 概率驱动)"]
169
- SCHED["调度器 Scheduler<br/>唯一文件写者 · 按优先级调度<br/>explorer → 逐方向 solver → 验证器 → 收口<br/>断点持久化 · 人工决策门"]
170
- end
171
-
172
- subgraph L3["🧠 子代理层(continuable 持久会话)"]
173
- EXP["🧭 Explorer<br/>拆方向 / 全死路时重派生(去死路 · 并集)"]
174
- SOLV["✍️ Solver × N<br/>agent_self_iteration<br/>逐方向多轮迭代"]
175
- VERI["🔬 Verifier × ≥3<br/>独立审查 → 辩论 → 裁决"]
176
- end
177
-
178
- subgraph L4["💾 数据层 · VibeMath/Projects/&lt;项目&gt;/"]
179
- QS["📋 qs/qs.json<br/>问题 + 解法(正确概率)"]
180
- PRP["📚 Propos/&lt;分类&gt;_Propos.json<br/>命题(布尔估计 · 证明/证伪列表)"]
181
- VERD["✅ Verified/<br/>定论事实(0/1)"]
182
- LOGS["🗄️ Verification_logs/ · Progress_Logs/<br/>· Reliable/ · VibeMath_State/"]
183
- end
184
-
185
- U -->|"求解 / 查进度 / 干预"| M
186
- M -->|"vibe_math_* 工具"| SCHED
187
-
188
- SCHED -->|"① 按优先级取问题"| QS
189
- SCHED -->|"② 派 Explorer"| EXP
190
- EXP -->|"方向集 M_q"| SCHED
191
- SCHED -->|"③ 每方向一个"| SOLV
192
- SOLV -->|"引理 → Propos(概率&lt;1)"| PRP
193
- SOLV -->|"解法 → qs(概率&lt;1)"| QS
194
- SOLV -.->|"卡死 → 重派生"| EXP
195
- SCHED -->|"④ 选 r 派 ≥3 验证器"| VERI
196
- VERI -->|"⑤ 裁决 0/1/中间"| SCHED
197
- SCHED -->|"⑥ 概率=1 → 收口/晋升"| PRP
198
- SCHED -->|"已解决 / 优先级 never"| QS
199
- SCHED -->|"晋升定论"| VERD
200
- SCHED <-->|"辩论记录 / 状态落盘"| LOGS
201
- ```
202
-
203
- **一句话流水线**:`qs.json` 按优先级取问题 → Explorer 拆方向(全死路则重派生)→ 每方向一个 Solver 多轮迭代(引理进 `Propos/`、解法回 `qs.json`,概率均 <1)→ 调度器选 r(命题 / 命题+证明·证伪 / 问题+解法)派 ≥3 验证器独立审查→辩论→裁决 → 概率=1 自动收口(问题 solved、命题 1/0,优先级置 `never`);全程状态落盘,`resume` 断点续跑,`reportMode` 可 file/push/both 汇报。
204
-
205
- ---
206
114
 
207
115
  ## 📁 目录结构
208
116
 
@@ -279,9 +187,9 @@ flowchart TB
279
187
  | `vibe_math_setup` | 返回参数 schema(交互式配置用) |
280
188
  | `vibe_math_save_settings` | 把当前参数存成新默认 |
281
189
  | `vibe_math_template` | 生成默认参数模板文件 |
282
- | `vibe_math_new_project` / `set_project` / `list_projects` | 项目管理 |
190
+ | `vibe_math_new_project` / `vibe_math_set_project` / `vibe_math_list_projects` | 项目管理 |
283
191
  | `vibe_math_list_decisions` / `decide` | 查看 / 裁决人工决策 |
284
- | `vibe_math_list_agents` / `message_agent` / `interrupt_agent` | 查看 / 发消息 / 中断子代理 |
192
+ | `vibe_math_list_agents` / `vibe_math_message_agent` / `vibe_math_interrupt_agent` | 查看 / 发消息 / 中断子代理 |
285
193
 
286
194
  斜杠命令(与工具等价):`/vibe start|resume|pause|abort|status|report|mode <auto|manual>|setup|save|template [global|project]|add <id> <desc>|add-proposition <id> <概述>|list-propositions|project [list|new <name>|<name>]|decisions|agents`
287
195
 
@@ -415,6 +323,7 @@ flowchart TB
415
323
  | `mode` | `auto` | `auto` / `manual` |
416
324
  | `maxParallelThreshold` | 4 | 全局最大并发子代理轮数(新派发前须 active < 阈值) |
417
325
  | `solverMaxRounds` | 3 | 每个求解方向最大迭代轮数(agent_self_iteration 上限) |
326
+ | `directionsPerSolver` | 1 | 每个 solver 提示词附带的方向数量(1 = 只看自己方向、互不干扰;>1 = 附带其他活跃方向摘要用于协调) |
418
327
  | `verifierCount` | 3 | 每个验证对象的独立验证器数量 |
419
328
  | `debateMaxRounds` | 5 | 验证辩论(交流群)最大轮数 |
420
329
  | `verdictMode` | `flat` | `flat` = 均衡机制(不一致判 0.5)/ `forced` = 强制裁决(历史准确率+严谨性加权) |
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 — TWO agent presets in one install: vibe-math-v1 (classic pipeline: brainstorm → solver iteration → multi-verifier debate → Verified) and vibe-math-v2 (new probability-driven architecture: qs.json + Propos knowledge base + explorer→solver→review/debate verdict). Installing this bundle auto-installs both presets into the DSH preset root.",
4
- "version": "0.3.5",
4
+ "version": "0.3.6",
5
5
  "type": "module",
6
6
  "main": "installer.js",
7
7
  "exports": {
@@ -34,6 +34,7 @@ export function apply(ctx) {
34
34
  mode: 'auto', // auto | manual
35
35
  maxParallelThreshold: 4, // concurrency gate: active turns < this
36
36
  solverMaxRounds: 3, // per-direction iteration cap (spec example)
37
+ directionsPerSolver: 1, // 每个 solver 提示词附带的方向数量(1 = 只看自己方向)
37
38
  verifierCount: 3, // independent reviewers per verification
38
39
  debateMaxRounds: 5, // debate round cap (spec example)
39
40
  verdictMode: 'flat', // flat = 均衡机制(0.5) | forced = 强制裁决(weighted)
@@ -119,6 +120,7 @@ export function apply(ctx) {
119
120
  { name: 'mode', type: 'enum', options: ['auto', 'manual'], description: 'auto = 无人值守自动通过关键节点;manual = 关键节点挂起人工决策', suggestion: 'auto' },
120
121
  { name: 'maxParallelThreshold', type: 'integer', description: '全局最大并发子代理轮数(新派发前须满足 active < 阈值)', suggestion: 4 },
121
122
  { name: 'solverMaxRounds', type: 'integer', description: '每个求解方向的最大迭代轮数(agent_self_iteration 上限)', suggestion: 3 },
123
+ { name: 'directionsPerSolver', type: 'integer', description: '每个 solver 提示词附带的方向数量:1 = 只看自己方向(互不干扰);>1 = 额外附带其他活跃方向摘要用于协调', suggestion: 1 },
122
124
  { name: 'verifierCount', type: 'integer', description: '每个验证对象的独立验证器数量', suggestion: 3 },
123
125
  { name: 'debateMaxRounds', type: 'integer', description: '验证辩论(交流群)最大轮数', suggestion: 5 },
124
126
  { name: 'verdictMode', type: 'enum', options: ['flat', 'forced'], description: 'flat = 均衡机制(不一致直接判 0.5);forced = 强制裁决(按历史准确率+严谨性加权)', suggestion: 'flat' },
@@ -164,7 +166,7 @@ export function apply(ctx) {
164
166
  // ================= settings =================
165
167
  function sanitizeParams(obj) {
166
168
  const out = {}
167
- const intFields = ['maxParallelThreshold', 'solverMaxRounds', 'verifierCount', 'debateMaxRounds', 'solverMaxToolCalls', 'verifierMaxToolCalls', 'reportIntervalMs', 'tickIntervalMs', 'activityLogCap', 'maxExplorerRetries']
169
+ const intFields = ['maxParallelThreshold', 'solverMaxRounds', 'directionsPerSolver', 'verifierCount', 'debateMaxRounds', 'solverMaxToolCalls', 'verifierMaxToolCalls', 'reportIntervalMs', 'tickIntervalMs', 'activityLogCap', 'maxExplorerRetries']
168
170
  const numFields = ['promoteValueThreshold']
169
171
  const arrayFields = ['solverToolAllow', 'solverToolDeny', 'verifierToolAllow', 'verifierToolDeny']
170
172
  for (const k of Object.keys(DEFAULT_PARAMS)) {
@@ -397,6 +399,16 @@ export function apply(ctx) {
397
399
  (d.lessons && d.lessons.length ? ' | lessons: ' + d.lessons.join('; ') : '') +
398
400
  (d.blockers && d.blockers.length ? ' | blockers: ' + d.blockers.join('; ') : '')
399
401
  }
402
+ // 每个 solver 默认只看自己方向(互不干扰):round>1 时带上自己的历史进度,
403
+ // directionsPerSolver>1 时再附带其他活跃方向摘要用于协调(总数不超过该参数)。
404
+ function buildSolverContext(all, own, round, perSolver) {
405
+ const out = []
406
+ const n = Math.max(1, Number(perSolver) || 1)
407
+ if (round > 1) out.push(own)
408
+ const others = all.filter(function (d) { return d.id !== own.id && d.status === 'active' })
409
+ for (let i = 0; i < others.length && out.length < n; i++) out.push(others[i])
410
+ return out.map(directionSummary).join('\n')
411
+ }
400
412
  function solverPrompt(q, dir, round, progressText) {
401
413
  let head = solverPersonaText() + 'You are a dedicated solver agent working ONE solution direction of a math problem (agent_self_iteration).\n\n'
402
414
  head += 'PROBLEM (id: ' + q.id + '): ' + q.概述 + '\nDIRECTION: ' + dir.title + ' (method: ' + dir.method + '; core assumption: ' + dir.core_assumption + ')\nROUND: ' + round + ' of ' + params.solverMaxRounds + '\n'
@@ -688,7 +700,7 @@ export function apply(ctx) {
688
700
  if (dir.status === 'success' || dir.status === 'dead-end') continue
689
701
  const running = Object.keys(agentRegistry).some(function (cid) { const m = agentRegistry[cid]; return m && m.qid === q.id && m.direction === dir.id && m.role === 'solver' })
690
702
  if (running) continue
691
- const progressText = prog.directions.map(directionSummary).join('\n')
703
+ const progressText = buildSolverContext(prog.directions, dir, 1, params.directionsPerSolver)
692
704
  const promptText = solverPrompt(q, dir, 1, progressText)
693
705
  const r = await maybeGate('spawn', 'solver for problem ' + q.id + ' direction ' + dir.id, { label: 'solver:' + q.id + ':' + dir.id, promptText: promptText, meta: { role: 'solver', qid: q.id, direction: dir.id, round: 1, description: q.概述 } }, async function (d) { await spawnChild(d.label, d.promptText, d.meta); return { spawned: true } })
694
706
  if (r && r.gated) return
@@ -743,7 +755,7 @@ export function apply(ctx) {
743
755
  delete agentRegistry[childId]
744
756
  logActivity('solver', qid + '/' + dirId + ' dead-end (success without solution)')
745
757
  } else {
746
- const progressText = prog.directions.map(directionSummary).join('\n')
758
+ const progressText = buildSolverContext(prog.directions, dir, meta.round + 1, params.directionsPerSolver)
747
759
  await followupChild(childId, solverPrompt(q, dir, meta.round + 1, progressText))
748
760
  agentRegistry[childId].round = meta.round + 1
749
761
  dir.round = meta.round + 1
@@ -755,7 +767,7 @@ export function apply(ctx) {
755
767
  delete agentRegistry[childId]
756
768
  logActivity('solver', qid + '/' + dirId + ' dead-end: ' + dir.dead_end_reason)
757
769
  } else {
758
- const progressText = prog.directions.map(directionSummary).join('\n')
770
+ const progressText = buildSolverContext(prog.directions, dir, meta.round + 1, params.directionsPerSolver)
759
771
  if (!scheduler.running) {
760
772
  // paused/aborted: stop the follow-up chain; keep the direction active for resume
761
773
  delete agentRegistry[childId]
@@ -1095,7 +1107,7 @@ export function apply(ctx) {
1095
1107
  registerTool('vibe_math_status', 'Show scheduler status, params, active agents, projects, and recent activity.', objParams({}), async function () { return await getStatus() })
1096
1108
  registerTool('vibe_math_report', 'Return the full progress report and write it to Progress_Logs/report.json.', objParams({}), async function () { await maybeWriteReport(true); return await buildReport() })
1097
1109
  registerTool('vibe_math_set_mode', 'Switch between manual and auto (preset) mode. Switching to auto auto-resolves any pending manual decisions.', objParams({ mode: { type: 'string', enum: ['manual', 'auto'] } }, ['mode']), async function (args) { params.mode = args.mode; await saveAll(); if (params.mode === 'auto') await autoResolvePending(); return { ok: true, mode: params.mode } })
1098
- registerTool('vibe_math_set_params', 'Update scheduler parameters (partial).', objParams({ maxParallelThreshold: { type: 'integer' }, solverMaxRounds: { type: 'integer' }, verifierCount: { type: 'integer' }, debateMaxRounds: { type: 'integer' }, verdictMode: { type: 'string', enum: ['flat', 'forced'] }, reportMode: { type: 'string', enum: ['file', 'push', 'both'] }, promoteValueThreshold: { type: 'number' }, priorityAdjust: { type: 'string', enum: ['none', 'deadend-deprioritize', 'survival-map'] }, proposPriorityAdjust: { type: 'string', enum: ['none', 'progress-graded'] }, provider: { type: 'string' }, model: { type: 'string' }, solverPersona: { type: 'string' }, verifierPersona: { type: 'string' }, solverToolAllow: { type: 'array', items: { type: 'string' } }, solverToolDeny: { type: 'array', items: { type: 'string' } }, verifierToolAllow: { type: 'array', items: { type: 'string' } }, verifierToolDeny: { type: 'array', items: { type: 'string' } }, solverMaxToolCalls: { type: 'integer' }, verifierMaxToolCalls: { type: 'integer' }, reportIntervalMs: { type: 'integer' }, tickIntervalMs: { type: 'integer' }, activityLogCap: { type: 'integer' }, maxExplorerRetries: { type: 'integer' } }), async function (args) { params = Object.assign({}, params, sanitizeParams(args)); await saveAll(); return { ok: true, params: params } })
1110
+ registerTool('vibe_math_set_params', 'Update scheduler parameters (partial).', objParams({ maxParallelThreshold: { type: 'integer' }, solverMaxRounds: { type: 'integer' }, verifierCount: { type: 'integer' }, debateMaxRounds: { type: 'integer' }, verdictMode: { type: 'string', enum: ['flat', 'forced'] }, reportMode: { type: 'string', enum: ['file', 'push', 'both'] }, promoteValueThreshold: { type: 'number' }, priorityAdjust: { type: 'string', enum: ['none', 'deadend-deprioritize', 'survival-map'] }, proposPriorityAdjust: { type: 'string', enum: ['none', 'progress-graded'] }, provider: { type: 'string' }, model: { type: 'string' }, solverPersona: { type: 'string' }, verifierPersona: { type: 'string' }, solverToolAllow: { type: 'array', items: { type: 'string' } }, solverToolDeny: { type: 'array', items: { type: 'string' } }, verifierToolAllow: { type: 'array', items: { type: 'string' } }, verifierToolDeny: { type: 'array', items: { type: 'string' } }, solverMaxToolCalls: { type: 'integer' }, verifierMaxToolCalls: { type: 'integer' }, reportIntervalMs: { type: 'integer' }, tickIntervalMs: { type: 'integer' }, activityLogCap: { type: 'integer' }, maxExplorerRetries: { type: 'integer' }, directionsPerSolver: { type: 'integer' } }), async function (args) { params = Object.assign({}, params, sanitizeParams(args)); await saveAll(); return { ok: true, params: params } })
1099
1111
  registerTool('vibe_math_setup', 'Return the interactive parameter schema for guided configuration.', objParams({}), async function () { const list = PARAM_SCHEMA.map(function (p) { const out = Object.assign({}, p); out.current = params[p.name]; out.default = DEFAULT_PARAMS[p.name]; return out }); return { ok: true, parameters: list, saveTo: frameworkRoot() + '/vibe_math_setting.json' } })
1100
1112
  registerTool('vibe_math_save_settings', 'Write the current params to vibe_math_setting.json (JSON with comments) as new defaults.', objParams({}), async function () { return await saveSettings() })
1101
1113
  registerTool('vibe_math_template', 'Create a fresh vibe_math_setting.json template (with defaults + comments) in the workspace (global) or current project folder.', objParams({ where: { type: 'string', enum: ['global', 'project'] } }), async function (args) { return await createTemplate((args && args.where) || 'global') })