@kabmo-labs/kabmo 0.34.0 → 0.36.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 (210) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +435 -432
  3. package/dist/client/static/js/{CsvGrid-vze4m5ag.js → CsvGrid-1h3bcak7.js} +2 -2
  4. package/dist/client/static/js/{DocxView-jbf21gmh.js → DocxView-ndca8jch.js} +3 -3
  5. package/dist/client/static/js/{DrawioView-b52qybx5.js → DrawioView-kpzd6y0b.js} +2 -2
  6. package/dist/client/static/js/{ImageView-mdgzj8px.js → ImageView-79prn3dg.js} +1 -1
  7. package/dist/client/static/js/{LayoutWrapper-3c49dvtt.js → LayoutWrapper-v2wn2sb2.js} +2 -2
  8. package/dist/client/static/js/{Modal-sqp864vd.js → Modal-99j0zz3z.js} +16 -16
  9. package/dist/client/static/js/{PdfView-g06rxqb1.js → PdfView-2rjd87ay.js} +1 -1
  10. package/dist/client/static/js/{SessionsView-521adxyr.js → SessionsView-t7f3s71b.js} +1 -1
  11. package/dist/client/static/js/{SheetView-h8xmsz7q.js → SheetView-ehb976st.js} +4 -4
  12. package/dist/client/static/js/{SvgPreview-1j4jvcvz.js → SvgPreview-de2bbba6.js} +1 -1
  13. package/dist/client/static/js/{abnfDiagram-O67JEVCF-pasxh4b6.js → abnfDiagram-O67JEVCF-nx9jzn7m.js} +1 -1
  14. package/dist/client/static/js/architecture-7GRP2DOG-aqft2erp.js +1 -0
  15. package/dist/client/static/js/{architectureDiagram-NJMV4G6O-ms14g0bm.js → architectureDiagram-NJMV4G6O-170v67rr.js} +2 -2
  16. package/dist/client/static/js/{blockDiagram-BEXU5L5S-ycn78fcq.js → blockDiagram-BEXU5L5S-16q285n1.js} +2 -2
  17. package/dist/client/static/js/{c4Diagram-YGBWAQC7-vn2gpjfm.js → c4Diagram-YGBWAQC7-rn3qt45h.js} +1 -1
  18. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-fyrm1pr5.js → classDiagram-v2-NBCMYWYE-r26wg74e.js} +3 -3
  19. package/dist/client/static/js/{cose-bilkent-JH36ORCC-ea5nwvgq.js → cose-bilkent-JH36ORCC-82kwe7ha.js} +1 -1
  20. package/dist/client/static/js/css-r2nhvzff.js +1 -0
  21. package/dist/client/static/js/cynefin-OW5HDTMX-v2sz60t6.js +1 -0
  22. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-j6bsjpre.js → cynefinDiagram-VND7K2PF-tcxdn6pa.js} +1 -1
  23. package/dist/client/static/js/{dagre-6A5THRUB-4smdkwv8.js → dagre-6A5THRUB-g833ata3.js} +2 -2
  24. package/dist/client/static/js/{diagram-22UHCM2B-9sm4kqwc.js → diagram-22UHCM2B-f1fq8xec.js} +4 -4
  25. package/dist/client/static/js/{diagram-3UASUU5V-2h3qxaed.js → diagram-3UASUU5V-6j2w016f.js} +1 -1
  26. package/dist/client/static/js/{diagram-ATOU4E4O-1981bc94.js → diagram-ATOU4E4O-6t2qxsk4.js} +1 -1
  27. package/dist/client/static/js/{diagram-CDSNMT55-3vgsxavc.js → diagram-CDSNMT55-7abar8s7.js} +1 -1
  28. package/dist/client/static/js/{diagram-MLGK6HIB-c9gf2r3f.js → diagram-MLGK6HIB-s68rgy16.js} +1 -1
  29. package/dist/client/static/js/{diagram-MPIPVDR6-gjqeq92d.js → diagram-MPIPVDR6-azgkm6w8.js} +1 -1
  30. package/dist/client/static/js/{dockerfile-8v935dkn.js → dockerfile-47e33kqa.js} +1 -1
  31. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-4vbsgh99.js → ebnfDiagram-ZINNZB2B-esrjz750.js} +1 -1
  32. package/dist/client/static/js/{elixir-vcbg60wv.js → elixir-rpa1g4gy.js} +1 -1
  33. package/dist/client/static/js/{elk-276RUBZZ-nca3t891.js → elk-276RUBZZ-fhr4b4jj.js} +1 -1
  34. package/dist/client/static/js/{erDiagram-OPXOYQCR-5kfkev03.js → erDiagram-OPXOYQCR-5r3fmdnz.js} +2 -2
  35. package/dist/client/static/js/{erlang-qt876zrq.js → erlang-bh5cbm8m.js} +1 -1
  36. package/dist/client/static/js/eventmodeling-NTZA5JFV-8qbefe4m.js +1 -0
  37. package/dist/client/static/js/flowDiagram-KWPJA3E3-krsvgcq7.js +1 -0
  38. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-mxc73wmq.js → ganttDiagram-FUAMR5RP-j4pf6rdn.js} +2 -2
  39. package/dist/client/static/js/gitGraph-4MIJSDKK-9bx1a38k.js +1 -0
  40. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-7en3ag0e.js → gitGraphDiagram-X574FWY7-x5epk0gr.js} +1 -1
  41. package/dist/client/static/js/graphql-xnpp5gn9.js +1 -0
  42. package/dist/client/static/js/html-pv88ny12.js +1 -0
  43. package/dist/client/static/js/{index-j51d5a5m.js → index-0b1kwsam.js} +28 -28
  44. package/dist/client/static/js/{index-52rqxgya.js → index-3kgrcaq1.js} +1 -1
  45. package/dist/client/static/js/{index-vhqe0y82.js → index-3vdmwpbh.js} +2 -2
  46. package/dist/client/static/js/{index-g2dyfze9.js → index-40ve7zzv.js} +1 -1
  47. package/dist/client/static/js/{index-eyfcm0cy.js → index-44qrckd2.js} +1 -1
  48. package/dist/client/static/js/{index-qckv9nte.js → index-55pqvh82.js} +2 -2
  49. package/dist/client/static/js/{index-r014brzs.js → index-5kjpacvd.js} +1 -1
  50. package/dist/client/static/js/{index-ev3yt353.js → index-5rzk1226.js} +1 -1
  51. package/dist/client/static/js/{index-p0nz38bm.js → index-60ceydzn.js} +1 -1
  52. package/dist/client/static/js/{index-ybm2x4vh.js → index-63c6t75t.js} +1 -1
  53. package/dist/client/static/js/{index-ahv9y42z.js → index-63jbb4kf.js} +2 -2
  54. package/dist/client/static/js/{index-nccwxv0s.js → index-6xzfta4b.js} +1 -1
  55. package/dist/client/static/js/{index-cgzrpvzj.js → index-75haaj8g.js} +169 -169
  56. package/dist/client/static/js/{index-ag2rmtas.js → index-7r1hw2gd.js} +1 -1
  57. package/dist/client/static/js/{index-hf52f59k.js → index-8cy3x2y8.js} +2 -2
  58. package/dist/client/static/js/{index-vy6termr.js → index-8e15fzax.js} +1 -1
  59. package/dist/client/static/js/{index-rzxcj7cg.js → index-97t3mv1v.js} +1 -1
  60. package/dist/client/static/js/{index-km2zb6wk.js → index-982jyfsb.js} +2 -2
  61. package/dist/client/static/js/{index-jsyekbx9.js → index-9gf8b73w.js} +1 -1
  62. package/dist/client/static/js/{index-s7gkkkyz.js → index-a293pdg7.js} +2 -2
  63. package/dist/client/static/js/{index-dbe6afkf.js → index-af24nes6.js} +2 -2
  64. package/dist/client/static/js/{index-ptcwae2n.js → index-b48p8d1j.js} +2 -2
  65. package/dist/client/static/js/{index-cd65zqba.js → index-be6gevq8.js} +1 -1
  66. package/dist/client/static/js/{index-231241f4.js → index-c09a5s1n.js} +9 -9
  67. package/dist/client/static/js/{index-fvmfge3p.js → index-c1j0xb0w.js} +1 -1
  68. package/dist/client/static/js/{index-fta1y9pc.js → index-ctgefatv.js} +10 -10
  69. package/dist/client/static/js/{index-7a64yjrm.js → index-d2km9egp.js} +4 -4
  70. package/dist/client/static/js/index-dh1vd0d9.js +1 -0
  71. package/dist/client/static/js/{index-j0r5hj0j.js → index-dmgawfhw.js} +2 -2
  72. package/dist/client/static/js/{index-1ksg88qf.js → index-h1e1abpt.js} +2 -2
  73. package/dist/client/static/js/{index-4g46wbdw.js → index-htt8qxm3.js} +1 -1
  74. package/dist/client/static/js/{index-c3ek61zv.js → index-k1xt92h4.js} +1 -1
  75. package/dist/client/static/js/{index-f7jhhqtk.js → index-ktvbsj6w.js} +1 -1
  76. package/dist/client/static/js/{index-a0fmsv1d.js → index-ky0prc71.js} +6 -6
  77. package/dist/client/static/js/{index-2svnq5gg.js → index-mm1rf116.js} +1 -1
  78. package/dist/client/static/js/{index-h5bn97p6.js → index-nws03exw.js} +1 -1
  79. package/dist/client/static/js/{index-xx6mqpxm.js → index-pyx8n25s.js} +2 -2
  80. package/dist/client/static/js/{index-rs80cwsv.js → index-q5t4sy22.js} +3 -3
  81. package/dist/client/static/js/{index-76zb4m0n.js → index-r8pckaqe.js} +2 -2
  82. package/dist/client/static/js/{index-4qwzxj81.js → index-sar2ggde.js} +1 -1
  83. package/dist/client/static/js/{index-1b0t1428.js → index-skm6k5w2.js} +3 -3
  84. package/dist/client/static/js/{index-b29afsjh.js → index-v5t761a1.js} +1 -1
  85. package/dist/client/static/js/{index-7y6rpsrp.js → index-v8qd8ypc.js} +2 -2
  86. package/dist/client/static/js/{index-354mqqra.js → index-w3n97x4b.js} +2 -2
  87. package/dist/client/static/js/{index-0vm41je9.js → index-ydvfc9td.js} +1 -1
  88. package/dist/client/static/js/{index-ptcrwswj.js → index-ye450a7z.js} +1 -1
  89. package/dist/client/static/js/{index-rytaa8ca.js → index-z6g74h7g.js} +2 -2
  90. package/dist/client/static/js/{index-sd66wv26.js → index-zdtsvnpq.js} +2 -2
  91. package/dist/client/static/js/{index-pm6xxwz1.js → index-zp73zexp.js} +2 -2
  92. package/dist/client/static/js/info-A6RAGUB7-j51t7jhh.js +1 -0
  93. package/dist/client/static/js/{infoDiagram-VRGFBTTK-sef80132.js → infoDiagram-VRGFBTTK-ktc8nb8g.js} +1 -1
  94. package/dist/client/static/js/ini-ygfyhprj.js +1 -0
  95. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-yhvepp1q.js → ishikawaDiagram-OU5B5YK6-n3dk6227.js} +2 -2
  96. package/dist/client/static/js/java-gm49vw59.js +1 -0
  97. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-5w77y95w.js → journeyDiagram-ZHPQQLJL-f0p1h8qn.js} +3 -3
  98. package/dist/client/static/js/jsx-ksxw1byz.js +1 -0
  99. package/dist/client/static/js/{julia-d4j6wgvf.js → julia-73zjh2w6.js} +1 -1
  100. package/dist/client/static/js/{kanban-definition-PNTS6WVX-02znqtna.js → kanban-definition-PNTS6WVX-7jdt7dv1.js} +2 -2
  101. package/dist/client/static/js/lua-53gzb9bx.js +1 -0
  102. package/dist/client/static/js/markdown-tk3cd3vs.js +1 -0
  103. package/dist/client/static/js/{mermaid.core-a6e6vck4.js → mermaid.core-e8rzrjt9.js} +6 -6
  104. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-y4n74q9x.js → mindmap-definition-NLK3R4M7-7shv6ge0.js} +2 -2
  105. package/dist/client/static/js/one-dark-pro-39bt34v9.js +1 -0
  106. package/dist/client/static/js/one-light-xec0sehr.js +1 -0
  107. package/dist/client/static/js/packet-AYTQ26CC-n83gfj2g.js +1 -0
  108. package/dist/client/static/js/{pegDiagram-GJSIUBJH-pr7ehgzb.js → pegDiagram-GJSIUBJH-17ak2zx3.js} +1 -1
  109. package/dist/client/static/js/{perl-srptw5vm.js → perl-8z46dmze.js} +1 -1
  110. package/dist/client/static/js/{php-n89g3fk7.js → php-6qvnp2t6.js} +1 -1
  111. package/dist/client/static/js/pie-WAS4IAKB-5c5pctwz.js +1 -0
  112. package/dist/client/static/js/{pieDiagram-5QR66LMP-39wpsk08.js → pieDiagram-5QR66LMP-at4x1g4q.js} +2 -2
  113. package/dist/client/static/js/properties-2tcybqjk.js +1 -0
  114. package/dist/client/static/js/python-qph3dntq.js +1 -0
  115. package/dist/client/static/js/{quadrantDiagram-O4NWA36T-esm913km.js → quadrantDiagram-O4NWA36T-apzhwrn4.js} +1 -1
  116. package/dist/client/static/js/r-gd26x93y.js +1 -0
  117. package/dist/client/static/js/radar-RG4KPBEZ-52e5n99a.js +1 -0
  118. package/dist/client/static/js/railroad-74A4TZTK-44nqxxpy.js +1 -0
  119. package/dist/client/static/js/railroad-abnf-HS5TGJTU-25jxgwg7.js +1 -0
  120. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-64pqpf2y.js +1 -0
  121. package/dist/client/static/js/railroad-peg-WCYAUIDC-0p5sxzpx.js +1 -0
  122. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-wy2mgya6.js → railroadDiagram-XR7U4H2S-rw8cj5f3.js} +1 -1
  123. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-6z9xdgbq.js → requirementDiagram-PLB6GJNP-qyrse7mb.js} +1 -1
  124. package/dist/client/static/js/{ruby-r81ytgcm.js → ruby-qy8mhstq.js} +1 -1
  125. package/dist/client/static/js/{rust-frn3szvc.js → rust-fpshqnk0.js} +1 -1
  126. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-rtmxk3ys.js → sankeyDiagram-IPEJSGJF-254qr59q.js} +1 -1
  127. package/dist/client/static/js/{sass-9bxped7y.js → sass-kbwea482.js} +1 -1
  128. package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-awzcrafg.js → sequenceDiagram-PO4LG4MO-y9xjxfc5.js} +3 -3
  129. package/dist/client/static/js/{sizeCapture-INFHLROL-03gy196j.js → sizeCapture-INFHLROL-sc5e60t3.js} +1 -1
  130. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-an8v3q5n.js → stateDiagram-v2-GCMORJYK-r134s4xr.js} +2 -2
  131. package/dist/client/static/js/{swimlanes-2SLR337P-n9yb4wcs.js → swimlanes-2SLR337P-xc7rbawt.js} +1 -1
  132. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-kdcdamkj.js +8 -0
  133. package/dist/client/static/js/{timeline-definition-EJHVYXUP-jceb575g.js → timeline-definition-EJHVYXUP-cgjd8shk.js} +2 -2
  134. package/dist/client/static/js/treeView-Q6P3EWNA-8j14nnd1.js +1 -0
  135. package/dist/client/static/js/treemap-WGGIJYW6-esf993kk.js +1 -0
  136. package/dist/client/static/js/{usecaseDiagram-POWQR4AR-888h3100.js → usecaseDiagram-POWQR4AR-9qsmjhm6.js} +4 -4
  137. package/dist/client/static/js/{vennDiagram-UO4OBE2U-wbfz0rzv.js → vennDiagram-UO4OBE2U-4grw9awx.js} +1 -1
  138. package/dist/client/static/js/{vue-c0rtg1wf.js → vue-j8vb9d7r.js} +1 -1
  139. package/dist/client/static/js/wardley-WFR3VGLG-v4dxm2sb.js +1 -0
  140. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-rn8c5qf9.js → wardleyDiagram-VNRHLVJA-8gxy0wat.js} +1 -1
  141. package/dist/client/static/js/xml-0py2vkw7.js +1 -0
  142. package/dist/client/static/js/{xychartDiagram-PMCCYNJV-8sn1apt6.js → xychartDiagram-PMCCYNJV-5sh7tdrx.js} +2 -2
  143. package/dist/client/static/js/yaml-vghdz0f0.js +1 -0
  144. package/package.json +1 -1
  145. package/src/client/components/settings/categories/ConnectSettings.tsx +8 -1
  146. package/src/client/components/settings/categories/connect-settings/CloudflareConfig.test.tsx +84 -0
  147. package/src/client/components/settings/categories/connect-settings/CloudflareConfig.tsx +68 -0
  148. package/src/client/components/settings/categories/connect-settings/PairDialog.test.tsx +159 -0
  149. package/src/client/components/settings/categories/connect-settings/PairDialog.tsx +40 -7
  150. package/src/client/components/workspace/git-panel/init-state.test.ts +5 -0
  151. package/src/client/hooks/chat/composer/speech-to-text.ts +24 -17
  152. package/src/client/hooks/connect/use-connect-status.ts +44 -19
  153. package/src/client/hooks/connect/use-pairing.ts +5 -0
  154. package/src/client/hooks/editor/file-actions.ts +3 -11
  155. package/src/client/hooks/editor/font.test.ts +2 -1
  156. package/src/client/hooks/editor/use-file-transfer.ts +2 -1
  157. package/src/client/lib/browser/download.ts +22 -0
  158. package/src/client/lib/notifications/watch.ts +4 -1
  159. package/src/server/lib/connect/cloudflared-config.server.ts +236 -0
  160. package/src/server/lib/connect/cloudflared-config.test.ts +245 -0
  161. package/src/server/lib/connect/cloudflared.lifecycle.test.ts +116 -15
  162. package/src/server/lib/connect/cloudflared.server.ts +53 -66
  163. package/src/server/lib/connect/pairing.server.ts +33 -0
  164. package/src/server/lib/connect/qr-png.server.test.ts +93 -0
  165. package/src/server/lib/connect/qr-png.server.ts +119 -0
  166. package/src/server/lib/connect/status.server.ts +10 -4
  167. package/src/server/routes/connect/index.ts +2 -0
  168. package/src/server/routes/connect/pair-qr.test.ts +72 -0
  169. package/src/server/routes/connect/pair-qr.ts +44 -0
  170. package/src/server/routes/connect/pair.ts +8 -2
  171. package/src/server/routes/connect/tunnels.test.ts +141 -0
  172. package/src/server/routes/connect/tunnels.ts +32 -7
  173. package/src/server/routes/notifications/stream.ts +11 -2
  174. package/src/shared/lib/connect/types.ts +7 -0
  175. package/src/shared/lib/dictation/capture-failure.test.ts +46 -0
  176. package/src/shared/lib/dictation/capture-failure.ts +36 -0
  177. package/dist/client/static/js/architecture-7GRP2DOG-fc9kmq1w.js +0 -1
  178. package/dist/client/static/js/css-6vj0d308.js +0 -1
  179. package/dist/client/static/js/cynefin-OW5HDTMX-a4t8992q.js +0 -1
  180. package/dist/client/static/js/eventmodeling-NTZA5JFV-18bdrkv5.js +0 -1
  181. package/dist/client/static/js/flowDiagram-KWPJA3E3-fg0yqx0h.js +0 -1
  182. package/dist/client/static/js/gitGraph-4MIJSDKK-8fa6y40p.js +0 -1
  183. package/dist/client/static/js/graphql-n43pd5fs.js +0 -1
  184. package/dist/client/static/js/html-dbrwss36.js +0 -1
  185. package/dist/client/static/js/index-6sf2vsp2.js +0 -1
  186. package/dist/client/static/js/info-A6RAGUB7-3hk844f7.js +0 -1
  187. package/dist/client/static/js/ini-j5dyq6gm.js +0 -1
  188. package/dist/client/static/js/java-g4dgwbfd.js +0 -1
  189. package/dist/client/static/js/jsx-7t5ecz9s.js +0 -1
  190. package/dist/client/static/js/lua-1g6w30de.js +0 -1
  191. package/dist/client/static/js/markdown-afx21x8c.js +0 -1
  192. package/dist/client/static/js/one-dark-pro-vwhfpzr8.js +0 -1
  193. package/dist/client/static/js/one-light-y5t9x6zh.js +0 -1
  194. package/dist/client/static/js/packet-AYTQ26CC-4nj2yy10.js +0 -1
  195. package/dist/client/static/js/pie-WAS4IAKB-k7rde3f9.js +0 -1
  196. package/dist/client/static/js/properties-thd83wey.js +0 -1
  197. package/dist/client/static/js/python-264ns4xw.js +0 -1
  198. package/dist/client/static/js/r-qw82kkv9.js +0 -1
  199. package/dist/client/static/js/radar-RG4KPBEZ-513dpw4f.js +0 -1
  200. package/dist/client/static/js/railroad-74A4TZTK-9bqnst9c.js +0 -1
  201. package/dist/client/static/js/railroad-abnf-HS5TGJTU-7367d5bv.js +0 -1
  202. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-b806b1mj.js +0 -1
  203. package/dist/client/static/js/railroad-peg-WCYAUIDC-5a67rwf8.js +0 -1
  204. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-nx5nfnf0.js +0 -8
  205. package/dist/client/static/js/treeView-Q6P3EWNA-kcy40evb.js +0 -1
  206. package/dist/client/static/js/treemap-WGGIJYW6-fsrvqxf4.js +0 -1
  207. package/dist/client/static/js/wardley-WFR3VGLG-36dmxww4.js +0 -1
  208. package/dist/client/static/js/xml-dz51p1m3.js +0 -1
  209. package/dist/client/static/js/yaml-2cfkd30t.js +0 -1
  210. package/src/server/lib/connect/cloudflared.server.test.ts +0 -65
