@kabmo-labs/kabmo 0.39.1 → 0.41.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 (284) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +364 -363
  3. package/dist/client/static/js/{CsvGrid-7synegzg.js → CsvGrid-60njj97j.js} +2 -2
  4. package/dist/client/static/js/{DocxView-v5d9n5yw.js → DocxView-rsv0j46a.js} +5 -5
  5. package/dist/client/static/js/{DrawioView-ww7y98tt.js → DrawioView-n2g5df3a.js} +2 -2
  6. package/dist/client/static/js/ImageView-t330jx6y.js +1 -0
  7. package/dist/client/static/js/LayoutWrapper-qp6nsw65.js +2 -0
  8. package/dist/client/static/js/{Modal-qj39shgb.js → Modal-sbya4ahp.js} +17 -17
  9. package/dist/client/static/js/{PdfView-t9v4datp.js → PdfView-1r7a0qkp.js} +1 -1
  10. package/dist/client/static/js/SessionsView-yqs5m8tj.js +1 -0
  11. package/dist/client/static/js/{SheetView-6zkxbjd4.js → SheetView-bt5pp042.js} +24 -24
  12. package/dist/client/static/js/{SvgPreview-7rt2p1y1.js → SvgPreview-vfmqgmrx.js} +1 -1
  13. package/dist/client/static/js/{abnfDiagram-O67JEVCF-888zn5zg.js → abnfDiagram-O67JEVCF-8k5hk1yx.js} +1 -1
  14. package/dist/client/static/js/architecture-7GRP2DOG-1wqga929.js +1 -0
  15. package/dist/client/static/js/{architectureDiagram-NJMV4G6O-b04e26rb.js → architectureDiagram-NJMV4G6O-7jcb7fgy.js} +3 -3
  16. package/dist/client/static/js/{astro-4ybhkc9b.js → astro-0rh34hha.js} +1 -1
  17. package/dist/client/static/js/bash-vv2ysp0a.js +1 -0
  18. package/dist/client/static/js/{blockDiagram-BEXU5L5S-32ph2m52.js → blockDiagram-BEXU5L5S-04sbtdth.js} +5 -5
  19. package/dist/client/static/js/c-67jyc7sg.js +1 -0
  20. package/dist/client/static/js/{c4Diagram-YGBWAQC7-hwnaa333.js → c4Diagram-YGBWAQC7-vwac9za0.js} +2 -2
  21. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-2kg7dqeb.js → classDiagram-v2-NBCMYWYE-18cc0bsb.js} +5 -5
  22. package/dist/client/static/js/{cose-bilkent-JH36ORCC-tj2sbtyv.js → cose-bilkent-JH36ORCC-dk683zvp.js} +1 -1
  23. package/dist/client/static/js/cpp-crfbnwv8.js +1 -0
  24. package/dist/client/static/js/css-2re5mbea.js +1 -0
  25. package/dist/client/static/js/css-983fbv00.js +1 -0
  26. package/dist/client/static/js/cynefin-OW5HDTMX-j2dpdgkh.js +1 -0
  27. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-wx2y8dhm.js → cynefinDiagram-VND7K2PF-m2sx8d8s.js} +1 -1
  28. package/dist/client/static/js/{dagre-6A5THRUB-5v3rzdxd.js → dagre-6A5THRUB-qf3pr59p.js} +2 -2
  29. package/dist/client/static/js/{diagram-22UHCM2B-7er2jwy1.js → diagram-22UHCM2B-twnz23mt.js} +11 -11
  30. package/dist/client/static/js/{diagram-3UASUU5V-2b7nmdha.js → diagram-3UASUU5V-417bas6t.js} +1 -1
  31. package/dist/client/static/js/{diagram-ATOU4E4O-yf61ftn0.js → diagram-ATOU4E4O-n63cpdnx.js} +3 -3
  32. package/dist/client/static/js/{diagram-CDSNMT55-cn3rs9xn.js → diagram-CDSNMT55-v86p14dd.js} +3 -3
  33. package/dist/client/static/js/{diagram-MLGK6HIB-7kvtsj6c.js → diagram-MLGK6HIB-7a0h1hs3.js} +1 -1
  34. package/dist/client/static/js/{diagram-MPIPVDR6-g3zg3r5e.js → diagram-MPIPVDR6-w75bftmd.js} +2 -2
  35. package/dist/client/static/js/{dockerfile-f9j396wm.js → dockerfile-g5qbaeq3.js} +1 -1
  36. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-ft02nzne.js → ebnfDiagram-ZINNZB2B-vdzm3tsv.js} +1 -1
  37. package/dist/client/static/js/{elixir-v9bbxsgg.js → elixir-gpez1k9m.js} +1 -1
  38. package/dist/client/static/js/{elk-276RUBZZ-87fvkn2k.js → elk-276RUBZZ-2fsbb484.js} +1 -1
  39. package/dist/client/static/js/{erDiagram-OPXOYQCR-gh9mp6j8.js → erDiagram-OPXOYQCR-vnkztq7d.js} +5 -5
  40. package/dist/client/static/js/{erlang-55r0skxa.js → erlang-jqqa3ehb.js} +1 -1
  41. package/dist/client/static/js/eventmodeling-NTZA5JFV-xjvjawd3.js +1 -0
  42. package/dist/client/static/js/flowDiagram-KWPJA3E3-j21f2bfg.js +1 -0
  43. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-227xs61z.js → ganttDiagram-FUAMR5RP-pbvcch52.js} +2 -2
  44. package/dist/client/static/js/{ghostty-web-2gt2tp72.js → ghostty-web-22pdvhta.js} +4 -4
  45. package/dist/client/static/js/gitGraph-4MIJSDKK-r0zbk95f.js +1 -0
  46. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-4671gdym.js → gitGraphDiagram-X574FWY7-dkvktvzr.js} +2 -2
  47. package/dist/client/static/js/graphql-npbd9fdx.js +1 -0
  48. package/dist/client/static/js/html-1cpe2xc8.js +1 -0
  49. package/dist/client/static/js/{index-enmh3w27.js → index-0c6vpk89.js} +2 -2
  50. package/dist/client/static/js/{index-35mh9kbs.js → index-0xaz2eyv.js} +3 -3
  51. package/dist/client/static/js/{index-668chrpq.js → index-1sw00wm0.js} +1 -1
  52. package/dist/client/static/js/index-2z9wrb46.js +2 -0
  53. package/dist/client/static/js/{index-qbnd827h.js → index-3rymer2w.js} +1 -1
  54. package/dist/client/static/js/{index-f1nqk6z6.js → index-4jk8ngjg.js} +2 -2
  55. package/dist/client/static/js/index-55hq7tnj.js +1 -0
  56. package/dist/client/static/js/{index-8egjccbq.js → index-6fx2t6y7.js} +52 -52
  57. package/dist/client/static/js/{index-8xasfxf3.js → index-7fwppdkn.js} +1 -1
  58. package/dist/client/static/js/{index-28a5kf88.js → index-7w3gqw2b.js} +1 -1
  59. package/dist/client/static/js/{index-c1be3rva.js → index-9dnkfpx4.js} +2 -2
  60. package/dist/client/static/js/{index-s80x8d58.js → index-9fnzcg2x.js} +2 -2
  61. package/dist/client/static/js/{index-h8rr48px.js → index-a4ed3mks.js} +4 -4
  62. package/dist/client/static/js/{index-j2g39xq7.js → index-ae91g8ka.js} +5 -5
  63. package/dist/client/static/js/{index-xrp2zv8z.js → index-agdbjh5k.js} +2 -2
  64. package/dist/client/static/js/{index-2rs03vfy.js → index-ajjq0b8y.js} +2 -2
  65. package/dist/client/static/js/{index-xfr6r539.js → index-amawahyh.js} +2 -2
  66. package/dist/client/static/js/{index-y5ymgp20.js → index-b6cyn4hr.js} +50 -50
  67. package/dist/client/static/js/index-c6kx7s6a.js +2 -0
  68. package/dist/client/static/js/{index-k7sdsmgv.js → index-ce4vytm6.js} +2 -2
  69. package/dist/client/static/js/{index-b08hx4tw.js → index-cytks03p.js} +2 -2
  70. package/dist/client/static/js/{index-cfnxda13.js → index-djv15k5s.js} +2 -2
  71. package/dist/client/static/js/{index-kkfbd1db.js → index-ds6a2cx7.js} +5 -5
  72. package/dist/client/static/js/{index-tmnnafht.js → index-e6qjfcz9.js} +1 -1
  73. package/dist/client/static/js/{index-442mbhwb.js → index-e7yf273s.js} +2 -2
  74. package/dist/client/static/js/{index-f73v86a3.js → index-efn233xp.js} +4 -4
  75. package/dist/client/static/js/index-esx3zwnt.js +1 -0
  76. package/dist/client/static/js/{index-d3prrt2q.js → index-f8pq132s.js} +1 -1
  77. package/dist/client/static/js/index-fbbp5cwj.js +2 -0
  78. package/dist/client/static/js/{index-drjtwfp5.js → index-fg965t62.js} +2 -2
  79. package/dist/client/static/js/{index-xnk1500f.js → index-g1cggqgx.js} +12 -12
  80. package/dist/client/static/js/index-ghsdzs4m.js +1 -0
  81. package/dist/client/static/js/{index-4wvtar0v.js → index-gn92c6hp.js} +2 -2
  82. package/dist/client/static/js/{index-4c2zcvem.js → index-gs7ytgdw.js} +180 -180
  83. package/dist/client/static/js/{index-q0bph5x0.js → index-haaz8t7e.js} +2 -2
  84. package/dist/client/static/js/{index-t6gznaxm.js → index-hz177dr2.js} +2 -2
  85. package/dist/client/static/js/{index-7qc2avfy.js → index-j5ram1ve.js} +2 -2
  86. package/dist/client/static/js/{index-cst843zs.css → index-jqs23cc7.css} +1 -1
  87. package/dist/client/static/js/{index-y91j4t1q.js → index-ne131hmw.js} +2 -2
  88. package/dist/client/static/js/{index-1sgad84m.js → index-ngk9h0v9.js} +2 -2
  89. package/dist/client/static/js/{index-4wtr5wjp.js → index-ntcqyqd5.js} +2 -2
  90. package/dist/client/static/js/{index-m847wafq.js → index-pbsm2vw7.js} +2 -2
  91. package/dist/client/static/js/{index-vb3srfyc.js → index-pfbyfab5.js} +2 -2
  92. package/dist/client/static/js/{index-qsrw5c67.js → index-pn91shfp.js} +2 -2
  93. package/dist/client/static/js/{index-6rs8e8ng.js → index-qjsy6p86.js} +1 -1
  94. package/dist/client/static/js/{index-fjnkzk12.js → index-qsw5edtk.js} +5 -5
  95. package/dist/client/static/js/{index-72289dgx.js → index-rc8wrs2a.js} +2 -2
  96. package/dist/client/static/js/{index-w0rbyw47.js → index-rdqn92tc.js} +2 -2
  97. package/dist/client/static/js/{index-phm1zb8m.js → index-re1xz433.js} +1 -1
  98. package/dist/client/static/js/{index-mtadrbxt.js → index-rebnv57p.js} +2 -2
  99. package/dist/client/static/js/{index-9d6x1f3t.js → index-s78n0dtv.js} +2 -2
  100. package/dist/client/static/js/{index-c36pag9y.js → index-sj4y8kj2.js} +2 -2
  101. package/dist/client/static/js/{index-87qandgr.js → index-tgper3yy.js} +2 -2
  102. package/dist/client/static/js/index-x2kb1kx5.js +3 -0
  103. package/dist/client/static/js/{index-0j518hqm.js → index-xf36nmbm.js} +2 -2
  104. package/dist/client/static/js/{index-hdd8nqz8.js → index-xfa5hswh.js} +1 -1
  105. package/dist/client/static/js/{index-9gepbvdt.js → index-yq9vnd1y.js} +2 -2
  106. package/dist/client/static/js/{index-y3qxrs90.js → index-yzg9mbsv.js} +2 -2
  107. package/dist/client/static/js/{index-wgvysmnr.js → index-zfykeg7x.js} +10 -10
  108. package/dist/client/static/js/{index-rj81xrvw.js → index-zye9309h.js} +2 -2
  109. package/dist/client/static/js/info-A6RAGUB7-a8xap43w.js +1 -0
  110. package/dist/client/static/js/{infoDiagram-VRGFBTTK-k1jnhhbp.js → infoDiagram-VRGFBTTK-mh6yks62.js} +1 -1
  111. package/dist/client/static/js/ini-df5bw23e.js +1 -0
  112. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-ar94x2gr.js → ishikawaDiagram-OU5B5YK6-hnfqppnv.js} +2 -2
  113. package/dist/client/static/js/java-8j33rj1p.js +1 -0
  114. package/dist/client/static/js/javascript-zegm06a1.js +1 -0
  115. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-ntfp0w54.js → journeyDiagram-ZHPQQLJL-s4nv1f3q.js} +3 -3
  116. package/dist/client/static/js/json-g5ggnd94.js +1 -0
  117. package/dist/client/static/js/jsx-f6p72qpc.js +1 -0
  118. package/dist/client/static/js/{julia-jhe2vd4f.js → julia-yre4bxb9.js} +1 -1
  119. package/dist/client/static/js/{kanban-definition-PNTS6WVX-q5rsr6j3.js → kanban-definition-PNTS6WVX-t8kbfefp.js} +8 -8
  120. package/dist/client/static/js/lua-bahx6qze.js +1 -0
  121. package/dist/client/static/js/markdown-9dhg1fax.js +1 -0
  122. package/dist/client/static/js/{mermaid.core-0gafsqrm.js → mermaid.core-0784021p.js} +7 -7
  123. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-jgz6nyhk.js → mindmap-definition-NLK3R4M7-swkkze8c.js} +8 -8
  124. package/dist/client/static/js/one-dark-pro-h5tmw145.js +1 -0
  125. package/dist/client/static/js/one-light-x7vj1pxr.js +1 -0
  126. package/dist/client/static/js/packet-AYTQ26CC-b5bvg6v1.js +1 -0
  127. package/dist/client/static/js/{pegDiagram-GJSIUBJH-b3e9ma2c.js → pegDiagram-GJSIUBJH-jqayzh7z.js} +1 -1
  128. package/dist/client/static/js/{perl-qhj6tk7k.js → perl-weeskn1v.js} +1 -1
  129. package/dist/client/static/js/{php-arycc4w7.js → php-vf3045p9.js} +1 -1
  130. package/dist/client/static/js/pie-WAS4IAKB-77ee73zg.js +1 -0
  131. package/dist/client/static/js/{pieDiagram-5QR66LMP-66mn2qnt.js → pieDiagram-5QR66LMP-w03a65ky.js} +2 -2
  132. package/dist/client/static/js/properties-49mfnee4.js +1 -0
  133. package/dist/client/static/js/python-qb69wp1s.js +1 -0
  134. package/dist/client/static/js/{quadrantDiagram-O4NWA36T-n7warg0e.js → quadrantDiagram-O4NWA36T-2j7sfa9s.js} +3 -3
  135. package/dist/client/static/js/r-s3mf2tch.js +1 -0
  136. package/dist/client/static/js/radar-RG4KPBEZ-cp79xtvb.js +1 -0
  137. package/dist/client/static/js/railroad-74A4TZTK-dcpgqhcb.js +1 -0
  138. package/dist/client/static/js/railroad-abnf-HS5TGJTU-qasqv686.js +1 -0
  139. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-e46908rd.js +1 -0
  140. package/dist/client/static/js/railroad-peg-WCYAUIDC-7009t6bk.js +1 -0
  141. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-k8j43rxj.js → railroadDiagram-XR7U4H2S-jtkkgy34.js} +1 -1
  142. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-ef2v7nyq.js → requirementDiagram-PLB6GJNP-t85ckjdb.js} +3 -3
  143. package/dist/client/static/js/{ruby-fb6zzevm.js → ruby-1a2ryzy6.js} +1 -1
  144. package/dist/client/static/js/{rust-jvkbr060.js → rust-736r0f0v.js} +1 -1
  145. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-3njbd1yd.js → sankeyDiagram-IPEJSGJF-5pfkw8ne.js} +3 -3
  146. package/dist/client/static/js/{sass-fzs6a0kr.js → sass-tq4vw7hd.js} +1 -1
  147. package/dist/client/static/js/{scss-gdb52d0c.js → scss-x7ddw6gb.js} +1 -1
  148. package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-k2wqc0qt.js → sequenceDiagram-PO4LG4MO-55vs9zv5.js} +7 -7
  149. package/dist/client/static/js/{sizeCapture-INFHLROL-cpnd12ee.js → sizeCapture-INFHLROL-pzqqd7f4.js} +1 -1
  150. package/dist/client/static/js/sql-aczp05f2.js +1 -0
  151. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-1ydpxaeg.js → stateDiagram-v2-GCMORJYK-6nhrph8n.js} +3 -3
  152. package/dist/client/static/js/{svelte-8s3k6qjd.js → svelte-0hv6pak2.js} +1 -1
  153. package/dist/client/static/js/{swimlanes-2SLR337P-4md43da2.js → swimlanes-2SLR337P-6tcnxfbv.js} +1 -1
  154. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-7xrkrkpa.js +8 -0
  155. package/dist/client/static/js/{timeline-definition-EJHVYXUP-sp32bf3e.js → timeline-definition-EJHVYXUP-1dz46nt5.js} +4 -4
  156. package/dist/client/static/js/treeView-Q6P3EWNA-tpn62q8j.js +1 -0
  157. package/dist/client/static/js/treemap-WGGIJYW6-w910f1g4.js +1 -0
  158. package/dist/client/static/js/tsx-s1shkfg9.js +1 -0
  159. package/dist/client/static/js/typescript-htx9v6bf.js +1 -0
  160. package/dist/client/static/js/{usecaseDiagram-POWQR4AR-p2ssettn.js → usecaseDiagram-POWQR4AR-b3jfveq6.js} +28 -28
  161. package/dist/client/static/js/{vennDiagram-UO4OBE2U-ejqq8b82.js → vennDiagram-UO4OBE2U-dnc3jqvp.js} +3 -3
  162. package/dist/client/static/js/{vue-k3f3chre.js → vue-zccj3qa5.js} +1 -1
  163. package/dist/client/static/js/wardley-WFR3VGLG-pt9tq808.js +1 -0
  164. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-tkk79rsn.js → wardleyDiagram-VNRHLVJA-466m8400.js} +3 -3
  165. package/dist/client/static/js/xml-wr1dxav5.js +1 -0
  166. package/dist/client/static/js/{xychartDiagram-PMCCYNJV-zhgrsqpb.js → xychartDiagram-PMCCYNJV-kryrpqp1.js} +3 -3
  167. package/dist/client/static/js/yaml-0y9fdskg.js +1 -0
  168. package/marketplace/plugins/command-runner/package.json +2 -2
  169. package/marketplace/plugins/command-runner/src/panel/Custom.test.tsx +1 -0
  170. package/marketplace/plugins/command-runner/src/panel/Groups.test.tsx +10 -0
  171. package/marketplace/plugins/command-runner/src/panel/Groups.tsx +24 -3
  172. package/marketplace/plugins/command-runner/src/panel/index.tsx +1 -0
  173. package/marketplace/plugins/command-runner/src/protocol.ts +10 -0
  174. package/marketplace/plugins/command-runner/src/server/discovery.test.ts +30 -0
  175. package/marketplace/plugins/command-runner/src/server/scan.ts +16 -3
  176. package/package.json +1 -1
  177. package/src/client/components/common/header-controls/MoreMenu.tsx +24 -14
  178. package/src/client/components/common/header-controls/index.test.tsx +22 -0
  179. package/src/client/components/common/header-controls/index.tsx +8 -2
  180. package/src/client/components/layout/desktop-layout/LeftColumn.tsx +7 -0
  181. package/src/client/components/layout/session-sidebar/SessionsView.tsx +2 -1
  182. package/src/client/components/layout/session-sidebar/about-modal/index.test.tsx +1 -1
  183. package/src/client/components/mobile/LayoutWrapper.tsx +19 -2
  184. package/src/client/components/mobile/RightSidebar.tsx +49 -1
  185. package/src/client/components/mobile/SessionSidebar.tsx +29 -1
  186. package/src/client/components/mobile/header-titlebar.test.tsx +17 -0
  187. package/src/client/components/mobile/mobile-main-view/Header.test.tsx +43 -0
  188. package/src/client/components/mobile/mobile-main-view/Header.tsx +30 -0
  189. package/src/client/components/mobile/mobile-session-sidebar/Dock.tsx +5 -1
  190. package/src/client/components/mobile/mobile-session-sidebar/Header.tsx +12 -1
  191. package/src/client/components/mobile/panel-chips.test.tsx +13 -0
  192. package/src/client/components/mobile/panel-chips.tsx +9 -2
  193. package/src/client/components/settings/categories/connect-settings/DeviceTable.test.tsx +92 -0
  194. package/src/client/components/settings/categories/connect-settings/DeviceTable.tsx +22 -3
  195. package/src/client/components/workspace/chat-timeline/MessageList.test.ts +19 -19
  196. package/src/client/components/workspace/git-panel/commit-modal/Header.test.tsx +21 -0
  197. package/src/client/components/workspace/git-panel/commit-modal/Header.tsx +13 -9
  198. package/src/client/components/workspace/terminal-panel/focus-target.test.ts +121 -0
  199. package/src/client/components/workspace/terminal-panel/focus-target.ts +54 -0
  200. package/src/client/components/workspace/terminal-panel/index.tsx +7 -1
  201. package/src/client/components/workspace/terminal-panel/instance.ts +82 -0
  202. package/src/client/components/workspace/terminal-panel/mount.ts +22 -63
  203. package/src/client/components/workspace/terminal-panel/soft-keyboard.ts +29 -0
  204. package/src/client/hooks/commands/use-command-runtime.ts +15 -0
  205. package/src/client/hooks/ui/touch-device.ts +8 -3
  206. package/src/client/hooks/ui/updates/check-request.ts +41 -0
  207. package/src/client/hooks/ui/updates/index.ts +13 -5
  208. package/src/client/hooks/ui/visibility-menu-trigger.test.ts +155 -0
  209. package/src/client/hooks/ui/visibility-menu-trigger.ts +85 -0
  210. package/src/client/hooks/workspace/panel-visibility-menu.ts +50 -0
  211. package/src/client/lib/native/run-command.test.ts +95 -0
  212. package/src/client/lib/native/run-command.ts +52 -0
  213. package/src/client/lib/router/open-session.test.ts +26 -1
  214. package/src/client/lib/router/open-session.ts +21 -0
  215. package/src/client/lib/ui/soft-keyboard.test.ts +103 -0
  216. package/src/client/lib/ui/soft-keyboard.ts +90 -0
  217. package/src/client/main.tsx +9 -0
  218. package/src/server/lib/auth/guard.ts +8 -2
  219. package/src/server/lib/changes/capture-shell.test.ts +253 -0
  220. package/src/server/lib/changes/capture-targets.test.ts +83 -0
  221. package/src/server/lib/changes/capture-targets.ts +51 -0
  222. package/src/server/lib/changes/capture-write.server.ts +2 -2
  223. package/src/server/lib/changes/capture.server.ts +14 -29
  224. package/src/server/lib/changes/capture.test.ts +69 -149
  225. package/src/server/lib/changes/patch-paths.ts +37 -0
  226. package/src/server/lib/connect/devices.server.test.ts +70 -0
  227. package/src/server/lib/connect/devices.server.ts +43 -1
  228. package/src/server/lib/connect/last-connect.gate.test.ts +52 -0
  229. package/src/server/routes/connect/devices.ts +5 -4
  230. package/src/shared/lib/commands/catalog.test.ts +36 -0
  231. package/src/shared/lib/commands/catalog.ts +16 -0
  232. package/src/shared/lib/connect/types.ts +1 -0
  233. package/src/shared/lib/updates/popup-state.ts +11 -0
  234. package/dist/client/static/js/ImageView-t3rkypzs.js +0 -1
  235. package/dist/client/static/js/LayoutWrapper-th2pd4yt.js +0 -2
  236. package/dist/client/static/js/SessionsView-yqy0a1xg.js +0 -1
  237. package/dist/client/static/js/architecture-7GRP2DOG-y0zb4vqa.js +0 -1
  238. package/dist/client/static/js/bash-k6p3y3pr.js +0 -1
  239. package/dist/client/static/js/c-ve09y19q.js +0 -1
  240. package/dist/client/static/js/cpp-vhqp7bcy.js +0 -1
  241. package/dist/client/static/js/css-77mvf0ca.js +0 -1
  242. package/dist/client/static/js/css-tys2rrny.js +0 -1
  243. package/dist/client/static/js/cynefin-OW5HDTMX-nt1ed192.js +0 -1
  244. package/dist/client/static/js/eventmodeling-NTZA5JFV-v4edaxx7.js +0 -1
  245. package/dist/client/static/js/flowDiagram-KWPJA3E3-6gc6gd1d.js +0 -1
  246. package/dist/client/static/js/gitGraph-4MIJSDKK-adzhec96.js +0 -1
  247. package/dist/client/static/js/graphql-g97hycb3.js +0 -1
  248. package/dist/client/static/js/html-2syect3n.js +0 -1
  249. package/dist/client/static/js/index-1jeyjqkh.js +0 -2
  250. package/dist/client/static/js/index-4ry8kz8h.js +0 -3
  251. package/dist/client/static/js/index-fjqp03xe.js +0 -2
  252. package/dist/client/static/js/index-fs3pbqwn.js +0 -1
  253. package/dist/client/static/js/index-jze0zg3z.js +0 -2
  254. package/dist/client/static/js/index-w0xvdda9.js +0 -1
  255. package/dist/client/static/js/index-wfcgqjzr.js +0 -1
  256. package/dist/client/static/js/info-A6RAGUB7-2ye26vqn.js +0 -1
  257. package/dist/client/static/js/ini-7ffv28px.js +0 -1
  258. package/dist/client/static/js/java-4x5yky4a.js +0 -1
  259. package/dist/client/static/js/javascript-4kw2j9t3.js +0 -1
  260. package/dist/client/static/js/json-h3kwpty2.js +0 -1
  261. package/dist/client/static/js/jsx-jk20f0dr.js +0 -1
  262. package/dist/client/static/js/lua-k02dpxq8.js +0 -1
  263. package/dist/client/static/js/markdown-fhhg7ms6.js +0 -1
  264. package/dist/client/static/js/one-dark-pro-n0as47q7.js +0 -1
  265. package/dist/client/static/js/one-light-05nw3mzj.js +0 -1
  266. package/dist/client/static/js/packet-AYTQ26CC-b0j3te0q.js +0 -1
  267. package/dist/client/static/js/pie-WAS4IAKB-28qq62fn.js +0 -1
  268. package/dist/client/static/js/properties-qhvcxc13.js +0 -1
  269. package/dist/client/static/js/python-3qsrs510.js +0 -1
  270. package/dist/client/static/js/r-z2ng7mza.js +0 -1
  271. package/dist/client/static/js/radar-RG4KPBEZ-fyrcbpyd.js +0 -1
  272. package/dist/client/static/js/railroad-74A4TZTK-9s62qncd.js +0 -1
  273. package/dist/client/static/js/railroad-abnf-HS5TGJTU-f7yjmhrk.js +0 -1
  274. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-sfrw8gkz.js +0 -1
  275. package/dist/client/static/js/railroad-peg-WCYAUIDC-4mm4cern.js +0 -1
  276. package/dist/client/static/js/sql-ypk53ntb.js +0 -1
  277. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-d48g5gjf.js +0 -8
  278. package/dist/client/static/js/treeView-Q6P3EWNA-a5vgg4gz.js +0 -1
  279. package/dist/client/static/js/treemap-WGGIJYW6-ctqhajgg.js +0 -1
  280. package/dist/client/static/js/tsx-zy7hb2hw.js +0 -1
  281. package/dist/client/static/js/typescript-2hr53c8j.js +0 -1
  282. package/dist/client/static/js/wardley-WFR3VGLG-ns7e0fqf.js +0 -1
  283. package/dist/client/static/js/xml-p4742r9b.js +0 -1
  284. package/dist/client/static/js/yaml-qbckg671.js +0 -1
