dsh-vibe-math 0.3.14 → 0.3.16

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
@@ -333,7 +333,7 @@ dsh plugin --profile <你的 profile> add github:ChongCyrus/Vibe-Mathematics
333
333
  | `mode` | `auto` | `auto` / `manual` |
334
334
  | `maxParallelThreshold` | 4 | 全局最大并发子代理轮数(新派发前须 active < 阈值) |
335
335
  | `solverMaxRounds` | 3 | 每个求解方向最大迭代轮数(agent_self_iteration 上限) |
336
- | `directionsPerSolver` | 1 | 每个 solver 提示词附带的方向数量(1 = 只看自己方向、互不干扰;>1 = 附带其他活跃方向摘要用于协调) |
336
+ | `directionsPerSolver` | 1 | 每个 solver 提示词可见的方向总数(1 = 只看自己方向、互不干扰;N>1 = 自己 + 最多 N-1 个其他活跃方向摘要) |
337
337
  | `verifierCount` | 3 | 每个验证对象的独立验证器数量 |
338
338
  | `debateMaxRounds` | 5 | 验证辩论(交流群)最大轮数 |
339
339
  | `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.14",
4
+ "version": "0.3.16",
5
5
  "type": "module",
6
6
  "main": "installer.js",
7
7
  "exports": {
@@ -233,6 +233,12 @@ export function apply(ctx) {
233
233
  // ================= persistence =================
234
234
  async function loadState() { const s = await readJson('VibeMath_State/scheduler_state.json'); if (s) scheduler = Object.assign({}, scheduler, s); const r = await readJson('VibeMath_State/agent_registry.json'); if (r) agentRegistry = r; const d = await readJson('VibeMath_State/dependencies.json'); if (d) dependencies = d; const dq = await readJson('VibeMath_State/decision_queue.json'); if (dq) decisionQueue = dq; const tk = await readJson('VibeMath_State/tasks.json'); if (tk) tasks = tk; const sv = await readJson('VibeMath_State/solved_by_verified.json'); if (sv) solvedByVerified = sv; const pq = await readJson('VibeMath_State/promotion_queue.json'); if (pq) promotionQueue = pq; const va = await readJson('VibeMath_State/verifier_accuracy.json'); if (va) verifierAccuracy = va }
235
235
  async function saveAll() { await writeJson('VibeMath_State/scheduler_state.json', scheduler); await writeJson('VibeMath_State/agent_registry.json', agentRegistry); await writeJson('VibeMath_State/dependencies.json', dependencies); await writeJson('VibeMath_State/decision_queue.json', decisionQueue); await writeJson('VibeMath_State/tasks.json', tasks); await writeJson('VibeMath_State/solved_by_verified.json', solvedByVerified); await writeJson('VibeMath_State/promotion_queue.json', promotionQueue); await writeJson('VibeMath_State/verifier_accuracy.json', verifierAccuracy); scheduler.lastCheckpoint = now() }
236
+ // 查询类工具(status/setup/report)汇报前重读设置文件:文件是唯一持久化源,可能在会话启动后被用户手改或由本进程外编辑更新。
237
+ async function refreshParams() {
238
+ params = Object.assign({}, DEFAULT_PARAMS)
239
+ await loadSettings()
240
+ await migrateLegacyParams()
241
+ }
236
242
  // 一次性迁移(单文件化):旧版 params.json 合并进 vibe_math_setting.json 后删除。
237
243
  async function migrateLegacyParams() {
238
244
  const legacy = await readJson('VibeMath_State/params.json')
@@ -518,11 +524,11 @@ export function apply(ctx) {
518
524
  registerTool('vibe_math_resume', 'Resume the scheduler after a checkpoint/restart.', objParams({}), async function (args, agent) { return await resumeScheduler(agent) })
519
525
  registerTool('vibe_math_pause', 'Pause the scheduler (in-flight children finish their current turn).', objParams({}), async function () { return await pauseScheduler() })
520
526
  registerTool('vibe_math_abort', 'Abort the scheduler and interrupt all active children.', objParams({}), async function () { return await abortScheduler() })
521
- registerTool('vibe_math_status', 'Show scheduler status, params, active agents, projects, and recent activity.', objParams({}), async function () { return await getStatus() })
522
- registerTool('vibe_math_report', 'Return the full progress report (status + recent activity + params) and write it to Progress_Logs/report.json.', objParams({}), async function () { await maybeWriteReport(true); return buildReport() })
527
+ registerTool('vibe_math_status', 'Show scheduler status, params, active agents, projects, and recent activity.', objParams({}), async function () { await refreshParams(); return await getStatus() })
528
+ registerTool('vibe_math_report', 'Return the full progress report (status + recent activity + params) and write it to Progress_Logs/report.json.', objParams({}), async function () { await refreshParams(); await maybeWriteReport(true); return buildReport() })
523
529
  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(); await saveSettings(); if (params.mode === 'auto') await autoResolvePending(); return { ok: true, mode: params.mode } })
524
530
  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: ['direct-veto', 'weighted-vote'] }, 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' } }), async function (args) { params = Object.assign({}, params, args); await saveAll(); await saveSettings(); return { ok: true, params: params } })
525
- registerTool('vibe_math_setup', 'Return the interactive parameter schema (each param: name, type, current, default, description, options, suggestion) 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' } })
531
+ registerTool('vibe_math_setup', 'Return the interactive parameter schema (each param: name, type, current, default, description, options, suggestion) for guided configuration.', objParams({}), async function () { await refreshParams(); 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' } })
526
532
  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() })
527
533
  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') })
528
534
  registerTool('vibe_math_add_problem', 'Add a problem to the current project qs.csv.', objParams({ id: { type: 'string' }, description: { type: 'string' }, priority: { type: 'integer' } }, ['id', 'description']), async function (args) { const qs = await getQs(); if (qs.some(function (q) { return q.id === args.id })) return { ok: false, message: 'problem id already exists' }; qs.push({ id: args.id, description: args.description, priority: args.priority || 0, status: 'unsolved', deps: [] }); await writeQs(qs); scheduleTick(); return { ok: true, message: 'problem added' } })
@@ -541,10 +547,10 @@ export function apply(ctx) {
541
547
  if (cmd === 'resume') return await resumeScheduler(agent)
542
548
  if (cmd === 'pause') return await pauseScheduler()
543
549
  if (cmd === 'abort') return await abortScheduler()
544
- if (cmd === 'status') return await getStatus()
545
- if (cmd === 'report') { await maybeWriteReport(true); return buildReport() }
550
+ if (cmd === 'status') { await refreshParams(); return await getStatus() }
551
+ if (cmd === 'report') { await refreshParams(); await maybeWriteReport(true); return buildReport() }
546
552
  if (cmd === 'mode') { params.mode = (args[0] === 'manual') ? 'manual' : 'auto'; await saveAll(); await saveSettings(); if (params.mode === 'auto') await autoResolvePending(); return { ok: true, mode: params.mode } }
547
- if (cmd === 'setup') { 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' } }
553
+ if (cmd === 'setup') { await refreshParams(); 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' } }
548
554
  if (cmd === 'save') return await saveSettings()
549
555
  if (cmd === 'template') return await createTemplate(args[0] === 'project' ? 'project' : 'global')
550
556
  if (cmd === 'add') { const id = args[0]; const desc = args.slice(1).join(' '); if (!id || !desc) return { ok: false, message: 'usage: /vibe add <id> <description>' }; const qs = await getQs(); if (qs.some(function (q) { return q.id === id })) return { ok: false, message: 'problem id already exists' }; qs.push({ id: id, description: desc, priority: 0, status: 'unsolved', deps: [] }); await writeQs(qs); scheduleTick(); return { ok: true, message: 'problem added' } }
@@ -126,7 +126,7 @@ export function apply(ctx) {
126
126
  { name: 'mode', type: 'enum', options: ['auto', 'manual'], description: 'auto = 无人值守自动通过关键节点;manual = 关键节点挂起人工决策', suggestion: 'auto' },
127
127
  { name: 'maxParallelThreshold', type: 'integer', description: '全局最大并发子代理轮数(新派发前须满足 active < 阈值)', suggestion: 4 },
128
128
  { name: 'solverMaxRounds', type: 'integer', description: '每个求解方向的最大迭代轮数(agent_self_iteration 上限)', suggestion: 3 },
129
- { name: 'directionsPerSolver', type: 'integer', description: '每个 solver 提示词附带的方向数量:1 = 只看自己方向(互不干扰);>1 = 额外附带其他活跃方向摘要用于协调', suggestion: 1 },
129
+ { name: 'directionsPerSolver', type: 'integer', description: '每个 solver 提示词附带的其他活跃方向摘要数量:1 = 只看自己方向(互不干扰);N>1 = 额外附带最多 N 个其他活跃方向摘要用于协调', suggestion: 1 },
130
130
  { name: 'verifierCount', type: 'integer', description: '每个验证对象的独立验证器数量', suggestion: 3 },
131
131
  { name: 'debateMaxRounds', type: 'integer', description: '验证辩论(交流群)最大轮数', suggestion: 5 },
132
132
  { name: 'verdictMode', type: 'enum', options: ['flat', 'forced'], description: 'flat = 均衡机制(不一致直接判 0.5);forced = 强制裁决(按历史准确率+严谨性加权)', suggestion: 'flat' },
@@ -250,6 +250,12 @@ export function apply(ctx) {
250
250
  await writeJson('VibeMath_State/explorer_retries.json', explorerRetries)
251
251
  scheduler.lastCheckpoint = now()
252
252
  }
253
+ // 查询类工具(status/setup/report)汇报前重读设置文件:文件是唯一持久化源,可能在会话启动后被用户手改或由本进程外编辑更新。
254
+ async function refreshParams() {
255
+ params = Object.assign({}, DEFAULT_PARAMS)
256
+ await loadSettings()
257
+ await migrateLegacyParams()
258
+ }
253
259
  // 一次性迁移(单文件化):旧版 VibeMath_State/params.json 中的运行时参数合并进 vibe_math_setting.json 后删除。
254
260
  async function migrateLegacyParams() {
255
261
  const legacy = await readJson('VibeMath_State/params.json')
@@ -268,9 +274,18 @@ export function apply(ctx) {
268
274
  async function writeQs(list) { await writeJson('qs/qs.json', list) }
269
275
  async function findQ(qid) { const qs = await getQs(); return qs.find(function (q) { return q.id === qid }) }
270
276
 
271
- // progress is a JSON string inside the problem object
272
- function parseProgress(q) { const p = safeJson((q && q.progress) || '', null); if (p && typeof p === 'object') return p; return { directions: [], experience: '' } }
273
- async function saveProgress(qid, progObj) { const qs = await getQs(); const q = qs.find(function (x) { return x.id === qid }); if (!q) return; q.progress = JSON.stringify(progObj); await writeQs(qs) }
277
+ // progress:结构化 JSON 对象(旧数据可能是 JSON 字符串,两者兼容解析)。
278
+ // 注意:必须保证返回对象含 directions 数组(晋升/判断/子问题等 progress 可能只有来源/说明等字段)。
279
+ function parseProgress(q) {
280
+ const raw = (q && q.progress) || null
281
+ let p = null
282
+ if (raw && typeof raw === 'object' && !Array.isArray(raw)) p = raw
283
+ else p = safeJson(raw, null)
284
+ if (!p || typeof p !== 'object' || Array.isArray(p)) return { directions: [], experience: '' }
285
+ if (!Array.isArray(p.directions)) p.directions = []
286
+ return p
287
+ }
288
+ async function saveProgress(qid, progObj) { const qs = await getQs(); const q = qs.find(function (x) { return x.id === qid }); if (!q) return; q.progress = progObj; await writeQs(qs) }
274
289
 
275
290
  // ================= data layer: Propos =================
276
291
  function categoryOf(p) { const t = (p && p.细类型) || {}; const keys = Object.keys(t); return (keys.length > 0 && typeof t[keys[0]] === 'object') ? keys[0] : '未分类' }
@@ -405,6 +420,7 @@ export function apply(ctx) {
405
420
  '- Verification_logs/:辩论记录。Progress_Logs/:进度与报告。VibeMath_State/:调度器私有状态——不要读也不要改。\n' +
406
421
  '\n4) OUTPUT REQUIREMENTS (你输出的每个对象必须满足):\n' +
407
422
  '- 完整性、不断章取义:任何你写出的问题/命题/结论都要给出完整陈述,并把它所依赖的对象、环境、背景、定义全部补全(例如提到某个序列/函数/定理时给出其完整定义与假设)。\n' +
423
+ '- 引用溯源:若你引用了 qs/qs.json、Propos/、Verified/、Reliable/ 中已有的命题/引理/结论/解法,必须给出出处——具体文件路径(相对项目根,如 Propos/数论_Propos.json 或 Verified/未分类_Verified.json)+ 对象 id 或 JSON 路径(如 .证明列表[0] 或 .directions[1]);没有出处的引用一律不允许。你自己新提出的结论则必须自带完整定义,不得引用未定义的内容。\n' +
408
424
  '- 若结论依赖某个临时假设 p,必须显式写成「若 <p 的完整陈述> 成立,则:...」(同样要定义完整)。\n' +
409
425
  '- 只输出规定的 JSON(放在 ```json 代码围栏内),JSON 之外不写任何内容。\n' +
