dsh-workplan 1.10.6 → 1.11.0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,125 @@
1
+ ## 1.11.0 — 2026-11-02
2
+
3
+ **闭环契约 v1:为「派发 → 执行 → 遇阻 → 请示 → 指示 → 回报 → 进度 → 重规划」补上回执、上行请示与重规划通道;并如实标注本版仍未落地的深度下限。**
4
+
5
+ > 本版直接回应用户的 8 条质疑。判定沿用 T3:**3 条成立(③④⑥)、5 条部分成立(①②⑤⑦⑧)、0 条不成立**。
6
+ > 1.11.0 把 ①–⑧ 中「机制缺失」的部分全部补齐:派发回执、上行请示、下行指示与回执超时、完成必回报(沉默不再算成功)、验收逐条证据下限、就地重规划、左侧栏闭环徽标。**仍按设计延后的只有 SSE 推送(D1)、独立复核(D3)与预算/并发调参(D4)**——它们改变的是时延与成本,不是闭环是否存在。
7
+
8
+ ### 8 条疑问逐条处置
9
+
10
+ | # | 疑问 | T3 判定 | 1.11.0 处置 | 代码落点 | 尚余 |
11
+ |---|---|---|---|---|---|
12
+ | ① | 下发分解 | 部分成立 | **已修复(回执与下发确定性)**:计划消息点名「必须调用 `dsh_workplan_dispatch`」;派发即写 `closure:'assigned'` + `dispatchSeq`;子会话首个进度事件写 `acknowledged`;90s 未回执标 `ackOverdue`,180s 仍无事件判 `blocked/no-ack` 并中止该次尝试 | `src/plan.ts:1038-1039`;`src/runtime.ts:903`(assigned)、`996`(acknowledged)、`929`(90s)、`941-955`(180s) | 无模型参与的完全自动派发延后(D2:会绕过预算/权限判断) |
13
+ | ② | 执行深度 | 部分成立 | **已修复(深度下限)**:删掉「证据足够就立即汇报」,改为「每条验收标准至少一处可复核证据」;`acceptance[].result==='pass'` 但没有 `evidence` 时降级为 `unverified`(C-19),交付门禁据此继续拦;`strictCompletion` 默认开启,可用 `DSH_WORKPLAN_STRICT_COMPLETION=0` 回到宽松档 | `src/plan.ts`(`readEvidenceAcceptance` 降级、`deliveryReadiness` 证据 blocker)、子提示词「执行要求」段;`src/host.ts`(`strictCompletion` 三态解析) | 独立复核延后(D3)、预算/并发调参延后(D4);这两项是成本策略,不是深度下限 |
14
+ | ③ | 遇阻主动上报并请示 | 成立 | **已修复**:新增子会话工具 `dsh_workplan_escalate`(question 必填、按 `childId` 反查计划、写入 `blocked + closure:'escalated'` 并向父会话追加 `workplan-update`);子提示词强制「遇阻先上报、再停止等待」;工具不可用时结果块的 `question` 走文本兜底;父层提示第 8 条要求当轮处理待指示项 | `src/host.ts:593`;`src/runtime.ts:3761`、`3814`;`src/plan.ts:3204-3210`、`1705-1717`;`src/host.ts:115` | 300s 空闲仍按失败收束,不会自动改判 `escalated`(只有子 Agent 主动上报或结果块带 question 才升级) |
15
+ | ④ | 收到指示后是否执行 | 成立(子层) | **已修复**:新增根会话工具 `dsh_workplan_instruct`(仅根会话、仅 `closure:'escalated'`、仅直接子会话;`sendMessage` 投递成功后写 `closure:'instructed'` + `instruction` + `instructionSeq`;投递失败返回 `DELIVERY_FAILED` 且**不改状态**);指示写入 60s 无进展标 `instructionOverdue`、180s 仍无事件判 `blocked/no-ack`;子会话来重新激活时,`buildChildPrompt` 会把 `instruction.text` 注入提示词(不靠模型自己回想);续跑重置不再把 `instructed` 洗成 `pending` | `src/host.ts`(`createInstructTool`);`src/runtime.ts`(`instructSubtask`、`scheduleInstructionAck`);`src/plan.ts`(`buildChildPrompt` 指示注入、`resetBlockedStatuses` 跳过 instructed) | 投递失败后的自动重投仍由主 Agent 重试(状态保持 `escalated`,不会假称已指示) |
16
+ | ⑤ | 完成后主动回报 | 部分成立 | **已修复**:结构化证据块成为完成的必要条件——没有证据块、又没写 `BLOCKED:` 的结果判 `blocked/unverified`(C-05,沉默不再算成功);结果消息写成功后才由 `markReported` 把 `done` 行标 `closure:'reported'` + `report{state,at,ref,turn}`;`closure:'done'` 且 `updatedBy:'child'` 的行进交付 blocker;记录级 `reportPending` 同样拦交付;旧日志无 `closure` 时按 1.10.6 语义回放(done 视为已回报),避免升级后所有历史计划不可交付 | `src/plan.ts`(`adjudicateResult` 严格分支、`deliveryReadiness`);`src/runtime.ts`(`markReported`、`settleFromOutput` 的 `closure:'done'`);`src/host.ts`(`strictCompletion`) | 无 |
17
+ | ⑥ | 需求变更及时重规划 | 成立 | **已修复**:新增根会话工具 `dsh_workplan_replan`(`cancel`/`replace`/`add`);执行中出现的新要求不再被丢弃,先暂存为 `changeRequest` 并由 pre-step 通知主 Agent 判定;旧行保留 `closure:'replanned'` + `supersededAt`/`replacedBy`,不计入剩余分母、不再调度、不再参与交付门禁;`planRevision` 随修订递增;未落实的变更进交付 blocker | `src/host.ts:308`(注册 `1013`);`src/runtime.ts:2973`、`5153`、`5212`;`src/replan.ts`;`src/plan.ts:2820`、`2888` | 变更语义仍由主 Agent 判定、代码只检测与暂存(E7,按设计) |
18
+ | ⑦ | 左侧栏进度同步 | 部分成立 | **已修复(展示半边)**:`serialisePlan` 在同一快照中下发 `closure`/`replacedBy`/`report`/`planRevision`/`blockedKind`/`question`/`instruction`;客户端按服务端字段渲染闭环全档徽标——「待你决定」「已给指示 · 待执行」「已下发 · 待回应」「已回应 · 执行中」「完成 · 待回报」「已回报」「已重规划」;仍不持本地状态机,仍是写入后 ≤4s 的同一轮询链 | `src/runtime.ts`(`serialisePlan`);`src/client.ts`(`SubtaskRow` 的 closure 分支与文案) | SSE 实时推送延后(D1):现状是 ≤4s 有界延迟,不是不同步 |
19
+ | ⑧ | 底层机制/逻辑 | 部分成立 | **部分修复**:新增与四值 `status` 正交的 `closure` 九状态(`pending/assigned/acknowledged/instructed/escalated/blocked/done/reported/replanned`),`STATUSES` 仍为四值;唯一写入口仍是 `applyStatus`;非法 `closure` 抛 `INVALID_CLOSURE`;契约外迁移抛 `INVALID_TRANSITION`(`CLOSURE_TRANSITIONS` 白名单,`replanned` 为终态);`escalated` 必须同时是 `blocked`;四个新工具的服务端权限硬校验(子会话/根会话、直接子会话、待指示状态)不依赖提示词 | `src/plan.ts:110`(STATUSES 未扩)、`123-133`(CLOSURES)、`1976-1980`、`2278-2281`;`src/host.ts:1005-1013` | D1–D4 延后;②⑤ 的上述缺口仍属机制未闭合——见 G1–G3 |
20
+
21
+ ### 跨部门协作闭环(本版新增,回应用户追加要求)
22
+
23
+ > 追加要求原文:**「对于需要跨部门协作的时候,现有的这个插件是否有对应的完美机制,你必须同样全面、深入、全面地毯式、深入排查、诊断和修正。严禁发生不合理、不完美的跨部门协作机制。」**
24
+
25
+ 1.10.6 的跨部门协作只有三件事:子任务带 `department`、兄弟部门进展通过 `buildTeamBrief` 只读展示、`needs` 以一段文字出现在结果消息的「跨部门待转达」里。它没有生命周期,也不进交付门禁:主 Agent 忘掉一条需求,计划照样可以 `present`。
26
+
27
+ 1.11.0 把它补成一条可追踪、可处置、可验证的闭环:
28
+
29
+ - **需求自动登记**:`applyStatus` 在写入 `needs` 时同步生成 `handoffs`(`H1`、`H2`…),字段为 `{id, request, department, status, response, at, updatedAt, by}`,去重键是需求原文。任何写路径(子 Agent 结算、结果消息回放、人工改判)都无法只留一段文字而不留下可追踪记录。
30
+ - **四态生命周期**:`open`(已提出,未处置)→ `routed`(已指派部门)→ `answered`(已给出书面答复或产物引用)/ `closed`(判定无需动作)。只有 `answered` / `closed` 解除交付阻塞;`open` / `routed` 会在 `deliveryReadiness` 里生成「跨部门需求未落实」blocker,`present` 被拒绝。
31
+ - **唯一处置入口**:新增根会话工具 `dsh_workplan_handoff`(`list` / `assign` / `resolve` / `close`),服务端 `isRootSession` 硬校验;子 Agent 只能提出需求,不能宣称需求已解决。处置结果写回同一条状态行并追加可回放的 `workplan-update`。若提出需求的行正处于「待指示」,`resolve` 会复用 `instructSubtask` 的投递与回执链路把答复直接送进子会话——只改计划表、不唤醒等待方的「闭环」不算闭环。
32
+ - **答复回到提出方**:子任务下次被激活时,`buildChildPrompt` 把已答复的需求(含答复正文)与仍在等待的需求一起注入提示词;等待中的明确要求「不要重复上报、先做不依赖它的部分」。
33
+ - **交接物可消费**:派发时为下游注入的依赖结果不再只有状态与摘要,还带上游 `artifacts[].exists===true` 的产物引用(`runtime.ts` 的 `dependencyResults` 映射),跨部门交接从「知道做完了」变成「知道产物在哪」。
34
+ - **进度栏可见**:`SubtaskRow` 渲染每条需求的编号、原文、指派部门、四态文案与答复,用户不必从结果消息里猜「这条需求谁在办」。
35
+ - **测试**:`tests/workplan-closure-n1-n5.test.ts` 覆盖「needs 自动登记 → 未处置拦交付 → 指派后仍拦 → 答复后放行」与去重、回放;`npm test` 363 / 363 通过。
36
+
37
+ ### 交付门禁收紧(跨部门审计 T4/T5/T8/T10 的阻断项)
38
+
39
+ 第二轮地毯式审计(`_t5_contract_20261102/`、`_t8_scenario_20261102/`、`_t10_defect_triage_20261102/`,79 条来源缺陷去重为 54 条)确认本版还有两处**阻断级**缺口。它们不是新功能,而是「计划说完成了、其实没完成」的放行路径,本版一并堵住:
40
+
41
+ - **验收不可自证(D-01)**:`adjudicateResult` 原先只检查证据自身的 `result/evidence`,计划写的 5 条验收可以被一条「自创验收项:pass」全部绕开。现在裁决与交付门共用 `acceptanceCoverage`:证据必须逐条回应计划验收(允许措辞差异,短文本只接受等值),少一条即 `blocked/unverified`,交付阻塞写明「验收项未被逐条回应(N/M)」。
42
+ - **未验收上游不得解锁下游(D-02)**:调度门的 `dependencyOk` 原先只看 `status==='done'` 与缺失产物;上游 `unverified/failed` 时下游照常开跑。现在 `unverified/failed` 一律不放行(`legacy` 旧日志与 `structured` 仍放行,避免历史计划整体卡死)。
43
+ - **cancel 悬挂下游(D-13)**:`replan cancel` 不重写下游 `dependsOn`,下游会永久 `pending`。现在派发与交付判定前由 `blockCancelledDependents` 把这类下游显式标 `blocked`,并写明「请用 replan 重新安排或取消」。
44
+ - **级联不再撞非法迁移(F6-01)**:`markDependentsBlocked` 跳过 `closure:'replanned'` 的历史行,避免 `replanned → blocked` 抛 `INVALID_TRANSITION` 污染整轮。
45
+ - **replan 与首次规划同强度(D-T4-03/04)**:`add/replace` 校验 `dependsOn≤12`、`method/inputs/outputs≤12`、`acceptance 1–8`、字符串长度;容量只数未 `superseded` 的活跃行,满编 15 项时也能 replace;新阶段 ID 撞名时追加后缀,保证新任务始终在末尾。
46
+ - **子会话不得直接交付(T7 P9)**:`present` 的守卫对非根会话不再放行,返回 `NOT_ROOT`「子 Agent 不能直接交付」;交付只属于根会话。
47
+
48
+ 以上 6 条均有 `tests/workplan-crossdept-hardening.test.ts` 回归(9 条)与 `tests/present-deny-code.test.ts` 的码值契约更新。
49
+
50
+ ### 走查修正(T10 端到端报告 N1–N5)
51
+
52
+ 端到端走查(`_t10_walkthrough_20261102/`)在已完成机制上又发现 5 处「机制对了、读出来的样子不对」,本版一并修复:
53
+
54
+ - **N1 阶段分母双口径**:`planStageRows` 现在过滤 `supersededAt` 旧行;重规划后不再出现「头部 100%、阶段条 1/2」。
55
+ - **N2 等指示被当成可续跑**:`canResumePlan` 跳过 `closure:'escalated'` 的行;「待你决定」不再显示为可续跑,也不消耗续跑额度。
56
+ - **N3 指示后仍显示卡住**:`reconcilePhase` 允许 `blocked` 在有活跃行时对账为 `executing`,`instructSubtask` 写入后立即重算 `record.phase`。
57
+ - **N4 指示回执字段被丢弃**:`applyStatus` 增加 `instructionOverdue` 分支并可回放;`scheduleInstructionAck` 新增 5s 轮询,子会话一有新事件就写 `acknowledged` 并撤销 60s/180s 定时器(正常工作但较慢的子会话不会再被误判 no-ack);进度栏新增「指示还没被执行」徽标。
58
+ - **N5 变更正文不进进度栏**:卡片新增「需求变更待落实」横幅,显示变更原文与「本轮结束后重规划、不会丢失」的说明。
59
+
60
+ ### 机制改动明细
61
+
62
+ - **派发回执**:`runtime.ts:903` 在启动子会话后写 `closure:'assigned'`、`assignedAt`、`dispatchSeq`;同一 `dispatchSeq` 的第一个进度事件写 `acknowledged`(`runtime.ts:996`)并撤销两个定时器;90s 写 `ackOverdue`(`runtime.ts:929`),180s 写 `blocked/blockedKind:'no-ack'` 并 abort(`runtime.ts:941-955`)。重试是全新尝试,旧的 `ackedAt`/`escalatedAt`/`question` 一律清空。
63
+ - **上行请示**:`dsh_workplan_escalate` 只接受子会话,按 `childId` 反查父计划(不信自报 `subtaskId`),`question` 必填、`options` 最多 6 条;写入 `blocked + closure:'escalated' + blockedKind:'escalated'` 并向父会话追加一条 `workplan-update`(`runtime.ts:3814-3862`)。子会话拿不到工具时,结果块里的 `question` 由 `adjudicateResult` 解析并走同一 `escalated` 投影(`plan.ts:1705-1717`、`runtime.ts:739-750`)。
64
+ - **下行指示**:`dsh_workplan_instruct` 校验根会话、`closure==='escalated'`、直接子会话,`sendMessage` 成功后写 `status:'in_progress' + closure:'instructed'`,并 append 同一条 update 供回放(`runtime.ts:3883-3985`);失败路径 `DELIVERY_FAILED` 明确提示「状态未改变」。
65
+ - **完成回报**:`markReported` 是唯一写入点(`runtime.ts:3489`),只处理 `status:'done'` 的行,已 `reported` 的不重复写;`deliveryReadiness` 新增「`closure:'done'` 且 `updatedBy:'child'`」与记录级 `reportPending` 两类 blocker(`plan.ts:2842`、`2892`)。
66
+ - **重规划**:`src/replan.ts`(569 行)承载 `cancel/replace/add` 的纯函数;`runtime.ts:2973` 的 `replanPlan` 负责权限、修订号与持久化,执行中调用返回 `REPLAN_PLAN_RUNNING` 并保留 `changeText`;`plan.ts:2820` 把 `replanned` 行从剩余分母剔除,`runtime.ts:95-108` 让其不进入调度。
67
+ - **完成判定收紧**:`adjudicateResult` 的 `!parsed.found` 分支从 `done/legacy` 改为 `blocked/unverified`;`readEvidenceAcceptance` 把「宣称 pass 但没有 evidence」降级为 `unverified`;`deliveryReadiness` 对无证据的 pass 另记一条 blocker。严格档默认开启,`strictCompletion:false` / `DSH_WORKPLAN_STRICT_COMPLETION=0` 可回放旧行为。
68
+ - **状态机闸门**:`CLOSURE_TRANSITIONS` 逐状态列出合法出边,`applyStatus` 在投影校验之前拒绝契约外迁移;重试的 `blocked→assigned`、结果回放的 `pending→reported` 是两条显式例外。
69
+ - **指示闭环**:`instructSubtask` 投递成功后启动 60s/180s 两级回执定时器;`buildChildPrompt` 在 `closure:'instructed'` 时把 `instruction.text` 注入子提示词;`resetBlockedStatuses` 不再重置 `instructed` 行,避免续跑把指示静默抹掉。
70
+ - **进度读取**:字段全部来自 `serialisePlan` 的同一次快照;HTTP 仍只有一个 `/dsh-workplan/plans` GET;客户端 4s 轮询、按服务端 `closure` 渲染徽标,不做状态推导(`client.ts` 的 `SubtaskRow`)。
71
+
72
+ ### 行为变化(非破坏性)
73
+
74
+ - 子任务派发后若 180s 内没有任何事件,状态会显示 `blocked`(原因 `no-ack`)而不是一直 `in_progress`,并中止该次子会话;重试策略不变(仍最多一次)。
75
+ - 子 Agent 主动上报遇阻后,该行保持 `blocked + escalated`;父会话必须用 `instruct` 回答或显式改判 `blocked`,交付门禁不会把它当成已完成。
76
+ - `done` 行只有在结果消息确实写入会话后才变为 `reported`;写失败时整轮记 `reportPending`,下一次交付被拦。
77
+ - 执行中收到的新要求会生成 `changeRequest` 并在 pre-step 提示,主 Agent 必须 `replan`/`dispatch`/`cancel` 三选一,不能再静默略过。
78
+
79
+ ### 破坏性变更
80
+
81
+ **无。**
82
+
83
+ - `PLAN_VERSION` 保持 `1`(`src/plan.ts:14`),消息格式未变;
84
+ - 未删除或改名任何既有字段/工具,新增字段均为可选;
85
+ - `STATUSES` 仍是 `pending/in_progress/done/blocked` 四值(`src/plan.ts:110`),四值语义、计数与门禁不变;
86
+ - 旧日志没有 `closure` 时按 `null` 回放,`done` 行按 1.10.6 语义视为已回报(`src/plan.ts:1890`);
87
+ - 新增的 `escalate`/`instruct`/`replan` 是纯增量工具,旧工具的参数面未变。
88
+
89
+ ### 迁移与安装
90
+
91
+ **不需要迁移数据或改历史计划。** 升级后旧会话重新打开时按原语义回放;`closure` 为空的旧行不会被误判成「未回报」。
92
+
93
+ ```bash
94
+ dsh plugin --profile web add dsh-workplan@1.11.0
95
+ ```
96
+
97
+ 装完重启一次 DSH Web(或重新载入页面)。
98
+
99
+ ### 测试
100
+
101
+ `npm test`:**363 / 363 通过**(`src` + `tests` 全量,含 `tests/version-sync.test.ts` 对版本位点、CHANGELOG 标题与 README 安装命令的一致性断言)。新增用例:`tests/workplan-crossdept-hardening.test.ts`(验收覆盖、未验收上游、cancel 悬挂、replan 容量与字段强度 9 条)、`tests/workplan-closure-ack-escalation.test.ts`(9 条)、`tests/workplan-replan-progress.test.ts`、`tests/workplan-closure-n1-n5.test.ts`(走查修正 + 跨部门闭环 5 条)、`tests/workplan-evidence-contract.test.ts` 增补 3 条(严格判定、`strict=false` 兼容档、C-19 证据降级);`tests/workplan-host-schema.test.ts` 纳入四个新工具的 schema(escalate / instruct / replan / handoff)。
102
+
103
+ ### 未包含(列入 1.12 的入口)
104
+
105
+ - **D1** SSE 推送:左侧栏继续 4s 轮询(写入后 ≤4s 可见,不是「不同步」)。
106
+ - **D2** 完全自动派发:会绕过预算/权限判断,保持「计划消息点名 + 收尾闸门」。
107
+ - **D3** 独立复核/深度下限:需要第二套模型预算与复核判定标准。
108
+ - **D4** 预算/并发/maxDepth 调参:900s/1200s/5 并发是现有安全边界,需基准后再动。
109
+
110
+ ### 本版固化的闭环语义(发布前自查)
111
+
112
+ - **状态机有闸门**:`applyStatus` 拒绝契约外迁移(`INVALID_TRANSITION`),`replanned` 是终态;重试路径(`blocked → assigned`)与结果回放(`pending → reported`)是显式允许的两条例外。
113
+ - **完成必须有证据**:无证据块 → `blocked/unverified`;`pass` 无 `evidence` → 降级 `unverified`;完成但未回报 → 交付 blocker。
114
+ - **指示必须能到、能被确认**:`instructed` 行在下次激活时把指示注入子提示词;60s/180s 两级回执超时;续跑重置跳过 `instructed`/`escalated`。
115
+ - **进度栏与服务端同源**:客户端只渲染 `serialisePlan` 下发的 `closure`,不推导状态。
116
+
117
+ ### 仍按设计延后(不是缺口)
118
+
119
+ - **D1** SSE 推送:「写入后 ≤4s 可见」是有界延迟;改为推送属于性能优化,1.12 入口。
120
+ - **D3** 独立复核:需要第二套模型预算与复核判定标准。
121
+ - **D4** 预算/并发/maxDepth 调参:900s/1200s/5 并发是安全边界,需基准后再动。
122
+
1
123
  ## 1.10.6 — 2026-11-01
