@kabmo-labs/kabmo 0.43.1 → 0.45.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 (433) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +337 -337
  3. package/dist/client/static/js/{CsvGrid-g67pk2zy.js → CsvGrid-z74weshk.js} +2 -2
  4. package/dist/client/static/js/{DocxView-pyh6p2kb.js → DocxView-dpe5x9ab.js} +5 -5
  5. package/dist/client/static/js/{DrawioView-g48r6y2m.js → DrawioView-ftzwjf8v.js} +2 -2
  6. package/dist/client/static/js/ImageView-vchn6wyq.js +1 -0
  7. package/dist/client/static/js/LayoutWrapper-1x0gnppc.js +2 -0
  8. package/dist/client/static/js/{Modal-edw446r8.js → Modal-tteg7vtb.js} +20 -20
  9. package/dist/client/static/js/{PdfView-6z3cgj37.js → PdfView-vjec8z3z.js} +1 -1
  10. package/dist/client/static/js/SessionsView-g7z3fxbp.js +1 -0
  11. package/dist/client/static/js/{SheetView-64076z1j.js → SheetView-hhtfkdhe.js} +25 -25
  12. package/dist/client/static/js/{SvgPreview-dmpgavgd.js → SvgPreview-48n3ex6p.js} +1 -1
  13. package/dist/client/static/js/{abnfDiagram-O67JEVCF-nfz5z1vw.js → abnfDiagram-O67JEVCF-bpvzdara.js} +1 -1
  14. package/dist/client/static/js/architecture-7GRP2DOG-bch3nye9.js +1 -0
  15. package/dist/client/static/js/{architectureDiagram-NJMV4G6O-jra2jyzw.js → architectureDiagram-NJMV4G6O-xw62cr7j.js} +11 -11
  16. package/dist/client/static/js/{astro-dpfdhc5e.js → astro-56b0as3q.js} +1 -1
  17. package/dist/client/static/js/bash-mevzaywf.js +1 -0
  18. package/dist/client/static/js/{blockDiagram-BEXU5L5S-3szktxam.js → blockDiagram-BEXU5L5S-x3a6cgar.js} +6 -6
  19. package/dist/client/static/js/c-y1y6v00q.js +1 -0
  20. package/dist/client/static/js/{c4Diagram-YGBWAQC7-xe9vbppt.js → c4Diagram-YGBWAQC7-katvaxbj.js} +6 -6
  21. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-egzhj1xn.js → classDiagram-v2-NBCMYWYE-bjz4mqqh.js} +5 -5
  22. package/dist/client/static/js/{cose-bilkent-JH36ORCC-dfrk1wnr.js → cose-bilkent-JH36ORCC-fsn80psf.js} +1 -1
  23. package/dist/client/static/js/cpp-wk9z0c5g.js +1 -0
  24. package/dist/client/static/js/css-3w3p9s67.js +1 -0
  25. package/dist/client/static/js/css-g85rwzty.js +1 -0
  26. package/dist/client/static/js/cynefin-OW5HDTMX-vqy5jtnk.js +1 -0
  27. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-xefpcmpg.js → cynefinDiagram-VND7K2PF-cfhbsnkm.js} +2 -2
  28. package/dist/client/static/js/{dagre-6A5THRUB-vtzjnrt9.js → dagre-6A5THRUB-j2wt7ns6.js} +2 -2
  29. package/dist/client/static/js/{diagram-22UHCM2B-4vvn790v.js → diagram-22UHCM2B-abrdj714.js} +21 -21
  30. package/dist/client/static/js/{diagram-3UASUU5V-tmht3bew.js → diagram-3UASUU5V-dbn15bxn.js} +2 -2
  31. package/dist/client/static/js/{diagram-ATOU4E4O-p5wa5ztx.js → diagram-ATOU4E4O-y79pwf7w.js} +3 -3
  32. package/dist/client/static/js/{diagram-CDSNMT55-8myesjfc.js → diagram-CDSNMT55-f8ryt86n.js} +4 -4
  33. package/dist/client/static/js/{diagram-MLGK6HIB-9t3x2d5f.js → diagram-MLGK6HIB-ws7wn3q9.js} +2 -2
  34. package/dist/client/static/js/{diagram-MPIPVDR6-8ahgnmhy.js → diagram-MPIPVDR6-zmznrg13.js} +2 -2
  35. package/dist/client/static/js/{dockerfile-x8aa0543.js → dockerfile-qgc921kw.js} +1 -1
  36. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-5semw111.js → ebnfDiagram-ZINNZB2B-y5q7hy1v.js} +1 -1
  37. package/dist/client/static/js/{elixir-5ewfhvfh.js → elixir-12pgbgtq.js} +1 -1
  38. package/dist/client/static/js/{elk-276RUBZZ-jmhs58ww.js → elk-276RUBZZ-vddwbn6q.js} +1 -1
  39. package/dist/client/static/js/{erDiagram-OPXOYQCR-31wvbpdr.js → erDiagram-OPXOYQCR-qdqcx4g4.js} +6 -6
  40. package/dist/client/static/js/{erlang-jqqa3ehb.js → erlang-811btv6p.js} +1 -1
  41. package/dist/client/static/js/eventmodeling-NTZA5JFV-65ph4s3m.js +1 -0
  42. package/dist/client/static/js/flowDiagram-KWPJA3E3-nh2tb65b.js +1 -0
  43. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-c2dycjrf.js → ganttDiagram-FUAMR5RP-763hk9rm.js} +4 -4
  44. package/dist/client/static/js/gitGraph-4MIJSDKK-t45ekjb6.js +1 -0
  45. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-y4k4pdd8.js → gitGraphDiagram-X574FWY7-bgx1q5nw.js} +10 -10
  46. package/dist/client/static/js/graphql-027z8sc0.js +1 -0
  47. package/dist/client/static/js/html-fqda6wxx.js +1 -0
  48. package/dist/client/static/js/{index-38v0781h.js → index-03j5j1j0.js} +2 -2
  49. package/dist/client/static/js/{index-3588r3wg.js → index-05hx4ftf.js} +2 -2
  50. package/dist/client/static/js/index-0vk6v4y4.js +2 -0
  51. package/dist/client/static/js/{index-7dp90ad1.js → index-1nwwvv29.js} +2 -2
  52. package/dist/client/static/js/{index-aar68x31.js → index-228yzebd.js} +5 -5
  53. package/dist/client/static/js/{index-xf36nmbm.js → index-2b1wnvez.js} +2 -2
  54. package/dist/client/static/js/index-34ff2vq6.js +2 -0
  55. package/dist/client/static/js/{index-6fpd55cq.js → index-3d21hpk7.js} +2 -2
  56. package/dist/client/static/js/{index-181p91hf.js → index-3h2mr90j.js} +2 -2
  57. package/dist/client/static/js/{index-efra065v.js → index-3sqndc9n.js} +2 -2
  58. package/dist/client/static/js/{index-kc5znr75.js → index-47wn2gjx.js} +2 -2
  59. package/dist/client/static/js/{index-nt7nhchn.js → index-4b5b6g0k.js} +1 -1
  60. package/dist/client/static/js/index-5b2vsbcf.js +1 -0
  61. package/dist/client/static/js/index-5mrqfs82.js +12 -0
  62. package/dist/client/static/js/{index-m94f4ngb.js → index-61j9qkck.js} +3 -3
  63. package/dist/client/static/js/index-6bm4pw90.css +1 -0
  64. package/dist/client/static/js/{index-qhytrsyb.js → index-6sqmhdyv.js} +2 -2
  65. package/dist/client/static/js/{index-jz93j0at.js → index-8dtp7mt0.js} +2 -2
  66. package/dist/client/static/js/index-a11ptyzf.js +1 -0
  67. package/dist/client/static/js/index-acphtw1r.js +2 -0
  68. package/dist/client/static/js/{index-s78n0dtv.js → index-as1wptfa.js} +2 -2
  69. package/dist/client/static/js/index-cj39b26c.js +1 -0
  70. package/dist/client/static/js/index-dgjerk4w.js +3 -0
  71. package/dist/client/static/js/{index-sesghshh.js → index-dmv2zasz.js} +2 -2
  72. package/dist/client/static/js/index-dn6pqym4.js +9 -0
  73. package/dist/client/static/js/{index-ynaxep06.js → index-ehg2ftnp.js} +2 -2
  74. package/dist/client/static/js/{index-e7yf273s.js → index-f51jxezc.js} +2 -2
  75. package/dist/client/static/js/index-f7paep2f.js +2 -0
  76. package/dist/client/static/js/index-f98dhbt4.js +4 -0
  77. package/dist/client/static/js/{index-ys0xpw3q.js → index-fbct0jcf.js} +2 -2
  78. package/dist/client/static/js/index-fqatn0vh.js +1 -0
  79. package/dist/client/static/js/{index-bvjct7sp.js → index-gcwmpfr4.js} +2 -2
  80. package/dist/client/static/js/{index-cgzw43bc.js → index-gmq5pbcv.js} +67 -67
  81. package/dist/client/static/js/{index-q81rxwh7.js → index-gzafyqsr.js} +43 -43
  82. package/dist/client/static/js/{index-gmnmnfm0.js → index-gzp4j2h5.js} +2 -2
  83. package/dist/client/static/js/{index-cjhvtzdd.js → index-h0rmkz9n.js} +2 -2
  84. package/dist/client/static/js/{index-sk9ej289.js → index-jaqjvk22.js} +2 -2
  85. package/dist/client/static/js/{index-pt8440xh.js → index-jpp0zm7t.js} +15 -15
  86. package/dist/client/static/js/index-kg2sk8cf.js +1 -0
  87. package/dist/client/static/js/index-mrw7qweg.js +1 -0
  88. package/dist/client/static/js/index-mwm8aptp.js +1 -0
  89. package/dist/client/static/js/{index-yvgbr7ek.js → index-n1ga63de.js} +2 -2
  90. package/dist/client/static/js/{index-cqnpsw2m.js → index-nzhwd6t3.js} +2 -2
  91. package/dist/client/static/js/{index-vyw4tbn8.js → index-p21mvqc2.js} +2 -2
  92. package/dist/client/static/js/{index-fjnkzk12.js → index-pfj3sd1n.js} +3 -3
  93. package/dist/client/static/js/{index-fg965t62.js → index-pxq4v81r.js} +2 -2
  94. package/dist/client/static/js/index-q76jfb54.js +1 -0
  95. package/dist/client/static/js/{index-m9s9rg5k.js → index-qt9jc4ck.js} +2 -2
  96. package/dist/client/static/js/{index-48pb18zj.js → index-r6e44vkx.js} +2 -2
  97. package/dist/client/static/js/{index-2cbnjc32.js → index-szk3vk8h.js} +2 -2
  98. package/dist/client/static/js/{index-ycks7gyg.js → index-t0yv1375.js} +2 -2
  99. package/dist/client/static/js/{index-0c6vpk89.js → index-vgcm2g0g.js} +2 -2
  100. package/dist/client/static/js/{index-f7djda1g.js → index-vkerrwpa.js} +2 -2
  101. package/dist/client/static/js/{index-dkwhs38j.js → index-w57zbym7.js} +2 -2
  102. package/dist/client/static/js/{index-n9scbxy5.js → index-wqrdgt1g.js} +2 -2
  103. package/dist/client/static/js/{index-j17h4z6f.js → index-x2wvq4ae.js} +2 -2
  104. package/dist/client/static/js/{index-2b46dzw8.js → index-x7rfmwg8.js} +4 -4
  105. package/dist/client/static/js/{index-f77c3ag0.js → index-xkwybnf3.js} +200 -200
  106. package/dist/client/static/js/info-A6RAGUB7-mw29xbwf.js +1 -0
  107. package/dist/client/static/js/{infoDiagram-VRGFBTTK-z3pqx7w8.js → infoDiagram-VRGFBTTK-e66pw8d9.js} +1 -1
  108. package/dist/client/static/js/ini-3cx6tmv4.js +1 -0
  109. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-f5v6z8yr.js → ishikawaDiagram-OU5B5YK6-ehc0q24d.js} +3 -3
  110. package/dist/client/static/js/java-zs6qh1dm.js +1 -0
  111. package/dist/client/static/js/javascript-b9mkygak.js +1 -0
  112. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-js1yxatk.js → journeyDiagram-ZHPQQLJL-hye05qtd.js} +5 -5
  113. package/dist/client/static/js/json-qn73s8xb.js +1 -0
  114. package/dist/client/static/js/jsx-gahhfczw.js +1 -0
  115. package/dist/client/static/js/{julia-0h9krgsd.js → julia-mgsev9df.js} +1 -1
  116. package/dist/client/static/js/{kanban-definition-PNTS6WVX-m0a6069c.js → kanban-definition-PNTS6WVX-vce614m8.js} +7 -7
  117. package/dist/client/static/js/lua-d8enp14s.js +1 -0
  118. package/dist/client/static/js/markdown-qetaj4vp.js +1 -0
  119. package/dist/client/static/js/{mermaid.core-6xvbnm63.js → mermaid.core-gc79re5p.js} +7 -7
  120. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-a9f9yzc0.js → mindmap-definition-NLK3R4M7-ft1whaf5.js} +3 -3
  121. package/dist/client/static/js/one-dark-pro-rvg5xm1a.js +1 -0
  122. package/dist/client/static/js/one-light-2b5w3ksh.js +1 -0
  123. package/dist/client/static/js/packet-AYTQ26CC-md85wpjq.js +1 -0
  124. package/dist/client/static/js/{pegDiagram-GJSIUBJH-4v4pf1h1.js → pegDiagram-GJSIUBJH-2s4ykhaa.js} +1 -1
  125. package/dist/client/static/js/{perl-rptyx23q.js → perl-6n93vjsa.js} +1 -1
  126. package/dist/client/static/js/{php-sagvq3wz.js → php-w23nmbtc.js} +1 -1
  127. package/dist/client/static/js/pie-WAS4IAKB-4grcqnp8.js +1 -0
  128. package/dist/client/static/js/{pieDiagram-5QR66LMP-a54yrmfm.js → pieDiagram-5QR66LMP-7h8dp0z3.js} +2 -2
  129. package/dist/client/static/js/properties-g6tpq003.js +1 -0
  130. package/dist/client/static/js/python-cy06fzhg.js +1 -0
  131. package/dist/client/static/js/{quadrantDiagram-O4NWA36T-1twhvnp2.js → quadrantDiagram-O4NWA36T-pteyxjxr.js} +6 -6
  132. package/dist/client/static/js/r-vw8berfv.js +1 -0
  133. package/dist/client/static/js/radar-RG4KPBEZ-7j9prhg1.js +1 -0
  134. package/dist/client/static/js/railroad-74A4TZTK-g8x2jps1.js +1 -0
  135. package/dist/client/static/js/railroad-abnf-HS5TGJTU-cbg7k68h.js +1 -0
  136. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-xfvjk9f8.js +1 -0
  137. package/dist/client/static/js/railroad-peg-WCYAUIDC-7w97805z.js +1 -0
  138. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-83tqfdcy.js → railroadDiagram-XR7U4H2S-68z9wdt0.js} +1 -1
  139. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-73e3pzw6.js → requirementDiagram-PLB6GJNP-c08nmey6.js} +4 -4
  140. package/dist/client/static/js/{ruby-9qyx7knh.js → ruby-ag3b3t9t.js} +1 -1
  141. package/dist/client/static/js/{rust-jds4e4r7.js → rust-ke5ec0w5.js} +1 -1
  142. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-1bzwj6sb.js → sankeyDiagram-IPEJSGJF-2r3kvjs5.js} +5 -5
  143. package/dist/client/static/js/{sass-07rteya0.js → sass-x0eez0kp.js} +1 -1
  144. package/dist/client/static/js/{scss-e2dndbfa.js → scss-qycakpjn.js} +1 -1
  145. package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-yh3h988k.js → sequenceDiagram-PO4LG4MO-ctjycd88.js} +19 -19
  146. package/dist/client/static/js/{sizeCapture-INFHLROL-1n121yp6.js → sizeCapture-INFHLROL-97ndea95.js} +1 -1
  147. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-0tdrzn06.js → stateDiagram-v2-GCMORJYK-aqnmsb96.js} +5 -5
  148. package/dist/client/static/js/{svelte-w365cpwa.js → svelte-tg19by0f.js} +1 -1
  149. package/dist/client/static/js/{swimlanes-2SLR337P-77n1ttdw.js → swimlanes-2SLR337P-v50cx1nx.js} +1 -1
  150. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-e227mz39.js +8 -0
  151. package/dist/client/static/js/{timeline-definition-EJHVYXUP-b6r0k3e8.js → timeline-definition-EJHVYXUP-1ggrtdcj.js} +7 -7
  152. package/dist/client/static/js/treeView-Q6P3EWNA-xhf1r6c3.js +1 -0
  153. package/dist/client/static/js/treemap-WGGIJYW6-4n3j7ekq.js +1 -0
  154. package/dist/client/static/js/tsx-3dzv8h6k.js +1 -0
  155. package/dist/client/static/js/typescript-44vs0wn4.js +1 -0
  156. package/dist/client/static/js/{usecaseDiagram-POWQR4AR-efq58m3m.js → usecaseDiagram-POWQR4AR-ybcwhpzs.js} +39 -39
  157. package/dist/client/static/js/{vennDiagram-UO4OBE2U-ad4gvd5r.js → vennDiagram-UO4OBE2U-p9ggrt07.js} +8 -8
  158. package/dist/client/static/js/{vue-d6cesny1.js → vue-mhj4sme0.js} +1 -1
  159. package/dist/client/static/js/wardley-WFR3VGLG-fb0py35r.js +1 -0
  160. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-v89tys2p.js → wardleyDiagram-VNRHLVJA-v79nb9kx.js} +4 -4
  161. package/dist/client/static/js/xml-yvv5fn3k.js +1 -0
  162. package/dist/client/static/js/{xychartDiagram-PMCCYNJV-xtgzmknw.js → xychartDiagram-PMCCYNJV-43thqscz.js} +5 -5
  163. package/dist/client/static/js/yaml-avewh7n5.js +1 -0
  164. package/marketplace/marketplace.json +7 -0
  165. package/marketplace/plugins/github-actions/README.md +142 -0
  166. package/marketplace/plugins/github-actions/icon.svg +12 -0
  167. package/marketplace/plugins/github-actions/package.json +30 -0
  168. package/marketplace/plugins/github-actions/settings-schema.json +27 -0
  169. package/marketplace/plugins/github-actions/src/app.tsx +32 -0
  170. package/marketplace/plugins/github-actions/src/panel/Actions.tsx +105 -0
  171. package/marketplace/plugins/github-actions/src/panel/LogView.tsx +76 -0
  172. package/marketplace/plugins/github-actions/src/panel/Row.tsx +59 -0
  173. package/marketplace/plugins/github-actions/src/panel/RunView.tsx +197 -0
  174. package/marketplace/plugins/github-actions/src/panel/format.ts +74 -0
  175. package/marketplace/plugins/github-actions/src/panel/index.test.tsx +86 -0
  176. package/marketplace/plugins/github-actions/src/panel/index.tsx +256 -0
  177. package/marketplace/plugins/github-actions/src/panel/picker.test.tsx +68 -0
  178. package/marketplace/plugins/github-actions/src/panel/test-fixtures.ts +98 -0
  179. package/marketplace/plugins/github-actions/src/panel/test-harness.tsx +175 -0
  180. package/marketplace/plugins/github-actions/src/protocol.ts +156 -0
  181. package/marketplace/plugins/github-actions/src/server/github.test.ts +264 -0
  182. package/marketplace/plugins/github-actions/src/server/github.ts +309 -0
  183. package/marketplace/plugins/github-actions/src/server/http.test.ts +150 -0
  184. package/marketplace/plugins/github-actions/src/server/http.ts +202 -0
  185. package/marketplace/plugins/github-actions/src/server/json.ts +44 -0
  186. package/marketplace/plugins/github-actions/src/server/logtext.test.ts +84 -0
  187. package/marketplace/plugins/github-actions/src/server/logtext.ts +59 -0
  188. package/marketplace/plugins/github-actions/src/server/progress.test.ts +96 -0
  189. package/marketplace/plugins/github-actions/src/server/progress.ts +62 -0
  190. package/marketplace/plugins/github-actions/src/server/remote.ts +84 -0
  191. package/marketplace/plugins/github-actions/src/server/scope.ts +51 -0
  192. package/marketplace/plugins/github-actions/src/server/token.ts +84 -0
  193. package/marketplace/plugins/github-actions/src/server.ts +163 -0
  194. package/marketplace/plugins/github-actions/src/state.test.ts +55 -0
  195. package/marketplace/plugins/github-actions/src/state.ts +63 -0
  196. package/marketplace/plugins/github-actions/tsconfig.json +16 -0
  197. package/marketplace/plugins/stats/package.json +2 -2
  198. package/marketplace/plugins/stats/src/proc/identity.ts +4 -3
  199. package/package.json +2 -2
  200. package/src/client/App.tsx +1 -1
  201. package/src/client/borders.css +143 -0
  202. package/src/client/components/common/context-usage-button/Ring.tsx +34 -9
  203. package/src/client/components/common/context-usage-button/index.test.tsx +19 -2
  204. package/src/client/components/common/context-usage-button/index.tsx +4 -4
  205. package/src/client/components/common/header-controls/index.test.tsx +26 -59
  206. package/src/client/components/common/header-controls/index.tsx +41 -52
  207. package/src/client/components/common/header-controls/phone-row.test.tsx +265 -0
  208. package/src/client/components/common/header-controls/plugin-entry.test.tsx +25 -3
  209. package/src/client/components/common/header-controls/shell-chrome.test.tsx +2 -2
  210. package/src/client/components/layout/LeftDock.tsx +7 -0
  211. package/src/client/components/layout/desktop-layout/DesktopOverlays.tsx +51 -0
  212. package/src/client/components/layout/desktop-layout/LeftColumn.tsx +117 -15
  213. package/src/client/components/layout/desktop-layout/RightColumn.tsx +257 -0
  214. package/src/client/components/layout/desktop-layout/TopNavbar.tsx +23 -24
  215. package/src/client/components/layout/desktop-layout/WorkspacePanels.tsx +50 -78
  216. package/src/client/components/layout/desktop-layout/index.tsx +73 -73
  217. package/src/client/components/layout/session-sidebar/Footer.test.tsx +20 -0
  218. package/src/client/components/layout/session-sidebar/Footer.tsx +24 -2
  219. package/src/client/components/layout/session-sidebar/Header.test.ts +10 -0
  220. package/src/client/components/layout/session-sidebar/Header.tsx +2 -2
  221. package/src/client/components/mobile/RightSidebar.tsx +164 -66
  222. package/src/client/components/mobile/header-titlebar.test.tsx +92 -0
  223. package/src/client/components/mobile/mobile-main-view/Header.test.tsx +2 -3
  224. package/src/client/components/mobile/mobile-main-view/Header.tsx +12 -10
  225. package/src/client/components/mobile/mobile-right-sidebar/Chrome.tsx +179 -0
  226. package/src/client/components/mobile/panel-chips.test.tsx +12 -0
  227. package/src/client/components/mobile/panel-chips.tsx +5 -1
  228. package/src/client/components/mobile/right-drawer-nav.test.tsx +258 -0
  229. package/src/client/components/settings/Modal.tsx +14 -9
  230. package/src/client/components/settings/ProjectSelectorDropdown.tsx +18 -6
  231. package/src/client/components/settings/SettingsSidebarList.tsx +2 -1
  232. package/src/client/components/settings/Sidebar.tsx +6 -4
  233. package/src/client/components/settings/apply-side-effects.test.ts +17 -0
  234. package/src/client/components/settings/apply-side-effects.ts +32 -5
  235. package/src/client/components/settings/band-height.test.tsx +122 -0
  236. package/src/client/components/settings/categories/AppearanceSettings.test.tsx +144 -0
  237. package/src/client/components/settings/categories/AppearanceSettings.tsx +81 -39
  238. package/src/client/components/settings/categories/ChatSettings.tsx +9 -15
  239. package/src/client/components/settings/categories/UsageSettings.tsx +2 -1
  240. package/src/client/components/settings/categories/appearance-settings/BorderStyleSection.test.tsx +101 -0
  241. package/src/client/components/settings/categories/appearance-settings/BorderStyleSection.tsx +134 -0
  242. package/src/client/components/settings/categories/appearance-settings/EditorBlameSection.tsx +2 -2
  243. package/src/client/components/settings/categories/appearance-settings/EditorFontSection.tsx +5 -5
  244. package/src/client/components/settings/categories/appearance-settings/EditorIndentSection.tsx +2 -2
  245. package/src/client/components/settings/categories/appearance-settings/EditorThemeSection.tsx +6 -6
  246. package/src/client/components/settings/categories/appearance-settings/EditorTypingSection.tsx +2 -2
  247. package/src/client/components/settings/categories/appearance-settings/IconStyleSection.tsx +2 -2
  248. package/src/client/components/settings/categories/appearance-settings/PanelNavSection.tsx +288 -0
  249. package/src/client/components/settings/categories/appearance-settings/SidebarStyleSection.tsx +2 -2
  250. package/src/client/components/settings/categories/appearance-settings/SurfaceStyleSection.tsx +2 -2
  251. package/src/client/components/settings/categories/appearance-settings/ThemeSection.tsx +42 -0
  252. package/src/client/components/settings/categories/appearance-settings/TrayIconSection.tsx +2 -2
  253. package/src/client/components/settings/categories/appearance-settings/groups.test.ts +47 -0
  254. package/src/client/components/settings/categories/appearance-settings/groups.ts +95 -0
  255. package/src/client/components/settings/categories/chat-settings/LayoutSection.tsx +31 -14
  256. package/src/client/components/settings/categories/mcp-settings/SidebarList.tsx +2 -1
  257. package/src/client/components/settings/categories/project-settings/SidebarList.tsx +2 -1
  258. package/src/client/components/settings/categories/provider-settings/SidebarList.tsx +2 -1
  259. package/src/client/components/settings/categories/usage-settings/SidebarList.tsx +2 -1
  260. package/src/client/components/settings/master-detail/GroupDetail.tsx +38 -0
  261. package/src/client/components/settings/{categories/chat-settings/SidebarList.tsx → master-detail/GroupSidebar.tsx} +35 -12
  262. package/src/client/components/settings/master-detail/index.tsx +3 -1
  263. package/src/client/components/settings/pane-header.ts +25 -0
  264. package/src/client/components/workspace/browser-toolbar/index.test.tsx +39 -1
  265. package/src/client/components/workspace/browser-toolbar/index.tsx +53 -17
  266. package/src/client/components/workspace/chat-timeline/ColumnResizeHandle.tsx +107 -0
  267. package/src/client/components/workspace/chat-timeline/ComposerDockFrame.tsx +9 -3
  268. package/src/client/components/workspace/chat-timeline/EmptyWorkspacePrompt.tsx +35 -26
  269. package/src/client/components/workspace/chat-timeline/TimelineBody.tsx +6 -0
  270. package/src/client/components/workspace/chat-timeline/column-resize.test.tsx +292 -0
  271. package/src/client/components/workspace/chat-timeline/composer-dock-frame.test.tsx +5 -3
  272. package/src/client/components/workspace/context-panel/index.tsx +10 -4
  273. package/src/client/components/workspace/editor/EditorHideButton.tsx +41 -0
  274. package/src/client/components/workspace/editor/EmptyEditor.tsx +11 -2
  275. package/src/client/components/workspace/editor/PluginColumn.tsx +11 -1
  276. package/src/client/components/workspace/editor/Tabs.tsx +8 -0
  277. package/src/client/components/workspace/editor/editor-hide-button.test.ts +144 -0
  278. package/src/client/components/workspace/editor/index.tsx +8 -2
  279. package/src/client/components/workspace/editor/props.ts +9 -0
  280. package/src/client/components/workspace/file-explorer/RowLabel.test.tsx +90 -0
  281. package/src/client/components/workspace/file-explorer/RowLabel.tsx +1 -4
  282. package/src/client/components/workspace/git-panel/commit-modal/CommitRow.test.ts +52 -46
  283. package/src/client/components/workspace/git-panel/commit-modal/CommitRow.tsx +41 -21
  284. package/src/client/components/workspace/git-panel/commit-modal/GraphCanvas.tsx +6 -5
  285. package/src/client/components/workspace/git-panel/commit-modal/index.tsx +19 -22
  286. package/src/client/components/workspace/panel-header/title-policy.test.tsx +62 -0
  287. package/src/client/components/workspace/panel-header/title-policy.tsx +83 -0
  288. package/src/client/components/workspace/panel-tabs/Home.density.test.tsx +122 -0
  289. package/src/client/components/workspace/panel-tabs/Home.test.tsx +137 -0
  290. package/src/client/components/workspace/panel-tabs/Home.tsx +118 -0
  291. package/src/client/components/workspace/panel-tabs/TabChip.tsx +173 -0
  292. package/src/client/components/workspace/panel-tabs/TabStrip.test.tsx +339 -0
  293. package/src/client/components/workspace/panel-tabs/TabStrip.tsx +302 -0
  294. package/src/client/components/workspace/panel-tabs/index.tsx +105 -0
  295. package/src/client/components/workspace/panels/builtin.tsx +9 -0
  296. package/src/client/components/workspace/plan-panel/index.tsx +7 -2
  297. package/src/client/components/workspace/repo-picker/Modal.tsx +1 -1
  298. package/src/client/components/workspace/repo-picker/index.test.tsx +32 -8
  299. package/src/client/components/workspace/repo-picker/index.tsx +2 -2
  300. package/src/client/components/workspace/search-panel/Body.tsx +7 -1
  301. package/src/client/components/workspace/search-panel/index.tsx +2 -1
  302. package/src/client/components/workspace/terminal-panel/Header.tsx +10 -3
  303. package/src/client/components/workspace/terminal-panel/index.tsx +4 -1
  304. package/src/client/components/workspace/todo-panel/index.tsx +6 -1
  305. package/src/client/components/workspace/usage-panel/index.tsx +7 -2
  306. package/src/client/components/workspace/user-browser-panel/AddressBar.tsx +43 -4
  307. package/src/client/components/workspace/user-browser-panel/Frame.tsx +101 -45
  308. package/src/client/components/workspace/user-browser-panel/TabStrip.tsx +107 -0
  309. package/src/client/components/workspace/user-browser-panel/index.tsx +31 -6
  310. package/src/client/glass.test.ts +1 -1
  311. package/src/client/hooks/browser/use-annotate.ts +6 -5
  312. package/src/client/hooks/browser/use-user-browser.test.tsx +279 -0
  313. package/src/client/hooks/browser/use-user-browser.ts +190 -44
  314. package/src/client/hooks/chat/timeline/column-drag.ts +171 -0
  315. package/src/client/hooks/chat/timeline/width-mode.test.ts +112 -11
  316. package/src/client/hooks/chat/timeline/width-mode.ts +91 -18
  317. package/src/client/hooks/ui/border-style.test.ts +172 -0
  318. package/src/client/hooks/ui/border-style.ts +60 -0
  319. package/src/client/hooks/ui/navbar-controls.test.ts +27 -1
  320. package/src/client/hooks/ui/navbar-controls.ts +95 -20
  321. package/src/client/hooks/ui/style-attributes.test.ts +2 -0
  322. package/src/client/hooks/workspace/active-project.ts +46 -0
  323. package/src/client/hooks/workspace/commit-expansion.test.ts +135 -0
  324. package/src/client/hooks/workspace/commit-expansion.ts +56 -0
  325. package/src/client/hooks/workspace/mobile-right-panel-nav.ts +63 -0
  326. package/src/client/hooks/workspace/panel-nav.test.ts +140 -0
  327. package/src/client/hooks/workspace/panel-nav.ts +95 -0
  328. package/src/client/hooks/workspace/panel-tabs.session.test.tsx +235 -0
  329. package/src/client/hooks/workspace/panel-tabs.ts +194 -0
  330. package/src/client/hooks/workspace/right-open-request.ts +53 -0
  331. package/src/client/hooks/workspace/right-side.test.ts +204 -0
  332. package/src/client/hooks/workspace/right-side.ts +142 -0
  333. package/src/client/lib/ui/control-plate.ts +33 -0
  334. package/src/client/main.tsx +9 -4
  335. package/src/client/tailwind.css +6 -0
  336. package/src/server/lib/assets/shell-attributes.server.ts +26 -10
  337. package/src/server/lib/assets/shell-attributes.test.ts +26 -0
  338. package/src/server/lib/bundler/titlebar-css.test.ts +5 -3
  339. package/src/server/lib/harness/acp/background-replay.test.ts +16 -1
  340. package/src/server/lib/harness/acp/background-replay.ts +6 -1
  341. package/src/server/lib/harness/acp/background-work.ts +44 -31
  342. package/src/server/lib/harness/acp/session-turns.ts +4 -3
  343. package/src/server/lib/harness/acp/session-wiring.test.ts +53 -0
  344. package/src/server/lib/harness/acp/session-wiring.ts +11 -2
  345. package/src/server/lib/harness/session-lease.server.ts +3 -2
  346. package/src/server/lib/omp/session/lease-probe.server.test.ts +82 -0
  347. package/src/server/lib/omp/session/lease-probe.server.ts +180 -0
  348. package/src/server/lib/omp/session/ownership.server.test.ts +17 -6
  349. package/src/server/lib/omp/session/ownership.server.ts +7 -5
  350. package/src/server/plugins/ssr.ts +6 -3
  351. package/src/shared/lib/browser/user-tabs.test.ts +165 -0
  352. package/src/shared/lib/browser/user-tabs.ts +172 -0
  353. package/src/shared/lib/chat/timeline/width-mode.test.ts +34 -2
  354. package/src/shared/lib/chat/timeline/width-mode.ts +71 -22
  355. package/src/shared/lib/commands/catalog.ts +2 -2
  356. package/src/shared/lib/fs/git-status.test.ts +23 -0
  357. package/src/shared/lib/fs/git-status.ts +15 -0
  358. package/src/shared/lib/icons/tint-hues.generated.ts +20 -20
  359. package/src/shared/lib/settings/defaults.ts +8 -1
  360. package/src/shared/lib/theme/border-style.test.ts +83 -0
  361. package/src/shared/lib/theme/border-style.ts +122 -0
  362. package/src/shared/lib/workspace/keymap.ts +2 -1
  363. package/src/shared/lib/workspace/panel-nav.test.ts +198 -0
  364. package/src/shared/lib/workspace/panel-nav.ts +148 -0
  365. package/src/shared/lib/workspace/panel-tabs-close.test.ts +154 -0
  366. package/src/shared/lib/workspace/panel-tabs.ts +105 -0
  367. package/src/shared/lib/workspace/session-state/cache.ts +22 -0
  368. package/src/shared/lib/workspace/session-state/merge.ts +6 -0
  369. package/src/shared/lib/workspace/session-state/store.ts +23 -0
  370. package/src/shared/types/settings/state.ts +58 -3
  371. package/src/test-support/header-controls-harness.ts +22 -0
  372. package/src/test-support/peer-harness.ts +2 -2
  373. package/dist/client/static/js/ImageView-rnzf5tve.js +0 -1
  374. package/dist/client/static/js/LayoutWrapper-rekrgth6.js +0 -2
  375. package/dist/client/static/js/SessionsView-e84tjbcr.js +0 -1
  376. package/dist/client/static/js/architecture-7GRP2DOG-7j23x20s.js +0 -1
  377. package/dist/client/static/js/bash-vv2ysp0a.js +0 -1
  378. package/dist/client/static/js/c-8jf64j6h.js +0 -1
  379. package/dist/client/static/js/cpp-vh94zee0.js +0 -1
  380. package/dist/client/static/js/css-a13jmmnc.js +0 -1
  381. package/dist/client/static/js/css-p57h1fme.js +0 -1
  382. package/dist/client/static/js/cynefin-OW5HDTMX-me5xnx6a.js +0 -1
  383. package/dist/client/static/js/eventmodeling-NTZA5JFV-5zbvjj84.js +0 -1
  384. package/dist/client/static/js/flowDiagram-KWPJA3E3-36ygrbvm.js +0 -1
  385. package/dist/client/static/js/gitGraph-4MIJSDKK-tjhkv71w.js +0 -1
  386. package/dist/client/static/js/graphql-kesh8gk0.js +0 -1
  387. package/dist/client/static/js/html-sxpfydga.js +0 -1
  388. package/dist/client/static/js/index-0q2qfcjn.js +0 -1
  389. package/dist/client/static/js/index-48gh56ka.js +0 -3
  390. package/dist/client/static/js/index-4rv388z7.js +0 -2
  391. package/dist/client/static/js/index-52xmdeh2.js +0 -1
  392. package/dist/client/static/js/index-8kqepehd.js +0 -12
  393. package/dist/client/static/js/index-cje5gg45.js +0 -1
  394. package/dist/client/static/js/index-fbcg8y95.js +0 -1
  395. package/dist/client/static/js/index-g3shdymf.js +0 -1
  396. package/dist/client/static/js/index-h5n1btqy.js +0 -1
  397. package/dist/client/static/js/index-m1n4v0z7.js +0 -9
  398. package/dist/client/static/js/index-rn8w29pv.js +0 -2
  399. package/dist/client/static/js/index-s00j9042.js +0 -2
  400. package/dist/client/static/js/index-s7rfbydk.js +0 -4
  401. package/dist/client/static/js/index-sg6sz3g8.js +0 -1
  402. package/dist/client/static/js/index-vcrh95gf.css +0 -1
  403. package/dist/client/static/js/index-w5rw8f7w.js +0 -1
  404. package/dist/client/static/js/index-x6v37h3j.js +0 -1
  405. package/dist/client/static/js/info-A6RAGUB7-m6qz24p8.js +0 -1
  406. package/dist/client/static/js/ini-1x0ad976.js +0 -1
  407. package/dist/client/static/js/java-3944nq02.js +0 -1
  408. package/dist/client/static/js/javascript-zegm06a1.js +0 -1
  409. package/dist/client/static/js/json-g5ggnd94.js +0 -1
  410. package/dist/client/static/js/jsx-f6p72qpc.js +0 -1
  411. package/dist/client/static/js/lua-edn2b3wn.js +0 -1
  412. package/dist/client/static/js/markdown-9dhg1fax.js +0 -1
  413. package/dist/client/static/js/one-dark-pro-hteqzfb0.js +0 -1
  414. package/dist/client/static/js/one-light-dapnh0rs.js +0 -1
  415. package/dist/client/static/js/packet-AYTQ26CC-ng6wq5xj.js +0 -1
  416. package/dist/client/static/js/pie-WAS4IAKB-rf6jhxf6.js +0 -1
  417. package/dist/client/static/js/properties-fcmj08pv.js +0 -1
  418. package/dist/client/static/js/python-532d8ezm.js +0 -1
  419. package/dist/client/static/js/r-ptmdxs2a.js +0 -1
  420. package/dist/client/static/js/radar-RG4KPBEZ-ygp6hxq4.js +0 -1
  421. package/dist/client/static/js/railroad-74A4TZTK-rxgnrb2g.js +0 -1
  422. package/dist/client/static/js/railroad-abnf-HS5TGJTU-xkv52a2p.js +0 -1
  423. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-bvcktbqh.js +0 -1
  424. package/dist/client/static/js/railroad-peg-WCYAUIDC-9c3v7jsq.js +0 -1
  425. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-akjqm31r.js +0 -8
  426. package/dist/client/static/js/treeView-Q6P3EWNA-fb58a7z1.js +0 -1
  427. package/dist/client/static/js/treemap-WGGIJYW6-ej4qhksx.js +0 -1
  428. package/dist/client/static/js/tsx-zfy727zs.js +0 -1
  429. package/dist/client/static/js/typescript-683kkkaw.js +0 -1
  430. package/dist/client/static/js/wardley-WFR3VGLG-mkp0kanv.js +0 -1
  431. package/dist/client/static/js/xml-6ct32gys.js +0 -1
  432. package/dist/client/static/js/yaml-1d5m3bfj.js +0 -1
  433. package/src/server/lib/omp/session/lease-flock.server.ts +0 -117
