dsh-progress-union 0.1.4 → 0.1.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/dsh.plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "id": "dsh-external/dsh-progress-union",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "main": "./index.js",
5
5
  "description": "进度结合原型:board 槽位真相源(用户可编辑、diff+ack 增量同步、staleness nudge)× 鲸程时间引擎(step 计数、ETA 三档 board>todo>local>prior、悬浮迷你条),并向压缩插件暴露只读三层进度锚点 progressAnchor(board 语义锚 + time 时间锚 + userEdits 未确认改动,service 与 HTTP 双平面)。",
6
6
  "engines": {
package/index.js CHANGED
@@ -2624,6 +2624,93 @@ ${reason}。本回合开始前先用 progress_update 处理进度板:用户这
2624
2624
  )
2625
2625
  }
2626
2626
 
2627
+ // —— 模型侧 progress_goal_report 工具(报告轮次状态;助手草案不自动调这里)——
2628
+ ctx.effect(
2629
+ () =>
2630
+ tools.register({
2631
+ name: 'progress_goal_report',
2632
+ description:
2633
+ '在 /progress-goal 续轮里报告本轮状态。complete 需 evidence 且进度板已全部完成;blocked 需 blocker(连续 3 轮同因才落 blocked);continue 表示仍在推进。',
2634
+ parameters: {
2635
+ type: 'object',
2636
+ additionalProperties: false,
2637
+ properties: {
2638
+ status: { type: 'string', enum: ['continue', 'complete', 'blocked'] },
2639
+ summary: { type: 'string' },
2640
+ evidence: { type: 'array', items: { type: 'string' } },
2641
+ nextSteps: { type: 'array', items: { type: 'string' } },
2642
+ blocker: { type: 'string' },
2643
+ },
2644
+ required: ['status'],
2645
+ },
2646
+ output: {
2647
+ schema: { type: 'object', additionalProperties: true, properties: { ok: { type: 'boolean' }, goal: { type: 'object', additionalProperties: true } } },
2648
+ render(_args, value) {
2649
+ return [{ type: 'text', text: JSON.stringify(value, null, 2) }]
2650
+ },
2651
+ },
2652
+ async execute(args, exec) {
2653
+ const agent = exec.agent
2654
+ if (!agent) throw new Error('progress_goal_report 只能在 Agent 会话中调用')
2655
+ if (!isObject(args)) throw new Error('参数必须是对象')
2656
+ const view = await applyGoalReport(String(agent.session?.id ?? agent.id), args)
2657
+ return { ok: true, goal: view }
2658
+ },
2659
+ }, { when: ({ agent }) => isEnabled(sessionOfAgent(agent)) }),
2660
+ 'progress-union: progress_goal_report tool',
2661
+ )
2662
+
2663
+ if (commands) {
2664
+ ctx.effect(
2665
+ () =>
2666
+ commands.register({
2667
+ name: 'progress-goal',
2668
+ description: '设置一个长程目标,自动续轮推进(预算/检查/重试),替代 /goal',
2669
+ input: { hint: '[<objective>|status|budget <n>|edit <objective>|pause|resume|clear]' },
2670
+ handler: async ({ agent, rawInput }) => {
2671
+ const sessionId = sessionOfAgent(agent)
2672
+ const raw = String(rawInput || '').trim()
2673
+ const lower = raw.toLowerCase()
2674
+ try {
2675
+ if (lower === 'status' || raw === '') {
2676
+ const view = goalView(sessionId)
2677
+ return { kind: 'success', text: view.phase === 'idle' ? '没有目标。用法:/progress-goal <objective>' : renderGoalViewText(view) }
2678
+ }
2679
+ if (lower === 'clear') {
2680
+ const current = goalView(sessionId)
2681
+ if (current.phase === 'idle') return { kind: 'success', text: '没有目标可清除。' }
2682
+ await clearGoal(sessionId)
2683
+ return { kind: 'success', text: '目标已清除。' }
2684
+ }
2685
+ if (lower === 'pause') {
2686
+ const view = await pauseGoal(sessionId)
2687
+ return { kind: 'success', text: `目标已暂停\n${renderGoalViewText(view)}` }
2688
+ }
2689
+ if (lower === 'resume') {
2690
+ const view = await resumeGoal(sessionId)
2691
+ return { kind: 'success', text: `目标已恢复\n${renderGoalViewText(view)}` }
2692
+ }
2693
+ if (/^budget(?=\s)/i.test(raw)) {
2694
+ const value = raw.slice(6).trim()
2695
+ const view = await setGoalBudget(sessionId, Number(value))
2696
+ return { kind: 'success', text: `预算已更新\n${renderGoalViewText(view)}` }
2697
+ }
2698
+ if (/^edit(?=\s)/i.test(raw)) {
2699
+ const view = await editGoal(sessionId, raw.slice(4).trim())
2700
+ return { kind: 'success', text: `目标已更新\n${renderGoalViewText(view)}` }
2701
+ }
2702
+ // 其余一律当作新目标 objective
2703
+ const view = await createGoal(sessionId, raw)
2704
+ return { kind: 'success', text: `目标已创建\n${renderGoalViewText(view)}` }
2705
+ } catch (err) {
2706
+ return { kind: 'error', text: err instanceof Error ? err.message : String(err) }
2707
+ }
2708
+ },
2709
+ }),
2710
+ 'progress-union: /progress-goal command',
2711
+ )
2712
+ }
2713
+
2627
2714
  const agentDisposers = new Map()
2628
2715
  function bindAgentContext(agent) {
2629
2716
  const sessionId = sessionOfAgent(agent)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-progress-union",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "type": "module",
5
5
  "description": "进度结合原型:dsh-progress-board 槽位真相源 × 鲸程 widget 时间/ETA 引擎,另向压缩插件暴露只读三层进度锚点(service + HTTP 双平面)。基于 l3j3y3/dsh-progress-board (MIT) 与 uuhihj/task-progress-bar dsh-progress-widget (MIT)。",
6
6
  "license": "MIT",