@kabmo-labs/kabmo 0.40.0 → 0.41.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 (197) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +360 -359
  3. package/dist/client/static/js/{CsvGrid-j9nvnhq1.js → CsvGrid-60njj97j.js} +2 -2
  4. package/dist/client/static/js/{DocxView-87gnpm81.js → DocxView-rsv0j46a.js} +1 -1
  5. package/dist/client/static/js/{DrawioView-a351t8f8.js → DrawioView-n2g5df3a.js} +1 -1
  6. package/dist/client/static/js/{ImageView-c139r891.js → ImageView-t330jx6y.js} +1 -1
  7. package/dist/client/static/js/LayoutWrapper-qp6nsw65.js +2 -0
  8. package/dist/client/static/js/{Modal-0weqfqvk.js → Modal-sbya4ahp.js} +9 -9
  9. package/dist/client/static/js/{PdfView-n6bwcvc8.js → PdfView-1r7a0qkp.js} +1 -1
  10. package/dist/client/static/js/SessionsView-yqs5m8tj.js +1 -0
  11. package/dist/client/static/js/{SheetView-k8ymr87w.js → SheetView-bt5pp042.js} +8 -8
  12. package/dist/client/static/js/{SvgPreview-5pcp444e.js → SvgPreview-vfmqgmrx.js} +1 -1
  13. package/dist/client/static/js/{abnfDiagram-O67JEVCF-psav75bx.js → abnfDiagram-O67JEVCF-8k5hk1yx.js} +1 -1
  14. package/dist/client/static/js/architecture-7GRP2DOG-1wqga929.js +1 -0
  15. package/dist/client/static/js/{architectureDiagram-NJMV4G6O-9bk6ykn7.js → architectureDiagram-NJMV4G6O-7jcb7fgy.js} +2 -2
  16. package/dist/client/static/js/{blockDiagram-BEXU5L5S-17xsf182.js → blockDiagram-BEXU5L5S-04sbtdth.js} +1 -1
  17. package/dist/client/static/js/{c4Diagram-YGBWAQC7-jn9j4n04.js → c4Diagram-YGBWAQC7-vwac9za0.js} +1 -1
  18. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-663z1g1r.js → classDiagram-v2-NBCMYWYE-18cc0bsb.js} +1 -1
  19. package/dist/client/static/js/{cose-bilkent-JH36ORCC-vp4yvx8x.js → cose-bilkent-JH36ORCC-dk683zvp.js} +1 -1
  20. package/dist/client/static/js/css-2re5mbea.js +1 -0
  21. package/dist/client/static/js/cynefin-OW5HDTMX-j2dpdgkh.js +1 -0
  22. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-dagkrjbh.js → cynefinDiagram-VND7K2PF-m2sx8d8s.js} +1 -1
  23. package/dist/client/static/js/{dagre-6A5THRUB-8qgwpb5a.js → dagre-6A5THRUB-qf3pr59p.js} +2 -2
  24. package/dist/client/static/js/{diagram-22UHCM2B-671xtp0d.js → diagram-22UHCM2B-twnz23mt.js} +1 -1
  25. package/dist/client/static/js/{diagram-3UASUU5V-8nn5fha8.js → diagram-3UASUU5V-417bas6t.js} +1 -1
  26. package/dist/client/static/js/{diagram-ATOU4E4O-dnar0ktg.js → diagram-ATOU4E4O-n63cpdnx.js} +1 -1
  27. package/dist/client/static/js/{diagram-CDSNMT55-bt0fhk7n.js → diagram-CDSNMT55-v86p14dd.js} +1 -1
  28. package/dist/client/static/js/{diagram-MLGK6HIB-tp6dwxdb.js → diagram-MLGK6HIB-7a0h1hs3.js} +1 -1
  29. package/dist/client/static/js/{diagram-MPIPVDR6-qgx8c8ee.js → diagram-MPIPVDR6-w75bftmd.js} +1 -1
  30. package/dist/client/static/js/{dockerfile-hk0s4qaw.js → dockerfile-g5qbaeq3.js} +1 -1
  31. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-nmf9r33z.js → ebnfDiagram-ZINNZB2B-vdzm3tsv.js} +1 -1
  32. package/dist/client/static/js/{elk-276RUBZZ-dheh5ngz.js → elk-276RUBZZ-2fsbb484.js} +1 -1
  33. package/dist/client/static/js/{erDiagram-OPXOYQCR-8837mk18.js → erDiagram-OPXOYQCR-vnkztq7d.js} +1 -1
  34. package/dist/client/static/js/{erlang-w9gmf866.js → erlang-jqqa3ehb.js} +1 -1
  35. package/dist/client/static/js/eventmodeling-NTZA5JFV-xjvjawd3.js +1 -0
  36. package/dist/client/static/js/flowDiagram-KWPJA3E3-j21f2bfg.js +1 -0
  37. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-g68mvnje.js → ganttDiagram-FUAMR5RP-pbvcch52.js} +1 -1
  38. package/dist/client/static/js/gitGraph-4MIJSDKK-r0zbk95f.js +1 -0
  39. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-ymk81cdj.js → gitGraphDiagram-X574FWY7-dkvktvzr.js} +1 -1
  40. package/dist/client/static/js/graphql-npbd9fdx.js +1 -0
  41. package/dist/client/static/js/{index-jy91r3ap.js → index-0c6vpk89.js} +2 -2
  42. package/dist/client/static/js/{index-js81yrmy.js → index-0xaz2eyv.js} +2 -2
  43. package/dist/client/static/js/{index-qnt118mp.js → index-1sw00wm0.js} +1 -1
  44. package/dist/client/static/js/{index-rvjc19x7.js → index-2z9wrb46.js} +1 -1
  45. package/dist/client/static/js/{index-ag78jnva.js → index-3rymer2w.js} +1 -1
  46. package/dist/client/static/js/{index-69xe17c1.js → index-4jk8ngjg.js} +2 -2
  47. package/dist/client/static/js/{index-q1bqg4f6.js → index-55hq7tnj.js} +1 -1
  48. package/dist/client/static/js/{index-547h1b8j.js → index-6fx2t6y7.js} +6 -6
  49. package/dist/client/static/js/{index-bgpcf3mr.js → index-7fwppdkn.js} +1 -1
  50. package/dist/client/static/js/{index-p2812ygk.js → index-7w3gqw2b.js} +1 -1
  51. package/dist/client/static/js/{index-2kg3r5jw.js → index-9dnkfpx4.js} +2 -2
  52. package/dist/client/static/js/{index-8ggxxp8c.js → index-9fnzcg2x.js} +1 -1
  53. package/dist/client/static/js/{index-y5hxhr7q.js → index-a4ed3mks.js} +1 -1
  54. package/dist/client/static/js/{index-g10nr8m6.js → index-ae91g8ka.js} +5 -5
  55. package/dist/client/static/js/{index-d1vearmk.js → index-ajjq0b8y.js} +2 -2
  56. package/dist/client/static/js/{index-ek7hqfp0.js → index-amawahyh.js} +2 -2
  57. package/dist/client/static/js/{index-wv36ddd5.js → index-b6cyn4hr.js} +19 -19
  58. package/dist/client/static/js/{index-aznkfx1z.js → index-c6kx7s6a.js} +1 -1
  59. package/dist/client/static/js/{index-9wjnbb3q.js → index-cytks03p.js} +2 -2
  60. package/dist/client/static/js/{index-b612vske.js → index-djv15k5s.js} +2 -2
  61. package/dist/client/static/js/{index-8888hgj8.js → index-ds6a2cx7.js} +4 -4
  62. package/dist/client/static/js/{index-qw5aqk2d.js → index-e6qjfcz9.js} +1 -1
  63. package/dist/client/static/js/{index-173x4bh0.js → index-e7yf273s.js} +2 -2
  64. package/dist/client/static/js/{index-y82bk3hr.js → index-efn233xp.js} +4 -4
  65. package/dist/client/static/js/index-esx3zwnt.js +1 -0
  66. package/dist/client/static/js/{index-4j1g7m8g.js → index-f8pq132s.js} +1 -1
  67. package/dist/client/static/js/{index-qntpsp98.js → index-fbbp5cwj.js} +1 -1
  68. package/dist/client/static/js/{index-bdz08fe2.js → index-g1cggqgx.js} +7 -7
  69. package/dist/client/static/js/{index-bj3wn9je.js → index-ghsdzs4m.js} +1 -1
  70. package/dist/client/static/js/{index-j4ks5s41.js → index-gs7ytgdw.js} +171 -171
  71. package/dist/client/static/js/{index-gx2xefdg.js → index-hz177dr2.js} +2 -2
  72. package/dist/client/static/js/{index-wy05jt00.js → index-j5ram1ve.js} +1 -1
  73. package/dist/client/static/js/{index-6wtx7a9x.js → index-ne131hmw.js} +1 -1
  74. package/dist/client/static/js/{index-vwc8pdy3.js → index-ngk9h0v9.js} +1 -1
  75. package/dist/client/static/js/{index-ek4gwrm8.js → index-ntcqyqd5.js} +2 -2
  76. package/dist/client/static/js/{index-4j5jwb54.js → index-pbsm2vw7.js} +2 -2
  77. package/dist/client/static/js/{index-wsqgp9jw.js → index-pfbyfab5.js} +1 -1
  78. package/dist/client/static/js/{index-vv9ytx0t.js → index-pn91shfp.js} +2 -2
  79. package/dist/client/static/js/{index-w130cs7d.js → index-qjsy6p86.js} +1 -1
  80. package/dist/client/static/js/{index-dj7y2df7.js → index-rdqn92tc.js} +1 -1
  81. package/dist/client/static/js/{index-c003wb3r.js → index-re1xz433.js} +1 -1
  82. package/dist/client/static/js/{index-mxpgfj6p.js → index-rebnv57p.js} +1 -1
  83. package/dist/client/static/js/{index-cccrappc.js → index-tgper3yy.js} +2 -2
  84. package/dist/client/static/js/{index-pp6mss9b.js → index-x2kb1kx5.js} +1 -1
  85. package/dist/client/static/js/{index-018ehs1n.js → index-xfa5hswh.js} +1 -1
  86. package/dist/client/static/js/{index-r1fe56cn.js → index-yq9vnd1y.js} +2 -2
  87. package/dist/client/static/js/{index-harsfp4x.js → index-zfykeg7x.js} +3 -3
  88. package/dist/client/static/js/{index-ys4t1am4.js → index-zye9309h.js} +2 -2
  89. package/dist/client/static/js/info-A6RAGUB7-a8xap43w.js +1 -0
  90. package/dist/client/static/js/{infoDiagram-VRGFBTTK-11trzn8c.js → infoDiagram-VRGFBTTK-mh6yks62.js} +1 -1
  91. package/dist/client/static/js/ini-df5bw23e.js +1 -0
  92. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-8xnnymb5.js → ishikawaDiagram-OU5B5YK6-hnfqppnv.js} +1 -1
  93. package/dist/client/static/js/java-8j33rj1p.js +1 -0
  94. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-wd47j0hy.js → journeyDiagram-ZHPQQLJL-s4nv1f3q.js} +2 -2
  95. package/dist/client/static/js/jsx-f6p72qpc.js +1 -0
  96. package/dist/client/static/js/{julia-c2q0vwpd.js → julia-yre4bxb9.js} +1 -1
  97. package/dist/client/static/js/{kanban-definition-PNTS6WVX-s5rgcp44.js → kanban-definition-PNTS6WVX-t8kbfefp.js} +7 -7
  98. package/dist/client/static/js/lua-bahx6qze.js +1 -0
  99. package/dist/client/static/js/markdown-9dhg1fax.js +1 -0
  100. package/dist/client/static/js/{mermaid.core-9fxp8nt2.js → mermaid.core-0784021p.js} +6 -6
  101. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-4fyewtst.js → mindmap-definition-NLK3R4M7-swkkze8c.js} +8 -8
  102. package/dist/client/static/js/one-dark-pro-h5tmw145.js +1 -0
  103. package/dist/client/static/js/one-light-x7vj1pxr.js +1 -0
  104. package/dist/client/static/js/packet-AYTQ26CC-b5bvg6v1.js +1 -0
  105. package/dist/client/static/js/{pegDiagram-GJSIUBJH-s2xe2e2k.js → pegDiagram-GJSIUBJH-jqayzh7z.js} +1 -1
  106. package/dist/client/static/js/{perl-6pa0tn3b.js → perl-weeskn1v.js} +1 -1
  107. package/dist/client/static/js/{php-1zy994pz.js → php-vf3045p9.js} +1 -1
  108. package/dist/client/static/js/pie-WAS4IAKB-77ee73zg.js +1 -0
  109. package/dist/client/static/js/{pieDiagram-5QR66LMP-1szpjbzy.js → pieDiagram-5QR66LMP-w03a65ky.js} +1 -1
  110. package/dist/client/static/js/properties-49mfnee4.js +1 -0
  111. package/dist/client/static/js/python-qb69wp1s.js +1 -0
  112. package/dist/client/static/js/{quadrantDiagram-O4NWA36T-mv3ee2qa.js → quadrantDiagram-O4NWA36T-2j7sfa9s.js} +1 -1
  113. package/dist/client/static/js/r-s3mf2tch.js +1 -0
  114. package/dist/client/static/js/radar-RG4KPBEZ-cp79xtvb.js +1 -0
  115. package/dist/client/static/js/railroad-74A4TZTK-dcpgqhcb.js +1 -0
  116. package/dist/client/static/js/railroad-abnf-HS5TGJTU-qasqv686.js +1 -0
  117. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-e46908rd.js +1 -0
  118. package/dist/client/static/js/railroad-peg-WCYAUIDC-7009t6bk.js +1 -0
  119. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-hgdqjpm9.js → railroadDiagram-XR7U4H2S-jtkkgy34.js} +1 -1
  120. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-yrfjp9wx.js → requirementDiagram-PLB6GJNP-t85ckjdb.js} +1 -1
  121. package/dist/client/static/js/{ruby-arvs7kz4.js → ruby-1a2ryzy6.js} +1 -1
  122. package/dist/client/static/js/{rust-3ahjk339.js → rust-736r0f0v.js} +1 -1
  123. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-k7k871xa.js → sankeyDiagram-IPEJSGJF-5pfkw8ne.js} +1 -1
  124. package/dist/client/static/js/{sass-cmkf7nwd.js → sass-tq4vw7hd.js} +1 -1
  125. package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-gd80m0as.js → sequenceDiagram-PO4LG4MO-55vs9zv5.js} +3 -3
  126. package/dist/client/static/js/{sizeCapture-INFHLROL-jv6p4834.js → sizeCapture-INFHLROL-pzqqd7f4.js} +1 -1
  127. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-tvphxq2h.js → stateDiagram-v2-GCMORJYK-6nhrph8n.js} +2 -2
  128. package/dist/client/static/js/{swimlanes-2SLR337P-3dt7nxj2.js → swimlanes-2SLR337P-6tcnxfbv.js} +1 -1
  129. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-7xrkrkpa.js +8 -0
  130. package/dist/client/static/js/{timeline-definition-EJHVYXUP-40vvf856.js → timeline-definition-EJHVYXUP-1dz46nt5.js} +2 -2
  131. package/dist/client/static/js/treeView-Q6P3EWNA-tpn62q8j.js +1 -0
  132. package/dist/client/static/js/treemap-WGGIJYW6-w910f1g4.js +1 -0
  133. package/dist/client/static/js/{usecaseDiagram-POWQR4AR-g1j5x0xh.js → usecaseDiagram-POWQR4AR-b3jfveq6.js} +1 -1
  134. package/dist/client/static/js/{vennDiagram-UO4OBE2U-5b8789qk.js → vennDiagram-UO4OBE2U-dnc3jqvp.js} +3 -3
  135. package/dist/client/static/js/wardley-WFR3VGLG-pt9tq808.js +1 -0
  136. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-c7x3za3w.js → wardleyDiagram-VNRHLVJA-466m8400.js} +1 -1
  137. package/dist/client/static/js/xml-wr1dxav5.js +1 -0
  138. package/dist/client/static/js/{xychartDiagram-PMCCYNJV-h0fy45tg.js → xychartDiagram-PMCCYNJV-kryrpqp1.js} +2 -2
  139. package/dist/client/static/js/yaml-0y9fdskg.js +1 -0
  140. package/package.json +1 -1
  141. package/src/client/components/layout/desktop-layout/LeftColumn.tsx +7 -0
  142. package/src/client/components/layout/session-sidebar/SessionsView.tsx +2 -1
  143. package/src/client/components/layout/session-sidebar/about-modal/index.test.tsx +1 -1
  144. package/src/client/components/mobile/SessionSidebar.tsx +4 -0
  145. package/src/client/components/workspace/chat-timeline/MessageList.test.ts +19 -19
  146. package/src/client/hooks/commands/use-command-runtime.ts +15 -0
  147. package/src/client/hooks/ui/updates/check-request.ts +41 -0
  148. package/src/client/hooks/ui/updates/index.ts +13 -5
  149. package/src/client/lib/native/run-command.test.ts +95 -0
  150. package/src/client/lib/native/run-command.ts +52 -0
  151. package/src/client/lib/router/open-session.test.ts +26 -1
  152. package/src/client/lib/router/open-session.ts +21 -0
  153. package/src/client/main.tsx +9 -0
  154. package/src/server/lib/changes/capture-shell.test.ts +253 -0
  155. package/src/server/lib/changes/capture-targets.test.ts +83 -0
  156. package/src/server/lib/changes/capture-targets.ts +51 -0
  157. package/src/server/lib/changes/capture-write.server.ts +2 -2
  158. package/src/server/lib/changes/capture.server.ts +14 -29
  159. package/src/server/lib/changes/capture.test.ts +69 -149
  160. package/src/server/lib/changes/patch-paths.ts +37 -0
  161. package/src/shared/lib/commands/catalog.test.ts +36 -0
  162. package/src/shared/lib/commands/catalog.ts +16 -0
  163. package/src/shared/lib/updates/popup-state.ts +11 -0
  164. package/dist/client/static/js/LayoutWrapper-08axzr3a.js +0 -2
  165. package/dist/client/static/js/SessionsView-awef8ehj.js +0 -1
  166. package/dist/client/static/js/architecture-7GRP2DOG-6rbq97t9.js +0 -1
  167. package/dist/client/static/js/css-zj4qzw6r.js +0 -1
  168. package/dist/client/static/js/cynefin-OW5HDTMX-zafxcz2k.js +0 -1
  169. package/dist/client/static/js/eventmodeling-NTZA5JFV-cq3dvz7e.js +0 -1
  170. package/dist/client/static/js/flowDiagram-KWPJA3E3-spzh2jxq.js +0 -1
  171. package/dist/client/static/js/gitGraph-4MIJSDKK-epgk26pj.js +0 -1
  172. package/dist/client/static/js/graphql-dewsj5g1.js +0 -1
  173. package/dist/client/static/js/index-dhrp656p.js +0 -1
  174. package/dist/client/static/js/info-A6RAGUB7-0an46pag.js +0 -1
  175. package/dist/client/static/js/ini-09e0scxh.js +0 -1
  176. package/dist/client/static/js/java-vnaesxzs.js +0 -1
  177. package/dist/client/static/js/jsx-xz71aed4.js +0 -1
  178. package/dist/client/static/js/lua-e4wenyzt.js +0 -1
  179. package/dist/client/static/js/markdown-yv3p1p7m.js +0 -1
  180. package/dist/client/static/js/one-dark-pro-ahch85zb.js +0 -1
  181. package/dist/client/static/js/one-light-9706jgqt.js +0 -1
  182. package/dist/client/static/js/packet-AYTQ26CC-5e397pav.js +0 -1
  183. package/dist/client/static/js/pie-WAS4IAKB-0zzmzg64.js +0 -1
  184. package/dist/client/static/js/properties-0ag74bdj.js +0 -1
  185. package/dist/client/static/js/python-zsn5tdbj.js +0 -1
  186. package/dist/client/static/js/r-mwtqhnw3.js +0 -1
  187. package/dist/client/static/js/radar-RG4KPBEZ-mtar9742.js +0 -1
  188. package/dist/client/static/js/railroad-74A4TZTK-d6a6j9fq.js +0 -1
  189. package/dist/client/static/js/railroad-abnf-HS5TGJTU-1257kd8x.js +0 -1
  190. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-v8b6qmas.js +0 -1
  191. package/dist/client/static/js/railroad-peg-WCYAUIDC-jxpbx410.js +0 -1
  192. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-aqnh1hhp.js +0 -8
  193. package/dist/client/static/js/treeView-Q6P3EWNA-q3qr7ew7.js +0 -1
  194. package/dist/client/static/js/treemap-WGGIJYW6-zgbdydeq.js +0 -1
  195. package/dist/client/static/js/wardley-WFR3VGLG-b230aajh.js +0 -1
  196. package/dist/client/static/js/xml-23y6pgvx.js +0 -1
  197. package/dist/client/static/js/yaml-vrayja34.js +0 -1
