@kabmo-labs/kabmo 0.45.1 → 0.46.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 +412 -412
- package/dist/client/static/js/{CsvGrid-eqmctwyq.js → CsvGrid-qdkmv8bj.js} +2 -2
- package/dist/client/static/js/{DocxView-rjrshmzf.js → DocxView-k84ns803.js} +3 -3
- package/dist/client/static/js/{DrawioView-za569srw.js → DrawioView-r1n717f7.js} +2 -2
- package/dist/client/static/js/ImageView-jkrdrq8v.js +1 -0
- package/dist/client/static/js/LayoutWrapper-sh634350.js +2 -0
- package/dist/client/static/js/Modal-xe6h99jn.js +59 -0
- package/dist/client/static/js/{PdfView-2m78d4jz.js → PdfView-ffg4mccg.js} +1 -1
- package/dist/client/static/js/{SessionsView-54awmse0.js → SessionsView-cdcbsee9.js} +1 -1
- package/dist/client/static/js/{SheetView-xfvjdh24.js → SheetView-89sscpz6.js} +19 -19
- package/dist/client/static/js/{SvgPreview-yfjrfb40.js → SvgPreview-68c0ccbv.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-tmsa3b36.js → abnfDiagram-O67JEVCF-h3a5s259.js} +1 -1
- package/dist/client/static/js/architecture-7GRP2DOG-pvb4d65d.js +1 -0
- package/dist/client/static/js/{architectureDiagram-NJMV4G6O-a5effrpz.js → architectureDiagram-NJMV4G6O-983p0jgn.js} +3 -3
- package/dist/client/static/js/{astro-56b0as3q.js → astro-hyj5wege.js} +1 -1
- package/dist/client/static/js/bash-8d8z8zrg.js +1 -0
- package/dist/client/static/js/{blockDiagram-BEXU5L5S-3q2kf22c.js → blockDiagram-BEXU5L5S-16pse5mh.js} +5 -5
- package/dist/client/static/js/c-acmn1zc9.js +1 -0
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-mkw3jvf6.js → c4Diagram-YGBWAQC7-mvnb00zt.js} +3 -3
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-fw9bs1za.js → classDiagram-v2-NBCMYWYE-kmpd91xb.js} +7 -7
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-eqjrpps4.js → cose-bilkent-JH36ORCC-3ek5r5se.js} +1 -1
- package/dist/client/static/js/cpp-620mvjkk.js +1 -0
- package/dist/client/static/js/css-bt76kxbq.js +1 -0
- package/dist/client/static/js/css-drfs4n12.js +1 -0
- package/dist/client/static/js/cynefin-OW5HDTMX-gmx4vean.js +1 -0
- package/dist/client/static/js/{cynefinDiagram-VND7K2PF-4w61hq3e.js → cynefinDiagram-VND7K2PF-jkbh84zn.js} +1 -1
- package/dist/client/static/js/{dagre-6A5THRUB-t52jdfr1.js → dagre-6A5THRUB-4fdc0sgn.js} +2 -2
- package/dist/client/static/js/{diagram-22UHCM2B-448hyxaz.js → diagram-22UHCM2B-hbk61nq9.js} +18 -18
- package/dist/client/static/js/{diagram-3UASUU5V-350k213a.js → diagram-3UASUU5V-hfpbr9qh.js} +1 -1
- package/dist/client/static/js/{diagram-ATOU4E4O-9davjeyb.js → diagram-ATOU4E4O-fn0nt71a.js} +3 -3
- package/dist/client/static/js/{diagram-CDSNMT55-034wwghk.js → diagram-CDSNMT55-ssswxjeb.js} +4 -4
- package/dist/client/static/js/{diagram-MLGK6HIB-kzzd4ecm.js → diagram-MLGK6HIB-whnzxv6f.js} +2 -2
- package/dist/client/static/js/{diagram-MPIPVDR6-rsky4e3s.js → diagram-MPIPVDR6-hk1chzxk.js} +2 -2
- package/dist/client/static/js/{dockerfile-68b0e6b6.js → dockerfile-zmsj8r4g.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-7bm1e394.js → ebnfDiagram-ZINNZB2B-q1vkg5mr.js} +1 -1
- package/dist/client/static/js/{elixir-12pgbgtq.js → elixir-80wq7gak.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-4xjp4rgh.js → elk-276RUBZZ-kt98vg8j.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-v52qmcrv.js → erDiagram-OPXOYQCR-ey3avsn9.js} +9 -9
- package/dist/client/static/js/{erlang-811btv6p.js → erlang-814e8qy5.js} +1 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-vrnheyh7.js +1 -0
- package/dist/client/static/js/flowDiagram-KWPJA3E3-7gvtpn3d.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-1r1fn18p.js → ganttDiagram-FUAMR5RP-a9k1at43.js} +4 -4
- package/dist/client/static/js/gitGraph-4MIJSDKK-n6wnc8st.js +1 -0
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-zt5cwg83.js → gitGraphDiagram-X574FWY7-gnekjfym.js} +13 -13
- package/dist/client/static/js/graphql-j1a6zp7m.js +1 -0
- package/dist/client/static/js/html-m0megrvb.js +1 -0
- package/dist/client/static/js/{index-qt9jc4ck.js → index-19x11s5w.js} +2 -2
- package/dist/client/static/js/{index-0gmw2bt3.js → index-1ax52p0q.js} +2 -2
- package/dist/client/static/js/{index-2b1wnvez.js → index-1c2jvnyh.js} +2 -2
- package/dist/client/static/js/index-2a6qp9y6.js +2 -0
- package/dist/client/static/js/{index-gcwmpfr4.js → index-2ks0m8ss.js} +2 -2
- package/dist/client/static/js/{index-pfj3sd1n.js → index-33qxg79j.js} +7 -7
- package/dist/client/static/js/{index-bcpyxt97.js → index-3x7h2eqj.js} +2 -2
- package/dist/client/static/js/{index-q36gq3yz.js → index-4cag7w6k.js} +198 -198
- package/dist/client/static/js/{index-03j5j1j0.js → index-561gkvve.js} +2 -2
- package/dist/client/static/js/{index-m9s7r4z9.js → index-5ka2tyf9.js} +3 -3
- package/dist/client/static/js/{index-f51jxezc.js → index-5wz0y88c.js} +2 -2
- package/dist/client/static/js/{index-frqq7yen.js → index-60v30k5h.js} +64 -64
- package/dist/client/static/js/{index-x2wvq4ae.js → index-64sqfr4a.js} +2 -2
- package/dist/client/static/js/{index-xgv501v0.js → index-65afr75v.js} +2 -2
- package/dist/client/static/js/index-83rkg916.js +2 -0
- package/dist/client/static/js/{index-ga6492qc.js → index-84fyq5a6.js} +1 -1
- package/dist/client/static/js/{index-2tmnqqzt.js → index-8g7q8mz4.js} +3 -3
- package/dist/client/static/js/{index-mnh8nptt.js → index-9vv7wr1n.js} +2 -2
- package/dist/client/static/js/{index-gzafyqsr.js → index-abs635a1.js} +56 -56
- package/dist/client/static/js/{index-j50y0z44.js → index-amsa0tfs.js} +1 -1
- package/dist/client/static/js/index-atq9q1s7.js +1 -0
- package/dist/client/static/js/{index-8ps5gdwz.js → index-b2e5pwx7.js} +5 -5
- package/dist/client/static/js/{index-cza9mnxx.js → index-b5dfvget.js} +6 -6
- package/dist/client/static/js/{index-zwx3vbf0.js → index-bsr7wmj2.js} +1 -1
- package/dist/client/static/js/{index-ex3w7t7s.js → index-c9e417cs.js} +2 -2
- package/dist/client/static/js/{index-fbct0jcf.js → index-d23eacf2.js} +2 -2
- package/dist/client/static/js/{index-wqrdgt1g.js → index-dn7hg4em.js} +2 -2
- package/dist/client/static/js/index-dpy3ewrn.css +1 -0
- package/dist/client/static/js/index-dt6q3rws.js +12 -0
- package/dist/client/static/js/{index-3h2mr90j.js → index-dxvtjn6a.js} +2 -2
- package/dist/client/static/js/{index-127se1a3.js → index-e9cxje00.js} +19 -19
- package/dist/client/static/js/{index-6sqmhdyv.js → index-fj5rsp5v.js} +2 -2
- package/dist/client/static/js/{index-c7vbr57m.js → index-fzngzhww.js} +2 -2
- package/dist/client/static/js/{index-n1ga63de.js → index-g7s0wsag.js} +2 -2
- package/dist/client/static/js/{index-x0kgnkv3.js → index-hgzntg2j.js} +2 -2
- package/dist/client/static/js/{index-jaqjvk22.js → index-hkz2mz34.js} +2 -2
- package/dist/client/static/js/{index-gzp4j2h5.js → index-hnb66d3s.js} +2 -2
- package/dist/client/static/js/{index-9zwtpazh.js → index-kb14dhrx.js} +2 -2
- package/dist/client/static/js/{index-snjtkfkq.js → index-kbhrvep8.js} +6 -6
- package/dist/client/static/js/{index-vgcm2g0g.js → index-kty4ncsr.js} +2 -2
- package/dist/client/static/js/index-m4k054wz.js +4 -0
- package/dist/client/static/js/{index-pxq4v81r.js → index-nw5mvcaj.js} +2 -2
- package/dist/client/static/js/index-pavvxrsz.js +1 -0
- package/dist/client/static/js/index-q9ytjey8.js +1 -0
- package/dist/client/static/js/{index-8dtp7mt0.js → index-qf3y3ahx.js} +2 -2
- package/dist/client/static/js/{index-as1wptfa.js → index-qfxn7yh5.js} +2 -2
- package/dist/client/static/js/{index-e6any867.js → index-sa1675y0.js} +2 -2
- package/dist/client/static/js/{index-ehg2ftnp.js → index-trvqvb1v.js} +2 -2
- package/dist/client/static/js/{index-1nwwvv29.js → index-vjmg7kn5.js} +2 -2
- package/dist/client/static/js/index-vkqb4dnt.js +1 -0
- package/dist/client/static/js/{index-nzhwd6t3.js → index-wbws16ag.js} +2 -2
- package/dist/client/static/js/{index-528x5x8c.js → index-wrcdc9vz.js} +1 -1
- package/dist/client/static/js/{index-2zntn964.js → index-x9r7zfp4.js} +2 -2
- package/dist/client/static/js/{index-mhnwyra0.js → index-xq5f3nxa.js} +2 -2
- package/dist/client/static/js/index-xwjbq003.js +2 -0
- package/dist/client/static/js/{index-2gbfke1a.js → index-yf93db65.js} +1 -1
- package/dist/client/static/js/{index-tkfxnnr5.js → index-ykm7a3cp.js} +2 -2
- package/dist/client/static/js/{index-t0yv1375.js → index-z0fkfphe.js} +2 -2
- package/dist/client/static/js/{index-84vmdg3k.js → index-z25ss7xj.js} +1 -1
- package/dist/client/static/js/{index-dmv2zasz.js → index-z4530r3c.js} +2 -2
- package/dist/client/static/js/info-A6RAGUB7-1xtdxjz2.js +1 -0
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-yd4zwrtv.js → infoDiagram-VRGFBTTK-r1p25738.js} +2 -2
- package/dist/client/static/js/ini-5f4zqtqr.js +1 -0
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-7sjp09d4.js → ishikawaDiagram-OU5B5YK6-afgrqdrt.js} +3 -3
- package/dist/client/static/js/java-jj41mty3.js +1 -0
- package/dist/client/static/js/javascript-n9w9p97f.js +1 -0
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-qh9jk7qk.js → journeyDiagram-ZHPQQLJL-hepa4wk7.js} +5 -5
- package/dist/client/static/js/json-rnh2h17x.js +1 -0
- package/dist/client/static/js/jsx-4gecrt29.js +1 -0
- package/dist/client/static/js/{julia-mgsev9df.js → julia-yv2j8qd0.js} +1 -1
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-cjc8k0jk.js → kanban-definition-PNTS6WVX-jysft8ya.js} +5 -5
- package/dist/client/static/js/lua-zszaw2f7.js +1 -0
- package/dist/client/static/js/markdown-nm6gw4v4.js +1 -0
- package/dist/client/static/js/{mermaid.core-vw0b7r0k.js → mermaid.core-0m90b0s8.js} +7 -7
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-jyhtpt1z.js → mindmap-definition-NLK3R4M7-x2rrzpvr.js} +8 -8
- package/dist/client/static/js/one-dark-pro-09d8p5vy.js +1 -0
- package/dist/client/static/js/one-light-g3ednt6p.js +1 -0
- package/dist/client/static/js/packet-AYTQ26CC-zm1r82x5.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-80ygdd29.js → pegDiagram-GJSIUBJH-z7vb7f1z.js} +1 -1
- package/dist/client/static/js/{perl-6n93vjsa.js → perl-917pjq5a.js} +1 -1
- package/dist/client/static/js/{php-w23nmbtc.js → php-hwz75qzt.js} +1 -1
- package/dist/client/static/js/pie-WAS4IAKB-sqa7321j.js +1 -0
- package/dist/client/static/js/{pieDiagram-5QR66LMP-6vgh7ntn.js → pieDiagram-5QR66LMP-jqv6v4e6.js} +3 -3
- package/dist/client/static/js/properties-rkptax7r.js +1 -0
- package/dist/client/static/js/python-qf1se1mj.js +1 -0
- package/dist/client/static/js/{quadrantDiagram-O4NWA36T-k5byajmm.js → quadrantDiagram-O4NWA36T-w2h8yxrv.js} +6 -6
- package/dist/client/static/js/r-ms0cygq2.js +1 -0
- package/dist/client/static/js/radar-RG4KPBEZ-z3z82syp.js +1 -0
- package/dist/client/static/js/railroad-74A4TZTK-z6swcqq2.js +1 -0
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-33km6py4.js +1 -0
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-1zbf1xmq.js +1 -0
- package/dist/client/static/js/railroad-peg-WCYAUIDC-wte1xzzy.js +1 -0
- package/dist/client/static/js/{railroadDiagram-XR7U4H2S-qffrkk7g.js → railroadDiagram-XR7U4H2S-nd09yac3.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-r80w7tdp.js → requirementDiagram-PLB6GJNP-t61zxh5v.js} +10 -10
- package/dist/client/static/js/{ruby-ag3b3t9t.js → ruby-er7ayhte.js} +1 -1
- package/dist/client/static/js/{rust-a9jcfy2e.js → rust-avnkhh0p.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-g9qdy74b.js → sankeyDiagram-IPEJSGJF-2f7h2cmw.js} +4 -4
- package/dist/client/static/js/{sass-x0eez0kp.js → sass-n47tt136.js} +1 -1
- package/dist/client/static/js/{scss-qycakpjn.js → scss-kvev49ga.js} +1 -1
- package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-nywg1eq3.js → sequenceDiagram-PO4LG4MO-kfb5d7zd.js} +19 -19
- package/dist/client/static/js/{sizeCapture-INFHLROL-m5pks027.js → sizeCapture-INFHLROL-amfg19se.js} +1 -1
- package/dist/client/static/js/sql-hd42h8wx.js +1 -0
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-xzzv780w.js → stateDiagram-v2-GCMORJYK-k5hx7btx.js} +3 -3
- package/dist/client/static/js/{svelte-tg19by0f.js → svelte-2pmz35vx.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-n4q5ad13.js → swimlanes-2SLR337P-wv3rp8kk.js} +1 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-6y8zdbm4.js +8 -0
- package/dist/client/static/js/{timeline-definition-EJHVYXUP-j9pde7sa.js → timeline-definition-EJHVYXUP-0re95wtn.js} +6 -6
- package/dist/client/static/js/treeView-Q6P3EWNA-pvgx6n22.js +1 -0
- package/dist/client/static/js/treemap-WGGIJYW6-3n9zm628.js +1 -0
- package/dist/client/static/js/tsx-gx7td06z.js +1 -0
- package/dist/client/static/js/typescript-1a808spn.js +1 -0
- package/dist/client/static/js/{usecaseDiagram-POWQR4AR-ehnc0600.js → usecaseDiagram-POWQR4AR-yrje14qp.js} +44 -44
- package/dist/client/static/js/{vennDiagram-UO4OBE2U-cp4kj6kw.js → vennDiagram-UO4OBE2U-jxkmrfy5.js} +7 -7
- package/dist/client/static/js/{vue-mhj4sme0.js → vue-d5gpjfgn.js} +1 -1
- package/dist/client/static/js/wardley-WFR3VGLG-7m07ewc4.js +1 -0
- package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-eegf1jpw.js → wardleyDiagram-VNRHLVJA-d3v2m9b1.js} +3 -3
- package/dist/client/static/js/xml-3117mxd9.js +1 -0
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-zkkqfyex.js → xychartDiagram-PMCCYNJV-9a1s1rjt.js} +5 -5
- package/dist/client/static/js/yaml-dmvh8vyt.js +1 -0
- package/extensions/kabmo-modes/index.ts +1 -1
- package/extensions/kabmo-modes/parked.test.ts +2 -2
- package/extensions/kabmo-modes/parked.ts +10 -9
- package/extensions/kabmo-modes/plan.test.ts +4 -4
- package/extensions/kabmo-modes/plan.ts +6 -6
- package/extensions/kabmo-modes/session.ts +2 -2
- package/package.json +1 -1
- package/src/client/components/common/FolderPicker.tsx +1 -1
- package/src/client/components/common/Modal.tsx +8 -3
- package/src/client/components/common/NotificationPermissionDialog.test.tsx +8 -3
- package/src/client/components/common/NotificationPermissionDialog.tsx +7 -9
- package/src/client/components/common/PWAInstallButton.tsx +1 -1
- package/src/client/components/common/header-panel-buttons/index.tsx +5 -1
- package/src/client/components/common/shell-update-button/Modal.tsx +31 -36
- package/src/client/components/common/shell-update-button/index.test.tsx +5 -2
- package/src/client/components/layout/desktop-layout/LeftColumn.tsx +16 -0
- package/src/client/components/layout/desktop-layout/RightColumn.test.tsx +204 -0
- package/src/client/components/layout/desktop-layout/RightColumn.tsx +52 -15
- package/src/client/components/layout/session-sidebar/OverflowMenu.tsx +1 -1
- package/src/client/components/layout/session-sidebar/about-modal/index.tsx +4 -6
- package/src/client/components/layout/session-sidebar/new-workspace-modal/index.tsx +1 -1
- package/src/client/components/layout/session-sidebar/scheduler-modal/index.tsx +1 -1
- package/src/client/components/mobile/LayoutWrapper.tsx +9 -43
- package/src/client/components/mobile/RightSidebar.tsx +31 -12
- package/src/client/components/mobile/SessionSidebar.tsx +112 -137
- package/src/client/components/mobile/drawer-strip.tsx +85 -0
- package/src/client/components/mobile/left-drawer-nav.test.tsx +350 -0
- package/src/client/components/mobile/mobile-drawer-reveals.test.tsx +194 -0
- package/src/client/components/mobile/mobile-drawer-reveals.ts +138 -0
- package/src/client/components/mobile/mobile-main-view/Header.tsx +12 -24
- package/src/client/components/mobile/mobile-right-sidebar/Action.tsx +57 -0
- package/src/client/components/mobile/mobile-right-sidebar/Chrome.tsx +14 -87
- package/src/client/components/mobile/mobile-right-sidebar/FullDiff.tsx +2 -7
- package/src/client/components/mobile/mobile-right-sidebar/Header.test.tsx +157 -0
- package/src/client/components/mobile/mobile-right-sidebar/Header.tsx +109 -105
- package/src/client/components/mobile/mobile-right-sidebar/OutlineButton.tsx +1 -1
- package/src/client/components/mobile/mobile-right-sidebar/Overflow.tsx +95 -0
- package/src/client/components/mobile/mobile-session-sidebar/Body.tsx +212 -0
- package/src/client/components/mobile/mobile-session-sidebar/Header.tsx +7 -9
- package/src/client/components/mobile/mobile-session-sidebar/Toolbar.tsx +2 -2
- package/src/client/components/mobile/mobile-session-sidebar/use-dock.ts +29 -8
- package/src/client/components/mobile/mobile-session-sidebar/use-drawer-tabs.ts +97 -0
- package/src/client/components/settings/Band.test.tsx +83 -0
- package/src/client/components/settings/Band.tsx +96 -0
- package/src/client/components/settings/Modal.tsx +44 -69
- package/src/client/components/settings/apply-side-effects.ts +15 -4
- package/src/client/components/settings/band-height.test.tsx +16 -3
- package/src/client/components/settings/categories/AppearanceSettings.test.tsx +35 -9
- package/src/client/components/settings/categories/AppearanceSettings.tsx +2 -0
- package/src/client/components/settings/categories/ChatSettings.test.tsx +32 -9
- package/src/client/components/settings/categories/ChatSettings.tsx +2 -0
- package/src/client/components/settings/categories/NotificationSettings.tsx +1 -1
- package/src/client/components/settings/categories/appearance-settings/PanelNavSection.tsx +40 -223
- package/src/client/components/settings/categories/appearance-settings/nav-choice.tsx +176 -0
- package/src/client/components/settings/categories/appearance-settings/nav-miniatures.tsx +93 -0
- package/src/client/components/settings/categories/connect-settings/PairDialog.tsx +1 -1
- package/src/client/components/settings/categories/mcp-settings/ImportModal.tsx +1 -1
- package/src/client/components/settings/categories/notification-settings/PermissionNotice.tsx +1 -1
- package/src/client/components/settings/categories/provider-settings/DeleteProviderModal.tsx +1 -1
- package/src/client/components/settings/categories/provider-settings/LogoutProviderModal.tsx +1 -1
- package/src/client/components/settings/drill.tsx +113 -0
- package/src/client/components/settings/master-detail/GroupDetail.tsx +14 -6
- package/src/client/components/settings/master-detail/GroupSidebar.tsx +9 -1
- package/src/client/components/settings/master-detail/index.tsx +45 -25
- package/src/client/components/workspace/chat-timeline/MessageList.test.ts +11 -0
- package/src/client/components/workspace/chat-timeline/MessageList.tsx +29 -21
- package/src/client/components/workspace/chat-timeline/MobileTurnJump.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/NewChatModal.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/SystemNotice.tsx +4 -0
- package/src/client/components/workspace/chat-timeline/ToolCallingSection.test.ts +23 -6
- package/src/client/components/workspace/chat-timeline/UndoConfirmModal.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/chat-input/AttachmentToolbar.tsx +19 -2
- package/src/client/components/workspace/chat-timeline/chat-input/GoalModal.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/index.tsx +5 -9
- package/src/client/components/workspace/chat-timeline/plan-review/index.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/FormAsk.test.tsx +4 -4
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/FormDialog.test.tsx +127 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/FormDialog.tsx +225 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/OrphanAsks.test.tsx +5 -4
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/OrphanAsks.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/PluginPendingInteractions.test.ts +2 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/index.test.ts +4 -3
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/index.tsx +40 -4
- package/src/client/components/workspace/chat-timeline/tool-renderers/extension-dialog/Footer.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/extension-dialog/index.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/index.tsx +5 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/AstEdit.tsx +8 -3
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Lsp.tsx +5 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Mcp.tsx +16 -7
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Resolve.tsx +16 -4
- package/src/client/components/workspace/chat-timeline/tool-renderers/registry.ts +37 -12
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/card-header.ts +4 -3
- package/src/client/components/workspace/diff-panel/index.tsx +1 -1
- package/src/client/components/workspace/editor/SaveDeletedFileModal.tsx +1 -1
- package/src/client/components/workspace/file-explorer/ArchiveModals.tsx +1 -1
- package/src/client/components/workspace/file-explorer/Modals.tsx +4 -4
- package/src/client/components/workspace/git-panel/Modals.tsx +1 -1
- package/src/client/components/workspace/model-dropdown/CloseButton.tsx +38 -0
- package/src/client/components/workspace/model-dropdown/Fullscreen.tsx +16 -25
- package/src/client/components/workspace/model-dropdown/HarnessTabs.tsx +30 -9
- package/src/client/components/workspace/model-dropdown/Header.tsx +33 -21
- package/src/client/components/workspace/model-dropdown/Panel.tsx +19 -4
- package/src/client/components/workspace/model-dropdown/picker-close.test.tsx +139 -0
- package/src/client/components/workspace/model-dropdown/placement.test.tsx +9 -7
- package/src/client/components/workspace/terminal-panel/RealtimeTerminalView.tsx +1 -1
- package/src/client/components/workspace/wiki-panel/NavModal.tsx +1 -1
- package/src/client/data/settings/omp-schema.json +103 -42
- package/src/client/hooks/chat/timeline/ask-form-frame.ts +33 -0
- package/src/client/hooks/chat/timeline/ask-frame-asks.ts +68 -0
- package/src/client/hooks/chat/timeline/ask-frame-buckets.ts +77 -0
- package/src/client/hooks/chat/timeline/ask-frames-context.ts +68 -0
- package/src/client/hooks/chat/timeline/ask-frames-form.test.ts +170 -0
- package/src/client/hooks/chat/timeline/ask-frames.test.ts +1 -1
- package/src/client/hooks/chat/timeline/ask-frames.ts +36 -93
- package/src/client/hooks/chat/timeline/row-measure.ts +75 -0
- package/src/client/hooks/chat/timeline/row-window.test.ts +41 -21
- package/src/client/hooks/chat/timeline/row-window.ts +6 -24
- package/src/client/hooks/workspace/left-dock.ts +19 -0
- package/src/client/hooks/workspace/mobile-panel-nav.ts +90 -0
- package/src/client/hooks/workspace/panel-nav.test.ts +42 -21
- package/src/client/hooks/workspace/panel-tabs-reveal.test.tsx +286 -0
- package/src/client/hooks/workspace/panel-tabs-reveal.ts +174 -0
- package/src/client/hooks/workspace/panel-tabs.ts +22 -4
- package/src/client/hooks/workspace/session-state/index.test.tsx +145 -0
- package/src/client/hooks/workspace/session-state/index.ts +28 -16
- package/src/client/lib/ui/phone-row.test.ts +52 -0
- package/src/client/lib/ui/phone-row.ts +71 -0
- package/src/client/press-state.test.ts +179 -0
- package/src/client/tailwind.css +146 -0
- package/src/server/lib/bundler/titlebar-css.test.ts +10 -1
- package/src/server/lib/omp/rpc/constants.test.ts +6 -1
- package/src/shared/lib/chat/ask-form/data.ts +155 -0
- package/src/shared/lib/chat/ask-form/fields.ts +4 -0
- package/src/shared/lib/chat/ask-form/index.ts +8 -0
- package/src/shared/lib/chat/ask-form/types.ts +12 -0
- package/src/shared/lib/chat/timeline/tool-verbs.ts +28 -1
- package/src/shared/lib/chat/tool/tool-commands.test.ts +102 -0
- package/src/shared/lib/chat/tool/tool-commands.ts +124 -0
- package/src/shared/lib/omp/config/schema-releases.test.ts +34 -1
- package/src/shared/lib/omp/dialog-methods.ts +6 -0
- package/src/shared/lib/omp/session/wait-idle.ts +7 -3
- package/src/shared/lib/settings/defaults.ts +3 -2
- package/src/shared/lib/workspace/panel-nav.test.ts +26 -19
- package/src/shared/lib/workspace/panel-nav.ts +20 -9
- package/src/shared/types/omp/agent.ts +20 -3
- package/src/shared/types/settings/state.ts +17 -5
- package/dist/client/static/js/ImageView-6ksvyzqv.js +0 -1
- package/dist/client/static/js/LayoutWrapper-px60417t.js +0 -2
- package/dist/client/static/js/Modal-yv1718s1.js +0 -59
- package/dist/client/static/js/architecture-7GRP2DOG-bch3nye9.js +0 -1
- package/dist/client/static/js/bash-mevzaywf.js +0 -1
- package/dist/client/static/js/c-y1y6v00q.js +0 -1
- package/dist/client/static/js/cpp-wk9z0c5g.js +0 -1
- package/dist/client/static/js/css-3w3p9s67.js +0 -1
- package/dist/client/static/js/css-g85rwzty.js +0 -1
- package/dist/client/static/js/cynefin-OW5HDTMX-vqy5jtnk.js +0 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-65ph4s3m.js +0 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-hekt0qsb.js +0 -1
- package/dist/client/static/js/gitGraph-4MIJSDKK-t45ekjb6.js +0 -1
- package/dist/client/static/js/graphql-027z8sc0.js +0 -1
- package/dist/client/static/js/html-fqda6wxx.js +0 -1
- package/dist/client/static/js/index-252br0k2.js +0 -1
- package/dist/client/static/js/index-6bm4pw90.css +0 -1
- package/dist/client/static/js/index-80qxk9hx.js +0 -1
- package/dist/client/static/js/index-9674dxb4.js +0 -1
- package/dist/client/static/js/index-9k4121z4.js +0 -4
- package/dist/client/static/js/index-b6454rme.js +0 -12
- package/dist/client/static/js/index-ck0fd3aj.js +0 -2
- package/dist/client/static/js/index-jdf1tks1.js +0 -2
- package/dist/client/static/js/index-q58e8x6j.js +0 -1
- package/dist/client/static/js/info-A6RAGUB7-mw29xbwf.js +0 -1
- package/dist/client/static/js/ini-3cx6tmv4.js +0 -1
- package/dist/client/static/js/java-zs6qh1dm.js +0 -1
- package/dist/client/static/js/javascript-b9mkygak.js +0 -1
- package/dist/client/static/js/json-qn73s8xb.js +0 -1
- package/dist/client/static/js/jsx-gahhfczw.js +0 -1
- package/dist/client/static/js/lua-d8enp14s.js +0 -1
- package/dist/client/static/js/markdown-qetaj4vp.js +0 -1
- package/dist/client/static/js/one-dark-pro-axkq0m3s.js +0 -1
- package/dist/client/static/js/one-light-pncb08qd.js +0 -1
- package/dist/client/static/js/packet-AYTQ26CC-md85wpjq.js +0 -1
- package/dist/client/static/js/pie-WAS4IAKB-4grcqnp8.js +0 -1
- package/dist/client/static/js/properties-g6tpq003.js +0 -1
- package/dist/client/static/js/python-cy06fzhg.js +0 -1
- package/dist/client/static/js/r-vw8berfv.js +0 -1
- package/dist/client/static/js/radar-RG4KPBEZ-7j9prhg1.js +0 -1
- package/dist/client/static/js/railroad-74A4TZTK-g8x2jps1.js +0 -1
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-cbg7k68h.js +0 -1
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-xfvjk9f8.js +0 -1
- package/dist/client/static/js/railroad-peg-WCYAUIDC-7w97805z.js +0 -1
- package/dist/client/static/js/sql-bwnasywx.js +0 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-253nz20y.js +0 -8
- package/dist/client/static/js/treeView-Q6P3EWNA-xhf1r6c3.js +0 -1
- package/dist/client/static/js/treemap-WGGIJYW6-4n3j7ekq.js +0 -1
- package/dist/client/static/js/tsx-3dzv8h6k.js +0 -1
- package/dist/client/static/js/typescript-44vs0wn4.js +0 -1
- package/dist/client/static/js/wardley-WFR3VGLG-fb0py35r.js +0 -1
- package/dist/client/static/js/xml-yvv5fn3k.js +0 -1
- package/dist/client/static/js/yaml-avewh7n5.js +0 -1
- package/src/client/hooks/workspace/mobile-right-panel-nav.ts +0 -63
- package/src/shared/lib/ui/safe-area.test.ts +0 -28
- package/src/shared/lib/ui/safe-area.ts +0 -42
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The `ask` tool calls a dialog may belong to, read from the timeline.
|
|
8
|
+
*
|
|
9
|
+
* Split from `ask-frames.ts` (which owns the routing decision) because the two
|
|
10
|
+
* ask sets answer different questions and both are read on every pending frame:
|
|
11
|
+
*
|
|
12
|
+
* - `openAsks` are the calls that can still OWN a dialog: not settled, and not
|
|
13
|
+
* already carrying an answer for every question.
|
|
14
|
+
* - `allAsks` are every ask, settled ones included. A dialog whose call just
|
|
15
|
+
* failed is still that ask's dialog, so it belongs on the timeline (an
|
|
16
|
+
* inline orphan) rather than in the modal.
|
|
17
|
+
*
|
|
18
|
+
* Each entry also carries the call's `html` when it has one, because omp
|
|
19
|
+
* 19.1.0's whole-form frame (`method:"form"`) names no question: its `html` is
|
|
20
|
+
* the same string the tool call's arguments carry, and that is the only key
|
|
21
|
+
* both sides hold.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import type { ChatMessageData } from '@/shared/types';
|
|
25
|
+
import type { AskQuestion } from '@/shared/lib/chat/ask-form/types';
|
|
26
|
+
import { isAskSettled, isAskToolCall, parseAskQuestions } from '@/shared/lib/chat/ask-questions';
|
|
27
|
+
import { parseAskResult } from '@/shared/lib/chat/ask-results';
|
|
28
|
+
|
|
29
|
+
/** One ask tool call, as a dialog's potential owner. */
|
|
30
|
+
export interface AskCall {
|
|
31
|
+
toolId: string;
|
|
32
|
+
questions: AskQuestion[];
|
|
33
|
+
/** The `html` the call asked with, when it is the form shape. */
|
|
34
|
+
html?: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface AskIndex {
|
|
38
|
+
/** Calls that can still own a dialog. */
|
|
39
|
+
openAsks: AskCall[];
|
|
40
|
+
/** Every ask, settled ones included. */
|
|
41
|
+
allAsks: AskCall[];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Index the timeline's ask tool calls by what a pending dialog may claim. */
|
|
45
|
+
export function collectAsks(messages: ChatMessageData[]): AskIndex {
|
|
46
|
+
const openAsks: AskCall[] = [];
|
|
47
|
+
const allAsks: AskCall[] = [];
|
|
48
|
+
for (const message of messages) {
|
|
49
|
+
for (const tool of message.toolCalls ?? []) {
|
|
50
|
+
if (!isAskToolCall(tool)) continue;
|
|
51
|
+
const questions = parseAskQuestions(tool);
|
|
52
|
+
if (questions.length === 0) continue;
|
|
53
|
+
const input = tool.input as Record<string, unknown> | undefined;
|
|
54
|
+
const html = typeof input?.html === 'string' ? input.html : undefined;
|
|
55
|
+
const entry: AskCall = { toolId: tool.id, questions, ...(html ? { html } : {}) };
|
|
56
|
+
allAsks.push(entry);
|
|
57
|
+
// A settled call is not a candidate at all: a validation failure leaves a
|
|
58
|
+
// dead call (`status: 'error'`) whose card renders no control, so letting
|
|
59
|
+
// it claim the retry's dialog left the live card waiting forever. A call
|
|
60
|
+
// read back from the JSONL while still parked is neither — omp writes no
|
|
61
|
+
// result until the question is answered.
|
|
62
|
+
if (isAskSettled(tool)) continue;
|
|
63
|
+
if (parseAskResult(tool, questions).every((answer) => answer !== null)) continue;
|
|
64
|
+
openAsks.push(entry);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return { openAsks, allAsks };
|
|
68
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Where one ask's claimed dialogs sit among its questions.
|
|
8
|
+
*
|
|
9
|
+
* Split from `ask-frames.ts` (which decides WHICH ask a frame belongs to) so
|
|
10
|
+
* each file states one rule. This half takes the frames already owned by one
|
|
11
|
+
* tool call and answers the question the card asks: for each question, the
|
|
12
|
+
* dialogs it raised, in order.
|
|
13
|
+
*
|
|
14
|
+
* Three shapes arrive and each is placed by its own key:
|
|
15
|
+
*
|
|
16
|
+
* - a GROUPED frame (`method:"ask"`) covers every question it names, so it is
|
|
17
|
+
* pushed onto each of their buckets rather than onto one;
|
|
18
|
+
* - a frame claimed by its ROWS already knows its question (`optionPlacements`);
|
|
19
|
+
* - anything else is the per-question walk's business (`groupAskFrames`), which
|
|
20
|
+
* follows omp's own forward-moving order.
|
|
21
|
+
*
|
|
22
|
+
* A frame with neither a title nor a row match is not walked at all: it is
|
|
23
|
+
* handed back as `loose`, because the card must draw it as the live control
|
|
24
|
+
* rather than guess a question and print the wrong one as open.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
import type { ExtensionUiDialogRequest } from '@/shared/types/omp/agent';
|
|
28
|
+
import type { AskQuestion } from '@/shared/lib/chat/ask-form/types';
|
|
29
|
+
import { groupAskFrames } from '@/shared/lib/chat/ask-questions';
|
|
30
|
+
|
|
31
|
+
export interface BucketedFrames {
|
|
32
|
+
/** One bucket per question, in form order. */
|
|
33
|
+
perQuestion: ExtensionUiDialogRequest[][];
|
|
34
|
+
/**
|
|
35
|
+
* Frames matched by NEITHER key, which the card draws as the live control
|
|
36
|
+
* (see `looseByTool`). They are deliberately absent from every question
|
|
37
|
+
* bucket: guessing one would print the wrong question as open.
|
|
38
|
+
*/
|
|
39
|
+
unmatched: ExtensionUiDialogRequest[];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function bucketAskFrames(
|
|
43
|
+
questions: AskQuestion[],
|
|
44
|
+
frames: readonly ExtensionUiDialogRequest[],
|
|
45
|
+
/** Frames claimed by neither key, which the card draws as the live control. */
|
|
46
|
+
unmatched: ReadonlySet<ExtensionUiDialogRequest>,
|
|
47
|
+
/** Question index per frame claimed by its option rows. */
|
|
48
|
+
optionPlacements: ReadonlyMap<ExtensionUiDialogRequest, number>,
|
|
49
|
+
): BucketedFrames {
|
|
50
|
+
const placed: ExtensionUiDialogRequest[][] = questions.map((): ExtensionUiDialogRequest[] => []);
|
|
51
|
+
/** Frames the per-question walk still has to place. */
|
|
52
|
+
const walking: ExtensionUiDialogRequest[] = [];
|
|
53
|
+
const unplaced: ExtensionUiDialogRequest[] = [];
|
|
54
|
+
for (const frame of frames) {
|
|
55
|
+
if (Array.isArray(frame.questions) && frame.questions.length > 0) {
|
|
56
|
+
for (const grouped of frame.questions) {
|
|
57
|
+
const index = questions.findIndex((question) => question.id === grouped.id);
|
|
58
|
+
if (index >= 0) placed[index].push(frame);
|
|
59
|
+
else walking.push(frame);
|
|
60
|
+
}
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
const byOptions = optionPlacements.get(frame);
|
|
64
|
+
if (byOptions !== undefined) {
|
|
65
|
+
if (placed[byOptions]) placed[byOptions].push(frame);
|
|
66
|
+
else walking.push(frame);
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
if (unmatched.has(frame)) {
|
|
70
|
+
unplaced.push(frame);
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
walking.push(frame);
|
|
74
|
+
}
|
|
75
|
+
const walked = groupAskFrames(questions, walking);
|
|
76
|
+
return { perQuestion: questions.map((_, index) => [...placed[index], ...walked[index]]), unmatched: unplaced };
|
|
77
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The context the timeline provides so any ask card can reach the dialogs omp
|
|
8
|
+
* is blocked on: what `splitAskFrames` routed to it, and the one responder that
|
|
9
|
+
* puts an answer on the wire.
|
|
10
|
+
*
|
|
11
|
+
* Split from `ask-frames.ts` (which owns the ROUTING) because the two answer
|
|
12
|
+
* different questions: routing decides which card a frame belongs to, and this
|
|
13
|
+
* is the plumbing that hands the result down the tree. A component needs one or
|
|
14
|
+
* the other, never both.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { createContext, useContext } from 'preact/compat';
|
|
18
|
+
import type { ExtensionUiDialogRequest } from '@/shared/types/omp/agent';
|
|
19
|
+
import type { ExtensionDialogResponse } from '@/client/components/workspace/chat-timeline/tool-renderers/extension-dialog/Lazy';
|
|
20
|
+
|
|
21
|
+
export interface AskFramesSplit {
|
|
22
|
+
/** The ask's dialogs, bucketed per question, keyed by ask tool-call id. */
|
|
23
|
+
framesByTool: Map<string, ExtensionUiDialogRequest[][]>;
|
|
24
|
+
/**
|
|
25
|
+
* Field dialogs that belong to an open ask but matched no question, keyed by
|
|
26
|
+
* tool id. A form parser can drift from omp's on a shape neither was written
|
|
27
|
+
* for; the frame must still be answerable on the card, and the modal has no
|
|
28
|
+
* field body. The card draws these last, as the live control.
|
|
29
|
+
*/
|
|
30
|
+
looseByTool: Map<string, ExtensionUiDialogRequest[]>;
|
|
31
|
+
/** Ask dialogs no card can own — the timeline draws them inline. */
|
|
32
|
+
orphanAsks: ExtensionUiDialogRequest[];
|
|
33
|
+
/**
|
|
34
|
+
* The whole-form dialog of an ask call (omp 19.1.0's `method:"form"`), keyed
|
|
35
|
+
* by tool id. ONE frame answers every control, so it is not bucketed per
|
|
36
|
+
* question like the per-field walk's dialogs.
|
|
37
|
+
*/
|
|
38
|
+
formByTool: Map<string, ExtensionUiDialogRequest>;
|
|
39
|
+
/** Oldest non-ask request nothing claimed — the one the modal renders. */
|
|
40
|
+
modalRequest: ExtensionUiDialogRequest | null;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface AskFramesHandle {
|
|
44
|
+
framesByTool: AskFramesSplit['framesByTool'];
|
|
45
|
+
/** Ask field dialogs a card owns but no question matched (see `looseByTool`). */
|
|
46
|
+
looseByTool: AskFramesSplit['looseByTool'];
|
|
47
|
+
/** Ask dialogs with no tool card to render them (see `orphanAsks`). */
|
|
48
|
+
orphanAsks: AskFramesSplit['orphanAsks'];
|
|
49
|
+
/** The ask's whole-form dialog, when it has one (see `formByTool`). */
|
|
50
|
+
formByTool: AskFramesSplit['formByTool'];
|
|
51
|
+
/** Answer one ask dialog and drop it from the pending queue. */
|
|
52
|
+
respond: (request: ExtensionUiDialogRequest, response: ExtensionDialogResponse) => void;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const EMPTY: AskFramesHandle = {
|
|
56
|
+
framesByTool: new Map(),
|
|
57
|
+
looseByTool: new Map(),
|
|
58
|
+
orphanAsks: [],
|
|
59
|
+
formByTool: new Map(),
|
|
60
|
+
respond: () => {},
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export const AskFramesContext = createContext<AskFramesHandle>(EMPTY);
|
|
64
|
+
|
|
65
|
+
/** Pending ask dialogs for the timeline that provides them. */
|
|
66
|
+
export function useAskFrames(): AskFramesHandle {
|
|
67
|
+
return useContext(AskFramesContext);
|
|
68
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* omp 19.1.0's `method:"form"` frame — the RPC host's `ui.formDialog`.
|
|
8
|
+
*
|
|
9
|
+
* The `ask` tool stopped walking its HTML form one blocking dialog at a time
|
|
10
|
+
* and now sends the whole form once, keyed by the same `html` the tool call's
|
|
11
|
+
* arguments carry, answered by ONE `{ data }` reply. Two facts matter here and
|
|
12
|
+
* neither is visible to a type check:
|
|
13
|
+
*
|
|
14
|
+
* 1. The frame must be CLAIMED by its call. Unclaimed, it reached the modal —
|
|
15
|
+
* a panel with no form body — while the agent stayed blocked.
|
|
16
|
+
* 2. The `data` payload must satisfy omp's validation (`parseFormDialogResponse`):
|
|
17
|
+
* an unknown key, a disabled option, an array where a single string is
|
|
18
|
+
* expected, or a missing required field is refused and the run parks.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import { describe, expect, test } from 'bun:test';
|
|
22
|
+
|
|
23
|
+
import { splitAskFrames } from '@/client/hooks/chat/timeline/ask-frames';
|
|
24
|
+
import { buildFormData, formAnswers, isArrayQuestion } from '@/shared/lib/chat/ask-form/data';
|
|
25
|
+
import { parseAskForm } from '@/shared/lib/chat/ask-form';
|
|
26
|
+
import type { AskQuestion } from '@/shared/lib/chat/ask-form/types';
|
|
27
|
+
import type { ChatMessageData } from '@/shared/types';
|
|
28
|
+
import type { ExtensionUiDialogRequest } from '@/shared/types/omp/agent';
|
|
29
|
+
|
|
30
|
+
const HTML = `<form>
|
|
31
|
+
<fieldset>
|
|
32
|
+
<legend>Flavour</legend>
|
|
33
|
+
<label><input type="radio" name="flavour" value="yes" checked> Yes</label>
|
|
34
|
+
<label><input type="radio" name="flavour" value="no"> No</label>
|
|
35
|
+
</fieldset>
|
|
36
|
+
<label>Serving <input type="number" name="serving" value="1" required></label>
|
|
37
|
+
<label><input type="checkbox" name="extras" value="ice"> Ice</label>
|
|
38
|
+
<label><input type="checkbox" name="extras" value="lemon"> Lemon</label>
|
|
39
|
+
</form>`;
|
|
40
|
+
|
|
41
|
+
function askTool(html: string) {
|
|
42
|
+
return {
|
|
43
|
+
id: 'call-ask',
|
|
44
|
+
type: 'custom' as const,
|
|
45
|
+
title: 'ask',
|
|
46
|
+
name: 'ask',
|
|
47
|
+
input: { html },
|
|
48
|
+
status: 'running' as const,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function message(html: string): ChatMessageData {
|
|
53
|
+
return { id: 'm1', role: 'ai', content: '', toolCalls: [askTool(html)] } as unknown as ChatMessageData;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const formFrame: ExtensionUiDialogRequest = {
|
|
57
|
+
type: 'extension_ui_request',
|
|
58
|
+
id: 'frame-form',
|
|
59
|
+
method: 'form',
|
|
60
|
+
html: HTML,
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
describe('splitAskFrames with a form frame', () => {
|
|
64
|
+
test('claims the ask by its html and never reaches the modal', () => {
|
|
65
|
+
const split = splitAskFrames([message(HTML)], [formFrame], true);
|
|
66
|
+
expect(split.formByTool.get('call-ask')).toBe(formFrame);
|
|
67
|
+
expect(split.orphanAsks).toEqual([]);
|
|
68
|
+
expect(split.modalRequest).toBeNull();
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
test('a form no ask raised is an inline orphan, not a modal', () => {
|
|
72
|
+
const split = splitAskFrames([], [formFrame], true);
|
|
73
|
+
expect(split.formByTool.size).toBe(0);
|
|
74
|
+
expect(split.orphanAsks).toEqual([formFrame]);
|
|
75
|
+
expect(split.modalRequest).toBeNull();
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
test('falls back to the single open ask when the html differs only in whitespace', () => {
|
|
79
|
+
const reindented = HTML.replace(/\n\s*/g, ' ');
|
|
80
|
+
const split = splitAskFrames([message(HTML)], [{ ...formFrame, html: reindented }], true);
|
|
81
|
+
expect(split.formByTool.get('call-ask')?.id).toBe('frame-form');
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
test('an empty queue reports an empty form map', () => {
|
|
85
|
+
expect(splitAskFrames([message(HTML)], [], true).formByTool.size).toBe(0);
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
describe('buildFormData', () => {
|
|
90
|
+
const questions = parseAskForm(HTML);
|
|
91
|
+
|
|
92
|
+
test('the form parses into one question per control name', () => {
|
|
93
|
+
expect(questions.map((question) => question.id)).toEqual(['flavour', 'serving', 'extras']);
|
|
94
|
+
expect(questions[0].multi).toBe(false);
|
|
95
|
+
expect(questions[2].multi).toBe(true);
|
|
96
|
+
expect(isArrayQuestion(questions[2])).toBe(true);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
test('carries required and disabled through the parser', () => {
|
|
100
|
+
expect(questions[1].required).toBe(true);
|
|
101
|
+
const withDisabled = parseAskForm(
|
|
102
|
+
'<form><fieldset><legend>Pick</legend>' +
|
|
103
|
+
'<label><input type="radio" name="a" value="1" disabled> One</label>' +
|
|
104
|
+
'<label><input type="radio" name="a" value="2"> Two</label></fieldset></form>',
|
|
105
|
+
);
|
|
106
|
+
expect(withDisabled[0].options[0].disabled).toBe(true);
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
test('a single choice submits one string and a group an array', () => {
|
|
110
|
+
const built = buildFormData(questions, {
|
|
111
|
+
0: { selected: ['Yes'], text: '' },
|
|
112
|
+
1: { selected: [], text: '2' },
|
|
113
|
+
2: { selected: ['Ice', 'Lemon'], text: '' },
|
|
114
|
+
});
|
|
115
|
+
expect(built).toEqual({ data: { flavour: 'yes', serving: '2', extras: ['ice', 'lemon'] } });
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
test('a typed answer stands in for the single choice', () => {
|
|
119
|
+
const built = buildFormData(questions, {
|
|
120
|
+
0: { selected: [], text: 'oat' },
|
|
121
|
+
1: { selected: [], text: '1' },
|
|
122
|
+
});
|
|
123
|
+
expect('data' in built && built.data.flavour).toBe('oat');
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
test('Other text joins a checkbox group as an extra entry', () => {
|
|
127
|
+
const built = buildFormData(questions, {
|
|
128
|
+
0: { selected: ['No'], text: '' },
|
|
129
|
+
1: { selected: [], text: '3' },
|
|
130
|
+
2: { selected: ['Ice'], text: 'sprinkles' },
|
|
131
|
+
});
|
|
132
|
+
expect('data' in built && built.data.extras).toEqual(['ice', 'sprinkles']);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
test('a required field left empty names the question instead of sending', () => {
|
|
136
|
+
const built = buildFormData(questions, { 0: { selected: ['Yes'], text: '' } });
|
|
137
|
+
expect(built).toEqual({ missing: questions[1].question });
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
test('nothing answered at all is refused rather than sent as {}', () => {
|
|
141
|
+
const optional = parseAskForm('<form><label>Note <input name="note"></label></form>');
|
|
142
|
+
expect(buildFormData(optional, {})).toEqual({ missing: 'Answer at least one question.' });
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
test('a disabled option is never sent', () => {
|
|
146
|
+
const withDisabled = parseAskForm(
|
|
147
|
+
'<form><fieldset><legend>Pick</legend>' +
|
|
148
|
+
'<label><input type="radio" name="a" value="1" disabled> One</label>' +
|
|
149
|
+
'<label><input type="radio" name="a" value="2"> Two</label></fieldset></form>',
|
|
150
|
+
);
|
|
151
|
+
const built = buildFormData(withDisabled, { 0: { selected: ['One'], text: '' } });
|
|
152
|
+
expect(built).toEqual({ missing: 'Answer at least one question.' });
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
test('formAnswers reports every control in form order', () => {
|
|
156
|
+
const answers = formAnswers(questions, { 1: { selected: [], text: '4' } });
|
|
157
|
+
expect(answers.map((answer) => answer.name)).toEqual(['flavour', 'serving', 'extras']);
|
|
158
|
+
expect(answers[1].value).toBe('4');
|
|
159
|
+
// The radio group is not `required`, so an unanswered one is simply absent
|
|
160
|
+
// from the payload rather than named as a blocker.
|
|
161
|
+
expect(answers[0]).toEqual({ name: 'flavour', value: '' });
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
describe('AskQuestion required flag', () => {
|
|
166
|
+
test('is absent on a form whose controls are all optional', () => {
|
|
167
|
+
const questions: AskQuestion[] = parseAskForm('<form><label>Note <input name="note"></label></form>');
|
|
168
|
+
expect(questions[0].required).toBeUndefined();
|
|
169
|
+
});
|
|
170
|
+
});
|
|
@@ -74,7 +74,7 @@ describe('splitAskFrames', () => {
|
|
|
74
74
|
const gate = confirmFrame('g1', 'Run bash?');
|
|
75
75
|
|
|
76
76
|
// The regression: the frame has been replayed, its tool call has not.
|
|
77
|
-
expect(splitAskFrames([], [question], false)).toEqual({ framesByTool: new Map(), looseByTool: new Map(), orphanAsks: [], modalRequest: null });
|
|
77
|
+
expect(splitAskFrames([], [question], false)).toEqual({ framesByTool: new Map(), looseByTool: new Map(), orphanAsks: [], formByTool: new Map(), modalRequest: null });
|
|
78
78
|
// The hold is uniform — a gate cannot be told from an ask before history
|
|
79
79
|
// either, and it is re-decided the moment the history settles.
|
|
80
80
|
expect(splitAskFrames([], [gate], false).modalRequest).toBeNull();
|
|
@@ -43,49 +43,14 @@
|
|
|
43
43
|
* modal — never the card claim — until there is a timeline to decide against.
|
|
44
44
|
*/
|
|
45
45
|
|
|
46
|
-
import { createContext, useContext } from 'preact/compat';
|
|
47
46
|
import type { ChatMessageData } from '@/shared/types';
|
|
48
47
|
import type { ExtensionUiDialogRequest } from '@/shared/types/omp/agent';
|
|
49
|
-
import { askQuestionForFrame, askQuestionForOptions, askQuestionForTitle, askQuestionSharesText,
|
|
50
|
-
import {
|
|
51
|
-
import type {
|
|
48
|
+
import { askQuestionForFrame, askQuestionForOptions, askQuestionForTitle, askQuestionSharesText, normalizeAskText } from '@/shared/lib/chat/ask-questions';
|
|
49
|
+
import { bucketAskFrames } from '@/client/hooks/chat/timeline/ask-frame-buckets';
|
|
50
|
+
import type { AskFramesSplit } from '@/client/hooks/chat/timeline/ask-frames-context';
|
|
51
|
+
import { collectAsks } from '@/client/hooks/chat/timeline/ask-frame-asks';
|
|
52
|
+
import { claimFormFrame } from '@/client/hooks/chat/timeline/ask-form-frame';
|
|
52
53
|
import { isApprovalGateFrame } from '@/shared/lib/chat/omp/approval-gate';
|
|
53
|
-
import type { ExtensionDialogResponse } from '@/client/components/workspace/chat-timeline/tool-renderers/extension-dialog/Lazy';
|
|
54
|
-
|
|
55
|
-
export interface AskFramesSplit {
|
|
56
|
-
/** The ask's dialogs, bucketed per question, keyed by ask tool-call id. */
|
|
57
|
-
framesByTool: Map<string, ExtensionUiDialogRequest[][]>;
|
|
58
|
-
/**
|
|
59
|
-
* Field dialogs that belong to an open ask but matched no question, keyed by
|
|
60
|
-
* tool id. A form parser can drift from omp's on a shape neither was written
|
|
61
|
-
* for; the frame must still be answerable on the card, and the modal has no
|
|
62
|
-
* field body. The card draws these last, as the live control.
|
|
63
|
-
*/
|
|
64
|
-
looseByTool: Map<string, ExtensionUiDialogRequest[]>;
|
|
65
|
-
/** Ask dialogs no card can own — the timeline draws them inline. */
|
|
66
|
-
orphanAsks: ExtensionUiDialogRequest[];
|
|
67
|
-
/** Oldest non-ask request nothing claimed — the one the modal renders. */
|
|
68
|
-
modalRequest: ExtensionUiDialogRequest | null;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export interface AskFramesHandle {
|
|
72
|
-
framesByTool: AskFramesSplit['framesByTool'];
|
|
73
|
-
/** Ask field dialogs a card owns but no question matched (see `looseByTool`). */
|
|
74
|
-
looseByTool: AskFramesSplit['looseByTool'];
|
|
75
|
-
/** Ask dialogs with no tool card to render them (see `orphanAsks`). */
|
|
76
|
-
orphanAsks: AskFramesSplit['orphanAsks'];
|
|
77
|
-
/** Answer one ask dialog and drop it from the pending queue. */
|
|
78
|
-
respond: (request: ExtensionUiDialogRequest, response: ExtensionDialogResponse) => void;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const EMPTY: AskFramesHandle = { framesByTool: new Map(), looseByTool: new Map(), orphanAsks: [], respond: () => {} };
|
|
82
|
-
|
|
83
|
-
export const AskFramesContext = createContext<AskFramesHandle>(EMPTY);
|
|
84
|
-
|
|
85
|
-
/** Pending ask dialogs for the timeline that provides them. */
|
|
86
|
-
export function useAskFrames(): AskFramesHandle {
|
|
87
|
-
return useContext(AskFramesContext);
|
|
88
|
-
}
|
|
89
54
|
|
|
90
55
|
export function splitAskFrames(
|
|
91
56
|
messages: ChatMessageData[],
|
|
@@ -96,7 +61,8 @@ export function splitAskFrames(
|
|
|
96
61
|
): AskFramesSplit {
|
|
97
62
|
const framesByTool = new Map<string, ExtensionUiDialogRequest[][]>();
|
|
98
63
|
const looseByTool = new Map<string, ExtensionUiDialogRequest[]>();
|
|
99
|
-
|
|
64
|
+
const formByTool = new Map<string, ExtensionUiDialogRequest>();
|
|
65
|
+
if (pending.length === 0) return { framesByTool, looseByTool, orphanAsks: [], formByTool, modalRequest: null };
|
|
100
66
|
|
|
101
67
|
// Match against the asks that can still own a dialog: a reloaded session
|
|
102
68
|
// reads its tool calls back from the JSONL, where a call still parked on a
|
|
@@ -110,23 +76,7 @@ export function splitAskFrames(
|
|
|
110
76
|
// ask, and one whose every question already carries a recorded answer, is
|
|
111
77
|
// therefore not a candidate at all. A parked call read back from the JSONL is
|
|
112
78
|
// neither: omp writes no result until the question is answered.
|
|
113
|
-
const
|
|
114
|
-
// Every ask, settled ones included: a dialog whose call just failed is still
|
|
115
|
-
// the ask's dialog, so it belongs on the timeline (an inline orphan), never
|
|
116
|
-
// in the modal. Keeping them apart from `openAsks` is what lets ownership
|
|
117
|
-
// prefer the live call while recognition still avoids the modal.
|
|
118
|
-
const allAsks: { toolId: string; questions: AskQuestion[] }[] = [];
|
|
119
|
-
for (const message of messages) {
|
|
120
|
-
for (const tool of message.toolCalls ?? []) {
|
|
121
|
-
if (!isAskToolCall(tool)) continue;
|
|
122
|
-
const questions = parseAskQuestions(tool);
|
|
123
|
-
if (questions.length === 0) continue;
|
|
124
|
-
allAsks.push({ toolId: tool.id, questions });
|
|
125
|
-
if (isAskSettled(tool)) continue;
|
|
126
|
-
if (parseAskResult(tool, questions).every((answer) => answer !== null)) continue;
|
|
127
|
-
openAsks.push({ toolId: tool.id, questions });
|
|
128
|
-
}
|
|
129
|
-
}
|
|
79
|
+
const { openAsks, allAsks } = collectAsks(messages);
|
|
130
80
|
|
|
131
81
|
const owned = new Map<string, ExtensionUiDialogRequest[]>();
|
|
132
82
|
const handled = new Set<ExtensionUiDialogRequest>();
|
|
@@ -194,6 +144,27 @@ export function splitAskFrames(
|
|
|
194
144
|
continue;
|
|
195
145
|
}
|
|
196
146
|
|
|
147
|
+
// A FORM frame (omp 19.1.0's `ui.formDialog`, which the `ask` tool now
|
|
148
|
+
// uses) carries no `title` and no per-question ids: its `html` is the SAME
|
|
149
|
+
// string the tool call's arguments carry, which makes it the exact key.
|
|
150
|
+
// It answers every control of the form in one `{ data }` reply, so it
|
|
151
|
+
// belongs to the call as a whole rather than to one question.
|
|
152
|
+
if (request.method === 'form' && typeof request.html === 'string') {
|
|
153
|
+
const owner = claimFormFrame(request.html, openAsks);
|
|
154
|
+
if (owner) {
|
|
155
|
+
handled.add(request);
|
|
156
|
+
lastOwner = owner.toolId;
|
|
157
|
+
formByTool.set(owner.toolId, request);
|
|
158
|
+
} else if (historyLoaded) {
|
|
159
|
+
// Cardless: an extension's own `formDialog` (not the ask tool) has no
|
|
160
|
+
// card of its own. The timeline draws it inline rather than the modal,
|
|
161
|
+
// which has no form body.
|
|
162
|
+
orphanAsks.push(request);
|
|
163
|
+
handled.add(request);
|
|
164
|
+
}
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
|
|
197
168
|
let owner: string | null = null;
|
|
198
169
|
let titleMatched = false;
|
|
199
170
|
if (typeof request.title === 'string' && request.title) {
|
|
@@ -286,39 +257,9 @@ export function splitAskFrames(
|
|
|
286
257
|
|
|
287
258
|
for (const [toolId, frames] of owned) {
|
|
288
259
|
const questions = openAsks.find((candidate) => candidate.toolId === toolId)?.questions ?? [];
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
const loose: ExtensionUiDialogRequest[] = [];
|
|
293
|
-
const unmatched = new Set(unplaced.get(toolId) ?? []);
|
|
294
|
-
for (const frame of frames) {
|
|
295
|
-
if (Array.isArray(frame.questions) && frame.questions.length > 0) {
|
|
296
|
-
for (const grouped of frame.questions) {
|
|
297
|
-
const index = questions.findIndex((question) => question.id === grouped.id);
|
|
298
|
-
if (index >= 0) placed[index].push(frame);
|
|
299
|
-
else loose.push(frame);
|
|
300
|
-
}
|
|
301
|
-
continue;
|
|
302
|
-
}
|
|
303
|
-
// A frame claimed by its rows already knows the question it belongs to.
|
|
304
|
-
const byOptions = optionPlacements.get(frame);
|
|
305
|
-
if (byOptions !== undefined) {
|
|
306
|
-
if (placed[byOptions]) placed[byOptions].push(frame);
|
|
307
|
-
else loose.push(frame);
|
|
308
|
-
continue;
|
|
309
|
-
}
|
|
310
|
-
// A frame with neither a title nor a row match has no question to walk
|
|
311
|
-
// to; the card draws it as the live control (see `looseByTool`) rather
|
|
312
|
-
// than guessing a question and printing the wrong one as open.
|
|
313
|
-
if (unmatched.has(frame)) continue;
|
|
314
|
-
loose.push(frame);
|
|
315
|
-
}
|
|
316
|
-
// Everything that was not part of a grouped frame keeps the per-question
|
|
317
|
-
// walk it has always used.
|
|
318
|
-
const walked = groupAskFrames(questions, loose);
|
|
319
|
-
framesByTool.set(toolId, questions.map((_, index) => [...placed[index], ...walked[index]]));
|
|
320
|
-
const unplacedFrames = unplaced.get(toolId);
|
|
321
|
-
if (unplacedFrames && unplacedFrames.length > 0) looseByTool.set(toolId, unplacedFrames);
|
|
260
|
+
const buckets = bucketAskFrames(questions, frames, new Set(unplaced.get(toolId) ?? []), optionPlacements);
|
|
261
|
+
framesByTool.set(toolId, buckets.perQuestion);
|
|
262
|
+
if (buckets.unmatched.length > 0) looseByTool.set(toolId, buckets.unmatched);
|
|
322
263
|
}
|
|
323
264
|
|
|
324
265
|
// The frame stays queued either way — only the modal waits for the history,
|
|
@@ -326,8 +267,10 @@ export function splitAskFrames(
|
|
|
326
267
|
// in BOTH states: it is answered by a card or by the orphan row, and the
|
|
327
268
|
// modal has no body for it. Anything this split already handed to an inline
|
|
328
269
|
// surface is excluded too — a dialog must never be drawn twice.
|
|
270
|
+
// A `form` frame is excluded for the same reason as `ask`: the modal has no
|
|
271
|
+
// form body, so an unclaimed one is drawn inline by the timeline.
|
|
329
272
|
const modalRequest = historyLoaded
|
|
330
|
-
? pending.find((request) => !handled.has(request) && request.method !== 'ask') ?? null
|
|
273
|
+
? pending.find((request) => !handled.has(request) && request.method !== 'ask' && request.method !== 'form') ?? null
|
|
331
274
|
: null;
|
|
332
|
-
return { framesByTool, looseByTool, orphanAsks, modalRequest };
|
|
275
|
+
return { framesByTool, looseByTool, orphanAsks, formByTool, modalRequest };
|
|
333
276
|
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Measuring the mounted window into the layout's height map.
|
|
8
|
+
*
|
|
9
|
+
* Split out of `row-window.ts` so that hook stays under the repo's per-file
|
|
10
|
+
* ceiling; the arithmetic is self-contained (DOM in, slot map out) and the
|
|
11
|
+
* subtlety it encodes is worth its own module.
|
|
12
|
+
*
|
|
13
|
+
* A row's SLOT is its wrapper PLUS the run footer that closes it. The footer is
|
|
14
|
+
* a sibling of the row GROUP — it is a model/duration stamp, not a step of the
|
|
15
|
+
* trace rail, so it cannot live inside the rail's container — which puts it
|
|
16
|
+
* outside the row's own rect. Left out of the layout, the rendered content
|
|
17
|
+
* height depended on which rows were mounted: the row at the window's edge
|
|
18
|
+
* pulled its footer in with it, the total grew by the footer's height, the tail
|
|
19
|
+
* pin followed, and the next frame's window started one row later and dropped
|
|
20
|
+
* it again — measured in Chromium at a run's settle as scrollTop 1938 → 1968 →
|
|
21
|
+
* 1938 with scrollHeight 2236 → 2266 → 2236, i.e. the reported up/down flicker
|
|
22
|
+
* at the end of a stream. The marker (`data-row-footer-for`) is set by
|
|
23
|
+
* `MessageList`; the pad then carries the footer for a row that is unmounted,
|
|
24
|
+
* exactly as it carries the row.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/** A measurement is only adopted when it differs by more than this. */
|
|
28
|
+
const MEASURE_EPSILON_PX = 0.5;
|
|
29
|
+
|
|
30
|
+
export interface RowMeasurement {
|
|
31
|
+
/** At least one slot changed by more than the epsilon. */
|
|
32
|
+
changed: boolean;
|
|
33
|
+
/** A measured row sits at or above the viewport's top, so the content ABOVE
|
|
34
|
+
* the reader moved. */
|
|
35
|
+
above: boolean;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** Read the mounted rows (and their footers) into `measured`, keyed by row id.
|
|
39
|
+
*
|
|
40
|
+
* A height survives the row being unmounted and remounted, which is what keeps
|
|
41
|
+
* the scrollbar steady — so this only ever ADDS or REFRESHES entries. */
|
|
42
|
+
export function measureRows(el: HTMLElement, measured: Map<string, number>): RowMeasurement {
|
|
43
|
+
let above = false;
|
|
44
|
+
const slots = new Map<string, number>();
|
|
45
|
+
for (const node of el.querySelectorAll<HTMLElement>('[data-row-id]')) {
|
|
46
|
+
const id = node.dataset.rowId;
|
|
47
|
+
if (!id) continue;
|
|
48
|
+
const rect = node.getBoundingClientRect();
|
|
49
|
+
const height = rect.height;
|
|
50
|
+
// A row measured while hidden reports 0; averaging it in would drag every
|
|
51
|
+
// unmeasured row toward nothing.
|
|
52
|
+
if (height <= 0) continue;
|
|
53
|
+
slots.set(id, height);
|
|
54
|
+
// A row at or above the viewport's top moves the content ABOVE the reader;
|
|
55
|
+
// the tail pin must not follow it (see `skipTailPinRef`).
|
|
56
|
+
if (rect.bottom <= 0) above = true;
|
|
57
|
+
}
|
|
58
|
+
for (const node of el.querySelectorAll<HTMLElement>('[data-row-footer-for]')) {
|
|
59
|
+
const id = node.dataset.rowFooterFor;
|
|
60
|
+
if (!id) continue;
|
|
61
|
+
// Only a mounted row has its footer on screen; an unmounted one takes the
|
|
62
|
+
// slot height recorded when it last was.
|
|
63
|
+
const height = slots.get(id);
|
|
64
|
+
if (height === undefined) continue;
|
|
65
|
+
slots.set(id, height + node.getBoundingClientRect().height);
|
|
66
|
+
}
|
|
67
|
+
let changed = false;
|
|
68
|
+
for (const [id, height] of slots) {
|
|
69
|
+
const previous = measured.get(id);
|
|
70
|
+
if (previous !== undefined && Math.abs(previous - height) <= MEASURE_EPSILON_PX) continue;
|
|
71
|
+
measured.set(id, height);
|
|
72
|
+
changed = true;
|
|
73
|
+
}
|
|
74
|
+
return { changed, above };
|
|
75
|
+
}
|