dsh-workplan 2.1.5 → 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.
@@ -0,0 +1,37 @@
1
+ # 版本与变更基准冻结清单(T2 · 2026-11-09)
2
+
3
+ 采集时刻:2026-11-09T13:08+08:00;仓库:`/Users/open/Documents/Stocks/plugins/dsh-workplan`(`git rev-parse --show-toplevel` 确认为仓库根)。
4
+
5
+ ## 1. 版本号三处对照(A1)
6
+
7
+ | 口径 | 结果 | 证据 |
8
+ |---|---|---|
9
+ | package.json `version` | **2.2.6** | `node -e require('./package.json')` → `dsh-workplan@2.2.6` |
10
+ | 构建产物/源码标记 | **2.2.6** | `src/host.ts:1574` `version: '2.2.6'`;`[2.2.6]` 标记 src 12 处(plan.ts 8 / runtime.ts 3 / understanding.ts 1),lib 对应 plan.js 8 / runtime.js 3 / understanding.js 1,一一对应 |
11
+ | 索引源 & npm 已发布版本 | **2.1.5** | 插件目录索引 `dsh-plugin-catalog/index.json`(unpkg 拉取,目录版本 2026.1109.17642)中 dsh-workplan 仅登记 versions=[2.1.5];npm registry dist-tags.latest=2.1.5 |
12
+ | CHANGELOG 顶部条目 | 2.2.6 — 2026-11-08 | `head CHANGELOG.md` |
13
+
14
+ **冻结结论:本次发布的「最新版本」= 2.2.6**。已发布基准为 2.1.5(tag v2.1.5,commit 6ed12d3),2.1.5 之后全部 2.2.x 内容目前只存在于**未提交的工作区**。
15
+
16
+ ## 2. Git 基线与未提交变更(A2)
17
+
18
+ - 分支 `main`,HEAD `6ed12d32af03d22d5024eb1d9fbb1c20a7546781`(= tag v2.1.5 = 已发布基准)。
19
+ - 未提交变更:**30 个已跟踪文件修改 + 23 个未跟踪新文件**,含全部 2.2.x 源码(src/ 与 lib/ 10 组)、CHANGELOG.md、package.json/package-lock.json、13 个新测试、`release.sh`、`docs/release-records/*`、`src/notice-channel.ts` 等。
20
+ - **判定:包含**。版本号 2.2.6 只存在于未提交变更中,不提交则「发布 2.2.6」无从谈起——发布前必须先把这些变更作为 2.2.6 提交(该提交由发布脚本/T4-T5 执行,本清单已将其显式纳入范围,无静默纳入)。
21
+ - 构建产物新鲜度:T2 已执行 `npm run build`,build 后 lib/ 与当前 src 同源(编译成功、产物含 2.2.6 标记);发布脚本构建步骤再次构建即可保持同源。
22
+ - 遗留杂物:未跟踪 `dist-tests-t4/`、`handoff-need-serialization.test.ts`(根目录散件,tests/ 下已有同名)建议发布提交时不纳入或清理,由主 Agent 决定。
23
+
24
+ ## 3. 敏感信息初筛(A3)
25
+
26
+ - 密钥类模式(sk-/ghp_/AKIA/api_key/password/token 硬编码)扫描变更范围内文件:**0 命中 → 通过**。
27
+ - 本地绝对路径 `/Users/open`:4 处命中——`CHANGELOG.md:138/180/2233`、`RELEASING.md:61`、`docs/release-records/release-steps-20261106.md:3`、`release.sh:271`(含 W5_ROOT_LOG 默认值)。均为机器路径/日志路径,**非凭证**,泄露面为「暴露本机用户目录结构」,风险低。结论:**通过,附发现项**——建议 T3/T4 在发布文案与脚本中把 `/Users/open/...` 改写为相对路径或 `$(pwd)` 占位;若不处理亦可接受(公开仓库历史中已有同类)。
28
+ - 远端:`origin = git@github.com:abbaababa/dsh-workplan.git`(SSH),与索引源登记的 `github.com/abbaababa/dsh-workplan` 一致。
29
+
30
+ ## 4. 待发布内容清单(冻结范围)
31
+
32
+ 以「发布提交 = 当前工作区全部变更(30 修改 + 22 有效新文件,剔除 §2 杂物 2 项)」为冻结范围,版本号 2.2.6,构建产物 lib/ + client.js 由发布脚本构建步骤生成。凭证与推送执行属 T1/T4/T5 结论,本清单不预设。
33
+
34
+ ## 5. 待确认项(移交)
35
+
36
+ - 索引源提交协议(catalog 是第三方聚合索引,登记机制/是否需 PR 或自动同步 npm)→ T1/T6 结论。
37
+ - GitHub 凭证可用性(SSH key / gh CLI / token)→ T1 核查。
package/lib/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
  * 进度栏可见。否则用户只能从结果消息的一段文字里猜「这条需求谁在办、
