@kabmo-labs/kabmo 0.47.0 → 0.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.html +1 -1
- package/dist/client/index.js +535 -521
- package/dist/client/static/js/Body-9h5hd351.js +3 -0
- package/dist/client/static/js/{CsvGrid-vfgttmym.js → CsvGrid-s05k1q18.js} +2 -2
- package/dist/client/static/js/{DocxView-dc41t6rp.js → DocxView-x6sjw5ht.js} +22 -22
- package/dist/client/static/js/{DrawioView-wpwr38d9.js → DrawioView-jashn8sf.js} +2 -2
- package/dist/client/static/js/{HtmlPreview-23n7t5cs.js → HtmlPreview-eygzgtyc.js} +1 -1
- package/dist/client/static/js/ImageView-g50pk5pt.js +1 -0
- package/dist/client/static/js/LayoutWrapper-tag0qpts.js +2 -0
- package/dist/client/static/js/MergeDiffView-c4mb8m1w.js +1 -0
- package/dist/client/static/js/Modal-pf9p6m1k.js +59 -0
- package/dist/client/static/js/PdfView-syhjmyqf.js +1 -0
- package/dist/client/static/js/SessionsView-2r1grxxs.js +1 -0
- package/dist/client/static/js/{SheetView-n6mst0hq.js → SheetView-26r0e506.js} +45 -45
- package/dist/client/static/js/{SvgPreview-g2aqq812.js → SvgPreview-2fk85jzz.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-3vac8sq4.js → abnfDiagram-O67JEVCF-fdka7pxr.js} +1 -1
- package/dist/client/static/js/architecture-7GRP2DOG-ee9wjsht.js +1 -0
- package/dist/client/static/js/architectureDiagram-NJMV4G6O-278nx8rt.js +36 -0
- package/dist/client/static/js/{astro-63zcysj7.js → astro-rn2bvwpm.js} +1 -1
- package/dist/client/static/js/bash-36shcpcw.js +1 -0
- package/dist/client/static/js/{blockDiagram-BEXU5L5S-62z6kaar.js → blockDiagram-BEXU5L5S-vpcmd3vx.js} +9 -9
- package/dist/client/static/js/c-kxeqssf9.js +1 -0
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-rts5zgx4.js → c4Diagram-YGBWAQC7-1rgpdnbq.js} +4 -4
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-tnpww186.js → classDiagram-v2-NBCMYWYE-fbsejvb9.js} +9 -9
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-8vsjbzwa.js → cose-bilkent-JH36ORCC-ydq7mvy0.js} +1 -1
- package/dist/client/static/js/cpp-wtk1s3d7.js +1 -0
- package/dist/client/static/js/css-0a0r6rp3.js +1 -0
- package/dist/client/static/js/css-xhnrhg4e.js +1 -0
- package/dist/client/static/js/cynefin-OW5HDTMX-gs16zjqa.js +1 -0
- package/dist/client/static/js/{cynefinDiagram-VND7K2PF-005gc8km.js → cynefinDiagram-VND7K2PF-7ta5vbrw.js} +1 -1
- package/dist/client/static/js/dagre-6A5THRUB-b8gtt32x.js +4 -0
- package/dist/client/static/js/{diagram-22UHCM2B-prsm18a1.js → diagram-22UHCM2B-7emepy7h.js} +28 -28
- package/dist/client/static/js/{diagram-3UASUU5V-5nx9wf04.js → diagram-3UASUU5V-06nptkzc.js} +2 -2
- package/dist/client/static/js/{diagram-ATOU4E4O-k3d4z3aq.js → diagram-ATOU4E4O-t113exk3.js} +3 -3
- package/dist/client/static/js/{diagram-CDSNMT55-x2c5x5j2.js → diagram-CDSNMT55-pyj3x97y.js} +4 -4
- package/dist/client/static/js/{diagram-MLGK6HIB-nvr76jqh.js → diagram-MLGK6HIB-183sgpjh.js} +2 -2
- package/dist/client/static/js/{diagram-MPIPVDR6-v1jpzp9p.js → diagram-MPIPVDR6-fmbj4hcx.js} +2 -2
- package/dist/client/static/js/{dockerfile-vz6va73h.js → dockerfile-qay672za.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-0v4tqr9v.js → ebnfDiagram-ZINNZB2B-eafvfws2.js} +1 -1
- package/dist/client/static/js/{elixir-80wq7gak.js → elixir-t8bep87c.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-qfn4r7xj.js → elk-276RUBZZ-573f1vfs.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-cd667n9f.js → erDiagram-OPXOYQCR-4z1r88ej.js} +14 -14
- package/dist/client/static/js/{erlang-vk66vt7q.js → erlang-261km7r1.js} +1 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-ftz7zrz5.js +1 -0
- package/dist/client/static/js/flowDiagram-KWPJA3E3-ax0qfmp3.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-ps0h3drm.js → ganttDiagram-FUAMR5RP-49jd7msz.js} +5 -5
- package/dist/client/static/js/gitGraph-4MIJSDKK-3rtkds4s.js +1 -0
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-fts23jer.js → gitGraphDiagram-X574FWY7-5p9mgq7n.js} +26 -26
- package/dist/client/static/js/graphql-w9ajhndp.js +1 -0
- package/dist/client/static/js/html-krfbq5wp.js +1 -0
- package/dist/client/static/js/index-05n22cg9.js +4 -0
- package/dist/client/static/js/{index-fxd8dfj4.js → index-0857zpr0.js} +2 -2
- package/dist/client/static/js/{index-9ab6xaxd.js → index-0w4jqzqk.js} +2 -2
- package/dist/client/static/js/index-14dgbjsm.js +2 -0
- package/dist/client/static/js/{index-q4ke39rh.js → index-1p880x6e.js} +2 -2
- package/dist/client/static/js/{index-e5j5gc4h.js → index-1yq96wpa.js} +2 -2
- package/dist/client/static/js/{index-x0xspam4.js → index-2bf0txsp.js} +2 -2
- package/dist/client/static/js/index-2jgx68m0.js +1 -0
- package/dist/client/static/js/{index-evmcc5qh.js → index-2yzt8h3d.js} +2 -2
- package/dist/client/static/js/{index-ccgzzydx.js → index-333rq9yy.js} +1 -1
- package/dist/client/static/js/{index-9xsf8162.js → index-38g2eevc.js} +80 -80
- package/dist/client/static/js/{index-dxkefysk.js → index-3v8k8ms3.js} +1 -1
- package/dist/client/static/js/index-473hk8nb.js +10 -0
- package/dist/client/static/js/{index-5f4b44ay.js → index-4ccs971z.js} +2 -2
- package/dist/client/static/js/{index-fjex1y0t.js → index-4dnc1kys.js} +2 -2
- package/dist/client/static/js/{index-4jzsr1ky.js → index-4z5ram7g.js} +2 -2
- package/dist/client/static/js/{index-dzeyd153.js → index-5dn4159w.js} +2 -2
- package/dist/client/static/js/{index-54mkp2r2.js → index-5p8dwr4y.js} +1 -1
- package/dist/client/static/js/{index-1c2jvnyh.js → index-5ztdqm1w.js} +2 -2
- package/dist/client/static/js/{index-cra9mgkq.js → index-7dqq7cjp.js} +13 -13
- package/dist/client/static/js/{index-64p1dncg.js → index-7ff9scbm.js} +2 -2
- package/dist/client/static/js/{index-z0fkfphe.js → index-7rmps91t.js} +2 -2
- package/dist/client/static/js/{index-0dkc6z8e.js → index-80fjn77c.js} +2 -2
- package/dist/client/static/js/{index-cvyqp8nz.css → index-9wc36am3.css} +1 -1
- package/dist/client/static/js/{index-y6ke70e6.js → index-a4636gt1.js} +2 -2
- package/dist/client/static/js/{index-c63qyysm.js → index-bmaktvm2.js} +1 -1
- package/dist/client/static/js/index-bvpzzhn2.js +4 -0
- package/dist/client/static/js/{index-56rtb871.js → index-c3whkrwa.js} +58 -58
- package/dist/client/static/js/{index-7zeah164.js → index-dh060b7r.js} +2 -2
- package/dist/client/static/js/{index-hkz2mz34.js → index-dmc82cxb.js} +2 -2
- package/dist/client/static/js/index-e19dbqd3.js +2 -0
- package/dist/client/static/js/{index-g4kkapka.js → index-e8mt8rag.js} +2 -2
- package/dist/client/static/js/index-epzvftkq.js +1 -0
- package/dist/client/static/js/{index-an2wv33f.js → index-fbg5vhhw.js} +2 -2
- package/dist/client/static/js/{index-nkahe229.js → index-gaqjrzdb.js} +2 -2
- package/dist/client/static/js/index-gg910gpv.js +2 -0
- package/dist/client/static/js/{index-n1yr4khe.js → index-gr8sqjpz.js} +1 -1
- package/dist/client/static/js/{index-7zedprz3.js → index-gz7kvpnm.js} +1 -1
- package/dist/client/static/js/{index-70g527sb.js → index-h8hjcdj1.js} +2 -2
- package/dist/client/static/js/{index-4wnzs76g.js → index-j37m7pn9.js} +2 -2
- package/dist/client/static/js/{index-39d8zbkx.js → index-mbtenbyc.js} +6 -6
- package/dist/client/static/js/{index-tqgj7rd9.js → index-nbm5r9g1.js} +2 -2
- package/dist/client/static/js/{index-52nd4hgm.js → index-nzvte8s5.js} +2 -2
- package/dist/client/static/js/index-pv4z2mp2.js +463 -0
- package/dist/client/static/js/{index-c5hjht5e.js → index-pygy21w5.js} +2 -2
- package/dist/client/static/js/{index-sa1675y0.js → index-qs4n116g.js} +2 -2
- package/dist/client/static/js/{index-6d6hxwb5.js → index-qwxawph7.js} +2 -2
- package/dist/client/static/js/index-rz0tz4hg.js +1 -0
- package/dist/client/static/js/{index-gzkzwgzv.js → index-s5vegk6q.js} +2 -2
- package/dist/client/static/js/{index-xk1cqjkn.js → index-t522tpxt.js} +3 -3
- package/dist/client/static/js/{index-a4h5np9r.js → index-taev57jw.js} +2 -2
- package/dist/client/static/js/{index-dyc886cc.js → index-tb35a328.js} +2 -2
- package/dist/client/static/js/{index-396r53n0.js → index-tc6k8qt7.js} +2 -2
- package/dist/client/static/js/{index-62jgcgfd.js → index-tcfpzqb9.js} +36 -36
- package/dist/client/static/js/{index-z4530r3c.js → index-wbsvg1d9.js} +2 -2
- package/dist/client/static/js/index-xw1bptp5.js +2 -0
- package/dist/client/static/js/{index-33qxg79j.js → index-yg083mk0.js} +6 -6
- package/dist/client/static/js/{index-f2ahkev0.js → index-ykc14gez.js} +5 -5
- package/dist/client/static/js/index-yr3exz70.js +2 -0
- package/dist/client/static/js/{index-1whzs9kb.js → index-yyjw1ty9.js} +2 -2
- package/dist/client/static/js/index-z6y8j93w.js +9 -0
- package/dist/client/static/js/index-zdw8bd5t.js +2 -0
- package/dist/client/static/js/index-zp40g8ah.js +12 -0
- package/dist/client/static/js/{index-zhjjpvcc.js → index-zyefab6q.js} +1 -1
- package/dist/client/static/js/info-A6RAGUB7-vr5mxm6f.js +1 -0
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-88qbtpq5.js → infoDiagram-VRGFBTTK-xsar9j6v.js} +2 -2
- package/dist/client/static/js/ini-zx7x1jj1.js +1 -0
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-s8bagk00.js → ishikawaDiagram-OU5B5YK6-g2rvt9jp.js} +6 -6
- package/dist/client/static/js/java-bbw6kdcr.js +1 -0
- package/dist/client/static/js/javascript-p2a8rbpw.js +1 -0
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-hz8z0b9x.js → journeyDiagram-ZHPQQLJL-q95v18zc.js} +5 -5
- package/dist/client/static/js/json-zh7m2fyg.js +1 -0
- package/dist/client/static/js/jsx-3zyyt0eh.js +1 -0
- package/dist/client/static/js/{julia-dm0j9apa.js → julia-pe5vpc2m.js} +1 -1
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-sjjnjb51.js → kanban-definition-PNTS6WVX-2e7m7ds3.js} +11 -11
- package/dist/client/static/js/lua-d656k76a.js +1 -0
- package/dist/client/static/js/markdown-b5w681mm.js +1 -0
- package/dist/client/static/js/{mermaid.core-zvwygxbh.js → mermaid.core-dzajkp0g.js} +8 -8
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-kgj8enan.js → mindmap-definition-NLK3R4M7-banecvf8.js} +4 -4
- package/dist/client/static/js/one-dark-pro-z965dedc.js +1 -0
- package/dist/client/static/js/one-light-capdx801.js +1 -0
- package/dist/client/static/js/packet-AYTQ26CC-ncb5xxtn.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-gxzw1qwa.js → pegDiagram-GJSIUBJH-6erykm1c.js} +1 -1
- package/dist/client/static/js/{perl-4jcm2jxv.js → perl-cc2eqye8.js} +1 -1
- package/dist/client/static/js/{php-q32mec74.js → php-p9bvnpsv.js} +1 -1
- package/dist/client/static/js/pie-WAS4IAKB-ff8fpvc4.js +1 -0
- package/dist/client/static/js/{pieDiagram-5QR66LMP-pdqwyqcm.js → pieDiagram-5QR66LMP-jn1d905q.js} +3 -3
- package/dist/client/static/js/properties-3c6rmnqp.js +1 -0
- package/dist/client/static/js/python-a3x3zpv1.js +1 -0
- package/dist/client/static/js/{quadrantDiagram-O4NWA36T-yx2t364p.js → quadrantDiagram-O4NWA36T-sz4afnp1.js} +6 -6
- package/dist/client/static/js/r-7h3gwype.js +1 -0
- package/dist/client/static/js/radar-RG4KPBEZ-gbj4b1hf.js +1 -0
- package/dist/client/static/js/railroad-74A4TZTK-ndv5tqgr.js +1 -0
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-yjzj09s1.js +1 -0
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-e6pw7e5z.js +1 -0
- package/dist/client/static/js/railroad-peg-WCYAUIDC-9734dxy4.js +1 -0
- package/dist/client/static/js/{railroadDiagram-XR7U4H2S-800fdzkr.js → railroadDiagram-XR7U4H2S-ewzhhth2.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-vc5rpgtm.js → requirementDiagram-PLB6GJNP-fcs3xd42.js} +8 -8
- package/dist/client/static/js/{ruby-npmpb290.js → ruby-65s2ca5d.js} +1 -1
- package/dist/client/static/js/{rust-waks43wh.js → rust-ec1j2hwy.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-ccjk8zgn.js → sankeyDiagram-IPEJSGJF-2r829rjf.js} +4 -4
- package/dist/client/static/js/{sass-502a4r7y.js → sass-p6cssgq8.js} +1 -1
- package/dist/client/static/js/{scss-kvev49ga.js → scss-qfx8wt3b.js} +1 -1
- package/dist/client/static/js/sequenceDiagram-PO4LG4MO-3mnte9tv.js +169 -0
- package/dist/client/static/js/{sizeCapture-INFHLROL-fma9p1vy.js → sizeCapture-INFHLROL-r6hf9265.js} +1 -1
- package/dist/client/static/js/sql-7a5vavm0.js +1 -0
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-d8f24b7j.js → stateDiagram-v2-GCMORJYK-hm2f0wdb.js} +6 -6
- package/dist/client/static/js/{svelte-c15d0421.js → svelte-jz3a190v.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-sdt7qy36.js → swimlanes-2SLR337P-s58xzqhw.js} +1 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-z4pt2kn1.js +8 -0
- package/dist/client/static/js/{timeline-definition-EJHVYXUP-rv8qyr8b.js → timeline-definition-EJHVYXUP-ezm1c4pz.js} +8 -8
- package/dist/client/static/js/treeView-Q6P3EWNA-rs10d4p5.js +1 -0
- package/dist/client/static/js/treemap-WGGIJYW6-ey6c5x9f.js +1 -0
- package/dist/client/static/js/tsx-4a9b8tqf.js +1 -0
- package/dist/client/static/js/typescript-kas107wb.js +1 -0
- package/dist/client/static/js/{usecaseDiagram-POWQR4AR-w6ew1red.js → usecaseDiagram-POWQR4AR-ryvgs5ac.js} +48 -48
- package/dist/client/static/js/{vennDiagram-UO4OBE2U-p9axw7ch.js → vennDiagram-UO4OBE2U-rd5prsf1.js} +6 -6
- package/dist/client/static/js/{vue-xpemy62d.js → vue-rv4pea8r.js} +1 -1
- package/dist/client/static/js/wardley-WFR3VGLG-kd9swrdr.js +1 -0
- package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-5ewc8s4p.js → wardleyDiagram-VNRHLVJA-1kt8q8a4.js} +4 -4
- package/dist/client/static/js/xml-3g4bdtpa.js +1 -0
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-7n4gn7k6.js → xychartDiagram-PMCCYNJV-q39bbgq4.js} +4 -4
- package/dist/client/static/js/yaml-ktxjn917.js +1 -0
- package/package.json +1 -1
- package/src/client/components/common/MarkdownRenderer.tsx +29 -28
- package/src/client/components/common/header-controls/index.test.tsx +1 -0
- package/src/client/components/common/header-controls/phone-row.test.tsx +1 -0
- package/src/client/components/common/header-controls/plugin-entry.test.tsx +1 -0
- package/src/client/components/common/header-controls/shell-chrome.test.tsx +1 -0
- package/src/client/components/layout/ActivityBar.tsx +2 -1
- package/src/client/components/layout/LeftActivityBar.test.ts +1 -0
- package/src/client/components/settings/Modal.tsx +1 -1
- package/src/client/components/settings/Sidebar.tsx +2 -1
- package/src/client/components/settings/apply-side-effects.ts +8 -0
- package/src/client/components/settings/categories/DictationSettings.test.tsx +152 -0
- package/src/client/components/settings/categories/DictationSettings.tsx +76 -0
- package/src/client/components/settings/categories/VoiceSettings.tsx +77 -0
- package/src/client/components/settings/categories/dictation-settings/CaptureSection.tsx +153 -0
- package/src/client/components/settings/categories/dictation-settings/EngineSection.tsx +123 -0
- package/src/client/components/settings/categories/dictation-settings/ExternalSection.tsx +221 -0
- package/src/client/components/settings/categories/dictation-settings/LanguageSection.tsx +73 -0
- package/src/client/components/settings/categories/panel-plugins/InstallForm.tsx +24 -17
- package/src/client/components/settings/categories/panel-plugins/Registries.test.tsx +164 -0
- package/src/client/components/settings/categories/panel-plugins/Registries.tsx +180 -0
- package/src/client/components/settings/categories/panel-plugins/Section.tsx +15 -6
- package/src/client/components/settings/categories/usage-settings/LimitsSection.tsx +10 -3
- package/src/client/components/settings/categories/usage-settings/ProviderDetail.tsx +27 -4
- package/src/client/components/settings/categories/usage-settings/TokenHarborCard.tsx +160 -0
- package/src/client/components/settings/categories/usage-settings/TokenPortalCard.tsx +104 -0
- package/src/client/components/settings/categories/usage-settings/format.ts +35 -0
- package/src/client/components/settings/categories/usage-settings/limits-section.test.tsx +16 -0
- package/src/client/components/settings/categories/usage-settings/providers.ts +26 -4
- package/src/client/components/settings/categories/usage-settings/token-harbor-card.test.tsx +114 -0
- package/src/client/components/settings/categories/usage-settings/token-harbor-hint.test.ts +68 -0
- package/src/client/components/settings/categories/usage-settings/token-portal-card.test.tsx +81 -0
- package/src/client/components/settings/categories/usage-settings/usage-and-picker.test.ts +66 -0
- package/src/client/components/settings/categories/voice-settings/SpeechSettings.test.tsx +112 -0
- package/src/client/components/settings/categories/voice-settings/SpeechSettings.tsx +84 -0
- package/src/client/components/settings/categories/voice-settings/groups.test.ts +23 -0
- package/src/client/components/settings/categories/voice-settings/groups.ts +48 -0
- package/src/client/components/settings/categories/voice-settings/speech/AutoplaySection.tsx +49 -0
- package/src/client/components/settings/categories/voice-settings/speech/EndpointSection.tsx +161 -0
- package/src/client/components/settings/categories/voice-settings/speech/EngineSection.tsx +108 -0
- package/src/client/components/settings/categories/voice-settings/speech/TestSection.tsx +56 -0
- package/src/client/components/settings/categories/voice-settings/speech/VoiceSection.tsx +157 -0
- package/src/client/components/settings/categories/voice-settings/speech/styles.ts +15 -0
- package/src/client/components/settings/category-content.tsx +3 -0
- package/src/client/components/workspace/chat-timeline/AiMessageFooter.speech.test.tsx +140 -0
- package/src/client/components/workspace/chat-timeline/AiMessageFooter.tsx +41 -97
- package/src/client/components/workspace/chat-timeline/AiMessageFooterSheet.tsx +143 -0
- package/src/client/components/workspace/chat-timeline/MessageItem.tsx +5 -1
- package/src/client/components/workspace/chat-timeline/MessageList.tsx +1 -0
- package/src/client/components/workspace/chat-timeline/RunFooter.tsx +1 -0
- package/src/client/components/workspace/chat-timeline/SpeechButton.tsx +110 -0
- package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.test.ts +26 -10
- package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.tsx +13 -8
- package/src/client/components/workspace/chat-timeline/chat-input/AttachmentToolbar.tsx +9 -2
- package/src/client/components/workspace/chat-timeline/chat-input/ComposerRows.tsx +6 -0
- package/src/client/components/workspace/chat-timeline/chat-input/ModeToggles.tsx +18 -7
- package/src/client/components/workspace/chat-timeline/chat-input/SessionModeDropdown.tsx +4 -2
- package/src/client/components/workspace/chat-timeline/chat-input/ThinkingLevelDropdown.tsx +4 -4
- package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.tsx +19 -11
- package/src/client/components/workspace/chat-timeline/chat-input/WaitingDependencyPicker.tsx +8 -6
- package/src/client/components/workspace/chat-timeline/chat-input/index.tsx +38 -30
- package/src/client/components/workspace/chat-timeline/chat-input/narrow.test.tsx +185 -0
- package/src/client/components/workspace/chat-timeline/chat-input/paste-attach.test.tsx +194 -0
- package/src/client/components/workspace/chat-timeline/index.tsx +4 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/index.tsx +5 -11
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Bash.test.ts +10 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Edit.tsx +2 -7
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/task-rows.ts +6 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/registry.test.ts +38 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/registry.ts +10 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/DiffView.test.ts +13 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/DiffView.tsx +41 -18
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/tool-input.ts +5 -5
- package/src/client/components/workspace/editor/BodyLazy.tsx +40 -0
- package/src/client/components/workspace/editor/index.tsx +2 -2
- package/src/client/data/settings/omp-schema.json +33 -10
- package/src/client/hooks/chat/composer/attachments.ts +18 -2
- package/src/client/hooks/chat/composer/capture.test.ts +282 -0
- package/src/client/hooks/chat/composer/capture.ts +166 -0
- package/src/client/hooks/chat/composer/dictation-settings.ts +53 -0
- package/src/client/hooks/chat/composer/narrow.test.ts +130 -0
- package/src/client/hooks/chat/composer/narrow.ts +82 -0
- package/src/client/hooks/chat/composer/paste-attachments.test.ts +215 -0
- package/src/client/hooks/chat/composer/paste-attachments.ts +173 -0
- package/src/client/hooks/chat/composer/pipeline.ts +16 -3
- package/src/client/hooks/chat/composer/speech-to-text.test.tsx +314 -0
- package/src/client/hooks/chat/composer/speech-to-text.ts +158 -134
- package/src/client/hooks/chat/composer/voice-input.ts +24 -9
- package/src/client/hooks/chat/timeline/scroll.test.ts +44 -3
- package/src/client/hooks/chat/timeline/scroll.ts +31 -14
- package/src/client/hooks/chat/timeline/send-helpers.ts +3 -0
- package/src/client/hooks/chat/timeline/send.ts +5 -1
- package/src/client/hooks/settings/dictation.ts +153 -0
- package/src/client/hooks/settings/speech.ts +170 -0
- package/src/client/hooks/tts/provider.tsx +50 -0
- package/src/client/hooks/tts/tts-context.ts +39 -0
- package/src/client/hooks/tts/use-speech-autoplay.test.tsx +122 -0
- package/src/client/hooks/tts/use-speech-autoplay.ts +106 -0
- package/src/client/hooks/tts/use-tts-player.ts +33 -0
- package/src/client/hooks/ui/markdown-hydration.test.tsx +83 -0
- package/src/client/hooks/ui/markdown-hydration.ts +31 -0
- package/src/client/hooks/ui/markdown-render.ts +119 -0
- package/src/client/hooks/workspace/journal-diff.ts +8 -1
- package/src/client/hooks/workspace/panel-actions.ts +184 -0
- package/src/client/hooks/workspace/panel-registry.ts +6 -139
- package/src/client/hooks/workspace/panel-visibility-menu.ts +2 -1
- package/src/client/lib/plugins/bootstrap.test.ts +1 -0
- package/src/client/lib/tts/player.test.ts +103 -0
- package/src/client/lib/tts/player.ts +213 -0
- package/src/client/tailwind.css +11 -0
- package/src/server/lib/changes/capture-bash.server.ts +6 -3
- package/src/server/lib/changes/capture-fs.server.ts +2 -2
- package/src/server/lib/changes/capture-races.test.ts +33 -1
- package/src/server/lib/changes/capture-scan.test.ts +1 -1
- package/src/server/lib/changes/capture-test-util.ts +1 -1
- package/src/server/lib/changes/capture-types.ts +1 -1
- package/src/server/lib/changes/capture.server.ts +1 -1
- package/src/server/lib/changes/journal-read.server.ts +21 -0
- package/src/server/lib/changes/reader.server.ts +92 -14
- package/src/server/lib/changes/reader.test.ts +99 -0
- package/src/server/lib/changes/records.ts +2 -0
- package/src/server/lib/dictation/capability.server.test.ts +113 -0
- package/src/server/lib/dictation/capability.server.ts +57 -0
- package/src/server/lib/dictation/engines/adapter.ts +147 -0
- package/src/server/lib/dictation/engines/adapters.test.ts +215 -0
- package/src/server/lib/dictation/engines/deepgram.ts +77 -0
- package/src/server/lib/dictation/engines/elevenlabs.ts +44 -0
- package/src/server/lib/dictation/engines/index.ts +55 -0
- package/src/server/lib/dictation/engines/openai.ts +51 -0
- package/src/server/lib/dictation/language.server.test.ts +21 -22
- package/src/server/lib/dictation/language.server.ts +16 -19
- package/src/server/lib/dictation/omp-stt-worker.test.ts +183 -0
- package/src/server/lib/dictation/omp-stt-worker.ts +130 -78
- package/src/server/lib/dictation/settings.server.ts +74 -0
- package/src/server/lib/dictation/speech-frames.test.ts +125 -0
- package/src/server/lib/dictation/speech-frames.ts +146 -0
- package/src/server/lib/dictation/worker-process.ts +122 -0
- package/src/server/lib/harness/acp/calls.ts +20 -0
- package/src/server/lib/harness/acp/client-capabilities.ts +8 -1
- package/src/server/lib/harness/acp/client-fs.ts +17 -5
- package/src/server/lib/harness/acp/client-initialize.test.ts +32 -1
- package/src/server/lib/harness/acp/client-initialize.ts +51 -6
- package/src/server/lib/harness/acp/client-requests.ts +49 -0
- package/src/server/lib/harness/acp/client.ts +33 -36
- package/src/server/lib/harness/acp/frames-rows.test.ts +144 -0
- package/src/server/lib/harness/acp/frames-tool-shapes.test.ts +238 -0
- package/src/server/lib/harness/acp/frames-v2.test.ts +21 -0
- package/src/server/lib/harness/acp/frames.test.ts +3 -15
- package/src/server/lib/harness/acp/frames.ts +43 -67
- package/src/server/lib/harness/acp/grants.ts +20 -5
- package/src/server/lib/harness/acp/mapper.test.ts +40 -1
- package/src/server/lib/harness/acp/mapper.ts +69 -9
- package/src/server/lib/harness/acp/message-rows.ts +219 -0
- package/src/server/lib/harness/acp/prompt.ts +20 -2
- package/src/server/lib/harness/acp/protocol.ts +24 -0
- package/src/server/lib/harness/acp/replay-window.test.ts +66 -0
- package/src/server/lib/harness/acp/replay.ts +33 -8
- package/src/server/lib/harness/acp/session-addressing.test.ts +99 -0
- package/src/server/lib/harness/acp/session-approvals.ts +4 -0
- package/src/server/lib/harness/acp/session-cancel-policy.test.ts +86 -0
- package/src/server/lib/harness/acp/session-close.test.ts +89 -0
- package/src/server/lib/harness/acp/session-config.ts +8 -3
- package/src/server/lib/harness/acp/session-handshake.ts +6 -0
- package/src/server/lib/harness/acp/session-inbound.ts +126 -0
- package/src/server/lib/harness/acp/session-intake.ts +9 -2
- package/src/server/lib/harness/acp/session-lifecycle.ts +25 -0
- package/src/server/lib/harness/acp/session-notifications.ts +36 -0
- package/src/server/lib/harness/acp/session-permissions.ts +22 -1
- package/src/server/lib/harness/acp/session-requests.ts +19 -1
- package/src/server/lib/harness/acp/session-stop.ts +54 -0
- package/src/server/lib/harness/acp/session-wiring.ts +1 -0
- package/src/server/lib/harness/acp/session.test-util.ts +8 -3
- package/src/server/lib/harness/acp/session.ts +75 -75
- package/src/server/lib/harness/acp/stdio.ts +8 -1
- package/src/server/lib/harness/acp/subagent-frames.test.ts +82 -0
- package/src/server/lib/harness/acp/subagent-frames.ts +124 -0
- package/src/server/lib/harness/acp/subagents.test.ts +124 -0
- package/src/server/lib/harness/acp/subagents.ts +182 -0
- package/src/server/lib/harness/acp/tool-calls.ts +115 -45
- package/src/server/lib/harness/acp/tool-identity.test.ts +8 -0
- package/src/server/lib/harness/acp/tool-identity.ts +13 -1
- package/src/server/lib/harness/acp/tool-shape.ts +99 -0
- package/src/server/lib/harness/acp/turn.test.ts +1 -0
- package/src/server/lib/harness/acp/turn.ts +4 -1
- package/src/server/lib/harness/acp/v2.test.ts +21 -1
- package/src/server/lib/harness/acp/v2.ts +6 -1
- package/src/server/lib/lifecycle/paths.ts +22 -0
- package/src/server/lib/omp/session/changes-patch.test.ts +120 -0
- package/src/server/lib/omp/session/changes-patch.ts +190 -0
- package/src/server/lib/omp/session/changes.test.ts +55 -61
- package/src/server/lib/omp/session/changes.ts +79 -127
- package/src/server/lib/omp/session/merge-stored.ts +2 -0
- package/src/server/lib/panels/catalog-offers.server.ts +1 -1
- package/src/server/lib/panels/catalog.server.test.ts +71 -2
- package/src/server/lib/panels/catalog.server.ts +80 -0
- package/src/server/lib/panels/install.server.test.ts +15 -0
- package/src/server/lib/panels/install.server.ts +7 -0
- package/src/server/lib/panels/manifest.test.ts +1 -76
- package/src/server/lib/panels/manifest.ts +3 -60
- package/src/server/lib/panels/marketplace-catalog.server.test.ts +154 -0
- package/src/server/lib/panels/marketplace-catalog.server.ts +131 -0
- package/src/server/lib/panels/offers.server.test.ts +5 -5
- package/src/server/lib/panels/offers.server.ts +20 -2
- package/src/server/lib/panels/registries.server.test.ts +216 -0
- package/src/server/lib/panels/registries.server.ts +118 -0
- package/src/server/lib/panels/registry-cache.server.ts +104 -0
- package/src/server/lib/panels/registry-refresh.server.ts +195 -0
- package/src/server/lib/panels/registry.server.test.ts +2 -2
- package/src/server/lib/panels/registry.server.ts +19 -1
- package/src/server/lib/panels/seed.server.ts +4 -1
- package/src/server/lib/tts/engines/adapter.ts +133 -0
- package/src/server/lib/tts/engines/adapters.test.ts +129 -0
- package/src/server/lib/tts/engines/deepgram.ts +43 -0
- package/src/server/lib/tts/engines/elevenlabs.ts +53 -0
- package/src/server/lib/tts/engines/index.ts +75 -0
- package/src/server/lib/tts/engines/openai.ts +52 -0
- package/src/server/lib/tts/engines/xai.ts +44 -0
- package/src/server/lib/tts/local.server.ts +160 -0
- package/src/server/lib/tts/settings.server.ts +103 -0
- package/src/server/lib/usage/provider-key.ts +18 -0
- package/src/server/lib/usage/providers.server.ts +27 -3
- package/src/server/lib/usage/report.server.ts +24 -0
- package/src/server/lib/usage/token-harbor.test.ts +191 -0
- package/src/server/lib/usage/token-harbor.ts +207 -0
- package/src/server/lib/usage/token-portal.test.ts +140 -0
- package/src/server/lib/usage/token-portal.ts +179 -0
- package/src/server/lib/usage/vendor-http.test.ts +52 -0
- package/src/server/lib/usage/vendor-http.ts +9 -2
- package/src/server/routes/dictation/ws.ts +99 -27
- package/src/server/routes/index.ts +2 -0
- package/src/server/routes/panels/install-route.test.ts +110 -0
- package/src/server/routes/panels/install.ts +82 -3
- package/src/server/routes/sessions/index.ts +5 -0
- package/src/server/routes/sessions/local-image.test.ts +94 -0
- package/src/server/routes/sessions/local-image.ts +141 -0
- package/src/server/routes/settings/dictation.test.ts +139 -0
- package/src/server/routes/settings/dictation.ts +86 -0
- package/src/server/routes/settings/index.ts +4 -0
- package/src/server/routes/settings/speech.test.ts +156 -0
- package/src/server/routes/settings/speech.ts +98 -0
- package/src/server/routes/tts/index.ts +11 -0
- package/src/server/routes/tts/speak.test.ts +160 -0
- package/src/server/routes/tts/speak.ts +87 -0
- package/src/shared/lib/chat/attachments.ts +17 -3
- package/src/shared/lib/chat/composer/attachment-labels.test.ts +154 -0
- package/src/shared/lib/chat/composer/attachment-labels.ts +166 -0
- package/src/shared/lib/chat/omp/subagent-card-fold.test.ts +75 -0
- package/src/shared/lib/chat/timeline/changed-files.test.ts +13 -0
- package/src/shared/lib/chat/timeline/changed-files.ts +4 -2
- package/src/shared/lib/chat/timeline/local-image.test.ts +88 -0
- package/src/shared/lib/chat/timeline/local-image.ts +110 -0
- package/src/shared/lib/chat/timeline/omp-callbacks.ts +3 -2
- package/src/shared/lib/chat/timeline/run-signals.ts +2 -2
- package/src/shared/lib/chat/timeline/stream-callbacks.ts +8 -6
- package/src/shared/lib/chat/timeline/stream-coalescer.ts +7 -0
- package/src/shared/lib/chat/timeline/stream.test.ts +3 -1
- package/src/shared/lib/chat/timeline/tool-verbs.test.ts +5 -0
- package/src/shared/lib/chat/timeline/tool-verbs.ts +3 -1
- package/src/shared/lib/chat/todo/parser.test.ts +54 -0
- package/src/shared/lib/chat/todo/parser.ts +56 -0
- package/src/shared/lib/chat/tool/tool-aliases.test.ts +37 -0
- package/src/shared/lib/chat/tool/tool-aliases.ts +75 -0
- package/src/shared/lib/chat/tool/tool-input-path.test.ts +44 -0
- package/src/shared/lib/chat/tool/tool-input-path.ts +47 -0
- package/src/shared/lib/dictation/capability.ts +32 -0
- package/src/shared/lib/dictation/constraints.test.ts +41 -0
- package/src/shared/lib/dictation/constraints.ts +48 -0
- package/src/shared/lib/dictation/engines.test.ts +117 -0
- package/src/shared/lib/dictation/engines.ts +190 -0
- package/src/shared/lib/dictation/gate.test.ts +118 -0
- package/src/shared/lib/dictation/gate.ts +85 -0
- package/src/shared/lib/dictation/languages.test.ts +88 -0
- package/src/shared/lib/dictation/languages.ts +90 -0
- package/src/shared/lib/dictation/models.ts +9 -5
- package/src/shared/lib/dictation/protocol.ts +74 -34
- package/src/shared/lib/dictation/settings.test.ts +94 -0
- package/src/shared/lib/dictation/settings.ts +111 -0
- package/src/shared/lib/dictation/wav.test.ts +66 -0
- package/src/shared/lib/dictation/wav.ts +48 -0
- package/src/shared/lib/fs/journal-unavailable.test.ts +30 -0
- package/src/shared/lib/fs/journal-unavailable.ts +35 -0
- package/src/shared/lib/icons/tint-hues.generated.ts +35 -35
- package/src/shared/lib/net/base-url.test.ts +25 -0
- package/src/shared/lib/net/base-url.ts +29 -0
- package/src/shared/lib/omp/config/schema-extras.ts +9 -8
- package/src/shared/lib/omp/config/schema-releases.test.ts +22 -0
- package/src/shared/lib/omp/session/parse-message-blocks.ts +2 -2
- package/src/shared/lib/panels/plugin-repo.test.ts +113 -0
- package/src/shared/lib/panels/plugin-repo.ts +149 -0
- package/src/shared/lib/settings/defaults.ts +4 -0
- package/src/shared/lib/tts/capability.ts +16 -0
- package/src/shared/lib/tts/engines.test.ts +79 -0
- package/src/shared/lib/tts/engines.ts +313 -0
- package/src/shared/lib/tts/settings.test.ts +56 -0
- package/src/shared/lib/tts/settings.ts +108 -0
- package/src/shared/lib/tts/speakable.test.ts +76 -0
- package/src/shared/lib/tts/speakable.ts +179 -0
- package/src/shared/types/chat.ts +8 -1
- package/src/shared/types/panels-registry.ts +32 -0
- package/src/shared/types/panels.ts +23 -0
- package/src/shared/types/session-changes.ts +15 -1
- package/src/shared/types/settings/state.ts +25 -0
- package/src/shared/types/settings/usage.ts +89 -2
- package/src/test-support/pristine-globals.ts +5 -0
- package/dist/client/static/js/ImageView-mvjb3qh1.js +0 -1
- package/dist/client/static/js/LayoutWrapper-eenx0hp2.js +0 -2
- package/dist/client/static/js/Modal-dsqhas10.js +0 -59
- package/dist/client/static/js/PdfView-cpvsbfk0.js +0 -1
- package/dist/client/static/js/SessionsView-s0crtcm8.js +0 -1
- package/dist/client/static/js/architecture-7GRP2DOG-b5w9mnn5.js +0 -1
- package/dist/client/static/js/architectureDiagram-NJMV4G6O-1nh4htz2.js +0 -36
- package/dist/client/static/js/bash-hv3167gh.js +0 -1
- package/dist/client/static/js/c-acmn1zc9.js +0 -1
- package/dist/client/static/js/cpp-v2mqp8j7.js +0 -1
- package/dist/client/static/js/css-drfs4n12.js +0 -1
- package/dist/client/static/js/css-x7gyc3ta.js +0 -1
- package/dist/client/static/js/cynefin-OW5HDTMX-kdj8rjc1.js +0 -1
- package/dist/client/static/js/dagre-6A5THRUB-41zsteyd.js +0 -4
- package/dist/client/static/js/eventmodeling-NTZA5JFV-m57b7ytw.js +0 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-fasj2gxy.js +0 -1
- package/dist/client/static/js/gitGraph-4MIJSDKK-wvzsc4ph.js +0 -1
- package/dist/client/static/js/graphql-a4gbqpj9.js +0 -1
- package/dist/client/static/js/html-m0megrvb.js +0 -1
- package/dist/client/static/js/index-1d8bxjsz.js +0 -4
- package/dist/client/static/js/index-3nsrnyqr.js +0 -2
- package/dist/client/static/js/index-4x9p7hf9.js +0 -2
- package/dist/client/static/js/index-6009v8jf.js +0 -1
- package/dist/client/static/js/index-9vqkyj58.js +0 -3
- package/dist/client/static/js/index-d2xtbabt.js +0 -2
- package/dist/client/static/js/index-dxp2yvy7.js +0 -2
- package/dist/client/static/js/index-p6s3fz6b.js +0 -12
- package/dist/client/static/js/index-qtd0e38d.js +0 -1
- package/dist/client/static/js/index-x2v1zmth.js +0 -479
- package/dist/client/static/js/index-x9hfvbz6.js +0 -2
- package/dist/client/static/js/info-A6RAGUB7-ym2xevn8.js +0 -1
- package/dist/client/static/js/ini-80p6sp79.js +0 -1
- package/dist/client/static/js/java-mm2b3s9b.js +0 -1
- package/dist/client/static/js/javascript-n9w9p97f.js +0 -1
- package/dist/client/static/js/json-fzy76fkw.js +0 -1
- package/dist/client/static/js/jsx-c7v2f8s7.js +0 -1
- package/dist/client/static/js/lua-ppfdxrmv.js +0 -1
- package/dist/client/static/js/markdown-xed7y3ds.js +0 -1
- package/dist/client/static/js/one-dark-pro-mq6sn6a2.js +0 -1
- package/dist/client/static/js/one-light-pt6t6vax.js +0 -1
- package/dist/client/static/js/packet-AYTQ26CC-01vcsy6x.js +0 -1
- package/dist/client/static/js/pie-WAS4IAKB-053gzkmh.js +0 -1
- package/dist/client/static/js/properties-8ysbq2n2.js +0 -1
- package/dist/client/static/js/python-4ysexc8s.js +0 -1
- package/dist/client/static/js/r-hrsw5arc.js +0 -1
- package/dist/client/static/js/radar-RG4KPBEZ-bkpby8am.js +0 -1
- package/dist/client/static/js/railroad-74A4TZTK-67bxrjgw.js +0 -1
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-xj9ymacg.js +0 -1
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-2xxpbnf6.js +0 -1
- package/dist/client/static/js/railroad-peg-WCYAUIDC-78w88znz.js +0 -1
- package/dist/client/static/js/sequenceDiagram-PO4LG4MO-c0tk7gfn.js +0 -169
- package/dist/client/static/js/sql-hd42h8wx.js +0 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-rz309qrx.js +0 -8
- package/dist/client/static/js/treeView-Q6P3EWNA-g2bkjr4z.js +0 -1
- package/dist/client/static/js/treemap-WGGIJYW6-pj7yw9rw.js +0 -1
- package/dist/client/static/js/tsx-xjp2ds8g.js +0 -1
- package/dist/client/static/js/typescript-yg97da8h.js +0 -1
- package/dist/client/static/js/wardley-WFR3VGLG-c7ekf8r2.js +0 -1
- package/dist/client/static/js/xml-nrb23phz.js +0 -1
- package/dist/client/static/js/yaml-sqs6pjpx.js +0 -1
|
@@ -5,33 +5,41 @@
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Composer dictation: capture the browser's microphone, hand the utterance to
|
|
8
|
-
* Kabmo's dictation socket, and insert what
|
|
8
|
+
* Kabmo's dictation socket, and insert what the configured engine returns.
|
|
9
9
|
*
|
|
10
|
-
* Audio is captured as raw PCM16LE mono @16 kHz — the rate
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
10
|
+
* Audio is captured as raw PCM16LE mono @16 kHz — the rate every engine takes —
|
|
11
|
+
* and sent as ONE binary frame on release. The engine, the language and the
|
|
12
|
+
* model are fixed before recording starts and travel in the socket's query
|
|
13
|
+
* string, so the server can refuse an unusable combination at the upgrade rather
|
|
14
|
+
* than after a minute of audio.
|
|
14
15
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
16
|
+
* Two local refusals happen BEFORE the round trip, because both are cheaper to
|
|
17
|
+
* answer here and both otherwise produce text nobody said: a recording shorter
|
|
18
|
+
* than `minMs`, and one whose level never rises above the silence floor (a
|
|
19
|
+
* ~100 ms tap is the classic input for a Whisper "Thank you." hallucination).
|
|
20
|
+
* A third refusal names a dead capture — every sample exactly zero — because
|
|
21
|
+
* that is a microphone that never delivered, not a user who spoke softly; the
|
|
22
|
+
* device side of it, including the macOS constraints that keep the capture
|
|
23
|
+
* alive, is `capture.ts`.
|
|
20
24
|
*/
|
|
21
25
|
|
|
22
26
|
import { useCallback, useEffect, useRef, useState } from 'preact/hooks';
|
|
27
|
+
import { openCapture, type DictationCapture } from '@/client/hooks/chat/composer/capture';
|
|
23
28
|
import { concatSamples, float32ToPcm16 } from '@/shared/lib/dictation/audio';
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
|
|
29
|
+
import { DICTATION_NO_AUDIO, isDeadCapture, isSilent, utteranceMs } from '@/shared/lib/dictation/gate';
|
|
30
|
+
import {
|
|
31
|
+
DICTATION_SAMPLE_RATE,
|
|
32
|
+
decodeDictationServerFrame,
|
|
33
|
+
dictationSocketPath,
|
|
34
|
+
type DictationRequest,
|
|
35
|
+
} from '@/shared/lib/dictation/protocol';
|
|
36
|
+
import type { DictationConfig } from '@/shared/lib/dictation/settings';
|
|
27
37
|
|
|
28
38
|
export interface UseSpeechToTextOptions {
|
|
29
39
|
/** Called with the final transcript. */
|
|
30
40
|
onResult: (text: string) => void;
|
|
31
|
-
/**
|
|
32
|
-
|
|
33
|
-
/** BCP 47 tag (`id-ID`, `en-US`). Omitted lets the model auto-detect. */
|
|
34
|
-
language?: string;
|
|
41
|
+
/** The stored preference; read live so a settings edit applies next time. */
|
|
42
|
+
config: DictationConfig;
|
|
35
43
|
}
|
|
36
44
|
|
|
37
45
|
export interface UseSpeechToTextReturn {
|
|
@@ -48,51 +56,45 @@ export interface UseSpeechToTextReturn {
|
|
|
48
56
|
error: string | null;
|
|
49
57
|
}
|
|
50
58
|
|
|
51
|
-
/**
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
+
/** A pending timer; the handle differs between the DOM and Bun typings. */
|
|
60
|
+
type CaptureTimer = ReturnType<typeof setTimeout>;
|
|
61
|
+
|
|
62
|
+
/** The socket path for this config: engine, language and model, no audio. */
|
|
63
|
+
export function dictationRequestFor(config: DictationConfig): DictationRequest {
|
|
64
|
+
return {
|
|
65
|
+
engine: config.engine,
|
|
66
|
+
language: config.language,
|
|
67
|
+
...(config.model.trim() ? { model: config.model.trim() } : {}),
|
|
68
|
+
};
|
|
59
69
|
}
|
|
60
70
|
|
|
61
|
-
function dictationUrl(): string {
|
|
71
|
+
function dictationUrl(request: DictationRequest): string {
|
|
62
72
|
const scheme = location.protocol === 'https:' ? 'wss:' : 'ws:';
|
|
63
|
-
return `${scheme}//${location.host}
|
|
73
|
+
return `${scheme}//${location.host}${dictationSocketPath(request)}`;
|
|
64
74
|
}
|
|
65
75
|
|
|
66
|
-
export function useSpeechToText({ onResult,
|
|
76
|
+
export function useSpeechToText({ onResult, config }: UseSpeechToTextOptions): UseSpeechToTextReturn {
|
|
67
77
|
const [isListening, setIsListening] = useState(false);
|
|
68
78
|
const [isTranscribing, setIsTranscribing] = useState(false);
|
|
69
79
|
const [progressText, setProgressText] = useState<string | null>(null);
|
|
70
80
|
const [error, setError] = useState<string | null>(null);
|
|
71
81
|
|
|
72
|
-
const
|
|
73
|
-
const contextRef = useRef<AudioContext | null>(null);
|
|
74
|
-
const sourceRef = useRef<MediaStreamAudioSourceNode | null>(null);
|
|
75
|
-
const processorRef = useRef<ScriptProcessorNode | null>(null);
|
|
76
|
-
const chunksRef = useRef<Float32Array[]>([]);
|
|
77
|
-
const inputRateRef = useRef(DICTATION_SAMPLE_RATE);
|
|
82
|
+
const captureRef = useRef<DictationCapture | null>(null);
|
|
78
83
|
const socketRef = useRef<WebSocket | null>(null);
|
|
84
|
+
const autoStopRef = useRef<CaptureTimer | undefined>(undefined);
|
|
85
|
+
/** Set by `stopListening` below; the auto-stop timer needs a stable seam. */
|
|
86
|
+
const stopListeningRef = useRef<(() => void) | null>(null);
|
|
79
87
|
|
|
80
88
|
const isSupported =
|
|
81
89
|
typeof navigator !== 'undefined' && typeof navigator.mediaDevices?.getUserMedia === 'function';
|
|
82
90
|
|
|
83
91
|
/** Stop capturing and release the microphone; returns the recorded samples. */
|
|
84
92
|
const releaseCapture = useCallback((): Float32Array[] => {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
contextRef.current = null;
|
|
91
|
-
for (const track of streamRef.current?.getTracks() ?? []) track.stop();
|
|
92
|
-
streamRef.current = null;
|
|
93
|
-
const chunks = chunksRef.current;
|
|
94
|
-
chunksRef.current = [];
|
|
95
|
-
return chunks;
|
|
93
|
+
clearTimeout(autoStopRef.current);
|
|
94
|
+
autoStopRef.current = undefined;
|
|
95
|
+
const capture = captureRef.current;
|
|
96
|
+
captureRef.current = null;
|
|
97
|
+
return capture?.release() ?? [];
|
|
96
98
|
}, []);
|
|
97
99
|
|
|
98
100
|
const fail = useCallback(
|
|
@@ -108,105 +110,127 @@ export function useSpeechToText({ onResult, modelKey, language }: UseSpeechToTex
|
|
|
108
110
|
[releaseCapture],
|
|
109
111
|
);
|
|
110
112
|
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
navigator.mediaDevices
|
|
118
|
-
.getUserMedia({ audio: true })
|
|
119
|
-
.then((stream) => {
|
|
120
|
-
streamRef.current = stream;
|
|
121
|
-
try {
|
|
122
|
-
const context = new AudioContext({ sampleRate: DICTATION_SAMPLE_RATE });
|
|
123
|
-
contextRef.current = context;
|
|
124
|
-
inputRateRef.current = context.sampleRate;
|
|
125
|
-
|
|
126
|
-
const source = context.createMediaStreamSource(stream);
|
|
127
|
-
sourceRef.current = source;
|
|
128
|
-
const processor = context.createScriptProcessor(4096, 1, 1);
|
|
129
|
-
processorRef.current = processor;
|
|
130
|
-
processor.onaudioprocess = (event) => {
|
|
131
|
-
chunksRef.current.push(new Float32Array(event.inputBuffer.getChannelData(0)));
|
|
132
|
-
};
|
|
133
|
-
source.connect(processor);
|
|
134
|
-
processor.connect(context.destination);
|
|
135
|
-
setIsListening(true);
|
|
136
|
-
} catch {
|
|
137
|
-
// The microphone IS open at this point, so the failure is the audio
|
|
138
|
-
// graph, not the permission — and the stream has to be released or
|
|
139
|
-
// the OS keeps showing the microphone in use.
|
|
140
|
-
fail('Could not start audio capture.');
|
|
141
|
-
}
|
|
142
|
-
})
|
|
143
|
-
.catch((cause: unknown) => {
|
|
144
|
-
setError(describeCaptureFailure(cause));
|
|
145
|
-
});
|
|
146
|
-
}, [fail, isSupported]);
|
|
147
|
-
|
|
148
|
-
const stopListening = useCallback(() => {
|
|
149
|
-
setIsListening(false);
|
|
150
|
-
const chunks = releaseCapture();
|
|
151
|
-
if (chunks.length === 0) return;
|
|
152
|
-
|
|
153
|
-
const samples = concatSamples(chunks);
|
|
154
|
-
if (samples.length === 0) return;
|
|
155
|
-
const pcm16 = float32ToPcm16(samples, inputRateRef.current, DICTATION_SAMPLE_RATE);
|
|
156
|
-
const audio = toBase64(new Uint8Array(pcm16.buffer, pcm16.byteOffset, pcm16.byteLength));
|
|
157
|
-
|
|
158
|
-
setIsTranscribing(true);
|
|
159
|
-
setProgressText('Transcribing…');
|
|
160
|
-
|
|
161
|
-
const socket = new WebSocket(dictationUrl());
|
|
162
|
-
socketRef.current = socket;
|
|
113
|
+
const send = useCallback(
|
|
114
|
+
(chunks: Float32Array[], inputRate: number) => {
|
|
115
|
+
const samples = concatSamples(chunks);
|
|
116
|
+
const pcm16 = float32ToPcm16(samples, inputRate, DICTATION_SAMPLE_RATE);
|
|
117
|
+
const bytes = new Uint8Array(pcm16.buffer, pcm16.byteOffset, pcm16.byteLength);
|
|
163
118
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
socket.onmessage = (event) => {
|
|
169
|
-
let frame: DictationServerFrame;
|
|
170
|
-
try {
|
|
171
|
-
frame = JSON.parse(String(event.data)) as DictationServerFrame;
|
|
172
|
-
} catch {
|
|
119
|
+
if (utteranceMs(bytes.byteLength) < config.minMs) {
|
|
120
|
+
fail(`That was too short to transcribe (under ${config.minMs} ms).`);
|
|
173
121
|
return;
|
|
174
122
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
? 'Transcribing…'
|
|
180
|
-
: frame.percent !== null
|
|
181
|
-
? `Downloading speech model ${frame.percent}%`
|
|
182
|
-
: 'Downloading speech model…',
|
|
183
|
-
);
|
|
123
|
+
// Before the silence floor: bit-exact zeros are a capture that delivered
|
|
124
|
+
// nothing (a track WebKit ended, a muted device), not a quiet speaker.
|
|
125
|
+
if (isDeadCapture(bytes)) {
|
|
126
|
+
fail(DICTATION_NO_AUDIO);
|
|
184
127
|
return;
|
|
185
128
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
setProgressText(null);
|
|
189
|
-
setIsTranscribing(false);
|
|
190
|
-
socket.close();
|
|
191
|
-
socketRef.current = null;
|
|
192
|
-
onResult(frame.text);
|
|
129
|
+
if (isSilent(bytes)) {
|
|
130
|
+
fail('No speech was detected in that recording.');
|
|
193
131
|
return;
|
|
194
132
|
}
|
|
195
133
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
134
|
+
setIsTranscribing(true);
|
|
135
|
+
setProgressText('Transcribing…');
|
|
136
|
+
|
|
137
|
+
const socket = new WebSocket(dictationUrl(dictationRequestFor(config)));
|
|
138
|
+
socketRef.current = socket;
|
|
139
|
+
socket.binaryType = 'arraybuffer';
|
|
140
|
+
|
|
141
|
+
socket.onopen = () => {
|
|
142
|
+
// A copy: the buffer is a view over the resampled array and Bun's
|
|
143
|
+
// serializer wants an owned frame.
|
|
144
|
+
socket.send(bytes.slice().buffer);
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
socket.onmessage = (event) => {
|
|
148
|
+
const frame = decodeDictationServerFrame(event.data);
|
|
149
|
+
if (!frame) return;
|
|
150
|
+
|
|
151
|
+
if (frame.type === 'progress') {
|
|
152
|
+
setProgressText(
|
|
153
|
+
frame.decoding
|
|
154
|
+
? 'Transcribing…'
|
|
155
|
+
: frame.percent !== null
|
|
156
|
+
? `Downloading speech model ${frame.percent}%`
|
|
157
|
+
: 'Downloading speech model…',
|
|
158
|
+
);
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (frame.type === 'final') {
|
|
163
|
+
setProgressText(null);
|
|
164
|
+
setIsTranscribing(false);
|
|
165
|
+
socket.close();
|
|
166
|
+
socketRef.current = null;
|
|
167
|
+
onResult(frame.text);
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (frame.type === 'error') {
|
|
172
|
+
fail(frame.error);
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
socket.onerror = () => {
|
|
177
|
+
if (socketRef.current === socket) fail('Could not reach the dictation service.');
|
|
178
|
+
};
|
|
200
179
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
180
|
+
socket.onclose = () => {
|
|
181
|
+
// A close before a final/error frame means the transcription never landed.
|
|
182
|
+
if (socketRef.current === socket) fail('The dictation connection closed unexpectedly.');
|
|
183
|
+
};
|
|
184
|
+
},
|
|
185
|
+
[config, fail, onResult],
|
|
186
|
+
);
|
|
204
187
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
188
|
+
const startListening = useCallback(() => {
|
|
189
|
+
if (!isSupported) return;
|
|
190
|
+
setError(null);
|
|
191
|
+
setProgressText(null);
|
|
192
|
+
|
|
193
|
+
void openCapture(config.deviceId, fail, { onDead: () => fail(DICTATION_NO_AUDIO) }).then(
|
|
194
|
+
(capture) => {
|
|
195
|
+
if (!capture) return;
|
|
196
|
+
captureRef.current = capture;
|
|
197
|
+
setIsListening(true);
|
|
198
|
+
|
|
199
|
+
// A recording nobody stops would grow until the browser kills it.
|
|
200
|
+
autoStopRef.current = setTimeout(() => {
|
|
201
|
+
autoStopRef.current = undefined;
|
|
202
|
+
stopListeningRef.current?.();
|
|
203
|
+
}, config.maxMs);
|
|
204
|
+
},
|
|
205
|
+
);
|
|
206
|
+
}, [config.deviceId, config.maxMs, fail, isSupported]);
|
|
207
|
+
|
|
208
|
+
// The auto-stop timer is armed inside `startListening`, which must not depend
|
|
209
|
+
// on `stopListening` (it would re-create the callback on every render and
|
|
210
|
+
// restart the timer). One ref is the seam.
|
|
211
|
+
const stopListening = useCallback(() => {
|
|
212
|
+
setIsListening(false);
|
|
213
|
+
const capture = captureRef.current;
|
|
214
|
+
captureRef.current = null;
|
|
215
|
+
clearTimeout(autoStopRef.current);
|
|
216
|
+
autoStopRef.current = undefined;
|
|
217
|
+
if (!capture) return;
|
|
218
|
+
const inputRate = capture.inputRate();
|
|
219
|
+
const chunks = capture.release();
|
|
220
|
+
// No callback ran at all, so the recording ended inside the first 85 ms
|
|
221
|
+
// buffer — necessarily under `minMs`. A dead capture is NOT this case: it
|
|
222
|
+
// still runs callbacks (measured 11 in 1.2 s) and is refused by the gate in
|
|
223
|
+
// `send`, so this cannot mask it.
|
|
224
|
+
if (chunks.length === 0) {
|
|
225
|
+
fail(`That was too short to transcribe (under ${config.minMs} ms).`);
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
send(chunks, inputRate);
|
|
229
|
+
}, [config.minMs, fail, send]);
|
|
230
|
+
|
|
231
|
+
useEffect(() => {
|
|
232
|
+
stopListeningRef.current = stopListening;
|
|
233
|
+
}, [stopListening]);
|
|
210
234
|
|
|
211
235
|
useEffect(
|
|
212
236
|
() => () => {
|
|
@@ -8,13 +8,19 @@
|
|
|
8
8
|
* notice, and the status line the composer shows while a first-run model
|
|
9
9
|
* download is still in flight.
|
|
10
10
|
*
|
|
11
|
-
* It deliberately does NOT write into the textarea.
|
|
12
|
-
*
|
|
13
|
-
* text appears once, when the utterance is transcribed.
|
|
11
|
+
* It deliberately does NOT write into the textarea. No engine streams here —
|
|
12
|
+
* omp's is not incremental, and the hosted ones return one transcript per
|
|
13
|
+
* request — so the text appears once, when the utterance is transcribed.
|
|
14
|
+
*
|
|
15
|
+
* The preference comes from `useDictationConfig`, which is live: the settings
|
|
16
|
+
* modal announces an edit and the next utterance uses it, without a reload.
|
|
14
17
|
*/
|
|
15
18
|
|
|
16
19
|
import { useEffect, useState } from 'preact/hooks';
|
|
17
20
|
import { useSpeechToText } from '@/client/hooks/chat/composer/speech-to-text';
|
|
21
|
+
import { useDictationConfig } from '@/client/hooks/chat/composer/dictation-settings';
|
|
22
|
+
import { dictationEngine } from '@/shared/lib/dictation/engines';
|
|
23
|
+
import { resolveDictationTag } from '@/shared/lib/dictation/languages';
|
|
18
24
|
|
|
19
25
|
export interface UseVoiceInputReturn {
|
|
20
26
|
/** Whether the browser can capture audio. */
|
|
@@ -26,12 +32,15 @@ export interface UseVoiceInputReturn {
|
|
|
26
32
|
/** Status line while busy ("Downloading speech model 42%"). */
|
|
27
33
|
voiceStatus: string | null;
|
|
28
34
|
/** Toggle recording on/off. The mic button's `onClick`. */
|
|
29
|
-
|
|
30
|
-
/**
|
|
35
|
+
voiceToggle: () => void;
|
|
36
|
+
/** Tooltip: engine and the language this utterance will be decoded as. */
|
|
37
|
+
voiceHint: string;
|
|
38
|
+
/** Non-null while a dictation error should be shown. Clears after 8 s. */
|
|
31
39
|
displayedVoiceError: string | null;
|
|
32
40
|
}
|
|
33
41
|
|
|
34
42
|
export function useVoiceInput(onResult: (text: string) => void): UseVoiceInputReturn {
|
|
43
|
+
const config = useDictationConfig();
|
|
35
44
|
const {
|
|
36
45
|
isSupported: voiceSupported,
|
|
37
46
|
isListening: voiceListening,
|
|
@@ -40,9 +49,9 @@ export function useVoiceInput(onResult: (text: string) => void): UseVoiceInputRe
|
|
|
40
49
|
startListening,
|
|
41
50
|
stopListening,
|
|
42
51
|
error: voiceError,
|
|
43
|
-
} = useSpeechToText({ onResult });
|
|
52
|
+
} = useSpeechToText({ onResult, config });
|
|
44
53
|
|
|
45
|
-
const
|
|
54
|
+
const voiceToggle = () => {
|
|
46
55
|
if (voiceListening) {
|
|
47
56
|
stopListening();
|
|
48
57
|
} else if (!voiceBusy) {
|
|
@@ -56,16 +65,22 @@ export function useVoiceInput(onResult: (text: string) => void): UseVoiceInputRe
|
|
|
56
65
|
useEffect(() => {
|
|
57
66
|
if (!voiceError) return;
|
|
58
67
|
setDisplayedVoiceError(voiceError);
|
|
59
|
-
const timer = setTimeout(() => setDisplayedVoiceError(null),
|
|
68
|
+
const timer = setTimeout(() => setDisplayedVoiceError(null), 8000);
|
|
60
69
|
return () => clearTimeout(timer);
|
|
61
70
|
}, [voiceError]);
|
|
62
71
|
|
|
72
|
+
const languageTag = resolveDictationTag(config.engine, config.language);
|
|
73
|
+
const voiceHint = `${dictationEngine(config.engine).label} — ${
|
|
74
|
+
languageTag ?? 'detected per utterance'
|
|
75
|
+
}`;
|
|
76
|
+
|
|
63
77
|
return {
|
|
64
78
|
voiceSupported,
|
|
65
79
|
voiceListening,
|
|
66
80
|
voiceBusy,
|
|
67
81
|
voiceStatus: voiceBusy ? progressText : null,
|
|
68
|
-
|
|
82
|
+
voiceToggle,
|
|
83
|
+
voiceHint,
|
|
69
84
|
displayedVoiceError,
|
|
70
85
|
};
|
|
71
86
|
}
|
|
@@ -49,8 +49,10 @@ describe('timeline scroll', () => {
|
|
|
49
49
|
await p.updateProbe(probe, 'a', [p.message('a1'), p.message('a2')]);
|
|
50
50
|
expect(probe.el.scrollTop).toBe(p.geometry.height - p.geometry.viewport);
|
|
51
51
|
|
|
52
|
-
// The user reads back —
|
|
53
|
-
//
|
|
52
|
+
// The user reads back — a wheel is what makes the upward move THEIRS (see
|
|
53
|
+
// `handleScroll`: a layout correction may not take the viewport back).
|
|
54
|
+
// Follow disengages, and that state outlives the session it was set in.
|
|
55
|
+
await p.act(() => { probe.el.dispatchEvent(new Event('wheel')); });
|
|
54
56
|
probe.el.scrollTop = 100;
|
|
55
57
|
expect(scroll().followRef.current).toBe(false);
|
|
56
58
|
|
|
@@ -99,6 +101,43 @@ describe('timeline scroll', () => {
|
|
|
99
101
|
await p.unmountProbe(probe);
|
|
100
102
|
});
|
|
101
103
|
|
|
104
|
+
test('a layout correction may not stop the stream from following', async () => {
|
|
105
|
+
p.scrolled.length = 0;
|
|
106
|
+
p.geometry.top = 0;
|
|
107
|
+
p.geometry.height = 5000;
|
|
108
|
+
p.geometry.viewport = 500;
|
|
109
|
+
const probe = await p.mountProbe('a', [p.message('a1')]);
|
|
110
|
+
const scroll = () => probe.holder.current!;
|
|
111
|
+
|
|
112
|
+
// Pinned to the tail, no jump in flight: the state a running stream is in.
|
|
113
|
+
await p.act(() => { scroll().jumpToBottom('instant'); });
|
|
114
|
+
await p.act(() => { probe.el.scrollTo({ top: p.geometry.height, behavior: 'instant' }); });
|
|
115
|
+
await p.flushFrames(6);
|
|
116
|
+
expect(scroll().followRef.current).toBe(true);
|
|
117
|
+
expect(scroll().jumpActiveRef.current).toBe(false);
|
|
118
|
+
|
|
119
|
+
// The row window measured a row ABOVE the viewport 300 px shorter than its
|
|
120
|
+
// estimate, so the anchor correction moved the viewport UP with nobody
|
|
121
|
+
// behind it. Read as the reader taking the viewport back, that turned
|
|
122
|
+
// `follow` off for the rest of the run — the reported "the stream stops
|
|
123
|
+
// scrolling and I have to scroll down myself". No wheel, no touch: it is
|
|
124
|
+
// not the reader's.
|
|
125
|
+
probe.el.scrollTop = p.geometry.height - p.geometry.viewport - 300;
|
|
126
|
+
expect(scroll().followRef.current).toBe(true);
|
|
127
|
+
|
|
128
|
+
// The next chunk still lands the tail.
|
|
129
|
+
p.scrolled.length = 0;
|
|
130
|
+
await p.act(() => { scroll().scrollToBottom('instant'); });
|
|
131
|
+
expect(p.scrolled.length).toBe(1);
|
|
132
|
+
expect(probe.el.scrollTop).toBe(p.geometry.height - p.geometry.viewport);
|
|
133
|
+
|
|
134
|
+
// The reader's own upward move is the one that still disengages it.
|
|
135
|
+
await p.act(() => { probe.el.dispatchEvent(new Event('wheel')); });
|
|
136
|
+
probe.el.scrollTop = 100;
|
|
137
|
+
expect(scroll().followRef.current).toBe(false);
|
|
138
|
+
await p.unmountProbe(probe);
|
|
139
|
+
});
|
|
140
|
+
|
|
102
141
|
test('the jump guard releases when the landing SETTLES, not on a clock', async () => {
|
|
103
142
|
p.scrolled.length = 0;
|
|
104
143
|
p.geometry.top = 0;
|
|
@@ -193,7 +232,9 @@ describe('timeline scroll', () => {
|
|
|
193
232
|
expect(p.scrolled[0].behavior).toBe('instant');
|
|
194
233
|
expect(probe.el.scrollTop).toBe(p.geometry.height - p.geometry.viewport);
|
|
195
234
|
|
|
196
|
-
// Reading back: the same growth must
|
|
235
|
+
// Reading back (a wheel, then the viewport moves up): the same growth must
|
|
236
|
+
// leave the viewport alone.
|
|
237
|
+
await p.act(() => { probe.el.dispatchEvent(new Event('wheel')); });
|
|
197
238
|
probe.el.scrollTop = 400;
|
|
198
239
|
p.scrolled.length = 0;
|
|
199
240
|
p.geometry.height += 800;
|
|
@@ -15,11 +15,24 @@
|
|
|
15
15
|
* shows the button without a single scroll event.
|
|
16
16
|
*
|
|
17
17
|
* Streaming auto-scroll is stick-to-bottom: `scrollToBottom` only actually
|
|
18
|
-
* moves the viewport while `follow` is engaged
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* moves the viewport while `follow` is engaged, and it writes INSTANTLY — a
|
|
19
|
+
* smooth write re-issued every frame cannot catch a tail that is still growing
|
|
20
|
+
* (measured in Chromium: one line per frame left the viewport 3 120 px behind
|
|
21
|
+
* after 120 frames, while `instant` stayed at 0). The reader scrolling away
|
|
22
|
+
* from the tail disengages it (the scroll fight is gone — they can read while
|
|
23
|
+
* the AI generates); scrolling back near the tail, or clicking the scroll-bottom
|
|
21
24
|
* button, re-engages it. Programmatic jumps (`scrollTo`) never flip the mode.
|
|
22
25
|
*
|
|
26
|
+
* Only the READER'S OWN INPUT disengages it — a wheel, a finger, a pointer, a
|
|
27
|
+
* key (see `reader-input.ts`). An upward `scrollTop` alone is not evidence: the
|
|
28
|
+
* row window's anchor correction (a row above the viewport measured shorter
|
|
29
|
+
* than its estimate) moves the viewport up with nobody behind it, and read as
|
|
30
|
+
* intent it turned `follow` off for the REST OF THE RUN — the reported "the
|
|
31
|
+
* stream stopped scrolling and I had to scroll down myself". Nothing re-engages
|
|
32
|
+
* the flag except a scroll that lands back within the threshold, and the tail
|
|
33
|
+
* was already running away. (A browser CLAMP is harmless by comparison: it
|
|
34
|
+
* leaves the viewport at the tail, so the same handler re-engages it.)
|
|
35
|
+
*
|
|
23
36
|
* `jumpToBottom` is the unconditional bypass (`follow` is re-engaged, geometry
|
|
24
37
|
* is re-baselined, and the paging trigger stands down until the landing
|
|
25
38
|
* settles) — the button's jump, the open-session jump, and the send jump all
|
|
@@ -61,9 +74,10 @@ const FOLLOW_BOTTOM_THRESHOLD_PX = 100;
|
|
|
61
74
|
const COMPACT_TRIGGER_PX = FOLLOW_BOTTOM_THRESHOLD_PX + 64;
|
|
62
75
|
|
|
63
76
|
/** How long after a wheel/touch/pointer/key event an upward scroll still
|
|
64
|
-
* counts as the READER's.
|
|
65
|
-
*
|
|
66
|
-
*
|
|
77
|
+
* counts as the READER's. A layout clamp moves `scrollTop` up with nobody
|
|
78
|
+
* behind it, and treating that as the reader taking the viewport back is what
|
|
79
|
+
* cancelled a jump mid-flight — and what silently stopped the stream's
|
|
80
|
+
* auto-scroll for the rest of a run. */
|
|
67
81
|
const READER_INPUT_WINDOW_MS = 600;
|
|
68
82
|
|
|
69
83
|
export interface ChatTimelineScrollOptions {
|
|
@@ -227,14 +241,17 @@ export function useChatTimelineScroll(options: ChatTimelineScrollOptions = {}):
|
|
|
227
241
|
// mid-animation as content outgrows the animation. Re-engage whenever
|
|
228
242
|
// the viewport is back near the tail, whichever way it got there.
|
|
229
243
|
if (el.scrollTop < lastScrollTopRef.current - 1) {
|
|
230
|
-
// An upward move is not automatically the reader's: the row window
|
|
231
|
-
//
|
|
232
|
-
//
|
|
233
|
-
//
|
|
234
|
-
//
|
|
235
|
-
//
|
|
236
|
-
|
|
237
|
-
|
|
244
|
+
// An upward move is not automatically the reader's: the row window's
|
|
245
|
+
// anchor correction writes the reader's row back after a row ABOVE the
|
|
246
|
+
// viewport was measured shorter than its estimate. While a jump is
|
|
247
|
+
// landing that move used to cancel the jump outright — the animation
|
|
248
|
+
// stopped mid-flight and only the next click reached the tail. OUTSIDE a
|
|
249
|
+
// jump it was worse and quieter: a correction larger than the follow
|
|
250
|
+
// threshold turned `follow` off for the rest of the run, so the stream
|
|
251
|
+
// stopped moving the viewport and only a manual scroll to the tail (or
|
|
252
|
+
// the button) brought it back. Only the reader's own input takes the
|
|
253
|
+
// viewport back; a layout correction never does.
|
|
254
|
+
if (performance.now() - readerInputAtRef.current < READER_INPUT_WINDOW_MS) {
|
|
238
255
|
followRef.current = false;
|
|
239
256
|
jumpActiveRef.current = false;
|
|
240
257
|
}
|
|
@@ -51,6 +51,9 @@ export function buildOptimisticRows(args: {
|
|
|
51
51
|
content: text,
|
|
52
52
|
attachments: attachments.map((a) => ({
|
|
53
53
|
name: attachmentName(a),
|
|
54
|
+
// A pasted filename the user edited in the draft is the display name;
|
|
55
|
+
// the file's own name is what classification reads on retry.
|
|
56
|
+
...(a.sourceName ? { sourceName: a.sourceName } : {}),
|
|
54
57
|
// The blob URL only lives as long as this page, so the data URL wins
|
|
55
58
|
// where it exists — a persisted turn re-renders its images from it.
|
|
56
59
|
preview: a.dataBase64 ? `data:${attachmentType(a)};base64,${a.dataBase64}` : a.preview,
|
|
@@ -180,7 +180,11 @@ export function useChatTimelineSend(deps: ChatTimelineSendDeps): ChatTimelineSen
|
|
|
180
180
|
setGeneratingVerb(PHASE_VERBS.thinking);
|
|
181
181
|
// An explicit send is user intent to watch the answer: re-engage follow
|
|
182
182
|
// mode even if the user had scrolled away, then scroll to the tail.
|
|
183
|
-
|
|
183
|
+
// INSTANT, like the session-open jump: the first stream chunk lands inside
|
|
184
|
+
// the 50 ms delay, and its own follow write is instant — a smooth flight
|
|
185
|
+
// would be snapped by it, and a smooth animation cannot catch a tail that
|
|
186
|
+
// is already growing (see `stream-coalescer.ts`).
|
|
187
|
+
setTimeout(() => jumpToBottom('instant'), 50);
|
|
184
188
|
|
|
185
189
|
// Real mode: route through the omp agent RPC bridge + event stream.
|
|
186
190
|
if (isOmpSession) {
|