@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,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Who may see which workspace folder.
|
|
8
|
+
*
|
|
9
|
+
* Access is by PATH as well as by row because omp sessions are discovered from
|
|
10
|
+
* a directory, not from a foreign key. One project path therefore belongs to
|
|
11
|
+
* exactly one workspace row; sharing is the only way a second account gets the
|
|
12
|
+
* same sessions.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import type { DbClient } from '@kabmo-labs/kabmo-db/client';
|
|
16
|
+
import { projectPathKey } from '@kabmo-labs/kabmo-omp/paths';
|
|
17
|
+
|
|
18
|
+
export interface WorkspaceFolderRow {
|
|
19
|
+
id: number;
|
|
20
|
+
name: string;
|
|
21
|
+
is_expanded?: number | null;
|
|
22
|
+
project_path?: string | null;
|
|
23
|
+
model?: string | null;
|
|
24
|
+
accent_color?: string | null;
|
|
25
|
+
icon?: string | null;
|
|
26
|
+
custom_icon_url?: string | null;
|
|
27
|
+
is_pinned?: number | null;
|
|
28
|
+
owner_account_id?: string | null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export type FolderAccessKind = 'owner' | 'shared';
|
|
32
|
+
|
|
33
|
+
export interface FolderAccess {
|
|
34
|
+
folder: WorkspaceFolderRow;
|
|
35
|
+
access: FolderAccessKind;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const ACCESS_QUERY = `
|
|
39
|
+
SELECT DISTINCT f.*
|
|
40
|
+
FROM workspace_folders f
|
|
41
|
+
LEFT JOIN workspace_folder_shares s ON s.folder_id = f.id
|
|
42
|
+
WHERE f.owner_account_id = ? OR s.account_id = ?
|
|
43
|
+
ORDER BY f.id ASC
|
|
44
|
+
`;
|
|
45
|
+
|
|
46
|
+
/** Every folder one account may render or use. */
|
|
47
|
+
export async function accessibleFolderRows(db: DbClient, accountId: string): Promise<WorkspaceFolderRow[]> {
|
|
48
|
+
return db.all<WorkspaceFolderRow>(ACCESS_QUERY, [accountId, accountId]);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** One folder and how the account reaches it, or null when it may not. */
|
|
52
|
+
export async function folderAccess(
|
|
53
|
+
db: DbClient,
|
|
54
|
+
accountId: string,
|
|
55
|
+
folderId: string | number,
|
|
56
|
+
): Promise<FolderAccess | null> {
|
|
57
|
+
const row = await db.get<WorkspaceFolderRow & { share_account: string | null }>(
|
|
58
|
+
`SELECT f.*, s.account_id AS share_account
|
|
59
|
+
FROM workspace_folders f
|
|
60
|
+
LEFT JOIN workspace_folder_shares s ON s.folder_id = f.id AND s.account_id = ?
|
|
61
|
+
WHERE f.id = ?`,
|
|
62
|
+
[accountId, folderId],
|
|
63
|
+
);
|
|
64
|
+
if (!row) return null;
|
|
65
|
+
if (row.owner_account_id === accountId) return { folder: row, access: 'owner' };
|
|
66
|
+
if (row.share_account) return { folder: row, access: 'shared' };
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export async function ownedFolderRow(
|
|
71
|
+
db: DbClient,
|
|
72
|
+
accountId: string,
|
|
73
|
+
folderId: string | number,
|
|
74
|
+
): Promise<WorkspaceFolderRow | null> {
|
|
75
|
+
const row = await db.get<WorkspaceFolderRow>(
|
|
76
|
+
'SELECT * FROM workspace_folders WHERE id = ? AND owner_account_id = ?',
|
|
77
|
+
[folderId, accountId],
|
|
78
|
+
);
|
|
79
|
+
return row ?? null;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** True when a path is inside one of the account's accessible workspaces. */
|
|
83
|
+
export async function canAccessProjectPath(
|
|
84
|
+
db: DbClient,
|
|
85
|
+
accountId: string,
|
|
86
|
+
targetPath: string | null | undefined,
|
|
87
|
+
): Promise<boolean> {
|
|
88
|
+
if (!targetPath) return false;
|
|
89
|
+
const target = projectPathKey(targetPath);
|
|
90
|
+
const rows = await accessibleFolderRows(db, accountId);
|
|
91
|
+
return rows.some((row) => typeof row.project_path === 'string' && projectPathKey(row.project_path) === target);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** Display names for the accounts a folder is shared with. */
|
|
95
|
+
export async function folderShares(
|
|
96
|
+
db: DbClient,
|
|
97
|
+
folderId: number,
|
|
98
|
+
): Promise<Array<{ accountId: string; name: string }>> {
|
|
99
|
+
const rows = await db.all<{ account_id: string; name: string }>(
|
|
100
|
+
`SELECT s.account_id, a.name
|
|
101
|
+
FROM workspace_folder_shares s
|
|
102
|
+
JOIN accounts a ON a.id = s.account_id
|
|
103
|
+
WHERE s.folder_id = ?
|
|
104
|
+
ORDER BY lower(a.name) ASC`,
|
|
105
|
+
[folderId],
|
|
106
|
+
);
|
|
107
|
+
return rows.map((row) => ({ accountId: row.account_id, name: row.name }));
|
|
108
|
+
}
|
|
@@ -80,8 +80,10 @@ export async function prepareProjectPatch(
|
|
|
80
80
|
|
|
81
81
|
if (patch.name !== undefined) {
|
|
82
82
|
const clash = await db.get<{ id: number }>(
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
`SELECT id FROM workspace_folders
|
|
84
|
+
WHERE lower(name) = lower(?) AND id != ?
|
|
85
|
+
AND owner_account_id = (SELECT owner_account_id FROM workspace_folders WHERE id = ?)`,
|
|
86
|
+
[patch.name, folderId, folderId],
|
|
85
87
|
);
|
|
86
88
|
if (clash) {
|
|
87
89
|
return {
|
|
@@ -33,7 +33,7 @@ import { emitRealtimeSignal } from '@kabmo-labs/kabmo-realtime-signals';
|
|
|
33
33
|
|
|
34
34
|
export type RegisterFolderResult =
|
|
35
35
|
| { ok: true; id: number; name: string }
|
|
36
|
-
| { ok: false; code: 'duplicate_name'; error: string };
|
|
36
|
+
| { ok: false; code: 'duplicate_name' | 'duplicate_path'; error: string };
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* The name a folder is listed under when the caller did not supply one: the
|
|
@@ -47,15 +47,29 @@ export function defaultFolderName(projectPath: string): string {
|
|
|
47
47
|
|
|
48
48
|
export async function registerWorkspaceFolder(
|
|
49
49
|
db: DbClient,
|
|
50
|
-
input: { name: string; projectPath: string | null },
|
|
50
|
+
input: { name: string; projectPath: string | null; ownerAccountId: string },
|
|
51
51
|
): Promise<RegisterFolderResult> {
|
|
52
|
-
const existing = await db.get(
|
|
52
|
+
const existing = await db.get(
|
|
53
|
+
'SELECT id FROM workspace_folders WHERE lower(name) = lower(?) AND owner_account_id = ?',
|
|
54
|
+
[input.name, input.ownerAccountId],
|
|
55
|
+
);
|
|
53
56
|
if (existing) {
|
|
54
57
|
return { ok: false, code: 'duplicate_name', error: 'A workspace with this name already exists' };
|
|
55
58
|
}
|
|
56
59
|
|
|
57
60
|
if (input.projectPath) {
|
|
58
61
|
const target = projectPathKey(input.projectPath);
|
|
62
|
+
const bound = await db.all<{ name: string; project_path: string | null }>(
|
|
63
|
+
'SELECT name, project_path FROM workspace_folders WHERE project_path IS NOT NULL',
|
|
64
|
+
);
|
|
65
|
+
const duplicate = bound.find((row) => row.project_path && projectPathKey(row.project_path) === target);
|
|
66
|
+
if (duplicate) {
|
|
67
|
+
return {
|
|
68
|
+
ok: false,
|
|
69
|
+
code: 'duplicate_path',
|
|
70
|
+
error: `${duplicate.name} is already bound to ${input.projectPath}`,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
59
73
|
const tombstones = await db.all<{ project_path: string | null }>(
|
|
60
74
|
'SELECT project_path FROM deleted_workspaces',
|
|
61
75
|
);
|
|
@@ -67,8 +81,8 @@ export async function registerWorkspaceFolder(
|
|
|
67
81
|
}
|
|
68
82
|
|
|
69
83
|
const result = await db.run(
|
|
70
|
-
'INSERT INTO workspace_folders (name, is_expanded, project_path) VALUES (?, 1, ?)',
|
|
71
|
-
[input.name, input.projectPath],
|
|
84
|
+
'INSERT INTO workspace_folders (name, is_expanded, project_path, owner_account_id) VALUES (?, 1, ?, ?)',
|
|
85
|
+
[input.name, input.projectPath, input.ownerAccountId],
|
|
72
86
|
);
|
|
73
87
|
|
|
74
88
|
void syncDiscoveryRootsWatch();
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Whether an account may open one chat.
|
|
8
|
+
*
|
|
9
|
+
* A chat has no folder foreign key in omp's store: it is filed by the project
|
|
10
|
+
* root its cwd resolves to. Access therefore resolves the same way the sidebar
|
|
11
|
+
* does — project root matches an accessible folder — and falls back to the ACP
|
|
12
|
+
* row's own `account_id` when the row carries one.
|
|
13
|
+
*
|
|
14
|
+
* `unknown` is a deliberate third answer. Static session routes and ids a scan
|
|
15
|
+
* has not seen yet must reach their handler, which owns the 404; refusing them
|
|
16
|
+
* here would turn a mistaken URL into a permission error and hide the real one.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { getDb } from '@kabmo-labs/kabmo-db/lifecycle';
|
|
20
|
+
import { projectPathKey } from '@kabmo-labs/kabmo-omp/paths';
|
|
21
|
+
import { loadOmpSidebarData } from '@kabmo-labs/kabmo-omp/session-reader';
|
|
22
|
+
import { accessibleFolderRows, folderAccess } from '@/server/lib/workspace/access.server';
|
|
23
|
+
|
|
24
|
+
export type SessionAccess = 'allowed' | 'denied' | 'unknown';
|
|
25
|
+
|
|
26
|
+
export async function sessionAccess(accountId: string, sessionId: string): Promise<SessionAccess> {
|
|
27
|
+
const db = await getDb();
|
|
28
|
+
const mock = await db.get<{ folder_id: number }>('SELECT folder_id FROM sessions WHERE id = ?', [sessionId]);
|
|
29
|
+
if (mock) {
|
|
30
|
+
return (await folderAccess(db, accountId, mock.folder_id)) ? 'allowed' : 'denied';
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const acp = await db.get<{ account_id: string; cwd: string }>(
|
|
34
|
+
'SELECT account_id, cwd FROM harness_sessions WHERE session_id = ?',
|
|
35
|
+
[sessionId],
|
|
36
|
+
);
|
|
37
|
+
const rows = await accessibleFolderRows(db, accountId);
|
|
38
|
+
const rootKeys = new Set(
|
|
39
|
+
rows
|
|
40
|
+
.map((row) => row.project_path)
|
|
41
|
+
.filter((value): value is string => typeof value === 'string' && value.length > 0)
|
|
42
|
+
.map((value) => projectPathKey(value)),
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
if (acp) {
|
|
46
|
+
if (acp.account_id && acp.account_id === accountId) return 'allowed';
|
|
47
|
+
return acp.cwd && rootKeys.has(projectPathKey(acp.cwd)) ? 'allowed' : 'denied';
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const data = await loadOmpSidebarData();
|
|
51
|
+
const session = data.sessions.find((entry) => entry.id === sessionId);
|
|
52
|
+
if (!session) return 'unknown';
|
|
53
|
+
const root = session.projectRoot || session.cwd;
|
|
54
|
+
return root && rootKeys.has(projectPathKey(root)) ? 'allowed' : 'denied';
|
|
55
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Workspace tenancy: who owns a folder and which other accounts may use it.
|
|
8
|
+
*
|
|
9
|
+
* `owner_account_id` is added in place because an install may already hold
|
|
10
|
+
* dozens of curated folders. Existing rows belong to the root account — the
|
|
11
|
+
* only account that existed before this migration.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import type { DbClient } from '@kabmo-labs/kabmo-db/client';
|
|
15
|
+
|
|
16
|
+
export async function ensureWorkspaceTenancySchema(db: DbClient): Promise<void> {
|
|
17
|
+
await db.exec(`
|
|
18
|
+
CREATE TABLE IF NOT EXISTS workspace_folder_shares (
|
|
19
|
+
folder_id INTEGER NOT NULL REFERENCES workspace_folders(id) ON DELETE CASCADE,
|
|
20
|
+
account_id TEXT NOT NULL REFERENCES accounts(id) ON DELETE CASCADE,
|
|
21
|
+
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
22
|
+
PRIMARY KEY (folder_id, account_id)
|
|
23
|
+
);
|
|
24
|
+
CREATE INDEX IF NOT EXISTS idx_workspace_folder_shares_account
|
|
25
|
+
ON workspace_folder_shares (account_id, folder_id);
|
|
26
|
+
CREATE TABLE IF NOT EXISTS workspace_folder_user_state (
|
|
27
|
+
folder_id INTEGER NOT NULL REFERENCES workspace_folders(id) ON DELETE CASCADE,
|
|
28
|
+
account_id TEXT NOT NULL REFERENCES accounts(id) ON DELETE CASCADE,
|
|
29
|
+
is_expanded INTEGER,
|
|
30
|
+
is_pinned INTEGER,
|
|
31
|
+
PRIMARY KEY (folder_id, account_id)
|
|
32
|
+
);
|
|
33
|
+
`);
|
|
34
|
+
try {
|
|
35
|
+
await db.exec("ALTER TABLE workspace_folders ADD COLUMN owner_account_id TEXT DEFAULT 'root'");
|
|
36
|
+
} catch {
|
|
37
|
+
// Already present.
|
|
38
|
+
}
|
|
39
|
+
await db.run("UPDATE workspace_folders SET owner_account_id = 'root' WHERE owner_account_id IS NULL OR owner_account_id = ''");
|
|
40
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Elysia } from 'elysia';
|
|
2
2
|
import { getDb } from '@/server/db.server';
|
|
3
|
-
import { isAuthEnabled, isAuthenticatedRequest } from '@/server/lib/auth/guard';
|
|
3
|
+
import { authenticatedAccount, isAuthEnabled, isAuthenticatedRequest } from '@/server/lib/auth/guard';
|
|
4
|
+
import { accountCount } from '@kabmo-labs/kabmo-auth/server/accounts';
|
|
4
5
|
import { tryServeStatic } from '@/server/plugins/static';
|
|
5
6
|
import { maybeCompress } from '@/server/plugins/compress';
|
|
6
7
|
import { renderShell, SHELL_MARKER } from '@/server/plugins/shell.server';
|
|
@@ -26,7 +27,7 @@ import { applyShellDocumentFacts } from '@/server/lib/assets/shell-attributes.se
|
|
|
26
27
|
import { splitShellSettings } from '@/server/lib/assets/shell-settings.server';
|
|
27
28
|
import { SURFACE_STYLE_SETTING_KEY } from '@/shared/lib/theme/surface-style';
|
|
28
29
|
import { BORDER_STYLE_SETTING_KEY } from '@/shared/lib/theme/border-style';
|
|
29
|
-
import { CHROME_STYLE_SETTING_KEY } from '@/shared/lib/theme/chrome-style';
|
|
30
|
+
import { CHROME_STYLE_SETTING_KEY, MOBILE_CHROME_STYLE_SETTING_KEY } from '@/shared/lib/theme/chrome-style';
|
|
30
31
|
import { ICON_STYLE_SETTING_KEY } from '@/shared/lib/theme/icon-style';
|
|
31
32
|
import { windowChromeColor } from '@/shared/lib/theme/chrome';
|
|
32
33
|
import { THEME_CSS_ROUTE, customThemeStyleElement, serveThemeCss } from '@/server/lib/assets/theme-css.server';
|
|
@@ -261,7 +262,21 @@ export const ssrRoutes = new Elysia({ name: 'ssr' }).get('*', async ({ request }
|
|
|
261
262
|
// questions: "this browser has a session" versus "there is a session to have".
|
|
262
263
|
// A Kabmo running open answers `authenticated: true` for every visitor, so
|
|
263
264
|
// the navbar cannot use it to decide whether a sign-out control applies.
|
|
264
|
-
const
|
|
265
|
+
const account = authenticated && isAuthEnabled() ? authenticatedAccount(request) : null;
|
|
266
|
+
const bootstrap = JSON.stringify({
|
|
267
|
+
initialIsMobile,
|
|
268
|
+
shellVersion: androidVersion,
|
|
269
|
+
iosShellVersion: iosVersion,
|
|
270
|
+
isAndroid,
|
|
271
|
+
authenticated,
|
|
272
|
+
authEnabled: isAuthEnabled(),
|
|
273
|
+
account: account ? { id: account.id, name: account.name, role: account.role } : null,
|
|
274
|
+
accountCount: isAuthEnabled() ? accountCount() : 1,
|
|
275
|
+
production: !DEV_ASSETS_ENABLED,
|
|
276
|
+
lastOpenedSessionId,
|
|
277
|
+
appSettings: publishedSettings,
|
|
278
|
+
customThemes,
|
|
279
|
+
}).replace(/</g, '\\u003c');
|
|
265
280
|
// The template's own `<meta name="theme-color">` is REWRITTEN, not joined by
|
|
266
281
|
// a second tag: with both present Chrome reads the first one, so an appended
|
|
267
282
|
// tag would leave a dark theme painting light browser chrome.
|
|
@@ -309,6 +324,7 @@ export const ssrRoutes = new Elysia({ name: 'ssr' }).get('*', async ({ request }
|
|
|
309
324
|
surfaceStyle: readSettingsBlob(settings)[SURFACE_STYLE_SETTING_KEY],
|
|
310
325
|
borderStyle: readSettingsBlob(settings)[BORDER_STYLE_SETTING_KEY],
|
|
311
326
|
chromeStyle: readSettingsBlob(settings)[CHROME_STYLE_SETTING_KEY],
|
|
327
|
+
mobileChromeStyle: readSettingsBlob(settings)[MOBILE_CHROME_STYLE_SETTING_KEY],
|
|
312
328
|
iconStyle: readSettingsBlob(settings)[ICON_STYLE_SETTING_KEY],
|
|
313
329
|
chromeColor: chrome,
|
|
314
330
|
})
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { bindingsFor, type HandlerBinding } from '@/server/lib/route-adapter';
|
|
2
|
+
import * as accounts from '@/server/routes/accounts/management';
|
|
3
|
+
|
|
4
|
+
export const accountsBindings: HandlerBinding[] = [
|
|
5
|
+
...bindingsFor(accounts, '/api/accounts'),
|
|
6
|
+
{ method: 'POST', path: '/api/accounts/:accountId/password', handler: accounts.action },
|
|
7
|
+
...bindingsFor(accounts, '/api/accounts/:accountId', { mutating: ['POST', 'PATCH', 'DELETE'] }),
|
|
8
|
+
];
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Accounts: root login, member login, the self-only list, password reset and
|
|
8
|
+
* workspace sharing. Runs against a throwaway database and data directory
|
|
9
|
+
* because `initAuth` and the account cache are process-wide.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { afterEach, beforeEach, describe, expect, test } from 'bun:test';
|
|
13
|
+
import fs from 'node:fs';
|
|
14
|
+
import os from 'node:os';
|
|
15
|
+
import path from 'node:path';
|
|
16
|
+
|
|
17
|
+
import { isolateDb, releaseDb } from '@/test-support/isolated-db';
|
|
18
|
+
import { getDb } from '@/server/db.server';
|
|
19
|
+
import { initAccounts, resetAccountCacheForTests, createAccount } from '@kabmo-labs/kabmo-auth/server/accounts';
|
|
20
|
+
import { initAuth, loadAuthConfig, authenticatedAccount } from '@/server/lib/auth/guard';
|
|
21
|
+
import { action as login } from '@/server/routes/auth/login';
|
|
22
|
+
import { resetLoginRateLimits } from '@kabmo-labs/kabmo-auth/server/rate-limit';
|
|
23
|
+
import { loader as state } from '@/server/routes/auth/state';
|
|
24
|
+
import { action as accountsAction, loader as accountsLoader } from '@/server/routes/accounts/management';
|
|
25
|
+
import { action as sharesAction } from '@/server/routes/folders/shares';
|
|
26
|
+
import { registerWorkspaceFolder } from '@/server/lib/workspace/register-folder.server';
|
|
27
|
+
import { accessibleFolderRows } from '@/server/lib/workspace/access.server';
|
|
28
|
+
|
|
29
|
+
const PASSWORD = 'root-password-1';
|
|
30
|
+
let dataDir = '';
|
|
31
|
+
let rootCookie = '';
|
|
32
|
+
|
|
33
|
+
function post(url: string, body: unknown, cookie?: string): Request {
|
|
34
|
+
return new Request(url, {
|
|
35
|
+
method: 'POST',
|
|
36
|
+
headers: { 'content-type': 'application/json', ...(cookie ? { cookie } : {}) },
|
|
37
|
+
body: JSON.stringify(body),
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function cookieOf(response: Response): string {
|
|
42
|
+
const header = response.headers.get('set-cookie') ?? '';
|
|
43
|
+
const match = /(omp_session(?:_\d+)?)=([^;]*)/.exec(header);
|
|
44
|
+
return match ? `${match[1]}=${match[2]}` : '';
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async function body(response: Response): Promise<Record<string, unknown>> {
|
|
48
|
+
return (await response.json()) as Record<string, unknown>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
beforeEach(async () => {
|
|
52
|
+
await isolateDb();
|
|
53
|
+
dataDir = fs.mkdtempSync(path.join(os.tmpdir(), 'kabmo-accounts-'));
|
|
54
|
+
Bun.env.KABMO_DATA_DIR = dataDir;
|
|
55
|
+
Bun.env.SYNC_WORKSPACE = 'false';
|
|
56
|
+
resetLoginRateLimits();
|
|
57
|
+
await initAuth(PASSWORD);
|
|
58
|
+
await initAccounts();
|
|
59
|
+
const response = (await login({
|
|
60
|
+
request: post('http://localhost/api/auth/login', { password: PASSWORD }),
|
|
61
|
+
} as never)) as Response;
|
|
62
|
+
rootCookie = cookieOf(response);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
afterEach(async () => {
|
|
66
|
+
await initAuth(null);
|
|
67
|
+
resetAccountCacheForTests();
|
|
68
|
+
delete Bun.env.KABMO_DATA_DIR;
|
|
69
|
+
delete Bun.env.SYNC_WORKSPACE;
|
|
70
|
+
fs.rmSync(dataDir, { recursive: true, force: true });
|
|
71
|
+
await releaseDb();
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
describe('accounts', () => {
|
|
75
|
+
test('the root password still logs in the root account with no picker', async () => {
|
|
76
|
+
expect(rootCookie).toContain('omp_session');
|
|
77
|
+
const res = (await state({
|
|
78
|
+
request: new Request('http://localhost/api/auth/state', { headers: { cookie: rootCookie } }),
|
|
79
|
+
} as never)) as Response;
|
|
80
|
+
expect(await body(res)).toEqual({ required: true, authenticated: true });
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
test('a member exists, signs in, and sees only itself in settings', async () => {
|
|
84
|
+
const created = (await accountsAction({
|
|
85
|
+
request: post('http://localhost/api/accounts', { name: 'Alice', password: 'alice-password' }, rootCookie),
|
|
86
|
+
params: {},
|
|
87
|
+
} as never)) as Response;
|
|
88
|
+
expect(created.status).toBe(201);
|
|
89
|
+
|
|
90
|
+
const memberLogin = (await login({
|
|
91
|
+
request: post('http://localhost/api/auth/login', { accountId: 'missing', password: 'alice-password' }),
|
|
92
|
+
} as never)) as Response;
|
|
93
|
+
expect(memberLogin.status).toBe(401);
|
|
94
|
+
|
|
95
|
+
const list = await accountsLoader({
|
|
96
|
+
request: new Request('http://localhost/api/accounts', { headers: { cookie: rootCookie } }),
|
|
97
|
+
} as never) as Response;
|
|
98
|
+
const payload = await body(list);
|
|
99
|
+
const accounts = payload.accounts as Array<{ id: string; name: string }>;
|
|
100
|
+
const alice = accounts.find((entry) => entry.name === 'Alice');
|
|
101
|
+
expect(alice).toBeTruthy();
|
|
102
|
+
|
|
103
|
+
const aliceLogin = (await login({
|
|
104
|
+
request: post('http://localhost/api/auth/login', { accountId: alice!.id, password: 'alice-password' }),
|
|
105
|
+
} as never)) as Response;
|
|
106
|
+
expect(aliceLogin.status).toBe(200);
|
|
107
|
+
const aliceCookie = cookieOf(aliceLogin);
|
|
108
|
+
const self = await accountsLoader({
|
|
109
|
+
request: new Request('http://localhost/api/accounts', { headers: { cookie: aliceCookie } }),
|
|
110
|
+
} as never) as Response;
|
|
111
|
+
expect((await body(self)).accounts).toEqual([expect.objectContaining({ id: alice!.id, name: 'Alice' })]);
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
test('a member token carries its account and a reset invalidates it', async () => {
|
|
115
|
+
const create = await createAccount({
|
|
116
|
+
name: 'Bob',
|
|
117
|
+
password: 'bob-password',
|
|
118
|
+
sessionSecret: loadAuthConfig()!.sessionSecret,
|
|
119
|
+
minPasswordLength: 8,
|
|
120
|
+
});
|
|
121
|
+
expect(create.ok).toBe(true);
|
|
122
|
+
if (!create.ok) return;
|
|
123
|
+
|
|
124
|
+
const aliceLogin = (await login({
|
|
125
|
+
request: post('http://localhost/api/auth/login', { accountId: create.value.id, password: 'bob-password' }),
|
|
126
|
+
} as never)) as Response;
|
|
127
|
+
const cookie = cookieOf(aliceLogin);
|
|
128
|
+
const token = cookie.slice(cookie.indexOf('=') + 1);
|
|
129
|
+
const request = new Request('http://localhost/api/auth/state', { headers: { cookie } });
|
|
130
|
+
expect(authenticatedAccount(request)?.id).toBe(create.value.id);
|
|
131
|
+
expect(token.startsWith('v2.')).toBe(true);
|
|
132
|
+
|
|
133
|
+
const reset = (await accountsAction({
|
|
134
|
+
request: post(`http://localhost/api/accounts/${create.value.id}/password`, { newPassword: 'new-bob-password' }, rootCookie),
|
|
135
|
+
params: { accountId: create.value.id },
|
|
136
|
+
} as never)) as Response;
|
|
137
|
+
expect(reset.status).toBe(200);
|
|
138
|
+
expect(authenticatedAccount(request)).toBeNull();
|
|
139
|
+
|
|
140
|
+
const again = (await login({
|
|
141
|
+
request: post('http://localhost/api/auth/login', { accountId: create.value.id, password: 'new-bob-password' }),
|
|
142
|
+
} as never)) as Response;
|
|
143
|
+
expect(again.status).toBe(200);
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
test('the owner can share a workspace with another account', async () => {
|
|
147
|
+
const create = await createAccount({
|
|
148
|
+
name: 'Carol',
|
|
149
|
+
password: 'carol-password',
|
|
150
|
+
sessionSecret: loadAuthConfig()!.sessionSecret,
|
|
151
|
+
minPasswordLength: 8,
|
|
152
|
+
});
|
|
153
|
+
if (!create.ok) throw new Error(create.error);
|
|
154
|
+
|
|
155
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'kabmo-workspace-'));
|
|
156
|
+
try {
|
|
157
|
+
const registered = await registerWorkspaceFolder(await getDb(), {
|
|
158
|
+
name: 'shared', projectPath: dir, ownerAccountId: 'root',
|
|
159
|
+
});
|
|
160
|
+
expect(registered.ok).toBe(true);
|
|
161
|
+
if (!registered.ok) return;
|
|
162
|
+
|
|
163
|
+
expect(await accessibleFolderRows(await getDb(), create.value.id)).toHaveLength(0);
|
|
164
|
+
const shared = (await sharesAction({
|
|
165
|
+
request: post(`http://localhost/api/folders/${registered.id}/shares`, { accountId: create.value.id }, rootCookie),
|
|
166
|
+
params: { folderId: String(registered.id) },
|
|
167
|
+
} as never)) as Response;
|
|
168
|
+
expect(shared.status).toBe(200);
|
|
169
|
+
expect(await accessibleFolderRows(await getDb(), create.value.id)).toHaveLength(1);
|
|
170
|
+
} finally {
|
|
171
|
+
fs.rmSync(dir, { recursive: true, force: true });
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
});
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Account management for Settings → Accounts.
|
|
8
|
+
*
|
|
9
|
+
* Root administers every account; a member may read itself, rename itself and
|
|
10
|
+
* change its own password. Deleting an account never deletes a workspace's
|
|
11
|
+
* files: its owned rows transfer to the requested account, or unregister when
|
|
12
|
+
* the caller explicitly asks for that.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { json, NO_STORE_HEADERS } from '@kabmo-labs/kabmo-http';
|
|
16
|
+
import type { ActionFunctionArgs, LoaderFunctionArgs } from '@kabmo-labs/kabmo-http';
|
|
17
|
+
import { methodNotAllowed, parseJsonBody } from '@/server/lib/route-adapter';
|
|
18
|
+
import { getDb } from '@/server/db.server';
|
|
19
|
+
import { authenticatedAccount, isAuthEnabled, loadAuthConfig } from '@/server/lib/auth/guard';
|
|
20
|
+
import { verifyPassword } from '@kabmo-labs/kabmo-auth/server/config';
|
|
21
|
+
import {
|
|
22
|
+
createAccount,
|
|
23
|
+
deleteAccountRow,
|
|
24
|
+
getAccount,
|
|
25
|
+
listAccountItems,
|
|
26
|
+
renameAccount,
|
|
27
|
+
setMemberPassword,
|
|
28
|
+
} from '@kabmo-labs/kabmo-auth/server/accounts';
|
|
29
|
+
import { revokeDevice } from '@/server/lib/connect/devices.server';
|
|
30
|
+
import { deleteWorkspaceFolder } from '@/shared/lib/workspace/project-settings';
|
|
31
|
+
import { emitRealtimeSignal } from '@kabmo-labs/kabmo-realtime-signals';
|
|
32
|
+
|
|
33
|
+
const MIN_PASSWORD_LENGTH = 8;
|
|
34
|
+
|
|
35
|
+
function forbidden(): Response {
|
|
36
|
+
return json({ error: 'Only the root account can manage other accounts' }, { status: 403, headers: NO_STORE_HEADERS });
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function notFound(): Response {
|
|
40
|
+
return json({ error: 'Account not found' }, { status: 404, headers: NO_STORE_HEADERS });
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async function payload(currentAccountId: string, root: boolean) {
|
|
44
|
+
const all = await listAccountItems();
|
|
45
|
+
return {
|
|
46
|
+
enabled: isAuthEnabled(),
|
|
47
|
+
currentAccountId,
|
|
48
|
+
accounts: root ? all : all.filter((account) => account.id === currentAccountId),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export async function loader({ request }: LoaderFunctionArgs) {
|
|
53
|
+
const session = authenticatedAccount(request);
|
|
54
|
+
if (!session) return json({ error: 'UI authentication required' }, { status: 401, headers: NO_STORE_HEADERS });
|
|
55
|
+
return json(await payload(session.id, session.role === 'root'), { headers: NO_STORE_HEADERS });
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Move every row one account owns to another, keeping names unique in the target. */
|
|
59
|
+
async function transferWorkspaces(from: string, to: string): Promise<void> {
|
|
60
|
+
const db = await getDb();
|
|
61
|
+
const rows = await db.all<{ id: number; name: string }>(
|
|
62
|
+
'SELECT id, name FROM workspace_folders WHERE owner_account_id = ? ORDER BY id ASC',
|
|
63
|
+
[from],
|
|
64
|
+
);
|
|
65
|
+
for (const row of rows) {
|
|
66
|
+
let name = row.name;
|
|
67
|
+
let suffix = 2;
|
|
68
|
+
while (await db.get('SELECT id FROM workspace_folders WHERE owner_account_id = ? AND lower(name) = lower(?)', [to, name])) {
|
|
69
|
+
name = `${row.name}-${suffix++}`;
|
|
70
|
+
}
|
|
71
|
+
await db.run('UPDATE workspace_folders SET name = ?, owner_account_id = ? WHERE id = ?', [name, to, row.id]);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export async function action({ request, params }: ActionFunctionArgs) {
|
|
76
|
+
if (request.method !== 'POST' && request.method !== 'PATCH' && request.method !== 'DELETE') {
|
|
77
|
+
return methodNotAllowed({ request, params });
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const session = authenticatedAccount(request);
|
|
81
|
+
if (!session) return json({ error: 'UI authentication required' }, { status: 401, headers: NO_STORE_HEADERS });
|
|
82
|
+
if (!isAuthEnabled()) {
|
|
83
|
+
return json({ error: 'Accounts need --ui-password' }, { status: 400, headers: NO_STORE_HEADERS });
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const accountId = params?.accountId;
|
|
87
|
+
const isRoot = session.role === 'root';
|
|
88
|
+
const isSelf = accountId === session.id;
|
|
89
|
+
|
|
90
|
+
if (request.method === 'DELETE' && accountId) {
|
|
91
|
+
if (!isRoot) return forbidden();
|
|
92
|
+
if (accountId === 'root' || !getAccount(accountId)) return notFound();
|
|
93
|
+
const body = (await request.json().catch(() => null)) as { transferTo?: unknown; deleteWorkspaces?: unknown } | null;
|
|
94
|
+
const target = typeof body?.transferTo === 'string' ? body.transferTo : 'root';
|
|
95
|
+
if (!getAccount(target) || target === accountId) {
|
|
96
|
+
return json({ error: 'Choose another account to receive the workspaces' }, { status: 400, headers: NO_STORE_HEADERS });
|
|
97
|
+
}
|
|
98
|
+
const db = await getDb();
|
|
99
|
+
if (body?.deleteWorkspaces === true) {
|
|
100
|
+
const owned = await db.all<{ id: number }>('SELECT id FROM workspace_folders WHERE owner_account_id = ?', [accountId]);
|
|
101
|
+
for (const row of owned) await deleteWorkspaceFolder(db, String(row.id));
|
|
102
|
+
} else {
|
|
103
|
+
await transferWorkspaces(accountId, target);
|
|
104
|
+
}
|
|
105
|
+
const devices = await db.all<{ id: string }>('SELECT id FROM paired_devices WHERE account_id = ?', [accountId]);
|
|
106
|
+
for (const device of devices) await revokeDevice(device.id);
|
|
107
|
+
await deleteAccountRow(accountId);
|
|
108
|
+
emitRealtimeSignal('sidebar-structure');
|
|
109
|
+
return json({ success: true, ...(await payload(session.id, true)) }, { headers: NO_STORE_HEADERS });
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (request.method === 'PATCH' && accountId) {
|
|
113
|
+
if (!isRoot && !isSelf) return forbidden();
|
|
114
|
+
const body = await parseJsonBody<{ name?: unknown }>(request);
|
|
115
|
+
if (!body.ok) return json({ error: 'Invalid request body' }, { status: 400, headers: NO_STORE_HEADERS });
|
|
116
|
+
const result = await renameAccount(accountId, body.body.name);
|
|
117
|
+
if (!result.ok) return json({ error: result.error, code: result.code }, { status: 400, headers: NO_STORE_HEADERS });
|
|
118
|
+
return json({ success: true, account: result.value }, { headers: NO_STORE_HEADERS });
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (request.method === 'POST' && accountId) {
|
|
122
|
+
if (!isRoot && !isSelf) return forbidden();
|
|
123
|
+
if (accountId === 'root') {
|
|
124
|
+
return json(
|
|
125
|
+
{ error: 'The root password comes from --ui-password; change it from your account page for this run.' },
|
|
126
|
+
{ status: 400, headers: NO_STORE_HEADERS },
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
const body = await parseJsonBody<{ currentPassword?: unknown; newPassword?: unknown }>(request);
|
|
130
|
+
if (!body.ok) return json({ error: 'Invalid request body' }, { status: 400, headers: NO_STORE_HEADERS });
|
|
131
|
+
const config = loadAuthConfig();
|
|
132
|
+
if (!config) return json({ error: 'UI authentication is not enabled' }, { status: 400, headers: NO_STORE_HEADERS });
|
|
133
|
+
const target = getAccount(accountId);
|
|
134
|
+
if (!target) return notFound();
|
|
135
|
+
if (!isRoot) {
|
|
136
|
+
const current = typeof body.body.currentPassword === 'string' ? body.body.currentPassword : '';
|
|
137
|
+
if (!target.passwordHash || !(await verifyPassword(current, target.passwordHash))) {
|
|
138
|
+
return json({ error: 'Current password is incorrect' }, { status: 401, headers: NO_STORE_HEADERS });
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
const newPassword = typeof body.body.newPassword === 'string' ? body.body.newPassword : '';
|
|
142
|
+
if (newPassword.length < MIN_PASSWORD_LENGTH) {
|
|
143
|
+
return json(
|
|
144
|
+
{ error: `Password must be at least ${MIN_PASSWORD_LENGTH} characters` },
|
|
145
|
+
{ status: 400, headers: NO_STORE_HEADERS },
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
if (!(await setMemberPassword(accountId, newPassword, config.sessionSecret))) return notFound();
|
|
149
|
+
return json({ success: true }, { headers: NO_STORE_HEADERS });
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (request.method !== 'POST') return methodNotAllowed({ request, params });
|
|
153
|
+
if (!isRoot) return forbidden();
|
|
154
|
+
const body = await parseJsonBody<{ name?: unknown; password?: unknown }>(request);
|
|
155
|
+
if (!body.ok) return json({ error: 'Invalid request body' }, { status: 400, headers: NO_STORE_HEADERS });
|
|
156
|
+
const config = loadAuthConfig();
|
|
157
|
+
if (!config) return json({ error: 'UI authentication is not enabled' }, { status: 400, headers: NO_STORE_HEADERS });
|
|
158
|
+
const result = await createAccount({
|
|
159
|
+
name: body.body.name,
|
|
160
|
+
password: body.body.password,
|
|
161
|
+
sessionSecret: config.sessionSecret,
|
|
162
|
+
minPasswordLength: MIN_PASSWORD_LENGTH,
|
|
163
|
+
});
|
|
164
|
+
if (!result.ok) return json({ error: result.error, code: result.code }, { status: 400, headers: NO_STORE_HEADERS });
|
|
165
|
+
return json({ success: true, account: result.value }, { status: 201, headers: NO_STORE_HEADERS });
|
|
166
|
+
}
|