@@ -0,0 +1,41 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The native App menu's "Check for Updates…", shared by both layouts.
8
+ *
9
+ * The menu row cannot read the console's update state, and a second copy of the
10
+ * request would be a second source of truth for the same check. The row
11
+ * dispatches `omp:update-check`; whichever sidebar is mounted owns `useUpdates`
12
+ * and runs the ONE check, then reports the verdict — the popup when a release is
13
+ * available, a sentence when there is not.
14
+ *
15
+ * Both sidebars mount this hook because only one of them is on screen at a time,
16
+ * and the rule "one check, one verdict" is easier to keep in one place than in
17
+ * two handlers that have to stay identical.
18
+ */
19
+
20
+ import { useKabmoEvent } from '@/client/hooks/ui/window-event';
21
+ import type { UseUpdatesResult } from '@/client/hooks/ui/updates';
22
+ import { UPDATE_CHECK_EVENT, UPDATE_POPUP_OPEN_EVENT } from '@/shared/lib/updates/popup-state';
23
+ import type { ToastTone } from '@/shared/lib/ui/toast-duration';
24
+
25
+ export function useUpdateCheckRequest(
26
+ updates: UseUpdatesResult,
27
+ pushToast: (message: string, type?: ToastTone) => void,
28
+ ): void {
29
+ useKabmoEvent(UPDATE_CHECK_EVENT, () => {
30
+ void updates.check().then((result) => {
31
+ // A failed check already has its own sentence in `updates.error`, and the
32
+ // About modal shows it; a toast here would only repeat it.
33
+ if (!result) return;
34
+ if (result.kabmo.updateAvailable) {
35
+ window.dispatchEvent(new CustomEvent(UPDATE_POPUP_OPEN_EVENT));
36
+ return;
37
+ }
38
+ pushToast('Kabmo is up to date.', 'success');
39
+ });
40
+ });
41
+ }
@@ -25,7 +25,12 @@ export interface UseUpdatesResult {
25
25
  progress: UpdateLogState | null;
26
26
  error: string | null;
27
27
  hasUpdate: boolean;
28
- check: () => Promise<void>;
28
+ /**
29
+ * The verdict, not just "done": a caller that asked for the check (the native
30
+ * menu's row) has to report it, and reading `info` from state right after the
31
+ * promise resolves is a race the returned value does not have.
32
+ */
33
+ check: () => Promise<UpdateCheckResult | null>;
29
34
  apply: (target: UpdateTarget) => Promise<UpdateApplyResult | null>;
30
35
  }
