@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,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A send whose prompt assembly outlives a session switch.
|
|
8
|
+
*
|
|
9
|
+
* The composer awaits text attachments and the agent-name cache before it
|
|
10
|
+
* mounts the optimistic turn. Opening another chat in that window used to move
|
|
11
|
+
* BOTH the delivery and the rows with the URL: the prompt ran in the chat the
|
|
12
|
+
* operator had just opened, and its user/placeholder rows landed there with no
|
|
13
|
+
* run behind them. Delivery is now pinned to the captured session id, while the
|
|
14
|
+
* rows and the generating UI stay with the chat that is actually on screen.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, test } from 'bun:test';
|
|
18
|
+
import {
|
|
19
|
+
act,
|
|
20
|
+
installDomGlobals,
|
|
21
|
+
makeSendHarness,
|
|
22
|
+
originalFetch,
|
|
23
|
+
restoreDomGlobals,
|
|
24
|
+
stubComposerFetch,
|
|
25
|
+
} from '@/client/hooks/chat/timeline/send.test-util';
|
|
26
|
+
import type { Attachment, PromptDispatchResult } from '@/shared/types';
|
|
27
|
+
|
|
28
|
+
beforeAll(() => {
|
|
29
|
+
installDomGlobals();
|
|
30
|
+
});
|
|
31
|
+
afterAll(() => {
|
|
32
|
+
restoreDomGlobals();
|
|
33
|
+
});
|
|
34
|
+
afterEach(() => {
|
|
35
|
+
globalThis.fetch = originalFetch;
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
function textAttachment(text: () => Promise<string>): Attachment {
|
|
39
|
+
return {
|
|
40
|
+
id: 'notes',
|
|
41
|
+
name: 'notes.md',
|
|
42
|
+
sourceName: 'notes.md',
|
|
43
|
+
type: 'text/markdown',
|
|
44
|
+
size: 7,
|
|
45
|
+
file: { name: 'notes.md', type: 'text/markdown', size: 7, text },
|
|
46
|
+
} as unknown as Attachment;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
describe('executeSend across a session switch', () => {
|
|
50
|
+
beforeEach(() => {
|
|
51
|
+
stubComposerFetch();
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test('keeps delivery in the origin session and leaves the opened chat untouched', async () => {
|
|
55
|
+
const gate = Promise.withResolvers<string>();
|
|
56
|
+
const h = makeSendHarness();
|
|
57
|
+
const send = h.sends.executeSend('hello', [textAttachment(() => gate.promise)], {
|
|
58
|
+
model: { provider: 'p', modelId: 'm', thinkingLevel: 'high', accessMode: 'always-ask' },
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
// The operator opens another chat while the prompt is still assembling.
|
|
62
|
+
h.sessionIdRef.current = 'sess-2';
|
|
63
|
+
gate.resolve('# notes');
|
|
64
|
+
let result: PromptDispatchResult | undefined;
|
|
65
|
+
await act(async () => { result = await send; });
|
|
66
|
+
|
|
67
|
+
expect(result?.ok).toBe(true);
|
|
68
|
+
// The newly opened chat gets no rows, no placeholder and no spinner.
|
|
69
|
+
expect(h.state.messages).toEqual([]);
|
|
70
|
+
expect(h.deps.aiPlaceholderIdRef.current).toBeNull();
|
|
71
|
+
expect(h.generating).toEqual([]);
|
|
72
|
+
// The prompt, its model snapshot and its thinking level all went to the
|
|
73
|
+
// session the composer belonged to.
|
|
74
|
+
expect(h.agent.calls.promptSessions).toEqual(['sess-1']);
|
|
75
|
+
expect(h.agent.calls.modelSessions).toEqual(['sess-1']);
|
|
76
|
+
expect(h.agent.calls.levelSessions).toEqual(['sess-1']);
|
|
77
|
+
// And the operator's turn was persisted against that same session.
|
|
78
|
+
expect(h.persisted).toHaveLength(1);
|
|
79
|
+
expect(h.persisted[0]?.[0]).toMatchObject({ role: 'user', content: 'hello' });
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
test('a send that stays on its screen still mounts the optimistic turn', async () => {
|
|
83
|
+
const h = makeSendHarness();
|
|
84
|
+
await act(async () => {
|
|
85
|
+
await h.sends.executeSend('hello', []);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
expect(h.state.messages.map((m) => m.role)).toEqual(['user', 'ai']);
|
|
89
|
+
expect(h.agent.calls.promptSessions).toEqual(['sess-1']);
|
|
90
|
+
expect(h.generating).toEqual([true]);
|
|
91
|
+
});
|
|
92
|
+
});
|
|
@@ -107,13 +107,20 @@ export function stubComposerFetch(): void {
|
|
|
107
107
|
}) as typeof fetch;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
function makeMessages(): {
|
|
110
|
+
function makeMessages(): {
|
|
111
|
+
messages: ChatMessageData[];
|
|
112
|
+
setLocalMessages: ChatTimelineSendDeps['setLocalMessages'];
|
|
113
|
+
localMessagesRef: { current: ChatMessageData[] };
|
|
114
|
+
} {
|
|
111
115
|
const messages: ChatMessageData[] = [];
|
|
116
|
+
const localMessagesRef = { current: messages };
|
|
112
117
|
return {
|
|
113
118
|
messages,
|
|
119
|
+
localMessagesRef,
|
|
114
120
|
setLocalMessages: (next) => {
|
|
115
121
|
const resolved = typeof next === 'function' ? next(messages) : next;
|
|
116
122
|
messages.splice(0, messages.length, ...resolved);
|
|
123
|
+
localMessagesRef.current = messages;
|
|
117
124
|
},
|
|
118
125
|
};
|
|
119
126
|
}
|
|
@@ -121,10 +128,15 @@ function makeMessages(): { messages: ChatMessageData[]; setLocalMessages: ChatTi
|
|
|
121
128
|
/** Everything the send path pushed onto the agent, plus the canned outcomes. */
|
|
122
129
|
export interface AgentCalls {
|
|
123
130
|
prompts: Array<{ text: string; images: unknown; options: unknown }>;
|
|
131
|
+
/** Session id each prompt was pinned to (`''` when the caller omitted it). */
|
|
132
|
+
promptSessions: string[];
|
|
124
133
|
newPrompts: Array<{ text: string; cwd: string; options: unknown }>;
|
|
125
134
|
models: Array<[string, string]>;
|
|
135
|
+
modelSessions: string[];
|
|
126
136
|
levels: string[];
|
|
137
|
+
levelSessions: string[];
|
|
127
138
|
interrupts: Array<{ text: string; images: unknown }>;
|
|
139
|
+
steerSessions: string[];
|
|
128
140
|
sendPromptOk: boolean;
|
|
129
141
|
/** omp's typed mid-turn refusal (nothing delivered, safe to queue). */
|
|
130
142
|
sendPromptBusy: boolean;
|
|
@@ -145,10 +157,14 @@ export interface AgentRecorder {
|
|
|
145
157
|
export function makeAgent(overrides: Partial<AgentCalls> = {}): AgentRecorder {
|
|
146
158
|
const calls: AgentCalls = {
|
|
147
159
|
prompts: [],
|
|
160
|
+
promptSessions: [],
|
|
148
161
|
newPrompts: [],
|
|
149
162
|
models: [],
|
|
163
|
+
modelSessions: [],
|
|
150
164
|
levels: [],
|
|
165
|
+
levelSessions: [],
|
|
151
166
|
interrupts: [],
|
|
167
|
+
steerSessions: [],
|
|
152
168
|
sendPromptOk: true,
|
|
153
169
|
sendPromptBusy: false,
|
|
154
170
|
sendPromptError: undefined,
|
|
@@ -156,8 +172,9 @@ export function makeAgent(overrides: Partial<AgentCalls> = {}): AgentRecorder {
|
|
|
156
172
|
...overrides,
|
|
157
173
|
};
|
|
158
174
|
const agent = {
|
|
159
|
-
sendPrompt: async (text: string, images: unknown, options: unknown) => {
|
|
175
|
+
sendPrompt: async (text: string, images: unknown, options: unknown, sessionId?: string) => {
|
|
160
176
|
calls.prompts.push({ text, images, options });
|
|
177
|
+
calls.promptSessions.push(sessionId ?? '');
|
|
161
178
|
return { ok: calls.sendPromptOk, busy: calls.sendPromptBusy, error: calls.sendPromptError };
|
|
162
179
|
},
|
|
163
180
|
sendNewPrompt: async (text: string, cwd: string, _images: unknown, options: unknown) => {
|
|
@@ -166,15 +183,18 @@ export function makeAgent(overrides: Partial<AgentCalls> = {}): AgentRecorder {
|
|
|
166
183
|
? { ok: true as const, session: calls.spawnResult }
|
|
167
184
|
: { ok: false as const, error: calls.spawnError ?? 'spawn failed', ...(calls.spawnCode ? { code: calls.spawnCode } : {}) };
|
|
168
185
|
},
|
|
169
|
-
steerOmpRun: async (text: string, images: unknown) => {
|
|
186
|
+
steerOmpRun: async (text: string, images: unknown, sessionId?: string) => {
|
|
170
187
|
calls.interrupts.push({ text, images });
|
|
188
|
+
calls.steerSessions.push(sessionId ?? '');
|
|
171
189
|
return { ok: calls.sendPromptOk, busy: false, error: calls.sendPromptError };
|
|
172
190
|
},
|
|
173
|
-
setModel: async (provider: string, modelId: string) => {
|
|
191
|
+
setModel: async (provider: string, modelId: string, sessionId?: string) => {
|
|
174
192
|
calls.models.push([provider, modelId]);
|
|
193
|
+
calls.modelSessions.push(sessionId ?? '');
|
|
175
194
|
},
|
|
176
|
-
setThinkingLevel: async (level: string) => {
|
|
195
|
+
setThinkingLevel: async (level: string, sessionId?: string) => {
|
|
177
196
|
calls.levels.push(level);
|
|
197
|
+
calls.levelSessions.push(sessionId ?? '');
|
|
178
198
|
},
|
|
179
199
|
} as unknown as OmpAgentHandle;
|
|
180
200
|
return { calls, agent };
|
|
@@ -196,6 +216,10 @@ export interface SendHarness {
|
|
|
196
216
|
/** The armed goal, so a case can arm one and read what the send consumed. */
|
|
197
217
|
goalArmRef: { current: ArmedGoal | null };
|
|
198
218
|
adoptedSessionIdRef: { current: string | null };
|
|
219
|
+
/** The live URL mirror a race case mutates to simulate opening another chat. */
|
|
220
|
+
sessionIdRef: { current: string | null };
|
|
221
|
+
/** Rows the send path snapshots before its async assembly. */
|
|
222
|
+
localMessagesRef: { current: ChatMessageData[] };
|
|
199
223
|
}
|
|
200
224
|
|
|
201
225
|
export function makeSendHarness(options: {
|
|
@@ -209,13 +233,15 @@ export function makeSendHarness(options: {
|
|
|
209
233
|
// Ensure, never HOLD: a case's DOM comes from its file's `beforeAll`, and
|
|
210
234
|
// counting here would leave the globals installed for the whole process.
|
|
211
235
|
ensureDom();
|
|
212
|
-
const { messages, setLocalMessages } = makeMessages();
|
|
236
|
+
const { messages, setLocalMessages, localMessagesRef } = makeMessages();
|
|
213
237
|
// `options.agent` is either overrides for the recorder's `AgentCalls` or
|
|
214
238
|
// the finished recorder itself; the two forms are told apart by shape.
|
|
215
239
|
const agent: AgentRecorder =
|
|
216
240
|
options.agent && 'calls' in options.agent
|
|
217
241
|
? options.agent
|
|
218
242
|
: makeAgent(options.agent);
|
|
243
|
+
const sessionId = options.sessionId === undefined ? 'sess-1' : options.sessionId;
|
|
244
|
+
const sessionIdRef = { current: sessionId };
|
|
219
245
|
const persisted: ChatMessageData[][] = [];
|
|
220
246
|
const generating: boolean[] = [];
|
|
221
247
|
const drafts: string[] = [];
|
|
@@ -231,7 +257,9 @@ export function makeSendHarness(options: {
|
|
|
231
257
|
const deps: ChatTimelineSendDeps = {
|
|
232
258
|
folders: (options.folders ?? []) as ChatTimelineSendDeps['folders'],
|
|
233
259
|
selectedFolderId: options.selectedFolderId ?? null,
|
|
234
|
-
sessionId
|
|
260
|
+
sessionId,
|
|
261
|
+
sessionIdRef,
|
|
262
|
+
localMessagesRef,
|
|
235
263
|
isOmpSession: options.isOmpSession ?? true,
|
|
236
264
|
appSettings: {},
|
|
237
265
|
ompAgent: agent.agent,
|
|
@@ -294,6 +322,8 @@ export function makeSendHarness(options: {
|
|
|
294
322
|
spawnSelectionRef,
|
|
295
323
|
goalArmRef,
|
|
296
324
|
adoptedSessionIdRef,
|
|
325
|
+
sessionIdRef,
|
|
326
|
+
localMessagesRef,
|
|
297
327
|
};
|
|
298
328
|
}
|
|
299
329
|
|
|
@@ -51,13 +51,20 @@ afterEach(() => {
|
|
|
51
51
|
});
|
|
52
52
|
|
|
53
53
|
|
|
54
|
-
function makeMessages(): {
|
|
54
|
+
function makeMessages(): {
|
|
55
|
+
messages: ChatMessageData[];
|
|
56
|
+
setLocalMessages: ChatTimelineSendDeps['setLocalMessages'];
|
|
57
|
+
localMessagesRef: { current: ChatMessageData[] };
|
|
58
|
+
} {
|
|
55
59
|
const messages: ChatMessageData[] = [];
|
|
60
|
+
const localMessagesRef = { current: messages };
|
|
56
61
|
return {
|
|
57
62
|
messages,
|
|
63
|
+
localMessagesRef,
|
|
58
64
|
setLocalMessages: (next) => {
|
|
59
65
|
const resolved = typeof next === 'function' ? next(messages) : next;
|
|
60
66
|
messages.splice(0, messages.length, ...resolved);
|
|
67
|
+
localMessagesRef.current = messages;
|
|
61
68
|
},
|
|
62
69
|
};
|
|
63
70
|
}
|
|
@@ -142,7 +149,7 @@ function makeSendHarness(options: {
|
|
|
142
149
|
agent?: Partial<AgentCalls> | AgentRecorder;
|
|
143
150
|
deferredPick?: { current: any };
|
|
144
151
|
} = {}): SendHarness {
|
|
145
|
-
const { messages, setLocalMessages } = makeMessages();
|
|
152
|
+
const { messages, setLocalMessages, localMessagesRef } = makeMessages();
|
|
146
153
|
// `options.agent` is either overrides for the recorder's `AgentCalls` or
|
|
147
154
|
// the finished recorder itself; the two forms are told apart by shape.
|
|
148
155
|
const agent: AgentRecorder =
|
|
@@ -166,6 +173,8 @@ function makeSendHarness(options: {
|
|
|
166
173
|
folders: options.folders ?? [],
|
|
167
174
|
selectedFolderId: options.selectedFolderId ?? null,
|
|
168
175
|
sessionId: options.sessionId === undefined ? 'sess-1' : options.sessionId,
|
|
176
|
+
sessionIdRef: { current: options.sessionId === undefined ? 'sess-1' : options.sessionId },
|
|
177
|
+
localMessagesRef,
|
|
169
178
|
isOmpSession: options.isOmpSession ?? true,
|
|
170
179
|
appSettings: {},
|
|
171
180
|
ompAgent: agent.agent,
|
|
@@ -31,6 +31,8 @@ export function useChatTimelineSend(deps: ChatTimelineSendDeps): ChatTimelineSen
|
|
|
31
31
|
folders,
|
|
32
32
|
selectedFolderId,
|
|
33
33
|
sessionId,
|
|
34
|
+
sessionIdRef,
|
|
35
|
+
localMessagesRef,
|
|
34
36
|
isOmpSession,
|
|
35
37
|
harness,
|
|
36
38
|
appSettings,
|
|
@@ -103,6 +105,7 @@ export function useChatTimelineSend(deps: ChatTimelineSendDeps): ChatTimelineSen
|
|
|
103
105
|
// Steer the running omp agent (interrupt-and-reply). Returns the outcome so
|
|
104
106
|
// the caller can report a refusal: the composer is cleared before this runs.
|
|
105
107
|
const steerOmpAgent = useCallback(async (text: string, attachments: Attachment[]): Promise<PromptDispatchResult> => {
|
|
108
|
+
const targetSessionId = sessionId;
|
|
106
109
|
// A queued item's "Send now" can steer a turn with a snapshot queued before
|
|
107
110
|
// the ceiling existed; the draft comes back so the prompt is not lost.
|
|
108
111
|
const oversized = describeOversizedAttachments(oversizedAttachments(attachments));
|
|
@@ -112,7 +115,7 @@ export function useChatTimelineSend(deps: ChatTimelineSendDeps): ChatTimelineSen
|
|
|
112
115
|
}
|
|
113
116
|
// A steer IS a new prompt: a pick made during the interrupted turn belongs
|
|
114
117
|
// to it, so it is pushed before the interrupt-and-reply starts the turn.
|
|
115
|
-
await flushDeferredPick(ompAgent, deferredComposerPickRef);
|
|
118
|
+
await flushDeferredPick(ompAgent, deferredComposerPickRef, targetSessionId ?? undefined);
|
|
116
119
|
let deliverable: { promptText: string; images?: AgentImage[] };
|
|
117
120
|
try {
|
|
118
121
|
deliverable = await prepareDeliverable(text, attachments);
|
|
@@ -122,10 +125,10 @@ export function useChatTimelineSend(deps: ChatTimelineSendDeps): ChatTimelineSen
|
|
|
122
125
|
setInputValue(text);
|
|
123
126
|
return { ok: false, busy: false, error: message };
|
|
124
127
|
}
|
|
125
|
-
const result = await ompAgent.steerOmpRun(deliverable.promptText, deliverable.images);
|
|
128
|
+
const result = await ompAgent.steerOmpRun(deliverable.promptText, deliverable.images, targetSessionId ?? undefined);
|
|
126
129
|
if (!result.ok) setInputValue(text);
|
|
127
130
|
return result;
|
|
128
|
-
}, [ompAgent, prepareDeliverable, setInputValue, deferredComposerPickRef, reportActionError]);
|
|
131
|
+
}, [ompAgent, prepareDeliverable, setInputValue, deferredComposerPickRef, reportActionError, sessionId]);
|
|
129
132
|
|
|
130
133
|
const executeSend = useCallback(async (
|
|
131
134
|
text: string,
|
|
@@ -151,6 +154,13 @@ export function useChatTimelineSend(deps: ChatTimelineSendDeps): ChatTimelineSen
|
|
|
151
154
|
// send keeps the session's live picks. 'auto' thinking leaves omp alone.
|
|
152
155
|
const modelOverride = options?.model ?? null;
|
|
153
156
|
const effectiveAccessMode = modelOverride?.accessMode ?? accessModeRef.current;
|
|
157
|
+
// The send belongs to the chat its composer was showing. Prompt assembly
|
|
158
|
+
// below is asynchronous (text attachments, the agent-name cache), and the
|
|
159
|
+
// operator can open another chat before it resolves; both the delivery and
|
|
160
|
+
// every UI write must key off this captured id, never the live URL.
|
|
161
|
+
const targetSessionId = sessionId;
|
|
162
|
+
const targetIsOnScreen = () => sessionIdRef.current === targetSessionId;
|
|
163
|
+
const rowsBeforeSend = localMessagesRef.current;
|
|
154
164
|
const time = formatClock();
|
|
155
165
|
const userMsgId = `msg-${Date.now()}-user`;
|
|
156
166
|
const aiPlaceholderId = `msg-${Date.now() + 1}-ai`;
|
|
@@ -175,67 +185,77 @@ export function useChatTimelineSend(deps: ChatTimelineSendDeps): ChatTimelineSen
|
|
|
175
185
|
aiPlaceholderId,
|
|
176
186
|
});
|
|
177
187
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
188
|
+
// The rows a send mounts belong to the chat that is still on screen. A
|
|
189
|
+
// switch during assembly means the timeline now holds another session's
|
|
190
|
+
// rows: persist the operator's turn where it was typed, but never append it
|
|
191
|
+
// (or the AI placeholder) to the chat they moved to.
|
|
192
|
+
const keepOnThisScreen = !isOmpSession || targetIsOnScreen();
|
|
193
|
+
const rowsForPersist = keepOnThisScreen ? localMessagesRef.current : rowsBeforeSend;
|
|
194
|
+
persistMessages([...rowsForPersist, newUserMsg]);
|
|
195
|
+
if (keepOnThisScreen) {
|
|
196
|
+
setLocalMessages(prev => (targetIsOnScreen() ? [...prev, newUserMsg, initialAiMsg] : prev));
|
|
197
|
+
// Arm the placeholder ref WITH its row, never after the spawn await. A
|
|
198
|
+
// brand-new session's child streams its first frames before
|
|
199
|
+
// `sendNewPrompt` resolves, and a frame that finds no placeholder APPENDS
|
|
200
|
+
// its message beside the placeholder row instead of filling it; arming the
|
|
201
|
+
// ref afterwards then made the next update map the placeholder onto that
|
|
202
|
+
// same id, rendering the turn (and its ask card) TWICE — measured as two
|
|
203
|
+
// cards for one ask, one "Running" and one "Done", on ~1 run in 30.
|
|
204
|
+
aiPlaceholderIdRef.current = aiPlaceholderId;
|
|
195
205
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
206
|
+
setGenerating(true, true);
|
|
207
|
+
setGeneratingVerb(PHASE_VERBS.thinking);
|
|
208
|
+
// An explicit send is user intent to watch the answer: re-engage follow
|
|
209
|
+
// mode even if the user had scrolled away, then scroll to the tail.
|
|
210
|
+
// INSTANT, like the session-open jump: the first stream chunk lands inside
|
|
211
|
+
// the 50 ms delay, and its own follow write is instant — a smooth flight
|
|
212
|
+
// would be snapped by it, and a smooth animation cannot catch a tail that
|
|
213
|
+
// is already growing (see `stream-coalescer.ts`).
|
|
214
|
+
setTimeout(() => jumpToBottom('instant'), 50);
|
|
215
|
+
}
|
|
205
216
|
|
|
206
217
|
// Real mode: route through the omp agent RPC bridge + event stream.
|
|
207
218
|
if (isOmpSession) {
|
|
208
219
|
// This chat now has a prompt in flight, so its sidebar row must survive a
|
|
209
220
|
// switch away: omp's transcript — which would draw the row for real — is
|
|
210
221
|
// seconds behind. A no-op for a session the store does not know.
|
|
211
|
-
if (
|
|
212
|
-
optimisticUserIdRef.current = userMsgId;
|
|
222
|
+
if (targetSessionId) markPendingSessionSent(targetSessionId);
|
|
223
|
+
if (targetIsOnScreen()) optimisticUserIdRef.current = userMsgId;
|
|
213
224
|
// A model/thinking pick made while the previous turn streamed was held
|
|
214
225
|
// back so it could not re-target that answer. A queued delivery does NOT
|
|
215
226
|
// own it: that item carries its own snapshot, so the pick stays pending
|
|
216
227
|
// for the composer's own next prompt instead of being spent — and then
|
|
217
228
|
// overwritten — by a delivery it was never meant for.
|
|
218
|
-
if (!modelOverride) await flushDeferredPick(ompAgent, deferredComposerPickRef);
|
|
229
|
+
if (!modelOverride) await flushDeferredPick(ompAgent, deferredComposerPickRef, targetSessionId ?? undefined);
|
|
219
230
|
// Replay the queued snapshot first so the prompt runs on the exact
|
|
220
231
|
// model/thinking the item was queued with.
|
|
221
232
|
if (modelOverride) {
|
|
222
|
-
await ompAgent.setModel(modelOverride.provider, modelOverride.modelId);
|
|
233
|
+
await ompAgent.setModel(modelOverride.provider, modelOverride.modelId, targetSessionId ?? undefined);
|
|
223
234
|
if (modelOverride.thinkingLevel !== 'auto') {
|
|
224
|
-
await ompAgent.setThinkingLevel(modelOverride.thinkingLevel);
|
|
235
|
+
await ompAgent.setThinkingLevel(modelOverride.thinkingLevel, targetSessionId ?? undefined);
|
|
225
236
|
}
|
|
226
237
|
}
|
|
227
238
|
const images = collectImages(attachments);
|
|
228
239
|
// `promptText` was assembled once above, so no refusal can reach here.
|
|
229
240
|
const armed = goalArmRef.current;
|
|
230
|
-
const consumed = armed &&
|
|
241
|
+
const consumed = armed && targetSessionId ? await startArmedGoal(targetSessionId, armed, promptText) : false;
|
|
231
242
|
if (consumed) return { ok: true, busy: false };
|
|
232
|
-
const result = await ompAgent.sendPrompt(
|
|
243
|
+
const result = await ompAgent.sendPrompt(
|
|
244
|
+
promptText,
|
|
245
|
+
images,
|
|
246
|
+
{ accessMode: effectiveAccessMode },
|
|
247
|
+
targetSessionId ?? undefined,
|
|
248
|
+
);
|
|
233
249
|
if (!result.ok) {
|
|
234
|
-
// Roll back the optimistic bubbles on a failed send
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
250
|
+
// Roll back the optimistic bubbles on a failed send — but only the
|
|
251
|
+
// rows this send mounted. A switch away already cleared them with the
|
|
252
|
+
// previous session's timeline.
|
|
253
|
+
if (targetIsOnScreen()) {
|
|
254
|
+
setLocalMessages(prev => prev.filter(m => m.id !== userMsgId && m.id !== aiPlaceholderId));
|
|
255
|
+
aiPlaceholderIdRef.current = null;
|
|
256
|
+
optimisticUserIdRef.current = null;
|
|
257
|
+
setGenerating(false);
|
|
258
|
+
}
|
|
239
259
|
// And SAY so. The rollback alone left the operator's turn vanishing
|
|
240
260
|
// with no explanation, which is the reported "gagal kirim prompt": the
|
|
241
261
|
// server's reason (a dead child, a session another process owns) was
|
|
@@ -279,6 +299,6 @@ export function useChatTimelineSend(deps: ChatTimelineSendDeps): ChatTimelineSen
|
|
|
279
299
|
setGeneratingVerb,
|
|
280
300
|
scrollToBottom,
|
|
281
301
|
});
|
|
282
|
-
}, [appSettings, folders, isOmpSession, harness, ompAgent, selectedFolderId, sessionId, scrollToBottom, jumpToBottom, persistMessages, seedSession, pendingComposerModelRef, pendingThinkingLevelRef, deferredComposerPickRef, accessModeRef, setLocalMessages, reportActionError]);
|
|
302
|
+
}, [appSettings, folders, isOmpSession, harness, ompAgent, selectedFolderId, sessionId, sessionIdRef, localMessagesRef, scrollToBottom, jumpToBottom, persistMessages, seedSession, pendingComposerModelRef, pendingThinkingLevelRef, deferredComposerPickRef, accessModeRef, setLocalMessages, reportActionError]);
|
|
283
303
|
return { steerOmpAgent, executeSend };
|
|
284
304
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The cache-bust generation an image's raw URL carries beside the revision.
|
|
8
|
+
*
|
|
9
|
+
* A browser keys a decoded `<img>` on its URL and reuses that frame for an
|
|
10
|
+
* identical URL even when the response is `no-store` — measured in Chromium:
|
|
11
|
+
* unmounting and re-mounting the same `<img src>` after the bytes changed issued
|
|
12
|
+
* no request at all, while WebKit re-fetched. So `revision` alone is not enough:
|
|
13
|
+
* it resets to 0 on a fresh mount, and the same URL then comes back. This
|
|
14
|
+
* counter advances every time a file becomes the ACTIVE tab (a mount, a tab
|
|
15
|
+
* switch, a re-open), so the URL can never name a frame the browser decoded from
|
|
16
|
+
* older bytes.
|
|
17
|
+
*/
|
|
18
|
+
let sequence = 0;
|
|
19
|
+
|
|
20
|
+
/** A value no earlier image URL has carried. */
|
|
21
|
+
export function nextImageGeneration(): number {
|
|
22
|
+
sequence += 1;
|
|
23
|
+
return sequence;
|
|
24
|
+
}
|
|
@@ -15,9 +15,10 @@
|
|
|
15
15
|
* 3. an image keeps its own `imageUrl` field (the image viewer and the transfer
|
|
16
16
|
* path read it) while every other byte viewer takes the source object.
|
|
17
17
|
*
|
|
18
|
-
* The
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* The cache-bust is the fourth: an image's URL carries `&v=<revision>.<activation>`
|
|
19
|
+
* because a browser keys a decoded picture on the URL alone and will reuse the
|
|
20
|
+
* old frame for an identical one even under `no-store`; the other byte viewers
|
|
21
|
+
* key their re-read on `revision` directly rather than on the URL.
|
|
21
22
|
*/
|
|
22
23
|
|
|
23
24
|
import { afterAll, beforeAll, describe, expect, test } from 'bun:test';
|
|
@@ -56,36 +57,41 @@ function fakeHandle(name: string, bytes: Uint8Array): FileSystemFileHandle {
|
|
|
56
57
|
|
|
57
58
|
describe('resolveViewer', () => {
|
|
58
59
|
test('the viewer comes from the path', () => {
|
|
59
|
-
expect(resolveViewer({ path: 'notes.md' }, 0).viewerKind).toBe('markdown');
|
|
60
|
-
expect(resolveViewer({ path: 'report.pdf' }, 0).viewerKind).toBe('pdf');
|
|
61
|
-
expect(resolveViewer({ path: 'sheet.xlsx' }, 0).viewerKind).toBe('spreadsheet');
|
|
62
|
-
expect(resolveViewer({ path: 'data.csv' }, 0).viewerKind).toBe('csv');
|
|
63
|
-
expect(resolveViewer({ path: 'logo.svg' }, 0).viewerKind).toBe('svg');
|
|
64
|
-
expect(resolveViewer({ path: 'src/app.ts' }, 0).viewerKind).toBe('code');
|
|
65
|
-
expect(resolveViewer(null, 0).viewerKind).toBe('code');
|
|
60
|
+
expect(resolveViewer({ path: 'notes.md' }, 0, 1).viewerKind).toBe('markdown');
|
|
61
|
+
expect(resolveViewer({ path: 'report.pdf' }, 0, 1).viewerKind).toBe('pdf');
|
|
62
|
+
expect(resolveViewer({ path: 'sheet.xlsx' }, 0, 1).viewerKind).toBe('spreadsheet');
|
|
63
|
+
expect(resolveViewer({ path: 'data.csv' }, 0, 1).viewerKind).toBe('csv');
|
|
64
|
+
expect(resolveViewer({ path: 'logo.svg' }, 0, 1).viewerKind).toBe('svg');
|
|
65
|
+
expect(resolveViewer({ path: 'src/app.ts' }, 0, 1).viewerKind).toBe('code');
|
|
66
|
+
expect(resolveViewer(null, 0, 1).viewerKind).toBe('code');
|
|
66
67
|
});
|
|
67
68
|
|
|
68
69
|
test('a byte viewer is marked binary; a text viewer is not', () => {
|
|
69
70
|
for (const path of ['report.pdf', 'brief.docx', 'book.xlsx', 'pic.png']) {
|
|
70
|
-
expect(resolveViewer({ path }, 0).isBinaryViewer).toBe(true);
|
|
71
|
+
expect(resolveViewer({ path }, 0, 1).isBinaryViewer).toBe(true);
|
|
71
72
|
}
|
|
72
73
|
// CSV and SVG read the TEXT buffer, so neither is a byte viewer.
|
|
73
74
|
for (const path of ['data.csv', 'logo.svg', 'notes.md', 'src/app.ts']) {
|
|
74
|
-
expect(resolveViewer({ path }, 0).isBinaryViewer).toBe(false);
|
|
75
|
+
expect(resolveViewer({ path }, 0, 1).isBinaryViewer).toBe(false);
|
|
75
76
|
}
|
|
76
77
|
});
|
|
77
78
|
|
|
78
|
-
test('a workspace image gets its raw URL, cache-busted per
|
|
79
|
-
const resolved = resolveViewer({ path: 'pic.png', root: '/ws', repo: 'projects/token' }, 7);
|
|
79
|
+
test('a workspace image gets its raw URL, cache-busted per activation', () => {
|
|
80
|
+
const resolved = resolveViewer({ path: 'pic.png', root: '/ws', repo: 'projects/token' }, 7, 42);
|
|
80
81
|
expect(resolved.isImage).toBe(true);
|
|
81
82
|
expect(resolved.imageUrl).toBe(resolved.byteSource.url);
|
|
82
83
|
expect(resolved.imageUrl).toContain('/api/fs/raw');
|
|
83
84
|
expect(resolved.imageUrl).toContain('path=pic.png');
|
|
84
85
|
expect(resolved.imageUrl).toContain('root=%2Fws');
|
|
85
86
|
expect(resolved.imageUrl).toContain('repo=projects%2Ftoken');
|
|
86
|
-
// The revision is
|
|
87
|
-
expect(resolved.imageUrl).toContain('&v=7');
|
|
88
|
-
expect(resolveViewer({ path: 'pic.png', root: '/ws' }, 8).imageUrl).toContain('&v=8');
|
|
87
|
+
// The revision is the manual Reload lever, the generation the activation.
|
|
88
|
+
expect(resolved.imageUrl).toContain('&v=7.42');
|
|
89
|
+
expect(resolveViewer({ path: 'pic.png', root: '/ws' }, 8, 42).imageUrl).toContain('&v=8.42');
|
|
90
|
+
// A tab switch back is a new activation, so it must not name the frame the
|
|
91
|
+
// browser already decoded from the previous visit.
|
|
92
|
+
expect(resolveViewer({ path: 'pic.png', root: '/ws' }, 8, 43).imageUrl).not.toBe(
|
|
93
|
+
resolveViewer({ path: 'pic.png', root: '/ws' }, 8, 42).imageUrl,
|
|
94
|
+
);
|
|
89
95
|
});
|
|
90
96
|
|
|
91
97
|
test('a handle-backed tab never gets a raw URL, even though it carries a path', async () => {
|
|
@@ -108,7 +114,7 @@ describe('resolveViewer', () => {
|
|
|
108
114
|
}
|
|
109
115
|
if (!handleId) throw new Error('the open did not carry a handle id');
|
|
110
116
|
|
|
111
|
-
const resolved = resolveViewer({ path: 'dropped.png', handleId }, 0);
|
|
117
|
+
const resolved = resolveViewer({ path: 'dropped.png', handleId }, 0, 1);
|
|
112
118
|
// No server path → no raw URL, and the picture is drawn from the handle.
|
|
113
119
|
expect(resolved.byteSource.url).toBeNull();
|
|
114
120
|
expect(resolved.imageUrl).toBeNull();
|
|
@@ -124,14 +130,14 @@ describe('resolveViewer', () => {
|
|
|
124
130
|
});
|
|
125
131
|
|
|
126
132
|
test('an inline attachment (content, no path) has no byte source', () => {
|
|
127
|
-
const resolved = resolveViewer({ path: 'pic.png', content: 'not-a-path' }, 0);
|
|
133
|
+
const resolved = resolveViewer({ path: 'pic.png', content: 'not-a-path' }, 0, 1);
|
|
128
134
|
expect(resolved.isImage).toBe(false);
|
|
129
135
|
expect(resolved.imageUrl).toBeNull();
|
|
130
136
|
expect(resolved.byteSource.url).toBeNull();
|
|
131
137
|
});
|
|
132
138
|
|
|
133
139
|
test('a document viewer takes the source object, not an imageUrl', () => {
|
|
134
|
-
const resolved = resolveViewer({ path: 'report.pdf', root: '/ws' }, 3);
|
|
140
|
+
const resolved = resolveViewer({ path: 'report.pdf', root: '/ws' }, 3, 1);
|
|
135
141
|
expect(resolved.isImage).toBe(false);
|
|
136
142
|
expect(resolved.imageUrl).toBeNull();
|
|
137
143
|
expect(resolved.byteSource.url).toContain('/api/fs/raw');
|
|
@@ -39,12 +39,16 @@ export interface ResolvedViewer {
|
|
|
39
39
|
viewerKind: ViewerKind;
|
|
40
40
|
isBinaryViewer: boolean;
|
|
41
41
|
isImage: boolean;
|
|
42
|
-
/** Raw-byte URL of the active image (cache-busted per
|
|
42
|
+
/** Raw-byte URL of the active image (cache-busted per activation), else null. */
|
|
43
43
|
imageUrl: string | null;
|
|
44
44
|
byteSource: ByteSource;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
export function resolveViewer(
|
|
47
|
+
export function resolveViewer(
|
|
48
|
+
target: ViewerTarget | null,
|
|
49
|
+
revision: number,
|
|
50
|
+
imageGeneration: number,
|
|
51
|
+
): ResolvedViewer {
|
|
48
52
|
const viewerKind = target ? viewerKindFor(target.path ?? '') : 'code';
|
|
49
53
|
const isBinaryViewer = BINARY_VIEWERS[viewerKind] === true;
|
|
50
54
|
|
|
@@ -62,10 +66,15 @@ export function resolveViewer(target: ViewerTarget | null, revision: number): Re
|
|
|
62
66
|
const byteSource = byteSourceFor({
|
|
63
67
|
path: target?.path,
|
|
64
68
|
handleId: target?.handleId,
|
|
65
|
-
// An image's URL is cache-busted per
|
|
66
|
-
//
|
|
69
|
+
// An image's URL is cache-busted per ACTIVATION and per revision: the
|
|
70
|
+
// browser keys a decoded picture on the URL alone, so `no-store` does not
|
|
71
|
+
// stop it reusing the old frame after the same URL is requested again
|
|
72
|
+
// (measured in Chromium, while WebKit re-fetched). `revision` is the manual
|
|
73
|
+
// Reload lever; `imageGeneration` changes every time this file becomes the
|
|
74
|
+
// active tab, so re-opening or switching back to it cannot inherit the old
|
|
75
|
+
// picture. The other byte viewers key their re-read on `revision` directly.
|
|
67
76
|
rawUrl: imageTarget
|
|
68
|
-
? `${buildFsRawUrl({ path: imageTarget, root: target?.root, repo: target?.repo })}&v=${revision}`
|
|
77
|
+
? `${buildFsRawUrl({ path: imageTarget, root: target?.root, repo: target?.repo })}&v=${revision}.${imageGeneration}`
|
|
69
78
|
: rawUrl,
|
|
70
79
|
});
|
|
71
80
|
|
|
@@ -287,3 +287,37 @@ describe('useFileEditor unsupported files', () => {
|
|
|
287
287
|
expect(state.writes).toBe(0);
|
|
288
288
|
});
|
|
289
289
|
});
|
|
290
|
+
|
|
291
|
+
describe('useFileEditor image cache-bust', () => {
|
|
292
|
+
const IMAGE = { id: 'pic', name: 'pic.png', path: 'pic.png' };
|
|
293
|
+
|
|
294
|
+
// A browser keys a decoded <img> on its URL and reuses that frame for an
|
|
295
|
+
// identical one even under `no-store` (measured in Chromium). So an image
|
|
296
|
+
// that is re-opened, or switched away from and back to, must not reuse the
|
|
297
|
+
// URL from its previous activation.
|
|
298
|
+
test('re-opening the same image yields a new URL', async () => {
|
|
299
|
+
await editor.mount(IMAGE);
|
|
300
|
+
const first = editor.mounted?.imageUrl;
|
|
301
|
+
await editor.mount(IMAGE);
|
|
302
|
+
const second = editor.mounted?.imageUrl;
|
|
303
|
+
|
|
304
|
+
expect(first).toContain('/api/fs/raw');
|
|
305
|
+
expect(first).toContain('path=pic.png');
|
|
306
|
+
expect(second).not.toBe(first);
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
test('switching away and back to an image yields a new URL', async () => {
|
|
310
|
+
const other = { id: 'notes', name: 'notes.md', path: 'notes.md' };
|
|
311
|
+
const state = freshState();
|
|
312
|
+
stubFetch(state);
|
|
313
|
+
await editor.mount(IMAGE);
|
|
314
|
+
const first = editor.mounted?.imageUrl;
|
|
315
|
+
|
|
316
|
+
await editor.update(other);
|
|
317
|
+
await editor.update(IMAGE);
|
|
318
|
+
const second = editor.mounted?.imageUrl;
|
|
319
|
+
|
|
320
|
+
expect(second).toContain('path=pic.png');
|
|
321
|
+
expect(second).not.toBe(first);
|
|
322
|
+
});
|
|
323
|
+
});
|