2
124
 
3
125
  **修复:单个子任务超时后的「自动重试一次」在真实链路里是死代码;自动续跑开关默认关闭,等于从来没有打开过。**
package/README.en.md CHANGED
@@ -53,14 +53,14 @@ For every new task with a real goal, the plugin inserts three beats:
53
53
 
54
54
  Greetings, thanks, and status questions ("how far along are we?") do not trigger a plan.
55
55
 
56
- ## How departments collaborate (what 1.7.1 actually does)
56
+ ## How departments collaborate (what 1.11.0 actually does)
57
57
 
58
58
  Every work item carries a department label (Engineering, Research, Design, Product, Data, QA, Security, DevOps, Writing, Operations, Legal, Finance). **The label drives the prompt and the stats, not an org chart**:
59
59
 
60
60
  - Departments **cannot talk to each other directly**. Cross-department information goes through the main agent, or through files both sides can read.
61
61
  - A downstream task sees only the **summary** of its `dependsOn` upstreams — not sibling tasks, not the upstream's full conversation. Upstreams must put the artifact's absolute path and acceptance steps in the summary.
62
62
  - A stage is a display grouping, **not an execution gate**; `dependsOn` decides order.
63
- - Each child receives a **read-only brief of its sibling tasks** (who, what, expected outputs, summaries of finished work). It cannot contact them directly: cooperation requests go into `needs`, and the result message collects them under "cross-department hand-offs" for the main agent.
63
+ - Each child receives a **read-only brief of its sibling tasks** (who, what, expected outputs, summaries of finished work). It cannot contact them directly (a deliberate permission boundary): cooperation requests go into `needs`. Every need is registered as a numbered hand-off (`open → routed → answered/closed`), visible in the result message and in `status`, and **unresolved needs block delivery**. The main agent resolves them with `dsh_workplan_handoff`; when the asking row is waiting for direction, `resolve` delivers the answer straight into that child session.
64
64
  - A child returns a structured evidence block (`status` / `acceptance` / `artifacts` / `needs`). **Non-empty output no longer means done**: `partial`, any failed acceptance item, or an unparsable block is blocked; only all-`pass` is trusted directly, everything else is flagged "unverified" for the main agent.
