dsh-mcmp 2.0.1 → 2.0.3

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.
Files changed (2) hide show
  1. package/lib/index.js +7 -5
  2. package/package.json +3 -3
package/lib/index.js CHANGED
@@ -403,7 +403,7 @@ export function apply(ctx) {
403
403
  }
404
404
 
405
405
  // 启动一个子智能体并返回 { ok, text, outcome }
406
- async function runChild(provider, session, agent, args, controller, label, promptText) {
406
+ async function runChild(provider, session, agent, controller, label, promptText, onStarted) {
407
407
  let child = null
408
408
  try {
409
409
  const parent = (agents && agents.get(session.id)) || agent
@@ -413,6 +413,7 @@ export function apply(ctx) {
413
413
  parent,
414
414
  signal: controller.signal,
415
415
  })
416
+ if (onStarted) { try { onStarted(child) } catch (err) { /* ignore */ } }
416
417
  const res = await child.result
417
418
  const text = (Array.isArray(res.output) ? res.output.filter((b) => b && b.type === 'text').map((b) => b.text).join('') : '')
418
419
  const outcome = res.stopReason === 'completed' ? 'completed' : res.stopReason === 'cancelled' ? 'cancelled' : 'failed'
@@ -452,12 +453,13 @@ export function apply(ctx) {
452
453
  let started = false
453
454
  let outcome = 'failed'
454
455
  let note = ''
455
- const res = await runChild(provider, session, agent, args, controller, label, buildPrompt(r, f.s, f.i, s, it, args))
456
- started = res.started
456
+ const res = await runChild(provider, session, agent, controller, label, buildPrompt(r, f.s, f.i, s, it, args), (child) => {
457
+ started = true
458
+ appendRec(runId, session, 'tool-workflow/agent-start', { runId, seq: g + 1, label, phase: s.phase, childId: String(child.id) })
459
+ })
457
460
  outcome = res.outcome
458
461
  note = (res.text || '').trim().slice(0, 300)
459
462
  if (res.err) note = '执行异常: ' + String((res.err && res.err.message) || res.err).slice(0, 200)
460
- if (started) appendRec(runId, session, 'tool-workflow/agent-start', { runId, seq: g + 1, label, phase: s.phase, childId: '' })
461
463
  state.done = Math.min(g + 1, state.total)
462
464
  refreshFiles()
463
465
  if (outcome === 'completed') {
@@ -493,7 +495,7 @@ export function apply(ctx) {
493
495
  state.agentLabel = 'S8 兜底·论文定稿'
494
496
  const fresh = makeController()
495
497
  const reason = stopReason === 'cancelled' ? '用户中止' : stopReason === 'error' ? errorMsg : '正常流程已结束但定稿步骤未完成'
496
- const fres = await runChild(provider, session, agent, args, fresh, '兜底·论文定稿(不论成败)', buildFinalizePrompt(args, reason))
498
+ const fres = await runChild(provider, session, agent, fresh, '兜底·论文定稿(不论成败)', buildFinalizePrompt(args, reason))
497
499
  if (fres.outcome === 'completed') {
498
500
  finalDone = true
499
501
  pushLog('兜底定稿完成: 论文定稿.md 已生成')
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
- {
1
+ {
2
2
  "name": "dsh-mcmp",
3
- "version": "2.0.1",
4
- "description": "DeepSeek Harness 鎻掍欢:鏁板寤烘ā璁烘枃鑷姩鍖栨祦姘寸嚎 v2(8 姝ラ 19 杩唬 N 杞?鍥捐〃瑙嗚鑷涓庝慨澶嶃€佽瘎瀹¢棶棰樹慨澶嶉棴鐜€佽鏂囧厹搴曞畾绋裤€佽川鐤戦┍鍔ㄣ€佹柇鐐圭画璺戙€佽繘搴﹂潰鏉?",
3
+ "version": "2.0.3",
4
+ "description": "DeepSeek Harness 插件:数学建模论文自动化流水线 v2(8 步骤 × 19 迭代 × N 轮:图表视觉自检与修复、评审问题修复闭环、论文兜底定稿、质疑驱动、断点续跑、进度面板)",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "exports": {