@kabmo-labs/kabmo 0.41.0 → 0.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (305) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +533 -518
  3. package/dist/client/static/js/{CsvGrid-60njj97j.js → CsvGrid-20k047ht.js} +2 -2
  4. package/dist/client/static/js/{DocxView-rsv0j46a.js → DocxView-qpvhfcmg.js} +5 -5
  5. package/dist/client/static/js/{DrawioView-n2g5df3a.js → DrawioView-178skky8.js} +2 -2
  6. package/dist/client/static/js/ImageView-460th5qa.js +1 -0
  7. package/dist/client/static/js/LayoutWrapper-5cv0dty8.js +2 -0
  8. package/dist/client/static/js/Modal-wks6p4r5.js +38 -0
  9. package/dist/client/static/js/{PdfView-1r7a0qkp.js → PdfView-y51g03nr.js} +1 -1
  10. package/dist/client/static/js/SessionsView-rsmvn7ks.js +1 -0
  11. package/dist/client/static/js/{SheetView-bt5pp042.js → SheetView-z7yvb05v.js} +25 -25
  12. package/dist/client/static/js/{SvgPreview-vfmqgmrx.js → SvgPreview-yehgzhem.js} +1 -1
  13. package/dist/client/static/js/{abnfDiagram-O67JEVCF-8k5hk1yx.js → abnfDiagram-O67JEVCF-6zxpcy8b.js} +1 -1
  14. package/dist/client/static/js/architecture-7GRP2DOG-9q06651f.js +1 -0
  15. package/dist/client/static/js/architectureDiagram-NJMV4G6O-m98sgh3c.js +36 -0
  16. package/dist/client/static/js/{astro-0rh34hha.js → astro-nn7xg0we.js} +1 -1
  17. package/dist/client/static/js/bash-fjzhxy10.js +1 -0
  18. package/dist/client/static/js/{blockDiagram-BEXU5L5S-04sbtdth.js → blockDiagram-BEXU5L5S-cp7rervg.js} +5 -5
  19. package/dist/client/static/js/c-wqtyezvw.js +1 -0
  20. package/dist/client/static/js/c4Diagram-YGBWAQC7-t31recqm.js +38 -0
  21. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-18cc0bsb.js → classDiagram-v2-NBCMYWYE-fy8x3dkx.js} +5 -5
  22. package/dist/client/static/js/{cose-bilkent-JH36ORCC-dk683zvp.js → cose-bilkent-JH36ORCC-va7ybm9e.js} +1 -1
  23. package/dist/client/static/js/cpp-y0nzwner.js +1 -0
  24. package/dist/client/static/js/css-a13jmmnc.js +1 -0
  25. package/dist/client/static/js/css-n2waj098.js +1 -0
  26. package/dist/client/static/js/cynefin-OW5HDTMX-w7a38g4g.js +1 -0
  27. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-m2sx8d8s.js → cynefinDiagram-VND7K2PF-4k0k429c.js} +2 -2
  28. package/dist/client/static/js/{dagre-6A5THRUB-qf3pr59p.js → dagre-6A5THRUB-ykdhxq6t.js} +2 -2
  29. package/dist/client/static/js/{diagram-22UHCM2B-twnz23mt.js → diagram-22UHCM2B-5nvwx7b6.js} +8 -8
  30. package/dist/client/static/js/{diagram-3UASUU5V-417bas6t.js → diagram-3UASUU5V-hc7zsjgw.js} +1 -1
  31. package/dist/client/static/js/diagram-ATOU4E4O-97ae07y7.js +3 -0
  32. package/dist/client/static/js/diagram-CDSNMT55-b56nnbbs.js +30 -0
  33. package/dist/client/static/js/{diagram-MLGK6HIB-7a0h1hs3.js → diagram-MLGK6HIB-37rygr9k.js} +1 -1
  34. package/dist/client/static/js/{diagram-MPIPVDR6-w75bftmd.js → diagram-MPIPVDR6-wv3vhhfk.js} +2 -2
  35. package/dist/client/static/js/{dockerfile-g5qbaeq3.js → dockerfile-0efb1z6e.js} +1 -1
  36. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-vdzm3tsv.js → ebnfDiagram-ZINNZB2B-13fv7vxg.js} +1 -1
  37. package/dist/client/static/js/{elixir-gpez1k9m.js → elixir-mabagxwa.js} +1 -1
  38. package/dist/client/static/js/{elk-276RUBZZ-2fsbb484.js → elk-276RUBZZ-xam60ktz.js} +1 -1
  39. package/dist/client/static/js/{erDiagram-OPXOYQCR-vnkztq7d.js → erDiagram-OPXOYQCR-24ctv2ee.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-6wrjccyw.js +1 -0
  42. package/dist/client/static/js/flowDiagram-KWPJA3E3-19vjkg84.js +1 -0
  43. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-pbvcch52.js → ganttDiagram-FUAMR5RP-766a8fqw.js} +2 -2
  44. package/dist/client/static/js/gitGraph-4MIJSDKK-4je2p50v.js +1 -0
  45. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-dkvktvzr.js → gitGraphDiagram-X574FWY7-fmwjkgh6.js} +2 -2
  46. package/dist/client/static/js/graphql-gvb7e2eb.js +1 -0
  47. package/dist/client/static/js/html-bwyt0ayy.js +1 -0
  48. package/dist/client/static/js/{index-rc8wrs2a.js → index-03pyvmcz.js} +2 -2
  49. package/dist/client/static/js/index-13dr1t1r.js +314 -0
  50. package/dist/client/static/js/{index-rebnv57p.js → index-13xbwcbz.js} +2 -2
  51. package/dist/client/static/js/{index-pbsm2vw7.js → index-1c0pnsjd.js} +2 -2
  52. package/dist/client/static/js/index-1rxa9zxp.js +1 -0
  53. package/dist/client/static/js/{index-c6kx7s6a.js → index-2hpy58d0.js} +2 -2
  54. package/dist/client/static/js/{index-f8pq132s.js → index-2x9eqztp.js} +1 -1
  55. package/dist/client/static/js/{index-pn91shfp.js → index-4cncqz8j.js} +2 -2
  56. package/dist/client/static/js/index-4j8rgr4p.js +1 -0
  57. package/dist/client/static/js/{index-x2kb1kx5.js → index-4mstdh41.js} +3 -3
  58. package/dist/client/static/js/index-4z4ax55k.js +12 -0
  59. package/dist/client/static/js/{index-55hq7tnj.js → index-6ge6gk9w.js} +1 -1
  60. package/dist/client/static/js/{index-re1xz433.js → index-7t63akyt.js} +1 -1
  61. package/dist/client/static/js/{index-zye9309h.js → index-8b3t2y77.js} +2 -2
  62. package/dist/client/static/js/index-8hgm0abr.js +474 -0
  63. package/dist/client/static/js/index-8jqawh3r.js +2 -0
  64. package/dist/client/static/js/index-95en3p3g.js +9 -0
  65. package/dist/client/static/js/{index-rdqn92tc.js → index-97qst4k9.js} +2 -2
  66. package/dist/client/static/js/{index-xfa5hswh.js → index-9vdbnvmk.js} +1 -1
  67. package/dist/client/static/js/{index-zfykeg7x.js → index-a9t9gdew.js} +9 -9
  68. package/dist/client/static/js/{index-ds6a2cx7.js → index-b4y5g48d.js} +5 -5
  69. package/dist/client/static/js/{index-hz177dr2.js → index-czagykbq.js} +2 -2
  70. package/dist/client/static/js/{index-yq9vnd1y.js → index-dfqmwm7j.js} +2 -2
  71. package/dist/client/static/js/{index-tgper3yy.js → index-dydwcp3n.js} +2 -2
  72. package/dist/client/static/js/{index-0c6vpk89.js → index-e1yz59fa.js} +2 -2
  73. package/dist/client/static/js/{index-ce4vytm6.js → index-e6any867.js} +2 -2
  74. package/dist/client/static/js/{index-j5ram1ve.js → index-ejdnjh5c.js} +2 -2
  75. package/dist/client/static/js/index-f4vr1c6e.css +1 -0
  76. package/dist/client/static/js/{index-cytks03p.js → index-feffxxss.js} +2 -2
  77. package/dist/client/static/js/{index-6fx2t6y7.js → index-grczkttn.js} +12 -12
  78. package/dist/client/static/js/{index-s78n0dtv.js → index-hga3e13s.js} +2 -2
  79. package/dist/client/static/js/{index-ajjq0b8y.js → index-hw14rhen.js} +2 -2
  80. package/dist/client/static/js/index-hzwr5fm9.js +4 -0
  81. package/dist/client/static/js/{index-sj4y8kj2.js → index-j17h4z6f.js} +2 -2
  82. package/dist/client/static/js/{index-a4ed3mks.js → index-ka2rc2cr.js} +5 -5
  83. package/dist/client/static/js/{index-djv15k5s.js → index-ktbrmp29.js} +2 -2
  84. package/dist/client/static/js/{index-3rymer2w.js → index-nbexks3x.js} +1 -1
  85. package/dist/client/static/js/{index-ngk9h0v9.js → index-nh29fkk9.js} +2 -2
  86. package/dist/client/static/js/{index-gn92c6hp.js → index-p0ez6hqd.js} +2 -2
  87. package/dist/client/static/js/{index-e7yf273s.js → index-pkes9492.js} +2 -2
  88. package/dist/client/static/js/{index-fg965t62.js → index-pysqpc5n.js} +2 -2
  89. package/dist/client/static/js/index-qj34r6d0.js +1 -0
  90. package/dist/client/static/js/{index-ntcqyqd5.js → index-qx6x4z0y.js} +2 -2
  91. package/dist/client/static/js/{index-agdbjh5k.js → index-r8cc80w5.js} +2 -2
  92. package/dist/client/static/js/{index-9dnkfpx4.js → index-rab39785.js} +2 -2
  93. package/dist/client/static/js/{index-haaz8t7e.js → index-sk9ej289.js} +2 -2
  94. package/dist/client/static/js/{index-9fnzcg2x.js → index-sq3r1xhf.js} +2 -2
  95. package/dist/client/static/js/{index-pfbyfab5.js → index-sx809d6d.js} +2 -2
  96. package/dist/client/static/js/{index-7w3gqw2b.js → index-sz3mxjvy.js} +1 -1
  97. package/dist/client/static/js/{index-4jk8ngjg.js → index-tqycj126.js} +2 -2
  98. package/dist/client/static/js/{index-0xaz2eyv.js → index-vcn1kcpy.js} +3 -3
  99. package/dist/client/static/js/{index-2z9wrb46.js → index-x7f5ysch.js} +2 -2
  100. package/dist/client/static/js/index-xe5cqwnf.js +1 -0
  101. package/dist/client/static/js/index-xxe52zrm.js +2 -0
  102. package/dist/client/static/js/{index-amawahyh.js → index-yvxa7hd8.js} +2 -2
  103. package/dist/client/static/js/{index-e6qjfcz9.js → index-z6kpc98a.js} +1 -1
  104. package/dist/client/static/js/{index-yzg9mbsv.js → index-zjydzxhm.js} +1 -1
  105. package/dist/client/static/js/{index-ne131hmw.js → index-zvazj4va.js} +2 -2
  106. package/dist/client/static/js/info-A6RAGUB7-k0z5qdew.js +1 -0
  107. package/dist/client/static/js/{infoDiagram-VRGFBTTK-mh6yks62.js → infoDiagram-VRGFBTTK-tqytmzp1.js} +1 -1
  108. package/dist/client/static/js/ini-2gvjwh83.js +1 -0
  109. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-hnfqppnv.js → ishikawaDiagram-OU5B5YK6-rp77ff6m.js} +1 -1
  110. package/dist/client/static/js/java-1xwcq79s.js +1 -0
  111. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-s4nv1f3q.js → journeyDiagram-ZHPQQLJL-c7bxrhf1.js} +2 -2
  112. package/dist/client/static/js/json-4pqjabgq.js +1 -0
  113. package/dist/client/static/js/jsx-wcsss15s.js +1 -0
  114. package/dist/client/static/js/{julia-yre4bxb9.js → julia-2eekpjq8.js} +1 -1
  115. package/dist/client/static/js/{kanban-definition-PNTS6WVX-t8kbfefp.js → kanban-definition-PNTS6WVX-j2pxewqq.js} +5 -5
  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-cqqe1krg.js} +6 -6
  119. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-swkkze8c.js → mindmap-definition-NLK3R4M7-s03k32p9.js} +5 -5
  120. package/dist/client/static/js/one-dark-pro-9tt0a020.js +1 -0
  121. package/dist/client/static/js/one-light-5fg4r0ra.js +1 -0
  122. package/dist/client/static/js/packet-AYTQ26CC-6cnvmb2z.js +1 -0
  123. package/dist/client/static/js/{pegDiagram-GJSIUBJH-jqayzh7z.js → pegDiagram-GJSIUBJH-dfg2j0zc.js} +1 -1
  124. package/dist/client/static/js/{perl-weeskn1v.js → perl-5vxax0nr.js} +1 -1
  125. package/dist/client/static/js/{php-vf3045p9.js → php-hgrgdq63.js} +1 -1
  126. package/dist/client/static/js/pie-WAS4IAKB-m9z1mztn.js +1 -0
  127. package/dist/client/static/js/{pieDiagram-5QR66LMP-w03a65ky.js → pieDiagram-5QR66LMP-pshd1j79.js} +1 -1
  128. package/dist/client/static/js/properties-ymexza6q.js +1 -0
  129. package/dist/client/static/js/python-31ycwa66.js +1 -0
  130. package/dist/client/static/js/{quadrantDiagram-O4NWA36T-2j7sfa9s.js → quadrantDiagram-O4NWA36T-cvvvmtk2.js} +4 -4
  131. package/dist/client/static/js/r-t2nne4xp.js +1 -0
  132. package/dist/client/static/js/radar-RG4KPBEZ-8m9rkex6.js +1 -0
  133. package/dist/client/static/js/railroad-74A4TZTK-wc55emj8.js +1 -0
  134. package/dist/client/static/js/railroad-abnf-HS5TGJTU-2y2rnrzq.js +1 -0
  135. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-zzcc9x0v.js +1 -0
  136. package/dist/client/static/js/railroad-peg-WCYAUIDC-z82na5nb.js +1 -0
  137. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-jtkkgy34.js → railroadDiagram-XR7U4H2S-h53p3sha.js} +1 -1
  138. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-t85ckjdb.js → requirementDiagram-PLB6GJNP-bdv2fkxd.js} +4 -4
  139. package/dist/client/static/js/{ruby-1a2ryzy6.js → ruby-8pxcn21w.js} +1 -1
  140. package/dist/client/static/js/{rust-736r0f0v.js → rust-j80dxgjg.js} +1 -1
  141. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-5pfkw8ne.js → sankeyDiagram-IPEJSGJF-xqnnvmhy.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-3p67305f.js} +10 -10
  145. package/dist/client/static/js/{sizeCapture-INFHLROL-pzqqd7f4.js → sizeCapture-INFHLROL-f87525h7.js} +1 -1
  146. package/dist/client/static/js/sql-bwnasywx.js +1 -0
  147. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-6nhrph8n.js → stateDiagram-v2-GCMORJYK-e5st1fy3.js} +6 -6
  148. package/dist/client/static/js/{svelte-0hv6pak2.js → svelte-ztkaww47.js} +1 -1
  149. package/dist/client/static/js/{swimlanes-2SLR337P-6tcnxfbv.js → swimlanes-2SLR337P-ceghkbez.js} +1 -1
  150. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-vc8hvfya.js +8 -0
  151. package/dist/client/static/js/{timeline-definition-EJHVYXUP-1dz46nt5.js → timeline-definition-EJHVYXUP-f7evs443.js} +2 -2
  152. package/dist/client/static/js/treeView-Q6P3EWNA-kzh6cm3f.js +1 -0
  153. package/dist/client/static/js/treemap-WGGIJYW6-wz5ed560.js +1 -0
  154. package/dist/client/static/js/tsx-zfy727zs.js +1 -0
  155. package/dist/client/static/js/typescript-p3syh43m.js +1 -0
  156. package/dist/client/static/js/{usecaseDiagram-POWQR4AR-b3jfveq6.js → usecaseDiagram-POWQR4AR-0gpn21p7.js} +27 -27
  157. package/dist/client/static/js/{vennDiagram-UO4OBE2U-dnc3jqvp.js → vennDiagram-UO4OBE2U-4spzy428.js} +1 -1
  158. package/dist/client/static/js/{vue-zccj3qa5.js → vue-xm1dxpmy.js} +1 -1
  159. package/dist/client/static/js/wardley-WFR3VGLG-zewbfccz.js +1 -0
  160. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-466m8400.js → wardleyDiagram-VNRHLVJA-745xr2pa.js} +4 -4
  161. package/dist/client/static/js/xml-4enq788a.js +1 -0
  162. package/dist/client/static/js/xychartDiagram-PMCCYNJV-7dr9qwx5.js +7 -0
  163. package/dist/client/static/js/yaml-pjtt3jsc.js +1 -0
  164. package/package.json +1 -1
  165. package/src/client/components/common/batch-selection/folder-state.ts +2 -2
  166. package/src/client/components/common/server-control/Panel.tsx +16 -5
  167. package/src/client/components/common/server-control/index.test.tsx +63 -9
  168. package/src/client/components/common/session-row/TrailingSlot.tsx +8 -0
  169. package/src/client/components/common/session-row/index.tsx +16 -9
  170. package/src/client/components/layout/session-sidebar/CategoryItem.tsx +1 -1
  171. package/src/client/components/layout/session-sidebar/ClassicView.tsx +13 -0
  172. package/src/client/components/layout/session-sidebar/HarnessFilter.tsx +175 -0
  173. package/src/client/components/layout/session-sidebar/SessionList.tsx +9 -1
  174. package/src/client/components/layout/session-sidebar/SessionsView.tsx +6 -0
  175. package/src/client/components/layout/session-sidebar/harness-filter.test.tsx +173 -0
  176. package/src/client/components/layout/session-sidebar/modern/FilterChips.tsx +63 -18
  177. package/src/client/components/layout/session-sidebar/modern/SearchField.tsx +1 -1
  178. package/src/client/components/layout/session-sidebar/modern/WorkspaceHeader.tsx +21 -12
  179. package/src/client/components/layout/session-sidebar/modern/WorkspaceSection.tsx +1 -1
  180. package/src/client/components/layout/session-sidebar/modern/index.tsx +11 -2
  181. package/src/client/components/layout/session-sidebar/modern/search-field.test.tsx +96 -0
  182. package/src/client/components/layout/session-sidebar/session-list-states.test.tsx +3 -0
  183. package/src/client/components/layout/session-sidebar/variant-props.ts +7 -0
  184. package/src/client/components/mobile/SessionSidebar.tsx +14 -25
  185. package/src/client/components/mobile/mobile-session-sidebar/ClassicDrawer.tsx +19 -0
  186. package/src/client/components/mobile/mobile-session-sidebar/Item.tsx +1 -1
  187. package/src/client/components/settings/categories/omp-settings/EngineHeader.tsx +1 -1
  188. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.image.test.ts +147 -0
  189. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.test.ts +51 -83
  190. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.tsx +44 -63
  191. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/ReadDirectory.tsx +72 -0
  192. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/ReadImage.tsx +51 -0
  193. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/read-test-util.ts +91 -0
  194. package/src/client/components/workspace/git-panel/commit-modal/CommitRow.test.ts +80 -62
  195. package/src/client/components/workspace/git-panel/commit-modal/CommitRow.tsx +15 -33
  196. package/src/client/components/workspace/git-panel/commit-modal/Header.tsx +1 -1
  197. package/src/client/components/workspace/terminal-panel/copy.test.ts +179 -0
  198. package/src/client/components/workspace/terminal-panel/copy.ts +76 -0
  199. package/src/client/components/workspace/terminal-panel/mount.ts +13 -0
  200. package/src/client/data/settings/omp-schema.json +39 -18
  201. package/src/client/hooks/chat/omp/pending-child.test.ts +1 -1
  202. package/src/client/hooks/chat/omp/session-sidebar-controller.test.ts +61 -0
  203. package/src/client/hooks/chat/omp/session-sidebar-controller.ts +37 -39
  204. package/src/client/hooks/chat/omp/sidebar-filter.ts +62 -0
  205. package/src/client/hooks/chat/timeline/session-changes.test.ts +85 -0
  206. package/src/client/hooks/chat/timeline/session-changes.ts +8 -5
  207. package/src/client/hooks/shell/servers.ts +60 -2
  208. package/src/client/hooks/ui/updates/mobile-flow.ts +56 -0
  209. package/src/client/tailwind.css +58 -0
  210. package/src/server/lib/harness/acp/commands.test.ts +1 -0
  211. package/src/server/lib/harness/acp/commands.ts +12 -4
  212. package/src/server/lib/harness/acp/replay-transcript.ts +32 -13
  213. package/src/server/lib/harness/acp/session-transcript.server.test.ts +162 -0
  214. package/src/server/lib/harness/acp/session-transcript.server.ts +350 -0
  215. package/src/server/lib/harness/acp/session.ts +6 -1
  216. package/src/server/lib/harness/schema.server.ts +18 -0
  217. package/src/server/lib/harness/spawn.server.ts +14 -1
  218. package/src/server/lib/models/provider-icon-fetch.ts +2 -2
  219. package/src/server/lib/models/provider-icon-parse.test.ts +0 -12
  220. package/src/server/lib/models/provider-icon-parse.ts +0 -8
  221. package/src/server/lib/omp/rpc/frame-fold.test.ts +16 -1
  222. package/src/server/lib/omp/rpc/frame-fold.ts +17 -4
  223. package/src/server/lib/omp/session/blobs.server.test.ts +34 -0
  224. package/src/server/lib/omp/session/blobs.server.ts +8 -3
  225. package/src/server/lib/omp/session/delete.server.ts +4 -0
  226. package/src/server/lib/omp/session/sidebar-activity.server.test.ts +2 -1
  227. package/src/server/routes/agent/harness-command.test.ts +71 -0
  228. package/src/server/routes/agent/harness-command.ts +27 -13
  229. package/src/server/routes/chat/imported.ts +5 -2
  230. package/src/server/routes/chat/live-meta.ts +42 -0
  231. package/src/server/routes/chat/session.test.ts +110 -0
  232. package/src/server/routes/chat/session.ts +31 -34
  233. package/src/shared/lib/chat/transcript-rows.ts +22 -0
  234. package/src/shared/lib/fs/file-kind.test.ts +46 -3
  235. package/src/shared/lib/fs/file-kind.ts +40 -9
  236. package/src/shared/lib/omp/config/schema-releases.test.ts +29 -0
  237. package/src/shared/lib/workspace/harness-filter.test.ts +89 -0
  238. package/src/shared/lib/workspace/harness-filter.ts +75 -0
  239. package/src/{client/lib → shared/lib/workspace}/session-tree.test.ts +1 -1
  240. package/src/shared/lib/workspace/session-visibility.test.ts +71 -0
  241. package/src/shared/lib/workspace/session-visibility.ts +48 -23
  242. package/src/shared/lib/workspace/sidebar-filter-row.test.ts +64 -23
  243. package/src/shared/lib/workspace/sidebar-filter-row.ts +89 -31
  244. package/dist/client/static/js/ImageView-t330jx6y.js +0 -1
  245. package/dist/client/static/js/LayoutWrapper-qp6nsw65.js +0 -2
  246. package/dist/client/static/js/Modal-sbya4ahp.js +0 -38
  247. package/dist/client/static/js/SessionsView-yqs5m8tj.js +0 -1
  248. package/dist/client/static/js/architecture-7GRP2DOG-1wqga929.js +0 -1
  249. package/dist/client/static/js/architectureDiagram-NJMV4G6O-7jcb7fgy.js +0 -36
  250. package/dist/client/static/js/bash-vv2ysp0a.js +0 -1
  251. package/dist/client/static/js/c-67jyc7sg.js +0 -1
  252. package/dist/client/static/js/c4Diagram-YGBWAQC7-vwac9za0.js +0 -38
  253. package/dist/client/static/js/cpp-crfbnwv8.js +0 -1
  254. package/dist/client/static/js/css-2re5mbea.js +0 -1
  255. package/dist/client/static/js/css-983fbv00.js +0 -1
  256. package/dist/client/static/js/cynefin-OW5HDTMX-j2dpdgkh.js +0 -1
  257. package/dist/client/static/js/diagram-ATOU4E4O-n63cpdnx.js +0 -3
  258. package/dist/client/static/js/diagram-CDSNMT55-v86p14dd.js +0 -30
  259. package/dist/client/static/js/eventmodeling-NTZA5JFV-xjvjawd3.js +0 -1
  260. package/dist/client/static/js/flowDiagram-KWPJA3E3-j21f2bfg.js +0 -1
  261. package/dist/client/static/js/gitGraph-4MIJSDKK-r0zbk95f.js +0 -1
  262. package/dist/client/static/js/graphql-npbd9fdx.js +0 -1
  263. package/dist/client/static/js/html-1cpe2xc8.js +0 -1
  264. package/dist/client/static/js/index-1sw00wm0.js +0 -2
  265. package/dist/client/static/js/index-7fwppdkn.js +0 -1
  266. package/dist/client/static/js/index-ae91g8ka.js +0 -9
  267. package/dist/client/static/js/index-b6cyn4hr.js +0 -314
  268. package/dist/client/static/js/index-efn233xp.js +0 -4
  269. package/dist/client/static/js/index-esx3zwnt.js +0 -1
  270. package/dist/client/static/js/index-fbbp5cwj.js +0 -2
  271. package/dist/client/static/js/index-g1cggqgx.js +0 -12
  272. package/dist/client/static/js/index-ghsdzs4m.js +0 -1
  273. package/dist/client/static/js/index-gs7ytgdw.js +0 -474
  274. package/dist/client/static/js/index-jqs23cc7.css +0 -1
  275. package/dist/client/static/js/index-qjsy6p86.js +0 -1
  276. package/dist/client/static/js/info-A6RAGUB7-a8xap43w.js +0 -1
  277. package/dist/client/static/js/ini-df5bw23e.js +0 -1
  278. package/dist/client/static/js/java-8j33rj1p.js +0 -1
  279. package/dist/client/static/js/json-g5ggnd94.js +0 -1
  280. package/dist/client/static/js/jsx-f6p72qpc.js +0 -1
  281. package/dist/client/static/js/lua-bahx6qze.js +0 -1
  282. package/dist/client/static/js/markdown-9dhg1fax.js +0 -1
  283. package/dist/client/static/js/one-dark-pro-h5tmw145.js +0 -1
  284. package/dist/client/static/js/one-light-x7vj1pxr.js +0 -1
  285. package/dist/client/static/js/packet-AYTQ26CC-b5bvg6v1.js +0 -1
  286. package/dist/client/static/js/pie-WAS4IAKB-77ee73zg.js +0 -1
  287. package/dist/client/static/js/properties-49mfnee4.js +0 -1
  288. package/dist/client/static/js/python-qb69wp1s.js +0 -1
  289. package/dist/client/static/js/r-s3mf2tch.js +0 -1
  290. package/dist/client/static/js/radar-RG4KPBEZ-cp79xtvb.js +0 -1
  291. package/dist/client/static/js/railroad-74A4TZTK-dcpgqhcb.js +0 -1
  292. package/dist/client/static/js/railroad-abnf-HS5TGJTU-qasqv686.js +0 -1
  293. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-e46908rd.js +0 -1
  294. package/dist/client/static/js/railroad-peg-WCYAUIDC-7009t6bk.js +0 -1
  295. package/dist/client/static/js/sql-aczp05f2.js +0 -1
  296. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-7xrkrkpa.js +0 -8
  297. package/dist/client/static/js/treeView-Q6P3EWNA-tpn62q8j.js +0 -1
  298. package/dist/client/static/js/treemap-WGGIJYW6-w910f1g4.js +0 -1
  299. package/dist/client/static/js/tsx-s1shkfg9.js +0 -1
  300. package/dist/client/static/js/typescript-htx9v6bf.js +0 -1
  301. package/dist/client/static/js/wardley-WFR3VGLG-pt9tq808.js +0 -1
  302. package/dist/client/static/js/xml-wr1dxav5.js +0 -1
  303. package/dist/client/static/js/xychartDiagram-PMCCYNJV-kryrpqp1.js +0 -7
  304. package/dist/client/static/js/yaml-0y9fdskg.js +0 -1
  305. /package/src/{client/lib → shared/lib/workspace}/session-tree.ts +0 -0
