@kabmo-labs/kabmo 0.43.1 → 0.44.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 (385) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +337 -337
  3. package/dist/client/static/js/{CsvGrid-g67pk2zy.js → CsvGrid-1t2q46rg.js} +2 -2
  4. package/dist/client/static/js/{DocxView-pyh6p2kb.js → DocxView-301hxnwk.js} +4 -4
  5. package/dist/client/static/js/{DrawioView-g48r6y2m.js → DrawioView-47bwea5t.js} +2 -2
  6. package/dist/client/static/js/ImageView-68zdx5ex.js +1 -0
  7. package/dist/client/static/js/LayoutWrapper-vw54s8ra.js +2 -0
  8. package/dist/client/static/js/{Modal-edw446r8.js → Modal-fb9b4gq6.js} +18 -18
  9. package/dist/client/static/js/{PdfView-6z3cgj37.js → PdfView-m64ksepp.js} +1 -1
  10. package/dist/client/static/js/SessionsView-zyjwhpzm.js +1 -0
  11. package/dist/client/static/js/{SheetView-64076z1j.js → SheetView-e88sqprx.js} +13 -13
  12. package/dist/client/static/js/{SvgPreview-dmpgavgd.js → SvgPreview-hs9a713t.js} +1 -1
  13. package/dist/client/static/js/{abnfDiagram-O67JEVCF-nfz5z1vw.js → abnfDiagram-O67JEVCF-fnr5kyqk.js} +1 -1
  14. package/dist/client/static/js/architecture-7GRP2DOG-mq93vqx9.js +1 -0
  15. package/dist/client/static/js/{architectureDiagram-NJMV4G6O-jra2jyzw.js → architectureDiagram-NJMV4G6O-7v003363.js} +11 -11
  16. package/dist/client/static/js/{astro-dpfdhc5e.js → astro-t9vjc0mc.js} +1 -1
  17. package/dist/client/static/js/bash-fjzhxy10.js +1 -0
  18. package/dist/client/static/js/{blockDiagram-BEXU5L5S-3szktxam.js → blockDiagram-BEXU5L5S-k4mwbw3d.js} +5 -5
  19. package/dist/client/static/js/c-y1y6v00q.js +1 -0
  20. package/dist/client/static/js/{c4Diagram-YGBWAQC7-xe9vbppt.js → c4Diagram-YGBWAQC7-688zq6f4.js} +6 -6
  21. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-egzhj1xn.js → classDiagram-v2-NBCMYWYE-h0s16pxr.js} +5 -5
  22. package/dist/client/static/js/{cose-bilkent-JH36ORCC-dfrk1wnr.js → cose-bilkent-JH36ORCC-qb2t8qq5.js} +1 -1
  23. package/dist/client/static/js/cpp-9f6zkdd4.js +1 -0
  24. package/dist/client/static/js/css-g85rwzty.js +1 -0
  25. package/dist/client/static/js/css-y4y3qtsb.js +1 -0
  26. package/dist/client/static/js/cynefin-OW5HDTMX-qyg5rjr5.js +1 -0
  27. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-xefpcmpg.js → cynefinDiagram-VND7K2PF-syhtcr7b.js} +1 -1
  28. package/dist/client/static/js/{dagre-6A5THRUB-vtzjnrt9.js → dagre-6A5THRUB-7wgbx6cm.js} +2 -2
  29. package/dist/client/static/js/{diagram-22UHCM2B-4vvn790v.js → diagram-22UHCM2B-951cmp5h.js} +21 -21
  30. package/dist/client/static/js/{diagram-3UASUU5V-tmht3bew.js → diagram-3UASUU5V-mvdbqt7b.js} +2 -2
  31. package/dist/client/static/js/{diagram-ATOU4E4O-p5wa5ztx.js → diagram-ATOU4E4O-hkvdtgdm.js} +3 -3
  32. package/dist/client/static/js/{diagram-CDSNMT55-8myesjfc.js → diagram-CDSNMT55-bkkz35ca.js} +4 -4
  33. package/dist/client/static/js/{diagram-MLGK6HIB-9t3x2d5f.js → diagram-MLGK6HIB-z6pcrkc3.js} +2 -2
  34. package/dist/client/static/js/{diagram-MPIPVDR6-8ahgnmhy.js → diagram-MPIPVDR6-mkwf8j4m.js} +1 -1
  35. package/dist/client/static/js/{dockerfile-x8aa0543.js → dockerfile-7gd570bm.js} +1 -1
  36. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-5semw111.js → ebnfDiagram-ZINNZB2B-trym26ts.js} +1 -1
  37. package/dist/client/static/js/{elixir-5ewfhvfh.js → elixir-z77c7tfn.js} +1 -1
  38. package/dist/client/static/js/{elk-276RUBZZ-jmhs58ww.js → elk-276RUBZZ-gkhz67v6.js} +1 -1
  39. package/dist/client/static/js/{erDiagram-OPXOYQCR-31wvbpdr.js → erDiagram-OPXOYQCR-gkyr5cqs.js} +7 -7
  40. package/dist/client/static/js/{erlang-jqqa3ehb.js → erlang-6vrvh2m6.js} +1 -1
  41. package/dist/client/static/js/eventmodeling-NTZA5JFV-15yz245z.js +1 -0
  42. package/dist/client/static/js/flowDiagram-KWPJA3E3-n1sapfye.js +1 -0
  43. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-c2dycjrf.js → ganttDiagram-FUAMR5RP-1qpme6ks.js} +4 -4
  44. package/dist/client/static/js/gitGraph-4MIJSDKK-xtjwv160.js +1 -0
  45. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-y4k4pdd8.js → gitGraphDiagram-X574FWY7-wbg3kqak.js} +10 -10
  46. package/dist/client/static/js/graphql-amk52c95.js +1 -0
  47. package/dist/client/static/js/html-2y935m7r.js +1 -0
  48. package/dist/client/static/js/index-07yh7qx0.js +1 -0
  49. package/dist/client/static/js/{index-6fpd55cq.js → index-1923aj4g.js} +2 -2
  50. package/dist/client/static/js/{index-s00j9042.js → index-19ffgf9a.js} +1 -1
  51. package/dist/client/static/js/index-204ae4vs.js +2 -0
  52. package/dist/client/static/js/{index-cqnpsw2m.js → index-22whvfdw.js} +2 -2
  53. package/dist/client/static/js/{index-2cbnjc32.js → index-232nsp2c.js} +2 -2
  54. package/dist/client/static/js/{index-aar68x31.js → index-31hntzse.js} +5 -5
  55. package/dist/client/static/js/{index-2b46dzw8.js → index-3w845q50.js} +4 -4
  56. package/dist/client/static/js/{index-gmnmnfm0.js → index-4y4hshcx.js} +2 -2
  57. package/dist/client/static/js/index-53ysgsd2.js +1 -0
  58. package/dist/client/static/js/{index-m94f4ngb.js → index-62ng8tkj.js} +3 -3
  59. package/dist/client/static/js/{index-nt7nhchn.js → index-6ah5sj5y.js} +1 -1
  60. package/dist/client/static/js/{index-kc5znr75.js → index-6gyk52ff.js} +2 -2
  61. package/dist/client/static/js/{index-m9s9rg5k.js → index-6s4mrdew.js} +2 -2
  62. package/dist/client/static/js/index-6t21c6jt.js +2 -0
  63. package/dist/client/static/js/{index-7dp90ad1.js → index-83pwa9c0.js} +2 -2
  64. package/dist/client/static/js/{index-pt8440xh.js → index-8trggh1z.js} +15 -15
  65. package/dist/client/static/js/{index-ys0xpw3q.js → index-92n96mgd.js} +2 -2
  66. package/dist/client/static/js/index-ad4x44d6.js +9 -0
  67. package/dist/client/static/js/{index-s78n0dtv.js → index-as1wptfa.js} +2 -2
  68. package/dist/client/static/js/{index-j17h4z6f.js → index-barbpakv.js} +2 -2
  69. package/dist/client/static/js/index-bjqz7swa.js +1 -0
  70. package/dist/client/static/js/{index-yvgbr7ek.js → index-c3v62nvt.js} +2 -2
  71. package/dist/client/static/js/{index-f77c3ag0.js → index-cq98p2rb.js} +200 -200
  72. package/dist/client/static/js/{index-3588r3wg.js → index-czedkbmb.js} +2 -2
  73. package/dist/client/static/js/{index-sesghshh.js → index-dmv2zasz.js} +2 -2
  74. package/dist/client/static/js/{index-ycks7gyg.js → index-e6rm5xzj.js} +2 -2
  75. package/dist/client/static/js/{index-48pb18zj.js → index-ehacfgwm.js} +2 -2
  76. package/dist/client/static/js/{index-q81rxwh7.js → index-fbpc1wx6.js} +41 -41
  77. package/dist/client/static/js/{index-qhytrsyb.js → index-fj4k07zt.js} +2 -2
  78. package/dist/client/static/js/{index-jz93j0at.js → index-gtkhz0hj.js} +2 -2
  79. package/dist/client/static/js/{index-181p91hf.js → index-hfsvwfgw.js} +2 -2
  80. package/dist/client/static/js/{index-sk9ej289.js → index-jaqjvk22.js} +2 -2
  81. package/dist/client/static/js/{index-e7yf273s.js → index-jbkkwa2q.js} +2 -2
  82. package/dist/client/static/js/{index-38v0781h.js → index-ks23y2cd.js} +2 -2
  83. package/dist/client/static/js/{index-f7djda1g.js → index-kwpaz891.js} +2 -2
  84. package/dist/client/static/js/{index-0c6vpk89.js → index-n0matkz9.js} +2 -2
  85. package/dist/client/static/js/index-n6fbd265.js +1 -0
  86. package/dist/client/static/js/{index-cjhvtzdd.js → index-nqjd3hh5.js} +2 -2
  87. package/dist/client/static/js/{index-ynaxep06.js → index-nr8s5xm9.js} +2 -2
  88. package/dist/client/static/js/index-nvevymac.js +2 -0
  89. package/dist/client/static/js/index-pxm44qfd.js +1 -0
  90. package/dist/client/static/js/{index-fg965t62.js → index-pysqpc5n.js} +2 -2
  91. package/dist/client/static/js/index-qf9x7yet.js +1 -0
  92. package/dist/client/static/js/{index-s7rfbydk.js → index-qkjx6521.js} +4 -4
  93. package/dist/client/static/js/index-qm92sf9w.js +12 -0
  94. package/dist/client/static/js/{index-fjnkzk12.js → index-qsw5edtk.js} +5 -5
  95. package/dist/client/static/js/index-rpzxrr2d.js +1 -0
  96. package/dist/client/static/js/index-s8bktzpg.js +1 -0
  97. package/dist/client/static/js/index-sc7r305t.css +1 -0
  98. package/dist/client/static/js/{index-efra065v.js → index-svmzgtcx.js} +2 -2
  99. package/dist/client/static/js/{index-vyw4tbn8.js → index-tr2pkfs6.js} +2 -2
  100. package/dist/client/static/js/{index-bvjct7sp.js → index-tzdm1y3z.js} +2 -2
  101. package/dist/client/static/js/{index-cgzw43bc.js → index-v5npdwy2.js} +65 -65
  102. package/dist/client/static/js/{index-dkwhs38j.js → index-v7bcgh77.js} +2 -2
  103. package/dist/client/static/js/index-wytdbvax.js +3 -0
  104. package/dist/client/static/js/{index-n9scbxy5.js → index-yfjvx4yf.js} +2 -2
  105. package/dist/client/static/js/info-A6RAGUB7-e31s2xvj.js +1 -0
  106. package/dist/client/static/js/{infoDiagram-VRGFBTTK-z3pqx7w8.js → infoDiagram-VRGFBTTK-yebngg8c.js} +1 -1
  107. package/dist/client/static/js/ini-kemnmt16.js +1 -0
  108. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-f5v6z8yr.js → ishikawaDiagram-OU5B5YK6-kh4nqj6q.js} +3 -3
  109. package/dist/client/static/js/java-caqpfm88.js +1 -0
  110. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-js1yxatk.js → journeyDiagram-ZHPQQLJL-4khnf8x1.js} +5 -5
  111. package/dist/client/static/js/json-qn73s8xb.js +1 -0
  112. package/dist/client/static/js/jsx-bvterpm5.js +1 -0
  113. package/dist/client/static/js/{julia-0h9krgsd.js → julia-svwxx41e.js} +1 -1
  114. package/dist/client/static/js/{kanban-definition-PNTS6WVX-m0a6069c.js → kanban-definition-PNTS6WVX-snmq3wq4.js} +4 -4
  115. package/dist/client/static/js/lua-1hcfm8ya.js +1 -0
  116. package/dist/client/static/js/markdown-n6na4ykv.js +1 -0
  117. package/dist/client/static/js/{mermaid.core-6xvbnm63.js → mermaid.core-yctw30sk.js} +7 -7
  118. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-a9f9yzc0.js → mindmap-definition-NLK3R4M7-atfv66wq.js} +3 -3
  119. package/dist/client/static/js/one-dark-pro-c1vnxka7.js +1 -0
  120. package/dist/client/static/js/one-light-mbxx52p5.js +1 -0
  121. package/dist/client/static/js/packet-AYTQ26CC-mtzmsrk4.js +1 -0
  122. package/dist/client/static/js/{pegDiagram-GJSIUBJH-4v4pf1h1.js → pegDiagram-GJSIUBJH-hpbtxjht.js} +1 -1
  123. package/dist/client/static/js/{perl-rptyx23q.js → perl-mr0ds2ex.js} +1 -1
  124. package/dist/client/static/js/{php-sagvq3wz.js → php-5h3wt6tv.js} +1 -1
  125. package/dist/client/static/js/pie-WAS4IAKB-85nwadmj.js +1 -0
  126. package/dist/client/static/js/{pieDiagram-5QR66LMP-a54yrmfm.js → pieDiagram-5QR66LMP-9zrtkdr2.js} +2 -2
  127. package/dist/client/static/js/properties-nxcks67c.js +1 -0
  128. package/dist/client/static/js/python-58p0gqn0.js +1 -0
  129. package/dist/client/static/js/{quadrantDiagram-O4NWA36T-1twhvnp2.js → quadrantDiagram-O4NWA36T-xq970vx1.js} +6 -6
  130. package/dist/client/static/js/r-eyn8en0g.js +1 -0
  131. package/dist/client/static/js/radar-RG4KPBEZ-ae3jdajx.js +1 -0
  132. package/dist/client/static/js/railroad-74A4TZTK-3m0s7cse.js +1 -0
  133. package/dist/client/static/js/railroad-abnf-HS5TGJTU-pz22c3eb.js +1 -0
  134. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-cgqgqq15.js +1 -0
  135. package/dist/client/static/js/railroad-peg-WCYAUIDC-ts0nmcxb.js +1 -0
  136. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-83tqfdcy.js → railroadDiagram-XR7U4H2S-1g9jchbk.js} +1 -1
  137. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-73e3pzw6.js → requirementDiagram-PLB6GJNP-ntt088y4.js} +4 -4
  138. package/dist/client/static/js/{ruby-9qyx7knh.js → ruby-nn836rtq.js} +1 -1
  139. package/dist/client/static/js/{rust-jds4e4r7.js → rust-eygk56y5.js} +1 -1
  140. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-1bzwj6sb.js → sankeyDiagram-IPEJSGJF-95k8c5v6.js} +5 -5
  141. package/dist/client/static/js/{sass-07rteya0.js → sass-c2bk03e4.js} +1 -1
  142. package/dist/client/static/js/{scss-e2dndbfa.js → scss-qycakpjn.js} +1 -1
  143. package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-yh3h988k.js → sequenceDiagram-PO4LG4MO-qfvxrwfa.js} +19 -19
  144. package/dist/client/static/js/{sizeCapture-INFHLROL-1n121yp6.js → sizeCapture-INFHLROL-0m7dc5nd.js} +1 -1
  145. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-0tdrzn06.js → stateDiagram-v2-GCMORJYK-femwcn7n.js} +5 -5
  146. package/dist/client/static/js/{svelte-w365cpwa.js → svelte-bfy1rq5g.js} +1 -1
  147. package/dist/client/static/js/{swimlanes-2SLR337P-77n1ttdw.js → swimlanes-2SLR337P-5n1qq48r.js} +1 -1
  148. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-n85hawg8.js +8 -0
  149. package/dist/client/static/js/{timeline-definition-EJHVYXUP-b6r0k3e8.js → timeline-definition-EJHVYXUP-vdsj18be.js} +7 -7
  150. package/dist/client/static/js/treeView-Q6P3EWNA-fvpt3hm8.js +1 -0
  151. package/dist/client/static/js/treemap-WGGIJYW6-4z9s24je.js +1 -0
  152. package/dist/client/static/js/tsx-fnzxsv25.js +1 -0
  153. package/dist/client/static/js/typescript-0ppbqrb6.js +1 -0
  154. package/dist/client/static/js/{usecaseDiagram-POWQR4AR-efq58m3m.js → usecaseDiagram-POWQR4AR-psjbrprk.js} +43 -43
  155. package/dist/client/static/js/{vennDiagram-UO4OBE2U-ad4gvd5r.js → vennDiagram-UO4OBE2U-4yn9kac9.js} +7 -7
  156. package/dist/client/static/js/{vue-d6cesny1.js → vue-0fwtgwj4.js} +1 -1
  157. package/dist/client/static/js/wardley-WFR3VGLG-73mrhkmy.js +1 -0
  158. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-v89tys2p.js → wardleyDiagram-VNRHLVJA-js0tbpca.js} +3 -3
  159. package/dist/client/static/js/xml-v1ytr8qz.js +1 -0
  160. package/dist/client/static/js/{xychartDiagram-PMCCYNJV-xtgzmknw.js → xychartDiagram-PMCCYNJV-svr38ygh.js} +5 -5
  161. package/dist/client/static/js/yaml-txrqz62t.js +1 -0
  162. package/marketplace/plugins/stats/package.json +2 -2
  163. package/marketplace/plugins/stats/src/proc/identity.ts +4 -3
  164. package/package.json +2 -2
  165. package/src/client/App.tsx +1 -1
  166. package/src/client/borders.css +143 -0
  167. package/src/client/components/common/context-usage-button/Ring.tsx +34 -9
  168. package/src/client/components/common/context-usage-button/index.test.tsx +19 -2
  169. package/src/client/components/common/context-usage-button/index.tsx +4 -4
  170. package/src/client/components/common/header-controls/index.test.tsx +26 -59
  171. package/src/client/components/common/header-controls/index.tsx +41 -52
  172. package/src/client/components/common/header-controls/phone-row.test.tsx +265 -0
  173. package/src/client/components/common/header-controls/plugin-entry.test.tsx +25 -3
  174. package/src/client/components/common/header-controls/shell-chrome.test.tsx +2 -2
  175. package/src/client/components/layout/LeftDock.tsx +7 -0
  176. package/src/client/components/layout/desktop-layout/DesktopOverlays.tsx +51 -0
  177. package/src/client/components/layout/desktop-layout/LeftColumn.tsx +117 -15
  178. package/src/client/components/layout/desktop-layout/RightColumn.tsx +257 -0
  179. package/src/client/components/layout/desktop-layout/TopNavbar.tsx +23 -24
  180. package/src/client/components/layout/desktop-layout/WorkspacePanels.tsx +50 -78
  181. package/src/client/components/layout/desktop-layout/index.tsx +73 -73
  182. package/src/client/components/layout/session-sidebar/Footer.test.tsx +20 -0
  183. package/src/client/components/layout/session-sidebar/Footer.tsx +24 -2
  184. package/src/client/components/layout/session-sidebar/Header.test.ts +10 -0
  185. package/src/client/components/layout/session-sidebar/Header.tsx +2 -2
  186. package/src/client/components/mobile/mobile-main-view/Header.test.tsx +2 -3
  187. package/src/client/components/mobile/mobile-main-view/Header.tsx +12 -10
  188. package/src/client/components/settings/Modal.tsx +14 -9
  189. package/src/client/components/settings/ProjectSelectorDropdown.tsx +18 -6
  190. package/src/client/components/settings/SettingsSidebarList.tsx +2 -1
  191. package/src/client/components/settings/Sidebar.tsx +6 -4
  192. package/src/client/components/settings/apply-side-effects.test.ts +17 -0
  193. package/src/client/components/settings/apply-side-effects.ts +26 -5
  194. package/src/client/components/settings/band-height.test.tsx +122 -0
  195. package/src/client/components/settings/categories/AppearanceSettings.test.tsx +144 -0
  196. package/src/client/components/settings/categories/AppearanceSettings.tsx +81 -39
  197. package/src/client/components/settings/categories/ChatSettings.tsx +9 -15
  198. package/src/client/components/settings/categories/UsageSettings.tsx +2 -1
  199. package/src/client/components/settings/categories/appearance-settings/BorderStyleSection.test.tsx +101 -0
  200. package/src/client/components/settings/categories/appearance-settings/BorderStyleSection.tsx +134 -0
  201. package/src/client/components/settings/categories/appearance-settings/EditorBlameSection.tsx +2 -2
  202. package/src/client/components/settings/categories/appearance-settings/EditorFontSection.tsx +5 -5
  203. package/src/client/components/settings/categories/appearance-settings/EditorIndentSection.tsx +2 -2
  204. package/src/client/components/settings/categories/appearance-settings/EditorThemeSection.tsx +6 -6
  205. package/src/client/components/settings/categories/appearance-settings/EditorTypingSection.tsx +2 -2
  206. package/src/client/components/settings/categories/appearance-settings/IconStyleSection.tsx +2 -2
  207. package/src/client/components/settings/categories/appearance-settings/PanelNavSection.tsx +167 -0
  208. package/src/client/components/settings/categories/appearance-settings/SidebarStyleSection.tsx +2 -2
  209. package/src/client/components/settings/categories/appearance-settings/SurfaceStyleSection.tsx +2 -2
  210. package/src/client/components/settings/categories/appearance-settings/ThemeSection.tsx +42 -0
  211. package/src/client/components/settings/categories/appearance-settings/TrayIconSection.tsx +2 -2
  212. package/src/client/components/settings/categories/appearance-settings/groups.test.ts +47 -0
  213. package/src/client/components/settings/categories/appearance-settings/groups.ts +95 -0
  214. package/src/client/components/settings/categories/chat-settings/LayoutSection.tsx +31 -14
  215. package/src/client/components/settings/categories/mcp-settings/SidebarList.tsx +2 -1
  216. package/src/client/components/settings/categories/project-settings/SidebarList.tsx +2 -1
  217. package/src/client/components/settings/categories/provider-settings/SidebarList.tsx +2 -1
  218. package/src/client/components/settings/categories/usage-settings/SidebarList.tsx +2 -1
  219. package/src/client/components/settings/master-detail/GroupDetail.tsx +38 -0
  220. package/src/client/components/settings/{categories/chat-settings/SidebarList.tsx → master-detail/GroupSidebar.tsx} +35 -12
  221. package/src/client/components/settings/master-detail/index.tsx +3 -1
  222. package/src/client/components/settings/pane-header.ts +25 -0
  223. package/src/client/components/workspace/browser-toolbar/index.test.tsx +39 -1
  224. package/src/client/components/workspace/browser-toolbar/index.tsx +53 -17
  225. package/src/client/components/workspace/chat-timeline/ColumnResizeHandle.tsx +107 -0
  226. package/src/client/components/workspace/chat-timeline/ComposerDockFrame.tsx +9 -3
  227. package/src/client/components/workspace/chat-timeline/EmptyWorkspacePrompt.tsx +35 -26
  228. package/src/client/components/workspace/chat-timeline/TimelineBody.tsx +6 -0
  229. package/src/client/components/workspace/chat-timeline/column-resize.test.tsx +292 -0
  230. package/src/client/components/workspace/chat-timeline/composer-dock-frame.test.tsx +5 -3
  231. package/src/client/components/workspace/context-panel/index.tsx +10 -4
  232. package/src/client/components/workspace/editor/EditorHideButton.tsx +41 -0
  233. package/src/client/components/workspace/editor/EmptyEditor.tsx +11 -2
  234. package/src/client/components/workspace/editor/PluginColumn.tsx +11 -1
  235. package/src/client/components/workspace/editor/Tabs.tsx +8 -0
  236. package/src/client/components/workspace/editor/editor-hide-button.test.ts +144 -0
  237. package/src/client/components/workspace/editor/index.tsx +8 -2
  238. package/src/client/components/workspace/editor/props.ts +9 -0
  239. package/src/client/components/workspace/file-explorer/RowLabel.test.tsx +90 -0
  240. package/src/client/components/workspace/file-explorer/RowLabel.tsx +1 -4
  241. package/src/client/components/workspace/git-panel/commit-modal/CommitRow.test.ts +52 -46
  242. package/src/client/components/workspace/git-panel/commit-modal/CommitRow.tsx +41 -21
  243. package/src/client/components/workspace/git-panel/commit-modal/GraphCanvas.tsx +6 -5
  244. package/src/client/components/workspace/git-panel/commit-modal/index.tsx +19 -22
  245. package/src/client/components/workspace/panel-header/title-policy.test.tsx +62 -0
  246. package/src/client/components/workspace/panel-header/title-policy.tsx +83 -0
  247. package/src/client/components/workspace/panel-tabs/Home.density.test.tsx +122 -0
  248. package/src/client/components/workspace/panel-tabs/Home.test.tsx +137 -0
  249. package/src/client/components/workspace/panel-tabs/Home.tsx +106 -0
  250. package/src/client/components/workspace/panel-tabs/TabStrip.test.tsx +221 -0
  251. package/src/client/components/workspace/panel-tabs/TabStrip.tsx +315 -0
  252. package/src/client/components/workspace/panel-tabs/index.tsx +97 -0
  253. package/src/client/components/workspace/panels/builtin.tsx +9 -0
  254. package/src/client/components/workspace/plan-panel/index.tsx +7 -2
  255. package/src/client/components/workspace/repo-picker/Modal.tsx +1 -1
  256. package/src/client/components/workspace/repo-picker/index.test.tsx +32 -8
  257. package/src/client/components/workspace/repo-picker/index.tsx +2 -2
  258. package/src/client/components/workspace/search-panel/Body.tsx +7 -1
  259. package/src/client/components/workspace/search-panel/index.tsx +2 -1
  260. package/src/client/components/workspace/terminal-panel/Header.tsx +10 -3
  261. package/src/client/components/workspace/terminal-panel/index.tsx +4 -1
  262. package/src/client/components/workspace/todo-panel/index.tsx +6 -1
  263. package/src/client/components/workspace/usage-panel/index.tsx +7 -2
  264. package/src/client/components/workspace/user-browser-panel/AddressBar.tsx +43 -4
  265. package/src/client/components/workspace/user-browser-panel/Frame.tsx +101 -45
  266. package/src/client/components/workspace/user-browser-panel/TabStrip.tsx +107 -0
  267. package/src/client/components/workspace/user-browser-panel/index.tsx +31 -6
  268. package/src/client/glass.test.ts +1 -1
  269. package/src/client/hooks/browser/use-annotate.ts +6 -5
  270. package/src/client/hooks/browser/use-user-browser.test.tsx +279 -0
  271. package/src/client/hooks/browser/use-user-browser.ts +190 -44
  272. package/src/client/hooks/chat/timeline/column-drag.ts +171 -0
  273. package/src/client/hooks/chat/timeline/width-mode.test.ts +112 -11
  274. package/src/client/hooks/chat/timeline/width-mode.ts +91 -18
  275. package/src/client/hooks/ui/border-style.test.ts +172 -0
  276. package/src/client/hooks/ui/border-style.ts +60 -0
  277. package/src/client/hooks/ui/navbar-controls.test.ts +27 -1
  278. package/src/client/hooks/ui/navbar-controls.ts +95 -20
  279. package/src/client/hooks/ui/style-attributes.test.ts +2 -0
  280. package/src/client/hooks/workspace/active-project.ts +46 -0
  281. package/src/client/hooks/workspace/commit-expansion.test.ts +135 -0
  282. package/src/client/hooks/workspace/commit-expansion.ts +56 -0
  283. package/src/client/hooks/workspace/panel-nav.test.ts +102 -0
  284. package/src/client/hooks/workspace/panel-nav.ts +95 -0
  285. package/src/client/hooks/workspace/panel-tabs.session.test.tsx +235 -0
  286. package/src/client/hooks/workspace/panel-tabs.ts +194 -0
  287. package/src/client/hooks/workspace/right-open-request.ts +53 -0
  288. package/src/client/hooks/workspace/right-side.test.ts +204 -0
  289. package/src/client/hooks/workspace/right-side.ts +142 -0
  290. package/src/client/main.tsx +9 -4
  291. package/src/client/tailwind.css +6 -0
  292. package/src/server/lib/assets/shell-attributes.server.ts +26 -10
  293. package/src/server/lib/assets/shell-attributes.test.ts +26 -0
  294. package/src/server/lib/harness/acp/background-replay.test.ts +16 -1
  295. package/src/server/lib/harness/acp/background-replay.ts +6 -1
  296. package/src/server/lib/harness/acp/background-work.ts +44 -31
  297. package/src/server/lib/harness/acp/session-turns.ts +4 -3
  298. package/src/server/lib/harness/acp/session-wiring.test.ts +53 -0
  299. package/src/server/lib/harness/acp/session-wiring.ts +11 -2
  300. package/src/server/lib/harness/session-lease.server.ts +3 -2
  301. package/src/server/lib/omp/session/lease-probe.server.test.ts +82 -0
  302. package/src/server/lib/omp/session/lease-probe.server.ts +180 -0
  303. package/src/server/lib/omp/session/ownership.server.test.ts +17 -6
  304. package/src/server/lib/omp/session/ownership.server.ts +7 -5
  305. package/src/server/plugins/ssr.ts +6 -3
  306. package/src/shared/lib/browser/user-tabs.test.ts +165 -0
  307. package/src/shared/lib/browser/user-tabs.ts +172 -0
  308. package/src/shared/lib/chat/timeline/width-mode.test.ts +34 -2
  309. package/src/shared/lib/chat/timeline/width-mode.ts +71 -22
  310. package/src/shared/lib/commands/catalog.ts +2 -2
  311. package/src/shared/lib/fs/git-status.test.ts +23 -0
  312. package/src/shared/lib/fs/git-status.ts +15 -0
  313. package/src/shared/lib/icons/tint-hues.generated.ts +20 -20
  314. package/src/shared/lib/settings/defaults.ts +7 -1
  315. package/src/shared/lib/theme/border-style.test.ts +83 -0
  316. package/src/shared/lib/theme/border-style.ts +122 -0
  317. package/src/shared/lib/workspace/keymap.ts +2 -1
  318. package/src/shared/lib/workspace/panel-nav.test.ts +162 -0
  319. package/src/shared/lib/workspace/panel-nav.ts +105 -0
  320. package/src/shared/lib/workspace/panel-tabs-close.test.ts +154 -0
  321. package/src/shared/lib/workspace/panel-tabs.ts +105 -0
  322. package/src/shared/lib/workspace/session-state/cache.ts +22 -0
  323. package/src/shared/lib/workspace/session-state/merge.ts +6 -0
  324. package/src/shared/lib/workspace/session-state/store.ts +23 -0
  325. package/src/shared/types/settings/state.ts +50 -3
  326. package/src/test-support/header-controls-harness.ts +22 -0
  327. package/src/test-support/peer-harness.ts +2 -2
  328. package/dist/client/static/js/ImageView-rnzf5tve.js +0 -1
  329. package/dist/client/static/js/LayoutWrapper-rekrgth6.js +0 -2
  330. package/dist/client/static/js/SessionsView-e84tjbcr.js +0 -1
  331. package/dist/client/static/js/architecture-7GRP2DOG-7j23x20s.js +0 -1
  332. package/dist/client/static/js/bash-vv2ysp0a.js +0 -1
  333. package/dist/client/static/js/c-8jf64j6h.js +0 -1
  334. package/dist/client/static/js/cpp-vh94zee0.js +0 -1
  335. package/dist/client/static/js/css-a13jmmnc.js +0 -1
  336. package/dist/client/static/js/css-p57h1fme.js +0 -1
  337. package/dist/client/static/js/cynefin-OW5HDTMX-me5xnx6a.js +0 -1
  338. package/dist/client/static/js/eventmodeling-NTZA5JFV-5zbvjj84.js +0 -1
  339. package/dist/client/static/js/flowDiagram-KWPJA3E3-36ygrbvm.js +0 -1
  340. package/dist/client/static/js/gitGraph-4MIJSDKK-tjhkv71w.js +0 -1
  341. package/dist/client/static/js/graphql-kesh8gk0.js +0 -1
  342. package/dist/client/static/js/html-sxpfydga.js +0 -1
  343. package/dist/client/static/js/index-0q2qfcjn.js +0 -1
  344. package/dist/client/static/js/index-48gh56ka.js +0 -3
  345. package/dist/client/static/js/index-4rv388z7.js +0 -2
  346. package/dist/client/static/js/index-52xmdeh2.js +0 -1
  347. package/dist/client/static/js/index-8kqepehd.js +0 -12
  348. package/dist/client/static/js/index-cje5gg45.js +0 -1
  349. package/dist/client/static/js/index-fbcg8y95.js +0 -1
  350. package/dist/client/static/js/index-g3shdymf.js +0 -1
  351. package/dist/client/static/js/index-h5n1btqy.js +0 -1
  352. package/dist/client/static/js/index-m1n4v0z7.js +0 -9
  353. package/dist/client/static/js/index-rn8w29pv.js +0 -2
  354. package/dist/client/static/js/index-sg6sz3g8.js +0 -1
  355. package/dist/client/static/js/index-vcrh95gf.css +0 -1
  356. package/dist/client/static/js/index-w5rw8f7w.js +0 -1
  357. package/dist/client/static/js/index-x6v37h3j.js +0 -1
  358. package/dist/client/static/js/info-A6RAGUB7-m6qz24p8.js +0 -1
  359. package/dist/client/static/js/ini-1x0ad976.js +0 -1
  360. package/dist/client/static/js/java-3944nq02.js +0 -1
  361. package/dist/client/static/js/json-g5ggnd94.js +0 -1
  362. package/dist/client/static/js/jsx-f6p72qpc.js +0 -1
  363. package/dist/client/static/js/lua-edn2b3wn.js +0 -1
  364. package/dist/client/static/js/markdown-9dhg1fax.js +0 -1
  365. package/dist/client/static/js/one-dark-pro-hteqzfb0.js +0 -1
  366. package/dist/client/static/js/one-light-dapnh0rs.js +0 -1
  367. package/dist/client/static/js/packet-AYTQ26CC-ng6wq5xj.js +0 -1
  368. package/dist/client/static/js/pie-WAS4IAKB-rf6jhxf6.js +0 -1
  369. package/dist/client/static/js/properties-fcmj08pv.js +0 -1
  370. package/dist/client/static/js/python-532d8ezm.js +0 -1
  371. package/dist/client/static/js/r-ptmdxs2a.js +0 -1
  372. package/dist/client/static/js/radar-RG4KPBEZ-ygp6hxq4.js +0 -1
  373. package/dist/client/static/js/railroad-74A4TZTK-rxgnrb2g.js +0 -1
  374. package/dist/client/static/js/railroad-abnf-HS5TGJTU-xkv52a2p.js +0 -1
  375. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-bvcktbqh.js +0 -1
  376. package/dist/client/static/js/railroad-peg-WCYAUIDC-9c3v7jsq.js +0 -1
  377. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-akjqm31r.js +0 -8
  378. package/dist/client/static/js/treeView-Q6P3EWNA-fb58a7z1.js +0 -1
  379. package/dist/client/static/js/treemap-WGGIJYW6-ej4qhksx.js +0 -1
  380. package/dist/client/static/js/tsx-zfy727zs.js +0 -1
  381. package/dist/client/static/js/typescript-683kkkaw.js +0 -1
  382. package/dist/client/static/js/wardley-WFR3VGLG-mkp0kanv.js +0 -1
  383. package/dist/client/static/js/xml-6ct32gys.js +0 -1
  384. package/dist/client/static/js/yaml-1d5m3bfj.js +0 -1
  385. package/src/server/lib/omp/session/lease-flock.server.ts +0 -117
