dsh-vibe-math 2.0.7 → 2.0.8
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
|
@@ -97,7 +97,7 @@ dsh plugin --profile <你的 profile> add github:ChongCyrus/Vibe-Mathematics
|
|
|
97
97
|
|
|
98
98
|
- **形态依赖**:三个 preset 依赖 DSH 的标准 **agent-preset 机制**(`~/.dsh/.agent-presets/<id>/` + preset picker)与 **bundle patch 机制**(`cordis.patch.yml` 注入安装器)。
|
|
99
99
|
- **宿主插件行**:`agent.cordis.yml` 引用宿主提供的 `@deepseek-ai/dsh-*` 插件行(persona、agent-instructions、tool-bash/pwsh、tool-fs/fs-search、tool-jobs、skill-filesystem、tool-skill、tool-goal、plan-mode、compaction、subagent/workflow、ask-user、todo、web 等,约 21 个唯一包名)。宿主缺行会导致 preset 挂载失败(会话启动时报错)。
|
|
100
|
-
- **宿主服务 API**:预设插件消费 `subagents`(startContinuable / followup
|
|
100
|
+
- **宿主服务 API**:预设插件消费 `subagents`(startContinuable / **sendMessage**(续做/唤醒;`followup` 仅为 `Agent` 对象方法、**不是** `subagents` 服务方法)/ interrupt)、`agents`(roots)、`tools`(register)、`commands`(register)、`fs`(resolve/stat/readText/writeText/listDir)、可选 `subprocess` / `sandboxPolicy`。这些 API 形状随 DSH 版本演进;本项目**已充分测试并确认适配 `dsh-v0.1.2-rc.1`**(`package.json` 的 `dsh.testedVersion`;`minVersion` 为 `0.1.2-rc.1`)。**注意:DSH 0.1.2 起 `subagents.startContinuable` 的 `agentOptions` / `toolFilter` 需要宿主 provider 声明对应 capability**(spawn / fork 进程内 provider 均支持,v4 指定常驻模型/路由与工具权限依赖于此)。
|
|
101
101
|
- **DSH STORE 兼容声明**:`package.json` 的 `dsh.compatibility.dshReleases` 对每个完整 DSH 版本逐项声明 `compatible` / `incompatible` / `unknown`(当前 `0.1.2-alpha.4`、`0.1.2-alpha.5`、`0.1.2-rc.1` 均标 `compatible`);`engines.node` 为 `^22.19.0 || >=24.0.0`(与 DSH 0.1.2 相同)。
|
|
102
102
|
- **运行时自检(能力 + 版本双检)**:安装器(bundle 插件)每次启动时:**① 尽力探测 DSH 版本**(读 `@deepseek-ai/dsh/package.json` 或 `DSH_VERSION` 环境变量;DSH 未通过公开 service/context 暴露版本,故为尽力而为,探测不到就跳过)。若探测到且该版本未被 `dshReleases` 声明为 `compatible`,会给出明确"DSH 版本不匹配,请使用 `dsh-v0.1.2-rc.1`(或 `0.1.2-alpha.4/alpha.5`)"提示;**② 再对上述服务与关键 API 做能力自检**(这是真正的挂载门槛,含 `fs.resolve` 返回形状检测与 subagent `agentOptions`/`toolFilter` capability 检测),不满足时打 warning。preset 挂载失败时先看 DSH 日志里的自检 warning。
|
|
103
103
|
- **升级路径**:DSH 升级后无需重装本包;升级本包用 `dsh plugin update dsh-vibe-math`,重启 DSH 后安装器会自动把 preset 更新到新版本(见上文「安装」说明)。
|
package/installer.js
CHANGED
|
@@ -113,7 +113,9 @@ async function checkHostCapabilities(ctx, logger) {
|
|
|
113
113
|
// 2) capability self-check (the authoritative mounting gate; also covers hosts whose version
|
|
114
114
|
// could not be read). subagents / agents / tools / commands / fs shapes + v4 capabilities.
|
|
115
115
|
const checks = [
|
|
116
|
-
|
|
116
|
+
// subagents 服务的续做/唤醒方法是 sendMessage(sender, targetId, content, {signal});
|
|
117
|
+
// followup 不是 subagents 服务的方法(它只是 Agent 对象方法)。同时探测两者,能用一个即可。
|
|
118
|
+
['subagents', ['startContinuable', 'interrupt']],
|
|
117
119
|
['agents', ['roots']],
|
|
118
120
|
['tools', ['register']],
|
|
119
121
|
['commands', ['register']],
|
|
@@ -128,6 +130,10 @@ async function checkHostCapabilities(ctx, logger) {
|
|
|
128
130
|
for (let j = 0; j < methods.length; j++) {
|
|
129
131
|
if (typeof s[methods[j]] !== 'function') problems.push(svc + '.' + methods[j] + ' 不可用(宿主版本可能过旧)')
|
|
130
132
|
}
|
|
133
|
+
// subagents continuation (wake) API: sendMessage (modern) OR followup (legacy) must exist.
|
|
134
|
+
if (svc === 'subagents' && typeof s.sendMessage !== 'function' && typeof s.followup !== 'function') {
|
|
135
|
+
problems.push('subagents 缺少续做/唤醒方法(需 sendMessage 或 followup 至少其一)')
|
|
136
|
+
}
|
|
131
137
|
}
|
|
132
138
|
// fs API shape: DSH 0.1.1 起 resolve 返回 {targetKey, displayPath} 对象(旧版返回字符串路径)
|
|
133
139
|
try {
|
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 — THREE agent presets in one install: vibe-math-v2 (probability-driven: qs.json + Propos knowledge base + explorer→solver→review/debate verdict), vibe-math-v3 (THIRD-generation, recommended: 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). Installing this bundle auto-installs all three presets (v1 was removed at v2.0.0).",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.8",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": "^22.19.0 || >=24.0.0"
|
|
@@ -444,7 +444,19 @@ export function apply(ctx) {
|
|
|
444
444
|
scheduler.activeCount = Math.max(0, scheduler.activeCount) + 1
|
|
445
445
|
await saveAll(); return started.childId
|
|
446
446
|
}
|
|
447
|
-
|
|
447
|
+
// DSH continuable-wake API is subagents.sendMessage(sender, targetId, content, {signal}); subagents.followup
|
|
448
|
+
// does NOT exist on the subagents service (it is only Agent.followup). Calling the missing method threw
|
|
449
|
+
// TypeError and made every wake fail silently. Prefer sendMessage, fall back to a legacy followup.
|
|
450
|
+
async function followupChild(childId, promptText) {
|
|
451
|
+
const blocks = [textBlock(promptText)]
|
|
452
|
+
try {
|
|
453
|
+
if (typeof subagents.sendMessage === 'function') await subagents.sendMessage(rootAgent, childId, blocks, { signal: makeSignal(30000) })
|
|
454
|
+
else if (typeof subagents.followup === 'function') await subagents.followup(rootAgent, childId, blocks, { source: { kind: 'user' }, signal: makeSignal(30000) })
|
|
455
|
+
else throw new Error('no subagent continuation API')
|
|
456
|
+
} catch (e) { console.error('vibe-math-v2: wake ' + childId + ' failed: ' + String((e && e.message) || e)); throw e }
|
|
457
|
+
scheduler.activeCount = Math.max(0, scheduler.activeCount) + 1
|
|
458
|
+
await saveAll()
|
|
459
|
+
}
|
|
448
460
|
async function interruptChild(childId) { try { subagents.interrupt(childId, { kind: 'ancestor', agent: rootAgent }) } catch (e) {} }
|
|
449
461
|
|
|
450
462
|
// ================= prompts =================
|
|
@@ -888,7 +888,19 @@ export function apply(ctx) {
|
|
|
888
888
|
await saveAll()
|
|
889
889
|
return started.childId
|
|
890
890
|
}
|
|
891
|
-
|
|
891
|
+
// DSH continuable-wake API is subagents.sendMessage(sender, targetId, content, {signal}); subagents.followup
|
|
892
|
+
// does NOT exist on the subagents service (it is only Agent.followup). Calling the missing method threw
|
|
893
|
+
// TypeError and made every wake fail silently. Prefer sendMessage, fall back to a legacy followup.
|
|
894
|
+
async function followupChild(childId, promptText) {
|
|
895
|
+
const blocks = [textBlock(promptText)]
|
|
896
|
+
try {
|
|
897
|
+
if (typeof subagents.sendMessage === 'function') await subagents.sendMessage(rootAgent, childId, blocks, { signal: makeSignal(30000) })
|
|
898
|
+
else if (typeof subagents.followup === 'function') await subagents.followup(rootAgent, childId, blocks, { source: { kind: 'user' }, signal: makeSignal(30000) })
|
|
899
|
+
else throw new Error('no subagent continuation API')
|
|
900
|
+
} catch (e) { console.error('vibe-math-v3: wake ' + childId + ' failed: ' + String((e && e.message) || e)); throw e }
|
|
901
|
+
scheduler.activeCount = Math.max(0, scheduler.activeCount) + 1
|
|
902
|
+
await saveAll()
|
|
903
|
+
}
|
|
892
904
|
async function interruptChild(childId) { try { subagents.interrupt(childId, { kind: 'ancestor', agent: rootAgent }) } catch (e) {} }
|
|
893
905
|
|
|
894
906
|
// ================= prompts =================
|
|
@@ -280,7 +280,21 @@ export function apply(ctx) {
|
|
|
280
280
|
prompt = coreRulesBrief() + '\n' + prompt
|
|
281
281
|
r.needCompact = false
|
|
282
282
|
}
|
|
283
|
-
|
|
283
|
+
// The DSH continuable-wake API is subagents.sendMessage(sender, targetId, content, {signal}),
|
|
284
|
+
// NOT subagents.followup (which is only Agent.followup, and does NOT exist on the subagents
|
|
285
|
+
// service). Using a non-existent method threw TypeError and made EVERY wake fail silently →
|
|
286
|
+
// the group went idle forever. Prefer sendMessage; fall back to a legacy followup if a host
|
|
287
|
+
// still exposes it (older deployments), so this works across versions.
|
|
288
|
+
try {
|
|
289
|
+
if(typeof subagents.sendMessage==='function'){
|
|
290
|
+
await subagents.sendMessage(rootAgent, r.childId, [textBlock(prompt)], {signal: makeSignal(params.activityTimeoutMs||60000)})
|
|
291
|
+
} else if(typeof subagents.followup==='function'){
|
|
292
|
+
await subagents.followup(rootAgent, r.childId, [textBlock(prompt)], {source:{kind:'user'},signal:makeSignal(params.activityTimeoutMs||60000)})
|
|
293
|
+
} else {
|
|
294
|
+
throw new Error('no subagent continuation API (need sendMessage or followup)')
|
|
295
|
+
}
|
|
296
|
+
return true
|
|
297
|
+
}
|
|
284
298
|
catch(e){ console.error('vibe-v4 wake '+r.rId+' failed: '+String((e&&e.message)||e)); busy.delete(r.rId); return false }
|
|
285
299
|
}
|
|
286
300
|
function byChild(childId){ for(const [,r] of residents){ if(r.childId===childId) return r } return undefined }
|
|
@@ -596,6 +610,13 @@ export function apply(ctx) {
|
|
|
596
610
|
async function onResidentEnd(childId, info){
|
|
597
611
|
const r=byChild(childId); if(!r) return
|
|
598
612
|
busy.delete(r.rId)
|
|
613
|
+
// Any resident turn that COMPLETED is real activity for the stall clock (B). Residents frequently
|
|
614
|
+
// write their libraries via direct fs (not the record* tools), so relying only on
|
|
615
|
+
// bumpArtifacts/markProgress would leave lastProgressAt stale and B would fire against an active
|
|
616
|
+
// team. We count only a clean 'completed' turn: an error/max-tokens/refusal did NOT meaningfully
|
|
617
|
+
// advance the work, so it must NOT mask a truly stalled group (B can then convene a recovery
|
|
618
|
+
// meeting). A completed turn also refreshes the meeting/verify deadlock clock through lastInputAt.
|
|
619
|
+
if(info && info.stopReason==='completed') markProgress()
|
|
599
620
|
realCompact(r).catch(()=>{}) // best-effort real DSH /compact of this resident while idle
|
|
600
621
|
const output=blocksToText(info&&info.lastAssistantMessage)
|
|
601
622
|
const parsed=parseReply(output)
|
|
@@ -88,7 +88,7 @@ flowchart TD
|
|
|
88
88
|
### 4.1 本质
|
|
89
89
|
- 每个常驻 = 一个 DSH **continuable 子代理**:`subagents.startContinuable({ parent: 会话根代理, request, agentOptions, toolFilter })`。
|
|
90
90
|
- **持久上下文**(continuable):跨多次唤醒记住前文,直到被 `/compact` 压缩。
|
|
91
|
-
- **唤醒** = `subagents.
|
|
91
|
+
- **唤醒** = `subagents.sendMessage(root, <childId>, [textBlock(prompt)], {signal})`(DSH 的 `subagents` 服务没有 `followup` 方法——`followup` 只是 `Agent` 对象的方法;`sendMessage` 才是服务暴露的续做 API。旧代码 `subagents.followup(...)` 在真实运行时抛 `TypeError`,导致每次唤醒都失败、小组整体停摆);一轮收益 = 该常驻提交一次完整思考(经 `ctx.on('subagent/end')` 回归,`stateOf`=settled 时 `watchSettlement` 每次 dispose 都会重新触发一次 `/end`)。
|
|
92
92
|
- **工具**:`tools.register` 对会话内所有代理可用(处理器按 `exec.agent` 路由),故常驻可直接用 `fs` + `vibe_v4_*` 工具(写自己的库、读他人的库、发消息、提会议、记命题、发起验证)。
|
|
93
93
|
|
|
94
94
|
### 4.2 身份与上下文
|
|
@@ -117,7 +117,7 @@ VibeMath/Projects/<project>/
|
|
|
117
117
|
| 能力 | 机制 | 关键点 |
|
|
118
118
|
|---|---|---|
|
|
119
119
|
| **常驻生命周期** | start 时 brainstorm→spawn N(各带初始方向);add/remove;resume 重建 | 常驻上下文断点后需 re-spawn 并用其 `progress.md` 重种化 |
|
|
120
|
-
| **消息总线** | `vibe_v4_send_message(to, content)` → 入目标邮件箱 → 若空闲则 `
|
|
120
|
+
| **消息总线** | `vibe_v4_send_message(to, content)` → 入目标邮件箱 → 若空闲则 `sendMessage` 唤醒 | 常驻间不直接互调,全靠框架 relay(模拟收件箱);支持 `broadcast(all)` |
|
|
121
121
|
| **会议** | `vibe_v4_meeting(agenda)` → 向全体发会议 prompt → 收齐发言 → 写 `Shared/meetings/<id>.md` → 广播结论 | 会议用于分工/方向/任务分配/提出验证/表决"是否已解决" |
|
|
122
122
|
| **任务板** | 常驻在会议/留言提议任务 → 框架记 `Shared/taskboard.md`;认领后被唤醒 | 框架只搬运,不决定谁做什么 |
|
|
123
123
|
| **产物沉淀** | `vibe_v4_publish_progress` / `record_proposition` / `record_method` / `record_subproblem` | **必填**:价值程度 / 动机用途计划 / 自身概率估计(框架校验,缺则提示) |
|
|
@@ -254,7 +254,7 @@ VibeMath/Projects/<project>/
|
|
|
254
254
|
| DSH 能力 | 在本架构中的用途 |
|
|
255
255
|
|---|---|
|
|
256
256
|
| `subagents.startContinuable({parent, request, agentOptions, toolFilter})` | 产生常驻(continuable,持久上下文) |
|
|
257
|
-
| `subagents.
|
|
257
|
+
| `subagents.sendMessage(root, childId, blocks, {signal})` | 唤醒常驻做一轮 / 投递一条留言 / 开会向某常驻收集发言(**服务暴露的续做 API**;旧 `subagents.followup` 不存在) |
|
|
258
258
|
| `ctx.on('subagent/end')` | 一常驻完成一轮(收其回复,续驱动) |
|
|
259
259
|
| `subagents.interrupt / list` | 中断 / 枚举常驻 |
|
|
260
260
|
| `tools.register`(会话内所有代理可用,`exec.agent` 路由) | 常驻可直接调用 `vibe_v4_*` 与 `fs` |
|
|
@@ -521,7 +521,8 @@ VibeMath/Projects/<project>/
|
|
|
521
521
|
|
|
522
522
|
针对一次真实 run("跑完就停")的诊断:三名常驻第一轮就把问题归约到**同一个硬核引理**并一致给出 `solved=false`——这是**自然的难点停滞**,而非 bug。但框架的活性机制太弱且会"死":
|
|
523
523
|
- 空闲后唯一驱动是心跳(`activityTimeoutMs` 唤醒一个常驻、CHECKPOINT 提示词偏向"是否要停止"),**缺乏推进力**;
|
|
524
|
-
- **唤醒失败会永久停死**(`scheduleNext` 在心跳分支 `await wakeResident(...)` 后无条件 `return`,而 `wakeResident` 捕获异常后返回 false 但**不重新武装心跳**)→
|
|
524
|
+
- **唤醒失败会永久停死**(`scheduleNext` 在心跳分支 `await wakeResident(...)` 后无条件 `return`,而 `wakeResident` 捕获异常后返回 false 但**不重新武装心跳**)→ 一旦某次唤醒抛异常,心跳不再武装,小组**永不再被唤醒**;
|
|
525
|
+
- **唤醒 API 用错**(历史根因):代码曾调 `subagents.followup(...)`,但 DSH 的 `subagents` 服务**没有** `followup`(那只是 `Agent` 对象的方法),真实运行时每次唤醒抛 `TypeError: is not a function` → 被 catch 后所有后续唤醒全部失败。**已改为** `subagents.sendMessage(root, childId, blocks, {signal})`(服务暴露的续做 API),并保留 `followup` 作为旧宿主兜底。
|
|
525
526
|
- `session.json` 不持久化 `meetingState`(进行中会议只在进程内存),进程重启或会议唤醒失败都可能让会议悬停。
|
|
526
527
|
|
|
527
528
|
### A · 自驱动心跳(修复推进力 + 永不永久停死)
|