create-pmos 0.399.0 → 0.401.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (425) hide show
  1. package/package.json +30 -25
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/workspace/briefing-premium-adddoc-test.js +2 -2
  7. package/workspace/briefing-premium-board-test.js +3 -3
  8. package/workspace/briefing-premium-doc-edit-test.js +2 -8
  9. package/workspace/briefing-premium-sources-test.js +2 -0
  10. package/workspace/briefing-premium-test.js +6 -2
  11. package/workspace/briefing-premium-work-test.js +9 -4
  12. package/workspace/c3-capture-test.js +0 -17
  13. package/workspace/changelog.json +29 -0
  14. package/workspace/guide/briefing-premium.md +2 -2
  15. package/workspace/guide/home.md +24 -3
  16. package/workspace/guide/layout.md +2 -2
  17. package/workspace/guide/notes.md +2 -2
  18. package/workspace/guide/phone-companion.md +1 -1
  19. package/workspace/lib/core-docs.js +2 -2
  20. package/workspace/lib/route-modules.js +1 -9
  21. package/workspace/lib/routes-phone-day.js +18 -9
  22. package/workspace/lib/routes-slash.js +95 -0
  23. package/workspace/package-lock.json +2 -2
  24. package/workspace/package.json +1 -2
  25. package/workspace/premium-chat-goal-view-test.js +1 -1
  26. package/workspace/premium-chat-term-test.js +0 -10
  27. package/workspace/premium-menu-rows-test.js +1 -1
  28. package/workspace/premium-phone-card-test.js +8 -3
  29. package/workspace/premium-vw-cal-test.js +4 -1
  30. package/workspace/premium-vw-doc-test.js +1 -8
  31. package/workspace/premium-work-depth-test.js +2 -3
  32. package/workspace/public/capture.html +23 -0
  33. package/workspace/public/pm/c3-base.js +47 -0
  34. package/workspace/public/pm/c3-capture.js +1 -1
  35. package/workspace/public/pm/c3-ini-ui.js +1 -1
  36. package/workspace/public/pm/c3-sheet.js +1 -1
  37. package/workspace/public/pm/c3-toast.js +1 -1
  38. package/workspace/public/pm/console3.css +3 -0
  39. package/workspace/public/pm/cozy-home.css +21 -6
  40. package/workspace/public/pm/cozy-today.css +4 -3
  41. package/workspace/public/pm/cozy-viewer.js +4 -2
  42. package/workspace/public/pm/cozy.css +9 -0
  43. package/workspace/public/pm/goal-chat.js +5 -1
  44. package/workspace/public/pm/home-app.js +65 -33
  45. package/workspace/public/pm/home-chat.js +34 -29
  46. package/workspace/public/pm/home-data.js +10 -2
  47. package/workspace/public/pm/home-dictate.js +7 -4
  48. package/workspace/public/pm/home-ini.js +13 -3
  49. package/workspace/public/pm/home-list.js +18 -10
  50. package/workspace/public/pm/home-more.js +2 -2
  51. package/workspace/public/pm/home-phone-card.js +9 -4
  52. package/workspace/public/pm/home-review.js +2 -3
  53. package/workspace/public/pm/home-today.js +11 -8
  54. package/workspace/public/pm/home-work.js +13 -8
  55. package/workspace/public/pm/note-dock.js +1 -2
  56. package/workspace/public/pm/notes-links.js +1 -2
  57. package/workspace/public/pm/notes-task.js +3 -4
  58. package/workspace/public/pm/premium-board.js +1 -1
  59. package/workspace/public/pm/premium-initiative-head.js +3 -3
  60. package/workspace/public/pm/premium-vw-doc.css +20 -2
  61. package/workspace/public/pm/premium-vw-doc.js +22 -7
  62. package/workspace/public/pm/premium-vw-item.css +6 -0
  63. package/workspace/public/pm/view-notes.js +2 -2
  64. package/workspace/replaced-tests.json +435 -0
  65. package/workspace/run-tests.js +323 -28
  66. package/workspace/server.js +15 -10
  67. package/workspace/test-files.json +4 -140
  68. package/workspace/test-lists/base.json +1 -2
  69. package/workspace/test-lists/c3-desktop-light-load.json +1 -2
  70. package/workspace/test-lists/c3-initiative-boards.json +1 -2
  71. package/workspace/test-lists/c3-meeting-focus.json +2 -12
  72. package/workspace/test-lists/c3-work-agent.json +1 -2
  73. package/workspace/test-lists/calendar-tidy-up.json +1 -2
  74. package/workspace/test-lists/console3-reports.json +1 -2
  75. package/workspace/test-lists/docs-three-way-sync.json +1 -2
  76. package/workspace/test-lists/extension-capture.json +5 -0
  77. package/workspace/test-lists/jira-wbs.json +1 -2
  78. package/workspace/test-lists/legacy-cleanup-a.json +9 -0
  79. package/workspace/test-lists/meeting-material.json +1 -2
  80. package/workspace/test-lists/meeting-notes.json +2 -36
  81. package/workspace/test-lists/meeting-replay.json +1 -2
  82. package/workspace/test-lists/mm-capture.json +2 -12
  83. package/workspace/test-lists/my-work.json +2 -10
  84. package/workspace/test-lists/onboarding-firstrun.json +2 -12
  85. package/workspace/test-lists/people-directory.json +1 -2
  86. package/workspace/test-lists/run2-a.json +1 -2
  87. package/workspace/test-lists/run2-d.json +2 -19
  88. package/workspace/test-lists/run3-b.json +1 -2
  89. package/workspace/test-lists/run3-c.json +2 -12
  90. package/workspace/test-lists/run4-b.json +1 -2
  91. package/workspace/test-lists/run4-d.json +1 -5
  92. package/workspace/test-lists/run5-c.json +1 -11
  93. package/workspace/test-lists/run6.json +1 -5
  94. package/workspace/test-lists/workspace-launch-flags.json +2 -12
  95. package/workspace/test-lists/workspace-profile-detection.json +2 -10
  96. package/workspace/test-timings.json +242 -123
  97. package/workspace/c3-briefing-test.js +0 -136
  98. package/workspace/c3-core-docs-test.js +0 -170
  99. package/workspace/c3-driver-fixture.js +0 -64
  100. package/workspace/c3-driver-test.js +0 -169
  101. package/workspace/c3-foundation-test.js +0 -163
  102. package/workspace/c3-ib-items-test.js +0 -114
  103. package/workspace/c3-ib-more-test.js +0 -146
  104. package/workspace/c3-ib-triage-backlog-test.js +0 -128
  105. package/workspace/c3-ini-harness.js +0 -66
  106. package/workspace/c3-ini-life-test.js +0 -167
  107. package/workspace/c3-initiatives-test.js +0 -186
  108. package/workspace/c3-light-load-test.js +0 -112
  109. package/workspace/c3-one-home-test.js +0 -149
  110. package/workspace/c3-phone-test.js +0 -289
  111. package/workspace/c3-quiet-test.js +0 -157
  112. package/workspace/c3-report-design-real-test.js +0 -264
  113. package/workspace/c3-report-design-test.js +0 -442
  114. package/workspace/c3-report-setup-test.js +0 -192
  115. package/workspace/c3-report-structure-real-test.js +0 -248
  116. package/workspace/c3-report-structure-test.js +0 -397
  117. package/workspace/c3-reports-test.js +0 -288
  118. package/workspace/c3-scan-test.js +0 -517
  119. package/workspace/c3-sessions-panel-test.js +0 -365
  120. package/workspace/c3-settings-test.js +0 -204
  121. package/workspace/c3-updates-test.js +0 -131
  122. package/workspace/c3-work-test.js +0 -260
  123. package/workspace/cut-stub.js +0 -40
  124. package/workspace/first-paint-audit.js +0 -160
  125. package/workspace/lib/c3-full-console.js +0 -15
  126. package/workspace/lib/engine/derived/trust.js +0 -3
  127. package/workspace/lib/engine/plan-forecast.js +0 -342
  128. package/workspace/lib/engine/report-families.js +0 -175
  129. package/workspace/lib/engine/truth-table.js +0 -57
  130. package/workspace/lib/routes-c3-init.js +0 -54
  131. package/workspace/lib/routes-c3-life.js +0 -120
  132. package/workspace/lib/routes-c3-timeline.js +0 -192
  133. package/workspace/lib/routes-forecast.js +0 -86
  134. package/workspace/lib/routes-releases.js +0 -130
  135. package/workspace/lib/routes-report-facts.js +0 -85
  136. package/workspace/lib/routes-report-families.js +0 -33
  137. package/workspace/lib/routes-signals.js +0 -51
  138. package/workspace/lib/routes-timeline.js +0 -197
  139. package/workspace/public/c3.html +0 -35
  140. package/workspace/public/index.html +0 -156
  141. package/workspace/public/pm/app.js +0 -831
  142. package/workspace/public/pm/bd-board.js +0 -159
  143. package/workspace/public/pm/bd-drag.js +0 -59
  144. package/workspace/public/pm/bd-model.js +0 -152
  145. package/workspace/public/pm/bd-timeline.js +0 -233
  146. package/workspace/public/pm/bd-tree.js +0 -244
  147. package/workspace/public/pm/board-copy.js +0 -59
  148. package/workspace/public/pm/board-read.js +0 -38
  149. package/workspace/public/pm/branches-sheet.js +0 -56
  150. package/workspace/public/pm/breakdown-api.js +0 -58
  151. package/workspace/public/pm/breakdown-copy.js +0 -138
  152. package/workspace/public/pm/briefing-deck.js +0 -441
  153. package/workspace/public/pm/briefing-model.js +0 -251
  154. package/workspace/public/pm/c3-ambient.js +0 -100
  155. package/workspace/public/pm/c3-audience-link.js +0 -21
  156. package/workspace/public/pm/c3-audience.js +0 -46
  157. package/workspace/public/pm/c3-boot.js +0 -13
  158. package/workspace/public/pm/c3-breakdown.js +0 -240
  159. package/workspace/public/pm/c3-brief-data.js +0 -11
  160. package/workspace/public/pm/c3-brief-mentions.js +0 -137
  161. package/workspace/public/pm/c3-brief-needs.js +0 -288
  162. package/workspace/public/pm/c3-brief-pulse.js +0 -112
  163. package/workspace/public/pm/c3-brief-summary.js +0 -139
  164. package/workspace/public/pm/c3-brief-today.js +0 -79
  165. package/workspace/public/pm/c3-brief.js +0 -279
  166. package/workspace/public/pm/c3-cal-strategy.js +0 -529
  167. package/workspace/public/pm/c3-calendar.js +0 -965
  168. package/workspace/public/pm/c3-calpop.js +0 -111
  169. package/workspace/public/pm/c3-case.js +0 -196
  170. package/workspace/public/pm/c3-core-docs.css +0 -18
  171. package/workspace/public/pm/c3-core-docs.js +0 -236
  172. package/workspace/public/pm/c3-daypart.js +0 -176
  173. package/workspace/public/pm/c3-demo-boards.js +0 -764
  174. package/workspace/public/pm/c3-demo-brief-ix.js +0 -350
  175. package/workspace/public/pm/c3-demo-brief-page.js +0 -70
  176. package/workspace/public/pm/c3-demo-cal-ix.js +0 -74
  177. package/workspace/public/pm/c3-demo-cal2.js +0 -66
  178. package/workspace/public/pm/c3-demo-cal3.js +0 -173
  179. package/workspace/public/pm/c3-demo-cal4.js +0 -169
  180. package/workspace/public/pm/c3-demo-cal5.js +0 -52
  181. package/workspace/public/pm/c3-demo-coredocs.js +0 -221
  182. package/workspace/public/pm/c3-demo-data.js +0 -552
  183. package/workspace/public/pm/c3-demo-focus.js +0 -181
  184. package/workspace/public/pm/c3-demo-init.js +0 -430
  185. package/workspace/public/pm/c3-demo-life.js +0 -77
  186. package/workspace/public/pm/c3-demo-material.js +0 -58
  187. package/workspace/public/pm/c3-demo-misc2.js +0 -34
  188. package/workspace/public/pm/c3-demo-phone.js +0 -48
  189. package/workspace/public/pm/c3-demo-plan2.js +0 -30
  190. package/workspace/public/pm/c3-demo-rd.js +0 -432
  191. package/workspace/public/pm/c3-demo-rep-ix.js +0 -126
  192. package/workspace/public/pm/c3-demo-rep2.js +0 -130
  193. package/workspace/public/pm/c3-demo-rep3.js +0 -138
  194. package/workspace/public/pm/c3-demo-rs.js +0 -287
  195. package/workspace/public/pm/c3-demo-term.js +0 -153
  196. package/workspace/public/pm/c3-demo-time.js +0 -49
  197. package/workspace/public/pm/c3-demo-work-ix.js +0 -32
  198. package/workspace/public/pm/c3-demo.js +0 -131
  199. package/workspace/public/pm/c3-design-studio.js +0 -369
  200. package/workspace/public/pm/c3-doc-formats.js +0 -153
  201. package/workspace/public/pm/c3-doc-sheet.js +0 -1230
  202. package/workspace/public/pm/c3-dock.js +0 -206
  203. package/workspace/public/pm/c3-docs.js +0 -291
  204. package/workspace/public/pm/c3-driver-work.js +0 -110
  205. package/workspace/public/pm/c3-driver.css +0 -18
  206. package/workspace/public/pm/c3-driver.js +0 -298
  207. package/workspace/public/pm/c3-focus.css +0 -304
  208. package/workspace/public/pm/c3-focus.js +0 -983
  209. package/workspace/public/pm/c3-ib-docs.js +0 -92
  210. package/workspace/public/pm/c3-ib-initiatives.js +0 -201
  211. package/workspace/public/pm/c3-ib-items.js +0 -210
  212. package/workspace/public/pm/c3-ib-releases.js +0 -48
  213. package/workspace/public/pm/c3-ib-sprints.js +0 -201
  214. package/workspace/public/pm/c3-ib-triage.js +0 -177
  215. package/workspace/public/pm/c3-ii-tabs.js +0 -252
  216. package/workspace/public/pm/c3-ini-life.css +0 -34
  217. package/workspace/public/pm/c3-ini-life.js +0 -379
  218. package/workspace/public/pm/c3-ini-records.js +0 -197
  219. package/workspace/public/pm/c3-ini-timeline.js +0 -278
  220. package/workspace/public/pm/c3-ini-work.js +0 -139
  221. package/workspace/public/pm/c3-init-extras.js +0 -170
  222. package/workspace/public/pm/c3-initiatives.js +0 -852
  223. package/workspace/public/pm/c3-lifecycle-panels.js +0 -479
  224. package/workspace/public/pm/c3-look.js +0 -27
  225. package/workspace/public/pm/c3-material.css +0 -22
  226. package/workspace/public/pm/c3-material.js +0 -321
  227. package/workspace/public/pm/c3-md.js +0 -3
  228. package/workspace/public/pm/c3-misc-panels.js +0 -89
  229. package/workspace/public/pm/c3-new-session.js +0 -110
  230. package/workspace/public/pm/c3-notes.js +0 -751
  231. package/workspace/public/pm/c3-phone-boot.js +0 -47
  232. package/workspace/public/pm/c3-phone-detail.js +0 -97
  233. package/workspace/public/pm/c3-phone-model.js +0 -3
  234. package/workspace/public/pm/c3-phone.css +0 -66
  235. package/workspace/public/pm/c3-phone.js +0 -444
  236. package/workspace/public/pm/c3-plan-panels.js +0 -163
  237. package/workspace/public/pm/c3-plan.js +0 -193
  238. package/workspace/public/pm/c3-quiet.css +0 -113
  239. package/workspace/public/pm/c3-quiet.js +0 -177
  240. package/workspace/public/pm/c3-replay.css +0 -133
  241. package/workspace/public/pm/c3-replay.js +0 -429
  242. package/workspace/public/pm/c3-report-deck.css +0 -163
  243. package/workspace/public/pm/c3-report-deck.js +0 -598
  244. package/workspace/public/pm/c3-report-frame.css +0 -20
  245. package/workspace/public/pm/c3-report-print.css +0 -20
  246. package/workspace/public/pm/c3-report-setup.css +0 -67
  247. package/workspace/public/pm/c3-report-setup.js +0 -298
  248. package/workspace/public/pm/c3-report-store.js +0 -244
  249. package/workspace/public/pm/c3-report-structure.css +0 -44
  250. package/workspace/public/pm/c3-report-structure.js +0 -473
  251. package/workspace/public/pm/c3-reports.css +0 -68
  252. package/workspace/public/pm/c3-reports.js +0 -377
  253. package/workspace/public/pm/c3-roadmap.js +0 -249
  254. package/workspace/public/pm/c3-scan-api.js +0 -167
  255. package/workspace/public/pm/c3-scan-next.js +0 -248
  256. package/workspace/public/pm/c3-scan-setup.js +0 -313
  257. package/workspace/public/pm/c3-scan-words.js +0 -41
  258. package/workspace/public/pm/c3-scan.css +0 -74
  259. package/workspace/public/pm/c3-scan.js +0 -93
  260. package/workspace/public/pm/c3-session-chat.js +0 -103
  261. package/workspace/public/pm/c3-session-conv.js +0 -165
  262. package/workspace/public/pm/c3-session-term.js +0 -216
  263. package/workspace/public/pm/c3-settings.css +0 -85
  264. package/workspace/public/pm/c3-settings.js +0 -1045
  265. package/workspace/public/pm/c3-shell.js +0 -628
  266. package/workspace/public/pm/c3-signals.js +0 -196
  267. package/workspace/public/pm/c3-strategy-panels.js +0 -45
  268. package/workspace/public/pm/c3-swipe.js +0 -230
  269. package/workspace/public/pm/c3-terminal-data.js +0 -48
  270. package/workspace/public/pm/c3-terminal-edge.js +0 -91
  271. package/workspace/public/pm/c3-terminal-icons.js +0 -40
  272. package/workspace/public/pm/c3-terminal-results.js +0 -141
  273. package/workspace/public/pm/c3-terminal.js +0 -52
  274. package/workspace/public/pm/c3-tickets.js +0 -163
  275. package/workspace/public/pm/c3-timeline.js +0 -201
  276. package/workspace/public/pm/calendar-views.js +0 -1049
  277. package/workspace/public/pm/console3-lift.md +0 -220
  278. package/workspace/public/pm/cozy-home.js +0 -172
  279. package/workspace/public/pm/cozy-initiative.css +0 -138
  280. package/workspace/public/pm/cycle-review.js +0 -125
  281. package/workspace/public/pm/data.js +0 -1577
  282. package/workspace/public/pm/dest-board.js +0 -444
  283. package/workspace/public/pm/dest-docs.js +0 -530
  284. package/workspace/public/pm/dest-initiatives.js +0 -162
  285. package/workspace/public/pm/dest-mywork.js +0 -307
  286. package/workspace/public/pm/dest-notes.js +0 -537
  287. package/workspace/public/pm/dest-people.js +0 -449
  288. package/workspace/public/pm/dest-reports.js +0 -383
  289. package/workspace/public/pm/dest-settings.js +0 -601
  290. package/workspace/public/pm/dest-today.js +0 -267
  291. package/workspace/public/pm/display-word.js +0 -56
  292. package/workspace/public/pm/doc-editor.js +0 -473
  293. package/workspace/public/pm/doc-graph.js +0 -272
  294. package/workspace/public/pm/doc-health-panel.js +0 -110
  295. package/workspace/public/pm/doc-rail.js +0 -167
  296. package/workspace/public/pm/doc-remote.js +0 -180
  297. package/workspace/public/pm/dock-sessions.js +0 -472
  298. package/workspace/public/pm/dock.js +0 -216
  299. package/workspace/public/pm/fixture.js +0 -821
  300. package/workspace/public/pm/flag-picker.js +0 -104
  301. package/workspace/public/pm/frame-copy.js +0 -278
  302. package/workspace/public/pm/freshness-line.js +0 -149
  303. package/workspace/public/pm/handoff-box.js +0 -82
  304. package/workspace/public/pm/initiative-list.js +0 -235
  305. package/workspace/public/pm/initiative-sheet.js +0 -331
  306. package/workspace/public/pm/initiatives-api.js +0 -95
  307. package/workspace/public/pm/initiatives-copy.js +0 -287
  308. package/workspace/public/pm/initiatives-timeline-copy.js +0 -59
  309. package/workspace/public/pm/initiatives-timeline.js +0 -410
  310. package/workspace/public/pm/initiatives-ui.js +0 -291
  311. package/workspace/public/pm/item-sheet.js +0 -268
  312. package/workspace/public/pm/keep-card.js +0 -204
  313. package/workspace/public/pm/lifecycle-lens-model.js +0 -246
  314. package/workspace/public/pm/lifecycle-lens.js +0 -276
  315. package/workspace/public/pm/lifecycle.js +0 -111
  316. package/workspace/public/pm/mobile.css +0 -366
  317. package/workspace/public/pm/mobile.js +0 -581
  318. package/workspace/public/pm/modes-live.js +0 -453
  319. package/workspace/public/pm/modes.js +0 -147
  320. package/workspace/public/pm/my-work-card.js +0 -51
  321. package/workspace/public/pm/my-work-data.js +0 -36
  322. package/workspace/public/pm/new-initiative-sheet.js +0 -169
  323. package/workspace/public/pm/next-step-ui.js +0 -190
  324. package/workspace/public/pm/outbox-panel.js +0 -125
  325. package/workspace/public/pm/palette-copy.js +0 -55
  326. package/workspace/public/pm/palette.js +0 -343
  327. package/workspace/public/pm/panel-breakdown.js +0 -702
  328. package/workspace/public/pm/panel-cockpit.js +0 -425
  329. package/workspace/public/pm/panel-detail.js +0 -1513
  330. package/workspace/public/pm/panel-initiatives.js +0 -929
  331. package/workspace/public/pm/panel-newsess.js +0 -709
  332. package/workspace/public/pm/panel-repos.js +0 -741
  333. package/workspace/public/pm/panel-tabs.js +0 -1506
  334. package/workspace/public/pm/panel-trees.js +0 -204
  335. package/workspace/public/pm/people-link.js +0 -106
  336. package/workspace/public/pm/phone-deck.js +0 -167
  337. package/workspace/public/pm/pm-work-view.js +0 -1533
  338. package/workspace/public/pm/portfolio-report.js +0 -61
  339. package/workspace/public/pm/premium-acts.js +0 -280
  340. package/workspace/public/pm/premium-brief.js +0 -111
  341. package/workspace/public/pm/premium-chat.js +0 -22
  342. package/workspace/public/pm/premium-doc-sheet.js +0 -312
  343. package/workspace/public/pm/premium-initiative.js +0 -324
  344. package/workspace/public/pm/premium-insights.css +0 -228
  345. package/workspace/public/pm/premium-metric-tiles.js +0 -68
  346. package/workspace/public/pm/premium-report-brief.js +0 -132
  347. package/workspace/public/pm/premium-vw-rec.js +0 -67
  348. package/workspace/public/pm/premium-wide.css +0 -30
  349. package/workspace/public/pm/print.css +0 -44
  350. package/workspace/public/pm/provider-cards.js +0 -136
  351. package/workspace/public/pm/registry.js +0 -203
  352. package/workspace/public/pm/release-card.js +0 -110
  353. package/workspace/public/pm/releases-view.js +0 -248
  354. package/workspace/public/pm/report-families-view.js +0 -505
  355. package/workspace/public/pm/report-slides.js +0 -438
  356. package/workspace/public/pm/report-tab.js +0 -33
  357. package/workspace/public/pm/report-view.js +0 -337
  358. package/workspace/public/pm/reports-copy.js +0 -134
  359. package/workspace/public/pm/roadmap.js +0 -294
  360. package/workspace/public/pm/run-card.js +0 -260
  361. package/workspace/public/pm/sessions-panel.js +0 -219
  362. package/workspace/public/pm/sheet-jira.js +0 -353
  363. package/workspace/public/pm/shell-bell.js +0 -163
  364. package/workspace/public/pm/shell-model.js +0 -83
  365. package/workspace/public/pm/shell-phone.js +0 -124
  366. package/workspace/public/pm/shell-readaloud.js +0 -53
  367. package/workspace/public/pm/shell-recording.js +0 -274
  368. package/workspace/public/pm/shell-ticker.js +0 -90
  369. package/workspace/public/pm/sig-watch.js +0 -41
  370. package/workspace/public/pm/slide-confirm.js +0 -163
  371. package/workspace/public/pm/slides-copy.js +0 -52
  372. package/workspace/public/pm/status-banner.js +0 -95
  373. package/workspace/public/pm/tab-doc.js +0 -859
  374. package/workspace/public/pm/tab-gone.js +0 -21
  375. package/workspace/public/pm/tab-term.js +0 -1210
  376. package/workspace/public/pm/tab-web.js +0 -90
  377. package/workspace/public/pm/timeline-copy.js +0 -48
  378. package/workspace/public/pm/timeline-forecast-view.js +0 -164
  379. package/workspace/public/pm/today-agenda.js +0 -331
  380. package/workspace/public/pm/today-cards.js +0 -244
  381. package/workspace/public/pm/today-copy.js +0 -506
  382. package/workspace/public/pm/today-day.js +0 -1371
  383. package/workspace/public/pm/today-goals.js +0 -297
  384. package/workspace/public/pm/today-jobs.js +0 -84
  385. package/workspace/public/pm/today-mentions.js +0 -50
  386. package/workspace/public/pm/topbar.js +0 -202
  387. package/workspace/public/pm/triage-card.js +0 -60
  388. package/workspace/public/pm/undo-hold.js +0 -103
  389. package/workspace/public/pm/view-addrepo.js +0 -208
  390. package/workspace/public/pm/view-files.js +0 -197
  391. package/workspace/public/pm/view-livenotes.js +0 -399
  392. package/workspace/public/pm/view-today.js +0 -13
  393. package/workspace/public/pm/view-validate.js +0 -171
  394. package/workspace/public/pm/welcome.js +0 -391
  395. package/workspace/public/pm/work-place.js +0 -68
  396. package/workspace/public/pm/xlsx-read.js +0 -117
  397. package/workspace/public/welcome.html +0 -22
  398. package/workspace/test-lists/browser-suites-green.json +0 -5
  399. package/workspace/test-lists/c3-core-docs.json +0 -9
  400. package/workspace/test-lists/c3-doc-sheet-rich.json +0 -6
  401. package/workspace/test-lists/c3-doc-sheet-size.json +0 -6
  402. package/workspace/test-lists/c3-doc-sheet-v2.json +0 -6
  403. package/workspace/test-lists/c3-ib-items.json +0 -9
  404. package/workspace/test-lists/c3-ib-more.json +0 -9
  405. package/workspace/test-lists/c3-ib-triage-backlog.json +0 -9
  406. package/workspace/test-lists/c3-ini-life.json +0 -9
  407. package/workspace/test-lists/c3-meeting-board.json +0 -5
  408. package/workspace/test-lists/c3-meeting-card.json +0 -5
  409. package/workspace/test-lists/c3-notes-place.json +0 -5
  410. package/workspace/test-lists/c3-notes-series.json +0 -5
  411. package/workspace/test-lists/calendar-time-page.json +0 -5
  412. package/workspace/test-lists/calpop.json +0 -4
  413. package/workspace/test-lists/console3-briefing.json +0 -9
  414. package/workspace/test-lists/console3-foundation.json +0 -9
  415. package/workspace/test-lists/console3-work-page.json +0 -9
  416. package/workspace/test-lists/premium-brief-parity.json +0 -9
  417. package/workspace/test-lists/report-design-studio-ui.json +0 -5
  418. package/workspace/test-lists/report-structure-ui.json +0 -11
  419. package/workspace/test-lists/report-workspace-ui.json +0 -5
  420. package/workspace/test-lists/run3-a.json +0 -5
  421. package/workspace/test-lists/run3-d.json +0 -6
  422. package/workspace/test-lists/run4-c.json +0 -13
  423. package/workspace/test-lists/today-goals-jobs-ui.json +0 -5
  424. package/workspace/test-lists/today-mentions-cards.json +0 -5
  425. package/workspace/test-lists/workspace-tabs-declutter.json +0 -13
