@kabmo-labs/kabmo 0.39.0 → 0.40.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 (264) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +363 -363
  3. package/dist/client/static/js/{CsvGrid-kfcp4sd6.js → CsvGrid-j9nvnhq1.js} +2 -2
  4. package/dist/client/static/js/{DocxView-atff5w38.js → DocxView-87gnpm81.js} +5 -5
  5. package/dist/client/static/js/{DrawioView-yfnq4c99.js → DrawioView-a351t8f8.js} +2 -2
  6. package/dist/client/static/js/ImageView-c139r891.js +1 -0
  7. package/dist/client/static/js/LayoutWrapper-08axzr3a.js +2 -0
  8. package/dist/client/static/js/{Modal-2xqd3sss.js → Modal-0weqfqvk.js} +17 -17
  9. package/dist/client/static/js/{PdfView-mk8paxt1.js → PdfView-n6bwcvc8.js} +1 -1
  10. package/dist/client/static/js/{SessionsView-ner25qxn.js → SessionsView-awef8ehj.js} +1 -1
  11. package/dist/client/static/js/{SheetView-s6n3fawm.js → SheetView-k8ymr87w.js} +24 -24
  12. package/dist/client/static/js/{SvgPreview-8bxvz3ez.js → SvgPreview-5pcp444e.js} +1 -1
  13. package/dist/client/static/js/{abnfDiagram-O67JEVCF-tvvz9fha.js → abnfDiagram-O67JEVCF-psav75bx.js} +1 -1
  14. package/dist/client/static/js/architecture-7GRP2DOG-6rbq97t9.js +1 -0
  15. package/dist/client/static/js/{architectureDiagram-NJMV4G6O-bybv3wg4.js → architectureDiagram-NJMV4G6O-9bk6ykn7.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-h3fs79x6.js → blockDiagram-BEXU5L5S-17xsf182.js} +5 -5
  19. package/dist/client/static/js/c-67jyc7sg.js +1 -0
  20. package/dist/client/static/js/{c4Diagram-YGBWAQC7-h8p3h54v.js → c4Diagram-YGBWAQC7-jn9j4n04.js} +2 -2
  21. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-q645r4q6.js → classDiagram-v2-NBCMYWYE-663z1g1r.js} +5 -5
  22. package/dist/client/static/js/{cose-bilkent-JH36ORCC-p4mm1zcv.js → cose-bilkent-JH36ORCC-vp4yvx8x.js} +1 -1
  23. package/dist/client/static/js/cpp-crfbnwv8.js +1 -0
  24. package/dist/client/static/js/css-983fbv00.js +1 -0
  25. package/dist/client/static/js/css-zj4qzw6r.js +1 -0
  26. package/dist/client/static/js/cynefin-OW5HDTMX-zafxcz2k.js +1 -0
  27. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-v2hbc3aq.js → cynefinDiagram-VND7K2PF-dagkrjbh.js} +1 -1
  28. package/dist/client/static/js/{dagre-6A5THRUB-4edpda33.js → dagre-6A5THRUB-8qgwpb5a.js} +2 -2
  29. package/dist/client/static/js/{diagram-22UHCM2B-b6gp813w.js → diagram-22UHCM2B-671xtp0d.js} +11 -11
  30. package/dist/client/static/js/{diagram-3UASUU5V-s1f3b0ng.js → diagram-3UASUU5V-8nn5fha8.js} +1 -1
  31. package/dist/client/static/js/{diagram-ATOU4E4O-ga06kjp5.js → diagram-ATOU4E4O-dnar0ktg.js} +3 -3
  32. package/dist/client/static/js/{diagram-CDSNMT55-wdbmv4td.js → diagram-CDSNMT55-bt0fhk7n.js} +3 -3
  33. package/dist/client/static/js/{diagram-MLGK6HIB-fkntefcq.js → diagram-MLGK6HIB-tp6dwxdb.js} +1 -1
  34. package/dist/client/static/js/{diagram-MPIPVDR6-k2zh7edp.js → diagram-MPIPVDR6-qgx8c8ee.js} +2 -2
  35. package/dist/client/static/js/{dockerfile-srcym0bs.js → dockerfile-hk0s4qaw.js} +1 -1
  36. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-4vc4vz9c.js → ebnfDiagram-ZINNZB2B-nmf9r33z.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-g2ppf1by.js → elk-276RUBZZ-dheh5ngz.js} +1 -1
  39. package/dist/client/static/js/{erDiagram-OPXOYQCR-rmnwkb5q.js → erDiagram-OPXOYQCR-8837mk18.js} +5 -5
  40. package/dist/client/static/js/{erlang-55r0skxa.js → erlang-w9gmf866.js} +1 -1
  41. package/dist/client/static/js/eventmodeling-NTZA5JFV-cq3dvz7e.js +1 -0
  42. package/dist/client/static/js/flowDiagram-KWPJA3E3-spzh2jxq.js +1 -0
  43. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-ptfvae64.js → ganttDiagram-FUAMR5RP-g68mvnje.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-epgk26pj.js +1 -0
  46. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-ne9n3cyf.js → gitGraphDiagram-X574FWY7-ymk81cdj.js} +2 -2
  47. package/dist/client/static/js/graphql-dewsj5g1.js +1 -0
  48. package/dist/client/static/js/html-1cpe2xc8.js +1 -0
  49. package/dist/client/static/js/{index-dmd26a1y.js → index-018ehs1n.js} +1 -1
  50. package/dist/client/static/js/{index-442mbhwb.js → index-173x4bh0.js} +2 -2
  51. package/dist/client/static/js/{index-c1be3rva.js → index-2kg3r5jw.js} +2 -2
  52. package/dist/client/static/js/{index-gvkc9e32.js → index-4j1g7m8g.js} +1 -1
  53. package/dist/client/static/js/{index-7h5n5rz4.js → index-4j5jwb54.js} +2 -2
  54. package/dist/client/static/js/{index-8egjccbq.js → index-547h1b8j.js} +52 -52
  55. package/dist/client/static/js/{index-4pehdq5h.js → index-69xe17c1.js} +2 -2
  56. package/dist/client/static/js/{index-k5a6r25s.js → index-6wtx7a9x.js} +2 -2
  57. package/dist/client/static/js/{index-m3r0j562.js → index-8888hgj8.js} +5 -5
  58. package/dist/client/static/js/{index-8w2tx2k9.js → index-8ggxxp8c.js} +2 -2
  59. package/dist/client/static/js/{index-b08hx4tw.js → index-9wjnbb3q.js} +2 -2
  60. package/dist/client/static/js/{index-p89z1qmj.js → index-ag78jnva.js} +1 -1
  61. package/dist/client/static/js/{index-xrp2zv8z.js → index-agdbjh5k.js} +2 -2
  62. package/dist/client/static/js/index-aznkfx1z.js +2 -0
  63. package/dist/client/static/js/{index-cfnxda13.js → index-b612vske.js} +2 -2
  64. package/dist/client/static/js/{index-k3c3n69j.js → index-bdz08fe2.js} +12 -12
  65. package/dist/client/static/js/{index-ntx3bbmb.js → index-bgpcf3mr.js} +1 -1
  66. package/dist/client/static/js/index-bj3wn9je.js +1 -0
  67. package/dist/client/static/js/{index-7z63xr1s.js → index-c003wb3r.js} +1 -1
  68. package/dist/client/static/js/{index-5kvvb0zm.js → index-cccrappc.js} +2 -2
  69. package/dist/client/static/js/{index-k7sdsmgv.js → index-ce4vytm6.js} +2 -2
  70. package/dist/client/static/js/{index-2rs03vfy.js → index-d1vearmk.js} +2 -2
  71. package/dist/client/static/js/index-dhrp656p.js +1 -0
  72. package/dist/client/static/js/{index-k61tdd4a.js → index-dj7y2df7.js} +2 -2
  73. package/dist/client/static/js/{index-4wtr5wjp.js → index-ek4gwrm8.js} +2 -2
  74. package/dist/client/static/js/{index-mdxnhndy.js → index-ek7hqfp0.js} +2 -2
  75. package/dist/client/static/js/{index-drjtwfp5.js → index-fg965t62.js} +2 -2
  76. package/dist/client/static/js/{index-me7m3516.js → index-g10nr8m6.js} +5 -5
  77. package/dist/client/static/js/{index-4wvtar0v.js → index-gn92c6hp.js} +2 -2
  78. package/dist/client/static/js/{index-t6gznaxm.js → index-gx2xefdg.js} +2 -2
  79. package/dist/client/static/js/{index-q0bph5x0.js → index-haaz8t7e.js} +2 -2
  80. package/dist/client/static/js/{index-pr7gk5eq.js → index-harsfp4x.js} +10 -10
  81. package/dist/client/static/js/{index-3fw3sd10.js → index-j4ks5s41.js} +179 -179
  82. package/dist/client/static/js/{index-cst843zs.css → index-jqs23cc7.css} +1 -1
  83. package/dist/client/static/js/{index-ymp2wqtc.js → index-js81yrmy.js} +3 -3
  84. package/dist/client/static/js/{index-enmh3w27.js → index-jy91r3ap.js} +2 -2
  85. package/dist/client/static/js/{index-y2prm0xm.js → index-mxpgfj6p.js} +2 -2
  86. package/dist/client/static/js/{index-a7qccdq2.js → index-p2812ygk.js} +1 -1
  87. package/dist/client/static/js/index-pp6mss9b.js +3 -0
  88. package/dist/client/static/js/index-q1bqg4f6.js +1 -0
  89. package/dist/client/static/js/{index-v8vjh5jj.js → index-qnt118mp.js} +1 -1
  90. package/dist/client/static/js/index-qntpsp98.js +2 -0
  91. package/dist/client/static/js/{index-fjnkzk12.js → index-qsw5edtk.js} +5 -5
  92. package/dist/client/static/js/{index-ywpdhntc.js → index-qw5aqk2d.js} +1 -1
  93. package/dist/client/static/js/{index-9gepbvdt.js → index-r1fe56cn.js} +2 -2
  94. package/dist/client/static/js/{index-72289dgx.js → index-rc8wrs2a.js} +2 -2
  95. package/dist/client/static/js/index-rvjc19x7.js +2 -0
  96. package/dist/client/static/js/{index-9d6x1f3t.js → index-s78n0dtv.js} +2 -2
  97. package/dist/client/static/js/{index-c36pag9y.js → index-sj4y8kj2.js} +2 -2
  98. package/dist/client/static/js/{index-qsrw5c67.js → index-vv9ytx0t.js} +2 -2
  99. package/dist/client/static/js/{index-1sgad84m.js → index-vwc8pdy3.js} +2 -2
  100. package/dist/client/static/js/{index-8qgwj6m8.js → index-w130cs7d.js} +1 -1
  101. package/dist/client/static/js/{index-hh05xd1d.js → index-wsqgp9jw.js} +2 -2
  102. package/dist/client/static/js/{index-61qjr1k0.js → index-wv36ddd5.js} +48 -48
  103. package/dist/client/static/js/{index-56w8m083.js → index-wy05jt00.js} +2 -2
  104. package/dist/client/static/js/{index-0j518hqm.js → index-xf36nmbm.js} +2 -2
  105. package/dist/client/static/js/{index-xdqsqhnn.js → index-y5hxhr7q.js} +4 -4
  106. package/dist/client/static/js/{index-pzqsp5jw.js → index-y82bk3hr.js} +3 -3
  107. package/dist/client/static/js/{index-rj81xrvw.js → index-ys4t1am4.js} +2 -2
  108. package/dist/client/static/js/{index-y3qxrs90.js → index-yzg9mbsv.js} +2 -2
  109. package/dist/client/static/js/info-A6RAGUB7-0an46pag.js +1 -0
  110. package/dist/client/static/js/{infoDiagram-VRGFBTTK-ctfwcm3n.js → infoDiagram-VRGFBTTK-11trzn8c.js} +1 -1
  111. package/dist/client/static/js/ini-09e0scxh.js +1 -0
  112. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-b0b0pn4y.js → ishikawaDiagram-OU5B5YK6-8xnnymb5.js} +2 -2
  113. package/dist/client/static/js/java-vnaesxzs.js +1 -0
  114. package/dist/client/static/js/javascript-zegm06a1.js +1 -0
  115. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-kdq12drs.js → journeyDiagram-ZHPQQLJL-wd47j0hy.js} +3 -3
  116. package/dist/client/static/js/json-g5ggnd94.js +1 -0
  117. package/dist/client/static/js/jsx-xz71aed4.js +1 -0
  118. package/dist/client/static/js/{julia-jhe2vd4f.js → julia-c2q0vwpd.js} +1 -1
  119. package/dist/client/static/js/{kanban-definition-PNTS6WVX-65x6xn2q.js → kanban-definition-PNTS6WVX-s5rgcp44.js} +4 -4
  120. package/dist/client/static/js/lua-e4wenyzt.js +1 -0
  121. package/dist/client/static/js/markdown-yv3p1p7m.js +1 -0
  122. package/dist/client/static/js/{mermaid.core-0fq63jpa.js → mermaid.core-9fxp8nt2.js} +7 -7
  123. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-p86myex3.js → mindmap-definition-NLK3R4M7-4fyewtst.js} +3 -3
  124. package/dist/client/static/js/one-dark-pro-ahch85zb.js +1 -0
  125. package/dist/client/static/js/one-light-9706jgqt.js +1 -0
  126. package/dist/client/static/js/packet-AYTQ26CC-5e397pav.js +1 -0
  127. package/dist/client/static/js/{pegDiagram-GJSIUBJH-p2hkk9xb.js → pegDiagram-GJSIUBJH-s2xe2e2k.js} +1 -1
  128. package/dist/client/static/js/{perl-qhj6tk7k.js → perl-6pa0tn3b.js} +1 -1
  129. package/dist/client/static/js/{php-arycc4w7.js → php-1zy994pz.js} +1 -1
  130. package/dist/client/static/js/pie-WAS4IAKB-0zzmzg64.js +1 -0
  131. package/dist/client/static/js/{pieDiagram-5QR66LMP-bza19wkx.js → pieDiagram-5QR66LMP-1szpjbzy.js} +2 -2
  132. package/dist/client/static/js/properties-0ag74bdj.js +1 -0
  133. package/dist/client/static/js/python-zsn5tdbj.js +1 -0
  134. package/dist/client/static/js/{quadrantDiagram-O4NWA36T-bxqec9w1.js → quadrantDiagram-O4NWA36T-mv3ee2qa.js} +3 -3
  135. package/dist/client/static/js/r-mwtqhnw3.js +1 -0
  136. package/dist/client/static/js/radar-RG4KPBEZ-mtar9742.js +1 -0
  137. package/dist/client/static/js/railroad-74A4TZTK-d6a6j9fq.js +1 -0
  138. package/dist/client/static/js/railroad-abnf-HS5TGJTU-1257kd8x.js +1 -0
  139. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-v8b6qmas.js +1 -0
  140. package/dist/client/static/js/railroad-peg-WCYAUIDC-jxpbx410.js +1 -0
  141. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-1g3hx3sm.js → railroadDiagram-XR7U4H2S-hgdqjpm9.js} +1 -1
  142. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-qbjjm48v.js → requirementDiagram-PLB6GJNP-yrfjp9wx.js} +3 -3
  143. package/dist/client/static/js/{ruby-fb6zzevm.js → ruby-arvs7kz4.js} +1 -1
  144. package/dist/client/static/js/{rust-jatm47v6.js → rust-3ahjk339.js} +1 -1
  145. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-t2ythbh7.js → sankeyDiagram-IPEJSGJF-k7k871xa.js} +3 -3
  146. package/dist/client/static/js/{sass-fzs6a0kr.js → sass-cmkf7nwd.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-mqsfek2j.js → sequenceDiagram-PO4LG4MO-gd80m0as.js} +7 -7
  149. package/dist/client/static/js/{sizeCapture-INFHLROL-xj67pgds.js → sizeCapture-INFHLROL-jv6p4834.js} +1 -1
  150. package/dist/client/static/js/sql-aczp05f2.js +1 -0
  151. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-gj4fezak.js → stateDiagram-v2-GCMORJYK-tvphxq2h.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-pgtdd1pk.js → swimlanes-2SLR337P-3dt7nxj2.js} +1 -1
  154. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-aqnh1hhp.js +8 -0
  155. package/dist/client/static/js/{timeline-definition-EJHVYXUP-q013vdd1.js → timeline-definition-EJHVYXUP-40vvf856.js} +4 -4
  156. package/dist/client/static/js/treeView-Q6P3EWNA-q3qr7ew7.js +1 -0
  157. package/dist/client/static/js/treemap-WGGIJYW6-zgbdydeq.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-7swsbqnq.js → usecaseDiagram-POWQR4AR-g1j5x0xh.js} +28 -28
  161. package/dist/client/static/js/{vennDiagram-UO4OBE2U-9dygxdxf.js → vennDiagram-UO4OBE2U-5b8789qk.js} +1 -1
  162. package/dist/client/static/js/{vue-k3f3chre.js → vue-zccj3qa5.js} +1 -1
  163. package/dist/client/static/js/wardley-WFR3VGLG-b230aajh.js +1 -0
  164. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-aaaa9kj3.js → wardleyDiagram-VNRHLVJA-c7x3za3w.js} +3 -3
  165. package/dist/client/static/js/xml-23y6pgvx.js +1 -0
  166. package/dist/client/static/js/{xychartDiagram-PMCCYNJV-tamf39gx.js → xychartDiagram-PMCCYNJV-h0fy45tg.js} +3 -3
  167. package/dist/client/static/js/yaml-vrayja34.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/mobile/LayoutWrapper.tsx +19 -2
  181. package/src/client/components/mobile/RightSidebar.tsx +49 -1
  182. package/src/client/components/mobile/SessionSidebar.tsx +25 -1
  183. package/src/client/components/mobile/header-titlebar.test.tsx +17 -0
  184. package/src/client/components/mobile/mobile-main-view/Header.test.tsx +43 -0
  185. package/src/client/components/mobile/mobile-main-view/Header.tsx +30 -0
  186. package/src/client/components/mobile/mobile-session-sidebar/Dock.tsx +5 -1
  187. package/src/client/components/mobile/mobile-session-sidebar/Header.tsx +12 -1
  188. package/src/client/components/mobile/panel-chips.test.tsx +13 -0
  189. package/src/client/components/mobile/panel-chips.tsx +9 -2
  190. package/src/client/components/settings/categories/connect-settings/DeviceTable.test.tsx +92 -0
  191. package/src/client/components/settings/categories/connect-settings/DeviceTable.tsx +22 -3
  192. package/src/client/components/workspace/git-panel/commit-modal/Header.test.tsx +21 -0
  193. package/src/client/components/workspace/git-panel/commit-modal/Header.tsx +13 -9
  194. package/src/client/components/workspace/terminal-panel/focus-target.test.ts +121 -0
  195. package/src/client/components/workspace/terminal-panel/focus-target.ts +54 -0
  196. package/src/client/components/workspace/terminal-panel/index.tsx +7 -1
  197. package/src/client/components/workspace/terminal-panel/instance.ts +82 -0
  198. package/src/client/components/workspace/terminal-panel/mount.ts +22 -63
  199. package/src/client/components/workspace/terminal-panel/soft-keyboard.ts +29 -0
  200. package/src/client/hooks/ui/touch-device.ts +8 -3
  201. package/src/client/hooks/ui/visibility-menu-trigger.test.ts +155 -0
  202. package/src/client/hooks/ui/visibility-menu-trigger.ts +85 -0
  203. package/src/client/hooks/workspace/panel-visibility-menu.ts +50 -0
  204. package/src/client/lib/ui/soft-keyboard.test.ts +103 -0
  205. package/src/client/lib/ui/soft-keyboard.ts +90 -0
  206. package/src/server/lib/auth/guard.ts +8 -2
  207. package/src/server/lib/connect/devices.server.test.ts +70 -0
  208. package/src/server/lib/connect/devices.server.ts +43 -1
  209. package/src/server/lib/connect/last-connect.gate.test.ts +52 -0
  210. package/src/server/lib/terminal/attach-replay.test.ts +80 -17
  211. package/src/server/plugins/static.test.ts +23 -1
  212. package/src/server/plugins/static.ts +24 -1
  213. package/src/server/routes/connect/devices.ts +5 -4
  214. package/src/shared/lib/connect/types.ts +1 -0
  215. package/dist/client/static/js/ImageView-nreh25s0.js +0 -1
  216. package/dist/client/static/js/LayoutWrapper-0x1q1q5z.js +0 -2
  217. package/dist/client/static/js/architecture-7GRP2DOG-y0zb4vqa.js +0 -1
  218. package/dist/client/static/js/bash-k6p3y3pr.js +0 -1
  219. package/dist/client/static/js/c-ve09y19q.js +0 -1
  220. package/dist/client/static/js/cpp-vhqp7bcy.js +0 -1
  221. package/dist/client/static/js/css-77mvf0ca.js +0 -1
  222. package/dist/client/static/js/css-tys2rrny.js +0 -1
  223. package/dist/client/static/js/cynefin-OW5HDTMX-nt1ed192.js +0 -1
  224. package/dist/client/static/js/eventmodeling-NTZA5JFV-v4edaxx7.js +0 -1
  225. package/dist/client/static/js/flowDiagram-KWPJA3E3-jvrvhb9d.js +0 -1
  226. package/dist/client/static/js/gitGraph-4MIJSDKK-adzhec96.js +0 -1
  227. package/dist/client/static/js/graphql-g97hycb3.js +0 -1
  228. package/dist/client/static/js/html-2syect3n.js +0 -1
  229. package/dist/client/static/js/index-1jeyjqkh.js +0 -2
  230. package/dist/client/static/js/index-270y5r9k.js +0 -2
  231. package/dist/client/static/js/index-5a4w58r2.js +0 -1
  232. package/dist/client/static/js/index-878d61js.js +0 -1
  233. package/dist/client/static/js/index-dt22v9ns.js +0 -2
  234. package/dist/client/static/js/index-jkph8wqq.js +0 -3
  235. package/dist/client/static/js/index-mmsszqvn.js +0 -1
  236. package/dist/client/static/js/info-A6RAGUB7-2ye26vqn.js +0 -1
  237. package/dist/client/static/js/ini-7ffv28px.js +0 -1
  238. package/dist/client/static/js/java-4x5yky4a.js +0 -1
  239. package/dist/client/static/js/javascript-4kw2j9t3.js +0 -1
  240. package/dist/client/static/js/json-h3kwpty2.js +0 -1
  241. package/dist/client/static/js/jsx-jk20f0dr.js +0 -1
  242. package/dist/client/static/js/lua-k02dpxq8.js +0 -1
  243. package/dist/client/static/js/markdown-fhhg7ms6.js +0 -1
  244. package/dist/client/static/js/one-dark-pro-c4q810z4.js +0 -1
  245. package/dist/client/static/js/one-light-czk9dzya.js +0 -1
  246. package/dist/client/static/js/packet-AYTQ26CC-b0j3te0q.js +0 -1
  247. package/dist/client/static/js/pie-WAS4IAKB-28qq62fn.js +0 -1
  248. package/dist/client/static/js/properties-qhvcxc13.js +0 -1
  249. package/dist/client/static/js/python-3qsrs510.js +0 -1
  250. package/dist/client/static/js/r-z2ng7mza.js +0 -1
  251. package/dist/client/static/js/radar-RG4KPBEZ-fyrcbpyd.js +0 -1
  252. package/dist/client/static/js/railroad-74A4TZTK-9s62qncd.js +0 -1
  253. package/dist/client/static/js/railroad-abnf-HS5TGJTU-f7yjmhrk.js +0 -1
  254. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-sfrw8gkz.js +0 -1
  255. package/dist/client/static/js/railroad-peg-WCYAUIDC-4mm4cern.js +0 -1
  256. package/dist/client/static/js/sql-ypk53ntb.js +0 -1
  257. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-zk37paj9.js +0 -8
  258. package/dist/client/static/js/treeView-Q6P3EWNA-a5vgg4gz.js +0 -1
  259. package/dist/client/static/js/treemap-WGGIJYW6-ctqhajgg.js +0 -1
  260. package/dist/client/static/js/tsx-zy7hb2hw.js +0 -1
  261. package/dist/client/static/js/typescript-2hr53c8j.js +0 -1
  262. package/dist/client/static/js/wardley-WFR3VGLG-ns7e0fqf.js +0 -1
  263. package/dist/client/static/js/xml-p4742r9b.js +0 -1
  264. package/dist/client/static/js/yaml-qbckg671.js +0 -1
