@kabmo-labs/kabmo 0.32.1 → 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 (334) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +805 -637
  3. package/dist/client/static/js/{CsvGrid-4gx0jevc.js → CsvGrid-vze4m5ag.js} +2 -2
  4. package/dist/client/static/js/{DocxView-0667nr8h.js → DocxView-jbf21gmh.js} +5 -5
  5. package/dist/client/static/js/{DrawioView-522v0d0r.js → DrawioView-b52qybx5.js} +2 -2
  6. package/dist/client/static/js/{ImageView-t8xp60hm.js → ImageView-mdgzj8px.js} +1 -1
  7. package/dist/client/static/js/LayoutWrapper-3c49dvtt.js +2 -0
  8. package/dist/client/static/js/Modal-sqp864vd.js +38 -0
  9. package/dist/client/static/js/{PdfView-3fx172xh.js → PdfView-g06rxqb1.js} +1 -1
  10. package/dist/client/static/js/{SessionsView-n3agmf5t.js → SessionsView-521adxyr.js} +1 -1
  11. package/dist/client/static/js/{SheetView-nmrdb1b8.js → SheetView-h8xmsz7q.js} +22 -22
  12. package/dist/client/static/js/{SvgPreview-0xsc6xam.js → SvgPreview-1j4jvcvz.js} +1 -1
  13. package/dist/client/static/js/{abnfDiagram-O67JEVCF-jj31rs62.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-ay3yr7pf.js → architectureDiagram-NJMV4G6O-ms14g0bm.js} +4 -4
  16. package/dist/client/static/js/{astro-qgx1r159.js → astro-80bs6hvg.js} +1 -1
  17. package/dist/client/static/js/bash-b3rwyg5p.js +1 -0
  18. package/dist/client/static/js/{blockDiagram-BEXU5L5S-4x33e16k.js → blockDiagram-BEXU5L5S-ycn78fcq.js} +4 -4
  19. package/dist/client/static/js/{c4Diagram-YGBWAQC7-dtb81cgz.js → c4Diagram-YGBWAQC7-vn2gpjfm.js} +5 -5
  20. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-vk5a2n9w.js → classDiagram-v2-NBCMYWYE-fyrm1pr5.js} +5 -5
  21. package/dist/client/static/js/{cose-bilkent-JH36ORCC-6rbjbe19.js → cose-bilkent-JH36ORCC-ea5nwvgq.js} +1 -1
  22. package/dist/client/static/js/css-6vj0d308.js +1 -0
  23. package/dist/client/static/js/cynefin-OW5HDTMX-a4t8992q.js +1 -0
  24. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-vyjksedr.js → cynefinDiagram-VND7K2PF-j6bsjpre.js} +2 -2
  25. package/dist/client/static/js/{dagre-6A5THRUB-7hey38z5.js → dagre-6A5THRUB-4smdkwv8.js} +2 -2
  26. package/dist/client/static/js/{diagram-22UHCM2B-aes06jde.js → diagram-22UHCM2B-9sm4kqwc.js} +19 -19
  27. package/dist/client/static/js/{diagram-3UASUU5V-3cfkgm3x.js → diagram-3UASUU5V-2h3qxaed.js} +1 -1
  28. package/dist/client/static/js/{diagram-ATOU4E4O-z8mfhwpy.js → diagram-ATOU4E4O-1981bc94.js} +3 -3
  29. package/dist/client/static/js/{diagram-CDSNMT55-t4821ctz.js → diagram-CDSNMT55-3vgsxavc.js} +5 -5
  30. package/dist/client/static/js/{diagram-MLGK6HIB-23yxbfrx.js → diagram-MLGK6HIB-c9gf2r3f.js} +2 -2
  31. package/dist/client/static/js/{diagram-MPIPVDR6-chhtf7v0.js → diagram-MPIPVDR6-gjqeq92d.js} +2 -2
  32. package/dist/client/static/js/{dockerfile-5b87ghm7.js → dockerfile-8v935dkn.js} +1 -1
  33. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-9jejcvfr.js → ebnfDiagram-ZINNZB2B-4vbsgh99.js} +1 -1
  34. package/dist/client/static/js/{elixir-rpa1g4gy.js → elixir-vcbg60wv.js} +1 -1
  35. package/dist/client/static/js/{elk-276RUBZZ-xhhtkf58.js → elk-276RUBZZ-nca3t891.js} +1 -1
  36. package/dist/client/static/js/{erDiagram-OPXOYQCR-mt2apjjb.js → erDiagram-OPXOYQCR-5kfkev03.js} +6 -6
  37. package/dist/client/static/js/{erlang-6m6tpt72.js → erlang-qt876zrq.js} +1 -1
  38. package/dist/client/static/js/eventmodeling-NTZA5JFV-18bdrkv5.js +1 -0
  39. package/dist/client/static/js/flowDiagram-KWPJA3E3-fg0yqx0h.js +1 -0
  40. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-8cm7a29w.js → ganttDiagram-FUAMR5RP-mxc73wmq.js} +3 -3
  41. package/dist/client/static/js/gitGraph-4MIJSDKK-8fa6y40p.js +1 -0
  42. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-5s0gbnx2.js → gitGraphDiagram-X574FWY7-7en3ag0e.js} +12 -12
  43. package/dist/client/static/js/graphql-n43pd5fs.js +1 -0
  44. package/dist/client/static/js/html-dbrwss36.js +1 -0
  45. package/dist/client/static/js/{index-ye3sr7db.js → index-0vm41je9.js} +4 -4
  46. package/dist/client/static/js/{index-5y7c62sm.js → index-1b0t1428.js} +5 -5
  47. package/dist/client/static/js/{index-9sd0vjmh.js → index-1ksg88qf.js} +2 -2
  48. package/dist/client/static/js/{index-brj8qwa6.js → index-1y9r4frb.js} +2 -2
  49. package/dist/client/static/js/index-231241f4.js +12 -0
  50. package/dist/client/static/js/index-2mx9ej4k.css +1 -0
  51. package/dist/client/static/js/{index-6q80csr0.js → index-2svnq5gg.js} +1 -1
  52. package/dist/client/static/js/{index-dt7e1328.js → index-354mqqra.js} +2 -2
  53. package/dist/client/static/js/{index-532btjmp.js → index-3zc1b0dv.js} +2 -2
  54. package/dist/client/static/js/{index-h06bcfds.js → index-4g46wbdw.js} +1 -1
  55. package/dist/client/static/js/{index-p7btwjvj.js → index-4qwzxj81.js} +3 -3
  56. package/dist/client/static/js/{index-3vhznzgr.js → index-52rqxgya.js} +1 -1
  57. package/dist/client/static/js/index-6sf2vsp2.js +1 -0
  58. package/dist/client/static/js/{index-xya34x4v.js → index-76zb4m0n.js} +2 -2
  59. package/dist/client/static/js/{index-jz9fpznk.js → index-7a64yjrm.js} +6 -6
  60. package/dist/client/static/js/{index-2xj14800.js → index-7y6rpsrp.js} +2 -2
  61. package/dist/client/static/js/{index-rg8jpbsw.js → index-8acv5b77.js} +2 -2
  62. package/dist/client/static/js/{index-ay34b398.js → index-a0fmsv1d.js} +19 -19
  63. package/dist/client/static/js/{index-2gfc25tq.js → index-ag2rmtas.js} +1 -1
  64. package/dist/client/static/js/{index-sa9cp6km.js → index-ahv9y42z.js} +2 -2
  65. package/dist/client/static/js/{index-g33knza2.js → index-b29afsjh.js} +1 -1
  66. package/dist/client/static/js/{index-629kfbcb.js → index-c3ek61zv.js} +2 -2
  67. package/dist/client/static/js/{index-360d7j0d.js → index-cd65zqba.js} +1 -1
  68. package/dist/client/static/js/{index-4s8ttfxj.js → index-cgzrpvzj.js} +211 -211
  69. package/dist/client/static/js/{index-gbfg0anm.js → index-dbe6afkf.js} +2 -2
  70. package/dist/client/static/js/{index-z4v1xmh1.js → index-ev3yt353.js} +2 -2
  71. package/dist/client/static/js/{index-ehcpzk5b.js → index-eyfcm0cy.js} +1 -1
  72. package/dist/client/static/js/{index-a733k69t.js → index-f7jhhqtk.js} +2 -2
  73. package/dist/client/static/js/{index-hc2jmzpx.js → index-fta1y9pc.js} +65 -65
  74. package/dist/client/static/js/{index-vd0e25p0.js → index-fvmfge3p.js} +1 -1
  75. package/dist/client/static/js/{index-a6k2hqke.js → index-g2dyfze9.js} +1 -1
  76. package/dist/client/static/js/index-h5bn97p6.js +2 -0
  77. package/dist/client/static/js/{index-7fdp9c7m.js → index-hf52f59k.js} +2 -2
  78. package/dist/client/static/js/{index-qkscve6n.js → index-j0r5hj0j.js} +2 -2
  79. package/dist/client/static/js/{index-ejgd8w3s.js → index-j51d5a5m.js} +28 -28
  80. package/dist/client/static/js/{index-kpspnztv.js → index-jsyekbx9.js} +2 -2
  81. package/dist/client/static/js/{index-a0bdavdr.js → index-km2zb6wk.js} +2 -2
  82. package/dist/client/static/js/{index-59jb53v3.js → index-nccwxv0s.js} +2 -2
  83. package/dist/client/static/js/{index-dnp07j57.js → index-p0nz38bm.js} +1 -1
  84. package/dist/client/static/js/{index-c0x6s6f7.js → index-pm6xxwz1.js} +2 -2
  85. package/dist/client/static/js/{index-5x95n3hx.js → index-ptcrwswj.js} +1 -1
  86. package/dist/client/static/js/{index-fdbfzshx.js → index-ptcwae2n.js} +2 -2
  87. package/dist/client/static/js/{index-h7pn9qw6.js → index-qckv9nte.js} +2 -2
  88. package/dist/client/static/js/{index-wzma5n54.js → index-r014brzs.js} +2 -2
  89. package/dist/client/static/js/{index-xj9649ac.js → index-ray2czf6.js} +7 -7
  90. package/dist/client/static/js/{index-qnwqaczk.js → index-rs80cwsv.js} +3 -3
  91. package/dist/client/static/js/{index-pf5sbesf.js → index-rytaa8ca.js} +2 -2
  92. package/dist/client/static/js/{index-c93sp4yh.js → index-rzxcj7cg.js} +1 -1
  93. package/dist/client/static/js/{index-a293pdg7.js → index-s7gkkkyz.js} +2 -2
  94. package/dist/client/static/js/{index-7n68yx6m.js → index-sd66wv26.js} +2 -2
  95. package/dist/client/static/js/{index-bbggh3f8.js → index-vhqe0y82.js} +2 -2
  96. package/dist/client/static/js/{index-dq1kdt03.js → index-vy6termr.js} +1 -1
  97. package/dist/client/static/js/{index-pf7syd7t.js → index-xx6mqpxm.js} +3 -3
  98. package/dist/client/static/js/{index-z5s27s26.js → index-ybm2x4vh.js} +1 -1
  99. package/dist/client/static/js/{index-jppt5mgc.js → index-zvfvqvn9.js} +2 -2
  100. package/dist/client/static/js/info-A6RAGUB7-3hk844f7.js +1 -0
  101. package/dist/client/static/js/{infoDiagram-VRGFBTTK-3w1yz32c.js → infoDiagram-VRGFBTTK-sef80132.js} +2 -2
  102. package/dist/client/static/js/ini-j5dyq6gm.js +1 -0
  103. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-ckt471dy.js → ishikawaDiagram-OU5B5YK6-yhvepp1q.js} +6 -6
  104. package/dist/client/static/js/java-g4dgwbfd.js +1 -0
  105. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-kfvn4w7e.js → journeyDiagram-ZHPQQLJL-5w77y95w.js} +5 -5
  106. package/dist/client/static/js/jsx-7t5ecz9s.js +1 -0
  107. package/dist/client/static/js/{julia-0j0gsjvc.js → julia-d4j6wgvf.js} +1 -1
  108. package/dist/client/static/js/{kanban-definition-PNTS6WVX-0q36cm83.js → kanban-definition-PNTS6WVX-02znqtna.js} +6 -6
  109. package/dist/client/static/js/lua-1g6w30de.js +1 -0
  110. package/dist/client/static/js/markdown-afx21x8c.js +1 -0
  111. package/dist/client/static/js/{mermaid.core-b1ssa824.js → mermaid.core-a6e6vck4.js} +6 -6
  112. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-e2ym5en8.js → mindmap-definition-NLK3R4M7-y4n74q9x.js} +8 -8
  113. package/dist/client/static/js/one-dark-pro-vwhfpzr8.js +1 -0
  114. package/dist/client/static/js/one-light-y5t9x6zh.js +1 -0
  115. package/dist/client/static/js/packet-AYTQ26CC-4nj2yy10.js +1 -0
  116. package/dist/client/static/js/{pegDiagram-GJSIUBJH-t8bbdyhe.js → pegDiagram-GJSIUBJH-pr7ehgzb.js} +1 -1
  117. package/dist/client/static/js/{perl-7n7e9ncg.js → perl-srptw5vm.js} +1 -1
  118. package/dist/client/static/js/{php-32vy69vd.js → php-n89g3fk7.js} +1 -1
  119. package/dist/client/static/js/pie-WAS4IAKB-k7rde3f9.js +1 -0
  120. package/dist/client/static/js/{pieDiagram-5QR66LMP-envv4brj.js → pieDiagram-5QR66LMP-39wpsk08.js} +2 -2
  121. package/dist/client/static/js/properties-thd83wey.js +1 -0
  122. package/dist/client/static/js/python-264ns4xw.js +1 -0
  123. package/dist/client/static/js/{quadrantDiagram-O4NWA36T-72rk137a.js → quadrantDiagram-O4NWA36T-esm913km.js} +4 -4
  124. package/dist/client/static/js/r-qw82kkv9.js +1 -0
  125. package/dist/client/static/js/radar-RG4KPBEZ-513dpw4f.js +1 -0
  126. package/dist/client/static/js/railroad-74A4TZTK-9bqnst9c.js +1 -0
  127. package/dist/client/static/js/railroad-abnf-HS5TGJTU-7367d5bv.js +1 -0
  128. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-b806b1mj.js +1 -0
  129. package/dist/client/static/js/railroad-peg-WCYAUIDC-5a67rwf8.js +1 -0
  130. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-1ej0f5hr.js → railroadDiagram-XR7U4H2S-wy2mgya6.js} +1 -1
  131. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-rvdaknpd.js → requirementDiagram-PLB6GJNP-6z9xdgbq.js} +4 -4
  132. package/dist/client/static/js/{ruby-5ty7fys7.js → ruby-r81ytgcm.js} +1 -1
  133. package/dist/client/static/js/{rust-2geezrcs.js → rust-frn3szvc.js} +1 -1
  134. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-nxvhtdaw.js → sankeyDiagram-IPEJSGJF-rtmxk3ys.js} +5 -5
  135. package/dist/client/static/js/{sass-mey5150f.js → sass-9bxped7y.js} +1 -1
  136. package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-n5cn5qrt.js → sequenceDiagram-PO4LG4MO-awzcrafg.js} +18 -18
  137. package/dist/client/static/js/{sizeCapture-INFHLROL-r074kj7s.js → sizeCapture-INFHLROL-03gy196j.js} +1 -1
  138. package/dist/client/static/js/sql-0e9mnrda.js +1 -0
  139. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-vxghxdb0.js → stateDiagram-v2-GCMORJYK-an8v3q5n.js} +3 -3
  140. package/dist/client/static/js/{svelte-3ewx0hzx.js → svelte-mwtx07d9.js} +1 -1
  141. package/dist/client/static/js/{swimlanes-2SLR337P-qkkv894p.js → swimlanes-2SLR337P-n9yb4wcs.js} +1 -1
  142. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-nx5nfnf0.js +8 -0
  143. package/dist/client/static/js/{timeline-definition-EJHVYXUP-5tbq4ex2.js → timeline-definition-EJHVYXUP-jceb575g.js} +4 -4
  144. package/dist/client/static/js/treeView-Q6P3EWNA-kcy40evb.js +1 -0
  145. package/dist/client/static/js/treemap-WGGIJYW6-fsrvqxf4.js +1 -0
  146. package/dist/client/static/js/tsx-nm94hed6.js +1 -0
  147. package/dist/client/static/js/typescript-0s2t05jj.js +1 -0
  148. package/dist/client/static/js/{usecaseDiagram-POWQR4AR-6p8hf0b7.js → usecaseDiagram-POWQR4AR-888h3100.js} +39 -39
  149. package/dist/client/static/js/vennDiagram-UO4OBE2U-wbfz0rzv.js +34 -0
  150. package/dist/client/static/js/{vue-06rdf4wh.js → vue-c0rtg1wf.js} +1 -1
  151. package/dist/client/static/js/wardley-WFR3VGLG-36dmxww4.js +1 -0
  152. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-km2x4er8.js → wardleyDiagram-VNRHLVJA-rn8c5qf9.js} +4 -4
  153. package/dist/client/static/js/xml-dz51p1m3.js +1 -0
  154. package/dist/client/static/js/{xychartDiagram-PMCCYNJV-kr3sgr4m.js → xychartDiagram-PMCCYNJV-8sn1apt6.js} +5 -5
  155. package/dist/client/static/js/yaml-2cfkd30t.js +1 -0
  156. package/package.json +4 -1
  157. package/src/client/components/auth/login-screen/index.tsx +1 -0
  158. package/src/client/components/common/MarkdownRenderer.tsx +9 -12
  159. package/src/client/components/common/context-usage-button/McpSection.test.tsx +98 -0
  160. package/src/client/components/common/context-usage-button/McpSection.tsx +12 -5
  161. package/src/client/components/common/context-usage-button/SessionStats.tsx +80 -0
  162. package/src/client/components/common/context-usage-button/index.test.tsx +26 -0
  163. package/src/client/components/common/context-usage-button/index.tsx +36 -28
  164. package/src/client/components/common/harness-glyph/brands.ts +8 -0
  165. package/src/client/components/mobile/LayoutWrapper.tsx +12 -3
  166. package/src/client/components/mobile/mobile-right-sidebar/FullDiff.tsx +9 -2
  167. package/src/client/components/settings/Modal.tsx +14 -84
  168. package/src/client/components/settings/Sidebar.tsx +3 -1
  169. package/src/client/components/settings/apply-side-effects.test.ts +11 -0
  170. package/src/client/components/settings/apply-side-effects.ts +7 -0
  171. package/src/client/components/settings/categories/ChatSettings.test.tsx +1 -1
  172. package/src/client/components/settings/categories/ChatSettings.tsx +2 -0
  173. package/src/client/components/settings/categories/ConnectSettings.tsx +105 -0
  174. package/src/client/components/settings/categories/NotificationSettings.tsx +1 -1
  175. package/src/client/components/settings/categories/chat-settings/ChangedFilesSection.tsx +79 -0
  176. package/src/client/components/settings/categories/chat-settings/groups.ts +4 -3
  177. package/src/client/components/settings/categories/connect-settings/DeviceTable.tsx +145 -0
  178. package/src/client/components/settings/categories/connect-settings/PairDialog.tsx +160 -0
  179. package/src/client/components/settings/categories/connect-settings/QrCode.tsx +73 -0
  180. package/src/client/components/settings/categories/connect-settings/ServerCard.tsx +94 -0
  181. package/src/client/components/settings/categories/connect-settings/TunnelRow.tsx +127 -0
  182. package/src/client/components/settings/category-content.tsx +116 -0
  183. package/src/client/components/workspace/chat-timeline/ChangedFilesSummary.test.tsx +120 -0
  184. package/src/client/components/workspace/chat-timeline/ChangedFilesSummary.tsx +137 -0
  185. package/src/client/components/workspace/chat-timeline/MessageList.tsx +33 -1
  186. package/src/client/components/workspace/chat-timeline/RunFooter.tsx +22 -1
  187. package/src/client/components/workspace/chat-timeline/TimelineBody.tsx +13 -0
  188. package/src/client/components/workspace/chat-timeline/index.tsx +1 -1
  189. package/src/client/components/workspace/diff-panel/Toolbar.tsx +17 -51
  190. package/src/client/components/workspace/diff-panel/index.tsx +23 -4
  191. package/src/client/components/workspace/diff-panel/toolbar-git-actions.tsx +94 -0
  192. package/src/client/components/workspace/editor/Body.tsx +2 -0
  193. package/src/client/data/settings/omp-schema.json +73 -3
  194. package/src/client/hooks/chat/timeline/change-stats.ts +57 -0
  195. package/src/client/hooks/chat/timeline/changed-files-setting.test.ts +31 -0
  196. package/src/client/hooks/chat/timeline/changed-files-setting.ts +60 -0
  197. package/src/client/hooks/chat/timeline/session-changes.ts +51 -0
  198. package/src/client/hooks/connect/use-connect-status.ts +116 -0
  199. package/src/client/hooks/connect/use-pairing.ts +100 -0
  200. package/src/client/hooks/ui/clipboard.ts +26 -0
  201. package/src/client/hooks/ui/notification-events.test.ts +3 -0
  202. package/src/client/hooks/ui/notification-events.ts +3 -1
  203. package/src/client/hooks/ui/notification-sound.ts +13 -6
  204. package/src/client/hooks/ui/ui-sounds.test.ts +15 -0
  205. package/src/client/hooks/workspace/diff-file.ts +11 -4
  206. package/src/client/hooks/workspace/file-tabs.ts +13 -4
  207. package/src/client/hooks/workspace/journal-diff.ts +97 -0
  208. package/src/client/lib/notifications/native-banner-sound.test.ts +93 -0
  209. package/src/client/lib/notifications/native-banner-sound.ts +46 -0
  210. package/src/client/lib/notifications/os.test.ts +14 -5
  211. package/src/client/lib/notifications/os.ts +8 -0
  212. package/src/client/tailwind.css +5 -0
  213. package/src/server/index.ts +2 -0
  214. package/src/server/lib/assets/font-css.server.test.ts +19 -0
  215. package/src/server/lib/auth/client-address.test.ts +58 -0
  216. package/src/server/lib/auth/client-address.ts +37 -3
  217. package/src/server/lib/auth/guard.ts +31 -4
  218. package/src/server/lib/auth/rate-limit.test.ts +25 -8
  219. package/src/server/lib/auth/rate-limit.ts +8 -5
  220. package/src/server/lib/connect/cloudflared.lifecycle.test.ts +88 -0
  221. package/src/server/lib/connect/cloudflared.server.test.ts +65 -0
  222. package/src/server/lib/connect/cloudflared.server.ts +206 -0
  223. package/src/server/lib/connect/devices.server.ts +192 -0
  224. package/src/server/lib/connect/identity.server.ts +81 -0
  225. package/src/server/lib/connect/pairing.server.test.ts +56 -0
  226. package/src/server/lib/connect/pairing.server.ts +113 -0
  227. package/src/server/lib/connect/qr.roundtrip.test.ts +106 -0
  228. package/src/server/lib/connect/qr.server.ts +36 -0
  229. package/src/server/lib/connect/run.server.ts +101 -0
  230. package/src/server/lib/connect/status.server.ts +177 -0
  231. package/src/server/lib/connect/tailscale.server.test.ts +117 -0
  232. package/src/server/lib/connect/tailscale.server.ts +172 -0
  233. package/src/server/lib/db/schema.ts +4 -0
  234. package/src/server/lib/harness/launch-table.ts +10 -0
  235. package/src/server/lib/omp/session/changes.test.ts +201 -0
  236. package/src/server/lib/omp/session/changes.ts +313 -0
  237. package/src/server/lib/omp/session/session-discovery.test.ts +4 -4
  238. package/src/server/lib/omp/session/sidebar-activity.server.test.ts +6 -2
  239. package/src/server/lib/omp/session/subagent-presence-scan.ts +54 -0
  240. package/src/server/lib/omp/session/subagent-presence-store.test.ts +1 -1
  241. package/src/server/lib/omp/session/subagent-presence.test.ts +115 -0
  242. package/src/server/lib/omp/session/subagent-presence.ts +12 -3
  243. package/src/server/lib/omp/session/telemetry/compute.ts +68 -0
  244. package/src/server/lib/omp/session/telemetry.test.ts +81 -0
  245. package/src/server/routes/connect/devices.ts +56 -0
  246. package/src/server/routes/connect/index.ts +15 -0
  247. package/src/server/routes/connect/pair-page.ts +177 -0
  248. package/src/server/routes/connect/pair.ts +158 -0
  249. package/src/server/routes/connect/status.ts +19 -0
  250. package/src/server/routes/connect/tunnels.ts +76 -0
  251. package/src/server/routes/health/probe.ts +5 -0
  252. package/src/server/routes/index.ts +2 -0
  253. package/src/server/routes/sessions/changes.test.ts +99 -0
  254. package/src/server/routes/sessions/changes.ts +79 -0
  255. package/src/server/routes/sessions/index.ts +7 -0
  256. package/src/shared/lib/chat/duration.ts +34 -0
  257. package/src/shared/lib/chat/timeline/changed-files.test.ts +121 -0
  258. package/src/shared/lib/chat/timeline/changed-files.ts +71 -0
  259. package/src/shared/lib/chat/timeline/fork-anchor.test.ts +3 -0
  260. package/src/shared/lib/connect/payload.test.ts +144 -0
  261. package/src/shared/lib/connect/payload.ts +229 -0
  262. package/src/shared/lib/connect/tier.test.ts +73 -0
  263. package/src/shared/lib/connect/tier.ts +105 -0
  264. package/src/shared/lib/connect/types.ts +99 -0
  265. package/src/shared/lib/format/duration.test.ts +31 -0
  266. package/src/shared/lib/format/duration.ts +27 -0
  267. package/src/shared/lib/fs/unified-diff.test.ts +53 -0
  268. package/src/shared/lib/fs/unified-diff.ts +127 -0
  269. package/src/shared/lib/harness/brand-color.ts +3 -0
  270. package/src/shared/lib/harness/catalog.test.ts +13 -0
  271. package/src/shared/lib/harness/catalog.ts +8 -1
  272. package/src/shared/lib/harness/fork.ts +4 -2
  273. package/src/shared/lib/harness/mcp-facts.ts +3 -0
  274. package/src/shared/lib/harness/provider-facts.ts +14 -0
  275. package/src/shared/lib/harness/updates.ts +5 -0
  276. package/src/shared/lib/icons/tint-hues.generated.ts +27 -27
  277. package/src/shared/lib/markdown/fira-code-fonts.css +65 -6
  278. package/src/shared/lib/markdown/marked.ts +7 -4
  279. package/src/shared/lib/markdown/mermaid-actions.test.ts +78 -0
  280. package/src/shared/lib/markdown/mermaid-actions.ts +45 -0
  281. package/src/shared/lib/markdown/mermaid.ts +41 -7
  282. package/src/shared/lib/omp/config/schema.test.ts +4 -2
  283. package/src/shared/lib/settings/defaults.ts +1 -0
  284. package/src/shared/lib/settings/sections.ts +6 -1
  285. package/src/shared/lib/workspace/file-tab-id.ts +9 -0
  286. package/src/shared/types/context.ts +18 -0
  287. package/src/shared/types/fs.ts +21 -0
  288. package/src/shared/types/index.ts +1 -0
  289. package/src/shared/types/omp/session.ts +6 -0
  290. package/src/shared/types/session-changes.ts +64 -0
  291. package/src/shared/types/settings/state.ts +10 -0
  292. package/dist/client/static/js/LayoutWrapper-xjnveecv.js +0 -2
  293. package/dist/client/static/js/Modal-k2jr9hc4.js +0 -38
  294. package/dist/client/static/js/architecture-7GRP2DOG-1y9zvsyt.js +0 -1
  295. package/dist/client/static/js/bash-m0qjsyy0.js +0 -1
  296. package/dist/client/static/js/css-t4ngafan.js +0 -1
  297. package/dist/client/static/js/cynefin-OW5HDTMX-k2188qcq.js +0 -1
  298. package/dist/client/static/js/eventmodeling-NTZA5JFV-pdr0qn0n.js +0 -1
  299. package/dist/client/static/js/flowDiagram-KWPJA3E3-zvz0mxne.js +0 -1
  300. package/dist/client/static/js/gitGraph-4MIJSDKK-wmqf046s.js +0 -1
  301. package/dist/client/static/js/graphql-692h0n2x.js +0 -1
  302. package/dist/client/static/js/html-pv88ny12.js +0 -1
  303. package/dist/client/static/js/index-61tm0v57.js +0 -1
  304. package/dist/client/static/js/index-e94a1en0.css +0 -1
  305. package/dist/client/static/js/index-kg86e3sy.js +0 -12
  306. package/dist/client/static/js/index-nmmxb4va.js +0 -2
  307. package/dist/client/static/js/info-A6RAGUB7-zg3twte6.js +0 -1
  308. package/dist/client/static/js/ini-cg0a5wm3.js +0 -1
  309. package/dist/client/static/js/java-vcck089n.js +0 -1
  310. package/dist/client/static/js/jsx-ht9zyzwa.js +0 -1
  311. package/dist/client/static/js/lua-ke895s2q.js +0 -1
  312. package/dist/client/static/js/markdown-gwmsh53r.js +0 -1
  313. package/dist/client/static/js/one-dark-pro-4geyzhjj.js +0 -1
  314. package/dist/client/static/js/one-light-tqssjm9t.js +0 -1
  315. package/dist/client/static/js/packet-AYTQ26CC-3pav51g0.js +0 -1
  316. package/dist/client/static/js/pie-WAS4IAKB-wqfh7zdk.js +0 -1
  317. package/dist/client/static/js/properties-mzvvbqg5.js +0 -1
  318. package/dist/client/static/js/python-3w64wsyd.js +0 -1
  319. package/dist/client/static/js/r-32re2zwb.js +0 -1
  320. package/dist/client/static/js/radar-RG4KPBEZ-w7qjdr2g.js +0 -1
  321. package/dist/client/static/js/railroad-74A4TZTK-rhr99kkj.js +0 -1
  322. package/dist/client/static/js/railroad-abnf-HS5TGJTU-c4jeea3m.js +0 -1
  323. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-x2ee66ex.js +0 -1
  324. package/dist/client/static/js/railroad-peg-WCYAUIDC-yw8wjfwg.js +0 -1
  325. package/dist/client/static/js/sql-g8wcshpc.js +0 -1
  326. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-y81h9n27.js +0 -8
  327. package/dist/client/static/js/treeView-Q6P3EWNA-ekz05ccs.js +0 -1
  328. package/dist/client/static/js/treemap-WGGIJYW6-aq6qymjr.js +0 -1
  329. package/dist/client/static/js/tsx-0p183w2f.js +0 -1
  330. package/dist/client/static/js/typescript-t9a5jyvv.js +0 -1
  331. package/dist/client/static/js/vennDiagram-UO4OBE2U-7k5jsxf9.js +0 -34
  332. package/dist/client/static/js/wardley-WFR3VGLG-z34tj4y3.js +0 -1
  333. package/dist/client/static/js/xml-81hxjjt4.js +0 -1
  334. package/dist/client/static/js/yaml-yssayv8a.js +0 -1
