@kabmo-labs/kabmo 0.60.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-p82s28sj.js → Body-z6kstvk6.js} +3 -3
- package/dist/client/static/js/{CsvGrid-erc5mcvc.js → CsvGrid-f73c0s4e.js} +2 -2
- package/dist/client/static/js/{DocxView-x3faj0jv.js → DocxView-a1pb7nsb.js} +3 -3
- package/dist/client/static/js/{DrawioView-t7fh3ens.js → DrawioView-r61gcg24.js} +2 -2
- package/dist/client/static/js/{HtmlPreview-zy7x7jmm.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-kqx472q7.js → PdfView-mppt2gkd.js} +1 -1
- package/dist/client/static/js/SessionsView-vvsaw9f0.js +1 -0
- package/dist/client/static/js/{SheetView-0n9fze50.js → SheetView-5s9zfx9g.js} +9 -9
- package/dist/client/static/js/{SvgPreview-6xc6ts46.js → SvgPreview-ff78xn3e.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-2xdkkqwg.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-ja8cx19z.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-ytf7s99c.js → blockDiagram-BEXU5L5S-t8xbexa6.js} +6 -6
- package/dist/client/static/js/c-vvantfth.js +1 -0
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-5a0kdx0z.js → c4Diagram-YGBWAQC7-9fwf2zxk.js} +3 -3
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-hd98dvjw.js → classDiagram-v2-NBCMYWYE-nbapgqbs.js} +4 -4
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-man3fqcj.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-2f0kbbv2.js → cynefinDiagram-VND7K2PF-qdg32wah.js} +1 -1
- package/dist/client/static/js/{dagre-6A5THRUB-k7pyhgzn.js → dagre-6A5THRUB-qzshg1vs.js} +2 -2
- package/dist/client/static/js/{diagram-22UHCM2B-qx0afa2m.js → diagram-22UHCM2B-197hemfa.js} +11 -11
- package/dist/client/static/js/{diagram-3UASUU5V-ydpe77sv.js → diagram-3UASUU5V-236gnjr6.js} +1 -1
- package/dist/client/static/js/{diagram-ATOU4E4O-e63v984n.js → diagram-ATOU4E4O-vjgpyaaq.js} +3 -3
- package/dist/client/static/js/{diagram-CDSNMT55-8c765h3a.js → diagram-CDSNMT55-ywvzcx7z.js} +4 -4
- package/dist/client/static/js/{diagram-MLGK6HIB-3pq0n7v8.js → diagram-MLGK6HIB-9ey7ev7j.js} +1 -1
- package/dist/client/static/js/{diagram-MPIPVDR6-638atzxz.js → diagram-MPIPVDR6-vrqbb6r7.js} +2 -2
- package/dist/client/static/js/{dockerfile-yehc914q.js → dockerfile-4nked309.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-3gv43zvm.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-6s5pggfc.js → elk-276RUBZZ-nej6yy1c.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-x7cqyb89.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-g97te4v1.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-sw4f94tc.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-vejz38qt.js → index-0w1jzang.js} +5 -5
- package/dist/client/static/js/{index-bpcg34jp.js → index-1svt0cdw.js} +2 -2
- package/dist/client/static/js/{index-hgfyx8dt.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-pdz6j2g2.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-111bq6rs.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-hwdkxe4n.js → index-dxyjxhm1.js} +2 -2
- package/dist/client/static/js/{index-43gmn7yb.js → index-edpyqz9f.js} +1 -1
- package/dist/client/static/js/{index-pdgc9ccr.js → index-eesepb70.js} +2 -2
- package/dist/client/static/js/{index-vec7m1yd.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-vcq6zfxx.js → index-jcbp1d9d.js} +6 -6
- package/dist/client/static/js/index-jg5h18sm.js +2 -0
- package/dist/client/static/js/{index-6qn9kygb.js → index-jtdve6xw.js} +7 -7
- package/dist/client/static/js/{index-4xbc0j7t.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-2n2evsg0.js → index-kv1xnem9.js} +2 -2
- package/dist/client/static/js/{index-8zct30zd.js → index-m54ctmxr.js} +1 -1
- package/dist/client/static/js/index-mgzbypt5.js +314 -0
- package/dist/client/static/js/{index-cf69bhjx.js → index-mh52531j.js} +2 -2
- package/dist/client/static/js/{index-0ze5bwvw.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-9rz6kzsv.js → index-nxd6z7f9.js} +2 -2
- package/dist/client/static/js/{index-jfqd838j.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-cfvc1zpk.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-37apvxgj.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-z8k42dwz.js → index-w0j96eyy.js} +8 -8
- package/dist/client/static/js/{index-qkqkygrf.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-dv01prse.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-ywp0sd1e.js → index-zy963qbh.js} +1 -1
- package/dist/client/static/js/info-A6RAGUB7-t7pbg7rt.js +1 -0
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-pw2qaa27.js → infoDiagram-VRGFBTTK-9pe7w3r5.js} +2 -2
- package/dist/client/static/js/ini-522adp5a.js +1 -0
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-d13jhvxy.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-20gb8a04.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-s78e158c.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-xbm27k28.js → mermaid.core-3aae27b9.js} +7 -7
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-6y7xe2zm.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-dmvewetf.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-1q9e7rcm.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-mvrem3n6.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-axttcfhw.js → railroadDiagram-XR7U4H2S-70qy7qdh.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-5qx7erta.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-b3ckax3e.js → rust-6sddyxnt.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-es87a3j6.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-dgpnjrtk.js → sequenceDiagram-PO4LG4MO-w7z84f80.js} +7 -7
- package/dist/client/static/js/{sizeCapture-INFHLROL-kyw0p86n.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-vnsbw8y9.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-060q1rep.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-18sp73v7.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-q0kwmbzh.js → wardleyDiagram-VNRHLVJA-hjddd656.js} +3 -3
- package/dist/client/static/js/xml-59n0cjn6.js +1 -0
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-y0gpmg6m.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 -37
- package/src/client/components/workspace/panel-tabs/TabStrip.connected.test.tsx +76 -49
- 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-xc90jc1c.js +0 -1
- package/dist/client/static/js/LayoutWrapper-wyqe98kf.js +0 -2
- package/dist/client/static/js/MergeDiffView-bng34cpr.js +0 -1
- package/dist/client/static/js/Modal-89jk7wff.js +0 -60
- package/dist/client/static/js/SessionsView-6bpz1faj.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-7sn6nwjv.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-4h2zkrk1.js +0 -2
- package/dist/client/static/js/index-5nm8hm4k.js +0 -2
- package/dist/client/static/js/index-95jfphx5.js +0 -481
- package/dist/client/static/js/index-9pw441wc.js +0 -4
- package/dist/client/static/js/index-bjz54ht6.js +0 -1
- package/dist/client/static/js/index-bqapt2e8.js +0 -2
- package/dist/client/static/js/index-ddkjgv5h.js +0 -2
- package/dist/client/static/js/index-dekvtt2a.js +0 -314
- package/dist/client/static/js/index-fnwaxc6r.js +0 -1
- package/dist/client/static/js/index-h65zrhva.js +0 -1
- package/dist/client/static/js/index-hxsqw7sz.js +0 -4
- package/dist/client/static/js/index-hxy1sadd.js +0 -2
- package/dist/client/static/js/index-ja0ajnvq.js +0 -10
- package/dist/client/static/js/index-qkyy563e.js +0 -1
- package/dist/client/static/js/index-t6nqy2n5.css +0 -1
- package/dist/client/static/js/index-wrk99kks.js +0 -3
- 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-7bgqnyhm.js +0 -1
- package/dist/client/static/js/one-light-47y6etng.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-y77g9dq0.js +0 -8
- package/dist/client/static/js/timeline-definition-EJHVYXUP-8a3yqmx0.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-gf4y1r3s.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
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
listPairedDevices,
|
|
25
25
|
markDeviceConnected,
|
|
26
26
|
mintDeviceToken,
|
|
27
|
+
revokeDevice,
|
|
27
28
|
} from '@/server/lib/connect/devices.server';
|
|
28
29
|
import { isolateDb, releaseDb } from '@/test-support/isolated-db';
|
|
29
30
|
|
|
@@ -57,6 +58,17 @@ describe('last connect', () => {
|
|
|
57
58
|
expect(at).toBeLessThanOrEqual(Date.now());
|
|
58
59
|
});
|
|
59
60
|
|
|
61
|
+
test('each account sees and revokes only its own devices', async () => {
|
|
62
|
+
await mintDeviceToken({ name: 'Root phone', platform: 'ios', accountId: 'root' });
|
|
63
|
+
const alice = await mintDeviceToken({ name: 'Alice phone', platform: 'android', accountId: 'alice' });
|
|
64
|
+
|
|
65
|
+
expect((await listPairedDevices('root')).map((device) => device.name)).toEqual(['Root phone']);
|
|
66
|
+
expect((await listPairedDevices('alice')).map((device) => device.name)).toEqual(['Alice phone']);
|
|
67
|
+
expect(await revokeDevice(alice.id, 'root')).toBe(false);
|
|
68
|
+
expect(await revokeDevice(alice.id, 'alice')).toBe(true);
|
|
69
|
+
expect(await listPairedDevices('alice')).toHaveLength(0);
|
|
70
|
+
});
|
|
71
|
+
|
|
60
72
|
test('a burst of requests moves the timestamp once per window', async () => {
|
|
61
73
|
const device = await mintDeviceToken({ name: 'Phone', platform: 'ios' });
|
|
62
74
|
await markDeviceConnected(device.id);
|
|
@@ -26,6 +26,7 @@ interface DeviceRow {
|
|
|
26
26
|
name: string;
|
|
27
27
|
platform: string;
|
|
28
28
|
token_hash: string;
|
|
29
|
+
account_id: string | null;
|
|
29
30
|
route: string | null;
|
|
30
31
|
rtt_ms: number | null;
|
|
31
32
|
created_at: number;
|
|
@@ -37,6 +38,8 @@ declare global {
|
|
|
37
38
|
// eslint-disable-next-line no-var
|
|
38
39
|
var __kabmoDeviceTokens: Map<string, string> | undefined;
|
|
39
40
|
// eslint-disable-next-line no-var
|
|
41
|
+
var __kabmoDeviceAccounts: Map<string, string> | undefined;
|
|
42
|
+
// eslint-disable-next-line no-var
|
|
40
43
|
var __kabmoDeviceMarks: Map<string, number> | undefined;
|
|
41
44
|
}
|
|
42
45
|
|
|
@@ -45,6 +48,11 @@ function tokenCache(): Map<string, string> {
|
|
|
45
48
|
return globalThis.__kabmoDeviceTokens;
|
|
46
49
|
}
|
|
47
50
|
|
|
51
|
+
function accountCache(): Map<string, string> {
|
|
52
|
+
globalThis.__kabmoDeviceAccounts ??= new Map();
|
|
53
|
+
return globalThis.__kabmoDeviceAccounts;
|
|
54
|
+
}
|
|
55
|
+
|
|
48
56
|
/**
|
|
49
57
|
* How often one device's connect timestamp is written.
|
|
50
58
|
*
|
|
@@ -88,6 +96,7 @@ export async function ensureConnectSchema(db: DbClient): Promise<void> {
|
|
|
88
96
|
name TEXT NOT NULL,
|
|
89
97
|
platform TEXT NOT NULL,
|
|
90
98
|
token_hash TEXT NOT NULL UNIQUE,
|
|
99
|
+
account_id TEXT,
|
|
91
100
|
route TEXT,
|
|
92
101
|
rtt_ms INTEGER,
|
|
93
102
|
created_at INTEGER NOT NULL,
|
|
@@ -97,6 +106,11 @@ export async function ensureConnectSchema(db: DbClient): Promise<void> {
|
|
|
97
106
|
CREATE INDEX IF NOT EXISTS idx_paired_devices_token
|
|
98
107
|
ON paired_devices (token_hash);
|
|
99
108
|
`);
|
|
109
|
+
try {
|
|
110
|
+
await db.exec('ALTER TABLE paired_devices ADD COLUMN account_id TEXT');
|
|
111
|
+
} catch {
|
|
112
|
+
// Already added by a previous boot.
|
|
113
|
+
}
|
|
100
114
|
}
|
|
101
115
|
|
|
102
116
|
function hashToken(token: string): string {
|
|
@@ -108,11 +122,18 @@ export async function initDeviceTokens(): Promise<void> {
|
|
|
108
122
|
try {
|
|
109
123
|
const db = await getDb();
|
|
110
124
|
const rows = (await db.all(
|
|
111
|
-
'SELECT id, token_hash FROM paired_devices WHERE revoked_at IS NULL',
|
|
112
|
-
)) as { id: string; token_hash: string }[];
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
125
|
+
'SELECT id, token_hash, account_id FROM paired_devices WHERE revoked_at IS NULL',
|
|
126
|
+
)) as { id: string; token_hash: string; account_id: string | null }[];
|
|
127
|
+
const tokens = new Map<string, string>();
|
|
128
|
+
const accounts = new Map<string, string>();
|
|
129
|
+
for (const row of rows) {
|
|
130
|
+
tokens.set(row.token_hash, row.id);
|
|
131
|
+
// A device paired before accounts existed belongs to the owner who
|
|
132
|
+
// upgraded; the Connect page can revoke it like any other.
|
|
133
|
+
accounts.set(row.token_hash, row.account_id || 'root');
|
|
134
|
+
}
|
|
135
|
+
globalThis.__kabmoDeviceTokens = tokens;
|
|
136
|
+
globalThis.__kabmoDeviceAccounts = accounts;
|
|
116
137
|
} catch {
|
|
117
138
|
// A database opened before this table existed has no device credentials;
|
|
118
139
|
// the browser path is unaffected.
|
|
@@ -125,6 +146,15 @@ export function verifyDeviceToken(token: string | null): string | null {
|
|
|
125
146
|
return tokenCache().get(hashToken(token)) ?? null;
|
|
126
147
|
}
|
|
127
148
|
|
|
149
|
+
/** The account a device token acts as, or null. Synchronous: the gate. */
|
|
150
|
+
export function verifyDeviceAccount(token: string | null): { deviceId: string; accountId: string } | null {
|
|
151
|
+
if (!token) return null;
|
|
152
|
+
const hash = hashToken(token);
|
|
153
|
+
const deviceId = tokenCache().get(hash);
|
|
154
|
+
if (!deviceId) return null;
|
|
155
|
+
return { deviceId, accountId: accountCache().get(hash) || 'root' };
|
|
156
|
+
}
|
|
157
|
+
|
|
128
158
|
/**
|
|
129
159
|
* The cookie a shell sets after pairing.
|
|
130
160
|
*
|
|
@@ -162,29 +192,40 @@ export function readDeviceCookie(request: Request): string | null {
|
|
|
162
192
|
export async function mintDeviceToken(input: {
|
|
163
193
|
name: string;
|
|
164
194
|
platform: string;
|
|
195
|
+
accountId?: string;
|
|
165
196
|
}): Promise<{ id: string; token: string }> {
|
|
166
197
|
const id = crypto.randomUUID();
|
|
167
198
|
const token = `kabmo_device_${crypto.randomUUID().replace(/-/g, '')}`;
|
|
168
199
|
const hash = hashToken(token);
|
|
200
|
+
const accountId = input.accountId?.trim() || 'root';
|
|
169
201
|
const db = await getDb();
|
|
170
202
|
await db.run(
|
|
171
|
-
`INSERT INTO paired_devices (id, name, platform, token_hash, created_at)
|
|
172
|
-
VALUES (?, ?, ?, ?, ?)`,
|
|
173
|
-
[id, input.name.trim() || 'Device', input.platform.trim() || 'unknown', hash, Date.now()],
|
|
203
|
+
`INSERT INTO paired_devices (id, name, platform, token_hash, account_id, created_at)
|
|
204
|
+
VALUES (?, ?, ?, ?, ?, ?)`,
|
|
205
|
+
[id, input.name.trim() || 'Device', input.platform.trim() || 'unknown', hash, accountId, Date.now()],
|
|
174
206
|
);
|
|
175
207
|
tokenCache().set(hash, id);
|
|
208
|
+
accountCache().set(hash, accountId);
|
|
176
209
|
return { id, token };
|
|
177
210
|
}
|
|
178
211
|
|
|
179
212
|
/** Every device, newest first, revoked ones included so the page can say so. */
|
|
180
|
-
export async function listPairedDevices(): Promise<PairedDevice[]> {
|
|
213
|
+
export async function listPairedDevices(accountId?: string): Promise<PairedDevice[]> {
|
|
181
214
|
const db = await getDb();
|
|
182
|
-
const rows = (
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
215
|
+
const rows = (accountId
|
|
216
|
+
? await db.all(
|
|
217
|
+
`SELECT id, name, platform, route, rtt_ms, created_at, last_seen_at, revoked_at
|
|
218
|
+
FROM paired_devices
|
|
219
|
+
WHERE revoked_at IS NULL AND account_id = ?
|
|
220
|
+
ORDER BY created_at DESC`,
|
|
221
|
+
[accountId],
|
|
222
|
+
)
|
|
223
|
+
: await db.all(
|
|
224
|
+
`SELECT id, name, platform, route, rtt_ms, created_at, last_seen_at, revoked_at
|
|
225
|
+
FROM paired_devices
|
|
226
|
+
WHERE revoked_at IS NULL
|
|
227
|
+
ORDER BY created_at DESC`,
|
|
228
|
+
)) as DeviceRow[];
|
|
188
229
|
return rows.map((row) => ({
|
|
189
230
|
id: row.id,
|
|
190
231
|
name: row.name,
|
|
@@ -197,14 +238,17 @@ export async function listPairedDevices(): Promise<PairedDevice[]> {
|
|
|
197
238
|
}
|
|
198
239
|
|
|
199
240
|
/** Cut a device off. The token stops verifying on the next request. */
|
|
200
|
-
export async function revokeDevice(id: string): Promise<boolean> {
|
|
241
|
+
export async function revokeDevice(id: string, accountId?: string): Promise<boolean> {
|
|
201
242
|
const db = await getDb();
|
|
202
|
-
const row = (await db.get(
|
|
203
|
-
|
|
204
|
-
|
|
243
|
+
const row = (await db.get(
|
|
244
|
+
'SELECT token_hash, account_id FROM paired_devices WHERE id = ?',
|
|
245
|
+
[id],
|
|
246
|
+
)) as { token_hash: string; account_id: string | null } | undefined;
|
|
205
247
|
if (!row) return false;
|
|
248
|
+
if (accountId !== undefined && (row.account_id || 'root') !== accountId) return false;
|
|
206
249
|
await db.run('UPDATE paired_devices SET revoked_at = ? WHERE id = ?', [Date.now(), id]);
|
|
207
250
|
tokenCache().delete(row.token_hash);
|
|
251
|
+
accountCache().delete(row.token_hash);
|
|
208
252
|
connectMarks().delete(id);
|
|
209
253
|
return true;
|
|
210
254
|
}
|
|
@@ -35,6 +35,7 @@ export const PAIRING_TTL_MS = 5 * 60 * 1000;
|
|
|
35
35
|
export interface PendingPairing {
|
|
36
36
|
pairingId: string;
|
|
37
37
|
secretHash: string;
|
|
38
|
+
accountId: string;
|
|
38
39
|
candidates: ConnectCandidate[];
|
|
39
40
|
expiresAt: number;
|
|
40
41
|
/**
|
|
@@ -71,7 +72,7 @@ function sweep(now: number): void {
|
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
/** Mint a pairing and return the plaintext secret exactly once. */
|
|
74
|
-
export function createPairing(candidates: ConnectCandidate[]): {
|
|
75
|
+
export function createPairing(candidates: ConnectCandidate[], accountId = 'root'): {
|
|
75
76
|
pairingId: string;
|
|
76
77
|
secret: string;
|
|
77
78
|
expiresAt: string;
|
|
@@ -84,6 +85,7 @@ export function createPairing(candidates: ConnectCandidate[]): {
|
|
|
84
85
|
store().set(pairingId, {
|
|
85
86
|
pairingId,
|
|
86
87
|
secretHash: hashSecret(secret),
|
|
88
|
+
accountId,
|
|
87
89
|
candidates,
|
|
88
90
|
expiresAt,
|
|
89
91
|
qrPng: null,
|
|
@@ -124,7 +126,7 @@ export function pairingQr(pairingId: string): Uint8Array | null {
|
|
|
124
126
|
export function consumePairing(
|
|
125
127
|
pairingId: string,
|
|
126
128
|
secret: string,
|
|
127
|
-
): { ok: true; candidates: ConnectCandidate[] } | { ok: false; reason: string } {
|
|
129
|
+
): { ok: true; candidates: ConnectCandidate[]; accountId: string } | { ok: false; reason: string } {
|
|
128
130
|
const now = Date.now();
|
|
129
131
|
sweep(now);
|
|
130
132
|
const entry = store().get(pairingId);
|
|
@@ -137,7 +139,7 @@ export function consumePairing(
|
|
|
137
139
|
return { ok: false, reason: 'This pairing code does not match the one this server issued.' };
|
|
138
140
|
}
|
|
139
141
|
store().delete(pairingId);
|
|
140
|
-
return { ok: true, candidates: entry.candidates };
|
|
142
|
+
return { ok: true, candidates: entry.candidates, accountId: entry.accountId };
|
|
141
143
|
}
|
|
142
144
|
|
|
143
145
|
/** Drop every pending pairing. The tests use it; a running server has no reason to. */
|
|
@@ -147,11 +147,11 @@ function cloudflareState(port: number, configPath: string): { tunnel: TunnelStat
|
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
/** The whole page's payload. */
|
|
150
|
-
export async function connectStatus(): Promise<ConnectStatus> {
|
|
150
|
+
export async function connectStatus(accountId?: string): Promise<ConnectStatus> {
|
|
151
151
|
const port = currentPort();
|
|
152
152
|
const [tailscale, devices, configPath] = await Promise.all([
|
|
153
153
|
tailscaleState(),
|
|
154
|
-
listPairedDevices(),
|
|
154
|
+
listPairedDevices(accountId),
|
|
155
155
|
resolveCloudflaredConfigPath(),
|
|
156
156
|
]);
|
|
157
157
|
const cloudflare = cloudflareState(port, configPath);
|
|
@@ -25,9 +25,9 @@ import fs from 'fs';
|
|
|
25
25
|
import os from 'os';
|
|
26
26
|
import path from 'path';
|
|
27
27
|
|
|
28
|
-
import { hashPassword, readSessionSecret, verifyPassword, writeSessionSecret } from '
|
|
29
|
-
import { clientAddressFor, rememberClientAddress } from '
|
|
30
|
-
import { UNKNOWN_CLIENT_KEY } from '
|
|
28
|
+
import { hashPassword, readSessionSecret, verifyPassword, writeSessionSecret } from '@kabmo-labs/kabmo-auth/server/config';
|
|
29
|
+
import { clientAddressFor, rememberClientAddress } from '@kabmo-labs/kabmo-auth/server/client-address';
|
|
30
|
+
import { UNKNOWN_CLIENT_KEY } from '@kabmo-labs/kabmo-auth/server/rate-limit';
|
|
31
31
|
import { getAuthPath } from '@kabmo-labs/kabmo-paths/paths';
|
|
32
32
|
import { createDb } from '@kabmo-labs/kabmo-db/client';
|
|
33
33
|
import { removeDir } from '@/test-support/remove-dir';
|
|
@@ -28,6 +28,8 @@ import { ensurePromptHistorySchema } from '@/server/lib/chat/schema.server';
|
|
|
28
28
|
import { ensureSessionMcpSchema } from '@/server/lib/mcp/schema.server';
|
|
29
29
|
import { ensureNotificationSchema } from '@/server/lib/notifications/schema.server';
|
|
30
30
|
import { ensureConnectSchema } from '@/server/lib/connect/devices.server';
|
|
31
|
+
import { ensureAccountsSchema } from '@kabmo-labs/kabmo-auth/server/accounts';
|
|
32
|
+
import { ensureWorkspaceTenancySchema } from '@/server/lib/workspace/tenancy-schema.server';
|
|
31
33
|
import { ensureAcpGrantSchema } from '@kabmo-labs/kabmo-acp/session-core/grants.server';
|
|
32
34
|
import { migrateWorkspaceFolderColumns } from '@/shared/lib/workspace/schema-migrations';
|
|
33
35
|
import { migrateSessionStreamStateColumns } from '@/shared/lib/omp/session/schema-migrations';
|
|
@@ -43,6 +45,7 @@ export async function initSchema(db: DbClient): Promise<void> {
|
|
|
43
45
|
accent_color TEXT DEFAULT '',
|
|
44
46
|
icon TEXT DEFAULT 'default',
|
|
45
47
|
custom_icon_url TEXT,
|
|
48
|
+
owner_account_id TEXT DEFAULT 'root',
|
|
46
49
|
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
|
47
50
|
);
|
|
48
51
|
|
|
@@ -155,7 +158,10 @@ export async function initSchema(db: DbClient): Promise<void> {
|
|
|
155
158
|
);
|
|
156
159
|
`);
|
|
157
160
|
|
|
161
|
+
// Accounts must exist before workspace rows can name an owner.
|
|
162
|
+
await ensureAccountsSchema(db);
|
|
158
163
|
await migrateWorkspaceFolderColumns(db);
|
|
164
|
+
await ensureWorkspaceTenancySchema(db);
|
|
159
165
|
// Installs older `queued_messages` schemas carry an invalid FK (see the
|
|
160
166
|
// migration module); rebuild once so real-session queue inserts work.
|
|
161
167
|
await migrateQueueTableFk(db);
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The environment the detached update worker is spawned with.
|
|
8
|
+
*
|
|
9
|
+
* The failure this pins is the one a reboot exposed: the server launched by
|
|
10
|
+
* launchd has only `/usr/bin:/bin:/usr/sbin:/sbin`, the worker inherited it,
|
|
11
|
+
* and every step that runs a tool by name — `npm`, `claude update`, `opencode
|
|
12
|
+
* upgrade` — answered `Executable not found in $PATH`. The worker process is
|
|
13
|
+
* real here because the PATH it hands its own child is the fact under test.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { afterEach, beforeEach, expect } from 'bun:test';
|
|
17
|
+
import { mkdtempSync, readFileSync, rmSync } from 'node:fs';
|
|
18
|
+
import { tmpdir } from 'node:os';
|
|
19
|
+
import { join } from 'node:path';
|
|
20
|
+
import { spawnUpdateWorker } from '@/server/lib/harness/update-spawn.server';
|
|
21
|
+
import { getHarnessUpdateStatusPath } from '@kabmo-labs/kabmo-paths/paths';
|
|
22
|
+
import { readUpdateJob } from '@kabmo-labs/kabmo-harness/lease/update-job-store';
|
|
23
|
+
import { testPosix } from '@/test-support/platform';
|
|
24
|
+
import type { HarnessUpdateJob } from '@kabmo-labs/kabmo-harness/update-job/types';
|
|
25
|
+
|
|
26
|
+
let dir = '';
|
|
27
|
+
const realDataDir = Bun.env.KABMO_DATA_DIR;
|
|
28
|
+
const realPath = Bun.env.PATH;
|
|
29
|
+
const realProbe = Bun.env.FAKE_HARNESS_UPDATE_PROBE;
|
|
30
|
+
|
|
31
|
+
beforeEach(() => {
|
|
32
|
+
dir = mkdtempSync(join(tmpdir(), 'kabmo-update-spawn-'));
|
|
33
|
+
Bun.env.KABMO_DATA_DIR = dir;
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
afterEach(() => {
|
|
37
|
+
if (realDataDir === undefined) delete Bun.env.KABMO_DATA_DIR;
|
|
38
|
+
else Bun.env.KABMO_DATA_DIR = realDataDir;
|
|
39
|
+
if (realPath === undefined) delete Bun.env.PATH;
|
|
40
|
+
else Bun.env.PATH = realPath;
|
|
41
|
+
if (realProbe === undefined) delete Bun.env.FAKE_HARNESS_UPDATE_PROBE;
|
|
42
|
+
else Bun.env.FAKE_HARNESS_UPDATE_PROBE = realProbe;
|
|
43
|
+
rmSync(dir, { recursive: true, force: true });
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
function probeJob(): HarnessUpdateJob {
|
|
47
|
+
const script = `require('node:fs').writeFileSync(process.env.FAKE_HARNESS_UPDATE_PROBE, process.env.PATH ?? '')`;
|
|
48
|
+
return {
|
|
49
|
+
harness: 'claude',
|
|
50
|
+
label: 'claude',
|
|
51
|
+
startedAt: Date.now(),
|
|
52
|
+
finishedAt: null,
|
|
53
|
+
queuedAt: null,
|
|
54
|
+
pid: null,
|
|
55
|
+
steps: [{ part: 'probe', command: '<bun> -e <script>', argv: [process.execPath, '-e', script], state: 'pending', code: null }],
|
|
56
|
+
output: '',
|
|
57
|
+
ok: null,
|
|
58
|
+
message: null,
|
|
59
|
+
applied: false,
|
|
60
|
+
repointed: null,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The worker is a separate process: the record it writes is the completion
|
|
66
|
+
* signal. Polled rather than watched because a watcher that registers after the
|
|
67
|
+
* first write — or a platform whose `fs.watch` drops the event — leaves this
|
|
68
|
+
* suite at its timeout instead of failing on the record; the poll also proves
|
|
69
|
+
* the finished record exists on disk rather than that an event fired. Real time
|
|
70
|
+
* is unavoidable here: the signal is a DETACHED OS process writing a file, not
|
|
71
|
+
* an in-process promise, so fake timers cannot advance it.
|
|
72
|
+
*/
|
|
73
|
+
async function waitForFinish(statusPath: string): Promise<HarnessUpdateJob | null> {
|
|
74
|
+
const deadline = Date.now() + 15_000;
|
|
75
|
+
for (;;) {
|
|
76
|
+
const record = await readUpdateJob(statusPath);
|
|
77
|
+
if (record?.finishedAt) return record;
|
|
78
|
+
if (Date.now() >= deadline) return null;
|
|
79
|
+
await Bun.sleep(50);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
testPosix('the detached worker gets the repaired toolchain PATH', async () => {
|
|
84
|
+
const probe = join(dir, 'path.txt');
|
|
85
|
+
Bun.env.FAKE_HARNESS_UPDATE_PROBE = probe;
|
|
86
|
+
// What a login-entry launch actually inherits.
|
|
87
|
+
Bun.env.PATH = '/usr/bin:/bin';
|
|
88
|
+
const statusPath = getHarnessUpdateStatusPath('claude');
|
|
89
|
+
|
|
90
|
+
const finished = waitForFinish(statusPath);
|
|
91
|
+
await spawnUpdateWorker(probeJob());
|
|
92
|
+
|
|
93
|
+
expect((await finished)?.ok).toBe(true);
|
|
94
|
+
const path = readFileSync(probe, 'utf8');
|
|
95
|
+
expect(path.split(':')).toContain('/opt/homebrew/bin');
|
|
96
|
+
expect(path.split(':')).toContain(`${Bun.env.HOME}/.bun/bin`);
|
|
97
|
+
}, 20_000);
|
|
@@ -24,6 +24,8 @@ import { existsSync } from 'node:fs';
|
|
|
24
24
|
import { join } from 'node:path';
|
|
25
25
|
import { resolveBunBin } from '@/server/lib/lifecycle/bun';
|
|
26
26
|
import { packageDir } from '@/server/lib/fs/package-root';
|
|
27
|
+
import { childEnv } from '@kabmo-labs/kabmo-fs/child-env';
|
|
28
|
+
import { withToolchainPath } from '@kabmo-labs/kabmo-sdk';
|
|
27
29
|
import { getHarnessUpdateLockPath, getHarnessUpdateSpecPath, getHarnessUpdateStatusPath } from '@kabmo-labs/kabmo-paths/paths';
|
|
28
30
|
import { writeUpdateJob } from '@kabmo-labs/kabmo-harness/lease/update-job-store';
|
|
29
31
|
import type { HarnessUpdateJob, HarnessUpdateJobSpec } from '@kabmo-labs/kabmo-harness/update-job/types';
|
|
@@ -79,6 +81,14 @@ export async function spawnUpdateWorker(job: HarnessUpdateJob): Promise<HarnessU
|
|
|
79
81
|
const child = Bun.spawn({
|
|
80
82
|
cmd: [resolveBunBin(), worker, getHarnessUpdateSpecPath(job.harness)],
|
|
81
83
|
cwd: packageDir(),
|
|
84
|
+
// The worker's steps run `npm`, `claude update`, `opencode upgrade` — all
|
|
85
|
+
// looked up BY NAME. A login-entry launch (launchd) gives the server only
|
|
86
|
+
// `/usr/bin:/bin:/usr/sbin:/sbin`, so the worker inherited a PATH without
|
|
87
|
+
// Homebrew or `~/.bun/bin` and every harness update failed with
|
|
88
|
+
// `Executable not found in $PATH: "npm"` after a reboot. The same repair
|
|
89
|
+
// the ACP launch uses (`withToolchainPath`) applies here; `childEnv` keeps
|
|
90
|
+
// the UI credential out of a third-party install process.
|
|
91
|
+
env: withToolchainPath(childEnv(), process.platform),
|
|
82
92
|
stdin: 'ignore',
|
|
83
93
|
// Nothing is read back from stdio: the worker reports through the record, so
|
|
84
94
|
// the install cannot be wedged by a parent that stopped draining a pipe.
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Provider marks assigned in `models.yml` (`providerIcons`).
|
|
8
|
+
*
|
|
9
|
+
* Isolated DB because the synced picture is written to `provider_icons`, and a
|
|
10
|
+
* temp agent dir because the parser resolves a relative picture path against
|
|
11
|
+
* the file's own directory.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { afterEach, beforeEach, describe, expect, test } from 'bun:test';
|
|
15
|
+
import { mkdtempSync } from 'node:fs';
|
|
16
|
+
import { tmpdir } from 'node:os';
|
|
17
|
+
import { join, resolve } from 'node:path';
|
|
18
|
+
|
|
19
|
+
import { getDb } from '@/server/db.server';
|
|
20
|
+
import { isolateDb, releaseDb } from '@/test-support/isolated-db';
|
|
21
|
+
import { removeDir } from '@/test-support/remove-dir';
|
|
22
|
+
import { ensureProviderIconSchema } from '@/server/lib/models/provider-icon-store.server';
|
|
23
|
+
import {
|
|
24
|
+
parseProviderIcons,
|
|
25
|
+
syncProviderIconOverrides,
|
|
26
|
+
} from '@/server/lib/models/provider-icon-override.server';
|
|
27
|
+
import { stampProviderIcons } from '@/server/lib/models/provider-icon.server';
|
|
28
|
+
import type { ProviderItem } from '@/shared/types';
|
|
29
|
+
|
|
30
|
+
const PNG = new Uint8Array([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 1, 2, 3]);
|
|
31
|
+
let home: string;
|
|
32
|
+
let previousAgentDir: string | undefined;
|
|
33
|
+
|
|
34
|
+
beforeEach(async () => {
|
|
35
|
+
await isolateDb();
|
|
36
|
+
await ensureProviderIconSchema(await getDb());
|
|
37
|
+
home = mkdtempSync(join(tmpdir(), 'kabmo-icon-override-'));
|
|
38
|
+
previousAgentDir = Bun.env.PI_CODING_AGENT_DIR;
|
|
39
|
+
Bun.env.PI_CODING_AGENT_DIR = join(home, '.omp', 'agent');
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
afterEach(async () => {
|
|
43
|
+
if (previousAgentDir === undefined) delete Bun.env.PI_CODING_AGENT_DIR;
|
|
44
|
+
else Bun.env.PI_CODING_AGENT_DIR = previousAgentDir;
|
|
45
|
+
removeDir(home);
|
|
46
|
+
await releaseDb();
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
async function writeAgentFile(name: string, body: string | Uint8Array): Promise<string> {
|
|
50
|
+
const path = join(home, '.omp', 'agent', name);
|
|
51
|
+
await Bun.write(path, body);
|
|
52
|
+
return path;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function provider(slug: string): ProviderItem {
|
|
56
|
+
return {
|
|
57
|
+
id: `omp-native-${slug}`,
|
|
58
|
+
name: slug,
|
|
59
|
+
slug,
|
|
60
|
+
icon: slug,
|
|
61
|
+
status: 'connected',
|
|
62
|
+
configuredIn: 'models.yml',
|
|
63
|
+
inModelsYml: true,
|
|
64
|
+
models: [],
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
describe('parseProviderIcons', () => {
|
|
69
|
+
test('names, pictures and relative paths are read; junk is not', () => {
|
|
70
|
+
const parsed = parseProviderIcons({
|
|
71
|
+
acme: 'provider:openai',
|
|
72
|
+
bare: 'openai',
|
|
73
|
+
gateway: 'provider-icons/gateway.png',
|
|
74
|
+
home: '~/icons/home.png',
|
|
75
|
+
blank: ' ',
|
|
76
|
+
pathLike: 'some/icon',
|
|
77
|
+
object: { icon: 'openai' },
|
|
78
|
+
}, '/work/agent', '/Users/me');
|
|
79
|
+
|
|
80
|
+
expect(parsed.get('acme')).toEqual({ kind: 'icon', name: 'openai' });
|
|
81
|
+
expect(parsed.get('bare')).toEqual({ kind: 'icon', name: 'openai' });
|
|
82
|
+
// The parser resolves a relative picture against the file's directory and
|
|
83
|
+
// joins `~/…` under the home directory; both are `node:path`, so the
|
|
84
|
+
// expected string is the platform's spelling, not a POSIX literal.
|
|
85
|
+
expect(parsed.get('gateway')).toEqual({
|
|
86
|
+
kind: 'image',
|
|
87
|
+
path: resolve('/work/agent', 'provider-icons/gateway.png'),
|
|
88
|
+
});
|
|
89
|
+
expect(parsed.get('home')).toEqual({ kind: 'image', path: join('/Users/me', 'icons/home.png') });
|
|
90
|
+
expect(parsed.has('blank')).toBe(false);
|
|
91
|
+
expect(parsed.has('pathlike')).toBe(false);
|
|
92
|
+
expect(parsed.has('object')).toBe(false);
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
describe('syncProviderIconOverrides', () => {
|
|
97
|
+
test('an omp icon name replaces the glyph the item would resolve from its slug', async () => {
|
|
98
|
+
await writeAgentFile('models.yml', 'providerIcons:\n acme: provider:openai\n');
|
|
99
|
+
const [stamped] = await stampProviderIcons([provider('acme')]);
|
|
100
|
+
expect(stamped.icon).toBe('openai');
|
|
101
|
+
expect(stamped.iconUrl).toBeUndefined();
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
test('a picture becomes the provider icon and leaves when the entry is removed', async () => {
|
|
105
|
+
await writeAgentFile('provider-icons/gateway.png', PNG);
|
|
106
|
+
await writeAgentFile('models.yml', 'providerIcons:\n gateway: provider-icons/gateway.png\n');
|
|
107
|
+
|
|
108
|
+
const [stamped] = await stampProviderIcons([provider('gateway')]);
|
|
109
|
+
expect(stamped.iconUrl).toContain('/api/provider-icon?slug=gateway');
|
|
110
|
+
|
|
111
|
+
const stored = await syncProviderIconOverrides(await getDb());
|
|
112
|
+
expect(stored.overridden.has('gateway')).toBe(true);
|
|
113
|
+
|
|
114
|
+
await writeAgentFile('models.yml', 'providerIcons: {}\n');
|
|
115
|
+
const [after] = await stampProviderIcons([provider('gateway')]);
|
|
116
|
+
expect(after.iconUrl).toBeUndefined();
|
|
117
|
+
// The old row is gone, so the next fetch is from the site rather than a
|
|
118
|
+
// stale user picture.
|
|
119
|
+
const cleared = await syncProviderIconOverrides(await getDb());
|
|
120
|
+
expect(cleared.overridden.size).toBe(0);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
test('a picture that cannot be read falls back instead of serving bytes', async () => {
|
|
124
|
+
await writeAgentFile('models.yml', 'providerIcons:\n gateway: provider-icons/missing.png\n');
|
|
125
|
+
const [stamped] = await stampProviderIcons([provider('gateway')]);
|
|
126
|
+
expect(stamped.iconUrl).toBeUndefined();
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
test('a picture that appears later is picked up on the next paint', async () => {
|
|
130
|
+
// The failure row must not blind the sync: a permission fix can leave the
|
|
131
|
+
// file's mtime unchanged, so only the failed row's marker keeps it retrying.
|
|
132
|
+
await writeAgentFile('models.yml', 'providerIcons:\n gateway: provider-icons/late.png\n');
|
|
133
|
+
const [before] = await stampProviderIcons([provider('gateway')]);
|
|
134
|
+
expect(before.iconUrl).toBeUndefined();
|
|
135
|
+
|
|
136
|
+
await writeAgentFile('provider-icons/late.png', PNG);
|
|
137
|
+
const [after] = await stampProviderIcons([provider('gateway')]);
|
|
138
|
+
expect(after.iconUrl).toContain('/api/provider-icon?slug=gateway');
|
|
139
|
+
});
|
|
140
|
+
});
|