@@ -0,0 +1,154 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * A request is an EVENT and must be applied once.
8
+ *
9
+ * The bug this pins, measured in the browser: closing the last tab returned to
10
+ * the home page for one frame and the strip then showed the requested view
11
+ * again, so the X looked broken. The cause was an effect keyed on the REQUEST
12
+ * but closing over `open()`, whose identity changes with every tab write — so
13
+ * the effect re-ran after the user's own next action and forced the tab back.
14
+ *
15
+ * `appliedRequest` makes the nonce, not the callback, the trigger. These tests
16
+ * drive the reducer-level rule the effect relies on: a request for the same
17
+ * nonce is one opening, a new nonce is a new one.
18
+ */
19
+
20
+ import { describe, expect, test } from 'bun:test';
21
+ import {
22
+ closePanelTab,
23
+ nextActiveTab,
24
+ openPanelTab,
25
+ type PanelTabs,
26
+ } from '@/shared/lib/workspace/panel-tabs';
27
+
28
+ /**
29
+ * The strip's close rule, as one call: the list and the selection move together.
30
+ *
31
+ * Mirrors `usePanelTabs().close`, which writes `{ tabs, active, home }` in one
32
+ * update so no render ever sees a closed tab still named as active.
33
+ */
34
+ function close(tabs: PanelTabs, active: string | null, id: string, pinned?: string) {
35
+ const next = closePanelTab(tabs, id, pinned);
36
+ return { tabs: next, active: nextActiveTab(tabs, next, active), home: next.length === 0 };
37
+ }
38
+
39
+ describe('closing the ACTIVE tab moves the selection, then falls back to home', () => {
40
+ test('a middle tab hands the selection to the one on its right', () => {
41
+ const result = close(['files', 'git', 'todo'], 'git', 'git');
42
+ expect(result.tabs).toEqual(['files', 'todo']);
43
+ expect(result.active).toBe('todo');
44
+ expect(result.home).toBe(false);
45
+ });
46
+
47
+ test('the rightmost tab hands it to the one on its LEFT', () => {
48
+ const result = close(['files', 'git'], 'git', 'git');
49
+ expect(result.tabs).toEqual(['files']);
50
+ expect(result.active).toBe('files');
51
+ expect(result.home).toBe(false);
52
+ });
53
+
54
+ test('the last remaining tab lands on the home page', () => {
55
+ const result = close(['files'], 'files', 'files');
56
+ expect(result.tabs).toEqual([]);
57
+ expect(result.active).toBeNull();
58
+ expect(result.home).toBe(true);
59
+ });
60
+
61
+ test('closing a BACKGROUND tab leaves the selection where it was', () => {
62
+ const result = close(['files', 'git', 'todo'], 'files', 'todo');
63
+ expect(result.tabs).toEqual(['files', 'git']);
64
+ expect(result.active).toBe('files');
65
+ expect(result.home).toBe(false);
66
+ });
67
+
68
+ test('the pinned view refuses to close, so the column keeps its way back', () => {
69
+ const result = close(['sessions', 'git'], 'sessions', 'sessions', 'sessions');
70
+ expect(result.tabs).toEqual(['sessions', 'git']);
71
+ expect(result.active).toBe('sessions');
72
+ });
73
+ });
74
+
75
+ describe('adopting a dragged order', () => {
76
+ /**
77
+ * The strip's commit rule, as one call: only ids that are still OPEN survive,
78
+ * and the pinned view is put back in front.
79
+ *
80
+ * Mirrors `usePanelTabs().setOrder`, which refuses a list that is not a
81
+ * permutation of the open set — a drag renders what the strip drew, and a chip
82
+ * closed mid-gesture is not the user's arrangement.
83
+ */
84
+ function adoptOrder(tabs: PanelTabs, ids: readonly string[], pinned?: string) {
85
+ if (ids.length !== tabs.length) return tabs;
86
+ const open = new Set(tabs);
87
+ const next = ids.filter((id) => open.has(id));
88
+ if (next.length !== tabs.length || new Set(next).size !== tabs.length) return tabs;
89
+ return pinned ? [pinned, ...next.filter((id) => id !== pinned)] : next;
90
+ }
91
+
92
+ test('a valid drag adopts the new order', () => {
93
+ expect(adoptOrder(['files', 'git', 'todo'], ['todo', 'files', 'git'])).toEqual(['todo', 'files', 'git']);
94
+ });
95
+
96
+ test('a list that LOST a tab is refused, so a mid-drag close is not an arrangement', () => {
97
+ const tabs = ['files', 'git', 'todo'];
98
+ expect(adoptOrder(tabs, ['todo', 'files'])).toEqual(tabs);
99
+ });
100
+
101
+ test('a list that GAINED an id is refused, so a drag cannot invent a tab', () => {
102
+ const tabs = ['files', 'git'];
103
+ expect(adoptOrder(tabs, ['files', 'git', 'ghost'])).toEqual(tabs);
104
+ });
105
+
106
+ test('the pinned view leads whatever the drop said', () => {
107
+ expect(adoptOrder(['sessions', 'git', 'todo'], ['git', 'todo', 'sessions'], 'sessions')).toEqual([
108
+ 'sessions',
109
+ 'git',
110
+ 'todo',
111
+ ]);
112
+ });
113
+
114
+ test('a duplicate in the dropped list is refused rather than collapsed silently', () => {
115
+ const tabs = ['files', 'git'];
116
+ expect(adoptOrder(tabs, ['files', 'files'])).toEqual(tabs);
117
+ });
118
+
119
+ test('reordering never changes WHICH tab is open, only their order', () => {
120
+ const before = ['files', 'git', 'todo'];
121
+ const after = adoptOrder(before, ['todo', 'git', 'files']);
122
+ expect([...after].sort()).toEqual([...before].sort());
123
+ });
124
+ });
125
+
126
+ describe('a request applied once', () => {
127
+ /**
128
+ * The effect's rule, in isolation: given the nonce already applied, does this
129
+ * request still need opening?
130
+ */
131
+ const shouldApply = (applied: number | null, request: { panelKey: string; nonce: number } | null) =>
132
+ request !== null && applied !== request.nonce;
133
+
134
+ test('the first request for a view applies', () => {
135
+ expect(shouldApply(null, { panelKey: 'git', nonce: 1 })).toBe(true);
136
+ });
137
+
138
+ test('the SAME nonce does not apply again, which is what kept a closed tab alive', () => {
139
+ expect(shouldApply(1, { panelKey: 'git', nonce: 1 })).toBe(false);
140
+ });
141
+
142
+ test('a second press on the same view is a new event and applies again', () => {
143
+ expect(shouldApply(1, { panelKey: 'git', nonce: 2 })).toBe(true);
144
+ });
145
+
146
+ test('no request applies nothing', () => {
147
+ expect(shouldApply(null, null)).toBe(false);
148
+ });
149
+
150
+ test('opening is idempotent on the LIST, so a re-applied request cannot duplicate a tab', () => {
151
+ const once = openPanelTab(['files'], 'git');
152
+ expect(openPanelTab(once, 'git')).toEqual(['files', 'git']);
153
+ });
154
+ });
@@ -0,0 +1,105 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The OPEN tabs of a desktop panel column, as data.
8
+ *
9
+ * A browser column keeps a working set, not a catalog: the strip shows what the
10
+ * user opened, the home page shows what could be opened, and the two are
11
+ * different lists. This module is that working set — pure functions over an
12
+ * array of panel ids — so the strip, the home page and the column body cannot
13
+ * disagree about what is open, and the rules can be tested without mounting
14
+ * anything.
15
+ *
16
+ * Five rules, and each is a defect if dropped:
17
+ *
18
+ * 1. **One tab per panel.** The id IS the key: opening a view that is already
19
+ * open focuses its tab rather than appending a second one, which is the
20
+ * "duplicate tab" a card grid invites.
21
+ * 2. **A pinned tab cannot be closed.** The left column's session list is the
22
+ * reason the column exists; a chat with no way back to another chat is a dead
23
+ * end. `SESSIONS_VIEW_ID` is pinned by the caller, not encoded here.
24
+ * 3. **Closing the ACTIVE tab moves the selection**, to the right neighbour
25
+ * first (the tab that took its place), else the left one. Closing a tab you
26
+ * are not looking at leaves the selection alone.
27
+ * 4. **Closing the last tab leaves the column on its home page**, not on a blank
28
+ * body and not on an implicit view the user never opened.
29
+ * 5. **A stored id this build cannot draw is dropped on read**, not rendered as
30
+ * an empty body. A disabled panel, an uninstalled plugin, a bundle that has
31
+ * not loaded yet all produce that state.
32
+ */
33
+
34
+ /** The ids a column is showing, in strip order. */
35
+ export type PanelTabs = readonly string[];
36
+
37
+ /** Opening a view that is already open focuses it; it never appends. */
38
+ export function openPanelTab(tabs: PanelTabs, id: string): PanelTabs {
39
+ return tabs.includes(id) ? tabs : [...tabs, id];
40
+ }
41
+
42
+ /**
43
+ * Close one tab.
44
+ *
45
+ * Returns the surviving list; the caller decides the selection with
46
+ * `nextActiveTab` so the two questions stay separate (closing a background tab
47
+ * must not move the selection).
48
+ */
49
+ export function closePanelTab(tabs: PanelTabs, id: string, pinned?: string): PanelTabs {
50
+ if (id === pinned) return tabs;
51
+ return tabs.filter((tab) => tab !== id);
52
+ }
53
+
54
+ /**
55
+ * Which tab a column shows after the list changed — the four cases a strip has.
56
+ *
57
+ * - the current selection still exists → keep it (a background close, an open of
58
+ * an already-open view);
59
+ * - the selection was closed → the tab that slid into its index, else the one
60
+ * before it;
61
+ * - nothing is open → `null`, which is the home page;
62
+ * - the selection named a view this build cannot draw → the first tab.
63
+ */
64
+ export function nextActiveTab(
65
+ previous: PanelTabs,
66
+ next: PanelTabs,
67
+ activeId: string | null,
68
+ ): string | null {
69
+ if (next.length === 0) return null;
70
+ if (activeId !== null && next.includes(activeId)) return activeId;
71
+ if (activeId === null) return next[0] ?? null;
72
+ // The closed tab's own index in the OLD list is where its replacement now
73
+ // sits: the tab after it, or the last one when it was the tail.
74
+ const index = previous.indexOf(activeId);
75
+ if (index === -1) return next[0] ?? null;
76
+ return next[Math.min(index, next.length - 1)] ?? next[0] ?? null;
77
+ }
78
+
79
+ /**
80
+ * The stored list, filtered against what the column can draw right now.
81
+ *
82
+ * Order is preserved, duplicates are dropped, and a survivor list is returned
83
+ * even when everything was filtered out — an empty list is the home page, which
84
+ * is a state, not an error.
85
+ */
86
+ export function visiblePanelTabs(tabs: PanelTabs, known: ReadonlySet<string>): PanelTabs {
87
+ const seen = new Set<string>();
88
+ const out: string[] = [];
89
+ for (const id of tabs) {
90
+ if (!known.has(id) || seen.has(id)) continue;
91
+ seen.add(id);
92
+ out.push(id);
93
+ }
94
+ return out;
95
+ }
96
+
97
+ /**
98
+ * The pinned view is always the FIRST tab of its column.
99
+ *
100
+ * A tab strip whose first chip moves is a strip the user has to re-read; the
101
+ * session list is the column's own view, so it leads on every read.
102
+ */
103
+ export function withPinnedTab(tabs: PanelTabs, pinned: string): PanelTabs {
104
+ return tabs[0] === pinned ? tabs : [pinned, ...tabs.filter((id) => id !== pinned)];
105
+ }
@@ -120,6 +120,28 @@ export function dropEntry(sessionId: string): void {
120
120
  dropPersistTimer(sessionId);
121
121
  }
