@kabmo-labs/kabmo 0.41.0 → 0.42.1

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 (347) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +647 -633
  3. package/dist/client/static/js/{CsvGrid-60njj97j.js → CsvGrid-8gdp5b49.js} +2 -2
  4. package/dist/client/static/js/{DocxView-rsv0j46a.js → DocxView-j9sphgra.js} +5 -5
  5. package/dist/client/static/js/{DrawioView-n2g5df3a.js → DrawioView-xsgjc7d8.js} +2 -2
  6. package/dist/client/static/js/ImageView-ve9hc519.js +1 -0
  7. package/dist/client/static/js/LayoutWrapper-5mqffvkc.js +2 -0
  8. package/dist/client/static/js/Modal-50whypff.js +38 -0
  9. package/dist/client/static/js/{PdfView-1r7a0qkp.js → PdfView-afd5cg54.js} +1 -1
  10. package/dist/client/static/js/SessionsView-7719nvy0.js +1 -0
  11. package/dist/client/static/js/{SheetView-bt5pp042.js → SheetView-gfzgxb4r.js} +25 -25
  12. package/dist/client/static/js/{SvgPreview-vfmqgmrx.js → SvgPreview-225pkb99.js} +1 -1
  13. package/dist/client/static/js/{abnfDiagram-O67JEVCF-8k5hk1yx.js → abnfDiagram-O67JEVCF-z70sk69m.js} +1 -1
  14. package/dist/client/static/js/architecture-7GRP2DOG-cagtcfhk.js +1 -0
  15. package/dist/client/static/js/architectureDiagram-NJMV4G6O-pf1gpkje.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-04sbtdth.js → blockDiagram-BEXU5L5S-sr25kbn6.js} +6 -6
  19. package/dist/client/static/js/c-wqtyezvw.js +1 -0
  20. package/dist/client/static/js/c4Diagram-YGBWAQC7-znstpg86.js +38 -0
  21. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-18cc0bsb.js → classDiagram-v2-NBCMYWYE-7n0pdcd8.js} +6 -6
  22. package/dist/client/static/js/{cose-bilkent-JH36ORCC-dk683zvp.js → cose-bilkent-JH36ORCC-zn3qw4c4.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-6g2ydrss.js +1 -0
  27. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-m2sx8d8s.js → cynefinDiagram-VND7K2PF-3z41vtzs.js} +2 -2
  28. package/dist/client/static/js/{dagre-6A5THRUB-qf3pr59p.js → dagre-6A5THRUB-5j3zn883.js} +2 -2
  29. package/dist/client/static/js/{diagram-22UHCM2B-twnz23mt.js → diagram-22UHCM2B-ryw1w2kh.js} +10 -10
  30. package/dist/client/static/js/{diagram-3UASUU5V-417bas6t.js → diagram-3UASUU5V-p91q4gkh.js} +1 -1
  31. package/dist/client/static/js/diagram-ATOU4E4O-22dn73g4.js +3 -0
  32. package/dist/client/static/js/diagram-CDSNMT55-589p9n53.js +30 -0
  33. package/dist/client/static/js/{diagram-MLGK6HIB-7a0h1hs3.js → diagram-MLGK6HIB-ezw06wbx.js} +1 -1
  34. package/dist/client/static/js/{diagram-MPIPVDR6-w75bftmd.js → diagram-MPIPVDR6-cfwrsvk1.js} +2 -2
  35. package/dist/client/static/js/{dockerfile-g5qbaeq3.js → dockerfile-r4k7q34y.js} +1 -1
  36. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-vdzm3tsv.js → ebnfDiagram-ZINNZB2B-3rv2wvbf.js} +1 -1
  37. package/dist/client/static/js/{elixir-gpez1k9m.js → elixir-szk51ehr.js} +1 -1
  38. package/dist/client/static/js/{elk-276RUBZZ-2fsbb484.js → elk-276RUBZZ-ma40kneq.js} +1 -1
  39. package/dist/client/static/js/{erDiagram-OPXOYQCR-vnkztq7d.js → erDiagram-OPXOYQCR-xwstsfqa.js} +6 -6
  40. package/dist/client/static/js/{erlang-jqqa3ehb.js → erlang-zwy7cqdk.js} +1 -1
  41. package/dist/client/static/js/eventmodeling-NTZA5JFV-b774qbn2.js +1 -0
  42. package/dist/client/static/js/flowDiagram-KWPJA3E3-evp84v09.js +1 -0
  43. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-pbvcch52.js → ganttDiagram-FUAMR5RP-qxyx9tr9.js} +2 -2
  44. package/dist/client/static/js/gitGraph-4MIJSDKK-b047d6vk.js +1 -0
  45. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-dkvktvzr.js → gitGraphDiagram-X574FWY7-v6sg7bkh.js} +2 -2
  46. package/dist/client/static/js/graphql-gvb7e2eb.js +1 -0
  47. package/dist/client/static/js/html-tbz83eke.js +1 -0
  48. package/dist/client/static/js/index-001vebsp.js +2 -0
  49. package/dist/client/static/js/{index-rc8wrs2a.js → index-03pyvmcz.js} +2 -2
  50. package/dist/client/static/js/index-0nca2nhp.js +1 -0
  51. package/dist/client/static/js/{index-3rymer2w.js → index-0p43qr4k.js} +1 -1
  52. package/dist/client/static/js/{index-amawahyh.js → index-2w9j2nj4.js} +2 -2
  53. package/dist/client/static/js/{index-f8pq132s.js → index-313ctswm.js} +1 -1
  54. package/dist/client/static/js/{index-a4ed3mks.js → index-3d40c0a7.js} +5 -5
  55. package/dist/client/static/js/{index-pn91shfp.js → index-4cncqz8j.js} +2 -2
  56. package/dist/client/static/js/{index-9fnzcg2x.js → index-4y0ayjfx.js} +2 -2
  57. package/dist/client/static/js/index-5599dngt.js +1 -0
  58. package/dist/client/static/js/index-5asf5625.js +4 -0
  59. package/dist/client/static/js/{index-tgper3yy.js → index-6dxs0tvg.js} +2 -2
  60. package/dist/client/static/js/{index-zfykeg7x.js → index-6eq445nn.js} +10 -10
  61. package/dist/client/static/js/index-869bpqcs.js +12 -0
  62. package/dist/client/static/js/{index-zye9309h.js → index-8b3t2y77.js} +2 -2
  63. package/dist/client/static/js/{index-rdqn92tc.js → index-8fvmyv7t.js} +2 -2
  64. package/dist/client/static/js/{index-0xaz2eyv.js → index-8pdz41yh.js} +3 -3
  65. package/dist/client/static/js/{index-ne131hmw.js → index-9hzfvjrb.js} +2 -2
  66. package/dist/client/static/js/{index-xfa5hswh.js → index-9ss64g4g.js} +1 -1
  67. package/dist/client/static/js/{index-yzg9mbsv.js → index-b0v6gwym.js} +2 -2
  68. package/dist/client/static/js/{index-j5ram1ve.js → index-b37ewyvk.js} +2 -2
  69. package/dist/client/static/js/{index-e6qjfcz9.js → index-b3d2k7ec.js} +1 -1
  70. package/dist/client/static/js/{index-6fx2t6y7.js → index-b42t14wk.js} +13 -13
  71. package/dist/client/static/js/{index-pbsm2vw7.js → index-cqaz1281.js} +2 -2
  72. package/dist/client/static/js/{index-pfbyfab5.js → index-df4yxfzd.js} +2 -2
  73. package/dist/client/static/js/{index-yq9vnd1y.js → index-dfqmwm7j.js} +2 -2
  74. package/dist/client/static/js/{index-0c6vpk89.js → index-e1yz59fa.js} +2 -2
  75. package/dist/client/static/js/{index-ce4vytm6.js → index-e6any867.js} +2 -2
  76. package/dist/client/static/js/index-f4vr1c6e.css +1 -0
  77. package/dist/client/static/js/{index-cytks03p.js → index-feffxxss.js} +2 -2
  78. package/dist/client/static/js/{index-c6kx7s6a.js → index-gsxebrq9.js} +2 -2
  79. package/dist/client/static/js/{index-s78n0dtv.js → index-hga3e13s.js} +2 -2
  80. package/dist/client/static/js/{index-ajjq0b8y.js → index-hw14rhen.js} +2 -2
  81. package/dist/client/static/js/{index-sj4y8kj2.js → index-j17h4z6f.js} +2 -2
  82. package/dist/client/static/js/{index-7w3gqw2b.js → index-kh6vp5w5.js} +1 -1
  83. package/dist/client/static/js/{index-djv15k5s.js → index-ktbrmp29.js} +2 -2
  84. package/dist/client/static/js/{index-2z9wrb46.js → index-mphhvgm9.js} +2 -2
  85. package/dist/client/static/js/{index-rebnv57p.js → index-mq6s2faf.js} +2 -2
  86. package/dist/client/static/js/index-mvykbyhe.js +1 -0
  87. package/dist/client/static/js/{index-ngk9h0v9.js → index-nh29fkk9.js} +2 -2
  88. package/dist/client/static/js/{index-gn92c6hp.js → index-p0ez6hqd.js} +2 -2
  89. package/dist/client/static/js/{index-e7yf273s.js → index-pkes9492.js} +2 -2
  90. package/dist/client/static/js/{index-hz177dr2.js → index-pxtff3ez.js} +2 -2
  91. package/dist/client/static/js/{index-fg965t62.js → index-pysqpc5n.js} +2 -2
  92. package/dist/client/static/js/{index-4jk8ngjg.js → index-q3qpm7jn.js} +2 -2
  93. package/dist/client/static/js/{index-55hq7tnj.js → index-qh753ynv.js} +1 -1
  94. package/dist/client/static/js/{index-ntcqyqd5.js → index-qx6x4z0y.js} +2 -2
  95. package/dist/client/static/js/{index-agdbjh5k.js → index-r8cc80w5.js} +2 -2
  96. package/dist/client/static/js/{index-9dnkfpx4.js → index-rab39785.js} +2 -2
  97. package/dist/client/static/js/index-rt6ac0kk.js +478 -0
  98. package/dist/client/static/js/{index-haaz8t7e.js → index-sk9ej289.js} +2 -2
  99. package/dist/client/static/js/{index-ds6a2cx7.js → index-sr7sdm2t.js} +5 -5
  100. package/dist/client/static/js/index-v5dbrq83.js +2 -0
  101. package/dist/client/static/js/index-w5q9ymf4.js +1 -0
  102. package/dist/client/static/js/{index-x2kb1kx5.js → index-x7a5jpvq.js} +3 -3
  103. package/dist/client/static/js/{index-re1xz433.js → index-x7m6dmt4.js} +1 -1
  104. package/dist/client/static/js/index-xsts4pqm.js +314 -0
  105. package/dist/client/static/js/index-y1p3bdsw.js +9 -0
  106. package/dist/client/static/js/info-A6RAGUB7-n495k952.js +1 -0
  107. package/dist/client/static/js/{infoDiagram-VRGFBTTK-mh6yks62.js → infoDiagram-VRGFBTTK-0anekyhb.js} +2 -2
  108. package/dist/client/static/js/ini-2gvjwh83.js +1 -0
  109. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-hnfqppnv.js → ishikawaDiagram-OU5B5YK6-zxpmfkjb.js} +2 -2
  110. package/dist/client/static/js/java-1xwcq79s.js +1 -0
  111. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-s4nv1f3q.js → journeyDiagram-ZHPQQLJL-1e86fzra.js} +3 -3
  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-yre4bxb9.js → julia-2eekpjq8.js} +1 -1
  115. package/dist/client/static/js/{kanban-definition-PNTS6WVX-t8kbfefp.js → kanban-definition-PNTS6WVX-e85hhmr1.js} +6 -6
  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-0784021p.js → mermaid.core-jpcrnzyw.js} +6 -6
  119. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-swkkze8c.js → mindmap-definition-NLK3R4M7-xwy5928e.js} +5 -5
  120. package/dist/client/static/js/one-dark-pro-r0tswz8r.js +1 -0
  121. package/dist/client/static/js/one-light-xzcfrptf.js +1 -0
  122. package/dist/client/static/js/packet-AYTQ26CC-zajj62z6.js +1 -0
  123. package/dist/client/static/js/{pegDiagram-GJSIUBJH-jqayzh7z.js → pegDiagram-GJSIUBJH-7dy6pw26.js} +1 -1
  124. package/dist/client/static/js/{perl-weeskn1v.js → perl-dtn1fccw.js} +1 -1
  125. package/dist/client/static/js/{php-vf3045p9.js → php-7av78hch.js} +1 -1
  126. package/dist/client/static/js/pie-WAS4IAKB-1ve78y5f.js +1 -0
  127. package/dist/client/static/js/{pieDiagram-5QR66LMP-w03a65ky.js → pieDiagram-5QR66LMP-nrv2t5yn.js} +2 -2
  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-2j7sfa9s.js → quadrantDiagram-O4NWA36T-3nt63xr8.js} +4 -4
  131. package/dist/client/static/js/r-t2nne4xp.js +1 -0
  132. package/dist/client/static/js/radar-RG4KPBEZ-8rqadb58.js +1 -0
  133. package/dist/client/static/js/railroad-74A4TZTK-v6ppm8dy.js +1 -0
  134. package/dist/client/static/js/railroad-abnf-HS5TGJTU-9j6bae14.js +1 -0
  135. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-56cpyt0g.js +1 -0
  136. package/dist/client/static/js/railroad-peg-WCYAUIDC-yfdmspf4.js +1 -0
  137. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-jtkkgy34.js → railroadDiagram-XR7U4H2S-evm05hzp.js} +1 -1
  138. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-t85ckjdb.js → requirementDiagram-PLB6GJNP-tzrcmktj.js} +4 -4
  139. package/dist/client/static/js/{ruby-1a2ryzy6.js → ruby-s2bqr910.js} +1 -1
  140. package/dist/client/static/js/{rust-736r0f0v.js → rust-pcvgybk3.js} +1 -1
  141. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-5pfkw8ne.js → sankeyDiagram-IPEJSGJF-jvjd5rz8.js} +2 -2
  142. package/dist/client/static/js/{sass-tq4vw7hd.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-55vs9zv5.js → sequenceDiagram-PO4LG4MO-0zvjwx29.js} +10 -10
  145. package/dist/client/static/js/{sizeCapture-INFHLROL-pzqqd7f4.js → sizeCapture-INFHLROL-6t6g0edv.js} +1 -1
  146. package/dist/client/static/js/sql-bwnasywx.js +1 -0
  147. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-6nhrph8n.js → stateDiagram-v2-GCMORJYK-nb13b23a.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-6tcnxfbv.js → swimlanes-2SLR337P-ef8vmg6f.js} +1 -1
  150. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-f4sx355z.js +8 -0
  151. package/dist/client/static/js/{timeline-definition-EJHVYXUP-1dz46nt5.js → timeline-definition-EJHVYXUP-3bfph698.js} +3 -3
  152. package/dist/client/static/js/treeView-Q6P3EWNA-vwpg3wp8.js +1 -0
  153. package/dist/client/static/js/treemap-WGGIJYW6-htfxwd32.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-b3jfveq6.js → usecaseDiagram-POWQR4AR-vj6yj6tc.js} +29 -29
  157. package/dist/client/static/js/{vennDiagram-UO4OBE2U-dnc3jqvp.js → vennDiagram-UO4OBE2U-9xyyabaq.js} +2 -2
  158. package/dist/client/static/js/{vue-zccj3qa5.js → vue-cbqm4bed.js} +1 -1
  159. package/dist/client/static/js/wardley-WFR3VGLG-hapfjkzq.js +1 -0
  160. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-466m8400.js → wardleyDiagram-VNRHLVJA-zpcwgv9d.js} +4 -4
  161. package/dist/client/static/js/xml-4enq788a.js +1 -0
  162. package/dist/client/static/js/xychartDiagram-PMCCYNJV-pdr2rms2.js +7 -0
  163. package/dist/client/static/js/yaml-pjtt3jsc.js +1 -0
  164. package/package.json +1 -1
  165. package/src/cli/lib/commands/session.js +12 -1
  166. package/src/client/components/common/batch-selection/folder-state.ts +2 -2
  167. package/src/client/components/common/server-control/Panel.tsx +16 -5
  168. package/src/client/components/common/server-control/index.test.tsx +63 -9
  169. package/src/client/components/common/session-row/TrailingSlot.tsx +8 -0
  170. package/src/client/components/common/session-row/index.tsx +16 -9
  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 +6 -0
  176. package/src/client/components/layout/session-sidebar/harness-filter.test.tsx +173 -0
  177. package/src/client/components/layout/session-sidebar/modern/FilterChips.tsx +63 -18
  178. package/src/client/components/layout/session-sidebar/modern/SearchField.tsx +1 -1
  179. package/src/client/components/layout/session-sidebar/modern/WorkspaceHeader.tsx +21 -12
  180. package/src/client/components/layout/session-sidebar/modern/WorkspaceSection.tsx +1 -1
  181. package/src/client/components/layout/session-sidebar/modern/index.tsx +11 -2
  182. package/src/client/components/layout/session-sidebar/modern/search-field.test.tsx +96 -0
  183. package/src/client/components/layout/session-sidebar/session-list-states.test.tsx +3 -0
  184. package/src/client/components/layout/session-sidebar/variant-props.ts +7 -0
  185. package/src/client/components/mobile/SessionSidebar.tsx +14 -25
  186. package/src/client/components/mobile/mobile-session-sidebar/ClassicDrawer.tsx +19 -0
  187. package/src/client/components/mobile/mobile-session-sidebar/Item.tsx +1 -1
  188. package/src/client/components/settings/categories/omp-settings/EngineHeader.tsx +1 -1
  189. package/src/client/components/workspace/chat-timeline/MessageItem.tsx +14 -123
  190. package/src/client/components/workspace/chat-timeline/OrchestrationNotice.tsx +214 -0
  191. package/src/client/components/workspace/chat-timeline/UserTurn.test.tsx +126 -0
  192. package/src/client/components/workspace/chat-timeline/UserTurn.tsx +183 -0
  193. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.image.test.ts +147 -0
  194. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.test.ts +51 -83
  195. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.tsx +44 -63
  196. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/ReadDirectory.tsx +72 -0
  197. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/ReadImage.tsx +51 -0
  198. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/read-test-util.ts +91 -0
  199. package/src/client/components/workspace/git-panel/commit-modal/CommitRow.test.ts +80 -62
  200. package/src/client/components/workspace/git-panel/commit-modal/CommitRow.tsx +15 -33
  201. package/src/client/components/workspace/git-panel/commit-modal/Header.tsx +1 -1
  202. package/src/client/components/workspace/terminal-panel/copy.test.ts +179 -0
  203. package/src/client/components/workspace/terminal-panel/copy.ts +76 -0
  204. package/src/client/components/workspace/terminal-panel/mount.ts +13 -0
  205. package/src/client/data/settings/omp-schema.json +39 -18
  206. package/src/client/hooks/chat/omp/pending-child.test.ts +1 -1
  207. package/src/client/hooks/chat/omp/session-sidebar-controller.test.ts +61 -0
  208. package/src/client/hooks/chat/omp/session-sidebar-controller.ts +37 -39
  209. package/src/client/hooks/chat/omp/sidebar-filter.ts +62 -0
  210. package/src/client/hooks/chat/timeline/composer-modes.ts +10 -7
  211. package/src/client/hooks/chat/timeline/plan-review-republish.test.ts +121 -0
  212. package/src/client/hooks/chat/timeline/plan-review.ts +12 -3
  213. package/src/client/hooks/chat/timeline/session-changes.test.ts +85 -0
  214. package/src/client/hooks/chat/timeline/session-changes.ts +8 -5
  215. package/src/client/hooks/shell/servers.ts +60 -2
  216. package/src/client/hooks/ui/updates/mobile-flow.ts +56 -0
  217. package/src/client/tailwind.css +58 -0
  218. package/src/server/lib/harness/acp/acp-audit.server.ts +1 -1
  219. package/src/server/lib/harness/acp/commands.test.ts +1 -0
  220. package/src/server/lib/harness/acp/commands.ts +12 -4
  221. package/src/server/lib/harness/acp/replay-transcript.ts +32 -13
  222. package/src/server/lib/harness/acp/session-exit.ts +39 -5
  223. package/src/server/lib/harness/acp/session-transcript.server.test.ts +162 -0
  224. package/src/server/lib/harness/acp/session-transcript.server.ts +350 -0
  225. package/src/server/lib/harness/acp/session-turns.ts +67 -12
  226. package/src/server/lib/harness/acp/session.test.ts +61 -0
  227. package/src/server/lib/harness/acp/session.ts +21 -26
  228. package/src/server/lib/harness/acp/turn-outcome.server.test.ts +97 -0
  229. package/src/server/lib/harness/acp/turn-outcome.server.ts +71 -0
  230. package/src/server/lib/harness/acp/turn-silence.ts +52 -0
  231. package/src/server/lib/harness/acp/turn.test.ts +85 -3
  232. package/src/server/lib/harness/acp/turn.ts +62 -4
  233. package/src/server/lib/harness/schema.server.ts +18 -0
  234. package/src/server/lib/harness/spawn.server.ts +14 -1
  235. package/src/server/lib/lifecycle/after-listen.ts +10 -0
  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-contract.ts +21 -0
  240. package/src/server/lib/omp/rpc/frame-fold-host.test-util.ts +4 -0
  241. package/src/server/lib/omp/rpc/frame-fold.test.ts +16 -1
  242. package/src/server/lib/omp/rpc/frame-fold.ts +42 -6
  243. package/src/server/lib/omp/rpc/manager.ts +9 -8
  244. package/src/server/lib/omp/rpc/retry-saga.ts +54 -0
  245. package/src/server/lib/omp/rpc/run-settle.server.ts +38 -5
  246. package/src/server/lib/omp/rpc/run-settle.test.ts +5 -2
  247. package/src/server/lib/omp/rpc/session-commands-dialog.test.ts +6 -20
  248. package/src/server/lib/omp/rpc/session-commands-mapping.test.ts +131 -0
  249. package/src/server/lib/omp/rpc/session-commands.test.ts +95 -116
  250. package/src/server/lib/omp/rpc/session-commands.ts +38 -17
  251. package/src/server/lib/omp/rpc/terminal-settle.test.ts +223 -0
  252. package/src/server/lib/omp/rpc/terminal-settle.ts +127 -29
  253. package/src/server/lib/omp/session/blobs.server.test.ts +34 -0
  254. package/src/server/lib/omp/session/blobs.server.ts +8 -3
  255. package/src/server/lib/omp/session/delete.server.ts +4 -0
  256. package/src/server/lib/omp/session/sidebar-activity.server.test.ts +2 -1
  257. package/src/server/lib/sessions/notify.server.test.ts +11 -3
  258. package/src/server/lib/sessions/notify.server.ts +67 -42
  259. package/src/server/lib/sessions/spawn.server.test.ts +5 -1
  260. package/src/server/lib/sessions/spawn.server.ts +8 -3
  261. package/src/server/routes/agent/harness-command.test.ts +71 -0
  262. package/src/server/routes/agent/harness-command.ts +27 -13
  263. package/src/server/routes/chat/imported.ts +5 -2
  264. package/src/server/routes/chat/live-meta.ts +42 -0
  265. package/src/server/routes/chat/session.test.ts +110 -0
  266. package/src/server/routes/chat/session.ts +31 -34
  267. package/src/server/routes/sessions/answer.test.ts +62 -0
  268. package/src/server/routes/sessions/answer.ts +13 -2
  269. package/src/shared/lib/chat/composer/delegation.ts +11 -7
  270. package/src/shared/lib/chat/export-markdown.ts +19 -0
  271. package/src/shared/lib/chat/orchestration/notice.test.ts +118 -0
  272. package/src/shared/lib/chat/orchestration/notice.ts +183 -0
  273. package/src/shared/lib/chat/timeline/omp-callbacks.ts +6 -1
  274. package/src/shared/lib/chat/transcript-rows.ts +22 -0
  275. package/src/shared/lib/fs/file-kind.test.ts +46 -3
  276. package/src/shared/lib/fs/file-kind.ts +40 -9
  277. package/src/shared/lib/icons/tint-hues.generated.ts +36 -36
  278. package/src/shared/lib/omp/config/schema-releases.test.ts +29 -0
  279. package/src/shared/lib/workspace/harness-filter.test.ts +89 -0
  280. package/src/shared/lib/workspace/harness-filter.ts +75 -0
  281. package/src/{client/lib → shared/lib/workspace}/session-tree.test.ts +1 -1
  282. package/src/shared/lib/workspace/session-visibility.test.ts +71 -0
  283. package/src/shared/lib/workspace/session-visibility.ts +48 -23
  284. package/src/shared/lib/workspace/sidebar-filter-row.test.ts +64 -23
  285. package/src/shared/lib/workspace/sidebar-filter-row.ts +89 -31
  286. package/dist/client/static/js/ImageView-t330jx6y.js +0 -1
  287. package/dist/client/static/js/LayoutWrapper-qp6nsw65.js +0 -2
  288. package/dist/client/static/js/Modal-sbya4ahp.js +0 -38
  289. package/dist/client/static/js/SessionsView-yqs5m8tj.js +0 -1
  290. package/dist/client/static/js/architecture-7GRP2DOG-1wqga929.js +0 -1
  291. package/dist/client/static/js/architectureDiagram-NJMV4G6O-7jcb7fgy.js +0 -36
  292. package/dist/client/static/js/bash-vv2ysp0a.js +0 -1
  293. package/dist/client/static/js/c-67jyc7sg.js +0 -1
  294. package/dist/client/static/js/c4Diagram-YGBWAQC7-vwac9za0.js +0 -38
  295. package/dist/client/static/js/cpp-crfbnwv8.js +0 -1
  296. package/dist/client/static/js/css-2re5mbea.js +0 -1
  297. package/dist/client/static/js/css-983fbv00.js +0 -1
  298. package/dist/client/static/js/cynefin-OW5HDTMX-j2dpdgkh.js +0 -1
  299. package/dist/client/static/js/diagram-ATOU4E4O-n63cpdnx.js +0 -3
  300. package/dist/client/static/js/diagram-CDSNMT55-v86p14dd.js +0 -30
  301. package/dist/client/static/js/eventmodeling-NTZA5JFV-xjvjawd3.js +0 -1
  302. package/dist/client/static/js/flowDiagram-KWPJA3E3-j21f2bfg.js +0 -1
  303. package/dist/client/static/js/gitGraph-4MIJSDKK-r0zbk95f.js +0 -1
  304. package/dist/client/static/js/graphql-npbd9fdx.js +0 -1
  305. package/dist/client/static/js/html-1cpe2xc8.js +0 -1
  306. package/dist/client/static/js/index-1sw00wm0.js +0 -2
  307. package/dist/client/static/js/index-7fwppdkn.js +0 -1
  308. package/dist/client/static/js/index-ae91g8ka.js +0 -9
  309. package/dist/client/static/js/index-b6cyn4hr.js +0 -314
  310. package/dist/client/static/js/index-efn233xp.js +0 -4
  311. package/dist/client/static/js/index-esx3zwnt.js +0 -1
  312. package/dist/client/static/js/index-fbbp5cwj.js +0 -2
  313. package/dist/client/static/js/index-g1cggqgx.js +0 -12
  314. package/dist/client/static/js/index-ghsdzs4m.js +0 -1
  315. package/dist/client/static/js/index-gs7ytgdw.js +0 -474
  316. package/dist/client/static/js/index-jqs23cc7.css +0 -1
  317. package/dist/client/static/js/index-qjsy6p86.js +0 -1
  318. package/dist/client/static/js/info-A6RAGUB7-a8xap43w.js +0 -1
  319. package/dist/client/static/js/ini-df5bw23e.js +0 -1
  320. package/dist/client/static/js/java-8j33rj1p.js +0 -1
  321. package/dist/client/static/js/json-g5ggnd94.js +0 -1
  322. package/dist/client/static/js/jsx-f6p72qpc.js +0 -1
  323. package/dist/client/static/js/lua-bahx6qze.js +0 -1
  324. package/dist/client/static/js/markdown-9dhg1fax.js +0 -1
  325. package/dist/client/static/js/one-dark-pro-h5tmw145.js +0 -1
  326. package/dist/client/static/js/one-light-x7vj1pxr.js +0 -1
  327. package/dist/client/static/js/packet-AYTQ26CC-b5bvg6v1.js +0 -1
  328. package/dist/client/static/js/pie-WAS4IAKB-77ee73zg.js +0 -1
  329. package/dist/client/static/js/properties-49mfnee4.js +0 -1
  330. package/dist/client/static/js/python-qb69wp1s.js +0 -1
  331. package/dist/client/static/js/r-s3mf2tch.js +0 -1
  332. package/dist/client/static/js/radar-RG4KPBEZ-cp79xtvb.js +0 -1
  333. package/dist/client/static/js/railroad-74A4TZTK-dcpgqhcb.js +0 -1
  334. package/dist/client/static/js/railroad-abnf-HS5TGJTU-qasqv686.js +0 -1
  335. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-e46908rd.js +0 -1
  336. package/dist/client/static/js/railroad-peg-WCYAUIDC-7009t6bk.js +0 -1
  337. package/dist/client/static/js/sql-aczp05f2.js +0 -1
  338. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-7xrkrkpa.js +0 -8
  339. package/dist/client/static/js/treeView-Q6P3EWNA-tpn62q8j.js +0 -1
  340. package/dist/client/static/js/treemap-WGGIJYW6-w910f1g4.js +0 -1
  341. package/dist/client/static/js/tsx-s1shkfg9.js +0 -1
  342. package/dist/client/static/js/typescript-htx9v6bf.js +0 -1
  343. package/dist/client/static/js/wardley-WFR3VGLG-pt9tq808.js +0 -1
  344. package/dist/client/static/js/xml-wr1dxav5.js +0 -1
  345. package/dist/client/static/js/xychartDiagram-PMCCYNJV-kryrpqp1.js +0 -7
  346. package/dist/client/static/js/yaml-0y9fdskg.js +0 -1
  347. /package/src/{client/lib → shared/lib/workspace}/session-tree.ts +0 -0
