@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,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The database client's two performance contracts.
|
|
8
|
+
*
|
|
9
|
+
* Both are invisible in a functional test and expensive in production:
|
|
10
|
+
*
|
|
11
|
+
* - `synchronous = NORMAL` is what makes a single-row write 8 µs instead of
|
|
12
|
+
* 79 µs (measured on this machine). A regression to SQLite's default is a
|
|
13
|
+
* 10x write cost with no failing behaviour to notice it.
|
|
14
|
+
* - `writeMany` is the only batched writer. A loop of `run()` calls is correct
|
|
15
|
+
* and 395x slower, so the batching itself is what is asserted.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { afterEach, describe, expect, test } from 'bun:test';
|
|
19
|
+
import { mkdtempSync, rmSync } from 'node:fs';
|
|
20
|
+
import { tmpdir } from 'node:os';
|
|
21
|
+
import { join } from 'node:path';
|
|
22
|
+
|
|
23
|
+
import { createDb, type DbClient } from '@/server/lib/db/client';
|
|
24
|
+
|
|
25
|
+
const opened: DbClient[] = [];
|
|
26
|
+
const dirs: string[] = [];
|
|
27
|
+
|
|
28
|
+
function open(): DbClient {
|
|
29
|
+
const dir = mkdtempSync(join(tmpdir(), 'kabmo-db-client-'));
|
|
30
|
+
dirs.push(dir);
|
|
31
|
+
const db = createDb(join(dir, 'test.sqlite'));
|
|
32
|
+
opened.push(db);
|
|
33
|
+
db.raw.exec('CREATE TABLE t (id INTEGER PRIMARY KEY, value TEXT)');
|
|
34
|
+
return db;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
afterEach(() => {
|
|
38
|
+
for (const db of opened.splice(0)) db.raw.close();
|
|
39
|
+
for (const dir of dirs.splice(0)) rmSync(dir, { recursive: true, force: true });
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
describe('createDb', () => {
|
|
43
|
+
test('pairs WAL with synchronous=NORMAL', () => {
|
|
44
|
+
const db = open();
|
|
45
|
+
const journal = db.raw.query('PRAGMA journal_mode').get() as { journal_mode: string };
|
|
46
|
+
const sync = db.raw.query('PRAGMA synchronous').get() as { synchronous: number };
|
|
47
|
+
expect(journal.journal_mode).toBe('wal');
|
|
48
|
+
// 1 = NORMAL. 2 (FULL) is SQLite's default and fsyncs every commit.
|
|
49
|
+
expect(sync.synchronous).toBe(1);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
describe('writeMany', () => {
|
|
54
|
+
test('writes every row and reports the count', async () => {
|
|
55
|
+
const db = open();
|
|
56
|
+
const written = await db.writeMany('INSERT INTO t (value) VALUES (?)', [['a'], ['b'], ['c']]);
|
|
57
|
+
expect(written).toBe(3);
|
|
58
|
+
const rows = await db.all<{ value: string }>('SELECT value FROM t ORDER BY id');
|
|
59
|
+
expect(rows.map((row) => row.value)).toEqual(['a', 'b', 'c']);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
test('chunks the work without losing or reordering a row', async () => {
|
|
63
|
+
const db = open();
|
|
64
|
+
const params = Array.from({ length: 7 }, (_, index) => [`v${index}`]);
|
|
65
|
+
// Chunk size 2 over 7 rows: four transactions, same result.
|
|
66
|
+
expect(await db.writeMany('INSERT INTO t (value) VALUES (?)', params, 2)).toBe(7);
|
|
67
|
+
const rows = await db.all<{ value: string }>('SELECT value FROM t ORDER BY id');
|
|
68
|
+
expect(rows.map((row) => row.value)).toEqual(params.map(([value]) => value));
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
test('an empty list is a no-op, not an empty transaction', async () => {
|
|
72
|
+
const db = open();
|
|
73
|
+
expect(await db.writeMany('INSERT INTO t (value) VALUES (?)', [])).toBe(0);
|
|
74
|
+
const count = await db.get<{ n: number }>('SELECT COUNT(*) AS n FROM t');
|
|
75
|
+
expect(count?.n).toBe(0);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
test('a failing row rolls back its own chunk and keeps the earlier ones', async () => {
|
|
79
|
+
const db = open();
|
|
80
|
+
await db.run('INSERT INTO t (id, value) VALUES (?, ?)', [1, 'first']);
|
|
81
|
+
// The second chunk repeats id 1, which the primary key refuses.
|
|
82
|
+
await expect(
|
|
83
|
+
db.writeMany('INSERT INTO t (id, value) VALUES (?, ?)', [[2, 'ok'], [1, 'duplicate']], 1),
|
|
84
|
+
).rejects.toThrow();
|
|
85
|
+
const rows = await db.all<{ id: number }>('SELECT id FROM t ORDER BY id');
|
|
86
|
+
// Chunk 1 (id 2) committed; the failing chunk (id 1) did not.
|
|
87
|
+
expect(rows.map((row) => row.id)).toEqual([1, 2]);
|
|
88
|
+
});
|
|
89
|
+
});
|
|
@@ -10,6 +10,17 @@ export interface DbClient {
|
|
|
10
10
|
get<T = any>(sql: string, params?: any[]): Promise<T | undefined>;
|
|
11
11
|
all<T = any>(sql: string, params?: any[]): Promise<T[]>;
|
|
12
12
|
run(sql: string, params?: any[]): Promise<{ changes: number; lastID: number }>;
|
|
13
|
+
/**
|
|
14
|
+
* Run one statement for every parameter row, in transactions of `chunkSize`.
|
|
15
|
+
*
|
|
16
|
+
* Autocommit costs an fsync per statement: measured on this machine, 8 µs per
|
|
17
|
+
* INSERT at `synchronous=NORMAL` against 0.20 µs inside a transaction — a 40x
|
|
18
|
+
* difference that a loop of single-row writes pays in full. Chunking
|
|
19
|
+
* rather than one transaction keeps the event-loop block bounded, because
|
|
20
|
+
* `bun:sqlite` is synchronous and a 173 MB rewrite in one transaction would
|
|
21
|
+
* freeze every request, stream and terminal frame for its whole duration.
|
|
22
|
+
*/
|
|
23
|
+
writeMany(sql: string, paramsList: readonly any[][], chunkSize?: number): Promise<number>;
|
|
13
24
|
exec(sql: string): Promise<void>;
|
|
14
25
|
raw: Database;
|
|
15
26
|
}
|
|
@@ -42,6 +53,13 @@ export function createDb(path: string): DbClient {
|
|
|
42
53
|
raw.exec('PRAGMA journal_mode = WAL');
|
|
43
54
|
raw.exec('PRAGMA foreign_keys = ON');
|
|
44
55
|
raw.exec(`PRAGMA busy_timeout = ${BUSY_TIMEOUT_MS}`);
|
|
56
|
+
// WAL's documented pairing. `bun:sqlite` leaves SQLite's default at FULL,
|
|
57
|
+
// which fsyncs on every commit: measured here, 79 µs per single-row INSERT
|
|
58
|
+
// against 8 µs at NORMAL (12.6k/s -> 124k/s). NORMAL in WAL cannot corrupt
|
|
59
|
+
// the database; the exposure is losing the last commits if the OPERATING
|
|
60
|
+
// SYSTEM crashes, not if this process does — and every write here is UI
|
|
61
|
+
// state that a restart re-reads from omp's own files.
|
|
62
|
+
raw.exec('PRAGMA synchronous = NORMAL');
|
|
45
63
|
|
|
46
64
|
const stmts = new Map<string, ReturnType<Database['query']>>();
|
|
47
65
|
const prep = (sql: string) => {
|
|
@@ -68,6 +86,19 @@ export function createDb(path: string): DbClient {
|
|
|
68
86
|
const result = prep(sql).run(...(params as never[]));
|
|
69
87
|
return { changes: result.changes, lastID: Number(result.lastInsertRowid) };
|
|
70
88
|
},
|
|
89
|
+
async writeMany(sql: string, paramsList: readonly any[][], chunkSize = 200) {
|
|
90
|
+
if (paramsList.length === 0) return 0;
|
|
91
|
+
const stmt = prep(sql);
|
|
92
|
+
const apply = raw.transaction((rows: readonly any[][]) => {
|
|
93
|
+
for (const params of rows) stmt.run(...(params as never[]));
|
|
94
|
+
return rows.length;
|
|
95
|
+
});
|
|
96
|
+
let written = 0;
|
|
97
|
+
for (let start = 0; start < paramsList.length; start += chunkSize) {
|
|
98
|
+
written += apply(paramsList.slice(start, start + chunkSize));
|
|
99
|
+
}
|
|
100
|
+
return written;
|
|
101
|
+
},
|
|
71
102
|
async exec(sql: string) {
|
|
72
103
|
raw.exec(sql);
|
|
73
104
|
},
|
|
@@ -57,6 +57,10 @@ export async function compactChatOverlayRows(db: DbClient, sessionsRoot?: string
|
|
|
57
57
|
|
|
58
58
|
let compacted = 0;
|
|
59
59
|
let reclaimed = 0;
|
|
60
|
+
// Collected, then written in transactions: one autocommit UPDATE per row
|
|
61
|
+
// costs an fsync each (8 µs measured at `synchronous=NORMAL`), and this pass
|
|
62
|
+
// rewrites thousands of rows on a first run.
|
|
63
|
+
const updates: [string, string][] = [];
|
|
60
64
|
for (const row of rows) {
|
|
61
65
|
let parsed: unknown;
|
|
62
66
|
try {
|
|
@@ -74,11 +78,13 @@ export async function compactChatOverlayRows(db: DbClient, sessionsRoot?: string
|
|
|
74
78
|
if (!(await findSessionFileById(row.session_id, sessionsRoot))) continue;
|
|
75
79
|
|
|
76
80
|
const next = JSON.stringify(reduced);
|
|
77
|
-
|
|
81
|
+
updates.push([next, row.session_id]);
|
|
78
82
|
compacted += 1;
|
|
79
83
|
reclaimed += row.messages.length - next.length;
|
|
80
84
|
}
|
|
81
85
|
|
|
86
|
+
await db.writeMany('UPDATE chat_sessions SET messages = ? WHERE session_id = ?', updates);
|
|
87
|
+
|
|
82
88
|
if (compacted > 0) {
|
|
83
89
|
console.log(
|
|
84
90
|
`[chat-overlay] compacted ${compacted} mirrored session row(s), reclaimed ${(reclaimed / 1e6).toFixed(1)} MB`,
|
|
@@ -25,6 +25,8 @@ import { ensureReviewSchema } from '@/server/lib/review/schema.server';
|
|
|
25
25
|
import { ensureHarnessSchema } from '@/server/lib/harness/schema.server';
|
|
26
26
|
import { ensureSessionRelationsSchema } from '@/server/lib/sessions/schema.server';
|
|
27
27
|
import { ensurePromptHistorySchema } from '@/server/lib/chat/schema.server';
|
|
28
|
+
import { ensureSessionMcpSchema } from '@/server/lib/mcp/schema.server';
|
|
29
|
+
import { ensureNotificationSchema } from '@/server/lib/notifications/schema.server';
|
|
28
30
|
import { migrateWorkspaceFolderColumns } from '@/shared/lib/workspace/schema-migrations';
|
|
29
31
|
import { migrateSessionStreamStateColumns } from '@/shared/lib/omp/session/schema-migrations';
|
|
30
32
|
|
|
@@ -149,6 +151,12 @@ export async function initSchema(db: DbClient): Promise<void> {
|
|
|
149
151
|
await ensureSessionRelationsSchema(db);
|
|
150
152
|
// The composer's ArrowUp recall: one row per prompt the operator sent.
|
|
151
153
|
await ensurePromptHistorySchema(db);
|
|
154
|
+
// Per-session MCP enablement: read by the spawn path, so it cannot live in
|
|
155
|
+
// the client-owned `session_ui_state` blob.
|
|
156
|
+
await ensureSessionMcpSchema(db);
|
|
157
|
+
// The system-notification outbox: written by the run settles, read by a page
|
|
158
|
+
// over the realtime socket and by the Android watcher over SSE.
|
|
159
|
+
await ensureNotificationSchema(db);
|
|
152
160
|
await db.exec(`
|
|
153
161
|
CREATE TABLE IF NOT EXISTS files (
|
|
154
162
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
@@ -123,7 +123,10 @@ async function syncWorkspaceFoldersWithOmp(db: DbClient): Promise<boolean> {
|
|
|
123
123
|
const usedNames = new Set<string>();
|
|
124
124
|
const deletedPaths = new Set(tombstoned.map((r) => projectPathKey(r.project_path as string)));
|
|
125
125
|
|
|
126
|
-
|
|
126
|
+
// Collected, then written in one transaction: the loop used to autocommit an
|
|
127
|
+
// INSERT per project, which is an fsync each (8 µs measured at
|
|
128
|
+
// `synchronous=NORMAL`).
|
|
129
|
+
const rows: [string, string][] = [];
|
|
127
130
|
for (const project of orderedOmpProjects(data)) {
|
|
128
131
|
if (deletedPaths.has(projectPathKey(project.path))) continue;
|
|
129
132
|
|
|
@@ -134,11 +137,8 @@ async function syncWorkspaceFoldersWithOmp(db: DbClient): Promise<boolean> {
|
|
|
134
137
|
candidate = `${name}-${suffix++}`;
|
|
135
138
|
}
|
|
136
139
|
usedNames.add(candidate);
|
|
137
|
-
|
|
138
|
-
'INSERT INTO workspace_folders (name, is_expanded, project_path) VALUES (?, 1, ?)',
|
|
139
|
-
[candidate, project.path],
|
|
140
|
-
);
|
|
141
|
-
inserted = true;
|
|
140
|
+
rows.push([candidate, project.path]);
|
|
142
141
|
}
|
|
143
|
-
|
|
142
|
+
await db.writeMany('INSERT INTO workspace_folders (name, is_expanded, project_path) VALUES (?, 1, ?)', rows);
|
|
143
|
+
return rows.length > 0;
|
|
144
144
|
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The lookup a login-entry launch needs.
|
|
8
|
+
*
|
|
9
|
+
* The bug this pins: launchd starts the server with
|
|
10
|
+
* `/usr/bin:/bin:/usr/sbin:/sbin` (measured — the `dev.kabmo.tray` plist carries
|
|
11
|
+
* no `EnvironmentVariables`), so `Bun.which('npx')` answered null while
|
|
12
|
+
* `/opt/homebrew/bin/npx` was installed. Every `npx`-launched harness read "not
|
|
13
|
+
* installed" on the first boot after login and `ready` after a terminal start.
|
|
14
|
+
*
|
|
15
|
+
* The cases below hand in the environment rather than mutating `Bun.env`, so the
|
|
16
|
+
* suite measures the repair itself and not the runner's PATH.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { afterAll, describe, expect, test } from 'bun:test';
|
|
20
|
+
import fs from 'node:fs';
|
|
21
|
+
import os from 'node:os';
|
|
22
|
+
import { join } from 'node:path';
|
|
23
|
+
|
|
24
|
+
import { toolchainPath, whichOnToolchainPath } from '@/server/lib/fs/toolchain-path';
|
|
25
|
+
|
|
26
|
+
const home = fs.mkdtempSync(join(os.tmpdir(), 'kabmo-toolchain-'));
|
|
27
|
+
const bunBin = join(home, '.bun', 'bin');
|
|
28
|
+
fs.mkdirSync(bunBin, { recursive: true });
|
|
29
|
+
const fakeTool = join(bunBin, 'kabmo-fake-tool');
|
|
30
|
+
fs.writeFileSync(fakeTool, '#!/bin/sh\nexit 0\n', { mode: 0o755 });
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* A POSIX home for the string-shape cases.
|
|
34
|
+
*
|
|
35
|
+
* They ask for a `linux` PATH, so the home they hand in has to be a POSIX one:
|
|
36
|
+
* `os.tmpdir()` is `C:\Users\…` on the Windows gate, and comparing the answer
|
|
37
|
+
* against a host-joined expectation there measured the runner's separators
|
|
38
|
+
* rather than the repair.
|
|
39
|
+
*/
|
|
40
|
+
const POSIX_HOME = '/home/tester';
|
|
41
|
+
|
|
42
|
+
afterAll(() => {
|
|
43
|
+
fs.rmSync(home, { recursive: true, force: true });
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
describe('toolchainPath', () => {
|
|
47
|
+
test('keeps the inherited order and appends what a GUI launch never had', () => {
|
|
48
|
+
const path = toolchainPath({ PATH: '/usr/bin:/bin', HOME: POSIX_HOME }, 'linux');
|
|
49
|
+
const entries = path.split(':');
|
|
50
|
+
expect(entries.slice(0, 2)).toEqual(['/usr/bin', '/bin']);
|
|
51
|
+
expect(entries).toContain('/home/tester/.bun/bin');
|
|
52
|
+
expect(entries).toContain('/opt/homebrew/bin');
|
|
53
|
+
expect(entries).toContain('/usr/local/bin');
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test('does not append an entry the inherited PATH already names', () => {
|
|
57
|
+
const path = toolchainPath({ PATH: '/opt/homebrew/bin:/usr/bin', HOME: POSIX_HOME }, 'linux');
|
|
58
|
+
expect(path.split(':').filter((entry) => entry === '/opt/homebrew/bin')).toHaveLength(1);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
test('a missing PATH becomes the fallback list, not an empty search path', () => {
|
|
62
|
+
const path = toolchainPath({ HOME: POSIX_HOME }, 'linux');
|
|
63
|
+
expect(path.split(':')).toContain('/home/tester/.bun/bin');
|
|
64
|
+
expect(path.split(':')).toContain('/usr/bin');
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
test('Windows is left alone: a GUI launch there inherits the user environment', () => {
|
|
68
|
+
expect(toolchainPath({ PATH: 'C:\\Windows\\system32' }, 'win32')).toBe('C:\\Windows\\system32');
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
describe('whichOnToolchainPath', () => {
|
|
73
|
+
test.skipIf(process.platform === 'win32')(
|
|
74
|
+
'finds a binary that only exists in a toolchain directory',
|
|
75
|
+
() => {
|
|
76
|
+
// The launchd shape: the inherited PATH cannot see `~/.bun/bin`.
|
|
77
|
+
const env = { PATH: '/usr/bin:/bin', HOME: home };
|
|
78
|
+
expect(Bun.which('kabmo-fake-tool', { PATH: env.PATH })).toBeNull();
|
|
79
|
+
expect(whichOnToolchainPath('kabmo-fake-tool', env, 'linux')).toBe(fakeTool);
|
|
80
|
+
},
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
test('a binary nowhere the user shell would look is still null', () => {
|
|
84
|
+
expect(whichOnToolchainPath('kabmo-definitely-missing-xyz', { PATH: '/usr/bin:/bin', HOME: home }, 'linux'))
|
|
85
|
+
.toBeNull();
|
|
86
|
+
});
|
|
87
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Looking a binary up the way a SPAWN will find it.
|
|
8
|
+
*
|
|
9
|
+
* A login-entry launch hands the server a minimal PATH. Measured on this
|
|
10
|
+
* machine: `~/Library/LaunchAgents/dev.kabmo.tray.plist` carries no
|
|
11
|
+
* `EnvironmentVariables`, so launchd's default `/usr/bin:/bin:/usr/sbin:/sbin`
|
|
12
|
+
* is what the server searched — `Bun.which('npx')` answered null while
|
|
13
|
+
* `/opt/homebrew/bin/npx` and `~/.bun/bin/omp` were installed. Every harness
|
|
14
|
+
* whose launch line starts with `npx` therefore read "not installed" on the
|
|
15
|
+
* first boot after login, and the same build answered `ready` when Kabmo was
|
|
16
|
+
* started from a terminal (which inherits the shell's PATH). A restart spawned
|
|
17
|
+
* BY that server inherited the same minimal PATH, so it did not repair it.
|
|
18
|
+
*
|
|
19
|
+
* The spawn side already repairs this (`withToolchainPath`, used by the ACP
|
|
20
|
+
* stdio transport), which is why "not installed" and "runs fine" could both be
|
|
21
|
+
* true. This is the same repair for the RESOLUTION side, so a lookup here
|
|
22
|
+
* answers what `Bun.which` answers in the user's own shell.
|
|
23
|
+
*
|
|
24
|
+
* `env`/`platform` are parameters for the reason `childEnv` takes them: the
|
|
25
|
+
* repair is only testable if a suite can hand in a PATH that lacks the
|
|
26
|
+
* toolchain directories.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
import { withToolchainPath } from '@kabmo-labs/kabmo-sdk';
|
|
30
|
+
|
|
31
|
+
/** The PATH a lookup (and a child) should search: the inherited one, repaired. */
|
|
32
|
+
export function toolchainPath(
|
|
33
|
+
env: Record<string, string | undefined> = Bun.env,
|
|
34
|
+
platform: string = process.platform,
|
|
35
|
+
): string {
|
|
36
|
+
return withToolchainPath(env, platform).PATH ?? '';
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* `Bun.which` over the repaired PATH. Null when the binary is nowhere the
|
|
41
|
+
* user's shell would look either.
|
|
42
|
+
*/
|
|
43
|
+
export function whichOnToolchainPath(
|
|
44
|
+
binary: string,
|
|
45
|
+
env: Record<string, string | undefined> = Bun.env,
|
|
46
|
+
platform: string = process.platform,
|
|
47
|
+
): string | null {
|
|
48
|
+
return Bun.which(binary, { PATH: toolchainPath(env, platform) });
|
|
49
|
+
}
|
|
@@ -159,7 +159,15 @@ export interface AcpMcpServerHttp {
|
|
|
159
159
|
headers: Array<{ name: string; value: string }>;
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
|
|
162
|
+
/** Legacy SSE transport; ACP carries it as its own typed variant. */
|
|
163
|
+
export interface AcpMcpServerSse {
|
|
164
|
+
type: 'sse';
|
|
165
|
+
name: string;
|
|
166
|
+
url: string;
|
|
167
|
+
headers: Array<{ name: string; value: string }>;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export type AcpMcpServer = AcpMcpServerStdio | AcpMcpServerHttp | AcpMcpServerSse;
|
|
163
171
|
|
|
164
172
|
export interface AcpSessionNewResult {
|
|
165
173
|
sessionId: string;
|
|
@@ -19,6 +19,7 @@ import type { AcpId } from '@/server/lib/harness/acp/protocol';
|
|
|
19
19
|
import type { PendingPermissions } from '@/server/lib/harness/acp/permissions';
|
|
20
20
|
import type { ApprovalMode } from '@/shared/lib/omp/config/access-mode';
|
|
21
21
|
import { allowOption, autoApproval, type PermissionOption } from '@/server/lib/harness/acp/permissions';
|
|
22
|
+
import { noteAwaitingInput } from '@/server/lib/notifications/feed.server';
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* The option id to select when the tier already allows this call, or null to
|
|
@@ -104,6 +105,9 @@ export function answerPermissionRequest(
|
|
|
104
105
|
}
|
|
105
106
|
const dialog = host.permissions.add(id, String(params.sessionId ?? host.sessionId), params);
|
|
106
107
|
host.emit(dialog as unknown as AgentEvent);
|
|
108
|
+
// The agent is now blocked on the operator. Announced from the SERVER so the
|
|
109
|
+
// banner arrives even when no page is open to see the dialog.
|
|
110
|
+
void noteAwaitingInput(host.sessionId);
|
|
107
111
|
// Answered LATER; the transport must not send a refusal now or the agent
|
|
108
112
|
// sees two answers to one request.
|
|
109
113
|
return Promise.resolve({ answered: false, deferred: true });
|
|
@@ -45,6 +45,7 @@ import { blockedProbe, probeHarness } from '@/server/lib/harness/launch';
|
|
|
45
45
|
import { HARNESS_LAUNCH, harnessRequirementMet, type HarnessLaunch } from '@/server/lib/harness/launch-table';
|
|
46
46
|
import { customLaunch } from '@/server/lib/harness/custom.server';
|
|
47
47
|
import { resolveOmpBin } from '@/server/lib/omp/core/cli';
|
|
48
|
+
import { whichOnToolchainPath } from '@/server/lib/fs/toolchain-path';
|
|
48
49
|
import { rememberProbe } from '@/server/lib/harness/probe-cache.server';
|
|
49
50
|
import { harnessDescriptor, harnessIds, type HarnessId } from '@/shared/lib/harness/catalog';
|
|
50
51
|
import { harnessEnabled } from '@/shared/lib/harness/enabled';
|
|
@@ -80,8 +81,8 @@ export function commandAvailable(id: HarnessId, config?: HarnessConfig): boolean
|
|
|
80
81
|
// An adapter can need a binary it SPAWNS rather than execs: the zcode bridge
|
|
81
82
|
// starts `zcode app-server --stdio`, so `npx` being present says nothing.
|
|
82
83
|
if (!harnessRequirementMet(launch?.requires, launch?.env)) return false;
|
|
83
|
-
if (binary === 'npx') return Boolean(
|
|
84
|
-
return Boolean(
|
|
84
|
+
if (binary === 'npx') return Boolean(whichOnToolchainPath('npx') ?? whichOnToolchainPath('node'));
|
|
85
|
+
return Boolean(whichOnToolchainPath(binary));
|
|
85
86
|
}
|
|
86
87
|
|
|
87
88
|
/**
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
import { existsSync } from 'node:fs';
|
|
16
16
|
import { homedir } from 'node:os';
|
|
17
|
+
import { whichOnToolchainPath } from '@/server/lib/fs/toolchain-path';
|
|
17
18
|
import type { HarnessId } from '@/shared/lib/harness/catalog';
|
|
18
19
|
|
|
19
20
|
/** One harness's launch configuration. */
|
|
@@ -54,7 +55,7 @@ function resolvable(value: string): boolean {
|
|
|
54
55
|
if (trimmed.includes('/') || trimmed.includes('\\')) {
|
|
55
56
|
return existsSync(trimmed.replace(/^~(?=[/\\])/, homedir()));
|
|
56
57
|
}
|
|
57
|
-
return Boolean(
|
|
58
|
+
return Boolean(whichOnToolchainPath(trimmed));
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
/**
|
|
@@ -76,7 +77,7 @@ export function harnessRequirementMet(
|
|
|
76
77
|
? (env?.[requirement.env] ?? Bun.env[requirement.env] ?? '').trim()
|
|
77
78
|
: '';
|
|
78
79
|
if (explicit) return resolvable(explicit);
|
|
79
|
-
if (
|
|
80
|
+
if (whichOnToolchainPath(requirement.binary)) return true;
|
|
80
81
|
return (requirement.bundled ?? []).some(resolvable);
|
|
81
82
|
}
|
|
82
83
|
|
|
@@ -35,6 +35,7 @@ import { emitRealtimeSignal } from '@/server/lib/realtime/signals.server';
|
|
|
35
35
|
import { harnessDescriptor, type HarnessId } from '@/shared/lib/harness/catalog';
|
|
36
36
|
import { mcpDelivery } from '@/shared/lib/harness/mcp-facts';
|
|
37
37
|
import { mcpServersFor, toAcpMcpServers } from '@/server/lib/mcp/registry.server';
|
|
38
|
+
import { readSessionMcpOverrides } from '@/server/lib/mcp/session-state.server';
|
|
38
39
|
import { ensureCustomHarnesses } from '@/server/lib/harness/custom.server';
|
|
39
40
|
import type { HarnessConfig } from '@/shared/lib/harness/config';
|
|
40
41
|
import type { AcpProcess } from '@/server/lib/harness/acp/client';
|
|
@@ -130,8 +131,11 @@ export async function openAcpSession(
|
|
|
130
131
|
// The MCP list is read per SPAWN, not cached: a server added in Settings must
|
|
131
132
|
// reach the next chat without a restart. A harness whose delivery is a file
|
|
132
133
|
// (omp's RPC mode) is not an ACP session, so this branch is the ACP contract.
|
|
134
|
+
// The session's own overrides are applied here, which is what makes a toggle
|
|
135
|
+
// per-session: the list is an argument to `session/new|load`, not a file.
|
|
136
|
+
const overrides = await readSessionMcpOverrides(request.sessionId);
|
|
133
137
|
const mcpServers = mcpDelivery(request.harness) === 'acp'
|
|
134
|
-
? toAcpMcpServers(await mcpServersFor(request.cwd))
|
|
138
|
+
? toAcpMcpServers(await mcpServersFor(request.cwd, { overrides }))
|
|
135
139
|
: [];
|
|
136
140
|
// Built here rather than behind a factory in the session module: this is the
|
|
137
141
|
// only place a session is constructed, and the handshake it runs (load vs
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
30
|
import { probeWithConfig } from '@/server/lib/harness/auto-probe.server';
|
|
31
|
+
import { whichOnToolchainPath } from '@/server/lib/fs/toolchain-path';
|
|
31
32
|
import { forgetProbe, rememberProbe } from '@/server/lib/harness/probe-cache.server';
|
|
32
33
|
import { forgetCliVersion } from '@/server/lib/harness/update-state.server';
|
|
33
34
|
import { loadHarnessConfig, saveHarnessConfig } from '@/server/lib/harness/config.server';
|
|
@@ -95,7 +96,7 @@ async function pointAtInstalledAdapter(
|
|
|
95
96
|
facts,
|
|
96
97
|
steps,
|
|
97
98
|
config.command,
|
|
98
|
-
facts.agentBin ? Boolean(
|
|
99
|
+
facts.agentBin ? Boolean(whichOnToolchainPath(facts.agentBin)) : false,
|
|
99
100
|
);
|
|
100
101
|
if (!bin) return null;
|
|
101
102
|
await saveHarnessConfig(harness, { ...config, command: bin });
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import { commandAvailable } from '@/server/lib/harness/auto-probe.server';
|
|
26
|
+
import { whichOnToolchainPath } from '@/server/lib/fs/toolchain-path';
|
|
26
27
|
import { loadHarnessConfig } from '@/server/lib/harness/config.server';
|
|
27
28
|
import { fetchNpmLatest } from '@/server/lib/updates/npm';
|
|
28
29
|
import type { HarnessId } from '@/shared/lib/harness/catalog';
|
|
@@ -99,8 +100,11 @@ export async function cliVersion(bin: string): Promise<string | null> {
|
|
|
99
100
|
if (cached && Date.now() - cached.at < CLI_VERSION_TTL_MS) return cached.version;
|
|
100
101
|
let version: string | null = null;
|
|
101
102
|
try {
|
|
102
|
-
|
|
103
|
-
|
|
103
|
+
// Resolved, then executed by its absolute path: a login-entry launch has a
|
|
104
|
+
// minimal PATH, so a bare name passes this check and fails the spawn.
|
|
105
|
+
const resolved = whichOnToolchainPath(bin);
|
|
106
|
+
if (resolved) {
|
|
107
|
+
const proc = Bun.spawn({ cmd: [resolved, '--version'], stdout: 'pipe', stderr: 'pipe', timeout: 5000 });
|
|
104
108
|
const text = (await new Response(proc.stdout).text()) + (await new Response(proc.stderr).text());
|
|
105
109
|
await proc.exited;
|
|
106
110
|
// The first version-shaped token: `2.1.318 (Claude Code)`, `codex-cli 0.166.0`.
|
|
@@ -2,6 +2,7 @@ import { describe, expect, test } from 'bun:test';
|
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import {
|
|
4
4
|
SPAWN_CLIFF,
|
|
5
|
+
cachedOpenFileDescriptors,
|
|
5
6
|
countOpenFileDescriptors,
|
|
6
7
|
describeFdPressure,
|
|
7
8
|
describeSpawnFailure,
|
|
@@ -56,6 +57,48 @@ describe('countOpenFileDescriptors', () => {
|
|
|
56
57
|
});
|
|
57
58
|
});
|
|
58
59
|
|
|
60
|
+
describe('cachedOpenFileDescriptors', () => {
|
|
61
|
+
// The sweep is 5.03 ms on a 61,440-entry table and blocks the event loop, so
|
|
62
|
+
// `/api/health` — polled at 250-500 ms while a boot or restart is watched —
|
|
63
|
+
// must reuse it. The cache is process-wide, so each case clears the slot.
|
|
64
|
+
const reset = (): void => {
|
|
65
|
+
(globalThis as unknown as Record<string, unknown>).__kabmoFdSweep = undefined;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
test('reuses one sweep inside the window', () => {
|
|
69
|
+
reset();
|
|
70
|
+
const first = cachedOpenFileDescriptors(60_000);
|
|
71
|
+
const second = cachedOpenFileDescriptors(60_000);
|
|
72
|
+
expect(second).toBe(first);
|
|
73
|
+
reset();
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test('sweeps again once the window has passed', () => {
|
|
77
|
+
reset();
|
|
78
|
+
const first = cachedOpenFileDescriptors(0);
|
|
79
|
+
const second = cachedOpenFileDescriptors(0);
|
|
80
|
+
// A zero window means every call is fresh; the values are equal objects
|
|
81
|
+
// only if the host cannot answer at all.
|
|
82
|
+
if (first === null) expect(second).toBeNull();
|
|
83
|
+
else expect(second).not.toBe(first);
|
|
84
|
+
reset();
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
test('sees a descriptor opened after the window', () => {
|
|
88
|
+
reset();
|
|
89
|
+
const before = cachedOpenFileDescriptors(0);
|
|
90
|
+
if (!before) return; // Host cannot answer; nothing to assert.
|
|
91
|
+
const fd = fs.openSync('/dev/null', 'r');
|
|
92
|
+
try {
|
|
93
|
+
const after = cachedOpenFileDescriptors(0);
|
|
94
|
+
expect(after!.open).toBeGreaterThanOrEqual(before.open + 1);
|
|
95
|
+
} finally {
|
|
96
|
+
fs.closeSync(fd);
|
|
97
|
+
reset();
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
|
|
59
102
|
describe('describeFdPressure', () => {
|
|
60
103
|
test('is silent when the table has room, so no caller blames the wrong thing', () => {
|
|
61
104
|
expect(describeFdPressure(null)).toBeNull();
|
|
@@ -172,6 +172,44 @@ export function countOpenFileDescriptors(): FdPressure | null {
|
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
+
/**
|
|
176
|
+
* The last sweep, and when it ran.
|
|
177
|
+
*
|
|
178
|
+
* Anchored on `globalThis` for the reason the database handle is: `bun --hot`
|
|
179
|
+
* re-evaluates this module while the process lives on.
|
|
180
|
+
*/
|
|
181
|
+
interface FdSweepCache {
|
|
182
|
+
at: number;
|
|
183
|
+
value: FdPressure | null;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
declare global {
|
|
187
|
+
// eslint-disable-next-line no-var
|
|
188
|
+
var __kabmoFdSweep: FdSweepCache | undefined;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* The descriptor count, reused for `maxAgeMs`.
|
|
193
|
+
*
|
|
194
|
+
* The sweep is 5.03 ms on a 61,440-entry table (measured, macOS) and it blocks
|
|
195
|
+
* the event loop, so a caller that polls — `GET /api/health` is polled at 250 ms
|
|
196
|
+
* while a plugin pass runs and at 500 ms while a restart is watched — must not
|
|
197
|
+
* pay it per request. One second is short enough that a leak still shows up
|
|
198
|
+
* within a poll or two and long enough that a burst of probes costs one sweep.
|
|
199
|
+
*
|
|
200
|
+
* `countOpenFileDescriptors` stays the fresh answer for the paths that decide
|
|
201
|
+
* whether a spawn may be attempted: a stale count there would refuse work the
|
|
202
|
+
* table can hold, or attempt work it cannot.
|
|
203
|
+
*/
|
|
204
|
+
export function cachedOpenFileDescriptors(maxAgeMs = 1_000): FdPressure | null {
|
|
205
|
+
const now = Date.now();
|
|
206
|
+
const cache = (globalThis.__kabmoFdSweep ??= { at: 0, value: null });
|
|
207
|
+
if (now - cache.at < maxAgeMs) return cache.value;
|
|
208
|
+
cache.value = countOpenFileDescriptors();
|
|
209
|
+
cache.at = now;
|
|
210
|
+
return cache.value;
|
|
211
|
+
}
|
|
212
|
+
|
|
175
213
|
/**
|
|
176
214
|
* What descriptor exhaustion looks like in Bun's own words. macOS names the
|
|
177
215
|
* failing syscall (`EBADF … posix_spawn '/bin/sh'`), Linux the errno
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* The HTTP listener this process is serving on, plus how to talk to it.
|
|
8
8
|
*
|
|
9
|
-
* Two consumers need it and neither can import it: the shell renderer, which
|
|
10
|
-
* asks the listener for its own `/_shell` route (Bun renders an HTML
|
|
11
|
-
* while serving
|
|
12
|
-
* own routing table owns. The reference is injected rather than imported because
|
|
9
|
+
* Two consumers need it and neither can import it: the shell renderer, which in
|
|
10
|
+
* DEVELOPMENT asks the listener for its own `/_shell` route (Bun renders an HTML
|
|
11
|
+
* route only while serving; production reads the built file instead), and the
|
|
12
|
+
* dev asset proxy, which asks it for the assets Bun's own routing table owns. The reference is injected rather than imported because
|
|
13
13
|
* `index.ts` owns the listener and imports both of them — a direct import would
|
|
14
14
|
* be a cycle.
|
|
15
15
|
*
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The HTML bundle, in development only.
|
|
8
|
+
*
|
|
9
|
+
* `index.html` is the client's entrypoint: importing it makes Bun bundle the
|
|
10
|
+
* page and register it as an HTML route, which is what injects the HMR client
|
|
11
|
+
* and what `renderShell` fetches back. Production does not need it — the client
|
|
12
|
+
* is built ahead of time by `scripts/build-client.ts` and the shell is read
|
|
13
|
+
* from `dist/client/index.html` — and importing it there would drag the whole
|
|
14
|
+
* client graph into the server build, which is exactly what prevents the client
|
|
15
|
+
* from being code-split.
|
|
16
|
+
*
|
|
17
|
+
* The import is dynamic and guarded so the server build can mark `*.html`
|
|
18
|
+
* external: the specifier survives into the bundle, and the branch that would
|
|
19
|
+
* resolve it is never taken in production. A static import cannot work here —
|
|
20
|
+
* it is evaluated at module load in every mode, so the server build would
|
|
21
|
+
* bundle the client graph and production would resolve an HTML bundle it never
|
|
22
|
+
* serves.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import { DEV_ASSETS_ENABLED } from '@/server/lib/assets/dev-assets.server';
|
|
26
|
+
|
|
27
|
+
export const shellBundle = DEV_ASSETS_ENABLED
|
|
28
|
+
? (await import('@/../index.html')).default
|
|
29
|
+
: null;
|