dsh-workplan 1.10.6 → 1.11.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-workplan",
3
- "version": "1.10.6",
3
+ "version": "1.11.1",
4
4
  "description": "Automatic task decomposition, real department subagents, and a responsive workplan dashboard for DeepSeek Harness.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/client.ts CHANGED
@@ -86,6 +86,13 @@ window.__ModuleLoader__.load({
86
86
  "done": "做好了",
87
87
  "blocked": "卡住了"
88
88
  },
89
+ "handoff": {
90
+ "open": "待处置",
91
+ "routed": "已指派",
92
+ "answered": "已答复",
93
+ "closed": "无需动作"
94
+ },
95
+ "handoffs": "跨部门需求",
89
96
  "dept": {
90
97
  "engineering": "工程研发",
91
98
  "research": "研究分析",
@@ -124,6 +131,18 @@ window.__ModuleLoader__.load({
124
131
  "notDeliverable": "还不能交付",
125
132
  "notDeliverableHint": "「全部做完」不等于「可以交付」:交付还需要每一行都有可核对的证据。下面是没有通过的部分。",
126
133
  "progressLabel": "进度",
134
+ "closureReported": "已回报",
135
+ "closureDone": "完成 · 待回报",
136
+ "closureAssigned": "已下发 · 待回应",
137
+ "closureAcknowledged": "已回应 · 执行中",
138
+ "closureInstructed": "已给指示 · 待执行",
139
+ "closureEscalated": "待你决定",
140
+ "closureRunning": "执行中",
141
+ "closureNoAck": "指示还没被执行",
142
+ "changePending": "需求变更待落实",
143
+ "changePendingHint": "你在执行中提出的变更已记录,本轮不会中途改写正在跑的任务;本轮结束后会按新需求重规划,已发出的变更不会丢失。",
144
+ "closureReplanned": "已重规划",
145
+ "closureReplannedTo": "已重规划 → 修订 {ids}",
127
146
  "more": "更多细节(不看也不影响理解)",
128
147
  "why": "为什么这样安排",
129
148
  "whyHint": "先找出最关键的问题,再按顺序解决;每一步做完先检查,再决定下一步。",
@@ -262,6 +281,13 @@ window.__ModuleLoader__.load({
262
281
  "done": "Done",
263
282
  "blocked": "Stuck"
264
283
  },
284
+ "handoff": {
285
+ "open": "Open",
286
+ "routed": "Assigned",
287
+ "answered": "Answered",
288
+ "closed": "No action"
289
+ },
290
+ "handoffs": "Cross-team needs",
265
291
  "dept": {
266
292
  "engineering": "Engineering",
267
293
  "research": "Research",
@@ -300,6 +326,18 @@ window.__ModuleLoader__.load({
300
326
  "notDeliverable": "Not deliverable yet",
301
327
  "notDeliverableHint": "All rows done does not mean deliverable: every row needs checkable evidence. The gaps are listed below.",
302
328
  "progressLabel": "Progress",
329
+ "closureReported": "Reported back",
330
+ "closureDone": "Done · not reported",
331
+ "closureAssigned": "Sent · no reply yet",
332
+ "closureAcknowledged": "Acknowledged",
333
+ "closureInstructed": "Instruction sent",
334
+ "closureEscalated": "Needs your call",
335
+ "closureRunning": "Running",
336
+ "closureNoAck": "Instruction not started yet",
337
+ "changePending": "Change request pending",
338
+ "changePendingHint": "Your mid-run change is recorded. This round will not rewrite running work; the plan is replanned from your new requirements as soon as this round ends, so nothing is lost.",
339
+ "closureReplanned": "Replanned",
340
+ "closureReplannedTo": "Replanned → revised {ids}",
303
341
  "more": "More detail (optional)",
304
342
  "why": "Why it is arranged this way",
305
343
  "whyHint": "Find the most important problem first, solve in order, and check after each step before deciding the next one.",
@@ -1089,6 +1127,19 @@ window.__ModuleLoader__.load({
1089
1127
  return value === key ? String(id || '') : value
1090
1128
  }
1091
1129
 
1130
+ /*
1131
+ * [1.11.0] 跨部门需求的四档文案(用户 m00687)。
1132
+ *
1133
+ * 客户端只做「状态值 → 文案」映射,不推导状态:服务端写 open/routed/
1134
+ * answered/closed,这里原样显示。未知值退回原文,避免把新状态误写成
1135
+ * “已答复”。
1136
+ */
1137
+ function handoffStatusText(t: any, status: any) {
1138
+ const key = `handoff.${String(status ?? '')}`
1139
+ const value = t(key)
1140
+ return value === key ? String(status || '') : value
1141
+ }
1142
+
1092
1143
  function levelText(t: any, value: any) {
1093
1144
  const key = `level.${value}`
1094
1145
  const text = t(key)
@@ -1430,11 +1481,59 @@ window.__ModuleLoader__.load({
1430
1481
 
1431
1482
  function SubtaskRow({ item, subtask, index, t }: any) {
1432
1483
  const status = item?.status ?? 'pending'
1433
- const tone = toneOfStatus(status)
1484
+ /*
1485
+ * [1.11.0] 闭环徽标:完成 ≠ 已回报;被重规划的行灰化并指向后继。
1486
+ *
1487
+ * 这里只渲染 `serialisePlan` 下发的 `closure/replacedBy`,不在客户端
1488
+ * 推导任何状态(契约 §8.3:客户端不得维护本地状态机)。计划定义里的
1489
+ * `supersededAt` 是同一事实的镜像,只用于「状态行缺失」的历史载荷。
1490
+ */
1491
+ const closure = item?.closure ?? (subtask?.supersededAt ? 'replanned' : null)
1492
+ const replacedBy = Array.isArray(item?.replacedBy)
1493
+ ? item.replacedBy
1494
+ : (Array.isArray(subtask?.replacedBy) ? subtask.replacedBy : [])
1495
+ /*
1496
+ * [1.11.0] M9:闭环每一档都要在左侧栏可见。
1497
+ *
1498
+ * 只显示「已回报/已重规划」时,一条正在等主 Agent 决定的请示看起来就是
1499
+ * 普通「受阻」,主 Agent 与用户都无法从进度栏看出「它在等你拍板」。
1500
+ * 文案由服务端下发的 `closure` 决定,客户端不推导状态。
1501
+ */
1502
+ const closureText = closure === 'replanned'
1503
+ ? (replacedBy.length > 0 ? fill(t('closureReplannedTo'), { ids: replacedBy.join('、') }) : t('closureReplanned'))
1504
+ : closure === 'reported' ? t('closureReported')
1505
+ : closure === 'done' ? t('closureDone')
1506
+ : closure === 'assigned' ? t('closureAssigned')
1507
+ : closure === 'acknowledged' ? t('closureAcknowledged')
1508
+ : closure === 'instructed' ? t('closureInstructed')
1509
+ : closure === 'escalated' ? t('closureEscalated')
1510
+ /*
1511
+ * [1.11.0] 瞬态兜底(T10 N7):状态行已经 in_progress,
1512
+ * 但闭环字段还是 pending(旧载荷 / 重建中的一行)。没有
1513
+ * 徽标会让这一行看起来「没有闭环含义」,补一个只描述
1514
+ * 事实的「执行中」,不推断它是否已回报。
1515
+ */
1516
+ : status === 'in_progress' ? t('closureRunning')
1517
+ : ''
1518
+ const closureLabel = closureText
1519
+ const closureTone = closure === 'reported' ? 'done'
1520
+ : closure === 'escalated' ? 'blocked'
1521
+ : closure === 'replanned' ? 'idle'
1522
+ : 'idle'
1523
+ /*
1524
+ * [1.11.0] 「指示已发出、子会话还没动」(T10 N4)。
1525
+ *
1526
+ * `instructionOverdue` 由 60s 定时器写、由子会话首次进展清除;它描述的
1527
+ * 是等待事实,不是失败,所以用 blocked 色提醒但不改 status。
1528
+ */
1529
+ const instructionOverdue = item?.instructionOverdue === true
1530
+ const tone = closure === 'replanned' ? 'idle' : toneOfStatus(status)
1434
1531
  const pct = clampPct(item?.progress ?? 0)
1435
1532
  return h('div', { className: `dsh-wp-subtask dsh-wp-tone-${tone}` },
1436
1533
  h('div', { className: 'dsh-wp-subtask-head' },
1437
1534
  h('div', { className: 'dsh-wp-subtask-title' }, `${workLabel(t, index)}:${subtask.title}`),
1535
+ closureLabel ? h(Pill, { tone: closureTone }, closureLabel) : null,
1536
+ instructionOverdue ? h(Pill, { tone: 'blocked' }, t('closureNoAck')) : null,
1438
1537
  h(Pill, { tone }, progressText(item, t)),
1439
1538
  ),
1440
1539
  h('div', { className: 'dsh-wp-subtask-meta' },
@@ -1449,6 +1548,24 @@ window.__ModuleLoader__.load({
1449
1548
  ),
1450
1549
  status === 'in_progress' ? h(Progress, { value: pct, tone }) : null,
1451
1550
  status === 'in_progress' ? h('div', { className: 'dsh-wp-progress-meta' }, h('span', null, `${t('progressLabel')} ${pct}%`)) : null,
1551
+ /*
1552
+ * [1.11.0] 跨部门需求(用户 m00687):提出方、指派对象、答复都必须在
1553
+ * 进度栏可见。否则用户只能从结果消息的一段文字里猜「这条需求谁在办、
1554
+ * 办没办」,而交付门禁却已经因为它把整份计划拦住了。
1555
+ */
1556
+ Array.isArray(item?.handoffs) && item.handoffs.length
1557
+ ? h('div', { className: 'dsh-wp-subtask-body' },
1558
+ h('div', null, h('strong', null, `${t('handoffs')}:`)),
1559
+ h('ul', { className: 'dsh-wp-muted' },
1560
+ item.handoffs.map((handoff: any) => h('li', { key: String(handoff?.id ?? '') },
1561
+ `${String(handoff?.id ?? 'H?')} ${String(handoff?.request ?? '')}`
1562
+ + `${handoff?.department ? ` → ${deptName(t, handoff.department)}` : ''}`
1563
+ + `|${handoffStatusText(t, handoff?.status)}`
1564
+ + `${handoff?.response ? `:${String(handoff.response)}` : ''}`,
1565
+ )),
1566
+ ),
1567
+ )
1568
+ : null,
1452
1569
  status !== 'blocked' && item?.summary ? h('p', { className: 'dsh-wp-muted' }, `${t('summary')}:${plainError(item.summary)}`) : null,
1453
1570
  /*
1454
1571
  * [1.10.0] R-02:「卡住原因」只属于没做完的行。
@@ -1479,7 +1596,13 @@ window.__ModuleLoader__.load({
1479
1596
 
1480
1597
  function StageCard({ stage, statuses, index, t }: any) {
1481
1598
  const byId = useMemo(() => new Map((statuses || []).map((item: any) => [item.subtaskId, item])), [statuses])
1482
- const items = (stage.subtasks || []).map((subtask: any) => ({ subtask, item: byId.get(subtask.id) }))
1599
+ const allItems = (stage.subtasks || []).map((subtask: any) => ({ subtask, item: byId.get(subtask.id) }))
1600
+ /*
1601
+ * [1.11.0] 被重规划替换/撤销的行仍然渲染(可追溯),但不进入阶段分母:
1602
+ * 否则「替换一项」会让阶段永远停在 4/5,用户看到的进度与总数互相矛盾。
1603
+ * 同一个 `supersededAt` 也决定了 `definedSubtaskCount` 的分母。
1604
+ */
1605
+ const items = allItems.filter(({ subtask }: any) => !subtask.supersededAt)
1483
1606
  const done = items.filter(({ item }: any) => item?.status === 'done').length
1484
1607
  const blocked = items.filter(({ item }: any) => item?.status === 'blocked').length
1485
1608
  const inProgress = items.some(({ item }: any) => item?.status === 'in_progress')
@@ -1506,7 +1629,7 @@ window.__ModuleLoader__.load({
1506
1629
  },
1507
1630
  h('div', { className: 'dsh-wp-stage-goal' }, `${t('what')}:${stage.goal}`),
1508
1631
  h('div', { className: 'dsh-wp-checkpoint' }, `${t('checkpoint')}:${stage.checkpoint}`),
1509
- items.map(({ subtask, item }: any, subIndex: any) => h(SubtaskRow, { key: subtask.id, subtask, item, index: subIndex, t })),
1632
+ allItems.map(({ subtask, item }: any, subIndex: any) => h(SubtaskRow, { key: subtask.id, subtask, item, index: subIndex, t })),
1510
1633
  ),
1511
1634
  )
1512
1635
  }
@@ -1730,7 +1853,18 @@ window.__ModuleLoader__.load({
1730
1853
  const rows: PlanStageRow[] = []
1731
1854
  const list = Array.isArray(stages) ? stages : []
1732
1855
  list.forEach((stage: any, index: number) => {
1733
- const subtasks = Array.isArray(stage?.subtasks) ? stage.subtasks : []
1856
+ /*
1857
+ * [1.11.0] 被重规划替换的旧行不参与阶段步进条(T10 N1)。
1858
+ *
1859
+ * 卡片头部按 `definedSubtaskCount` 已排除 `supersededAt`,这里却把
1860
+ * 计划定义里的全部行都算进分母,于是重规划后出现「头部 100%,
1861
+ * 阶段条 1/2 做好了」的双口径。旧行仍是审计记录(下面按状态行渲染、
1862
+ * 灰化),但不再是「还要做的工作」,所以不进入 total/done/active/
1863
+ * blocked 四个计数;一个阶段若只剩旧行,整段也不再显示。
1864
+ */
1865
+ const allSubtasks = Array.isArray(stage?.subtasks) ? stage.subtasks : []
1866
+ const subtasks = allSubtasks.filter((subtask: any) => !subtask?.supersededAt)
1867
+ if (allSubtasks.length > 0 && subtasks.length === 0) return
1734
1868
  let done = 0
1735
1869
  let active = 0
1736
1870
  let blocked = 0
@@ -2025,6 +2159,22 @@ window.__ModuleLoader__.load({
2025
2159
  h('div', null, plainError(session.error || '')),
2026
2160
  h('div', { className: 'dsh-wp-muted' }, t('degradedHint')),
2027
2161
  ) : null,
2162
+ /*
2163
+ * [1.11.0] 执行中收到的需求变更(T10 N5)。
2164
+ *
2165
+ * 服务端从 1.11.0 起把 `changeRequest` 放进每份载荷,但卡片原先
2166
+ * 一字不显示:用户提了变更、工具也回了「已记录」,进度栏却看不出
2167
+ * 来,只能等主 Agent 自己再解释一遍。这里只显示「已记录 + 原文 +
2168
+ * 何时生效」,不显示任何未落地的承诺。
2169
+ */
2170
+ session.changeRequest?.status === 'pending'
2171
+ ? h('div', { className: 'dsh-wp-banner dsh-wp-banner--degraded' },
2172
+ h('strong', null, t('changePending')),
2173
+ h('div', { className: 'dsh-wp-muted' }, t('changePendingHint')),
2174
+ typeof session.changeRequest.text === 'string' && session.changeRequest.text
2175
+ ? h('div', { className: 'dsh-wp-error-text' }, plainError(session.changeRequest.text))
2176
+ : null,
2177
+ ) : null,
2028
2178
  /*
2029
2179
  * [1.10.0] C-09:把服务端已经下发、却从来没人读的交付门禁搬上界面。
2030
2180
  *