@@ -54,6 +54,23 @@ export const COMM_FORMAT_SPEC = Object.freeze({
54
54
  description: '不得编造、虚构或伪造任何证据、文件路径、命令输出或验收结果;无法确认的项目必须写 unverified',
55
55
  rationale: '虚假证据一旦通过交付门禁,用户拿到的就是不可信的成品' }),
56
56
  ]),
57
+ /*
58
+ * [2.2.0][T3/O-2c] 结果块可选字段(方案 §2.4:「模板增加 timeSpentMinutes、
59
+ * finalEstimateMinutes 字段」;方案 §2.5:「时间字段纯 advisory:不参与可
60
+ * 交付判定,不加拒绝码」)。
61
+ *
62
+ * 纯增量:不属于 F1-F9 门禁条目(requirements 冻结不动、版本号不升),
63
+ * 缺失或不合法一律不判不合规——仅供用时回填与协商审计,adjudicateResult
64
+ * 以 readAdvisoryMinutes 透传。
65
+ */
66
+ optionalFields: Object.freeze([
67
+ Object.freeze({ name: 'timeSpentMinutes', type: 'integer', unit: '分钟', required: false,
68
+ description: '实际耗时回填(完成即回报时如实填写;未知可省略)',
69
+ semantics: 'advisory:不参与可交付判定,缺失/非法不判不合规' }),
70
+ Object.freeze({ name: 'finalEstimateMinutes', type: 'integer', unit: '分钟', required: false,
71
+ description: '最终预估回填(与开工前预告不一致时以此为准,用于协商审计)',
72
+ semantics: 'advisory:不参与可交付判定,缺失/非法不判不合规' }),
73
+ ]),
57
74
  });
58
75
  /**
59
76
  * 对子 Agent 的证据块执行沟通交流格式合规检查(F1-F8 自动核验;F9 为诚信约束不自动判)。
package/lib/host.js CHANGED
@@ -102,7 +102,13 @@ const PROMPT_SECTION = [
102
102
  */
103
103
  '5. 「完成」只有一个判据:计划里全部子任务都是 done,**且** deliveryReady=true(每个 done 项 verification="structured"、acceptance 非空且逐项 result="pass"、无缺失产物)。用户取消 ≠ 完成:取消只停止执行,未完成项仍然是未完成。`dsh_workplan_dispatch` 返回 ok:true / complete:true 只表示调用成功或状态全 done,必须再看 deliveryReady 与 完成 X/Y;只要 deliveryReady=false 或还有 pending/blocked,就禁止 present 交付物、禁止写“已完成/最终版/已交付”、禁止给收尾性最终答复,必须先再次调用 dsh_workplan_dispatch 续跑剩余项。',
104
104
  '6. 如果续跑被拒绝、受阻项无法恢复、证据补不齐、计划已取消但未完成,或用户要求先看中间结果:答复开头必须写「未完成:剩余 N 项(列出 ID)与原因」,正文只能按中间结果表述,不得包装成成品。取消不会给你交付许可。',