410
426
  '- 示例(完整问题 概述):"设 {a_n} 为非负实数序列(n≥1),满足:对任意正整数 n 都存在 i,j 使 |a_i − a_j| = 1/n^p(p>0 为实参数)。判断:p 在什么范围内保证级数 ∑_{n=1}^∞ a_n 发散?" —— 每个记号(序列、参数、级数)都在句内定义完整,读它的人无需再查背景。\n' +
@@ -465,14 +481,17 @@ export function apply(ctx) {
465
481
  (d.lessons && d.lessons.length ? ' | lessons: ' + d.lessons.join('; ') : '') +
466
482
  (d.blockers && d.blockers.length ? ' | blockers: ' + d.blockers.join('; ') : '')
467
483
  }
468
- // 每个 solver 默认只看自己方向(互不干扰):round>1 时带上自己的历史进度,
469
- // directionsPerSolver>1 时再附带其他活跃方向摘要用于协调(总数不超过该参数)。
484
+ // 每个 solver 可见的方向总数 = directionsPerSolver(默认 1 = 只看自己方向,互不干扰)。
485
+ // round 1 时自己的方向由 DIRECTION 行给出、占用 1 个名额;round>1 时自己的历史进度摘要占用 1 个名额;
486
+ // 其余名额填充其他活跃方向摘要(n=3 → 自己 + 最多 2 个其他方向)。
470
487
  function buildSolverContext(all, own, round, perSolver) {
471
488
  const out = []
472
489
  const n = Math.max(1, Number(perSolver) || 1)
473
- if (round > 1) out.push(own)
490
+ let slots = n
491
+ if (round > 1) { out.push(own); slots -= 1 }
492
+ else slots -= 1 // round 1:自己的方向已由 DIRECTION 行给出
474
493
  const others = all.filter(function (d) { return d.id !== own.id && d.status === 'active' })
475
- for (let i = 0; i < others.length && out.length < n; i++) out.push(others[i])
494
+ for (let i = 0; i < others.length && slots > 0; i++) { out.push(others[i]); slots -= 1 }
476
495
  return out.map(directionSummary).join('\n')
477
496
  }
