@kabmo-labs/kabmo 0.40.0 → 0.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (326) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +533 -517
  3. package/dist/client/static/js/{CsvGrid-j9nvnhq1.js → CsvGrid-20k047ht.js} +2 -2
  4. package/dist/client/static/js/{DocxView-87gnpm81.js → DocxView-qpvhfcmg.js} +5 -5
  5. package/dist/client/static/js/{DrawioView-a351t8f8.js → DrawioView-178skky8.js} +2 -2
  6. package/dist/client/static/js/ImageView-460th5qa.js +1 -0
  7. package/dist/client/static/js/LayoutWrapper-5cv0dty8.js +2 -0
  8. package/dist/client/static/js/Modal-wks6p4r5.js +38 -0
  9. package/dist/client/static/js/{PdfView-n6bwcvc8.js → PdfView-y51g03nr.js} +1 -1
  10. package/dist/client/static/js/SessionsView-rsmvn7ks.js +1 -0
  11. package/dist/client/static/js/{SheetView-k8ymr87w.js → SheetView-z7yvb05v.js} +25 -25
  12. package/dist/client/static/js/{SvgPreview-5pcp444e.js → SvgPreview-yehgzhem.js} +1 -1
  13. package/dist/client/static/js/{abnfDiagram-O67JEVCF-psav75bx.js → abnfDiagram-O67JEVCF-6zxpcy8b.js} +1 -1
  14. package/dist/client/static/js/architecture-7GRP2DOG-9q06651f.js +1 -0
  15. package/dist/client/static/js/architectureDiagram-NJMV4G6O-m98sgh3c.js +36 -0
  16. package/dist/client/static/js/{astro-0rh34hha.js → astro-nn7xg0we.js} +1 -1
  17. package/dist/client/static/js/bash-fjzhxy10.js +1 -0
  18. package/dist/client/static/js/{blockDiagram-BEXU5L5S-17xsf182.js → blockDiagram-BEXU5L5S-cp7rervg.js} +5 -5
  19. package/dist/client/static/js/c-wqtyezvw.js +1 -0
  20. package/dist/client/static/js/c4Diagram-YGBWAQC7-t31recqm.js +38 -0
  21. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-663z1g1r.js → classDiagram-v2-NBCMYWYE-fy8x3dkx.js} +5 -5
  22. package/dist/client/static/js/{cose-bilkent-JH36ORCC-vp4yvx8x.js → cose-bilkent-JH36ORCC-va7ybm9e.js} +1 -1
  23. package/dist/client/static/js/cpp-y0nzwner.js +1 -0
  24. package/dist/client/static/js/css-a13jmmnc.js +1 -0
  25. package/dist/client/static/js/css-n2waj098.js +1 -0
  26. package/dist/client/static/js/cynefin-OW5HDTMX-w7a38g4g.js +1 -0
  27. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-dagkrjbh.js → cynefinDiagram-VND7K2PF-4k0k429c.js} +2 -2
  28. package/dist/client/static/js/{dagre-6A5THRUB-8qgwpb5a.js → dagre-6A5THRUB-ykdhxq6t.js} +2 -2
  29. package/dist/client/static/js/{diagram-22UHCM2B-671xtp0d.js → diagram-22UHCM2B-5nvwx7b6.js} +8 -8
  30. package/dist/client/static/js/{diagram-3UASUU5V-8nn5fha8.js → diagram-3UASUU5V-hc7zsjgw.js} +1 -1
  31. package/dist/client/static/js/diagram-ATOU4E4O-97ae07y7.js +3 -0
  32. package/dist/client/static/js/diagram-CDSNMT55-b56nnbbs.js +30 -0
  33. package/dist/client/static/js/{diagram-MLGK6HIB-tp6dwxdb.js → diagram-MLGK6HIB-37rygr9k.js} +1 -1
  34. package/dist/client/static/js/{diagram-MPIPVDR6-qgx8c8ee.js → diagram-MPIPVDR6-wv3vhhfk.js} +2 -2
  35. package/dist/client/static/js/{dockerfile-hk0s4qaw.js → dockerfile-0efb1z6e.js} +1 -1
  36. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-nmf9r33z.js → ebnfDiagram-ZINNZB2B-13fv7vxg.js} +1 -1
  37. package/dist/client/static/js/{elixir-gpez1k9m.js → elixir-mabagxwa.js} +1 -1
  38. package/dist/client/static/js/{elk-276RUBZZ-dheh5ngz.js → elk-276RUBZZ-xam60ktz.js} +1 -1
  39. package/dist/client/static/js/{erDiagram-OPXOYQCR-8837mk18.js → erDiagram-OPXOYQCR-24ctv2ee.js} +6 -6
  40. package/dist/client/static/js/{erlang-w9gmf866.js → erlang-zwy7cqdk.js} +1 -1
  41. package/dist/client/static/js/eventmodeling-NTZA5JFV-6wrjccyw.js +1 -0
  42. package/dist/client/static/js/flowDiagram-KWPJA3E3-19vjkg84.js +1 -0
  43. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-g68mvnje.js → ganttDiagram-FUAMR5RP-766a8fqw.js} +2 -2
  44. package/dist/client/static/js/gitGraph-4MIJSDKK-4je2p50v.js +1 -0
  45. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-ymk81cdj.js → gitGraphDiagram-X574FWY7-fmwjkgh6.js} +2 -2
  46. package/dist/client/static/js/graphql-gvb7e2eb.js +1 -0
  47. package/dist/client/static/js/html-bwyt0ayy.js +1 -0
  48. package/dist/client/static/js/{index-rc8wrs2a.js → index-03pyvmcz.js} +2 -2
  49. package/dist/client/static/js/index-13dr1t1r.js +314 -0
  50. package/dist/client/static/js/{index-mxpgfj6p.js → index-13xbwcbz.js} +2 -2
  51. package/dist/client/static/js/{index-4j5jwb54.js → index-1c0pnsjd.js} +2 -2
  52. package/dist/client/static/js/index-1rxa9zxp.js +1 -0
  53. package/dist/client/static/js/{index-aznkfx1z.js → index-2hpy58d0.js} +2 -2
  54. package/dist/client/static/js/{index-4j1g7m8g.js → index-2x9eqztp.js} +1 -1
  55. package/dist/client/static/js/{index-vv9ytx0t.js → index-4cncqz8j.js} +2 -2
  56. package/dist/client/static/js/index-4j8rgr4p.js +1 -0
  57. package/dist/client/static/js/{index-pp6mss9b.js → index-4mstdh41.js} +3 -3
  58. package/dist/client/static/js/index-4z4ax55k.js +12 -0
  59. package/dist/client/static/js/{index-q1bqg4f6.js → index-6ge6gk9w.js} +1 -1
  60. package/dist/client/static/js/{index-c003wb3r.js → index-7t63akyt.js} +1 -1
  61. package/dist/client/static/js/{index-ys4t1am4.js → index-8b3t2y77.js} +2 -2
  62. package/dist/client/static/js/index-8hgm0abr.js +474 -0
  63. package/dist/client/static/js/index-8jqawh3r.js +2 -0
  64. package/dist/client/static/js/index-95en3p3g.js +9 -0
  65. package/dist/client/static/js/{index-dj7y2df7.js → index-97qst4k9.js} +2 -2
  66. package/dist/client/static/js/{index-018ehs1n.js → index-9vdbnvmk.js} +1 -1
  67. package/dist/client/static/js/{index-harsfp4x.js → index-a9t9gdew.js} +9 -9
  68. package/dist/client/static/js/{index-8888hgj8.js → index-b4y5g48d.js} +5 -5
  69. package/dist/client/static/js/{index-gx2xefdg.js → index-czagykbq.js} +2 -2
  70. package/dist/client/static/js/{index-r1fe56cn.js → index-dfqmwm7j.js} +2 -2
  71. package/dist/client/static/js/{index-cccrappc.js → index-dydwcp3n.js} +2 -2
  72. package/dist/client/static/js/{index-jy91r3ap.js → index-e1yz59fa.js} +2 -2
  73. package/dist/client/static/js/{index-ce4vytm6.js → index-e6any867.js} +2 -2
  74. package/dist/client/static/js/{index-wy05jt00.js → index-ejdnjh5c.js} +2 -2
  75. package/dist/client/static/js/index-f4vr1c6e.css +1 -0
  76. package/dist/client/static/js/{index-9wjnbb3q.js → index-feffxxss.js} +2 -2
  77. package/dist/client/static/js/{index-547h1b8j.js → index-grczkttn.js} +13 -13
  78. package/dist/client/static/js/{index-s78n0dtv.js → index-hga3e13s.js} +2 -2
  79. package/dist/client/static/js/{index-d1vearmk.js → index-hw14rhen.js} +2 -2
  80. package/dist/client/static/js/index-hzwr5fm9.js +4 -0
  81. package/dist/client/static/js/{index-sj4y8kj2.js → index-j17h4z6f.js} +2 -2
  82. package/dist/client/static/js/{index-y5hxhr7q.js → index-ka2rc2cr.js} +5 -5
  83. package/dist/client/static/js/{index-b612vske.js → index-ktbrmp29.js} +2 -2
  84. package/dist/client/static/js/{index-ag78jnva.js → index-nbexks3x.js} +1 -1
  85. package/dist/client/static/js/{index-vwc8pdy3.js → index-nh29fkk9.js} +2 -2
  86. package/dist/client/static/js/{index-gn92c6hp.js → index-p0ez6hqd.js} +2 -2
  87. package/dist/client/static/js/{index-173x4bh0.js → index-pkes9492.js} +2 -2
  88. package/dist/client/static/js/{index-fg965t62.js → index-pysqpc5n.js} +2 -2
  89. package/dist/client/static/js/index-qj34r6d0.js +1 -0
  90. package/dist/client/static/js/{index-ek4gwrm8.js → index-qx6x4z0y.js} +2 -2
  91. package/dist/client/static/js/{index-agdbjh5k.js → index-r8cc80w5.js} +2 -2
  92. package/dist/client/static/js/{index-2kg3r5jw.js → index-rab39785.js} +2 -2
  93. package/dist/client/static/js/{index-haaz8t7e.js → index-sk9ej289.js} +2 -2
  94. package/dist/client/static/js/{index-8ggxxp8c.js → index-sq3r1xhf.js} +2 -2
  95. package/dist/client/static/js/{index-wsqgp9jw.js → index-sx809d6d.js} +2 -2
  96. package/dist/client/static/js/{index-p2812ygk.js → index-sz3mxjvy.js} +1 -1
  97. package/dist/client/static/js/{index-69xe17c1.js → index-tqycj126.js} +2 -2
  98. package/dist/client/static/js/{index-js81yrmy.js → index-vcn1kcpy.js} +3 -3
  99. package/dist/client/static/js/{index-rvjc19x7.js → index-x7f5ysch.js} +2 -2
  100. package/dist/client/static/js/index-xe5cqwnf.js +1 -0
  101. package/dist/client/static/js/index-xxe52zrm.js +2 -0
  102. package/dist/client/static/js/{index-ek7hqfp0.js → index-yvxa7hd8.js} +2 -2
  103. package/dist/client/static/js/{index-qw5aqk2d.js → index-z6kpc98a.js} +1 -1
  104. package/dist/client/static/js/{index-yzg9mbsv.js → index-zjydzxhm.js} +1 -1
  105. package/dist/client/static/js/{index-6wtx7a9x.js → index-zvazj4va.js} +2 -2
  106. package/dist/client/static/js/info-A6RAGUB7-k0z5qdew.js +1 -0
  107. package/dist/client/static/js/{infoDiagram-VRGFBTTK-11trzn8c.js → infoDiagram-VRGFBTTK-tqytmzp1.js} +1 -1
  108. package/dist/client/static/js/ini-2gvjwh83.js +1 -0
  109. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-8xnnymb5.js → ishikawaDiagram-OU5B5YK6-rp77ff6m.js} +1 -1
  110. package/dist/client/static/js/java-1xwcq79s.js +1 -0
  111. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-wd47j0hy.js → journeyDiagram-ZHPQQLJL-c7bxrhf1.js} +2 -2
  112. package/dist/client/static/js/json-4pqjabgq.js +1 -0
  113. package/dist/client/static/js/jsx-wcsss15s.js +1 -0
  114. package/dist/client/static/js/{julia-c2q0vwpd.js → julia-2eekpjq8.js} +1 -1
  115. package/dist/client/static/js/{kanban-definition-PNTS6WVX-s5rgcp44.js → kanban-definition-PNTS6WVX-j2pxewqq.js} +8 -8
  116. package/dist/client/static/js/lua-h7vjcn0h.js +1 -0
  117. package/dist/client/static/js/markdown-f30jjjh9.js +1 -0
  118. package/dist/client/static/js/{mermaid.core-9fxp8nt2.js → mermaid.core-cqqe1krg.js} +6 -6
  119. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-4fyewtst.js → mindmap-definition-NLK3R4M7-s03k32p9.js} +9 -9
  120. package/dist/client/static/js/one-dark-pro-9tt0a020.js +1 -0
  121. package/dist/client/static/js/one-light-5fg4r0ra.js +1 -0
  122. package/dist/client/static/js/packet-AYTQ26CC-6cnvmb2z.js +1 -0
  123. package/dist/client/static/js/{pegDiagram-GJSIUBJH-s2xe2e2k.js → pegDiagram-GJSIUBJH-dfg2j0zc.js} +1 -1
  124. package/dist/client/static/js/{perl-6pa0tn3b.js → perl-5vxax0nr.js} +1 -1
  125. package/dist/client/static/js/{php-1zy994pz.js → php-hgrgdq63.js} +1 -1
  126. package/dist/client/static/js/pie-WAS4IAKB-m9z1mztn.js +1 -0
  127. package/dist/client/static/js/{pieDiagram-5QR66LMP-1szpjbzy.js → pieDiagram-5QR66LMP-pshd1j79.js} +1 -1
  128. package/dist/client/static/js/properties-ymexza6q.js +1 -0
  129. package/dist/client/static/js/python-31ycwa66.js +1 -0
  130. package/dist/client/static/js/{quadrantDiagram-O4NWA36T-mv3ee2qa.js → quadrantDiagram-O4NWA36T-cvvvmtk2.js} +4 -4
  131. package/dist/client/static/js/r-t2nne4xp.js +1 -0
  132. package/dist/client/static/js/radar-RG4KPBEZ-8m9rkex6.js +1 -0
  133. package/dist/client/static/js/railroad-74A4TZTK-wc55emj8.js +1 -0
  134. package/dist/client/static/js/railroad-abnf-HS5TGJTU-2y2rnrzq.js +1 -0
  135. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-zzcc9x0v.js +1 -0
  136. package/dist/client/static/js/railroad-peg-WCYAUIDC-z82na5nb.js +1 -0
  137. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-hgdqjpm9.js → railroadDiagram-XR7U4H2S-h53p3sha.js} +1 -1
  138. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-yrfjp9wx.js → requirementDiagram-PLB6GJNP-bdv2fkxd.js} +4 -4
  139. package/dist/client/static/js/{ruby-arvs7kz4.js → ruby-8pxcn21w.js} +1 -1
  140. package/dist/client/static/js/{rust-3ahjk339.js → rust-j80dxgjg.js} +1 -1
  141. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-k7k871xa.js → sankeyDiagram-IPEJSGJF-xqnnvmhy.js} +2 -2
  142. package/dist/client/static/js/{sass-cmkf7nwd.js → sass-bm32bb5k.js} +1 -1
  143. package/dist/client/static/js/{scss-x7ddw6gb.js → scss-e2dndbfa.js} +1 -1
  144. package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-gd80m0as.js → sequenceDiagram-PO4LG4MO-3p67305f.js} +10 -10
  145. package/dist/client/static/js/{sizeCapture-INFHLROL-jv6p4834.js → sizeCapture-INFHLROL-f87525h7.js} +1 -1
  146. package/dist/client/static/js/sql-bwnasywx.js +1 -0
  147. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-tvphxq2h.js → stateDiagram-v2-GCMORJYK-e5st1fy3.js} +6 -6
  148. package/dist/client/static/js/{svelte-0hv6pak2.js → svelte-ztkaww47.js} +1 -1
  149. package/dist/client/static/js/{swimlanes-2SLR337P-3dt7nxj2.js → swimlanes-2SLR337P-ceghkbez.js} +1 -1
  150. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-vc8hvfya.js +8 -0
  151. package/dist/client/static/js/{timeline-definition-EJHVYXUP-40vvf856.js → timeline-definition-EJHVYXUP-f7evs443.js} +3 -3
  152. package/dist/client/static/js/treeView-Q6P3EWNA-kzh6cm3f.js +1 -0
  153. package/dist/client/static/js/treemap-WGGIJYW6-wz5ed560.js +1 -0
  154. package/dist/client/static/js/tsx-zfy727zs.js +1 -0
  155. package/dist/client/static/js/typescript-p3syh43m.js +1 -0
  156. package/dist/client/static/js/{usecaseDiagram-POWQR4AR-g1j5x0xh.js → usecaseDiagram-POWQR4AR-0gpn21p7.js} +27 -27
  157. package/dist/client/static/js/{vennDiagram-UO4OBE2U-5b8789qk.js → vennDiagram-UO4OBE2U-4spzy428.js} +3 -3
  158. package/dist/client/static/js/{vue-zccj3qa5.js → vue-xm1dxpmy.js} +1 -1
  159. package/dist/client/static/js/wardley-WFR3VGLG-zewbfccz.js +1 -0
  160. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-c7x3za3w.js → wardleyDiagram-VNRHLVJA-745xr2pa.js} +4 -4
  161. package/dist/client/static/js/xml-4enq788a.js +1 -0
  162. package/dist/client/static/js/xychartDiagram-PMCCYNJV-7dr9qwx5.js +7 -0
  163. package/dist/client/static/js/yaml-pjtt3jsc.js +1 -0
  164. package/package.json +1 -1
  165. package/src/client/components/common/batch-selection/folder-state.ts +2 -2
  166. package/src/client/components/common/server-control/Panel.tsx +16 -5
  167. package/src/client/components/common/server-control/index.test.tsx +63 -9
  168. package/src/client/components/common/session-row/TrailingSlot.tsx +8 -0
  169. package/src/client/components/common/session-row/index.tsx +16 -9
  170. package/src/client/components/layout/desktop-layout/LeftColumn.tsx +7 -0
  171. package/src/client/components/layout/session-sidebar/CategoryItem.tsx +1 -1
  172. package/src/client/components/layout/session-sidebar/ClassicView.tsx +13 -0
  173. package/src/client/components/layout/session-sidebar/HarnessFilter.tsx +175 -0
  174. package/src/client/components/layout/session-sidebar/SessionList.tsx +9 -1
  175. package/src/client/components/layout/session-sidebar/SessionsView.tsx +8 -1
  176. package/src/client/components/layout/session-sidebar/about-modal/index.test.tsx +1 -1
  177. package/src/client/components/layout/session-sidebar/harness-filter.test.tsx +173 -0
  178. package/src/client/components/layout/session-sidebar/modern/FilterChips.tsx +63 -18
  179. package/src/client/components/layout/session-sidebar/modern/SearchField.tsx +1 -1
  180. package/src/client/components/layout/session-sidebar/modern/WorkspaceHeader.tsx +21 -12
  181. package/src/client/components/layout/session-sidebar/modern/WorkspaceSection.tsx +1 -1
  182. package/src/client/components/layout/session-sidebar/modern/index.tsx +11 -2
  183. package/src/client/components/layout/session-sidebar/modern/search-field.test.tsx +96 -0
  184. package/src/client/components/layout/session-sidebar/session-list-states.test.tsx +3 -0
  185. package/src/client/components/layout/session-sidebar/variant-props.ts +7 -0
  186. package/src/client/components/mobile/SessionSidebar.tsx +14 -21
  187. package/src/client/components/mobile/mobile-session-sidebar/ClassicDrawer.tsx +19 -0
  188. package/src/client/components/mobile/mobile-session-sidebar/Item.tsx +1 -1
  189. package/src/client/components/settings/categories/omp-settings/EngineHeader.tsx +1 -1
  190. package/src/client/components/workspace/chat-timeline/MessageList.test.ts +19 -19
  191. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.image.test.ts +147 -0
  192. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.test.ts +51 -83
  193. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.tsx +44 -63
  194. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/ReadDirectory.tsx +72 -0
  195. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/ReadImage.tsx +51 -0
  196. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/read-test-util.ts +91 -0
  197. package/src/client/components/workspace/git-panel/commit-modal/CommitRow.test.ts +80 -62
  198. package/src/client/components/workspace/git-panel/commit-modal/CommitRow.tsx +15 -33
  199. package/src/client/components/workspace/git-panel/commit-modal/Header.tsx +1 -1
  200. package/src/client/components/workspace/terminal-panel/copy.test.ts +179 -0
  201. package/src/client/components/workspace/terminal-panel/copy.ts +76 -0
  202. package/src/client/components/workspace/terminal-panel/mount.ts +13 -0
  203. package/src/client/data/settings/omp-schema.json +39 -18
  204. package/src/client/hooks/chat/omp/pending-child.test.ts +1 -1
  205. package/src/client/hooks/chat/omp/session-sidebar-controller.test.ts +61 -0
  206. package/src/client/hooks/chat/omp/session-sidebar-controller.ts +37 -39
  207. package/src/client/hooks/chat/omp/sidebar-filter.ts +62 -0
  208. package/src/client/hooks/chat/timeline/session-changes.test.ts +85 -0
  209. package/src/client/hooks/chat/timeline/session-changes.ts +8 -5
  210. package/src/client/hooks/commands/use-command-runtime.ts +15 -0
  211. package/src/client/hooks/shell/servers.ts +60 -2
  212. package/src/client/hooks/ui/updates/check-request.ts +41 -0
  213. package/src/client/hooks/ui/updates/index.ts +13 -5
  214. package/src/client/hooks/ui/updates/mobile-flow.ts +56 -0
  215. package/src/client/lib/native/run-command.test.ts +95 -0
  216. package/src/client/lib/native/run-command.ts +52 -0
  217. package/src/client/lib/router/open-session.test.ts +26 -1
  218. package/src/client/lib/router/open-session.ts +21 -0
  219. package/src/client/main.tsx +9 -0
  220. package/src/client/tailwind.css +58 -0
  221. package/src/server/lib/changes/capture-shell.test.ts +253 -0
  222. package/src/server/lib/changes/capture-targets.test.ts +83 -0
  223. package/src/server/lib/changes/capture-targets.ts +51 -0
  224. package/src/server/lib/changes/capture-write.server.ts +2 -2
  225. package/src/server/lib/changes/capture.server.ts +14 -29
  226. package/src/server/lib/changes/capture.test.ts +69 -149
  227. package/src/server/lib/changes/patch-paths.ts +37 -0
  228. package/src/server/lib/harness/acp/commands.test.ts +1 -0
  229. package/src/server/lib/harness/acp/commands.ts +12 -4
  230. package/src/server/lib/harness/acp/replay-transcript.ts +32 -13
  231. package/src/server/lib/harness/acp/session-transcript.server.test.ts +162 -0
  232. package/src/server/lib/harness/acp/session-transcript.server.ts +350 -0
  233. package/src/server/lib/harness/acp/session.ts +6 -1
  234. package/src/server/lib/harness/schema.server.ts +18 -0
  235. package/src/server/lib/harness/spawn.server.ts +14 -1
  236. package/src/server/lib/models/provider-icon-fetch.ts +2 -2
  237. package/src/server/lib/models/provider-icon-parse.test.ts +0 -12
  238. package/src/server/lib/models/provider-icon-parse.ts +0 -8
  239. package/src/server/lib/omp/rpc/frame-fold.test.ts +16 -1
  240. package/src/server/lib/omp/rpc/frame-fold.ts +17 -4
  241. package/src/server/lib/omp/session/blobs.server.test.ts +34 -0
  242. package/src/server/lib/omp/session/blobs.server.ts +8 -3
  243. package/src/server/lib/omp/session/delete.server.ts +4 -0
  244. package/src/server/lib/omp/session/sidebar-activity.server.test.ts +2 -1
  245. package/src/server/routes/agent/harness-command.test.ts +71 -0
  246. package/src/server/routes/agent/harness-command.ts +27 -13
  247. package/src/server/routes/chat/imported.ts +5 -2
  248. package/src/server/routes/chat/live-meta.ts +42 -0
  249. package/src/server/routes/chat/session.test.ts +110 -0
  250. package/src/server/routes/chat/session.ts +31 -34
  251. package/src/shared/lib/chat/transcript-rows.ts +22 -0
  252. package/src/shared/lib/commands/catalog.test.ts +36 -0
  253. package/src/shared/lib/commands/catalog.ts +16 -0
  254. package/src/shared/lib/fs/file-kind.test.ts +46 -3
  255. package/src/shared/lib/fs/file-kind.ts +40 -9
  256. package/src/shared/lib/omp/config/schema-releases.test.ts +29 -0
  257. package/src/shared/lib/updates/popup-state.ts +11 -0
  258. package/src/shared/lib/workspace/harness-filter.test.ts +89 -0
  259. package/src/shared/lib/workspace/harness-filter.ts +75 -0
  260. package/src/{client/lib → shared/lib/workspace}/session-tree.test.ts +1 -1
  261. package/src/shared/lib/workspace/session-visibility.test.ts +71 -0
  262. package/src/shared/lib/workspace/session-visibility.ts +48 -23
  263. package/src/shared/lib/workspace/sidebar-filter-row.test.ts +64 -23
  264. package/src/shared/lib/workspace/sidebar-filter-row.ts +89 -31
  265. package/dist/client/static/js/ImageView-c139r891.js +0 -1
  266. package/dist/client/static/js/LayoutWrapper-08axzr3a.js +0 -2
  267. package/dist/client/static/js/Modal-0weqfqvk.js +0 -38
  268. package/dist/client/static/js/SessionsView-awef8ehj.js +0 -1
  269. package/dist/client/static/js/architecture-7GRP2DOG-6rbq97t9.js +0 -1
  270. package/dist/client/static/js/architectureDiagram-NJMV4G6O-9bk6ykn7.js +0 -36
  271. package/dist/client/static/js/bash-vv2ysp0a.js +0 -1
  272. package/dist/client/static/js/c-67jyc7sg.js +0 -1
  273. package/dist/client/static/js/c4Diagram-YGBWAQC7-jn9j4n04.js +0 -38
  274. package/dist/client/static/js/cpp-crfbnwv8.js +0 -1
  275. package/dist/client/static/js/css-983fbv00.js +0 -1
  276. package/dist/client/static/js/css-zj4qzw6r.js +0 -1
  277. package/dist/client/static/js/cynefin-OW5HDTMX-zafxcz2k.js +0 -1
  278. package/dist/client/static/js/diagram-ATOU4E4O-dnar0ktg.js +0 -3
  279. package/dist/client/static/js/diagram-CDSNMT55-bt0fhk7n.js +0 -30
  280. package/dist/client/static/js/eventmodeling-NTZA5JFV-cq3dvz7e.js +0 -1
  281. package/dist/client/static/js/flowDiagram-KWPJA3E3-spzh2jxq.js +0 -1
  282. package/dist/client/static/js/gitGraph-4MIJSDKK-epgk26pj.js +0 -1
  283. package/dist/client/static/js/graphql-dewsj5g1.js +0 -1
  284. package/dist/client/static/js/html-1cpe2xc8.js +0 -1
  285. package/dist/client/static/js/index-bdz08fe2.js +0 -12
  286. package/dist/client/static/js/index-bgpcf3mr.js +0 -1
  287. package/dist/client/static/js/index-bj3wn9je.js +0 -1
  288. package/dist/client/static/js/index-dhrp656p.js +0 -1
  289. package/dist/client/static/js/index-g10nr8m6.js +0 -9
  290. package/dist/client/static/js/index-j4ks5s41.js +0 -474
  291. package/dist/client/static/js/index-jqs23cc7.css +0 -1
  292. package/dist/client/static/js/index-qnt118mp.js +0 -2
  293. package/dist/client/static/js/index-qntpsp98.js +0 -2
  294. package/dist/client/static/js/index-w130cs7d.js +0 -1
  295. package/dist/client/static/js/index-wv36ddd5.js +0 -314
  296. package/dist/client/static/js/index-y82bk3hr.js +0 -4
  297. package/dist/client/static/js/info-A6RAGUB7-0an46pag.js +0 -1
  298. package/dist/client/static/js/ini-09e0scxh.js +0 -1
  299. package/dist/client/static/js/java-vnaesxzs.js +0 -1
  300. package/dist/client/static/js/json-g5ggnd94.js +0 -1
  301. package/dist/client/static/js/jsx-xz71aed4.js +0 -1
  302. package/dist/client/static/js/lua-e4wenyzt.js +0 -1
  303. package/dist/client/static/js/markdown-yv3p1p7m.js +0 -1
  304. package/dist/client/static/js/one-dark-pro-ahch85zb.js +0 -1
  305. package/dist/client/static/js/one-light-9706jgqt.js +0 -1
  306. package/dist/client/static/js/packet-AYTQ26CC-5e397pav.js +0 -1
  307. package/dist/client/static/js/pie-WAS4IAKB-0zzmzg64.js +0 -1
  308. package/dist/client/static/js/properties-0ag74bdj.js +0 -1
  309. package/dist/client/static/js/python-zsn5tdbj.js +0 -1
  310. package/dist/client/static/js/r-mwtqhnw3.js +0 -1
  311. package/dist/client/static/js/radar-RG4KPBEZ-mtar9742.js +0 -1
  312. package/dist/client/static/js/railroad-74A4TZTK-d6a6j9fq.js +0 -1
  313. package/dist/client/static/js/railroad-abnf-HS5TGJTU-1257kd8x.js +0 -1
  314. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-v8b6qmas.js +0 -1
  315. package/dist/client/static/js/railroad-peg-WCYAUIDC-jxpbx410.js +0 -1
  316. package/dist/client/static/js/sql-aczp05f2.js +0 -1
  317. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-aqnh1hhp.js +0 -8
  318. package/dist/client/static/js/treeView-Q6P3EWNA-q3qr7ew7.js +0 -1
  319. package/dist/client/static/js/treemap-WGGIJYW6-zgbdydeq.js +0 -1
  320. package/dist/client/static/js/tsx-s1shkfg9.js +0 -1
  321. package/dist/client/static/js/typescript-htx9v6bf.js +0 -1
  322. package/dist/client/static/js/wardley-WFR3VGLG-b230aajh.js +0 -1
  323. package/dist/client/static/js/xml-23y6pgvx.js +0 -1
  324. package/dist/client/static/js/xychartDiagram-PMCCYNJV-h0fy45tg.js +0 -7
  325. package/dist/client/static/js/yaml-vrayja34.js +0 -1
  326. /package/src/{client/lib → shared/lib/workspace}/session-tree.ts +0 -0
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The catalog is the single source for a command's title and chord, so a row
8
+ * that exists only in a menu or only in a palette is a bug by construction.
9
+ *
10
+ * These cases pin the two commands the native menu bar reaches for — a rename
11
+ * would leave the menu row calling an id nothing registers, which is silent in
12
+ * the app (the row simply does nothing) and is exactly what this file exists to
13
+ * catch.
14
+ */
15
+
16
+ import { describe, expect, test } from 'bun:test';
17
+ import { BUILTIN_COMMANDS } from '@/shared/lib/commands/catalog';
18
+
19
+ describe('the built-in catalog', () => {
20
+ test('every id is unique', () => {
21
+ const ids = BUILTIN_COMMANDS.map((entry) => entry.id);
22
+ expect(new Set(ids).size).toBe(ids.length);
23
+ });
24
+
25
+ test('New Session is a command with ⌘N', () => {
26
+ const entry = BUILTIN_COMMANDS.find((candidate) => candidate.id === 'workspace.newSession');
27
+ expect(entry?.title).toBe('New Session');
28
+ expect(entry?.defaultKey?.mac).toEqual([{ code: 'KeyN', meta: true }]);
29
+ });
30
+
31
+ test('Check for Updates is a command with no chord', () => {
32
+ const entry = BUILTIN_COMMANDS.find((candidate) => candidate.id === 'workspace.checkUpdates');
33
+ expect(entry?.title).toBe('Check for Updates');
34
+ expect(entry?.defaultKey).toBeUndefined();
35
+ });
36
+ });
@@ -55,6 +55,22 @@ export const BUILTIN_COMMANDS: readonly CommandMeta[] = [
55
55
  ],
