@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
@@ -16,34 +16,32 @@
16
16
  * two mounts pin both spellings, and that the footer lands once the run ends.
17
17
  */
18
18
 
19
- import { afterAll, beforeAll, describe, expect, test } from 'bun:test';
19
+ import { afterAll, afterEach, beforeAll, describe, expect, test } from 'bun:test';
20
20
  import { Window } from 'happy-dom';
21
21
  import { h, render } from 'preact';
22
22
  import { act } from 'preact/test-utils';
23
23
  import { MessageList } from '@/client/components/workspace/chat-timeline/MessageList';
24
+ import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
24
25
  import type { ChatMessageData } from '@/shared/types';
25
26
 
26
27
  let container: HTMLElement;
27
-
28
- const DOM_GLOBALS = ['window', 'document', 'navigator', 'Node', 'Element', 'HTMLElement', 'HTMLInputElement', 'Event', 'MouseEvent', 'KeyboardEvent'] as const;
29
- /** The runner's own globals, restored on teardown — deleting them would strip natives (Event/CustomEvent) every later file needs. */const nativeGlobals: Partial<Record<(typeof DOM_GLOBALS)[number], unknown>> = {};
30
-
31
- beforeAll(() => {
32
- const win = new Window({ url: 'http://localhost' });
33
- const target = globalThis as unknown as Record<string, unknown>;
34
- for (const key of DOM_GLOBALS) {
35
- if (!(key in nativeGlobals)) nativeGlobals[key] = target[key];
36
- target[key] = (win as unknown as Record<string, unknown>)[key];
37
- }
28
+ /** Every tree this file mounted; unmounted before the window goes away. */
29
+ const mounted: HTMLElement[] = [];
30
+
31
+ beforeAll(() => installDomGlobals(new Window({ url: 'http://localhost' })));
32
+
33
+ afterEach(() => {
34
+ // UNMOUNT, not detach: `MessageList` draws `AiMessageFooter`, whose plugin
35
+ // strip subscribes to the list-slot store. A tree left mounted re-renders on
36
+ // that store's next publish — which happens in a LATER file, after
37
+ // `restoreDomGlobals` deleted `document`, and surfaces there as
38
+ // `ReferenceError: document is not defined` in `list-slots.test.ts` on the
39
+ // Windows shard. A detached container is enough for the assertions, but the
40
+ // subscription outlives it.
41
+ for (const node of mounted.splice(0)) render(null, node);
38
42
  });
39
43
 
40
- afterAll(() => {
41
- const target = globalThis as unknown as Record<string, unknown>;
42
- for (const key of DOM_GLOBALS) {
43
- if (nativeGlobals[key] === undefined) delete target[key];
44
- else target[key] = nativeGlobals[key];
45
- }
46
- });
44
+ afterAll(() => restoreDomGlobals());
47
45
 
48
46
  const user = (id: string): ChatMessageData => ({ id, role: 'user', content: 'yo' });
49
47
  const ai = (id: string): ChatMessageData => ({ id, role: 'ai', content: 'hi' });
@@ -53,6 +51,7 @@ const committed = (id: string): ChatMessageData => ({ id, role: 'assistant', con
53
51
  async function mount(messages: ChatMessageData[], isGenerating: boolean): Promise<HTMLElement> {
54
52
  container = document.createElement('div');
55
53
  document.body.appendChild(container);
54
+ mounted.push(container);
56
55
  await act(async () => {
57
56
  render(h(MessageList, { messages, isGenerating }), container);
58
57
  });
@@ -97,6 +96,7 @@ describe('MessageList mounted window', () => {
97
96
  async function mountWindowed(messages: ChatMessageData[], rowWindow: ReturnType<typeof window>): Promise<HTMLElement> {
98
97
  container = document.createElement('div');
99
98
  document.body.appendChild(container);
99
+ mounted.push(container);
100
100
  await act(async () => {
101
101
  render(h(MessageList, { messages, isGenerating: false, rowWindow }), container);
102
102
  });
@@ -81,6 +81,27 @@ describe('commit modal header', () => {
81
81
  expect(graph.querySelector('button[aria-label="Graph view"]')?.getAttribute('aria-pressed')).toBe('true');
82
82
  });
83
83
 
84
+ test('the phone drops the rect around the three header controls', async () => {
85
+ const el = await mount(false);
86
+ const switcher = el.querySelector('button[aria-label="History view"]')?.parentElement;
87
+
88
+ // The segmented-control plate and the refresh border are desktop-only: on
89
+ // the phone the row is icon-only, and only the active tab keeps a rect.
90
+ expect(switcher?.classList.contains('bg-ink/5')).toBe(false);
91
+ expect(switcher?.classList.contains('border')).toBe(false);
92
+ expect(switcher?.classList.contains('lg:bg-ink/5')).toBe(true);
93
+
94
+ const active = el.querySelector('button[aria-label="History view"]');
95
+ expect(active?.classList.contains('bg-ink/5')).toBe(true);
96
+ // Centred, so the glyph sits in the middle of the active rect instead of
97
+ // being pushed left by the (hidden) label's padding.
98
+ expect(active?.classList.contains('justify-center')).toBe(true);
99
+
100
+ const refresh = el.querySelector('button[aria-label="Refresh commit history"]');
101
+ expect(refresh?.classList.contains('border')).toBe(false);
102
+ expect(refresh?.classList.contains('lg:border')).toBe(true);
103
+ });
104
+
84
105
  test('the filter and the close control have accessible names', async () => {
85
106
  const el = await mount(false);
86
107
  expect(el.querySelector('input[aria-label="Filter commits"]')).toBeTruthy();
@@ -67,18 +67,22 @@ export function Header({
67
67
 
68
68
  {/* Action Controls on the Right */}
69
69
  <div className="flex items-center gap-1.5 lg:gap-2 flex-shrink-0">
70
- {/* Mode Switcher */}
71
- <div className="flex items-center bg-ink/5 p-0.5 rounded-lg border border-ink/10 text-xs">
70
+ {/* Mode Switcher. The phone drops the segmented-control plate: three
71
+ icon-only controls in a row read as one cluster, and the plate
72
+ plus the refresh border made them look like three separate
73
+ widgets. The active tab keeps its own rect, with the glyph
74
+ centred in it. */}
75
+ <div className="flex items-center text-xs lg:bg-ink/5 lg:p-0.5 lg:rounded-lg lg:border lg:border-ink/10">
72
76
  <button
73
77
  type="button"
74
78
  onClick={() => onToggleMode(false)}
75
79
  title="History view"
76
80
  aria-label="History view"
77
81
  aria-pressed={!isGraphMode}
78
- className={`tap-target flex items-center gap-1.5 px-2.5 py-1 rounded-md font-medium transition-colors cursor-pointer ${
82
+ className={`tap-target flex items-center justify-center gap-1.5 p-2 rounded-md font-medium transition-colors cursor-pointer lg:px-2.5 lg:py-1 ${
79
83
  !isGraphMode
80
- ? 'bg-paper text-ink shadow-xs'
81
- : 'text-ink/80 hover:text-ink hover:bg-ink/5'
84
+ ? 'bg-ink/5 text-ink lg:bg-paper lg:shadow-xs'
85
+ : 'text-ink/80 lg:hover:text-ink lg:hover:bg-ink/5'
82
86
  }`}
83
87
  >
84
88
  <History size={13} aria-hidden="true" />
@@ -90,10 +94,10 @@ export function Header({
90
94
  title="Graph view"
91
95
  aria-label="Graph view"
92
96
  aria-pressed={isGraphMode}
93
- className={`tap-target flex items-center gap-1.5 px-2.5 py-1 rounded-md font-medium transition-colors cursor-pointer ${
97
+ className={`tap-target flex items-center justify-center gap-1.5 p-2 rounded-md font-medium transition-colors cursor-pointer lg:px-2.5 lg:py-1 ${
94
98
  isGraphMode
95
- ? 'bg-paper text-ink shadow-xs'
96
- : 'text-ink/80 hover:text-ink hover:bg-ink/5'
99
+ ? 'bg-ink/5 text-ink lg:bg-paper lg:shadow-xs'
100
+ : 'text-ink/80 lg:hover:text-ink lg:hover:bg-ink/5'
97
101
  }`}
98
102
  >
99
103
  <GitMerge size={13} aria-hidden="true" />
@@ -106,7 +110,7 @@ export function Header({
106
110
  type="button"
107
111
  onClick={onRefresh}
108
112
  disabled={isRefreshing}
109
- className="tap-target flex items-center gap-1.5 px-2.5 py-1.5 rounded-md border border-ink/15 hover:bg-ink/5 text-ink/70 hover:text-ink transition-colors cursor-pointer text-xs disabled:opacity-40"
113
+ className="tap-target flex items-center justify-center gap-1.5 p-2 rounded-md text-ink/70 transition-colors cursor-pointer text-xs disabled:opacity-40 lg:px-2.5 lg:py-1.5 lg:border lg:border-ink/15 lg:hover:bg-ink/5 lg:hover:text-ink"
110
114
  title="Refresh commit history"
111
115
  aria-label="Refresh commit history"
112
116
  >
@@ -0,0 +1,121 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The device split in the terminal's focus target.
8
+ *
9
+ * A phone types into the renderer's textarea (`beforeinput`); a hardware
10
+ * keyboard types into the container (`keydown`). Focusing the container on a
11
+ * phone is what left the keyboard closed and the first characters swallowed, so
12
+ * the two branches are pinned here — including the redirect that survives
13
+ * ghostty's own delayed container focus.
14
+ */
15
+
16
+ import { afterAll, afterEach, beforeAll, describe, expect, test } from 'bun:test';
17
+ import { Window } from 'happy-dom';
18
+ import type { Terminal } from 'ghostty-web';
19
+ import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
20
+ import {
21
+ focusTerminal,
22
+ focusTerminalTextarea,
23
+ redirectSoftKeyboardFocus,
24
+ } from '@/client/components/workspace/terminal-panel/focus-target';
25
+
26
+ let win: Window;
27
+ let container: HTMLDivElement;
28
+ let textarea: HTMLTextAreaElement;
29
+ let containerFocuses = 0;
30
+
31
+ function setSoftKeyboardDevice(value: boolean): void {
32
+ win.matchMedia = ((query: string) => ({
33
+ matches: value && query === '(pointer: coarse)',
34
+ media: query,
35
+ onchange: null,
36
+ addListener() {},
37
+ removeListener() {},
38
+ addEventListener() {},
39
+ removeEventListener() {},
40
+ dispatchEvent: () => false,
41
+ })) as unknown as typeof win.matchMedia;
42
+ Object.defineProperty(win.navigator, 'maxTouchPoints', { value: 0, configurable: true });
43
+ }
44
+
45
+ function fakeTerminal(): Terminal {
46
+ return {
47
+ textarea,
48
+ focus() {
49
+ containerFocuses += 1;
50
+ container.focus();
51
+ },
52
+ } as unknown as Terminal;
53
+ }
54
+
55
+ beforeAll(() => {
56
+ win = new Window({ url: 'http://localhost' });
57
+ installDomGlobals(win);
58
+ });
59
+
60
+ afterEach(() => {
61
+ document.body.innerHTML = '';
62
+ containerFocuses = 0;
63
+ });
64
+
65
+ afterAll(() => {
66
+ restoreDomGlobals();
67
+ });
68
+
69
+ function mount(): void {
70
+ container = document.createElement('div');
71
+ container.tabIndex = 0;
72
+ textarea = document.createElement('textarea');
73
+ container.appendChild(textarea);
74
+ document.body.appendChild(container);
75
+ }
76
+
77
+ describe('terminal focus target', () => {
78
+ test('a phone focuses the textarea, not the container', () => {
79
+ mount();
80
+ setSoftKeyboardDevice(true);
81
+ focusTerminal(fakeTerminal());
82
+ expect(document.activeElement).toBe(textarea);
83
+ expect(containerFocuses).toBe(0);
84
+ });
85
+
86
+ test('a hardware keyboard focuses the container', () => {
87
+ mount();
88
+ setSoftKeyboardDevice(false);
89
+ focusTerminal(fakeTerminal());
90
+ expect(document.activeElement).toBe(container);
91
+ expect(containerFocuses).toBe(1);
92
+ });
93
+
94
+ test('the textarea helper is a no-op on a desktop', () => {
95
+ mount();
96
+ setSoftKeyboardDevice(false);
97
+ focusTerminalTextarea(fakeTerminal());
98
+ expect(document.activeElement).not.toBe(textarea);
99
+ });
100
+
101
+ test('a phone redirects the container focus ghostty schedules after open', () => {
102
+ mount();
103
+ setSoftKeyboardDevice(true);
104
+ const stop = redirectSoftKeyboardFocus(container, fakeTerminal());
105
+ container.focus();
106
+ expect(document.activeElement).toBe(textarea);
107
+ stop();
108
+ textarea.blur();
109
+ container.focus();
110
+ expect(document.activeElement).toBe(container);
111
+ });
112
+
113
+ test('a desktop keeps the container focus', () => {
114
+ mount();
115
+ setSoftKeyboardDevice(false);
116
+ const stop = redirectSoftKeyboardFocus(container, fakeTerminal());
117
+ container.focus();
118
+ expect(document.activeElement).toBe(container);
119
+ stop();
120
+ });
121
+ });
@@ -0,0 +1,54 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * Which element takes the terminal's focus, per device.
8
+ *
9
+ * ghostty-web focuses its CONTAINER (`tabindex=0`, `contenteditable`), which is
10
+ * the hardware-keyboard surface: its `keydown` listener is what encodes a
11
+ * physical key. A phone's input arrives as `beforeinput` on the renderer's
12
+ * textarea instead, and only an editable element that is focused can open the
13
+ * soft keyboard — focusing the container there left the keyboard closed and the
14
+ * panel needing a tap before it accepted a character.
15
+ *
16
+ * The second half is a race the vendor creates: `Terminal.open()` ends with
17
+ * `focus()`, and `Terminal.focus()` focuses the container and then focuses it
18
+ * AGAIN on a 0 ms timer. Focusing the textarea after `open()` therefore lost to
19
+ * that timer one tick later — measured on the phone layout: the textarea held
20
+ * focus at mount and the container owned it 12 ms after. A `focusin` redirect is
21
+ * event-driven, so it survives the timer and any later internal `focus()`;
22
+ * keydown still reaches the container because the textarea is its child.
23
+ */
24
+
25
+ import type { Terminal } from 'ghostty-web';
26
+ import { isSoftKeyboardDevice } from '@/client/hooks/ui/touch-device';
27
+
28
+ /** Focus whatever this device types into. */
29
+ export function focusTerminal(term: Terminal): void {
30
+ if (isSoftKeyboardDevice() && term.textarea) term.textarea.focus();
31
+ else term.focus();
32
+ }
33
+
34
+ /**
35
+ * Move the textarea's keyboard focus onto the terminal on a phone.
36
+ *
37
+ * A no-op on a desktop, where the container is the correct target and the
38
+ * padding click's caret behaviour is pinned by `terminal.e2e.ts`.
39
+ */
40
+ export function focusTerminalTextarea(term: Terminal): void {
41
+ if (isSoftKeyboardDevice()) term.textarea?.focus();
42
+ }
43
+
44
+ /**
45
+ * Keep a soft-keyboard device's focus on the textarea. Returns the disposer.
46
+ */
47
+ export function redirectSoftKeyboardFocus(container: HTMLElement, term: Terminal): () => void {
48
+ const redirect = (event: FocusEvent) => {
49
+ if (event.target !== container || !isSoftKeyboardDevice()) return;
50
+ term.textarea?.focus();
51
+ };
52
+ container.addEventListener('focusin', redirect);
53
+ return () => container.removeEventListener('focusin', redirect);
54
+ }
@@ -9,6 +9,7 @@ import { TerminalHeader } from '@/client/components/workspace/terminal-panel/Hea
9
9
  import { TerminalQuickActions } from '@/client/components/workspace/terminal-panel/QuickActions';
10
10
  import { TerminalKeyBar } from '@/client/components/workspace/terminal-panel/KeyBar';
11
11
  import { RealtimeTerminalView, type RealtimeTerminalHandle } from '@/client/components/workspace/terminal-panel/RealtimeTerminalView';
12
+ import { releaseSoftKeyboard } from '@/client/lib/ui/soft-keyboard';
12
13
  import {
13
14
  NO_MODIFIERS,
14
15
  applyModifiers,
@@ -62,7 +63,12 @@ export function TerminalPanel({ className = '', enabled = true, rootPath, showHe
62
63
  * renderer's async mount (`focus.ts`).
63
64
  */
64
65
  useEffect(() => {
65
- if (!active || !enabled) return;
66
+ if (!active || !enabled) {
67
+ // The drawer armed the keyboard for a terminal that will not take focus
68
+ // (no workspace, a hidden view); do not leave it up over the placeholder.
69
+ releaseSoftKeyboard();
70
+ return;
71
+ }
66
72
  terminalRef.current?.focus();
67
73
  }, [active, enabled]);
68
74
 
@@ -0,0 +1,82 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * One ghostty-web terminal and the addons bound to it.
8
+ *
9
+ * Split from `mount.ts` so the mount lifecycle (import, observers, replay,
10
+ * focus) stays readable and this file owns only "make a terminal, wire it, tear
11
+ * it down". The caller supplies `wire` because the event handlers it installs
12
+ * close over the mount's own state (the replay gate, the grid announcer).
13
+ */
14
+
15
+ import type { FitAddon, Ghostty, Terminal } from 'ghostty-web';
16
+ import { installCellMetrics } from '@/client/components/workspace/terminal-panel/fonts';
17
+ import { installFullWidthFit } from '@/client/components/workspace/terminal-panel/fit';
18
+ import { focusTerminalTextarea } from '@/client/components/workspace/terminal-panel/focus-target';
19
+ import {
20
+ getTerminalTheme,
21
+ TERMINAL_FONT_FAMILY,
22
+ TERMINAL_FONT_SIZE,
23
+ TERMINAL_SCROLLBACK_BYTES,
24
+ } from '@/client/data/theme/terminal';
25
+
26
+ export interface TerminalInstance {
27
+ term: Terminal;
28
+ fitAddon: FitAddon;
29
+ disposables: { dispose(): void }[];
30
+ }
31
+
32
+ export function createTerminalInstance(
33
+ module: { Terminal: typeof Terminal; FitAddon: typeof FitAddon },
34
+ ghostty: Ghostty,
35
+ container: HTMLElement,
36
+ themeId: string,
37
+ wire: (instance: TerminalInstance) => void,
38
+ ): TerminalInstance {
39
+ const term = new module.Terminal({
40
+ cursorBlink: true,
41
+ cursorStyle: 'block',
42
+ fontSize: TERMINAL_FONT_SIZE,
43
+ fontFamily: TERMINAL_FONT_FAMILY,
44
+ theme: getTerminalTheme(themeId),
45
+ // A byte budget, not xterm's line count. See `theme/terminal.ts`.
46
+ scrollback: TERMINAL_SCROLLBACK_BYTES,
47
+ // No `convertEol`: the PTY already emits CRLF, and converting a lone LF
48
+ // would re-introduce the line-feed doubling a real terminal avoids.
49
+ smoothScrollDuration: 0,
50
+ ghostty,
51
+ });
52
+ term.open(container);
53
+ installCellMetrics(term);
54
+ // The WASM allocator reuses pages: a fresh terminal can inherit the previous
55
+ // screen's cells until something overwrites them. Clear before the first byte
56
+ // is shown.
57
+ term.clear();
58
+ // Only when the container is really on screen: the desktop mounts every view
59
+ // hidden, and a hidden terminal must not take focus (or a keyboard).
60
+ if (container.clientWidth > 0) focusTerminalTextarea(term);
61
+ const fitAddon = new module.FitAddon();
62
+ term.loadAddon(fitAddon);
63
+ installFullWidthFit(fitAddon, term);
64
+ const instance: TerminalInstance = { term, fitAddon, disposables: [] };
65
+ wire(instance);
66
+ return instance;
67
+ }
68
+
69
+ export function disposeTerminalInstance(instance: TerminalInstance | null): void {
70
+ if (!instance) return;
71
+ for (const disposable of instance.disposables) {
72
+ try {
73
+ disposable.dispose();
74
+ } catch {}
75
+ }
76
+ try {
77
+ instance.fitAddon.dispose();
78
+ } catch {}
79
+ try {
80
+ instance.term.dispose();
81
+ } catch {}
82
+ }
@@ -37,24 +37,28 @@
37
37
  * pages and can hand a fresh terminal the previous screen's cells.
38
38
  */
39
39
 
40
- import type { FitAddon, Ghostty, Terminal } from 'ghostty-web';
40
+ import type { Ghostty } from 'ghostty-web';
41
41
  import { terminalInputFrame } from '@/shared/lib/workspace/terminal/input';
42
42
  import {
43
- installCellMetrics,
44
43
  remeasureTerminal,
45
44
  waitForTerminalFonts,
46
45
  watchTerminalFonts,
47
46
  } from '@/client/components/workspace/terminal-panel/fonts';
48
- import { installFullWidthFit } from '@/client/components/workspace/terminal-panel/fit';
49
47
  import { createGridAnnouncer } from '@/client/components/workspace/terminal-panel/grid';
50
- import { attachTouchScroll, handleKeyNavigation } from '@/client/components/workspace/terminal-panel/navigation';
48
+ import {
49
+ attachTouchScroll,
50
+ handleKeyNavigation,
51
+ } from '@/client/components/workspace/terminal-panel/navigation';
51
52
  import { holdAcrossWrite, watchPointerPress } from '@/client/components/workspace/terminal-panel/scroll-hold';
52
53
  import {
53
- getTerminalTheme,
54
- TERMINAL_FONT_FAMILY,
55
- TERMINAL_FONT_SIZE,
56
- TERMINAL_SCROLLBACK_BYTES,
57
- } from '@/client/data/theme/terminal';
54
+ focusTerminal,
55
+ redirectSoftKeyboardFocus,
56
+ } from '@/client/components/workspace/terminal-panel/focus-target';
57
+ import {
58
+ createTerminalInstance,
59
+ disposeTerminalInstance,
60
+ type TerminalInstance,
61
+ } from '@/client/components/workspace/terminal-panel/instance';
58
62
 
59
63
  export interface TerminalMountCallbacks {
60
64
  /** Keystrokes, paste, mouse reports — straight to the PTY. */
@@ -95,12 +99,6 @@ export interface TerminalMount {
95
99
  dispose: () => void;
96
100
  }
97
101
 
98
- interface TerminalInstance {
99
- term: Terminal;
100
- fitAddon: FitAddon;
101
- disposables: { dispose(): void }[];
102
- }
103
-
104
102
  /**
105
103
  * Mount the terminal inside `container`. Resolves to null when the module could
106
104
  * not be loaded or the component unmounted while importing.
@@ -134,6 +132,9 @@ export async function mountTerminal(
134
132
  // one.
135
133
  term.attachCustomKeyEventHandler((event: globalThis.KeyboardEvent) => handleKeyNavigation(term, event));
136
134
  instance.disposables.push(
135
+ // ghostty's own `open()` re-focuses the container on a timer; see
136
+ // `focus-target.ts` for why a phone's textarea needs this redirect.
137
+ { dispose: redirectSoftKeyboardFocus(container, term) },
137
138
  term.onScroll((viewportY: number) => callbacks.onScrolledUpChange(viewportY > 0)),
138
139
  term.onData((data: string) => {
139
140
  const frame = terminalInputFrame(data);
@@ -153,49 +154,6 @@ export async function mountTerminal(
153
154
  );
154
155
  };
155
156
 
156
- const create = (nextThemeId: string): TerminalInstance => {
157
- const term = new module.Terminal({
158
- cursorBlink: true,
159
- cursorStyle: 'block',
160
- fontSize: TERMINAL_FONT_SIZE,
161
- fontFamily: TERMINAL_FONT_FAMILY,
162
- theme: getTerminalTheme(nextThemeId),
163
- // A byte budget, not xterm's line count. See `theme/terminal.ts`.
164
- scrollback: TERMINAL_SCROLLBACK_BYTES,
165
- // No `convertEol`: the PTY already emits CRLF, and converting a lone LF
166
- // would re-introduce the line-feed doubling a real terminal avoids.
167
- smoothScrollDuration: 0,
168
- ghostty: ghostty as Ghostty,
169
- });
170
- term.open(container);
171
- installCellMetrics(term);
172
- // The WASM allocator reuses pages: a fresh terminal can inherit the previous
173
- // screen's cells until something overwrites them. Clear before the first
174
- // byte is shown.
175
- term.clear();
176
- const fitAddon = new module.FitAddon();
177
- term.loadAddon(fitAddon);
178
- installFullWidthFit(fitAddon, term);
179
- const instance: TerminalInstance = { term, fitAddon, disposables: [] };
180
- wire(instance);
181
- return instance;
182
- };
183
-
184
- const disposeInstance = (instance: TerminalInstance | null): void => {
185
- if (!instance) return;
186
- for (const disposable of instance.disposables) {
187
- try {
188
- disposable.dispose();
189
- } catch {}
190
- }
191
- try {
192
- instance.fitAddon.dispose();
193
- } catch {}
194
- try {
195
- instance.term.dispose();
196
- } catch {}
197
- };
198
-
199
157
  /**
200
158
  * Fit to the container. Returns false when no fit was possible — the panel is
201
159
  * hidden, or the cell has not been measured yet — which is what keeps the
@@ -259,7 +217,7 @@ export async function mountTerminal(
259
217
 
260
218
  const pointer = watchPointerPress(container);
261
219
 
262
- current = create(currentThemeId);
220
+ current = createTerminalInstance(module, ghostty as Ghostty, container, currentThemeId, wire);
263
221
  safeFit();
264
222
  grid.schedule();
265
223
 
@@ -309,7 +267,8 @@ export async function mountTerminal(
309
267
  safeFit();
310
268
  },
311
269
  focus() {
312
- current?.term.focus();
270
+ const term = current?.term;
271
+ if (term) focusTerminal(term);
313
272
  },
314
273
  applicationCursorKeys() {
315
274
  return current?.term.wasmTerm?.getMode(1, false) ?? false;
@@ -326,8 +285,8 @@ export async function mountTerminal(
326
285
  setTheme(nextThemeId: string) {
327
286
  if (disposed || nextThemeId === currentThemeId) return;
328
287
  currentThemeId = nextThemeId;
329
- disposeInstance(current);
330
- current = create(nextThemeId);
288
+ disposeTerminalInstance(current);
289
+ current = createTerminalInstance(module, ghostty as Ghostty, container, nextThemeId, wire);
331
290
  safeFit();
332
291
  },
333
292
  dispose() {
@@ -339,7 +298,7 @@ export async function mountTerminal(
339
298
  touch();
340
299
  pointer.stop();
341
300
  resizeObserver.disconnect();
342
- disposeInstance(current);
301
+ disposeTerminalInstance(current);
343
302
  current = null;
344
303
  },
345
304
  };
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The terminal is the one built-in panel that is typed into, so it is the one
8
+ * that needs the soft keyboard open before its view mounts.
9
+ *
10
+ * The phone shell arms it at the moment of the tap, before the view exists; the
11
+ * drawer releases the bridge (`lib/ui/soft-keyboard.ts`) when the panel it
12
+ * actually resolved is not the terminal — a stored tab the user has since
13
+ * disabled or moved, or a session with no workspace, must not leave the keyboard
14
+ * up over another view.
15
+ */
16
+
17
+ import { openSoftKeyboard } from '@/client/lib/ui/soft-keyboard';
18
+
19
+ /** The built-in id of this panel (`RIGHT_PANEL_TYPES`), spelled once here. */
20
+ const TERMINAL_PANEL_ID = 'terminal';
21
+
22
+ export function panelWantsSoftKeyboard(panelKey: string | null | undefined): boolean {
23
+ return panelKey === TERMINAL_PANEL_ID;
24
+ }
25
+
26
+ /** Arm the keyboard for the panel about to open; a no-op for every other view. */
27
+ export function armTerminalSoftKeyboard(panelKey: string | null | undefined): void {
28
+ if (panelWantsSoftKeyboard(panelKey)) openSoftKeyboard();
29
+ }
@@ -19,6 +19,8 @@ import { setUserKeybindings } from '@/client/lib/commands/keymap';
19
19
  import { registerCommand } from '@/client/lib/commands/registry';
20
20
  import { editorCommandTarget } from '@/client/lib/commands/editor-target';
21
21
  import { openKeyBindingHelp, openPalette } from '@/client/lib/commands/overlays';
22
+ import { openEmptyWorkspace } from '@/client/lib/router/open-session';
23
+ import { UPDATE_CHECK_EVENT } from '@/shared/lib/updates/popup-state';
22
24
  import type { EditorCommand } from '@/shared/lib/code/editor/keymap';
23
25
  import { readUserKeybindings } from '@/shared/lib/commands/user-keybindings';
24
26
  import { isMacPlatform, isWindowsPlatform } from '@/shared/lib/util/platform';
@@ -42,6 +44,19 @@ export function useCommandRuntime(): void {
42
44
  registerCommand('workspace.commandPalette', () => openPalette('commands')),
43
45
  registerCommand('workspace.quickOpen', () => openPalette('files')),
44
46
  registerCommand('workspace.keyBindings', () => openKeyBindingHelp()),
47
+ // The sidebar's primary action, reachable from the native File menu and
48
+ // the palette. It clears the routing state rather than minting a pending
49
+ // chat — see `SessionsView.handleNewSession`.
50
+ registerCommand('workspace.newSession', () => {
51
+ openEmptyWorkspace();
52
+ }),
53
+ // The native App menu's "Check for Updates…" asks the page, because the
54
+ // check and its verdict live in `useUpdates` on whichever sidebar is
55
+ // mounted. A second copy of the request here would be a second source of
56
+ // truth for the same state.
57
+ registerCommand('workspace.checkUpdates', () => {
58
+ window.dispatchEvent(new CustomEvent(UPDATE_CHECK_EVENT));
59
+ }),
45
60
  registerCommand('workspace.saveFile', () => editorCommandTarget()?.saveNow()),
46
61
  registerCommand('editor.run', (args) => {
47
62
  const command = (args as { command?: EditorCommand } | undefined)?.command;
@@ -24,18 +24,23 @@ import { useEffect, useState } from 'preact/hooks';
24
24
  const COARSE_POINTER_QUERY = '(pointer: coarse)';
25
25
  const NO_HOVER_QUERY = '(hover: none)';
26
26
 
27
- function detectSoftKeyboardDevice(): boolean {
27
+ /**
28
+ * The same verdict the hook reports, for code that runs outside a render — the
29
+ * terminal's focus target and the soft-keyboard bridge both need it at the
30
+ * moment of a tap, not at the moment of a render.
31
+ */
32
+ export function isSoftKeyboardDevice(): boolean {
28
33
  if (typeof window === 'undefined') return false;
29
34
  if (window.matchMedia(COARSE_POINTER_QUERY).matches) return true;
30
35
  return navigator.maxTouchPoints > 0 && window.matchMedia(NO_HOVER_QUERY).matches;
31
36
  }
32
37
 
33
38
  export function useTouchDevice(): boolean {
34
- const [isTouch, setIsTouch] = useState(detectSoftKeyboardDevice);
39
+ const [isTouch, setIsTouch] = useState(isSoftKeyboardDevice);
35
40
 
36
41
  useEffect(() => {
37
42
  const queries = [COARSE_POINTER_QUERY, NO_HOVER_QUERY].map((q) => window.matchMedia(q));
38
- const update = () => setIsTouch(detectSoftKeyboardDevice());
43
+ const update = () => setIsTouch(isSoftKeyboardDevice());
39
44
  for (const query of queries) query.addEventListener('change', update);
40
45
  return () => {
41
46
  for (const query of queries) query.removeEventListener('change', update);