@@ -0,0 +1,183 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * One `role: "user"` row.
8
+ *
9
+ * Split out of `MessageItem` when the orchestration card landed: the row now
10
+ * has two halves — the text Kabmo injected and the text the operator typed —
11
+ * and keeping both in the assistant renderer pushed that file past the repo's
12
+ * ceiling.
13
+ *
14
+ * The split is the point. A delegating message is an orchestration contract
15
+ * PREPENDED to what the person wrote, and a child outcome is a notice with no
16
+ * operator text at all. Drawing either as a bubble made Kabmo's own machinery
17
+ * look like something a human said, so the injected half renders as a card
18
+ * (`OrchestrationNotice`) and only the operator's words keep the bubble.
19
+ */
20
+
21
+ import { useMemo } from 'preact/hooks';
22
+ import { Bot, GitFork, MessageSquarePlus, Undo2, User } from 'lucide-preact';
23
+ import type { Attachment, ChatMessageData } from '@/shared/types';
24
+ import type { ForkAnchorRole } from '@/shared/lib/chat/timeline/fork-anchor';
25
+ import { toAttachmentList } from '@/shared/lib/chat/attachments';
26
+ import { MarkdownRenderer } from '@/client/components/common/MarkdownRenderer';
27
+ import { AttachmentChips } from '@/client/components/workspace/chat-timeline/AttachmentChips';
28
+ import { CopyButton } from '@/client/components/common/CopyButton';
29
+ import { PluginMessageActions } from '@/client/components/workspace/chat-timeline/PluginMessageActions';
30
+ import { OrchestrationNotice } from '@/client/components/workspace/chat-timeline/OrchestrationNotice';
31
+ import { formatMessageStamp } from '@/shared/lib/format/time';
32
+ import { transcriptBlockPadding, transcriptGutter } from '@/shared/lib/chat/timeline/gutter';
33
+ import { parseOrchestrationBlock } from '@/shared/lib/chat/orchestration/notice';
34
+
35
+ export interface UserTurnProps {
36
+ msg: ChatMessageData | any;
37
+ /** The row's display text, already resolved by the caller. */
38
+ content: unknown;
39
+ isMobile: boolean;
40
+ /** Whether this row offers Undo / New-chat (a chat turn, not a BTW question). */
41
+ userActions: boolean;
42
+ canFork: boolean;
43
+ className: string;
44
+ onUndo?: (msgId: string, content?: string) => void;
45
+ onNewChat?: (content: string, attachments?: Attachment[]) => void;
46
+ onFork?: (msgId: string, role: ForkAnchorRole) => void;
47
+ }
48
+
49
+ export function UserTurn({
50
+ msg,
51
+ content,
52
+ isMobile,
53
+ userActions,
54
+ canFork,
55
+ className,
56
+ onUndo,
57
+ onNewChat,
58
+ onFork,
59
+ }: UserTurnProps) {
60
+ const isAgentAttributed = msg.attribution === 'agent';
61
+ const raw = typeof content === 'string' ? content : '';
62
+ const orchestration = useMemo(() => parseOrchestrationBlock(raw), [raw]);
63
+ // What the operator actually wrote. For a delegating turn that is the text
64
+ // after the contract; for a notice it is nothing, and the row is the card.
65
+ const operatorText = orchestration ? orchestration.rest : raw;
66
+ const showBubble = !orchestration || operatorText.length > 0;
67
+ const displayText = useMemo(() => operatorText.trim(), [operatorText]);
68
+
69
+ const handleNewChat = (e?: Event) => {
70
+ if (e) e.preventDefault();
71
+ if (!onNewChat) return;
72
+ // Committed rows carry the persisted display fields only (no `File`), which
73
+ // is what the composer and the send path both expect on a replay.
74
+ const attachments = toAttachmentList(msg.attachments);
75
+ onNewChat(displayText, attachments.length ? attachments : undefined);
76
+ };
77
+
78
+ return (
79
+ <div id={msg.id} className={`flex flex-col space-y-1.5 w-full max-w-full ${className}`}>
80
+ {orchestration && <OrchestrationNotice block={orchestration} isMobile={isMobile} />}
81
+
82
+ {showBubble && (
83
+ <div className="flex flex-col items-end space-y-1.5 w-full max-w-full">
84
+ {/* User bubble - standardized to text-[13px] with markdown support */}
85
+ <div className={`bg-paper ${transcriptBlockPadding(isMobile)} sm:p-4 rounded-xl border border-ink/15 text-[13px] text-ink shadow-xs max-w-[92%] sm:max-w-[85%] break-words overflow-hidden flex flex-col space-y-2 font-sans select-text ${transcriptGutter(isMobile)}`} style={{ lineHeight: 'var(--markdown-body-line-height)' }}>
86
+ {isAgentAttributed && (
87
+ <div className="flex items-center space-x-1.5 pb-1.5 mb-1 border-b border-ink/10 text-[11px] font-mono text-ink/70">
88
+ <Bot size={12} className="text-ink shrink-0" />
89
+ <span className="font-semibold text-ink">Subagent Assignment</span>
90
+ <span className="text-[10px] uppercase tracking-wider px-1.5 py-0.5 rounded bg-ink/5 text-ink/60">Delegated</span>
91
+ </div>
92
+ )}
93
+ <MarkdownRenderer content={displayText} />
94
+
95
+ <AttachmentChips
96
+ attachments={msg.attachments || []}
97
+ onOpenFile={(att: { name?: string; content?: string }) => {
98
+ window.dispatchEvent(new CustomEvent('omp:open-file', {
99
+ detail: { path: att.name ?? 'attachment', content: att.content }
100
+ }));
101
+ }}
102
+ />
103
+ </div>
104
+
105
+ {/* User Metadata & Toolbar (Undo on the left of Copy) */}
106
+ <div className="flex items-center space-x-2.5 text-[11px] text-ink/60 px-1 font-mono">
107
+ <div className="flex items-center space-x-1.5 border-r border-ink/15 pr-2.5">
108
+ {isAgentAttributed ? (
109
+ <>
110
+ <Bot size={11} className="text-ink/70 shrink-0" />
111
+ <span className="text-[10px] uppercase font-semibold tracking-wider text-ink/60">Agent</span>
112
+ </>
113
+ ) : (
114
+ <User size={11} className="text-ink/70 shrink-0" />
115
+ )}
116
+ {formatMessageStamp(msg) && <span>{formatMessageStamp(msg)}</span>}
117
+ </div>
118
+
119
+ <div className="flex items-center space-x-1">
120
+ {/* Undo Button (to the left of copy button) */}
121
+ {userActions && (
122
+ <button
123
+ type="button"
124
+ className="flex items-center hover:text-ink transition-colors p-1 rounded hover:bg-ink/5 cursor-pointer"
125
+ title="Undo / Edit message"
126
+ aria-label="Undo this message"
127
+ onClick={() => onUndo?.(msg.id, displayText)}
128
+ >
129
+ <Undo2 size={12} />
130
+ </button>
131
+ )}
132
+
133
+ {/* Copy Button — the operator's words, never the injected contract. */}
134
+ <CopyButton
135
+ text={displayText}
136
+ className="flex items-center hover:text-ink transition-colors p-1 rounded hover:bg-ink/5 cursor-pointer"
137
+ iconSize={12}
138
+ title="Copy prompt"
139
+ ariaLabel="Copy prompt"
140
+ emptyTitle="Nothing to copy — attachment-only prompt"
141
+ />
142
+
143
+ {/* Fork Button — branches the session at this row, leaving the
144
+ source untouched. Separate from New Chat: a fork carries the
145
+ history, a new chat does not. */}
146
+ {userActions && canFork && (
147
+ <button
148
+ type="button"
149
+ className="flex items-center hover:text-ink transition-colors p-1 rounded hover:bg-ink/5 cursor-pointer"
150
+ title="Fork from here"
151
+ aria-label="Fork this session from this message"
152
+ onClick={(e) => {
153
+ e.preventDefault();
154
+ onFork?.(msg.id, 'user');
155
+ }}
156
+ >
157
+ <GitFork size={12} />
158
+ </button>
159
+ )}
160
+
161
+ {/* New Chat Button */}
162
+ {userActions && (
163
+ <button
164
+ type="button"
165
+ className="flex items-center hover:text-ink transition-colors p-1 rounded hover:bg-ink/5 cursor-pointer"
166
+ title="New Chat from here"
167
+ aria-label="Start a new chat from this message"
168
+ onClick={handleNewChat}
169
+ >
170
+ <MessageSquarePlus size={12} />
171
+ </button>
172
+ )}
173
+
174
+ {/* Plugin contributions, in store order. The empty slot renders
175
+ nothing, so a Kabmo with no plugins keeps this strip intact. */}
176
+ <PluginMessageActions messageId={String(msg.id)} role="user" text={displayText} />
177
+ </div>
178
+ </div>
179
+ </div>
180
+ )}
181
+ </div>
182
+ );
183
+ }
@@ -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
  });