@skillre/dsh-plugin-work-dashboard 0.13.0 → 0.15.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.
Files changed (38) hide show
  1. package/README.en.md +6 -9
  2. package/README.md +9 -12
  3. package/lib/client/api.d.ts +3 -3
  4. package/lib/client/api.js +1 -3
  5. package/lib/client/text.js +5 -5
  6. package/lib/client.js +37 -30
  7. package/lib/index.js +56 -8
  8. package/lib/report-contract.d.ts +132 -2
  9. package/lib/report-contract.js +127 -1
  10. package/lib/report-form.d.ts +33 -2
  11. package/lib/report-form.js +79 -6
  12. package/lib/report-page.js +2093 -1481
  13. package/lib/report-style.d.ts +24 -12
  14. package/lib/report-style.js +368 -447
  15. package/lib/transport.d.ts +5 -5
  16. package/lib/transport.js +4 -3
  17. package/lib/types.d.ts +25 -10
  18. package/package.json +9 -16
  19. package/skills/poc-export/SKILL.md +3 -3
  20. package/skills/poc-export/scripts/export-form.mjs +24 -5
  21. package/skills/poc-submit/SKILL.md +2 -2
  22. package/compatibility.json +0 -240
  23. package/docs/DESIGN-0.3.md +0 -122
  24. package/docs/DESIGN-1.0-/344/274/230/345/214/226/346/226/271/346/241/210.md +0 -212
  25. package/docs/DESIGN-/344/274/232/350/257/235/344/272/214-SuperAgent/344/270/216/344/273/223/345/272/223/346/224/271/351/200/240.md +0 -275
  26. package/docs/DESIGN-/345/257/274/345/207/272/350/241/250/345/215/225/351/207/215/350/256/276/350/256/241.md +0 -330
  27. package/docs/DESIGN-/346/217/220/351/206/222/344/270/216Gate/350/257/204/345/256/241.md +0 -518
  28. package/docs/DESIGN-/346/226/207/346/234/254/346/210/252/346/226/255.md +0 -565
  29. package/docs/DESIGN-/350/241/250/345/215/225/345/210/206/351/230/266/346/256/265.md +0 -420
  30. package/docs/LEDGER-REQUIREMENTS-v3.1.md +0 -367
  31. package/docs/PLAN-0.7-0.9.md +0 -230
  32. package/docs/PLAN-v3.1-adaptation.md +0 -237
  33. package/docs/POC-3.2-/350/277/233/345/261/225/345/245/221/347/272/246.md +0 -21
  34. package/docs/Super-Agent-3.2-/350/201/224/350/260/203/346/211/213/345/206/214.md +0 -38
  35. package/docs/TARGET-/345/217/260/350/264/246/344/273/223/345/272/223v3.1.md +0 -500
  36. package/docs//350/200/201Mac-SuperAgent/346/224/271/351/200/240/350/256/260/345/275/225-/347/254/254/344/272/214/346/255/245.md +0 -233
  37. package/lib/form.d.ts +0 -597
  38. package/lib/form.js +0 -3211
package/README.en.md CHANGED
@@ -21,7 +21,7 @@ Work Dashboard (plugin)
21
21
  ├── Project detail stage-aware skeleton: basic info / worklist, then the blocks the current gate needs
22
22
  ├── Risk board severity swimlanes + a distribution figure
23
23
  ├── Global timeline grouped by month + a monthly distribution + the silent projects
24
- └── Export form offline worksheets for new projects and plan-based progress reports
24
+ └── Export form one offline worksheet per project for new registrations and plan-based progress reports
25
25
  ```
26
26
 
27
27
  ## Three bundled skills
@@ -201,20 +201,18 @@ A local tarball is likewise **outside** the official update path.
201
201
 
202
202
  ```sh
203
203
  npm install
204
- npm run check # typecheck + 172 unit tests + lib-drift check + pack check
205
- npm pack # produces skillre-dsh-plugin-work-dashboard-0.4.0.tgz
204
+ npm run check # typecheck + unit tests + pack check
205
+ npm pack # produces skillre-dsh-plugin-<version>.tgz
206
206
  ```
207
207
 
208
- Real mount verification **only against an owned, disposable, non-Desktop profile**:
208
+ Browser verification **only against an owned, disposable, non-Desktop profile**:
209
209
 
210
210
  ```sh
211
- node scripts/verify-isolated.mjs # real clone/fetch/detail/auth/restart-wipe + risks/timeline, self-cleaning
212
211
  node scripts/ui-preview.mjs # boots a bounded Web instance and writes .preview-url.txt
213
212
  node scripts/ui-verify.mjs # browser assertions + docs/evidence/ screenshots