@@ -1,312 +0,0 @@
1
- /* pm/premium-doc-sheet.js — the premium document sheet, shared by the Board page and the initiative page (initiative briefing-premium-doc-edit, then premium-doc-sheet).
2
- * A document row with a file opens the sheet in the standard dialog beside the read-only agent: Read, Edit, Proposals, Edit log and Health, from the existing
3
- * /api/doc-sheet routes and POST /api/doc-health/check. A draft has Issue it (POST /api/core-docs/issue) and, where the page asks for it, Draft it again.
4
- * The caller gives the page's own facts: { ws(), scope(), rows(), reload(), noteKey(d), sub(), again }. */
5
- import { pmPost } from './http.js';
6
- import { openCopy } from './premium-vw-copies.js';
7
- import { proposalsModel, relationsOf, copyKindOf, copyView, editBody, acceptBody, rejectBody, askBody, askLine, issueBody, mdHtml, sectionAttribution, revDiffHtml } from './premium-doc-edit.js';
8
- import { $, $$, esc, openDlg, closeDlg, toast, loadThread, logHtml, turnA, ptx, kv, CHECK, CHEV, AI } from './premium-shell.js';
9
- import { openDocPage } from './premium-vw-doc.js';
10
-
11
- const when = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); if (!m) return ''; return +m[3] + ' ' + ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][+m[2] - 1]; };
12
-
13
- export function mountDocSheet(ctx) {
14
- let sheet = null; // { d, tab, text, log, health, props, draft, why, ask, askText, picked, busy, msg, err }
15
- const prevRev = (R, r) => { const i = R.indexOf(r); return i >= 0 && i + 1 < R.length ? R[i + 1].rev : null; }; // R is newest first
16
- const cmpHtml = (c) => (c === 'busy' ? 'Comparing.' : c.err ? esc(c.err) : c.changed ? c.html : 'No change in the words.');
17
- const TABS = [['read', 'Read'], ['edit', 'Edit'], ['props', 'Proposals'], ['log', 'Edit log'], ['health', 'Health'], ['rel', 'Relations']];
18
- const wsq = () => (ctx.ws() ? '&ws=' + encodeURIComponent(ctx.ws()) : '');
19
- const propsM = (s) => proposalsModel(s.props || []);
20
- /** The bar above a draft (core document Issue, initiative premium-core-doc-issue). The words are fixed; the state is the row's own. */
21
- function issueBar(s) {
22
- const d = s.d;
23
- if (s.issued && d.st !== 'draft') return `<div class="dsiss dsok" data-issue-bar="done" role="status"><span>${CHECK}Issued. Nothing was sent to anyone. The row now reads ${esc(d.state)}.</span></div>`;
24
- if (d.st !== 'draft' || !d.slot) return '';
25
- return `<div class="dsiss" data-issue-bar="draft"><span>${AI}PMOS drafted this from its sources. Nothing is sent. ${ctx.again ? 'Read it, then issue it, or draft it again.' : 'Read it, change what you like, then issue it.'}</span><span class="dsa"><button class="dmcta dark" data-ds="issue"${s.busy ? ' disabled' : ''}>Issue it</button>${ctx.again ? `<button class="dmcta alt" data-ds="again"${s.busy ? ' disabled' : ''}>Draft it again</button>` : ''}</span></div>`
26
- + (s.msg && s.tab === 'read' ? `<p class="note" id="dsErr" role="alert" style="margin:-4px 0 10px;color:var(--ember-ink)">${esc(s.msg)}</p>` : '');
27
- }
28
- const whoOf = (r) => (r.git && r.git.author) || (r.text_by === 'agent' || r.by === 'agent' ? 'The agent' : r.by === 'pm' ? 'You' : r.by === 'baseline' || r.via === 'first' ? 'Before the sheet' : r.via === 'outside' ? 'Outside PMOS' : String(r.by || ''));
29
- /** Who last changed each section, read once the Read view has its text: the text at each revision (the newest 12), compared section by section. */
30
- async function loadAttr() {
31
- const s = sheet; if (!s || s.attr || s.text == null || !s.log || !s.log.ok) return;
32
- const revs = (s.log.revisions || []).slice(-12); if (revs.length < 1) return;
33
- const p = encodeURIComponent(s.d.path), ws = ctx.ws() ? '&ws=' + encodeURIComponent(ctx.ws()) : '';
34
- const texts = await Promise.all(revs.map((r) => getJson('/api/doc-sheet/at?path=' + p + '&rev=' + r.rev + ws).then((a) => (a && a.ok ? a.text : null))));
35
- if (sheet !== s) return;
36
- const hit = sectionAttribution(revs, texts), attr = {};
37
- Object.keys(hit).forEach((n) => { const r = revs[hit[n]], w = whoOf(r); attr[n] = { who: w, initial: (w[0] || '?').toUpperCase(), rev: 'rev ' + r.rev, date: when(r.at) }; });
38
- s.attr = attr; s.md = null; if (s.tab === 'read') drawSheet();
39
- }
40
- /** The outline's rows: each heading at its own depth, filtered by the Find a heading box, with a dot on a heading an open proposal touches. */
41
- function olItems(s, m) {
42
- const q = String(s.olq || '').trim().toLowerCase(), lo = Math.min(...m.levels), mk = s.props ? propsM(s).marked : new Set();
43
- const rows = m.outline.map((t, n) => ({ t, n, l: Math.min(3, m.levels[n] - lo + 1) })).filter((x) => !q || x.t.toLowerCase().includes(q));
44
- return rows.length ? rows.map((x) => `<button type="button" data-go="${x.n}" class="l${x.l}${s.cur === x.n ? ' on' : ''}">${esc(x.t)}${mk.has(x.t) ? '<i></i>' : ''}</button>`).join('') : '<p class="note">No heading matches.</p>';
45
- }
46
- function sheetPane() {
47
- const s = sheet, d = s.d;
48
- const rels = s.lib && !s.lib.err ? relationsOf(s.lib, s.d.path, s.d.iniName) : null;
49
- const cnt = (k) => (k === 'props' && s.props && propsM(s).count ? ` <em>${propsM(s).count}</em>` : k === 'rel' && rels && rels.count ? ` <em>${rels.count}</em>` : '');
50
- const EYE = '<svg class="i" viewBox="0 0 24 24"><path d="M2 12s4-7 10-7 10 7 10 7-4 7-10 7S2 12 2 12z"/><circle cx="12" cy="12" r="3"/></svg>';
51
- const revs = (s.log && s.log.revisions) || [], last = revs[revs.length - 1], m0 = s.md || (s.text != null ? (s.md = mdHtml(s.text, { attr: s.attr })) : null);
52
- const menu = `<div class="dsvr" id="shT"><span class="dsvw"><button type="button" class="dsvb" id="shV" aria-haspopup="menu" aria-expanded="${!!s.vm}">${EYE}${esc(TABS.find((t) => t[0] === s.tab)[1])}${cnt(s.tab)}${CHEV}</button>${s.vm ? `<div class="dsmn" role="menu" aria-label="Document views">${TABS.map(([k, n]) => `<button type="button" role="menuitem" data-sh="${k}" aria-current="${s.tab === k}">${n}${cnt(k)}${s.tab === k ? CHECK : ''}</button>`).join('')}</div>` : ''}</span>${s.tab === 'read' && m0 && m0.outline.length > 2 ? `<button type="button" class="dsvb ol" data-ds="olt" aria-pressed="${!s.olHide}">${s.olHide ? 'Show the outline' : 'Hide the outline'}</button>` : ''}</div>`;
53
- const chk = s.health && s.health.total ? `<button type="button" class="chp lk ${s.health.passed === s.health.total ? 'ok' : 'warn'}" data-sh="health"><i></i>${s.health.passed} of ${s.health.total} checks</button>` : '';
54
- const cps = (s.copies || []).map(copyView);
55
- const cpc = s.copies == null ? '' : cps.length ? cps.map((c) => `<button type="button" class="chp lk ${c.tone}" data-ds="cp" aria-expanded="${!!s.cp}" title="${esc(c.words)}"><i></i>${esc(c.tool)}: ${esc(c.state.toLowerCase())}</button>`).join('') : `<button type="button" class="chp lk" data-ds="cp" aria-expanded="${!!s.cp}"><i></i>Link a copy</button>`;
56
- const file = String(d.path).split('/').pop();
57
- const head = `<div class="dsm2"><span class="chp ${d.st === 'ok' ? 'ok' : d.st === 'draft' ? 'warn' : ''}"><i></i>${esc(d.state)}</span>${revs.length ? `<span class="chp mono">v${revs.length}</span>` : ''}${chk}${cpc}<button type="button" class="chp lk" data-ds="meta" aria-expanded="${!!s.meta}" title="${esc(d.path)}">${esc(file)}</button><button type="button" class="chp lk" data-ds="page" title="Read and edit it as a page in the viewer">Open as a page</button>${last ? `<span class="chp"><span>Last change: <b>${esc(whoOf(last))}</b>${last.at ? ', ' + esc(when(last.at)) : ''}</span></span>` : ''}${d.when && !last ? `<span class="chp">updated ${esc(d.when)}</span>` : ''}</div>${s.cp ? copiesHtml(s, cps) : ''}${s.meta ? `<div class="dsmeta"><p class="dpath">${esc(d.path)}</p>${m0 && m0.fm.length ? kv(m0.fm) : '<p class="note">The file has no front matter.</p>'}</div>` : ''}`;
58
- let body = '';
59
- if (s.err) body = `<p class="empty3 plain">${esc(s.err)}</p>`;
60
- else if (s.tab === 'read') {
61
- if (s.text == null) body = '<p class="empty3 plain">Reading the file.</p>';
62
- else {
63
- const m = s.md || (s.md = mdHtml(s.text, { attr: s.attr })), has = m.outline.length > 2 && !s.olHide;
64
- const nav = `<nav class="dso" aria-label="Outline"><p class="label">Outline <em>${m.outline.length} headings</em></p>${m.outline.length > 12 ? `<input id="dsOlq" class="dsfind" type="search" placeholder="Find a heading" aria-label="Find a heading" autocomplete="off" value="${esc(s.olq || '')}">` : ''}<div id="dsOlItems">${olItems(s, m)}</div></nav>`;
65
- body = issueBar(s) + `<div class="dsrd${has ? '' : ' no'}">${has ? nav : ''}<div class="dsbody">${m.html}</div></div>`;
66
- }
67
- } else if (s.tab === 'edit') {
68
- if (s.text == null) body = '<p class="empty3 plain">Reading the file.</p>';
69
- else {
70
- const cur = s.draft == null ? s.text : s.draft, nv = ((s.log && s.log.revisions) || []).length + 1;
71
- body = `<textarea id="dsEd" class="dsed" spellcheck="true" aria-label="Edit the document">${esc(cur)}</textarea>`
72
- + `<p class="note" id="dsNote" style="margin:8px 0">${cur === s.text ? 'No changes yet.' : 'Changed. Health checks the document again after you save.'}</p>`
73
- + `<input id="dsWhy" class="dsy" placeholder="Why are you changing it? Kept in the edit log." aria-label="Why are you changing it" value="${esc(s.why || '')}">`
74
- + `<p class="note" id="dsErr" role="alert" style="margin:6px 0 0;color:var(--ember-ink)">${esc(s.msg || '')}</p>`
75
- + `<div class="dsfoot"><span class="note">Saved by you as v${nv}</span><span><button class="dmcta alt" data-ds="discard">Cancel</button><button class="dmcta dark" id="dsSave" data-ds="save"${s.busy || cur === s.text ? ' disabled' : ''}>Save as v${nv}</button></span></div>`;
76
- }
77
- } else if (s.tab === 'props') {
78
- if (!s.props) body = '<p class="empty3 plain">Reading the proposals.</p>';
79
- else {
80
- const m = propsM(s), line = askLine(s.ask);
81
- body = `<div class="dsask2"><p class="label">${AI}Ask the agent</p><textarea id="dsAsk" rows="3" placeholder="Tell the agent what to change, for example: add a one-paragraph summary at the top" aria-label="Tell the agent what to change">${esc(s.askText || '')}</textarea><div class="dsrow"><button class="dmcta alt" data-ds="ask"${s.busy || (s.ask && s.ask.state === 'working') ? ' disabled' : ''}>${AI}Ask the agent</button></div><p class="note" style="margin:8px 0 0">The agent drafts a proposal and can only read. Nothing in the document changes until you accept it, and your request is kept in the edit log.</p>${line ? `<p class="note" role="status" style="margin:6px 0 0">${esc(line)}</p>` : ''}</div>`
82
- + `<p class="label" style="margin:18px 0 8px">Open proposals · ${m.count}</p>`
83
- + (m.count ? m.open.map((p) => propHtml(s, p)).join('') : `<div class="dsnone">${CHECK}No open proposals.</div>`)
84
- + (m.closed.length ? `<p class="label" style="margin:18px 0 8px">Closed · ${m.closed.length}</p>${m.closed.map((p) => `<div class="dsp ${esc(p.state)}"><div><b>${esc(p.who)}</b><span>${esc(p.request)}</span>${p.why ? `<q>${esc(p.why)}</q>` : ''}</div><span class="dst2">${esc(p.label)}</span></div>`).join('')}` : '')
85
- + `<p class="note" id="dsErr" role="alert" style="margin:10px 0 0;color:var(--ember-ink)">${esc(s.msg || '')}</p>`;
86
- }
87
- } else if (s.tab === 'log') {
88
- if (!s.log) body = '<p class="empty3 plain">Reading the log.</p>';
89
- else {
90
- const R = (s.log.revisions || []).slice().reverse(), E = (s.log.events || []).slice().reverse();
91
- body = (R.length ? `<div class="evl">${R.map((r) => `<div class="hsr"><time>${esc(when(r.at))}</time><span><b>v${esc(r.rev)}</b> ${esc(r.why || (r.by === 'baseline' ? 'The file as the sheet first saw it' : 'No reason recorded'))}${r.by ? ' · ' + esc(r.by) : ''}</span>${prevRev(R, r) == null ? '' : `<button type="button" class="lk" data-lgd="${esc(r.rev)}" aria-expanded="${s.cmp && s.cmp[r.rev] ? 'true' : 'false'}">${s.cmp && s.cmp[r.rev] ? 'Hide change' : 'Show change'}</button>`}${s.cmp && s.cmp[r.rev] ? `<div class="dsdf lgdf">${cmpHtml(s.cmp[r.rev])}</div>` : ''}</div>`).join('')}</div>` : '<p class="mut">No revision is recorded.</p>')
92
- + (E.length ? `<p class="label" style="margin:18px 0 8px">Other entries</p><div class="evl">${E.map((e) => `<div class="hsr"><time>${esc(when(e.at))}</time><span><b>${esc(e.kind)}</b> ${esc(e.prompt || e.why || '')}</span></div>`).join('')}</div>` : '');
93
- }
94
- } else if (s.tab === 'health') {
95
- if (!s.health) body = '<p class="empty3 plain">Checking the document.</p>';
96
- else body = `<p class="note" style="margin:0 0 10px">${s.health.passed} of ${s.health.total} checks that had the input they need passed. A check with no input is not counted.</p><div class="ckl">${s.health.checks.map((c) => `<div class="ckr ${c.pass === true ? 'done' : c.pass === false ? 'blocked' : 'skipped'}"><i></i><b>${esc(c.id)}</b><span>${c.pass === true ? 'Passed' : c.pass === false ? 'Not passed' : 'No input'}</span><small>${esc(c.reason || '')}</small></div>`).join('')}</div>`;
97
- } else if (s.tab === 'rel') {
98
- body = relHtml(s, rels);
99
- }
100
- return `<article class="paper doc">${head}${menu}<div id="shBody">${body}</div><p class="xn">Every change is kept in the Edit log with its reason. The file changes only when you press Save or Accept.</p></article>`;
101
- }
102
- /** Copies in other tools: each linked copy with its state, a link to open it, Check now, and a box to link another. The sheet never writes to the copy; updating one stays in the console. */
103
- function copiesHtml(s, cps) {
104
- const rows = cps.map((c, i) => `<div class="dscr"><div><b>${esc(c.title)}</b><span class="chp ${c.tone}">${esc(c.state)}</span></div><small>${esc([c.tool, c.target].filter(Boolean).join(' · '))}</small><p class="note" style="margin:4px 0 0">${esc(c.words)}${c.checked ? ' Last checked ' + esc(when(c.checked)) + '.' : ' Not checked yet.'}</p><button type="button" class="lk" data-ds="cpview:${i}">Preview</button> ${c.url ? `<a class="lk" href="${esc(c.url)}" target="_blank" rel="noopener">Open in ${esc(c.tool)}</a>` : ''}</div>`).join('');
105
- return `<div class="dscp" data-copies><p class="label">Copies in other tools</p>${rows || '<p class="note">This document has no copy in Confluence or Google Docs yet. Link one to see whether it is in step.</p>'}`
106
- + `<div class="dsrow"><input id="dsCpUrl" class="dsy" type="text" placeholder="Paste a Confluence page or Google Doc link" aria-label="Address of the copy" value="${esc(s.cpUrl || '')}"><button class="dmcta dark" data-ds="cplink">Link</button>${cps.length ? `<button class="dmcta alt" data-ds="cpcheck"${s.checkRun ? ' disabled' : ''}>${s.checkRun ? 'Checking' : 'Check now'}</button>` : ''}</div>`
107
- + `${s.cpMsg ? `<p class="note" role="alert" style="margin:6px 0 0;color:var(--ember-ink)">${esc(s.cpMsg)}</p>` : ''}<p class="note" style="margin:8px 0 0">PMOS never writes to a copy from this sheet. Check now starts one agent session that reads the copies with your connectors. Updating a copy is in the console.</p></div>`;
108
- }
109
- /** Relations: three plain lists from the document library. A related file opens in this same sheet. */
110
- function relHtml(s, R) {
111
- if (s.lib === undefined || (s.lib === null && !s.err)) return '<p class="empty3 plain">Reading the document graph.</p>';
112
- if (s.lib && s.lib.err) return `<p class="empty3 plain">${esc(s.lib.err)}</p>`;
113
- const ST = { drift: 'Out of step', conflict: 'Conflict', missing: 'Missing', ahead: 'PMOS ahead' };
114
- const grp = (h, list) => (list.length ? `<p class="label" style="margin:14px 0 8px">${h} · ${list.length}</p><div class="dsrel">${list.map((n) => `<div class="dsrr">${n.open ? `<button type="button" data-rel="${esc(n.path)}" data-rt="${esc(n.name)}" title="Open ${esc(n.name)}"><b>${esc(n.name)}</b><small>${esc(n.sub)}</small></button>` : `<span><b>${esc(n.name)}</b><small>${esc(n.sub)}</small></span>`}${n.st && n.st !== 'ok' ? `<span class="chp ${n.st === 'drift' ? 'warn' : ''}">${esc(ST[n.st] || n.st)}</span>` : ''}</div>`).join('')}</div>` : '');
115
- return R && (R.sources.length || R.goals.length || R.used.length) ? grp('Sources', R.sources) + grp('Goals and initiative', R.goals) + grp('Used by', R.used) : '<p class="mut">No relation is recorded for this document.</p>';
116
- }
117
- function propHtml(s, p) {
118
- const picked = s.picked && s.picked[p.id], on = (n) => (picked ? picked.includes(n) : true);
119
- const secs = p.sections.map((x) => `<div class="dsdf">${p.sections.length > 1 && !x.stale ? `<label><input type="checkbox" data-pk="${esc(p.id)}" value="${esc(x.name)}"${on(x.name) ? ' checked' : ''}> ` : ''}<b>${esc(x.name)}</b>${p.sections.length > 1 && !x.stale ? '</label>' : ''} ${x.stale ? '<span class="dst2">Changed since this was proposed</span>' : `<ins>+ ${esc(x.add)}</ins>`}</div>`).join('');
120
- return `<div class="dsp"><div><b>${esc(p.who)}</b><span>${esc(p.request)}</span>${secs}${p.staleAll ? '<q>The document changed since this was proposed, so it cannot be accepted. Ask again.</q>' : ''}</div><div class="dsa">${p.canAccept ? `<button class="dmcta dark" data-ds="acc:${esc(p.id)}"${s.busy ? ' disabled' : ''}>Accept</button>` : ''}<button class="dmcta alt" data-ds="rej:${esc(p.id)}"${s.busy ? ' disabled' : ''}>Reject</button></div>${s.rejecting === p.id ? `<div class="dsrow" style="grid-column:1/-1"><input id="dsRj" class="dsy" placeholder="Why are you rejecting it? Kept in the edit log." aria-label="Why are you rejecting it" value="${esc(s.rejWhy || '')}"><button class="dmcta dark" data-ds="rejgo:${esc(p.id)}"${s.busy ? ' disabled' : ''}>Reject it</button><button class="dmcta alt" data-ds="rejno">Cancel</button></div>` : ''}</div>`;
121
- }
122
- function drawSheet() { $('#oMain').innerHTML = sheetPane(); }
123
- async function getJson(url, init) { try { const r = await fetch(url, Object.assign({ credentials: 'same-origin' }, init || {})); return await r.json(); } catch { return null; } }
124
- async function toggleCmp(rev) {
125
- const s = sheet; s.cmp = s.cmp || {};
126
- if (s.cmp[rev]) { delete s.cmp[rev]; drawSheet(); return; }
127
- const R = ((s.log && s.log.revisions) || []).slice().reverse(), r = R.find((x) => String(x.rev) === String(rev)), pv = r && prevRev(R, r);
128
- if (pv == null) return;
129
- s.cmp[rev] = 'busy'; drawSheet();
130
- const p = encodeURIComponent(s.d.path), ws = ctx.ws() ? '&ws=' + encodeURIComponent(ctx.ws()) : '';
131
- const [a, b] = await Promise.all([getJson('/api/doc-sheet/at?path=' + p + '&rev=' + pv + ws), getJson('/api/doc-sheet/at?path=' + p + '&rev=' + rev + ws)]);
132
- if (sheet !== s || !s.cmp || !s.cmp[rev]) return;
133
- s.cmp[rev] = a && a.ok && b && b.ok ? revDiffHtml(a.text, b.text) : { err: (b && b.error) || (a && a.error) || 'The change could not be read.' };
134
- drawSheet();
135
- }
136
- async function loadTab(tab) {
137
- const s = sheet, p = encodeURIComponent(s.d.path), ws = ctx.ws() ? '&ws=' + encodeURIComponent(ctx.ws()) : '';
138
- if (tab !== 'props' && tab !== 'log' && tab !== 'health' && !s.props) {
139
- const pr = await getJson('/api/doc-sheet/proposals?path=' + p + ws);
140
- if (sheet !== s) return;
141
- if (pr && pr.ok) s.props = pr.proposals || [];
142
- }
143
- if ((tab === 'read' || tab === 'edit') && s.text == null) {
144
- const lg = s.log || (s.log = await getJson('/api/doc-sheet/log?path=' + p + ws));
145
- if (sheet !== s) return;
146
- const revs = lg && lg.ok ? lg.revisions || [] : [];
147
- const at = revs.length ? await getJson('/api/doc-sheet/at?path=' + p + '&rev=' + revs[revs.length - 1].rev + ws) : null;
148
- if (sheet !== s) return;
149
- if (at && at.ok) s.text = at.text; else s.err = (at && at.error) || (lg && lg.error) || 'The file could not be read.';
150
- } else if (tab === 'props' && !s.props) {
151
- const pr = await getJson('/api/doc-sheet/proposals?path=' + p + ws);
152
- if (sheet !== s) return;
153
- if (!pr || pr.ok === false) s.err = (pr && pr.error) || 'The proposals could not be read.'; else s.props = pr.proposals || [];
154
- } else if (tab === 'log' && !s.log) {
155
- s.log = await getJson('/api/doc-sheet/log?path=' + p + ws);
156
- if (sheet !== s) return;
157
- if (!s.log || s.log.ok === false) { s.err = (s.log && s.log.error) || 'The edit log could not be read.'; s.log = null; }
158
- } else if (tab === 'health' && !s.health) {
159
- const h = await getJson('/api/doc-health/check', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ path: s.d.path, ws: ctx.ws() }) });
160
- if (sheet !== s) return;
161
- if (!h || h.ok === false) s.err = (h && h.error) || 'The health check could not run.'; else s.health = h.health;
162
- }
163
- if (tab === 'rel' && s.lib === undefined) {
164
- s.lib = null; const j = await getJson('/api/docs/library?' + wsq().slice(1));
165
- if (sheet !== s) return;
166
- s.lib = j && j.ok ? j : { err: (j && j.error) || 'The document graph could not be read.' };
167
- }
168
- if (sheet === s && s.tab === tab) drawSheet();
169
- if (tab === 'read' && s.text != null) loadAttr();
170
- }
171
- /** The checks chip of the status line: the same health check the Health view runs, read once when the sheet opens. */
172
- async function loadChip() {
173
- const s = sheet, h = await getJson('/api/doc-health/check', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ path: s.d.path, ws: ctx.ws() }) });
174
- if (sheet !== s || !h || h.ok === false || !h.health) return;
175
- s.health = h.health; if (s.tab === 'read') drawSheet();
176
- }
177
- /** The copies of this document in other tools (GET /api/docs: the links and their signals), read when the sheet opens and after a link or a check. */
178
- async function loadCopies() {
179
- const s = sheet; if (!s) return;
180
- const j = await getJson('/api/docs?' + wsq().slice(1)); if (sheet !== s) return;
181
- if (!j || j.ok === false) { s.copies = s.copies || []; s.cpMsg = (j && j.error) || 'The copies could not be read.'; }
182
- else { const d = (j.docs || []).find((x) => x.path === s.d.path); s.copies = d ? d.links || [] : []; s.checkRun = j.session || j.open || null; }
183
- if (s.tab === 'read' || s.cp) drawSheet();
184
- }
185
- function openSheet(d) {
186
- if (!d || !d.path) return;
187
- sheet = { d, tab: 'read', text: null, log: null, health: null, props: null, draft: null, why: '', ask: null, askText: '', picked: {}, busy: false, msg: '', err: null };
188
- const key = ctx.noteKey(d), say = d.title + ' is ' + d.state.toLowerCase() + (d.by ? '. ' + d.by + '.' : '.') + ' I can read the file with you and answer questions. I change nothing; only you change the file, with Save or Accept.';
189
- openDlg({ eye: 'Document · real data', title: d.title, sub: ctx.sub(), say, stream: turnA(logHtml({ logTitle: 'Read from the repository', log: ['Found the file ' + d.path, 'Read its revisions from the document sheet', 'Left the file as it is'] })) + turnA(ptx(say)), noteKey: key, pane: '', label: 'Document' });
190
- drawSheet(); loadThread(key); loadTab('read'); loadChip(); loadCopies();
191
- }
192
- $('#oMain').addEventListener('click', (e) => {
193
- if (sheet && sheet.vm && !e.target.closest('.dsvw')) { sheet.vm = false; drawSheet(); }
194
- if (sheet && e.target.closest('#shV')) { keepDraft(); sheet.vm = !sheet.vm; drawSheet(); return; }
195
- const lg = e.target.closest('[data-lgd]');
196
- if (lg && sheet) { toggleCmp(lg.dataset.lgd); return; }
197
- const rl = e.target.closest('[data-rel]');
198
- if (rl && sheet) { openPage({ path: rl.dataset.rel, title: rl.dataset.rt }); return; } // a related file opens as a page beside this one (premium-viewer R1, R2)
199
- const t = e.target.closest('[data-sh]');
200
- if (t && sheet) { keepDraft(); sheet.vm = false; sheet.tab = t.dataset.sh; sheet.err = null; sheet.msg = ''; drawSheet(); loadTab(sheet.tab); return; }
201
- const b = e.target.closest('[data-ds]'); if (b && sheet) { sheetPress(b.dataset.ds); return; }
202
- const g = e.target.closest('[data-go]'); if (g) { if (sheet) sheet.cur = +g.dataset.go; $$('#dsOlItems [data-go]').forEach((x) => x.classList.toggle('on', x === g)); const h = $('#ds-h' + g.dataset.go); if (h) h.scrollIntoView({ block: 'start', behavior: 'smooth' }); }
203
- });
204
- $('#oMain').addEventListener('change', (e) => { const c = e.target.closest('[data-pk]'); if (c && sheet) sheet.picked[c.dataset.pk] = $$('[data-pk]', $('#oMain')).filter((x) => x.dataset.pk === c.dataset.pk && x.checked).map((x) => x.value); });
205
- $('#oMain').addEventListener('input', (e) => {
206
- if (!sheet) return;
207
- if (e.target.id === 'dsEd') { sheet.draft = e.target.value; const ch = sheet.draft !== sheet.text; $('#dsSave').disabled = !ch || sheet.busy; $('#dsNote').textContent = ch ? 'Changed. Health checks the document again after you save.' : 'No changes yet.'; }
208
- else if (e.target.id === 'dsWhy') sheet.why = e.target.value;
209
- else if (e.target.id === 'dsAsk') sheet.askText = e.target.value;
210
- else if (e.target.id === 'dsOlq') { sheet.olq = e.target.value; const it = $('#dsOlItems'); if (it && sheet.md) it.innerHTML = olItems(sheet, sheet.md); }
211
- else if (e.target.id === 'dsRj') sheet.rejWhy = e.target.value;
212
- else if (e.target.id === 'dsCpUrl') sheet.cpUrl = e.target.value;
213
- });
214
- function keepDraft() { if (!sheet) return; const ed = $('#dsEd'), w = $('#dsWhy'), a = $('#dsAsk'), rj = $('#dsRj'); if (rj) sheet.rejWhy = rj.value; if (ed) sheet.draft = ed.value; if (w) sheet.why = w.value; if (a) sheet.askText = a.value; }
215
- /* the sheet's presses: each posts to one existing /api/doc-sheet route (ws in the query, as the routes read it) and then reads the routes again */
216
- const dsPost = (route, body) => pmPost('/api/doc-sheet/' + route + (ctx.ws() ? '?ws=' + encodeURIComponent(ctx.ws()) : ''), body);
217
- async function reloadSheet(s) {
218
- s.text = null; s.md = null; s.attr = null; s.cmp = null; s.log = null; s.health = null; s.props = null; s.draft = null; s.why = ''; s.rejecting = null;
219
- await loadTab(s.tab);
220
- if (sheet === s) { s.busy = false; drawSheet(); }
221
- }
222
- async function sheetPress(act) {
223
- const s = sheet; keepDraft();
224
- const fail = (m) => { s.busy = false; s.msg = m; drawSheet(); };
225
- if (act === 'meta') { s.meta = !s.meta; drawSheet(); return; }
226
- if (act === 'page') { openPage({ path: s.d.path, title: s.d.title, iniName: s.d.iniName }); return; }
227
- if (act === 'cp') { s.cp = !s.cp; s.cpMsg = ''; drawSheet(); return; }
228
- if (act.startsWith('cpview:')) { const l = (s.copies || [])[+act.slice(7)]; if (l) openCopy({ ws: ctx.ws(), path: s.d.path, kind: l.kind, url: l.url || l.target, title: l.title || s.d.title }); return; }
229
- if (act === 'cplink') {
230
- const t = String(s.cpUrl || '').trim(), kind = copyKindOf(t);
231
- if (!kind) { s.cpMsg = 'Paste a Confluence page or Google Doc link.'; drawSheet(); const f = $('#dsCpUrl'); if (f) f.focus(); return; }
232
- const r = await pmPost('/api/docs/link', { ws: ctx.ws(), path: s.d.path, kind, target: t }).catch(() => null); if (sheet !== s) return;
233
- if (!r || r.ok !== true) { s.cpMsg = (r && r.error) || 'The copy was not linked.'; drawSheet(); return; }
234
- s.cpUrl = ''; s.cpMsg = ''; toast('Linked the copy. Check now reads it.'); await loadCopies(); return;
235
- }
236
- if (act === 'cpcheck') {
237
- const r = await pmPost('/api/docs/check', { ws: ctx.ws() }).catch(() => null); if (sheet !== s) return;
238
- if (!r || r.ok !== true) { s.cpMsg = (r && r.error) || 'The check did not start.'; drawSheet(); return; }
239
- s.checkRun = { id: r.session }; s.cpMsg = ''; drawSheet();
240
- for (let i = 0; i < 120 && sheet === s && s.checkRun; i++) { await new Promise((ok) => setTimeout(ok, 5000)); await loadCopies(); }
241
- return;
242
- }
243
- if (act === 'olt') { s.olHide = !s.olHide; drawSheet(); return; }
244
- if (act === 'rejno') { s.rejecting = null; s.msg = ''; drawSheet(); return; }
245
- if (act === 'discard') { s.draft = null; s.why = ''; s.msg = ''; drawSheet(); return; }
246
- if (act === 'again') {
247
- s.busy = true; s.msg = ''; drawSheet();
248
- const res = await pmPost('/api/core-docs/draft', { ws: ctx.ws(), scope: ctx.scope(), key: s.d.key }); if (sheet !== s) return;
249
- if (!res || res.ok !== true) return fail((res && res.error) || 'The draft could not be started.');
250
- toast('The agent is drafting “' + s.d.title + '” again. The new draft replaces this one when it is ready, and it sends nothing.');
251
- s.busy = false; closeDlg(); await ctx.reload(); return;
252
- }
253
- if (act === 'issue') {
254
- const r = issueBody(ctx.ws(), ctx.scope(), s.d.key, s.d.slot, s.draft != null && s.draft !== s.text); if (r.error) return fail(r.error);
255
- s.busy = true; s.msg = ''; drawSheet();
256
- const res = await pmPost('/api/core-docs/issue', r.body); if (sheet !== s) return;
257
- if (!res || res.ok !== true) return fail((res && res.error) || 'The document could not be issued.');
258
- toast('Issued. Nothing was sent to anyone.');
259
- s.issued = true; await ctx.reload(); if (sheet !== s) return;
260
- s.d = ctx.rows().find((x) => x.key === s.d.key) || s.d;
261
- return reloadSheet(s);
262
- }
263
- if (act === 'save') {
264
- const r = editBody(s.d.path, s.text, s.draft == null ? s.text : s.draft, s.why); if (r.error) return fail(r.error);
265
- s.busy = true; s.msg = ''; drawSheet();
266
- const res = await dsPost('edit', r.body); if (sheet !== s) return;
267
- if (!res || res.ok !== true) return fail((res && res.error) || 'The document could not be saved.');
268
- toast('Saved. The reason is in the Edit log.'); return reloadSheet(s);
269
- }
270
- if (act === 'ask') {
271
- const r = askBody(s.d.path, s.askText); if (r.error) return fail(r.error);
272
- s.busy = true; s.msg = ''; drawSheet();
273
- const res = await dsPost('ask', r.body); if (sheet !== s) return;
274
- s.busy = false;
275
- if (!res || res.ok !== true || !res.id) return fail((res && res.error) || 'The agent could not be asked.');
276
- s.askText = ''; s.ask = { state: 'working', id: res.id }; drawSheet(); return pollAsk(s, res.id);
277
- }
278
- const [kind, id] = [act.split(':')[0], act.slice(act.indexOf(':') + 1)];
279
- const p = propsM(s).open.find((x) => x.id === id); if (!p) return;
280
- if (kind === 'acc') {
281
- const r = acceptBody(s.d.path, p, s.picked[id] || p.sections.filter((x) => !x.stale).map((x) => x.name)); if (r.error) return fail(r.error);
282
- s.busy = true; s.msg = ''; drawSheet();
283
- const res = await dsPost('accept', r.body); if (sheet !== s) return;
284
- if (!res || res.ok !== true) { await reloadSheet(s); return fail((res && res.error) || 'The proposal could not be accepted.'); }
285
- toast('Accepted. The file changed and the request is in the Edit log.'); return reloadSheet(s);
286
- }
287
- if (kind === 'rej') { s.rejecting = id; s.rejWhy = ''; s.msg = ''; drawSheet(); const f = $('#dsRj'); if (f) f.focus(); return; }
288
- if (kind === 'rejgo') {
289
- const r = rejectBody(s.d.path, p, s.rejWhy); if (r.error) return fail(r.error);
290
- s.busy = true; s.msg = ''; drawSheet();
291
- const res = await dsPost('reject', r.body); if (sheet !== s) return;
292
- if (!res || res.ok !== true) return fail((res && res.error) || 'The proposal could not be rejected.');
293
- toast('Rejected. The file is as it was.'); return reloadSheet(s);
294
- }
295
- }
296
- /** The document as a page in the viewer (premium-vw-doc.js). A write there reads this sheet again, so its views stay in step. */
297
- function openPage(doc) {
298
- const s = sheet;
299
- openDocPage(doc, { ws: ctx.ws, onWrite: () => { if (sheet === s && s) reloadSheet(s); } });
300
- }
301
- async function pollAsk(s, id) {
302
- for (let i = 0; i < 400 && sheet === s; i++) {
303
- await new Promise((r) => setTimeout(r, 2000));
304
- const a = await getJson('/api/doc-sheet/ask?id=' + encodeURIComponent(id) + wsq()); if (sheet !== s) return;
305
- if (!a || a.ok === false) { s.ask = { state: 'failed', error: (a && a.error) || 'The answer could not be read.' }; drawSheet(); return; }
306
- s.ask = a;
307
- if (a.state !== 'working') { s.props = null; await loadTab('props'); if (sheet === s) drawSheet(); return; }
308
- if (s.tab === 'props') drawSheet();
309
- }
310
- }
311
- return { open: openSheet };
312
- }