122
122
 
123
+ /**
124
+ * Drop EVERY entry, the write history and the pending timers.
125
+ *
126
+ * Exists for the test process, not the app: the store is a module singleton, and
127
+ * `bun test` runs every suite in one process, so a suite that writes a slot and
128
+ * forgets it leaves the cache holding an entry. Enough of those and the 10-entry
129
+ * LRU fills; the next suite's `hydrateSession` then evicts the session it just
130
+ * seeded, because a leaked entry that is DIRTY (a debounced persist that never
131
+ * landed) is never evicted and so consumes a permanent slot. Measured: a full
132
+ * run evicted `s-a` at size 11 in `panel-tabs.session.test.tsx`, a case that
133
+ * passes alone and on a developer machine but failed on every CI leg.
134
+ *
135
+ * Never called from product code — a reset here would drop user state.
136
+ */
137
+ export function resetCache(): void {
138
+ for (const timer of persistTimers.values()) clearTimeout(timer);
139
+ entries.clear();
140
+ lastTouched.clear();
141
+ dirty.clear();
142
+ persistTimers.clear();
143
+ }
144
+
123
145
  /**
124
146
  * Evict the oldest clean sessions until the cache is within bounds.
125
147
  *
@@ -63,6 +63,12 @@ export function keysWrittenAfter(sessionId: string, since: number): Set<string>
63
63
  return written;
64
64
  }
65
65
 
66
+ /** Drop every session's write history — the store's reset, for a test process. */
67
+ export function resetWrites(): void {
68
+ writeSeq = 0;
69
+ writeLog.clear();
70
+ }
71
+
66
72
  /** Drop a session's write history — evicted, forgotten or adopted away. */