65
65
  - Declared `file` artifacts are checked; a missing artifact keeps downstream tasks locked and names the upstream plus the missing file.
66
66
 
@@ -77,7 +77,7 @@ The full contract — roles, data shapes, state machine, recovery, and the three
77
77
  ## Install
78
78
 
79
79
  ```bash
80
- dsh plugin --profile web add dsh-workplan@1.10.6
80
+ dsh plugin --profile web add dsh-workplan@1.11.0
81
81
  ```
82
82
 
83
83
  Restart the DSH Web process (or reload the page) so the bundle is picked up.
@@ -112,6 +112,11 @@ Every number is derived from the same task state — the panel can no longer cla
112
112
  | `dsh_workplan_status` | Read-only: ask how far along the plan is. Rebuilt from the session log, so it survives a restart or reload. |
113
113
  | `dsh_workplan_update` | Main agent only: correct a subtask's status and evidence. Takes `expectedRevision` to prevent lost updates; in-flight subtasks are refused unless `force:true`. |
114
114
  | `dsh_workplan_cancel` | Cancel a plan that has not been dispatched; never fabricates completion. |
115
+ | `dsh_workplan_replan` | Amend in place when the request changes: `cancel` / `replace` / `add`. Superseded rows are kept as history; the plan revision increases. Main agent only. |
116
+ | `dsh_workplan_escalate` | A child reports a blocker mid-run (question, options, recommendation) into the state machine and waits for direction, instead of only writing `BLOCKED` at the very end. |
117
+ | `dsh_workplan_instruct` | The main agent answers an escalation and issues direction; if delivery fails the instruction is queued for the next activation. Ack checks at 60s/180s. |
118
+ | `dsh_workplan_handoff` | Resolve cross-department needs: `list` / `assign` / `resolve` / `close`. Unresolved needs block delivery; when the asking row is waiting for direction, `resolve` delivers the answer straight into the child session. |
119
+ | `dsh_workplan_followup` | Send a closing note to a direct child that was stopped by budget/timeout but already wrote its artifacts. |
115
120
 