214
- node scripts/verify-market-install.mjs # LIVE index → real install → routes answer (requires a published entry)
215
213
  ```
216
214
 
217
- `ui-preview.mjs` stops its processes and deletes the isolated root it created; `verify-isolated.mjs` cleans up in a `finally` and verifies the root is gone. Every script points `cacheRoot` inside the isolated profile and **never touches your real `~/.dsh/cache`**.
215
+ `ui-preview.mjs` stops its processes and deletes the isolated root it created. The scripts point `cacheRoot` inside the isolated profile and **never touch your real `~/.dsh/cache`**.
218
216
 
219
217
  The UI harness must rebuild and repack before it runs: the preview installs the packed artifact, so verifying without a rebuild would verify the previous build.
220
218
 
@@ -226,10 +224,9 @@ See [UNINSTALL.md](UNINSTALL.md). All data lives in the GitHub repository, so un
226
224
 
227
225
  | DSH version | Result | Verified | Notes |
228
226
  |---|---|---|---|
229
- | 0.2.2-rc.2 | passed | 2026-11-13 | packed install + bounded startup + real clone + 31 isolated checks (incl. the three skills really reaching the skill catalog) + 15 live market npm-install checks (see `compatibility.json`) |
227
+ | 0.2.2-rc.2 | passed | 2026-11-13 | packed install + bounded startup + real clone + 31 isolated checks (incl. the three skills really reaching the skill catalog) + 15 live market npm-install checks (see ``) |
230
228
  | 0.2.2-rc.1 | passed | 2026-11-06 | same behaviour + 69 browser assertions; 0.6.0 does not touch the client bundle, so that record still holds |
231
229
 
232
- Machine-readable evidence is in `compatibility.json`; screenshots and reports are in `docs/evidence/`. **Desktop Client (Electron) was not verified**: its profile is managed by the app and this CLI harness cannot drive it, so a Desktop-specific visual check is still outstanding before Desktop delivery.
233
230
 
234
231
  ## Implementation notes
235
232
 
package/README.md CHANGED
@@ -23,12 +23,12 @@
23
23
  ├── 项目详情 阶段感知骨架:基本信息 / 待补清单 + 按 Gate 重排的区块(其余折叠,字段不丢)
24
24
  ├── 风险看板 按等级分泳道 + 严重度分布条
25
25
  ├── 全局时间线 按月份分组 + 月度分布条 + 无进展项目清单
26
- └── 导出表单 新建项目或对照上轮计划逐项反馈,离线填写并回传 HTML
26
+ └── 导出表单 一项目一文件,新建项目或对照上轮计划逐项反馈
27
27
  ```
28
28
 
29
29
  ## 记录进展怎样回流
30
30
 
31
- 组员只填事实。「记录进展」读取最新追加轮的计划,支持计划外工作和多条下轮安排;G0/G1/G2/G4 事实另外折叠。回传 HTML 可直接打开阅读,由 `poc-submit` 解析并准备候选,不运行回执脚本、不直接写主分支。旧 3.1 仍可读取,正式接收新版回执需要台账先迁移至 3.2。见 [台账与表单契约](<docs/POC-3.2-进展契约.md>) 与 [Super Agent 联调](<docs/Super-Agent-3.2-联调手册.md>)。
31
+ 组员只填事实。「记录进展」读取最新追加轮的计划,支持计划外工作和多条下轮安排;G0/G1/G2/G4 事实另外折叠。保存后的表单文件可直接打开续填,由 `poc-submit` 解析并准备候选,不运行页面脚本、不直接写主分支。旧 3.1 仍可读取,正式接收新版回执需要台账先迁移至 3.2。见 [台账与表单契约](<docs/POC-3.2-进展契约.md>) 与 [Super Agent 联调](<docs/Super-Agent-3.2-联调手册.md>)。
32
32
 
33
33
  ## 随包安装的三个技能
34
34
 
@@ -38,7 +38,7 @@
38
38
  |---|---|---|
39
39
  | `poc-ledger` | 读取并分析台账(v3),回答进展、判断阶段、识别 12 条缺口 | 「某个 POC 怎么样了」「哪些项目卡住了」 |
40
40
  | `poc-export` | 生成自包含 HTML 收集表单,给没有 GitHub 账号的组员填 | 「导出表单」「让某某补一下这个项目的进展」 |
41
- | `poc-submit` | 解析回传 HTML/JSON,校验 3.2 后准备待审差异 | 「把这个文件提交上去」「帮我提个 PR」 |
41
+ | `poc-submit` | 解析保存后的表单文件,校验 3.2 后准备待审差异 | 「把这个文件提交上去」「帮我提个 PR」 |
42
42
 
43
43
  **为什么随包发**:这三个技能描述的字段必须和看板读的数据是同一套。它们曾经作为独立 skill
44
44
  装在用户目录里,结果数据模型从 v1 升到 v3 后,skill 还在教模型读 `why_customer_test` /
@@ -132,7 +132,7 @@ POC 台账最容易烂在「感觉做成了」上:项目说结果达成,但
132
132
 
133
133
  ### 导出收集表单
134
134
 
135
- 页头「导出表单」只提供「新建项目」和「记录进展」。后者从最新一次**追加轮**读取计划,并逐项收集实际结果;计划外工作也可追加。组员填写后的「生成回传文件」才是需要回传的文件,直接把原始表单发回不会带有草稿。草稿只保存在浏览器,与这一份表单的导出快照绑定。
135
+ 页头「导出表单」只提供「新建项目」和「记录进展」。后者从最新一次**追加轮**读取计划,并逐项收集实际结果;计划外工作也可追加。**一个项目一个文件**,文件名是「项目名称_负责人_记录进展_日期.html」。组员填完点「保存」,保存下来的就是这份表单本身(内容已写入),发回该文件即可,没有单独的 JSON 或只读回执。
136
136
 