@@ -2,8 +2,10 @@ import { useCallback, useRef, useState } from 'preact/hooks';
2
2
  import { useSessionUiState } from '@/client/hooks/workspace/session-state';
3
3
  import { isUnmergedCode } from '@/shared/lib/fs/git-unmerged';
4
4
  import { useFileDiff } from '@/client/hooks/workspace/diff-file';
5
+ import { useJournalDiff } from '@/client/hooks/workspace/journal-diff';
5
6
  import { useDiffGitActions } from '@/client/hooks/workspace/diff-git-actions';
6
7
  import { getLanguageFromPath } from '@/shared/lib/code/language';
8
+ import type { JournalDiffRef } from '@/shared/types/fs';
7
9
  import { DiffToolbar, type DiffContentMode, type DiffViewMode } from '@/client/components/workspace/diff-panel/Toolbar';
8
10
  import { ConflictBanner } from '@/client/components/workspace/diff-panel/ConflictBanner';
9
11
  import { ThemedMergeDiffView } from '@/client/components/workspace/diff-panel/ThemedMergeDiffView';
@@ -33,6 +35,14 @@ interface DiffPanelProps {
33
35
  * already covers the chat and the sidebar.
34
36
  */
35
37
  viewModeButtons?: boolean;
38
+ /**
39
+ * Read the two sides from the session's agent change journal instead of the
40
+ * worktree. The panel then shows what the agent wrote, even after someone
41
+ * else edited the file, and its git writes are hidden.
42
+ */
43
+ journalDiff?: JournalDiffRef;
44
+ /** Hide the git writes (stage / discard). Implied by `journalDiff`. */
45
+ readOnly?: boolean;
36
46
  }