@@ -0,0 +1,141 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The tunnels route's config action.
8
+ *
9
+ * The page sends a path, not a flag, because the server owns the "is this a
10
+ * runnable config?" question. The cases pin that contract: a missing file and a
11
+ * hostname-less file are refused with the reason, a good path is persisted and
12
+ * reported back in the same payload, and a running tunnel is stopped when the
13
+ * file underneath it changes — leaving it up would label the page with a path
14
+ * the process is not using.
15
+ */
16
+
17
+ import { afterEach, beforeEach, describe, expect, test } from 'bun:test';
18
+ import fs from 'fs';
19
+ import os from 'os';
20
+ import path from 'path';
21
+ import { action } from '@/server/routes/connect/tunnels';
22
+ import {
23
+ cloudflaredAlive,
24
+ runningTunnelUrl,
25
+ startCloudflared,
26
+ } from '@/server/lib/connect/cloudflared.server';
27
+ import type { ConnectStatus } from '@/shared/lib/connect/types';
28
+ import { isolateDb, releaseDb } from '@/test-support/isolated-db';
29
+
30
+ const dirs: string[] = [];
31
+
32
+ function tempDir(): string {
33
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'kabmo-cf-route-'));
34
+ dirs.push(dir);
35
+ return dir;
36
+ }
37
+
38
+ function writeConfig(): string {
39
+ const file = path.join(tempDir(), 'config.yml');
40
+ fs.writeFileSync(
41
+ file,
42
+ ['tunnel: t', 'ingress:', ' - hostname: kabmo.example.com', ' service: http://localhost:3000', ' - service: http_status:404', ''].join('\n'),
43
+ );
44
+ return file;
45
+ }
46
+
47
+ async function post(body: unknown) {
48
+ const request = new Request('http://localhost/api/connect/tunnels', {
49
+ method: 'POST',
50
+ headers: { 'content-type': 'application/json' },
51
+ body: JSON.stringify(body),
52
+ });
53
+ const response = await action({ request } as never);
54
+ return {
55
+ status: response.status,
56
+ body: (await response.json()) as { ok?: boolean; error?: string; status?: ConnectStatus },
57
+ };
58
+ }
59
+
60
+ let previousConfig: string | undefined;
61
+ let previousDataDir: string | undefined;
62
+
63
+ beforeEach(async () => {
64
+ previousConfig = Bun.env.CLOUDFLARED_CONFIG;
65
+ previousDataDir = Bun.env.KABMO_DATA_DIR;
66
+ Bun.env.KABMO_DATA_DIR = tempDir();
67
+ await isolateDb();
68
+ });
69
+
70
+ afterEach(async () => {
71
+ if (previousConfig === undefined) delete Bun.env.CLOUDFLARED_CONFIG;
72
+ else Bun.env.CLOUDFLARED_CONFIG = previousConfig;
73
+ if (previousDataDir === undefined) delete Bun.env.KABMO_DATA_DIR;
74
+ else Bun.env.KABMO_DATA_DIR = previousDataDir;
75
+ await releaseDb();
76
+ for (const dir of dirs.splice(0)) fs.rmSync(dir, { recursive: true, force: true });
77
+ });
78
+
79
+ describe('POST /api/connect/tunnels config action', () => {
80
+ test('persists a runnable config path and reports it in the payload', async () => {
81
+ const file = writeConfig();
82
+ const { status, body } = await post({ provider: 'cloudflare', action: 'config', path: file });
83
+
84
+ expect(status).toBe(200);
85
+ expect(body.ok).toBe(true);
86
+ expect(body.status?.cloudflareConfigPath).toBe(path.resolve(file));
87
+ });
88
+
89
+ test('refuses a config that does not exist', async () => {
90
+ const missing = path.join(tempDir(), 'nope.yml');
91
+ const { status, body } = await post({ provider: 'cloudflare', action: 'config', path: missing });
92
+
93
+ expect(status).toBe(400);
94
+ expect(body.error).toContain(missing);
95
+ expect(body.status).toBeDefined();
96
+ });
97
+
98
+ test('refuses a config with no ingress hostname', async () => {
99
+ const file = path.join(tempDir(), 'config.yml');
100
+ fs.writeFileSync(file, 'tunnel: t\ningress:\n - service: http_status:404\n');
101
+ const { status, body } = await post({ provider: 'cloudflare', action: 'config', path: file });
102
+
103
+ expect(status).toBe(400);
104
+ expect(body.error).toContain('no ingress hostname');
105
+ });
106
+
107
+ test('refuses a config path for tailscale', async () => {
108
+ const { status, body } = await post({ provider: 'tailscale', action: 'config', path: writeConfig() });
109
+
110
+ expect(status).toBe(400);
111
+ expect(body.error).toBe('Only the Cloudflare tunnel takes a config path.');
112
+ });
113
+
114
+ test('refuses an unknown action', async () => {
115
+ const { status, body } = await post({ provider: 'cloudflare', action: 'restart' });
116
+
117
+ expect(status).toBe(400);
118
+ expect(body.error).toContain('Expected');
119
+ });
120
+
121
+ test.skipIf(process.platform === 'win32')('stops a running tunnel when the config path changes', async () => {
122
+ const first = writeConfig();
123
+ Bun.env.CLOUDFLARED_CONFIG = first;
124
+
125
+ const dir = tempDir();
126
+ const binary = path.join(dir, 'cloudflared');
127
+ fs.writeFileSync(binary, '#!/bin/sh\nexec sleep 30\n');
128
+ fs.chmodSync(binary, 0o755);
129
+
130
+ const port = Number(Bun.env.PORT) || 3000;
131
+ const started = await startCloudflared(binary, first, 'kabmo.example.com', port);
132
+ expect(started.ok).toBe(true);
133
+ expect(cloudflaredAlive(port)).toBe(true);
134
+
135
+ const { status } = await post({ provider: 'cloudflare', action: 'config', path: writeConfig() });
136
+
137
+ expect(status).toBe(200);
138
+ expect(cloudflaredAlive(port)).toBe(false);
139
+ expect(runningTunnelUrl(port)).toBeNull();
140
+ });
141
+ });
@@ -4,11 +4,12 @@
4
4
  */