@@ -0,0 +1,62 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The sidebar's row filters, as pure functions.
8
+ *
9
+ * Extracted from the controller so the controller stays a wiring module: the
10
+ * search rule is the one with a subtle branch (the desktop force-expands a
11
+ * match, the phone does not), and it is easier to read — and to test — beside
12
+ * the harness rule than inside a 300-line hook.
13
+ */
14
+
15
+ import type { WorkspaceFolderData } from '@/shared/types';
16
+
17
+ /**
18
+ * Narrow the list to what the query names.
19
+ *
20
+ * A session matches on its title OR its id: the id is what "Copy session ID"
21
+ * puts on the clipboard, and a search that could not find the string it just
22
+ * handed the user would be a dead end.
23
+ *
24
+ * `expandMatches` is the desktop's rule — a folder whose NAME matched keeps all
25
+ * its rows and opens, because the user asked for the workspace. The phone
26
+ * filters without expanding and drops a folder that has nothing left to show.
27
+ */
28
+ export function filterFoldersBySearch(
29
+ folders: readonly WorkspaceFolderData[],
30
+ query: string,
31
+ expandMatches: boolean,
32
+ ): WorkspaceFolderData[] {
33
+ if (!query.trim()) return folders as WorkspaceFolderData[];
34
+ const q = query.toLowerCase();
35
+ const matchesSession = (session: { id: number | string; title: string }) =>
36
+ session.title.toLowerCase().includes(q) || String(session.id).toLowerCase().includes(q);
37
+
38
+ if (expandMatches) {
39
+ return folders
40
+ .filter((folder) => {
41
+ const matchFolder = folder.name.toLowerCase().includes(q);
42
+ const matchSession = folder.sessions?.some(matchesSession);
43
+ return matchFolder || matchSession;
44
+ })
45
+ .map((folder) => {
46
+ // If we are searching, we also filter the sessions within the folder
47
+ const filteredSessions = folder.sessions?.filter((session) =>
48
+ folder.name.toLowerCase().includes(q) || matchesSession(session)
49
+ );
50
+ return { ...folder, sessions: filteredSessions, isExpanded: true };
51
+ });
52
+ }
53
+
54
+ return folders
55
+ .map((folder) => {
56
+ const matchesFolderName = folder.name.toLowerCase().includes(q);
57
+ const filteredSessions = (folder.sessions || []).filter(matchesSession);
58
+ if (matchesFolderName) return folder;
59
+ return { ...folder, sessions: filteredSessions };
60
+ })
61
+ .filter((folder) => folder.sessions && folder.sessions.length > 0);
62
+ }
@@ -0,0 +1,85 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The change list's read timing.
8
+ *
9
+ * A reader who opens a LIVE session must still see the settled runs' file
10
+ * lists. The hook used to skip the read while `isGenerating`, so a session
11
+ * opened mid-run showed no changes section at all — even though the journal
12
+ * already held every earlier run. The mid-run read is safe: the current run's
13
+ * partial records are bucketed into a run whose footer is not rendered yet.
14
+ */
15
+
16
+ import { afterAll, afterEach, beforeAll, describe, expect, test } from 'bun:test';
17
+ import { Window } from 'happy-dom';
18
+ import { h, render } from 'preact';
19
+ import { act } from 'preact/test-utils';
20
+ import { useSessionChanges } from '@/client/hooks/chat/timeline/session-changes';
21
+ import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
22
+
23
+ let container: HTMLElement;
24
+ const mounted: HTMLElement[] = [];
25
+ let originalFetch: typeof fetch;
26
+
27
+ beforeAll(() => {
28
+ installDomGlobals(new Window({ url: 'http://localhost' }));
29
+ originalFetch = globalThis.fetch;
30
+ });
31
+
32
+ afterEach(() => {
33
+ for (const node of mounted.splice(0)) render(null, node);
34
+ globalThis.fetch = originalFetch;
35
+ });
36
+
37
+ afterAll(() => {
38
+ restoreDomGlobals();
39
+ });
40
+
41
+ function Probe({ sessionId, isGenerating }: { sessionId: string; isGenerating: boolean }) {
42
+ const records = useSessionChanges(sessionId, isGenerating);
43
+ return h('div', { 'data-count': String(records.length) });
44
+ }
45
+
46
+ describe('useSessionChanges', () => {
47
+ test('reads on mount even while generating, so settled runs show', async () => {
48
+ let calls = 0;
49
+ let release: (response: Response) => void = () => {};
50
+ const pending = new Promise<Response>((resolve) => {
51
+ release = resolve;
52
+ });
53
+ globalThis.fetch = (() => {
54
+ calls += 1;
55
+ return pending;
56
+ }) as unknown as typeof fetch;
57
+
58
+ container = document.createElement('div');
59
+ document.body.appendChild(container);
60
+ mounted.push(container);
61
+
62
+ await act(async () => {
63
+ render(h(Probe, { sessionId: 's1', isGenerating: true }), container);
64
+ });
65
+ expect(calls).toBe(1);
66
+
67
+ await act(async () => {
68
+ release(
69
+ new Response(
70
+ JSON.stringify({
71
+ records: [
72
+ { at: 1, agent: 'Main', tool: 'edit', path: '/repo/a.ts', displayPath: 'a.ts', before: 'a', after: 'b' },
73
+ ],
74
+ }),
75
+ { status: 200 },
76
+ ),
77
+ );
78
+ await pending;
79
+ // Let the hook's `res.json()` and `setRecords` run before the act flushes.
80
+ await new Promise((resolve) => setTimeout(resolve, 0));
81
+ });
82
+
83
+ expect(container.querySelector('div')?.getAttribute('data-count')).toBe('1');
84
+ });
85
+ });
@@ -6,10 +6,14 @@
6
6
  /**
7
7
  * The session's agent change journal, for the chat's per-run file list.
8
8
  *
9
- * Read once per settled run: the journal is written while the agent works, so
10
- * asking mid-run would show a partial list that then changes under the reader.
11
- * A failed read keeps the previous list — a transient 500 is not a reason to
12
- * blank a summary the reader is looking at.
9
+ * Read on mount and again when a run settles. The mid-run read is deliberate:
10
+ * the journal is written while the agent works, so the CURRENT run's records
11
+ * are partial — but the settled runs' records are complete, and a reader who
12
+ * opens a live session must still see their file lists. The current run's
13
+ * partial records are bucketed into a run whose footer is not rendered yet, so
14
+ * they do not show until the settle read. A failed read keeps the previous
15
+ * list — a transient 500 is not a reason to blank a summary the reader is
16
+ * looking at.
13
17
  */
