@kabmo-labs/kabmo 0.58.1 → 0.59.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.html +1 -1
- package/dist/client/index.js +513 -495
- package/dist/client/static/js/{Body-ysmhxbvk.js → Body-5yedtmnk.js} +3 -3
- package/dist/client/static/js/{CsvGrid-w90pxyn2.js → CsvGrid-39m8pp1c.js} +2 -2
- package/dist/client/static/js/{DocxView-evxn6kaq.js → DocxView-vd99cv12.js} +3 -3
- package/dist/client/static/js/{DrawioView-tmdevwf4.js → DrawioView-6nq4412n.js} +2 -2
- package/dist/client/static/js/{HtmlPreview-bpsn2z9p.js → HtmlPreview-cs51gszy.js} +1 -1
- package/dist/client/static/js/ImageView-nc2n0w6s.js +1 -0
- package/dist/client/static/js/LayoutWrapper-j7786frq.js +2 -0
- package/dist/client/static/js/MergeDiffView-0rn5zsy5.js +1 -0
- package/dist/client/static/js/Modal-7ag7a9qq.js +60 -0
- package/dist/client/static/js/{PdfView-txxn6qff.js → PdfView-0zab721q.js} +1 -1
- package/dist/client/static/js/SessionsView-t9rhx472.js +1 -0
- package/dist/client/static/js/{SheetView-52b33e6f.js → SheetView-2wdn5hkd.js} +11 -11
- package/dist/client/static/js/{SvgPreview-hrk4pfm1.js → SvgPreview-fmrfxd7z.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-at77sybc.js → abnfDiagram-O67JEVCF-41scfh9v.js} +1 -1
- package/dist/client/static/js/architecture-7GRP2DOG-bwn1drdz.js +1 -0
- package/dist/client/static/js/{architectureDiagram-NJMV4G6O-raw33jgg.js → architectureDiagram-NJMV4G6O-fp6etjvt.js} +3 -3
- package/dist/client/static/js/{astro-qha7sceh.js → astro-ryr2ajmg.js} +1 -1
- package/dist/client/static/js/bash-zknkkwkw.js +1 -0
- package/dist/client/static/js/{blockDiagram-BEXU5L5S-b6e90fbk.js → blockDiagram-BEXU5L5S-pespk9mt.js} +4 -4
- package/dist/client/static/js/c-0w02jkxb.js +1 -0
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-msg9y1c6.js → c4Diagram-YGBWAQC7-rt4z91dx.js} +2 -2
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-jmrd1h8r.js → classDiagram-v2-NBCMYWYE-6bzaq8sd.js} +4 -4
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-na65ebq3.js → cose-bilkent-JH36ORCC-z3fhgcba.js} +1 -1
- package/dist/client/static/js/cpp-p5b4vean.js +1 -0
- package/dist/client/static/js/css-9jzbvdyz.js +1 -0
- package/dist/client/static/js/css-sn00sq6v.js +1 -0
- package/dist/client/static/js/cynefin-OW5HDTMX-jbc50ks8.js +1 -0
- package/dist/client/static/js/{cynefinDiagram-VND7K2PF-9xkkw71m.js → cynefinDiagram-VND7K2PF-8endeh4p.js} +2 -2
- package/dist/client/static/js/{dagre-6A5THRUB-p59f19tv.js → dagre-6A5THRUB-2a2f32dv.js} +2 -2
- package/dist/client/static/js/{diagram-22UHCM2B-2e2rcvn7.js → diagram-22UHCM2B-wgbyr6b7.js} +9 -9
- package/dist/client/static/js/{diagram-3UASUU5V-r9ds8vgr.js → diagram-3UASUU5V-5122b41x.js} +1 -1
- package/dist/client/static/js/{diagram-ATOU4E4O-jgwxv7v8.js → diagram-ATOU4E4O-1gt9fr7e.js} +3 -3
- package/dist/client/static/js/{diagram-CDSNMT55-20m35eqq.js → diagram-CDSNMT55-v6hs59jb.js} +4 -4
- package/dist/client/static/js/{diagram-MLGK6HIB-vt3kxt2m.js → diagram-MLGK6HIB-yey2m5nm.js} +1 -1
- package/dist/client/static/js/{diagram-MPIPVDR6-c47rgxf1.js → diagram-MPIPVDR6-hg4f3q4d.js} +2 -2
- package/dist/client/static/js/{dockerfile-gtcyey0q.js → dockerfile-56tfnp5r.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-aszw3xy3.js → ebnfDiagram-ZINNZB2B-2mhc9aar.js} +1 -1
- package/dist/client/static/js/{elixir-w92v180e.js → elixir-fyxw6d70.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-gbvr3gry.js → elk-276RUBZZ-wedtvz9y.js} +2 -2
- package/dist/client/static/js/{erDiagram-OPXOYQCR-1hqca8qe.js → erDiagram-OPXOYQCR-1kysnby9.js} +6 -6
- package/dist/client/static/js/{erlang-v7344938.js → erlang-97ayje6m.js} +1 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-b37ey01t.js +1 -0
- package/dist/client/static/js/flowDiagram-KWPJA3E3-vd4z6bvy.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-07v22te5.js → ganttDiagram-FUAMR5RP-j4g65rpm.js} +3 -3
- package/dist/client/static/js/gitGraph-4MIJSDKK-mvqq7tcs.js +1 -0
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-y068jtz9.js → gitGraphDiagram-X574FWY7-vcwmj4b3.js} +8 -8
- package/dist/client/static/js/graphql-xzykn0ba.js +1 -0
- package/dist/client/static/js/html-2zc3shky.js +1 -0
- package/dist/client/static/js/{index-r8d4bk86.js → index-10vzyga1.js} +2 -2
- package/dist/client/static/js/index-1mkn5fbf.js +481 -0
- package/dist/client/static/js/{index-medk4f18.js → index-2h7xh93h.js} +2 -2
- package/dist/client/static/js/{index-fhtnvqgf.js → index-3j2he86h.js} +2 -2
- package/dist/client/static/js/{index-zhgh7a31.js → index-3kedv94b.js} +2 -2
- package/dist/client/static/js/{index-374xq5a4.js → index-42k78whj.js} +1 -1
- package/dist/client/static/js/{index-c9aqx3ht.js → index-42q5gg7t.js} +1 -1
- package/dist/client/static/js/index-461ga40v.js +2 -0
- package/dist/client/static/js/{index-9qf2h9jb.js → index-51rbgeh9.js} +12 -12
- package/dist/client/static/js/{index-tdg7hz80.js → index-58z2hatp.js} +2 -2
- package/dist/client/static/js/{index-4tbdws4r.js → index-5e4e18tg.js} +2 -2
- package/dist/client/static/js/{index-th61y26d.js → index-69mnn71v.js} +2 -2
- package/dist/client/static/js/index-6vbra7p9.js +1 -0
- package/dist/client/static/js/{index-007sewcn.js → index-7enfdvh0.js} +2 -2
- package/dist/client/static/js/{index-gaa39w5q.js → index-8tzt0dek.js} +2 -2
- package/dist/client/static/js/{index-ewryzs4g.js → index-92h38pwg.js} +2 -2
- package/dist/client/static/js/{index-vw8b29ek.js → index-9mgpbwfr.js} +1 -1
- package/dist/client/static/js/{index-80kx6dm6.js → index-a3bpmw2r.js} +2 -2
- package/dist/client/static/js/{index-fv7nybnf.js → index-a70sk36c.js} +2 -2
- package/dist/client/static/js/index-c5401dqs.js +4 -0
- package/dist/client/static/js/{index-xmg1x6zv.js → index-csxnqgzw.js} +5 -5
- package/dist/client/static/js/{index-qefssj0m.js → index-d201jvs9.js} +1 -1
- package/dist/client/static/js/{index-y0f3wbc3.js → index-d9sfavx1.js} +2 -2
- package/dist/client/static/js/{index-5hvt233n.js → index-db6s66jr.js} +2 -2
- package/dist/client/static/js/index-dbsy29gn.js +2 -0
- package/dist/client/static/js/{index-j830qk07.js → index-dw9epydj.js} +2 -2
- package/dist/client/static/js/{index-s4dpkds5.js → index-e39m185a.js} +2 -2
- package/dist/client/static/js/{index-dxq1tbwm.js → index-fg0ne74z.js} +2 -2
- package/dist/client/static/js/{index-hb7a7m9m.js → index-fnaq8baz.js} +1 -1
- package/dist/client/static/js/{index-tq3t3qm4.js → index-fsa18ns9.js} +2 -2
- package/dist/client/static/js/{index-wxqcnsrq.js → index-fvphmwkf.js} +2 -2
- package/dist/client/static/js/{index-94d416ee.js → index-gajpd90b.js} +2 -2
- package/dist/client/static/js/{index-rxt8sf9a.js → index-h1xbx74w.js} +2 -2
- package/dist/client/static/js/{index-1e0rt7c6.js → index-hgzf4ask.js} +5 -5
- package/dist/client/static/js/{index-wn28m9h7.js → index-hrez92pw.js} +8 -8
- package/dist/client/static/js/{index-zs7kw0be.js → index-jaf968hx.js} +4 -4
- package/dist/client/static/js/{index-sxag9ptg.js → index-jct0jryd.js} +2 -2
- package/dist/client/static/js/{index-5xxbbzqa.js → index-kt77dwsg.js} +7 -7
- package/dist/client/static/js/{index-8d8ce00v.js → index-m62sf9wn.js} +2 -2
- package/dist/client/static/js/{index-6x0kn8pb.js → index-mhrkjbjq.js} +2 -2
- package/dist/client/static/js/index-mttx9327.css +1 -0
- package/dist/client/static/js/{index-1e710snk.js → index-n7bmqeqz.js} +1 -1
- package/dist/client/static/js/{index-3ymw778n.js → index-ndqtff48.js} +2 -2
- package/dist/client/static/js/{index-cmjyet7w.js → index-nf4hq5tg.js} +27 -27
- package/dist/client/static/js/{index-3p732mvs.js → index-np2rfq06.js} +2 -2
- package/dist/client/static/js/{index-2s17netq.js → index-nwbr15b3.js} +2 -2
- package/dist/client/static/js/{index-nptbz7sv.js → index-pn0ja904.js} +1 -1
- package/dist/client/static/js/{index-azz46nwc.js → index-pr8wsq24.js} +2 -2
- package/dist/client/static/js/{index-7sq6cjt1.js → index-q3k8r0ms.js} +11 -11
- package/dist/client/static/js/{index-an7fq7f6.js → index-qc3de995.js} +1 -1
- package/dist/client/static/js/{index-f61c25vn.js → index-r42f3r1p.js} +3 -3
- package/dist/client/static/js/{index-e4nge3f4.js → index-s7p2wdr1.js} +1 -1
- package/dist/client/static/js/{index-vny4ymjf.js → index-sg65xdey.js} +1 -1
- package/dist/client/static/js/index-skp6991n.js +2 -0
- package/dist/client/static/js/index-spnrx2c0.js +2 -0
- package/dist/client/static/js/{index-fe92hqmb.js → index-sqyvj03y.js} +4 -4
- package/dist/client/static/js/{index-cpp43af3.js → index-tz5ewsza.js} +9 -9
- package/dist/client/static/js/{index-v8xhgfeq.js → index-vs2y8gxr.js} +2 -2
- package/dist/client/static/js/{index-e0kahttb.js → index-vs3g6njv.js} +1 -1
- package/dist/client/static/js/index-wkxsypj1.js +2 -0
- package/dist/client/static/js/{index-gqrt766t.js → index-xqz7bqcn.js} +61 -61
- package/dist/client/static/js/{index-jxsha63v.js → index-y4cx8cqf.js} +2 -2
- package/dist/client/static/js/{index-kzzvrqnv.js → index-y5pkqrga.js} +2 -2
- package/dist/client/static/js/{index-3m1dksmy.js → index-yrwm437g.js} +2 -2
- package/dist/client/static/js/{index-7ynf3s2w.js → index-z82nd2bd.js} +2 -2
- package/dist/client/static/js/info-A6RAGUB7-zkv4crz7.js +1 -0
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-1x83h4k4.js → infoDiagram-VRGFBTTK-7craq9x2.js} +2 -2
- package/dist/client/static/js/ini-62r3vxaf.js +1 -0
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-et6z3c28.js → ishikawaDiagram-OU5B5YK6-ncjty2re.js} +2 -2
- package/dist/client/static/js/java-kacycary.js +1 -0
- package/dist/client/static/js/javascript-zc1qnyyp.js +1 -0
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-sw669e7a.js → journeyDiagram-ZHPQQLJL-yx222bzt.js} +2 -2
- package/dist/client/static/js/json-yrwpn6bd.js +1 -0
- package/dist/client/static/js/jsx-b40ag8q1.js +1 -0
- package/dist/client/static/js/{julia-z14p8jsx.js → julia-agc5kfvg.js} +1 -1
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-aqxg95kx.js → kanban-definition-PNTS6WVX-a2f84qmn.js} +6 -6
- package/dist/client/static/js/lua-bk961f37.js +1 -0
- package/dist/client/static/js/markdown-b7rgzgd6.js +1 -0
- package/dist/client/static/js/mermaid.core-9vfwthw3.js +12 -0
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-530anpc4.js → mindmap-definition-NLK3R4M7-fsxysg6f.js} +4 -4
- package/dist/client/static/js/one-dark-pro-7v4by00h.js +1 -0
- package/dist/client/static/js/one-light-5rfzh8p4.js +1 -0
- package/dist/client/static/js/packet-AYTQ26CC-dgpge627.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-5zar6hvy.js → pegDiagram-GJSIUBJH-77wxmp9g.js} +1 -1
- package/dist/client/static/js/{perl-1na2x6yd.js → perl-v5vbtzgf.js} +1 -1
- package/dist/client/static/js/{php-x75tt7w3.js → php-83qwy98t.js} +1 -1
- package/dist/client/static/js/pie-WAS4IAKB-b8pgsqrd.js +1 -0
- package/dist/client/static/js/{pieDiagram-5QR66LMP-3bx8syvw.js → pieDiagram-5QR66LMP-gvgfhez0.js} +3 -3
- package/dist/client/static/js/properties-k8gbzggp.js +1 -0
- package/dist/client/static/js/python-343tspad.js +1 -0
- package/dist/client/static/js/{quadrantDiagram-O4NWA36T-yaarpr2e.js → quadrantDiagram-O4NWA36T-9zkbt5h8.js} +2 -2
- package/dist/client/static/js/r-ycdwmv8g.js +1 -0
- package/dist/client/static/js/radar-RG4KPBEZ-fmfe5y27.js +1 -0
- package/dist/client/static/js/railroad-74A4TZTK-b5tks4ce.js +1 -0
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-0sf4m0ze.js +1 -0
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-pjfy3pt7.js +1 -0
- package/dist/client/static/js/railroad-peg-WCYAUIDC-nr8ngt42.js +1 -0
- package/dist/client/static/js/{railroadDiagram-XR7U4H2S-ag41q4nt.js → railroadDiagram-XR7U4H2S-w55bsyw6.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-g8sr48h4.js → requirementDiagram-PLB6GJNP-828s1e5g.js} +3 -3
- package/dist/client/static/js/{ruby-3h22qahv.js → ruby-994n5j6e.js} +1 -1
- package/dist/client/static/js/{rust-r27demr5.js → rust-csv5f258.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-t1wbd1hh.js → sankeyDiagram-IPEJSGJF-34f3fyvg.js} +3 -3
- package/dist/client/static/js/{sass-8bq5r2tz.js → sass-p6g7qdv2.js} +1 -1
- package/dist/client/static/js/{scss-c04ezwnn.js → scss-4j4t3r6y.js} +1 -1
- package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-407mjqty.js → sequenceDiagram-PO4LG4MO-nnta2hn0.js} +7 -7
- package/dist/client/static/js/{sizeCapture-INFHLROL-w38zb9ky.js → sizeCapture-INFHLROL-gpcramga.js} +1 -1
- package/dist/client/static/js/sql-kwpd5w07.js +1 -0
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-4cvgymkc.js → stateDiagram-v2-GCMORJYK-3f2en220.js} +3 -3
- package/dist/client/static/js/{svelte-egg3x4tw.js → svelte-bek3h1sz.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-w7ts2rzw.js → swimlanes-2SLR337P-jgqt12z9.js} +1 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-xx1z57df.js +8 -0
- package/dist/client/static/js/{timeline-definition-EJHVYXUP-nq46nzy9.js → timeline-definition-EJHVYXUP-sgchcs11.js} +3 -3
- package/dist/client/static/js/treeView-Q6P3EWNA-23r9fa68.js +1 -0
- package/dist/client/static/js/treemap-WGGIJYW6-mxxzdrj6.js +1 -0
- package/dist/client/static/js/tsx-gjxfjnbk.js +1 -0
- package/dist/client/static/js/typescript-4dchbnya.js +1 -0
- package/dist/client/static/js/{usecaseDiagram-POWQR4AR-q144snzb.js → usecaseDiagram-POWQR4AR-znkg9pkq.js} +15 -15
- package/dist/client/static/js/{vennDiagram-UO4OBE2U-2wemak2p.js → vennDiagram-UO4OBE2U-dncg96ej.js} +4 -4
- package/dist/client/static/js/{vue-d7p4wv35.js → vue-y44m889c.js} +1 -1
- package/dist/client/static/js/wardley-WFR3VGLG-cbqtax1x.js +1 -0
- package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-bb2qvvgr.js → wardleyDiagram-VNRHLVJA-77xz2d49.js} +4 -4
- package/dist/client/static/js/xml-xs6qz3ya.js +1 -0
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-9dr05fdq.js → xychartDiagram-PMCCYNJV-40j1aqyf.js} +4 -4
- package/dist/client/static/js/yaml-174nk5bn.js +1 -0
- package/package.json +7 -7
- package/src/client/borders.css +15 -3
- package/src/client/components/common/ComposerTextarea.test.tsx +13 -1
- package/src/client/components/common/ComposerTextarea.tsx +8 -2
- package/src/client/components/common/MarkdownRenderer.tsx +11 -2
- package/src/client/components/common/harness-glyph/harness-glyph.test.ts +0 -4
- package/src/client/components/common/harness-glyph/index.tsx +4 -5
- package/src/client/components/common/markdown-inline-file.test.tsx +90 -15
- package/src/client/components/common/session-actions-menu/index.test.tsx +45 -0
- package/src/client/components/common/session-actions-menu/index.tsx +6 -1
- package/src/client/components/common/session-row/TrailingSlot.tsx +8 -1
- package/src/client/components/common/session-row/index.tsx +4 -0
- package/src/client/components/common/session-row/session-row.test.tsx +5 -0
- package/src/client/components/layout/desktop-layout/RightColumn.tsx +4 -1
- package/src/client/components/layout/desktop-layout/WorkspacePanels.tsx +28 -35
- package/src/client/components/layout/desktop-layout/index.tsx +5 -3
- package/src/client/components/layout/desktop-layout/resizer/index.tsx +13 -3
- package/src/client/components/layout/desktop-layout/resizer/panel.test.ts +41 -0
- package/src/client/components/layout/session-sidebar/CategoryHeader.tsx +21 -1
- package/src/client/components/layout/session-sidebar/CategoryHeader.worktree.test.tsx +1 -0
- package/src/client/components/layout/session-sidebar/CategoryItem.tsx +8 -2
- package/src/client/components/layout/session-sidebar/ClassicView.tsx +2 -0
- package/src/client/components/layout/session-sidebar/SessionList.tsx +4 -0
- package/src/client/components/layout/session-sidebar/SessionsView.tsx +22 -1
- package/src/client/components/layout/session-sidebar/modern/RevealRow.tsx +36 -5
- package/src/client/components/layout/session-sidebar/modern/WorkspaceHeader.tsx +45 -28
- package/src/client/components/layout/session-sidebar/modern/WorkspaceSection.tsx +10 -3
- package/src/client/components/layout/session-sidebar/modern/index.tsx +2 -0
- package/src/client/components/layout/session-sidebar/modern/reveal-row.test.tsx +28 -1
- package/src/client/components/layout/session-sidebar/modern/workspace-header.test.tsx +27 -11
- package/src/client/components/layout/session-sidebar/search-results.test.tsx +29 -16
- package/src/client/components/layout/session-sidebar/session-list-states.test.tsx +1 -0
- package/src/client/components/layout/session-sidebar/variant-props.ts +2 -0
- package/src/client/components/mobile/LayoutWrapper.tsx +9 -0
- package/src/client/components/mobile/SessionSidebar.tsx +4 -0
- package/src/client/components/mobile/left-drawer-nav.test.tsx +1 -1
- package/src/client/components/mobile/mobile-session-sidebar/Body.tsx +4 -0
- package/src/client/components/mobile/mobile-session-sidebar/ClassicDrawer.tsx +3 -0
- package/src/client/components/mobile/mobile-session-sidebar/Item.test.tsx +85 -0
- package/src/client/components/mobile/mobile-session-sidebar/Item.tsx +30 -14
- package/src/client/components/mobile/mobile-session-sidebar/List.tsx +4 -0
- package/src/client/components/settings/apply-side-effects.test.ts +31 -0
- package/src/client/components/settings/apply-side-effects.ts +7 -0
- package/src/client/components/settings/categories/appearance-settings/BorderStyleSection.tsx +3 -2
- package/src/client/components/settings/categories/appearance-settings/SidebarStyleSection.test.tsx +95 -0
- package/src/client/components/settings/categories/appearance-settings/SidebarStyleSection.tsx +35 -0
- package/src/client/components/workspace/chat-timeline/EmptyWorkspacePrompt.tsx +1 -0
- package/src/client/components/workspace/chat-timeline/MessageItem.gutter.test.ts +26 -0
- package/src/client/components/workspace/chat-timeline/MessageItem.tsx +6 -3
- package/src/client/components/workspace/chat-timeline/ThinkingSection.test.tsx +17 -0
- package/src/client/components/workspace/chat-timeline/ThinkingSection.tsx +9 -3
- package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.test.ts +39 -2
- package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.tsx +19 -4
- package/src/client/components/workspace/chat-timeline/chat-input/AttachmentToolbar.tsx +28 -21
- package/src/client/components/workspace/chat-timeline/chat-input/AttachmentToolbar.wait.test.tsx +48 -0
- package/src/client/components/workspace/chat-timeline/chat-input/ComposerRows.tsx +44 -21
- package/src/client/components/workspace/chat-timeline/chat-input/GoalBanner.test.ts +24 -0
- package/src/client/components/workspace/chat-timeline/chat-input/GoalBanner.tsx +44 -18
- package/src/client/components/workspace/chat-timeline/chat-input/GoalSurfaces.tsx +2 -1
- package/src/client/components/workspace/chat-timeline/chat-input/ModeToggles.test.ts +35 -0
- package/src/client/components/workspace/chat-timeline/chat-input/ModeToggles.tsx +33 -12
- package/src/client/components/workspace/chat-timeline/chat-input/SessionModeDropdown.test.tsx +24 -0
- package/src/client/components/workspace/chat-timeline/chat-input/SessionModeDropdown.tsx +14 -3
- package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.test.ts +24 -1
- package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.tsx +78 -135
- package/src/client/components/workspace/chat-timeline/chat-input/VoiceButton.tsx +58 -0
- package/src/client/components/workspace/chat-timeline/chat-input/action-base.ts +42 -0
- package/src/client/components/workspace/chat-timeline/chat-input/index.tsx +1 -0
- package/src/client/components/workspace/chat-timeline/chat-input/mode-icons.test.ts +108 -0
- package/src/client/components/workspace/chat-timeline/chat-input/mode-icons.tsx +122 -0
- package/src/client/components/workspace/chat-timeline/chat-input/narrow.test.tsx +78 -20
- package/src/client/components/workspace/chat-timeline/chat-input/styles/index.tsx +11 -5
- package/src/client/components/workspace/chat-timeline/chat-input/styles.test.tsx +19 -0
- package/src/client/components/workspace/chat-timeline/composer-dock-frame.test.tsx +9 -0
- package/src/client/components/workspace/chat-timeline/index.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/OptionRow.test.tsx +125 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/OptionRow.tsx +84 -27
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Mcp.test.tsx +18 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Mcp.tsx +14 -5
- package/src/client/components/workspace/model-dropdown/CloseButton.tsx +2 -2
- package/src/client/components/workspace/model-dropdown/Fullscreen.tsx +2 -2
- package/src/client/components/workspace/model-dropdown/HarnessTabs.tsx +40 -10
- package/src/client/components/workspace/model-dropdown/Header.tsx +33 -18
- package/src/client/components/workspace/model-dropdown/Panel.tsx +19 -1
- package/src/client/components/workspace/model-dropdown/ThinkingLevels.tsx +51 -0
- package/src/client/components/workspace/model-dropdown/Trigger.tsx +99 -0
- package/src/client/components/workspace/model-dropdown/bands.ts +51 -0
- package/src/client/components/workspace/model-dropdown/harness-tabs.test.tsx +39 -5
- package/src/client/components/workspace/model-dropdown/index.tsx +20 -47
- package/src/client/components/workspace/model-dropdown/picker-close.test.tsx +34 -4
- package/src/client/components/workspace/model-dropdown/thinking-levels.test.tsx +108 -0
- package/src/client/components/workspace/model-dropdown/trigger.test.ts +54 -8
- package/src/client/hooks/chat/composer/attachments.test.ts +12 -0
- package/src/client/hooks/chat/composer/attachments.ts +16 -4
- package/src/client/hooks/chat/composer/pipeline.test.ts +14 -0
- package/src/client/hooks/chat/composer/pipeline.ts +15 -6
- package/src/client/hooks/chat/omp/session-list.activity.test.ts +20 -0
- package/src/client/hooks/chat/omp/session-merges.ts +18 -6
- package/src/client/hooks/chat/omp/session-sidebar-controller.ts +4 -0
- package/src/client/hooks/chat/timeline/scope.test.ts +17 -0
- package/src/client/hooks/chat/timeline/scope.ts +6 -1
- package/src/client/hooks/chat/timeline/send-refusal.test.ts +19 -0
- package/src/client/hooks/chat/timeline/send-steer.test.ts +17 -0
- package/src/client/hooks/chat/timeline/send.ts +17 -0
- package/src/client/hooks/editor/quick-open.ts +41 -0
- package/src/client/hooks/ui/border-style.test.ts +13 -0
- package/src/client/hooks/ui/markdown-render.ts +11 -6
- package/src/client/hooks/ui/open-inline-file.test.ts +16 -0
- package/src/client/hooks/ui/open-inline-file.ts +4 -2
- package/src/client/hooks/ui/show-more.ts +11 -1
- package/src/client/hooks/ui/ui-feedback.test.ts +11 -0
- package/src/client/hooks/ui/verified-inline-files.test.tsx +143 -0
- package/src/client/hooks/ui/verified-inline-files.ts +165 -0
- package/src/client/hooks/workspace/mobile-workspace-panels.test.tsx +116 -0
- package/src/client/hooks/workspace/mobile-workspace-panels.ts +73 -0
- package/src/client/hooks/workspace/panel-resize.test.ts +127 -0
- package/src/client/hooks/workspace/panel-resize.ts +81 -0
- package/src/client/hooks/workspace/session-list-limit.test.ts +80 -0
- package/src/client/hooks/workspace/session-list-limit.ts +69 -0
- package/src/client/hooks/workspace/session-pin.ts +58 -0
- package/src/client/hooks/workspace/workspace-panels-mode.test.tsx +87 -0
- package/src/client/hooks/workspace/workspace-panels-mode.ts +76 -0
- package/src/client/lib/router/branch-params.test.ts +17 -1
- package/src/client/lib/router/branch-params.ts +18 -0
- package/src/client/lib/ui/pressed.ts +15 -0
- package/src/client/tailwind.css +30 -10
- package/src/server/lib/connect/cloudflared.lifecycle.test.ts +25 -9
- package/src/server/lib/db/schema.test.ts +1 -1
- package/src/server/lib/db/schema.ts +17 -0
- package/src/server/lib/harness/activity.server.test.ts +81 -0
- package/src/server/lib/harness/activity.server.ts +55 -0
- package/src/server/lib/harness/spawn.server.ts +9 -0
- package/src/server/lib/omp/session/delete.server.ts +4 -2
- package/src/server/lib/omp/session/sidebar-activity.server.test.ts +24 -2
- package/src/server/lib/omp/session/sidebar-data.canonical.test.ts +14 -0
- package/src/server/lib/sessions/last-opened.server.test.ts +17 -0
- package/src/server/lib/sessions/last-opened.server.ts +18 -1
- package/src/server/routes/sessions/index.ts +3 -2
- package/src/server/routes/sessions/routes.test.ts +29 -46
- package/src/server/routes/sessions/session.ts +40 -62
- package/src/server/routes/sessions/state.test.ts +89 -0
- package/src/server/routes/sessions/state.ts +86 -0
- package/src/shared/lib/chat/attachment-budget.test.ts +74 -0
- package/src/shared/lib/chat/attachment-budget.ts +111 -0
- package/src/shared/lib/chat/attachments.test.ts +0 -17
- package/src/shared/lib/chat/attachments.ts +0 -53
- package/src/shared/lib/chat/timeline/block-chrome.test.ts +35 -0
- package/src/shared/lib/chat/timeline/block-chrome.ts +21 -0
- package/src/shared/lib/markdown/degenerate-emphasis.test.ts +64 -0
- package/src/shared/lib/markdown/degenerate-emphasis.ts +90 -0
- package/src/shared/lib/markdown/inline-file.test.ts +79 -22
- package/src/shared/lib/markdown/inline-file.ts +57 -25
- package/src/shared/lib/markdown/marked.ts +5 -1
- package/src/shared/lib/settings/defaults.ts +2 -0
- package/src/shared/lib/theme/border-style.ts +1 -1
- package/src/shared/lib/workspace/active-project.test.ts +17 -1
- package/src/shared/lib/workspace/active-project.ts +9 -0
- package/src/shared/lib/workspace/project-settings-delete.test.ts +97 -0
- package/src/shared/lib/workspace/project-settings.test.ts +2 -34
- package/src/shared/lib/workspace/project-settings.ts +6 -0
- package/src/shared/lib/workspace/session-list-limit.test.ts +31 -0
- package/src/shared/lib/workspace/session-list-limit.ts +32 -0
- package/src/shared/lib/workspace/sidebar-sort.test.ts +21 -0
- package/src/shared/lib/workspace/workspace-panel-widths.ts +1 -1
- package/src/shared/lib/workspace/workspace-session.test.ts +34 -0
- package/src/shared/lib/workspace/workspace-session.ts +40 -0
- package/src/shared/types/settings/state.ts +10 -0
- package/dist/client/static/js/ImageView-ssazqckj.js +0 -1
- package/dist/client/static/js/LayoutWrapper-qwpfq4dq.js +0 -2
- package/dist/client/static/js/MergeDiffView-en6aazw8.js +0 -1
- package/dist/client/static/js/Modal-zjnhj9nb.js +0 -60
- package/dist/client/static/js/SessionsView-eryjtmb2.js +0 -1
- package/dist/client/static/js/architecture-7GRP2DOG-v05ap4e3.js +0 -1
- package/dist/client/static/js/bash-n5d0esqg.js +0 -1
- package/dist/client/static/js/c-pk766wx0.js +0 -1
- package/dist/client/static/js/cpp-3pt91jvm.js +0 -1
- package/dist/client/static/js/css-q2k6afe3.js +0 -1
- package/dist/client/static/js/css-sp1cgdbr.js +0 -1
- package/dist/client/static/js/cynefin-OW5HDTMX-sqv0ze38.js +0 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-t4dzf5s7.js +0 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-c16xmjyv.js +0 -1
- package/dist/client/static/js/gitGraph-4MIJSDKK-0jq8y0qd.js +0 -1
- package/dist/client/static/js/graphql-qx4tt6ze.js +0 -1
- package/dist/client/static/js/html-5e0g8664.js +0 -1
- package/dist/client/static/js/index-4ddgpqm0.css +0 -1
- package/dist/client/static/js/index-5g2j626a.js +0 -1
- package/dist/client/static/js/index-cc7qbfvn.js +0 -477
- package/dist/client/static/js/index-f27wvdky.js +0 -4
- package/dist/client/static/js/index-m5n0zsft.js +0 -2
- package/dist/client/static/js/index-rqt8mem9.js +0 -2
- package/dist/client/static/js/index-s9k82stc.js +0 -2
- package/dist/client/static/js/index-skwem10a.js +0 -2
- package/dist/client/static/js/index-tv9rn2nd.js +0 -2
- package/dist/client/static/js/info-A6RAGUB7-szttx3v5.js +0 -1
- package/dist/client/static/js/ini-bdk46a3d.js +0 -1
- package/dist/client/static/js/java-3g3925cf.js +0 -1
- package/dist/client/static/js/javascript-av46zx4c.js +0 -1
- package/dist/client/static/js/json-hdyzmffz.js +0 -1
- package/dist/client/static/js/jsx-y8r9mrdq.js +0 -1
- package/dist/client/static/js/lua-wf5k6p3r.js +0 -1
- package/dist/client/static/js/markdown-9bf16dx7.js +0 -1
- package/dist/client/static/js/mermaid.core-6cgqsgcf.js +0 -12
- package/dist/client/static/js/one-dark-pro-9hnhtkpr.js +0 -1
- package/dist/client/static/js/one-light-2n5y8592.js +0 -1
- package/dist/client/static/js/packet-AYTQ26CC-401149bv.js +0 -1
- package/dist/client/static/js/pie-WAS4IAKB-bgfv8tfz.js +0 -1
- package/dist/client/static/js/properties-xk4dn00p.js +0 -1
- package/dist/client/static/js/python-7sgz05n4.js +0 -1
- package/dist/client/static/js/r-w4qxm0pv.js +0 -1
- package/dist/client/static/js/radar-RG4KPBEZ-pw720590.js +0 -1
- package/dist/client/static/js/railroad-74A4TZTK-n2a30ngs.js +0 -1
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-rn5rx9qt.js +0 -1
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-t4yryhtd.js +0 -1
- package/dist/client/static/js/railroad-peg-WCYAUIDC-c4ebgvrr.js +0 -1
- package/dist/client/static/js/sql-sd00wgem.js +0 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-v82nym6b.js +0 -8
- package/dist/client/static/js/treeView-Q6P3EWNA-bxgt5yhm.js +0 -1
- package/dist/client/static/js/treemap-WGGIJYW6-hh3595m0.js +0 -1
- package/dist/client/static/js/tsx-h5yzg80q.js +0 -1
- package/dist/client/static/js/typescript-qy1sbhea.js +0 -1
- package/dist/client/static/js/wardley-WFR3VGLG-6bza7h1b.js +0 -1
- package/dist/client/static/js/xml-mrk4xakv.js +0 -1
- package/dist/client/static/js/yaml-xaza6dra.js +0 -1
- package/src/client/components/workspace/chat-timeline/chat-input/ThinkingLevelDropdown.test.tsx +0 -110
- package/src/client/components/workspace/chat-timeline/chat-input/ThinkingLevelDropdown.tsx +0 -86
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The picker's chrome-band geometry, in one place.
|
|
8
|
+
*
|
|
9
|
+
* Four bands stand on top of the model list — Add provider, Search, the thinking
|
|
10
|
+
* ladder and the harness strip — and each used to own its padding, so they
|
|
11
|
+
* measured 35, 34, 32 and 40px. The strip read as a different window from the
|
|
12
|
+
* rows under it. Stating the height once is what makes them one rhythm.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The height of every picker band.
|
|
17
|
+
*
|
|
18
|
+
* 36px is the desktop density: an 18px mark with 9px above and below.
|
|
19
|
+
*
|
|
20
|
+
* `shrink-0` is load-bearing: the card is a flex COLUMN whose list sibling is
|
|
21
|
+
* clamped by a max height, and a fixed-height band that is allowed to shrink did
|
|
22
|
+
* exactly that — measured, the thinking ladder collapsed from 36px to its 20.3px
|
|
23
|
+
* content while the add and search rows kept their height.
|
|
24
|
+
*
|
|
25
|
+
* On a coarse pointer it grows to 48px because every harness tab is a
|
|
26
|
+
* `tap-chip`: that floor is 44px, and the strip keeps 4px of air around it.
|
|
27
|
+
* A fixed band height on a touch device must hold the tab, not clip it.
|
|
28
|
+
*/
|
|
29
|
+
export const PICKER_BAND_HEIGHT = 'h-9 shrink-0 pointer-coarse:h-12';
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The harness strip's leading inset, so its FIRST mark sits on the same column
|
|
33
|
+
* as the Add provider plus, the search glyph and the thinking brain.
|
|
34
|
+
*
|
|
35
|
+
* A fine-pointer tab is a 24px box (a 12px mark plus `p-1.5`), so its mark
|
|
36
|
+
* centres 12px into the tab. The band rail's marks centre at `pl-2.5` (10px)
|
|
37
|
+
* plus half of the 18px slot (9px) = 19px, and `7 + 12 = 19`.
|
|
38
|
+
*/
|
|
39
|
+
export const PICKER_STRIP_INSET = 'pl-[7px] pointer-coarse:pl-0';
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The coarse-pointer pull, applied to the strip itself.
|
|
43
|
+
*
|
|
44
|
+
* A coarse tab reaches its 44px `tap-chip` floor, so its centred mark sits 22px
|
|
45
|
+
* in instead of 12px. Pulling the whole strip 3px left (background included)
|
|
46
|
+
* makes `0 - 3 + 22 = 19` again; without it every tab's mark sat 10px right of
|
|
47
|
+
* the column the rows below share. On the phone the strip still starts inside
|
|
48
|
+
* the frame; in the desktop popover the card's own clip trims the 2px that
|
|
49
|
+
* crosses its border.
|
|
50
|
+
*/
|
|
51
|
+
export const PICKER_STRIP_SHIFT = 'pointer-coarse:-ml-[3px]';
|
|
@@ -93,6 +93,23 @@ describe('harness tabs', () => {
|
|
|
93
93
|
expect(picked).toEqual(['claude']);
|
|
94
94
|
});
|
|
95
95
|
|
|
96
|
+
test('the selected tab is filled and barred, the others are neither', async () => {
|
|
97
|
+
const el = await mount(h(HarnessTabs, {
|
|
98
|
+
harnesses: [summary('omp-rpc'), summary('claude')],
|
|
99
|
+
active: 'omp-rpc',
|
|
100
|
+
onSelect: () => {},
|
|
101
|
+
}));
|
|
102
|
+
const [active, idle] = Array.from(el.querySelectorAll('[role="tab"]')) as HTMLElement[];
|
|
103
|
+
// The tint, not `bg-paper`: the strip sits on a translucent popover, so a
|
|
104
|
+
// paper fill was ~2% off it on the light palettes and selection vanished.
|
|
105
|
+
expect(active.className).toContain('bg-ink/10');
|
|
106
|
+
expect(idle.className).not.toContain('bg-ink/10');
|
|
107
|
+
// The indicator is a real element; the arbitrary inset shadow it replaced
|
|
108
|
+
// computed to the transparent default and painted nothing.
|
|
109
|
+
expect(active.querySelector('span.bg-ink')).not.toBeNull();
|
|
110
|
+
expect(idle.querySelector('span.bg-ink')).toBeNull();
|
|
111
|
+
});
|
|
112
|
+
|
|
96
113
|
test('an uninstalled harness is marked unusable, keeps its reason, and opens the fix', async () => {
|
|
97
114
|
const fixes: string[] = [];
|
|
98
115
|
const el = await mount(h(HarnessTabs, {
|
|
@@ -202,16 +219,15 @@ describe('harness tabs', () => {
|
|
|
202
219
|
expect(el.querySelector('[data-harness="codex"]')).not.toBeNull();
|
|
203
220
|
});
|
|
204
221
|
|
|
205
|
-
test('the tab mark is
|
|
222
|
+
test('the tab mark is the SAME size as the harness mark in the model list', async () => {
|
|
206
223
|
const el = await mount(h(HarnessTabs, {
|
|
207
224
|
harnesses: [summary('codex')],
|
|
208
225
|
active: 'codex',
|
|
209
226
|
onSelect: () => {},
|
|
210
227
|
}));
|
|
211
|
-
// The tab
|
|
212
|
-
//
|
|
213
|
-
expect(el.querySelector('svg')?.getAttribute('width')).toBe(String(HARNESS_GLYPH_SIZE.
|
|
214
|
-
expect(HARNESS_GLYPH_SIZE.tab).toBeGreaterThan(HARNESS_GLYPH_SIZE.touch);
|
|
228
|
+
// The tab selects a list whose rows carry a 12px mark; a larger tab mark
|
|
229
|
+
// drew the same agent at two sizes on one surface.
|
|
230
|
+
expect(el.querySelector('svg')?.getAttribute('width')).toBe(String(HARNESS_GLYPH_SIZE.compact));
|
|
215
231
|
});
|
|
216
232
|
|
|
217
233
|
test('the mark inside a tab is DECORATION, so the tab keeps its own tooltip', async () => {
|
|
@@ -258,6 +274,24 @@ describe('harness tabs', () => {
|
|
|
258
274
|
expect(tab.textContent).toContain('⚠');
|
|
259
275
|
});
|
|
260
276
|
|
|
277
|
+
test('the strip scrolls horizontally and never vertically', async () => {
|
|
278
|
+
const el = await mount(h(HarnessTabs, {
|
|
279
|
+
harnesses: [summary('omp-rpc'), summary('claude')],
|
|
280
|
+
active: 'omp-rpc',
|
|
281
|
+
onSelect: () => {},
|
|
282
|
+
}));
|
|
283
|
+
const strip = el.querySelector('[role="tablist"]') as HTMLElement;
|
|
284
|
+
// Horizontal pan is the strip's one axis.
|
|
285
|
+
expect(strip.className).toContain('overflow-x-auto');
|
|
286
|
+
// `overflow-x-auto` computes `overflow-y: auto`. Without the explicit
|
|
287
|
+
// `hidden`, a browser whose styled 8px scrollbar takes layout space shrank
|
|
288
|
+
// the band's content box to 40px while a `tap-chip` tab stays 44px — 4px
|
|
289
|
+
// of vertical overflow and a scrollbar painted over the marks (measured).
|
|
290
|
+
expect(strip.className).toContain('overflow-y-hidden');
|
|
291
|
+
expect(strip.className).toContain('no-scrollbar');
|
|
292
|
+
expect(strip.className).not.toContain('scrollbar-overlay-container');
|
|
293
|
+
});
|
|
294
|
+
|
|
261
295
|
test('no harnesses draws nothing rather than an empty strip', async () => {
|
|
262
296
|
const el = await mount(h(HarnessTabs, { harnesses: [], active: null, onSelect: () => {} }));
|
|
263
297
|
expect(el.querySelector('[role="tablist"]')).toBeNull();
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { useMemo, useRef, useState } from 'preact/hooks';
|
|
2
|
-
import { ChevronDown, Sparkles } from 'lucide-preact';
|
|
3
2
|
import type { AIModelOption } from '@/shared/types';
|
|
4
3
|
import { useOnClickOutside } from '@/client/hooks/ui/on-click-outside';
|
|
5
4
|
import { invalidateModelsCache } from '@/shared/lib/models/client';
|
|
6
5
|
import { ModelDropdownPanel } from '@/client/components/workspace/model-dropdown/Panel';
|
|
7
|
-
import {
|
|
6
|
+
import { ModelDropdownTrigger } from '@/client/components/workspace/model-dropdown/Trigger';
|
|
8
7
|
import { useModelCatalog } from '@/client/components/workspace/model-dropdown/use-catalog';
|
|
9
8
|
import { useCollapsedSections } from '@/client/components/workspace/model-dropdown/collapsed';
|
|
10
9
|
import { useHarnesses } from '@/client/hooks/models/use-harnesses';
|
|
@@ -12,7 +11,6 @@ import { harnessCategoryId } from '@/shared/lib/harness/menu';
|
|
|
12
11
|
import { useFullscreenPicker } from '@/client/components/workspace/model-dropdown/fullscreen-picker';
|
|
13
12
|
import { harnessModels, pickerHarnesses } from '@/shared/lib/harness/models';
|
|
14
13
|
import { useRowMutations } from '@/client/components/workspace/model-dropdown/row-mutations';
|
|
15
|
-
import { HarnessGlyph, HARNESS_GLYPH_SIZE } from '@/client/components/common/harness-glyph';
|
|
16
14
|
import { buildPickerGroups, type PickerRow } from '@/client/components/workspace/model-dropdown/groups';
|
|
17
15
|
import { modelKey } from '@/shared/lib/models/identity';
|
|
18
16
|
import { RECENT_MODELS_LIMIT, filterKnownKeys, recordRecentKey } from '@/shared/lib/models/preferences';
|
|
@@ -22,6 +20,12 @@ interface ModelDropdownProps {
|
|
|
22
20
|
onSelectModel?: (model: AIModelOption) => void;
|
|
23
21
|
onOpenAddProvider?: () => void;
|
|
24
22
|
onThinkingLevelChange?: (level: string) => void;
|
|
23
|
+
/** The selected model's ladder; the label and the panel strip draw from it. */
|
|
24
|
+
thinkingLevels?: string[];
|
|
25
|
+
/** Level in force, shown beside the model in the trigger. */
|
|
26
|
+
currentThinking?: string;
|
|
27
|
+
/** Pick a level without leaving the model picker. */
|
|
28
|
+
onSelectThinking?: (level: string) => void;
|
|
25
29
|
className?: string;
|
|
26
30
|
/** The session's harness (`omp-rpc`, `claude`, …). Undefined for a chat that
|
|
27
31
|
* has not spawned: the picker then shows the user's last choice. */
|
|
@@ -41,6 +45,9 @@ export function ModelDropdown({
|
|
|
41
45
|
onSelectModel,
|
|
42
46
|
onOpenAddProvider,
|
|
43
47
|
onThinkingLevelChange,
|
|
48
|
+
thinkingLevels,
|
|
49
|
+
currentThinking,
|
|
50
|
+
onSelectThinking,
|
|
44
51
|
className = '',
|
|
45
52
|
harness,
|
|
46
53
|
onSelectHarness,
|
|
@@ -233,55 +240,18 @@ export function ModelDropdown({
|
|
|
233
240
|
onKeyDown={handleKeyDown}
|
|
234
241
|
>
|
|
235
242
|
{/* Trigger Button */}
|
|
236
|
-
<
|
|
237
|
-
|
|
243
|
+
<ModelDropdownTrigger
|
|
244
|
+
{...(selectedModel ? { selectedModel } : {})}
|
|
245
|
+
mark={selectedMark}
|
|
246
|
+
harness={activeHarness}
|
|
247
|
+
{...(currentThinking ? { thinkingLevel: currentThinking } : {})}
|
|
248
|
+
{...(thinkingLevels ? { thinkingLevels } : {})}
|
|
238
249
|
onClick={() => {
|
|
239
250
|
setIsOpen(prev => !prev);
|
|
240
251
|
setHoveredRow(null);
|
|
241
252
|
setFocusedIndex(-1);
|
|
242
253
|
}}
|
|
243
|
-
|
|
244
|
-
title={selectedModel ? `${selectedModel.provider} • ${selectedModel.name}` : 'Select a model'}
|
|
245
|
-
>
|
|
246
|
-
{selectedModel ? (
|
|
247
|
-
<>
|
|
248
|
-
{/* Harness MARK, then the provider plate: the same two-mark order
|
|
249
|
-
the rows use, so the trigger and the list cannot describe two
|
|
250
|
-
different things. `decorative` for the same measured reason as
|
|
251
|
-
the tabs: a nested `title` is the one the browser shows, so this
|
|
252
|
-
component's "Session runs on omp" replaced the trigger's own
|
|
253
|
-
`provider • model`. */}
|
|
254
|
-
<HarnessGlyph harness={activeHarness} size={HARNESS_GLYPH_SIZE.compact} decorative />
|
|
255
|
-
{selectedModel.isCmdAgent ? (
|
|
256
|
-
<span className="inline-flex items-center justify-center w-[16px] h-[16px] rounded-[4px] border border-ink/20 bg-ink/5 text-ink/70 flex-shrink-0 font-mono text-[10px] font-bold">
|
|
257
|
-
⌘
|
|
258
|
-
</span>
|
|
259
|
-
) : (
|
|
260
|
-
<ProviderIconPlate provider={selectedMark ?? {}} size={16} />
|
|
261
|
-
)}
|
|
262
|
-
{/* Provider and model are two labels with a separator between them.
|
|
263
|
-
The PROVIDER never truncates: `kenari` and `kenari-jatis` are two
|
|
264
|
-
accounts, and an ellipsis made them render identically. The MODEL
|
|
265
|
-
takes the slack, because it is the part the reader is choosing
|
|
266
|
-
and the only part whose identity survives a cut. */}
|
|
267
|
-
<span className="flex items-baseline gap-1 min-w-0">
|
|
268
|
-
<span className="shrink-0 text-muted font-normal">{selectedModel.provider}</span>
|
|
269
|
-
<span className="text-ink/50 flex-shrink-0">•</span>
|
|
270
|
-
<span className="min-w-0 flex-1 truncate">{selectedModel.name}</span>
|
|
271
|
-
</span>
|
|
272
|
-
</>
|
|
273
|
-
) : (
|
|
274
|
-
/* No selection yet: the list is still loading or the registry came
|
|
275
|
-
back empty. Show a pulse placeholder rather than a made-up model. */
|
|
276
|
-
<>
|
|
277
|
-
<span className="text-ink/60 flex-shrink-0">
|
|
278
|
-
<Sparkles size={12} className="text-ink/60" />
|
|
279
|
-
</span>
|
|
280
|
-
<span className="h-3 w-28 rounded animate-pulse bg-ink/10" />
|
|
281
|
-
</>
|
|
282
|
-
)}
|
|
283
|
-
<ChevronDown size={12} className="text-ink/40 flex-shrink-0" />
|
|
284
|
-
</button>
|
|
254
|
+
/>
|
|
285
255
|
|
|
286
256
|
{/* Popover Dropdown */}
|
|
287
257
|
{isOpen && (
|
|
@@ -304,6 +274,9 @@ export function ModelDropdown({
|
|
|
304
274
|
onSelect={handleSelect}
|
|
305
275
|
onToggleFavorite={toggleFavorite}
|
|
306
276
|
onCycleThinking={cycleThinking}
|
|
277
|
+
{...(thinkingLevels ? { thinkingLevels } : {})}
|
|
278
|
+
{...(currentThinking ? { currentThinking } : {})}
|
|
279
|
+
{...(onSelectThinking ? { onSelectThinking } : {})}
|
|
307
280
|
onHoverItem={(idx) => {
|
|
308
281
|
setFocusedIndex(idx);
|
|
309
282
|
// The flat list is the one order the panel renders, so an index is
|
|
@@ -64,13 +64,18 @@ function harness(id: string): HarnessSummary {
|
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
function mount(
|
|
67
|
+
function mount(
|
|
68
|
+
harnesses: HarnessSummary[],
|
|
69
|
+
onClose: () => void,
|
|
70
|
+
editable = true,
|
|
71
|
+
onAddProvider: () => void = () => {},
|
|
72
|
+
): void {
|
|
68
73
|
act(() =>
|
|
69
74
|
render(
|
|
70
75
|
h(ModelDropdownPanel, {
|
|
71
76
|
search: '',
|
|
72
77
|
onSearchChange: () => {},
|
|
73
|
-
onAddProvider
|
|
78
|
+
onAddProvider,
|
|
74
79
|
isLoading: false,
|
|
75
80
|
filteredModels: [],
|
|
76
81
|
favoriteModels: [],
|
|
@@ -115,12 +120,18 @@ describe('the full-screen picker close control', () => {
|
|
|
115
120
|
expect(dialog.querySelector('header')).toBeNull();
|
|
116
121
|
});
|
|
117
122
|
|
|
118
|
-
test('a picker with no harness tabs puts the control on the
|
|
123
|
+
test('a picker with no harness tabs puts the control on the Add new provider row', () => {
|
|
119
124
|
mount([], () => {});
|
|
120
125
|
const dialog = document.querySelector('[role="dialog"][aria-label="Select model"]') as HTMLElement;
|
|
121
126
|
const close = dialog.querySelector('button[aria-label="Close"]') as HTMLElement;
|
|
122
127
|
expect(close).not.toBeNull();
|
|
123
128
|
expect(dialog.querySelector('[role="tablist"]')).toBeNull();
|
|
129
|
+
const addButton = [...dialog.querySelectorAll('button')]
|
|
130
|
+
.find((button) => button.textContent?.includes('Add new provider')) as HTMLElement | undefined;
|
|
131
|
+
expect(addButton).not.toBeUndefined();
|
|
132
|
+
// The control's slot (actions div) is a SIBLING of the Add button inside
|
|
133
|
+
// that row — not nested in it, and not on the search row.
|
|
134
|
+
expect(close.parentElement?.parentElement).toBe(addButton?.parentElement);
|
|
124
135
|
expect(dialog.querySelector('input[placeholder="Search models"]')).not.toBeNull();
|
|
125
136
|
});
|
|
126
137
|
|
|
@@ -132,9 +143,12 @@ describe('the full-screen picker close control', () => {
|
|
|
132
143
|
const dialog = document.querySelector('[role="dialog"][aria-label="Select model"]') as HTMLElement;
|
|
133
144
|
expect(dialog.querySelector('[role="tablist"]')).toBeNull();
|
|
134
145
|
expect(dialog.querySelectorAll('[role="tab"]')).toHaveLength(0);
|
|
135
|
-
// The close control still rides the picker's first row.
|
|
146
|
+
// The close control still rides the picker's first row: Add new provider.
|
|
136
147
|
const close = dialog.querySelector('button[aria-label="Close"]') as HTMLElement;
|
|
137
148
|
expect(close).not.toBeNull();
|
|
149
|
+
const addButton = [...dialog.querySelectorAll('button')]
|
|
150
|
+
.find((button) => button.textContent?.includes('Add new provider')) as HTMLElement | undefined;
|
|
151
|
+
expect(close.parentElement?.parentElement).toBe(addButton?.parentElement);
|
|
138
152
|
expect(dialog.querySelector('input[placeholder="Search models"]')).not.toBeNull();
|
|
139
153
|
});
|
|
140
154
|
|
|
@@ -150,4 +164,20 @@ describe('the full-screen picker close control', () => {
|
|
|
150
164
|
act(() => close?.click());
|
|
151
165
|
expect(closed).toBe(1);
|
|
152
166
|
});
|
|
167
|
+
|
|
168
|
+
test('pressing it never adds a provider', () => {
|
|
169
|
+
// The row is a button plus a trailing slot, so the close control is not a
|
|
170
|
+
// button nested in a button and a press on it cannot bubble into
|
|
171
|
+
// `onAddProvider`.
|
|
172
|
+
let closed = 0;
|
|
173
|
+
let added = 0;
|
|
174
|
+
mount([], () => { closed += 1; }, true, () => { added += 1; });
|
|
175
|
+
const close = document.querySelector<HTMLButtonElement>(
|
|
176
|
+
'[role="dialog"] button[aria-label="Close"]',
|
|
177
|
+
);
|
|
178
|
+
expect(close).not.toBeNull();
|
|
179
|
+
act(() => close?.click());
|
|
180
|
+
expect(closed).toBe(1);
|
|
181
|
+
expect(added).toBe(0);
|
|
182
|
+
});
|
|
153
183
|
});
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* One picker for model AND thinking level.
|
|
8
|
+
*
|
|
9
|
+
* The level used to be a second dropdown in the composer's toolbar; it is now
|
|
10
|
+
* the strip inside the model picker and a badge on its trigger. These cases pin
|
|
11
|
+
* both ends of that merge: the strip reports the pick, and an empty ladder draws
|
|
12
|
+
* no control at all rather than an inert one.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { afterAll, afterEach, beforeEach, describe, expect, test } from 'bun:test';
|
|
16
|
+
import { Window } from 'happy-dom';
|
|
17
|
+
import { h, render } from 'preact';
|
|
18
|
+
import { act } from 'preact/test-utils';
|
|
19
|
+
import { ModelDropdown } from '@/client/components/workspace/model-dropdown/index';
|
|
20
|
+
import { ModelThinkingLevels } from '@/client/components/workspace/model-dropdown/ThinkingLevels';
|
|
21
|
+
import type { AIModelOption } from '@/shared/types';
|
|
22
|
+
import { invalidateModelsCache } from '@/shared/lib/models/client';
|
|
23
|
+
import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
|
|
24
|
+
import { restoreRealtime, silenceRealtime } from '@/test-support/silent-socket';
|
|
25
|
+
|
|
26
|
+
const MODEL: AIModelOption = {
|
|
27
|
+
id: 'deepseek-v4-1-flash',
|
|
28
|
+
name: 'Deepseek-V4-1-Flash',
|
|
29
|
+
provider: 'kenari',
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
let container: HTMLElement;
|
|
33
|
+
|
|
34
|
+
beforeEach(() => {
|
|
35
|
+
installDomGlobals(new Window());
|
|
36
|
+
invalidateModelsCache();
|
|
37
|
+
silenceRealtime();
|
|
38
|
+
container = document.createElement('div');
|
|
39
|
+
document.body.appendChild(container);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
afterEach(() => {
|
|
43
|
+
render(null, container);
|
|
44
|
+
container.remove();
|
|
45
|
+
restoreRealtime();
|
|
46
|
+
restoreDomGlobals();
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
afterAll(() => restoreDomGlobals());
|
|
50
|
+
|
|
51
|
+
describe('ModelThinkingLevels', () => {
|
|
52
|
+
test('marks the level in force and reports a new one', () => {
|
|
53
|
+
const picks: string[] = [];
|
|
54
|
+
act(() => {
|
|
55
|
+
render(
|
|
56
|
+
h(ModelThinkingLevels, { levels: ['off', 'low', 'high'], current: 'low', onSelect: (level) => picks.push(level) }),
|
|
57
|
+
container,
|
|
58
|
+
);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const buttons = [...container.querySelectorAll('button')];
|
|
62
|
+
expect(buttons.find((button) => button.textContent === 'low')?.getAttribute('aria-pressed')).toBe('true');
|
|
63
|
+
expect(buttons.find((button) => button.textContent === 'high')?.getAttribute('aria-pressed')).toBe('false');
|
|
64
|
+
|
|
65
|
+
act(() => {
|
|
66
|
+
buttons.find((button) => button.textContent === 'high')?.click();
|
|
67
|
+
});
|
|
68
|
+
expect(picks).toEqual(['high']);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
test('draws nothing when the model exposes no ladder', () => {
|
|
72
|
+
act(() => {
|
|
73
|
+
render(h(ModelThinkingLevels, { levels: [], current: 'auto', onSelect: () => {} }), container);
|
|
74
|
+
});
|
|
75
|
+
expect(container.querySelector('[role="group"]')).toBeNull();
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
describe('thinking strip inside the model picker', () => {
|
|
80
|
+
test('opens with the picker and reports the level the reader clicked', () => {
|
|
81
|
+
const picks: string[] = [];
|
|
82
|
+
act(() => {
|
|
83
|
+
render(
|
|
84
|
+
h(ModelDropdown, {
|
|
85
|
+
selectedModel: MODEL,
|
|
86
|
+
thinkingLevels: ['off', 'low', 'high'],
|
|
87
|
+
currentThinking: 'low',
|
|
88
|
+
onSelectThinking: (level: string) => picks.push(level),
|
|
89
|
+
isMobile: false,
|
|
90
|
+
}),
|
|
91
|
+
container,
|
|
92
|
+
);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
const trigger = container.querySelector('button[title]') as HTMLButtonElement | null;
|
|
96
|
+
if (!trigger) throw new Error('model trigger not found');
|
|
97
|
+
act(() => {
|
|
98
|
+
trigger.click();
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
const high = [...container.querySelectorAll('button')].find((button) => button.textContent === 'high');
|
|
102
|
+
expect(high).toBeDefined();
|
|
103
|
+
act(() => {
|
|
104
|
+
high?.click();
|
|
105
|
+
});
|
|
106
|
+
expect(picks).toEqual(['high']);
|
|
107
|
+
});
|
|
108
|
+
});
|
|
@@ -102,19 +102,39 @@ describe('composer model trigger label', () => {
|
|
|
102
102
|
const label = provider.parentElement!;
|
|
103
103
|
|
|
104
104
|
expect(label.className).not.toContain('max-w-');
|
|
105
|
-
expect(provider.className).
|
|
105
|
+
expect(provider.className).toContain('truncate');
|
|
106
106
|
expect(model.className).toContain('truncate');
|
|
107
107
|
});
|
|
108
108
|
|
|
109
|
-
test('
|
|
110
|
-
//
|
|
111
|
-
//
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
109
|
+
test('ellipsizes provider and model, never the level, and keeps the model widest', () => {
|
|
110
|
+
// The level is the choice the trigger always has to report, so it is the one
|
|
111
|
+
// part that may not be cut. The provider is capped at 30% so the model keeps
|
|
112
|
+
// the majority of the label and stays the readable half.
|
|
113
|
+
act(() => {
|
|
114
|
+
render(
|
|
115
|
+
h(ModelDropdown, { selectedModel: MODEL, thinkingLevels: ['off', 'high'], currentThinking: 'high' }),
|
|
116
|
+
container,
|
|
117
|
+
);
|
|
118
|
+
});
|
|
119
|
+
const { provider, separator, model } = labelParts(container);
|
|
120
|
+
const levelSeparator = model.nextElementSibling as HTMLElement | null;
|
|
121
|
+
const level = levelSeparator?.nextElementSibling as HTMLElement | null;
|
|
122
|
+
if (!levelSeparator || !level) throw new Error('level part not found');
|
|
123
|
+
|
|
124
|
+
expect(provider.className).toContain('min-w-0');
|
|
125
|
+
expect(provider.style.flex).toBe('0 100 auto');
|
|
126
|
+
expect(provider.style.minWidth).toBe('4ch');
|
|
127
|
+
expect(provider.style.maxWidth).toBe('');
|
|
128
|
+
expect(provider.className).toContain('truncate');
|
|
115
129
|
expect(separator.className).toContain('shrink-0');
|
|
116
|
-
expect(model.className).toContain('flex-1');
|
|
117
130
|
expect(model.className).toContain('min-w-0');
|
|
131
|
+
expect(model.className).toContain('truncate');
|
|
132
|
+
expect(model.style.flex).toBe('');
|
|
133
|
+
expect(provider.parentElement?.className).toContain('text-left');
|
|
134
|
+
expect(levelSeparator.className).toContain('shrink-0');
|
|
135
|
+
expect(level.className).toContain('shrink-0');
|
|
136
|
+
expect(level.className).not.toContain('truncate');
|
|
137
|
+
expect(level.textContent).toBe('high');
|
|
118
138
|
});
|
|
119
139
|
|
|
120
140
|
test('the trigger itself may shrink on every layout', () => {
|
|
@@ -175,3 +195,29 @@ describe('trigger mark for a provider whose own icon was fetched', () => {
|
|
|
175
195
|
}
|
|
176
196
|
});
|
|
177
197
|
});
|
|
198
|
+
|
|
199
|
+
describe('thinking level in the model trigger', () => {
|
|
200
|
+
test('rides the label and the title when the model exposes a ladder', () => {
|
|
201
|
+
act(() => {
|
|
202
|
+
render(
|
|
203
|
+
h(ModelDropdown, {
|
|
204
|
+
selectedModel: MODEL,
|
|
205
|
+
thinkingLevels: ['off', 'low', 'high'],
|
|
206
|
+
currentThinking: 'low',
|
|
207
|
+
}),
|
|
208
|
+
container,
|
|
209
|
+
);
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
const button = trigger(container);
|
|
213
|
+
expect(button.title).toBe('kenari • Deepseek-V4-1-Flash • low');
|
|
214
|
+
expect(button.textContent).toContain('•low');
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
test('is absent when the model exposes no levels', () => {
|
|
218
|
+
act(() => {
|
|
219
|
+
render(h(ModelDropdown, { selectedModel: MODEL, thinkingLevels: [], currentThinking: 'auto' }), container);
|
|
220
|
+
});
|
|
221
|
+
expect(trigger(container).title).toBe('kenari • Deepseek-V4-1-Flash');
|
|
222
|
+
});
|
|
223
|
+
});
|
|
@@ -29,6 +29,7 @@ import { act } from 'preact/test-utils';
|
|
|
29
29
|
import { useState } from 'preact/hooks';
|
|
30
30
|
import type { Attachment } from '@/shared/types';
|
|
31
31
|
import { attachmentHasPayload, toAttachmentList } from '@/shared/lib/chat/attachments';
|
|
32
|
+
import { MAX_ATTACHMENT_BYTES } from '@/shared/lib/chat/attachment-budget';
|
|
32
33
|
import {
|
|
33
34
|
useComposerAttachments,
|
|
34
35
|
type ComposerAttachments,
|
|
@@ -145,6 +146,17 @@ describe('useComposerAttachments', () => {
|
|
|
145
146
|
expect(api.peek().length).toBe(10);
|
|
146
147
|
});
|
|
147
148
|
|
|
149
|
+
test('a file over the byte ceiling is refused before its bytes are read', async () => {
|
|
150
|
+
await mount();
|
|
151
|
+
const huge = new File(['PNG'], 'huge.png', { type: 'image/png' });
|
|
152
|
+
Object.defineProperty(huge, 'size', { value: MAX_ATTACHMENT_BYTES + 1 });
|
|
153
|
+
|
|
154
|
+
const outcome = await api.addFiles([huge]);
|
|
155
|
+
expect(outcome.added).toBe(0);
|
|
156
|
+
expect(outcome.oversized).toEqual([huge]);
|
|
157
|
+
expect(api.peek()).toEqual([]);
|
|
158
|
+
});
|
|
159
|
+
|
|
148
160
|
test('readyForSend waits for an in-flight read and returns the patched entry', async () => {
|
|
149
161
|
await mount();
|
|
150
162
|
const pending = api.addFiles([textFile('late.md', '# late')]);
|
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
import { useCallback, useRef } from 'preact/hooks';
|
|
30
30
|
import type { SetStateAction } from 'preact/compat';
|
|
31
31
|
import type { Attachment } from '@/shared/types';
|
|
32
|
-
import {
|
|
32
|
+
import { isTextAttachment, looksLikeTextFile } from '@/shared/lib/chat/attachments';
|
|
33
|
+
import { applyTextAttachmentBudget, isOversizedAttachment } from '@/shared/lib/chat/attachment-budget';
|
|
33
34
|
import { delay, primedPrefix, readAsDataUrl, readFileTextWithRetry } from '@/client/hooks/chat/composer/file-reads';
|
|
34
35
|
import type { PrimedReads } from '@/client/hooks/chat/composer/file-reads';
|
|
35
36
|
|
|
@@ -44,6 +45,8 @@ export interface AddFilesOutcome {
|
|
|
44
45
|
added: number;
|
|
45
46
|
/** Files refused by the inline text budget, for the caller to report. */
|
|
46
47
|
skipped: File[];
|
|
48
|
+
/** Files refused because one file exceeded `MAX_ATTACHMENT_BYTES`. */
|
|
49
|
+
oversized: File[];
|
|
47
50
|
/** Names of files whose contents could not be read, for the caller to report. */
|
|
48
51
|
unreadable: string[];
|
|
49
52
|
}
|
|
@@ -115,8 +118,17 @@ export function useComposerAttachments({
|
|
|
115
118
|
primed?: PrimedReads,
|
|
116
119
|
onAttached?: (created: Attachment[]) => void,
|
|
117
120
|
): Promise<AddFilesOutcome> => {
|
|
118
|
-
|
|
119
|
-
|
|
121
|
+
// The byte ceiling is checked before the text budget: a file too large to
|
|
122
|
+
// accept at all must not consume an inline slot it could never fill.
|
|
123
|
+
const withinSize: File[] = [];
|
|
124
|
+
const oversized: File[] = [];
|
|
125
|
+
for (const file of files) {
|
|
126
|
+
if (isOversizedAttachment(file)) oversized.push(file);
|
|
127
|
+
else withinSize.push(file);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const { accepted, skipped } = applyTextAttachmentBudget(withinSize, attachments);
|
|
131
|
+
if (accepted.length === 0) return { added: 0, skipped, oversized, unreadable: [] };
|
|
120
132
|
|
|
121
133
|
// Display fields are captured at creation: a File does not survive the
|
|
122
134
|
// queue's JSON round trip or committed history, and every replay path reads
|
|
@@ -182,7 +194,7 @@ export function useComposerAttachments({
|
|
|
182
194
|
resolve();
|
|
183
195
|
}
|
|
184
196
|
|
|
185
|
-
return { added: newAttachments.length, skipped, unreadable };
|
|
197
|
+
return { added: newAttachments.length, skipped, oversized, unreadable };
|
|
186
198
|
}, [attachments, setAttachments]);
|
|
187
199
|
|
|
188
200
|
const removeAttachment = useCallback((id: string) => {
|
|
@@ -19,6 +19,7 @@ import { h, render } from 'preact';
|
|
|
19
19
|
import { act } from 'preact/test-utils';
|
|
20
20
|
import { useState } from 'preact/hooks';
|
|
21
21
|
import type { Attachment } from '@/shared/types';
|
|
22
|
+
import { MAX_ATTACHMENT_BYTES } from '@/shared/lib/chat/attachment-budget';
|
|
22
23
|
import { DROP_LIMIT_NOTICE } from '@/client/hooks/chat/composer/file-drop';
|
|
23
24
|
import { READ_RETRY_MS, delay } from '@/client/hooks/chat/composer/file-reads';
|
|
24
25
|
import { useComposerPipeline, type ComposerPipeline } from '@/client/hooks/chat/composer/pipeline';
|
|
@@ -257,6 +258,19 @@ describe('useComposerPipeline', () => {
|
|
|
257
258
|
expect(current.length).toBe(10);
|
|
258
259
|
});
|
|
259
260
|
|
|
261
|
+
test('a file over the byte ceiling is refused and reported, not attached', async () => {
|
|
262
|
+
await mountPipeline();
|
|
263
|
+
const huge = new File(['PNG'], 'huge.png', { type: 'image/png' });
|
|
264
|
+
Object.defineProperty(huge, 'size', { value: MAX_ATTACHMENT_BYTES + 1 });
|
|
265
|
+
|
|
266
|
+
await act(async () => { api.acceptFiles([huge]); });
|
|
267
|
+
await waitFor(() => api.notice !== null);
|
|
268
|
+
|
|
269
|
+
const limit = `${Math.round(MAX_ATTACHMENT_BYTES / 1024 / 1024)} MB`;
|
|
270
|
+
expect(api.notice).toBe(`"huge.png" was not attached — the largest allowed file is ${limit}.`);
|
|
271
|
+
expect(current.length).toBe(0);
|
|
272
|
+
});
|
|
273
|
+
|
|
260
274
|
test('a drop cut short by the cap says so, and the notice can be dismissed', async () => {
|
|
261
275
|
await mountPipeline();
|
|
262
276
|
await act(async () => { api.acceptFiles([textFile('a.md', 'a')], true); });
|
|
@@ -28,7 +28,8 @@
|
|
|
28
28
|
import { useCallback, useRef, useState } from 'preact/hooks';
|
|
29
29
|
import type { SetStateAction } from 'preact/compat';
|
|
30
30
|
import type { Attachment } from '@/shared/types';
|
|
31
|
-
import { attachmentHasPayload, attachmentName
|
|
31
|
+
import { attachmentHasPayload, attachmentName } from '@/shared/lib/chat/attachments';
|
|
32
|
+
import { describeAttachmentBudget, describeOversizedAttachments } from '@/shared/lib/chat/attachment-budget';
|
|
32
33
|
import { useComposerAttachments } from '@/client/hooks/chat/composer/attachments';
|
|
33
34
|
import { useFileDrop, DROP_LIMIT_NOTICE, type FileDropProps } from '@/client/hooks/chat/composer/file-drop';
|
|
34
35
|
import type { PrimedReads } from '@/client/hooks/chat/composer/file-reads';
|
|
@@ -40,6 +41,13 @@ import {
|
|
|
40
41
|
type ReferenceFailure,
|
|
41
42
|
} from '@/client/hooks/chat/composer/drop-references';
|
|
42
43
|
|
|
44
|
+
/** One notice for every refused file in a batch; null when none was refused. */
|
|
45
|
+
function describeRefusals(oversized: File[], skipped: File[]): string | null {
|
|
46
|
+
const parts = [describeOversizedAttachments(oversized), skipped.length > 0 ? describeAttachmentBudget(skipped) : null];
|
|
47
|
+
const text = parts.filter((part): part is string => part !== null).join(' ');
|
|
48
|
+
return text || null;
|
|
49
|
+
}
|
|
50
|
+
|
|
43
51
|
export interface UseComposerPipelineOptions {
|
|
44
52
|
attachments: Attachment[];
|
|
45
53
|
setAttachments: (updater: SetStateAction<Attachment[]>) => void;
|
|
@@ -121,8 +129,8 @@ export function useComposerPipeline({
|
|
|
121
129
|
reasons.set(name, result.reason);
|
|
122
130
|
}));
|
|
123
131
|
if (resolved.length > 0) {
|
|
124
|
-
const { unreadable } = await addFiles(resolved);
|
|
125
|
-
setNotice(unreadable.length > 0 ? describeUnreadable(unreadable) : null);
|
|
132
|
+
const { oversized, skipped, unreadable } = await addFiles(resolved);
|
|
133
|
+
setNotice(describeRefusals(oversized, skipped) ?? (unreadable.length > 0 ? describeUnreadable(unreadable) : null));
|
|
126
134
|
}
|
|
127
135
|
if (failed.length > 0) {
|
|
128
136
|
// Named per cause: "outside the folders Kabmo may read" is something
|
|
@@ -140,9 +148,10 @@ export function useComposerPipeline({
|
|
|
140
148
|
onAttached?: (created: Attachment[]) => void,
|
|
141
149
|
) => {
|
|
142
150
|
void (async () => {
|
|
143
|
-
const { added, skipped, unreadable } = await addFiles(files, primed, onAttached);
|
|
144
|
-
|
|
145
|
-
|
|
151
|
+
const { added, skipped, oversized, unreadable } = await addFiles(files, primed, onAttached);
|
|
152
|
+
const refusal = describeRefusals(oversized, skipped);
|
|
153
|
+
if (refusal) {
|
|
154
|
+
setNotice(refusal);
|
|
146
155
|
} else if (incomplete) {
|
|
147
156
|
setNotice(DROP_LIMIT_NOTICE);
|
|
148
157
|
} else if (unreadable.length > 0) {
|