@kabmo-labs/kabmo 0.46.1 → 0.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.html +1 -1
- package/dist/client/index.js +506 -502
- package/dist/client/static/js/Body-3tspyjtk.js +3 -0
- package/dist/client/static/js/{CsvGrid-qdkmv8bj.js → CsvGrid-3pwsfmxp.js} +2 -2
- package/dist/client/static/js/{DocxView-k84ns803.js → DocxView-xcg9jktb.js} +3 -3
- package/dist/client/static/js/{DrawioView-r1n717f7.js → DrawioView-2q19tgkx.js} +2 -2
- package/dist/client/static/js/HtmlPreview-92cadvbr.js +1 -0
- package/dist/client/static/js/ImageView-pr4h38hb.js +1 -0
- package/dist/client/static/js/LayoutWrapper-n4tzhjes.js +2 -0
- package/dist/client/static/js/MergeDiffView-0t15nh9f.js +1 -0
- package/dist/client/static/js/{Modal-xe6h99jn.js → Modal-77hgx4dw.js} +20 -20
- package/dist/client/static/js/{PdfView-ffg4mccg.js → PdfView-gzxhvxe8.js} +1 -1
- package/dist/client/static/js/{SessionsView-cdcbsee9.js → SessionsView-2tdqrvk0.js} +1 -1
- package/dist/client/static/js/{SheetView-89sscpz6.js → SheetView-w5w2m2de.js} +22 -22
- package/dist/client/static/js/{SvgPreview-68c0ccbv.js → SvgPreview-mtk6de6h.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-h3a5s259.js → abnfDiagram-O67JEVCF-tha4j2fn.js} +1 -1
- package/dist/client/static/js/architecture-7GRP2DOG-zs15nydj.js +1 -0
- package/dist/client/static/js/{architectureDiagram-NJMV4G6O-983p0jgn.js → architectureDiagram-NJMV4G6O-heep78p6.js} +6 -6
- package/dist/client/static/js/{astro-hyj5wege.js → astro-r4dp34pw.js} +1 -1
- package/dist/client/static/js/bash-8d3wrx5c.js +1 -0
- package/dist/client/static/js/{blockDiagram-BEXU5L5S-16pse5mh.js → blockDiagram-BEXU5L5S-6mzgfqh8.js} +5 -5
- package/dist/client/static/js/c-rn3z0csz.js +1 -0
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-mvnb00zt.js → c4Diagram-YGBWAQC7-sfkcw7g9.js} +4 -4
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-kmpd91xb.js → classDiagram-v2-NBCMYWYE-v530ny5e.js} +6 -6
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-3ek5r5se.js → cose-bilkent-JH36ORCC-ybv1ttbx.js} +1 -1
- package/dist/client/static/js/cpp-99ws9nak.js +1 -0
- package/dist/client/static/js/css-narcr42w.js +1 -0
- package/dist/client/static/js/cynefin-OW5HDTMX-p3y1b4ap.js +1 -0
- package/dist/client/static/js/{cynefinDiagram-VND7K2PF-jkbh84zn.js → cynefinDiagram-VND7K2PF-k8f3z0mm.js} +2 -2
- package/dist/client/static/js/{dagre-6A5THRUB-4fdc0sgn.js → dagre-6A5THRUB-gk0gp124.js} +2 -2
- package/dist/client/static/js/{diagram-22UHCM2B-hbk61nq9.js → diagram-22UHCM2B-2zh2957c.js} +15 -15
- package/dist/client/static/js/{diagram-3UASUU5V-hfpbr9qh.js → diagram-3UASUU5V-bzstt5e2.js} +2 -2
- package/dist/client/static/js/{diagram-ATOU4E4O-fn0nt71a.js → diagram-ATOU4E4O-16adx4g0.js} +3 -3
- package/dist/client/static/js/{diagram-CDSNMT55-ssswxjeb.js → diagram-CDSNMT55-1ja98ens.js} +5 -5
- package/dist/client/static/js/{diagram-MLGK6HIB-whnzxv6f.js → diagram-MLGK6HIB-f9nnyjbq.js} +2 -2
- package/dist/client/static/js/{diagram-MPIPVDR6-hk1chzxk.js → diagram-MPIPVDR6-3qgadfjz.js} +2 -2
- package/dist/client/static/js/{dockerfile-zmsj8r4g.js → dockerfile-04tc68pq.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-q1vkg5mr.js → ebnfDiagram-ZINNZB2B-022cz603.js} +1 -1
- package/dist/client/static/js/{elixir-80wq7gak.js → elixir-61gbjv6c.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-kt98vg8j.js → elk-276RUBZZ-2anf1c36.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-ey3avsn9.js → erDiagram-OPXOYQCR-ndd27fz1.js} +7 -7
- package/dist/client/static/js/{erlang-814e8qy5.js → erlang-bh5cbm8m.js} +1 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-sx2cwkz3.js +1 -0
- package/dist/client/static/js/flowDiagram-KWPJA3E3-dsc17mty.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-a9k1at43.js → ganttDiagram-FUAMR5RP-9gm6hkgn.js} +4 -4
- package/dist/client/static/js/gitGraph-4MIJSDKK-yqhbscsd.js +1 -0
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-gnekjfym.js → gitGraphDiagram-X574FWY7-78bxa67c.js} +8 -8
- package/dist/client/static/js/graphql-tr0jcndy.js +1 -0
- package/dist/client/static/js/html-n8fdvrdk.js +1 -0
- package/dist/client/static/js/index-0e51wknc.js +10 -0
- package/dist/client/static/js/{index-z25ss7xj.js → index-13g17wa3.js} +1 -1
- package/dist/client/static/js/index-1hb8fvw9.js +1 -0
- package/dist/client/static/js/{index-1c2jvnyh.js → index-2bsnywea.js} +2 -2
- package/dist/client/static/js/{index-g7s0wsag.js → index-2n1fgpjv.js} +2 -2
- package/dist/client/static/js/{index-3x7h2eqj.js → index-30a8py59.js} +2 -2
- package/dist/client/static/js/{index-qf3y3ahx.js → index-34aq5bz5.js} +2 -2
- package/dist/client/static/js/index-3en15m75.js +2 -0
- package/dist/client/static/js/{index-nw5mvcaj.js → index-417fbrqk.js} +2 -2
- package/dist/client/static/js/{index-z4530r3c.js → index-45p59fxq.js} +2 -2
- package/dist/client/static/js/index-4n7t26ap.js +2 -0
- package/dist/client/static/js/{index-kty4ncsr.js → index-55pqvh82.js} +2 -2
- package/dist/client/static/js/index-5mpv57fn.js +12 -0
- package/dist/client/static/js/{index-x9r7zfp4.js → index-7pz6n3pg.js} +2 -2
- package/dist/client/static/js/{index-1ax52p0q.js → index-7whstwc7.js} +2 -2
- package/dist/client/static/js/index-869vdnz8.js +2 -0
- package/dist/client/static/js/{index-fzngzhww.js → index-8tvrzce0.js} +2 -2
- package/dist/client/static/js/index-9a78xmkk.js +462 -0
- package/dist/client/static/js/{index-33qxg79j.js → index-a58rkn3f.js} +5 -5
- package/dist/client/static/js/{index-60v30k5h.js → index-aa3hmn6j.js} +64 -64
- package/dist/client/static/js/{index-wrcdc9vz.js → index-aabp7nt6.js} +1 -1
- package/dist/client/static/js/{index-64sqfr4a.js → index-abrrqhne.js} +2 -2
- package/dist/client/static/js/{index-9vv7wr1n.js → index-ac2q5903.js} +2 -2
- package/dist/client/static/js/index-axtm1aq8.js +2 -0
- package/dist/client/static/js/index-b2cs4c51.js +4 -0
- package/dist/client/static/js/{index-8g7q8mz4.js → index-c250nzm1.js} +3 -3
- package/dist/client/static/js/{index-abs635a1.js → index-dxnkwf39.js} +48 -48
- package/dist/client/static/js/{index-kbhrvep8.js → index-e6ny4gd9.js} +6 -6
- package/dist/client/static/js/index-ebf50mrs.js +9 -0
- package/dist/client/static/js/{index-trvqvb1v.js → index-ep6bqcmg.js} +2 -2
- package/dist/client/static/js/{index-qfxn7yh5.js → index-fb2s080r.js} +2 -2
- package/dist/client/static/js/index-fryp0kgf.js +2 -0
- package/dist/client/static/js/{index-2ks0m8ss.js → index-g3rg6vsd.js} +2 -2
- package/dist/client/static/js/{index-sa1675y0.js → index-g8rpydkr.js} +2 -2
- package/dist/client/static/js/{index-bsr7wmj2.js → index-gkmn4y1v.js} +1 -1
- package/dist/client/static/js/{index-xq5f3nxa.js → index-gpmcth0x.js} +2 -2
- package/dist/client/static/js/{index-e9cxje00.js → index-hcmhdpp4.js} +10 -10
- package/dist/client/static/js/{index-kb14dhrx.js → index-he4k2j91.js} +2 -2
- package/dist/client/static/js/{index-wbws16ag.js → index-hq28918s.js} +2 -2
- package/dist/client/static/js/{index-84fyq5a6.js → index-hwzxdwwg.js} +1 -1
- package/dist/client/static/js/{index-2a6qp9y6.js → index-jnkc9p53.js} +1 -1
- package/dist/client/static/js/{index-pavvxrsz.js → index-k39be93q.js} +1 -1
- package/dist/client/static/js/{index-c9e417cs.js → index-kaxvwh07.js} +2 -2
- package/dist/client/static/js/{index-ykm7a3cp.js → index-kjr68pcj.js} +2 -2
- package/dist/client/static/js/{index-b5dfvget.js → index-m0fatq7c.js} +4 -4
- package/dist/client/static/js/{index-atq9q1s7.js → index-m39gbcxn.js} +1 -1
- package/dist/client/static/js/{index-hnb66d3s.js → index-mqzgf7rw.js} +2 -2
- package/dist/client/static/js/{index-5wz0y88c.js → index-pzsp1src.js} +2 -2
- package/dist/client/static/js/{index-yf93db65.js → index-qe0vfv6s.js} +1 -1
- package/dist/client/static/js/{index-q9ytjey8.js → index-qek9mt5w.js} +1 -1
- package/dist/client/static/js/{index-d23eacf2.js → index-qxzj780x.js} +2 -2
- package/dist/client/static/js/index-rgxg0azs.css +1 -0
- package/dist/client/static/js/{index-m4k054wz.js → index-rq4dk4tp.js} +4 -4
- package/dist/client/static/js/{index-fj5rsp5v.js → index-seekt5k3.js} +2 -2
- package/dist/client/static/js/{index-561gkvve.js → index-sng4prpr.js} +2 -2
- package/dist/client/static/js/{index-vjmg7kn5.js → index-t4s10406.js} +2 -2
- package/dist/client/static/js/{index-b2e5pwx7.js → index-tzz5gp8a.js} +5 -5
- package/dist/client/static/js/index-vnv9z0a1.js +1 -0
- package/dist/client/static/js/{index-19x11s5w.js → index-x7rajphe.js} +2 -2
- package/dist/client/static/js/{index-dxvtjn6a.js → index-xny7vsfz.js} +2 -2
- package/dist/client/static/js/index-xr4hjv01.js +2 -0
- package/dist/client/static/js/{index-65afr75v.js → index-ya9yqj5w.js} +2 -2
- package/dist/client/static/js/{index-z0fkfphe.js → index-zcgqacvx.js} +2 -2
- package/dist/client/static/js/info-A6RAGUB7-0sd3zzgg.js +1 -0
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-r1p25738.js → infoDiagram-VRGFBTTK-bxk0g0pe.js} +2 -2
- package/dist/client/static/js/ini-tnaw7zjy.js +1 -0
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-afgrqdrt.js → ishikawaDiagram-OU5B5YK6-d1kdkhth.js} +3 -3
- package/dist/client/static/js/java-m4dpc2vw.js +1 -0
- package/dist/client/static/js/javascript-8y26t991.js +1 -0
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-hepa4wk7.js → journeyDiagram-ZHPQQLJL-cahg3zjq.js} +4 -4
- package/dist/client/static/js/json-azm7bdqd.js +1 -0
- package/dist/client/static/js/jsx-p9j1k773.js +1 -0
- package/dist/client/static/js/{julia-yv2j8qd0.js → julia-2n5k898q.js} +1 -1
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-jysft8ya.js → kanban-definition-PNTS6WVX-nq7t83en.js} +6 -6
- package/dist/client/static/js/lua-hbm9rhz9.js +1 -0
- package/dist/client/static/js/markdown-tk3cd3vs.js +1 -0
- package/dist/client/static/js/{mermaid.core-0m90b0s8.js → mermaid.core-6nw0853j.js} +8 -8
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-x2rrzpvr.js → mindmap-definition-NLK3R4M7-cm7ykxf2.js} +3 -3
- package/dist/client/static/js/one-dark-pro-2cdc2nk7.js +1 -0
- package/dist/client/static/js/one-light-bt6z4jf0.js +1 -0
- package/dist/client/static/js/packet-AYTQ26CC-13w2v5bb.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-z7vb7f1z.js → pegDiagram-GJSIUBJH-xwxz8nsq.js} +1 -1
- package/dist/client/static/js/{perl-917pjq5a.js → perl-66vb5pz7.js} +1 -1
- package/dist/client/static/js/{php-hwz75qzt.js → php-4e9we8am.js} +1 -1
- package/dist/client/static/js/pie-WAS4IAKB-swtnysgn.js +1 -0
- package/dist/client/static/js/{pieDiagram-5QR66LMP-jqv6v4e6.js → pieDiagram-5QR66LMP-n910k9th.js} +3 -3
- package/dist/client/static/js/properties-6911ckw7.js +1 -0
- package/dist/client/static/js/python-44cvj250.js +1 -0
- package/dist/client/static/js/{quadrantDiagram-O4NWA36T-w2h8yxrv.js → quadrantDiagram-O4NWA36T-dxkwxbqb.js} +6 -6
- package/dist/client/static/js/r-t3sepzm4.js +1 -0
- package/dist/client/static/js/radar-RG4KPBEZ-vtvxkx55.js +1 -0
- package/dist/client/static/js/railroad-74A4TZTK-5sp2d63r.js +1 -0
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-kg706fan.js +1 -0
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-4ra1gzx5.js +1 -0
- package/dist/client/static/js/railroad-peg-WCYAUIDC-hms3zpjm.js +1 -0
- package/dist/client/static/js/{railroadDiagram-XR7U4H2S-nd09yac3.js → railroadDiagram-XR7U4H2S-xb1smt7r.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-t61zxh5v.js → requirementDiagram-PLB6GJNP-6kb21b9f.js} +6 -6
- package/dist/client/static/js/{ruby-er7ayhte.js → ruby-v7nmcvyr.js} +1 -1
- package/dist/client/static/js/{rust-avnkhh0p.js → rust-5ersd7be.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-2f7h2cmw.js → sankeyDiagram-IPEJSGJF-74z0fskw.js} +4 -4
- package/dist/client/static/js/{sass-n47tt136.js → sass-h3nvy4c8.js} +1 -1
- package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-kfb5d7zd.js → sequenceDiagram-PO4LG4MO-apn6kezn.js} +17 -17
- package/dist/client/static/js/{sizeCapture-INFHLROL-amfg19se.js → sizeCapture-INFHLROL-2drzcjb8.js} +1 -1
- package/dist/client/static/js/sql-zdkawqx3.js +1 -0
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-k5hx7btx.js → stateDiagram-v2-GCMORJYK-ma09vhby.js} +3 -3
- package/dist/client/static/js/{svelte-2pmz35vx.js → svelte-dhspkgss.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-wv3rp8kk.js → swimlanes-2SLR337P-f6y9xqnx.js} +1 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-3dwas56m.js +8 -0
- package/dist/client/static/js/{timeline-definition-EJHVYXUP-0re95wtn.js → timeline-definition-EJHVYXUP-zmcmvq00.js} +5 -5
- package/dist/client/static/js/treeView-Q6P3EWNA-7t5k6rs2.js +1 -0
- package/dist/client/static/js/treemap-WGGIJYW6-w56ry3bg.js +1 -0
- package/dist/client/static/js/tsx-b7eabr17.js +1 -0
- package/dist/client/static/js/typescript-nnkvhwfy.js +1 -0
- package/dist/client/static/js/{usecaseDiagram-POWQR4AR-yrje14qp.js → usecaseDiagram-POWQR4AR-wfaa019a.js} +24 -24
- package/dist/client/static/js/{vennDiagram-UO4OBE2U-jxkmrfy5.js → vennDiagram-UO4OBE2U-46wf2pgd.js} +8 -8
- package/dist/client/static/js/{vue-d5gpjfgn.js → vue-ffngx2b3.js} +1 -1
- package/dist/client/static/js/wardley-WFR3VGLG-rtjb9kgv.js +1 -0
- package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-d3v2m9b1.js → wardleyDiagram-VNRHLVJA-10ph3bzq.js} +4 -4
- package/dist/client/static/js/xml-xy1tw6b2.js +1 -0
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-9a1s1rjt.js → xychartDiagram-PMCCYNJV-2ba825z9.js} +5 -5
- package/dist/client/static/js/yaml-0fexqg2d.js +1 -0
- package/marketplace/marketplace.json +34 -7
- package/marketplace/plugins/kanban/README.md +143 -0
- package/marketplace/plugins/kanban/icon.svg +5 -0
- package/marketplace/plugins/kanban/package.json +30 -0
- package/marketplace/plugins/kanban/src/app.tsx +34 -0
- package/marketplace/plugins/kanban/src/mcp-tools.ts +296 -0
- package/marketplace/plugins/kanban/src/mcp.test.ts +199 -0
- package/marketplace/plugins/kanban/src/mcp.ts +148 -0
- package/marketplace/plugins/kanban/src/panel/CardSheet.tsx +319 -0
- package/marketplace/plugins/kanban/src/panel/CardTile.tsx +97 -0
- package/marketplace/plugins/kanban/src/panel/StageColumn.tsx +116 -0
- package/marketplace/plugins/kanban/src/panel/StageSheet.tsx +249 -0
- package/marketplace/plugins/kanban/src/panel/catalogs.ts +114 -0
- package/marketplace/plugins/kanban/src/panel/index.tsx +327 -0
- package/marketplace/plugins/kanban/src/panel/panel.test.ts +219 -0
- package/marketplace/plugins/kanban/src/panel/start-work.ts +132 -0
- package/marketplace/plugins/kanban/src/panel/use-board.ts +148 -0
- package/marketplace/plugins/kanban/src/panel/use-card-detail.ts +70 -0
- package/marketplace/plugins/kanban/src/panel/use-writes.ts +123 -0
- package/marketplace/plugins/kanban/src/protocol.ts +180 -0
- package/marketplace/plugins/kanban/src/server.test.ts +113 -0
- package/marketplace/plugins/kanban/src/server.ts +227 -0
- package/marketplace/plugins/kanban/src/store/board.test.ts +311 -0
- package/marketplace/plugins/kanban/src/store/board.ts +147 -0
- package/marketplace/plugins/kanban/src/store/cards.ts +228 -0
- package/marketplace/plugins/kanban/src/store/fs.ts +159 -0
- package/marketplace/plugins/kanban/src/store/ops.ts +245 -0
- package/marketplace/plugins/kanban/src/store/resolve.test.ts +82 -0
- package/marketplace/plugins/kanban/src/store/resolve.ts +135 -0
- package/marketplace/plugins/kanban/tsconfig.json +26 -0
- package/package.json +2 -2
- package/src/client/components/common/file-icon/index.tsx +1 -1
- package/src/client/components/layout/desktop-layout/LeftColumn.tsx +12 -3
- package/src/client/components/layout/desktop-layout/WorkspacePanels.tsx +34 -7
- package/src/client/components/layout/desktop-layout/index.tsx +17 -22
- package/src/client/components/mobile/mobile-right-sidebar/EditorSurface.tsx +2 -0
- package/src/client/components/mobile/mobile-right-sidebar/FullEditor.tsx +11 -3
- package/src/client/components/settings/categories/appearance-settings/EditorThemeSection.test.tsx +21 -0
- package/src/client/components/settings/categories/appearance-settings/EditorThemeSection.tsx +8 -4
- package/src/client/components/settings/categories/appearance-settings/ThemeCard.tsx +8 -2
- package/src/client/components/settings/categories/appearance-settings/ThemeGrid.tsx +15 -4
- package/src/client/components/settings/categories/usage-settings/LimitsSection.tsx +10 -3
- package/src/client/components/settings/categories/usage-settings/ProviderDetail.tsx +27 -4
- package/src/client/components/settings/categories/usage-settings/TokenHarborCard.tsx +160 -0
- package/src/client/components/settings/categories/usage-settings/TokenPortalCard.tsx +104 -0
- package/src/client/components/settings/categories/usage-settings/format.ts +35 -0
- package/src/client/components/settings/categories/usage-settings/limits-section.test.tsx +16 -0
- package/src/client/components/settings/categories/usage-settings/providers.ts +26 -4
- package/src/client/components/settings/categories/usage-settings/token-harbor-card.test.tsx +114 -0
- package/src/client/components/settings/categories/usage-settings/token-harbor-hint.test.ts +68 -0
- package/src/client/components/settings/categories/usage-settings/token-portal-card.test.tsx +81 -0
- package/src/client/components/settings/categories/usage-settings/usage-and-picker.test.ts +66 -0
- package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.test.ts +21 -0
- package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.tsx +7 -1
- package/src/client/components/workspace/chat-timeline/chat-input/ThinkingLevelDropdown.tsx +3 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/DiffView.test.ts +13 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/DiffView.tsx +41 -18
- package/src/client/components/workspace/editor/BodyLazy.tsx +40 -0
- package/src/client/components/workspace/editor/FilePane.tsx +4 -2
- package/src/client/components/workspace/editor/Tabs.tsx +7 -1
- package/src/client/components/workspace/editor/Toolbar.tsx +7 -1
- package/src/client/components/workspace/editor/chrome-rows.test.tsx +126 -0
- package/src/client/components/workspace/editor/index.tsx +2 -2
- package/src/client/components/workspace/editor/viewers/HtmlPreview.test.tsx +94 -0
- package/src/client/components/workspace/editor/viewers/HtmlPreview.tsx +71 -0
- package/src/client/components/workspace/editor/viewers/bytes.ts +1 -1
- package/src/client/components/workspace/editor/viewers/dispatch.tsx +18 -2
- package/src/client/components/workspace/editor/viewers/viewers.test.ts +14 -1
- package/src/client/components/workspace/panel-header/index.test.tsx +2 -1
- package/src/client/components/workspace/panel-header/index.tsx +6 -4
- package/src/client/data/settings/omp-schema.json +33 -10
- package/src/client/hooks/editor/resolve-viewer.ts +1 -1
- package/src/client/hooks/editor/use-editor-drop.ts +14 -0
- package/src/client/hooks/editor/use-editor-tab-state.ts +5 -4
- package/src/client/hooks/ui/media-query.ts +27 -0
- package/src/client/hooks/workspace/file-tabs.ts +10 -0
- package/src/client/hooks/workspace/right-panel-presence.test.ts +152 -0
- package/src/client/hooks/workspace/right-panel-presence.ts +119 -0
- package/src/client/lib/router/search-params.test.ts +83 -0
- package/src/client/lib/router/search-params.ts +14 -3
- package/src/server/lib/mcp/session-mcp.test.ts +64 -1
- package/src/server/lib/mcp/session-overlay.server.ts +7 -4
- package/src/server/lib/omp/rpc/constants.test.ts +31 -0
- package/src/server/lib/omp/rpc/constants.ts +19 -0
- package/src/server/lib/omp/rpc/session-new.ts +78 -0
- package/src/server/lib/omp/rpc/session-registry.ts +22 -49
- package/src/server/lib/omp/rpc/spawn-mcp.ts +8 -1
- package/src/server/lib/omp/session/blobs.server.ts +2 -1
- package/src/server/lib/plugins/e2e.test.ts +71 -2
- package/src/server/lib/plugins/loader.server.ts +20 -1
- package/src/server/lib/plugins/module-import.server.ts +45 -0
- package/src/server/lib/usage/provider-key.ts +18 -0
- package/src/server/lib/usage/providers.server.ts +27 -3
- package/src/server/lib/usage/report.server.ts +24 -0
- package/src/server/lib/usage/token-harbor.test.ts +191 -0
- package/src/server/lib/usage/token-harbor.ts +207 -0
- package/src/server/lib/usage/token-portal.test.ts +140 -0
- package/src/server/lib/usage/token-portal.ts +179 -0
- package/src/server/lib/usage/vendor-http.test.ts +52 -0
- package/src/server/lib/usage/vendor-http.ts +9 -2
- package/src/server/routes/agent/new-prompt.test.ts +81 -0
- package/src/server/routes/agent/new.ts +78 -4
- package/src/server/routes/fs/raw.test.ts +12 -0
- package/src/server/routes/fs/raw.ts +2 -6
- package/src/server/routes/wiki/asset.ts +1 -1
- package/src/shared/lib/fs/document-kind.test.ts +39 -2
- package/src/shared/lib/fs/document-kind.ts +49 -1
- package/src/shared/lib/fs/file-kind.test.ts +30 -3
- package/src/shared/lib/fs/file-kind.ts +7 -104
- package/src/shared/lib/fs/mime.ts +159 -0
- package/src/shared/lib/omp/config/schema-releases.test.ts +22 -0
- package/src/shared/lib/workspace/sidebar-width.test.ts +34 -0
- package/src/shared/lib/workspace/sidebar-width.ts +33 -0
- package/src/shared/lib/workspace/workspace-panel-widths.test.ts +124 -0
- package/src/shared/lib/workspace/workspace-panel-widths.ts +115 -18
- package/src/shared/types/settings/usage.ts +89 -2
- package/dist/client/static/js/ImageView-jkrdrq8v.js +0 -1
- package/dist/client/static/js/LayoutWrapper-sh634350.js +0 -2
- package/dist/client/static/js/architecture-7GRP2DOG-pvb4d65d.js +0 -1
- package/dist/client/static/js/bash-8d8z8zrg.js +0 -1
- package/dist/client/static/js/c-acmn1zc9.js +0 -1
- package/dist/client/static/js/cpp-620mvjkk.js +0 -1
- package/dist/client/static/js/css-bt76kxbq.js +0 -1
- package/dist/client/static/js/cynefin-OW5HDTMX-gmx4vean.js +0 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-vrnheyh7.js +0 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-7gvtpn3d.js +0 -1
- package/dist/client/static/js/gitGraph-4MIJSDKK-n6wnc8st.js +0 -1
- package/dist/client/static/js/graphql-j1a6zp7m.js +0 -1
- package/dist/client/static/js/html-m0megrvb.js +0 -1
- package/dist/client/static/js/index-4cag7w6k.js +0 -479
- package/dist/client/static/js/index-5ka2tyf9.js +0 -3
- package/dist/client/static/js/index-83rkg916.js +0 -2
- package/dist/client/static/js/index-amsa0tfs.js +0 -2
- package/dist/client/static/js/index-dn7hg4em.js +0 -2
- package/dist/client/static/js/index-dpy3ewrn.css +0 -1
- package/dist/client/static/js/index-dt6q3rws.js +0 -12
- package/dist/client/static/js/index-hgzntg2j.js +0 -2
- package/dist/client/static/js/index-vkqb4dnt.js +0 -1
- package/dist/client/static/js/index-xwjbq003.js +0 -2
- package/dist/client/static/js/info-A6RAGUB7-1xtdxjz2.js +0 -1
- package/dist/client/static/js/ini-5f4zqtqr.js +0 -1
- package/dist/client/static/js/java-jj41mty3.js +0 -1
- package/dist/client/static/js/javascript-n9w9p97f.js +0 -1
- package/dist/client/static/js/json-rnh2h17x.js +0 -1
- package/dist/client/static/js/jsx-4gecrt29.js +0 -1
- package/dist/client/static/js/lua-zszaw2f7.js +0 -1
- package/dist/client/static/js/markdown-nm6gw4v4.js +0 -1
- package/dist/client/static/js/one-dark-pro-09d8p5vy.js +0 -1
- package/dist/client/static/js/one-light-g3ednt6p.js +0 -1
- package/dist/client/static/js/packet-AYTQ26CC-zm1r82x5.js +0 -1
- package/dist/client/static/js/pie-WAS4IAKB-sqa7321j.js +0 -1
- package/dist/client/static/js/properties-rkptax7r.js +0 -1
- package/dist/client/static/js/python-qf1se1mj.js +0 -1
- package/dist/client/static/js/r-ms0cygq2.js +0 -1
- package/dist/client/static/js/radar-RG4KPBEZ-z3z82syp.js +0 -1
- package/dist/client/static/js/railroad-74A4TZTK-z6swcqq2.js +0 -1
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-33km6py4.js +0 -1
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-1zbf1xmq.js +0 -1
- package/dist/client/static/js/railroad-peg-WCYAUIDC-wte1xzzy.js +0 -1
- package/dist/client/static/js/sql-hd42h8wx.js +0 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-6y8zdbm4.js +0 -8
- package/dist/client/static/js/treeView-Q6P3EWNA-pvgx6n22.js +0 -1
- package/dist/client/static/js/treemap-WGGIJYW6-3n9zm628.js +0 -1
- package/dist/client/static/js/tsx-gx7td06z.js +0 -1
- package/dist/client/static/js/typescript-1a808spn.js +0 -1
- package/dist/client/static/js/wardley-WFR3VGLG-7m07ewc4.js +0 -1
- package/dist/client/static/js/xml-3117mxd9.js +0 -1
- package/dist/client/static/js/yaml-dmvh8vyt.js +0 -1
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
import { RpcProcess } from '@/server/lib/omp/rpc/process';
|
|
15
|
-
import { buildSessionSpawnArgs } from '@/server/lib/omp/rpc/constants';
|
|
15
|
+
import { buildSessionSpawnArgs, type SessionPromptArgs } from '@/server/lib/omp/rpc/constants';
|
|
16
16
|
import { AgentSessionWrapper } from '@/server/lib/omp/rpc/manager';
|
|
17
17
|
import { syncDiscoveryRootsWatch } from '@/server/lib/omp/config/roots-watch.server';
|
|
18
18
|
import { emitRealtimeSignal } from '@/server/lib/realtime/signals.server';
|
|
@@ -20,11 +20,9 @@ import { localRuns } from '@/server/lib/omp/session/local-runs.server';
|
|
|
20
20
|
import { recordSpawnProvenance } from '@/server/lib/omp/rpc/spawn-provenance';
|
|
21
21
|
import { registerSpawnedSession } from '@/server/lib/omp/rpc/session-registration';
|
|
22
22
|
import { resolveSessionOwnership, SessionOwnedElsewhereError } from '@/server/lib/omp/session/ownership.server';
|
|
23
|
-
import { claimPrewarmedSession } from '@/server/lib/omp/rpc/prewarm-pool';
|
|
24
|
-
import { mintAgentEnvironment, rememberAgentToken } from '@/server/lib/sessions/agent-token.server';
|
|
25
23
|
import { sessionMcpSpawn } from '@/server/lib/omp/rpc/spawn-mcp';
|
|
26
24
|
import { isUnrestorableModelFailure, resolveResumableModel } from '@/server/lib/omp/session/resumable-model.server';
|
|
27
|
-
import {
|
|
25
|
+
import type { ApprovalMode } from '@/shared/lib/omp/config/access-mode';
|
|
28
26
|
import type { SelectedModel } from '@/shared/types/models';
|
|
29
27
|
import { claimHarness, harnessOf } from '@/server/lib/harness/registry';
|
|
30
28
|
import { saveHarnessSession } from '@/server/lib/harness/session-store.server';
|
|
@@ -171,6 +169,7 @@ export async function startRpcSession(
|
|
|
171
169
|
approvalMode?: ApprovalMode,
|
|
172
170
|
modeEnv?: Record<string, string>,
|
|
173
171
|
resumeModel?: SelectedModel,
|
|
172
|
+
promptArgs?: SessionPromptArgs,
|
|
174
173
|
): Promise<{ session: AgentSessionWrapper; realSessionId: string }> {
|
|
175
174
|
const registry = getRegistry();
|
|
176
175
|
const locks = getLocks();
|
|
@@ -200,7 +199,7 @@ export async function startRpcSession(
|
|
|
200
199
|
const inflight = locks.get(sessionId);
|
|
201
200
|
if (inflight) return inflight;
|
|
202
201
|
|
|
203
|
-
const starting = spawnOnce(sessionId, sessionFile, cwd, recordedCwd, approvalMode, modeEnv)
|
|
202
|
+
const starting = spawnOnce(sessionId, sessionFile, cwd, recordedCwd, approvalMode, modeEnv, undefined, promptArgs)
|
|
204
203
|
.catch(async (error) => {
|
|
205
204
|
// omp restores the model the session's transcript records, and it does
|
|
206
205
|
// NOT fall back when that model is gone: the child exits(1) with
|
|
@@ -221,7 +220,7 @@ export async function startRpcSession(
|
|
|
221
220
|
if (!isUnrestorableModelFailure(error)) throw error;
|
|
222
221
|
const replacement = await resolveResumableModel(resumeModel);
|
|
223
222
|
if (!replacement) throw error;
|
|
224
|
-
return spawnOnce(sessionId, sessionFile, cwd, recordedCwd, approvalMode, modeEnv, replacement);
|
|
223
|
+
return spawnOnce(sessionId, sessionFile, cwd, recordedCwd, approvalMode, modeEnv, replacement, promptArgs);
|
|
225
224
|
})
|
|
226
225
|
.finally(() => locks.delete(sessionId));
|
|
227
226
|
|
|
@@ -238,6 +237,7 @@ async function spawnOnce(
|
|
|
238
237
|
approvalMode: ApprovalMode | undefined,
|
|
239
238
|
modeEnv: Record<string, string> | undefined,
|
|
240
239
|
resumeModel?: SelectedModel | undefined,
|
|
240
|
+
promptArgs?: SessionPromptArgs,
|
|
241
241
|
): Promise<{ session: AgentSessionWrapper; realSessionId: string }> {
|
|
242
242
|
const registry = getRegistry();
|
|
243
243
|
const holder: { wrapper?: AgentSessionWrapper } = {};
|
|
@@ -245,7 +245,10 @@ async function spawnOnce(
|
|
|
245
245
|
const mcp = await sessionMcpSpawn(sessionId, cwd, modeEnv);
|
|
246
246
|
const proc = new RpcProcess({
|
|
247
247
|
cwd,
|
|
248
|
-
extraArgs: [
|
|
248
|
+
extraArgs: [
|
|
249
|
+
...buildSessionSpawnArgs(sessionFile, approvalMode, resumeModel, promptArgs),
|
|
250
|
+
...mcp.extraArgs,
|
|
251
|
+
],
|
|
249
252
|
env: mcp.env,
|
|
250
253
|
onExit: ({ stderrTail }) => holder.wrapper?.handleProcessExit(stderrTail),
|
|
251
254
|
});
|
|
@@ -304,46 +307,16 @@ async function spawnOnce(
|
|
|
304
307
|
// of the live-session map below.
|
|
305
308
|
// ============================================================================
|
|
306
309
|
|
|
307
|
-
/**
|
|
308
|
-
*
|
|
309
|
-
*
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
// get a callback credential, and no caller can forget it.
|
|
318
|
-
const { token, env: agentEnv } = mintAgentEnvironment();
|
|
319
|
-
const env = { ...(modeEnv ?? {}), ...agentEnv };
|
|
320
|
-
const wrapper = await claimPrewarmedSession(cwd, mode, env);
|
|
321
|
-
|
|
322
|
-
if (!wrapper) {
|
|
323
|
-
const started = await startRpcSession(`__new__${Bun.randomUUIDv7()}`, '', cwd, undefined, mode, env);
|
|
324
|
-
await rememberAgentToken(started.realSessionId, token).catch((cause: unknown) => {
|
|
325
|
-
console.error(`[sessions] could not record the agent token for ${started.realSessionId}:`, cause);
|
|
326
|
-
});
|
|
327
|
-
return started;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
// A claimed prewarmed process recorded its own token before entering the
|
|
331
|
-
// pool; recording this call's token would invalidate the child's environment.
|
|
332
|
-
|
|
333
|
-
const registry = getRegistry();
|
|
334
|
-
const realSessionId = wrapper.sessionId;
|
|
335
|
-
// The same registration the cold path uses: it installs the destroy cleanup
|
|
336
|
-
// AND starts the change journal, so a prewarmed session is not a second
|
|
337
|
-
// convention.
|
|
338
|
-
registerSpawnedSession(registry, wrapper, realSessionId, realSessionId);
|
|
339
|
-
// A prewarmed process is adopted here, not in `startRpcSession`, so this is
|
|
340
|
-
// the only spawn path that sees it — a session's cwd may sit outside every
|
|
341
|
-
// registered workspace, and the discovery watcher has to learn it. Awaited
|
|
342
|
-
// for the same reason as in `startRpcSession`: the attach is asynchronous,
|
|
343
|
-
// and the caller's first write must not land before the watch exists.
|
|
344
|
-
await syncDiscoveryRootsWatch();
|
|
345
|
-
// Same as `startRpcSession`: a topic subscribed against the pre-spawn id (or
|
|
346
|
-
// a placeholder) needs a fresh snapshot now that a child is reachable.
|
|
347
|
-
emitRealtimeSignal('session-attached', realSessionId);
|
|
348
|
-
return { session: wrapper, realSessionId };
|
|
310
|
+
/**
|
|
311
|
+
* The live-session map, for the module that adopts a prewarmed child.
|
|
312
|
+
*
|
|
313
|
+
* Exported rather than re-derived: `startNewRpcSession` lives in its own file
|
|
314
|
+
* (`session-new.ts`) to keep this one under the repo's ceiling, and it must
|
|
315
|
+
* register into the SAME map — a second one would make `getRpcSession` miss
|
|
316
|
+
* every prewarmed session.
|
|
317
|
+
*/
|
|
318
|
+
export function ompSessionRegistry(): Map<string, LiveSession> {
|
|
319
|
+
return getRegistry();
|
|
349
320
|
}
|
|
321
|
+
|
|
322
|
+
export { startNewRpcSession } from '@/server/lib/omp/rpc/session-new';
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
import { readSessionMcpOverrides } from '@/server/lib/mcp/session-state.server';
|
|
19
19
|
import { ensureSessionMcpOverlay, type SessionMcpOverlay } from '@/server/lib/mcp/session-overlay.server';
|
|
20
|
+
import { pluginMcpServers } from '@/server/lib/plugins/mcp.server';
|
|
20
21
|
|
|
21
22
|
export interface SessionMcpSpawn {
|
|
22
23
|
/** Extra CLI args for the child (`--config <overlay>`). */
|
|
@@ -33,7 +34,13 @@ export async function sessionMcpSpawn(
|
|
|
33
34
|
modeEnv: Record<string, string> | undefined,
|
|
34
35
|
): Promise<SessionMcpSpawn> {
|
|
35
36
|
const overrides = await readSessionMcpOverrides(sessionId);
|
|
36
|
-
|
|
37
|
+
// A session with no overrides used to skip the overlay entirely — which also
|
|
38
|
+
// skipped the PLUGIN servers, because the overlay is the only path that
|
|
39
|
+
// materializes them for omp's RPC child. So the overlay is built whenever a
|
|
40
|
+
// plugin contributes a server, even with an empty override map.
|
|
41
|
+
const overlay = await ensureSessionMcpOverlay(sessionId, cwd, overrides, {
|
|
42
|
+
keep: pluginMcpServers().length > 0,
|
|
43
|
+
});
|
|
37
44
|
if (!overlay) return { extraArgs: [], env: modeEnv };
|
|
38
45
|
return {
|
|
39
46
|
extraArgs: ['--config', overlay.configPath],
|
|
@@ -28,7 +28,8 @@ import * as fsp from 'node:fs/promises';
|
|
|
28
28
|
import { existsSync } from 'node:fs';
|
|
29
29
|
import * as path from 'node:path';
|
|
30
30
|
import { getAgentDir } from '@/server/lib/omp/core/paths';
|
|
31
|
-
import { getImageMimeFromBytes
|
|
31
|
+
import { getImageMimeFromBytes } from '@/shared/lib/fs/file-kind';
|
|
32
|
+
import { getPaintableImageMimeType } from '@/shared/lib/fs/mime';
|
|
32
33
|
|
|
33
34
|
const BLOB_PREFIX = 'blob:sha256:';
|
|
34
35
|
|
|
@@ -19,17 +19,25 @@
|
|
|
19
19
|
|
|
20
20
|
import { afterAll, beforeAll, describe, expect, test } from 'bun:test';
|
|
21
21
|
import { cp, mkdir, mkdtemp, rm } from 'fs/promises';
|
|
22
|
+
import { readdirSync } from 'node:fs';
|
|
22
23
|
import { tmpdir } from 'os';
|
|
23
|
-
import { join } from 'path';
|
|
24
|
+
import { isAbsolute, join } from 'path';
|
|
24
25
|
import { isolateDb, releaseDb } from '@/test-support/isolated-db';
|
|
25
26
|
import { packageDir } from '@/server/lib/fs/package-root';
|
|
26
27
|
import { invalidatePanelScan } from '@/server/lib/panels/registry.server';
|
|
27
28
|
import { buildPanelPlugin } from '@/server/lib/panels/build.server';
|
|
28
29
|
import { toManifest } from '@/server/lib/panels/manifest';
|
|
29
|
-
import {
|
|
30
|
+
import {
|
|
31
|
+
loadPluginServer,
|
|
32
|
+
disposePlugin,
|
|
33
|
+
loadedPluginIds,
|
|
34
|
+
pluginLoadErrors,
|
|
35
|
+
} from '@/server/lib/plugins/loader.server';
|
|
36
|
+
import { importPluginModule } from '@/server/lib/plugins/module-import.server';
|
|
30
37
|
import { callRpcMethod } from '@/server/lib/plugins/rpc.server';
|
|
31
38
|
import { pluginTopicValue } from '@/server/lib/plugins/realtime.server';
|
|
32
39
|
import { findHttpRoute } from '@/server/lib/plugins/http.server';
|
|
40
|
+
import { getDataDir } from '@/server/lib/lifecycle/paths';
|
|
33
41
|
|
|
34
42
|
const PLUGIN_ID = 'session-info';
|
|
35
43
|
let marketplaceRoot = '';
|
|
@@ -132,3 +140,64 @@ describe('a real plugin server half', () => {
|
|
|
132
140
|
if (!after.ok) expect(after.error.code).toBe('unknown_method');
|
|
133
141
|
});
|
|
134
142
|
});
|
|
143
|
+
|
|
144
|
+
describe('the host facts a plugin is handed', () => {
|
|
145
|
+
test('paths.dataDir is the host resolution, not a plugin guess', async () => {
|
|
146
|
+
// The bug this pins: a plugin that keeps files had to re-derive
|
|
147
|
+
// `KABMO_DATA_DIR`/`~/.kabmo` itself, which is wrong on every relocated
|
|
148
|
+
// install and a second copy of a fact `getDataDir()` owns.
|
|
149
|
+
const record = await loadPluginServer(PLUGIN_ID);
|
|
150
|
+
expect(record.api.paths.dataDir).toBe(getDataDir());
|
|
151
|
+
// ABSOLUTE, asked portably: `startsWith('/')` is a POSIX assumption and this
|
|
152
|
+
// gate runs on Windows too, where the answer is `D:\…` (measured on the
|
|
153
|
+
// Windows leg, which failed the whole case on the drive letter alone).
|
|
154
|
+
expect(isAbsolute(record.api.paths.dataDir)).toBe(true);
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
test('a relocated data dir is what a freshly loaded plugin sees', async () => {
|
|
158
|
+
// A plugin is loaded ONCE and its API object is kept, so the relocation is
|
|
159
|
+
// observable only after a dispose — which is exactly the reload path a
|
|
160
|
+
// `bun --hot` save or a disable/enable takes.
|
|
161
|
+
const previous = Bun.env.KABMO_DATA_DIR;
|
|
162
|
+
Bun.env.KABMO_DATA_DIR = join(marketplaceRoot, 'relocated');
|
|
163
|
+
try {
|
|
164
|
+
await disposePlugin(PLUGIN_ID);
|
|
165
|
+
const record = await loadPluginServer(PLUGIN_ID);
|
|
166
|
+
expect(record.api.paths.dataDir).toBe(join(marketplaceRoot, 'relocated'));
|
|
167
|
+
} finally {
|
|
168
|
+
if (previous === undefined) delete Bun.env.KABMO_DATA_DIR;
|
|
169
|
+
else Bun.env.KABMO_DATA_DIR = previous;
|
|
170
|
+
await disposePlugin(PLUGIN_ID);
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
describe('a rebuilt bundle is not masked by the module cache', () => {
|
|
176
|
+
test('importPluginModule reads the file again when it changed', async () => {
|
|
177
|
+
// Measured: Bun keys an ESM module by its resolved URL, so a plain
|
|
178
|
+
// `import(entry)` returned the FIRST copy after a Rebuild — the plugin kept
|
|
179
|
+
// running its previous code until the process restarted, and the UI had no
|
|
180
|
+
// way to say so.
|
|
181
|
+
const dir = await mkdtemp(join(tmpdir(), 'plugin-bust-'));
|
|
182
|
+
const file = join(dir, 'bundle.js');
|
|
183
|
+
await Bun.write(file, 'export default function factory() { return 1; }\n');
|
|
184
|
+
const first = await importPluginModule(file);
|
|
185
|
+
const firstModule = first.module as { default: () => number };
|
|
186
|
+
expect(firstModule.default()).toBe(1);
|
|
187
|
+
|
|
188
|
+
await Bun.write(file, 'export default function factory() { return 2; }\n');
|
|
189
|
+
const second = await importPluginModule(file);
|
|
190
|
+
const secondModule = second.module as { default: () => number };
|
|
191
|
+
expect(secondModule.default()).toBe(2);
|
|
192
|
+
expect(secondModule).not.toBe(firstModule);
|
|
193
|
+
|
|
194
|
+
// The copy outlives the import on purpose (a plugin may spawn itself from
|
|
195
|
+
// `import.meta.url`) and goes away with the plugin.
|
|
196
|
+
const copies = readdirSync(dir).filter((name) => name.includes('.load-'));
|
|
197
|
+
expect(copies.length).toBe(2);
|
|
198
|
+
await first.cleanup();
|
|
199
|
+
expect(readdirSync(dir).filter((name) => name.includes('.load-')).length).toBe(1);
|
|
200
|
+
await second.cleanup();
|
|
201
|
+
await rm(dir, { recursive: true, force: true });
|
|
202
|
+
});
|
|
203
|
+
});
|
|
@@ -34,6 +34,8 @@ import { readPluginManifest } from '@/server/lib/panels/files.server';
|
|
|
34
34
|
import { toManifest } from '@/server/lib/panels/manifest';
|
|
35
35
|
import { pluginSettingsDefinitions } from '@/server/lib/panels/settings-schema.server';
|
|
36
36
|
import { createPluginStorage } from '@/server/lib/plugins/storage.server';
|
|
37
|
+
import { getDataDir } from '@/server/lib/lifecycle/paths';
|
|
38
|
+
import { importPluginModule } from '@/server/lib/plugins/module-import.server';
|
|
37
39
|
import { createPluginSettings, clearPluginSettingListeners } from '@/server/lib/plugins/settings.server';
|
|
38
40
|
import { registerRpcMethod, clearPluginRpcMethods } from '@/server/lib/plugins/rpc.server';
|
|
39
41
|
import { createPluginHttp, clearPluginHttpRoutes } from '@/server/lib/plugins/http.server';
|
|
@@ -154,6 +156,16 @@ export function loadedPlugins(): LoadedPlugin[] {
|
|
|
154
156
|
* only plugins reachable here are ones the scan already admitted — installed,
|
|
155
157
|
* enabled, and compatible.
|
|
156
158
|
*/
|
|
159
|
+
/**
|
|
160
|
+
* Import a plugin's server bundle, busting the module cache.
|
|
161
|
+
*
|
|
162
|
+
* Bun keys an ESM module by its resolved URL, so re-importing the SAME path
|
|
163
|
+
* returns the module it loaded the first time — measured: a rebuilt plugin kept
|
|
164
|
+
* serving its previous code until the whole process restarted, which made
|
|
165
|
+
* Rebuild look like a no-op and an update look like it did nothing. The query is
|
|
166
|
+
* the file's mtime + size, so a changed bundle is a changed URL and an unchanged
|
|
167
|
+
* one still hits the cache.
|
|
168
|
+
*/
|
|
157
169
|
export async function loadPluginServer(pluginId: string): Promise<LoadedPlugin> {
|
|
158
170
|
const existing = loaded().get(pluginId);
|
|
159
171
|
if (existing) return existing;
|
|
@@ -173,7 +185,8 @@ export async function loadPluginServer(pluginId: string): Promise<LoadedPlugin>
|
|
|
173
185
|
const settings = await pluginSettingsDefinitions(dir, parsed);
|
|
174
186
|
if ('error' in settings) throw new Error(`plugin "${pluginId}" has an invalid settings schema: ${settings.error}`);
|
|
175
187
|
|
|
176
|
-
const
|
|
188
|
+
const loadedModule = await importPluginModule(entry);
|
|
189
|
+
const module = loadedModule.module as { default?: unknown };
|
|
177
190
|
if (typeof module.default !== 'function') {
|
|
178
191
|
throw new Error(`plugin "${pluginId}" has no server factory default export (export default function plugin(api) {})`);
|
|
179
192
|
}
|
|
@@ -207,12 +220,18 @@ export async function loadPluginServer(pluginId: string): Promise<LoadedPlugin>
|
|
|
207
220
|
events: events,
|
|
208
221
|
background: background.api,
|
|
209
222
|
mcp: createPluginMcp(pluginId),
|
|
223
|
+
// The host's own resolution, handed over rather than re-derived: a plugin
|
|
224
|
+
// that reads `~/.kabmo` itself is wrong on every XDG/relocated install.
|
|
225
|
+
paths: { dataDir: getDataDir() },
|
|
210
226
|
onDispose(hook) {
|
|
211
227
|
if (typeof hook !== 'function') throw new Error('onDispose expects a function');
|
|
212
228
|
track(hook);
|
|
213
229
|
},
|
|
214
230
|
};
|
|
215
231
|
|
|
232
|
+
// Registered FIRST so it runs LAST: the module's own disposers may still read
|
|
233
|
+
// files beside the bundle (a copied entry that spawns itself).
|
|
234
|
+
track(loadedModule.cleanup);
|
|
216
235
|
const record: LoadedPlugin = { pluginId, api, background: background.handle, disposers };
|
|
217
236
|
// Registered BEFORE the factory runs: a factory that registers something and
|
|
218
237
|
// then throws still needs its partial registrations disposed, and the only
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Importing a plugin's server bundle as a module Bun has not seen.
|
|
8
|
+
*
|
|
9
|
+
* A plain `import(entry)` is cached by resolved URL, and **Bun ignores a query
|
|
10
|
+
* string on a file specifier** (measured in one process: `?v=1` then `?v=2`
|
|
11
|
+
* returned the SAME module object). So a rebuilt plugin kept running its previous
|
|
12
|
+
* code until Kabmo restarted, and Rebuild looked like a no-op.
|
|
13
|
+
*
|
|
14
|
+
* The workaround is a COPY in the same directory, imported under its own name: a
|
|
15
|
+
* fresh URL, and `import.meta.url` still resolves to a real file in the plugin's
|
|
16
|
+
* own directory — which matters, because a plugin that ships an MCP server spawns
|
|
17
|
+
* itself from that URL. The copy is removed on dispose, never immediately: an
|
|
18
|
+
* unlinked path would make that spawn fail.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import fs from 'fs';
|
|
22
|
+
import { basename, dirname, join } from 'path';
|
|
23
|
+
import { pathToFileURL } from 'node:url';
|
|
24
|
+
|
|
25
|
+
/** Never reused: each load is a fresh module, so a Rebuild always takes effect. */
|
|
26
|
+
let moduleLoadSeq = 0;
|
|
27
|
+
|
|
28
|
+
export async function importPluginModule(entry: string): Promise<{
|
|
29
|
+
module: unknown;
|
|
30
|
+
cleanup: () => Promise<void>;
|
|
31
|
+
}> {
|
|
32
|
+
// A dot prefix keeps the copy out of the bundle route and out of a directory
|
|
33
|
+
// listing a reader would mistake for a real entry.
|
|
34
|
+
const copy = join(dirname(entry), `.${basename(entry)}.load-${++moduleLoadSeq}.mjs`);
|
|
35
|
+
await fs.promises.copyFile(entry, copy);
|
|
36
|
+
try {
|
|
37
|
+
return {
|
|
38
|
+
module: await import(pathToFileURL(copy).href),
|
|
39
|
+
cleanup: () => fs.promises.rm(copy, { force: true }),
|
|
40
|
+
};
|
|
41
|
+
} catch (cause) {
|
|
42
|
+
await fs.promises.rm(copy, { force: true });
|
|
43
|
+
throw cause;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -7,6 +7,24 @@ import { isRecord } from '@/shared/lib/util/guards';
|
|
|
7
7
|
|
|
8
8
|
const SETTINGS_KEY = 'omp_providers_config';
|
|
9
9
|
const MASKED_KEY_PATTERN = /•{3,}/;
|
|
10
|
+
/** omp reads a bare variable name in `apiKey` from the environment. */
|
|
11
|
+
const ENV_NAME_PATTERN = /^[A-Z][A-Z0-9_]*$/;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* A stored key value turned into the literal to send: a text key passes
|
|
15
|
+
* through, a masked placeholder is refused, and a bare environment-variable
|
|
16
|
+
* NAME is resolved (omp's own docs write `apiKey: TOKENPORTAL_API_KEY`, which
|
|
17
|
+
* omp resolves from the environment; sending the variable name itself answers
|
|
18
|
+
* 401 for a working setup).
|
|
19
|
+
*/
|
|
20
|
+
export function resolveStoredKey(value: string | null): string | null {
|
|
21
|
+
if (!value) return null;
|
|
22
|
+
const trimmed = value.trim();
|
|
23
|
+
if (!trimmed || MASKED_KEY_PATTERN.test(trimmed)) return null;
|
|
24
|
+
if (!ENV_NAME_PATTERN.test(trimmed)) return trimmed;
|
|
25
|
+
const fromEnv = Bun.env[trimmed];
|
|
26
|
+
return fromEnv && fromEnv.trim() ? fromEnv.trim() : null;
|
|
27
|
+
}
|
|
10
28
|
|
|
11
29
|
export interface ProviderEntry {
|
|
12
30
|
name: string;
|
|
@@ -24,6 +24,8 @@ import { readProviderIconUrls } from '@/server/lib/models/provider-icon.server';
|
|
|
24
24
|
import { buildDeepSeekReport } from '@/server/lib/usage/deepseek';
|
|
25
25
|
import { buildKenariReport } from '@/server/lib/usage/kenari';
|
|
26
26
|
import { buildNewApiReports } from '@/server/lib/usage/new-api';
|
|
27
|
+
import { allowanceWindows, buildTokenHarborReports } from '@/server/lib/usage/token-harbor';
|
|
28
|
+
import { buildTokenPortalReports, tokenPortalWindows } from '@/server/lib/usage/token-portal';
|
|
27
29
|
import { fetchOmpUsageSnapshot, type OmpUsageSnapshot } from '@/server/lib/usage/omp-usage.server';
|
|
28
30
|
import { fetchVendorBalance, type VendorBalance } from '@/server/lib/usage/vendor-balance.server';
|
|
29
31
|
import { kenariProviderSlugs, listCredentialedProviders, type CredentialedProvider } from '@/server/lib/usage/provider-key';
|
|
@@ -124,13 +126,15 @@ export async function buildUsageProviders(options: { force?: boolean } = {}): Pr
|
|
|
124
126
|
// one (`kenari2`) with no quota card while its key was never read. DeepSeek
|
|
125
127
|
// still resolves by its canonical slug.
|
|
126
128
|
const kenariSlugs = await kenariProviderSlugs(credentials.keys());
|
|
127
|
-
const [kenariReports, deepseek, balances, gateways] = await Promise.all([
|
|
129
|
+
const [kenariReports, deepseek, balances, gateways, tokenHarbor, tokenPortal] = await Promise.all([
|
|
128
130
|
Promise.all([...kenariSlugs].map(async (slug) => [slug, await buildKenariReport(slug)] as const)),
|
|
129
131
|
credentials.has('deepseek') ? buildDeepSeekReport() : Promise.resolve(null),
|
|
130
132
|
loadVendorBalances([...credentials.keys()]),
|
|
131
133
|
// Self-hosted relays answer on the provider's OWN base URL, so they cannot
|
|
132
134
|
// live in `vendor-balance`'s fixed-URL table.
|
|
133
135
|
buildNewApiReports(credentials.keys()),
|
|
136
|
+
buildTokenHarborReports(credentials.keys()),
|
|
137
|
+
buildTokenPortalReports(credentials.keys()),
|
|
134
138
|
]);
|
|
135
139
|
const kenariBySlug = new Map<string, KenariUsageReport>();
|
|
136
140
|
for (const [slug, report] of kenariReports) {
|
|
@@ -142,6 +146,10 @@ export async function buildUsageProviders(options: { force?: boolean } = {}): Pr
|
|
|
142
146
|
const report = snapshot.reports.get(slug);
|
|
143
147
|
const balance = balances.get(slug);
|
|
144
148
|
const gateway = gateways.get(slug);
|
|
149
|
+
const harbor = tokenHarbor.get(slug);
|
|
150
|
+
const harborWindows = harbor?.allowance ? allowanceWindows(harbor.allowance) : [];
|
|
151
|
+
const portal = tokenPortal.get(slug);
|
|
152
|
+
const portalWindows = portal?.balance ? tokenPortalWindows(portal.balance) : [];
|
|
145
153
|
const { tracked, limitsUnavailable } = resolveUsageTracking(slug, snapshot);
|
|
146
154
|
const summary: UsageProviderSummary = {
|
|
147
155
|
id: slug,
|
|
@@ -149,8 +157,18 @@ export async function buildUsageProviders(options: { force?: boolean } = {}): Pr
|
|
|
149
157
|
...(iconUrls.get(slug) ? { iconUrl: iconUrls.get(slug) } : {}),
|
|
150
158
|
credentialSources: sources,
|
|
151
159
|
// A vendor balance is real quota data even when omp has no adapter for it.
|
|
152
|
-
tracked: tracked
|
|
153
|
-
|
|
160
|
+
tracked: tracked
|
|
161
|
+
|| Boolean(balance?.limits.length)
|
|
162
|
+
|| Boolean(gateway?.limits.length)
|
|
163
|
+
|| harborWindows.length > 0
|
|
164
|
+
|| portalWindows.length > 0,
|
|
165
|
+
limits: [
|
|
166
|
+
...(report?.limits ?? []),
|
|
167
|
+
...(balance?.limits ?? []),
|
|
168
|
+
...(gateway?.limits ?? []),
|
|
169
|
+
...harborWindows,
|
|
170
|
+
...portalWindows,
|
|
171
|
+
],
|
|
154
172
|
...(limitsUnavailable ? { limitsUnavailable: true } : {}),
|
|
155
173
|
...(report?.notes ? { notes: report.notes } : {}),
|
|
156
174
|
};
|
|
@@ -162,6 +180,12 @@ export async function buildUsageProviders(options: { force?: boolean } = {}): Pr
|
|
|
162
180
|
} else if (slug === 'deepseek' && deepseek) {
|
|
163
181
|
summary.deepseek = deepseek;
|
|
164
182
|
if (deepseek.error) summary.error = deepseek.error;
|
|
183
|
+
} else if (harbor) {
|
|
184
|
+
summary.tokenHarbor = harbor;
|
|
185
|
+
if (harbor.error) summary.error = harbor.error;
|
|
186
|
+
} else if (portal) {
|
|
187
|
+
summary.tokenPortal = portal;
|
|
188
|
+
if (portal.error) summary.error = portal.error;
|
|
165
189
|
} else if (gateway?.error) {
|
|
166
190
|
summary.error = gateway.error;
|
|
167
191
|
} else if (balance?.error && !summary.error) {
|
|
@@ -68,6 +68,30 @@ export function mockUsageReport(): UsageReport {
|
|
|
68
68
|
},
|
|
69
69
|
},
|
|
70
70
|
},
|
|
71
|
+
{
|
|
72
|
+
id: 'token-harbour',
|
|
73
|
+
name: 'Token Harbor',
|
|
74
|
+
credentialSources: ['models.yml'],
|
|
75
|
+
// No omp adapter; the allowance comes from Token Harbor's own endpoint.
|
|
76
|
+
tracked: false,
|
|
77
|
+
limits: [],
|
|
78
|
+
tokenHarbor: {
|
|
79
|
+
allowance: {
|
|
80
|
+
planName: 'Agent Pass',
|
|
81
|
+
onPlan: true,
|
|
82
|
+
planUsedPct: 37,
|
|
83
|
+
planExhausted: false,
|
|
84
|
+
usedPct: 12,
|
|
85
|
+
exhausted: false,
|
|
86
|
+
activated: true,
|
|
87
|
+
resetAt: '2026-11-30T07:45:14.048+00:00',
|
|
88
|
+
periodStartedAt: '2026-11-23T07:45:14.048+00:00',
|
|
89
|
+
periodEndsAt: '2026-11-30T07:45:14.048+00:00',
|
|
90
|
+
freeModels: ['deepseek-v4-flash', 'mimo-v2.6-flash', 'mimo-v2.5', 'deepseek-v4.1-flash'],
|
|
91
|
+
modelsEnabled: true,
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
},
|
|
71
95
|
{
|
|
72
96
|
id: 'deepseek',
|
|
73
97
|
name: 'DeepSeek',
|