105
- '7. 子任务有硬执行上限(默认 15 分钟/步)与整轮预算(默认 20 分钟):子 Agent 接近上限时应先把已完成内容落盘并在结论里列出路径。任何「达到执行上限」「本轮预算用尽」都不等于「什么都没做」:状态里的 error 会列出「声明产物已在盘上」,必须先用文件核对;若产物已覆盖验收标准,用 dsh_workplan_update 复核改判,只补缺失部分再续跑,禁止无视盘上产物把整步重跑。',
105
+ /*
106
+ * [2.2.0][T5/O-5a] E1:超时是安全兜底(防止任务无限运行),不是交付期限。
107
+ * 旧句把「每步 15 分钟」的规模参考写成硬性上限,等于对外承诺固定完成时间;
108
+ * 改为「协商上限+安全兜底」,并给出 extendMs 协商入口。安全概念与事故溯源
109
+ * (上方 1.8.7/1.8.13 注释)全部保留,不删。
110
+ */
111
+ '7. 子任务的时间是「协商上限」+「安全兜底」,不是固定交付期限:规模参考 15 分钟量级(仅供参考、非承诺,实际时长由执行专家开工预告协商决定),整轮预算(默认 20 分钟)同样只是安全兜底,不是交付期限。子 Agent 接近上限时应先把已完成内容落盘并在结论里列出路径。任何「达到协商上限」「本轮预算用尽」都不等于「什么都没做」:状态里的 error 会列出「声明产物已在盘上」,必须先用文件核对;若产物已覆盖验收标准,用 dsh_workplan_update 复核改判,只补缺失部分再续跑,禁止无视盘上产物把整步重跑。确认需要更多时间时,主 Agent 可用 dsh_workplan_update 的 extendMs 协商放宽(放宽永远有界:累计超过初始协商上限的一倍即拒绝,转新轮续跑或转 escalate 请主 Agent/用户裁决)。',
106
112
  '8. 出现「待指示」项(closure=escalated,左侧栏显示「待指示」并附问题摘录)时,必须在当轮处理:用 dsh_workplan_instruct 下发决定(投递到子会话并把该行恢复为执行中),或确认放弃后用 dsh_workplan_update 置 blocked。不要沉默略过,也不要把待指示当成普通失败——它是一条还没被回答的请示,会一直占着交付门禁。',
107
113
  '9. 出现「已下发未响应」(ackOverdue)时,不要重复派发:先用 dsh_workplan_status 看该行 childId 与已等待时长,必要时用 dsh_workplan_followup 投递一次说明;超过硬超时仍未响应会记为 blocked(blockedKind=no-ack),可以再下发指示复活。',
108
114
  /*
@@ -164,6 +170,7 @@ function createUpdateTool(runtime) {
164
170
  + '当主 Agent 核对子任务结果、发现完成不实或需要修正时使用。'
165
171
  + '把子任务标成 done 时,必须同时给出真实的 verification 与 acceptance(每项 result="pass"),'
166
172
  + '否则计划不会变成可交付状态(deliveryReady=false,present 会被拒绝)。'
173
+ + '运行中的子任务需要更多时间时,传 extendMs(毫秒)即可协商放宽,不需要 force;放宽永远有界(累计 ≤ 初始协商上限 × 1),超出转新轮续跑或转 escalate 请主 Agent 裁决。'
167
174
  + '这些字段会写入会话日志,刷新/重启后仍然生效。',
168
175
  parameters: {
169
176
  type: 'object',
@@ -179,7 +186,7 @@ function createUpdateTool(runtime) {
179
186
  status: {
180
187
  type: 'string',
181
188
  enum: ['pending', 'in_progress', 'done', 'blocked'],
182
- description: '新的状态。',
189
+ description: '新的状态(普通改判必填;仅协商时限时可省略,改传 extendMs / timeNotice)。',
183
190
  },
184
191
  progress: {
185
192
  type: 'integer',
@@ -253,8 +260,40 @@ function createUpdateTool(runtime) {
253
260
  description: '待指示项(closure=escalated)的答复文本:与 status="in_progress" 一起使用,'
254
261
  + '会投递给子会话并把该行恢复为执行中。等价于 dsh_workplan_instruct。',
255
262
  },
263
+ /*
264
+ * [2.2.0][T5/O-4c] 延期事务(方案 §2.2 / §5.4;D-28 教训:runtime 会读取的
265
+ * 字段必须在这里显式声明,additionalProperties:false 会让未声明参数被严格
266
+ * 宿主直接拒收)。extendMs 只推移协商截止并重置计时,不改状态判定,运行中
267
+ * 无需 force(TASK_RUNNING 的唯一豁免);放宽永远有界(累计 ≤ 初始协商
268
+ * 上限 × 1),超出由 runtime 拒绝并转「请主 Agent 裁决」。
269
+ */
270
+ extendMs: {
271
+ type: 'integer',
272
+ description: '延期毫秒数(正整数,仅主 Agent 可用):只推移本子任务的协商截止并重置计时,'
273
+ + '不改状态判定;运行中可用,不需要 force。除非另传 status,否则可省略 status。'
274
+ + '放宽永远有界:累计延期 ≤ 初始协商上限的一倍,超出会被拒绝并提示转新轮续跑或转 escalate 请主 Agent 裁决。',
275
+ },
276
+ /*
277
+ * [2.2.0][T5/O-4c] O-2a 专家开工预告:{declaredMinutes, reason}。与 extendMs
278
+ * 同属「只记录、不改判定」的时限信息,运行中同样放行。
279
+ */
280
+ timeNotice: {
281
+ type: 'object',
282
+ description: '专家开工预告(O-2a):{ declaredMinutes, reason },只记入协商流水,不改状态与判定。',
283
+ properties: {
284
+ declaredMinutes: { type: 'number', description: '预计完成本子任务的分钟数(仅供参考、非承诺)。' },
285
+ reason: { type: 'string', description: '预告理由(可选)。' },
286
+ },
287
+ required: ['declaredMinutes'],
288
+ additionalProperties: false,
289
+ },
256
290
  },
