@kabmo-labs/kabmo 0.40.0 → 0.42.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 (326) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +533 -517
  3. package/dist/client/static/js/{CsvGrid-j9nvnhq1.js → CsvGrid-20k047ht.js} +2 -2
  4. package/dist/client/static/js/{DocxView-87gnpm81.js → DocxView-qpvhfcmg.js} +5 -5
  5. package/dist/client/static/js/{DrawioView-a351t8f8.js → DrawioView-178skky8.js} +2 -2
  6. package/dist/client/static/js/ImageView-460th5qa.js +1 -0
  7. package/dist/client/static/js/LayoutWrapper-5cv0dty8.js +2 -0
  8. package/dist/client/static/js/Modal-wks6p4r5.js +38 -0
  9. package/dist/client/static/js/{PdfView-n6bwcvc8.js → PdfView-y51g03nr.js} +1 -1
  10. package/dist/client/static/js/SessionsView-rsmvn7ks.js +1 -0
  11. package/dist/client/static/js/{SheetView-k8ymr87w.js → SheetView-z7yvb05v.js} +25 -25
  12. package/dist/client/static/js/{SvgPreview-5pcp444e.js → SvgPreview-yehgzhem.js} +1 -1
  13. package/dist/client/static/js/{abnfDiagram-O67JEVCF-psav75bx.js → abnfDiagram-O67JEVCF-6zxpcy8b.js} +1 -1
  14. package/dist/client/static/js/architecture-7GRP2DOG-9q06651f.js +1 -0
  15. package/dist/client/static/js/architectureDiagram-NJMV4G6O-m98sgh3c.js +36 -0
  16. package/dist/client/static/js/{astro-0rh34hha.js → astro-nn7xg0we.js} +1 -1
  17. package/dist/client/static/js/bash-fjzhxy10.js +1 -0
  18. package/dist/client/static/js/{blockDiagram-BEXU5L5S-17xsf182.js → blockDiagram-BEXU5L5S-cp7rervg.js} +5 -5
  19. package/dist/client/static/js/c-wqtyezvw.js +1 -0
  20. package/dist/client/static/js/c4Diagram-YGBWAQC7-t31recqm.js +38 -0
  21. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-663z1g1r.js → classDiagram-v2-NBCMYWYE-fy8x3dkx.js} +5 -5
  22. package/dist/client/static/js/{cose-bilkent-JH36ORCC-vp4yvx8x.js → cose-bilkent-JH36ORCC-va7ybm9e.js} +1 -1
  23. package/dist/client/static/js/cpp-y0nzwner.js +1 -0
  24. package/dist/client/static/js/css-a13jmmnc.js +1 -0
  25. package/dist/client/static/js/css-n2waj098.js +1 -0
  26. package/dist/client/static/js/cynefin-OW5HDTMX-w7a38g4g.js +1 -0
  27. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-dagkrjbh.js → cynefinDiagram-VND7K2PF-4k0k429c.js} +2 -2
  28. package/dist/client/static/js/{dagre-6A5THRUB-8qgwpb5a.js → dagre-6A5THRUB-ykdhxq6t.js} +2 -2
  29. package/dist/client/static/js/{diagram-22UHCM2B-671xtp0d.js → diagram-22UHCM2B-5nvwx7b6.js} +8 -8
  30. package/dist/client/static/js/{diagram-3UASUU5V-8nn5fha8.js → diagram-3UASUU5V-hc7zsjgw.js} +1 -1
  31. package/dist/client/static/js/diagram-ATOU4E4O-97ae07y7.js +3 -0
  32. package/dist/client/static/js/diagram-CDSNMT55-b56nnbbs.js +30 -0
  33. package/dist/client/static/js/{diagram-MLGK6HIB-tp6dwxdb.js → diagram-MLGK6HIB-37rygr9k.js} +1 -1
  34. package/dist/client/static/js/{diagram-MPIPVDR6-qgx8c8ee.js → diagram-MPIPVDR6-wv3vhhfk.js} +2 -2
  35. package/dist/client/static/js/{dockerfile-hk0s4qaw.js → dockerfile-0efb1z6e.js} +1 -1
  36. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-nmf9r33z.js → ebnfDiagram-ZINNZB2B-13fv7vxg.js} +1 -1
  37. package/dist/client/static/js/{elixir-gpez1k9m.js → elixir-mabagxwa.js} +1 -1
  38. package/dist/client/static/js/{elk-276RUBZZ-dheh5ngz.js → elk-276RUBZZ-xam60ktz.js} +1 -1
  39. package/dist/client/static/js/{erDiagram-OPXOYQCR-8837mk18.js → erDiagram-OPXOYQCR-24ctv2ee.js} +6 -6
  40. package/dist/client/static/js/{erlang-w9gmf866.js → erlang-zwy7cqdk.js} +1 -1
  41. package/dist/client/static/js/eventmodeling-NTZA5JFV-6wrjccyw.js +1 -0
  42. package/dist/client/static/js/flowDiagram-KWPJA3E3-19vjkg84.js +1 -0
  43. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-g68mvnje.js → ganttDiagram-FUAMR5RP-766a8fqw.js} +2 -2
  44. package/dist/client/static/js/gitGraph-4MIJSDKK-4je2p50v.js +1 -0
  45. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-ymk81cdj.js → gitGraphDiagram-X574FWY7-fmwjkgh6.js} +2 -2
  46. package/dist/client/static/js/graphql-gvb7e2eb.js +1 -0
  47. package/dist/client/static/js/html-bwyt0ayy.js +1 -0
  48. package/dist/client/static/js/{index-rc8wrs2a.js → index-03pyvmcz.js} +2 -2
  49. package/dist/client/static/js/index-13dr1t1r.js +314 -0
  50. package/dist/client/static/js/{index-mxpgfj6p.js → index-13xbwcbz.js} +2 -2
  51. package/dist/client/static/js/{index-4j5jwb54.js → index-1c0pnsjd.js} +2 -2
  52. package/dist/client/static/js/index-1rxa9zxp.js +1 -0
  53. package/dist/client/static/js/{index-aznkfx1z.js → index-2hpy58d0.js} +2 -2
  54. package/dist/client/static/js/{index-4j1g7m8g.js → index-2x9eqztp.js} +1 -1
  55. package/dist/client/static/js/{index-vv9ytx0t.js → index-4cncqz8j.js} +2 -2
  56. package/dist/client/static/js/index-4j8rgr4p.js +1 -0
  57. package/dist/client/static/js/{index-pp6mss9b.js → index-4mstdh41.js} +3 -3
  58. package/dist/client/static/js/index-4z4ax55k.js +12 -0
  59. package/dist/client/static/js/{index-q1bqg4f6.js → index-6ge6gk9w.js} +1 -1
  60. package/dist/client/static/js/{index-c003wb3r.js → index-7t63akyt.js} +1 -1
  61. package/dist/client/static/js/{index-ys4t1am4.js → index-8b3t2y77.js} +2 -2
  62. package/dist/client/static/js/index-8hgm0abr.js +474 -0
  63. package/dist/client/static/js/index-8jqawh3r.js +2 -0
  64. package/dist/client/static/js/index-95en3p3g.js +9 -0
  65. package/dist/client/static/js/{index-dj7y2df7.js → index-97qst4k9.js} +2 -2
  66. package/dist/client/static/js/{index-018ehs1n.js → index-9vdbnvmk.js} +1 -1
  67. package/dist/client/static/js/{index-harsfp4x.js → index-a9t9gdew.js} +9 -9
  68. package/dist/client/static/js/{index-8888hgj8.js → index-b4y5g48d.js} +5 -5
  69. package/dist/client/static/js/{index-gx2xefdg.js → index-czagykbq.js} +2 -2
  70. package/dist/client/static/js/{index-r1fe56cn.js → index-dfqmwm7j.js} +2 -2
  71. package/dist/client/static/js/{index-cccrappc.js → index-dydwcp3n.js} +2 -2
  72. package/dist/client/static/js/{index-jy91r3ap.js → index-e1yz59fa.js} +2 -2
  73. package/dist/client/static/js/{index-ce4vytm6.js → index-e6any867.js} +2 -2
  74. package/dist/client/static/js/{index-wy05jt00.js → index-ejdnjh5c.js} +2 -2
  75. package/dist/client/static/js/index-f4vr1c6e.css +1 -0
  76. package/dist/client/static/js/{index-9wjnbb3q.js → index-feffxxss.js} +2 -2
  77. package/dist/client/static/js/{index-547h1b8j.js → index-grczkttn.js} +13 -13
  78. package/dist/client/static/js/{index-s78n0dtv.js → index-hga3e13s.js} +2 -2
  79. package/dist/client/static/js/{index-d1vearmk.js → index-hw14rhen.js} +2 -2
  80. package/dist/client/static/js/index-hzwr5fm9.js +4 -0
  81. package/dist/client/static/js/{index-sj4y8kj2.js → index-j17h4z6f.js} +2 -2
  82. package/dist/client/static/js/{index-y5hxhr7q.js → index-ka2rc2cr.js} +5 -5
  83. package/dist/client/static/js/{index-b612vske.js → index-ktbrmp29.js} +2 -2
  84. package/dist/client/static/js/{index-ag78jnva.js → index-nbexks3x.js} +1 -1
  85. package/dist/client/static/js/{index-vwc8pdy3.js → index-nh29fkk9.js} +2 -2
  86. package/dist/client/static/js/{index-gn92c6hp.js → index-p0ez6hqd.js} +2 -2
  87. package/dist/client/static/js/{index-173x4bh0.js → index-pkes9492.js} +2 -2
  88. package/dist/client/static/js/{index-fg965t62.js → index-pysqpc5n.js} +2 -2
  89. package/dist/client/static/js/index-qj34r6d0.js +1 -0
  90. package/dist/client/static/js/{index-ek4gwrm8.js → index-qx6x4z0y.js} +2 -2
  91. package/dist/client/static/js/{index-agdbjh5k.js → index-r8cc80w5.js} +2 -2
  92. package/dist/client/static/js/{index-2kg3r5jw.js → index-rab39785.js} +2 -2
  93. package/dist/client/static/js/{index-haaz8t7e.js → index-sk9ej289.js} +2 -2
  94. package/dist/client/static/js/{index-8ggxxp8c.js → index-sq3r1xhf.js} +2 -2
  95. package/dist/client/static/js/{index-wsqgp9jw.js → index-sx809d6d.js} +2 -2
  96. package/dist/client/static/js/{index-p2812ygk.js → index-sz3mxjvy.js} +1 -1
  97. package/dist/client/static/js/{index-69xe17c1.js → index-tqycj126.js} +2 -2
  98. package/dist/client/static/js/{index-js81yrmy.js → index-vcn1kcpy.js} +3 -3
  99. package/dist/client/static/js/{index-rvjc19x7.js → index-x7f5ysch.js} +2 -2
  100. package/dist/client/static/js/index-xe5cqwnf.js +1 -0
  101. package/dist/client/static/js/index-xxe52zrm.js +2 -0
  102. package/dist/client/static/js/{index-ek7hqfp0.js → index-yvxa7hd8.js} +2 -2
  103. package/dist/client/static/js/{index-qw5aqk2d.js → index-z6kpc98a.js} +1 -1
  104. package/dist/client/static/js/{index-yzg9mbsv.js → index-zjydzxhm.js} +1 -1
  105. package/dist/client/static/js/{index-6wtx7a9x.js → index-zvazj4va.js} +2 -2
  106. package/dist/client/static/js/info-A6RAGUB7-k0z5qdew.js +1 -0
  107. package/dist/client/static/js/{infoDiagram-VRGFBTTK-11trzn8c.js → infoDiagram-VRGFBTTK-tqytmzp1.js} +1 -1
  108. package/dist/client/static/js/ini-2gvjwh83.js +1 -0
  109. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-8xnnymb5.js → ishikawaDiagram-OU5B5YK6-rp77ff6m.js} +1 -1
  110. package/dist/client/static/js/java-1xwcq79s.js +1 -0
  111. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-wd47j0hy.js → journeyDiagram-ZHPQQLJL-c7bxrhf1.js} +2 -2
  112. package/dist/client/static/js/json-4pqjabgq.js +1 -0
  113. package/dist/client/static/js/jsx-wcsss15s.js +1 -0
  114. package/dist/client/static/js/{julia-c2q0vwpd.js → julia-2eekpjq8.js} +1 -1
  115. package/dist/client/static/js/{kanban-definition-PNTS6WVX-s5rgcp44.js → kanban-definition-PNTS6WVX-j2pxewqq.js} +8 -8
  116. package/dist/client/static/js/lua-h7vjcn0h.js +1 -0
  117. package/dist/client/static/js/markdown-f30jjjh9.js +1 -0
  118. package/dist/client/static/js/{mermaid.core-9fxp8nt2.js → mermaid.core-cqqe1krg.js} +6 -6
  119. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-4fyewtst.js → mindmap-definition-NLK3R4M7-s03k32p9.js} +9 -9
  120. package/dist/client/static/js/one-dark-pro-9tt0a020.js +1 -0
  121. package/dist/client/static/js/one-light-5fg4r0ra.js +1 -0
  122. package/dist/client/static/js/packet-AYTQ26CC-6cnvmb2z.js +1 -0
  123. package/dist/client/static/js/{pegDiagram-GJSIUBJH-s2xe2e2k.js → pegDiagram-GJSIUBJH-dfg2j0zc.js} +1 -1
  124. package/dist/client/static/js/{perl-6pa0tn3b.js → perl-5vxax0nr.js} +1 -1
  125. package/dist/client/static/js/{php-1zy994pz.js → php-hgrgdq63.js} +1 -1
  126. package/dist/client/static/js/pie-WAS4IAKB-m9z1mztn.js +1 -0
  127. package/dist/client/static/js/{pieDiagram-5QR66LMP-1szpjbzy.js → pieDiagram-5QR66LMP-pshd1j79.js} +1 -1
  128. package/dist/client/static/js/properties-ymexza6q.js +1 -0
  129. package/dist/client/static/js/python-31ycwa66.js +1 -0
  130. package/dist/client/static/js/{quadrantDiagram-O4NWA36T-mv3ee2qa.js → quadrantDiagram-O4NWA36T-cvvvmtk2.js} +4 -4
  131. package/dist/client/static/js/r-t2nne4xp.js +1 -0
  132. package/dist/client/static/js/radar-RG4KPBEZ-8m9rkex6.js +1 -0
  133. package/dist/client/static/js/railroad-74A4TZTK-wc55emj8.js +1 -0
  134. package/dist/client/static/js/railroad-abnf-HS5TGJTU-2y2rnrzq.js +1 -0
  135. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-zzcc9x0v.js +1 -0
  136. package/dist/client/static/js/railroad-peg-WCYAUIDC-z82na5nb.js +1 -0
  137. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-hgdqjpm9.js → railroadDiagram-XR7U4H2S-h53p3sha.js} +1 -1
  138. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-yrfjp9wx.js → requirementDiagram-PLB6GJNP-bdv2fkxd.js} +4 -4
  139. package/dist/client/static/js/{ruby-arvs7kz4.js → ruby-8pxcn21w.js} +1 -1
  140. package/dist/client/static/js/{rust-3ahjk339.js → rust-j80dxgjg.js} +1 -1
  141. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-k7k871xa.js → sankeyDiagram-IPEJSGJF-xqnnvmhy.js} +2 -2
  142. package/dist/client/static/js/{sass-cmkf7nwd.js → sass-bm32bb5k.js} +1 -1
  143. package/dist/client/static/js/{scss-x7ddw6gb.js → scss-e2dndbfa.js} +1 -1
  144. package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-gd80m0as.js → sequenceDiagram-PO4LG4MO-3p67305f.js} +10 -10
  145. package/dist/client/static/js/{sizeCapture-INFHLROL-jv6p4834.js → sizeCapture-INFHLROL-f87525h7.js} +1 -1
  146. package/dist/client/static/js/sql-bwnasywx.js +1 -0
  147. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-tvphxq2h.js → stateDiagram-v2-GCMORJYK-e5st1fy3.js} +6 -6
  148. package/dist/client/static/js/{svelte-0hv6pak2.js → svelte-ztkaww47.js} +1 -1
  149. package/dist/client/static/js/{swimlanes-2SLR337P-3dt7nxj2.js → swimlanes-2SLR337P-ceghkbez.js} +1 -1
  150. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-vc8hvfya.js +8 -0
  151. package/dist/client/static/js/{timeline-definition-EJHVYXUP-40vvf856.js → timeline-definition-EJHVYXUP-f7evs443.js} +3 -3
  152. package/dist/client/static/js/treeView-Q6P3EWNA-kzh6cm3f.js +1 -0
  153. package/dist/client/static/js/treemap-WGGIJYW6-wz5ed560.js +1 -0
  154. package/dist/client/static/js/tsx-zfy727zs.js +1 -0
  155. package/dist/client/static/js/typescript-p3syh43m.js +1 -0
  156. package/dist/client/static/js/{usecaseDiagram-POWQR4AR-g1j5x0xh.js → usecaseDiagram-POWQR4AR-0gpn21p7.js} +27 -27
  157. package/dist/client/static/js/{vennDiagram-UO4OBE2U-5b8789qk.js → vennDiagram-UO4OBE2U-4spzy428.js} +3 -3
  158. package/dist/client/static/js/{vue-zccj3qa5.js → vue-xm1dxpmy.js} +1 -1
  159. package/dist/client/static/js/wardley-WFR3VGLG-zewbfccz.js +1 -0
  160. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-c7x3za3w.js → wardleyDiagram-VNRHLVJA-745xr2pa.js} +4 -4
  161. package/dist/client/static/js/xml-4enq788a.js +1 -0
  162. package/dist/client/static/js/xychartDiagram-PMCCYNJV-7dr9qwx5.js +7 -0
  163. package/dist/client/static/js/yaml-pjtt3jsc.js +1 -0
  164. package/package.json +1 -1
  165. package/src/client/components/common/batch-selection/folder-state.ts +2 -2
  166. package/src/client/components/common/server-control/Panel.tsx +16 -5
  167. package/src/client/components/common/server-control/index.test.tsx +63 -9
  168. package/src/client/components/common/session-row/TrailingSlot.tsx +8 -0
  169. package/src/client/components/common/session-row/index.tsx +16 -9
  170. package/src/client/components/layout/desktop-layout/LeftColumn.tsx +7 -0
  171. package/src/client/components/layout/session-sidebar/CategoryItem.tsx +1 -1
  172. package/src/client/components/layout/session-sidebar/ClassicView.tsx +13 -0
  173. package/src/client/components/layout/session-sidebar/HarnessFilter.tsx +175 -0
  174. package/src/client/components/layout/session-sidebar/SessionList.tsx +9 -1
  175. package/src/client/components/layout/session-sidebar/SessionsView.tsx +8 -1
  176. package/src/client/components/layout/session-sidebar/about-modal/index.test.tsx +1 -1
  177. package/src/client/components/layout/session-sidebar/harness-filter.test.tsx +173 -0
  178. package/src/client/components/layout/session-sidebar/modern/FilterChips.tsx +63 -18
  179. package/src/client/components/layout/session-sidebar/modern/SearchField.tsx +1 -1
  180. package/src/client/components/layout/session-sidebar/modern/WorkspaceHeader.tsx +21 -12
  181. package/src/client/components/layout/session-sidebar/modern/WorkspaceSection.tsx +1 -1
  182. package/src/client/components/layout/session-sidebar/modern/index.tsx +11 -2
  183. package/src/client/components/layout/session-sidebar/modern/search-field.test.tsx +96 -0
  184. package/src/client/components/layout/session-sidebar/session-list-states.test.tsx +3 -0
  185. package/src/client/components/layout/session-sidebar/variant-props.ts +7 -0
  186. package/src/client/components/mobile/SessionSidebar.tsx +14 -21
  187. package/src/client/components/mobile/mobile-session-sidebar/ClassicDrawer.tsx +19 -0
  188. package/src/client/components/mobile/mobile-session-sidebar/Item.tsx +1 -1
  189. package/src/client/components/settings/categories/omp-settings/EngineHeader.tsx +1 -1
  190. package/src/client/components/workspace/chat-timeline/MessageList.test.ts +19 -19
  191. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.image.test.ts +147 -0
  192. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.test.ts +51 -83
  193. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.tsx +44 -63
  194. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/ReadDirectory.tsx +72 -0
  195. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/ReadImage.tsx +51 -0
  196. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/read-test-util.ts +91 -0
  197. package/src/client/components/workspace/git-panel/commit-modal/CommitRow.test.ts +80 -62
  198. package/src/client/components/workspace/git-panel/commit-modal/CommitRow.tsx +15 -33
  199. package/src/client/components/workspace/git-panel/commit-modal/Header.tsx +1 -1
  200. package/src/client/components/workspace/terminal-panel/copy.test.ts +179 -0
  201. package/src/client/components/workspace/terminal-panel/copy.ts +76 -0
  202. package/src/client/components/workspace/terminal-panel/mount.ts +13 -0
  203. package/src/client/data/settings/omp-schema.json +39 -18
  204. package/src/client/hooks/chat/omp/pending-child.test.ts +1 -1
  205. package/src/client/hooks/chat/omp/session-sidebar-controller.test.ts +61 -0
  206. package/src/client/hooks/chat/omp/session-sidebar-controller.ts +37 -39
  207. package/src/client/hooks/chat/omp/sidebar-filter.ts +62 -0
  208. package/src/client/hooks/chat/timeline/session-changes.test.ts +85 -0
  209. package/src/client/hooks/chat/timeline/session-changes.ts +8 -5
  210. package/src/client/hooks/commands/use-command-runtime.ts +15 -0
  211. package/src/client/hooks/shell/servers.ts +60 -2
  212. package/src/client/hooks/ui/updates/check-request.ts +41 -0
  213. package/src/client/hooks/ui/updates/index.ts +13 -5
  214. package/src/client/hooks/ui/updates/mobile-flow.ts +56 -0
  215. package/src/client/lib/native/run-command.test.ts +95 -0
  216. package/src/client/lib/native/run-command.ts +52 -0
  217. package/src/client/lib/router/open-session.test.ts +26 -1
  218. package/src/client/lib/router/open-session.ts +21 -0
  219. package/src/client/main.tsx +9 -0
  220. package/src/client/tailwind.css +58 -0
  221. package/src/server/lib/changes/capture-shell.test.ts +253 -0
  222. package/src/server/lib/changes/capture-targets.test.ts +83 -0
  223. package/src/server/lib/changes/capture-targets.ts +51 -0
  224. package/src/server/lib/changes/capture-write.server.ts +2 -2
  225. package/src/server/lib/changes/capture.server.ts +14 -29
  226. package/src/server/lib/changes/capture.test.ts +69 -149
  227. package/src/server/lib/changes/patch-paths.ts +37 -0
  228. package/src/server/lib/harness/acp/commands.test.ts +1 -0
  229. package/src/server/lib/harness/acp/commands.ts +12 -4
  230. package/src/server/lib/harness/acp/replay-transcript.ts +32 -13
  231. package/src/server/lib/harness/acp/session-transcript.server.test.ts +162 -0
  232. package/src/server/lib/harness/acp/session-transcript.server.ts +350 -0
  233. package/src/server/lib/harness/acp/session.ts +6 -1
  234. package/src/server/lib/harness/schema.server.ts +18 -0
  235. package/src/server/lib/harness/spawn.server.ts +14 -1
  236. package/src/server/lib/models/provider-icon-fetch.ts +2 -2
  237. package/src/server/lib/models/provider-icon-parse.test.ts +0 -12
  238. package/src/server/lib/models/provider-icon-parse.ts +0 -8
  239. package/src/server/lib/omp/rpc/frame-fold.test.ts +16 -1
  240. package/src/server/lib/omp/rpc/frame-fold.ts +17 -4
  241. package/src/server/lib/omp/session/blobs.server.test.ts +34 -0
  242. package/src/server/lib/omp/session/blobs.server.ts +8 -3
  243. package/src/server/lib/omp/session/delete.server.ts +4 -0
  244. package/src/server/lib/omp/session/sidebar-activity.server.test.ts +2 -1
  245. package/src/server/routes/agent/harness-command.test.ts +71 -0
  246. package/src/server/routes/agent/harness-command.ts +27 -13
  247. package/src/server/routes/chat/imported.ts +5 -2
  248. package/src/server/routes/chat/live-meta.ts +42 -0
  249. package/src/server/routes/chat/session.test.ts +110 -0
  250. package/src/server/routes/chat/session.ts +31 -34
  251. package/src/shared/lib/chat/transcript-rows.ts +22 -0
  252. package/src/shared/lib/commands/catalog.test.ts +36 -0
  253. package/src/shared/lib/commands/catalog.ts +16 -0
  254. package/src/shared/lib/fs/file-kind.test.ts +46 -3
  255. package/src/shared/lib/fs/file-kind.ts +40 -9
  256. package/src/shared/lib/omp/config/schema-releases.test.ts +29 -0
  257. package/src/shared/lib/updates/popup-state.ts +11 -0
  258. package/src/shared/lib/workspace/harness-filter.test.ts +89 -0
  259. package/src/shared/lib/workspace/harness-filter.ts +75 -0
  260. package/src/{client/lib → shared/lib/workspace}/session-tree.test.ts +1 -1
  261. package/src/shared/lib/workspace/session-visibility.test.ts +71 -0
  262. package/src/shared/lib/workspace/session-visibility.ts +48 -23
  263. package/src/shared/lib/workspace/sidebar-filter-row.test.ts +64 -23
  264. package/src/shared/lib/workspace/sidebar-filter-row.ts +89 -31
  265. package/dist/client/static/js/ImageView-c139r891.js +0 -1
  266. package/dist/client/static/js/LayoutWrapper-08axzr3a.js +0 -2
  267. package/dist/client/static/js/Modal-0weqfqvk.js +0 -38
  268. package/dist/client/static/js/SessionsView-awef8ehj.js +0 -1
  269. package/dist/client/static/js/architecture-7GRP2DOG-6rbq97t9.js +0 -1
  270. package/dist/client/static/js/architectureDiagram-NJMV4G6O-9bk6ykn7.js +0 -36
  271. package/dist/client/static/js/bash-vv2ysp0a.js +0 -1
  272. package/dist/client/static/js/c-67jyc7sg.js +0 -1
  273. package/dist/client/static/js/c4Diagram-YGBWAQC7-jn9j4n04.js +0 -38
  274. package/dist/client/static/js/cpp-crfbnwv8.js +0 -1
  275. package/dist/client/static/js/css-983fbv00.js +0 -1
  276. package/dist/client/static/js/css-zj4qzw6r.js +0 -1
  277. package/dist/client/static/js/cynefin-OW5HDTMX-zafxcz2k.js +0 -1
  278. package/dist/client/static/js/diagram-ATOU4E4O-dnar0ktg.js +0 -3
  279. package/dist/client/static/js/diagram-CDSNMT55-bt0fhk7n.js +0 -30
  280. package/dist/client/static/js/eventmodeling-NTZA5JFV-cq3dvz7e.js +0 -1
  281. package/dist/client/static/js/flowDiagram-KWPJA3E3-spzh2jxq.js +0 -1
  282. package/dist/client/static/js/gitGraph-4MIJSDKK-epgk26pj.js +0 -1
  283. package/dist/client/static/js/graphql-dewsj5g1.js +0 -1
  284. package/dist/client/static/js/html-1cpe2xc8.js +0 -1
  285. package/dist/client/static/js/index-bdz08fe2.js +0 -12
  286. package/dist/client/static/js/index-bgpcf3mr.js +0 -1
  287. package/dist/client/static/js/index-bj3wn9je.js +0 -1
  288. package/dist/client/static/js/index-dhrp656p.js +0 -1
  289. package/dist/client/static/js/index-g10nr8m6.js +0 -9
  290. package/dist/client/static/js/index-j4ks5s41.js +0 -474
  291. package/dist/client/static/js/index-jqs23cc7.css +0 -1
  292. package/dist/client/static/js/index-qnt118mp.js +0 -2
  293. package/dist/client/static/js/index-qntpsp98.js +0 -2
  294. package/dist/client/static/js/index-w130cs7d.js +0 -1
  295. package/dist/client/static/js/index-wv36ddd5.js +0 -314
  296. package/dist/client/static/js/index-y82bk3hr.js +0 -4
  297. package/dist/client/static/js/info-A6RAGUB7-0an46pag.js +0 -1
  298. package/dist/client/static/js/ini-09e0scxh.js +0 -1
  299. package/dist/client/static/js/java-vnaesxzs.js +0 -1
  300. package/dist/client/static/js/json-g5ggnd94.js +0 -1
  301. package/dist/client/static/js/jsx-xz71aed4.js +0 -1
  302. package/dist/client/static/js/lua-e4wenyzt.js +0 -1
  303. package/dist/client/static/js/markdown-yv3p1p7m.js +0 -1
  304. package/dist/client/static/js/one-dark-pro-ahch85zb.js +0 -1
  305. package/dist/client/static/js/one-light-9706jgqt.js +0 -1
  306. package/dist/client/static/js/packet-AYTQ26CC-5e397pav.js +0 -1
  307. package/dist/client/static/js/pie-WAS4IAKB-0zzmzg64.js +0 -1
  308. package/dist/client/static/js/properties-0ag74bdj.js +0 -1
  309. package/dist/client/static/js/python-zsn5tdbj.js +0 -1
  310. package/dist/client/static/js/r-mwtqhnw3.js +0 -1
  311. package/dist/client/static/js/radar-RG4KPBEZ-mtar9742.js +0 -1
  312. package/dist/client/static/js/railroad-74A4TZTK-d6a6j9fq.js +0 -1
  313. package/dist/client/static/js/railroad-abnf-HS5TGJTU-1257kd8x.js +0 -1
  314. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-v8b6qmas.js +0 -1
  315. package/dist/client/static/js/railroad-peg-WCYAUIDC-jxpbx410.js +0 -1
  316. package/dist/client/static/js/sql-aczp05f2.js +0 -1
  317. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-aqnh1hhp.js +0 -8
  318. package/dist/client/static/js/treeView-Q6P3EWNA-q3qr7ew7.js +0 -1
  319. package/dist/client/static/js/treemap-WGGIJYW6-zgbdydeq.js +0 -1
  320. package/dist/client/static/js/tsx-s1shkfg9.js +0 -1
  321. package/dist/client/static/js/typescript-htx9v6bf.js +0 -1
  322. package/dist/client/static/js/wardley-WFR3VGLG-b230aajh.js +0 -1
  323. package/dist/client/static/js/xml-23y6pgvx.js +0 -1
  324. package/dist/client/static/js/xychartDiagram-PMCCYNJV-h0fy45tg.js +0 -7
  325. package/dist/client/static/js/yaml-vrayja34.js +0 -1
  326. /package/src/{client/lib → shared/lib/workspace}/session-tree.ts +0 -0
