@kabmo-labs/kabmo 0.30.1 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +79 -21
- package/dist/client/index.html +1 -1
- package/dist/client/index.js +518 -480
- package/dist/client/static/js/CsvGrid-amafmq3z.js +2 -0
- package/dist/client/static/js/DocxView-851ps9t0.js +58 -0
- package/dist/client/static/js/DrawioView-kw1vy3r2.js +5 -0
- package/dist/client/static/js/ImageView-ksx9bbct.js +1 -0
- package/dist/client/static/js/LayoutWrapper-9ftz050x.js +2 -0
- package/dist/client/static/js/Modal-f8x3j3be.js +38 -0
- package/dist/client/static/js/PdfView-f5jkm0rs.js +1 -0
- package/dist/client/static/js/SessionsView-wzdf1cp6.js +1 -0
- package/dist/client/static/js/SheetView-23zxy30b.js +140 -0
- package/dist/client/static/js/SvgPreview-c341y50e.js +1 -0
- package/dist/client/static/js/__vite-browser-external-2447137e-mq6vaetg.js +0 -0
- package/dist/client/static/js/abnfDiagram-O67JEVCF-2dc3mpk6.js +1 -0
- package/dist/client/static/js/andromeeda-17pn42cc.js +1 -0
- package/dist/client/static/js/architecture-7GRP2DOG-4wsd6vk0.js +1 -0
- package/dist/client/static/js/architectureDiagram-NJMV4G6O-7jmrr5ja.js +36 -0
- package/dist/client/static/js/astro-sjtf954j.js +1 -0
- package/dist/client/static/js/aurora-x-hxy97145.js +1 -0
- package/dist/client/static/js/ayu-dark-x0jd4baz.js +1 -0
- package/dist/client/static/js/ayu-light-12fg03q0.js +1 -0
- package/dist/client/static/js/ayu-mirage-52h7xjbv.js +1 -0
- package/dist/client/static/js/bash-h6pkqvth.js +1 -0
- package/dist/client/static/js/blockDiagram-BEXU5L5S-jrk2m0ea.js +140 -0
- package/dist/client/static/js/c-thbdzmwv.js +1 -0
- package/dist/client/static/js/c4Diagram-YGBWAQC7-48cyncjd.js +38 -0
- package/dist/client/static/js/catppuccin-frappe-fqgpn512.js +1 -0
- package/dist/client/static/js/catppuccin-latte-tr2x6gmz.js +1 -0
- package/dist/client/static/js/catppuccin-macchiato-rm7kh084.js +1 -0
- package/dist/client/static/js/catppuccin-mocha-hw0dzp99.js +1 -0
- package/dist/client/static/js/classDiagram-v2-NBCMYWYE-gm7jt1cd.js +217 -0
- package/dist/client/static/js/clike-h8p24dc6.js +1 -0
- package/dist/client/static/js/clojure-tf457n84.js +1 -0
- package/dist/client/static/js/clojure-w19rx1x5.js +1 -0
- package/dist/client/static/js/cmake-qpejsvqg.js +1 -0
- package/dist/client/static/js/cose-bilkent-JH36ORCC-g0g3z0xp.js +1 -0
- package/dist/client/static/js/cpp-r1za1kke.js +1 -0
- package/dist/client/static/js/csharp-dap1ppts.js +1 -0
- package/dist/client/static/js/css-qsv4vvke.js +1 -0
- package/dist/client/static/js/css-tf1s0nb7.js +1 -0
- package/dist/client/static/js/cynefin-OW5HDTMX-eycwde8c.js +1 -0
- package/dist/client/static/js/cynefinDiagram-VND7K2PF-6vjde6am.js +62 -0
- package/dist/client/static/js/dagre-6A5THRUB-q6k8bx1j.js +4 -0
- package/dist/client/static/js/dark-plus-weqfnwnf.js +1 -0
- package/dist/client/static/js/dart-dxn88tw0.js +1 -0
- package/dist/client/static/js/diagram-22UHCM2B-87cmze2n.js +200 -0
- package/dist/client/static/js/diagram-3UASUU5V-1ejbr2p4.js +24 -0
- package/dist/client/static/js/diagram-ATOU4E4O-vaw1r6k2.js +3 -0
- package/dist/client/static/js/diagram-CDSNMT55-gxm9zv7d.js +30 -0
- package/dist/client/static/js/diagram-MLGK6HIB-x010xswm.js +24 -0
- package/dist/client/static/js/diagram-MPIPVDR6-qtcq7e6c.js +41 -0
- package/dist/client/static/js/diff-r1sqd2db.js +1 -0
- package/dist/client/static/js/dockerfile-d43jt8fq.js +1 -0
- package/dist/client/static/js/dockerfile-k5xbramm.js +1 -0
- package/dist/client/static/js/dracula-k5pe1hsy.js +1 -0
- package/dist/client/static/js/dracula-soft-xqzm7g02.js +1 -0
- package/dist/client/static/js/ebnfDiagram-ZINNZB2B-nwwbasfh.js +1 -0
- package/dist/client/static/js/elixir-rpa1g4gy.js +1 -0
- package/dist/client/static/js/elk-276RUBZZ-xcp7thax.js +2 -0
- package/dist/client/static/js/erDiagram-OPXOYQCR-xj1tp716.js +99 -0
- package/dist/client/static/js/erlang-1ch2hjv9.js +1 -0
- package/dist/client/static/js/erlang-rz1g9mxy.js +1 -0
- package/dist/client/static/js/eventmodeling-NTZA5JFV-srqbnmey.js +1 -0
- package/dist/client/static/js/everforest-dark-v44f35e9.js +1 -0
- package/dist/client/static/js/everforest-light-c7m7g4z4.js +1 -0
- package/dist/client/static/js/flowDiagram-KWPJA3E3-yj98317w.js +1 -0
- package/dist/client/static/js/ganttDiagram-FUAMR5RP-f7q96bea.js +292 -0
- package/dist/client/static/js/ghostty-web-2gt2tp72.js +13 -0
- package/dist/client/static/js/gitGraph-4MIJSDKK-5jcrvn94.js +1 -0
- package/dist/client/static/js/gitGraphDiagram-X574FWY7-1rydkyq9.js +106 -0
- package/dist/client/static/js/github-dark-default-1000qs8y.js +1 -0
- package/dist/client/static/js/github-dark-dimmed-vfghfgh1.js +1 -0
- package/dist/client/static/js/github-dark-fvd3e45k.js +1 -0
- package/dist/client/static/js/github-dark-high-contrast-2j07czxg.js +1 -0
- package/dist/client/static/js/github-light-9r4ahj0m.js +1 -0
- package/dist/client/static/js/github-light-default-6d4nszch.js +1 -0
- package/dist/client/static/js/github-light-high-contrast-qwzscwzg.js +1 -0
- package/dist/client/static/js/go-nfrqbjpq.js +1 -0
- package/dist/client/static/js/go-rtqh5zp3.js +1 -0
- package/dist/client/static/js/graphql-275pg7ya.js +1 -0
- package/dist/client/static/js/groovy-63s5pygd.js +1 -0
- package/dist/client/static/js/groovy-s992001c.js +1 -0
- package/dist/client/static/js/gruvbox-dark-hard-ctttkbm1.js +1 -0
- package/dist/client/static/js/gruvbox-dark-medium-vh8mkpgj.js +1 -0
- package/dist/client/static/js/gruvbox-dark-soft-9f1ph8sj.js +1 -0
- package/dist/client/static/js/gruvbox-light-hard-n3ma2f5b.js +1 -0
- package/dist/client/static/js/gruvbox-light-medium-hkamn7bg.js +1 -0
- package/dist/client/static/js/gruvbox-light-soft-r39t4g97.js +1 -0
- package/dist/client/static/js/haskell-ev7ynt8z.js +1 -0
- package/dist/client/static/js/haskell-phxh4hcg.js +1 -0
- package/dist/client/static/js/hcl-wndsmevr.js +1 -0
- package/dist/client/static/js/horizon-bright-wz5mjtp4.js +1 -0
- package/dist/client/static/js/horizon-pr13gmaz.js +1 -0
- package/dist/client/static/js/houston-mrdq0gj4.js +1 -0
- package/dist/client/static/js/html-pv88ny12.js +1 -0
- package/dist/client/static/js/index-0a1ekhqf.js +2 -0
- package/dist/client/static/js/index-0g25yrc0.js +1 -0
- package/dist/client/static/js/index-0j518hqm.js +2 -0
- package/dist/client/static/js/index-0n9c85ke.js +2 -0
- package/dist/client/static/js/index-123e8tqq.js +2 -0
- package/dist/client/static/js/index-14wppnkx.js +2 -0
- package/dist/client/static/js/index-22jaxtz1.js +2 -0
- package/dist/client/static/js/index-2n5wy1sh.js +1 -0
- package/dist/client/static/js/index-2t2tnc3x.js +1 -0
- package/dist/client/static/js/index-31jrebvn.js +214 -0
- package/dist/client/static/js/index-3anc30zh.js +2 -0
- package/dist/client/static/js/index-52bgxh6f.js +1 -0
- package/dist/client/static/js/index-5zd1jx9r.js +2 -0
- package/dist/client/static/js/index-6sdctwv2.js +2 -0
- package/dist/client/static/js/index-73xfkyea.js +2 -0
- package/dist/client/static/js/index-8a3tmm1h.js +332 -0
- package/dist/client/static/js/index-8m3q2zpb.js +1 -0
- package/dist/client/static/js/index-9nbxb421.js +2 -0
- package/dist/client/static/js/index-a293pdg7.js +2 -0
- package/dist/client/static/js/index-b08zd4eq.js +1 -0
- package/dist/client/static/js/index-c20a46ww.js +2 -0
- package/dist/client/static/js/index-c8jzx6b0.js +2 -0
- package/dist/client/static/js/index-cwaz6geq.js +2 -0
- package/dist/client/static/js/index-deex10rz.js +9 -0
- package/dist/client/static/js/index-e26rd868.js +2 -0
- package/dist/client/static/js/index-e6rar25v.js +2 -0
- package/dist/client/static/js/index-e7a3fkvv.js +1 -0
- package/dist/client/static/js/index-e94a1en0.css +1 -0
- package/dist/client/static/js/index-f519m6s3.js +1 -0
- package/dist/client/static/js/index-f63y3mjj.js +7 -0
- package/dist/client/static/js/index-fc2j6bq2.js +2 -0
- package/dist/client/static/js/index-fmxn1rzs.js +3 -0
- package/dist/client/static/js/index-g0pkzanm.js +2 -0
- package/dist/client/static/js/index-ga2xdef3.js +2 -0
- package/dist/client/static/js/index-ggaqh9rt.js +2 -0
- package/dist/client/static/js/index-gvwqjpcr.js +2 -0
- package/dist/client/static/js/index-h6jxmkxk.js +129 -0
- package/dist/client/static/js/index-hhm62nfj.js +2 -0
- package/dist/client/static/js/index-hkq0y3pn.js +2 -0
- package/dist/client/static/js/index-hyry1n8x.js +2 -0
- package/dist/client/static/js/index-m6wwc5h6.js +2 -0
- package/dist/client/static/js/index-nsrnyqcm.js +2 -0
- package/dist/client/static/js/index-pe9j88d4.js +2 -0
- package/dist/client/static/js/index-pkyrkkbt.js +2 -0
- package/dist/client/static/js/index-qmh0h87h.js +314 -0
- package/dist/client/static/js/index-r416e9dt.js +12 -0
- package/dist/client/static/js/index-s9vp6p70.js +2 -0
- package/dist/client/static/js/index-tr8754r0.js +179 -0
- package/dist/client/static/js/index-vmvcse63.js +1 -0
- package/dist/client/static/js/index-vnvrzwht.js +240 -0
- package/dist/client/static/js/index-vrbcj11n.js +2 -0
- package/dist/client/static/js/index-w4re5r8w.js +2 -0
- package/dist/client/static/js/index-w5131mtt.js +2 -0
- package/dist/client/static/js/index-w7xbfv44.js +2 -0
- package/dist/client/static/js/index-x64kqgen.js +2 -0
- package/dist/client/static/js/index-xa7nrnda.js +2 -0
- package/dist/client/static/js/index-xpf2ra60.js +1 -0
- package/dist/client/static/js/index-xzfsaqyz.js +4 -0
- package/dist/client/static/js/index-y139vc12.js +474 -0
- package/dist/client/static/js/index-ynqnbvn2.js +3 -0
- package/dist/client/static/js/index-yvcpdk5f.js +89 -0
- package/dist/client/static/js/index-zca66d5d.js +3 -0
- package/dist/client/static/js/info-A6RAGUB7-mbt0ryx5.js +1 -0
- package/dist/client/static/js/infoDiagram-VRGFBTTK-ptg07tp2.js +2 -0
- package/dist/client/static/js/ini-jqdrx98c.js +1 -0
- package/dist/client/static/js/ishikawaDiagram-OU5B5YK6-bdk2dkf5.js +70 -0
- package/dist/client/static/js/java-70zqqrkr.js +1 -0
- package/dist/client/static/js/javascript-18thb3jp.js +1 -0
- package/dist/client/static/js/javascript-4kw2j9t3.js +1 -0
- package/dist/client/static/js/journeyDiagram-ZHPQQLJL-kez0ha4c.js +139 -0
- package/dist/client/static/js/json-kxk8gfet.js +1 -0
- package/dist/client/static/js/json5-hmb38a78.js +1 -0
- package/dist/client/static/js/jsx-h1035eqk.js +1 -0
- package/dist/client/static/js/julia-ft9kd90a.js +1 -0
- package/dist/client/static/js/julia-nmr85k8z.js +1 -0
- package/dist/client/static/js/kanagawa-dragon-nya1w1ke.js +1 -0
- package/dist/client/static/js/kanagawa-lotus-hwn4nbn5.js +1 -0
- package/dist/client/static/js/kanagawa-wave-7rsxqd8r.js +1 -0
- package/dist/client/static/js/kanban-definition-PNTS6WVX-dhzp3qg5.js +89 -0
- package/dist/client/static/js/katex-eh1m1m1d.js +257 -0
- package/dist/client/static/js/kotlin-bw3n4j1v.js +1 -0
- package/dist/client/static/js/laserwave-37chepry.js +1 -0
- package/dist/client/static/js/less-w8v48sx0.js +1 -0
- package/dist/client/static/js/light-plus-mcbbmtzj.js +1 -0
- package/dist/client/static/js/lua-6at2ddf6.js +1 -0
- package/dist/client/static/js/lua-j2356waf.js +1 -0
- package/dist/client/static/js/main-rx9grv92.js +7 -0
- package/dist/client/static/js/makefile-22weg265.js +1 -0
- package/dist/client/static/js/markdown-ffw6rgk6.js +1 -0
- package/dist/client/static/js/material-theme-darker-pcm1tb69.js +1 -0
- package/dist/client/static/js/material-theme-lighter-cbdrfj3g.js +1 -0
- package/dist/client/static/js/material-theme-ocean-3rs19bm6.js +1 -0
- package/dist/client/static/js/material-theme-palenight-rxhkgd4c.js +1 -0
- package/dist/client/static/js/material-theme-x46yf0tm.js +1 -0
- package/dist/client/static/js/mermaid.core-h7wttbss.js +12 -0
- package/dist/client/static/js/min-dark-f279fhzv.js +1 -0
- package/dist/client/static/js/min-light-s53yjy4e.js +1 -0
- package/dist/client/static/js/mindmap-definition-NLK3R4M7-tq5dd1em.js +96 -0
- package/dist/client/static/js/mllike-cnahv8ak.js +1 -0
- package/dist/client/static/js/monokai-yr7h8283.js +1 -0
- package/dist/client/static/js/night-owl-8d01zsx4.js +1 -0
- package/dist/client/static/js/night-owl-light-7jbd0p3j.js +1 -0
- package/dist/client/static/js/nix-7e31jz1m.js +1 -0
- package/dist/client/static/js/nord-h1bak1eb.js +1 -0
- package/dist/client/static/js/objective-c-8r3dxert.js +1 -0
- package/dist/client/static/js/ocaml-bpjgcgwa.js +1 -0
- package/dist/client/static/js/one-dark-pro-8acf6cn2.js +1 -0
- package/dist/client/static/js/one-light-ysc1knem.js +1 -0
- package/dist/client/static/js/packet-AYTQ26CC-a5yw789s.js +1 -0
- package/dist/client/static/js/pegDiagram-GJSIUBJH-e5hrdfzv.js +1 -0
- package/dist/client/static/js/perl-3t5fm1te.js +1 -0
- package/dist/client/static/js/perl-prxcva8r.js +1 -0
- package/dist/client/static/js/php-m9kcctzs.js +1 -0
- package/dist/client/static/js/pie-WAS4IAKB-x0y4v4r2.js +1 -0
- package/dist/client/static/js/pieDiagram-5QR66LMP-axvbvnz8.js +39 -0
- package/dist/client/static/js/plastic-8kfqgcmr.js +1 -0
- package/dist/client/static/js/poimandres-rjcckfek.js +1 -0
- package/dist/client/static/js/powershell-m5qb6mjj.js +1 -0
- package/dist/client/static/js/powershell-rrzhqtmb.js +1 -0
- package/dist/client/static/js/properties-55mrarxr.js +1 -0
- package/dist/client/static/js/properties-qq2pcfyk.js +1 -0
- package/dist/client/static/js/protobuf-578974t5.js +1 -0
- package/dist/client/static/js/protobuf-ggczeare.js +1 -0
- package/dist/client/static/js/python-dhypc3j4.js +1 -0
- package/dist/client/static/js/python-wbdfs2gc.js +1 -0
- package/dist/client/static/js/quadrantDiagram-O4NWA36T-wtn28cfm.js +7 -0
- package/dist/client/static/js/r-6b8dt1wp.js +1 -0
- package/dist/client/static/js/r-z4m38eb1.js +1 -0
- package/dist/client/static/js/racket-dhm8rebp.js +1 -0
- package/dist/client/static/js/radar-RG4KPBEZ-trrc3ta1.js +1 -0
- package/dist/client/static/js/railroad-74A4TZTK-dxgvx21w.js +1 -0
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-rbgkd8sk.js +1 -0
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-exgw7j47.js +1 -0
- package/dist/client/static/js/railroad-peg-WCYAUIDC-28tpamzk.js +1 -0
- package/dist/client/static/js/railroadDiagram-XR7U4H2S-avjkq945.js +1 -0
- package/dist/client/static/js/red-zgbwyj31.js +1 -0
- package/dist/client/static/js/requirementDiagram-PLB6GJNP-bntx7r6q.js +84 -0
- package/dist/client/static/js/rose-pine-azwmazxg.js +1 -0
- package/dist/client/static/js/rose-pine-dawn-3t3j9bnk.js +1 -0
- package/dist/client/static/js/rose-pine-moon-35ecvxkf.js +1 -0
- package/dist/client/static/js/ruby-nq98w40a.js +1 -0
- package/dist/client/static/js/ruby-t06c0e7g.js +1 -0
- package/dist/client/static/js/rust-6gqjxyf0.js +1 -0
- package/dist/client/static/js/rust-psncxtga.js +1 -0
- package/dist/client/static/js/sankeyDiagram-IPEJSGJF-ps8nkdm2.js +40 -0
- package/dist/client/static/js/sass-gsbyn3wh.js +1 -0
- package/dist/client/static/js/sass-k1jjq4y7.js +1 -0
- package/dist/client/static/js/scala-atdk263v.js +1 -0
- package/dist/client/static/js/scheme-181kqjff.js +1 -0
- package/dist/client/static/js/scheme-jvs3e9c8.js +1 -0
- package/dist/client/static/js/scss-zphrqp25.js +1 -0
- package/dist/client/static/js/sequenceDiagram-PO4LG4MO-3ckf1q6z.js +169 -0
- package/dist/client/static/js/shell-5rhwzbr3.js +1 -0
- package/dist/client/static/js/sizeCapture-INFHLROL-akvcr1x7.js +1 -0
- package/dist/client/static/js/slack-dark-j9p83tbc.js +1 -0
- package/dist/client/static/js/slack-ochin-fe90gs3m.js +1 -0
- package/dist/client/static/js/snazzy-light-pj44bwcm.js +1 -0
- package/dist/client/static/js/solarized-dark-54jyr51c.js +1 -0
- package/dist/client/static/js/solarized-light-ca8r58m6.js +1 -0
- package/dist/client/static/js/solidity-bx92jb30.js +1 -0
- package/dist/client/static/js/sql-9dq913c8.js +1 -0
- package/dist/client/static/js/sql-wsvbkyd1.js +1 -0
- package/dist/client/static/js/stateDiagram-v2-GCMORJYK-c82914fz.js +291 -0
- package/dist/client/static/js/stylus-fht9fjbw.js +1 -0
- package/dist/client/static/js/stylus-xh0f7m9m.js +1 -0
- package/dist/client/static/js/svelte-j54gfrvq.js +1 -0
- package/dist/client/static/js/swift-0rtnm3tm.js +1 -0
- package/dist/client/static/js/swift-rr9wc5y7.js +1 -0
- package/dist/client/static/js/swimlanes-2SLR337P-scgdefh4.js +1 -0
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-0x2ashav.js +8 -0
- package/dist/client/static/js/synthwave-84-yq047vcq.js +1 -0
- package/dist/client/static/js/timeline-definition-EJHVYXUP-z2ha1rhq.js +120 -0
- package/dist/client/static/js/tokyo-night-jfy87bj1.js +1 -0
- package/dist/client/static/js/toml-b5g7qp6k.js +1 -0
- package/dist/client/static/js/toml-prjdc335.js +1 -0
- package/dist/client/static/js/treeView-Q6P3EWNA-1a00b6kc.js +1 -0
- package/dist/client/static/js/treemap-WGGIJYW6-2q4f2f7m.js +1 -0
- package/dist/client/static/js/tsx-wh5xgm7f.js +1 -0
- package/dist/client/static/js/typescript-ge85req5.js +1 -0
- package/dist/client/static/js/usecaseDiagram-POWQR4AR-3wdmrfmk.js +370 -0
- package/dist/client/static/js/vennDiagram-UO4OBE2U-7m5tatzv.js +34 -0
- package/dist/client/static/js/vesper-0e7jx631.js +1 -0
- package/dist/client/static/js/vitesse-black-avx6j9e8.js +1 -0
- package/dist/client/static/js/vitesse-dark-5ypr9e1f.js +1 -0
- package/dist/client/static/js/vitesse-light-sze15mny.js +1 -0
- package/dist/client/static/js/vue-y8bb5f3h.js +1 -0
- package/dist/client/static/js/wardley-WFR3VGLG-x9v91the.js +1 -0
- package/dist/client/static/js/wardleyDiagram-VNRHLVJA-55ps9s4z.js +78 -0
- package/dist/client/static/js/xml-7bgz40qa.js +1 -0
- package/dist/client/static/js/xml-f6syr877.js +1 -0
- package/dist/client/static/js/xychartDiagram-PMCCYNJV-8bsjtm4t.js +7 -0
- package/dist/client/static/js/yaml-4ht9416k.js +1 -0
- package/dist/client/static/js/yaml-qwwswzvs.js +1 -0
- package/dist/client/static/js/zig-yf26r6vn.js +1 -0
- package/marketplace/plugins/stats/package.json +2 -2
- package/marketplace/plugins/stats/src/format.test.ts +7 -1
- package/package.json +5 -2
- package/src/client/App.tsx +16 -0
- package/src/client/components/common/anchored-menu/index.test.tsx +3 -3
- package/src/client/components/common/anchored-menu/index.tsx +10 -16
- package/src/client/components/common/command-palette/ChordHint.tsx +36 -0
- package/src/client/components/common/command-palette/index.test.tsx +126 -0
- package/src/client/components/common/command-palette/index.tsx +216 -0
- package/src/client/components/common/context-usage-button/McpSection.tsx +133 -0
- package/src/client/components/common/context-usage-button/Ring.tsx +12 -6
- package/src/client/components/common/context-usage-button/index.test.tsx +24 -13
- package/src/client/components/common/context-usage-button/index.tsx +47 -40
- package/src/client/components/common/key-binding-cheatsheet/index.tsx +147 -0
- package/src/client/components/common/server-control/Panel.tsx +8 -9
- package/src/client/components/common/session-actions-menu/index.test.tsx +26 -0
- package/src/client/components/common/session-actions-menu/index.tsx +19 -15
- package/src/client/components/common/session-row/RunElapsed.tsx +50 -0
- package/src/client/components/common/session-row/TimeCell.tsx +38 -0
- package/src/client/components/common/session-row/TrailingSlot.tsx +31 -13
- package/src/client/components/common/session-row/index.tsx +5 -0
- package/src/client/components/common/session-row/session-row.test.tsx +39 -1
- package/src/client/components/layout/desktop-layout/LeftColumn.tsx +2 -0
- package/src/client/components/layout/desktop-layout/index.tsx +7 -3
- package/src/client/components/layout/session-sidebar/CategoryItem.tsx +2 -1
- package/src/client/components/layout/session-sidebar/Footer.tsx +13 -2
- package/src/client/components/layout/session-sidebar/SessionItem.test.ts +17 -0
- package/src/client/components/layout/session-sidebar/SessionItem.tsx +13 -7
- package/src/client/components/layout/session-sidebar/modern/WorkspaceSection.tsx +2 -1
- package/src/client/components/mobile/RightSidebar.tsx +2 -1
- package/src/client/components/mobile/SessionSidebar.tsx +2 -0
- package/src/client/components/mobile/mobile-main-view/Header.test.tsx +122 -0
- package/src/client/components/mobile/mobile-main-view/Header.tsx +25 -26
- package/src/client/components/mobile/mobile-session-sidebar/Footer.tsx +11 -1
- package/src/client/components/mobile/mobile-session-sidebar/Item.tsx +2 -1
- package/src/client/components/mobile/mobile-session-sidebar/SessionRow.tsx +10 -5
- package/src/client/components/settings/Modal.tsx +3 -0
- package/src/client/components/settings/Sidebar.tsx +3 -2
- package/src/client/components/settings/categories/ChatSettings.test.tsx +2 -2
- package/src/client/components/settings/categories/ChatSettings.tsx +0 -2
- package/src/client/components/settings/categories/KeyboardSettings.tsx +31 -0
- package/src/client/components/settings/categories/McpSettings.tsx +10 -3
- package/src/client/components/settings/categories/NotificationSettings.tsx +9 -0
- package/src/client/components/settings/categories/SkillCatalogSettings.tsx +34 -16
- package/src/client/components/settings/categories/SkillSettings.tsx +22 -1
- package/src/client/components/settings/categories/chat-settings/groups.ts +2 -11
- package/src/client/components/settings/categories/{chat-settings/KeybindingsSection.tsx → keyboard-settings/ComposerKeys.tsx} +2 -2
- package/src/client/components/settings/categories/keyboard-settings/KeyRecorder.tsx +106 -0
- package/src/client/components/settings/categories/keyboard-settings/ShortcutTable.tsx +137 -0
- package/src/client/components/settings/categories/mcp-settings/AdvancedSection.tsx +244 -0
- package/src/client/components/settings/categories/mcp-settings/ConnectionTest.tsx +3 -3
- package/src/client/components/settings/categories/mcp-settings/DetailPane.tsx +55 -97
- package/src/client/components/settings/categories/mcp-settings/ImportModal.tsx +12 -64
- package/src/client/components/settings/categories/mcp-settings/{EnvVarsSection.tsx → KeyValueSection.tsx} +42 -24
- package/src/client/components/settings/categories/mcp-settings/SidebarList.tsx +1 -1
- package/src/client/components/settings/categories/mcp-settings/TransportSection.tsx +101 -0
- package/src/client/components/settings/categories/skill-catalog/GitImportPanel.tsx +13 -41
- package/src/client/components/settings/categories/skill-catalog/SkillCard.tsx +1 -1
- package/src/client/components/settings/categories/skill-catalog/catalog-ui.test.tsx +3 -6
- package/src/client/components/settings/categories/skill-settings/DetailHeader.tsx +43 -2
- package/src/client/components/settings/categories/skill-settings/DetailPane.tsx +9 -0
- package/src/client/components/settings/categories/skill-settings/pane.test.tsx +28 -0
- package/src/client/components/settings/categories/skill-settings/row-meta.ts +3 -0
- package/src/client/components/workspace/browser-panel/EngineNotice.test.tsx +109 -0
- package/src/client/components/workspace/browser-panel/EngineNotice.tsx +112 -0
- package/src/client/components/workspace/browser-panel/index.tsx +45 -12
- package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.test.ts +63 -0
- package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.tsx +18 -6
- package/src/client/components/workspace/chat-timeline/chat-input/AttachmentToolbar.tsx +38 -5
- package/src/client/components/workspace/chat-timeline/chat-input/AttachmentToolbar.wait.test.tsx +158 -0
- package/src/client/components/workspace/chat-timeline/chat-input/ComposerRows.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.test.ts +28 -33
- package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.tsx +27 -68
- package/src/client/components/workspace/chat-timeline/chat-input/WaitingDependencyPicker.search.test.tsx +4 -2
- package/src/client/components/workspace/chat-timeline/chat-input/WaitingDependencyPicker.tsx +101 -78
- package/src/client/components/workspace/chat-timeline/chat-input/access-levels.ts +39 -1
- package/src/client/components/workspace/chat-timeline/chat-input/props.ts +3 -3
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Eval.test.tsx +33 -7
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Eval.tsx +5 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ToolScreenshots.test.tsx +113 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ToolScreenshots.tsx +198 -0
- package/src/client/components/workspace/editor/Body.tsx +0 -15
- package/src/client/components/workspace/editor/FileDocument.tsx +0 -26
- package/src/client/components/workspace/editor/FilePane.tsx +0 -15
- package/src/client/components/workspace/editor/Pane.tsx +4 -1
- package/src/client/components/workspace/editor/index.tsx +5 -8
- package/src/client/components/workspace/editor/plugin-rail.test.tsx +6 -1
- package/src/client/components/workspace/terminal-panel/scroll-hold.test.ts +20 -5
- package/src/client/data/settings/mcp.ts +4 -2
- package/src/client/data/settings/omp-schema.json +22 -2
- package/src/client/hooks/browser/use-browser-engine.ts +99 -0
- package/src/client/hooks/chat/context/mcp.ts +159 -0
- package/src/client/hooks/chat/omp/session-list.test.ts +13 -0
- package/src/client/hooks/chat/omp/session-list.tsx +33 -8
- package/src/client/hooks/chat/timeline/access-mode.ts +45 -15
- package/src/client/hooks/chat/timeline/index.ts +7 -3
- package/src/client/hooks/chat/timeline/timeline-mode-state.test.ts +33 -4
- package/src/client/hooks/chat/waiting/composer-wait.ts +2 -2
- package/src/client/hooks/commands/use-command-catalog.ts +52 -0
- package/src/client/hooks/commands/use-command-context.ts +21 -0
- package/src/client/hooks/commands/use-command-runtime.test.ts +117 -0
- package/src/client/hooks/commands/use-command-runtime.ts +62 -0
- package/src/client/hooks/commands/use-overlays.ts +35 -0
- package/src/client/hooks/commands/use-palette-items.ts +156 -0
- package/src/client/hooks/commands/use-plugin-commands.ts +69 -0
- package/src/client/hooks/editor/find-harness.test-util.ts +20 -3
- package/src/client/hooks/editor/use-editor-command-target.ts +46 -0
- package/src/client/hooks/editor/use-editor-find.test.ts +4 -9
- package/src/client/hooks/editor/use-editor-panel-keys.ts +24 -93
- package/src/client/hooks/editor/use-editor-panel-ui.ts +0 -10
- package/src/client/hooks/settings/skill-catalog.ts +3 -3
- package/src/client/hooks/settings/skill-git-import.ts +3 -11
- package/src/client/hooks/ui/icon-style.ts +10 -5
- package/src/client/hooks/ui/notification-events.test.ts +126 -0
- package/src/client/hooks/ui/notification-events.ts +61 -0
- package/src/client/hooks/ui/second-tick.ts +55 -0
- package/src/client/hooks/ui/theme.ts +9 -5
- package/src/client/hooks/ui/ui-listeners.test.ts +13 -18
- package/src/client/hooks/workspace/commands.ts +51 -0
- package/src/client/lib/commands/context.ts +51 -0
- package/src/client/lib/commands/dispatcher.ts +101 -0
- package/src/client/lib/commands/editor-target.ts +36 -0
- package/src/client/lib/commands/keymap.test.ts +68 -0
- package/src/client/lib/commands/keymap.ts +151 -0
- package/src/client/lib/commands/overlays.ts +87 -0
- package/src/client/lib/commands/registry.ts +69 -0
- package/src/client/lib/notifications/os.test.ts +24 -0
- package/src/client/lib/notifications/os.ts +16 -0
- package/src/client/lib/notifications/watch.ts +48 -0
- package/src/client/lib/plugins/slots.ts +1 -0
- package/src/client/main.tsx +7 -0
- package/src/client/tailwind.css +5 -38
- package/src/server/db.server.test.ts +10 -4
- package/src/server/index.ts +12 -8
- package/src/server/lib/assets/theme-css.server.test.ts +58 -0
- package/src/server/lib/assets/theme-css.server.ts +52 -0
- package/src/server/lib/auth/guard.ts +6 -1
- package/src/server/lib/browser/engine.test.ts +118 -0
- package/src/server/lib/browser/engine.ts +102 -0
- package/src/server/lib/browser/runtime.test.ts +21 -16
- package/src/server/lib/db/client.test.ts +89 -0
- package/src/server/lib/db/client.ts +31 -0
- package/src/server/lib/db/compact-chat-overlay.ts +7 -1
- package/src/server/lib/db/schema.ts +8 -0
- package/src/server/lib/db/workspace-sync.ts +7 -7
- package/src/server/lib/fs/toolchain-path.test.ts +87 -0
- package/src/server/lib/fs/toolchain-path.ts +49 -0
- package/src/server/lib/harness/acp/protocol.ts +9 -1
- package/src/server/lib/harness/acp/session-permissions.ts +4 -0
- package/src/server/lib/harness/auto-probe.server.ts +3 -2
- package/src/server/lib/harness/launch-table.ts +3 -2
- package/src/server/lib/harness/spawn.server.ts +5 -1
- package/src/server/lib/harness/update-queue.server.ts +2 -1
- package/src/server/lib/harness/update-state.server.ts +6 -2
- package/src/server/lib/lifecycle/fd-pressure.test.ts +43 -0
- package/src/server/lib/lifecycle/fd-pressure.ts +38 -0
- package/src/server/lib/lifecycle/listener.ts +4 -4
- package/src/server/lib/lifecycle/shell-entry.server.ts +29 -0
- package/src/server/lib/lifecycle/shell-route.ts +5 -4
- package/src/server/lib/mcp/probe.server.ts +71 -0
- package/src/server/lib/mcp/registry.server.ts +195 -46
- package/src/server/lib/mcp/registry.test.ts +76 -4
- package/src/server/lib/mcp/schema.server.ts +35 -0
- package/src/server/lib/mcp/session-mcp.test.ts +164 -0
- package/src/server/lib/mcp/session-overlay.server.ts +152 -0
- package/src/server/lib/mcp/session-state.server.ts +75 -0
- package/src/server/lib/mcp/store.server.ts +6 -1
- package/src/server/lib/notifications/feed.server.test.ts +127 -0
- package/src/server/lib/notifications/feed.server.ts +195 -0
- package/src/server/lib/notifications/schema.server.ts +47 -0
- package/src/server/lib/notifications/store.server.test.ts +118 -0
- package/src/server/lib/notifications/store.server.ts +103 -0
- package/src/server/lib/observer-ws.test.ts +49 -0
- package/src/server/lib/observer-ws.ts +2 -1
- package/src/server/lib/omp/config/config-cli.ts +4 -0
- package/src/server/lib/omp/config/definitions.test.ts +17 -18
- package/src/server/lib/omp/config/mcp-and-cli.test.ts +12 -183
- package/src/server/lib/omp/config/mcp-config.test.ts +277 -0
- package/src/server/lib/omp/config/mcp-shared.ts +36 -0
- package/src/server/lib/omp/config/mcp-test-protocol.ts +89 -0
- package/src/server/lib/omp/config/mcp-test-remote.ts +167 -0
- package/src/server/lib/omp/config/mcp-test.ts +21 -123
- package/src/server/lib/omp/config/mcp-write.ts +179 -0
- package/src/server/lib/omp/config/mcp.ts +138 -118
- package/src/server/lib/omp/config/skills-catalog.ts +109 -73
- package/src/server/lib/omp/config/skills-git-repo.ts +10 -12
- package/src/server/lib/omp/core/cli.ts +4 -14
- package/src/server/lib/omp/rpc/frame-fold-frames.test.ts +2 -0
- package/src/server/lib/omp/rpc/manager.ts +16 -18
- package/src/server/lib/omp/rpc/reload-mcp.ts +39 -0
- package/src/server/lib/omp/rpc/run-model.test.ts +2 -0
- package/src/server/lib/omp/rpc/session-registry.ts +6 -2
- package/src/server/lib/omp/rpc/spawn-mcp.ts +43 -0
- package/src/server/lib/omp/session/delete.server.ts +7 -0
- package/src/server/lib/omp/session/sidebar-data.server.ts +1 -0
- package/src/server/lib/plugins/mcp.server.ts +2 -2
- package/src/server/lib/realtime/hub.server.test.ts +27 -1
- package/src/server/lib/realtime/hub.server.ts +6 -2
- package/src/server/lib/realtime/hub.types.ts +9 -1
- package/src/server/lib/realtime/topics/catalog.server.ts +5 -0
- package/src/server/lib/realtime/topics/peer-relay.server.test.ts +27 -14
- package/src/server/lib/realtime/topics/workspace.server.test.ts +44 -0
- package/src/server/lib/realtime/topics/workspace.server.ts +3 -2
- package/src/server/lib/realtime/topics.server.test.ts +2 -1
- package/src/server/plugins/shell.server.test.ts +4 -4
- package/src/server/plugins/shell.server.ts +83 -22
- package/src/server/plugins/ssr.ts +13 -11
- package/src/server/plugins/static.ts +5 -7
- package/src/server/routes/browser/engine.test.ts +70 -0
- package/src/server/routes/browser/engine.ts +51 -0
- package/src/server/routes/browser/index.ts +5 -0
- package/src/server/routes/fs/git.ts +4 -3
- package/src/server/routes/harness/versions.test.ts +5 -0
- package/src/server/routes/health/probe.ts +7 -8
- package/src/server/routes/index.ts +2 -0
- package/src/server/routes/notifications/index.ts +6 -0
- package/src/server/routes/notifications/stream.test.ts +116 -0
- package/src/server/routes/notifications/stream.ts +88 -0
- package/src/server/routes/sessions/index.ts +7 -0
- package/src/server/routes/sessions/mcp.test.ts +154 -0
- package/src/server/routes/sessions/mcp.ts +202 -0
- package/src/server/routes/settings/mcp-test.ts +5 -4
- package/src/server/routes/settings/mcp.test.ts +42 -1
- package/src/server/routes/settings/mcp.ts +80 -24
- package/src/server/routes/settings/skills-catalog-actions.ts +11 -31
- package/src/server/routes/settings/skills.test.ts +14 -0
- package/src/server/routes/settings/skills.ts +29 -21
- package/src/shared/lib/code/highlight-cache.test.ts +19 -8
- package/src/shared/lib/code/highlight-memo.test.ts +18 -0
- package/src/shared/lib/code/highlight-memo.ts +46 -17
- package/src/shared/lib/commands/catalog.ts +114 -0
- package/src/shared/lib/commands/chord.test.ts +66 -0
- package/src/shared/lib/commands/chord.ts +193 -0
- package/src/shared/lib/commands/conflicts.test.ts +43 -0
- package/src/shared/lib/commands/conflicts.ts +53 -0
- package/src/shared/lib/commands/record.test.ts +24 -0
- package/src/shared/lib/commands/record.ts +44 -0
- package/src/shared/lib/commands/resolve.test.ts +54 -0
- package/src/shared/lib/commands/resolve.ts +45 -0
- package/src/shared/lib/commands/score.test.ts +41 -0
- package/src/shared/lib/commands/score.ts +53 -0
- package/src/shared/lib/commands/types.ts +60 -0
- package/src/shared/lib/commands/user-keybindings.test.ts +33 -0
- package/src/shared/lib/commands/user-keybindings.ts +64 -0
- package/src/shared/lib/commands/when.test.ts +46 -0
- package/src/shared/lib/commands/when.ts +221 -0
- package/src/shared/lib/icons/icon-paint-authority.test.ts +9 -0
- package/src/shared/lib/icons/icon-paint-authority.ts +25 -8
- package/src/shared/lib/mcp/import.ts +112 -0
- package/src/shared/lib/mcp/item.ts +61 -0
- package/src/shared/lib/mcp/key-value.ts +37 -0
- package/src/shared/lib/mcp/mcp-lib.test.ts +119 -0
- package/src/shared/lib/mcp/status.test.ts +36 -0
- package/src/shared/lib/mcp/status.ts +38 -0
- package/src/shared/lib/models/client.ts +27 -6
- package/src/shared/lib/models/provider/models.test.ts +31 -0
- package/src/shared/lib/notifications/events.test.ts +77 -0
- package/src/shared/lib/notifications/events.ts +104 -0
- package/src/shared/lib/omp/config/access-mode.test.ts +73 -0
- package/src/shared/lib/omp/config/access-mode.ts +49 -0
- package/src/shared/lib/omp/session/prewarm-misc.test.ts +3 -2
- package/src/shared/lib/omp/session/schema-migrations.ts +4 -0
- package/src/shared/lib/omp/session/stream-state.server.test.ts +37 -1
- package/src/shared/lib/omp/session/stream-state.server.ts +42 -5
- package/src/shared/lib/omp/skill-source.test.ts +24 -0
- package/src/shared/lib/omp/skill-source.ts +20 -0
- package/src/shared/lib/panels/slot-labels.ts +6 -1
- package/src/shared/lib/realtime/protocol.ts +11 -0
- package/src/shared/lib/theme/css.ts +11 -0
- package/src/shared/lib/ui/menu-anchor.test.ts +17 -5
- package/src/shared/lib/ui/menu-anchor.ts +22 -5
- package/src/shared/lib/workspace/refresh-cadence.test.ts +34 -1
- package/src/shared/lib/workspace/relative-time.ts +22 -0
- package/src/shared/lib/workspace/right-panels.ts +13 -0
- package/src/shared/lib/workspace/workspace-modules.test.ts +3 -1
- package/src/shared/types/browser.ts +21 -0
- package/src/shared/types/realtime.ts +10 -0
- package/src/shared/types/settings/mcp.ts +73 -4
- package/src/shared/types/settings/skill.ts +1 -9
- package/src/shared/types/settings/state.ts +1 -0
- package/src/shared/types/workspace.ts +5 -0
- package/src/test-support/peer-harness.ts +32 -6
- package/src/test-support/pristine-globals.test.ts +53 -0
- package/src/test-support/pristine-globals.ts +6 -1
- package/dist/client/static/js/index-bwhhehnh.js +0 -5697
- package/dist/client/static/js/index-naa91727.css +0 -1
- package/src/client/components/workspace/editor/CommandPalette.test.ts +0 -242
- package/src/client/components/workspace/editor/CommandPalette.tsx +0 -138
- package/src/client/components/workspace/editor/QuickOpenModal.tsx +0 -146
- package/src/client/hooks/ui/input-required-alert.ts +0 -50
- package/src/client/hooks/ui/notifications.ts +0 -54
- package/src/client/hooks/ui/run-outcome-alert.ts +0 -48
- package/src/client/hooks/ui/ui-alert.test.ts +0 -235
- package/src/client/hooks/workspace/keybindings.ts +0 -44
- package/src/shared/lib/notifications/outcomes.test.ts +0 -96
- package/src/shared/lib/notifications/outcomes.ts +0 -64
- package/src/shared/lib/ui/mobile-overlay.ts +0 -61
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Tell a phone shell whether it should keep watching while the console is away.
|
|
8
|
+
*
|
|
9
|
+
* The event switches live in the server's settings, and the shell has no page
|
|
10
|
+
* to ask once the app is backgrounded — so the answer is pushed to it here, on
|
|
11
|
+
* boot and whenever a switch changes. The shell persists it and starts its
|
|
12
|
+
* watcher from `onStop` only when it is armed.
|
|
13
|
+
*
|
|
14
|
+
* A no-op outside a phone shell: the desktop shells and a browser have no
|
|
15
|
+
* background watcher, and their notifications are posted by the page itself.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { callShell, shellHost } from '@/client/lib/shell/transport';
|
|
19
|
+
import { isNotificationEnabled, isNotificationPlatformEnabled } from '@/shared/lib/notifications/settings';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Whether any event is switched on AND this device class is allowed to banner.
|
|
23
|
+
*
|
|
24
|
+
* `settings` is passed by the Notifications page, whose own state is ahead of
|
|
25
|
+
* the primed snapshot by one write; the boot call omits it and reads the
|
|
26
|
+
* snapshot the page was served with.
|
|
27
|
+
*/
|
|
28
|
+
export function nativeNotificationWatchWanted(settings?: Record<string, any>): boolean {
|
|
29
|
+
if (!isNotificationPlatformEnabled('mobile', settings)) return false;
|
|
30
|
+
return (
|
|
31
|
+
isNotificationEnabled('finish', settings) ||
|
|
32
|
+
isNotificationEnabled('ask', settings) ||
|
|
33
|
+
isNotificationEnabled('error', settings)
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** Push the current answer to the shell. Safe to call on every settings change. */
|
|
38
|
+
export function syncNativeNotificationWatch(settings?: Record<string, any>): void {
|
|
39
|
+
// Android only: it is the one shell with a background watcher. iOS has no
|
|
40
|
+
// background connection, and a desktop shell posts from the page itself.
|
|
41
|
+
if (typeof window === 'undefined' || shellHost() !== 'android') return;
|
|
42
|
+
const enabled = nativeNotificationWatchWanted(settings);
|
|
43
|
+
void callShell('notification_watch', { enabled: enabled ? 'true' : 'false' }).catch((error) => {
|
|
44
|
+
// An older APK does not know the command; the page's own banners still work
|
|
45
|
+
// while the app is open, so this is reported and not retried.
|
|
46
|
+
console.warn('[notifications] the shell could not arm the background watcher:', error);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
@@ -206,6 +206,7 @@ export function registerPluginBundle(pluginId: string, module: unknown): void {
|
|
|
206
206
|
// only handle that should ever remove its row.
|
|
207
207
|
messageAction: (registration) => registerListSlot(pluginId, 'messageAction', registration),
|
|
208
208
|
commandPaletteAction: (registration) => registerListSlot(pluginId, 'commandPaletteAction', registration),
|
|
209
|
+
command: (registration) => registerListSlot(pluginId, 'command', registration),
|
|
209
210
|
fileOpener: (registration) => registerListSlot(pluginId, 'fileOpener', registration),
|
|
210
211
|
sourceCodeRenderer: (registration) => registerListSlot(pluginId, 'sourceCodeRenderer', registration),
|
|
211
212
|
diffRenderer: (registration) => registerListSlot(pluginId, 'diffRenderer', registration),
|
package/src/client/main.tsx
CHANGED
|
@@ -16,6 +16,7 @@ import { installBackDispatcher } from '@/client/lib/native/back';
|
|
|
16
16
|
import { installPalettePublisher } from '@/client/lib/native/palette';
|
|
17
17
|
import { installShellTransport } from '@/client/lib/shell/transport';
|
|
18
18
|
import { installResumeDispatcher } from '@/client/lib/native/resume';
|
|
19
|
+
import { syncNativeNotificationWatch } from '@/client/lib/notifications/watch';
|
|
19
20
|
import { installOpenSessionDispatcher } from '@/client/lib/native/open-session';
|
|
20
21
|
import { installFileLaunchHandler } from '@/client/lib/launch/file-handlers';
|
|
21
22
|
import { installOpenPaths } from '@/client/lib/native/open-paths';
|
|
@@ -106,6 +107,12 @@ installShellTransport();
|
|
|
106
107
|
// for the watchdog that covers the case no event arrives at all.
|
|
107
108
|
installResumeDispatcher();
|
|
108
109
|
|
|
110
|
+
// A phone shell keeps its own connection to the server's notification stream
|
|
111
|
+
// while the console is closed, because a backgrounded WebView is frozen and
|
|
112
|
+
// cannot post a banner. It needs the console's own switches to know whether to
|
|
113
|
+
// watch at all, and this is the only moment a page is guaranteed to exist.
|
|
114
|
+
syncNativeNotificationWatch();
|
|
115
|
+
|
|
109
116
|
// A file the OS handed to Kabmo (PWA File Handling) arrives as a
|
|
110
117
|
// `FileSystemFileHandle` on `launchQueue`, and the consumer must be installed
|
|
111
118
|
// before the first render: launches that happened before the script ran are
|
package/src/client/tailwind.css
CHANGED
|
@@ -65,15 +65,6 @@
|
|
|
65
65
|
--color-warning: var(--theme-warning);
|
|
66
66
|
--color-warning-text: var(--theme-warning-text);
|
|
67
67
|
--color-warning-hover: var(--theme-warning-hover);
|
|
68
|
-
/* A filled control's hover, for the two slots the composer's action pair
|
|
69
|
-
uses. Mixing toward the theme's INK follows the palette (darker on a light
|
|
70
|
-
theme, lighter on a dark one) and keeps the `text-canvas` glyph legal:
|
|
71
|
-
measured over the 63 palettes, `hover:opacity-90` blended the fill into the
|
|
72
|
-
paper and dropped the glyph to **3.77:1** on `nightowl-light`, while this
|
|
73
|
-
mix holds 4.71:1 minimum. The `-text` fill is what the control rests on —
|
|
74
|
-
the raw palette hex measures 1.94:1 against `aura-light`'s canvas. */
|
|
75
|
-
--color-error-text-hover: color-mix(in srgb, var(--theme-error-text) 88%, var(--theme-ink));
|
|
76
|
-
--color-info-text-hover: color-mix(in srgb, var(--theme-info-text) 88%, var(--theme-ink));
|
|
77
68
|
/* The brand mark's own colour, and deliberately NOT a theme token: the logo
|
|
78
69
|
is the same mark in every palette, so a theme flip must not repaint the
|
|
79
70
|
letter that carries it. This is the app icon's accent stroke — the orange
|
|
@@ -372,35 +363,11 @@
|
|
|
372
363
|
background-color: color-mix(in srgb, var(--theme-error) 75%, var(--theme-ink));
|
|
373
364
|
}
|
|
374
365
|
|
|
375
|
-
/*
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
* ink" (`icon-paint-ink.ts`), so two filled signal buttons were the only
|
|
381
|
-
* saturated objects left in a window that said it had no colour; reported as
|
|
382
|
-
* "btn send dan btn stop di mode monochrome kenapa masih berwarna?".
|
|
383
|
-
*
|
|
384
|
-
* The fill follows the app's own inverted surface (`bg-ink text-canvas`, used by
|
|
385
|
-
* every primary button), so the pair keeps the same geometry and the glyph's
|
|
386
|
-
* `text-canvas` stays the house pair — the palette's ink/canvas relationship,
|
|
387
|
-
* which is the one every body text already relies on.
|
|
388
|
-
*
|
|
389
|
-
* These rules are UNLAYERED and scoped to `:root:not([data-icon-style="color"])`
|
|
390
|
-
* for two reasons: a rule inside `@layer utilities` would sit at the same layer
|
|
391
|
-
* as the caller's `bg-info-text` and win only by source order, and the
|
|
392
|
-
* `:not(:disabled)` on hover keeps a disabled Send from re-stating the colour
|
|
393
|
-
* fill it was just moved off. The glyph itself is already handled by
|
|
394
|
-
* `monochromeSolidFillRules`, which keys on the very `bg-info-text` /
|
|
395
|
-
* `bg-error-text` classes this rule repaints.
|
|
396
|
-
*/
|
|
397
|
-
:root:not([data-icon-style="color"]) .composer-action {
|
|
398
|
-
background-color: var(--theme-ink);
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
:root:not([data-icon-style="color"]) .composer-action:hover:not(:disabled) {
|
|
402
|
-
background-color: color-mix(in srgb, var(--theme-ink) 90%, transparent);
|
|
403
|
-
}
|
|
366
|
+
/* (The composer's Stop/Send pair used to be two FILLED signal buttons, and this
|
|
367
|
+
is where monochrome repainted them ink. The pair is icon-only now — the
|
|
368
|
+
colour lives on the glyph (`text-error-text` / `text-info-text`), and the
|
|
369
|
+
monochrome ink pass in `icon-paint-ink.ts` already outranks those utilities,
|
|
370
|
+
so a `.composer-action` rule here would have nothing left to paint.) */
|
|
404
371
|
|
|
405
372
|
/* (The hero card's dot-grain texture lived here and was used by nothing: the
|
|
406
373
|
deploy hero it decorated is not part of this product. A texture with no
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
31
|
import { afterEach, beforeEach, describe, expect, test } from 'bun:test';
|
|
32
|
-
import { existsSync, mkdtempSync
|
|
32
|
+
import { existsSync, mkdtempSync } from 'node:fs';
|
|
33
33
|
import { homedir, tmpdir } from 'node:os';
|
|
34
34
|
import * as path from 'node:path';
|
|
35
35
|
|
|
@@ -109,9 +109,15 @@ describe('getDatabasePath', () => {
|
|
|
109
109
|
});
|
|
110
110
|
|
|
111
111
|
test('a leading ~ expands to the home directory', async () => {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
rmSync
|
|
112
|
+
// The parent must ALREADY exist: `getDatabasePath` creates a missing one,
|
|
113
|
+
// and a `~`-spelled parent is the developer's real home. A fixed probe
|
|
114
|
+
// directory there was created and then `rmSync`-ed on every run — a test
|
|
115
|
+
// that writes into `$HOME`, and deletes a directory it did not create if
|
|
116
|
+
// one happened to exist. `~` itself exists, so this case expands the tilde
|
|
117
|
+
// and touches nothing; nested creation is covered by the temp-root case
|
|
118
|
+
// above.
|
|
119
|
+
Bun.env.KABMO_DB_PATH = '~/db.sqlite';
|
|
120
|
+
expect(await getDatabasePath()).toBe(path.join(homedir(), 'db.sqlite'));
|
|
115
121
|
});
|
|
116
122
|
|
|
117
123
|
test('mock with no override stays cwd-relative workspace.db', async () => {
|
package/src/server/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Elysia } from 'elysia';
|
|
2
2
|
import pkg from '@/../package.json';
|
|
3
|
-
import
|
|
3
|
+
import { shellBundle } from '@/server/lib/lifecycle/shell-entry.server';
|
|
4
4
|
import { apiRoutes } from '@/server/routes';
|
|
5
5
|
import { initRealtimeTopics } from '@/server/lib/realtime/topics.server';
|
|
6
6
|
import { startSessionsWatch } from '@/server/lib/omp/session/sessions-watch.server';
|
|
@@ -105,13 +105,17 @@ if (!lock) {
|
|
|
105
105
|
process.exit(1);
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
// `serve.routes` is where the HTML shell lives
|
|
109
|
-
// routes into that same table (its Bun adapter passes
|
|
110
|
-
// `Bun.serve`), and Bun's table wins for the paths it
|
|
111
|
-
// renders the bundle while every other path falls
|
|
112
|
-
// WebSocket routes keep working: Elysia composes its
|
|
113
|
-
// alongside this object.
|
|
114
|
-
|
|
108
|
+
// `serve.routes` is where the HTML shell lives, in DEVELOPMENT only. Elysia
|
|
109
|
+
// merges its own static routes into that same table (its Bun adapter passes
|
|
110
|
+
// `serve` straight to `Bun.serve`), and Bun's table wins for the paths it
|
|
111
|
+
// declares — so `/_shell` renders the bundle while every other path falls
|
|
112
|
+
// through to `fetch`. The WebSocket routes keep working: Elysia composes its
|
|
113
|
+
// `websocket` handler alongside this object.
|
|
114
|
+
//
|
|
115
|
+
// Production has no HTML route: the client is built ahead of time and
|
|
116
|
+
// `renderShell` reads `dist/client/index.html`. See `shell-entry.server.ts` for
|
|
117
|
+
// why the import cannot be static.
|
|
118
|
+
const app = new Elysia({ serve: shellBundle ? { routes: { [SHELL_ROUTE]: shellBundle } } : {} })
|
|
115
119
|
.onBeforeHandle((context) => {
|
|
116
120
|
// The socket address is read INLINE, and that is not a style choice.
|
|
117
121
|
// Passing this Elysia context to a helper function — however simple, even
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The generated stylesheet as a served asset.
|
|
8
|
+
*
|
|
9
|
+
* The shell used to inline 182 KB of `<style>` into every `no-store` document.
|
|
10
|
+
* The contract that replaced it has three parts, and each one is a way the page
|
|
11
|
+
* breaks if it drifts:
|
|
12
|
+
*
|
|
13
|
+
* - the URL carries a content hash, so `immutable` can never serve stale bytes;
|
|
14
|
+
* - the body is the palette sheet FIRST and the icon paint second, the order
|
|
15
|
+
* the inline blocks had (the icon sheet declares Tailwind's layer order);
|
|
16
|
+
* - the route is reachable without a session, because the login screen is the
|
|
17
|
+
* shell and needs its own styling.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { describe, expect, test } from 'bun:test';
|
|
21
|
+
|
|
22
|
+
import { THEME_CSS_ROUTE, serveThemeCss } from '@/server/lib/assets/theme-css.server';
|
|
23
|
+
import { isPublicPath } from '@/server/lib/auth/guard';
|
|
24
|
+
import { iconPaintStyleSheet } from '@/shared/lib/icons/icon-paint-css';
|
|
25
|
+
import { themeStyleSheet } from '@/shared/lib/theme/css';
|
|
26
|
+
|
|
27
|
+
describe('THEME_CSS_ROUTE', () => {
|
|
28
|
+
test('is content-addressed', () => {
|
|
29
|
+
expect(THEME_CSS_ROUTE).toMatch(/^\/theme-[a-z0-9]+\.css$/);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test('is reachable before a credential exists', () => {
|
|
33
|
+
expect(isPublicPath(THEME_CSS_ROUTE)).toBe(true);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
describe('serveThemeCss', () => {
|
|
38
|
+
test('serves both sheets, palette first, as an immutable stylesheet', async () => {
|
|
39
|
+
const response = await serveThemeCss(new Request(`http://localhost${THEME_CSS_ROUTE}`));
|
|
40
|
+
expect(response.status).toBe(200);
|
|
41
|
+
expect(response.headers.get('content-type')).toBe('text/css; charset=utf-8');
|
|
42
|
+
expect(response.headers.get('cache-control')).toBe('public, max-age=31536000, immutable');
|
|
43
|
+
|
|
44
|
+
const body = await response.text();
|
|
45
|
+
expect(body).toContain(themeStyleSheet());
|
|
46
|
+
expect(body).toContain(iconPaintStyleSheet());
|
|
47
|
+
// The palette rules must be parsed before the icon sheet's `@layer` order.
|
|
48
|
+
expect(body.indexOf('--theme-paper')).toBeLessThan(body.indexOf('@layer theme, base, components, utilities;'));
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
test('compresses for a client that asks', async () => {
|
|
52
|
+
const response = await serveThemeCss(
|
|
53
|
+
new Request(`http://localhost${THEME_CSS_ROUTE}`, { headers: { 'accept-encoding': 'gzip' } }),
|
|
54
|
+
);
|
|
55
|
+
expect(response.headers.get('content-encoding')).toBeTruthy();
|
|
56
|
+
expect(response.headers.get('vary')).toContain('accept-encoding');
|
|
57
|
+
});
|
|
58
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The two generated stylesheets, served as one immutable asset.
|
|
8
|
+
*
|
|
9
|
+
* `themeStyleSheet` (68.9 KB) and `iconPaintStyleSheet` (113.2 KB) are built
|
|
10
|
+
* from TS tables, so the bundler cannot carry them — but they are FIXED for the
|
|
11
|
+
* life of a build, which is what makes them a cacheable file rather than 182 KB
|
|
12
|
+
* of inline `<style>` in every document. Measured before this module: a
|
|
13
|
+
* navigation carried 187,419 characters of HTML, 182,093 of them these two
|
|
14
|
+
* sheets, and the shell is `no-store`, so every navigation paid for them again.
|
|
15
|
+
*
|
|
16
|
+
* The URL carries a content hash and the response is `immutable`: a browser
|
|
17
|
+
* fetches it once per build and never asks again. The hash is computed from the
|
|
18
|
+
* bytes, so a palette or icon-table edit changes the URL and cannot be served
|
|
19
|
+
* from a stale cache.
|
|
20
|
+
*
|
|
21
|
+
* Order is load-bearing and matches the inline order it replaces: the palette
|
|
22
|
+
* rules first, then the icon paint. The icon sheet declares Tailwind's full
|
|
23
|
+
* `@layer` order, and it must be parsed before the bundled stylesheet — a
|
|
24
|
+
* `<link>` in `<head>` before the bundle's own link keeps that true.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
import { iconPaintStyleSheet } from '@/shared/lib/icons/icon-paint-css';
|
|
28
|
+
import { themeStyleSheet } from '@/shared/lib/theme/css';
|
|
29
|
+
import { maybeCompress } from '@/server/plugins/compress';
|
|
30
|
+
|
|
31
|
+
/** The bytes, built once. Both generators are already memoized. */
|
|
32
|
+
const BODY = `${themeStyleSheet()}\n${iconPaintStyleSheet()}\n`;
|
|
33
|
+
|
|
34
|
+
/** Content hash, so a changed sheet is a changed URL. */
|
|
35
|
+
const HASH = Bun.hash(BODY).toString(36);
|
|
36
|
+
|
|
37
|
+
/** Where the shell links this sheet. */
|
|
38
|
+
export const THEME_CSS_ROUTE = `/theme-${HASH}.css`;
|
|
39
|
+
|
|
40
|
+
const HEADERS = {
|
|
41
|
+
'content-type': 'text/css; charset=utf-8',
|
|
42
|
+
// Content-addressed: the URL changes with the bytes, so it can never be stale.
|
|
43
|
+
'cache-control': 'public, max-age=31536000, immutable',
|
|
44
|
+
} as const;
|
|
45
|
+
|
|
46
|
+
/** The sheet, compressed for the client that asked. */
|
|
47
|
+
export function serveThemeCss(request: Request): Promise<Response> {
|
|
48
|
+
return maybeCompress(
|
|
49
|
+
new Response(BODY, { headers: HEADERS }),
|
|
50
|
+
request.headers.get('accept-encoding'),
|
|
51
|
+
);
|
|
52
|
+
}
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
* - `/_shell` lives in `Bun.serve`'s own routing table rather than Elysia's, so
|
|
18
18
|
* no hook sees it. It is left reachable deliberately: it serves the page
|
|
19
19
|
* skeleton and, measured, carries no bootstrap payload — the settings map is
|
|
20
|
-
* injected by the SSR route, which is gated.
|
|
20
|
+
* injected by the SSR route, which is gated. The route exists in development
|
|
21
|
+
* only; production reads the built shell from disk.
|
|
21
22
|
* - Static assets are exempt by necessity: the login page is the app shell, so
|
|
22
23
|
* its bundle, stylesheet and fonts must load before any credential exists.
|
|
23
24
|
*
|
|
@@ -84,6 +85,10 @@ const PUBLIC_PREFIXES = [
|
|
|
84
85
|
'/icon-',
|
|
85
86
|
'/apple-touch-icon.',
|
|
86
87
|
'/apple-touch-icon-',
|
|
88
|
+
// The generated palette + icon-paint sheet, content-hashed (`/theme-<hash>.css`).
|
|
89
|
+
// It is the login screen's own styling, so it has to load before a credential
|
|
90
|
+
// exists — the same reason `/static/` is here.
|
|
91
|
+
'/theme-',
|
|
87
92
|
];
|
|
88
93
|
|
|
89
94
|
/** True when `pathname` is reachable without a session. */
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The engine probe behind the Browser Agent panel's notice.
|
|
8
|
+
*
|
|
9
|
+
* The panel can only mirror Chromium, so this answer decides whether it shows
|
|
10
|
+
* a live view or an explanation. The cases pin the two ways it could lie:
|
|
11
|
+
* claiming Chromium when omp will open WebKit (the panel then waits forever),
|
|
12
|
+
* and claiming WebKit when the engine is not installed (omp falls back to
|
|
13
|
+
* Chromium and the panel would refuse a view it can actually show).
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { describe, expect, test } from 'bun:test';
|
|
17
|
+
import { readBrowserEngineState, webkitHostCandidates } from '@/server/lib/browser/engine';
|
|
18
|
+
|
|
19
|
+
const HOME = '/home/tester';
|
|
20
|
+
const DEFAULT_HOST = `${HOME}/.o2/lib/abkit/ABHost`;
|
|
21
|
+
|
|
22
|
+
function deps(config: Record<string, unknown>, files: string[]) {
|
|
23
|
+
return {
|
|
24
|
+
readConfig: async (key: string) => config[key],
|
|
25
|
+
exists: async (file: string) => files.includes(file),
|
|
26
|
+
home: HOME,
|
|
27
|
+
platform: 'darwin' as const,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
describe('webkitHostCandidates', () => {
|
|
32
|
+
test('defaults to the ABKit host under the home directory', () => {
|
|
33
|
+
expect(webkitHostCandidates(undefined, HOME, 'darwin')).toEqual([DEFAULT_HOST]);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
test('a configured engine directory also offers the host inside it', () => {
|
|
37
|
+
expect(webkitHostCandidates('/opt/abkit', HOME, 'darwin')).toEqual([
|
|
38
|
+
'/opt/abkit',
|
|
39
|
+
'/opt/abkit/ABHost',
|
|
40
|
+
]);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test('a configured executable is offered as-is', () => {
|
|
44
|
+
expect(webkitHostCandidates('/opt/abkit/ABHost', HOME, 'darwin')).toEqual([
|
|
45
|
+
'/opt/abkit/ABHost',
|
|
46
|
+
'/opt/abkit/ABHost/ABHost',
|
|
47
|
+
]);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
test('windows names the host ABHost.exe', () => {
|
|
51
|
+
expect(webkitHostCandidates(undefined, 'C:\\Users\\t', 'win32')).toEqual([
|
|
52
|
+
'C:\\Users\\t\\.o2\\lib\\abkit\\ABHost.exe',
|
|
53
|
+
]);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test('~ expands against the given home, never the real one', () => {
|
|
57
|
+
expect(webkitHostCandidates('~/engines/abkit', HOME, 'darwin')).toEqual([
|
|
58
|
+
`${HOME}/engines/abkit`,
|
|
59
|
+
`${HOME}/engines/abkit/ABHost`,
|
|
60
|
+
]);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
test('~ expands with the TARGET platform separators, not the host’s', () => {
|
|
64
|
+
// Measured on the Windows gate: the expansion used the host's `path.join`,
|
|
65
|
+
// so a `darwin` request answered `\home\tester\engines\abkit` — a path that
|
|
66
|
+
// exists on no Mac. The assertion is host-independent precisely because the
|
|
67
|
+
// function takes the platform it is answering for.
|
|
68
|
+
expect(webkitHostCandidates('~/engines/abkit', HOME, 'darwin')[0]).toBe('/home/tester/engines/abkit');
|
|
69
|
+
expect(webkitHostCandidates('~/engines/abkit', 'C:\\Users\\t', 'win32')).toEqual([
|
|
70
|
+
'C:\\Users\\t\\engines\\abkit',
|
|
71
|
+
'C:\\Users\\t\\engines\\abkit\\ABHost.exe',
|
|
72
|
+
]);
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
describe('readBrowserEngineState', () => {
|
|
77
|
+
test('WebKit is the default when the engine is installed', async () => {
|
|
78
|
+
expect(await readBrowserEngineState(deps({}, [DEFAULT_HOST]))).toEqual({
|
|
79
|
+
webkit: true,
|
|
80
|
+
engineInstalled: true,
|
|
81
|
+
effective: 'webkit',
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
test('browser.webkit false selects Chromium even with the engine installed', async () => {
|
|
86
|
+
const state = await readBrowserEngineState(
|
|
87
|
+
deps({ 'browser.webkit': false }, [DEFAULT_HOST]),
|
|
88
|
+
);
|
|
89
|
+
expect(state).toEqual({ webkit: false, engineInstalled: true, effective: 'chromium' });
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
test('a missing engine falls back to Chromium', async () => {
|
|
93
|
+
expect(await readBrowserEngineState(deps({}, []))).toEqual({
|
|
94
|
+
webkit: true,
|
|
95
|
+
engineInstalled: false,
|
|
96
|
+
effective: 'chromium',
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
test('a configured engine directory is honoured', async () => {
|
|
101
|
+
const state = await readBrowserEngineState(
|
|
102
|
+
deps({ 'browser.webkitPath': '/opt/abkit' }, ['/opt/abkit/ABHost']),
|
|
103
|
+
);
|
|
104
|
+
expect(state.effective).toBe('webkit');
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
test('a config read failure keeps the documented default instead of promising Chromium', async () => {
|
|
108
|
+
const state = await readBrowserEngineState({
|
|
109
|
+
readConfig: async () => {
|
|
110
|
+
throw new Error('omp binary not found');
|
|
111
|
+
},
|
|
112
|
+
exists: async () => true,
|
|
113
|
+
home: HOME,
|
|
114
|
+
platform: 'darwin',
|
|
115
|
+
});
|
|
116
|
+
expect(state).toEqual({ webkit: true, engineInstalled: true, effective: 'webkit' });
|
|
117
|
+
});
|
|
118
|
+
});
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Which browser engine the session's omp agent will use, and whether the
|
|
8
|
+
* Browser Agent panel can mirror it.
|
|
9
|
+
*
|
|
10
|
+
* omp opens tabs in its own WebKit engine (ABKit) by default when that engine
|
|
11
|
+
* is installed, and only falls back to the managed Chromium daemon otherwise.
|
|
12
|
+
* The panel mirrors Chromium over CDP; WebKit has no CDP endpoint and no frame
|
|
13
|
+
* stream, so a WebKit session is invisible to it. This module answers the one
|
|
14
|
+
* question the panel needs before it can explain that: is the next open going
|
|
15
|
+
* to be WebKit?
|
|
16
|
+
*
|
|
17
|
+
* The answer is read from omp's own config (`browser.webkit`, default `true`)
|
|
18
|
+
* plus the presence of the host executable, because a setting that names an
|
|
19
|
+
* engine which is not installed does not select it — omp falls back to
|
|
20
|
+
* Chromium and the panel works.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import { homedir } from 'node:os';
|
|
24
|
+
import * as path from 'node:path';
|
|
25
|
+
import { getOmpConfigValue } from '@/server/lib/omp/config/config-cli';
|
|
26
|
+
import type { BrowserEngineState } from '@/shared/types';
|
|
27
|
+
|
|
28
|
+
/** Where omp installs ABKit when `browser.webkitPath` is unset. */
|
|
29
|
+
const DEFAULT_ENGINE_DIR = ['.o2', 'lib', 'abkit'] as const;
|
|
30
|
+
|
|
31
|
+
export interface BrowserEngineDeps {
|
|
32
|
+
/** Read one omp config key; defaults to the real `omp config get`. */
|
|
33
|
+
readConfig?: (key: string) => Promise<unknown>;
|
|
34
|
+
/** Whether a file exists; defaults to `Bun.file(...).exists()`. */
|
|
35
|
+
exists?: (file: string) => Promise<boolean>;
|
|
36
|
+
home?: string;
|
|
37
|
+
platform?: NodeJS.Platform;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* `~` and `~/…` against the given home, so a test never reads the real one.
|
|
42
|
+
*
|
|
43
|
+
* Joined with the TARGET platform's rules, not the host's: this module answers
|
|
44
|
+
* for the machine the browser runs on, and the Windows gate caught the host
|
|
45
|
+
* version of it — `path.join` turned a POSIX `~/engines/abkit` into
|
|
46
|
+
* `\home\tester\engines\abkit` while the caller had asked for `darwin`.
|
|
47
|
+
*/
|
|
48
|
+
function expandHome(value: string, home: string, platform: NodeJS.Platform): string {
|
|
49
|
+
if (value === '~') return home;
|
|
50
|
+
if (!value.startsWith('~/') && !value.startsWith('~\\')) return value;
|
|
51
|
+
const join = platform === 'win32' ? path.win32.join : path.posix.join;
|
|
52
|
+
return join(home, value.slice(2));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The paths that could hold the ABKit host.
|
|
57
|
+
*
|
|
58
|
+
* `browser.webkitPath` names either the host executable or an ABKit engine
|
|
59
|
+
* directory that holds it as `ABHost` (`ABHost.exe` on Windows), so both
|
|
60
|
+
* readings are offered and the caller accepts the first that exists.
|
|
61
|
+
*/
|
|
62
|
+
export function webkitHostCandidates(
|
|
63
|
+
configured: unknown,
|
|
64
|
+
home: string,
|
|
65
|
+
platform: NodeJS.Platform,
|
|
66
|
+
): string[] {
|
|
67
|
+
const join = platform === 'win32' ? path.win32.join : path.posix.join;
|
|
68
|
+
const exe = platform === 'win32' ? 'ABHost.exe' : 'ABHost';
|
|
69
|
+
if (typeof configured === 'string' && configured.trim()) {
|
|
70
|
+
const expanded = expandHome(configured.trim(), home, platform);
|
|
71
|
+
return [expanded, join(expanded, exe)];
|
|
72
|
+
}
|
|
73
|
+
return [join(home, ...DEFAULT_ENGINE_DIR, exe)];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The engine the next `browser.open` will use.
|
|
78
|
+
*
|
|
79
|
+
* A config read that fails is NOT treated as "Chromium": the panel would then
|
|
80
|
+
* promise a mirror it cannot deliver. It keeps the documented default (WebKit
|
|
81
|
+
* on) and lets the install check decide.
|
|
82
|
+
*/
|
|
83
|
+
export async function readBrowserEngineState(
|
|
84
|
+
deps: BrowserEngineDeps = {},
|
|
85
|
+
): Promise<BrowserEngineState> {
|
|
86
|
+
const readConfig = deps.readConfig ?? getOmpConfigValue;
|
|
87
|
+
const exists = deps.exists ?? ((file: string) => Bun.file(file).exists());
|
|
88
|
+
const home = deps.home ?? homedir();
|
|
89
|
+
const platform = deps.platform ?? process.platform;
|
|
90
|
+
|
|
91
|
+
const [webkitValue, pathValue] = await Promise.all([
|
|
92
|
+
readConfig('browser.webkit').catch(() => undefined),
|
|
93
|
+
readConfig('browser.webkitPath').catch(() => undefined),
|
|
94
|
+
]);
|
|
95
|
+
const webkit = webkitValue !== false;
|
|
96
|
+
const candidates = webkitHostCandidates(pathValue, home, platform);
|
|
97
|
+
const installed = (
|
|
98
|
+
await Promise.all(candidates.map((file) => exists(file).catch(() => false)))
|
|
99
|
+
).some(Boolean);
|
|
100
|
+
|
|
101
|
+
return { webkit, engineInstalled: installed, effective: webkit && installed ? 'webkit' : 'chromium' };
|
|
102
|
+
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { afterAll, afterEach, beforeEach, describe, expect, test } from 'bun:test';
|
|
7
7
|
import fs from 'fs';
|
|
8
|
-
import {
|
|
8
|
+
import { tmpdir } from 'os';
|
|
9
9
|
import { join } from 'path';
|
|
10
10
|
|
|
11
11
|
import { findProjectRuntimeDir, isTcpPortLive } from '@/server/lib/browser/runtime';
|
|
@@ -13,8 +13,13 @@ import { findProjectRuntimeDir, isTcpPortLive } from '@/server/lib/browser/runti
|
|
|
13
13
|
const tempRoots: string[] = [];
|
|
14
14
|
const savedEnv: Record<string, string | undefined> = {};
|
|
15
15
|
|
|
16
|
+
/** The daemon tree the scan reads: `$XDG_STATE_HOME/omp/run/daemons`. */
|
|
17
|
+
function runtimeRoot(): string {
|
|
18
|
+
return join(Bun.env.XDG_STATE_HOME!, 'omp', 'run', 'daemons');
|
|
19
|
+
}
|
|
20
|
+
|
|
16
21
|
async function makeRuntimeDir(name: string): Promise<string> {
|
|
17
|
-
const dir = join(
|
|
22
|
+
const dir = join(runtimeRoot(), name);
|
|
18
23
|
await fs.promises.mkdir(join(dir, 'omp.browser.headless.profile'), { recursive: true });
|
|
19
24
|
await Bun.write(join(dir, 'scope.json'), JSON.stringify({ projectDir: '/tmp/fake-project' }));
|
|
20
25
|
return dir;
|
|
@@ -25,17 +30,21 @@ async function writeDevToolsActivePort(runtimeDir: string, port: number, wsPath:
|
|
|
25
30
|
}
|
|
26
31
|
|
|
27
32
|
beforeEach(async () => {
|
|
28
|
-
// getConfigRoot()
|
|
29
|
-
// snapshotted at process start — a runtime HOME change is invisible
|
|
30
|
-
//
|
|
31
|
-
//
|
|
33
|
+
// `getConfigRoot()` is `homedir()/PI_CONFIG_DIR`, and `os.homedir()` is
|
|
34
|
+
// snapshotted at process start — a runtime `HOME` change is invisible, so the
|
|
35
|
+
// config root cannot be moved out of the developer's real home. Point
|
|
36
|
+
// `PI_CONFIG_DIR` at a name that does not exist (the scan skips a missing
|
|
37
|
+
// root) and put the daemon tree under a temp `XDG_STATE_HOME` instead: the
|
|
38
|
+
// suite then writes nothing into `$HOME`. A uniquely named config dir inside
|
|
39
|
+
// the real home was the previous isolation, and it left a directory behind
|
|
40
|
+
// whenever the run died before `afterAll`.
|
|
32
41
|
savedEnv.PI_CONFIG_DIR = Bun.env.PI_CONFIG_DIR;
|
|
33
42
|
savedEnv.XDG_STATE_HOME = Bun.env.XDG_STATE_HOME;
|
|
34
|
-
const
|
|
35
|
-
tempRoots.push(
|
|
36
|
-
|
|
37
|
-
Bun.env.
|
|
38
|
-
|
|
43
|
+
const stateRoot = fs.mkdtempSync(join(tmpdir(), 'kabmo-browser-runtime-'));
|
|
44
|
+
tempRoots.push(stateRoot);
|
|
45
|
+
Bun.env.PI_CONFIG_DIR = `.omp-browser-test-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
46
|
+
Bun.env.XDG_STATE_HOME = stateRoot;
|
|
47
|
+
await fs.promises.mkdir(runtimeRoot(), { recursive: true });
|
|
39
48
|
});
|
|
40
49
|
|
|
41
50
|
afterEach(() => {
|
|
@@ -97,11 +106,7 @@ describe('findProjectRuntimeDir', () => {
|
|
|
97
106
|
await makeRuntimeDir('other');
|
|
98
107
|
const server = Bun.listen({ hostname: '127.0.0.1', port: 0, socket: { data() {}, close() {}, error() {} } });
|
|
99
108
|
try {
|
|
100
|
-
await writeDevToolsActivePort(
|
|
101
|
-
join(homedir(), Bun.env.PI_CONFIG_DIR!, 'run', 'daemons', 'other'),
|
|
102
|
-
server.port,
|
|
103
|
-
'/devtools/browser/other',
|
|
104
|
-
);
|
|
109
|
+
await writeDevToolsActivePort(join(runtimeRoot(), 'other'), server.port, '/devtools/browser/other');
|
|
105
110
|
expect(await findProjectRuntimeDir('/tmp/never-registered')).toBeNull();
|
|
106
111
|
} finally {
|
|
107
112
|
server.stop(true);
|