@@ -0,0 +1,135 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * `useCommitExpansion` — the commit modal's one-open-row rule.
8
+ *
9
+ * Three behaviours the modal depends on, each mounted rather than inferred:
10
+ * a page starts with NOTHING open, clicking a row opens it and clicking it
11
+ * again closes it, and a new page (a refresh, or the modal reopened) starts
12
+ * collapsed even though the component stayed mounted.
13
+ */
14
+
15
+ import { afterAll, beforeAll, describe, expect, test } from 'bun:test';
16
+ import { Window } from 'happy-dom';
17
+ import type { h as PreactH, render as PreactRender } from 'preact';
18
+ import type { act as PreactAct } from 'preact/test-utils';
19
+ import type { useCommitExpansion as UseCommitExpansion } from '@/client/hooks/workspace/commit-expansion';
20
+ import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
21
+ import type { CommitHistoryPage } from '@/shared/types/git';
22
+
23
+ // Imported dynamically after the window exists: a static import evaluates
24
+ // Preact against the runner's windowless global and the render dies first.
25
+ let useCommitExpansion: typeof UseCommitExpansion;
26
+ let h: typeof PreactH;
27
+ let render: typeof PreactRender;
28
+ let act: typeof PreactAct;
29
+
30
+ let exposed: { expandedHash: string; toggleExpanded: (hash: string) => void } | null = null;
31
+
32
+ function page(data: string[]): CommitHistoryPage {
33
+ return {
34
+ success: true,
35
+ type: 'history',
36
+ title: 'History',
37
+ data: data.map((hash) => ({ hash, shortHash: hash.slice(0, 8), message: hash, author: 'a', date: 'now' })),
38
+ } as CommitHistoryPage;
39
+ }
40
+
41
+ async function mountPage(output: CommitHistoryPage | null): Promise<{
42
+ rerender: (next: CommitHistoryPage | null) => Promise<void>;
43
+ toggle: (hash: string) => Promise<void>;
44
+ expanded: () => string;
45
+ }> {
46
+ const container = document.createElement('div');
47
+ document.body.appendChild(container);
48
+
49
+ const Probe = ({ output: current }: { output: CommitHistoryPage | null }) => {
50
+ exposed = useCommitExpansion(current);
51
+ return null;
52
+ };
53
+
54
+ const rerender = async (next: CommitHistoryPage | null) => {
55
+ await act(async () => {
56
+ render(h(Probe, { output: next }), container);
57
+ });
58
+ };
59
+ await rerender(output);
60
+
61
+ return {
62
+ rerender,
63
+ toggle: async (hash: string) => {
64
+ await act(async () => { exposed?.toggleExpanded(hash); });
65
+ },
66
+ expanded: () => exposed?.expandedHash ?? '(unmounted)',
67
+ };
68
+ }
69
+
70
+ beforeAll(async () => {
71
+ installDomGlobals(new Window({ url: 'http://localhost' }));
72
+ ({ useCommitExpansion } = await import('@/client/hooks/workspace/commit-expansion'));
73
+ ({ h, render } = await import('preact'));
74
+ ({ act } = await import('preact/test-utils'));
75
+ });
76
+
77
+ afterAll(() => {
78
+ restoreDomGlobals();
79
+ });
80
+
81
+ describe('useCommitExpansion', () => {
82
+ test('a page opens with no row expanded', async () => {
83
+ const { expanded } = await mountPage(page(['aaa', 'bbb']));
84
+ expect(expanded()).toBe('');
85
+ });
86
+
87
+ test('a click opens the row and a second click closes it', async () => {
88
+ const { toggle, expanded } = await mountPage(page(['aaa', 'bbb']));
89
+
90
+ await toggle('aaa');
91
+ expect(expanded()).toBe('aaa');
92
+
93
+ await toggle('aaa');
94
+ expect(expanded()).toBe('');
95
+ });
96
+
97
+ test('opening another row closes the previous one', async () => {
98
+ const { toggle, expanded } = await mountPage(page(['aaa', 'bbb']));
99
+
100
+ await toggle('aaa');
101
+ await toggle('bbb');
102
+ expect(expanded()).toBe('bbb');
103
+
104
+ // The previous row's state is gone, not merely overridden: clicking it
105
+ // opens it rather than "closing" a row that is already closed.
106
+ await toggle('aaa');
107
+ expect(expanded()).toBe('aaa');
108
+ });
109
+
110
+ test('a new page starts collapsed', async () => {
111
+ const { rerender, toggle, expanded } = await mountPage(page(['aaa', 'bbb']));
112
+ await toggle('aaa');
113
+ expect(expanded()).toBe('aaa');
114
+
115
+ await rerender(page(['ccc', 'ddd']));
116
+ expect(expanded()).toBe('');
117
+
118
+ // And it is the NEW page's state that answers: opening a row still works.
119
+ await toggle('ccc');
120
+ expect(expanded()).toBe('ccc');
121
+ });
122
+
123
+ test('a null page is collapsed, and the next open page too', async () => {
124
+ const { rerender, toggle, expanded } = await mountPage(page(['aaa']));
125
+ await toggle('aaa');
126
+ expect(expanded()).toBe('aaa');
127
+
128
+ // The modal returns null while closed, then renders the next open with a
129
+ // FRESH output object — the row left open is not carried over.
130
+ await rerender(null);
131
+ expect(expanded()).toBe('');
132
+ await rerender(page(['bbb']));
133
+ expect(expanded()).toBe('');
134
+ });
135
+ });
@@ -0,0 +1,56 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * Which row of the commit modal has its detail open.
8
+ *
9
+ * One hash, not a set: the open row carries the action strip, the body and the
10
+ * changed-file list, which is the focused thing on the page, so opening another
11
+ * row closes the previous one. The modal keeps a row's detail to a single
12
+ * reader at a time rather than letting the list fill with open rows.
13
+ *
14
+ * A page that opens with a row expanded is the bug this replaces: the modal
15
+ * seeded the first commit as selected, so the history arrived with one commit
16
+ * already grown and every other commit pushed down before the reader asked for
17
+ * anything — and clicking that row again could not close it. Nothing is open
18
+ * until a row is clicked, and clicking the open row closes it.
19
+ *
20
+ * The page is part of the state so a NEW page (a refresh, or the modal reopened)
21
+ * starts collapsed. The modal stays mounted while closed, so state alone would
22
+ * carry the last open row into the next open.
23
+ */
24
+
25
+ import { useCallback, useState } from 'preact/hooks';
26
+ import type { CommitHistoryPage } from '@/shared/types/git';
27
+
28
+ interface ExpansionState {
29
+ /** The page the open row belongs to. */
30
+ page: CommitHistoryPage | null;
31
+ /** The open row's hash, or `''`. */
32
+ hash: string;
33
+ }
34
+
35
+ export function useCommitExpansion(output: CommitHistoryPage | null): {
36
+ expandedHash: string;
37
+ toggleExpanded: (hash: string) => void;
38
+ } {
39
+ const [state, setState] = useState<ExpansionState>({ page: output, hash: '' });
40
+
41
+ // Derived during render, not reset in an effect: a stale page's row would
42
+ // otherwise stay open for a frame after the new page's rows are on screen.
43
+ const expandedHash = state.page === output ? state.hash : '';
44
+
45
+ const toggleExpanded = useCallback(
46
+ (hash: string) => {
47
+ setState((current) => {
48
+ const open = current.page === output && current.hash === hash;
49
+ return { page: output, hash: open ? '' : hash };
50
+ });
51
+ },
52
+ [output],
53
+ );
54
+
55
+ return { expandedHash, toggleExpanded };
56
+ }
@@ -0,0 +1,102 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The panel-navigation setting's live-apply half.
8
+ *
9
+ * Two columns, two keys, and the failure this file exists to prevent:
10
+ * **a change addressed to one column re-mounting the other's tree.** The left
11
+ * column's mount owns the session list's expansion, scroll and batch selection;
12
+ * the right column's owns a terminal's PTY. An event that repainted both would
13
+ * cost one of them for a setting that did not touch it.
14
+ *
15
+ * `applyPanelNav` is idempotent in the only sense that matters here — it resolves
16
+ * the value and announces the resolved one — so a settings path that fires twice
17
+ * with the same value repaints the same tree with the same style.
18
+ *
19
+ * No database: this module reads the primed client snapshot and dispatches a
20
+ * window event. The write is the settings modal's own `writeKabmoSettings`.
21
+ */
22
+
23
+ import { afterEach, describe, expect, test } from 'bun:test';
24
+ import { primeKabmoSettings } from '@/shared/lib/settings/client';
25
+ import {
26
+ PANEL_NAV_CHANGED_EVENT,
27
+ PANEL_NAV_SETTING_KEY,
28
+ applyPanelNav,
29
+ currentPanelNav,
30
+ } from '@/client/hooks/workspace/panel-nav';
31
+
32
+ /** The events dispatched while the current test ran; `detail` may be absent. */
33
+ const dispatched: Array<{ side?: unknown; style?: unknown }> = [];
34
+
35
+ // `applyPanelNav` bails out in a process with no window; give this file one so
36
+ // the dispatch path is the real one, and stand in for the settings write.
37
+ const fakeWindow = globalThis as unknown as {
38
+ window?: unknown;
39
+ CustomEvent?: unknown;
40
+ };
41
+
42
+ fakeWindow.window ??= {
43
+ dispatchEvent: (event: { detail?: { side?: unknown; style?: unknown } }) => {
44
+ dispatched.push(event.detail ?? {});
45
+ return true;
46
+ },
47
+ };
48
+ fakeWindow.CustomEvent ??= class {
49
+ detail: unknown;
50
+ constructor(_type: string, init?: { detail?: unknown }) {
51
+ this.detail = init?.detail;
52
+ }
53
+ };
54
+
55
+ afterEach(() => dispatched.length = 0);
56
+
57
+ describe('currentPanelNav', () => {
58
+ test('reads each column from its own key', () => {
59
+ primeKabmoSettings({ leftPanelNav: 'tabs', rightPanelNav: 'rail' });
60
+ expect(currentPanelNav('left')).toBe('tabs');
61
+ expect(currentPanelNav('right')).toBe('rail');
62
+ });
63
+
64
+ test('the two keys are independent, so one choice cannot carry to the other', () => {
65
+ primeKabmoSettings({ leftPanelNav: 'rail', rightPanelNav: 'tabs' });
66
+ expect(currentPanelNav('left')).toBe('rail');
67
+ expect(currentPanelNav('right')).toBe('tabs');
68
+ });
69
+
70
+ test('an unset or unreadable value resolves to the rail, which is what ships', () => {
71
+ primeKabmoSettings({ leftPanelNav: 'from-a-newer-build' });
72
+ expect(currentPanelNav('left')).toBe('rail');
73
+ expect(currentPanelNav('right')).toBe('rail');
74
+ });
75
+
76
+ test('the keys it reads are the settings fields the app persists', () => {
77
+ expect(PANEL_NAV_SETTING_KEY.left).toBe('leftPanelNav');
78
+ expect(PANEL_NAV_SETTING_KEY.right).toBe('rightPanelNav');
79
+ });
80
+ });
81
+
82
+ describe('applyPanelNav', () => {
83
+ test('announces the SIDE and the resolved style', () => {
84
+ applyPanelNav('right', 'tabs');
85
+ expect(dispatched).toEqual([{ side: 'right', style: 'tabs' }]);
86
+ expect(PANEL_NAV_CHANGED_EVENT).toBe('omp:panel-nav-changed');
87
+ });
88
+
89
+ test('an unreadable value is announced as the shipped default, never as itself', () => {
90
+ applyPanelNav('left', 'whatever');
91
+ expect(dispatched).toEqual([{ side: 'left', style: 'rail' }]);
92
+ });
93
+
94
+ test('two changes addressed to different columns stay separate events', () => {
95
+ applyPanelNav('left', 'tabs');
96
+ applyPanelNav('right', 'tabs');
97
+ expect(dispatched).toEqual([
98
+ { side: 'left', style: 'tabs' },
99
+ { side: 'right', style: 'tabs' },
100
+ ]);
101
+ });
102
+ });
@@ -0,0 +1,95 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The one reader/writer of the desktop panel navigation style, per column.
8
+ *
9
+ * A style picks a COMPONENT TREE (`LeftColumn`/`RightColumn`'s switch between
10
+ * the rail and the tab strip), so something in JavaScript must re-render when
11
+ * it changes — `appSettings` is a boot-time prop and would only show a new
12
+ * style after a reload. The settings modal calls `applyPanelNav` when a value
13
+ * moves, which announces `omp:panel-nav-changed` with the SIDE and the resolved
14
+ * style; `usePanelNav(side)` is the single subscriber per column.
15
+ *
16
+ * Two independent values, because the columns answer different questions. The
17
+ * event carries the side so a change on the left cannot repaint the right into a
18
+ * tree it was not asked for.
19
+ *
20
+ * The initial value comes from the primed settings snapshot
21
+ * (`primeKabmoSettings` in `main.tsx`), so a mounted column draws the stored
22
+ * style on its first render — no flash of the other chrome.
23
+ */
24
+
25
+ import { useCallback, useState } from 'preact/hooks';
26
+ import { readKabmoSetting } from '@/shared/lib/settings/client';
27
+ import { useKabmoEvent } from '@/client/hooks/ui/window-event';
28
+ import type { SettingsState } from '@/shared/types';
29
+ import {
30
+ PANEL_NAV_SETTING_KEYS,
31
+ isPanelNavSide,
32
+ resolvePanelNav,
33
+ type PanelNavSide,
34
+ type PanelNavStyle,
35
+ } from '@/shared/lib/workspace/panel-nav';
36
+
37
+ /**
38
+ * `app_settings` keys holding each column's style (in the `kabmo_settings`
39
+ * blob).
40
+ *
41
+ * `satisfies keyof SettingsState` because the key and the field name must be the
42
+ * same string for persistence to work at all — renaming a field without this
43
+ * line would leave the setting silently unsaved.
44
+ */
45
+ export const PANEL_NAV_SETTING_KEY: Record<PanelNavSide, keyof SettingsState> = {
46
+ left: PANEL_NAV_SETTING_KEYS.left satisfies keyof SettingsState,
47
+ right: PANEL_NAV_SETTING_KEYS.right satisfies keyof SettingsState,
48
+ };
49
+
50
+ /** Window event carrying `{ side, style }` as `detail`. */
51
+ export const PANEL_NAV_CHANGED_EVENT = 'omp:panel-nav-changed';
52
+
53
+ /** The stored style for one column, resolved against what this build can draw. */
54
+ export function currentPanelNav(
55
+ side: PanelNavSide,
56
+ appSettings?: Record<string, any>,
57
+ ): PanelNavStyle {
58
+ return resolvePanelNav(readKabmoSetting<unknown>(PANEL_NAV_SETTING_KEY[side], appSettings));
59
+ }
60
+
61
+ /**
62
+ * Announce a new style for one column. Called by the settings modal when the
63
+ * value changes — the persisted copy is written by the modal's own
64
+ * `writeKabmoSettings`, so this function only has to make the mounted column
65
+ * re-render.
66
+ */
67
+ export function applyPanelNav(side: PanelNavSide, style: unknown): void {
68
+ if (typeof window === 'undefined') return;
69
+ window.dispatchEvent(
70
+ new CustomEvent(PANEL_NAV_CHANGED_EVENT, {
71
+ detail: { side, style: resolvePanelNav(style) },
72
+ }),
73
+ );
74
+ }
75
+
76
+ /** The style one column should draw, kept live across settings edits. */
77
+ export function usePanelNav(side: PanelNavSide): PanelNavStyle {
78
+ const [style, setStyle] = useState<PanelNavStyle>(() => currentPanelNav(side));
79
+
80
+ useKabmoEvent(PANEL_NAV_CHANGED_EVENT, (event) => {
81
+ const detail = (event as CustomEvent<{ side?: unknown; style?: unknown }>).detail;
82
+ // A change addressed to the other column is not this column's news: an
83
+ // unconditional set would repaint both, and a column that re-mounts its
84
+ // tree loses whatever the user had open in it.
85
+ if (!isPanelNavSide(detail?.side) || detail.side !== side) return;
86
+ setStyle(resolvePanelNav(detail.style));
87
+ });
88
+
89
+ return style;
90
+ }
91
+
92
+ /** A writer the settings modal can hand a single column's change to. */
93
+ export function usePanelNavApply(): (side: PanelNavSide, style: unknown) => void {
94
+ return useCallback((side: PanelNavSide, style: unknown) => applyPanelNav(side, style), []);
95
+ }
@@ -0,0 +1,235 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The tab strip's opening state: EMPTY, per session, and restored as itself.
8
+ *
9
+ * Three claims that the UI depends on and that a pure-function test cannot make,
10
+ * because they are about the session slot:
11
+ *
12
+ * 1. **A session that has never opened a tab is on the HOME PAGE.** This is what
13
+ * makes the tab style different from the rail, whose default is a view: a
14
+ * column with no view still has to show something, while a strip's empty
15
+ * state is its catalog. The stored `layout.activeRightPanel` (`files`) must
16
+ * not seed a tab — that path is `useRightOpenRequest`.
17
+ * 2. **Tabs are PER SESSION.** Two chats may be doing different work; carrying
18
+ * one chat's strip into another is the same mistake the sidebar's pending row
19
+ * made when it was derived from the active session.
20
+ * 3. **The round trip is lossless**, including the home flag: closing every tab
21
+ * must come back as `home`, not as `active: null` on a strip that has tabs.
22
+ *
23
+ * Rendered against happy-dom with the real `SessionStateProvider`, and the store
24
+ * is read directly for the persisted shape.
25
+ */
26
+
27
+ import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, test } from 'bun:test';
28
+ import { Window } from 'happy-dom';
29
+ import { h, render } from 'preact';
30
+ import { act } from 'preact/test-utils';
31
+ import { SessionStateProvider } from '@/client/components/common/session-state-provider/index';
32
+ import { usePanelTabs } from '@/client/hooks/workspace/panel-tabs';
33
+ import { getSessionState, getSessionValue, hydrateSession, resetSessionStateStore, setSessionKey } from '@/shared/lib/workspace/session-state/store';
34
+
35
+ const DOM_GLOBALS = ['window', 'document', 'navigator', 'Node', 'Element', 'HTMLElement', 'HTMLInputElement', 'Event', 'MouseEvent', 'KeyboardEvent'] as const;
36
+ const nativeGlobals: Partial<Record<(typeof DOM_GLOBALS)[number], unknown>> = {};
37
+ const nativeFetch = Bun.fetch;
38
+
39
+ let container: HTMLElement;
40
+
41
+ /** What the probe last rendered, so a test can read the hook's whole shape. */
42
+ let seen: { tabs: readonly string[]; active: string | null; home: boolean } | null = null;
43
+ /** The probe's writer, so a test can drive an action from outside. */
44
+ let actions: { open: (id: string) => void; close: (id: string) => void; showHome: () => void } | null = null;
45
+
46
+ /** The right column's strip, rendered as the column renders it. */
47
+ function Probe() {
48
+ const tabs = usePanelTabs('right', new Set(['files', 'git', 'todo']), null);
49
+ seen = { tabs: tabs.tabs, active: tabs.active, home: tabs.home };
50
+ actions = { open: tabs.open, close: tabs.close, showHome: tabs.showHome };
51
+ return h('div', null, JSON.stringify(seen));
52
+ }
53
+
54
+ function mount(sessionId: string) {
55
+ container = document.createElement('div');
56
+ document.body.appendChild(container);
57
+ act(() => {
58
+ render(h(SessionStateProvider, { sessionId, children: h(Probe, null) }), container);
59
+ });
60
+ }
61
+
62
+ beforeAll(() => {
63
+ const win = new Window({ url: 'http://localhost' });
64
+ const target = globalThis as unknown as Record<string, unknown>;
65
+ for (const key of DOM_GLOBALS) {
66
+ if (!(key in nativeGlobals)) nativeGlobals[key] = target[key];
67
+ target[key] = (win as unknown as Record<string, unknown>)[key];
68
+ }
69
+ // The stub stands in for the SERVER, and the server answers what it was
70
+ // persisted — so the GET returns the session's own entry rather than `{}`.
71
+ //
72
+ // Returning `{}` made `loadSession` adopt an empty blob over the value
73
+ // `hydrateSession` had just seeded, and `mount()` only awaits the effects of
74
+ // the first commit: whether the clearing fetch had settled by the assertion
75
+ // depended on the event loop's timing, not on the code. That passed locally
76
+ // and failed 100% of the time in CI (both the Linux and the Windows leg, the
77
+ // same single case), because the response landed before the first read there.
78
+ target.fetch = async (input: unknown, init?: { method?: string; body?: unknown }) => {
79
+ const method = init?.method ?? 'GET';
80
+ const sessionId = String(input).split('/sessions/')[1]?.split('/')[0] ?? 'x';
81
+ if (method === 'POST') return new Response(JSON.stringify({ success: true }), { status: 200, headers: { 'content-type': 'application/json' } });
82
+ return new Response(
83
+ JSON.stringify({ sessionId, state: { ...(getSessionState(sessionId) ?? {}) } }),
84
+ { status: 200, headers: { 'content-type': 'application/json' } },
85
+ );
86
+ };
87
+ });
88
+ afterAll(() => {
89
+ const target = globalThis as unknown as Record<string, unknown>;
90
+ for (const key of DOM_GLOBALS) {
91
+ if (nativeGlobals[key] === undefined) delete target[key];
92
+ else target[key] = nativeGlobals[key];
93
+ }
94
+ target.fetch = nativeFetch;
95
+ });
96
+
97
+ /**
98
+ * Every case starts on an EMPTY cache.
99
+ *
100
+ * The store is a module singleton, and `bun test` runs every suite in one
101
+ * process: a suite that writes a slot and does not forget it leaves an entry
102
+ * behind, so by the time this file runs the 10-entry LRU can already be full of
103
+ * other suites' leaked — and often DIRTY, therefore permanently un-evictable —
104
+ * sessions. Hydrating `s-a` and then `s-b` then evicts `s-a`, and this suite
105
+ * fails on a case that passes in isolation. Measured in CI on a full run: the
106
+ * cache evicted `s-a` at size 11.
107
+ */
108
+ beforeEach(() => {
109
+ resetSessionStateStore();
110
+ });
111
+
112
+ afterEach(() => {
113
+ render(null, container);
114
+ container.remove();
115
+ seen = null;
116
+ actions = null;
117
+ });
118
+ describe('a session that never opened a tab', () => {
119
+ test('starts on the home page with an empty strip, NOT on the stored right view', () => {
120
+ hydrateSession('s-new', {});
121
+ mount('s-new');
122
+ expect(seen).toEqual({ tabs: [], active: null, home: true });
123
+ });
124
+
125
+ test('a stored `layout.activeRightPanel` does not seed a tab', () => {
126
+ // The rail's default is `files`; the strip's default is nothing, and the
127
+ // stored selection is not a request to open it.
128
+ hydrateSession('s-rail', { 'layout.activeRightPanel': 'files' });
129
+ mount('s-rail');
130
+ expect(seen?.tabs).toEqual([]);
131
+ expect(seen?.home).toBe(true);
132
+ });
133
+ });
134
+
135
+ describe('tabs are per session', () => {
136
+ test('two sessions keep different strips', () => {
137
+ // Each session is hydrated and asserted BEFORE the next one is seeded.
138
+ //
139
+ // The store is a process-wide LRU capped at 10 sessions, so seeding both up
140
+ // front let the second `hydrateSession` evict the first when the cache was
141
+ // already full of other suites' sessions — and `evictIfNeeded` skips dirty
142
+ // entries, so a leaked entry that never persisted held a slot permanently.
143
+ // That made this case pass in isolation and fail on every CI leg. Nothing
144
+ // here depends on two entries co-residing, and the claim under test — one
145
+ // session's strip is not another's — is unchanged.
146
+ hydrateSession('s-a', { 'layout.rightPanelTabs': { tabs: ['files'], active: 'files', home: false } });
147
+ mount('s-a');
148
+ expect(seen?.tabs).toEqual(['files']);
149
+ render(null, container);
150
+ container.remove();
151
+
152
+ hydrateSession('s-b', { 'layout.rightPanelTabs': { tabs: ['git', 'todo'], active: 'todo', home: false } });
153
+ mount('s-b');
154
+ expect(seen?.tabs).toEqual(['git', 'todo']);
155
+ expect(seen?.active).toBe('todo');
156
+ });
157
+
158
+ test('a session with no blob is unaffected by another session that has one', () => {
159
+ hydrateSession('s-has', { 'layout.rightPanelTabs': { tabs: ['files'], active: 'files', home: false } });
160
+ hydrateSession('s-empty', {});
161
+ mount('s-empty');
162
+ expect(seen).toEqual({ tabs: [], active: null, home: true });
163
+ });
164
+ });
165
+
166
+ describe('the round trip', () => {
167
+ test('opening a tab persists under layout.rightPanelTabs', () => {
168
+ hydrateSession('s-w', {});
169
+ mount('s-w');
170
+ act(() => actions!.open('git'));
171
+ const stored = getSessionValue<{ tabs: string[]; active: string; home: boolean }>('s-w', 'layout.rightPanelTabs');
172
+ expect(stored).toEqual({ tabs: ['git'], active: 'git', home: false });
173
+ });
174
+
175
+ test('closing the last tab persists the HOME page, not a bare null', () => {
176
+ hydrateSession('s-c', {});
177
+ mount('s-c');
178
+ act(() => actions!.open('files'));
179
+ act(() => actions!.close('files'));
180
+ const stored = getSessionValue<{ tabs: string[]; active: string | null; home: boolean }>('s-c', 'layout.rightPanelTabs');
181
+ expect(stored).toEqual({ tabs: [], active: null, home: true });
182
+ });
183
+
184
+ test('a stored home flag is restored as home even while tabs are open', () => {
185
+ hydrateSession('s-h', {
186
+ 'layout.rightPanelTabs': { tabs: ['files', 'git'], active: 'git', home: true },
187
+ });
188
+ mount('s-h');
189
+ expect(seen).toEqual({ tabs: ['files', 'git'], active: 'git', home: true });
190
+ });
191
+
192
+ test('the store key carries the layout prefix every other layout slot uses', () => {
193
+ hydrateSession('s-k', {});
194
+ mount('s-k');
195
+ act(() => actions!.open('todo'));
196
+ // One prefix for per-session UI, beside `layout.openedFiles` and
197
+ // `layout.showRightPanel`; a key without it was the one inconsistency here.
198
+ expect(getSessionValue('s-k', 'layout.rightPanelTabs')).not.toBeUndefined();
199
+ expect(getSessionValue('s-k', 'rightPanelTabs')).toBeUndefined();
200
+ });
201
+
202
+ test('an id this build cannot draw is dropped, leaving the home page', () => {
203
+ hydrateSession('s-x', {
204
+ 'layout.rightPanelTabs': { tabs: ['ghost'], active: 'ghost', home: false },
205
+ });
206
+ mount('s-x');
207
+ expect(seen).toEqual({ tabs: [], active: null, home: true });
208
+ });
209
+
210
+ test('a corrupted blob is the empty page, not a crash', () => {
211
+ hydrateSession('s-bad', { 'layout.rightPanelTabs': 'not-an-object' });
212
+ mount('s-bad');
213
+ expect(seen).toEqual({ tabs: [], active: null, home: true });
214
+ });
215
+
216
+ test('showHome keeps the strip and only changes the page', () => {
217
+ hydrateSession('s-home', {
218
+ 'layout.rightPanelTabs': { tabs: ['files'], active: 'files', home: false },
219
+ });
220
+ mount('s-home');
221
+ act(() => actions!.showHome());
222
+ expect(seen).toEqual({ tabs: ['files'], active: 'files', home: true });
223
+ });
224
+ });
225
+
226
+ /** Keeps the store honest about a write it never received. */
227
+ test('setSessionKey is the writer the hook goes through', () => {
228
+ hydrateSession('s-direct', {});
229
+ setSessionKey('s-direct', 'layout.rightPanelTabs', { tabs: ['git'], active: 'git', home: false });
230
+ expect(getSessionValue('s-direct', 'layout.rightPanelTabs')).toEqual({
231
+ tabs: ['git'],
232
+ active: 'git',
233
+ home: false,
234
+ });
235
+ });