@kabmo-labs/kabmo 0.33.0 → 0.34.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 (211) 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-vze4m5ag.js} +1 -1
  4. package/dist/client/static/js/{DocxView-c9v2vr3r.js → DocxView-jbf21gmh.js} +5 -5
  5. package/dist/client/static/js/{DrawioView-vxjksm12.js → DrawioView-b52qybx5.js} +2 -2
  6. package/dist/client/static/js/{ImageView-a3g5k226.js → ImageView-mdgzj8px.js} +1 -1
  7. package/dist/client/static/js/{LayoutWrapper-hnjfwsjh.js → LayoutWrapper-3c49dvtt.js} +2 -2
  8. package/dist/client/static/js/Modal-sqp864vd.js +38 -0
  9. package/dist/client/static/js/{PdfView-ksaes53y.js → PdfView-g06rxqb1.js} +1 -1
  10. package/dist/client/static/js/{SessionsView-30vcr95v.js → SessionsView-521adxyr.js} +1 -1
  11. package/dist/client/static/js/{SheetView-vc484scg.js → SheetView-h8xmsz7q.js} +22 -22
  12. package/dist/client/static/js/{SvgPreview-tph89jet.js → SvgPreview-1j4jvcvz.js} +1 -1
  13. package/dist/client/static/js/{abnfDiagram-O67JEVCF-xbar278c.js → abnfDiagram-O67JEVCF-pasxh4b6.js} +1 -1
  14. package/dist/client/static/js/architecture-7GRP2DOG-fc9kmq1w.js +1 -0
  15. package/dist/client/static/js/{architectureDiagram-NJMV4G6O-s171n2z6.js → architectureDiagram-NJMV4G6O-ms14g0bm.js} +4 -4
  16. package/dist/client/static/js/{blockDiagram-BEXU5L5S-gzx6rv9n.js → blockDiagram-BEXU5L5S-ycn78fcq.js} +4 -4
  17. package/dist/client/static/js/{c4Diagram-YGBWAQC7-7f00skch.js → c4Diagram-YGBWAQC7-vn2gpjfm.js} +5 -5
  18. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-j79v95nc.js → classDiagram-v2-NBCMYWYE-fyrm1pr5.js} +4 -4
  19. package/dist/client/static/js/{cose-bilkent-JH36ORCC-5fkn7ee5.js → cose-bilkent-JH36ORCC-ea5nwvgq.js} +1 -1
  20. package/dist/client/static/js/cynefin-OW5HDTMX-a4t8992q.js +1 -0
  21. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-cfs1yvrd.js → cynefinDiagram-VND7K2PF-j6bsjpre.js} +1 -1
  22. package/dist/client/static/js/{dagre-6A5THRUB-44bgc48p.js → dagre-6A5THRUB-4smdkwv8.js} +2 -2
  23. package/dist/client/static/js/{diagram-22UHCM2B-a4g4x83k.js → diagram-22UHCM2B-9sm4kqwc.js} +11 -11
  24. package/dist/client/static/js/{diagram-3UASUU5V-gm4rg5na.js → diagram-3UASUU5V-2h3qxaed.js} +1 -1
  25. package/dist/client/static/js/{diagram-ATOU4E4O-a95y41vk.js → diagram-ATOU4E4O-1981bc94.js} +3 -3
  26. package/dist/client/static/js/{diagram-CDSNMT55-t3j93mmc.js → diagram-CDSNMT55-3vgsxavc.js} +4 -4
  27. package/dist/client/static/js/{diagram-MLGK6HIB-c2wdez02.js → diagram-MLGK6HIB-c9gf2r3f.js} +2 -2
  28. package/dist/client/static/js/{diagram-MPIPVDR6-gya9jhs5.js → diagram-MPIPVDR6-gjqeq92d.js} +2 -2
  29. package/dist/client/static/js/{dockerfile-a7q6174s.js → dockerfile-8v935dkn.js} +1 -1
  30. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-jjhkza6t.js → ebnfDiagram-ZINNZB2B-4vbsgh99.js} +1 -1
  31. package/dist/client/static/js/{elixir-rpa1g4gy.js → elixir-vcbg60wv.js} +1 -1
  32. package/dist/client/static/js/{elk-276RUBZZ-f7re45mw.js → elk-276RUBZZ-nca3t891.js} +1 -1
  33. package/dist/client/static/js/{erDiagram-OPXOYQCR-tpm9g5te.js → erDiagram-OPXOYQCR-5kfkev03.js} +2 -2
  34. package/dist/client/static/js/eventmodeling-NTZA5JFV-18bdrkv5.js +1 -0
  35. package/dist/client/static/js/flowDiagram-KWPJA3E3-fg0yqx0h.js +1 -0
  36. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-fz43n12d.js → ganttDiagram-FUAMR5RP-mxc73wmq.js} +3 -3
  37. package/dist/client/static/js/gitGraph-4MIJSDKK-8fa6y40p.js +1 -0
  38. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-f61hgbn6.js → gitGraphDiagram-X574FWY7-7en3ag0e.js} +12 -12
  39. package/dist/client/static/js/html-dbrwss36.js +1 -0
  40. package/dist/client/static/js/{index-m73za75e.js → index-0vm41je9.js} +3 -3
  41. package/dist/client/static/js/{index-eyzeya95.js → index-1b0t1428.js} +5 -5
  42. package/dist/client/static/js/{index-2x5f66t6.js → index-1ksg88qf.js} +1 -1
  43. package/dist/client/static/js/{index-sffjtm5w.js → index-231241f4.js} +9 -9
  44. package/dist/client/static/js/index-2mx9ej4k.css +1 -0
  45. package/dist/client/static/js/{index-8239j2v1.js → index-4g46wbdw.js} +1 -1
  46. package/dist/client/static/js/{index-1xqs14fr.js → index-4qwzxj81.js} +1 -1
  47. package/dist/client/static/js/{index-gcs49f3p.js → index-52rqxgya.js} +1 -1
  48. package/dist/client/static/js/{index-at6bhjyf.js → index-6sf2vsp2.js} +1 -1
  49. package/dist/client/static/js/{index-q2w6s8n7.js → index-7a64yjrm.js} +4 -4
  50. package/dist/client/static/js/{index-rg8jpbsw.js → index-8acv5b77.js} +2 -2
  51. package/dist/client/static/js/{index-js7t1vb1.js → index-a0fmsv1d.js} +5 -5
  52. package/dist/client/static/js/{index-w0fwb80e.js → index-ag2rmtas.js} +1 -1
  53. package/dist/client/static/js/{index-djmg1d7h.js → index-b29afsjh.js} +1 -1
  54. package/dist/client/static/js/{index-e4p4cd3r.js → index-c3ek61zv.js} +1 -1
  55. package/dist/client/static/js/{index-0e40xskg.js → index-cd65zqba.js} +1 -1
  56. package/dist/client/static/js/{index-zt75xpq0.js → index-cgzrpvzj.js} +204 -204
  57. package/dist/client/static/js/{index-0n5wwe60.js → index-ev3yt353.js} +2 -2
  58. package/dist/client/static/js/{index-9y3gjdj7.js → index-eyfcm0cy.js} +1 -1
  59. package/dist/client/static/js/{index-qsm2z36d.js → index-f7jhhqtk.js} +1 -1
  60. package/dist/client/static/js/{index-vw5k8csz.js → index-fta1y9pc.js} +50 -50
  61. package/dist/client/static/js/{index-ajs3jj6j.js → index-fvmfge3p.js} +1 -1
  62. package/dist/client/static/js/{index-pxv2nw9w.js → index-g2dyfze9.js} +1 -1
  63. package/dist/client/static/js/{index-bkye8mz4.js → index-h5bn97p6.js} +1 -1
  64. package/dist/client/static/js/{index-trm9x02n.js → index-j51d5a5m.js} +6 -6
  65. package/dist/client/static/js/{index-pbe4yed4.js → index-jsyekbx9.js} +2 -2
  66. package/dist/client/static/js/{index-gs6f0qwa.js → index-nccwxv0s.js} +2 -2
  67. package/dist/client/static/js/{index-d495kfm0.js → index-p0nz38bm.js} +1 -1
  68. package/dist/client/static/js/{index-sdtye3jy.js → index-pm6xxwz1.js} +2 -2
  69. package/dist/client/static/js/{index-3rcjx70v.js → index-ptcrwswj.js} +1 -1
  70. package/dist/client/static/js/{index-14vndmcr.js → index-ptcwae2n.js} +1 -1
  71. package/dist/client/static/js/{index-5tgq7aqx.js → index-r014brzs.js} +2 -2
  72. package/dist/client/static/js/{index-xj9649ac.js → index-ray2czf6.js} +7 -7
  73. package/dist/client/static/js/{index-apvkd37e.js → index-rs80cwsv.js} +3 -3
  74. package/dist/client/static/js/{index-vw4brsdx.js → index-rzxcj7cg.js} +1 -1
  75. package/dist/client/static/js/{index-a293pdg7.js → index-s7gkkkyz.js} +2 -2
  76. package/dist/client/static/js/{index-1a0zkj8h.js → index-sd66wv26.js} +2 -2
  77. package/dist/client/static/js/{index-ypx3qmhq.js → index-vhqe0y82.js} +1 -1
  78. package/dist/client/static/js/{index-9fjt5anh.js → index-vy6termr.js} +1 -1
  79. package/dist/client/static/js/{index-0tf0arsp.js → index-xx6mqpxm.js} +3 -3
  80. package/dist/client/static/js/{index-03h3bkcf.js → index-ybm2x4vh.js} +1 -1
  81. package/dist/client/static/js/info-A6RAGUB7-3hk844f7.js +1 -0
  82. package/dist/client/static/js/{infoDiagram-VRGFBTTK-1qj804sn.js → infoDiagram-VRGFBTTK-sef80132.js} +2 -2
  83. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-4j4qsnzw.js → ishikawaDiagram-OU5B5YK6-yhvepp1q.js} +6 -6
  84. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-j0brnfft.js → journeyDiagram-ZHPQQLJL-5w77y95w.js} +5 -5
  85. package/dist/client/static/js/{julia-4ghmfy3e.js → julia-d4j6wgvf.js} +1 -1
  86. package/dist/client/static/js/{kanban-definition-PNTS6WVX-qqc22br0.js → kanban-definition-PNTS6WVX-02znqtna.js} +6 -6
  87. package/dist/client/static/js/{mermaid.core-vv3wbe65.js → mermaid.core-a6e6vck4.js} +5 -5
  88. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-y5b2z8zp.js → mindmap-definition-NLK3R4M7-y4n74q9x.js} +8 -8
  89. package/dist/client/static/js/one-dark-pro-vwhfpzr8.js +1 -0
  90. package/dist/client/static/js/one-light-y5t9x6zh.js +1 -0
  91. package/dist/client/static/js/packet-AYTQ26CC-4nj2yy10.js +1 -0
  92. package/dist/client/static/js/{pegDiagram-GJSIUBJH-0be07mqs.js → pegDiagram-GJSIUBJH-pr7ehgzb.js} +1 -1
  93. package/dist/client/static/js/{perl-sd00t4b4.js → perl-srptw5vm.js} +1 -1
  94. package/dist/client/static/js/{php-2zfyqa61.js → php-n89g3fk7.js} +1 -1
  95. package/dist/client/static/js/pie-WAS4IAKB-k7rde3f9.js +1 -0
  96. package/dist/client/static/js/{pieDiagram-5QR66LMP-544w86jk.js → pieDiagram-5QR66LMP-39wpsk08.js} +2 -2
  97. package/dist/client/static/js/{quadrantDiagram-O4NWA36T-p09e7z5s.js → quadrantDiagram-O4NWA36T-esm913km.js} +5 -5
  98. package/dist/client/static/js/radar-RG4KPBEZ-513dpw4f.js +1 -0
  99. package/dist/client/static/js/railroad-74A4TZTK-9bqnst9c.js +1 -0
  100. package/dist/client/static/js/railroad-abnf-HS5TGJTU-7367d5bv.js +1 -0
  101. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-b806b1mj.js +1 -0
  102. package/dist/client/static/js/railroad-peg-WCYAUIDC-5a67rwf8.js +1 -0
  103. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-de830ed2.js → railroadDiagram-XR7U4H2S-wy2mgya6.js} +1 -1
  104. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-b47d74p1.js → requirementDiagram-PLB6GJNP-6z9xdgbq.js} +2 -2
  105. package/dist/client/static/js/{ruby-v9qaqhby.js → ruby-r81ytgcm.js} +1 -1
  106. package/dist/client/static/js/{rust-fkt0qyrs.js → rust-frn3szvc.js} +1 -1
  107. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-6ezc2fpj.js → sankeyDiagram-IPEJSGJF-rtmxk3ys.js} +4 -4
  108. package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-by5zqj6w.js → sequenceDiagram-PO4LG4MO-awzcrafg.js} +18 -18
  109. package/dist/client/static/js/{sizeCapture-INFHLROL-q85r06j6.js → sizeCapture-INFHLROL-03gy196j.js} +1 -1
  110. package/dist/client/static/js/sql-0e9mnrda.js +1 -0
  111. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-ep5pyexs.js → stateDiagram-v2-GCMORJYK-an8v3q5n.js} +3 -3
  112. package/dist/client/static/js/{swimlanes-2SLR337P-95fcqkh8.js → swimlanes-2SLR337P-n9yb4wcs.js} +1 -1
  113. package/dist/client/static/js/{swimlanesDiagram-TC7HE7FX-xs2en5dv.js → swimlanesDiagram-TC7HE7FX-nx5nfnf0.js} +1 -1
  114. package/dist/client/static/js/{timeline-definition-EJHVYXUP-461e615g.js → timeline-definition-EJHVYXUP-jceb575g.js} +4 -4
  115. package/dist/client/static/js/treeView-Q6P3EWNA-kcy40evb.js +1 -0
  116. package/dist/client/static/js/treemap-WGGIJYW6-fsrvqxf4.js +1 -0
  117. package/dist/client/static/js/{usecaseDiagram-POWQR4AR-ftqfnvhg.js → usecaseDiagram-POWQR4AR-888h3100.js} +13 -13
  118. package/dist/client/static/js/{vennDiagram-UO4OBE2U-7t96h6ez.js → vennDiagram-UO4OBE2U-wbfz0rzv.js} +7 -7
  119. package/dist/client/static/js/{vue-j8vb9d7r.js → vue-c0rtg1wf.js} +1 -1
  120. package/dist/client/static/js/wardley-WFR3VGLG-36dmxww4.js +1 -0
  121. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-0de8w8c6.js → wardleyDiagram-VNRHLVJA-rn8c5qf9.js} +4 -4
  122. package/dist/client/static/js/{xychartDiagram-PMCCYNJV-dez9phkf.js → xychartDiagram-PMCCYNJV-8sn1apt6.js} +5 -5
  123. package/package.json +4 -1
  124. package/src/client/components/auth/login-screen/index.tsx +1 -0
  125. package/src/client/components/common/MarkdownRenderer.tsx +9 -12
  126. package/src/client/components/settings/Modal.tsx +14 -84
  127. package/src/client/components/settings/Sidebar.tsx +3 -1
  128. package/src/client/components/settings/categories/ConnectSettings.tsx +105 -0
  129. package/src/client/components/settings/categories/connect-settings/DeviceTable.tsx +145 -0
  130. package/src/client/components/settings/categories/connect-settings/PairDialog.tsx +160 -0
  131. package/src/client/components/settings/categories/connect-settings/QrCode.tsx +73 -0
  132. package/src/client/components/settings/categories/connect-settings/ServerCard.tsx +94 -0
  133. package/src/client/components/settings/categories/connect-settings/TunnelRow.tsx +127 -0
  134. package/src/client/components/settings/category-content.tsx +116 -0
  135. package/src/client/components/workspace/chat-timeline/ChangedFilesSummary.test.tsx +120 -0
  136. package/src/client/components/workspace/chat-timeline/ChangedFilesSummary.tsx +56 -20
  137. package/src/client/components/workspace/chat-timeline/RunFooter.tsx +1 -0
  138. package/src/client/hooks/chat/timeline/change-stats.ts +57 -0
  139. package/src/client/hooks/connect/use-connect-status.ts +116 -0
  140. package/src/client/hooks/connect/use-pairing.ts +100 -0
  141. package/src/client/hooks/ui/clipboard.ts +26 -0
  142. package/src/client/tailwind.css +5 -0
  143. package/src/server/index.ts +2 -0
  144. package/src/server/lib/assets/font-css.server.test.ts +19 -0
  145. package/src/server/lib/auth/client-address.test.ts +58 -0
  146. package/src/server/lib/auth/client-address.ts +37 -3
  147. package/src/server/lib/auth/guard.ts +31 -4
  148. package/src/server/lib/auth/rate-limit.test.ts +25 -8
  149. package/src/server/lib/auth/rate-limit.ts +8 -5
  150. package/src/server/lib/connect/cloudflared.lifecycle.test.ts +88 -0
  151. package/src/server/lib/connect/cloudflared.server.test.ts +65 -0
  152. package/src/server/lib/connect/cloudflared.server.ts +206 -0
  153. package/src/server/lib/connect/devices.server.ts +192 -0
  154. package/src/server/lib/connect/identity.server.ts +81 -0
  155. package/src/server/lib/connect/pairing.server.test.ts +56 -0
  156. package/src/server/lib/connect/pairing.server.ts +113 -0
  157. package/src/server/lib/connect/qr.roundtrip.test.ts +106 -0
  158. package/src/server/lib/connect/qr.server.ts +36 -0
  159. package/src/server/lib/connect/run.server.ts +101 -0
  160. package/src/server/lib/connect/status.server.ts +177 -0
  161. package/src/server/lib/connect/tailscale.server.test.ts +117 -0
  162. package/src/server/lib/connect/tailscale.server.ts +172 -0
  163. package/src/server/lib/db/schema.ts +4 -0
  164. package/src/server/lib/omp/session/changes.test.ts +64 -1
  165. package/src/server/lib/omp/session/changes.ts +94 -1
  166. package/src/server/routes/connect/devices.ts +56 -0
  167. package/src/server/routes/connect/index.ts +15 -0
  168. package/src/server/routes/connect/pair-page.ts +177 -0
  169. package/src/server/routes/connect/pair.ts +158 -0
  170. package/src/server/routes/connect/status.ts +19 -0
  171. package/src/server/routes/connect/tunnels.ts +76 -0
  172. package/src/server/routes/health/probe.ts +5 -0
  173. package/src/server/routes/index.ts +2 -0
  174. package/src/server/routes/sessions/changes.test.ts +12 -3
  175. package/src/server/routes/sessions/changes.ts +27 -3
  176. package/src/server/routes/sessions/index.ts +2 -1
  177. package/src/shared/lib/connect/payload.test.ts +144 -0
  178. package/src/shared/lib/connect/payload.ts +229 -0
  179. package/src/shared/lib/connect/tier.test.ts +73 -0
  180. package/src/shared/lib/connect/tier.ts +105 -0
  181. package/src/shared/lib/connect/types.ts +99 -0
  182. package/src/shared/lib/markdown/fira-code-fonts.css +65 -6
  183. package/src/shared/lib/markdown/marked.ts +7 -4
  184. package/src/shared/lib/markdown/mermaid-actions.test.ts +78 -0
  185. package/src/shared/lib/markdown/mermaid-actions.ts +45 -0
  186. package/src/shared/lib/markdown/mermaid.ts +41 -7
  187. package/src/shared/lib/settings/sections.ts +6 -1
  188. package/src/shared/types/session-changes.ts +6 -0
  189. package/src/shared/types/settings/state.ts +2 -0
  190. package/dist/client/static/js/Modal-qtftcp2t.js +0 -38
  191. package/dist/client/static/js/architecture-7GRP2DOG-tavtgb8a.js +0 -1
  192. package/dist/client/static/js/cynefin-OW5HDTMX-cdh3n2z2.js +0 -1
  193. package/dist/client/static/js/eventmodeling-NTZA5JFV-as97tpyp.js +0 -1
  194. package/dist/client/static/js/flowDiagram-KWPJA3E3-ggm06d12.js +0 -1
  195. package/dist/client/static/js/gitGraph-4MIJSDKK-eqz7p9ng.js +0 -1
  196. package/dist/client/static/js/html-pv88ny12.js +0 -1
  197. package/dist/client/static/js/index-e94a1en0.css +0 -1
  198. package/dist/client/static/js/info-A6RAGUB7-4pkzh1qx.js +0 -1
  199. package/dist/client/static/js/one-dark-pro-hm3f56n1.js +0 -1
  200. package/dist/client/static/js/one-light-xrz49rct.js +0 -1
  201. package/dist/client/static/js/packet-AYTQ26CC-yg71sp88.js +0 -1
  202. package/dist/client/static/js/pie-WAS4IAKB-89wd6np0.js +0 -1
  203. package/dist/client/static/js/radar-RG4KPBEZ-avn0b8r9.js +0 -1
  204. package/dist/client/static/js/railroad-74A4TZTK-de27xv5w.js +0 -1
  205. package/dist/client/static/js/railroad-abnf-HS5TGJTU-rg4zzj7x.js +0 -1
  206. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-d84fhj8v.js +0 -1
  207. package/dist/client/static/js/railroad-peg-WCYAUIDC-dvf8xrmc.js +0 -1
  208. package/dist/client/static/js/sql-g8wcshpc.js +0 -1
  209. package/dist/client/static/js/treeView-Q6P3EWNA-mham0bh6.js +0 -1
  210. package/dist/client/static/js/treemap-WGGIJYW6-mxrxax86.js +0 -1
  211. package/dist/client/static/js/wardley-WFR3VGLG-8vrvh9p3.js +0 -1
