dsh-workplan 2.1.3 → 2.2.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.
Files changed (38) hide show
  1. package/CHANGELOG.md +380 -1
  2. package/README.en.md +5 -2
  3. package/README.md +5 -2
  4. package/README.zh.md +5 -2
  5. package/client.js +143 -3
  6. package/docs/dsh-workplan_T4_runtime.patch +508 -0
  7. package/docs/release-records/_release_notes_2.1.2_20261106.md +44 -0
  8. package/docs/release-records/_t2_version_determination_20261106.md +39 -0
  9. package/docs/release-records/_t5_external_reverify_20261106.md +18 -0
  10. package/docs/release-records/release-dryrun-report-20261106.md +74 -0
  11. package/docs/release-records/release-notes-2.2.6-T3.md +128 -0
  12. package/docs/release-records/release-record-2.1.3-20261106.md +82 -0
  13. package/docs/release-records/release-steps-20261106.md +129 -0
  14. package/docs/release-records/version-freeze-20261109-T2.md +37 -0
  15. package/lib/client.js +143 -3
  16. package/lib/comm-format.js +17 -0
  17. package/lib/departments.js +19 -0
  18. package/lib/host.js +95 -17
  19. package/lib/notice-channel.js +290 -0
  20. package/lib/plan.js +541 -32
  21. package/lib/replan.js +4 -0
  22. package/lib/runtime.js +1481 -85
  23. package/lib/supersede.js +2 -2
  24. package/lib/understanding.js +8 -2
  25. package/lib/watchdog.js +52 -1
  26. package/package.json +3 -2
  27. package/scripts/repair-malformed-user-messages.mjs +312 -0
  28. package/src/client.ts +150 -2
  29. package/src/comm-format.ts +17 -0
  30. package/src/departments.ts +22 -0
  31. package/src/host.ts +90 -12
  32. package/src/notice-channel.ts +328 -0
  33. package/src/plan.ts +575 -24
  34. package/src/replan.ts +4 -0
  35. package/src/runtime.ts +1500 -86
  36. package/src/supersede.ts +2 -1
  37. package/src/understanding.ts +10 -2
  38. package/src/watchdog.ts +80 -1
