@kabmo-labs/kabmo 0.50.0 → 0.51.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 +503 -501
- package/dist/client/static/js/{Body-pd3nt4xa.js → Body-s3nh6vet.js} +3 -3
- package/dist/client/static/js/{CsvGrid-eksmqv8f.js → CsvGrid-j4h6cpnn.js} +2 -2
- package/dist/client/static/js/{DocxView-xfx1kt8x.js → DocxView-197x16zq.js} +3 -3
- package/dist/client/static/js/{DrawioView-2xyqg9bv.js → DrawioView-v6ps0cm5.js} +2 -2
- package/dist/client/static/js/{HtmlPreview-ps3f0aa5.js → HtmlPreview-a2t5zngp.js} +1 -1
- package/dist/client/static/js/ImageView-ar7hz7jx.js +1 -0
- package/dist/client/static/js/LayoutWrapper-epef152a.js +2 -0
- package/dist/client/static/js/MergeDiffView-7rwjvzk5.js +1 -0
- package/dist/client/static/js/Modal-9nxt67fm.js +60 -0
- package/dist/client/static/js/{PdfView-8fp08jym.js → PdfView-gzhcym20.js} +1 -1
- package/dist/client/static/js/SessionsView-3h872gpe.js +1 -0
- package/dist/client/static/js/{SheetView-g7mstjdp.js → SheetView-baaynkb4.js} +8 -8
- package/dist/client/static/js/{SvgPreview-wsv4h6c6.js → SvgPreview-jzcqwwcc.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-1kgm1049.js → abnfDiagram-O67JEVCF-grb1sfhr.js} +1 -1
- package/dist/client/static/js/architecture-7GRP2DOG-3hkq8grc.js +1 -0
- package/dist/client/static/js/{architectureDiagram-NJMV4G6O-mtm210rw.js → architectureDiagram-NJMV4G6O-9084jzwr.js} +5 -5
- package/dist/client/static/js/{astro-dszrfwwn.js → astro-m3fcq2sa.js} +1 -1
- package/dist/client/static/js/bash-n7wcmq3s.js +1 -0
- package/dist/client/static/js/{blockDiagram-BEXU5L5S-s474vn2w.js → blockDiagram-BEXU5L5S-qqcjrg1b.js} +6 -6
- package/dist/client/static/js/c-ypdp030b.js +1 -0
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-s68v6tc8.js → c4Diagram-YGBWAQC7-gc8fqbpc.js} +2 -2
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-291va3yk.js → classDiagram-v2-NBCMYWYE-pp6060kq.js} +7 -7
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-0zg7crdw.js → cose-bilkent-JH36ORCC-744ekavk.js} +1 -1
- package/dist/client/static/js/cpp-cxwev3gs.js +1 -0
- package/dist/client/static/js/css-6mxcqf8c.js +1 -0
- package/dist/client/static/js/css-9gak6bze.js +1 -0
- package/dist/client/static/js/cynefin-OW5HDTMX-9m18e6m5.js +1 -0
- package/dist/client/static/js/{cynefinDiagram-VND7K2PF-4gnmn3yc.js → cynefinDiagram-VND7K2PF-57dja6g9.js} +1 -1
- package/dist/client/static/js/{dagre-6A5THRUB-nxmj6bkg.js → dagre-6A5THRUB-de4xrbrw.js} +2 -2
- package/dist/client/static/js/{diagram-22UHCM2B-3171dabw.js → diagram-22UHCM2B-ky3ncyv8.js} +18 -18
- package/dist/client/static/js/{diagram-3UASUU5V-9h1pd6h8.js → diagram-3UASUU5V-zgg82bz9.js} +2 -2
- package/dist/client/static/js/{diagram-ATOU4E4O-ywfrbd6m.js → diagram-ATOU4E4O-r4s13e4n.js} +3 -3
- package/dist/client/static/js/{diagram-CDSNMT55-t87b4wbk.js → diagram-CDSNMT55-my21t0kq.js} +5 -5
- package/dist/client/static/js/{diagram-MLGK6HIB-bzv52p97.js → diagram-MLGK6HIB-pvt20jtj.js} +2 -2
- package/dist/client/static/js/{diagram-MPIPVDR6-8f66rp0a.js → diagram-MPIPVDR6-as9dk4f3.js} +2 -2
- package/dist/client/static/js/{dockerfile-z3v0km9v.js → dockerfile-3b5caedj.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-3y4w2j6t.js → ebnfDiagram-ZINNZB2B-tj3hkcj4.js} +1 -1
- package/dist/client/static/js/{elixir-c701n0qg.js → elixir-7q2k61zb.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-d9d23jch.js → elk-276RUBZZ-5e7wczf3.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-w4z3501c.js → erDiagram-OPXOYQCR-5jje7qrh.js} +3 -3
- package/dist/client/static/js/{erlang-cpw5s1f9.js → erlang-tjsd7n4d.js} +1 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-d4egnv9v.js +1 -0
- package/dist/client/static/js/flowDiagram-KWPJA3E3-pdeqndnd.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-7wcxk4bm.js → ganttDiagram-FUAMR5RP-7hresycc.js} +4 -4
- package/dist/client/static/js/gitGraph-4MIJSDKK-grqv890n.js +1 -0
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-sdh1hsb1.js → gitGraphDiagram-X574FWY7-8m202jb7.js} +17 -17
- package/dist/client/static/js/graphql-6rwdfcnf.js +1 -0
- package/dist/client/static/js/html-p76eszt9.js +1 -0
- package/dist/client/static/js/{index-zhnfq8br.js → index-0prwdwyb.js} +2 -2
- package/dist/client/static/js/{index-tew3rd6t.js → index-0y6tstk8.js} +1 -1
- package/dist/client/static/js/{index-1dx4dqzy.js → index-20hj80g4.js} +4 -4
- package/dist/client/static/js/index-21421tq7.js +2 -0
- package/dist/client/static/js/{index-0q39ajgh.js → index-254387vg.js} +2 -2
- package/dist/client/static/js/index-2y4gk5q5.js +2 -0
- package/dist/client/static/js/index-3fk8grhz.js +2 -0
- package/dist/client/static/js/index-3rrdmk9m.js +2 -0
- package/dist/client/static/js/{index-frhxbqhg.js → index-3sz9cztk.js} +1 -1
- package/dist/client/static/js/{index-9ydvkxz1.css → index-4m2d73m3.css} +1 -1
- package/dist/client/static/js/{index-7xn7gxgw.js → index-4nvcwtvr.js} +2 -2
- package/dist/client/static/js/index-4ppap7vb.js +9 -0
- package/dist/client/static/js/{index-vgwjn4de.js → index-4tbdws4r.js} +2 -2
- package/dist/client/static/js/{index-hqhz4eam.js → index-56hy2hcy.js} +1 -1
- package/dist/client/static/js/{index-dgkpbrdr.js → index-60g0e74a.js} +2 -2
- package/dist/client/static/js/{index-n54jd3aw.js → index-7ag37ghj.js} +11 -11
- package/dist/client/static/js/{index-bggz63br.js → index-7ehcjb3r.js} +7 -7
- package/dist/client/static/js/index-899yw6fh.js +2 -0
- package/dist/client/static/js/{index-4vaxdt8a.js → index-8pqx5n2p.js} +2 -2
- package/dist/client/static/js/{index-971stdh4.js → index-91jm3ywm.js} +2 -2
- package/dist/client/static/js/{index-5qwgexg6.js → index-9qf2h9jb.js} +4 -4
- package/dist/client/static/js/{index-wbma8kqw.js → index-9rp7h1nv.js} +23 -23
- package/dist/client/static/js/index-9rr23e0e.js +2 -0
- package/dist/client/static/js/index-9wj4ma9g.js +3 -0
- package/dist/client/static/js/{index-e471eprg.js → index-awtk0djy.js} +1 -1
- package/dist/client/static/js/{index-1d8v3bvm.js → index-awz6pyd0.js} +2 -2
- package/dist/client/static/js/index-cvx1vkrx.js +1 -0
- package/dist/client/static/js/{index-09ap9ncj.js → index-cwwg7k5f.js} +46 -46
- package/dist/client/static/js/{index-8fk7h2me.js → index-dzatbdws.js} +5 -5
- package/dist/client/static/js/{index-1adfks1n.js → index-e6ew77ph.js} +2 -2
- package/dist/client/static/js/{index-144aknp3.js → index-ej1va073.js} +2 -2
- package/dist/client/static/js/{index-cm8pa783.js → index-er7pj5k6.js} +2 -2
- package/dist/client/static/js/index-fm0t4pct.js +4 -0
- package/dist/client/static/js/{index-aqqj4xxy.js → index-g5wp6ksw.js} +2 -2
- package/dist/client/static/js/{index-ajqmcds5.js → index-gy4mtr2e.js} +2 -2
- package/dist/client/static/js/{index-kce86cnw.js → index-j9y4tjk0.js} +2 -2
- package/dist/client/static/js/{index-gws4prmg.js → index-kt7c42n7.js} +2 -2
- package/dist/client/static/js/index-ktmb341a.js +468 -0
- package/dist/client/static/js/{index-56319bht.js → index-m6zncj00.js} +2 -2
- package/dist/client/static/js/{index-jxxewcat.js → index-mpyd7qxj.js} +2 -2
- package/dist/client/static/js/{index-gcgsjd3c.js → index-ms80nne4.js} +2 -2
- package/dist/client/static/js/{index-k66w6d9b.js → index-my856e49.js} +2 -2
- package/dist/client/static/js/{index-c2mqr5fh.js → index-nt17ejrm.js} +2 -2
- package/dist/client/static/js/{index-zsx5vs3j.js → index-pvv340b4.js} +2 -2
- package/dist/client/static/js/{index-svx6rnfs.js → index-pxr36neg.js} +2 -2
- package/dist/client/static/js/{index-r2z0a118.js → index-q0k1am0g.js} +2 -2
- package/dist/client/static/js/{index-xrn2reb5.js → index-qrpx4sk1.js} +2 -2
- package/dist/client/static/js/{index-ajdzvegm.js → index-r2zsw7nw.js} +8 -8
- package/dist/client/static/js/{index-xgbcn89g.js → index-rbkvw2xs.js} +2 -2
- package/dist/client/static/js/{index-2g1ey1c9.js → index-scmtzcv1.js} +2 -2
- package/dist/client/static/js/{index-3rhk4apq.js → index-syvkpnc8.js} +1 -1
- package/dist/client/static/js/index-tfqqsj2g.js +1 -0
- package/dist/client/static/js/{index-7jdz4jr4.js → index-tj7xr4ta.js} +2 -2
- package/dist/client/static/js/{index-1vfej0gk.js → index-wvw70pgd.js} +2 -2
- package/dist/client/static/js/{index-qxzyvye9.js → index-wxs0x3g1.js} +2 -2
- package/dist/client/static/js/index-x507ndnc.js +314 -0
- package/dist/client/static/js/{index-1jx4nt2f.js → index-x87scjpa.js} +1 -1
- package/dist/client/static/js/{index-grkacfv3.js → index-xtrsvm0d.js} +2 -2
- package/dist/client/static/js/{index-ratbr10x.js → index-y1j18rha.js} +2 -2
- package/dist/client/static/js/{index-r6bm9sth.js → index-yv2ervdj.js} +7 -7
- package/dist/client/static/js/{index-k3vvk28c.js → index-z2pmt1bc.js} +1 -1
- package/dist/client/static/js/{index-ap6hv7s7.js → index-z446edg9.js} +1 -1
- package/dist/client/static/js/{index-1ec33b1j.js → index-zkgqa0c2.js} +2 -2
- package/dist/client/static/js/index-zwbw177x.js +2 -0
- package/dist/client/static/js/info-A6RAGUB7-rzpg7qk1.js +1 -0
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-gtdp0z6p.js → infoDiagram-VRGFBTTK-5mb5w005.js} +2 -2
- package/dist/client/static/js/ini-kjcpgebh.js +1 -0
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-c05m0sqq.js → ishikawaDiagram-OU5B5YK6-zk7fa0fm.js} +3 -3
- package/dist/client/static/js/java-0bcyv1jt.js +1 -0
- package/dist/client/static/js/javascript-0mqgcvps.js +1 -0
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-kgk5ygm2.js → journeyDiagram-ZHPQQLJL-8jd7b2aw.js} +5 -5
- package/dist/client/static/js/json-mb8k0b1n.js +1 -0
- package/dist/client/static/js/jsx-8p6dqgpq.js +1 -0
- package/dist/client/static/js/{julia-w13bz4s1.js → julia-nwh5w343.js} +1 -1
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-q1w9w68s.js → kanban-definition-PNTS6WVX-yp9rks4k.js} +7 -7
- package/dist/client/static/js/lua-nxnqww9z.js +1 -0
- package/dist/client/static/js/markdown-8gbyxxjd.js +1 -0
- package/dist/client/static/js/{mermaid.core-1rz62j9g.js → mermaid.core-kxsxr8ec.js} +9 -9
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-3m3w6bnb.js → mindmap-definition-NLK3R4M7-anx2kj3b.js} +5 -5
- package/dist/client/static/js/one-dark-pro-wyegjr0d.js +1 -0
- package/dist/client/static/js/one-light-kp6c3eqh.js +1 -0
- package/dist/client/static/js/packet-AYTQ26CC-eac14hsq.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-svd3ex4e.js → pegDiagram-GJSIUBJH-9egqyzkc.js} +1 -1
- package/dist/client/static/js/{perl-hcg3hacf.js → perl-wb4wtc9x.js} +1 -1
- package/dist/client/static/js/{php-q6hhp84p.js → php-9g594k9f.js} +1 -1
- package/dist/client/static/js/pie-WAS4IAKB-a9xqvysf.js +1 -0
- package/dist/client/static/js/{pieDiagram-5QR66LMP-2nrkw034.js → pieDiagram-5QR66LMP-f3dvprbm.js} +3 -3
- package/dist/client/static/js/properties-d5bwhgwz.js +1 -0
- package/dist/client/static/js/python-fdwwjjhh.js +1 -0
- package/dist/client/static/js/{quadrantDiagram-O4NWA36T-4895d1aq.js → quadrantDiagram-O4NWA36T-qsghd295.js} +6 -6
- package/dist/client/static/js/r-4d2ygtfj.js +1 -0
- package/dist/client/static/js/radar-RG4KPBEZ-jv2pm0fe.js +1 -0
- package/dist/client/static/js/railroad-74A4TZTK-j74sc0b6.js +1 -0
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-eaf19baz.js +1 -0
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-d4j5nq31.js +1 -0
- package/dist/client/static/js/railroad-peg-WCYAUIDC-ba862a9p.js +1 -0
- package/dist/client/static/js/{railroadDiagram-XR7U4H2S-zj3g9yne.js → railroadDiagram-XR7U4H2S-6vmazht2.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-727yjvs8.js → requirementDiagram-PLB6GJNP-phs0wn1v.js} +5 -5
- package/dist/client/static/js/{ruby-wzqz8vw6.js → ruby-c4hxsegh.js} +1 -1
- package/dist/client/static/js/{rust-r94pgqvf.js → rust-e4whdswc.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-17c7p2pe.js → sankeyDiagram-IPEJSGJF-vkktegjk.js} +4 -4
- package/dist/client/static/js/{sass-xb3van7h.js → sass-6yxywx7t.js} +1 -1
- package/dist/client/static/js/{scss-ddg6t3x4.js → scss-9wz47c6t.js} +1 -1
- package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-wcmbpckr.js → sequenceDiagram-PO4LG4MO-37e6se72.js} +16 -16
- package/dist/client/static/js/{sizeCapture-INFHLROL-nkr57cd6.js → sizeCapture-INFHLROL-3b4nsa4s.js} +1 -1
- package/dist/client/static/js/sql-sd00wgem.js +1 -0
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-vd7r8s78.js → stateDiagram-v2-GCMORJYK-2nnyqs9x.js} +3 -3
- package/dist/client/static/js/{svelte-wzaxz546.js → svelte-mm3jfpje.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-zhxm05ak.js → swimlanes-2SLR337P-eezd46ps.js} +1 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-h78096xp.js +8 -0
- package/dist/client/static/js/{timeline-definition-EJHVYXUP-n7gbzhzd.js → timeline-definition-EJHVYXUP-pz0f2b4h.js} +6 -6
- package/dist/client/static/js/treeView-Q6P3EWNA-e8yb44pd.js +1 -0
- package/dist/client/static/js/treemap-WGGIJYW6-zvdv84vp.js +1 -0
- package/dist/client/static/js/typescript-5txwpd9t.js +1 -0
- package/dist/client/static/js/{usecaseDiagram-POWQR4AR-davsnwkf.js → usecaseDiagram-POWQR4AR-hvg7a87b.js} +29 -29
- package/dist/client/static/js/{vennDiagram-UO4OBE2U-gb54bh5k.js → vennDiagram-UO4OBE2U-03zh9phs.js} +8 -8
- package/dist/client/static/js/{vue-6zhfw7zx.js → vue-rcdqpz7q.js} +1 -1
- package/dist/client/static/js/wardley-WFR3VGLG-hbv0cg4s.js +1 -0
- package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-sf98cg9t.js → wardleyDiagram-VNRHLVJA-xy77th92.js} +5 -5
- package/dist/client/static/js/xml-vtrdnrn6.js +1 -0
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-9nn09k40.js → xychartDiagram-PMCCYNJV-h48448cm.js} +4 -4
- package/dist/client/static/js/yaml-6k1tmwtm.js +1 -0
- package/package.json +2 -1
- package/src/client/components/common/MarkdownRenderer.tsx +31 -34
- package/src/client/components/common/ViewportSelector.tsx +4 -0
- package/src/client/components/common/command-palette/index.tsx +5 -2
- package/src/client/components/common/markdown-inline-file.test.tsx +131 -0
- package/src/client/components/common/search-select/OptionList.tsx +164 -0
- package/src/client/components/common/search-select/index.tsx +159 -136
- package/src/client/components/common/search-select/option.ts +16 -0
- package/src/client/components/common/search-select/search-select.test.tsx +61 -2
- package/src/client/components/common/sort-menu/index.tsx +9 -4
- package/src/client/components/layout/session-sidebar/HarnessFilter.tsx +26 -6
- package/src/client/components/layout/session-sidebar/scheduler-modal/ModelFields.tsx +45 -49
- package/src/client/components/layout/session-sidebar/scheduler-modal/TaskForm.tsx +31 -25
- package/src/client/components/settings/ProjectSelectorDropdown.tsx +40 -101
- package/src/client/components/settings/categories/agent-settings/DetailPane.tsx +12 -10
- package/src/client/components/settings/categories/command-settings/DetailPane.tsx +12 -10
- package/src/client/components/settings/categories/dictation-settings/CaptureSection.tsx +13 -18
- package/src/client/components/settings/categories/git-settings/CommitMessageSection.tsx +8 -9
- package/src/client/components/settings/categories/keyboard-settings/ComposerKeys.tsx +10 -10
- package/src/client/components/settings/categories/mcp-settings/AdvancedSection.tsx +21 -18
- package/src/client/components/settings/categories/mcp-settings/DetailPane.tsx +12 -7
- package/src/client/components/settings/categories/omp-settings/PresetBar.tsx +11 -11
- package/src/client/components/settings/categories/omp-settings/RoleEditor.test.ts +14 -11
- package/src/client/components/settings/categories/omp-settings/RowEditor.tsx +17 -16
- package/src/client/components/settings/categories/plugin-settings/MarketplacePane.tsx +11 -9
- package/src/client/components/settings/categories/plugin-settings/SettingsSection.tsx +10 -9
- package/src/client/components/settings/categories/provider-settings/AddModelModal.tsx +10 -8
- package/src/client/components/settings/categories/provider-settings/DialectFields.tsx +40 -24
- package/src/client/components/settings/categories/provider-settings/EntryAdvanced.tsx +13 -9
- package/src/client/components/settings/categories/provider-settings/EntryModal.tsx +22 -17
- package/src/client/components/settings/categories/provider-settings/PresetPicker.tsx +79 -50
- package/src/client/components/settings/categories/provider-settings/model-dialogs.test.tsx +14 -7
- package/src/client/components/settings/categories/voice-settings/SpeechSettings.test.tsx +117 -15
- package/src/client/components/settings/categories/voice-settings/SpeechSettings.tsx +27 -3
- package/src/client/components/settings/categories/voice-settings/speech/EndpointSection.tsx +3 -1
- package/src/client/components/settings/categories/voice-settings/speech/EngineSection.tsx +32 -2
- package/src/client/components/settings/categories/voice-settings/speech/ModelsSection.tsx +277 -0
- package/src/client/components/settings/categories/voice-settings/speech/TestSection.tsx +2 -1
- package/src/client/components/settings/categories/voice-settings/speech/VoiceSection.tsx +83 -41
- package/src/client/components/workspace/btw-panel/TopicMenu.tsx +20 -2
- package/src/client/components/workspace/chat-timeline/AiMessageFooter.speech.test.tsx +35 -6
- package/src/client/components/workspace/chat-timeline/SpeechButton.tsx +111 -36
- package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.tsx +21 -6
- package/src/client/components/workspace/chat-timeline/chat-input/SessionModeDropdown.tsx +7 -4
- package/src/client/components/workspace/chat-timeline/chat-input/ThinkingLevelDropdown.tsx +22 -6
- package/src/client/components/workspace/chat-timeline/target-picker/WorktreePicker.tsx +17 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/index.tsx +8 -65
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Proc.test.ts +12 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/registry.test.ts +35 -218
- package/src/client/components/workspace/chat-timeline/tool-renderers/registry.ts +40 -177
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/DiffView.test.ts +13 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/FallbackToolJson.test.tsx +79 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/FallbackToolJson.tsx +86 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ToolBody.tsx +25 -16
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/card-header.test.ts +4 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/tool-view.ts +11 -4
- package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Card.plugin.test.ts +3 -1
- package/src/client/components/workspace/file-explorer/ArchiveModals.tsx +15 -15
- package/src/client/components/workspace/git-panel/BranchToolbar.tsx +30 -5
- package/src/client/data/mock/chat.ts +17 -0
- package/src/client/data/samples/tools-session.ts +8 -5
- package/src/client/hooks/editor/font.test.ts +21 -0
- package/src/client/hooks/editor/font.ts +12 -9
- package/src/client/hooks/settings/local-tts-models.ts +164 -0
- package/src/client/hooks/tts/tts-context.ts +6 -0
- package/src/client/hooks/tts/use-tts-player.ts +10 -0
- package/src/client/hooks/ui/markdown-render.ts +9 -1
- package/src/client/hooks/ui/markdown-scoped-links.ts +77 -0
- package/src/client/hooks/ui/open-inline-file.test.ts +144 -0
- package/src/client/hooks/ui/open-inline-file.ts +71 -0
- package/src/client/lib/commands/overlays.ts +16 -2
- package/src/client/lib/tts/player.test.ts +61 -0
- package/src/client/lib/tts/player.ts +120 -41
- package/src/client/tailwind.css +16 -0
- package/src/server/lib/chat/normalize-tools.server.test.ts +79 -0
- package/src/server/lib/chat/normalize-tools.server.ts +87 -0
- package/src/server/lib/harness/acp/background-replay.test.ts +36 -0
- package/src/server/lib/harness/acp/background-replay.ts +8 -3
- package/src/server/lib/harness/acp/frames-tool-shapes.test.ts +41 -13
- package/src/server/lib/harness/acp/frames-vendor-names.test.ts +209 -0
- package/src/server/lib/harness/acp/frames.test.ts +11 -20
- package/src/server/lib/harness/acp/frames.ts +5 -3
- package/src/server/lib/harness/acp/mapper.ts +5 -41
- package/src/server/lib/harness/acp/replay-transcript.ts +6 -1
- package/src/server/lib/harness/acp/subagent-frames.test.ts +1 -1
- package/src/server/lib/harness/acp/subagent-frames.ts +0 -2
- package/src/server/lib/harness/acp/tool-calls.ts +5 -16
- package/src/server/lib/harness/acp/tool-identity.test.ts +69 -8
- package/src/server/lib/harness/acp/tool-identity.ts +58 -10
- package/src/server/lib/harness/acp/tool-shape.ts +5 -3
- package/src/server/lib/harness/codex/transcript.server.test.ts +3 -1
- package/src/server/lib/harness/codex/transcript.server.ts +8 -15
- package/src/server/lib/lifecycle/paths.ts +12 -0
- package/src/server/lib/omp/session/messages.ts +5 -1
- package/src/server/lib/realtime/topics/peer-relay.server.ts +9 -1
- package/src/server/lib/realtime/topics/session.server.ts +5 -1
- package/src/server/lib/tts/engines/adapters.test.ts +17 -8
- package/src/server/lib/tts/engines/deepgram.ts +30 -9
- package/src/server/lib/tts/engines/index.ts +11 -0
- package/src/server/lib/tts/engines/local.ts +53 -0
- package/src/server/lib/tts/engines/sherpa-onnx-node.d.ts +38 -0
- package/src/server/lib/tts/engines/sherpa.test.ts +53 -0
- package/src/server/lib/tts/engines/sherpa.ts +287 -0
- package/src/server/lib/tts/local-models.server.ts +257 -0
- package/src/server/lib/tts/local-request.test.ts +66 -0
- package/src/server/lib/tts/local-request.ts +59 -0
- package/src/server/lib/tts/model-manifest.server.test.ts +71 -0
- package/src/server/lib/tts/model-manifest.server.ts +154 -0
- package/src/server/lib/tts/settings.server.ts +7 -4
- package/src/server/lib/tts/wav.test.ts +37 -0
- package/src/server/lib/tts/wav.ts +43 -0
- package/src/server/routes/chat/session-legacy-tools.test.ts +132 -0
- package/src/server/routes/chat/session.ts +10 -4
- package/src/server/routes/tts/index.ts +2 -0
- package/src/server/routes/tts/models.test.ts +148 -0
- package/src/server/routes/tts/models.ts +89 -0
- package/src/shared/lib/chat/tool/normalize.ts +67 -0
- package/src/shared/lib/chat/tool/render-key.test.ts +167 -0
- package/src/shared/lib/chat/tool/render-key.ts +247 -0
- package/src/shared/lib/chat/tool/tool-aliases.test.ts +42 -0
- package/src/shared/lib/chat/tool/tool-aliases.ts +59 -12
- package/src/shared/lib/fs/open-reference.test.ts +64 -0
- package/src/shared/lib/fs/open-reference.ts +74 -0
- package/src/shared/lib/icons/tint-hues.generated.ts +20 -20
- package/src/shared/lib/markdown/inline-file.test.ts +100 -0
- package/src/shared/lib/markdown/inline-file.ts +213 -0
- package/src/shared/lib/omp/session/messages-map.test.ts +2 -1
- package/src/shared/lib/omp/session/messages-parse.ts +3 -2
- package/src/shared/lib/omp/session/parse-message-blocks.ts +14 -0
- package/src/shared/lib/omp/subagent/transcript-client.ts +5 -1
- package/src/shared/lib/tts/engines.test.ts +28 -3
- package/src/shared/lib/tts/engines.ts +31 -6
- package/src/shared/lib/tts/local-models.test.ts +69 -0
- package/src/shared/lib/tts/local-models.ts +200 -0
- package/src/shared/lib/tts/speakable.test.ts +21 -1
- package/src/shared/lib/tts/speakable.ts +66 -33
- package/src/shared/lib/tts/voices.ts +125 -19
- package/src/shared/types/chat.ts +3 -0
- package/src/shared/types/index.ts +1 -0
- package/src/shared/types/tool-render.ts +37 -0
- package/dist/client/static/js/ImageView-7vse3k6x.js +0 -1
- package/dist/client/static/js/LayoutWrapper-qdp83fps.js +0 -2
- package/dist/client/static/js/MergeDiffView-hzsccppq.js +0 -1
- package/dist/client/static/js/Modal-zw9x5b6f.js +0 -60
- package/dist/client/static/js/SessionsView-qmgg03fv.js +0 -1
- package/dist/client/static/js/architecture-7GRP2DOG-g7b64973.js +0 -1
- package/dist/client/static/js/bash-z5pe89pt.js +0 -1
- package/dist/client/static/js/c-fy0fysfw.js +0 -1
- package/dist/client/static/js/cpp-wam8dze6.js +0 -1
- package/dist/client/static/js/css-ke51m4kc.js +0 -1
- package/dist/client/static/js/css-yryw442h.js +0 -1
- package/dist/client/static/js/cynefin-OW5HDTMX-8bscrcct.js +0 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-pj22bng1.js +0 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-9h6g160j.js +0 -1
- package/dist/client/static/js/gitGraph-4MIJSDKK-hgw4jcvk.js +0 -1
- package/dist/client/static/js/graphql-0yv8dc1v.js +0 -1
- package/dist/client/static/js/html-zk3m0az9.js +0 -1
- package/dist/client/static/js/index-0ff2x5g9.js +0 -1
- package/dist/client/static/js/index-17jy16v3.js +0 -314
- package/dist/client/static/js/index-1kjgdyfk.js +0 -2
- package/dist/client/static/js/index-4z3qtazf.js +0 -2
- package/dist/client/static/js/index-779rptb2.js +0 -1
- package/dist/client/static/js/index-9jrej3ht.js +0 -3
- package/dist/client/static/js/index-bczhbk01.js +0 -2
- package/dist/client/static/js/index-evvmkk2f.js +0 -2
- package/dist/client/static/js/index-jr6q69r3.js +0 -465
- package/dist/client/static/js/index-qaxjp73x.js +0 -2
- package/dist/client/static/js/index-rgneq3zt.js +0 -2
- package/dist/client/static/js/index-tfwsch7a.js +0 -4
- package/dist/client/static/js/index-vn495w82.js +0 -9
- package/dist/client/static/js/info-A6RAGUB7-k0kv05ny.js +0 -1
- package/dist/client/static/js/ini-apj95p59.js +0 -1
- package/dist/client/static/js/java-khk2v3g4.js +0 -1
- package/dist/client/static/js/javascript-gez6yppm.js +0 -1
- package/dist/client/static/js/json-r78y6e80.js +0 -1
- package/dist/client/static/js/jsx-h7hfj8cz.js +0 -1
- package/dist/client/static/js/lua-pat2bzg3.js +0 -1
- package/dist/client/static/js/markdown-545zn05v.js +0 -1
- package/dist/client/static/js/one-dark-pro-7c942tnw.js +0 -1
- package/dist/client/static/js/one-light-tp8y6c5g.js +0 -1
- package/dist/client/static/js/packet-AYTQ26CC-ne66q5h9.js +0 -1
- package/dist/client/static/js/pie-WAS4IAKB-ej9aysvz.js +0 -1
- package/dist/client/static/js/properties-9f76xngb.js +0 -1
- package/dist/client/static/js/python-nwerpkfq.js +0 -1
- package/dist/client/static/js/r-39k5dr2p.js +0 -1
- package/dist/client/static/js/radar-RG4KPBEZ-375pe46t.js +0 -1
- package/dist/client/static/js/railroad-74A4TZTK-hdgdfsc1.js +0 -1
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-2p5ynn4a.js +0 -1
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-2p1fxxen.js +0 -1
- package/dist/client/static/js/railroad-peg-WCYAUIDC-g131pt42.js +0 -1
- package/dist/client/static/js/sql-4dcrp3sw.js +0 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-myzk2rg0.js +0 -8
- package/dist/client/static/js/treeView-Q6P3EWNA-gfztfha9.js +0 -1
- package/dist/client/static/js/treemap-WGGIJYW6-kwtrwq1f.js +0 -1
- package/dist/client/static/js/typescript-q0493nmw.js +0 -1
- package/dist/client/static/js/wardley-WFR3VGLG-30dnzvww.js +0 -1
- package/dist/client/static/js/xml-91sb3gt9.js +0 -1
- package/dist/client/static/js/yaml-ghx4mjw1.js +0 -1
|
@@ -17,8 +17,10 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import type { ToolCallData, ToolType } from '@/shared/types/chat';
|
|
20
|
+
import type { ToolRender } from '@/shared/types/tool-render';
|
|
20
21
|
import { hashlineTargetPath } from '@/shared/lib/omp/session/hashline-patch';
|
|
21
22
|
import { toolInputPath } from '@/shared/lib/chat/tool/tool-input-path';
|
|
23
|
+
import { isToolRenderKey } from '@/shared/lib/chat/tool/render-key';
|
|
22
24
|
import { extractToolImages, type ToolImageRef } from '@/shared/lib/omp/session/tool-images';
|
|
23
25
|
import { isRecord } from '@/shared/lib/util/guards';
|
|
24
26
|
|
|
@@ -41,6 +43,10 @@ export interface ParsedToolCall {
|
|
|
41
43
|
/** The transport's own renderer key, when it knows one (ACP `kind`). The
|
|
42
44
|
* shared inference below is a fallback for providers that only send a name. */
|
|
43
45
|
toolType?: ToolType;
|
|
46
|
+
/** The SERVER-normalized renderer family, carried from the wire block. Its
|
|
47
|
+
* absence means the producer could not classify the call, and the card
|
|
48
|
+
* shows the raw JSON body instead of guessing a panel. */
|
|
49
|
+
render?: ToolRender;
|
|
44
50
|
intent?: string;
|
|
45
51
|
target?: string;
|
|
46
52
|
command?: string;
|
|
@@ -117,6 +123,7 @@ export function parseMessageBlocks(content: unknown): ParsedMessageBlocks {
|
|
|
117
123
|
arguments?: unknown;
|
|
118
124
|
input?: unknown;
|
|
119
125
|
toolType?: unknown;
|
|
126
|
+
render?: unknown;
|
|
120
127
|
};
|
|
121
128
|
if (block.type === 'thinking') {
|
|
122
129
|
const body = typeof block.thinking === 'string'
|
|
@@ -155,6 +162,9 @@ export function parseMessageBlocks(content: unknown): ParsedMessageBlocks {
|
|
|
155
162
|
name,
|
|
156
163
|
title: detail ? `${name} — ${detail}` : name,
|
|
157
164
|
...(typeof block.toolType === 'string' ? { toolType: block.toolType as ToolType } : {}),
|
|
165
|
+
...(isToolRenderKey(isRecord(block.render) ? block.render.key : undefined)
|
|
166
|
+
? { render: block.render as ToolRender }
|
|
167
|
+
: {}),
|
|
158
168
|
intent,
|
|
159
169
|
target: target || undefined,
|
|
160
170
|
command: command || undefined,
|
|
@@ -199,9 +209,13 @@ export function toToolCallData(
|
|
|
199
209
|
: options.streaming ? 'running' : 'success';
|
|
200
210
|
return {
|
|
201
211
|
id: parsed.id,
|
|
212
|
+
// `type` is the transport's own word; the PANEL comes from `render`. The
|
|
213
|
+
// two answer different questions (`glob` is a variant of the grep family),
|
|
214
|
+
// so neither is derived from the other.
|
|
202
215
|
type: parsed.toolType ?? inferToolType(parsed.name),
|
|
203
216
|
name: parsed.name,
|
|
204
217
|
title: parsed.title,
|
|
218
|
+
...(parsed.render ? { render: parsed.render } : {}),
|
|
205
219
|
intent: parsed.intent,
|
|
206
220
|
target: parsed.target,
|
|
207
221
|
command: parsed.command,
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
import type { ChatMessageData, SubagentMessagesPage } from '@/shared/types';
|
|
14
14
|
import { toChatMessage } from '@/shared/lib/omp/session/mapper';
|
|
15
|
+
import { normalizeMessageTools } from '@/shared/lib/chat/tool/normalize';
|
|
15
16
|
import { extractText } from '@/shared/lib/omp/session/parse-message-blocks';
|
|
16
17
|
import { normalizeThinkingLevel } from '@/shared/lib/models/thinking-levels';
|
|
17
18
|
import { isRecord } from '@/shared/lib/util/guards';
|
|
@@ -93,7 +94,10 @@ export function convertMessages(raw: unknown[], streaming: boolean): ChatMessage
|
|
|
93
94
|
if (currentLevel !== undefined && converted.role !== 'user') {
|
|
94
95
|
converted.thinkingLevel = currentLevel;
|
|
95
96
|
}
|
|
96
|
-
|
|
97
|
+
// A child transcript is read straight off the wire or the disk, never
|
|
98
|
+
// through the session topic's ingress, so its tool rows get the same
|
|
99
|
+
// classification here — one rule, one resolver.
|
|
100
|
+
out.push(normalizeMessageTools(converted));
|
|
97
101
|
}
|
|
98
102
|
return out;
|
|
99
103
|
}
|
|
@@ -16,10 +16,10 @@ import {
|
|
|
16
16
|
} from '@/shared/lib/tts/engines';
|
|
17
17
|
|
|
18
18
|
describe('TTS_ENGINES', () => {
|
|
19
|
-
test('omp is the shipped default and
|
|
19
|
+
test('omp is the shipped default, and both on-machine engines need no key', () => {
|
|
20
20
|
expect(TTS_ENGINES[0].id).toBe('omp');
|
|
21
21
|
expect(TTS_ENGINES[0].needsKey).toBe(false);
|
|
22
|
-
expect(TTS_ENGINES.filter((engine) => !engine.needsKey).map((engine) => engine.id)).toEqual(['omp']);
|
|
22
|
+
expect(TTS_ENGINES.filter((engine) => !engine.needsKey).map((engine) => engine.id)).toEqual(['omp', 'local']);
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
test('every engine has a positive input budget and an ordered speed range', () => {
|
|
@@ -45,12 +45,37 @@ describe('TTS_ENGINES', () => {
|
|
|
45
45
|
|
|
46
46
|
test('only the engines that document language support expose it', () => {
|
|
47
47
|
expect(TTS_ENGINES.filter((engine) => engine.language !== 'none').map((engine) => engine.id))
|
|
48
|
-
.toEqual(['openai', 'elevenlabs', 'xai', 'gemini']);
|
|
48
|
+
.toEqual(['local', 'openai', 'elevenlabs', 'xai', 'gemini']);
|
|
49
49
|
expect(ttsEngine('xai').language).toBe('required');
|
|
50
50
|
expect(ttsEngine('gemini').language).toBe('auto');
|
|
51
|
+
// The ONNX engine sends a language per request; omp has no such channel.
|
|
52
|
+
expect(ttsEngine('local').language).toBe('parameter');
|
|
51
53
|
expect(ttsEngine('omp').language).toBe('none');
|
|
52
54
|
});
|
|
53
55
|
|
|
56
|
+
test('Deepgram offers Flux voices whose id carries the language', () => {
|
|
57
|
+
const ids = ttsEngine('deepgram').models.map((model) => model.id);
|
|
58
|
+
expect(new Set(ids).size).toBe(ids.length);
|
|
59
|
+
expect(ids).toContain('flux-dewi-id');
|
|
60
|
+
for (const id of ids.filter((entry) => entry.startsWith('flux-'))) {
|
|
61
|
+
expect(id).toMatch(/^flux-[a-z]+-[a-z]{2}$/);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
test('Deepgram speed is the range both endpoints accept', () => {
|
|
66
|
+
// Measured: Aura refuses 0.5 and 1.55; Flux refuses the same edges.
|
|
67
|
+
expect(clampTtsSpeed('deepgram', 2)).toBe(1.5);
|
|
68
|
+
expect(clampTtsSpeed('deepgram', 0.1)).toBe(0.7);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
test('the ONNX engine is a machine-local engine with a real speed range', () => {
|
|
72
|
+
expect(ttsEngine('local').where).toContain('never leaves this machine');
|
|
73
|
+
expect(ttsEngine('local').needsKey).toBe(false);
|
|
74
|
+
expect(ttsEngine('local').editableBaseUrl).toBe(false);
|
|
75
|
+
expect(clampTtsSpeed('local', 9)).toBe(2);
|
|
76
|
+
expect(clampTtsSpeed('local', 0.1)).toBe(0.7);
|
|
77
|
+
});
|
|
78
|
+
|
|
54
79
|
test('only the OpenAI-compatible engine accepts a keyless endpoint', () => {
|
|
55
80
|
expect(TTS_ENGINES.filter((engine) => engine.keyOptional).map((engine) => engine.id)).toEqual(['openai']);
|
|
56
81
|
});
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
XAI_VOICES,
|
|
25
25
|
} from '@/shared/lib/tts/voices';
|
|
26
26
|
|
|
27
|
-
export type TtsEngine = 'omp' | 'openai' | 'elevenlabs' | 'deepgram' | 'xai' | 'gemini';
|
|
27
|
+
export type TtsEngine = 'omp' | 'local' | 'openai' | 'elevenlabs' | 'deepgram' | 'xai' | 'gemini';
|
|
28
28
|
|
|
29
29
|
export interface TtsModelOption {
|
|
30
30
|
id: string;
|
|
@@ -73,7 +73,8 @@ export interface TtsEngineSpec {
|
|
|
73
73
|
* - `instructions`: folded into the model's steering prompt (OpenAI's
|
|
74
74
|
* `gpt-4o-mini-tts`); engines without prompt steering ignore it.
|
|
75
75
|
* - `auto`: no parameter; the model detects the answer's language (Gemini).
|
|
76
|
-
* - `none`: the engine has no language control (omp's local voices,
|
|
76
|
+
* - `none`: the engine has no language control (omp's local voices, and
|
|
77
|
+
* Deepgram, whose model id carries the language).
|
|
77
78
|
*/
|
|
78
79
|
language: 'required' | 'parameter' | 'instructions' | 'auto' | 'none';
|
|
79
80
|
/** Where the provider documents the API, shown under the fields. */
|
|
@@ -99,6 +100,26 @@ export const TTS_ENGINES: readonly TtsEngineSpec[] = [
|
|
|
99
100
|
language: 'none',
|
|
100
101
|
docs: 'https://github.com/kabmo-labs/kabmo/wiki/Chat-Stream-and-Tools',
|
|
101
102
|
},
|
|
103
|
+
{
|
|
104
|
+
id: 'local',
|
|
105
|
+
label: 'This machine (ONNX)',
|
|
106
|
+
where: 'Text never leaves this machine. Runs inside Kabmo’s own server; the model is downloaded once.',
|
|
107
|
+
needsKey: false,
|
|
108
|
+
keyOptional: false,
|
|
109
|
+
editableBaseUrl: false,
|
|
110
|
+
baseUrl: '',
|
|
111
|
+
defaultModel: '',
|
|
112
|
+
defaultVoice: '',
|
|
113
|
+
// The model list is the INSTALLED set, which only the server can read — a
|
|
114
|
+
// static list here would offer a download the user has not made.
|
|
115
|
+
models: [],
|
|
116
|
+
voices: [],
|
|
117
|
+
voiceEditable: true,
|
|
118
|
+
maxChars: 4000,
|
|
119
|
+
speed: { min: 0.7, max: 2 },
|
|
120
|
+
language: 'parameter',
|
|
121
|
+
docs: 'https://github.com/kabmo-labs/kabmo/wiki/Chat-Stream-and-Tools',
|
|
122
|
+
},
|
|
102
123
|
{
|
|
103
124
|
id: 'openai',
|
|
104
125
|
label: 'OpenAI-compatible API',
|
|
@@ -149,8 +170,8 @@ export const TTS_ENGINES: readonly TtsEngineSpec[] = [
|
|
|
149
170
|
},
|
|
150
171
|
{
|
|
151
172
|
id: 'deepgram',
|
|
152
|
-
label: 'Deepgram
|
|
153
|
-
where: 'Text is uploaded to api.deepgram.com.',
|
|
173
|
+
label: 'Deepgram',
|
|
174
|
+
where: 'Text is uploaded to api.deepgram.com. Aura and Flux voices are both offered.',
|
|
154
175
|
needsKey: true,
|
|
155
176
|
keyOptional: false,
|
|
156
177
|
editableBaseUrl: false,
|
|
@@ -161,9 +182,13 @@ export const TTS_ENGINES: readonly TtsEngineSpec[] = [
|
|
|
161
182
|
voices: [],
|
|
162
183
|
voiceEditable: false,
|
|
163
184
|
maxChars: 2000,
|
|
164
|
-
|
|
185
|
+
// The intersection of the two generations, measured: Aura refuses 0.5 and
|
|
186
|
+
// 1.55, Flux refuses 0.5 below and 1.55 above, and only Flux demands 0.05
|
|
187
|
+
// steps. The client must not offer a value either endpoint answers 400 to.
|
|
188
|
+
speed: { min: 0.7, max: 1.5 },
|
|
189
|
+
// The model id's language segment selects the language; there is no field.
|
|
165
190
|
language: 'none',
|
|
166
|
-
docs: 'https://developers.deepgram.com/
|
|
191
|
+
docs: 'https://developers.deepgram.com/docs/tts-models-languages-overview',
|
|
167
192
|
},
|
|
168
193
|
{
|
|
169
194
|
id: 'xai',
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { describe, expect, test } from 'bun:test';
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
LOCAL_LANGUAGE_LABELS,
|
|
10
|
+
LOCAL_TTS_CATALOG,
|
|
11
|
+
SUPERTONIC_VOICE_LABELS,
|
|
12
|
+
catalogModel,
|
|
13
|
+
describeLocalModel,
|
|
14
|
+
formatModelSize,
|
|
15
|
+
localLanguageOptions,
|
|
16
|
+
localVoiceLabel,
|
|
17
|
+
localVoiceOptions,
|
|
18
|
+
} from '@/shared/lib/tts/local-models';
|
|
19
|
+
|
|
20
|
+
const supertonic = LOCAL_TTS_CATALOG[0]!;
|
|
21
|
+
|
|
22
|
+
describe('local model catalog', () => {
|
|
23
|
+
test('the shipped model speaks Indonesian and states its voices', () => {
|
|
24
|
+
expect(supertonic.id).toBe('supertonic-3');
|
|
25
|
+
expect(supertonic.languages).toContain('id');
|
|
26
|
+
expect(supertonic.defaultLanguage).toBe('en');
|
|
27
|
+
expect(supertonic.voices).toBe(SUPERTONIC_VOICE_LABELS.length);
|
|
28
|
+
expect(catalogModel('supertonic-3')).toBe(supertonic);
|
|
29
|
+
expect(catalogModel('nope')).toBeUndefined();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test('every declared Supertonic language has a label', () => {
|
|
33
|
+
for (const code of supertonic.languages) {
|
|
34
|
+
expect(LOCAL_LANGUAGE_LABELS[code]).toBeString();
|
|
35
|
+
}
|
|
36
|
+
expect(supertonic.languages).toHaveLength(31);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test('a model with languages offers only those; one without offers every known code', () => {
|
|
40
|
+
expect(localLanguageOptions(supertonic).map((entry) => entry.id)).toContain('id');
|
|
41
|
+
expect(localLanguageOptions(supertonic)).toHaveLength(31);
|
|
42
|
+
expect(localLanguageOptions({ ...supertonic, languages: ['en', 'id'] }).map((entry) => entry.id))
|
|
43
|
+
.toEqual(['en', 'id']);
|
|
44
|
+
expect(localLanguageOptions({ ...supertonic, languages: [] })).toHaveLength(
|
|
45
|
+
Object.keys(LOCAL_LANGUAGE_LABELS).length,
|
|
46
|
+
);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test('a voice is its documented name, and an unnamed speaker is still numbered', () => {
|
|
50
|
+
expect(localVoiceLabel(supertonic, 0)).toBe('Female 1');
|
|
51
|
+
expect(localVoiceLabel(supertonic, 9)).toBe('Male 5');
|
|
52
|
+
expect(localVoiceLabel({ ...supertonic, voiceLabels: undefined }, 3)).toBe('Voice 3');
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test('voice options cover the probed speaker count, or one default when unknown', () => {
|
|
56
|
+
expect(localVoiceOptions({ ...supertonic, voices: 2 }).map((entry) => entry.label))
|
|
57
|
+
.toEqual(['Female 1', 'Female 2']);
|
|
58
|
+
expect(localVoiceOptions({ ...supertonic, voices: 0 })).toEqual([{ id: '0', label: 'Default voice' }]);
|
|
59
|
+
expect(localVoiceOptions(null)).toEqual([{ id: '0', label: 'Default voice' }]);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
test('the one-line description states languages, voices and size', () => {
|
|
63
|
+
expect(describeLocalModel(supertonic)).toBe('31 languages · 10 voices · 146 MB');
|
|
64
|
+
expect(describeLocalModel({ ...supertonic, languages: [], voices: 0, sizeBytes: undefined }))
|
|
65
|
+
.toBe('languages not declared');
|
|
66
|
+
expect(formatModelSize(1_500_000_000)).toBe('1.5 GB');
|
|
67
|
+
expect(formatModelSize(0)).toBe('');
|
|
68
|
+
});
|
|
69
|
+
});
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The local ONNX speech engine's model catalog, and the two facts a model has to
|
|
8
|
+
* state before the settings page can offer it: which languages it speaks and
|
|
9
|
+
* which voices it has.
|
|
10
|
+
*
|
|
11
|
+
* Why the catalog is Kabmo's and not the engine's: sherpa-onnx validates the
|
|
12
|
+
* language code against its own 32-code list, NOT against the model that was
|
|
13
|
+
* loaded. Measured — the English-only Supertonic v1 bundle happily accepts
|
|
14
|
+
* `lang: "id"` and returns audio in English. A picker that trusted the runtime
|
|
15
|
+
* would offer Indonesian on a model that cannot speak it, so the declared list
|
|
16
|
+
* lives here, and the adapter refuses a language outside it.
|
|
17
|
+
*
|
|
18
|
+
* `languages: []` means the model declared nothing (a bundle added from a link
|
|
19
|
+
* that carries no metadata). Those pass the language through unchanged, and the
|
|
20
|
+
* settings page says so rather than pretending to know.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/** Architectures the in-process runtime can load today, and only measured ones. */
|
|
24
|
+
export type LocalTtsArch = 'supertonic' | 'kokoro';
|
|
25
|
+
|
|
26
|
+
export interface LocalTtsModelInfo {
|
|
27
|
+
/** Directory name under `<data>/tts-models`, and the value stored in settings. */
|
|
28
|
+
id: string;
|
|
29
|
+
label: string;
|
|
30
|
+
arch: LocalTtsArch;
|
|
31
|
+
/** ISO 639-1 codes the model claims. Empty = it claims nothing. */
|
|
32
|
+
languages: string[];
|
|
33
|
+
/** Language used when the setting is empty. */
|
|
34
|
+
defaultLanguage: string;
|
|
35
|
+
/** Speaker count the runtime reports; 0 until probed. */
|
|
36
|
+
voices: number;
|
|
37
|
+
/** Human names by speaker id, when the model documents them. */
|
|
38
|
+
voiceLabels?: string[];
|
|
39
|
+
sampleRate: number;
|
|
40
|
+
/** Bytes on disk, for the settings copy. */
|
|
41
|
+
sizeBytes?: number;
|
|
42
|
+
/** Where it came from: a catalog URL or a link the user pasted. */
|
|
43
|
+
sourceUrl?: string;
|
|
44
|
+
installedAt?: string;
|
|
45
|
+
/** True for entries the settings page offers as a one-click download. */
|
|
46
|
+
curated?: boolean;
|
|
47
|
+
/** One line: what this model trades for what. */
|
|
48
|
+
notes?: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export type InstallStatus = 'downloading' | 'extracting' | 'probing' | 'ready' | 'error';
|
|
52
|
+
|
|
53
|
+
/** One install in flight, or the record of the last one. */
|
|
54
|
+
export interface InstallJob {
|
|
55
|
+
id: string;
|
|
56
|
+
label: string;
|
|
57
|
+
status: InstallStatus;
|
|
58
|
+
/** Bytes written so far. */
|
|
59
|
+
received: number;
|
|
60
|
+
/** `content-length`, or 0 when the server did not state one. */
|
|
61
|
+
total: number;
|
|
62
|
+
/** 0–1 while downloading, 1 after. */
|
|
63
|
+
progress: number;
|
|
64
|
+
error?: string;
|
|
65
|
+
/** The URL the job is fetching — a pasted link is retried with it, not its id. */
|
|
66
|
+
url?: string;
|
|
67
|
+
startedAt: number;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** The shipped Supertonic style tensors, in the runtime's alphabetical order. */
|
|
71
|
+
export const SUPERTONIC_VOICE_LABELS: readonly string[] = [
|
|
72
|
+
'Female 1',
|
|
73
|
+
'Female 2',
|
|
74
|
+
'Female 3',
|
|
75
|
+
'Female 4',
|
|
76
|
+
'Female 5',
|
|
77
|
+
'Male 1',
|
|
78
|
+
'Male 2',
|
|
79
|
+
'Male 3',
|
|
80
|
+
'Male 4',
|
|
81
|
+
'Male 5',
|
|
82
|
+
];
|
|
83
|
+
|
|
84
|
+
/** The 31 codes Supertonic 3 ships, with the label the picker shows. */
|
|
85
|
+
export const LOCAL_LANGUAGE_LABELS: Readonly<Record<string, string>> = {
|
|
86
|
+
ar: 'Arabic',
|
|
87
|
+
bg: 'Bulgarian',
|
|
88
|
+
cs: 'Czech',
|
|
89
|
+
da: 'Danish',
|
|
90
|
+
de: 'German',
|
|
91
|
+
el: 'Greek',
|
|
92
|
+
en: 'English',
|
|
93
|
+
es: 'Spanish',
|
|
94
|
+
et: 'Estonian',
|
|
95
|
+
fi: 'Finnish',
|
|
96
|
+
fr: 'French',
|
|
97
|
+
hi: 'Hindi',
|
|
98
|
+
hr: 'Croatian',
|
|
99
|
+
hu: 'Hungarian',
|
|
100
|
+
id: 'Indonesian',
|
|
101
|
+
it: 'Italian',
|
|
102
|
+
ja: 'Japanese',
|
|
103
|
+
ko: 'Korean',
|
|
104
|
+
lt: 'Lithuanian',
|
|
105
|
+
lv: 'Latvian',
|
|
106
|
+
nl: 'Dutch',
|
|
107
|
+
pl: 'Polish',
|
|
108
|
+
pt: 'Portuguese',
|
|
109
|
+
ro: 'Romanian',
|
|
110
|
+
ru: 'Russian',
|
|
111
|
+
sk: 'Slovak',
|
|
112
|
+
sl: 'Slovenian',
|
|
113
|
+
sv: 'Swedish',
|
|
114
|
+
tr: 'Turkish',
|
|
115
|
+
uk: 'Ukrainian',
|
|
116
|
+
vi: 'Vietnamese',
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const SUPERTONIC_LANGUAGES: readonly string[] = Object.keys(LOCAL_LANGUAGE_LABELS);
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Models the settings page can download with one click.
|
|
123
|
+
*
|
|
124
|
+
* Both are sherpa-onnx int8 bundles, which is what the runtime reads. The
|
|
125
|
+
* Indonesian voice of Piper is deliberately absent: its model card names the
|
|
126
|
+
* Lessac corpus, whose licence excludes commercial use of the synthesis.
|
|
127
|
+
*/
|
|
128
|
+
export const LOCAL_TTS_CATALOG: readonly LocalTtsModelInfo[] = [
|
|
129
|
+
{
|
|
130
|
+
id: 'supertonic-3',
|
|
131
|
+
label: 'Supertonic 3',
|
|
132
|
+
arch: 'supertonic',
|
|
133
|
+
languages: [...SUPERTONIC_LANGUAGES],
|
|
134
|
+
defaultLanguage: 'en',
|
|
135
|
+
voices: 10,
|
|
136
|
+
voiceLabels: [...SUPERTONIC_VOICE_LABELS],
|
|
137
|
+
sampleRate: 44_100,
|
|
138
|
+
sizeBytes: 146_000_000,
|
|
139
|
+
curated: true,
|
|
140
|
+
sourceUrl:
|
|
141
|
+
'https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/sherpa-onnx-supertonic-3-tts-int8-2026-05-11.tar.bz2',
|
|
142
|
+
notes: '99M parameters, 31 languages including Indonesian, ten voices. Weights OpenRAIL-M, runtime MIT.',
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
id: 'kokoro-en-zh',
|
|
146
|
+
label: 'Kokoro 82M (English + Chinese)',
|
|
147
|
+
arch: 'kokoro',
|
|
148
|
+
languages: ['en', 'zh'],
|
|
149
|
+
defaultLanguage: 'en',
|
|
150
|
+
voices: 103,
|
|
151
|
+
sampleRate: 24_000,
|
|
152
|
+
sizeBytes: 140_000_000,
|
|
153
|
+
curated: true,
|
|
154
|
+
sourceUrl:
|
|
155
|
+
'https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/kokoro-int8-multi-lang-v1_1.tar.bz2',
|
|
156
|
+
notes: '82M parameters, 103 voices, English and Chinese only — Supertonic 3 is the Indonesian one.',
|
|
157
|
+
},
|
|
158
|
+
];
|
|
159
|
+
|
|
160
|
+
/** One catalog entry, or undefined. */
|
|
161
|
+
export function catalogModel(id: string): LocalTtsModelInfo | undefined {
|
|
162
|
+
return LOCAL_TTS_CATALOG.find((model) => model.id === id);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** The language list a model declares, or every known code when it declares none. */
|
|
166
|
+
export function localLanguageOptions(model: LocalTtsModelInfo | null): { id: string; label: string }[] {
|
|
167
|
+
const codes = model && model.languages.length > 0 ? model.languages : Object.keys(LOCAL_LANGUAGE_LABELS);
|
|
168
|
+
return codes.map((code) => ({ id: code, label: LOCAL_LANGUAGE_LABELS[code] ?? code.toUpperCase() }));
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/** "Female 3" when the model names its voices, else "Voice 3". */
|
|
172
|
+
export function localVoiceLabel(model: LocalTtsModelInfo | null, sid: number): string {
|
|
173
|
+
const named = model?.voiceLabels?.[sid];
|
|
174
|
+
return named ?? `Voice ${sid}`;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/** Every voice of a model as picker options; one entry when the count is unknown. */
|
|
178
|
+
export function localVoiceOptions(model: LocalTtsModelInfo | null): { id: string; label: string }[] {
|
|
179
|
+
const count = model?.voices ?? 0;
|
|
180
|
+
if (count <= 0) return [{ id: '0', label: 'Default voice' }];
|
|
181
|
+
return Array.from({ length: count }, (_unused, sid) => ({ id: String(sid), label: localVoiceLabel(model, sid) }));
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/** Bytes → "146 MB", for a settings row that must not show a raw number. */
|
|
185
|
+
export function formatModelSize(bytes: number | undefined): string {
|
|
186
|
+
if (!bytes || bytes <= 0) return '';
|
|
187
|
+
const mb = bytes / 1_000_000;
|
|
188
|
+
return mb >= 1000 ? `${(mb / 1000).toFixed(1)} GB` : `${Math.round(mb)} MB`;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/** "31 languages · 10 voices · 146 MB" — the one line under a model's name. */
|
|
192
|
+
export function describeLocalModel(model: LocalTtsModelInfo): string {
|
|
193
|
+
const parts: string[] = [];
|
|
194
|
+
if (model.languages.length > 0) parts.push(`${model.languages.length} languages`);
|
|
195
|
+
else parts.push('languages not declared');
|
|
196
|
+
if (model.voices > 0) parts.push(`${model.voices} voices`);
|
|
197
|
+
const size = formatModelSize(model.sizeBytes);
|
|
198
|
+
if (size) parts.push(size);
|
|
199
|
+
return parts.join(' · ');
|
|
200
|
+
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { describe, expect, test } from 'bun:test';
|
|
7
|
-
import { speechChunks, speakableText } from '@/shared/lib/tts/speakable';
|
|
7
|
+
import { speechChunks, speakableParagraphs, speakableText } from '@/shared/lib/tts/speakable';
|
|
8
8
|
|
|
9
9
|
describe('speakableText', () => {
|
|
10
10
|
test('drops fenced code and tables', () => {
|
|
@@ -47,7 +47,27 @@ describe('speakableText', () => {
|
|
|
47
47
|
});
|
|
48
48
|
});
|
|
49
49
|
|
|
50
|
+
describe('speakableParagraphs', () => {
|
|
51
|
+
test('a blank line separates paragraphs and code blocks vanish', () => {
|
|
52
|
+
expect(speakableParagraphs('First para.\n\n```ts\nconst x = 1;\n```\n\nSecond para.')).toEqual([
|
|
53
|
+
'First para.',
|
|
54
|
+
'Second para.',
|
|
55
|
+
]);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
|
|
50
59
|
describe('speechChunks', () => {
|
|
60
|
+
test('a paragraph worth of speech ends a request', () => {
|
|
61
|
+
const first = 'The first paragraph says enough to be read on its own, and it keeps going for a little while longer so that a listener has time to settle into the answer.';
|
|
62
|
+
const second = 'The second paragraph also stands alone, with a sentence of its own that ends the thought here.';
|
|
63
|
+
const chunks = speechChunks(`${first}\n\n${second}`, 4000, 4000);
|
|
64
|
+
expect(chunks).toEqual([first, second]);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
test('short paragraphs merge so a heading is not its own request', () => {
|
|
68
|
+
expect(speechChunks('## Plan\n\nDo the thing.', 4000, 4000)).toEqual(['Plan Do the thing.']);
|
|
69
|
+
});
|
|
70
|
+
|
|
51
71
|
test('keeps the first request small so audio starts sooner', () => {
|
|
52
72
|
const text = Array.from({ length: 20 }, (_, i) => `Sentence number ${i + 1} is here.`).join(' ');
|
|
53
73
|
const chunks = speechChunks(text, 400, 120);
|
|
@@ -33,6 +33,13 @@ const PATH_RE = /(^|[\s("'`])((?:~|\.{1,2})?\/?[\w.@+-]+(?:\/[\w.@+-]+){2,}\/?)/
|
|
|
33
33
|
const HAS_SPEAKABLE_RE = /[\p{L}\p{N}]/u;
|
|
34
34
|
const SENTENCE_BOUNDARY_RE = /[.!?…]+[)\]"'»”’]*\s/g;
|
|
35
35
|
const ABBREVIATION_RE = /(?:^|\s)(?:e\.g|i\.e|etc|vs|Mr|Mrs|Ms|Dr|St|No)\.$/i;
|
|
36
|
+
/**
|
|
37
|
+
* A paragraph this short never ends a request on its own: headings, one-line
|
|
38
|
+
* bullets and answer fragments would otherwise spend a spawn/round-trip each.
|
|
39
|
+
* Longer paragraphs do end one, which is what makes the read follow the
|
|
40
|
+
* writer's pauses.
|
|
41
|
+
*/
|
|
42
|
+
const PARAGRAPH_FLOOR = 120;
|
|
36
43
|
|
|
37
44
|
/** "https://github.com/foo/bar?x#y" → "github.com". */
|
|
38
45
|
function speakableUrl(url: string): string {
|
|
@@ -73,14 +80,9 @@ function isSilentLine(line: string): boolean {
|
|
|
73
80
|
return false;
|
|
74
81
|
}
|
|
75
82
|
|
|
76
|
-
/**
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
* it are read as separate sentences by the punctuation, not by the layout.
|
|
80
|
-
*/
|
|
81
|
-
export function speakableText(markdown: string): string {
|
|
82
|
-
const withoutFences = markdown.replace(FENCE_RE, ' ');
|
|
83
|
-
const lines = withoutFences.split('\n').flatMap((line) => {
|
|
83
|
+
/** Strip block markup from one block of lines, then normalize the prose. */
|
|
84
|
+
function speakableBlock(block: string): string {
|
|
85
|
+
const lines = block.split('\n').flatMap((line) => {
|
|
84
86
|
if (isSilentLine(line)) return [];
|
|
85
87
|
let text = line;
|
|
86
88
|
text = text.replace(/^\s{0,3}#{1,6}\s+/, '');
|
|
@@ -92,6 +94,27 @@ export function speakableText(markdown: string): string {
|
|
|
92
94
|
return normalizeSpeakable(lines.join(' '));
|
|
93
95
|
}
|
|
94
96
|
|
|
97
|
+
/**
|
|
98
|
+
* The speakable paragraphs, in order.
|
|
99
|
+
*
|
|
100
|
+
* A blank line is the writer's own pause: a request may end there and the
|
|
101
|
+
* reader hears a paragraph break instead of one unbroken stream. Lines inside
|
|
102
|
+
* a block join with a space — a heading and the paragraph under it are separate
|
|
103
|
+
* sentences by punctuation, not by the layout.
|
|
104
|
+
*/
|
|
105
|
+
export function speakableParagraphs(markdown: string): string[] {
|
|
106
|
+
return markdown
|
|
107
|
+
.replace(FENCE_RE, '\n\n')
|
|
108
|
+
.split(/\n{2,}/)
|
|
109
|
+
.map(speakableBlock)
|
|
110
|
+
.filter(Boolean);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** The whole answer as one prose string (the paragraphs, joined). */
|
|
114
|
+
export function speakableText(markdown: string): string {
|
|
115
|
+
return speakableParagraphs(markdown).join(' ');
|
|
116
|
+
}
|
|
117
|
+
|
|
95
118
|
/** Sentence boundaries that exist in `text`, as end offsets. */
|
|
96
119
|
function sentenceEnds(text: string): number[] {
|
|
97
120
|
const ends: number[] = [];
|
|
@@ -125,34 +148,41 @@ function splitLong(sentence: string, max: number): string[] {
|
|
|
125
148
|
return pieces;
|
|
126
149
|
}
|
|
127
150
|
|
|
151
|
+
/** The sentences of one paragraph, in order. */
|
|
152
|
+
function sentencesOf(paragraph: string): string[] {
|
|
153
|
+
const sentences: string[] = [];
|
|
154
|
+
let start = 0;
|
|
155
|
+
for (const end of sentenceEnds(paragraph)) {
|
|
156
|
+
const sentence = paragraph.slice(start, end).trim();
|
|
157
|
+
if (sentence) sentences.push(sentence);
|
|
158
|
+
start = end;
|
|
159
|
+
}
|
|
160
|
+
const tail = paragraph.slice(start).trim();
|
|
161
|
+
if (tail) sentences.push(tail);
|
|
162
|
+
return sentences;
|
|
163
|
+
}
|
|
164
|
+
|
|
128
165
|
/**
|
|
129
166
|
* The request-sized pieces of an answer, in order.
|
|
130
167
|
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
168
|
+
* Two constraints decide a boundary. The paragraph is the writer's own pause,
|
|
169
|
+
* so a chunk ends there once it carries a paragraph's worth of speech: the
|
|
170
|
+
* player can start reading the first paragraph while the rest is still being
|
|
171
|
+
* synthesized, and the reader hears the break. `maxChars` is the engine's hard
|
|
172
|
+
* ceiling and `firstMax` is smaller on purpose — the first request decides
|
|
173
|
+
* time-to-first-audio, so it is the first paragraph (or its first sentences),
|
|
174
|
+
* not a 600-character block that spends seconds synthesizing before a sound.
|
|
135
175
|
*/
|
|
136
176
|
export function speechChunks(
|
|
137
177
|
markdown: string,
|
|
138
178
|
maxChars: number,
|
|
139
|
-
firstMax = Math.min(
|
|
179
|
+
firstMax = Math.min(160, maxChars),
|
|
140
180
|
): string[] {
|
|
141
|
-
const
|
|
142
|
-
if (
|
|
181
|
+
const paragraphs = speakableParagraphs(markdown);
|
|
182
|
+
if (paragraphs.length === 0) return [];
|
|
143
183
|
const limit = Math.max(1, Math.floor(maxChars));
|
|
144
184
|
const firstLimit = Math.max(1, Math.min(Math.floor(firstMax), limit));
|
|
145
185
|
|
|
146
|
-
const sentences: string[] = [];
|
|
147
|
-
let start = 0;
|
|
148
|
-
for (const end of sentenceEnds(text)) {
|
|
149
|
-
const sentence = text.slice(start, end).trim();
|
|
150
|
-
if (sentence) sentences.push(sentence);
|
|
151
|
-
start = end;
|
|
152
|
-
}
|
|
153
|
-
const tail = text.slice(start).trim();
|
|
154
|
-
if (tail) sentences.push(tail);
|
|
155
|
-
|
|
156
186
|
const chunks: string[] = [];
|
|
157
187
|
let current = '';
|
|
158
188
|
let currentLimit = firstLimit;
|
|
@@ -163,16 +193,19 @@ export function speechChunks(
|
|
|
163
193
|
currentLimit = limit;
|
|
164
194
|
};
|
|
165
195
|
|
|
166
|
-
for (const
|
|
167
|
-
for (const
|
|
168
|
-
const
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
196
|
+
for (const paragraph of paragraphs) {
|
|
197
|
+
for (const sentence of sentencesOf(paragraph)) {
|
|
198
|
+
for (const piece of sentence.length > currentLimit ? splitLong(sentence, currentLimit) : [sentence]) {
|
|
199
|
+
const joined = current ? `${current} ${piece}` : piece;
|
|
200
|
+
if (joined.length > currentLimit) {
|
|
201
|
+
flush();
|
|
202
|
+
current = piece;
|
|
203
|
+
} else {
|
|
204
|
+
current = joined;
|
|
205
|
+
}
|
|
174
206
|
}
|
|
175
207
|
}
|
|
208
|
+
if (current.length >= Math.min(currentLimit, PARAGRAPH_FLOOR)) flush();
|
|
176
209
|
}
|
|
177
210
|
flush();
|
|
178
211
|
return chunks.filter((chunk) => HAS_SPEAKABLE_RE.test(chunk));
|