create-pmos 0.399.0 → 0.401.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 (425) 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 +2 -2
  7. package/workspace/briefing-premium-board-test.js +3 -3
  8. package/workspace/briefing-premium-doc-edit-test.js +2 -8
  9. package/workspace/briefing-premium-sources-test.js +2 -0
  10. package/workspace/briefing-premium-test.js +6 -2
  11. package/workspace/briefing-premium-work-test.js +9 -4
  12. package/workspace/c3-capture-test.js +0 -17
  13. package/workspace/changelog.json +29 -0
  14. package/workspace/guide/briefing-premium.md +2 -2
  15. package/workspace/guide/home.md +24 -3
  16. package/workspace/guide/layout.md +2 -2
  17. package/workspace/guide/notes.md +2 -2
  18. package/workspace/guide/phone-companion.md +1 -1
  19. package/workspace/lib/core-docs.js +2 -2
  20. package/workspace/lib/route-modules.js +1 -9
  21. package/workspace/lib/routes-phone-day.js +18 -9
  22. package/workspace/lib/routes-slash.js +95 -0
  23. package/workspace/package-lock.json +2 -2
  24. package/workspace/package.json +1 -2
  25. package/workspace/premium-chat-goal-view-test.js +1 -1
  26. package/workspace/premium-chat-term-test.js +0 -10
  27. package/workspace/premium-menu-rows-test.js +1 -1
  28. package/workspace/premium-phone-card-test.js +8 -3
  29. package/workspace/premium-vw-cal-test.js +4 -1
  30. package/workspace/premium-vw-doc-test.js +1 -8
  31. package/workspace/premium-work-depth-test.js +2 -3
  32. package/workspace/public/capture.html +23 -0
  33. package/workspace/public/pm/c3-base.js +47 -0
  34. package/workspace/public/pm/c3-capture.js +1 -1
  35. package/workspace/public/pm/c3-ini-ui.js +1 -1
  36. package/workspace/public/pm/c3-sheet.js +1 -1
  37. package/workspace/public/pm/c3-toast.js +1 -1
  38. package/workspace/public/pm/console3.css +3 -0
  39. package/workspace/public/pm/cozy-home.css +21 -6
  40. package/workspace/public/pm/cozy-today.css +4 -3
  41. package/workspace/public/pm/cozy-viewer.js +4 -2
  42. package/workspace/public/pm/cozy.css +9 -0
  43. package/workspace/public/pm/goal-chat.js +5 -1
  44. package/workspace/public/pm/home-app.js +65 -33
  45. package/workspace/public/pm/home-chat.js +34 -29
  46. package/workspace/public/pm/home-data.js +10 -2
  47. package/workspace/public/pm/home-dictate.js +7 -4
  48. package/workspace/public/pm/home-ini.js +13 -3
  49. package/workspace/public/pm/home-list.js +18 -10
  50. package/workspace/public/pm/home-more.js +2 -2
  51. package/workspace/public/pm/home-phone-card.js +9 -4
  52. package/workspace/public/pm/home-review.js +2 -3
  53. package/workspace/public/pm/home-today.js +11 -8
  54. package/workspace/public/pm/home-work.js +13 -8
  55. package/workspace/public/pm/note-dock.js +1 -2
  56. package/workspace/public/pm/notes-links.js +1 -2
  57. package/workspace/public/pm/notes-task.js +3 -4
  58. package/workspace/public/pm/premium-board.js +1 -1
  59. package/workspace/public/pm/premium-initiative-head.js +3 -3
  60. package/workspace/public/pm/premium-vw-doc.css +20 -2
  61. package/workspace/public/pm/premium-vw-doc.js +22 -7
  62. package/workspace/public/pm/premium-vw-item.css +6 -0
  63. package/workspace/public/pm/view-notes.js +2 -2
  64. package/workspace/replaced-tests.json +435 -0
  65. package/workspace/run-tests.js +323 -28
  66. package/workspace/server.js +15 -10
  67. package/workspace/test-files.json +4 -140
  68. package/workspace/test-lists/base.json +1 -2
  69. package/workspace/test-lists/c3-desktop-light-load.json +1 -2
  70. package/workspace/test-lists/c3-initiative-boards.json +1 -2
  71. package/workspace/test-lists/c3-meeting-focus.json +2 -12
  72. package/workspace/test-lists/c3-work-agent.json +1 -2
  73. package/workspace/test-lists/calendar-tidy-up.json +1 -2
  74. package/workspace/test-lists/console3-reports.json +1 -2
  75. package/workspace/test-lists/docs-three-way-sync.json +1 -2
  76. package/workspace/test-lists/extension-capture.json +5 -0
  77. package/workspace/test-lists/jira-wbs.json +1 -2
  78. package/workspace/test-lists/legacy-cleanup-a.json +9 -0
  79. package/workspace/test-lists/meeting-material.json +1 -2
  80. package/workspace/test-lists/meeting-notes.json +2 -36
  81. package/workspace/test-lists/meeting-replay.json +1 -2
  82. package/workspace/test-lists/mm-capture.json +2 -12
  83. package/workspace/test-lists/my-work.json +2 -10
  84. package/workspace/test-lists/onboarding-firstrun.json +2 -12
  85. package/workspace/test-lists/people-directory.json +1 -2
  86. package/workspace/test-lists/run2-a.json +1 -2
  87. package/workspace/test-lists/run2-d.json +2 -19
  88. package/workspace/test-lists/run3-b.json +1 -2
  89. package/workspace/test-lists/run3-c.json +2 -12
  90. package/workspace/test-lists/run4-b.json +1 -2
  91. package/workspace/test-lists/run4-d.json +1 -5
  92. package/workspace/test-lists/run5-c.json +1 -11
  93. package/workspace/test-lists/run6.json +1 -5
  94. package/workspace/test-lists/workspace-launch-flags.json +2 -12
  95. package/workspace/test-lists/workspace-profile-detection.json +2 -10
  96. package/workspace/test-timings.json +242 -123
  97. package/workspace/c3-briefing-test.js +0 -136
  98. package/workspace/c3-core-docs-test.js +0 -170
  99. package/workspace/c3-driver-fixture.js +0 -64
  100. package/workspace/c3-driver-test.js +0 -169
  101. package/workspace/c3-foundation-test.js +0 -163
  102. package/workspace/c3-ib-items-test.js +0 -114
  103. package/workspace/c3-ib-more-test.js +0 -146
  104. package/workspace/c3-ib-triage-backlog-test.js +0 -128
  105. package/workspace/c3-ini-harness.js +0 -66
  106. package/workspace/c3-ini-life-test.js +0 -167
  107. package/workspace/c3-initiatives-test.js +0 -186
  108. package/workspace/c3-light-load-test.js +0 -112
  109. package/workspace/c3-one-home-test.js +0 -149
  110. package/workspace/c3-phone-test.js +0 -289
  111. package/workspace/c3-quiet-test.js +0 -157
  112. package/workspace/c3-report-design-real-test.js +0 -264
  113. package/workspace/c3-report-design-test.js +0 -442
  114. package/workspace/c3-report-setup-test.js +0 -192
  115. package/workspace/c3-report-structure-real-test.js +0 -248
  116. package/workspace/c3-report-structure-test.js +0 -397
  117. package/workspace/c3-reports-test.js +0 -288
  118. package/workspace/c3-scan-test.js +0 -517
  119. package/workspace/c3-sessions-panel-test.js +0 -365
  120. package/workspace/c3-settings-test.js +0 -204
  121. package/workspace/c3-updates-test.js +0 -131
  122. package/workspace/c3-work-test.js +0 -260
  123. package/workspace/cut-stub.js +0 -40
  124. package/workspace/first-paint-audit.js +0 -160
  125. package/workspace/lib/c3-full-console.js +0 -15
  126. package/workspace/lib/engine/derived/trust.js +0 -3
  127. package/workspace/lib/engine/plan-forecast.js +0 -342
  128. package/workspace/lib/engine/report-families.js +0 -175
  129. package/workspace/lib/engine/truth-table.js +0 -57
  130. package/workspace/lib/routes-c3-init.js +0 -54
  131. package/workspace/lib/routes-c3-life.js +0 -120
  132. package/workspace/lib/routes-c3-timeline.js +0 -192
  133. package/workspace/lib/routes-forecast.js +0 -86
  134. package/workspace/lib/routes-releases.js +0 -130
  135. package/workspace/lib/routes-report-facts.js +0 -85
  136. package/workspace/lib/routes-report-families.js +0 -33
  137. package/workspace/lib/routes-signals.js +0 -51
  138. package/workspace/lib/routes-timeline.js +0 -197
  139. package/workspace/public/c3.html +0 -35
  140. package/workspace/public/index.html +0 -156
  141. package/workspace/public/pm/app.js +0 -831
  142. package/workspace/public/pm/bd-board.js +0 -159
  143. package/workspace/public/pm/bd-drag.js +0 -59
  144. package/workspace/public/pm/bd-model.js +0 -152
  145. package/workspace/public/pm/bd-timeline.js +0 -233
  146. package/workspace/public/pm/bd-tree.js +0 -244
  147. package/workspace/public/pm/board-copy.js +0 -59
  148. package/workspace/public/pm/board-read.js +0 -38
  149. package/workspace/public/pm/branches-sheet.js +0 -56
  150. package/workspace/public/pm/breakdown-api.js +0 -58
  151. package/workspace/public/pm/breakdown-copy.js +0 -138
  152. package/workspace/public/pm/briefing-deck.js +0 -441
  153. package/workspace/public/pm/briefing-model.js +0 -251
  154. package/workspace/public/pm/c3-ambient.js +0 -100
  155. package/workspace/public/pm/c3-audience-link.js +0 -21
  156. package/workspace/public/pm/c3-audience.js +0 -46
  157. package/workspace/public/pm/c3-boot.js +0 -13
  158. package/workspace/public/pm/c3-breakdown.js +0 -240
  159. package/workspace/public/pm/c3-brief-data.js +0 -11
  160. package/workspace/public/pm/c3-brief-mentions.js +0 -137
  161. package/workspace/public/pm/c3-brief-needs.js +0 -288
  162. package/workspace/public/pm/c3-brief-pulse.js +0 -112
  163. package/workspace/public/pm/c3-brief-summary.js +0 -139
  164. package/workspace/public/pm/c3-brief-today.js +0 -79
  165. package/workspace/public/pm/c3-brief.js +0 -279
  166. package/workspace/public/pm/c3-cal-strategy.js +0 -529
  167. package/workspace/public/pm/c3-calendar.js +0 -965
  168. package/workspace/public/pm/c3-calpop.js +0 -111
  169. package/workspace/public/pm/c3-case.js +0 -196
  170. package/workspace/public/pm/c3-core-docs.css +0 -18
  171. package/workspace/public/pm/c3-core-docs.js +0 -236
  172. package/workspace/public/pm/c3-daypart.js +0 -176
  173. package/workspace/public/pm/c3-demo-boards.js +0 -764
  174. package/workspace/public/pm/c3-demo-brief-ix.js +0 -350
  175. package/workspace/public/pm/c3-demo-brief-page.js +0 -70
  176. package/workspace/public/pm/c3-demo-cal-ix.js +0 -74
  177. package/workspace/public/pm/c3-demo-cal2.js +0 -66
  178. package/workspace/public/pm/c3-demo-cal3.js +0 -173
  179. package/workspace/public/pm/c3-demo-cal4.js +0 -169
  180. package/workspace/public/pm/c3-demo-cal5.js +0 -52
  181. package/workspace/public/pm/c3-demo-coredocs.js +0 -221
  182. package/workspace/public/pm/c3-demo-data.js +0 -552
  183. package/workspace/public/pm/c3-demo-focus.js +0 -181
  184. package/workspace/public/pm/c3-demo-init.js +0 -430
  185. package/workspace/public/pm/c3-demo-life.js +0 -77
  186. package/workspace/public/pm/c3-demo-material.js +0 -58
  187. package/workspace/public/pm/c3-demo-misc2.js +0 -34
  188. package/workspace/public/pm/c3-demo-phone.js +0 -48
  189. package/workspace/public/pm/c3-demo-plan2.js +0 -30
  190. package/workspace/public/pm/c3-demo-rd.js +0 -432
  191. package/workspace/public/pm/c3-demo-rep-ix.js +0 -126
  192. package/workspace/public/pm/c3-demo-rep2.js +0 -130
  193. package/workspace/public/pm/c3-demo-rep3.js +0 -138
  194. package/workspace/public/pm/c3-demo-rs.js +0 -287
  195. package/workspace/public/pm/c3-demo-term.js +0 -153
  196. package/workspace/public/pm/c3-demo-time.js +0 -49
  197. package/workspace/public/pm/c3-demo-work-ix.js +0 -32
  198. package/workspace/public/pm/c3-demo.js +0 -131
  199. package/workspace/public/pm/c3-design-studio.js +0 -369
  200. package/workspace/public/pm/c3-doc-formats.js +0 -153
  201. package/workspace/public/pm/c3-doc-sheet.js +0 -1230
  202. package/workspace/public/pm/c3-dock.js +0 -206
  203. package/workspace/public/pm/c3-docs.js +0 -291
  204. package/workspace/public/pm/c3-driver-work.js +0 -110
  205. package/workspace/public/pm/c3-driver.css +0 -18
  206. package/workspace/public/pm/c3-driver.js +0 -298
  207. package/workspace/public/pm/c3-focus.css +0 -304
  208. package/workspace/public/pm/c3-focus.js +0 -983
  209. package/workspace/public/pm/c3-ib-docs.js +0 -92
  210. package/workspace/public/pm/c3-ib-initiatives.js +0 -201
  211. package/workspace/public/pm/c3-ib-items.js +0 -210
  212. package/workspace/public/pm/c3-ib-releases.js +0 -48
  213. package/workspace/public/pm/c3-ib-sprints.js +0 -201
  214. package/workspace/public/pm/c3-ib-triage.js +0 -177
  215. package/workspace/public/pm/c3-ii-tabs.js +0 -252
  216. package/workspace/public/pm/c3-ini-life.css +0 -34
  217. package/workspace/public/pm/c3-ini-life.js +0 -379
  218. package/workspace/public/pm/c3-ini-records.js +0 -197
  219. package/workspace/public/pm/c3-ini-timeline.js +0 -278
  220. package/workspace/public/pm/c3-ini-work.js +0 -139
  221. package/workspace/public/pm/c3-init-extras.js +0 -170
  222. package/workspace/public/pm/c3-initiatives.js +0 -852
  223. package/workspace/public/pm/c3-lifecycle-panels.js +0 -479
  224. package/workspace/public/pm/c3-look.js +0 -27
  225. package/workspace/public/pm/c3-material.css +0 -22
  226. package/workspace/public/pm/c3-material.js +0 -321
  227. package/workspace/public/pm/c3-md.js +0 -3
  228. package/workspace/public/pm/c3-misc-panels.js +0 -89
  229. package/workspace/public/pm/c3-new-session.js +0 -110
  230. package/workspace/public/pm/c3-notes.js +0 -751
  231. package/workspace/public/pm/c3-phone-boot.js +0 -47
  232. package/workspace/public/pm/c3-phone-detail.js +0 -97
  233. package/workspace/public/pm/c3-phone-model.js +0 -3
  234. package/workspace/public/pm/c3-phone.css +0 -66
  235. package/workspace/public/pm/c3-phone.js +0 -444
  236. package/workspace/public/pm/c3-plan-panels.js +0 -163
  237. package/workspace/public/pm/c3-plan.js +0 -193
  238. package/workspace/public/pm/c3-quiet.css +0 -113
  239. package/workspace/public/pm/c3-quiet.js +0 -177
  240. package/workspace/public/pm/c3-replay.css +0 -133
  241. package/workspace/public/pm/c3-replay.js +0 -429
  242. package/workspace/public/pm/c3-report-deck.css +0 -163
  243. package/workspace/public/pm/c3-report-deck.js +0 -598
  244. package/workspace/public/pm/c3-report-frame.css +0 -20
  245. package/workspace/public/pm/c3-report-print.css +0 -20
  246. package/workspace/public/pm/c3-report-setup.css +0 -67
  247. package/workspace/public/pm/c3-report-setup.js +0 -298
  248. package/workspace/public/pm/c3-report-store.js +0 -244
  249. package/workspace/public/pm/c3-report-structure.css +0 -44
  250. package/workspace/public/pm/c3-report-structure.js +0 -473
  251. package/workspace/public/pm/c3-reports.css +0 -68
  252. package/workspace/public/pm/c3-reports.js +0 -377
  253. package/workspace/public/pm/c3-roadmap.js +0 -249
  254. package/workspace/public/pm/c3-scan-api.js +0 -167
  255. package/workspace/public/pm/c3-scan-next.js +0 -248
  256. package/workspace/public/pm/c3-scan-setup.js +0 -313
  257. package/workspace/public/pm/c3-scan-words.js +0 -41
  258. package/workspace/public/pm/c3-scan.css +0 -74
  259. package/workspace/public/pm/c3-scan.js +0 -93
  260. package/workspace/public/pm/c3-session-chat.js +0 -103
  261. package/workspace/public/pm/c3-session-conv.js +0 -165
  262. package/workspace/public/pm/c3-session-term.js +0 -216
  263. package/workspace/public/pm/c3-settings.css +0 -85
  264. package/workspace/public/pm/c3-settings.js +0 -1045
  265. package/workspace/public/pm/c3-shell.js +0 -628
  266. package/workspace/public/pm/c3-signals.js +0 -196
  267. package/workspace/public/pm/c3-strategy-panels.js +0 -45
  268. package/workspace/public/pm/c3-swipe.js +0 -230
  269. package/workspace/public/pm/c3-terminal-data.js +0 -48
  270. package/workspace/public/pm/c3-terminal-edge.js +0 -91
  271. package/workspace/public/pm/c3-terminal-icons.js +0 -40
  272. package/workspace/public/pm/c3-terminal-results.js +0 -141
  273. package/workspace/public/pm/c3-terminal.js +0 -52
  274. package/workspace/public/pm/c3-tickets.js +0 -163
  275. package/workspace/public/pm/c3-timeline.js +0 -201
  276. package/workspace/public/pm/calendar-views.js +0 -1049
  277. package/workspace/public/pm/console3-lift.md +0 -220
  278. package/workspace/public/pm/cozy-home.js +0 -172
  279. package/workspace/public/pm/cozy-initiative.css +0 -138
  280. package/workspace/public/pm/cycle-review.js +0 -125
  281. package/workspace/public/pm/data.js +0 -1577
  282. package/workspace/public/pm/dest-board.js +0 -444
  283. package/workspace/public/pm/dest-docs.js +0 -530
  284. package/workspace/public/pm/dest-initiatives.js +0 -162
  285. package/workspace/public/pm/dest-mywork.js +0 -307
  286. package/workspace/public/pm/dest-notes.js +0 -537
  287. package/workspace/public/pm/dest-people.js +0 -449
  288. package/workspace/public/pm/dest-reports.js +0 -383
  289. package/workspace/public/pm/dest-settings.js +0 -601
  290. package/workspace/public/pm/dest-today.js +0 -267
  291. package/workspace/public/pm/display-word.js +0 -56
  292. package/workspace/public/pm/doc-editor.js +0 -473
  293. package/workspace/public/pm/doc-graph.js +0 -272
  294. package/workspace/public/pm/doc-health-panel.js +0 -110
  295. package/workspace/public/pm/doc-rail.js +0 -167
  296. package/workspace/public/pm/doc-remote.js +0 -180
  297. package/workspace/public/pm/dock-sessions.js +0 -472
  298. package/workspace/public/pm/dock.js +0 -216
  299. package/workspace/public/pm/fixture.js +0 -821
  300. package/workspace/public/pm/flag-picker.js +0 -104
  301. package/workspace/public/pm/frame-copy.js +0 -278
  302. package/workspace/public/pm/freshness-line.js +0 -149
  303. package/workspace/public/pm/handoff-box.js +0 -82
  304. package/workspace/public/pm/initiative-list.js +0 -235
  305. package/workspace/public/pm/initiative-sheet.js +0 -331
  306. package/workspace/public/pm/initiatives-api.js +0 -95
  307. package/workspace/public/pm/initiatives-copy.js +0 -287
  308. package/workspace/public/pm/initiatives-timeline-copy.js +0 -59
  309. package/workspace/public/pm/initiatives-timeline.js +0 -410
  310. package/workspace/public/pm/initiatives-ui.js +0 -291
  311. package/workspace/public/pm/item-sheet.js +0 -268
  312. package/workspace/public/pm/keep-card.js +0 -204
  313. package/workspace/public/pm/lifecycle-lens-model.js +0 -246
  314. package/workspace/public/pm/lifecycle-lens.js +0 -276
  315. package/workspace/public/pm/lifecycle.js +0 -111
  316. package/workspace/public/pm/mobile.css +0 -366
  317. package/workspace/public/pm/mobile.js +0 -581
  318. package/workspace/public/pm/modes-live.js +0 -453
  319. package/workspace/public/pm/modes.js +0 -147
  320. package/workspace/public/pm/my-work-card.js +0 -51
  321. package/workspace/public/pm/my-work-data.js +0 -36
  322. package/workspace/public/pm/new-initiative-sheet.js +0 -169
  323. package/workspace/public/pm/next-step-ui.js +0 -190
  324. package/workspace/public/pm/outbox-panel.js +0 -125
  325. package/workspace/public/pm/palette-copy.js +0 -55
  326. package/workspace/public/pm/palette.js +0 -343
  327. package/workspace/public/pm/panel-breakdown.js +0 -702
  328. package/workspace/public/pm/panel-cockpit.js +0 -425
  329. package/workspace/public/pm/panel-detail.js +0 -1513
  330. package/workspace/public/pm/panel-initiatives.js +0 -929
  331. package/workspace/public/pm/panel-newsess.js +0 -709
  332. package/workspace/public/pm/panel-repos.js +0 -741
  333. package/workspace/public/pm/panel-tabs.js +0 -1506
  334. package/workspace/public/pm/panel-trees.js +0 -204
  335. package/workspace/public/pm/people-link.js +0 -106
  336. package/workspace/public/pm/phone-deck.js +0 -167
  337. package/workspace/public/pm/pm-work-view.js +0 -1533
  338. package/workspace/public/pm/portfolio-report.js +0 -61
  339. package/workspace/public/pm/premium-acts.js +0 -280
  340. package/workspace/public/pm/premium-brief.js +0 -111
  341. package/workspace/public/pm/premium-chat.js +0 -22
  342. package/workspace/public/pm/premium-doc-sheet.js +0 -312
  343. package/workspace/public/pm/premium-initiative.js +0 -324
  344. package/workspace/public/pm/premium-insights.css +0 -228
  345. package/workspace/public/pm/premium-metric-tiles.js +0 -68
  346. package/workspace/public/pm/premium-report-brief.js +0 -132
  347. package/workspace/public/pm/premium-vw-rec.js +0 -67
  348. package/workspace/public/pm/premium-wide.css +0 -30
  349. package/workspace/public/pm/print.css +0 -44
  350. package/workspace/public/pm/provider-cards.js +0 -136
  351. package/workspace/public/pm/registry.js +0 -203
  352. package/workspace/public/pm/release-card.js +0 -110
  353. package/workspace/public/pm/releases-view.js +0 -248
  354. package/workspace/public/pm/report-families-view.js +0 -505
  355. package/workspace/public/pm/report-slides.js +0 -438
  356. package/workspace/public/pm/report-tab.js +0 -33
  357. package/workspace/public/pm/report-view.js +0 -337
  358. package/workspace/public/pm/reports-copy.js +0 -134
  359. package/workspace/public/pm/roadmap.js +0 -294
  360. package/workspace/public/pm/run-card.js +0 -260
  361. package/workspace/public/pm/sessions-panel.js +0 -219
  362. package/workspace/public/pm/sheet-jira.js +0 -353
  363. package/workspace/public/pm/shell-bell.js +0 -163
  364. package/workspace/public/pm/shell-model.js +0 -83
  365. package/workspace/public/pm/shell-phone.js +0 -124
  366. package/workspace/public/pm/shell-readaloud.js +0 -53
  367. package/workspace/public/pm/shell-recording.js +0 -274
  368. package/workspace/public/pm/shell-ticker.js +0 -90
  369. package/workspace/public/pm/sig-watch.js +0 -41
  370. package/workspace/public/pm/slide-confirm.js +0 -163
  371. package/workspace/public/pm/slides-copy.js +0 -52
  372. package/workspace/public/pm/status-banner.js +0 -95
  373. package/workspace/public/pm/tab-doc.js +0 -859
  374. package/workspace/public/pm/tab-gone.js +0 -21
  375. package/workspace/public/pm/tab-term.js +0 -1210
  376. package/workspace/public/pm/tab-web.js +0 -90
  377. package/workspace/public/pm/timeline-copy.js +0 -48
  378. package/workspace/public/pm/timeline-forecast-view.js +0 -164
  379. package/workspace/public/pm/today-agenda.js +0 -331
  380. package/workspace/public/pm/today-cards.js +0 -244
  381. package/workspace/public/pm/today-copy.js +0 -506
  382. package/workspace/public/pm/today-day.js +0 -1371
  383. package/workspace/public/pm/today-goals.js +0 -297
  384. package/workspace/public/pm/today-jobs.js +0 -84
  385. package/workspace/public/pm/today-mentions.js +0 -50
  386. package/workspace/public/pm/topbar.js +0 -202
  387. package/workspace/public/pm/triage-card.js +0 -60
  388. package/workspace/public/pm/undo-hold.js +0 -103
  389. package/workspace/public/pm/view-addrepo.js +0 -208
  390. package/workspace/public/pm/view-files.js +0 -197
  391. package/workspace/public/pm/view-livenotes.js +0 -399
  392. package/workspace/public/pm/view-today.js +0 -13
  393. package/workspace/public/pm/view-validate.js +0 -171
  394. package/workspace/public/pm/welcome.js +0 -391
  395. package/workspace/public/pm/work-place.js +0 -68
  396. package/workspace/public/pm/xlsx-read.js +0 -117
  397. package/workspace/public/welcome.html +0 -22
  398. package/workspace/test-lists/browser-suites-green.json +0 -5
  399. package/workspace/test-lists/c3-core-docs.json +0 -9
  400. package/workspace/test-lists/c3-doc-sheet-rich.json +0 -6
  401. package/workspace/test-lists/c3-doc-sheet-size.json +0 -6
  402. package/workspace/test-lists/c3-doc-sheet-v2.json +0 -6
  403. package/workspace/test-lists/c3-ib-items.json +0 -9
  404. package/workspace/test-lists/c3-ib-more.json +0 -9
  405. package/workspace/test-lists/c3-ib-triage-backlog.json +0 -9
  406. package/workspace/test-lists/c3-ini-life.json +0 -9
  407. package/workspace/test-lists/c3-meeting-board.json +0 -5
  408. package/workspace/test-lists/c3-meeting-card.json +0 -5
  409. package/workspace/test-lists/c3-notes-place.json +0 -5
  410. package/workspace/test-lists/c3-notes-series.json +0 -5
  411. package/workspace/test-lists/calendar-time-page.json +0 -5
  412. package/workspace/test-lists/calpop.json +0 -4
  413. package/workspace/test-lists/console3-briefing.json +0 -9
  414. package/workspace/test-lists/console3-foundation.json +0 -9
  415. package/workspace/test-lists/console3-work-page.json +0 -9
  416. package/workspace/test-lists/premium-brief-parity.json +0 -9
  417. package/workspace/test-lists/report-design-studio-ui.json +0 -5
  418. package/workspace/test-lists/report-structure-ui.json +0 -11
  419. package/workspace/test-lists/report-workspace-ui.json +0 -5
  420. package/workspace/test-lists/run3-a.json +0 -5
  421. package/workspace/test-lists/run3-d.json +0 -6
  422. package/workspace/test-lists/run4-c.json +0 -13
  423. package/workspace/test-lists/today-goals-jobs-ui.json +0 -5
  424. package/workspace/test-lists/today-mentions-cards.json +0 -5
  425. package/workspace/test-lists/workspace-tabs-declutter.json +0 -13