5
5
 
6
6
  /**
7
- * `POST /api/connect/tunnels` — start or stop one provider.
7
+ * `POST /api/connect/tunnels` — start or stop one provider, or point the
8
+ * Cloudflare row at a different config file.
8
9
  *
9
10
  * The response is the whole status payload rather than a boolean: the page has
10
- * to redraw the address list and the tunnel card together, and a second read
11
- * would let the two disagree for a frame.
11
+ * to redraw the address list, the tunnel card and the config path together, and
12
+ * a second read would let the two disagree for a frame.
12
13
  *
13
14
  * A refusal carries the provider's own sentence. "Tailscale refused: HTTPS is
14
15
  * not enabled for this tailnet" is actionable; `{ ok: false }` is not.
@@ -18,15 +19,21 @@ import { json, NO_STORE_HEADERS, type ActionFunctionArgs } from '@/server/lib/re
18
19
  import { connectStatus, currentPort } from '@/server/lib/connect/status.server';
19
20
  import { findTailscale, startServe, stopServe } from '@/server/lib/connect/tailscale.server';
20
21
  import {
22
+ cloudflaredAlive,
21
23
  findCloudflared,
22
- readCloudflaredConfig,
23
24
  startCloudflared,
24
25
  stopCloudflared,
25
26
  } from '@/server/lib/connect/cloudflared.server';
27
+ import {
28
+ readCloudflaredConfig,
29
+ resolveCloudflaredConfigPath,
30
+ saveCloudflaredConfigPath,
31
+ } from '@/server/lib/connect/cloudflared-config.server';
26
32
 
27
33
  interface TunnelRequest {
28
34
  provider?: unknown;
29
35
  action?: unknown;
36
+ path?: unknown;
30
37
  }
31
38
 
32
39
  export async function action({ request }: ActionFunctionArgs) {
@@ -37,9 +44,16 @@ export async function action({ request }: ActionFunctionArgs) {
37
44
  const body = (await request.json().catch(() => null)) as TunnelRequest | null;
38
45
  const provider = body?.provider;
39
46
  const verb = body?.action;
40
- if ((provider !== 'tailscale' && provider !== 'cloudflare') || (verb !== 'start' && verb !== 'stop')) {
47
+ const knownVerb = verb === 'start' || verb === 'stop' || verb === 'config';
48
+ if ((provider !== 'tailscale' && provider !== 'cloudflare') || !knownVerb) {
49
+ return json(
50
+ { error: 'Expected { provider: "tailscale" | "cloudflare", action: "start" | "stop" | "config" }' },
51
+ { status: 400, headers: NO_STORE_HEADERS },
52
+ );
53
+ }
54
+ if (verb === 'config' && provider !== 'cloudflare') {
41
55
  return json(
42
- { error: 'Expected { provider: "tailscale" | "cloudflare", action: "start" | "stop" }' },
56
+ { error: 'Only the Cloudflare tunnel takes a config path.' },
43
57
  { status: 400, headers: NO_STORE_HEADERS },
44
58
  );
45
59
  }
@@ -57,8 +71,19 @@ export async function action({ request }: ActionFunctionArgs) {
57
71
  }
58
72
  } else if (verb === 'stop') {
59
73
  stopCloudflared(port);
74
+ } else if (verb === 'config') {
75
+ const before = await resolveCloudflaredConfigPath();
76
+ const saved = await saveCloudflaredConfigPath(body?.path);
77
+ if (!saved.ok) {
78
+ failure = saved.reason;
79
+ } else if (saved.path !== before && cloudflaredAlive(port)) {
80
+ // The running process holds the old file; leaving it up would make the
81
+ // page name a path the tunnel is not using.
82
+ stopCloudflared(port);
83
+ }
60
84
  } else {
61
- const presence = findCloudflared();
85
+ const configPath = await resolveCloudflaredConfigPath();
86
+ const presence = findCloudflared(configPath);
62
87
  const config = presence.configPath ? readCloudflaredConfig(presence.configPath) : null;
63
88
  if (presence.reason || !presence.binary || !presence.configPath || !config?.hostname) {
64
89
  failure = presence.reason ?? 'cloudflared is not configured.';
@@ -41,8 +41,17 @@ import {
41
41
  listNotificationEventsAfter,
42
42
  } from '@/server/lib/notifications/store.server';
43
43
 
44
- /** Long enough that a phone's radio sleeps between beats, short enough to notice a dead link. */
45
- const HEARTBEAT_MS = 25_000;
44
+ /**
45
+ * The comment frame that proves the stream is alive.
46
+ *
47
+ * 60 s, not 25: this stream has exactly one consumer — the Android watcher — and
48
+ * every beat is a radio wakeup on a phone that is otherwise asleep. 25 s woke it
49
+ * more than twice as often for the same liveness proof; 60 s lets it idle for
50
+ * most of the interval, and the shell's read timeout (150 s, two and a half
51
+ * beats) still notices a link that died. The page does not use this route: an
52
+ * open page has the realtime socket, whose own heartbeat is separate.
53
+ */
54
+ const HEARTBEAT_MS = 60_000;
46
55
 
