@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
@@ -3,16 +3,12 @@ import { MobileSessionHeader } from '@/client/components/mobile/mobile-session-s
3
3
  import { ClassicDrawer } from '@/client/components/mobile/mobile-session-sidebar/ClassicDrawer';
4
4
  import { ModernSidebarView } from '@/client/components/layout/session-sidebar/modern';
5
5
  import { MobileSessionFooter } from '@/client/components/mobile/mobile-session-sidebar/Footer';
6
- import { useShellOffer } from '@/client/hooks/ui/updates/shell-download';
7
- import { useKabmoEvent } from '@/client/hooks/ui/window-event';
6
+ import { useMobileUpdateFlow } from '@/client/hooks/ui/updates/mobile-flow';
8
7
  import { useToasts } from '@/client/hooks/ui/toasts';
9
8
  import { useCancelWait } from '@/client/hooks/chat/waiting/cancel';
10
9
  import { useWaitingDispatch } from '@/client/hooks/chat/waiting/dispatch';
11
- import { useUpdates } from '@/client/hooks/ui/updates';
12
10
  import { useSidebarStyle } from '@/client/hooks/workspace/sidebar-style';
13
- import { UPDATE_REQUEST_EVENT } from '@/shared/lib/updates/popup-state';
14
11
  import { openKeyBindingHelp } from '@/client/lib/commands/overlays';
15
- import { updateOutcomeTone } from '@/shared/lib/ui/toast-duration';
16
12
  import { useScheduledTaskCount } from '@/client/hooks/workspace/scheduled-tasks';
17
13
  import { phoneLeftStripVisible } from '@/shared/lib/workspace/mobile-dock';
18
14
  import { MobileDockBody, MobileDockStrip } from '@/client/components/mobile/mobile-session-sidebar/Dock';