257
- required: ['subtaskId', 'status'],
291
+ /*
292
+ * [2.2.0][T5/O-4c] status 不再是无条件必填:纯延期/纯预告事务(只带
293
+ * extendMs / timeNotice)是合法调用,runtime 会按「不改判定只改时限/记录」
294
+ * 处理;普通改判缺 status 仍由 runtime 以 INVALID_STATUS 拒绝。
295
+ */
296
+ required: ['subtaskId'],
258
297
  additionalProperties: false,
259
298
  },
260
299
  output: {
@@ -1015,14 +1054,49 @@ function createStatusTool(runtime) {
1015
1054
  + (identity ? `(${identity})` : ''));
1016
1055
  }
1017
1056
  const running = result.running === true;
1018
- return textContent(`计划 ${String(result.planId ?? '')}|${running ? '执行中' : '未在执行'}`
1019
- + `|阶段:${phaseLabel(result.phase)}`
1020
- + `|完成 ${Number(stats.done ?? 0)}/${Number(stats.total ?? 0)},受阻 ${Number(stats.blocked ?? 0)}`
1021
- + `|${result.deliveryReady === true ? '可交付' : '未就绪'}`
1022
- + (running && Number(result.elapsedMs ?? 0) > 0
1023
- ? `|已 ${Math.round(Number(result.elapsedMs) / 1000)}s`
1024
- : '')
1025
- + (identity ? `|${identity}` : ''));
1057
+ const planner = isRecord(result.planner) ? result.planner : null;
1058
+ const statuses = Array.isArray(result.statuses) ? result.statuses : [];
1059
+ /*
1060
+ * [2.2.3][N1] 模型可见面补齐:planner 与 noticeChannel 之前只进结构化
1061
+ * value,DSH 只把 render 文本写进对话,导致 D5/D1-b 结构性不可读。
1062
+ * 这里只做只读展示,不改变状态机;缺失字段不编造。
1063
+ */
1064
+ const plannerLine = planner
1065
+ ? `规划器:推理等级 ${String(planner.reasoningEffort ?? '未记录')}`
1066
+ + `|来源 ${String(planner.reasoningEffortSource ?? '未记录')}`
1067
+ + `|判定 ${String(planner.outcome ?? '未记录')}`
1068
+ + (typeof planner.model === 'string' && planner.model ? `|模型 ${planner.model}` : '')
1069
+ : '';
1070
+ const channelLines = statuses
1071
+ .filter((item) => isRecord(item?.noticeChannel))
1072
+ .slice(0, 12)
1073
+ .map((item) => {
1074
+ const channel = item.noticeChannel;
1075
+ const at = Number(channel.at) > 0
1076
+ ? new Date(Number(channel.at)).toLocaleString('zh-CN', { hour12: false })
1077
+ : '—';
1078
+ const observedAt = Number(channel.observedAt) > 0
1079
+ ? new Date(Number(channel.observedAt)).toLocaleString('zh-CN', { hour12: false })
1080
+ : '—';
1081
+ return `${String(item.subtaskId ?? '')} 通道:${String(channel.state ?? '')}`
1082
+ + `|target ${String(channel.target ?? '—')}`
1083
+ + `|caller ${String(channel.caller ?? '—')}`
1084
+ + `|at ${at}`
1085
+ + `|observedAt ${observedAt}`
1086
+ + `|reason ${String(channel.reason ?? '—')}`;
1087
+ });
1088
+ return textContent([
1089
+ `计划 ${String(result.planId ?? '')}|${running ? '执行中' : '未在执行'}`
1090
+ + `|阶段:${phaseLabel(result.phase)}`
1091
+ + `|完成 ${Number(stats.done ?? 0)}/${Number(stats.total ?? 0)},受阻 ${Number(stats.blocked ?? 0)}`
1092
+ + `|${result.deliveryReady === true ? '可交付' : '未就绪'}`
1093
+ + (running && Number(result.elapsedMs ?? 0) > 0
1094
+ ? `|已 ${Math.round(Number(result.elapsedMs) / 1000)}s`
1095
+ : '')
1096
+ + (identity ? `|${identity}` : ''),
1097
+ plannerLine,
1098
+ ...channelLines,
1099
+ ].filter(Boolean).join('\n'));
1026
1100
  },