37
47
 
38
48
  export function DiffPanel({
@@ -46,6 +56,8 @@ export function DiffPanel({
46
56
  className = '',
47
57
  tabKey = null,
48
58
  viewModeButtons = true,
59
+ journalDiff,
60
+ readOnly = false,
49
61
  }: DiffPanelProps) {
50
62
  // Read and persist view mode & whitespace preference in session_ui_state
51
63
  const [viewMode, setViewMode] = useSessionUiState<DiffViewMode>('diff.viewMode', 'unified');
@@ -75,6 +87,11 @@ export function DiffPanel({
75
87
  }, []);
76
88
  const editorFontFamily = useEditorFontStack();
77
89
 
90
+ // Both hooks run unconditionally (hooks cannot be conditional); the journal
91
+ // one is inert without a ref, and the git one is told not to read when the
92
+ // journal owns the panel.
93
+ const gitDiff = useFileDiff({ filePath, status, isStaged, repo, root, enabled: !journalDiff });
94
+ const journalDiffState = useJournalDiff(journalDiff);
78
95
  const {
79
96
  rawDiff,
80
97
  oldContent,
@@ -85,8 +102,9 @@ export function DiffPanel({
85
102
  errorMessage,
86
103
  fetchDiff,
87
104
  adoptState,
88
- } = useFileDiff({ filePath, status, isStaged, repo, root });
89
- const conflicted = isUnmergedCode(currentStatus);
105
+ } = journalDiff ? journalDiffState : gitDiff;
106
+ const conflicted = !journalDiff && isUnmergedCode(currentStatus);
107
+ const isReadOnly = readOnly || Boolean(journalDiff);
90
108
 
91
109
  const language = getLanguageFromPath(filePath);
92
110
  // A contributed renderer replaces the built-in views below, never the toolbar.
@@ -168,12 +186,13 @@ export function DiffPanel({
168
186
  isCopied={isCopied}
169
187
  isBusy={isBusy}
170
188
  viewModeButtons={viewModeButtons}
189
+ readOnly={isReadOnly}
171
190
  onSetViewMode={handleSetViewMode}
172
191
  onSetContentMode={handleSetContentMode}
173
192
  onToggleWordWrap={handleToggleWordWrap}
174
193
  onToggleWhitespace={handleToggleWhitespace}
175
- onStageUnstage={() => void gitActions.stageUnstage()}
176
- onDiscard={() => setShowDiscardConfirm(true)}
194
+ onStageUnstage={() => { if (!isReadOnly) void gitActions.stageUnstage(); }}
195
+ onDiscard={() => { if (!isReadOnly) setShowDiscardConfirm(true); }}
177
196
  onOpenInEditor={onOpenInEditor}
178
197
  onRefresh={() => void fetchDiff()}
179
198
  onCopyDiff={handleCopyDiff}
@@ -0,0 +1,94 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The diff toolbar's two git writes, as clusters.
8
+ *
9
+ * Split out of `Toolbar.tsx` when the journal diff added a `readOnly` mode: the
10
+ * file was already at the repo's line ceiling, and these are the only clusters
11
+ * that write to git. A journal diff shows the agent's own snapshots, which are
12
+ * not the worktree, so it renders neither.
13
+ */
14
+
15
+ import { Minus, Plus, Undo2 } from 'lucide-preact';
16
+ import type { ToolbarCluster } from '@/client/components/common/toolbar-row';
17
+
18
+ /** Shared class for the toolbar's icon buttons. */
19
+ export const ACTION_CLASS =
20
+ 'flex items-center justify-center p-1.5 rounded transition-colors cursor-pointer disabled:cursor-default disabled:opacity-40 disabled:hover:bg-transparent disabled:hover:text-ink/50';
21
+
22
+ interface GitActionClustersArgs {
23
+ isStaged: boolean;
24
+ /** A write is in flight; the actions lock. */
25
+ locked: boolean;
26
+ /** A journal diff: no git writes at all. */
27
+ readOnly: boolean;
28
+ stageLabel: string;
29
+ onStageUnstage: () => void;
30
+ onDiscard: () => void;
31
+ }
32
+
33
+ /** Discard (unstaged only) and Stage/Unstage, in the toolbar's visual order. */
34
+ export function gitActionClusters({
35
+ isStaged,
36
+ locked,
37
+ readOnly,
38
+ stageLabel,
39
+ onStageUnstage,
40
+ onDiscard,
41
+ }: GitActionClustersArgs): ToolbarCluster[] {
42
+ if (readOnly) return [];
43
+ const clusters: ToolbarCluster[] = [];
44
+
45
+ if (!isStaged) {
46
+ clusters.push({
47
+ id: 'discard',
48
+ actions: [{ label: 'Discard changes in this file', icon: Undo2, onSelect: onDiscard, disabled: locked }],
49
+ children: (
50
+ <button
51
+ type="button"
52
+ onClick={onDiscard}
53
+ className={`${ACTION_CLASS} text-ink/50 hover:text-error hover:bg-error/10`}
54
+ title="Discard changes in this file"
55
+ aria-label="Discard changes in this file"
56
+ disabled={locked}
57
+ >
58
+ <Undo2 size={13} />
59
+ </button>
60
+ ),
61
+ });
62
+ }
63
+
64
+ clusters.push({
65
+ id: 'stage',
66
+ // The panel's primary write: a menu row must not be the only way to stage.
67
+ pinned: true,
68
+ actions: [{ label: stageLabel, icon: isStaged ? Minus : Plus, onSelect: onStageUnstage, disabled: locked }],
69
+ children: (
70
+ <button
71
+ type="button"
72
+ onClick={onStageUnstage}
73
+ className="px-2 py-1 text-[11px] font-medium rounded border border-ink/15 hover:bg-ink/5 flex items-center space-x-1 transition-colors text-ink cursor-pointer disabled:cursor-default disabled:opacity-40 disabled:hover:bg-transparent"
74
+ title={stageLabel}
75
+ aria-label={stageLabel}
76
+ disabled={locked}
77
+ >
78
+ {isStaged ? (
79
+ <>
80
+ <Minus size={12} />
81
+ <span className="hidden @[360px]:inline">Unstage</span>
82
+ </>
83
+ ) : (
84
+ <>
85
+ <Plus size={12} />
86
+ <span className="hidden @[360px]:inline">Stage</span>
87
+ </>
88
+ )}
89
+ </button>
90
+ ),
91
+ });
92
+
93
+ return clusters;
94
+ }
@@ -98,6 +98,8 @@ export function EditorBody({
98
98
  isStaged={Boolean(activeFile.diffStaged)}
99
99
  root={activeFile.root}
100
100
  repo={activeFile.repo || '.'}
101
+ journalDiff={activeFile.journalDiff}
102
+ readOnly={activeFile.diffSource === 'journal'}
101
103
  onOpenInEditor={() => onConvertDiffToEditor(activeFile.id)}
102
104
  onFileSaved={onFileSaved}
103
105
  className="flex-1"
@@ -1,5 +1,5 @@
1
1
  {
2
- "source": "@oh-my-pi/pi-coding-agent 10 tabs / 615 settings",
2
+ "source": "@oh-my-pi/pi-coding-agent 10 tabs / 622 settings",
3
3
  "tabs": [
4
4
  {
5
5
  "id": "appearance",
@@ -124,6 +124,24 @@
124
124
  }
125
125
  ],
126
126
  "entries": {
127
+ "auth.unpausedProviders": {
128
+ "type": "array",
129
+ "default": [],
130
+ "ui": {
131
+ "tab": "providers",
132
+ "group": "Services",
133
+ "label": "Unpaused Providers",
134
+ "description": "Turn providers we paused back on: login, token refresh and stored credentials work again. Each pause names the account risk you accept. Project settings cannot set this",
135
+ "options": [
136
+ {
137
+ "value": "google-antigravity",
138
+ "label": "Google Antigravity (Gemini, Claude, GPT-OSS)",
139
+ "description": "Google Antigravity is paused: Google's terms do not allow third-party sign-in and Google has suspended accounts that used it (see #18341). Use GEMINI_API_KEY (AI Studio) or google-vertex instead."
140
+ }
141
+ ],
142
+ "condition": "unpausedProvidersNotProject"
143
+ }
144
+ },
127
145
  "modelRoleStorage": {
128
146
  "type": "enum",
129
147
  "default": "global",
@@ -6336,6 +6354,38 @@
6336
6354
  ]
6337
6355
  }
6338
6356
  },
6357
+ "todo.midRunNudges": {
6358
+ "type": "enum",
6359
+ "default": "capped",
6360
+ "values": [
6361
+ "off",
6362
+ "capped",
6363
+ "backoff"
6364
+ ],
6365
+ "ui": {
6366
+ "tab": "tools",
6367
+ "group": "Todos",
6368
+ "label": "Mid-Run Todo Nudges",
6369
+ "description": "How often a long turn is reminded to update its todo list while it keeps changing things",
6370
+ "options": [
6371
+ {
6372
+ "value": "off",
6373
+ "label": "Off",
6374
+ "description": "Never nudge mid-run"
6375
+ },
6376
+ {
6377
+ "value": "capped",
6378
+ "label": "Capped",
6379
+ "description": "Nudge after 12 edits or commands, at most twice until the todo list changes or you send a message"
6380
+ },
6381
+ {
6382
+ "value": "backoff",
6383
+ "label": "Backoff",
6384
+ "description": "Keep nudging with a doubling gap: after 12, 24, 48, 96, then every 192 edits or commands"
6385
+ }
6386
+ ]
6387
+ }
6388
+ },
6339
6389
  "todo.eager": {
6340
6390
  "type": "enum",
6341
6391
  "default": "default",
@@ -6431,7 +6481,7 @@
6431
6481
  },
6432
6482
  "grep.contextBefore": {
6433
6483
  "type": "number",
6434
- "default": 1,
6484
+ "default": 0,
6435
6485
  "ui": {
6436
6486
  "tab": "tools",
6437
6487
  "group": "Grep & Browser",
@@ -6463,7 +6513,7 @@
6463
6513
  },
6464
6514
  "grep.contextAfter": {
6465
6515
  "type": "number",
6466
- "default": 3,
6516
+ "default": 0,
6467
6517
  "ui": {
6468
6518
  "tab": "tools",
6469
6519
  "group": "Grep & Browser",
@@ -6628,6 +6678,16 @@
6628
6678
  "description": "Enable the read-only archive eval prelude: prompt history, recent projects, past sessions and recaps"
6629
6679
  }
6630
6680
  },
6681
+ "commit.enabled": {
6682
+ "type": "boolean",
6683
+ "default": true,
6684
+ "ui": {
6685
+ "tab": "tools",
6686
+ "group": "Available Tools",
6687
+ "label": "Selective commit",
6688
+ "description": "Enable the commit eval prelude and /commit: commit only the lines this agent and its subagents wrote"
6689
+ }
6690
+ },
6631
6691
  "computer.display": {
6632
6692
  "type": "string",
6633
6693
  "default": "active",
@@ -7189,6 +7249,16 @@
7189
7249
  "description": "Ordered bash command approval rules. Each item has match and approval fields; only '*' wildcards are supported."
7190
7250
  }
7191
7251
  },
7252
+ "bash.allowedEnvVars": {
7253
+ "type": "array",
7254
+ "default": [],
7255
+ "ui": {
7256
+ "tab": "shell",
7257
+ "group": "Bash",
7258
+ "label": "Bash Allowed Environment Variables",
7259
+ "description": "Exact environment variable names allowed as leading KEY=VALUE prefixes when matching bash.patterns allow rules (no wildcards). Any value is accepted, so list only benign build/test variables; execution-altering variables (PATH, LD_PRELOAD, BASH_ENV, *_RUNNER, *_WRAPPER) allow arbitrary command execution."
7260
+ }
7261
+ },
7192
7262
  "bashInterceptor.enabled": {
7193
7263
  "type": "boolean",
7194
7264
  "default": false,
@@ -0,0 +1,57 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The `+`/`−` line counts of one run's changed files.
8
+ *
9
+ * The chat's run summary prints a per-file and a total stat, so it needs counts
10
+ * without opening a diff. The server computes them from the same net pair the
11
+ * diff tab reads (first `before`, last `after`), so the number and the diff can
12
+ * never disagree.
13
+ *
14
+ * Read once per run summary the reader actually has on screen — the timeline
15
+ * mounts a window of rows, so a long session does not fetch every run's stats
16
+ * at once. A failed read leaves the counts absent; the file list itself still
17
+ * renders, and a made-up `0` would be a lie about the run.
18
+ */
19
+
20
+ import { useEffect, useState } from 'preact/hooks';
21
+ import type { SessionChangeCounts } from '@/shared/types';
22
+
23
+ /** Absolute path → the run's net counts for that path. */
24
+ export type ChangeStatsByPath = Record<string, SessionChangeCounts>;
25
+
26
+ export function useChangeStats(
27
+ sessionId: string | null,
28
+ from: number,
29
+ to: number,
30
+ ): ChangeStatsByPath {
31
+ const [stats, setStats] = useState<ChangeStatsByPath>({});
32
+
33
+ useEffect(() => {
34
+ if (!sessionId) {
35
+ setStats({});
36
+ return;
37
+ }
38
+ let cancelled = false;
39
+ void (async () => {
40
+ try {
41
+ const params = new URLSearchParams({ from: String(from), to: String(to) });
42
+ const res = await fetch(
43
+ `/api/sessions/${encodeURIComponent(sessionId)}/changes/stats?${params.toString()}`,
44
+ );
45
+ const data = (await res.json().catch(() => null)) as { files?: ChangeStatsByPath } | null;
46
+ if (!cancelled && data?.files) setStats(data.files);
47
+ } catch {
48
+ // Counts are an annotation; the list stays truthful without them.
49
+ }
50
+ })();
51
+ return () => {
52
+ cancelled = true;
53
+ };
54
+ }, [sessionId, from, to]);
55
+
56
+ return stats;
57
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The changed-files setting's read rule: on unless the stored value is the
8
+ * literal `false`. A missing key (an install that predates the setting) and a
9
+ * malformed value both keep the list, because the list is the only place the
10
+ * transcript says which files a run touched.
11
+ */
12
+
13
+ import { describe, expect, test } from 'bun:test';
14
+ import { primeKabmoSettings } from '@/shared/lib/settings/client';
15
+ import { currentShowChangedFiles } from '@/client/hooks/chat/timeline/changed-files-setting';
16
+
17
+ describe('currentShowChangedFiles', () => {
18
+ test('defaults on, and only the literal false turns it off', () => {
19
+ primeKabmoSettings({});
20
+ expect(currentShowChangedFiles()).toBe(true);
21
+
22
+ primeKabmoSettings({ showChangedFiles: false });
23
+ expect(currentShowChangedFiles()).toBe(false);
24
+
25
+ primeKabmoSettings({ showChangedFiles: true });
26
+ expect(currentShowChangedFiles()).toBe(true);
27
+
28
+ primeKabmoSettings({ showChangedFiles: 'no' });
29
+ expect(currentShowChangedFiles()).toBe(true);
30
+ });
31
+ });
@@ -0,0 +1,60 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The one reader/writer of the transcript's "N files changed" list.
8
+ *
9
+ * The list is a Preact subtree, so something in JavaScript must re-render when
10
+ * the setting moves. The settings modal calls {@link applyShowChangedFiles},
11
+ * which announces {@link CHANGED_FILES_CHANGED_EVENT}; {@link useShowChangedFiles}
12
+ * is the single subscriber, and the timeline is the only consumer.
13
+ *
14
+ * The initial value comes from the primed settings snapshot
15
+ * (`primeKabmoSettings` in `main.tsx`), so a mounted timeline draws the stored
16
+ * choice on its first render — no flash of the default.
17
+ */
18
+
19
+ import { useState } from 'preact/hooks';
20
+ import { readKabmoSetting } from '@/shared/lib/settings/client';
21
+ import { useKabmoEvent } from '@/client/hooks/ui/window-event';
22
+ import type { SettingsState } from '@/shared/types';
23
+
24
+ /**
25
+ * `app_settings` key holding the choice (in the `kabmo_settings` blob).
26
+ *
27
+ * `satisfies keyof SettingsState` because the key and the field name must be
28
+ * the same string for persistence to work at all — renaming the field without
29
+ * this line would leave the setting silently unsaved.
30
+ */
31
+ export const CHANGED_FILES_SETTING_KEY = 'showChangedFiles' satisfies keyof SettingsState;
32
+
33
+ /** Window event carrying the resolved boolean as `detail`. */
34
+ export const CHANGED_FILES_CHANGED_EVENT = 'omp:changed-files-changed';
35
+
36
+ /** The stored choice; only the literal `false` turns the list off. */
37
+ export function currentShowChangedFiles(appSettings?: Record<string, any>): boolean {
38
+ return readKabmoSetting<unknown>(CHANGED_FILES_SETTING_KEY, appSettings) !== false;
39
+ }
40
+
41
+ /**
42
+ * Announce a new choice. Called by the settings modal when the value changes —
43
+ * the persisted copy is written by the modal's own `writeKabmoSettings`, so
44
+ * this function only has to make the open timeline re-render.
45
+ */
46
+ export function applyShowChangedFiles(value: unknown): void {
47
+ if (typeof window === 'undefined') return;
48
+ window.dispatchEvent(
49
+ new CustomEvent(CHANGED_FILES_CHANGED_EVENT, { detail: value !== false }),
50
+ );
51
+ }
52
+
53
+ /** Whether the transcript should draw the list, kept live across settings edits. */
54
+ export function useShowChangedFiles(): boolean {
55
+ const [show, setShow] = useState<boolean>(() => currentShowChangedFiles());
56
+ useKabmoEvent(CHANGED_FILES_CHANGED_EVENT, (event) => {
57
+ setShow((event as CustomEvent<unknown>).detail !== false);
58
+ });
59
+ return show;
60
+ }
@@ -0,0 +1,51 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The session's agent change journal, for the chat's per-run file list.
8
+ *
9
+ * Read once per settled run: the journal is written while the agent works, so
10
+ * asking mid-run would show a partial list that then changes under the reader.
11
+ * A failed read keeps the previous list — a transient 500 is not a reason to
12
+ * blank a summary the reader is looking at.
13
+ */
14
+
15
+ import { useEffect, useState } from 'preact/hooks';
16
+ import type { SessionChangeRecord } from '@/shared/types';
17
+
18
+ export function useSessionChanges(
19
+ sessionId: string | null,
20
+ isGenerating: boolean,
21
+ enabled = true,
22
+ ): SessionChangeRecord[] {
23
+ const [records, setRecords] = useState<SessionChangeRecord[]>([]);
24
+
25
+ useEffect(() => {
26
+ if (!enabled) {
27
+ setRecords([]);
28
+ return;
29
+ }
30
+ if (!sessionId) {
31
+ setRecords([]);
32
+ return;
33
+ }
34
+ if (isGenerating) return;
35
+ let cancelled = false;
36
+ void (async () => {
37
+ try {
38
+ const res = await fetch(`/api/sessions/${encodeURIComponent(sessionId)}/changes`);
39
+ const data = (await res.json().catch(() => null)) as { records?: SessionChangeRecord[] } | null;
40
+ if (!cancelled && Array.isArray(data?.records)) setRecords(data.records);
41
+ } catch {
42
+ // Keep the previous list.
43
+ }
44
+ })();
45
+ return () => {
46
+ cancelled = true;
47
+ };
48
+ }, [sessionId, isGenerating, enabled]);
49
+
50
+ return records;
51
+ }
@@ -0,0 +1,116 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The Connect page's one read, and the three actions that change it.
8
+ *
9
+ * Every action answers with the WHOLE status payload rather than a boolean, so
10
+ * the address list and the tunnel card are redrawn from one snapshot. A second
11
+ * read after a toggle would let the two disagree for a frame — the card saying
12
+ * "up" while the address row still says "not running".
13
+ *
14
+ * A refusal is returned as a sentence, never swallowed: the server's own words
15
+ * ("Tailscale refused: HTTPS is not enabled for this tailnet") are the only
16
+ * place the user learns what to fix.
17
+ */
18
+
19
+ import { useCallback, useEffect, useState } from 'preact/hooks';
20
+ import type { ConnectStatus } from '@/shared/lib/connect/types';
21
+
22
+ export type TunnelProvider = 'cloudflare' | 'tailscale';
23
+ export type TunnelVerb = 'start' | 'stop';
24
+
25
+ export interface UseConnectStatusResult {
26
+ status: ConnectStatus | null;
27
+ /** Why the last read or action failed, in the server's words. */
28
+ error: string | null;
29
+ /** Which control is in flight, so only that one is disabled. */
30
+ busy: string | null;
31
+ refresh: () => Promise<void>;
32
+ setTunnel: (provider: TunnelProvider, verb: TunnelVerb) => Promise<string | null>;
33
+ revoke: (id: string) => Promise<string | null>;
34
+ }
35
+
36
+ interface StatusEnvelope {
37
+ status?: ConnectStatus;
38
+ error?: string;
39
+ }
40
+
41
+ export function useConnectStatus(): UseConnectStatusResult {
42
+ const [status, setStatus] = useState<ConnectStatus | null>(null);
43
+ const [error, setError] = useState<string | null>(null);
44
+ const [busy, setBusy] = useState<string | null>(null);
45
+
46
+ const refresh = useCallback(async () => {
47
+ try {
48
+ const response = await fetch('/api/connect/status', { headers: { accept: 'application/json' } });
49
+ if (!response.ok) {
50
+ setError(`Could not read the connection state (HTTP ${response.status}).`);
51
+ return;
52
+ }
53
+ setStatus((await response.json()) as ConnectStatus);
54
+ setError(null);
55
+ } catch (cause) {
56
+ setError(cause instanceof Error ? cause.message : 'Could not read the connection state.');
57
+ }
58
+ }, []);
59
+
60
+ useEffect(() => {
61
+ void refresh();
62
+ }, [refresh]);
63
+
64
+ const setTunnel = useCallback(
65
+ async (provider: TunnelProvider, verb: TunnelVerb): Promise<string | null> => {
66
+ setBusy(`${provider}:${verb}`);
67
+ try {
68
+ const response = await fetch('/api/connect/tunnels', {
69
+ method: 'POST',
70
+ headers: { 'content-type': 'application/json' },
71
+ body: JSON.stringify({ provider, action: verb }),
72
+ });
73
+ const payload = (await response.json().catch(() => null)) as StatusEnvelope | null;
74
+ if (payload?.status) setStatus(payload.status);
75
+ if (!response.ok) {
76
+ const message = payload?.error ?? `The tunnel did not change (HTTP ${response.status}).`;
77
+ setError(message);
78
+ return message;
79
+ }
80
+ setError(null);
81
+ return null;
82
+ } catch (cause) {
83
+ const message = cause instanceof Error ? cause.message : 'The tunnel did not change.';
84
+ setError(message);
85
+ return message;
86
+ } finally {
87
+ setBusy(null);
88
+ }
89
+ },
90
+ [],
91
+ );
92
+
93
+ const revoke = useCallback(async (id: string): Promise<string | null> => {
94
+ setBusy(`device:${id}`);
95
+ try {
96
+ const response = await fetch(`/api/connect/devices?id=${encodeURIComponent(id)}`, { method: 'DELETE' });
97
+ const payload = (await response.json().catch(() => null)) as { devices?: ConnectStatus['devices']; error?: string } | null;
98
+ if (!response.ok) {
99
+ const message = payload?.error ?? `Could not revoke that device (HTTP ${response.status}).`;
100
+ setError(message);
101
+ return message;
102
+ }
103
+ setStatus((current) => (current && payload?.devices ? { ...current, devices: payload.devices } : current));
104
+ setError(null);
105
+ return null;
106
+ } catch (cause) {
107
+ const message = cause instanceof Error ? cause.message : 'Could not revoke that device.';
108
+ setError(message);
109
+ return message;
110
+ } finally {
111
+ setBusy(null);
112
+ }
113
+ }, []);
114
+
115
+ return { status, error, busy, refresh, setTunnel, revoke };
116
+ }