dsh-workplan 1.11.1 → 1.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,61 @@
1
+ # Release record — dsh-workplan 1.11.1 (2026-11-02)
2
+
3
+ Patch release on top of 1.11.0. It fixes a defect that 1.11.0 claimed but did not
4
+ actually enforce at the data layer.
5
+
6
+ ## Source
7
+
8
+ | Item | Value |
9
+ | --- | --- |
10
+ | Commit | `f7c92dc` |
11
+ | Tag | `v1.11.1` (annotated object `06b2b1881809d3cc770292be767447a4505b296c`) |
12
+ | Version declarations | `package.json`, `package-lock.json` (2), `src/host.ts` meta, `CHANGELOG.md`, `README.md`, `README.en.md` — all `1.11.1` |
13
+ | Base | `v1.11.0` @ `71f0b65` |
14
+
15
+ ## What changed
16
+
17
+ `applyReplanStatuses` now cascades a cancelled upstream through the dependency
18
+ graph instead of only marking the cancelled row:
19
+
20
+ - direct dependents become `blocked` with `blockedBy` pointing at the cancelled row;
21
+ - transitive dependents become `blocked` with an error that names the root
22
+ cancelled row and the cancellation reason;
23
+ - live path and replay path use the same function, so a refresh cannot revert
24
+ the cascade.
25
+
26
+ Before this, `probe_d13.mjs` reported `FAIL(before)` against the released 1.11.0
27
+ `lib/`; after the fix it reports `PASS` against the `v1.11.1` tag build.
28
+
29
+ ## Verification
30
+
31
+ | Check | Result |
32
+ | --- | --- |
33
+ | `npm run check` | exit 0 |
34
+ | `npm test` | **364 / 364 passed, 0 failed** |
35
+ | `probe_d13.mjs lib` on the tag clone | `PASS: D-13 cancel cascades A -> B -> C` |
36
+ | Clean-clone build + pack | succeeded |
37
+
38
+ ## GitHub Release
39
+
40
+ - URL: https://github.com/abbaababa/dsh-workplan/releases/tag/v1.11.1
41
+ - Asset: `dsh-workplan-1.11.1.tgz`
42
+ - Size: 918,951 bytes
43
+ - SHA-256: `6cb91fe77f540068186bb9a47198742c2ee5ce58705bd0fa4a56e2260026e0a1`
44
+
45
+ ## npm
46
+
47
+ - `dsh-workplan@1.11.1` published; registry propagation can take a few minutes
48
+ before `npm view dsh-workplan@latest version` reports it.
49
+
50
+ ## Catalog index
51
+
52
+ - PR https://github.com/awesome-dsh-plugin/awesome-dsh-plugin/pull/11316 updated
53
+ to `v1.11.1/dsh-workplan-1.11.1.tgz` (OPEN, MERGEABLE, single file).
54
+ - The upstream catalog npm package is still rebuilt by the upstream CI; this
55
+ repository cannot publish it.
56
+
57
+ ## Known limits (unchanged from 1.11.0)
58
+
59
+ SSE push (4 s polling), department duties as data, contract v2, checkpoint
60
+ runtime semantics, child-session shell guard, per-artifact locking, and the
61
+ remaining medium/low items in `_t10_defect_triage_20261102/defects.json`.
@@ -0,0 +1,99 @@
1
+ # dsh-workplan 1.12.0 发布记录(可复核)
2
+
3
+ - 发布时刻:2026-11-03 10:00–10:17(Asia/Shanghai)
4
+ - 发布人:主 Agent(abbaababa / npm open-dsh)
5
+ - 版本:**1.12.0**(10 个声明点一致,`verify_version.mjs` → `ALL_EQUAL=1.12.0`)
6
+
7
+ ## 1. 提交与 tag
8
+
9
+ | 项 | 值 |
10
+ |---|---|
11
+ | 发布提交 | `6f5bd88a990ead0b98a858277c535058985dd91f` |
12
+ | commit 标题 | `Release 1.12.0: rebase T11 low-risk patches, acceptance IDs, auto-dispatch, collapsible step rows` |
13
+ | tag | `v1.12.0`(annotated,tag 对象 `7f4bf784799170eeb182234af4dcedbc43677ed5`) |
14
+ | tag → 提交 | `git rev-list -n 1 v1.12.0` = `6f5bd88a990ead0b98a858277c535058985dd91f`(一致) |
15
+ | 远端 | `main` 已推送 `f5160ff..6f5bd88`;`git ls-remote --tags origin v1.12.0` 返回 `refs/tags/v1.12.0` |
16
+
17
+ 复核命令:
18
+
19
+ ```bash
20
+ cd plugins/dsh-workplan
21
+ git rev-parse HEAD
22
+ git rev-list -n 1 v1.12.0
23
+ git ls-remote --tags origin v1.12.0
24
+ ```
25
+
26
+ ## 2. 干净克隆门禁(tag 构建,不是本机脏树)
27
+
28
+ 在 `/tmp/dsh-workplan-release-1.12.0`(`git clone --depth 1 --branch v1.12.0`)执行:
29
+
30
+ | 命令 | 结果 |
31
+ |---|---|
32
+ | `npm ci` | 退出 0 |
33
+ | `npm run check` | 退出 0(`tsc -p tsconfig.json --noEmit`) |
34
+ | `npm test` | **tests 459 / pass 459 / fail 0**,退出 0 |
35
+ | `npm run build` | 退出 0 |
36
+ | `npm pack` | `dsh-workplan-1.12.0.tgz`,**983,635 B**,sha256 `ebda99d10eda30e73f7061d0c5ed22b2b428a7f05b3a838ede600477dcd3c54e` |
37
+
38
+ 包清单 83 个文件;含 `lib/departments.js`、`lib/understanding.js`、`lib/replan.js`、`docs/release-notes-1.12.0.md`(5,444 B,含「10 个声明点」);`*.orig` / `*.rej` / `*.tgz` 计数为 0。
39
+
40
+ ## 3. GitHub Release
41
+
42
+ - URL:https://github.com/abbaababa/dsh-workplan/releases/tag/v1.12.0
43
+ - 资产:`dsh-workplan-1.12.0.tgz`,state `uploaded`,**983,635 B**
44
+ - 资产 digest(GitHub API 返回):`sha256:ebda99d10eda30e73f7061d0c5ed22b2b428a7f05b3a838ede600477dcd3c54e`
45
+ - 实际下载复核:`gh release download v1.12.0 --pattern 'dsh-workplan-1.12.0.tgz'` 成功,落盘 983,635 B,`shasum -a 256` 与 digest 完全一致。
46
+ - 直连 `curl https://github.com/.../download/...` 在本机网络返回 `HTTP=000`(连接失败,非 404);因此本条不使用 curl 200 作为证据,改以上面的 API state + 实际下载哈希为证据。
47
+
48
+ 复核命令:
49
+
50
+ ```bash
51
+ gh api repos/abbaababa/dsh-workplan/releases/tags/v1.12.0 \
52
+ --jq '{tag:.tag_name,assets:[.assets[]|{name,size,state,digest}]}'
53
+ ```
54
+
55
+ ## 4. npm
56
+
57
+ | 项 | 值 |
58
+ |---|---|
59
+ | `npm publish` | 成功(`+ dsh-workplan@1.12.0`) |
60
+ | `npm view dsh-workplan@latest version` | `1.12.0` |
61
+ | `npm view dsh-workplan@1.12.0 version` | `1.12.0` |
62
+ | tarball | `https://registry.npmjs.org/dsh-workplan/-/dsh-workplan-1.12.0.tgz` |
63
+ | `dist.shasum` | `9be532629f357cc850e0b2fc6f3b8836daf2ac8d` |
64
+ | `dist.integrity` | `sha512-K12M8xrT19AjFA6lMy/2QvpiEC7fwVGebhBpdsZT4G/mf00MEvYQvsEtxyQXPbOIbNlZnBOA6RK+4kGHPhfS2Q==` |
65
+
66
+ 安装烟测(`/tmp/dsh-wp-install-1.12`):
67
+
68
+ ```text
69
+ npm i dsh-workplan@1.12.0
70
+ installed 1.12.0
71
+ node_modules/dsh-workplan/lib/host.js 中 createHandoffTool 出现 3 次
72
+ 包内 docs/release-notes-1.12.0.md 含「10 个声明点」
73
+ ```
74
+
75
+ ## 5. 索引源
76
+
77
+ - 上游仓库:`awesome-dsh-plugin/awesome-dsh-plugin`
78
+ - 条目:`data/plugins/abbaababa__dsh-workplan.yml`,`tarball` 改为
79
+ `https://github.com/abbaababa/dsh-workplan/releases/download/v1.12.0/dsh-workplan-1.12.0.tgz`
80
+ - PR:https://github.com/awesome-dsh-plugin/awesome-dsh-plugin/pull/11515
81
+ - 状态:**OPEN / MERGEABLE**,diff 为 1 行新增 + 1 行删除(只改 tarball)
82
+ - 边界:合并由上游维护者决定;合并后上游 CI(cron)重建 `dsh-plugin-catalog`,jsDelivr 有缓存。**合并前不能写「索引已生效」。**
83
+
84
+ ## 6. 发布决策(用户答复)
85
+
86
+ | 问题 | 用户选择 | 落地 |
87
+ |---|---|---|
88
+ | 智能验收口径 | 固定样例 + 代码护栏 | 发布说明按「代码级护栏 + 固定样例」限定,不宣称真实模型命中率 |
89
+ | 自动派发默认值 | 默认开启(plan 模式除外) | `autoDispatch` 默认 true;`autoDispatch:false` / `DSH_WORKPLAN_AUTO_DISPATCH=0` 可关 |
90
+ | 截图红圈位置 | 「分步进度」那几行 | 与实现一致:默认收起,点击行或 Enter/Space 展开 |
91
+
92
+ ## 7. 已知限制(未折算为已修)
93
+
94
+ - U-17:42 条 `present` 缺陷中 28 条仍无逐条复验;D-01 / D-13 属高风险补丁范围(D-13 的级联修复已在 1.11.1)。
95
+ - 真实模型 20 条任务的理解质量 / 部门命中率未跑;T10 的 41/41 是历史计划回放,只证明旧计划不被误伤。
96
+ - 自动派发的宿主端到端未单独演练(配置解析与计划消息有单测)。
97
+ - 真实浏览器点击未在带登录态的 3080 页面完成(组件级 17/17 已过)。
98
+ - 当前宿主进程仍是 v1.11.1 旧构建;需要重启 DSH Web 才会加载 1.12.0(插件为 `link:` 安装,重启即可,无需重新安装)。
99
+ - 索引 PR 未合并,catalog npm 包未重建。
@@ -32,7 +32,8 @@
32
32
  * re-running a done subtask cannot fix a missing acceptance item, it only