@@ -0,0 +1,95 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * `window.__kabmoRunCommand` — the native menu's only route into the catalog.
8
+ *
9
+ * A menu row carries no key equivalent, so this property is what makes the row
10
+ * do anything at all. The cases are the ways it can lie: installed but not
11
+ * callable, callable but running the wrong id, and answering `true` for a command
12
+ * nothing registered (which would make a dead menu row look alive).
13
+ *
14
+ * Runs against a real DOM (happy-dom) because the transport IS a `window`
15
+ * property; the registry is global on `globalThis`, as it is in the app.
16
+ */
17
+
18
+ import { afterAll, beforeAll, beforeEach, describe, expect, test } from 'bun:test';
19
+ import { Window } from 'happy-dom';
20
+
21
+ import { RUN_COMMAND_PROPERTY, dispatchRunCommand, installCommandRunner } from '@/client/lib/native/run-command';
22
+ import { registerCommand } from '@/client/lib/commands/registry';
23
+
24
+ const displaced: Record<string, unknown> = {};
25
+ let dom: Window;
26
+
27
+ beforeAll(() => {
28
+ for (const key of ['window', 'document'] as const) displaced[key] = (globalThis as Record<string, unknown>)[key];
29
+ dom = new Window({ url: 'http://127.0.0.1:3000/' });
30
+ (globalThis as Record<string, unknown>).window = dom;
31
+ (globalThis as Record<string, unknown>).document = dom.document;
32
+ });
33
+
34
+ afterAll(() => {
35
+ for (const [key, value] of Object.entries(displaced)) {
36
+ if (value === undefined) delete (globalThis as Record<string, unknown>)[key];
37
+ else (globalThis as Record<string, unknown>)[key] = value;
38
+ }
39
+ });
40
+
41
+ function transport(): ((id: unknown, args?: unknown) => boolean) | undefined {
42
+ const callable = (window as unknown as Record<string, unknown>)[RUN_COMMAND_PROPERTY];
43
+ return typeof callable === 'function' ? (callable as (id: unknown, args?: unknown) => boolean) : undefined;
44
+ }
45
+
46
+ let dispose: (() => void) | null = null;
47
+
48
+ beforeEach(() => {
49
+ dispose?.();
50
+ dispose = null;
51
+ });
52
+
53
+ describe('__kabmoRunCommand', () => {
54
+ test('the installer publishes a callable property', () => {
55
+ installCommandRunner();
56
+ expect(transport()).toBeFunction();
57
+ });
58
+
59
+ test('a registered command runs with the shell\'s arguments', () => {
60
+ installCommandRunner();
61
+ const calls: unknown[] = [];
62
+ dispose = registerCommand('test.native-command', (args) => { calls.push(args); });
63
+
64
+ expect(transport()?.('test.native-command', { pick: 'worktree' })).toBe(true);
65
+ expect(calls).toEqual([{ pick: 'worktree' }]);
66
+ });
67
+
68
+ test('an unregistered id answers false instead of throwing', () => {
69
+ installCommandRunner();
70
+ expect(transport()?.('workspace.not-a-command')).toBe(false);
71
+ });
72
+
73
+ test('a missing or blank id is refused', () => {
74
+ installCommandRunner();
75
+ expect(transport()?.(undefined)).toBe(false);
76
+ expect(transport()?.(42)).toBe(false);
77
+ expect(transport()?.(' ')).toBe(false);
78
+ });
79
+
80
+ test('the exported dispatcher is the same contract', () => {
81
+ let runs = 0;
82
+ dispose = registerCommand('test.direct', () => { runs += 1; });
83
+ expect(dispatchRunCommand('test.direct')).toBe(true);
84
+ expect(runs).toBe(1);
85
+ });
86
+
87
+ test('a re-install replaces the property rather than stacking', () => {
88
+ installCommandRunner();
89
+ const first = transport();
90
+ installCommandRunner();
91
+ expect(transport()).toBeFunction();
92
+ // Both installs point at the same function, so a second one cannot double-run.
93
+ expect(transport()).toBe(first);
94
+ });
95
+ });
@@ -0,0 +1,52 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The console's command catalog, published for the NATIVE shell that hosts it.
8
+ *
9
+ * A shell's menu bar can only report a click; every command it would offer lives
10
+ * in the page (`shared/lib/commands/catalog.ts`), because that is the one place
11
+ * a chord, a title and a `when` condition are stated. Duplicating those rows
12
+ * natively would be a second source of truth that drifts — and a native row that
13
+ * also DECLARED a key equivalent would steal the chord from the page's own
14
+ * dispatcher before it ever saw the keystroke.
15
+ *
16
+ * So the menu row carries no chord and asks here instead:
17
+ *
18
+ * window.__kabmoRunCommand('workspace.toggleSidebar')
19
+ *
20
+ * The same indirection as `__kabmoBack`, `__kabmoResume` and `__kabmoOpenPaths`
21
+ * — the page owns the state and the catalog, the shell only knows the moment.
22
+ * Installed unconditionally: inert in a browser (nothing calls it), and gating on
23
+ * a user agent would be a second place that has to know which shells exist.
24
+ *
25
+ * A command that is not registered answers `false` rather than throwing: a menu
26
+ * row is not a place to surface `command "…" is already registered`, and the
27
+ * shell's caller can decide to stay quiet.
28
+ */
29
+
30
+ import { runCommand } from '@/client/lib/commands/registry';
31
+
32
+ /** The property a shell calls. Named once so both sides agree. */
33
+ export const RUN_COMMAND_PROPERTY = '__kabmoRunCommand';
34
+
35
+ /**
36
+ * Run one catalog command by id, with optional arguments.
37
+ *
38
+ * Exported for tests and for any in-page caller that wants the same contract
39
+ * without the global — the property is only the transport.
40
+ */
41
+ export function dispatchRunCommand(id: unknown, args?: unknown): boolean {
42
+ if (typeof id !== 'string') return false;
43
+ const command = id.trim();
44
+ if (!command) return false;
45
+ return runCommand(command, args);
46
+ }
47
+
48
+ /** Install `window.__kabmoRunCommand`. Idempotent — a hot reload re-runs it. */
49
+ export function installCommandRunner(): void {
50
+ if (typeof window === 'undefined') return;
51
+ (window as unknown as Record<string, unknown>)[RUN_COMMAND_PROPERTY] = dispatchRunCommand;
52
+ }
@@ -15,7 +15,7 @@
15
15
  import { afterAll, afterEach, beforeAll, describe, expect, test } from 'bun:test';
