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,206 +0,0 @@
1
- /* pm/c3-dock.js — the console3 dock on /c3.html: the mockup's repository, branch and session tree (console3.html renderDock, line 1957).
2
- * Header: the repository select, the New session button (c3-new-session.js) and the fold button. Tree: one .br per working tree of the repository, its branch on
3
- * top and the sessions that run in that tree under it, each with a state glyph, a provider icon and a name. Below the tree: the
4
- * selected session's detail (what it is, where it runs, how long, the output tail, the Message box) and a scratchpad.
5
- * Real data only:
6
- * GET /api/git/worktrees?ws= the working trees and their branches (the tree is these, not every branch of the repository)
7
- * GET /api/sessions the sessions; one belongs to a tree through its `tree` path and to a repository through `ws`
8
- * GET /api/sessions/transcript the output tail, already stripped of terminal codes
9
- * GET /api/runs the needs-you count only (a run that asks, holds a permission or needs the terminal); the cards are on the Terminal page
10
- * GET and POST /api/scratchpad the session's pad
11
- * The Message box and Send type the message into the session and press Enter (c3-terminal-data.js send: the terminal's own socket). End asks first.
12
- * Icon language (c3-terminal-icons.js): the header's AGENT button (spark) opens the Terminal page, the full agent surfaces; the TERMINAL glyph (`>_`) is every "Open the session" link.
13
- * A folded dock leaves no rail (PM, 2026-10-12): Ctrl J and the More menu open it again. */
14
- import { el } from './dom.js';
15
- import { pmGet, pmPost } from './http.js';
16
- import { c3ic } from './pm-work-view.js';
17
- import { ic, TIPS } from './c3-terminal-icons.js';
18
- import { source, needsYou } from './c3-terminal-data.js';
19
- import { toast } from './c3-toast.js';
20
- import { button } from './primitives.js';
21
-
22
- /* a primitives button (keyboard, role) carrying the dock's own look and children */
23
- const c3btn = (attrs, onClick, ...kids) => { const b = button({ variant: 'ghost', attrs, onClick }); b.replaceChildren(...kids); return b; };
24
-
25
- /* the mockup's SM (line 1953): glyph and class by state. The server's `shown` words map onto them. */
26
- const SM = { working: ['●', 'w'], needs: ['◆', 'n'], quiet: ['◼', ''], blocked: ['◇', 'b'], exited: ['○', ''] };
27
- const smOf = (s) => SM[s.shown] || SM[s.state] || ['●', ''];
28
- const shownOf = (s, ended) => (ended && ended.has(s.id) ? 'exited' : s.shown);
29
- const PI = { claude: 'term', cloud: 'cloud', codex: 'bolt', shell: 'term', local: 'term' }; // spark is reserved for the agent surfaces
30
- const PN = { claude: 'Claude', cloud: 'Claude cloud', codex: 'Codex', shell: 'Shell', local: 'Local' };
31
- const NOEND = 'Ending a session needs the page route /api/session/remove, which did not answer. Use the terminal in the classic app (/classic.html).';
32
- const MAX_TREES = 10;
33
-
34
- const ago = (ms) => {
35
- if (!Number.isFinite(ms)) return null;
36
- const m = Math.max(0, Math.round(ms / 60000));
37
- return m < 1 ? 'just now' : m < 60 ? m + ' min' : m < 1440 ? Math.round(m / 60) + ' h' : Math.round(m / 1440) + ' d';
38
- };
39
- const clean = (t) => String(t || '').replace(/[\u0000-\u0008\u000b-\u001f\u007f]/g, '').replace(/[ \t]+$/gm, '');
40
- const tail = (t, n) => clean(t).split('\n').map((l) => l.trimEnd()).filter((l, i, a) => l.trim() || (a[i - 1] && a[i - 1].trim())).slice(-n).join('\n').slice(-900);
41
-
42
- export function createDock(opts) {
43
- const o = opts || {};
44
- const S = { ws: '', sessions: [], trees: null, sel: null, err: null, seq: 0, ended: new Set(), confirm: null, need: 0 };
45
- const sel = el('select', { 'aria-label': 'Repository', 'data-c3pg': 'ws-select' });
46
- const tree = el('div', { class: 'dk-tree', 'data-c3pg': 'dock-tree' });
47
- const detail = el('div', { class: 'dk-p', 'data-c3pg': 'dock-detail' });
48
- const body = el('div', { class: 'dk-body' }, tree, detail);
49
- /* the AGENT button: the full agent surfaces (the Terminal page), not a terminal. It carries the needs-you count; the header's button opens the same page. */
50
- const agentBdg = el('span', { class: 'bdg', hidden: true, 'data-c3pg': 'dock-agent-count' }, '0');
51
- const listBtn = el('button', { type: 'button', class: 'ib sm', title: TIPS.agentDock, 'aria-label': TIPS.agentDock, 'aria-haspopup': 'dialog', 'data-c3pg': 'dock-agent', style: 'position:relative',
52
- onclick: () => { import('./c3-terminal.js').then((m) => m.openTerminalPage()); } }, ic('bolt'), agentBdg);
53
- const side = el('aside', { class: 'c3dock dock', 'aria-label': 'Sessions', 'data-c3pg': 'dock' },
54
- el('div', { class: 'dk-h' }, c3ic('repo', 'sm'), sel,
55
- listBtn,
56
- c3btn({ class: 'ib sm', title: 'New session', 'aria-label': 'New session', 'data-c3pg': 'dock-new' }, () => newSession(), c3ic('plus', 'sm')),
57
- el('button', { type: 'button', class: 'ib sm', title: 'Fold the dock (Ctrl J)', 'aria-label': 'Fold the dock', onclick: () => o.setOpen && o.setOpen(false) }, c3ic('fold'))),
58
- body);
59
-
60
- const withEnd = (s) => (S.ended.has(s.id) ? { ...s, shown: 'exited', label: 'ended' } : s);
61
- const mine = () => S.sessions.filter((s) => s.ws === S.ws && !s.automatic).map(withEnd);
62
- const inTree = (dir) => mine().filter((s) => s.tree === dir).sort((a, b) => (a.shown === 'exited') - (b.shown === 'exited') || String(b.created).localeCompare(String(a.created)));
63
- /* a new session: the sheet asks name, agent and where it runs, starts it over the terminal connection and opens its terminal here (c3-new-session) */
64
- const newSession = (on) => import('./c3-new-session.js').then((m) => m.openNewSession({ ws: S.ws, boards: S.boards || [], trees: (S.trees || []).filter((t) => t.ws === S.ws || t.main), on,
65
- // a session started on another board: the dock moves to that board, so the new session is in the tree
66
- onStarted: (id, ws) => { if (ws && ws !== S.ws && S.boards && S.boards.some((w) => w.id === ws)) setWs(ws); S.sel = id; refresh(); } }));
67
- const pick = (id) => { S.sel = id; S.selTree = null; S.confirm = null; drawTree(); drawDetail(); if (o.setOpen) o.setOpen(true); };
68
-
69
- function row(s) {
70
- const g = smOf(s);
71
- return el('button', { type: 'button', class: 'sr', 'data-c3-sess': s.id, 'aria-current': String(s.id === S.sel), title: (PN[s.agent] || s.agent) + ' · ' + (s.label || s.shown), onclick: () => pick(s.id) },
72
- el('span', { class: 'mk ' + g[1] }, g[0]), c3ic(PI[s.agent] || 'term', 'sm'), el('span', { class: 'nm' }, s.name));
73
- }
74
- function drawTree() {
75
- if (S.err) { tree.replaceChildren(el('p', { class: 'dim mono', style: 'font-size:var(--fs-2);padding:4px', role: 'status' }, S.err)); return; }
76
- if (!S.trees) { tree.replaceChildren(el('p', { class: 'dim mono', style: 'font-size:var(--fs-2);padding:4px', role: 'status' }, 'Reading the repository')); return; }
77
- const all = S.trees.filter((t) => !t.missing && (t.ws === S.ws || t.main));
78
- const list = all.slice(0, MAX_TREES);
79
- const nodes = list.map((t) => {
80
- const ss = inTree(t.dir);
81
- const body = ss.length ? ss.slice(0, 4).map(row)
82
- : [t.main ? el('span', { class: 'dim mono', style: 'font-size:var(--fs-1);padding:2px 6px' }, 'no session')
83
- : c3btn({ class: 'chip2 lk', title: 'Start a session on this branch', 'data-c3pg': 'dock-new-here' }, () => newSession('ws:' + t.ws), c3ic('plus', 'sm'), 'session')];
84
- if (ss.length > 4) body.push(el('span', { class: 'dim mono', style: 'font-size:var(--fs-1);padding:2px 6px' }, '+' + (ss.length - 4) + ' more'));
85
- return el('div', { class: 'br', 'data-c3-tree': t.dir }, el('button', { type: 'button', class: 'bn', 'data-c3-branch': t.dir, 'aria-current': String(!!S.sel && ss.some((x) => x.id === S.sel)), title: ss.length ? 'Open the session on this branch' : 'This branch has no session', onclick: () => { if (ss[0]) pick((ss.find((x) => x.shown !== 'exited') || ss[0]).id); else { S.sel = null; S.selTree = t.dir; drawTree(); drawDetail(); } },
86
- style: 'border:0;background:none;text-align:left;width:100%;cursor:pointer' }, c3ic('branch', 'sm'), t.branch || '(detached)'), el('div', { class: 'ss' }, ...body));
87
- });
88
- // a session whose tree is not one of the listed ones still shows, under its own path
89
- const known = new Set(list.map((t) => t.dir));
90
- const stray = mine().filter((s) => !known.has(s.tree));
91
- if (stray.length) nodes.push(el('div', { class: 'br' }, el('div', { class: 'bn' }, c3ic('branch', 'sm'), 'other trees'), el('div', { class: 'ss' }, ...stray.slice(0, 4).map(row))));
92
- if (all.length > MAX_TREES) nodes.push(el('div', { class: 'dim mono dk-more' }, '+' + (all.length - MAX_TREES) + ' more branches in the classic app'));
93
- tree.replaceChildren(...(nodes.length ? nodes : [el('p', { class: 'dim mono', style: 'font-size:var(--fs-2);padding:4px' }, 'No working tree is registered for this repository.')]));
94
- }
95
-
96
- async function drawDetail() {
97
- const s = mine().find((x) => x.id === S.sel);
98
- if (!s) { const bt = S.selTree && S.trees && S.trees.find((x) => x.dir === S.selTree); detail.replaceChildren(el('p', { class: 'dim mono dk-empty', 'data-c3pg': 'dock-empty' }, bt ? (bt.branch || 'This branch') + ' has no session. Press + session to start one.' : mine().length ? 'Pick a session above.' : 'No session runs in this repository.')); return; }
99
- const t = S.trees && S.trees.find((x) => x.dir === s.tree);
100
- const started = ago(Date.now() - Date.parse(s.created));
101
- const last = Number.isFinite(s.lastOutputAt) ? ago(Date.now() - s.lastOutputAt) : null;
102
- const facts = [started, s.shown === 'working' ? null : (s.label || s.shown), last ? 'last output ' + last + ' ago' : null, s.model && s.model_line ? s.model_line : null].filter(Boolean).join(' · ');
103
- const term = el('div', { class: 'term', 'data-c3pg': 'dock-term', tabindex: '0', 'aria-label': 'Output tail' }, 'Reading the output');
104
- const pad = el('textarea', { 'aria-label': 'Scratchpad', style: 'width:100%;min-height:56px;margin-top:6px', 'data-c3pg': 'dock-pad' });
105
- const saveBtn = el('button', { type: 'button', class: 'ib sm', title: 'Save the scratchpad', 'aria-label': 'Save the scratchpad', onclick: async () => {
106
- const r = await pmPost('/api/scratchpad', { session: s.id, text: pad.value });
107
- saveBtn.title = r && r.ok ? 'Saved' : 'Not saved: ' + ((r && r.error) || 'unreadable');
108
- } }, c3ic('notes', 'sm'));
109
- const ended = s.shown === 'exited';
110
- const msg = el('input', { type: 'text', disabled: ended, placeholder: s.shown === 'needs' ? 'Your answer' : 'Message', 'aria-label': 'Message', title: 'Types this into the session and presses Enter', 'data-c3pg': 'dock-msg' });
111
- async function sendMsg() {
112
- const v = msg.value.trim(); if (!v) return;
113
- msg.value = '';
114
- const r = await source().send(s.id, { verb: 'free', text: v });
115
- if (r && r.ok) toast({ text: 'Sent to ' + s.name + '.' }); else msg.value = v;
116
- }
117
- msg.addEventListener('keydown', (e) => { if (e.key === 'Enter' && !e.isComposing) { e.preventDefault(); sendMsg(); } });
118
- detail.replaceChildren(...[
119
- el('div', { class: 'chips2' }, el('b', { style: 'font-size:var(--fs-3)' }, s.name), el('span', { class: 'chips2 dim mono', style: 'font-size:var(--fs-1)' }, c3ic(PI[s.agent] || 'term', 'sm'), (PN[s.agent] || s.agent) + ' · ' + ((t && t.branch) || 'no branch'))),
120
- el('div', { class: 'dim mono', style: 'font-size:var(--fs-1)' }, facts),
121
- s.shown === 'needs' ? el('div', { class: 'fold a' }, c3ic('alert', 'sm'), 'needs you') : null,
122
- el('a', { class: 'chip2 lk', href: '/classic.html', 'data-c3pg': 'dock-open-session', title: TIPS.terminalOpen, 'aria-label': 'Open the session ' + s.name,
123
- onclick: (e) => { if (e.metaKey || e.ctrlKey || e.shiftKey || e.button > 0) return; e.preventDefault(); import('./c3-session-term.js').then((m) => m.openSessionTerm({ id: s.id, name: s.name })); } }, ic('term', 'sm'), 'Open the session'),
124
- term,
125
- el('div', { class: 'form' },
126
- msg,
127
- c3btn({ class: 'ib pri sm', disabled: ended, title: 'Send: types this into the session and presses Enter', 'aria-label': 'Send', 'data-c3pg': 'dock-send' }, sendMsg, c3ic('out', 'sm')),
128
- s.shown === 'exited' ? null : el('button', { type: 'button', class: 'ib sm', title: 'End the session', 'aria-label': 'End the session', 'aria-expanded': String(S.confirm === s.id), 'data-c3pg': 'dock-end', onclick: () => { S.confirm = S.confirm === s.id ? null : s.id; drawDetail(); } }, c3ic('stop', 'sm'))),
129
- S.confirm === s.id ? el('div', { class: 'dk-confirm', role: 'group', 'aria-label': 'End this session?', 'data-c3pg': 'dock-confirm' }, el('span', { class: 'dim mono' }, 'End it? Any pending change stays a proposal.'),
130
- el('button', { type: 'button', class: 'chip2 lk', 'data-c3pg': 'dock-end-yes', onclick: () => endSession(s) }, c3ic('stop', 'sm'), 'End'),
131
- el('button', { type: 'button', class: 'chip2 lk', onclick: () => { S.confirm = null; drawDetail(); } }, 'Keep it')) : null,
132
- s.shown === 'exited' ? el('div', { class: 'chips2' }, el('span', { class: 'dim mono', style: 'font-size:var(--fs-2)' }, 'ended')) : null,
133
- el('details', null, el('summary', { class: 'chips2 dim', style: 'cursor:pointer;font-size:var(--fs-2)' }, c3ic('notes', 'sm'), 'scratchpad'), pad, saveBtn)].filter(Boolean));
134
- const [tr, sp] = await Promise.all([pmGet('/api/sessions/transcript?id=' + encodeURIComponent(s.id) + '&max=2400'), pmGet('/api/scratchpad?session=' + encodeURIComponent(s.id))]);
135
- if (S.sel !== s.id) return;
136
- const txt = tr && tr.ok ? tail(tr.text, 10) : '';
137
- term.textContent = txt || (tr && tr.ok ? 'No output yet.' : 'The output could not be read.');
138
- if (sp && sp.ok && typeof sp.text === 'string') pad.value = sp.text;
139
- }
140
-
141
- /* End: the page's own route POST /api/session/remove (it ends the process and removes the session). In demo the write is answered locally and the session is only marked ended. */
142
- async function endSession(s) {
143
- S.confirm = null;
144
- const r = await pmPost('/api/session/remove', { id: s.id });
145
- if (r && r.ok) { S.ended.add(s.id); toast({ text: r.removed === false ? 'Asked it to end. Press End again to remove it.' : 'Ended. Any pending change stays a proposal.', timeout: 4200 }); }
146
- else toast({ text: (r && r.error) ? 'Not ended: ' + r.error : NOEND, tone: 'error' });
147
- drawTree(); drawDetail(); refresh();
148
- }
149
-
150
-
151
- /* A folded dock reads only the runs, for the needs-you count on the header's agent button; the sessions, the working trees and the
152
- * selected session's output are read when the dock is open (c3-desktop-light-load). Opening it calls refresh() again. */
153
- async function refresh() {
154
- const seq = ++S.seq; const ws = S.ws;
155
- if (side.hidden) {
156
- const rn = await source().getRuns().catch(() => null);
157
- if (seq !== S.seq) return;
158
- S.need = needsYou(rn); agentBdg.textContent = String(S.need); agentBdg.hidden = !S.need;
159
- if (o.onCount) o.onCount(null, S.need);
160
- return;
161
- }
162
- const [ss, wt, rn] = await Promise.all([pmGet('/api/sessions'), ws ? pmGet('/api/git/worktrees?ws=' + encodeURIComponent(ws)) : Promise.resolve(null), source().getRuns().catch(() => null)]);
163
- if (seq !== S.seq) return;
164
- S.need = needsYou(rn); agentBdg.textContent = String(S.need); agentBdg.hidden = !S.need;
165
- if (ss && Array.isArray(ss.sessions)) S.sessions = ss.sessions; else S.err = 'The sessions could not be read.';
166
- if (wt && wt.ok) { S.trees = wt.worktrees || []; S.err = null; } else if (!S.trees) S.trees = [];
167
- const m = mine();
168
- if (!m.some((x) => x.id === S.sel)) S.sel = (m.find((x) => x.shown !== 'exited') || m[0] || {}).id || null;
169
- drawTree();
170
- const cur = detail.getAttribute('data-sel');
171
- if (cur !== String(S.sel)) { detail.setAttribute('data-sel', String(S.sel)); drawDetail(); }
172
- if (o.onCount) { const all = S.sessions.filter((x) => !x.automatic); o.onCount(all.filter((x) => x.shown === 'working').length, S.need); }
173
- }
174
-
175
- /* the mockup's keys: Ctrl or Cmd J folds and opens the dock (title "Open sessions (Ctrl J)"); the arrows move along the tree */
176
- const onKey = (e) => {
177
- if ((e.ctrlKey || e.metaKey) && !e.altKey && !e.shiftKey && (e.key === 'j' || e.key === 'J')) {
178
- if (!side.isConnected) return;
179
- e.preventDefault(); if (o.setOpen) o.setOpen(side.hidden); return;
180
- }
181
- if ((e.key === 'ArrowDown' || e.key === 'ArrowUp') && e.target.closest && e.target.closest('.dk-tree')) {
182
- const items = [...tree.querySelectorAll('button.sr,button.bn')]; const i = items.indexOf(e.target.closest('button'));
183
- if (i >= 0) { e.preventDefault(); const n = items[i + (e.key === 'ArrowDown' ? 1 : -1)]; if (n) n.focus(); }
184
- }
185
- };
186
- function setWs(ws) {
187
- S.ws = ws; S.trees = null; S.sel = null; sel.value = ws; detail.removeAttribute('data-sel');
188
- if (o.onWs) o.onWs(S.ws);
189
- drawTree(); refresh();
190
- }
191
- let timer = null;
192
- const api = {
193
- side,
194
- setWorkspaces(list, ws) {
195
- S.ws = ws;
196
- S.boards = list.length ? list : [{ id: ws, name: ws || 'workspace' }];
197
- sel.replaceChildren(...S.boards.map((w) => el('option', { value: w.id, selected: w.id === ws }, w.name || w.id)));
198
- sel.onchange = (e) => setWs(e.target.value);
199
- },
200
- start() { document.addEventListener('keydown', onKey); drawTree(); refresh(); timer = setInterval(refresh, 15000); if (source().subscribe) S.unsub = source().subscribe(refresh); },
201
- stop() { if (timer) clearInterval(timer); if (S.unsub) S.unsub(); document.removeEventListener('keydown', onKey); },
202
- refresh,
203
- newSession,
204
- };
205
- return api;
206
- }
@@ -1,291 +0,0 @@
1
- /* pm/c3-docs.js — the Documents sub-view of Initiatives on /c3.html (console3.html: IDOCS and dcRow at lines 3652 to 3665 and 3790, docHealthCard 4105,
2
- * the coverage matrix at 3849, the List and Graph toggle dvToggle 4191, the graph graphSVG and relHtml at 4160 to 4190).
3
- * REAL: GET /api/docs/library (the repository's documents: files { path, title, category, date, initiative }, edges [from, to, kind] and the kinds) and
4
- * POST /api/doc-health/check { ws, path } (the six health checks, recomputed from the text: { health: { passed, total, checks } }, read-only).
5
- * - A real document's state is derived from its date only: Current, or Stale when it has not changed for 30 days. Draft and Missing need a record of
6
- * what a lane requires, which the library does not carry, so they are not shown for real documents.
7
- * - A real edge has no sync state; the page marks an edge "out of sync" when its source changed after the document it feeds (dates from the library)
8
- * for the link, cites and anchor kinds, and "in sync" otherwise. No edge is marked conflict or missing from real data.
9
- * - Health is asked for the first eight documents shown, one at a time, and is drawn as "N of M checks" on the row and in the health card.
10
- * DEMO ONLY (optional fields the real library does not carry): per file ty, v, st, why, by, up, node (Goal, Decision, Data, Tickets) and col; a 4th
11
- * edge element (state); the response's `cards` (Benchmark, Research themes). The 14 documents, the graph and the cards are the mockup's own.
12
- * ROW AND SHEET: a row opens its case file in place and swipes (right: ask the agent for the update, left: later); its Open chip opens the document sheet (c3-doc-sheet.js:
13
- * Read, Edit by hand with a why, Ask the agent, History, Health, Relations). The list itself writes nothing; an edit is written by the sheet through POST /api/doc-sheet/edit. */
14
- import { el } from './dom.js';
15
- import { pmGet, pmPost } from './http.js';
16
- import { c3ic, c3ring } from './pm-work-view.js';
17
- import { makeView, frame, hBars, card, emptyRow, dayLabel, short, rowShell, caseNode, markDone, say } from './c3-init-extras.js';
18
- import { openDocSheet } from './c3-doc-sheet.js';
19
-
20
- const NS = 'http://www.w3.org/2000/svg';
21
- const sv = (tag, a, ...kids) => { const n = document.createElementNS(NS, tag); for (const k of Object.keys(a || {})) if (a[k] != null) n.setAttribute(k, a[k]); for (const c of kids) if (c) n.appendChild(c); return n; };
22
- const svt = (x, y, t, a) => { const n = sv('text', { x, y, ...(a || {}) }); n.textContent = t; return n; };
23
-
24
- const DST = { current: ['Current', 'var(--success)', 'check'], stale: ['Stale', 'var(--warning)', 'alert'], draft: ['Draft', 'var(--acc)', 'clock'], missing: ['Missing', 'var(--destructive)', 'plus'] };
25
- const DTI = { PRD: 'doc', Rubric: 'scale', Research: 'notes', Benchmark: 'report', Design: 'img', Brief: 'flag', Specs: 'doc', Evals: 'scale', Decisions: 'scale', Explainers: 'info', Prototypes: 'img' };
26
- const COLS = [['Spec', ['PRD', 'Brief', 'Spec']], ['Rubric', ['Rubric']], ['Research', ['Research']], ['Benchmark', ['Benchmark']], ['Design', ['Design']]];
27
- const ESTATE = { ok: ['in sync', 'var(--ring)'], drift: ['out of sync', 'var(--warning)'], conflict: ['conflict', 'var(--destructive)'], missing: ['missing', 'var(--muted-foreground)'] };
28
- const REAL_TYPE = { spec: 'Spec', eval: 'Rubric', res: 'Research', proto: 'Design' }; // the library's categories that are the mockup's document types
29
- const REAL_COL = { dec: 0, guide: 0, know: 0, res: 1, spec: 2, ini: 2, eval: 3, proto: 3, exp: 3 };
30
- const STALE_DAYS = 30;
31
- const hcol = (h) => (h.total === 0 ? 'var(--muted-foreground)' : h.passed === h.total ? 'var(--success)' : h.total - h.passed === 1 ? 'var(--warning)' : 'var(--destructive)');
32
- const dayNum = (iso) => Math.round(Date.parse(String(iso).slice(0, 10) + 'T00:00:00Z') / 86400000);
33
- const todayIso = () => { const d = new Date(); return d.getFullYear() + '-' + String(d.getMonth() + 1).padStart(2, '0') + '-' + String(d.getDate()).padStart(2, '0'); };
34
-
35
- /** The documents of a library response in the page's own shape. */
36
- export function docsOf(lib, today) {
37
- if (!lib || !lib.files) return [];
38
- const catName = Object.fromEntries((lib.categories || []).map((c) => [c.key, c.name]));
39
- return lib.files.map((f, i) => {
40
- const real = !f.st;
41
- const age = real && f.date && today ? dayNum(today) - dayNum(f.date) : 0;
42
- return { i, path: f.path, name: f.title || f.path, ty: f.ty || REAL_TYPE[f.category] || catName[f.category] || f.category, cat: f.category, node: f.node || null,
43
- col: f.col != null ? f.col : (REAL_COL[f.category] != null ? REAL_COL[f.category] : 3), ini: f.initiative || '', v: f.v || '', up: f.up || (f.date ? dayLabel(f.date) : ''), date: f.date || '',
44
- st: f.st || (age > STALE_DAYS ? 'stale' : 'current'), why: f.why || '', real };
45
- });
46
- }
47
- const isDoc = (d) => !d.node;
48
- const needs = (d) => d.st === 'stale' || d.st === 'missing';
49
- /** The count on the Documents button: documents that need attention. A real document counts only when it is stale and its initiative is in Now. */
50
- export async function badge(ctx) {
51
- const lib = await pmGet('/api/docs/library' + (ctx && ctx.ws ? '?ws=' + encodeURIComponent(ctx.ws) : ''));
52
- if (!lib || !lib.ok) return null;
53
- const now = new Set(((ctx && ctx.rows) || []).filter((r) => r.horizon === 'now').map((r) => r.id));
54
- return docsOf(lib, todayIso()).filter((d) => isDoc(d) && d.ini && needs(d) && (!d.real || now.has(d.ini))).length;
55
- }
56
-
57
- /** The document sheet for a document (the Open chip, the Documents graph, a related document). `ask` opens it on Ask the agent with that request. */
58
- function openDoc(V, d, ask) {
59
- if (!d || d.st === 'missing' || d.node) return;
60
- const ui = openDocSheet({ ws: V.ctx.ws, doc: { path: d.path, name: d.name, ty: d.ty, v: d.v, st: d.st, ini: d.ini, iniName: iniName(V, d.ini) }, mode: ask ? 'ask' : 'read', prompt: ask || '',
61
- relations: (doc, openOther) => relationsOf(V, d, openOther), library: () => V.lib, openGraph: () => { V.view = 'graph'; V.sel = d.i; V.render(); },
62
- onChanged: () => { delete V.health[d.path]; V.asking = false; load(V); } });
63
- ui.setOpener((o) => openDoc(V, o));
64
- }
65
- const iniName = (V, id) => { const i = V.lib && V.lib.initiatives && V.lib.initiatives[id]; return i ? i.short || i.title : id || ''; };
66
-
67
- /** The first thing to ask the agent about a document: the first failing check's own request, else a plain one. */
68
- function askFor(V, d) {
69
- const h = V.health[d.path]; const c = h && h.checks && h.checks.find((x) => x.pass === false && x.fix);
70
- return c ? c.fix : d.st === 'draft' ? 'Finish the draft: fill the missing sections' : 'Update this document so it matches the current plan';
71
- }
72
-
73
- /** The case file of a document (console3.html genDoc, line 3787). "Have the agent draft the update" opens the sheet on Ask the agent: the agent proposes, the slide that accepts is in the sheet. */
74
- function caseOf(V, d) {
75
- const chg = [['doc', d.ty + (d.v ? ' ' + d.v : ''), 'version']];
76
- if (d.why) chg.push(['info', d.why, 'agent']);
77
- else if (d.st === 'stale') chg.push(['clock', 'Not changed for more than ' + STALE_DAYS + ' days', 'git']);
78
- if (d.up) chg.push(['clock', 'Updated ' + d.up, '']);
79
- const h = V.health[d.path]; if (h && h.total) chg.push([h.passed === h.total ? 'check' : 'alert', h.passed + ' of ' + h.total + ' health checks pass', 'health', h.passed === h.total ? 'ok' : 'warn']);
80
- const opts = [];
81
- if (d.st === 'stale' || d.st === 'missing' || d.st === 'draft') opts.push({ id: 'dr', l: d.st === 'draft' ? 'Review the agent draft' : 'Have the agent draft ' + (d.st === 'missing' ? 'it' : 'the update'), rec: 1, fx: [['check', 'You approve before anything is shared', 'ok'], ['lock', d.st === 'missing' ? 'Nothing is written until you accept' : 'Opens the document on Ask the agent', '']] });
82
- opts.push({ id: 'lt', l: 'Later', fx: [] });
83
- const sit = d.st === 'stale' ? 'This document no longer matches the plan. People may be reading an old version.' : d.st === 'missing' ? 'The initiative has no ' + String(d.ty).toLowerCase() + '. ' + (d.ty === 'Benchmark' ? 'It is optional but cheap.' : 'The gate needs it.') : d.why || (d.name + ' is ' + d.st + (d.up ? ', last changed ' + d.up : '') + '.');
84
- return caseNode(V, 'doc:' + d.path, { sit, conf: d.st === 'current' ? 90 : 78, chg, opts, cta: 'Slide to confirm', go: d.st !== 'missing' ? ['open', d.path, 'Open the document'] : null }, {
85
- onGo: () => openDoc(V, d),
86
- onConfirm: (o) => {
87
- if (o.id === 'lt') { markDone(V, 'doc:' + d.path, 'Parked for this week.'); return; }
88
- if (d.st === 'missing') { markDone(V, 'doc:' + d.path, 'Draft started. It lands in Review as a diff you approve.'); return; }
89
- openDoc(V, d, askFor(V, d));
90
- } });
91
- }
92
-
93
- function docRow(V, d) {
94
- const S = DST[d.st] || DST.current; const h = V.health[d.path];
95
- const ini = V.lib.initiatives && V.lib.initiatives[d.ini];
96
- /* the swipe (console3.html line 3881): right asks the agent for the update, left leaves it for later */
97
- const sw = { labelRight: d.st === 'current' ? 'already current' : 'have the agent draft the update', labelLeft: 'later', iconRight: 'spark', iconLeft: 'moon',
98
- onRight: () => { if (d.st === 'current' || d.st === 'missing') { say(d.st === 'current' ? 'Already current' : 'Open its case to start the draft'); return; } say('Opened on Ask the agent. The draft is a proposal you accept.'); openDoc(V, d, askFor(V, d)); },
99
- onLeft: () => say('Later') };
100
- return rowShell(V, { key: 'doc:' + d.path, attrs: { 'data-in-doc': d.path, 'data-id': d.path, 'data-dc': '1' }, icon: DTI[d.ty] || 'doc', iconColor: S[1], title: d.name, sw, xpContent: caseOf(V, d),
101
- chips: [el('span', { class: 'chip2', style: 'color:' + S[1] }, c3ic(S[2], 'sm'), S[0]),
102
- el('span', { class: 'chip2' }, d.ty),
103
- d.v ? el('span', { class: 'chip2 mono' }, d.v) : null,
104
- h && h.total ? el('span', { class: 'chip2', style: 'color:' + hcol(h), 'data-in-health': d.path }, c3ic('shield', 'sm'), h.passed + ' of ' + h.total + ' checks') : null,
105
- d.up ? el('span', { class: 'chip2' }, c3ic('clock', 'sm'), d.up) : null,
106
- ini ? el('span', { class: 'tag' }, V.lib.initiatives[d.ini].short || short(ini.title, 24)) : d.ini ? el('span', { class: 'tag' }, d.ini) : null,
107
- d.st !== 'missing' ? el('button', { type: 'button', class: 'chip2 lk', 'data-doc-open': d.path, onclick: () => openDoc(V, d) }, c3ic('doc', 'sm'), 'Open') : null] });
108
- }
109
-
110
- /* ── health: asked per document, one at a time ─────────────────────────────────────────────────────────────── */
111
- function askHealth(V, docs) {
112
- const todo = docs.filter((d) => !V.health[d.path] && !d.node && d.st !== 'missing').slice(0, docs.some((d) => !d.real) ? 14 : 8);
113
- if (V.asking || !todo.length) return;
114
- V.asking = true;
115
- (async () => {
116
- for (const d of todo) {
117
- if (V.disposed) return;
118
- const r = await pmPost('/api/doc-health/check', { ws: V.ctx.ws, path: d.path });
119
- V.health[d.path] = r && r.ok && r.health ? { passed: r.health.passed, total: r.health.total, checks: r.health.checks } : { passed: 0, total: 0, checks: [], err: true };
120
- V.render();
121
- }
122
- V.asking = false;
123
- })();
124
- }
125
-
126
- function healthCard(V, docs) {
127
- const hs = docs.map((d) => [d, V.health[d.path]]).filter(([, h]) => h && h.total);
128
- if (!hs.length) return card('shield', 'Document health', 'can I trust it without rereading', el('p', { class: 'dim', style: 'font-size:var(--fs-2);margin:0', role: 'status' }, V.asking ? 'Checking the documents.' : 'No document has been checked yet.'));
129
- const good = hs.filter(([, h]) => h.passed === h.total).length;
130
- hs.sort((a, b) => a[1].passed / a[1].total - b[1].passed / b[1].total);
131
- return card('shield', 'Document health', 'can I trust it without rereading',
132
- el('div', { class: 'chips2' }, el('span', { style: 'display:inline-flex' }, c3ring(good, Math.max(1, hs.length), 44)), el('span', { class: 'dim', style: 'font-size:var(--fs-2)' }, good + ' of ' + hs.length + ' pass every check: fresh, matches decisions and data, complete, traced, readers current')),
133
- hBars(hs.slice(0, 5).map(([d, h]) => [short(d.name, 28), h.passed / h.total, hcol(h), h.passed + ' of ' + h.total])));
134
- }
135
-
136
- function coverageCard(V, docs) {
137
- const rows = (V.scope ? V.ctx.rows.filter((r) => r.id === V.scope) : V.ctx.rows).slice(0, 5);
138
- if (!rows.length) return null;
139
- const used = COLS.filter((c, ci) => ci < 2 || ci === 2 || docs.some((d) => c[1].includes(d.ty)));
140
- const cell = (r, c, ci) => {
141
- const L = docs.filter((d) => d.ini === r.id && c[1].includes(d.ty)); const req = ci < (r.lane === 'feature' ? 2 : 1);
142
- const k = !L.length ? (req ? 'x' : 'o') : L.some((d) => d.st === 'current') ? '' : L.some((d) => d.st === 'stale' || d.st === 'draft') ? 'w' : (req ? 'x' : 'o');
143
- return el('span', { class: 'c' }, el('i', { class: k }));
144
- };
145
- return card('shield', 'Coverage', 'features need spec and rubric first',
146
- el('div', { class: 'dxm' + (used.length === 4 ? ' c4' : ''), 'data-in-coverage': '' }, el('span'), ...used.map((c) => el('span', { class: 'h' }, c[0].slice(0, 5))),
147
- ...rows.flatMap((r) => [el('span', null, short(r.title, 18) + ' ', el('span', { class: 'dim' }, r.lane || '')), ...used.map((c) => cell(r, c, COLS.indexOf(c)))])),
148
- el('div', { class: 'pgl' }, el('span', { style: 'color:var(--success)' }, '● current'), el('span', { style: 'color:var(--warning)' }, '◯ stale or draft'), el('span', null, '◌ none'), el('span', { style: 'color:var(--destructive)' }, '● required, missing')));
149
- }
150
-
151
- /* ── the graph ─────────────────────────────────────────────────────────────────────────────────────────────── */
152
- function edgesOf(lib, docs) {
153
- const byIdx = new Map(docs.map((d) => [d.i, d]));
154
- const edges = (lib.edges || []).map(([a, b, k, st]) => ({ a, b, k: lib.kinds[k] || String(k), st })).filter((e) => byIdx.has(e.a) && byIdx.has(e.b) && e.a !== e.b);
155
- for (const e of edges) {
156
- if (e.st) continue;
157
- const A = byIdx.get(e.a); const B = byIdx.get(e.b);
158
- e.st = ['link', 'cites', 'anchor'].includes(e.k) && A.date && B.date && A.date > B.date ? 'drift' : 'ok';
159
- }
160
- return edges;
161
- }
162
- function graphModel(V, docs) {
163
- const lib = V.lib; const byIdx = new Map(docs.map((d) => [d.i, d]));
164
- const edges = edgesOf(lib, docs);
165
- const deg = new Map(); edges.forEach((e) => { deg.set(e.a, (deg.get(e.a) || 0) + 1); deg.set(e.b, (deg.get(e.b) || 0) + 1); });
166
- const keep = new Set();
167
- if (V.scope) docs.forEach((d) => { if (d.ini === V.scope) keep.add(d.i); });
168
- else if (docs.some((d) => d.node)) docs.forEach((d) => keep.add(d.i));
169
- else [...deg.entries()].filter(([i]) => byIdx.get(i).ini && byIdx.get(i).ini !== 'README').sort((x, y) => y[1] - x[1]).slice(0, 16).forEach(([i]) => keep.add(i));
170
- edges.forEach((e) => { if (keep.has(e.a) && keep.size < 26) keep.add(e.b); if (keep.has(e.b) && keep.size < 26) keep.add(e.a); });
171
- const nodes = [...keep].map((i) => byIdx.get(i)).filter(Boolean).slice(0, 26);
172
- const ids = new Set(nodes.map((n) => n.i));
173
- return { nodes, edges: edges.filter((e) => ids.has(e.a) && ids.has(e.b)) };
174
- }
175
- function downstream(edges, id) {
176
- const seen = new Set(); const q = [id]; const out = [];
177
- while (q.length) { const x = q.shift(); edges.forEach((e) => { if (e.a === x && !seen.has(e.b) && e.st !== 'conflict') { seen.add(e.b); out.push(e.b); q.push(e.b); } }); }
178
- return out;
179
- }
180
- function graphSvg(V, G) {
181
- const CW = 152; const NW = 124; const NH = 50; const top = 26; const cols = [[], [], [], [], []]; const sel = V.sel;
182
- G.nodes.forEach((n) => cols[Math.min(4, Math.max(0, n.col))].push(n));
183
- cols.forEach((c) => c.sort((a, b) => (a.ini || '').localeCompare(b.ini || '') || a.name.localeCompare(b.name)));
184
- const mx = Math.max(1, ...cols.map((c) => c.length)); const H = top + mx * (NH + 10) + 10; const W = 760; const pos = {};
185
- cols.forEach((c, ci) => { const gap = (H - top - 10) / Math.max(1, c.length); c.forEach((n, i) => { pos[n.i] = { x: 8 + ci * CW, y: top + i * gap + (gap - NH) / 2 }; }); });
186
- const nb = new Set([sel]); G.edges.forEach((e) => { if (e.a === sel) nb.add(e.b); if (e.b === sel) nb.add(e.a); });
187
- const s = sv('svg', { class: 'pg', viewBox: `0 0 ${W} ${H}`, role: 'img', 'aria-label': 'Document relationship graph. Amber lines are out of sync, red lines conflict.', style: 'width:100%;min-width:760px;height:auto;display:block' });
188
- ['Goals and sources', 'Evidence', 'Specs', 'Rubric and design', 'Delivery'].forEach((t, i) => s.append(svt(8 + i * CW, 14, t)));
189
- G.edges.forEach((e) => {
190
- const p = pos[e.a]; const q = pos[e.b]; if (!p || !q) return;
191
- const c = ESTATE[e.st][1]; const x1 = p.x + NW; const y1 = p.y + NH / 2; const x2 = q.x; const y2 = q.y + NH / 2; const m = (x1 + x2) / 2; const on = e.a === sel || e.b === sel; const op = on || sel == null ? 1 : .25;
192
- s.append(sv('path', { d: `M${x1} ${y1} C${m} ${y1} ${m} ${y2} ${x2} ${y2}`, fill: 'none', stroke: c, 'stroke-width': on ? 2.5 : 1.4, opacity: op, 'stroke-dasharray': e.st === 'missing' ? '4 3' : null }), sv('path', { d: `M${x2} ${y2} l-6 -3.5 v7z`, fill: c, opacity: op }));
193
- if (on) s.append(svt(m, (y1 + y2) / 2 - 5, e.k, { 'text-anchor': 'middle', style: 'fill:' + c }));
194
- });
195
- G.nodes.forEach((n) => {
196
- const p = pos[n.i]; const c = n.node ? 'var(--muted-foreground)' : (DST[n.st] || DST.current)[1]; const on = n.i === sel;
197
- const g = sv('g', { tabindex: '0', role: 'button', 'aria-label': 'Show the relations of ' + n.name, 'data-in-node': n.i, style: 'cursor:pointer', opacity: nb.has(n.i) || sel == null ? 1 : .35 },
198
- sv('rect', { x: p.x, y: p.y, width: NW, height: NH, rx: 8, fill: 'var(--card)', stroke: c, 'stroke-width': on ? 3 : 1.5, 'stroke-dasharray': n.st === 'missing' ? '4 3' : null }),
199
- svt(p.x + 8, p.y + 19, (n.node || n.ty) + (n.v ? ' ' + n.v : ''), { style: 'font-size:var(--fs-1);fill:var(--muted-foreground)' }), svt(p.x + 8, p.y + 37, short(n.name, 17), { class: 't' }));
200
- const pick = () => { V.sel = n.i; V.render(); };
201
- g.addEventListener('click', pick); g.addEventListener('keydown', (e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); pick(); } });
202
- s.append(g);
203
- });
204
- return s;
205
- }
206
- /** The Relations of a document (the sheet's sixth mode): every edge that touches it, from the whole library, not the graph's capped node set. */
207
- function relationsOf(V, d, openOther) {
208
- const docs = V.docs; const G = { nodes: docs, edges: edgesOf(V.lib, docs) };
209
- return relations(d.i, G, docs, openOther);
210
- }
211
- function relations(sel, G, docs, openOther) {
212
- const n = docs.find((d) => d.i === sel);
213
- if (!n) return el('p', { class: 'dim', style: 'font-size:var(--fs-2);margin:0' }, 'Pick a node to see what feeds it and what it feeds.');
214
- const by = new Map(docs.map((d) => [d.i, d]));
215
- const inn = G.edges.filter((e) => e.b === n.i); const out = G.edges.filter((e) => e.a === n.i); const dn = downstream(G.edges, n.i); const dr = out.filter((e) => e.st === 'drift');
216
- const line = (e, dir) => { const o = by.get(dir === 'in' ? e.a : e.b); const E = ESTATE[e.st];
217
- return el('li', { class: e.st === 'ok' ? 'ok' : e.st === 'missing' ? '' : 'bad' }, c3ic(e.st === 'ok' ? 'check' : 'alert', 'sm'), el('span', null, o.name + ' · ', el('b', null, e.k), ' · ' + E[0] + ' ',
218
- openOther && !o.node && o.st !== 'missing' ? el('button', { type: 'button', class: 'chip2 lk', 'data-doc-rel-open': o.path, onclick: () => openOther(o) }, c3ic('doc', 'sm'), 'Open') : null)); };
219
- return el('div', { class: 'dpn' },
220
- el('div', { class: 'chips2' }, el('b', null, n.name), el('span', { class: 'chip2' }, n.node || n.ty)),
221
- inn.length ? el('div', null, el('div', { class: 'dim', style: 'font-size:var(--fs-2)' }, 'Comes from'), el('ul', { class: 'chgl' }, inn.map((e) => line(e, 'in')))) : null,
222
- out.length ? el('div', null, el('div', { class: 'dim', style: 'font-size:var(--fs-2)' }, 'Feeds'), el('ul', { class: 'chgl' }, out.map((e) => line(e, 'out')))) : null,
223
- el('div', { class: 'chips2', 'data-in-impact': '' }, el('span', { class: 'ki', style: 'color:' + (dr.length ? 'var(--warning)' : 'var(--success)') }, c3ic(dr.length ? 'alert' : 'check')),
224
- el('span', { style: 'font-size:var(--fs-3)' }, 'If you change this, ', el('b', null, String(dn.length)), ' item' + (dn.length === 1 ? '' : 's') + ' downstream are affected' + (dr.length ? ', ' + dr.length + ' already out of sync' : '') + '.')));
225
- }
226
- function graphCards(V, docs) {
227
- const G = graphModel(V, docs);
228
- if (V.sel == null || !G.nodes.some((n) => n.i === V.sel)) { const hub = [...G.nodes].sort((a, b) => G.edges.filter((e) => e.a === b.i || e.b === b.i).length - G.edges.filter((e) => e.a === a.i || e.b === a.i).length)[0]; V.sel = hub ? hub.i : null; }
229
- const c = { drift: 0, conflict: 0, missing: 0 }; G.edges.forEach((e) => { if (c[e.st] != null) c[e.st]++; });
230
- if (!G.nodes.length) return [card('init', 'Document graph', 'tap a node to see what feeds it and what it feeds', el('p', { class: 'dim', style: 'font-size:var(--fs-2);margin:0', 'data-in-empty': '' }, 'No document has a recorded relation yet, so there is no graph to draw.'))];
231
- return [
232
- card('init', 'Document graph', 'tap a node to see what feeds it and what it feeds', el('div', { style: 'overflow-x:auto;max-width:100%' }, graphSvg(V, G)),
233
- el('div', { class: 'pgl' }, el('span', { style: 'color:var(--destructive)' }, '━ conflict ' + c.conflict), el('span', { style: 'color:var(--warning)' }, '━ out of sync ' + c.drift), el('span', null, '━ in sync'), el('span', null, '┄ missing'))),
234
- card('tree', 'Relations', '', relations(V.sel, G, docs, (d) => openDoc(V, d))),
235
- ];
236
- }
237
-
238
- function load(V) {
239
- Promise.all([pmGet('/api/docs/library?ws=' + encodeURIComponent(V.ctx.ws))]).then(([lib]) => {
240
- if (V.disposed) return;
241
- V.lib = lib && lib.ok ? lib : null; V.err = V.lib ? null : (lib && lib.error) || 'The documents could not be read.';
242
- V.docs = V.lib ? docsOf(V.lib, todayIso()) : [];
243
- V.render();
244
- }, () => { V.err = 'The documents could not be read.'; V.render(); });
245
- }
246
-
247
- const LIST_MAX = 30;
248
- function render(V) {
249
- V.health = V.health || {}; V.view = V.view || 'list';
250
- if (V.lib === undefined) {
251
- frame(V, { head: { icon: 'doc', h: 'Reading the documents', s: 'A feature needs its spec and rubric before build. Discovery needs a brief.', ring: [0, 1] }, left: [el('section', { class: 'card sect' }, el('ul', { class: 'list' }, emptyRow('clock', 'Reading the documents.', { role: 'status' })))], right: [] });
252
- return;
253
- }
254
- if (!V.lib) {
255
- frame(V, { head: { icon: 'doc', h: 'The documents could not be read', s: V.err, ring: [0, 1] }, left: [el('section', { class: 'card sect' }, el('ul', { class: 'list' }, emptyRow('alert', V.err)))], right: [] });
256
- return;
257
- }
258
- const all = V.docs.filter(isDoc);
259
- const inScope = all.filter((d) => (V.scope ? d.ini === V.scope : !!d.ini && d.ini !== 'README'));
260
- const O = { missing: 0, stale: 1, draft: 2, current: 3 };
261
- const list = inScope.slice().sort((a, b) => O[a.st] - O[b.st] || String(b.date).localeCompare(String(a.date)));
262
- const shown = V.all ? list : list.slice(0, LIST_MAX);
263
- const cur = inScope.filter((d) => d.st === 'current').length; const need = inScope.filter(needs).length;
264
- askHealth(V, shown);
265
- const hs = shown.map((d) => V.health[d.path]).filter((h) => h && h.total); const good = hs.filter((h) => h.passed === h.total).length;
266
- const head = { icon: 'doc', h: inScope.length + ' document' + (inScope.length === 1 ? '' : 's') + ', ' + need + ' need attention',
267
- s: (hs.length ? 'Health: ' + good + ' of ' + hs.length + ' checked pass every check. ' : '') + 'A feature needs its spec and rubric before build. Discovery needs a brief.', ring: [cur, Math.max(1, inScope.length)] };
268
- const toggle = el('div', { class: 'calbar', style: 'margin-bottom:8px' }, el('div', { class: 'seg', role: 'group', 'aria-label': 'Documents view' },
269
- [['list', 'doc', 'List'], ['graph', 'init', 'Graph']].map(([k, ic, l]) => el('button', { type: 'button', 'aria-pressed': String(V.view === k), 'data-in-dview': k, onClick: () => { V.view = k; V.render(); } }, c3ic(ic, 'sm'), l))));
270
- const left = [toggle]; const right = [];
271
- if (V.view === 'graph') {
272
- left.push(...graphCards(V, V.docs));
273
- right.push(healthCard(V, shown), card('info', 'How to read it', '', el('ul', { class: 'chgl' },
274
- el('li', null, c3ic('init', 'sm'), el('span', null, 'Arrows run from the source to what is built on it.')),
275
- el('li', { class: 'bad' }, c3ic('alert', 'sm'), el('span', null, 'Red: a decision or data source disagrees with the document.')),
276
- el('li', { class: 'bad' }, c3ic('alert', 'sm'), el('span', null, 'Amber: the source changed after the document last used it.')))));
277
- } else {
278
- left.push(el('section', { class: 'card sect', 'data-in-list': 'documents' }, el('div', { class: 'sh2' }, el('h2', null, c3ic('doc', 'sm'), 'Documents ', el('span', { class: 'bdg g' }, String(list.length)))),
279
- el('ul', { class: 'list' }, list.length ? [...shown.map((d) => docRow(V, d)), list.length > shown.length ? el('li', { class: 'fold' }, el('button', { type: 'button', class: 'pill', 'data-in-showall': '', onClick: () => { V.all = true; V.render(); } }, 'Show all ' + list.length)) : null]
280
- : [emptyRow('moon', V.scope ? 'No document belongs to this initiative.' : 'No document belongs to an initiative yet.', { 'data-in-empty': '' })])));
281
- right.push(healthCard(V, shown), coverageCard(V, V.docs.filter(isDoc)));
282
- const C = V.lib.cards || {};
283
- if (C.benchmark) right.push(card('report', 'Benchmark', C.benchmark.sub, hBars(C.benchmark.rows)));
284
- if (C.research) right.push(card('notes', 'Research themes', C.research.sub, hBars(C.research.rows)));
285
- }
286
- frame(V, { head, left, right: right.filter(Boolean) });
287
- }
288
-
289
- const view = makeView('documents', { init: load, render });
290
- export const mount = view.mount;
291
- export const dispose = view.dispose;