@kabmo-labs/kabmo 0.61.0 → 0.62.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 +53 -49
- package/dist/client/index.html +1 -1
- package/dist/client/index.js +1157 -825
- package/dist/client/static/js/{Body-ab8wswhm.js → Body-z6kstvk6.js} +3 -3
- package/dist/client/static/js/{CsvGrid-czssywvz.js → CsvGrid-f73c0s4e.js} +2 -2
- package/dist/client/static/js/{DocxView-ke0dwdmt.js → DocxView-a1pb7nsb.js} +3 -3
- package/dist/client/static/js/{DrawioView-a1whhy84.js → DrawioView-r61gcg24.js} +2 -2
- package/dist/client/static/js/{HtmlPreview-dr32dwjy.js → HtmlPreview-vt7j0b05.js} +1 -1
- package/dist/client/static/js/ImageView-4nhr5dtm.js +1 -0
- package/dist/client/static/js/LayoutWrapper-vwhy0vhj.js +2 -0
- package/dist/client/static/js/MergeDiffView-f4h9ss71.js +1 -0
- package/dist/client/static/js/Modal-cadmjkak.js +60 -0
- package/dist/client/static/js/{PdfView-2kdn91f9.js → PdfView-mppt2gkd.js} +1 -1
- package/dist/client/static/js/SessionsView-vvsaw9f0.js +1 -0
- package/dist/client/static/js/{SheetView-ettr9pdw.js → SheetView-5s9zfx9g.js} +9 -9
- package/dist/client/static/js/{SvgPreview-hzcejjry.js → SvgPreview-ff78xn3e.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-kdmv4y72.js → abnfDiagram-O67JEVCF-p29sh3w2.js} +1 -1
- package/dist/client/static/js/architecture-7GRP2DOG-83w3kytq.js +1 -0
- package/dist/client/static/js/{architectureDiagram-NJMV4G6O-qyrwaq0x.js → architectureDiagram-NJMV4G6O-nbpdyea3.js} +3 -3
- package/dist/client/static/js/{astro-yphdvdty.js → astro-qtfmc8x7.js} +1 -1
- package/dist/client/static/js/bash-wcy12qjx.js +1 -0
- package/dist/client/static/js/{blockDiagram-BEXU5L5S-tszxy2g7.js → blockDiagram-BEXU5L5S-t8xbexa6.js} +6 -6
- package/dist/client/static/js/c-vvantfth.js +1 -0
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-0ye36hhv.js → c4Diagram-YGBWAQC7-9fwf2zxk.js} +3 -3
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-szgk1shv.js → classDiagram-v2-NBCMYWYE-nbapgqbs.js} +4 -4
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-0s9s4mmv.js → cose-bilkent-JH36ORCC-k54mmydp.js} +1 -1
- package/dist/client/static/js/cpp-5x63r6g0.js +1 -0
- package/dist/client/static/js/css-j2j6f03w.js +1 -0
- package/dist/client/static/js/css-qk59j6rj.js +1 -0
- package/dist/client/static/js/cynefin-OW5HDTMX-80z02zrj.js +1 -0
- package/dist/client/static/js/{cynefinDiagram-VND7K2PF-664g28ze.js → cynefinDiagram-VND7K2PF-qdg32wah.js} +1 -1
- package/dist/client/static/js/{dagre-6A5THRUB-ga4rp1jx.js → dagre-6A5THRUB-qzshg1vs.js} +2 -2
- package/dist/client/static/js/{diagram-22UHCM2B-aagj46ty.js → diagram-22UHCM2B-197hemfa.js} +11 -11
- package/dist/client/static/js/{diagram-3UASUU5V-20qk6whk.js → diagram-3UASUU5V-236gnjr6.js} +1 -1
- package/dist/client/static/js/{diagram-ATOU4E4O-1vg1tfca.js → diagram-ATOU4E4O-vjgpyaaq.js} +3 -3
- package/dist/client/static/js/{diagram-CDSNMT55-90d6jrqs.js → diagram-CDSNMT55-ywvzcx7z.js} +4 -4
- package/dist/client/static/js/{diagram-MLGK6HIB-8je4z8m1.js → diagram-MLGK6HIB-9ey7ev7j.js} +1 -1
- package/dist/client/static/js/{diagram-MPIPVDR6-0kzpexsj.js → diagram-MPIPVDR6-vrqbb6r7.js} +2 -2
- package/dist/client/static/js/{dockerfile-5nrbr0ef.js → dockerfile-4nked309.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-47yg36zx.js → ebnfDiagram-ZINNZB2B-hvnkevqy.js} +1 -1
- package/dist/client/static/js/{elixir-3nwnd9yw.js → elixir-3jvh6v4k.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-5hqp6r2d.js → elk-276RUBZZ-nej6yy1c.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-bt9te7r0.js → erDiagram-OPXOYQCR-ww453xcy.js} +5 -5
- package/dist/client/static/js/{erlang-p5c4n3t0.js → erlang-4fz73a1q.js} +1 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-y9pq2709.js +1 -0
- package/dist/client/static/js/flowDiagram-KWPJA3E3-e6v7513q.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-kzc13swm.js → ganttDiagram-FUAMR5RP-abc5wy70.js} +3 -3
- package/dist/client/static/js/gitGraph-4MIJSDKK-fzaf9azs.js +1 -0
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-bjf8aa3j.js → gitGraphDiagram-X574FWY7-4acqzj2h.js} +7 -7
- package/dist/client/static/js/graphql-hpkvdvk7.js +1 -0
- package/dist/client/static/js/html-x12gb1wk.js +1 -0
- package/dist/client/static/js/{index-v88m5sva.js → index-0g82ph6h.js} +2 -2
- package/dist/client/static/js/{index-1fmjhm2d.js → index-0w1jzang.js} +5 -5
- package/dist/client/static/js/{index-kj70d2q9.js → index-1svt0cdw.js} +2 -2
- package/dist/client/static/js/{index-m24sebb0.js → index-1tb4py5v.js} +2 -2
- package/dist/client/static/js/index-2gt9krtj.js +4 -0
- package/dist/client/static/js/index-2x9m7s1a.js +1 -0
- package/dist/client/static/js/index-3fvqmz3m.js +4 -0
- package/dist/client/static/js/{index-k9yf2txw.js → index-42wvbkm5.js} +2 -2
- package/dist/client/static/js/index-477vtt51.js +2 -0
- package/dist/client/static/js/{index-ca6tmamh.js → index-4px56qaz.js} +2 -2
- package/dist/client/static/js/{index-excgtjhx.js → index-5anvw7xg.js} +36 -36
- package/dist/client/static/js/index-5nb9k2ph.js +1 -0
- package/dist/client/static/js/{index-97sw4d9n.js → index-615je3km.js} +2 -2
- package/dist/client/static/js/{index-jz4012t5.js → index-66qxrh5n.js} +1 -1
- package/dist/client/static/js/{index-a145x0w2.js → index-7kct1sz1.js} +2 -2
- package/dist/client/static/js/{index-hwv7bfxc.js → index-8e0d8y30.js} +2 -2
- package/dist/client/static/js/{index-s4j2ghmx.js → index-90bq56xw.js} +2 -2
- package/dist/client/static/js/{index-wsy6y5em.js → index-b1gzh60t.js} +11 -11
- package/dist/client/static/js/{index-10vzyga1.js → index-bypkmjrz.js} +2 -2
- package/dist/client/static/js/{index-n8r7r86r.js → index-c1vd63yd.js} +2 -2
- package/dist/client/static/js/index-c9f0hejv.js +3 -0
- package/dist/client/static/js/{index-2dmew334.js → index-cgqj15g0.js} +2 -2
- package/dist/client/static/js/{index-mtav0rpf.js → index-cts5re1t.js} +2 -2
- package/dist/client/static/js/index-dxc14kmm.js +1 -0
- package/dist/client/static/js/{index-krdz5vby.js → index-dxyjxhm1.js} +2 -2
- package/dist/client/static/js/{index-zr3965k9.js → index-edpyqz9f.js} +1 -1
- package/dist/client/static/js/{index-h7agc069.js → index-eesepb70.js} +2 -2
- package/dist/client/static/js/{index-r38e0rya.js → index-evh437bz.js} +2 -2
- package/dist/client/static/js/index-ey6v4t5b.js +1 -0
- package/dist/client/static/js/{index-025s3fp8.js → index-fsd7n336.js} +2 -2
- package/dist/client/static/js/{index-yfcy4cf6.js → index-h7a7fqag.js} +2 -2
- package/dist/client/static/js/{index-11qn05g9.js → index-hffgwnvz.js} +2 -2
- package/dist/client/static/js/index-j734ev6q.js +482 -0
- package/dist/client/static/js/{index-9g2nzgpx.js → index-jcbp1d9d.js} +6 -6
- package/dist/client/static/js/index-jg5h18sm.js +2 -0
- package/dist/client/static/js/{index-bq9f0mxp.js → index-jtdve6xw.js} +7 -7
- package/dist/client/static/js/{index-kyr612aa.js → index-k0bqrb1y.js} +1 -1
- package/dist/client/static/js/{index-bdtftrym.js → index-kegevd10.js} +2 -2
- package/dist/client/static/js/{index-fr6wsqk8.js → index-kqcfxkch.js} +2 -2
- package/dist/client/static/js/{index-sr14vwn5.js → index-kv1xnem9.js} +2 -2
- package/dist/client/static/js/{index-xy0m8te9.js → index-m54ctmxr.js} +1 -1
- package/dist/client/static/js/index-mgzbypt5.js +314 -0
- package/dist/client/static/js/{index-85jfn1fz.js → index-mh52531j.js} +2 -2
- package/dist/client/static/js/{index-776n5n29.js → index-mhz5ywa4.js} +5 -5
- package/dist/client/static/js/{index-3j2he86h.js → index-nnwdbg3t.js} +2 -2
- package/dist/client/static/js/{index-3x7cbxwq.js → index-nxd6z7f9.js} +2 -2
- package/dist/client/static/js/{index-dabnbvbc.js → index-pjrbt77c.js} +2 -2
- package/dist/client/static/js/index-r7h4pm42.js +2 -0
- package/dist/client/static/js/index-ratrdgc9.js +2 -0
- package/dist/client/static/js/{index-475dc6h9.js → index-rhmvh9w5.js} +2 -2
- package/dist/client/static/js/{index-twwsn91p.js → index-sqzjwy9h.js} +2 -2
- package/dist/client/static/js/{index-z5s9tmj8.js → index-tckzkw0f.js} +2 -2
- package/dist/client/static/js/index-tza9h3q6.css +1 -0
- package/dist/client/static/js/{index-qccydkze.js → index-vhjfr093.js} +2 -2
- package/dist/client/static/js/{index-653x8zdq.js → index-w0j96eyy.js} +8 -8
- package/dist/client/static/js/{index-24a40rw8.js → index-ws04kxy9.js} +1 -1
- package/dist/client/static/js/{index-a3bpmw2r.js → index-x1yqmzpr.js} +2 -2
- package/dist/client/static/js/{index-fb2fjndj.js → index-x2f7wykb.js} +6 -6
- package/dist/client/static/js/index-y8405hdg.js +10 -0
- package/dist/client/static/js/{index-sx83ans2.js → index-yxk7dgnb.js} +2 -2
- package/dist/client/static/js/{index-bkn6jtn1.js → index-zavecxak.js} +2 -2
- package/dist/client/static/js/{index-vn59zz0k.js → index-zg7q3kcb.js} +2 -2
- package/dist/client/static/js/{index-enm77k5z.js → index-zhn9vv3z.js} +2 -2
- package/dist/client/static/js/{index-vgcw01yk.js → index-zy963qbh.js} +1 -1
- package/dist/client/static/js/info-A6RAGUB7-t7pbg7rt.js +1 -0
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-jy5zvvj8.js → infoDiagram-VRGFBTTK-9pe7w3r5.js} +2 -2
- package/dist/client/static/js/ini-522adp5a.js +1 -0
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-pfky1nnf.js → ishikawaDiagram-OU5B5YK6-38arfrx5.js} +2 -2
- package/dist/client/static/js/java-z0rgs7v6.js +1 -0
- package/dist/client/static/js/javascript-fv87f565.js +1 -0
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-mvaf7rfh.js → journeyDiagram-ZHPQQLJL-kcwzjgtz.js} +4 -4
- package/dist/client/static/js/json-1czq1ped.js +1 -0
- package/dist/client/static/js/jsx-1fch2jyr.js +1 -0
- package/dist/client/static/js/{julia-rpd1y9vh.js → julia-pzzxbptm.js} +1 -1
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-hw2xwe6e.js → kanban-definition-PNTS6WVX-nmegwy9w.js} +15 -15
- package/dist/client/static/js/lua-nn8bpjev.js +1 -0
- package/dist/client/static/js/markdown-38tqrgkn.js +1 -0
- package/dist/client/static/js/{mermaid.core-hsw87hmq.js → mermaid.core-3aae27b9.js} +7 -7
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-wfe4d846.js → mindmap-definition-NLK3R4M7-zsaq4e65.js} +12 -12
- package/dist/client/static/js/one-dark-pro-trnff03z.js +1 -0
- package/dist/client/static/js/one-light-ck31ptqs.js +1 -0
- package/dist/client/static/js/packet-AYTQ26CC-rwac7scq.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-cvnmxgst.js → pegDiagram-GJSIUBJH-2b6whj1p.js} +1 -1
- package/dist/client/static/js/{perl-kmtz9dnv.js → perl-zdkbbjd2.js} +1 -1
- package/dist/client/static/js/{php-bttrsbxy.js → php-ktaxff6g.js} +1 -1
- package/dist/client/static/js/pie-WAS4IAKB-gjz20apz.js +1 -0
- package/dist/client/static/js/{pieDiagram-5QR66LMP-0n3gz7sv.js → pieDiagram-5QR66LMP-y09ar7vz.js} +3 -3
- package/dist/client/static/js/properties-kncqeqhn.js +1 -0
- package/dist/client/static/js/python-gx8ggmyh.js +1 -0
- package/dist/client/static/js/{quadrantDiagram-O4NWA36T-9qqh6xvv.js → quadrantDiagram-O4NWA36T-mapfzs06.js} +3 -3
- package/dist/client/static/js/r-x8rftkm3.js +1 -0
- package/dist/client/static/js/radar-RG4KPBEZ-akwdknab.js +1 -0
- package/dist/client/static/js/railroad-74A4TZTK-m5v4rfhx.js +1 -0
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-k2gmqcjb.js +1 -0
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-1zdsfjf4.js +1 -0
- package/dist/client/static/js/railroad-peg-WCYAUIDC-e98evqb6.js +1 -0
- package/dist/client/static/js/{railroadDiagram-XR7U4H2S-5f3x3762.js → railroadDiagram-XR7U4H2S-70qy7qdh.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-a68bv6kh.js → requirementDiagram-PLB6GJNP-2vb2gp3e.js} +3 -3
- package/dist/client/static/js/{ruby-dve3y59w.js → ruby-ytqv3pqz.js} +1 -1
- package/dist/client/static/js/{rust-qjhdt4b0.js → rust-6sddyxnt.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-ry7xcphh.js → sankeyDiagram-IPEJSGJF-9jd8ebrn.js} +3 -3
- package/dist/client/static/js/{sass-emxqt5p2.js → sass-dvbra5b6.js} +1 -1
- package/dist/client/static/js/{scss-4j4t3r6y.js → scss-sy7w8916.js} +1 -1
- package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-mekzzhet.js → sequenceDiagram-PO4LG4MO-w7z84f80.js} +7 -7
- package/dist/client/static/js/{sizeCapture-INFHLROL-pvc16ame.js → sizeCapture-INFHLROL-q8w7ehgx.js} +1 -1
- package/dist/client/static/js/sql-99y0qnag.js +1 -0
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-3ytxby83.js → stateDiagram-v2-GCMORJYK-4978hapr.js} +3 -3
- package/dist/client/static/js/{svelte-dbsx1ehx.js → svelte-xvs3fkza.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-c2zfp416.js → swimlanes-2SLR337P-eshg5fjy.js} +1 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-914e28hd.js +8 -0
- package/dist/client/static/js/timeline-definition-EJHVYXUP-5h5q357k.js +120 -0
- package/dist/client/static/js/treeView-Q6P3EWNA-fkm3a7gx.js +1 -0
- package/dist/client/static/js/treemap-WGGIJYW6-hm4ktxjf.js +1 -0
- package/dist/client/static/js/tsx-phngprp0.js +1 -0
- package/dist/client/static/js/typescript-m62a7zr2.js +1 -0
- package/dist/client/static/js/{usecaseDiagram-POWQR4AR-sz6b7bnv.js → usecaseDiagram-POWQR4AR-4j69y3zx.js} +20 -20
- package/dist/client/static/js/vennDiagram-UO4OBE2U-pa9p5jpw.js +34 -0
- package/dist/client/static/js/{vue-hyr58df9.js → vue-p4g4avm3.js} +1 -1
- package/dist/client/static/js/wardley-WFR3VGLG-3y2rvdmy.js +1 -0
- package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-xvtyvde9.js → wardleyDiagram-VNRHLVJA-hjddd656.js} +3 -3
- package/dist/client/static/js/xml-59n0cjn6.js +1 -0
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-jcs20s84.js → xychartDiagram-PMCCYNJV-8ng5m849.js} +4 -4
- package/dist/client/static/js/yaml-9fw908s4.js +1 -0
- package/dist/client/tailwindcss-oxide.linux-x64-gnu-c0fa36dv.node +0 -0
- package/dist/client/tailwindcss-oxide.linux-x64-musl-kr04sh0e.node +0 -0
- package/marketplace/plugins/command-runner/package.json +2 -2
- package/marketplace/plugins/command-runner/src/app.tsx +2 -5
- package/marketplace/plugins/command-runner/src/panel/CustomForm.tsx +35 -52
- package/marketplace/plugins/command-runner/src/panel/Groups.tsx +6 -5
- package/marketplace/plugins/command-runner/src/panel/Header.tsx +18 -54
- package/marketplace/plugins/command-runner/src/panel/Output.tsx +3 -7
- package/marketplace/plugins/command-runner/src/panel/Row.tsx +19 -38
- package/marketplace/plugins/command-runner/src/panel/index.tsx +1 -4
- package/marketplace/plugins/git-forge/package.json +2 -2
- package/marketplace/plugins/git-forge/src/app.tsx +2 -0
- package/marketplace/plugins/git-forge/src/panel/Credential.tsx +8 -15
- package/marketplace/plugins/git-forge/src/panel/Header.tsx +35 -66
- package/marketplace/plugins/git-forge/src/panel/ItemView.tsx +7 -13
- package/marketplace/plugins/git-forge/src/panel/List.tsx +28 -56
- package/marketplace/plugins/git-forge/src/panel/Row.tsx +7 -9
- package/marketplace/plugins/git-forge/src/panel/Sidebar.tsx +21 -31
- package/marketplace/plugins/git-forge/src/panel/Write.tsx +26 -40
- package/marketplace/plugins/git-forge/src/panel/index.tsx +0 -1
- package/marketplace/plugins/github-actions/package.json +2 -2
- package/marketplace/plugins/github-actions/src/app.tsx +2 -0
- package/marketplace/plugins/github-actions/src/panel/Actions.tsx +9 -17
- package/marketplace/plugins/github-actions/src/panel/LogView.tsx +4 -13
- package/marketplace/plugins/github-actions/src/panel/Row.tsx +4 -5
- package/marketplace/plugins/github-actions/src/panel/RunView.tsx +8 -15
- package/marketplace/plugins/github-actions/src/panel/index.test.tsx +3 -2
- package/marketplace/plugins/github-actions/src/panel/index.tsx +31 -37
- package/marketplace/plugins/kanban/package.json +2 -2
- package/marketplace/plugins/kanban/src/app.tsx +2 -0
- package/marketplace/plugins/kanban/src/panel/CardSheet.tsx +88 -98
- package/marketplace/plugins/kanban/src/panel/CardTile.tsx +6 -10
- package/marketplace/plugins/kanban/src/panel/StageColumn.tsx +22 -18
- package/marketplace/plugins/kanban/src/panel/StageSheet.tsx +59 -70
- package/marketplace/plugins/kanban/src/panel/index.tsx +37 -52
- package/marketplace/plugins/kanban/src/panel/use-board.ts +2 -0
- package/marketplace/plugins/session-info/package.json +2 -2
- package/marketplace/plugins/session-info/src/app.tsx +6 -3
- package/marketplace/plugins/stats/package.json +2 -2
- package/marketplace/plugins/stats/src/KillConfirm.test.tsx +6 -4
- package/marketplace/plugins/stats/src/KillConfirm.tsx +26 -76
- package/marketplace/plugins/stats/src/ProcessTable.tsx +8 -6
- package/marketplace/plugins/stats/src/RefreshButton.tsx +7 -5
- package/marketplace/plugins/stats/src/app.tsx +11 -9
- package/package.json +10 -10
- package/src/cli/lib/commands/plugin.js +8 -5
- package/src/client/bootstrap.d.ts +5 -0
- package/src/client/chat-title-overlay.test.ts +53 -0
- package/src/client/components/auth/login-screen/index.tsx +31 -3
- package/src/client/components/common/SignOutButton.tsx +4 -5
- package/src/client/components/common/account-badge/index.tsx +31 -0
- package/src/client/components/common/footer-version/index.tsx +40 -0
- package/src/client/components/common/fullscreen-viewer/fullscreen-viewer.test.tsx +24 -0
- package/src/client/components/common/fullscreen-viewer/index.tsx +22 -31
- package/src/client/components/common/header-controls/MoreMenu.tsx +5 -56
- package/src/client/components/common/header-controls/index.test.tsx +2 -6
- package/src/client/components/common/header-controls/index.tsx +9 -25
- package/src/client/components/common/header-controls/phone-row.test.tsx +3 -16
- package/src/client/components/common/shell-update-button/index.tsx +2 -2
- package/src/client/components/common/zoom-pan-stage/index.tsx +54 -50
- package/src/client/components/layout/desktop-layout/WorkspacePanels.tsx +4 -5
- package/src/client/components/layout/desktop-layout/index.tsx +2 -4
- package/src/client/components/layout/left-bar/index.tsx +25 -3
- package/src/client/components/layout/rail-toggle.test.tsx +112 -0
- package/src/client/components/layout/session-sidebar/CategoryHeader.accent.test.tsx +81 -0
- package/src/client/components/layout/session-sidebar/CategoryHeader.tsx +11 -3
- package/src/client/components/layout/session-sidebar/Footer.test.tsx +36 -0
- package/src/client/components/layout/session-sidebar/Footer.tsx +42 -61
- package/src/client/components/layout/session-sidebar/FooterHost.tsx +5 -1
- package/src/client/components/layout/session-sidebar/modern/WorkspaceHeader.tsx +30 -10
- package/src/client/components/layout/session-sidebar/modern/WorkspaceSection.tsx +4 -0
- package/src/client/components/layout/session-sidebar/modern/index.tsx +8 -1
- package/src/client/components/layout/session-sidebar/modern/workspace-header.test.tsx +25 -4
- package/src/client/components/layout/session-title-bar/index.tsx +13 -5
- package/src/client/components/layout/top-bars.test.tsx +4 -2
- package/src/client/components/mobile/LayoutWrapper.tsx +3 -1
- package/src/client/components/mobile/RightSidebar.tsx +12 -3
- package/src/client/components/mobile/SessionSidebar.tsx +6 -2
- package/src/client/components/mobile/drawer-layout.test.tsx +7 -3
- package/src/client/components/mobile/drawer-strip.tsx +9 -2
- package/src/client/components/mobile/mobile-main-view/Header.test.tsx +29 -9
- package/src/client/components/mobile/mobile-main-view/Header.tsx +43 -12
- package/src/client/components/mobile/mobile-right-sidebar/Chrome.tsx +12 -1
- package/src/client/components/mobile/mobile-right-sidebar/FullDiff.tsx +9 -2
- package/src/client/components/mobile/mobile-right-sidebar/FullEditor.tsx +1 -0
- package/src/client/components/mobile/mobile-right-sidebar/Header.tsx +9 -1
- package/src/client/components/mobile/mobile-right-sidebar/StatusBar.tsx +4 -2
- package/src/client/components/mobile/mobile-session-sidebar/Body.tsx +1 -1
- package/src/client/components/mobile/mobile-session-sidebar/Footer.tsx +48 -46
- package/src/client/components/mobile/mobile-session-sidebar/Header.tsx +18 -1
- package/src/client/components/mobile/mobile-session-sidebar/Item.test.tsx +4 -0
- package/src/client/components/mobile/mobile-session-sidebar/Item.tsx +4 -6
- package/src/client/components/mobile/right-drawer-nav.test.tsx +53 -1
- package/src/client/components/settings/Band.tsx +5 -2
- package/src/client/components/settings/Modal.tsx +8 -5
- package/src/client/components/settings/Sidebar.tsx +5 -3
- package/src/client/components/settings/apply-side-effects.ts +5 -0
- package/src/client/components/settings/categories/AccountSettings.tsx +266 -0
- package/src/client/components/settings/categories/ProjectSettings.tsx +2 -0
- package/src/client/components/settings/categories/account-settings/Dialogs.tsx +223 -0
- package/src/client/components/settings/categories/appearance-settings/BorderStyleSection.test.tsx +3 -4
- package/src/client/components/settings/categories/appearance-settings/ChromeStyleSection.tsx +66 -39
- package/src/client/components/settings/categories/connect-settings/DeviceTable.tsx +7 -4
- package/src/client/components/settings/categories/project-settings/DetailsForm.tsx +14 -1
- package/src/client/components/settings/categories/project-settings/ProjectSharing.tsx +130 -0
- package/src/client/components/settings/categories/project-settings/SidebarList.tsx +5 -0
- package/src/client/components/settings/category-content.tsx +3 -0
- package/src/client/components/workspace/chat-timeline/AiMessageFooterSheet.tsx +3 -1
- package/src/client/components/workspace/chat-timeline/ComposerDockFrame.tsx +2 -1
- package/src/client/components/workspace/chat-timeline/EmptyWorkspacePrompt.tsx +3 -1
- package/src/client/components/workspace/chat-timeline/SessionSkeleton.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/TimelineBody.tsx +1 -0
- package/src/client/components/workspace/chat-timeline/chat-input/ComposerRows.tsx +9 -2
- package/src/client/components/workspace/chat-timeline/chat-input/expansion.test.ts +1 -1
- package/src/client/components/workspace/chat-timeline/chat-input/expansion.ts +2 -1
- package/src/client/components/workspace/chat-timeline/chat-input/narrow.test.tsx +34 -0
- package/src/client/components/workspace/chat-timeline/composer-dock-frame.test.tsx +9 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/styles/styles.test.tsx +4 -1
- package/src/client/components/workspace/editor/Tab.tsx +19 -26
- package/src/client/components/workspace/editor/Tabs.test.ts +13 -7
- package/src/client/components/workspace/git-panel/commit-modal/Header.tsx +1 -0
- package/src/client/components/workspace/git-panel/commit-modal/floating.test.ts +46 -0
- package/src/client/components/workspace/git-panel/commit-modal/index.tsx +2 -0
- package/src/client/components/workspace/model-dropdown/Fullscreen.tsx +4 -5
- package/src/client/components/workspace/panel-tabs/TabChip.tsx +40 -39
- package/src/client/components/workspace/panel-tabs/TabStrip.connected.test.tsx +76 -58
- package/src/client/components/workspace/panel-tabs/TabStrip.test.tsx +9 -9
- package/src/client/components/workspace/panel-tabs/TabStrip.tsx +14 -1
- package/src/client/components/workspace/panel-tabs/index.tsx +1 -1
- package/src/client/components/workspace/plugin-panel/catalog.tsx +22 -5
- package/src/client/components/workspace/plugin-panel/chrome.test.tsx +89 -0
- package/src/client/components/workspace/plugin-panel/chrome.tsx +62 -0
- package/src/client/data/settings/omp-schema.json +40 -4
- package/src/client/floating-phone.test.ts +189 -0
- package/src/client/floating.css +205 -2
- package/src/client/floating.test.ts +43 -0
- package/src/client/glass.css +47 -0
- package/src/client/hooks/chat/omp/index.ts +6 -5
- package/src/client/hooks/chat/omp/prompt-send.test.ts +18 -0
- package/src/client/hooks/chat/omp/prompt-send.ts +26 -8
- package/src/client/hooks/chat/omp/session-list.tsx +20 -8
- package/src/client/hooks/chat/timeline/deferred-model.ts +13 -5
- package/src/client/hooks/chat/timeline/index.ts +2 -0
- package/src/client/hooks/chat/timeline/send-props.ts +14 -0
- package/src/client/hooks/chat/timeline/send-steer.test.ts +11 -2
- package/src/client/hooks/chat/timeline/send-switch.test.ts +92 -0
- package/src/client/hooks/chat/timeline/send.test-util.ts +37 -7
- package/src/client/hooks/chat/timeline/send.test.ts +11 -2
- package/src/client/hooks/chat/timeline/send.ts +62 -42
- package/src/client/hooks/editor/image-generation.ts +24 -0
- package/src/client/hooks/editor/resolve-viewer.test.ts +26 -20
- package/src/client/hooks/editor/resolve-viewer.ts +14 -5
- package/src/client/hooks/editor/use-file-editor.test.ts +34 -0
- package/src/client/hooks/editor/use-file-editor.ts +6 -2
- package/src/client/hooks/settings/accounts.ts +162 -0
- package/src/client/hooks/ui/auth.ts +58 -3
- package/src/client/hooks/ui/border-style.test.ts +5 -4
- package/src/client/hooks/ui/border-style.ts +3 -2
- package/src/client/hooks/ui/mobile-chrome-style.ts +68 -0
- package/src/client/hooks/ui/navbar-controls.test.ts +1 -2
- package/src/client/hooks/ui/navbar-controls.ts +0 -3
- package/src/client/hooks/ui/zoom-gesture.ts +104 -0
- package/src/client/lib/desktop/titlebar.test.ts +21 -0
- package/src/client/lib/desktop/titlebar.ts +34 -0
- package/src/client/lib/plugins/bootstrap.test.ts +20 -0
- package/src/client/lib/plugins/bootstrap.tsx +10 -15
- package/src/client/lib/plugins/kit-components.test.tsx +119 -0
- package/src/client/lib/plugins/kit-components.tsx +79 -0
- package/src/client/lib/plugins/kit.ts +8 -0
- package/src/client/lib/plugins/slots.test.ts +34 -0
- package/src/client/lib/plugins/slots.ts +31 -4
- package/src/client/lib/plugins/stylesheets.ts +10 -11
- package/src/client/lib/ui/pinch.test.ts +74 -0
- package/src/client/lib/ui/pinch.ts +104 -0
- package/src/client/lib/ui/safe-area.test.ts +25 -0
- package/src/client/lib/ui/safe-area.ts +23 -0
- package/src/client/main.tsx +8 -1
- package/src/client/tailwind.css +54 -1
- package/src/server/index.ts +2 -0
- package/src/server/lib/assets/shell-attributes.server.ts +12 -4
- package/src/server/lib/assets/shell-attributes.test.ts +19 -18
- package/src/server/lib/auth/client-address.test.ts +2 -2
- package/src/server/lib/auth/guard.test.ts +2 -2
- package/src/server/lib/auth/guard.ts +81 -97
- package/src/server/lib/auth/handover-guard.test.ts +1 -1
- package/src/server/lib/auth/rate-limit.test.ts +2 -2
- package/src/server/lib/auth/token.test.ts +1 -1
- package/src/server/lib/auth/workspace-gate.server.ts +34 -0
- package/src/server/lib/bundler/css.test.ts +16 -0
- package/src/server/lib/connect/devices.server.test.ts +12 -0
- package/src/server/lib/connect/devices.server.ts +63 -19
- package/src/server/lib/connect/pairing.server.ts +5 -3
- package/src/server/lib/connect/status.server.ts +2 -2
- package/src/server/lib/db/schema.test.ts +3 -3
- package/src/server/lib/db/schema.ts +6 -0
- package/src/server/lib/harness/update-spawn.server.test.ts +97 -0
- package/src/server/lib/harness/update-spawn.server.ts +10 -0
- package/src/server/lib/models/provider-icon-override.server.test.ts +140 -0
- package/src/server/lib/models/provider-icon-override.server.ts +197 -0
- package/src/server/lib/models/provider-icon-store.server.ts +8 -0
- package/src/server/lib/models/provider-icon.server.ts +31 -6
- package/src/server/lib/omp/session/artifacts.server.test.ts +11 -7
- package/src/server/lib/omp/session/artifacts.server.ts +21 -17
- package/src/server/lib/panels/build.server.ts +19 -2
- package/src/server/lib/panels/css.server.test.ts +141 -0
- package/src/server/lib/panels/css.server.ts +255 -0
- package/src/server/lib/panels/plugin-ui-contract.test.ts +64 -0
- package/src/server/lib/panels/registry-stylesheet.server.test.ts +69 -0
- package/src/server/lib/panels/scan.server.ts +13 -7
- package/src/server/lib/panels/source-warnings.server.test.ts +65 -0
- package/src/server/lib/panels/source-warnings.server.ts +71 -0
- package/src/server/lib/realtime/topics/catalog.server.ts +3 -0
- package/src/server/lib/realtime/topics.server.ts +14 -0
- package/src/server/lib/sessions/last-opened-client.server.ts +1 -1
- package/src/server/lib/workspace/access.server.ts +108 -0
- package/src/server/lib/workspace/project-patch.server.ts +4 -2
- package/src/server/lib/workspace/register-folder.server.ts +19 -5
- package/src/server/lib/workspace/session-access.server.ts +55 -0
- package/src/server/lib/workspace/tenancy-schema.server.ts +40 -0
- package/src/server/plugins/ssr.ts +19 -3
- package/src/server/routes/accounts/index.ts +8 -0
- package/src/server/routes/accounts/management.test.ts +174 -0
- package/src/server/routes/accounts/management.ts +166 -0
- package/src/server/routes/auth/login.ts +22 -8
- package/src/server/routes/auth/logout.ts +1 -1
- package/src/server/routes/auth/password.ts +40 -33
- package/src/server/routes/auth/revoke.test.ts +1 -1
- package/src/server/routes/auth/revoke.ts +26 -8
- package/src/server/routes/auth/routes.test.ts +3 -3
- package/src/server/routes/auth/state.ts +14 -7
- package/src/server/routes/connect/devices.ts +7 -4
- package/src/server/routes/connect/pair.ts +4 -3
- package/src/server/routes/connect/status.ts +4 -2
- package/src/server/routes/connect/tunnels.ts +2 -1
- package/src/server/routes/folders/batch-delete.ts +12 -0
- package/src/server/routes/folders/clone.ts +7 -2
- package/src/server/routes/folders/create.ts +3 -1
- package/src/server/routes/folders/folder.ts +44 -4
- package/src/server/routes/folders/index.ts +3 -0
- package/src/server/routes/folders/shares.ts +62 -0
- package/src/server/routes/index.ts +2 -0
- package/src/server/routes/panels/build.ts +1 -1
- package/src/server/routes/panels/css.test.ts +22 -0
- package/src/server/routes/panels/css.ts +5 -7
- package/src/server/routes/realtime/ws.ts +16 -1
- package/src/server/routes/sessions/list.ts +3 -2
- package/src/server/routes/settings/projects.ts +46 -7
- package/src/server/routes/settings/provider-icon.ts +18 -0
- package/src/shared/lib/chat/timeline/tool-render-mode.test.ts +2 -2
- package/src/shared/lib/chat/timeline/tool-render-mode.ts +6 -3
- package/src/shared/lib/icons/tint-hues.generated.ts +38 -37
- package/src/shared/lib/omp/config/schema-releases-19-4.test.ts +27 -1
- package/src/shared/lib/omp/session/prewarm-misc.test.ts +1 -1
- package/src/shared/lib/realtime/protocol.ts +16 -0
- package/src/shared/lib/settings/defaults.ts +2 -1
- package/src/shared/lib/settings/sections.ts +1 -1
- package/src/shared/lib/theme/border-style.test.ts +11 -9
- package/src/shared/lib/theme/border-style.ts +7 -7
- package/src/shared/lib/theme/chrome-style.test.ts +15 -0
- package/src/shared/lib/theme/chrome-style.ts +16 -1
- package/src/shared/types/index.ts +1 -0
- package/src/shared/types/settings/state.ts +6 -5
- package/src/test-support/file-editor.test-util.ts +25 -6
- package/tsconfig.json +21 -0
- package/dist/client/static/js/ImageView-zf4kh5wp.js +0 -1
- package/dist/client/static/js/LayoutWrapper-dncbzcea.js +0 -2
- package/dist/client/static/js/MergeDiffView-btdx9yb9.js +0 -1
- package/dist/client/static/js/Modal-5cxfw2rv.js +0 -60
- package/dist/client/static/js/SessionsView-vbn0nvx4.js +0 -1
- package/dist/client/static/js/architecture-7GRP2DOG-sxrkxwbq.js +0 -1
- package/dist/client/static/js/bash-bcbct9gc.js +0 -1
- package/dist/client/static/js/c-fn9jz26e.js +0 -1
- package/dist/client/static/js/cpp-a1q64mke.js +0 -1
- package/dist/client/static/js/css-b92azee8.js +0 -1
- package/dist/client/static/js/css-sn00sq6v.js +0 -1
- package/dist/client/static/js/cynefin-OW5HDTMX-g1xwa8b9.js +0 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-05p61bka.js +0 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-500fcx2a.js +0 -1
- package/dist/client/static/js/gitGraph-4MIJSDKK-z1yehwys.js +0 -1
- package/dist/client/static/js/graphql-8d8bn59j.js +0 -1
- package/dist/client/static/js/html-6hdrwtz2.js +0 -1
- package/dist/client/static/js/index-0kcnghxn.js +0 -4
- package/dist/client/static/js/index-2zhmmtye.js +0 -2
- package/dist/client/static/js/index-4vtc4xct.js +0 -481
- package/dist/client/static/js/index-5srvxsht.js +0 -2
- package/dist/client/static/js/index-6c1s0v4b.js +0 -1
- package/dist/client/static/js/index-cvm2ha01.js +0 -1
- package/dist/client/static/js/index-d11mbz2q.js +0 -4
- package/dist/client/static/js/index-fen0x3qh.js +0 -1
- package/dist/client/static/js/index-gwgh27h3.js +0 -314
- package/dist/client/static/js/index-hxy1sadd.js +0 -2
- package/dist/client/static/js/index-pg87cgpy.js +0 -2
- package/dist/client/static/js/index-q1a40v20.js +0 -3
- package/dist/client/static/js/index-qmvstmvh.js +0 -1
- package/dist/client/static/js/index-t6nqy2n5.css +0 -1
- package/dist/client/static/js/index-wf5j0009.js +0 -10
- package/dist/client/static/js/index-y6zbkh4p.js +0 -2
- package/dist/client/static/js/info-A6RAGUB7-dqyaxjc1.js +0 -1
- package/dist/client/static/js/ini-g6a5xsaw.js +0 -1
- package/dist/client/static/js/java-n596am4c.js +0 -1
- package/dist/client/static/js/javascript-zc1qnyyp.js +0 -1
- package/dist/client/static/js/json-7k70qbkj.js +0 -1
- package/dist/client/static/js/jsx-sndenqrc.js +0 -1
- package/dist/client/static/js/lua-djd3g9q5.js +0 -1
- package/dist/client/static/js/markdown-r2tpvxpn.js +0 -1
- package/dist/client/static/js/one-dark-pro-ckq5capv.js +0 -1
- package/dist/client/static/js/one-light-a908z398.js +0 -1
- package/dist/client/static/js/packet-AYTQ26CC-7jxzax4z.js +0 -1
- package/dist/client/static/js/pie-WAS4IAKB-wc9wxr7f.js +0 -1
- package/dist/client/static/js/properties-brn72zdk.js +0 -1
- package/dist/client/static/js/python-g9mghwgm.js +0 -1
- package/dist/client/static/js/r-e247x4mw.js +0 -1
- package/dist/client/static/js/radar-RG4KPBEZ-kwj5padj.js +0 -1
- package/dist/client/static/js/railroad-74A4TZTK-h8sdx3w5.js +0 -1
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-2wmwx246.js +0 -1
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-h4cdgw3y.js +0 -1
- package/dist/client/static/js/railroad-peg-WCYAUIDC-q7m0tfd0.js +0 -1
- package/dist/client/static/js/sql-0kar81jy.js +0 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-9gm67sq4.js +0 -8
- package/dist/client/static/js/timeline-definition-EJHVYXUP-xtvv4za2.js +0 -120
- package/dist/client/static/js/treeView-Q6P3EWNA-yv9640h3.js +0 -1
- package/dist/client/static/js/treemap-WGGIJYW6-7kpzjg21.js +0 -1
- package/dist/client/static/js/tsx-gjxfjnbk.js +0 -1
- package/dist/client/static/js/typescript-bm89v3gk.js +0 -1
- package/dist/client/static/js/vennDiagram-UO4OBE2U-56q0qs51.js +0 -34
- package/dist/client/static/js/wardley-WFR3VGLG-mggay64p.js +0 -1
- package/dist/client/static/js/xml-b7824nx0.js +0 -1
- package/dist/client/static/js/yaml-kqqktdv1.js +0 -1
- package/src/server/lib/auth/client-address.ts +0 -89
- package/src/server/lib/auth/config.ts +0 -133
- package/src/server/lib/auth/rate-limit.ts +0 -146
- package/src/server/lib/auth/token.ts +0 -220
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Provider marks a user assigned in omp's `models.yml` (`providerIcons.<slug>`).
|
|
8
|
+
*
|
|
9
|
+
* omp 19.4.0's `/model` hub stores either a named icon from its terminal icon
|
|
10
|
+
* set (`provider:openai`, `cpu`) or a picture path (imported ones are square
|
|
11
|
+
* PNGs under `provider-icons/` beside the file). Kabmo has two marks of its own
|
|
12
|
+
* — the vendor glyph and the provider site's fetched favicon — so this maps the
|
|
13
|
+
* file's value onto those and nothing more:
|
|
14
|
+
*
|
|
15
|
+
* - a name Kabmo knows (`provider:<brand>` or a bare brand) replaces the glyph;
|
|
16
|
+
* - a readable picture becomes the provider's `iconUrl`, stored in the same
|
|
17
|
+
* `provider_icons` row the favicon uses, with a `models.yml:` source marker so
|
|
18
|
+
* this module can tell its rows from fetched ones;
|
|
19
|
+
* - a TUI-only icon name (`cpu`, a shape from Tern's icon set) is left to
|
|
20
|
+
* `resolveProviderGlyph`, which falls through to the slug and then the
|
|
21
|
+
* initials badge. Kabmo cannot paint a terminal icon it does not have.
|
|
22
|
+
*
|
|
23
|
+
* The file is the authority: removing an entry must remove the override row, or
|
|
24
|
+
* a stale picture would outlive the user's choice.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
import { stat } from 'node:fs/promises';
|
|
28
|
+
import { dirname, extname, isAbsolute, join, resolve } from 'node:path';
|
|
29
|
+
import YAML from 'yaml';
|
|
30
|
+
|
|
31
|
+
import type { DbClient } from '@kabmo-labs/kabmo-db/client';
|
|
32
|
+
import { isRecord } from '@kabmo-labs/kabmo-guards';
|
|
33
|
+
import { getModelsConfigPath } from '@kabmo-labs/kabmo-omp/models-config/models-config';
|
|
34
|
+
import { getImageMimeFromBytes } from '@kabmo-labs/kabmo-fs/media/file-kind';
|
|
35
|
+
import { drawableSvg } from '@/server/lib/models/provider-icon-svg';
|
|
36
|
+
import {
|
|
37
|
+
deleteProviderIcon,
|
|
38
|
+
readProviderIconSources,
|
|
39
|
+
writeProviderIcon,
|
|
40
|
+
} from '@/server/lib/models/provider-icon-store.server';
|
|
41
|
+
|
|
42
|
+
/** One configured value, in the shape Kabmo can render. */
|
|
43
|
+
export type ProviderIconOverride =
|
|
44
|
+
| { kind: 'icon'; name: string }
|
|
45
|
+
| { kind: 'image'; path: string };
|
|
46
|
+
|
|
47
|
+
/** Extensions omp's `isImagePath` accepts; a picture is chosen by extension there. */
|
|
48
|
+
const IMAGE_EXTENSIONS: Readonly<Record<string, true>> = {
|
|
49
|
+
'.png': true, '.jpg': true, '.jpeg': true, '.gif': true, '.webp': true, '.bmp': true,
|
|
50
|
+
'.ico': true, '.tif': true, '.tiff': true, '.avif': true, '.heic': true,
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/** The ceiling the favicon fetch uses; a local icon is no more trusted. */
|
|
54
|
+
const MAX_ICON_BYTES = 512 * 1024;
|
|
55
|
+
|
|
56
|
+
/** Rows written from `models.yml` carry this prefix in `provider_icons.source`. */
|
|
57
|
+
const OVERRIDE_SOURCE_PREFIX = 'models.yml:';
|
|
58
|
+
|
|
59
|
+
/** `~/…` expanded the way the agents expand it, or resolved against the file. */
|
|
60
|
+
function resolveUserPath(value: string, baseDir: string, home: string): string {
|
|
61
|
+
if (value === '~') return home;
|
|
62
|
+
if (value.startsWith('~/')) return join(home, value.slice(2));
|
|
63
|
+
return isAbsolute(value) ? value : resolve(baseDir, value);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** An image path, resolved against `models.yml`'s directory, or undefined. */
|
|
67
|
+
function imagePath(value: string, baseDir: string, home: string): string | undefined {
|
|
68
|
+
const extension = extname(value).toLowerCase();
|
|
69
|
+
return IMAGE_EXTENSIONS[extension] ? resolveUserPath(value, baseDir, home) : undefined;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Parse the `providerIcons` map. Pure so a test can pin the three shapes
|
|
74
|
+
* without a file or a database; keys are folded to the slug spelling omp uses
|
|
75
|
+
* for an entry.
|
|
76
|
+
*/
|
|
77
|
+
export function parseProviderIcons(
|
|
78
|
+
value: unknown,
|
|
79
|
+
modelsDir: string,
|
|
80
|
+
home = Bun.env.HOME || Bun.env.USERPROFILE || '~',
|
|
81
|
+
): Map<string, ProviderIconOverride> {
|
|
82
|
+
const overrides = new Map<string, ProviderIconOverride>();
|
|
83
|
+
if (!isRecord(value)) return overrides;
|
|
84
|
+
for (const [rawSlug, rawValue] of Object.entries(value)) {
|
|
85
|
+
if (typeof rawValue !== 'string') continue;
|
|
86
|
+
const slug = rawSlug.trim().toLowerCase();
|
|
87
|
+
const text = rawValue.trim();
|
|
88
|
+
if (!slug || !text) continue;
|
|
89
|
+
const image = imagePath(text, modelsDir, home);
|
|
90
|
+
if (image) {
|
|
91
|
+
overrides.set(slug, { kind: 'image', path: image });
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
// `provider:openai` is Tern's spelling for a logo; older files carry the
|
|
95
|
+
// bare name. Anything with a path separator is neither.
|
|
96
|
+
const name = (text.startsWith('provider:') ? text.slice('provider:'.length) : text).trim();
|
|
97
|
+
if (!name || /[\s/\\]/.test(name)) continue;
|
|
98
|
+
overrides.set(slug, { kind: 'icon', name });
|
|
99
|
+
}
|
|
100
|
+
return overrides;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** The user's assignments, read from the same `models.yml` omp serves. */
|
|
104
|
+
export async function readProviderIconOverrides(): Promise<Map<string, ProviderIconOverride>> {
|
|
105
|
+
try {
|
|
106
|
+
const path = await getModelsConfigPath();
|
|
107
|
+
if (!(await Bun.file(path).exists())) return new Map();
|
|
108
|
+
const doc = YAML.parse(await Bun.file(path).text());
|
|
109
|
+
const icons = isRecord(doc) ? doc.providerIcons : undefined;
|
|
110
|
+
return parseProviderIcons(icons, dirname(path));
|
|
111
|
+
} catch {
|
|
112
|
+
// no-excuse-ok: catch — an unreadable models.yml only means "no override";
|
|
113
|
+
// the fetched favicon/glyph stays and the panel keeps working.
|
|
114
|
+
return new Map();
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Store (or clear) a picture the file names, so the existing icon route can
|
|
120
|
+
* serve it. The `source` marker carries the file's mtime and size, which makes
|
|
121
|
+
* a rewrite of the picture a rewrite of the row — and therefore a new URL.
|
|
122
|
+
*/
|
|
123
|
+
async function syncPicture(db: DbClient, slug: string, path: string, storedSource?: string): Promise<void> {
|
|
124
|
+
let marker = `${OVERRIDE_SOURCE_PREFIX}${path}`;
|
|
125
|
+
try {
|
|
126
|
+
const info = await stat(path);
|
|
127
|
+
marker = `${marker}:${Math.floor(info.mtimeMs)}:${info.size}`;
|
|
128
|
+
if (storedSource === marker) return;
|
|
129
|
+
if (!info.isFile() || info.size === 0 || info.size > MAX_ICON_BYTES) {
|
|
130
|
+
throw new Error('not a readable picture within the size ceiling');
|
|
131
|
+
}
|
|
132
|
+
const raw = new Uint8Array(await Bun.file(path).arrayBuffer());
|
|
133
|
+
const mime = getImageMimeFromBytes(raw);
|
|
134
|
+
if (!mime) throw new Error('no image signature');
|
|
135
|
+
// The route serves these bytes to an `<img>`; a broken SVG paints nothing
|
|
136
|
+
// and is rejected, exactly as the favicon fetch rejects one.
|
|
137
|
+
const bytes = mime === 'image/svg+xml' ? drawableSvg(raw) : raw;
|
|
138
|
+
if (!bytes) throw new Error('the SVG cannot be decoded');
|
|
139
|
+
await writeProviderIcon(db, {
|
|
140
|
+
slug,
|
|
141
|
+
status: 'ok',
|
|
142
|
+
mime,
|
|
143
|
+
bytes,
|
|
144
|
+
source: marker,
|
|
145
|
+
fetchedAt: Math.floor(info.mtimeMs),
|
|
146
|
+
});
|
|
147
|
+
} catch (error) {
|
|
148
|
+
await writeProviderIcon(db, {
|
|
149
|
+
slug,
|
|
150
|
+
status: 'missing',
|
|
151
|
+
// The `:unreadable` suffix keeps the next sync from accepting this failed
|
|
152
|
+
// row: a permission fix changes no mtime, so the marker would otherwise
|
|
153
|
+
// match and the picture would stay missing.
|
|
154
|
+
source: `${marker}:unreadable`,
|
|
155
|
+
error: error instanceof Error ? error.message : 'models.yml provider icon unreadable',
|
|
156
|
+
fetchedAt: Date.now(),
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Apply every assignment, and remove the rows whose entry disappeared.
|
|
163
|
+
*
|
|
164
|
+
* Returns the icon names the caller must stamp onto its `ProviderItem`s; a
|
|
165
|
+
* picture is served through `readProviderIconUrls` like a favicon.
|
|
166
|
+
*/
|
|
167
|
+
export interface AppliedProviderIcons {
|
|
168
|
+
/** Provider slug → the named icon the file assigns. */
|
|
169
|
+
icons: Map<string, string>;
|
|
170
|
+
/** Every slug the file assigns, picture or name: the fetch must skip these. */
|
|
171
|
+
overridden: Set<string>;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export async function syncProviderIconOverrides(db: DbClient): Promise<AppliedProviderIcons> {
|
|
175
|
+
const overrides = await readProviderIconOverrides();
|
|
176
|
+
const sources = await readProviderIconSources(db);
|
|
177
|
+
const icons = new Map<string, string>();
|
|
178
|
+
|
|
179
|
+
for (const [slug, override] of overrides) {
|
|
180
|
+
if (override.kind === 'icon') {
|
|
181
|
+
icons.set(slug, override.name);
|
|
182
|
+
// A picture URL would win over the glyph in the renderer, so the row has
|
|
183
|
+
// to go when the user switches to a named icon.
|
|
184
|
+
if (sources.has(slug)) await deleteProviderIcon(db, slug);
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
await syncPicture(db, slug, override.path, sources.get(slug));
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// An assignment that was removed must not leave its picture behind.
|
|
191
|
+
for (const [slug, source] of sources) {
|
|
192
|
+
if (!overrides.has(slug) && source.startsWith(OVERRIDE_SOURCE_PREFIX)) {
|
|
193
|
+
await deleteProviderIcon(db, slug);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return { icons, overridden: new Set(overrides.keys()) };
|
|
197
|
+
}
|
|
@@ -96,6 +96,14 @@ export async function readProviderIconStamps(
|
|
|
96
96
|
return stamps;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
/** Slug → where the bytes came from, for rows that recorded a source. */
|
|
100
|
+
export async function readProviderIconSources(db: DbClient): Promise<Map<string, string>> {
|
|
101
|
+
const rows = await db.all<{ slug: string; source: string }>(
|
|
102
|
+
'SELECT slug, source FROM provider_icons WHERE source IS NOT NULL',
|
|
103
|
+
);
|
|
104
|
+
return new Map(rows.map((row) => [row.slug, row.source]));
|
|
105
|
+
}
|
|
106
|
+
|
|
99
107
|
/** Write (or replace) one provider's icon row. */
|
|
100
108
|
export async function writeProviderIcon(db: DbClient, icon: StoredProviderIcon): Promise<void> {
|
|
101
109
|
await db.run(
|
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
writeProviderIcon,
|
|
35
35
|
type StoredProviderIcon,
|
|
36
36
|
} from '@/server/lib/models/provider-icon-store.server';
|
|
37
|
+
import { syncProviderIconOverrides } from '@/server/lib/models/provider-icon-override.server';
|
|
37
38
|
import { isMockMode } from '@kabmo-labs/kabmo-runtime-flags';
|
|
38
39
|
|
|
39
40
|
const HIT_TTL_MS = 7 * 24 * 60 * 60 * 1000;
|
|
@@ -172,16 +173,35 @@ export async function readProviderIconBytes(slug: string): Promise<StoredProvide
|
|
|
172
173
|
*/
|
|
173
174
|
export async function stampProviderIcons(providers: ProviderItem[]): Promise<ProviderItem[]> {
|
|
174
175
|
if (providers.length === 0) return providers;
|
|
176
|
+
let overridden = new Set<string>();
|
|
177
|
+
let withIcons = providers;
|
|
178
|
+
if (!isMockMode()) {
|
|
179
|
+
// The file's assignments are resolved FIRST: a named icon has to win over
|
|
180
|
+
// the glyph, and a picture has to be stored before the URL map is read.
|
|
181
|
+
// no-excuse-ok: catch — an icon is decoration; a broken icon row must not
|
|
182
|
+
// take down the provider panel.
|
|
183
|
+
const applied = await syncProviderIconOverrides(await getDb()).catch(() => ({
|
|
184
|
+
icons: new Map<string, string>(),
|
|
185
|
+
overridden: new Set<string>(),
|
|
186
|
+
}));
|
|
187
|
+
overridden = applied.overridden;
|
|
188
|
+
if (applied.icons.size > 0) {
|
|
189
|
+
withIcons = providers.map((provider) => {
|
|
190
|
+
const name = applied.icons.get(provider.slug.trim().toLowerCase());
|
|
191
|
+
return name ? { ...provider, icon: name } : provider;
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
}
|
|
175
195
|
const urls = await readProviderIconUrls();
|
|
176
196
|
if (urls.size === 0) {
|
|
177
|
-
scheduleIconFetch(
|
|
178
|
-
return
|
|
197
|
+
scheduleIconFetch(withIcons, overridden);
|
|
198
|
+
return withIcons;
|
|
179
199
|
}
|
|
180
|
-
const stamped =
|
|
200
|
+
const stamped = withIcons.map((provider) => {
|
|
181
201
|
const url = urls.get(provider.slug.trim().toLowerCase());
|
|
182
202
|
return url ? { ...provider, iconUrl: url } : provider;
|
|
183
203
|
});
|
|
184
|
-
scheduleIconFetch(stamped);
|
|
204
|
+
scheduleIconFetch(stamped, overridden);
|
|
185
205
|
return stamped;
|
|
186
206
|
}
|
|
187
207
|
|
|
@@ -193,9 +213,14 @@ export async function stampProviderIcons(providers: ProviderItem[]): Promise<Pro
|
|
|
193
213
|
* settings panel that hangs when that host is down. The pass is deduped per
|
|
194
214
|
* slug inside `ensureProviderIcons`.
|
|
195
215
|
*/
|
|
196
|
-
function scheduleIconFetch(providers: ProviderItem[]): void {
|
|
216
|
+
function scheduleIconFetch(providers: ProviderItem[], overridden: ReadonlySet<string>): void {
|
|
197
217
|
const targets = providers
|
|
198
|
-
.filter((provider) =>
|
|
218
|
+
.filter((provider) => (
|
|
219
|
+
provider.inModelsYml === true
|
|
220
|
+
&& Boolean(provider.baseUrl)
|
|
221
|
+
&& !provider.iconUrl
|
|
222
|
+
&& !overridden.has(provider.slug.trim().toLowerCase())
|
|
223
|
+
))
|
|
199
224
|
.map((provider) => ({ slug: provider.slug, baseUrl: provider.baseUrl as string }));
|
|
200
225
|
if (targets.length === 0) return;
|
|
201
226
|
void ensureProviderIcons(targets)
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* Reading the raw stream behind a spilled tool result.
|
|
8
8
|
*
|
|
9
|
-
* omp 19.0.0 spills a long tool result to `<sessionDir
|
|
10
|
-
*
|
|
11
|
-
* transcript; before it the file was `<id>.<kind>.log
|
|
12
|
-
* either, so 65 real results (the longest
|
|
13
|
-
* bytes the transcript kept.
|
|
9
|
+
* omp 19.0.0 spills a long tool result to `<sessionDir>/local/<id>.log` (the
|
|
10
|
+
* `local://<id>.log` its truncation notice names) and leaves only a truncated
|
|
11
|
+
* body in the transcript; before it the file was `<id>.<kind>.log` beside the
|
|
12
|
+
* session file. Nothing in Kabmo read either, so 65 real results (the longest
|
|
13
|
+
* in the corpus) stopped at the 768 bytes the transcript kept.
|
|
14
14
|
*
|
|
15
15
|
* The id and kind reach this module from a session transcript — a document the
|
|
16
16
|
* Kabmo reads, not one it wrote — so the guards ARE the test: a crafted id
|
|
@@ -49,8 +49,12 @@ beforeAll(async () => {
|
|
|
49
49
|
await fsp.writeFile(path.join(sessionDir, '420.bash.log'), 'full build log\nsecond line\n');
|
|
50
50
|
await fsp.writeFile(path.join(sessionDir, '213.eval.log'), 'eval output\n');
|
|
51
51
|
await fsp.writeFile(path.join(sessionDir, '420.read.log'), 'read output\n');
|
|
52
|
-
// 19.0.0: the spill is `<id>.log`
|
|
53
|
-
|
|
52
|
+
// 19.0.0: the spill is `<id>.log` under the session's `local://` root, no
|
|
53
|
+
// kind. The `local/` segment is load-bearing: omp 19.4.1 writes no bare
|
|
54
|
+
// `<id>.log` beside the session file (verified on a live install).
|
|
55
|
+
const localDir = path.join(sessionDir, 'local');
|
|
56
|
+
await fsp.mkdir(localDir, { recursive: true });
|
|
57
|
+
await fsp.writeFile(path.join(localDir, '500.log'), 'spilled by 19.0.0\n');
|
|
54
58
|
clearSessionFileCaches();
|
|
55
59
|
});
|
|
56
60
|
|
|
@@ -14,14 +14,16 @@
|
|
|
14
14
|
* served none of it, so those results were truncated at 768 bytes with no way
|
|
15
15
|
* to see the rest.
|
|
16
16
|
*
|
|
17
|
-
* omp 19.0.0 replaced `artifact://<id>` with a `local://<id>.log` file
|
|
18
|
-
*
|
|
19
|
-
* <sessionsDir>/<cwd-dir>/<sessionFile>.jsonl
|
|
20
|
-
* <sessionsDir>/<cwd-dir>/<sessionFile
|
|
21
|
-
*
|
|
22
|
-
* (
|
|
23
|
-
*
|
|
24
|
-
*
|
|
17
|
+
* omp 19.0.0 replaced `artifact://<id>` with a `local://<id>.log` file, so the
|
|
18
|
+
* layout is now:
|
|
19
|
+
* <sessionsDir>/<cwd-dir>/<sessionFile>.jsonl the transcript
|
|
20
|
+
* <sessionsDir>/<cwd-dir>/<sessionFile>/local/<id>.log the spilled stream
|
|
21
|
+
* The `local/` segment below the session dir is the `local://` root omp's own
|
|
22
|
+
* truncation notice names (`Use local://<id>.log:raw`); the 19.x spills on a
|
|
23
|
+
* live install all sit there. Before 19.0.0 the file carried the tool's kind in
|
|
24
|
+
* its name and sat beside the session (`<id>.<kind>.log`), and sessions
|
|
25
|
+
* recorded then still name one, so both layouts are read. The kind is no longer
|
|
26
|
+
* part of the path; a new spill is reported as `spill`.
|
|
25
27
|
*
|
|
26
28
|
* Every guard here is a path boundary: the id must be digits, the kind must be
|
|
27
29
|
* one of omp's own, and the resolved path must still sit inside the session's
|
|
@@ -35,6 +37,7 @@ import { existsSync } from 'node:fs';
|
|
|
35
37
|
import * as path from 'node:path';
|
|
36
38
|
import { findSessionFileById } from '@kabmo-labs/kabmo-omp/session-locator';
|
|
37
39
|
import { siblingDirForSession } from '@kabmo-labs/kabmo-omp/subagent/history-paths';
|
|
40
|
+
import { localRootForSessionFile } from '@/server/lib/omp/session/plans';
|
|
38
41
|
|
|
39
42
|
/** omp's legacy artifact kinds, from the filenames it wrote before 19.0.0. */
|
|
40
43
|
export const ARTIFACT_KINDS = ['bash', 'bash-original', 'eval', 'read', 'async'] as const;
|
|
@@ -81,13 +84,13 @@ async function readCapped(filePath: string, size: number, kind: ArtifactKind): P
|
|
|
81
84
|
* Read one spilled tool output, or null when the session, the id or the file
|
|
82
85
|
* cannot be resolved.
|
|
83
86
|
*
|
|
84
|
-
* The 19.0.0 layout is probed first: `<id>.log`
|
|
85
|
-
* root. A session recorded before the pin keeps
|
|
86
|
-
* kind
|
|
87
|
-
*
|
|
88
|
-
* `eval` and a `bash` artifact
|
|
89
|
-
*
|
|
90
|
-
* `ARTIFACT_KINDS` order wins.
|
|
87
|
+
* The 19.0.0 layout is probed first: `<id>.log` under the session's `local://`
|
|
88
|
+
* root (`<sessionDir>/local/`). A session recorded before the pin keeps
|
|
89
|
+
* `<id>.<kind>.log` beside the session file, where the kind is probed rather
|
|
90
|
+
* than required — a caller reading a transcript sees `artifactId` without the
|
|
91
|
+
* kind that produced it, and a session can hold an `eval` and a `bash` artifact
|
|
92
|
+
* under the same id (they are numbered per tool). The caller may pass the kind
|
|
93
|
+
* it knows; otherwise the first match in `ARTIFACT_KINDS` order wins.
|
|
91
94
|
*/
|
|
92
95
|
export async function readArtifact(
|
|
93
96
|
sessionId: string,
|
|
@@ -101,10 +104,11 @@ export async function readArtifact(
|
|
|
101
104
|
const dir = siblingDirForSession(sessionFile);
|
|
102
105
|
if (!existsSync(dir)) return null;
|
|
103
106
|
|
|
104
|
-
const
|
|
107
|
+
const localDir = localRootForSessionFile(sessionFile);
|
|
108
|
+
const spillPath = path.join(localDir, `${artifactId}.log`);
|
|
105
109
|
// Boundary check: the id is digits, but the resolved path is what actually
|
|
106
110
|
// reaches the filesystem.
|
|
107
|
-
if (spillPath.startsWith(`${
|
|
111
|
+
if (spillPath.startsWith(`${localDir}${path.sep}`)) {
|
|
108
112
|
const stat = await fsp.stat(spillPath).catch(() => null);
|
|
109
113
|
if (stat?.isFile()) return readCapped(spillPath, stat.size, 'spill');
|
|
110
114
|
}
|
|
@@ -56,6 +56,8 @@ import {
|
|
|
56
56
|
buildServerBundle,
|
|
57
57
|
findSource,
|
|
58
58
|
} from '@/server/lib/panels/build-targets.server';
|
|
59
|
+
import { buildPluginStylesheet } from '@/server/lib/panels/css.server';
|
|
60
|
+
import { pluginSourceWarnings } from '@/server/lib/panels/source-warnings.server';
|
|
59
61
|
|
|
60
62
|
/** Where a built plugin's output lands, relative to the plugin root. */
|
|
61
63
|
export const PLUGIN_BUILD_DIR = 'dist';
|
|
@@ -83,6 +85,8 @@ export interface PluginBuildResult {
|
|
|
83
85
|
reason?: string;
|
|
84
86
|
/** Output directory relative to the plugin root, when built. */
|
|
85
87
|
outDir?: string;
|
|
88
|
+
/** Source patterns that build, but drift from the kit's contract. */
|
|
89
|
+
warnings?: string[];
|
|
86
90
|
}
|
|
87
91
|
|
|
88
92
|
const INSTALL_TIMEOUT_MS = 300_000;
|
|
@@ -142,7 +146,9 @@ async function declaresDependencies(root: string): Promise<boolean> {
|
|
|
142
146
|
* - **The Kabmo's bundler.** One `Bun.build` per declared entry: the app
|
|
143
147
|
* entry shimmed for the browser, the server entry bundled for Bun. A plugin
|
|
144
148
|
* may declare either or both, and each half is built only when its source is
|
|
145
|
-
* present.
|
|
149
|
+
* present. An app entry also gets `dist/plugin.css`: Tailwind compiled from
|
|
150
|
+
* the plugin's own sources plus the UI kit, so its classes are not left to
|
|
151
|
+
* whatever the host's stylesheet happened to contain.
|
|
146
152
|
*
|
|
147
153
|
* The `dist/` purge happens only when Kabmo is about to WRITE something.
|
|
148
154
|
* A server-only plugin whose server half is emitted by its own tooling has
|
|
@@ -199,6 +205,16 @@ export async function buildPanelPlugin(root: string, manifest: PanelPluginManife
|
|
|
199
205
|
: await buildServerBundle(root, bundle.source, outdir);
|
|
200
206
|
if (!outcome.ok) return { status: 'failed', reason: describeBundleError(outcome.error) };
|
|
201
207
|
}
|
|
208
|
+
|
|
209
|
+
// Tailwind for the plugin's OWN source, after the JS build so its emitted
|
|
210
|
+
// CSS exists and can be appended. This is what makes a plugin's classes
|
|
211
|
+
// real: the host's stylesheet was generated before the plugin existed, so
|
|
212
|
+
// it cannot carry them. A plugin with its own build script owns this step,
|
|
213
|
+
// which is why it is inside the `else` arm.
|
|
214
|
+
if (appSource) {
|
|
215
|
+
const css = await buildPluginStylesheet(root, manifest);
|
|
216
|
+
if (!css.ok) return { status: 'failed', reason: `stylesheet: ${css.reason}` };
|
|
217
|
+
}
|
|
202
218
|
}
|
|
203
219
|
|
|
204
220
|
for (const entry of [manifest.app, manifest.server]) {
|
|
@@ -207,7 +223,8 @@ export async function buildPanelPlugin(root: string, manifest: PanelPluginManife
|
|
|
207
223
|
return { status: 'failed', reason: `the build produced no ${entry}` };
|
|
208
224
|
}
|
|
209
225
|
}
|
|
210
|
-
|
|
226
|
+
const warnings = await pluginSourceWarnings(root);
|
|
227
|
+
return { status: 'built', outDir: PLUGIN_BUILD_DIR, ...(warnings.length ? { warnings } : {}) };
|
|
211
228
|
}
|
|
212
229
|
|
|
213
230
|
/**
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The per-plugin stylesheet builder.
|
|
8
|
+
*
|
|
9
|
+
* The property this suite pins is the one the old contract could not give a
|
|
10
|
+
* plugin: a class it writes has a RULE. Before this pipeline, Tailwind ran only
|
|
11
|
+
* over the app's own sources, so `max-w-[37rem]` in a third-party panel matched
|
|
12
|
+
* nothing — no error, just a panel that looked different from every other one.
|
|
13
|
+
*
|
|
14
|
+
* A real Tailwind pass runs against a real temp plugin: the behaviour under
|
|
15
|
+
* test is the interaction between the host's `@theme`, the explicit source
|
|
16
|
+
* scan, and the authored CSS appended after it, and a stub would exercise none
|
|
17
|
+
* of those.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { afterEach, beforeEach, describe, expect, test } from 'bun:test';
|
|
21
|
+
import fs from 'node:fs';
|
|
22
|
+
import { tmpdir } from 'node:os';
|
|
23
|
+
import { join } from 'node:path';
|
|
24
|
+
|
|
25
|
+
import {
|
|
26
|
+
GENERATED_CSS_FILE,
|
|
27
|
+
buildPluginStylesheet,
|
|
28
|
+
extractThemeBlock,
|
|
29
|
+
pluginCssInput,
|
|
30
|
+
resolvePluginCssPath,
|
|
31
|
+
} from '@/server/lib/panels/css.server';
|
|
32
|
+
import type { PanelPluginManifest } from '@/shared/types';
|
|
33
|
+
|
|
34
|
+
let root = '';
|
|
35
|
+
|
|
36
|
+
const manifest: PanelPluginManifest = {
|
|
37
|
+
id: 'demo',
|
|
38
|
+
name: 'Demo',
|
|
39
|
+
version: '1.0.0',
|
|
40
|
+
app: 'dist/app.js',
|
|
41
|
+
css: 'panel.css',
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
function writeFile(relative: string, content: string): void {
|
|
45
|
+
const target = join(root, relative);
|
|
46
|
+
fs.mkdirSync(join(target, '..'), { recursive: true });
|
|
47
|
+
fs.writeFileSync(target, content);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
beforeEach(() => {
|
|
51
|
+
root = fs.mkdtempSync(join(tmpdir(), 'kabmo-plugin-css-'));
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
afterEach(() => {
|
|
55
|
+
fs.rmSync(root, { recursive: true, force: true });
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
describe('extractThemeBlock', () => {
|
|
59
|
+
test('returns the whole block even when a comment contains a brace', () => {
|
|
60
|
+
const css = [
|
|
61
|
+
'@import "tailwindcss";',
|
|
62
|
+
'@theme {',
|
|
63
|
+
' /* a comment with a } in it */',
|
|
64
|
+
' --color-ink: var(--theme-ink);',
|
|
65
|
+
'}',
|
|
66
|
+
'@layer base { :root { --x: 1; } }',
|
|
67
|
+
].join('\n');
|
|
68
|
+
|
|
69
|
+
expect(extractThemeBlock(css)).toBe(
|
|
70
|
+
['@theme {', ' /* a comment with a } in it */', ' --color-ink: var(--theme-ink);', '}'].join('\n'),
|
|
71
|
+
);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
test('null when the stylesheet has no theme', () => {
|
|
75
|
+
expect(extractThemeBlock('@layer base { :root { --x: 1; } }')).toBeNull();
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
describe('pluginCssInput', () => {
|
|
80
|
+
test('scans the plugin and the kit with automatic detection off', () => {
|
|
81
|
+
writeFile('src/app.tsx', 'export default {};');
|
|
82
|
+
|
|
83
|
+
const input = pluginCssInput(root, '@theme { --color-ink: red; }', '/kit/src');
|
|
84
|
+
|
|
85
|
+
expect(input).toContain('source(none)');
|
|
86
|
+
expect(input).toContain(`@source ${JSON.stringify(join(root, 'src'))};`);
|
|
87
|
+
expect(input).toContain('@source "/kit/src";');
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
describe('buildPluginStylesheet', () => {
|
|
92
|
+
test('compiles the plugin’s own classes against the host theme', async () => {
|
|
93
|
+
writeFile('src/app.tsx', 'export default () => <div class="bg-paper max-w-[37rem]" />;');
|
|
94
|
+
|
|
95
|
+
const result = await buildPluginStylesheet(root, manifest);
|
|
96
|
+
expect(result.ok).toBe(true);
|
|
97
|
+
|
|
98
|
+
const css = await Bun.file(join(root, GENERATED_CSS_FILE)).text();
|
|
99
|
+
// Both classes exist: one a theme token, one an arbitrary value the app
|
|
100
|
+
// never used — the exact case that used to be a silent no-op.
|
|
101
|
+
expect(css).toContain('.bg-paper');
|
|
102
|
+
expect(css).toContain('.max-w-\\[37rem\\]');
|
|
103
|
+
// The theme layer is moved onto the scope root, because the served sheet
|
|
104
|
+
// lives inside `@scope ([data-plugin-surface="demo"])`.
|
|
105
|
+
expect(css).toContain('@layer theme');
|
|
106
|
+
expect(css).toContain(':scope');
|
|
107
|
+
expect(css).not.toContain(':root, :host');
|
|
108
|
+
// Only the plugin's own sources were scanned.
|
|
109
|
+
expect(css).not.toContain('.prose-content');
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
test('appends authored CSS after the utilities', async () => {
|
|
113
|
+
writeFile('src/app.tsx', 'export default () => <div class="bg-paper" />;');
|
|
114
|
+
writeFile('panel.css', '.own-marker { color: red; }');
|
|
115
|
+
|
|
116
|
+
const result = await buildPluginStylesheet(root, manifest);
|
|
117
|
+
expect(result.ok).toBe(true);
|
|
118
|
+
|
|
119
|
+
const css = await Bun.file(join(root, GENERATED_CSS_FILE)).text();
|
|
120
|
+
expect(css.indexOf('.own-marker')).toBeGreaterThan(css.indexOf('.bg-paper'));
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
describe('resolvePluginCssPath', () => {
|
|
125
|
+
test('the generated sheet wins over a declared one', async () => {
|
|
126
|
+
writeFile('panel.css', '.a {}');
|
|
127
|
+
writeFile(GENERATED_CSS_FILE, '.b {}');
|
|
128
|
+
|
|
129
|
+
expect(resolvePluginCssPath(root, 'panel.css')).toBe(GENERATED_CSS_FILE);
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
test('a hand-built plugin keeps its declared sheet', () => {
|
|
133
|
+
writeFile('panel.css', '.a {}');
|
|
134
|
+
|
|
135
|
+
expect(resolvePluginCssPath(root, 'panel.css')).toBe('panel.css');
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
test('null when neither exists', () => {
|
|
139
|
+
expect(resolvePluginCssPath(root, 'panel.css')).toBeNull();
|
|
140
|
+
});
|
|
141
|
+
});
|