116
121
  In **plan mode** the plan is shown for review and `dispatch` is explicitly refused with a reason.
117
122
 
package/README.md CHANGED
@@ -66,7 +66,7 @@ grep -RInE "child_process|execSync|eval\(|writeFileSync" src || echo "0 命中
66
66
  ## 一键安装
67
67
 
68
68
  ```bash
69
- dsh plugin --profile web add dsh-workplan@1.10.6
69
+ dsh plugin --profile web add dsh-workplan@1.11.0
70
70
  ```
71
71
 
72
72
  装完**重启一次 DSH Web**(或重新载入当前页面)让插件生效。
@@ -97,7 +97,7 @@ dsh plugin --profile web add "$(pwd)"
97
97
 
98
98
  纯打招呼、道谢、问「做到哪了」不会触发拆解,不会平白多出一堆子 Agent。
99
99
 
100
- ## 四个模型工具(你不用直接调用)
100
+ ## 九个模型工具(你不用直接调用)
101
101
 
102
102
  | 工具 | 作用 |
103
103
  |---|---|
@@ -105,14 +105,19 @@ dsh plugin --profile web add "$(pwd)"
105
105
  | `dsh_workplan_status` | 只读:问到哪了。重启或刷新后也能从会话记录重建。 |
106
106
  | `dsh_workplan_update` | 主 Agent 核对结果、修正某个子任务状态与证据。带 `expectedRevision` 防覆盖,运行中默认拒绝(`force:true` 才覆盖)。子 Agent 不能调用。 |
107
107
  | `dsh_workplan_cancel` | 取消还没派发的计划,不会伪造任何「已完成」。 |
108
+ | `dsh_workplan_replan` | 需求变更时就地修订:`cancel` / `replace` / `add`,旧行标为「已取代」保留可追溯,计划版本号递增。主 Agent 专用。 |
109
+ | `dsh_workplan_escalate` | 子 Agent 执行中遇阻上报:问题、选项、建议进状态机,等主 Agent 指示;不再是「只能憋到结尾写 BLOCKED」。 |
110
+ | `dsh_workplan_instruct` | 主 Agent 回答请示并下达指示;失败则挂起,子任务下次激活时注入。带 60s/180s 回执检查。 |
111
+ | `dsh_workplan_handoff` | 处置跨部门需求:`list` / `assign` / `resolve` / `close`。未处置会拦住交付;对「待指示」的行 `resolve` 会直接把答复投递给子会话。 |
112
+ | `dsh_workplan_followup` | 给预算/超时中止、但产物已落盘的直接子会话补一条收尾说明。 |
108
113
 
109
114
  在 **plan 模式**下只会给你看计划,`dispatch` 会被明确拦下并说明原因,不会偷偷开跑。
110
115
 
111
- ## 部门怎么协作(1.7.1 的真实能力)
116
+ ## 部门怎么协作(1.11.0 的真实能力)
112
117
 
113
118
  计划里的每件工作都带一个部门标签(工程研发、研究分析、设计、产品、数据、质量验证、安全、运维、文档写作、运营、法务合规、财务)。**标签决定提示词与统计口径,不是组织架构**:
114
119
 