137
137
  新版表单生成 HTML 回执(可另存同数据的 JSON),不会生成可直接覆盖台账的 YAML。`poc-submit` 拒绝失效附件,先准备追加差异,再用台账自己的校验器和派生工具作审查。正式导入要求台账已启用 3.2;原有 3.1 历史不需重填。
138
138
 
@@ -308,20 +308,18 @@ DSH `0.2.2` 线起,插件详情页有「版本 / Versions」区块,能检查
308
308
 
309
309
  ```sh
310
310
  npm install
311
- npm run check # typecheck + 172 个单测 + lib 漂移检查 + 打包检查
312
- npm pack # 产出 skillre-dsh-plugin-work-dashboard-0.4.0.tgz
311
+ npm run check # typecheck + 单测 + 打包检查
312
+ npm pack # 产出 skillre-dsh-plugin-<version>.tgz
313
313
  ```
314
314
 
315
- **仅使用自己拥有的、可丢弃的非 Desktop profile**做真实挂载验证:
315
+ **仅使用自己拥有的、可丢弃的非 Desktop profile**做浏览器侧验证:
316
316
 
317
317
  ```sh
318
- node scripts/verify-isolated.mjs # 真实 clone/fetch/详情/鉴权/重启清空 + 风险/时间线,结束自清理
319
318
  node scripts/ui-preview.mjs # 起一个有界 Web 实例并写入 .preview-url.txt
320
319
  node scripts/ui-verify.mjs # 浏览器断言 + docs/evidence/ 截图
321
- node scripts/verify-market-install.mjs # 线上索引 → 真实安装 → 动作可用(需已发布)
322
320
  ```
323
321
 
324
- `ui-preview.mjs` 必须在退出前创建 `.preview-stop`,或让它超时;它会停进程、删掉自己创建的隔离根目录。`verify-isolated.mjs` 在 `finally` 里清理并校验根目录已消失。所有脚本都把 `cacheRoot` 指向隔离 profile 内的路径,**不会碰你真实的 `~/.dsh/cache`**。
322
+ `ui-preview.mjs` 必须在退出前创建 `.preview-stop`,或让它超时;它会停进程、删掉自己创建的隔离根目录。脚本把 `cacheRoot` 指向隔离 profile 内的路径,**不会碰你真实的 `~/.dsh/cache`**。
325
323
 
326
324
  ## 卸载与回滚
327
325
 
@@ -331,10 +329,9 @@ node scripts/verify-market-install.mjs # 线上索引 → 真实安装 → 动
331
329
 
332
330
  | DSH 版本 | 结果 | 验证日期 | 说明 |
333
331
  |---|---|---|---|
334
- | 0.2.2-rc.2 | 通过 | 2026-11-13 | 打包安装 + 有界启动 + 真实 clone + 31 项隔离集成(含三个技能确实进入技能目录)+ 15 项线上市场 npm 安装(见 `compatibility.json`) |
332
+ | 0.2.2-rc.2 | 通过 | 2026-11-13 | 打包安装 + 有界启动 + 真实 clone + 31 项隔离集成(含三个技能确实进入技能目录)+ 15 项线上市场 npm 安装(见 ``) |
335
333
  | 0.2.2-rc.1 | 通过 | 2026-11-06 | 同上行为 + 69 项浏览器断言;0.6.0 未改动客户端产物,该记录仍然有效 |
336
334
 
337
- 机器可读证据在 `compatibility.json`,截图与报告在 `docs/evidence/`。**未验证 Desktop Client(Electron)**:它的 profile 由应用管理,本 CLI 测试台无法驱动,Desktop 发布前需在那里重做一次视觉检查。
338
335
 
339
336
  ## 实现说明
340
337
 
@@ -33,10 +33,10 @@ export interface ClientApi {
33
33
  /**
34
34
  * Build the collection form.
35
35
  *
36
- * Generated on the Host because the generator needs the YAML serializer, which
37
- * must not be bundled into the browser module.
36
+ * Generated on the Host because the generator needs the ledger's display
37
+ * projection, which must not be bundled into the browser module.
38
38
  */
39
- exportForm(mode: 'fill' | 'blank', pocIds: readonly string[], intent?: 'new' | 'supplement' | 'progress', signal?: AbortSignal): Promise<ExportFormResult>;
39
+ exportForm(mode: 'fill' | 'blank', pocIds: readonly string[], signal?: AbortSignal): Promise<ExportFormResult>;
40
40
  }
41
41
  /** Create the API bound to this plugin's Fiber lifetime. */
42
42
  export declare function createApi(connection: ClientConnectionLike, lifetime: AbortSignal): ClientApi;
