create-pmos 0.399.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 (421) hide show
  1. package/package.json +18 -13
  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 +2 -2
  8. package/workspace/briefing-premium-doc-edit-test.js +2 -8
  9. package/workspace/briefing-premium-test.js +3 -2
  10. package/workspace/briefing-premium-work-test.js +9 -4
  11. package/workspace/c3-capture-test.js +0 -17
  12. package/workspace/changelog.json +17 -0
  13. package/workspace/guide/briefing-premium.md +2 -2
  14. package/workspace/guide/home.md +20 -2
  15. package/workspace/guide/layout.md +2 -2
  16. package/workspace/guide/notes.md +2 -2
  17. package/workspace/guide/phone-companion.md +1 -1
  18. package/workspace/lib/route-modules.js +1 -9
  19. package/workspace/lib/routes-phone-day.js +18 -9
  20. package/workspace/lib/routes-slash.js +95 -0
  21. package/workspace/package-lock.json +2 -2
  22. package/workspace/package.json +1 -2
  23. package/workspace/premium-chat-goal-view-test.js +1 -1
  24. package/workspace/premium-chat-term-test.js +0 -10
  25. package/workspace/premium-menu-rows-test.js +1 -1
  26. package/workspace/premium-phone-card-test.js +2 -2
  27. package/workspace/premium-vw-doc-test.js +1 -8
  28. package/workspace/premium-work-depth-test.js +2 -3
  29. package/workspace/public/capture.html +23 -0
  30. package/workspace/public/pm/c3-base.js +47 -0
  31. package/workspace/public/pm/c3-capture.js +1 -1
  32. package/workspace/public/pm/c3-ini-ui.js +1 -1
  33. package/workspace/public/pm/c3-sheet.js +1 -1
  34. package/workspace/public/pm/c3-toast.js +1 -1
  35. package/workspace/public/pm/console3.css +3 -0
  36. package/workspace/public/pm/cozy-home.css +20 -5
  37. package/workspace/public/pm/cozy-today.css +5 -2
  38. package/workspace/public/pm/cozy-viewer.js +4 -2
  39. package/workspace/public/pm/cozy.css +9 -0
  40. package/workspace/public/pm/goal-chat.js +5 -1
  41. package/workspace/public/pm/home-app.js +47 -26
  42. package/workspace/public/pm/home-chat.js +10 -4
  43. package/workspace/public/pm/home-data.js +3 -1
  44. package/workspace/public/pm/home-dictate.js +7 -4
  45. package/workspace/public/pm/home-ini.js +12 -2
  46. package/workspace/public/pm/home-list.js +20 -7
  47. package/workspace/public/pm/home-more.js +2 -2
  48. package/workspace/public/pm/home-phone-card.js +9 -4
  49. package/workspace/public/pm/home-review.js +2 -3
  50. package/workspace/public/pm/home-today.js +10 -6
  51. package/workspace/public/pm/home-work.js +15 -8
  52. package/workspace/public/pm/note-dock.js +1 -2
  53. package/workspace/public/pm/notes-links.js +1 -2
  54. package/workspace/public/pm/notes-task.js +3 -4
  55. package/workspace/public/pm/premium-board.js +1 -1
  56. package/workspace/public/pm/premium-initiative-head.js +3 -3
  57. package/workspace/public/pm/premium-vw-doc.css +20 -2
  58. package/workspace/public/pm/premium-vw-doc.js +22 -7
  59. package/workspace/public/pm/view-notes.js +2 -2
  60. package/workspace/replaced-tests.json +435 -0
  61. package/workspace/run-tests.js +323 -28
  62. package/workspace/server.js +15 -10
  63. package/workspace/test-files.json +3 -140
  64. package/workspace/test-lists/base.json +1 -2
  65. package/workspace/test-lists/c3-desktop-light-load.json +1 -2
  66. package/workspace/test-lists/c3-initiative-boards.json +1 -2
  67. package/workspace/test-lists/c3-meeting-focus.json +2 -12
  68. package/workspace/test-lists/c3-work-agent.json +1 -2
  69. package/workspace/test-lists/calendar-tidy-up.json +1 -2
  70. package/workspace/test-lists/console3-reports.json +1 -2
  71. package/workspace/test-lists/docs-three-way-sync.json +1 -2
  72. package/workspace/test-lists/extension-capture.json +5 -0
  73. package/workspace/test-lists/jira-wbs.json +1 -2
  74. package/workspace/test-lists/legacy-cleanup-a.json +9 -0
  75. package/workspace/test-lists/meeting-material.json +1 -2
  76. package/workspace/test-lists/meeting-notes.json +2 -36
  77. package/workspace/test-lists/meeting-replay.json +1 -2
  78. package/workspace/test-lists/mm-capture.json +2 -12
  79. package/workspace/test-lists/my-work.json +2 -10
  80. package/workspace/test-lists/onboarding-firstrun.json +2 -12
  81. package/workspace/test-lists/people-directory.json +1 -2
  82. package/workspace/test-lists/run2-a.json +1 -2
  83. package/workspace/test-lists/run2-d.json +2 -19
  84. package/workspace/test-lists/run3-b.json +1 -2
  85. package/workspace/test-lists/run3-c.json +2 -12
  86. package/workspace/test-lists/run4-b.json +1 -2
  87. package/workspace/test-lists/run4-d.json +1 -5
  88. package/workspace/test-lists/run5-c.json +1 -11
  89. package/workspace/test-lists/run6.json +1 -5
  90. package/workspace/test-lists/workspace-launch-flags.json +2 -12
  91. package/workspace/test-lists/workspace-profile-detection.json +2 -10
  92. package/workspace/test-timings.json +242 -123
  93. package/workspace/c3-briefing-test.js +0 -136
  94. package/workspace/c3-core-docs-test.js +0 -170
  95. package/workspace/c3-driver-fixture.js +0 -64
  96. package/workspace/c3-driver-test.js +0 -169
  97. package/workspace/c3-foundation-test.js +0 -163
  98. package/workspace/c3-ib-items-test.js +0 -114
  99. package/workspace/c3-ib-more-test.js +0 -146
  100. package/workspace/c3-ib-triage-backlog-test.js +0 -128
  101. package/workspace/c3-ini-harness.js +0 -66
  102. package/workspace/c3-ini-life-test.js +0 -167
  103. package/workspace/c3-initiatives-test.js +0 -186
  104. package/workspace/c3-light-load-test.js +0 -112
  105. package/workspace/c3-one-home-test.js +0 -149
  106. package/workspace/c3-phone-test.js +0 -289
  107. package/workspace/c3-quiet-test.js +0 -157
  108. package/workspace/c3-report-design-real-test.js +0 -264
  109. package/workspace/c3-report-design-test.js +0 -442
  110. package/workspace/c3-report-setup-test.js +0 -192
  111. package/workspace/c3-report-structure-real-test.js +0 -248
  112. package/workspace/c3-report-structure-test.js +0 -397
  113. package/workspace/c3-reports-test.js +0 -288
  114. package/workspace/c3-scan-test.js +0 -517
  115. package/workspace/c3-sessions-panel-test.js +0 -365
  116. package/workspace/c3-settings-test.js +0 -204
  117. package/workspace/c3-updates-test.js +0 -131
  118. package/workspace/c3-work-test.js +0 -260
  119. package/workspace/cut-stub.js +0 -40
  120. package/workspace/first-paint-audit.js +0 -160
  121. package/workspace/lib/c3-full-console.js +0 -15
  122. package/workspace/lib/engine/derived/trust.js +0 -3
  123. package/workspace/lib/engine/plan-forecast.js +0 -342
  124. package/workspace/lib/engine/report-families.js +0 -175
  125. package/workspace/lib/engine/truth-table.js +0 -57
  126. package/workspace/lib/routes-c3-init.js +0 -54
  127. package/workspace/lib/routes-c3-life.js +0 -120
  128. package/workspace/lib/routes-c3-timeline.js +0 -192
  129. package/workspace/lib/routes-forecast.js +0 -86
  130. package/workspace/lib/routes-releases.js +0 -130
  131. package/workspace/lib/routes-report-facts.js +0 -85
  132. package/workspace/lib/routes-report-families.js +0 -33
  133. package/workspace/lib/routes-signals.js +0 -51
  134. package/workspace/lib/routes-timeline.js +0 -197
  135. package/workspace/public/c3.html +0 -35
  136. package/workspace/public/index.html +0 -156
  137. package/workspace/public/pm/app.js +0 -831
  138. package/workspace/public/pm/bd-board.js +0 -159
  139. package/workspace/public/pm/bd-drag.js +0 -59
  140. package/workspace/public/pm/bd-model.js +0 -152
  141. package/workspace/public/pm/bd-timeline.js +0 -233
  142. package/workspace/public/pm/bd-tree.js +0 -244
  143. package/workspace/public/pm/board-copy.js +0 -59
  144. package/workspace/public/pm/board-read.js +0 -38
  145. package/workspace/public/pm/branches-sheet.js +0 -56
  146. package/workspace/public/pm/breakdown-api.js +0 -58
  147. package/workspace/public/pm/breakdown-copy.js +0 -138
  148. package/workspace/public/pm/briefing-deck.js +0 -441
  149. package/workspace/public/pm/briefing-model.js +0 -251
  150. package/workspace/public/pm/c3-ambient.js +0 -100
  151. package/workspace/public/pm/c3-audience-link.js +0 -21
  152. package/workspace/public/pm/c3-audience.js +0 -46
  153. package/workspace/public/pm/c3-boot.js +0 -13
  154. package/workspace/public/pm/c3-breakdown.js +0 -240
  155. package/workspace/public/pm/c3-brief-data.js +0 -11
  156. package/workspace/public/pm/c3-brief-mentions.js +0 -137
  157. package/workspace/public/pm/c3-brief-needs.js +0 -288
  158. package/workspace/public/pm/c3-brief-pulse.js +0 -112
  159. package/workspace/public/pm/c3-brief-summary.js +0 -139
  160. package/workspace/public/pm/c3-brief-today.js +0 -79
  161. package/workspace/public/pm/c3-brief.js +0 -279
  162. package/workspace/public/pm/c3-cal-strategy.js +0 -529
  163. package/workspace/public/pm/c3-calendar.js +0 -965
  164. package/workspace/public/pm/c3-calpop.js +0 -111
  165. package/workspace/public/pm/c3-case.js +0 -196
  166. package/workspace/public/pm/c3-core-docs.css +0 -18
  167. package/workspace/public/pm/c3-core-docs.js +0 -236
  168. package/workspace/public/pm/c3-daypart.js +0 -176
  169. package/workspace/public/pm/c3-demo-boards.js +0 -764
  170. package/workspace/public/pm/c3-demo-brief-ix.js +0 -350
  171. package/workspace/public/pm/c3-demo-brief-page.js +0 -70
  172. package/workspace/public/pm/c3-demo-cal-ix.js +0 -74
  173. package/workspace/public/pm/c3-demo-cal2.js +0 -66
  174. package/workspace/public/pm/c3-demo-cal3.js +0 -173
  175. package/workspace/public/pm/c3-demo-cal4.js +0 -169
  176. package/workspace/public/pm/c3-demo-cal5.js +0 -52
  177. package/workspace/public/pm/c3-demo-coredocs.js +0 -221
  178. package/workspace/public/pm/c3-demo-data.js +0 -552
  179. package/workspace/public/pm/c3-demo-focus.js +0 -181
  180. package/workspace/public/pm/c3-demo-init.js +0 -430
  181. package/workspace/public/pm/c3-demo-life.js +0 -77
  182. package/workspace/public/pm/c3-demo-material.js +0 -58
  183. package/workspace/public/pm/c3-demo-misc2.js +0 -34
  184. package/workspace/public/pm/c3-demo-phone.js +0 -48
  185. package/workspace/public/pm/c3-demo-plan2.js +0 -30
  186. package/workspace/public/pm/c3-demo-rd.js +0 -432
  187. package/workspace/public/pm/c3-demo-rep-ix.js +0 -126
  188. package/workspace/public/pm/c3-demo-rep2.js +0 -130
  189. package/workspace/public/pm/c3-demo-rep3.js +0 -138
  190. package/workspace/public/pm/c3-demo-rs.js +0 -287
  191. package/workspace/public/pm/c3-demo-term.js +0 -153
  192. package/workspace/public/pm/c3-demo-time.js +0 -49
  193. package/workspace/public/pm/c3-demo-work-ix.js +0 -32
  194. package/workspace/public/pm/c3-demo.js +0 -131
  195. package/workspace/public/pm/c3-design-studio.js +0 -369
  196. package/workspace/public/pm/c3-doc-formats.js +0 -153
  197. package/workspace/public/pm/c3-doc-sheet.js +0 -1230
  198. package/workspace/public/pm/c3-dock.js +0 -206
  199. package/workspace/public/pm/c3-docs.js +0 -291
  200. package/workspace/public/pm/c3-driver-work.js +0 -110
  201. package/workspace/public/pm/c3-driver.css +0 -18
  202. package/workspace/public/pm/c3-driver.js +0 -298
  203. package/workspace/public/pm/c3-focus.css +0 -304
  204. package/workspace/public/pm/c3-focus.js +0 -983
  205. package/workspace/public/pm/c3-ib-docs.js +0 -92
  206. package/workspace/public/pm/c3-ib-initiatives.js +0 -201
  207. package/workspace/public/pm/c3-ib-items.js +0 -210
  208. package/workspace/public/pm/c3-ib-releases.js +0 -48
  209. package/workspace/public/pm/c3-ib-sprints.js +0 -201
  210. package/workspace/public/pm/c3-ib-triage.js +0 -177
  211. package/workspace/public/pm/c3-ii-tabs.js +0 -252
  212. package/workspace/public/pm/c3-ini-life.css +0 -34
  213. package/workspace/public/pm/c3-ini-life.js +0 -379
  214. package/workspace/public/pm/c3-ini-records.js +0 -197
  215. package/workspace/public/pm/c3-ini-timeline.js +0 -278
  216. package/workspace/public/pm/c3-ini-work.js +0 -139
  217. package/workspace/public/pm/c3-init-extras.js +0 -170
  218. package/workspace/public/pm/c3-initiatives.js +0 -852
  219. package/workspace/public/pm/c3-lifecycle-panels.js +0 -479
  220. package/workspace/public/pm/c3-look.js +0 -27
  221. package/workspace/public/pm/c3-material.css +0 -22
  222. package/workspace/public/pm/c3-material.js +0 -321
  223. package/workspace/public/pm/c3-md.js +0 -3
  224. package/workspace/public/pm/c3-misc-panels.js +0 -89
  225. package/workspace/public/pm/c3-new-session.js +0 -110
  226. package/workspace/public/pm/c3-notes.js +0 -751
  227. package/workspace/public/pm/c3-phone-boot.js +0 -47
  228. package/workspace/public/pm/c3-phone-detail.js +0 -97
  229. package/workspace/public/pm/c3-phone-model.js +0 -3
  230. package/workspace/public/pm/c3-phone.css +0 -66
  231. package/workspace/public/pm/c3-phone.js +0 -444
  232. package/workspace/public/pm/c3-plan-panels.js +0 -163
  233. package/workspace/public/pm/c3-plan.js +0 -193
  234. package/workspace/public/pm/c3-quiet.css +0 -113
  235. package/workspace/public/pm/c3-quiet.js +0 -177
  236. package/workspace/public/pm/c3-replay.css +0 -133
  237. package/workspace/public/pm/c3-replay.js +0 -429
  238. package/workspace/public/pm/c3-report-deck.css +0 -163
  239. package/workspace/public/pm/c3-report-deck.js +0 -598
  240. package/workspace/public/pm/c3-report-frame.css +0 -20
  241. package/workspace/public/pm/c3-report-print.css +0 -20
  242. package/workspace/public/pm/c3-report-setup.css +0 -67
  243. package/workspace/public/pm/c3-report-setup.js +0 -298
  244. package/workspace/public/pm/c3-report-store.js +0 -244
  245. package/workspace/public/pm/c3-report-structure.css +0 -44
  246. package/workspace/public/pm/c3-report-structure.js +0 -473
  247. package/workspace/public/pm/c3-reports.css +0 -68
  248. package/workspace/public/pm/c3-reports.js +0 -377
  249. package/workspace/public/pm/c3-roadmap.js +0 -249
  250. package/workspace/public/pm/c3-scan-api.js +0 -167
  251. package/workspace/public/pm/c3-scan-next.js +0 -248
  252. package/workspace/public/pm/c3-scan-setup.js +0 -313
  253. package/workspace/public/pm/c3-scan-words.js +0 -41
  254. package/workspace/public/pm/c3-scan.css +0 -74
  255. package/workspace/public/pm/c3-scan.js +0 -93
  256. package/workspace/public/pm/c3-session-chat.js +0 -103
  257. package/workspace/public/pm/c3-session-conv.js +0 -165
  258. package/workspace/public/pm/c3-session-term.js +0 -216
  259. package/workspace/public/pm/c3-settings.css +0 -85
  260. package/workspace/public/pm/c3-settings.js +0 -1045
  261. package/workspace/public/pm/c3-shell.js +0 -628
  262. package/workspace/public/pm/c3-signals.js +0 -196
  263. package/workspace/public/pm/c3-strategy-panels.js +0 -45
  264. package/workspace/public/pm/c3-swipe.js +0 -230
  265. package/workspace/public/pm/c3-terminal-data.js +0 -48
  266. package/workspace/public/pm/c3-terminal-edge.js +0 -91
  267. package/workspace/public/pm/c3-terminal-icons.js +0 -40
  268. package/workspace/public/pm/c3-terminal-results.js +0 -141
  269. package/workspace/public/pm/c3-terminal.js +0 -52
  270. package/workspace/public/pm/c3-tickets.js +0 -163
  271. package/workspace/public/pm/c3-timeline.js +0 -201
  272. package/workspace/public/pm/calendar-views.js +0 -1049
  273. package/workspace/public/pm/console3-lift.md +0 -220
  274. package/workspace/public/pm/cozy-home.js +0 -172
  275. package/workspace/public/pm/cozy-initiative.css +0 -138
  276. package/workspace/public/pm/cycle-review.js +0 -125
  277. package/workspace/public/pm/data.js +0 -1577
  278. package/workspace/public/pm/dest-board.js +0 -444
  279. package/workspace/public/pm/dest-docs.js +0 -530
  280. package/workspace/public/pm/dest-initiatives.js +0 -162
  281. package/workspace/public/pm/dest-mywork.js +0 -307
  282. package/workspace/public/pm/dest-notes.js +0 -537
  283. package/workspace/public/pm/dest-people.js +0 -449
  284. package/workspace/public/pm/dest-reports.js +0 -383
  285. package/workspace/public/pm/dest-settings.js +0 -601
  286. package/workspace/public/pm/dest-today.js +0 -267
  287. package/workspace/public/pm/display-word.js +0 -56
  288. package/workspace/public/pm/doc-editor.js +0 -473
  289. package/workspace/public/pm/doc-graph.js +0 -272
  290. package/workspace/public/pm/doc-health-panel.js +0 -110
  291. package/workspace/public/pm/doc-rail.js +0 -167
  292. package/workspace/public/pm/doc-remote.js +0 -180
  293. package/workspace/public/pm/dock-sessions.js +0 -472
  294. package/workspace/public/pm/dock.js +0 -216
  295. package/workspace/public/pm/fixture.js +0 -821
  296. package/workspace/public/pm/flag-picker.js +0 -104
  297. package/workspace/public/pm/frame-copy.js +0 -278
  298. package/workspace/public/pm/freshness-line.js +0 -149
  299. package/workspace/public/pm/handoff-box.js +0 -82
  300. package/workspace/public/pm/initiative-list.js +0 -235
  301. package/workspace/public/pm/initiative-sheet.js +0 -331
  302. package/workspace/public/pm/initiatives-api.js +0 -95
  303. package/workspace/public/pm/initiatives-copy.js +0 -287
  304. package/workspace/public/pm/initiatives-timeline-copy.js +0 -59
  305. package/workspace/public/pm/initiatives-timeline.js +0 -410
  306. package/workspace/public/pm/initiatives-ui.js +0 -291
  307. package/workspace/public/pm/item-sheet.js +0 -268
  308. package/workspace/public/pm/keep-card.js +0 -204
  309. package/workspace/public/pm/lifecycle-lens-model.js +0 -246
  310. package/workspace/public/pm/lifecycle-lens.js +0 -276
  311. package/workspace/public/pm/lifecycle.js +0 -111
  312. package/workspace/public/pm/mobile.css +0 -366
  313. package/workspace/public/pm/mobile.js +0 -581
  314. package/workspace/public/pm/modes-live.js +0 -453
  315. package/workspace/public/pm/modes.js +0 -147
  316. package/workspace/public/pm/my-work-card.js +0 -51
  317. package/workspace/public/pm/my-work-data.js +0 -36
  318. package/workspace/public/pm/new-initiative-sheet.js +0 -169
  319. package/workspace/public/pm/next-step-ui.js +0 -190
  320. package/workspace/public/pm/outbox-panel.js +0 -125
  321. package/workspace/public/pm/palette-copy.js +0 -55
  322. package/workspace/public/pm/palette.js +0 -343
  323. package/workspace/public/pm/panel-breakdown.js +0 -702
  324. package/workspace/public/pm/panel-cockpit.js +0 -425
  325. package/workspace/public/pm/panel-detail.js +0 -1513
  326. package/workspace/public/pm/panel-initiatives.js +0 -929
  327. package/workspace/public/pm/panel-newsess.js +0 -709
  328. package/workspace/public/pm/panel-repos.js +0 -741
  329. package/workspace/public/pm/panel-tabs.js +0 -1506
  330. package/workspace/public/pm/panel-trees.js +0 -204
  331. package/workspace/public/pm/people-link.js +0 -106
  332. package/workspace/public/pm/phone-deck.js +0 -167
  333. package/workspace/public/pm/pm-work-view.js +0 -1533
  334. package/workspace/public/pm/portfolio-report.js +0 -61
  335. package/workspace/public/pm/premium-acts.js +0 -280
  336. package/workspace/public/pm/premium-brief.js +0 -111
  337. package/workspace/public/pm/premium-chat.js +0 -22
  338. package/workspace/public/pm/premium-doc-sheet.js +0 -312
  339. package/workspace/public/pm/premium-initiative.js +0 -324
  340. package/workspace/public/pm/premium-insights.css +0 -228
  341. package/workspace/public/pm/premium-metric-tiles.js +0 -68
  342. package/workspace/public/pm/premium-report-brief.js +0 -132
  343. package/workspace/public/pm/premium-vw-rec.js +0 -67
  344. package/workspace/public/pm/premium-wide.css +0 -30
  345. package/workspace/public/pm/print.css +0 -44
  346. package/workspace/public/pm/provider-cards.js +0 -136
  347. package/workspace/public/pm/registry.js +0 -203
  348. package/workspace/public/pm/release-card.js +0 -110
  349. package/workspace/public/pm/releases-view.js +0 -248
  350. package/workspace/public/pm/report-families-view.js +0 -505
  351. package/workspace/public/pm/report-slides.js +0 -438
  352. package/workspace/public/pm/report-tab.js +0 -33
  353. package/workspace/public/pm/report-view.js +0 -337
  354. package/workspace/public/pm/reports-copy.js +0 -134
  355. package/workspace/public/pm/roadmap.js +0 -294
  356. package/workspace/public/pm/run-card.js +0 -260
  357. package/workspace/public/pm/sessions-panel.js +0 -219
  358. package/workspace/public/pm/sheet-jira.js +0 -353
  359. package/workspace/public/pm/shell-bell.js +0 -163
  360. package/workspace/public/pm/shell-model.js +0 -83
  361. package/workspace/public/pm/shell-phone.js +0 -124
  362. package/workspace/public/pm/shell-readaloud.js +0 -53
  363. package/workspace/public/pm/shell-recording.js +0 -274
  364. package/workspace/public/pm/shell-ticker.js +0 -90
  365. package/workspace/public/pm/sig-watch.js +0 -41
  366. package/workspace/public/pm/slide-confirm.js +0 -163
  367. package/workspace/public/pm/slides-copy.js +0 -52
  368. package/workspace/public/pm/status-banner.js +0 -95
  369. package/workspace/public/pm/tab-doc.js +0 -859
  370. package/workspace/public/pm/tab-gone.js +0 -21
  371. package/workspace/public/pm/tab-term.js +0 -1210
  372. package/workspace/public/pm/tab-web.js +0 -90
  373. package/workspace/public/pm/timeline-copy.js +0 -48
  374. package/workspace/public/pm/timeline-forecast-view.js +0 -164
  375. package/workspace/public/pm/today-agenda.js +0 -331
  376. package/workspace/public/pm/today-cards.js +0 -244
  377. package/workspace/public/pm/today-copy.js +0 -506
  378. package/workspace/public/pm/today-day.js +0 -1371
  379. package/workspace/public/pm/today-goals.js +0 -297
  380. package/workspace/public/pm/today-jobs.js +0 -84
  381. package/workspace/public/pm/today-mentions.js +0 -50
  382. package/workspace/public/pm/topbar.js +0 -202
  383. package/workspace/public/pm/triage-card.js +0 -60
  384. package/workspace/public/pm/undo-hold.js +0 -103
  385. package/workspace/public/pm/view-addrepo.js +0 -208
  386. package/workspace/public/pm/view-files.js +0 -197
  387. package/workspace/public/pm/view-livenotes.js +0 -399
  388. package/workspace/public/pm/view-today.js +0 -13
  389. package/workspace/public/pm/view-validate.js +0 -171
  390. package/workspace/public/pm/welcome.js +0 -391
  391. package/workspace/public/pm/work-place.js +0 -68
  392. package/workspace/public/pm/xlsx-read.js +0 -117
  393. package/workspace/public/welcome.html +0 -22
  394. package/workspace/test-lists/browser-suites-green.json +0 -5
  395. package/workspace/test-lists/c3-core-docs.json +0 -9
  396. package/workspace/test-lists/c3-doc-sheet-rich.json +0 -6
  397. package/workspace/test-lists/c3-doc-sheet-size.json +0 -6
  398. package/workspace/test-lists/c3-doc-sheet-v2.json +0 -6
  399. package/workspace/test-lists/c3-ib-items.json +0 -9
  400. package/workspace/test-lists/c3-ib-more.json +0 -9
  401. package/workspace/test-lists/c3-ib-triage-backlog.json +0 -9
  402. package/workspace/test-lists/c3-ini-life.json +0 -9
  403. package/workspace/test-lists/c3-meeting-board.json +0 -5
  404. package/workspace/test-lists/c3-meeting-card.json +0 -5
  405. package/workspace/test-lists/c3-notes-place.json +0 -5
  406. package/workspace/test-lists/c3-notes-series.json +0 -5
  407. package/workspace/test-lists/calendar-time-page.json +0 -5
  408. package/workspace/test-lists/calpop.json +0 -4
  409. package/workspace/test-lists/console3-briefing.json +0 -9
  410. package/workspace/test-lists/console3-foundation.json +0 -9
  411. package/workspace/test-lists/console3-work-page.json +0 -9
  412. package/workspace/test-lists/premium-brief-parity.json +0 -9
  413. package/workspace/test-lists/report-design-studio-ui.json +0 -5
  414. package/workspace/test-lists/report-structure-ui.json +0 -11
  415. package/workspace/test-lists/report-workspace-ui.json +0 -5
  416. package/workspace/test-lists/run3-a.json +0 -5
  417. package/workspace/test-lists/run3-d.json +0 -6
  418. package/workspace/test-lists/run4-c.json +0 -13
  419. package/workspace/test-lists/today-goals-jobs-ui.json +0 -5
  420. package/workspace/test-lists/today-mentions-cards.json +0 -5
  421. package/workspace/test-lists/workspace-tabs-declutter.json +0 -13