@@ -0,0 +1,78 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The mermaid block's own actions.
8
+ *
9
+ * The refresh button is the reader's only repair for a diagram that rendered
10
+ * blank, and it is wired by a DELEGATED listener that looks for
11
+ * `data-mermaid-refresh` — so the two things that can silently kill it are
12
+ * (a) the attribute not surviving `sanitizeHtml`, and (b) the hydrated block
13
+ * replacing the placeholder's markup with a set that lacks the button. Both
14
+ * are asserted here, plus the copy payload, which must be the diagram source
15
+ * and not its URI escape.
16
+ */
17
+
18
+ import { afterEach, describe, expect, test } from 'bun:test';
19
+ import { Window } from 'happy-dom';
20
+ import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
21
+ import { renderMarkdown } from '@/shared/lib/markdown/marked';
22
+ import { sanitizeHtml } from '@/shared/lib/markdown/sanitize';
23
+ import { mermaidActionsHtml, mermaidSourceHtml } from '@/shared/lib/markdown/mermaid-actions';
24
+ import { refreshMermaidFromClick } from '@/shared/lib/markdown/mermaid';
25
+
26
+ afterEach(() => restoreDomGlobals());
27
+
28
+ const FENCE = '```mermaid\ngraph TD\n A["quoted"] --> B\n```';
29
+
30
+ describe('mermaid block actions', () => {
31
+ test('the placeholder carries both actions, and the refresh hook survives sanitizing', () => {
32
+ installDomGlobals(new Window({ url: 'http://localhost' }));
33
+ const html = sanitizeHtml(renderMarkdown(FENCE));
34
+ expect(html).toContain('data-mermaid-refresh');
35
+ expect(html).toContain('data-copy=');
36
+ // The copy payload is the source, not its percent escape.
37
+ expect(html).toContain('graph TD');
38
+ expect(html).not.toContain('graph%20TD');
39
+ });
40
+
41
+ test('the hydrated action set is the same one the placeholder emitted', () => {
42
+ const html = mermaidActionsHtml('graph TD\n A --> B');
43
+ expect(html).toContain('data-mermaid-refresh');
44
+ expect(html).toContain('data-copy="graph TD\n A --> B"');
45
+ });
46
+
47
+ test('a quote in the source cannot break out of the copy attribute', () => {
48
+ const html = mermaidActionsHtml('A["x"] --> B');
49
+ expect(html).toContain('data-copy="A["x"] --> B"');
50
+ });
51
+
52
+ test('the fallback body escapes markup so a fence cannot inject HTML', () => {
53
+ expect(mermaidSourceHtml('<img src=x onerror=alert(1)>')).toBe(
54
+ '<pre><code class="language-mermaid">&lt;img src=x onerror=alert(1)&gt;</code></pre>',
55
+ );
56
+ });
57
+
58
+ test('a click on the refresh button re-renders that block and reports handled', () => {
59
+ installDomGlobals(new Window({ url: 'http://localhost' }));
60
+ const host = document.createElement('div');
61
+ // The raw render, not `sanitizeHtml`: happy-dom's purifier drops every
62
+ // `<div>`, which would remove the block this test is about.
63
+ host.innerHTML = renderMarkdown(FENCE);
64
+ document.body.append(host);
65
+ const block = host.querySelector<HTMLElement>('.mermaid-block')!;
66
+ block.querySelector('pre')!.setAttribute('data-marker', '1');
67
+ const button = block.querySelector<HTMLElement>('[data-mermaid-refresh]')!;
68
+
69
+ expect(refreshMermaidFromClick(button)).toBe(true);
70
+ // The block was reset to its placeholder, which is the retry starting.
71
+ expect(block.querySelector('[data-marker]')).toBeNull();
72
+ // The retry is in flight: `renderBlock` marks the block before awaiting.
73
+ expect(block.dataset.mermaidState).toBe('rendering');
74
+
75
+ // Any other click is not a refresh, so the caller keeps its own handling.
76
+ expect(refreshMermaidFromClick(host)).toBe(false);
77
+ });
78
+ });
@@ -0,0 +1,45 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The floating actions every mermaid block carries: copy the source, and
8
+ * re-render the diagram.
9
+ *
10
+ * Shared by the marked placeholder (`marked.ts`) and the hydrated block
11
+ * (`mermaid.ts`) because `applySvg` REPLACES the placeholder's innerHTML — a
12
+ * second copy of this markup is how the refresh button would exist before the
13
+ * first render and disappear after it, which is exactly when a blank diagram
14
+ * needs it.
15
+ *
16
+ * The refresh button is `data-mermaid-refresh`: the delegated click listener
17
+ * in `MarkdownRenderer` reads it, so no component handler is needed. It must
18
+ * stay a separate button from `data-copy` — the copy branch returns early on
19
+ * an empty `data-copy`, and a refresh that fell through to it would copy the
20
+ * empty string and drop the click.
21
+ */
22
+
23
+ const COPY_ICON =
24
+ '<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>';
25
+
26
+ const REFRESH_ICON =
27
+ '<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12a9 9 0 1 1-2.64-6.36"/><polyline points="21 3 21 9 15 9"/></svg>';
28
+
29
+ /** Both action buttons for a block whose source is `source`. */
30
+ export function mermaidActionsHtml(source: string): string {
31
+ const copyAttr = source.replace(/"/g, '&quot;');
32
+ return (
33
+ `<button type="button" class="code-copy-float" data-copy="${copyAttr}" aria-label="Copy diagram source" title="Copy diagram source">${COPY_ICON}</button>` +
34
+ `<button type="button" class="code-copy-float mermaid-refresh-float" data-mermaid-refresh aria-label="Refresh diagram" title="Refresh diagram">${REFRESH_ICON}</button>`
35
+ );
36
+ }
37
+
38
+ /** The pending/error body: the raw source, hidden while a render is in flight. */
39
+ export function mermaidSourceHtml(source: string): string {
40
+ const escaped = source
41
+ .replace(/&/g, '&amp;')
42
+ .replace(/</g, '&lt;')
43
+ .replace(/>/g, '&gt;');
44
+ return `<pre><code class="language-mermaid">${escaped}</code></pre>`;
45
+ }
@@ -18,6 +18,7 @@
18
18
  */
19
19
 
20
20
  import { sanitizeMermaidSvg } from '@/shared/lib/markdown/sanitize';
21
+ import { mermaidActionsHtml, mermaidSourceHtml } from '@/shared/lib/markdown/mermaid-actions';
21
22
  import { isDarkTheme } from '@/shared/lib/theme/catalog';
22
23
 
23
24
  export interface MermaidRenderResult {
@@ -91,13 +92,10 @@ async function loadMermaid(themeKey: ThemeKey): Promise<MermaidModule['default']
91
92
  }
92
93
 
93
94
  function applySvg(block: HTMLElement, svg: string, themeKey: ThemeKey): void {
94
- const source = block.dataset.mermaid ?? '';
95
- const copyAttr = source.replace(/"/g, '&quot;');
96
- block.innerHTML =
97
- `<button type="button" class="code-copy-float" data-copy="${copyAttr}" aria-label="Copy diagram source" title="Copy diagram source">` +
98
- '<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>' +
99
- '</button>' +
100
- svg;
95
+ // `dataset.mermaid` is URI-encoded for the attribute; the copy button must
96
+ // give the reader the diagram they can paste back, not its percent escape.
97
+ const source = decodeURIComponent(block.dataset.mermaid ?? '');
98
+ block.innerHTML = mermaidActionsHtml(source) + svg;
101
99
  block.dataset.mermaidState = 'done';
102
100
  block.dataset.mermaidTheme = themeKey;
103
101
 
@@ -167,3 +165,39 @@ export async function hydrateMermaidBlocks(
167
165
  );
168
166
  return { rendered: results.filter(Boolean).length, failed: results.filter((ok) => !ok).length };
169
167
  }
168
+
169
+ /**
170
+ * Re-render one block from scratch — the block's own Refresh button.
171
+ *
172
+ * The cached SVG is dropped first: a blank diagram is usually a cached blank
173
+ * (or an SVG whose sanitized markup lost a node), so re-applying the cache
174
+ * would reproduce the blank the reader just asked to fix. The block is reset
175
+ * to its placeholder before the retry, so a failed second attempt shows the
176
+ * source in the error colour instead of leaving the old blank SVG up.
177
+ */
178
+ export async function refreshMermaidBlock(block: HTMLElement): Promise<void> {
179
+ const encoded = block.dataset.mermaid;
180
+ if (encoded == null) return;
181
+ const source = decodeURIComponent(encoded);
182
+ const themeKey = resolveThemeKey();
183
+ svgCache.delete(cacheKey(themeKey, source));
184
+ block.dataset.mermaidState = 'pending';
185
+ delete block.dataset.mermaidTheme;
186
+ block.innerHTML = `<div class="code-block">${mermaidActionsHtml(source)}${mermaidSourceHtml(source)}</div>`;
187
+ await renderBlock(block, false);
188
+ }
189
+
190
+ /**
191
+ * Handle a click that landed on a block's Refresh button.
192
+ *
193
+ * Returns true when the click WAS a refresh, so the caller stops there: the
194
+ * block is also a door into the zoom/pan viewer, and letting the click fall
195
+ * through would open a blank overlay instead of retrying the render.
196
+ */
197
+ export function refreshMermaidFromClick(target: EventTarget | null): boolean {
198
+ const button = (target as HTMLElement | null)?.closest?.<HTMLButtonElement>('button[data-mermaid-refresh]');
199
+ if (!button) return false;
200
+ const block = button.closest<HTMLElement>('.mermaid-block');
201
+ if (block) void refreshMermaidBlock(block);
202
+ return true;
203
+ }
@@ -21,8 +21,13 @@
21
21
  *
22
22
  * There is no `LIBRARY` group: plugins, skills and the skills catalog are omp's
23
23
  * own extension surface, so they file under `OMP` with the rest of its config.
24
+ *
25
+ * `CONNECT` sits directly after `KABMO` because it is about reaching this
26
+ * install, not about configuring the agent: tunnels, addresses and paired
27
+ * devices are the first thing a user sets up on a new machine, and burying them
28
+ * under `OMP` would file a network fact with the engine's own config.
24
29
  */
25
30
 
26
- export const SETTINGS_SECTIONS = ['KABMO', 'WORKSPACE', 'OMP', 'HARNESSES'] as const;
31
+ export const SETTINGS_SECTIONS = ['KABMO', 'CONNECT', 'WORKSPACE', 'OMP', 'HARNESSES'] as const;
27
32
 
28
33
  export type SettingsSection = (typeof SETTINGS_SECTIONS)[number];
@@ -44,6 +44,12 @@ export interface ChangedFile {
44
44
  agent: string;
45
45
  }
46
46
 
47
+ /** One file's net `+`/`−` line counts inside a run window. */
48
+ export interface SessionChangeCounts {
49
+ added: number;
50
+ removed: number;
51
+ }
52
+
47
53
  /** The two sides of one file's net change in a run, plus a unified patch. */
48
54
  export interface SessionChangeDiff {
49
55
  path: string;
@@ -20,6 +20,8 @@ export type SettingsCategoryId =
20
20
  * sandboxed panel views). Deliberately NOT under OMP → Plugins, which holds
21
21
  * plugins: these are Kabmo surfaces omp has no concept of. */
22
22
  | 'panel-plugins'
23
+ // CONNECT — how a device reaches this install: tunnels, addresses, pairing.
24
+ | 'connect'
23
25
  // WORKSPACE
24
26
  | 'projects'
25
27
  // OMP