@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
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* TokenPortal wallet (`GET https://tokenportal.id/v1/key`).
|
|
8
|
+
*
|
|
9
|
+
* The endpoint is OpenRouter-shaped — `data.limit` / `data.limit_remaining` /
|
|
10
|
+
* `data.usage` — but the live body (verified 2026-11-23 with the stored `tp-`
|
|
11
|
+
* key) reports money itself, not a token ledger:
|
|
12
|
+
*
|
|
13
|
+
* {"data":{"label":"Kabmo","currency":"IDR","balance":8827,"limit":null,
|
|
14
|
+
* "limit_remaining":8827,"is_free_tier":false,
|
|
15
|
+
* "session_budget":null,"subscription":null}}
|
|
16
|
+
*
|
|
17
|
+
* So `balance` and `limit_remaining` are whole Rupiah, not cents: dividing them
|
|
18
|
+
* or formatting them as USD misstates the wallet by four orders of magnitude.
|
|
19
|
+
* `/v1/key` 404s on every other configured gateway (aihub/new-api, kiosapi,
|
|
20
|
+
* clevecode, nutaraline, sumopod, helipod, token-harbor), so identity is the
|
|
21
|
+
* host and nothing else is probed.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import { readOmpProviderApiKey } from '@/server/lib/omp/core/auth-credentials';
|
|
25
|
+
import { resolveProviderEndpoint, resolveStoredKey } from '@/server/lib/usage/provider-key';
|
|
26
|
+
import { fetchProviderJson } from '@/server/lib/usage/vendor-http';
|
|
27
|
+
import { num } from '@/server/lib/usage/window';
|
|
28
|
+
import { isRecord } from '@/shared/lib/util/guards';
|
|
29
|
+
import type {
|
|
30
|
+
TokenPortalBalance,
|
|
31
|
+
TokenPortalUsageReport,
|
|
32
|
+
UsageLimitWindow,
|
|
33
|
+
UsageUnit,
|
|
34
|
+
} from '@/shared/types';
|
|
35
|
+
|
|
36
|
+
const ORIGIN = 'https://tokenportal.id';
|
|
37
|
+
|
|
38
|
+
/** Currencies the panel can render; anything else keeps its amount verbatim. */
|
|
39
|
+
const MONEY_UNITS: Record<string, UsageUnit> = { IDR: 'idr', USD: 'usd' };
|
|
40
|
+
|
|
41
|
+
/** Whether a provider's base URL is TokenPortal (its `/v1` path is implied). */
|
|
42
|
+
export function isTokenPortalBaseUrl(baseUrl: string): boolean {
|
|
43
|
+
let host: string;
|
|
44
|
+
try {
|
|
45
|
+
host = new URL(baseUrl).hostname.toLowerCase();
|
|
46
|
+
} catch {
|
|
47
|
+
return false; // a malformed URL is not TokenPortal
|
|
48
|
+
}
|
|
49
|
+
return host === 'tokenportal.id' || host.endsWith('.tokenportal.id');
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** The key endpoint for a provider entry's base URL, or the canonical one. */
|
|
53
|
+
export function tokenPortalKeyUrl(baseUrl?: string): string {
|
|
54
|
+
let origin = ORIGIN;
|
|
55
|
+
if (baseUrl) {
|
|
56
|
+
try {
|
|
57
|
+
origin = new URL(baseUrl).origin;
|
|
58
|
+
} catch {
|
|
59
|
+
// A malformed base URL keeps the canonical origin; identity was checked
|
|
60
|
+
// before this ran, so this is a broken entry, not another provider.
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return `${origin}/v1/key`;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** `data` (or the root) out of the vendor envelope. */
|
|
67
|
+
function envelope(payload: unknown): Record<string, unknown> {
|
|
68
|
+
if (!isRecord(payload)) throw new Error('unexpected key response');
|
|
69
|
+
return isRecord(payload.data) ? payload.data : payload;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Map the key body into the report contract. A body without a currency or a
|
|
74
|
+
* balance is a schema change, not an empty wallet, so it throws; the optional
|
|
75
|
+
* caps degrade to null because a key legitimately has none.
|
|
76
|
+
*/
|
|
77
|
+
export function parseTokenPortalBalance(payload: unknown): TokenPortalBalance {
|
|
78
|
+
const data = envelope(payload);
|
|
79
|
+
const currency = typeof data.currency === 'string' ? data.currency.trim().toUpperCase() : '';
|
|
80
|
+
const balance = num(data.balance);
|
|
81
|
+
if (!currency || balance === undefined) throw new Error('unexpected key response');
|
|
82
|
+
return {
|
|
83
|
+
label: typeof data.label === 'string' && data.label.trim().length > 0 ? data.label.trim() : null,
|
|
84
|
+
currency,
|
|
85
|
+
balance,
|
|
86
|
+
limit: num(data.limit) ?? null,
|
|
87
|
+
limitRemaining: num(data.limit_remaining) ?? null,
|
|
88
|
+
isFreeTier: data.is_free_tier === true,
|
|
89
|
+
sessionBudget: num(data.session_budget) ?? null,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* The wallet as the generic `UsageLimitWindow` list, so the sidebar hint and
|
|
95
|
+
* any consumer that only understands quota windows still sees the numbers.
|
|
96
|
+
*
|
|
97
|
+
* The remaining amount outranks the cap: with `limit: null` the vendor still
|
|
98
|
+
* reports `limit_remaining`, and that is the money left. The cap window only
|
|
99
|
+
* exists when the operator set one, because a `used` fraction of a cap that was
|
|
100
|
+
* never set would read as a reassuring 0%.
|
|
101
|
+
*/
|
|
102
|
+
export function tokenPortalWindows(balance: TokenPortalBalance): UsageLimitWindow[] {
|
|
103
|
+
const unit = MONEY_UNITS[balance.currency] ?? 'unknown';
|
|
104
|
+
const remaining = balance.limitRemaining ?? balance.balance;
|
|
105
|
+
const limit = balance.limit ?? undefined;
|
|
106
|
+
const spent = limit !== undefined && balance.limitRemaining !== null
|
|
107
|
+
? Math.max(0, limit - balance.limitRemaining)
|
|
108
|
+
: undefined;
|
|
109
|
+
const windows: UsageLimitWindow[] = [
|
|
110
|
+
{
|
|
111
|
+
id: 'tokenportal:balance',
|
|
112
|
+
label: 'Credit balance',
|
|
113
|
+
...(spent !== undefined ? { used: spent } : {}),
|
|
114
|
+
...(limit !== undefined ? { limit } : {}),
|
|
115
|
+
remaining,
|
|
116
|
+
...(limit !== undefined && spent !== undefined && limit > 0
|
|
117
|
+
? { usedFraction: spent / limit }
|
|
118
|
+
: {}),
|
|
119
|
+
unit,
|
|
120
|
+
status: remaining <= 0 ? 'exhausted' : 'ok',
|
|
121
|
+
},
|
|
122
|
+
];
|
|
123
|
+
if (balance.sessionBudget !== null) {
|
|
124
|
+
windows.push({
|
|
125
|
+
id: 'tokenportal:session',
|
|
126
|
+
label: 'Session budget',
|
|
127
|
+
remaining: balance.sessionBudget,
|
|
128
|
+
unit,
|
|
129
|
+
status: balance.sessionBudget <= 0 ? 'exhausted' : 'ok',
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
return windows;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** The key and endpoint of one provider slug, when it is TokenPortal. */
|
|
136
|
+
async function resolveCredential(slug: string): Promise<{ apiKey: string; url: string } | null> {
|
|
137
|
+
const endpoint = await resolveProviderEndpoint(slug);
|
|
138
|
+
const apiKey = resolveStoredKey(endpoint?.apiKey ?? (await readOmpProviderApiKey(slug)));
|
|
139
|
+
if (!apiKey) return null;
|
|
140
|
+
// A stored base URL decides identity; without one (agent.db only) the slug is
|
|
141
|
+
// all there is, and a wrong guess here would show one account's wallet under
|
|
142
|
+
// another provider's name.
|
|
143
|
+
const named = slug.toLowerCase().replace(/[-_\s]/g, '').includes('tokenportal');
|
|
144
|
+
if (endpoint ? !isTokenPortalBaseUrl(endpoint.baseUrl) : !named) return null;
|
|
145
|
+
return { apiKey, url: tokenPortalKeyUrl(endpoint?.baseUrl) };
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
async function fetchBalance(
|
|
149
|
+
slug: string,
|
|
150
|
+
credential: { apiKey: string; url: string },
|
|
151
|
+
): Promise<TokenPortalUsageReport> {
|
|
152
|
+
try {
|
|
153
|
+
const payload = await fetchProviderJson(credential.url, credential.apiKey, 'TokenPortal');
|
|
154
|
+
return { balance: parseTokenPortalBalance(payload) };
|
|
155
|
+
} catch (error) {
|
|
156
|
+
return { error: error instanceof Error ? error.message : `${slug} key request failed` };
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Wallet reports for every credentialed slug that resolves to TokenPortal.
|
|
162
|
+
* Providers with another endpoint are skipped, and one provider's failure never
|
|
163
|
+
* rejects the batch: it lands on that provider's `error`.
|
|
164
|
+
*/
|
|
165
|
+
export async function buildTokenPortalReports(
|
|
166
|
+
slugs: Iterable<string>,
|
|
167
|
+
): Promise<Map<string, TokenPortalUsageReport>> {
|
|
168
|
+
const reports = new Map<string, TokenPortalUsageReport>();
|
|
169
|
+
const targets = await Promise.all(
|
|
170
|
+
[...slugs].map(async (slug) => ({ slug, credential: await resolveCredential(slug) })),
|
|
171
|
+
);
|
|
172
|
+
await Promise.all(
|
|
173
|
+
targets.map(async ({ slug, credential }) => {
|
|
174
|
+
if (!credential) return;
|
|
175
|
+
reports.set(slug, await fetchBalance(slug, credential));
|
|
176
|
+
}),
|
|
177
|
+
);
|
|
178
|
+
return reports;
|
|
179
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The one copy rule for a failed usage read. A 401 and a 403 are different
|
|
8
|
+
* facts: kiosapi authenticates a valid `sk-` key and then refuses the billing
|
|
9
|
+
* endpoint because the key's group has no permission, so the old shared
|
|
10
|
+
* "rejected the API key" sent the user to rotate a working credential.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { afterEach, describe, expect, test } from 'bun:test';
|
|
14
|
+
|
|
15
|
+
import { fetchProviderJson } from '@/server/lib/usage/vendor-http';
|
|
16
|
+
|
|
17
|
+
const realFetch = globalThis.fetch;
|
|
18
|
+
|
|
19
|
+
afterEach(() => {
|
|
20
|
+
globalThis.fetch = realFetch;
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
function respond(status: number, body: unknown = {}): void {
|
|
24
|
+
globalThis.fetch = (async () => new Response(JSON.stringify(body), {
|
|
25
|
+
status,
|
|
26
|
+
headers: { 'Content-Type': 'application/json' },
|
|
27
|
+
})) as unknown as typeof fetch;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
describe('fetchProviderJson status copy', () => {
|
|
31
|
+
test('401 says the key was rejected', async () => {
|
|
32
|
+
respond(401, { error: 'unauthorized' });
|
|
33
|
+
await expect(fetchProviderJson('https://example.test/v1/key', 'sk-x', 'Acme'))
|
|
34
|
+
.rejects.toThrow('Acme rejected the API key (HTTP 401).');
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
test('403 says the key is refused for the endpoint, not rejected', async () => {
|
|
38
|
+
respond(403, { error: { message: 'No permission to access group DeepSeek-Discount' } });
|
|
39
|
+
await expect(fetchProviderJson('https://example.test/v1/key', 'sk-x', 'Acme'))
|
|
40
|
+
.rejects.toThrow('Acme refused this endpoint for the key (HTTP 403).');
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test('a 200 body is parsed, and a non-JSON body is named as unreadable', async () => {
|
|
44
|
+
respond(200, { data: { balance: 1 } });
|
|
45
|
+
await expect(fetchProviderJson('https://example.test/v1/key', 'sk-x', 'Acme'))
|
|
46
|
+
.resolves.toEqual({ data: { balance: 1 } });
|
|
47
|
+
|
|
48
|
+
globalThis.fetch = (async () => new Response('<html>nope</html>', { status: 200 })) as unknown as typeof fetch;
|
|
49
|
+
await expect(fetchProviderJson('https://example.test/v1/key', 'sk-x', 'Acme'))
|
|
50
|
+
.rejects.toThrow('Acme returned an unreadable balance response.');
|
|
51
|
+
});
|
|
52
|
+
});
|
|
@@ -27,8 +27,15 @@ export async function fetchProviderJson(url: string, apiKey: string, label: stri
|
|
|
27
27
|
} catch (error) {
|
|
28
28
|
throw new Error(error instanceof Error ? error.message : `${label} balance request failed`);
|
|
29
29
|
}
|
|
30
|
-
if (response.status === 401
|
|
31
|
-
throw new Error(`${label} rejected the API key (HTTP
|
|
30
|
+
if (response.status === 401) {
|
|
31
|
+
throw new Error(`${label} rejected the API key (HTTP 401).`);
|
|
32
|
+
}
|
|
33
|
+
if (response.status === 403) {
|
|
34
|
+
// A group-restricted gateway authenticates the key and THEN refuses the
|
|
35
|
+
// endpoint: kiosapi answers "No permission to access group …" on both
|
|
36
|
+
// /v1/dashboard/billing/* and /v1/models for a valid key. Saying "rejected
|
|
37
|
+
// the API key" here sends the user to rotate a credential that is fine.
|
|
38
|
+
throw new Error(`${label} refused this endpoint for the key (HTTP 403).`);
|
|
32
39
|
}
|
|
33
40
|
if (response.status < 200 || response.status >= 300) {
|
|
34
41
|
throw new Error(`${label} balance request failed (HTTP ${response.status}).`);
|
|
@@ -5,11 +5,13 @@
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Dictation WebSocket: one utterance in, one transcript out, with model
|
|
8
|
-
* download progress pushed while
|
|
8
|
+
* download progress pushed while a local first-run decode waits on a fetch.
|
|
9
9
|
*
|
|
10
|
-
* The
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* The engine, the language and the model are fixed BEFORE the recording starts
|
|
11
|
+
* and arrive in the query string, so an unknown engine or an unusable language
|
|
12
|
+
* is refused at the upgrade instead of after a minute of audio. The audio itself
|
|
13
|
+
* is the single binary frame that follows — base64 in JSON cost a third more
|
|
14
|
+
* bytes and two conversions for nothing.
|
|
13
15
|
*
|
|
14
16
|
* Per-connection state lives on `ws.data`, not in a `WeakMap` keyed by the
|
|
15
17
|
* `ws` object — Elysia hands a different wrapper to `message`/`close` than the
|
|
@@ -18,21 +20,30 @@
|
|
|
18
20
|
|
|
19
21
|
import { Elysia } from 'elysia';
|
|
20
22
|
import { isSameOriginUpgrade } from '@/server/lib/http/same-origin';
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
23
|
+
import { dictationEngine, resolveDictationModel } from '@/shared/lib/dictation/engines';
|
|
24
|
+
import { resolveDictationTag } from '@/shared/lib/dictation/languages';
|
|
25
|
+
import { readDictationConfig, readDictationApiKey } from '@/server/lib/dictation/settings.server';
|
|
26
|
+
import { localDictationCapability } from '@/server/lib/dictation/capability.server';
|
|
27
|
+
import { readOmpSttLanguage } from '@/server/lib/dictation/language.server';
|
|
28
|
+
import { transcribeWithEngine } from '@/server/lib/dictation/engines';
|
|
29
|
+
import { DictationEngineError } from '@/server/lib/dictation/engines/adapter';
|
|
30
|
+
import { DICTATION_NO_AUDIO, isDeadCapture, isSilent, utteranceMs } from '@/shared/lib/dictation/gate';
|
|
24
31
|
import { summarizeProgress, type SttProgressSummary } from '@/shared/lib/dictation/models';
|
|
25
32
|
import {
|
|
26
33
|
DICTATION_MAX_AUDIO_BYTES,
|
|
34
|
+
decodeDictationQuery,
|
|
27
35
|
encodeDictationFrame,
|
|
28
|
-
|
|
36
|
+
type DictationRequest,
|
|
29
37
|
type DictationServerFrame,
|
|
30
38
|
} from '@/shared/lib/dictation/protocol';
|
|
31
39
|
|
|
32
40
|
interface DictationState {
|
|
41
|
+
request: DictationRequest;
|
|
33
42
|
/** Percent last reported, so a burst of file events does not flood the socket. */
|
|
34
43
|
lastPercent: number | null;
|
|
35
44
|
lastDecoding: boolean;
|
|
45
|
+
/** One utterance per socket. */
|
|
46
|
+
used: boolean;
|
|
36
47
|
}
|
|
37
48
|
|
|
38
49
|
type DictationWsData = { dictation?: DictationState };
|
|
@@ -53,13 +64,18 @@ export const dictationWsRoutes = new Elysia({ prefix: '/api/dictation' }).ws('/w
|
|
|
53
64
|
},
|
|
54
65
|
|
|
55
66
|
open(ws) {
|
|
56
|
-
(ws.data as unknown as DictationWsData).dictation = {
|
|
67
|
+
(ws.data as unknown as DictationWsData).dictation = {
|
|
68
|
+
request: decodeDictationQuery(ws.data.query as Record<string, unknown> | undefined),
|
|
69
|
+
lastPercent: null,
|
|
70
|
+
lastDecoding: false,
|
|
71
|
+
used: false,
|
|
72
|
+
};
|
|
57
73
|
ws.send(encodeDictationFrame({ type: 'ready' }));
|
|
58
74
|
},
|
|
59
75
|
|
|
60
76
|
async message(ws, raw) {
|
|
61
77
|
const state = (ws.data as unknown as DictationWsData).dictation;
|
|
62
|
-
if (!state) return;
|
|
78
|
+
if (!state || state.used) return;
|
|
63
79
|
|
|
64
80
|
const send = (frame: DictationServerFrame) => {
|
|
65
81
|
try {
|
|
@@ -69,28 +85,84 @@ export const dictationWsRoutes = new Elysia({ prefix: '/api/dictation' }).ws('/w
|
|
|
69
85
|
}
|
|
70
86
|
};
|
|
71
87
|
|
|
72
|
-
//
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
if (
|
|
88
|
+
// The utterance is the binary frame; anything else is a protocol mistake.
|
|
89
|
+
if (!(raw instanceof Uint8Array)) {
|
|
90
|
+
send({ type: 'error', error: 'Expected the audio as a binary frame.', retryable: false });
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (raw.byteLength === 0) {
|
|
94
|
+
send({ type: 'error', error: 'No audio was received.', retryable: true });
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
if (raw.byteLength > DICTATION_MAX_AUDIO_BYTES) {
|
|
78
98
|
send({ type: 'error', error: 'The recording is too long.', retryable: true });
|
|
79
99
|
return;
|
|
80
100
|
}
|
|
101
|
+
state.used = true;
|
|
81
102
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
const
|
|
103
|
+
const config = await readDictationConfig();
|
|
104
|
+
const engine = state.request.engine ?? config.engine;
|
|
105
|
+
const spec = dictationEngine(engine);
|
|
106
|
+
|
|
107
|
+
if (utteranceMs(raw.byteLength) < config.minMs) {
|
|
108
|
+
send({
|
|
109
|
+
type: 'error',
|
|
110
|
+
error: `That was too short to transcribe (under ${config.minMs} ms).`,
|
|
111
|
+
retryable: true,
|
|
112
|
+
});
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
// Bit-exact zeros are a capture that delivered nothing, which is a different
|
|
116
|
+
// answer from "the room was quiet" — and the one that a WebKit capture unit
|
|
117
|
+
// that failed to start actually produces.
|
|
118
|
+
if (isDeadCapture(raw)) {
|
|
119
|
+
send({ type: 'error', error: DICTATION_NO_AUDIO, retryable: true });
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
if (isSilent(raw)) {
|
|
123
|
+
send({ type: 'error', error: 'No speech was detected in that recording.', retryable: true });
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (engine === 'omp') {
|
|
128
|
+
const capability = await localDictationCapability();
|
|
129
|
+
if (!capability.available) {
|
|
130
|
+
send({ type: 'error', error: capability.reason ?? 'Local speech-to-text is unavailable.', retryable: false });
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const apiKey = engine === 'omp' ? undefined : ((await readDictationApiKey()) ?? undefined);
|
|
136
|
+
if (spec.needsKey && !apiKey) {
|
|
137
|
+
send({
|
|
138
|
+
type: 'error',
|
|
139
|
+
error: `${spec.label} needs an API key. Add one in Settings → Dictation.`,
|
|
140
|
+
retryable: false,
|
|
141
|
+
});
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const language = resolveDictationTag(
|
|
146
|
+
engine,
|
|
147
|
+
state.request.language ?? config.language,
|
|
148
|
+
engine === 'omp' ? await readOmpSttLanguage() : undefined,
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
if (engine !== 'omp') {
|
|
152
|
+
// A hosted engine has no model to download; the wait is the upload and
|
|
153
|
+
// the decode, and saying so is the whole status line.
|
|
154
|
+
send({ type: 'progress', percent: null, decoding: true });
|
|
155
|
+
}
|
|
85
156
|
|
|
86
157
|
try {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
158
|
+
const text = await transcribeWithEngine({
|
|
159
|
+
engine,
|
|
160
|
+
pcm16: raw,
|
|
161
|
+
model: resolveDictationModel(engine, state.request.model ?? config.model),
|
|
162
|
+
baseUrl: config.baseUrl,
|
|
163
|
+
prompt: config.prompt,
|
|
164
|
+
apiKey,
|
|
165
|
+
...(language ? { language } : {}),
|
|
94
166
|
onProgress: (event) => {
|
|
95
167
|
const summary = summarizeProgress(event);
|
|
96
168
|
if (!shouldEmitProgress(state, summary)) return;
|
|
@@ -109,7 +181,7 @@ export const dictationWsRoutes = new Elysia({ prefix: '/api/dictation' }).ws('/w
|
|
|
109
181
|
send({
|
|
110
182
|
type: 'error',
|
|
111
183
|
error: error instanceof Error ? error.message : 'Speech transcription failed.',
|
|
112
|
-
retryable: true,
|
|
184
|
+
retryable: error instanceof DictationEngineError ? error.retryable : true,
|
|
113
185
|
});
|
|
114
186
|
}
|
|
115
187
|
},
|
|
@@ -18,6 +18,7 @@ import { telemetryBindings } from '@/server/routes/telemetry';
|
|
|
18
18
|
import { terminalBindings } from '@/server/routes/terminal';
|
|
19
19
|
import { terminalWsRoutes } from '@/server/routes/terminal/ws';
|
|
20
20
|
import { dictationWsRoutes } from '@/server/routes/dictation/ws';
|
|
21
|
+
import { ttsBindings } from '@/server/routes/tts';
|
|
21
22
|
import { browserBindings } from '@/server/routes/browser';
|
|
22
23
|
import { modelsBindings } from '@/server/routes/models';
|
|
23
24
|
import { ompBindings } from '@/server/routes/omp';
|
|
@@ -46,6 +47,7 @@ const allBindings: HandlerBinding[] = [
|
|
|
46
47
|
...scheduleBindings,
|
|
47
48
|
...waitingBindings,
|
|
48
49
|
...settingsBindings,
|
|
50
|
+
...ttsBindings,
|
|
49
51
|
...fsBindings,
|
|
50
52
|
...foldersBindings,
|
|
51
53
|
...worktreesBindings,
|
|
@@ -236,3 +236,113 @@ describe('the install route', () => {
|
|
|
236
236
|
expect((await discoverPanelPlugins()).syncBlocked).toEqual({});
|
|
237
237
|
});
|
|
238
238
|
});
|
|
239
|
+
|
|
240
|
+
describe('the registry verbs', () => {
|
|
241
|
+
const realFetch = globalThis.fetch;
|
|
242
|
+
|
|
243
|
+
/** Every raw catalog path answers 404, so the repository offers itself. */
|
|
244
|
+
function stubNoCatalog(): void {
|
|
245
|
+
globalThis.fetch = (async () => new Response('not found', { status: 404 })) as unknown as typeof fetch;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
test('register_registry writes the registration and lists the repository', async () => {
|
|
249
|
+
stubNoCatalog();
|
|
250
|
+
try {
|
|
251
|
+
const response = await post(installAction, { type: 'register_registry', repo: 'acme/kabmo-plugins-kanban' });
|
|
252
|
+
expect(response.status).toBe(200);
|
|
253
|
+
const body = (await response.json()) as {
|
|
254
|
+
ok: boolean;
|
|
255
|
+
registries: Array<{ repo: string; name: string; pluginCount: number; error?: string }>;
|
|
256
|
+
catalog: Array<{ pluginId: string; url?: string; origin: string; installed: boolean }>;
|
|
257
|
+
};
|
|
258
|
+
expect(body.ok).toBe(true);
|
|
259
|
+
expect(body.registries).toMatchObject([
|
|
260
|
+
{ repo: 'acme/kabmo-plugins-kanban', name: 'kanban', pluginCount: 1 },
|
|
261
|
+
]);
|
|
262
|
+
// The offer the pane shows, installable by URL — and the plugin name has
|
|
263
|
+
// no prefix, which is the whole point of the rule.
|
|
264
|
+
expect(body.catalog).toMatchObject([
|
|
265
|
+
{ pluginId: 'kanban', url: 'https://github.com/acme/kabmo-plugins-kanban', origin: 'git', installed: false },
|
|
266
|
+
]);
|
|
267
|
+
|
|
268
|
+
const catalog = JSON.parse(fs.readFileSync(join(dirs.root, 'marketplace.json'), 'utf8')) as {
|
|
269
|
+
registries: Array<{ repo: string }>;
|
|
270
|
+
};
|
|
271
|
+
expect(catalog.registries).toEqual([{ repo: 'acme/kabmo-plugins-kanban' }]);
|
|
272
|
+
} finally {
|
|
273
|
+
globalThis.fetch = realFetch;
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
test('register_registry refuses a repository that breaks the naming rule', async () => {
|
|
278
|
+
const response = await post(installAction, { type: 'register_registry', repo: 'acme/kanban' });
|
|
279
|
+
expect(response.status).toBe(400);
|
|
280
|
+
expect(((await response.json()) as { error: string }).error).toContain('kabmo-plugins-');
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
test('register_registry keeps the registration when the read fails, and says why', async () => {
|
|
284
|
+
globalThis.fetch = (async () => {
|
|
285
|
+
throw new Error('connect ETIMEDOUT');
|
|
286
|
+
}) as unknown as typeof fetch;
|
|
287
|
+
try {
|
|
288
|
+
const response = await post(installAction, { type: 'register_registry', repo: 'acme/kabmo-plugins-kanban' });
|
|
289
|
+
// A 200: the WRITE succeeded. The failed READ travels as a warning, because
|
|
290
|
+
// refusing here would lose a registration the user asked for.
|
|
291
|
+
expect(response.status).toBe(200);
|
|
292
|
+
const body = (await response.json()) as {
|
|
293
|
+
ok: boolean;
|
|
294
|
+
error?: string;
|
|
295
|
+
registries: Array<{ repo: string; pluginCount: number; error?: string }>;
|
|
296
|
+
};
|
|
297
|
+
expect(body.ok).toBe(true);
|
|
298
|
+
expect(body.error).toContain('ETIMEDOUT');
|
|
299
|
+
expect(body.registries).toMatchObject([{ repo: 'acme/kabmo-plugins-kanban', pluginCount: 0 }]);
|
|
300
|
+
expect(body.registries[0]?.error).toContain('ETIMEDOUT');
|
|
301
|
+
} finally {
|
|
302
|
+
globalThis.fetch = realFetch;
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
test('remove_registry drops the registration and its cached offers', async () => {
|
|
307
|
+
stubNoCatalog();
|
|
308
|
+
try {
|
|
309
|
+
await post(installAction, { type: 'register_registry', repo: 'acme/kabmo-plugins-kanban' });
|
|
310
|
+
expect((await discoverPanelPlugins()).catalog).toHaveLength(1);
|
|
311
|
+
|
|
312
|
+
const response = await post(installAction, { type: 'remove_registry', repo: 'acme/kabmo-plugins-kanban' });
|
|
313
|
+
expect(response.status).toBe(200);
|
|
314
|
+
const body = (await response.json()) as { ok: boolean; registries: unknown[]; catalog: unknown[] };
|
|
315
|
+
expect(body.ok).toBe(true);
|
|
316
|
+
expect(body.registries).toEqual([]);
|
|
317
|
+
expect(body.catalog).toEqual([]);
|
|
318
|
+
} finally {
|
|
319
|
+
globalThis.fetch = realFetch;
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
test('refresh_registry re-reads one repository and answers the payload', async () => {
|
|
324
|
+
stubNoCatalog();
|
|
325
|
+
try {
|
|
326
|
+
await post(installAction, { type: 'register_registry', repo: 'acme/kabmo-plugins-kanban' });
|
|
327
|
+
const response = await post(installAction, { type: 'refresh_registry', repo: 'acme/kabmo-plugins-kanban' });
|
|
328
|
+
expect(response.status).toBe(200);
|
|
329
|
+
const body = (await response.json()) as { ok: boolean; registries: Array<{ fetchedAt?: string }> };
|
|
330
|
+
expect(body.ok).toBe(true);
|
|
331
|
+
expect(body.registries[0]?.fetchedAt).toBeTruthy();
|
|
332
|
+
} finally {
|
|
333
|
+
globalThis.fetch = realFetch;
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
test('installing an unknown plugin NAME refuses by naming the remedy', async () => {
|
|
338
|
+
const response = await post(installAction, { type: 'install', spec: 'kanban' });
|
|
339
|
+
expect(response.status).toBe(400);
|
|
340
|
+
const body = (await response.json()) as { error: string };
|
|
341
|
+
expect(body.error).toContain('No plugin named "kanban"');
|
|
342
|
+
expect(body.error).toContain('register its repository');
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
test('an install with no spec, url or plugin id is refused', async () => {
|
|
346
|
+
expect((await post(installAction, { type: 'install' })).status).toBe(400);
|
|
347
|
+
});
|
|
348
|
+
});
|