@@ -4,11 +4,10 @@
4
4
  */
5
5
 
6
6
  /**
7
- * The capture layer: a tool call's frames become journal records.
8
- *
9
- * The cases are the ones the feature exists for — an `edit`, a `write`, a
10
- * `bash rm`, a `sed -i`, a redirect — plus the two honest failures: an opaque
11
- * command is a `note`, and a subagent's write is attributed to the child.
7
+ * The capture layer, at the tool adapter: an `edit`, a `write` and an
8
+ * `apply_patch` become journal records, an ACP agent's arg spellings are read,
9
+ * and a write under the OS temp dir or a build directory is not journaled.
10
+ * The shell half (trace, scan, subagents) is `capture-shell.test.ts`.
12
11
  *
13
12
  * The fake filesystem is a `Map`, so the before/after pair is deterministic:
14
13
  * `flush()` after the start frame proves the snapshot ran before the test
@@ -21,7 +20,6 @@ import * as fsp from 'node:fs/promises';
21
20
  import * as os from 'node:os';
22
21
  import * as path from 'node:path';
23
22
  import { makeCapture, records, REPO } from '@/server/lib/changes/capture-test-util';
24
- import { ChangeJournal } from '@/server/lib/changes/journal.server';
25
23
  import { readSessionChangeDiff } from '@/server/lib/changes/reader.server';
26
24
 
27
25
  let dataDir = '';
@@ -135,199 +133,121 @@ describe('build paths', () => {
135
133
  });
136
134
  });
137
135
 
138
- describe('bash capture', () => {
139
- test('rm is a delete, from the trace argv', async () => {
140
- const files = new Map([[at('c.ts'), 'C']]);
141
- const capture = makeCapture('cap-rm', files);
136
+ describe('apply_patch', () => {
137
+ test('a patch names its paths and the change is recorded', async () => {
138
+ const files = new Map([[at('a.txt'), 'old']]);
139
+ const capture = makeCapture('cap-patch', files);
142
140
  capture.onFrame({
143
141
  type: 'tool_execution_start',
144
142
  toolCallId: 'c1',
145
- toolName: 'bash',
146
- args: { command: 'rm -f c.ts' },
143
+ toolName: 'apply_patch',
144
+ args: { input: '*** Begin Patch\n*** Update File: a.txt\n@@\n-old\n+new\n*** End Patch' },
147
145
  });
148
146
  await capture.flush();
149
- files.delete(at('c.ts'));
150
- capture.onFrame({
151
- type: 'tool_execution_end',
152
- toolCallId: 'c1',
153
- toolName: 'bash',
154
- result: { details: { trace: { status: 0, units: [{ nodes: [{ k: 'simple', argv: ['rm', '-f', 'c.ts'], st: 0 }] }] } } },
155
- });
147
+ files.set(at('a.txt'), 'new');
148
+ capture.onFrame({ type: 'tool_execution_end', toolCallId: 'c1', toolName: 'apply_patch' });
156
149
  await capture.flush();
157
150
 
158
- const diff = await readSessionChangeDiff('cap-rm', at('c.ts'), 0, WINDOW_END);
159
- expect(diff?.status).toBe('deleted');
160
- expect(diff?.oldContent).toBe('C');
161
- });
162
-
163
- test('sed -i is an update', async () => {
164
- const files = new Map([[at('d.ts'), 'a']]);
165
- const capture = makeCapture('cap-sed', files);
166
- capture.onFrame({
167
- type: 'tool_execution_start',
168
- toolCallId: 'c1',
169
- toolName: 'bash',
170
- args: { command: "sed -i 's/a/b/' d.ts" },
171
- });
172
- await capture.flush();
173
- files.set(at('d.ts'), 'b');
174
- capture.onFrame({
175
- type: 'tool_execution_end',
176
- toolCallId: 'c1',
177
- toolName: 'bash',
178
- result: { details: { trace: { status: 0, units: [{ nodes: [{ k: 'simple', argv: ['sed', '-i', 's/a/b/', 'd.ts'], st: 0 }] }] } } },
179
- });
180
- await capture.flush();
181
-
182
- const diff = await readSessionChangeDiff('cap-sed', at('d.ts'), 0, WINDOW_END);
183
- expect(diff?.status).toBe('modified');
184
- expect(diff?.oldContent).toBe('a');
185
- expect(diff?.newContent).toBe('b');
186
- });
187
-
188
- test('a redirect is a create the trace does not name', async () => {
189
- const files = new Map<string, string>();
190
- const capture = makeCapture('cap-redirect', files);
191
- capture.onFrame({
192
- type: 'tool_execution_start',
193
- toolCallId: 'c1',
194
- toolName: 'bash',
195
- args: { command: 'echo hi > e.txt' },
196
- });
197
- await capture.flush();
198
- files.set(at('e.txt'), 'hi\n');
199
- capture.onFrame({
200
- type: 'tool_execution_end',
201
- toolCallId: 'c1',
202
- toolName: 'bash',
203
- result: { details: { trace: { status: 0, units: [{ nodes: [{ k: 'simple', argv: ['echo', 'hi'], st: 0 }] }] } } },
204
- });
205
- await capture.flush();
206
-
207
- const diff = await readSessionChangeDiff('cap-redirect', at('e.txt'), 0, WINDOW_END);
208
- expect(diff?.status).toBe('added');
209
- expect(diff?.newContent).toBe('hi\n');
151
+ const change = (await records('cap-patch')).find((line) => line.type === 'change');
152
+ expect(change?.type).toBe('change');
153
+ if (change?.type !== 'change') throw new Error('expected a change');
154
+ expect(change.op).toBe('update');
155
+ expect(change.path).toBe(at('a.txt'));
210
156
  });
157
+ });
211
158
 
212
- test('an opaque command is a note, not a guess', async () => {
159
+ describe('ACP shell tools', () => {
160
+ test('exec_command with a command is captured as a shell call', async () => {
213
161
  const files = new Map<string, string>();
214
- const capture = makeCapture('cap-opaque', files);
162
+ const capture = makeCapture('cap-acp-exec', files);
215
163
  capture.onFrame({
216
164
  type: 'tool_execution_start',
217
165
  toolCallId: 'c1',
218
- toolName: 'bash',
219
- args: { command: 'bun test' },
166
+ toolName: 'exec_command',
167
+ args: { command: 'printf hello > a.txt', cwd: REPO },
220
168
  });
221
169
  await capture.flush();
222
- capture.onFrame({
223
- type: 'tool_execution_end',
224
- toolCallId: 'c1',
225
- toolName: 'bash',
226
- result: { details: { trace: { status: 0, units: [{ nodes: [{ k: 'simple', argv: ['bun', 'test'], st: 0 }] }] } } },
227
- });
170
+ files.set(at('a.txt'), 'hello');
171
+ capture.onFrame({ type: 'tool_execution_end', toolCallId: 'c1', toolName: 'exec_command' });
228
172
  await capture.flush();
229
173
 
230
- const lines = await records('cap-opaque');
231
- expect(lines.some((line) => line.type === 'change')).toBe(false);
232
- const note = lines.find((line) => line.type === 'note');
233
- expect(note?.type).toBe('note');
234
- if (note?.type !== 'note') throw new Error('expected a note');
235
- expect(note.reason).toBe('opaque-command');
174
+ const change = (await records('cap-acp-exec')).find((line) => line.type === 'change');
175
+ expect(change?.type).toBe('change');
176
+ if (change?.type !== 'change') throw new Error('expected a change');
177
+ expect(change.op).toBe('create');
178
+ expect(change.path).toBe(at('a.txt'));
236
179
  });
237
- });
238
180
 
239
- describe('scan pass', () => {
240
- test('an opaque git reset is reconciled from the two snapshots', async () => {
241
- const files = new Map([[at('g.ts'), 'old']]);
181
+ test('a shell tool named after the command is captured', async () => {
182
+ const files = new Map([[at('rm.txt'), 'hello']]);
242
183
  const scans = [
243
- { root: REPO, dirty: new Map([[at('g.ts'), 'old']]), truncated: false },
244
- { root: REPO, dirty: new Map([[at('g.ts'), 'new']]), truncated: false },
184
+ { root: REPO, dirty: new Map([[at('rm.txt'), 'hello']]), truncated: false },
185
+ { root: REPO, dirty: new Map<string, string | null>(), truncated: false },
245
186
  ];
246
- const capture = makeCapture('cap-scan', files, {
187
+ const capture = makeCapture('cap-acp-rm', files, {
247
188
  takeScan: async () => scans.shift() ?? null,
248
189
  readHead: async () => null,
249
190
  });
250
191
  capture.onFrame({
251
192
  type: 'tool_execution_start',
252
193
  toolCallId: 'c1',
253
- toolName: 'bash',
254
- args: { command: 'git reset --hard' },
194
+ toolName: 'rm -f rm.txt',
195
+ args: { command: "/bin/zsh -lc 'rm -f rm.txt'", cwd: REPO },
255
196
  });
256
197
  await capture.flush();
257
- files.set(at('g.ts'), 'new');
258
- capture.onFrame({
259
- type: 'tool_execution_end',
260
- toolCallId: 'c1',
261
- toolName: 'bash',
262
- result: { details: { trace: { status: 0, units: [{ nodes: [{ k: 'simple', argv: ['git', 'reset', '--hard'], st: 0 }] }] } } },
263
- });
198
+ files.delete(at('rm.txt'));
199
+ capture.onFrame({ type: 'tool_execution_end', toolCallId: 'c1', toolName: 'rm -f rm.txt' });
264
200
  await capture.flush();
265
201
 
266
- const diff = await readSessionChangeDiff('cap-scan', at('g.ts'), 0, WINDOW_END);
267
- expect(diff?.status).toBe('modified');
268
- expect(diff?.oldContent).toBe('old');
269
- expect(diff?.newContent).toBe('new');
202
+ const change = (await records('cap-acp-rm')).find((line) => line.type === 'change');
203
+ expect(change?.type).toBe('change');
204
+ if (change?.type !== 'change') throw new Error('expected a change');
205
+ expect(change.op).toBe('delete');
206
+ expect(change.path).toBe(at('rm.txt'));
270
207
  });
271
208
  });
272
209
 
273
- describe('cross-session scan', () => {
274
- test('a scan skips a path another session in the same cwd recorded', async () => {
275
- const other = new ChangeJournal('cap-other', REPO);
276
- await other.recordChange({
277
- at: Date.now(), agent: 'Main', tool: 'edit', op: 'update', path: at('file4.txt'),
278
- displayPath: 'file4.txt', before: 'a', after: 'b', source: 'tool',
279
- });
280
- await other.flush();
281
-
210
+ describe('ACP arg spellings', () => {
211
+ test('a write with filePath is recorded', async () => {
282
212
  const files = new Map<string, string>();
283
- const scans = [
284
- { root: REPO, dirty: new Map<string, string | null>(), truncated: false },
285
- { root: REPO, dirty: new Map([[at('file4.txt'), 'python']]), truncated: false },
286
- ];
287
- const capture = makeCapture('cap-cross', files, {
288
- takeScan: async () => scans.shift() ?? null,
289
- readHead: async () => null,
290
- });
213
+ const capture = makeCapture('cap-acp-write', files);
291
214
  capture.onFrame({
292
215
  type: 'tool_execution_start',
293
216
  toolCallId: 'c1',
294
- toolName: 'bash',
295
- args: { command: "python3 - <<'PY'\nopen('file4.txt','w').write('python')\nPY" },
217
+ toolName: 'write',
218
+ args: { filePath: 'a.txt', content: 'hello' },
296
219
  });
297
220
  await capture.flush();
298
- files.set(at('file4.txt'), 'python');
299
- capture.onFrame({
300
- type: 'tool_execution_end',
301
- toolCallId: 'c1',
302
- toolName: 'bash',
303
- result: { details: { trace: { status: 0, units: [{ nodes: [{ k: 'simple', argv: ['python3', '-'], st: 0 }] }] } } },
304
- });
221
+ files.set(at('a.txt'), 'hello');
222
+ capture.onFrame({ type: 'tool_execution_end', toolCallId: 'c1', toolName: 'write' });
305
223
  await capture.flush();
306
224
 
307
- const lines = await records('cap-cross');
308
- expect(lines.some((line) => line.type === 'change' && line.path === at('file4.txt'))).toBe(false);
225
+ const change = (await records('cap-acp-write')).find((line) => line.type === 'change');
226
+ expect(change?.type).toBe('change');
227
+ if (change?.type !== 'change') throw new Error('expected a change');
228
+ expect(change.op).toBe('create');
229
+ expect(change.path).toBe(at('a.txt'));
309
230
  });
310
- });
311
231
 
312
- describe('subagents', () => {
313
- test('a child edit is attributed to the child', async () => {
314
- const files = new Map([[at('f.ts'), 'old']]);
315
- const capture = makeCapture('cap-sub', files);
232
+ test('an edit with oldString/newString is reconstructed', async () => {
233
+ const files = new Map([[at('b.txt'), 'old']]);
234
+ const capture = makeCapture('cap-acp-edit', files);
316
235
  capture.onFrame({
317
- type: 'subagent_event',
318
- payload: { type: 'tool_execution_start', toolCallId: 's1', toolName: 'edit', args: { path: 'f.ts' }, agent: 'Child' },
236
+ type: 'tool_execution_start',
237
+ toolCallId: 'c1',
238
+ toolName: 'edit',
239
+ args: { filePath: 'b.txt', oldString: 'old', newString: 'new' },
319
240
  });
320
241
  await capture.flush();
321
- files.set(at('f.ts'), 'new');
322
- capture.onFrame({
323
- type: 'subagent_event',
324
- payload: { type: 'tool_execution_end', toolCallId: 's1', toolName: 'edit', agent: 'Child' },
325
- });
242
+ files.set(at('b.txt'), 'new');
243
+ capture.onFrame({ type: 'tool_execution_end', toolCallId: 'c1', toolName: 'edit' });
326
244
  await capture.flush();
327
245
 
328
- const change = (await records('cap-sub')).find((line) => line.type === 'change');
246
+ const change = (await records('cap-acp-edit')).find((line) => line.type === 'change');
329
247
  expect(change?.type).toBe('change');
330
248
  if (change?.type !== 'change') throw new Error('expected a change');
331
- expect(change.agent).toBe('Child');
249
+ expect(change.op).toBe('update');
250
+ expect(change.path).toBe(at('b.txt'));
332
251
  });
333
252
  });
253
+
@@ -0,0 +1,37 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * Paths named by an `apply_patch` payload.
8
+ *
9
+ * The codex/Claude patch tool sends the patch as text (`args.input`,
10
+ * `args.patch`, `args.patchText`), not as a path. The headers are the only
11
+ * place the paths appear:
12
+ *
13
+ * *** Begin Patch
14
+ * *** Update File: src/a.ts
15
+ * *** Add File: src/b.ts
16
+ * *** Delete File: src/c.ts
17
+ * *** Move to: src/d.ts
18
+ * *** End Patch
19
+ *
20
+ * A `Move to` names the destination; the source is the preceding `Update File`
21
+ * header, so both are returned and the capture snapshots both sides.
22
+ */
23
+
24
+ const FILE_HEADER = /^\*\*\* (?:Update|Add|Delete) File: (.+)$/;
25
+ const MOVE_HEADER = /^\*\*\* Move to: (.+)$/;
26
+
27
+ export function patchPaths(text: string): string[] {
28
+ const paths: string[] = [];
29
+ for (const line of text.split('\n')) {
30
+ const trimmed = line.trim();
31
+ const file = FILE_HEADER.exec(trimmed);
32
+ if (file?.[1]) paths.push(file[1].trim());
33
+ const move = MOVE_HEADER.exec(trimmed);
34
+ if (move?.[1]) paths.push(move[1].trim());
35
+ }
36
+ return paths;
37
+ }
@@ -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',
@@ -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
  *