14
18
 
15
19
  import { useEffect, useState } from 'preact/hooks';
@@ -31,7 +35,6 @@ export function useSessionChanges(
31
35
  setRecords([]);
32
36
  return;
33
37
  }
34
- if (isGenerating) return;
35
38
  let cancelled = false;
36
39
  void (async () => {
37
40
  try {
@@ -38,8 +38,13 @@ export interface ShellServersStore {
38
38
  state: ShellServersState | null;
39
39
  /** A request is in flight; the panel disables its controls rather than queueing. */
40
40
  busy: boolean;
41
+ /** A MANUAL refresh is in flight; the button spins. The 4-second poll does not. */
42
+ refreshing: boolean;
41
43
  error: string | null;
42
44
  reload: () => Promise<void>;
45
+ /** Re-read the list for the refresh button, with a visible spin. */
46
+ refresh: () => Promise<void>;
47
+ dismissError: () => void;
43
48
  activate: (id: string) => Promise<boolean>;
44
49
  add: (label: string, url: string) => Promise<boolean>;
45
50
  remove: (id: string) => Promise<boolean>;
@@ -58,16 +63,27 @@ export interface ShellServersStore {
58
63
  */
59
64
  const REFRESH_INTERVAL_MS = 4000;
60
65
 
66
+ /**
67
+ * How long the refresh button keeps spinning, at minimum.
68
+ *
69
+ * A local list answers in a few milliseconds, so a spin tied only to the request
70
+ * would be over before the eye caught it and the button would read as dead. The
71
+ * floor is feedback, not a delay: the read has already happened, and the button
72
+ * is disabled for exactly as long as it is drawn as working.
73
+ */
74
+ const MIN_REFRESH_MS = 400;
75
+
61
76
  export function useShellServers(open: boolean): ShellServersStore {
62
77
  const available = hasShellBridge();
63
78
  const [state, setState] = useState<ShellServersState | null>(null);
64
79
  const [busy, setBusy] = useState(false);
80
+ const [refreshing, setRefreshing] = useState(false);
65
81
  const [error, setError] = useState<string | null>(null);
66
82
  // A mutation and a poll can overlap; the poll must not overwrite the answer
67
83
  // the user's own click produced. The counter is what tells them apart.
68
84
  const mutationsRef = useRef(0);
69
85
 
70
- const reload = useCallback(async () => {
86
+ const read = useCallback(async () => {
71
87
  if (!available) return;
72
88
  const ticket = mutationsRef.current;
73
89
  try {
@@ -78,6 +94,27 @@ export function useShellServers(open: boolean): ShellServersStore {
78
94
  }
79
95
  }, [available]);
80
96
 
97
+ const reload = useCallback(() => read(), [read]);
98
+
99
+ const refresh = useCallback(async () => {
100
+ if (!available) return;
101
+ setRefreshing(true);
102
+ const started = Date.now();
103
+ try {
104
+ await read();
105
+ } finally {
106
+ const remaining = MIN_REFRESH_MS - (Date.now() - started);
107
+ if (remaining > 0) {
108
+ const { promise, resolve } = Promise.withResolvers<void>();
109
+ setTimeout(resolve, remaining);
110
+ await promise;
111
+ }
112
+ setRefreshing(false);
113
+ }
114
+ }, [available, read]);
115
+
116
+ const dismissError = useCallback(() => setError(null), []);
117
+
81
118
  const run = useCallback(
82
119
  async (action: () => Promise<ShellServersState>) => {
83
120
  mutationsRef.current += 1;
@@ -101,6 +138,13 @@ export function useShellServers(open: boolean): ShellServersStore {
101
138
  void reload();
102
139
  }, [available, reload]);
103
140
 
141
+ // The error belongs to the panel session that produced it. Closing the panel
142
+ // is the user saying they are done with it; keeping the sentence for the next
143
+ // open is how a failed Start left a warning on screen until the page reloaded.
144
+ useEffect(() => {
145
+ if (!open) setError(null);
146
+ }, [open]);
147
+
104
148
  useEffect(() => {
105
149
  if (!available || !open) return;
106
150
  const timer = setInterval(() => void reload(), REFRESH_INTERVAL_MS);
@@ -125,5 +169,19 @@ export function useShellServers(open: boolean): ShellServersStore {
125
169
 
126
170
  const stop = useCallback((id: string) => run(() => stopLocalServer(id)), [run]);
127
171
 
128
- return { available, state, busy, error, reload, activate, add, remove, start, stop };
172
+ return {
173
+ available,
174
+ state,
175
+ busy,
176
+ refreshing,
177
+ error,
178
+ reload,
179
+ refresh,
180
+ dismissError,
181
+ activate,
182
+ add,
183
+ remove,
184
+ start,
185
+ stop,
186
+ };
129
187
  }
@@ -0,0 +1,56 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The phone drawer's update flow: the popup's "Update now" handover, the native
8
+ * menu's check, and the shell offer the footer draws.
9
+ *
10
+ * Extracted from `MobileSessionSidebar` because that file is the drawer's
11
+ * dispatcher and sits at the repo's per-file ceiling; the flow is one cohesive
12
+ * unit (it owns `useUpdates` and every listener that acts on it), not a wrapper
13
+ * around a single call.
14
+ *
15
+ * The handover is the phone's own rule: the popup's "Update now" must bring the
16
+ * drawer forward, or the About modal opens over the chat while the user is
17
+ * still looking at the session list they came from.
18
+ */
19
+
20
+ import { useKabmoEvent } from '@/client/hooks/ui/window-event';
21
+ import { useUpdates, type UseUpdatesResult } from '@/client/hooks/ui/updates';
22
+ import { useUpdateCheckRequest } from '@/client/hooks/ui/updates/check-request';
23
+ import { useShellOffer, type ShellDownload } from '@/client/hooks/ui/updates/shell-download';
24
+ import { UPDATE_REQUEST_EVENT } from '@/shared/lib/updates/popup-state';
25
+ import { updateOutcomeTone, type ToastTone } from '@/shared/lib/ui/toast-duration';
26
+
27
+ export interface MobileUpdateFlow {
28
+ updates: UseUpdatesResult;
29
+ /** An update inside a native shell, an install on an Android browser, nothing
30
+ * elsewhere — see `useShellOffer`. */
31
+ shellDownload: ShellDownload | null;
32
+ }
33
+
34
+ export function useMobileUpdateFlow(args: {
35
+ /** Bring the drawer forward before the About modal opens. */
36
+ onClose: () => void;
37
+ openAbout: () => void;
38
+ pushToast: (message: string, type?: ToastTone) => void;
39
+ }): MobileUpdateFlow {
40
+ const updates = useUpdates();
41
+ const shellDownload = useShellOffer();
42
+
43
+ useKabmoEvent(UPDATE_REQUEST_EVENT, () => {
44
+ args.onClose();
45
+ args.openAbout();
46
+ void updates.apply('kabmo').then((result) => {
47
+ if (!result) return;
48
+ args.pushToast(result.message, updateOutcomeTone(result));
49
+ });
50
+ });
51
+
52
+ // The same native row as the desktop's: one check, one verdict, drawer stays.
53
+ useUpdateCheckRequest(updates, args.pushToast);
54
+
55
+ return { updates, shellDownload };
56
+ }
@@ -304,6 +304,35 @@
304
304
  }
305
305
  }
306
306
 
307
+ /* A search field that draws its own clear control must not also get the
308
+ * engine's.
309
+ *
310
+ * `type="search"` is the right input — Escape clears it and the platform
311
+ * exposes it as a searchbox — but WebKit and Blink paint
312
+ * `::-webkit-search-cancel-button` inside it. Measured in the session sidebar,
313
+ * that put the native X beside the app's own `Clear search` button: two clear
314
+ * controls, one of them unlabelled and unstyleable.
315
+ *
316
+ * The class is opt-in, not a global reset: a field with no clear control of its
317
+ * own (the plan filter) still needs the native one. `::-webkit-search-decoration`
318
+ * goes with it, because Safari draws the magnifier there on some versions and
319
+ * that would be a second glyph next to the field's own.
320
+ *
321
+ * `display: none` is the declaration that does the work, not
322
+ * `-webkit-appearance: none`: measured in WebKit with only the appearance reset,
323
+ * the button was still painted — the class changed nothing on screen until
324
+ * `display: none` was added. Both spellings stay so Blink, which honours the
325
+ * appearance reset alone, needs no second rule.
326
+ */
327
+ @layer components {
328
+ .kabmo-search-field::-webkit-search-cancel-button,
329
+ .kabmo-search-field::-webkit-search-decoration {
330
+ display: none;
331
+ -webkit-appearance: none;
332
+ appearance: none;
333
+ }
334
+ }
335
+
307
336
  /* FULL COLOUR MODE: on is GREEN, off is RED.
308
337
  *
309
338
  * The colour mode is the one place a user asks for chroma, so the checkbox
@@ -458,6 +487,35 @@
458
487
  overflow-y: auto;
459
488
  }
460
489
 
490
+ /* The session list's right inset, so its content edge is the action row's.
491
+ *
492
+ * The list is a scroller, and the app's scrollbar is 8px of LAYOUT
493
+ * (`--scrollbar-size`), not an overlay: `overflow-y: overlay` is gone from
494
+ * Chrome. The action row above it is not a scroller, so its content edge is
495
+ * `px-3` (12px) from the panel while the rows' was 8px of padding PLUS the
496
+ * 8px bar — 16px. Measured on the running app, the sort icon's centre sat 8px
497
+ * right of every row's `⋯` and of the age's right edge, which is the reported
498
+ * "titik tiga tidak lurus dengan sort".
499
+ *
500
+ * `overflow-y: scroll`, not `auto`: the bar must be reserved even when the
501
+ * list is short, or the rows jump 8px sideways the first time they need to
502
+ * scroll — and the sort icon would be off by 8px in exactly the state nobody
503
+ * screenshots. WebKit 27 (the desktop shell) advertises `scrollbar-gutter`
504
+ * but does NOT reserve it for a non-overflowing `auto` scroller (measured:
505
+ * `clientWidth == offsetWidth` with `stable` set; `scroll` gives the 8px), so
506
+ * the always-present bar is the only portable reservation. Its track and thumb
507
+ * are transparent at rest, so it paints nothing. This rule is declared after
508
+ * `.scrollbar-overlay-container`, whose `auto` it deliberately overrides.
509
+ *
510
+ * The padding is then the action row's 12px minus that reserved 8px. The
511
+ * row's own trailing inset (3px, half the box difference) finishes the
512
+ * alignment: sort glyph centre = row `⋯` centre = age's right edge.
513
+ */
514
+ .session-list-gutter {
515
+ overflow-y: scroll;
516
+ padding-right: calc(0.75rem - var(--scrollbar-size));
517
+ }
518
+
461
519
  /* The composer reads at the transcript's own size — 13px — EXCEPT on iOS.
462
520
  *
463
521
  * Every message row in the timeline is `text-[13px] leading-relaxed`, and a
@@ -46,6 +46,7 @@ function host(): AcpCommandHost & { writes: [string, string | boolean][]; access
46
46
  isAlive: () => true,
47
47
  destroyAndWait: async () => {},
48
48
  steer: async () => ({}),
49
+ recordUserTurn: () => {},
49
50
  cancelTurn: () => {},
50
51
  setAccessMode: (mode) => {
51
52
  accessModes.push(mode);
@@ -46,6 +46,8 @@ export interface AcpCommandHost {
46
46
  isAlive(): boolean;
47
47
  destroyAndWait(): Promise<void>;
48
48
  steer(blocks: unknown[], queue: 'steering' | 'followUp'): Promise<unknown>;
49
+ /** Record a mid-turn user message in the session's own transcript. */
50
+ recordUserTurn(message: string, images: unknown): void;
49
51
  cancelTurn(): void;
50
52
  /** Adopt the composer's approval tier. ACP decides approvals in-process. */
51
53
  setAccessMode(mode: ApprovalMode): void;
@@ -87,17 +89,23 @@ export interface AcpCommandHost {
87
89
  }
88
90
 
89
91
  case 'steer': {
90
- const blocks = promptBlocks(String(command.message ?? ''), command.images);
92
+ const message = String(command.message ?? '');
93
+ const blocks = promptBlocks(message, command.images);
91
94
  if (host.capabilities.steerMode !== 'steer') {
92
95
  throw new Error(`This harness has no mid-turn steering (${host.harness})`);
93
96
  }
94
- return host.steer(blocks, 'steering');
97
+ const result = await host.steer(blocks, 'steering');
98
+ host.recordUserTurn(message, command.images);
99
+ return result;
95
100
  }
96
101
 
97
102
  case 'follow_up': {
98
- const blocks = promptBlocks(String(command.message ?? ''), command.images);
103
+ const message = String(command.message ?? '');
104
+ const blocks = promptBlocks(message, command.images);
99
105
  if (!host.capabilities.steerMode) throw new Error(`This harness cannot queue a follow-up (${host.harness})`);
100
- return host.steer(blocks, 'followUp');
106
+ const result = await host.steer(blocks, 'followUp');
107
+ host.recordUserTurn(message, command.images);
108
+ return result;
101
109
  }
102
110
 
103
111
  case 'abort':
@@ -24,12 +24,40 @@ import type { OmpMessageEntry } from '@/shared/lib/omp/session/messages-parse';
24
24
  import type { ChatMessageData } from '@/shared/types/chat';
25
25
  import type { AgentEvent } from '@/server/lib/omp/rpc/constants';
26
26
 
27
- const MESSAGE_EVENTS = new Set(['message_start', 'message_update', 'message_end']);
27
+ const MESSAGE_EVENT_TYPES: Record<string, true> = {
28
+ message_start: true,
29
+ message_update: true,
30
+ message_end: true,
31
+ };
32
+
33
+ /**
34
+ * One frame's message as a timeline row, or null when it carries none.
35
+ *
36
+ * Shared by the replay reducer and the live recorder so a restored row and a
37
+ * recorded row are built by the same rule.
38
+ */
39
+ export function chatMessageFromEvent(event: AgentEvent): ChatMessageData | null {
40
+ const message = event.message;
41
+ if (!message || typeof message !== 'object' || Array.isArray(message)) return null;
42
+ const record = message as Record<string, unknown>;
43
+ const id = typeof record.id === 'string' ? record.id : '';
44
+ if (!id) return null;
45
+ const timestamp = typeof record.timestamp === 'number' || typeof record.timestamp === 'string'
46
+ ? record.timestamp
47
+ : undefined;
48
+ const entry = {
49
+ type: 'message',
50
+ id,
51
+ ...(timestamp !== undefined ? { timestamp } : {}),
52
+ message: record,
53
+ } as unknown as OmpMessageEntry;
54
+ return toChatMessage(entry);
55
+ }
28
56
 
29
57
  export function transcriptFromReplay(events: readonly AgentEvent[]): ChatMessageData[] {
30
58
  const byId = new Map<string, Record<string, unknown>>();
31
59
  for (const event of events) {
32
- if (!MESSAGE_EVENTS.has(event.type)) continue;
60
+ if (!MESSAGE_EVENT_TYPES[event.type]) continue;
33
61
  const message = event.message;
34
62
  if (!message || typeof message !== 'object' || Array.isArray(message)) continue;
35
63
  const record = message as Record<string, unknown>;
@@ -38,17 +66,8 @@ export function transcriptFromReplay(events: readonly AgentEvent[]): ChatMessage
38
66
  byId.set(id, record);
39
67
  }
40
68
  const out: ChatMessageData[] = [];
41
- for (const [id, message] of byId) {
42
- const timestamp = typeof message.timestamp === 'number' || typeof message.timestamp === 'string'
43
- ? message.timestamp
44
- : undefined;
45
- const entry = {
46
- type: 'message',
47
- id,
48
- ...(timestamp !== undefined ? { timestamp } : {}),
49
- message,
50
- } as unknown as OmpMessageEntry;
51
- const converted = toChatMessage(entry);
69
+ for (const message of byId.values()) {
70
+ const converted = chatMessageFromEvent({ type: 'message_end', message });
52
71
  if (converted) out.push(converted);
53
72
  }
54
73
  return out;
@@ -0,0 +1,162 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The transcript a server-spawned ACP child writes for itself.
8
+ *
9
+ * The bug this pins: an orchestration worker has no tab, so the client never
10
+ * wrote `chat_sessions`; the loader answered an empty timeline. The recorder
11
+ * folds the frames the driver already receives into `acp_transcripts`, and the
12
+ * loader reads that table when the client's row is empty.
13
+ */
14
+
15
+ import { afterEach, beforeEach, describe, expect, test } from 'bun:test';
16
+ import { isolateDb, releaseDb } from '@/test-support/isolated-db';
17
+ import { getDb } from '@/server/db.server';
18
+ import {
19
+ AcpTranscriptRecorder,
20
+ loadAcpTranscript,
21
+ } from '@/server/lib/harness/acp/session-transcript.server';
22
+
23
+ const SESSION = 'child-1';
24
+
25
+ function assistantMessage(id: string, content: unknown[]): Record<string, unknown> {
26
+ return { id, role: 'assistant', timestamp: 2, content };
27
+ }
28
+
29
+ describe('AcpTranscriptRecorder', () => {
30
+ beforeEach(async () => {
31
+ await isolateDb();
32
+ });
33
+
34
+ afterEach(async () => {
35
+ await releaseDb();
36
+ });
37
+
38
+ test('records the prompt and the assistant answer, and the loader reads them back', async () => {
39
+ const recorder = new AcpTranscriptRecorder(() => SESSION);
40
+ recorder.recordPrompt('do the task');
41
+ recorder.record({
42
+ type: 'message_end',
43
+ message: assistantMessage('a1', [{ type: 'text', text: 'done' }]),
44
+ });
45
+ await recorder.flush();
46
+
47
+ const rows = await loadAcpTranscript(SESSION);
48
+ expect(rows.map((row) => row.role)).toEqual(['user', 'ai']);
49
+ expect(rows[0]?.content).toBe('do the task');
50
+ expect(rows[1]?.content).toBe('done');
51
+ });
52
+
53
+ test('pairs a tool result onto the call that owns it', async () => {
54
+ const recorder = new AcpTranscriptRecorder(() => SESSION);
55
+ recorder.recordPrompt('list files');
56
+ recorder.record({
57
+ type: 'message_end',
58
+ message: assistantMessage('a1', [
59
+ { type: 'text', text: 'checking' },
60
+ { type: 'toolCall', id: 'c1', name: 'bash', arguments: { command: 'ls' } },
61
+ ]),
62
+ });
63
+ recorder.record({
64
+ type: 'tool_execution_end',
65
+ toolCallId: 'c1',
66
+ output: 'file.txt',
67
+ result: { content: [{ type: 'text', text: 'file.txt' }] },
68
+ });
69
+ await recorder.flush();
70
+
71
+ const rows = await loadAcpTranscript(SESSION);
72
+ const call = rows[1]?.toolCalls?.[0];
73
+ expect(call?.id).toBe('c1');
74
+ expect(call?.output).toBe('file.txt');
75
+ expect(call?.status).toBe('success');
76
+ });
77
+
78
+ test('a second turn appends instead of replacing the first', async () => {
79
+ const recorder = new AcpTranscriptRecorder(() => SESSION);
80
+ recorder.recordPrompt('first');
81
+ recorder.record({
82
+ type: 'message_end',
83
+ message: assistantMessage('a1', [{ type: 'text', text: 'one' }]),
84
+ });
85
+ recorder.recordPrompt('second');
86
+ recorder.record({
87
+ type: 'message_end',
88
+ message: assistantMessage('a2', [{ type: 'text', text: 'two' }]),
89
+ });
90
+ await recorder.flush();
91
+
92
+ const rows = await loadAcpTranscript(SESSION);
93
+ expect(rows.map((row) => row.content)).toEqual(['first', 'one', 'second', 'two']);
94
+ });
95
+
96
+ test('a resumed session hydrates the rows a previous process recorded', async () => {
97
+ const first = new AcpTranscriptRecorder(() => SESSION);
98
+ first.recordPrompt('first');
99
+ first.record({
100
+ type: 'message_end',
101
+ message: assistantMessage('a1', [{ type: 'text', text: 'one' }]),
102
+ });
103
+ await first.flush();
104
+
105
+ const resumed = new AcpTranscriptRecorder(() => SESSION);
106
+ await resumed.hydrate();
107
+ resumed.recordPrompt('second');
108
+ resumed.record({
109
+ type: 'message_end',
110
+ message: assistantMessage('a2', [{ type: 'text', text: 'two' }]),
111
+ });
112
+ await resumed.flush();
113
+
114
+ const rows = await loadAcpTranscript(SESSION);
115
+ expect(rows.map((row) => row.content)).toEqual(['first', 'one', 'second', 'two']);
116
+ });
117
+
118
+ test('a client-written notice row survives a recorded turn', async () => {
119
+ const db = await getDb();
120
+ const now = Date.now();
121
+ await db.run(
122
+ 'INSERT INTO chat_sessions (session_id, title, messages, updated_at) VALUES (?, ?, ?, CURRENT_TIMESTAMP)',
123
+ [
124
+ SESSION,
125
+ 'Session',
126
+ JSON.stringify([
127
+ { id: 'msg-1-user', role: 'user', content: 'first', startedAt: now - 1000 },
128
+ { id: 'a1', role: 'ai', content: 'one', startedAt: now - 900 },
129
+ { id: 'notice-1', role: 'ai', content: '', notice: 'kept', startedAt: now - 800 },
130
+ ]),
131
+ ],
132
+ );
133
+
134
+ const recorder = new AcpTranscriptRecorder(() => SESSION);
135
+ await recorder.hydrate();
136
+ recorder.recordPrompt('second');
137
+ recorder.record({
138
+ type: 'message_end',
139
+ message: assistantMessage('a2', [{ type: 'text', text: 'two' }]),
140
+ });
141
+ await recorder.flush();
142
+
143
+ const rows = await loadAcpTranscript(SESSION);
144
+ expect(rows.map((row) => row.content)).toEqual(['first', 'one', '', 'second', 'two']);
145
+ expect(rows.find((row) => row.id === 'notice-1')?.notice).toBe('kept');
146
+ expect(rows.filter((row) => row.role === 'user')).toHaveLength(2);
147
+ });
148
+
149
+ test('a session with no recorded rows answers empty', async () => {
150
+ expect(await loadAcpTranscript('never-ran')).toEqual([]);
151
+ });
152
+
153
+ test('the row is keyed by the session id the driver reports', async () => {
154
+ const recorder = new AcpTranscriptRecorder(() => SESSION);
155
+ recorder.recordPrompt('hello');
156
+ await recorder.flush();
157
+
158
+ const db = await getDb();
159
+ const row = await db.get<{ session_id: string }>('SELECT session_id FROM acp_transcripts');
160
+ expect(row?.session_id).toBe(SESSION);
161
+ });
162
+ });