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,1513 +0,0 @@
1
- /* pm/panel-detail.js — panel 3, the initiative detail.
2
- *
3
- * A PORT of the prototype's column 2 (template lines 330–448 for the `dInit` branch, derivation
4
- * lines 1699–1806). Every inline `style` string below is copied from that file character for
5
- * character and every literal string is the prototype's literal. The acceptance bar for this
6
- * surface is a mechanical diff of text, computed style and geometry, so a re-worded label or a
7
- * "tidied" padding is a defect, not an improvement.
8
- *
9
- * ── What this panel is ──────────────────────────────────────────────────────────────────────
10
- * Panel 3 answers one question about one initiative: what is the state of the work, and what can
11
- * I open? Top to bottom: the slug + tag + pills header, LINKS (external references that are deliberately
12
- * NOT repo files), ARTIFACTS (repo files, each optionally linked to an external destination with a
13
- * repo-is-source sync panel), and the derived footer line.
14
- *
15
- * ── Two structural facts the port has to honour ─────────────────────────────────────────────
16
- *
17
- * 1. INTERPOLATIONS ARE WRAPPED. The prototype's runtime renders every `{{ expr }}` as a
18
- * `<span>` INSIDE the styled element, while literal template text stays a bare text node. The
19
- * comparator indexes nodes by their own text and then diffs computed style and geometry, so a
20
- * value placed directly on the styled element would be measured as a different box. `iv()`
21
- * reproduces the wrapper; bare text is used exactly where the template has bare text — `+`,
22
- * `⇄`, `·`, `→ repo`, `adopt`, `link`, `next`, the note lines and the two headings.
23
- *
24
- * 2. NOTHING DERIVABLE IS STORED (D33). Link lists and the footer line are all computed at read time,
25
- * every render, from the initiative record plus the state maps the prototype keeps (`initLinks`,
26
- * `artLinks`, `artSyncOpen`/`artSyncState`). The work itself (items, their state) is the Breakdown's;
27
- * the phases with synthetic rung tasks are cut (R29), and so is the Task tab that opened them.
28
- *
29
- * ── Where the data comes from ───────────────────────────────────────────────────────────────
30
- * Fixture mode reads `fixture.js` directly. Normal mode is the same code path with the optional
31
- * overrides the data layer publishes into state — `state.records` ({slug: record}) and
32
- * `state.board` ({repoId: group[]}). In normal mode the seed data is NEVER reachable: fixture rows
33
- * rendering in the real app is "the beautiful shell" the PRD names as a failure mode.
34
- *
35
- * ── The one place the design's fiction is refused ────────────────────────────────────────────
36
- * The artifact sync panel keeps the design's SHAPE — the statement, then the two approvals — and
37
- * replaces its claims. In FIXTURE mode the prototype's copy renders verbatim, because the parity
38
- * comparator measures this surface against the design file and a re-worded label is a defect there.
39
- * In real mode the panel says only what a row in the store says: nothing chosen yet, a direction
40
- * proposed and unreported, or a named session's write at a named time. The design's
41
- * `2 sections differ` and `in sync 12:41` are unreachable from the real path — a difference summary
42
- * over a destination nobody contacted is precisely the watermelon this repo has a word for.
43
- *
44
- * The two approvals ACT. They record the direction the PM chose and show the task a session will
45
- * run; they do not sync, because PMOS holds no credential and makes no outbound request (D53). The
46
- * property that has to survive every future change to this file: there is no path from a click to a
47
- * rendered claim about a destination without a profile in between.
48
- */
49
-
50
- import { el, setChildren } from './dom.js';
51
- import { state, setState, FIXTURE, LEGACY_LAYOUT_FLAG } from './state.js';
52
- import { isMobile } from './mobile.js';
53
- import * as FX from './fixture.js';
54
- import { openDoc, openTerm, fileNewModel } from './panel-initiatives.js';
55
- import { addProductBody } from './panel-repos.js';
56
- import { lifecycleRow } from './lifecycle.js';
57
- import { statusBanner, lifecycleNotes } from './status-banner.js';
58
- import { stepActions } from './next-step-ui.js';
59
- import { boardOf, records, currentProduct } from './board-read.js';
60
- import { breakdownEntry } from './panel-breakdown.js';
61
- import { askConfirm } from './dialogs.js';
62
- import { button } from './primitives.js';
63
-
64
- /** The cockpit's own look of this panel (workspace-cockpit-nav): the mockup's header, chips and phase rows. A phone and `?layout=legacy`
65
- * keep the prototype's look, which the older suites and the phone still read. */
66
- const cockpitLook = () => !LEGACY_LAYOUT_FLAG && !isMobile();
67
-
68
- /* ── the prototype's small helpers ─────────────────────────────────────────────────────────── */
69
-
70
- /** `{{ expr }}` — an interpolated value, wrapped the way the prototype's runtime wraps it. */
71
- const iv = (v) => el('span', null, v === null || v === undefined ? '' : String(v));
72
-
73
- /* ── late-bound siblings ────────────────────────────────────────────────────────────────────
74
- * panel-tabs.js owns tab creation and data.js owns the file-mode append. Both are imported
75
- * LAZILY: a static import of a module that is not on disk yet takes this whole panel down, and a
76
- * blank panel 3 is worse than a panel that opens a tab through the shared `openTab` fallback.
77
- * Neither import changes what is rendered — only who records the side effect.
78
- */
79
- const mods = { tabs: undefined, data: undefined }; // undefined = untried · null = unavailable
80
-
81
- /**
82
- * Resolve a sibling module without a boot-time request. app.js already imports both at boot and
83
- * publishes them on `window.pmApp.mods`, so the common path costs nothing; the dynamic import is
84
- * only the fallback for a page that came up without the shell's loader. A module that is not on
85
- * disk yet resolves to null and the caller degrades — it never takes this panel down.
86
- */
87
- function sibling(key, path) {
88
- if (mods[key] !== undefined) return mods[key];
89
- const shell = window.pmApp && window.pmApp.mods && window.pmApp.mods[key];
90
- if (shell) { mods[key] = shell; return shell; }
91
- mods[key] = null;
92
- import(path).then((m) => { mods[key] = m; }).catch(() => { mods[key] = null; });
93
- return null;
94
- }
95
-
96
- /**
97
- * Record a link declaration in file-mode state, if the data layer offers that write. A link is a
98
- * DECLARATION — `{artifact_path, kind, target}` — never an outbound call: PMOS holds no credential
99
- * and makes no external request (PRD, "External sync").
100
- */
101
- function declare(fn, payload) {
102
- if (FIXTURE) return; // the fixture is a render, never a write
103
- const data = sibling('data', './data.js');
104
- const write = data && data[fn];
105
- if (typeof write === 'function') { try { write(payload); } catch { /* the UI still shows it */ } }
106
- }
107
-
108
- /* ── the board, read the same way panel 2 reads it (board-read.js — one derivation) ────────── */
109
-
110
- function baseGroups(product) {
111
- const board = boardOf();
112
- if (board[product]) return board[product];
113
- return FIXTURE && !state.board ? (FX.ALLGROUPS[product] || FX.ALLGROUPS.workspace) : [];
114
- }
115
-
116
- /** The initiative showing when nothing has been picked yet (line 1397). */
117
- function selectedSlug() {
118
- if (state.sel !== null && state.sel !== undefined) return state.sel;
119
- const g0 = baseGroups(currentProduct())[0];
120
- return g0 && g0.slugs && g0.slugs.length ? g0.slugs[0] : null;
121
- }
122
-
123
- /** Which repository owns each slug (lines 1963–1965) — tabs are scoped by it. */
124
- function repoOf(slug) {
125
- const boards = boardOf();
126
- for (const prod of Object.keys(boards)) {
127
- for (const g of boards[prod] || []) if ((g.slugs || []).includes(slug)) return prod;
128
- }
129
- for (const key of Object.keys(state.addedInits || {})) {
130
- if ((state.addedInits[key] || []).includes(slug)) return key.split('|')[0];
131
- }
132
- return currentProduct();
133
- }
134
-
135
- /* ── connector honesty (PRD, "External sync") ───────────────────────────────────────────────
136
- * Fixture mode renders the design's copy so the diff is like-for-like. Real mode asks the data
137
- * layer whether a connector for this destination exists; with none, the summary says nothing was
138
- * read and the two approvals are inert. `state.connectors` accepts either shape a data layer is
139
- * likely to publish — a list of kinds, or a map of kind → truthy.
140
- */
141
- function hasConnector(kind) {
142
- if (FIXTURE) return true;
143
- const c = state.connectors;
144
- if (Array.isArray(c)) {
145
- return c.some((x) => (typeof x === 'string' ? x : x && x.kind) === kind
146
- && (typeof x === 'string' || x.configured !== false));
147
- }
148
- // The server's shape: `{configured:[{kind, profile, ...}], note}`. Checked BEFORE the plain-map
149
- // branch below, which would otherwise read `c['jira']` on this object, find undefined, and report
150
- // "no connector" on a machine whose profiles declare one — a false negative dressed as caution.
151
- if (c && Array.isArray(c.configured)) return c.configured.some((x) => x && x.kind === kind);
152
- if (c && typeof c === 'object') return !!c[kind];
153
- return false;
154
- }
155
-
156
- const NO_CONNECTOR = 'no connector configured — nothing was read, and nothing will be written.';
157
-
158
- /**
159
- * What the two sync approvals now do, and why they stopped being inert.
160
- *
161
- * They used to be dead in every real session — `const inert = FIXTURE ? !live : true` — because
162
- * publishing and read-back were out of scope by name and an inert control that states its reason
163
- * beats a control that lies. That was right on the day it shipped and it stopped being right when
164
- * the PM asked for the capability, because the reason it gave was *waiting on a decision the PM had
165
- * not made*, and they made it.
166
- *
167
- * What a click does now is the whole design in one sentence: it records the DIRECTION the PM chose
168
- * and shows the TASK a session will run to carry it out. It does not sync. PMOS holds no credential
169
- * and makes no outbound request (D53) — the session holds the credential, performs the write, and
170
- * reports back through a store that refuses any claim of success that cannot name the profile that
171
- * made it.
172
- *
173
- * So the surface can now say three different true things where it previously said one: nothing has
174
- * been chosen; a direction was chosen and nobody has reported; a named session wrote at a named
175
- * time. The word it still cannot say is `in sync`, because that is a claim about two documents PMOS
176
- * has never compared.
177
- */
178
- const SYNC_NOT_A_SYNC = 'PMOS does not perform this itself — it records which way you chose and '
179
- + 'composes the task. The session you run it in holds the credential; PMOS holds none.';
180
-
181
- /* ── the sticky detail header (lines 332–335) ───────────────────────────────────────────────
182
- * Built once and re-used, so panel 3's chrome keeps its identity across renders the way panel 2's
183
- * header and search box do.
184
- */
185
- // `<span>{{ detailTitle }}</span>` — the OUTER span is the header's flex item (and is therefore
186
- // blockified); the interpolation's own span sits inside it and stays inline. Collapsing the two
187
- // would change the measured box, so the wrapper is kept and only the inner text is rewritten.
188
- const headerTitleText = iv('initiative');
189
- const headerTitle = el('span', null, headerTitleText);
190
-
191
- const stickyHeader = el('div', {
192
- style: 'position:sticky;top:0;z-index:2;background:var(--sidebar);border-bottom:1px solid var(--border);padding:6px 8px 6px 14px;font-size:12px;font-weight:500;color:var(--muted-foreground);display:flex;align-items:center;gap:8px',
193
- },
194
- headerTitle,
195
- el('button', {
196
- onClick: () => setState({ col2: false }),
197
- style: 'margin-left:auto;color:var(--muted-foreground);padding:3px 7px;font-size:12px',
198
- hover: 'color:var(--foreground)',
199
- }, '⟨'),
200
- );
201
-
202
- /* ── 1b · SESSIONS — the agents running on THIS initiative ──────────────────────────────────────
203
- *
204
- * The PM's report: *"when I click the initiative on the initiative panel (which is column number 3),
205
- * I can see the active sessions list, then when i click, either go to the tab (if tab is open), or
206
- * open new tab and directly resume to the session."*
207
- *
208
- * Their first sentence was not that the list is unclickable — there was no list. `data.js` has been
209
- * building `rec.sessions` (each row carrying the server's own id and rendered label) and `rec.noSess`
210
- * since the four-panel port, and `initBody()` rendered header → phases → links → artifacts → footer.
211
- * Neither field appeared anywhere in this file. The join ran on the server, survived the wire, was
212
- * normalised by the data layer, and was dropped by the renderer.
213
- *
214
- * ── WHY THIS DOES NOT RENDER `rec.sessions` ──────────────────────────────────────────────────
215
- * Because `FX.DATA` carries seed `sessions` arrays, and drawing them would light up seven fixture
216
- * rows and break the design comparator's text axis on the first render. The board solved this the
217
- * same way and for the same reason: read the LIVE join, which fixture mode structurally cannot fill
218
- * (`pollSessions` returns early on FIXTURE). There is no server in fixture mode, so there are no
219
- * live sessions to claim.
220
- *
221
- * ── THE CLICK ────────────────────────────────────────────────────────────────────────────────
222
- * `openTerm` with the session's SERVER id and no `spawn`. Those two facts are the whole behaviour:
223
- * `openTab` focuses a tab whose id already exists rather than duplicating it, and the absent `spawn`
224
- * is what withholds authorisation to create a PTY — so a click either lands on the open tab or opens
225
- * one attached to the running process. It cannot start a second agent.
226
- */
227
-
228
- /** The live sessions on one initiative, from the shared join — never from the record's seed rows. */
229
- function liveSessionsFor(slug) {
230
- if (FIXTURE || !slug) return [];
231
- const ws = typeof window !== 'undefined' ? window.PMOSWorkingSet : null;
232
- const map = state.wsBranches && typeof state.wsBranches === 'object' ? state.wsBranches : {};
233
- if (!ws || typeof ws.attributeSessions !== 'function') return [];
234
- const attr = ws.attributeSessions(state.sessions, (id) => map[id] || null);
235
- return attr.byInitiative[slug] || [];
236
- }
237
-
238
- function sessionsBlock(slug) {
239
- const rows = liveSessionsFor(slug);
240
- if (!rows.length) return null; // nothing running: no heading over nothing
241
- const ss = typeof window !== 'undefined' ? window.PMOSSessionState : null;
242
- const openIds = new Set((state.tabs || []).filter((t) => t && t.kind === 'term' && t.sessionId).map((t) => t.sessionId));
243
-
244
- return el('div', { style: 'padding:9px 14px 10px;border-bottom:1px solid var(--border)' },
245
- el('div', { style: 'font-family:var(--mono);font-size:10px;letter-spacing:.12em;text-transform:uppercase;color:var(--muted-foreground);margin-bottom:6px' },
246
- 'sessions'),
247
- rows.map((s) => {
248
- const st = ss && ss.GLYPH[s.shown] ? s.shown : null;
249
- const here = openIds.has(s.id);
250
- return el('button', {
251
- onClick: () => openTerm(slug, { name: s.name, st: s.shown, label: s.label, id: s.id, profile: s.profile_id }),
252
- style: 'display:flex;align-items:center;gap:8px;width:100%;padding:5px 6px;min-height:30px',
253
- hover: 'background:var(--accent)',
254
- // What the click will do, said BEFORE it — the difference between landing on a tab already
255
- // open and opening one that attaches. Neither ever starts an agent, and that is worth saying
256
- // on the control rather than only in a comment nobody reading the surface can see.
257
- title: (s.name || s.id) + ' — ' + (s.label || s.shown || '')
258
- + (s.profile_id ? '\nprofile ' + s.profile_id : '')
259
- + (here ? '\nits tab is open — this goes to it' : '\nopens a tab attached to this running session; nothing is started'),
260
- },
261
- el('span', { style: 'flex:none;font-size:11px;color:' + (st && ss ? ss.COLOR[st] : 'var(--muted-foreground)') },
262
- st && ss ? ss.GLYPH[st] : '·'),
263
- el('span', { style: 'font-family:var(--mono);font-size:11.5px;color:var(--foreground);overflow:hidden;text-overflow:ellipsis;white-space:nowrap' },
264
- iv(s.name || s.id)),
265
- el('span', { style: 'margin-left:auto;flex:none;font-size:10px;color:var(--muted-foreground)' },
266
- iv(s.label || s.shown || '')),
267
- el('span', { style: 'flex:none;font-family:var(--mono);font-size:9.5px;color:var(--muted-foreground)' },
268
- iv(here ? 'open' : 'resume')),
269
- );
270
- }),
271
- );
272
- }
273
-
274
- /* ── 1 · HEADER — slug, tag, pills (lines 338–346) ──────────────────────────────────────────── */
275
-
276
- /* overhaul-r2 B3 — the breadcrumb, under the pills. Gaps are drawn muted and italic and SAY what is
277
- * missing; they are never an empty slot. The KR's baseline → target line and a domain's standing
278
- * goal sit beneath it, because "which metric does this move?" is the question the crumb answers. */
279
- function crumbBlock(c) {
280
- if (!c || !c.parts || !c.parts.length) return null;
281
- const kids = [];
282
- c.parts.forEach((pt, i) => {
283
- if (i) kids.push(el('span', { style: 'color:var(--muted-foreground)' }, ' › '));
284
- kids.push(el('span', { title: pt.k, style: pt.gap ? 'font-style:italic;color:var(--muted-foreground)' : 'color:var(--foreground)' }, iv(pt.v)));
285
- });
286
- return el('div', { 'data-r2': 'crumb', style: 'margin-top:8px;font-size:11.5px;line-height:1.5' },
287
- el('div', null, kids),
288
- c.line ? el('div', { 'data-r2': 'kr-line', style: 'font-family:var(--mono);font-size:10.5px;color:var(--muted-foreground);margin-top:3px' }, iv('measure · ' + c.line)) : null,
289
- c.goal ? el('div', { 'data-r2': 'domain-goal', style: 'font-size:11px;color:var(--muted-foreground);margin-top:3px' }, iv('standing goal · ' + c.goal)) : null,
290
- );
291
- }
292
-
293
- /* The lane picker: an existing initiative's workflow. The ladder is derived from the record's `lane:`, so this
294
- * edits that line (POST /api/initiative/lane) after a confirm, and the rungs re-derive. Live mode only. */
295
- let laneNote = null;
296
- function lanePicker(slug, rec) {
297
- if (FIXTURE || !rec || !rec.lane || !Array.isArray(rec.lanes) || !rec.lanes.length) return null;
298
- const opts = rec.lanes.includes(rec.lane) ? rec.lanes : [rec.lane, ...rec.lanes];
299
- const cur = rec.laneDefs && rec.laneDefs[rec.lane];
300
- const bar = el('div', { 'data-r15': 'lane-bar', style: 'display:flex;gap:6px;align-items:center;flex-wrap:wrap;margin-top:8px;font-family:var(--mono);font-size:10.5px;color:var(--muted-foreground)' },
301
- el('span', null, 'workflow'),
302
- el('select', { 'data-r15': 'lane-pick', title: 'change this initiative’s workflow (lane); the ladder re-derives from it',
303
- style: 'font-family:var(--mono);font-size:10.5px;background:var(--secondary);border:1px solid var(--border);color:var(--foreground);padding:2px 4px;min-height:24px',
304
- onChange: async (e) => {
305
- const next = e.target.value;
306
- if (next === rec.lane) return;
307
- const ok = await askConfirm({
308
- title: 'Change “' + slug + '” to the ' + next + ' lane?', confirmLabel: 'Change lane',
309
- body: 'Change “' + slug + '” from the ' + rec.lane + ' lane to the ' + next + ' lane?\n\nThe lane decides which steps the workflow ladder requires (spec, rubric, explainer, …). Only the lane: line of the record changes; the steps are re-derived and some may show as missing.',
310
- });
311
- if (!ok) { e.target.value = rec.lane; return; }
312
- const data = sibling('data', './data.js');
313
- const out = data && data.setInitiativeLane ? await data.setInitiativeLane(slug, next) : null;
314
- laneNote = out && out.ok ? 'lane is now ' + next : 'not changed — ' + ((out && out.error) || 'the server did not answer');
315
- setState({});
316
- } },
317
- opts.map((l) => {
318
- const d = rec.laneDefs && rec.laneDefs[l];
319
- return el('option', { value: l, title: d ? d.when : null, selected: l === rec.lane ? 'selected' : null }, d && d.label ? d.label + ' (' + l + ')' : l);
320
- })),
321
- laneNote ? el('span', { 'data-r15': 'lane-note', style: 'color:var(--muted-foreground)' }, iv(laneNote)) : null);
322
- if (!cur) return bar;
323
- // D77 — what this lane is: the definition the engine runs on, read from the same module.
324
- const row = (k, v) => el('div', null, el('span', { style: 'text-transform:uppercase;letter-spacing:.1em;font-size:9.5px;margin-right:6px' }, k), iv(v));
325
- return el('div', null, bar,
326
- el('div', { 'data-r17': 'lane-def', style: 'margin-top:6px;font-size:11.5px;line-height:1.5;color:var(--muted-foreground)' },
327
- row('when', cur.when), row('input', cur.requires || cur.input), row('output', cur.output), row('done', cur.done)));
328
- }
329
-
330
- function headerBlock(name, tag, pills, crumb, lane) {
331
- return el('div', { style: 'padding:13px 14px 11px;border-bottom:1px solid var(--border)' },
332
- el('div', { style: 'font-family:var(--mono);font-size:15px;font-weight:600;letter-spacing:-.01em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap' }, iv(name)),
333
- el('div', { style: 'font-size:12px;color:var(--muted-foreground);margin-top:2px' }, iv(tag)),
334
- el('div', { style: 'display:flex;gap:5px;flex-wrap:wrap;margin-top:8px' },
335
- pills.map((pl) => el('span', {
336
- style: 'font-family:var(--mono);font-size:10px;padding:2px 6px;background:var(--secondary);border:1px solid var(--border);color:' + pl.c,
337
- }, iv(pl.t)))),
338
- crumbBlock(crumb),
339
- lane || null,
340
- );
341
- }
342
-
343
- /* ── 2 · READ FAILURE (lines 347–352) ────────────────────────────────────────────────────────
344
- * A record that would not parse renders the panel RED and carries the parse error verbatim. It
345
- * replaces the phases, links and artifacts — the panel refuses to pretend the initiative is empty,
346
- * which is a different and much worse claim than "this file is broken".
347
- */
348
- function errorBlock(readError) {
349
- return el('div', {
350
- style: 'margin:12px;padding:11px 13px;border:1px solid var(--destructive);background:color-mix(in oklab, var(--destructive) 12%, transparent)',
351
- },
352
- el('div', { style: 'font-family:var(--mono);font-size:10px;letter-spacing:.14em;text-transform:uppercase;color:var(--destructive);margin-bottom:4px;font-weight:500' }, 'read failed'),
353
- el('div', { style: 'font-size:12.5px;line-height:1.55' }, iv(readError)),
354
- );
355
- }
356
-
357
- /* ── 3 · NO RECORD — the "next" banner + the note (lines 353–356) ───────────────────────────── */
358
-
359
- function noLadderBlock(ansBg, ansC, ansText, noLadderText) {
360
- return [
361
- el('div', { style: 'margin:12px 12px 0;padding:9px 11px;background:' + ansBg + ';border-left:2px solid ' + ansC + ';font-size:13px;line-height:1.5' },
362
- el('span', { style: 'font-family:var(--mono);font-size:10px;letter-spacing:.14em;text-transform:uppercase;color:' + ansC + ';margin-right:8px;font-weight:500' }, 'next'),
363
- iv(ansText)),
364
- el('div', { style: 'margin:10px 12px 0;padding:9px 11px;border:1px dashed var(--input);font-size:12px;line-height:1.5;color:var(--muted-foreground)' }, iv(noLadderText)),
365
- ];
366
- }
367
-
368
- /**
369
- * What the documents say, beside the ladder and never in it (status-from-artifacts, Run 1). One plain
370
- * line each, with its basis. A flag colours its own dot only; no phase, count or total reads it.
371
- */
372
- function factsBlock(rec) {
373
- const facts = (rec && rec.facts) || [];
374
- // An initiative with a ladder always gets the section; with nothing to compare it says what each check waits for.
375
- if (!facts.length && !(rec && rec.factsWhy)) return null;
376
- return el('div', { 'data-facts': 'status-from-artifacts', style: 'border-top:1px solid var(--border);padding:8px 14px 8px' },
377
- el('div', { style: 'font-family:var(--mono);font-size:9.5px;letter-spacing:.12em;text-transform:uppercase;color:var(--muted-foreground);padding-bottom:5px' }, iv('What the documents say')),
378
- facts.length ? null : el('div', { 'data-facts-empty': '', style: 'font-size:12px;line-height:1.45;color:var(--muted-foreground)' }, iv(rec.factsWhy)),
379
- ...facts.map((f) => el('div', { style: 'display:grid;grid-template-columns:14px 104px 1fr;gap:6px;align-items:baseline;padding:2px 0;font-size:12px;line-height:1.45' },
380
- el('span', { style: 'font-size:9px;color:' + (FX.TONE[f.tone] || FX.C.mut) }, iv('●')),
381
- el('span', { style: 'color:var(--muted-foreground)' }, iv(f.label)),
382
- el('span', { style: 'color:var(--foreground)' }, iv(f.text)),
383
- )));
384
- }
385
-
386
- /* ── 5a · LINKS (lines 380–398, derivation 1757–1766, 1797–1798) ────────────────────────────
387
- * External references — NOT repo files.
388
- *
389
- * WHAT CHANGED HERE, AND WHY IT IS THE POINT. This used to append a reference the moment a + button
390
- * was clicked, built out of the initiative slug and a counter: `ATL-501`, then `ATL-502`. The PM was
391
- * never asked which epic. The row then labelled itself `connected`, and after a reload the same row
392
- * read `declared · not connected` — one row, two labels, and the flattering one was the one visible
393
- * at the moment of the click. Six clicks recorded six references to six epics that did not exist.
394
- *
395
- * A + button now opens a FORM. Nothing is recorded until the PM supplies the reference or a session
396
- * resolves it, because a reference nobody chose is not a reference — it is a guess written down in
397
- * a place the PM will later trust. `makeLink` is gone rather than bypassed: a helper that can
398
- * fabricate an identifier is a helper someone re-wires later.
399
- */
400
- /**
401
- * Hand the lookup to a session that can actually perform it.
402
- *
403
- * This is the seam the whole initiative turns on, so it is worth being explicit about what it does
404
- * NOT do: it does not contact Jira, Confluence or Google, and it does not record a link. It asks
405
- * the server to compose a task and shows that task to the PM to run in a session on the named
406
- * profile — the session holds the credential, PMOS does not (D53). The session then records the
407
- * resolved reference through the same validated endpoint the PM's own typing goes through, where
408
- * it will be refused unless it names the profile that read it.
409
- *
410
- * The alternative — having the workspace perform the search itself — is the design D53 rejected and
411
- * that `no-network.test.js` fails by construction. There is no version of this function that calls out.
412
- */
413
- function askSessionToResolve(slug, kind, resolver, hint) {
414
- const data = sibling('data', './data.js');
415
- if (!data || typeof data.lookupTask !== 'function') return;
416
- Promise.resolve(data.lookupTask({ kind, subject: slug, hint, profile: resolver.profile }))
417
- .then((out) => {
418
- if (!out || out.ok === false) {
419
- setState((s) => ({ linkTask: { ...s.linkTask, [slug]: { error: (out && out.error) || 'the task could not be composed' } } }));
420
- return;
421
- }
422
- setState((s) => ({ linkTask: { ...s.linkTask, [slug]: { text: out.text, profile: resolver.profile, kind } } }));
423
- })
424
- .catch((e) => setState((s) => ({ linkTask: { ...s.linkTask, [slug]: { error: String((e && e.message) || e) } } })));
425
- }
426
-
427
- function linkStateStyle(st) {
428
- if (st === 'resolved') return { color: 'var(--success)', label: 'resolved' };
429
- if (st === 'unreachable') return { color: 'var(--warning)', label: 'unreachable' };
430
- if (st === 'unattributed') return { color: 'var(--muted-foreground)', label: 'unattributed' };
431
- return { color: 'var(--muted-foreground)', label: 'declared' };
432
- }
433
-
434
- /* ── the small controls a recorded link needs to be the PM's ────────────────────────────────
435
- * `edit` and `unlink`. Neither existed, and their absence made a paste error permanent: the store
436
- * is append-only and supersedes on read, so CHANGING a link was always one row away — there was
437
- * simply nothing in the UI that could write that row. Removing one had no representation at all.
438
- *
439
- * They are rendered only in real mode. Fixture mode is a transcription of the prototype, pinned
440
- * line-for-line by the parity comparator, and the prototype has no such controls; adding them there
441
- * would be a parity failure dressed as a feature.
442
- */
443
- const MINI_BTN = 'font-family:var(--mono);font-size:10px;padding:3px 8px;min-height:24px;'
444
- + 'background:transparent;border:1px solid var(--border);color:var(--muted-foreground)';
445
-
446
- function miniBtn(label, onClick, extra) {
447
- return el('button', { onClick, style: MINI_BTN + (extra || ''), hover: 'border-color:var(--ring);color:var(--foreground)' }, label);
448
- }
449
-
450
- /**
451
- * The one sentence a link row is allowed to say about itself, built from what was actually observed.
452
- * Every branch names its evidence or admits it has none — there is deliberately no branch that
453
- * returns a bare status word, because a bare status word is what `connected` was.
454
- */
455
- function linkStateText(lk) {
456
- const st = lk.state || (lk.origin ? 'declared' : 'unattributed');
457
- if (st === 'resolved') {
458
- const when = String(lk.resolved_at || '').slice(11, 16);
459
- return 'resolved by ' + (lk.profile || 'a session') + (when ? ' · read ' + when : '');
460
- }
461
- if (st === 'unreachable') return 'unreachable · ' + (lk.reason || 'the lookup failed');
462
- if (st === 'unattributed') return 'recorded before provenance — origin unknown';
463
- return 'declared · nothing read it';
464
- }
465
-
466
- function linksRow(slug) {
467
- const rec = records()[slug] || {};
468
- const manual = (state.initLinks || {})[slug] || [];
469
- // A reference the PM withdrew in this window is dropped here as well as on disk. The server
470
- // already omits retracted pairs from what it publishes, so this only covers the moment between
471
- // the click and the next hydration — without it the row would linger until a reload and the PM
472
- // would reasonably conclude the control had failed.
473
- const dropped = (state.linkGone || {})[slug] || [];
474
- const gone = (lk) => dropped.some((d) => d.kind === lk.kind && d.target === (lk.target || lk.path));
475
- const links = [...(rec.links || []), ...manual].filter((lk) => !gone(lk));
476
- const openSrc = (state.linkForm || {})[slug] || null;
477
-
478
- /**
479
- * Record what the PM typed. `origin: 'typed'` is sent explicitly and the server will refuse to
480
- * store it as anything stronger — a typed reference is the PM's word, and the row says so.
481
- */
482
- const submitTyped = (src, ref) => {
483
- const target = String(ref || '').trim();
484
- if (!target) return;
485
- const link = { kind: src, label: target, path: target, target, origin: 'typed', state: 'declared' };
486
- setState(
487
- (s) => ({
488
- initLinks: { ...s.initLinks, [slug]: [...((s.initLinks || {})[slug] || []), link] },
489
- linkForm: { ...s.linkForm, [slug]: null },
490
- // A pair the PM re-declares is no longer withdrawn. Clearing this is what makes R-B3's
491
- // "a later declaration brings it back" true on the screen as well as in the store.
492
- linkGone: { ...s.linkGone, [slug]: ((s.linkGone || {})[slug] || []).filter((d) => !(d.kind === src && d.target === target)) },
493
- }),
494
- () => declare('recordInitiativeLink', { slug, ...link }),
495
- );
496
- };
497
-
498
- /**
499
- * Withdraw a reference. This appends a `retracted` row — it does not delete anything, because the
500
- * store is a history of what the PM declared and a deleted row is a declaration that never
501
- * happened. The server refuses a retraction that does not come from the PM.
502
- */
503
- const retract = (lk) => {
504
- const target = lk.target || lk.path;
505
- setState(
506
- (s) => ({
507
- linkGone: { ...s.linkGone, [slug]: [...((s.linkGone || {})[slug] || []), { kind: lk.kind, target }] },
508
- initLinks: { ...s.initLinks, [slug]: ((s.initLinks || {})[slug] || []).filter((x) => !(x.kind === lk.kind && (x.target || x.path) === target)) },
509
- }),
510
- () => declare('recordInitiativeLink', {
511
- slug, kind: lk.kind, label: lk.label, path: target, origin: 'typed', state: 'retracted',
512
- }),
513
- );
514
- };
515
-
516
- const rows = links.map((lk) => {
517
- const body = el('button', {
518
- onClick: () => openDoc(slug, lk.path, String(lk.kind).toUpperCase()),
519
- // In fixture mode this button IS the row and carries the prototype's own negative margin. In
520
- // real mode it sits inside a wrapper that carries it instead, and the button flexes to fill.
521
- style: 'display:flex;gap:8px;align-items:center;padding:5px 6px;min-height:34px;'
522
- + (FIXTURE ? 'margin:0 -6px' : 'flex:1;min-width:0'),
523
- hover: 'background:var(--accent)',
524
- },
525
- el('span', { style: 'flex:none;width:76px;font-family:var(--mono);font-size:10px;letter-spacing:.1em;text-transform:uppercase;color:var(--info)' }, iv(lk.kind)),
526
- el('span', { style: 'font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap' }, iv(lk.label)),
527
- // A row that CARRIES provenance states what was observed; a row that does not keeps whatever
528
- // status copy it came with. The branch is on the row, not on the mode, which is the point: the
529
- // prototype's seeded rows (`auto · session`) render unchanged so the parity comparator still
530
- // sees a like-for-like surface, while every row this surface actually records — in either mode —
531
- // is held to the closed vocabulary. Branching on FIXTURE instead would have left a real row
532
- // in a fixture-mode session rendering `undefined`.
533
- (lk.state || lk.origin)
534
- ? el('span', {
535
- style: 'margin-left:auto;flex:none;font-family:var(--mono);font-size:10px;color:'
536
- + linkStateStyle(lk.state || 'declared').color,
537
- }, iv(linkStateText(lk)))
538
- : el('span', { style: 'margin-left:auto;flex:none;font-family:var(--mono);font-size:10px;color:var(--muted-foreground)' }, iv(lk.st)),
539
- );
540
- // The prototype's row is a single button and the comparator measures it as one. Only real mode
541
- // grows the wrapper and the withdraw control.
542
- if (FIXTURE) return body;
543
- return el('div', { style: 'display:flex;gap:6px;align-items:center;margin:0 -6px;min-width:0' },
544
- body, miniBtn('unlink', () => retract(lk)));
545
- });
546
-
547
- // Which destinations a session could actually look up, and under which profile. Derived by the
548
- // server from the PM's agent profiles — never a constant, and never a claim that PMOS is connected.
549
- const conn = (state.connectors && state.connectors.configured) || [];
550
- const resolverFor = (kind) => conn.find((c) => c.kind === kind) || null;
551
-
552
- const form = openSrc ? (() => {
553
- const resolver = resolverFor(openSrc);
554
- const task = (state.linkTask || {})[slug] || null;
555
- const inputId = 'linkref-' + slug + '-' + openSrc;
556
- const read = () => {
557
- const node = document.getElementById(inputId);
558
- return node ? node.value : '';
559
- };
560
- return el('div', { style: 'margin-top:6px;padding:9px 11px;border:1px solid var(--border);background:var(--background)' },
561
- el('div', { style: 'font-size:11.5px;color:var(--muted-foreground);line-height:1.5;margin-bottom:7px' },
562
- iv(resolver
563
- ? 'paste the reference, or ask ' + resolver.profile + ' to find it — that session holds your '
564
- + openSrc + ' MCP. PMOS itself reads nothing.'
565
- : 'paste the reference. No agent profile declares a ' + openSrc
566
- + ' MCP, so nothing here can look it up for you — what you type is recorded as your own declaration.')),
567
- el('input', {
568
- id: inputId,
569
- placeholder: openSrc === 'jira' ? 'ATL-482 or its URL' : 'the page or document URL',
570
- style: 'width:100%;font-family:var(--mono);font-size:11.5px;padding:6px 8px;background:var(--secondary);border:1px solid var(--border);color:var(--foreground)',
571
- }),
572
- el('div', { style: 'display:flex;gap:6px;margin-top:8px;flex-wrap:wrap' },
573
- button({ label: 'record this reference', variant: 'primary', size: 'sm', onClick: () => submitTyped(openSrc, read()) }),
574
- resolver && el('button', {
575
- onClick: () => askSessionToResolve(slug, openSrc, resolver, read()),
576
- style: 'font-family:var(--mono);font-size:10.5px;padding:5px 10px;min-height:28px;background:var(--secondary);border:1px solid var(--border);color:var(--foreground)',
577
- hover: 'border-color:var(--ring)',
578
- }, 'ask ', iv(resolver.profile), ' to find it'),
579
- el('button', {
580
- onClick: () => setState((s) => ({ linkForm: { ...s.linkForm, [slug]: null } })),
581
- style: 'font-family:var(--mono);font-size:10.5px;padding:5px 10px;min-height:28px;background:transparent;border:1px solid var(--border);color:var(--muted-foreground)',
582
- }, 'cancel'),
583
- ),
584
- task && (task.error
585
- ? el('div', { style: 'margin-top:8px;font-size:11.5px;color:var(--warning);line-height:1.5' },
586
- iv('the lookup task could not be composed — ' + task.error))
587
- : el('div', { style: 'margin-top:8px' },
588
- el('div', { style: 'font-size:11px;color:var(--muted-foreground);line-height:1.5;margin-bottom:5px' },
589
- iv('run this in a session on ' + task.profile + '. it records the reference itself, and PMOS'
590
- + ' will refuse the result unless it names the profile that read it.')),
591
- el('pre', {
592
- style: 'font-family:var(--mono);font-size:10.5px;line-height:1.5;white-space:pre-wrap;'
593
- + 'padding:8px 9px;background:var(--secondary);border:1px solid var(--border);color:var(--foreground);margin:0',
594
- }, iv(task.text)))),
595
- );
596
- })() : null;
597
-
598
- const addRow = el('div', { style: 'display:flex;gap:6px;align-items:center;flex-wrap:wrap;margin-top:4px' },
599
- el('span', { style: 'font-family:var(--mono);font-size:9.5px;letter-spacing:.1em;text-transform:uppercase;color:var(--muted-foreground)' }, 'link'),
600
- FX.LINK_SRCS.map((ls) => el('button', {
601
- onClick: () => setState((s) => ({
602
- linkForm: { ...s.linkForm, [slug]: (s.linkForm || {})[slug] === ls.src ? null : ls.src },
603
- })),
604
- style: 'display:flex;gap:5px;align-items:center;font-family:var(--mono);font-size:10.5px;padding:4px 9px;min-height:28px;background:var(--secondary);border:1px solid var(--border);color:var(--foreground)',
605
- hover: 'border-color:var(--ring)',
606
- }, '+ ', iv(ls.l))),
607
- );
608
-
609
- return el('div', { style: 'display:grid;grid-template-columns:76px 1fr;gap:10px;padding:8px 14px;border-bottom:1px solid var(--border)' },
610
- el('span', { style: 'font-family:var(--mono);font-size:9.5px;letter-spacing:.12em;text-transform:uppercase;color:var(--muted-foreground);padding-top:2px' }, 'links'),
611
- el('div', { style: 'display:flex;flex-direction:column;gap:2px;min-width:0' },
612
- rows,
613
- addRow,
614
- form,
615
- el('span', { style: 'font-size:11px;color:var(--muted-foreground);margin-top:3px;line-height:1.5' },
616
- 'references — not in the repo. sessions add these automatically; link one yourself when you need it.'),
617
- ),
618
- );
619
- }
620
-
621
- /* ── 5b · ARTIFACTS (lines 399–437, derivation 1779–1795) ───────────────────────────────────
622
- * Repo files, each with its role and path; clicking one opens the document. An artifact may carry
623
- * an external DESTINATION — recorded as a declaration, never as an outbound call — and once linked
624
- * it grows the ⇄ pill, a `sync` button, `edit`/`unlink`, and the inline sync panel behind it.
625
- *
626
- * The sync panel is where this surface is at its most careful, and the care moved rather than
627
- * relaxed. It used to be careful by refusing to act; it is now careful about WHAT A CLICK MEANS. A
628
- * direction is a decision the PM makes and PMOS records; the write is performed by a session
629
- * holding the PM's own MCP; and the status line reports the latest recorded row and nothing else.
630
- * There is no path from a click to a claim about the destination without a profile in between —
631
- * that sentence is the acceptance criterion for this whole region.
632
- */
633
-
634
- /**
635
- * The status line beside the pill, derived from the latest recorded sync row.
636
- *
637
- * Everything it can say is something a row on disk says. It cannot say `in sync`, because that
638
- * compares two documents PMOS has never read; it cannot invent a time, because the only times here
639
- * are the ones the store stamped. `proposed` says the quiet true thing that the old panel had no
640
- * way to express: you chose a direction, and nobody has reported doing it.
641
- */
642
- function syncStatus(sy) {
643
- if (!sy) return null;
644
- const hm = (t) => String(t || '').slice(11, 16);
645
- const arrow = sy.direction === 'push' ? 'repo → ' + sy.kind : sy.kind + ' → repo';
646
- if (sy.state === 'applied') {
647
- return {
648
- color: 'var(--success)',
649
- text: arrow + ' · applied by ' + (sy.profile || 'a session') + (hm(sy.applied_at) ? ' · ' + hm(sy.applied_at) : ''),
650
- };
651
- }
652
- if (sy.state === 'failed') {
653
- return { color: 'var(--warning)', text: arrow + ' · failed · ' + (sy.reason || 'no reason recorded') };
654
- }
655
- return {
656
- color: 'var(--muted-foreground)',
657
- text: arrow + ' · proposed' + (hm(sy.at) ? ' ' + hm(sy.at) : '') + ' · no session has reported',
658
- };
659
- }
660
-
661
- /** What the open sync panel says about where things stand. One sentence per recorded state. */
662
- function syncSummary(sy, dest) {
663
- const hm = (t) => String(t || '').slice(11, 16);
664
- if (!sy) {
665
- return 'no direction has been chosen for this document yet. nothing has been written either way,'
666
- + ' and PMOS has read nothing from ' + dest.kind + '.';
667
- }
668
- const way = sy.direction === 'push' ? 'push to ' + sy.kind : 'adoption from ' + sy.kind;
669
- if (sy.state === 'applied') {
670
- return sy.profile + ' reported applying this ' + way + (hm(sy.applied_at) ? ' at ' + hm(sy.applied_at) : '')
671
- + '.' + (sy.detail ? ' it reported: ' + sy.detail : '');
672
- }
673
- if (sy.state === 'failed') {
674
- return 'the last attempt at this ' + way + ' failed — ' + (sy.reason || 'no reason was recorded')
675
- + '. nothing was written.';
676
- }
677
- return 'a ' + way + ' was proposed' + (hm(sy.at) ? ' at ' + hm(sy.at) : '')
678
- + '. the task below is what performs it, and no session has reported back.';
679
- }
680
-
681
- /* ── the role chip's short form ───────────────────────────────────────────────────────────────
682
- * The chip is a fixed 52px box — roughly eight characters of 10px mono with `.1em` tracking — and
683
- * the design drew it that way. The index's canonical role for a user-story document is
684
- * `user stories`, which is twelve, so it ran under the path beside it.
685
- *
686
- * The canonical role is NOT renamed. It is asserted as `user stories` in two suites, and it is the
687
- * string the search results (`artifact · user stories`) and a document tab's label read — both
688
- * places where the longer, clearer word is the right one. Only the CHIP is abbreviated, and only
689
- * where a role is genuinely too long for the box the design specified. The prototype's own stories
690
- * row says `STORIES`, so this is the design's word, shortened to the case the real index uses.
691
- */
692
- const ROLE_CHIP = { 'user stories': 'stories' };
693
- function roleChip(role) { return ROLE_CHIP[role] || role; }
694
-
695
- function artifactRow(slug, a, noHead) {
696
- const key = FX.artKey(slug, a.path);
697
- // `hasOwnProperty`, not `||`. An unlinked artifact records `null` under its key, and a falsy check
698
- // would fall straight through to the server's `a.dest` and re-draw the link the PM just withdrew.
699
- const over = state.artLinks || {};
700
- const dest = Object.prototype.hasOwnProperty.call(over, key) ? over[key] : (a.dest || null);
701
- const syncState = (state.artSyncState || {})[key] || null;
702
- const syncOpen = !!(state.artSyncOpen || {})[key];
703
-
704
- const head = el('button', {
705
- onClick: () => openDoc(slug, a.path, a.role),
706
- style: 'display:flex;gap:8px;align-items:center;width:100%;padding:4px 6px;margin:0 -6px;min-width:0;min-height:30px',
707
- hover: 'background:var(--accent)',
708
- },
709
- el('span', { style: 'flex:none;width:52px;font-family:var(--mono);font-size:10px;letter-spacing:.1em;color:var(--info)' }, iv(roleChip(a.role))),
710
- el('span', { style: 'font-family:var(--mono);font-size:10px;color:var(--muted-foreground);overflow:hidden;text-overflow:ellipsis;white-space:nowrap' }, iv(a.path)),
711
- );
712
-
713
- const openHere = (state.artLinkForm || {})[key] || null;
714
- const inputId = 'artref-' + key.replace(/[^A-Za-z0-9]/g, '-');
715
- const conn = (state.connectors && state.connectors.configured) || [];
716
-
717
- /**
718
- * Record a destination for this artifact. Used by BOTH the first link and an edit of one already
719
- * recorded — they are the same act as far as the store is concerned, because it is append-only and
720
- * supersedes on read. That is why editing needed no new endpoint and no mutation: the second row
721
- * simply wins, and the first stays as the history of what the PM once believed.
722
- */
723
- const submit = (kind) => {
724
- const node = document.getElementById(inputId);
725
- const target = String((node && node.value) || '').trim();
726
- if (!target) return;
727
- const d = { kind, target, origin: 'typed', state: 'declared' };
728
- setState((s) => ({
729
- artLinks: { ...s.artLinks, [key]: d },
730
- artLinkForm: { ...s.artLinkForm, [key]: null },
731
- // A re-linked pair discards whatever sync was recorded against the OLD destination in this
732
- // window. Carrying it over would attach a status line to a record it was never about.
733
- artSyncTask: { ...s.artSyncTask, [key]: null },
734
- }));
735
- declare('recordArtifactLink', { artifact_path: a.path, slug, kind, target, origin: 'typed', state: 'declared' });
736
- };
737
-
738
- /** Withdraw this artifact's destination — an appended `retracted` row, never a deletion. */
739
- const retract = () => {
740
- if (!dest) return;
741
- setState((s) => ({
742
- artLinks: { ...s.artLinks, [key]: null },
743
- artSyncOpen: { ...s.artSyncOpen, [key]: false },
744
- artSyncTask: { ...s.artSyncTask, [key]: null },
745
- }));
746
- declare('recordArtifactLink', {
747
- artifact_path: a.path, slug, kind: dest.kind, target: dest.target, origin: 'typed', state: 'retracted',
748
- });
749
- };
750
-
751
- /** The paste-a-reference form. `initial` pre-fills it when the PM is editing rather than adding. */
752
- const destForm = (kind, initial) => el('div', { style: 'margin-top:6px;padding:8px 10px;border:1px solid var(--border);background:var(--background)' },
753
- el('div', { style: 'font-size:11.5px;color:var(--muted-foreground);line-height:1.5;margin-bottom:6px' },
754
- iv(conn.some((c) => c.kind === kind)
755
- ? 'paste the ' + kind + ' reference this file corresponds to. a session on '
756
- + (conn.find((c) => c.kind === kind) || {}).profile + ' can find it for you — PMOS reads nothing.'
757
- : 'paste the ' + kind + ' reference this file corresponds to. nothing here can look it up,'
758
- + ' so what you type is recorded as your own declaration.')),
759
- el('input', {
760
- id: inputId,
761
- value: initial || '',
762
- placeholder: kind === 'jira' ? 'ATL-482 or its URL' : 'the page or document URL',
763
- style: 'width:100%;font-family:var(--mono);font-size:11px;padding:5px 7px;background:var(--secondary);border:1px solid var(--border);color:var(--foreground)',
764
- }),
765
- el('div', { style: 'display:flex;gap:6px;margin-top:7px;flex-wrap:wrap' },
766
- button({ label: 'record', variant: 'primary', size: 'sm', onClick: () => submit(kind) }),
767
- el('button', {
768
- onClick: () => setState((s) => ({ artLinkForm: { ...s.artLinkForm, [key]: null } })),
769
- style: 'font-family:var(--mono);font-size:10px;padding:4px 9px;min-height:26px;background:transparent;border:1px solid var(--border);color:var(--muted-foreground)',
770
- }, 'cancel'),
771
- ),
772
- );
773
-
774
- if (!dest) {
775
- // Unlinked: the three destinations it could be linked to.
776
- // In FIXTURE mode the prototype's own destination copy is drawn, so the parity comparator still
777
- // sees a like-for-like surface. In REAL mode a click opens a FORM: `linkArtDest` built the
778
- // destination out of the artifact's own FILENAME — `PM / <basename>`, `ATL epic · <basename>` —
779
- // which is a name for a page nobody created, recorded as though the PM had chosen it.
780
- const linkRow = el('div', { style: 'display:flex;gap:6px;align-items:center;flex-wrap:wrap;padding:3px 0 0' },
781
- el('span', { style: 'font-family:var(--mono);font-size:9.5px;letter-spacing:.1em;text-transform:uppercase;color:var(--muted-foreground)' }, 'link'),
782
- FX.ART_LINK_SRCS.map((ls) => el('button', {
783
- onClick: () => {
784
- if (FIXTURE) {
785
- const d = FX.linkArtDest(key, ls.kind);
786
- setState((s) => ({ artLinks: { ...s.artLinks, [key]: d } }));
787
- return;
788
- }
789
- setState((s) => ({
790
- artLinkForm: { ...s.artLinkForm, [key]: (s.artLinkForm || {})[key] === ls.kind ? null : ls.kind },
791
- }));
792
- },
793
- style: 'font-family:var(--mono);font-size:10px;padding:3px 8px;min-height:24px;background:var(--secondary);border:1px solid var(--border);color:var(--foreground)',
794
- hover: 'border-color:var(--ring)',
795
- }, '+ ', iv(ls.l))),
796
- );
797
-
798
- return el('div', { style: 'min-width:0' }, noHead ? null : head, linkRow, openHere ? destForm(openHere, '') : null);
799
- }
800
-
801
- // Linked: the destination pill, the sync button, the PM's own controls, and the status line —
802
- // which in real mode is what the store recorded, and in fixture mode is the prototype's own.
803
- const recorded = FIXTURE ? null : syncStatus(a.sync || null);
804
- const shown = FIXTURE ? syncState : (recorded || syncState);
805
- const pillRow = el('div', { style: 'display:flex;gap:7px;align-items:center;flex-wrap:wrap;padding:3px 0 0 0' },
806
- el('span', { style: 'font-family:var(--mono);font-size:10px;padding:1px 6px;background:var(--brand-wash);color:var(--brand)' },
807
- '⇄ ', iv(dest.kind), ' · ', iv(dest.target)),
808
- /* WHERE THE CLAIM CAME FROM. A destination read out of the file's own frontmatter is exactly as
809
- * unverified as one the PM typed — PMOS has not looked at either — but it arrived without
810
- * anybody in this window doing anything, so the row has to say so or it reads as something the
811
- * app established. This region already lost that argument once: its predecessor existed because
812
- * a row said `connected` about a record nobody had checked. Real mode only; the prototype has
813
- * no such row, and the parity comparator measures the fixture surface against it. */
814
- (!FIXTURE && dest.origin === 'frontmatter')
815
- ? el('span', { style: 'font-family:var(--mono);font-size:10px;color:var(--muted-foreground)' },
816
- 'declared in the file · nothing has been checked')
817
- : null,
818
- el('button', {
819
- onClick: () => setState((s) => ({ artSyncOpen: { ...s.artSyncOpen, [key]: !s.artSyncOpen[key] } })),
820
- style: 'font-family:var(--mono);font-size:10.5px;padding:3px 10px;min-height:26px;background:var(--secondary);border:1px solid var(--border);color:var(--foreground)',
821
- hover: 'border-color:var(--ring)',
822
- }, 'sync'),
823
- // Real mode only: the prototype has no edit or unlink control and the comparator measures the
824
- // fixture surface against it.
825
- FIXTURE ? null : miniBtn('edit', () => setState((s) => ({
826
- artLinkForm: { ...s.artLinkForm, [key]: (s.artLinkForm || {})[key] ? null : dest.kind },
827
- }))),
828
- FIXTURE ? null : miniBtn('unlink', retract),
829
- shown && el('span', { style: 'font-family:var(--mono);font-size:10px;color:' + shown.color }, iv(shown.text)),
830
- );
831
-
832
- let panel = null;
833
- if (syncOpen && FIXTURE) {
834
- // The prototype's panel, transcribed. Its two approvals write the seed module's own result
835
- // strings; nothing here reaches a store, and the parity comparator measures this surface against
836
- // the design file character for character.
837
- const live = hasConnector(dest.kind);
838
- const inert = !live;
839
- const decide = (make) => () => {
840
- if (inert) return;
841
- setState((s) => ({
842
- artSyncState: { ...s.artSyncState, [key]: make(dest) },
843
- artSyncOpen: { ...s.artSyncOpen, [key]: false },
844
- }));
845
- };
846
- const off = inert ? ';opacity:.5;cursor:not-allowed' : '';
847
- panel = el('div', { style: 'margin-top:6px;padding:9px 11px;border:1px solid var(--border);background:var(--background)' },
848
- el('div', { style: 'font-size:12px;line-height:1.5;color:var(--muted-foreground)' },
849
- iv(live ? FX.artDiffText(dest) : NO_CONNECTOR)),
850
- el('div', { style: 'display:flex;gap:6px;margin-top:8px;flex-wrap:wrap' },
851
- button({ label: 'repo is source → push', variant: 'primary', size: 'sm', disabled: inert, onClick: decide(FX.artSyncPushed) }),
852
- el('button', {
853
- onClick: decide(FX.artSyncPulled), disabled: inert,
854
- style: 'font-family:var(--mono);font-size:10.5px;padding:5px 10px;min-height:28px;background:var(--secondary);border:1px solid var(--border);color:var(--foreground)' + off,
855
- hover: inert ? null : 'border-color:var(--ring)',
856
- }, 'adopt ', iv(dest.kind), ' → repo'),
857
- ),
858
- );
859
- } else if (syncOpen) {
860
- panel = realSyncPanel(slug, a, key, dest);
861
- }
862
-
863
- return el('div', { style: 'min-width:0' }, noHead ? null : head, pillRow, openHere ? destForm(openHere, dest.target) : null, panel);
864
- }
865
-
866
- /**
867
- * The real sync panel: what is true now, who could perform the next step, the two directions, and —
868
- * once a direction is chosen — the task that carries it out.
869
- *
870
- * The click handler is worth reading closely, because it is where this initiative could most easily
871
- * have reproduced the defect it exists to remove. It records a `proposed` row and asks the server
872
- * for the task text. It does NOT set a status line of its own, does not stamp a time, and has no
873
- * success branch — because from in here there is no such thing as success to observe. The status
874
- * line updates when the panel next reads the store, and it can only say what a row says.
875
- */
876
- function realSyncPanel(slug, a, key, dest) {
877
- const task = (state.artSyncTask || {})[key] || null;
878
- const resolver = ((state.connectors && state.connectors.configured) || []).find((c) => c.kind === dest.kind) || null;
879
-
880
- const choose = (direction) => () => {
881
- const data = sibling('data', './data.js');
882
- if (!data || typeof data.recordSync !== 'function') return;
883
- setState((s) => ({ artSyncTask: { ...s.artSyncTask, [key]: { pending: true, direction } } }));
884
- Promise.resolve(data.recordSync({
885
- artifact_path: a.path, slug, kind: dest.kind, target: dest.target,
886
- direction, profile: resolver ? resolver.profile : null,
887
- }))
888
- .then((out) => setState((s) => ({
889
- artSyncTask: {
890
- ...s.artSyncTask,
891
- [key]: (!out || out.ok === false)
892
- // A refusal is shown, never absorbed. The store returning 500 rather than a false green
893
- // is the server's half of this rule; showing what it said is the client's.
894
- ? { error: (out && out.error) || 'the direction could not be recorded', direction }
895
- : { text: out.task, error: out.task_error || null, direction, profile: resolver ? resolver.profile : null },
896
- },
897
- })))
898
- .catch((e) => setState((s) => ({
899
- artSyncTask: { ...s.artSyncTask, [key]: { error: String((e && e.message) || e), direction } },
900
- })));
901
- };
902
-
903
- const btn = (label, primary, onClick) => button({ label, variant: primary ? 'primary' : 'outline', size: 'sm', onClick });
904
-
905
- return el('div', { style: 'margin-top:6px;padding:9px 11px;border:1px solid var(--border);background:var(--background)' },
906
- el('div', { style: 'font-size:12px;line-height:1.5;color:var(--muted-foreground)' },
907
- iv(syncSummary(a.sync || null, dest))),
908
- el('div', { style: 'font-size:11.5px;line-height:1.5;color:var(--muted-foreground);margin-top:5px' },
909
- iv(resolver
910
- ? SYNC_NOT_A_SYNC + ' a session on ' + resolver.profile + ' holds your ' + dest.kind + ' MCP.'
911
- : SYNC_NOT_A_SYNC + ' no agent profile declares a ' + dest.kind + ' MCP, so the task below is'
912
- + ' yours to run wherever you hold that access.')),
913
- el('div', { style: 'display:flex;gap:6px;margin-top:8px;flex-wrap:wrap' },
914
- btn('repo is source → push', true, choose('push')),
915
- el('button', {
916
- onClick: choose('adopt'),
917
- style: 'font-family:var(--mono);font-size:10.5px;padding:5px 10px;min-height:28px;background:var(--secondary);border:1px solid var(--border);color:var(--foreground)',
918
- hover: 'border-color:var(--ring)',
919
- }, 'adopt ', iv(dest.kind), ' → repo'),
920
- ),
921
- task && (task.error
922
- ? el('div', { style: 'margin-top:8px;font-size:11.5px;color:var(--warning);line-height:1.5' },
923
- iv('the direction was not recorded — ' + task.error))
924
- : task.pending
925
- ? el('div', { style: 'margin-top:8px;font-size:11.5px;color:var(--muted-foreground)' }, iv('recording…'))
926
- : el('div', { style: 'margin-top:8px' },
927
- el('div', { style: 'font-size:11px;color:var(--muted-foreground);line-height:1.5;margin-bottom:5px' },
928
- iv('recorded as proposed. run this in a session on ' + (task.profile || 'a profile holding that MCP')
929
- + '. it records the outcome itself, and PMOS will refuse a success that does not name'
930
- + ' the profile that performed it.')),
931
- el('pre', {
932
- style: 'font-family:var(--mono);font-size:10.5px;line-height:1.5;white-space:pre-wrap;'
933
- + 'padding:8px 9px;background:var(--secondary);border:1px solid var(--border);color:var(--foreground);margin:0',
934
- }, iv(task.text)))),
935
- );
936
- }
937
-
938
- /* ── NEXT STEPS TO DONE (initiative-surface-batch R4) ─────────────────────────────────────────
939
- * The whole remaining path, in order, from the ladder, the ledgers and the sessions — derived on the server
940
- * (lib/next-steps.js), never written by a model. Each item names the fact it was read from; the first is
941
- * marked. A stopped initiative says so, and an accepted one says nothing remains. */
942
- function nextStepsBlock(slug, rec) {
943
- const ns = rec && rec.nextSteps;
944
- if (FIXTURE || !ns) return null;
945
- const TONE = { blocked: 'var(--destructive)', current: 'var(--brand)', pending: 'var(--muted-foreground)', unknown: 'var(--destructive)' };
946
- const rowFor = (it) => el('div', { 'data-r16': 'next-item', 'data-first': it.first ? '1' : '0', 'data-kind': it.kind, 'data-owner': it.owner || '', 'data-id': it.id || '',
947
- style: 'display:grid;grid-template-columns:22px 1fr;gap:8px;padding:6px 0;border-bottom:1px solid var(--border)' + (it.held ? ';opacity:.6' : '') },
948
- el('span', { style: 'font-family:var(--mono);font-size:11px;color:' + (TONE[it.status] || 'var(--muted-foreground)') }, iv(String(it.n))),
949
- el('div', { style: 'min-width:0;display:flex;flex-direction:column;gap:2px' },
950
- el('div', { style: 'display:flex;gap:7px;align-items:baseline;flex-wrap:wrap' },
951
- el('span', { style: 'font-size:12.5px;color:var(--foreground)' }, iv(it.text)),
952
- it.first ? el('span', { 'data-r16': 'next-first', style: 'font-family:var(--mono);font-size:9.5px;letter-spacing:.1em;text-transform:uppercase;color:var(--brand)' }, 'next') : null,
953
- it.status === 'blocked' ? el('span', { style: 'font-family:var(--mono);font-size:9.5px;letter-spacing:.1em;text-transform:uppercase;color:var(--destructive)' }, 'blocked') : null,
954
- it.held ? el('span', { style: 'font-family:var(--mono);font-size:9.5px;letter-spacing:.1em;text-transform:uppercase;color:var(--muted-foreground)' }, 'after reopening') : null),
955
- el('div', { style: 'font-size:11.5px;line-height:1.5;color:var(--foreground)' }, iv(it.action)),
956
- it.why && it.why !== it.action ? el('div', { style: 'font-size:11px;line-height:1.5;color:var(--muted-foreground)' }, iv(it.why)) : null,
957
- el('div', { style: 'font-family:var(--mono);font-size:10px;color:var(--muted-foreground)' }, iv('from: ' + it.source)),
958
- stepActions(repoOf(slug), slug, it)));
959
- // Yours / Mine (status-clarity R3): the same ordered list, split by who acts. The number keeps its place in the whole path.
960
- const all = ns.items || [];
961
- const SEC = 'font-family:var(--mono);font-size:9.5px;letter-spacing:.12em;text-transform:uppercase;padding:6px 0 2px;';
962
- const part = (owner, label, tone, empty) => {
963
- const mine = all.filter((it) => it.owner === owner);
964
- return el('div', { 'data-r18': 'steps-' + owner },
965
- el('div', { 'data-r18': 'steps-heading', style: SEC + 'color:' + tone }, label + ' · ' + mine.length),
966
- mine.length ? mine.map(rowFor) : el('div', { style: 'font-size:11.5px;color:var(--muted-foreground);font-style:italic;padding:2px 0' }, empty));
967
- };
968
- const rows = all.length ? [
969
- part('pm', 'yours', 'var(--brand)', 'nothing is waiting on you right now'),
970
- part('agent', 'mine (the agent’s)', 'var(--muted-foreground)', 'nothing is waiting on the agent'),
971
- ] : [];
972
- return el('div', { 'data-r16': 'next-steps', style: 'padding:8px 14px;border-top:1px solid var(--border)' },
973
- el('div', { style: 'font-family:var(--mono);font-size:9.5px;letter-spacing:.12em;text-transform:uppercase;color:var(--muted-foreground);padding-bottom:4px' }, 'next steps to done'),
974
- el('div', { 'data-r16': 'next-summary', style: 'font-size:12px;line-height:1.5;color:var(--foreground);padding-bottom:4px' }, iv(ns.summary || '')),
975
- rows);
976
- }
977
-
978
- /* Conversations and git files, listed with the document artifacts (R5, R6). A conversation opens a read-only
979
- * transcript tab; the row says where it is stored. A file read from git is marked as such and opens read-only
980
- * (gitFileRow): it is evidence of what changed, so the tab offers no edit or save. */
981
- function openConversation(slug, c) {
982
- const ini = iniModLazy;
983
- if (!ini || typeof ini.openTab !== 'function') return;
984
- ini.openTab({ id: 'conv:' + c.id, kind: 'transcript', title: c.name || c.id, convId: c.id, repo: repoOf(slug) || null, slug: slug || null, role: 'CONVERSATION' });
985
- }
986
- let iniModLazy = null;
987
- import('./panel-initiatives.js').then((m) => { iniModLazy = m; }).catch(() => { iniModLazy = null; });
988
-
989
- function conversationsBlock(slug, rec) {
990
- if (FIXTURE) return null;
991
- const cs = rec.convs || [];
992
- const LAB = 'font-family:var(--mono);font-size:9.5px;letter-spacing:.12em;text-transform:uppercase;color:var(--muted-foreground)';
993
- const kids = cs.map((c) => el('button', { onClick: () => openConversation(slug, c), 'data-r16': 'conv-row', 'data-id': c.id,
994
- style: 'display:flex;gap:8px;align-items:center;width:100%;padding:4px 6px;margin:0 -6px;min-width:0;min-height:30px', hover: 'background:var(--accent)',
995
- title: 'a recorded conversation — read-only; kept in the runtime state directory on this machine, not in the repository' },
996
- el('span', { style: 'flex:none;width:52px;font-family:var(--mono);font-size:10px;letter-spacing:.1em;color:var(--info)' }, 'talk'),
997
- el('span', { style: 'font-family:var(--mono);font-size:10px;color:var(--foreground);overflow:hidden;text-overflow:ellipsis;white-space:nowrap' }, iv(c.name || c.id)),
998
- el('span', { style: 'margin-left:auto;flex:none;font-family:var(--mono);font-size:10px;color:var(--muted-foreground)' },
999
- iv((c.live ? 'live' : c.state === 'exited' ? 'ended' : 'saved') + (c.saved ? ' · ' + String(c.saved).slice(0, 10) : '')))));
1000
- return el('div', { 'data-r16': 'conversations', style: 'display:flex;flex-direction:column;gap:2px' },
1001
- el('span', { style: LAB + ';padding-top:4px' }, 'conversations · ' + cs.length),
1002
- cs.length ? kids : el('span', { 'data-r16': 'conv-empty', style: 'font-size:11.5px;color:var(--muted-foreground);font-style:italic' },
1003
- 'none — no session is bound to this initiative. A session on its branch, or one you bind, is recorded here and kept after it ends.'),
1004
- cs.length ? el('span', { style: 'font-size:10.5px;color:var(--muted-foreground)' }, 'stored in this machine’s runtime state directory — not in the repository, never sent anywhere') : null);
1005
- }
1006
-
1007
- /* A file read from git opens in a read-only doc tab (status-clarity R5). Text, markdown and html open anywhere. A
1008
- * file that exists only on the initiative's own branch is read through git from that branch, so it opens the branch's
1009
- * copy and never the trunk's. An image, PDF or workbook opens only from the checked-out tree. Anything else says why it
1010
- * cannot be previewed instead of failing on click. */
1011
- const READ_FROM_BRANCH = new Set(['markdown', 'text', 'html']);
1012
- function gitFileRow(slug, f, it) {
1013
- const branchOnly = it.where === 'branch';
1014
- const readable = READ_FROM_BRANCH.has(it.kind) || (!branchOnly && (it.kind === 'image' || it.kind === 'pdf' || it.kind === 'sheet'));
1015
- const tip = it.commits + ' commit' + (it.commits === 1 ? '' : 's') + ', last ' + it.last + (branchOnly ? ' · only on ' + (f.branch || 'the initiative branch') : '');
1016
- const STYLE = 'font-family:var(--mono);font-size:10px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;';
1017
- if (!readable) {
1018
- const why = branchOnly ? 'this kind of file cannot be previewed from a branch' : 'binary or unknown file type — it cannot be previewed here';
1019
- return el('span', { 'data-r16': 'git-file', 'data-open': '0', title: tip + ' · ' + why, style: STYLE + 'color:var(--muted-foreground)' },
1020
- iv(it.path + ' — cannot be previewed'));
1021
- }
1022
- return el('button', { 'data-r16': 'git-file', 'data-open': '1', 'data-where': it.where || 'head', title: tip + ' · opens read-only',
1023
- onClick: () => openDoc(slug, it.path, 'FILE', null, { readonly: true, ref: branchOnly ? (f.branch || null) : null }),
1024
- style: STYLE + 'color:var(--foreground);text-align:left;min-height:22px;padding:1px 4px;margin:0 -4px', hover: 'background:var(--accent)' }, iv(it.path));
1025
- }
1026
-
1027
- function gitFilesBlock(slug, rec) {
1028
- if (FIXTURE) return null;
1029
- const f = rec.gitFiles;
1030
- const LAB = 'font-family:var(--mono);font-size:9.5px;letter-spacing:.12em;text-transform:uppercase;color:var(--muted-foreground)';
1031
- if (!f) return null;
1032
- if (f.ok === false) {
1033
- return el('div', { 'data-r16': 'git-files', style: 'display:flex;flex-direction:column;gap:2px' },
1034
- el('span', { style: LAB + ';padding-top:4px' }, 'files from git'),
1035
- el('span', { 'data-r16': 'git-error', style: 'font-size:11.5px;color:var(--destructive)' }, 'could not be read — ' + (f.reason || 'git did not answer')));
1036
- }
1037
- const groups = {};
1038
- for (const it of f.items || []) (groups[it.group] = groups[it.group] || []).push(it);
1039
- const order = ['code', 'tests', 'documents', 'other'].filter((g) => groups[g]);
1040
- return el('div', { 'data-r16': 'git-files', style: 'display:flex;flex-direction:column;gap:2px' },
1041
- el('span', { style: LAB + ';padding-top:4px' }, 'files from git · ' + (f.total || 0) + (f.via && f.via.length ? ' · via ' + f.via.join(', ') : '')),
1042
- order.length ? order.map((g) => el('div', { style: 'display:flex;flex-direction:column;gap:1px' },
1043
- el('span', { style: 'font-family:var(--mono);font-size:10px;color:var(--info);padding-top:2px' }, g + ' · ' + groups[g].length),
1044
- groups[g].map((it) => gitFileRow(slug, f, it))))
1045
- : el('span', { 'data-r16': 'git-empty', style: 'font-size:11.5px;color:var(--muted-foreground);font-style:italic' },
1046
- 'none — git shows no commit naming this initiative and no initiative/<id> branch with changes'),
1047
- f.truncated ? el('span', { style: 'font-size:10.5px;color:var(--muted-foreground)' }, 'showing the first 200 of ' + f.total) : null);
1048
- }
1049
-
1050
- function artifactsRow(slug, rec) {
1051
- const arts = rec.arts || [];
1052
- return el('div', { style: 'display:grid;grid-template-columns:76px 1fr;gap:10px;padding:8px 14px' },
1053
- el('span', { style: 'font-family:var(--mono);font-size:9.5px;letter-spacing:.12em;text-transform:uppercase;color:var(--muted-foreground);padding-top:2px' }, 'artifacts'),
1054
- el('div', { style: 'display:flex;flex-direction:column;gap:8px;min-width:0' },
1055
- arts.map((a) => artifactRow(slug, a)),
1056
- arts.length === 0
1057
- ? el('span', { style: 'font-size:11.5px;color:var(--muted-foreground);font-style:italic' }, 'none filed')
1058
- : null,
1059
- conversationsBlock(slug, rec),
1060
- gitFilesBlock(slug, rec),
1061
- ),
1062
- );
1063
- }
1064
-
1065
- /* ── 6 · FOOTER — the derivation line (line 447) ─────────────────────────────────────────────
1066
- * `margin-top:auto` pins it to the bottom of panel 3's flex column. It states what the panel above
1067
- * was derived FROM: the working tree, or the absence of one, or a failed read.
1068
- */
1069
- /* THE FOOTER OWNS NO CLOCK. `rec.asOf` is stamped in data.js at the moment `/api/initiative`
1070
- * answers, and this function prints it. Calling a clock here instead — which is what the first fix
1071
- * for the fabricated `12:41:03` did — measures the render, and panel 3 re-renders on every session
1072
- * poll while its data is read once per page life: the line advanced while the reading behind it did
1073
- * not. In fixture mode `undefined` is passed deliberately so `branchLine` falls back to the design's
1074
- * own literal; a live clock inside a render the comparator diffs could never be called clean. A real
1075
- * record that has not been hydrated yet has no `asOf`, and `null` makes the line say so rather than
1076
- * borrow the design's number. */
1077
- function footer(rec) {
1078
- const asOf = FIXTURE ? undefined : ((rec && rec.asOf) || null);
1079
- return el('div', {
1080
- style: 'margin-top:auto;padding:8px 14px;border-top:1px solid var(--border);font-family:var(--mono);font-size:10px;color:var(--muted-foreground)',
1081
- }, iv(FX.branchLine(rec, asOf)));
1082
- }
1083
-
1084
- /* ── the `dInit` branch, assembled in the prototype's order ─────────────────────────────────── */
1085
-
1086
- /* ── the cockpit look: the mockup's title block and phase rows (planning/design/cockpit-mockup/WsA.dc.html) ────────────────── */
1087
-
1088
- const CK_BADGE = 'font:500 11px var(--sans);border:1px solid var(--border);border-radius:999px;padding:0 8px;line-height:18px;color:var(--foreground);white-space:nowrap';
1089
- const CK_SEP = () => el('div', { style: 'height:1px;background:var(--border)' });
1090
-
1091
- /** Title, summary and chips: the lane, the anchor and the flow, as pills. */
1092
- function cockpitTitle(name, tag, pills) {
1093
- return [
1094
- // the right padding keeps a long name clear of the column's fold control (renderDetail)
1095
- el('div', { style: 'font:600 17px var(--sans);overflow-wrap:anywhere;padding-right:30px' }, iv(name)),
1096
- el('div', { style: 'color:var(--muted-foreground)' }, iv(tag)),
1097
- el('div', { style: 'display:flex;gap:6px;flex-wrap:wrap' }, pills.map((pl) => el('span', { style: CK_BADGE }, iv(pl.t)))),
1098
- ];
1099
- }
1100
-
1101
- /** The blocker card (workspace-cockpit-nav): drawn only when a rung of the ladder is blocking, in the engine's own words. The cockpit
1102
- * draws it as the mockup's row: the words on the left, and on the right the slot of the Grant button, which stays empty until the
1103
- * grants ledger behind it exists (PRD Q3) — the slot keeps the card's height, so nothing moves when the button arrives. */
1104
- function blockerCard(b) {
1105
- if (cockpitLook()) {
1106
- const said = el('span', { style: 'color:var(--destructive)' }, iv(b.label + ' blocked' + (b.evidence ? ': ' + b.evidence : '')));
1107
- return el('div', {
1108
- 'data-cockpit': 'blocker',
1109
- style: 'border:1px solid color-mix(in oklab, var(--destructive) 50%, transparent);background:color-mix(in oklab, var(--destructive) 8%, transparent);border-radius:8px;padding:10px 12px;display:flex;align-items:center;justify-content:space-between;gap:10px',
1110
- },
1111
- b.next
1112
- ? el('div', { style: 'display:flex;flex-direction:column;gap:4px;min-width:0' }, said,
1113
- el('span', { style: 'color:var(--muted-foreground);font-size:12px;line-height:1.5' }, iv('next: ' + b.next)))
1114
- : said,
1115
- el('span', { 'data-cockpit': 'grant-slot', 'aria-hidden': 'true', style: 'flex:none;width:0;height:30px' }),
1116
- );
1117
- }
1118
- return el('div', {
1119
- 'data-cockpit': 'blocker',
1120
- style: 'border:1px solid color-mix(in oklab, var(--destructive) 50%, transparent);background:color-mix(in oklab, var(--destructive) 8%, transparent);border-radius:8px;padding:10px 12px;display:flex;flex-direction:column;gap:4px',
1121
- },
1122
- el('span', { style: 'color:var(--destructive);font-size:13px' }, iv(b.label + ' blocked' + (b.evidence ? ': ' + b.evidence : ''))),
1123
- b.next ? el('span', { style: 'color:var(--muted-foreground);font-size:12px;line-height:1.5' }, iv('next: ' + b.next)) : null,
1124
- );
1125
- }
1126
-
1127
- function initBody(slug) {
1128
- const rec = slug ? records()[slug] : null;
1129
- if (!rec) return [noneBody()];
1130
-
1131
- const out = [];
1132
-
1133
- if (rec.readError) {
1134
- // Header (slug, empty tag, no pills) → the red block → the footer. Nothing else (line 1703).
1135
- out.push(headerBlock(slug, '', []));
1136
- out.push(errorBlock(rec.readError));
1137
- out.push(footer(rec));
1138
- return out;
1139
- }
1140
-
1141
- const ck = cockpitLook();
1142
- if (ck) return cockpitInitBody(slug, rec);
1143
- {
1144
- out.push(headerBlock(slug, rec.tag || '', rec.pills || [], rec.crumb || null, lanePicker(slug, rec)));
1145
- if (rec.blocker) out.push(el('div', { style: 'margin:12px 14px 0' }, blockerCard(rec.blocker)));
1146
- }
1147
- { const bd = breakdownEntry(slug, rec, repoOf(slug)); if (bd) out.push(bd); }
1148
- { const sb = statusBanner(repoOf(slug), slug, rec); if (sb) out.push(sb); }
1149
- { const lc = lifecycleRow(repoOf(slug), slug); if (lc) { out.push(lc); const ln = lifecycleNotes(rec); if (ln) out.push(ln); } }
1150
-
1151
- if (rec.noLadder) {
1152
- const ansC = FX.TONE[(rec.answer && rec.answer.tone) || 'info'] || FX.C.mut;
1153
- out.push(...noLadderBlock(FX.wash(ansC), ansC, (rec.answer && rec.answer.text) || '', rec.noLadder));
1154
- }
1155
-
1156
- // What is RUNNING on this initiative, above the ladder: the loop position is the slower fact, and
1157
- // an agent waiting on the PM is the one they came to the panel for.
1158
- const sess = sessionsBlock(slug);
1159
- if (sess) out.push(sess);
1160
-
1161
- const nextB = nextStepsBlock(slug, rec);
1162
- if (nextB) out.push(nextB);
1163
-
1164
- { const fb = factsBlock(rec); if (fb) out.push(fb); }
1165
-
1166
- out.push(el('div', { style: 'border-top:1px solid var(--border)' },
1167
- linksRow(slug),
1168
- artifactsRow(slug, rec),
1169
- ));
1170
-
1171
- out.push(footer(rec));
1172
- return out;
1173
- }
1174
-
1175
- /* ── the cockpit's initiative (Run 4: the mockup's column, section for section) ─────────────────────────────────────────────
1176
- * The detail host is the mockup's column: 16px padding and a 12px gap between its sections (renderDetail sets that). In order:
1177
- * title, summary, chips, the blocker card, a rule, the phases, then what the mockup does not draw (the anchor line, the lane picker,
1178
- * the status, the sessions, the next steps, the facts), a rule, the artifacts, the links and the derivation line. A section with
1179
- * nothing to show is not drawn, so it leaves no gap. The sections the mockup does not draw were laid out for the full width of the
1180
- * column, so they keep it (`FULL`). */
1181
- const FULL = 'margin:0 -16px';
1182
- function cockpitInitBody(slug, rec) {
1183
- const out = [...cockpitTitle(slug, rec.tag || '', rec.pills || [])];
1184
- if (rec.blocker) out.push(blockerCard(rec.blocker));
1185
- { const bd = breakdownEntry(slug, rec, repoOf(slug)); if (bd) out.push(bd); }
1186
- const more = [crumbBlock(rec.crumb || null), lanePicker(slug, rec)].filter(Boolean);
1187
- if (more.length) out.push(el('div', null, more));
1188
- const wide = [];
1189
- { const sb = statusBanner(repoOf(slug), slug, rec); if (sb) wide.push(sb); }
1190
- { const lc = lifecycleRow(repoOf(slug), slug); if (lc) { wide.push(lc); const ln = lifecycleNotes(rec); if (ln) wide.push(ln); } }
1191
- if (rec.noLadder) {
1192
- const ansC = FX.TONE[(rec.answer && rec.answer.tone) || 'info'] || FX.C.mut;
1193
- wide.push(...noLadderBlock(FX.wash(ansC), ansC, (rec.answer && rec.answer.text) || '', rec.noLadder));
1194
- }
1195
- { const sess = sessionsBlock(slug); if (sess) wide.push(sess); }
1196
- { const nextB = nextStepsBlock(slug, rec); if (nextB) wide.push(nextB); }
1197
- { const fb = factsBlock(rec); if (fb) wide.push(fb); }
1198
- if (wide.length) out.push(el('div', { style: FULL }, wide));
1199
- out.push(CK_SEP(), cockpitArtifacts(slug, rec));
1200
- // The links row's + controls record a reference through the server; the fixture has no server and no links, so it has none.
1201
- const links = (rec.links || []).length || ((state.initLinks || {})[slug] || []).length || !FIXTURE ? linksRow(slug) : null;
1202
- if (links) out.push(el('div', { style: FULL + ';border-top:1px solid var(--border)' }, links));
1203
- // The derivation line says which working tree the panel was read from and when. The fixture read none, so it has no line.
1204
- if (!FIXTURE) out.push(el('div', { style: 'margin:auto -16px -16px' }, footer(rec)));
1205
- return out;
1206
- }
1207
-
1208
- /** The mockup's artifacts: a label, then a row per artifact — its role, its path — with the artifact's link and sync controls
1209
- * under the row (`data-art-links`). The mockup shows a sync badge in the row ("⇄ in sync"); the app never claims that, because it
1210
- * has never compared the two documents (see SYNC_NOT_A_SYNC), so the row says what is recorded through the controls instead. */
1211
- const CK_LBL = 'font:500 10px var(--mono);letter-spacing:.1em;text-transform:uppercase;color:var(--muted-foreground)';
1212
- function cockpitArtifacts(slug, rec) {
1213
- const arts = rec.arts || [];
1214
- const rows = [];
1215
- for (const a of arts) {
1216
- rows.push(el('button', {
1217
- onClick: () => openDoc(slug, a.path, a.role), 'data-art-row': a.path, title: a.path,
1218
- style: 'display:flex;align-items:center;gap:8px;width:100%;text-align:left', hover: 'background:var(--accent)',
1219
- },
1220
- el('span', { style: CK_BADGE + ';font-family:var(--mono)' }, iv(roleChip(a.role))),
1221
- el('span', { 'data-art-path': '', style: 'flex-grow:1;min-width:0;color:var(--muted-foreground);font:11px var(--mono)' }, iv(shortPath(a.path))),
1222
- ));
1223
- rows.push(el('div', { 'data-art-links': a.path }, artifactRow(slug, a, true)));
1224
- }
1225
- if (!arts.length) rows.push(el('span', { style: 'font-size:11.5px;color:var(--muted-foreground);font-style:italic' }, 'none filed'));
1226
- const conv = conversationsBlock(slug, rec), git = gitFilesBlock(slug, rec);
1227
- return el('div', { 'data-cockpit': 'artifacts', style: 'display:flex;flex-direction:column;gap:6px' },
1228
- el('div', { style: CK_LBL }, 'Artifacts'), rows, conv, git);
1229
- }
1230
-
1231
- /** A path as the mockup writes one: whole when it is short, else its first 24 characters, an ellipsis and its last 7, so the folder and
1232
- * the end of the name both stay readable ("planning/prd/ooh-weather…-prd.md"). The row's tooltip carries the whole path. */
1233
- export function shortPath(p) {
1234
- const s0 = String(p || '');
1235
- return s0.length <= 32 ? s0 : s0.slice(0, 24) + '…' + s0.slice(-7);
1236
- }
1237
-
1238
- /* ── `dNone` (lines 838–840) ────────────────────────────────────────────────────────────────── */
1239
-
1240
- function noneBody() {
1241
- return el('div', { style: 'flex:1;display:grid;place-items:center;color:var(--muted-foreground);font-size:12.5px;padding:20px;text-align:center' },
1242
- 'select something on the left');
1243
- }
1244
-
1245
- /* ── `dNew` — the file-new form (lines 665–728) ─────────────────────────────────────────────
1246
- * The form's MODEL belongs to panel 2 — every field it edits and every record it files lands on
1247
- * that board — so it is imported from there (`fileNewModel`) rather than re-derived here. Only the
1248
- * rendering is this panel's, because panel 3 is the host.
1249
- */
1250
- const NEW_LABEL = 'font-family:var(--mono);font-size:9.5px;letter-spacing:.12em;text-transform:uppercase;color:var(--muted-foreground)';
1251
- const NEW_FIELD_LABEL = NEW_LABEL + ';padding-top:8px';
1252
- const NEW_ROW = 'display:grid;grid-template-columns:76px 1fr;gap:10px;padding:10px 14px';
1253
-
1254
- /**
1255
- * A form field, caret-safe. `oninput` writes straight onto the state object WITHOUT a render — a
1256
- * repaint between keystrokes would rebuild the input and take the caret with it — and `onchange`
1257
- * commits through the model's own handler so everything derived from the field catches up. This is
1258
- * the same contract panel 1's `field()` uses; the prototype's React `onChange` did both at once.
1259
- */
1260
- function newField(key, value, commit, placeholder, css) {
1261
- return el('input', {
1262
- value, placeholder, style: css,
1263
- onInput: (e) => { state[key] = e.target.value; },
1264
- onChange: commit,
1265
- });
1266
- }
1267
-
1268
- function anchorButton(an) {
1269
- return el('button', {
1270
- onClick: an.on,
1271
- style: 'display:flex;gap:8px;align-items:center;min-height:34px;padding:0 9px;background:' + an.bg + ';border:1px solid ' + an.bc,
1272
- hover: 'border-color:var(--ring)',
1273
- },
1274
- el('span', { style: 'font-family:var(--mono);font-size:11px;color:' + an.color }, iv(an.label)),
1275
- el('span', { style: 'font-size:11px;color:var(--muted-foreground);overflow:hidden;text-overflow:ellipsis;white-space:nowrap' }, iv(an.sub)),
1276
- );
1277
- }
1278
-
1279
- /* ── BIND — the PM's own word about a session already running ──────────────────────────────────
1280
- *
1281
- * Every session that existed before a session could record its initiative has no attribution, and so
1282
- * does every session started outside PMOS. This is the only way one of them ever joins an initiative,
1283
- * which is why "show them read-only" was not enough.
1284
- *
1285
- * The whole surface turns on one distinction, stated in the copy rather than left to a code comment:
1286
- * what is recorded here is a DECLARATION. PMOS was not told at spawn and did not read it off
1287
- * anything — the PM is saying so. `initiative-links.jsonl` already draws that line with
1288
- * `origin`/`state`, and a binding that presented itself as a reading would be the same watermelon
1289
- * this repo keeps finding.
1290
- */
1291
- function bindBody() {
1292
- const out = [];
1293
- const rows = (state.sessions || []).filter((s) => s && s.shown !== 'exited');
1294
- const picked = state.bindSess && rows.find((s) => s.id === state.bindSess);
1295
- const board = state.board && state.board[state.product] ? state.board[state.product] : [];
1296
- const slugs = [];
1297
- for (const g of board) for (const sl of g.slugs || []) if (!slugs.includes(sl)) slugs.push(sl);
1298
- const typed = String(state.bindTo || '');
1299
- const matches = typed ? slugs.filter((sl) => sl.includes(typed.toLowerCase())).slice(0, 8) : [];
1300
-
1301
- out.push(el('div', { style: 'padding:13px 14px 11px;border-bottom:1px solid var(--border)' },
1302
- el('div', { style: 'font-size:14px;font-weight:600;margin-bottom:4px' }, 'bind a session'),
1303
- el('div', { style: 'font-size:11.5px;line-height:1.5;color:var(--muted-foreground)' },
1304
- 'PMOS was never told what these sessions are for, and nothing here can read it. '
1305
- + 'What you pick is recorded as YOUR declaration — not as something PMOS observed.')));
1306
-
1307
- out.push(el('div', { style: 'padding:10px 14px 2px;' + NEW_LABEL }, 'session'));
1308
- if (!rows.length) {
1309
- out.push(el('div', { style: 'padding:2px 14px 10px;font-size:11.5px;color:var(--muted-foreground);font-style:italic' },
1310
- 'no live sessions — a successful read of nothing'));
1311
- return out;
1312
- }
1313
- out.push(el('div', { style: 'display:flex;flex-direction:column;gap:2px;padding:2px 14px 6px' },
1314
- rows.map((s) => el('button', {
1315
- onClick: () => setState({ bindSess: s.id }),
1316
- style: 'display:flex;gap:8px;align-items:center;min-height:32px;padding:0 9px;background:'
1317
- + (picked && picked.id === s.id ? 'var(--secondary)' : 'transparent')
1318
- + ';border:1px solid ' + (picked && picked.id === s.id ? 'var(--input)' : 'var(--border)'),
1319
- hover: 'border-color:var(--ring)',
1320
- },
1321
- el('span', { style: 'font-family:var(--mono);font-size:11px;color:var(--foreground)' }, iv(s.name || s.id)),
1322
- el('span', { style: 'font-size:11px;color:var(--muted-foreground)' }, iv(s.label || s.shown || '')),
1323
- // What it is bound to NOW, and by what. A session already attributed can be re-bound, and the
1324
- // PM is entitled to see what they would be replacing before they replace it (R8).
1325
- s.initiative
1326
- ? el('span', { style: 'margin-left:auto;font-family:var(--mono);font-size:9.5px;color:var(--muted-foreground)' },
1327
- iv('→ ' + s.initiative + (s.attributed_by === 'declared' ? ' · declared' : ' · recorded')))
1328
- : null,
1329
- ))));
1330
-
1331
- out.push(el('div', { style: 'padding:6px 14px 2px;' + NEW_LABEL }, 'initiative'));
1332
- out.push(el('div', { style: 'padding:2px 14px 4px' },
1333
- newField('bindTo', typed, () => setState({}), 'type part of an initiative id',
1334
- 'width:100%;font-family:var(--mono);font-size:11px;padding:5px 7px;background:var(--secondary);border:1px solid var(--border);color:var(--foreground)')));
1335
- if (matches.length) {
1336
- out.push(el('div', { style: 'display:flex;flex-direction:column;gap:2px;padding:2px 14px 6px' },
1337
- matches.map((sl) => el('button', {
1338
- onClick: () => {
1339
- if (!picked) return;
1340
- const data = sibling('data', './data.js');
1341
- if (!data || typeof data.bindSessionInitiative !== 'function') return;
1342
- data.bindSessionInitiative(picked.id, sl).then((r) => {
1343
- setState({
1344
- bindResult: r && r.ok
1345
- ? '“' + (picked.name || picked.id) + '” is now on ' + sl
1346
- + (r.previous ? ' — replacing ' + r.previous : '')
1347
- : 'could not bind — ' + ((r && r.error) || 'the server did not answer'),
1348
- });
1349
- });
1350
- },
1351
- style: 'display:flex;gap:8px;align-items:center;min-height:30px;padding:0 9px;background:transparent;border:1px solid var(--border)',
1352
- hover: 'border-color:var(--ring)',
1353
- }, el('span', { style: 'font-family:var(--mono);font-size:11px' }, iv(sl))))));
1354
- } else if (typed) {
1355
- out.push(el('div', { style: 'padding:2px 14px 8px;font-size:11.5px;color:var(--muted-foreground);font-style:italic' },
1356
- 'nothing on this board matches — a successful read of nothing'));
1357
- }
1358
-
1359
- if (!picked) {
1360
- out.push(el('div', { style: 'padding:4px 14px 10px;font-size:11.5px;color:var(--muted-foreground)' },
1361
- 'pick a session first.'));
1362
- }
1363
- if (state.bindResult) {
1364
- out.push(el('div', { style: 'margin:4px 14px 10px;padding:8px 11px;border:1px solid var(--border);font-size:11.5px;line-height:1.5' },
1365
- iv(state.bindResult)));
1366
- }
1367
- return out;
1368
- }
1369
-
1370
- function fileNewBody() {
1371
- const nw = fileNewModel();
1372
- const out = [];
1373
-
1374
- out.push(el('div', { style: 'padding:13px 14px 11px;border-bottom:1px solid var(--border)' },
1375
- el('div', { style: 'font-family:var(--mono);font-size:15px;font-weight:600' }, 'file new'),
1376
- el('div', { style: 'font-size:12px;color:var(--muted-foreground);margin-top:2px' }, 'objectives and KRs are structure — initiatives are work'),
1377
- ));
1378
-
1379
- out.push(el('div', { style: 'display:flex;gap:4px;padding:10px 14px 2px' },
1380
- nw.typeBtns.map((tb) => el('button', {
1381
- onClick: tb.on,
1382
- style: 'font-family:var(--mono);font-size:10.5px;padding:5px 10px;min-height:28px;background:' + tb.bg + ';border:1px solid ' + tb.bc + ';color:' + tb.color,
1383
- hover: 'border-color:var(--ring)',
1384
- }, iv(tb.l))),
1385
- ));
1386
-
1387
- if (nw.isObj) {
1388
- out.push(el('div', { style: NEW_ROW },
1389
- el('span', { style: NEW_FIELD_LABEL }, 'name'),
1390
- newField('newName', nw.name, nw.onName, 'what this quarter is for…', 'font-size:12.5px;padding:6px 9px;border:1px solid var(--input);min-height:32px'),
1391
- ));
1392
- out.push(el('div', { style: 'padding:2px 14px 8px;font-size:11.5px;line-height:1.5;color:var(--muted-foreground)' },
1393
- 'An objective is a file — ',
1394
- el('span', { style: 'font-family:var(--mono)' }, 'planning/objectives/<id>.md'),
1395
- '. KRs and initiatives anchor upward to it.'));
1396
- }
1397
-
1398
- if (nw.isKr) {
1399
- out.push(el('div', { style: 'padding:10px 14px 4px;' + NEW_LABEL }, 'under objective'));
1400
- out.push(el('div', { style: 'display:flex;flex-direction:column;gap:2px;padding:2px 14px 4px' },
1401
- nw.anchors.map(anchorButton),
1402
- nw.noKrTargets
1403
- ? el('span', { style: 'font-size:11.5px;color:var(--muted-foreground);font-style:italic' }, 'every objective here already has its KR — add an objective first')
1404
- : null,
1405
- ));
1406
- out.push(el('div', { style: 'display:grid;grid-template-columns:76px 1fr;gap:10px;padding:6px 14px' },
1407
- el('span', { style: NEW_FIELD_LABEL }, 'name'),
1408
- newField('newName', nw.name, nw.onName, 'measurable result…', 'font-size:12.5px;padding:6px 9px;border:1px solid var(--input);min-height:32px'),
1409
- ));
1410
- }
1411
-
1412
- if (nw.isInit) {
1413
- out.push(el('div', { style: NEW_ROW },
1414
- el('span', { style: NEW_FIELD_LABEL }, 'slug'),
1415
- newField('newSlug', nw.slug, nw.onSlug, 'my-new-initiative', 'font-family:var(--mono);font-size:11.5px;padding:6px 9px;border:1px solid var(--input);min-height:32px'),
1416
- ));
1417
- out.push(el('div', { style: 'padding:2px 14px 4px;' + NEW_LABEL }, 'anchor · parent_kr'));
1418
- out.push(el('div', { style: 'display:flex;flex-direction:column;gap:2px;padding:2px 14px 4px' },
1419
- nw.anchors.map(anchorButton)));
1420
- if (nw.showD59) {
1421
- out.push(el('div', { style: 'margin:4px 14px;padding:8px 11px;border:1px solid var(--destructive);background:color-mix(in oklab, var(--destructive) 10%, transparent);font-size:11.5px;line-height:1.5' },
1422
- 'No anchor — it will be filed, then ',
1423
- el('span', { style: 'color:var(--destructive)' }, 'rejected at intake under D59'),
1424
- ', listed under unanchored, never hidden.'));
1425
- }
1426
- out.push(el('div', { style: 'padding:4px 14px 4px;' + NEW_LABEL }, 'workflow'));
1427
- out.push(el('div', { style: 'display:flex;gap:4px;flex-wrap:wrap;padding:2px 14px 6px' },
1428
- nw.flowsBtns.map((fb) => el('button', {
1429
- onClick: fb.on,
1430
- style: 'font-family:var(--mono);font-size:10.5px;padding:4px 8px;min-height:26px;background:' + fb.bg + ';border:1px solid ' + fb.bc + ';color:' + fb.color,
1431
- hover: 'border-color:var(--ring)',
1432
- }, iv(fb.l))),
1433
- ));
1434
- }
1435
-
1436
- out.push(el('div', { style: 'padding:8px 14px 12px;border-bottom:1px solid var(--border)' },
1437
- button({ label: nw.createLabel, variant: 'primary', onClick: nw.onCreate }),
1438
- ));
1439
-
1440
- out.push(el('div', { style: 'margin-top:auto;padding:8px 14px;border-top:1px solid var(--border);font-family:var(--mono);font-size:10px;color:var(--muted-foreground)' },
1441
- 'pmos new <objective | kr | initiative> — creates the file; the board derives'));
1442
-
1443
- return out;
1444
- }
1445
-
1446
- /* ── the secondary detail kinds ─────────────────────────────────────────────────────────────
1447
- * `flow · sched · skill · know · agent · mem · prof · intg` are modes.js's bodies, not this
1448
- * panel's. modes.js is loaded on first use; until it answers — or if it never does — the panel
1449
- * falls back to the prototype's own empty copy rather than rendering nothing at all.
1450
- */
1451
- let modesMod; // undefined = not tried · null = loading or unavailable · module = ready
1452
-
1453
- function modesModule() {
1454
- if (modesMod !== undefined) return modesMod;
1455
- modesMod = null;
1456
- import('./modes.js')
1457
- .then((m) => { modesMod = m; setState({}); })
1458
- .catch(() => { modesMod = null; });
1459
- return null;
1460
- }
1461
-
1462
- function modeDetailBody(kind) {
1463
- const mod = modesModule();
1464
- const fn = mod && (mod.detailBody || mod.renderDetailBody);
1465
- if (typeof fn === 'function') {
1466
- try {
1467
- const nodes = fn(kind, state.detail);
1468
- if (Array.isArray(nodes)) return nodes;
1469
- if (nodes) return [nodes];
1470
- } catch (e) { console.error('[pm] modes.detailBody failed:', e); }
1471
- }
1472
- return [noneBody()];
1473
- }
1474
-
1475
- /* ── render ────────────────────────────────────────────────────────────────────────────────── */
1476
-
1477
- export function renderDetail(host) {
1478
- const kind = (state.detail && state.detail.kind) || 'init';
1479
- // `bind` is not one of the prototype's detail kinds, and `fixture.js` is its seed data — adding a
1480
- // key there to title one screen would be drift into a file the parity suite exists to keep
1481
- // transcribed. The override lives here instead, where the screen does.
1482
- headerTitleText.textContent = kind === 'bind' ? 'bind a session' : FX.detailTitle(kind);
1483
-
1484
- let body;
1485
- if (kind === 'init') body = initBody(selectedSlug());
1486
- else if (kind === 'addprod') body = addProductBody();
1487
- else if (kind === 'bind') body = bindBody();
1488
- else if (kind === 'new') body = fileNewBody();
1489
- else if (kind === 'none') body = [noneBody()];
1490
- else body = modeDetailBody(kind);
1491
-
1492
- // the cockpit draws an initiative without the panel's own title bar (the top bar's breadcrumb names it)
1493
- const bare = cockpitLook() && kind === 'init';
1494
- /* The cockpit's column is the mockup's: the page's own background, and for an initiative 16px of padding and a 12px
1495
- * gap between sections. The legacy shell and a phone keep the panel's sidebar fill and draw their own padding. */
1496
- const ckCol = cockpitLook();
1497
- host.style.background = ckCol ? 'transparent' : 'var(--sidebar)';
1498
- host.style.padding = ckCol && bare ? '16px' : '';
1499
- host.style.gap = ckCol && bare ? '12px' : '';
1500
- /* The cockpit's initiative has no title bar, so its fold control floats at the column's top right. The column folds to the 36px
1501
- * strip app.js draws ("initiative ⟩"), which opens it again. Nothing in the column moves (design-parity names the control). */
1502
- host.style.position = bare ? 'relative' : '';
1503
- return setChildren(host, bare ? [...body, foldDetail] : [stickyHeader, ...body]);
1504
- }
1505
-
1506
- const foldDetail = el('button', {
1507
- 'data-fold': 'detail', 'aria-label': 'hide the detail', title: 'hide the detail',
1508
- onClick: () => setState({ col2: false }),
1509
- style: 'position:absolute;top:10px;right:10px;height:28px;padding:0 8px;border-radius:6px;font-size:14px;color:var(--muted-foreground)',
1510
- hover: 'color:var(--foreground);background:var(--accent)',
1511
- }, '⟨');
1512
-
1513
- export default renderDetail;