47
56
  async function platformEnabled(platform: NotificationPlatform): Promise<boolean> {
48
57
  try {
@@ -81,6 +81,13 @@ export interface ConnectStatus {
81
81
  version: string;
82
82
  addresses: ConnectAddress[];
83
83
  tunnels: TunnelState[];
84
+ /**
85
+ * The cloudflared config the Cloudflare row reads and the start path runs.
86
+ *
87
+ * The page shows it because "which file am I using?" is the question a user
88
+ * with two configs cannot answer from the tunnel's state alone.
89
+ */
90
+ cloudflareConfigPath: string;
84
91
  devices: PairedDevice[];
85
92
  }
86
93
 
@@ -0,0 +1,46 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * `describeCaptureFailure` is the composer's only report of WHY the microphone
8
+ * did not open, so each branch is a message a user can act on — and the
9
+ * fallback must keep the DOMException's name, because the unnamed version is
10
+ * what made an Android WebView capture failure ("Could not open the
11
+ * microphone") impossible to diagnose from the screen.
12
+ */
13
+
14
+ import { describe, expect, test } from 'bun:test';
15
+ import { describeCaptureFailure } from '@/shared/lib/dictation/capture-failure';
16
+
17
+ describe('describeCaptureFailure', () => {
18
+ test('names a refused permission', () => {
19
+ expect(describeCaptureFailure(new DOMException('refused', 'NotAllowedError'))).toBe('Microphone permission denied.');
20
+ });
21
+
22
+ test('separates a device that could not start from a refused permission', () => {
23
+ // Android WebView's message before MODIFY_AUDIO_SETTINGS was declared: the
24
+ // permission WAS granted, so telling the user it was denied would be wrong.
25
+ const message = describeCaptureFailure(new DOMException('refused', 'NotReadableError'));
26
+ expect(message).toContain('could not be started');
27
+ expect(message).not.toContain('permission denied');
28
+ });
29
+
30
+ test('separates a missing device', () => {
31
+ expect(describeCaptureFailure(new DOMException('refused', 'NotFoundError'))).toBe('No microphone was found.');
32
+ });
33
+
34
+ test('keeps the name of an unclassified DOMException', () => {
35
+ // The name is the only diagnosable part; dropping it is the bug this test
36
+ // exists for.
37
+ expect(describeCaptureFailure(new DOMException('refused', 'SecurityError'))).toBe(
38
+ 'Could not open the microphone (SecurityError).',
39
+ );
40
+ });
41
+
42
+ test('a rejection that is not a DOMException says so without inventing a name', () => {
43
+ expect(describeCaptureFailure(new Error('boom'))).toBe('Could not open the microphone.');
44
+ expect(describeCaptureFailure(undefined)).toBe('Could not open the microphone.');
45
+ });
46
+ });
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * What the composer says when `getUserMedia` refuses the microphone.
8
+ *
9
+ * The reason matters more than the sentence: the three failures a user can act
10
+ * on are a refused permission, a device another app holds, and no device at
11
+ * all — and the fourth case is everything else, which is exactly the case that
12
+ * used to be reported as a bare "Could not open the microphone." with nothing
13
+ * to search for. Android WebView's `NotReadableError` is the one that made this
14
+ * necessary: the app's `RECORD_AUDIO` grant and the page's secure origin were
15
+ * both fine, and the capture still failed one layer below them (Chromium's
16
+ * communication-device selection needs `MODIFY_AUDIO_SETTINGS` in the host
17
+ * manifest). Naming the DOMException is what turns that into a report someone
18
+ * can act on.
19
+ */
20
+
21
+ /** The sentence the composer shows for a failed capture. */
22
+ export function describeCaptureFailure(cause: unknown): string {
23
+ const name = cause instanceof DOMException ? cause.name : '';
24
+ switch (name) {
25
+ case 'NotAllowedError':
26
+ return 'Microphone permission denied.';
27
+ case 'NotReadableError':
28
+ return 'The microphone could not be started — another app may be using it.';
29
+ case 'NotFoundError':
30
+ return 'No microphone was found.';
31
+ default:
32
+ // An unnamed rejection is not a DOMException at all (a thrown string, a
33
+ // missing `AudioContext`), so there is no name to append.
34
+ return name ? `Could not open the microphone (${name}).` : 'Could not open the microphone.';
35
+ }
36
+ }
@@ -1 +0,0 @@
1
- import{cf}from"./index-j51d5a5m.js";export{cf as createArchitectureServices};
@@ -1 +0,0 @@
1
- import{rd,as,ah,ih,oh,sh}from"./index-rytaa8ca.js";export{ah as css,sh as gss,as as keywords,oh as less,rd as mkCSS,ih as sCSS};
@@ -1 +0,0 @@
1
- import{nf}from"./index-j51d5a5m.js";export{nf as createCynefinServices};
@@ -1 +0,0 @@
1
- import{uf}from"./index-j51d5a5m.js";export{uf as createEventModelingServices};
@@ -1 +0,0 @@
1
- import"./index-fta1y9pc.js";import"./index-1ksg88qf.js";import{rh}from"./index-a0fmsv1d.js";export{rh as diagram};
@@ -1 +0,0 @@
1
- import{rf}from"./index-j51d5a5m.js";export{rf as createGitGraphServices};
@@ -1 +0,0 @@
1
- import{Sf}from"./index-7y6rpsrp.js";import"./index-zvfvqvn9.js";import"./index-3zc1b0dv.js";import"./index-0j518hqm.js";import"./index-76zb4m0n.js";export{Sf as default};
@@ -1 +0,0 @@
1
- import{xn}from"./index-s7gkkkyz.js";import"./index-0j518hqm.js";import"./index-w7xbfv44.js";export{xn as default};
@@ -1 +0,0 @@
1
- import{Mn,Ni,Tm,es,so,Js,qu,Zs,Wf,Hu,Dm,Qm,Nm,Rm,Yg,Xs,Wu,Jg,Ku,Br,Zg}from"./index-cgzrpvzj.js";export{Zs as IndentContext,Zg as StreamLanguage,Ku as bracketMatching,Xs as codeFolding,Nm as foldAll,Dm as foldCode,Wu as foldGutter,Yg as foldKeymap,Hu as foldService,so as getIndentUnit,qu as getIndentation,Jg as highlightingFor,Wf as indentOnInput,Tm as indentService,Js as indentString,es as indentUnit,Ni as language,Br as matchBrackets,Mn as syntaxTree,Rm as unfoldAll,Qm as unfoldCode};
@@ -1 +0,0 @@
1
- import{af}from"./index-j51d5a5m.js";export{af as createInfoServices};
@@ -1 +0,0 @@
1
- import{BA}from"./index-j0r5hj0j.js";export{BA as default};
@@ -1 +0,0 @@
1
- import{Df}from"./index-hf52f59k.js";export{Df as default};
@@ -1 +0,0 @@
1
- import{Zf}from"./index-76zb4m0n.js";export{Zf as default};
@@ -1 +0,0 @@
1
- import{Tf}from"./index-km2zb6wk.js";import"./index-9t82sx0w.js";export{Tf as default};
@@ -1 +0,0 @@
1
- import{Xf}from"./index-qckv9nte.js";export{Xf as default};
@@ -1 +0,0 @@
1
- import{PA}from"./index-cgzrpvzj.js";export{PA as default};
@@ -1 +0,0 @@
1
- import{MA}from"./index-cgzrpvzj.js";export{MA as default};
@@ -1 +0,0 @@
1
- import{of}from"./index-j51d5a5m.js";export{of as createPacketServices};
@@ -1 +0,0 @@
1
- import{sf}from"./index-j51d5a5m.js";export{sf as createPieServices};
@@ -1 +0,0 @@
1
- import{BA}from"./index-j0r5hj0j.js";export{BA as default};
@@ -1 +0,0 @@
1
- import{Nf}from"./index-dbe6afkf.js";export{Nf as default};
@@ -1 +0,0 @@
1
- import{_f}from"./index-ahv9y42z.js";export{_f as default};
@@ -1 +0,0 @@
1
- import{Xm}from"./index-j51d5a5m.js";export{Xm as createRadarServices};
@@ -1 +0,0 @@
1
- import{ul}from"./index-j51d5a5m.js";export{ul as createRailroadServices};
@@ -1 +0,0 @@
1
- import{pl}from"./index-j51d5a5m.js";export{pl as createRailroadAbnfServices};
@@ -1 +0,0 @@
1
- import{dl}from"./index-j51d5a5m.js";export{dl as createRailroadEbnfServices};
@@ -1 +0,0 @@
1
- import{ml}from"./index-j51d5a5m.js";export{ml as createRailroadPegServices};
@@ -1,8 +0,0 @@
1
- import{t}from"./index-fta1y9pc.js";import"./index-1ksg88qf.js";import{df,pf}from"./index-a0fmsv1d.js";var o=t((r)=>`${df(r)}
2
- .swimlane.cluster:not([data-color-id]) rect {
3
- stroke: ${r.clusterBorder} !important;
4
- }
5
- [data-look="neo"].cluster rect {
6
- filter: none;
7
- }
8
- `,"getStyles"),m=o,D=pf({styles:m});export{D as diagram};
@@ -1 +0,0 @@
1
- import{lf}from"./index-j51d5a5m.js";export{lf as createTreeViewServices};
@@ -1 +0,0 @@
1
- import{ef}from"./index-j51d5a5m.js";export{ef as createTreemapServices};
@@ -1 +0,0 @@
1
- import{tf}from"./index-j51d5a5m.js";export{tf as createWardleyServices};
@@ -1 +0,0 @@
1
- import{Hi}from"./index-2svnq5gg.js";import"./index-hf52f59k.js";export{Hi as default};
@@ -1 +0,0 @@
1
- import{Qf}from"./index-354mqqra.js";export{Qf as default};
@@ -1,65 +0,0 @@
1
- /**
2
- * @license
3
- * SPDX-License-Identifier: MIT
4
- */
5
-
6
- /**
7
- * The cloudflared config scan.
8
- *
9
- * A line scan is only safe if it refuses the shapes it cannot read. The case
10
- * that matters is a config with an ingress block but no hostname: reporting a
11
- * tunnel as configured there would put a URL on the page that does not exist.
12
- */
13
-
14
- import { describe, expect, test } from 'bun:test';
15
- import fs from 'fs';
16
- import os from 'os';
17
- import path from 'path';
18
- import { readCloudflaredConfig } from '@/server/lib/connect/cloudflared.server';
19
-
20
- function writeConfig(text: string): string {
21
- const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'kabmo-cf-'));
22
- const file = path.join(dir, 'config.yml');
23
- fs.writeFileSync(file, text);
24
- return file;
25
- }
26
-
27
- describe('readCloudflaredConfig', () => {
28
- test('reads the tunnel name and the first ingress hostname', () => {
29
- const file = writeConfig(
30
- [
31
- 'tunnel: 6ff42ae2-765d-4adf-8112-31c55c1551ef',
32
- 'credentials-file: /home/me/.cloudflared/6ff42ae2.json',
33
- '',
34
- 'ingress:',
35
- ' - hostname: kabmo.example.com',
36
- ' service: http://localhost:3000',
37
- ' - service: http_status:404',
38
- '',
39
- ].join('\n'),
40
- );
41
- expect(readCloudflaredConfig(file)).toEqual({
42
- tunnel: '6ff42ae2-765d-4adf-8112-31c55c1551ef',
43
- hostname: 'kabmo.example.com',
44
- });
45
- });
46
-
47
- test('strips quotes around a value', () => {
48
- const file = writeConfig(['tunnel: "my-tunnel"', 'ingress:', ' - hostname: "a.example.com"'].join('\n'));
49
- expect(readCloudflaredConfig(file)).toEqual({ tunnel: 'my-tunnel', hostname: 'a.example.com' });
50
- });
51
-
52
- test('answers null for a file with neither field', () => {
53
- const file = writeConfig('metrics: 127.0.0.1:20241\n');
54
- expect(readCloudflaredConfig(file)).toBeNull();
55
- });
56
-
57
- test('answers null for a missing file', () => {
58
- expect(readCloudflaredConfig(path.join(os.tmpdir(), 'kabmo-does-not-exist.yml'))).toBeNull();
59
- });
60
-
61
- test('does not read a hostname from outside the ingress block', () => {
62
- const file = writeConfig(['tunnel: t', 'hostname: not-ingress.example.com', 'ingress:', ' - service: http_status:404'].join('\n'));
63
- expect(readCloudflaredConfig(file)).toEqual({ tunnel: 't', hostname: null });
64
- });
65
- });