56
56
  },
57
57
  },
58
+ {
59
+ id: 'workspace.newSession',
60
+ title: 'New Session',
61
+ category: 'Workspace',
62
+ keywords: ['new', 'chat', 'start', 'empty', 'workspace'],
63
+ defaultKey: {
64
+ mac: [{ code: 'KeyN', meta: true }],
65
+ other: [{ code: 'KeyN', ctrl: true }],
66
+ },
67
+ },
68
+ {
69
+ id: 'workspace.checkUpdates',
70
+ title: 'Check for Updates',
71
+ category: 'Workspace',
72
+ keywords: ['update', 'version', 'release', 'upgrade'],
73
+ },
58
74
  {
59
75
  id: 'workspace.toggleSidebar',
60
76
  title: 'Toggle Sidebar',
@@ -23,8 +23,10 @@ import {
23
23
  getFileExtension,
24
24
  getImageMimeFromBytes,
25
25
  getImageMimeType,
26
+ getPaintableImageMimeType,
26
27
  getRawContentType,
27
28
  IMAGE_MIME_BY_EXT,
29
+ looksLikeSvg,
28
30
  SVG_MIME,
29
31
  } from '@/shared/lib/fs/file-kind';
30
32
 
@@ -180,6 +182,38 @@ describe('getRawContentType', () => {
180
182
  });
181
183
  });
