@kabmo-labs/kabmo 0.33.0 → 0.35.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 (272) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +785 -624
  3. package/dist/client/static/js/{CsvGrid-fncjbg6j.js → CsvGrid-0amzgtd7.js} +2 -2
  4. package/dist/client/static/js/{DocxView-c9v2vr3r.js → DocxView-bxjhzxe9.js} +5 -5
  5. package/dist/client/static/js/{DrawioView-vxjksm12.js → DrawioView-7s1yqsf4.js} +2 -2
  6. package/dist/client/static/js/{ImageView-a3g5k226.js → ImageView-ycfbn66h.js} +1 -1
  7. package/dist/client/static/js/{LayoutWrapper-hnjfwsjh.js → LayoutWrapper-tw1q1x0g.js} +2 -2
  8. package/dist/client/static/js/Modal-wqjactyd.js +38 -0
  9. package/dist/client/static/js/{PdfView-ksaes53y.js → PdfView-x6dmtwvr.js} +1 -1
  10. package/dist/client/static/js/{SessionsView-30vcr95v.js → SessionsView-t85wq0me.js} +1 -1
  11. package/dist/client/static/js/{SheetView-vc484scg.js → SheetView-n52nvz8s.js} +25 -25
  12. package/dist/client/static/js/{SvgPreview-tph89jet.js → SvgPreview-59z7syme.js} +1 -1
  13. package/dist/client/static/js/{abnfDiagram-O67JEVCF-xbar278c.js → abnfDiagram-O67JEVCF-91gnt049.js} +1 -1
  14. package/dist/client/static/js/architecture-7GRP2DOG-bajpnvy7.js +1 -0
  15. package/dist/client/static/js/{architectureDiagram-NJMV4G6O-s171n2z6.js → architectureDiagram-NJMV4G6O-5b9qtff2.js} +4 -4
  16. package/dist/client/static/js/{astro-80bs6hvg.js → astro-31cbyw7b.js} +1 -1
  17. package/dist/client/static/js/bash-0h36tk0k.js +1 -0
  18. package/dist/client/static/js/{blockDiagram-BEXU5L5S-gzx6rv9n.js → blockDiagram-BEXU5L5S-6f23fjkn.js} +3 -3
  19. package/dist/client/static/js/{c4Diagram-YGBWAQC7-7f00skch.js → c4Diagram-YGBWAQC7-76t6d3am.js} +5 -5
  20. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-j79v95nc.js → classDiagram-v2-NBCMYWYE-f9tb19xm.js} +3 -3
  21. package/dist/client/static/js/{cose-bilkent-JH36ORCC-5fkn7ee5.js → cose-bilkent-JH36ORCC-t6nwrbwj.js} +1 -1
  22. package/dist/client/static/js/cpp-4wp9sy20.js +1 -0
  23. package/dist/client/static/js/css-c9nsbkh6.js +1 -0
  24. package/dist/client/static/js/cynefin-OW5HDTMX-8q9e90m8.js +1 -0
  25. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-cfs1yvrd.js → cynefinDiagram-VND7K2PF-69gc244j.js} +1 -1
  26. package/dist/client/static/js/{dagre-6A5THRUB-44bgc48p.js → dagre-6A5THRUB-54bry3ey.js} +2 -2
  27. package/dist/client/static/js/{diagram-22UHCM2B-a4g4x83k.js → diagram-22UHCM2B-gfkebye6.js} +11 -11
  28. package/dist/client/static/js/{diagram-3UASUU5V-gm4rg5na.js → diagram-3UASUU5V-a1mr319f.js} +1 -1
  29. package/dist/client/static/js/{diagram-ATOU4E4O-a95y41vk.js → diagram-ATOU4E4O-tkyk0qbe.js} +3 -3
  30. package/dist/client/static/js/{diagram-CDSNMT55-t3j93mmc.js → diagram-CDSNMT55-np0hc9m2.js} +4 -4
  31. package/dist/client/static/js/{diagram-MLGK6HIB-c2wdez02.js → diagram-MLGK6HIB-nh06fshp.js} +2 -2
  32. package/dist/client/static/js/{diagram-MPIPVDR6-gya9jhs5.js → diagram-MPIPVDR6-27q2veks.js} +2 -2
  33. package/dist/client/static/js/{dockerfile-a7q6174s.js → dockerfile-4rtt6c0f.js} +1 -1
  34. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-jjhkza6t.js → ebnfDiagram-ZINNZB2B-x9p9jqe8.js} +1 -1
  35. package/dist/client/static/js/{elk-276RUBZZ-f7re45mw.js → elk-276RUBZZ-fw7waks3.js} +1 -1
  36. package/dist/client/static/js/{erDiagram-OPXOYQCR-tpm9g5te.js → erDiagram-OPXOYQCR-fdfgzr5d.js} +5 -5
  37. package/dist/client/static/js/{erlang-qt876zrq.js → erlang-trjm07as.js} +1 -1
  38. package/dist/client/static/js/eventmodeling-NTZA5JFV-kn4hsm3p.js +1 -0
  39. package/dist/client/static/js/flowDiagram-KWPJA3E3-ah8cvps1.js +1 -0
  40. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-fz43n12d.js → ganttDiagram-FUAMR5RP-2avbqgdr.js} +3 -3
  41. package/dist/client/static/js/gitGraph-4MIJSDKK-hvavh16n.js +1 -0
  42. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-f61hgbn6.js → gitGraphDiagram-X574FWY7-9jmc0a3g.js} +12 -12
  43. package/dist/client/static/js/graphql-hbkmxsty.js +1 -0
  44. package/dist/client/static/js/{index-8239j2v1.js → index-0v34a7wf.js} +1 -1
  45. package/dist/client/static/js/{index-vtbbfwx0.js → index-1wjp16f0.js} +2 -2
  46. package/dist/client/static/js/index-2mx9ej4k.css +1 -0
  47. package/dist/client/static/js/{index-q2w6s8n7.js → index-2v1nmxwr.js} +6 -6
  48. package/dist/client/static/js/{index-apvkd37e.js → index-3ecsp1rx.js} +3 -3
  49. package/dist/client/static/js/{index-1y9r4frb.js → index-43qpbxjv.js} +2 -2
  50. package/dist/client/static/js/{index-w0fwb80e.js → index-4vybd9e7.js} +1 -1
  51. package/dist/client/static/js/{index-ahv9y42z.js → index-6f6cmcbq.js} +2 -2
  52. package/dist/client/static/js/{index-9fjt5anh.js → index-7ct7qrsp.js} +2 -2
  53. package/dist/client/static/js/{index-ajs3jj6j.js → index-7q02xnvq.js} +1 -1
  54. package/dist/client/static/js/{index-rytaa8ca.js → index-7smwzkvq.js} +2 -2
  55. package/dist/client/static/js/{index-rg8jpbsw.js → index-8acv5b77.js} +2 -2
  56. package/dist/client/static/js/{index-gs6f0qwa.js → index-8f9x7ev8.js} +2 -2
  57. package/dist/client/static/js/{index-7y6rpsrp.js → index-8mwragbj.js} +2 -2
  58. package/dist/client/static/js/{index-gcs49f3p.js → index-8x9ecxb0.js} +1 -1
  59. package/dist/client/static/js/{index-3rcjx70v.js → index-9ketbkh6.js} +1 -1
  60. package/dist/client/static/js/{index-ypx3qmhq.js → index-a628fg4m.js} +2 -2
  61. package/dist/client/static/js/{index-e4p4cd3r.js → index-a8ffattk.js} +2 -2
  62. package/dist/client/static/js/{index-js7t1vb1.js → index-b8s3xraa.js} +6 -6
  63. package/dist/client/static/js/index-btr2w8cq.js +12 -0
  64. package/dist/client/static/js/index-dfzrpy54.js +2 -0
  65. package/dist/client/static/js/{index-pxv2nw9w.js → index-ee2p07eg.js} +1 -1
  66. package/dist/client/static/js/{index-03h3bkcf.js → index-ek2e773p.js} +1 -1
  67. package/dist/client/static/js/{index-1xqs14fr.js → index-fvc0x6nx.js} +3 -3
  68. package/dist/client/static/js/{index-3zc1b0dv.js → index-jc1yagmk.js} +2 -2
  69. package/dist/client/static/js/{index-d495kfm0.js → index-jmxqefe3.js} +1 -1
  70. package/dist/client/static/js/{index-2x5f66t6.js → index-k7q01ye4.js} +2 -2
  71. package/dist/client/static/js/{index-5tgq7aqx.js → index-kdkfyrja.js} +2 -2
  72. package/dist/client/static/js/{index-m73za75e.js → index-mc4nefs7.js} +3 -3
  73. package/dist/client/static/js/{index-trm9x02n.js → index-nb8tp4mj.js} +30 -30
  74. package/dist/client/static/js/{index-zt75xpq0.js → index-ncrenheb.js} +206 -206
  75. package/dist/client/static/js/{index-qsm2z36d.js → index-p16scjt7.js} +2 -2
  76. package/dist/client/static/js/{index-sdtye3jy.js → index-pc6eg8h2.js} +2 -2
  77. package/dist/client/static/js/{index-zvfvqvn9.js → index-pnt0vc59.js} +2 -2
  78. package/dist/client/static/js/{index-pbe4yed4.js → index-py2k8std.js} +2 -2
  79. package/dist/client/static/js/{index-dbe6afkf.js → index-pzbssnsc.js} +2 -2
  80. package/dist/client/static/js/{index-qckv9nte.js → index-qqz6bcdd.js} +2 -2
  81. package/dist/client/static/js/{index-xj9649ac.js → index-ray2czf6.js} +7 -7
  82. package/dist/client/static/js/{index-0tf0arsp.js → index-rbgemjsp.js} +3 -3
  83. package/dist/client/static/js/{index-vw4brsdx.js → index-rkn0bxxt.js} +1 -1
  84. package/dist/client/static/js/{index-76zb4m0n.js → index-rv89xpaf.js} +2 -2
  85. package/dist/client/static/js/index-sbd5e816.js +1 -0
  86. package/dist/client/static/js/{index-eyzeya95.js → index-sdby39w4.js} +5 -5
  87. package/dist/client/static/js/{index-0n5wwe60.js → index-t6c0pd43.js} +2 -2
  88. package/dist/client/static/js/{index-km2zb6wk.js → index-tp7yb3bv.js} +2 -2
  89. package/dist/client/static/js/{index-vw5k8csz.js → index-vnw3hbeg.js} +56 -56
  90. package/dist/client/static/js/{index-354mqqra.js → index-vq6wts05.js} +2 -2
  91. package/dist/client/static/js/{index-14vndmcr.js → index-w5373tg1.js} +2 -2
  92. package/dist/client/static/js/{index-0e40xskg.js → index-w7tpgt46.js} +1 -1
  93. package/dist/client/static/js/{index-djmg1d7h.js → index-whbtxmwh.js} +2 -2
  94. package/dist/client/static/js/{index-2svnq5gg.js → index-xs1m0bpt.js} +1 -1
  95. package/dist/client/static/js/{index-9y3gjdj7.js → index-xxtsm2rb.js} +2 -2
  96. package/dist/client/static/js/{index-hf52f59k.js → index-y3ms153k.js} +2 -2
  97. package/dist/client/static/js/{index-1a0zkj8h.js → index-yq39qbs1.js} +2 -2
  98. package/dist/client/static/js/{index-j0r5hj0j.js → index-zh2jj56s.js} +2 -2
  99. package/dist/client/static/js/info-A6RAGUB7-fmjz8qwg.js +1 -0
  100. package/dist/client/static/js/{infoDiagram-VRGFBTTK-1qj804sn.js → infoDiagram-VRGFBTTK-g2dky5xg.js} +2 -2
  101. package/dist/client/static/js/ini-72yrpvd4.js +1 -0
  102. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-4j4qsnzw.js → ishikawaDiagram-OU5B5YK6-exrcjwp1.js} +6 -6
  103. package/dist/client/static/js/java-ab5tb2ra.js +1 -0
  104. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-j0brnfft.js → journeyDiagram-ZHPQQLJL-pn752qa5.js} +4 -4
  105. package/dist/client/static/js/jsx-25zj9j3k.js +1 -0
  106. package/dist/client/static/js/{julia-4ghmfy3e.js → julia-evn99h2m.js} +1 -1
  107. package/dist/client/static/js/{kanban-definition-PNTS6WVX-qqc22br0.js → kanban-definition-PNTS6WVX-v8nvr373.js} +5 -5
  108. package/dist/client/static/js/lua-j5w0c9wm.js +1 -0
  109. package/dist/client/static/js/markdown-j6hn4377.js +1 -0
  110. package/dist/client/static/js/{mermaid.core-vv3wbe65.js → mermaid.core-egzv89zv.js} +6 -6
  111. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-y5b2z8zp.js → mindmap-definition-NLK3R4M7-t9njmv2w.js} +8 -8
  112. package/dist/client/static/js/one-dark-pro-bm3r4js7.js +1 -0
  113. package/dist/client/static/js/one-light-e07dt7sy.js +1 -0
  114. package/dist/client/static/js/packet-AYTQ26CC-cwr6n1cm.js +1 -0
  115. package/dist/client/static/js/{pegDiagram-GJSIUBJH-0be07mqs.js → pegDiagram-GJSIUBJH-zhycy2b7.js} +1 -1
  116. package/dist/client/static/js/{perl-sd00t4b4.js → perl-506fy8m8.js} +1 -1
  117. package/dist/client/static/js/{php-2zfyqa61.js → php-axtsvxck.js} +1 -1
  118. package/dist/client/static/js/pie-WAS4IAKB-h1ebfzgt.js +1 -0
  119. package/dist/client/static/js/{pieDiagram-5QR66LMP-544w86jk.js → pieDiagram-5QR66LMP-sgctvma2.js} +2 -2
  120. package/dist/client/static/js/properties-q8njes42.js +1 -0
  121. package/dist/client/static/js/python-vqxc7181.js +1 -0
  122. package/dist/client/static/js/{quadrantDiagram-O4NWA36T-p09e7z5s.js → quadrantDiagram-O4NWA36T-kzzhdcph.js} +5 -5
  123. package/dist/client/static/js/r-0k5eej8m.js +1 -0
  124. package/dist/client/static/js/radar-RG4KPBEZ-k7p1m364.js +1 -0
  125. package/dist/client/static/js/railroad-74A4TZTK-d08dw3t0.js +1 -0
  126. package/dist/client/static/js/railroad-abnf-HS5TGJTU-txnjycgk.js +1 -0
  127. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-p0r3cv6w.js +1 -0
  128. package/dist/client/static/js/railroad-peg-WCYAUIDC-sryk900a.js +1 -0
  129. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-de830ed2.js → railroadDiagram-XR7U4H2S-nzjffwxm.js} +1 -1
  130. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-b47d74p1.js → requirementDiagram-PLB6GJNP-tz4xxn4d.js} +2 -2
  131. package/dist/client/static/js/{ruby-v9qaqhby.js → ruby-qp7zfk2m.js} +1 -1
  132. package/dist/client/static/js/{rust-fkt0qyrs.js → rust-fz913fvw.js} +1 -1
  133. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-6ezc2fpj.js → sankeyDiagram-IPEJSGJF-2wcb0xr6.js} +4 -4
  134. package/dist/client/static/js/{sass-9bxped7y.js → sass-gnk9vsyp.js} +1 -1
  135. package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-by5zqj6w.js → sequenceDiagram-PO4LG4MO-vqgebfns.js} +18 -18
  136. package/dist/client/static/js/{sizeCapture-INFHLROL-q85r06j6.js → sizeCapture-INFHLROL-xc314tes.js} +1 -1
  137. package/dist/client/static/js/sql-0e9mnrda.js +1 -0
  138. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-ep5pyexs.js → stateDiagram-v2-GCMORJYK-8bd9b1h8.js} +3 -3
  139. package/dist/client/static/js/{svelte-mwtx07d9.js → svelte-brpgzrtv.js} +1 -1
  140. package/dist/client/static/js/{swimlanes-2SLR337P-95fcqkh8.js → swimlanes-2SLR337P-t6hbdzcw.js} +1 -1
  141. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-c1czc7kv.js +8 -0
  142. package/dist/client/static/js/{timeline-definition-EJHVYXUP-461e615g.js → timeline-definition-EJHVYXUP-2txxasx5.js} +4 -4
  143. package/dist/client/static/js/treeView-Q6P3EWNA-77kj68p1.js +1 -0
  144. package/dist/client/static/js/treemap-WGGIJYW6-rw94xc82.js +1 -0
  145. package/dist/client/static/js/tsx-yd5wt250.js +1 -0
  146. package/dist/client/static/js/typescript-v7z7crfe.js +1 -0
  147. package/dist/client/static/js/{usecaseDiagram-POWQR4AR-ftqfnvhg.js → usecaseDiagram-POWQR4AR-3x353hn4.js} +17 -17
  148. package/dist/client/static/js/{vennDiagram-UO4OBE2U-7t96h6ez.js → vennDiagram-UO4OBE2U-cerpss8e.js} +7 -7
  149. package/dist/client/static/js/{vue-j8vb9d7r.js → vue-apnkw9qy.js} +1 -1
  150. package/dist/client/static/js/wardley-WFR3VGLG-18xe4fhz.js +1 -0
  151. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-0de8w8c6.js → wardleyDiagram-VNRHLVJA-cx6jfsbf.js} +4 -4
  152. package/dist/client/static/js/xml-94fhzrfs.js +1 -0
  153. package/dist/client/static/js/{xychartDiagram-PMCCYNJV-dez9phkf.js → xychartDiagram-PMCCYNJV-tgn23xj1.js} +5 -5
  154. package/dist/client/static/js/yaml-s8af9rnw.js +1 -0
  155. package/package.json +4 -1
  156. package/src/client/components/auth/login-screen/index.tsx +1 -0
  157. package/src/client/components/common/MarkdownRenderer.tsx +9 -12
  158. package/src/client/components/settings/Modal.tsx +14 -84
  159. package/src/client/components/settings/Sidebar.tsx +3 -1
  160. package/src/client/components/settings/categories/ConnectSettings.tsx +105 -0
  161. package/src/client/components/settings/categories/connect-settings/DeviceTable.tsx +145 -0
  162. package/src/client/components/settings/categories/connect-settings/PairDialog.test.tsx +159 -0
  163. package/src/client/components/settings/categories/connect-settings/PairDialog.tsx +189 -0
  164. package/src/client/components/settings/categories/connect-settings/QrCode.tsx +56 -0
  165. package/src/client/components/settings/categories/connect-settings/ServerCard.tsx +94 -0
  166. package/src/client/components/settings/categories/connect-settings/TunnelRow.tsx +127 -0
  167. package/src/client/components/settings/categories/connect-settings/qr-image.ts +76 -0
  168. package/src/client/components/settings/category-content.tsx +116 -0
  169. package/src/client/components/workspace/chat-timeline/ChangedFilesSummary.test.tsx +120 -0
  170. package/src/client/components/workspace/chat-timeline/ChangedFilesSummary.tsx +56 -20
  171. package/src/client/components/workspace/chat-timeline/RunFooter.tsx +1 -0
  172. package/src/client/components/workspace/git-panel/init-state.test.ts +5 -0
  173. package/src/client/hooks/chat/composer/speech-to-text.ts +24 -17
  174. package/src/client/hooks/chat/timeline/change-stats.ts +57 -0
  175. package/src/client/hooks/connect/use-connect-status.ts +116 -0
  176. package/src/client/hooks/connect/use-pairing.ts +100 -0
  177. package/src/client/hooks/editor/file-actions.ts +3 -11
  178. package/src/client/hooks/editor/font.test.ts +2 -1
  179. package/src/client/hooks/editor/use-file-transfer.ts +2 -1
  180. package/src/client/hooks/ui/clipboard.ts +26 -0
  181. package/src/client/lib/browser/download.ts +22 -0
  182. package/src/client/tailwind.css +5 -0
  183. package/src/server/index.ts +2 -0
  184. package/src/server/lib/assets/font-css.server.test.ts +19 -0
  185. package/src/server/lib/auth/client-address.test.ts +58 -0
  186. package/src/server/lib/auth/client-address.ts +37 -3
  187. package/src/server/lib/auth/guard.ts +31 -4
  188. package/src/server/lib/auth/rate-limit.test.ts +25 -8
  189. package/src/server/lib/auth/rate-limit.ts +8 -5
  190. package/src/server/lib/connect/cloudflared.lifecycle.test.ts +88 -0
  191. package/src/server/lib/connect/cloudflared.server.test.ts +65 -0
  192. package/src/server/lib/connect/cloudflared.server.ts +206 -0
  193. package/src/server/lib/connect/devices.server.ts +192 -0
  194. package/src/server/lib/connect/identity.server.ts +81 -0
  195. package/src/server/lib/connect/pairing.server.test.ts +56 -0
  196. package/src/server/lib/connect/pairing.server.ts +113 -0
  197. package/src/server/lib/connect/qr.roundtrip.test.ts +106 -0
  198. package/src/server/lib/connect/qr.server.ts +36 -0
  199. package/src/server/lib/connect/run.server.ts +101 -0
  200. package/src/server/lib/connect/status.server.ts +177 -0
  201. package/src/server/lib/connect/tailscale.server.test.ts +117 -0
  202. package/src/server/lib/connect/tailscale.server.ts +172 -0
  203. package/src/server/lib/db/schema.ts +4 -0
  204. package/src/server/lib/omp/session/changes.test.ts +64 -1
  205. package/src/server/lib/omp/session/changes.ts +94 -1
  206. package/src/server/routes/connect/devices.ts +56 -0
  207. package/src/server/routes/connect/index.ts +15 -0
  208. package/src/server/routes/connect/pair-page.ts +177 -0
  209. package/src/server/routes/connect/pair.ts +158 -0
  210. package/src/server/routes/connect/status.ts +19 -0
  211. package/src/server/routes/connect/tunnels.ts +76 -0
  212. package/src/server/routes/health/probe.ts +5 -0
  213. package/src/server/routes/index.ts +2 -0
  214. package/src/server/routes/sessions/changes.test.ts +12 -3
  215. package/src/server/routes/sessions/changes.ts +27 -3
  216. package/src/server/routes/sessions/index.ts +2 -1
  217. package/src/shared/lib/connect/payload.test.ts +144 -0
  218. package/src/shared/lib/connect/payload.ts +229 -0
  219. package/src/shared/lib/connect/tier.test.ts +73 -0
  220. package/src/shared/lib/connect/tier.ts +105 -0
  221. package/src/shared/lib/connect/types.ts +99 -0
  222. package/src/shared/lib/dictation/capture-failure.test.ts +46 -0
  223. package/src/shared/lib/dictation/capture-failure.ts +36 -0
  224. package/src/shared/lib/markdown/fira-code-fonts.css +65 -6
  225. package/src/shared/lib/markdown/marked.ts +7 -4
  226. package/src/shared/lib/markdown/mermaid-actions.test.ts +78 -0
  227. package/src/shared/lib/markdown/mermaid-actions.ts +45 -0
  228. package/src/shared/lib/markdown/mermaid.ts +41 -7
  229. package/src/shared/lib/settings/sections.ts +6 -1
  230. package/src/shared/types/session-changes.ts +6 -0
  231. package/src/shared/types/settings/state.ts +2 -0
  232. package/dist/client/static/js/Modal-qtftcp2t.js +0 -38
  233. package/dist/client/static/js/architecture-7GRP2DOG-tavtgb8a.js +0 -1
  234. package/dist/client/static/js/bash-b3rwyg5p.js +0 -1
  235. package/dist/client/static/js/cpp-y0t6mynx.js +0 -1
  236. package/dist/client/static/js/css-6vj0d308.js +0 -1
  237. package/dist/client/static/js/cynefin-OW5HDTMX-cdh3n2z2.js +0 -1
  238. package/dist/client/static/js/eventmodeling-NTZA5JFV-as97tpyp.js +0 -1
  239. package/dist/client/static/js/flowDiagram-KWPJA3E3-ggm06d12.js +0 -1
  240. package/dist/client/static/js/gitGraph-4MIJSDKK-eqz7p9ng.js +0 -1
  241. package/dist/client/static/js/graphql-n43pd5fs.js +0 -1
  242. package/dist/client/static/js/index-at6bhjyf.js +0 -1
  243. package/dist/client/static/js/index-bkye8mz4.js +0 -2
  244. package/dist/client/static/js/index-e94a1en0.css +0 -1
  245. package/dist/client/static/js/index-sffjtm5w.js +0 -12
  246. package/dist/client/static/js/info-A6RAGUB7-4pkzh1qx.js +0 -1
  247. package/dist/client/static/js/ini-j5dyq6gm.js +0 -1
  248. package/dist/client/static/js/java-g4dgwbfd.js +0 -1
  249. package/dist/client/static/js/jsx-7t5ecz9s.js +0 -1
  250. package/dist/client/static/js/lua-1g6w30de.js +0 -1
  251. package/dist/client/static/js/markdown-afx21x8c.js +0 -1
  252. package/dist/client/static/js/one-dark-pro-hm3f56n1.js +0 -1
  253. package/dist/client/static/js/one-light-xrz49rct.js +0 -1
  254. package/dist/client/static/js/packet-AYTQ26CC-yg71sp88.js +0 -1
  255. package/dist/client/static/js/pie-WAS4IAKB-89wd6np0.js +0 -1
  256. package/dist/client/static/js/properties-thd83wey.js +0 -1
  257. package/dist/client/static/js/python-264ns4xw.js +0 -1
  258. package/dist/client/static/js/r-qw82kkv9.js +0 -1
  259. package/dist/client/static/js/radar-RG4KPBEZ-avn0b8r9.js +0 -1
  260. package/dist/client/static/js/railroad-74A4TZTK-de27xv5w.js +0 -1
  261. package/dist/client/static/js/railroad-abnf-HS5TGJTU-rg4zzj7x.js +0 -1
  262. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-d84fhj8v.js +0 -1
  263. package/dist/client/static/js/railroad-peg-WCYAUIDC-dvf8xrmc.js +0 -1
  264. package/dist/client/static/js/sql-g8wcshpc.js +0 -1
  265. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-xs2en5dv.js +0 -8
  266. package/dist/client/static/js/treeView-Q6P3EWNA-mham0bh6.js +0 -1
  267. package/dist/client/static/js/treemap-WGGIJYW6-mxrxax86.js +0 -1
  268. package/dist/client/static/js/tsx-nm94hed6.js +0 -1
  269. package/dist/client/static/js/typescript-0s2t05jj.js +0 -1
  270. package/dist/client/static/js/wardley-WFR3VGLG-8vrvh9p3.js +0 -1
  271. package/dist/client/static/js/xml-dz51p1m3.js +0 -1
  272. package/dist/client/static/js/yaml-2cfkd30t.js +0 -1