@@ -1,929 +0,0 @@
1
- /* pm/panel-initiatives.js — panel 2, the Slack-style initiative board.
2
- *
3
- * A PORT of the prototype's column 1 (template lines 117–322, derivation lines 1411–1466). Every
4
- * inline `style` string below is copied from that file character for character, and every literal
5
- * is the prototype's literal: the acceptance bar for this surface is a mechanical diff, so a
6
- * reworded label or a "tidied" padding is a defect, not an improvement.
7
- *
8
- * ── Two structural facts the port has to honour ─────────────────────────────────────────────
9
- *
10
- * 1. INTERPOLATIONS ARE WRAPPED. The prototype's runtime renders every `{{ expr }}` as
11
- * `<span class="sc-interp">value</span>` INSIDE the styled element, while literal template text
12
- * stays a bare text node. That is not cosmetic: the comparator indexes nodes by their own text
13
- * and then diffs computed style and geometry, so the node carrying "O1" is an inline span in the
14
- * prototype and would be a blockified 9px-wide flex item if the text were placed directly on the
15
- * styled span. `iv()` below reproduces the wrapper; bare text is used exactly where the
16
- * prototype's template has bare text (`#`, `●`, `+`, `⌕`, `⟨`, and the two italic lines).
17
- *
18
- * 2. THE SEARCH INPUT IS PERSISTENT. Typing sets `q`, which re-renders this panel; an input node
19
- * rebuilt on every keystroke loses focus and caret after the first character. The header and the
20
- * search box are therefore built ONCE at module load and re-used on every render, and only the
21
- * list below them is rebuilt. `setChildren` keeps their identity in the host.
22
- *
23
- * ── Where the data comes from ───────────────────────────────────────────────────────────────
24
- * Fixture mode reads `fixture.js` directly. Normal mode is the same code path with two optional
25
- * overrides the data layer may publish into state — `state.board` ({repoId: group[]}) and
26
- * `state.records` ({slug: record}). Nothing here caches anything derivable (D33): groups, counts,
27
- * search hits and the selected row are computed at read time, every render.
28
- *
29
- * ── What the board says about YOUR work (workspace-active-visibility) ────────────────────────
30
- * On 178 records the filing order is the right filing order and the wrong ATTENTION order, and the
31
- * PM could not tell which initiatives they were working on or which had a live agent. Two additions,
32
- * both inside the elements that were already here:
33
- *
34
- * 1. THE ROW'S LEADING SLOT. It held a constant `#` — the Slack channel glyph, ported for its
35
- * look, carrying nothing on every row. On an initiative with a live session it now holds that
36
- * session's glyph, in that session's colour, with every session named in the tooltip. Same
37
- * span, same node count, same geometry. The TRAILING dot is untouched: it is the ladder's, and
38
- * `lightRecord` cannot derive 178 of those without ~30s of `git log`.
39
- *
40
- * 2. A DERIVED GROUP ABOVE THE OBJECTIVES. Built from `groupNode`, the same element, with the same
41
- * collapse key — derived groups are not new here (`unanchored` and `no record` are both
42
- * constructed in data.js). It lists what a live session, a checked-out working tree, or an open
43
- * tab says the PM is on, ordered so the initiative WAITING on them is the first row.
44
- *
45
- * Three rules hold it honest. Rows are DUPLICATED, never moved — an initiative keeps its place under
46
- * its own anchor, because the anchor is the truth (D59) and a shortcut that re-homes work is a second
47
- * filing system. The group is ABSENT, not empty, when nothing is live. And the join is
48
- * lib/working-set.js's — so a session the join cannot reach never lands on a row it does not belong
49
- * to.
50
- *
51
- * ── What that first cut got wrong (workspace-session-attribution) ────────────────────────────
52
- * It joined on the `initiative/<id>` branch convention ALONE, which holds in one of four ordinary
53
- * situations — and the proof was this file's own history: the initiative that shipped this group was
54
- * built on a `claude/*` branch, so the group could not see the session that wrote it. A session now
55
- * RECORDS what it is for, and `attributeSessions` resolves recorded → branch → unattributed, saying
56
- * which path answered.
57
- *
58
- * The other half was worse than a narrow join. A session the board could not place was DROPPED, so a
59
- * running agent was invisible on the surface whose job is to say what is running. Refusing to guess
60
- * and refusing to mention are different things, and only the first is honesty — hence `orphanRows`,
61
- * which lists them under the group, claims no initiative for them, and offers the bind that turns
62
- * the PM's knowledge into a recorded declaration.
63
- *
64
- * Fixture mode is structurally unaffected, not conditionally suppressed: `pollSessions` returns early
65
- * on FIXTURE and `foldWorkspaces` never runs, so `state.sessions` is empty and there are no branches.
66
- * There is no server in fixture mode, so there are no live sessions to claim — the same rule line 45
67
- * states in the other direction.
68
- */
69
-
70
- import { el, setChildren } from './dom.js';
71
- import { state, setState, FIXTURE } from './state.js';
72
- import * as FX from './fixture.js';
73
- import { boardOf, records, currentProduct } from './board-read.js';
74
-
75
- /* ── the prototype's small helpers, verbatim in behaviour ──────────────────────────────────── */
76
-
77
- /** `{{ expr }}` — an interpolated value, wrapped the way the prototype's runtime wraps it. */
78
- const iv = (v) => el('span', null, v === null || v === undefined ? '' : String(v));
79
-
80
- /** selRow (line 1402) — an active row is washed and gets the 2px brand left border. */
81
- const selRow = (on) => ({
82
- bg: on ? 'var(--accent)' : 'transparent',
83
- bl: on ? 'var(--brand)' : 'transparent',
84
- });
85
-
86
- /* `boardOf` / `records` / `currentProduct` live in board-read.js — one derivation, four readers.
87
- * The seed-board honesty rule ("the beautiful shell") is stated and enforced there. */
88
-
89
- /** The Objective/KR groups a repository starts from, before user-filed additions. */
90
- function baseGroups(product) {
91
- const board = boardOf();
92
- if (board[product]) return board[product];
93
- // The prototype falls back to the workspace board for an unknown repository (line 1425). Only
94
- // fixture mode can honour that; in normal mode an unknown repository has an empty board.
95
- return FIXTURE && !state.board ? (FX.ALLGROUPS[product] || FX.ALLGROUPS.workspace) : [];
96
- }
97
-
98
- /** GROUPS (lines 1425–1430) — user groups appended, user KRs and user initiatives folded in. */
99
- export function groupsFor(product) {
100
- const extraGroups = (state.userGroups && state.userGroups[product]) || [];
101
- return [...baseGroups(product), ...extraGroups].map((g) => {
102
- const extra = (state.addedInits && state.addedInits[product + '|' + g.gid]) || [];
103
- const kr = state.userKrs && state.userKrs[product + '|' + g.gid];
104
- const slugs2 = [...(g.slugs || []), ...extra];
105
- return {
106
- ...g,
107
- slugs: slugs2,
108
- ...(kr ? { hasKr: true, krid: kr.krid, krname: kr.krname, krct: String(slugs2.length) } : {}),
109
- gct: g.dyn ? String(slugs2.length) : g.gct,
110
- };
111
- });
112
- }
113
-
114
- /** The initiative selected when nothing has been picked yet (line 1397 / line 1440). */
115
- function firstSlugOf(product) {
116
- const g0 = baseGroups(product)[0];
117
- return g0 && g0.slugs && g0.slugs.length ? g0.slugs[0] : null;
118
- }
119
-
120
- export const selectedSlug = () => (state.sel !== null && state.sel !== undefined ? state.sel : firstSlugOf(currentProduct()));
121
-
122
- /** sessionsOf (line 1398) — a record that failed to read has no sessions, it does not throw. */
123
- export function sessionsOf(slug, DATA) {
124
- const i = DATA[slug];
125
- if (!i || i.readError) return [];
126
- return [...(i.sessions || []), ...((state.extraSess && state.extraSess[slug]) || [])];
127
- }
128
-
129
- /* ── the working set: which initiatives are yours, and which of them are live ─────────────────── */
130
-
131
- /** The shared modules, off the globals the way panel-tabs.js reads window.PMOSTreeShare. */
132
- const WS = () => (typeof window !== 'undefined' ? window.PMOSWorkingSet : null);
133
- const SS = () => (typeof window !== 'undefined' ? window.PMOSSessionState : null);
134
-
135
- /** workspace id → branch, published by the data layer alongside `board` and `productWs`. */
136
- const branches = () => (state.wsBranches && typeof state.wsBranches === 'object' ? state.wsBranches : {});
137
-
138
- /**
139
- * Every LIVE session, keyed by the initiative its working tree is on: `{slug: [session…]}`.
140
- *
141
- * Fixture mode returns nothing and SAYS so rather than relying on the inputs happening to be empty.
142
- * `pollSessions` does return early on FIXTURE — but a marker drawn from seed data is "the beautiful
143
- * shell" in the PRD's own failure-mode list, and that is not a property to leave resting on a
144
- * `return` two modules away.
145
- */
146
- function liveSessions() {
147
- return attribution().byInitiative;
148
- }
149
-
150
- /**
151
- * The full attribution — `{byInitiative, via, unattributed}` — computed ONCE per render and shared
152
- * by the row markers, the working-set group, the unattributed row and the search. Deriving it three
153
- * times would be three chances to disagree about one fact.
154
- *
155
- * The join now prefers what a session RECORDED over what its branch is called; `via` says which
156
- * answered, and `unattributed` is every live session neither path could place. That last list is
157
- * why this returns the whole shape rather than just the map: a running agent PMOS cannot attribute
158
- * still has to be visible somewhere, and dropping it was half the defect this fixes.
159
- */
160
- export function attribution() {
161
- const empty = { byInitiative: {}, via: {}, unattributed: [] };
162
- if (FIXTURE) return empty;
163
- const ws = WS();
164
- if (!ws || typeof ws.attributeSessions !== 'function') return empty;
165
- const map = branches();
166
- return ws.attributeSessions(state.sessions, (id) => map[id] || null);
167
- }
168
-
169
- /**
170
- * The rows the derived group shows, in attention order.
171
- *
172
- * `onBoard` is what stops a tab or a working tree belonging to ANOTHER repository putting a row on
173
- * this repository's board — `slugProduct()` is the same map panel 4 scopes its tabs by.
174
- */
175
- export function workingSet(attr, product) {
176
- if (FIXTURE) return [];
177
- const ws = WS();
178
- if (!ws) return [];
179
- const owner = slugProduct();
180
- return ws.workingSet({
181
- live: attr.byInitiative,
182
- via: attr.via,
183
- trees: ws.initiativesWithTree(Object.values(branches())),
184
- tabs: ws.initiativesWithTab(state.tabs),
185
- onBoard: (slug) => owner[slug] === product,
186
- });
187
- }
188
-
189
- /**
190
- * The row's leading slot, for one initiative: `['#', colour, title]` when nothing is live, and the
191
- * session's own glyph/colour/tooltip when something is.
192
- *
193
- * The vocabulary is `window.PMOSSessionState`'s — the module index.html loads for exactly this
194
- * reason ("ONE table, TWO consumers"). Not `FX.SDOT`, which is the design prototype's seed data,
195
- * parity-locked to prototype-original.html, and which gives `working` and `needs` the same ● and
196
- * separates them by hue alone. On a board the PM scans, a signal that dies in greyscale is not a
197
- * signal.
198
- */
199
- const HASH = ['#', 'var(--muted-foreground)', ''];
200
-
201
- export function leadOf(slug, live) {
202
- const rows = live[slug];
203
- if (!rows || !rows.length) return HASH;
204
- const ss = SS();
205
- const ws = WS();
206
- if (!ss || !ws) return HASH;
207
- const st = ws.stateOf(rows);
208
- // A state the table does not know is NOT drawn. Falling back to a generic dot here would put a
209
- // mark on the board that no vocabulary can explain, which is the one thing worse than no mark.
210
- if (!st || !ss.GLYPH[st]) return HASH;
211
- return [ss.GLYPH[st], ss.COLOR[st] || 'var(--muted-foreground)', ws.sessionTitle(slug, rows)];
212
- }
213
-
214
- /** Which repository owns each slug (lines 1963–1965) — the tab-scoping key. */
215
- function slugProduct() {
216
- const map = {};
217
- const boards = boardOf();
218
- Object.keys(boards).forEach((prod) => {
219
- (boards[prod] || []).forEach((g) => (g.slugs || []).forEach((s) => { map[s] = prod; }));
220
- });
221
- Object.keys(state.addedInits || {}).forEach((key) => {
222
- const prod = key.split('|')[0];
223
- (state.addedInits[key] || []).forEach((s) => { map[s] = prod; });
224
- });
225
- return map;
226
- }
227
-
228
- /* ── the two tab openers (lines 1380–1385, 1399–1400) ──────────────────────────────────────── */
229
-
230
- /** openTab (line 1380) — an already-open tab is focused, never duplicated. */
231
- export function openTab(tab) {
232
- setState((s) => ({
233
- tabs: s.tabs.find((t) => t.id === tab.id) ? s.tabs : [...s.tabs, tab],
234
- active: tab.id,
235
- }));
236
- }
237
-
238
- export function openTerm(slug, sess) {
239
- /* THE TAB ID, and why a session with no initiative gets a different one.
240
- *
241
- * `term:<slug>:<name>` is the id every initiative-opened terminal has always had, and it is what
242
- * makes `openTab` focus an already-open tab instead of duplicating it. A session PMOS cannot place
243
- * on an initiative has no slug — and interpolating one anyway produced `term:null:agent 1`, where
244
- * every unattributed session with the same name would collide on one tab. Keying those by the
245
- * SERVER's own session id instead is both collision-free and more honest: the tab is a view of
246
- * that process, not of an initiative it does not belong to. */
247
- const key = slug ? 'term:' + slug + ':' + sess.name : 'term:sess:' + ((sess && sess.id) || sess.name);
248
- openTab({
249
- id: key, kind: 'term', title: sess.name, slug: slug || null,
250
- /* `profile` is the session's OWN, or null — never the literal 'claude-work'. It used to default
251
- * to that string, which was a claim about a descriptor this client had never read: nothing in
252
- * data.js reads /api/profiles, so the name was invented here and then filed on the session. It
253
- * also became load-bearing the moment the tab's profile started travelling to the server on a
254
- * spawn, because `resolveProfileForSpawn` REFUSES a profile it cannot find — a fabricated
255
- * default would have turned "no profile chosen" into "session refused". Every display reader
256
- * (fixture.js:853, modes.js:658/808) already supplies its own fallback for null. */
257
- repo: slug ? slugProduct()[slug] : null, sess: sess.name, state: sess.st, profile: sess.profile || null,
258
- /* The SERVER's session id, when the row that was clicked carries one. This is the exact join:
259
- * with it, the terminal attaches to precisely the PTY the PM pointed at, and a reload attaches
260
- * to the same one again. Without it the tab falls back to matching by NAME, and names repeat
261
- * across repositories — which is how a click in one repo opened another repo's shell.
262
- * `spawn` is the opposite instruction, set only by `+ session`: start one, never adopt one. */
263
- sessionId: (sess && sess.id) || null,
264
- spawn: !!(sess && sess.spawn),
265
- });
266
- }
267
-
268
- export function openDoc(slug, path, role, tree, opts) {
269
- /* `tree` — the line of work a search hit came from (overhaul-r1 R1.3). A hit on a LINKED worktree
270
- * opens a tab that carries that tree's `ws` and `branch`, under its own id, so it is read from and
271
- * saved to that tree and can sit beside the main tree's copy of the same path. A main-tree hit
272
- * opens exactly the tab it always did. */
273
- const linked = !!(tree && tree.ws && tree.linked);
274
- // `opts.ref` — read the file from that initiative branch through git (it is not in the checked-out tree);
275
- // `opts.readonly` — a git file is evidence, so the tab offers no edit or save.
276
- const ref = opts && opts.ref ? opts.ref : null;
277
- openTab({
278
- id: 'doc:' + (linked ? tree.ws + ':' : '') + (ref ? 'ref:' + ref + ':' : '') + path, kind: 'doc', title: path.split('/').pop(), slug,
279
- ...(linked ? { ws: tree.ws, branch: tree.branch || null } : {}),
280
- ...(ref ? { ref } : {}), ...(opts && opts.readonly ? { readonly: true } : {}),
281
- /* A file opened from the FOLDER search belongs to no initiative, so `slugProduct()` has no
282
- * answer for it — and `panel-tabs.visibleTabs` shows a tab whose repo is `undefined` in EVERY
283
- * repository, which would hang this workspace's file in another one's tab strip and read its
284
- * path against that root. The repository it was opened FROM is the true answer, and it is used
285
- * only where there is no slug: every existing call site keeps its exact previous value. */
286
- repo: slug ? slugProduct()[slug] : currentProduct(),
287
- path, role: role || 'DOC',
288
- });
289
- }
290
-
291
- /* ── persistent chrome: the sticky header and the search box ───────────────────────────────── */
292
-
293
- const titleText = el('span', null, 'initiatives');
294
-
295
- const header = el('div', {
296
- style: 'display:flex;align-items:center;gap:8px;padding:11px 14px 10px;border-bottom:1px solid var(--border);position:sticky;top:0;background:var(--sidebar);z-index:2',
297
- },
298
- el('span', { style: 'font-size:14px;font-weight:600;letter-spacing:.01em' }, titleText),
299
- el('button', {
300
- onClick: () => setState((s) => ({ col1: !s.col1 })),
301
- style: 'margin-left:auto;color:var(--muted-foreground);font-size:14px;padding:2px 7px;min-height:26px',
302
- hover: 'color:var(--foreground)',
303
- }, '⟨'),
304
- );
305
-
306
- /* `search everything…` — one input, filtering everything, in every mode. ⌘K focuses it, which is
307
- * why it carries `data-pm-search`: app.js looks the target up by that attribute rather than by a
308
- * placeholder string that a translation would break. */
309
- const searchInput = el('input', {
310
- onInput: (e) => setState({ q: e.target.value }),
311
- placeholder: 'search everything…',
312
- 'data-pm-search': '',
313
- style: 'flex:1;min-width:0;font-size:12.5px',
314
- });
315
-
316
- const searchBox = el('div', { style: 'padding:8px 12px 4px' },
317
- el('div', { style: 'display:flex;align-items:center;gap:8px;padding:6px 10px;border:1px solid var(--input);min-height:32px' },
318
- el('span', { style: 'color:var(--muted-foreground);font-size:12px' }, '⌕'),
319
- searchInput,
320
- ),
321
- );
322
-
323
- const fileNewRow = el('button', {
324
- onClick: () => setState({ detail: { kind: 'new' }, col2: true }),
325
- style: 'display:flex;align-items:center;gap:7px;width:100%;padding:8px 12px;margin-top:4px;color:var(--muted-foreground)',
326
- hover: 'color:var(--foreground);background:var(--accent)',
327
- },
328
- el('span', { style: 'flex:none;width:9px;text-align:center;font-size:14px' }, '+'),
329
- el('span', { style: 'font-size:12px' }, 'add objective · KR · initiative'),
330
- );
331
-
332
- /* ── one group: header, optional KR sub-row, initiative rows, empty line ───────────────────── */
333
-
334
- function groupNode(g, product) {
335
- const gkey = product + '|' + g.gid;
336
- // An active search FORCES every group open — a collapsed group must never hide a match.
337
- const isOpen = state.q ? true : !state.collapsedGroups[gkey];
338
- const gshort = g.gname.length > 34 ? g.gname.slice(0, 34).trim() + '…' : g.gname;
339
-
340
- const groupHeader = el('button', {
341
- onClick: () => setState((s) => ({ collapsedGroups: { ...s.collapsedGroups, [gkey]: !s.collapsedGroups[gkey] } })),
342
- style: 'display:flex;align-items:center;gap:6px;width:100%;padding:8px 12px 5px',
343
- hover: 'opacity:.75',
344
- },
345
- el('span', { style: 'flex:none;width:9px;font-size:9px;color:var(--muted-foreground)' }, iv(isOpen ? '▾' : '▸')),
346
- el('span', { style: 'flex:none;font-family:var(--mono);font-size:10px;font-weight:600;letter-spacing:.06em;color:' + g.idc }, iv(g.gid)),
347
- el('span', { style: 'font-family:var(--mono);font-size:10px;letter-spacing:.05em;text-transform:uppercase;color:var(--muted-foreground);overflow:hidden;text-overflow:ellipsis;white-space:nowrap' }, iv(gshort)),
348
- el('span', { style: 'margin-left:auto;flex:none;font-size:10px;color:var(--muted-foreground)' }, iv(g.gct)),
349
- );
350
-
351
- const body = [];
352
- if (isOpen) {
353
- if (g.hasKr) {
354
- body.push(el('div', { style: 'display:flex;align-items:baseline;gap:6px;padding:2px 12px 3px 27px' },
355
- el('span', { style: 'flex:none;font-family:var(--mono);font-size:10px;color:var(--brand)' }, iv(g.krid)),
356
- el('span', { style: 'font-size:10.5px;color:var(--muted-foreground);overflow:hidden;text-overflow:ellipsis;white-space:nowrap' }, iv(g.krname)),
357
- ));
358
- }
359
- for (const it of g.inits) {
360
- body.push(el('button', {
361
- onClick: () => setState({ sel: it.slug, detail: { kind: 'init' }, col2: true }),
362
- style: 'display:flex;align-items:center;gap:7px;width:100%;padding:5px 12px 5px 27px;min-height:32px;border-left:2px solid ' + it.bl + ';background:' + it.bg,
363
- hover: 'background:var(--accent)',
364
- // Stated where the PM is standing, not only in a tooltip on the glyph: on a working-set row
365
- // this names WHICH of the three signals put it there. The glyph summarises; this does not.
366
- title: it.why || null,
367
- },
368
- // ① The slot that used to be a constant. `#` when nothing is live — byte-identical to what
369
- // shipped, which is what keeps the comparator's text axis clean — and the session's own
370
- // glyph when something is. One span either way: no node added, no geometry moved.
371
- el('span', { style: 'flex:none;font-size:12px;color:' + it.leadC, title: it.leadT || null }, it.lead),
372
- el('span', { style: 'font-family:var(--mono);font-size:12.5px;color:var(--foreground);overflow:hidden;text-overflow:ellipsis;white-space:nowrap' }, iv(it.slug)),
373
- el('span', { style: 'margin-left:auto;flex:none;font-size:9px;color:' + it.l2c, title: it.l2b }, '●'),
374
- ));
375
- }
376
- if (g.isEmpty) {
377
- body.push(el('div', { style: 'padding:5px 12px 6px 27px;font-size:11px;color:var(--muted-foreground);font-style:italic' },
378
- 'nothing filed yet — a successful read of nothing'));
379
- }
380
- // Rows this group carries that are NOT initiatives — today, the live sessions PMOS cannot place.
381
- // Appended by the caller so `groupNode` stays the one renderer and does not learn a second model.
382
- if (g.after) body.push(g.after);
383
- }
384
-
385
- return el('div', { style: 'margin-top:4px' }, groupHeader, body);
386
- }
387
-
388
- /* ── the live sessions PMOS cannot place ──────────────────────────────────────────────────────
389
- *
390
- * One row per unattributable live session, under the working-set group, in the same row shape the
391
- * initiatives use so the eye reads one list. It deliberately does NOT look like an initiative row:
392
- * the id slot carries the session's own name and its glyph is the session state, because this row
393
- * stands for a process, not for a record.
394
- *
395
- * Clicking it opens that session's terminal — the same `openTerm` join every other session click
396
- * uses, by the server's id, with no `spawn`. `+ bind` is the second control: it turns the PM's
397
- * knowledge of what the session is for into a recorded declaration, which is the only way a session
398
- * started before this field existed can ever join an initiative.
399
- */
400
- export function orphanRows(rows) {
401
- const ss = SS();
402
- const ws = WS();
403
- const head = el('div', {
404
- style: 'display:flex;align-items:baseline;gap:6px;padding:6px 12px 3px 27px',
405
- title: ws ? ws.unattributedTitle(rows) : null,
406
- },
407
- el('span', { style: 'flex:none;font-family:var(--mono);font-size:10px;color:var(--warning)' }, iv('⌁')),
408
- el('span', { style: 'font-size:10.5px;color:var(--muted-foreground);overflow:hidden;text-overflow:ellipsis;white-space:nowrap' },
409
- iv('not on an initiative — ' + rows.length + ' live session' + (rows.length === 1 ? '' : 's'))),
410
- );
411
-
412
- const body = rows.map((s) => {
413
- const st = ss && ss.GLYPH[s.shown] ? s.shown : null;
414
- return el('button', {
415
- onClick: () => openTerm(null, { name: s.name, st: s.shown, label: s.label, id: s.id, profile: s.profile_id }),
416
- style: 'display:flex;align-items:center;gap:7px;width:100%;padding:5px 12px 5px 27px;min-height:32px;border-left:2px solid transparent;background:transparent',
417
- hover: 'background:var(--accent)',
418
- title: (s.name || s.id) + ' — ' + (s.label || s.shown || '')
419
- + '\nPMOS was never told what this session is for. + bind records it. A session maps to one initiative or none.',
420
- },
421
- el('span', { style: 'flex:none;font-size:12px;color:' + (st && ss ? ss.COLOR[st] : 'var(--muted-foreground)') },
422
- st && ss ? ss.GLYPH[st] : '·'),
423
- el('span', { style: 'font-family:var(--mono);font-size:12.5px;color:var(--foreground);overflow:hidden;text-overflow:ellipsis;white-space:nowrap' },
424
- iv(s.name || s.id)),
425
- el('span', { style: 'margin-left:auto;flex:none;font-size:9px;color:var(--muted-foreground)' }, iv(s.label || s.shown || '')),
426
- );
427
- });
428
-
429
- const bind = el('button', {
430
- onClick: () => setState({ bindSess: rows.length === 1 ? rows[0].id : null, bindResult: null, detail: { kind: 'bind' }, col2: true }),
431
- style: 'display:flex;align-items:center;gap:7px;width:100%;padding:6px 12px 6px 27px;color:var(--muted-foreground)',
432
- hover: 'color:var(--foreground);background:var(--accent)',
433
- },
434
- el('span', { style: 'flex:none;width:9px;text-align:center;font-size:14px' }, '+'),
435
- el('span', { style: 'font-size:11px' }, 'bind a session to an initiative'),
436
- );
437
-
438
- return el('div', null, head, body, bind);
439
- }
440
-
441
- /* ── "matches elsewhere" — artifacts and sessions that the group list cannot show ──────────── */
442
-
443
- /**
444
- * `searchHits` used to read sessions off `record.sessions` ONLY — and board records are LIGHT, with
445
- * `sessions: []`, until the PM opens one. So a search for a session's name returned nothing for 177
446
- * of 178 initiatives, silently, with no indication that the search had not looked. The hit was
447
- * scoped to hydrated records and nothing said so.
448
- *
449
- * `live` closes it: the same join the row markers use, over every session the server has published,
450
- * regardless of what has been hydrated. The old path is KEPT rather than replaced — it also carries
451
- * `state.extraSess`, the sessions this window started, which have no server row until the next poll.
452
- * `seen` is what stops one session arriving twice when both paths find it.
453
- */
454
- export function searchHits(q, DATA, live) {
455
- const hits = [];
456
- if (!q) return hits;
457
- const seen = new Set();
458
- const push = (slug, s) => {
459
- const key = slug + '|' + (s.id || s.name);
460
- if (seen.has(key)) return;
461
- seen.add(key);
462
- hits.push({
463
- kind: 'session · ' + slug,
464
- label: s.name + ' · ' + (s.label || s.shown || s.st || ''),
465
- on: () => { setState({ sel: slug, detail: { kind: 'init' } }); openTerm(slug, s); },
466
- });
467
- };
468
- Object.keys(DATA).forEach((slug) => {
469
- (DATA[slug].arts || []).forEach((a) => {
470
- if (a.path.toLowerCase().includes(q)) {
471
- hits.push({ kind: 'artifact · ' + a.role, label: a.path, on: () => openDoc(slug, a.path, a.role) });
472
- }
473
- });
474
- sessionsOf(slug, DATA).forEach((s) => { if (s.name.toLowerCase().includes(q)) push(slug, s); });
475
- });
476
- Object.keys(live || {}).forEach((slug) => {
477
- (live[slug] || []).forEach((s) => {
478
- // The server's row calls the presented state `shown`; a record's row calls it `st`. `openTerm`
479
- // reads `st`, so the shape is normalised HERE rather than teaching the opener a second one.
480
- if (s.name && s.name.toLowerCase().includes(q)) push(slug, { ...s, st: s.shown });
481
- });
482
- });
483
- return hits.slice(0, 8);
484
- }
485
-
486
- export function hitNode(ht) {
487
- return el('button', {
488
- onClick: ht.on,
489
- style: 'display:block;width:100%;padding:6px 12px;min-height:40px',
490
- hover: 'background:var(--accent)',
491
- },
492
- el('span', { style: 'display:block;font-family:var(--mono);font-size:10px;color:var(--info)' }, iv(ht.kind)),
493
- el('span', { style: 'display:block;font-family:var(--mono);font-size:11px;color:var(--muted-foreground);overflow:hidden;text-overflow:ellipsis;white-space:nowrap' }, iv(ht.label)),
494
- );
495
- }
496
-
497
- /* ── "files in this folder" — the half of `search everything…` that was missing ────────────────
498
- *
499
- * `searchHits` above is the board's search: initiative slugs, paths DECLARED on a record, session
500
- * names. A file the board was never told about is in none of those lists, so it could not be found
501
- * by typing its exact name — and the miss printed "nothing matches — a successful read of nothing",
502
- * which is this repo's phrase for *we looked and there was nothing*, after a search that had never
503
- * opened the folder. This block is the folder half, from /api/search.
504
- *
505
- * ── Three constraints the shape below is a response to ──────────────────────────────────────
506
- *
507
- * 1. THE SEARCH IS ASYNCHRONOUS AND THE RENDER IS NOT. `state.q` changes on every keystroke and
508
- * every change repaints this panel, so a result has to arrive by a route that survives a
509
- * re-render: a cache keyed by the QUERY, a fetch kicked off during render, and `setState({})` on
510
- * arrival. It is exactly `tab-doc.js`'s `requestDoc` pattern, for the same reason.
511
- * 2. ONE WORD IS ONE SEARCH, NOT SIX. A 140 ms debounce collapses the keystrokes of a word, and
512
- * only the LATEST query is ever in flight — an earlier reply landing late must not repaint the
513
- * panel with results for a query the PM has already typed past.
514
- * 3. A BOUNDED ANSWER SAYS SO. `truncated` travels from the walk to the payload to this heading. A
515
- * capped list drawn as a complete one is the same lie with a longer walk behind it.
516
- *
517
- * A hit is labelled `file · <kind>`, never `artifact · <role>`: a file no initiative declares has no
518
- * role, and inventing one would file a claim nobody made. A file the reader cannot show (an image,
519
- * an inert binary) is LISTED and greyed rather than hidden — found-but-not-openable is a true
520
- * answer, and it beats a tab that opens onto a failure the surface could have predicted.
521
- */
522
-
523
- const fileCache = new Map(); // q -> { hits, truncated, scanned, error }
524
- let fileWanted = null; // the query the PM has actually typed — the only reply that may land
525
- let fileTimer = null;
526
- let dataMod; // undefined = not tried · null = unavailable · module = ready
527
-
528
- function dataModule() {
529
- if (dataMod !== undefined) return dataMod;
530
- dataMod = null;
531
- import('./data.js').then((m) => { dataMod = m; setState({}); }).catch(() => { dataMod = null; });
532
- return null;
533
- }
534
-
535
- /* overhaul-r4 B2 — "all repositories": the same box, widened to every registered repository. The
536
- * cache is keyed by scope too, so the two answers never mix. */
537
- const scopeKey = (q) => (state.searchAll ? 'all\u0000' : '') + q;
538
- function requestFiles(q) {
539
- const key = scopeKey(q);
540
- const all = !!state.searchAll;
541
- fileWanted = key;
542
- if (fileTimer) clearTimeout(fileTimer);
543
- fileTimer = setTimeout(() => {
544
- fileTimer = null;
545
- const mod = dataModule();
546
- if (!mod || typeof mod.searchFiles !== 'function') return;
547
- const asked = key;
548
- Promise.resolve(mod.searchFiles(q, undefined, all)).then(
549
- (r) => {
550
- if (fileWanted !== asked) return; // the PM has typed past this query
551
- fileCache.set(asked, (r && r.ok === false)
552
- ? { hits: [], truncated: false, contentTruncated: false, scanned: 0, contentScanned: 0, error: r.error || 'the folder could not be searched' }
553
- : {
554
- hits: (r && r.hits) || [], truncated: !!(r && r.truncated),
555
- contentTruncated: !!(r && r.content_truncated),
556
- scanned: (r && r.scanned) || 0, contentScanned: (r && r.content_scanned) || 0, error: null,
557
- trees: Array.isArray(r && r.trees) ? r.trees : [],
558
- repos: Array.isArray(r && r.repos) ? r.repos : null,
559
- });
560
- if (fileCache.size > 40) fileCache.delete(fileCache.keys().next().value);
561
- setState({});
562
- },
563
- (e) => {
564
- if (fileWanted !== asked) return;
565
- fileCache.set(asked, { hits: [], truncated: false, contentTruncated: false, scanned: 0, contentScanned: 0, error: (e && e.message) || String(e) });
566
- setState({});
567
- },
568
- );
569
- }, 140);
570
- }
571
-
572
- /** The result for `q`, or null while nothing has come back yet. Kicks the fetch off on a miss. */
573
- function fileResults(q) {
574
- if (!q || FIXTURE) return null;
575
- if (fileCache.has(scopeKey(q))) return fileCache.get(scopeKey(q));
576
- requestFiles(q);
577
- return null;
578
- }
579
-
580
- /* overhaul-r1 R1.2 — every hit names its line of work. A hit merged across trees (identical
581
- * content) names every branch; a hit from a linked worktree names its branch with `⑂`; a hit only
582
- * on the main tree of a repository with no linked trees says nothing extra. */
583
- const isLinked = (ws) => !!(dataMod && typeof dataMod.isLinkedTree === 'function' && dataMod.isLinkedTree(ws));
584
- const hitTree = (h) => (h && h.ws ? { ws: h.ws, branch: h.branch || null, linked: isLinked(h.ws) } : null);
585
- function branchTag(h) {
586
- const bs = Array.isArray(h.branches) ? h.branches.filter(Boolean) : [];
587
- if (bs.length > 1) return ' · on ' + bs.join(', ');
588
- if (h.ws && isLinked(h.ws)) return ' · ⑂ ' + (h.branch || 'detached');
589
- return '';
590
- }
591
- /* A hit from ANOTHER repository (all-repositories scope) selects that repository first, then opens
592
- * the file from the hit's own tree, so it is read where it was found. */
593
- async function openHit(h) {
594
- if (h.repo && h.repo !== state.product) {
595
- const repos = await import('./panel-repos.js');
596
- repos.selectRepo(h.repo);
597
- openDoc(null, h.path, 'FILE', h.ws ? { ws: h.ws, branch: h.branch || null, linked: true } : null);
598
- return;
599
- }
600
- openDoc(null, h.path, 'FILE', hitTree(h));
601
- }
602
- const fileLabel = (h) => (h.repo && state.searchAll ? h.repo + ' · ' : '') + 'file · ' + (h.kind || 'file') + (h.match === 'content' ? ' · line ' + h.line : '') + branchTag(h);
603
-
604
- function fileHitNode(h) {
605
- const where = h.dir ? h.dir + '/' : '';
606
- const sub = h.match === 'content' ? h.snippet : (where + h.name);
607
- if (!h.openable) {
608
- return el('div', {
609
- style: 'display:block;width:100%;padding:6px 12px;min-height:40px;opacity:.55',
610
- title: h.path + '\nfound, but this workspace\'s reader cannot show a ' + h.kind + ' file — nothing was opened.',
611
- },
612
- el('span', { style: 'display:block;font-family:var(--mono);font-size:10px;color:var(--muted-foreground)' }, iv(fileLabel(h) + ' · not openable')),
613
- el('span', { style: 'display:block;font-family:var(--mono);font-size:11px;color:var(--muted-foreground);overflow:hidden;text-overflow:ellipsis;white-space:nowrap' }, iv(h.path)),
614
- );
615
- }
616
- return el('button', {
617
- onClick: () => openHit(h),
618
- style: 'display:block;width:100%;padding:6px 12px;min-height:40px;text-align:left',
619
- hover: 'background:var(--accent)',
620
- title: h.path,
621
- },
622
- el('span', { style: 'display:block;font-family:var(--mono);font-size:10px;color:var(--info)' }, iv(fileLabel(h))),
623
- el('span', { style: 'display:block;font-family:var(--mono);font-size:11px;color:var(--foreground);overflow:hidden;text-overflow:ellipsis;white-space:nowrap' }, iv(h.name)),
624
- el('span', { style: 'display:block;font-family:var(--mono);font-size:10px;color:var(--muted-foreground);overflow:hidden;text-overflow:ellipsis;white-space:nowrap' }, iv(sub)),
625
- );
626
- }
627
-
628
- /**
629
- * The whole block, or null when there is nothing to say. Rendered in EVERY mode — the box says
630
- * `search everything…` in all seven of them, and modes.js reads `state.q` in none.
631
- */
632
- export function fileHitsBlock(q) {
633
- if (!q || FIXTURE) return null;
634
- const r = fileResults(q);
635
- const scope = state.searchAll ? 'files in every repository' : 'files in this folder';
636
- const head = (text, tone) => el('div', {
637
- style: 'display:flex;gap:8px;align-items:center;padding:4px 12px 4px;font-family:var(--mono);font-size:10px;letter-spacing:.12em;'
638
- + 'text-transform:uppercase;color:' + (tone || 'var(--muted-foreground)') + ';border-bottom:1px solid var(--border)',
639
- }, iv(String(text).replace(/^files in this folder/, scope)),
640
- // overhaul-r4 B2 — widen the same search to every registered repository
641
- el('button', {
642
- onClick: () => setState((st) => ({ searchAll: !st.searchAll })),
643
- style: 'margin-left:auto;letter-spacing:0;text-transform:none;font-size:10px;padding:1px 6px;border:1px solid var(--border);color:var(--muted-foreground)',
644
- hover: 'color:var(--foreground)', 'data-r4': 'search-all', title: 'search every registered repository',
645
- }, iv((state.searchAll ? '☑' : '☐') + ' all repositories')));
646
-
647
- if (!r) return el('div', { 'data-pm-files': '' }, head('files in this folder · searching…'));
648
- if (r.error) {
649
- return el('div', { 'data-pm-files': '' }, head('files in this folder · not searched', 'var(--destructive)'),
650
- el('div', { style: 'padding:6px 12px;font-size:11px;color:var(--muted-foreground)' }, iv(r.error)));
651
- }
652
- /* WHAT THE WALK DID NOT DO, in the heading, in the caller's own words. Two flags, never merged:
653
- * `truncated` means files were never looked at AT ALL — the one that changes what a PM should
654
- * conclude from an empty list. `contentTruncated` means every file was NAMED and some bodies
655
- * were not read, which is the ordinary state of any repository holding a lock file. Folding the
656
- * second into the first would light the serious flag permanently and thereby retire it. */
657
- // overhaul-r1 R1.4: with several lines of work, say WHICH walk was cut short
658
- const cut = (r.trees || []).length > 1 ? (r.trees || []).filter((t) => t.truncated).map((t) => t.branch || 'detached') : [];
659
- const lines = (r.trees || []).length > 1 ? ' across ' + r.trees.length + ' lines of work' : '';
660
- const bound = r.truncated
661
- ? ' · BOUNDED — files beyond the walk limit were not looked at' + (cut.length ? ' (on ' + cut.join(', ') + ')' : '')
662
- : (r.contentTruncated ? ' · all ' + r.scanned + ' names searched; ' + r.contentScanned + ' bodies read' : '');
663
-
664
- if (!r.hits.length) {
665
- // The board's own phrase is used ONLY when it is true — when the walk really did reach
666
- // everything. A cut-short walk found nothing *of what it looked at*, which is a different claim.
667
- return el('div', { 'data-pm-files': '' },
668
- head('files in this folder · ' + (r.truncated
669
- ? 'no match in the ' + r.scanned + ' files searched — the walk was BOUNDED, more were not looked at'
670
- : 'no file matches — a successful read of nothing' + (r.contentTruncated ? bound : ''))));
671
- }
672
- const kids = [head('files in this folder · ' + r.hits.length + ' of ' + r.scanned + ' searched' + lines + bound)];
673
- for (const h of r.hits) kids.push(fileHitNode(h));
674
- return el('div', { 'data-pm-files': '' }, kids);
675
- }
676
-
677
- /* ── the file-new form's view model (prototype `nw`, lines 1620–1687) ──────────────────────────
678
- * The form itself renders in PANEL 3 (`detail.kind === 'new'`), which panel-detail.js owns — but
679
- * every field it edits and every record it files belongs to this board, so the model is derived
680
- * and exported here rather than duplicated there. panel-detail.js renders `fileNewModel()`.
681
- */
682
- export function fileNewModel() {
683
- const product = currentProduct();
684
- const GROUPS = groupsFor(product);
685
- const DATA = records();
686
- const flowsMap = state.flowsMap || FX.FLOWS;
687
- const ty = state.newType;
688
- const chip = (onSel, sel) => ({
689
- bg: sel ? 'var(--secondary)' : 'transparent',
690
- bc: sel ? 'var(--input)' : 'var(--border)',
691
- color: sel ? 'var(--foreground)' : 'var(--muted-foreground)',
692
- on: onSel,
693
- });
694
- const krTargets = GROUPS.filter((g) => !g.hasKr && /^O\d+$/.test(g.gid));
695
- const anch = state.newAnchor !== null && state.newAnchor !== undefined
696
- ? state.newAnchor
697
- : (ty === 'kr' ? (krTargets[0] ? krTargets[0].gid : null) : (GROUPS[0] ? GROUPS[0].gid : 'none'));
698
-
699
- const anchorRows = ty === 'kr'
700
- ? krTargets.map((g) => ({ label: g.gid, sub: g.gname, ...chip(() => setState({ newAnchor: g.gid }), anch === g.gid) }))
701
- : [
702
- ...GROUPS.filter((g) => g.gid !== 'unanchored').map((g) => ({
703
- label: g.hasKr ? g.gid + ' · ' + g.krid : g.gid,
704
- sub: g.hasKr ? g.krname : g.gname,
705
- ...chip(() => setState({ newAnchor: g.gid }), anch === g.gid),
706
- })),
707
- { label: 'none', sub: 'no anchor — rejected under D59', ...chip(() => setState({ newAnchor: 'none' }), anch === 'none') },
708
- ];
709
-
710
- // Rejected work is filed, never hidden (D59): if the repository has no "unanchored" group yet,
711
- // one is created so the rejection has somewhere honest to land.
712
- const ensureUnanchored = (s) => {
713
- const ug = s.userGroups[product] || [];
714
- const hasBase = baseGroups(product).some((g) => g.gid === 'unanchored') || ug.some((g) => g.gid === 'unanchored');
715
- return hasBase ? s.userGroups : { ...s.userGroups, [product]: [...ug, FX.unanchoredGroup()] };
716
- };
717
-
718
- return {
719
- isObj: ty === 'obj', isKr: ty === 'kr', isInit: ty === 'init',
720
- typeBtns: FX.NEW_TYPES.map(([id, l]) => ({ l, ...chip(() => setState({ newType: id, newAnchor: null }), ty === id) })),
721
- name: state.newName, slug: state.newSlug,
722
- onName: (e) => setState({ newName: e.target.value }),
723
- onSlug: (e) => setState({ newSlug: e.target.value }),
724
- anchors: anchorRows, noKrTargets: ty === 'kr' && krTargets.length === 0,
725
- flowsBtns: Object.keys(flowsMap).map((fn) => ({ l: fn, ...chip(() => setState({ newFlow: fn }), state.newFlow === fn) })),
726
- showD59: ty === 'init' && anch === 'none',
727
- createLabel: FX.CREATE_LABELS[ty] || FX.CREATE_LABELS.init,
728
- onCreate: () => {
729
- if (ty === 'obj') {
730
- const name = state.newName.trim();
731
- if (!name) return;
732
- const ug = state.userGroups[product] || [];
733
- const n = GROUPS.filter((g) => /^O\d+$/.test(g.gid)).length + 1;
734
- setState({
735
- userGroups: { ...state.userGroups, [product]: [...ug, FX.userObjectiveGroup('O' + n, name)] },
736
- newName: '',
737
- });
738
- } else if (ty === 'kr') {
739
- const name = state.newName.trim();
740
- if (!name || !anch) return;
741
- setState({
742
- userKrs: { ...state.userKrs, [product + '|' + anch]: { krid: 'KR1', krname: name } },
743
- newName: '', newAnchor: null,
744
- });
745
- } else {
746
- const slug = state.newSlug.trim().toLowerCase().replace(/\s+/g, '-');
747
- if (!slug || DATA[slug]) return;
748
- const anchored = anch !== 'none';
749
- const group = GROUPS.find((x) => x.gid === anch);
750
- const entry = FX.newInitiativeRecord({ slug, anchored, group, flow: state.newFlow, flowsMap });
751
- const key = product + '|' + (anchored ? anch : 'unanchored');
752
- setState((s) => ({
753
- userInits: { ...s.userInits, [slug]: entry },
754
- userGroups: anchored ? s.userGroups : ensureUnanchored(s),
755
- addedInits: { ...s.addedInits, [key]: [...(s.addedInits[key] || []), slug] },
756
- sel: slug, detail: { kind: 'init' }, newSlug: '', newAnchor: null,
757
- }));
758
- }
759
- },
760
- };
761
- }
762
-
763
- /* ── the secondary modes ───────────────────────────────────────────────────────────────────────
764
- * The seven modes behind the settings drawer are modes.js's; this panel only owns its header and
765
- * its search box, which every mode keeps. modes.js is loaded on first use rather than at boot —
766
- * the product board is what a PM opens on, and a mode that is never entered costs nothing. It is
767
- * handed no detail host: panel 3 is painted by its own owner, and two modules writing one host is
768
- * the one thing the ownership table forbids. A missing modes.js leaves the header and the search
769
- * box on screen instead of taking the panel down.
770
- */
771
- let modesMod; // undefined = not tried · null = loading or unavailable · module = ready
772
-
773
- function modesModule() {
774
- if (modesMod !== undefined) return modesMod;
775
- modesMod = null;
776
- import('./modes.js')
777
- .then((m) => { modesMod = m; setState({}); })
778
- .catch(() => { modesMod = null; });
779
- return null;
780
- }
781
-
782
- /* ── render ────────────────────────────────────────────────────────────────────────────────── */
783
-
784
- export function renderInitiatives(host) {
785
- const mode = state.mode || 'product';
786
- titleText.textContent = FX.modeTitle(mode);
787
- // The input is uncontrolled while it has focus — writing `value` on every render would drop the
788
- // caret to the end mid-word. It is only re-synced when state and DOM have actually diverged.
789
- if (searchInput.value !== state.q) searchInput.value = state.q;
790
-
791
- if (mode !== 'product') {
792
- // The folder results render HERE TOO. The box says `search everything…` in all seven modes and
793
- // modes.js reads `state.q` in none of them, so until now typing in six of them did nothing at
794
- // all — including in the library/folder lens, the one surface that actually lists files.
795
- setChildren(host, [header, searchBox, fileHitsBlock(state.q || '')]);
796
- const modes = modesModule();
797
- if (modes && typeof modes.renderMode === 'function') {
798
- try { modes.renderMode(host, null, mode); } catch (e) { console.error('[pm] renderMode failed:', e); }
799
- }
800
- return host;
801
- }
802
-
803
- const q = (state.q || '').toLowerCase();
804
- const product = currentProduct();
805
- const DATA = records();
806
- const selSlug = selectedSlug();
807
- const detKind = (state.detail && state.detail.kind) || '';
808
- // ONE attribution per render, shared by the row markers, the working-set group, the unattributed
809
- // row and the search. Computing it four times would be four chances to disagree about one fact.
810
- const attr = attribution();
811
- const live = attr.byInitiative;
812
-
813
- /** One row's view model. `why` is null everywhere except in the working-set group. */
814
- const rowOf = (slug, why) => {
815
- const i = DATA[slug];
816
- // The prototype reads `i.l2` unguarded; a real repository can hand back a slug with no
817
- // record at all, and a board that throws is worse than a row that reads "no record".
818
- const l2 = (i && i.l2) || ['', '', FX.C.mut];
819
- const [lead, leadC, leadT] = leadOf(slug, live);
820
- return {
821
- slug, ...selRow(slug === selSlug && detKind === 'init'),
822
- l2a: l2[0], l2b: l2[1], l2c: l2[2], lead, leadC, leadT, why: why || null,
823
- };
824
- };
825
-
826
- let total = 0;
827
- const groups = groupsFor(product).map((g) => {
828
- const inits = g.slugs.filter((s) => !q || s.includes(q)).map((slug) => rowOf(slug, null));
829
- total += inits.length;
830
- return { ...g, inits, isEmpty: inits.length === 0 };
831
- }).filter((g) => g.inits.length > 0 || (g.dyn && !q));
832
-
833
- const hits = searchHits(q, DATA, live);
834
-
835
- /* GROUP BY STATUS (initiative-surface-batch R2). The status is the one the server DERIVES (deriveState + the
836
- * lifecycle ledger), mapped to the PM's words by lib/status-groups.js; nothing typed in a record decides where a
837
- * row lands. A failed read of the statuses is said under the control and everything files under Unknown. */
838
- const SG = typeof window !== 'undefined' ? window.PMOSStatusGroups : null;
839
- const byStatus = state.groupBy === 'status' && !!SG;
840
- const statusRows = (state.statuses && state.statuses[product]) || {};
841
- const statusErr = (state.statusErrors && state.statusErrors[product]) || null;
842
- const STATUS_TONE = { 'needs-you': 'var(--destructive)', 'in-progress': 'var(--brand)', planning: 'var(--muted-foreground)',
843
- 'awaiting-acceptance': 'var(--foreground)', accepted: 'var(--muted-foreground)', 'on-hold': 'var(--muted-foreground)',
844
- closed: 'var(--muted-foreground)', cancelled: 'var(--muted-foreground)', unknown: 'var(--destructive)' };
845
- if (byStatus) {
846
- const seen = new Set(); const all = [];
847
- for (const g of groupsFor(product)) for (const sl of g.slugs) if (!seen.has(sl)) { seen.add(sl); all.push(sl); }
848
- const shown = all.filter((sl) => !q || sl.includes(q));
849
- // An active search shows every match whatever its status: the "active" filter must not hide a hit.
850
- const sgs = SG.group(shown, statusRows, { activeOnly: !!state.activeOnly && !q });
851
- total = 0;
852
- groups.length = 0;
853
- for (const sg of sgs) {
854
- const inits = sg.slugs.map((sl) => rowOf(sl, null));
855
- total += inits.length;
856
- groups.push({ gid: 'status:' + sg.key, idc: STATUS_TONE[sg.key] || 'var(--muted-foreground)', gname: sg.label, gct: String(inits.length),
857
- hasKr: true, krid: '●', krname: sg.meaning || sg.hint, krct: String(inits.length), slugs: sg.slugs, inits, isEmpty: false });
858
- }
859
- }
860
- const CHIP = 'font-family:var(--mono);font-size:10.5px;padding:2px 8px;border:1px solid var(--border);min-height:24px';
861
- const chip = (label, on, onClick, attr) => el('button', { onClick, 'data-r16': attr,
862
- style: CHIP + ';' + (on ? 'color:var(--foreground);background:var(--secondary);border-color:var(--input)' : 'color:var(--muted-foreground)'),
863
- hover: 'color:var(--foreground)', 'aria-pressed': on ? 'true' : 'false' }, label);
864
- const groupBar = FIXTURE ? null : el('div', { 'data-r16': 'group-bar', style: 'display:flex;gap:5px;flex-wrap:wrap;align-items:center;padding:4px 12px 6px' },
865
- el('span', { style: 'font-family:var(--mono);font-size:10px;letter-spacing:.08em;text-transform:uppercase;color:var(--muted-foreground)' }, 'group by'),
866
- chip('objective', !byStatus, () => setState({ groupBy: 'objective' }), 'by-objective'),
867
- chip('status', byStatus, () => setState({ groupBy: 'status' }), 'by-status'),
868
- byStatus ? chip('active only', !!state.activeOnly, () => setState({ activeOnly: !state.activeOnly }), 'active-only') : null,
869
- byStatus && statusErr ? el('span', { 'data-r16': 'status-error', style: 'flex-basis:100%;font-size:10.5px;color:var(--destructive)' }, 'status could not be read — ' + statusErr + ' (every initiative is under Unknown)') : null);
870
-
871
- const kids = [header, searchBox, groupBar];
872
- /* THE WORKING SET, pinned above the Objectives.
873
- *
874
- * It is `groupNode` — the same element, the same collapse key, the same forced-open-on-search
875
- * rule — and it is NOT in `groups`, deliberately: it must not be counted in `total`, because
876
- * `total` decides the "nothing matches" line and a duplicate row is not a second match.
877
- *
878
- * `hasKr` is reused to state the derivation. That slot renders an id and a sentence under a group
879
- * header, which is exactly the shape "what is this group?" needs, and reusing it is what the PM
880
- * asked for ("use the existing one"). It carries no KR here and claims none.
881
- *
882
- * Absent when empty. Not a "0", not a placeholder: a heading over nothing is a heading the PM
883
- * learns to skip. */
884
- const now = workingSet(attr, product).filter((e) => !q || e.slug.includes(q));
885
- /* EVERY LIVE SESSION PMOS CANNOT PLACE (workspace-session-attribution R5).
886
- *
887
- * The board shipped joining on the `initiative/<id>` branch alone, so a session on `main`, on a
888
- * `claude/*` branch, or in a repo with no git simply vanished from it. Refusing to guess which
889
- * initiative it belongs to is right; refusing to MENTION it is not, and only the first is honesty.
890
- *
891
- * It is rendered as a row inside the same group rather than as a group of its own, because it is
892
- * not an initiative and must not sit in a list keyed by one. `+ bind` opens the chooser that
893
- * turns it into the PM's own declaration. */
894
- const orphans = q ? [] : (attr.unattributed || []);
895
- if (now.length || orphans.length) {
896
- const rows = now.map((e) => rowOf(e.slug, WS() ? WS().reasonTitle(e) : null));
897
- kids.push(groupNode({
898
- gid: 'NOW', dyn: true, idc: FX.C.brand, gname: 'working on',
899
- gct: String(now.length + orphans.length),
900
- hasKr: true, krid: '⑂', krname: 'live sessions · checked-out trees · open tabs',
901
- inits: rows,
902
- isEmpty: false,
903
- after: orphans.length ? orphanRows(orphans) : null,
904
- }, product));
905
- }
906
- for (const g of groups) kids.push(groupNode(g, product));
907
- kids.push(fileNewRow);
908
- if (hits.length) {
909
- kids.push(el('div', { style: 'padding:4px 12px 4px;font-family:var(--mono);font-size:10px;letter-spacing:.12em;text-transform:uppercase;color:var(--muted-foreground);border-bottom:1px solid var(--border)' },
910
- 'matches elsewhere'));
911
- for (const ht of hits) kids.push(hitNode(ht));
912
- }
913
- // THE FOLDER. Below the board's own hits, because a record the PM filed outranks a file that
914
- // merely matched — and it is the block that makes the box's name true.
915
- const files = fileHitsBlock(q);
916
- if (files) kids.push(files);
917
- // The prototype's line, unchanged and shown under the same condition it always was — plus the
918
- // folder. It claims nothing matched ANYWHERE, so a file hit has to suppress it or it is a lie
919
- // rendered directly above its own counter-example.
920
- const fileRes = fileResults(q);
921
- if (total === 0 && hits.length === 0 && !(fileRes && fileRes.hits.length)) {
922
- kids.push(el('div', { style: 'padding:10px 14px;font-size:12px;color:var(--muted-foreground);font-style:italic' },
923
- 'nothing matches — a successful read of nothing'));
924
- }
925
-
926
- return setChildren(host, kids);
927
- }
928
-
929
- export default renderInitiatives;