115
- - 部门之间**不能直接对话**;跨部门信息由主 Agent 转达,或落到双方都能读的工作区文件。但每个子 Agent 的提示词里会带上**兄弟部门的只读一览**(谁、做什么、产出什么、已完成摘要),需要协作就写进 `needs`,结果消息会汇总成「跨部门待转达」交给主 Agent 逐条处理。
120
+ - 部门之间**不能直接对话**(这是刻意的权限边界);跨部门信息由主 Agent 转达,或落到双方都能读的工作区文件。但每个子 Agent 的提示词里会带上**兄弟部门的只读一览**(谁、做什么、产出什么、已完成摘要),需要协作就写进 `needs`;每条 needs 会自动登记成带编号的跨部门需求(`open → routed → answered/closed`),结果消息与 `status` 都能看到,**未处置就拦住交付**。主 Agent 用 `dsh_workplan_handoff` 逐条处置;提出需求的行若正在等指示,`resolve` 会把答复直接投递给该子会话。
116
121
  - 下游只看到 `dependsOn` 里上游的**摘要**与完整体检结果,看不到上游的完整对话。所以上游必须把「产物绝对路径 + 怎么验收」写进摘要;声明为 `file` 的产物会被逐个核实,**缺失就不给下游解锁**。
117
122
  - 子 Agent 在输出末尾回传结构化证据块(`status` / `acceptance` / `artifacts` / `needs`)。**非空输出不再等于完成**:`partial`、任一条验收失败、坏块都判受阻,只有全 `pass` 才可直接采信,其余在结果消息里标「未验证」等主 Agent 核对。
118
123
  - 阶段(stage)只是展示分组,**不是执行门槛**;真正决定先后的是 `dependsOn`。