@@ -98,6 +94,9 @@ export function MobileSessionSidebar({
98
94
  setOptionsOpen,
99
95
  sortOption,
100
96
  handleSortChange,
97
+ harnessFilter,
98
+ setHarnessFilter,
99
+ harnessOptions,
101
100
  processedFolders,
102
101
  sessionStatus,
103
102
  handleSelectSession,
@@ -116,25 +115,13 @@ export function MobileSessionSidebar({
116
115
  const [schedulerOpen, setSchedulerOpen] = useState(false);
117
116
  const scheduledCount = useScheduledTaskCount();
118
117
  const [aboutOpen, setAboutOpen] = useState(false);
119
- const updates = useUpdates();
120
- // An update inside a native shell, an install on an Android browser, nothing
121
- // elsewhere — see `useShellOffer`.
122
- const shellDownload = useShellOffer();
123
118
  const { pushToast } = useToasts();
124
119
  const cancelWait = useCancelWait(pushToast);
125
120
  useWaitingDispatch({ onNotice: pushToast });
126
-
127
- // The popup's "Update now" hands the run over rather than starting its own —
128
- // see the desktop sidebar. The phone must also bring the drawer forward, or
129
- // the About modal would open over the chat with the user still looking at the
130
- // session list they came from.
131
- useKabmoEvent(UPDATE_REQUEST_EVENT, () => {
132
- onClose();
133
- setAboutOpen(true);
134
- void updates.apply('kabmo').then((result) => {
135
- if (!result) return;
136
- pushToast(result.message, updateOutcomeTone(result));
137
- });
121
+ const { updates, shellDownload } = useMobileUpdateFlow({
122
+ onClose,
123
+ openAbout: () => setAboutOpen(true),
124
+ pushToast,
138
125
  });
139
126
 
140
127
  const handleNewSessionAndClose = () => {
@@ -196,6 +183,9 @@ export function MobileSessionSidebar({
196
183
  onToggleOptions: () => setOptionsOpen(!optionsOpen),
197
184
  onCloseOptions: () => setOptionsOpen(false),
198
185
  onSortChange: handleSortChange,
186
+ harnessFilter,
187
+ onHarnessFilterChange: setHarnessFilter,
188
+ harnessOptions,
199
189
  onRefresh: refreshNow,
200
190
  refreshing: isRefreshing,
201
191
  scheduledCount,
@@ -264,6 +254,9 @@ export function MobileSessionSidebar({
264
254
  sortOption={sortOption}
265
255
  optionsOpen={optionsOpen}
266
256
  showArchived={showArchived}
257
+ harnessFilter={harnessFilter}
258
+ onHarnessFilterChange={setHarnessFilter}
259
+ harnessOptions={harnessOptions}
267
260
  optionsRef={optionsRef}
268
261
  scheduledCount={scheduledCount}
269
262
  refreshing={isRefreshing}
@@ -18,7 +18,9 @@ import { MobileSessionToolbar } from '@/client/components/mobile/mobile-session-
18
18
  import { MobileSessionList } from '@/client/components/mobile/mobile-session-sidebar/List';
19
19
  import { MobileSessionListSkeleton } from '@/client/components/mobile/mobile-session-sidebar/Skeleton';
20
20
  import { SessionListNotice } from '@/client/components/layout/session-sidebar/SessionListNotice';
21
+ import { HarnessFilter } from '@/client/components/layout/session-sidebar/HarnessFilter';
21
22
  import type { BatchBinding } from '@/client/components/common/batch-selection/types';
23
+ import type { HarnessFilterOption } from '@/shared/lib/workspace/harness-filter';
22
24
  import type { SessionSortOption, WorkspaceFolderData } from '@/shared/types';
23
25
  import type { ToastTone } from '@/shared/lib/ui/toast-duration';
24
26
 
@@ -34,6 +36,11 @@ export interface ClassicDrawerProps {
34
36
  sortOption: SessionSortOption;
35
37
  optionsOpen: boolean;
36
38
  showArchived: boolean;
39
+ /** The harness the list is narrowed to, or null for every harness. */
40
+ harnessFilter: string | null;
41
+ onHarnessFilterChange: (harness: string | null) => void;
42
+ /** The harnesses the list holds, with row counts — the filter's menu. */
43
+ harnessOptions: HarnessFilterOption[];
37
44
  optionsRef: RefObject<HTMLDivElement>;
38
45
  scheduledCount: number;
39
46
  refreshing: boolean;
@@ -71,6 +78,9 @@ export function ClassicDrawer({
71
78
  sortOption,
72
79
  optionsOpen,
73
80
  showArchived,
81
+ harnessFilter,
82
+ onHarnessFilterChange,
83
+ harnessOptions,
74
84
  optionsRef,
75
85
  scheduledCount,
76
86
  refreshing,
@@ -121,6 +131,15 @@ export function ClassicDrawer({
121
131
  selecting={selecting}
122
132
  />
123
133
 
134
+ <div className="px-3 pt-2 pb-1">
135
+ <HarnessFilter
136
+ options={harnessOptions}
137
+ value={harnessFilter}
138
+ onChange={onHarnessFilterChange}
139
+ touch
140
+ />
141
+ </div>
142
+
124
143
  {failed ? (
125
144
  <SessionListNotice touch onRetry={onRefresh} refreshing={refreshing} />
126
145
  ) : initializing ? (
@@ -5,7 +5,7 @@ import { MobileSessionRow, MOBILE_BRANCH_STYLE } from '@/client/components/mobil
5
5
  import { SessionBranch, branchControlFor } from '@/client/components/common/session-branch';
6
6
  import type { BranchControl } from '@/client/components/common/session-branch';
7
7
  import type { ToastTone } from '@/shared/lib/ui/toast-duration';
8
- import { buildSessionTree } from '@/client/lib/session-tree';
8
+ import { buildSessionTree } from '@/shared/lib/workspace/session-tree';
9
9
  import { useWorktreeDialog } from '@/client/components/mobile/mobile-session-sidebar/WorktreeDialog';
10
10
  import { useShowMore } from '@/client/hooks/ui/show-more';
11
11
  import { useExpandedSessions } from '@/client/hooks/workspace/expanded-sessions';
@@ -72,7 +72,7 @@ export function EngineHeader({
72
72
  value={searchQuery}
73
73
  onChange={(e) => onSearchChange(e.currentTarget.value)}
74
74
  placeholder="Search every setting…"
75
- className="w-52 bg-paper border border-ink/15 rounded-md pl-6 pr-6 py-1 text-ink placeholder:text-ink/40 focus:outline-none focus:border-ink/40"
75
+ className="kabmo-search-field w-52 bg-paper border border-ink/15 rounded-md pl-6 pr-6 py-1 text-ink placeholder:text-ink/40 focus:outline-none focus:border-ink/40"
76
76
  />
77
77
  {searchQuery && (
78
78
  <button
@@ -16,34 +16,32 @@
16
16
  * two mounts pin both spellings, and that the footer lands once the run ends.
17
17
  */
18
18
 
19
- import { afterAll, beforeAll, describe, expect, test } from 'bun:test';
19
+ import { afterAll, afterEach, beforeAll, describe, expect, test } from 'bun:test';
20
20
  import { Window } from 'happy-dom';
21
21
  import { h, render } from 'preact';
22
22
  import { act } from 'preact/test-utils';
23
23
  import { MessageList } from '@/client/components/workspace/chat-timeline/MessageList';
24
+ import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
24
25
  import type { ChatMessageData } from '@/shared/types';
25
26
 
26
27
  let container: HTMLElement;
27
-
28
- const DOM_GLOBALS = ['window', 'document', 'navigator', 'Node', 'Element', 'HTMLElement', 'HTMLInputElement', 'Event', 'MouseEvent', 'KeyboardEvent'] as const;
29
- /** The runner's own globals, restored on teardown — deleting them would strip natives (Event/CustomEvent) every later file needs. */const nativeGlobals: Partial<Record<(typeof DOM_GLOBALS)[number], unknown>> = {};
30
-
31
- beforeAll(() => {
32
- const win = new Window({ url: 'http://localhost' });
33
- const target = globalThis as unknown as Record<string, unknown>;
34
- for (const key of DOM_GLOBALS) {
35
- if (!(key in nativeGlobals)) nativeGlobals[key] = target[key];
36
- target[key] = (win as unknown as Record<string, unknown>)[key];
37
- }
28
+ /** Every tree this file mounted; unmounted before the window goes away. */
29
+ const mounted: HTMLElement[] = [];
30
+
31
+ beforeAll(() => installDomGlobals(new Window({ url: 'http://localhost' })));
32
+
33
+ afterEach(() => {
34
+ // UNMOUNT, not detach: `MessageList` draws `AiMessageFooter`, whose plugin
35
+ // strip subscribes to the list-slot store. A tree left mounted re-renders on
36
+ // that store's next publish — which happens in a LATER file, after
37
+ // `restoreDomGlobals` deleted `document`, and surfaces there as
38
+ // `ReferenceError: document is not defined` in `list-slots.test.ts` on the
39
+ // Windows shard. A detached container is enough for the assertions, but the
40
+ // subscription outlives it.
41
+ for (const node of mounted.splice(0)) render(null, node);
38
42
  });
39
43
 
40
- afterAll(() => {
41
- const target = globalThis as unknown as Record<string, unknown>;
42
- for (const key of DOM_GLOBALS) {
43
- if (nativeGlobals[key] === undefined) delete target[key];
44
- else target[key] = nativeGlobals[key];
45
- }
46
- });
44
+ afterAll(() => restoreDomGlobals());
47
45
 
48
46
  const user = (id: string): ChatMessageData => ({ id, role: 'user', content: 'yo' });
49
47
  const ai = (id: string): ChatMessageData => ({ id, role: 'ai', content: 'hi' });
@@ -53,6 +51,7 @@ const committed = (id: string): ChatMessageData => ({ id, role: 'assistant', con
53
51
  async function mount(messages: ChatMessageData[], isGenerating: boolean): Promise<HTMLElement> {
54
52
  container = document.createElement('div');
55
53
  document.body.appendChild(container);
54
+ mounted.push(container);
56
55
  await act(async () => {
57
56
  render(h(MessageList, { messages, isGenerating }), container);
58
57
  });
@@ -97,6 +96,7 @@ describe('MessageList mounted window', () => {
97
96
  async function mountWindowed(messages: ChatMessageData[], rowWindow: ReturnType<typeof window>): Promise<HTMLElement> {
98
97
  container = document.createElement('div');
99
98
  document.body.appendChild(container);
99
+ mounted.push(container);
100
100
  await act(async () => {
101
101
  render(h(MessageList, { messages, isGenerating: false, rowWindow }), container);
102
102
  });
@@ -0,0 +1,147 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The pictures a `read` card paints, and the full-size view behind a click.
8
+ *
9
+ * The card used to draw the bytes at `max-h-72` with no affordance, so a
10
+ * screenshot of fine text could not be read; and an SVG — which omp returns as
11
+ * SOURCE, because it has no magic bytes — rendered as a code block with no
12
+ * picture at all. Both now open the same surface `eval` screenshots do.
13
+ *
14
+ * Split from `Read.test.ts` (the text branches) because each suite is at the
15
+ * repo's per-file ceiling; both mount through `read-test-util.ts`.
16
+ */
17
+
18
+ import { afterAll, beforeAll, describe, expect, test } from 'bun:test';
19
+ import { act } from 'preact/test-utils';
20
+ import {
21
+ installReadDom,
22
+ mountRead,
23
+ readTool,
24
+ restoreReadDom,
25
+ } from '@/client/components/workspace/chat-timeline/tool-renderers/panels/read-test-util';
26
+
27
+ beforeAll(() => {
28
+ installReadDom();
29
+ });
30
+
31
+ afterAll(() => {
32
+ restoreReadDom();
33
+ });
34
+
35
+ /** Close the preview the click opened, so the next case starts clean. */
36
+ function closePreview(): void {
37
+ act(() => {
38
+ window.dispatchEvent(new window.KeyboardEvent('keydown', { key: 'Escape' }));
39
+ });
40
+ }
41
+
42
+ describe('Read panel — image preview', () => {
43
+ test('the result’s own picture opens at full size when clicked', async () => {
44
+ // The card painted the bytes with no affordance, so a screenshot of fine
45
+ // text could not be read. The full-size surface is the one `eval`
46
+ // screenshots open into: a dialog with the zoom/pan pill, on the SAME URL
47
+ // the thumbnail drew.
48
+ const el = await mountRead(readTool({
49
+ target: '/tmp/shot.png',
50
+ input: { path: '/tmp/shot.png' },
51
+ images: [{ mimeType: 'image/png', dataBase64: 'AAAA' }],
52
+ }));
53
+ const open = el.querySelector('button[aria-label="Open /tmp/shot.png full size"]') as HTMLButtonElement;
54
+ expect(open).not.toBeNull();
55
+ expect(open.querySelector('img')?.getAttribute('src')).toBe('data:image/png;base64,AAAA');
56
+
57
+ act(() => open.click());
58
+
59
+ const dialog = document.querySelector('[role="dialog"]');
60
+ expect(dialog).not.toBeNull();
61
+ expect(dialog?.getAttribute('aria-label')).toBe('/tmp/shot.png');
62
+ expect(dialog?.querySelector('button[title="Fit to view (0)"]')).not.toBeNull();
63
+ expect(dialog?.querySelector('button[title="Zoom in (+)"]')).not.toBeNull();
64
+ expect(dialog?.querySelector('img')?.getAttribute('src')).toBe('data:image/png;base64,AAAA');
65
+
66
+ closePreview();
67
+ expect(document.querySelector('[role="dialog"]')).toBeNull();
68
+ });
69
+
70
+ test('a path-only image read opens the same preview', async () => {
71
+ // A result that carries no image block falls back to the raw-file route;
72
+ // the click affordance belongs to both branches, not just to the bytes the
73
+ // result returned.
74
+ const el = await mountRead(readTool({ target: 'assets/logo.png', input: { path: 'assets/logo.png' } }));
75
+ const open = el.querySelector('button[aria-label="Open assets/logo.png full size"]') as HTMLButtonElement;
76
+ expect(open).not.toBeNull();
77
+ expect(open.querySelector('img')?.getAttribute('src')).toContain('/api/fs/raw?path=assets%2Flogo.png');
78
+
79
+ act(() => open.click());
80
+ expect(document.querySelector('[role="dialog"] img')?.getAttribute('src')).toContain(
81
+ '/api/fs/raw?path=assets%2Flogo.png',
82
+ );
83
+ closePreview();
84
+ });
85
+
86
+ test('a path-only webp read opens the same preview', async () => {
87
+ // WEBP is in the image table AND in the magic-byte table (RIFF/WEBP at
88
+ // offset 8), so a `.webp` a provider did not decode still previews.
89
+ const el = await mountRead(readTool({ target: 'assets/logo.webp', input: { path: 'assets/logo.webp' } }));
90
+ const open = el.querySelector('button[aria-label="Open assets/logo.webp full size"]') as HTMLButtonElement;
91
+ expect(open).not.toBeNull();
92
+ expect(open.querySelector('img')?.getAttribute('src')).toContain('/api/fs/raw?path=assets%2Flogo.webp');
93
+
94
+ act(() => open.click());
95
+ expect(document.querySelector('[role="dialog"] img')?.getAttribute('src')).toContain(
96
+ '/api/fs/raw?path=assets%2Flogo.webp',
97
+ );
98
+ closePreview();
99
+ });
100
+
101
+ test('an svg image block paints through the blob route', async () => {
102
+ // omp hands an `<svg>` back as text, but a result CAN carry an svg image
103
+ // block; the blob route labels it `image/svg+xml` from the bytes, so the
104
+ // card paints it instead of a broken picture with an octet-stream type.
105
+ const hash = 'a'.repeat(64);
106
+ const el = await mountRead(readTool({
107
+ target: 'assets/mark.svg',
108
+ input: { path: 'assets/mark.svg' },
109
+ images: [{ mimeType: 'image/svg+xml', blobRef: `blob:sha256:${hash}` }],
110
+ }));
111
+ const open = el.querySelector('button[aria-label="Open assets/mark.svg full size"]') as HTMLButtonElement;
112
+ expect(open).not.toBeNull();
113
+ expect(open.querySelector('img')?.getAttribute('src')).toBe(`/api/omp/blob?hash=${hash}`);
114
+ });
115
+
116
+ test('an svg read paints the picture AND keeps the source it returned', async () => {
117
+ // omp answers a `read` of an SVG with its markup, so treating it as a
118
+ // picture-only card would hide the only text the tool actually returned.
119
+ // The preview is additive: image on top, source below, still copyable.
120
+ const source = '1|<svg xmlns="http://www.w3.org/2000/svg" width="300" height="120"><rect width="300" height="120"/></svg>';
121
+ const el = await mountRead(readTool({
122
+ target: 'assets/mark.svg',
123
+ input: { path: 'assets/mark.svg' },
124
+ output: source,
125
+ details: { fileSize: 224, totalLines: 1, displayContent: { text: source.slice(2), startLine: 1, lineNumbers: [1] } },
126
+ }));
127
+ const open = el.querySelector('button[aria-label="Open assets/mark.svg full size"]') as HTMLButtonElement;
128
+ expect(open).not.toBeNull();
129
+ expect(open.querySelector('img')?.getAttribute('src')).toContain('/api/fs/raw?path=assets%2Fmark.svg');
130
+ const text = el.textContent ?? '';
131
+ expect(text).toContain('SVG');
132
+ // The markup the tool returned is still on the card, not replaced by pixels.
133
+ expect(text).toContain('<rect');
134
+ expect(text).toContain('Copy file content');
135
+ });
136
+
137
+ test('a failed svg read stays a message, with no picture over it', async () => {
138
+ const el = await mountRead(readTool({
139
+ target: 'assets/missing.svg',
140
+ input: { path: 'assets/missing.svg' },
141
+ status: 'error',
142
+ isError: true,
143
+ output: "Path 'assets/missing.svg' not found",
144
+ }));
145
+ expect(el.querySelector('button[aria-label="Open assets/missing.svg full size"]')).toBeNull();
146
+ });
147
+ });
@@ -4,119 +4,72 @@
4
4
  */
5
5
 
6
6
  /**
7
- * The Read panel's lazy fallback.
7
+ * The Read panel's text branches: the lazy `/api/fs/read` fallback and the
8
+ * documents it renders as prose.
8
9
  *
9
10
  * A `read` whose result carries no output falls back to fetching the path it
10
- * named through `/api/fs/read`. An omp internal URL names no file: the route
11
- * refused `proc://kabmo-dev`, and the panel printed
12
- * `// Loaded file: proc://kabmo-dev` as if that were the file's contents.
13
- * A `read` of a process is answered by the `proc://` panel, never by this one —
14
- * but a legacy transcript can still hand it a virtual URL.
11
+ * named. An omp internal URL names no file: the route refused `proc://kabmo-dev`,
12
+ * and the panel printed `// Loaded file: proc://kabmo-dev` as if that were the
13
+ * file's contents. A `read` of a process is answered by the `proc://` panel,
14
+ * never by this one — but a legacy transcript can still hand it a virtual URL.
15
15
  *
16
- * Rendered with `h()` against happy-dom, following `panels/Edit.test.ts`.
16
+ * The picture branches are `Read.image.test.ts`; both mount through
17
+ * `read-test-util.ts`.
17
18
  */
18
19
 
19
20
  import { afterAll, beforeAll, beforeEach, describe, expect, test } from 'bun:test';
20
- import { Window } from 'happy-dom';
21
- import { h, render } from 'preact';
22
- import { act } from 'preact/test-utils';
23
- import { Read } from '@/client/components/workspace/chat-timeline/tool-renderers/panels/Read';
24
- import type { ToolCallData } from '@/shared/types';
25
-
26
- const DOM_GLOBALS = ['window', 'document', 'navigator', 'Node', 'Element', 'HTMLElement', 'HTMLInputElement', 'Event', 'MouseEvent', 'KeyboardEvent', 'fetch'] as const;
27
- const nativeGlobals: Partial<Record<(typeof DOM_GLOBALS)[number], unknown>> = {};
28
-
29
- let calls: string[] = [];
30
- /** The next response the stub hands back. Defaults to a 200 carrying `hello`. */
31
- let nextResponse: { ok: boolean; status: number; body: unknown } = {
32
- ok: true,
33
- status: 200,
34
- body: { content: 'hello' },
35
- };
21
+ import {
22
+ fetchCalls,
23
+ installReadDom,
24
+ mountRead,
25
+ readTool,
26
+ restoreReadDom,
27
+ setNextResponse,
28
+ } from '@/client/components/workspace/chat-timeline/tool-renderers/panels/read-test-util';
36
29
 
37
30
  beforeAll(() => {
38
- const win = new Window({ url: 'http://localhost' });
39
- const target = globalThis as unknown as Record<string, unknown>;
40
- for (const key of DOM_GLOBALS) {
41
- nativeGlobals[key] = target[key];
42
- target[key] = (win as unknown as Record<string, unknown>)[key];
43
- }
44
- // The panel reads the status and the body, so the stub has to carry both: a
45
- // refused read is `ok: false` with an `error`, and the assertions below are
46
- // about which sentence the panel printed.
47
- const stub = (async (url: string) => {
48
- calls.push(String(url));
49
- const { ok, status, body } = nextResponse;
50
- return { ok, status, json: async () => body };
51
- }) as unknown as typeof globalThis.fetch;
52
- globalThis.fetch = stub;
31
+ installReadDom();
53
32
  });
54
33
 
55
34
  afterAll(() => {
56
- const target = globalThis as unknown as Record<string, unknown>;
57
- for (const key of DOM_GLOBALS) {
58
- if (nativeGlobals[key] === undefined) delete target[key];
59
- else target[key] = nativeGlobals[key];
60
- }
35
+ restoreReadDom();
61
36
  });
62
37
 
63
- /** Mount and flush the effect + its fetch microtask chain. */
64
- async function mount(tool: ToolCallData) {
65
- const container = document.createElement('div');
66
- document.body.appendChild(container);
67
- await act(async () => {
68
- render(h(Read, { tool, output: tool.output ?? '' }), container);
69
- });
70
- // The reader awaits `fetch` and then `res.json()`, and each state write lands
71
- // a turn later; a few separate `act` passes drain that chain without binding
72
- // the test to the clock.
73
- for (let pass = 0; pass < 4; pass += 1) {
74
- await act(async () => {
75
- await Promise.resolve();
76
- });
77
- }
78
- return container;
79
- }
80
-
81
- function readTool(partial: Partial<ToolCallData>): ToolCallData {
82
- return { id: 'r1', type: 'read', name: 'read', title: 'read', output: '', status: 'success', details: {}, ...partial } as ToolCallData;
83
- }
84
-
85
38
  describe('Read panel — lazy fallback', () => {
86
39
  beforeEach(() => {
87
- nextResponse = { ok: true, status: 200, body: { content: 'hello' } };
40
+ setNextResponse({ ok: true, status: 200, body: { content: 'hello' } });
88
41
  });
89
42
 
90
43
  test('a virtual URL never reaches /api/fs/read', async () => {
91
- calls = [];
92
- const el = await mount(readTool({ target: 'proc://kabmo-dev', input: { path: 'proc://kabmo-dev' } }));
93
- expect(calls).toHaveLength(0);
44
+ fetchCalls.length = 0;
45
+ const el = await mountRead(readTool({ target: 'proc://kabmo-dev', input: { path: 'proc://kabmo-dev' } }));
46
+ expect(fetchCalls).toHaveLength(0);
94
47
  expect(el.textContent ?? '').not.toContain('Loaded file');
95
48
  });
96
49
 
97
50
  test('a real path still lazy-loads', async () => {
98
- calls = [];
99
- await mount(readTool({ target: 'src/x.ts', input: { path: 'src/x.ts' } }));
100
- expect(calls[0]).toContain('/api/fs/read?path=src%2Fx.ts');
51
+ fetchCalls.length = 0;
52
+ await mountRead(readTool({ target: 'src/x.ts', input: { path: 'src/x.ts' } }));
53
+ expect(fetchCalls[0]).toContain('/api/fs/read?path=src%2Fx.ts');
101
54
  });
102
55
 
103
56
  test('a refused read prints the server’s reason, never a fake body', async () => {
104
57
  // A binary or oversized file is refused by the route with its own sentence.
105
58
  // Printing `// Loaded file: <path>` described contents that were never read.
106
- nextResponse = {
59
+ setNextResponse({
107
60
  ok: false,
108
61
  status: 415,
109
62
  body: { error: 'This file is not text, so it cannot be shown in the editor.', kind: 'binary' },
110
- };
111
- const el = await mount(readTool({ target: 'archive.zip', input: { path: 'archive.zip' } }));
63
+ });
64
+ const el = await mountRead(readTool({ target: 'archive.zip', input: { path: 'archive.zip' } }));
112
65
  const text = el.textContent ?? '';
113
66
  expect(text).toContain('not text');
114
67
  expect(text).not.toContain('Loaded file');
115
68
  });
116
69
 
117
70
  test('a read whose body is missing a content field is reported, not faked', async () => {
118
- nextResponse = { ok: true, status: 200, body: {} };
119
- const el = await mount(readTool({ target: 'src/y.ts', input: { path: 'src/y.ts' } }));
71
+ setNextResponse({ ok: true, status: 200, body: {} });
72
+ const el = await mountRead(readTool({ target: 'src/y.ts', input: { path: 'src/y.ts' } }));
120
73
  const text = el.textContent ?? '';
121
74
  expect(text).toContain('HTTP 200');
122
75
  expect(text).not.toContain('Loaded file');
@@ -130,7 +83,7 @@ describe('Read panel — language and markdown', () => {
130
83
  // was badged `javascript` (the language detector's default for a path with
131
84
  // no extension) and rendered as one `<pre>` of literal syntax.
132
85
  const text = '# eval — Eval\n\n- Static content? Use `read`.';
133
- const el = await mount(readTool({
86
+ const el = await mountRead(readTool({
134
87
  target: 'xd://eval',
135
88
  input: { path: 'xd://eval' },
136
89
  output: text.split('\n').map((row, index) => `${index + 1}|${row}`).join('\n'),
@@ -169,7 +122,7 @@ describe('Read panel — language and markdown', () => {
169
122
  '- MUST open a tab before direct use.',
170
123
  '</critical>',
171
124
  ].join('\n');
172
- const el = await mount(readTool({
125
+ const el = await mountRead(readTool({
173
126
  target: 'xd://eval/browser',
174
127
  input: { path: 'xd://eval/browser' },
175
128
  output: text.split('\n').map((line, index) => `${index + 1}|${line}`).join('\n'),
@@ -193,7 +146,7 @@ describe('Read panel — language and markdown', () => {
193
146
  // `read xd://propose` payload (one row) rendered as the paragraph
194
147
  // `1|Write your plan's <slug> …`.
195
148
  const line = "Write your plan's <slug> as plain text to xd://propose to submit the plan for approval.";
196
- const el = await mount(readTool({
149
+ const el = await mountRead(readTool({
197
150
  target: 'xd://propose',
198
151
  input: { path: 'xd://propose' },
199
152
  output: `1|${line}`,
@@ -211,7 +164,7 @@ describe('Read panel — language and markdown', () => {
211
164
  test('a failed xd:// read stays a message, not a document', async () => {
212
165
  // `read xd://nope` answers "No such tool: xd://nope. Mounted devices: …",
213
166
  // which is a refusal rather than a document; it keeps the code surface.
214
- const el = await mount(readTool({
167
+ const el = await mountRead(readTool({
215
168
  target: 'xd://nope',
216
169
  input: { path: 'xd://nope' },
217
170
  status: 'error',
@@ -231,7 +184,7 @@ describe('Read panel — language and markdown', () => {
231
184
  // renderer must strip that gutter before the markdown parse — otherwise the
232
185
  // heading is the paragraph `1|# Diagnose`.
233
186
  const text = '# Diagnose\n\n## Steps\n\n1. Reproduce';
234
- const el = await mount(readTool({
187
+ const el = await mountRead(readTool({
235
188
  target: 'skill://diagnose',
236
189
  input: { path: 'skill://diagnose' },
237
190
  output: text.split('\n').map((line, index) => `${index + 1}|${line}`).join('\n'),
@@ -250,7 +203,7 @@ describe('Read panel — language and markdown', () => {
250
203
  });
251
204
 
252
205
  test('a source file still gets its language badge and code gutter', async () => {
253
- const el = await mount(readTool({
206
+ const el = await mountRead(readTool({
254
207
  target: 'src/x.ts',
255
208
  input: { path: 'src/x.ts' },
256
209
  output: '1|const a = 1;',
@@ -260,4 +213,19 @@ describe('Read panel — language and markdown', () => {
260
213
  expect(text).toContain('typescript');
261
214
  expect(text).toContain('const a = 1;');
262
215
  });
216
+
217
+ test('a directory read draws the tree omp printed', async () => {
218
+ // The listing lives in `ReadDirectory` (split for the file-size ceiling);
219
+ // this pins the wiring, so a prop rename cannot silently empty the card.
220
+ const el = await mountRead(readTool({
221
+ target: 'src',
222
+ input: { path: 'src' },
223
+ output: '.\n- components/\n- index.ts',
224
+ }));
225
+ const text = el.textContent ?? '';
226
+ expect(text).toContain('Directory');
227
+ expect(text).toContain('components/');
228
+ expect(text).toContain('index.ts');
229
+ expect(el.querySelector('svg.lucide-folder')).not.toBeNull();
230
+ });
263
231
  });