dsh-vibe-math 0.3.13 → 0.3.15
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 +2 -0
- package/package.json +1 -1
- package/vibe-math-v1/vibe-math.js +32 -14
- package/vibe-math-v2/vibe-math-v2.js +30 -13
package/README.md
CHANGED
|
@@ -237,6 +237,8 @@ dsh plugin --profile <你的 profile> add github:ChongCyrus/Vibe-Mathematics
|
|
|
237
237
|
- **生成模板**:`/vibe template`(生成到工作区)或 `/vibe template project`(生成到当前项目)——
|
|
238
238
|
会产出一份**带 `//` 注释、逐项中文说明**的 JSON 模板,你手改后重启/resume 即生效。
|
|
239
239
|
- **保存当前值**:`/vibe save` 把当前生效参数写回该文件。
|
|
240
|
+
- **唯一持久化来源**:该文件是参数的**唯一持久化层**(项目级优先 → 缺失时回退全局 `<工作区>/VibeMath/vibe_math_setting.json` → 内置默认)。
|
|
241
|
+
`vibe_math_set_params` / `set_mode` 会**立即写回**项目级文件并持久化,无需再手动 save。
|
|
240
242
|
|
|
241
243
|
---
|
|
242
244
|
|
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.
|
|
4
|
+
"version": "0.3.15",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "installer.js",
|
|
7
7
|
"exports": {
|
|
@@ -212,7 +212,7 @@ export function apply(ctx) {
|
|
|
212
212
|
lines.push('{')
|
|
213
213
|
lines.push(' // Vibe Math 默认参数配置(JSON with Comments,可加 // 注释)。')
|
|
214
214
|
lines.push(' // 位置:<项目>/vibe_math_setting.json(全局回退:<工作区>/VibeMath/vibe_math_setting.json)。')
|
|
215
|
-
lines.push(' //
|
|
215
|
+
lines.push(' // 本文件是参数的唯一持久化来源:vibe_math_set_params / set_mode 会立即写回此文件;全局文件仅作项目文件不存在时的回退默认。')
|
|
216
216
|
const keys = Object.keys(src).sort()
|
|
217
217
|
for (let i = 0; i < keys.length; i++) {
|
|
218
218
|
const k = keys[i]
|
|
@@ -231,8 +231,26 @@ export function apply(ctx) {
|
|
|
231
231
|
async function createTemplate(where) { const isGlobal = where !== 'project'; const path = isGlobal ? (vibeRoot() + '/vibe_math_setting.json') : (frameworkRoot() + '/vibe_math_setting.json'); const content = settingsTemplateFrom(DEFAULT_PARAMS); const ok = isGlobal ? await writeTextAbs(path, content) : await writeText('vibe_math_setting.json', content); return { ok: ok, path: path, where: isGlobal ? 'global' : 'project' } }
|
|
232
232
|
|
|
233
233
|
// ================= persistence =================
|
|
234
|
-
async function loadState() { const
|
|
235
|
-
async function saveAll() { await writeJson('VibeMath_State/
|
|
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
|
+
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
|
+
}
|
|
242
|
+
// 一次性迁移(单文件化):旧版 params.json 合并进 vibe_math_setting.json 后删除。
|
|
243
|
+
async function migrateLegacyParams() {
|
|
244
|
+
const legacy = await readJson('VibeMath_State/params.json')
|
|
245
|
+
if (!legacy || Object.keys(legacy).length === 0) return
|
|
246
|
+
try {
|
|
247
|
+
params = Object.assign({}, params, sanitizeParams(legacy))
|
|
248
|
+
await saveSettings()
|
|
249
|
+
await writeJson('VibeMath_State/params.json', {}) // 一次性守卫:即使删除失败,空对象也不再覆盖设置文件
|
|
250
|
+
await removeFile('VibeMath_State/params.json')
|
|
251
|
+
logActivity('params', 'legacy params.json merged into vibe_math_setting.json and removed')
|
|
252
|
+
} catch (e) { console.error('vibe-math: params migration failed: ' + String((e && e.message) || e)) }
|
|
253
|
+
}
|
|
236
254
|
|
|
237
255
|
// ================= activity log / report =================
|
|
238
256
|
function logActivity(event, detail) { activityLog.push({ at: now(), event: event, detail: String(detail || '') }); const cap = Number(params.activityLogCap) || 100; if (activityLog.length > cap) activityLog.shift(); reportDirty = true }
|
|
@@ -307,7 +325,7 @@ export function apply(ctx) {
|
|
|
307
325
|
|
|
308
326
|
// ================= init / control =================
|
|
309
327
|
async function resolveRootAgent(agent) { if (rootAgent) return rootAgent; if (agent) { rootAgent = agent; return rootAgent } try { const roots = agents.roots ? agents.roots() : []; if (roots && roots.length > 0) { rootAgent = roots[0]; return rootAgent } } catch (e) {} return rootAgent }
|
|
310
|
-
async function init(agent) { await resolveRootAgent(agent); if (!rootAgent) return { ok: false, message: 'no root agent available' }; currentProject = await readCurrentProject(); await ensureDirs(); if ((await readText('qs/qs.csv')) === undefined) await writeText('qs/qs.csv', 'id,description,priority,status,deps\n'); params = Object.assign({}, DEFAULT_PARAMS); await loadSettings(); await loadState(); scheduler.activeCount = 0; await saveAll(); return { ok: true } }
|
|
328
|
+
async function init(agent) { await resolveRootAgent(agent); if (!rootAgent) return { ok: false, message: 'no root agent available' }; currentProject = await readCurrentProject(); await ensureDirs(); if ((await readText('qs/qs.csv')) === undefined) await writeText('qs/qs.csv', 'id,description,priority,status,deps\n'); params = Object.assign({}, DEFAULT_PARAMS); await loadSettings(); await migrateLegacyParams(); await loadState(); scheduler.activeCount = 0; await saveAll(); return { ok: true } }
|
|
311
329
|
async function startScheduler(agent) { const r = await init(agent); if (!r.ok) return r; scheduler.running = true; scheduler.startedAt = now(); scheduler.gate = null; logActivity('start', 'scheduler started for project ' + currentProject); await saveAll(); await maybeWriteReport(true); scheduleTick(); return { ok: true, message: 'scheduler started', project: currentProject, frameworkRoot: frameworkRoot() } }
|
|
312
330
|
async function resumeScheduler(agent) { const r = await init(agent); if (!r.ok) return r; scheduler.running = true; scheduler.gate = null; logActivity('resume', 'scheduler resumed'); await saveAll(); await maybeWriteReport(true); scheduleTick(); return { ok: true, message: 'scheduler resumed', project: currentProject, frameworkRoot: frameworkRoot() } }
|
|
313
331
|
async function pauseScheduler() { scheduler.running = false; logActivity('pause', 'scheduler paused'); await saveAll(); return { ok: true, message: 'scheduler paused' } }
|
|
@@ -338,7 +356,7 @@ export function apply(ctx) {
|
|
|
338
356
|
await ensureDirs()
|
|
339
357
|
if ((await readText('qs/qs.csv')) === undefined) await writeText('qs/qs.csv', 'id,description,priority,status,deps\n')
|
|
340
358
|
params = Object.assign({}, DEFAULT_PARAMS); scheduler = { running: false, activeCount: 0, startedAt: 0, lastCheckpoint: 0, gate: null }; agentRegistry = {}; dependencies = {}; decisionQueue = []; tasks = {}; brainstormRetries = {}; deriveRetries = {}; solvedByVerified = {}; promotionQueue = {}; verifierAccuracy = {}; activityLog = []
|
|
341
|
-
await loadSettings(); await loadState(); await saveAll()
|
|
359
|
+
await loadSettings(); await migrateLegacyParams(); await loadState(); await saveAll()
|
|
342
360
|
return { ok: true, project: slug, frameworkRoot: frameworkRoot() }
|
|
343
361
|
}
|
|
344
362
|
|
|
@@ -506,11 +524,11 @@ export function apply(ctx) {
|
|
|
506
524
|
registerTool('vibe_math_resume', 'Resume the scheduler after a checkpoint/restart.', objParams({}), async function (args, agent) { return await resumeScheduler(agent) })
|
|
507
525
|
registerTool('vibe_math_pause', 'Pause the scheduler (in-flight children finish their current turn).', objParams({}), async function () { return await pauseScheduler() })
|
|
508
526
|
registerTool('vibe_math_abort', 'Abort the scheduler and interrupt all active children.', objParams({}), async function () { return await abortScheduler() })
|
|
509
|
-
registerTool('vibe_math_status', 'Show scheduler status, params, active agents, projects, and recent activity.', objParams({}), async function () { return await getStatus() })
|
|
510
|
-
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() })
|
|
511
|
-
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 } })
|
|
512
|
-
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(); return { ok: true, params: params } })
|
|
513
|
-
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' } })
|
|
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() })
|
|
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 } })
|
|
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 } })
|
|
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' } })
|
|
514
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() })
|
|
515
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') })
|
|
516
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' } })
|
|
@@ -529,10 +547,10 @@ export function apply(ctx) {
|
|
|
529
547
|
if (cmd === 'resume') return await resumeScheduler(agent)
|
|
530
548
|
if (cmd === 'pause') return await pauseScheduler()
|
|
531
549
|
if (cmd === 'abort') return await abortScheduler()
|
|
532
|
-
if (cmd === 'status') return await getStatus()
|
|
533
|
-
if (cmd === 'report') { await maybeWriteReport(true); return buildReport() }
|
|
534
|
-
if (cmd === 'mode') { params.mode = (args[0] === 'manual') ? 'manual' : 'auto'; await saveAll(); if (params.mode === 'auto') await autoResolvePending(); return { ok: true, mode: params.mode } }
|
|
535
|
-
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' } }
|
|
550
|
+
if (cmd === 'status') { await refreshParams(); return await getStatus() }
|
|
551
|
+
if (cmd === 'report') { await refreshParams(); await maybeWriteReport(true); return buildReport() }
|
|
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 } }
|
|
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' } }
|
|
536
554
|
if (cmd === 'save') return await saveSettings()
|
|
537
555
|
if (cmd === 'template') return await createTemplate(args[0] === 'project' ? 'project' : 'global')
|
|
538
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' } }
|
|
@@ -214,6 +214,7 @@ export function apply(ctx) {
|
|
|
214
214
|
lines.push('{')
|
|
215
215
|
lines.push(' // Vibe Math V2 默认参数配置(JSON with Comments,可加 // 注释)。')
|
|
216
216
|
lines.push(' // 位置:<项目>/vibe_math_setting.json(全局回退:<工作区>/VibeMath/vibe_math_setting.json)。')
|
|
217
|
+
lines.push(' // 本文件是参数的唯一持久化来源:vibe_math_set_params / set_mode 会立即写回此文件;全局文件仅作项目文件不存在时的回退默认。')
|
|
217
218
|
const keys = Object.keys(src).sort()
|
|
218
219
|
for (let i = 0; i < keys.length; i++) {
|
|
219
220
|
const k = keys[i]
|
|
@@ -233,7 +234,6 @@ export function apply(ctx) {
|
|
|
233
234
|
|
|
234
235
|
// ================= persistence =================
|
|
235
236
|
async function loadState() {
|
|
236
|
-
const pj = await readJson('VibeMath_State/params.json'); if (pj) params = Object.assign({}, params, pj)
|
|
237
237
|
const s = await readJson('VibeMath_State/scheduler_state.json'); if (s) scheduler = Object.assign({}, scheduler, s)
|
|
238
238
|
const r = await readJson('VibeMath_State/agent_registry.json'); if (r) agentRegistry = r
|
|
239
239
|
const dq = await readJson('VibeMath_State/decision_queue.json'); if (dq) decisionQueue = dq
|
|
@@ -242,7 +242,6 @@ export function apply(ctx) {
|
|
|
242
242
|
const er = await readJson('VibeMath_State/explorer_retries.json'); if (er) explorerRetries = er
|
|
243
243
|
}
|
|
244
244
|
async function saveAll() {
|
|
245
|
-
await writeJson('VibeMath_State/params.json', params)
|
|
246
245
|
await writeJson('VibeMath_State/scheduler_state.json', scheduler)
|
|
247
246
|
await writeJson('VibeMath_State/agent_registry.json', agentRegistry)
|
|
248
247
|
await writeJson('VibeMath_State/decision_queue.json', decisionQueue)
|
|
@@ -251,6 +250,24 @@ export function apply(ctx) {
|
|
|
251
250
|
await writeJson('VibeMath_State/explorer_retries.json', explorerRetries)
|
|
252
251
|
scheduler.lastCheckpoint = now()
|
|
253
252
|
}
|
|
253
|
+
// 查询类工具(status/setup/report)汇报前重读设置文件:文件是唯一持久化源,可能在会话启动后被用户手改或由本进程外编辑更新。
|
|
254
|
+
async function refreshParams() {
|
|
255
|
+
params = Object.assign({}, DEFAULT_PARAMS)
|
|
256
|
+
await loadSettings()
|
|
257
|
+
await migrateLegacyParams()
|
|
258
|
+
}
|
|
259
|
+
// 一次性迁移(单文件化):旧版 VibeMath_State/params.json 中的运行时参数合并进 vibe_math_setting.json 后删除。
|
|
260
|
+
async function migrateLegacyParams() {
|
|
261
|
+
const legacy = await readJson('VibeMath_State/params.json')
|
|
262
|
+
if (!legacy || Object.keys(legacy).length === 0) return
|
|
263
|
+
try {
|
|
264
|
+
params = Object.assign({}, params, sanitizeParams(legacy))
|
|
265
|
+
await saveSettings()
|
|
266
|
+
await writeJson('VibeMath_State/params.json', {}) // 一次性守卫:即使删除失败,空对象也不再覆盖设置文件
|
|
267
|
+
await removeFile('VibeMath_State/params.json')
|
|
268
|
+
logActivity('params', 'legacy params.json merged into vibe_math_setting.json and removed')
|
|
269
|
+
} catch (e) { console.error('vibe-math-v2: params migration failed: ' + String((e && e.message) || e)) }
|
|
270
|
+
}
|
|
254
271
|
|
|
255
272
|
// ================= data layer: qs.json =================
|
|
256
273
|
async function getQs() { const a = await readJson('qs/qs.json'); return Array.isArray(a) ? a : [] }
|
|
@@ -1159,7 +1176,7 @@ export function apply(ctx) {
|
|
|
1159
1176
|
await resolveRootAgent(agent); if (!rootAgent) return { ok: false, message: 'no root agent available' }
|
|
1160
1177
|
currentProject = await readCurrentProject(); await ensureDirs()
|
|
1161
1178
|
if ((await readJson('qs/qs.json')) === undefined) await writeJson('qs/qs.json', [])
|
|
1162
|
-
params = Object.assign({}, DEFAULT_PARAMS); await loadSettings(); await loadState()
|
|
1179
|
+
params = Object.assign({}, DEFAULT_PARAMS); await loadSettings(); await migrateLegacyParams(); await loadState()
|
|
1163
1180
|
// Distinguish same-process continue from cross-process restart via processEpoch:
|
|
1164
1181
|
// equal epoch = same process (pause→resume; children may still be alive), different
|
|
1165
1182
|
// epoch = previous process wrote this state (in-flight children are gone).
|
|
@@ -1217,7 +1234,7 @@ export function apply(ctx) {
|
|
|
1217
1234
|
currentProject = slug; await writeCurrentProject(); await ensureDirs()
|
|
1218
1235
|
if ((await readJson('qs/qs.json')) === undefined) await writeJson('qs/qs.json', [])
|
|
1219
1236
|
params = Object.assign({}, DEFAULT_PARAMS); scheduler = { running: false, activeCount: 0, startedAt: 0, lastCheckpoint: 0, gate: null }; agentRegistry = {}; decisionQueue = []; verifierAccuracy = {}; tasks = {}; explorerRetries = {}; activityLog = []; lastReportWrite = 0; lastPushReport = 0; reportDirty = false
|
|
1220
|
-
await loadSettings(); await loadState(); await saveAll()
|
|
1237
|
+
await loadSettings(); await migrateLegacyParams(); await loadState(); await saveAll()
|
|
1221
1238
|
return { ok: true, project: slug, frameworkRoot: frameworkRoot() }
|
|
1222
1239
|
}
|
|
1223
1240
|
|
|
@@ -1238,11 +1255,11 @@ export function apply(ctx) {
|
|
|
1238
1255
|
registerTool('vibe_math_resume', 'Resume the Vibe Math V2 scheduler after a checkpoint/restart.', objParams({}), async function (args, agent) { return await resumeScheduler(agent) })
|
|
1239
1256
|
registerTool('vibe_math_pause', 'Pause the scheduler (in-flight children finish their current turn).', objParams({}), async function () { return await pauseScheduler() })
|
|
1240
1257
|
registerTool('vibe_math_abort', 'Abort the scheduler and interrupt all active children.', objParams({}), async function () { return await abortScheduler() })
|
|
1241
|
-
registerTool('vibe_math_status', 'Show scheduler status, params, active agents, projects, and recent activity.', objParams({}), async function () { return await getStatus() })
|
|
1242
|
-
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() })
|
|
1243
|
-
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 } })
|
|
1244
|
-
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(); return { ok: true, params: params } })
|
|
1245
|
-
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' } })
|
|
1258
|
+
registerTool('vibe_math_status', 'Show scheduler status, params, active agents, projects, and recent activity.', objParams({}), async function () { await refreshParams(); return await getStatus() })
|
|
1259
|
+
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() })
|
|
1260
|
+
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 } })
|
|
1261
|
+
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 } })
|
|
1262
|
+
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' } })
|
|
1246
1263
|
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() })
|
|
1247
1264
|
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') })
|
|
1248
1265
|
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' } })
|
|
@@ -1266,10 +1283,10 @@ export function apply(ctx) {
|
|
|
1266
1283
|
if (cmd === 'resume') return await resumeScheduler(agent)
|
|
1267
1284
|
if (cmd === 'pause') return await pauseScheduler()
|
|
1268
1285
|
if (cmd === 'abort') return await abortScheduler()
|
|
1269
|
-
if (cmd === 'status') return await getStatus()
|
|
1270
|
-
if (cmd === 'report') { await maybeWriteReport(true); return await buildReport() }
|
|
1271
|
-
if (cmd === 'mode') { params.mode = (args[0] === 'manual') ? 'manual' : 'auto'; await saveAll(); if (params.mode === 'auto') await autoResolvePending(); return { ok: true, mode: params.mode } }
|
|
1272
|
-
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' } }
|
|
1286
|
+
if (cmd === 'status') { await refreshParams(); return await getStatus() }
|
|
1287
|
+
if (cmd === 'report') { await refreshParams(); await maybeWriteReport(true); return await buildReport() }
|
|
1288
|
+
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 } }
|
|
1289
|
+
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' } }
|
|
1273
1290
|
if (cmd === 'save') return await saveSettings()
|
|
1274
1291
|
if (cmd === 'template') return await createTemplate(args[0] === 'project' ? 'project' : 'global')
|
|
1275
1292
|
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' } }
|