package/client.js CHANGED
@@ -84,6 +84,13 @@ window.__ModuleLoader__.load({
84
84
  "done": "做好了",
85
85
  "blocked": "卡住了"
86
86
  },
87
+ "handoff": {
88
+ "open": "待处置",
89
+ "routed": "已指派",
90
+ "answered": "已答复",
91
+ "closed": "无需动作"
92
+ },
93
+ "handoffs": "跨部门需求",
87
94
  "dept": {
88
95
  "engineering": "工程研发",
89
96
  "research": "研究分析",
@@ -122,6 +129,18 @@ window.__ModuleLoader__.load({
122
129
  "notDeliverable": "还不能交付",
123
130
  "notDeliverableHint": "「全部做完」不等于「可以交付」:交付还需要每一行都有可核对的证据。下面是没有通过的部分。",
124
131
  "progressLabel": "进度",
132
+ "closureReported": "已回报",
133
+ "closureDone": "完成 · 待回报",
134
+ "closureAssigned": "已下发 · 待回应",
135
+ "closureAcknowledged": "已回应 · 执行中",
136
+ "closureInstructed": "已给指示 · 待执行",
137
+ "closureEscalated": "待你决定",
138
+ "closureRunning": "执行中",
139
+ "closureNoAck": "指示还没被执行",
140
+ "changePending": "需求变更待落实",
141
+ "changePendingHint": "你在执行中提出的变更已记录,本轮不会中途改写正在跑的任务;本轮结束后会按新需求重规划,已发出的变更不会丢失。",
142
+ "closureReplanned": "已重规划",
143
+ "closureReplannedTo": "已重规划 → 修订 {ids}",
125
144
  "more": "更多细节(不看也不影响理解)",
126
145
  "why": "为什么这样安排",
127
146
  "whyHint": "先找出最关键的问题,再按顺序解决;每一步做完先检查,再决定下一步。",
@@ -260,6 +279,13 @@ window.__ModuleLoader__.load({
260
279
  "done": "Done",
261
280
  "blocked": "Stuck"
262
281
  },
282
+ "handoff": {
283
+ "open": "Open",
284
+ "routed": "Assigned",
285
+ "answered": "Answered",
286
+ "closed": "No action"
287
+ },
288
+ "handoffs": "Cross-team needs",
263
289
  "dept": {
264
290
  "engineering": "Engineering",
265
291
  "research": "Research",
@@ -298,6 +324,18 @@ window.__ModuleLoader__.load({
298
324
  "notDeliverable": "Not deliverable yet",
299
325
  "notDeliverableHint": "All rows done does not mean deliverable: every row needs checkable evidence. The gaps are listed below.",
300
326
  "progressLabel": "Progress",
327
+ "closureReported": "Reported back",
328
+ "closureDone": "Done · not reported",
329
+ "closureAssigned": "Sent · no reply yet",
330
+ "closureAcknowledged": "Acknowledged",
331
+ "closureInstructed": "Instruction sent",
332
+ "closureEscalated": "Needs your call",
333
+ "closureRunning": "Running",
334
+ "closureNoAck": "Instruction not started yet",
335
+ "changePending": "Change request pending",
336
+ "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.",
337
+ "closureReplanned": "Replanned",
338
+ "closureReplannedTo": "Replanned → revised {ids}",
301
339
  "more": "More detail (optional)",
302
340
  "why": "Why it is arranged this way",
303
341
  "whyHint": "Find the most important problem first, solve in order, and check after each step before deciding the next one.",
@@ -1088,6 +1126,18 @@ window.__ModuleLoader__.load({
1088
1126
  const value = t(key);
1089
1127
  return value === key ? String(id || '') : value;
1090
1128
  }
1129
+ /*
1130
+ * [1.11.0] 跨部门需求的四档文案(用户 m00687)。
1131
+ *
1132
+ * 客户端只做「状态值 → 文案」映射,不推导状态:服务端写 open/routed/
1133
+ * answered/closed,这里原样显示。未知值退回原文,避免把新状态误写成
1134
+ * “已答复”。
1135
+ */
1136
+ function handoffStatusText(t, status) {
1137
+ const key = `handoff.${String(status ?? '')}`;
1138
+ const value = t(key);
1139
+ return value === key ? String(status || '') : value;
1140
+ }
1091
1141
  function levelText(t, value) {
1092
1142
  const key = `level.${value}`;
1093
1143
  const text = t(key);
@@ -1378,9 +1428,66 @@ window.__ModuleLoader__.load({
1378
1428
  }
1379
1429
  function SubtaskRow({ item, subtask, index, t }) {
1380
1430
  const status = item?.status ?? 'pending';
1381
- const tone = toneOfStatus(status);
1431
+ /*
1432
+ * [1.11.0] 闭环徽标:完成 ≠ 已回报;被重规划的行灰化并指向后继。
1433
+ *
1434
+ * 这里只渲染 `serialisePlan` 下发的 `closure/replacedBy`,不在客户端
1435
+ * 推导任何状态(契约 §8.3:客户端不得维护本地状态机)。计划定义里的
1436
+ * `supersededAt` 是同一事实的镜像,只用于「状态行缺失」的历史载荷。
1437
+ */
1438
+ const closure = item?.closure ?? (subtask?.supersededAt ? 'replanned' : null);
1439
+ const replacedBy = Array.isArray(item?.replacedBy)
1440
+ ? item.replacedBy
1441
+ : (Array.isArray(subtask?.replacedBy) ? subtask.replacedBy : []);
1442
+ /*
1443
+ * [1.11.0] M9:闭环每一档都要在左侧栏可见。
1444
+ *
1445
+ * 只显示「已回报/已重规划」时,一条正在等主 Agent 决定的请示看起来就是
1446
+ * 普通「受阻」,主 Agent 与用户都无法从进度栏看出「它在等你拍板」。
1447
+ * 文案由服务端下发的 `closure` 决定,客户端不推导状态。
1448
+ */
1449
+ const closureText = closure === 'replanned'
1450
+ ? (replacedBy.length > 0 ? fill(t('closureReplannedTo'), { ids: replacedBy.join('、') }) : t('closureReplanned'))
1451
+ : closure === 'reported' ? t('closureReported')
1452
+ : closure === 'done' ? t('closureDone')
1453
+ : closure === 'assigned' ? t('closureAssigned')
1454
+ : closure === 'acknowledged' ? t('closureAcknowledged')
1455
+ : closure === 'instructed' ? t('closureInstructed')
1456
+ : closure === 'escalated' ? t('closureEscalated')
1457
+ /*
1458
+ * [1.11.0] 瞬态兜底(T10 N7):状态行已经 in_progress,
1459
+ * 但闭环字段还是 pending(旧载荷 / 重建中的一行)。没有
1460
+ * 徽标会让这一行看起来「没有闭环含义」,补一个只描述
1461
+ * 事实的「执行中」,不推断它是否已回报。
1462
+ */
1463
+ : status === 'in_progress' ? t('closureRunning')
1464
+ : '';
1465
+ const closureLabel = closureText;
1466
+ const closureTone = closure === 'reported' ? 'done'
1467
+ : closure === 'escalated' ? 'blocked'
1468
+ : closure === 'replanned' ? 'idle'
1469
+ : 'idle';
1470
+ /*
1471
+ * [1.11.0] 「指示已发出、子会话还没动」(T10 N4)。
1472
+ *
1473
+ * `instructionOverdue` 由 60s 定时器写、由子会话首次进展清除;它描述的
1474
+ * 是等待事实,不是失败,所以用 blocked 色提醒但不改 status。
1475
+ */
1476
+ const instructionOverdue = item?.instructionOverdue === true;
1477
+ const tone = closure === 'replanned' ? 'idle' : toneOfStatus(status);
1382
1478
  const pct = clampPct(item?.progress ?? 0);
1383
- 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}`), 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, status !== 'blocked' && item?.summary ? h('p', { className: 'dsh-wp-muted' }, `${t('summary')}:${plainError(item.summary)}`) : null,
1479
+ 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,
1480
+ /*
1481
+ * [1.11.0] 跨部门需求(用户 m00687):提出方、指派对象、答复都必须在
1482
+ * 进度栏可见。否则用户只能从结果消息的一段文字里猜「这条需求谁在办、
1483
+ * 办没办」,而交付门禁却已经因为它把整份计划拦住了。
1484
+ */
1485
+ Array.isArray(item?.handoffs) && item.handoffs.length
1486
+ ? h('div', { className: 'dsh-wp-subtask-body' }, h('div', null, h('strong', null, `${t('handoffs')}:`)), h('ul', { className: 'dsh-wp-muted' }, item.handoffs.map((handoff) => h('li', { key: String(handoff?.id ?? '') }, `${String(handoff?.id ?? 'H?')} ${String(handoff?.request ?? '')}`
1487
+ + `${handoff?.department ? ` → ${deptName(t, handoff.department)}` : ''}`
1488
+ + `|${handoffStatusText(t, handoff?.status)}`
1489
+ + `${handoff?.response ? `:${String(handoff.response)}` : ''}`))))
1490
+ : null, status !== 'blocked' && item?.summary ? h('p', { className: 'dsh-wp-muted' }, `${t('summary')}:${plainError(item.summary)}`) : null,
1384
1491
  /*
1385
1492
  * [1.10.0] R-02:「卡住原因」只属于没做完的行。
1386
1493
  *
@@ -1397,7 +1504,13 @@ window.__ModuleLoader__.load({
1397
1504
  }
1398
1505
  function StageCard({ stage, statuses, index, t }) {
1399
1506
  const byId = useMemo(() => new Map((statuses || []).map((item) => [item.subtaskId, item])), [statuses]);
1400
- const items = (stage.subtasks || []).map((subtask) => ({ subtask, item: byId.get(subtask.id) }));
1507
+ const allItems = (stage.subtasks || []).map((subtask) => ({ subtask, item: byId.get(subtask.id) }));
1508
+ /*
1509
+ * [1.11.0] 被重规划替换/撤销的行仍然渲染(可追溯),但不进入阶段分母:
1510
+ * 否则「替换一项」会让阶段永远停在 4/5,用户看到的进度与总数互相矛盾。
1511
+ * 同一个 `supersededAt` 也决定了 `definedSubtaskCount` 的分母。
1512
+ */
1513
+ const items = allItems.filter(({ subtask }) => !subtask.supersededAt);
1401
1514
  const done = items.filter(({ item }) => item?.status === 'done').length;
1402
1515
  const blocked = items.filter(({ item }) => item?.status === 'blocked').length;
1403
1516
  const inProgress = items.some(({ item }) => item?.status === 'in_progress');
@@ -1420,7 +1533,7 @@ window.__ModuleLoader__.load({
1420
1533
  title: `${stageLabel(t, index)}:${stage.name}`,
1421
1534
  meta: `${done}/${items.length} ${t('stats.done')}`,
1422
1535
  badge: h(Pill, { tone }, stateText),
1423
- }, h('div', { className: 'dsh-wp-stage-goal' }, `${t('what')}:${stage.goal}`), h('div', { className: 'dsh-wp-checkpoint' }, `${t('checkpoint')}:${stage.checkpoint}`), items.map(({ subtask, item }, subIndex) => h(SubtaskRow, { key: subtask.id, subtask, item, index: subIndex, t }))));
1536
+ }, h('div', { className: 'dsh-wp-stage-goal' }, `${t('what')}:${stage.goal}`), h('div', { className: 'dsh-wp-checkpoint' }, `${t('checkpoint')}:${stage.checkpoint}`), allItems.map(({ subtask, item }, subIndex) => h(SubtaskRow, { key: subtask.id, subtask, item, index: subIndex, t }))));
1424
1537
  }
1425
1538
  function Analysis({ session, t }) {
1426
1539
  const task = session.taskUnderstanding || {};
@@ -1561,7 +1674,19 @@ window.__ModuleLoader__.load({
1561
1674
  const rows = [];
1562
1675
  const list = Array.isArray(stages) ? stages : [];
1563
1676
  list.forEach((stage, index) => {
1564
- const subtasks = Array.isArray(stage?.subtasks) ? stage.subtasks : [];
1677
+ /*
1678
+ * [1.11.0] 被重规划替换的旧行不参与阶段步进条(T10 N1)。
1679
+ *
1680
+ * 卡片头部按 `definedSubtaskCount` 已排除 `supersededAt`,这里却把
1681
+ * 计划定义里的全部行都算进分母,于是重规划后出现「头部 100%,
1682
+ * 阶段条 1/2 做好了」的双口径。旧行仍是审计记录(下面按状态行渲染、
1683
+ * 灰化),但不再是「还要做的工作」,所以不进入 total/done/active/
1684
+ * blocked 四个计数;一个阶段若只剩旧行,整段也不再显示。
1685
+ */
1686
+ const allSubtasks = Array.isArray(stage?.subtasks) ? stage.subtasks : [];
1687
+ const subtasks = allSubtasks.filter((subtask) => !subtask?.supersededAt);
1688
+ if (allSubtasks.length > 0 && subtasks.length === 0)
1689
+ return;
1565
1690
  let done = 0;
1566
1691
  let active = 0;
1567
1692
  let blocked = 0;
@@ -1795,6 +1920,18 @@ window.__ModuleLoader__.load({
1795
1920
  }, session.updatedAt
1796
1921
  ? h('div', { className: 'dsh-wp-meta dsh-wp-session-updated' }, `${t('updatedAt')} ${formatTime(session.updatedAt)}`)
1797
1922
  : null, open === true ? h(PlanOverview, { t, stats, counts, rows: stageRows }) : null, session.degraded ? h('div', { className: 'dsh-wp-banner dsh-wp-banner--degraded' }, h('strong', null, t('degraded')), h('div', null, plainError(session.error || '')), h('div', { className: 'dsh-wp-muted' }, t('degradedHint'))) : null,
1923
+ /*
1924
+ * [1.11.0] 执行中收到的需求变更(T10 N5)。
1925
+ *
1926
+ * 服务端从 1.11.0 起把 `changeRequest` 放进每份载荷,但卡片原先
1927
+ * 一字不显示:用户提了变更、工具也回了「已记录」,进度栏却看不出
1928
+ * 来,只能等主 Agent 自己再解释一遍。这里只显示「已记录 + 原文 +
1929
+ * 何时生效」,不显示任何未落地的承诺。
1930
+ */
1931
+ session.changeRequest?.status === 'pending'
1932
+ ? h('div', { className: 'dsh-wp-banner dsh-wp-banner--degraded' }, h('strong', null, t('changePending')), h('div', { className: 'dsh-wp-muted' }, t('changePendingHint')), typeof session.changeRequest.text === 'string' && session.changeRequest.text
1933
+ ? h('div', { className: 'dsh-wp-error-text' }, plainError(session.changeRequest.text))
1934
+ : null) : null,
1798
1935
  /*
1799
1936
  * [1.10.0] C-09:把服务端已经下发、却从来没人读的交付门禁搬上界面。
1800
1937
  *
@@ -251,21 +251,32 @@ pending ──dispatch──▶ executing ──全部 done──▶ done
251
251
  子 Agent 必须用**自由文本**汇报,并满足:
252
252
 
253
253
  - 优先在输出末尾追加结构化证据块(`<!-- WORKPLAN_EVIDENCE:START -->` … JSON … `<!-- WORKPLAN_EVIDENCE:END -->`),含 `status` / `blockedReason` / `acceptance[]` / `artifacts[]` / `needs[]`。这是 1.7.0 的主信号:`partial`、任一验收 `fail`、坏块都判受阻,只有全 `pass` 直接采信。
254
- - 没有证据块时,失败仍可**第一行**写 `BLOCKED: 原因`(大小写不敏感,中英文冒号都认,行首允许空白)——按 `legacy` 判受阻;其余非空文本按 `legacy` 判完成但标「未验证」,结果消息会提示主 Agent 复核。
254
+ - 没有证据块时,失败仍可**第一行**写 `BLOCKED: 原因`(大小写不敏感,中英文冒号都认,行首允许空白)——按 `legacy` 判受阻。
255
+ - **1.11.0 起,没有证据块、也没有 `BLOCKED` 的「纯散文」不再算完成**:默认(`strictCompletion`,可用 `DSH_WORKPLAN_STRICT_COMPLETION=0` 关闭)判 `blocked` + `unverified`,错误信息写明「结果块缺失,无法确认验收项是否真的通过」。历史回放仍按 `legacy` 读取,避免旧计划整体失效。
256
+ - 验收条目自称 `pass` 但 `evidence` 为空时,1.11.0 降级为 `unverified`,且 `deliveryReadiness` 增加「验收自称通过但没有证据」阻塞项。
255
257
  - 正文写清:做了什么、证据/文件路径、验收结果、遗留问题;
256
258
  - 不编造命令输出、文件或证据;无法确认就写「未验证」;
257
259
  - 需要别人配合时,写「需要主 Agent 执行/确认什么」,**不要等待或空转**。
258
260
 
259
261
  `summary` 会被截断到 3000 字,因此**关键结论和绝对路径要放在最前面**。
260
262
 
263
+ ### 5.2.1 验收覆盖与上游门槛(1.11.0)
264
+
265
+ - **验收不可自证**:裁决与交付门共用 `acceptanceCoverage`。计划写了 N 条验收,证据块必须逐条回应;允许措辞差异(规范化后包含关系),短文本(<6 字)只接受等值。少一条即 `blocked/unverified`,交付阻塞写明「验收项未被逐条回应(N/M)」。
266
+ - **未验收上游不得解锁下游**:调度门 `dependencyOk` 对上游 `verification` 为 `unverified` / `failed` 时返回 false;`structured` 与 `legacy`(旧日志)仍放行。下游因此停在 pending,并由 `describePendingCause` 说明原因。
267
+ - **cancel 的悬挂下游**:`replan cancel` 不重写下游依赖;派发与交付判定前由 `blockCancelledDependents` 把这类下游标成 `blocked` 并写明处理方式,不再永久 pending。
268
+ - **子会话不得直接交付**:`present` 守卫对非根会话返回 `NOT_ROOT`;产物写工作区,由主 Agent 统一核对后交付。
269
+
261
270
  ### 5.3 跨部门转达
262
271
 
263
- 1.7.0 **仍没有**子 Agent 直连、共享黑板或会签,但多了两个通道:兄弟任务只读一览(提示词内)与 `needs` 清单(结果消息内「跨部门待转达」)。转达仍只有两条路:
272
+ 1.11.0 **仍没有**子 Agent 直连、共享黑板或会签——这是刻意的权限边界,不是遗漏。跨部门只有三条路:
264
273
 
265
- 1. **经主 Agent**:主 Agent 读结果消息,用 `dsh_workplan_update` 的 `note` / `evidence` 写回结论,或在下一轮对话里补充背景;
266
- 2. **经工作区文件**:上游把接口/产物落到双方都能读到的路径,并在摘要里写绝对路径。
274
+ 1. **带编号的 hand-off(1.11.0 新增,唯一处置入口)**:子 Agent 每条 `needs` 由 `applyStatus` 自动登记为 `{id: H1, request, department, status}`;主 Agent 用 `dsh_workplan_handoff` 处置:`list` / `assign`(登记责任部门)/ `resolve`(写入答复或产物引用)/ `close`(确认无需动作)。四态为 `open → routed → answered / closed`。**未处置的 hand-off 会进 `deliveryReadiness`,直接拦住交付**;对正处于「待指示」的行执行 `resolve`,会复用 `instructSubtask` 把答复直接投递给该子会话。
275
+ - `assign` 只登记责任,**不会自动产生工作**(插件没有常驻部门代理);需要产出时用 `dsh_workplan_replan(action=add)` 建该部门的子任务,或由主 Agent 自己完成,再 `resolve`。
276
+ 2. **经主 Agent 对话**:`dsh_workplan_instruct` 回答请示、`dsh_workplan_replan` 就地修订计划;
277
+ 3. **经工作区文件**:上游把接口/产物落到双方都能读到的路径,并在摘要里写绝对路径;`dependsOn` 上游的 `artifacts[].ref`(`exists:true`)会作为「可消费产物」注入下游提示词。
267
278
 
268
- 「兄弟任务只读一览」与 `needs` 清单已在 1.7.0 实现(`buildTeamBrief`、`buildResultMessage`);子 Agent 直连仍然不开放。
279
+ 「兄弟任务只读一览」与 `needs` 清单自 1.7.0 起存在(`buildTeamBrief`、`buildResultMessage`);子 Agent 直连仍然不开放。
269
280
 
270
281
  ---
271
282
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  - **是职责标签。** `src/plan.ts#DEPARTMENTS` 里的 12 个 key 决定子任务的提示词、面板分组与统计口径。
8
8
  - **不是组织架构。** 1.7.0 仍没有部门负责人、部门队列、部门内串行、部门预算;同一部门的两个子任务也可以并行。
9
- - **不是通信通道。** 部门之间不能直接对话;跨部门信息经主 Agent 转达、落到工作区文件,或写进子 Agent 回传的 `needs` 由结果消息汇总(见协作契约 §5.3)。
9
+ - **不是通信通道。** 部门之间不能直接对话;跨部门信息经主 Agent 转达、落到工作区文件,或写进子 Agent 回传的 `needs`(1.11.0 起自动登记为带编号、可处置、会拦住交付的 hand-off,见协作契约 §5.3)。
10
10
  - **不代表权限。** 任何部门都不能派发、改判、取消计划;这些只有主 Agent 能做。
11
11
 
12
12
  选部门的唯一标准:**这件工作主要由谁的专业判断负责,就选谁。** 拿不准时按「产物归谁验收」选,而不是按「谁顺手动一下」选。
@@ -60,7 +60,7 @@
60
60
  |---|---|---|---|
61
61
  | 串联 | 下游依赖上游结论/产物 | 计划里写 `dependsOn: ["T1"]` | 只有上游 `done` 下游才开跑;下游只看到上游摘要,**务必把路径写进摘要** |
62
62
  | 并行对齐 | 两件事可同时做,但接口要对齐 | 同一阶段、无依赖 | 彼此看不到对方;接口必须由计划或主 Agent 事先写死 |
63
- | 升级转达 | 需要另一个部门补信息/做决定 | 主 Agent 用 `update` 的 `note`/`evidence` 记录,或在下一轮对话补充 | 1.7.0 的 `needs` 会自动汇总成「跨部门待转达」,但仍由主 Agent 执行转达 |
63
+ | 升级转达 | 需要另一个部门补信息/做决定 | 子 Agent 写 `needs` 或调用 `dsh_workplan_escalate`;主 Agent 用 `dsh_workplan_handoff` 处置(`assign`/`resolve`/`close`),用 `dsh_workplan_instruct` 下达指示 | 1.11.0 起 `needs` 自动登记为带编号的 hand-off,未处置拦住交付;`assign` 只登记责任,需要产出时用 `dsh_workplan_replan(action=add)` 建子任务 |
64
64
 
65
65
  ### 2.4 交接自检清单(交接前逐条过)
66
66
 
@@ -0,0 +1,78 @@
1
+ # Release record — v1.10.6(2026-11-01)
2
+
3
+ 本文件按 `RELEASING.md` 第 6 节生成:只记录可复核的证据,不写形容词。
4
+
5
+ ## 1. 源码与版本
6
+
7
+ | 项目 | 值 |
8
+ |---|---|
9
+ | commit | `5cecb83b4e3c9b42107b2055f2b0825b4c2fb40a` |
10
+ | tag | `v1.10.6`(annotated,tag object `1414bb26975e6a5ac97265703488a25d607595c5`) |
11
+ | package.json version | `1.10.6` |
12
+ | package-lock.json version | `1.10.6`(root + `packages[""]`) |
13
+ | src/host.ts `meta.version` | `1.10.6` |
14
+ | CHANGELOG | `## 1.10.6 — 2026-11-01` |
15
+
16
+ ## 2. 发布前检查
17
+
18
+ ```text
19
+ npm run check → 通过(tsc --noEmit,无输出)
20
+ npm test → tests 332 / pass 332 / fail 0(duration 4.37s)
21
+ 构建可复现(build 后 git diff lib client.js)→ 无差异
22
+ ```
23
+
24
+ A/B 跨版本探针(R-W5-01):本次改动集中在重试链路与 auto-resume 开关,未触及
25
+ superseded/cancelled 信封与 present 判定,探针结论沿用 v1.9.1 记录的 PASS;未重跑,
26
+ 此处如实标注为"未在 1.10.6 树重跑"。
27
+
28
+ ## 3. GitHub Release
29
+
30
+ | 项目 | 值 |
31
+ |---|---|
32
+ | Release | https://github.com/abbaababa/dsh-workplan/releases/tag/v1.10.6 |
33
+ | 资产 | `dsh-workplan-1.10.6.tgz` |
34
+ | 大小 | 805,574 bytes(API 回报 `state: uploaded`,大小一致) |
35
+ | sha256 | `0f11fc01c98fc1ba7079b6b2eb87c69c495f79e118dfc01e50141891d7cc2718` |
36
+ | 构建方式 | 从 tag 干净克隆 → `npm ci` → `npm run build` → `npm pack` |
37
+
38
+ ## 4. npm
39
+
40
+ | 项目 | 值 |
41
+ |---|---|
42
+ | 版本 | `dsh-workplan@1.10.6`,`dist-tags.latest = 1.10.6` |
43
+ | tarball | https://registry.npmjs.org/dsh-workplan/-/dsh-workplan-1.10.6.tgz |
44
+ | shasum | `7ba4fdf8c5c69c507b581a2beb511accd1e19826` |
45
+ | integrity | `sha512-O98ViT+dm/fO4dMQgZ0TTmIRFn11Mee3aOzS6AXkVMXnxYcU8pCrk0MiCGBaZ2XB7y60PhOiec6hcCI44eMx6A==` |
46
+ | 发布账号 | `open-dsh` |
47
+ | 端到端安装验证 | 空目录 `npm i dsh-workplan@1.10.6` → `added 1 package in 844ms`,`node_modules/dsh-workplan` 版本 1.10.6,`lib/` 存在 |
48
+
49
+ ## 5. 索引源(dsh-plugin-catalog)
50
+
51
+ | 项目 | 值 |
52
+ |---|---|
53
+ | 上游条目 | `data/plugins/abbaababa__dsh-workplan.yml` |
54
+ | PR | https://github.com/awesome-dsh-plugin/awesome-dsh-plugin/pull/11154 |
55
+ | 变更 | `tarball:` 由 v1.8.3 指向 v1.10.6(只改这一行) |
56
+ | 合并前 catalog 状态 | jsDelivr `index.json` 中该条目 `versions` 仍为 `1.8.4`(catalog 由上游 CI 依 npm 重建,本仓库无法直接触发) |
57
+ | 合并后复验命令 | `npm view dsh-plugin-catalog@latest version`;`curl -s https://cdn.jsdelivr.net/npm/dsh-plugin-catalog/index.json \| grep -o '"name":"dsh-workplan"'` |
58
+
59
+ ## 6. 已知限制
60
+
61
+ - 本机对 `github.com` 直连(curl)不可达(返回 000),因此 Release 资产的 HTTP 200
62
+ 复验未能用 curl 完成;改用 GitHub API 校验资产存在、`state: uploaded` 且大小与本地
63
+ 制品一致(805,574 bytes)。资产字节的 sha256 已在打包时记录。
64
+ - catalog 收录依赖上游 CI,PR 合并后需要等待一轮构建,本记录不预先声称已收录。
65
+
66
+ ## 7. 回滚
67
+
68
+ ```bash
69
+ # npm(24 小时内)
70
+ npm unpublish dsh-workplan@1.10.6
71
+ # 或发布 1.10.7 补丁,不覆盖 1.10.6
72
+
73
+ # GitHub
74
+ gh release delete v1.10.6 --repo abbaababa/dsh-workplan --yes # tag 保留可追溯
75
+
76
+ # 索引源
77
+ 把 PR 中的 tarball 改回 v1.8.3(或合并后反向 PR),并重跑 `npm view dsh-plugin-catalog@latest version` 确认
78
+ ```