@skillre/dsh-plugin-work-dashboard 0.11.1 → 0.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.
@@ -4,7 +4,7 @@
4
4
  "verified": [
5
5
  {
6
6
  "dsh": "0.2.2-rc.5",
7
- "verifiedAt": "2026-11-19",
7
+ "verifiedAt": "2026-11-20",
8
8
  "result": "passed",
9
9
  "checks": [
10
10
  "command: dsh --version -> exit 0",
@@ -45,7 +45,7 @@
45
45
  "cache-wiped-on-restart",
46
46
  "api-refresh-after-restart"
47
47
  ],
48
- "notes": "Isolated non-Desktop profile; packed tarball @skillre/dsh-plugin-work-dashboard@0.11.0 (sha256 88e11c97c573a11c...). Scope: Host mount, Connection route, cache lifecycle, risk board, global timeline, blocker aggregation, export-form generation, bundled skill registration, and owned-profile cleanup. NOT covered by this run: any Client UI check — no browser was driven. Browser UI check added 2026-11-20: tests/browser-text.spec.ts renders the real DetailPage against a git-backed ledger, loads it in headless Chrome at 1440px and compares scrollHeight to clientHeight on every data-prose card. 18 cards across 9 projects, 0 clipped; white-space resolves to pre-wrap and line-clamp to none. The check was mutation-tested: reintroducing the removed three-line clamp makes it fail with measured hidden pixel counts, so it detects the regression it exists to catch."
48
+ "notes": "Isolated non-Desktop profile; packed tarball @skillre/dsh-plugin-work-dashboard@0.11.1 (sha256 6a2a889bf603d6b8...). Scope: Host mount, Connection route, cache lifecycle, risk board, global timeline, blocker aggregation, export-form generation, bundled skill registration, and owned-profile cleanup. Re-run on 2026-11-20 after the export-form return-file work: 35 checks, export-form generation exercised (111123 bytes, fill mode). Client UI: tests/browser-text.spec.ts renders the real DetailPage against a git-backed ledger in headless Chrome at 1440px and compares scrollHeight to clientHeight on every data-prose card (18 cards / 9 projects, 0 clipped; mutation-tested). Generated-form UI: the collection form was driven in headless Chrome at 1440px and 390px (no horizontal overflow; mobile banner/snapshot verified), and the download/return-file paths were exercised end to end in a real browser. NOT covered: the DSH Electron Desktop client shell."
49
49
  },
50
50
  {
51
51
  "dsh": "0.2.2-rc.2",
@@ -155,7 +155,7 @@ export const zh = {
155
155
  // Milestone 3: export form
156
156
  exportNav: '导出表单',
157
157
  exportTitle: '导出给组员填写的表单',
158
- exportSubtitle: '勾选项目,生成一个自包含 HTML 文件:双击即可填写,自动保存,实时校验,填完下载 YAML。',
158
+ exportSubtitle: '勾选项目,生成一个自包含 HTML 文件:双击即可填写,自动保存,实时校验。组员填完点【生成回传文件】,通过企业微信发回即可。',
159
159
  exportSelectAll: '全选',
160
160
  exportSelectNone: '清空',
161
161
  exportSelected: '已选 {count} 个项目',
@@ -174,7 +174,7 @@ export const zh = {
174
174
  exportStageFilterLabel: '按阶段筛选',
175
175
  exportStageAll: '全部阶段',
176
176
  exportStageEmpty: '这个阶段下没有项目。',
177
- exportHint: '表单完全离线可用:没有 CDN、没有外部字体、没有服务器。填完下载的变更集(.json)发给项目负责人,由他合并进台账。',
177
+ exportHint: '表单完全离线可用:没有 CDN、没有外部字体、没有服务器。组员填完点【生成回传文件 (.html)】或【下载变更集 (.json)】,把那个文件发给项目负责人,由他交给 DSH 合并进台账。',
178
178
  exportGenerate: '生成并下载',
179
179
  exportGenerating: '正在生成…',
180
180
  exportDone: '已下载 {name}',
@@ -743,7 +743,7 @@ export const en = {
743
743
  // Milestone 3: export form
744
744
  exportNav: 'Export form',
745
745
  exportTitle: 'Export a form for a colleague',
746
- exportSubtitle: 'Pick projects and generate one self-contained HTML file: open it, fill it in, auto-saved, live-validated, then download the YAML.',
746
+ exportSubtitle: 'Pick projects and generate one self-contained HTML file: open it, fill it in, auto-saved, live-validated. The colleague then clicks Generate return file and sends it back.',
747
747
  exportSelectAll: 'Select all',
748
748
  exportSelectNone: 'Clear',
749
749
  exportSelected: '{count} project(s) selected',
@@ -760,7 +760,7 @@ export const en = {
760
760
  exportStageFilterLabel: 'Filter by stage',
761
761
  exportStageAll: 'All stages',
762
762
  exportStageEmpty: 'No projects at this stage.',
763
- exportHint: 'The form works fully offline: no CDN, no external fonts, no server. The change set (.json) it produces goes to the project owner, who merges it into the ledger.',
763
+ exportHint: 'The form works fully offline: no CDN, no external fonts, no server. The colleague clicks Generate return file (.html) or Download change set (.json), and sends that file to the project owner, who merges it into the ledger.',
764
764
  exportGenerate: 'Generate and download',
765
765
  exportGenerating: 'Generating…',
766
766
  exportDone: 'Downloaded {name}',
package/lib/client.js CHANGED
@@ -250,7 +250,7 @@ window.__ModuleLoader__.load({
250
250
  // Milestone 3: export form
251
251
  exportNav: "\u5BFC\u51FA\u8868\u5355",
252
252
  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\uFF0C\u586B\u5B8C\u4E0B\u8F7D YAML\u3002",
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",
254
254
  exportSelectAll: "\u5168\u9009",
255
255
  exportSelectNone: "\u6E05\u7A7A",
256
256
  exportSelected: "\u5DF2\u9009 {count} \u4E2A\u9879\u76EE",
@@ -269,7 +269,7 @@ window.__ModuleLoader__.load({
269
269
  exportStageFilterLabel: "\u6309\u9636\u6BB5\u7B5B\u9009",
270
270
  exportStageAll: "\u5168\u90E8\u9636\u6BB5",
271
271
  exportStageEmpty: "\u8FD9\u4E2A\u9636\u6BB5\u4E0B\u6CA1\u6709\u9879\u76EE\u3002",
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\u586B\u5B8C\u4E0B\u8F7D\u7684\u53D8\u66F4\u96C6\uFF08.json\uFF09\u53D1\u7ED9\u9879\u76EE\u8D1F\u8D23\u4EBA\uFF0C\u7531\u4ED6\u5408\u5E76\u8FDB\u53F0\u8D26\u3002",
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\u7EC4\u5458\u586B\u5B8C\u70B9\u3010\u751F\u6210\u56DE\u4F20\u6587\u4EF6 (.html)\u3011\u6216\u3010\u4E0B\u8F7D\u53D8\u66F4\u96C6 (.json)\u3011\uFF0C\u628A\u90A3\u4E2A\u6587\u4EF6\u53D1\u7ED9\u9879\u76EE\u8D1F\u8D23\u4EBA\uFF0C\u7531\u4ED6\u4EA4\u7ED9 DSH \u5408\u5E76\u8FDB\u53F0\u8D26\u3002",
273
273
  exportGenerate: "\u751F\u6210\u5E76\u4E0B\u8F7D",
274
274
  exportGenerating: "\u6B63\u5728\u751F\u6210\u2026",
275
275
  exportDone: "\u5DF2\u4E0B\u8F7D {name}",
@@ -837,7 +837,7 @@ window.__ModuleLoader__.load({
837
837
  // Milestone 3: export form
838
838
  exportNav: "Export form",
839
839
  exportTitle: "Export a form for a colleague",
840
- exportSubtitle: "Pick projects and generate one self-contained HTML file: open it, fill it in, auto-saved, live-validated, then download the YAML.",
840
+ exportSubtitle: "Pick projects and generate one self-contained HTML file: open it, fill it in, auto-saved, live-validated. The colleague then clicks Generate return file and sends it back.",
841
841
  exportSelectAll: "Select all",
842
842
  exportSelectNone: "Clear",
843
843
  exportSelected: "{count} project(s) selected",
@@ -854,7 +854,7 @@ window.__ModuleLoader__.load({
854
854
  exportStageFilterLabel: "Filter by stage",
855
855
  exportStageAll: "All stages",
856
856
  exportStageEmpty: "No projects at this stage.",
857
- exportHint: "The form works fully offline: no CDN, no external fonts, no server. The change set (.json) it produces goes to the project owner, who merges it into the ledger.",
857
+ exportHint: "The form works fully offline: no CDN, no external fonts, no server. The colleague clicks Generate return file (.html) or Download change set (.json), and sends that file to the project owner, who merges it into the ledger.",
858
858
  exportGenerate: "Generate and download",
859
859
  exportGenerating: "Generating\u2026",
860
860
  exportDone: "Downloaded {name}",
package/lib/form.d.ts CHANGED
@@ -35,7 +35,7 @@
35
35
  * commits; submission stays a human-merged PR, which is the ledger's design.
36
36
  */
37
37
  import YAML from 'yaml';
38
- import type { PocRecord } from './types.js';
38
+ import type { PocRecord, ProgressRecord } from './types.js';
39
39
  /** The four G0 prerequisites that live under `gate0` (the fifth is identity). */
40
40
  export declare const G0_FIELDS: readonly ["why_customer", "why_us", "decision_chain", "post_poc_decision"];
41
41
  /** One plan criterion, as the form edits it. */
@@ -98,6 +98,35 @@ export interface FormProgress {
98
98
  deadline: string;
99
99
  };
100
100
  }
101
+ /**
102
+ * One already-recorded progress round, as the form shows it read-only.
103
+ *
104
+ * This exists because the form used to say only "已有 3 条进展" and never showed
105
+ * them. Two concrete failures came from that:
106
+ *
107
+ * - the colleague could not see what had already been reported, so the same
108
+ * round was filed twice under different wording;
109
+ * - the reviewer opening a returned form could not see the story the new round
110
+ * was supposed to continue, so "这次什么变了" was unverifiable.
111
+ *
112
+ * Read-only by construction: v3 history is append-only, and the form's job is to
113
+ * add a round, never to rewrite one.
114
+ */
115
+ export interface FormHistoryEntry {
116
+ seq: number | null;
117
+ date: string;
118
+ type: string;
119
+ change: string;
120
+ actual: string;
121
+ completion: string;
122
+ /** Evidence titles, already flattened: the form only lists them. */
123
+ evidence: string[];
124
+ syncedWith: string;
125
+ recognition: string;
126
+ nextGoal: string;
127
+ nextOwner: string;
128
+ nextDeadline: string;
129
+ }
101
130
  /**
102
131
  * The project shape the form edits.
103
132
  *
@@ -146,6 +175,14 @@ export interface FormProject {
146
175
  progress: FormProgress;
147
176
  /** How many entries the project already has (so `seq` can continue). */
148
177
  existingProgressCount: number;
178
+ /**
179
+ * The recorded rounds, newest first, for the read-only history block.
180
+ *
181
+ * Capped by {@link HISTORY_LIMIT}: a project with forty rounds does not need
182
+ * all forty in a form whose job is to add the forty-first, and an uncapped list
183
+ * would push the fields the colleague must fill below the fold.
184
+ */
185
+ history: FormHistoryEntry[];
149
186
  /**
150
187
  * The G4 conclusion block.
151
188
  *
@@ -219,6 +256,17 @@ export interface FormOptions {
219
256
  * empty one rather than `undefined`, so the generated script never has to guard.
220
257
  */
221
258
  export declare function projectForForm(record: PocRecord): FormProject;
259
+ /** How many recorded rounds the form lists read-only. */
260
+ export declare const HISTORY_LIMIT = 5;
261
+ /**
262
+ * Flatten the recorded rounds for the read-only history block.
263
+ *
264
+ * Newest first, because the round a colleague is about to continue is the newest
265
+ * one: reading it first is what makes "这次什么变了" answerable. The order is
266
+ * reversed rather than re-sorted by date because the ledger's own array order is
267
+ * the append order, and a hand-edited `date` must not reshuffle history.
268
+ */
269
+ export declare function progressHistory(progress: readonly ProgressRecord[]): FormHistoryEntry[];
222
270
  /** One empty progress entry, with `seq` continuing the existing count. */
223
271
  export declare function blankProgress(existingCount: number): FormProgress;
224
272
  /** The blank project a `blank`-mode form edits. */
@@ -317,17 +365,50 @@ export interface FormChangeSet {
317
365
  ready: string | null;
318
366
  };
319
367
  };
368
+ /**
369
+ * The G4 conclusion block.
370
+ *
371
+ * It was missing from the change set while the form could edit it, which meant a
372
+ * G4 colleague filled in "我们证明了什么 / 客户认可了什么 / 下一步业务动作",
373
+ * downloaded the file, and every one of those answers was silently dropped. The
374
+ * form showed the block; the serializer never wrote it. A G4 form could not
375
+ * record the only thing a G4 form exists to record.
376
+ */
377
+ outcome: {
378
+ achievement: string | null;
379
+ customer_recognition: string | null;
380
+ our_proof: string | null;
381
+ remaining_risks: string | null;
382
+ conclusion: {
383
+ proved: string | null;
384
+ recognized: string | null;
385
+ next_business: string | null;
386
+ };
387
+ business: {
388
+ milestone: string | null;
389
+ owner: string | null;
390
+ deadline: string | null;
391
+ status: string | null;
392
+ };
393
+ overall: string | null;
394
+ };
320
395
  /** The rounds this form ADDS; empty when the colleague recorded none. */
321
396
  progress: Array<Record<string, unknown>>;
322
397
  }
323
398
  /**
324
399
  * Build one project's change set from the form state.
325
400
  *
326
- * Every field the form can edit appears, so `poc-submit` can apply the whole
327
- * object with `setIfPresent` semantics: a blank field means "I did not change
328
- * this", which the merge step must not read as "delete it".
401
+ * Blocks outside the intent's scope are emitted as `null` (or an empty list), which
402
+ * `poc-submit` treats as "not changed" and skips. A blank field inside a block that
403
+ * IS in scope means the same thing: the colleague did not touch it.
404
+ *
405
+ * @param project the form's own view of the project
406
+ * @param intent what the colleague was asked to do; defaults to `supplement`, the
407
+ * widest scope, so an older caller keeps its previous behaviour
408
+ * @param baseline the project's values when the form was generated. When given,
409
+ * a field equal to its seed is emitted as `null` — "I did not touch this".
329
410
  */
330
- export declare function projectToChangeSet(project: FormProject): FormChangeSet;
411
+ export declare function projectToChangeSet(project: FormProject, intent?: FormIntent, baseline?: FormProject): FormChangeSet;
331
412
  /** The whole download: one change set per project, plus provenance. */
332
413
  export interface FormChangeDocument {
333
414
  schemaVersion: string;
@@ -341,6 +422,15 @@ export declare function buildChangeDocument(options: {
341
422
  projects: readonly FormProject[];
342
423
  intent: FormIntent;
343
424
  now?: Date;
425
+ /**
426
+ * The values each project had when the form was GENERATED.
427
+ *
428
+ * When supplied, only fields that differ from their seed are emitted — so a
429
+ * colleague who opened a form, changed one field and sent it back cannot revert
430
+ * the other twenty to the day the form was exported. See
431
+ * {@link projectToChangeSet}.
432
+ */
433
+ baseline?: readonly FormProject[];
344
434
  }): FormChangeDocument;
345
435
  /** The enums, mirrored from `schemas/enums.yaml`. */
346
436
  declare const ENUMS: {
@@ -391,6 +481,14 @@ export interface FormPayload {
391
481
  generatedAt: string;
392
482
  today: string;
393
483
  projects: FormProject[];
484
+ /**
485
+ * Each project's values at generation time, index-aligned with `projects`.
486
+ *
487
+ * The page compares against this before emitting a change set, so a field the
488
+ * colleague never touched is sent as "unchanged" rather than as its stale
489
+ * pre-filled value.
490
+ */
491
+ baseline: FormProject[];
394
492
  /**
395
493
  * Per-project section resolution, index-aligned with `projects`.
396
494
  *
@@ -411,6 +509,15 @@ export interface FormPayload {
411
509
  label: string;
412
510
  hint: string;
413
511
  }>;
512
+ /**
513
+ * The returned page's stylesheet.
514
+ *
515
+ * It is shipped in the payload rather than referenced from the page script
516
+ * because the page script is generated code with no module scope: it cannot see
517
+ * a Host constant, and a first attempt that assumed otherwise threw
518
+ * "RETURN_CSS is not defined" at the moment a colleague clicked the button.
519
+ */
520
+ returnCss: string;
414
521
  }
415
522
  /**
416
523
  * Generate the complete HTML form.
@@ -456,3 +563,35 @@ export interface FormCompatibility {
456
563
  * point is to inspect a document whose shape may be from an older generation.
457
564
  */
458
565
  export declare function checkFormCompatibility(payload: unknown): FormCompatibility;
566
+ /** The element id the returned page carries its change set in. */
567
+ export declare const RETURN_DATA_ID = "poc-return-data";
568
+ /** What reading a returned file produced. */
569
+ export interface ReturnReadResult {
570
+ /** The change document, or `null` when the file could not be read. */
571
+ document: FormChangeDocument | null;
572
+ /** A message safe to show the person who sent the file back. */
573
+ reason: string;
574
+ }
575
+ /**
576
+ * Read a returned form — either the `.html` this generator emits or a `.json`
577
+ * change set — back into a change document.
578
+ *
579
+ * ## Why both formats, and why HTML is the default
580
+ *
581
+ * The documented workflow is "colleague fills it in and sends the HTML back on
582
+ * WeChat". That only works if the returned HTML actually carries the answers, so
583
+ * {@link buildFormHtml}'s page writes a `RETURN_DATA_ID` script block holding the
584
+ * exact change set. The same page is also readable by a human: it renders the
585
+ * answers as formatted HTML, so the person who receives it can see what was
586
+ * submitted before handing it to DSH.
587
+ *
588
+ * The `.json` path is kept because it is stricter and smaller, and because forms
589
+ * already in circulation emit it.
590
+ *
591
+ * ## Safety
592
+ *
593
+ * The HTML is never executed and never given to a DOM parser: the block is found
594
+ * with a string search and the slice is handed to `JSON.parse`. Nothing in the
595
+ * returned file can run.
596
+ */
597
+ export declare function readReturnDocument(input: string): ReturnReadResult;