16
16
  import { Window } from 'happy-dom';
17
17
 
18
- import { openSessionInUrl } from '@/client/lib/router/open-session';
18
+ import { openEmptyWorkspace, openSessionInUrl } from '@/client/lib/router/open-session';
19
19
  import { installOpenSessionDispatcher } from '@/client/lib/native/open-session';
20
20
  import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
21
21
 
@@ -65,6 +65,31 @@ describe('openSessionInUrl', () => {
65
65
  });
66
66
  });
67
67
 
68
+ describe('openEmptyWorkspace', () => {
69
+ test('clears every routing parameter', () => {
70
+ go('?folderId=3&sessionId=old&subagent=9');
71
+ expect(openEmptyWorkspace()).toBe(true);
72
+ expect(window.location.search).toBe('');
73
+ });
74
+
75
+ test('tells the router the URL moved', () => {
76
+ go('?sessionId=old');
77
+ let events = 0;
78
+ const listener = () => { events += 1; };
79
+ window.addEventListener('popstate', listener);
80
+ openEmptyWorkspace();
81
+ window.removeEventListener('popstate', listener);
82
+ expect(events).toBe(1);
83
+ });
84
+
85
+ test('keeps the path and the hash', () => {
86
+ window.history.replaceState(null, '', '/workspace?sessionId=old#timeline');
87
+ openEmptyWorkspace();
88
+ expect(window.location.pathname).toBe('/workspace');
89
+ expect(window.location.hash).toBe('#timeline');
90
+ });
91
+ });
92
+
68
93
  describe('window.__kabmoOpenSession', () => {
69
94
  test('the installed dispatcher is the same navigation', () => {
70
95
  installOpenSessionDispatcher();
@@ -32,3 +32,24 @@ export function openSessionInUrl(sessionId: string): boolean {
32
32
  window.dispatchEvent(new Event('popstate'));
33
33
  return true;
34
34
  }
35
+
36
+ /**
37
+ * Clear the routing state, which is the sidebar's own "New Session".
38
+ *
39
+ * The sidebar's primary action opens the EMPTY WORKSPACE — the landing, with no
40
+ * query at all — rather than minting a pending chat (see `SessionsView`). A
41
+ * native menu row and the command palette need the same move without a component
42
+ * to call `setSearchParams` from, so it lives here beside the session opener and
43
+ * writes through the same store.
44
+ */
45
+ export function openEmptyWorkspace(options: { replace?: boolean } = {}): boolean {
46
+ if (typeof window === 'undefined') return false;
47
+ const url = new URL(window.location.href);
48
+ url.search = '';
49
+ // The sidebar's own button replaces the history entry (a New Session press is
50
+ // not a place to go Back to); the option keeps the two callers identical.
51
+ if (options.replace) window.history.replaceState(null, '', url);
52
+ else window.history.pushState(null, '', url);
53
+ window.dispatchEvent(new Event('popstate'));
54
+ return true;
55
+ }
@@ -21,6 +21,7 @@ import { readNotificationGrant } from '@/client/lib/notifications/os';
21
21
  import { installOpenSessionDispatcher } from '@/client/lib/native/open-session';
22
22
  import { installFileLaunchHandler } from '@/client/lib/launch/file-handlers';
23
23
  import { installOpenPaths } from '@/client/lib/native/open-paths';
24
+ import { installCommandRunner } from '@/client/lib/native/run-command';
24
25
  import { installDeviceFiles } from '@/client/lib/launch/device-files';
25
26
 
26
27
  import '@/client/tailwind.css';
@@ -144,6 +145,14 @@ installOpenSessionDispatcher();
144
145
  // drained by the same tick that registers the opener.
145
146
  installOpenPaths();
146
147
 
148
+ // A native menu row can only report a click; the command it names lives in the
149
+ // page's catalog. The shell calls `window.__kabmoRunCommand(id)` and this is the
150
+ // transport — installed before the first render for the same reason as the other
151
+ // native hooks: a row pressed during hydration must find the runner, not
152
+ // `undefined`. The row carries NO key equivalent, so the page's own dispatcher
153
+ // keeps every chord (and the user's overrides) intact.
154
+ installCommandRunner();
155
+
147
156
  // A document the PHONE handed over — picked in the Files app, or "Open with →
148
157
  // Kabmo" from Gmail — arrives as BYTES, not a path: the console may be on
149
158
  // another machine, so it could never read the file itself. The shell announces
@@ -304,6 +304,35 @@
304
304
  }
305
305
  }
306
306
 
307
+ /* A search field that draws its own clear control must not also get the
308
+ * engine's.
309
+ *
310
+ * `type="search"` is the right input — Escape clears it and the platform
311
+ * exposes it as a searchbox — but WebKit and Blink paint
312
+ * `::-webkit-search-cancel-button` inside it. Measured in the session sidebar,
313
+ * that put the native X beside the app's own `Clear search` button: two clear
314
+ * controls, one of them unlabelled and unstyleable.
315
+ *
316
+ * The class is opt-in, not a global reset: a field with no clear control of its
317
+ * own (the plan filter) still needs the native one. `::-webkit-search-decoration`
318
+ * goes with it, because Safari draws the magnifier there on some versions and
319
+ * that would be a second glyph next to the field's own.
320
+ *
321
+ * `display: none` is the declaration that does the work, not
322
+ * `-webkit-appearance: none`: measured in WebKit with only the appearance reset,
323
+ * the button was still painted — the class changed nothing on screen until
324
+ * `display: none` was added. Both spellings stay so Blink, which honours the
325
+ * appearance reset alone, needs no second rule.
326
+ */
327
+ @layer components {
328
+ .kabmo-search-field::-webkit-search-cancel-button,
329
+ .kabmo-search-field::-webkit-search-decoration {
330
+ display: none;
331
+ -webkit-appearance: none;
332
+ appearance: none;
333
+ }
334
+ }
335
+
307
336
  /* FULL COLOUR MODE: on is GREEN, off is RED.
308
337
  *
309
338
  * The colour mode is the one place a user asks for chroma, so the checkbox
@@ -458,6 +487,35 @@
458
487
  overflow-y: auto;
459
488
  }
460
489
 
490
+ /* The session list's right inset, so its content edge is the action row's.
491
+ *
492
+ * The list is a scroller, and the app's scrollbar is 8px of LAYOUT
493
+ * (`--scrollbar-size`), not an overlay: `overflow-y: overlay` is gone from
494
+ * Chrome. The action row above it is not a scroller, so its content edge is
495
+ * `px-3` (12px) from the panel while the rows' was 8px of padding PLUS the
496
+ * 8px bar — 16px. Measured on the running app, the sort icon's centre sat 8px
497
+ * right of every row's `⋯` and of the age's right edge, which is the reported
498
+ * "titik tiga tidak lurus dengan sort".
499
+ *
500
+ * `overflow-y: scroll`, not `auto`: the bar must be reserved even when the
501
+ * list is short, or the rows jump 8px sideways the first time they need to
502
+ * scroll — and the sort icon would be off by 8px in exactly the state nobody
503
+ * screenshots. WebKit 27 (the desktop shell) advertises `scrollbar-gutter`
504
+ * but does NOT reserve it for a non-overflowing `auto` scroller (measured:
505
+ * `clientWidth == offsetWidth` with `stable` set; `scroll` gives the 8px), so
506
+ * the always-present bar is the only portable reservation. Its track and thumb
507
+ * are transparent at rest, so it paints nothing. This rule is declared after
508
+ * `.scrollbar-overlay-container`, whose `auto` it deliberately overrides.
509
+ *
510
+ * The padding is then the action row's 12px minus that reserved 8px. The
511
+ * row's own trailing inset (3px, half the box difference) finishes the
512
+ * alignment: sort glyph centre = row `⋯` centre = age's right edge.
513
+ */
514
+ .session-list-gutter {
515
+ overflow-y: scroll;
516
+ padding-right: calc(0.75rem - var(--scrollbar-size));
517
+ }
518
+
461
519
  /* The composer reads at the transcript's own size — 13px — EXCEPT on iOS.
462
520
  *
463
521
  * Every message row in the timeline is `text-[13px] leading-relaxed`, and a
@@ -0,0 +1,253 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The capture layer, at the shell: a `bash` call's frames become records.
8
+ *
9
+ * `capture.test.ts` covers the tool adapters (an `edit`, a `write`, an
10
+ * `apply_patch`); this file covers the three lower-authority layers — the trace
11
+ * that names a command's argv, the scan that reconciles an opaque one, and the
12
+ * subagent whose write is attributed to the child.
13
+ *
14
+ * The fake filesystem is a `Map`, so the before/after pair is deterministic:
15
+ * `flush()` after the start frame proves the snapshot ran before the test
16
+ * changes the file. Every path goes through `at()`, so the fixture is native
17
+ * on Windows too.
18
+ */
19
+
20
+ import { afterAll, beforeAll, describe, expect, test } from 'bun:test';
21
+ import * as fsp from 'node:fs/promises';
22
+ import * as os from 'node:os';
23
+ import * as path from 'node:path';
24
+ import { makeCapture, records, REPO } from '@/server/lib/changes/capture-test-util';
25
+ import { ChangeJournal } from '@/server/lib/changes/journal.server';
26
+ import { readSessionChangeDiff } from '@/server/lib/changes/reader.server';
27
+
28
+ let dataDir = '';
29
+ let agentDir = '';
30
+ let original: string | undefined;
31
+ let originalAgent: string | undefined;
32
+
33
+ beforeAll(async () => {
34
+ original = Bun.env.KABMO_DATA_DIR;
35
+ originalAgent = Bun.env.PI_CODING_AGENT_DIR;
36
+ dataDir = await fsp.mkdtemp(path.join(os.tmpdir(), 'kabmo-changes-shell-'));
37
+ agentDir = await fsp.mkdtemp(path.join(os.tmpdir(), 'kabmo-changes-shell-agent-'));
38
+ Bun.env.KABMO_DATA_DIR = dataDir;
39
+ Bun.env.PI_CODING_AGENT_DIR = agentDir;
40
+ });
41
+
42
+ afterAll(async () => {
43
+ if (original === undefined) delete Bun.env.KABMO_DATA_DIR;
44
+ else Bun.env.KABMO_DATA_DIR = original;
45
+ if (originalAgent === undefined) delete Bun.env.PI_CODING_AGENT_DIR;
46
+ else Bun.env.PI_CODING_AGENT_DIR = originalAgent;
47
+ await fsp.rm(dataDir, { recursive: true, force: true });
48
+ await fsp.rm(agentDir, { recursive: true, force: true });
49
+ });
50
+
51
+ const WINDOW_END = Date.now() + 60_000;
52
+
53
+ /** A path inside the fixture repo, spelled the way the host spells it. */
54
+ function at(relative: string): string {
55
+ return path.join(REPO, relative);
56
+ }
57
+
58
+ describe('bash capture', () => {
59
+ test('rm is a delete, from the trace argv', async () => {
60
+ const files = new Map([[at('c.ts'), 'C']]);
61
+ const capture = makeCapture('cap-rm', files);
62
+ capture.onFrame({
63
+ type: 'tool_execution_start',
64
+ toolCallId: 'c1',
65
+ toolName: 'bash',
66
+ args: { command: 'rm -f c.ts' },
67
+ });
68
+ await capture.flush();
69
+ files.delete(at('c.ts'));
70
+ capture.onFrame({
71
+ type: 'tool_execution_end',
72
+ toolCallId: 'c1',
73
+ toolName: 'bash',
74
+ result: { details: { trace: { status: 0, units: [{ nodes: [{ k: 'simple', argv: ['rm', '-f', 'c.ts'], st: 0 }] }] } } },
75
+ });
76
+ await capture.flush();
77
+
78
+ const diff = await readSessionChangeDiff('cap-rm', at('c.ts'), 0, WINDOW_END);
79
+ expect(diff?.status).toBe('deleted');
80
+ expect(diff?.oldContent).toBe('C');
81
+ });
82
+
83
+ test('sed -i is an update', async () => {
84
+ const files = new Map([[at('d.ts'), 'a']]);
85
+ const capture = makeCapture('cap-sed', files);
86
+ capture.onFrame({
87
+ type: 'tool_execution_start',
88
+ toolCallId: 'c1',
89
+ toolName: 'bash',
90
+ args: { command: "sed -i 's/a/b/' d.ts" },
91
+ });
92
+ await capture.flush();
93
+ files.set(at('d.ts'), 'b');
94
+ capture.onFrame({
95
+ type: 'tool_execution_end',
96
+ toolCallId: 'c1',
97
+ toolName: 'bash',
98
+ result: { details: { trace: { status: 0, units: [{ nodes: [{ k: 'simple', argv: ['sed', '-i', 's/a/b/', 'd.ts'], st: 0 }] }] } } },
99
+ });
100
+ await capture.flush();
101
+
102
+ const diff = await readSessionChangeDiff('cap-sed', at('d.ts'), 0, WINDOW_END);
103
+ expect(diff?.status).toBe('modified');
104
+ expect(diff?.oldContent).toBe('a');
105
+ expect(diff?.newContent).toBe('b');
106
+ });
107
+
108
+ test('a redirect is a create the trace does not name', async () => {
109
+ const files = new Map<string, string>();
110
+ const capture = makeCapture('cap-redirect', files);
111
+ capture.onFrame({
112
+ type: 'tool_execution_start',
113
+ toolCallId: 'c1',
114
+ toolName: 'bash',
115
+ args: { command: 'echo hi > e.txt' },
116
+ });
117
+ await capture.flush();
118
+ files.set(at('e.txt'), 'hi\n');
119
+ capture.onFrame({
120
+ type: 'tool_execution_end',
121
+ toolCallId: 'c1',
122
+ toolName: 'bash',
123
+ result: { details: { trace: { status: 0, units: [{ nodes: [{ k: 'simple', argv: ['echo', 'hi'], st: 0 }] }] } } },
124
+ });
125
+ await capture.flush();
126
+
127
+ const diff = await readSessionChangeDiff('cap-redirect', at('e.txt'), 0, WINDOW_END);
128
+ expect(diff?.status).toBe('added');
129
+ expect(diff?.newContent).toBe('hi\n');
130
+ });
131
+
132
+ test('an opaque command is a note, not a guess', async () => {
133
+ const files = new Map<string, string>();
134
+ const capture = makeCapture('cap-opaque', files);
135
+ capture.onFrame({
136
+ type: 'tool_execution_start',
137
+ toolCallId: 'c1',
138
+ toolName: 'bash',
139
+ args: { command: 'bun test' },
140
+ });
141
+ await capture.flush();
142
+ capture.onFrame({
143
+ type: 'tool_execution_end',
144
+ toolCallId: 'c1',
145
+ toolName: 'bash',
146
+ result: { details: { trace: { status: 0, units: [{ nodes: [{ k: 'simple', argv: ['bun', 'test'], st: 0 }] }] } } },
147
+ });
148
+ await capture.flush();
149
+
150
+ const lines = await records('cap-opaque');
151
+ expect(lines.some((line) => line.type === 'change')).toBe(false);
152
+ const note = lines.find((line) => line.type === 'note');
153
+ expect(note?.type).toBe('note');
154
+ if (note?.type !== 'note') throw new Error('expected a note');
155
+ expect(note.reason).toBe('opaque-command');
156
+ });
157
+ });
158
+
159
+ describe('scan pass', () => {
160
+ test('an opaque git reset is reconciled from the two snapshots', async () => {
161
+ const files = new Map([[at('g.ts'), 'old']]);
162
+ const scans = [
163
+ { root: REPO, dirty: new Map([[at('g.ts'), 'old']]), truncated: false },
164
+ { root: REPO, dirty: new Map([[at('g.ts'), 'new']]), truncated: false },
165
+ ];
166
+ const capture = makeCapture('cap-scan', files, {
167
+ takeScan: async () => scans.shift() ?? null,
168
+ readHead: async () => null,
169
+ });
170
+ capture.onFrame({
171
+ type: 'tool_execution_start',
172
+ toolCallId: 'c1',
173
+ toolName: 'bash',
174
+ args: { command: 'git reset --hard' },
175
+ });
176
+ await capture.flush();
177
+ files.set(at('g.ts'), 'new');
178
+ capture.onFrame({
179
+ type: 'tool_execution_end',
180
+ toolCallId: 'c1',
181
+ toolName: 'bash',
182
+ result: { details: { trace: { status: 0, units: [{ nodes: [{ k: 'simple', argv: ['git', 'reset', '--hard'], st: 0 }] }] } } },
183
+ });
184
+ await capture.flush();
185
+
186
+ const diff = await readSessionChangeDiff('cap-scan', at('g.ts'), 0, WINDOW_END);
187
+ expect(diff?.status).toBe('modified');
188
+ expect(diff?.oldContent).toBe('old');
189
+ expect(diff?.newContent).toBe('new');
190
+ });
191
+ });
192
+
193
+ describe('cross-session scan', () => {
194
+ test('a scan skips a path another session in the same cwd recorded', async () => {
195
+ const other = new ChangeJournal('cap-other', REPO);
196
+ await other.recordChange({
197
+ at: Date.now(), agent: 'Main', tool: 'edit', op: 'update', path: at('file4.txt'),
198
+ displayPath: 'file4.txt', before: 'a', after: 'b', source: 'tool',
199
+ });
200
+ await other.flush();
201
+
202
+ const files = new Map<string, string>();
203
+ const scans = [
204
+ { root: REPO, dirty: new Map<string, string | null>(), truncated: false },
205
+ { root: REPO, dirty: new Map([[at('file4.txt'), 'python']]), truncated: false },
206
+ ];
207
+ const capture = makeCapture('cap-cross', files, {
208
+ takeScan: async () => scans.shift() ?? null,
209
+ readHead: async () => null,
210
+ });
211
+ capture.onFrame({
212
+ type: 'tool_execution_start',
213
+ toolCallId: 'c1',
214
+ toolName: 'bash',
215
+ args: { command: "python3 - <<'PY'\nopen('file4.txt','w').write('python')\nPY" },
216
+ });
217
+ await capture.flush();
218
+ files.set(at('file4.txt'), 'python');
219
+ capture.onFrame({
220
+ type: 'tool_execution_end',
221
+ toolCallId: 'c1',
222
+ toolName: 'bash',
223
+ result: { details: { trace: { status: 0, units: [{ nodes: [{ k: 'simple', argv: ['python3', '-'], st: 0 }] }] } } },
224
+ });
225
+ await capture.flush();
226
+
227
+ const lines = await records('cap-cross');
228
+ expect(lines.some((line) => line.type === 'change' && line.path === at('file4.txt'))).toBe(false);
229
+ });
230
+ });
231
+
232
+ describe('subagents', () => {
233
+ test('a child edit is attributed to the child', async () => {
234
+ const files = new Map([[at('f.ts'), 'old']]);
235
+ const capture = makeCapture('cap-sub', files);
236
+ capture.onFrame({
237
+ type: 'subagent_event',
238
+ payload: { type: 'tool_execution_start', toolCallId: 's1', toolName: 'edit', args: { path: 'f.ts' }, agent: 'Child' },
239
+ });
240
+ await capture.flush();
241
+ files.set(at('f.ts'), 'new');
242
+ capture.onFrame({
243
+ type: 'subagent_event',
244
+ payload: { type: 'tool_execution_end', toolCallId: 's1', toolName: 'edit', agent: 'Child' },
245
+ });
246
+ await capture.flush();
247
+
248
+ const change = (await records('cap-sub')).find((line) => line.type === 'change');
249
+ expect(change?.type).toBe('change');
250
+ if (change?.type !== 'change') throw new Error('expected a change');
251
+ expect(change.agent).toBe('Child');
252
+ });
253
+ });
@@ -0,0 +1,83 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The paths a tool call can touch, read from its args before it runs.
8
+ *
9
+ * Every case is a spelling a real agent sends: omp's `path`, ACP's `filePath`,
10
+ * Claude's `file_path`, an `apply_patch` that names them only in the patch text,
11
+ * and a `bash` call whose plan carries the mutations (plus the source side of a
12
+ * move, which is what makes a `mv` snapshot the file that disappears).
13
+ */
14
+
15
+ import { describe, expect, test } from 'bun:test';
16
+ import path from 'node:path';
17
+ import { captureTargets } from '@/server/lib/changes/capture-targets';
18
+ import type { PendingCall } from '@/server/lib/changes/capture-types';
19
+
20
+ const CWD = path.resolve('/work');
21
+
22
+ function pending(tool: string, args: Record<string, unknown>): PendingCall {
23
+ return {
24
+ toolCallId: 'c1',
25
+ tool,
26
+ agent: 'Main',
27
+ startedAt: 0,
28
+ args,
29
+ before: new Map(),
30
+ ready: Promise.resolve(),
31
+ };
32
+ }
33
+
34
+ describe('captureTargets', () => {
35
+ test('a file tool resolves its relative path against the session cwd', () => {
36
+ expect(captureTargets(pending('edit', { path: 'src/a.ts' }), CWD)).toEqual([path.join(CWD, 'src/a.ts')]);
37
+ });
38
+
39
+ test('every arg spelling an agent uses is a target', () => {
40
+ const args = { path: 'a.ts', file_path: 'b.ts', filePath: 'c.ts', moveTo: 'd.ts', destination: 'e.ts' };
41
+ expect(captureTargets(pending('edit', args), CWD)).toEqual(['a', 'b', 'c', 'd', 'e'].map((name) => path.join(CWD, `${name}.ts`)));
42
+ });
43
+
44
+ test('an absolute path is normalized, not re-rooted', () => {
45
+ const absolute = path.resolve('/other/x.ts');
46
+ expect(captureTargets(pending('write', { path: absolute }), CWD)).toEqual([absolute]);
47
+ });
48
+
49
+ test('an apply_patch names its paths inside the patch text', () => {
50
+ const patch = [
51
+ '*** Begin Patch',
52
+ '*** Update File: src/one.ts',
53
+ '*** Move to: src/two.ts',
54
+ '*** Add File: src/three.ts',
55
+ '*** End Patch',
56
+ ].join('\n');
57
+ expect(captureTargets(pending('apply_patch', { patch }), CWD)).toEqual(
58
+ ['src/one.ts', 'src/two.ts', 'src/three.ts'].map((relative) => path.join(CWD, relative)),
59
+ );
60
+ });
61
+
62
+ test('a bash call takes its plan mutations, including the side a move leaves', () => {
63
+ const plan = {
64
+ scan: false,
65
+ opaque: false,
66
+ readOnly: false,
67
+ mutations: [
68
+ { path: path.join(CWD, 'from.ts'), from: path.join(CWD, 'old.ts'), op: 'update' as const },
69
+ { path: path.join(CWD, 'new.ts'), op: 'create' as const },
70
+ ],
71
+ };
72
+ const call = { ...pending('bash', { command: 'mv old.ts from.ts' }), plan };
73
+ expect(captureTargets(call, CWD)).toEqual([path.join(CWD, 'from.ts'), path.join(CWD, 'old.ts'), path.join(CWD, 'new.ts')]);
74
+ });
75
+
76
+ test('a URL is not a path', () => {
77
+ expect(captureTargets(pending('read', { path: 'https://example.test/a.ts' }), CWD)).toEqual([]);
78
+ });
79
+
80
+ test('a tool with no path arg has no target', () => {
81
+ expect(captureTargets(pending('read', {}), CWD)).toEqual([]);
82
+ });
83
+ });