package/lib/client/api.js CHANGED
@@ -40,8 +40,6 @@ export function createApi(connection, lifetime) {
40
40
  detail: (pocId, signal) => call({ action: 'detail', pocId }, signal),
41
41
  risks: (signal) => call({ action: 'risks' }, signal),
42
42
  timeline: (signal) => call({ action: 'timeline' }, signal),
43
- exportForm: (mode, pocIds, intent, signal) => call(intent === undefined
44
- ? { action: 'export-form', mode, pocIds: [...pocIds] }
45
- : { action: 'export-form', mode, pocIds: [...pocIds], intent }, signal),
43
+ exportForm: (mode, pocIds, signal) => call({ action: 'export-form', mode, pocIds: [...pocIds] }, signal),
46
44
  };
47
45
  }
@@ -155,7 +155,7 @@ export const zh = {
155
155
  // Milestone 3: export form
156
156
  exportNav: '导出表单',
157
157
  exportTitle: '导出给组员填写的表单',
158
- exportSubtitle: '勾选项目,生成一个自包含 HTML 文件:双击即可填写,自动保存,实时校验。组员填完点【生成回传文件】,通过企业微信发回即可。',
158
+ exportSubtitle: '勾选项目,每个项目生成一个自包含 HTML 文件:双击即可填写,自动保存,实时校验。组员填完点「保存」(内容写回该文件),通过企业微信发回即可。',
159
159
  exportSelectAll: '全选',
160
160
  exportSelectNone: '清空',
161
161
  exportSelected: '已选 {count} 个项目',
@@ -172,8 +172,8 @@ export const zh = {
172
172
  exportStageFilterLabel: '按阶段筛选',
173
173
  exportStageAll: '全部阶段',
174
174
  exportStageEmpty: '这个阶段下没有项目。',
175
- exportHint: '表单完全离线可用:没有 CDN、没有外部字体、没有服务器。组员填完生成回传 HTML,通过企业微信发回。DSH 校验后准备待审变更,不直接写台账。',
176
- exportGenerate: '生成并下载',
175
+ exportHint: '表单完全离线可用:没有 CDN、没有外部字体、没有服务器。每个项目一个文件;组员点「保存」把内容写回表单文件,再用企业微信发回。DSH 校验后准备待审变更,不直接写台账。',
176
+ exportGenerate: '生成表单文件',
177
177
  exportGenerating: '正在生成…',
178
178
  exportDone: '已下载 {name}',
179
179
  exportSize: '{kb} KB',
@@ -756,8 +756,8 @@ export const en = {
756
756
  exportStageFilterLabel: 'Filter by stage',
757
757
  exportStageAll: 'All stages',
758
758
  exportStageEmpty: 'No projects at this stage.',
759
- exportHint: 'The form works fully offline: no CDN, no external fonts, no server. The colleague downloads an HTML return file to send back. DSH validates it and prepares a change for review.',
760
- exportGenerate: 'Generate and download',
759
+ exportHint: 'The form works fully offline: no CDN, no external fonts, no server. One file per project: the colleague saves answers back into the same form file and sends it back. DSH validates it and prepares a change for review.',
760
+ exportGenerate: 'Generate form files',
761
761
  exportGenerating: 'Generating…',
762
762
  exportDone: 'Downloaded {name}',
763
763
  exportSize: '{kb} KB',
package/lib/client.js CHANGED
@@ -80,6 +80,8 @@ window.__ModuleLoader__.load({
80
80
  this.details = details;
81
81
  this.name = "ActionError";
82
82
  }
83
+ code;
84
+ details;
83
85
  };
84
86
  function unwrap(result) {
85
87
  if (result === null || typeof result !== "object" || !("ok" in result)) {
@@ -99,8 +101,8 @@ window.__ModuleLoader__.load({
99
101
  detail: (pocId, signal) => call({ action: "detail", pocId }, signal),
100
102
  risks: (signal) => call({ action: "risks" }, signal),
101
103
  timeline: (signal) => call({ action: "timeline" }, signal),
102
- exportForm: (mode, pocIds, intent, signal) => call(
103
- intent === void 0 ? { action: "export-form", mode, pocIds: [...pocIds] } : { action: "export-form", mode, pocIds: [...pocIds], intent },
104
+ exportForm: (mode, pocIds, signal) => call(
105
+ { action: "export-form", mode, pocIds: [...pocIds] },
104
106
  signal
105
107
  )
106
108
  };
@@ -250,7 +252,7 @@ window.__ModuleLoader__.load({
250
252
  // Milestone 3: export form
251
253
  exportNav: "\u5BFC\u51FA\u8868\u5355",
252
254
  exportTitle: "\u5BFC\u51FA\u7ED9\u7EC4\u5458\u586B\u5199\u7684\u8868\u5355",
253
- exportSubtitle: "\u52FE\u9009\u9879\u76EE\uFF0C\u751F\u6210\u4E00\u4E2A\u81EA\u5305\u542B HTML \u6587\u4EF6\uFF1A\u53CC\u51FB\u5373\u53EF\u586B\u5199\uFF0C\u81EA\u52A8\u4FDD\u5B58\uFF0C\u5B9E\u65F6\u6821\u9A8C\u3002\u7EC4\u5458\u586B\u5B8C\u70B9\u3010\u751F\u6210\u56DE\u4F20\u6587\u4EF6\u3011\uFF0C\u901A\u8FC7\u4F01\u4E1A\u5FAE\u4FE1\u53D1\u56DE\u5373\u53EF\u3002",
255
+ exportSubtitle: "\u52FE\u9009\u9879\u76EE\uFF0C\u6BCF\u4E2A\u9879\u76EE\u751F\u6210\u4E00\u4E2A\u81EA\u5305\u542B HTML \u6587\u4EF6\uFF1A\u53CC\u51FB\u5373\u53EF\u586B\u5199\uFF0C\u81EA\u52A8\u4FDD\u5B58\uFF0C\u5B9E\u65F6\u6821\u9A8C\u3002\u7EC4\u5458\u586B\u5B8C\u70B9\u300C\u4FDD\u5B58\u300D\uFF08\u5185\u5BB9\u5199\u56DE\u8BE5\u6587\u4EF6\uFF09\uFF0C\u901A\u8FC7\u4F01\u4E1A\u5FAE\u4FE1\u53D1\u56DE\u5373\u53EF\u3002",
254
256
  exportSelectAll: "\u5168\u9009",
255
257
  exportSelectNone: "\u6E05\u7A7A",
256
258
  exportSelected: "\u5DF2\u9009 {count} \u4E2A\u9879\u76EE",
@@ -267,8 +269,8 @@ window.__ModuleLoader__.load({
267
269
  exportStageFilterLabel: "\u6309\u9636\u6BB5\u7B5B\u9009",
268
270
  exportStageAll: "\u5168\u90E8\u9636\u6BB5",
269
271
  exportStageEmpty: "\u8FD9\u4E2A\u9636\u6BB5\u4E0B\u6CA1\u6709\u9879\u76EE\u3002",
270
- exportHint: "\u8868\u5355\u5B8C\u5168\u79BB\u7EBF\u53EF\u7528\uFF1A\u6CA1\u6709 CDN\u3001\u6CA1\u6709\u5916\u90E8\u5B57\u4F53\u3001\u6CA1\u6709\u670D\u52A1\u5668\u3002\u7EC4\u5458\u586B\u5B8C\u751F\u6210\u56DE\u4F20 HTML\uFF0C\u901A\u8FC7\u4F01\u4E1A\u5FAE\u4FE1\u53D1\u56DE\u3002DSH \u6821\u9A8C\u540E\u51C6\u5907\u5F85\u5BA1\u53D8\u66F4\uFF0C\u4E0D\u76F4\u63A5\u5199\u53F0\u8D26\u3002",
271
- exportGenerate: "\u751F\u6210\u5E76\u4E0B\u8F7D",
272
+ exportHint: "\u8868\u5355\u5B8C\u5168\u79BB\u7EBF\u53EF\u7528\uFF1A\u6CA1\u6709 CDN\u3001\u6CA1\u6709\u5916\u90E8\u5B57\u4F53\u3001\u6CA1\u6709\u670D\u52A1\u5668\u3002\u6BCF\u4E2A\u9879\u76EE\u4E00\u4E2A\u6587\u4EF6\uFF1B\u7EC4\u5458\u70B9\u300C\u4FDD\u5B58\u300D\u628A\u5185\u5BB9\u5199\u56DE\u8868\u5355\u6587\u4EF6\uFF0C\u518D\u7528\u4F01\u4E1A\u5FAE\u4FE1\u53D1\u56DE\u3002DSH \u6821\u9A8C\u540E\u51C6\u5907\u5F85\u5BA1\u53D8\u66F4\uFF0C\u4E0D\u76F4\u63A5\u5199\u53F0\u8D26\u3002",
273
+ exportGenerate: "\u751F\u6210\u8868\u5355\u6587\u4EF6",
272
274
  exportGenerating: "\u6B63\u5728\u751F\u6210\u2026",
273
275
  exportDone: "\u5DF2\u4E0B\u8F7D {name}",
274
276
  exportSize: "{kb} KB",
@@ -850,8 +852,8 @@ window.__ModuleLoader__.load({
850
852
  exportStageFilterLabel: "Filter by stage",
851
853
  exportStageAll: "All stages",
852
854
  exportStageEmpty: "No projects at this stage.",
853
- exportHint: "The form works fully offline: no CDN, no external fonts, no server. The colleague downloads an HTML return file to send back. DSH validates it and prepares a change for review.",
854
- exportGenerate: "Generate and download",
855
+ exportHint: "The form works fully offline: no CDN, no external fonts, no server. One file per project: the colleague saves answers back into the same form file and sends it back. DSH validates it and prepares a change for review.",
856
+ exportGenerate: "Generate form files",
855
857
  exportGenerating: "Generating\u2026",
856
858
  exportDone: "Downloaded {name}",
857
859
  exportSize: "{kb} KB",
@@ -1685,13 +1687,13 @@ window.__ModuleLoader__.load({
1685
1687
  var import_react = require("react");
1686
1688
 
1687
1689
  // node_modules/yaml/browser/dist/nodes/identity.js
1688
- var ALIAS = Symbol.for("yaml.alias");
1689
- var DOC = Symbol.for("yaml.document");
1690
- var MAP = Symbol.for("yaml.map");
1691
- var PAIR = Symbol.for("yaml.pair");
1692
- var SCALAR = Symbol.for("yaml.scalar");
1693
- var SEQ = Symbol.for("yaml.seq");
1694
- var NODE_TYPE = Symbol.for("yaml.node.type");
1690
+ var ALIAS = /* @__PURE__ */ Symbol.for("yaml.alias");
1691
+ var DOC = /* @__PURE__ */ Symbol.for("yaml.document");
1692
+ var MAP = /* @__PURE__ */ Symbol.for("yaml.map");
1693
+ var PAIR = /* @__PURE__ */ Symbol.for("yaml.pair");
1694
+ var SCALAR = /* @__PURE__ */ Symbol.for("yaml.scalar");
1695
+ var SEQ = /* @__PURE__ */ Symbol.for("yaml.seq");
1696
+ var NODE_TYPE = /* @__PURE__ */ Symbol.for("yaml.node.type");
1695
1697
  var isAlias = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === ALIAS;
1696
1698
  var isDocument = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === DOC;
1697
1699
  var isMap = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === MAP;
@@ -1721,9 +1723,9 @@ window.__ModuleLoader__.load({
1721
1723
  var hasAnchor = (node) => (isScalar(node) || isCollection(node)) && !!node.anchor;
1722
1724
 
1723
1725
  // node_modules/yaml/browser/dist/visit.js
1724
- var BREAK = Symbol("break visit");
1725
- var SKIP = Symbol("skip children");
1726
- var REMOVE = Symbol("remove node");
1726
+ var BREAK = /* @__PURE__ */ Symbol("break visit");
1727
+ var SKIP = /* @__PURE__ */ Symbol("skip children");
1728
+ var REMOVE = /* @__PURE__ */ Symbol("remove node");
1727
1729
  function visit(node, visitor) {
1728
1730
  const visitor_ = initVisitor(visitor);
1729
1731
  if (isDocument(node)) {
@@ -3890,9 +3892,9 @@ window.__ModuleLoader__.load({
3890
3892
  };
3891
3893
 
3892
3894
  // node_modules/yaml/browser/dist/parse/cst-visit.js
3893
- var BREAK2 = Symbol("break visit");
3894
- var SKIP2 = Symbol("skip children");
3895
- var REMOVE2 = Symbol("remove item");
3895
+ var BREAK2 = /* @__PURE__ */ Symbol("break visit");
3896
+ var SKIP2 = /* @__PURE__ */ Symbol("skip children");
3897
+ var REMOVE2 = /* @__PURE__ */ Symbol("remove item");
3896
3898
  function visit2(cst, visitor) {
3897
3899
  if ("type" in cst && cst.type === "document")
3898
3900
  cst = { start: cst.start, value: cst.value };
@@ -4680,16 +4682,21 @@ window.__ModuleLoader__.load({
4680
4682
  setBusy(true);
4681
4683
  try {
4682
4684
  const mode = intent === "new" ? "blank" : "fill";
4683
- const result = await api.exportForm(mode, mode === "blank" ? [] : selectedIds, intent);
4684
- const blob = new Blob([result.html], { type: "text/html;charset=utf-8" });
4685
- const url = URL.createObjectURL(blob);
4686
- const anchor = document.createElement("a");
4687
- anchor.href = url;
4688
- anchor.download = result.fileName;
4689
- document.body.appendChild(anchor);
4690
- anchor.click();
4691
- anchor.remove();
4692
- setTimeout(() => URL.revokeObjectURL(url), 4e3);
4685
+ const result = await api.exportForm(mode, mode === "blank" ? [] : selectedIds);
4686
+ const files = Array.isArray(result.files) ? result.files : [];
4687
+ if (files.length === 0) throw new Error(t("exportFailed"));
4688
+ for (const [index, file] of files.entries()) {
4689
+ if (index > 0) await new Promise((resolve) => setTimeout(resolve, 350));
4690
+ const blob = new Blob([file.html], { type: "text/html;charset=utf-8" });
4691
+ const url = URL.createObjectURL(blob);
4692
+ const anchor = document.createElement("a");
4693
+ anchor.href = url;
4694
+ anchor.download = file.fileName;
4695
+ document.body.appendChild(anchor);
4696
+ anchor.click();
4697
+ anchor.remove();
4698
+ setTimeout(() => URL.revokeObjectURL(url), 4e3);
4699
+ }
4693
4700
  onClose();
4694
4701
  } catch (error) {
4695
4702
  onError(error instanceof Error ? error.message : t("exportFailed"));
package/lib/index.js CHANGED
@@ -20,7 +20,8 @@ import { buildRiskBoard } from './risks.js';
20
20
  import { buildGlobalTimeline } from './timeline.js';
21
21
  import { text } from './gap.js';
22
22
  import { canReportProgress } from './progress.js';
23
- import { buildReportHtml, reportFileName } from './report-form.js';
23
+ import { buildDossier } from './report-contract.js';
24
+ import { buildReportHtml, reportFileName, reportFileNames } from './report-form.js';
24
25
  import { registerBundledSkills } from './skill.js';
25
26
  import { createExecuteRoute } from './transport.js';
26
27
  export { resolveConfig };
@@ -69,6 +70,36 @@ export function createRuntime(config, options = {}) {
69
70
  throw error;
70
71
  }
71
72
  };
73
+ /**
74
+ * The read-only dossier for one project, for the form's second page.
75
+ *
76
+ * `detail()` already computes the summary, the derived scenario/criteria
77
+ * statuses and the gap scan the dossier shows, so this reads it rather than
78
+ * re-deriving them: a second derivation would be a second answer to the same
79
+ * question, and the two would drift.
80
+ *
81
+ * A project whose detail cannot be built still gets a form — the dossier is
82
+ * context, and missing context must not block recording progress. `null` makes
83
+ * the page render its "档案暂不可用" state instead of failing the export.
84
+ */
85
+ const dossierFor = async (record) => {
86
+ try {
87
+ const detail = await store.detail(text(record.poc_id));
88
+ if (!detail)
89
+ return null;
90
+ const achieved = detail.plan.criteria.filter((criterion) => criterion.status === '已达成').length;
91
+ return buildDossier(record, {
92
+ daysInStage: detail.summary.daysInStage,
93
+ stageSince: detail.summary.stageSince ?? '',
94
+ g0Conclusion: detail.summary.g0Conclusion,
95
+ g0Complete: detail.summary.g0Complete,
96
+ unverifiedCriteria: detail.plan.criteria.length - achieved,
97
+ });
98
+ }
99
+ catch {
100
+ return null;
101
+ }
102
+ };
72
103
  return {
73
104
  async prepare() {
74
105
  prepared ??= cache.prepare();
@@ -96,18 +127,27 @@ export function createRuntime(config, options = {}) {
96
127
  return buildGlobalTimeline(await loadOrEmpty(), { stallDays: config.stallDays });
97
128
  },
98
129
  /**
99
- * Build the collection form.
130
+ * Build one collection form per project.
100
131
  *
101
132
  * `blank` is the new-project form and ignores the ids. `fill` selects the
102
133
  * named projects; an id that matches nothing is simply absent from the form
103
134
  * rather than an error, because a stale browser tab holding an id that was
104
135
  * renamed in the ledger should still produce the projects it can.
136
+ *
137
+ * Each project gets its own document: the export is handed to different
138
+ * owners, so a merged file would have to be split again before anyone could
139
+ * fill it in. Two projects that happen to share a name and an owner get a
140
+ * numeric suffix instead of overwriting each other in the download folder.
105
141
  */
106
142
  async exportForm(mode, pocIds) {
107
143
  await this.prepare();
108
144
  const stamp = now();
109
145
  if (mode === 'blank') {
110
- return { html: buildReportHtml('new', [], stamp), fileName: reportFileName('new', [], stamp), projectCount: 0 };
146
+ return {
147
+ files: [{ html: buildReportHtml('new', [], stamp), fileName: reportFileName('new', null, stamp), projectCount: 0, pocId: null }],
148
+ fileCount: 1,
149
+ projectCount: 0,
150
+ };
111
151
  }
112
152
  const wanted = new Set(pocIds);
113
153
  const records = (await loadOrEmpty()).filter((record) => wanted.has(text(record.poc_id)));
@@ -116,11 +156,19 @@ export function createRuntime(config, options = {}) {
116
156
  const ended = records.find((record) => !canReportProgress(record.stage, record.status));
117
157
  if (ended)
118
158
  throw new RepoError('unknown-project', `${text(ended.poc_id)} 已结束,不能导出记录进展表单。`, { pocId: text(ended.poc_id) });
119
- return {
120
- html: buildReportHtml('progress', records, stamp),
121
- fileName: reportFileName('progress', records.map((record) => text(record.poc_id)), stamp),
122
- projectCount: records.length,
123
- };
159
+ const names = reportFileNames('progress', records.map((record) => ({
160
+ name: text(record.name), owner: text(record.owner), pocId: text(record.poc_id),
161
+ })), stamp);
162
+ // Build the dossier before mapping: `map` cannot await, and a project's
163
+ // dossier must be ready when its document is assembled.
164
+ const dossiers = await Promise.all(records.map((record) => dossierFor(record)));
165
+ const files = records.map((record, index) => ({
166
+ html: buildReportHtml('progress', [record], stamp, dossiers[index] ?? null),
167
+ fileName: names[index] ?? '记录进展.html',
168
+ projectCount: 1,
169
+ pocId: text(record.poc_id),
170
+ }));
171
+ return { files, fileCount: files.length, projectCount: records.length };
124
172
  },
125
173
  };
126
174
  }
@@ -130,10 +130,10 @@ export declare const reportSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
130
130
  amount_wan: z.ZodOptional<z.ZodNumber>;
131
131
  poc_type: z.ZodOptional<z.ZodEnum<{
132
132
  大体量项目: "大体量项目";
133
- SDL: "SDL";
134
- ACG: "ACG";
135
133
  AI安全: "AI安全";
136
134
  保护AI: "保护AI";
135
+ ACG: "ACG";
136
+ SDL: "SDL";
137
137
  虚拟化: "虚拟化";
138
138
  }>>;
139
139
  exec_sponsor: z.ZodOptional<z.ZodString>;
@@ -312,4 +312,134 @@ export interface ReportPlan {
312
312
  export declare function previousPlans(project: PocRecord): ReportPlan[];
313
313
  /** Stable report-derived read data. Never treat colleague-reported status as a review verdict. */
314
314
  export declare function structuredSummary(roundRecord: ProgressRecord): string;
315
+ /**
316
+ * What the colleague needs to read before answering this round.
317
+ *
318
+ * The export used to carry only the previous plan, so a form opened as a blank
319
+ * grid attached to nothing: the person filling it in had no way to know what the
320
+ * project was for, what had already been tried, or what was still missing. This
321
+ * projection is the whole project, flattened for a page that has no ledger and
322
+ * no network.
323
+ *
324
+ * It is a **snapshot**, taken at export time, and strictly read-only. Every
325
+ * field is already resolved to a string or a plain object — the page must never
326
+ * reach back into `PocRecord`, because the record is not in the file.
327
+ *
328
+ * Deliberate shape choices:
329
+ *
330
+ * - `text` fields keep `''` for "not filled" instead of being omitted. The page
331
+ * renders "台账未填写" from the empty string; a missing key would force the
332
+ * page to invent a reason it cannot know.
333
+ * - `rounds` is capped by the caller, not here. The projection reports every
334
+ * round it was given plus `roundTotal`, so the page can say "还有 N 轮未展开".
335
+ */
336
+ export interface DossierRound {
337
+ seq: string;
338
+ date: string;
339
+ type: string;
340
+ change: string;
341
+ /** `实测 91.2% …` — the round's own words, already joined. */
342
+ actual: string;
343
+ /** Structured lines when the round has them, else `[]`. */
344
+ lines: Array<{
345
+ title: string;
346
+ status: string;
347
+ actual: string;
348
+ }>;
349
+ completion: string;
350
+ evidenceCount: number;
351
+ /** `scn-01 · cri-02`, or `''`. */
352
+ ids: string;
353
+ customer: string;
354
+ }
355
+ export interface DossierProject {
356
+ pocId: string;
357
+ name: string;
358
+ stage: string;
359
+ status: string;
360
+ owner: string;
361
+ company: string;
362
+ department: string;
363
+ system: string;
364
+ sales: string;
365
+ techOwner: string;
366
+ execSponsor: string;
367
+ amountWan: string;
368
+ pocType: string;
369
+ /** Whole days in the current stage; `null` when the ledger has no `stage_since`. */
370
+ daysInStage: number | null;
371
+ /** `已导出的那一刻`, `''` when never fetched. */
372
+ stageSince: string;
373
+ g0Conclusion: string;
374
+ g0Complete: boolean;
375
+ gate0: {
376
+ whyCustomer: string;
377
+ whyUs: string;
378
+ decisionChain: string;
379
+ postPocDecision: string;
380
+ competitor: string;
381
+ /** Field keys still empty, in schema order: `['decision_chain', …]`. */
382
+ missing: string[];
383
+ };
384
+ plan: {
385
+ customerPain: string;
386
+ expectedRecognition: string;
387
+ ourEdge: string;
388
+ timelineStart: string;
389
+ timelineEnd: string;
390
+ criteria: Array<{
391
+ id: string;
392
+ name: string;
393
+ metric: string;
394
+ status: string;
395
+ }>;
396
+ scenarios: Array<{
397
+ id: string;
398
+ name: string;
399
+ goal: string;
400
+ status: string;
401
+ evidenceCount: number;
402
+ }>;
403
+ risks: Array<{
404
+ name: string;
405
+ level: string;
406
+ mitigation: string;
407
+ }>;
408
+ };
409
+ /** Newest first, already capped. */
410
+ rounds: DossierRound[];
411
+ /** How many rounds the ledger holds, for the "还有 N 轮" line. */
412
+ roundTotal: number;
413
+ outcome: {
414
+ achievement: string;
415
+ proved: string;
416
+ recognized: string;
417
+ nextBusiness: string;
418
+ overall: string;
419
+ };
420
+ /** Derived counters the "现在卡在哪" row shows. */
421
+ gaps: {
422
+ stalled: boolean;
423
+ stalledDays: number | null;
424
+ unverifiedCriteria: number;
425
+ g0Missing: number;
426
+ pendingPlans: number;
427
+ };
428
+ }
429
+ /** Flatten one round for the dossier list. */
430
+ export declare function dossierRound(entry: ProgressRecord): DossierRound;
431
+ /**
432
+ * Build the read-only dossier embedded in every progress form.
433
+ *
434
+ * `recentRounds` is the caller's cap. Two is the default the user chose: enough
435
+ * to see what was promised and what happened, few enough that a project with
436
+ * forty rounds still opens instantly.
437
+ */
438
+ export declare function buildDossier(project: PocRecord, summary: {
439
+ daysInStage: number | null;
440
+ stageSince: string;
441
+ g0Conclusion: string;
442
+ g0Complete: boolean;
443
+ unverifiedCriteria: number;
444
+ }, recentRounds?: number): DossierProject;
315
445
  export {};