@@ -1,2 +0,0 @@
1
- import{d,n,o,W,i,u,a,Ke,le,fn,Jl,e,Kn,Os,Ze,Se,Xt,Zg,$a,Fp,s,Qe,Be,m,en,_,Xe,tn,f,B,ie,et,re,fe,Et,qe,sn,ge,Ge,de,va,Kr,ln,ka,Y,D,O,Us,b,un,Gs,Pe,Bt,Eo,pe,J,it,Vi,Yi,Hu,ec,Ie,je,Zi,BA,rc,Wt,Kt,_t,oc,Vs,_o,Ys,Js,To,bt,St,ta,He,el,kc,xc,Ia,wc,hm,_a,Qo,No,Ro,vt,Xn,ls,Fo,Lo,Mo,nl,Va,rl,al,Ir,Dm,Qm,Po,_c,Rm,Fm,Lm,Sc,er,_r,Oo,$o,Mm,Tc,Ya,Pm,Om,$m,ih,rd,sh,ct,ad,zm,Um,Gm,ol,pg,rf,Qc,pl,uf,df,fd,pf,Ch}from"./index-j4ks5s41.js";import{Mc,Pc,Oc,$c,zc,Uc,Gc,bd,ds,Uo,ps,gi,qc,ml,Hc,Wc,Kc,Vc,Yc,Jc,Zc,Xc,eu}from"./index-bdz08fe2.js";import{Pu,Ou,Jo,$u,zu}from"./index-pp6mss9b.js";import{kt,Ai,nu,ru,ou}from"./index-qntpsp98.js";import{gs,Ta,Nr,hl,iu,su,Go,lu,As,_d,wg,hs,bs,Rr,ys,vs,jo,ks,xs,ws,Cs,bi,Es,Bs,Is,cu,Sd,uu,du,pu,mu,fu,gu,Au,hu}from"./index-y82bk3hr.js";import{bu}from"./index-4j5jwb54.js";import{Qa,Na}from"./index-wsqgp9jw.js";function eo(t){let{editorOpen:r,diffOpen:c,settingsOpen:p,offMainScreen:h,onCloseEditor:g,onCloseDiff:v,onCloseSettings:S,onReturnToMain:k}=t;o(()=>Ch(()=>{if(r)return g(),!0;if(c)return v(),!0;if(p)return S(),!0;if(h)return k(),!0;return!1}),[r,c,p,h,g,v,S,k])}var lt={name:"menu",size:24,node:[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]},oo=s(lt);function ze(){let t=Zi(),[r,c]=n(null),p=a((v,S)=>{c({top:S,bottom:S,left:v,right:v})},[]),h=Pu({enabled:t,onLongPress:p}),g=a(()=>c(null),[]);return{anchor:r,close:g,surfaceProps:{onContextMenu:(v)=>{v.preventDefault();let S=v.currentTarget.getBoundingClientRect();c({top:S.top,bottom:S.bottom,left:S.left,right:S.right})},onTouchStart:h.onTouchStart,onTouchMove:h.onTouchMove,onTouchEnd:h.onTouchEnd,onTouchCancel:h.onTouchCancel,onClickCapture:(v)=>{if(!h.consume())return;v.preventDefault(),v.stopPropagation()}}}}var dt=10,to=600000;function no({activeSessionTitle:t,activeSessionId:r,onOpenSessionSidebar:c,onOpenRightSidebar:p,onNewSession:h,onSelectSession:g}){let{folders:v}=He(),S=fd(),k=_a(r),[l,x]=n(null),{hidden:N,setHidden:P}=zm(),y=ze(),E=u(()=>{let w=Date.now(),C=[];for(let A of v)for(let T of A.sessions??[]){if(T.is_archived===1)continue;let I=Zg(String(T.id)),z=T.updated_at?Date.parse(T.updated_at):0,j=I!==void 0&&w-I<=to?I:z;if(I!==void 0&&w-I>to)continue;C.push({id:T.id,title:T.title,folderName:A.name,modified:j})}return C.sort((A,T)=>T.modified-A.modified).slice(0,dt)},[v]),R=t?t.charAt(0).toUpperCase()+t.slice(1):"New session";return e("header",{className:`flex-shrink-0 bg-canvas border-b border-ink/10 flex items-center justify-between ${nl} px-3 z-20 titlebar-drag-region select-none`,...Oo(),...y.surfaceProps,style:{height:"calc(3.5rem + env(safe-area-inset-top, 0px))",paddingLeft:$o(er("0.75rem",!0)),paddingRight:_r("0.75rem",!0),paddingTop:"env(safe-area-inset-top, 0px)"},children:[e("div",{className:"flex items-center space-x-2 flex-1 min-w-0 titlebar-no-drag",children:[e("button",{type:"button",onClick:c,className:"w-9 h-9 rounded-lg hover:bg-ink/5 active:bg-ink/10 text-ink transition-colors flex-shrink-0 inline-flex items-center justify-center",title:"Open Sessions","aria-label":"Open Sessions",children:e(oo,{size:20,strokeWidth:2})}),e("span",{className:"relative font-bold text-sm tracking-tight flex items-center flex-shrink-0",children:[e(Ia,{glow:!0}),e("span",{className:"absolute -top-0.5 -right-1.5 flex",children:e(Sc,{status:S})})]}),e("span",{className:"text-ink/25 font-light text-xs flex-shrink-0 select-none",children:"/"}),e("div",{className:"relative min-w-0 flex-1 max-w-[150px]","data-testid":"session-picker",children:[e("button",{type:"button",onClick:(w)=>{x((C)=>C?null:Wt(w.currentTarget))},className:"tap-chip flex w-full items-center space-x-1 text-xs font-semibold text-ink hover:text-ink/80 transition-colors py-1 min-w-0",title:R,"aria-haspopup":"menu","aria-expanded":l!==null,children:[e("span",{className:"truncate",children:R}),k&&e(m,{size:12,className:"animate-spin text-ink/50 flex-shrink-0",role:"status","aria-label":"Generating a session name…"}),e(B,{size:13,className:"text-ink/50 flex-shrink-0"})]}),l&&e(Kt,{anchor:l,align:"start",className:"w-72 bg-paper border border-ink/15 rounded-xl shadow-lg p-2 text-xs",onClose:()=>x(null),children:[e("button",{type:"button",onClick:()=>{x(null),h()},className:"w-full text-left px-3 py-2 rounded-lg bg-ink text-canvas flex items-center space-x-2 font-medium mb-1.5 active:scale-98",children:[e(Y,{size:14}),e("span",{children:"Start New Session"})]}),e("div",{className:"px-2 py-1 text-[10px] uppercase font-bold text-ink/40",children:"Recent Sessions"}),e("div",{className:"max-h-64 scrollbar-overlay-container space-y-0.5",children:E.length===0?e("div",{className:"px-2.5 py-2 text-ink/40 italic",children:"No sessions yet"}):E.map((w)=>e("button",{type:"button",onClick:()=>{x(null),g(w.id)},className:`w-full text-left px-2.5 py-1.5 rounded-lg flex items-center justify-between space-x-2 transition-colors ${String(r)===String(w.id)?"bg-ink/10 font-semibold text-ink":"hover:bg-ink/5 text-ink/80"}`,children:[e("span",{className:"min-w-0 flex flex-col",children:[e("span",{className:"truncate",children:w.title?w.title.charAt(0).toUpperCase()+w.title.slice(1):"Untitled"}),e("span",{className:"truncate text-[10px] text-ink/40 font-mono",children:w.folderName})]}),String(r)===String(w.id)&&e(f,{size:12,className:"flex-shrink-0"})]},w.id))})]})]})]}),e(Um,{layout:"mobile",sessionId:r==null?null:String(r),showRightPanel:!1,onToggleRightPanel:p,hidden:N}),y.anchor?e(Po,{anchor:y.anchor,title:"Navbar",align:"right",items:ad.filter((w)=>w.id!==ct.install&&w.id!==ct.editor&&w.id!==ct.mobile).map((w)=>({...w,removable:!0})),hidden:N,onToggle:P,onClose:y.close}):null]})}function io({activeSessionId:t,onSelectSession:r,onNewSession:c,onOpenSessionSidebar:p,onOpenRightSidebar:h,appSettings:g={}}){let{folders:v}=He(),[S,k]=n(null),l=u(()=>{if(!t)return"New session";for(let N of v){let P=N.sessions?.find((y)=>String(y.id)===String(t));if(P)return P.title}return null},[t,v]);return e("div",{className:"flex flex-col h-full w-full bg-canvas text-ink relative",children:[e(no,{activeSessionTitle:S||l||"New session",activeSessionId:t,onOpenSessionSidebar:p,onOpenRightSidebar:h,onNewSession:c,onSelectSession:r}),e("main",{className:"flex-1 min-h-0",children:e(rf,{appSettings:g,onSessionTitle:k,variant:"mobile"})})]})}function ro({onClose:t,viewLabel:r="Sessions",menuProps:c}){return e("div",{className:"border-b border-ink/10 flex items-center justify-between px-3 flex-shrink-0 bg-canvas titlebar-drag-region select-none",...Oo(),...c,style:{height:"calc(3.5rem + env(safe-area-inset-top, 0px))",paddingLeft:$o(er("0.75rem",!0)),paddingRight:_r("0.75rem",!0),paddingTop:"env(safe-area-inset-top, 0px)"},children:[e("div",{className:"flex items-center space-x-2.5 titlebar-no-drag min-w-0",children:[e("span",{className:"font-bold text-sm tracking-tight flex items-center flex-shrink-0",children:e(Ia,{className:"text-[16px]",glow:!0})}),e("span",{className:"text-ink/25 text-xs select-none flex-shrink-0",children:"/"}),e("span",{className:"text-[11px] font-semibold text-ink/60 uppercase tracking-wider font-mono truncate",children:r})]}),e("div",{className:"flex items-center gap-1 titlebar-no-drag flex-shrink-0",children:[e(Gm,{variant:"chip"}),e("button",{type:"button",onClick:t,className:"w-9 h-9 rounded-xl hover:bg-ink/5 active:bg-ink/10 text-ink flex items-center justify-center transition-colors cursor-pointer",title:"Close sidebar","aria-label":"Close sidebar",children:e(b,{size:19,strokeWidth:2})})]})]})}var Ne="w-9.5 h-9.5 rounded-xl border active:scale-95 flex items-center justify-center transition-all flex-shrink-0 cursor-pointer shadow-xs",Ce="border-ink/15 bg-paper hover:bg-ink/5 text-ink/80 hover:text-ink",so="bg-ink/10 text-ink border-ink/30";function ao({searchQuery:t,sortOption:r,optionsOpen:c,showArchived:p,optionsRef:h,onNewSession:g,onNewWorkspace:v,onScheduler:S,scheduledCount:k,onRefresh:l,refreshing:x,onToggleOptions:N,onSortChange:P,onResetSort:y,onToggleArchived:E,onHideArchived:R,onSearchChange:w,onClearSearch:C,onSelectWorkspaces:A,selecting:T}){let{ref:I,width:z}=As(0),j=wg(z),G={};for(let X of _d.slice(0,j))G[X]=!0;let K=_d.slice(j),M=p?"Hide archived sessions":"Show archived sessions",ee=k>0?`Scheduled tasks (${k} armed)`:"Scheduled tasks",Z=[];if(K.includes("new-workspace"))Z.push({id:"new-workspace",label:"New Workspace",icon:sn,onSelect:v});if(K.includes("refresh"))Z.push({id:"refresh",label:"Refresh sessions",icon:D,onSelect:l});if(K.includes("scheduler"))Z.push({id:"scheduler",label:ee,icon:Ta,onSelect:S});if(K.includes("archive"))Z.push({id:"archive",label:M,icon:Xe,onSelect:E,active:p});if(K.includes("select"))Z.push({id:"select",label:T?"Cancel selection":"Select workspaces",icon:Nr,onSelect:A,active:T});return e("div",{className:"p-3 border-b border-ink/10 flex flex-col space-y-2.5 flex-shrink-0 bg-canvas",children:[e("div",{ref:I,className:"flex items-center space-x-2",children:[e("button",{type:"button",onClick:g,"aria-label":"New Session",title:"New Session",className:"flex-1 min-w-0 h-9.5 flex items-center justify-center space-x-2 px-3.5 rounded-xl bg-ink text-canvas hover:bg-ink/90 active:scale-[0.98] text-xs font-semibold transition-all shadow-xs",children:[e(Y,{size:15,strokeWidth:2.4,className:"shrink-0"}),e("span",{className:"min-w-0 truncate",children:"New Session"})]}),G["new-workspace"]&&e("button",{type:"button",onClick:v,className:`${Ne} ${Ce}`,title:"New Workspace","aria-label":"New Workspace",children:e(sn,{size:16,strokeWidth:1.8})}),G.scheduler&&e("button",{type:"button",onClick:S,className:`relative ${Ne} ${Ce}`,title:ee,"aria-label":k>0?`Scheduled tasks, ${k} armed`:"Scheduled tasks",children:[e(Ta,{size:16,strokeWidth:1.8}),k>0&&e("span",{className:"absolute -top-0.5 -right-0.5 min-w-[13px] h-[13px] px-[3px] rounded-full bg-ink text-canvas text-[10px] leading-[13px] text-center font-semibold",children:k>9?"9+":k})]}),G.archive&&e("button",{type:"button",onClick:E,"aria-pressed":p,className:`${Ne} ${p?"bg-warning/15 border-warning/40 text-warning":Ce}`,title:M,"aria-label":M,children:e(Xe,{size:16,strokeWidth:1.8})}),G.select&&e("button",{type:"button",onClick:A,"aria-pressed":T,className:`${Ne} ${T?so:Ce}`,title:T?"Cancel selection":"Select workspaces","aria-label":T?"Cancel selection":"Select workspaces",children:e(Nr,{size:16,strokeWidth:1.8})}),G.refresh&&e("button",{type:"button",onClick:l,className:`${Ne} ${Ce}`,title:"Refresh sessions","aria-label":"Refresh sessions","aria-busy":x,children:e(D,{size:15,strokeWidth:1.8,className:x?"animate-spin":void 0})}),G.sort&&e("div",{className:"relative flex-shrink-0",ref:h,children:[e("button",{type:"button",onClick:N,className:`${Ne} ${c||r!=="A-Z"?so:Ce}`,title:"Sort workspaces","aria-label":"Sort workspaces",children:e(gs,{size:15,strokeWidth:1.8})}),c&&e("div",{className:"glass-popover absolute right-0 top-full mt-2 w-52 bg-paper border border-ink/15 rounded-xl shadow-xl z-50 p-2 text-xs",children:e(Go,{variant:"mobile",sortOption:r,onSortChange:P})})]}),K.length>0&&e(lu,{actions:Z,sortHidden:K.includes("sort"),sortOption:r,onSortChange:P,layout:"mobile"})]}),e("div",{className:"relative flex items-center",children:[e(O,{size:14,className:"absolute left-3 text-ink/40"}),e("input",{type:"text",value:t,onChange:(X)=>w(X.currentTarget.value),placeholder:"Search workspaces & sessions...",className:"w-full bg-paper border border-ink/15 rounded-xl pl-8 pr-8 py-2 text-xs text-ink placeholder-ink/40 focus:outline-none focus:border-ink/40 transition-colors font-mono"}),t&&e("button",{type:"button",onClick:C,className:"absolute right-2.5 text-ink/40 hover:text-ink p-1","aria-label":"Clear search",children:e(b,{size:13})})]}),(p||r!=="A-Z")&&e("div",{className:"flex items-center space-x-1.5 flex-wrap gap-y-1 pt-0.5",children:[r!=="A-Z"&&e("span",{className:"inline-flex items-center space-x-1 bg-ink/5 border border-ink/10 text-ink/80 rounded-lg px-2 py-0.5 text-[10px] font-mono",children:[e("span",{children:["Sort: ",r.replace("_"," ")]}),e("button",{type:"button",onClick:y,className:"hover:text-ink ml-0.5",title:"Reset sort",children:e(b,{size:10})})]}),p&&e("span",{className:"inline-flex items-center space-x-1 bg-warning/15 border border-warning/25 text-warning rounded-lg px-2 py-0.5 text-[10px] font-mono",children:[e(Xe,{size:10}),e("span",{children:"Archived"}),e("button",{type:"button",onClick:R,className:"hover:text-warning-hover ml-0.5",title:"Hide archived",children:e(b,{size:10})})]})]})]})}var pt="p-1.5 rounded-lg hover:bg-ink/10 active:bg-ink/15 text-ink/60 hover:text-ink";function lo({folder:t,canWorktree:r,onOpenFolder:c,onNewWorktree:p,onSelectSessions:h,confirmDelete:g,onPin:v,onDelete:S,onRequestDelete:k,onCancelDelete:l}){let[x,N]=n(!1),P=i(null),[y,E]=n(null),R=(w)=>()=>{N(!1),w()};return e("div",{className:"relative flex items-center",onClick:(w)=>w.stopPropagation(),children:[e("button",{ref:P,type:"button",onClick:(w)=>{if(w.stopPropagation(),P.current)E(Wt(P.current));N((C)=>!C)},className:pt,title:"Workspace options","aria-label":`Options for ${t.name}`,"aria-haspopup":"menu","aria-expanded":x,children:e(Be,{size:15})}),e(Kt,{anchor:x?y:null,align:"end",ariaLabel:`Options for ${t.name}`,className:"w-48 rounded-lg border border-ink/15 bg-paper py-1 text-xs shadow-lg",onClose:()=>{N(!1),l()},children:e(ws,{variant:"mobile",isPinned:t.isPinned,onOpenFolder:c?R(c):void 0,onNewWorktree:r&&p?R(p):void 0,onSelectSessions:h?R(h):void 0,confirmDelete:g,onPin:R(v),onDelete:R(S),onRequestDelete:k,onCancelDelete:l})})]})}var co={inset:"",insetPx:0,slotWidth:16,markGap:8,padding:"py-2",glyph:St.touch};function po({session:t,harness:r,isActive:c,status:p,awaitingInput:h=!1,timeAgo:g,timeTitle:v,runStartedAt:S,expandable:k=!1,isExpanded:l=!1,onToggleExpand:x,isChild:N=!1,folderId:P,onSelect:y,onArchive:E,onDelete:R,onRename:w,onRenameWithAi:C,waitingFor:A,onCancelWait:T,selectable:I=!1,selected:z=!1,onToggleSelect:j}){let{isEditing:G,draft:K,setDraft:M,inputRef:ee,startRename:Z,handleKeyDown:X,handleBlur:ue}=Ro(t.title,w),ae=_a(t.id),oe=Fo(),te=oe.anchor!==null,q=Boolean(w||E||R||T),U=Boolean(A),ce=k&&Boolean(x),ne=t.title.charAt(0).toUpperCase()+t.title.slice(1);if(G)return e("div",{className:"w-full rounded-lg flex items-center bg-ink/10",children:e("input",{ref:ee,autoFocus:!0,value:K,onChange:(me)=>M(me.currentTarget.value),onKeyDown:X,onBlur:ue,className:"flex-1 min-w-0 mx-2 my-1.5 bg-paper border border-ink/25 rounded px-2 py-1 text-xs text-ink outline-none focus:border-ink/50"})});return e(d,{children:[e("div",{"data-testid":"session-item","data-session-id":String(t.id),"data-menu-open":te?"true":void 0,onContextMenu:q&&!I?oe.openAtCursor:void 0,className:`w-full rounded-lg flex items-center transition-colors ${I&&z||te?xs:c?"bg-ink/10 font-medium text-ink":"hover:bg-ink/5 text-ink/85"}`,children:[e("button",{type:"button",onClick:I?j:y,className:"flex-1 text-left py-2 flex items-center justify-between min-w-0",children:[e("div",{className:"flex items-center min-w-0 pr-2",children:[I?e(Rr,{checked:z,label:`Select ${t.title}`,onChange:()=>j?.()}):e("span",{className:"w-4 flex-shrink-0 flex items-center justify-center",children:ae?e("span",{role:"status","aria-label":"Generating a name…",children:e(m,{size:13,className:"text-ink/50 animate-spin"})}):h?e(Qe,{size:13,className:"text-ink/70 animate-pulse"}):U?e("span",{role:"status","aria-label":`Waiting for ${A?.title??"another session"}`,children:e(Ge,{size:13,className:"text-ink/60 animate-pulse"})}):p==="stream"?e("span",{role:"status","aria-label":"Running",children:e(m,{size:13,className:"text-ink/50 animate-spin"})}):p?e(f,{size:13,className:"text-ink/50"}):N?e("span",{"data-testid":"child-indicator",className:"text-ink/35","aria-hidden":"true",children:e(ge,{size:13})}):null}),e("span",{className:"flex flex-col min-w-0 ml-2 leading-snug",children:[e("span",{className:"flex min-w-0 items-center",children:[r&&e("span",{className:"mr-1.5 flex shrink-0 items-center",children:e(bt,{harness:r,size:St.touch})}),e("span",{className:"min-w-0 truncate text-xs",children:ne})]}),U&&e("span",{className:"text-[10px] text-ink/40 truncate",children:["waiting for ",A?.title??"another session"]}),t.worktree?e(ys,{worktree:t.worktree}):null]})]}),e(ks,{timeAgo:g,timeTitle:v,runStartedAt:S,className:"text-[11px] font-mono flex-shrink-0 ml-2",restingClassName:"text-ink/45"})]}),q&&!I&&e("button",{type:"button",onClick:oe.openBelow,title:"Session actions","aria-label":"Session actions","aria-haspopup":"menu","aria-expanded":te,className:"flex-shrink-0 py-1.5 pl-1.5 pr-1 text-ink/35 hover:text-ink rounded-lg cursor-pointer",children:e(Be,{size:16})}),ce&&!I&&e("button",{type:"button",onClick:x,title:l?"Collapse sessions and subagents":"Expand sessions and subagents","aria-expanded":l,"aria-label":l?"Collapse sessions and subagents":"Expand sessions and subagents",className:"flex-shrink-0 py-1.5 pl-1.5 pr-1 flex items-center justify-center text-ink/50 hover:text-ink rounded-lg cursor-pointer",children:l?e(B,{size:14}):e(ie,{size:14})})]}),oe.anchor&&e(Lo,{anchor:oe.anchor,sessionId:t.id,...r?{harness:r}:{},...P!==void 0?{folderId:P}:{},isArchived:t.is_archived===1,onRename:w?Z:void 0,onRenameWithAi:C,onArchive:E,onDelete:R,onCancelWait:T,onClose:oe.close})]})}function mo(t,r){let[c,p]=n(!1);return{open:()=>p(!0),dialog:c?e(Mo,{isOpen:!0,onClose:()=>p(!1),root:t.project_path??null,folderId:t.id,folderName:t.name,onCreated:(h)=>{p(!1),r(h.path)}}):null}}function uo({hiddenCount:t,canShowLess:r,onShowMore:c,onShowLess:p}){if(t<=0&&!r)return null;return e("div",{className:"flex items-center gap-1",children:[t>0&&e("button",{type:"button",onClick:c,className:"flex items-center min-w-0 text-left py-2 pr-3 text-xs text-ink/60 hover:text-ink",children:[e("span",{className:"w-4 h-4 flex-shrink-0 flex items-center justify-center",children:e(B,{size:12})}),e("span",{className:"w-2 shrink-0"}),e("span",{className:"truncate",children:["Show more sessions (",t,")"]})]}),r&&e("button",{type:"button",onClick:p,className:"ml-auto shrink-0 flex items-center gap-1 text-xs text-ink/60 hover:text-ink pl-3 py-2",children:[e(et,{size:12}),e("span",{className:"truncate",children:"Show less"})]})]})}function fo(t){return t?"mb-4":"mb-1"}function ho({folder:t,activeSessionId:r,onSelectSession:c,onNewSessionForFolder:p,onNewWorktreeSession:h,isExpanded:g,onToggleExpand:v,showArchived:S=!1,sessionStatus:k={},onToast:l,batch:x,onStartSessionSelection:N,onCancelWait:P}){let{visibleCount:y,showMore:E,showLess:R,canShowLess:w}=hs(),C=mo(t,(L)=>h?.(t.id,L)),{refresh:A,runStartedAtMap:T}=He(),{expandedSessionIds:I,toggleSession:z}=ls(),[j]=le(),G=j.get("subagent"),K=j.get("sessionId"),{confirmDelete:M,requestDelete:ee,cancelDelete:Z,handlePin:X,handleDelete:ue,handleArchive:ae,handleRename:oe,handleRenameWithAi:te,handleOpenFolder:q}=bs(t,A,l),U=Qo(),ce=X,ne=ue,me=q??void 0,ve=(t.sessions||[]).filter((L)=>S?L.is_archived===1:L.is_archived!==1),xe=ta(t.icon),{folderCheckbox:he,sessionCheckboxes:be,folderSummary:F,toggleFolderSelection:V,rendered:H,hiddenCount:Me}=Bs({batch:x,folder:t,sessions:ve,showArchived:S,visibleCount:y,activeSessionId:r,sessionStatus:k}),we=Es(H),Re=g||be,Ae=(L,ke)=>{let Q=String(L.id),Te=String(r)===Q,Le=Te&&K===Q&&Boolean(G),Ee=vt(Q);return e(po,{session:L,harness:L.harness,folderId:L.folder_id,isActive:Te&&!Le,status:k[Q],awaitingInput:Boolean(L.awaitingInput),timeAgo:vs(L.updated_at??L.created_at),timeTitle:jo(L.updated_at??L.created_at),runStartedAt:k[Q]==="stream"?T[Q]:void 0,expandable:ke.expandable,isChild:ke.isChild,isExpanded:ke.isExpanded,onToggleExpand:ke.onToggleExpand,onSelect:()=>c(L.id),onArchive:()=>ae(L),onDelete:Ee?void 0:()=>U.requestDelete(L),onRename:Ee?void 0:(We)=>void oe(L,We),onRenameWithAi:Ee?void 0:()=>void te(L),waitingFor:L.waitingFor?{title:L.waitingFor.title}:void 0,onCancelWait:L.waitingFor?()=>P?.(L.waitingFor.waitId):void 0,selectable:be,selected:Boolean(x?.selected.includes(Q)),onToggleSelect:x?()=>x.toggle(Q):void 0})},ye=(L)=>Cs(L,we.childrenOf,I,z);return e("div",{className:fo(Re),"data-testid":"session-folder",children:[e("div",{onClick:x?void 0:v,className:"flex items-center justify-between gap-2 py-1 cursor-pointer hover:bg-ink/5 rounded-lg select-none transition-colors",children:[e("div",{className:"flex items-center space-x-2 min-w-0",children:[he&&F?e(Rr,{size:"md",checked:F.all,indeterminate:F.some,label:`Select ${t.name}`,onChange:V}):e(d,{children:e("span",{className:"w-4 h-4 flex items-center justify-center flex-shrink-0",children:t.customIconUrl?e("img",{src:t.customIconUrl,alt:"",className:"w-[15px] h-[15px] rounded-xs object-contain",referrerPolicy:"no-referrer"}):t.iconType==="chat"?e(ln,{size:15,className:"text-ink/80"}):e(xe,{size:15,className:"text-ink/80",style:{color:t.accentColor||void 0}})})}),e("span",{className:"text-sm font-semibold text-ink truncate",children:t.name})]}),e("div",{className:"flex items-center space-x-2 text-xs text-ink/60",children:[e("span",{className:"font-mono text-[11px] text-ink/70",children:ve.length}),t.project_path&&e(ge,{size:13,className:"text-ink/50 ml-1"}),!x&&e(d,{children:[e("button",{type:"button",onClick:(L)=>{L.stopPropagation(),p(t.id)},className:"p-1.5 rounded-lg hover:bg-ink/10 active:bg-ink/15 text-ink/60 hover:text-ink",title:"New Session","aria-label":`New session in ${t.name}`,children:e(Y,{size:15})}),e(lo,{folder:t,canWorktree:Boolean(h&&t.project_path),onOpenFolder:me,onNewWorktree:h?()=>C.open():void 0,onSelectSessions:N?()=>N(t.id):void 0,confirmDelete:M,onPin:ce,onDelete:ne,onRequestDelete:ee,onCancelDelete:Z}),e("span",{className:"flex items-center justify-center pr-1",children:g?e(B,{size:14}):e(ie,{size:14})})]})]})]}),Re&&e("div",{className:"mt-0.5 space-y-0.5",children:[we.roots.map((L)=>{let ke=String(L.id),Q=ye(L);return e("div",{className:"space-y-0.5",children:[Ae(L,Q),Q.isExpanded&&e(bi,{parentId:ke,hasSubagents:Boolean(L.hasSubagents),childrenOf:we.childrenOf,expandedIds:I,onToggle:z,activeSessionId:r===null?null:String(r),renderSession:Ae,style:co})]},L.id)}),e(uo,{hiddenCount:be?0:Me,canShowLess:!be&&w,onShowMore:E,onShowLess:R})]}),e(No,{session:U.pending,isDeleting:U.isDeleting,error:U.error,onClose:U.cancelDelete,onConfirm:()=>void U.confirmDelete()}),C.dialog]})}function bo({folders:t,activeSessionId:r,expandedFolders:c,showArchived:p,sessionStatus:h,onSelectSession:g,onNewSessionForFolder:v,onNewWorktreeSession:S,onToggleFolder:k,onToast:l,batch:x,onStartSessionSelection:N,onCancelWait:P}){return e("div",{className:"flex-1 scrollbar-overlay-container pl-3 pr-2 py-3",children:t.length===0?e("div",{className:"text-center py-12 text-xs text-ink/50 italic",children:"No matching sessions found"}):t.map((y)=>e(ho,{folder:y,activeSessionId:r,onSelectSession:g,onNewSessionForFolder:v,onNewWorktreeSession:S,isExpanded:c[y.id]??!0,onToggleExpand:()=>k(y.id),showArchived:p,sessionStatus:h,onToast:l,batch:x,onStartSessionSelection:N,onCancelWait:P},y.id))})}var mt=[3,2];function go(){return e("div",{className:"flex-1 p-3 space-y-4","aria-hidden":"true",children:mt.map((t,r)=>e("div",{className:"space-y-2",children:[e("div",{className:"flex items-center gap-2 py-2",children:[e("span",{className:"w-4 h-4 rounded-sm animate-pulse bg-ink/10"}),e("span",{className:"h-3 w-24 rounded animate-pulse bg-ink/10"})]}),Array.from({length:t},(c,p)=>e("div",{className:"flex items-center gap-2 rounded py-2",children:[e("span",{className:"w-4 h-4 rounded-full animate-pulse bg-ink/10"}),e("span",{className:"h-3 rounded animate-pulse bg-ink/10",style:{width:`${58-p%3*12}%`}})]},p))]},r))})}function vo({folders:t,initializing:r,failed:c,activeSessionId:p,expandedFolders:h,sessionStatus:g,searchQuery:v,sortOption:S,optionsOpen:k,showArchived:l,optionsRef:x,scheduledCount:N,refreshing:P,selecting:y,batch:E,onNewSession:R,onNewWorkspace:w,onScheduler:C,onRefresh:A,onToggleOptions:T,onSortChange:I,onResetSort:z,onToggleArchived:j,onHideArchived:G,onSearchChange:K,onClearSearch:M,onSelectWorkspaces:ee,onSelectSession:Z,onNewSessionForFolder:X,onNewWorktreeSession:ue,onToggleFolder:ae,onToast:oe,onStartSessionSelection:te,onCancelWait:q}){return e(d,{children:[e(ao,{searchQuery:v,sortOption:S,optionsOpen:k,showArchived:l,optionsRef:x,onNewSession:R,onNewWorkspace:w,onScheduler:C,scheduledCount:N,onRefresh:A,refreshing:P,onToggleOptions:T,onSortChange:I,onResetSort:z,onToggleArchived:j,onHideArchived:G,onSearchChange:K,onClearSearch:M,onSelectWorkspaces:ee,selecting:y}),c?e(Is,{touch:!0,onRetry:A,refreshing:P}):r?e(go,{}):e(bo,{folders:t,activeSessionId:p,expandedFolders:h,showArchived:l,sessionStatus:g,onSelectSession:Z,onNewSessionForFolder:X,onNewWorktreeSession:ue,onToggleFolder:ae,onToast:oe,batch:E,onStartSessionSelection:te,onCancelWait:q})]})}function xo({onSettings:t,onKeyBindings:r,onAbout:c,updateAvailable:p,onUpdateClick:h,onDesktopToggle:g,shellDownload:v}){return e("div",{className:"px-3 pt-3 border-t border-ink/10 flex items-center justify-between flex-shrink-0 bg-canvas text-xs text-ink/60",style:{paddingBottom:"max(0.75rem, env(safe-area-inset-bottom, 0px))"},children:[e("div",{className:"flex items-center space-x-3",children:[e("button",{type:"button",onClick:t,className:"flex items-center space-x-1 hover:text-ink transition-colors",children:[e(Us,{size:14}),e("span",{children:"Settings"})]}),e("button",{type:"button",onClick:r,className:"flex items-center space-x-1 hover:text-ink transition-colors",children:[e(va,{size:14}),e("span",{children:"Keys"})]}),e("button",{type:"button",onClick:c,className:"flex items-center space-x-1 hover:text-ink transition-colors",children:[e(de,{size:14}),e("span",{children:"About"})]}),v&&e(Lm,{download:v,variant:"label"}),g&&e("button",{type:"button",onClick:g,className:"flex items-center space-x-1 hover:text-ink transition-colors",title:"Switch to desktop view",children:[e(ka,{size:14}),e("span",{children:"Desktop"})]})]}),e("div",{className:"flex items-center gap-2",children:[e("span",{className:"font-mono text-[10px] text-ink/40",children:["v",xc.version]}),p&&e("button",{type:"button",onClick:h,className:"px-2 py-0.5 rounded-full border border-ink/20 text-[10px] font-semibold text-ink hover:border-ink/40",children:"update"})]})]})}function So(t,r,c){return t.filter((p)=>p.id!==r&&!(c&&p.side==="left"))}function ko(t){return t}function wo(t,r=0){let{scrollLeft:c,clientWidth:p,scrollWidth:h,start:g,size:v}=t,S=Math.max(0,h-p),k=g-r,l=g+v+r;if(v+r*2>=p)return Math.max(0,Math.min(S,k));let x=c;if(k<c)x=k;else if(l>c+p)x=l-p;return Math.max(0,Math.min(S,x))}var ut=8;function _e({panels:t,activeId:r,onSelect:c,hasGitChanges:p=!1}){let h=i(null),g=i(new Map),v=i({activeId:r,panels:t});v.current={activeId:r,panels:t};let S=i({signature:"",width:0}),k=a(()=>{let l=h.current,x=g.current.get(v.current.activeId);if(!l||!x||l.clientWidth<=0)return;let N=`${v.current.activeId}\x00${v.current.panels.map((w)=>w.id).join("\x00")}`,P=S.current;if(P.signature===N&&P.width===l.clientWidth)return;S.current={signature:N,width:l.clientWidth};let y=l.getBoundingClientRect(),E=x.getBoundingClientRect(),R=wo({scrollLeft:l.scrollLeft,clientWidth:l.clientWidth,scrollWidth:l.scrollWidth,start:E.left-y.left+l.scrollLeft,size:E.width},ut);if(R!==l.scrollLeft)l.scrollLeft=R},[]);return W(k,[r,t,k]),o(()=>{let l=h.current;if(!l||typeof ResizeObserver>"u")return;let x=new ResizeObserver(k);return x.observe(l),()=>x.disconnect()},[k]),e("div",{ref:h,className:"flex items-center space-x-1.5 overflow-x-auto no-scrollbar py-1",children:t.map((l)=>{let x=l.id===r;return e("button",{ref:(N)=>{if(N)g.current.set(l.id,N);else g.current.delete(l.id)},type:"button",onClick:()=>c(l.id),"aria-pressed":x,"aria-label":l.title,className:`relative flex shrink-0 items-center transition-all cursor-pointer ${x?"space-x-1.5 px-3 py-1.5 rounded-lg text-xs font-semibold bg-ink text-canvas shadow-sm":"p-2 rounded-lg text-ink/70 hover:bg-ink/5"}`,title:l.title,children:[e(el,{panelId:l.id,builtin:l.builtin,icon:l.builtin?l.icon:void 0,name:l.builtin?l.label:l.name,...l.iconUrl?{iconUrl:l.iconUrl}:{},...l.color?{color:l.color}:{},size:fn}),x&&e("span",{className:`shrink-0 whitespace-nowrap ${l.id==="git"?"tracking-wide":""}`,children:l.label}),l.id==="git"&&p&&e("span",{className:"absolute top-1 right-1 w-1.5 h-1.5 rounded-full bg-info",title:"Uncommitted changes"})]},l.id)})})}function yo({panels:t,activeId:r,onSelect:c,menuProps:p}){return e("div",{className:"px-3 py-1.5 border-b border-ink/10 bg-canvas flex-shrink-0",...p,children:e(_e,{panels:t,activeId:r,onSelect:c})})}function Co({panelKey:t,panel:r,body:c}){if(!r)return e("div",{className:"flex-1 min-h-0",children:e(_c,{panelKey:t})});return e("div",{className:"flex-1 min-h-0 overflow-hidden relative",children:e(Ke,{fallback:e("div",{className:"h-full flex items-center justify-center text-ink/40",children:e("span",{className:"text-xs font-mono",children:"Loading…"})}),children:e(Eo,{value:c,children:r.render(c)})})})}function Do({activeSessionId:t,newWorkspaceOpen:r,onCloseNewWorkspace:c,schedulerOpen:p,onCloseScheduler:h,aboutOpen:g,onCloseAbout:v,updates:S,pushToast:k,batchDelete:l,batchMode:x,onEndBatch:N,scopeLabel:P}){return e(d,{children:[e(hl,{isOpen:r,onClose:c,onCreate:pu,onClone:mu}),e(su,{isOpen:p,onClose:h,activeSessionId:t===null?null:String(t),onToast:k}),e(hm,{isOpen:g,onClose:v,updates:S,onToast:k}),e(Rm,{updates:S}),e(hu,{mode:x??"session",count:l.pending.length,scopeLabel:P,isDeleting:l.isDeleting,progress:l.progress,outcome:l.outcome,onClose:()=>{let y=l.outcome?.refused.length??0;if(l.cancel(),l.outcome&&y===0)N()},onConfirm:()=>{let y=x??"session";l.confirm(y).then((E)=>{if(E&&E.refused.length===0)N()})}})]})}function Ao(){let t=Bt(),r=Ir("left"),[c,p]=$a("layout.mobileLeftPanel",Pe),h=Dm(c,t.enabled);return{catalog:r,activeView:h,setActiveView:p,showingSessions:h===Pe,activePanel:r.find((g)=>g.id===h),enabled:t.enabled}}function Io(t){return{className:"w-full h-full",sessionId:t.sessionId===null?null:String(t.sessionId),enabled:t.requiresWorkspace?t.hasActiveContext===!0:!0,active:!0,refreshKey:t.refreshKey,...t.rootPath?{rootPath:t.rootPath}:{},...t.onRefresh?{onRefresh:t.onRefresh}:{},...t.onOpenFile?{onOpenFile:t.onOpenFile}:{},onClose:t.onClose,showHeader:!1,layout:"phone"}}function Wo({appSettings:t,onSelectSession:r,onClose:c,rootPath:p,refreshKey:h,onRefresh:g,onOpenFile:v}){let S=uu(t,{onSelectSession:r,onAfterSelect:c}),{folders:k,processedFolders:l,refreshNow:x,showArchived:N,activeSessionId:P}=S,y=gu(l,N,x),[E,R]=n({1:!0,2:!0,3:!0}),w=i(null);pe(w,()=>S.setOptionsOpen(!1));let C=(z)=>{R((K)=>({...K,[z]:!K[z]}));let j=k.find((K)=>K.id===z),G=!(E[z]??j?.isExpanded??!0);Sd(z,G)},A=l.map((z)=>`${z.id}:${z.isExpanded}`).join("|");o(()=>{R(Object.fromEntries(l.map((z)=>[z.id,z.isExpanded])))},[A]);let T=Ao(),I=Io({sessionId:P,refreshKey:h,rootPath:p,onRefresh:g,onOpenFile:v,onClose:c,requiresWorkspace:T.activePanel?.requiresWorkspace??!1,hasActiveContext:Boolean(p)});return{controller:S,batch:y,expandedFolders:E,toggleFolder:C,optionsRef:w,dock:T,dockBody:I}}function Ve(t){let{disabledPanels:r}=un(),{setEnabled:c}=Gs(),p=ze(),h=Qm(t),g=a((v,S)=>{c(v,S)},[c]);return{...p,items:h,hidden:r,toggle:g}}function Bo({activeSessionId:t,onSelectSession:r,onNewSession:c,onNewSessionForFolder:p,onNewWorktreeSession:h,onClose:g,onDesktopToggle:v,appSettings:S={},rootPath:k,refreshKey:l=0,onRefresh:x,onOpenFile:N}){let{controller:P,batch:y,expandedFolders:E,toggleFolder:R,optionsRef:w,dock:C,dockBody:A}=Wo({appSettings:S,onSelectSession:r,onClose:g,rootPath:k,refreshKey:l,onRefresh:x,onOpenFile:N}),{initializing:T,failed:I,refreshNow:z,isRefreshing:j,searchQuery:G,setSearchQuery:K,showArchived:M,setShowArchived:ee,optionsOpen:Z,setOptionsOpen:X,sortOption:ue,handleSortChange:ae,processedFolders:oe,sessionStatus:te,handleSelectSession:q}=P,{selection:U,deleteRun:ce,archiveRun:ne,binding:me,scopeFolder:ve,available:xe,selected:he}=y,be=bu(),F=Ve("left"),[V,H]=n(!1),[Me,we]=n(!1),Re=iu(),[Ae,ye]=n(!1),L=Mm(),ke=Fm(),{pushToast:Q}=je(),Te=al(Q);du({onNotice:Q}),Ie(wc,()=>{g(),ye(!0),L.apply("kabmo").then((se)=>{if(!se)return;Q(se.message,ec(se))})});let Le=()=>{c(),g()},Ee=()=>{ne.archive(he).then((se)=>{if(!se)return;let Oe=fu(se);if(Oe)Q(Oe.message,Oe.tone);if(!se.error)U.end()})},We=(se)=>{p(se),g()},Ye=()=>{ee(!M)},Je=h?(se,Oe)=>{h(se,Oe),g()}:void 0,at={className:"flex-1 min-h-0 w-full",folders:oe,initializing:T,failed:I,activeSessionId:t,sessionStatus:te,searchQuery:G,onSearchChange:K,showArchived:M,onToggleArchived:Ye,sortOption:ue,optionsOpen:Z,onToggleOptions:()=>X(!Z),onCloseOptions:()=>X(!1),onSortChange:ae,onRefresh:z,refreshing:j,scheduledCount:Re,onNewSession:Le,onNewWorkspace:()=>H(!0),onScheduler:()=>we(!0),onSelectSession:q,onNewSessionForFolder:We,onNewWorktreeSession:Je,onToast:Q,onCancelWait:Te,batch:me,onSelectWorkspaces:y.toggleWorkspaceSelection,onStartSessionSelection:(se)=>U.begin("session",se)};return e("div",{className:"flex flex-col h-full w-full bg-canvas text-ink relative select-none",children:[e(ro,{onClose:g,viewLabel:C.showingSessions?"Sessions":C.activePanel?.label??"Panel",menuProps:F.surfaceProps}),ko(C.enabled)?e(yo,{panels:C.catalog,activeId:C.activeView,onSelect:C.setActiveView,menuProps:F.surfaceProps}):null,F.anchor?e(Po,{anchor:F.anchor,items:F.items,hidden:F.hidden,onToggle:F.toggle,onClose:F.close}):null,e("div",{className:C.showingSessions?"contents":"hidden",children:[be==="modern"?e(cu,{...at,touch:!0}):e(vo,{folders:oe,initializing:T,failed:I,activeSessionId:t,expandedFolders:E,sessionStatus:te,searchQuery:G,sortOption:ue,optionsOpen:Z,showArchived:M,optionsRef:w,scheduledCount:Re,refreshing:j,selecting:U.mode!==null,batch:me,onNewSession:Le,onNewWorkspace:()=>H(!0),onScheduler:()=>we(!0),onRefresh:z,onToggleOptions:()=>X(!Z),onSortChange:ae,onResetSort:()=>ae("A-Z"),onToggleArchived:Ye,onHideArchived:()=>ee(!1),onSearchChange:K,onClearSearch:()=>K(""),onSelectWorkspaces:y.toggleWorkspaceSelection,onSelectSession:q,onNewSessionForFolder:We,onNewWorktreeSession:Je,onToggleFolder:R,onToast:Q,onStartSessionSelection:(se)=>U.begin("session",se),onCancelWait:Te}),U.mode&&e(Au,{drawer:!0,mode:U.mode,count:he.length,total:xe.length,busy:ce.isDeleting,archiving:ne.isArchiving,scopeLabel:ve?.name,onSelectAll:()=>U.selectAllOf(xe),onUnselectAll:()=>U.unselectAllOf(xe),onDelete:()=>ce.request(he),onArchive:Ee,onCancel:U.end})]}),C.showingSessions?null:e(Co,{panelKey:C.activeView,panel:C.activePanel,body:A}),e(xo,{onSettings:()=>window.dispatchEvent(new CustomEvent("omp:open-settings",{detail:{}})),onKeyBindings:Tc,onAbout:()=>ye(!0),shellDownload:ke,onDesktopToggle:v,updateAvailable:L.hasUpdate,onUpdateClick:()=>{ye(!0),L.check()}}),e(Do,{activeSessionId:t,newWorkspaceOpen:V,onCloseNewWorkspace:()=>H(!1),schedulerOpen:Me,onCloseScheduler:()=>we(!1),aboutOpen:Ae,onCloseAbout:()=>ye(!1),updates:L,pushToast:Q,batchDelete:ce,batchMode:U.mode,onEndBatch:U.end,scopeLabel:ve?.name})]})}var ft="terminal";function $e(t){return t===ft}function De(t){if($e(t))BA()}function zo({enabled:t=!0,rootPath:r,refreshKey:c=0,onRefresh:p,onOpenFile:h,onClose:g}){let[v,S]=$a("layout.mobileRightPanel",Jl),k=Bt(),l=So(Ir("all"),Pe,k.enabled),x=l.find((A)=>A.id===v)??l[0],N=Fp(r,t),{changes:P}=Os(r,N,t),y=P.length>0,E=a((A)=>{if(A!==x?.id)De(A);S(A)},[x?.id,S]);o(()=>{if(!$e(x?.id))rc()},[x?.id]);let R=Ve(k.enabled?"right":"all"),w=k.enabled?R.items:R.items.filter((A)=>A.id!==Pe),C={className:"h-full w-full",enabled:t||!x?.requiresWorkspace,active:!0,refreshKey:c,...r?{rootPath:r}:{},onRefresh:p,onOpenFile:h,onClose:g,showHeader:!1,layout:"phone"};return e("div",{className:"flex flex-col h-full w-full bg-paper text-ink relative select-none",children:[e("div",{className:"border-b border-ink/10 flex items-center justify-between px-3 flex-shrink-0 bg-canvas titlebar-drag-region select-none",...Oo(),...R.surfaceProps,style:{height:"calc(3.5rem + env(safe-area-inset-top, 0px))",paddingTop:"env(safe-area-inset-top, 0px)",paddingLeft:$o(er("0.75rem",!0)),paddingRight:_r("0.75rem",!0)},children:[e("div",{className:"flex items-center min-w-0 titlebar-no-drag",children:e(_e,{panels:l,activeId:x?.id??v,onSelect:E,hasGitChanges:y})}),e("button",{type:"button",onClick:g,className:"p-1.5 rounded-lg hover:bg-ink/5 active:bg-ink/10 text-ink transition-colors flex-shrink-0 ml-2 titlebar-no-drag",title:"Close right sidebar","aria-label":"Close right sidebar",children:e(b,{size:20,strokeWidth:1.8})})]}),R.anchor?e(Po,{anchor:R.anchor,align:"right",items:w,hidden:R.hidden,onToggle:R.toggle,onClose:R.close}):null,e("div",{className:"flex-1 min-h-0 overflow-hidden relative",style:{paddingBottom:"env(safe-area-inset-bottom, 0px)"},children:x?e(Ke,{fallback:e("div",{className:"h-full flex items-center justify-center text-ink/40",children:e("span",{className:"text-xs font-mono",children:"Loading…"})}),children:e(Eo,{value:C,children:x.render(C)})}):e("div",{className:"h-full flex items-center justify-center text-ink/40",children:e("span",{className:"text-xs font-mono text-muted",children:"No session selected"})})})]})}function Vo({fileName:t,hasPreview:r,isPreview:c,hasReview:p,isReviewing:h,onToggleReview:g,wordWrap:v,copied:S,byteViewer:k=!1,missing:l=!1,onSave:x,onClose:N,onTogglePreview:P,onToggleFind:y,findOpen:E,onToggleWrap:R,onZoomOut:w,onZoomIn:C,onCopy:A,onDownload:T}){return e("header",{className:"bg-canvas border-b border-ink/10 flex items-center justify-between px-3 flex-shrink-0",style:{height:"calc(3rem + env(safe-area-inset-top, 0px))",paddingTop:"env(safe-area-inset-top, 0px)",paddingLeft:er("0.75rem",!0),paddingRight:_r("0.75rem",!0)},children:[e("div",{className:"flex items-center space-x-2 min-w-0 pr-2",children:[e("button",{type:"button",onClick:N,className:"p-1.5 rounded-lg hover:bg-ink/10 text-ink transition-colors active:scale-90 flex-shrink-0 cursor-pointer",title:"Close editor","aria-label":"Close editor",children:e(tn,{size:18,strokeWidth:2})}),e("div",{className:"flex items-center space-x-1.5 truncate",children:[e(it,{name:t,size:15,className:`flex-shrink-0${l?" text-error":""}`}),e("span",{className:`font-semibold text-xs truncate${l?" text-error line-through":" text-ink"}`,children:t})]})]}),e("div",{className:"flex items-center space-x-1 text-ink/70 flex-shrink-0",children:[l&&x&&e("button",{type:"button",onClick:x,className:"p-1.5 rounded bg-error text-canvas hover:bg-error/90 transition-colors cursor-pointer",title:"Save and recreate the file","aria-label":"Save and recreate the file",children:e(kt,{size:15})}),!k&&e("button",{type:"button",onClick:y,className:`p-1.5 rounded hover:bg-ink/10 transition-colors cursor-pointer ${E?"bg-ink text-canvas":""}`,title:E?"Close find":"Find in file","aria-label":E?"Close find":"Find in file","aria-pressed":E,children:e(O,{size:15})}),p&&e("button",{type:"button",onClick:g,className:`p-1.5 rounded hover:bg-ink/10 transition-colors cursor-pointer ${h?"bg-ink text-canvas":""}`,title:h?"Exit review mode":"Review this document","aria-label":h?"Exit review mode":"Review this document","aria-pressed":h,children:e(ln,{size:15})}),r&&e("button",{type:"button",onClick:P,className:`p-1.5 rounded hover:bg-ink/10 transition-colors cursor-pointer ${c?"bg-ink text-canvas":""}`,title:c?"View source":"Show preview","aria-label":c?"View source":"Show preview",children:c?e(Et,{size:15}):e(qe,{size:15})}),!k&&e(d,{children:[e("button",{type:"button",onClick:R,className:`p-1.5 rounded hover:bg-ink/10 transition-colors cursor-pointer ${v?"text-ink":""}`,title:"Toggle word wrap",children:e(en,{size:15})}),e("button",{type:"button",onClick:w,className:"p-1.5 rounded hover:bg-ink/10 transition-colors cursor-pointer",title:"Decrease font size",children:e(Na,{size:15})}),e("button",{type:"button",onClick:C,className:"p-1.5 rounded hover:bg-ink/10 transition-colors cursor-pointer",title:"Increase font size",children:e(Qa,{size:15})})]}),e("button",{type:"button",onClick:A,className:"p-1.5 rounded hover:bg-ink/10 transition-colors cursor-pointer",title:"Copy content",children:S?e(f,{size:15,className:"text-success"}):e(re,{size:15})}),e("button",{type:"button",onClick:T,className:"p-1.5 rounded hover:bg-ink/10 transition-colors cursor-pointer",title:"Download file",children:e(fe,{size:15})})]})]})}function Ho({fileName:t,content:r,path:c,root:p,repo:h,fontSize:g,scrollRef:v,onScroll:S,isLoading:k,unsupported:l,loadError:x,reviewActive:N,onExitReview:P}){return e("div",{ref:v,onScroll:S,"data-testid":"editor-scroller",className:"flex-1 min-h-0 overflow-auto relative bg-paper text-ink select-text",children:k?e("div",{className:"flex items-center justify-center h-full text-ink/40 text-xs gap-2",children:[e(m,{size:14,className:"animate-spin"}),e("span",{children:"Loading file content..."})]}):l?e("div",{className:"flex flex-col items-center justify-center h-full gap-2 px-6 text-center",children:[e(Mc,{size:20,className:"text-ink/40"}),e("span",{className:"text-xs text-ink/70 font-sans",children:[t," cannot be opened here"]}),e("span",{className:"text-[11px] text-ink/50 font-sans max-w-[42ch]",children:l})]}):x?e("div",{className:"flex flex-col items-center justify-center h-full gap-2 px-6 text-center",children:[e(_,{size:20,className:"text-error"}),e("span",{className:"text-xs text-error font-sans",children:["Could not read ",t]}),e("span",{className:"text-[11px] text-ink/50 font-mono break-all",children:x})]}):e("div",{className:"p-4 bg-paper text-ink min-h-full font-sans",style:{fontSize:`${g}px`},children:e(Oc,{content:r,file:{name:t,path:c,root:p,repo:h},active:N,onExit:P})})})}function Ko({file:t,editor:r,viewerKind:c,byteViewer:p,isPreview:h,isMd:g,content:v,language:S,wordWrap:k,fileKey:l,revealMarks:x,currentMark:N,surfaceRef:P,setCodeScroller:y,previewRef:E,scroll:R,fontSize:w,reviewActive:C,onExitReview:A,editorTheme:T,editorFontFamily:I,indentUnitText:z,typing:j}){let G=a(async(K)=>{let M=await Wc(t,K,{interactive:!0,baseMtimeMs:r.baseMtimeMs});if(M.status==="written")return{ok:!0};if(M.status==="conflict")return{ok:!1,error:"This file changed on disk since it was opened."};if(M.status==="needs-permission")return{ok:!1,error:"Tap Save again to grant write access."};return{ok:!1,error:M.error}},[t,r.baseMtimeMs]);if(r.isImage&&r.imageUrl)return e(gi,{src:r.imageUrl,name:t.name,className:"flex-1 min-h-0"});if(r.isImage||qc(c)&&(p||h))return e(ml,{kind:c,path:t.path??t.name,name:t.name,source:r.byteSource,content:r.content,revision:r.revision,onContentChange:r.onChange,onSaveBytes:r.deviceBacked?void 0:G,onDirtyChange:r.setBinaryDirty});if(r.isLoading||r.unsupported||r.loadError||g&&h)return e(Ho,{fileName:t.name,content:v,path:t.path??t.name,root:t.root,repo:t.repo,fontSize:w,scrollRef:E,onScroll:R.onScroll,isLoading:r.isLoading,unsupported:r.unsupported,loadError:r.loadError,reviewActive:C,onExitReview:A});return e(zc,{ref:P,value:v,onValueChange:r.onChange,language:S,wordWrap:k,documentKey:l,marks:x,currentMark:N,onScroller:y,scrollTestId:"editor-scroller",className:"flex-1 min-h-0 text-ink select-text",themeVars:T.vars,themes:T.themes,indentUnitText:z,typing:j,padding:12,placeholder:"This file is empty",style:{fontFamily:I,fontSize:`${w}px`,lineHeight:Vs}})}function qo(){return e("div",{className:"flex items-start gap-2 px-3 py-2 border-b border-error/30 bg-error/10 text-error shrink-0",children:[e(_,{size:14,className:"shrink-0 mt-0.5"}),e("div",{className:"min-w-0",children:[e("div",{className:"text-[11.5px] font-sans",children:"This file was deleted from disk."}),e("div",{className:"text-[11px] font-sans text-error/80",children:"The buffer is still here. Saving recreates the file — autosave is off until then."})]})]})}function Zo({isImage:t,byteViewer:r,viewerKind:c,lineCount:p,charCount:h,language:g,saveStatus:v,path:S,conflicts:k=0}){return e("footer",{className:"bg-canvas border-t border-ink/10 px-3 flex items-center justify-between text-[10px] text-ink/60 flex-shrink-0 font-mono",style:{height:"calc(1.75rem + env(safe-area-inset-bottom, 0px))",paddingBottom:"env(safe-area-inset-bottom, 0px)",paddingLeft:"max(0.75rem, env(safe-area-inset-left, 0px))",paddingRight:"max(0.75rem, env(safe-area-inset-right, 0px))"},children:[e("div",{className:"flex items-center space-x-3",children:t?e("span",{className:"uppercase",children:"Image"}):r?e("span",{className:"uppercase",children:Uo[c]}):e(d,{children:[k>0&&e("span",{className:"text-error font-semibold tabular-nums",children:["⚠ ",k]}),e("span",{children:[p," lines"]}),e("span",{children:[h," chars"]}),e("span",{className:"uppercase",children:g})]})}),e("div",{className:"flex items-center space-x-2",children:[v==="saving"&&e(d,{children:[e(m,{size:10,className:"animate-spin"}),e("span",{children:"Saving…"})]}),v==="saved"&&e(d,{children:[e("span",{className:"w-1.5 h-1.5 rounded-full bg-success"}),e("span",{children:"Saved"})]}),v==="error"&&e(d,{children:[e("span",{className:"w-1.5 h-1.5 rounded-full bg-error"}),e("span",{className:"text-error",children:"Save failed"})]}),v==="idle"&&S&&e("span",{className:"truncate max-w-[140px]",children:S})]})]})}function Xo({path:t,content:r,ready:c,surfaceRef:p}){let h=Yc(t,r,c),g=i(null);return o(()=>{if(!h||g.current===h.request)return;g.current=h.request;let v=h.matches[h.currentIndex];if(!v)return;p.current?.select(v.start,v.end,!1),p.current?.revealOffset(v.start)},[h,p]),{matches:h?.matches??[],currentIndex:h?.currentIndex??-1}}function Yo({path:t,content:r,documentKey:c,ready:p,surfaceRef:h,toggleWordWrap:g}){let v=Xo({path:t,content:r,ready:p,surfaceRef:h}),S=Vc({text:r,documentKey:c,readSelection:()=>h.current?.getSelection()??null,select:(k,l,x=!0)=>h.current?.select(k,l,x),reveal:(k)=>h.current?.revealOffset(k),applyDocument:(k,l,x)=>h.current?.applyDocument(k,l,x),toggleWordWrap:g});if(S.open&&S.matches.length>0)return{find:S,revealMarks:S.matches,currentMark:S.currentIndex};return{find:S,revealMarks:v.matches.length>0?v.matches:void 0,currentMark:v.currentIndex}}function ot({path:t,symbols:r,total:c,truncated:p,emptyNotice:h,preview:g=!1}){let[v,S]=n(!1);if(!t)return null;let k=(l,x)=>{if(S(!1),g){let N=Hu(r,x);if(N)Yi({path:t,...N});return}Vi({path:t,line:l.line,column:l.column,length:l.name.length})};return e(d,{children:[e("div",{className:"absolute bottom-14 right-3 z-20",children:e("button",{type:"button",onClick:()=>S(!0),"aria-label":`Outline (${c} symbols)`,title:"Outline",className:"flex h-9 w-9 items-center justify-center rounded-full border border-ink/20 bg-paper text-ink/60 shadow-sm transition-all hover:bg-ink/5 hover:text-ink active:scale-95",children:e(Kr,{size:16})})}),v&&e(J,{onClose:()=>S(!1),maxWidthClass:"max-w-sm",zClass:"z-[70]",header:e("div",{className:"flex min-w-0 items-center gap-2",children:[e(Kr,{size:15,className:"flex-shrink-0 text-ink/50"}),e("span",{className:"text-sm font-medium",children:"Outline"}),e("span",{className:"font-mono text-[11px] text-ink/40",children:p?`${r.length}/${c}`:c})]}),children:e("div",{className:"max-h-[60vh] overflow-y-auto scrollbar-overlay-container py-1",children:[r.length===0?e("div",{className:"px-4 py-3 text-[11px] italic text-ink/40",children:h}):r.map((l,x)=>e("button",{type:"button",onClick:()=>k(l,x),"aria-label":g?`${Jo(l.kind)} ${l.name}`:`${Jo(l.kind)} ${l.name}, line ${l.line}`,className:"flex w-full min-w-0 items-center gap-2 px-4 py-2 text-left transition-colors hover:bg-ink/5 active:bg-ink/10",style:{paddingLeft:`${16+l.depth*12}px`},children:[e(Ou,{kind:l.kind,size:13}),e("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-ink",children:l.name}),!g&&e("span",{className:"flex-shrink-0 font-mono text-[10px] text-ink/40",children:l.line})]},`${l.line}:${l.kind}:${l.name}`)),p&&e("div",{className:"px-4 py-2 text-[11px] italic text-ink/40",children:$u(c)})]})})]})}function tt({file:t,missing:r=!1,onClose:c,onFileSaved:p,onDropResult:h}){let g=ps(t.path??t.name),[v,S]=n({}),[k,l]=n(_o),[x,N]=n(!0),P=To(),y=Ai(),E=ru(),R=ou(),w=g==="markdown",C=bd[g]===!0,A=ds[g]===!0,T=t.path??t.name,I=v[T]??A,z=eu(String(T)),j=w&&I,G=()=>S((H)=>({...H,[T]:!I})),K=Qc({enabled:Boolean(t.root),onResult:h}),M=Kc(t,{flushOnUnmount:!0,reportSaveError:!0,downloadMimeType:"text/plain;charset=utf-8",onFileSaved:p,missing:r}),[ee,Z]=n(null),X=ol({tabKey:T,surface:w&&I?"rendered":"code",ready:M.loaded,slot:ih,element:w&&I?void 0:ee}),[ue,ae]=n(null),oe=a((H)=>{X.ref(H),ae(H)},[X.ref]);Gc({path:t.path??null,scroller:ue,preview:w&&I});let te=i(null),{find:q,revealMarks:U,currentMark:ce}=Yo({path:t.path??null,content:M.content,documentKey:`${T}\x00${M.language}`,ready:M.loaded&&!M.loadError,surfaceRef:te,toggleWordWrap:()=>N((H)=>!H)}),{content:ne,language:me}=M,ve=ne.split(`
2
- `).length,xe=$c(ne);Jc({file:{id:T,name:t.name,path:t.path??T},editor:M,surfaceRef:te,isPreview:I,exitPreview:()=>S((H)=>({...H,[T]:!1})),publish:!1});let{symbols:he,total:be,truncated:F,notice:V}=zu({content:ne,language:me,path:t.path??null,state:C?"not-a-document":M.loadError?"error":M.loaded?"ready":"loading",note:C?`${Uo[g]} files have no text outline.`:M.loadError});return e("div",{className:"fixed inset-x-0 top-0 h-dvh z-[60] bg-paper flex flex-col font-mono text-xs select-none",...K.dropProps,...K.captureDropProps,children:[e(pl,{visible:K.isDragging}),e(Vo,{fileName:t.name,hasPreview:A,isPreview:I,wordWrap:x,copied:M.copied,byteViewer:C,missing:r,onSave:M.saveNow,onClose:c,onTogglePreview:G,hasReview:j,isReviewing:j&&z.active,onToggleReview:z.toggle,onToggleFind:()=>q.open?q.close():q.openFind(),findOpen:q.open,onToggleWrap:()=>N(!x),onZoomOut:()=>l((H)=>Math.max(Ys,H-1)),onZoomIn:()=>l((H)=>Math.min(Js,H+1)),onCopy:M.copy,onDownload:M.download}),r&&e(qo,{}),M.diskChange&&e(Zc,{fileName:t.name,onReload:M.reloadFromDisk,onKeepMine:M.keepMineAgainstDisk}),q.open&&!C&&e("div",{className:"relative shrink-0 h-9 border-b border-ink/10 bg-paper",children:e(Uc,{find:q})}),e(Ko,{file:t,editor:M,viewerKind:g,byteViewer:C,isPreview:I,isMd:w,content:ne,language:me,wordWrap:x,fileKey:T,revealMarks:U,currentMark:ce,surfaceRef:te,setCodeScroller:Z,previewRef:oe,scroll:X,fontSize:k,reviewActive:j&&z.active,onExitReview:z.toggle,editorTheme:y,editorFontFamily:P,indentUnitText:nu(E),typing:R}),!C&&e(ot,{path:t.path??null,symbols:he,total:be,truncated:F,emptyNotice:V,preview:w&&I}),e(Zo,{isImage:M.isImage,byteViewer:C,viewerKind:g,lineCount:ve,charCount:ne.length,language:me,saveStatus:M.saveStatus,path:t.path,conflicts:xe}),M.saveMissingConfirm&&t.path&&e(Xc,{fileName:t.name,filePath:t.path,onClose:M.cancelSaveMissing,onConfirm:M.confirmSaveMissing})]})}function nt({diff:t,onClose:r,onFileSaved:c}){let p=t.path.split("/").pop()||t.path,h=Boolean(t.staged),g=t.status||"M",v=Kn(g,h);return e("div",{className:"fixed inset-x-0 top-0 h-dvh z-[60] bg-paper flex flex-col",children:[e("header",{className:"bg-canvas border-b border-ink/10 flex items-center justify-between px-3 flex-shrink-0",style:{height:"calc(3rem + env(safe-area-inset-top, 0px))",paddingTop:"env(safe-area-inset-top, 0px)",paddingLeft:er("0.75rem",!0),paddingRight:_r("0.75rem",!0)},children:[e("div",{className:"flex items-center space-x-2 min-w-0 pr-2",children:[e("button",{type:"button",onClick:r,className:"p-1.5 -ml-1 rounded-lg hover:bg-ink/5 active:bg-ink/10 text-ink transition-colors flex-shrink-0",title:"Back","aria-label":"Close diff",children:e(tn,{size:18,strokeWidth:1.9})}),e(it,{name:p,size:14,className:"flex-shrink-0"}),e("span",{className:"font-mono text-xs text-ink font-medium truncate",title:t.path,children:p})]}),e("span",{className:`px-1.5 py-0.5 text-[10px] font-mono font-semibold rounded border flex-shrink-0 ${v.badgeBgClass}`,children:[v.charStatus," ",v.label]})]}),e("div",{className:"flex-1 min-h-0",children:e(Pc,{className:"h-full",viewModeButtons:!1,filePath:t.path,status:g,isStaged:h,root:t.root,repo:t.repo||".",journalDiff:t.journal,readOnly:Boolean(t.journal),onFileSaved:c,tabKey:t.journal?$m(t.journal.path,t.journal.from,t.journal.to):Om(t.path,h)})})]})}function Fe(t,r){let c=t[r];return typeof c==="string"&&c.length>0?c:void 0}function ht(t){let r=t.content;return typeof r==="string"?r:void 0}function Ue(t,r){let c=typeof t==="object"&&t!==null?t:{},p=(Fe(c,"path")??"").replace(/^\/+/,"");if(!p)return null;return{name:Fe(c,"name")??p.split("/").pop()??"file",path:p,content:ht(c),root:Fe(c,"root")??r??void 0,repo:Fe(c,"repo"),handleId:Fe(c,"handleId"),deviceFile:c.deviceFile===!0?!0:void 0}}function rt(t){if(!t)return[];return[{id:"mobile-editor",path:t.path,root:t.root,repo:t.repo,content:t.content,handleId:t.handleId,deviceFile:t.deviceFile}]}function st(t,r,c){Va(c);let p=Xn(r);return Xt(p,pg,{folderId:r,worktreePath:c}),t.setSearchParams((h)=>{let g=_t(h);return g.set("sessionId",p),g.set("folderId",r.toString()),g},{replace:!0}),t.afterNavigate?.(),p}function Ic({onDesktopToggle:t,appSettings:r={}}){let{folders:c,isMock:p}=He(),h=Bt(),{sessionId:g}=Ze(),[v,S]=le(),k=v.get("sessionId"),l=k?Number.isNaN(Number(k))?k:Number(k):null,x=v.get("folderId"),N=x?Number.isNaN(Number(x))?x:Number(x):null,[P,y]=n("main"),[E,R]=n(null),[w,C]=n(null),[A,T]=n(0),[I,z]=n(!1),[j,G]=n("appearance"),[K,M]=n(!1),ee=a(()=>T((F)=>F+1),[]),Z=Hc(rt(E),A),{pushToast:X}=je(),ue=a((F)=>X(F.message,F.ok?"success":"error"),[X]),ae=Z.size>0;eo({editorOpen:E!==null,diffOpen:w!==null,settingsOpen:I,offMainScreen:P!=="main",onCloseEditor:()=>R(null),onCloseDiff:()=>C(null),onCloseSettings:()=>{z(!1),M(!1)},onReturnToMain:()=>y("main")});let{folder:oe}=Ya(c,l),te=oe??(N?c.find((F)=>String(F.id)===String(N))??null:null),q=Pm(c,l)??te?.project_path??null,U=!!te,ce=Qc({enabled:U,onResult:ue});Ie("omp:open-file",(F)=>{let H=Ue(F.detail,q);if(H)R(H)}),Ie("omp:open-diff",(F)=>{let V=F.detail;if(!V?.file)return;C({path:V.file.replace(/^\/+/,""),status:V.status,staged:V.staged,repo:V.repo,root:V.root??q??void 0,...V.source==="journal"&&V.journal?{journal:V.journal}:{}})}),Ie("omp:view-subagent",()=>y("main")),Ie(rd,(F)=>{let V=F.detail?.panelKey;if(!V)return;let H=sh(V,h);if(!H)return;let Me=Se(g,"layout.mobileRightPanel");if(H==="right"&&(P!=="right"||Me!==V))De(V);Xt(g,H==="left"?"layout.mobileLeftPanel":"layout.mobileRightPanel",V),y(H==="left"?"session":"right")}),Ie("omp:open-settings",(F)=>{let V=F.detail;G(V?.category??"appearance"),M(Boolean(V?.autoOpenAdd)),z(!0)});let ne=(F)=>{S((V)=>{let H=_t(V);if(H.set("sessionId",F.toString()),H.has("subagent"))H.delete("subagent");return H},{replace:!0}),y("main")},me=()=>{S(new URLSearchParams,{replace:!0}),y("main")},ve=(F)=>{let V=rl(c,k,F);if(V)Va(V);S((H)=>oc(H,Xn(F),F),{replace:!0}),y("main")},xe=(F,V)=>st({setSearchParams:S,afterNavigate:()=>y("main")},F,V),he=a((F)=>{let V=Ue(F,q);if(V)R(V)},[q]),be=a(()=>{let F=Se(g,"layout.mobileRightPanel")??Jl;De(F),y("right")},[g]);return e("div",{"data-testid":"app-root",className:"app-window flex flex-col h-dvh w-screen overflow-hidden bg-canvas text-ink font-sans selection:bg-ink selection:text-canvas relative",children:[e(uf,{}),e(df,{isMock:p}),e(pf,{workspacePath:q}),e("div",{className:`flex-1 min-h-0 w-full relative ${P==="main"?"block":"hidden"}`,...ce.dropProps,...ce.captureDropProps,children:[e(pl,{visible:ce.isDragging}),e(io,{activeSessionId:l,onSelectSession:ne,onNewSession:me,onOpenSessionSidebar:()=>y("session"),onOpenRightSidebar:be,appSettings:r})]}),e("div",{className:`flex-1 min-h-0 w-full ${P==="session"?"block":"hidden"}`,children:e(Bo,{activeSessionId:l,onSelectSession:ne,onNewSession:me,onNewSessionForFolder:ve,onNewWorktreeSession:xe,onClose:()=>y("main"),onDesktopToggle:t,appSettings:r,rootPath:q??void 0,refreshKey:A,onRefresh:ee,onOpenFile:he})}),P==="right"&&e("div",{className:"flex-1 min-h-0 w-full",children:e(zo,{enabled:U,rootPath:q??void 0,refreshKey:A,onRefresh:ee,onOpenFile:he,onClose:()=>y("main")})}),E&&e(tt,{file:E,missing:ae,onClose:()=>R(null),onFileSaved:ee}),w&&e(nt,{diff:w,onClose:()=>C(null),onFileSaved:ee}),e(kc,{isOpen:I,onClose:()=>{z(!1),M(!1)},initialCategory:j,autoOpenAddProvider:K,appSettings:r})]})}export{Ic as MobileLayoutWrapper};
@@ -1 +0,0 @@
1
- import{d,n,o,i,le,e,Xt,Qe,Be,m,Xe,f,B,ie,et,sn,ge,Ge,Y,D,O,b,st,je,Wt,Kt,oc,bt,St,ta,Xs,He,_a,Qo,No,Ro,vt,Xn,ls,Fo,Lo,Mo,Va,rl,al}from"./index-j4ks5s41.js";import{gs,Ta,Nr,hl,iu,su,Go,lu,As,Id,kg,xg,hs,bs,Rr,ys,vs,jo,ks,xs,ws,Cs,bi,Es,Bs,Is,cu,uu,du,pu,mu,fu,gu,Au,hu}from"./index-y82bk3hr.js";import{Da,bu}from"./index-4j5jwb54.js";var ne="shrink-0 w-7 h-7 inline-flex items-center justify-center rounded border transition-colors cursor-pointer",te="border-ink/15 bg-paper text-ink/70 hover:bg-ink/5 hover:text-ink",me="border-ink/30 bg-ink/10 text-ink";function Ne({isSearchVisible:t,searchQuery:p,showArchived:u,optionsOpen:h,sortOption:T,onToggleSearch:w,onSearchChange:S,onToggleArchived:y,onHideArchived:R,onToggleOptions:x,onCloseOptions:E,onSortChange:C,onNewSession:W,onNewWorkspace:P,onScheduler:z,scheduledCount:l,onRefresh:F,refreshing:M,onSelectWorkspaces:U,selecting:v}){let{ref:A,width:_}=As(kg),L=xg(_),r=new Set(Id.slice(0,L)),a=Id.slice(L),H=u?"Hide Archive":"Show Archive",j=l>0?`Scheduled tasks (${l} armed)`:"Scheduled tasks",c=[];if(a.includes("new-workspace"))c.push({id:"new-workspace",label:"New Workspace",icon:sn,onSelect:P});if(a.includes("refresh"))c.push({id:"refresh",label:"Refresh sessions",icon:D,onSelect:F});if(a.includes("search"))c.push({id:"search",label:"Search sessions",icon:O,onSelect:w,active:t});if(a.includes("archive"))c.push({id:"archive",label:H,icon:Xe,onSelect:y,active:u});if(a.includes("select"))c.push({id:"select",label:v?"Cancel selection":"Select workspaces",icon:Nr,onSelect:U,active:v});if(a.includes("scheduler"))c.push({id:"scheduler",label:j,icon:Ta,onSelect:z});return e("div",{className:"p-3 border-b border-ink/10 flex flex-col space-y-3",children:[e("div",{ref:A,className:"flex items-center justify-between gap-2 px-1 text-ink/60",children:[e("div",{className:"flex flex-1 min-w-0 items-center gap-1.5",children:[e("button",{type:"button",title:"New Session","aria-label":"New Session",onClick:W,className:"flex-1 min-w-[52px] h-7 flex items-center justify-center space-x-1.5 px-2 rounded bg-ink text-canvas text-xs font-semibold hover:bg-ink/90 transition-colors cursor-pointer",children:[e(Y,{size:14,className:"shrink-0"}),e("span",{className:"truncate",children:"New Session"})]}),r.has("new-workspace")&&e("button",{type:"button",title:"New Workspace","aria-label":"New Workspace",onClick:P,className:`${ne} ${te}`,children:e(sn,{size:14})}),r.has("scheduler")&&e("button",{type:"button",title:j,"aria-label":l>0?`Scheduled tasks, ${l} armed`:"Scheduled tasks",onClick:z,className:`relative ${ne} ${te}`,children:[e(Ta,{size:14}),l>0&&e("span",{className:"absolute -top-1 -right-1 min-w-[10px] h-[10px] px-[2px] rounded-full bg-ink text-canvas text-[7px] leading-[10px] text-center font-semibold",children:l>9?"9+":l})]}),r.has("refresh")&&e("button",{type:"button",title:"Refresh sessions",onClick:F,className:`${ne} ${te}`,"aria-label":"Refresh sessions","aria-busy":M,children:e(D,{size:14,className:M?"animate-spin":""})})]}),e("div",{className:"ml-auto flex items-center gap-1.5 shrink-0",children:[r.has("search")&&e("button",{type:"button",title:t?"Hide search":"Search sessions","aria-label":t?"Hide search":"Search sessions","aria-pressed":t,onClick:w,className:`${ne} ${t?me:te}`,children:e(O,{size:14})}),r.has("select")&&e("button",{type:"button",title:v?"Cancel selection":"Select workspaces","aria-label":v?"Cancel selection":"Select workspaces","aria-pressed":v,onClick:U,className:`${ne} ${v?me:te}`,children:e(Nr,{size:14})}),r.has("archive")&&e("button",{type:"button",title:H,"aria-label":H,"aria-pressed":u,onClick:y,className:`${ne} ${u?me:te}`,children:e(Xe,{size:14})}),r.has("sort")&&e("div",{className:"relative",children:[e("button",{type:"button",title:"Sort workspaces","aria-label":"Sort workspaces","aria-haspopup":"menu","aria-expanded":h,onClick:x,className:`${ne} ${h||T!=="A-Z"?me:te}`,children:e(gs,{size:14})}),h&&e("div",{className:"glass-popover absolute right-0 top-full mt-2 w-48 bg-paper border border-ink/15 rounded-lg shadow-lg z-50 py-1",onMouseLeave:E,children:e(Go,{variant:"desktop",sortOption:T,onSortChange:C})})]}),c.length>0&&e(lu,{actions:c,sortHidden:a.includes("sort"),sortOption:T,onSortChange:C})]})]}),t&&e("div",{className:"pt-1",children:e("input",{type:"text",placeholder:"Search workspaces & sessions...",value:p,onChange:(q)=>S(q.currentTarget.value),autoFocus:!0,className:"w-full bg-ink/5 border border-ink/10 rounded px-2.5 py-1.5 outline-none focus:border-ink/30 text-xs text-ink placeholder-ink/40 transition-colors"})}),u&&e("div",{className:"flex items-center justify-between bg-warning/10 border border-warning/25 text-warning rounded px-2.5 py-1.5 text-[10px] font-medium",children:[e("div",{className:"flex items-center space-x-1.5",children:[e(Xe,{size:10}),e("span",{children:"Showing Archived"})]}),e("button",{className:"hover:text-warning-hover",onClick:R,children:e(b,{size:10})})]})]})}var ye={inset:"px-2",insetPx:8,slotWidth:16,markGap:8,padding:"py-1.5",glyph:St.compact};function Ce({sessionId:t,title:p,harness:u,isActive:h=!1,isArchived:T=!1,status:w,awaitingInput:S=!1,timeAgo:y,timeTitle:R,runStartedAt:x,onClick:E,onArchive:C,onDelete:W,onRename:P,onRenameWithAi:z,expandable:l=!1,isExpanded:F=!1,onToggleExpand:M,isChild:U=!1,folderId:v,waitingFor:A,onCancelWait:_,worktree:L,selectable:r=!1,selected:a=!1,onToggleSelect:H}){let j=_a(t),c=Boolean(l&&M),q=Boolean(A),k=c&&!(S||w==="stream"||q)&&!j,N=Boolean(j||S||w)&&!k,{isEditing:V,draft:de,setDraft:se,inputRef:ee,startRename:Z,handleKeyDown:Q,handleBlur:re}=Ro(p,P),X=Fo(),oe=X.anchor!==null,ae=Boolean(P||C||W||_);return e(d,{children:[e("div",{"data-testid":"session-item","data-session-id":String(t),"data-selected":r&&a?"true":void 0,"data-menu-open":oe?"true":void 0,onClick:V?void 0:r?H:E,onContextMenu:ae&&!V&&!r?X.openAtCursor:void 0,className:`group/item relative flex items-center w-full rounded-lg px-2 py-1.5 cursor-pointer text-xs transition-colors select-none ${r&&a||oe?xs:h?"bg-ink/10 font-medium text-ink":"text-ink/75 hover:text-ink hover:bg-ink/5"}`,children:[r?e(d,{children:[e(Rr,{checked:a,label:`Select ${p}`,onChange:()=>H?.()}),e("span",{className:"w-2 shrink-0"})]}):e(d,{children:[e("span",{className:"relative w-4 h-4 shrink-0",children:[c&&M&&e("button",{type:"button",onClick:(G)=>{G.stopPropagation(),M(G)},title:F?"Collapse sessions and subagents":"Expand sessions and subagents","aria-expanded":F,className:`peer absolute inset-0 flex items-center justify-center rounded cursor-pointer transition-opacity ${k?"text-ink/60 hover:text-ink":"text-ink/40 hover:text-ink pointer-events-none opacity-0 group-hover/item:pointer-events-auto group-hover/item:opacity-100 focus-visible:opacity-100"}`,children:F?e(B,{size:13}):e(ie,{size:13})}),N&&e("span",{className:`pointer-events-none absolute inset-0 flex items-center justify-center text-ink/60 transition-opacity ${c?"group-hover/item:opacity-0 peer-focus-visible:opacity-0":""}`,children:j?e("span",{role:"status","aria-label":"Generating a name…",children:e(m,{size:12,className:"animate-spin"})}):S?e(Qe,{size:12,className:"animate-pulse text-ink/80"}):q?e("span",{role:"status","aria-label":`Waiting for ${A?.title??"another session"}`,children:e(Ge,{size:12,className:"animate-pulse text-ink/60"})}):w==="stream"?e("span",{role:"status","aria-label":"Running",children:e(m,{size:12,className:"animate-spin"})}):e(f,{size:12})}),U&&!c&&!N&&e("span",{"data-testid":"child-indicator","aria-hidden":"true",className:"pointer-events-none absolute inset-0 flex items-center justify-center text-ink/35",children:e(ge,{size:12,"aria-hidden":"true"})})]}),e("span",{className:"w-2 shrink-0"})]}),u&&e("span",{className:"mr-1.5 flex shrink-0 items-center",children:e(bt,{harness:u,size:St.compact})}),V?e("input",{ref:ee,autoFocus:!0,value:de,onChange:(G)=>se(G.currentTarget.value),onClick:(G)=>G.stopPropagation(),onKeyDown:Q,onBlur:re,className:"flex-1 min-w-0 bg-paper border border-ink/25 rounded px-1 py-0.5 text-xs text-ink outline-none focus:border-ink/50"}):e("span",{className:"flex-1 min-w-0 flex flex-col leading-snug",children:[e("span",{className:"min-w-0 truncate",children:p.charAt(0).toUpperCase()+p.slice(1)}),q&&e("span",{className:"truncate text-[10px] text-ink/40 font-normal",children:["waiting for ",A?.title??"another session"]}),L&&!V&&e(ys,{worktree:L})]}),!V&&e(ks,{timeAgo:y,timeTitle:R,runStartedAt:x,className:"shrink-0 ml-2 font-mono text-[10px]"}),!V&&ae&&!r&&e("button",{type:"button",onClick:X.openBelow,title:"Session actions","aria-label":"Session actions","aria-haspopup":"menu","aria-expanded":oe,className:"shrink-0 ml-1 p-1 text-ink/40 hover:text-ink hover:bg-ink/10 rounded cursor-pointer",children:e(Be,{size:14})})]}),X.anchor&&e(Lo,{anchor:X.anchor,sessionId:t,...u?{harness:u}:{},...v!==void 0?{folderId:v}:{},isArchived:T,onRename:P?Z:void 0,onRenameWithAi:z,onArchive:C,onDelete:W,onCancelWait:_,onClose:X.close})]})}function Ae({folder:t,isOpen:p,onToggleFolder:u,checkbox:h,batchActive:T,showMenu:w,onToggleMenu:S,onCloseMenu:y,onNewSession:R,onNewWorktreeSession:x,onOpenFolder:E,onSelectSessions:C,confirmDelete:W,onPin:P,onDelete:z,onRequestDelete:l,onCancelDelete:F}){let M=ta(t.icon),[U,v]=n(!1),A=Boolean(x&&t.project_path),_=i(null),[L,r]=n(null);return e("div",{className:"group flex items-center justify-between h-7 text-xs font-semibold text-ink px-2 hover:bg-ink/5 rounded-md transition-colors select-none",children:[e("div",{className:"flex-1 h-full flex items-center cursor-pointer min-w-0",onClick:T?void 0:u,children:[h?e(d,{children:[e(Rr,{size:"md",checked:h.checked,indeterminate:h.indeterminate,label:h.label,onChange:h.onChange}),e("span",{className:"w-2 shrink-0"})]}):e(d,{children:[e("span",{className:"relative w-4 h-4 flex items-center justify-center shrink-0",children:[e("span",{className:"absolute inset-0 flex items-center justify-center transition-opacity group-hover:opacity-0 touch-hidden",children:t.customIconUrl?e("img",{src:t.customIconUrl,alt:"",className:"w-[15px] h-[15px] rounded-xs object-contain shrink-0",referrerPolicy:"no-referrer"}):e(M,{size:15,className:"project-accent-mark text-ink/75",style:Xs(t.accentColor)})}),e("span",{className:"absolute inset-0 flex items-center justify-center text-ink/60 opacity-0 transition-opacity group-hover:opacity-100 touch-visible",children:p?e(B,{size:13}):e(ie,{size:13})})]}),e("span",{className:"w-2 shrink-0"})]}),t.isPinned&&e(Da,{size:11,className:"text-ink/60 shrink-0 mr-1.5"}),e("span",{className:"truncate text-[13px] font-semibold tracking-tight",children:t.name})]}),!T&&e("div",{className:"flex items-center space-x-0.5 pl-1",children:[e("button",{type:"button",title:"New Session","aria-label":`New session in ${t.name}`,className:"w-5 h-5 flex items-center justify-center text-ink/40 hover:text-ink hover:bg-ink/10 rounded cursor-pointer transition-colors",onClick:(a)=>{a.stopPropagation(),R()},children:e(Y,{size:12})}),e("div",{className:"relative flex items-center",children:[e("button",{ref:_,type:"button",title:`Options for ${t.name}`,"aria-label":`Options for ${t.name}`,"aria-haspopup":"menu","aria-expanded":w,className:"w-5 h-5 flex items-center justify-center text-ink/40 hover:text-ink hover:bg-ink/10 rounded cursor-pointer transition-colors",onClick:(a)=>{if(a.stopPropagation(),_.current)r(Wt(_.current));S()},children:e(Be,{size:12})}),e(Kt,{anchor:w?L:null,align:"end",ariaLabel:`Options for ${t.name}`,className:"glass-popover w-44 rounded-md border border-ink/15 bg-paper py-1 text-xs shadow-lg",onClose:y,children:e(ws,{variant:"desktop",isPinned:t.isPinned,onOpenFolder:E,onSelectSessions:C,onNewWorktree:A?()=>{S(),v(!0)}:void 0,confirmDelete:W,onPin:P,onDelete:z,onRequestDelete:l,onCancelDelete:F})})]})]}),A&&e(Mo,{isOpen:U,onClose:()=>v(!1),root:t.project_path??null,folderId:t.id,folderName:t.name,onCreated:(a)=>{v(!1),x?.(t.id,a.path)}})]})}function Oe({folder:t,activeSessionId:p,onSelectSession:u,onNewSessionForFolder:h,onNewWorktreeSession:T,forceExpanded:w=!1,showArchived:S=!1,sessionStatus:y={},onToast:R,batch:x,onStartSessionSelection:E,onCancelWait:C}){let[W,P]=n(t.isExpanded||!1),[z,l]=n(!1),{visibleCount:F,showMore:M,showLess:U,canShowLess:v}=hs(),[A]=le(),_=A.get("subagent"),L=A.get("sessionId"),{expandedSessionIds:r,toggleSession:a}=ls();o(()=>{if(typeof t.isExpanded==="boolean")P(t.isExpanded)},[t.isExpanded]);let{refresh:H,runStartedAtMap:j}=He(),c=st(),{confirmDelete:q,requestDelete:J,cancelDelete:k,handlePin:N,handleDelete:V,handleArchive:de,handleRename:se,handleRenameWithAi:ee,handleOpenFolder:Z}=bs(t,H,R),Q=Qo(),re=()=>{l(!1),k()},X=t.sessions,oe=()=>{let s=!W;if(P(s),typeof t.id!=="number")return;c.submit({isExpanded:String(s)},{method:"POST",action:`/api/folders/${t.id}/toggle`})},ae=()=>{N(),l(!1)},G=()=>{V(),l(!1)},g=Z?()=>{Z(),l(!1)}:void 0,I=w||W,pe=(X||[]).filter((s)=>S?s.is_archived===1:s.is_archived!==1),{folderCheckbox:ue,sessionCheckboxes:he,folderSummary:fe,toggleFolderSelection:We,rendered:Pe,hiddenCount:ve}=Bs({batch:x,folder:t,sessions:pe,showArchived:S,visibleCount:F,activeSessionId:p,sessionStatus:y}),Se=Es(Pe),Ie=I||he,ke=ve>0,xe=(s,ce)=>{let K=String(s.id),we=p!==null?String(p)===K:s.is_active===1,Me=we&&L===K&&Boolean(_),be=vt(K);return e(Ce,{sessionId:s.id,title:s.title,harness:s.harness,folderId:s.folder_id,isActive:we&&!Me,isArchived:s.is_archived===1,status:y[K],awaitingInput:Boolean(s.awaitingInput),worktree:s.worktree,timeAgo:vs(s.updated_at??s.created_at),timeTitle:jo(s.updated_at??s.created_at),runStartedAt:y[K]==="stream"?j[K]:void 0,onClick:()=>u(s.id),onArchive:()=>de(s),onDelete:be?void 0:()=>Q.requestDelete(s),onRename:be?void 0:(Ee)=>void se(s,Ee),onRenameWithAi:be?void 0:()=>void ee(s),expandable:ce.expandable,isChild:ce.isChild,isExpanded:ce.isExpanded,onToggleExpand:ce.onToggleExpand,waitingFor:s.waitingFor?{title:s.waitingFor.title}:void 0,onCancelWait:s.waitingFor?()=>C?.(s.waitingFor.waitId):void 0,selectable:he,selected:Boolean(x?.selected.includes(K)),onToggleSelect:x?()=>x.toggle(K):void 0})},Fe=(s)=>Cs(s,Se.childrenOf,r,a);return e("div",{className:"space-y-1",children:[e(Ae,{folder:t,isOpen:I,onToggleFolder:oe,checkbox:ue&&fe?{checked:fe.all,indeterminate:fe.some,label:`Select ${t.name}`,onChange:We}:null,batchActive:Boolean(x),showMenu:z,onToggleMenu:()=>l(!z),onCloseMenu:re,onNewSession:()=>h(t.id),onNewWorktreeSession:T,onOpenFolder:g,onSelectSessions:E?()=>{l(!1),E(t.id)}:void 0,confirmDelete:q,onPin:ae,onDelete:G,onRequestDelete:J,onCancelDelete:k}),Ie&&e("div",{className:"space-y-0.5",children:[Se.roots.map((s)=>{let ce=String(s.id),K=Fe(s);return e("div",{className:"space-y-0.5",children:[xe(s,K),K.isExpanded&&e(bi,{parentId:ce,hasSubagents:Boolean(s.hasSubagents),childrenOf:Se.childrenOf,expandedIds:r,onToggle:a,activeSessionId:p===null?null:String(p),renderSession:xe,style:ye})]},s.id)}),(ke||v)&&!he&&e("div",{className:"flex items-center gap-1",children:[ke&&e("button",{type:"button",onClick:M,className:"flex items-center min-w-0 text-xs text-ink/45 hover:text-ink/80 py-1.5 px-2 rounded-lg hover:bg-ink/5 transition-colors cursor-pointer select-none",children:[e("span",{className:"w-4 h-4 shrink-0 flex items-center justify-center",children:e(B,{size:12})}),e("span",{className:"w-2 shrink-0"}),e("span",{className:"truncate leading-snug",children:["Show more sessions (",ve,")"]})]}),v&&e("button",{type:"button",onClick:U,className:"ml-auto shrink-0 flex items-center gap-1 text-xs text-ink/45 hover:text-ink/80 py-1.5 px-2 rounded-lg hover:bg-ink/5 transition-colors cursor-pointer select-none",children:[e(et,{size:12}),e("span",{className:"truncate leading-snug",children:"Show less"})]})]}),pe.length===0&&e("div",{className:"px-3 py-2 text-[11px] text-ink/40 italic",children:S?"No archived sessions.":"No sessions."})]}),e(No,{session:Q.pending,isDeleting:Q.isDeleting,error:Q.error,onClose:Q.cancelDelete,onConfirm:()=>void Q.confirmDelete()})]})}function Te({folders:t,activeSessionId:p,searchQuery:u,showArchived:h,sessionStatus:T,onSelectSession:w,onNewSessionForFolder:S,onNewWorktreeSession:y,onToast:R,batch:x,onStartSessionSelection:E,onCancelWait:C}){return e("div",{className:"flex-1 scrollbar-overlay-container p-2 space-y-4",children:t.length===0?e("div",{className:"text-center py-8 text-xs text-muted",children:u?"No results found.":"No workspaces available."}):t.map((W)=>e(Oe,{folder:W,activeSessionId:p,onSelectSession:w,onNewSessionForFolder:S,onNewWorktreeSession:y,forceExpanded:u.trim().length>0,showArchived:h,sessionStatus:T,onToast:R,batch:x,onStartSessionSelection:E,onCancelWait:C},W.id))})}var ze=[3,2];function De(){return e("div",{className:"flex-1 p-2 space-y-4","aria-hidden":"true",children:ze.map((t,p)=>e("div",{className:"space-y-1.5",children:[e("div",{className:"flex items-center gap-2 px-1 py-1.5",children:[e("span",{className:"w-3.5 h-3.5 rounded-sm animate-pulse bg-ink/10"}),e("span",{className:"h-3 w-24 rounded animate-pulse bg-ink/10"})]}),Array.from({length:t},(u,h)=>e("div",{className:"flex items-center gap-2 rounded px-2 py-1.5",children:[e("span",{className:"w-4 h-4 rounded-full animate-pulse bg-ink/10"}),e("span",{className:"h-3 rounded animate-pulse bg-ink/10",style:{width:`${58-h%3*12}%`}})]},h))]},p))})}function Re({className:t="",folders:p,initializing:u,failed:h,activeSessionId:T,sessionStatus:w,searchQuery:S,onSearchChange:y,showArchived:R,onToggleArchived:x,sortOption:E,optionsOpen:C,onToggleOptions:W,onCloseOptions:P,onSortChange:z,onRefresh:l,refreshing:F,scheduledCount:M,onNewSession:U,onNewWorkspace:v,onScheduler:A,onSelectSession:_,onNewSessionForFolder:L,onNewWorktreeSession:r,onToast:a,onCancelWait:H,batch:j,onSelectWorkspaces:c,onStartSessionSelection:q}){let[J,k]=n(!1),N=J||S.length>0,V=Boolean(j);return e("div",{className:`flex flex-col ${t}`,children:[e(Ne,{isSearchVisible:N,searchQuery:S,showArchived:R,optionsOpen:C,sortOption:E,onToggleSearch:()=>{if(N)k(!1),y("");else k(!0)},onSearchChange:y,onToggleArchived:x,onHideArchived:x,onToggleOptions:W,onCloseOptions:P,onSortChange:z,onNewSession:U,onNewWorkspace:v,onScheduler:A,scheduledCount:M,onRefresh:l,refreshing:F,onSelectWorkspaces:c,selecting:V}),h?e(Is,{onRetry:l,refreshing:F}):u?e(De,{}):e(Te,{folders:p,activeSessionId:T,searchQuery:S,showArchived:R,sessionStatus:w,onSelectSession:_,onNewSessionForFolder:L,onNewWorktreeSession:r,onToast:a,batch:j,onStartSessionSelection:q,onCancelWait:H})]})}function Tn({className:t="",appSettings:p={}}){let{folders:u,initializing:h,failed:T,refreshNow:w,isRefreshing:S,activeSessionId:y,sessionParam:R,searchQuery:x,setSearchQuery:E,showArchived:C,setShowArchived:W,optionsOpen:P,setOptionsOpen:z,sortOption:l,handleSortChange:F,processedFolders:M,sessionStatus:U,handleSelectSession:v}=uu(p,{expandSearchMatches:!0}),[,A]=le(),_=bu(),[L,r]=n(!1),[a,H]=n(!1),j=iu(),{pushToast:c}=je(),q=al(c);du({onNotice:c});let J=gu(M,C,w),{selection:k,deleteRun:N,archiveRun:V,binding:de,scopeFolder:se,available:ee,selected:Z}=J,Q=()=>{V.archive(Z).then((g)=>{if(!g)return;let I=fu(g);if(I)c(I.message,I.tone);if(!g.error)k.end()})},re=(g)=>{let I=rl(u,R,g);if(I)Va(I)},X=()=>{A(new URLSearchParams,{replace:!0})},oe=(g,I)=>{re(g);let pe=Xn(g);Xt(pe,"chat.spawnTarget",{folderId:g,worktreePath:I}),A((ue)=>oc(ue,pe,g),{replace:!0})},ae=(g)=>{re(g),A((I)=>oc(I,Xn(g),g),{replace:!0})},G={className:`flex-1 min-h-0 w-full ${t}`,folders:M,initializing:h,failed:T,activeSessionId:y,sessionStatus:U,searchQuery:x,onSearchChange:E,showArchived:C,onToggleArchived:()=>W(!C),sortOption:l,optionsOpen:P,onToggleOptions:()=>z(!P),onCloseOptions:()=>z(!1),onSortChange:F,onRefresh:w,refreshing:S,scheduledCount:j,onNewSession:X,onNewWorkspace:()=>r(!0),onScheduler:()=>H(!0),onSelectSession:v,onNewSessionForFolder:ae,onNewWorktreeSession:oe,onToast:c,onCancelWait:q,batch:de,onSelectWorkspaces:J.toggleWorkspaceSelection,onStartSessionSelection:(g)=>k.begin("session",g)};return e(d,{children:[e("div",{className:"flex flex-col h-full",children:[_==="modern"?e(cu,{...G}):e(Re,{...G}),k.mode&&e(Au,{mode:k.mode,count:Z.length,total:ee.length,busy:N.isDeleting,archiving:V.isArchiving,scopeLabel:se?.name,onSelectAll:()=>k.selectAllOf(ee),onUnselectAll:()=>k.unselectAllOf(ee),onDelete:()=>N.request(Z),onArchive:Q,onCancel:k.end})]}),e(hu,{mode:k.mode??"session",count:N.pending.length,scopeLabel:se?.name,isDeleting:N.isDeleting,progress:N.progress,outcome:N.outcome,onClose:()=>{let g=N.outcome?.refused.length??0;if(N.cancel(),N.outcome&&g===0)k.end()},onConfirm:()=>{let g=k.mode??"session";N.confirm(g).then((I)=>{if(I&&I.refused.length===0)k.end()})}}),e(hl,{isOpen:L,onClose:()=>r(!1),onCreate:pu,onClone:mu}),e(su,{isOpen:a,onClose:()=>H(!1),activeSessionId:typeof R==="string"?R:null,onToast:c})]})}export{Tn as SessionsView};
@@ -1 +0,0 @@
1
- import{Ef}from"./index-547h1b8j.js";export{Ef as createArchitectureServices};
@@ -1 +0,0 @@
1
- import{vd,ms,Bh,Ih,_h,Sh}from"./index-r1fe56cn.js";export{Bh as css,Sh as gss,ms as keywords,_h as less,vd as mkCSS,Ih as sCSS};