478
497
  function solverPrompt(q, dir, round, progressText) {
@@ -488,7 +507,7 @@ export function apply(ctx) {
488
507
  '- an updated survival probability for this direction.\n'
489
508
  head += '\nIf you encounter an EXTREMELY complex auxiliary conjecture/sub-problem q_sub: list it in "sub_questions" as a PROBLEM-class object with its COMPLETE statement (every object/definition/notation it mentions must be fully defined — never quote partially, 不断章取义), together with p_{q-tmp}: a PROPOSITION-class TEMPORARY ASSUMPTION that is one possible answer to q_sub. TEMPORARILY ASSUME p_{q-tmp} holds and continue the main line — every later proposition/conclusion that depends on this assumption MUST be stated as "若 <p_{q-tmp} 的完整陈述> 成立,则:..." (with complete definitions). The scheduler registers q_sub and the problem "判断下述命题是否成立:p_{q-tmp}" in the problem list, and p_{q-tmp} in the proposition base.\n'
490
509
  head += '\nIMPORTANT — PROBABILITY RULES FOR NEW RESULTS: any 布尔估计 / solution_probability / survival_probability you output for NEW results must be strictly BETWEEN 0 and 1 (they await independent verifier confirmation). NEVER mark your own fresh lemma or solution as 1 or 0 — that is the verifiers\' job. Only facts already recorded in Verified/ (or 正确概率=1 entries you READ from files) count as certain.\n'
491
- head += '- Each lemma you output must carry a COMPLETE statement ("statement") and a COMPLETE proof ("proof"): define every object/notation it uses — no 断章取义, no undefined symbols.\n'
510
+ head += '- Each lemma you output must carry a COMPLETE statement ("statement") and a COMPLETE proof ("proof"): define every object/notation it uses — no 断章取义, no undefined symbols. If a lemma/conclusion references or is derived from existing knowledge (Propos/Verified/Reliable/qs files), state the source file path + object id / JSON path inside the statement — no unsourced references.\n'
492
511
  head += '\nIf you obtain a COMPLETE solution: adversarially self-check (construct counterexamples, test boundary conditions) BEFORE declaring success; put the full solution text in "solution".\n'
493
512
  head += '\nRespond with ONLY a single JSON object wrapped in a ```json code fence — no prose and no braces { } outside the JSON:\n' +
494
513
  '{"status":"continue|success|dead-end","solution":"complete solution text, or null","solution_probability":0.85,"lemmas":[{"title":"...","statement":"...","proof":"...","细类型":{"分类名":{}},"布尔估计":0.6,"价值/关键性":0.5,"优先级":1}],"routes":[{"title":"...","progress":"...","feasibility_signal":"...","blocker":"..."}],"lessons":["..."],"survival_probability":0.5,"dead_end_reason":"... or null","sub_questions":[{"q_sub_title":"...","q_sub_statement":"完整问题陈述(含所有对象/定义)","assumption_title":"p_{q-tmp} 标题","assumption_statement":"完整假设陈述(含所有定义)"}]}'
@@ -601,11 +620,12 @@ export function apply(ctx) {
601
620
  if ((p.布尔估计 === 1 || p.布尔估计 === 0) && p.优先级 !== 'never') { p.优先级 = 'never'; pChanged = true }
602
621
  if (p.布尔估计 === 1 || p.布尔估计 === 0) {
603
622
  if (await writeVerifiedCardIfNeeded(p)) pChanged = true
604
- // 源命题已定论 → 关闭其晋升出的"僵尸"问题(避免永远未解决)
605
- const srcMarker = '由命题 ' + p.id + '('
623
+ // 源命题已定论 → 关闭其晋升出的"僵尸"问题(优先用 判断命题 字段;兼容旧文本标记数据)
606
624
  for (let j = 0; j < qs.length; j++) {
607
625
  const qj = qs[j]
608
- if (!qj.已解决 && String(qj.progress || '').indexOf(srcMarker) !== -1) { qj.已解决 = true; qj.优先级 = 'never'; closedPromoted = true }
626
+ if (qj.已解决) continue
627
+ if (qj.判断命题 === p.id) { qj.已解决 = true; qj.优先级 = 'never'; closedPromoted = true }
628
+ else if (String((qj.progress && typeof qj.progress === 'object' ? (qj.progress.来源命题 || '') : qj.progress) || '').indexOf(p.id) !== -1) { qj.已解决 = true; qj.优先级 = 'never'; closedPromoted = true }
609
629
  }
610
630
  }
611
631
  if (pChanged) await upsertProposition(p)
@@ -674,7 +694,7 @@ export function apply(ctx) {
674
694
  const proofs = p.证明列表 || []; const refutes = p.证伪列表 || []
675
695
  for (let j = 0; j < proofs.length; j++) { const it = proofs[j]; sols.push({ 完整解法: '【证明】' + (it.完整过程 || ''), 正确概率: clamp01(it.正确概率 != null ? it.正确概率 : 0.5), 已验: !!it.已验, 来源: '由命题晋升(证明#' + j + ')', 来源命题: p.id, 来源列表: '证明', 来源索引: j, 验证记录: [] }) }
676
696
  for (let j = 0; j < refutes.length; j++) { const it = refutes[j]; sols.push({ 完整解法: '【证伪】' + (it.完整过程 || ''), 正确概率: clamp01(it.正确概率 != null ? it.正确概率 : 0.5), 已验: !!it.已验, 来源: '由命题晋升(证伪#' + j + ')', 来源命题: p.id, 来源列表: '证伪', 来源索引: j, 验证记录: [] }) }
677
- qs.push({ id: qid, 概述: '判断下述命题是否成立:' + p.概述, 已解决: false, 解法列表: sols, 优先级: 1, 判断命题: p.id, 细类型: (p.细类型 && typeof p.细类型 === 'object') ? p.细类型 : {}, '价值/关键性': p['价值/关键性'], progress: '由命题 ' + p.id + '(价值/关键性=' + p['价值/关键性'] + ')自动晋升;目标:证明或证伪该命题(解法列表中的【证明】/【证伪】条目即原命题的证明/证伪材料,验证结果会回写源命题)。' })
697
+ qs.push({ id: qid, 概述: '判断下述命题是否成立:' + p.概述, 已解决: false, 解法列表: sols, 优先级: 1, 判断命题: p.id, 细类型: (p.细类型 && typeof p.细类型 === 'object') ? p.细类型 : {}, '价值/关键性': p['价值/关键性'], progress: { 来源: 'promote', 来源命题: p.id, 说明: '由命题 ' + p.id + '(价值/关键性=' + p['价值/关键性'] + ')自动晋升;目标:证明或证伪该命题(解法列表中的【证明】/【证伪】条目即原命题的证明/证伪材料,验证结果会回写源命题)。' } })
678
698
  p.在问题清单 = true
679
699
  await upsertProposition(p)
680
700
  await writeQs(qs)
@@ -795,7 +815,7 @@ export function apply(ctx) {
795
815
  delete agentRegistry[childId]
796
816
  const parsed = parseJson(output)
797
817
  const dirs = (parsed && parsed.directions) || []
798
- if (dirs.length === 0) { logActivity('explorer', 'problem ' + meta.qid + ' returned no directions'); await saveAll(); return }
818
+ if (dirs.length === 0) { logActivity('explorer', 'problem ' + meta.qid + ' returned no directions (output head: ' + String(output || '').slice(0, 200) + ')'); await saveAll(); return }
799
819
  explorerRetries[meta.qid] = 0
800
820
  const q = await findQ(meta.qid); if (!q) return
801
821
  const prog = parseProgress(q)
@@ -878,7 +898,7 @@ export function apply(ctx) {
878
898
  证明列表: [{ 完整过程: lemma.proof || '', 正确概率: clamp01(0.7), '支持信息/依据': '' }],
879
899
  证伪列表: [], 优先级: (lemma.优先级 != null) ? lemma.优先级 : 1,
880
900
  '价值/关键性': clamp01(lemma['价值/关键性'] != null ? lemma['价值/关键性'] : 0.5),
881
- progress: '由求解器针对问题 ' + qid + ' 的方向迭代产出。', 来源问题: qid,
901
+ progress: { 来源: 'solver-lemma', 问题: qid, 说明: '由求解器针对问题 ' + qid + ' 的方向迭代产出。' }, 来源问题: qid,
882
902
  }
883
903
  await upsertProposition(p)
884
904
  logActivity('proposition', 'lemma「' + lemma.title + '」→ ' + p.id)
@@ -902,14 +922,14 @@ export function apply(ctx) {
902
922
  const assumeId = 'p-tmp-' + shortId()
903
923
  const judgeId = qid + '-judge-' + shortId()
904
924
  const assumeStatement = sq.assumption_statement || sq.assumption_title || ('对子问题「' + (sq.q_sub_title || sq.q_sub_statement) + '」的一种回答(临时假设)')
905
- qs.push({ id: subId, 概述: sq.q_sub_statement, 已解决: false, 解法列表: [], 优先级: 1, progress: '临时子问题:由问题 ' + qid + ' 方向 ' + dirId + ' 分支产生;求解主线在 p_{q-tmp}(' + assumeId + ')假设下推进。' })
906
- qs.push({ id: judgeId, 概述: '判断下述命题是否成立:' + assumeStatement, 已解决: false, 解法列表: [], 优先级: 1, 判断命题: assumeId, progress: '由临时假设 p_{q-tmp}(' + assumeId + ')生成;它是对子问题 ' + subId + ' 的一种回答的命题化。' })
925
+ qs.push({ id: subId, 概述: sq.q_sub_statement, 已解决: false, 解法列表: [], 优先级: 1, progress: { 类型: 'sub-question', 来源问题: qid, 来源方向: dirId, 说明: '临时子问题:由问题 ' + qid + ' 方向 ' + dirId + ' 分支产生;求解主线在 p_{q-tmp}(' + assumeId + ')假设下推进。' } })
926
+ qs.push({ id: judgeId, 概述: '判断下述命题是否成立:' + assumeStatement, 已解决: false, 解法列表: [], 优先级: 1, 判断命题: assumeId, progress: { 类型: 'judge', 假设命题: assumeId, 说明: '由临时假设 p_{q-tmp}(' + assumeId + ')生成;它是对子问题 ' + subId + ' 的一种回答的命题化。' } })
907
927
  await writeQs(qs)
908
928
  const p = {
909
929
  id: assumeId, 概述: assumeStatement, 布尔估计: 0.5,
910
930
  细类型: { 未分类: {} }, 证明列表: [], 证伪列表: [], 优先级: 1,
911
931
  '价值/关键性': 0.5,
912
- progress: '临时假设 p_{q-tmp}:由问题 ' + qid + ' 方向 ' + dirId + ' 在求解中临时假设其成立以推进主线;依赖子问题 ' + subId + ';若该假设被证伪,则依赖它的主线结论需重新审视。',
932
+ progress: { 类型: 'temporary-assumption', 来源问题: qid, 子问题: subId, 说明: '临时假设 p_{q-tmp}:由问题 ' + qid + ' 方向 ' + dirId + ' 在求解中临时假设其成立以推进主线;若该假设被证伪,则依赖它的主线结论需重新审视。' },
913
933
  来源问题: qid,
914
934
  }
915
935
  await upsertProposition(p)
@@ -1249,16 +1269,16 @@ export function apply(ctx) {
1249
1269
  registerTool('vibe_math_resume', 'Resume the Vibe Math V2 scheduler after a checkpoint/restart.', objParams({}), async function (args, agent) { return await resumeScheduler(agent) })
1250
1270
  registerTool('vibe_math_pause', 'Pause the scheduler (in-flight children finish their current turn).', objParams({}), async function () { return await pauseScheduler() })
1251
1271
  registerTool('vibe_math_abort', 'Abort the scheduler and interrupt all active children.', objParams({}), async function () { return await abortScheduler() })
1252
- registerTool('vibe_math_status', 'Show scheduler status, params, active agents, projects, and recent activity.', objParams({}), async function () { return await getStatus() })
1253
- 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() })
1272
+ registerTool('vibe_math_status', 'Show scheduler status, params, active agents, projects, and recent activity.', objParams({}), async function () { await refreshParams(); return await getStatus() })
1273
+ registerTool('vibe_math_report', 'Return the full progress report and write it to Progress_Logs/report.json.', objParams({}), async function () { await refreshParams(); await maybeWriteReport(true); return await buildReport() })
1254
1274
  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(); await saveSettings(); if (params.mode === 'auto') await autoResolvePending(); return { ok: true, mode: params.mode } })
1255
1275
  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' }, explorerPersona: { type: 'string' }, knowledgeContext: { 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' } }, solverAllowNetwork: { type: 'boolean' }, verifierAllowNetwork: { type: 'boolean' }, solverAllowScripts: { type: 'boolean' }, verifierAllowScripts: { type: 'boolean' }, 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(); await saveSettings(); return { ok: true, params: params } })
