create-pmos 0.398.0 → 0.400.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 (515) hide show
  1. package/package.json +30 -25
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/workspace/briefing-premium-adddoc-test.js +19 -15
  7. package/workspace/briefing-premium-board-test.js +82 -50
  8. package/workspace/briefing-premium-calendar-2-test.js +36 -36
  9. package/workspace/briefing-premium-calendar-3-test.js +39 -39
  10. package/workspace/briefing-premium-calendar-test.js +23 -24
  11. package/workspace/briefing-premium-doc-edit-test.js +8 -10
  12. package/workspace/briefing-premium-initiative-test.js +38 -16
  13. package/workspace/briefing-premium-insights-test.js +114 -37
  14. package/workspace/briefing-premium-metrics-test.js +6 -4
  15. package/workspace/briefing-premium-products-test.js +10 -7
  16. package/workspace/briefing-premium-sources-test.js +25 -22
  17. package/workspace/briefing-premium-test.js +48 -43
  18. package/workspace/briefing-premium-work-test.js +16 -11
  19. package/workspace/c3-capture-test.js +0 -17
  20. package/workspace/changelog.json +29 -0
  21. package/workspace/ev-everywhere-test.js +210 -0
  22. package/workspace/fixtures/premium-viewer-fixtures.js +11 -6
  23. package/workspace/guide/briefing-premium.md +2 -2
  24. package/workspace/guide/home.md +58 -19
  25. package/workspace/guide/index.md +1 -1
  26. package/workspace/guide/layout.md +2 -2
  27. package/workspace/guide/notes.md +2 -2
  28. package/workspace/guide/phone-companion.md +1 -1
  29. package/workspace/lib/board-grill.js +63 -0
  30. package/workspace/lib/board-premium.js +36 -5
  31. package/workspace/lib/initiative-layout.js +77 -0
  32. package/workspace/lib/insights-premium.js +3 -2
  33. package/workspace/lib/insights-records.js +21 -7
  34. package/workspace/lib/meeting-points.js +52 -0
  35. package/workspace/lib/news-for-you.js +88 -0
  36. package/workspace/lib/notes-series.js +29 -6
  37. package/workspace/lib/report-confirm.js +48 -0
  38. package/workspace/lib/route-modules.js +9 -9
  39. package/workspace/lib/routes-board-docs.js +46 -0
  40. package/workspace/lib/routes-board-grill.js +90 -0
  41. package/workspace/lib/routes-home-review.js +108 -0
  42. package/workspace/lib/routes-initiative-layout.js +57 -0
  43. package/workspace/lib/routes-insights-premium.js +4 -1
  44. package/workspace/lib/routes-insights-records.js +8 -4
  45. package/workspace/lib/routes-meeting-points.js +37 -0
  46. package/workspace/lib/routes-news.js +57 -0
  47. package/workspace/lib/routes-notes.js +2 -1
  48. package/workspace/lib/routes-phone-day.js +18 -9
  49. package/workspace/lib/routes-report-confirm.js +31 -0
  50. package/workspace/lib/routes-search.js +38 -0
  51. package/workspace/lib/routes-slash.js +95 -0
  52. package/workspace/lib/search-index.js +176 -0
  53. package/workspace/package-lock.json +2 -2
  54. package/workspace/package.json +1 -2
  55. package/workspace/premium-board-actions-test.js +86 -50
  56. package/workspace/premium-briefing-depth-test.js +55 -54
  57. package/workspace/premium-chat-chart-tab-test.js +4 -2
  58. package/workspace/premium-chat-goal-view-test.js +1 -1
  59. package/workspace/premium-chat-report-tab-test.js +16 -2
  60. package/workspace/premium-chat-term-test.js +0 -10
  61. package/workspace/premium-core-doc-issue-test.js +15 -13
  62. package/workspace/premium-menu-rows-test.js +1 -1
  63. package/workspace/premium-phone-card-test.js +7 -5
  64. package/workspace/premium-report-read-test.js +55 -18
  65. package/workspace/premium-vw-backlog-test.js +2 -2
  66. package/workspace/premium-vw-cal-test.js +50 -35
  67. package/workspace/premium-vw-doc-test.js +10 -11
  68. package/workspace/premium-vw-item-test.js +1 -1
  69. package/workspace/premium-vw-jira-test.js +2 -2
  70. package/workspace/premium-vw-meet-test.js +37 -40
  71. package/workspace/premium-vw-notes-test.js +21 -19
  72. package/workspace/premium-vw-rec-test.js +11 -12
  73. package/workspace/premium-welcome-test.js +3 -3
  74. package/workspace/premium-work-depth-test.js +5 -6
  75. package/workspace/public/capture.html +23 -0
  76. package/workspace/public/pm/bd-acts.js +303 -225
  77. package/workspace/public/pm/bd-asks.js +261 -0
  78. package/workspace/public/pm/bd-pop.js +59 -0
  79. package/workspace/public/pm/bd-span.js +49 -13
  80. package/workspace/public/pm/bd-views.js +169 -0
  81. package/workspace/public/pm/c3-base.js +47 -0
  82. package/workspace/public/pm/c3-capture.js +1 -1
  83. package/workspace/public/pm/c3-ini-ui.js +1 -1
  84. package/workspace/public/pm/c3-sheet.js +1 -1
  85. package/workspace/public/pm/c3-toast.js +1 -1
  86. package/workspace/public/pm/console3.css +3 -0
  87. package/workspace/public/pm/cozy-board.css +301 -0
  88. package/workspace/public/pm/cozy-ev.css +228 -0
  89. package/workspace/public/pm/cozy-evmodel.js +106 -0
  90. package/workspace/public/pm/cozy-evui.js +47 -0
  91. package/workspace/public/pm/cozy-home.css +20 -5
  92. package/workspace/public/pm/cozy-insights.css +148 -10
  93. package/workspace/public/pm/cozy-nav.js +103 -39
  94. package/workspace/public/pm/cozy-news.js +140 -0
  95. package/workspace/public/pm/cozy-search.js +203 -0
  96. package/workspace/public/pm/cozy-settings.js +198 -0
  97. package/workspace/public/pm/cozy-sources.js +89 -0
  98. package/workspace/public/pm/cozy-today.css +220 -0
  99. package/workspace/public/pm/cozy-viewer.js +5 -2
  100. package/workspace/public/pm/cozy-vw-mtg.css +350 -0
  101. package/workspace/public/pm/cozy-vw-rp.css +152 -0
  102. package/workspace/public/pm/cozy.css +9 -0
  103. package/workspace/public/pm/goal-chat.js +5 -1
  104. package/workspace/public/pm/home-adddoc.js +5 -5
  105. package/workspace/public/pm/home-app.js +365 -70
  106. package/workspace/public/pm/home-around.js +24 -126
  107. package/workspace/public/pm/home-chat.js +77 -18
  108. package/workspace/public/pm/home-data.js +9 -7
  109. package/workspace/public/pm/home-dictate.js +57 -0
  110. package/workspace/public/pm/home-draft.js +6 -6
  111. package/workspace/public/pm/home-ini-model.js +190 -0
  112. package/workspace/public/pm/home-ini.css +171 -0
  113. package/workspace/public/pm/home-ini.js +466 -0
  114. package/workspace/public/pm/home-list.js +289 -0
  115. package/workspace/public/pm/home-more.js +18 -135
  116. package/workspace/public/pm/home-phone-card.js +13 -8
  117. package/workspace/public/pm/home-review.js +103 -0
  118. package/workspace/public/pm/home-task.js +67 -0
  119. package/workspace/public/pm/home-today.js +148 -0
  120. package/workspace/public/pm/home-work.js +63 -28
  121. package/workspace/public/pm/note-dock.js +1 -2
  122. package/workspace/public/pm/notes-links.js +1 -2
  123. package/workspace/public/pm/notes-task.js +3 -4
  124. package/workspace/public/pm/premium-board.js +164 -40
  125. package/workspace/public/pm/premium-chart-tab.js +4 -5
  126. package/workspace/public/pm/premium-first.js +5 -7
  127. package/workspace/public/pm/premium-initiative-head.js +3 -3
  128. package/workspace/public/pm/premium-insights.js +499 -202
  129. package/workspace/public/pm/premium-mtg-present.js +138 -0
  130. package/workspace/public/pm/premium-mtg-replay.js +142 -0
  131. package/workspace/public/pm/premium-report-read.js +216 -52
  132. package/workspace/public/pm/premium-report-tab.js +44 -19
  133. package/workspace/public/pm/premium-shell.js +7 -7
  134. package/workspace/public/pm/premium-vw-cal.js +150 -60
  135. package/workspace/public/pm/premium-vw-doc.css +20 -2
  136. package/workspace/public/pm/premium-vw-doc.js +22 -7
  137. package/workspace/public/pm/premium-vw-mtg.js +488 -261
  138. package/workspace/public/pm/premium-vw-notes.js +61 -0
  139. package/workspace/public/pm/rp-parts.js +269 -0
  140. package/workspace/public/pm/view-notes.js +2 -2
  141. package/workspace/public/premium-board.html +4 -3
  142. package/workspace/public/premium-insights.html +10 -10
  143. package/workspace/public/premium.html +3 -1
  144. package/workspace/r/m1.png +0 -0
  145. package/workspace/r/m2.png +0 -0
  146. package/workspace/r/m3.png +0 -0
  147. package/workspace/r/nl.png +0 -0
  148. package/workspace/replaced-tests.json +435 -0
  149. package/workspace/run-tests.js +323 -28
  150. package/workspace/server.js +15 -10
  151. package/workspace/test-files.json +3 -140
  152. package/workspace/test-lists/base.json +1 -2
  153. package/workspace/test-lists/c3-desktop-light-load.json +1 -2
  154. package/workspace/test-lists/c3-initiative-boards.json +1 -2
  155. package/workspace/test-lists/c3-meeting-focus.json +2 -12
  156. package/workspace/test-lists/c3-work-agent.json +1 -2
  157. package/workspace/test-lists/calendar-tidy-up.json +1 -2
  158. package/workspace/test-lists/console3-reports.json +1 -2
  159. package/workspace/test-lists/docs-three-way-sync.json +1 -2
  160. package/workspace/test-lists/extension-capture.json +5 -0
  161. package/workspace/test-lists/initiative-layout.json +9 -0
  162. package/workspace/test-lists/jira-wbs.json +1 -2
  163. package/workspace/test-lists/legacy-cleanup-a.json +9 -0
  164. package/workspace/test-lists/meeting-material.json +1 -2
  165. package/workspace/test-lists/meeting-notes.json +2 -36
  166. package/workspace/test-lists/meeting-replay.json +1 -2
  167. package/workspace/test-lists/mm-capture.json +2 -12
  168. package/workspace/test-lists/my-work.json +2 -10
  169. package/workspace/test-lists/onboarding-firstrun.json +2 -12
  170. package/workspace/test-lists/people-directory.json +1 -2
  171. package/workspace/test-lists/premium-uncovered-meetings.json +9 -0
  172. package/workspace/test-lists/premium-uncovered-reports.json +9 -0
  173. package/workspace/test-lists/run2-a.json +1 -2
  174. package/workspace/test-lists/run2-d.json +2 -19
  175. package/workspace/test-lists/run3-b.json +1 -2
  176. package/workspace/test-lists/run3-c.json +2 -12
  177. package/workspace/test-lists/run4-b.json +1 -2
  178. package/workspace/test-lists/run4-d.json +1 -5
  179. package/workspace/test-lists/run5-c.json +1 -11
  180. package/workspace/test-lists/run6.json +1 -5
  181. package/workspace/test-lists/uf-everywhere.json +15 -0
  182. package/workspace/test-lists/uf-home.json +9 -0
  183. package/workspace/test-lists/uncovered-board.json +9 -0
  184. package/workspace/test-lists/workspace-launch-flags.json +2 -12
  185. package/workspace/test-lists/workspace-profile-detection.json +2 -10
  186. package/workspace/test-timings.json +242 -123
  187. package/workspace/c3-briefing-test.js +0 -136
  188. package/workspace/c3-core-docs-test.js +0 -170
  189. package/workspace/c3-driver-fixture.js +0 -64
  190. package/workspace/c3-driver-test.js +0 -169
  191. package/workspace/c3-foundation-test.js +0 -163
  192. package/workspace/c3-ib-items-test.js +0 -114
  193. package/workspace/c3-ib-more-test.js +0 -146
  194. package/workspace/c3-ib-triage-backlog-test.js +0 -128
  195. package/workspace/c3-ini-harness.js +0 -66
  196. package/workspace/c3-ini-life-test.js +0 -167
  197. package/workspace/c3-initiatives-test.js +0 -186
  198. package/workspace/c3-light-load-test.js +0 -112
  199. package/workspace/c3-one-home-test.js +0 -149
  200. package/workspace/c3-phone-test.js +0 -289
  201. package/workspace/c3-quiet-test.js +0 -157
  202. package/workspace/c3-report-design-real-test.js +0 -264
  203. package/workspace/c3-report-design-test.js +0 -442
  204. package/workspace/c3-report-setup-test.js +0 -192
  205. package/workspace/c3-report-structure-real-test.js +0 -248
  206. package/workspace/c3-report-structure-test.js +0 -397
  207. package/workspace/c3-reports-test.js +0 -288
  208. package/workspace/c3-scan-test.js +0 -517
  209. package/workspace/c3-sessions-panel-test.js +0 -365
  210. package/workspace/c3-settings-test.js +0 -204
  211. package/workspace/c3-updates-test.js +0 -131
  212. package/workspace/c3-work-test.js +0 -260
  213. package/workspace/cut-stub.js +0 -40
  214. package/workspace/first-paint-audit.js +0 -160
  215. package/workspace/lib/c3-full-console.js +0 -15
  216. package/workspace/lib/engine/derived/trust.js +0 -3
  217. package/workspace/lib/engine/plan-forecast.js +0 -342
  218. package/workspace/lib/engine/report-families.js +0 -175
  219. package/workspace/lib/engine/truth-table.js +0 -57
  220. package/workspace/lib/routes-c3-init.js +0 -54
  221. package/workspace/lib/routes-c3-life.js +0 -120
  222. package/workspace/lib/routes-c3-timeline.js +0 -192
  223. package/workspace/lib/routes-forecast.js +0 -86
  224. package/workspace/lib/routes-releases.js +0 -130
  225. package/workspace/lib/routes-report-facts.js +0 -85
  226. package/workspace/lib/routes-report-families.js +0 -33
  227. package/workspace/lib/routes-signals.js +0 -51
  228. package/workspace/lib/routes-timeline.js +0 -197
  229. package/workspace/public/c3.html +0 -35
  230. package/workspace/public/index.html +0 -156
  231. package/workspace/public/pm/app.js +0 -831
  232. package/workspace/public/pm/bd-board.js +0 -159
  233. package/workspace/public/pm/bd-drag.js +0 -59
  234. package/workspace/public/pm/bd-model.js +0 -152
  235. package/workspace/public/pm/bd-timeline.js +0 -233
  236. package/workspace/public/pm/bd-tree.js +0 -244
  237. package/workspace/public/pm/board-copy.js +0 -59
  238. package/workspace/public/pm/board-read.js +0 -38
  239. package/workspace/public/pm/branches-sheet.js +0 -56
  240. package/workspace/public/pm/breakdown-api.js +0 -58
  241. package/workspace/public/pm/breakdown-copy.js +0 -138
  242. package/workspace/public/pm/briefing-deck.js +0 -441
  243. package/workspace/public/pm/briefing-model.js +0 -251
  244. package/workspace/public/pm/c3-ambient.js +0 -100
  245. package/workspace/public/pm/c3-audience-link.js +0 -21
  246. package/workspace/public/pm/c3-audience.js +0 -46
  247. package/workspace/public/pm/c3-boot.js +0 -13
  248. package/workspace/public/pm/c3-breakdown.js +0 -240
  249. package/workspace/public/pm/c3-brief-data.js +0 -11
  250. package/workspace/public/pm/c3-brief-mentions.js +0 -137
  251. package/workspace/public/pm/c3-brief-needs.js +0 -288
  252. package/workspace/public/pm/c3-brief-pulse.js +0 -112
  253. package/workspace/public/pm/c3-brief-summary.js +0 -139
  254. package/workspace/public/pm/c3-brief-today.js +0 -79
  255. package/workspace/public/pm/c3-brief.js +0 -279
  256. package/workspace/public/pm/c3-cal-strategy.js +0 -529
  257. package/workspace/public/pm/c3-calendar.js +0 -965
  258. package/workspace/public/pm/c3-calpop.js +0 -111
  259. package/workspace/public/pm/c3-case.js +0 -196
  260. package/workspace/public/pm/c3-core-docs.css +0 -18
  261. package/workspace/public/pm/c3-core-docs.js +0 -236
  262. package/workspace/public/pm/c3-daypart.js +0 -176
  263. package/workspace/public/pm/c3-demo-boards.js +0 -764
  264. package/workspace/public/pm/c3-demo-brief-ix.js +0 -350
  265. package/workspace/public/pm/c3-demo-brief-page.js +0 -70
  266. package/workspace/public/pm/c3-demo-cal-ix.js +0 -74
  267. package/workspace/public/pm/c3-demo-cal2.js +0 -66
  268. package/workspace/public/pm/c3-demo-cal3.js +0 -173
  269. package/workspace/public/pm/c3-demo-cal4.js +0 -169
  270. package/workspace/public/pm/c3-demo-cal5.js +0 -52
  271. package/workspace/public/pm/c3-demo-coredocs.js +0 -221
  272. package/workspace/public/pm/c3-demo-data.js +0 -552
  273. package/workspace/public/pm/c3-demo-focus.js +0 -181
  274. package/workspace/public/pm/c3-demo-init.js +0 -430
  275. package/workspace/public/pm/c3-demo-life.js +0 -77
  276. package/workspace/public/pm/c3-demo-material.js +0 -58
  277. package/workspace/public/pm/c3-demo-misc2.js +0 -34
  278. package/workspace/public/pm/c3-demo-phone.js +0 -48
  279. package/workspace/public/pm/c3-demo-plan2.js +0 -30
  280. package/workspace/public/pm/c3-demo-rd.js +0 -432
  281. package/workspace/public/pm/c3-demo-rep-ix.js +0 -126
  282. package/workspace/public/pm/c3-demo-rep2.js +0 -130
  283. package/workspace/public/pm/c3-demo-rep3.js +0 -138
  284. package/workspace/public/pm/c3-demo-rs.js +0 -287
  285. package/workspace/public/pm/c3-demo-term.js +0 -153
  286. package/workspace/public/pm/c3-demo-time.js +0 -49
  287. package/workspace/public/pm/c3-demo-work-ix.js +0 -32
  288. package/workspace/public/pm/c3-demo.js +0 -131
  289. package/workspace/public/pm/c3-design-studio.js +0 -369
  290. package/workspace/public/pm/c3-doc-formats.js +0 -153
  291. package/workspace/public/pm/c3-doc-sheet.js +0 -1230
  292. package/workspace/public/pm/c3-dock.js +0 -206
  293. package/workspace/public/pm/c3-docs.js +0 -291
  294. package/workspace/public/pm/c3-driver-work.js +0 -110
  295. package/workspace/public/pm/c3-driver.css +0 -18
  296. package/workspace/public/pm/c3-driver.js +0 -298
  297. package/workspace/public/pm/c3-focus.css +0 -304
  298. package/workspace/public/pm/c3-focus.js +0 -983
  299. package/workspace/public/pm/c3-ib-docs.js +0 -92
  300. package/workspace/public/pm/c3-ib-initiatives.js +0 -201
  301. package/workspace/public/pm/c3-ib-items.js +0 -210
  302. package/workspace/public/pm/c3-ib-releases.js +0 -48
  303. package/workspace/public/pm/c3-ib-sprints.js +0 -201
  304. package/workspace/public/pm/c3-ib-triage.js +0 -177
  305. package/workspace/public/pm/c3-ii-tabs.js +0 -252
  306. package/workspace/public/pm/c3-ini-life.css +0 -34
  307. package/workspace/public/pm/c3-ini-life.js +0 -379
  308. package/workspace/public/pm/c3-ini-records.js +0 -197
  309. package/workspace/public/pm/c3-ini-timeline.js +0 -278
  310. package/workspace/public/pm/c3-ini-work.js +0 -139
  311. package/workspace/public/pm/c3-init-extras.js +0 -170
  312. package/workspace/public/pm/c3-initiatives.js +0 -852
  313. package/workspace/public/pm/c3-lifecycle-panels.js +0 -479
  314. package/workspace/public/pm/c3-look.js +0 -27
  315. package/workspace/public/pm/c3-material.css +0 -22
  316. package/workspace/public/pm/c3-material.js +0 -321
  317. package/workspace/public/pm/c3-md.js +0 -3
  318. package/workspace/public/pm/c3-misc-panels.js +0 -89
  319. package/workspace/public/pm/c3-new-session.js +0 -110
  320. package/workspace/public/pm/c3-notes.js +0 -751
  321. package/workspace/public/pm/c3-phone-boot.js +0 -47
  322. package/workspace/public/pm/c3-phone-detail.js +0 -97
  323. package/workspace/public/pm/c3-phone-model.js +0 -3
  324. package/workspace/public/pm/c3-phone.css +0 -66
  325. package/workspace/public/pm/c3-phone.js +0 -444
  326. package/workspace/public/pm/c3-plan-panels.js +0 -163
  327. package/workspace/public/pm/c3-plan.js +0 -193
  328. package/workspace/public/pm/c3-quiet.css +0 -113
  329. package/workspace/public/pm/c3-quiet.js +0 -177
  330. package/workspace/public/pm/c3-replay.css +0 -133
  331. package/workspace/public/pm/c3-replay.js +0 -429
  332. package/workspace/public/pm/c3-report-deck.css +0 -163
  333. package/workspace/public/pm/c3-report-deck.js +0 -598
  334. package/workspace/public/pm/c3-report-frame.css +0 -20
  335. package/workspace/public/pm/c3-report-print.css +0 -20
  336. package/workspace/public/pm/c3-report-setup.css +0 -67
  337. package/workspace/public/pm/c3-report-setup.js +0 -298
  338. package/workspace/public/pm/c3-report-store.js +0 -244
  339. package/workspace/public/pm/c3-report-structure.css +0 -44
  340. package/workspace/public/pm/c3-report-structure.js +0 -473
  341. package/workspace/public/pm/c3-reports.css +0 -68
  342. package/workspace/public/pm/c3-reports.js +0 -377
  343. package/workspace/public/pm/c3-roadmap.js +0 -249
  344. package/workspace/public/pm/c3-scan-api.js +0 -167
  345. package/workspace/public/pm/c3-scan-next.js +0 -248
  346. package/workspace/public/pm/c3-scan-setup.js +0 -313
  347. package/workspace/public/pm/c3-scan-words.js +0 -41
  348. package/workspace/public/pm/c3-scan.css +0 -74
  349. package/workspace/public/pm/c3-scan.js +0 -93
  350. package/workspace/public/pm/c3-session-chat.js +0 -103
  351. package/workspace/public/pm/c3-session-conv.js +0 -165
  352. package/workspace/public/pm/c3-session-term.js +0 -216
  353. package/workspace/public/pm/c3-settings.css +0 -85
  354. package/workspace/public/pm/c3-settings.js +0 -1045
  355. package/workspace/public/pm/c3-shell.js +0 -628
  356. package/workspace/public/pm/c3-signals.js +0 -196
  357. package/workspace/public/pm/c3-strategy-panels.js +0 -45
  358. package/workspace/public/pm/c3-swipe.js +0 -230
  359. package/workspace/public/pm/c3-terminal-data.js +0 -48
  360. package/workspace/public/pm/c3-terminal-edge.js +0 -91
  361. package/workspace/public/pm/c3-terminal-icons.js +0 -40
  362. package/workspace/public/pm/c3-terminal-results.js +0 -141
  363. package/workspace/public/pm/c3-terminal.js +0 -52
  364. package/workspace/public/pm/c3-tickets.js +0 -163
  365. package/workspace/public/pm/c3-timeline.js +0 -201
  366. package/workspace/public/pm/calendar-views.js +0 -1049
  367. package/workspace/public/pm/console3-lift.md +0 -220
  368. package/workspace/public/pm/cozy-home.js +0 -172
  369. package/workspace/public/pm/cozy-initiative.css +0 -138
  370. package/workspace/public/pm/cycle-review.js +0 -125
  371. package/workspace/public/pm/data.js +0 -1577
  372. package/workspace/public/pm/dest-board.js +0 -444
  373. package/workspace/public/pm/dest-docs.js +0 -530
  374. package/workspace/public/pm/dest-initiatives.js +0 -162
  375. package/workspace/public/pm/dest-mywork.js +0 -307
  376. package/workspace/public/pm/dest-notes.js +0 -537
  377. package/workspace/public/pm/dest-people.js +0 -449
  378. package/workspace/public/pm/dest-reports.js +0 -383
  379. package/workspace/public/pm/dest-settings.js +0 -601
  380. package/workspace/public/pm/dest-today.js +0 -267
  381. package/workspace/public/pm/display-word.js +0 -56
  382. package/workspace/public/pm/doc-editor.js +0 -473
  383. package/workspace/public/pm/doc-graph.js +0 -272
  384. package/workspace/public/pm/doc-health-panel.js +0 -110
  385. package/workspace/public/pm/doc-rail.js +0 -167
  386. package/workspace/public/pm/doc-remote.js +0 -180
  387. package/workspace/public/pm/dock-sessions.js +0 -472
  388. package/workspace/public/pm/dock.js +0 -216
  389. package/workspace/public/pm/fixture.js +0 -821
  390. package/workspace/public/pm/flag-picker.js +0 -104
  391. package/workspace/public/pm/frame-copy.js +0 -278
  392. package/workspace/public/pm/freshness-line.js +0 -149
  393. package/workspace/public/pm/handoff-box.js +0 -82
  394. package/workspace/public/pm/initiative-list.js +0 -235
  395. package/workspace/public/pm/initiative-sheet.js +0 -331
  396. package/workspace/public/pm/initiatives-api.js +0 -95
  397. package/workspace/public/pm/initiatives-copy.js +0 -287
  398. package/workspace/public/pm/initiatives-timeline-copy.js +0 -59
  399. package/workspace/public/pm/initiatives-timeline.js +0 -410
  400. package/workspace/public/pm/initiatives-ui.js +0 -291
  401. package/workspace/public/pm/item-sheet.js +0 -268
  402. package/workspace/public/pm/keep-card.js +0 -204
  403. package/workspace/public/pm/lifecycle-lens-model.js +0 -246
  404. package/workspace/public/pm/lifecycle-lens.js +0 -276
  405. package/workspace/public/pm/lifecycle.js +0 -111
  406. package/workspace/public/pm/mobile.css +0 -366
  407. package/workspace/public/pm/mobile.js +0 -581
  408. package/workspace/public/pm/modes-live.js +0 -453
  409. package/workspace/public/pm/modes.js +0 -147
  410. package/workspace/public/pm/my-work-card.js +0 -51
  411. package/workspace/public/pm/my-work-data.js +0 -36
  412. package/workspace/public/pm/new-initiative-sheet.js +0 -169
  413. package/workspace/public/pm/next-step-ui.js +0 -190
  414. package/workspace/public/pm/outbox-panel.js +0 -125
  415. package/workspace/public/pm/palette-copy.js +0 -55
  416. package/workspace/public/pm/palette.js +0 -343
  417. package/workspace/public/pm/panel-breakdown.js +0 -702
  418. package/workspace/public/pm/panel-cockpit.js +0 -425
  419. package/workspace/public/pm/panel-detail.js +0 -1513
  420. package/workspace/public/pm/panel-initiatives.js +0 -929
  421. package/workspace/public/pm/panel-newsess.js +0 -709
  422. package/workspace/public/pm/panel-repos.js +0 -741
  423. package/workspace/public/pm/panel-tabs.js +0 -1506
  424. package/workspace/public/pm/panel-trees.js +0 -204
  425. package/workspace/public/pm/people-link.js +0 -106
  426. package/workspace/public/pm/phone-deck.js +0 -167
  427. package/workspace/public/pm/pm-work-view.js +0 -1533
  428. package/workspace/public/pm/portfolio-report.js +0 -61
  429. package/workspace/public/pm/premium-acts.js +0 -280
  430. package/workspace/public/pm/premium-brief.js +0 -111
  431. package/workspace/public/pm/premium-chat.js +0 -22
  432. package/workspace/public/pm/premium-doc-sheet.js +0 -312
  433. package/workspace/public/pm/premium-initiative.js +0 -324
  434. package/workspace/public/pm/premium-insights.css +0 -228
  435. package/workspace/public/pm/premium-metric-tiles.js +0 -68
  436. package/workspace/public/pm/premium-report-brief.js +0 -132
  437. package/workspace/public/pm/premium-vw-rec.js +0 -67
  438. package/workspace/public/pm/premium-wide.css +0 -30
  439. package/workspace/public/pm/print.css +0 -44
  440. package/workspace/public/pm/provider-cards.js +0 -136
  441. package/workspace/public/pm/registry.js +0 -203
  442. package/workspace/public/pm/release-card.js +0 -110
  443. package/workspace/public/pm/releases-view.js +0 -248
  444. package/workspace/public/pm/report-families-view.js +0 -505
  445. package/workspace/public/pm/report-slides.js +0 -438
  446. package/workspace/public/pm/report-tab.js +0 -33
  447. package/workspace/public/pm/report-view.js +0 -337
  448. package/workspace/public/pm/reports-copy.js +0 -134
  449. package/workspace/public/pm/roadmap.js +0 -294
  450. package/workspace/public/pm/run-card.js +0 -260
  451. package/workspace/public/pm/sessions-panel.js +0 -219
  452. package/workspace/public/pm/sheet-jira.js +0 -353
  453. package/workspace/public/pm/shell-bell.js +0 -163
  454. package/workspace/public/pm/shell-model.js +0 -83
  455. package/workspace/public/pm/shell-phone.js +0 -124
  456. package/workspace/public/pm/shell-readaloud.js +0 -53
  457. package/workspace/public/pm/shell-recording.js +0 -274
  458. package/workspace/public/pm/shell-ticker.js +0 -90
  459. package/workspace/public/pm/sig-watch.js +0 -41
  460. package/workspace/public/pm/slide-confirm.js +0 -163
  461. package/workspace/public/pm/slides-copy.js +0 -52
  462. package/workspace/public/pm/status-banner.js +0 -95
  463. package/workspace/public/pm/tab-doc.js +0 -859
  464. package/workspace/public/pm/tab-gone.js +0 -21
  465. package/workspace/public/pm/tab-term.js +0 -1210
  466. package/workspace/public/pm/tab-web.js +0 -90
  467. package/workspace/public/pm/timeline-copy.js +0 -48
  468. package/workspace/public/pm/timeline-forecast-view.js +0 -164
  469. package/workspace/public/pm/today-agenda.js +0 -331
  470. package/workspace/public/pm/today-cards.js +0 -244
  471. package/workspace/public/pm/today-copy.js +0 -506
  472. package/workspace/public/pm/today-day.js +0 -1371
  473. package/workspace/public/pm/today-goals.js +0 -297
  474. package/workspace/public/pm/today-jobs.js +0 -84
  475. package/workspace/public/pm/today-mentions.js +0 -50
  476. package/workspace/public/pm/topbar.js +0 -202
  477. package/workspace/public/pm/triage-card.js +0 -60
  478. package/workspace/public/pm/undo-hold.js +0 -103
  479. package/workspace/public/pm/view-addrepo.js +0 -208
  480. package/workspace/public/pm/view-files.js +0 -197
  481. package/workspace/public/pm/view-livenotes.js +0 -399
  482. package/workspace/public/pm/view-today.js +0 -13
  483. package/workspace/public/pm/view-validate.js +0 -171
  484. package/workspace/public/pm/welcome.js +0 -391
  485. package/workspace/public/pm/work-place.js +0 -68
  486. package/workspace/public/pm/xlsx-read.js +0 -117
  487. package/workspace/public/welcome.html +0 -22
  488. package/workspace/test-lists/browser-suites-green.json +0 -5
  489. package/workspace/test-lists/c3-core-docs.json +0 -9
  490. package/workspace/test-lists/c3-doc-sheet-rich.json +0 -6
  491. package/workspace/test-lists/c3-doc-sheet-size.json +0 -6
  492. package/workspace/test-lists/c3-doc-sheet-v2.json +0 -6
  493. package/workspace/test-lists/c3-ib-items.json +0 -9
  494. package/workspace/test-lists/c3-ib-more.json +0 -9
  495. package/workspace/test-lists/c3-ib-triage-backlog.json +0 -9
  496. package/workspace/test-lists/c3-ini-life.json +0 -9
  497. package/workspace/test-lists/c3-meeting-board.json +0 -5
  498. package/workspace/test-lists/c3-meeting-card.json +0 -5
  499. package/workspace/test-lists/c3-notes-place.json +0 -5
  500. package/workspace/test-lists/c3-notes-series.json +0 -5
  501. package/workspace/test-lists/calendar-time-page.json +0 -5
  502. package/workspace/test-lists/calpop.json +0 -4
  503. package/workspace/test-lists/console3-briefing.json +0 -9
  504. package/workspace/test-lists/console3-foundation.json +0 -9
  505. package/workspace/test-lists/console3-work-page.json +0 -9
  506. package/workspace/test-lists/premium-brief-parity.json +0 -9
  507. package/workspace/test-lists/report-design-studio-ui.json +0 -5
  508. package/workspace/test-lists/report-structure-ui.json +0 -11
  509. package/workspace/test-lists/report-workspace-ui.json +0 -5
  510. package/workspace/test-lists/run3-a.json +0 -5
  511. package/workspace/test-lists/run3-d.json +0 -6
  512. package/workspace/test-lists/run4-c.json +0 -13
  513. package/workspace/test-lists/today-goals-jobs-ui.json +0 -5
  514. package/workspace/test-lists/today-mentions-cards.json +0 -5
  515. package/workspace/test-lists/workspace-tabs-declutter.json +0 -13
