@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
@@ -3,17 +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
- import { useUpdateCheckRequest } from '@/client/hooks/ui/updates/check-request';
15
11
  import { openKeyBindingHelp } from '@/client/lib/commands/overlays';
16
- import { updateOutcomeTone } from '@/shared/lib/ui/toast-duration';
17
12
  import { useScheduledTaskCount } from '@/client/hooks/workspace/scheduled-tasks';
18
13
  import { phoneLeftStripVisible } from '@/shared/lib/workspace/mobile-dock';
19
14
  import { MobileDockBody, MobileDockStrip } from '@/client/components/mobile/mobile-session-sidebar/Dock';
@@ -99,6 +94,9 @@ export function MobileSessionSidebar({
99
94
  setOptionsOpen,
100
95
  sortOption,
101
96
  handleSortChange,
97
+ harnessFilter,
98
+ setHarnessFilter,
99
+ harnessOptions,
102
100
  processedFolders,
103
101
  sessionStatus,
104
102
  handleSelectSession,
@@ -117,30 +115,15 @@ export function MobileSessionSidebar({
117
115
  const [schedulerOpen, setSchedulerOpen] = useState(false);
118
116
  const scheduledCount = useScheduledTaskCount();
119
117
  const [aboutOpen, setAboutOpen] = useState(false);
120
- const updates = useUpdates();
121
- // An update inside a native shell, an install on an Android browser, nothing
122
- // elsewhere — see `useShellOffer`.
123
- const shellDownload = useShellOffer();
124
118
  const { pushToast } = useToasts();
125
119
  const cancelWait = useCancelWait(pushToast);
126
120
  useWaitingDispatch({ onNotice: pushToast });
127
-
128
- // The popup's "Update now" hands the run over rather than starting its own —
129
- // see the desktop sidebar. The phone must also bring the drawer forward, or
130
- // the About modal would open over the chat with the user still looking at the
131
- // session list they came from.
132
- useKabmoEvent(UPDATE_REQUEST_EVENT, () => {
133
- onClose();
134
- setAboutOpen(true);
135
- void updates.apply('kabmo').then((result) => {
136
- if (!result) return;
137
- pushToast(result.message, updateOutcomeTone(result));
138
- });
121
+ const { updates, shellDownload } = useMobileUpdateFlow({
122
+ onClose,
123
+ openAbout: () => setAboutOpen(true),
124
+ pushToast,
139
125
  });
140
126
 
141
- // The same native row as the desktop's: one check, one verdict, drawer stays.
142
- useUpdateCheckRequest(updates, pushToast);
143
-
144
127
  const handleNewSessionAndClose = () => {
145
128
  onNewSession();
146
129
  onClose();
@@ -200,6 +183,9 @@ export function MobileSessionSidebar({
200
183
  onToggleOptions: () => setOptionsOpen(!optionsOpen),
201
184
  onCloseOptions: () => setOptionsOpen(false),
202
185
  onSortChange: handleSortChange,
186
+ harnessFilter,
187
+ onHarnessFilterChange: setHarnessFilter,
188
+ harnessOptions,
203
189
  onRefresh: refreshNow,
204
190
  refreshing: isRefreshing,
205
191
  scheduledCount,
@@ -268,6 +254,9 @@ export function MobileSessionSidebar({
268
254
  sortOption={sortOption}
269
255
  optionsOpen={optionsOpen}
270
256
  showArchived={showArchived}
257
+ harnessFilter={harnessFilter}
258
+ onHarnessFilterChange={setHarnessFilter}
259
+ harnessOptions={harnessOptions}
271
260
  optionsRef={optionsRef}
272
261
  scheduledCount={scheduledCount}
273
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
@@ -1,22 +1,17 @@
1
- import type { TargetedMouseEvent } from 'preact';
2
1
  import { useMemo } from 'preact/hooks';
3
2
  import { memo } from 'preact/compat';
4
- import { AlertCircle, Bot, GitFork, Info, MessageSquarePlus, Undo2, User } from 'lucide-preact';
3
+ import { AlertCircle, Info } from 'lucide-preact';
5
4
  import type { Attachment, ChatMessageData } from '@/shared/types';
6
5
  import { canForkAt, type ForkAnchorRole } from '@/shared/lib/chat/timeline/fork-anchor';
7
- import { toAttachmentList } from '@/shared/lib/chat/attachments';
8
6
  import { ThinkingSection } from '@/client/components/workspace/chat-timeline/ThinkingSection';
9
7
  import { ToolCallingSection } from '@/client/components/workspace/chat-timeline/ToolCallingSection';
10
8
  import { SystemNotice } from '@/client/components/workspace/chat-timeline/SystemNotice';
11
9
  import { IrcNotice } from '@/client/components/workspace/chat-timeline/IrcNotice';
12
10
  import { MarkdownRenderer } from '@/client/components/common/MarkdownRenderer';
13
- import { AttachmentChips } from '@/client/components/workspace/chat-timeline/AttachmentChips';
14
- import { CopyButton } from '@/client/components/common/CopyButton';
15
- import { PluginMessageActions } from '@/client/components/workspace/chat-timeline/PluginMessageActions';
11
+ import { UserTurn } from '@/client/components/workspace/chat-timeline/UserTurn';
16
12
  import { capitalizeFirstLetter } from '@/shared/lib/chat/capitalize';
17
13
  import { isNoticeRow, messageAnswerText } from '@/shared/lib/chat/notice-row';
18
- import { formatMessageStamp } from '@/shared/lib/format/time';
19
- import { transcriptBlockPadding, transcriptGutter } from '@/shared/lib/chat/timeline/gutter';
14
+ import { transcriptGutter } from '@/shared/lib/chat/timeline/gutter';
20
15
  import { traceInset } from '@/shared/lib/chat/timeline/block-chrome';
21
16
  import { useToolRenderMode } from '@/client/hooks/chat/timeline/tool-render-mode';
22
17
 
@@ -78,7 +73,6 @@ export const ChatMessageItem = memo(function ChatMessageItem({
78
73
  /** Stable string references for MarkdownRenderer so its internal
79
74
  * useMemo([content]) holds across parent re-renders (streaming frames
80
75
  * replace the timeline array identity every frame). */
81
- const userContent = useMemo(() => (typeof effectiveContent === 'string' ? effectiveContent.trim() : effectiveContent), [effectiveContent]);
82
76
  const assistantContent = useMemo(() => (typeof effectiveContent === 'string' ? capitalizeFirstLetter(effectiveContent) : effectiveContent), [effectiveContent]);
83
77
 
84
78
  /** Content is not worth rendering when it is empty or only punctuation
@@ -86,122 +80,19 @@ export const ChatMessageItem = memo(function ChatMessageItem({
86
80
  * lone dot while the real payload lives in tool calls / thinking. */
87
81
  const hasRenderableContent = typeof effectiveContent === 'string' && /[A-Za-z0-9]/.test(effectiveContent);
88
82
 
89
- const handleNewChat = (e?: TargetedMouseEvent<HTMLElement>) => {
90
- if (e) e.preventDefault();
91
- if (!onNewChat) return;
92
- // Committed rows carry the persisted display fields only (no `File`), which
93
- // is what the composer and the send path both expect on a replay.
94
- const attachments = toAttachmentList(msg.attachments);
95
- onNewChat(msg.content, attachments.length ? attachments : undefined);
96
- };
97
-
98
- const handleUndo = () => {
99
- if (onUndo) {
100
- onUndo(msg.id, msg.content);
101
- }
102
- };
103
-
104
83
  if (isUser) {
105
- const isAgentAttributed = msg.attribution === 'agent';
106
-
107
84
  return (
108
- <div id={msg.id} className={`flex flex-col items-end space-y-1.5 w-full max-w-full ${className}`}>
109
- {/* User bubble - standardized to text-[13px] with markdown support */}
110
- <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)' }}>
111
- {isAgentAttributed && (
112
- <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">
113
- <Bot size={12} className="text-ink shrink-0" />
114
- <span className="font-semibold text-ink">Subagent Assignment</span>
115
- <span className="text-[10px] uppercase tracking-wider px-1.5 py-0.5 rounded bg-ink/5 text-ink/60">Delegated</span>
116
- </div>
117
- )}
118
- <MarkdownRenderer content={userContent} />
119
-
120
- <AttachmentChips
121
- attachments={msg.attachments || []}
122
- onOpenFile={(att: { name?: string; content?: string }) => {
123
- window.dispatchEvent(new CustomEvent('omp:open-file', {
124
- detail: { path: att.name ?? 'attachment', content: att.content }
125
- }));
126
- }}
127
- />
128
- </div>
129
-
130
- {/* User Metadata & Toolbar (Undo on the left of Copy) */}
131
- <div className="flex items-center space-x-2.5 text-[11px] text-ink/60 px-1 font-mono">
132
- <div className="flex items-center space-x-1.5 border-r border-ink/15 pr-2.5">
133
- {isAgentAttributed ? (
134
- <>
135
- <Bot size={11} className="text-ink/70 shrink-0" />
136
- <span className="text-[10px] uppercase font-semibold tracking-wider text-ink/60">Agent</span>
137
- </>
138
- ) : (
139
- <User size={11} className="text-ink/70 shrink-0" />
140
- )}
141
- {formatMessageStamp(msg) && <span>{formatMessageStamp(msg)}</span>}
142
- </div>
143
-
144
- <div className="flex items-center space-x-1">
145
- {/* Undo Button (to the left of copy button) */}
146
- {userActions && (
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="Undo / Edit message"
151
- aria-label="Undo this message"
152
- onClick={handleUndo}
153
- >
154
- <Undo2 size={12} />
155
- </button>
156
- )}
157
-
158
- {/* Copy Button */}
159
- <CopyButton
160
- text={msg.content}
161
- className="flex items-center hover:text-ink transition-colors p-1 rounded hover:bg-ink/5 cursor-pointer"
162
- iconSize={12}
163
- title="Copy prompt"
164
- ariaLabel="Copy prompt"
165
- emptyTitle="Nothing to copy — attachment-only prompt"
166
- />
167
-
168
- {/* Fork Button — branches the session at this row, leaving the
169
- source untouched. Separate from New Chat: a fork carries the
170
- history, a new chat does not. */}
171
- {userActions && canFork && (
172
- <button
173
- type="button"
174
- className="flex items-center hover:text-ink transition-colors p-1 rounded hover:bg-ink/5 cursor-pointer"
175
- title="Fork from here"
176
- aria-label="Fork this session from this message"
177
- onClick={(e) => {
178
- e.preventDefault();
179
- onFork?.(msg.id, 'user');
180
- }}
181
- >
182
- <GitFork size={12} />
183
- </button>
184
- )}
185
-
186
- {/* New Chat Button */}
187
- {userActions && (
188
- <button
189
- type="button"
190
- className="flex items-center hover:text-ink transition-colors p-1 rounded hover:bg-ink/5 cursor-pointer"
191
- title="New Chat from here"
192
- aria-label="Start a new chat from this message"
193
- onClick={handleNewChat}
194
- >
195
- <MessageSquarePlus size={12} />
196
- </button>
197
- )}
198
-
199
- {/* Plugin contributions, in store order. The empty slot renders
200
- nothing, so a Kabmo with no plugins keeps this strip intact. */}
201
- <PluginMessageActions messageId={String(msg.id)} role="user" text={typeof msg.content === 'string' ? msg.content : ''} />
202
- </div>
203
- </div>
204
- </div>
85
+ <UserTurn
86
+ msg={msg}
87
+ content={effectiveContent}
88
+ isMobile={isMobile}
89
+ userActions={userActions}
90
+ canFork={canFork}
91
+ className={className}
92
+ onUndo={onUndo}
93
+ onNewChat={onNewChat}
94
+ onFork={onFork}
95
+ />
205
96
  );
206
97
  }
207
98
 
@@ -0,0 +1,214 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The card a Kabmo-injected prompt wears in the timeline.
8
+ *
9
+ * A delegating message, a worker brief and a child outcome all reach omp as
10
+ * `role: "user"` turns, because that is the only channel Kabmo can inject
11
+ * through. Drawn as bubbles they are indistinguishable from something the
12
+ * operator typed: a 1 KB orchestration contract with shell heredocs, a worker
13
+ * preamble quoting its own session id, a report from a session nobody is
14
+ * looking at. All three belong to Kabmo, not to the person reading the
15
+ * transcript, so they get a card with a label and a collapse control instead.
16
+ *
17
+ * The OPERATOR'S OWN WORDS still render as their bubble (`MessageItem` splits
18
+ * the envelope's trailing text out); this card only ever holds the injected
19
+ * half. That split is the whole reason the envelope wraps the injection rather
20
+ * than replacing the message: a delegating prompt is contract + the sentence
21
+ * they actually wrote, and dropping the sentence would rewrite their turn.
22
+ */
23
+
24
+ import { useMemo, useState } from 'preact/hooks';
25
+ import { AlertCircle, ArrowRightLeft, CheckCircle2, ChevronDown, Info, Workflow, XCircle } from 'lucide-preact';
26
+ import { MarkdownRenderer } from '@/client/components/common/MarkdownRenderer';
27
+ import { transcriptGutter } from '@/shared/lib/chat/timeline/gutter';
28
+ import { blockChrome } from '@/shared/lib/chat/timeline/block-chrome';
29
+ import { useToolRenderMode } from '@/client/hooks/chat/timeline/tool-render-mode';
30
+ import {
31
+ parseChildOutcomeNotice,
32
+ type ChildOutcomeEntry,
33
+ type OrchestrationBlock,
34
+ } from '@/shared/lib/chat/orchestration/notice';
35
+
36
+ const KIND_LABEL: Record<OrchestrationBlock['kind'], string> = {
37
+ contract: 'Orchestration',
38
+ worker: 'Dispatched worker',
39
+ outcome: 'Worker outcome',
40
+ };
41
+
42
+ const KIND_ICON: Record<OrchestrationBlock['kind'], typeof Workflow> = {
43
+ contract: Workflow,
44
+ worker: ArrowRightLeft,
45
+ outcome: Info,
46
+ };
47
+
48
+ const STATUS_STYLE: Record<ChildOutcomeEntry['status'], { label: string; icon: typeof CheckCircle2; badge: string }> = {
49
+ completed: { label: 'Completed', icon: CheckCircle2, badge: 'bg-success/10 text-success' },
50
+ failed: { label: 'Failed', icon: XCircle, badge: 'bg-error/10 text-error' },
51
+ interrupted: { label: 'Interrupted', icon: AlertCircle, badge: 'bg-warning/10 text-warning' },
52
+ };
53
+
54
+ /** How many workers a contract names — the count is the card's one-line
55
+ * summary, and the spawn command is what a contract is made of. */
56
+ function workerCount(body: string): number {
57
+ return body.match(/--harness\s+\S+/g)?.length ?? 0;
58
+ }
59
+
60
+ /** The collapsed subtitle for one kind. Deliberately short: the whole body is
61
+ * one click away, and a truncated heredoc tells the reader nothing. */
62
+ function subtitleOf(block: OrchestrationBlock): string {
63
+ if (block.kind === 'contract') {
64
+ const count = workerCount(block.body);
65
+ return count === 1 ? '1 worker' : `${count} workers`;
66
+ }
67
+ if (block.kind === 'worker') {
68
+ const task = block.body.split(/\r?\nTASK\r?\n/)[1]?.trim() ?? '';
69
+ const first = task.split(/\r?\n/).map((line) => line.trim()).find(Boolean);
70
+ return first ?? 'No task text';
71
+ }
72
+ const entries = parseChildOutcomeNotice(block.body);
73
+ if (entries.length === 0) return 'No outcome recorded';
74
+ if (entries.length === 1) {
75
+ const entry = entries[0] as ChildOutcomeEntry;
76
+ const name = entry.title || entry.sessionId;
77
+ // The reason rides the collapsed line: a card that only says "failed" makes
78
+ // the reader open it to learn whether it matters.
79
+ return entry.status === 'completed' ? name : `${name} — ${entry.failure ?? entry.status}`;
80
+ }
81
+ return `${entries.length} workers`;
82
+ }
83
+
84
+ function OutcomeEntry({ entry, showStatus }: { entry: ChildOutcomeEntry; showStatus: boolean }) {
85
+ const style = STATUS_STYLE[entry.status];
86
+ const Icon = style.icon;
87
+ return (
88
+ <div className="space-y-1.5 rounded-lg border border-ink/8 bg-paper p-2.5">
89
+ <div className="flex flex-wrap items-center gap-2">
90
+ {/* A single worker's verdict is already on the card's header; repeating
91
+ it here reads as two different results. */}
92
+ {showStatus && (
93
+ <span className={`flex items-center gap-1 rounded px-1.5 py-0.5 font-mono text-[10px] font-semibold uppercase ${style.badge}`}>
94
+ <Icon size={10} />
95
+ {style.label}
96
+ </span>
97
+ )}
98
+ {entry.title && <span className="truncate text-[12px] font-medium text-ink">{entry.title}</span>}
99
+ <span className="truncate font-mono text-[10px] text-ink/45">{entry.sessionId}</span>
100
+ </div>
101
+ {entry.status === 'completed' ? (
102
+ <div className="text-[11.5px] leading-relaxed text-ink/85">
103
+ <MarkdownRenderer content={entry.output?.trim() || 'No final output was recorded.'} />
104
+ </div>
105
+ ) : (
106
+ <p className="font-mono text-[11px] leading-relaxed break-words whitespace-pre-wrap text-ink/80">
107
+ {entry.failure?.trim() || 'The worker gave no reason.'}
108
+ </p>
109
+ )}
110
+ </div>
111
+ );
112
+ }
113
+
114
+ export interface OrchestrationNoticeProps {
115
+ block: OrchestrationBlock;
116
+ /** Phone layout: the card's frame is the timeline gutter itself. */
117
+ isMobile?: boolean;
118
+ }
119
+
120
+ export function OrchestrationNotice({ block, isMobile = false }: OrchestrationNoticeProps) {
121
+ const mode = useToolRenderMode();
122
+ const chrome = blockChrome(mode);
123
+ const [open, setOpen] = useState(false);
124
+ const Icon = KIND_ICON[block.kind];
125
+ const entries = useMemo(
126
+ () => (block.kind === 'outcome' ? parseChildOutcomeNotice(block.body) : []),
127
+ [block],
128
+ );
129
+ const subtitle = useMemo(() => subtitleOf(block), [block]);
130
+ const failed = entries.some((entry) => entry.status !== 'completed');
131
+ const badgeClass =
132
+ block.kind === 'outcome'
133
+ ? failed
134
+ ? 'bg-error/10 text-error'
135
+ : 'bg-success/10 text-success'
136
+ : 'bg-ink/8 text-ink/70';
137
+ // The aggregate verdict is on the HEADER, not only inside the body: a
138
+ // collapsed card is the normal state, and "did my worker fail" must be
139
+ // answerable without opening it.
140
+ const aggregate = block.kind === 'outcome' && entries.length > 0
141
+ ? failed
142
+ ? STATUS_STYLE.failed
143
+ : STATUS_STYLE.completed
144
+ : null;
145
+
146
+ return (
147
+ <div className={`${transcriptGutter(isMobile)} text-[12px] text-ink select-text ${chrome.root}`}>
148
+ {/* The rail is drawn once per TURN by `TurnRail`; this block only places
149
+ its node, exactly as the notice card does. */}
150
+ {mode === 'trace' && <span aria-hidden="true" className={chrome.node} />}
151
+ <div className={chrome.frame || undefined}>
152
+ <button
153
+ type="button"
154
+ onClick={() => setOpen((prev) => !prev)}
155
+ aria-expanded={open}
156
+ className={`${chrome.header} cursor-pointer hover:bg-ink/[0.03] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ink/20`}
157
+ >
158
+ <span className={`${chrome.icon} ${badgeClass}`}>
159
+ <Icon size={13} />
160
+ </span>
161
+ <span className="flex min-w-0 flex-1 flex-col">
162
+ <span className="flex flex-wrap items-center gap-2">
163
+ <span className="truncate text-[12px] font-semibold tracking-tight text-ink">
164
+ {KIND_LABEL[block.kind]}
165
+ </span>
166
+ <span className="rounded bg-ink/5 px-1.5 py-0.2 font-mono text-[10px] text-ink/60">
167
+ Kabmo
168
+ </span>
169
+ {aggregate && (
170
+ <span className={`flex items-center gap-1 rounded px-1.5 py-0.2 font-mono text-[10px] font-semibold uppercase ${aggregate.badge}`}>
171
+ <aggregate.icon size={10} />
172
+ {aggregate.label}
173
+ </span>
174
+ )}
175
+ </span>
176
+ {!open && subtitle && (
177
+ <span className="truncate font-mono text-[10.5px] text-ink/45" title={subtitle}>
178
+ {subtitle}
179
+ </span>
180
+ )}
181
+ </span>
182
+ <ChevronDown
183
+ size={14}
184
+ className={`shrink-0 text-ink/35 transition-transform duration-200 ${open ? 'rotate-180' : ''}`}
185
+ />
186
+ </button>
187
+
188
+ {open && (
189
+ <div className={chrome.body}>
190
+ {block.kind === 'outcome' ? (
191
+ <div className="space-y-2">
192
+ {entries.length === 0 ? (
193
+ <p className="font-mono text-[11px] text-ink/60">No outcome recorded.</p>
194
+ ) : (
195
+ entries.map((entry) => (
196
+ <OutcomeEntry
197
+ key={entry.sessionId}
198
+ entry={entry}
199
+ showStatus={entries.length > 1}
200
+ />
201
+ ))
202
+ )}
203
+ </div>
204
+ ) : (
205
+ <div className="rounded-lg border border-ink/8 bg-paper p-3 text-[11.5px] leading-relaxed text-ink/85">
206
+ <MarkdownRenderer content={block.body} />
207
+ </div>
208
+ )}
209
+ </div>
210
+ )}
211
+ </div>
212
+ </div>
213
+ );
214
+ }
@@ -0,0 +1,126 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * A row Kabmo wrote must not read as a row a person wrote.
8
+ *
9
+ * Both halves are pinned through the rendered DOM, because the bug was a
10
+ * decision made at a call site: a delegating message is an orchestration
11
+ * contract PREPENDED to the operator's sentence, and a child outcome is a card
12
+ * with no operator text at all. Drawing either as a user bubble put Kabmo's own
13
+ * machinery — a shell heredoc, a worker report from a session nobody is looking
14
+ * at — in the mouth of the person reading the transcript.
15
+ *
16
+ * Rendered with `h()` against happy-dom, the same way the notice and gutter
17
+ * suites do.
18
+ */
19
+
20
+ import { afterAll, afterEach, beforeAll, describe, expect, test } from 'bun:test';
21
+ import { Window } from 'happy-dom';
22
+ import { h, render } from 'preact';
23
+ import { act } from 'preact/test-utils';
24
+ import { UserTurn } from '@/client/components/workspace/chat-timeline/UserTurn';
25
+ import {
26
+ ORCHESTRATION_CONTRACT,
27
+ WORKER_BRIEF,
28
+ renderChildOutcomeNotice,
29
+ } from '@/shared/lib/chat/orchestration/notice';
30
+ import type { ChatMessageData } from '@/shared/types';
31
+
32
+ const DOM_GLOBALS = ['window', 'document', 'navigator', 'Node', 'Element', 'HTMLElement', 'Event'] as const;
33
+ const nativeGlobals: Partial<Record<(typeof DOM_GLOBALS)[number], unknown>> = {};
34
+
35
+ beforeAll(() => {
36
+ const win = new Window({ url: 'http://localhost' });
37
+ const target = globalThis as unknown as Record<string, unknown>;
38
+ for (const key of DOM_GLOBALS) {
39
+ if (!(key in nativeGlobals)) nativeGlobals[key] = target[key];
40
+ target[key] = (win as unknown as Record<string, unknown>)[key];
41
+ }
42
+ });
43
+
44
+ afterAll(() => {
45
+ const target = globalThis as unknown as Record<string, unknown>;
46
+ for (const key of DOM_GLOBALS) {
47
+ if (nativeGlobals[key] === undefined) delete target[key];
48
+ else target[key] = nativeGlobals[key];
49
+ }
50
+ });
51
+
52
+ let container: HTMLElement | null = null;
53
+
54
+ afterEach(() => {
55
+ if (container) {
56
+ act(() => render(null, container as HTMLElement));
57
+ container.remove();
58
+ container = null;
59
+ }
60
+ });
61
+
62
+ function mount(content: string): HTMLElement {
63
+ container = document.body.appendChild(document.createElement('div'));
64
+ const msg = { id: 'm1', role: 'user', content } as ChatMessageData;
65
+ act(() =>
66
+ render(
67
+ h(UserTurn, {
68
+ msg,
69
+ content,
70
+ isMobile: false,
71
+ userActions: true,
72
+ canFork: false,
73
+ className: '',
74
+ }),
75
+ container as HTMLElement,
76
+ ),
77
+ );
78
+ return container;
79
+ }
80
+
81
+ describe('an injected prompt renders as a card, not a bubble', () => {
82
+ test('a child outcome has no operator bubble at all', () => {
83
+ const root = mount(
84
+ renderChildOutcomeNotice([
85
+ { sessionId: 'c1', status: 'failed', failure: '400 The model is unavailable.' },
86
+ ]),
87
+ );
88
+ const text = root.textContent ?? '';
89
+ expect(text).toContain('Worker outcome');
90
+ expect(text).toContain('Failed');
91
+ // The card's subtitle names the worker; no bubble and no toolbar, because
92
+ // the operator wrote none of this row.
93
+ expect(root.querySelector('button[aria-label="Undo this message"]')).toBeNull();
94
+ });
95
+
96
+ test('the operator keeps their own words beside the contract', () => {
97
+ const content = [
98
+ ORCHESTRATION_CONTRACT.open,
99
+ 'You are the orchestrator for this message.',
100
+ ORCHESTRATION_CONTRACT.close,
101
+ '',
102
+ 'koordinasikan timnya',
103
+ ].join('\n');
104
+ const root = mount(content);
105
+ const text = root.textContent ?? '';
106
+ expect(text).toContain('Orchestration');
107
+ expect(text).toContain('koordinasikan timnya');
108
+ // The contract's own instructions never become the visible bubble text.
109
+ expect(root.innerHTML).not.toContain('You are the orchestrator for this message.');
110
+ });
111
+
112
+ test('a worker brief is one card and never a bubble', () => {
113
+ const root = mount(
114
+ `${WORKER_BRIEF.open}\nYou are session c1.\n\nTASK\ncheck the log\n${WORKER_BRIEF.close}`,
115
+ );
116
+ expect(root.textContent).toContain('Dispatched worker');
117
+ expect(root.querySelector('button[aria-label="Undo this message"]')).toBeNull();
118
+ });
119
+
120
+ test('an ordinary user message keeps its bubble and its toolbar', () => {
121
+ const root = mount('just fix the test please');
122
+ const text = root.textContent ?? '';
123
+ expect(text).toContain('just fix the test please');
124
+ expect(root.querySelector('button[aria-label="Undo this message"]')).not.toBeNull();
125
+ });
126
+ });