@@ -1,831 +0,0 @@
1
- /* pm/app.js — the shell of the workspace, and its render loop.
2
- *
3
- * ── Two shells (pm-os-absorb Run 3, slice 3A) ───────────────────────────────────────────────
4
- * THE FRAME is the default (PRD R9, R10, R15): one top bar (topbar.js: Repository ▾ · Today Initiatives Board Reports ·
5
- * ⌘K · Sync when unsynced · Settings), the destination on screen (each one mounted by registry.js mountDestTab into a
6
- * persistent host that carries data-dest="<id>"), the detail as a closable column when something opens one, and the
7
- * agent dock (dock.js; it is panel 4, #pm-tabs) open on Today and a 44px rail everywhere else. The phone shows the same
8
- * hosts one at a time under five tabs (pm/mobile.js). There is no left sidebar.
9
- * THE FOUR-PANEL COCKPIT below stays for fixture mode (the parity boards, until slice 3D lifts the lock) and for
10
- * `?layout=legacy`. Everything from here to "the frame" describes it.
11
- *
12
- * Owns: the root grid, the 44px top bar, the 26px status bar, the body grid's four tracks, the
13
- * three collapsed rails, and the keyboard (⌘K / Esc). Everything inside a panel belongs to that
14
- * panel's module.
15
- *
16
- * ── The host contract, for the panel modules ────────────────────────────────────────────────
17
- * app.js creates ONE persistent host element per panel and hands the SAME element to that panel's
18
- * renderer on every render:
19
- *
20
- * renderRepos(host) renderInitiatives(host) renderDetail(host) renderTabs(host)
21
- *
22
- * The host IS the prototype's open-panel container — app.js has already set its verbatim `style`
23
- * and it is the direct grid child. A renderer therefore clears the host and appends the panel's
24
- * CONTENTS; it must not wrap them in another div, because an extra layer between the grid and the
25
- * panel body changes the geometry the comparator measures. The host is persistent on purpose:
26
- * panel 4 holds a live xterm, and re-parenting a terminal on every unrelated state change is the
27
- * quiet PTY regression the PRD warns about.
28
- *
29
- * A panel module that does not exist yet is not an error — its host renders empty and the rest of
30
- * the shell still comes up.
31
- */
32
-
33
- import { el, clear, setChildren, keepScroll } from './dom.js';
34
- import { state, setState, subscribe, flush, FIXTURE, LEGACY_LAYOUT_FLAG } from './state.js';
35
- /* The phone surface (≤760px). It owns its own chrome and decides which single panel is visible;
36
- * the shell's only part in it is to keep all four hosts mounted below the breakpoint and to hand
37
- * the module a repaint. See pm/mobile.js. */
38
- import { isMobile, mountMobile, applyMobile } from './mobile.js';
39
- /* The frame's parts (Run 3, slice 3A). Small modules with no effect at import: a fixture page loads them and calls none. */
40
- import { createTopbar, unsyncedOf } from './topbar.js';
41
- import { createDockRail } from './dock.js';
42
- import { SEL, ensureComponentsCss, iconButton, menu, toast, sheet, button } from './primitives.js';
43
- import { ensureSprite } from './icons.js';
44
- import { COPY as FC } from './frame-copy.js';
45
- import { registerCommand } from './registry.js';
46
-
47
- /* The LEGACY layout is the three-column shell of column-layout: repositories with the list under them, the detail, the tabs, and
48
- * a list that a mode (skills, memory …) replaces. A phone still draws it until Run 4 of workspace-cockpit-nav, and `?layout=legacy`
49
- * draws it on a desktop so the suites of the panels it uses keep guarding them. It is not a setting: nothing offers it. */
50
- const legacyLayout = () => LEGACY_LAYOUT_FLAG || isMobile();
51
-
52
- /* ── derived labels (the prototype's two title maps, lines 1409 / 1699) ─────────────────────── */
53
-
54
- const MODE_TITLE = { product: 'initiatives', workflow: 'workflows', validate: 'validate', today: 'today' };
55
- const modeTitle = () => MODE_TITLE[state.mode] || 'initiatives';
56
- const DETAIL_TITLE = {
57
- init: 'initiative', flow: 'workflow', skill: 'skill', prof: 'claude profile', addprod: 'add product', new: 'file new',
58
- };
59
-
60
- const detailTitle = () => DETAIL_TITLE[(state.detail && state.detail.kind) || ''] || 'detail';
61
-
62
- /* Panels 1 and 2 are resizable: a drag handle on each right edge. The width is clamped, remembered
63
- * (state.js PERSIST) and reset by a double-click. Before this the columns were a fixed 210px / 280px and a
64
- * long repository or branch name was simply cut off. */
65
- const W_LEGACY = { min: 220, max: 560, def: 280 };
66
- /* The cockpit's list is 288px by default (the mockup's) and is resized and clamped the same way. */
67
- const W_COCKPIT = { min: 220, max: 560, def: 288 };
68
- const W0 = { get min() { return W_LEGACY.min; }, get max() { return W_LEGACY.max; }, get def() { return legacyLayout() ? W_LEGACY.def : W_COCKPIT.def; } };
69
- const clampW = (v, r) => (typeof v === 'number' && Number.isFinite(v) ? Math.min(r.max, Math.max(r.min, Math.round(v))) : r.def);
70
- const col0w = () => clampW(state.col0W, W0);
71
-
72
- /* workspace-cockpit-nav: on a desktop the body is FOUR columns — the 64px repository rail (a 65px track: the mockup draws the rail
73
- * 64px wide with its 1px border outside that width, so the list starts at x=65), the list (288px), the detail (about
74
- * 470px) and the tabs (the rest) — and the hosts keep the order they had. The rail is always drawn; `col1` folds the list to a 36px
75
- * strip and `col2` folds the detail. The three-column shell below is what a PHONE still draws until Run 4.
76
- *
77
- * THREE columns (column-layout): navigation, detail, tabs. Navigation is the repository list with the list of the
78
- * current mode UNDER it (initiatives, or memory, skills, knowledge …). The detail opens in the second column, the
79
- * tabs fill the rest. The DOM still holds four hosts in the same order — repos, list, detail, tabs — and the grid
80
- * puts the list host under the repositories host (see placeHosts). Folded away, the navigation column is a 36px
81
- * rail; the list alone folds to a one-line bar under the repositories. */
82
- const gridCols = (legacy) => legacy
83
- ? (state.col0 ? col0w() + 'px' : '36px') + ' ' + (state.col2 ? 'minmax(420px,560px)' : '36px') + ' minmax(0,1fr)'
84
- : '65px ' + (state.col1 ? col0w() + 'px' : '36px') + ' ' + (state.col2 ? 'minmax(420px,470px)' : '36px') + ' minmax(0,1fr)';
85
-
86
- /** The right-hand 7px of a column is its drag handle. It is a hit-test on the host, not an extra element:
87
- * the body grid is exactly four tracks and the panels repaint their own children. `key` is the state
88
- * field holding the width. */
89
- const EDGE = 7;
90
- function makeEdgeDrag(host, key, range, getW) {
91
- const onEdge = (e) => { const r = host.getBoundingClientRect(); return e.clientX >= r.right - EDGE && e.clientX <= r.right + 2; };
92
- host.addEventListener('mousemove', (e) => { host.style.cursor = onEdge(e) ? 'col-resize' : ''; });
93
- host.addEventListener('dblclick', (e) => { if (onEdge(e)) setState({ [key]: range.def }); });
94
- host.addEventListener('mousedown', (e) => {
95
- if (e.button !== 0 || !onEdge(e)) return;
96
- e.preventDefault();
97
- const x0 = e.clientX; const w0 = getW();
98
- const move = (ev) => setState({ [key]: clampW(w0 + (ev.clientX - x0), range) });
99
- const up = () => { document.removeEventListener('mousemove', move); document.removeEventListener('mouseup', up); document.body.style.userSelect = ''; };
100
- document.body.style.userSelect = 'none';
101
- document.addEventListener('mousemove', move); document.addEventListener('mouseup', up);
102
- });
103
- }
104
-
105
- /* ── running-session count for the status bar ───────────────────────────────────────────────
106
- * The count is over every session of every initiative in every repository, seeded plus started
107
- * (`extraSess`), whose state is `working` or `needs`, skipping records that failed to read. That
108
- * rule lives with the data — an agent's `sessions` list and an initiative's `sessions` list have
109
- * the same shape, so anything that counts by shape rather than by record counts the wrong things.
110
- * Order of preference:
111
- * 1. `state.runningCount`, if the data layer has published one;
112
- * 2. `data.js`'s `runningCount(state)`;
113
- * 3. `fixture.js`'s `countRunning(state)` — fixture mode's own derivation;
114
- * 4. otherwise only the sessions started in this window.
115
- */
116
- function runningCount() {
117
- if (typeof state.runningCount === 'number') return state.runningCount;
118
- if (mods.data && typeof mods.data.runningCount === 'function') {
119
- // Only a NUMBER counts as an answer. A source that declines returns null, and the chain
120
- // continues — taking `null` as an answer is how the data layer's fixture-mode decline used to
121
- // render as "null sessions running", and taking a 0 it did not mean is how it rendered "0".
122
- try {
123
- const n = mods.data.runningCount(state);
124
- if (typeof n === 'number') return n;
125
- } catch { /* fall through */ }
126
- }
127
- if (FIXTURE && mods.fixture && typeof mods.fixture.countRunning === 'function') {
128
- try { return mods.fixture.countRunning(state); } catch { /* fall through */ }
129
- }
130
- let n = 0;
131
- for (const k in state.extraSess) {
132
- const list = state.extraSess[k];
133
- if (Array.isArray(list)) for (const s of list) if (s && (s.st === 'working' || s.st === 'needs')) n++;
134
- }
135
- return n;
136
- }
137
-
138
- /* ── the shell, built once ─────────────────────────────────────────────────────────────────── */
139
-
140
- /* ── Why every track and every column here is `minmax(0, …)` / `min-height:0` ─────────────────
141
- *
142
- * The shell is 100vh and nothing in it is supposed to scroll the PAGE — a panel scrolls, the app
143
- * never does. That held right up until a long document was opened in panel 4, and then the whole
144
- * user interface scrolled: the top bar slid away, the status bar came up from below, and the doc
145
- * pane's own `overflow-y:auto` never engaged.
146
- *
147
- * The cause is one CSS default, in two guises, and it is worth naming precisely because it is
148
- * invisible in a style string that looks correct:
149
- *
150
- * • `grid-template-rows: 44px 1fr 26px` — `1fr` is shorthand for `minmax(auto, 1fr)`, and that
151
- * `auto` MINIMUM is the item's min-content height. A tall document therefore does not overflow
152
- * the middle row; it ENLARGES it, past the 100vh the row was supposed to be trapped inside.
153
- * • a grid item / flex item with `min-height: auto` cannot shrink below its content either, so
154
- * even a correctly-sized track hands the overflow straight through to the next box down.
155
- *
156
- * Overflow that is `visible` still contributes to the SCROLLABLE overflow region of every ancestor
157
- * that does not clip it, all the way up to the viewport — which is exactly the reported symptom:
158
- * the page scrolls, not the pane. So the fix is the whole chain, not one box. Each ancestor between
159
- * the viewport and a scrolling pane declares a zero minimum, and the root clips as the backstop so
160
- * a future panel that forgets cannot reach the page again.
161
- *
162
- * The design prototype had this right (`grid-template-rows:44px minmax(0,1fr) 28px`, see
163
- * prototype/workspace-layout-variants/*.html); the port dropped the `minmax(0, …)` and read
164
- * identically until something tall was rendered into it.
165
- */
166
- const root = el('div', {
167
- 'data-pm-theme': state.theme,
168
- style: 'display:grid;grid-template-rows:48px minmax(0,1fr) 28px;height:100vh;overflow:hidden;background:var(--background);color:var(--foreground);font-family:var(--sans);font-size:13px;line-height:1.5',
169
- });
170
-
171
- /* The legacy layout has no rail to hang the menu from, so its theme control stays where it was: in the top bar. */
172
- const themeBtn = el('button', {
173
- onClick: () => setState((s) => ({ theme: s.theme === 'dark' ? 'light' : 'dark' })),
174
- style: 'font-size:12px;color:var(--foreground);padding:5px 12px;border:1px solid var(--input);min-height:30px',
175
- hover: 'border-color:var(--muted-foreground)',
176
- }, 'theme · dark');
177
- const crumb = el('span', { 'data-top': 'crumb', style: 'display:flex;align-items:center;gap:8px;color:var(--muted-foreground);min-width:0;overflow:hidden;white-space:nowrap' });
178
- const jump = el('button', {
179
- onClick: () => { if (legacyLayout()) focusSearch(); else setState({ paletteOpen: true, menuOpen: false }); },
180
- 'data-top': 'jump', 'aria-label': 'jump to anything',
181
- style: 'margin-left:auto;display:flex;align-items:center;gap:8px;box-sizing:content-box;border:1px solid var(--input);border-radius:8px;height:32px;padding:0 12px;min-width:300px;color:var(--muted-foreground);font:13px var(--sans);line-height:1.45',
182
- hover: 'background:var(--accent)',
183
- html: '<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg>Jump to anything<span style="margin-left:auto;font:11px var(--mono)">⌘K</span>',
184
- });
185
- const liveBadge = el('span', { style: 'font:500 11px var(--sans);border:1px solid transparent;border-radius:999px;padding:0 8px;line-height:18px;white-space:nowrap;background:color-mix(in oklab, var(--success) 16%, transparent);color:var(--success)' }, '● live · local');
186
-
187
- const topBar = el('div', {
188
- 'data-shell': 'top',
189
- // its fill is set per layout in render(): none on the cockpit (as on the mockup), --background on the legacy shell
190
- style: 'display:flex;align-items:center;gap:14px;padding:0 16px;border-bottom:1px solid var(--border);color:var(--foreground);min-width:0;line-height:1.45',
191
- },
192
- el('span', { style: 'font-weight:600;font-size:15px' }, 'PMOS'),
193
- crumb,
194
- jump,
195
- liveBadge,
196
- );
197
-
198
- const statusLeft = el('span', null, 'local · 0 sessions running');
199
- const statusBar = el('div', {
200
- 'data-shell': 'status',
201
- style: 'display:flex;align-items:center;justify-content:space-between;padding:0 14px;color:var(--muted-foreground);font:11px var(--mono);border-top:1px solid var(--border)',
202
- },
203
- statusLeft,
204
- el('span', null, '⌘K jump · Esc closes tab'),
205
- );
206
- const paletteHost = el('div', { id: 'pm-palette', 'data-shell': 'palette', style: 'display:contents' });
207
-
208
- /* The body grid's own geometry, in one place so the initial build and every repaint below cannot
209
- * disagree. The implicit ROW is stated explicitly as `minmax(0,1fr)` for the same reason the root's
210
- * middle track is: an auto row is floored at its items' min-content height, and one tall panel
211
- * would push the grid taller than the box it was given. */
212
- // A cockpit desktop is one row of four columns; the legacy layout is two rows (repositories, then the list under them) on a desktop
213
- // and one on a phone, where the hosts are shown one at a time.
214
- const BODY_GRID_STYLE = (legacy, phone) =>
215
- 'display:grid;grid-template-columns:' + gridCols(legacy) + ';grid-template-rows:' + (legacy && !phone ? 'auto minmax(0,1fr)' : 'minmax(0,1fr)') + ';min-height:0;overflow:hidden';
216
-
217
- const bodyGrid = el('div', { 'data-shell': 'body', style: BODY_GRID_STYLE(false, false) });
218
-
219
- /** The collapsed 36px strip: a full-height button with a rotated vertical-rl label. */
220
- function makeRail(flag) {
221
- const label = el('span', { style: 'writing-mode:vertical-rl;font-size:11px;letter-spacing:.1em;color:var(--muted-foreground);font-family:var(--mono)' });
222
- const btn = el('button', {
223
- onClick: () => setState((s) => ({ [flag]: !s[flag] })),
224
- style: 'background:var(--sidebar);border-right:1px solid var(--border);display:flex;justify-content:center;padding-top:14px',
225
- hover: 'background:var(--accent)',
226
- }, label);
227
- return { btn, label };
228
- }
229
-
230
- const rail0 = makeRail('col0'); // the phone's folded navigation strip (legacy layout)
231
- const rail1 = makeRail('col1'); // a desktop's folded list
232
- const rail2 = makeRail('col2'); // a folded detail
233
- /* The list under the repositories, folded: one line, not a column (legacy layout). */
234
- const listBar = el('button', {
235
- onClick: () => setState((s) => ({ col1: !s.col1 })),
236
- title: 'show the list',
237
- style: 'background:var(--sidebar);border-right:1px solid var(--border);border-top:1px solid var(--border);display:flex;align-items:center;align-self:start;gap:6px;padding:8px 14px;min-height:34px;font-family:var(--mono);font-size:11px;letter-spacing:.06em;color:var(--muted-foreground);text-align:left',
238
- hover: 'background:var(--accent)',
239
- });
240
- rail0.label.textContent = 'repositories ⟩';
241
- /* overhaul-r1 R4: in live mode the collapsed repositories rail also carries one glyph per repository
242
- * (panel-repos.js#railGlyphs). Only the phone's legacy layout folds the navigation column now; a desktop's rail never folds. */
243
- const rail0Host = el('div', {
244
- role: 'button', tabindex: '0', title: 'show the repositories panel',
245
- onClick: () => setState((s) => ({ col0: !s.col0 })),
246
- onKeydown: (e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); setState((s) => ({ col0: !s.col0 })); } },
247
- style: 'background:var(--sidebar);border-right:1px solid var(--border);display:flex;flex-direction:column;align-items:center;min-height:0;overflow-y:auto;cursor:pointer',
248
- hover: 'background:var(--accent)',
249
- });
250
-
251
- /* `min-height:0` on all four: a grid item's automatic minimum is its content, so a panel taller
252
- * than the viewport would otherwise stretch the row it sits in rather than scroll inside it. */
253
- const HOST_STYLE = {
254
- repos: 'background:var(--sidebar);border-right:1px solid var(--border);display:flex;flex-direction:column;min-width:0;min-height:0;overflow-y:auto',
255
- inits: 'background:var(--sidebar);border-right:1px solid var(--border);overflow-y:auto;min-width:0;min-height:0',
256
- initsDesk: 'background:var(--sidebar);border-right:1px solid var(--border);display:flex;flex-direction:column;gap:12px;padding:12px;box-sizing:border-box;overflow:hidden;min-width:0;min-height:0',
257
- };
258
- const hostRepos = el('div', { id: 'pm-rail', style: HOST_STYLE.repos });
259
- const hostInits = el('div', { id: 'pm-list', style: HOST_STYLE.initsDesk });
260
- makeEdgeDrag(hostInits, 'col0W', W0, col0w);
261
- const hostDetail = el('div', { id: 'pm-detail', style: 'background:var(--sidebar);border-right:1px solid var(--border);overflow-y:auto;min-width:0;min-height:0;display:flex;flex-direction:column' });
262
- const hostTabs = el('div', { id: 'pm-tabs', class: 'lg-dock' });
263
-
264
- setChildren(root, [topBar, bodyGrid, statusBar, paletteHost]);
265
-
266
- /* ── panel modules, loaded at boot and tolerated when absent ────────────────────────────────── */
267
-
268
- const mods = { repos: null, inits: null, detail: null, tabs: null, data: null, fixture: null, cockpit: null };
269
-
270
- async function loadModules() {
271
- const want = [
272
- ['repos', './panel-repos.js'], ['inits', './panel-initiatives.js'],
273
- ['detail', './panel-detail.js'], ['tabs', './panel-tabs.js'],
274
- ['data', './data.js'], ['fixture', './fixture.js'], ['cockpit', './panel-cockpit.js'],
275
- ];
276
- await Promise.all(want.map(async ([key, path]) => {
277
- try { mods[key] = await import(path); } catch { mods[key] = null; }
278
- }));
279
- }
280
-
281
- /** Call a panel renderer, if it exists, without letting one panel take down the shell. */
282
- function paint(mod, name, host) {
283
- const fn = mod && mod[name];
284
- if (typeof fn !== 'function') { clear(host); return; }
285
- try { fn(host); } catch (e) { console.error('[pm] ' + name + ' failed:', e); }
286
- }
287
-
288
- /* ── render ────────────────────────────────────────────────────────────────────────────────── */
289
-
290
- /* The phone's folded navigation strip (legacy layout): one control that re-opens the panel, its first child the rotated label. */
291
- function railRepos() {
292
- const glyphs = mods.repos && typeof mods.repos.railGlyphs === 'function' ? mods.repos.railGlyphs() : [];
293
- if (!glyphs.length) {
294
- if (rail0.label.parentNode !== rail0.btn) rail0.btn.appendChild(rail0.label);
295
- return rail0.btn;
296
- }
297
- rail0.label.style.order = '2';
298
- rail0.label.style.paddingTop = '10px';
299
- setChildren(rail0Host, [rail0.label, el('div', { style: 'order:1;padding-top:8px;flex:none' }, glyphs)]);
300
- return rail0Host;
301
- }
302
-
303
- /* Where each host sits in the LEGACY grid. Column 1 holds the repositories (row 1) and the list under them (row 2); the detail and the
304
- * tabs span both rows. The repositories block is capped so a long list of repositories cannot push the list off the screen. A folded
305
- * column is a rail spanning both rows. On a phone the placement is cleared and mobile.css decides which single host is shown. On a
306
- * cockpit desktop every host has its own column and nothing is placed. */
307
- function placeHosts(legacy, phone, kids) {
308
- const cell = (el0, col, row) => { if (el0) { el0.style.gridColumn = col; el0.style.gridRow = row; } };
309
- const clear0 = (el0) => { el0.style.gridColumn = ''; el0.style.gridRow = ''; el0.style.maxHeight = ''; };
310
- for (const h of [hostRepos, hostInits, hostDetail, hostTabs, listBar, rail0.btn, rail0Host, rail1.btn, rail2.btn]) clear0(h);
311
- if (!legacy || phone) return;
312
- if (state.col0) {
313
- cell(hostRepos, '1', '1');
314
- hostRepos.style.maxHeight = 'calc((100vh - 70px) * .42)';
315
- cell(state.col1 ? hostInits : listBar, '1', '2');
316
- } else {
317
- const rail = kids.includes(rail0Host) ? rail0Host : rail0.btn;
318
- cell(rail, '1', '1 / 3');
319
- }
320
- cell(state.col2 ? hostDetail : rail2.btn, '2', '1 / 3');
321
- cell(hostTabs, '3', '1 / 3');
322
- }
323
-
324
- let lastLegacy = null;
325
- function render() {
326
- if (FRAME) return renderFrame();
327
- root.setAttribute('data-pm-theme', state.theme);
328
- document.documentElement.setAttribute('data-pm-page-theme', state.theme);
329
- const phone = isMobile();
330
- const legacy = legacyLayout();
331
- // the mockup's body line-height is 1.45; the legacy shell's panels are drawn for 1.5
332
- root.style.lineHeight = legacy ? '1.5' : '1.45';
333
- // the cockpit's bars are the mockup's 48px and 28px with their 1px rule outside that height (as its rail is 64px plus its rule);
334
- // the legacy shell keeps 48px and 28px rule included. A phone's stylesheet replaces the rows altogether.
335
- root.style.gridTemplateRows = legacy ? '48px minmax(0,1fr) 28px' : '49px minmax(0,1fr) 29px';
336
- // the cockpit's bars have no fill of their own (the root's --background shows through, as on the mockup); the legacy shell's do
337
- topBar.style.background = legacy ? 'var(--background)' : '';
338
- statusBar.style.background = legacy ? 'var(--background)' : '';
339
- // A cockpit desktop never shows a list mode in the list: it opens as a view tab (panel-cockpit.js)
340
- if (!legacy && mods.cockpit && typeof mods.cockpit.absorbMode === 'function' && mods.cockpit.absorbMode()) return;
341
-
342
- // overhaul-r1 R2.3: the active tab's line of work, when it is not the main tree
343
- const actTab = (state.tabs || []).find((t) => t.id === state.active);
344
- const br = actTab && mods.tabs && typeof mods.tabs.tabBranch === 'function' ? mods.tabs.tabBranch(actTab, true) : null;
345
- statusLeft.textContent = 'local · ' + runningCount() + ' sessions running' + (br ? ' · ⎇ ' + br : '');
346
- const parts = mods.cockpit && typeof mods.cockpit.breadcrumb === 'function' ? mods.cockpit.breadcrumb() : [];
347
- setChildren(crumb, parts);
348
- themeBtn.textContent = state.theme === 'dark' ? 'theme · dark' : 'theme · light';
349
- if (legacy && themeBtn.parentNode !== topBar) topBar.appendChild(themeBtn);
350
- if (!legacy && themeBtn.parentNode === topBar) topBar.removeChild(themeBtn);
351
-
352
- // Folded strips name whatever is behind them, so a PM who folded a panel away can still see what they folded.
353
- listBar.textContent = '▸ ' + modeTitle();
354
- rail1.label.textContent = 'initiatives ⟩';
355
- rail2.label.textContent = detailTitle() + ' ⟩';
356
-
357
- if (lastLegacy !== legacy) {
358
- lastLegacy = legacy;
359
- hostInits.setAttribute('style', legacy ? HOST_STYLE.inits + ';border-top:1px solid var(--border)' : HOST_STYLE.initsDesk);
360
- // the cockpit's rail is the mockup's centred column; the legacy repositories panel draws its own rows edge to edge
361
- hostRepos.style.alignItems = legacy ? '' : 'center';
362
- hostRepos.style.gap = legacy ? '' : '10px';
363
- hostRepos.style.padding = legacy ? '' : '12px 0';
364
- }
365
- const focus = false; // the Focus arrangement is cut (R29); BODY_GRID_STYLE keeps its third parameter so this line does not change
366
- bodyGrid.setAttribute('style', BODY_GRID_STYLE(legacy, phone, focus));
367
-
368
- // On a phone there are no rails to collapse into and no second column to fold away: the four hosts all stay mounted, one is
369
- // DISPLAYED (pm/mobile.css picks it from `data-mpanel`), and the PM's desktop arrangement is left exactly as they set it. Mounting
370
- // all four keeps a live terminal alive: a host dropped from this list would be removed from the document.
371
- let kids;
372
- if (phone) kids = [hostRepos, hostInits, hostDetail, hostTabs];
373
- else if (legacy) {
374
- const listHost = state.col1 ? hostInits : listBar;
375
- kids = [state.col0 ? hostRepos : railRepos(), state.col0 ? listHost : null, state.col2 ? hostDetail : rail2.btn, hostTabs].filter(Boolean);
376
- } else kids = [hostRepos, state.col1 ? hostInits : rail1.btn, state.col2 ? hostDetail : rail2.btn, hostTabs];
377
- setChildren(bodyGrid, kids);
378
- placeHosts(legacy, phone, kids);
379
-
380
- if (legacy) {
381
- if (phone || state.col0) paint(mods.repos, 'renderRepos', hostRepos);
382
- if (phone || (state.col0 && state.col1)) paint(mods.inits, 'renderInitiatives', hostInits);
383
- if (phone || state.col2) paint(mods.detail, 'renderDetail', hostDetail);
384
- } else {
385
- paint(mods.cockpit, 'renderRail', hostRepos);
386
- if (state.col1) paint(mods.cockpit, 'renderWorkList', hostInits);
387
- if (state.col2) paint(mods.detail, 'renderDetail', hostDetail);
388
- }
389
- paint(mods.tabs, 'renderTabs', hostTabs);
390
- paint(mods.cockpit, 'renderPalette', paletteHost);
391
- applyMobile();
392
- }
393
-
394
- /* ── the frame (pm-os-absorb Run 3, slice 3A; PRD R9, R10, R15) ──────────────────────────────
395
- * The default shell outside fixture mode and `?layout=legacy`. It REUSES the persistent hosts above: hostDetail moves
396
- * into the detail column, hostTabs (panel 4, the live terminals) is the dock and is never re-parented once the frame is
397
- * up, and hostRepos/hostInits are not mounted at all (there is no left sidebar). What is new:
398
- * hostMain the place on screen: one persistent host per destination ([data-fr-host]); registry.js
399
- * mountDestTab gives each its data-dest and draws the destination, or "<Label> arrives in Run N."
400
- * the top bar topbar.js
401
- * the dock rail dock.js; the dock is OPEN on Today and a 44px rail elsewhere. It never opens by itself: a tab
402
- * opened while it is a rail waits in it. ⌘J and the rail's control toggle it.
403
- * Destination, repository scope and Repository ▾ live here; what the PM picks is kept in this browser (FRAME_KEY).
404
- * The detail column is `state.col2`: anything that sets `col2: true` (the palette, an initiative opener, Settings ›
405
- * Profiles) opens it, and its close control or Esc sets it back to false. */
406
-
407
- const FRAME = !FIXTURE && !LEGACY_LAYOUT_FLAG;
408
- const FRAME_KEY = 'pmos.workspace.pm.frame';
409
- const FRAME_DESTS = Object.freeze(['today', 'mywork', 'initiatives', 'board', 'reports', 'docs', 'notes', 'people', 'settings']);
410
-
411
- function readFrame() {
412
- if (!FRAME) return {};
413
- try { const j = JSON.parse(localStorage.getItem(FRAME_KEY) || 'null'); return j && typeof j === 'object' ? j : {}; } catch { return {}; }
414
- }
415
- const fr = (() => {
416
- const s = readFrame();
417
- return { dest: FRAME_DESTS.includes(s.dest) ? s.dest : 'today', scope: s.scope === 'all' ? 'all' : 'repo', params: {}, dock: {}, dockMax: false, dockW: null, dockSize: null, syncing: false, reg: null, gAt: 0, needs: 0 };
418
- })();
419
- function writeFrame() {
420
- try { localStorage.setItem(FRAME_KEY, JSON.stringify({ dest: fr.dest, scope: fr.scope })); } catch { /* private mode: the default stands */ }
421
- }
422
-
423
- const activeRepo = () => (mods.repos && typeof mods.repos.activeProduct === 'function' ? mods.repos.activeProduct() : state.product || null);
424
- /** The dock on the current destination: what the PM chose here with ⌘J or the rail, else open on Today only. */
425
- const dockOpen = () => !!fr.dockMax || (Object.prototype.hasOwnProperty.call(fr.dock, fr.dest) ? fr.dock[fr.dest] : fr.dest === 'today');
426
-
427
- function go(id, params) {
428
- if (!FRAME_DESTS.includes(id)) return false;
429
- const p = params || {};
430
- if (p.repo) chooseRepo(p.repo);
431
- fr.dest = id;
432
- fr.params = { repo: p.repo || null, slug: p.slug || null };
433
- writeFrame();
434
- setState({ menuOpen: false, paletteOpen: false });
435
- return true;
436
- }
437
- function setDock(open) { fr.dock[fr.dest] = !!open; if (!open) fr.dockMax = false; setState({}); }
438
- const toggleDock = () => setDock(!dockOpen());
439
- const foldDock = () => setDock(false);
440
- const openDock = () => setDock(true);
441
- /* Focus (0.53.1): the dock takes the whole window, on every destination, until the PM leaves it. It opens the dock. */
442
- function toggleFocus() {
443
- fr.dockMax = !fr.dockMax;
444
- if (fr.dockMax) fr.dock[fr.dest] = true;
445
- setState({});
446
- }
447
- /* Dock size: set the dock to one of four preset sizes, or to focus mode.
448
- * Normal: default width (no CSS override). Half: 50vw. Two-thirds: 66.667vw (the body spans the window).
449
- * Focus: the dock takes the whole window (same as toggleFocus). */
450
- const DOCK_SIZE_KEY = 'pmos.workspace.pm.dock-size';
451
- const DOCK_SIZES = ['normal', 'half', 'two-thirds'];
452
- function readDockSize() {
453
- if (!FRAME) return null;
454
- let v = null;
455
- try { v = localStorage.getItem(DOCK_SIZE_KEY) || null; } catch { v = null; }
456
- return v === 'half' || v === 'two-thirds' ? v : null;
457
- }
458
- function setDockSize(next) {
459
- if (!FRAME) return;
460
- if (next === 'whole') {
461
- if (!fr.dockMax) toggleFocus();
462
- return;
463
- }
464
- if (!DOCK_SIZES.includes(next)) return;
465
- // A preset replaces a dragged pixel width, and leaving focus returns to the size chosen here.
466
- fr.dockW = null;
467
- try { localStorage.removeItem(DOCK_W_KEY); } catch { /* private mode */ }
468
- fr.dockSize = next === 'normal' ? null : next;
469
- try { if (fr.dockSize) localStorage.setItem(DOCK_SIZE_KEY, fr.dockSize); else localStorage.removeItem(DOCK_SIZE_KEY); } catch { /* private mode */ }
470
- fr.dockMax = false;
471
- fr.dock[fr.dest] = true;
472
- paintDockWidth();
473
- setState({});
474
- }
475
- /* The dock's width, chosen with the grip (0.53.1). Kept in this browser like the dock's other per-window choices;
476
- * null is the default width. */
477
- const DOCK_W_KEY = 'pmos.workspace.pm.dock-width';
478
- function readDockW() {
479
- if (!FRAME) return null;
480
- let v = null;
481
- try { v = Number(localStorage.getItem(DOCK_W_KEY)); } catch { v = null; }
482
- return Number.isFinite(v) && v > 0 ? v : null;
483
- }
484
- const dockWidth = {
485
- get: () => fr.dockW,
486
- set: (px) => {
487
- fr.dockW = Number.isFinite(px) && px > 0 ? Math.round(px) : null;
488
- fr.dockSize = null; // dragging the grip, or a double-click, replaces a preset
489
- try { if (fr.dockW) localStorage.setItem(DOCK_W_KEY, String(fr.dockW)); else localStorage.removeItem(DOCK_W_KEY); } catch { /* private mode */ }
490
- if (!fr.dockSize) try { localStorage.removeItem(DOCK_SIZE_KEY); } catch { /* private mode */ }
491
- paintDockWidth();
492
- },
493
- };
494
- function paintDockWidth() {
495
- let v = '';
496
- if (fr.dockW) {
497
- v = fr.dockW + 'px';
498
- } else if (fr.dockSize === 'half') {
499
- v = '50vw';
500
- } else if (fr.dockSize === 'two-thirds') {
501
- v = '66.667vw';
502
- }
503
- if (bodyGrid.style.getPropertyValue('--fr-dock-w') !== v) {
504
- if (v) bodyGrid.style.setProperty('--fr-dock-w', v); else bodyGrid.style.removeProperty('--fr-dock-w');
505
- }
506
- }
507
- function chooseRepo(name) {
508
- fr.scope = 'repo';
509
- writeFrame();
510
- if (name && name !== state.product && mods.repos && typeof mods.repos.selectRepo === 'function') mods.repos.selectRepo(name);
511
- setState({ todayScope: 'repo' });
512
- }
513
- function chooseAll() { fr.scope = 'all'; writeFrame(); setState({ todayScope: 'all' }); }
514
- const openPalette = () => setState({ paletteOpen: true, menuOpen: false });
515
- const closeDetail = () => setState({ col2: false });
516
-
517
- function repoMenu(anchor) {
518
- const tuples = mods.repos && typeof mods.repos.repoTuples === 'function' ? mods.repos.repoTuples() : [];
519
- const cur = fr.scope === 'all' ? null : activeRepo();
520
- const items = tuples.map((t) => ({ label: t[0], icon: t[0] === cur ? 'check' : null, onSelect: () => chooseRepo(t[0]) }));
521
- if (items.length) items.push({ sep: true });
522
- items.push({ label: FC.repo.all, icon: fr.scope === 'all' ? 'check' : null, onSelect: chooseAll });
523
- // 0.55.1: Branches and sessions left this menu; the dock lists the sessions, and ⌘K still opens the sheet
524
- menu({ anchor, items, ariaLabel: FC.repo.menu });
525
- }
526
-
527
- /* Branches and sessions (0.54.1): the legacy panel 1's working trees, which the frame never drew. The current repository,
528
- * or every repository when the scope is All. */
529
- function openBranchesSheet() {
530
- const tuples = mods.repos && typeof mods.repos.repoTuples === 'function' ? mods.repos.repoTuples() : [];
531
- const cur = fr.scope === 'all' ? null : activeRepo();
532
- const repos = cur ? [cur] : tuples.map((t) => t[0]);
533
- import('./branches-sheet.js').then((m) => m.openBranches(repos)).catch((e) => console.error('[pm] could not open the branches:', e));
534
- }
535
- if (FRAME) registerCommand({ id: 'branches-open', label: FC.repo.branches, hint: FC.branches.hint, cli: 'git worktree list', run: () => openBranchesSheet() });
536
-
537
- /* Sync: the bar shows it only while the current repository is not in sync. The reading is local git (GET
538
- * /api/sync/status), re-read a minute after the last one and at once after a Sync. */
539
- const syncSeen = new Map(); // repo -> { at, st, pending }
540
- function syncReading(repo) {
541
- const d = mods.data;
542
- if (!repo || !d || typeof d.syncStatusOf !== 'function' || (typeof d.wsOf === 'function' && !d.wsOf(repo))) return null;
543
- const have = syncSeen.get(repo);
544
- if (!have || (!have.pending && Date.now() - have.at > 60000)) {
545
- const e = { at: Date.now(), st: have ? have.st : null, pending: true };
546
- syncSeen.set(repo, e);
547
- Promise.resolve(d.syncStatusOf(repo)).then((st) => { e.st = st; e.at = Date.now(); e.pending = false; setState({}); })
548
- .catch(() => { e.pending = false; e.at = Date.now(); });
549
- }
550
- return syncSeen.get(repo).st;
551
- }
552
- async function runSync(prefer) {
553
- const repo = fr.scope === 'all' ? null : activeRepo();
554
- if (!repo || fr.syncing || !mods.data || typeof mods.data.syncRepository !== 'function') return;
555
- fr.syncing = true;
556
- setState({});
557
- let res;
558
- const opts = prefer === 'mine' || prefer === 'theirs' ? { prefer } : undefined;
559
- try { res = await mods.data.syncRepository(repo, opts); } catch (e) { res = { ok: false, message: String((e && e.message) || e) }; }
560
- fr.syncing = false;
561
- syncSeen.delete(repo);
562
- setState({});
563
- // Both machines changed the same lines and nothing changed: the PM chooses which version to keep (D70 amended
564
- // 2026-10-07). The server offers the choice only once per press, so a choice that still stops ends in the toast.
565
- if (res && !res.ok && res.conflict) return chooseSyncSide(res.conflict.files || []);
566
- toast({ text: res && res.ok ? FC.sync.done : FC.sync.stopped((res && (res.stopped_at || res.step)) || FC.sync.label, (res && (res.message || res.error)) || '') });
567
- }
568
- function chooseSyncSide(files) {
569
- const C = FC.sync.conflict;
570
- let s = null;
571
- const pick = (side) => () => { s.close(); runSync(side); };
572
- s = sheet({
573
- title: C.title, sub: C.sub(files), body: [el('p', {}, C.body)], attrs: { 'data-sync-conflict': '' },
574
- actions: [
575
- button({ label: C.push, variant: 'primary', onClick: pick('mine'), attrs: { 'data-sync-prefer': 'mine' } }),
576
- button({ label: C.pull, onClick: pick('theirs'), attrs: { 'data-sync-prefer': 'theirs' } }),
577
- button({ label: C.cancel, variant: 'ghost', onClick: () => s.close() }),
578
- ],
579
- });
580
- }
581
-
582
- /* Closing the tab with work that is not yet pushed asks first (D70 as amended 2026-10-06): idle auto-sync waits for a
583
- * few quiet minutes, and a laptop closed inside that window would carry the work away unsynced. The reading is the
584
- * last local one for each repository; a stale or unread reading never asks. */
585
- function unpushedOf(st) {
586
- // only a repository with an upstream: one with none has nowhere to push, and would ask on every close for ever
587
- return !!st && st.ok !== false && !!st.upstream && ((st.ahead | 0) > 0 || (st.dirty_records | 0) > 0);
588
- }
589
- if (FRAME) {
590
- window.addEventListener('beforeunload', (e) => {
591
- if (![...syncSeen.values()].some((v) => unpushedOf(v.st))) return;
592
- e.preventDefault();
593
- e.returnValue = '';
594
- });
595
- }
596
-
597
- let bar = null;
598
- let dockRail = null;
599
- let frDetail = null;
600
- const hostMain = el('div', { class: 'fr-main', 'data-fr': 'main' });
601
- const destHosts = {};
602
- for (const id of FRAME_DESTS) destHosts[id] = el('div', { class: 'fr-dest', 'data-fr-host': id, hidden: true });
603
- // each place keeps its reading position when it redraws through a short state (dom.js keepScroll)
604
- for (const id of FRAME_DESTS) keepScroll(destHosts[id]);
605
- const frEnd = el('span', { class: 'fr-end', 'aria-hidden': 'true' });
606
-
607
- function setupFrame() {
608
- ensureComponentsCss();
609
- ensureSprite();
610
- // panel-cockpit.js loads on first use: importing it statically here broke the legacy detail column's fold control (ui-test AC1)
611
- const openView = (v) => import('./panel-cockpit.js').then((m) => m.openView(v));
612
- bar = createTopbar({ go, openPalette, openView, repoMenu, sync: runSync });
613
- document.addEventListener('pointerdown', (e) => { fr.downAt = e.target; }, true);
614
- dockRail = createDockRail({ open: openDock, resize: dockWidth });
615
- fr.dockW = readDockW();
616
- fr.dockSize = readDockSize();
617
- frDetail = el('div', { class: 'fr-detail', 'data-fr': 'detail' },
618
- el('div', { class: 'fr-detail__bar' }, iconButton({ icon: 'x', ariaLabel: FC.detail.close, onClick: closeDetail, attrs: { 'data-fr': 'detail-close' } })),
619
- hostDetail);
620
- root.removeAttribute('style');
621
- root.classList.add('fr-root');
622
- bodyGrid.removeAttribute('style');
623
- bodyGrid.classList.add('fr-body');
624
- hostTabs.classList.add('fr-dock');
625
- setChildren(root, [bar.node, bodyGrid, paletteHost, frEnd]);
626
- // the frame opens with no detail: the column comes when something opens one
627
- setState({ col2: false, todayScope: fr.scope });
628
- }
629
-
630
- function paintMain() {
631
- // the state-health banner (panel-repos.js) heads every place while the runtime state is not settled: it is not
632
- // dismissible, and the frame has no repository panel for it to sit in
633
- let banner = null;
634
- try { banner = mods.repos && typeof mods.repos.stateHealthBanner === 'function' ? mods.repos.stateHealthBanner() : null; } catch { banner = null; }
635
- // On a phone, search and capture are the top bar's search control (pm/mobile.js), not a second control above Today:
636
- // a phone screen leads with its one job.
637
- const kids = [banner, ...FRAME_DESTS.map((id) => destHosts[id])];
638
- setChildren(hostMain, kids);
639
- for (const id of FRAME_DESTS) destHosts[id].hidden = id !== fr.dest;
640
- const reg = fr.reg;
641
- if (!reg) return;
642
- const host = destHosts[fr.dest];
643
- const scope = fr.scope;
644
- try {
645
- reg.mountDestTab(host, {
646
- id: 'frame:' + fr.dest, kind: 'dest', view: fr.dest, title: FC.nav[fr.dest], role: fr.dest,
647
- repo: scope === 'all' ? null : (fr.params.repo || activeRepo()), slug: fr.params.slug || null, scope,
648
- });
649
- } catch (e) { console.error('[pm] destination ' + fr.dest + ' failed:', e); }
650
- }
651
-
652
- function renderFrame() {
653
- root.setAttribute('data-pm-theme', state.theme);
654
- document.documentElement.setAttribute('data-pm-page-theme', state.theme);
655
- if (mods.cockpit && typeof mods.cockpit.absorbMode === 'function' && mods.cockpit.absorbMode()) return;
656
- const phone = isMobile();
657
- const repo = fr.scope === 'all' ? null : activeRepo();
658
- const st = repo ? syncReading(repo) : null;
659
- let needs = 0;
660
- try { needs = mods.cockpit && typeof mods.cockpit.needsCount === 'function' ? mods.cockpit.needsCount() : 0; } catch { needs = 0; }
661
- fr.needs = needs;
662
- fr.unsynced = unsyncedOf(st); // the phone bar (mobile.js) shows Sync on the same reading
663
- bar.update({ dest: fr.dest, repoLabel: fr.scope === 'all' ? FC.repo.all : repo, needs, unsynced: fr.unsynced, syncing: fr.syncing });
664
- const open = dockOpen();
665
- bodyGrid.setAttribute('data-fr-dock', phone ? 'phone' : open ? (fr.dockMax ? 'max' : 'open') : 'rail');
666
- paintDockWidth();
667
- const detail = !!state.col2;
668
- // Four children in every arrangement, hostTabs the fourth and last, so setChildren never moves it (a moved xterm loses
669
- // its grid) and a reader of the body's fourth child still finds panel 4. A closed detail stays mounted, hidden.
670
- frDetail.hidden = !phone && !detail;
671
- setChildren(bodyGrid, phone ? [hostMain, dockRail, frDetail, hostTabs] : [hostMain, frDetail, dockRail, hostTabs]);
672
- paintMain();
673
- if (detail || phone) paint(mods.detail, 'renderDetail', hostDetail);
674
- paint(mods.tabs, 'renderTabs', hostTabs);
675
- paint(mods.cockpit, 'renderPalette', paletteHost);
676
- applyMobile();
677
- }
678
-
679
- /* The frame's keys. A key typed into a field, a terminal or an open sheet or palette is the field's. */
680
- const ROW_SEL = [SEL.row, SEL.card, '[data-fr-row]'].join(', ');
681
- function typingIn(t) {
682
- if (!t || t.nodeType !== 1) return false;
683
- return /^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName) || t.isContentEditable || !!(t.closest && t.closest('.xterm'));
684
- }
685
- function shown(n) { return !!n && n.getClientRects().length > 0 && !n.closest('[hidden]'); }
686
- function rowsHere() {
687
- const scope = [destHosts[fr.dest], state.col2 ? frDetail : null].filter(Boolean);
688
- const out = [];
689
- for (const s of scope) for (const r of s.querySelectorAll(ROW_SEL)) if (shown(r) && !out.some((x) => x.contains(r))) out.push(r);
690
- return out;
691
- }
692
- const OPEN_SEL = [SEL.rowOpen, SEL.cardOpen].join(', ');
693
- const openTarget = (r) => r.querySelector(OPEN_SEL) || r.querySelector('button') || r;
694
- function pressIn(r, key) {
695
- const b = r && r.querySelector('[data-key~="' + key + '"]');
696
- if (b && !b.disabled) { b.click(); return true; }
697
- return false;
698
- }
699
- const G_KEYS = { t: 'today', i: 'initiatives', b: 'board', r: 'reports', d: 'docs', n: 'notes', p: 'people', w: 'mywork' };
700
-
701
- function frameKey(e) {
702
- const mod = e.metaKey || e.ctrlKey;
703
- if (mod && (e.key === 'k' || e.key === 'K')) { e.preventDefault(); setState({ paletteOpen: !state.paletteOpen, menuOpen: false }); return; }
704
- if (mod && (e.key === 'j' || e.key === 'J')) { e.preventDefault(); if (!isMobile()) { if (e.shiftKey) toggleFocus(); else toggleDock(); } return; }
705
- if (e.key === 'Escape') {
706
- if (state.paletteOpen) { setState({ paletteOpen: false }); return; }
707
- if (state.menuOpen) { setState({ menuOpen: false }); return; }
708
- if (modalOpen() || typingIn(e.target)) return;
709
- if (state.col2 && !hostTabs.contains(e.target)) { closeDetail(); return; }
710
- // Esc closes the active tab only while the dock is open, and only from the dock or from nowhere in particular (the
711
- // page itself): an Esc pressed in the place or the detail never closes a tab, and a folded dock keeps its tabs. A
712
- // click on blank space leaves the focus on the page, so the last pointer press says where the PM was.
713
- const down = fr.downAt && fr.downAt.isConnected ? fr.downAt : null;
714
- const inPlace = !!down && (hostMain.contains(down) || (!!frDetail && frDetail.contains(down)));
715
- const fromPage = (!e.target || e.target === document.body || e.target === document.documentElement) && !inPlace;
716
- if (dockOpen() && !isMobile() && (hostTabs.contains(e.target) || fromPage)) {
717
- setState((s) => {
718
- if (!s.active) return null;
719
- const rest = s.tabs.filter((t) => t.id !== s.active);
720
- return { tabs: rest, active: rest.length ? rest[rest.length - 1].id : null, splitId: s.splitId === s.active ? null : s.splitId };
721
- });
722
- }
723
- return;
724
- }
725
- if (mod || state.paletteOpen || modalOpen() || typingIn(e.target) || hostTabs.contains(e.target)) return;
726
- const k = e.key;
727
- if (!e.altKey && fr.gAt && Date.now() - fr.gAt < 1200 && G_KEYS[k]) { fr.gAt = 0; e.preventDefault(); go(G_KEYS[k]); return; }
728
- fr.gAt = !e.altKey && k === 'g' ? Date.now() : 0;
729
- if (k === 'g') return;
730
- const a = document.activeElement;
731
- const cur = a && a !== document.body ? a.closest(ROW_SEL) : null;
732
- if (k === 'j' || k === 'k') {
733
- const rows = rowsHere();
734
- if (!rows.length) return;
735
- e.preventDefault();
736
- const at = cur ? rows.findIndex((r) => r === cur || r.contains(cur) || cur.contains(r)) : -1;
737
- const next = at < 0 ? (k === 'j' ? 0 : rows.length - 1) : Math.min(rows.length - 1, Math.max(0, at + (k === 'j' ? 1 : -1)));
738
- openTarget(rows[next]).focus();
739
- return;
740
- }
741
- if (!cur) return;
742
- if (k === 'Enter' && a === cur) { e.preventDefault(); openTarget(cur).click(); return; }
743
- // Space ticks and never opens: on a row, or on the row's open target, it presses the row's tick control, or nothing.
744
- // On any other button of the row (⋯, a card's own button) Space is the browser's: it presses that button.
745
- if (k === ' ') {
746
- if (a !== cur && !(a.matches(OPEN_SEL) && a.closest(ROW_SEL) === cur)) return;
747
- e.preventDefault(); pressIn(cur, 'space'); return;
748
- }
749
- if (e.altKey && (k === 'ArrowUp' || k === 'ArrowDown')) { if (pressIn(cur, k === 'ArrowUp' ? 'alt-up' : 'alt-down')) e.preventDefault(); return; }
750
- if (!e.altKey && (k === 'a' || k === 'x')) { if (pressIn(cur, k)) e.preventDefault(); }
751
- }
752
-
753
- /* What the suites and the phone chrome reach the frame by. */
754
- const frameApi = {
755
- on: true, go, toggleDock, foldDock, openDock, toggleFocus, setDockSize, dockWidth, chooseRepo, chooseAll, openPalette, repoMenu, openBranchesSheet, closeDetail, sync: runSync,
756
- get unsynced() { return !!fr.unsynced; },
757
- get dest() { return fr.dest; }, get scope() { return fr.scope; }, get dockOpen() { return dockOpen(); }, get dockMax() { return !!fr.dockMax; }, get dockSize() { return fr.dockSize || 'normal'; },
758
- get detailOpen() { return !!state.col2; }, get syncing() { return fr.syncing; }, get needs() { return fr.needs || 0; },
759
- };
760
-
761
- /* ── keyboard ──────────────────────────────────────────────────────────────────────────────── */
762
-
763
- function focusSearch() {
764
- const input = document.querySelector('[data-pm-search]')
765
- || document.querySelector('input[placeholder="search everything…"]');
766
- if (input) input.focus();
767
- }
768
-
769
- /** Is a modal <dialog> open? (`:modal` where the browser knows it, else any open dialog.) */
770
- function modalOpen() {
771
- try { return !!document.querySelector('dialog:modal'); } catch { return !!document.querySelector('dialog[open]'); }
772
- }
773
-
774
- function onKeyDown(e) {
775
- if (FRAME) { frameKey(e); return; }
776
- if ((e.metaKey || e.ctrlKey) && (e.key === 'k' || e.key === 'K')) {
777
- e.preventDefault();
778
- // the cockpit's ⌘K is the palette; the legacy layout (and a phone) keep focusing the list's filter
779
- if (legacyLayout()) setState({ col1: true, menuOpen: false }, focusSearch);
780
- else setState({ paletteOpen: !state.paletteOpen, menuOpen: false });
781
- return;
782
- }
783
- if (e.key === 'Escape' && state.paletteOpen) { setState({ paletteOpen: false }); return; }
784
- if (e.key === 'Escape' && state.menuOpen) { setState({ menuOpen: false }); return; }
785
- // A modal sheet (the Breakdown's item sheet) handles its own Escape; one Escape never closes the sheet AND the tab.
786
- if (e.key === 'Escape' && modalOpen()) return;
787
- if (e.key === 'Escape' && !/INPUT|TEXTAREA/.test(e.target && e.target.tagName)) {
788
- // Verbatim from the prototype: Esc closes the ACTIVE tab, the last remaining tab takes over,
789
- // and a split pointing at the closed tab is dropped rather than left dangling.
790
- setState((s) => {
791
- if (!s.active) return null;
792
- const rest = s.tabs.filter((t) => t.id !== s.active);
793
- return {
794
- tabs: rest,
795
- active: rest.length ? rest[rest.length - 1].id : null,
796
- splitId: s.splitId === s.active ? null : s.splitId,
797
- };
798
- });
799
- }
800
- }
801
-
802
- /* ── boot ──────────────────────────────────────────────────────────────────────────────────── */
803
-
804
- async function boot() {
805
- document.body.appendChild(root);
806
- subscribe(render);
807
- window.addEventListener('keydown', onKeyDown);
808
- if (FRAME) setupFrame();
809
- mountMobile({ bodyGrid, render, frame: FRAME ? frameApi : null }); // wires the phone chrome; inert above 760px
810
- render(); // the shell is on screen before any panel module has resolved
811
- await loadModules();
812
- render();
813
- /* pm-os-absorb Runs 2–5: the destinations and extensions each run adds (pm/registry.js), loaded after the panels and
814
- * never in fixture mode. A module that is not on disk is not an error. `pmApp.open(id)` opens a destination. */
815
- if (!FIXTURE) {
816
- try {
817
- const reg = await import('./registry.js'); window.pmApp.open = reg.openDestination; await reg.loadExtensions(); window.pmApp.registry = reg;
818
- if (FRAME) { reg.setFrameHome((id, p) => go(id, p)); fr.reg = reg; } // the frame: pmApp.open(id) is the place on screen
819
- }
820
- catch (e) { console.error('[pm] the registry failed to load:', e); }
821
- // meeting-notes Run 6: the note being taken stays at the bottom right on every destination
822
- import('./note-dock.js').then((m) => m.mountDock()).catch((e) => console.error('[pm] the note dock failed to load:', e));
823
- render();
824
- }
825
- }
826
-
827
- /* A tiny surface for the browser suite and for a panel module that needs to force a paint. */
828
- window.pmApp = { root, render, state, setState, flush, fixture: FIXTURE, mods, hosts: { hostRepos, hostInits, hostDetail, hostTabs } };
829
- if (FRAME) { window.pmApp.frame = frameApi; window.pmApp.hosts.hostMain = hostMain; }
830
-
831
- boot();