1027
1101
  },
1028
1102
  async execute(args, exec) {
@@ -1113,7 +1187,9 @@ function createDispatchTool(runtime) {
1113
1187
  * call is killed while the dispatcher is still legitimately working and the
1114
1188
  * plan looks stuck. Derive it from the resolved limits.
1115
1189
  */
1116
- timeoutMs: Number(runtime?.limits?.totalTimeoutMs ?? 1200000) + 20000,
1190
+ timeoutMs: Number(runtime?.limits?.totalTimeoutMs ?? 0) > 0
1191
+ ? Number(runtime.limits.totalTimeoutMs) + 20000
1192
+ : 24 * 60 * 60 * 1000,
1117
1193
  async execute(args, exec) {
1118
1194
  const parsed = asObject(args) ?? {};
1119
1195
  return runtime.dispatchTool(exec.agent, parsed, exec.signal);
@@ -1185,17 +1261,18 @@ function booleanSetting(configValue, envName) {
1185
1261
  function settingEnv(envName) {
1186
1262
  return typeof process !== 'undefined' ? process.env?.[envName] : undefined;
1187
1263
  }
1188
- function numericSetting(configValue, envName) {
1264
+ function numericSetting(configValue, envName, allowZero = false) {
1265
+ const positive = (value) => Number.isFinite(value) && (allowZero ? value >= 0 : value > 0);
1189
1266
  if (configValue !== undefined && configValue !== null && configValue !== '') {
1190
1267
  const numeric = Number(configValue);
1191
- if (Number.isFinite(numeric) && numeric > 0)
1268
+ if (positive(numeric))
1192
1269
  return numeric;
1193
1270
  }
1194
1271
  const raw = typeof process !== 'undefined' ? process.env?.[envName] : undefined;
1195
1272
  if (raw === undefined || raw === '')
1196
1273
  return undefined;
1197
1274
  const numeric = Number(raw);
1198
- return Number.isFinite(numeric) && numeric > 0 ? numeric : undefined;
1275
+ return positive(numeric) ? numeric : undefined;
1199
1276
  }
1200
1277
  /**
1201
1278
  * Hard, tool-level guards. Kept as a pure function so the contracts can be
@@ -1230,9 +1307,10 @@ export function apply(ctx, config = {}) {
1230
1307
  },
1231
1308
  cwd: typeof config.cwd === 'string' ? config.cwd : undefined,
1232
1309
  plannerTimeoutMs: numericSetting(config.plannerTimeoutMs, 'DSH_WORKPLAN_PLANNER_TIMEOUT_MS'),
1310
+ plannerIdleTimeoutMs: numericSetting(config.plannerIdleTimeoutMs, 'DSH_WORKPLAN_PLANNER_IDLE_TIMEOUT_MS'),
1233
1311
  childTimeoutMs: numericSetting(config.childTimeoutMs, 'DSH_WORKPLAN_CHILD_TIMEOUT_MS'),
1234
1312
  idleTimeoutMs: numericSetting(config.idleTimeoutMs, 'DSH_WORKPLAN_IDLE_TIMEOUT_MS'),
1235
- totalTimeoutMs: numericSetting(config.totalTimeoutMs, 'DSH_WORKPLAN_TOTAL_TIMEOUT_MS'),
1313
+ totalTimeoutMs: numericSetting(config.totalTimeoutMs, 'DSH_WORKPLAN_TOTAL_TIMEOUT_MS', true),
1236
1314
  maxResumes: numericSetting(config.maxResumes, 'DSH_WORKPLAN_MAX_RESUMES'),
1237
1315
  /*
1238
1316
  * [1.10.6] 三态解析:显式配置 > 显式环境变量 > 默认开启。
@@ -1364,7 +1442,7 @@ export function apply(ctx, config = {}) {
1364
1442
  }
1365
1443
  export const meta = {
1366
1444
  name,
1367
- version: '2.1.5',
1445
+ version: '2.2.6',
1368
1446
  promptOrder: PROMPT_ORDER,
1369
1447
  routes: ['/dsh-workplan/plans', '/dsh-workplan/vendor/chart.umd.js'],
1370
1448
  };