dsh-workplan 1.11.1 → 1.12.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,134 @@
1
+ ## 1.12.0 — 2026-11-02
2
+
3
+ **把三类异质改动收敛为一次发布:T11 低风险缺陷补丁 rebase(15 个缺陷 / 44 个 hunk)、任务理解与部门分配机制修正、分步进度折叠 UI;并逐条给出 U-15…U-21 的结论或明确决策请求。**
4
+
5
+ > **事实边界(发布说明不得外推)**
6
+ > 1. 本版证明的是「代码级护栏 + 固定样例 + 全量回归」。真实模型在 20 条任务上的理解质量与部门命中率**尚未验证**(T5 D-1)。
7
+ > 2. 计划生成后**默认自动派发**(`autoDispatch` 默认 true,plan 模式除外;`autoDispatch:false` 或 `DSH_WORKPLAN_AUTO_DISPATCH=0` 可关闭并回到 plan-first)。
8
+ > 3. D-01 的验收改为**稳定编号 A1…An + 单向包含**:只写验收标准的一部分不再算覆盖,自创验收项也不能顶替计划验收(Q6 / U-16)。
9
+ > 4. 真实浏览器点击未在本机执行(缺浏览器自动化与 3080 鉴权);组件级交互验收 17/17 通过,发布前仍需主 Agent 在 GUI 手工点验一次。
10
+
11
+ ### 零、1.12.0 收口:自动派发与验收编号(T6 Q2 / Q6)
12
+
13
+ - **自动派发**:计划落地后立即以 async 方式调用 `dispatchPlan`,结果仍由 `finishRound` 写回;
14
+ 计划消息改为「已自动派发,不要重复调用 dispatch」。plan 模式不自动派发;预算、取消、
15
+ 幂等、交付门禁与自动续跑全部保留。三态解析:配置 > `DSH_WORKPLAN_AUTO_DISPATCH` > 默认 true。
16
+ - **验收稳定编号**:子提示词把计划验收编号为 A1…An,证据块 `criterion` 以 A1/A2… 对号入座;
17
+ `acceptanceCoverage` 同时去掉反向包含(`criterion.includes(row)`),部分文字不再被判覆盖。
18
+ - 新增回归:子串绕过被拦、A1/A2 编号通过、缺少编号时只覆盖对应项、计划消息自动派发文案;
19
+ 全量 **459 / 459 pass,0 fail**,`npm run check` exit 0。
20
+
21
+ ### 一、rebase:15 个低风险缺陷补丁
22
+
23
+ 补丁:[`_t8_rebase_20261102/out/T11-1.12.0.patch`](../_t8_rebase_20261102/out/T11-1.12.0.patch)(7 文件 / 44 hunk / SHA256 `6331f169…aadb00f`),基于 `HEAD f5160ff`(1.11.1)重生成,`git apply --check` 与 `patch --fuzz=0` 均为 0 退出码,无 `.rej`。
24
+
25
+ 45 个源 hunk 的去向(T7 台账 → T8 对账):
26
+
27
+ | 去向 | 数量 | 说明 |
28
+ |---|---:|---|
29
+ | 可直用 | 31 | 上下文未受 1.11.0/1.11.1 影响 |
30
+ | 需改写 | 11 | 按 HEAD 上下文重写(含 D-45 的 1.12.0 版本口径、D-30 的回放透传拆分) |
31
+ | 建议废弃 | 3 | D-15 两段、D-17 一段;对应缺陷已被 1.11.0 以不同实现修复,强打会回退已修逻辑 |
32
+ | 对齐新增 | 1 | B1(文档口径) |
33
+ | **最终 patch hunk** | **44** | 42 保留(#37 拆分 1→2,已含测试文件 hunk)+ 1 对齐 |
34
+
35
+ 覆盖的 15 个缺陷 ID:`D-04 / D-07 / D-08 / D-09 / D-10 / D-11 / D-15 / D-17 / D-19 / D-21 / D-28 / D-30 / D-31 / D-35 / D-45`。逐 hunk 落点见 `_t8_rebase_20261102/out/T11-1.12.0.map.json` 与 `source_decisions.csv`;D-15/D-17 的断言保留在 `tests/t11-lowrisk-patches.test.ts`,用于防止 1.11.0 的修复被回退,但不计作本次新增修复。
36
+
37
+ 回归覆盖(详见 `_t9_regression_20261102/T9_回归用例补齐与实跑记录_20261102.md`):
38
+
39
+ - 44/44 个 patch hunk 至少对应 1 条可执行用例,缺口 0;
40
+ - 新增 52 条:补丁自带 `tests/t11-lowrisk-patches.test.ts` 13 条 + `tests/t9-hunk-contract.test.ts` 34 条 + `tests/t13-gap-cases.test.ts` 5 条;
41
+ - 未打补丁基线同批对照:43/44 个 hunk 为 fail-before;唯一例外 hunk 33(D-19,基线本就拒绝环)已标注为「补独立基线」,不冒充判别力;
42
+ - T13 的 5 条补位用例已适配 1.12.0 版本口径(原断言写死 1.11.0,直接复用会假失败)。
43
+
44
+ ### 二、任务理解与部门分配(T10)
45
+
46
+ 改造前:`validatePlan(raw)` 拿不到用户原文,12 个部门只有中英文名,子 Agent 提示词首行才出现部门;「分配是否合理」在机制上不可判定。
47
+
48
+ 改造后(纯函数,无模型、无网络、无时钟、无文件系统):
49
+
50
+ - **任务锚点** `taskAnchor`:保存用户原文 + `sha256` + 长度 + 来源消息;哈希不一致即降级为 `null`,不会带着被改写的「原要求」通过校验;
51
+ - **要素抽取** `extractTaskElements()`:版本号、日期、编号、路径、数量、数值边界、显式否定、指代、矛盾;裸「它」等无上下文指代判 `needs-context`,不猜;
52
+ - **部门能力目录** `src/departments.ts`:12 个部门各有 `responsibilities / outputs / keywords`;`departmentFit()` 输出 `fit / weak / mismatch`、命中关键词、`bestAlternative` 与受保护部门的 `intrusion`;
53
+ - **偏离自检** `auditTaskUnderstanding()`:硬要素缺失、交付动作缺失、复述覆盖、部门矛盾;严格模式下以 `DEVIATION:` / `CLARIFY:` / `CONTEXT:` 前缀阻断并走既有重试/降级,不派发;
54
+ - **提示词**:规划提示词要求每个子任务写 `departmentRationale`;子 Agent 提示词注入部门职责、典型产物与只读锚点(含哈希前 12 位);
55
+ - **回退开关**:`DSH_WORKPLAN_CONTEXT_GUARD=off` 时审计仍运行并写盘,但只告警不阻断。
56
+
57
+ 真实历史计划回放(41 个子任务):`fit 41/41`、`mismatch 0`;S3 的 7 个硬要素 0 丢失。该结果证明「旧计划不会被新护栏误伤」,**不证明真实模型对新任务的理解质量**。
58
+
59
+ ### 三、自动化闭环口径修正(T11)
60
+
61
+ 本版修正 4 组会让自动化闭环「看起来在跑、实际丢状态」的缺陷,均有 fail-before / pass-after:
62
+
63
+ 1. 预算到点不再把 `escalated` / `instructed` / `replanned` 三类闭态行重置为 `pending`(原先会清空请示、触发 `INVALID_TRANSITION`、或让一条历史旧行毁掉整轮派发);
64
+ 2. 新增 `liveResumeCounts`:`replanned` 旧行不再被当作 pending,避免 live 行全 done 仍空排一轮并写误导性停止行;
65
+ 3. `HAS_BLOCKED` 不再被 `NOTHING_PENDING` 抢先,`paused + blocked + 0 pending` 如实答「有受阻」,不再答成「证据缺口」;
66
+ 4. 修正 3 处「自动续跑默认关闭」的错误文案(实现默认开启)与 1 处不存在的 `tools.guard` 强制派发注释。
67
+
68
+ 本版已实现默认自动派发(见 §零);plan 模式与 `DSH_WORKPLAN_AUTO_DISPATCH=0` 保留 plan-first。
69
+
70
+ ### 四、分步进度折叠 UI(T12)
71
+
72
+ `PlanOverview` 的「分步进度」每行改为可点击展开/收起,**默认收起**:
73
+
74
+ - 收起态只显示状态点、第 N 步名称、进度条、done/total、状态词与折叠箭头;
75
+ - 点击行或键盘 Enter/Space 展开该步摘要(目标、检查点、子任务状态);再次触发收起;
76
+ - `aria-expanded` / `aria-controls` 与 `hidden` 面板同步;点击不冒泡到外层卡片;
77
+ - 展开状态按会话存 `dsh-workplan:planrow-open:v1:<sessionId>`,刷新后恢复;localStorage 抛错时降级为纯内存,不影响点击;
78
+ - 统计数字与既有阶段卡不变,未删除下方「分几步做」列表(D-6 未拍板)。
79
+
80
+ 局限:`stage id` 在重规划后可能复用,旧展开态可能被新阶段继承(T13 观察 O-2,不丢数据、不影响点击,未阻塞)。
81
+
82
+ ### 五、U-15…U-21 结论
83
+
84
+ | ID | 结论 | 证据 / 待决 |
85
+ |---|---|---|
86
+ | U-15 | **本版已关闭** | 1.12.0 集成树 `npm test` 459/459、`fail 0`、退出码 0;原始日志见 T14 发布包 `logs/t14final2_npm_test.log` |
87
+ | U-16 | **已修(1.12.0)** | 验收改为稳定编号 A1…An + 单向包含;证据只写「通过登录测试」不再覆盖「通过登录测试与越权测试」。复跑探针 `BYPASS=BLOCKED`(`logs/t14final2_u16_probe.log`);回归见 `tests/workplan-crossdept-hardening.test.ts` |
88
+ | U-17 | **未关闭,不得写「已修 N/42」** | 42 条 present 中,T11 用例覆盖 12 条、D-01/D-13 已复验,仍有 28 条无复验;T9 的 44 hunk 覆盖不等于 42 缺陷全覆盖 |
89
+ | U-18 | **已关闭** | `v1.11.0` 干净树重跑 `npm test`:363/363、`fail 0`、退出码 0(T14 日志 `logs/v110_npm_test.log`) |
90
+ | U-19 | **内容已闭合,时刻保留说明** | 1.12.0 map 由 `gen_map.py` 从最终补丁反解生成,45/45 源 hunk 一致;旧 map 的 `createdAt` 与 mtime 矛盾仍如实记录,不再作为 1.12.0 权威映射 |
91
+ | U-20 | **已关闭** | `_t12_high_risk_patches_20261102/ROLLBACK.md` 已存在;该 P0 补丁(D-01/D-13)不进入 1.12.0 |
92
+ | U-21 | **需主 Agent/用户确认口径** | 以 `T14_诊断与修正总报告_20261102.md` + 证据索引为准,`dsh-workplan-1.11.0-final-report.md` 降为参考 |
93
+
94
+ ### 六、测试
95
+
96
+ | 检查 | 结果 |
97
+ |---|---|
98
+ | `npm run check`(tsc --noEmit) | exit 0 |
99
+ | `npm test` | **459 tests / 459 pass / 0 fail / exit 0**(约 4.4s) |
100
+ | `version-sync` | 2/2 通过;`verify_version.mjs` 10 个声明点(含 README 版本徽章)全部 1.12.0 |
101
+ | 基线对照(未打补丁) | 43/44 hunk fail-before;基线原套件 364/364 通过,排除环境故障 |
102
+ | `v1.11.0` 复跑 | 363/363,exit 0(U-18) |
103
+
104
+ 459 = 1.11.1 之后已并入的机制/UI 用例 404 + 本次 rebase 52 + 1.12.0 收口新增 3(U-16 / 自动派发文案)。
105
+
106
+ ### 七、破坏性变更
107
+
108
+ **无。** 可复核理由:
109
+
110
+ 1. `PLAN_VERSION` 仍为 `1`(`src/plan.ts:16`),计划消息契约未变;
111
+ 2. 未删除或改名任何字段/工具;新增 `taskAnchor`、`understandingAudit`、`departmentRationale` 均为可选字段;
112
+ 3. `STATUSES` 仍为四值,计数与交付门禁语义不变;
113
+ 4. 旧日志/旧计划缺新字段时按 1.11.1 语义降级(`degraded`、不阻断),刷新回放不翻红。
114
+
115
+ ### 八、升级
116
+
117
+ ```bash
118
+ dsh plugin --profile web add dsh-workplan@1.12.0
119
+ ```
120
+
121
+ 装完重启 DSH Web(或重新载入页面)。无需配置迁移;若新护栏误拒正常计划,可临时设 `DSH_WORKPLAN_CONTEXT_GUARD=off` 只告警不阻断,并把样例反馈回来。
122
+
123
+ ### 九、已知缺口(如实列出,不折算为已修)
124
+
125
+ - U-16 验收子串绕过:**已修**(A1…An 稳定编号 + 单向包含),复跑 `BYPASS=BLOCKED`;
126
+ - U-17 28 条 present 缺陷未逐条复验;
127
+ - 自动派发:**已实现并默认开启**(plan 模式除外,`DSH_WORKPLAN_AUTO_DISPATCH=0` 可关闭);真实宿主端到端自动派发未单独跑,证据为代码级 + 单测;
128
+ - 真实模型 20 条任务的理解质量/部门命中率:未验证;
129
+ - 真实浏览器点击:未执行(组件级 17/17 已过);
130
+ - 索引源:本仓库只能提上游条目 PR,catalog npm 由上游 CI 重建;PR 合并前不得写「已上索引」。
131
+
1
132
  ## 1.11.1 — 2026-11-02
2
133
 
3
134
  修复 1.11.0 中一个「已声称、但数据层未生效」的问题:
package/README.en.md CHANGED
@@ -3,6 +3,7 @@
3
3
  > **Two selling points, one line: a full ISO/IEC 15408:2026 evidence pack you can verify with 5 commands, and a one-command install with zero runtime dependencies.**
4
4
 
5
5
  [![verify](https://github.com/abbaababa/dsh-workplan/actions/workflows/verify.yml/badge.svg)](https://github.com/abbaababa/dsh-workplan/actions/workflows/verify.yml)
6
+ [![version](https://img.shields.io/badge/version-1.12.0-blue.svg)](https://github.com/abbaababa/dsh-workplan/releases/tag/v1.12.0)
6
7
 
7
8
  Adds "plan first → dispatch real department subagents → watch progress in the sidebar" to **DeepSeek Harness (DSH)**. No app, no DSH source patch, no page replacement.
8
9
 
@@ -27,7 +28,7 @@ We do the half that can be done by us: **build the materials the 2026 edition (n
27
28
  | Class-by-class mapping, EAL1 readiness, what is missing | Self-assessment | [docs/cc/CC-2026-ASSESSMENT.md](docs/cc/CC-2026-ASSESSMENT.md) |
28
29
  | Third-party components, licences, hashes | Life cycle (ALC) | [docs/SBOM.md](docs/SBOM.md) |
29
30
  | How to report a vulnerability, response times | Security policy | [SECURITY.md](SECURITY.md) |
30
- | 188 automated tests, one command to re-run | Testing (ATE) | `npm run verify` |
31
+ | 459 automated tests, one command to re-run | Testing (ATE) | `npm run verify` |
31
32
 
32
33
  Status: of the 14 EAL1 components — CC's lowest level — **10 are ready, 3 partially ready, 1 can only come from an external lab**. What is missing is lab money and scheduling, not code, so we sell evidence and do not pretend to hold a certificate.
33
34
 
@@ -35,7 +36,7 @@ Check it yourself — 3 lines, copy-paste:
35
36
 
36
37
  ```bash
37
38
  git clone https://github.com/abbaababa/dsh-workplan.git && cd dsh-workplan
38
- npm ci && npm run verify # expect: tests 188 / pass 188 / fail 0
39
+ npm ci && npm run verify # expect: tests 459 / pass 459 / fail 0
39
40
  grep -RInE "child_process|execSync|eval\(|writeFileSync" src || echo "0 hits (expected)"
40
41
  ```
41
42
 
@@ -77,7 +78,7 @@ The full contract — roles, data shapes, state machine, recovery, and the three
77
78
  ## Install
78
79
 
79
80
  ```bash
80
- dsh plugin --profile web add dsh-workplan@1.11.1
81
+ dsh plugin --profile web add dsh-workplan@1.12.0
81
82
  ```
82
83
 
83
84
  Restart the DSH Web process (or reload the page) so the bundle is picked up.
package/README.md CHANGED
@@ -3,6 +3,7 @@
3
3
  > **两个卖点,一句话:ISO/IEC 15408:2026 全套安全证据,5 条命令自己验;安装一条命令、零第三方运行时依赖。**
4
4
 
5
5
  [![verify](https://github.com/abbaababa/dsh-workplan/actions/workflows/verify.yml/badge.svg)](https://github.com/abbaababa/dsh-workplan/actions/workflows/verify.yml)
6
+ [![version](https://img.shields.io/badge/version-1.12.0-blue.svg)](https://github.com/abbaababa/dsh-workplan/releases/tag/v1.12.0)
6
7
 
7
8
  给 **DeepSeek Harness(DSH)** 加一段「先拆计划 → 真派部门子 Agent 去做 → 左侧栏实时看进度」的能力。不装 App、不改 DSH 源码、不换页面。
8
9
 
@@ -27,7 +28,7 @@
27
28
  | 逐类对照 + EAL1 就绪度 + 还缺什么 | 自评估 | [docs/cc/CC-2026-ASSESSMENT.md](docs/cc/CC-2026-ASSESSMENT.md) |
28
29
  | 第三方组件、许可证、哈希 | 生命周期(ALC) | [docs/SBOM.md](docs/SBOM.md) |
29
30
  | 漏洞怎么报、多久回、部署怎么配 | 安全策略 | [SECURITY.md](SECURITY.md) |
30
- | 188 项自动化测试,一条命令复跑 | 测试(ATE) | `npm run verify` |
31
+ | 459 项自动化测试,一条命令复跑 | 测试(ATE) | `npm run verify` |
31
32
 
32
33
  现状:CC 最低等级 **EAL1** 的 14 项组件里,**10 项就绪、3 项部分具备、1 项只能靠外部实验室**。差的不是代码,是认证要花的实验室费用与排期——所以我们只卖证据,不冒充分证。
33
34
 
@@ -35,7 +36,7 @@
35
36
 
36
37
  ```bash
37
38
  git clone https://github.com/abbaababa/dsh-workplan.git && cd dsh-workplan
38
- npm ci && npm run verify # 期望:tests 188 / pass 188 / fail 0
39
+ npm ci && npm run verify # 期望:tests 459 / pass 459 / fail 0
39
40
  grep -RInE "child_process|execSync|eval\(|writeFileSync" src || echo "0 命中(预期)"
40
41
  ```
41
42
 
@@ -66,7 +67,7 @@ grep -RInE "child_process|execSync|eval\(|writeFileSync" src || echo "0 命中
66
67
  ## 一键安装
67
68
 
68
69
  ```bash
69
- dsh plugin --profile web add dsh-workplan@1.11.1
70
+ dsh plugin --profile web add dsh-workplan@1.12.0
70
71
  ```
71
72
 
72
73
  装完**重启一次 DSH Web**(或重新载入当前页面)让插件生效。
package/client.js CHANGED
@@ -14,6 +14,7 @@ window.__ModuleLoader__.load({
14
14
  const PANEL_ID = 'workplan';
15
15
  const NS = 'dsh-workplan';
16
16
  const { useState, useEffect, useCallback, useMemo } = React;
17
+ // [D-11] 面板统一称「执行角色」:role 仍是自由文本字段,只消除「负责人」与「角色」的口径冲突。
17
18
  const LOCALE = {
18
19
  "zh": {
19
20
  "panel": "任务进度",
@@ -62,7 +63,7 @@ window.__ModuleLoader__.load({
62
63
  "refresh": "刷新",
63
64
  "updatedAt": "更新于",
64
65
  "empty": "还没有任务进度",
65
- "emptyHint": "先发一句话说明你要做什么,系统会自动安排步骤和负责人。",
66
+ "emptyHint": "先发一句话说明你要做什么,系统会自动安排步骤和执行角色。",
66
67
  "error": "读取失败",
67
68
  "retry": "重试",
68
69
  "phase": {
@@ -103,7 +104,8 @@ window.__ModuleLoader__.load({
103
104
  "writing": "文档写作",
104
105
  "operations": "运营",
105
106
  "legal": "法务合规",
106
- "finance": "财务"
107
+ "finance": "财务",
108
+ "unknown": "未知部门"
107
109
  },
108
110
  "stats": {
109
111
  "done": "做好了",
@@ -117,7 +119,7 @@ window.__ModuleLoader__.load({
117
119
  "stepSuffix": "步",
118
120
  "workPrefix": "具体工作",
119
121
  "who": "负责团队",
120
- "person": "负责人",
122
+ "person": "执行角色",
121
123
  "what": "要做出什么",
122
124
  "how": "怎么做",
123
125
  "doneWhen": "怎样算做好",
@@ -163,7 +165,7 @@ window.__ModuleLoader__.load({
163
165
  "transformation": "什么情况下会变化",
164
166
  "checkpoint": "这一步做完先检查",
165
167
  "subtasks": "具体工作",
166
- "role": "负责人",
168
+ "role": "执行角色",
167
169
  "objective": "要做出什么",
168
170
  "method": "怎么做",
169
171
  "inputs": "开始前需要",
@@ -298,7 +300,8 @@ window.__ModuleLoader__.load({
298
300
  "writing": "Writing",
299
301
  "operations": "Operations",
300
302
  "legal": "Legal",
301
- "finance": "Finance"
303
+ "finance": "Finance",
304
+ "unknown": "Unknown department"
302
305
  },
303
306
  "stats": {
304
307
  "done": "Done",
@@ -312,7 +315,7 @@ window.__ModuleLoader__.load({
312
315
  "stepSuffix": "",
313
316
  "workPrefix": "Work item",
314
317
  "who": "Team",
315
- "person": "Owner",
318
+ "person": "Execution role",
316
319
  "what": "What to make",
317
320
  "how": "How",
318
321
  "doneWhen": "How we know it is good",
@@ -358,7 +361,7 @@ window.__ModuleLoader__.load({
358
361
  "transformation": "What could change it",
359
362
  "checkpoint": "Check before moving on",
360
363
  "subtasks": "Work items",
361
- "role": "Owner role",
364
+ "role": "Execution role",
362
365
  "objective": "What to make",
363
366
  "method": "How",
364
367
  "inputs": "Needed first",
@@ -806,9 +809,45 @@ window.__ModuleLoader__.load({
806
809
  .dsh-wp-planoverview-title { font-size: 12px; font-weight: 650; letter-spacing: .2px; }
807
810
  .dsh-wp-planoverview-stats { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--dsw-alias-label-secondary, #475569); font-variant-numeric: tabular-nums; }
808
811
  .dsh-wp-planrows { display: grid; }
809
- .dsh-wp-planrow { display: grid; grid-template-columns: 7px minmax(0, 1fr) 48px auto auto; align-items: center; gap: 8px; min-height: 28px; padding: 4px 0; border-top: 1px solid var(--dsw-alias-border-l1); }
812
+ /*
813
+ * [1.12.0] 「分步进度」每一行都是一个可点击的 disclosure(默认收起)。
814
+ *
815
+ * 收起态必须与改造前逐项一致:状态点、第 N 步:名称、进度条、done/total、
816
+ * 状态词;只多一个折叠指示箭头。展开按钮本身是原生 <button>,44px 触控高度,
817
+ * aria-expanded/aria-controls 由组件绑定,不复用 Collapse 的外层卡片留白。
818
+ */
819
+ .dsh-wp-planrow { display: block; min-width: 0; border-top: 1px solid var(--dsw-alias-border-l1); }
810
820
  .dsh-wp-planrow:first-child { border-top: 0; }
811
821
  .dsh-wp-planrow[data-current="true"] { background: rgba(249,115,22,.06); border-radius: 8px; }
822
+ .dsh-wp-planrow-toggle {
823
+ display: grid;
824
+ grid-template-columns: 9px 7px minmax(0, 1fr) 48px auto auto;
825
+ align-items: center;
826
+ gap: 8px;
827
+ width: 100%;
828
+ min-height: 44px;
829
+ padding: 4px 6px;
830
+ border: 0;
831
+ border-radius: 8px;
832
+ background: transparent;
833
+ color: inherit;
834
+ font: inherit;
835
+ text-align: left;
836
+ cursor: pointer;
837
+ touch-action: manipulation;
838
+ }
839
+ .dsh-wp-planrow-toggle:hover { background: rgba(148,163,184,.10); }
840
+ .dsh-wp-planrow-toggle:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 2px; }
841
+ .dsh-wp-planrow-chevron {
842
+ justify-self: center;
843
+ width: 8px;
844
+ height: 8px;
845
+ border-right: 2px solid var(--dsw-alias-label-secondary, #475569);
846
+ border-bottom: 2px solid var(--dsw-alias-label-secondary, #475569);
847
+ transform: rotate(-45deg);
848
+ transition: transform 160ms ease;
849
+ }
850
+ .dsh-wp-planrow[data-open="true"] .dsh-wp-planrow-chevron { transform: rotate(45deg); }
812
851
  .dsh-wp-planrow-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dsw-alias-state-idle-primary); }
813
852
  .dsh-wp-planrow[data-tone="done"] .dsh-wp-planrow-dot { background: var(--dsh-wp-done); }
814
853
  .dsh-wp-planrow[data-tone="active"] .dsh-wp-planrow-dot { background: var(--dsh-wp-active); }
@@ -820,6 +859,21 @@ window.__ModuleLoader__.load({
820
859
  .dsh-wp-planrow[data-tone="blocked"] .dsh-wp-planrow-fill { background: var(--dsw-alias-state-error-primary); }
821
860
  .dsh-wp-planrow-count { font-size: 12px; color: var(--dsw-alias-label-secondary, #475569); font-variant-numeric: tabular-nums; }
822
861
  .dsh-wp-planrow-state { font-size: 11px; color: var(--dsw-alias-label-secondary, #475569); white-space: nowrap; }
862
+ .dsh-wp-planrow-panel { padding: 0 6px 10px 30px; min-width: 0; }
863
+ .dsh-wp-planrow-panel[hidden] { display: none; }
864
+ .dsh-wp-planrow-detail { display: grid; gap: 4px; font-size: 12px; color: var(--dsw-alias-label-secondary, #475569); overflow-wrap: anywhere; }
865
+ .dsh-wp-planrow-goal, .dsh-wp-planrow-checkpoint { line-height: 1.5; }
866
+ .dsh-wp-planrow-goal strong, .dsh-wp-planrow-checkpoint strong { color: var(--dsw-alias-label-primary, #0f172a); font-weight: 600; }
867
+ .dsh-wp-planrow-tasks { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 3px; }
868
+ .dsh-wp-planrow-task { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; min-width: 0; }
869
+ .dsh-wp-planrow-task-dot { flex: 0 0 auto; width: 6px; height: 6px; border-radius: 50%; background: var(--dsw-alias-state-idle-primary); }
870
+ .dsh-wp-planrow-task[data-status="done"] .dsh-wp-planrow-task-dot { background: var(--dsh-wp-done); }
871
+ .dsh-wp-planrow-task[data-status="in_progress"] .dsh-wp-planrow-task-dot { background: var(--dsh-wp-active); }
872
+ .dsh-wp-planrow-task[data-status="blocked"] .dsh-wp-planrow-task-dot { background: var(--dsw-alias-state-error-primary); }
873
+ .dsh-wp-planrow-task-title { min-width: 0; color: var(--dsw-alias-label-primary, #0f172a); }
874
+ .dsh-wp-planrow-task-dept { color: var(--dsw-alias-label-secondary, #475569); }
875
+ .dsh-wp-planrow-task-state { margin-left: auto; white-space: nowrap; }
876
+ @media (prefers-reduced-motion: reduce) { .dsh-wp-planrow-chevron { transition: none; } }
823
877
  .dsh-wp-sessions { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); gap: 16px; align-items: start; }
824
878
  .dsh-wp-session {
825
879
  min-width: 0;
@@ -1124,7 +1178,14 @@ window.__ModuleLoader__.load({
1124
1178
  function deptName(t, id) {
1125
1179
  const key = `dept.${id}`;
1126
1180
  const value = t(key);
1127
- return value === key ? String(id || '') : value;
1181
+ /*
1182
+ * [1.12.0][D-09] 未知部门不再回显原文。
1183
+ *
1184
+ * 计划/回放里的非法值(拼错、旧版本、注入文本)不能成为面板分组标题
1185
+ * 或任务行文案。语言表缺键时统一显示「未知部门 / Unknown」,原文只
1186
+ * 留在服务端记录里供审计。
1187
+ */
1188
+ return value === key ? t('dept.unknown') : value;
1128
1189
  }
1129
1190
  /*
1130
1191
  * [1.11.0] 跨部门需求的四档文案(用户 m00687)。
@@ -1857,11 +1918,124 @@ window.__ModuleLoader__.load({
1857
1918
  ? h('span', { className: 'dsh-wp-planviz-alarm' }, `${counts.blocked} ${t('stats.blocked')}`)
1858
1919
  : null, h('span', { className: 'dsh-wp-planviz-now', 'data-state': now.state }, h('span', { className: 'dsh-wp-planviz-now-dot', 'aria-hidden': 'true' }), h('span', { className: 'dsh-wp-planviz-now-text' }, now.text))), h(PlanSegments, { counts }), h(PlanLegend, { t, counts }), h(PlanStepper, { t, rows }));
1859
1920
  }
1860
- // 展开后的「分步进度」:逐阶段行 + 总体进度(与环/组头同一个计数口径)。
1861
- function PlanOverview({ t, stats, counts, rows }) {
1862
- const stateOf = (tone) => (tone === 'done'
1921
+ /*
1922
+ * [1.12.0] 「分步进度」每一步的展开状态。
1923
+ *
1924
+ * 默认不展开;只有用户亲手点开/收起的步骤才写进 localStorage
1925
+ * (存的是「已展开的步骤 id」集合,而不是布尔值数组,新增步骤天然收起)。
1926
+ * 读不到 localStorage(隐私模式、旧 WebView、测试环境)时退回纯内存状态,
1927
+ * 不让存储失败影响交互。轮询刷新、重渲染、状态回放都不会改动这份状态。
1928
+ */
1929
+ const PLANROW_STORAGE_PREFIX = 'dsh-workplan:planrow-open:v1';
1930
+ function planRowStorageKey(sessionId) {
1931
+ return `${PLANROW_STORAGE_PREFIX}:${String(sessionId ?? '')}`;
1932
+ }
1933
+ function readPlanRowOpen(sessionId) {
1934
+ try {
1935
+ const storage = typeof window !== 'undefined' ? window.localStorage : undefined;
1936
+ if (!storage || typeof storage.getItem !== 'function')
1937
+ return [];
1938
+ const raw = storage.getItem(planRowStorageKey(sessionId));
1939
+ if (!raw)
1940
+ return [];
1941
+ const parsed = JSON.parse(raw);
1942
+ if (!Array.isArray(parsed))
1943
+ return [];
1944
+ return Array.from(new Set(parsed.filter((id) => typeof id === 'string' && id !== '')));
1945
+ }
1946
+ catch {
1947
+ return [];
1948
+ }
1949
+ }
1950
+ function writePlanRowOpen(sessionId, ids) {
1951
+ try {
1952
+ const storage = typeof window !== 'undefined' ? window.localStorage : undefined;
1953
+ if (!storage || typeof storage.setItem !== 'function')
1954
+ return;
1955
+ storage.setItem(planRowStorageKey(sessionId), JSON.stringify(ids));
1956
+ }
1957
+ catch {
1958
+ // 配额已满或存储被禁用:保留内存状态,不影响本次交互。
1959
+ }
1960
+ }
1961
+ function planRowDomId(sessionId, rowId) {
1962
+ const safe = `${String(sessionId ?? '')}-${String(rowId ?? '')}`.replace(/[^A-Za-z0-9_-]+/g, '-');
1963
+ return `dsh-wp-planrow-${safe}`;
1964
+ }
1965
+ function planStepStateText(t, tone) {
1966
+ return tone === 'done'
1863
1967
  ? t('stats.done')
1864
- : tone === 'active' ? t('stats.inProgress') : tone === 'blocked' ? t('stats.blocked') : t('stats.pending'));
1968
+ : tone === 'active' ? t('stats.inProgress') : tone === 'blocked' ? t('stats.blocked') : t('stats.pending');
1969
+ }
1970
+ function planTaskStatus(value) {
1971
+ return value === 'done' || value === 'in_progress' || value === 'blocked' ? value : 'pending';
1972
+ }
1973
+ /*
1974
+ * 收起态与截图逐项一致:状态点、第 N 步:名称、进度条、done/total、状态词,
1975
+ * 只多一个折叠箭头。展开态放「该步摘要」(目标、检查点、子任务状态);
1976
+ * 完整明细仍由下方的阶段卡承担,避免 D-6 未拍板时出现两份完全相同的详情。
1977
+ */
1978
+ function PlanStepRow({ t, row, stage, statuses, open, onToggle, panelId, }) {
1979
+ const width = row.total > 0 ? (row.done / row.total) * 100 : 0;
1980
+ const stop = (event) => {
1981
+ if (event && typeof event.stopPropagation === 'function')
1982
+ event.stopPropagation();
1983
+ };
1984
+ const handleClick = (event) => {
1985
+ stop(event);
1986
+ onToggle(!open);
1987
+ };
1988
+ const handleKeyDown = (event) => {
1989
+ const key = event?.key;
1990
+ // 原生 button 已经把 Enter/Space 变成 click;这里只阻止按键冒泡到外层卡片。
1991
+ if (key === 'Enter' || key === ' ' || key === 'Spacebar')
1992
+ stop(event);
1993
+ };
1994
+ const byId = new Map();
1995
+ for (const item of Array.isArray(statuses) ? statuses : []) {
1996
+ if (item && item.subtaskId != null)
1997
+ byId.set(String(item.subtaskId), item);
1998
+ }
1999
+ const subtasks = (Array.isArray(stage?.subtasks) ? stage.subtasks : [])
2000
+ .filter((subtask) => !subtask?.supersededAt);
2001
+ return h('section', {
2002
+ className: 'dsh-wp-planrow',
2003
+ 'data-tone': row.tone,
2004
+ 'data-current': row.current ? 'true' : 'false',
2005
+ 'data-open': open ? 'true' : 'false',
2006
+ }, h('button', {
2007
+ type: 'button',
2008
+ className: 'dsh-wp-planrow-toggle',
2009
+ 'aria-expanded': open,
2010
+ 'aria-controls': panelId,
2011
+ onClick: handleClick,
2012
+ onKeyDown: handleKeyDown,
2013
+ }, h('span', { className: 'dsh-wp-planrow-chevron', 'aria-hidden': 'true' }), h('span', { className: 'dsh-wp-planrow-dot', 'aria-hidden': 'true' }), h('span', { className: 'dsh-wp-planrow-name' }, `${stageLabel(t, row.index)}:${row.name}`), h('span', { className: 'dsh-wp-planrow-bar' }, h('span', {
2014
+ className: 'dsh-wp-planrow-fill',
2015
+ 'data-width': String(Math.round(width)),
2016
+ style: { width: `${width}%` },
2017
+ })), h('span', { className: 'dsh-wp-planrow-count' }, `${row.done}/${row.total}`), h('span', { className: 'dsh-wp-planrow-state' }, planStepStateText(t, row.tone))), h('div', { id: panelId, className: 'dsh-wp-planrow-panel', hidden: !open }, h('div', { className: 'dsh-wp-planrow-detail' }, stage?.goal
2018
+ ? h('div', { className: 'dsh-wp-planrow-goal' }, h('strong', null, `${t('what')}:`), String(stage.goal))
2019
+ : null, stage?.checkpoint
2020
+ ? h('div', { className: 'dsh-wp-planrow-checkpoint' }, h('strong', null, `${t('checkpoint')}:`), String(stage.checkpoint))
2021
+ : null, subtasks.length
2022
+ ? h('ul', { className: 'dsh-wp-planrow-tasks' }, subtasks.map((subtask, index) => {
2023
+ const status = planTaskStatus(byId.get(String(subtask?.id))?.status);
2024
+ return h('li', {
2025
+ key: String(subtask?.id ?? index),
2026
+ className: 'dsh-wp-planrow-task',
2027
+ 'data-status': status,
2028
+ }, h('span', { className: 'dsh-wp-planrow-task-dot', 'aria-hidden': 'true' }), h('span', { className: 'dsh-wp-planrow-task-title' }, `${t('workPrefix')} ${index + 1}:${String(subtask?.title ?? '')}`), h('span', { className: 'dsh-wp-planrow-task-dept' }, deptName(t, subtask?.department)), h('span', { className: 'dsh-wp-planrow-task-state' }, t(`status.${status}`)));
2029
+ }))
2030
+ : null)));
2031
+ }
2032
+ // 展开后的「分步进度」:逐阶段行 + 总体进度(与环/组头同一个计数口径)。
2033
+ function PlanOverview({ t, stats, counts, rows, stages, statuses, sessionId, openRows, onToggleRow, }) {
2034
+ const stagesById = new Map();
2035
+ for (const stage of Array.isArray(stages) ? stages : []) {
2036
+ if (stage?.id != null)
2037
+ stagesById.set(String(stage.id), stage);
2038
+ }
1865
2039
  return h('div', {
1866
2040
  className: 'dsh-wp-planoverview',
1867
2041
  'data-plan-total': String(counts.total),
@@ -1877,22 +2051,35 @@ window.__ModuleLoader__.load({
1877
2051
  */
1878
2052
  h('span', null, `${t('vizOverall')} ${counts.percent === null ? '—' : `${counts.percent}%`}`), h('span', null, `${counts.active} ${t('stats.inProgress')} · ${counts.pending} ${t('stats.pending')}`), counts.blocked > 0 ? h('span', null, `${counts.blocked} ${t('stats.blocked')}`) : null), rows.length
1879
2053
  ? h('div', { className: 'dsh-wp-planrows' }, rows.map((row) => {
1880
- const width = row.total > 0 ? (row.done / row.total) * 100 : 0;
1881
- return h('div', {
2054
+ const panelId = `${planRowDomId(sessionId, row.id)}-panel`;
2055
+ return h(PlanStepRow, {
1882
2056
  key: row.id,
1883
- className: 'dsh-wp-planrow',
1884
- 'data-tone': row.tone,
1885
- 'data-current': row.current ? 'true' : 'false',
1886
- }, h('span', { className: 'dsh-wp-planrow-dot', 'aria-hidden': 'true' }), h('span', { className: 'dsh-wp-planrow-name' }, `${stageLabel(t, row.index)}:${row.name}`), h('span', { className: 'dsh-wp-planrow-bar' }, h('span', {
1887
- className: 'dsh-wp-planrow-fill',
1888
- 'data-width': String(Math.round(width)),
1889
- style: { width: `${width}%` },
1890
- })), h('span', { className: 'dsh-wp-planrow-count' }, `${row.done}/${row.total}`), h('span', { className: 'dsh-wp-planrow-state' }, stateOf(row.tone)));
2057
+ t,
2058
+ row,
2059
+ stage: stagesById.get(String(row.id)),
2060
+ statuses,
2061
+ open: openRows.includes(row.id),
2062
+ onToggle: (next) => onToggleRow(row.id, next),
2063
+ panelId,
2064
+ });
1891
2065
  }))
1892
2066
  : null);
1893
2067
  }
1894
2068
  function SessionCard({ session, t, open, onToggle }) {
1895
2069
  const domId = `dsh-wp-session-${session.sessionId}`;
2070
+ /*
2071
+ * [1.12.0] 受控状态:展开哪几步只由这里决定,初始值只来自 localStorage
2072
+ * (默认空集)。不按「当前步骤」或进度自动展开,也不在数据更新时重置;
2073
+ * 卡片收起再展开时,PlanOverview 重新挂载也拿得到同一份选择。
2074
+ */
2075
+ const [openPlanRows, setOpenPlanRows] = useState(() => readPlanRowOpen(session.sessionId));
2076
+ const togglePlanRow = (rowId, next) => {
2077
+ const nextOpen = next
2078
+ ? [...openPlanRows.filter((id) => id !== rowId), rowId]
2079
+ : openPlanRows.filter((id) => id !== rowId);
2080
+ setOpenPlanRows(nextOpen);
2081
+ writePlanRowOpen(session.sessionId, nextOpen);
2082
+ };
1896
2083
  const stats = session.stats || {};
1897
2084
  // 1.5.0:折叠卡摘要=图表(环 + 百分比 + 四段构成条 + 图例 + 阶段步进条);
1898
2085
  // 数字仍只来自 session.stats,与旧头部的口径完全一致,不引入第二套统计。
@@ -1919,7 +2106,17 @@ window.__ModuleLoader__.load({
1919
2106
  badge: h(Pill, { tone }, phaseLabel(phase, session, t)),
1920
2107
  }, session.updatedAt
1921
2108
  ? h('div', { className: 'dsh-wp-meta dsh-wp-session-updated' }, `${t('updatedAt')} ${formatTime(session.updatedAt)}`)
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,
2109
+ : null, open === true ? h(PlanOverview, {
2110
+ t,
2111
+ stats,
2112
+ counts,
2113
+ rows: stageRows,
2114
+ stages: session.stages,
2115
+ statuses,
2116
+ sessionId: session.sessionId,
2117
+ openRows: openPlanRows,
2118
+ onToggleRow: togglePlanRow,
2119
+ }) : 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
2120
  /*
1924
2121
  * [1.11.0] 执行中收到的需求变更(T10 N5)。
1925
2122
  *