@kabmo-labs/kabmo 0.42.2 → 0.43.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.
- package/README.md +1 -1
- package/dist/client/index.html +1 -1
- package/dist/client/index.js +619 -582
- package/dist/client/static/js/{CsvGrid-g6rek8y9.js → CsvGrid-3fr85032.js} +2 -2
- package/dist/client/static/js/{DocxView-41t9ryws.js → DocxView-pqbp2fpd.js} +4 -4
- package/dist/client/static/js/{DrawioView-mfxhfz1h.js → DrawioView-m0vecq1m.js} +2 -2
- package/dist/client/static/js/ImageView-rbejbjwg.js +1 -0
- package/dist/client/static/js/LayoutWrapper-mxfsqh57.js +2 -0
- package/dist/client/static/js/Modal-vnwg4xn3.js +59 -0
- package/dist/client/static/js/{PdfView-bek8k888.js → PdfView-wmg0vk2p.js} +1 -1
- package/dist/client/static/js/SessionsView-90z2t4qe.js +1 -0
- package/dist/client/static/js/{SheetView-vezssf6b.js → SheetView-rg5gkcd7.js} +13 -13
- package/dist/client/static/js/{SvgPreview-f1qaw73k.js → SvgPreview-wpb7b0ez.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-4qn94h52.js → abnfDiagram-O67JEVCF-4pxqt66j.js} +1 -1
- package/dist/client/static/js/architecture-7GRP2DOG-7j23x20s.js +1 -0
- package/dist/client/static/js/{architectureDiagram-NJMV4G6O-tbewzdya.js → architectureDiagram-NJMV4G6O-kwt1va5y.js} +11 -11
- package/dist/client/static/js/{astro-nn7xg0we.js → astro-dpfdhc5e.js} +1 -1
- package/dist/client/static/js/bash-vv2ysp0a.js +1 -0
- package/dist/client/static/js/{blockDiagram-BEXU5L5S-njgnwckz.js → blockDiagram-BEXU5L5S-hbj5v7n7.js} +7 -7
- package/dist/client/static/js/c-8jf64j6h.js +1 -0
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-f58pcvbk.js → c4Diagram-YGBWAQC7-epfzh8dw.js} +6 -6
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-52g73vyw.js → classDiagram-v2-NBCMYWYE-kbks4qgz.js} +6 -6
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-ptdnshzh.js → cose-bilkent-JH36ORCC-dvdmckrf.js} +1 -1
- package/dist/client/static/js/cpp-vh94zee0.js +1 -0
- package/dist/client/static/js/css-p57h1fme.js +1 -0
- package/dist/client/static/js/cynefin-OW5HDTMX-me5xnx6a.js +1 -0
- package/dist/client/static/js/{cynefinDiagram-VND7K2PF-qabfdkzr.js → cynefinDiagram-VND7K2PF-r084stj5.js} +2 -2
- package/dist/client/static/js/{dagre-6A5THRUB-kyf5jetf.js → dagre-6A5THRUB-64qc51n1.js} +2 -2
- package/dist/client/static/js/{diagram-22UHCM2B-bxrsjtv9.js → diagram-22UHCM2B-70qtb1rm.js} +16 -16
- package/dist/client/static/js/{diagram-3UASUU5V-0f41s00j.js → diagram-3UASUU5V-dgkvnsme.js} +1 -1
- package/dist/client/static/js/{diagram-ATOU4E4O-0z1zx9h1.js → diagram-ATOU4E4O-rnpsp26v.js} +3 -3
- package/dist/client/static/js/{diagram-CDSNMT55-znrmr6bk.js → diagram-CDSNMT55-26hthh60.js} +5 -5
- package/dist/client/static/js/{diagram-MLGK6HIB-jfe2jhk0.js → diagram-MLGK6HIB-nc1s85r5.js} +2 -2
- package/dist/client/static/js/{diagram-MPIPVDR6-2kaawmwa.js → diagram-MPIPVDR6-e4dckqhv.js} +3 -3
- package/dist/client/static/js/{dockerfile-12exatm9.js → dockerfile-rxtyyhr1.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-s5n37rfp.js → ebnfDiagram-ZINNZB2B-3w9h8qk7.js} +1 -1
- package/dist/client/static/js/{elixir-szk51ehr.js → elixir-5ewfhvfh.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-433rd9fp.js → elk-276RUBZZ-httpkyb1.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-key6ah0b.js → erDiagram-OPXOYQCR-3qhvf7se.js} +8 -8
- package/dist/client/static/js/{erlang-zwy7cqdk.js → erlang-jqqa3ehb.js} +1 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-5zbvjj84.js +1 -0
- package/dist/client/static/js/flowDiagram-KWPJA3E3-1jat076e.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-4efkhmca.js → ganttDiagram-FUAMR5RP-t53m50e5.js} +6 -6
- package/dist/client/static/js/gitGraph-4MIJSDKK-tjhkv71w.js +1 -0
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-ac376y2k.js → gitGraphDiagram-X574FWY7-b5wn9eht.js} +14 -14
- package/dist/client/static/js/graphql-kesh8gk0.js +1 -0
- package/dist/client/static/js/html-sxpfydga.js +1 -0
- package/dist/client/static/js/{index-e1yz59fa.js → index-0c6vpk89.js} +2 -2
- package/dist/client/static/js/{index-p0ez6hqd.js → index-181p91hf.js} +1 -1
- package/dist/client/static/js/{index-s4gv0rpk.js → index-1dwdgp27.js} +1 -1
- package/dist/client/static/js/{index-0e9nkc0g.js → index-2q23dwrs.js} +2 -2
- package/dist/client/static/js/{index-4cncqz8j.js → index-38v0781h.js} +2 -2
- package/dist/client/static/js/{index-zs7sjv6x.js → index-4banz7gr.js} +1 -1
- package/dist/client/static/js/{index-nh29fkk9.js → index-7dp90ad1.js} +2 -2
- package/dist/client/static/js/{index-yjmm73jm.js → index-7z9tz4ze.js} +2 -2
- package/dist/client/static/js/{index-zs73zwjz.js → index-7zc1z9z9.js} +4 -4
- package/dist/client/static/js/{index-z78bzryw.js → index-8y51kgan.js} +3 -3
- package/dist/client/static/js/{index-gp57dx2v.js → index-axszsg7a.js} +1 -1
- package/dist/client/static/js/{index-pxtff3ez.js → index-bvjct7sp.js} +2 -2
- package/dist/client/static/js/{index-8b3t2y77.js → index-cqnpsw2m.js} +2 -2
- package/dist/client/static/js/{index-yzda8j2d.js → index-d8r84zjd.js} +12 -12
- package/dist/client/static/js/{index-02543wk3.js → index-dg3b0mfk.js} +2 -2
- package/dist/client/static/js/index-dkqgmacr.js +4 -0
- package/dist/client/static/js/{index-pkes9492.js → index-e7yf273s.js} +2 -2
- package/dist/client/static/js/{index-8k7vjp8b.js → index-egd0vfey.js} +1 -1
- package/dist/client/static/js/{index-dzmar8jr.js → index-enb6chty.js} +1 -1
- package/dist/client/static/js/{index-v3f7we4n.js → index-f4fqvct6.js} +22 -22
- package/dist/client/static/js/{index-pysqpc5n.js → index-fg965t62.js} +2 -2
- package/dist/client/static/js/{index-raca8tsh.js → index-fgyenbv8.js} +4 -4
- package/dist/client/static/js/{index-qsw5edtk.js → index-fjnkzk12.js} +5 -5
- package/dist/client/static/js/{index-50mdqev0.js → index-g3a9j9hf.js} +1 -1
- package/dist/client/static/js/{index-1t5ybx9v.js → index-g4rsmakg.js} +3 -3
- package/dist/client/static/js/{index-qx6x4z0y.js → index-gmnmnfm0.js} +2 -2
- package/dist/client/static/js/{index-f33c4paw.js → index-gwqb7m8g.js} +1 -1
- package/dist/client/static/js/{index-ykfd2fyj.js → index-j60gtvw8.js} +1 -1
- package/dist/client/static/js/index-jvs2fvqz.js +2 -0
- package/dist/client/static/js/{index-r8cc80w5.js → index-jz93j0at.js} +2 -2
- package/dist/client/static/js/{index-82vk27q1.js → index-k9ws464d.js} +2 -2
- package/dist/client/static/js/{index-0pabfaac.js → index-kc3c2gzb.js} +1 -1
- package/dist/client/static/js/{index-5jnvz9hw.js → index-kccp6tgd.js} +2 -2
- package/dist/client/static/js/{index-1y3rzw6b.js → index-kmzd0adv.js} +1 -1
- package/dist/client/static/js/{index-77t0nvt1.js → index-ksph3kpr.js} +2 -2
- package/dist/client/static/js/{index-dfqmwm7j.js → index-m9s9rg5k.js} +2 -2
- package/dist/client/static/js/{index-gsxebrq9.js → index-n9scbxy5.js} +2 -2
- package/dist/client/static/js/{index-7a2efrbj.js → index-q1gwgmxt.js} +2 -2
- package/dist/client/static/js/{index-b42t14wk.js → index-q81rxwh7.js} +35 -35
- package/dist/client/static/js/{index-ktbrmp29.js → index-qhytrsyb.js} +2 -2
- package/dist/client/static/js/index-qzw4jnnv.js +1 -0
- package/dist/client/static/js/{index-cz50ha6x.js → index-r11bbnek.js} +78 -78
- package/dist/client/static/js/{index-zndbhb9w.js → index-rv4qs3wm.js} +2 -2
- package/dist/client/static/js/{index-hga3e13s.js → index-s78n0dtv.js} +2 -2
- package/dist/client/static/js/{index-03pyvmcz.js → index-sesghshh.js} +2 -2
- package/dist/client/static/js/index-tnv3dryk.js +9 -0
- package/dist/client/static/js/{index-dtj73vs1.js → index-tzbzehqd.js} +1 -1
- package/dist/client/static/js/index-vcrh95gf.css +1 -0
- package/dist/client/static/js/{index-8kbp24xg.js → index-vmgzhp41.js} +1 -1
- package/dist/client/static/js/{index-r9db1gsf.js → index-wmv3crye.js} +2 -2
- package/dist/client/static/js/{index-b0v6gwym.js → index-ycks7gyg.js} +2 -2
- package/dist/client/static/js/{index-hw14rhen.js → index-ynaxep06.js} +2 -2
- package/dist/client/static/js/{index-rab39785.js → index-ys0xpw3q.js} +2 -2
- package/dist/client/static/js/{index-feffxxss.js → index-yvgbr7ek.js} +2 -2
- package/dist/client/static/js/index-zqthmaxq.js +478 -0
- package/dist/client/static/js/info-A6RAGUB7-m6qz24p8.js +1 -0
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-4e7ej63f.js → infoDiagram-VRGFBTTK-qv7438m3.js} +1 -1
- package/dist/client/static/js/ini-1x0ad976.js +1 -0
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-k3yet1ec.js → ishikawaDiagram-OU5B5YK6-p1w6zg5y.js} +4 -4
- package/dist/client/static/js/java-3944nq02.js +1 -0
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-qe352kyd.js → journeyDiagram-ZHPQQLJL-ywk6xqxr.js} +5 -5
- package/dist/client/static/js/json-g5ggnd94.js +1 -0
- package/dist/client/static/js/jsx-f6p72qpc.js +1 -0
- package/dist/client/static/js/{julia-2eekpjq8.js → julia-0h9krgsd.js} +1 -1
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-58hag75n.js → kanban-definition-PNTS6WVX-gtrmhggc.js} +5 -5
- package/dist/client/static/js/lua-edn2b3wn.js +1 -0
- package/dist/client/static/js/markdown-9dhg1fax.js +1 -0
- package/dist/client/static/js/{mermaid.core-6e89h6vm.js → mermaid.core-5s24b4hh.js} +6 -6
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-ncsam2fm.js → mindmap-definition-NLK3R4M7-3wx7abqn.js} +4 -4
- package/dist/client/static/js/one-dark-pro-3vya9z02.js +1 -0
- package/dist/client/static/js/one-light-1yrwn9my.js +1 -0
- package/dist/client/static/js/packet-AYTQ26CC-ng6wq5xj.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-b5ckc39d.js → pegDiagram-GJSIUBJH-yvyqnjya.js} +1 -1
- package/dist/client/static/js/{perl-dtn1fccw.js → perl-rptyx23q.js} +1 -1
- package/dist/client/static/js/{php-7av78hch.js → php-sagvq3wz.js} +1 -1
- package/dist/client/static/js/pie-WAS4IAKB-rf6jhxf6.js +1 -0
- package/dist/client/static/js/{pieDiagram-5QR66LMP-s4d47ve8.js → pieDiagram-5QR66LMP-26x6pj38.js} +3 -3
- package/dist/client/static/js/properties-fcmj08pv.js +1 -0
- package/dist/client/static/js/python-532d8ezm.js +1 -0
- package/dist/client/static/js/{quadrantDiagram-O4NWA36T-zm0ekvjz.js → quadrantDiagram-O4NWA36T-qhe8h0j9.js} +6 -6
- package/dist/client/static/js/r-ptmdxs2a.js +1 -0
- package/dist/client/static/js/radar-RG4KPBEZ-ygp6hxq4.js +1 -0
- package/dist/client/static/js/railroad-74A4TZTK-rxgnrb2g.js +1 -0
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-xkv52a2p.js +1 -0
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-bvcktbqh.js +1 -0
- package/dist/client/static/js/railroad-peg-WCYAUIDC-9c3v7jsq.js +1 -0
- package/dist/client/static/js/{railroadDiagram-XR7U4H2S-52vdqf53.js → railroadDiagram-XR7U4H2S-dwy3k2jx.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-7kf8bmk9.js → requirementDiagram-PLB6GJNP-hcmgfesg.js} +4 -4
- package/dist/client/static/js/{ruby-s2bqr910.js → ruby-9qyx7knh.js} +1 -1
- package/dist/client/static/js/{rust-q98kssv3.js → rust-bmb4ee5w.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-bcb9f54a.js → sankeyDiagram-IPEJSGJF-s6d3k4zs.js} +6 -6
- package/dist/client/static/js/{sass-bm32bb5k.js → sass-07rteya0.js} +1 -1
- package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-76ywvj7g.js → sequenceDiagram-PO4LG4MO-0fcmzgdy.js} +19 -19
- package/dist/client/static/js/{sizeCapture-INFHLROL-p9bsf5dc.js → sizeCapture-INFHLROL-t8fcm7rq.js} +1 -1
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-1ecfb3fs.js → stateDiagram-v2-GCMORJYK-jr80hfeg.js} +6 -6
- package/dist/client/static/js/{svelte-ztkaww47.js → svelte-w365cpwa.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-2pyjr946.js → swimlanes-2SLR337P-x1ay6w39.js} +1 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-xj123xrp.js +8 -0
- package/dist/client/static/js/{timeline-definition-EJHVYXUP-4csxwmn2.js → timeline-definition-EJHVYXUP-qz0g6msb.js} +2 -2
- package/dist/client/static/js/treeView-Q6P3EWNA-fb58a7z1.js +1 -0
- package/dist/client/static/js/treemap-WGGIJYW6-ej4qhksx.js +1 -0
- package/dist/client/static/js/typescript-683kkkaw.js +1 -0
- package/dist/client/static/js/{usecaseDiagram-POWQR4AR-0p1jnbsn.js → usecaseDiagram-POWQR4AR-sxzrv8ht.js} +43 -43
- package/dist/client/static/js/{vennDiagram-UO4OBE2U-y1hgdet4.js → vennDiagram-UO4OBE2U-qsqgnjcv.js} +5 -5
- package/dist/client/static/js/{vue-cbqm4bed.js → vue-d6cesny1.js} +1 -1
- package/dist/client/static/js/wardley-WFR3VGLG-mkp0kanv.js +1 -0
- package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-p578yrgm.js → wardleyDiagram-VNRHLVJA-rvwxn458.js} +4 -4
- package/dist/client/static/js/xml-6ct32gys.js +1 -0
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-b08b4ah0.js → xychartDiagram-PMCCYNJV-nb4w7rcg.js} +5 -5
- package/dist/client/static/js/yaml-1d5m3bfj.js +1 -0
- package/marketplace/plugins/command-runner/package.json +2 -2
- package/marketplace/plugins/command-runner/src/app.test.tsx +161 -0
- package/marketplace/plugins/command-runner/src/app.tsx +37 -3
- package/marketplace/plugins/command-runner/src/panel/Glyph.tsx +22 -4
- package/marketplace/plugins/git-forge/package.json +2 -2
- package/marketplace/plugins/git-forge/src/panel/Glyph.tsx +22 -3
- package/marketplace/plugins/git-forge/src/panel/index.tsx +21 -3
- package/marketplace/plugins/git-forge/src/panel/refresh.test.tsx +192 -0
- package/marketplace/plugins/git-forge/src/panel/use-forge.ts +4 -2
- package/marketplace/plugins/git-forge/src/panel/write.test.tsx +21 -0
- package/marketplace/plugins/stats/package.json +2 -2
- package/marketplace/plugins/stats/src/RefreshButton.tsx +9 -7
- package/marketplace/plugins/stats/src/app.tsx +15 -1
- package/marketplace/plugins/stats/src/refresh.test.tsx +166 -0
- package/package.json +1 -1
- package/src/client/components/common/anchored-menu/index.tsx +26 -8
- package/src/client/components/common/context-usage-button/McpSection.test.tsx +34 -5
- package/src/client/components/common/context-usage-button/McpSection.tsx +25 -3
- package/src/client/components/common/harness-glyph/brands.ts +3 -0
- package/src/client/components/common/harness-glyph/omo.ts +22 -0
- package/src/client/components/common/server-control/Panel.tsx +24 -86
- package/src/client/components/common/server-control/Row.tsx +98 -0
- package/src/client/components/common/server-control/index.test.tsx +69 -9
- package/src/client/components/layout/VisibilityMenu.tsx +18 -6
- package/src/client/components/layout/new-workspace-host/index.test.tsx +84 -0
- package/src/client/components/layout/new-workspace-host/index.tsx +35 -0
- package/src/client/components/mobile/header-titlebar.test.tsx +38 -3
- package/src/client/components/settings/Sidebar.tsx +2 -1
- package/src/client/components/settings/categories/GitSettings.tsx +31 -0
- package/src/client/components/settings/categories/git-settings/CommitMessageSection.tsx +292 -0
- package/src/client/components/settings/categories/git-settings/IdentitySection.tsx +215 -0
- package/src/client/components/settings/category-content.tsx +3 -0
- package/src/client/components/workspace/chat-timeline/MessageItem.tsx +8 -0
- package/src/client/components/workspace/chat-timeline/MessageList.test.ts +55 -2
- package/src/client/components/workspace/chat-timeline/MessageList.tsx +13 -1
- package/src/client/components/workspace/chat-timeline/PendingChatView.tsx +56 -50
- package/src/client/components/workspace/chat-timeline/ThinkingSection.test.tsx +38 -2
- package/src/client/components/workspace/chat-timeline/ThinkingSection.tsx +13 -1
- package/src/client/components/workspace/chat-timeline/target-picker/WorkspacePicker.test.tsx +50 -0
- package/src/client/components/workspace/chat-timeline/target-picker/WorkspacePicker.tsx +20 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Bash.tsx +2 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Proc.tsx +1 -4
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Wait.tsx +3 -2
- package/src/client/components/workspace/git-panel/CommitBox.test.tsx +98 -0
- package/src/client/components/workspace/git-panel/CommitBox.tsx +68 -3
- package/src/client/components/workspace/git-panel/index.test.ts +12 -0
- package/src/client/components/workspace/git-panel/index.tsx +20 -1
- package/src/client/components/workspace/repo-picker/index.test.tsx +20 -0
- package/src/client/components/workspace/repo-picker/index.tsx +5 -6
- package/src/client/data/settings/omp-schema.json +134 -8
- package/src/client/hooks/chat/context/mcp.ts +19 -1
- package/src/client/hooks/chat/timeline/jump-rail.ts +1 -0
- package/src/client/hooks/chat/timeline/row-window.test.ts +38 -3
- package/src/client/hooks/chat/timeline/row-window.ts +33 -9
- package/src/client/hooks/chat/timeline/scroll-geometry.ts +19 -1
- package/src/client/hooks/chat/timeline/scroll.ts +15 -0
- package/src/client/hooks/chat/timeline/thinking-open.ts +10 -4
- package/src/client/hooks/workspace/commit-box.test.ts +62 -1
- package/src/client/hooks/workspace/commit-box.ts +94 -2
- package/src/client/hooks/workspace/git-panel-data.ts +15 -7
- package/src/client/hooks/workspace/repo-scope/index.test.ts +10 -3
- package/src/client/hooks/workspace/repo-scope/index.ts +21 -9
- package/src/client/lib/plugins/repo-scope-service.ts +7 -25
- package/src/server/lib/chat/session-store.server.ts +22 -1
- package/src/server/lib/fs/git-commit-context.test.ts +111 -0
- package/src/server/lib/fs/git-commit-context.ts +85 -0
- package/src/server/lib/fs/git-commit-message.server.ts +251 -0
- package/src/server/lib/fs/git-commit-message.test.ts +211 -0
- package/src/server/lib/fs/git-commit-prompt.test.ts +69 -0
- package/src/server/lib/fs/git-commit-prompt.ts +57 -0
- package/src/server/lib/fs/git-commit-settings.server.ts +42 -0
- package/src/server/lib/fs/git-identity.server.test.ts +129 -0
- package/src/server/lib/fs/git-identity.server.ts +130 -0
- package/src/server/lib/harness/acp/acp-audit.server.ts +13 -62
- package/src/server/lib/harness/acp/acp-frames.server.test.ts +105 -0
- package/src/server/lib/harness/acp/acp-frames.server.ts +217 -0
- package/src/server/lib/harness/acp/acp-raw-messages.server.test.ts +69 -0
- package/src/server/lib/harness/acp/acp-raw-messages.server.ts +129 -0
- package/src/server/lib/harness/acp/acp-telemetry.server.ts +19 -0
- package/src/server/lib/harness/acp/one-shot.server.ts +141 -0
- package/src/server/lib/harness/acp/raw-listeners.ts +30 -0
- package/src/server/lib/harness/acp/session-handshake.ts +11 -3
- package/src/server/lib/harness/acp/session.test-util.ts +2 -0
- package/src/server/lib/harness/acp/session.ts +8 -0
- package/src/server/lib/harness/capabilities.ts +11 -0
- package/src/server/lib/harness/launch-table.ts +19 -0
- package/src/server/lib/harness/launch.ts +4 -0
- package/src/server/lib/harness/schema.server.ts +23 -0
- package/src/server/lib/harness/spawn.server.ts +18 -2
- package/src/server/lib/mcp/agent-config.server.test.ts +111 -0
- package/src/server/lib/mcp/agent-config.server.ts +205 -0
- package/src/server/lib/mcp/probe.server.ts +7 -1
- package/src/server/lib/mcp/registry.server.ts +4 -3
- package/src/server/lib/mcp/secrets.server.test.ts +85 -0
- package/src/server/lib/mcp/secrets.server.ts +108 -0
- package/src/server/lib/omp/core/print.server.ts +100 -0
- package/src/server/lib/omp/rpc/frame-fold.ts +4 -0
- package/src/server/lib/omp/session/artifacts.server.test.ts +15 -5
- package/src/server/lib/omp/session/artifacts.server.ts +41 -26
- package/src/server/lib/omp/session/delete.server.ts +2 -0
- package/src/server/lib/omp/session/goal-auditor.server.ts +10 -48
- package/src/server/lib/realtime/topics/session-data.server.ts +6 -14
- package/src/server/routes/fs/git-message.test.ts +101 -0
- package/src/server/routes/fs/git-message.ts +60 -0
- package/src/server/routes/fs/index.ts +2 -0
- package/src/server/routes/omp/artifact.ts +4 -3
- package/src/server/routes/sessions/mcp.test.ts +65 -1
- package/src/server/routes/sessions/mcp.ts +77 -5
- package/src/server/routes/settings/git-identity.test.ts +77 -0
- package/src/server/routes/settings/git-identity.ts +47 -0
- package/src/server/routes/settings/index.ts +2 -0
- package/src/server/routes/telemetry/acp-telemetry.test.ts +149 -0
- package/src/server/routes/telemetry/context.ts +31 -0
- package/src/server/routes/telemetry/raw-messages.ts +34 -0
- package/src/shared/lib/chat/tool/artifact.test.ts +4 -2
- package/src/shared/lib/chat/tool/artifact.ts +6 -1
- package/src/shared/lib/chat/tool/proc-facts.ts +2 -1
- package/src/shared/lib/fs/paths.test.ts +2 -0
- package/src/shared/lib/fs/repo-label.test.ts +22 -1
- package/src/shared/lib/fs/repo-label.ts +29 -0
- package/src/shared/lib/git/commit-prompt.test.ts +47 -0
- package/src/shared/lib/git/commit-prompt.ts +72 -0
- package/src/shared/lib/git/identity.test.ts +46 -0
- package/src/shared/lib/git/identity.ts +70 -0
- package/src/shared/lib/harness/brand-color.ts +3 -0
- package/src/shared/lib/harness/catalog.test.ts +14 -0
- package/src/shared/lib/harness/catalog.ts +9 -1
- package/src/shared/lib/harness/mcp-facts.ts +4 -0
- package/src/shared/lib/harness/provider-facts.test.ts +11 -0
- package/src/shared/lib/harness/provider-facts.ts +14 -0
- package/src/shared/lib/harness/providers.ts +2 -2
- package/src/shared/lib/harness/updates.test.ts +8 -0
- package/src/shared/lib/harness/updates.ts +9 -0
- package/src/shared/lib/omp/session/proc-daemon.ts +124 -0
- package/src/shared/lib/omp/session/proc.test.ts +30 -3
- package/src/shared/lib/omp/session/proc.ts +6 -82
- package/src/shared/lib/omp/session/wait-idle.test.ts +15 -4
- package/src/shared/lib/omp/session/wait-idle.ts +11 -4
- package/src/shared/lib/settings/defaults.ts +5 -0
- package/src/shared/lib/workspace/new-workspace.ts +20 -0
- package/src/shared/types/settings/mcp.ts +2 -2
- package/src/shared/types/settings/state.ts +16 -0
- package/src/test-support/preload.ts +1 -0
- package/dist/client/static/js/ImageView-bxqw3t4k.js +0 -1
- package/dist/client/static/js/LayoutWrapper-zt14rv9m.js +0 -2
- package/dist/client/static/js/Modal-cm35g20x.js +0 -38
- package/dist/client/static/js/SessionsView-gn53zyn7.js +0 -1
- package/dist/client/static/js/architecture-7GRP2DOG-cagtcfhk.js +0 -1
- package/dist/client/static/js/bash-fjzhxy10.js +0 -1
- package/dist/client/static/js/c-wqtyezvw.js +0 -1
- package/dist/client/static/js/cpp-y0nzwner.js +0 -1
- package/dist/client/static/js/css-n2waj098.js +0 -1
- package/dist/client/static/js/cynefin-OW5HDTMX-6g2ydrss.js +0 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-b774qbn2.js +0 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-nznq0n36.js +0 -1
- package/dist/client/static/js/gitGraph-4MIJSDKK-b047d6vk.js +0 -1
- package/dist/client/static/js/graphql-gvb7e2eb.js +0 -1
- package/dist/client/static/js/html-tbz83eke.js +0 -1
- package/dist/client/static/js/index-0gbj4270.js +0 -2
- package/dist/client/static/js/index-38xv8h4t.js +0 -1
- package/dist/client/static/js/index-f4vr1c6e.css +0 -1
- package/dist/client/static/js/index-fb6pw9xb.js +0 -2
- package/dist/client/static/js/index-pzvr1699.js +0 -478
- package/dist/client/static/js/index-rf29f3fq.js +0 -9
- package/dist/client/static/js/index-zw621xez.js +0 -4
- package/dist/client/static/js/info-A6RAGUB7-n495k952.js +0 -1
- package/dist/client/static/js/ini-2gvjwh83.js +0 -1
- package/dist/client/static/js/java-1xwcq79s.js +0 -1
- package/dist/client/static/js/json-4pqjabgq.js +0 -1
- package/dist/client/static/js/jsx-wcsss15s.js +0 -1
- package/dist/client/static/js/lua-h7vjcn0h.js +0 -1
- package/dist/client/static/js/markdown-f30jjjh9.js +0 -1
- package/dist/client/static/js/one-dark-pro-qmyne0tn.js +0 -1
- package/dist/client/static/js/one-light-dj0ecjcj.js +0 -1
- package/dist/client/static/js/packet-AYTQ26CC-zajj62z6.js +0 -1
- package/dist/client/static/js/pie-WAS4IAKB-1ve78y5f.js +0 -1
- package/dist/client/static/js/properties-ymexza6q.js +0 -1
- package/dist/client/static/js/python-31ycwa66.js +0 -1
- package/dist/client/static/js/r-t2nne4xp.js +0 -1
- package/dist/client/static/js/radar-RG4KPBEZ-8rqadb58.js +0 -1
- package/dist/client/static/js/railroad-74A4TZTK-v6ppm8dy.js +0 -1
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-9j6bae14.js +0 -1
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-56cpyt0g.js +0 -1
- package/dist/client/static/js/railroad-peg-WCYAUIDC-yfdmspf4.js +0 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-qr5hdxm4.js +0 -8
- package/dist/client/static/js/treeView-Q6P3EWNA-vwpg3wp8.js +0 -1
- package/dist/client/static/js/treemap-WGGIJYW6-htfxwd32.js +0 -1
- package/dist/client/static/js/typescript-p3syh43m.js +0 -1
- package/dist/client/static/js/wardley-WFR3VGLG-hapfjkzq.js +0 -1
- package/dist/client/static/js/xml-4enq788a.js +0 -1
- package/dist/client/static/js/yaml-pjtt3jsc.js +0 -1
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{d,n,o,W,i,u,a,yr,e,vr,ho,Kn,Rp,Ce,S,Lp,ng,cr,ur,s,Ua,Ie,Ga,m,Qn,L,_,tt,f,B,ie,nt,re,fe,ge,Ln,rn,Mn,Y,D,Ea,O,Co,cn,b,ht,it,pe,Hu,ui,Z,lt,ct,bt,je,he,J}from"./index-pzvr1699.js";import{Dp,br}from"./index-7a2efrbj.js";var Bt={name:"folder-tree",size:24,node:[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]},Ue=s(Bt);var Ft={name:"list",size:24,node:[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]},We=s(Ft);function qe({message:t,hasStagedChanges:c,isBusy:l=!1,amend:r=!1,seeded:p=!1,onToggleAmend:h,onChangeMessage:g,onCommit:v}){let y=t.trim().length>0&&!l&&(r||c),P=r?"Rewrite the previous commit with this message":c?"Commit staged changes":"Stage changes first";return e("div",{className:"border-t border-ink/10 bg-canvas/50 p-3 flex flex-col gap-2",children:[e("textarea",{value:t,onChange:(C)=>g(C.currentTarget.value),onKeyDown:(C)=>{if(C.key==="Enter"&&(C.metaKey||C.ctrlKey)&&y)C.preventDefault(),v()},placeholder:r?"New message for the previous commit (⌘/Ctrl+Enter to commit)":"Commit message (⌘/Ctrl+Enter to commit)",rows:5,className:"w-full resize-y min-h-[100px] max-h-[200px] bg-paper border border-ink/20 rounded px-2.5 py-1.5 text-xs text-ink placeholder-ink/40 focus:outline-none focus:border-ink/40 transition-colors font-mono"}),e("div",{className:"flex items-center gap-2",children:[e("label",{className:"flex items-center gap-1.5 text-[11px] text-ink/70 cursor-pointer select-none",children:[e("input",{type:"checkbox",checked:r,onChange:(C)=>h?.(C.currentTarget.checked),className:`${he} accent-ink cursor-pointer`}),"Amend"]}),r&&p&&e("span",{className:"text-[10px] text-ink/40",title:"The previous commit's message, loaded as an editable starting point",children:"previous message loaded"}),e("button",{type:"button",onClick:v,disabled:!y,title:P,className:"ml-auto flex items-center justify-center gap-1.5 px-3 py-1.5 rounded bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e(f,{size:12}),r?"Amend commit":"Commit"]})]})]})}function Ke({operation:t,conflicts:c,isBusy:l,onAbort:r,onContinue:p}){let h=ho[t],g=c.length,v=g===0,y=t!=="stash-pop";return e("div",{className:"border-t border-warning/30 bg-warning/5 p-3 flex flex-col gap-2",children:[e("div",{className:"flex items-center gap-2 text-xs text-ink",children:[e(_,{size:13,className:"text-warning flex-shrink-0"}),e("span",{className:"font-medium",children:[h.charAt(0).toUpperCase()+h.slice(1)," in progress"]}),e("span",{className:`font-mono tabular-nums text-[10px] ${v?"text-success":"text-warning"}`,children:v?"all conflicts resolved":`${g} conflict${g===1?"":"s"} left`})]}),!v&&e("div",{className:"max-h-20 overflow-y-auto scrollbar-overlay-container font-mono text-[10px] text-warning/90 space-y-0.5",children:c.map((P)=>e("div",{className:"truncate",title:P,children:P},P))}),e("div",{className:"flex items-stretch gap-2",children:[e("button",{type:"button",onClick:r,disabled:l,title:`Abort the ${h} and restore the previous state`,className:"flex-1 flex items-center justify-center gap-1.5 px-3 py-1.5 rounded border border-error/40 text-error hover:bg-error/10 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e(cn,{size:12}),"Abort ",h]}),y&&e("button",{type:"button",onClick:p,disabled:l||!v,title:v?`Conclude the ${h}`:`Resolve all ${g} conflict(s) first`,className:"flex-1 flex items-center justify-center gap-1.5 px-3 py-1.5 rounded border border-transparent bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e(Ln,{size:12}),"Continue ",h]})]})]})}function Ve({branchRef:t,showBranchMenu:c,setShowBranchMenu:l,branch:r,branches:p,remoteBranches:h,onCheckout:g,onMerge:v,onOpenBranchPrompt:y,onManageBranches:P,optionsRef:C,showOptions:R,setShowOptions:N,onHistory:G,onGraph:M,viewMode:k,setViewMode:x,isBusy:w=!1,syncCount:T={ahead:0,behind:0},syncing:F=!1,onSync:H,onFetch:A,detached:z=!1}){return e("div",{className:"p-3 border-b border-ink/10 bg-canvas/50 flex items-center justify-between",children:[e("div",{className:"relative",ref:t,children:[e("button",{onClick:()=>l(!c),className:"flex items-center space-x-1.5 hover:bg-ink/5 px-2 py-1 -ml-2 rounded transition-colors text-[11px] text-ink/80 font-medium",title:z?`Detached HEAD at ${r}`:`On branch ${r}`,children:[e(ge,{size:12,className:z?"text-warning":"text-ink/60"}),e("span",{className:`truncate max-w-[140px] ${z?"font-mono text-warning":""}`,children:r}),e(B,{size:12,className:"text-ink/40"})]}),c&&e("div",{className:"glass-popover absolute top-full left-0 mt-1 w-56 bg-paper border border-ink/20 rounded-md shadow-lg z-50 flex flex-col overflow-hidden text-xs",children:e("div",{className:"max-h-48 scrollbar-overlay-container py-1",children:[p.length>0&&e(d,{children:[e("div",{className:"px-3 py-1 text-[10px] uppercase tracking-wider text-ink/40 font-semibold",children:"Local"}),p.map((E)=>e("div",{className:"flex items-center group/branch",children:[e("button",{onClick:()=>{g(E),l(!1)},className:"flex-1 min-w-0 text-left px-3 py-2 hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("span",{className:"truncate",children:E}),r===E&&e(f,{size:12,className:"text-ink flex-shrink-0"})]}),r!==E&&e("button",{type:"button",onClick:()=>{v(E),l(!1)},title:`Merge ${E} into ${r}`,"aria-label":`Merge ${E} into ${r}`,className:"touch-visible opacity-0 group-hover/branch:opacity-100 px-2 py-2 text-ink/40 hover:text-ink hover:bg-ink/5 transition-colors cursor-pointer flex-shrink-0",children:e(Ln,{size:12})})]},E))]}),h.length>0&&e(d,{children:[e("div",{className:"px-3 py-1 text-[10px] uppercase tracking-wider text-ink/40 font-semibold",children:"Remote"}),h.map((E)=>e("div",{className:"flex items-center group/branch",children:[e("button",{onClick:()=>{g(E),l(!1)},className:"flex-1 min-w-0 text-left px-3 py-2 hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("span",{className:"truncate",children:E}),r===E&&e(f,{size:12,className:"text-ink flex-shrink-0"})]}),r!==E&&e("button",{type:"button",onClick:()=>{v(E),l(!1)},title:`Merge ${E} into ${r}`,"aria-label":`Merge ${E} into ${r}`,className:"touch-visible opacity-0 group-hover/branch:opacity-100 px-2 py-2 text-ink/40 hover:text-ink hover:bg-ink/5 transition-colors cursor-pointer flex-shrink-0",children:e(Ln,{size:12})})]},E))]}),e("div",{className:"w-full h-px bg-ink/10 my-1"}),e("button",{onClick:()=>{y(),l(!1)},className:"w-full text-left px-3 py-2 hover:bg-ink/5 flex items-center space-x-2 transition-colors text-ink/80 italic",children:[e(Y,{size:12}),e("span",{children:"Create new branch..."})]}),e("button",{onClick:P,className:"w-full text-left px-3 py-2 hover:bg-ink/5 flex items-center space-x-2 transition-colors text-ink/80",children:[e(Co,{size:12}),e("span",{children:"Manage branches..."})]})]})})]}),e("div",{className:"flex items-center space-x-2 text-ink/40 relative",ref:C,children:[e("button",{type:"button",onClick:A,disabled:w,title:"Fetch from all remotes and prune deleted branches","aria-label":"Fetch",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:e(Ua,{size:13})}),e("button",{type:"button",onClick:H,disabled:w,title:F?"Syncing with upstream…":T.ahead>0&&T.behind>0?`Pull ${T.behind} then push ${T.ahead} commit(s)`:T.ahead>0?`Push ${T.ahead} commit(s)`:T.behind>0?`Pull ${T.behind} commit(s)`:"Up to date — sync anyway","aria-label":"Sync with upstream","aria-busy":F,className:`flex items-center gap-1 p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors disabled:cursor-not-allowed ${F?"":"disabled:opacity-40"}`,children:[e(D,{size:13,className:F?"animate-spin":"","aria-hidden":"true"}),e("span",{className:"font-mono tabular-nums text-[10px]",children:["↑",T.ahead," ↓",T.behind]})]}),e("button",{type:"button",onClick:G,title:"Commit History","aria-label":"Commit History",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:e(Qn,{size:13})}),e("button",{type:"button",onClick:M,title:"Git Graph","aria-label":"Git Graph",className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:e(Ln,{size:13})}),e("button",{type:"button",onClick:()=>N(!R),title:"View Options","aria-label":"View Options","aria-expanded":R,className:"p-1 rounded hover:text-ink hover:bg-ink/5 cursor-pointer transition-colors",children:e(Ie,{size:13})}),R&&e("div",{className:"glass-popover absolute right-0 top-full mt-1 w-36 bg-paper border border-ink/15 rounded-md shadow-lg z-50 py-1 font-mono text-xs",children:[e("button",{type:"button",onClick:()=>{x("flat"),N(!1)},className:"w-full px-3 py-1.5 text-left text-ink hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("div",{className:"flex items-center space-x-1.5",children:[e(We,{size:12,className:"text-ink/60"}),e("span",{children:"View as List"})]}),k==="flat"&&e(f,{size:12,className:"text-ink"})]}),e("button",{type:"button",onClick:()=>{x("tree"),N(!1)},className:"w-full px-3 py-1.5 text-left text-ink hover:bg-ink/5 flex items-center justify-between transition-colors",children:[e("div",{className:"flex items-center space-x-1.5",children:[e(Ue,{size:12,className:"text-ink/60"}),e("span",{children:"View as Tree"})]}),k==="tree"&&e(f,{size:12,className:"text-ink"})]})]})]})]})}function Ye({activeRepo:t,repos:c,isRefreshing:l,rootPath:r,reposScanning:p,onSelectRepo:h,onRefresh:g,onRefreshRepos:v}){return e(ht,{left:e(d,{children:[e(Dp,{size:12,className:"text-ink/50 flex-shrink-0","aria-hidden":!0}),e(br,{rootPath:r,activeRepo:t,onSelectRepo:h,repos:c,scanning:p,onRefreshRepos:v})]}),right:e(it,{label:"Refresh",onClick:g,busy:l})})}function Be({change:t,isStaged:c,repo:l,rootPath:r,onAction:p}){let h=Kn(t.status,c),{charStatus:g,colorClass:v}=h,y=t.file.split("/"),P=y.pop()||t.file,C=y.length>0?y.join("/"):"";return e("div",{className:"flex items-center justify-between px-3 py-1 hover:bg-ink/5 cursor-pointer group text-[11px] transition-colors",onClick:()=>{window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:t.file,staged:c,status:g,repo:l||".",root:r}}))},children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-2",children:[e("span",{className:`font-bold font-mono text-[10px] w-3 flex-shrink-0 text-center ${v}`,title:`Status: ${h.label}`,children:g}),e(lt,{name:P,size:12,className:"flex-shrink-0"}),e("span",{className:`truncate ${v}`,title:t.file,children:P}),C&&e("span",{className:"text-[10px] text-ink/40 truncate ml-1",children:C})]}),e("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("div",{className:"flex items-center touch-visible opacity-0 group-hover:opacity-100 space-x-1",children:[!c&&e(d,{children:[e("button",{type:"button",onClick:(N)=>{N.stopPropagation(),p("revert",t.file)},title:"Discard Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(cn,{size:11})}),e("button",{type:"button",onClick:(N)=>{N.stopPropagation(),p("stage",t.file)},title:"Stage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Y,{size:11})})]}),c&&e("button",{type:"button",onClick:(N)=>{N.stopPropagation(),p("unstage",t.file)},title:"Unstage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(rn,{size:11})})]})})]})}function Xe({change:t,repo:c,rootPath:l,onResolve:r}){let[p,h]=n(!1),[g,v]=n(null),y=t.file.split("/"),P=y.pop()||t.file,C=y.length>0?y.join("/"):"",R=()=>{window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:t.file,staged:!1,status:t.status,repo:c,root:l}}))},N=async()=>{let k=!p;if(h(k),k&&g===null){let x=new URLSearchParams({conflictMarkers:"1",file:t.file,repo:c||"."});if(l)x.set("root",l);try{let T=await(await fetch(`/api/fs/git?${x.toString()}`)).json();v(T.markers??{})}catch{v({})}}},G=g?.ours||"ours",M=g?.theirs||"theirs";return e("div",{className:"border-b border-warning/20 last:border-b-0",children:[e("div",{className:"flex items-center justify-between px-3 py-1 hover:bg-warning/5 cursor-pointer group text-[11px] transition-colors",onClick:R,children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-2",children:[e(Ga,{size:11,className:"text-warning flex-shrink-0"}),e(lt,{name:P,size:12,className:"flex-shrink-0"}),e("span",{className:"truncate text-warning",title:t.file,children:P}),C&&e("span",{className:"text-[10px] text-ink/40 truncate ml-1",children:C}),vr(t.status)&&e("span",{className:"text-[10px] text-warning/70 font-mono flex-shrink-0",children:t.status})]}),e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),N()},title:p?"Hide resolve actions":"Show resolve actions","aria-label":p?"Hide resolve actions":"Show resolve actions","aria-expanded":p,className:"w-5 h-5 flex items-center justify-center rounded text-ink/40 hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors flex-shrink-0",children:p?e(nt,{size:11}):e(B,{size:11})})]}),p&&e("div",{className:"px-3 pb-2 pt-0.5 flex flex-wrap items-center gap-1.5",children:[e("button",{type:"button",onClick:()=>r(t.file,"ours"),title:`Take ${G} — \`git checkout --ours\` then stage`,className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer max-w-[45%] truncate",children:["take ",G]}),e("button",{type:"button",onClick:()=>r(t.file,"theirs"),title:`Take ${M} — \`git checkout --theirs\` then stage`,className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer max-w-[45%] truncate",children:["take ",M]}),e("button",{type:"button",onClick:()=>r(t.file,""),title:"Mark resolved: the file was edited by hand, this stages it",className:"px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer flex items-center gap-1",children:[e(f,{size:10}),"mark resolved"]})]})]})}function Et(t){let c={id:"",name:"",path:"",type:"folder",children:[],changeCount:0};for(let r of t){let p=r.file.replace(/^[./]+/,""),h=p.endsWith("/"),g=p.replace(/\/$/,"").split("/").filter(Boolean),v=c,y="";for(let P=0;P<g.length;P++){let C=g[P];y=y?`${y}/${C}`:C;let R=P===g.length-1;if(R&&!h)v.children.push({id:y,name:C,path:y,type:"file",change:r,children:[],changeCount:1});else{let G=v.children.find((M)=>M.type==="folder"&&M.name===C);if(!G)G={id:y,name:C,path:y,type:"folder",children:[],changeCount:0,change:R&&h?r:void 0},v.children.push(G);v=G}}}function l(r){if(r.type==="file")return 1;let p=r.change?1:0;for(let h of r.children)p+=l(h);return r.changeCount=p,r.children.sort((h,g)=>{if(h.type==="folder"&&g.type==="file")return-1;if(h.type==="file"&&g.type==="folder")return 1;return h.name.localeCompare(g.name)}),p}return l(c),c.children}function Ze(t){let{sessionId:c,ready:l,read:r}=Lp(),p=u(()=>Et(t),[t]),h=u(()=>{let N=new Set;function G(M){for(let k of M)if(k.type==="folder"){if(N.add(k.id),k.children&&k.children.length>0)G(k.children)}}return G(p),N},[p]),[g,v]=S("git.expandedFolders",[]),y=u(()=>new Set(g),[g]),P=i(null);o(()=>{if(!l||P.current===c)return;if(h.size===0)return;if(P.current=c,r("git.expandedFolders",[]).length>0)return;v(Array.from(h))},[l,c,h,r,v]);let C=a((N)=>{v((G)=>{let M=new Set(G);if(M.has(N))M.delete(N);else M.add(N);return Array.from(M)})},[v]),R=a((N)=>y.has(N),[y]);return{tree:p,expandedFolders:y,toggleFolder:C,isFolderOpen:R,expandAll:()=>v(Array.from(h)),collapseAll:()=>v([])}}function Fe({node:t,isStaged:c,isFolderOpen:l,toggleFolder:r,onAction:p,repo:h,rootPath:g}){let v=t.type==="folder",y=v?l(t.id):!1;if(v)return e("div",{className:"select-none",children:[e("div",{className:"flex items-center justify-between px-2 py-1 hover:bg-ink/5 cursor-pointer rounded group transition-colors text-[11px]",onClick:()=>r(t.id),children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-1",children:[e("span",{className:"w-3.5 h-3.5 flex items-center justify-center text-ink/40 flex-shrink-0",children:y?e(B,{size:12}):e(ie,{size:12})}),e(lt,{name:t.name,isFolder:!0,isOpen:y,size:13,className:"flex-shrink-0"}),e("span",{className:"font-medium text-ink truncate",children:t.name}),e("span",{className:"text-[10px] text-ink/40 font-normal px-1 py-0.2 bg-ink/5 rounded-full ml-1",children:t.changeCount})]}),e("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("div",{className:"flex items-center touch-visible opacity-0 group-hover:opacity-100 space-x-1",children:!c?e(d,{children:[e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),p("revert",t.path)},title:`Discard changes in ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(cn,{size:11})}),e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),p("stage",t.path)},title:`Stage ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Y,{size:11})})]}):e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),p("unstage",t.path)},title:`Unstage ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(rn,{size:11})})})})]}),y&&t.children&&t.children.length>0&&e("div",{className:"ml-3 border-l border-ink/10 pl-1",children:t.children.map((k)=>e(Fe,{node:k,isStaged:c,isFolderOpen:l,toggleFolder:r,onAction:p,repo:h,rootPath:g},k.id))})]});let P=t.change,C=Kn(P?.status||"M",c),{charStatus:R,colorClass:N}=C,G=P?P.file:t.path;return e("div",{className:"flex items-center justify-between px-2 py-0.5 hover:bg-ink/5 cursor-pointer rounded group transition-colors text-[11px]",onClick:()=>{window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:G,staged:c,status:R,repo:h||".",root:g}}))},children:[e("div",{className:"flex items-center space-x-1.5 flex-1 min-w-0 pr-1",children:[e("span",{className:"w-3.5 h-3.5 flex items-center justify-center flex-shrink-0",children:e("span",{className:`font-bold font-mono text-[10px] ${N}`,title:`Status: ${C.label}`,children:R})}),e(lt,{name:t.name,size:12,className:"flex-shrink-0"}),e("span",{className:`truncate ${N}`,title:G,children:t.name})]}),e("div",{className:"flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("div",{className:"flex items-center touch-visible opacity-0 group-hover:opacity-100 space-x-1",children:!c?e(d,{children:[e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),p("revert",G)},title:"Discard Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(cn,{size:11})}),e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),p("stage",G)},title:"Stage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Y,{size:11})})]}):e("button",{type:"button",onClick:(k)=>{k.stopPropagation(),p("unstage",G)},title:"Unstage Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(rn,{size:11})})})})]})}function Ee({changes:t,isStaged:c,repo:l,rootPath:r,onAction:p}){let{tree:h,isFolderOpen:g,toggleFolder:v}=Ze(t);if(h.length===0)return null;return e("div",{className:"py-0.5",children:h.map((y)=>e(Fe,{node:y,isStaged:c,isFolderOpen:g,toggleFolder:v,onAction:p,repo:l,rootPath:r},y.id))})}function Qe({changes:t,isLoading:c,viewMode:l,repo:r,rootPath:p,onAction:h,onResolve:g}){let[v,y]=S("git.stagedExpanded",!0),[P,C]=S("git.unstagedExpanded",!0),[R,N]=S("git.conflictsExpanded",!0),G=t.filter((x)=>vr(x.status)),M=t.filter((x)=>{if(vr(x.status))return!1;let w=x.status;return w&&w[0]!==" "&&w[0]!=="?"}),k=t.filter((x)=>{if(vr(x.status))return!1;let w=x.status;return w&&w[1]!==" "&&w[1]!=="?"||w==="??"});if(c&&t.length===0)return e("div",{className:"flex-1 scrollbar-overlay-container font-mono text-[11px] text-ink/80",children:e("div",{className:"p-4 text-center text-ink/40 italic",children:"Loading..."})});if(t.length===0)return e("div",{className:"flex-1 scrollbar-overlay-container font-mono text-[11px] text-ink/80",children:e("div",{className:"p-4 text-center text-ink/40 italic",children:"No changes found."})});return e("div",{className:"flex-1 scrollbar-overlay-container font-mono text-[11px] text-ink/80",children:e("div",{className:"py-1",children:[G.length>0&&e("div",{className:"mb-2",children:[e("div",{className:"flex items-center justify-between px-3 py-1 group hover:bg-warning/5 cursor-pointer transition-colors",onClick:()=>N(!R),children:e("div",{className:"flex items-center space-x-1 font-semibold text-warning text-xs",children:[e("span",{className:"w-3 text-center",children:R?"▾":"▸"}),e("span",{children:"Conflicts"}),e("span",{className:"text-warning/70 font-normal ml-1 border border-warning/30 rounded-full px-1.5 text-[10px] bg-paper",children:G.length})]})}),R&&G.map((x)=>e(Xe,{change:x,repo:r,rootPath:p,onResolve:g??(()=>{})},`conflict-${x.file}`))]}),M.length>0&&e("div",{className:"mb-2",children:[e("div",{className:"flex items-center justify-between px-3 py-1 group hover:bg-ink/5 cursor-pointer transition-colors",onClick:()=>y(!v),children:[e("div",{className:"flex items-center space-x-1 font-semibold text-ink text-xs",children:[e("span",{className:"w-3 text-center",children:v?"▾":"▸"}),e("span",{children:"Staged Changes"}),e("span",{className:"text-ink/40 font-normal ml-1 border border-ink/20 rounded-full px-1.5 text-[10px] bg-paper",children:M.length})]}),e("div",{className:"touch-visible opacity-0 group-hover:opacity-100 flex items-center space-x-1 text-ink/40 flex-shrink-0",children:e("button",{type:"button",onClick:(x)=>{x.stopPropagation(),h("unstage_all")},title:"Unstage All Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(rn,{size:12})})})]}),v&&(l==="tree"?e(Ee,{changes:M,isStaged:!0,repo:r,rootPath:p,onAction:h}):M.map((x)=>e(Be,{change:x,isStaged:!0,repo:r,rootPath:p,onAction:h},x.file+"staged")))]}),k.length>0&&e("div",{children:[e("div",{className:"flex items-center justify-between px-3 py-1 group hover:bg-ink/5 cursor-pointer transition-colors",onClick:()=>C(!P),children:[e("div",{className:"flex items-center space-x-1 font-semibold text-ink text-xs",children:[e("span",{className:"w-3 text-center",children:P?"▾":"▸"}),e("span",{children:"Changes"}),e("span",{className:"text-ink/40 font-normal ml-1 border border-ink/20 rounded-full px-1.5 text-[10px] bg-paper",children:k.length})]}),e("div",{className:"touch-visible opacity-0 group-hover:opacity-100 flex items-center space-x-1 text-ink/40 flex-shrink-0",children:[e("button",{type:"button",onClick:(x)=>{x.stopPropagation(),h("revert_all")},title:"Discard All Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(cn,{size:12})}),e("button",{type:"button",onClick:(x)=>{x.stopPropagation(),h("stage_all")},title:"Stage All Changes",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Y,{size:12})})]})]}),P&&(l==="tree"?e(Ee,{changes:k,isStaged:!1,repo:r,rootPath:p,onAction:h}):k.map((x)=>e(Be,{change:x,isStaged:!1,repo:r,rootPath:p,onAction:h},x.file+"unstaged")))]})]})})}function Je({matches:t,loaded:c,total:l,hasMore:r,isFiltering:p}){if(p)return`${t} of ${c} loaded`;if(typeof l==="number"&&l>0)return r||c<l?`${c} of ${l}`:`${l} commits`;return r?`${c}+ commits`:`${c} commits`}function et({isGraphMode:t,onToggleMode:c,searchQuery:l,onSearchChange:r,onRefresh:p,onClose:h,isRefreshing:g,totalCommits:v,loadedCount:y,totalCount:P,hasMore:C}){let R=Je({matches:v,loaded:y,total:P,hasMore:C,isFiltering:l.trim().length>0});return e("div",{className:`flex flex-col gap-2 px-3 lg:px-5 py-3 border-b border-ink/10 bg-paper select-none
|
|
2
|
-
pl-[max(0.75rem,env(safe-area-inset-left,0px))] pr-[max(0.75rem,env(safe-area-inset-right,0px))]`,children:[e("div",{className:"flex items-center justify-between gap-2 lg:gap-4",children:[e("div",{className:"flex flex-col min-w-0",children:[e("div",{className:"flex items-center gap-2.5 min-w-0",children:[e("h2",{className:"text-base font-semibold text-ink tracking-tight",children:t?"Graph":"History"}),e("span",{className:"text-[11px] font-mono px-2 py-0.5 rounded-full bg-ink/5 text-ink/80 border border-ink/10 whitespace-nowrap",children:R})]}),e("p",{className:"text-xs text-muted mt-0.5 hidden lg:block",children:t?"Follow branch topology and inspect commits.":"Browse recent commits and inspect changed files."})]}),e("div",{className:"flex items-center gap-1.5 lg:gap-2 flex-shrink-0",children:[e("div",{className:"flex items-center text-xs lg:bg-ink/5 lg:p-0.5 lg:rounded-lg lg:border lg:border-ink/10",children:[e("button",{type:"button",onClick:()=>c(!1),title:"History view","aria-label":"History view","aria-pressed":!t,className:`tap-target flex items-center justify-center gap-1.5 p-2 rounded-md font-medium transition-colors cursor-pointer lg:px-2.5 lg:py-1 ${!t?"bg-ink/5 text-ink lg:bg-paper lg:shadow-xs":"text-ink/80 lg:hover:text-ink lg:hover:bg-ink/5"}`,children:[e(Qn,{size:13,"aria-hidden":"true"}),e("span",{className:"hidden lg:inline",children:"History"})]}),e("button",{type:"button",onClick:()=>c(!0),title:"Graph view","aria-label":"Graph view","aria-pressed":t,className:`tap-target flex items-center justify-center gap-1.5 p-2 rounded-md font-medium transition-colors cursor-pointer lg:px-2.5 lg:py-1 ${t?"bg-ink/5 text-ink lg:bg-paper lg:shadow-xs":"text-ink/80 lg:hover:text-ink lg:hover:bg-ink/5"}`,children:[e(Ln,{size:13,"aria-hidden":"true"}),e("span",{className:"hidden lg:inline",children:"Graph"})]})]}),e("button",{type:"button",onClick:p,disabled:g,className:"tap-target flex items-center justify-center gap-1.5 p-2 rounded-md text-ink/70 transition-colors cursor-pointer text-xs disabled:opacity-40 lg:px-2.5 lg:py-1.5 lg:border lg:border-ink/15 lg:hover:bg-ink/5 lg:hover:text-ink",title:"Refresh commit history","aria-label":"Refresh commit history",children:[e(Ea,{size:13,className:g?"animate-spin text-ink":"","aria-hidden":"true"}),e("span",{className:"hidden lg:inline",children:"Refresh"})]}),e("button",{type:"button",onClick:h,className:"tap-target p-2 -mr-1 rounded-md hover:bg-ink/5 text-muted hover:text-ink transition-colors cursor-pointer",title:"Close modal","aria-label":"Close commit history",children:e(b,{size:16,"aria-hidden":"true"})})]})]}),e("div",{className:"relative mt-1",children:[e(O,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-ink/55","aria-hidden":"true"}),e("input",{type:"text",value:l,onChange:(N)=>r(N.currentTarget.value),placeholder:"Filter commits by message, author, or hash...","aria-label":"Filter commits",className:"w-full bg-ink/[0.03] border border-ink/15 rounded-md pl-8 pr-3 py-1.5 text-xs text-ink placeholder-ink/40 focus:outline-none focus:border-ink/40 transition-colors font-mono"}),l&&e("button",{type:"button",onClick:()=>r(""),"aria-label":"Clear filter",className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-ink/55 hover:text-ink cursor-pointer",children:e(b,{size:12,"aria-hidden":"true"})})]})]})}var ce=["#38bdf8","#f97316","#a855f7","#10b981","#ec4899","#eab308","#06b6d4","#6366f1"];function He(t,c){if(!t||!c)return!1;if(t===c)return!0;let l=Math.min(t.length,c.length);if(l>=4)return t.substring(0,l)===c.substring(0,l);return!1}function Ge(t){let c=new Map,l=[];for(let r of t){if(typeof r.lane==="number"){c.set(r.hash,r.lane);continue}let p=l.findIndex((g)=>He(g,r.hash)||He(g,r.shortHash));if(p===-1)if(p=l.indexOf(null),p===-1)p=l.length,l.push(r.hash);else l[p]=r.hash;c.set(r.hash,p);let h=r.parents&&r.parents[0];if(h)l[p]=h;else l[p]=null;if(r.parents&&r.parents.length>1)for(let g=1;g<r.parents.length;g++){let v=r.parents[g];if(!l.some((P)=>He(P,v))){let P=l.indexOf(null);if(P===-1)l.push(v);else l[P]=v}}}return c}function ot(t,c,l,r){let p=[],h=new Map;t.forEach((g,v)=>{if(h.set(g.hash,v),g.shortHash)h.set(g.shortHash,v);if(g.hash.length>=7)h.set(g.hash.substring(0,7),v)});for(let g of t){let v=c.get(g.hash)??0,y=l[g.hash]??0,P=ce[v%ce.length];if(!g.parents||g.parents.length===0)continue;for(let C of g.parents){let R=h.get(C);if(typeof R!=="number"&&C.length>=7)R=h.get(C.substring(0,7));if(typeof R==="number"){let N=t[R],G=c.get(N.hash)??v,M=l[N.hash]??y+60;p.push({fromHash:g.hash,toHash:N.hash,fromLane:v,toLane:G,fromY:y,toY:M,color:ce[v%ce.length]})}else p.push({fromHash:g.hash,toHash:"tail-"+g.hash,fromLane:v,toLane:v,fromY:y,toY:Math.max(y+80,r),color:P})}}return p}function rt(t,c,l,r){if(Math.abs(t-l)<1)return`M ${t} ${c} L ${l} ${r}`;let p=r-c,h=c+p*0.45,g=r-p*0.45;return`M ${t} ${c} C ${t} ${h}, ${l} ${g}, ${l} ${r}`}function st({commits:t,nodePositions:c,selectedHash:l,hoveredHash:r,isGraphMode:p,laneWidth:h=18,paddingLeft:g=16,totalHeight:v}){let y=u(()=>{if(!p){let N=new Map;return t.forEach((G)=>N.set(G.hash,0)),N}return Ge(t)},[t,p]),P=u(()=>{let N=0;return y.forEach((G)=>{if(G>N)N=G}),N},[y]),C=p?(P+1)*h+g*2:36,R=u(()=>{if(!p){let N=[];for(let G=0;G<t.length-1;G++){let M=c[t[G].hash]??G*60+20,k=c[t[G+1].hash]??(G+1)*60+20;N.push({fromHash:t[G].hash,toHash:t[G+1].hash,fromLane:0,toLane:0,fromY:M,toY:k,color:"var(--theme-ink)"})}return N}return ot(t,y,c,v)},[t,y,c,v,p]);return e("div",{className:"absolute top-0 left-0 pointer-events-none z-10",style:{width:C,height:v},"aria-hidden":"true",children:e("svg",{className:"w-full h-full overflow-visible",style:{width:C,height:v},children:[R.map((N)=>{let G=p?g+N.fromLane*h:16,M=p?g+N.toLane*h:16,k=p?N.color:"currentColor",x=p?0.95:0.25,w=rt(G,N.fromY,M,N.toY);return e("path",{d:w,fill:"none",stroke:k,strokeWidth:p?2.25:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:x},`${N.fromHash}->${N.toHash}`)}),t.map((N)=>{let G=y.get(N.hash)??0,M=p?g+G*h:16,k=c[N.hash]??20,x=l===N.hash||l===N.shortHash,w=r===N.hash||r===N.shortHash,T=p?ce[G%ce.length]:"var(--theme-success)";return e("g",{"data-commit-node":N.hash,children:[(x||w)&&e("circle",{cx:M,cy:k,r:8,fill:T,fillOpacity:x?0.35:0.2,stroke:T,strokeWidth:1}),e("circle",{"data-commit-dot":"",cx:M,cy:k,r:p?4:4.5,fill:p?"var(--theme-paper)":T,stroke:T,strokeWidth:p?2.5:1.5}),p&&e("circle",{cx:M,cy:k,r:1.8,fill:T})]},`node-${N.hash}`)})]})})}var Ht=[{action:"checkout",label:"checkout"},{action:"create_branch_here",label:"create branch here"},{action:"cherry_pick",label:"cherry-pick"},{action:"revert",label:"revert"},{action:"reset",label:"reset..."},{action:"merge",label:"merge into current"},{action:"rebase",label:"rebase onto this"}];function at({commit:t,onAction:c}){return e("div",{className:"flex flex-wrap items-center gap-1.5 pt-1.5 pb-2",children:Ht.map(({action:l,label:r})=>e("button",{type:"button",onClick:(p)=>{p.stopPropagation(),c(l,t)},className:"px-2.5 py-1 text-[11px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/80 hover:text-ink transition-colors cursor-pointer",children:r},l))})}var Se=3;function zt(t){let c=[];for(let l=0;l<t.length;l+=1){if(t[l].type!=="context"){c.push({row:t[l],index:l});continue}let r=l;while(r<t.length&&t[r].type==="context")r+=1;let p=r-l;if(p>Se*2+1){for(let h=l;h<l+Se;h+=1)c.push({row:t[h],index:h});c.push({row:{type:"elided",count:p-Se*2},index:-1});for(let h=r-Se;h<r;h+=1)c.push({row:t[h],index:h})}else for(let h=l;h<r;h+=1)c.push({row:t[h],index:h});l=r-1}return c}function dt({diffText:t,isLoading:c,filePath:l,fullContext:r=!1,onToggleContext:p}){let h=ui(),g=u(()=>{if(!t)return[];let C=[],R=1,N=1,G=t.split(/\r?\n/),k=G.some((x)=>x.startsWith("@@"))?G:[`@@ -0,0 +1,${G.length} @@`,...G.map((x)=>x.startsWith("+")||x.startsWith("-")?x:`+${x}`)];for(let x of k){if(x.startsWith("diff --git")||x.startsWith("index ")||x.startsWith("---")||x.startsWith("+++")||x.startsWith("new file mode")||x.startsWith("deleted file mode")||x.startsWith("similarity index")||x.startsWith("old mode")||x.startsWith("new mode")||x.startsWith("\\ No newline"))continue;if(x.startsWith("@@")){let w=x.match(/@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);if(w)R=parseInt(w[1],10),N=parseInt(w[2],10);C.push({type:"meta",text:x})}else if(x.startsWith("+"))C.push({type:"add",text:x.slice(1),newNum:N++});else if(x.startsWith("-"))C.push({type:"del",text:x.slice(1),oldNum:R++});else{let w=x.startsWith(" ")?x.slice(1):x;C.push({type:"context",text:w,oldNum:R++,newNum:N++})}}return C},[t]),v=bt(l),y=u(()=>{let C=Array(g.length).fill(""),R=-1,N=(G)=>{if(R<0)return;let M=Hu(g.slice(R,G).map((k)=>k.text).join(`
|
|
3
|
-
`),v);for(let k=R;k<G;k++)C[k]=M[k-R]??"";R=-1};return g.forEach((G,M)=>{if(G.type==="meta")N(M);else if(R<0)R=M}),N(g.length),C},[g,v,h]),P=u(()=>r?g.map((C,R)=>({row:C,index:R})):zt(g),[g,r]);if(c)return e("div",{className:"my-2 p-4 rounded bg-canvas border border-ink/10 text-muted font-mono text-xs flex items-center justify-center",children:"Loading commit diff..."});if(!t||g.length===0)return e("div",{className:"my-2 p-3 rounded bg-canvas border border-ink/10 text-muted font-mono text-xs text-center",children:"No diff content available for this file."});return e("div",{className:"my-2 rounded border border-ink/15 bg-paper overflow-hidden text-[11px] font-mono leading-relaxed text-ink",children:[e("div",{className:"flex items-center justify-between px-3 py-1.5 bg-canvas border-b border-ink/10 text-ink/70 text-[10.5px]",children:[e("span",{className:"font-semibold text-muted",children:"Diff preview"}),e("button",{type:"button",onClick:p,disabled:!p,className:"hover:text-ink flex items-center gap-1 cursor-pointer transition-colors disabled:opacity-40 disabled:cursor-default",title:r?"Show only the changed hunks":"Read the whole file around the change","aria-pressed":r,children:r?e(d,{children:[e(nt,{size:12,"aria-hidden":"true"})," Collapse context"]}):e(d,{children:[e(B,{size:12,"aria-hidden":"true"})," Expand all context"]})})]}),e("div",{className:"overflow-x-auto max-h-72 select-text",children:e("div",{className:"w-max min-w-full divide-y divide-ink/[0.04]",children:P.map(({row:C,index:R},N)=>{if(C.type==="elided")return e("div",{className:"px-3 py-1 bg-canvas text-muted text-[10px] text-center select-none",title:`${C.count} unchanged line(s) hidden`,children:["⋯ ",C.count," unchanged line",C.count===1?"":"s"," hidden ⋯"]},`elided-${N}`);let G=C,M=R;if(G.type==="meta")return e("div",{className:"flex items-center gap-2 px-3 py-1 bg-canvas border-y border-ink/10 text-muted text-[10px] font-semibold",children:[e("span",{children:"↕"}),e("span",{children:G.text})]},M);let k=G.type==="add",x=G.type==="del";return e("div",{className:`flex items-start font-mono ${k?"bg-success/10 hover:bg-success/15":x?"bg-error/10 hover:bg-error/15":"text-ink hover:bg-ink/[0.02]"}`,children:[e("div",{className:`w-10 flex-shrink-0 text-right pr-2 py-0.5 select-none border-r border-ink/10 text-[10px] tabular-nums font-mono ${x?"bg-error/15 text-ink/80 font-semibold":k?"bg-success/15 text-ink/80":"bg-canvas/50 text-muted"}`,children:G.oldNum??(k?"+":"")}),e("div",{className:`w-10 flex-shrink-0 text-right pr-2 py-0.5 select-none border-r border-ink/10 text-[10px] tabular-nums font-mono ${k?"bg-success/15 text-ink/80 font-semibold":x?"bg-error/15 text-ink/80":"bg-canvas/50 text-muted"}`,children:G.newNum??(x?"-":"")}),e("div",{className:`w-4 flex-shrink-0 text-center py-0.5 select-none font-bold ${k||x?"text-ink/80":"opacity-0"}`,children:k?"+":x?"-":" "}),e("div",{className:"flex-1 py-0.5 pr-3 whitespace-pre text-ink",children:G.text?e("span",{className:"shiki",dangerouslySetInnerHTML:{__html:y[M]}}):" "})]},M)})})})]})}function pt({commit:t,isSelected:c,onSelect:l,onAction:r,onToggleFile:p,isExpandedFile:h,isLoadingFile:g,isFullContextFile:v,onToggleContext:y,fileDiffs:P,headerRef:C}){let[R,N]=n(!1),G=t.body?.trim()??"",M=G.length>0,k=t.files??[],x=k.length,w=x>0,T=M||w,F=(A)=>{A.stopPropagation(),navigator.clipboard.writeText(t.hash),N(!0),setTimeout(()=>N(!1),2000)},H=(A,z)=>{A.stopPropagation(),p(t.hash,z)};return e("div",{onClick:()=>l(t),"data-testid":"commit-row","data-commit-hash":t.hash,className:"border-b border-ink/5 transition-colors cursor-pointer hover:bg-ink/[0.015]",children:e("div",{className:"py-2.5 flex flex-col",children:[e("div",{className:"flex flex-col gap-1",children:[t.refs&&t.refs.length>0&&e("div",{className:"flex flex-wrap items-center gap-1.5 pb-0.5",children:t.refs.map((A,z)=>{let E=A.includes("stash"),X=A.includes("HEAD")||A.includes("main")||A.includes("master");return e("span",{className:`px-2 py-0.5 rounded text-[10px] font-mono border ${E?"bg-warning/10 text-ink/80 border-warning/25 font-semibold":X?"bg-ink/10 text-ink font-semibold border-ink/20":"bg-canvas text-muted border-ink/10 font-medium"}`,children:A},z)})}),e("div",{ref:C,className:"flex items-start gap-1.5",children:e("button",{type:"button",onClick:(A)=>{A.stopPropagation(),l(t)},"aria-expanded":T?c:void 0,className:"flex flex-1 min-w-0 items-start gap-1.5 text-left cursor-pointer rounded focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ink/20",children:[e("span",{"data-commit-title":"",className:"text-[13px] font-semibold text-ink leading-snug break-words flex-1 min-w-0",children:t.message}),T&&e("span",{className:"text-ink/55 flex-shrink-0 mt-0.5","aria-hidden":"true",children:c?e(B,{size:13}):e(ie,{size:13})})]})}),M&&c&&e("div",{className:"border-l-2 border-ink/15 pl-3 py-1",children:e(J,{content:G,className:"text-ink/70"})}),e("div",{className:"flex items-center gap-x-2 gap-y-0.5 text-[11px] text-muted font-mono flex-wrap",children:[e("span",{children:t.author}),e("span",{children:t.date}),e("button",{type:"button",onClick:F,title:"Copy commit hash","aria-label":`Copy commit hash ${t.shortHash}`,className:"inline-flex items-center gap-1 hover:text-ink transition-colors cursor-pointer text-ink/70",children:[e("span",{children:t.shortHash}),R?e(f,{size:11,className:"text-success-text","aria-hidden":"true"}):e(re,{size:11,"aria-hidden":"true"})]}),w&&e("span",{children:[x," ",x===1?"file":"files"]})]})]}),c&&e("div",{className:"mt-2",children:e(at,{commit:t,onAction:r})}),w&&c&&e("div",{className:"mt-2 flex flex-col gap-1",children:k.map((A,z)=>{let E=h(t.hash,A.file),X=`${t.hash}:${A.file}`,ne=P[X]!==void 0?P[X]:A.diff,U=g(t.hash,A.file),V=A.status==="A"?"text-success-text font-bold":A.status==="D"?"text-error-text font-bold":A.status==="R"?"text-meta-text font-bold":"text-info-text font-bold";return e("div",{className:"flex flex-col",children:[e("button",{type:"button",onClick:(q)=>H(q,A),"aria-expanded":E,className:"flex w-full items-center gap-2 py-1 px-2 rounded text-[11.5px] font-mono text-ink/80 transition-colors group cursor-pointer border border-transparent hover:border-ink/10 text-left",children:[e("span",{className:`w-3.5 text-center flex-shrink-0 text-[11px] ${V}`,children:A.status||"M"}),e("span",{className:"truncate flex-1 min-w-0 text-ink/90 group-hover:text-ink font-medium",children:A.file}),e("span",{className:"flex items-center gap-1 text-[10.5px] tabular-nums flex-shrink-0 font-medium",children:[e("span",{className:"text-success-text",children:["+",A.additions]}),e("span",{className:"text-ink/30",children:"/"}),e("span",{className:"text-error-text",children:["-",A.deletions]})]}),e("span",{className:"text-ink/55 group-hover:text-ink flex-shrink-0",children:E?e(B,{size:13,"aria-hidden":"true"}):e(ie,{size:13,"aria-hidden":"true"})})]}),E&&e("div",{className:"pl-4 pr-1",children:e(dt,{diffText:ne,isLoading:U,filePath:A.file,fullContext:v(t.hash,A.file),onToggleContext:()=>y(t.hash,A)})})]},z)})})]})})}var be=50;function Ot(t){if(!Array.isArray(t))return[];let c=[];for(let l of t){if(!l||typeof l!=="object")continue;let r=l;if(typeof r.file!=="string"||!r.file)continue;c.push({file:r.file,status:typeof r.status==="string"?r.status:"M",additions:typeof r.additions==="number"&&Number.isFinite(r.additions)?r.additions:0,deletions:typeof r.deletions==="number"&&Number.isFinite(r.deletions)?r.deletions:0,diff:typeof r.diff==="string"?r.diff:void 0})}return c}function ze(t){if(!Array.isArray(t))return[];let c=[];for(let l of t){if(!l||typeof l!=="object")continue;let r=l,p=typeof r.hash==="string"&&r.hash?r.hash:"";if(!p)continue;c.push({hash:p,shortHash:typeof r.shortHash==="string"&&r.shortHash?r.shortHash:p.slice(0,8),author:typeof r.author==="string"?r.author:"Unknown",date:typeof r.date==="string"?r.date:typeof r.time==="string"?r.time:"",message:typeof r.message==="string"?r.message:"",body:typeof r.body==="string"?r.body:void 0,parents:Array.isArray(r.parents)?r.parents.filter((h)=>typeof h==="string"):[],refs:Array.isArray(r.refs)?r.refs.filter((h)=>typeof h==="string"):[],files:Ot(r.files),lane:typeof r.lane==="number"?r.lane:void 0})}return c}function mt({output:t,isGraphMode:c,rootPath:l,activeRepo:r}){let[p,h]=n(!1),[g,v]=n(t?.hasMore??t?.data?.length===be),[y,P]=n(t?.total),C=u(()=>ze(t?.data),[t?.data]),R=Array.isArray(t?.data)?t.data.length:0,[N,G]=n(C),[M,k]=n(R);o(()=>{if(G(C),k(R),v(t?.hasMore??R===be),typeof t?.total==="number")P(t.total)},[C,R,t?.hasMore,t?.total]);let x=a(async()=>{if(p||!g)return;h(!0);try{let w=new FormData;if(w.set("actionType",c?"graph":"history"),w.set("limit",String(be)),w.set("skip",String(M)),l)w.set("root",l);if(r)w.set("repo",r);let F=await(await fetch("/api/fs/git",{method:"POST",body:w})).json();if(F.success&&Array.isArray(F.data)){let H=ze(F.data),A=F.data.length;if(G((z)=>{let E=new Set(z.map((ne)=>ne.hash)),X=H.filter((ne)=>!E.has(ne.hash));return[...z,...X]}),k((z)=>z+A),v(Boolean(F.hasMore??A===be)),typeof F.total==="number")P(F.total)}else v(!1)}catch(w){console.error("Failed to load more commits:",w)}finally{h(!1)}},[p,g,c,M,l,r]);return{commits:N,hasMore:g,totalCount:y,isLoadingMore:p,handleLoadMore:x}}function ut({onExecuteAction:t,rootPath:c,activeRepo:l}){let[r,p]=n({}),[h,g]=n(new Set),[v,y]=n(new Set),[P,C]=n(new Set),R=a(async(k,x,w)=>{let T=`${k}:${x.file}`;y((F)=>new Set(F).add(T));try{let F=new FormData;if(F.set("actionType","commit_diff"),F.set("hash",k),F.set("file",x.file),w)F.set("full","1");if(c)F.set("root",c);if(l&&l!==".")F.set("repo",l);let A=await(await fetch("/api/fs/git",{method:"POST",body:F})).json();if(A&&typeof A.diff==="string")p((z)=>({...z,[T]:A.diff}));else if(A&&A.error)p((z)=>({...z,[T]:`// Error: ${A.error}`}))}catch(F){console.error("Failed to load file diff:",F);let H=F instanceof Error?F.message:"Network error";p((A)=>({...A,[T]:`// Error loading diff: ${H}`}))}finally{y((F)=>{let H=new Set(F);return H.delete(T),H})}},[c,l]),N=a(async(k,x)=>{let w=`${k}:${x.file}`,T=!h.has(w);if(g((F)=>{let H=new Set(F);if(H.has(w))H.delete(w);else H.add(w);return H}),T&&r[w]===void 0&&!x.diff)await R(k,x,!1)},[h,r,R]),G=a(async(k,x)=>{let w=`${k}:${x.file}`,T=!P.has(w);C((F)=>{let H=new Set(F);if(H.has(w))H.delete(w);else H.add(w);return H}),await R(k,x,T)},[P,R]),M=a((k,x)=>{if(!t)return;if(k==="checkout")t("checkout",void 0,{branch:x.hash});else if(k==="create_branch_here"){let w=window.prompt(`Create new branch at commit ${x.shortHash}:`,`branch-${x.shortHash}`);if(w?.trim())t("create_branch_at",void 0,{branch:w.trim(),hash:x.hash})}else if(k==="cherry_pick"){if(window.confirm(`Cherry-pick commit ${x.shortHash} onto current branch?`))t("cherry_pick",void 0,{hash:x.hash})}else if(k==="revert"){if(window.confirm(`Revert commit ${x.shortHash}?`))t("revert_commit",void 0,{hash:x.hash})}else if(k==="reset"){let w=window.prompt(`Reset current branch to ${x.shortHash} (soft, mixed, hard):`,"soft");if(w&&["soft","mixed","hard"].includes(w.toLowerCase()))t("reset_commit",void 0,{hash:x.hash,mode:w.toLowerCase()})}else if(k==="merge"){if(window.confirm(`Merge commit ${x.shortHash} into current branch?`))t("merge_commit",void 0,{hash:x.hash})}else if(k==="rebase"){if(window.confirm(`Rebase current branch onto commit ${x.shortHash}?`))t("rebase_commit",void 0,{hash:x.hash})}},[t]);return{fileDiffs:r,expandedFiles:h,loadingFiles:v,fullContextFiles:P,handleToggleFile:N,handleToggleContext:G,handleCommitAction:M}}function Oe({output:t,onClose:c,onRefresh:l,onExecuteAction:r,rootPath:p,activeRepo:h}){if(o(()=>{if(!t)return;let j=(I)=>{if(I.key==="Escape")c()};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[t,c]),!t)return null;let[g,v]=n(()=>({title:t.title,graph:t.title.toLowerCase().includes("graph")}));if(g.title!==t.title)v({title:t.title,graph:t.title.toLowerCase().includes("graph")});let y=g.graph,P=(j)=>v((I)=>({...I,graph:j})),[C,R]=n(""),[N,G]=n(""),[M,k]=n(!1),{commits:x,hasMore:w,totalCount:T,isLoadingMore:F,handleLoadMore:H}=mt({output:t,isGraphMode:y,rootPath:p,activeRepo:h}),{fileDiffs:A,expandedFiles:z,loadingFiles:E,fullContextFiles:X,handleToggleFile:ne,handleToggleContext:U,handleCommitAction:V}=ut({onExecuteAction:r,rootPath:p,activeRepo:h});o(()=>{if(x.length>0&&!N)G(x[0].hash)},[x,N]);let q=u(()=>{if(!C.trim())return x;let j=C.toLowerCase().trim();return x.filter((I)=>I.message.toLowerCase().includes(j)||I.author.toLowerCase().includes(j)||I.shortHash.toLowerCase().includes(j)||I.hash.toLowerCase().includes(j)||I.refs?.some((te)=>te.toLowerCase().includes(j)))},[x,C]),oe=i(null),ae=i(null),ve=i(null),de=i({}),[me,ye]=n({}),[Pe,$e]=n(800);o(()=>{let j=ve.current;if(!j||!w||F||C.trim())return;let I=new IntersectionObserver((te)=>{if(te[0].isIntersecting)H()},{root:oe.current,threshold:0.1});return I.observe(j),()=>I.disconnect()},[w,F,C,H]);let le=a(()=>{if(!oe.current||!ae.current)return;let j=oe.current.getBoundingClientRect(),I=oe.current.scrollTop,te={};q.forEach((ue,Te)=>{let xe=de.current[ue.hash];if(xe){let se=xe.getBoundingClientRect();te[ue.hash]=se.top+se.height/2-j.top+I}else te[ue.hash]=Te*60+20}),ye(te);let we=ae.current.offsetHeight;$e(Math.max(we,oe.current.clientHeight,600))},[q]);W(()=>{le();let j=requestAnimationFrame(()=>{le()});return()=>cancelAnimationFrame(j)},[le,q,A,z,y,N]),o(()=>{let j=ae.current;if(!j)return;let I=new ResizeObserver(()=>{le()});I.observe(j);for(let te of Array.from(j.children))I.observe(te);return()=>I.disconnect()},[le,q]);let Q=u(()=>Ge(q),[q]),Me=u(()=>{let j=0;return Q.forEach((I)=>{if(I>j)j=I}),j},[Q]),ke=18,Ne=16,Ae=y?(Me+1)*ke+Ne*2:36,Le=()=>{k(!0),l?.(),setTimeout(()=>k(!1),600)};return e("div",{className:"fixed inset-0 z-50 modal-scrim backdrop-blur-xs flex items-center justify-center p-0 lg:p-5",onClick:c,role:"dialog","aria-modal":"true","aria-label":t.title,children:e("div",{className:`glass-overlay bg-paper border-ink/20 shadow-2xl flex flex-col overflow-hidden
|
|
4
|
-
w-full h-full rounded-none border-0
|
|
5
|
-
lg:w-[min(94vw,1200px)] lg:h-[88vh] lg:rounded-xl lg:border
|
|
6
|
-
pt-[env(safe-area-inset-top,0px)] lg:pt-0`,onClick:(j)=>j.stopPropagation(),children:[e(et,{isGraphMode:y,onToggleMode:P,searchQuery:C,onSearchChange:R,onRefresh:Le,onClose:c,isRefreshing:M,totalCommits:q.length,loadedCount:x.length,totalCount:T,hasMore:w}),e("div",{ref:oe,className:`flex-1 overflow-y-auto scrollbar-overlay-container relative select-text
|
|
7
|
-
px-3 lg:px-5
|
|
8
|
-
pl-[max(0.75rem,env(safe-area-inset-left,0px))] pr-[max(0.75rem,env(safe-area-inset-right,0px))]`,children:q.length===0?e("div",{className:"flex flex-col items-center justify-center py-20 text-muted font-mono text-xs",children:C.trim()?"No matching commits found.":"No commits in this branch."}):e("div",{className:"relative min-h-full pb-8",children:[e(st,{commits:q,nodePositions:me,selectedHash:N,isGraphMode:y,laneWidth:ke,paddingLeft:Ne,totalHeight:Pe}),e("div",{ref:ae,className:"flex flex-col relative z-20",style:{paddingLeft:`${Ae}px`},children:[q.map((j)=>e(pt,{commit:j,isSelected:N===j.hash,onSelect:(I)=>G(I.hash),onAction:V,onToggleFile:ne,isExpandedFile:(I,te)=>z.has(`${I}:${te}`),isLoadingFile:(I,te)=>E.has(`${I}:${te}`),isFullContextFile:(I,te)=>X.has(`${I}:${te}`),onToggleContext:U,fileDiffs:A,headerRef:(I)=>{de.current[j.hash]=I}},j.hash)),e("div",{ref:ve,className:"pt-3 pb-4 px-4 flex items-center justify-center",children:F?e("div",{className:"flex items-center gap-2 text-xs text-muted font-mono py-2",children:[e(m,{size:14,className:"animate-spin text-info-text","aria-hidden":"true"}),e("span",{children:"Loading more commits..."})]}):w&&!C.trim()?e("button",{type:"button",onClick:H,className:"px-3 py-1.5 text-xs font-mono text-ink/70 hover:text-ink bg-ink/5 hover:bg-ink/10 rounded-md border border-ink/10 transition-colors cursor-pointer",children:"Load more commits..."}):q.length>10?e("div",{className:"text-[11px] font-mono text-muted py-2",children:["End of commit history (",typeof T==="number"&&T>0?T:x.length," commits)"]}):null})]})]})})]})})}function ft({children:t,onClose:c}){return e("div",{className:"fixed inset-0 z-50 modal-scrim flex items-center justify-center p-4",onClick:c,role:"dialog","aria-modal":"true",children:e("div",{className:"glass-overlay bg-paper border border-ink/20 rounded-lg shadow-xl flex flex-col overflow-hidden w-[min(94vw,420px)] max-h-[80vh]",onClick:(l)=>l.stopPropagation(),children:t})})}function gt({modal:t,onClose:c,onConfirm:l}){if(!t)return null;return e(ft,{onClose:c,children:[e("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-ink/10",children:[e(_,{size:16,className:"text-error flex-shrink-0"}),e("h3",{className:"text-sm font-semibold text-ink",children:"Confirm Action"})]}),e("div",{className:"px-4 py-4 text-xs text-ink/80 leading-relaxed",children:t.message}),e("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-ink/10",children:[e("button",{type:"button",onClick:c,className:"px-3 py-1.5 rounded border border-ink/20 text-ink/70 hover:bg-ink/5 hover:text-ink transition-colors cursor-pointer text-xs",children:"Cancel"}),e("button",{type:"button",onClick:l,className:"px-3 py-1.5 rounded bg-error text-canvas hover:bg-error/90 transition-colors cursor-pointer text-xs font-medium",children:"Confirm"})]})]})}function xt({isOpen:t,branchName:c,inputRef:l,onChange:r,onClose:p,onCreate:h}){if(!t)return null;let g=a(()=>{if(c.trim())h()},[c,h]);return e(ft,{onClose:p,children:[e("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-ink/10",children:[e(Ln,{size:16,className:"text-ink/60 flex-shrink-0"}),e("h3",{className:"text-sm font-semibold text-ink",children:"Create New Branch"})]}),e("div",{className:"px-4 py-4",children:e("input",{ref:l,type:"text",value:c,onChange:(v)=>r(v.currentTarget.value),onKeyDown:(v)=>{if(v.key==="Enter")g();if(v.key==="Escape")p()},placeholder:"branch-name",className:"w-full bg-canvas border border-ink/20 rounded px-3 py-2 text-xs focus:outline-none focus:border-ink/40 text-ink placeholder-ink/40 transition-colors"})}),e("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-ink/10",children:[e("button",{type:"button",onClick:p,className:"px-3 py-1.5 rounded border border-ink/20 text-ink/70 hover:bg-ink/5 hover:text-ink transition-colors cursor-pointer text-xs",children:"Cancel"}),e("button",{type:"button",onClick:g,disabled:!c.trim(),className:"px-3 py-1.5 rounded bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:"Create"})]})]})}function vt({branch:t,detached:c,onCheckout:l,onMerge:r,onRename:p,onDelete:h}){let g=t.current&&!c;return e("div",{className:"grid grid-cols-[1rem_minmax(0,1fr)_minmax(0,9.5rem)_4.25rem_4rem] items-start gap-x-2 px-4 py-2 border-b border-ink/5 last:border-b-0 hover:bg-ink/[0.02] group/row transition-colors",children:[e("div",{className:"h-5 flex items-center justify-center",children:g&&e(f,{size:12,className:"text-ink","aria-label":"Current branch"})}),e("button",{type:"button",onClick:l,disabled:g,title:g?"Already on this branch":`Check out ${t.name}`,className:"min-w-0 text-left cursor-pointer disabled:cursor-default",children:[e("div",{className:"h-5 flex items-center gap-1.5 min-w-0",children:[e(ge,{size:11,className:g?"text-ink/60 flex-shrink-0":"text-ink/40 flex-shrink-0"}),e("span",{className:`truncate text-xs ${g?"font-semibold text-ink":"text-ink/90"}`,children:t.name})]}),t.subject&&e("div",{className:"h-4 flex items-center pl-[18px] min-w-0",children:e("span",{className:"truncate text-[10px] text-ink/40",title:t.subject,children:t.subject})})]}),e("div",{className:"h-5 flex items-center justify-end min-w-0",children:e(It,{branch:t})}),e("div",{className:"h-5 flex items-center justify-end",children:t.date&&e("span",{className:"text-[10px] text-ink/40 truncate",children:t.date})}),e("div",{className:"h-5 flex items-center justify-end gap-0.5 touch-visible opacity-0 group-hover/row:opacity-100",children:[!g&&e("button",{type:"button",onClick:r,title:`Merge ${t.name} into the current branch`,"aria-label":`Merge ${t.name} into the current branch`,className:"w-5 h-5 flex items-center justify-center rounded text-ink/40 hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Ln,{size:11})}),e("button",{type:"button",onClick:p,title:`Rename ${t.name}`,"aria-label":`Rename ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded text-ink/40 hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors",children:e(Mn,{size:11})}),!g&&e("button",{type:"button",onClick:h,title:`Delete ${t.name}`,"aria-label":`Delete ${t.name}`,className:"w-5 h-5 flex items-center justify-center rounded text-ink/40 hover:text-error hover:bg-error/10 cursor-pointer transition-colors",children:e(L,{size:11})})]})]})}function It({branch:t}){if(t.gone)return e("span",{className:"text-[10px] font-mono text-warning border border-warning/30 rounded px-1 truncate",title:`${t.upstream} no longer exists on the remote — fetch --prune to drop it`,children:"gone"});if(!t.upstream)return e("span",{className:"text-[10px] font-mono text-ink/40 truncate",title:"No upstream: this branch has never been published",children:"unpublished"});return e("span",{className:"flex items-center gap-1 text-[10px] font-mono text-ink/50 min-w-0",children:[e("span",{className:"truncate",title:t.upstream,children:t.upstream}),(t.ahead>0||t.behind>0)&&e("span",{className:"tabular-nums text-ink/70 flex-shrink-0",children:[t.ahead>0&&`↑${t.ahead}`,t.behind>0&&`↓${t.behind}`]})]})}function yt({branch:t,onClose:c,onSubmit:l}){if(!t)return null;return e(_t,{branch:t,onClose:c,onSubmit:l})}function _t({branch:t,onClose:c,onSubmit:l}){let[r,p]=n(t.name),[h,g]=n(!1),v=r.trim(),y=v===t.name,P=v.length>0&&!y,C=()=>{if(P)l(t.name,v,h)};return e(Z,{onClose:c,maxWidthClass:"max-w-[min(94vw,460px)]",header:e("div",{className:"flex items-center gap-2",children:[e("h2",{className:"text-sm font-semibold text-ink",children:"Rename branch"}),e("span",{className:"text-[10px] font-mono text-ink/50 truncate",children:t.name})]}),children:[e("div",{className:"px-5 py-4 flex flex-col gap-3",children:[e("div",{children:[e("label",{className:"text-[10px] uppercase tracking-wider text-ink/50 font-semibold",htmlFor:"branch-rename-input",children:"New name"}),e("input",{id:"branch-rename-input",type:"text",value:r,autoFocus:!0,onChange:(R)=>p(R.currentTarget.value),onKeyDown:(R)=>{if(R.key==="Enter")C();if(R.key==="Escape")c()},className:"mt-1 w-full bg-paper border border-ink/20 rounded px-2.5 py-1.5 text-xs font-mono text-ink focus:outline-none focus:border-ink/40 transition-colors"}),y&&v.length>0&&e("p",{className:"mt-1 text-[10px] text-ink/50",children:"The name is unchanged."})]}),e("div",{className:"text-[10px] font-mono text-ink/60 flex flex-col gap-0.5 border border-ink/10 rounded p-2 bg-canvas/40",children:[e("div",{className:"flex items-center justify-between gap-2",children:[e("span",{className:"text-ink/40",children:"upstream"}),e("span",{className:"truncate",children:t.upstream||"none (unpublished)"})]}),e("p",{className:"text-ink/40 leading-relaxed mt-0.5",children:"A local rename keeps this upstream unchanged — a plain push afterwards will refuse until the upstream matches the new name, which is what the remote option below does."})]}),e("label",{className:"flex items-start gap-2 text-[11px] text-ink/80 cursor-pointer select-none",children:[e("input",{type:"checkbox",checked:h,onChange:(R)=>g(R.currentTarget.checked),className:`${he} accent-ink cursor-pointer mt-0.5`}),e("span",{className:"flex flex-col gap-0.5",children:[e("span",{children:"Also rename it on the remote"}),e("span",{className:"text-[10px] font-mono text-ink/50",children:["git push -u ",t.upstream?t.upstream.split("/")[0]:"origin"," ",v||"<new>",e("br",{}),"git push ",t.upstream?t.upstream.split("/")[0]:"origin"," --delete ",t.name,e("br",{}),"git fetch --prune"]})]})]})]}),e("div",{className:"flex items-center justify-end gap-2 px-5 py-3 border-t border-ink/10",children:[e("button",{type:"button",onClick:c,className:"px-3 py-1.5 rounded border border-ink/20 text-ink/70 hover:bg-ink/5 hover:text-ink transition-colors cursor-pointer text-xs",children:"Cancel"}),e("button",{type:"button",onClick:C,disabled:!P,className:"px-3 py-1.5 rounded bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:"Rename"})]})]})}function kt({branch:t,force:c,onForceChange:l,onClose:r,onConfirm:p}){if(!t)return null;return e(Z,{onClose:r,maxWidthClass:"max-w-[min(94vw,440px)]",header:e("div",{className:"flex items-center gap-2",children:[e(_,{size:15,className:"text-error flex-shrink-0"}),e("h2",{className:"text-sm font-semibold text-ink",children:"Delete branch"})]}),children:[e("div",{className:"px-5 py-4 flex flex-col gap-3 text-xs text-ink/80 leading-relaxed",children:[e("p",{children:["Delete ",e("span",{className:"font-mono font-semibold text-ink",children:t.name}),t.upstream&&e(d,{children:[" ","(tracks ",e("span",{className:"font-mono",children:t.upstream}),")"]}),"?"]}),e("div",{className:"text-[10px] font-mono text-ink/60 border border-ink/10 rounded p-2 bg-canvas/40 flex flex-col gap-0.5",children:[e("div",{className:"flex items-center justify-between gap-2",children:[e("span",{className:"text-ink/40",children:"last commit"}),e("span",{className:"truncate",children:t.subject||"–"})]}),e("div",{className:"flex items-center justify-between gap-2",children:[e("span",{className:"text-ink/40",children:"when"}),e("span",{children:t.date||"–"})]})]}),e("label",{className:"flex items-start gap-2 cursor-pointer select-none text-[11px]",children:[e("input",{type:"checkbox",checked:c,onChange:(h)=>l(h.currentTarget.checked),className:`${he} accent-error cursor-pointer mt-0.5`}),e("span",{className:"flex flex-col gap-0.5",children:[e("span",{className:"text-error font-medium",children:"Delete even if its commits are not merged"}),e("span",{className:"text-[10px] font-mono text-ink/50",children:["git branch ",c?"-D":"-d"," ",t.name]}),e("span",{className:"text-ink/50",children:"Without this, git refuses when the branch holds commits no other branch has. Leaving it off is the safe default."})]})]})]}),e("div",{className:"flex items-center justify-end gap-2 px-5 py-3 border-t border-ink/10",children:[e("button",{type:"button",onClick:r,className:"px-3 py-1.5 rounded border border-ink/20 text-ink/70 hover:bg-ink/5 hover:text-ink transition-colors cursor-pointer text-xs",children:"Cancel"}),e("button",{type:"button",onClick:()=>p(t.name),className:"px-3 py-1.5 rounded bg-error text-canvas hover:bg-error/90 transition-colors cursor-pointer text-xs font-medium",children:["Delete ",c?"(force)":""]})]})]})}function Ct({isOpen:t,rootPath:c,repo:l,currentBranch:r,detached:p,isBusy:h,onClose:g,onAction:v,onConfirmDelete:y}){let[P,C]=n([]),[R,N]=n(!1),[G,M]=n(null),[k,x]=n(""),[w,T]=n(null),[F,H]=n(null),[A,z]=n(!1),E=a(async()=>{N(!0),M(null);let U=new URLSearchParams({branches:"1",repo:l||"."});if(c)U.set("root",c);try{let V=await fetch(`/api/fs/git?${U.toString()}`),q=await V.json();if(q.success&&Array.isArray(q.branches))C(q.branches);else M(q.error||`Failed to read branches (HTTP ${V.status})`)}catch(V){M(V instanceof Error?V.message:"Failed to read branches")}finally{N(!1)}},[c,l]);o(()=>{if(t)E()},[t,E]);let X=i(!1);o(()=>{if(!t){X.current=!1;return}if(X.current&&!h)E();X.current=h},[t,h,E]),o(()=>{if(!t)T(null),H(null),z(!1),x("")},[t]);let ne=u(()=>{let U=k.trim().toLowerCase();if(!U)return P;return P.filter((V)=>V.name.toLowerCase().includes(U)||V.upstream.toLowerCase().includes(U))},[P,k]);if(!t)return null;return e(d,{children:[e(Z,{onClose:g,maxWidthClass:"max-w-[min(96vw,720px)]",header:e("div",{className:"flex items-center gap-2 min-w-0",children:[e("h2",{className:"text-sm font-semibold text-ink",children:"Branches"}),e("span",{className:"text-[10px] font-mono text-ink/50",children:p?`detached at ${r}`:`on ${r}`})]}),children:[e("div",{className:"px-5 py-3 flex items-center gap-2 border-b border-ink/10",children:[e(O,{size:12,className:"text-ink/40 flex-shrink-0"}),e("input",{type:"text",value:k,onChange:(U)=>x(U.currentTarget.value),placeholder:"Filter branches…","aria-label":"Filter branches",className:"flex-1 min-w-0 bg-transparent outline-none text-xs text-ink placeholder-ink/40",autoFocus:!0}),e("button",{type:"button",onClick:()=>void E(),disabled:R,title:"Refresh","aria-label":"Refresh branches",className:"text-ink/40 hover:text-ink transition-colors cursor-pointer disabled:opacity-40 flex-shrink-0",children:e(D,{size:12,className:R?"animate-spin":""})})]}),e("div",{className:"min-h-[40vh] max-h-[60vh] overflow-y-auto scrollbar-overlay-container",children:R&&P.length===0?e("div",{className:"flex items-center justify-center gap-2 py-12 text-xs text-ink/50 font-mono",children:[e(m,{size:14,className:"animate-spin text-info"}),"Loading branches…"]}):G?e("div",{className:"py-12 px-6 text-center text-xs text-error font-mono",children:G}):ne.length===0?e("div",{className:"py-12 text-center text-xs text-ink/40 font-mono",children:k.trim()?"No matching branches.":"No branches."}):ne.map((U)=>e(vt,{branch:U,detached:p,onCheckout:()=>{v("checkout",{branch:U.name}),g()},onMerge:()=>{v("merge_branch",{branch:U.name}),g()},onRename:()=>T(U),onDelete:()=>{H(U),z(!1)}},U.name))})]}),e(yt,{branch:w,onClose:()=>T(null),onSubmit:(U,V,q)=>{v("rename_branch",{branch:U,newName:V,...q?{remote:"1"}:{}}),T(null)}},w?.name??"none"),e(kt,{branch:F,force:A,onForceChange:z,onClose:()=>{H(null),z(!1)},onConfirm:(U)=>{y(U,A),H(null),z(!1)}})]})}function Nt({mounted:t,confirmModal:c,onCloseConfirm:l,onConfirm:r,branchPrompt:p,newBranchName:h,newBranchInputRef:g,onNewBranchNameChange:v,onCloseBranchPrompt:y,onCreateBranch:P,viewingOutput:C,onCloseOutput:R,onRefreshOutput:N,onExecuteAction:G,branchModalOpen:M,onCloseBranchModal:k,rootPath:x,activeRepo:w,currentBranch:T,detached:F,isBusy:H,onBranchAction:A,onConfirmDeleteBranch:z}){if(!t)return null;return e(d,{children:[e(gt,{modal:c,onClose:l,onConfirm:r}),e(xt,{isOpen:p,branchName:h,inputRef:g,onChange:v,onClose:y,onCreate:P}),e(Oe,{output:C,onClose:R,onRefresh:N,onExecuteAction:G,rootPath:x,activeRepo:w}),e(Ct,{isOpen:M,rootPath:x,repo:w,currentBranch:T,detached:F,isBusy:H,onClose:k,onAction:A,onConfirmDelete:z})]})}function wt({rootPath:t,repo:c,isBusy:l,onAction:r}){let[p,h]=S("git.stashExpanded",!1),[g,v]=n([]),[y,P]=n(!1),[C,R]=n(""),[N,G]=n(!1),M=yr(),k=a(async()=>{P(!0);let w=new URLSearchParams({stashes:"1",repo:c||"."});if(t)w.set("root",t);try{let F=await(await fetch(`/api/fs/git?${w.toString()}`)).json();v(F.stashes??[])}catch{v([])}finally{P(!1)}},[t,c]);o(()=>{if(p)k()},[p,k,l]);let x=(w,T)=>{if(r(w,T),w==="stash_push")R(""),G(!1)};return e("div",{className:"border-t border-ink/10 bg-canvas/30 flex-shrink-0",children:[e("div",{className:"flex items-center hover:bg-ink/5 transition-colors",children:[e("button",{type:"button",onClick:()=>h(!p),"aria-expanded":p,"aria-controls":M,title:p?"Hide stashes":"Show stashes",className:"flex flex-1 min-w-0 items-center space-x-1 py-1.5 pl-3 pr-2 text-left font-semibold text-xs text-ink transition-colors cursor-pointer",children:[e("span",{className:"w-3 text-center font-mono","aria-hidden":"true",children:p?"▾":"▸"}),e(tt,{size:12}),e("span",{children:"Stash"}),g.length>0&&e("span",{className:"font-normal ml-1 border border-ink/20 rounded-full px-1.5 text-[10px] text-ink/50",children:g.length})]}),e("button",{type:"button",onClick:()=>x("stash_push",{...C.trim()?{message:C.trim()}:{},...N?{untracked:"1"}:{}}),disabled:l,title:"Stash the working tree",className:"mr-3 flex flex-shrink-0 items-center gap-1 px-2 py-0.5 text-[10px] font-mono rounded border border-ink/20 hover:bg-ink/5 text-ink/70 hover:text-ink transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",children:[e(Y,{size:10}),"Save"]})]}),e("div",{className:"section-reveal","data-expanded":p,id:M,inert:!p,children:e("div",{children:e("div",{className:"px-3 pb-2 flex flex-col gap-1.5",children:[e("div",{className:"flex items-center gap-1.5",children:[e("input",{type:"text",value:C,onChange:(w)=>R(w.currentTarget.value),placeholder:"Stash message (optional)","aria-label":"Stash message",className:"flex-1 min-w-0 bg-paper border border-ink/20 rounded px-2 py-1 text-[11px] text-ink placeholder-ink/40 focus:outline-none focus:border-ink/40 transition-colors font-mono"}),e("label",{className:"flex items-center gap-1 text-[10px] text-ink/60 cursor-pointer select-none flex-shrink-0",title:"Also stash untracked files (-u)",children:[e("input",{type:"checkbox",checked:N,onChange:(w)=>G(w.currentTarget.checked),className:`${he} accent-ink cursor-pointer`}),"-u"]})]}),y&&g.length===0?e("div",{className:"text-[10px] text-ink/40 italic py-1",children:"Loading…"}):g.length===0?e("div",{className:"text-[10px] text-ink/40 italic py-1",children:"No stash entries."}):e("div",{className:"max-h-40 overflow-y-auto scrollbar-overlay-container flex flex-col",children:g.map((w)=>e("div",{className:"grid grid-cols-[4rem_minmax(0,1fr)_3.5rem_4.5rem] items-center gap-x-1 group/stash py-0.5",children:[e("span",{className:"text-[10px] font-mono text-ink/50 truncate",children:w.ref}),e("span",{className:"min-w-0 truncate text-[10px] text-ink/80",title:w.subject,children:w.subject}),e("span",{className:"text-[10px] text-ink/40 text-right truncate",children:w.date}),e("div",{className:"flex items-center justify-end gap-0.5 touch-visible opacity-0 group-hover/stash:opacity-100",children:[e("button",{type:"button",onClick:()=>x("stash_apply",{ref:w.ref,pop:"1"}),disabled:l,title:"Pop: apply and remove the entry","aria-label":"Pop stash",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors disabled:opacity-40",children:e(fe,{size:10})}),e("button",{type:"button",onClick:()=>x("stash_apply",{ref:w.ref}),disabled:l,title:"Apply: keep the entry","aria-label":"Apply stash",className:"w-5 h-5 flex items-center justify-center rounded hover:text-ink hover:bg-ink/10 cursor-pointer transition-colors disabled:opacity-40",children:e(tt,{size:10})}),e("button",{type:"button",onClick:()=>x("stash_drop",{ref:w.ref}),disabled:l,title:"Drop: discard the entry (the stash is not recoverable from the panel)","aria-label":"Drop stash",className:"w-5 h-5 flex items-center justify-center rounded hover:text-error hover:bg-error/10 cursor-pointer transition-colors disabled:opacity-40",children:e(L,{size:10})})]})]},w.ref))})]})})})]})}function Rt({repo:t,isBusy:c,onInit:l}){let r=t==="."?"this folder":t;return e("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 px-6 text-center",children:[e(ge,{size:26,className:"text-ink/25","aria-hidden":!0}),e("div",{className:"font-mono space-y-1",children:[e("p",{className:"text-xs text-ink/70",children:"Not a Git repository"}),e("p",{className:"text-[11px] leading-4 text-ink/40",children:["Initialize one in ",r," to track changes, commit and manage branches."]})]}),e("button",{type:"button",onClick:l,disabled:c,"aria-label":"Initialize Git repository",title:`git init in ${r}`,className:"flex items-center justify-center gap-1.5 px-3 py-1.5 rounded bg-ink text-canvas hover:bg-ink/90 transition-colors cursor-pointer text-xs font-medium disabled:opacity-40 disabled:cursor-not-allowed",children:[e(ge,{size:12,"aria-hidden":!0}),"Initialize repository"]})]})}function Gt(t,c,l){let r=ct(),{activeRepo:p,setActiveRepo:h,ready:g}=cr(t),{repos:v,scanning:y,rescan:P}=ur(t,c),C=ng(p,v),R=i(C);R.current=C;let N=i("");N.current=`${t??""}\x00${C}`;let G=i(""),M=i(""),k=i(void 0);if(r.data!==k.current)k.current=r.data,M.current=G.current;let x=c&&g?Rp(`${t??""}\x00${C}`):null,w=Ce(x),T=i(w.refresh);T.current=w.refresh;let F=M.current===N.current?r.data:void 0,H=w.data??F,A=H?.syncCount??F?.syncCount,z=a((ne)=>{if(!c)return;let U=ne??R.current,V=new URLSearchParams;if(t)V.set("root",t);if(U&&U!==".")V.set("repo",U);V.set("sync","1"),V.set("t",String(Date.now())),G.current=N.current;let q=T.current;r.load(`/api/fs/git?${V.toString()}`).then(()=>q())},[c,t,r.load]);o(()=>{if(!g)return;z()},[l,t,c,g,C,z]);let E=r.state==="loading",X=E||w.refreshing;return{activeRepo:C,setActiveRepo:h,repos:v,reposScanning:y,refreshRepos:P,isReading:E,isRefreshing:X,data:H,syncCount:A,loadRepo:z,refreshTopic:w.refresh}}function St(t,c){let l=ct(),r=i(null),p=a((h,g,v)=>{r.current={actionType:h,extra:v};let y=new FormData;if(y.append("actionType",h),y.append("repo",c),t)y.append("root",t);if(g)y.append("file",g);if(v)Object.entries(v).forEach(([P,C])=>y.append(P,C));l.submit(y,{method:"POST",action:"/api/fs/git"})},[c,t,l]);return{state:l.state,execute:p,data:l.data,lastAction:r.current}}function Pt({rootPath:t,repo:c,execute:l}){let{sessionId:r}=Lp(),[p,h]=S("git.commitDraft",""),[g,v]=S("git.amend",!1),y=i(null),P=i(p);P.current=p;let C=i(g);C.current=g;let R=i(h);R.current=h,o(()=>{if(!g)return;if(P.current.trim().length>0)return;let M=new URLSearchParams({headMessage:"1"});if(t)M.set("root",t);if(c&&c!==".")M.set("repo",c);let k=!1;return fetch(`/api/fs/git?${M.toString()}`).then((x)=>x.json()).then((x)=>{if(k)return;if(!C.current||P.current.trim().length>0)return;let w=typeof x?.message==="string"?x.message:"";if(w.length===0)return;y.current=w,R.current(w)}).catch(()=>{}),()=>{k=!0}},[g,r,t,c]);let N=a((M)=>{if(M){v(!0);return}if(y.current!==null&&P.current===y.current)h("");y.current=null,v(!1)},[v,h]),G=a(()=>{l("commit",void 0,{message:P.current,...C.current?{amend:"1"}:{}}),h(""),v(!1),y.current=null},[l,v,h]);return{message:p,setMessage:h,amend:g,seeded:y.current!==null&&p===y.current,toggleAmend:N,commit:G}}var $t=48;function jt(t,c){let l=c?.branch?.trim()??"",r=(c?.hash??"").slice(0,7),p=c?.ref?.trim()||"stash@{0}";switch(t){case"init":return{done:"Initialized the repository"};case"fetch":return{done:"Fetched every remote"};case"push":return{done:"Pushed to upstream"};case"pull":return{done:"Pulled from upstream",stopped:"Pulled"};case"sync":return{done:"Synced with upstream",stopped:"Pulled, but nothing was pushed"};case"abort_operation":return{done:"Aborted the operation in progress"};case"continue_operation":return{done:"Concluded the operation"};case"commit":{if(c?.amend==="1")return{done:"Amended the last commit"};let h=(c?.message??"").split(`
|
|
9
|
-
`)[0].trim();if(!h)return{done:"Commit created"};return{done:`Committed “${h.length>$t?`${h.slice(0,$t-1)}…`:h}”`}}case"checkout":return{done:l?`Switched to ${l}`:"Switched branch"};case"create_branch":case"create_branch_at":return{done:l?`Created branch ${l}`:"Created branch"};case"rename_branch":{let h=c?.newName?.trim()??"";return{done:l&&h?`Renamed ${l} to ${h}`:"Renamed branch"}}case"delete_branch":return{done:l?`Deleted branch ${l}`:"Deleted branch"};case"merge_branch":return{done:l?`Merged ${l}`:"Merged branch",stopped:l?`Merging ${l}`:"Merging the branch"};case"merge_commit":return{done:r?`Merged commit ${r}`:"Merged commit",stopped:r?`Merging ${r}`:"Merging the commit"};case"cherry_pick":return{done:r?`Cherry-picked ${r}`:"Cherry-picked commit",stopped:r?`Cherry-picking ${r}`:"Cherry-picking the commit"};case"revert_commit":return{done:r?`Reverted commit ${r}`:"Reverted commit",stopped:r?`Reverting ${r}`:"Reverting the commit"};case"rebase_commit":return{done:r?`Rebased onto ${r}`:"Rebased",stopped:r?`Rebasing onto ${r}`:"Rebasing"};case"reset_commit":{let h=c?.mode??"mixed";return{done:r?`Reset to ${r} (${h})`:`Reset (${h})`}}case"stash_push":return{done:"Stashed your changes"};case"stash_apply":return{done:c?.pop==="1"?`Popped ${p}`:`Applied ${p}`,stopped:c?.pop==="1"?`Popping ${p}`:`Applying ${p}`};case"stash_drop":return{done:`Dropped ${p}`};default:return null}}function Mt({actionType:t,extra:c,stopped:l}){let r=jt(t,c);if(!l)return r?.done??null;let p=ho[l]??l,h=r?.stopped??r?.done??"",g=t==="sync"?"resolve it above, then Sync again":"resolve it above";return h?`${h} — the ${p} stopped on a conflict; ${g}`:`The ${p} stopped on a conflict; ${g}`}function At(t){let{fetcher:c,onPage:l,onReload:r,onSuccess:p,onError:h}=t,g=i(null),v=i({onPage:l,onReload:r,onSuccess:p,onError:h});v.current={onPage:l,onReload:r,onSuccess:p,onError:h},o(()=>{if(c.state!=="idle"||!c.data)return;let y=c.data;if(y===g.current)return;g.current=y;let P=v.current;if(y.type==="history"||y.type==="graph"){P.onPage({title:y.type==="graph"?"Git Graph":"Commit History",data:y.data||[],hasMore:y.hasMore,total:y.total});return}if(!y.success){P.onError(y.error||"Git operation failed");return}P.onReload();let C=c.lastAction,R=C?Mt({...C,stopped:y.stopped}):null;if(R)P.onSuccess(R,y.stopped?"warning":"success")},[c.state,c.data,c.lastAction])}function Lt(t,c,l,r){if(t==="revert")return{type:t,file:c,message:`Are you sure you want to discard changes in ${c}?`};if(t==="revert_all")return{type:t,message:"Are you sure you want to discard ALL unstaged changes? This cannot be undone."};if(t==="abort_operation"){let p=r?ho[r]:"operation";return{type:t,message:`Abort the ${p}? Everything resolved so far is discarded and the working tree returns to its pre-${p} state.`}}if(t==="delete_branch"){let p=l?.branch??"",h=l?.force==="1";return{type:t,extra:{branch:p,...h?{force:"1"}:{}},message:h?`Delete branch ${p} even though its commits are not merged? This cannot be undone from the panel.`:`Delete branch ${p}?`}}if(t==="stash_drop"){let p=l?.ref||"the top entry";return{type:t,extra:{ref:l?.ref??""},message:`Drop ${p}? The stash entry is removed — this cannot be undone from the panel.`}}return null}function hs({className:t="",enabled:c=!0,rootPath:l,refreshKey:r=0}){let{activeRepo:p,setActiveRepo:h,repos:g,reposScanning:v,refreshRepos:y,isReading:P,isRefreshing:C,data:R,syncCount:N,loadRepo:G,refreshTopic:M}=Gt(l,c,r),k=St(l,p),[x,w]=S("git.viewMode","flat"),[T,F]=n(!1),H=i(null),[A,z]=n(!1),E=i(null),[X,ne]=n(null),[U,V]=n(!1),[q,oe]=n(""),ae=i(null),[ve,de]=n(!1),[me,ye]=n(null),[Pe,$e]=n(!1),{pushToast:le}=je();o(()=>{$e(!0)},[]),o(()=>{if(U&&ae.current)ae.current.focus()},[U]),At({fetcher:k,onPage:ye,onReload:G,onSuccess:(K,ee)=>le(K,ee),onError:(K)=>le(K,"error")}),pe(H,()=>F(!1)),pe(E,()=>z(!1));let Q=k.execute,{message:Me,setMessage:ke,amend:Ne,seeded:Ae,toggleAmend:Le,commit:j}=Pt({rootPath:l,repo:p,execute:Q}),I=(K,ee,Re)=>{let _e=Lt(K,ee,Re,R?.state?.operation??null);if(_e){ne(_e);return}Q(K,ee,Re)},te=(K,ee)=>{Q("resolve_conflict",K,ee?{side:ee}:void 0)},we=R?.branch||"main",ue=R?.branches||["main"],Te=R?.remoteBranches||[],xe=R?.changes||[],se=P||k.state!=="idle",De=k.state==="idle"?null:k.lastAction?.actionType??null,Tt=De==="sync"||De==="push"||De==="pull",Dt=xe.filter((K)=>{if(vr(K.status))return!1;let ee=K.status;return ee&&ee[0]!==" "&&ee[0]!=="?"});if(!c)return e("div",{className:`flex flex-col h-full bg-paper items-center justify-center text-ink/40 ${t}`,children:e("span",{className:"text-xs font-mono text-muted",children:"No session selected"})});return e("div",{className:`flex flex-col h-full bg-paper relative ${t}`,children:[e(Nt,{mounted:Pe,confirmModal:X,onCloseConfirm:()=>ne(null),onConfirm:()=>{if(X)Q(X.type,X.file,X.extra),ne(null)},branchPrompt:U,newBranchName:q,newBranchInputRef:ae,onNewBranchNameChange:oe,onCloseBranchPrompt:()=>{V(!1),oe("")},onCreateBranch:()=>{if(q.trim())Q("create_branch",void 0,{branch:q.trim()}),V(!1),oe("")},viewingOutput:me,onCloseOutput:()=>ye(null),onRefreshOutput:()=>{if(me)Q(me.title.toLowerCase().includes("graph")?"graph":"history")},onExecuteAction:(K,ee,Re)=>Q(K,ee,Re),branchModalOpen:ve,onCloseBranchModal:()=>de(!1),rootPath:l,activeRepo:p,currentBranch:we,detached:R?.state?.detached??!1,isBusy:se,onBranchAction:(K,ee)=>Q(K,void 0,ee),onConfirmDeleteBranch:(K,ee)=>{Q("delete_branch",void 0,{branch:K,...ee?{force:"1"}:{}})}}),e(Ye,{activeRepo:p,repos:g,isRefreshing:C,rootPath:l,reposScanning:v,onSelectRepo:(K)=>{if(K!==p)h(K)},onRefresh:()=>{M(),G()},onRefreshRepos:y}),R?.isRepo===!1?e(Rt,{repo:p,isBusy:se,onInit:()=>Q("init")}):e(d,{children:[e(Ve,{branchRef:E,showBranchMenu:A,setShowBranchMenu:z,branch:we,branches:ue,remoteBranches:Te,onCheckout:(K)=>Q("checkout",void 0,{branch:K}),onMerge:(K)=>Q("merge_branch",void 0,{branch:K}),onOpenBranchPrompt:()=>V(!0),onManageBranches:()=>{de(!0),z(!1)},optionsRef:H,showOptions:T,setShowOptions:F,onHistory:()=>Q("history"),onGraph:()=>Q("graph"),viewMode:x,setViewMode:w,isBusy:se,syncCount:N,syncing:Tt,onSync:()=>Q("sync"),onFetch:()=>Q("fetch"),detached:R?.state?.detached??!1}),R?.state?.operation?e(Ke,{operation:R.state.operation,conflicts:R.state.conflicts,isBusy:se,onAbort:()=>I("abort_operation"),onContinue:()=>Q("continue_operation")}):e(qe,{message:Me,hasStagedChanges:Dt.length>0,isBusy:se,amend:Ne,seeded:Ae,onToggleAmend:Le,onChangeMessage:ke,onCommit:j}),e(Qe,{changes:xe,isLoading:se,viewMode:x,repo:p,rootPath:l,onAction:I,onResolve:te}),e(wt,{rootPath:l,repo:p,isBusy:se,onAction:(K,ee)=>I(K,void 0,ee)})]})]})}export{hs as GitPanel};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{d,n,o,W,i,u,a,le,e,w,tg,Ce,jr,Fp,s,E,ne,Ne,Ie,dr,m,L,_,tt,At,f,B,ie,nt,Fn,rt,Mt,sn,at,ge,wr,Ge,xo,Mn,Ca,Y,D,O,Jn,b,ot,pe,Z,ct,he,xt,Dt,Nt,ea,He,Je,hn,Va,na,tl,nh,We,ss,xm,td,Bc,Sa,wm,No,Qo,Ro,Ct,Cm,ls,cs,Ic,rh,ah,Em,us,Fo,Lo,Bm,Mo,Im,oh,_m,ih,Sm,Tm,Dm,sh,Nm,rl,dn,_c,al,Qm,rd,lh,Sc,ad,Rm}from"./index-pzvr1699.js";import{vl,Na,Nd,Ts}from"./index-0gbj4270.js";var Qn={name:"arrow-up-down",size:24,node:[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]},hs=s(Qn);var eo={name:"calendar",size:24,node:[["path",{d:"M8 2v3",key:"1ioesn"}],["path",{d:"M16 2v3",key:"otl347"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}],["path",{d:"M3 9h18",key:"1pudct"}]]},Da=s(eo);var to={name:"check-check",size:24,node:[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]},ft=s(to);var no={name:"list-checks",size:24,node:[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]]},Qr=s(no);function ht({value:r,onInput:t,onSubmit:l,onRefresh:c,onNewFolder:p,loading:h,creating:g,resolved:x}){return e("div",{children:[e("div",{className:"flex items-center space-x-2",children:[e("form",{onSubmit:(v)=>{v.preventDefault(),l()},className:"flex-1 flex items-center bg-paper border border-ink/20 rounded overflow-hidden focus-within:border-ink/50",children:[e("div",{className:"px-2 text-ink/40 bg-ink/5 h-full flex items-center border-r border-ink/10",children:e(dr,{size:14})}),e("input",{type:"text",value:r,onChange:(v)=>t(v.currentTarget.value),placeholder:"~/projects/my-project",spellcheck:!1,"aria-label":"Project path",className:"w-full px-3 py-2 outline-none text-sm bg-transparent font-mono"})]}),e("button",{type:"button",onClick:c,disabled:h,title:"Refresh folders","aria-label":"Refresh folders","aria-busy":h,className:"px-2.5 py-2 bg-ink/5 border border-ink/10 rounded text-ink/70 hover:bg-ink/10 hover:text-ink disabled:opacity-40 transition-colors flex-shrink-0",children:e(D,{size:13,className:h?"animate-spin":void 0})}),e("button",{type:"button",onClick:p,disabled:g||h||!x,title:"New folder here","aria-label":"New folder here","aria-busy":g,className:"px-2.5 py-2 bg-ink/5 border border-ink/10 rounded text-ink/70 hover:bg-ink/10 hover:text-ink disabled:opacity-40 transition-colors flex-shrink-0",children:g?e(m,{size:13,className:"animate-spin"}):e(sn,{size:13})})]}),x&&x!==r.trim()&&e("p",{className:"mt-1 text-[10px] text-ink/40 font-mono truncate",children:["Listing: ",x]})]})}function bt({directories:r,loading:t,error:l,onOpen:c,onRetry:p,creating:h,name:g,onNameChange:x,onCreate:k,onCancelCreate:v,createError:N,creatingBusy:y}){return e("div",{className:"border border-ink/15 rounded overflow-hidden",children:[h&&e("form",{onSubmit:(C)=>{if(C.preventDefault(),g.trim())k(g.trim())},className:"flex items-center space-x-1.5 px-2 py-1.5 border-b border-ink/10 bg-ink/5",children:[e(at,{size:13,className:"text-ink/40 flex-shrink-0"}),e("input",{type:"text",value:g,onChange:(C)=>x(C.currentTarget.value),placeholder:"new-folder-name","aria-label":"New folder name",spellcheck:!1,className:"flex-1 bg-paper border border-ink/20 rounded px-2 py-1 outline-none focus:border-ink/50 text-xs"}),e("button",{type:"submit",disabled:y||!g.trim(),className:"px-2 py-1 rounded bg-ink text-canvas text-[11px] font-medium hover:bg-ink/90 disabled:opacity-40 transition-colors",children:y?"Creating…":"Create"}),e("button",{type:"button",onClick:v,"aria-label":"Cancel new folder",className:"p-1 rounded text-ink/40 hover:text-ink hover:bg-ink/10 transition-colors",children:e(b,{size:12})})]}),h&&N&&e("p",{className:"px-2.5 py-1.5 text-[11px] text-error border-b border-ink/10",children:N}),e("div",{className:"max-h-52 overflow-y-auto scrollbar-overlay-container",children:t?e("div",{className:"flex items-center justify-center py-8 text-ink/40",children:e(m,{size:16,className:"animate-spin"})}):l?e("div",{className:"flex flex-col items-center justify-center py-6 px-3 text-xs text-error space-y-2",children:[e("span",{className:"text-center",children:l}),e("button",{type:"button",onClick:p,className:"px-2 py-1 rounded bg-ink/5 border border-ink/10 text-ink/70 hover:bg-ink/10 flex items-center space-x-1",children:[e(D,{size:11})," ",e("span",{children:"Retry"})]})]}):r.length===0?e("div",{className:"text-center py-8 text-xs text-ink/40",children:"No subfolders"}):r.map((C)=>e("button",{type:"button",onClick:()=>c(C),title:C.path,className:"w-full flex items-center space-x-2 px-2.5 py-1.5 text-left hover:bg-ink/5 transition-colors group",children:[e(at,{size:14,className:"text-ink/50 flex-shrink-0"}),e("span",{className:"text-xs truncate text-ink/85 flex-1",children:C.name}),e(rt,{size:11,className:"text-ink/20 group-hover:text-ink/50 flex-shrink-0 transition-colors"})]},C.path))})]})}function gt(r){let t=r.trim();if(!t||/\s/.test(t))return!1;if(/^https?:\/\/\S+$/i.test(t))return!0;if(/^ssh:\/\/\S+$/i.test(t))return!0;if(/^git@[^:/\s]+:\S+$/.test(t))return!0;if(/^file:\/\/\S+$/i.test(t))return!0;if(t.startsWith("/")||t.startsWith("~"))return!0;if(/^[a-z]:[\\/]/i.test(t))return!0;if(/^\\\\[^\\]+\\/.test(t))return!0;return!1}function kt(r){let c=r.replace(/^[a-z]:/i,"").replace(/\\/g,"/").replace(/\/+$/,"").split(/[/:]/).filter(Boolean),p=c.length===0?"":c[c.length-1];if(p===""||/^[a-z]+:$/i.test(p)||/^https?:?$/i.test(p))return"";return p.replace(/\.git$/i,"").replace(/[^a-z0-9._-]/gi,"-")}function St({parent:r,busy:t,onClone:l}){let[c,p]=n(""),h=c.trim(),g=gt(h),x=g?kt(h):"",k=()=>{if(g&&!t)l(h)};return e("div",{children:[e("label",{className:"block text-xs font-semibold mb-1 text-ink",children:["Clone Git Repository"," ",e("span",{className:"text-ink/40 font-normal",children:"(optional: clones into the path above)"})]}),e("div",{className:"flex items-center space-x-2",children:[e("input",{type:"text",value:c,onChange:(v)=>p(v.currentTarget.value),onKeyDown:(v)=>{if(v.key==="Enter")v.preventDefault(),k()},disabled:t,placeholder:"https://github.com/org/repo.git",spellcheck:!1,"aria-label":"Git repository URL",className:"flex-1 bg-paper border border-ink/20 rounded px-3 py-2 outline-none focus:border-ink/50 text-sm font-mono disabled:opacity-60"}),e("button",{type:"button",onClick:k,disabled:!g||t,title:g?`Clone into ${r}/${x}`:"Enter an https, ssh, git@ or local path","aria-label":"Clone repository",className:"px-3 py-2 bg-ink/5 border border-ink/10 rounded text-xs font-medium hover:bg-ink/10 disabled:opacity-40 transition-colors flex items-center space-x-1.5 flex-shrink-0",children:[t?e(m,{size:13,className:"animate-spin"}):e(wr,{size:13}),e("span",{children:t?"Cloning…":"Clone"})]})]}),g&&x&&!t&&e("p",{className:"mt-1 text-[10px] text-ink/40 font-mono truncate",children:["Creates workspace “",x.toLowerCase(),"” at ",r,"/",x]})]})}function vt(r){let[t,l]=n(r??""),[c,p]=n([]),[h,g]=n(null),[x,k]=n(!1),[v,N]=n(null),y=i(0),T=a(async(S)=>{let I=++y.current;k(!0),N(null);try{let P=await Nd(S);if(I!==y.current)return;l(P.path??S??""),g(P.parentPath??null),p(P.directories??[])}catch(P){if(I!==y.current)return;N(P instanceof Error?P.message:String(P)),p([])}finally{if(I===y.current)k(!1)}},[]);o(()=>{T(r||void 0)},[T]);let C=a(()=>T(t||void 0),[T,t]);return{current:t,directories:c,parentPath:h,loading:x,error:v,navigate:T,refresh:C}}function yl({isOpen:r,onClose:t,onCreate:l,onClone:c}){if(!r)return null;return e(oo,{onClose:t,onCreate:l,onClone:c})}function oo({onClose:r,onCreate:t,onClone:l}){let[c,p]=n("create"),[h,g]=n(""),[x,k]=n(""),[v,N]=n(!1),[y,T]=n(null),[C,S]=n(!1),[I,P]=n(!1),[A,F]=n(""),[R,M]=n(null),[q,Q]=n(!1),G=vt(),oe=async(H)=>{Q(!0),M(null);try{let K=await fetch("/api/folders/mkdir",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({parent:G.current,name:H})}),z=await K.json().catch(()=>({}));if(!K.ok||!z.success)throw Error(z.error||`HTTP ${K.status}`);P(!1),await G.refresh()}catch(K){M(K instanceof Error?K.message:String(K))}finally{Q(!1)}},re=async()=>{if(!t)return r();if(!h.trim()&&!x.trim()){T("Enter a name or a project path.");return}N(!0),T(null);try{await t({name:h.trim(),path:x.trim()||void 0}),r()}catch(H){T(H instanceof Error?H.message:String(H)),N(!1)}},V=async(H)=>{if(!l)return r();if(!G.current){T("Enter the folder the repository should be cloned into.");return}N(!0),T(null);try{await l({url:H,parent:G.current,name:h.trim()||void 0}),r()}catch(K){T(K instanceof Error?K.message:String(K)),N(!1)}};return e("div",{className:"fixed inset-0 modal-scrim z-50 flex items-center justify-center p-4",children:[e("div",{className:"glass-overlay bg-paper border border-ink/10 rounded-lg shadow-xl w-[30rem] max-w-full max-h-full overflow-y-auto flex flex-col",children:[e("div",{className:"flex justify-between items-center px-4 pt-4 pb-2 border-b border-ink/10",children:[e("h3",{className:"font-semibold text-sm",children:"New Workspace"}),e("button",{type:"button",onClick:r,"aria-label":"Close",className:"p-1 rounded text-ink/60 hover:text-ink hover:bg-ink/10 transition-colors",children:e(b,{size:14})})]}),e("div",{className:"flex px-4 pt-2 space-x-1",children:["create","clone"].map((H)=>e("button",{type:"button",onClick:()=>{p(H),T(null)},"aria-pressed":c===H,className:`px-3 py-1.5 text-xs font-medium rounded-t transition-colors ${c===H?"text-ink border-b-2 border-ink":"text-ink/50 hover:text-ink"}`,children:H==="create"?"Create":"Clone"},H))}),e("div",{className:"px-4 py-3 space-y-3 text-sm text-ink/80",children:[e("div",{children:[e("label",{className:"block text-xs font-semibold mb-1 text-ink",children:["Workspace Name"," ",e("span",{className:"text-ink/40 font-normal",children:c==="clone"?"(optional: defaults to the repository name)":""})]}),e("input",{type:"text",value:h,onChange:(H)=>g(H.currentTarget.value),placeholder:"e.g. bofis-pro",className:"w-full bg-paper border border-ink/20 rounded px-3 py-2 outline-none focus:border-ink/50 text-sm"})]}),e("div",{children:[e("label",{className:"block text-xs font-semibold mb-1 text-ink",children:[c==="clone"?"Clone Into":"Project Path"," ",e("span",{className:"text-ink/40 font-normal",children:c==="create"?"(optional: binds omp sessions)":""})]}),e(ht,{value:x,onInput:k,onSubmit:()=>void G.navigate(x.trim()||void 0),onRefresh:()=>void G.refresh(),onNewFolder:()=>{F(""),P(!0),M(null)},loading:G.loading,creating:q,resolved:G.current})]}),e(bt,{directories:G.directories,loading:G.loading,error:G.error,onOpen:(H)=>{k(H.path),G.navigate(H.path)},onRetry:()=>void G.refresh(),creating:I,name:A,onNameChange:F,onCreate:(H)=>void oe(H),onCancelCreate:()=>{P(!1),F(""),M(null)},createError:R,creatingBusy:q}),e("div",{className:"flex items-center justify-between",children:[e("button",{type:"button",onClick:()=>S(!0),className:"px-3 py-1.5 bg-ink/5 border border-ink/10 rounded text-xs font-medium hover:bg-ink/10 transition-colors flex items-center space-x-1.5",children:[e(Mt,{size:13}),e("span",{children:"Browse…"})]}),G.parentPath&&e("button",{type:"button",onClick:()=>void G.navigate(G.parentPath??void 0),className:"text-[11px] text-ink/50 hover:text-ink transition-colors",children:"↑ Up one level"})]}),c==="clone"&&e(St,{parent:G.current,busy:v,onClone:(H)=>void V(H)}),y&&e("div",{className:"text-xs text-error",children:y})]}),e("div",{className:"px-4 py-3 border-t border-ink/10 flex justify-end space-x-2",children:[e("button",{type:"button",className:"px-3 py-1.5 text-xs font-medium text-ink/60 hover:text-ink transition-colors",onClick:r,disabled:v,children:"Cancel"}),c==="create"&&e("button",{type:"button",className:"px-4 py-1.5 text-xs font-medium bg-ink text-canvas rounded hover:bg-ink/90 transition-colors disabled:opacity-50",onClick:()=>void re(),disabled:v,children:v?"Creating…":"Create Workspace"})]})]}),C&&e(Ts,{initialPath:x||void 0,onSelect:(H)=>{if(k(H),S(!1),!h.trim()){let K=H.replace(/[\\/]+$/,"").split(/[\\/]/).pop()||"";if(K)g(K)}G.navigate(H)},onClose:()=>S(!1)})]})}async function ro(r){let t=await r.json().catch(()=>null);if(!r.ok||!t||t.error)return null;return{tasks:t.tasks??[],serverTimeZone:t.serverTimeZone??""}}function yt(r){let[t,l]=n([]),[c,p]=n(""),[h,g]=n(!1),[x,k]=n(null),v=a(async()=>{g(!0);try{let A=await ro(await fetch("/api/schedule"));if(A){if(l(A.tasks),A.serverTimeZone)p(A.serverTimeZone);k(null)}else k("Could not load scheduled tasks.")}catch(A){k(A instanceof Error?A.message:String(A))}finally{g(!1)}},[]),N=Ce(tg,{enabled:r});o(()=>{if(!N.data)return;if(l(N.data.tasks),N.data.serverTimeZone)p(N.data.serverTimeZone);g(!1),k(null)},[N.data]);let y=a(async(A,F)=>{try{let R=await fetch(A,F),M=await R.json().catch(()=>null);if(!R.ok||!M||M.error){let q=M?.error??`HTTP ${R.status}`;return k(q),q}if(M.tasks)l(M.tasks);return k(null),null}catch(R){let M=R instanceof Error?R.message:String(R);return k(M),M}},[]),T=a(async(A)=>await y("/api/schedule",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)}),[y]),C=a(async(A,F)=>y(`/api/schedule?id=${encodeURIComponent(A)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(F)}),[y]),S=a(async(A)=>y(`/api/schedule?id=${encodeURIComponent(A)}`,{method:"DELETE"}),[y]),I=a(async(A)=>await y(`/api/schedule?id=${encodeURIComponent(A)}&run=now`,{method:"POST"}),[y]),P=a(async(A)=>{try{let F=await fetch(`/api/schedule/${encodeURIComponent(A)}/runs`),R=await F.json().catch(()=>null);return F.ok?R?.runs??[]:[]}catch{return[]}},[]);return{tasks:t,serverTimeZone:c,loading:h,error:x,refresh:v,create:T,patch:C,remove:S,runNow:I,loadRuns:P}}function lu(){let r=Ce(tg);return u(()=>(r.data?.tasks??[]).filter((t)=>t.enabled).length,[r.data])}var wt=new Map;function Ot(r){let t=wt.get(r);if(!t)t=new Intl.DateTimeFormat("en-US",{timeZone:r,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),wt.set(r,t);return t}function It(r){if(!r)return!1;try{return Ot(r),!0}catch{return!1}}function Rt(){return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}function De(r,t){let l=Ot(t).formatToParts(new Date(r)),c=(p)=>{let h=l.find((g)=>g.type===p);return h?Number(h.value):0};return{year:c("year"),month:c("month"),day:c("day"),hour:c("hour"),minute:c("minute"),second:c("second")}}function Tt(r,t){let l=De(r,t);return Date.UTC(l.year,l.month-1,l.day,l.hour,l.minute,l.second)-Math.floor(r/1000)*1000}function Qe(r,t,l,c,p,h){let g=Date.UTC(r,t-1,l,c,p),x=Tt(g,h),k=g-x,v=Tt(k,h);if(v!==x)k=g-v;let N=De(k,h);if(N.year!==r||N.month!==t||N.day!==l||N.hour!==c||N.minute!==p)return null;return k}var so=60000,io={s:1000,sec:1000,secs:1000,second:1000,seconds:1000,m:60000,min:60000,mins:60000,minute:60000,minutes:60000,h:3600000,hr:3600000,hrs:3600000,hour:3600000,hours:3600000,d:86400000,day:86400000,days:86400000,w:604800000,week:604800000,weeks:604800000};function Pt(r){let t=r.trim().toLowerCase();if(!t)return null;if(/^\d+(\.\d+)?$/.test(t)){let h=Number(t);return h>0?Math.round(h*60000):null}let l=t.match(/(\d+(?:\.\d+)?)\s*([a-z]+)/g);if(!l)return null;if(l.join("").replace(/\s+/g,"").length!==t.replace(/\s+/g,"").length)return null;let p=0;for(let h of l){let g=h.match(/^(\d+(?:\.\d+)?)\s*([a-z]+)$/);if(!g)return null;let x=io[g[2]];if(!x)return null;p+=Number(g[1])*x}return p>0?Math.round(p):null}var ao=[[0,59],[0,23],[1,31],[1,12],[0,7]];function lo(r,t,l){let c=new Set;for(let p of r.split(",")){let[h,g]=p.split("/"),x=g===void 0?1:Number(g);if(!Number.isInteger(x)||x<1)return null;let k,v;if(h==="*")k=t,v=l;else if(h.includes("-")){let[N,y]=h.split("-");k=Number(N),v=Number(y)}else k=Number(h),v=g===void 0?k:l;if(!Number.isInteger(k)||!Number.isInteger(v))return null;if(k<t||v>l||k>v)return null;for(let N=k;N<=v;N+=x)c.add(N)}return c.size?[...c].sort((p,h)=>p-h):null}function co(r){let t=r.trim().split(/\s+/);if(t.length!==5)return null;let l=t.map((k,v)=>{let[N,y]=ao[v];return lo(k,N,y)});if(l.some((k)=>k===null))return null;let[c,p,h,g,x]=l;return{minutes:c,hours:p,daysOfMonth:h,months:g,daysOfWeek:[...new Set(x.map((k)=>k===7?0:k))].sort((k,v)=>k-v),domRestricted:t[2].trim()!=="*",dowRestricted:t[4].trim()!=="*"}}function uo(r,t,l,c){let p=new Date(Date.UTC(t,l-1,c)).getUTCDay(),h=r.daysOfMonth.includes(c),g=r.daysOfWeek.includes(p);if(r.domRestricted&&r.dowRestricted)return h||g;if(r.domRestricted)return h;if(r.dowRestricted)return g;return!0}function po(r,t,l){let c=l&&It(l)?l:Rt(),p=De(t.getTime(),c),h=Date.UTC(p.year+8,p.month-1,p.day);for(let g=Date.UTC(p.year,p.month-1,p.day);g<=h;){let x=new Date(g),k=x.getUTCFullYear(),v=x.getUTCMonth()+1,N=x.getUTCDate();if(!r.months.includes(v)){g=Date.UTC(k,v,1);continue}if(uo(r,k,v,N))for(let y of r.hours)for(let T of r.minutes){let C=Qe(k,v,N,y,T,c);if(C!==null&&C>t.getTime())return C}g=Date.UTC(k,v-1,N+1)}return null}var mo=/^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?$/;function Et(r,t){let l=r.trim();if(!l)return null;if(/^\d+$/.test(l)){let p=Number(l);return p>0?p:null}if(t){let p=l.match(mo);if(p){let[,h,g,x,k,v,N,y]=p,T=Qe(Number(h),Number(g),Number(x),Number(k),Number(v),t);if(T===null)return null;let C=(N?Number(N)*1000:0)+(y?Number(y.padEnd(3,"0")):0);return T+C}}let c=Date.parse(l);return Number.isNaN(c)?null:c}function Ft(r,t,l=Date.now(),c){if(!t.trim())return{ok:!1,error:"Enter a schedule."};if(r==="once"){let g=Et(t,c);if(g===null)return{ok:!1,error:"Use an ISO timestamp, e.g. 2026-10-01T09:00."};if(g<=l)return{ok:!1,error:"That time is already in the past."};return{ok:!0,nextRunAt:g}}if(r==="every"){let g=Pt(t);if(g===null)return{ok:!1,error:"Use a duration, e.g. 30m, 1h30m, 2 days."};if(g<so)return{ok:!1,error:"The shortest interval is 1 minute."};return{ok:!0,nextRunAt:l+g}}let p=co(t);if(!p)return{ok:!1,error:"Use 5 fields: minute hour day-of-month month day-of-week."};let h=po(p,new Date(l),c);if(h===null)return{ok:!1,error:"That expression never matches a date."};return{ok:!0,nextRunAt:h}}function Bt(r,t,l){let c=t.trim();if(r==="once"){let p=Et(c,l);return p===null?c:`Once at ${new Date(p).toLocaleString(void 0,l?{timeZone:l}:void 0)}`}if(r==="every"){let p=Pt(c);return p===null?c:`Every ${et(p)}`}return`Cron ${c}`}function et(r){let t=Math.round(r/1000),l=Math.floor(t/86400),c=Math.floor(t%86400/3600),p=Math.floor(t%3600/60),h=t%60,g=[];if(l)g.push(`${l}d`);if(c)g.push(`${c}h`);if(p)g.push(`${p}m`);if(h&&!l)g.push(`${h}s`);return g.length?g.join(" "):"0s"}var fo={"always-ask":"Ask before writes",write:"Auto-write, ask before exec",yolo:"Auto-run everything"};function st(r){return`${r.provider}/${r.id}`}function ho(r){if(!Array.isArray(r))return[];let t=[];for(let l of r){if(!l||typeof l!=="object")continue;if(!("id"in l)||typeof l.id!=="string")continue;if(!("name"in l)||typeof l.name!=="string")continue;if(!("provider"in l)||typeof l.provider!=="string")continue;let c="thinkingLevels"in l&&Array.isArray(l.thinkingLevels)?l.thinkingLevels.filter((p)=>typeof p==="string"):void 0;t.push({id:l.id,name:l.name,provider:l.provider,...c?{thinkingLevels:c}:{}})}return t}function _t({harness:r,model:t,onHarnessChange:l,onModelChange:c}){let{harnesses:p}=hn(),h=Va((S)=>{let I=Array.isArray(S.modelList)&&S.modelList.length>0?S.modelList:S.models;return ho(I)}),g=ss(p,r,h??[]),x=g.models,k=t?x.find((S)=>S.provider===t.provider&&S.id===t.modelId):void 0,v=Bc(k?.thinkingLevels),N=xm(p,r),y=(S)=>{if(!S){c(null);return}let I=x.find((P)=>st(P)===S);if(!I)return;c({provider:I.provider,modelId:I.id,thinkingLevel:"auto",accessMode:t?.accessMode??"always-ask"})},T=(S)=>{if(!t)return;c({...t,thinkingLevel:S})},C=(S)=>{if(!t)return;c({...t,accessMode:S})};return e("div",{className:"space-y-2",children:[e("div",{className:"grid grid-cols-2 gap-2",children:[e("div",{children:[e("label",{className:"block font-semibold mb-1 text-ink",children:"Harness"}),e("select",{value:r,onChange:(S)=>l(S.currentTarget.value),className:"w-full bg-paper border border-ink/20 rounded px-2 py-1.5 outline-none focus:border-ink/50 text-xs",children:[!N.some((S)=>S.id===r)&&e("option",{value:r,children:r}),N.map((S)=>e("option",{value:S.id,children:S.label},S.id))]})]}),e("div",{children:[e("label",{className:"block font-semibold mb-1 text-ink",children:"Model"}),e("select",{value:t?`${t.provider}/${t.modelId}`:"",onChange:(S)=>y(S.currentTarget.value),className:"w-full bg-paper border border-ink/20 rounded px-2 py-1.5 outline-none focus:border-ink/50 text-xs",children:[e("option",{value:"",children:r==="omp-rpc"?"Default (composer selection)":"Harness default"}),t&&!x.some((S)=>S.provider===t.provider&&S.id===t.modelId)&&e("option",{value:`${t.provider}/${t.modelId}`,children:[t.provider,"/",t.modelId]}),x.map((S)=>e("option",{value:st(S),children:[S.name," · ",S.provider]},st(S)))]})]})]}),e("div",{className:"grid grid-cols-2 gap-2",children:[e("div",{children:[e("label",{className:"block font-semibold mb-1 text-ink",children:"Thinking"}),e("select",{value:t?.thinkingLevel??"auto",disabled:!t||v.length===0,onChange:(S)=>T(S.currentTarget.value),className:"w-full bg-paper border border-ink/20 rounded px-2 py-1.5 outline-none focus:border-ink/50 text-xs disabled:opacity-40",children:[e("option",{value:"auto",children:"Auto"}),t&&t.thinkingLevel!=="auto"&&!v.includes(t.thinkingLevel)&&e("option",{value:t.thinkingLevel,children:t.thinkingLevel}),v.map((S)=>e("option",{value:S,children:S},S))]})]}),e("div",{children:[e("label",{className:"block font-semibold mb-1 text-ink",children:"Access"}),e("select",{value:t?.accessMode??"always-ask",disabled:!t,onChange:(S)=>C(S.currentTarget.value),className:"w-full bg-paper border border-ink/20 rounded px-2 py-1.5 outline-none focus:border-ink/50 text-xs disabled:opacity-40",children:td.map((S)=>e("option",{value:S,children:fo[S]},S))})]})]}),g.blocked&&e("p",{className:"text-[11px] text-error",children:g.blocked}),g.unprobed&&e("p",{className:"text-[11px] text-ink/40",children:"This harness has not been probed yet; its models appear after a status check."})]})}var Lt={once:"Once",every:"Every",cron:"Cron"},bo={once:"An ISO timestamp, e.g. 2026-10-01T09:00",every:"A duration, e.g. 30m, 1h30m, 2 days",cron:"5 fields: minute hour day-of-month month day-of-week"},go={once:"2026-10-01T09:00",every:"1h30m",cron:"0 9 * * 1-5"};function ko(r){let t=r-Date.now();if(t<=0)return"due now";let l=Math.round(t/60000);if(l<60)return`in ${l}m`;let c=Math.round(l/60);if(c<24)return`in ${c}h`;return`in ${Math.round(c/24)}d`}var Fe=null;function So(){if(Fe)return Fe;let r=Intl,t=[];try{t=r.supportedValuesOf?.("timeZone")??[]}catch{t=[]}return Fe=t.length?t:["UTC"],Fe}function vo(r){let t=So();return r&&!t.includes(r)?[r,...t]:t}function $t({folders:r,initial:t,activeSessionId:l,serverTimeZone:c,busy:p,onSubmit:h,onCancel:g}){let[x,k]=n(""),[v,N]=n(""),[y,T]=n("every"),[C,S]=n("1h"),[I,P]=n("omp-rpc"),[A,F]=n(null),R=c||Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC",[M,q]=n(R),[Q,G]=n(null),[oe,re]=n(!1);o(()=>{k(t?.name??""),N(t?.prompt??""),T(t?.kind??"every"),S(t?.spec??"1h"),P(t?.harness??"omp-rpc"),F(t?.model??null),q(t?.timezone??R),G(t?.folderId??null),re(Boolean(t?.sessionId))},[t?.id,R]);let V=Ft(y,C,Date.now(),M),H=Boolean(v.trim())&&V.ok&&!p,K=()=>{if(!H||!V.ok)return;h({name:x.trim(),prompt:v.trim(),kind:y,spec:C.trim(),harness:I,timezone:M,folderId:Q,sessionId:oe?t?.sessionId??l:null,model:A})};return e("div",{className:"space-y-3 text-xs",children:[e("div",{children:[e("label",{className:"block font-semibold mb-1 text-ink",children:["Name ",e("span",{className:"text-ink/40 font-normal",children:"(optional)"})]}),e("input",{type:"text",value:x,onInput:(z)=>k(z.currentTarget.value),placeholder:"Morning standup digest",className:"w-full bg-paper border border-ink/20 rounded px-2.5 py-1.5 outline-none focus:border-ink/50 text-xs"})]}),e("div",{children:[e("label",{className:"block font-semibold mb-1 text-ink",children:"Prompt"}),e("textarea",{value:v,onInput:(z)=>N(z.currentTarget.value),placeholder:"Describe the task, ask a question, or paste commands…",rows:4,className:"w-full bg-paper border border-ink/20 rounded px-2.5 py-1.5 outline-none focus:border-ink/50 text-xs resize-y min-h-[80px]"})]}),e("div",{className:"flex items-end gap-2",children:[e("div",{className:"w-28 flex-shrink-0",children:[e("label",{className:"block font-semibold mb-1 text-ink",children:"Schedule"}),e("select",{value:y,onChange:(z)=>T(z.currentTarget.value),className:"w-full bg-paper border border-ink/20 rounded px-2 py-1.5 outline-none focus:border-ink/50 text-xs",children:Object.keys(Lt).map((z)=>e("option",{value:z,children:Lt[z]},z))})]}),e("div",{className:"flex-1",children:[e("label",{className:"block font-semibold mb-1 text-ink",children:"When"}),e("input",{type:"text",value:C,onInput:(z)=>S(z.currentTarget.value),placeholder:go[y],className:`w-full bg-paper border rounded px-2.5 py-1.5 outline-none text-xs font-mono ${V.ok?"border-ink/20 focus:border-ink/50":"border-error/50 focus:border-error"}`})]})]}),e("p",{className:`text-[11px] ${V.ok?"text-ink/50":"text-error"}`,children:V.ok?`Next run ${ko(V.nextRunAt)} · ${new Date(V.nextRunAt).toLocaleString(void 0,{timeZone:M})} · ${M}`:V.error}),e("p",{className:"text-[11px] text-ink/40",children:bo[y]}),e("div",{className:"grid grid-cols-2 gap-2",children:[e("div",{children:[e("label",{className:"block font-semibold mb-1 text-ink",children:"Timezone"}),e("select",{value:M,onChange:(z)=>q(z.currentTarget.value),className:"w-full bg-paper border border-ink/20 rounded px-2 py-1.5 outline-none focus:border-ink/50 text-xs",children:vo(M).map((z)=>e("option",{value:z,children:z},z))})]}),e("div",{children:[e("label",{className:"block font-semibold mb-1 text-ink",children:"Run in"}),e("select",{value:Q===null?"":String(Q),onChange:(z)=>G(z.currentTarget.value?Number(z.currentTarget.value):null),className:"w-full bg-paper border border-ink/20 rounded px-2 py-1.5 outline-none focus:border-ink/50 text-xs",children:[e("option",{value:"",children:"Server default directory"}),r.map((z)=>e("option",{value:z.id,children:z.name},z.id))]})]})]}),e(_t,{harness:I,model:A,onHarnessChange:(z)=>{P(z),F(null)},onModelChange:F}),e("label",{className:`flex items-center gap-2 text-[11px] ${l?"text-ink/70":"text-ink/35"}`,children:[e("input",{type:"checkbox",checked:oe,disabled:!l,onChange:(z)=>re(z.currentTarget.checked),className:`${he} accent-ink`}),e("span",{children:"Resume the open session each run"})]}),e("div",{className:"flex justify-end gap-2 pt-1",children:[e("button",{type:"button",onClick:g,disabled:p,className:"px-3 py-1.5 text-xs font-medium text-ink/60 hover:text-ink transition-colors",children:"Cancel"}),e("button",{type:"button",onClick:K,disabled:!H,className:"inline-flex items-center gap-1.5 px-4 py-1.5 text-xs font-medium bg-ink text-canvas rounded hover:bg-ink/90 transition-colors disabled:opacity-40",children:[p&&e(m,{size:12,className:"animate-spin"}),t?"Save changes":"Schedule task"]})]})]})}function yo(r){return r===null?"–":new Date(r).toLocaleString()}function wo(r){if(r.name)return r.name;let t=r.prompt.replace(/\s+/g," ").trim();return t.length>60?`${t.slice(0,57)}…`:t||"(empty prompt)"}function Wt({tasks:r,loading:t,pending:l,onRunNow:c,onToggleEnabled:p,onEdit:h,onDelete:g,loadRuns:x}){let[k,v]=n(null),[N,y]=n([]),[T,C]=n(!1);if(o(()=>{if(!k)return;let S=!0;return C(!0),x(k).then((I)=>{if(!S)return;y(I),C(!1)}),()=>{S=!1}},[k,x]),r.length===0)return e("div",{className:"px-3 py-8 text-center text-[11px] text-ink/50 border border-dashed border-ink/15 rounded-lg",children:t?"Loading…":"No scheduled tasks yet. Create one above."});return e("ul",{className:"space-y-2",children:r.map((S)=>{let I=l===S.id,P=k===S.id;return e("li",{className:"border border-ink/10 rounded-lg bg-paper",children:[e("div",{className:"flex items-start gap-2 p-2.5",children:[e("span",{className:"mt-0.5 shrink-0","aria-hidden":"true",children:!S.enabled?e(xo,{size:14,className:"text-ink/40"}):S.lastStatus==="error"?e(E,{size:14,className:"text-error"}):S.lastStatus==="success"?e(ne,{size:14,className:"text-ink/60"}):e(Fn,{size:14,className:"text-ink/60"})}),e("div",{className:"min-w-0 flex-1",children:[e("p",{className:"text-xs font-medium text-ink truncate",children:wo(S)}),e("p",{className:"text-[11px] text-ink/60 mt-0.5",children:[Bt(S.kind,S.spec,S.timezone),S.kind!=="every"&&e(d,{children:[e("span",{className:"text-ink/30",children:" · "}),S.timezone]}),e("span",{className:"text-ink/30",children:" · "}),!S.enabled?S.kind==="once"&&S.lastRunAt!==null?"Ran once, with no next run":"Paused":`Next ${yo(S.nextRunAt)}`]}),S.cwd&&e("p",{className:"text-[10.5px] text-ink/40 font-mono truncate mt-0.5",children:S.cwd}),e("p",{className:"text-[10.5px] text-ink/40 truncate mt-0.5",children:[S.harness,S.model&&` · ${S.model.provider}/${S.model.modelId}`]}),S.sessionId&&e("p",{className:"text-[10.5px] text-ink/40 font-mono truncate mt-0.5",children:["resumes ",S.sessionId.slice(0,8)]}),S.lastStatus==="error"&&S.lastError&&e("p",{className:"text-[10.5px] text-error mt-0.5 break-words",children:S.lastError}),S.runCount>0&&e("p",{className:"text-[10.5px] text-ink/40 mt-0.5",children:["Fired ",S.runCount,"×"]})]}),e("div",{className:"flex items-center gap-1 shrink-0",children:[e("button",{type:"button",title:"Run now","aria-label":"Run now",disabled:I,onClick:()=>c(S.id),className:"p-1.5 rounded hover:bg-ink/5 text-ink/60 hover:text-ink transition-colors disabled:opacity-40",children:I?e(m,{size:13,className:"animate-spin"}):e(Ca,{size:13})}),e("button",{type:"button",title:S.enabled?"Pause":"Resume","aria-label":S.enabled?"Pause":"Resume","aria-pressed":S.enabled,disabled:I,onClick:()=>p(S),className:"p-1.5 rounded hover:bg-ink/5 text-ink/60 hover:text-ink transition-colors disabled:opacity-40",children:S.enabled?e(xo,{size:13}):e(Ca,{size:13})}),e("button",{type:"button",title:"Edit","aria-label":"Edit",disabled:I,onClick:()=>h(S),className:"p-1.5 rounded hover:bg-ink/5 text-ink/60 hover:text-ink transition-colors disabled:opacity-40",children:e(Mn,{size:13})}),e("button",{type:"button",title:"Delete","aria-label":"Delete",disabled:I,onClick:()=>g(S.id),className:"p-1.5 rounded hover:bg-ink/5 text-ink/60 hover:text-error transition-colors disabled:opacity-40",children:e(L,{size:13})})]})]}),e("button",{type:"button",onClick:()=>v(P?null:S.id),"aria-expanded":P,className:"w-full text-left px-2.5 py-1.5 border-t border-ink/5 text-[10.5px] text-ink/50 hover:text-ink transition-colors",children:P?"Hide run history":"Run history"}),P&&e("div",{className:"px-2.5 pb-2.5 space-y-1",children:[T&&e("p",{className:"text-[10.5px] text-ink/40",children:"Loading…"}),!T&&N.length===0&&e("p",{className:"text-[10.5px] text-ink/40",children:"This task has not run yet."}),!T&&N.map((A)=>e("div",{className:"flex items-start gap-2 text-[10.5px]",children:[e("span",{className:"w-16 shrink-0 text-ink/50",children:new Date(A.startedAt).toLocaleTimeString()}),e("span",{className:`w-14 shrink-0 font-medium ${A.status==="error"?"text-error":A.status==="running"?"text-ink/60":"text-ink/70"}`,children:A.status}),e("span",{className:"w-12 shrink-0 text-ink/40",children:A.finishedAt===null?"…":et(A.finishedAt-A.startedAt)}),e("span",{className:"min-w-0 flex-1 text-ink/60 break-words",children:[A.detail||"–",A.sessionId&&e("span",{className:"block font-mono text-[10px] text-ink/40",children:["session ",A.sessionId.slice(0,8)]})]})]},A.id))]})]},S.id)})})}function zt(){let[r,t]=n([]);return o(()=>{let l=!0;return fetch("/api/settings/projects").then((c)=>c.json()).then((c)=>{if(!l)return;t((c.projects??[]).filter((p)=>typeof p.folderId==="number").map((p)=>({id:p.folderId,name:p.name})))}).catch((c)=>console.error("Failed to load workspace folders:",c)),()=>{l=!1}},[]),r}function cu({isOpen:r,onClose:t,activeSessionId:l=null,onToast:c}){let p=yt(r),h=zt(),[g,x]=n(null),[k,v]=n(!1),[N,y]=n(!1),[T,C]=n(null);if(o(()=>{if(r)return;x(null),v(!1),y(!1),C(null)},[r]),o(()=>{let R=(M)=>{if(M.key!=="Escape"||N)return;if(M.preventDefault(),g||k){x(null),v(!1);return}t()};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[t,N,g,k]),!r)return null;let S=async(R)=>{y(!0);let M=g?await p.patch(g.id,R):await p.create(R);if(y(!1),M){c?.(M,"error");return}c?.(g?"Scheduled task updated.":"Scheduled task created.","success"),x(null),v(!1)},I=async(R)=>{C(R.id);let M=await p.patch(R.id,{enabled:!R.enabled});if(C(null),M)c?.(M,"error")},P=async(R)=>{C(R);let M=await p.runNow(R);if(C(null),M){c?.(M,"error");return}c?.("Task dispatched. Open the session to watch it run.","success")},A=async(R)=>{C(R);let M=await p.remove(R);if(C(null),M){c?.(M,"error");return}if(g?.id===R)x(null)},F=g!==null||k;return e("div",{className:"fixed inset-0 modal-scrim backdrop-blur-[2px] z-50 flex items-center justify-center p-4",onClick:N?void 0:t,role:"dialog","aria-modal":"true","aria-label":"Scheduled tasks",children:e("div",{className:"glass-overlay bg-paper border border-ink/15 rounded-xl shadow-2xl w-[min(94vw,640px)] max-h-[88vh] flex flex-col overflow-hidden text-ink",onClick:(R)=>R.stopPropagation(),children:[e("div",{className:"flex items-center justify-between px-4 py-3 border-b border-ink/10",children:[e("div",{className:"flex items-center gap-2",children:[e(Da,{size:15}),e("h3",{className:"font-semibold text-sm",children:"Scheduled Tasks"})]}),e("button",{type:"button",onClick:t,"aria-label":"Close",className:"p-1.5 -m-1.5 rounded text-ink/50 hover:text-ink hover:bg-ink/5 transition-colors",children:e(b,{size:16})})]}),e("div",{className:"p-4 overflow-y-auto space-y-4",children:[p.error&&!F&&e("p",{className:"text-[11px] text-error border border-error/30 bg-error/5 rounded px-2.5 py-1.5",children:p.error}),F?e($t,{folders:h,initial:g,activeSessionId:l,serverTimeZone:p.serverTimeZone,busy:N,onSubmit:S,onCancel:()=>{x(null),v(!1)}}):e("button",{type:"button",onClick:()=>v(!0),className:"w-full py-2 rounded-lg border border-dashed border-ink/20 text-xs font-medium text-ink/70 hover:text-ink hover:border-ink/40 transition-colors",children:"+ New scheduled task"}),!F&&e(Wt,{tasks:p.tasks,loading:p.loading,pending:T,onRunNow:P,onToggleEnabled:I,onEdit:(R)=>x({id:R.id,name:R.name,prompt:R.prompt,kind:R.kind,spec:R.spec,harness:R.harness,timezone:R.timezone,folderId:R.folderId,sessionId:R.sessionId,model:R.model}),onDelete:A,loadRuns:p.loadRuns})]})]})})}var it=["A-Z","Z-A","LATEST_SESSION","LATEST_ADDED"],Ht={"A-Z":"A-Z","Z-A":"Z-A",LATEST_SESSION:"Latest Session",LATEST_ADDED:"Latest Added"};function Go({variant:r,sortOption:t,onSortChange:l}){if(r==="mobile")return e(d,{children:[e("div",{className:"px-2 py-1 text-[10px] uppercase font-bold text-ink/40 font-mono",children:"Sort Workspaces"}),it.map((c)=>e("button",{type:"button",onClick:()=>l(c),className:`w-full text-left px-2.5 py-1.5 rounded-lg flex items-center justify-between transition-colors ${t===c?"bg-ink/10 font-semibold text-ink":"hover:bg-ink/5 text-ink/80"}`,children:[e("span",{children:c.replace("_"," ")}),t===c&&e(f,{size:13,className:"text-ink"})]},c))]});return e(d,{children:[e("div",{className:"px-3 py-1 text-[10px] uppercase font-bold text-ink/40 tracking-wider",children:"Sort Workspaces"}),it.map((c)=>e("div",{className:`px-3 py-1.5 text-xs cursor-pointer flex items-center justify-between ${t===c?"bg-ink/5 text-ink font-medium":"text-ink/70 hover:bg-ink/5 hover:text-ink"}`,onClick:()=>l(c),children:[e("span",{children:Ht[c]}),t===c&&e("div",{className:"w-1.5 h-1.5 rounded-full bg-ink"})]},c))]})}function uu({actions:r,sortHidden:t,sortOption:l,onSortChange:c,layout:p="desktop"}){let h=p==="mobile",[g,x]=n(!1),k=i(null);pe(k,()=>x(!1)),o(()=>{if(!g)return;let N=(y)=>{if(y.key==="Escape")x(!1)};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[g]);let v=(N)=>{x(!1),N.onSelect()};return e("div",{className:"relative shrink-0",ref:k,children:[e("button",{type:"button",title:"More sidebar actions","aria-label":"More sidebar actions","aria-haspopup":"menu","aria-expanded":g,onClick:()=>x(!g),className:`inline-flex items-center justify-center transition-colors cursor-pointer ${h?"w-9.5 h-9.5 rounded-xl border active:scale-95 shadow-xs":"w-7 h-7 rounded border"} ${g?"border-ink/30 bg-ink/10 text-ink":"border-ink/15 bg-paper text-ink/70 hover:bg-ink/5 hover:text-ink"}`,children:e(Ie,{size:h?16:14})}),g&&e("div",{role:"menu",className:`glass-popover absolute right-0 top-full mt-2 w-52 bg-paper border border-ink/15 shadow-lg z-50 py-1 text-xs ${h?"rounded-xl p-2":"rounded-lg"}`,children:[r.map((N)=>e("button",{type:"button",role:"menuitem",onClick:()=>v(N),"aria-pressed":N.active,className:`w-full text-left flex items-center gap-2 transition-colors ${h?"px-2.5 py-1.5 rounded-lg":"px-3 py-1.5"} ${N.active?"bg-ink/5 text-ink font-medium":"text-ink/75 hover:bg-ink/5 hover:text-ink"}`,children:[e(N.icon,{size:13}),e("span",{children:N.label})]},N.id)),t&&e("div",{className:"mt-1 border-t border-ink/10 pt-1",children:e(Go,{variant:p,sortOption:l,onSortChange:c})})]})]})}function bs(r){let t=i(null),[l,c]=n(0);return W(()=>{let p=t.current;if(!p)return;let h=()=>c(Math.max(0,p.clientWidth-r));if(h(),typeof ResizeObserver>"u")return;let g=new ResizeObserver(h);return g.observe(p),()=>g.disconnect()},[r]),{ref:t,width:l}}var Sd=["new-workspace","refresh","search","select","archive","scheduler","sort"];var Bg=8;function Ig(r){let t=Sd.length;if(!(r>0))return t;let l=r-112-6-8;if(t*28+(t-1)*6<=l)return t;let p=Math.floor((l-28-8)/34);return Math.max(2,Math.min(t,p))}var To=38,Co=8,Oo=126,Io=1,Td=["new-workspace","refresh","archive","sort","scheduler","select"];function _g(r){let t=Td.length;if(!(r>0))return t;let l=To+Co,c=Math.floor((r-Oo)/l);if(c>=t)return t;return Math.max(Io,Math.min(t,c-1))}var Ut="inline-flex max-w-full shrink-0 items-center border font-medium transition-colors cursor-pointer",Po="border-ink bg-ink text-paper",Ao="border-ink/15 text-ink/60 hover:border-ink/30 hover:text-ink",Gt="w-full px-2.5 py-1.5 flex items-center gap-2 text-left hover:bg-ink/5 cursor-pointer",jt="bg-ink/10 font-semibold text-ink",Kt="text-ink/75";function ys({options:r,value:t,onChange:l,form:c="chip",touch:p=!1}){let[h,g]=n(null),x=t&&!r.some((y)=>y.harness===t)?[{harness:t,label:ea(t),count:0},...r]:r;if(x.length<2&&!t)return null;let k=t?x.find((y)=>y.harness===t):void 0,v=k?k.label:"All harnesses",N=c==="icon"?e("button",{type:"button","aria-haspopup":"menu","aria-expanded":h!==null,"aria-label":`Filter by harness: ${v}`,title:t?`Harness: ${v}`:"Filter by harness",onClick:(y)=>g(h?null:xt(y.currentTarget)),className:`${Ut} h-[22px] w-[22px] justify-center rounded-md ${t?"border-ink bg-ink text-paper":"border-ink/15 text-ink/55 hover:border-ink/30 hover:text-ink"}`,children:k?e(He,{harness:k.harness,size:Je.compact,inherit:!0,decorative:!0}):e(At,{size:13})}):e("button",{type:"button","aria-haspopup":"menu","aria-expanded":h!==null,title:"Filter by harness",onClick:(y)=>g(h?null:xt(y.currentTarget)),className:`${Ut} gap-1 rounded-full ${p?"px-2 py-1 text-xs":"px-2 py-0.5 text-[11px]"} ${t?Po:Ao}`,children:[k?e(He,{harness:k.harness,size:Je.compact,inherit:!0,decorative:!0}):null,e("span",{className:"max-w-[9rem] truncate",children:v}),k?e("span",{className:"font-mono tabular-nums opacity-70",children:k.count}):null,e(B,{size:11,className:"shrink-0 opacity-60"})]});return e(d,{children:[N,e(Dt,{anchor:h,align:"start",ariaLabel:"Filter by harness",className:"w-56 bg-paper border border-ink/15 rounded-lg shadow-xl py-1 text-xs",onClose:()=>g(null),children:[e("button",{type:"button",onClick:()=>{l(null),g(null)},className:`${Gt} ${!t?jt:Kt}`,children:[e("span",{className:"flex-1 truncate",children:"All harnesses"}),!t?e(f,{size:12}):null]}),x.map((y)=>{let T=y.harness===t;return e("button",{type:"button",onClick:()=>{l(y.harness),g(null)},className:`${Gt} ${T?jt:Kt}`,children:[e(He,{harness:y.harness,size:Je.compact,decorative:!0}),e("span",{className:"flex-1 truncate",children:y.label}),e("span",{className:"font-mono tabular-nums text-ink/50",children:y.count}),T?e(f,{size:12}):null]},y.harness)})]})]})}function vs(r=5,t=7){let[l,c]=n(r),p=a(()=>c((g)=>g+t),[t]),h=a(()=>c(r),[r]);return{visibleCount:l,showMore:p,showLess:h,canShowLess:l>r}}function ks(r,t,l){let[c,p]=n(!1),h=ct(),g=ct(),{handleArchive:x,handleRename:k,handleRenameWithAi:v}=wm(t,l),N=()=>{if(typeof r.id!=="number")return;h.submit({isPinned:String(!r.isPinned)},{method:"POST",action:`/api/folders/${r.id}/pin`}),t()},y=()=>{if(typeof r.id!=="number")return;g.submit({},{method:"POST",action:`/api/folders/${r.id}/delete`}),p(!1),t()},T=r.project_path?()=>{(async()=>{try{let C=await fetch(`/api/folders/${encodeURIComponent(String(r.id))}/open`,{method:"POST"}),S=await C.json().catch(()=>({}));if(!C.ok)l?.(S.error||`Could not open the folder (HTTP ${C.status})`)}catch(C){l?.(C instanceof Error?C.message:String(C))}})()}:void 0;return{confirmDelete:c,requestDelete:()=>p(!0),cancelDelete:()=>p(!1),handlePin:N,handleOpenFolder:T,handleDelete:y,handleArchive:x,handleRename:k,handleRenameWithAi:v}}function Rr({checked:r,indeterminate:t=!1,label:l,onChange:c,size:p="sm"}){let h=i(null);return o(()=>{if(h.current)h.current.indeterminate=t},[t]),e("input",{ref:h,type:"checkbox",checked:r,"aria-label":l,onChange:c,onClick:(g)=>g.stopPropagation(),className:`${he} shrink-0 accent-ink cursor-pointer ${p==="md"?"w-3.5 h-3.5":"w-3 h-3"}`})}function Eo(r){let t=r.branch||(r.detached?"detached":"worktree");return r.status==="missing"?`${t} · ${"missing"}`:t}function Do(r){if(r.status==="missing")return`Worktree folder is missing: ${r.path}`;return r.detached?`Detached HEAD in worktree ${r.path}`:`Runs in worktree ${r.path}`}function xs({worktree:r}){let t=r.status==="missing";return e("span",{className:`flex min-w-0 items-center gap-1 truncate text-[10px] font-normal ${t?"text-warning":"text-ink/45"}`,title:Do(r),"data-worktree-status":r.status,children:[e("span",{"aria-hidden":"true",className:"shrink-0 font-mono",children:"⑂"}),e("span",{className:"truncate",children:Eo(r)})]})}var Bo=1000,Be=new Set,Ae=null;function _o(){let r=Date.now();for(let t of Be)t(r)}function $o(r){if(Be.add(r),Ae===null)Ae=setInterval(_o,Bo);return()=>{if(Be.delete(r),Be.size===0&&Ae!==null)clearInterval(Ae),Ae=null}}function Xt(r=!0){let[t,l]=n(()=>Date.now());return o(()=>{if(!r)return;return $o(l)},[r]),t}function ws(r,t=Date.now()){if(r===null||r===void 0||r==="")return null;let l=typeof r==="number"?r:Date.parse(r);if(Number.isNaN(l))return null;let c=Math.round((t-l)/1000);if(c<45)return"now";let p=Math.round(c/60);if(p<60)return`${p}m`;let h=Math.round(p/60);if(h<24)return`${h}h`;let g=Math.round(h/24);if(g<7)return`${g}d`;let x=Math.round(g/7);if(x<5)return`${x}w`;let k=new Date(l),v=k.getFullYear()===new Date(t).getFullYear(),N=k.getDate(),y=k.toLocaleString("en-US",{month:"short"});return v?`${N} ${y}`:`${N} ${y} ${k.getFullYear()}`}function jo(r){if(r===null||r===void 0||r==="")return null;let t=typeof r==="number"?r:Date.parse(r);if(Number.isNaN(t))return null;return new Date(t).toLocaleString("en-US",{weekday:"short",day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"})}function Zt(r){if(!Number.isFinite(r)||r<1000)return"0s";return Bm(r)??"0s"}function Yt({startedAt:r,className:t}){let l=Xt(),c=Zt(Math.max(0,l-r)),p=u(()=>jo(r),[r]);return e("span",{role:"timer",className:`tabular-nums ${t??""}`,title:p?`Started ${p}`:void 0,"aria-label":`Running for ${c}`,children:c})}var Wo="text-ink/40",zo="text-ink/80";function Cs({timeAgo:r,timeTitle:t,runStartedAt:l,className:c,restingClassName:p=Wo}){if(l!==void 0)return e(Yt,{startedAt:l,className:`${c} ${zo}`});if(!r)return null;return e("span",{className:`${c} ${p}`,title:t??void 0,children:r})}var Es="bg-ink/10 text-ink ring-1 ring-inset ring-ink/20";function Bs({variant:r,isPinned:t=!1,onOpenFolder:l,onSelectSessions:c,onNewWorktree:p,confirmDelete:h,onPin:g,onDelete:x,onRequestDelete:k,onCancelDelete:v}){if(r==="mobile")return h?e(d,{children:[e("div",{className:"px-3 py-2 text-ink/80 font-medium",children:"Delete workspace?"}),e("button",{type:"button",onClick:x,className:"w-full text-left px-3 py-2 hover:bg-error/10 text-error flex items-center space-x-2",children:[e(L,{size:13}),e("span",{children:"Yes, delete"})]}),e("button",{type:"button",onClick:v,className:"w-full text-left px-3 py-2 hover:bg-ink/5 text-ink/70",children:"Cancel"})]}):e(d,{children:[l&&e("button",{type:"button",onClick:l,className:"w-full text-left px-3 py-2 hover:bg-ink/5 text-ink/80 flex items-center space-x-2",children:[e(Mt,{size:13}),e("span",{children:"Go to Explorer"})]}),e("button",{type:"button",onClick:g,className:"w-full text-left px-3 py-2 hover:bg-ink/5 text-ink/80 flex items-center space-x-2",children:[t?e(vl,{size:13}):e(Na,{size:13}),e("span",{children:t?"Unpin Workspace":"Pin Workspace"})]}),c&&e("button",{type:"button",onClick:c,className:"w-full text-left px-3 py-2 hover:bg-ink/5 text-ink/80 flex items-center space-x-2",children:[e(Qr,{size:13}),e("span",{children:"Select sessions"})]}),p&&e("button",{type:"button",onClick:p,className:"w-full text-left px-3 py-2 hover:bg-ink/5 text-ink/80 flex items-center space-x-2",children:[e(ge,{size:13}),e("span",{children:"New worktree…"})]}),e("button",{type:"button",onClick:k,className:"w-full text-left px-3 py-2 hover:bg-error/10 text-error flex items-center space-x-2",children:[e(L,{size:13}),e("span",{children:"Delete Workspace"})]})]});return h?e(d,{children:[e("div",{className:"px-3 py-1.5 text-xs text-ink/80 font-medium",children:"Delete workspace?"}),e("button",{type:"button",onClick:x,className:"w-full text-left px-3 py-1.5 hover:bg-ink/5 cursor-pointer flex items-center space-x-2 text-error",children:[e(L,{size:12}),e("span",{children:"Yes, delete"})]}),e("button",{type:"button",onClick:v,className:"w-full text-left px-3 py-1.5 hover:bg-ink/5 cursor-pointer flex items-center space-x-2 text-ink/70",children:e("span",{children:"Cancel"})})]}):e(d,{children:[l&&e("button",{type:"button",onClick:l,className:"w-full text-left px-3 py-1.5 hover:bg-ink/5 cursor-pointer flex items-center space-x-2 text-ink/80",children:[e(Mt,{size:12}),e("span",{children:"Go to Explorer"})]}),e("button",{type:"button",onClick:g,className:"w-full text-left px-3 py-1.5 hover:bg-ink/5 cursor-pointer flex items-center space-x-2 text-ink/80",children:[t?e(vl,{size:12}):e(Na,{size:12}),e("span",{children:t?"Unpin Workspace":"Pin Workspace"})]}),c&&e("button",{type:"button",onClick:c,className:"w-full text-left px-3 py-1.5 hover:bg-ink/5 cursor-pointer flex items-center space-x-2 text-ink/80",children:[e(Qr,{size:12}),e("span",{children:"Select sessions"})]}),p&&e("button",{type:"button",onClick:p,className:"w-full text-left px-3 py-1.5 hover:bg-ink/5 cursor-pointer flex items-center space-x-2 text-ink/80",children:[e(ge,{size:12}),e("span",{children:"New worktree…"})]}),e("button",{type:"button",onClick:k,className:"w-full text-left px-3 py-1.5 hover:bg-ink/5 cursor-pointer flex items-center space-x-2 text-error",children:[e(L,{size:12}),e("span",{children:"Delete Workspace"})]})]})}function _e({ancestors:r,isLast:t,first:l,style:c}){let p=c.insetPx+c.slotWidth/2,h=c.slotWidth/2+c.markGap+c.glyph/2,g=h+c.insetPx-p,x=2,k=p-1,v=l?t?{left:k,top:-6,height:"calc(50% + 6px)"}:{left:k,top:-6,bottom:-2}:t?{left:k,top:0,height:"50%"}:{left:k,top:0,bottom:-2};return e(d,{children:[r.map((N,y)=>e("span",{"data-guide":"ancestor","data-continues":N?void 0:"true","aria-hidden":"true",className:"relative shrink-0",style:{width:h},children:!N&&e("span",{className:"absolute z-10 bg-ink/40",style:{left:k,top:0,bottom:-2,width:2}})},y)),e("span",{"data-guide":"connector","data-last":t?"true":void 0,"data-first":l?"true":void 0,"aria-hidden":"true",className:"relative shrink-0",style:{width:h},children:[e("span",{className:"absolute z-10 bg-ink/40",style:{width:2,...v}}),e("span",{className:"absolute z-10 bg-ink/40",style:{left:k,top:"calc(50% - 1px)",width:g+1,height:2}})]})]})}function Vt({subagent:r,sessionId:t,style:l,running:c}){let[p]=le(),h=r.id===p.get("subagent"),g=oh(r),x=r.task??r.assignment??r.description??g;return e("div",{className:"group/subagent-row flex items-center",children:[e("button",{type:"button",title:x,onClick:()=>window.dispatchEvent(new CustomEvent("omp:view-subagent",{detail:{sessionId:t,subagent:r}})),className:`flex-1 min-w-0 flex items-center text-left text-xs rounded-md ${l.inset} ${l.padding} cursor-pointer transition-colors select-none ${h?"bg-ink/10 font-medium text-ink":"text-ink/70 hover:text-ink hover:bg-ink/5"}`,children:[e("span",{"data-testid":"subagent-status-slot",className:"w-4 h-4 flex items-center justify-center shrink-0",children:e(Im,{status:r.status,live:c,size:11})}),e("span",{className:"w-2 shrink-0"}),e("span",{"data-testid":"subagent-mark",className:"mr-1.5 flex shrink-0 items-center text-ink/55",children:e(At,{size:l.glyph,"aria-hidden":"true"})}),e("span",{className:"flex-1 min-w-0 truncate leading-snug",children:g})]}),c&&e("button",{type:"button",title:"Stop this subagent","aria-label":"Stop this subagent",onClick:()=>void _m(t,r.id),className:"touch-visible shrink-0 mr-1 w-5 h-5 flex items-center justify-center rounded text-ink/40 hover:text-error hover:bg-error/5 opacity-0 group-hover/subagent-row:opacity-100 transition-opacity cursor-pointer",children:e(Jn,{size:10})})]})}var Ho={pending:"started",running:"started",completed:"completed",failed:"failed",aborted:"aborted"};function Uo(r,t){return r.map((l)=>{if(t.id!==void 0){if(l.id!==t.id)return l}else if(t.index===void 0||t.index<0||l.index!==t.index)return l;let c=t.status&&l.status==="started"?Ho[t.status]??l.status:l.status;return{...l,status:c,progress:{...l.progress,...t},lastUpdate:Date.now()}})}function qt(r,t,l){let[c,p]=n([]),[h,g]=n(!1);return o(()=>{if(!l)return;let x=!1;return p([]),g(!0),ih(r).then((k)=>{if(x||!k)return;let v=k.map(Sm);p((N)=>Nm(N,v))}).finally(()=>{if(!x)g(!1)}),()=>{x=!0}},[r,l]),o(()=>{if(!l||!t)return;let x=!1,k=Date.now(),v=(T)=>T.sessionId===r?T.payload:null,N=rl("subagent_lifecycle",(T)=>{let C=Tm(v(T));if(C)p((S)=>Nm(S,[C]))}),y=rl("subagent_progress",(T)=>{let C=Dm(v(T));if(C)p((S)=>Uo(S,C))});return fetch(`/api/agent/${encodeURIComponent(r)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"get_subagents"})}).then((T)=>T.ok?T.json():null).then((T)=>{if(x||!w(T))return;let C="data"in T?T.data:T;p((S)=>Nm(S,sh(C),k))}).catch(()=>{}),()=>{x=!0,N(),y()}},[l,t,r]),{subagents:c,isLoading:h}}function Is(r,t,l,c,p=!1){let h=String(r.id);return{expandable:(t.get(h)?.length??0)>0||Boolean(r.hasSubagents),isExpanded:l.has(h),onToggleExpand:()=>c(h),isChild:p}}function yi({parentId:r,hasSubagents:t,childrenOf:l,expandedIds:c,onToggle:p,activeSessionId:h,renderSession:g,style:x,ancestors:k=[]}){let v=l.get(r)??[],{subagents:N,isLoading:y}=qt(r,h===r,t),T=[...v.map((C)=>({kind:"session",session:C})),...N.map((C)=>({kind:"subagent",subagent:C}))];if(T.length===0){if(!y)return null;return e("div",{"data-testid":"session-branch",className:"space-y-0.5",children:e("div",{className:"flex items-stretch",children:[e(_e,{ancestors:k,isLast:!0,first:!0,style:x}),e("div",{className:`flex min-w-0 flex-1 items-center text-xs italic text-ink/40 ${x.inset} ${x.padding}`,children:"Loading subagents…"})]})})}return e("div",{"data-testid":"session-branch",className:"space-y-0.5",children:T.map((C,S)=>{let I=S===T.length-1;if(C.kind==="subagent")return e("div",{className:"flex items-stretch",children:[e(_e,{ancestors:k,isLast:I,first:S===0,style:x}),e("div",{className:"min-w-0 flex-1",children:e(Vt,{subagent:C.subagent,sessionId:r,style:x,running:h===r&&C.subagent.status==="started"})})]},`subagent:${C.subagent.id}`);let P=String(C.session.id),F={expandable:(l.get(P)?.length??0)>0||Boolean(C.session.hasSubagents),isExpanded:c.has(P),onToggleExpand:()=>p(P),isChild:!0};return e(d,{children:[e("div",{className:"flex items-stretch",children:[e(_e,{ancestors:k,isLast:I,first:S===0,style:x}),e("div",{className:"min-w-0 flex-1",children:g(C.session,F)})]}),F.isExpanded&&e(yi,{parentId:P,hasSubagents:Boolean(C.session.hasSubagents),childrenOf:l,expandedIds:c,onToggle:p,activeSessionId:h,renderSession:g,style:x,ancestors:[...k,I]})]},P)})})}function qo(r){let t=new Set(r.map((p)=>String(p.id))),l=new Map,c=[];for(let p of r){let h=p.parentSessionId;if(!h||!t.has(h)||h===String(p.id)){c.push(p);continue}let g=l.get(h);if(g)g.push(p);else l.set(h,[p])}return{roots:c,childrenOf:l}}function lt(r,t,l=1,c=new Set){if(c.has(r))return[];c.add(r);let p=[];for(let h of t.get(r)??[]){if(c.has(String(h.id)))continue;p.push({session:h,depth:l}),p.push(...lt(String(h.id),t,l+1,c))}return p}function Jt(r,t){return r.includes(t)?r.filter((l)=>l!==t):[...r,t]}function Qt(r,t){let l=new Set(r),c=t.filter((p)=>l.has(p)).length;return{count:c,all:t.length>0&&c===t.length,some:c>0&&c<t.length}}function Le(r,t){return r.filter((l)=>t?l.is_archived===1:l.is_archived!==1).map((l)=>String(l.id))}function en(r,t){let l=new Set(t);return r.filter((c)=>l.has(c))}function tn(r,t,{activeSessionId:l,sessionStatus:c={}}){if(r.length<=t)return{rendered:r,hiddenCount:0};let p=new Set;for(let v of r){let N=String(v.id);if((l!==null?String(l)===N:v.is_active===1)||c[N]==="stream"||Boolean(v.awaitingInput))p.add(N)}let h=qo(r),g=new Set,x=0;for(let v=0;v<h.roots.length;v+=1){let N=h.roots[v],y=String(N.id),T=lt(y,h.childrenOf),C=p.has(y)||T.some((S)=>p.has(String(S.session.id)));if(v<t||C){g.add(y);for(let S of T)g.add(String(S.session.id))}else x+=1}return{rendered:r.filter((v)=>g.has(String(v.id))),hiddenCount:x}}function nn(r,t){return r.mode==="workspace"||r.mode==="session"&&r.scopeFolderId===t}function on(r,t){return r.mode==="session"&&r.scopeFolderId===t}function _s({batch:r,folder:t,sessions:l,showArchived:c,visibleCount:p,activeSessionId:h,sessionStatus:g}){let x=r?nn(r,t.id):!1,k=r?on(r,t.id):!1,v=k?Le(l,c):x?[String(t.id)]:[],N=r&&x?r.summaryOf(v):null,y=tn(l,p,{activeSessionId:h,sessionStatus:g});return{folderCheckbox:x,sessionCheckboxes:k,folderSummary:N,selectableIds:v,toggleFolderSelection:()=>{if(!r)return;if(x&&!k){r.toggle(String(t.id));return}if(!k)return;if(N?.all)r.unselectAllOf(v);else r.selectAllOf(v)},rendered:k?l:y.rendered,hiddenCount:k?0:y.hiddenCount}}function Ss({touch:r=!1,onRetry:t,refreshing:l=!1}){return e("div",{role:"alert",className:`flex flex-col items-center justify-center gap-2 px-4 text-center ${r?"py-10":"py-8"}`,children:[e("span",{className:"flex h-8 w-8 items-center justify-center rounded-md border border-ink/10 bg-ink/5 text-muted",children:e(_,{size:15,"aria-hidden":"true"})}),e("p",{className:"text-xs font-semibold text-ink",children:"The session list could not be loaded."}),e("p",{className:`text-muted leading-relaxed ${r?"text-xs":"text-[11px]"}`,children:"The live connection closed before the first reply arrived. Your sessions are still on disk; they are not shown here because this tab never received them."}),e("button",{type:"button",onClick:t,disabled:l,"aria-busy":l,className:`mt-1 inline-flex items-center gap-1.5 rounded-md border border-ink/20 bg-paper px-2.5 font-medium text-ink transition-colors hover:bg-ink/5 disabled:opacity-60 ${r?"h-11 text-sm":"h-7 text-xs"}`,children:[e(D,{size:13,className:l?"animate-spin":void 0,"aria-hidden":"true"}),"Try again"]})]})}function rn({value:r,onChange:t,touch:l=!1}){return e("div",{className:l?"px-3 pt-3 pb-2":"px-3 pt-2 pb-2",children:e("div",{className:`flex items-center gap-1.5 rounded-lg border border-ink/10 bg-ink/[0.04] px-2 transition-colors focus-within:border-ink/30 focus-within:bg-paper ${l?"h-9":"h-7"}`,children:[e(O,{size:l?15:13,"aria-hidden":"true",className:"shrink-0 text-ink/35"}),e("input",{type:"search",value:r,onChange:(c)=>t(c.currentTarget.value),placeholder:"Search workspaces & sessions","aria-label":"Search workspaces and sessions",className:`kabmo-search-field min-w-0 flex-1 bg-transparent text-ink outline-none placeholder:text-ink/40 ${l?"text-[13px]":"text-xs"}`}),r.length>0&&e("button",{type:"button",onClick:()=>t(""),title:"Clear search","aria-label":"Clear search",className:"-mr-0.5 shrink-0 rounded p-0.5 text-ink/40 transition-colors cursor-pointer hover:bg-ink/10 hover:text-ink",children:e(b,{size:l?14:12})})]})})}var Te={all:32,running:69,runningCount:14,archived:79,select:66};function Ko(r,t){let l=[Te.all,Te.running+(r>0?Te.runningCount:0),Te.archived,...t?[Te.select]:[]];return l.reduce((c,p)=>c+p,0)+(l.length-1)*4}var Me={chip:105,icon:22};function an(r,t){if(!(r>0))return{select:"mini",harness:"icon",wrap:!1};let l=Ko(t,!1),c=(p,h)=>l+8+p+h<=r;if(c(Me.chip,Te.select))return{select:"chip",harness:"chip",wrap:!1};if(c(Me.chip,28))return{select:"button",harness:"chip",wrap:!1};if(c(Me.icon,28))return{select:"button",harness:"icon",wrap:!1};if(c(Me.icon,22))return{select:"mini",harness:"icon",wrap:!1};return{select:"mini",harness:"icon",wrap:!0}}var $e="inline-flex shrink-0 items-center gap-1 rounded-full border px-2 py-0.5 text-[11px] font-medium transition-colors cursor-pointer",dt="border-ink bg-ink text-paper",ze="border-ink/15 text-ink/60 hover:border-ink/30 hover:text-ink",Xo=(r)=>r?"Cancel":"Select";function ln({focus:r,onFocusChange:t,runningCount:l,showArchived:c,onToggleArchived:p,harnessFilter:h,onHarnessFilterChange:g,harnessOptions:x,selecting:k,onToggleSelect:v}){let{ref:N,width:y}=bs(0),T=an(y,l),C=k?e(b,{size:10}):e(Qr,{size:10}),S=e(ys,{options:x,value:h,onChange:g,form:T.wrap?"chip":T.harness});return e("div",{className:"px-3 pb-2",children:e("div",{ref:N,className:`flex items-center gap-1 ${T.wrap?"flex-wrap":"flex-nowrap"}`,children:[e("div",{className:"flex shrink-0 items-center gap-1",role:"group","aria-label":"Session filters",children:[e("button",{type:"button",onClick:()=>t("all"),"aria-pressed":r==="all",className:`${$e} ${r==="all"?dt:ze}`,children:"All"}),e("button",{type:"button",onClick:()=>t("running"),"aria-pressed":r==="running",title:l>0?`${l} running or waiting`:"Nothing running",className:`${$e} ${r==="running"?dt:ze}`,children:[e("span",{"aria-hidden":"true",className:`h-1.5 w-1.5 rounded-full ${l>0?"bg-current":"bg-current opacity-30"}`}),"Running",l>0&&e("span",{className:"font-mono tabular-nums opacity-70",children:l})]}),e("button",{type:"button",onClick:p,"aria-pressed":c,title:c?"Hide archived sessions":"Show archived sessions",className:`${$e} ${c?"border-warning/40 bg-warning/10 text-warning hover:bg-warning/15":ze}`,children:[e(tt,{size:10}),"Archived"]})]}),T.wrap?null:S,T.select==="chip"?e("button",{type:"button",onClick:v,"aria-pressed":k,title:k?"Cancel selection":"Select workspaces",className:`${$e} ml-auto ${k?dt:ze}`,children:[C,Xo(k)]}):e("button",{type:"button",onClick:v,title:k?"Cancel selection":"Select workspaces","aria-label":k?"Cancel selection":"Select workspaces","aria-pressed":k,className:`ml-auto inline-flex shrink-0 items-center justify-center rounded-md transition-colors cursor-pointer ${T.select==="mini"?"h-[22px] w-[22px]":"h-7 w-7"} ${k?"bg-ink/10 text-ink":"text-ink/55 hover:bg-ink/[0.06] hover:text-ink"}`,children:k?e(b,{size:T.select==="mini"?12:14}):e(Qr,{size:T.select==="mini"?12:14})}),T.wrap?S:null]})})}var Zo="shrink-0 inline-flex items-center justify-center rounded-md text-ink/55 transition-colors cursor-pointer hover:bg-ink/[0.06] hover:text-ink",Yo="bg-ink/10 text-ink",cn={"A-Z":"A–Z","Z-A":"Z–A",LATEST_SESSION:"Latest chat",LATEST_ADDED:"Latest added"};function un({onNewSession:r,onNewWorkspace:t,onScheduler:l,scheduledCount:c,onRefresh:p,refreshing:h,sortOption:g,optionsOpen:x,onToggleOptions:k,onCloseOptions:v,onSortChange:N,touch:y=!1}){let T=`${Zo} ${y?dn.mobile:dn.desktop}`,C=c>0?`Scheduled tasks (${c} armed)`:"Scheduled tasks";return e("div",{className:`flex items-center ${al} px-3 pb-2`,children:[e("button",{type:"button",onClick:r,title:"New Session","aria-label":"New Session",className:`flex min-w-0 flex-1 items-center justify-center gap-1.5 rounded-md bg-ink px-2 font-semibold text-canvas transition-colors cursor-pointer hover:bg-ink/90 ${y?"h-9 text-[13px]":"h-7 text-xs"}`,children:[e(Y,{size:y?16:14,className:"shrink-0"}),e("span",{className:"truncate",children:"New Session"})]}),e("div",{className:`flex shrink-0 items-center ${_c}`,children:[e("button",{type:"button",onClick:t,title:"New Workspace","aria-label":"New Workspace",className:T,children:e(sn,{size:y?16:14})}),e("button",{type:"button",onClick:l,title:C,"aria-label":c>0?`Scheduled tasks, ${c} armed`:"Scheduled tasks",className:`relative ${T}`,children:[e(Da,{size:y?16:14}),c>0&&e("span",{className:"absolute right-0.5 top-0.5 min-w-[10px] rounded-full bg-ink px-[2px] text-center text-[7px] font-semibold leading-[10px] text-canvas",children:c>9?"9+":c})]}),e("button",{type:"button",onClick:p,title:"Refresh sessions","aria-label":"Refresh sessions","aria-busy":h,className:T,children:e(D,{size:y?16:14,className:h?"animate-spin":""})}),e("div",{className:"relative",children:[e("button",{type:"button",onClick:k,title:`Sort: ${cn[g]}`,"aria-label":`Sort workspaces, currently ${cn[g]}`,"aria-haspopup":"menu","aria-expanded":x,className:`${T} ${x||g!=="A-Z"?Yo:""}`,children:e(hs,{size:y?16:14})}),x&&e("div",{className:"glass-popover absolute right-0 top-full z-50 mt-1 w-48 rounded-lg border border-ink/15 bg-paper py-1 shadow-lg",onMouseLeave:v,children:e(Go,{variant:"desktop",sortOption:g,onSortChange:N})})]})]})]})}function pn({title:r,status:t,awaitingInput:l=!1,renaming:c=!1,waitingFor:p,expandable:h=!1,isExpanded:g=!1,onToggleExpand:x,child:k=!1,selectable:v=!1,selected:N=!1,onToggleSelect:y,touch:T=!1}){if(v)return e("span",{className:"flex shrink-0 items-center",children:[e(Rr,{checked:N,label:`Select ${r}`,onChange:()=>y?.()}),e("span",{className:"w-2 shrink-0"})]});let C=T?14:13,S=Boolean(p),I=l||t==="stream"||S,P=Boolean(h&&x)&&!I&&!c,A=Boolean(c||l||S||t)&&!P;return e(d,{children:[e("span",{className:`relative shrink-0 ${T?"w-[18px] h-5":"w-4 h-4"}`,children:[h&&x&&e("button",{type:"button",onClick:(F)=>{F.stopPropagation(),x(F)},title:g?"Collapse sessions and subagents":"Expand sessions and subagents","aria-expanded":g,"aria-label":g?"Collapse sessions and subagents":"Expand sessions and subagents",className:`peer absolute inset-0 flex items-center justify-center rounded cursor-pointer transition-opacity ${P?"text-ink/55 hover:text-ink":"text-ink/40 opacity-0 hover:text-ink group-hover/item:opacity-100 focus-visible:opacity-100"}`,children:g?e(B,{size:C}):e(ie,{size:C})}),A&&e("span",{className:`pointer-events-none absolute inset-0 flex items-center justify-center text-ink/60 transition-opacity ${h?"group-hover/item:opacity-0 peer-focus-visible:opacity-0":""}`,children:c?e("span",{role:"status","aria-label":"Generating a name…",children:e(m,{size:C-1,className:"animate-spin"})}):l?e(Ne,{size:C-1,className:"animate-pulse text-warning"}):S?e("span",{role:"status","aria-label":`Waiting for ${p?.title??"another session"}`,children:e(Ge,{size:C-1,className:"animate-pulse"})}):t==="stream"?e("span",{role:"status","aria-label":"Running",children:e(m,{size:C-1,className:"animate-spin"})}):e(f,{size:C-1})}),k&&!(h&&x)&&!A&&e("span",{"data-testid":"child-indicator","aria-hidden":"true",className:"pointer-events-none absolute inset-0 flex items-center justify-center text-ink/35",children:e(ge,{size:C-1,"aria-hidden":"true"})})]}),e("span",{className:"w-2 shrink-0"})]})}function mn({timeAgo:r,timeTitle:t,runStartedAt:l,onOpenMenu:c,menuOpen:p=!1,touch:h=!1}){let g=(k)=>e(Cs,{timeAgo:r,timeTitle:t,runStartedAt:l,className:k});if(!c)return g("ml-2 shrink-0 font-mono text-[10px]");let x=e("button",{type:"button",onClick:c,title:"Session actions","aria-label":"Session actions","aria-haspopup":"menu","aria-expanded":p,className:`shrink-0 rounded text-ink/40 hover:bg-ink/10 hover:text-ink cursor-pointer ${h?"p-1.5":"p-1"} ${h?"":"opacity-0 transition-opacity group-hover/item:opacity-100 group-focus-within/item:opacity-100 focus-visible:opacity-100"}`,children:e(Ie,{size:h?16:14})});if(h)return e("span",{className:"ml-1 flex shrink-0 items-center gap-0.5",children:[g("font-mono text-[10px]"),x]});return e("span",{className:"relative ml-2 flex h-4 min-w-8 shrink-0 items-center justify-end pr-1",children:[g("whitespace-nowrap font-mono text-[10px] leading-none transition-opacity group-hover/item:opacity-0 group-focus-within/item:opacity-0"),e("span",{className:"absolute right-0 -my-1 flex",children:x})]})}function fn(r){return{inset:r?"pl-1 pr-1":"pl-1 pr-[3px]",insetPx:4,slotWidth:r?18:16,markGap:8,padding:r?"py-0.5":"py-[7px]",glyph:r?Je.touch:Je.compact}}function bn({sessionId:r,title:t,harness:l,isActive:c=!1,isArchived:p=!1,status:h,awaitingInput:g=!1,timeAgo:x,timeTitle:k,runStartedAt:v,worktree:N,waitingFor:y,expandable:T=!1,isExpanded:C=!1,onToggleExpand:S,isChild:I=!1,folderId:P,onClick:A,onRename:F,onRenameWithAi:R,onArchive:M,onDelete:q,onCancelWait:Q,selectable:G=!1,selected:oe=!1,onToggleSelect:re,density:V="compact"}){let H=V==="touch",K=Sa(r),z=Fo(),{isEditing:be,draft:me,setDraft:de,inputRef:ee,startRename:Se,handleKeyDown:ve,handleBlur:se}=Ro(t,F),ae=Boolean(F||M||q||Q),te=z.anchor!==null,ye=Boolean(y),ce=t.charAt(0).toUpperCase()+t.slice(1);if(be)return e("div",{className:`flex w-full items-center rounded-lg bg-ink/10 ${H?"px-2 py-1.5":"px-2 py-1"}`,children:e("input",{ref:ee,autoFocus:!0,value:me,onChange:(fe)=>de(fe.currentTarget.value),onClick:(fe)=>fe.stopPropagation(),onKeyDown:ve,onBlur:se,"aria-label":"Session name",className:"min-w-0 flex-1 rounded border border-ink/25 bg-paper px-2 py-0.5 text-xs text-ink outline-none focus:border-ink/50"})});return e(d,{children:[e("div",{"data-testid":"session-item","data-session-id":String(r),"data-selected":G&&oe?"true":void 0,"data-menu-open":te?"true":void 0,onClick:G?re:A,onContextMenu:ae&&!G?z.openAtCursor:void 0,className:`group/item relative flex w-full items-center rounded-lg text-xs transition-colors select-none cursor-pointer ${H?"py-0.5 pl-1 pr-1":"py-[7px] pl-1 pr-[3px]"} ${G&&oe||te?Es:c?"bg-ink/[0.08] font-medium text-ink":"text-ink/75 hover:bg-ink/[0.04] hover:text-ink"}`,children:[c&&!G&&e("span",{"aria-hidden":"true",className:"absolute left-0 top-1.5 bottom-1.5 w-[2px] rounded-full bg-ink"}),e(pn,{title:t,status:h,awaitingInput:g,renaming:K,waitingFor:y,expandable:T,isExpanded:C,onToggleExpand:S,child:I,selectable:G,selected:oe,onToggleSelect:re,touch:H}),l&&e("span",{className:"mr-1.5 flex shrink-0 items-center",children:e(He,{harness:l,size:H?Je.touch:Je.compact})}),e("span",{className:`flex min-w-0 flex-1 flex-col leading-snug ${p?"text-ink/45":""}`,children:[e("span",{className:"min-w-0 truncate",children:ce}),ye&&e("span",{className:"truncate text-[10px] font-normal text-ink/40",children:["waiting for ",y?.title??"another session"]}),N&&e(xs,{worktree:N})]}),e(mn,{timeAgo:x,timeTitle:k,runStartedAt:v,touch:H,menuOpen:te,onOpenMenu:ae&&!G?z.openBelow:void 0})]}),z.anchor&&e(Lo,{anchor:z.anchor,sessionId:r,...l?{harness:l}:{},...P!==void 0?{folderId:P}:{},isArchived:p,onRename:F?Se:void 0,onRenameWithAi:R,onArchive:M,onDelete:q,onCancelWait:Q,onClose:z.close})]})}function Vo(r){let t=r.parentElement;while(t){let l=getComputedStyle(t);if(/(auto|scroll|overlay)/.test(l.overflowY))return t;t=t.parentElement}return null}function gn(r){let[t,l]=n(!1);return o(()=>{let c=r.current;if(!c)return;let p=Vo(c),h=!1,g=()=>{h=!1;let v=p?p.getBoundingClientRect():{top:0},N=p?p.scrollTop>0:window.scrollY>0,y=c.getBoundingClientRect();l(N&&y.top<=v.top+0.5&&y.bottom>v.top)},x=()=>{if(h)return;h=!0,requestAnimationFrame(g)};g();let k=typeof ResizeObserver>"u"?null:new ResizeObserver(x);if(k?.observe(c),p)k?.observe(p);return(p??window).addEventListener("scroll",x,{passive:!0}),window.addEventListener("resize",x),()=>{h=!1,k?.disconnect(),(p??window).removeEventListener("scroll",x),window.removeEventListener("resize",x)}},[r]),t}function xn({folder:r,isOpen:t,onToggleFolder:l,sessionCount:c,checkbox:p,batchActive:h,showMenu:g,onToggleMenu:x,onCloseMenu:k,onNewSession:v,menu:N,touch:y=!1}){let T=na(r.icon),C=r.accentColor||void 0,S=i(null),[I,P]=n(null),A=i(null),F=gn(A);return e("div",{ref:A,"data-stuck":F?"":void 0,className:`group/ws sticky top-0 z-10 -mx-1 flex items-center gap-1 rounded-md px-1 text-xs font-semibold text-ink ${y?"h-8 bg-canvas glass-sticky":"h-[26px] bg-paper glass-sticky"}`,children:[e("button",{type:"button",onClick:h?void 0:l,"aria-expanded":t,"aria-label":`${r.name}${t?", collapse":", expand"}`,className:"flex h-full min-w-0 flex-1 items-center gap-2 rounded-md px-1 text-left cursor-pointer hover:bg-ink/[0.04]",children:[p?e(Rr,{size:"md",checked:p.checked,indeterminate:p.indeterminate,label:p.label,onChange:p.onChange}):e("span",{className:`relative flex shrink-0 items-center justify-center ${y?"h-[18px] w-[18px]":"h-4 w-4"}`,children:r.customIconUrl?e("img",{src:r.customIconUrl,alt:"",className:"h-[15px] w-[15px] shrink-0 rounded-xs object-contain",referrerPolicy:"no-referrer"}):e(T,{size:15,className:"project-accent-mark text-ink/70",style:tl(C)})}),e("span",{className:"glass-sticky-label truncate text-[13px] font-semibold tracking-tight",children:r.name}),r.isPinned&&e(Na,{size:10,className:"shrink-0 text-ink/45"}),C&&!p&&e("span",{"aria-hidden":"true",className:"h-1.5 w-1.5 shrink-0 rounded-full",style:{backgroundColor:C}}),e("span",{className:"glass-sticky-label shrink-0 font-mono text-[10px] font-normal tabular-nums text-ink/35",children:c}),e("span",{className:"ml-auto shrink-0 text-ink/40",children:t?e(B,{size:y?14:12}):e(ie,{size:y?14:12})})]}),!h&&e("div",{className:`flex shrink-0 items-center gap-0.5 ${y?"pr-1":"pr-[3px]"}`,children:[e("button",{type:"button",title:"New Session","aria-label":`New session in ${r.name}`,onClick:(R)=>{R.stopPropagation(),v()},className:`flex items-center justify-center rounded text-ink/40 transition-colors cursor-pointer hover:bg-ink/10 hover:text-ink ${y?"h-7 w-7":"h-[22px] w-[22px]"}`,children:e(Y,{size:y?15:12})}),e("div",{className:"relative flex items-center",children:[e("button",{ref:S,type:"button",title:`Options for ${r.name}`,"aria-label":`Options for ${r.name}`,"aria-haspopup":"menu","aria-expanded":g,onClick:(R)=>{if(R.stopPropagation(),S.current)P(xt(S.current));x()},className:`flex items-center justify-center rounded text-ink/40 transition-colors cursor-pointer hover:bg-ink/10 hover:text-ink ${y?"h-7 w-7":"h-[22px] w-[22px]"}`,children:e(Ie,{size:y?15:12})}),e(Dt,{anchor:g&&N?I:null,align:"end",ariaLabel:`Options for ${r.name}`,className:"glass-popover w-44 rounded-md border border-ink/15 bg-paper py-1 text-xs shadow-lg",onClose:k,children:N})]})]})]})}function kn({hiddenCount:r,canShowLess:t,onShowMore:l,onShowLess:c}){if(r<=0&&!t)return null;return e("div",{className:"flex items-center gap-1 pl-6",children:[r>0&&e("button",{type:"button",onClick:l,className:"min-w-0 truncate rounded-md px-1 py-1 text-[11px] text-ink/45 transition-colors cursor-pointer hover:bg-ink/[0.04] hover:text-ink/80",children:[e(B,{size:11,className:"mr-1 inline align-[-2px]"}),r," more"]}),t&&e("button",{type:"button",onClick:c,className:"ml-auto shrink-0 rounded-md px-1 py-1 text-[11px] text-ink/45 transition-colors cursor-pointer hover:bg-ink/[0.04] hover:text-ink/80",children:[e(nt,{size:11,className:"mr-1 inline align-[-2px]"}),"Less"]})]})}function Sn({folder:r,activeSessionId:t,sessionStatus:l,showArchived:c,forceExpanded:p=!1,density:h="compact",batch:g,onSelectSession:x,onNewSessionForFolder:k,onNewWorktreeSession:v,onToast:N,onStartSessionSelection:y,onCancelWait:T}){let[C,S]=n(r.isExpanded||!1),[I,P]=n(!1),[A,F]=n(!1),{visibleCount:R,showMore:M,showLess:q,canShowLess:Q}=vs(),[G]=le(),oe=G.get("subagent"),re=G.get("sessionId"),{expandedSessionIds:V,toggleSession:H}=us(),{refresh:K,runStartedAtMap:z}=We(),be=ct(),{confirmDelete:me,requestDelete:de,cancelDelete:ee,handlePin:Se,handleDelete:ve,handleArchive:se,handleRename:ae,handleRenameWithAi:te,handleOpenFolder:ye}=ks(r,K,N),ce=No();o(()=>{if(typeof r.isExpanded==="boolean")S(r.isExpanded)},[r.isExpanded]);let fe=()=>{P(!1),ee()},Ze=()=>{let U=!C;if(S(U),typeof r.id!=="number")return;be.submit({isExpanded:String(U)},{method:"POST",action:`/api/folders/${r.id}/toggle`})},Oe=r.sessions.filter((U)=>c?U.is_archived===1:U.is_archived!==1),{folderCheckbox:Ee,sessionCheckboxes:Re,folderSummary:xe,toggleFolderSelection:Ye,rendered:Ve,hiddenCount:j}=_s({batch:g,folder:r,sessions:Oe,showArchived:c,visibleCount:R,activeSessionId:t,sessionStatus:l}),J=qo(Ve),X=p||C||Re,Pe=(U,we)=>{let ue=String(U.id),mt=t===null?U.is_active===1:String(t)===ue,Vn=mt&&re===ue&&Boolean(oe),qe=Ct(ue);return e(bn,{sessionId:U.id,title:U.title,harness:U.harness,folderId:U.folder_id,density:h,isActive:mt&&!Vn,isArchived:U.is_archived===1,status:l[ue],awaitingInput:Boolean(U.awaitingInput),timeAgo:ws(U.updated_at??U.created_at),timeTitle:jo(U.updated_at??U.created_at),runStartedAt:l[ue]==="stream"?z[ue]:void 0,worktree:U.worktree,waitingFor:U.waitingFor?{title:U.waitingFor.title}:void 0,expandable:we.expandable,isChild:we.isChild,isExpanded:we.isExpanded,onToggleExpand:we.onToggleExpand,onClick:()=>x(U.id),onArchive:()=>se(U),onDelete:qe?void 0:()=>ce.requestDelete(U),onRename:qe?void 0:(qn)=>void ae(U,qn),onRenameWithAi:qe?void 0:()=>void te(U),onCancelWait:U.waitingFor?()=>T?.(U.waitingFor.waitId):void 0,selectable:Re,selected:Boolean(g?.selected.includes(ue)),onToggleSelect:g?()=>g.toggle(ue):void 0})},Yn=(U)=>Is(U,J.childrenOf,V,H),pt=Boolean(v&&r.project_path);return e("div",{className:"space-y-0.5",children:[e(xn,{folder:r,isOpen:X,onToggleFolder:Ze,sessionCount:Oe.length,checkbox:Ee&&xe?{checked:xe.all,indeterminate:xe.some,label:`Select ${r.name}`,onChange:Ye}:null,batchActive:Boolean(g),showMenu:I,onToggleMenu:()=>P((U)=>!U),onCloseMenu:fe,onNewSession:()=>k(r.id),touch:h==="touch",menu:e(Bs,{variant:"desktop",isPinned:r.isPinned,onOpenFolder:ye?()=>{ye(),P(!1)}:void 0,onSelectSessions:y?()=>{P(!1),y(r.id)}:void 0,onNewWorktree:pt?()=>{P(!1),F(!0)}:void 0,confirmDelete:me,onPin:()=>{Se(),P(!1)},onDelete:()=>{ve(),P(!1)},onRequestDelete:de,onCancelDelete:ee})}),X&&e("div",{className:"space-y-0.5",children:[J.roots.map((U)=>{let we=String(U.id),ue=Yn(U);return e("div",{className:"space-y-0.5",children:[Pe(U,ue),ue.isExpanded&&e(yi,{parentId:we,hasSubagents:Boolean(U.hasSubagents),childrenOf:J.childrenOf,expandedIds:V,onToggle:H,activeSessionId:t===null?null:String(t),renderSession:Pe,style:fn(h==="touch")})]},U.id)}),!Re&&e(kn,{hiddenCount:j,canShowLess:Q,onShowMore:M,onShowLess:q}),Oe.length===0&&e("div",{className:"px-1 py-1 pl-6 text-[11px] italic text-ink/40",children:c?"No archived sessions.":"No sessions."})]}),e(Qo,{session:ce.pending,isDeleting:ce.isDeleting,error:ce.error,onClose:ce.cancelDelete,onConfirm:()=>void ce.confirmDelete()}),pt&&e(Mo,{isOpen:A,onClose:()=>F(!1),root:r.project_path??null,folderId:r.id,folderName:r.name,onCreated:(U)=>{F(!1),v?.(r.id,U.path)}})]})}var Jo=[3,2];function vn({touch:r=!1}){return e("div",{className:"space-y-3","aria-hidden":"true",children:Jo.map((t,l)=>e("div",{className:"space-y-0.5",children:[e("div",{className:`flex items-center gap-2 px-1 ${r?"h-8":"h-[26px]"}`,children:[e("span",{className:`animate-pulse rounded-sm bg-ink/10 ${r?"h-[18px] w-[18px]":"h-4 w-4"}`}),e("span",{className:"h-3 w-24 animate-pulse rounded bg-ink/10"})]}),Array.from({length:t},(c,p)=>e("div",{className:`flex items-center gap-2 pl-1 pr-2 ${r?"h-8":"h-[31px]"}`,children:[e("span",{className:`shrink-0 animate-pulse rounded-full bg-ink/10 ${r?"h-[18px] w-[18px]":"h-4 w-4"}`}),e("span",{className:"h-3 animate-pulse rounded bg-ink/10",style:{width:`${58-p%3*12}%`}})]},p))]},l))})}function yn(r,t){if(r.awaitingInput)return!0;if(r.waitingFor)return!0;return t==="stream"}function wn(r,{focus:t,statusOf:l}){if(t==="all")return r;return r.map((c)=>({...c,sessions:c.sessions.filter((p)=>yn(p,l(String(p.id))))})).filter((c)=>c.sessions.length>0)}function Nn(r,t){let l=0;for(let c of r)for(let p of c.sessions)if(yn(p,t(String(p.id))))l+=1;return l}function du({className:r="",folders:t,initializing:l,failed:c,activeSessionId:p,sessionStatus:h,searchQuery:g,onSearchChange:x,showArchived:k,onToggleArchived:v,sortOption:N,optionsOpen:y,onToggleOptions:T,onCloseOptions:C,onSortChange:S,harnessFilter:I,onHarnessFilterChange:P,harnessOptions:A,onRefresh:F,refreshing:R,scheduledCount:M,onNewSession:q,onNewWorkspace:Q,onScheduler:G,onSelectSession:oe,onNewSessionForFolder:re,onNewWorktreeSession:V,onToast:H,onCancelWait:K,batch:z,onSelectWorkspaces:be,onStartSessionSelection:me,touch:de=!1}){let[ee,Se]=n("all"),ve=u(()=>Nn(t,(te)=>h[te]),[t,h]),se=u(()=>wn(t,{focus:ee,statusOf:(te)=>h[te]}),[t,ee,h]),ae=Boolean(z);return e("div",{className:`flex flex-col ${r}`,children:[e(rn,{value:g,onChange:x,touch:de}),e(ln,{focus:ee,onFocusChange:Se,runningCount:ve,showArchived:k,onToggleArchived:v,harnessFilter:I,onHarnessFilterChange:P,harnessOptions:A,selecting:ae,onToggleSelect:be}),e(un,{onNewSession:q,onNewWorkspace:Q,onScheduler:G,scheduledCount:M,onRefresh:F,refreshing:R,sortOption:N,optionsOpen:y,onToggleOptions:T,onCloseOptions:C,onSortChange:S,touch:de}),e("div",{className:"mt-1 flex-1 scrollbar-overlay-container pl-2 session-list-gutter pb-3",children:c?e(Ss,{touch:de,onRetry:F,refreshing:R}):l?e(vn,{touch:de}):se.length===0?e("div",{className:"px-1 py-8 text-center text-[11px] leading-relaxed text-muted",children:ee==="running"?"Nothing is running right now.":g?"No workspace or chat matches that search.":I?`No chats on ${ea(I)}.`:"No workspaces yet."}):e("div",{className:"space-y-3",children:se.map((te)=>e(Sn,{folder:te,activeSessionId:p,sessionStatus:h,showArchived:k,forceExpanded:g.trim().length>0,density:de?"touch":"compact",batch:z,onSelectSession:oe,onNewSessionForFolder:re,onNewWorktreeSession:V,onToast:H,onStartSessionSelection:me,onCancelWait:K},te.id))})})]})}function er(r){if(!r)return Number.NaN;let t=Date.parse(r);return Number.isFinite(t)?t:Number.NaN}function Tn(r){let t=Number.NEGATIVE_INFINITY;for(let l of r.sessions??[]){let c=er(l.updated_at??l.created_at);if(c>t)t=c}return t}function Cn(r){let t=Number.NEGATIVE_INFINITY;for(let l of r.sessions??[]){let c=Number(l.id);if(Number.isFinite(c)&&c>t)t=c}return t}function ke(r){let t=Number(r.id);return Number.isFinite(t)?t:Number.NEGATIVE_INFINITY}function Ue(r,t){if(r===t)return 0;return r>t?-1:1}function On(r,t){if(r===t)return 0;return r>t?1:-1}function tr(r,t,l){let c=Boolean(r.isPinned),p=Boolean(t.isPinned);if(c!==p)return c?-1:1;switch(l){case"Z-A":{let h=t.name.localeCompare(r.name);return h!==0?h:On(ke(r),ke(t))}case"LATEST_SESSION":{let h=Ue(Tn(r),Tn(t));if(h!==0)return h;let g=Ue(Cn(r),Cn(t));if(g!==0)return g;let x=Ue(ke(r),ke(t));return x!==0?x:r.name.localeCompare(t.name)}case"LATEST_ADDED":{let h=Ue(ke(r),ke(t));return h!==0?h:r.name.localeCompare(t.name)}case"A-Z":default:{let h=r.name.localeCompare(t.name);return h!==0?h:On(ke(r),ke(t))}}}function In(r,t){return[...r].sort((l,c)=>tr(l,c,t))}var nr=["A-Z","Z-A","LATEST_SESSION","LATEST_ADDED"],Rn="LATEST_SESSION";function Pn(r){return typeof r==="string"&&nr.includes(r)}function An(r,t,l){if(t.length===0||r.length===0)return r;let c=new Set;for(let g of r)for(let x of g.sessions??[])c.add(String(x.id));let p=t.filter((g)=>!c.has(String(g.id)));if(p.length===0)return r;let h=r;for(let g of p){let x=Dn(h,g,l);if(!x)continue;let k=new Date(g.createdAt).toISOString(),v={id:g.id,folder_id:x.id,title:g.title??l.titleFor?.(String(g.id))??Cm(g.id),created_at:k,updated_at:k,...g.parentSessionId?{parentSessionId:g.parentSessionId}:{},...g.harness?{harness:g.harness}:{},...g.waiting?{waitingFor:{waitId:g.waiting.waitId,sessionId:g.waiting.dependsOn,title:g.waiting.dependsOnTitle}}:{}};h=h.map((N)=>N.id===x.id?{...N,isExpanded:!0,sessions:[v,...N.sessions??[]]}:N)}return h}function En(r,t,l){if(t.length===0||r.length===0)return[];let c=new Set;for(let p of t){let h=Dn(r,p,l);if(h)c.add(String(h.id))}return[...c]}function Dn(r,t,l){if(t.folderId!==null&&t.folderId!==void 0){let c=r.find((p)=>String(p.id)===String(t.folderId));if(c)return c}if(l.activeId){let c=r.find((p)=>(p.sessions??[]).some((h)=>String(h.id)===String(l.activeId)));if(c)return c}if(l.urlFolderId){let c=r.find((p)=>String(p.id)===String(l.urlFolderId));if(c)return c}return r[0]}function Bn(r,t,l){if(!t.trim())return r;let c=t.toLowerCase(),p=(h)=>h.title.toLowerCase().includes(c)||String(h.id).toLowerCase().includes(c);if(l)return r.filter((h)=>{let g=h.name.toLowerCase().includes(c),x=h.sessions?.some(p);return g||x}).map((h)=>{let g=h.sessions?.filter((x)=>h.name.toLowerCase().includes(c)||p(x));return{...h,sessions:g,isExpanded:!0}});return r.map((h)=>{let g=h.name.toLowerCase().includes(c),x=(h.sessions||[]).filter(p);if(g)return h;return{...h,sessions:x}}).filter((h)=>h.sessions&&h.sessions.length>0)}async function Dd(r,t){try{return(await fetch(`/api/folders/${encodeURIComponent(String(r))}/toggle`,{method:"POST",body:new URLSearchParams({isExpanded:String(t)})})).ok}catch(l){return console.error("Failed to save workspace expansion:",l),!1}}function _n(r,t){return r.find((l)=>(l.sessions??[]).some((c)=>String(c.id)===t))}function Ln(r){let{folders:t,initializing:l,runningIds:c,pendingEntries:p,activeId:h,urlFolderId:g}=r,x=u(()=>{let v=new Set;for(let N of c){let y=_n(t,N);if(y)v.add(String(y.id))}return v},[t,c]),k=i({running:new Set,pending:new Set});return o(()=>{if(l||t.length===0)return;let v=k.current,N=new Set,y=new Set,T=new Set;for(let S of c){if(v.running.has(S)){N.add(S);continue}let I=_n(t,S);if(!I)continue;N.add(S),T.add(String(I.id))}let C={activeId:h,urlFolderId:g};for(let S of p){let I=String(S.id);if(v.pending.has(I)){y.add(I);continue}y.add(I);for(let P of En(t,[S],C))T.add(P)}v.running=N,v.pending=y;for(let S of T){let I=t.find((P)=>String(P.id)===S);if(!I||I.isExpanded)continue;Dd(S,!0)}},[l,t,c,p,h,g]),x}function $n(r){let t=new Map;for(let l of r)for(let c of l.sessions){if(!c.harness)continue;t.set(c.harness,(t.get(c.harness)??0)+1)}return[...t].map(([l,c])=>({harness:l,label:ea(l),count:c})).sort((l,c)=>c.count-l.count||l.label.localeCompare(c.label))}function Wn(r,t){if(!t)return r;return r.map((l)=>({...l,sessions:l.sessions.filter((c)=>c.harness===t)})).filter((l)=>l.sessions.length>0)}var or=200;function pu(r={},t={}){let{expandSearchMatches:l=!1,onSelectSession:c,onAfterSelect:p}=t,{folders:h,initializing:g,failed:x,refresh:k,refreshNow:v,refreshing:N,isRefreshing:y,markSeen:T,hasSeen:C,streamStatusMap:S,titleHint:I}=We(),[P,A]=le(),F=P.get("sessionId"),R=P.get("folderId"),M=F?Number.isNaN(Number(F))?F:Number(F):null,q=i(k);q.current=k;let Q=a(()=>q.current(),[]),[G,oe]=n(""),[re,V]=n(!1),[H,K]=n(null),[z,be]=n(!1),[me,de]=n(()=>Pn(r.omp_sidebar_sort)?r.omp_sidebar_sort:Rn),ee=i(null),Se=a((j)=>{if(ee.current)clearTimeout(ee.current);ee.current=setTimeout(()=>{ot("omp_sidebar_sort",j)},or)},[]);o(()=>()=>{if(ee.current)clearTimeout(ee.current)},[]);let ve=(j)=>{de(j),be(!1),Se(j)},se=S;nh(se,M,Q,C);let ae=Em(),{prompts:te,loaded:ye}=Sc(),ce=u(()=>new Set(Object.entries(se).filter(([,j])=>j==="stream").map(([j])=>j)),[se]),fe=Ln({folders:h,initializing:g,runningIds:ce,pendingEntries:ae,activeId:F,urlFolderId:R});o(()=>{if(!F||g)return;if(h.some((j)=>(j.sessions??[]).some((J)=>String(J.id)===F)))return;rh(F,R,se[F]==="stream")},[F,h,g,R,se]),o(()=>{if(g||!ye)return;for(let j of ae){let J=String(j.id),X=te.find((Pe)=>Pe.pendingId===J&&Pe.status==="waiting");if(!X||j.waiting?.waitId===X.id)continue;Qm(J,{waitId:X.id,dependsOn:X.dependsOn,dependsOnTitle:X.dependsOnTitle})}},[ae,te,ye,g]);let[Ze,Oe]=n(0),Ee=ae.map((j)=>String(j.id)).join(`
|
|
2
|
-
`);o(()=>{let j=()=>Oe((X)=>X+1),J=Ee.split(`
|
|
3
|
-
`).filter(Boolean).flatMap((X)=>[jr(X,ls,j),jr(X,cs,j)]);return()=>{for(let X of J)X()}},[Ee]),o(()=>{if(g)return;let j=new Set;for(let J of h)for(let X of J.sessions??[])j.add(String(X.id));ah({listed:j,running:ce,activeId:F})},[h,g,ce,F,Ze]);let Re=(j)=>{if(T(j),c)c(j);else A((J)=>{let X=Nt(J);if(X.set("sessionId",j.toString()),X.has("subagent"))X.delete("subagent");return X},{replace:!0});p?.()},xe=u(()=>An(h,ae,{activeId:F,urlFolderId:R,titleFor:I}),[h,ae,F,R,I]),Ye=u(()=>$n(xe),[xe]),Ve=u(()=>{let j=Bn(xe,G,l);if(j=Wn(j,H),fe.size>0)j=j.map((J)=>fe.has(String(J.id))?{...J,isExpanded:!0}:J);return In(j,me)},[xe,G,H,me,l,fe]);return{folders:h,initializing:g,failed:x,refresh:Q,refreshNow:v,refreshing:N,isRefreshing:y,activeSessionId:M,sessionParam:F,searchQuery:G,setSearchQuery:oe,showArchived:re,setShowArchived:V,optionsOpen:z,setOptionsOpen:be,sortOption:me,handleSortChange:ve,harnessFilter:H,setHarnessFilter:K,harnessOptions:Ye,processedFolders:Ve,sessionStatus:se,handleSelectSession:Re}}function mu({onNotice:r}={}){let{prompts:t}=Sc(),[,l]=le(),c=i(r);c.current=r;let p=i(new Set);o(()=>{let h=new URLSearchParams(window.location.search).get("sessionId");for(let g of t){let{pendingId:x,targetSessionId:k}=g,v=x?lh(x):null,N=Boolean(x)&&(Boolean(v)||h===x),y=Boolean(k)&&h===k;if(!x&&!k)continue;let T=`${g.id}:${g.status}`;if(p.current.has(T))continue;if(g.status==="dispatched"&&g.sessionId){if(p.current.add(T),x&&N)Ic(x,g.sessionId,g.folderId),l((C)=>{if(C.get("sessionId")!==x)return C;let S=Nt(C);return S.set("sessionId",g.sessionId),S},{replace:!0}),c.current?.("Waiting finished — your prompt is now running in a new session.","success");else if(k&&y)c.current?.("Waiting finished — your prompt is now running in this chat.","success");continue}if(g.status==="error"){if(p.current.add(T),!N&&!y)continue;if(ad(g),x)rd(x);c.current?.(`The prompt you held was not sent: ${g.error??"the dispatch failed."} Your draft is back in the composer.`,"error");continue}if(g.status==="cancelled"){if(p.current.add(T),!N&&!y)continue;if(ad(g),x)rd(x)}}},[t,l])}async function fu(r){let t=await fetch("/api/folders",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),l=await t.json().catch(()=>({}));if(!t.ok||!l.success)throw Error(l.error||`HTTP ${t.status}`);window.location.reload()}async function gu(r){let t=await fetch("/api/folders/clone",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),l=await t.json().catch(()=>({}));if(!t.ok||!l.success)throw Error(l.error||`HTTP ${t.status}`);window.location.reload()}function zn(){let[r,t]=n(null),[l,c]=n(null),[p,h]=n([]),g=a((T,C)=>{t(T),c(T==="session"?C??null:null),h([])},[]),x=a(()=>{t(null),c(null),h([])},[]),k=a((T)=>{h((C)=>Jt(C,T))},[]),v=a((T)=>{h((C)=>[...new Set([...C,...T])])},[]),N=a((T)=>{h((C)=>{let S=new Set(T);return C.filter((I)=>!S.has(I))})},[]),y=a((T)=>Qt(p,T),[p]);return u(()=>({mode:r,scopeFolderId:l,selected:p,begin:g,end:x,toggle:k,selectAllOf:v,unselectAllOf:N,summaryOf:y}),[r,l,p,g,x,k,v,N,y])}var je=500,Hn=200;function Ke(r,t){if(!Number.isSafeInteger(t)||t<1)throw Error(`chunkIds needs a positive integer limit, got ${t}`);let l=[];for(let c=0;c<r.length;c+=t)l.push(r.slice(c,c+t));return l}var Xe={removed:[],refused:[]};async function rr(r,t){try{let l=await fetch(r,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({ids:t})}),c=await l.json().catch(()=>null);if(!l.ok)return{...Xe,error:c?.error||`Could not delete (HTTP ${l.status}).`};return{removed:Array.isArray(c?.removed)?c.removed:[],refused:Array.isArray(c?.refused)?c.refused:[]}}catch(l){return{...Xe,error:l instanceof Error?l.message:"Could not reach the server."}}}async function Un(r,t,l,c){let p=[],h=[],g,x=0;for(let k of Ke(t,l)){let v=await rr(r,k);p.push(...v.removed),h.push(...v.refused),g??=v.error,x+=k.length,c?.({done:x,total:t.length})}return{removed:p,refused:h,...g?{error:g}:{}}}function Gn(r,t){if(r.length===0)return Promise.resolve({...Xe});return Un("/api/sessions/batch-delete",r,je,t)}function jn(r,t){if(r.length===0)return Promise.resolve({...Xe});return Un("/api/folders/batch-delete",r,Hn,t)}function Kn(r){let[t,l]=n([]),[c,p]=n(!1),[h,g]=n(null),[x,k]=n(null),[v,N]=le(),y=a((S)=>{g(null),k(null),l([...S])},[]),T=a(()=>{g(null),k(null),l([])},[]),C=a(async(S)=>{if(t.length===0||c)return null;p(!0),g(null);let I=t;k({done:0,total:I.length});let P=(F)=>k(F),A=S==="workspace"?await jn(I,P):await Gn(I,P);if(S==="session"&&A.removed.length>0){for(let R of A.removed)Fp(R);let F=v.get("sessionId");if(F&&A.removed.includes(F))N((R)=>{let M=Nt(R);return M.delete("sessionId"),M.delete("subagent"),M},{replace:!0})}if(A.removed.length>0)r();if(g(A),k(null),p(!1),A.removed.length===I.length)l([]);return A},[t,c,v,N,r]);return{pending:t,isDeleting:c,outcome:h,progress:x,request:y,cancel:T,confirm:C}}var ut={archived:[],refused:[]};async function sr(r,t){try{let l=await fetch(r,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({ids:t})}),c=await l.json().catch(()=>null);if(!l.ok)return{...ut,error:c?.error||`Could not archive (HTTP ${l.status}).`};return{archived:Array.isArray(c?.archived)?c.archived:[],refused:Array.isArray(c?.refused)?c.refused:[]}}catch(l){return{...ut,error:l instanceof Error?l.message:"Could not reach the server."}}}async function Xn(r){if(r.length===0)return{...ut};let t=[],l=[],c;for(let p of Ke(r,je)){let h=await sr("/api/sessions/batch-archive",p);t.push(...h.archived),l.push(...h.refused),c??=h.error}return{archived:t,refused:l,...c?{error:c}:{}}}function Au(r){if(r.error)return{message:r.error,tone:"error"};let t=r.archived.length,l=r.refused.length;if(t===0&&l===0)return null;if(l===0)return{message:`Archived ${t} ${t===1?"session":"sessions"}.`,tone:"success"};if(t===0)return{message:`${l} ${l===1?"session":"sessions"} could not be archived.`,tone:"error"};return{message:`Archived ${t} ${t===1?"session":"sessions"}; ${l} refused.`,tone:"warning"}}function Zn(r){let[t,l]=n(!1),c=a(async(p)=>{if(p.length===0||t)return null;l(!0);let h=await Xn(p);if(h.archived.length>0)r();return l(!1),h},[t,r]);return{isArchiving:t,archive:c}}function hu(r,t,l){let c=zn(),p=Kn(l),h=Zn(l),g=c.scopeFolderId===null?null:r.find((y)=>y.id===c.scopeFolderId)??null,x=c.mode==="workspace"?r.map((y)=>String(y.id)):c.mode==="session"?Le(g?.sessions??[],t):[],k=en(c.selected,x),v=c.mode?{mode:c.mode,scopeFolderId:c.scopeFolderId,selected:c.selected,toggle:c.toggle,selectAllOf:c.selectAllOf,unselectAllOf:c.unselectAllOf,summaryOf:c.summaryOf}:void 0,N=a(()=>{if(c.mode==="workspace")c.end();else c.begin("workspace")},[c]);return{selection:c,deleteRun:p,archiveRun:h,binding:v,scopeFolder:g,available:x,selected:k,toggleWorkspaceSelection:N}}function bu({mode:r,count:t,total:l,busy:c,archiving:p=!1,scopeLabel:h,onSelectAll:g,onUnselectAll:x,onDelete:k,onArchive:v,onCancel:N,drawer:y=!1}){let T=r==="workspace"?"workspace":"session",C=t===1?T:`${T}s`,S=r==="session"&&h?` in ${h}`:"",I=c||p,P=I||t===0,A=r==="session"&&Boolean(v),F="min-w-0 w-full h-7 flex items-center justify-center gap-1 px-2 rounded border text-[11px] font-medium transition-colors cursor-pointer disabled:opacity-40",R="border-ink/20 text-ink hover:bg-ink/5";return e("div",{"data-testid":"batch-action-bar",className:`border-t border-ink/15 bg-paper ${y?"px-3":"px-2.5"} py-2 flex flex-col gap-1.5 flex-shrink-0`,children:[e("div",{className:"flex items-center justify-between gap-2 text-[11px]",children:[e("span",{className:"min-w-0 truncate text-ink/70",children:[e("span",{className:"font-semibold text-ink",children:t})," ","of ",l," ",l===1?T:`${T}s`," selected",S]}),e("button",{type:"button",onClick:N,disabled:I,title:"Cancel selection","aria-label":"Cancel selection",className:"shrink-0 w-5 h-5 flex items-center justify-center rounded text-ink/50 hover:text-ink hover:bg-ink/10 transition-colors cursor-pointer disabled:opacity-50",children:e(b,{size:13})})]}),e("div",{className:`grid gap-1.5 ${A?"grid-cols-2":"grid-cols-3"}`,children:[e("button",{type:"button",onClick:g,disabled:I||l===0||t===l,className:"min-w-0 w-full h-7 flex items-center justify-center gap-1 px-2 rounded border text-[11px] font-medium transition-colors cursor-pointer disabled:opacity-40 border-ink/20 text-ink hover:bg-ink/5",children:[e(ft,{size:12,className:"shrink-0"}),e("span",{className:"truncate",children:"Select all"})]}),e("button",{type:"button",onClick:x,disabled:I||t===0,className:"min-w-0 w-full h-7 flex items-center justify-center gap-1 px-2 rounded border text-[11px] font-medium transition-colors cursor-pointer disabled:opacity-40 border-ink/20 text-ink hover:bg-ink/5",children:e("span",{className:"truncate",children:"Unselect all"})}),A&&e("button",{type:"button",onClick:v,disabled:P,className:"min-w-0 w-full h-7 flex items-center justify-center gap-1 px-2 rounded border text-[11px] font-medium transition-colors cursor-pointer disabled:opacity-40 border-ink/20 text-ink hover:bg-ink/5",children:p?e(d,{children:[e(m,{size:12,className:"animate-spin shrink-0"}),e("span",{className:"truncate",children:"Archiving…"})]}):e(d,{children:[e(tt,{size:12,className:"shrink-0"}),e("span",{className:"truncate",children:["Archive ",t>0?`${t} ${C}`:C]})]})}),e("button",{type:"button",onClick:k,disabled:P,className:"min-w-0 w-full h-7 flex items-center justify-center gap-1 px-2 rounded bg-error text-canvas text-[11px] font-semibold hover:opacity-90 transition-opacity cursor-pointer disabled:opacity-40",children:c?e(d,{children:[e(m,{size:12,className:"animate-spin shrink-0"}),e("span",{className:"truncate",children:"Deleting…"})]}):e(d,{children:[e(L,{size:12,className:"shrink-0"}),e("span",{className:"truncate",children:["Delete ",t>0?`${t} ${C}`:C]})]})})]})]})}function yu({mode:r,count:t,scopeLabel:l,isDeleting:c,progress:p=null,outcome:h,onClose:g,onConfirm:x}){if(o(()=>{let I=(P)=>{if(P.key!=="Escape"||c)return;P.preventDefault(),g()};return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[g,c]),t===0)return null;let k=r==="session",v=k?"session":"workspace",N=t===1?v:`${v}s`,y=k&&l?` in ${l}`:"",T=!c&&h!==null,C=h?.removed.length??0,S=h?.refused??[];return e(Z,{onClose:c?()=>{}:g,zClass:"z-[70]",maxWidthClass:"max-w-[460px]",header:e("div",{className:"flex items-center gap-3 min-w-0",children:[e(L,{size:16,className:"text-error shrink-0"}),e("div",{className:"min-w-0",children:[e("h2",{className:"text-sm font-semibold text-ink",children:["Delete ",t," ",N,"?"]}),e("p",{className:"text-[11px] text-ink/50 truncate",children:y?y.trim():"Selected rows"})]})]}),footer:e("div",{className:"flex items-center justify-end gap-2 px-5 py-3.5 border-t border-ink/10",children:[e("button",{type:"button",onClick:g,disabled:c,className:"px-3.5 py-1.5 rounded-md border border-ink/20 text-xs font-medium text-ink hover:bg-ink/5 transition-colors cursor-pointer disabled:opacity-50",children:T?"Close":"Cancel"}),e("button",{type:"button",onClick:x,disabled:c||T,className:"px-3.5 py-1.5 rounded-md bg-error text-canvas text-xs font-medium hover:opacity-90 transition-opacity cursor-pointer disabled:opacity-50 flex items-center gap-1.5",children:c?e(d,{children:[e(m,{size:13,className:"animate-spin"}),e("span",{children:"Deleting…"})]}):e(d,{children:[e(L,{size:13}),e("span",{children:["Delete ",t," ",N]})]})})]}),children:e("div",{className:"px-5 py-4 space-y-3",children:[c&&e("div",{className:"space-y-1.5","data-testid":"batch-delete-progress",children:[e("div",{className:"flex items-center justify-between text-[11px] text-ink/60",children:[e("span",{children:["Deleting ",p?.done??0," of ",t,"…"]}),e("span",{children:[Math.round((p?.done??0)/Math.max(1,t)*100),"%"]})]}),e(Rm,{percent:(p?.done??0)/Math.max(1,t)*100,label:`Deleting ${t} ${N}`,tone:"error"})]}),k?e("ul",{className:"text-[11.5px] leading-relaxed text-ink/70 space-y-1.5",children:[e("li",{children:["Each transcript is removed from"," ",e("span",{className:"font-mono text-ink",children:"~/.omp/agent/sessions"})," — the conversations are gone from the sidebar and from oh-my-pi."]}),e("li",{children:"Chats that ran on another agent (opencode, dsh, …) are removed from that agent's own history too; one the agent cannot delete is refused, not silently forgotten."}),e("li",{children:"Their subagent transcripts, side questions, queued messages and saved layout go too."}),e("li",{children:"A session that is mid-run is refused rather than interrupted; stop it and delete again."})]}):e("ul",{className:"text-[11.5px] leading-relaxed text-ink/70 space-y-1.5",children:[e("li",{children:"The workspaces are removed from this sidebar."}),e("li",{children:["Their directories and every transcript on disk are left alone — re-add a workspace with"," ",e("span",{className:"font-mono text-ink",children:"New Workspace"})," when you want it back."]})]}),h?.error?e("div",{className:"flex items-start gap-2 px-3 py-2 rounded-md border border-error/30 bg-error/5 text-[11px] text-ink/75",children:[e(_,{size:13,className:"mt-0.5 shrink-0 text-error"}),e("span",{children:h.error})]}):T?e("div",{className:"flex items-start gap-2 px-3 py-2 rounded-md border border-ink/15 bg-ink/5 text-[11px] text-ink/75",children:e("span",{children:["Removed ",C," ",C===1?v:`${v}s`,S.length>0?`, ${S.length} refused:`:"."]})}):e("div",{className:"flex items-start gap-2 px-3 py-2 rounded-md border border-error/30 bg-error/5 text-[11px] text-ink/75",children:[e(_,{size:13,className:"mt-0.5 shrink-0 text-error"}),e("span",{children:k?"This cannot be undone from the UI. Archive a session instead to keep its transcript.":"This removes the sidebar entry only. The folder itself is not deleted."})]}),S.length>0&&e("ul",{className:"max-h-40 overflow-y-auto scrollbar-overlay-container space-y-1 text-[11px] text-ink/70",children:S.map((I)=>e("li",{className:"flex items-start gap-1.5",children:[e("span",{className:"font-mono text-ink/50 shrink-0 max-w-[7rem] truncate",title:I.id,children:I.id}),e("span",{className:"min-w-0",children:I.error})]},I.id))})]})})}
|
|
4
|
-
export{hs,Da,Qr,yl,lu,cu,Go,uu,bs,Sd,Bg,Ig,Td,_g,ys,vs,ks,Rr,xs,ws,jo,Cs,Es,Bs,Is,yi,qo,_s,Ss,du,Dd,pu,mu,fu,gu,Au,hu,bu,yu};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Bf}from"./index-b42t14wk.js";export{Bf as createInfoServices};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Yg}from"./index-ktbrmp29.js";export{Yg as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Zf}from"./index-feffxxss.js";export{Zf as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{gi}from"./index-hga3e13s.js";export{gi as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{kg}from"./index-pkes9492.js";export{kg as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Jf}from"./index-8b3t2y77.js";import"./index-03pyvmcz.js";export{Jf as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{xg}from"./index-e1yz59fa.js";export{xg as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{lA}from"./index-pzvr1699.js";export{lA as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{sA}from"./index-pzvr1699.js";export{sA as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{If}from"./index-b42t14wk.js";export{If as createPacketServices};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_f}from"./index-b42t14wk.js";export{_f as createPieServices};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Yg}from"./index-ktbrmp29.js";export{Yg as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{eg}from"./index-4cncqz8j.js";export{eg as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Vf}from"./index-hw14rhen.js";export{Vf as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{kf}from"./index-b42t14wk.js";export{kf as createRadarServices};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{xl}from"./index-b42t14wk.js";export{xl as createRailroadServices};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Cl}from"./index-b42t14wk.js";export{Cl as createRailroadAbnfServices};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{wl}from"./index-b42t14wk.js";export{wl as createRailroadEbnfServices};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{El}from"./index-b42t14wk.js";export{El as createRailroadPegServices};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{t}from"./index-cz50ha6x.js";import"./index-zndbhb9w.js";import{Nf,Qf}from"./index-v3f7we4n.js";var o=t((r)=>`${Nf(r)}
|
|
2
|
-
.swimlane.cluster:not([data-color-id]) rect {
|
|
3
|
-
stroke: ${r.clusterBorder} !important;
|
|
4
|
-
}
|
|
5
|
-
[data-look="neo"].cluster rect {
|
|
6
|
-
filter: none;
|
|
7
|
-
}
|
|
8
|
-
`,"getStyles"),m=o,D=Qf({styles:m});export{D as diagram};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Sf}from"./index-b42t14wk.js";export{Sf as createTreeViewServices};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{xf}from"./index-b42t14wk.js";export{xf as createTreemapServices};
|