package/client.js CHANGED
@@ -69,6 +69,7 @@ window.__ModuleLoader__.load({
69
69
  "phase": {
70
70
  "pending": "还没开始",
71
71
  "planning": "正在安排",
72
+ "clarify": "等信息中",
72
73
  "executing": "正在做",
73
74
  "integrating": "正在收尾",
74
75
  "done": "已完成",
@@ -213,7 +214,27 @@ window.__ModuleLoader__.load({
213
214
  "vizStageTitle": "分步进度",
214
215
  "vizOverall": "总体进度",
215
216
  "allPlansHint": "上面是当前各会话最新计划的合计;历史计划不在此汇总,下面每张卡片只统计本计划。",
216
- "openHint": "打开左侧「任务进度」看完整安排。"
217
+ "openHint": "打开左侧「任务进度」看完整安排。",
218
+ "timeNegotiation": "时长协商",
219
+ "reasoningEffort": "推理等级",
220
+ "estimateMinutes": "预估时长",
221
+ "negotiatedCeiling": "协商上限",
222
+ "derived": "派生",
223
+ "negotiatedDeadline": "协商截止",
224
+ "startedAtLabel": "开始时间",
225
+ "remaining": "剩余",
226
+ "minutes": "分钟",
227
+ "seconds": "秒",
228
+ "timeExtensions": "延期记录",
229
+ "startNotice": "开工预告",
230
+ "timeWarning": "到点预警",
231
+ "pendingAdjudication": "待裁决",
232
+ "pendingAdjudicationHint": "到点后按安全兜底结算:等待主 Agent 决定延期 / 重试 / 接受。",
233
+ "noticeChannel": "预告通道",
234
+ "noticeChannelObserved": "已观测到送达",
235
+ "noticeChannelAwaiting": "等待观测",
236
+ "noticeChannelNotObserved": "未观测到送达",
237
+ "reason": "原因",
217
238
  },
218
239
  "en": {
219
240
  "groupLive": "In progress",
@@ -266,6 +287,7 @@ window.__ModuleLoader__.load({
266
287
  "phase": {
267
288
  "pending": "Not started",
268
289
  "planning": "Planning",
290
+ "clarify": "Waiting for info",
269
291
  "executing": "In progress",
270
292
  "integrating": "Wrapping up",
271
293
  "done": "Done",
@@ -409,7 +431,27 @@ window.__ModuleLoader__.load({
409
431
  "vizStageTitle": "Step progress",
410
432
  "vizOverall": "Overall progress",
411
433
  "allPlansHint": "These totals cover the latest plan in each live session; older plans are not included. Each card below counts only its own plan.",
412
- "openHint": "Open “Task progress” on the left for the full plan."
434
+ "openHint": "Open “Task progress” on the left for the full plan.",
435
+ "timeNegotiation": "Time negotiation",
436
+ "reasoningEffort": "Reasoning effort",
437
+ "estimateMinutes": "Estimate",
438
+ "negotiatedCeiling": "Negotiated ceiling",
439
+ "derived": "derived",
440
+ "negotiatedDeadline": "Negotiated deadline",
441
+ "startedAtLabel": "Started at",
442
+ "remaining": "remaining",
443
+ "minutes": "min",
444
+ "seconds": "s",
445
+ "timeExtensions": "Extensions",
446
+ "startNotice": "Start notice",
447
+ "timeWarning": "Approaching deadline",
448
+ "pendingAdjudication": "Awaiting decision",
449
+ "pendingAdjudicationHint": "Safety fallback at the deadline: the main agent will decide whether to extend, retry, or accept.",
450
+ "noticeChannel": "Notice channel",
451
+ "noticeChannelObserved": "Delivery observed",
452
+ "noticeChannelAwaiting": "Awaiting observation",
453
+ "noticeChannelNotObserved": "Delivery not observed",
454
+ "reason": "reason",
413
455
  }
414
456
  };
415
457
  function flattenLocale(source, prefix = '', out = {}) {
@@ -983,6 +1025,12 @@ window.__ModuleLoader__.load({
983
1025
  .dsh-wp-subtask-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; color: var(--dsw-alias-label-secondary); font-size: 12px; }
984
1026
  .dsh-wp-subtask-body { margin-top: 6px; }
985
1027
  .dsh-wp-subtask-body > div { margin-top: 4px; }
1028
+ /* [2.2.0][T3/O-2a][O-3b][O-4c] 时长协商信息块:预估 / 协商上限 / 延期 / 开工预告 / 预警 / 通道。
1029
+ 只做展示,全部由服务端状态行与计划定义提供;字段缺失时整块不渲染(降级不报错)。 */
1030
+ .dsh-wp-time { margin-top: 8px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--dsw-alias-line-1, rgba(148,163,184,.22)); background: rgba(148,163,184,.06); }
1031
+ .dsh-wp-time-title { font-size: 12px; font-weight: 650; color: var(--dsw-alias-label-secondary, #475569); margin-bottom: 4px; }
1032
+ .dsh-wp-time-row { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--dsw-alias-label-primary, #0f172a); font-variant-numeric: tabular-nums; }
1033
+ .dsh-wp-time-note { margin: 4px 0 0; font-size: 12px; color: var(--dsw-alias-label-secondary, #475569); overflow-wrap: anywhere; }
986
1034
  .dsh-wp-subtask-body p { margin-top: 2px; overflow-wrap: anywhere; }
987
1035
  .dsh-wp-error-text { color: var(--dsw-alias-state-error-primary); overflow-wrap: anywhere; }
988
1036
  .dsh-wp-muted { color: var(--dsw-alias-label-secondary); }
@@ -1111,6 +1159,11 @@ window.__ModuleLoader__.load({
1111
1159
  const number = Number(value);
1112
1160
  return Number.isFinite(number) ? Math.max(0, Math.min(100, Math.round(number))) : 0;
1113
1161
  }
1162
+ /** 只接受有限正数;0/NaN/负数一律视为「没有这个字段」,用于展示层降级。 */
1163
+ function positiveNumber(value) {
1164
+ const number = Number(value);
1165
+ return Number.isFinite(number) && number > 0 ? number : null;
1166
+ }
1114
1167
  function formatTime(value) {
1115
1168
  if (!value)
1116
1169
  return '';
@@ -1487,6 +1540,90 @@ window.__ModuleLoader__.load({
1487
1540
  function ErrorBanner({ message, onRetry, t }) {
1488
1541
  return h('div', { className: 'dsh-wp-banner dsh-wp-banner--error', role: 'alert' }, h('div', { className: 'dsh-wp-section-title' }, t('error')), h('div', { className: 'dsh-wp-error-text' }, message || t('noResult')), h('button', { type: 'button', className: 'dsh-wp-button', style: { marginTop: '8px' }, onClick: onRetry }, t('retry')));
1489
1542
  }
1543
+ /*
1544
+ * [2.2.0][T3/O-2a][O-3b][O-4c] 看板:时长协商信息(T1 台账 A2 的可见入口)。
1545
+ *
1546
+ * 只展示服务端已经下发的计划字段与状态行字段:
1547
+ * - 计划定义:estimateMinutes(预估)、timeoutMs(协商上限)、reasoningEffort(推理等级);
1548
+ * - 状态行:startedAt/deadlineAt(协商截止)、timeJournal(延期/预告历史)、
1549
+ * timeNotice(开工预告)、timeWarning(到点预警)、noticeChannel(子→主通道是否送达)、
1550
+ * pendingAdjudication(到点后的待裁决标记)。
1551
+ *
1552
+ * 客户端不推导状态机、不补造字段:任何字段缺失就少显示一行;全部缺失整块不渲染,
1553
+ * 绝不出现 undefined / [object Object]。
1554
+ */
1555
+ function TimeNegotiation({ item, subtask, t }) {
1556
+ const estimate = positiveNumber(subtask?.estimateMinutes);
1557
+ const deadlineAt = positiveNumber(item?.deadlineAt);
1558
+ const startedAt = positiveNumber(item?.startedAt);
1559
+ const journal = Array.isArray(item?.timeJournal) ? item.timeJournal : [];
1560
+ const extensions = journal
1561
+ .filter((entry) => entry?.action === 'extend' && positiveNumber(entry?.extendMs))
1562
+ .slice(-3);
1563
+ /*
1564
+ * [2.2.3][N2] D2「协商上限」结构性不可达:计划里没有 timeoutMs 时,
1565
+ * 用 deadlineAt - startedAt - 已延期 派生一个只读上限,明确标注“派生”,
1566
+ * 不写回计划、不把派生值冒充用户授权值。
1567
+ */
1568
+ const extensionTotal = extensions.reduce((sum, entry) => sum + Number(positiveNumber(entry?.extendMs) ?? 0), 0);
1569
+ const declaredCeiling = positiveNumber(subtask?.timeoutMs);
1570
+ const derivedCeiling = !declaredCeiling && startedAt && deadlineAt
1571
+ ? Math.max(0, deadlineAt - startedAt - extensionTotal)
1572
+ : null;
1573
+ const ceiling = declaredCeiling ?? derivedCeiling;
1574
+ const ceilingLabel = declaredCeiling ? t('negotiatedCeiling') : `${t('negotiatedCeiling')}(${t('derived')})`;
1575
+ const notice = item?.timeNotice && typeof item.timeNotice === 'object' ? item.timeNotice : null;
1576
+ const warning = item?.timeWarning && typeof item.timeWarning === 'object' ? item.timeWarning : null;
1577
+ const channel = item?.noticeChannel && typeof item.noticeChannel === 'object' ? item.noticeChannel : null;
1578
+ const pending = item?.pendingAdjudication === true;
1579
+ if (!estimate && !ceiling && !deadlineAt && !notice && !warning && !channel && !pending && extensions.length === 0) {
1580
+ return null;
1581
+ }
1582
+ const remainingMs = deadlineAt ? Math.max(0, deadlineAt - Date.now()) : null;
1583
+ const facts = [];
1584
+ if (estimate)
1585
+ facts.push(`${t('estimateMinutes')}:${estimate} ${t('minutes')}`);
1586
+ if (ceiling)
1587
+ facts.push(`${ceilingLabel}:${Math.round(ceiling / 60000)} ${t('minutes')}`);
1588
+ if (deadlineAt) {
1589
+ const left = remainingMs && remainingMs > 0
1590
+ ? `(${t('remaining')} ${Math.max(1, Math.round(remainingMs / 60000))} ${t('minutes')})`
1591
+ : '';
1592
+ facts.push(`${t('negotiatedDeadline')}:${formatTime(deadlineAt)}${left}`);
1593
+ }
1594
+ const notes = [];
1595
+ if (notice) {
1596
+ const declared = positiveNumber(notice.declaredMinutes);
1597
+ const reason = typeof notice.reason === 'string' && notice.reason
1598
+ ? `(${t('reason')}:${notice.reason.slice(0, 80)})`
1599
+ : '';
1600
+ notes.push(declared
1601
+ ? `${t('startNotice')}:${declared} ${t('minutes')}${reason}`
1602
+ : `${t('startNotice')}${reason}`);
1603
+ }
1604
+ if (extensions.length > 0) {
1605
+ notes.push(`${t('timeExtensions')}:${extensions.map((entry) => `+${Math.round(Number(entry.extendMs) / 60000)} ${t('minutes')}`).join(';')}`);
1606
+ }
1607
+ if (warning) {
1608
+ const remaining = positiveNumber(warning.remainingMs);
1609
+ notes.push(`${t('timeWarning')}:${remaining
1610
+ ? `${t('remaining')} ${Math.round(remaining / 1000)} ${t('seconds')}`
1611
+ : t('pendingAdjudication')}`);
1612
+ }
1613
+ if (channel) {
1614
+ const stateText = channel.state === 'observed' ? t('noticeChannelObserved')
1615
+ : channel.state === 'awaiting' ? t('noticeChannelAwaiting') : t('noticeChannelNotObserved');
1616
+ const reason = typeof channel.reason === 'string' && channel.reason
1617
+ ? `(${t('reason')}:${channel.reason})`
1618
+ : '';
1619
+ notes.push(`${t('noticeChannel')}:${stateText}${reason}`);
1620
+ }
1621
+ if (pending)
1622
+ notes.push(`${t('pendingAdjudication')}:${t('pendingAdjudicationHint')}`);
1623
+ return h('div', { className: 'dsh-wp-time' }, h('div', { className: 'dsh-wp-time-title' }, t('timeNegotiation')), facts.length > 0
1624
+ ? h('div', { className: 'dsh-wp-time-row' }, facts.map((fact, factIndex) => h('span', { key: String(factIndex) }, fact)))
1625
+ : null, notes.map((note, noteIndex) => h('p', { key: String(noteIndex), className: 'dsh-wp-time-note' }, note)));
1626
+ }
1490
1627
  function SubtaskRow({ item, subtask, index, t }) {
1491
1628
  const status = item?.status ?? 'pending';
1492
1629
  /*
@@ -1537,7 +1674,10 @@ window.__ModuleLoader__.load({
1537
1674
  const instructionOverdue = item?.instructionOverdue === true;
1538
1675
  const tone = closure === 'replanned' ? 'idle' : toneOfStatus(status);
1539
1676
  const pct = clampPct(item?.progress ?? 0);
1540
- return h('div', { className: `dsh-wp-subtask dsh-wp-tone-${tone}` }, h('div', { className: 'dsh-wp-subtask-head' }, h('div', { className: 'dsh-wp-subtask-title' }, `${workLabel(t, index)}:${subtask.title}`), closureLabel ? h(Pill, { tone: closureTone }, closureLabel) : null, instructionOverdue ? h(Pill, { tone: 'blocked' }, t('closureNoAck')) : null, h(Pill, { tone }, progressText(item, t))), h('div', { className: 'dsh-wp-subtask-meta' }, h('span', null, `${t('who')}:${deptName(t, subtask.department)} · ${subtask.role}`)), h('div', { className: 'dsh-wp-subtask-body' }, h('p', null, h('strong', null, `${t('what')}:`), subtask.objective), h('div', null, h('strong', null, `${t('how')}:`), h(Bullets, { items: subtask.method })), h('div', null, h('strong', null, `${t('doneWhen')}:`), h(Bullets, { items: subtask.acceptance })), subtask.outputs?.length ? h('div', null, h('strong', null, `${t('willDeliver')}:`), h(Bullets, { items: subtask.outputs })) : null, subtask.dependsOn?.length ? h('p', { className: 'dsh-wp-muted' }, `${t('waitFor')}:先等前面的工作做完,才能开始这一步。`) : null), status === 'in_progress' ? h(Progress, { value: pct, tone }) : null, status === 'in_progress' ? h('div', { className: 'dsh-wp-progress-meta' }, h('span', null, `${t('progressLabel')} ${pct}%`)) : null,
1677
+ const effort = typeof subtask?.reasoningEffort === 'string' && ['low', 'high', 'max'].includes(subtask.reasoningEffort)
1678
+ ? subtask.reasoningEffort
1679
+ : null;
1680
+ return h('div', { className: `dsh-wp-subtask dsh-wp-tone-${tone}` }, h('div', { className: 'dsh-wp-subtask-head' }, h('div', { className: 'dsh-wp-subtask-title' }, `${workLabel(t, index)}:${subtask.title}`), closureLabel ? h(Pill, { tone: closureTone }, closureLabel) : null, instructionOverdue ? h(Pill, { tone: 'blocked' }, t('closureNoAck')) : null, h(Pill, { tone }, progressText(item, t))), h('div', { className: 'dsh-wp-subtask-meta' }, h('span', null, `${t('who')}:${deptName(t, subtask.department)} · ${subtask.role}`), effort ? h(Pill, { tone: 'idle' }, `${t('reasoningEffort')}:${effort}`) : null), h('div', { className: 'dsh-wp-subtask-body' }, h('p', null, h('strong', null, `${t('what')}:`), subtask.objective), h('div', null, h('strong', null, `${t('how')}:`), h(Bullets, { items: subtask.method })), h('div', null, h('strong', null, `${t('doneWhen')}:`), h(Bullets, { items: subtask.acceptance })), subtask.outputs?.length ? h('div', null, h('strong', null, `${t('willDeliver')}:`), h(Bullets, { items: subtask.outputs })) : null, subtask.dependsOn?.length ? h('p', { className: 'dsh-wp-muted' }, `${t('waitFor')}:先等前面的工作做完,才能开始这一步。`) : null), h(TimeNegotiation, { item, subtask, t }), status === 'in_progress' ? h(Progress, { value: pct, tone }) : null, status === 'in_progress' ? h('div', { className: 'dsh-wp-progress-meta' }, h('span', null, `${t('progressLabel')} ${pct}%`)) : null,
1541
1681
  /*
1542
1682
  * [1.11.0] 跨部门需求(用户 m00687):提出方、指派对象、答复都必须在
1543
1683
  * 进度栏可见。否则用户只能从结果消息的一段文字里猜「这条需求谁在办、