@skillre/dsh-plugin-work-dashboard 0.0.0-stage → 0.9.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 (73) hide show
  1. package/LICENSE +21 -0
  2. package/README.en.md +259 -0
  3. package/README.md +371 -2
  4. package/UNINSTALL.md +7 -0
  5. package/compatibility.json +195 -0
  6. package/cordis.patch.yml +24 -0
  7. package/docs/DESIGN-0.3.md +122 -0
  8. package/docs/DETAIL.md +1 -0
  9. package/docs/DETAIL.zh.md +1 -0
  10. package/docs/PLAN-0.7-0.9.md +230 -0
  11. package/docs/preview.svg +254 -0
  12. package/docs/preview.zh.svg +254 -0
  13. package/icon.svg +17 -0
  14. package/lib/blockers.d.ts +45 -0
  15. package/lib/blockers.js +160 -0
  16. package/lib/client/api.d.ts +42 -0
  17. package/lib/client/api.js +45 -0
  18. package/lib/client/contracts.d.ts +94 -0
  19. package/lib/client/contracts.js +21 -0
  20. package/lib/client/css/base.d.ts +31 -0
  21. package/lib/client/css/base.js +461 -0
  22. package/lib/client/css/blockers.d.ts +18 -0
  23. package/lib/client/css/blockers.js +196 -0
  24. package/lib/client/css/charts.d.ts +14 -0
  25. package/lib/client/css/charts.js +191 -0
  26. package/lib/client/css/detail.d.ts +21 -0
  27. package/lib/client/css/detail.js +423 -0
  28. package/lib/client/css/insights.d.ts +27 -0
  29. package/lib/client/css/insights.js +660 -0
  30. package/lib/client/css/overview.d.ts +23 -0
  31. package/lib/client/css/overview.js +327 -0
  32. package/lib/client/css/summary.d.ts +13 -0
  33. package/lib/client/css/summary.js +187 -0
  34. package/lib/client/format.d.ts +57 -0
  35. package/lib/client/format.js +96 -0
  36. package/lib/client/preferences.d.ts +56 -0
  37. package/lib/client/preferences.js +118 -0
  38. package/lib/client/styles.d.ts +17 -0
  39. package/lib/client/styles.js +24 -0
  40. package/lib/client/text.d.ts +32 -0
  41. package/lib/client/text.js +1112 -0
  42. package/lib/client/view-contract.d.ts +118 -0
  43. package/lib/client/view-contract.js +28 -0
  44. package/lib/client.js +6599 -0
  45. package/lib/config.d.ts +61 -0
  46. package/lib/config.js +67 -0
  47. package/lib/form.d.ts +218 -0
  48. package/lib/form.js +1075 -0
  49. package/lib/gap.d.ts +60 -0
  50. package/lib/gap.js +227 -0
  51. package/lib/index.d.ts +40 -0
  52. package/lib/index.js +159 -0
  53. package/lib/repo.d.ts +124 -0
  54. package/lib/repo.js +407 -0
  55. package/lib/risks.d.ts +24 -0
  56. package/lib/risks.js +85 -0
  57. package/lib/skill.d.ts +94 -0
  58. package/lib/skill.js +220 -0
  59. package/lib/store.d.ts +63 -0
  60. package/lib/store.js +505 -0
  61. package/lib/timeline.d.ts +23 -0
  62. package/lib/timeline.js +93 -0
  63. package/lib/transport.d.ts +67 -0
  64. package/lib/transport.js +131 -0
  65. package/lib/types.d.ts +701 -0
  66. package/lib/types.js +78 -0
  67. package/locale/en.json +7 -0
  68. package/locale/zh.json +7 -0
  69. package/package.json +117 -4
  70. package/skills/poc-export/SKILL.md +81 -0
  71. package/skills/poc-export/scripts/export-form.mjs +654 -0
  72. package/skills/poc-ledger/SKILL.md +171 -0
  73. package/skills/poc-submit/SKILL.md +186 -0