1256
- 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' } })
1276
+ registerTool('vibe_math_setup', 'Return the interactive parameter schema for guided configuration.', objParams({}), async function () { await refreshParams(); 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' } })
1257
1277
  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() })
1258
1278
  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') })
1259
- registerTool('vibe_math_add_problem', 'Add a problem to the current project qs/qs.json.', objParams({ id: { type: 'string' }, description: { type: 'string' }, priority: { type: 'integer' } }, ['id', 'description']), async function (args) { const qs = await getQs(); if (qs.some(function (q) { return q.id === args.id })) return { ok: false, message: 'problem id already exists' }; qs.push({ id: args.id, 概述: args.description, 已解决: false, 解法列表: [], 优先级: args.priority || 0, progress: '' }); await writeQs(qs); scheduleTick(); return { ok: true, message: 'problem added' } })
1279
+ registerTool('vibe_math_add_problem', 'Add a problem to the current project qs/qs.json.', objParams({ id: { type: 'string' }, description: { type: 'string' }, priority: { type: 'integer' } }, ['id', 'description']), async function (args) { const qs = await getQs(); if (qs.some(function (q) { return q.id === args.id })) return { ok: false, message: 'problem id already exists' }; qs.push({ id: args.id, 概述: args.description, 已解决: false, 解法列表: [], 优先级: args.priority || 0, progress: { directions: [] } }); await writeQs(qs); scheduleTick(); return { ok: true, message: 'problem added' } })
1260
1280
  registerTool('vibe_math_add_proposition', 'Add a proposition to Propos/ (with 概述, 布尔估计, 细类型, 优先级, 价值/关键性).', objParams({ id: { type: 'string' }, 概述: { type: 'string' }, 布尔估计: { type: 'number' }, 优先级: { type: 'integer' }, '价值/关键性': { type: 'number' }, 细类型: { type: 'object' } }, ['id', '概述']), async function (args) {
1261
- const p = { id: args.id, 概述: args.概述, 布尔估计: clamp01(args.布尔估计 != null ? args.布尔估计 : 0.5), 细类型: (args.细类型 && typeof args.细类型 === 'object') ? args.细类型 : { 未分类: {} }, 证明列表: [], 证伪列表: [], 优先级: (args.优先级 != null) ? args.优先级 : 1, '价值/关键性': clamp01(args['价值/关键性'] != null ? args['价值/关键性'] : 0.5), progress: '用户手动添加。' }
1281
+ const p = { id: args.id, 概述: args.概述, 布尔估计: clamp01(args.布尔估计 != null ? args.布尔估计 : 0.5), 细类型: (args.细类型 && typeof args.细类型 === 'object') ? args.细类型 : { 未分类: {} }, 证明列表: [], 证伪列表: [], 优先级: (args.优先级 != null) ? args.优先级 : 1, '价值/关键性': clamp01(args['价值/关键性'] != null ? args['价值/关键性'] : 0.5), progress: { 来源: 'user', 说明: '用户手动添加。' } }
1262
1282
  await upsertProposition(p); scheduleTick(); return { ok: true, proposition: p, file: proposFile(categoryOf(p)) }
1263
1283
  })