@@ -1,15 +0,0 @@
1
- 'use strict';
2
- /* lib/c3-full-console.js — for browser suites that test the console's desktop layout at phone width.
3
- * Since c3-phone-companion, console3 at 640px or less shows the phone companion. The PM has no way to the desktop layout there
4
- * (Full console was dropped on 2026-10-13); pmos.c3.testDesk = 'desk' keeps it, for suites only. fullConsole(browser) makes every
5
- * new context start with it, so a suite that resizes to 400 wide still tests the desktop layout. c3-phone-test.js tests the companion itself. */
6
- function fullConsole(browser) {
7
- const make = browser.newContext.bind(browser);
8
- browser.newContext = async (...args) => {
9
- const ctx = await make(...args);
10
- await ctx.addInitScript(() => { try { localStorage.setItem('pmos.c3.testDesk', 'desk'); } catch { /* no storage */ } });
11
- return ctx;
12
- };
13
- return browser;
14
- }
15
- module.exports = { fullConsole };
@@ -1,3 +0,0 @@
1
- 'use strict';
2
- // Re-export: the canonical copy is scripts/trust/trust.js (the PM's sample, ported once).
3
- module.exports = require('../trust/trust.js');
@@ -1,342 +0,0 @@
1
- 'use strict';
2
- /* plan-forecast.js — the forecast, critical path, time machine and capacity load of the Timeline (console3 wave B5).
3
- * PURE: no I/O, no clock (today is a parameter). Nothing here is typed by the PM; every date is derived.
4
- *
5
- * BACKED BY THE PM'S SAMPLE: the forecast dates come from derived/plan.js plan() (end = latest dependency end, or the start,
6
- * plus duration), and the critical path is derived/derive.js critical() (the items with slack 0 against the forecast, from
7
- * the sample's facts.js). Nothing here re-implements them; this file only adapts repo items to the sample's state shape and
8
- * keeps the graph clean (unknown dependencies and cycles are reported in `problems`, where plan.js throws).
9
- * REPO-WRITTEN, because the sample has no equivalent: stateAt/replay (the slider stepping over { at, id, op } events),
10
- * weeksFrom, progressOf, capacityLoad and rebalanceProposal.
11
- *
12
- * DECISION CHANGED TO MATCH THE SAMPLE: the older code moved an unfinished item past its planned end to today + remaining
13
- * time (the handoff's open question, "decide at build"). plan.js decides otherwise: progress is not an input, so the forecast
14
- * ignores status, progress, doneAt and today. `today` now only decides the 'overdue' status label.
15
- *
16
- * Items: { id, start:'YYYY-MM-DD', due:'YYYY-MM-DD', state|status, after:[ids], owner, points, skill, progress }.
17
- * Dependencies: `deps` is { id: [ids it waits for] }, or null to read each item's `after`.
18
- */
19
- const P = require('./derived/plan.js');
20
- const V = require('./derived/derive.js');
21
- const DAY = P.D;
22
- const day = (s) => P.day(String(s).slice(0, 10));
23
- const fmt = P.fmt;
24
- const stateOf = (it) => String(it.state || it.status || 'todo');
25
- const PROGRESS = { todo: 0, doing: 0.5, review: 0.9, done: 1 };
26
- function progressOf(it) {
27
- if (typeof it.progress === 'number' && it.progress >= 0 && it.progress <= 1 && stateOf(it) !== 'done') return it.progress;
28
- return PROGRESS[stateOf(it)] == null ? 0 : PROGRESS[stateOf(it)];
29
- }
30
- const durOf = (it) => (it.start && it.due ? Math.max(1, Math.round((day(it.due) - day(it.start)) / DAY)) : 1);
31
- const depsOf = (it, deps) => (deps && deps[it.id] ? deps[it.id] : (!deps && it.after) || []);
32
-
33
- /** Clean the graph: unknown dependencies reported, cycles broken at the back edge and reported, topological order. */
34
- function graph(items, deps) {
35
- const by = new Map(items.map((it) => [it.id, it]));
36
- const problems = [];
37
- const clean = new Map();
38
- for (const it of items) {
39
- const ok = [];
40
- for (const d of depsOf(it, deps)) {
41
- if (!by.has(d)) problems.push({ kind: 'unknown-dependency', item: it.id, dependency: d });
42
- else if (d === it.id) problems.push({ kind: 'cycle', path: [it.id, it.id] });
43
- else ok.push(d);
44
- }
45
- clean.set(it.id, ok.sort());
46
- }
47
- const color = new Map();
48
- const order = [];
49
- const visit = (id, stack) => {
50
- color.set(id, 1);
51
- const keep = [];
52
- for (const d of clean.get(id)) {
53
- if (color.get(d) === 1) { problems.push({ kind: 'cycle', path: stack.slice(stack.indexOf(d)).concat(d) }); continue; }
54
- keep.push(d);
55
- if (!color.get(d)) visit(d, stack.concat(d));
56
- }
57
- clean.set(id, keep);
58
- color.set(id, 2);
59
- order.push(id);
60
- };
61
- for (const id of [...by.keys()].sort()) if (!color.get(id)) visit(id, [id]);
62
- return { by, clean, order, problems };
63
- }
64
-
65
- function statusOf(it, slip, end, today) {
66
- if (stateOf(it) !== 'done' && it.due && day(it.due) < today) return 'overdue';
67
- if (slip <= 0) return 'on time';
68
- return slip <= 3 ? 'at risk' : 'delayed';
69
- }
70
-
71
- /** The sample's state shape ({ dur, deps }) over the cleaned graph, and the one start plan.js takes: the earliest planned start. */
72
- function sampleState(g, today) {
73
- const state = {};
74
- for (const [id, it] of g.by) state[id] = { dur: durOf(it), deps: g.clean.get(id) };
75
- const starts = [...g.by.values()].filter((it) => it.start).map((it) => day(it.start));
76
- return { state, start: fmt(starts.length ? Math.min(...starts) : day(today)) };
77
- }
78
-
79
- /** forecast(items, deps, today) → { rows: [{ id, start, end, slip_days, status }], problems }. `today` is 'YYYY-MM-DD'. */
80
- function forecast(items, deps, today) {
81
- const g = graph(items, deps);
82
- if (!items.length) return { rows: [], problems: g.problems };
83
- const t = day(today);
84
- const { state, start } = sampleState(g, today);
85
- const pl = P.plan(state, start);
86
- const rows = items.map((it) => {
87
- const e = pl.end[it.id];
88
- const plannedEnd = it.due ? day(it.due) : e;
89
- const slip = Math.round((e - plannedEnd) / DAY);
90
- return { id: it.id, start: fmt(e - state[it.id].dur * DAY), end: fmt(e), slip_days: slip, status: statusOf(it, slip, e, t) };
91
- });
92
- return { rows, problems: g.problems };
93
- }
94
-
95
- /** criticalPath(items, deps) → { ids, days, problems }: every item with slack 0 against the forecast (the sample's rule), in
96
- * end-date then id order. Two equal chains are both critical. days = forecast minus the start. */
97
- function criticalPath(items, deps) {
98
- const g = graph(items, deps);
99
- if (!items.length) return { ids: [], days: 0, problems: g.problems };
100
- const { state, start } = sampleState(g, '1970-01-01');
101
- const pl = P.plan(state, start);
102
- const ids = [...V.critical(state, pl)].sort((a, b) => pl.end[a] - pl.end[b] || (a < b ? -1 : 1));
103
- return { ids, days: Math.round((pl.forecast - day(start)) / DAY), problems: g.problems };
104
- }
105
-
106
- /** stateAt(events, date) → the items as the fold of events up to and including `date` (the whole day). Events are append-only
107
- * { at, id, op: 'add'|'set'|'remove', fields }; the same events in any order give the same state (sorted by at, then input order). */
108
- function stateAt(events, date) {
109
- const cut = /^\d{4}-\d\d-\d\d$/.test(String(date)) ? date + 'T23:59:59.999Z' : String(date);
110
- const sorted = (events || []).map((e, i) => ({ e, i })).filter((x) => String(x.e.at) <= cut)
111
- .sort((a, b) => (String(a.e.at) < String(b.e.at) ? -1 : String(a.e.at) > String(b.e.at) ? 1 : a.i - b.i));
112
- const s = new Map();
113
- for (const { e } of sorted) {
114
- if (e.op === 'add') s.set(e.id, { ...(e.fields || {}), id: e.id });
115
- else if (e.op === 'set' && s.has(e.id)) Object.assign(s.get(e.id), e.fields || {});
116
- else if (e.op === 'remove') s.delete(e.id);
117
- }
118
- return [...s.values()].sort((a, b) => (a.id < b.id ? -1 : 1));
119
- }
120
-
121
- /** replay(events, from, to, stepDays) → [{ date, items }] in date order, always ending at `to`. At most 400 steps. */
122
- function replay(events, from, to, stepDays) {
123
- const step = Math.max(1, Math.floor(stepDays) || 1) * DAY;
124
- const out = [];
125
- for (let d = day(from); d < day(to) && out.length < 399; d += step) out.push({ date: fmt(d), items: stateAt(events, fmt(d)) });
126
- out.push({ date: fmt(day(to)), items: stateAt(events, to) });
127
- return out;
128
- }
129
-
130
- /** The n week starts (Mondays) from the week that holds `today`. */
131
- function weeksFrom(today, n) {
132
- const d = new Date(day(today));
133
- const back = (d.getUTCDay() + 6) % 7;
134
- return Array.from({ length: n }, (_, i) => fmt(day(today) - back * DAY + i * 7 * DAY));
135
- }
136
-
137
- /** capacityLoad(items, people, weeks) → { weeks, people: [{ id, points_per_week, skills, weeks: [{ week, load, over, parts }] }], over }.
138
- * weeks: Monday dates. An item's remaining points (points, default 1, x (1 - progress)) spread evenly over its start..end days
139
- * (give it forecast rows' start and end); a week's load is the points falling in it. people: { id, points_per_week, skills }. */
140
- function capacityLoad(items, people, weeks) {
141
- const out = (people || []).map((p) => ({ id: p.id, points_per_week: p.points_per_week, skills: p.skills || [],
142
- weeks: weeks.map((w) => ({ week: w, load: 0, over: false, parts: [] })) }));
143
- const by = new Map(out.map((p) => [p.id, p]));
144
- for (const it of items) {
145
- const p = by.get(it.owner);
146
- if (!p || stateOf(it) === 'done') continue;
147
- const s = day(it.start || it.due); const e = Math.max(day(it.end || it.due), s + DAY);
148
- const pts = (typeof it.points === 'number' ? it.points : 1) * (1 - progressOf(it));
149
- p.weeks.forEach((w) => {
150
- const a = Math.max(s, day(w.week)); const b = Math.min(e, day(w.week) + 7 * DAY);
151
- if (b > a) { const part = pts * (b - a) / (e - s); w.load += part; w.parts.push({ item: it.id, points: part, skill: it.skill || null }); }
152
- });
153
- }
154
- const over = [];
155
- for (const p of out) for (const w of p.weeks) {
156
- w.load = Math.round(w.load * 100) / 100;
157
- w.over = w.load > p.points_per_week;
158
- if (w.over) over.push({ person: p.id, week: w.week, load: w.load, capacity: p.points_per_week });
159
- }
160
- return { weeks, people: out, over };
161
- }
162
-
163
- /** rebalanceProposal(load) → { proposal: true, applied: false, moves }. For each over-capacity week (worst first) one item moves
164
- * from the most overloaded person to the least loaded one who has the item's skill, else to the least loaded. A PROPOSAL only:
165
- * this function changes nothing, and the plan changes only through the plan-items writer. */
166
- function rebalanceProposal(load) {
167
- const sim = new Map(load.people.map((p) => [p.id, new Map(p.weeks.map((w) => [w.week, w.load]))]));
168
- const moves = [];
169
- const todo = load.over.map((o) => ({ ...o, excess: o.load - o.capacity })).sort((a, b) => b.excess - a.excess || (a.person + a.week < b.person + b.week ? -1 : 1));
170
- for (const o of todo) {
171
- const from = load.people.find((p) => p.id === o.person);
172
- const part = from.weeks.find((w) => w.week === o.week).parts.slice().sort((a, b) => b.points - a.points || (a.item < b.item ? -1 : 1))[0];
173
- if (!part || moves.some((m) => m.item === part.item)) continue;
174
- const others = load.people.filter((p) => p.id !== o.person);
175
- const ratio = (p) => sim.get(p.id).get(o.week) / (p.points_per_week || 1);
176
- const skilled = part.skill ? others.filter((p) => p.skills.includes(part.skill)) : [];
177
- const pool = skilled.length ? skilled : others;
178
- const to = pool.slice().sort((a, b) => ratio(a) - ratio(b) || (a.id < b.id ? -1 : 1))[0];
179
- if (!to) continue;
180
- sim.get(o.person).set(o.week, sim.get(o.person).get(o.week) - part.points);
181
- sim.get(to.id).set(o.week, sim.get(to.id).get(o.week) + part.points);
182
- moves.push({ item: part.item, from: o.person, to: to.id, week: o.week, points: Math.round(part.points * 100) / 100,
183
- reason: skilled.length ? 'least loaded with skill ' + part.skill : 'least loaded' });
184
- }
185
- return { proposal: true, applied: false, moves };
186
- }
187
-
188
-
189
- /* ───────────── the Timeline's per-check frames and "what changed" (console3 Timeline, ported from the mockup's tixAt / planOf / revsAt) ─────────────
190
- * The mockup replays the plan by folding every ticket's revision history up to a check and re-planning it (tixAt, planOf). These do the same
191
- * over the repo's { at, id, op, fields, by, why } events: stateAt() is the fold, plan.js plan() is the plan, and the one difference from
192
- * forecast() is the day convention. A bar covers its first and LAST day (the mockup draws due + 1 as the bar's right edge), so a dependency
193
- * arrow from the end of one bar meets the start of the next. plan.js treats `end` as the first day AFTER the work, so end(inclusive) = end - 1 day.
194
- * An item with its own planned start keeps it: plan.js has one start for the whole plan, so each item gets a zero-dependency "gap" node as long as
195
- * the days from the plan start to its own start (a node plan.js plans like any other; its rows are dropped again). Milestones take no time.
196
- */
197
- const dayStr = (n) => fmt(n);
198
- const addD = (s, n) => fmt(day(s) + n * DAY);
199
- const gapId = (id) => ' gap:' + id;
200
-
201
- /** frameForecast(items, today, opts?) → { rows: [{ id, start, end, slip_days, status }], critical: [ids], forecast_end, problems }.
202
- * items: { id, start, due, after, state, ms? }. Dates are 'YYYY-MM-DD', end is the last day of work (inclusive). today only labels 'overdue'. */
203
- function frameForecast(items, today) {
204
- const g = graph(items, null);
205
- if (!items.length) return { rows: [], critical: [], forecast_end: null, problems: g.problems };
206
- const starts = items.filter((it) => it.start).map((it) => day(it.start));
207
- const base = starts.length ? Math.min(...starts) : day(today);
208
- const state = {};
209
- for (const [id, it] of g.by) {
210
- const ownStart = it.start ? day(it.start) : base;
211
- const gap = Math.max(0, Math.round((ownStart - base) / DAY) + (it.ms ? 1 : 0));
212
- const dur = it.ms ? 0 : (it.start && it.due ? Math.max(1, Math.round((day(it.due) - day(it.start)) / DAY) + 1) : 1);
213
- state[gapId(id)] = { dur: gap, deps: [] };
214
- state[id] = { dur, deps: stateOf(it) === 'done' ? [gapId(id)] : [gapId(id), ...g.clean.get(id)] }; // finished work keeps the dates it had
215
- }
216
- const pl = P.plan(state, fmt(base));
217
- const t = day(today);
218
- const rows = items.map((it) => {
219
- const e = pl.end[it.id];
220
- const endDay = e - DAY; // plan.js end is the first day after the work: the last day is one before
221
- const due = it.due ? day(it.due) : endDay;
222
- const slip = Math.max(0, Math.round((endDay - due) / DAY));
223
- const startDay = it.ms ? endDay : e - state[it.id].dur * DAY;
224
- const done = stateOf(it) === 'done';
225
- const status = done ? 'done' : slip <= 0 ? 'on time' : due < t ? 'overdue' : slip <= 3 ? 'at risk' : 'delayed';
226
- return { id: it.id, start: fmt(startDay), end: fmt(endDay), slip_days: done ? 0 : slip, status };
227
- });
228
- const crit = [...V.critical(state, pl)].filter((k) => !k.startsWith(' gap:') && stateOf(g.by.get(k)) !== 'done').sort((a, b) => pl.end[a] - pl.end[b] || (a < b ? -1 : 1));
229
- return { rows, critical: crit, forecast_end: fmt(Math.max(...rows.map((r) => day(r.end)))), problems: g.problems };
230
- }
231
-
232
- const ptsOf = (it) => (typeof it.points === 'number' && it.points > 0 ? it.points : 1);
233
- const sumPts = (items) => items.reduce((a, it) => a + ptsOf(it), 0);
234
- const depsStr = (a) => (a || []).slice().sort().join(',');
235
-
236
- /** whatChanged(a, b, events?) → what differs between two plan states, as the mockup's timeRight reads it: items added, removed, moved
237
- * (start or due, with the days), dependency changes, points and the forecast. a and b are stateAt() arrays (a may be empty or null).
238
- * events: the { at, id, op, fields, by, why } events between the two checks; the last one that touched an item names who and why. */
239
- function whatChanged(a, b, events) {
240
- const A = new Map((a || []).map((it) => [it.id, it]));
241
- const B = new Map((b || []).map((it) => [it.id, it]));
242
- const last = new Map();
243
- for (const e of events || []) last.set(e.id, e);
244
- const who = (id) => { const e = last.get(id) || {}; return { by: e.by || null, why: e.why || '' }; };
245
- const adds = new Map();
246
- for (const e of events || []) if (e.op === 'add' && !adds.has(e.id)) adds.set(e.id, e);
247
- const out = { added: [], removed: [], moved: [], deps: [], points: { from: sumPts([...A.values()]), to: sumPts([...B.values()]) } };
248
- out.points.delta = out.points.to - out.points.from;
249
- for (const [id, it] of B) {
250
- if (!A.has(id)) { const e = adds.get(id) || last.get(id) || {}; out.added.push({ id, title: it.title || id, points: ptsOf(it), by: e.by || null, why: e.why || '' }); continue; }
251
- const o = A.get(id);
252
- for (const f of ['start', 'due']) {
253
- if (o[f] && it[f] && o[f] !== it[f]) out.moved.push({ id, title: it.title || id, field: f, from: o[f], to: it[f], days: Math.round((day(it[f]) - day(o[f])) / DAY), ...who(id) });
254
- }
255
- if (depsStr(o.after) !== depsStr(it.after)) {
256
- const was = new Set(o.after || []); const now = new Set(it.after || []);
257
- out.deps.push({ id, title: it.title || id, added: [...now].filter((d) => !was.has(d)), removed: [...was].filter((d) => !now.has(d)), ...who(id) });
258
- }
259
- }
260
- for (const [id, it] of A) if (!B.has(id)) out.removed.push({ id, title: it.title || id, ...who(id) });
261
- return out;
262
- }
263
-
264
- /** pickChecks(events, today, max?) → [{ date, label }]: the days the plan changed (the first is the baseline), then today. At most `max`
265
- * (default 6): the baseline plus the latest changes. Events marked `synthetic` (a source with no history, such as Jira) never make a check. */
266
- function pickChecks(events, today, max) {
267
- const cap = Math.max(2, max || 6);
268
- const real = (events || []).filter((e) => !e.synthetic && e.at && String(e.at).slice(0, 10) <= today);
269
- const dates = [...new Set(real.map((e) => String(e.at).slice(0, 10)))].sort();
270
- let keep = dates;
271
- const hasToday = dates.includes(today);
272
- const room = cap - (hasToday ? 0 : 1);
273
- if (dates.length > room) keep = [dates[0], ...dates.slice(dates.length - (room - 1))];
274
- const titleOf = new Map();
275
- for (const e of real) if (e.op === 'add' && e.fields && e.fields.title && !titleOf.has(e.id)) titleOf.set(e.id, e.fields.title);
276
- const label = (d, i) => {
277
- if (d === today) return 'Today';
278
- if (i === 0) return 'Baseline';
279
- const adds = real.filter((e) => String(e.at).slice(0, 10) === d && e.op === 'add');
280
- const n = real.filter((e) => String(e.at).slice(0, 10) === d).length;
281
- return adds.length === 1 && n === 1 ? short(titleOf.get(adds[0].id) || adds[0].id, 24) + ' added' : n + ' change' + (n === 1 ? '' : 's');
282
- };
283
- const out = keep.map((d, i) => ({ date: d, label: label(d, i) }));
284
- if (!hasToday) out.push({ date: today, label: 'Today' });
285
- return out;
286
- }
287
- const short = (t, n) => { t = String(t); return t.length > n ? t.slice(0, n - 1) + '…' : t; };
288
-
289
-
290
- const MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
291
- const dlab = (s) => { const d = new Date(day(s)); return d.getUTCDate() + ' ' + MONTHS[d.getUTCMonth()]; };
292
- /** One line per item touched between two checks: who (the last to touch it), why, and what changed in words ("Due 24 to 28 Oct"). */
293
- function describeWindow(win, before, after) {
294
- const B = new Map((before || []).map((it) => [it.id, it])); const Af = new Map((after || []).map((it) => [it.id, it]));
295
- const order = []; const by = new Map();
296
- for (const e of win) { if (!by.has(e.id)) { by.set(e.id, []); order.push(e.id); } by.get(e.id).push(e); }
297
- return order.map((id) => {
298
- const es = by.get(id); const last = es[es.length - 1]; const a = Af.get(id); const b = B.get(id);
299
- const src = a || b || {};
300
- const base = { id, key: src.key || null, title: src.title || id, origin: src.origin || null, by: last.by || null, why: (es.slice().reverse().find((x) => x.why) || {}).why || '', at: last.at };
301
- if (!a) return { ...base, op: 'remove', tx: 'Removed' };
302
- if (!b) return { ...base, op: 'add', tx: '' };
303
- const t = [];
304
- if (b.start !== a.start && b.start && a.start) t.push('Start ' + dlab(b.start) + ' to ' + dlab(a.start));
305
- if (b.due !== a.due && b.due && a.due) t.push('Due ' + dlab(b.due) + ' to ' + dlab(a.due));
306
- if (depsStr(b.after) !== depsStr(a.after)) {
307
- const was = new Set(b.after || []); const add = (a.after || []).filter((d) => !was.has(d)); const gone = (b.after || []).filter((d) => !(a.after || []).includes(d));
308
- if (add.length) t.push('Waits on ' + add.map((d) => (Af.get(d) && Af.get(d).key) || d).join(', '));
309
- if (gone.length) t.push('No longer waits on ' + gone.map((d) => (B.get(d) && B.get(d).key) || d).join(', '));
310
- }
311
- if (b.owner !== a.owner) t.push('Owner ' + (b.owner || 'none') + ' to ' + (a.owner || 'none'));
312
- if (b.state !== a.state) t.push('Now ' + a.state);
313
- if (ptsOf(b) !== ptsOf(a)) t.push('Points ' + ptsOf(b) + ' to ' + ptsOf(a));
314
- if (b.title !== a.title) t.push('Renamed');
315
- return { ...base, op: 'edit', tx: t.join(', ') };
316
- });
317
- }
318
-
319
- /** checkFrames(events, checks, today) → [{ check, date, label, items, critical, forecast_end, promised, slip_days, points, problems, changes, events }]
320
- * Each frame is the whole plan as it stood at that check, planned with plan.js, so a replay redraws a Gantt per frame. promised: the due date of the
321
- * latest milestone (null when no item is a milestone); the forecast date is that milestone's forecast end, or the latest end when there is none. */
322
- function checkFrames(events, checks, today) {
323
- const out = []; let prev = null;
324
- checks.forEach((c, i) => {
325
- const items = stateAt(events, c.date);
326
- const asOf = c.date > today ? today : c.date;
327
- const f = frameForecast(items, asOf);
328
- const by = new Map(f.rows.map((r) => [r.id, r]));
329
- const crit = new Set(f.critical);
330
- const merged = items.map((it) => ({ ...it, forecast: by.get(it.id), critical: crit.has(it.id) }));
331
- const ms = items.filter((it) => it.ms && it.due).sort((x, y) => (x.due < y.due ? 1 : x.due > y.due ? -1 : 0))[0];
332
- const promised = ms ? ms.due : null;
333
- const fe = ms ? by.get(ms.id).end : f.forecast_end;
334
- const win = (events || []).filter((e) => !e.synthetic && String(e.at).slice(0, 10) <= c.date && (!prev || String(e.at).slice(0, 10) > prev.date));
335
- out.push({ check: i, date: c.date, label: c.label, items: merged, critical: f.critical, forecast_end: fe, promised, slip_days: promised && fe ? Math.round((day(fe) - day(promised)) / DAY) : 0,
336
- points: sumPts(items), problems: f.problems, changes: i === 0 ? null : whatChanged(prev.items, items, win), events: describeWindow(win, prev ? prev.items : [], items) });
337
- prev = { date: c.date, items };
338
- });
339
- return out;
340
- }
341
-
342
- module.exports = { describeWindow, frameForecast, whatChanged, pickChecks, checkFrames, timeline: V.timeline, forecast, criticalPath, stateAt, replay, capacityLoad, rebalanceProposal, weeksFrom, progressOf, graph };
@@ -1,175 +0,0 @@
1
- 'use strict';
2
- // console3 wave B4: the four report families, their section builders and the claims check. Pure: no I/O, no send.
3
- // Evidence labels (HANDOFF section 11): fact | cited | reported | estimate | assumption | judgement.
4
- const { whoHoldsWhat } = require('./truth-table');
5
- const TR = require('./derived/trust.js');
6
- const { CLAIM_RULES } = require('./derived/derive.js');
7
-
8
- // BACKED BY THE PM'S SAMPLE: the claims check is derived/trust.js checkReport() under the sample's rules (derive.CLAIM_RULES,
9
- // gen.js claim-rules.json): label, required fields, destination strictness, untrusted import, source exists, source current,
10
- // overdue assumption, and the omitted-tripped-signal rule. This file only maps a claim to the sample's shape.
11
- // REPO-WRITTEN, no sample equivalent: the four families and their variants, the section builders, and the send summary wording.
12
-
13
- const LABELS = ['fact', 'cited', 'reported', 'estimate', 'assumption', 'judgement'];
14
- const REQUIRED = Object.fromEntries(Object.entries(CLAIM_RULES.basis).map(([k, v]) => [k, v.needs.slice()])); // CHANGED to the sample: assumption needs review_by, judgement needs by
15
- const present = (v) => v !== undefined && v !== null && String(v).trim() !== '';
16
-
17
- // gate: 'block' = an unlabelled or incomplete claim blocks sending; 'strict' = block, and only fact and cited are allowed;
18
- // 'warn' = internal draft, the check warns and never blocks.
19
- const FAMILIES = [
20
- { id: 'project', name: 'Project', intent: 'Decide and unblock', purpose: 'Let the audience decide something or remove a blocker.',
21
- cadence: 'on demand, at each decision point',
22
- variants: [
23
- { id: 'leadership', name: 'Leadership', audience: 'Leadership', gate: 'block' },
24
- { id: 'engineering', name: 'Engineering', audience: 'Engineering', gate: 'warn' },
25
- { id: 'customer-success', name: 'Customer success', audience: 'Customer success', gate: 'strict', external: true },
26
- ],
27
- sections: ['headline', 'progress', 'risks', 'decisions_needed', 'blockers'] },
28
- { id: 'product', name: 'Product', intent: 'Align and invest', purpose: 'Align the audience on outcomes and where to invest.',
29
- cadence: 'per planning cycle',
30
- variants: [
31
- { id: 'executives', name: 'Executives', audience: 'Executives', gate: 'block' },
32
- { id: 'product-council', name: 'Product council', audience: 'Product council', gate: 'block' },
33
- { id: 'team', name: 'Team', audience: 'Team', gate: 'warn' },
34
- ],
35
- sections: ['outcomes', 'bets', 'tradeoffs', 'investment_asks'] },
36
- { id: 'communications', name: 'Communications', intent: 'Inform, enable, ask', purpose: 'Tell people what they need, give them what they need to act, and ask.',
37
- cadence: 'on demand',
38
- variants: [
39
- { id: 'message-queue', name: 'Message queue', audience: 'Per message', gate: 'warn' },
40
- { id: 'who-holds-what', name: 'Who holds what', audience: 'PM', gate: 'warn' },
41
- { id: 'external', name: 'External message', audience: 'External', gate: 'strict', external: true, needs_approval: true },
42
- ],
43
- sections: ['message_queue', 'who_holds_what', 'asks'], needs_approval_external: true },
44
- { id: 'periodic', name: 'Periodic', intent: 'Rhythm', purpose: 'Keep a steady rhythm; one template, with the change since last time.',
45
- cadence: 'weekly, monthly, quarterly, per retro',
46
- variants: [
47
- { id: 'weekly-digest', name: 'Weekly digest', audience: 'Team', gate: 'warn', cadence: 'weekly' },
48
- { id: 'monthly-review', name: 'Monthly review', audience: 'Leadership', gate: 'block', cadence: 'monthly' },
49
- { id: 'quarterly-board-update', name: 'Quarterly board update', audience: 'Board', gate: 'block', cadence: 'quarterly' },
50
- { id: 'retro', name: 'Retro', audience: 'Team', gate: 'warn', cadence: 'per retro' },
51
- ],
52
- sections: ['since_last_time', 'highlights', 'metrics', 'next'], template: 'same template; change since last time' },
53
- ];
54
-
55
- const familyOf = (id) => FAMILIES.find((f) => f.id === id) || null;
56
- const variantOf = (f, id) => (f && f.variants.find((v) => v.id === id)) || null;
57
-
58
- /* ── section builders: pure, over a facts object the caller supplies ─────────────────────────────────────────────── */
59
- // facts[<section>] is a list of items { id?, text, label, source, ...label fields, from_import?, stale? }.
60
- // A builder copies what is given. It never adds a claim and never fills in a label.
61
- const CLAIM_KEYS = ['id', 'text', 'label', 'source', 'by', 'at', 'method', 'range', 'owner', 'falsifier', 'review_date', 'author', 'from_import', 'stale'];
62
- const pick = (it) => { const c = {}; for (const k of CLAIM_KEYS) if (it[k] !== undefined) c[k] = it[k]; if (c.label === undefined) c.label = null; if (c.source === undefined) c.source = null; return c; };
63
- const fromList = (key, title) => (facts = {}) => ({ title, claims: (Array.isArray(facts[key]) ? facts[key] : []).filter((x) => x && typeof x === 'object' && x.text).map(pick) });
64
-
65
- // "Since last time": a claim for each id whose value differs between facts.previous and facts.current (both { id: { text, value, source } }).
66
- function sinceLastTime(facts = {}) {
67
- const prev = facts.previous || {}, cur = facts.current || {};
68
- const claims = [];
69
- for (const id of Object.keys(cur)) {
70
- const c = cur[id] || {};
71
- if (JSON.stringify(prev[id] && prev[id].value) === JSON.stringify(c.value)) continue;
72
- const was = prev[id] ? ` (was ${JSON.stringify(prev[id].value)})` : ' (new)';
73
- claims.push({ ...pick({ ...c, id, text: `${c.text || id}: ${JSON.stringify(c.value)}${was}` }), label: c.label === undefined ? null : c.label });
74
- }
75
- return { title: 'Since last time', claims };
76
- }
77
-
78
- function whoHoldsWhatSection(facts = {}) {
79
- const rows = whoHoldsWhat(facts.messages || [], facts.truth || {});
80
- const claims = [];
81
- for (const p of rows) for (const c of p.claims) {
82
- claims.push({ id: `${p.person}:${c.id}`, text: `${p.person} holds "${c.text || c.id}": ${c.state}`, label: 'fact', source: 'truth-table:' + c.id, stale: c.state === 'stale', contradicted: c.state === 'contradicted' });
83
- }
84
- return { title: 'Who holds what', claims };
85
- }
86
-
87
- const BUILDERS = {
88
- headline: fromList('headline', 'Headline'), progress: fromList('progress', 'Progress'), risks: fromList('risks', 'Risks'),
89
- decisions_needed: fromList('decisions_needed', 'Decisions needed'), blockers: fromList('blockers', 'Blockers'),
90
- outcomes: fromList('outcomes', 'Outcomes'), bets: fromList('bets', 'Bets'), tradeoffs: fromList('tradeoffs', 'Trade-offs'),
91
- investment_asks: fromList('investment_asks', 'Investment asks'),
92
- message_queue: fromList('message_queue', 'Message queue'), who_holds_what: whoHoldsWhatSection, asks: fromList('asks', 'Asks'),
93
- since_last_time: sinceLastTime, highlights: fromList('highlights', 'Highlights'), metrics: fromList('metrics', 'Metrics'), next: fromList('next', 'Next'),
94
- };
95
-
96
- function buildFamily(familyId, facts = {}) {
97
- const f = familyOf(familyId);
98
- if (!f) throw new Error('unknown family: ' + familyId);
99
- return f.sections.map((name) => ({ name, ...BUILDERS[name](facts) }));
100
- }
101
-
102
- /* ── the claims check ────────────────────────────────────────────────────────────────────────────────────────────── */
103
- // gate 'block' = leadership rules, 'strict' = customer rules, 'warn' = internal-draft rules.
104
- const DEST = { block: 'leadership', strict: 'customer', warn: 'internal-draft' };
105
-
106
- // A repo claim in the sample's shape. The older field names are still read: review_date for review_by, author for by.
107
- // A stale claim cites its source at revision 1 while the source is at revision 2, which is how the sample marks it stale.
108
- function toSample(c, opts) {
109
- const src = c && present(c.source) ? String(c.source) : '';
110
- const stale = !!(c && (c.stale || (opts.staleKeys || []).includes(src)));
111
- const absent = (opts.absentKeys || []).includes(src) || (Array.isArray(opts.knownKeys) && !opts.knownKeys.includes(src));
112
- const sc = c ? { id: c.id, basis: c.label || undefined, claim: c.text, by: c.by || c.author, at: c.at, method: c.method, range: c.range,
113
- owner: c.owner, falsifier: c.falsifier, review_by: c.review_by || c.review_date, covers: c.covers } : {};
114
- sc.source = c && c.from_import ? 'import:' + src : (stale && src && !absent ? src + '@1' : src);
115
- const docs = src && !absent ? { [src]: { rev: stale ? 2 : 1 } } : (src ? {} : { '': { rev: 0 } });
116
- return { sc, docs, stale, src, absent };
117
- }
118
- const ctxOf = (docs, opts) => ({ snaps: [], last: '', docs, now: opts.now || '0000-00-00', tripped: opts.tripped || [] });
119
-
120
- // opts: { gate, knownKeys?, absentKeys?, staleKeys?, now? }
121
- function checkClaim(c, opts = {}) {
122
- const gate = opts.gate || 'warn';
123
- const m = toSample(c, opts);
124
- const row = TR.checkReport({ sections: [m.sc] }, CLAIM_RULES, ctxOf(m.docs, opts), DEST[gate] || DEST.warn).rows[0];
125
- const why = row.verdict === 'ok' ? '' : row.why;
126
- const problems = !why ? [] : /^missing /.test(why) ? why.slice(8).split(', ').map((k) => 'missing ' + k) : [why];
127
- const fabricated = row.verdict === 'block' && /does not exist|no such check/.test(why);
128
- if (fabricated && m.src && !/not found/.test(why)) problems.push('source not found: ' + m.src);
129
- return { ok: row.verdict === 'ok', verdict: row.verdict, problems, fabricated, stale: m.stale && /is now rev/.test(why) };
130
- }
131
-
132
- function claimsCheck(sections = [], opts = {}) {
133
- return (sections || []).map((s) => {
134
- const out = { name: s.name || null, title: s.title || null, traced: 0, stale_source: 0, needs_input: 0, fabricated: 0, problems: [] };
135
- (s.claims || []).forEach((c, i) => {
136
- const r = checkClaim(c, opts);
137
- if (r.fabricated) out.fabricated++;
138
- if (r.ok) out.traced++;
139
- else if (r.stale && r.verdict === 'warn') out.stale_source++; // an internal draft only warns about a stale source
140
- else { out.needs_input++; out.problems.push({ index: i, text: (c && c.text) || null, problems: r.problems }); }
141
- });
142
- return out;
143
- });
144
- }
145
-
146
- // Whether sending is blocked, and why. A fabricated source always blocks. Otherwise the variant's gate decides.
147
- function sendCheck({ family, variant, sections, knownKeys, absentKeys, staleKeys, tripped, now } = {}) {
148
- const f = familyOf(family);
149
- if (!f) return { ok: false, error: 'unknown family' };
150
- const v = variantOf(f, variant) || f.variants[0];
151
- const opts = { gate: v.gate, knownKeys, absentKeys, staleKeys, now };
152
- const per = claimsCheck(sections, opts);
153
- // the sample's bad-news rule: a leadership or customer report must cover every tripped signal (a claim's `covers` list)
154
- let omitted = [];
155
- if (Array.isArray(tripped) && tripped.length) {
156
- const all = (sections || []).flatMap((s) => (s.claims || []).map((c) => toSample(c, opts)));
157
- const rows = TR.checkReport({ sections: all.map((m) => m.sc) }, CLAIM_RULES, ctxOf(Object.assign({}, ...all.map((m) => m.docs)), { ...opts, tripped }), DEST[v.gate]).rows;
158
- omitted = rows.filter((r) => r.id === 'omitted').map((r) => r.claim);
159
- }
160
- const fabricated = per.reduce((n, s) => n + s.fabricated, 0);
161
- const needs = per.reduce((n, s) => n + s.needs_input, 0);
162
- const reasons = [];
163
- if (fabricated) reasons.push(`${fabricated} claim${fabricated > 1 ? 's' : ''} cite a source that does not exist`);
164
- if (needs && v.gate !== 'warn') reasons.push(`${needs} claim${needs > 1 ? 's' : ''} need input before this ${v.name} report can be sent`);
165
- if (omitted.length) reasons.push(omitted[0]);
166
- const warnings = [];
167
- if (needs && v.gate === 'warn') warnings.push(`${needs} claim${needs > 1 ? 's' : ''} need input (internal draft: warning only)`);
168
- const stale = per.reduce((n, s) => n + s.stale_source, 0);
169
- if (stale) warnings.push(`${stale} claim${stale > 1 ? 's' : ''} rest on a stale source`);
170
- const approval = !!(v.needs_approval || v.external);
171
- if (approval) warnings.push('external message: needs the PM approval before it is sent');
172
- return { ok: true, family: f.id, variant: v.id, gate: v.gate, sections: per, blocked: reasons.length > 0, reasons, warnings, needs_approval: approval };
173
- }
174
-
175
- module.exports = { LABELS, REQUIRED, FAMILIES, BUILDERS, familyOf, variantOf, buildFamily, checkClaim, claimsCheck, sendCheck };
@@ -1,57 +0,0 @@
1
- 'use strict';
2
- // console3 wave B4: the who-holds-what truth table. Pure. No I/O, no send.
3
- // messages: [{ id?, to, at, claims: [{ id, text?, value? }] }] (what each person was told)
4
- // truth: { [claimId]: { value, text?, changed_at? } } (what is true now)
5
- // Only claims present in messages are listed. A claim is never invented.
6
- // State per told claim (the person's latest message on that claim):
7
- // contradicted the truth has a value and it differs from the value told
8
- // stale the truth changed after the message, or the truth for the claim is not known
9
- // in sync the truth holds the value told and has not changed since
10
- const V = require('./derived/derive.js');
11
- // BACKED BY THE PM'S SAMPLE: whoHoldsWhatFromPlan below is reader.js section 7 (derive.heldVsTrue): the truth is DERIVED from the
12
- // plan, 'ship-date' = the forecast and 'ticket:<id>' = that ticket's end, and a claim is in sync or N days apart.
13
- // REPO-WRITTEN, no sample equivalent: whoHoldsWhat, the generic claim table with the 'stale' state (truth changed after the send).
14
- const same = (a, b) => JSON.stringify(a === undefined ? null : a) === JSON.stringify(b === undefined ? null : b);
15
- const ts = (v) => { const t = Date.parse(v); return Number.isNaN(t) ? null : t; };
16
-
17
- function stateOf(told, at, now) {
18
- if (!now || typeof now !== 'object') return 'stale';
19
- if ('value' in now && told.value !== undefined && !same(told.value, now.value)) return 'contradicted';
20
- if (told.value === undefined && 'text' in now && told.text !== undefined && told.text !== now.text) return 'contradicted';
21
- const changed = ts(now.changed_at), sent = ts(at);
22
- if (changed !== null && (sent === null || changed > sent)) return 'stale';
23
- return 'in sync';
24
- }
25
-
26
- const RANK = { 'in sync': 0, stale: 1, contradicted: 2 };
27
-
28
- function whoHoldsWhat(messages = [], truth = {}) {
29
- const people = new Map();
30
- const list = (Array.isArray(messages) ? messages : []).slice().sort((a, b) => (ts(a && a.at) || 0) - (ts(b && b.at) || 0));
31
- for (const m of list) {
32
- if (!m || !m.to || !Array.isArray(m.claims)) continue;
33
- if (!people.has(m.to)) people.set(m.to, new Map());
34
- for (const c of m.claims) {
35
- if (!c || !c.id) continue;
36
- people.get(m.to).set(c.id, { ...c, at: m.at || null }); // the later message replaces the earlier one
37
- }
38
- }
39
- const t = truth && typeof truth === 'object' ? truth : {};
40
- return [...people.entries()].map(([person, held]) => {
41
- const claims = [...held.values()].map((c) => {
42
- const now = Object.prototype.hasOwnProperty.call(t, c.id) ? t[c.id] : null;
43
- return {
44
- id: c.id, text: c.text || null, told_at: c.at, told_value: c.value === undefined ? null : c.value,
45
- truth_value: now && 'value' in now ? now.value : null, state: stateOf(c, c.at, now),
46
- };
47
- });
48
- const worst = claims.reduce((w, c) => (RANK[c.state] > RANK[w] ? c.state : w), 'in sync');
49
- return { person, claims, state: worst };
50
- });
51
- }
52
-
53
- // messages: sent.jsonl records { to, claims: [{ subject, value }] }; pl: derived/plan.js plan(state, start).
54
- // Returns one row per told claim: { to, subject, told, true, gap, state } with state 'in sync' | '<n>d apart' | 'unknown'.
55
- const whoHoldsWhatFromPlan = (messages, pl) => V.heldVsTrue(Array.isArray(messages) ? messages : [], pl);
56
-
57
- module.exports = { whoHoldsWhatFromPlan, whoHoldsWhat, STATES: Object.keys(RANK) };