31
36
 
@@ -81,16 +86,16 @@ export function useUpdates(options: UseUpdatesOptions = {}): UseUpdatesResult {
81
86
  const [applying, setApplying] = useState<UpdateTarget | null>(null);
82
87
  const [progress, setProgress] = useState<UpdateLogState | null>(null);
83
88
  const [error, setError] = useState<string | null>(null);
84
- const inFlightCheckRef = useRef<Promise<void> | null>(null);
89
+ const inFlightCheckRef = useRef<Promise<UpdateCheckResult | null> | null>(null);
85
90
  const lastCheckAtRef = useRef(0);
86
91
  const didAutoCheckRef = useRef(false);
87
92
  const applyAbortRef = useRef<AbortController | null>(null);
88
93
 
89
- const check = useCallback(() => {
94
+ const check = useCallback((): Promise<UpdateCheckResult | null> => {
90
95
  if (inFlightCheckRef.current) return inFlightCheckRef.current;
91
96
 
92
97
  lastCheckAtRef.current = Date.now();
93
- const request = (async () => {
98
+ const request = (async (): Promise<UpdateCheckResult | null> => {
94
99
  setChecking(true);
95
100
  setError(null);
96
101
 
@@ -100,9 +105,12 @@ export function useUpdates(options: UseUpdatesOptions = {}): UseUpdatesResult {
100
105
  if (!response.ok) {
101
106
  throw new Error(responseMessage(payload, `Update check failed (HTTP ${response.status})`));
102
107
  }
103
- setInfo(payload as UpdateCheckResult);
108
+ const result = payload as UpdateCheckResult;
109
+ setInfo(result);
110
+ return result;
104
111
  } catch (cause) {
105
112
  setError(cause instanceof Error ? cause.message : 'Unable to check for updates.');
113
+ return null;
106
114
  } finally {
107
115
  setChecking(false);
108
116
  inFlightCheckRef.current = null;
@@ -0,0 +1,155 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The phone's right-click: a long press opens the same visibility menu the
8
+ * desktop rails and navbar open on `contextmenu`.
9
+ *
10
+ * Four rules, each a way the gesture would otherwise misbehave:
11
+ *
12
+ * 1. **A right-click still works.** A desktop showing the phone layout keeps
13
+ * the menu it had, anchored to the surface rather than to the pixel.
14
+ * 2. **A hold opens at the press point.** There is no cursor to anchor to.
15
+ * 3. **The click the same gesture produces is swallowed.** Lifting the finger
16
+ * after the menu opened must not also press the control underneath.
17
+ * 4. **A press that moves is a scroll.** The surface is a scroller on a phone;
18
+ * a flick that starts on it must not open a menu.
19
+ */
20
+
21
+ import { afterEach, beforeEach, describe, expect, test, vi } from 'bun:test';
22
+ import { Window } from 'happy-dom';
23
+ import { h, render } from 'preact';
24
+ import { act } from 'preact/test-utils';
25
+ import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
26
+ import {
27
+ useVisibilityMenuTrigger,
28
+ type VisibilityMenuTrigger,
29
+ } from '@/client/hooks/ui/visibility-menu-trigger';
30
+
31
+ let win: Window;
32
+ let container: HTMLElement;
33
+ let trigger: VisibilityMenuTrigger | null = null;
34
+ let clicks = 0;
35
+
36
+ beforeEach(() => {
37
+ vi.useFakeTimers();
38
+ win = new Window({ url: 'http://localhost' });
39
+ installDomGlobals(win);
40
+ container = document.createElement('div');
41
+ document.body.appendChild(container);
42
+ trigger = null;
43
+ clicks = 0;
44
+ });
45
+
46
+ afterEach(() => {
47
+ render(null, container);
48
+ container.remove();
49
+ restoreDomGlobals();
50
+ vi.useRealTimers();
51
+ });
52
+
53
+ /** Mount the hook on a surface with one child control. */
54
+ async function mount(coarse: boolean): Promise<void> {
55
+ win.matchMedia = ((query: string) => ({
56
+ matches: coarse && query === '(pointer: coarse)',
57
+ media: query,
58
+ onchange: null,
59
+ addEventListener: () => {},
60
+ removeEventListener: () => {},
61
+ addListener: () => {},
62
+ removeListener: () => {},
63
+ dispatchEvent: () => false,
64
+ })) as unknown as typeof win.matchMedia;
65
+
66
+ const Probe = () => {
67
+ trigger = useVisibilityMenuTrigger();
68
+ return h(
69
+ 'div',
70
+ { 'data-testid': 'surface', ...trigger.surfaceProps },
71
+ h('button', { 'data-testid': 'child', onClick: () => { clicks += 1; } }, 'child'),
72
+ );
73
+ };
74
+ await act(async () => {
75
+ render(h(Probe, {}), container);
76
+ });
77
+ }
78
+
79
+ /** A touch event carrying one finger at `(x, y)`. */
80
+ function touch(type: string, x: number, y: number): globalThis.TouchEvent {
81
+ const event = new win.Event(type, { bubbles: true, cancelable: true }) as unknown as globalThis.TouchEvent;
82
+ Object.defineProperty(event, 'touches', {
83
+ value: type === 'touchend' || type === 'touchcancel' ? [] : [{ clientX: x, clientY: y }],
84
+ });
85
+ return event;
86
+ }
87
+
88
+ describe('useVisibilityMenuTrigger', () => {
89
+ test('a right-click anchors the menu to the surface', async () => {
90
+ await mount(false);
91
+ (container.querySelector('[data-testid="surface"]') as HTMLElement).getBoundingClientRect = () => ({
92
+ top: 10, bottom: 50, left: 20, right: 120, width: 100, height: 40, x: 20, y: 10,
93
+ toJSON: () => ({}),
94
+ });
95
+
96
+ act(() => {
97
+ (container.querySelector('[data-testid="surface"]') as HTMLElement).dispatchEvent(new win.MouseEvent('contextmenu', { bubbles: true, cancelable: true }) as unknown as Event);
98
+ });
99
+
100
+ expect(trigger!.anchor).toEqual({ top: 10, bottom: 50, left: 20, right: 120 });
101
+ });
102
+
103
+ test('a hold opens the menu at the press point and swallows the click', async () => {
104
+ await mount(true);
105
+
106
+ act(() => {
107
+ (container.querySelector('[data-testid="surface"]') as HTMLElement).dispatchEvent(touch('touchstart', 30, 40));
108
+ });
109
+ await act(async () => {
110
+ vi.advanceTimersByTime(450);
111
+ });
112
+
113
+ expect(trigger!.anchor).toEqual({ top: 40, bottom: 40, left: 30, right: 30 });
114
+
115
+ act(() => {
116
+ (container.querySelector('[data-testid="child"]') as HTMLElement).dispatchEvent(new win.MouseEvent('click', { bubbles: true, cancelable: true }) as unknown as Event);
117
+ });
118
+ expect(clicks).toBe(0);
119
+
120
+ // The suppression is one-shot: the next tap is the user's own.
121
+ act(() => {
122
+ (container.querySelector('[data-testid="child"]') as HTMLElement).dispatchEvent(new win.MouseEvent('click', { bubbles: true, cancelable: true }) as unknown as Event);
123
+ });
124
+ expect(clicks).toBe(1);
125
+ });
126
+
127
+ test('a press that moves is a scroll, not a menu', async () => {
128
+ await mount(true);
129
+
130
+ act(() => {
131
+ (container.querySelector('[data-testid="surface"]') as HTMLElement).dispatchEvent(touch('touchstart', 30, 40));
132
+ });
133
+ act(() => {
134
+ (container.querySelector('[data-testid="surface"]') as HTMLElement).dispatchEvent(touch('touchmove', 60, 40));
135
+ });
136
+ await act(async () => {
137
+ vi.advanceTimersByTime(450);
138
+ });
139
+
140
+ expect(trigger!.anchor).toBeNull();
141
+ });
142
+
143
+ test('a mouse hold does not open the menu', async () => {
144
+ await mount(false);
145
+
146
+ act(() => {
147
+ (container.querySelector('[data-testid="surface"]') as HTMLElement).dispatchEvent(touch('touchstart', 30, 40));
148
+ });
149
+ await act(async () => {
150
+ vi.advanceTimersByTime(450);
151
+ });
152
+
153
+ expect(trigger!.anchor).toBeNull();
154
+ });
155
+ });
@@ -0,0 +1,85 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The right-click menu, for a surface a finger has to reach.
8
+ *
9
+ * The desktop rails and navbar open their visibility menu on `contextmenu`.
10
+ * A phone has no right button, so the same menu was unreachable there: the
11
+ * phone's header, session drawer and right drawer drew the controls but had no
12
+ * way to switch one off. A long press is the phone's right-click, and this hook
13
+ * is the one place that turns it into the same `MenuAnchor` the desktop
14
+ * handlers produce.
15
+ *
16
+ * Three rules, each a way the gesture would otherwise misbehave:
17
+ *
18
+ * - **A press that MOVES is a scroll.** `useLongPress` owns that rule; this
19
+ * hook only decides what a completed press opens.
20
+ * - **The click the same gesture produces is swallowed.** Lifting the finger
21
+ * after the menu opened would otherwise also press the control underneath
22
+ * (close the drawer, switch a panel). The capture handler consumes it before
23
+ * the control's own `onClick` runs.
24
+ * - **A mouse still gets its right button.** `contextmenu` is handled on every
25
+ * device, so a desktop showing the phone layout keeps the menu it had.
26
+ *
27
+ * The anchor is the surface's own rectangle for a right-click (the menu hangs
28
+ * off the rail, not off the pixel) and the press point for a long press (there
29
+ * is no cursor to anchor to).
30
+ */
31
+
32
+ import { useCallback, useState } from 'preact/hooks';
33
+ import type { TargetedMouseEvent } from 'preact';
34
+ import { useLongPress } from '@/client/hooks/ui/long-press';
35
+ import { useTouchDevice } from '@/client/hooks/ui/touch-device';
36
+ import type { MenuAnchor } from '@/client/components/layout/VisibilityMenu';
37
+
38
+ /** The handlers a surface spreads onto the element that owns the menu. */
39
+ export interface VisibilityMenuSurfaceProps {
40
+ onContextMenu: (event: TargetedMouseEvent<HTMLElement>) => void;
41
+ onTouchStart: (event: globalThis.TouchEvent) => void;
42
+ onTouchMove: (event: globalThis.TouchEvent) => void;
43
+ onTouchEnd: () => void;
44
+ onTouchCancel: () => void;
45
+ onClickCapture: (event: TargetedMouseEvent<HTMLElement>) => void;
46
+ }
47
+
48
+ export interface VisibilityMenuTrigger {
49
+ /** Non-null while the menu is open. */
50
+ anchor: MenuAnchor | null;
51
+ close: () => void;
52
+ surfaceProps: VisibilityMenuSurfaceProps;
53
+ }
54
+
55
+ export function useVisibilityMenuTrigger(): VisibilityMenuTrigger {
56
+ const touch = useTouchDevice();
57
+ const [anchor, setAnchor] = useState<MenuAnchor | null>(null);
58
+
59
+ const openAt = useCallback((x: number, y: number) => {
60
+ setAnchor({ top: y, bottom: y, left: x, right: x });
61
+ }, []);
62
+ const longPress = useLongPress({ enabled: touch, onLongPress: openAt });
63
+ const close = useCallback(() => setAnchor(null), []);
64
+
65
+ return {
66
+ anchor,
67
+ close,
68
+ surfaceProps: {
69
+ onContextMenu: (event) => {
70
+ event.preventDefault();
71
+ const rect = event.currentTarget.getBoundingClientRect();
72
+ setAnchor({ top: rect.top, bottom: rect.bottom, left: rect.left, right: rect.right });
73
+ },
74
+ onTouchStart: longPress.onTouchStart,
75
+ onTouchMove: longPress.onTouchMove,
76
+ onTouchEnd: longPress.onTouchEnd,
77
+ onTouchCancel: longPress.onTouchCancel,
78
+ onClickCapture: (event) => {
79
+ if (!longPress.consume()) return;
80
+ event.preventDefault();
81
+ event.stopPropagation();
82
+ },
83
+ },
84
+ };
85
+ }
@@ -0,0 +1,50 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The panel switch a rail opens on right-click — or on a long press, on a
8
+ * phone.
9
+ *
10
+ * The desktop rails and the phone drawers ask the same three questions: which
11
+ * panels can this surface offer, which of them are switched off, and where does
12
+ * the menu hang. Answering them in one hook is what keeps the phone's menu and
13
+ * the desktop rail's menu from drifting: a panel hidden on one surface is the
14
+ * same `disabledPanels` entry, and the list is the same `useAllPanelItems`
15
+ * read, so a view cannot be switchable in one place and lost in the other.
16
+ *
17
+ * The surface handlers come from `useVisibilityMenuTrigger`, which owns the
18
+ * long-press/right-click split; this hook only adds the panel data.
19
+ */
20
+
21
+ import { useCallback } from 'preact/hooks';
22
+ import { useAllPanelItems } from '@/client/hooks/workspace/panel-menu-items';
23
+ import { usePanelPluginActions, usePanelRegistry } from '@/client/hooks/workspace/panel-registry';
24
+ import { useVisibilityMenuTrigger } from '@/client/hooks/ui/visibility-menu-trigger';
25
+ import type { PanelCatalogSide } from '@/client/components/workspace/plugin-panel/catalog';
26
+ import type { MenuAnchor, VisibilityItem } from '@/client/components/layout/VisibilityMenu';
27
+ import type { VisibilityMenuSurfaceProps } from '@/client/hooks/ui/visibility-menu-trigger';
28
+
29
+ export interface PanelVisibilityMenu {
30
+ anchor: MenuAnchor | null;
31
+ close: () => void;
32
+ surfaceProps: VisibilityMenuSurfaceProps;
33
+ items: VisibilityItem[];
34
+ hidden: string[];
35
+ toggle: (id: string, visible: boolean) => void;
36
+ }
37
+
38
+ export function usePanelVisibilityMenu(side: PanelCatalogSide): PanelVisibilityMenu {
39
+ const { disabledPanels } = usePanelRegistry();
40
+ const { setEnabled } = usePanelPluginActions();
41
+ const visibility = useVisibilityMenuTrigger();
42
+ const items = useAllPanelItems(side);
43
+ const toggle = useCallback(
44
+ (id: string, visible: boolean) => {
45
+ void setEnabled(id, visible);
46
+ },
47
+ [setEnabled],
48
+ );
49
+ return { ...visibility, items, hidden: disabledPanels, toggle };
50
+ }
@@ -0,0 +1,95 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * `window.__kabmoRunCommand` — the native menu's only route into the catalog.
8
+ *
9
+ * A menu row carries no key equivalent, so this property is what makes the row
10
+ * do anything at all. The cases are the ways it can lie: installed but not
11
+ * callable, callable but running the wrong id, and answering `true` for a command
12
+ * nothing registered (which would make a dead menu row look alive).
13
+ *
14
+ * Runs against a real DOM (happy-dom) because the transport IS a `window`
15
+ * property; the registry is global on `globalThis`, as it is in the app.
16
+ */
17
+
18
+ import { afterAll, beforeAll, beforeEach, describe, expect, test } from 'bun:test';
19
+ import { Window } from 'happy-dom';
20
+
21
+ import { RUN_COMMAND_PROPERTY, dispatchRunCommand, installCommandRunner } from '@/client/lib/native/run-command';
22
+ import { registerCommand } from '@/client/lib/commands/registry';
23
+
24
+ const displaced: Record<string, unknown> = {};
25
+ let dom: Window;
26
+
27
+ beforeAll(() => {
28
+ for (const key of ['window', 'document'] as const) displaced[key] = (globalThis as Record<string, unknown>)[key];
29
+ dom = new Window({ url: 'http://127.0.0.1:3000/' });
30
+ (globalThis as Record<string, unknown>).window = dom;
31
+ (globalThis as Record<string, unknown>).document = dom.document;
32
+ });
33
+
34
+ afterAll(() => {
35
+ for (const [key, value] of Object.entries(displaced)) {
36
+ if (value === undefined) delete (globalThis as Record<string, unknown>)[key];
37
+ else (globalThis as Record<string, unknown>)[key] = value;
38
+ }
39
+ });
40
+
41
+ function transport(): ((id: unknown, args?: unknown) => boolean) | undefined {
42
+ const callable = (window as unknown as Record<string, unknown>)[RUN_COMMAND_PROPERTY];
43
+ return typeof callable === 'function' ? (callable as (id: unknown, args?: unknown) => boolean) : undefined;
44
+ }
45
+
46
+ let dispose: (() => void) | null = null;
47
+
48
+ beforeEach(() => {
49
+ dispose?.();
50
+ dispose = null;
51
+ });
52
+
53
+ describe('__kabmoRunCommand', () => {
54
+ test('the installer publishes a callable property', () => {
55
+ installCommandRunner();
56
+ expect(transport()).toBeFunction();
57
+ });
58
+
59
+ test('a registered command runs with the shell\'s arguments', () => {
60
+ installCommandRunner();
61
+ const calls: unknown[] = [];
62
+ dispose = registerCommand('test.native-command', (args) => { calls.push(args); });
63
+
64
+ expect(transport()?.('test.native-command', { pick: 'worktree' })).toBe(true);
65
+ expect(calls).toEqual([{ pick: 'worktree' }]);
66
+ });
67
+
68
+ test('an unregistered id answers false instead of throwing', () => {
69
+ installCommandRunner();
70
+ expect(transport()?.('workspace.not-a-command')).toBe(false);
71
+ });
72
+
73
+ test('a missing or blank id is refused', () => {
74
+ installCommandRunner();
75
+ expect(transport()?.(undefined)).toBe(false);
76
+ expect(transport()?.(42)).toBe(false);
77
+ expect(transport()?.(' ')).toBe(false);
78
+ });
79
+
80
+ test('the exported dispatcher is the same contract', () => {
81
+ let runs = 0;
82
+ dispose = registerCommand('test.direct', () => { runs += 1; });
83
+ expect(dispatchRunCommand('test.direct')).toBe(true);
84
+ expect(runs).toBe(1);
85
+ });
86
+
87
+ test('a re-install replaces the property rather than stacking', () => {
88
+ installCommandRunner();
89
+ const first = transport();
90
+ installCommandRunner();
91
+ expect(transport()).toBeFunction();
92
+ // Both installs point at the same function, so a second one cannot double-run.
93
+ expect(transport()).toBe(first);
94
+ });
95
+ });
@@ -0,0 +1,52 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The console's command catalog, published for the NATIVE shell that hosts it.
8
+ *
9
+ * A shell's menu bar can only report a click; every command it would offer lives
10
+ * in the page (`shared/lib/commands/catalog.ts`), because that is the one place
11
+ * a chord, a title and a `when` condition are stated. Duplicating those rows
12
+ * natively would be a second source of truth that drifts — and a native row that
13
+ * also DECLARED a key equivalent would steal the chord from the page's own
14
+ * dispatcher before it ever saw the keystroke.
15
+ *
16
+ * So the menu row carries no chord and asks here instead:
17
+ *
18
+ * window.__kabmoRunCommand('workspace.toggleSidebar')
19
+ *
20
+ * The same indirection as `__kabmoBack`, `__kabmoResume` and `__kabmoOpenPaths`
21
+ * — the page owns the state and the catalog, the shell only knows the moment.
22
+ * Installed unconditionally: inert in a browser (nothing calls it), and gating on
23
+ * a user agent would be a second place that has to know which shells exist.
24
+ *
25
+ * A command that is not registered answers `false` rather than throwing: a menu
26
+ * row is not a place to surface `command "…" is already registered`, and the
27
+ * shell's caller can decide to stay quiet.
28
+ */
29
+
30
+ import { runCommand } from '@/client/lib/commands/registry';
31
+
32
+ /** The property a shell calls. Named once so both sides agree. */
33
+ export const RUN_COMMAND_PROPERTY = '__kabmoRunCommand';
34
+
35
+ /**
36
+ * Run one catalog command by id, with optional arguments.
37
+ *
38
+ * Exported for tests and for any in-page caller that wants the same contract
39
+ * without the global — the property is only the transport.
40
+ */
41
+ export function dispatchRunCommand(id: unknown, args?: unknown): boolean {
42
+ if (typeof id !== 'string') return false;
43
+ const command = id.trim();
44
+ if (!command) return false;
45
+ return runCommand(command, args);
46
+ }
47
+
48
+ /** Install `window.__kabmoRunCommand`. Idempotent — a hot reload re-runs it. */
49
+ export function installCommandRunner(): void {
50
+ if (typeof window === 'undefined') return;
51
+ (window as unknown as Record<string, unknown>)[RUN_COMMAND_PROPERTY] = dispatchRunCommand;
52
+ }
@@ -15,7 +15,7 @@
15
15
  import { afterAll, afterEach, beforeAll, describe, expect, test } from 'bun:test';
16
16
  import { Window } from 'happy-dom';
17
17
 
18
- import { openSessionInUrl } from '@/client/lib/router/open-session';
18
+ import { openEmptyWorkspace, openSessionInUrl } from '@/client/lib/router/open-session';
19
19
  import { installOpenSessionDispatcher } from '@/client/lib/native/open-session';
20
20
  import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
21
21
 
@@ -65,6 +65,31 @@ describe('openSessionInUrl', () => {
65
65
  });
66
66
  });
67
67
 
68
+ describe('openEmptyWorkspace', () => {
69
+ test('clears every routing parameter', () => {
70
+ go('?folderId=3&sessionId=old&subagent=9');
71
+ expect(openEmptyWorkspace()).toBe(true);
72
+ expect(window.location.search).toBe('');
73
+ });
74
+
75
+ test('tells the router the URL moved', () => {
76
+ go('?sessionId=old');
77
+ let events = 0;
78
+ const listener = () => { events += 1; };
79
+ window.addEventListener('popstate', listener);
80
+ openEmptyWorkspace();
81
+ window.removeEventListener('popstate', listener);
82
+ expect(events).toBe(1);
83
+ });
84
+
85
+ test('keeps the path and the hash', () => {
86
+ window.history.replaceState(null, '', '/workspace?sessionId=old#timeline');
87
+ openEmptyWorkspace();
88
+ expect(window.location.pathname).toBe('/workspace');
89
+ expect(window.location.hash).toBe('#timeline');
90
+ });
91
+ });
92
+
68
93
  describe('window.__kabmoOpenSession', () => {
69
94
  test('the installed dispatcher is the same navigation', () => {
70
95
  installOpenSessionDispatcher();
@@ -32,3 +32,24 @@ export function openSessionInUrl(sessionId: string): boolean {
32
32
  window.dispatchEvent(new Event('popstate'));
33
33
  return true;
34
34
  }
35
+
36
+ /**
37
+ * Clear the routing state, which is the sidebar's own "New Session".
38
+ *
39
+ * The sidebar's primary action opens the EMPTY WORKSPACE — the landing, with no
40
+ * query at all — rather than minting a pending chat (see `SessionsView`). A
41
+ * native menu row and the command palette need the same move without a component
42
+ * to call `setSearchParams` from, so it lives here beside the session opener and
43
+ * writes through the same store.
44
+ */
45
+ export function openEmptyWorkspace(options: { replace?: boolean } = {}): boolean {
46
+ if (typeof window === 'undefined') return false;
47
+ const url = new URL(window.location.href);
48
+ url.search = '';
49
+ // The sidebar's own button replaces the history entry (a New Session press is
50
+ // not a place to go Back to); the option keeps the two callers identical.
51
+ if (options.replace) window.history.replaceState(null, '', url);
52
+ else window.history.pushState(null, '', url);
53
+ window.dispatchEvent(new Event('popstate'));
54
+ return true;
55
+ }