1264
1284
  registerTool('vibe_math_list_propositions', 'List propositions from Propos/ (summary index: id, 概述, 布尔估计, 优先级, 价值/关键性, category).', objParams({}), async function () { const all = await getPropos(); return { ok: true, count: all.length, propositions: all.map(function (p) { return { id: p.id, 概述: p.概述, 布尔估计: p.布尔估计, 优先级: p.优先级, '价值/关键性': p['价值/关键性'], category: p._category } }) } })
@@ -1277,14 +1297,14 @@ export function apply(ctx) {
1277
1297
  if (cmd === 'resume') return await resumeScheduler(agent)
1278
1298
  if (cmd === 'pause') return await pauseScheduler()
1279
1299
  if (cmd === 'abort') return await abortScheduler()
1280
- if (cmd === 'status') return await getStatus()
1281
- if (cmd === 'report') { await maybeWriteReport(true); return await buildReport() }
1300
+ if (cmd === 'status') { await refreshParams(); return await getStatus() }
1301
+ if (cmd === 'report') { await refreshParams(); await maybeWriteReport(true); return await buildReport() }
1282
1302
  if (cmd === 'mode') { params.mode = (args[0] === 'manual') ? 'manual' : 'auto'; await saveAll(); await saveSettings(); if (params.mode === 'auto') await autoResolvePending(); return { ok: true, mode: params.mode } }
1283
- if (cmd === 'setup') { 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' } }
1303
+ if (cmd === 'setup') { await refreshParams(); 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' } }
1284
1304
  if (cmd === 'save') return await saveSettings()
1285
1305
  if (cmd === 'template') return await createTemplate(args[0] === 'project' ? 'project' : 'global')
1286
- if (cmd === 'add') { const id = args[0]; const desc = args.slice(1).join(' '); if (!id || !desc) return { ok: false, message: 'usage: /vibe add <id> <description>' }; const qs = await getQs(); if (qs.some(function (q) { return q.id === id })) return { ok: false, message: 'problem id already exists' }; qs.push({ id: id, 概述: desc, 已解决: false, 解法列表: [], 优先级: 0, progress: '' }); await writeQs(qs); scheduleTick(); return { ok: true, message: 'problem added' } }
1287
- if (cmd === 'add-proposition') { const id = args[0]; const desc = args.slice(1).join(' '); if (!id || !desc) return { ok: false, message: 'usage: /vibe add-proposition <id> <概述>' }; const p = { id: id, 概述: desc, 布尔估计: 0.5, 细类型: { 未分类: {} }, 证明列表: [], 证伪列表: [], 优先级: 1, '价值/关键性': 0.5, progress: '用户通过 /vibe 添加。' }; await upsertProposition(p); scheduleTick(); return { ok: true, proposition: p, file: proposFile(categoryOf(p)) } }
1306
+ if (cmd === 'add') { const id = args[0]; const desc = args.slice(1).join(' '); if (!id || !desc) return { ok: false, message: 'usage: /vibe add <id> <description>' }; const qs = await getQs(); if (qs.some(function (q) { return q.id === id })) return { ok: false, message: 'problem id already exists' }; qs.push({ id: id, 概述: desc, 已解决: false, 解法列表: [], 优先级: 0, progress: { directions: [] } }); await writeQs(qs); scheduleTick(); return { ok: true, message: 'problem added' } }
1307
+ if (cmd === 'add-proposition') { const id = args[0]; const desc = args.slice(1).join(' '); if (!id || !desc) return { ok: false, message: 'usage: /vibe add-proposition <id> <概述>' }; const p = { id: id, 概述: desc, 布尔估计: 0.5, 细类型: { 未分类: {} }, 证明列表: [], 证伪列表: [], 优先级: 1, '价值/关键性': 0.5, progress: { 来源: 'user-vibe', 说明: '用户通过 /vibe 添加。' } }; await upsertProposition(p); scheduleTick(); return { ok: true, proposition: p, file: proposFile(categoryOf(p)) } }
1288
1308
  if (cmd === 'list-propositions') { const all = await getPropos(); return { ok: true, count: all.length, propositions: all.map(function (p) { return { id: p.id, 概述: p.概述, 布尔估计: p.布尔估计, 优先级: p.优先级, '价值/关键性': p['价值/关键性'], category: p._category } }) } }
1289
1309
  if (cmd === 'project') {
1290
1310
  if (args.length === 0 || args[0] === 'list') return { ok: true, current: currentProject, projects: await listDirsAt(vibeRoot(), 'Projects') }