@@ -0,0 +1,254 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="1280" height="600" viewBox="0 0 1280 600">
2
+ <defs>
3
+ <linearGradient id="ground" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#F7F9FC"/><stop offset="1" stop-color="#EDF1F7"/></linearGradient>
4
+ </defs>
5
+ <rect x="0" y="0" width="1280" height="600" rx="0" fill="url(#ground)" stroke="none" stroke-width="0"/>
6
+ <rect x="24" y="20" width="1232" height="560" rx="16" fill="#F5F7FB" stroke="#DDE4EE" stroke-width="1.5"/>
7
+ <rect x="24" y="20" width="206" height="560" rx="0" fill="#FFFFFF" stroke="none" stroke-width="0"/>
8
+ <line x1="230" y1="20" x2="230" y2="580" stroke="#E6EBF2" stroke-width="1"/>
9
+ <circle cx="52" cy="50" r="9" fill="#2864E8" stroke="none" stroke-width="0"/>
10
+ <text x="70" y="55" font-family="Noto Sans SC" font-size="13" font-weight="700" fill="#192638" text-anchor="start">deepseek</text>
11
+ <text x="141" y="55" font-family="Noto Sans SC" font-size="8.5" font-weight="700" fill="#8B99AC" text-anchor="start">HARNESS</text>
12
+ <rect x="40" y="74" width="174" height="28" rx="8" fill="#F7F9FC" stroke="#E6EBF2" stroke-width="1"/>
13
+ <text x="56" y="93" font-family="Noto Sans SC" font-size="10.5" font-weight="normal" fill="#5A6A80" text-anchor="start">+ 新会话</text>
14
+ <circle cx="50" cy="121" r="3.2" fill="#8B99AC" stroke="none" stroke-width="0"/>
15
+ <text x="63" y="126" font-family="Noto Sans SC" font-size="11" font-weight="normal" fill="#5A6A80" text-anchor="start">插件</text>
16
+ <circle cx="50" cy="147" r="3.2" fill="#8B99AC" stroke="none" stroke-width="0"/>
17
+ <text x="63" y="152" font-family="Noto Sans SC" font-size="11" font-weight="normal" fill="#5A6A80" text-anchor="start">自动化任务</text>
18
+ <rect x="34" y="163" width="186" height="26" rx="7" fill="#EAF0FE" stroke="none" stroke-width="0"/>
19
+ <circle cx="50" cy="173" r="3.2" fill="#2864E8" stroke="none" stroke-width="0"/>
20
+ <text x="63" y="178" font-family="Noto Sans SC" font-size="11" font-weight="700" fill="#1B4FC2" text-anchor="start">工作看板</text>
21
+ <circle cx="50" cy="199" r="3.2" fill="#8B99AC" stroke="none" stroke-width="0"/>
22
+ <text x="63" y="204" font-family="Noto Sans SC" font-size="11" font-weight="normal" fill="#5A6A80" text-anchor="start">更多</text>
23
+ <text x="252" y="52" font-family="Noto Sans SC" font-size="9.5" font-weight="normal" fill="#8B99AC" text-anchor="start">工作看板 · 只读</text>
24
+ <text x="252" y="78" font-family="Noto Sans SC" font-size="21" font-weight="700" fill="#192638" text-anchor="start">POC 运营</text>
25
+ <rect x="1128" y="56" width="64" height="26" rx="8" fill="#2864E8" stroke="none" stroke-width="0"/>
26
+ <text x="1160" y="73" font-family="Noto Sans SC" font-size="10.5" font-weight="600" fill="#FFFFFF" text-anchor="middle">刷新</text>
27
+ <rect x="1044" y="56" width="76" height="26" rx="8" fill="#FFFFFF" stroke="#E6EBF2" stroke-width="1"/>
28
+ <text x="1082" y="73" font-family="Noto Sans SC" font-size="10" font-weight="normal" fill="#5A6A80" text-anchor="middle">风险看板</text>
29
+ <rect x="252" y="92" width="224" height="28" rx="9" fill="#FFFFFF" stroke="#E6EBF2" stroke-width="1"/>
30
+ <circle cx="267" cy="106" r="4.6" fill="none" stroke="#8B99AC" stroke-width="1.3"/>
31
+ <text x="278" y="110" font-family="Noto Sans SC" font-size="10" font-weight="normal" fill="#8B99AC" text-anchor="start">项目名 / 编号 / 负责人 / 公司</text>
32
+ <rect x="548" y="94" width="130" height="24" rx="8" fill="#F7F9FC" stroke="#E6EBF2" stroke-width="1"/>
33
+ <rect x="550" y="97" width="41" height="18" rx="6" fill="#FFFFFF" stroke="#E6EBF2" stroke-width="1"/>
34
+ <text x="570.5" y="110" font-family="Noto Sans SC" font-size="9.5" font-weight="700" fill="#192638" text-anchor="middle">卡片</text>
35
+ <text x="613.5" y="110" font-family="Noto Sans SC" font-size="9.5" font-weight="normal" fill="#5A6A80" text-anchor="middle">看板</text>
36
+ <text x="656.5" y="110" font-family="Noto Sans SC" font-size="9.5" font-weight="normal" fill="#5A6A80" text-anchor="middle">表格</text>
37
+ <rect x="690" y="94" width="74" height="24" rx="8" fill="#FFFFFF" stroke="#E6EBF2" stroke-width="1"/>
38
+ <text x="727" y="110" font-family="Noto Sans SC" font-size="10" font-weight="normal" fill="#5A6A80" text-anchor="middle">按金额</text>
39
+ <text x="1168" y="110" font-family="Noto Sans SC" font-size="9.5" font-weight="normal" fill="#8B99AC" text-anchor="end">筛出 5 / 5 个项目</text>
40
+ <rect x="252" y="128" width="73.6" height="20" rx="10" fill="#FFFFFF" stroke="#E6EBF2" stroke-width="1"/>
41
+ <text x="288.8" y="142" font-family="Noto Sans SC" font-size="9" font-weight="normal" fill="#5A6A80" text-anchor="middle">体系 人保体系 3</text>
42
+ <rect x="331.6" y="128" width="67.2" height="20" rx="10" fill="#FFFFFF" stroke="#E6EBF2" stroke-width="1"/>
43
+ <text x="365.20000000000005" y="142" font-family="Noto Sans SC" font-size="9" font-weight="normal" fill="#5A6A80" text-anchor="middle">阶段 已关闭 1</text>
44
+ <rect x="404.8" y="128" width="60.800000000000004" height="20" rx="10" fill="#FFFFFF" stroke="#E6EBF2" stroke-width="1"/>
45
+ <text x="435.2" y="142" font-family="Noto Sans SC" font-size="9" font-weight="normal" fill="#5A6A80" text-anchor="middle">G0 立项 1</text>
46
+ <rect x="471.6" y="128" width="73.6" height="20" rx="10" fill="#FFFFFF" stroke="#E6EBF2" stroke-width="1"/>
47
+ <text x="508.40000000000003" y="142" font-family="Noto Sans SC" font-size="9" font-weight="normal" fill="#5A6A80" text-anchor="middle">G2 方案验证 1</text>
48
+ <rect x="551.2" y="128" width="67.2" height="20" rx="10" fill="#FFFFFF" stroke="#E6EBF2" stroke-width="1"/>
49
+ <text x="584.8000000000001" y="142" font-family="Noto Sans SC" font-size="9" font-weight="normal" fill="#5A6A80" text-anchor="middle">状态 进行中 4</text>
50
+ <rect x="624.4000000000001" y="128" width="73.6" height="20" rx="10" fill="#FFFFFF" stroke="#E6EBF2" stroke-width="1"/>
51
+ <text x="661.2" y="142" font-family="Noto Sans SC" font-size="9" font-weight="normal" fill="#5A6A80" text-anchor="middle">类型 AI安全 1</text>
52
+ <rect x="252" y="160" width="792" height="250" rx="12" fill="#FFFFFF" stroke="#E6EBF2" stroke-width="1"/>
53
+ <line x1="252" y1="192" x2="1044" y2="192" stroke="#E6EBF2" stroke-width="1"/>
54
+ <text x="266" y="181" font-family="Noto Sans SC" font-size="12.5" font-weight="700" fill="#192638" text-anchor="start">组合视图</text>
55
+ <text x="976" y="181" font-family="Noto Sans SC" font-size="9.5" font-weight="normal" fill="#8B99AC" text-anchor="end">5 个项目 · 3,100 万元</text>
56
+ <rect x="988" y="169" width="42" height="17" rx="6" fill="#F7F9FC" stroke="#E6EBF2" stroke-width="1"/>
57
+ <text x="1009" y="181" font-family="Noto Sans SC" font-size="8.5" font-weight="normal" fill="#8B99AC" text-anchor="middle">收起</text>
58
+ <line x1="648" y1="192" x2="648" y2="324" stroke="#E6EBF2" stroke-width="1"/>
59
+ <text x="266" y="209" font-family="Noto Sans SC" font-size="10.5" font-weight="600" fill="#5A6A80" text-anchor="start">阶段分布</text>
60
+ <text x="636" y="209" font-family="Noto Sans SC" font-size="8.5" font-weight="normal" fill="#8B99AC" text-anchor="end">按当前阶段</text>
61
+ <text x="295" y="226" font-family="Noto Sans SC" font-size="9" font-weight="600" fill="#5A6A80" text-anchor="middle">1</text>
62
+ <rect x="282" y="232" width="26" height="46" rx="3" fill="#C0392B" stroke="none" stroke-width="0"/>
63
+ <text x="295" y="292" font-family="Noto Sans SC" font-size="7.5" font-weight="normal" fill="#8B99AC" text-anchor="middle">G0 立项</text>
64
+ <text x="351" y="226" font-family="Noto Sans SC" font-size="9" font-weight="600" fill="#5A6A80" text-anchor="middle">1</text>
65
+ <rect x="338" y="232" width="26" height="46" rx="3" fill="#2864E8" stroke="none" stroke-width="0"/>
66
+ <text x="351" y="292" font-family="Noto Sans SC" font-size="7.5" font-weight="normal" fill="#8B99AC" text-anchor="middle">G1 方案设计</text>
67
+ <text x="407" y="226" font-family="Noto Sans SC" font-size="9" font-weight="600" fill="#5A6A80" text-anchor="middle">1</text>
68
+ <rect x="394" y="232" width="26" height="46" rx="3" fill="#C0392B" stroke="none" stroke-width="0"/>
69
+ <text x="407" y="292" font-family="Noto Sans SC" font-size="7.5" font-weight="normal" fill="#8B99AC" text-anchor="middle">G2 方案验证</text>
70
+ <text x="463" y="226" font-family="Noto Sans SC" font-size="9" font-weight="600" fill="#5A6A80" text-anchor="middle">0</text>
71
+ <rect x="450" y="275" width="26" height="3" rx="3" fill="#E6EBF2" stroke="none" stroke-width="0"/>
72
+ <text x="463" y="292" font-family="Noto Sans SC" font-size="7.5" font-weight="normal" fill="#8B99AC" text-anchor="middle">G3 结果验证</text>
73
+ <text x="519" y="226" font-family="Noto Sans SC" font-size="9" font-weight="600" fill="#5A6A80" text-anchor="middle">1</text>
74
+ <rect x="506" y="232" width="26" height="46" rx="3" fill="#C0392B" stroke="none" stroke-width="0"/>
75
+ <text x="519" y="292" font-family="Noto Sans SC" font-size="7.5" font-weight="normal" fill="#8B99AC" text-anchor="middle">G4 结果转化</text>
76
+ <text x="575" y="226" font-family="Noto Sans SC" font-size="9" font-weight="600" fill="#5A6A80" text-anchor="middle">1</text>
77
+ <rect x="562" y="232" width="26" height="46" rx="3" fill="#C0392B" stroke="none" stroke-width="0"/>
78
+ <text x="575" y="292" font-family="Noto Sans SC" font-size="7.5" font-weight="normal" fill="#8B99AC" text-anchor="middle">已关闭</text>
79
+ <text x="266" y="310" font-family="Noto Sans SC" font-size="8" font-weight="normal" fill="#5A6A80" text-anchor="start">■ G0 立项 300 万 ■ G1 方案设计 500 万 ■ G2 方案验证 1,500 万</text>
80
+ <text x="266" y="322" font-family="Noto Sans SC" font-size="8" font-weight="normal" fill="#5A6A80" text-anchor="start">■ G4 结果转化 800 万 ■ 已关闭 0 万</text>
81
+ <text x="662" y="209" font-family="Noto Sans SC" font-size="10.5" font-weight="600" fill="#5A6A80" text-anchor="start">四维覆盖</text>
82
+ <text x="1032" y="209" font-family="Noto Sans SC" font-size="8.5" font-weight="normal" fill="#8B99AC" text-anchor="end">有值项目占比</text>
83
+ <circle cx="706" cy="246" r="20" fill="none" stroke="#E6EBF2" stroke-width="5"/>
84
+ <circle cx="706" cy="246" r="20" fill="none" stroke="#2864E8" stroke-width="5" stroke-dasharray="75.4 125.7"/>
85
+ <text x="706" y="250" font-family="Noto Sans SC" font-size="10.5" font-weight="700" fill="#192638" text-anchor="middle">3/5</text>
86
+ <text x="706" y="284" font-family="Noto Sans SC" font-size="8.5" font-weight="normal" fill="#5A6A80" text-anchor="middle">目标达成</text>
87
+ <text x="706" y="297" font-family="Noto Sans SC" font-size="7.5" font-weight="normal" fill="#8B99AC" text-anchor="middle">2 个缺</text>
88
+ <circle cx="802" cy="246" r="20" fill="none" stroke="#E6EBF2" stroke-width="5"/>
89
+ <circle cx="802" cy="246" r="20" fill="none" stroke="#218568" stroke-width="5" stroke-dasharray="50.3 125.7"/>
90
+ <text x="802" y="250" font-family="Noto Sans SC" font-size="10.5" font-weight="700" fill="#192638" text-anchor="middle">2/5</text>
91
+ <text x="802" y="284" font-family="Noto Sans SC" font-size="8.5" font-weight="normal" fill="#5A6A80" text-anchor="middle">证据</text>
92
+ <text x="802" y="297" font-family="Noto Sans SC" font-size="7.5" font-weight="normal" fill="#8B99AC" text-anchor="middle">2 个缺</text>
93
+ <circle cx="898" cy="246" r="20" fill="none" stroke="#E6EBF2" stroke-width="5"/>
94
+ <circle cx="898" cy="246" r="20" fill="none" stroke="#B77919" stroke-width="5" stroke-dasharray="75.4 125.7"/>
95
+ <text x="898" y="250" font-family="Noto Sans SC" font-size="10.5" font-weight="700" fill="#192638" text-anchor="middle">3/5</text>
96
+ <text x="898" y="284" font-family="Noto Sans SC" font-size="8.5" font-weight="normal" fill="#5A6A80" text-anchor="middle">客户认可</text>
97
+ <text x="898" y="297" font-family="Noto Sans SC" font-size="7.5" font-weight="normal" fill="#8B99AC" text-anchor="middle">2 个缺</text>
98
+ <circle cx="994" cy="246" r="20" fill="none" stroke="#E6EBF2" stroke-width="5"/>
99
+ <circle cx="994" cy="246" r="20" fill="none" stroke="#C0392B" stroke-width="5" stroke-dasharray="25.1 125.7"/>
100
+ <text x="994" y="250" font-family="Noto Sans SC" font-size="10.5" font-weight="700" fill="#192638" text-anchor="middle">1/5</text>
101
+ <text x="994" y="284" font-family="Noto Sans SC" font-size="8.5" font-weight="normal" fill="#5A6A80" text-anchor="middle">下一步</text>
102
+ <text x="994" y="297" font-family="Noto Sans SC" font-size="7.5" font-weight="normal" fill="#8B99AC" text-anchor="middle">2 个缺</text>
103
+ <line x1="252" y1="324" x2="1044" y2="324" stroke="#E6EBF2" stroke-width="1"/>
104
+ <line x1="448" y1="324" x2="448" y2="410" stroke="#E6EBF2" stroke-width="1"/>
105
+ <line x1="648" y1="324" x2="648" y2="410" stroke="#E6EBF2" stroke-width="1"/>
106
+ <line x1="846" y1="324" x2="846" y2="410" stroke="#E6EBF2" stroke-width="1"/>
107
+ <text x="266" y="340" font-family="Noto Sans SC" font-size="10" font-weight="600" fill="#5A6A80" text-anchor="start">体系 / 公司</text>
108
+ <text x="438" y="340" font-family="Noto Sans SC" font-size="8" font-weight="normal" fill="#8B99AC" text-anchor="end">按金额</text>
109
+ <text x="266" y="356" font-family="Noto Sans SC" font-size="8" font-weight="normal" fill="#5A6A80" text-anchor="start">人保财险</text>
110
+ <rect x="348" y="350.5" width="56" height="5" rx="2" fill="#C0392B" stroke="none" stroke-width="0"/>
111
+ <text x="438" y="356" font-family="Noto Sans SC" font-size="8" font-weight="600" fill="#5A6A80" text-anchor="end">1,500 万</text>
112
+ <text x="266" y="371" font-family="Noto Sans SC" font-size="8" font-weight="normal" fill="#5A6A80" text-anchor="start">人保寿险</text>
113
+ <rect x="348" y="365.5" width="34" height="5" rx="2" fill="#C0392B" stroke="none" stroke-width="0"/>
114
+ <text x="438" y="371" font-family="Noto Sans SC" font-size="8" font-weight="600" fill="#5A6A80" text-anchor="end">800 万</text>
115
+ <text x="266" y="386" font-family="Noto Sans SC" font-size="8" font-weight="normal" fill="#5A6A80" text-anchor="start">国寿股份</text>
116
+ <rect x="348" y="380.5" width="22" height="5" rx="2" fill="#2864E8" stroke="none" stroke-width="0"/>
117
+ <text x="438" y="386" font-family="Noto Sans SC" font-size="8" font-weight="600" fill="#5A6A80" text-anchor="end">500 万</text>
118
+ <text x="462" y="340" font-family="Noto Sans SC" font-size="10" font-weight="600" fill="#5A6A80" text-anchor="start">缺口规则命中</text>
119
+ <text x="634" y="340" font-family="Noto Sans SC" font-size="8" font-weight="normal" fill="#8B99AC" text-anchor="end">共 12 条</text>
120
+ <text x="462" y="356" font-family="Noto Sans SC" font-size="8" font-weight="normal" fill="#5A6A80" text-anchor="start">R10 G3-2 未确认</text>
121
+ <rect x="544" y="350.5" width="38" height="5" rx="2" fill="#C0392B" stroke="none" stroke-width="0"/>
122
+ <text x="634" y="356" font-family="Noto Sans SC" font-size="8" font-weight="600" fill="#5A6A80" text-anchor="end">2 次</text>
123
+ <text x="462" y="371" font-family="Noto Sans SC" font-size="8" font-weight="normal" fill="#5A6A80" text-anchor="start">R12 阶段停滞</text>
124
+ <rect x="544" y="365.5" width="30" height="5" rx="2" fill="#B77919" stroke="none" stroke-width="0"/>
125
+ <text x="634" y="371" font-family="Noto Sans SC" font-size="8" font-weight="600" fill="#5A6A80" text-anchor="end">2 次</text>
126
+ <text x="462" y="386" font-family="Noto Sans SC" font-size="8" font-weight="normal" fill="#5A6A80" text-anchor="start">R1 G0 必填未齐</text>
127
+ <rect x="544" y="380.5" width="20" height="5" rx="2" fill="#C0392B" stroke="none" stroke-width="0"/>
128
+ <text x="634" y="386" font-family="Noto Sans SC" font-size="8" font-weight="600" fill="#5A6A80" text-anchor="end">1 次</text>
129
+ <text x="662" y="340" font-family="Noto Sans SC" font-size="10" font-weight="600" fill="#5A6A80" text-anchor="start">项目类型</text>
130
+ <text x="834" y="340" font-family="Noto Sans SC" font-size="8" font-weight="normal" fill="#8B99AC" text-anchor="end">按数量</text>
131
+ <text x="662" y="356" font-family="Noto Sans SC" font-size="8" font-weight="normal" fill="#5A6A80" text-anchor="start">大体量项目</text>
132
+ <text x="834" y="356" font-family="Noto Sans SC" font-size="8" font-weight="600" fill="#5A6A80" text-anchor="end">1</text>
133
+ <text x="662" y="371" font-family="Noto Sans SC" font-size="8" font-weight="normal" fill="#5A6A80" text-anchor="start">AI安全</text>
134
+ <text x="834" y="371" font-family="Noto Sans SC" font-size="8" font-weight="600" fill="#5A6A80" text-anchor="end">1</text>
135
+ <text x="662" y="386" font-family="Noto Sans SC" font-size="8" font-weight="normal" fill="#5A6A80" text-anchor="start">保护AI</text>
136
+ <text x="834" y="386" font-family="Noto Sans SC" font-size="8" font-weight="600" fill="#5A6A80" text-anchor="end">1</text>
137
+ <text x="860" y="340" font-family="Noto Sans SC" font-size="10" font-weight="600" fill="#5A6A80" text-anchor="start">金额集中度</text>
138
+ <text x="1032" y="340" font-family="Noto Sans SC" font-size="8" font-weight="normal" fill="#8B99AC" text-anchor="end">前 5 名</text>
139
+ <text x="860" y="356" font-family="Noto Sans SC" font-size="8" font-weight="normal" fill="#5A6A80" text-anchor="start">某某银行零信任…</text>
140
+ <rect x="942" y="350.5" width="48" height="5" rx="2" fill="#B77919" stroke="none" stroke-width="0"/>
141
+ <text x="1032" y="356" font-family="Noto Sans SC" font-size="8" font-weight="600" fill="#5A6A80" text-anchor="end">48%</text>
142
+ <text x="860" y="371" font-family="Noto Sans SC" font-size="8" font-weight="normal" fill="#5A6A80" text-anchor="start">某某制造产线安…</text>
143
+ <rect x="942" y="365.5" width="30" height="5" rx="2" fill="#B77919" stroke="none" stroke-width="0"/>
144
+ <text x="1032" y="371" font-family="Noto Sans SC" font-size="8" font-weight="600" fill="#5A6A80" text-anchor="end">26%</text>
145
+ <text x="860" y="386" font-family="Noto Sans SC" font-size="8" font-weight="normal" fill="#5A6A80" text-anchor="start">某某保险集团数…</text>
146
+ <rect x="942" y="380.5" width="18" height="5" rx="2" fill="#B77919" stroke="none" stroke-width="0"/>
147
+ <text x="1032" y="386" font-family="Noto Sans SC" font-size="8" font-weight="600" fill="#5A6A80" text-anchor="end">16%</text>
148
+ <text x="252" y="434" font-family="Noto Sans SC" font-size="12" font-weight="700" fill="#192638" text-anchor="start">项目总览</text>
149
+ <rect x="252" y="444" width="792" height="128" rx="12" fill="#FFFFFF" stroke="#E6EBF2" stroke-width="1"/>
150
+ <rect x="266" y="456" width="248" height="106" rx="10" fill="#FFFFFF" stroke="#E6EBF2" stroke-width="1"/>
151
+ <text x="278" y="476" font-family="Noto Sans SC" font-size="10" font-weight="700" fill="#192638" text-anchor="start">某某银行零信任试点</text>
152
+ <text x="278" y="489" font-family="Noto Sans SC" font-size="7.5" font-weight="normal" fill="#8B99AC" text-anchor="start">POC-2026-001 · 张三</text>
153
+ <rect x="448" y="465" width="54" height="16" rx="8" fill="#FAE9E7" stroke="none" stroke-width="0"/>
154
+ <text x="475" y="476" font-family="Noto Sans SC" font-size="7.5" font-weight="600" fill="#C0392B" text-anchor="middle">1 处高危</text>
155
+ <rect x="278" y="496" width="62" height="15" rx="8" fill="#EAF0FE" stroke="none" stroke-width="0"/>
156
+ <text x="309" y="507" font-family="Noto Sans SC" font-size="7.5" font-weight="normal" fill="#2864E8" text-anchor="middle">G2-方案验证</text>
157
+ <rect x="350" y="502" width="16" height="3.5" rx="2" fill="#218568" stroke="none" stroke-width="0"/>
158
+ <rect x="369" y="502" width="16" height="3.5" rx="2" fill="#218568" stroke="none" stroke-width="0"/>
159
+ <rect x="388" y="502" width="16" height="3.5" rx="2" fill="#218568" stroke="none" stroke-width="0"/>
160
+ <rect x="407" y="502" width="16" height="3.5" rx="2" fill="#E6EBF2" stroke="none" stroke-width="0"/>
161
+ <rect x="426" y="502" width="16" height="3.5" rx="2" fill="#E6EBF2" stroke="none" stroke-width="0"/>
162
+ <rect x="278" y="518" width="224" height="27" rx="6" fill="#F7F9FC" stroke="#E6EBF2" stroke-width="1"/>
163
+ <text x="285" y="529" font-family="Noto Sans SC" font-size="6.5" font-weight="normal" fill="#8B99AC" text-anchor="start">最新进展</text>
164
+ <text x="285" y="540" font-family="Noto Sans SC" font-size="8" font-weight="normal" fill="#5A6A80" text-anchor="start">内部Review · 完成 150 人灰度</text>
165
+ <rect x="278" y="550" width="44" height="12" rx="3" fill="#E7F4F0" stroke="none" stroke-width="0"/>
166
+ <circle cx="286" cy="556" r="2.6" fill="#218568" stroke="none" stroke-width="0"/>
167
+ <text x="293" y="559" font-family="Noto Sans SC" font-size="7" font-weight="700" fill="#218568" text-anchor="start">✓</text>
168
+ <rect x="334" y="550" width="44" height="12" rx="3" fill="#E7F4F0" stroke="none" stroke-width="0"/>
169
+ <circle cx="342" cy="556" r="2.6" fill="#218568" stroke="none" stroke-width="0"/>
170
+ <text x="349" y="559" font-family="Noto Sans SC" font-size="7" font-weight="700" fill="#218568" text-anchor="start">✓</text>
171
+ <rect x="390" y="550" width="44" height="12" rx="3" fill="#FAE9E7" stroke="none" stroke-width="0"/>
172
+ <circle cx="398" cy="556" r="2.6" fill="#C0392B" stroke="none" stroke-width="0"/>
173
+ <text x="405" y="559" font-family="Noto Sans SC" font-size="7" font-weight="700" fill="#C0392B" text-anchor="start">✗</text>
174
+ <rect x="446" y="550" width="44" height="12" rx="3" fill="#FAE9E7" stroke="none" stroke-width="0"/>
175
+ <circle cx="454" cy="556" r="2.6" fill="#C0392B" stroke="none" stroke-width="0"/>
176
+ <text x="461" y="559" font-family="Noto Sans SC" font-size="7" font-weight="700" fill="#C0392B" text-anchor="start">✗</text>
177
+ <rect x="526" y="456" width="248" height="106" rx="10" fill="#FFFFFF" stroke="#E6EBF2" stroke-width="1"/>
178
+ <text x="538" y="476" font-family="Noto Sans SC" font-size="10" font-weight="700" fill="#192638" text-anchor="start">某某制造产线安全接入</text>
179
+ <text x="538" y="489" font-family="Noto Sans SC" font-size="7.5" font-weight="normal" fill="#8B99AC" text-anchor="start">POC-2026-003 · 孙八</text>
180
+ <rect x="708" y="465" width="54" height="16" rx="8" fill="#FAE9E7" stroke="none" stroke-width="0"/>
181
+ <text x="735" y="476" font-family="Noto Sans SC" font-size="7.5" font-weight="600" fill="#C0392B" text-anchor="middle">1 处高危</text>
182
+ <rect x="538" y="496" width="62" height="15" rx="8" fill="#EAF0FE" stroke="none" stroke-width="0"/>
183
+ <text x="569" y="507" font-family="Noto Sans SC" font-size="7.5" font-weight="normal" fill="#2864E8" text-anchor="middle">G4-结果转化</text>
184
+ <rect x="610" y="502" width="16" height="3.5" rx="2" fill="#218568" stroke="none" stroke-width="0"/>
185
+ <rect x="629" y="502" width="16" height="3.5" rx="2" fill="#218568" stroke="none" stroke-width="0"/>
186
+ <rect x="648" y="502" width="16" height="3.5" rx="2" fill="#218568" stroke="none" stroke-width="0"/>
187
+ <rect x="667" y="502" width="16" height="3.5" rx="2" fill="#E6EBF2" stroke="none" stroke-width="0"/>
188
+ <rect x="686" y="502" width="16" height="3.5" rx="2" fill="#E6EBF2" stroke="none" stroke-width="0"/>
189
+ <rect x="538" y="518" width="224" height="27" rx="6" fill="#F7F9FC" stroke="#E6EBF2" stroke-width="1"/>
190
+ <text x="545" y="529" font-family="Noto Sans SC" font-size="6.5" font-weight="normal" fill="#8B99AC" text-anchor="start">最新进展</text>
191
+ <text x="545" y="540" font-family="Noto Sans SC" font-size="8" font-weight="normal" fill="#5A6A80" text-anchor="start">内部Review · 完成 150 人灰度</text>
192
+ <rect x="538" y="550" width="44" height="12" rx="3" fill="#E7F4F0" stroke="none" stroke-width="0"/>
193
+ <circle cx="546" cy="556" r="2.6" fill="#218568" stroke="none" stroke-width="0"/>
194
+ <text x="553" y="559" font-family="Noto Sans SC" font-size="7" font-weight="700" fill="#218568" text-anchor="start">✓</text>
195
+ <rect x="594" y="550" width="44" height="12" rx="3" fill="#E7F4F0" stroke="none" stroke-width="0"/>
196
+ <circle cx="602" cy="556" r="2.6" fill="#218568" stroke="none" stroke-width="0"/>
197
+ <text x="609" y="559" font-family="Noto Sans SC" font-size="7" font-weight="700" fill="#218568" text-anchor="start">✓</text>
198
+ <rect x="650" y="550" width="44" height="12" rx="3" fill="#FAE9E7" stroke="none" stroke-width="0"/>
199
+ <circle cx="658" cy="556" r="2.6" fill="#C0392B" stroke="none" stroke-width="0"/>
200
+ <text x="665" y="559" font-family="Noto Sans SC" font-size="7" font-weight="700" fill="#C0392B" text-anchor="start">✗</text>
201
+ <rect x="706" y="550" width="44" height="12" rx="3" fill="#FAE9E7" stroke="none" stroke-width="0"/>
202
+ <circle cx="714" cy="556" r="2.6" fill="#C0392B" stroke="none" stroke-width="0"/>
203
+ <text x="721" y="559" font-family="Noto Sans SC" font-size="7" font-weight="700" fill="#C0392B" text-anchor="start">✗</text>
204
+ <rect x="786" y="456" width="248" height="106" rx="10" fill="#FFFFFF" stroke="#E6EBF2" stroke-width="1"/>
205
+ <text x="798" y="476" font-family="Noto Sans SC" font-size="10" font-weight="700" fill="#192638" text-anchor="start">某某保险集团数据安全治理</text>
206
+ <text x="798" y="489" font-family="Noto Sans SC" font-size="7.5" font-weight="normal" fill="#8B99AC" text-anchor="start">POC-2026-004 · 郑十</text>
207
+ <rect x="968" y="465" width="54" height="16" rx="8" fill="#FAE9E7" stroke="none" stroke-width="0"/>
208
+ <text x="995" y="476" font-family="Noto Sans SC" font-size="7.5" font-weight="600" fill="#C0392B" text-anchor="middle">2 处高危</text>
209
+ <rect x="798" y="496" width="62" height="15" rx="8" fill="#EAF0FE" stroke="none" stroke-width="0"/>
210
+ <text x="829" y="507" font-family="Noto Sans SC" font-size="7.5" font-weight="normal" fill="#2864E8" text-anchor="middle">G1-方案设计</text>
211
+ <rect x="870" y="502" width="16" height="3.5" rx="2" fill="#218568" stroke="none" stroke-width="0"/>
212
+ <rect x="889" y="502" width="16" height="3.5" rx="2" fill="#218568" stroke="none" stroke-width="0"/>
213
+ <rect x="908" y="502" width="16" height="3.5" rx="2" fill="#218568" stroke="none" stroke-width="0"/>
214
+ <rect x="927" y="502" width="16" height="3.5" rx="2" fill="#E6EBF2" stroke="none" stroke-width="0"/>
215
+ <rect x="946" y="502" width="16" height="3.5" rx="2" fill="#E6EBF2" stroke="none" stroke-width="0"/>
216
+ <rect x="798" y="518" width="224" height="27" rx="6" fill="#F7F9FC" stroke="#E6EBF2" stroke-width="1"/>
217
+ <text x="805" y="529" font-family="Noto Sans SC" font-size="6.5" font-weight="normal" fill="#8B99AC" text-anchor="start">最新进展</text>
218
+ <text x="805" y="540" font-family="Noto Sans SC" font-size="8" font-weight="normal" fill="#5A6A80" text-anchor="start">内部Review · 完成 150 人灰度</text>
219
+ <rect x="798" y="550" width="44" height="12" rx="3" fill="#E7F4F0" stroke="none" stroke-width="0"/>
220
+ <circle cx="806" cy="556" r="2.6" fill="#218568" stroke="none" stroke-width="0"/>
221
+ <text x="813" y="559" font-family="Noto Sans SC" font-size="7" font-weight="700" fill="#218568" text-anchor="start">✓</text>
222
+ <rect x="854" y="550" width="44" height="12" rx="3" fill="#E7F4F0" stroke="none" stroke-width="0"/>
223
+ <circle cx="862" cy="556" r="2.6" fill="#218568" stroke="none" stroke-width="0"/>
224
+ <text x="869" y="559" font-family="Noto Sans SC" font-size="7" font-weight="700" fill="#218568" text-anchor="start">✓</text>
225
+ <rect x="910" y="550" width="44" height="12" rx="3" fill="#FAE9E7" stroke="none" stroke-width="0"/>
226
+ <circle cx="918" cy="556" r="2.6" fill="#C0392B" stroke="none" stroke-width="0"/>
227
+ <text x="925" y="559" font-family="Noto Sans SC" font-size="7" font-weight="700" fill="#C0392B" text-anchor="start">✗</text>
228
+ <rect x="966" y="550" width="44" height="12" rx="3" fill="#FAE9E7" stroke="none" stroke-width="0"/>
229
+ <circle cx="974" cy="556" r="2.6" fill="#C0392B" stroke="none" stroke-width="0"/>
230
+ <text x="981" y="559" font-family="Noto Sans SC" font-size="7" font-weight="700" fill="#C0392B" text-anchor="start">✗</text>
231
+ <rect x="1048" y="160" width="200" height="390" rx="12" fill="#FFFFFF" stroke="#E6EBF2" stroke-width="1"/>
232
+ <line x1="1048" y1="192" x2="1248" y2="192" stroke="#E6EBF2" stroke-width="1"/>
233
+ <text x="1062" y="181" font-family="Noto Sans SC" font-size="12" font-weight="700" fill="#192638" text-anchor="start">待处理</text>
234
+ <rect x="1190" y="169" width="44" height="17" rx="8" fill="#F7F9FC" stroke="#E6EBF2" stroke-width="1"/>
235
+ <text x="1212" y="181" font-family="Noto Sans SC" font-size="8.5" font-weight="normal" fill="#8B99AC" text-anchor="middle">12 项</text>
236
+ <rect x="1048" y="192" width="3" height="86" rx="0" fill="#C0392B" stroke="none" stroke-width="0"/>
237
+ <rect x="1062" y="204" width="24" height="13" rx="3" fill="#FAE9E7" stroke="none" stroke-width="0"/>
238
+ <text x="1074" y="214" font-family="Noto Sans SC" font-size="7" font-weight="700" fill="#C0392B" text-anchor="middle">R11</text>
239
+ <text x="1092" y="214" font-family="Noto Sans SC" font-size="9" font-weight="700" fill="#192638" text-anchor="start">R11 已达成但无下一步里程碑</text>
240
+ <text x="1062" y="230" font-family="Noto Sans SC" font-size="7.5" font-weight="normal" fill="#5A6A80" text-anchor="start">结果已达成,却没有下一个里程碑:</text>
241
+ <text x="1062" y="242" font-family="Noto Sans SC" font-size="7.5" font-weight="normal" fill="#5A6A80" text-anchor="start">价值做出来了,没有转化路径。</text>
242
+ <text x="1062" y="262" font-family="Noto Sans SC" font-size="7.5" font-weight="normal" fill="#2864E8" text-anchor="start">某某制造产线安全接入 · POC-2026-003</text>
243
+ <line x1="1048" y1="278" x2="1248" y2="278" stroke="#E6EBF2" stroke-width="1"/>
244
+ <rect x="1048" y="278" width="3" height="76" rx="0" fill="#C0392B" stroke="none" stroke-width="0"/>
245
+ <rect x="1062" y="290" width="20" height="13" rx="3" fill="#FAE9E7" stroke="none" stroke-width="0"/>
246
+ <text x="1072" y="300" font-family="Noto Sans SC" font-size="7" font-weight="700" fill="#C0392B" text-anchor="middle">R1</text>
247
+ <text x="1088" y="300" font-family="Noto Sans SC" font-size="9" font-weight="700" fill="#192638" text-anchor="start">R1 G0 必填未齐</text>
248
+ <text x="1062" y="316" font-family="Noto Sans SC" font-size="7.5" font-weight="normal" fill="#5A6A80" text-anchor="start">G0 五必填缺 2 项:</text>
249
+ <text x="1062" y="328" font-family="Noto Sans SC" font-size="7.5" font-weight="normal" fill="#5A6A80" text-anchor="start">decision_chain, post_poc_decision。</text>
250
+ <line x1="1048" y1="354" x2="1248" y2="354" stroke="#E6EBF2" stroke-width="1"/>
251
+ <text x="1062" y="372" font-family="Noto Sans SC" font-size="8.5" font-weight="600" fill="#5A6A80" text-anchor="start">R12 已在 G2 停留 68 天</text>
252
+ <text x="1062" y="394" font-family="Noto Sans SC" font-size="8.5" font-weight="600" fill="#5A6A80" text-anchor="start">R4 成功指标 1 个(要求 2–3)</text>
253
+ <text x="1062" y="422" font-family="Noto Sans SC" font-size="8" font-weight="normal" fill="#8B99AC" text-anchor="start">还有 8 条…</text>
254
+ </svg>
package/icon.svg ADDED
@@ -0,0 +1,17 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 96 96" width="96" height="96" role="img" aria-label="Work Dashboard">
2
+ <defs>
3
+ <linearGradient id="wd-bg" x1="0" y1="0" x2="1" y2="1">
4
+ <stop offset="0" stop-color="#3B7BF0" />
5
+ <stop offset="1" stop-color="#1B4FC2" />
6
+ </linearGradient>
7
+ </defs>
8
+ <rect x="6" y="6" width="84" height="84" rx="20" fill="url(#wd-bg)" />
9
+ <!-- Dashboard board: two metric tiles above, one wide row below -->
10
+ <rect x="18" y="22" width="27" height="22" rx="6" fill="#ffffff" opacity="0.95" />
11
+ <rect x="51" y="22" width="27" height="22" rx="6" fill="#ffffff" opacity="0.62" />
12
+ <rect x="18" y="50" width="60" height="12" rx="5" fill="#ffffff" opacity="0.82" />
13
+ <rect x="18" y="66" width="38" height="9" rx="4" fill="#ffffff" opacity="0.42" />
14
+ <!-- Accent mark: the current module -->
15
+ <circle cx="27.5" cy="33" r="3.4" fill="#218568" />
16
+ <circle cx="60.5" cy="33" r="3.4" fill="#C9D8F5" />
17
+ </svg>
@@ -0,0 +1,45 @@
1
+ /**
2
+ * The unified blocker board: every reason a project is stuck, in one list.
3
+ *
4
+ * The dashboard used to answer "what is stuck" in three unrelated places: the
5
+ * pending rail (the 12 gap rules), the risk board (an independent page), and a
6
+ * one-line footnote about missing amounts. A reader had to merge them mentally,
7
+ * and the merge was never complete — a project with no amount and no progress
8
+ * appeared in none of the three.
9
+ *
10
+ * This module does that merge once, on the Host, so the Client cannot disagree
11
+ * with itself. Five sources, each with its own level and priority:
12
+ *
13
+ * 1. `gap` — the twelve v3 rules. Delegated to `scanGaps` so this board and the
14
+ * pending rail can never report different gap counts.
15
+ * 2. `stalled` — the stage has not moved past `stallDays`. Deliberately NOT
16
+ * R12: R12 only fires when `stage_since` exists, which on the real ledger is
17
+ * one project in thirty. A project with no `stage_since` is not "not stuck",
18
+ * it is unmeasurable, and that is what `no-stage-since` reports.
19
+ * 3. `missing-amount` — `amount_wan` is 0. A project with no amount cannot be
20
+ * ranked, forecast, or compared against the large-amount rule.
21
+ * 4. `no-progress` — the project has never recorded a progress entry. This is
22
+ * the single largest blocker on a freshly imported ledger and it appeared
23
+ * nowhere before.
24
+ * 5. `no-stage-since` — no `stage_since`, so the stall clock never started.
25
+ *
26
+ * Each source contributes at most ONE row per project. Two rows saying "this
27
+ * project is stalled" and "this project has no stage_since" would be the same
28
+ * finding twice, and a list that double-counts cannot be sorted honestly.
29
+ */
30
+ import type { ScanOptions } from './gap.js';
31
+ import type { BlockerBoard, PocRecord } from './types.js';
32
+ import { BLOCKER_SOURCES } from './types.js';
33
+ /**
34
+ * Build the blocker board from the loaded records.
35
+ *
36
+ * Ordering: a global priority descending, then project id, then source. The
37
+ * gap rules keep their own weights (R11 outranks R2, and so on), so this list
38
+ * is a merge of rankings rather than a re-ranking — which is the point: the
39
+ * most valuable finding must not sink because it came from a smaller source.
40
+ */
41
+ export declare function buildBlockerBoard(records: readonly PocRecord[], options: ScanOptions): BlockerBoard;
42
+ /** An empty board for the cold-cache case, so the Client needs no null check. */
43
+ export declare function emptyBlockerBoard(): BlockerBoard;
44
+ /** Every source key, re-exported so the Client can build its chips. */
45
+ export { BLOCKER_SOURCES };
@@ -0,0 +1,160 @@
1
+ /**
2
+ * The unified blocker board: every reason a project is stuck, in one list.
3
+ *
4
+ * The dashboard used to answer "what is stuck" in three unrelated places: the
5
+ * pending rail (the 12 gap rules), the risk board (an independent page), and a
6
+ * one-line footnote about missing amounts. A reader had to merge them mentally,
7
+ * and the merge was never complete — a project with no amount and no progress
8
+ * appeared in none of the three.
9
+ *
10
+ * This module does that merge once, on the Host, so the Client cannot disagree
11
+ * with itself. Five sources, each with its own level and priority:
12
+ *
13
+ * 1. `gap` — the twelve v3 rules. Delegated to `scanGaps` so this board and the
14
+ * pending rail can never report different gap counts.
15
+ * 2. `stalled` — the stage has not moved past `stallDays`. Deliberately NOT
16
+ * R12: R12 only fires when `stage_since` exists, which on the real ledger is
17
+ * one project in thirty. A project with no `stage_since` is not "not stuck",
18
+ * it is unmeasurable, and that is what `no-stage-since` reports.
19
+ * 3. `missing-amount` — `amount_wan` is 0. A project with no amount cannot be
20
+ * ranked, forecast, or compared against the large-amount rule.
21
+ * 4. `no-progress` — the project has never recorded a progress entry. This is
22
+ * the single largest blocker on a freshly imported ledger and it appeared
23
+ * nowhere before.
24
+ * 5. `no-stage-since` — no `stage_since`, so the stall clock never started.
25
+ *
26
+ * Each source contributes at most ONE row per project. Two rows saying "this
27
+ * project is stalled" and "this project has no stage_since" would be the same
28
+ * finding twice, and a list that double-counts cannot be sorted honestly.
29
+ */
30
+ import { daysSince, latestProgress, normalizeStage, numberOrNull, scanGaps, text } from './gap.js';
31
+ import { BLOCKER_SOURCES } from './types.js';
32
+ /** Severity and sort weight for one source. */
33
+ const SOURCE_META = {
34
+ // A stalled project is losing money right now; nothing else outranks it.
35
+ stalled: { level: 'high', priority: 88 },
36
+ // No progress at all is the "invisible work" case the timeline also flags.
37
+ 'no-progress': { level: 'high', priority: 86 },
38
+ 'missing-amount': { level: 'medium', priority: 58 },
39
+ // The gap rules carry their own priority; this is only the fallback.
40
+ gap: { level: 'high', priority: 80 },
41
+ 'no-stage-since': { level: 'medium', priority: 44 },
42
+ };
43
+ /** An empty count map, so every source key exists even at zero. */
44
+ function emptyCounts() {
45
+ return { gap: 0, stalled: 0, 'missing-amount': 0, 'no-progress': 0, 'no-stage-since': 0 };
46
+ }
47
+ /** One row from a gap finding; the rule's own level and priority win. */
48
+ function fromGap(item, stageLabel) {
49
+ return {
50
+ source: 'gap',
51
+ level: item.level,
52
+ priority: item.priority,
53
+ pocId: item.pocId,
54
+ pocName: item.pocName,
55
+ stageLabel,
56
+ rule: item.rule,
57
+ ruleNo: item.ruleNo,
58
+ params: item.params ?? {},
59
+ };
60
+ }
61
+ /** One row from a non-gap source. */
62
+ function fromSource(source, record, stageLabel, params = {}) {
63
+ const meta = SOURCE_META[source];
64
+ const pocId = text(record.poc_id);
65
+ const name = text(record.name);
66
+ return {
67
+ source,
68
+ level: meta.level,
69
+ priority: meta.priority,
70
+ pocId,
71
+ pocName: name === '' ? pocId : name,
72
+ stageLabel,
73
+ rule: null,
74
+ ruleNo: 0,
75
+ params,
76
+ };
77
+ }
78
+ /**
79
+ * Whether the record has any progress entry at all.
80
+ *
81
+ * `latestProgress` is the single definition of "the newest entry" in this
82
+ * codebase; using it here keeps the board, the summary and the detail page in
83
+ * agreement about what counts as activity.
84
+ */
85
+ function hasProgress(record) {
86
+ return latestProgress(record) !== null;
87
+ }
88
+ /**
89
+ * Build the blocker board from the loaded records.
90
+ *
91
+ * Ordering: a global priority descending, then project id, then source. The
92
+ * gap rules keep their own weights (R11 outranks R2, and so on), so this list
93
+ * is a merge of rankings rather than a re-ranking — which is the point: the
94
+ * most valuable finding must not sink because it came from a smaller source.
95
+ */
96
+ export function buildBlockerBoard(records, options) {
97
+ const rows = [];
98
+ const counts = emptyCounts();
99
+ const blocked = new Set();
100
+ for (const record of records) {
101
+ const pocId = text(record.poc_id);
102
+ const rawStage = text(record.stage);
103
+ const { closed } = normalizeStage(record.stage);
104
+ const stageLabel = closed ? 'closed' : rawStage;
105
+ const before = rows.length;
106
+ // 1. The twelve rules. Delegated, never reimplemented.
107
+ for (const item of scanGaps(record, options)) {
108
+ rows.push(fromGap(item, stageLabel));
109
+ counts.gap += 1;
110
+ }
111
+ // 2. Stalled: the stage clock exists AND has run out. R12 already reports
112
+ // exactly this case, so the row is only added when R12 did not fire —
113
+ // otherwise the same fact would appear twice under two labels.
114
+ const since = text(record.stage_since);
115
+ const isDated = /^\d{4}-\d{2}-\d{2}$/.test(since);
116
+ const stalledDays = isDated ? daysSince(since, options.now) : null;
117
+ const r12Fired = rows.some((row) => row.pocId === pocId && row.rule === 'R12-stage-stalled');
118
+ if (stalledDays !== null && stalledDays > options.stallDays && !r12Fired) {
119
+ rows.push(fromSource('stalled', record, stageLabel, { days: stalledDays, stallDays: options.stallDays }));
120
+ counts.stalled += 1;
121
+ }
122
+ // 3. Missing amount. `0` is the ledger's "not filled", not "free".
123
+ if ((numberOrNull(record.amount_wan) ?? 0) === 0) {
124
+ rows.push(fromSource('missing-amount', record, stageLabel));
125
+ counts['missing-amount'] += 1;
126
+ }
127
+ // 4. No progress at all.
128
+ if (!hasProgress(record)) {
129
+ rows.push(fromSource('no-progress', record, stageLabel));
130
+ counts['no-progress'] += 1;
131
+ }
132
+ // 5. The stall clock never started.
133
+ if (!isDated) {
134
+ rows.push(fromSource('no-stage-since', record, stageLabel));
135
+ counts['no-stage-since'] += 1;
136
+ }
137
+ if (rows.length > before)
138
+ blocked.add(pocId);
139
+ }
140
+ rows.sort((left, right) => right.priority - left.priority ||
141
+ left.pocId.localeCompare(right.pocId) ||
142
+ left.source.localeCompare(right.source));
143
+ return {
144
+ rows,
145
+ counts,
146
+ projectsBlocked: blocked.size,
147
+ projectsTotal: records.length,
148
+ };
149
+ }
150
+ /** An empty board for the cold-cache case, so the Client needs no null check. */
151
+ export function emptyBlockerBoard() {
152
+ return {
153
+ rows: [],
154
+ counts: emptyCounts(),
155
+ projectsBlocked: 0,
156
+ projectsTotal: 0,
157
+ };
158
+ }
159
+ /** Every source key, re-exported so the Client can build its chips. */
160
+ export { BLOCKER_SOURCES };
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Typed Client-side API over the Host's exact Connection route.
3
+ *
4
+ * The browser RPC caller validates the envelope and the correlation id, so this
5
+ * layer only has to unwrap the endpoint's own result: `ok: true` returns the
6
+ * value, `ok: false` throws an {@link ActionError} carrying the Host's stable
7
+ * code and message. No Host object, function or live Session value crosses this
8
+ * boundary — only lossless JSON.
9
+ */
10
+ import type { ClientConnectionLike } from './contracts.js';
11
+ import type { ExportFormResult, GlobalTimeline, ProjectDetail, RefreshOutcome, RiskBoard, Snapshot } from '../types.js';
12
+ /** Failure raised by the Host; `code` is stable enough to switch on. */
13
+ export declare class ActionError extends Error {
14
+ readonly code: string;
15
+ readonly details: Record<string, unknown>;
16
+ constructor(code: string, message: string, details?: Record<string, unknown>);
17
+ }
18
+ /** The one API face the view uses. */
19
+ export interface ClientApi {
20
+ /** Current snapshot; `cacheReady: false` means "no data pulled yet". */
21
+ list(signal?: AbortSignal): Promise<Snapshot>;
22
+ /** Clone or fast-forward, then return the new snapshot and what happened. */
23
+ refresh(signal?: AbortSignal): Promise<{
24
+ snapshot: Snapshot;
25
+ outcome: RefreshOutcome;
26
+ }>;
27
+ /** One project's detail page. */
28
+ detail(pocId: string, signal?: AbortSignal): Promise<ProjectDetail>;
29
+ /** Risks across all projects, sorted by severity. */
30
+ risks(signal?: AbortSignal): Promise<RiskBoard>;
31
+ /** Rounds across all projects, newest first. */
32
+ timeline(signal?: AbortSignal): Promise<GlobalTimeline>;
33
+ /**
34
+ * Build the collection form.
35
+ *
36
+ * Generated on the Host because the generator needs the YAML serializer, which
37
+ * must not be bundled into the browser module.
38
+ */
39
+ exportForm(mode: 'fill' | 'blank', pocIds: readonly string[], signal?: AbortSignal): Promise<ExportFormResult>;
40
+ }
41
+ /** Create the API bound to this plugin's Fiber lifetime. */
42
+ export declare function createApi(connection: ClientConnectionLike, lifetime: AbortSignal): ClientApi;
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Typed Client-side API over the Host's exact Connection route.
3
+ *
4
+ * The browser RPC caller validates the envelope and the correlation id, so this
5
+ * layer only has to unwrap the endpoint's own result: `ok: true` returns the
6
+ * value, `ok: false` throws an {@link ActionError} carrying the Host's stable
7
+ * code and message. No Host object, function or live Session value crosses this
8
+ * boundary — only lossless JSON.
9
+ */
10
+ import { ENDPOINT } from '../types.js';
11
+ /** Failure raised by the Host; `code` is stable enough to switch on. */
12
+ export class ActionError extends Error {
13
+ code;
14
+ details;
15
+ constructor(code, message, details = {}) {
16
+ super(message);
17
+ this.code = code;
18
+ this.details = details;
19
+ this.name = 'ActionError';
20
+ }
21
+ }
22
+ /** Unwrap one endpoint result, converting a failure into a thrown error. */
23
+ function unwrap(result) {
24
+ if (result === null || typeof result !== 'object' || !('ok' in result)) {
25
+ throw new ActionError('invalid-response', 'The Host returned an invalid work dashboard response.');
26
+ }
27
+ if (!result.ok)
28
+ throw new ActionError(result.error.code, result.error.message, result.error.details);
29
+ return result.value;
30
+ }
31
+ /** Create the API bound to this plugin's Fiber lifetime. */
32
+ export function createApi(connection, lifetime) {
33
+ const call = async (request, signal) => {
34
+ const signalToUse = signal === undefined ? lifetime : AbortSignal.any([lifetime, signal]);
35
+ return unwrap(await connection.rpc.call('/api', ENDPOINT, request, signalToUse));
36
+ };
37
+ return {
38
+ list: (signal) => call({ action: 'list' }, signal),
39
+ refresh: (signal) => call({ action: 'refresh' }, signal),
40
+ detail: (pocId, signal) => call({ action: 'detail', pocId }, signal),
41
+ risks: (signal) => call({ action: 'risks' }, signal),
42
+ timeline: (signal) => call({ action: 'timeline' }, signal),
43
+ exportForm: (mode, pocIds, signal) => call({ action: 'export-form', mode, pocIds: [...pocIds] }, signal),
44
+ };
45
+ }