67
73
  export function forgetWrites(sessionId: string): void {
68
74
  writeLog.delete(sessionId);
@@ -16,6 +16,11 @@
16
16
  * which are migrated on the first open.
17
17
  * - layout.activeRightPanel RightPanelType
18
18
  * - layout.showRightPanel boolean
19
+ * - layout.rightSideHidden boolean — the whole right side (editor column,
20
+ * right panel and their rail) is put away by the
21
+ * navbar's one control; the two columns keep their
22
+ * own flags, so showing the side returns them as
23
+ * they were last left.
19
24
  * - layout.showLeftPanel boolean
20
25
  * - layout.userToggledEditor boolean | null (null = follow whether a file is open)
21
26
  * - layout.panelWidths PanelWidths (the editor's and the right panel's
@@ -94,6 +99,7 @@ import {
94
99
  lastAccess,
95
100
  markDirty,
96
101
  readEntry,
102
+ resetCache,
97
103
  setPersistTimer,
98
104
  stampAccess,
99
105
  touchEntry,
@@ -105,6 +111,7 @@ import {
105
111
  keysWrittenAfter,
106
112
  mergeStoredBlob,
107
113
  noteWrite,
114
+ resetWrites,
108
115
  } from '@/shared/lib/workspace/session-state/merge';
109
116
 
110
117
  type SessionState = Record<string, unknown>;
@@ -256,6 +263,22 @@ export function hydrateSession(sessionId: string | null, state: SessionState): v
256
263
  notifySessionReplaced(sessionId);
257
264
  }
258
265
 
266
+ /**
267
+ * Drop every cached session and the write history that goes with it.
268
+ *
269
+ * The store is a module singleton, so `bun test`'s single process shares it
270
+ * across suites. A suite that writes a slot and does not forget it leaves an
271
+ * entry behind, and once the LRU is full the next suite's `hydrateSession` can
272
+ * evict the session it just seeded. This is the seam that makes a suite
273
+ * independent of what ran before it.
274
+ *
275
+ * Test-only: product code must never call this.
276
+ */
277
+ export function resetSessionStateStore(): void {
278
+ resetCache();
279
+ resetWrites();
280
+ }
281
+
259
282
  /**
260
283
  * Record that the user opened this session now. Drives the mobile header's
261
284
  * recent-session picker and the cache TTL: a session is "recent" only while
@@ -2,8 +2,10 @@ import type { ThemeId } from '@/shared/lib/theme/catalog';
2
2
  import type { ChatWidthMode } from '@/shared/lib/chat/timeline/width-mode';
3
3
  import type { ToolRenderMode } from '@/shared/lib/chat/timeline/tool-render-mode';
4
4
  import type { SidebarStyle } from '@/shared/lib/workspace/sidebar-style';
5
+ import type { MobileRightPanelNav, PanelNavStyle } from '@/shared/lib/workspace/panel-nav';
5
6
  import type { ComposerStyle } from '@/shared/lib/chat/composer/style';
6
7
  import type { SurfaceStyle } from '@/shared/lib/theme/surface-style';
8
+ import type { BorderStyle } from '@/shared/lib/theme/border-style';
7
9
  import type { IconStyle } from '@/shared/lib/theme/icon-style';
8
10
  import type { TrayIconStyle } from '@/shared/lib/theme/tray-icon-style';
9
11
  import type { SettingsSection } from '@/shared/lib/settings/sections';
@@ -141,15 +143,23 @@ export interface SettingsState {
141
143
  */
142
144
  goalDefaultBudget: number | null;
143
145
  /**
144
- * How wide the chat's content column is (`compact` | `wide` | `full`). A
145
- * READING width, not a layout: no mode hides a panel. The numbers live in
146
- * `tailwind.css` (`--chat-column-max`); this field only names the choice.
146
+ * How wide the chat's content column is (`compact` | `wide` | `full` |
147
+ * `custom`). A READING width, not a layout: no mode hides a panel. The
148
+ * PRESET numbers live in `tailwind.css` (`--chat-column-max`); `custom` draws
149
+ * at `chatColumnWidth` below.
147
150
  *
148
151
  * Global, not per-session: a comfortable line length is a property of the
149
152
  * person and the display, not of one conversation, and a per-session value
150
153
  * would send every new chat back to the default.
151
154
  */
152
155
  chatWidthMode: ChatWidthMode;
156
+ /**
157
+ * Pixel width a `custom` column draws at, written by dragging the column's
158
+ * edge. Kept while a preset is active, so picking Custom again restores the
159
+ * width the user dragged instead of a placeholder. Clamped on read
160
+ * (`resolveChatColumnWidth`), because a stored value is untrusted input.
161
+ */
162
+ chatColumnWidth: number;
153
163
  /**
154
164
  * How a tool call is drawn in the transcript (`card` | `compact` | `trace` |
155
165
  * `minimal` | `tui`). A reading style: every mode renders the same call,
@@ -176,6 +186,36 @@ export interface SettingsState {
176
186
  * `classic` is the default so an upgrade rearranges nothing.
177
187
  */
178
188
  sidebarStyle: SidebarStyle;
189
+ /**
190
+ * How the DESKTOP left panel column is navigated (`rail` | `tabs`).
191
+ *
192
+ * A PRESENTATION choice over one catalog: both styles draw the same views and
193
+ * the same bodies. `rail` is the 44px vertical activity bar every install
194
+ * already has; `tabs` is a browser-style strip of opened views over a home
195
+ * page that draws the whole catalog as a card grid.
196
+ *
197
+ * **Independent of `rightPanelNav`**, and desktop-only: a phone has one drawer
198
+ * per side and keeps its chip strip, so `mobile/**` never reads either value.
199
+ * `rail` is the default so an upgrade rearranges nothing.
200
+ */
201
+ leftPanelNav: PanelNavStyle;
202
+ /**
203
+ * How the DESKTOP right panel column is navigated (`rail` | `tabs`).
204
+ *
205
+ * Independent of `leftPanelNav`: the two columns answer different questions
206
+ * (the left is the session list plus placed panels, the right is a working set
207
+ * the user opens and closes), so a user may want tabs on one and the rail on
208
+ * the other. Desktop-only, like its left counterpart.
209
+ */
210
+ rightPanelNav: PanelNavStyle;
211
+ /**
212
+ * How the PHONE's right drawer navigates its views (`classic` | `tabs`).
213
+ *
214
+ * Its own axis, not a reuse of the desktop values: a phone has no rail to put
215
+ * beside a drawer that already is the screen, so the choice is between "every
216
+ * view is a chip" and "the strip holds what is open, over a home page".
217
+ */
218
+ mobileRightPanelNav: MobileRightPanelNav;
179
219
  /**
180
220
  * How the chat composer is drawn (`classic` | `calm` | `console` | `stage`).
181
221
  * A PRESENTATION choice over one composer: every style renders the same
@@ -199,6 +239,21 @@ export interface SettingsState {
199
239
  * call site each. `classic` is the default so an upgrade restyles nothing.
200
240
  */
201
241
  surfaceStyle: SurfaceStyle;
242
+ /**
243
+ * How the app's HAIRLINES are drawn (`hairline` | `borderless`). A
244
+ * presentation choice over one shell: both styles draw the same panels, rows
245
+ * and controls, and `borderless` removes only the 1px rules between them —
246
+ * never a control's own edge, a validation colour, a drop zone or a focus
247
+ * ring, because those are facts and affordances rather than decoration. The
248
+ * table lives in `shared/lib/theme/border-style.ts`; the pixels are the
249
+ * `[data-borders="borderless"]` block in `src/client/borders.css`.
250
+ *
251
+ * It reaches the document as `data-borders` on `<html>`, for the same reason
252
+ * as the surface material: the sidebar, navbar, composer and every modal are
253
+ * separate subtrees. `hairline` is what CSS paints with no attribute, so an
254
+ * upgrade removes nothing.
255
+ */
256
+ borderStyle: BorderStyle;
202
257
  /**
203
258
  * How EVERY icon is painted (`monochrome` | `color`): functional Lucide
204
259
  * glyphs, provider/model marks and file-type marks. `color` gives each glyph
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * `HeaderControls` with the plugin entries its surface resolves.
8
+ *
9
+ * The cluster takes `entries` from its caller (the row and the visibility menu
10
+ * are two halves of one `useHeaderEntries` answer), so a suite that mounts the
11
+ * cluster on its own has to stand in for that caller. This harness is the
12
+ * caller, not a second contract: it renders the real component with the real
13
+ * hook against the suite's realtime server and plugin registry.
14
+ */
15
+
16
+ import { h } from 'preact';
17
+ import { HeaderControls, type HeaderControlsProps } from '@/client/components/common/header-controls';
18
+ import { useHeaderEntries } from '@/client/components/common/header-panel-buttons/entries';
19
+
20
+ export function HeaderControlsHarness(props: Omit<HeaderControlsProps, 'entries'>) {
21
+ return h(HeaderControls, { ...props, entries: useHeaderEntries(props.layout) });
22
+ }
@@ -23,7 +23,7 @@ import { join } from 'node:path';
23
23
 
24
24
  import type { RealtimeConnection } from '@/server/lib/realtime/hub.server';
25
25
  import { sessionLeasePath } from '@/server/lib/omp/session/ownership.server';
26
- import { leaseHeldByAnother } from '@/server/lib/omp/session/lease-flock.server';
26
+ import { leaseHeldByAnother } from '@/server/lib/omp/session/lease-probe.server';
27
27
  import { isProcessAlive, processParentPid } from '@/server/lib/lifecycle/identity';
28
28
  import type { RealtimeServerFrame } from '@/shared/lib/realtime/protocol';
29
29
 
@@ -207,7 +207,7 @@ export async function holdLeaseInForeignProcess(sessionId: string): Promise<Fore
207
207
  const lease = sessionLeasePath(sessionId);
208
208
  writeFileSync(lease, '');
209
209
  const script = `
210
- const { holdLeaseForTest } = await import(${JSON.stringify(join(import.meta.dir, '..', 'server/lib/omp/session/lease-flock.server.ts'))});
210
+ const { holdLeaseForTest } = await import(${JSON.stringify(join(import.meta.dir, '..', 'server/lib/omp/session/lease-probe.server.ts'))});
211
211
  holdLeaseForTest(process.argv[1]);
212
212
  await Promise.withResolvers().promise;
213
213
  `;
@@ -1 +0,0 @@
1
- import{e,m,Dr}from"./index-f77c3ag0.js";import{gi,Hc}from"./index-8kqepehd.js";function g({source:t,name:r,revision:s=0}){let{url:i,loading:n,error:o}=Hc(t,s);if(o)return e(Dr,{name:r,message:o});if(n||!i)return e("div",{className:"flex flex-1 items-center justify-center gap-2 text-xs text-ink/40",children:[e(m,{size:14,className:"animate-spin"}),e("span",{children:"Loading image…"})]});return e(gi,{src:i,name:r,className:"flex-1 min-h-0"})}export{g as ImageView};
@@ -1,2 +0,0 @@
1
- import{d,n,o,K,i,u,a,Ve,le,gn,Xl,e,Kn,$s,tt,Te,Xt,Yg,$a,Fp,s,Qe,Ie,m,en,_,nt,tn,f,B,se,rt,re,ge,St,qe,ln,pe,Ge,ce,ka,Kr,cn,xa,W,D,O,Gs,b,dn,js,Pe,Tt,Co,me,Z,st,Yi,Ji,qu,tc,xe,je,Xi,wA,ac,Ct,Nt,Qt,ic,Js,Bo,Zs,Xs,Ju,_o,He,Ze,na,We,nl,rl,Cc,_a,Ec,Xu,is,Sa,To,Do,No,Bt,Xn,us,Qo,Ro,Fo,ol,Ka,il,sl,ll,cl,Br,Dm,Nm,Lo,Tc,Rm,Fm,Lm,Dc,er,Ir,Mo,Po,Mm,Pm,Nc,Va,Om,$m,zm,sh,ad,lh,ut,od,Um,Gm,jm,ul,fg,af,Rc,hl,df,pf,gd,mf,Eh}from"./index-f77c3ag0.js";import{Oc,$c,zc,Uc,Gc,jc,qc,yd,ms,$o,fs,gi,Wc,bl,Kc,Vc,Yc,Jc,Zc,Xc,eu,tu,nu}from"./index-8kqepehd.js";import{Mu,Pu,Yo,Ou,$u}from"./index-m94f4ngb.js";import{pt,Ai,au,ou,su}from"./index-rn8w29pv.js";import{hs,Da,Nr,lu,cu,zo,uu,bs,Sd,Eg,ys,vs,ks,Qr,xs,ws,Uo,Cs,Es,Bs,Is,bi,Go,_s,Ss,du,Td,pu,mu,fu,gu,Au,hu}from"./index-s7rfbydk.js";import{Na,Qa}from"./index-48pb18zj.js";function to(t){let{editorOpen:r,diffOpen:c,settingsOpen:p,offMainScreen:h,onCloseEditor:g,onCloseDiff:v,onCloseSettings:S,onReturnToMain:k}=t;o(()=>Eh(()=>{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 gt={name:"menu",size:24,node:[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]},no=s(gt);function ze(){let t=Xi(),[r,c]=n(null),p=a((v,S)=>{c({top:S,bottom:S,left:v,right:v})},[]),h=Mu({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 vt=10,io=600000;function ro({activeSessionTitle:t,activeSessionId:r,onOpenSessionSidebar:c,onOpenRightSidebar:p,onNewSession:h,onSelectSession:g}){let{folders:v}=We(),S=gd(),k=Sa(r),[l,x]=n(null),{hidden:N,setHidden:R}=Um(),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 F=Yg(String(T.id)),I=T.updated_at?Date.parse(T.updated_at):0,j=F!==void 0&&w-F<=io?F:I;if(F!==void 0&&w-F>io)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,vt)},[v]),P=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 ${ol} px-3 z-20 titlebar-drag-region select-none`,...Mo(),...y.surfaceProps,style:{height:"calc(3.5rem + env(safe-area-inset-top, 0px))",paddingLeft:Po(er("0.75rem",!0)),paddingRight:Ir("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(no,{size:20,strokeWidth:2})}),e("span",{className:"relative font-bold text-sm tracking-tight flex items-center flex-shrink-0",children:[e(_a,{glow:!0}),e("span",{className:"absolute -top-0.5 -right-1.5 flex",children:e(Dc,{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:Ct(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:P,"aria-haspopup":"menu","aria-expanded":l!==null,children:[e("span",{className:"truncate",children:P}),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(Nt,{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(W,{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(Gm,{layout:"mobile",sessionId:r==null?null:String(r),showRightPanel:!1,onToggleRightPanel:p,hidden:N}),y.anchor?e(Lo,{anchor:y.anchor,title:"Navbar",align:"right",items:od.filter((w)=>w.id!==ut.install&&w.id!==ut.editor&&w.id!==ut.mobile).map((w)=>({...w,removable:!0})),hidden:N,onToggle:R,onClose:y.close}):null]})}function so({activeSessionId:t,onSelectSession:r,onNewSession:c,onOpenSessionSidebar:p,onOpenRightSidebar:h,appSettings:g={}}){let{folders:v}=We(),[S,k]=n(null),l=u(()=>{if(!t)return"New session";for(let N of v){let R=N.sessions?.find((y)=>String(y.id)===String(t));if(R)return R.title}return null},[t,v]);return e("div",{className:"flex flex-col h-full w-full bg-canvas text-ink relative",children:[e(ro,{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(af,{appSettings:g,onSessionTitle:k,variant:"mobile"})})]})}function ao({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",...Mo(),...c,style:{height:"calc(3.5rem + env(safe-area-inset-top, 0px))",paddingLeft:Po(er("0.75rem",!0)),paddingRight:Ir("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(_a,{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(jm,{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 Me="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",Re="border-ink/15 bg-paper hover:bg-ink/5 text-ink/80 hover:text-ink",lo="bg-ink/10 text-ink border-ink/30";function co({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:R,onResetSort:y,onToggleArchived:E,onHideArchived:P,onSearchChange:w,onClearSearch:C,onSelectWorkspaces:A,selecting:T}){let{ref:F,width:I}=bs(0),j=Eg(I),G={};for(let J of Sd.slice(0,j))G[J]=!0;let U=Sd.slice(j),M=p?"Hide archived sessions":"Show archived sessions",ee=k>0?`Scheduled tasks (${k} armed)`:"Scheduled tasks",Y=[];if(U.includes("new-workspace"))Y.push({id:"new-workspace",label:"New Workspace",icon:ln,onSelect:v});if(U.includes("refresh"))Y.push({id:"refresh",label:"Refresh sessions",icon:D,onSelect:l});if(U.includes("scheduler"))Y.push({id:"scheduler",label:ee,icon:Da,onSelect:S});if(U.includes("archive"))Y.push({id:"archive",label:M,icon:nt,onSelect:E,active:p});if(U.includes("select"))Y.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:F,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(W,{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:`${Me} ${Re}`,title:"New Workspace","aria-label":"New Workspace",children:e(ln,{size:16,strokeWidth:1.8})}),G.scheduler&&e("button",{type:"button",onClick:S,className:`relative ${Me} ${Re}`,title:ee,"aria-label":k>0?`Scheduled tasks, ${k} armed`:"Scheduled tasks",children:[e(Da,{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:`${Me} ${p?"bg-warning/15 border-warning/40 text-warning":Re}`,title:M,"aria-label":M,children:e(nt,{size:16,strokeWidth:1.8})}),G.select&&e("button",{type:"button",onClick:A,"aria-pressed":T,className:`${Me} ${T?lo:Re}`,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:`${Me} ${Re}`,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:`${Me} ${c||r!=="A-Z"?lo:Re}`,title:"Sort workspaces","aria-label":"Sort workspaces",children:e(hs,{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(zo,{variant:"mobile",sortOption:r,onSortChange:R})})]}),U.length>0&&e(uu,{actions:Y,sortHidden:U.includes("sort"),sortOption:r,onSortChange:R,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:(J)=>w(J.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(nt,{size:10}),e("span",{children:"Archived"}),e("button",{type:"button",onClick:P,className:"hover:text-warning-hover ml-0.5",title:"Hide archived",children:e(b,{size:10})})]})]})]})}var xt="p-1.5 rounded-lg hover:bg-ink/10 active:bg-ink/15 text-ink/60 hover:text-ink";function po({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),R=i(null),[y,E]=n(null),P=(w)=>()=>{N(!1),w()};return e("div",{className:"relative flex items-center",onClick:(w)=>w.stopPropagation(),children:[e("button",{ref:R,type:"button",onClick:(w)=>{if(w.stopPropagation(),R.current)E(Ct(R.current));N((C)=>!C)},className:xt,title:"Workspace options","aria-label":`Options for ${t.name}`,"aria-haspopup":"menu","aria-expanded":x,children:e(Ie,{size:15})}),e(Nt,{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(Bs,{variant:"mobile",isPinned:t.isPinned,onOpenFolder:c?P(c):void 0,onNewWorktree:r&&p?P(p):void 0,onSelectSessions:h?P(h):void 0,confirmDelete:g,onPin:P(v),onDelete:P(S),onRequestDelete:k,onCancelDelete:l})})]})}var mo={inset:"",insetPx:0,slotWidth:16,markGap:8,padding:"py-2",glyph:Ze.touch};function uo({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:R,onSelect:y,onArchive:E,onDelete:P,onRename:w,onRenameWithAi:C,waitingFor:A,onCancelWait:T,selectable:F=!1,selected:I=!1,onToggleSelect:j}){let{isEditing:G,draft:U,setDraft:M,inputRef:ee,startRename:Y,handleKeyDown:J,handleBlur:ue}=No(t.title,w),de=Sa(t.id),oe=Qo(),te=oe.anchor!==null,q=Boolean(w||E||P||T),Q=Boolean(A),ae=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:U,onChange:(X)=>M(X.currentTarget.value),onKeyDown:J,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&&!F?oe.openAtCursor:void 0,className:`w-full rounded-lg flex items-center transition-colors ${F&&I||te?Es:c?"bg-ink/10 font-medium text-ink":"hover:bg-ink/5 text-ink/85"}`,children:[e("button",{type:"button",onClick:F?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:[F?e(Qr,{checked:I,label:`Select ${t.title}`,onChange:()=>j?.()}):e("span",{className:"w-4 flex-shrink-0 flex items-center justify-center",children:de?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"}):Q?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(pe,{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(He,{harness:r,size:Ze.touch})}),e("span",{className:"min-w-0 truncate text-xs",children:ne})]}),Q&&e("span",{className:"text-[10px] text-ink/40 truncate",children:["waiting for ",A?.title??"another session"]}),t.worktree?e(xs,{worktree:t.worktree}):null]})]}),e(Cs,{timeAgo:g,timeTitle:v,runStartedAt:S,className:"text-[11px] font-mono flex-shrink-0 ml-2",restingClassName:"text-ink/45"})]}),q&&!F&&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(Ie,{size:16})}),ae&&!F&&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(se,{size:14})})]}),oe.anchor&&e(Ro,{anchor:oe.anchor,sessionId:t.id,...r?{harness:r}:{},...R!==void 0?{folderId:R}:{},isArchived:t.is_archived===1,onRename:w?Y:void 0,onRenameWithAi:C,onArchive:E,onDelete:P,onCancelWait:T,onClose:oe.close})]})}function fo(t,r){let[c,p]=n(!1);return{open:()=>p(!0),dialog:c?e(Fo,{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 ho({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(rt,{size:12}),e("span",{className:"truncate",children:"Show less"})]})]})}function bo(t){return t?"mb-4":"mb-1"}function go({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:R}){let{visibleCount:y,showMore:E,showLess:P,canShowLess:w}=vs(),C=fo(t,(H)=>h?.(t.id,H)),{refresh:A,runStartedAtMap:T}=We(),{expandedSessionIds:F,toggleSession:I}=us(),[j]=le(),G=j.get("subagent"),U=j.get("sessionId"),{confirmDelete:M,requestDelete:ee,cancelDelete:Y,handlePin:J,handleDelete:ue,handleArchive:de,handleRename:oe,handleRenameWithAi:te,handleOpenFolder:q}=ks(t,A,l),Q=To(),ae=J,ne=ue,X=q??void 0,ve=(t.sessions||[]).filter((H)=>S?H.is_archived===1:H.is_archived!==1),we=na(t.icon),{folderCheckbox:ke,sessionCheckboxes:he,folderSummary:z,toggleFolderSelection:L,rendered:V,hiddenCount:fe}=_s({batch:x,folder:t,sessions:ve,showArchived:S,visibleCount:y,activeSessionId:r,sessionStatus:k}),Ee=Go(V),Ce=g||he,Le=(H,ye)=>{let ie=String(H.id),Se=String(r)===ie,Be=Se&&U===ie&&Boolean(G),Ne=Bt(ie);return e(uo,{session:H,harness:H.harness,folderId:H.folder_id,isActive:Se&&!Be,status:k[ie],awaitingInput:Boolean(H.awaitingInput),timeAgo:ws(H.updated_at??H.created_at),timeTitle:Uo(H.updated_at??H.created_at),runStartedAt:k[ie]==="stream"?T[ie]:void 0,expandable:ye.expandable,isChild:ye.isChild,isExpanded:ye.isExpanded,onToggleExpand:ye.onToggleExpand,onSelect:()=>c(H.id),onArchive:()=>de(H),onDelete:Ne?void 0:()=>Q.requestDelete(H),onRename:Ne?void 0:($e)=>void oe(H,$e),onRenameWithAi:Ne?void 0:()=>void te(H),waitingFor:H.waitingFor?{title:H.waitingFor.title}:void 0,onCancelWait:H.waitingFor?()=>R?.(H.waitingFor.waitId):void 0,selectable:he,selected:Boolean(x?.selected.includes(ie)),onToggleSelect:x?()=>x.toggle(ie):void 0})},Oe=(H)=>Is(H,Ee.childrenOf,F,I);return e("div",{className:bo(Ce),"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:[ke&&z?e(Qr,{size:"md",checked:z.all,indeterminate:z.some,label:`Select ${t.name}`,onChange:L}):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(cn,{size:15,className:"text-ink/80"}):e(we,{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(pe,{size:13,className:"text-ink/50 ml-1"}),!x&&e(d,{children:[e("button",{type:"button",onClick:(H)=>{H.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(W,{size:15})}),e(po,{folder:t,canWorktree:Boolean(h&&t.project_path),onOpenFolder:X,onNewWorktree:h?()=>C.open():void 0,onSelectSessions:N?()=>N(t.id):void 0,confirmDelete:M,onPin:ae,onDelete:ne,onRequestDelete:ee,onCancelDelete:Y}),e("span",{className:"flex items-center justify-center pr-1",children:g?e(B,{size:14}):e(se,{size:14})})]})]})]}),Ce&&e("div",{className:"mt-0.5 space-y-0.5",children:[Ee.roots.map((H)=>{let ye=String(H.id),ie=Oe(H);return e("div",{className:"space-y-0.5",children:[Le(H,ie),ie.isExpanded&&e(bi,{parentId:ye,hasSubagents:Boolean(H.hasSubagents),childrenOf:Ee.childrenOf,expandedIds:F,onToggle:I,activeSessionId:r===null?null:String(r),renderSession:Le,style:mo})]},H.id)}),e(ho,{hiddenCount:he?0:fe,canShowLess:!he&&w,onShowMore:E,onShowLess:P})]}),e(Do,{session:Q.pending,isDeleting:Q.isDeleting,error:Q.error,onClose:Q.cancelDelete,onConfirm:()=>void Q.confirmDelete()}),C.dialog]})}function vo({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:R}){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(go,{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:R},y.id))})}var kt=[3,2];function xo(){return e("div",{className:"flex-1 p-3 space-y-4","aria-hidden":"true",children:kt.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 So({folders:t,initializing:r,failed:c,activeSessionId:p,expandedFolders:h,sessionStatus:g,searchQuery:v,sortOption:S,optionsOpen:k,showArchived:l,harnessFilter:x,onHarnessFilterChange:N,harnessOptions:R,optionsRef:y,scheduledCount:E,refreshing:P,selecting:w,batch:C,onNewSession:A,onNewWorkspace:T,onScheduler:F,onRefresh:I,onToggleOptions:j,onSortChange:G,onResetSort:U,onToggleArchived:M,onHideArchived:ee,onSearchChange:Y,onClearSearch:J,onSelectWorkspaces:ue,onSelectSession:de,onNewSessionForFolder:oe,onNewWorktreeSession:te,onToggleFolder:q,onToast:Q,onStartSessionSelection:ae,onCancelWait:ne}){return e(d,{children:[e(co,{searchQuery:v,sortOption:S,optionsOpen:k,showArchived:l,optionsRef:y,onNewSession:A,onNewWorkspace:T,onScheduler:F,scheduledCount:E,onRefresh:I,refreshing:P,onToggleOptions:j,onSortChange:G,onResetSort:U,onToggleArchived:M,onHideArchived:ee,onSearchChange:Y,onClearSearch:J,onSelectWorkspaces:ue,selecting:w}),e("div",{className:"px-3 pt-2 pb-1",children:e(ys,{options:R,value:x,onChange:N,touch:!0})}),c?e(Ss,{touch:!0,onRetry:I,refreshing:P}):r?e(xo,{}):e(vo,{folders:t,activeSessionId:p,expandedFolders:h,showArchived:l,sessionStatus:g,onSelectSession:de,onNewSessionForFolder:oe,onNewWorktreeSession:te,onToggleFolder:q,onToast:Q,batch:C,onStartSessionSelection:ae,onCancelWait:ne})]})}function ko({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(Gs,{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(ka,{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(ce,{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(xa,{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",Cc.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 wo(t){let r=Mm(),c=Fm();return xe(Ec,()=>{t.onClose(),t.openAbout(),r.apply("kabmo").then((p)=>{if(!p)return;t.pushToast(p.message,tc(p))})}),Pm(r,t.pushToast),{updates:r,shellDownload:c}}function yo(t,r,c){return t.filter((p)=>p.id!==r&&!(c&&p.side==="left"))}function Eo(t){return t}function Oo(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 wt=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")}`,R=S.current;if(R.signature===N&&R.width===l.clientWidth)return;S.current={signature:N,width:l.clientWidth};let y=l.getBoundingClientRect(),E=x.getBoundingClientRect(),P=Oo({scrollLeft:l.scrollLeft,clientWidth:l.clientWidth,scrollWidth:l.scrollWidth,start:E.left-y.left+l.scrollLeft,size:E.width},wt);if(P!==l.scrollLeft)l.scrollLeft=P},[]);return K(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(nl,{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:gn}),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 Ao({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 Io({panelKey:t,panel:r,body:c}){if(!r)return e("div",{className:"flex-1 min-h-0",children:e(Tc,{panelKey:t})});return e("div",{className:"flex-1 min-h-0 overflow-hidden relative",children:e(Ve,{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(Co,{value:c,children:r.render(c)})})})}function Wo({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:R}){return e(d,{children:[e(is,{isOpen:r,onClose:c,onCreate:ll,onClone:cl}),e(cu,{isOpen:p,onClose:h,activeSessionId:t===null?null:String(t),onToast:k}),e(Xu,{isOpen:g,onClose:v,updates:S,onToast:k}),e(Rm,{updates:S}),e(hu,{mode:x??"session",count:l.pending.length,scopeLabel:R,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 Ho(){let t=Tt(),r=Br("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 Vo(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 Ko({appSettings:t,onSelectSession:r,onClose:c,rootPath:p,refreshKey:h,onRefresh:g,onOpenFile:v}){let S=pu(t,{onSelectSession:r,onAfterSelect:c}),{folders:k,processedFolders:l,refreshNow:x,showArchived:N,activeSessionId:R}=S,y=gu(l,N,x),[E,P]=n({1:!0,2:!0,3:!0}),w=i(null);me(w,()=>S.setOptionsOpen(!1));let C=(I)=>{P((U)=>({...U,[I]:!U[I]}));let j=k.find((U)=>U.id===I),G=!(E[I]??j?.isExpanded??!0);Td(I,G)},A=l.map((I)=>`${I.id}:${I.isExpanded}`).join("|");o(()=>{P(Object.fromEntries(l.map((I)=>[I.id,I.isExpanded])))},[A]);let T=Ho(),F=Vo({sessionId:R,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:F}}function Ke(t){let{disabledPanels:r}=dn(),{setEnabled:c}=js(),p=ze(),h=Nm(t),g=a((v,S)=>{c(v,S)},[c]);return{...p,items:h,hidden:r,toggle:g}}function jo({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:R,batch:y,expandedFolders:E,toggleFolder:P,optionsRef:w,dock:C,dockBody:A}=Ko({appSettings:S,onSelectSession:r,onClose:g,rootPath:k,refreshKey:l,onRefresh:x,onOpenFile:N}),{initializing:T,failed:F,refreshNow:I,isRefreshing:j,searchQuery:G,setSearchQuery:U,showArchived:M,setShowArchived:ee,optionsOpen:Y,setOptionsOpen:J,sortOption:ue,handleSortChange:de,harnessFilter:oe,setHarnessFilter:te,harnessOptions:q,processedFolders:Q,sessionStatus:ae,handleSelectSession:ne}=R,{selection:X,deleteRun:ve,archiveRun:we,binding:ke,scopeFolder:he,available:z,selected:L}=y,V=Ju(),fe=Ke("left"),[Ee,Ce]=n(!1),[Le,Oe]=n(!1),H=lu(),[ye,ie]=n(!1),{pushToast:Se}=je(),Be=sl(Se);mu({onNotice:Se});let{updates:Ne,shellDownload:$e}=wo({onClose:g,openAbout:()=>ie(!0),pushToast:Se}),Ye=()=>{c(),g()},ht=()=>{we.archive(L).then((be)=>{if(!be)return;let De=fu(be);if(De)Se(De.message,De.tone);if(!be.error)X.end()})},Je=(be)=>{p(be),g()},eo=()=>{ee(!M)},oo=h?(be,De)=>{h(be,De),g()}:void 0,bt={className:"flex-1 min-h-0 w-full",folders:Q,initializing:T,failed:F,activeSessionId:t,sessionStatus:ae,searchQuery:G,onSearchChange:U,showArchived:M,onToggleArchived:eo,sortOption:ue,optionsOpen:Y,onToggleOptions:()=>J(!Y),onCloseOptions:()=>J(!1),onSortChange:de,harnessFilter:oe,onHarnessFilterChange:te,harnessOptions:q,onRefresh:I,refreshing:j,scheduledCount:H,onNewSession:Ye,onNewWorkspace:()=>Ce(!0),onScheduler:()=>Oe(!0),onSelectSession:ne,onNewSessionForFolder:Je,onNewWorktreeSession:oo,onToast:Se,onCancelWait:Be,batch:ke,onSelectWorkspaces:y.toggleWorkspaceSelection,onStartSessionSelection:(be)=>X.begin("session",be)};return e("div",{className:"flex flex-col h-full w-full bg-canvas text-ink relative select-none",children:[e(ao,{onClose:g,viewLabel:C.showingSessions?"Sessions":C.activePanel?.label??"Panel",menuProps:fe.surfaceProps}),Eo(C.enabled)?e(Ao,{panels:C.catalog,activeId:C.activeView,onSelect:C.setActiveView,menuProps:fe.surfaceProps}):null,fe.anchor?e(Lo,{anchor:fe.anchor,items:fe.items,hidden:fe.hidden,onToggle:fe.toggle,onClose:fe.close}):null,e("div",{className:C.showingSessions?"contents":"hidden",children:[V==="modern"?e(du,{...bt,touch:!0}):e(So,{folders:Q,initializing:T,failed:F,activeSessionId:t,expandedFolders:E,sessionStatus:ae,searchQuery:G,sortOption:ue,optionsOpen:Y,showArchived:M,harnessFilter:oe,onHarnessFilterChange:te,harnessOptions:q,optionsRef:w,scheduledCount:H,refreshing:j,selecting:X.mode!==null,batch:ke,onNewSession:Ye,onNewWorkspace:()=>Ce(!0),onScheduler:()=>Oe(!0),onRefresh:I,onToggleOptions:()=>J(!Y),onSortChange:de,onResetSort:()=>de("A-Z"),onToggleArchived:eo,onHideArchived:()=>ee(!1),onSearchChange:U,onClearSearch:()=>U(""),onSelectWorkspaces:y.toggleWorkspaceSelection,onSelectSession:ne,onNewSessionForFolder:Je,onNewWorktreeSession:oo,onToggleFolder:P,onToast:Se,onStartSessionSelection:(be)=>X.begin("session",be),onCancelWait:Be}),X.mode&&e(Au,{drawer:!0,mode:X.mode,count:L.length,total:z.length,busy:ve.isDeleting,archiving:we.isArchiving,scopeLabel:he?.name,onSelectAll:()=>X.selectAllOf(z),onUnselectAll:()=>X.unselectAllOf(z),onDelete:()=>ve.request(L),onArchive:ht,onCancel:X.end})]}),C.showingSessions?null:e(Io,{panelKey:C.activeView,panel:C.activePanel,body:A}),e(ko,{onSettings:()=>window.dispatchEvent(new CustomEvent("omp:open-settings",{detail:{}})),onKeyBindings:Nc,onAbout:()=>ie(!0),shellDownload:$e,onDesktopToggle:v,updateAvailable:Ne.hasUpdate,onUpdateClick:()=>{ie(!0),Ne.check()}}),e(Wo,{activeSessionId:t,newWorkspaceOpen:Ee,onCloseNewWorkspace:()=>Ce(!1),schedulerOpen:Le,onCloseScheduler:()=>Oe(!1),aboutOpen:ye,onCloseAbout:()=>ie(!1),updates:Ne,pushToast:Se,batchDelete:ve,batchMode:X.mode,onEndBatch:X.end,scopeLabel:he?.name})]})}var yt="terminal";function Ue(t){return t===yt}function Fe(t){if(Ue(t))wA()}function qo({enabled:t=!0,rootPath:r,refreshKey:c=0,onRefresh:p,onOpenFile:h,onClose:g}){let[v,S]=$a("layout.mobileRightPanel",Xl),k=Tt(),l=yo(Br("all"),Pe,k.enabled),x=l.find((A)=>A.id===v)??l[0],N=Fp(r,t),{changes:R}=$s(r,N,t),y=R.length>0,E=a((A)=>{if(A!==x?.id)Fe(A);S(A)},[x?.id,S]);o(()=>{if(!Ue(x?.id))ac()},[x?.id]);let P=Ke(k.enabled?"right":"all"),w=k.enabled?P.items:P.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",...Mo(),...P.surfaceProps,style:{height:"calc(3.5rem + env(safe-area-inset-top, 0px))",paddingTop:"env(safe-area-inset-top, 0px)",paddingLeft:Po(er("0.75rem",!0)),paddingRight:Ir("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})})]}),P.anchor?e(Lo,{anchor:P.anchor,align:"right",items:w,hidden:P.hidden,onToggle:P.toggle,onClose:P.close}):null,e("div",{className:"flex-1 min-h-0 overflow-hidden relative",style:{paddingBottom:"env(safe-area-inset-bottom, 0px)"},children:x?e(Ve,{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(Co,{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 Zo({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:R,onToggleFind:y,findOpen:E,onToggleWrap:P,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:Ir("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(st,{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(pt,{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(cn,{size:15})}),r&&e("button",{type:"button",onClick:R,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(St,{size:15}):e(qe,{size:15})}),!k&&e(d,{children:[e("button",{type:"button",onClick:P,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(Qa,{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(Na,{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(ge,{size:15})})]})]})}function Xo({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:R}){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(Oc,{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(zc,{content:r,file:{name:t,path:c,root:p,repo:h},active:N,onExit:R})})})}function Jo({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:R,setCodeScroller:y,previewRef:E,scroll:P,fontSize:w,reviewActive:C,onExitReview:A,editorTheme:T,editorFontFamily:F,indentUnitText:I,typing:j}){let G=a(async(U)=>{let M=await Vc(t,U,{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||Wc(c)&&(p||h))return e(bl,{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(Xo,{fileName:t.name,content:v,path:t.path??t.name,root:t.root,repo:t.repo,fontSize:w,scrollRef:E,onScroll:P.onScroll,isLoading:r.isLoading,unsupported:r.unsupported,loadError:r.loadError,reviewActive:C,onExitReview:A});return e(Gc,{ref:R,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:I,typing:j,padding:12,placeholder:"This file is empty",style:{fontFamily:F,fontSize:`${w}px`,lineHeight:Js}})}function et(){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 ot({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:$o[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 it({path:t,content:r,ready:c,surfaceRef:p}){let h=Zc(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 at({path:t,content:r,documentKey:c,ready:p,surfaceRef:h,toggleWordWrap:g}){let v=it({path:t,content:r,ready:p,surfaceRef:h}),S=Jc({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 lt({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=qu(r,x);if(N)Ji({path:t,...N});return}Yi({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(Z,{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?`${Yo(l.kind)} ${l.name}`:`${Yo(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(Pu,{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:Ou(c)})]})})]})}function ct({file:t,missing:r=!1,onClose:c,onFileSaved:p,onDropResult:h}){let g=fs(t.path??t.name),[v,S]=n({}),[k,l]=n(Bo),[x,N]=n(!0),R=_o(),y=Ai(),E=ou(),P=su(),w=g==="markdown",C=yd[g]===!0,A=ms[g]===!0,T=t.path??t.name,F=v[T]??A,I=nu(String(T)),j=w&&F,G=()=>S((V)=>({...V,[T]:!F})),U=Rc({enabled:Boolean(t.root),onResult:h}),M=Yc(t,{flushOnUnmount:!0,reportSaveError:!0,downloadMimeType:"text/plain;charset=utf-8",onFileSaved:p,missing:r}),[ee,Y]=n(null),J=ul({tabKey:T,surface:w&&F?"rendered":"code",ready:M.loaded,slot:sh,element:w&&F?void 0:ee}),[ue,de]=n(null),oe=a((V)=>{J.ref(V),de(V)},[J.ref]);qc({path:t.path??null,scroller:ue,preview:w&&F});let te=i(null),{find:q,revealMarks:Q,currentMark:ae}=at({path:t.path??null,content:M.content,documentKey:`${T}\x00${M.language}`,ready:M.loaded&&!M.loadError,surfaceRef:te,toggleWordWrap:()=>N((V)=>!V)}),{content:ne,language:X}=M,ve=ne.split(`
2
- `).length,we=Uc(ne);Xc({file:{id:T,name:t.name,path:t.path??T},editor:M,surfaceRef:te,isPreview:F,exitPreview:()=>S((V)=>({...V,[T]:!1})),publish:!1});let{symbols:ke,total:he,truncated:z,notice:L}=$u({content:ne,language:X,path:t.path??null,state:C?"not-a-document":M.loadError?"error":M.loaded?"ready":"loading",note:C?`${$o[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",...U.dropProps,...U.captureDropProps,children:[e(hl,{visible:U.isDragging}),e(Zo,{fileName:t.name,hasPreview:A,isPreview:F,wordWrap:x,copied:M.copied,byteViewer:C,missing:r,onSave:M.saveNow,onClose:c,onTogglePreview:G,hasReview:j,isReviewing:j&&I.active,onToggleReview:I.toggle,onToggleFind:()=>q.open?q.close():q.openFind(),findOpen:q.open,onToggleWrap:()=>N(!x),onZoomOut:()=>l((V)=>Math.max(Zs,V-1)),onZoomIn:()=>l((V)=>Math.min(Xs,V+1)),onCopy:M.copy,onDownload:M.download}),r&&e(et,{}),M.diskChange&&e(eu,{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(jc,{find:q})}),e(Jo,{file:t,editor:M,viewerKind:g,byteViewer:C,isPreview:F,isMd:w,content:ne,language:X,wordWrap:x,fileKey:T,revealMarks:Q,currentMark:ae,surfaceRef:te,setCodeScroller:Y,previewRef:oe,scroll:J,fontSize:k,reviewActive:j&&I.active,onExitReview:I.toggle,editorTheme:y,editorFontFamily:R,indentUnitText:au(E),typing:P}),!C&&e(lt,{path:t.path??null,symbols:ke,total:he,truncated:z,emptyNotice:L,preview:w&&F}),e(ot,{isImage:M.isImage,byteViewer:C,viewerKind:g,lineCount:ve,charCount:ne.length,language:X,saveStatus:M.saveStatus,path:t.path,conflicts:we}),M.saveMissingConfirm&&t.path&&e(tu,{fileName:t.name,filePath:t.path,onClose:M.cancelSaveMissing,onConfirm:M.confirmSaveMissing})]})}function dt({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:Ir("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(st,{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($c,{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?zm(t.journal.path,t.journal.from,t.journal.to):$m(t.path,h)})})]})}function Ae(t,r){let c=t[r];return typeof c==="string"&&c.length>0?c:void 0}function Mt(t){let r=t.content;return typeof r==="string"?r:void 0}function Xe(t,r){let c=typeof t==="object"&&t!==null?t:{},p=(Ae(c,"path")??"").replace(/^\/+/,"");if(!p)return null;return{name:Ae(c,"name")??p.split("/").pop()??"file",path:p,content:Mt(c),root:Ae(c,"root")??r??void 0,repo:Ae(c,"repo"),handleId:Ae(c,"handleId"),deviceFile:c.deviceFile===!0?!0:void 0}}function mt(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 ft(t,r,c){Ka(c);let p=Xn(r);return Xt(p,fg,{folderId:r,worktreePath:c}),t.setSearchParams((h)=>{let g=Qt(h);return g.set("sessionId",p),g.set("folderId",r.toString()),g},{replace:!0}),t.afterNavigate?.(),p}function sd({onDesktopToggle:t,appSettings:r={}}){let{folders:c,isMock:p}=We(),h=Tt(),{sessionId:g}=tt(),[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,[R,y]=n("main"),[E,P]=n(null),[w,C]=n(null),[A,T]=n(0),[F,I]=n(!1),[j,G]=n("appearance"),[U,M]=n(!1),ee=a(()=>T((z)=>z+1),[]),Y=Kc(mt(E),A),{pushToast:J}=je(),ue=a((z)=>J(z.message,z.ok?"success":"error"),[J]),de=Y.size>0;to({editorOpen:E!==null,diffOpen:w!==null,settingsOpen:F,offMainScreen:R!=="main",onCloseEditor:()=>P(null),onCloseDiff:()=>C(null),onCloseSettings:()=>{I(!1),M(!1)},onReturnToMain:()=>y("main")});let{folder:oe}=Va(c,l),te=oe??(N?c.find((z)=>String(z.id)===String(N))??null:null),q=Om(c,l)??te?.project_path??null,Q=!!te,ae=Rc({enabled:Q,onResult:ue});xe("omp:open-file",(z)=>{let V=Xe(z.detail,q);if(V)P(V)}),xe("omp:open-diff",(z)=>{let L=z.detail;if(!L?.file)return;C({path:L.file.replace(/^\/+/,""),status:L.status,staged:L.staged,repo:L.repo,root:L.root??q??void 0,...L.source==="journal"&&L.journal?{journal:L.journal}:{}})}),xe("omp:view-subagent",()=>y("main")),xe(ad,(z)=>{let L=z.detail?.panelKey;if(!L)return;let V=lh(L,h);if(!V)return;let fe=Te(g,"layout.mobileRightPanel");if(V==="right"&&(R!=="right"||fe!==L))Fe(L);Xt(g,V==="left"?"layout.mobileLeftPanel":"layout.mobileRightPanel",L),y(V==="left"?"session":"right")}),xe("omp:open-settings",(z)=>{let L=z.detail;G(L?.category??"appearance"),M(Boolean(L?.autoOpenAdd)),I(!0)});let ne=(z)=>{S((L)=>{let V=Qt(L);if(V.set("sessionId",z.toString()),V.has("subagent"))V.delete("subagent");return V},{replace:!0}),y("main")},X=()=>{S(new URLSearchParams,{replace:!0}),y("main")},ve=(z)=>{let L=il(c,k,z);if(L)Ka(L);S((V)=>ic(V,Xn(z),z),{replace:!0}),y("main")},we=(z,L)=>ft({setSearchParams:S,afterNavigate:()=>y("main")},z,L),ke=a((z)=>{let L=Xe(z,q);if(L)P(L)},[q]),he=a(()=>{let z=Te(g,"layout.mobileRightPanel")??Xl;Fe(z),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(df,{}),e(pf,{isMock:p}),e(mf,{workspacePath:q}),e("div",{className:`flex-1 min-h-0 w-full relative ${R==="main"?"block":"hidden"}`,...ae.dropProps,...ae.captureDropProps,children:[e(hl,{visible:ae.isDragging}),e(so,{activeSessionId:l,onSelectSession:ne,onNewSession:X,onOpenSessionSidebar:()=>y("session"),onOpenRightSidebar:he,appSettings:r})]}),e("div",{className:`flex-1 min-h-0 w-full ${R==="session"?"block":"hidden"}`,children:e(jo,{activeSessionId:l,onSelectSession:ne,onNewSession:X,onNewSessionForFolder:ve,onNewWorktreeSession:we,onClose:()=>y("main"),onDesktopToggle:t,appSettings:r,rootPath:q??void 0,refreshKey:A,onRefresh:ee,onOpenFile:ke})}),R==="right"&&e("div",{className:"flex-1 min-h-0 w-full",children:e(qo,{enabled:Q,rootPath:q??void 0,refreshKey:A,onRefresh:ee,onOpenFile:ke,onClose:()=>y("main")})}),E&&e(ct,{file:E,missing:de,onClose:()=>P(null),onFileSaved:ee}),w&&e(dt,{diff:w,onClose:()=>C(null),onFileSaved:ee}),e(rl,{isOpen:F,onClose:()=>{I(!1),M(!1)},initialCategory:j,autoOpenAddProvider:U,appSettings:r})]})}export{sd as MobileLayoutWrapper};