@@ -0,0 +1,56 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * `GET /api/connect/devices` — the paired list.
8
+ * `DELETE /api/connect/devices?id=…` — revoke one.
9
+ * `POST /api/connect/devices` — a device reports the route it is using.
10
+ *
11
+ * The report is a POST rather than a side effect of every request: the auth gate
12
+ * runs on every call and is synchronous, so writing a row there would put a
13
+ * database write in front of every frame. A device reports once when it
14
+ * connects, which is exactly the fact the page displays.
15
+ */
16
+
17
+ import { json, NO_STORE_HEADERS, type ActionFunctionArgs } from '@/server/lib/remix-compat';
18
+ import { listPairedDevices, revokeDevice, touchDevice } from '@/server/lib/connect/devices.server';
19
+ import { bearerToken } from '@/server/lib/sessions/agent-token.server';
20
+ import { verifyDeviceToken } from '@/server/lib/connect/devices.server';
21
+ import type { ConnectRouteKind } from '@/shared/lib/connect/types';
22
+
23
+ const ROUTE_KINDS: readonly ConnectRouteKind[] = ['cloudflare', 'lan', 'tailscale'];
24
+
25
+ export async function loader() {
26
+ return json({ devices: await listPairedDevices() }, { headers: NO_STORE_HEADERS });
27
+ }
28
+
29
+ export async function action({ request }: ActionFunctionArgs) {
30
+ const url = new URL(request.url);
31
+
32
+ if (request.method === 'DELETE') {
33
+ const id = url.searchParams.get('id') ?? '';
34
+ if (!id) return json({ error: 'Expected ?id=' }, { status: 400, headers: NO_STORE_HEADERS });
35
+ const revoked = await revokeDevice(id);
36
+ if (!revoked) return json({ error: 'No such device' }, { status: 404, headers: NO_STORE_HEADERS });
37
+ return json({ ok: true, devices: await listPairedDevices() }, { headers: NO_STORE_HEADERS });
38
+ }
39
+
40
+ if (request.method === 'POST') {
41
+ const deviceId = verifyDeviceToken(bearerToken(request));
42
+ if (!deviceId) {
43
+ return json({ error: 'A device token is required' }, { status: 401, headers: NO_STORE_HEADERS });
44
+ }
45
+ const body = (await request.json().catch(() => null)) as { route?: unknown; rttMs?: unknown } | null;
46
+ const route = ROUTE_KINDS.find((kind) => kind === body?.route);
47
+ const rttMs = typeof body?.rttMs === 'number' && Number.isFinite(body.rttMs) ? Math.round(body.rttMs) : null;
48
+ if (!route || rttMs === null) {
49
+ return json({ error: 'Expected { route, rttMs }' }, { status: 400, headers: NO_STORE_HEADERS });
50
+ }
51
+ await touchDevice(deviceId, { route, rttMs });
52
+ return json({ ok: true }, { headers: NO_STORE_HEADERS });
53
+ }
54
+
55
+ return json({ error: 'Method not allowed' }, { status: 405, headers: NO_STORE_HEADERS });
56
+ }
@@ -0,0 +1,15 @@
1
+ import { bindingsFor, type HandlerBinding } from '@/server/lib/route-adapter';
2
+ import * as connectStatus from '@/server/routes/connect/status';
3
+ import * as connectTunnels from '@/server/routes/connect/tunnels';
4
+ import * as connectDevices from '@/server/routes/connect/devices';
5
+ import * as connectPair from '@/server/routes/connect/pair';
6
+ import * as connectPairPage from '@/server/routes/connect/pair-page';
7
+
8
+ export const connectBindings: HandlerBinding[] = [
9
+ ...bindingsFor(connectStatus, '/api/connect/status'),
10
+ ...bindingsFor(connectTunnels, '/api/connect/tunnels'),
11
+ ...bindingsFor(connectDevices, '/api/connect/devices'),
12
+ ...bindingsFor(connectPair, '/api/connect/pair'),
13
+ ...bindingsFor(connectPair, '/api/connect/pair/claim'),
14
+ ...bindingsFor(connectPairPage, '/pair'),
15
+ ];
@@ -0,0 +1,177 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * `GET /pair` — the page a phone's camera opens.
8
+ *
9
+ * This is what makes a pairing code usable WITHOUT a native scanner: the QR
10
+ * encodes an `https://<address>/pair#<payload>` URL, the phone's own camera app
11
+ * opens it in the browser, and this page redeems the code and lands the browser
12
+ * on the console with a device cookie already set.
13
+ *
14
+ * The payload lives in the FRAGMENT, never the query string. A fragment is not
15
+ * sent to the server, so the one-time secret never reaches an access log, a
16
+ * proxy, or the `Referer` of anything this page loads. The page reads it with
17
+ * `location.hash` and posts it once.
18
+ *
19
+ * No external assets and no framework: this page has to render on a phone that
20
+ * has never reached this server before, over a link that may be slow, and a
21
+ * bundle that fails to load would leave the user staring at a blank screen with
22
+ * a code that is already burning its two minutes.
23
+ */
24
+
25
+ import { NO_STORE_HEADERS } from '@/server/lib/remix-compat';
26
+
27
+ const PAGE = `<!doctype html>
28
+ <html lang="en">
29
+ <head>
30
+ <meta charset="utf-8">
31
+ <meta name="viewport" content="width=device-width, initial-scale=1">
32
+ <meta name="robots" content="noindex">
33
+ <title>Pair with Kabmo</title>
34
+ <style>
35
+ :root { color-scheme: light dark; }
36
+ body { margin: 0; min-height: 100vh; display: grid; place-items: center;
37
+ font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
38
+ background: #f7f5f0; color: #141310; }
39
+ main { width: min(28rem, calc(100vw - 3rem)); padding: 1.5rem;
40
+ border: 1px solid rgba(20,19,16,.12); border-radius: 14px; background: #fff; }
41
+ h1 { margin: 0 0 .5rem; font-size: 1.05rem; }
42
+ p { margin: 0; color: rgba(20,19,16,.65); font-size: .85rem; }
43
+ a { display: inline-block; margin-top: 1rem; padding: .5rem .9rem; border-radius: 8px;
44
+ background: #141310; color: #f7f5f0; text-decoration: none; font-weight: 600; font-size: .85rem; }
45
+ @media (prefers-color-scheme: dark) {
46
+ body { background: #141310; color: #f7f5f0; }
47
+ main { background: #1d1b17; border-color: rgba(247,245,240,.14); }
48
+ p { color: rgba(247,245,240,.65); }
49
+ a { background: #f7f5f0; color: #141310; }
50
+ }
51
+ </style>
52
+ </head>
53
+ <body>
54
+ <main>
55
+ <h1>Pair with Kabmo</h1>
56
+ <p id="status">Pairing…</p>
57
+ <a id="continue" href="/" hidden>Open the console</a>
58
+ </main>
59
+ <script>
60
+ (function () {
61
+ var status = document.getElementById('status');
62
+ var link = document.getElementById('continue');
63
+
64
+ function fail(message) {
65
+ status.textContent = message;
66
+ }
67
+
68
+ function decode(value) {
69
+ var padded = value.replace(/-/g, '+').replace(/_/g, '/');
70
+ while (padded.length % 4) padded += '=';
71
+ var binary = atob(padded);
72
+ var bytes = new Uint8Array(binary.length);
73
+ for (var i = 0; i < binary.length; i += 1) bytes[i] = binary.charCodeAt(i);
74
+ return new TextDecoder().decode(bytes);
75
+ }
76
+
77
+ function deviceName() {
78
+ var ua = navigator.userAgent || '';
79
+ if (/iPhone/.test(ua)) return 'iPhone';
80
+ if (/iPad/.test(ua)) return 'iPad';
81
+ if (/Android/.test(ua)) return 'Android device';
82
+ if (/Macintosh/.test(ua)) return 'Mac';
83
+ if (/Windows/.test(ua)) return 'Windows PC';
84
+ return 'Browser';
85
+ }
86
+
87
+ function platform() {
88
+ var ua = navigator.userAgent || '';
89
+ if (/iPhone|iPad|iPod/.test(ua)) return 'ios';
90
+ if (/Android/.test(ua)) return 'android';
91
+ if (/Macintosh/.test(ua)) return 'macos';
92
+ if (/Windows/.test(ua)) return 'windows';
93
+ if (/Linux/.test(ua)) return 'linux';
94
+ return 'web';
95
+ }
96
+
97
+ var raw = location.hash.slice(1);
98
+ if (!raw) { fail('This link is missing its pairing code. Create a new one in Settings → Connect.'); return; }
99
+
100
+ var payload;
101
+ try {
102
+ payload = JSON.parse(decode(raw));
103
+ } catch (error) {
104
+ fail('This link is not a Kabmo pairing code.');
105
+ return;
106
+ }
107
+ if (!payload || !payload.pairingId || !payload.secret) {
108
+ fail('This link is not a Kabmo pairing code.');
109
+ return;
110
+ }
111
+
112
+ // Which candidate this page was opened from, and how fast it answers.
113
+ //
114
+ // The page is served BY the origin it is pairing with, so location.origin
115
+ // matches exactly one candidate — this is a fact, not a guess. The round trip
116
+ // is measured here because the server cannot measure a phone's latency, and
117
+ // the device row's ROUTE/RTT columns are otherwise always empty.
118
+ var route = null;
119
+ var candidates = payload.candidates || [];
120
+ for (var i = 0; i < candidates.length; i += 1) {
121
+ if (candidates[i] && candidates[i].url === location.origin) { route = candidates[i].kind; break; }
122
+ }
123
+
124
+ function measure() {
125
+ if (!window.performance || !performance.now) return Promise.resolve(null);
126
+ var started = performance.now();
127
+ return fetch('/api/health', { cache: 'no-store' })
128
+ .then(function (response) { return response.ok ? Math.round(performance.now() - started) : null; })
129
+ .catch(function () { return null; });
130
+ }
131
+
132
+ measure().then(function (rttMs) {
133
+ var body = {
134
+ pairingId: payload.pairingId,
135
+ secret: payload.secret,
136
+ name: deviceName(),
137
+ platform: platform()
138
+ };
139
+ if (route) body.route = route;
140
+ if (rttMs !== null) body.rttMs = rttMs;
141
+
142
+ return fetch('/api/connect/pair/claim', {
143
+ method: 'POST',
144
+ headers: { 'content-type': 'application/json' },
145
+ body: JSON.stringify(body)
146
+ });
147
+ }).then(function (response) {
148
+ return response.json().catch(function () { return null; }).then(function (body) {
149
+ if (!response.ok) {
150
+ fail((body && body.error) || 'This pairing code could not be redeemed.');
151
+ return;
152
+ }
153
+ status.textContent = 'Paired. Opening the console…';
154
+ link.hidden = false;
155
+ location.replace('/');
156
+ });
157
+ }).catch(function () {
158
+ fail('Could not reach the server. Check that this device is on the same network or tailnet.');
159
+ });
160
+ })();
161
+ </script>
162
+ </body>
163
+ </html>`;
164
+
165
+ export async function loader() {
166
+ return new Response(PAGE, {
167
+ status: 200,
168
+ headers: {
169
+ 'content-type': 'text/html; charset=utf-8',
170
+ ...NO_STORE_HEADERS,
171
+ // The page reads a fragment and posts it once; nothing it loads may leak
172
+ // the URL onward.
173
+ 'referrer-policy': 'no-referrer',
174
+ 'x-content-type-options': 'nosniff',
175
+ },
176
+ });
177
+ }
@@ -0,0 +1,158 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * `POST /api/connect/pair` — mint a one-time code and its QR.
8
+ * `POST /api/connect/pair/claim` — redeem it for a device token.
9
+ *
10
+ * The two halves have different auth on purpose. Minting requires a session: it
11
+ * is the operator handing out access. Claiming is PUBLIC, because the device
12
+ * doing it has no cookie yet — the one-time secret IS the credential, and it is
13
+ * 32 random bytes with a two-minute life, so it cannot be guessed and cannot be
14
+ * replayed.
15
+ *
16
+ * The claim answers with the server's `serverId` so the device can confirm it
17
+ * reached the machine the QR named. A device that pinned an id and gets a
18
+ * different one must refuse the token it was just handed.
19
+ */
20
+
21
+ import { json, NO_STORE_HEADERS, type ActionFunctionArgs } from '@/server/lib/remix-compat';
22
+ import { connectIdentity } from '@/server/lib/connect/identity.server';
23
+ import { connectStatus } from '@/server/lib/connect/status.server';
24
+ import { createPairing, consumePairing } from '@/server/lib/connect/pairing.server';
25
+ import { mintDeviceToken, touchDevice, DEVICE_COOKIE } from '@/server/lib/connect/devices.server';
26
+ import { isSecureRequest } from '@/server/lib/auth/token';
27
+ import { qrMatrix } from '@/server/lib/connect/qr.server';
28
+ import { encodePairingFragment, encodePairingPayload, PAIRING_VERSION } from '@/shared/lib/connect/payload';
29
+ import { ROUTE_TIER } from '@/shared/lib/connect/tier';
30
+ import type { ConnectCandidate, ConnectRouteKind } from '@/shared/lib/connect/types';
31
+
32
+ const ROUTE_KINDS: readonly ConnectRouteKind[] = ['cloudflare', 'lan', 'tailscale'];
33
+
34
+ /**
35
+ * How long the device cookie lives, in seconds.
36
+ *
37
+ * 400 days is the longest Chrome honours; the token itself never expires, so this
38
+ * is the browser's cap rather than a policy. Revocation is the control that ends
39
+ * a pairing, not time.
40
+ */
41
+ const DEVICE_COOKIE_MAX_AGE = 400 * 24 * 60 * 60;
42
+
43
+ interface ClaimRequest {
44
+ action?: unknown;
45
+ pairingId?: unknown;
46
+ secret?: unknown;
47
+ name?: unknown;
48
+ platform?: unknown;
49
+ route?: unknown;
50
+ rttMs?: unknown;
51
+ }
52
+
53
+ export async function action({ request }: ActionFunctionArgs) {
54
+ if (request.method !== 'POST') {
55
+ return json({ error: 'Method not allowed' }, { status: 405, headers: NO_STORE_HEADERS });
56
+ }
57
+
58
+ const url = new URL(request.url);
59
+ const body = (await request.json().catch(() => null)) as ClaimRequest | null;
60
+ const isClaim = url.pathname.endsWith('/claim');
61
+
62
+ if (isClaim) {
63
+ const pairingId = typeof body?.pairingId === 'string' ? body.pairingId : '';
64
+ const secret = typeof body?.secret === 'string' ? body.secret : '';
65
+ if (!pairingId || !secret) {
66
+ return json({ error: 'Expected { pairingId, secret }' }, { status: 400, headers: NO_STORE_HEADERS });
67
+ }
68
+
69
+ const consumed = consumePairing(pairingId, secret);
70
+ if (!consumed.ok) {
71
+ return json({ error: consumed.reason }, { status: 410, headers: NO_STORE_HEADERS });
72
+ }
73
+
74
+ const name = typeof body?.name === 'string' ? body.name : 'Device';
75
+ const platform = typeof body?.platform === 'string' ? body.platform : 'unknown';
76
+ const device = await mintDeviceToken({ name, platform });
77
+
78
+ const route = ROUTE_KINDS.find((kind) => kind === body?.route);
79
+ const rttMs = typeof body?.rttMs === 'number' && Number.isFinite(body.rttMs) ? Math.round(body.rttMs) : null;
80
+ if (route && rttMs !== null) await touchDevice(device.id, { route, rttMs });
81
+
82
+ // The cookie is what a webview can actually send: it cannot attach an
83
+ // `Authorization` header to its own page requests or to a WebSocket upgrade.
84
+ // `HttpOnly` keeps it away from page script; `SameSite=Lax` is enough because
85
+ // every request that matters is same-origin.
86
+ //
87
+ // `Max-Age` is what makes pairing survive a restart. Without it the cookie is
88
+ // a SESSION cookie, which the browser drops when it closes — so a paired phone
89
+ // asked for a password again the next morning, and the whole point of pairing
90
+ // is that it does not. The token itself has no expiry in the database (only
91
+ // revocation), so the cookie's life is the browser's cap rather than a policy:
92
+ // 400 days is the longest Chrome honours.
93
+ const secure = isSecureRequest(request) ? '; Secure' : '';
94
+ return json(
95
+ {
96
+ deviceId: device.id,
97
+ token: device.token,
98
+ serverId: connectIdentity().serverId,
99
+ candidates: consumed.candidates,
100
+ },
101
+ {
102
+ headers: {
103
+ ...NO_STORE_HEADERS,
104
+ 'set-cookie': `${DEVICE_COOKIE}=${encodeURIComponent(device.token)}; Path=/; Max-Age=${DEVICE_COOKIE_MAX_AGE}; HttpOnly; SameSite=Lax${secure}`,
105
+ },
106
+ },
107
+ );
108
+ }
109
+
110
+ // Minting. Only the addresses that actually answer go into the code: a
111
+ // candidate the device cannot reach would make the first probe fail for no
112
+ // reason, and the page already shows the unavailable ones with their reason.
113
+ const status = await connectStatus();
114
+ const candidates: ConnectCandidate[] = status.addresses
115
+ .filter((address) => address.unavailable === null && address.url !== '')
116
+ .map((address) => ({ kind: address.kind, url: address.url }));
117
+
118
+ if (candidates.length === 0) {
119
+ return json(
120
+ {
121
+ error:
122
+ 'No reachable address to put in a pairing code. Turn on Tailscale Serve, or start this server with --lan.',
123
+ },
124
+ { status: 409, headers: NO_STORE_HEADERS },
125
+ );
126
+ }
127
+
128
+ const pairing = createPairing(candidates);
129
+ const payload = {
130
+ v: PAIRING_VERSION as 1,
131
+ pairingId: pairing.pairingId,
132
+ secret: pairing.secret,
133
+ serverId: status.serverId,
134
+ label: status.label,
135
+ expiresAt: pairing.expiresAt,
136
+ candidates,
137
+ };
138
+ const link = encodePairingPayload(payload);
139
+
140
+ // The QR carries the BROWSER link, not the deep link: a phone's camera app
141
+ // opens an https URL in the browser, which is what makes pairing work with no
142
+ // native scanner. The best candidate is the lowest tier — Tailscale before
143
+ // LAN, because the LAN origin is not a secure context.
144
+ const best = [...candidates].sort((left, right) => ROUTE_TIER[left.kind] - ROUTE_TIER[right.kind])[0];
145
+ const webLink = `${best.url}/pair#${encodePairingFragment(payload)}`;
146
+
147
+ return json(
148
+ {
149
+ pairingId: pairing.pairingId,
150
+ expiresAt: pairing.expiresAt,
151
+ link,
152
+ webLink,
153
+ candidates,
154
+ qr: qrMatrix(webLink),
155
+ },
156
+ { headers: NO_STORE_HEADERS },
157
+ );
158
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * `GET /api/connect/status` — everything the Connect page draws.
8
+ *
9
+ * Authenticated like every other API route: the payload names the machine, its
10
+ * addresses and its paired devices, which is reconnaissance a stranger should
11
+ * not get for free.
12
+ */
13
+
14
+ import { json, NO_STORE_HEADERS } from '@/server/lib/remix-compat';
15
+ import { connectStatus } from '@/server/lib/connect/status.server';
16
+
17
+ export async function loader() {
18
+ return json(await connectStatus(), { headers: NO_STORE_HEADERS });
19
+ }
@@ -0,0 +1,76 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * `POST /api/connect/tunnels` — start or stop one provider.
8
+ *
9
+ * 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.
12
+ *
13
+ * A refusal carries the provider's own sentence. "Tailscale refused: HTTPS is
14
+ * not enabled for this tailnet" is actionable; `{ ok: false }` is not.
15
+ */
16
+
17
+ import { json, NO_STORE_HEADERS, type ActionFunctionArgs } from '@/server/lib/remix-compat';
18
+ import { connectStatus, currentPort } from '@/server/lib/connect/status.server';
19
+ import { findTailscale, startServe, stopServe } from '@/server/lib/connect/tailscale.server';
20
+ import {
21
+ findCloudflared,
22
+ readCloudflaredConfig,
23
+ startCloudflared,
24
+ stopCloudflared,
25
+ } from '@/server/lib/connect/cloudflared.server';
26
+
27
+ interface TunnelRequest {
28
+ provider?: unknown;
29
+ action?: unknown;
30
+ }
31
+
32
+ export async function action({ request }: ActionFunctionArgs) {
33
+ if (request.method !== 'POST') {
34
+ return json({ error: 'Method not allowed' }, { status: 405, headers: NO_STORE_HEADERS });
35
+ }
36
+
37
+ const body = (await request.json().catch(() => null)) as TunnelRequest | null;
38
+ const provider = body?.provider;
39
+ const verb = body?.action;
40
+ if ((provider !== 'tailscale' && provider !== 'cloudflare') || (verb !== 'start' && verb !== 'stop')) {
41
+ return json(
42
+ { error: 'Expected { provider: "tailscale" | "cloudflare", action: "start" | "stop" }' },
43
+ { status: 400, headers: NO_STORE_HEADERS },
44
+ );
45
+ }
46
+
47
+ const port = currentPort();
48
+ let failure: string | null = null;
49
+
50
+ if (provider === 'tailscale') {
51
+ const presence = findTailscale();
52
+ if (!presence.binary) {
53
+ failure = presence.reason;
54
+ } else {
55
+ const outcome = verb === 'start' ? await startServe(presence.binary, port) : await stopServe(presence.binary);
56
+ if (!outcome.ok) failure = outcome.reason;
57
+ }
58
+ } else if (verb === 'stop') {
59
+ stopCloudflared(port);
60
+ } else {
61
+ const presence = findCloudflared();
62
+ const config = presence.configPath ? readCloudflaredConfig(presence.configPath) : null;
63
+ if (presence.reason || !presence.binary || !presence.configPath || !config?.hostname) {
64
+ failure = presence.reason ?? 'cloudflared is not configured.';
65
+ } else {
66
+ const outcome = await startCloudflared(presence.binary, presence.configPath, config.hostname, port);
67
+ if (!outcome.ok) failure = outcome.reason;
68
+ }
69
+ }
70
+
71
+ const status = await connectStatus();
72
+ return json(
73
+ failure ? { ok: false, error: failure, status } : { ok: true, status },
74
+ { status: failure ? 400 : 200, headers: NO_STORE_HEADERS },
75
+ );
76
+ }
@@ -8,6 +8,7 @@ import { isTrayEnabledByArgv } from '@/server/lib/lifecycle/argv-flags';
8
8
  import { isTlsEnabledByArgv } from '@/server/lib/lifecycle/tls';
9
9
  import { isMockMode } from '@/server/mock.server';
10
10
  import { pluginPlatformReady } from '@/server/lib/plugins/loader.server';
11
+ import { connectIdentity } from '@/server/lib/connect/identity.server';
11
12
 
12
13
  const STARTED_AT = Date.now();
13
14
  const STARTED_ISO = new Date(STARTED_AT).toISOString();
@@ -46,6 +47,10 @@ export async function loader() {
46
47
  // address, so a LAN-bound instance with no password — reachable by anyone
47
48
  // on the network — is visible from the CLI instead of only from a browser.
48
49
  authEnabled: isAuthEnabled(),
50
+ // Stable identity of this install, derived from a persisted key. A paired
51
+ // device pins it and refuses an address that answers with a different one,
52
+ // which is what stops a reassigned LAN address from receiving its token.
53
+ serverId: connectIdentity().serverId,
49
54
  // Reported so discovery does not have to guess the scheme: `status` and
50
55
  // `findLiveInstance` read it to build the URL they print and probe.
51
56
  tls: isTlsEnabledByArgv(),
@@ -31,6 +31,7 @@ import { harnessBindings } from '@/server/routes/harness';
31
31
  import { healthBindings } from '@/server/routes/health';
32
32
  import { wellKnownBindings } from '@/server/routes/well-known';
33
33
  import { notificationsBindings } from '@/server/routes/notifications';
34
+ import { connectBindings } from '@/server/routes/connect';
34
35
 
35
36
  const allBindings: HandlerBinding[] = [
36
37
  ...authBindings,
@@ -61,6 +62,7 @@ const allBindings: HandlerBinding[] = [
61
62
  ...pluginsBindings,
62
63
  ...healthBindings,
63
64
  ...notificationsBindings,
65
+ ...connectBindings,
64
66
  ...wellKnownBindings,
65
67
  ];
66
68
 
@@ -19,7 +19,7 @@ import { clearSessionFileCaches } from '@/server/lib/omp/session/files';
19
19
  import { getSessionChangeDiff, getSessionChanges } from '@/server/routes/sessions/changes';
20
20
 
21
21
  const SESSION_ID = '01a0cc50-fd62-7417-899c-e24ff8c8608c';
22
- const CWD = '/tmp/project';
22
+ let CWD = '';
23
23
  let agentDir = '';
24
24
  let journalDir = '';
25
25
 
@@ -34,6 +34,10 @@ function args(sessionId: string | undefined, query = ''): LoaderFunctionArgs {
34
34
  beforeAll(async () => {
35
35
  agentDir = await fsp.mkdtemp(path.join(os.tmpdir(), 'omp-changes-route-'));
36
36
  process.env.PI_CODING_AGENT_DIR = agentDir;
37
+ CWD = path.join(agentDir, 'project');
38
+ await fsp.mkdir(CWD, { recursive: true });
39
+ // The list drops a creation whose file is gone, so the kept one must exist.
40
+ await fsp.writeFile(path.join(CWD, 'a.ts'), 'one\n');
37
41
  const cwdDir = path.join(agentDir, 'sessions', '-tmp-project');
38
42
  await fsp.mkdir(cwdDir, { recursive: true });
39
43
  const sessionFile = path.join(cwdDir, `2026-01-01T00-00-00-000Z_${SESSION_ID}.jsonl`);
@@ -47,7 +51,12 @@ beforeAll(async () => {
47
51
  await fsp.writeFile(path.join(journalDir, 'blobs', after), Bun.gzipSync(Buffer.from('one\n', 'utf8')));
48
52
  await fsp.writeFile(
49
53
  path.join(journalDir, 'changes.jsonl'),
50
- `${JSON.stringify({ type: 'change', at: 1000, agent: 'Main', tool: 'write', path: `${CWD}/a.ts`, before: null, after })}\n`,
54
+ [
55
+ JSON.stringify({ type: 'change', at: 1000, agent: 'Main', tool: 'write', path: `${CWD}/a.ts`, before: null, after }),
56
+ // Created then `rm`'d: the journal has no delete record, so the list must
57
+ // drop it by checking the path.
58
+ JSON.stringify({ type: 'change', at: 1001, agent: 'Main', tool: 'write', path: `${CWD}/gone.ts`, before: null, after }),
59
+ ].join('\n') + '\n',
51
60
  );
52
61
  clearSessionFileCaches();
53
62
  });
@@ -59,7 +68,7 @@ afterAll(async () => {
59
68
  });
60
69
 
61
70
  describe('getSessionChanges', () => {
62
- test('answers the records for a real session', async () => {
71
+ test('answers the records for a real session, minus a creation whose file is gone', async () => {
63
72
  const response = (await getSessionChanges(args(SESSION_ID))) as Response;
64
73
  expect(response.status).toBe(200);
65
74
  const body = (await response.json()) as { records: Array<{ displayPath: string }> };
@@ -9,12 +9,18 @@
9
9
  * GET /api/sessions/:sessionId/changes
10
10
  * Every `change` record, oldest first, with a display path. No blob
11
11
  * content: the client buckets records into runs and only asks for a diff
12
- * when a file is clicked.
12
+ * when a file is clicked. A creation whose file is gone is dropped — a
13
+ * `bash rm` never reaches the journal, so the run's list would otherwise
14
+ * count a file that no longer exists.
13
15
  *
14
16
  * GET /api/sessions/:sessionId/changes/diff?path=<abs>&from=<ms>&to=<ms>
15
17
  * The net change of one path inside one run window: the first record's
16
18
  * `before` and the last record's `after`, plus a unified patch.
17
19
  *
20
+ * GET /api/sessions/:sessionId/changes/stats?from=<ms>&to=<ms>
21
+ * The same net change as `+`/`−` line counts for every path in the window,
22
+ * so the run's file summary can print the totals without opening a diff.
23
+ *
18
24
  * A session with no journal (older omp, or no artifacts directory) answers an
19
25
  * empty list — a normal state, not an error. The diff read answers 404 when the
20
26
  * path has no record in the range, so a stale click reports the real problem.
@@ -23,14 +29,14 @@
23
29
  import { json } from '@/server/lib/remix-compat';
24
30
  import type { LoaderFunctionArgs } from '@/server/lib/remix-compat';
25
31
  import { isSinglePathSegment } from '@/server/lib/fs/path-segment';
26
- import { readSessionChangeDiff, readSessionChangeIndex } from '@/server/lib/omp/session/changes';
32
+ import { readSessionChangeDiff, readSessionChangeList, readSessionChangeStats } from '@/server/lib/omp/session/changes';
27
33
 
28
34
  /** GET /api/sessions/:sessionId/changes */
29
35
  export async function getSessionChanges({ params }: LoaderFunctionArgs) {
30
36
  const sessionId = params.sessionId;
31
37
  if (!sessionId) return json({ error: 'Missing session id' }, { status: 400 });
32
38
  if (!isSinglePathSegment(sessionId)) return json({ error: 'Session not found' }, { status: 404 });
33
- return json({ sessionId, records: await readSessionChangeIndex(sessionId) });
39
+ return json({ sessionId, records: await readSessionChangeList(sessionId) });
34
40
  }
35
41
 
36
42
  /** GET /api/sessions/:sessionId/changes/diff */
@@ -53,3 +59,21 @@ export async function getSessionChangeDiff({ params, request }: LoaderFunctionAr
53
59
  if (!diff) return json({ error: 'No change for that path in the range' }, { status: 404 });
54
60
  return json({ success: true, ...diff });
55
61
  }
62
+
63
+ /** GET /api/sessions/:sessionId/changes/stats */
64
+ export async function getSessionChangeStats({ params, request }: LoaderFunctionArgs) {
65
+ const sessionId = params.sessionId;
66
+ if (!sessionId) return json({ error: 'Missing session id' }, { status: 400 });
67
+ if (!isSinglePathSegment(sessionId)) return json({ error: 'Session not found' }, { status: 404 });
68
+
69
+ const url = new URL(request.url);
70
+ const fromRaw = url.searchParams.get('from');
71
+ const toRaw = url.searchParams.get('to');
72
+ const from = fromRaw === null ? Number.NaN : Number(fromRaw);
73
+ const to = toRaw === null ? Number.NaN : Number(toRaw);
74
+ if (!Number.isFinite(from) || !Number.isFinite(to) || to < from) {
75
+ return json({ error: 'from and to are required' }, { status: 400 });
76
+ }
77
+
78
+ return json({ sessionId, files: await readSessionChangeStats(sessionId, from, to) });
79
+ }
@@ -21,7 +21,7 @@ import { getSessionRelations, updateSessionParent } from '@/server/routes/sessio
21
21
  import { forkSessionRoute } from '@/server/routes/sessions/fork';
22
22
  import { getSessionAnswer } from '@/server/routes/sessions/answer';
23
23
  import { getSessionMcp, probeSessionMcp, setSessionMcp } from '@/server/routes/sessions/mcp';
24
- import { getSessionChangeDiff, getSessionChanges } from '@/server/routes/sessions/changes';
24
+ import { getSessionChangeDiff, getSessionChanges, getSessionChangeStats } from '@/server/routes/sessions/changes';
25
25
 
26
26
  export const sessionsBindings: HandlerBinding[] = [
27
27
  ...bindingsFor(sessionsList, '/api/sessions/list'),
@@ -48,6 +48,7 @@ export const sessionsBindings: HandlerBinding[] = [
48
48
  // parameter name must stay `sessionId`.
49
49
  { method: 'GET', path: '/api/sessions/:sessionId/changes', handler: getSessionChanges },
50
50
  { method: 'GET', path: '/api/sessions/:sessionId/changes/diff', handler: getSessionChangeDiff },
51
+ { method: 'GET', path: '/api/sessions/:sessionId/changes/stats', handler: getSessionChangeStats },
51
52
  // The MCP list this session has, and the per-session switch. A static suffix
52
53
  // under the same `:sessionId` position, so the parameter name must stay
53
54
  // `sessionId` (Elysia requires one name per position).