33
33
  * produces duplicate work and a chance to overwrite the evidence.
34
34
  *
35
- * Default: **off**. See `AUTO_RESUME_DEFAULTS.enabled`.
35
+ * Default: **on**. `AUTO_RESUME_DEFAULTS.enabled = true`; turn it off with
36
+ * profile `autoResume: false` or `DSH_WORKPLAN_AUTO_RESUME=0`.
36
37
  */
37
38
  /** Tunables that are policy, not deployment config. */
38
39
  export const AUTO_RESUME_DEFAULTS = Object.freeze({
@@ -99,6 +100,25 @@ export function autoResumeEnabledFrom(configValue, envValue) {
99
100
  }
100
101
  return AUTO_RESUME_DEFAULTS.enabled === true;
101
102
  }
103
+ /**
104
+ * [1.12.0] Count the rows that still participate in scheduling.
105
+ *
106
+ * A `closure:'replanned'` row keeps `status:'pending'` for audit. Counting it as
107
+ * pending made `armAutoResume` schedule a continuation round that could dispatch
108
+ * nothing (every live row was done) and then append a misleading
109
+ * `PHASE_NOT_PAUSED` stop line to `record.errors`.
110
+ *
111
+ * `armAutoResume` now passes these counts to `decideAutoResume`; `total` there
112
+ * still comes from `derivePlanSnapshot` (same live-row rule).
113
+ *
114
+ * @param statuses - the plan's status list.
115
+ * @returns live `done` / `pending` / `blocked` counts.
116
+ */
117
+ export function liveResumeCounts(statuses) {
118
+ const live = (Array.isArray(statuses) ? statuses : []).filter((item) => item?.closure !== 'replanned');
119
+ const count = (status) => live.filter((item) => item?.status === status).length;
120
+ return { done: count('done'), pending: count('pending'), blocked: count('blocked') };
121
+ }
102
122
  /**
103
123
  * Decide whether one more round may start, and when.
104
124
  *
@@ -107,8 +127,8 @@ export function autoResumeEnabledFrom(configValue, envValue) {
107
127
  * 2. user stop (`cancelled`, `superseded`) — never resurrect a decision
108
128
  * 3. already running / plan mode
109
129
  * 4. only a `paused` phase is auto-continuable
110
- * 5. nothing pending (includes "all done, evidence gap" — human work)
111
- * 6. any `blocked` row — a real failure, not a budget artifact
130
+ * 5. any `blocked` row — a real failure, not a budget artifact
131
+ * 6. nothing pending (includes "all done, evidence gap" — human work)
112
132
  * 7. attempt / progress budgets
113
133
  *
114
134
  * @param input - the frozen facts of the round that just ended.
@@ -125,7 +145,7 @@ export function decideAutoResume(input) {
125
145
  delayMs: 0,
126
146
  });
127
147
  if (input.enabled !== true) {
128
- return stop('AUTO_RESUME_DISABLED', '自动续跑开关未开启(默认关闭)');
148
+ return stop('AUTO_RESUME_DISABLED', '自动续跑开关未开启(已被显式关闭:profile autoResume:false 或 DSH_WORKPLAN_AUTO_RESUME=0)');
129
149
  }
130
150
  if (input.degraded === true || Number(input.total) <= 0) {
131
151
  return stop('NO_PLAN', '没有可续跑的计划(自动分解降级或子任务数为 0)');
@@ -145,6 +165,17 @@ export function decideAutoResume(input) {
145
165
  if (input.phase !== 'paused') {
146
166
  return stop('PHASE_NOT_PAUSED', `计划阶段是 ${String(input.phase ?? 'unknown')},只有 paused(预算到点)才自动续跑`);
147
167
  }
168
+ /*
169
+ * [1.12.0] 「有 blocked」先于「没有 pending」(T11)。
170
+ *
171
+ * 旧顺序把 `done=N, blocked=1, pending=0` 判成 NOTHING_PENDING(证据缺口),
172
+ * 而真正要处理的是那条 blocked 行。1.12 起预算到点会保留等指示行并把阶段写成
173
+ * blocked(PHASE_NOT_PAUSED 先命中),但历史会话回放仍可能出现 paused + blocked,
174
+ * 所以这里按可执行的优先序回答。
175
+ */
176
+ if (Number(input.blocked) > 0) {
177
+ return stop('HAS_BLOCKED', `存在 ${input.blocked} 个 blocked 子任务:那是真实失败,需人工改判或显式续跑,不自动修复`);
178
+ }
148
179
  if (Number(input.pending) <= 0) {
149
180
  /*
150
181
  * Also the evidence-gap case: all rows done but deliveryReady=false.
@@ -153,9 +184,6 @@ export function decideAutoResume(input) {
153
184
  */
154
185
  return stop('NOTHING_PENDING', '没有 pending 项:若仍未就绪,那是证据缺口,需主 Agent 复核,不能靠重跑 done 项解决');
155
186
  }
156
- if (Number(input.blocked) > 0) {
157
- return stop('HAS_BLOCKED', `存在 ${input.blocked} 个 blocked 子任务:那是真实失败,需人工改判或显式续跑,不自动修复`);
158
- }
159
187
  if (attempt >= maxAttempts) {
160
188
  return stop('BUDGET_EXHAUSTED', `自动续跑已用满 ${maxAttempts} 轮,交给主 Agent 决定`);
161
189
  }
package/lib/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
  *