@@ -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,103 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The soft-keyboard bridge: one focusable element, focused inside the tap.
8
+ *
9
+ * The bug this pins is a phone one: the terminal's focus request lands after the
10
+ * renderer's async mount, which is after the tap that opened the panel, and a
11
+ * phone opens its keyboard only while a gesture is active. The bridge is the
12
+ * element that carries the gesture across that gap, so the assertions are about
13
+ * the three ways it can fail: it is not focusable (a hidden element), it piles
14
+ * up one element per tap, or it steals focus back from the terminal.
15
+ */
16
+
17
+ import { afterAll, afterEach, beforeAll, describe, expect, test } from 'bun:test';
18
+ import { Window } from 'happy-dom';
19
+ import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
20
+ import {
21
+ openSoftKeyboard,
22
+ releaseSoftKeyboard,
23
+ SOFT_KEYBOARD_BRIDGE_ATTR,
24
+ } from '@/client/lib/ui/soft-keyboard';
25
+
26
+ let win: Window;
27
+
28
+ function setSoftKeyboardDevice(value: boolean): void {
29
+ win.matchMedia = ((query: string) => ({
30
+ matches: value && query === '(pointer: coarse)',
31
+ media: query,
32
+ onchange: null,
33
+ addListener() {},
34
+ removeListener() {},
35
+ addEventListener() {},
36
+ removeEventListener() {},
37
+ dispatchEvent: () => false,
38
+ })) as unknown as typeof win.matchMedia;
39
+ Object.defineProperty(win.navigator, 'maxTouchPoints', { value: 0, configurable: true });
40
+ }
41
+
42
+ function bridge(): HTMLTextAreaElement | null {
43
+ return document.querySelector<HTMLTextAreaElement>(`[${SOFT_KEYBOARD_BRIDGE_ATTR}]`);
44
+ }
45
+
46
+ beforeAll(() => {
47
+ win = new Window({ url: 'http://localhost' });
48
+ installDomGlobals(win);
49
+ });
50
+
51
+ afterEach(() => {
52
+ releaseSoftKeyboard();
53
+ document.body.innerHTML = '';
54
+ });
55
+
56
+ afterAll(() => {
57
+ restoreDomGlobals();
58
+ });
59
+
60
+ describe('soft keyboard bridge', () => {
61
+ test('focuses a real, offscreen textarea on a soft-keyboard device', () => {
62
+ setSoftKeyboardDevice(true);
63
+ openSoftKeyboard();
64
+
65
+ const element = bridge();
66
+ expect(element).not.toBeNull();
67
+ expect(document.activeElement).toBe(element);
68
+ // `display:none`/`visibility:hidden` cannot take focus, and a font below
69
+ // 16px makes iOS zoom the page when the keyboard opens.
70
+ expect(element!.style.display).not.toBe('none');
71
+ expect(element!.style.visibility).not.toBe('hidden');
72
+ expect(element!.style.fontSize).toBe('16px');
73
+ });
74
+
75
+ test('reuses one bridge across taps', () => {
76
+ setSoftKeyboardDevice(true);
77
+ openSoftKeyboard();
78
+ openSoftKeyboard();
79
+ expect(document.querySelectorAll(`[${SOFT_KEYBOARD_BRIDGE_ATTR}]`).length).toBe(1);
80
+ });
81
+
82
+ test('release blurs the bridge but never steals focus from the terminal', () => {
83
+ setSoftKeyboardDevice(true);
84
+ openSoftKeyboard();
85
+ releaseSoftKeyboard();
86
+ expect(document.activeElement).not.toBe(bridge());
87
+
88
+ const terminal = document.createElement('div');
89
+ terminal.tabIndex = 0;
90
+ document.body.appendChild(terminal);
91
+ terminal.focus();
92
+ releaseSoftKeyboard();
93
+ expect(document.activeElement).toBe(terminal);
94
+ });
95
+
96
+ test('does nothing on a device with a hardware keyboard', () => {
97
+ setSoftKeyboardDevice(false);
98
+ const before = document.activeElement;
99
+ openSoftKeyboard();
100
+ expect(bridge()).toBeNull();
101
+ expect(document.activeElement).toBe(before);
102
+ });
103
+ });
@@ -0,0 +1,90 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * Summon the soft keyboard from inside a tap.
8
+ *
9
+ * A phone opens its keyboard only while a user gesture is active. The terminal
10
+ * panel asks for focus the moment it becomes visible, but the element that takes
11
+ * focus is created by `mountTerminal`, whose ghostty-web import and font wait
12
+ * resolve long after the tap that opened the panel has ended — so the focus
13
+ * landed, the keyboard did not, and the first command needed a tap on the canvas
14
+ * first.
15
+ *
16
+ * `openSoftKeyboard()` focuses a 1px offscreen textarea synchronously in that
17
+ * tap. When the terminal mounts it takes focus from the bridge, and the keyboard
18
+ * stays up because focus moved between two editable elements. The bridge is not
19
+ * an input: it is cleared on every arm, and the terminal's own textarea is the
20
+ * surface that receives the keystrokes.
21
+ *
22
+ * The element is deliberately NOT `display:none`/`visibility:hidden` — a hidden
23
+ * element cannot take focus — and its font size is 16px, the size below which
24
+ * iOS zooms the page on focus.
25
+ */
26
+
27
+ import { isSoftKeyboardDevice } from '@/client/hooks/ui/touch-device';
28
+
29
+ /** Marks the bridge for the tests; it is not a product hook. */
30
+ export const SOFT_KEYBOARD_BRIDGE_ATTR = 'data-soft-keyboard-bridge';
31
+
32
+ /**
33
+ * How long the bridge may hold the keyboard with no terminal to hand it to.
34
+ *
35
+ * The terminal's mount is bounded by the font wait (2s) plus the import, so a
36
+ * bridge that is still focused after this long belongs to a panel that never
37
+ * opened (no workspace, a disabled view) and must not leave the keyboard up.
38
+ */
39
+ const RELEASE_AFTER_MS = 8000;
40
+
41
+ let bridge: HTMLTextAreaElement | null = null;
42
+ let releaseTimer: ReturnType<typeof setTimeout> | undefined;
43
+
44
+ function createBridge(): HTMLTextAreaElement {
45
+ const element = document.createElement('textarea');
46
+ element.tabIndex = -1;
47
+ element.autocomplete = 'off';
48
+ element.setAttribute('autocorrect', 'off');
49
+ element.setAttribute('autocapitalize', 'off');
50
+ element.setAttribute('spellcheck', 'false');
51
+ element.setAttribute('aria-label', 'Terminal keyboard');
52
+ element.setAttribute(SOFT_KEYBOARD_BRIDGE_ATTR, '');
53
+ element.style.cssText = [
54
+ 'position:fixed',
55
+ 'top:0',
56
+ 'left:0',
57
+ 'width:1px',
58
+ 'height:1px',
59
+ 'padding:0',
60
+ 'border:0',
61
+ 'margin:0',
62
+ 'opacity:0',
63
+ 'font-size:16px',
64
+ 'pointer-events:none',
65
+ 'z-index:-1',
66
+ ].join(';');
67
+ document.body.appendChild(element);
68
+ return element;
69
+ }
70
+
71
+ /** Focus the bridge now, while the caller's tap is still a user gesture. */
72
+ export function openSoftKeyboard(): void {
73
+ if (typeof document === 'undefined' || !isSoftKeyboardDevice()) return;
74
+ if (!bridge || !bridge.isConnected) bridge = createBridge();
75
+ clearTimeout(releaseTimer);
76
+ bridge.value = '';
77
+ bridge.focus({ preventScroll: true });
78
+ releaseTimer = setTimeout(releaseSoftKeyboard, RELEASE_AFTER_MS);
79
+ }
80
+
81
+ /**
82
+ * Drop the bridge's keyboard, but never steal focus from whatever holds it now.
83
+ *
84
+ * Called when the panel that asked for the keyboard turns out not to be the
85
+ * terminal, and by the terminal panel when it is not the visible view.
86
+ */
87
+ export function releaseSoftKeyboard(): void {
88
+ clearTimeout(releaseTimer);
89
+ if (bridge && document.activeElement === bridge) bridge.blur();
90
+ }
@@ -31,7 +31,7 @@ import { hashPassword, deriveCredentialKey, readSessionSecret, writeSessionSecre
31
31
  import { readSessionCookie, verifySessionToken } from '@/server/lib/auth/token';
32
32
  import { agentGate } from '@/server/lib/auth/agent-gate.server';
33
33
  import { bearerToken } from '@/server/lib/sessions/agent-token.server';
34
- import { verifyDeviceToken, readDeviceCookie } from '@/server/lib/connect/devices.server';
34
+ import { markDeviceConnected, verifyDeviceToken, readDeviceCookie } from '@/server/lib/connect/devices.server';
35
35
  import { rememberClientAddress } from '@/server/lib/auth/client-address';
36
36
  import type { CredentialHandover } from '@/shared/lib/auth/handover';
37
37
 
@@ -332,7 +332,13 @@ export async function authGate(request: Request, clientAddress?: string): Promis
332
332
  // the device removes the hash from the cache, so the next request fails here.
333
333
  // The cookie form is what a webview can actually send — it cannot attach a
334
334
  // header to its own page requests or to a WebSocket upgrade.
335
- if (verifyDeviceToken(bearerToken(request)) || verifyDeviceToken(readDeviceCookie(request))) {
335
+ //
336
+ // Verification is also the only reliable "last connect" signal: no shell
337
+ // reports after pairing, so a timestamp written by the claim route alone
338
+ // would show the pairing date. Throttled to one write per device per minute.
339
+ const deviceId = verifyDeviceToken(bearerToken(request)) ?? verifyDeviceToken(readDeviceCookie(request));
340
+ if (deviceId) {
341
+ await markDeviceConnected(deviceId);
336
342
  return undefined;
337
343
  }
338
344
 
@@ -0,0 +1,70 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The last-connect timestamp.
8
+ *
9
+ * The Settings page reads `last_seen_at` as "Last connect", and the only writer
10
+ * that fires on ordinary use is the auth gate's `markDeviceConnected`. Pairing
11
+ * alone is not a connect: a device that redeemed a code but never opened the
12
+ * console must stay unmarked, which is what the first case pins.
13
+ *
14
+ * The throttle is deliberate — the gate runs on every request, so a write per
15
+ * frame would be a database write in front of every page load. The second case
16
+ * pins that a burst of requests moves the timestamp once.
17
+ */
18
+
19
+ import { afterEach, beforeEach, describe, expect, test } from 'bun:test';
20
+
21
+ import { getDb } from '@/server/db.server';
22
+ import {
23
+ ensureConnectSchema,
24
+ listPairedDevices,
25
+ markDeviceConnected,
26
+ mintDeviceToken,
27
+ } from '@/server/lib/connect/devices.server';
28
+ import { isolateDb, releaseDb } from '@/test-support/isolated-db';
29
+
30
+ beforeEach(async () => {
31
+ await isolateDb();
32
+ globalThis.__kabmoDeviceMarks = new Map();
33
+ globalThis.__kabmoDeviceTokens = new Map();
34
+ await ensureConnectSchema(await getDb());
35
+ });
36
+
37
+ afterEach(async () => {
38
+ await releaseDb();
39
+ });
40
+
41
+ describe('last connect', () => {
42
+ test('a freshly paired device has not connected yet', async () => {
43
+ await mintDeviceToken({ name: 'Phone', platform: 'ios' });
44
+ const [device] = await listPairedDevices();
45
+ expect(device?.lastSeenAt).toBeNull();
46
+ });
47
+
48
+ test('a token use records the time', async () => {
49
+ const device = await mintDeviceToken({ name: 'Phone', platform: 'ios' });
50
+ const before = Date.now();
51
+ await markDeviceConnected(device.id);
52
+
53
+ const [listed] = await listPairedDevices();
54
+ expect(listed?.lastSeenAt).not.toBeNull();
55
+ const at = Date.parse(listed?.lastSeenAt ?? '');
56
+ expect(at).toBeGreaterThanOrEqual(before);
57
+ expect(at).toBeLessThanOrEqual(Date.now());
58
+ });
59
+
60
+ test('a burst of requests moves the timestamp once per window', async () => {
61
+ const device = await mintDeviceToken({ name: 'Phone', platform: 'ios' });
62
+ await markDeviceConnected(device.id);
63
+ const first = (await listPairedDevices())[0]?.lastSeenAt;
64
+
65
+ await markDeviceConnected(device.id);
66
+ await markDeviceConnected(device.id);
67
+
68
+ expect((await listPairedDevices())[0]?.lastSeenAt).toBe(first ?? null);
69
+ });
70
+ });
@@ -36,6 +36,8 @@ interface DeviceRow {
36
36
  declare global {
37
37
  // eslint-disable-next-line no-var
38
38
  var __kabmoDeviceTokens: Map<string, string> | undefined;
39
+ // eslint-disable-next-line no-var
40
+ var __kabmoDeviceMarks: Map<string, number> | undefined;
39
41
  }
40
42
 
41
43
  function tokenCache(): Map<string, string> {
@@ -43,6 +45,42 @@ function tokenCache(): Map<string, string> {
43
45
  return globalThis.__kabmoDeviceTokens;
44
46
  }
45
47
 
48
+ /**
49
+ * How often one device's connect timestamp is written.
50
+ *
51
+ * The gate runs on every request — pages, frames, WebSocket upgrades — so the
52
+ * timestamp is throttled in memory: the first request after the window records,
53
+ * and the next minute of traffic is free of writes.
54
+ */
55
+ const CONNECT_MARK_INTERVAL_MS = 60_000;
56
+
57
+ function connectMarks(): Map<string, number> {
58
+ globalThis.__kabmoDeviceMarks ??= new Map();
59
+ return globalThis.__kabmoDeviceMarks;
60
+ }
61
+
62
+ /**
63
+ * Record that `id` just used its token.
64
+ *
65
+ * This is the "last connect" the Settings page shows, and it is deliberately a
66
+ * report of USE rather than of pairing: a device that paired last week and is
67
+ * open right now must not read "last seen: last week". Never throws — the
68
+ * request is already authorized and the timestamp is a display fact, not a
69
+ * credential — and a failed write is retried by the next allowed window.
70
+ */
71
+ export async function markDeviceConnected(id: string): Promise<void> {
72
+ const marks = connectMarks();
73
+ const now = Date.now();
74
+ if (now - (marks.get(id) ?? 0) < CONNECT_MARK_INTERVAL_MS) return;
75
+ marks.set(id, now);
76
+ try {
77
+ const db = await getDb();
78
+ await db.run('UPDATE paired_devices SET last_seen_at = ? WHERE id = ?', [now, id]);
79
+ } catch {
80
+ // The device stays authorized; the next connection retries.
81
+ }
82
+ }
83
+
46
84
  export async function ensureConnectSchema(db: DbClient): Promise<void> {
47
85
  await db.exec(`
48
86
  CREATE TABLE IF NOT EXISTS paired_devices (
@@ -167,6 +205,7 @@ export async function revokeDevice(id: string): Promise<boolean> {
167
205
  if (!row) return false;
168
206
  await db.run('UPDATE paired_devices SET revoked_at = ? WHERE id = ?', [Date.now(), id]);
169
207
  tokenCache().delete(row.token_hash);
208
+ connectMarks().delete(id);
170
209
  return true;
171
210
  }
172
211
 
@@ -182,10 +221,13 @@ export async function touchDevice(
182
221
  ): Promise<void> {
183
222
  try {
184
223
  const db = await getDb();
224
+ const now = Date.now();
185
225
  await db.run(
186
226
  'UPDATE paired_devices SET last_seen_at = ?, route = COALESCE(?, route), rtt_ms = COALESCE(?, rtt_ms) WHERE id = ?',
187
- [Date.now(), report?.route ?? null, report?.rttMs ?? null, id],
227
+ [now, report?.route ?? null, report?.rttMs ?? null, id],
188
228
  );
229
+ // The gate would otherwise write the same timestamp immediately after.
230
+ connectMarks().set(id, now);
189
231
  } catch {
190
232
  // See above: a display fact, not a credential.
191
233
  }
@@ -0,0 +1,52 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The gate is what records "last connect".
8
+ *
9
+ * No shell reports its connection after pairing, so a timestamp written only by
10
+ * `POST /api/connect/devices` would leave every real device reading "Never
11
+ * connected" while it is open. This case starts at the actual entry point — a
12
+ * request carrying the device token — and reads the row the Settings page
13
+ * reads back.
14
+ */
15
+
16
+ import { afterEach, beforeEach, expect, test } from 'bun:test';
17
+ import path from 'node:path';
18
+
19
+ import { authGate, initAuth } from '@/server/lib/auth/guard';
20
+ import { getDb } from '@/server/db.server';
21
+ import {
22
+ ensureConnectSchema,
23
+ listPairedDevices,
24
+ mintDeviceToken,
25
+ } from '@/server/lib/connect/devices.server';
26
+ import { isolateDb, releaseDb } from '@/test-support/isolated-db';
27
+
28
+ beforeEach(async () => {
29
+ const dbPath = await isolateDb();
30
+ Bun.env.KABMO_DATA_DIR = path.dirname(dbPath);
31
+ globalThis.__kabmoDeviceMarks = new Map();
32
+ globalThis.__kabmoDeviceTokens = new Map();
33
+ await ensureConnectSchema(await getDb());
34
+ });
35
+
36
+ afterEach(async () => {
37
+ await initAuth(null);
38
+ delete Bun.env.KABMO_DATA_DIR;
39
+ await releaseDb();
40
+ });
41
+
42
+ test('an authenticated device request moves the last-connect timestamp', async () => {
43
+ await initAuth('correct horse battery staple');
44
+ const device = await mintDeviceToken({ name: 'Phone', platform: 'ios' });
45
+ expect((await listPairedDevices())[0]?.lastSeenAt).toBeNull();
46
+
47
+ const request = new Request('http://localhost/api/settings', {
48
+ headers: { authorization: `Bearer ${device.token}` },
49
+ });
50
+ expect(await authGate(request)).toBeUndefined();
51
+ expect((await listPairedDevices())[0]?.lastSeenAt).not.toBeNull();
52
+ });