@kabmo-labs/kabmo 0.47.0 → 0.49.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/dist/client/index.html +1 -1
- package/dist/client/index.js +535 -521
- package/dist/client/static/js/Body-9h5hd351.js +3 -0
- package/dist/client/static/js/{CsvGrid-vfgttmym.js → CsvGrid-s05k1q18.js} +2 -2
- package/dist/client/static/js/{DocxView-dc41t6rp.js → DocxView-x6sjw5ht.js} +22 -22
- package/dist/client/static/js/{DrawioView-wpwr38d9.js → DrawioView-jashn8sf.js} +2 -2
- package/dist/client/static/js/{HtmlPreview-23n7t5cs.js → HtmlPreview-eygzgtyc.js} +1 -1
- package/dist/client/static/js/ImageView-g50pk5pt.js +1 -0
- package/dist/client/static/js/LayoutWrapper-tag0qpts.js +2 -0
- package/dist/client/static/js/MergeDiffView-c4mb8m1w.js +1 -0
- package/dist/client/static/js/Modal-pf9p6m1k.js +59 -0
- package/dist/client/static/js/PdfView-syhjmyqf.js +1 -0
- package/dist/client/static/js/SessionsView-2r1grxxs.js +1 -0
- package/dist/client/static/js/{SheetView-n6mst0hq.js → SheetView-26r0e506.js} +45 -45
- package/dist/client/static/js/{SvgPreview-g2aqq812.js → SvgPreview-2fk85jzz.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-3vac8sq4.js → abnfDiagram-O67JEVCF-fdka7pxr.js} +1 -1
- package/dist/client/static/js/architecture-7GRP2DOG-ee9wjsht.js +1 -0
- package/dist/client/static/js/architectureDiagram-NJMV4G6O-278nx8rt.js +36 -0
- package/dist/client/static/js/{astro-63zcysj7.js → astro-rn2bvwpm.js} +1 -1
- package/dist/client/static/js/bash-36shcpcw.js +1 -0
- package/dist/client/static/js/{blockDiagram-BEXU5L5S-62z6kaar.js → blockDiagram-BEXU5L5S-vpcmd3vx.js} +9 -9
- package/dist/client/static/js/c-kxeqssf9.js +1 -0
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-rts5zgx4.js → c4Diagram-YGBWAQC7-1rgpdnbq.js} +4 -4
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-tnpww186.js → classDiagram-v2-NBCMYWYE-fbsejvb9.js} +9 -9
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-8vsjbzwa.js → cose-bilkent-JH36ORCC-ydq7mvy0.js} +1 -1
- package/dist/client/static/js/cpp-wtk1s3d7.js +1 -0
- package/dist/client/static/js/css-0a0r6rp3.js +1 -0
- package/dist/client/static/js/css-xhnrhg4e.js +1 -0
- package/dist/client/static/js/cynefin-OW5HDTMX-gs16zjqa.js +1 -0
- package/dist/client/static/js/{cynefinDiagram-VND7K2PF-005gc8km.js → cynefinDiagram-VND7K2PF-7ta5vbrw.js} +1 -1
- package/dist/client/static/js/dagre-6A5THRUB-b8gtt32x.js +4 -0
- package/dist/client/static/js/{diagram-22UHCM2B-prsm18a1.js → diagram-22UHCM2B-7emepy7h.js} +28 -28
- package/dist/client/static/js/{diagram-3UASUU5V-5nx9wf04.js → diagram-3UASUU5V-06nptkzc.js} +2 -2
- package/dist/client/static/js/{diagram-ATOU4E4O-k3d4z3aq.js → diagram-ATOU4E4O-t113exk3.js} +3 -3
- package/dist/client/static/js/{diagram-CDSNMT55-x2c5x5j2.js → diagram-CDSNMT55-pyj3x97y.js} +4 -4
- package/dist/client/static/js/{diagram-MLGK6HIB-nvr76jqh.js → diagram-MLGK6HIB-183sgpjh.js} +2 -2
- package/dist/client/static/js/{diagram-MPIPVDR6-v1jpzp9p.js → diagram-MPIPVDR6-fmbj4hcx.js} +2 -2
- package/dist/client/static/js/{dockerfile-vz6va73h.js → dockerfile-qay672za.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-0v4tqr9v.js → ebnfDiagram-ZINNZB2B-eafvfws2.js} +1 -1
- package/dist/client/static/js/{elixir-80wq7gak.js → elixir-t8bep87c.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-qfn4r7xj.js → elk-276RUBZZ-573f1vfs.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-cd667n9f.js → erDiagram-OPXOYQCR-4z1r88ej.js} +14 -14
- package/dist/client/static/js/{erlang-vk66vt7q.js → erlang-261km7r1.js} +1 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-ftz7zrz5.js +1 -0
- package/dist/client/static/js/flowDiagram-KWPJA3E3-ax0qfmp3.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-ps0h3drm.js → ganttDiagram-FUAMR5RP-49jd7msz.js} +5 -5
- package/dist/client/static/js/gitGraph-4MIJSDKK-3rtkds4s.js +1 -0
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-fts23jer.js → gitGraphDiagram-X574FWY7-5p9mgq7n.js} +26 -26
- package/dist/client/static/js/graphql-w9ajhndp.js +1 -0
- package/dist/client/static/js/html-krfbq5wp.js +1 -0
- package/dist/client/static/js/index-05n22cg9.js +4 -0
- package/dist/client/static/js/{index-fxd8dfj4.js → index-0857zpr0.js} +2 -2
- package/dist/client/static/js/{index-9ab6xaxd.js → index-0w4jqzqk.js} +2 -2
- package/dist/client/static/js/index-14dgbjsm.js +2 -0
- package/dist/client/static/js/{index-q4ke39rh.js → index-1p880x6e.js} +2 -2
- package/dist/client/static/js/{index-e5j5gc4h.js → index-1yq96wpa.js} +2 -2
- package/dist/client/static/js/{index-x0xspam4.js → index-2bf0txsp.js} +2 -2
- package/dist/client/static/js/index-2jgx68m0.js +1 -0
- package/dist/client/static/js/{index-evmcc5qh.js → index-2yzt8h3d.js} +2 -2
- package/dist/client/static/js/{index-ccgzzydx.js → index-333rq9yy.js} +1 -1
- package/dist/client/static/js/{index-9xsf8162.js → index-38g2eevc.js} +80 -80
- package/dist/client/static/js/{index-dxkefysk.js → index-3v8k8ms3.js} +1 -1
- package/dist/client/static/js/index-473hk8nb.js +10 -0
- package/dist/client/static/js/{index-5f4b44ay.js → index-4ccs971z.js} +2 -2
- package/dist/client/static/js/{index-fjex1y0t.js → index-4dnc1kys.js} +2 -2
- package/dist/client/static/js/{index-4jzsr1ky.js → index-4z5ram7g.js} +2 -2
- package/dist/client/static/js/{index-dzeyd153.js → index-5dn4159w.js} +2 -2
- package/dist/client/static/js/{index-54mkp2r2.js → index-5p8dwr4y.js} +1 -1
- package/dist/client/static/js/{index-1c2jvnyh.js → index-5ztdqm1w.js} +2 -2
- package/dist/client/static/js/{index-cra9mgkq.js → index-7dqq7cjp.js} +13 -13
- package/dist/client/static/js/{index-64p1dncg.js → index-7ff9scbm.js} +2 -2
- package/dist/client/static/js/{index-z0fkfphe.js → index-7rmps91t.js} +2 -2
- package/dist/client/static/js/{index-0dkc6z8e.js → index-80fjn77c.js} +2 -2
- package/dist/client/static/js/{index-cvyqp8nz.css → index-9wc36am3.css} +1 -1
- package/dist/client/static/js/{index-y6ke70e6.js → index-a4636gt1.js} +2 -2
- package/dist/client/static/js/{index-c63qyysm.js → index-bmaktvm2.js} +1 -1
- package/dist/client/static/js/index-bvpzzhn2.js +4 -0
- package/dist/client/static/js/{index-56rtb871.js → index-c3whkrwa.js} +58 -58
- package/dist/client/static/js/{index-7zeah164.js → index-dh060b7r.js} +2 -2
- package/dist/client/static/js/{index-hkz2mz34.js → index-dmc82cxb.js} +2 -2
- package/dist/client/static/js/index-e19dbqd3.js +2 -0
- package/dist/client/static/js/{index-g4kkapka.js → index-e8mt8rag.js} +2 -2
- package/dist/client/static/js/index-epzvftkq.js +1 -0
- package/dist/client/static/js/{index-an2wv33f.js → index-fbg5vhhw.js} +2 -2
- package/dist/client/static/js/{index-nkahe229.js → index-gaqjrzdb.js} +2 -2
- package/dist/client/static/js/index-gg910gpv.js +2 -0
- package/dist/client/static/js/{index-n1yr4khe.js → index-gr8sqjpz.js} +1 -1
- package/dist/client/static/js/{index-7zedprz3.js → index-gz7kvpnm.js} +1 -1
- package/dist/client/static/js/{index-70g527sb.js → index-h8hjcdj1.js} +2 -2
- package/dist/client/static/js/{index-4wnzs76g.js → index-j37m7pn9.js} +2 -2
- package/dist/client/static/js/{index-39d8zbkx.js → index-mbtenbyc.js} +6 -6
- package/dist/client/static/js/{index-tqgj7rd9.js → index-nbm5r9g1.js} +2 -2
- package/dist/client/static/js/{index-52nd4hgm.js → index-nzvte8s5.js} +2 -2
- package/dist/client/static/js/index-pv4z2mp2.js +463 -0
- package/dist/client/static/js/{index-c5hjht5e.js → index-pygy21w5.js} +2 -2
- package/dist/client/static/js/{index-sa1675y0.js → index-qs4n116g.js} +2 -2
- package/dist/client/static/js/{index-6d6hxwb5.js → index-qwxawph7.js} +2 -2
- package/dist/client/static/js/index-rz0tz4hg.js +1 -0
- package/dist/client/static/js/{index-gzkzwgzv.js → index-s5vegk6q.js} +2 -2
- package/dist/client/static/js/{index-xk1cqjkn.js → index-t522tpxt.js} +3 -3
- package/dist/client/static/js/{index-a4h5np9r.js → index-taev57jw.js} +2 -2
- package/dist/client/static/js/{index-dyc886cc.js → index-tb35a328.js} +2 -2
- package/dist/client/static/js/{index-396r53n0.js → index-tc6k8qt7.js} +2 -2
- package/dist/client/static/js/{index-62jgcgfd.js → index-tcfpzqb9.js} +36 -36
- package/dist/client/static/js/{index-z4530r3c.js → index-wbsvg1d9.js} +2 -2
- package/dist/client/static/js/index-xw1bptp5.js +2 -0
- package/dist/client/static/js/{index-33qxg79j.js → index-yg083mk0.js} +6 -6
- package/dist/client/static/js/{index-f2ahkev0.js → index-ykc14gez.js} +5 -5
- package/dist/client/static/js/index-yr3exz70.js +2 -0
- package/dist/client/static/js/{index-1whzs9kb.js → index-yyjw1ty9.js} +2 -2
- package/dist/client/static/js/index-z6y8j93w.js +9 -0
- package/dist/client/static/js/index-zdw8bd5t.js +2 -0
- package/dist/client/static/js/index-zp40g8ah.js +12 -0
- package/dist/client/static/js/{index-zhjjpvcc.js → index-zyefab6q.js} +1 -1
- package/dist/client/static/js/info-A6RAGUB7-vr5mxm6f.js +1 -0
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-88qbtpq5.js → infoDiagram-VRGFBTTK-xsar9j6v.js} +2 -2
- package/dist/client/static/js/ini-zx7x1jj1.js +1 -0
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-s8bagk00.js → ishikawaDiagram-OU5B5YK6-g2rvt9jp.js} +6 -6
- package/dist/client/static/js/java-bbw6kdcr.js +1 -0
- package/dist/client/static/js/javascript-p2a8rbpw.js +1 -0
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-hz8z0b9x.js → journeyDiagram-ZHPQQLJL-q95v18zc.js} +5 -5
- package/dist/client/static/js/json-zh7m2fyg.js +1 -0
- package/dist/client/static/js/jsx-3zyyt0eh.js +1 -0
- package/dist/client/static/js/{julia-dm0j9apa.js → julia-pe5vpc2m.js} +1 -1
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-sjjnjb51.js → kanban-definition-PNTS6WVX-2e7m7ds3.js} +11 -11
- package/dist/client/static/js/lua-d656k76a.js +1 -0
- package/dist/client/static/js/markdown-b5w681mm.js +1 -0
- package/dist/client/static/js/{mermaid.core-zvwygxbh.js → mermaid.core-dzajkp0g.js} +8 -8
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-kgj8enan.js → mindmap-definition-NLK3R4M7-banecvf8.js} +4 -4
- package/dist/client/static/js/one-dark-pro-z965dedc.js +1 -0
- package/dist/client/static/js/one-light-capdx801.js +1 -0
- package/dist/client/static/js/packet-AYTQ26CC-ncb5xxtn.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-gxzw1qwa.js → pegDiagram-GJSIUBJH-6erykm1c.js} +1 -1
- package/dist/client/static/js/{perl-4jcm2jxv.js → perl-cc2eqye8.js} +1 -1
- package/dist/client/static/js/{php-q32mec74.js → php-p9bvnpsv.js} +1 -1
- package/dist/client/static/js/pie-WAS4IAKB-ff8fpvc4.js +1 -0
- package/dist/client/static/js/{pieDiagram-5QR66LMP-pdqwyqcm.js → pieDiagram-5QR66LMP-jn1d905q.js} +3 -3
- package/dist/client/static/js/properties-3c6rmnqp.js +1 -0
- package/dist/client/static/js/python-a3x3zpv1.js +1 -0
- package/dist/client/static/js/{quadrantDiagram-O4NWA36T-yx2t364p.js → quadrantDiagram-O4NWA36T-sz4afnp1.js} +6 -6
- package/dist/client/static/js/r-7h3gwype.js +1 -0
- package/dist/client/static/js/radar-RG4KPBEZ-gbj4b1hf.js +1 -0
- package/dist/client/static/js/railroad-74A4TZTK-ndv5tqgr.js +1 -0
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-yjzj09s1.js +1 -0
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-e6pw7e5z.js +1 -0
- package/dist/client/static/js/railroad-peg-WCYAUIDC-9734dxy4.js +1 -0
- package/dist/client/static/js/{railroadDiagram-XR7U4H2S-800fdzkr.js → railroadDiagram-XR7U4H2S-ewzhhth2.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-vc5rpgtm.js → requirementDiagram-PLB6GJNP-fcs3xd42.js} +8 -8
- package/dist/client/static/js/{ruby-npmpb290.js → ruby-65s2ca5d.js} +1 -1
- package/dist/client/static/js/{rust-waks43wh.js → rust-ec1j2hwy.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-ccjk8zgn.js → sankeyDiagram-IPEJSGJF-2r829rjf.js} +4 -4
- package/dist/client/static/js/{sass-502a4r7y.js → sass-p6cssgq8.js} +1 -1
- package/dist/client/static/js/{scss-kvev49ga.js → scss-qfx8wt3b.js} +1 -1
- package/dist/client/static/js/sequenceDiagram-PO4LG4MO-3mnte9tv.js +169 -0
- package/dist/client/static/js/{sizeCapture-INFHLROL-fma9p1vy.js → sizeCapture-INFHLROL-r6hf9265.js} +1 -1
- package/dist/client/static/js/sql-7a5vavm0.js +1 -0
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-d8f24b7j.js → stateDiagram-v2-GCMORJYK-hm2f0wdb.js} +6 -6
- package/dist/client/static/js/{svelte-c15d0421.js → svelte-jz3a190v.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-sdt7qy36.js → swimlanes-2SLR337P-s58xzqhw.js} +1 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-z4pt2kn1.js +8 -0
- package/dist/client/static/js/{timeline-definition-EJHVYXUP-rv8qyr8b.js → timeline-definition-EJHVYXUP-ezm1c4pz.js} +8 -8
- package/dist/client/static/js/treeView-Q6P3EWNA-rs10d4p5.js +1 -0
- package/dist/client/static/js/treemap-WGGIJYW6-ey6c5x9f.js +1 -0
- package/dist/client/static/js/tsx-4a9b8tqf.js +1 -0
- package/dist/client/static/js/typescript-kas107wb.js +1 -0
- package/dist/client/static/js/{usecaseDiagram-POWQR4AR-w6ew1red.js → usecaseDiagram-POWQR4AR-ryvgs5ac.js} +48 -48
- package/dist/client/static/js/{vennDiagram-UO4OBE2U-p9axw7ch.js → vennDiagram-UO4OBE2U-rd5prsf1.js} +6 -6
- package/dist/client/static/js/{vue-xpemy62d.js → vue-rv4pea8r.js} +1 -1
- package/dist/client/static/js/wardley-WFR3VGLG-kd9swrdr.js +1 -0
- package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-5ewc8s4p.js → wardleyDiagram-VNRHLVJA-1kt8q8a4.js} +4 -4
- package/dist/client/static/js/xml-3g4bdtpa.js +1 -0
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-7n4gn7k6.js → xychartDiagram-PMCCYNJV-q39bbgq4.js} +4 -4
- package/dist/client/static/js/yaml-ktxjn917.js +1 -0
- package/package.json +1 -1
- package/src/client/components/common/MarkdownRenderer.tsx +29 -28
- package/src/client/components/common/header-controls/index.test.tsx +1 -0
- package/src/client/components/common/header-controls/phone-row.test.tsx +1 -0
- package/src/client/components/common/header-controls/plugin-entry.test.tsx +1 -0
- package/src/client/components/common/header-controls/shell-chrome.test.tsx +1 -0
- package/src/client/components/layout/ActivityBar.tsx +2 -1
- package/src/client/components/layout/LeftActivityBar.test.ts +1 -0
- package/src/client/components/settings/Modal.tsx +1 -1
- package/src/client/components/settings/Sidebar.tsx +2 -1
- package/src/client/components/settings/apply-side-effects.ts +8 -0
- package/src/client/components/settings/categories/DictationSettings.test.tsx +152 -0
- package/src/client/components/settings/categories/DictationSettings.tsx +76 -0
- package/src/client/components/settings/categories/VoiceSettings.tsx +77 -0
- package/src/client/components/settings/categories/dictation-settings/CaptureSection.tsx +153 -0
- package/src/client/components/settings/categories/dictation-settings/EngineSection.tsx +123 -0
- package/src/client/components/settings/categories/dictation-settings/ExternalSection.tsx +221 -0
- package/src/client/components/settings/categories/dictation-settings/LanguageSection.tsx +73 -0
- package/src/client/components/settings/categories/panel-plugins/InstallForm.tsx +24 -17
- package/src/client/components/settings/categories/panel-plugins/Registries.test.tsx +164 -0
- package/src/client/components/settings/categories/panel-plugins/Registries.tsx +180 -0
- package/src/client/components/settings/categories/panel-plugins/Section.tsx +15 -6
- package/src/client/components/settings/categories/usage-settings/LimitsSection.tsx +10 -3
- package/src/client/components/settings/categories/usage-settings/ProviderDetail.tsx +27 -4
- package/src/client/components/settings/categories/usage-settings/TokenHarborCard.tsx +160 -0
- package/src/client/components/settings/categories/usage-settings/TokenPortalCard.tsx +104 -0
- package/src/client/components/settings/categories/usage-settings/format.ts +35 -0
- package/src/client/components/settings/categories/usage-settings/limits-section.test.tsx +16 -0
- package/src/client/components/settings/categories/usage-settings/providers.ts +26 -4
- package/src/client/components/settings/categories/usage-settings/token-harbor-card.test.tsx +114 -0
- package/src/client/components/settings/categories/usage-settings/token-harbor-hint.test.ts +68 -0
- package/src/client/components/settings/categories/usage-settings/token-portal-card.test.tsx +81 -0
- package/src/client/components/settings/categories/usage-settings/usage-and-picker.test.ts +66 -0
- package/src/client/components/settings/categories/voice-settings/SpeechSettings.test.tsx +112 -0
- package/src/client/components/settings/categories/voice-settings/SpeechSettings.tsx +84 -0
- package/src/client/components/settings/categories/voice-settings/groups.test.ts +23 -0
- package/src/client/components/settings/categories/voice-settings/groups.ts +48 -0
- package/src/client/components/settings/categories/voice-settings/speech/AutoplaySection.tsx +49 -0
- package/src/client/components/settings/categories/voice-settings/speech/EndpointSection.tsx +161 -0
- package/src/client/components/settings/categories/voice-settings/speech/EngineSection.tsx +108 -0
- package/src/client/components/settings/categories/voice-settings/speech/TestSection.tsx +56 -0
- package/src/client/components/settings/categories/voice-settings/speech/VoiceSection.tsx +157 -0
- package/src/client/components/settings/categories/voice-settings/speech/styles.ts +15 -0
- package/src/client/components/settings/category-content.tsx +3 -0
- package/src/client/components/workspace/chat-timeline/AiMessageFooter.speech.test.tsx +140 -0
- package/src/client/components/workspace/chat-timeline/AiMessageFooter.tsx +41 -97
- package/src/client/components/workspace/chat-timeline/AiMessageFooterSheet.tsx +143 -0
- package/src/client/components/workspace/chat-timeline/MessageItem.tsx +5 -1
- package/src/client/components/workspace/chat-timeline/MessageList.tsx +1 -0
- package/src/client/components/workspace/chat-timeline/RunFooter.tsx +1 -0
- package/src/client/components/workspace/chat-timeline/SpeechButton.tsx +110 -0
- package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.test.ts +26 -10
- package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.tsx +13 -8
- package/src/client/components/workspace/chat-timeline/chat-input/AttachmentToolbar.tsx +9 -2
- package/src/client/components/workspace/chat-timeline/chat-input/ComposerRows.tsx +6 -0
- package/src/client/components/workspace/chat-timeline/chat-input/ModeToggles.tsx +18 -7
- package/src/client/components/workspace/chat-timeline/chat-input/SessionModeDropdown.tsx +4 -2
- package/src/client/components/workspace/chat-timeline/chat-input/ThinkingLevelDropdown.tsx +4 -4
- package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.tsx +19 -11
- package/src/client/components/workspace/chat-timeline/chat-input/WaitingDependencyPicker.tsx +8 -6
- package/src/client/components/workspace/chat-timeline/chat-input/index.tsx +38 -30
- package/src/client/components/workspace/chat-timeline/chat-input/narrow.test.tsx +185 -0
- package/src/client/components/workspace/chat-timeline/chat-input/paste-attach.test.tsx +194 -0
- package/src/client/components/workspace/chat-timeline/index.tsx +4 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/index.tsx +5 -11
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Bash.test.ts +10 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Edit.tsx +2 -7
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/task-rows.ts +6 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/registry.test.ts +38 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/registry.ts +10 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/DiffView.test.ts +13 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/DiffView.tsx +41 -18
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/tool-input.ts +5 -5
- package/src/client/components/workspace/editor/BodyLazy.tsx +40 -0
- package/src/client/components/workspace/editor/index.tsx +2 -2
- package/src/client/data/settings/omp-schema.json +33 -10
- package/src/client/hooks/chat/composer/attachments.ts +18 -2
- package/src/client/hooks/chat/composer/capture.test.ts +282 -0
- package/src/client/hooks/chat/composer/capture.ts +166 -0
- package/src/client/hooks/chat/composer/dictation-settings.ts +53 -0
- package/src/client/hooks/chat/composer/narrow.test.ts +130 -0
- package/src/client/hooks/chat/composer/narrow.ts +82 -0
- package/src/client/hooks/chat/composer/paste-attachments.test.ts +215 -0
- package/src/client/hooks/chat/composer/paste-attachments.ts +173 -0
- package/src/client/hooks/chat/composer/pipeline.ts +16 -3
- package/src/client/hooks/chat/composer/speech-to-text.test.tsx +314 -0
- package/src/client/hooks/chat/composer/speech-to-text.ts +158 -134
- package/src/client/hooks/chat/composer/voice-input.ts +24 -9
- package/src/client/hooks/chat/timeline/scroll.test.ts +44 -3
- package/src/client/hooks/chat/timeline/scroll.ts +31 -14
- package/src/client/hooks/chat/timeline/send-helpers.ts +3 -0
- package/src/client/hooks/chat/timeline/send.ts +5 -1
- package/src/client/hooks/settings/dictation.ts +153 -0
- package/src/client/hooks/settings/speech.ts +170 -0
- package/src/client/hooks/tts/provider.tsx +50 -0
- package/src/client/hooks/tts/tts-context.ts +39 -0
- package/src/client/hooks/tts/use-speech-autoplay.test.tsx +122 -0
- package/src/client/hooks/tts/use-speech-autoplay.ts +106 -0
- package/src/client/hooks/tts/use-tts-player.ts +33 -0
- package/src/client/hooks/ui/markdown-hydration.test.tsx +83 -0
- package/src/client/hooks/ui/markdown-hydration.ts +31 -0
- package/src/client/hooks/ui/markdown-render.ts +119 -0
- package/src/client/hooks/workspace/journal-diff.ts +8 -1
- package/src/client/hooks/workspace/panel-actions.ts +184 -0
- package/src/client/hooks/workspace/panel-registry.ts +6 -139
- package/src/client/hooks/workspace/panel-visibility-menu.ts +2 -1
- package/src/client/lib/plugins/bootstrap.test.ts +1 -0
- package/src/client/lib/tts/player.test.ts +103 -0
- package/src/client/lib/tts/player.ts +213 -0
- package/src/client/tailwind.css +11 -0
- package/src/server/lib/changes/capture-bash.server.ts +6 -3
- package/src/server/lib/changes/capture-fs.server.ts +2 -2
- package/src/server/lib/changes/capture-races.test.ts +33 -1
- package/src/server/lib/changes/capture-scan.test.ts +1 -1
- package/src/server/lib/changes/capture-test-util.ts +1 -1
- package/src/server/lib/changes/capture-types.ts +1 -1
- package/src/server/lib/changes/capture.server.ts +1 -1
- package/src/server/lib/changes/journal-read.server.ts +21 -0
- package/src/server/lib/changes/reader.server.ts +92 -14
- package/src/server/lib/changes/reader.test.ts +99 -0
- package/src/server/lib/changes/records.ts +2 -0
- package/src/server/lib/dictation/capability.server.test.ts +113 -0
- package/src/server/lib/dictation/capability.server.ts +57 -0
- package/src/server/lib/dictation/engines/adapter.ts +147 -0
- package/src/server/lib/dictation/engines/adapters.test.ts +215 -0
- package/src/server/lib/dictation/engines/deepgram.ts +77 -0
- package/src/server/lib/dictation/engines/elevenlabs.ts +44 -0
- package/src/server/lib/dictation/engines/index.ts +55 -0
- package/src/server/lib/dictation/engines/openai.ts +51 -0
- package/src/server/lib/dictation/language.server.test.ts +21 -22
- package/src/server/lib/dictation/language.server.ts +16 -19
- package/src/server/lib/dictation/omp-stt-worker.test.ts +183 -0
- package/src/server/lib/dictation/omp-stt-worker.ts +130 -78
- package/src/server/lib/dictation/settings.server.ts +74 -0
- package/src/server/lib/dictation/speech-frames.test.ts +125 -0
- package/src/server/lib/dictation/speech-frames.ts +146 -0
- package/src/server/lib/dictation/worker-process.ts +122 -0
- package/src/server/lib/harness/acp/calls.ts +20 -0
- package/src/server/lib/harness/acp/client-capabilities.ts +8 -1
- package/src/server/lib/harness/acp/client-fs.ts +17 -5
- package/src/server/lib/harness/acp/client-initialize.test.ts +32 -1
- package/src/server/lib/harness/acp/client-initialize.ts +51 -6
- package/src/server/lib/harness/acp/client-requests.ts +49 -0
- package/src/server/lib/harness/acp/client.ts +33 -36
- package/src/server/lib/harness/acp/frames-rows.test.ts +144 -0
- package/src/server/lib/harness/acp/frames-tool-shapes.test.ts +238 -0
- package/src/server/lib/harness/acp/frames-v2.test.ts +21 -0
- package/src/server/lib/harness/acp/frames.test.ts +3 -15
- package/src/server/lib/harness/acp/frames.ts +43 -67
- package/src/server/lib/harness/acp/grants.ts +20 -5
- package/src/server/lib/harness/acp/mapper.test.ts +40 -1
- package/src/server/lib/harness/acp/mapper.ts +69 -9
- package/src/server/lib/harness/acp/message-rows.ts +219 -0
- package/src/server/lib/harness/acp/prompt.ts +20 -2
- package/src/server/lib/harness/acp/protocol.ts +24 -0
- package/src/server/lib/harness/acp/replay-window.test.ts +66 -0
- package/src/server/lib/harness/acp/replay.ts +33 -8
- package/src/server/lib/harness/acp/session-addressing.test.ts +99 -0
- package/src/server/lib/harness/acp/session-approvals.ts +4 -0
- package/src/server/lib/harness/acp/session-cancel-policy.test.ts +86 -0
- package/src/server/lib/harness/acp/session-close.test.ts +89 -0
- package/src/server/lib/harness/acp/session-config.ts +8 -3
- package/src/server/lib/harness/acp/session-handshake.ts +6 -0
- package/src/server/lib/harness/acp/session-inbound.ts +126 -0
- package/src/server/lib/harness/acp/session-intake.ts +9 -2
- package/src/server/lib/harness/acp/session-lifecycle.ts +25 -0
- package/src/server/lib/harness/acp/session-notifications.ts +36 -0
- package/src/server/lib/harness/acp/session-permissions.ts +22 -1
- package/src/server/lib/harness/acp/session-requests.ts +19 -1
- package/src/server/lib/harness/acp/session-stop.ts +54 -0
- package/src/server/lib/harness/acp/session-wiring.ts +1 -0
- package/src/server/lib/harness/acp/session.test-util.ts +8 -3
- package/src/server/lib/harness/acp/session.ts +75 -75
- package/src/server/lib/harness/acp/stdio.ts +8 -1
- package/src/server/lib/harness/acp/subagent-frames.test.ts +82 -0
- package/src/server/lib/harness/acp/subagent-frames.ts +124 -0
- package/src/server/lib/harness/acp/subagents.test.ts +124 -0
- package/src/server/lib/harness/acp/subagents.ts +182 -0
- package/src/server/lib/harness/acp/tool-calls.ts +115 -45
- package/src/server/lib/harness/acp/tool-identity.test.ts +8 -0
- package/src/server/lib/harness/acp/tool-identity.ts +13 -1
- package/src/server/lib/harness/acp/tool-shape.ts +99 -0
- package/src/server/lib/harness/acp/turn.test.ts +1 -0
- package/src/server/lib/harness/acp/turn.ts +4 -1
- package/src/server/lib/harness/acp/v2.test.ts +21 -1
- package/src/server/lib/harness/acp/v2.ts +6 -1
- package/src/server/lib/lifecycle/paths.ts +22 -0
- package/src/server/lib/omp/session/changes-patch.test.ts +120 -0
- package/src/server/lib/omp/session/changes-patch.ts +190 -0
- package/src/server/lib/omp/session/changes.test.ts +55 -61
- package/src/server/lib/omp/session/changes.ts +79 -127
- package/src/server/lib/omp/session/merge-stored.ts +2 -0
- package/src/server/lib/panels/catalog-offers.server.ts +1 -1
- package/src/server/lib/panels/catalog.server.test.ts +71 -2
- package/src/server/lib/panels/catalog.server.ts +80 -0
- package/src/server/lib/panels/install.server.test.ts +15 -0
- package/src/server/lib/panels/install.server.ts +7 -0
- package/src/server/lib/panels/manifest.test.ts +1 -76
- package/src/server/lib/panels/manifest.ts +3 -60
- package/src/server/lib/panels/marketplace-catalog.server.test.ts +154 -0
- package/src/server/lib/panels/marketplace-catalog.server.ts +131 -0
- package/src/server/lib/panels/offers.server.test.ts +5 -5
- package/src/server/lib/panels/offers.server.ts +20 -2
- package/src/server/lib/panels/registries.server.test.ts +216 -0
- package/src/server/lib/panels/registries.server.ts +118 -0
- package/src/server/lib/panels/registry-cache.server.ts +104 -0
- package/src/server/lib/panels/registry-refresh.server.ts +195 -0
- package/src/server/lib/panels/registry.server.test.ts +2 -2
- package/src/server/lib/panels/registry.server.ts +19 -1
- package/src/server/lib/panels/seed.server.ts +4 -1
- package/src/server/lib/tts/engines/adapter.ts +133 -0
- package/src/server/lib/tts/engines/adapters.test.ts +129 -0
- package/src/server/lib/tts/engines/deepgram.ts +43 -0
- package/src/server/lib/tts/engines/elevenlabs.ts +53 -0
- package/src/server/lib/tts/engines/index.ts +75 -0
- package/src/server/lib/tts/engines/openai.ts +52 -0
- package/src/server/lib/tts/engines/xai.ts +44 -0
- package/src/server/lib/tts/local.server.ts +160 -0
- package/src/server/lib/tts/settings.server.ts +103 -0
- package/src/server/lib/usage/provider-key.ts +18 -0
- package/src/server/lib/usage/providers.server.ts +27 -3
- package/src/server/lib/usage/report.server.ts +24 -0
- package/src/server/lib/usage/token-harbor.test.ts +191 -0
- package/src/server/lib/usage/token-harbor.ts +207 -0
- package/src/server/lib/usage/token-portal.test.ts +140 -0
- package/src/server/lib/usage/token-portal.ts +179 -0
- package/src/server/lib/usage/vendor-http.test.ts +52 -0
- package/src/server/lib/usage/vendor-http.ts +9 -2
- package/src/server/routes/dictation/ws.ts +99 -27
- package/src/server/routes/index.ts +2 -0
- package/src/server/routes/panels/install-route.test.ts +110 -0
- package/src/server/routes/panels/install.ts +82 -3
- package/src/server/routes/sessions/index.ts +5 -0
- package/src/server/routes/sessions/local-image.test.ts +94 -0
- package/src/server/routes/sessions/local-image.ts +141 -0
- package/src/server/routes/settings/dictation.test.ts +139 -0
- package/src/server/routes/settings/dictation.ts +86 -0
- package/src/server/routes/settings/index.ts +4 -0
- package/src/server/routes/settings/speech.test.ts +156 -0
- package/src/server/routes/settings/speech.ts +98 -0
- package/src/server/routes/tts/index.ts +11 -0
- package/src/server/routes/tts/speak.test.ts +160 -0
- package/src/server/routes/tts/speak.ts +87 -0
- package/src/shared/lib/chat/attachments.ts +17 -3
- package/src/shared/lib/chat/composer/attachment-labels.test.ts +154 -0
- package/src/shared/lib/chat/composer/attachment-labels.ts +166 -0
- package/src/shared/lib/chat/omp/subagent-card-fold.test.ts +75 -0
- package/src/shared/lib/chat/timeline/changed-files.test.ts +13 -0
- package/src/shared/lib/chat/timeline/changed-files.ts +4 -2
- package/src/shared/lib/chat/timeline/local-image.test.ts +88 -0
- package/src/shared/lib/chat/timeline/local-image.ts +110 -0
- package/src/shared/lib/chat/timeline/omp-callbacks.ts +3 -2
- package/src/shared/lib/chat/timeline/run-signals.ts +2 -2
- package/src/shared/lib/chat/timeline/stream-callbacks.ts +8 -6
- package/src/shared/lib/chat/timeline/stream-coalescer.ts +7 -0
- package/src/shared/lib/chat/timeline/stream.test.ts +3 -1
- package/src/shared/lib/chat/timeline/tool-verbs.test.ts +5 -0
- package/src/shared/lib/chat/timeline/tool-verbs.ts +3 -1
- package/src/shared/lib/chat/todo/parser.test.ts +54 -0
- package/src/shared/lib/chat/todo/parser.ts +56 -0
- package/src/shared/lib/chat/tool/tool-aliases.test.ts +37 -0
- package/src/shared/lib/chat/tool/tool-aliases.ts +75 -0
- package/src/shared/lib/chat/tool/tool-input-path.test.ts +44 -0
- package/src/shared/lib/chat/tool/tool-input-path.ts +47 -0
- package/src/shared/lib/dictation/capability.ts +32 -0
- package/src/shared/lib/dictation/constraints.test.ts +41 -0
- package/src/shared/lib/dictation/constraints.ts +48 -0
- package/src/shared/lib/dictation/engines.test.ts +117 -0
- package/src/shared/lib/dictation/engines.ts +190 -0
- package/src/shared/lib/dictation/gate.test.ts +118 -0
- package/src/shared/lib/dictation/gate.ts +85 -0
- package/src/shared/lib/dictation/languages.test.ts +88 -0
- package/src/shared/lib/dictation/languages.ts +90 -0
- package/src/shared/lib/dictation/models.ts +9 -5
- package/src/shared/lib/dictation/protocol.ts +74 -34
- package/src/shared/lib/dictation/settings.test.ts +94 -0
- package/src/shared/lib/dictation/settings.ts +111 -0
- package/src/shared/lib/dictation/wav.test.ts +66 -0
- package/src/shared/lib/dictation/wav.ts +48 -0
- package/src/shared/lib/fs/journal-unavailable.test.ts +30 -0
- package/src/shared/lib/fs/journal-unavailable.ts +35 -0
- package/src/shared/lib/icons/tint-hues.generated.ts +35 -35
- package/src/shared/lib/net/base-url.test.ts +25 -0
- package/src/shared/lib/net/base-url.ts +29 -0
- package/src/shared/lib/omp/config/schema-extras.ts +9 -8
- package/src/shared/lib/omp/config/schema-releases.test.ts +22 -0
- package/src/shared/lib/omp/session/parse-message-blocks.ts +2 -2
- package/src/shared/lib/panels/plugin-repo.test.ts +113 -0
- package/src/shared/lib/panels/plugin-repo.ts +149 -0
- package/src/shared/lib/settings/defaults.ts +4 -0
- package/src/shared/lib/tts/capability.ts +16 -0
- package/src/shared/lib/tts/engines.test.ts +79 -0
- package/src/shared/lib/tts/engines.ts +313 -0
- package/src/shared/lib/tts/settings.test.ts +56 -0
- package/src/shared/lib/tts/settings.ts +108 -0
- package/src/shared/lib/tts/speakable.test.ts +76 -0
- package/src/shared/lib/tts/speakable.ts +179 -0
- package/src/shared/types/chat.ts +8 -1
- package/src/shared/types/panels-registry.ts +32 -0
- package/src/shared/types/panels.ts +23 -0
- package/src/shared/types/session-changes.ts +15 -1
- package/src/shared/types/settings/state.ts +25 -0
- package/src/shared/types/settings/usage.ts +89 -2
- package/src/test-support/pristine-globals.ts +5 -0
- package/dist/client/static/js/ImageView-mvjb3qh1.js +0 -1
- package/dist/client/static/js/LayoutWrapper-eenx0hp2.js +0 -2
- package/dist/client/static/js/Modal-dsqhas10.js +0 -59
- package/dist/client/static/js/PdfView-cpvsbfk0.js +0 -1
- package/dist/client/static/js/SessionsView-s0crtcm8.js +0 -1
- package/dist/client/static/js/architecture-7GRP2DOG-b5w9mnn5.js +0 -1
- package/dist/client/static/js/architectureDiagram-NJMV4G6O-1nh4htz2.js +0 -36
- package/dist/client/static/js/bash-hv3167gh.js +0 -1
- package/dist/client/static/js/c-acmn1zc9.js +0 -1
- package/dist/client/static/js/cpp-v2mqp8j7.js +0 -1
- package/dist/client/static/js/css-drfs4n12.js +0 -1
- package/dist/client/static/js/css-x7gyc3ta.js +0 -1
- package/dist/client/static/js/cynefin-OW5HDTMX-kdj8rjc1.js +0 -1
- package/dist/client/static/js/dagre-6A5THRUB-41zsteyd.js +0 -4
- package/dist/client/static/js/eventmodeling-NTZA5JFV-m57b7ytw.js +0 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-fasj2gxy.js +0 -1
- package/dist/client/static/js/gitGraph-4MIJSDKK-wvzsc4ph.js +0 -1
- package/dist/client/static/js/graphql-a4gbqpj9.js +0 -1
- package/dist/client/static/js/html-m0megrvb.js +0 -1
- package/dist/client/static/js/index-1d8bxjsz.js +0 -4
- package/dist/client/static/js/index-3nsrnyqr.js +0 -2
- package/dist/client/static/js/index-4x9p7hf9.js +0 -2
- package/dist/client/static/js/index-6009v8jf.js +0 -1
- package/dist/client/static/js/index-9vqkyj58.js +0 -3
- package/dist/client/static/js/index-d2xtbabt.js +0 -2
- package/dist/client/static/js/index-dxp2yvy7.js +0 -2
- package/dist/client/static/js/index-p6s3fz6b.js +0 -12
- package/dist/client/static/js/index-qtd0e38d.js +0 -1
- package/dist/client/static/js/index-x2v1zmth.js +0 -479
- package/dist/client/static/js/index-x9hfvbz6.js +0 -2
- package/dist/client/static/js/info-A6RAGUB7-ym2xevn8.js +0 -1
- package/dist/client/static/js/ini-80p6sp79.js +0 -1
- package/dist/client/static/js/java-mm2b3s9b.js +0 -1
- package/dist/client/static/js/javascript-n9w9p97f.js +0 -1
- package/dist/client/static/js/json-fzy76fkw.js +0 -1
- package/dist/client/static/js/jsx-c7v2f8s7.js +0 -1
- package/dist/client/static/js/lua-ppfdxrmv.js +0 -1
- package/dist/client/static/js/markdown-xed7y3ds.js +0 -1
- package/dist/client/static/js/one-dark-pro-mq6sn6a2.js +0 -1
- package/dist/client/static/js/one-light-pt6t6vax.js +0 -1
- package/dist/client/static/js/packet-AYTQ26CC-01vcsy6x.js +0 -1
- package/dist/client/static/js/pie-WAS4IAKB-053gzkmh.js +0 -1
- package/dist/client/static/js/properties-8ysbq2n2.js +0 -1
- package/dist/client/static/js/python-4ysexc8s.js +0 -1
- package/dist/client/static/js/r-hrsw5arc.js +0 -1
- package/dist/client/static/js/radar-RG4KPBEZ-bkpby8am.js +0 -1
- package/dist/client/static/js/railroad-74A4TZTK-67bxrjgw.js +0 -1
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-xj9ymacg.js +0 -1
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-2xxpbnf6.js +0 -1
- package/dist/client/static/js/railroad-peg-WCYAUIDC-78w88znz.js +0 -1
- package/dist/client/static/js/sequenceDiagram-PO4LG4MO-c0tk7gfn.js +0 -169
- package/dist/client/static/js/sql-hd42h8wx.js +0 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-rz309qrx.js +0 -8
- package/dist/client/static/js/treeView-Q6P3EWNA-g2bkjr4z.js +0 -1
- package/dist/client/static/js/treemap-WGGIJYW6-pj7yw9rw.js +0 -1
- package/dist/client/static/js/tsx-xjp2ds8g.js +0 -1
- package/dist/client/static/js/typescript-yg97da8h.js +0 -1
- package/dist/client/static/js/wardley-WFR3VGLG-c7ekf8r2.js +0 -1
- package/dist/client/static/js/xml-nrb23phz.js +0 -1
- package/dist/client/static/js/yaml-sqs6pjpx.js +0 -1
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Markdown → the segments a speech engine should read.
|
|
8
|
+
*
|
|
9
|
+
* The assistant writes markdown for a screen: fenced code, tables, link
|
|
10
|
+
* targets, file paths and emphasis markers. Speaking that text verbatim is the
|
|
11
|
+
* classic text-to-speech failure — a 40-line diff read aloud, a URL spelled
|
|
12
|
+
* character by character, `**bold**` pronounced as asterisks. The rules here
|
|
13
|
+
* mirror omp's own `SpeakableStream`: drop what cannot be spoken, speak a
|
|
14
|
+
* link's label instead of its target, a URL's host instead of its path, and a
|
|
15
|
+
* long path's basename.
|
|
16
|
+
*
|
|
17
|
+
* Pure and synchronous. The player owns timing, network and playback; this
|
|
18
|
+
* module only answers "what is worth saying, and where may a request end?".
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
const FENCE_RE = /```[\s\S]*?```|~~~[\s\S]*?~~~/g;
|
|
22
|
+
const IMAGE_RE = /!\[([^\]]*)\]\(([^()]*)\)/g;
|
|
23
|
+
const LINK_RE = /\[([^\]]+)\]\(([^()]*)\)/g;
|
|
24
|
+
const AUTOLINK_RE = /<(https?:\/\/[^\s>]+)>/g;
|
|
25
|
+
const BARE_URL_RE = /\bhttps?:\/\/[^\s<>()"'\]]+|\bwww\.[\w-]+(?:\.[\w-]+)+[^\s<>()"'\]]*/g;
|
|
26
|
+
const INLINE_CODE_RE = /`{1,2}([^`]+)`{1,2}/g;
|
|
27
|
+
const BOLD_STRIKE_RE = /\*\*|__|~~/g;
|
|
28
|
+
const EMPHASIS_ASTERISK_RE = /\*(?=\S)|(?<=\S)\*/g;
|
|
29
|
+
const EMPHASIS_UNDERSCORE_RE = /(^|\s)_+|_+(?=\s|$)/g;
|
|
30
|
+
const HTML_TAG_RE = /<\/?[a-zA-Z][^<>]*>/g;
|
|
31
|
+
const HR_INLINE_RE = /(^|\s)[-*_]{3,}(?=\s|$)/g;
|
|
32
|
+
const PATH_RE = /(^|[\s("'`])((?:~|\.{1,2})?\/?[\w.@+-]+(?:\/[\w.@+-]+){2,}\/?)/g;
|
|
33
|
+
const HAS_SPEAKABLE_RE = /[\p{L}\p{N}]/u;
|
|
34
|
+
const SENTENCE_BOUNDARY_RE = /[.!?…]+[)\]"'»”’]*\s/g;
|
|
35
|
+
const ABBREVIATION_RE = /(?:^|\s)(?:e\.g|i\.e|etc|vs|Mr|Mrs|Ms|Dr|St|No)\.$/i;
|
|
36
|
+
|
|
37
|
+
/** "https://github.com/foo/bar?x#y" → "github.com". */
|
|
38
|
+
function speakableUrl(url: string): string {
|
|
39
|
+
return url
|
|
40
|
+
.replace(/^[a-z][\w+.-]*:\/\//i, '')
|
|
41
|
+
.replace(/^www\./i, '')
|
|
42
|
+
.replace(/[/?#].*$/, '');
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** One raw slice → its speakable form; '' when nothing is worth vocalizing. */
|
|
46
|
+
function normalizeSpeakable(raw: string): string {
|
|
47
|
+
const spoken = raw
|
|
48
|
+
.replace(IMAGE_RE, '$1')
|
|
49
|
+
.replace(LINK_RE, '$1')
|
|
50
|
+
.replace(AUTOLINK_RE, (_match, url: string) => speakableUrl(url))
|
|
51
|
+
.replace(BARE_URL_RE, (match) => speakableUrl(match))
|
|
52
|
+
.replace(INLINE_CODE_RE, '$1')
|
|
53
|
+
.replace(BOLD_STRIKE_RE, '')
|
|
54
|
+
.replace(EMPHASIS_ASTERISK_RE, '')
|
|
55
|
+
.replace(EMPHASIS_UNDERSCORE_RE, '$1')
|
|
56
|
+
.replace(HTML_TAG_RE, ' ')
|
|
57
|
+
.replace(HR_INLINE_RE, '$1')
|
|
58
|
+
.replace(PATH_RE, (_match, lead: string, path: string) => {
|
|
59
|
+
const parts = path.split('/').filter((part) => part.length > 0);
|
|
60
|
+
return lead + (parts[parts.length - 1] ?? path);
|
|
61
|
+
})
|
|
62
|
+
.replace(/\s+/g, ' ')
|
|
63
|
+
.trim();
|
|
64
|
+
return HAS_SPEAKABLE_RE.test(spoken) ? spoken : '';
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** A line that carries no speakable prose. */
|
|
68
|
+
function isSilentLine(line: string): boolean {
|
|
69
|
+
const trimmed = line.trim();
|
|
70
|
+
if (!trimmed) return false;
|
|
71
|
+
if (trimmed.startsWith('|')) return true;
|
|
72
|
+
if (/^(?:-{3,}|\*{3,}|_{3,})\s*$/.test(trimmed)) return true;
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Strip block markup, drop tables and code, and collapse the rest into one
|
|
78
|
+
* prose string. The newline becomes a space: a heading and the paragraph under
|
|
79
|
+
* it are read as separate sentences by the punctuation, not by the layout.
|
|
80
|
+
*/
|
|
81
|
+
export function speakableText(markdown: string): string {
|
|
82
|
+
const withoutFences = markdown.replace(FENCE_RE, ' ');
|
|
83
|
+
const lines = withoutFences.split('\n').flatMap((line) => {
|
|
84
|
+
if (isSilentLine(line)) return [];
|
|
85
|
+
let text = line;
|
|
86
|
+
text = text.replace(/^\s{0,3}#{1,6}\s+/, '');
|
|
87
|
+
text = text.replace(/^\s{0,3}>\s?/, '');
|
|
88
|
+
text = text.replace(/^\s{0,3}[-*+]\s+/, '');
|
|
89
|
+
text = text.replace(/^\s{0,3}(\d{1,3})[.)]\s+/, '$1. ');
|
|
90
|
+
return text.trim() ? [text.trim()] : [];
|
|
91
|
+
});
|
|
92
|
+
return normalizeSpeakable(lines.join(' '));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** Sentence boundaries that exist in `text`, as end offsets. */
|
|
96
|
+
function sentenceEnds(text: string): number[] {
|
|
97
|
+
const ends: number[] = [];
|
|
98
|
+
SENTENCE_BOUNDARY_RE.lastIndex = 0;
|
|
99
|
+
for (let match = SENTENCE_BOUNDARY_RE.exec(text); match; match = SENTENCE_BOUNDARY_RE.exec(text)) {
|
|
100
|
+
const cut = match.index + match[0].length;
|
|
101
|
+
const head = text.slice(0, cut).trimEnd();
|
|
102
|
+
if (ABBREVIATION_RE.test(head)) continue;
|
|
103
|
+
if ((head.match(/`/g)?.length ?? 0) % 2 !== 0) continue;
|
|
104
|
+
ends.push(cut);
|
|
105
|
+
}
|
|
106
|
+
return ends;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** Latest position at or below `max` that ends a word. */
|
|
110
|
+
function wordCut(text: string, max: number): number {
|
|
111
|
+
const space = text.lastIndexOf(' ', max);
|
|
112
|
+
return space > 0 ? space + 1 : Math.min(max, text.length);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** Split one sentence that exceeds `max` into word-sized pieces. */
|
|
116
|
+
function splitLong(sentence: string, max: number): string[] {
|
|
117
|
+
const pieces: string[] = [];
|
|
118
|
+
let rest = sentence;
|
|
119
|
+
while (rest.length > max) {
|
|
120
|
+
const cut = wordCut(rest, max);
|
|
121
|
+
pieces.push(rest.slice(0, cut).trim());
|
|
122
|
+
rest = rest.slice(cut).trim();
|
|
123
|
+
}
|
|
124
|
+
if (rest) pieces.push(rest);
|
|
125
|
+
return pieces;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* The request-sized pieces of an answer, in order.
|
|
130
|
+
*
|
|
131
|
+
* `firstMax` is smaller than `maxChars` on purpose: the first request is what
|
|
132
|
+
* decides time-to-first-audio, and a 600-character first chunk spends seconds
|
|
133
|
+
* synthesizing before the user hears anything. Later chunks fill the engine's
|
|
134
|
+
* budget.
|
|
135
|
+
*/
|
|
136
|
+
export function speechChunks(
|
|
137
|
+
markdown: string,
|
|
138
|
+
maxChars: number,
|
|
139
|
+
firstMax = Math.min(320, maxChars),
|
|
140
|
+
): string[] {
|
|
141
|
+
const text = speakableText(markdown);
|
|
142
|
+
if (!text) return [];
|
|
143
|
+
const limit = Math.max(1, Math.floor(maxChars));
|
|
144
|
+
const firstLimit = Math.max(1, Math.min(Math.floor(firstMax), limit));
|
|
145
|
+
|
|
146
|
+
const sentences: string[] = [];
|
|
147
|
+
let start = 0;
|
|
148
|
+
for (const end of sentenceEnds(text)) {
|
|
149
|
+
const sentence = text.slice(start, end).trim();
|
|
150
|
+
if (sentence) sentences.push(sentence);
|
|
151
|
+
start = end;
|
|
152
|
+
}
|
|
153
|
+
const tail = text.slice(start).trim();
|
|
154
|
+
if (tail) sentences.push(tail);
|
|
155
|
+
|
|
156
|
+
const chunks: string[] = [];
|
|
157
|
+
let current = '';
|
|
158
|
+
let currentLimit = firstLimit;
|
|
159
|
+
const flush = () => {
|
|
160
|
+
if (!current) return;
|
|
161
|
+
chunks.push(current);
|
|
162
|
+
current = '';
|
|
163
|
+
currentLimit = limit;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
for (const sentence of sentences) {
|
|
167
|
+
for (const piece of sentence.length > currentLimit ? splitLong(sentence, currentLimit) : [sentence]) {
|
|
168
|
+
const joined = current ? `${current} ${piece}` : piece;
|
|
169
|
+
if (joined.length > currentLimit) {
|
|
170
|
+
flush();
|
|
171
|
+
current = piece;
|
|
172
|
+
} else {
|
|
173
|
+
current = joined;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
flush();
|
|
178
|
+
return chunks.filter((chunk) => HAS_SPEAKABLE_RE.test(chunk));
|
|
179
|
+
}
|
package/src/shared/types/chat.ts
CHANGED
|
@@ -38,6 +38,13 @@ export interface Attachment {
|
|
|
38
38
|
/** Inlined text-file contents, persisted with the committed user turn so a
|
|
39
39
|
* retry can re-send them without the original `File`. */
|
|
40
40
|
content?: string;
|
|
41
|
+
/**
|
|
42
|
+
* The file's OWN name, kept when the composer renames `name` from the
|
|
43
|
+
* filename text in the draft. Classification reads this: a pasted `notes.md`
|
|
44
|
+
* whose name the user edits to `catatan` must still be inlined as text at
|
|
45
|
+
* send time, and only the extension this name carries can say so.
|
|
46
|
+
*/
|
|
47
|
+
sourceName?: string;
|
|
41
48
|
/**
|
|
42
49
|
* Set when `content` came from sniffing the file's bytes rather than from its
|
|
43
50
|
* name or MIME. A promised-file drag from another app has neither, so without
|
|
@@ -162,7 +169,7 @@ export interface ChatMessageData {
|
|
|
162
169
|
date?: string;
|
|
163
170
|
timestamp?: string;
|
|
164
171
|
content: string;
|
|
165
|
-
attachments?: { id?: string; name: string; preview?: string; type?: string; size?: number }[];
|
|
172
|
+
attachments?: { id?: string; name: string; sourceName?: string; preview?: string; type?: string; size?: number }[];
|
|
166
173
|
thinking?: ThinkingData | string;
|
|
167
174
|
/** Short human intent for tool calls (omp arguments.i) shown before the tools. */
|
|
168
175
|
intent?: string;
|
|
@@ -272,6 +272,38 @@ export interface PanelRegistryPayload {
|
|
|
272
272
|
* with nothing on screen to say why.
|
|
273
273
|
*/
|
|
274
274
|
syncBlocked: Record<string, PanelSyncBlocked>;
|
|
275
|
+
/**
|
|
276
|
+
* GitHub repositories the marketplace registers as plugin sources.
|
|
277
|
+
*
|
|
278
|
+
* Both the registration and the last cached read travel here, because they are
|
|
279
|
+
* different facts and either can be the interesting one: `repo` is what the
|
|
280
|
+
* user added, while `pluginCount`/`fetchedAt`/`error` describe the refresh. A
|
|
281
|
+
* failed refresh keeps the registration with its reason rather than making the
|
|
282
|
+
* repository vanish from the pane.
|
|
283
|
+
*/
|
|
284
|
+
registries: PanelPluginSource[];
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* One registered GitHub repository, as the pane renders it.
|
|
289
|
+
*
|
|
290
|
+
* `pluginCount` is what the repository's last successful read offered, so a
|
|
291
|
+
* registration whose fetch has never succeeded shows zero plugins and an
|
|
292
|
+
* `error`, never a silent empty row.
|
|
293
|
+
*/
|
|
294
|
+
export interface PanelPluginSource {
|
|
295
|
+
/** `owner/repo` on GitHub. */
|
|
296
|
+
repo: string;
|
|
297
|
+
url: string;
|
|
298
|
+
name: string;
|
|
299
|
+
description?: string;
|
|
300
|
+
/** ISO time of the last successful refresh. */
|
|
301
|
+
fetchedAt?: string;
|
|
302
|
+
/** Why the last refresh failed. The registration is kept. */
|
|
303
|
+
error?: string;
|
|
304
|
+
/** Entries of the repository's catalog that could not be offered, and why. */
|
|
305
|
+
warning?: string;
|
|
306
|
+
pluginCount: number;
|
|
275
307
|
}
|
|
276
308
|
|
|
277
309
|
/** A bundled plugin whose sync a local edit refused. */
|
|
@@ -179,5 +179,28 @@ export interface PanelMarketplaceManifest {
|
|
|
179
179
|
description?: string;
|
|
180
180
|
owner?: { name?: string };
|
|
181
181
|
plugins?: PanelMarketplacePluginEntry[];
|
|
182
|
+
/** GitHub repositories this catalog registers as further plugin sources. */
|
|
183
|
+
registries?: PanelMarketplaceRegistryEntry[];
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* A GitHub repository a `marketplace.json` registers as a plugin source.
|
|
188
|
+
*
|
|
189
|
+
* This is what lets a user publish a plugin in their own repository and have it
|
|
190
|
+
* appear in the pane's Available list without vendoring it into this
|
|
191
|
+
* marketplace: the entry names the repository, the server reads the repository's
|
|
192
|
+
* own catalog when it can, and every plugin it offers becomes installable.
|
|
193
|
+
*
|
|
194
|
+
* The repository must follow the ecosystem naming rule
|
|
195
|
+
* (`kabmo-plugins-<plugin>`, `src/shared/lib/panels/plugin-repo.ts`). The PLUGIN
|
|
196
|
+
* name it publishes is free-form — the prefix belongs to the repository, never
|
|
197
|
+
* to the plugin.
|
|
198
|
+
*/
|
|
199
|
+
export interface PanelMarketplaceRegistryEntry {
|
|
200
|
+
/** `owner/repo` on GitHub. */
|
|
201
|
+
repo: string;
|
|
202
|
+
/** Display name; the repository name without the prefix when absent. */
|
|
203
|
+
name?: string;
|
|
204
|
+
description?: string;
|
|
182
205
|
}
|
|
183
206
|
|
|
@@ -35,6 +35,13 @@ export interface SessionChangeRecord {
|
|
|
35
35
|
before: string | null | undefined;
|
|
36
36
|
/** Blob key of the content after the write; `null` when the write deleted the file. */
|
|
37
37
|
after: string | null | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Whether the file existed before this write, when the journal stores hunks
|
|
40
|
+
* (`base: null` / `sum: '-'`) instead of blob keys. Absent when unknown.
|
|
41
|
+
*/
|
|
42
|
+
existedBefore?: boolean;
|
|
43
|
+
/** Whether it existed after the write; absent when the journal has no answer. */
|
|
44
|
+
existsAfter?: boolean;
|
|
38
45
|
}
|
|
39
46
|
|
|
40
47
|
/** One file a run changed, as the collapsed summary lists it. */
|
|
@@ -54,6 +61,9 @@ export interface SessionChangeCounts {
|
|
|
54
61
|
removed: number;
|
|
55
62
|
}
|
|
56
63
|
|
|
64
|
+
/** Why a journal side cannot be read. */
|
|
65
|
+
export type SessionChangeUnavailableReason = 'too-large' | 'snapshot-race' | 'unreadable';
|
|
66
|
+
|
|
57
67
|
/** The two sides of one file's net change in a run, plus a unified patch. */
|
|
58
68
|
export interface SessionChangeDiff {
|
|
59
69
|
path: string;
|
|
@@ -63,6 +73,10 @@ export interface SessionChangeDiff {
|
|
|
63
73
|
newContent: string;
|
|
64
74
|
/** Unified diff of the two sides; empty when they are equal. */
|
|
65
75
|
diff: string;
|
|
66
|
-
/** A
|
|
76
|
+
/** A side was not stored, or its stored copy is gone, so the pair is unknown. */
|
|
67
77
|
unavailable: boolean;
|
|
78
|
+
/** Why a side is unknown; absent when `unavailable` is false. */
|
|
79
|
+
unavailableReason?: SessionChangeUnavailableReason;
|
|
80
|
+
/** The store's content cap that dropped the side; only for `too-large`. */
|
|
81
|
+
unavailableLimitBytes?: number;
|
|
68
82
|
}
|
|
@@ -10,12 +10,18 @@ import type { IconStyle } from '@/shared/lib/theme/icon-style';
|
|
|
10
10
|
import type { TrayIconStyle } from '@/shared/lib/theme/tray-icon-style';
|
|
11
11
|
import type { SettingsSection } from '@/shared/lib/settings/sections';
|
|
12
12
|
import type { GitIdentity } from '@/shared/lib/git/identity';
|
|
13
|
+
import type { DictationConfig } from '@/shared/lib/dictation/settings';
|
|
14
|
+
import type { TtsConfig } from '@/shared/lib/tts/settings';
|
|
13
15
|
|
|
14
16
|
/** Wire protocol for the live agent event stream (chat timeline). */
|
|
15
17
|
export type SettingsCategoryId =
|
|
16
18
|
// KABMO
|
|
17
19
|
| 'appearance'
|
|
18
20
|
| 'chats'
|
|
21
|
+
/** Voice: the composer mic (STT) and spoken answers (TTS). One category
|
|
22
|
+
* because both decide where AUDIO goes, and a reader looking for one
|
|
23
|
+
* expects the other beside it. */
|
|
24
|
+
| 'voice'
|
|
19
25
|
| 'keyboard'
|
|
20
26
|
| 'notifications'
|
|
21
27
|
| 'usage'
|
|
@@ -290,4 +296,23 @@ export interface SettingsState {
|
|
|
290
296
|
keybindingSend: 'Enter' | 'Shift + Enter' | 'Ctrl / Cmd + Enter';
|
|
291
297
|
keybindingNewLine: 'Enter' | 'Shift + Enter' | 'Ctrl / Cmd + Enter';
|
|
292
298
|
keybindingSteering: 'Enter' | 'Shift + Enter' | 'Ctrl / Cmd + Enter';
|
|
299
|
+
/**
|
|
300
|
+
* Composer dictation: which engine transcribes the mic, in which language,
|
|
301
|
+
* with which model, and the capture limits. One object because every field is
|
|
302
|
+
* read together by the same hook, and the normaliser in
|
|
303
|
+
* `shared/lib/dictation/settings.ts` is the only place that decides what an
|
|
304
|
+
* absent or hostile value means.
|
|
305
|
+
*
|
|
306
|
+
* The API key is NOT here: this object ships to the browser in the bootstrap,
|
|
307
|
+
* so a credential would be readable by any script on the origin. It lives in
|
|
308
|
+
* `~/.kabmo/dictation.json` (0600) behind its own route.
|
|
309
|
+
*/
|
|
310
|
+
dictation: DictationConfig;
|
|
311
|
+
/**
|
|
312
|
+
* Spoken answers: which engine reads the assistant's final text, in which
|
|
313
|
+
* voice, and whether a settled run is read automatically. The API keys are
|
|
314
|
+
* NOT here for the same reason dictation's key is not: the blob ships to the
|
|
315
|
+
* browser. They live in `~/.kabmo/tts.json` (0600) behind their own route.
|
|
316
|
+
*/
|
|
317
|
+
tts: TtsConfig;
|
|
293
318
|
}
|
|
@@ -95,8 +95,91 @@ export interface DeepSeekUsageReport {
|
|
|
95
95
|
error?: string;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
/**
|
|
99
|
-
|
|
98
|
+
/**
|
|
99
|
+
* The allowance Token Harbor reports for one account
|
|
100
|
+
* (`GET https://tokenharbor.ai/api/cli/free-tier`).
|
|
101
|
+
*
|
|
102
|
+
* Percentages only, by contract: the endpoint states how much of each allowance
|
|
103
|
+
* is used and never a dollar remainder, so a card built from it must not imply
|
|
104
|
+
* an amount. A Pass allowance and the free-model allowance are metered
|
|
105
|
+
* separately but share ONE 7-day window, hence a single `resetAt`.
|
|
106
|
+
*/
|
|
107
|
+
export interface TokenHarborAllowance {
|
|
108
|
+
/** "Agent Pass" | "Office Pass" | "Frontier Pass", or null without a Pass. */
|
|
109
|
+
planName: string | null;
|
|
110
|
+
/** False when the account holds no Pass: there is no Pass allowance to draw. */
|
|
111
|
+
onPlan: boolean;
|
|
112
|
+
/** Percent of the 7-day Pass allowance used (0-100), null on schema drift. */
|
|
113
|
+
planUsedPct: number | null;
|
|
114
|
+
/**
|
|
115
|
+
* The Pass allowance is spent for this window. Authoritative over
|
|
116
|
+
* `planUsedPct`: the percentage is rounded, so it can read 100 on a request
|
|
117
|
+
* that is still covered and 99 on the one that is refused.
|
|
118
|
+
*/
|
|
119
|
+
planExhausted: boolean;
|
|
120
|
+
/** Percent of the free-model allowance used (0-100), null on schema drift. */
|
|
121
|
+
usedPct: number | null;
|
|
122
|
+
/** The free allowance is spent for this window. */
|
|
123
|
+
exhausted: boolean;
|
|
124
|
+
/** False until the first request starts the 7-day window. */
|
|
125
|
+
activated: boolean;
|
|
126
|
+
/** When both allowances come back in full; null before the first request. */
|
|
127
|
+
resetAt: string | null;
|
|
128
|
+
periodStartedAt: string | null;
|
|
129
|
+
periodEndsAt: string | null;
|
|
130
|
+
/**
|
|
131
|
+
* The `:free` ids the key can call right now, as the endpoint spells them.
|
|
132
|
+
* Kept verbatim: the docs show a `:free` suffix the live response omits, so
|
|
133
|
+
* rebuilding ids from these would invent a model that does not resolve.
|
|
134
|
+
*/
|
|
135
|
+
freeModels: string[];
|
|
136
|
+
/** False when free models are switched off for the account (calls get 403). */
|
|
137
|
+
modelsEnabled: boolean;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** Token Harbor allowance; present only when Token Harbor has a credential. */
|
|
141
|
+
export interface TokenHarborUsageReport {
|
|
142
|
+
allowance?: TokenHarborAllowance;
|
|
143
|
+
error?: string;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* The wallet TokenPortal reports for one API key (`GET /v1/key`).
|
|
148
|
+
*
|
|
149
|
+
* The endpoint is OpenRouter-shaped, but the numbers are the vendor's own: both
|
|
150
|
+
* money fields are whole units of the `currency` it names (IDR on the live
|
|
151
|
+
* endpoint), NOT cents — `balance` is what is left, `limit` the key's cap, and
|
|
152
|
+
* `limitRemaining` what is left under that cap.
|
|
153
|
+
*/
|
|
154
|
+
export interface TokenPortalBalance {
|
|
155
|
+
/** The key's own label ("Kabmo"), when the endpoint names it. */
|
|
156
|
+
label: string | null;
|
|
157
|
+
/** ISO 4217 code the amounts are denominated in. */
|
|
158
|
+
currency: string;
|
|
159
|
+
/** Money left on this key, in whole `currency` units. */
|
|
160
|
+
balance: number;
|
|
161
|
+
/** The key's spending cap, when the operator set one. */
|
|
162
|
+
limit: number | null;
|
|
163
|
+
/** Money left under that cap, as the vendor reports it. */
|
|
164
|
+
limitRemaining: number | null;
|
|
165
|
+
/** True while the key is on the free tier. */
|
|
166
|
+
isFreeTier: boolean;
|
|
167
|
+
/** A per-session cap, when the operator set one. */
|
|
168
|
+
sessionBudget: number | null;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/** TokenPortal wallet; present only when TokenPortal has a credential. */
|
|
172
|
+
export interface TokenPortalUsageReport {
|
|
173
|
+
balance?: TokenPortalBalance;
|
|
174
|
+
error?: string;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Unit of a provider-reported quota amount (mirrors omp's `UsageUnit`, plus
|
|
179
|
+
* `idr` for the Rupiah wallets Kabmo reads itself — an IDR amount formatted as
|
|
180
|
+
* USD would misstate the balance by four orders of magnitude).
|
|
181
|
+
*/
|
|
182
|
+
export type UsageUnit = 'percent' | 'tokens' | 'requests' | 'credits' | 'usd' | 'idr' | 'minutes' | 'bytes' | 'unknown';
|
|
100
183
|
|
|
101
184
|
/** Coarse state of one quota window. */
|
|
102
185
|
export type UsageWindowStatus = 'ok' | 'warning' | 'exhausted' | 'unknown';
|
|
@@ -172,6 +255,10 @@ export interface UsageProviderSummary {
|
|
|
172
255
|
kenari?: KenariUsageReport;
|
|
173
256
|
/** Rich DeepSeek report (prepaid balance). */
|
|
174
257
|
deepseek?: DeepSeekUsageReport;
|
|
258
|
+
/** Rich Token Harbor report (Pass + free allowance percentages). */
|
|
259
|
+
tokenHarbor?: TokenHarborUsageReport;
|
|
260
|
+
/** Rich TokenPortal report (wallet, key cap, session budget). */
|
|
261
|
+
tokenPortal?: TokenPortalUsageReport;
|
|
175
262
|
}
|
|
176
263
|
|
|
177
264
|
/** Response body of `GET /api/settings/usage`. */
|
|
@@ -42,6 +42,11 @@ export const DOM_TEST_GLOBALS = [
|
|
|
42
42
|
// while every other component rendered. Listed here they are installed from
|
|
43
43
|
// the window under test and put back with the rest.
|
|
44
44
|
'requestAnimationFrame', 'cancelAnimationFrame',
|
|
45
|
+
// `location` is read as a BARE global by code that builds an origin-relative
|
|
46
|
+
// URL — dictation's socket (`dictationUrl`) is the one that failed here with
|
|
47
|
+
// `ReferenceError: location is not defined` under `bun test`, because the
|
|
48
|
+
// runner defines no `location` and a mounted hook therefore had no origin.
|
|
49
|
+
'location',
|
|
45
50
|
// The three DOM data classes, because a suite that swaps `window` usually needs them and
|
|
46
51
|
// a LOCAL save-and-restore loop is how they leaked: `editor/save-as.test.ts` installed
|
|
47
52
|
// happy-dom's `File`/`Blob` and never put them back, so a later file's `carriesBytes` read
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{e,m,Rr}from"./index-x2v1zmth.js";import{Ei,iu}from"./index-p6s3fz6b.js";function g({source:t,name:r,revision:s=0}){let{url:i,loading:n,error:o}=iu(t,s);if(o)return e(Rr,{name:r,message:o});if(n||!i)return e("div",{className:"flex flex-1 items-center justify-center gap-2 text-xs text-ink/40",children:[e(m,{size:14,className:"animate-spin"}),e("span",{children:"Loading image…"})]});return e(Ei,{src:i,name:r,className:"flex-1 min-h-0"})}export{g as ImageView};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{d,n,o,K,i,u,a,We,le,Ot,dc,e,s,De,Ee,m,nn,rn,_,at,an,f,B,se,ot,re,fe,Tt,Ke,pn,me,qe,ce,ka,Yr,mn,xa,Zn,P,D,U,tl,b,er,nl,Oe,xe,ln,wA,Ha,Vp,gn,rl,Te,Dt,Io,$e,ol,Sr,ue,Z,ct,os,is,od,mc,ge,He,ls,JA,Ac,Et,Qt,Rt,bc,ul,So,dl,pl,dd,Do,Ve,tt,ra,Ye,Ja,gl,Lc,Sa,Mc,md,As,Ta,Qo,Ro,Fo,It,nr,vs,Lo,Mo,Po,Za,hl,bl,yl,vl,rr,Vm,Ym,Oo,zc,Jm,ks,xs,Zm,ws,ef,tf,nf,Uc,hi,kl,Da,bi,rf,af,Gc,jc,of,sf,zh,bd,Uh,zo,yd,xn,lf,cf,uf,df,xl,zg,no,Ef,Bf,Hc,Sl,Nf,Qf,Sd,Rf,o0}from"./index-x2v1zmth.js";import{Fd}from"./index-d2xtbabt.js";import{Jc,Zc,Xc,eu,tu,nu,ru,Bs,au,ou,Go,Is,Ei,su,Tl,lu,cu,uu,du,pu,mu,fu,gu,Au}from"./index-p6s3fz6b.js";import{Ju,Zu,ei,Xu,ed}from"./index-xk1cqjkn.js";import{mt,Bi,bu,yu,ku}from"./index-dxp2yvy7.js";import{Ts,Qa,Fr,xu,wu,jo,Cu,Ds,Gd,Zg,Ns,Qs,Rs,Lr,Fs,Ls,qo,Ms,Ps,Os,$s,_i,Ho,zs,Us,Eu,jd,Bu,Iu,_u,Su,Tu,Du}from"./index-1d8bxjsz.js";import{Ra,Fa}from"./index-52nd4hgm.js";function Je(t){let{editorOpen:r,diffOpen:l,settingsOpen:p,offMainScreen:h,onCloseEditor:g,onCloseDiff:S,onCloseSettings:v,onReturnToMain:x}=t;o(()=>o0(()=>{if(r)return g(),!0;if(l)return S(),!0;if(p)return v(),!0;if(h)return x(),!0;return!1}),[r,l,p,h,g,S,v,x])}var gt="terminal";function Ge(t){return t===gt}function Re(t){if(Ge(t))JA()}function Qe({dock:t,sessionId:r,currentScreen:l,setCurrentScreen:p}){let[h,g]=n(0),[S,v]=n(0),x=a(()=>{let k=xe(r,"layout.mobileRightPanel")??dc;Re(k),g((y)=>y+1),p("right")},[r,p]),c=a(()=>{v((k)=>k+1),p("session")},[p]),w=a((k)=>{let y=Uh(k,t);if(!y)return;let M=xe(r,"layout.mobileRightPanel");if(y==="right"&&(l!=="right"||M!==k))Re(k);if(ln(r,y==="left"?"layout.mobileLeftPanel":"layout.mobileRightPanel",k),y==="right")g(0);p(y==="left"?"session":"right")},[t,r,l,p]);return ge(bd,(k)=>{let y=k.detail?.panelKey;if(y)w(y)}),{right:h,left:S,openSessionDrawer:c,openRightDrawer:x,openNamedPanel:w}}var vt={name:"menu",size:24,node:[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]},eo=s(vt);function Le(){let t=ls(),[r,l]=n(null),p=a((S,v)=>{l({top:v,bottom:v,left:S,right:S})},[]),h=Ju({enabled:t,onLongPress:p}),g=a(()=>l(null),[]);return{anchor:r,close:g,surfaceProps:{onContextMenu:(S)=>{S.preventDefault();let v=S.currentTarget.getBoundingClientRect();l({top:v.top,bottom:v.bottom,left:v.left,right:v.right})},onTouchStart:h.onTouchStart,onTouchMove:h.onTouchMove,onTouchEnd:h.onTouchEnd,onTouchCancel:h.onTouchCancel,onClickCapture:(S)=>{if(!h.consume())return;S.preventDefault(),S.stopPropagation()}}}}var St=10,oo=600000;function to({activeSessionTitle:t,activeSessionId:r,onOpenSessionSidebar:l,onOpenRightSidebar:p,onNewSession:h,onSelectSession:g}){let{folders:S}=Ye(),v=Sd(),x=Ta(r),[c,w]=n(null),{hidden:k,setHidden:y}=cf(),M=Le(),T=yd("mobile"),I=u(()=>{let C=Date.now(),A=[];for(let E of S)for(let O of E.sessions??[]){if(O.is_archived===1)continue;let R=wA(String(O.id)),L=O.updated_at?Date.parse(O.updated_at):0,q=R!==void 0&&C-R<=oo?R:L;if(R!==void 0&&C-R>oo)continue;A.push({id:O.id,title:O.title,folderName:E.name,modified:q})}return A.sort((E,O)=>O.modified-E.modified).slice(0,St)},[S]),N=t?t.charAt(0).toUpperCase()+t.slice(1):"New session";return e("header",{className:`flex-shrink-0 bg-canvas border-b border-ink/10 flex items-center justify-between ${ol} px-3 z-20 titlebar-drag-region select-none`,...Da(),...M.surfaceProps,style:zo(),children:[e("div",{className:"flex items-center space-x-2 flex-1 min-w-0 titlebar-no-drag",children:[e("button",{type:"button",onClick:l,className:"w-9 h-9 rounded-lg hover:bg-ink/5 active:bg-ink/10 text-ink transition-colors flex-shrink-0 inline-flex items-center justify-center",title:"Open Sessions","aria-label":"Open Sessions",children:e(eo,{size:20,strokeWidth:2})}),e("span",{className:"relative font-bold text-sm tracking-tight flex items-center flex-shrink-0",children:[e(Sa,{glow:!0}),e("span",{className:"absolute -top-0.5 -right-1.5 flex",children:e(Uc,{status:v})})]}),e("span",{className:"text-ink/25 font-light text-xs flex-shrink-0 select-none",children:"/"}),e("div",{className:"relative min-w-0 flex-1 max-w-[150px]","data-testid":"session-picker",children:[e("button",{type:"button",onClick:(C)=>{w((A)=>A?null:Et(C.currentTarget))},className:"tap-chip flex w-full items-center space-x-1 text-xs font-semibold text-ink hover:text-ink/80 transition-colors py-1 min-w-0",title:N,"aria-haspopup":"menu","aria-expanded":c!==null,children:[e("span",{className:"truncate",children:N}),x&&e(m,{size:12,className:"animate-spin text-ink/50 flex-shrink-0",role:"status","aria-label":"Generating a session name…"}),e(B,{size:13,className:"text-ink/50 flex-shrink-0"})]}),c&&e(Qt,{anchor:c,align:"start",className:"w-72 bg-paper border border-ink/15 rounded-xl shadow-lg p-2 text-xs",onClose:()=>w(null),children:[e("button",{type:"button",onClick:()=>{w(null),h()},className:"w-full text-left px-3 py-2 rounded-lg bg-ink text-canvas flex items-center space-x-2 font-medium mb-1.5",children:[e(P,{size:14}),e("span",{children:"Start New Session"})]}),e("div",{className:"px-2 py-1 text-[10px] uppercase font-bold text-ink/40",children:"Recent Sessions"}),e("div",{className:"max-h-64 scrollbar-overlay-container space-y-0.5",children:I.length===0?e("div",{className:"px-2.5 py-2 text-ink/40 italic",children:"No sessions yet"}):I.map((C)=>e("button",{type:"button",onClick:()=>{w(null),g(C.id)},className:`w-full text-left px-2.5 py-1.5 rounded-lg flex items-center justify-between space-x-2 transition-colors ${String(r)===String(C.id)?"bg-ink/10 font-semibold text-ink":"hover:bg-ink/5 text-ink/80"}`,children:[e("span",{className:"min-w-0 flex flex-col",children:[e("span",{className:"truncate",children:C.title?C.title.charAt(0).toUpperCase()+C.title.slice(1):"Untitled"}),e("span",{className:"truncate text-[10px] text-ink/40 font-mono",children:C.folderName})]}),String(r)===String(C.id)&&e(f,{size:12,className:"flex-shrink-0"})]},C.id))})]})]})]}),e(uf,{layout:"mobile",sessionId:r==null?null:String(r),showRightPanel:!1,onToggleRightPanel:p,entries:T,hidden:k}),M.anchor?e(Oo,{anchor:M.anchor,title:"Navbar",align:"right",items:lf([...T.inline,...T.folded]).filter((C)=>C.id!==xn.install).map((C)=>({...C,removable:!0})),hidden:k,onToggle:y,onClose:M.close}):null]})}function io({activeSessionId:t,onSelectSession:r,onNewSession:l,onOpenSessionSidebar:p,onOpenRightSidebar:h,appSettings:g={}}){let{folders:S}=Ye(),[v,x]=n(null),c=u(()=>{if(!t)return"New session";for(let k of S){let y=k.sessions?.find((M)=>String(M.id)===String(t));if(y)return y.title}return null},[t,S]);return e("div",{className:"flex flex-col h-full w-full bg-canvas text-ink relative",children:[e(to,{activeSessionTitle:v||c||"New session",activeSessionId:t,onOpenSessionSidebar:p,onOpenRightSidebar:h,onNewSession:l,onSelectSession:r}),e("main",{className:"flex-1 min-h-0",children:e(Bf,{appSettings:g,onSessionTitle:x,variant:"mobile"})})]})}function ro({onClose:t,viewLabel:r="Sessions",menuProps:l}){return e("div",{className:"border-b border-ink/10 flex items-center justify-between px-3 flex-shrink-0 bg-canvas titlebar-drag-region select-none",...Da(),...l,style:{...zo()},children:[e("div",{className:"flex items-center space-x-2.5 titlebar-no-drag min-w-0",children:[e("span",{className:"font-bold text-sm tracking-tight flex items-center flex-shrink-0",children:e(Sa,{className:"text-[16px]",glow:!0})}),e("span",{className:"text-ink/25 text-xs select-none flex-shrink-0",children:"/"}),e("span",{className:"text-[11px] font-semibold text-ink/60 uppercase tracking-wider font-mono truncate",children:r})]}),e("div",{className:"flex items-center gap-1 titlebar-no-drag flex-shrink-0",children:[e(df,{variant:"chip"}),e("button",{type:"button",onClick:t,className:"w-9 h-9 rounded-xl hover:bg-ink/5 active:bg-ink/10 text-ink flex items-center justify-center transition-colors cursor-pointer",title:"Close sidebar","aria-label":"Close sidebar",children:e(b,{size:19,strokeWidth:2})})]})]})}function so({onSettings:t,onKeyBindings:r,onAbout:l,updateAvailable:p,onUpdateClick:h,onDesktopToggle:g,shellDownload:S}){return e("div",{className:"px-3 pt-3 border-t border-ink/10 flex items-center justify-between flex-shrink-0 bg-canvas text-xs text-ink/60",style:{paddingBottom:"max(0.75rem, env(safe-area-inset-bottom, 0px))"},children:[e("div",{className:"flex items-center space-x-3",children:[e("button",{type:"button",onClick:t,className:"flex items-center space-x-1 hover:text-ink transition-colors",children:[e(tl,{size:14}),e("span",{children:"Settings"})]}),e("button",{type:"button",onClick:r,className:"flex items-center space-x-1 hover:text-ink transition-colors",children:[e(ka,{size:14}),e("span",{children:"Keys"})]}),e("button",{type:"button",onClick:l,className:"flex items-center space-x-1 hover:text-ink transition-colors",children:[e(ce,{size:14}),e("span",{children:"About"})]}),S&&e(nf,{download:S,variant:"label"}),g&&e("button",{type:"button",onClick:g,className:"flex items-center space-x-1 hover:text-ink transition-colors",title:"Switch to desktop view",children:[e(xa,{size:14}),e("span",{children:"Desktop"})]})]}),e("div",{className:"flex items-center gap-2",children:[e("span",{className:"font-mono text-[10px] text-ink/40",children:["v",Lc.version]}),p&&e("button",{type:"button",onClick:h,className:"px-2 py-0.5 rounded-full border border-ink/20 text-[10px] font-semibold text-ink hover:border-ink/40",children:"update"})]})]})}function ao(t){let r=rf(),l=tf();return ge(Mc,()=>{t.onClose(),t.openAbout(),r.apply("kabmo").then((p)=>{if(!p)return;t.pushToast(p.message,mc(p))})}),af(r,t.pushToast),{updates:r,shellDownload:l}}function lo(t,r,l){return t.filter((p)=>p.id!==r&&!(l&&p.side==="left"))}function co(t){return t}var xt=8;function Be({panels:t,activeId:r,onSelect:l,hasGitChanges:p=!1}){let h=i(null),g=i(new Map),S=i({activeId:r,panels:t});S.current={activeId:r,panels:t};let v=i({signature:"",width:0}),x=a(()=>{let c=h.current,w=g.current.get(S.current.activeId);if(!c||!w||c.clientWidth<=0)return;let k=`${S.current.activeId}\x00${S.current.panels.map((N)=>N.id).join("\x00")}`,y=v.current;if(y.signature===k&&y.width===c.clientWidth)return;v.current={signature:k,width:c.clientWidth};let M=c.getBoundingClientRect(),T=w.getBoundingClientRect(),I=Jm({scrollLeft:c.scrollLeft,clientWidth:c.clientWidth,scrollWidth:c.scrollWidth,start:T.left-M.left+c.scrollLeft,size:T.width},xt);if(I!==c.scrollLeft)c.scrollLeft=I},[]);return K(x,[r,t,x]),o(()=>{let c=h.current;if(!c||typeof ResizeObserver>"u")return;let w=new ResizeObserver(x);return w.observe(c),()=>w.disconnect()},[x]),e("div",{ref:h,className:"flex items-center space-x-1.5 overflow-x-auto no-scrollbar py-1",children:t.map((c)=>{let w=c.id===r;return e("button",{ref:(k)=>{if(k)g.current.set(c.id,k);else g.current.delete(c.id)},type:"button",onClick:()=>l(c.id),"aria-pressed":w,"aria-label":c.title,className:`tap-chip relative flex shrink-0 items-center transition-all cursor-pointer ${w?"space-x-1.5 px-3 py-1.5 rounded-lg text-xs font-semibold bg-ink text-canvas shadow-sm":"p-2 rounded-lg text-ink/70 hover:bg-ink/5"}`,title:c.title,children:[e(Ja,{panelId:c.id,builtin:c.builtin,icon:c.builtin?c.icon:void 0,name:c.builtin?c.label:c.name,...c.iconUrl?{iconUrl:c.iconUrl}:{},...c.color?{color:c.color}:{},size:Ot}),w&&e("span",{className:`shrink-0 whitespace-nowrap ${c.id==="git"?"tracking-wide":""}`,children:c.label}),c.id==="git"&&p&&e("span",{className:"absolute top-1 right-1 w-1.5 h-1.5 rounded-full bg-info",title:"Uncommitted changes"})]},c.id)})})}function po({panels:t,activeId:r,onSelect:l,menuProps:p}){return e("div",{className:"px-3 py-1.5 border-b border-ink/10 bg-canvas flex-shrink-0",...p,children:e(Be,{panels:t,activeId:r,onSelect:l})})}function mo({panelKey:t,panel:r,body:l}){if(!r)return e("div",{className:"flex-1 min-h-0",children:e(zc,{panelKey:t})});return e("div",{className:"flex-1 min-h-0 overflow-hidden relative",children:e(We,{fallback:e("div",{className:"h-full flex items-center justify-center text-ink/40",children:e("span",{className:"text-xs font-mono",children:"Loading…"})}),children:e(Io,{value:l,children:r.render(l)})})})}var Ae="w-9.5 h-9.5 rounded-xl border flex items-center justify-center transition-all flex-shrink-0 cursor-pointer shadow-xs",Fe="border-ink/15 bg-paper hover:bg-ink/5 text-ink/80 hover:text-ink",uo="bg-ink/10 text-ink border-ink/30";function fo({searchQuery:t,sortOption:r,optionsOpen:l,showArchived:p,optionsRef:h,onNewSession:g,onNewWorkspace:S,onScheduler:v,scheduledCount:x,onRefresh:c,refreshing:w,onToggleOptions:k,onSortChange:y,onResetSort:M,onToggleArchived:T,onHideArchived:I,onSearchChange:N,onClearSearch:C,onSelectWorkspaces:A,selecting:E}){let{ref:O,width:R}=Ds(0),L=Zg(R),q={};for(let X of Gd.slice(0,L))q[X]=!0;let z=Gd.slice(L),F=p?"Hide archived sessions":"Show archived sessions",te=x>0?`Scheduled tasks (${x} armed)`:"Scheduled tasks",H=[];if(z.includes("new-workspace"))H.push({id:"new-workspace",label:"New Workspace",icon:pn,onSelect:S});if(z.includes("refresh"))H.push({id:"refresh",label:"Refresh sessions",icon:D,onSelect:c});if(z.includes("scheduler"))H.push({id:"scheduler",label:te,icon:Qa,onSelect:v});if(z.includes("archive"))H.push({id:"archive",label:F,icon:at,onSelect:T,active:p});if(z.includes("select"))H.push({id:"select",label:E?"Cancel selection":"Select workspaces",icon:Fr,onSelect:A,active:E});return e("div",{className:"p-3 border-b border-ink/10 flex flex-col space-y-2.5 flex-shrink-0 bg-canvas",children:[e("div",{ref:O,className:"flex items-center space-x-2",children:[e("button",{type:"button",onClick:g,"aria-label":"New Session",title:"New Session",className:"flex-1 min-w-0 h-9.5 flex items-center justify-center space-x-2 px-3.5 rounded-xl bg-ink text-canvas hover:bg-ink/90 text-xs font-semibold transition-all shadow-xs",children:[e(P,{size:15,strokeWidth:2.4,className:"shrink-0"}),e("span",{className:"min-w-0 truncate",children:"New Session"})]}),q["new-workspace"]&&e("button",{type:"button",onClick:S,className:`${Ae} ${Fe}`,title:"New Workspace","aria-label":"New Workspace",children:e(pn,{size:16,strokeWidth:1.8})}),q.scheduler&&e("button",{type:"button",onClick:v,className:`relative ${Ae} ${Fe}`,title:te,"aria-label":x>0?`Scheduled tasks, ${x} armed`:"Scheduled tasks",children:[e(Qa,{size:16,strokeWidth:1.8}),x>0&&e("span",{className:"absolute -top-0.5 -right-0.5 min-w-[13px] h-[13px] px-[3px] rounded-full bg-ink text-canvas text-[10px] leading-[13px] text-center font-semibold",children:x>9?"9+":x})]}),q.archive&&e("button",{type:"button",onClick:T,"aria-pressed":p,className:`${Ae} ${p?"bg-warning/15 border-warning/40 text-warning":Fe}`,title:F,"aria-label":F,children:e(at,{size:16,strokeWidth:1.8})}),q.select&&e("button",{type:"button",onClick:A,"aria-pressed":E,className:`${Ae} ${E?uo:Fe}`,title:E?"Cancel selection":"Select workspaces","aria-label":E?"Cancel selection":"Select workspaces",children:e(Fr,{size:16,strokeWidth:1.8})}),q.refresh&&e("button",{type:"button",onClick:c,className:`${Ae} ${Fe}`,title:"Refresh sessions","aria-label":"Refresh sessions","aria-busy":w,children:e(D,{size:15,strokeWidth:1.8,className:w?"animate-spin":void 0})}),q.sort&&e("div",{className:"relative flex-shrink-0",ref:h,children:[e("button",{type:"button",onClick:k,className:`${Ae} ${l||r!=="A-Z"?uo:Fe}`,title:"Sort workspaces","aria-label":"Sort workspaces",children:e(Ts,{size:15,strokeWidth:1.8})}),l&&e("div",{className:"glass-popover absolute right-0 top-full mt-2 w-52 bg-paper border border-ink/15 rounded-xl shadow-xl z-50 p-2 text-xs",children:e(jo,{variant:"mobile",sortOption:r,onSortChange:y})})]}),z.length>0&&e(Cu,{actions:H,sortHidden:z.includes("sort"),sortOption:r,onSortChange:y,layout:"mobile"})]}),e("div",{className:"relative flex items-center",children:[e(U,{size:14,className:"absolute left-3 text-ink/40"}),e("input",{type:"text",value:t,onChange:(X)=>N(X.currentTarget.value),placeholder:"Search workspaces & sessions...",className:"w-full bg-paper border border-ink/15 rounded-xl pl-8 pr-8 py-2 text-xs text-ink placeholder-ink/40 focus:outline-none focus:border-ink/40 transition-colors font-mono"}),t&&e("button",{type:"button",onClick:C,className:"absolute right-2.5 text-ink/40 hover:text-ink p-1","aria-label":"Clear search",children:e(b,{size:13})})]}),(p||r!=="A-Z")&&e("div",{className:"flex items-center space-x-1.5 flex-wrap gap-y-1 pt-0.5",children:[r!=="A-Z"&&e("span",{className:"inline-flex items-center space-x-1 bg-ink/5 border border-ink/10 text-ink/80 rounded-lg px-2 py-0.5 text-[10px] font-mono",children:[e("span",{children:["Sort: ",r.replace("_"," ")]}),e("button",{type:"button",onClick:M,className:"hover:text-ink ml-0.5",title:"Reset sort",children:e(b,{size:10})})]}),p&&e("span",{className:"inline-flex items-center space-x-1 bg-warning/15 border border-warning/25 text-warning rounded-lg px-2 py-0.5 text-[10px] font-mono",children:[e(at,{size:10}),e("span",{children:"Archived"}),e("button",{type:"button",onClick:I,className:"hover:text-warning-hover ml-0.5",title:"Hide archived",children:e(b,{size:10})})]})]})]})}var wt="p-1.5 rounded-lg hover:bg-ink/10 active:bg-ink/15 text-ink/60 hover:text-ink";function ho({folder:t,canWorktree:r,onOpenFolder:l,onNewWorktree:p,onSelectSessions:h,confirmDelete:g,onPin:S,onDelete:v,onRequestDelete:x,onCancelDelete:c}){let[w,k]=n(!1),y=i(null),[M,T]=n(null),I=(N)=>()=>{k(!1),N()};return e("div",{className:"relative flex items-center",onClick:(N)=>N.stopPropagation(),children:[e("button",{ref:y,type:"button",onClick:(N)=>{if(N.stopPropagation(),y.current)T(Et(y.current));k((C)=>!C)},className:wt,title:"Workspace options","aria-label":`Options for ${t.name}`,"aria-haspopup":"menu","aria-expanded":w,children:e(Ee,{size:15})}),e(Qt,{anchor:w?M:null,align:"end",ariaLabel:`Options for ${t.name}`,className:"w-48 rounded-lg border border-ink/15 bg-paper py-1 text-xs shadow-lg",onClose:()=>{k(!1),c()},children:e(Os,{variant:"mobile",isPinned:t.isPinned,onOpenFolder:l?I(l):void 0,onNewWorktree:r&&p?I(p):void 0,onSelectSessions:h?I(h):void 0,confirmDelete:g,onPin:I(S),onDelete:I(v),onRequestDelete:x,onCancelDelete:c})})]})}var bo={inset:"",insetPx:0,slotWidth:16,markGap:8,padding:"py-2",glyph:tt.touch};function go({session:t,harness:r,isActive:l,status:p,awaitingInput:h=!1,timeAgo:g,timeTitle:S,runStartedAt:v,expandable:x=!1,isExpanded:c=!1,onToggleExpand:w,isChild:k=!1,folderId:y,onSelect:M,onArchive:T,onDelete:I,onRename:N,onRenameWithAi:C,waitingFor:A,onCancelWait:E,selectable:O=!1,selected:R=!1,onToggleSelect:L}){let{isEditing:q,draft:z,setDraft:F,inputRef:te,startRename:H,handleKeyDown:X,handleBlur:ae}=Fo(t.title,N),W=Ta(t.id),ne=Lo(),ie=ne.anchor!==null,ee=Boolean(N||T||I||E),J=Boolean(A),de=x&&Boolean(w),Q=t.title.charAt(0).toUpperCase()+t.title.slice(1);if(q)return e("div",{className:"w-full rounded-lg flex items-center bg-ink/10",children:e("input",{ref:te,autoFocus:!0,value:z,onChange:(oe)=>F(oe.currentTarget.value),onKeyDown:X,onBlur:ae,className:"flex-1 min-w-0 mx-2 my-1.5 bg-paper border border-ink/25 rounded px-2 py-1 text-xs text-ink outline-none focus:border-ink/50"})});return e(d,{children:[e("div",{"data-testid":"session-item","data-session-id":String(t.id),"data-menu-open":ie?"true":void 0,onContextMenu:ee&&!O?ne.openAtCursor:void 0,className:`w-full rounded-lg flex items-center transition-colors ${O&&R||ie?Ps:l?"bg-ink/10 font-medium text-ink":"hover:bg-ink/5 text-ink/85"}`,children:[e("button",{type:"button",onClick:O?L:M,className:"flex-1 text-left py-2 flex items-center justify-between min-w-0",children:[e("div",{className:"flex items-center min-w-0 pr-2",children:[O?e(Lr,{checked:R,label:`Select ${t.title}`,onChange:()=>L?.()}):e("span",{className:"w-4 flex-shrink-0 flex items-center justify-center",children:W?e("span",{role:"status","aria-label":"Generating a name…",children:e(m,{size:13,className:"text-ink/50 animate-spin"})}):h?e(De,{size:13,className:"text-ink/70 animate-pulse"}):J?e("span",{role:"status","aria-label":`Waiting for ${A?.title??"another session"}`,children:e(qe,{size:13,className:"text-ink/60 animate-pulse"})}):p==="stream"?e("span",{role:"status","aria-label":"Running",children:e(m,{size:13,className:"text-ink/50 animate-spin"})}):p?e(f,{size:13,className:"text-ink/50"}):k?e("span",{"data-testid":"child-indicator",className:"text-ink/35","aria-hidden":"true",children:e(me,{size:13})}):null}),e("span",{className:"flex flex-col min-w-0 ml-2 leading-snug",children:[e("span",{className:"flex min-w-0 items-center",children:[r&&e("span",{className:"mr-1.5 flex shrink-0 items-center",children:e(Ve,{harness:r,size:tt.touch})}),e("span",{className:"min-w-0 truncate text-xs",children:Q})]}),J&&e("span",{className:"text-[10px] text-ink/40 truncate",children:["waiting for ",A?.title??"another session"]}),t.worktree?e(Fs,{worktree:t.worktree}):null]})]}),e(Ms,{timeAgo:g,timeTitle:S,runStartedAt:v,className:"text-[11px] font-mono flex-shrink-0 ml-2",restingClassName:"text-ink/45"})]}),ee&&!O&&e("button",{type:"button",onClick:ne.openBelow,title:"Session actions","aria-label":"Session actions","aria-haspopup":"menu","aria-expanded":ie,className:"flex-shrink-0 py-1.5 pl-1.5 pr-1 text-ink/35 hover:text-ink rounded-lg cursor-pointer",children:e(Ee,{size:16})}),de&&!O&&e("button",{type:"button",onClick:w,title:c?"Collapse sessions and subagents":"Expand sessions and subagents","aria-expanded":c,"aria-label":c?"Collapse sessions and subagents":"Expand sessions and subagents",className:"flex-shrink-0 py-1.5 pl-1.5 pr-1 flex items-center justify-center text-ink/50 hover:text-ink rounded-lg cursor-pointer",children:c?e(B,{size:14}):e(se,{size:14})})]}),ne.anchor&&e(Mo,{anchor:ne.anchor,sessionId:t.id,...r?{harness:r}:{},...y!==void 0?{folderId:y}:{},isArchived:t.is_archived===1,onRename:N?H:void 0,onRenameWithAi:C,onArchive:T,onDelete:I,onCancelWait:E,onClose:ne.close})]})}function vo(t,r){let[l,p]=n(!1);return{open:()=>p(!0),dialog:l?e(Po,{isOpen:!0,onClose:()=>p(!1),root:t.project_path??null,folderId:t.id,folderName:t.name,onCreated:(h)=>{p(!1),r(h.path)}}):null}}function xo({hiddenCount:t,canShowLess:r,onShowMore:l,onShowLess:p}){if(t<=0&&!r)return null;return e("div",{className:"flex items-center gap-1",children:[t>0&&e("button",{type:"button",onClick:l,className:"flex items-center min-w-0 text-left py-2 pr-3 text-xs text-ink/60 hover:text-ink",children:[e("span",{className:"w-4 h-4 flex-shrink-0 flex items-center justify-center",children:e(B,{size:12})}),e("span",{className:"w-2 shrink-0"}),e("span",{className:"truncate",children:["Show more sessions (",t,")"]})]}),r&&e("button",{type:"button",onClick:p,className:"ml-auto shrink-0 flex items-center gap-1 text-xs text-ink/60 hover:text-ink pl-3 py-2",children:[e(ot,{size:12}),e("span",{className:"truncate",children:"Show less"})]})]})}function wo(t){return t?"mb-4":"mb-1"}function ko({folder:t,activeSessionId:r,onSelectSession:l,onNewSessionForFolder:p,onNewWorktreeSession:h,isExpanded:g,onToggleExpand:S,showArchived:v=!1,sessionStatus:x={},onToast:c,batch:w,onStartSessionSelection:k,onCancelWait:y}){let{visibleCount:M,showMore:T,showLess:I,canShowLess:N}=Qs(),C=vo(t,(G)=>h?.(t.id,G)),{refresh:A,runStartedAtMap:E}=Ye(),{expandedSessionIds:O,toggleSession:R}=vs(),[L]=le(),q=L.get("subagent"),z=L.get("sessionId"),{confirmDelete:F,requestDelete:te,cancelDelete:H,handlePin:X,handleDelete:ae,handleArchive:W,handleRename:ne,handleRenameWithAi:ie,handleOpenFolder:ee}=Rs(t,A,c),J=Qo(),de=X,Q=ae,oe=ee??void 0,pe=(t.sessions||[]).filter((G)=>v?G.is_archived===1:G.is_archived!==1),ke=ra(t.icon),{folderCheckbox:be,sessionCheckboxes:he,folderSummary:V,toggleFolderSelection:j,rendered:Y,hiddenCount:ye}=zs({batch:w,folder:t,sessions:pe,showArchived:v,visibleCount:M,activeSessionId:r,sessionStatus:x}),Pe=Ho(Y),Se=g||he,Ne=(G,Me)=>{let ve=String(G.id),Ze=String(r)===ve,ht=Ze&&z===ve&&Boolean(q),Ue=It(ve);return e(go,{session:G,harness:G.harness,folderId:G.folder_id,isActive:Ze&&!ht,status:x[ve],awaitingInput:Boolean(G.awaitingInput),timeAgo:Ls(G.updated_at??G.created_at),timeTitle:qo(G.updated_at??G.created_at),runStartedAt:x[ve]==="stream"?E[ve]:void 0,expandable:Me.expandable,isChild:Me.isChild,isExpanded:Me.isExpanded,onToggleExpand:Me.onToggleExpand,onSelect:()=>l(G.id),onArchive:()=>W(G),onDelete:Ue?void 0:()=>J.requestDelete(G),onRename:Ue?void 0:(bt)=>void ne(G,bt),onRenameWithAi:Ue?void 0:()=>void ie(G),waitingFor:G.waitingFor?{title:G.waitingFor.title}:void 0,onCancelWait:G.waitingFor?()=>y?.(G.waitingFor.waitId):void 0,selectable:he,selected:Boolean(w?.selected.includes(ve)),onToggleSelect:w?()=>w.toggle(ve):void 0})},ft=(G)=>$s(G,Pe.childrenOf,O,R);return e("div",{className:wo(Se),"data-testid":"session-folder",children:[e("div",{onClick:w?void 0:S,className:"flex items-center justify-between gap-2 py-1 cursor-pointer hover:bg-ink/5 rounded-lg select-none transition-colors",children:[e("div",{className:"flex items-center space-x-2 min-w-0",children:[be&&V?e(Lr,{size:"md",checked:V.all,indeterminate:V.some,label:`Select ${t.name}`,onChange:j}):e(d,{children:e("span",{className:"w-4 h-4 flex items-center justify-center flex-shrink-0",children:t.customIconUrl?e("img",{src:t.customIconUrl,alt:"",className:"w-[15px] h-[15px] rounded-xs object-contain",referrerPolicy:"no-referrer"}):t.iconType==="chat"?e(mn,{size:15,className:"text-ink/80"}):e(ke,{size:15,className:"text-ink/80",style:{color:t.accentColor||void 0}})})}),e("span",{className:"text-sm font-semibold text-ink truncate",children:t.name})]}),e("div",{className:"flex items-center space-x-2 text-xs text-ink/60",children:[e("span",{className:"font-mono text-[11px] text-ink/70",children:pe.length}),t.project_path&&e(me,{size:13,className:"text-ink/50 ml-1"}),!w&&e(d,{children:[e("button",{type:"button",onClick:(G)=>{G.stopPropagation(),p(t.id)},className:"p-1.5 rounded-lg hover:bg-ink/10 active:bg-ink/15 text-ink/60 hover:text-ink",title:"New Session","aria-label":`New session in ${t.name}`,children:e(P,{size:15})}),e(ho,{folder:t,canWorktree:Boolean(h&&t.project_path),onOpenFolder:oe,onNewWorktree:h?()=>C.open():void 0,onSelectSessions:k?()=>k(t.id):void 0,confirmDelete:F,onPin:de,onDelete:Q,onRequestDelete:te,onCancelDelete:H}),e("span",{className:"flex items-center justify-center pr-1",children:g?e(B,{size:14}):e(se,{size:14})})]})]})]}),Se&&e("div",{className:"mt-0.5 space-y-0.5",children:[Pe.roots.map((G)=>{let Me=String(G.id),ve=ft(G);return e("div",{className:"space-y-0.5",children:[Ne(G,ve),ve.isExpanded&&e(_i,{parentId:Me,hasSubagents:Boolean(G.hasSubagents),childrenOf:Pe.childrenOf,expandedIds:O,onToggle:R,activeSessionId:r===null?null:String(r),renderSession:Ne,style:bo})]},G.id)}),e(xo,{hiddenCount:he?0:ye,canShowLess:!he&&N,onShowMore:T,onShowLess:I})]}),e(Ro,{session:J.pending,isDeleting:J.isDeleting,error:J.error,onClose:J.cancelDelete,onConfirm:()=>void J.confirmDelete()}),C.dialog]})}function yo({folders:t,activeSessionId:r,expandedFolders:l,showArchived:p,sessionStatus:h,onSelectSession:g,onNewSessionForFolder:S,onNewWorktreeSession:v,onToggleFolder:x,onToast:c,batch:w,onStartSessionSelection:k,onCancelWait:y}){return e("div",{className:"flex-1 scrollbar-overlay-container pl-3 pr-2 py-3",children:t.length===0?e("div",{className:"text-center py-12 text-xs text-ink/50 italic",children:"No matching sessions found"}):t.map((M)=>e(ko,{folder:M,activeSessionId:r,onSelectSession:g,onNewSessionForFolder:S,onNewWorktreeSession:v,isExpanded:l[M.id]??!0,onToggleExpand:()=>x(M.id),showArchived:p,sessionStatus:h,onToast:c,batch:w,onStartSessionSelection:k,onCancelWait:y},M.id))})}var kt=[3,2];function No(){return e("div",{className:"flex-1 p-3 space-y-4","aria-hidden":"true",children:kt.map((t,r)=>e("div",{className:"space-y-2",children:[e("div",{className:"flex items-center gap-2 py-2",children:[e("span",{className:"w-4 h-4 rounded-sm animate-pulse bg-ink/10"}),e("span",{className:"h-3 w-24 rounded animate-pulse bg-ink/10"})]}),Array.from({length:t},(l,p)=>e("div",{className:"flex items-center gap-2 rounded py-2",children:[e("span",{className:"w-4 h-4 rounded-full animate-pulse bg-ink/10"}),e("span",{className:"h-3 rounded animate-pulse bg-ink/10",style:{width:`${58-p%3*12}%`}})]},p))]},r))})}function Co({folders:t,initializing:r,failed:l,activeSessionId:p,expandedFolders:h,sessionStatus:g,searchQuery:S,sortOption:v,optionsOpen:x,showArchived:c,harnessFilter:w,onHarnessFilterChange:k,harnessOptions:y,optionsRef:M,scheduledCount:T,refreshing:I,selecting:N,batch:C,onNewSession:A,onNewWorkspace:E,onScheduler:O,onRefresh:R,onToggleOptions:L,onSortChange:q,onResetSort:z,onToggleArchived:F,onHideArchived:te,onSearchChange:H,onClearSearch:X,onSelectWorkspaces:ae,onSelectSession:W,onNewSessionForFolder:ne,onNewWorktreeSession:ie,onToggleFolder:ee,onToast:J,onStartSessionSelection:de,onCancelWait:Q}){return e(d,{children:[e(fo,{searchQuery:S,sortOption:v,optionsOpen:x,showArchived:c,optionsRef:M,onNewSession:A,onNewWorkspace:E,onScheduler:O,scheduledCount:T,onRefresh:R,refreshing:I,onToggleOptions:L,onSortChange:q,onResetSort:z,onToggleArchived:F,onHideArchived:te,onSearchChange:H,onClearSearch:X,onSelectWorkspaces:ae,selecting:N}),e("div",{className:"px-3 pt-2 pb-1",children:e(Ns,{options:y,value:w,onChange:k,touch:!0})}),l?e(Us,{touch:!0,onRetry:R,refreshing:I}):r?e(No,{}):e(yo,{folders:t,activeSessionId:p,expandedFolders:h,showArchived:c,sessionStatus:g,onSelectSession:W,onNewSessionForFolder:ne,onNewWorktreeSession:ie,onToggleFolder:ee,onToast:J,batch:C,onStartSessionSelection:de,onCancelWait:Q})]})}function To({sidebarStyle:t,controller:r,batch:l,dock:p,dockBody:h,expandedFolders:g,optionsRef:S,activeSessionId:v,scheduledCount:x,onToggleFolder:c,onNewSession:w,onNewWorkspace:k,onScheduler:y,onToggleArchived:M,onNewSessionForFolder:T,onNewWorktreeSession:I,onToast:N,onArchiveSelected:C,onCancelWait:A}){let{initializing:E,failed:O,refreshNow:R,isRefreshing:L,searchQuery:q,setSearchQuery:z,showArchived:F,setShowArchived:te,optionsOpen:H,setOptionsOpen:X,sortOption:ae,handleSortChange:W,harnessFilter:ne,setHarnessFilter:ie,harnessOptions:ee,processedFolders:J,sessionStatus:de,handleSelectSession:Q}=r,{selection:oe,deleteRun:pe,archiveRun:ke,binding:be,scopeFolder:he,available:V,selected:j}=l,Y={className:"flex-1 min-h-0 w-full",folders:J,initializing:E,failed:O,activeSessionId:v,sessionStatus:de,searchQuery:q,onSearchChange:z,showArchived:F,onToggleArchived:M,sortOption:ae,optionsOpen:H,onToggleOptions:()=>X(!H),onCloseOptions:()=>X(!1),onSortChange:W,harnessFilter:ne,onHarnessFilterChange:ie,harnessOptions:ee,onRefresh:R,refreshing:L,scheduledCount:x,onNewSession:w,onNewWorkspace:k,onScheduler:y,onSelectSession:Q,onNewSessionForFolder:T,onNewWorktreeSession:I,onToast:N,onCancelWait:A,batch:be,onSelectWorkspaces:l.toggleWorkspaceSelection,onStartSessionSelection:(ye)=>oe.begin("session",ye)};return e(d,{children:[e("div",{className:p.showingSessions?"contents":"hidden",children:[t==="modern"?e(Eu,{...Y,touch:!0}):e(Co,{folders:J,initializing:E,failed:O,activeSessionId:v,expandedFolders:g,sessionStatus:de,searchQuery:q,sortOption:ae,optionsOpen:H,showArchived:F,harnessFilter:ne,onHarnessFilterChange:ie,harnessOptions:ee,optionsRef:S,scheduledCount:x,refreshing:L,selecting:oe.mode!==null,batch:be,onNewSession:w,onNewWorkspace:k,onScheduler:y,onRefresh:R,onToggleOptions:()=>X(!H),onSortChange:W,onResetSort:()=>W("A-Z"),onToggleArchived:M,onHideArchived:()=>te(!1),onSearchChange:z,onClearSearch:()=>z(""),onSelectWorkspaces:l.toggleWorkspaceSelection,onSelectSession:Q,onNewSessionForFolder:T,onNewWorktreeSession:I,onToggleFolder:c,onToast:N,onStartSessionSelection:(ye)=>oe.begin("session",ye),onCancelWait:A}),oe.mode&&e(Tu,{drawer:!0,mode:oe.mode,count:j.length,total:V.length,busy:pe.isDeleting,archiving:ke.isArchiving,scopeLabel:he?.name,onSelectAll:()=>oe.selectAllOf(V),onUnselectAll:()=>oe.unselectAllOf(V),onDelete:()=>pe.request(j),onArchive:C,onCancel:oe.end})]}),p.showingSessions?null:e(mo,{panelKey:p.activeView,panel:p.activePanel,body:h})]})}function Eo(t,r){let l=t.tabs;ws({enabled:t.tabsMode,revealed:Zm(r),storedView:t.activeView,home:l?.home??!1,chosenHome:l?.chosenHome??!1,openTab:l?.open??null,known:new Set(t.catalog.map((g)=>g.id))});let p=i(!1),h=l?{...l,select:(g)=>{p.current=!0,l.select(g)},open:(g)=>{p.current=!0,l.open(g)},close:(g)=>{p.current=!0,l.close(g)}}:null;return o(()=>{if(!t.tabsMode||!l)return;if(l.active!==null&&l.active!==t.activeView)t.setActiveView(l.active)},[t.tabsMode,l?.active,t.activeView,t.setActiveView]),o(()=>{if(!t.tabsMode||!l)return;if(p.current){p.current=!1;return}if(l.tabs.includes(t.activeView))return;if(!t.catalog.some((g)=>g.id===t.activeView))return;l.open(t.activeView)},[t.tabsMode,l,t.activeView,t.catalog]),{tabs:h}}function _e(t){return{dragRegion:!0,layout:"mobile",rootProps:{...Da(),...t},style:{paddingLeft:bi(hi("0.75rem",!0)),paddingRight:kl("0.75rem",!0)}}}function Ao({side:t,onClose:r}){let l=t==="left"?nn:Zn;return e("button",{type:"button",onClick:r,className:`${$e.mobile} flex-none cursor-pointer rounded-lg text-ink/60 transition-colors hover:bg-ink/5 hover:text-ink titlebar-no-drag`,title:t==="left"?"Tutup panel kiri":"Tutup panel kanan","aria-label":t==="left"?"Close left sidebar":"Close right sidebar",children:e(l,{size:Sr.mobile,strokeWidth:1.8})})}function Wo({activeSessionId:t,newWorkspaceOpen:r,onCloseNewWorkspace:l,schedulerOpen:p,onCloseScheduler:h,aboutOpen:g,onCloseAbout:S,updates:v,pushToast:x,batchDelete:c,batchMode:w,onEndBatch:k,scopeLabel:y}){return e(d,{children:[e(As,{isOpen:r,onClose:l,onCreate:yl,onClone:vl}),e(wu,{isOpen:p,onClose:h,activeSessionId:t===null?null:String(t),onToast:x}),e(md,{isOpen:g,onClose:S,updates:v,onToast:x}),e(ef,{updates:v}),e(Du,{mode:w??"session",count:c.pending.length,scopeLabel:y,isDeleting:c.isDeleting,progress:c.progress,outcome:c.outcome,onClose:()=>{let M=c.outcome?.refused.length??0;if(c.cancel(),c.outcome&&M===0)k()},onConfirm:()=>{let M=w??"session";c.confirm(M).then((T)=>{if(T&&T.refused.length===0)k()})}})]})}function Bo(){let t=Dt(),r=rr("left"),[l,p]=Ha("layout.mobileLeftPanel",Te),h=Vm(l,t.enabled),g=Fd("left"),S=t.enabled&&g==="tabs",v=u(()=>new Set(r.map((c)=>c.id)),[r]),x=xs("left",v,Te);return{catalog:r,activeView:h,setActiveView:p,showingSessions:h===Te,activePanel:r.find((c)=>c.id===h),enabled:t.enabled,tabsMode:S,tabs:S?x:null}}function _o(t){return{className:"w-full h-full",sessionId:t.sessionId===null?null:String(t.sessionId),enabled:t.requiresWorkspace?t.hasActiveContext===!0:!0,active:!0,refreshKey:t.refreshKey,...t.rootPath?{rootPath:t.rootPath}:{},...t.onRefresh?{onRefresh:t.onRefresh}:{},...t.onOpenFile?{onOpenFile:t.onOpenFile}:{},onClose:t.onClose,showHeader:!1,layout:"phone"}}function Vo({appSettings:t,onSelectSession:r,onClose:l,rootPath:p,refreshKey:h,onRefresh:g,onOpenFile:S}){let v=Bu(t,{onSelectSession:r,onAfterSelect:l}),{folders:x,processedFolders:c,refreshNow:w,showArchived:k,activeSessionId:y}=v,M=Su(c,k,w),[T,I]=n({1:!0,2:!0,3:!0}),N=i(null);ue(N,()=>v.setOptionsOpen(!1));let C=(R)=>{I((z)=>({...z,[R]:!z[R]}));let L=x.find((z)=>z.id===R),q=!(T[R]??L?.isExpanded??!0);jd(R,q)},A=c.map((R)=>`${R.id}:${R.isExpanded}`).join("|");o(()=>{I(Object.fromEntries(c.map((R)=>[R.id,R.isExpanded])))},[A]);let E=Bo(),O=_o({sessionId:y,refreshKey:h,rootPath:p,onRefresh:g,onOpenFile:S,onClose:l,requiresWorkspace:E.activePanel?.requiresWorkspace??!1,hasActiveContext:Boolean(p)});return{controller:v,batch:M,expandedFolders:T,toggleFolder:C,optionsRef:N,dock:E,dockBody:O}}function ze(t){let{disabledPanels:r}=gn(),{setEnabled:l}=rl(),p=Le(),h=Ym(t),g=a((S,v)=>{l(S,v)},[l]);return{...p,items:h,hidden:r,toggle:g}}function Ko({activeSessionId:t,onSelectSession:r,onNewSession:l,onNewSessionForFolder:p,onNewWorktreeSession:h,onClose:g,onDesktopToggle:S,appSettings:v={},rootPath:x,refreshKey:c=0,onRefresh:w,onOpenFile:k,revealSignal:y=0}){let{controller:M,batch:T,expandedFolders:I,toggleFolder:N,optionsRef:C,dock:A,dockBody:E}=Vo({appSettings:v,onSelectSession:r,onClose:g,rootPath:x,refreshKey:c,onRefresh:w,onOpenFile:k}),{showArchived:O,setShowArchived:R}=M,{selection:L,deleteRun:q,archiveRun:z,selected:F,scopeFolder:te}=T,H=dd(),X=ze("left"),[ae,W]=n(!1),[ne,ie]=n(!1),ee=xu(),[J,de]=n(!1),{pushToast:Q}=He(),oe=bl(Q);Iu({onNotice:Q});let{updates:pe,shellDownload:ke}=ao({onClose:g,openAbout:()=>de(!0),pushToast:Q}),{tabs:be}=Eo(A,y),he=()=>{l(),g()},V=()=>{z.archive(F).then((Se)=>{if(!Se)return;let Ne=_u(Se);if(Ne)Q(Ne.message,Ne.tone);if(!Se.error)L.end()})},j=(Se)=>{p(Se),g()},Y=()=>{R(!O)},ye=h?(Se,Ne)=>{h(Se,Ne),g()}:void 0,Pe=e(To,{sidebarStyle:H,controller:M,batch:T,dock:A,dockBody:E,expandedFolders:I,optionsRef:C,activeSessionId:t,scheduledCount:ee,onToggleFolder:N,onNewSession:he,onNewWorkspace:()=>W(!0),onScheduler:()=>ie(!0),onToggleArchived:Y,onNewSessionForFolder:j,...ye?{onNewWorktreeSession:ye}:{},onToast:Q,onArchiveSelected:V,onCancelWait:oe});return e("div",{className:"flex flex-col h-full w-full bg-canvas text-ink relative select-none",children:[e(ro,{onClose:g,viewLabel:A.showingSessions?"Sessions":A.activePanel?.label??"Panel",menuProps:X.surfaceProps}),!A.tabsMode&&co(A.enabled)?e(po,{panels:A.catalog,activeId:A.activeView,onSelect:A.setActiveView,menuProps:X.surfaceProps}):null,A.tabsMode&&be?e("div",{className:"flex-1 min-h-0 flex flex-col",children:e(ks,{catalog:A.catalog,tabs:be,pinned:Te,homeTitle:"Panel kiri",stripProps:_e(X.surfaceProps),children:e("div",{className:"h-full w-full",children:Pe})})}):null,X.anchor?e(Oo,{anchor:X.anchor,items:X.items,hidden:X.hidden,onToggle:X.toggle,onClose:X.close}):null,A.tabsMode?null:e("div",{className:"contents",children:Pe}),e(so,{onSettings:()=>window.dispatchEvent(new CustomEvent("omp:open-settings",{detail:{}})),onKeyBindings:Gc,onAbout:()=>de(!0),shellDownload:ke,onDesktopToggle:S,updateAvailable:pe.hasUpdate,onUpdateClick:()=>{de(!0),pe.check()}}),e(Wo,{activeSessionId:t,newWorkspaceOpen:ae,onCloseNewWorkspace:()=>W(!1),schedulerOpen:ne,onCloseScheduler:()=>ie(!1),aboutOpen:J,onCloseAbout:()=>de(!1),updates:pe,pushToast:Q,batchDelete:q,batchMode:L.mode,onEndBatch:L.end,scopeLabel:te?.name})]})}function $o({catalog:t,activeId:r,onSelect:l,hasGitChanges:p,onClose:h,menuProps:g}){return e("div",{className:"border-b border-ink/10 flex items-center justify-between px-3 flex-shrink-0 bg-canvas titlebar-drag-region select-none",...Da(),...g,style:zo(),children:[e("div",{className:"flex items-center min-w-0 titlebar-no-drag",children:e(Be,{panels:t,activeId:r,onSelect:l,hasGitChanges:p})}),e("button",{type:"button",onClick:h,className:"p-1.5 rounded-lg hover:bg-ink/5 active:bg-ink/10 text-ink transition-colors flex-shrink-0 ml-2 titlebar-no-drag",title:"Close right sidebar","aria-label":"Close right sidebar",children:e(b,{size:20,strokeWidth:1.8})})]})}function je({panel:t,body:r}){if(!t)return e("div",{className:"h-full flex items-center justify-center text-ink/40",children:e("span",{className:"text-xs font-mono text-muted",children:"No session selected"})});return e(We,{fallback:e("div",{className:"h-full flex items-center justify-center text-ink/40",children:e("span",{className:"text-xs font-mono",children:"Loading…"})}),children:e(Io,{value:r,children:t.render(r)})})}function Uo({enabled:t=!0,rootPath:r,refreshKey:l=0,onRefresh:p,onOpenFile:h,onClose:g,revealSignal:S=0}){let[v,x]=Ha("layout.mobileRightPanel",dc),{sessionId:c}=Oe(),w=Dt(),k=lo(rr("all"),Te,w.enabled),y=k.find((W)=>W.id===v)??k[0],T=Fd("right")==="tabs",I=u(()=>new Set(k.map((W)=>W.id)),[k]),N=xs("right",I,null),C=xe(c,"layout.mobileRightPanel")!==void 0;ws({enabled:T,revealed:Zm(S),storedView:C?v:null,home:N.home,chosenHome:N.chosenHome,openTab:N.open,known:I});let{open:A,tabs:E}=N,O=(W)=>{if(W!==y?.id)Re(W)},R=i(!1),L={...N,select:(W)=>{R.current=!0,O(W),N.select(W)},open:(W)=>{R.current=!0,O(W),N.open(W)},close:(W)=>{R.current=!0,N.close(W)}};o(()=>{if(!T)return;if(N.active!==null&&N.active!==v)x(N.active)},[T,N.active,v,x]),o(()=>{if(!T||N.home)return;if(R.current){R.current=!1;return}if(!C)return;if(E.includes(v)||!I.has(v))return;A(v)},[T,N.home,C,v,E,A,I]);let q=Vp(r,t),{changes:z}=nl(r,q,t),F=z.length>0,te=a((W)=>{if(W!==y?.id)Re(W);x(W)},[y?.id,x]);o(()=>{if(!Ge(y?.id))Ac()},[y?.id]);let H=ze(w.enabled?"right":"all"),X=w.enabled?H.items:H.items.filter((W)=>W.id!==Te),ae={className:"h-full w-full",enabled:t||!y?.requiresWorkspace,active:!0,refreshKey:l,...r?{rootPath:r}:{},onRefresh:p,onOpenFile:h,onClose:g,showHeader:!1,layout:"phone"};return e("div",{className:"flex flex-col h-full w-full bg-paper text-ink relative select-none",children:[T?null:e($o,{catalog:k,activeId:y?.id??v,onSelect:te,hasGitChanges:F,onClose:g,menuProps:H.surfaceProps}),T?e("div",{className:"flex-1 min-h-0 flex flex-col",children:e(ks,{catalog:k,tabs:L,homeTitle:"Panel kanan",stripProps:_e(H.surfaceProps),actions:e(Ao,{side:"right",onClose:g}),children:e("div",{className:"h-full w-full",children:e(je,{panel:y,body:ae})})})}):null,H.anchor?e(Oo,{anchor:H.anchor,align:"right",items:X,hidden:H.hidden,onToggle:H.toggle,onClose:H.close}):null,T?null:e("div",{className:"flex-1 min-h-0 overflow-hidden relative",style:{paddingBottom:"env(safe-area-inset-bottom, 0px)"},children:e(je,{panel:y,body:ae})})]})}function Ce({label:t,onClick:r,active:l=!1,danger:p=!1,children:h}){let g=p?"bg-error text-canvas hover:bg-error/90":l?"bg-ink text-canvas":"text-ink/70 hover:bg-ink/10 hover:text-ink";return e("button",{type:"button",onClick:r,title:t,"aria-label":t,"aria-pressed":l||void 0,className:`${$e.mobile} flex-none cursor-pointer rounded-lg transition-colors ${g}`,children:h})}var we=Sr.mobile;function Xo({actions:t}){let[r,l]=n(!1),p=i(null);return ue(p,()=>l(!1),r),o(()=>{if(!r)return;let h=(g)=>{if(g.key==="Escape")l(!1)};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[r]),e("div",{className:"relative flex-none",ref:p,children:[e("button",{type:"button",onClick:()=>l((h)=>!h),title:"More file actions","aria-label":"More file actions","aria-haspopup":"menu","aria-expanded":r,className:`${$e.mobile} flex-none cursor-pointer rounded-lg text-ink/70 transition-colors hover:bg-ink/10 hover:text-ink`,children:e(Ee,{size:Sr.mobile})}),r?e("div",{role:"menu","aria-label":"File actions",className:"absolute right-0 top-full z-50 mt-1 w-52 overflow-hidden rounded-xl border border-ink/15 bg-paper py-1 text-xs shadow-lg",children:t.map((h)=>{let g=h.icon;return e("button",{type:"button",role:"menuitem",onClick:()=>{l(!1),h.onSelect()},className:"flex w-full items-center gap-2 px-3 py-2.5 text-left text-ink/80 transition-colors hover:bg-ink/5 hover:text-ink",children:[e(g,{size:15,className:"flex-none text-ink/60"}),e("span",{className:"truncate",children:h.label})]},h.id)})}):null]})}var yt=420;function Yo({fileName:t,hasPreview:r,isPreview:l,hasReview:p,isReviewing:h,onToggleReview:g,wordWrap:S,copied:v,byteViewer:x=!1,missing:c=!1,onSave:w,onClose:k,onTogglePreview:y,onToggleFind:M,findOpen:T,onToggleWrap:I,onZoomOut:N,onZoomIn:C,onCopy:A,onDownload:E}){let O=jc(yt),R=u(()=>{let L=[];if(!x)L.push({id:"wrap",label:S?"Word wrap: on":"Word wrap: off",icon:rn,onSelect:I},{id:"zoom-out",label:"Decrease font size",icon:Fa,onSelect:N},{id:"zoom-in",label:"Increase font size",icon:Ra,onSelect:C});if(!O)L.push({id:"copy",label:v?"Copied":"Copy content",icon:v?f:re,onSelect:A},{id:"download",label:"Download file",icon:fe,onSelect:E});return L},[x,O,S,v,I,N,C,A,E]);return e("header",{className:"bg-canvas border-b border-ink/10 flex items-center justify-between gap-1 px-3 flex-shrink-0 titlebar-drag-region",style:zo(),children:[e("div",{className:"flex items-center gap-1 min-w-0 titlebar-no-drag",children:[e(Ce,{label:"Close editor",onClick:k,children:e(an,{size:we,strokeWidth:2})}),e("div",{className:"flex min-w-0 items-center gap-1.5",children:[e(ct,{name:t,size:15,className:`flex-shrink-0${c?" text-error":""}`}),e("span",{className:`truncate font-semibold text-xs${c?" text-error line-through":" text-ink"}`,children:t})]})]}),e("div",{className:"flex flex-none items-center gap-0.5 text-ink/70 titlebar-no-drag",children:[c&&w&&e(Ce,{label:"Save and recreate the file",onClick:w,danger:!0,children:e(mt,{size:we})}),!x&&e(Ce,{label:T?"Close find":"Find in file",onClick:M,active:T,children:e(U,{size:we})}),p&&e(Ce,{label:h?"Exit review mode":"Review this document",onClick:g,active:h,children:e(mn,{size:we})}),r&&e(Ce,{label:l?"View source":"Show preview",onClick:y,active:l,children:l?e(Tt,{size:we}):e(Ke,{size:we})}),O&&e(d,{children:[e(Ce,{label:"Copy content",onClick:A,children:v?e(f,{size:we,className:"text-success"}):e(re,{size:we})}),e(Ce,{label:"Download file",onClick:E,children:e(fe,{size:we})})]}),R.length>0&&e(Xo,{actions:R})]})]})}function Zo({fileName:t,content:r,path:l,root:p,repo:h,fontSize:g,scrollRef:S,onScroll:v,isLoading:x,unsupported:c,loadError:w,reviewActive:k,onExitReview:y}){return e("div",{ref:S,onScroll:v,"data-testid":"editor-scroller",className:"flex-1 min-h-0 overflow-auto relative bg-paper text-ink select-text",children:x?e("div",{className:"flex items-center justify-center h-full text-ink/40 text-xs gap-2",children:[e(m,{size:14,className:"animate-spin"}),e("span",{children:"Loading file content..."})]}):c?e("div",{className:"flex flex-col items-center justify-center h-full gap-2 px-6 text-center",children:[e(Jc,{size:20,className:"text-ink/40"}),e("span",{className:"text-xs text-ink/70 font-sans",children:[t," cannot be opened here"]}),e("span",{className:"text-[11px] text-ink/50 font-sans max-w-[42ch]",children:c})]}):w?e("div",{className:"flex flex-col items-center justify-center h-full gap-2 px-6 text-center",children:[e(_,{size:20,className:"text-error"}),e("span",{className:"text-xs text-error font-sans",children:["Could not read ",t]}),e("span",{className:"text-[11px] text-ink/50 font-mono break-all",children:w})]}):e("div",{className:"p-4 bg-paper text-ink min-h-full font-sans",style:{fontSize:`${g}px`},children:e(Xc,{content:r,file:{name:t,path:l,root:p,repo:h},active:k,onExit:y})})})}function Jo({file:t,editor:r,viewerKind:l,byteViewer:p,isPreview:h,isMd:g,content:S,language:v,wordWrap:x,fileKey:c,revealMarks:w,currentMark:k,surfaceRef:y,setCodeScroller:M,previewRef:T,scroll:I,fontSize:N,reviewActive:C,onExitReview:A,editorTheme:E,editorFontFamily:O,indentUnitText:R,typing:L}){let q=a(async(z)=>{let F=await cu(t,z,{interactive:!0,baseMtimeMs:r.baseMtimeMs});if(F.status==="written")return{ok:!0};if(F.status==="conflict")return{ok:!1,error:"This file changed on disk since it was opened."};if(F.status==="needs-permission")return{ok:!1,error:"Tap Save again to grant write access."};return{ok:!1,error:F.error}},[t,r.baseMtimeMs]);if(r.isImage&&r.imageUrl)return e(Ei,{src:r.imageUrl,name:t.name,className:"flex-1 min-h-0"});if(r.isImage||su(l)&&(p||h))return e(Tl,{kind:l,path:t.path??t.name,name:t.name,source:r.byteSource,content:r.content,root:t.root,repo:t.repo,revision:r.revision,onContentChange:r.onChange,onSaveBytes:r.deviceBacked?void 0:q,onDirtyChange:r.setBinaryDirty});if(r.isLoading||r.unsupported||r.loadError||g&&h)return e(Zo,{fileName:t.name,content:S,path:t.path??t.name,root:t.root,repo:t.repo,fontSize:N,scrollRef:T,onScroll:I.onScroll,isLoading:r.isLoading,unsupported:r.unsupported,loadError:r.loadError,reviewActive:C,onExitReview:A});return e(tu,{ref:y,value:S,onValueChange:r.onChange,language:v,wordWrap:x,documentKey:c,marks:w,currentMark:k,onScroller:M,scrollTestId:"editor-scroller",className:"flex-1 min-h-0 text-ink select-text",themeVars:E.vars,themes:E.themes,indentUnitText:R,typing:L,padding:12,placeholder:"This file is empty",style:{fontFamily:O,fontSize:`${N}px`,lineHeight:ul}})}function et(){return e("div",{className:"flex items-start gap-2 px-3 py-2 border-b border-error/30 bg-error/10 text-error shrink-0",children:[e(_,{size:14,className:"shrink-0 mt-0.5"}),e("div",{className:"min-w-0",children:[e("div",{className:"text-[11.5px] font-sans",children:"This file was deleted from disk."}),e("div",{className:"text-[11px] font-sans text-error/80",children:"The buffer is still here. Saving recreates the file — autosave is off until then."})]})]})}function nt({isImage:t,byteViewer:r,viewerKind:l,lineCount:p,charCount:h,language:g,saveStatus:S,path:v,conflicts:x=0}){return e("footer",{className:"bg-canvas border-t border-ink/10 px-3 flex items-center justify-between text-[10px] text-ink/60 flex-shrink-0 font-mono",style:{height:"calc(1.75rem + env(safe-area-inset-bottom, 0px))",paddingBottom:"env(safe-area-inset-bottom, 0px)",paddingLeft:"max(0.75rem, env(safe-area-inset-left, 0px))",paddingRight:"max(0.75rem, env(safe-area-inset-right, 0px))"},children:[e("div",{className:"flex items-center space-x-3",children:t?e("span",{className:"uppercase",children:"Image"}):r?e("span",{className:"uppercase",children:Go[l]}):e(d,{children:[x>0&&e("span",{className:"text-error font-semibold tabular-nums",children:["⚠ ",x]}),e("span",{children:[p," lines"]}),e("span",{children:[h," chars"]}),e("span",{className:"uppercase",children:g})]})}),e("div",{className:"flex items-center space-x-2",children:[S==="saving"&&e(d,{children:[e(m,{size:10,className:"animate-spin"}),e("span",{children:"Saving…"})]}),S==="saved"&&e(d,{children:[e("span",{className:"w-1.5 h-1.5 rounded-full bg-success"}),e("span",{children:"Saved"})]}),S==="error"&&e(d,{children:[e("span",{className:"w-1.5 h-1.5 rounded-full bg-error"}),e("span",{className:"text-error",children:"Save failed"})]}),S==="idle"&&v&&e("span",{className:"truncate max-w-[140px]",children:v})]})]})}function it({path:t,content:r,ready:l,surfaceRef:p}){let h=pu(t,r,l),g=i(null);return o(()=>{if(!h||g.current===h.request)return;g.current=h.request;let S=h.matches[h.currentIndex];if(!S)return;p.current?.select(S.start,S.end,!1),p.current?.revealOffset(S.start)},[h,p]),{matches:h?.matches??[],currentIndex:h?.currentIndex??-1}}function rt({path:t,content:r,documentKey:l,ready:p,surfaceRef:h,toggleWordWrap:g}){let S=it({path:t,content:r,ready:p,surfaceRef:h}),v=du({text:r,documentKey:l,readSelection:()=>h.current?.getSelection()??null,select:(x,c,w=!0)=>h.current?.select(x,c,w),reveal:(x)=>h.current?.revealOffset(x),applyDocument:(x,c,w)=>h.current?.applyDocument(x,c,w),toggleWordWrap:g});if(v.open&&v.matches.length>0)return{find:v,revealMarks:v.matches,currentMark:v.currentIndex};return{find:v,revealMarks:S.matches.length>0?S.matches:void 0,currentMark:S.currentIndex}}function st({path:t,symbols:r,total:l,truncated:p,emptyNotice:h,preview:g=!1}){let[S,v]=n(!1);if(!t)return null;let x=(c,w)=>{if(v(!1),g){let k=od(r,w);if(k)is({path:t,...k});return}os({path:t,line:c.line,column:c.column,length:c.name.length})};return e(d,{children:[e("div",{className:"absolute bottom-14 right-3 z-20",children:e("button",{type:"button",onClick:()=>v(!0),"aria-label":`Outline (${l} symbols)`,title:"Outline",className:"flex h-9 w-9 items-center justify-center rounded-full border border-ink/20 bg-paper text-ink/60 shadow-sm transition-all hover:bg-ink/5 hover:text-ink",children:e(Yr,{size:16})})}),S&&e(Z,{onClose:()=>v(!1),maxWidthClass:"max-w-sm",zClass:"z-[70]",header:e("div",{className:"flex min-w-0 items-center gap-2",children:[e(Yr,{size:15,className:"flex-shrink-0 text-ink/50"}),e("span",{className:"text-sm font-medium",children:"Outline"}),e("span",{className:"font-mono text-[11px] text-ink/40",children:p?`${r.length}/${l}`:l})]}),children:e("div",{className:"max-h-[60vh] overflow-y-auto scrollbar-overlay-container py-1",children:[r.length===0?e("div",{className:"px-4 py-3 text-[11px] italic text-ink/40",children:h}):r.map((c,w)=>e("button",{type:"button",onClick:()=>x(c,w),"aria-label":g?`${ei(c.kind)} ${c.name}`:`${ei(c.kind)} ${c.name}, line ${c.line}`,className:"flex w-full min-w-0 items-center gap-2 px-4 py-2 text-left transition-colors hover:bg-ink/5 active:bg-ink/10",style:{paddingLeft:`${16+c.depth*12}px`},children:[e(Zu,{kind:c.kind,size:13}),e("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-ink",children:c.name}),!g&&e("span",{className:"flex-shrink-0 font-mono text-[10px] text-ink/40",children:c.line})]},`${c.line}:${c.kind}:${c.name}`)),p&&e("div",{className:"px-4 py-2 text-[11px] italic text-ink/40",children:Xu(l)})]})})]})}function lt({file:t,missing:r=!1,onClose:l,onFileSaved:p,onDropResult:h}){let g=Is(t.path??t.name),[S,v]=n({}),[x,c]=n(So),[w,k]=n(!0),y=Do(),M=Bi(),T=yu(),I=ku(),N=g==="markdown",C=Bs[g]===!0,A=au[g]===!0,E=t.path??t.name,O=S[E]??ou(g),R=Au(String(E)),L=N&&O,q=()=>v((Y)=>({...Y,[E]:!O})),z=Hc({enabled:Boolean(t.root),onResult:h}),F=uu(t,{flushOnUnmount:!0,reportSaveError:!0,downloadMimeType:"text/plain;charset=utf-8",onFileSaved:p,missing:r}),[te,H]=n(null),X=xl({tabKey:E,surface:N&&O?"rendered":"code",ready:F.loaded,slot:zh,element:N&&O?void 0:te}),[ae,W]=n(null),ne=a((Y)=>{X.ref(Y),W(Y)},[X.ref]);ru({path:t.path??null,scroller:ae,preview:N&&O});let ie=i(null),{find:ee,revealMarks:J,currentMark:de}=rt({path:t.path??null,content:F.content,documentKey:`${E}\x00${F.language}`,ready:F.loaded&&!F.loadError,surfaceRef:ie,toggleWordWrap:()=>k((Y)=>!Y)}),{content:Q,language:oe}=F,pe=Q.split(`
|
|
2
|
-
`).length,ke=eu(Q);mu({file:{id:E,name:t.name,path:t.path??E},editor:F,surfaceRef:ie,isPreview:O,exitPreview:()=>v((Y)=>({...Y,[E]:!1})),publish:!1});let{symbols:be,total:he,truncated:V,notice:j}=ed({content:Q,language:oe,path:t.path??null,state:C?"not-a-document":F.loadError?"error":F.loaded?"ready":"loading",note:C?`${Go[g]} files have no text outline.`:F.loadError});return e("div",{className:"fixed inset-x-0 top-0 h-dvh z-[60] bg-paper flex flex-col font-mono text-xs select-none",...z.dropProps,...z.captureDropProps,children:[e(Sl,{visible:z.isDragging}),e(Yo,{fileName:t.name,hasPreview:A,isPreview:O,wordWrap:w,copied:F.copied,byteViewer:C,missing:r,onSave:F.saveNow,onClose:l,onTogglePreview:q,hasReview:L,isReviewing:L&&R.active,onToggleReview:R.toggle,onToggleFind:()=>ee.open?ee.close():ee.openFind(),findOpen:ee.open,onToggleWrap:()=>k(!w),onZoomOut:()=>c((Y)=>Math.max(dl,Y-1)),onZoomIn:()=>c((Y)=>Math.min(pl,Y+1)),onCopy:F.copy,onDownload:F.download}),r&&e(et,{}),F.diskChange&&e(fu,{fileName:t.name,onReload:F.reloadFromDisk,onKeepMine:F.keepMineAgainstDisk}),ee.open&&!C&&e("div",{className:"relative shrink-0 h-9 border-b border-ink/10 bg-paper",children:e(nu,{find:ee})}),e(Jo,{file:t,editor:F,viewerKind:g,byteViewer:C,isPreview:O,isMd:N,content:Q,language:oe,wordWrap:w,fileKey:E,revealMarks:J,currentMark:de,surfaceRef:ie,setCodeScroller:H,previewRef:ne,scroll:X,fontSize:x,reviewActive:L&&R.active,onExitReview:R.toggle,editorTheme:M,editorFontFamily:y,indentUnitText:bu(T),typing:I}),!C&&e(st,{path:t.path??null,symbols:be,total:he,truncated:V,emptyNotice:j,preview:N&&O}),e(nt,{isImage:F.isImage,byteViewer:C,viewerKind:g,lineCount:pe,charCount:Q.length,language:oe,saveStatus:F.saveStatus,path:t.path,conflicts:ke}),F.saveMissingConfirm&&t.path&&e(gu,{fileName:t.name,filePath:t.path,onClose:F.cancelSaveMissing,onConfirm:F.confirmSaveMissing})]})}function dt({diff:t,onClose:r,onFileSaved:l}){let p=t.path.split("/").pop()||t.path,h=Boolean(t.staged),g=t.status||"M",S=er(g,h);return e("div",{className:"fixed inset-x-0 top-0 h-dvh z-[60] bg-paper flex flex-col",children:[e("header",{className:"bg-canvas border-b border-ink/10 flex items-center justify-between px-3 flex-shrink-0",style:zo(),children:[e("div",{className:"flex items-center space-x-2 min-w-0 pr-2",children:[e("button",{type:"button",onClick:r,className:"p-1.5 -ml-1 rounded-lg hover:bg-ink/5 active:bg-ink/10 text-ink transition-colors flex-shrink-0",title:"Back","aria-label":"Close diff",children:e(an,{size:18,strokeWidth:1.9})}),e(ct,{name:p,size:14,className:"flex-shrink-0"}),e("span",{className:"font-mono text-xs text-ink font-medium truncate",title:t.path,children:p})]}),e("span",{className:`px-1.5 py-0.5 text-[10px] font-mono font-semibold rounded border flex-shrink-0 ${S.badgeBgClass}`,children:[S.charStatus," ",S.label]})]}),e("div",{className:"flex-1 min-h-0",children:e(Zc,{className:"h-full",viewModeButtons:!1,filePath:t.path,status:g,isStaged:h,root:t.root,repo:t.repo||".",journalDiff:t.journal,readOnly:Boolean(t.journal),onFileSaved:l,tabKey:t.journal?sf(t.journal.path,t.journal.from,t.journal.to):of(t.path,h)})})]})}function Ie(t,r){let l=t[r];return typeof l==="string"&&l.length>0?l:void 0}function Nt(t){let r=t.content;return typeof r==="string"?r:void 0}function Xe(t,r){let l=typeof t==="object"&&t!==null?t:{},p=(Ie(l,"path")??"").replace(/^\/+/,"");if(!p)return null;return{name:Ie(l,"name")??p.split("/").pop()??"file",path:p,content:Nt(l),root:Ie(l,"root")??r??void 0,repo:Ie(l,"repo"),handleId:Ie(l,"handleId"),deviceFile:l.deviceFile===!0?!0:void 0}}function pt(t){if(!t)return[];return[{id:"mobile-editor",path:t.path,root:t.root,repo:t.repo,content:t.content,handleId:t.handleId,deviceFile:t.deviceFile}]}function ut(t,r,l){Za(l);let p=nr(r);return ln(p,zg,{folderId:r,worktreePath:l}),t.setSearchParams((h)=>{let g=Rt(h);return g.set("sessionId",p),g.set("folderId",r.toString()),g},{replace:!0}),t.afterNavigate?.(),p}function lp({onDesktopToggle:t,appSettings:r={}}){let{folders:l,isMock:p}=Ye(),h=Dt(),{sessionId:g}=Oe(),[S,v]=le(),x=S.get("sessionId"),c=x?Number.isNaN(Number(x))?x:Number(x):null,w=S.get("folderId"),k=w?Number.isNaN(Number(w))?w:Number(w):null,[y,M]=n("main"),T=Qe({dock:h,sessionId:g,currentScreen:y,setCurrentScreen:M}),[I,N]=n(null),[C,A]=n(null),[E,O]=n(0),[R,L]=n(!1),[q,z]=n("appearance"),[F,te]=n(!1),H=a(()=>O((V)=>V+1),[]),X=lu(pt(I),E),{pushToast:ae}=He(),W=a((V)=>ae(V.message,V.ok?"success":"error"),[ae]),ne=X.size>0;Je({editorOpen:I!==null,diffOpen:C!==null,settingsOpen:R,offMainScreen:y!=="main",onCloseEditor:()=>N(null),onCloseDiff:()=>A(null),onCloseSettings:()=>{L(!1),te(!1)},onReturnToMain:()=>M("main")});let{folder:ie}=no(l,c),ee=ie??(k?l.find((V)=>String(V.id)===String(k))??null:null),J=Ef(l,c)??ee?.project_path??null,de=!!ee,Q=Hc({enabled:de,onResult:W});ge("omp:open-file",(V)=>{let Y=Xe(V.detail,J);if(Y)N(Y)}),ge("omp:open-diff",(V)=>{let j=V.detail;if(!j?.file)return;A({path:j.file.replace(/^\/+/,""),status:j.status,staged:j.staged,repo:j.repo,root:j.root??J??void 0,...j.source==="journal"&&j.journal?{journal:j.journal}:{}})}),ge("omp:view-subagent",()=>M("main")),ge("omp:open-settings",(V)=>{let j=V.detail;z(j?.category??"appearance"),te(Boolean(j?.autoOpenAdd)),L(!0)});let oe=(V)=>{v((j)=>{let Y=Rt(j);if(Y.set("sessionId",V.toString()),Y.has("subagent"))Y.delete("subagent");return Y},{replace:!0}),M("main")},pe=()=>{v(new URLSearchParams,{replace:!0}),M("main")},ke=(V)=>{let j=hl(l,x,V);if(j)Za(j);v((Y)=>bc(Y,nr(V),V),{replace:!0}),M("main")},be=(V,j)=>ut({setSearchParams:v,afterNavigate:()=>M("main")},V,j),he=a((V)=>{let j=Xe(V,J);if(j)N(j)},[J]);return e("div",{"data-testid":"app-root",className:"app-window flex flex-col h-dvh w-screen overflow-hidden bg-canvas text-ink font-sans selection:bg-ink selection:text-canvas relative",children:[e(Nf,{}),e(Qf,{isMock:p}),e(Rf,{workspacePath:J}),e("div",{className:`flex-1 min-h-0 w-full relative ${y==="main"?"block":"hidden"}`,...Q.dropProps,...Q.captureDropProps,children:[e(Sl,{visible:Q.isDragging}),e(io,{activeSessionId:c,onSelectSession:oe,onNewSession:pe,onOpenSessionSidebar:T.openSessionDrawer,onOpenRightSidebar:T.openRightDrawer,appSettings:r})]}),e("div",{className:`flex-1 min-h-0 w-full ${y==="session"?"block":"hidden"}`,children:e(Ko,{activeSessionId:c,onSelectSession:oe,onNewSession:pe,onNewSessionForFolder:ke,onNewWorktreeSession:be,onClose:()=>M("main"),onDesktopToggle:t,appSettings:r,rootPath:J??void 0,refreshKey:E,onRefresh:H,onOpenFile:he,revealSignal:T.left})}),y==="right"&&e("div",{className:"flex-1 min-h-0 w-full",children:e(Uo,{enabled:de,rootPath:J??void 0,refreshKey:E,onRefresh:H,onOpenFile:he,onClose:()=>M("main"),revealSignal:T.right})}),I&&e(lt,{file:I,missing:ne,onClose:()=>N(null),onFileSaved:H}),C&&e(dt,{diff:C,onClose:()=>A(null),onFileSaved:H}),e(gl,{isOpen:R,onClose:()=>{L(!1),te(!1)},initialCategory:q,autoOpenAddProvider:F,appSettings:r})]})}export{lp as MobileLayoutWrapper};
|