182
184
 
185
+ describe('getPaintableImageMimeType', () => {
186
+ test('a raster image keeps its own type', () => {
187
+ expect(getPaintableImageMimeType('shot.png')).toBe('image/png');
188
+ expect(getPaintableImageMimeType('shot.webp')).toBe('image/webp');
189
+ });
190
+
191
+ // The chat `read` card paints the file a tool returned, and an SVG is a
192
+ // picture there — while the editor keeps it on the code path, which is why
193
+ // `getImageMimeType` stays raster-only.
194
+ test('svg is paintable even though it is not an image kind', () => {
195
+ expect(getPaintableImageMimeType('logo.svg')).toBe(SVG_MIME);
196
+ expect(getImageMimeType('logo.svg')).toBeNull();
197
+ });
198
+
199
+ test('a document and a text file are not paintable', () => {
200
+ expect(getPaintableImageMimeType('report.pdf')).toBeNull();
201
+ expect(getPaintableImageMimeType('a.ts')).toBeNull();
202
+ expect(getPaintableImageMimeType(undefined)).toBeNull();
203
+ });
204
+ });
205
+
206
+ describe('looksLikeSvg', () => {
207
+ test('recognises a document and one behind a prolog', () => {
208
+ expect(looksLikeSvg(new TextEncoder().encode('<svg xmlns="http://www.w3.org/2000/svg"/>'))).toBe(true);
209
+ expect(looksLikeSvg(new TextEncoder().encode('<?xml version="1.0"?>\n<svg/>'))).toBe(true);
210
+ });
211
+
212
+ test('a PNG is not an SVG', () => {
213
+ expect(looksLikeSvg(new Uint8Array([0x89, 0x50, 0x4e, 0x47]))).toBe(false);
214
+ });
215
+ });
216
+
183
217
  describe('getImageMimeFromBytes', () => {
184
218
  test('the PNG signature is recognized', () => {
185
219
  expect(getImageMimeFromBytes(bytes(0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a))).toBe('image/png');
@@ -237,9 +271,18 @@ describe('getImageMimeFromBytes', () => {
237
271
  expect(getImageMimeFromBytes(bytes(0x89))).toBeNull();
238
272
  });
239
273
 
240
- test('a UTF-8 text buffer is not mistaken for an image', () => {
241
- const text = new TextEncoder().encode('<svg xmlns="http://www.w3.org/2000/svg"></svg>');
242
- expect(getImageMimeFromBytes(text)).toBeNull();
274
+ test('an SVG document is named from its own text', () => {
275
+ // An SVG has no magic signature, so the sniff reads the head as text. The
276
+ // blob route depends on this answer: without it an SVG image block was
277
+ // labelled `application/octet-stream` and painted nothing.
278
+ const svg = new TextEncoder().encode('<svg xmlns="http://www.w3.org/2000/svg"></svg>');
279
+ expect(getImageMimeFromBytes(svg)).toBe(SVG_MIME);
280
+ expect(getImageMimeFromBytes(new TextEncoder().encode('<?xml version="1.0"?>\n<svg/>'))).toBe(SVG_MIME);
281
+ });
282
+
283
+ test('ordinary text is not mistaken for a picture', () => {
284
+ expect(getImageMimeFromBytes(new TextEncoder().encode('<html><body>hi</body></html>'))).toBeNull();
285
+ expect(getImageMimeFromBytes(new TextEncoder().encode('const a = 1;'))).toBeNull();
243
286
  });
244
287
 
245
288
  test('the first matching signature wins when bytes overlap two formats', () => {
@@ -86,21 +86,31 @@ export function getDocumentMimeType(filePath: string | undefined | null): string
86
86
  return DOCUMENT_MIME_BY_EXT[getFileExtension(filePath)] ?? null;
87
87
  }
88
88
 
89
+ /**
90
+ * MIME type for a path an `<img>` can PAINT — every raster image plus SVG — or
91
+ * null.
92
+ *
93
+ * The chat `read` card is the caller that needs this third answer: it paints the
94
+ * file a tool returned, and an SVG is a picture there even though the editor
95
+ * keeps it on the code path (`getImageMimeType` stays raster-only for that
96
+ * reason). One function, so the read panel and `/api/fs/raw` cannot disagree
97
+ * about which files are previewable.
98
+ */
99
+ export function getPaintableImageMimeType(filePath: string | undefined | null): string | null {
100
+ return getImageMimeType(filePath) ?? (getFileExtension(filePath) === 'svg' ? SVG_MIME : null);
101
+ }
102
+
89
103
  /**
90
104
  * The `content-type` `/api/fs/raw` should answer a path with, or null when the
91
105
  * bytes have no picture/document type (the route falls back to
92
106
  * `application/octet-stream`).
93
107
  *
94
- * SVG is named here rather than by `getImageMimeType` because it is deliberately
95
- * excluded there — the classifier must keep it on the text path — while the raw
96
- * route serves it to an `<img>`.
108
+ * SVG is named through `getPaintableImageMimeType` rather than by
109
+ * `getImageMimeType` because the classifier must keep it on the text path while
110
+ * the raw route serves it to an `<img>`.
97
111
  */
98
112
  export function getRawContentType(filePath: string | undefined | null): string | null {
99
- return (
100
- getImageMimeType(filePath) ??
101
- getDocumentMimeType(filePath) ??
102
- (getFileExtension(filePath) === 'svg' ? SVG_MIME : null)
103
- );
113
+ return getPaintableImageMimeType(filePath) ?? getDocumentMimeType(filePath);
104
114
  }
105
115
 
106
116
  /** Leading bytes → MIME, longest signature first so `webp`'s `RIFF`/`WEBP`
@@ -118,6 +128,23 @@ const IMAGE_MAGIC: { bytes: number[]; mime: string; offset?: number }[] = [
118
128
  { bytes: [0x00, 0x00, 0x01, 0x00], mime: 'image/x-icon' },
119
129
  ];
120
130
 
131
+ /**
132
+ * True when the bytes are an SVG document.
133
+ *
134
+ * An SVG has no magic signature — it is XML, and an `<svg>` root can sit behind
135
+ * a prolog, a comment, a doctype and a long `<style>` — so the head is read as
136
+ * text. Only the first 2 KiB are decoded: past that there is no prolog left.
137
+ *
138
+ * Lives here rather than in one caller because two paths need the same answer:
139
+ * the blob store has to label a `.svg` blob `image/svg+xml` or the browser
140
+ * downloads it, and a provider's favicon is the same question about different
141
+ * bytes.
142
+ */
143
+ export function looksLikeSvg(bytes: Uint8Array): boolean {
144
+ const head = new TextDecoder().decode(bytes.subarray(0, 2048)).trimStart();
145
+ return head.startsWith('<svg') || (head.startsWith('<?xml') && head.includes('<svg'));
146
+ }
147
+
121
148
  /**
122
149
  * MIME type for a raster image read from its own bytes, or null when no
123
150
  * signature matches.
@@ -127,6 +154,10 @@ const IMAGE_MAGIC: { bytes: number[]; mime: string; offset?: number }[] = [
127
154
  * pruned of those links — or a ref whose `mimeType` field the caller lost —
128
155
  * leaves the bytes as the only evidence. A wrong `content-type` is not
129
156
  * cosmetic here: `image/*` is what makes the browser paint rather than download.
157
+ *
158
+ * SVG is the last entry because it matches no bytes table: a tool can return an
159
+ * SVG image block (and omp's blob store will hold it), and without this the blob
160
+ * route answered `application/octet-stream`, which paints nothing.
130
161
  */
131
162
  export function getImageMimeFromBytes(bytes: Uint8Array): string | null {
132
163
  for (const { bytes: magic, mime, offset = 0 } of IMAGE_MAGIC) {
@@ -140,7 +171,7 @@ export function getImageMimeFromBytes(bytes: Uint8Array): string | null {
140
171
  }
141
172
  if (matched) return mime;
142
173
  }
143
- return null;
174
+ return looksLikeSvg(bytes) ? SVG_MIME : null;
144
175
  }
145
176
 
146
177
  /**
@@ -190,4 +190,33 @@ describe('OMP_SCHEMA release rows', () => {
190
190
  // asking; a stale ladder would hide the only uncoverable value.
191
191
  expect(OMP_SCHEMA.entries['worktree.onExit']?.values).toEqual(['keep', 'ask', 'remove', 'force']);
192
192
  });
193
+
194
+ test("18.22.2's live-endpoint and keyless rows are offered, and credentials are masked", () => {
195
+ // 18.22.1 lets live voice reach any OpenAI Realtime server, so the endpoint
196
+ // and its key are the only way to configure one from the console; the
197
+ // keyless switch is the only way to turn the scraped engines off.
198
+ const expected: Record<string, { type: SchemaEntry['type']; tab: string; group: string; default: unknown }> = {
199
+ 'live.endpoint': { type: 'string', tab: 'providers', group: 'Services', default: undefined },
200
+ 'live.apiKey': { type: 'string', tab: 'providers', group: 'Services', default: undefined },
201
+ 'providers.webKeyless': { type: 'boolean', tab: 'providers', group: 'Services', default: true },
202
+ };
203
+ for (const [key, want] of Object.entries(expected)) {
204
+ const entry = OMP_SCHEMA.entries[key];
205
+ expect({ key, entry: entry && { type: entry.type, tab: entry.ui.tab, group: entry.ui.group, default: entry.default } }).toEqual({
206
+ key,
207
+ entry: want,
208
+ });
209
+ }
210
+ // `live.voice` became a free-form string that still ships the nine known
211
+ // voices as options: omp's own panel renders string+options as a submenu,
212
+ // and so does `RowEditor`, so the row must keep its options.
213
+ expect(OMP_SCHEMA.entries['live.voice']?.type).toBe('string');
214
+ expect(OMP_SCHEMA.entries['live.voice']?.ui.options).toHaveLength(9);
215
+ // The generator reads the raw definition, where the marker is `credential`
216
+ // (not the `Setting` instance's `isCredential` getter). Reading the getter
217
+ // left every credential row in plain text — including this release's key.
218
+ for (const key of ['live.apiKey', 'mnemopi.embeddingApiKey', 'mnemopi.llmApiKey', 'hindsight.apiToken']) {
219
+ expect({ key, credential: OMP_SCHEMA.entries[key]?.credential }).toEqual({ key, credential: true });
220
+ }
221
+ });
193
222
  });
@@ -30,6 +30,17 @@ export const UPDATE_POPUP_SETTING_KEY = 'omp_update_popup_version';
30
30
  */
31
31
  export const UPDATE_POPUP_OPEN_EVENT = 'omp:update-popup';
32
32
 
33
+ /**
34
+ * Window event that asks for a fresh update check.
35
+ *
36
+ * The native menu's "Check for Updates…" cannot read the console's update state,
37
+ * and a second copy of the check would be a second source of truth. The row
38
+ * dispatches this event; whichever sidebar is mounted owns `useUpdates` and runs
39
+ * the one check, then reports the verdict (the popup when there is a release, a
40
+ * toast when there is not).
41
+ */
42
+ export const UPDATE_CHECK_EVENT = 'omp:update-check';
43
+
33
44
  /**
34
45
  * Window event that opens the About modal and starts Kabmo update.
35
46
  *
@@ -0,0 +1,89 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The harness filter's two rules, in isolation.
8
+ *
9
+ * The failure mode is a list that lies: an entry whose count is about the current
10
+ * filter instead of the workspace, or a workspace drawn as an empty header
11
+ * because its rows were filtered away. Both are asserted here rather than
12
+ * through the mounted sidebar, which cannot tell a wrong count from a right one
13
+ * without the same arithmetic.
14
+ */
15
+
16
+ import { describe, expect, test } from 'bun:test';
17
+ import {
18
+ harnessFilterFolders,
19
+ harnessFilterOptions,
20
+ } from '@/shared/lib/workspace/harness-filter';
21
+ import type { SessionItemData, WorkspaceFolderData } from '@/shared/types';
22
+
23
+ function session(id: string, harness?: string): SessionItemData {
24
+ return { id, folder_id: 1, title: id, ...(harness ? { harness } : {}) };
25
+ }
26
+
27
+ function folder(id: number, sessions: SessionItemData[]): WorkspaceFolderData {
28
+ return { id, name: `ws-${id}`, isExpanded: false, hasMore: false, totalSessions: sessions.length, sessions };
29
+ }
30
+
31
+ describe('harnessFilterOptions', () => {
32
+ test('counts every harness over the whole list, most-used first', () => {
33
+ const folders = [
34
+ folder(1, [session('a', 'omp-rpc'), session('b', 'claude'), session('c', 'omp-rpc')]),
35
+ folder(2, [session('d', 'codex')]),
36
+ ];
37
+
38
+ expect(harnessFilterOptions(folders)).toEqual([
39
+ { harness: 'omp-rpc', label: 'omp', count: 2 },
40
+ { harness: 'claude', label: 'claude', count: 1 },
41
+ { harness: 'codex', label: 'codex', count: 1 },
42
+ ]);
43
+ });
44
+
45
+ test('a row with no harness belongs to no entry', () => {
46
+ const folders = [folder(1, [session('a'), session('b', 'claude')])];
47
+
48
+ expect(harnessFilterOptions(folders).map((option) => option.harness)).toEqual(['claude']);
49
+ });
50
+
51
+ test('an empty list has no entries', () => {
52
+ expect(harnessFilterOptions([])).toEqual([]);
53
+ });
54
+ });
55
+
56
+ describe('harnessFilterFolders', () => {
57
+ test('null returns the input untouched', () => {
58
+ const folders = [folder(1, [session('a', 'claude')])];
59
+
60
+ expect(harnessFilterFolders(folders, null)).toBe(folders);
61
+ });
62
+
63
+ test('keeps only the chosen harness and drops a workspace with nothing left', () => {
64
+ const folders = [
65
+ folder(1, [session('a', 'omp-rpc'), session('b', 'claude')]),
66
+ folder(2, [session('c', 'codex')]),
67
+ ];
68
+
69
+ const filtered = harnessFilterFolders(folders, 'claude');
70
+
71
+ expect(filtered.map((entry) => entry.id)).toEqual([1]);
72
+ expect(filtered[0]?.sessions.map((entry) => entry.id)).toEqual(['b']);
73
+ });
74
+
75
+ test('a row with no harness is not claimed by any filter', () => {
76
+ const folders = [folder(1, [session('a'), session('b', 'claude')])];
77
+
78
+ expect(harnessFilterFolders(folders, 'claude')[0]?.sessions.map((entry) => entry.id)).toEqual(['b']);
79
+ expect(harnessFilterFolders(folders, 'omp-rpc')).toEqual([]);
80
+ });
81
+
82
+ test('does not mutate the input folders', () => {
83
+ const folders = [folder(1, [session('a', 'omp-rpc'), session('b', 'claude')])];
84
+
85
+ harnessFilterFolders(folders, 'claude');
86
+
87
+ expect(folders[0]?.sessions).toHaveLength(2);
88
+ });
89
+ });
@@ -0,0 +1,75 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The sidebar's harness filter: which agent ran the chat.
8
+ *
9
+ * A harness is a SPAWN-time fact (`SessionItemData.harness`), so this is a
10
+ * filter over rows the server already sent — never a second query. A workspace
11
+ * with nothing left to show is dropped rather than drawn as an empty header,
12
+ * the same rule the search and focus filters follow.
13
+ *
14
+ * The options are counted over the UNFILTERED list, so an entry's number is a
15
+ * fact about the workspace rather than about what the current filter shows.
16
+ * That is what makes "3 claude" still readable while the list is narrowed to
17
+ * `codex`.
18
+ *
19
+ * A row with no harness (a session created before harnesses were tracked, or a
20
+ * MOCK row) belongs to no entry: inventing `omp-rpc` for it would claim a
21
+ * transport the row itself refuses to draw. It stays reachable through `All`.
22
+ */
23
+
24
+ import { harnessBadgeLabel } from '@/shared/lib/harness/catalog';
25
+ import type { WorkspaceFolderData } from '@/shared/types';
26
+
27
+ /** A harness id, or `null` for every harness. */
28
+ export type HarnessFilter = string | null;
29
+
30
+ export interface HarnessFilterOption {
31
+ harness: string;
32
+ /** The name a human reads (`omp`, `claude`, …). */
33
+ label: string;
34
+ /** Rows this harness owns in the unfiltered list. */
35
+ count: number;
36
+ }
37
+
38
+ /**
39
+ * The menu entries, most-used first.
40
+ *
41
+ * Ordering by count puts the agent the user actually works on at the top, where
42
+ * the eye lands; the label breaks ties so two harnesses with one row each do not
43
+ * swap places between renders.
44
+ */
45
+ export function harnessFilterOptions(folders: readonly WorkspaceFolderData[]): HarnessFilterOption[] {
46
+ const counts = new Map<string, number>();
47
+ for (const folder of folders) {
48
+ for (const session of folder.sessions) {
49
+ if (!session.harness) continue;
50
+ counts.set(session.harness, (counts.get(session.harness) ?? 0) + 1);
51
+ }
52
+ }
53
+ return [...counts]
54
+ .map(([harness, count]) => ({ harness, label: harnessBadgeLabel(harness), count }))
55
+ .sort((a, b) => b.count - a.count || a.label.localeCompare(b.label));
56
+ }
57
+
58
+ /**
59
+ * The folders a harness filter offers.
60
+ *
61
+ * `null` returns the input untouched — the caller compares by identity to know
62
+ * whether it has to re-expand anything.
63
+ */
64
+ export function harnessFilterFolders(
65
+ folders: readonly WorkspaceFolderData[],
66
+ filter: HarnessFilter,
67
+ ): WorkspaceFolderData[] {
68
+ if (!filter) return folders as WorkspaceFolderData[];
69
+ return folders
70
+ .map((folder) => ({
71
+ ...folder,
72
+ sessions: folder.sessions.filter((session) => session.harness === filter),
73
+ }))
74
+ .filter((folder) => folder.sessions.length > 0);
75
+ }
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import { describe, expect, test } from 'bun:test';
7
- import { buildSessionTree, descendantsOf } from '@/client/lib/session-tree';
7
+ import { buildSessionTree, descendantsOf } from '@/shared/lib/workspace/session-tree';
8
8
  import type { SessionItemData } from '@/shared/types';
9
9
 
10
10
  function session(id: string, parentSessionId?: string): SessionItemData {
@@ -13,6 +13,11 @@
13
13
  * when it sits past the window. A regression here is silent on screen (the row
14
14
  * simply is not there) and the label's count would be wrong by the same rows.
15
15
  *
16
+ * The windowed unit is a ROOT session, not a transcript: a child session is a
17
+ * row inside its parent's branch, so counting it against the page shrank the
18
+ * list the user sees (five rows of budget drew three top-level rows). The
19
+ * branch cases below are that bug, measured.
20
+ *
16
21
  * The `hiddenCount` cases are as load-bearing as the exemption ones: it feeds
17
22
  * "Show more sessions (n)", which must count only what the next click reveals.
18
23
  * The exempt rows are already rendered, so counting them overstates the
@@ -115,3 +120,69 @@ describe('selectVisibleSessions', () => {
115
120
  expect(second.hiddenCount).toBe(0);
116
121
  });
117
122
  });
123
+
124
+ /** `parent` with two children, in the sidebar's activity order. */
125
+ function rootWithChildren(
126
+ parent: number,
127
+ childIds: number[],
128
+ ): SessionItemData[] {
129
+ const root = makeSession(parent);
130
+ const children = childIds.map((id) => makeSession(id, { parentSessionId: String(parent) }));
131
+ return [root, ...children];
132
+ }
133
+
134
+ describe('selectVisibleSessions over branches', () => {
135
+ test('a child session does not consume a root slot', () => {
136
+ // Two roots, the first carrying two children: five transcripts, three rows.
137
+ const sessions = [
138
+ ...rootWithChildren(1, [2, 3]),
139
+ ...rootWithChildren(4, [5, 6]),
140
+ ];
141
+ const result = selectVisibleSessions(sessions, 2, { activeSessionId: null });
142
+
143
+ // Both roots stay, and each keeps its whole branch — the old flat window
144
+ // spent three of its five slots on one root plus two children.
145
+ expect(result.rendered.map((s) => s.id)).toEqual([1, 2, 3, 4, 5, 6]);
146
+ expect(result.hiddenCount).toBe(0);
147
+ });
148
+
149
+ test('a hidden root takes its branch with it, and counts as one row', () => {
150
+ const sessions = [
151
+ ...rootWithChildren(1, [2, 3]),
152
+ ...rootWithChildren(4, [5, 6]),
153
+ ...rootWithChildren(7, [8, 9]),
154
+ ];
155
+ const result = selectVisibleSessions(sessions, 2, { activeSessionId: null });
156
+
157
+ expect(result.rendered.map((s) => s.id)).toEqual([1, 2, 3, 4, 5, 6]);
158
+ // Next click reveals ONE row, the third root; its branch follows it.
159
+ expect(result.hiddenCount).toBe(1);
160
+ });
161
+
162
+ test('a live child keeps its ancestor chain and branch rendered', () => {
163
+ const sessions = [
164
+ ...rootWithChildren(1, [2, 3]),
165
+ ...rootWithChildren(4, [5, 6]),
166
+ ];
167
+ const status = { '5': 'stream' } as Record<string, string>;
168
+ const result = selectVisibleSessions(sessions, 1, { activeSessionId: null, sessionStatus: status });
169
+
170
+ // Root 1 is inside the window; root 4 is past it but its child is live, so
171
+ // the parent row that hosts the spinner is rendered too.
172
+ expect(result.rendered.map((s) => s.id)).toEqual([1, 2, 3, 4, 5, 6]);
173
+ expect(result.hiddenCount).toBe(0);
174
+ });
175
+
176
+ test('an opened grandchild keeps every ancestor row rendered', () => {
177
+ const sessions = [
178
+ makeSession(1),
179
+ makeSession(2, { parentSessionId: '1' }),
180
+ makeSession(3, { parentSessionId: '2' }),
181
+ makeSession(4),
182
+ ];
183
+ const result = selectVisibleSessions(sessions, 1, { activeSessionId: 3 });
184
+
185
+ expect(result.rendered.map((s) => s.id)).toEqual([1, 2, 3]);
186
+ expect(result.hiddenCount).toBe(1);
187
+ });
188
+ });
@@ -7,13 +7,20 @@
7
7
  * Sidebar session pagination, shared by the desktop workspace category and the
8
8
  * mobile drawer item.
9
9
  *
10
- * The list is truncated for height (`useShowMore`), but a session that is
11
- * OPENED or LIVE must never be one of the hidden rows: the row the operator is
12
- * reading, the run whose spinner is turning, and the run blocked on a question
13
- * are the states the sidebar exists to report. Those rows are rendered OUTSIDE
14
- * the window instead, so the list is `visibleCount` rows or longer exactly when
15
- * one of them sits past the boundary — never shorter, and never with a session
16
- * the user is watching missing from it.
10
+ * The list is truncated for height (`useShowMore`), and the unit of that window
11
+ * is a ROOT session — one row the sidebar actually draws — not a transcript.
12
+ * Child sessions are rows INSIDE their parent's branch, so letting them take
13
+ * page slots shrank the list the user sees: a folder with three roots whose two
14
+ * children sat inside the window drew two or three top-level rows while the
15
+ * label claimed five. The branch of every kept root travels with it, so a child
16
+ * session is never cut off by a boundary that was counted on its parent.
17
+ *
18
+ * A session that is OPENED or LIVE must never be one of the hidden rows: the
19
+ * row the operator is reading, the run whose spinner is turning, and the run
20
+ * blocked on a question are the states the sidebar exists to report. Such a
21
+ * session keeps its whole branch rendered — including the ancestors a collapsed
22
+ * branch would otherwise hide it behind — so the list is `visibleCount` roots
23
+ * or more exactly when one of them sits past the boundary, never shorter.
17
24
  *
18
25
  * The "opened or live" rule lives here rather than at either call site, because
19
26
  * the two sidebars are the same list on two layouts: one predicate means the
@@ -21,12 +28,13 @@
21
28
  * exempt from the window.
22
29
  */
23
30
 
31
+ import { buildSessionTree, descendantsOf } from '@/shared/lib/workspace/session-tree';
24
32
  import type { SessionItemData } from '@/shared/types';
25
33
 
26
34
  export interface SessionWindow {
27
35
  /** The rows to render, in the source order. */
28
36
  rendered: SessionItemData[];
29
- /** How many rows the next "Show more" click reveals. */
37
+ /** How many ROOT rows the next "Show more" click reveals. */
30
38
  hiddenCount: number;
31
39
  }
32
40
 
@@ -42,14 +50,14 @@ export interface SessionWindowContext {
42
50
  }
43
51
 
44
52
  /**
45
- * The first `count` sessions, plus every session that is OPENED or LIVE no
46
- * matter where it sits. Source order is preserved — an exempt row is never
47
- * lifted to the top, because the list is ordered by activity and moving one
48
- * would misreport that.
53
+ * The first `count` root sessions, each with its full branch, plus every root
54
+ * whose branch holds a session that is OPENED or LIVE. Source order is
55
+ * preserved — an exempt row is never lifted to the top, because the list is
56
+ * ordered by activity and moving one would misreport that.
49
57
  *
50
- * `hiddenCount` counts only the rows the next click actually reveals, which is
51
- * what the "Show more sessions (n)" label must print: the exempt rows are
52
- * already on screen and counting them would overstate the remainder.
58
+ * `hiddenCount` counts only the roots the next click actually reveals, which is
59
+ * what the "Show more sessions (n)" label must print: the branch of a hidden
60
+ * root has no row on screen yet, and an exempt branch is already rendered.
53
61
  */
54
62
  export function selectVisibleSessions(
55
63
  sessions: SessionItemData[],
@@ -57,20 +65,37 @@ export function selectVisibleSessions(
57
65
  { activeSessionId, sessionStatus = {} }: SessionWindowContext,
58
66
  ): SessionWindow {
59
67
  if (sessions.length <= count) return { rendered: sessions, hiddenCount: 0 };
60
- const rendered: SessionItemData[] = [];
61
- let hiddenCount = 0;
62
- for (let index = 0; index < sessions.length; index += 1) {
63
- const session = sessions[index];
68
+
69
+ const exemptIds = new Set<string>();
70
+ for (const session of sessions) {
64
71
  const key = String(session.id);
65
72
  // The same test the row itself uses to draw the highlight: the URL's
66
73
  // session when one is selected, else the row's own `is_active` flag (which
67
74
  // only MOCK's seeded rows ever carry — real mode writes 0 unconditionally).
68
75
  const isOpened =
69
76
  activeSessionId !== null ? String(activeSessionId) === key : session.is_active === 1;
70
- const exempt =
71
- isOpened || sessionStatus[key] === 'stream' || Boolean(session.awaitingInput);
72
- if (index < count || exempt) rendered.push(session);
73
- else hiddenCount += 1;
77
+ if (isOpened || sessionStatus[key] === 'stream' || Boolean(session.awaitingInput)) {
78
+ exemptIds.add(key);
79
+ }
80
+ }
81
+
82
+ const tree = buildSessionTree(sessions);
83
+ const keptIds = new Set<string>();
84
+ let hiddenCount = 0;
85
+
86
+ for (let index = 0; index < tree.roots.length; index += 1) {
87
+ const root = tree.roots[index];
88
+ const rootId = String(root.id);
89
+ const branch = descendantsOf(rootId, tree.childrenOf);
90
+ const exempt = exemptIds.has(rootId) || branch.some((row) => exemptIds.has(String(row.session.id)));
91
+ if (index < count || exempt) {
92
+ keptIds.add(rootId);
93
+ for (const row of branch) keptIds.add(String(row.session.id));
94
+ } else {
95
+ hiddenCount += 1;
96
+ }
74
97
  }
98
+
99
+ const rendered = sessions.filter((session) => keptIds.has(String(session.id)));
75
100
  return { rendered, hiddenCount };
76
101
  }