@kabmo-labs/kabmo 0.47.0 → 0.48.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 +497 -497
- package/dist/client/static/js/Body-3tspyjtk.js +3 -0
- package/dist/client/static/js/{CsvGrid-vfgttmym.js → CsvGrid-3pwsfmxp.js} +2 -2
- package/dist/client/static/js/{DocxView-dc41t6rp.js → DocxView-xcg9jktb.js} +3 -3
- package/dist/client/static/js/{DrawioView-wpwr38d9.js → DrawioView-2q19tgkx.js} +2 -2
- package/dist/client/static/js/{HtmlPreview-23n7t5cs.js → HtmlPreview-92cadvbr.js} +1 -1
- package/dist/client/static/js/ImageView-pr4h38hb.js +1 -0
- package/dist/client/static/js/LayoutWrapper-n4tzhjes.js +2 -0
- package/dist/client/static/js/MergeDiffView-0t15nh9f.js +1 -0
- package/dist/client/static/js/{Modal-dsqhas10.js → Modal-77hgx4dw.js} +20 -20
- package/dist/client/static/js/{PdfView-cpvsbfk0.js → PdfView-gzxhvxe8.js} +1 -1
- package/dist/client/static/js/{SessionsView-s0crtcm8.js → SessionsView-2tdqrvk0.js} +1 -1
- package/dist/client/static/js/{SheetView-n6mst0hq.js → SheetView-w5w2m2de.js} +21 -21
- package/dist/client/static/js/{SvgPreview-g2aqq812.js → SvgPreview-mtk6de6h.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-3vac8sq4.js → abnfDiagram-O67JEVCF-tha4j2fn.js} +1 -1
- package/dist/client/static/js/architecture-7GRP2DOG-zs15nydj.js +1 -0
- package/dist/client/static/js/{architectureDiagram-NJMV4G6O-1nh4htz2.js → architectureDiagram-NJMV4G6O-heep78p6.js} +6 -6
- package/dist/client/static/js/{astro-63zcysj7.js → astro-r4dp34pw.js} +1 -1
- package/dist/client/static/js/bash-8d3wrx5c.js +1 -0
- package/dist/client/static/js/{blockDiagram-BEXU5L5S-62z6kaar.js → blockDiagram-BEXU5L5S-6mzgfqh8.js} +5 -5
- package/dist/client/static/js/c-rn3z0csz.js +1 -0
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-rts5zgx4.js → c4Diagram-YGBWAQC7-sfkcw7g9.js} +4 -4
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-tnpww186.js → classDiagram-v2-NBCMYWYE-v530ny5e.js} +6 -6
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-8vsjbzwa.js → cose-bilkent-JH36ORCC-ybv1ttbx.js} +1 -1
- package/dist/client/static/js/cpp-99ws9nak.js +1 -0
- package/dist/client/static/js/css-narcr42w.js +1 -0
- package/dist/client/static/js/cynefin-OW5HDTMX-p3y1b4ap.js +1 -0
- package/dist/client/static/js/{cynefinDiagram-VND7K2PF-005gc8km.js → cynefinDiagram-VND7K2PF-k8f3z0mm.js} +2 -2
- package/dist/client/static/js/{dagre-6A5THRUB-41zsteyd.js → dagre-6A5THRUB-gk0gp124.js} +2 -2
- package/dist/client/static/js/{diagram-22UHCM2B-prsm18a1.js → diagram-22UHCM2B-2zh2957c.js} +15 -15
- package/dist/client/static/js/{diagram-3UASUU5V-5nx9wf04.js → diagram-3UASUU5V-bzstt5e2.js} +2 -2
- package/dist/client/static/js/{diagram-ATOU4E4O-k3d4z3aq.js → diagram-ATOU4E4O-16adx4g0.js} +3 -3
- package/dist/client/static/js/{diagram-CDSNMT55-x2c5x5j2.js → diagram-CDSNMT55-1ja98ens.js} +5 -5
- package/dist/client/static/js/{diagram-MLGK6HIB-nvr76jqh.js → diagram-MLGK6HIB-f9nnyjbq.js} +2 -2
- package/dist/client/static/js/{diagram-MPIPVDR6-v1jpzp9p.js → diagram-MPIPVDR6-3qgadfjz.js} +2 -2
- package/dist/client/static/js/{dockerfile-vz6va73h.js → dockerfile-04tc68pq.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-0v4tqr9v.js → ebnfDiagram-ZINNZB2B-022cz603.js} +1 -1
- package/dist/client/static/js/{elixir-80wq7gak.js → elixir-61gbjv6c.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-qfn4r7xj.js → elk-276RUBZZ-2anf1c36.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-cd667n9f.js → erDiagram-OPXOYQCR-ndd27fz1.js} +7 -7
- package/dist/client/static/js/{erlang-vk66vt7q.js → erlang-bh5cbm8m.js} +1 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-sx2cwkz3.js +1 -0
- package/dist/client/static/js/flowDiagram-KWPJA3E3-dsc17mty.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-ps0h3drm.js → ganttDiagram-FUAMR5RP-9gm6hkgn.js} +4 -4
- package/dist/client/static/js/gitGraph-4MIJSDKK-yqhbscsd.js +1 -0
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-fts23jer.js → gitGraphDiagram-X574FWY7-78bxa67c.js} +8 -8
- package/dist/client/static/js/graphql-tr0jcndy.js +1 -0
- package/dist/client/static/js/html-n8fdvrdk.js +1 -0
- package/dist/client/static/js/index-0e51wknc.js +10 -0
- package/dist/client/static/js/{index-7zedprz3.js → index-13g17wa3.js} +1 -1
- package/dist/client/static/js/index-1hb8fvw9.js +1 -0
- package/dist/client/static/js/{index-1c2jvnyh.js → index-2bsnywea.js} +2 -2
- package/dist/client/static/js/{index-9ab6xaxd.js → index-2n1fgpjv.js} +2 -2
- package/dist/client/static/js/{index-a4h5np9r.js → index-30a8py59.js} +2 -2
- package/dist/client/static/js/{index-e5j5gc4h.js → index-34aq5bz5.js} +2 -2
- package/dist/client/static/js/index-3en15m75.js +2 -0
- package/dist/client/static/js/{index-64p1dncg.js → index-417fbrqk.js} +2 -2
- package/dist/client/static/js/{index-z4530r3c.js → index-45p59fxq.js} +2 -2
- package/dist/client/static/js/index-4n7t26ap.js +2 -0
- package/dist/client/static/js/{index-1whzs9kb.js → index-55pqvh82.js} +2 -2
- package/dist/client/static/js/index-5mpv57fn.js +12 -0
- package/dist/client/static/js/{index-tqgj7rd9.js → index-7pz6n3pg.js} +2 -2
- package/dist/client/static/js/{index-4jzsr1ky.js → index-7whstwc7.js} +2 -2
- package/dist/client/static/js/index-869vdnz8.js +2 -0
- package/dist/client/static/js/{index-52nd4hgm.js → index-8tvrzce0.js} +2 -2
- package/dist/client/static/js/index-9a78xmkk.js +462 -0
- package/dist/client/static/js/{index-33qxg79j.js → index-a58rkn3f.js} +5 -5
- package/dist/client/static/js/{index-9xsf8162.js → index-aa3hmn6j.js} +65 -65
- package/dist/client/static/js/{index-dxkefysk.js → index-aabp7nt6.js} +1 -1
- package/dist/client/static/js/{index-c5hjht5e.js → index-abrrqhne.js} +2 -2
- package/dist/client/static/js/{index-an2wv33f.js → index-ac2q5903.js} +2 -2
- package/dist/client/static/js/index-axtm1aq8.js +2 -0
- package/dist/client/static/js/index-b2cs4c51.js +4 -0
- package/dist/client/static/js/{index-xk1cqjkn.js → index-c250nzm1.js} +3 -3
- package/dist/client/static/js/{index-56rtb871.js → index-dxnkwf39.js} +52 -52
- package/dist/client/static/js/{index-39d8zbkx.js → index-e6ny4gd9.js} +6 -6
- package/dist/client/static/js/index-ebf50mrs.js +9 -0
- package/dist/client/static/js/{index-g4kkapka.js → index-ep6bqcmg.js} +2 -2
- package/dist/client/static/js/{index-396r53n0.js → index-fb2s080r.js} +2 -2
- package/dist/client/static/js/index-fryp0kgf.js +2 -0
- package/dist/client/static/js/{index-evmcc5qh.js → index-g3rg6vsd.js} +2 -2
- package/dist/client/static/js/{index-sa1675y0.js → index-g8rpydkr.js} +2 -2
- package/dist/client/static/js/{index-zhjjpvcc.js → index-gkmn4y1v.js} +1 -1
- package/dist/client/static/js/{index-0dkc6z8e.js → index-gpmcth0x.js} +2 -2
- package/dist/client/static/js/{index-62jgcgfd.js → index-hcmhdpp4.js} +10 -10
- package/dist/client/static/js/{index-fxd8dfj4.js → index-he4k2j91.js} +2 -2
- package/dist/client/static/js/{index-x0xspam4.js → index-hq28918s.js} +2 -2
- package/dist/client/static/js/{index-c63qyysm.js → index-hwzxdwwg.js} +1 -1
- package/dist/client/static/js/{index-4wnzs76g.js → index-jnkc9p53.js} +1 -1
- package/dist/client/static/js/{index-54mkp2r2.js → index-k39be93q.js} +1 -1
- package/dist/client/static/js/{index-y6ke70e6.js → index-kaxvwh07.js} +2 -2
- package/dist/client/static/js/{index-7zeah164.js → index-kjr68pcj.js} +2 -2
- package/dist/client/static/js/{index-cra9mgkq.js → index-m0fatq7c.js} +4 -4
- package/dist/client/static/js/{index-ccgzzydx.js → index-m39gbcxn.js} +1 -1
- package/dist/client/static/js/{index-q4ke39rh.js → index-mqzgf7rw.js} +2 -2
- package/dist/client/static/js/{index-dzeyd153.js → index-pzsp1src.js} +2 -2
- package/dist/client/static/js/{index-n1yr4khe.js → index-qe0vfv6s.js} +1 -1
- package/dist/client/static/js/{index-6009v8jf.js → index-qek9mt5w.js} +1 -1
- package/dist/client/static/js/{index-nkahe229.js → index-qxzj780x.js} +2 -2
- package/dist/client/static/js/{index-cvyqp8nz.css → index-rgxg0azs.css} +1 -1
- package/dist/client/static/js/{index-1d8bxjsz.js → index-rq4dk4tp.js} +4 -4
- package/dist/client/static/js/{index-6d6hxwb5.js → index-seekt5k3.js} +2 -2
- package/dist/client/static/js/{index-gzkzwgzv.js → index-sng4prpr.js} +2 -2
- package/dist/client/static/js/{index-dyc886cc.js → index-t4s10406.js} +2 -2
- package/dist/client/static/js/{index-f2ahkev0.js → index-tzz5gp8a.js} +5 -5
- package/dist/client/static/js/index-vnv9z0a1.js +1 -0
- package/dist/client/static/js/{index-70g527sb.js → index-x7rajphe.js} +2 -2
- package/dist/client/static/js/{index-5f4b44ay.js → index-xny7vsfz.js} +2 -2
- package/dist/client/static/js/index-xr4hjv01.js +2 -0
- package/dist/client/static/js/{index-fjex1y0t.js → index-ya9yqj5w.js} +2 -2
- package/dist/client/static/js/{index-z0fkfphe.js → index-zcgqacvx.js} +2 -2
- package/dist/client/static/js/info-A6RAGUB7-0sd3zzgg.js +1 -0
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-88qbtpq5.js → infoDiagram-VRGFBTTK-bxk0g0pe.js} +2 -2
- package/dist/client/static/js/ini-tnaw7zjy.js +1 -0
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-s8bagk00.js → ishikawaDiagram-OU5B5YK6-d1kdkhth.js} +3 -3
- package/dist/client/static/js/java-m4dpc2vw.js +1 -0
- package/dist/client/static/js/javascript-8y26t991.js +1 -0
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-hz8z0b9x.js → journeyDiagram-ZHPQQLJL-cahg3zjq.js} +4 -4
- package/dist/client/static/js/json-azm7bdqd.js +1 -0
- package/dist/client/static/js/jsx-p9j1k773.js +1 -0
- package/dist/client/static/js/{julia-dm0j9apa.js → julia-2n5k898q.js} +1 -1
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-sjjnjb51.js → kanban-definition-PNTS6WVX-nq7t83en.js} +6 -6
- package/dist/client/static/js/lua-hbm9rhz9.js +1 -0
- package/dist/client/static/js/markdown-tk3cd3vs.js +1 -0
- package/dist/client/static/js/{mermaid.core-zvwygxbh.js → mermaid.core-6nw0853j.js} +8 -8
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-kgj8enan.js → mindmap-definition-NLK3R4M7-cm7ykxf2.js} +3 -3
- package/dist/client/static/js/one-dark-pro-2cdc2nk7.js +1 -0
- package/dist/client/static/js/one-light-bt6z4jf0.js +1 -0
- package/dist/client/static/js/packet-AYTQ26CC-13w2v5bb.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-gxzw1qwa.js → pegDiagram-GJSIUBJH-xwxz8nsq.js} +1 -1
- package/dist/client/static/js/{perl-4jcm2jxv.js → perl-66vb5pz7.js} +1 -1
- package/dist/client/static/js/{php-q32mec74.js → php-4e9we8am.js} +1 -1
- package/dist/client/static/js/pie-WAS4IAKB-swtnysgn.js +1 -0
- package/dist/client/static/js/{pieDiagram-5QR66LMP-pdqwyqcm.js → pieDiagram-5QR66LMP-n910k9th.js} +3 -3
- package/dist/client/static/js/properties-6911ckw7.js +1 -0
- package/dist/client/static/js/python-44cvj250.js +1 -0
- package/dist/client/static/js/{quadrantDiagram-O4NWA36T-yx2t364p.js → quadrantDiagram-O4NWA36T-dxkwxbqb.js} +6 -6
- package/dist/client/static/js/r-t3sepzm4.js +1 -0
- package/dist/client/static/js/radar-RG4KPBEZ-vtvxkx55.js +1 -0
- package/dist/client/static/js/railroad-74A4TZTK-5sp2d63r.js +1 -0
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-kg706fan.js +1 -0
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-4ra1gzx5.js +1 -0
- package/dist/client/static/js/railroad-peg-WCYAUIDC-hms3zpjm.js +1 -0
- package/dist/client/static/js/{railroadDiagram-XR7U4H2S-800fdzkr.js → railroadDiagram-XR7U4H2S-xb1smt7r.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-vc5rpgtm.js → requirementDiagram-PLB6GJNP-6kb21b9f.js} +6 -6
- package/dist/client/static/js/{ruby-npmpb290.js → ruby-v7nmcvyr.js} +1 -1
- package/dist/client/static/js/{rust-waks43wh.js → rust-5ersd7be.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-ccjk8zgn.js → sankeyDiagram-IPEJSGJF-74z0fskw.js} +4 -4
- package/dist/client/static/js/{sass-502a4r7y.js → sass-h3nvy4c8.js} +1 -1
- package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-c0tk7gfn.js → sequenceDiagram-PO4LG4MO-apn6kezn.js} +17 -17
- package/dist/client/static/js/{sizeCapture-INFHLROL-fma9p1vy.js → sizeCapture-INFHLROL-2drzcjb8.js} +1 -1
- package/dist/client/static/js/sql-zdkawqx3.js +1 -0
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-d8f24b7j.js → stateDiagram-v2-GCMORJYK-ma09vhby.js} +3 -3
- package/dist/client/static/js/{svelte-c15d0421.js → svelte-dhspkgss.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-sdt7qy36.js → swimlanes-2SLR337P-f6y9xqnx.js} +1 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-3dwas56m.js +8 -0
- package/dist/client/static/js/{timeline-definition-EJHVYXUP-rv8qyr8b.js → timeline-definition-EJHVYXUP-zmcmvq00.js} +5 -5
- package/dist/client/static/js/treeView-Q6P3EWNA-7t5k6rs2.js +1 -0
- package/dist/client/static/js/treemap-WGGIJYW6-w56ry3bg.js +1 -0
- package/dist/client/static/js/tsx-b7eabr17.js +1 -0
- package/dist/client/static/js/typescript-nnkvhwfy.js +1 -0
- package/dist/client/static/js/{usecaseDiagram-POWQR4AR-w6ew1red.js → usecaseDiagram-POWQR4AR-wfaa019a.js} +24 -24
- package/dist/client/static/js/{vennDiagram-UO4OBE2U-p9axw7ch.js → vennDiagram-UO4OBE2U-46wf2pgd.js} +8 -8
- package/dist/client/static/js/{vue-xpemy62d.js → vue-ffngx2b3.js} +1 -1
- package/dist/client/static/js/wardley-WFR3VGLG-rtjb9kgv.js +1 -0
- package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-5ewc8s4p.js → wardleyDiagram-VNRHLVJA-10ph3bzq.js} +4 -4
- package/dist/client/static/js/xml-xy1tw6b2.js +1 -0
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-7n4gn7k6.js → xychartDiagram-PMCCYNJV-2ba825z9.js} +5 -5
- package/dist/client/static/js/yaml-0fexqg2d.js +1 -0
- package/package.json +1 -1
- 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/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/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/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/shared/lib/omp/config/schema-releases.test.ts +22 -0
- package/src/shared/types/settings/usage.ts +89 -2
- 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/architecture-7GRP2DOG-b5w9mnn5.js +0 -1
- 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-x7gyc3ta.js +0 -1
- package/dist/client/static/js/cynefin-OW5HDTMX-kdj8rjc1.js +0 -1
- 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-3nsrnyqr.js +0 -2
- package/dist/client/static/js/index-4x9p7hf9.js +0 -2
- 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/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
|
@@ -23,6 +23,8 @@ import { describe, expect, test } from 'bun:test';
|
|
|
23
23
|
import {
|
|
24
24
|
formatAmount,
|
|
25
25
|
formatCompactTokens,
|
|
26
|
+
formatCurrency,
|
|
27
|
+
formatDate,
|
|
26
28
|
formatDateTime,
|
|
27
29
|
formatFractionPercent,
|
|
28
30
|
formatNumber,
|
|
@@ -70,6 +72,15 @@ describe('usage number formatting', () => {
|
|
|
70
72
|
expect(formatDateTime('not-a-date')).toBe('not-a-date');
|
|
71
73
|
});
|
|
72
74
|
|
|
75
|
+
test('formatDate keeps the year and drops the clock, in any locale', () => {
|
|
76
|
+
// Cutting `formatDateTime` at a comma would lose the year wherever the
|
|
77
|
+
// locale puts it after the comma (en-US: "Mar 5, 2024, 5:30 PM").
|
|
78
|
+
const date = formatDate('2024-03-05T10:30:00Z');
|
|
79
|
+
expect(date).toContain('2024');
|
|
80
|
+
expect(date).not.toContain(':');
|
|
81
|
+
expect(formatDate('not-a-date')).toBe('not-a-date');
|
|
82
|
+
});
|
|
83
|
+
|
|
73
84
|
test('usedPercent clamps to 0..100 and divides by zero safely', () => {
|
|
74
85
|
expect(usedPercent(50, 100)).toBe(50);
|
|
75
86
|
expect(usedPercent(150, 100)).toBe(100);
|
|
@@ -109,9 +120,18 @@ describe('usage number formatting', () => {
|
|
|
109
120
|
expect(formatUsd(Number.NaN)).toBe('$0,00');
|
|
110
121
|
});
|
|
111
122
|
|
|
123
|
+
test('formatCurrency delegates IDR and USD, and never invents a symbol', () => {
|
|
124
|
+
expect(formatCurrency(8827, 'IDR').replace(/\s/g, '')).toBe('Rp8.827');
|
|
125
|
+
expect(formatCurrency(12.5, 'usd')).toBe('$12,50');
|
|
126
|
+
// An unknown ISO code must not throw inside a render.
|
|
127
|
+
expect(formatCurrency(5, 'ZZZ')).toContain('ZZZ');
|
|
128
|
+
expect(formatCurrency(Number.NaN, 'IDR')).toBe('—');
|
|
129
|
+
});
|
|
130
|
+
|
|
112
131
|
test('formatUsageAmount dispatches on the unit and guards non-finite values', () => {
|
|
113
132
|
expect(formatUsageAmount(50, 'percent')).toBe('50%');
|
|
114
133
|
expect(formatUsageAmount(12.5, 'usd')).toBe('$12,50');
|
|
134
|
+
expect(formatUsageAmount(8827, 'idr').replace(/\s/g, '')).toBe('Rp8.827');
|
|
115
135
|
expect(formatUsageAmount(61950, 'tokens')).toBe('61,95K');
|
|
116
136
|
expect(formatUsageAmount(61950, 'bytes')).toBe('61,95K');
|
|
117
137
|
expect(formatUsageAmount(61950, 'requests')).toBe('61.950');
|
|
@@ -180,6 +200,52 @@ describe('buildProviders', () => {
|
|
|
180
200
|
expect(entry?.hint).toBe('USD 12,34');
|
|
181
201
|
});
|
|
182
202
|
|
|
203
|
+
test('a TokenPortal wallet is the hint, in the currency the endpoint named', () => {
|
|
204
|
+
const entry = buildProviders({
|
|
205
|
+
isMock: false,
|
|
206
|
+
generatedAt: '',
|
|
207
|
+
providers: [
|
|
208
|
+
summary({
|
|
209
|
+
id: 'tokenportal',
|
|
210
|
+
name: 'Tokenportal',
|
|
211
|
+
tokenPortal: {
|
|
212
|
+
balance: {
|
|
213
|
+
label: 'Kabmo',
|
|
214
|
+
currency: 'IDR',
|
|
215
|
+
balance: 8827,
|
|
216
|
+
limit: null,
|
|
217
|
+
limitRemaining: 8827,
|
|
218
|
+
isFreeTier: false,
|
|
219
|
+
sessionBudget: null,
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
}),
|
|
223
|
+
],
|
|
224
|
+
})[0];
|
|
225
|
+
// Rp, not $: the live endpoint reports whole Rupiah.
|
|
226
|
+
expect(entry?.hint.replace(/\s/g, '')).toBe('Rp8.827');
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
test('a Rupiah credit window with no rich report keeps its Rupiah hint', () => {
|
|
230
|
+
const entry = buildProviders({
|
|
231
|
+
isMock: false,
|
|
232
|
+
generatedAt: '',
|
|
233
|
+
providers: [summary({ limits: [window({ unit: 'idr', remaining: 15000, label: 'Credit' })] })],
|
|
234
|
+
})[0];
|
|
235
|
+
expect(entry?.hint.replace(/\s/g, '')).toBe('Rp15.000left');
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
test('a tracked Command Code with an OAuth login asks for an API key', () => {
|
|
239
|
+
const entry = buildProviders({
|
|
240
|
+
isMock: false,
|
|
241
|
+
generatedAt: '',
|
|
242
|
+
providers: [summary({ id: 'commandcode', name: 'Command Code', tracked: true, limitsUnavailable: true })],
|
|
243
|
+
})[0];
|
|
244
|
+
// "No quota reported" would claim the plan has none; the credential type is
|
|
245
|
+
// what is missing.
|
|
246
|
+
expect(entry?.hint).toBe('API key needed');
|
|
247
|
+
});
|
|
248
|
+
|
|
183
249
|
test('the hint reports the WORST used fraction, not the first window', () => {
|
|
184
250
|
const entry = buildProviders({
|
|
185
251
|
isMock: false,
|
package/src/client/components/workspace/chat-timeline/tool-renderers/shared/DiffView.test.ts
CHANGED
|
@@ -50,12 +50,25 @@ afterAll(() => {
|
|
|
50
50
|
/** omp's excerpt diff, long enough to overflow any ceiling. */
|
|
51
51
|
const EXCERPT = Array.from({ length: 120 }, (_, i) => `${i + 1}|line ${i + 1}`).join('\n');
|
|
52
52
|
|
|
53
|
+
/**
|
|
54
|
+
* The merge view is `lazy()` (it carries CodeMirror, and that is what keeps the
|
|
55
|
+
* editor out of the boot chunk). Hold the same module promise the lazy import
|
|
56
|
+
* resolves, so the test can await the chunk instead of sleeping on it.
|
|
57
|
+
*/
|
|
58
|
+
const MERGE_VIEW = import('@/client/components/workspace/diff-panel/MergeDiffView');
|
|
59
|
+
|
|
53
60
|
async function mount(text = EXCERPT) {
|
|
54
61
|
container = document.createElement('div');
|
|
55
62
|
document.body.appendChild(container);
|
|
56
63
|
await act(async () => {
|
|
57
64
|
render(h(DiffView, { text, path: 'src/x.ts' }), container);
|
|
58
65
|
});
|
|
66
|
+
// The assertions below are about the mounted view, not the fallback text:
|
|
67
|
+
// settle the lazy chunk, then let Preact's retry render flush.
|
|
68
|
+
await act(async () => {
|
|
69
|
+
await MERGE_VIEW;
|
|
70
|
+
});
|
|
71
|
+
await act(async () => {});
|
|
59
72
|
return container;
|
|
60
73
|
}
|
|
61
74
|
|
|
@@ -25,16 +25,31 @@
|
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
27
|
import { useMemo, useState } from 'preact/hooks';
|
|
28
|
-
import type
|
|
28
|
+
import { Suspense, lazy, type ReactNode } from 'preact/compat';
|
|
29
29
|
import { Columns2, Rows3, WrapText } from 'lucide-preact';
|
|
30
30
|
import { patchSides } from '@/shared/lib/fs/patch-sides';
|
|
31
31
|
import { excerptDiffToUnified, isExcerptDiff } from '@/shared/lib/fs/excerpt-diff';
|
|
32
32
|
import { getLanguageFromPath } from '@/shared/lib/code/language';
|
|
33
33
|
import { CopyButton } from '@/client/components/common/CopyButton';
|
|
34
|
-
import { MergeDiffView } from '@/client/components/workspace/diff-panel/MergeDiffView';
|
|
35
34
|
import { useEditorFontStack } from '@/client/hooks/editor/font';
|
|
36
35
|
import { EDITOR_DEFAULT_FONT_SIZE } from '@/shared/lib/code/editor/typography';
|
|
37
36
|
|
|
37
|
+
/**
|
|
38
|
+
* The merge view is CodeMirror, and a diff card is the ONLY thing on the boot
|
|
39
|
+
* path that pulled the editor in: `MergeDiffView` → `diff-panel/folding.ts` →
|
|
40
|
+
* `@codemirror/{view,state,language,merge}` was 302 KB of the 2.05 MB boot
|
|
41
|
+
* chunk, paid by every console load whether or not a chat ever drew a diff.
|
|
42
|
+
*
|
|
43
|
+
* `lazy()` here is what keeps that out of the entry: the chat's own card is the
|
|
44
|
+
* first thing to need it, so the chunk is fetched with the transcript instead
|
|
45
|
+
* of ahead of it. The fallback is the same patch as readable text, not a
|
|
46
|
+
* spinner — a card that is already on screen should show its bytes while the
|
|
47
|
+
* editor loads.
|
|
48
|
+
*/
|
|
49
|
+
const MergeDiffView = lazy(() =>
|
|
50
|
+
import('@/client/components/workspace/diff-panel/MergeDiffView').then((m) => ({ default: m.MergeDiffView })),
|
|
51
|
+
);
|
|
52
|
+
|
|
38
53
|
/** A small icon-only toolbar button, `aria-pressed` for its own state. */
|
|
39
54
|
function ToggleButton({
|
|
40
55
|
pressed,
|
|
@@ -157,22 +172,30 @@ export function DiffView({ text, path = '', maxHeightClass = 'max-h-72' }: DiffV
|
|
|
157
172
|
{/* No tab key: this diff lives inside a chat card, and the timeline —
|
|
158
173
|
not the card — is what the reader scrolls. No counts either: the
|
|
159
174
|
header above already prints them from the patch. */}
|
|
160
|
-
<
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
175
|
+
<Suspense
|
|
176
|
+
fallback={(
|
|
177
|
+
<pre className="h-full w-full overflow-auto p-2 font-mono text-[11px] leading-relaxed whitespace-pre-wrap break-all text-ink/70 select-text">
|
|
178
|
+
{unified}
|
|
179
|
+
</pre>
|
|
180
|
+
)}
|
|
181
|
+
>
|
|
182
|
+
<MergeDiffView
|
|
183
|
+
original={sides.original}
|
|
184
|
+
next={sides.next}
|
|
185
|
+
language={language}
|
|
186
|
+
viewMode={split ? 'split' : 'unified'}
|
|
187
|
+
// Collapsed gaps: the reconstructed sides carry blank padding up to
|
|
188
|
+
// each hunk's real line, so showing every row would draw thousands of
|
|
189
|
+
// empty lines between two changes.
|
|
190
|
+
contentMode="diff"
|
|
191
|
+
wordWrap={wordWrap}
|
|
192
|
+
ignoreWhitespace={false}
|
|
193
|
+
tabKey={null}
|
|
194
|
+
empty={false}
|
|
195
|
+
fontFamily={editorFontFamily}
|
|
196
|
+
fontSize={EDITOR_DEFAULT_FONT_SIZE}
|
|
197
|
+
/>
|
|
198
|
+
</Suspense>
|
|
176
199
|
</div>
|
|
177
200
|
</div>
|
|
178
201
|
);
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The editor pane's body, fetched when a document is actually opened.
|
|
8
|
+
*
|
|
9
|
+
* `Body` is where CodeMirror lives — the surface, the diff panel, the document
|
|
10
|
+
* viewers — so importing it statically put `@codemirror/*` in the editor chunk,
|
|
11
|
+
* and the editor column mounts on every console load, with or without a file
|
|
12
|
+
* open. Behind this boundary the column's empty state (`EmptyEditor`, no
|
|
13
|
+
* CodeMirror) is all a console visit pays for; the chunks arrive with the first
|
|
14
|
+
* file.
|
|
15
|
+
*
|
|
16
|
+
* It lives in its own module rather than in `index.tsx` because that file is at
|
|
17
|
+
* the repository's per-file ceiling, and the boundary plus its reason is the
|
|
18
|
+
* one thing here that needs to be read on its own.
|
|
19
|
+
*
|
|
20
|
+
* The fallback is the canvas the body would paint, never a spinner: the tab
|
|
21
|
+
* strip and the pane's frame are already on screen, and a spinner inside them
|
|
22
|
+
* would read as a loading file rather than a loading editor.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import { Suspense, lazy } from 'preact/compat';
|
|
26
|
+
import type { EditorBody } from '@/client/components/workspace/editor/Body';
|
|
27
|
+
|
|
28
|
+
const Body = lazy(() =>
|
|
29
|
+
import('@/client/components/workspace/editor/Body').then((m) => ({ default: m.EditorBody })),
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
type BodyProps = Parameters<typeof EditorBody>[0];
|
|
33
|
+
|
|
34
|
+
export function BodyLazy(props: BodyProps) {
|
|
35
|
+
return (
|
|
36
|
+
<Suspense fallback={<div className="h-full w-full" />}>
|
|
37
|
+
<Body {...props} />
|
|
38
|
+
</Suspense>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
@@ -6,7 +6,6 @@ import { useEditorFontStack } from '@/client/hooks/editor/font';
|
|
|
6
6
|
import { useEditorTheme } from '@/client/hooks/editor/theme';
|
|
7
7
|
import type { CodeSurfaceHandle } from '@/client/components/common/code-surface';
|
|
8
8
|
import { useActiveEditorPanel } from '@/client/components/workspace/plugin-panel/resolve';
|
|
9
|
-
import { EditorBody } from '@/client/components/workspace/editor/Body';
|
|
10
9
|
import { PluginColumn } from '@/client/components/workspace/editor/PluginColumn';
|
|
11
10
|
import { EmptyEditor } from '@/client/components/workspace/editor/EmptyEditor';
|
|
12
11
|
|
|
@@ -30,6 +29,7 @@ import { useCloseGuard } from '@/client/hooks/editor/use-close-guard';
|
|
|
30
29
|
import { useFileReviewMode } from '@/client/hooks/editor/use-file-review-mode';
|
|
31
30
|
import { useEditorPanelUi } from '@/client/hooks/editor/use-editor-panel-ui';
|
|
32
31
|
import type { EditorProps } from '@/client/components/workspace/editor/props';
|
|
32
|
+
import { BodyLazy } from '@/client/components/workspace/editor/BodyLazy';
|
|
33
33
|
|
|
34
34
|
export function Editor({
|
|
35
35
|
className = '',
|
|
@@ -319,7 +319,7 @@ export function Editor({
|
|
|
319
319
|
conflict={editor.conflict}
|
|
320
320
|
onReload={editor.resolveConflictByReload}
|
|
321
321
|
onKeepMine={editor.keepMineAgainstDisk}
|
|
322
|
-
body={<
|
|
322
|
+
body={<BodyLazy {...bodyProps} />}
|
|
323
323
|
saveAsOpen={panelUi.saveAsOpen}
|
|
324
324
|
onSaveAsClose={() => panelUi.setSaveAsOpen(false)}
|
|
325
325
|
onSavedAs={(path) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"source": "@oh-my-pi/pi-coding-agent 10 tabs /
|
|
2
|
+
"source": "@oh-my-pi/pi-coding-agent 10 tabs / 644 settings",
|
|
3
3
|
"tabs": [
|
|
4
4
|
{
|
|
5
5
|
"id": "appearance",
|
|
@@ -6600,6 +6600,17 @@
|
|
|
6600
6600
|
]
|
|
6601
6601
|
}
|
|
6602
6602
|
},
|
|
6603
|
+
"todo.backend": {
|
|
6604
|
+
"type": "string",
|
|
6605
|
+
"default": "native",
|
|
6606
|
+
"ui": {
|
|
6607
|
+
"tab": "tools",
|
|
6608
|
+
"group": "Todos",
|
|
6609
|
+
"label": "Todo Backend",
|
|
6610
|
+
"description": "Extension that the todo list is mirrored to; Native keeps it in the session only",
|
|
6611
|
+
"options": "runtime"
|
|
6612
|
+
}
|
|
6613
|
+
},
|
|
6603
6614
|
"tasks.todoClearDelay": {
|
|
6604
6615
|
"type": "number",
|
|
6605
6616
|
"default": 60,
|
|
@@ -6900,28 +6911,40 @@
|
|
|
6900
6911
|
"description": "Maximum screenshot height in pixels"
|
|
6901
6912
|
}
|
|
6902
6913
|
},
|
|
6903
|
-
"computer.
|
|
6914
|
+
"computer.takeover": {
|
|
6904
6915
|
"type": "enum",
|
|
6905
|
-
"default": "
|
|
6916
|
+
"default": "fallback",
|
|
6906
6917
|
"values": [
|
|
6907
|
-
"
|
|
6918
|
+
"fallback",
|
|
6919
|
+
"foreground",
|
|
6920
|
+
"always",
|
|
6908
6921
|
"refuse"
|
|
6909
6922
|
],
|
|
6910
6923
|
"ui": {
|
|
6911
6924
|
"tab": "tools",
|
|
6912
6925
|
"group": "Computer",
|
|
6913
|
-
"label": "Computer
|
|
6914
|
-
"description": "
|
|
6926
|
+
"label": "Computer Takeover",
|
|
6927
|
+
"description": "When window input takes over (the real pointer and keyboard; your Escape stops it) instead of running in the background",
|
|
6915
6928
|
"options": [
|
|
6916
6929
|
{
|
|
6917
|
-
"value": "
|
|
6918
|
-
"label": "
|
|
6919
|
-
"description": "
|
|
6930
|
+
"value": "fallback",
|
|
6931
|
+
"label": "Fallback",
|
|
6932
|
+
"description": "Background first; a call whose background route is unavailable briefly brings the target forward, then returns focus to your app (on macOS even if you kept typing). The agent may also ask for takeover on a call"
|
|
6933
|
+
},
|
|
6934
|
+
{
|
|
6935
|
+
"value": "foreground",
|
|
6936
|
+
"label": "Foreground",
|
|
6937
|
+
"description": "omp, never the agent, decides: take over input to a window already in front of you, and a call whose background route is unavailable; stay in the background otherwise"
|
|
6938
|
+
},
|
|
6939
|
+
{
|
|
6940
|
+
"value": "always",
|
|
6941
|
+
"label": "Always",
|
|
6942
|
+
"description": "omp, never the agent, decides: take over every window and element input call, bringing the target forward for that call and then returning focus to your app"
|
|
6920
6943
|
},
|
|
6921
6944
|
{
|
|
6922
6945
|
"value": "refuse",
|
|
6923
6946
|
"label": "Refuse",
|
|
6924
|
-
"description": "
|
|
6947
|
+
"description": "Never take over: a call whose background route is unavailable fails, and the agent's own takeover, raise, activating open, desktop input and macOS menus (context menus, popup and menu buttons; they take your keyboard while open) are refused too"
|
|
6925
6948
|
}
|
|
6926
6949
|
]
|
|
6927
6950
|
}
|
|
@@ -7,6 +7,24 @@ import { isRecord } from '@/shared/lib/util/guards';
|
|
|
7
7
|
|
|
8
8
|
const SETTINGS_KEY = 'omp_providers_config';
|
|
9
9
|
const MASKED_KEY_PATTERN = /•{3,}/;
|
|
10
|
+
/** omp reads a bare variable name in `apiKey` from the environment. */
|
|
11
|
+
const ENV_NAME_PATTERN = /^[A-Z][A-Z0-9_]*$/;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* A stored key value turned into the literal to send: a text key passes
|
|
15
|
+
* through, a masked placeholder is refused, and a bare environment-variable
|
|
16
|
+
* NAME is resolved (omp's own docs write `apiKey: TOKENPORTAL_API_KEY`, which
|
|
17
|
+
* omp resolves from the environment; sending the variable name itself answers
|
|
18
|
+
* 401 for a working setup).
|
|
19
|
+
*/
|
|
20
|
+
export function resolveStoredKey(value: string | null): string | null {
|
|
21
|
+
if (!value) return null;
|
|
22
|
+
const trimmed = value.trim();
|
|
23
|
+
if (!trimmed || MASKED_KEY_PATTERN.test(trimmed)) return null;
|
|
24
|
+
if (!ENV_NAME_PATTERN.test(trimmed)) return trimmed;
|
|
25
|
+
const fromEnv = Bun.env[trimmed];
|
|
26
|
+
return fromEnv && fromEnv.trim() ? fromEnv.trim() : null;
|
|
27
|
+
}
|
|
10
28
|
|
|
11
29
|
export interface ProviderEntry {
|
|
12
30
|
name: string;
|
|
@@ -24,6 +24,8 @@ import { readProviderIconUrls } from '@/server/lib/models/provider-icon.server';
|
|
|
24
24
|
import { buildDeepSeekReport } from '@/server/lib/usage/deepseek';
|
|
25
25
|
import { buildKenariReport } from '@/server/lib/usage/kenari';
|
|
26
26
|
import { buildNewApiReports } from '@/server/lib/usage/new-api';
|
|
27
|
+
import { allowanceWindows, buildTokenHarborReports } from '@/server/lib/usage/token-harbor';
|
|
28
|
+
import { buildTokenPortalReports, tokenPortalWindows } from '@/server/lib/usage/token-portal';
|
|
27
29
|
import { fetchOmpUsageSnapshot, type OmpUsageSnapshot } from '@/server/lib/usage/omp-usage.server';
|
|
28
30
|
import { fetchVendorBalance, type VendorBalance } from '@/server/lib/usage/vendor-balance.server';
|
|
29
31
|
import { kenariProviderSlugs, listCredentialedProviders, type CredentialedProvider } from '@/server/lib/usage/provider-key';
|
|
@@ -124,13 +126,15 @@ export async function buildUsageProviders(options: { force?: boolean } = {}): Pr
|
|
|
124
126
|
// one (`kenari2`) with no quota card while its key was never read. DeepSeek
|
|
125
127
|
// still resolves by its canonical slug.
|
|
126
128
|
const kenariSlugs = await kenariProviderSlugs(credentials.keys());
|
|
127
|
-
const [kenariReports, deepseek, balances, gateways] = await Promise.all([
|
|
129
|
+
const [kenariReports, deepseek, balances, gateways, tokenHarbor, tokenPortal] = await Promise.all([
|
|
128
130
|
Promise.all([...kenariSlugs].map(async (slug) => [slug, await buildKenariReport(slug)] as const)),
|
|
129
131
|
credentials.has('deepseek') ? buildDeepSeekReport() : Promise.resolve(null),
|
|
130
132
|
loadVendorBalances([...credentials.keys()]),
|
|
131
133
|
// Self-hosted relays answer on the provider's OWN base URL, so they cannot
|
|
132
134
|
// live in `vendor-balance`'s fixed-URL table.
|
|
133
135
|
buildNewApiReports(credentials.keys()),
|
|
136
|
+
buildTokenHarborReports(credentials.keys()),
|
|
137
|
+
buildTokenPortalReports(credentials.keys()),
|
|
134
138
|
]);
|
|
135
139
|
const kenariBySlug = new Map<string, KenariUsageReport>();
|
|
136
140
|
for (const [slug, report] of kenariReports) {
|
|
@@ -142,6 +146,10 @@ export async function buildUsageProviders(options: { force?: boolean } = {}): Pr
|
|
|
142
146
|
const report = snapshot.reports.get(slug);
|
|
143
147
|
const balance = balances.get(slug);
|
|
144
148
|
const gateway = gateways.get(slug);
|
|
149
|
+
const harbor = tokenHarbor.get(slug);
|
|
150
|
+
const harborWindows = harbor?.allowance ? allowanceWindows(harbor.allowance) : [];
|
|
151
|
+
const portal = tokenPortal.get(slug);
|
|
152
|
+
const portalWindows = portal?.balance ? tokenPortalWindows(portal.balance) : [];
|
|
145
153
|
const { tracked, limitsUnavailable } = resolveUsageTracking(slug, snapshot);
|
|
146
154
|
const summary: UsageProviderSummary = {
|
|
147
155
|
id: slug,
|
|
@@ -149,8 +157,18 @@ export async function buildUsageProviders(options: { force?: boolean } = {}): Pr
|
|
|
149
157
|
...(iconUrls.get(slug) ? { iconUrl: iconUrls.get(slug) } : {}),
|
|
150
158
|
credentialSources: sources,
|
|
151
159
|
// A vendor balance is real quota data even when omp has no adapter for it.
|
|
152
|
-
tracked: tracked
|
|
153
|
-
|
|
160
|
+
tracked: tracked
|
|
161
|
+
|| Boolean(balance?.limits.length)
|
|
162
|
+
|| Boolean(gateway?.limits.length)
|
|
163
|
+
|| harborWindows.length > 0
|
|
164
|
+
|| portalWindows.length > 0,
|
|
165
|
+
limits: [
|
|
166
|
+
...(report?.limits ?? []),
|
|
167
|
+
...(balance?.limits ?? []),
|
|
168
|
+
...(gateway?.limits ?? []),
|
|
169
|
+
...harborWindows,
|
|
170
|
+
...portalWindows,
|
|
171
|
+
],
|
|
154
172
|
...(limitsUnavailable ? { limitsUnavailable: true } : {}),
|
|
155
173
|
...(report?.notes ? { notes: report.notes } : {}),
|
|
156
174
|
};
|
|
@@ -162,6 +180,12 @@ export async function buildUsageProviders(options: { force?: boolean } = {}): Pr
|
|
|
162
180
|
} else if (slug === 'deepseek' && deepseek) {
|
|
163
181
|
summary.deepseek = deepseek;
|
|
164
182
|
if (deepseek.error) summary.error = deepseek.error;
|
|
183
|
+
} else if (harbor) {
|
|
184
|
+
summary.tokenHarbor = harbor;
|
|
185
|
+
if (harbor.error) summary.error = harbor.error;
|
|
186
|
+
} else if (portal) {
|
|
187
|
+
summary.tokenPortal = portal;
|
|
188
|
+
if (portal.error) summary.error = portal.error;
|
|
165
189
|
} else if (gateway?.error) {
|
|
166
190
|
summary.error = gateway.error;
|
|
167
191
|
} else if (balance?.error && !summary.error) {
|
|
@@ -68,6 +68,30 @@ export function mockUsageReport(): UsageReport {
|
|
|
68
68
|
},
|
|
69
69
|
},
|
|
70
70
|
},
|
|
71
|
+
{
|
|
72
|
+
id: 'token-harbour',
|
|
73
|
+
name: 'Token Harbor',
|
|
74
|
+
credentialSources: ['models.yml'],
|
|
75
|
+
// No omp adapter; the allowance comes from Token Harbor's own endpoint.
|
|
76
|
+
tracked: false,
|
|
77
|
+
limits: [],
|
|
78
|
+
tokenHarbor: {
|
|
79
|
+
allowance: {
|
|
80
|
+
planName: 'Agent Pass',
|
|
81
|
+
onPlan: true,
|
|
82
|
+
planUsedPct: 37,
|
|
83
|
+
planExhausted: false,
|
|
84
|
+
usedPct: 12,
|
|
85
|
+
exhausted: false,
|
|
86
|
+
activated: true,
|
|
87
|
+
resetAt: '2026-11-30T07:45:14.048+00:00',
|
|
88
|
+
periodStartedAt: '2026-11-23T07:45:14.048+00:00',
|
|
89
|
+
periodEndsAt: '2026-11-30T07:45:14.048+00:00',
|
|
90
|
+
freeModels: ['deepseek-v4-flash', 'mimo-v2.6-flash', 'mimo-v2.5', 'deepseek-v4.1-flash'],
|
|
91
|
+
modelsEnabled: true,
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
},
|
|
71
95
|
{
|
|
72
96
|
id: 'deepseek',
|
|
73
97
|
name: 'DeepSeek',
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Token Harbor reports its allowance as two integer percentages sharing one
|
|
8
|
+
* window, with `plan_exhausted`/`exhausted` deciding "spent" because the
|
|
9
|
+
* percentages are rounded. Every fixture below is the documented shape; the
|
|
10
|
+
* live endpoint was verified to add undocumented fields and to spell `models`
|
|
11
|
+
* without the `:free` suffix the docs show, so the parser must ignore the
|
|
12
|
+
* extras and pass ids through unchanged.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { describe, expect, test } from 'bun:test';
|
|
16
|
+
|
|
17
|
+
import {
|
|
18
|
+
allowanceWindows,
|
|
19
|
+
isTokenHarborBaseUrl,
|
|
20
|
+
parseTokenHarborAllowance,
|
|
21
|
+
tokenHarborAllowanceUrl,
|
|
22
|
+
} from '@/server/lib/usage/token-harbor';
|
|
23
|
+
|
|
24
|
+
/** The Office Pass example from the allowance docs. */
|
|
25
|
+
const OFFICE_PASS = {
|
|
26
|
+
plan_name: 'Office Pass',
|
|
27
|
+
on_plan: true,
|
|
28
|
+
plan_used_pct: 37,
|
|
29
|
+
plan_exhausted: false,
|
|
30
|
+
used_pct: 12,
|
|
31
|
+
exhausted: false,
|
|
32
|
+
activated: true,
|
|
33
|
+
period_started_at: '2026-11-05T09:12:44.512+00:00',
|
|
34
|
+
period_ends_at: '2026-11-12T09:12:44.512+00:00',
|
|
35
|
+
reset_at: '2026-11-12T09:12:44.512+00:00',
|
|
36
|
+
models: ['deepseek-v4.1-flash', 'mimo-v2.6-flash'],
|
|
37
|
+
models_enabled: true,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
describe('isTokenHarborBaseUrl', () => {
|
|
41
|
+
test('matches the vendor host at any path or subdomain', () => {
|
|
42
|
+
expect(isTokenHarborBaseUrl('https://tokenharbor.ai/v1')).toBe(true);
|
|
43
|
+
expect(isTokenHarborBaseUrl('https://tokenharbor.ai/v1/')).toBe(true);
|
|
44
|
+
expect(isTokenHarborBaseUrl('https://www.tokenharbor.ai')).toBe(true);
|
|
45
|
+
expect(isTokenHarborBaseUrl('https://TOKENHARBOR.AI/v1')).toBe(true);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test('a look-alike host, another vendor and a malformed URL are not Token Harbor', () => {
|
|
49
|
+
expect(isTokenHarborBaseUrl('https://tokenharbor.ai.evil.example/v1')).toBe(false);
|
|
50
|
+
expect(isTokenHarborBaseUrl('https://api.deepseek.com/v1')).toBe(false);
|
|
51
|
+
expect(isTokenHarborBaseUrl('tokenharbor.ai')).toBe(false);
|
|
52
|
+
expect(isTokenHarborBaseUrl('')).toBe(false);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
describe('tokenHarborAllowanceUrl', () => {
|
|
57
|
+
test('the allowance endpoint hangs off the origin, not the /v1 base', () => {
|
|
58
|
+
expect(tokenHarborAllowanceUrl('https://tokenharbor.ai/v1'))
|
|
59
|
+
.toBe('https://tokenharbor.ai/api/cli/free-tier');
|
|
60
|
+
expect(tokenHarborAllowanceUrl('https://tokenharbor.ai/v1/'))
|
|
61
|
+
.toBe('https://tokenharbor.ai/api/cli/free-tier');
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test('a missing or malformed base URL keeps the canonical origin', () => {
|
|
65
|
+
expect(tokenHarborAllowanceUrl()).toBe('https://tokenharbor.ai/api/cli/free-tier');
|
|
66
|
+
expect(tokenHarborAllowanceUrl('not a url')).toBe('https://tokenharbor.ai/api/cli/free-tier');
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
describe('parseTokenHarborAllowance', () => {
|
|
71
|
+
test('the documented Office Pass body maps field for field', () => {
|
|
72
|
+
expect(parseTokenHarborAllowance(OFFICE_PASS)).toEqual({
|
|
73
|
+
planName: 'Office Pass',
|
|
74
|
+
onPlan: true,
|
|
75
|
+
planUsedPct: 37,
|
|
76
|
+
planExhausted: false,
|
|
77
|
+
usedPct: 12,
|
|
78
|
+
exhausted: false,
|
|
79
|
+
activated: true,
|
|
80
|
+
resetAt: '2026-11-12T09:12:44.512+00:00',
|
|
81
|
+
periodStartedAt: '2026-11-05T09:12:44.512+00:00',
|
|
82
|
+
periodEndsAt: '2026-11-12T09:12:44.512+00:00',
|
|
83
|
+
freeModels: ['deepseek-v4.1-flash', 'mimo-v2.6-flash'],
|
|
84
|
+
modelsEnabled: true,
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
test('an account without a Pass reports no plan and a zero Pass percentage', () => {
|
|
89
|
+
const allowance = parseTokenHarborAllowance({
|
|
90
|
+
...OFFICE_PASS,
|
|
91
|
+
plan_name: null,
|
|
92
|
+
on_plan: false,
|
|
93
|
+
plan_used_pct: 0,
|
|
94
|
+
plan_exhausted: false,
|
|
95
|
+
});
|
|
96
|
+
expect(allowance.planName).toBeNull();
|
|
97
|
+
expect(allowance.onPlan).toBe(false);
|
|
98
|
+
expect(allowance.planUsedPct).toBe(0);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
test('a window that never started carries no timestamps', () => {
|
|
102
|
+
const allowance = parseTokenHarborAllowance({
|
|
103
|
+
...OFFICE_PASS,
|
|
104
|
+
activated: false,
|
|
105
|
+
plan_used_pct: 0,
|
|
106
|
+
used_pct: 0,
|
|
107
|
+
period_started_at: null,
|
|
108
|
+
period_ends_at: null,
|
|
109
|
+
reset_at: null,
|
|
110
|
+
});
|
|
111
|
+
expect(allowance.activated).toBe(false);
|
|
112
|
+
expect(allowance.resetAt).toBeNull();
|
|
113
|
+
expect(allowance.periodStartedAt).toBeNull();
|
|
114
|
+
expect(allowance.periodEndsAt).toBeNull();
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
test('the spent flag outranks a percentage that is still under 100', () => {
|
|
118
|
+
// Rounded integers: the refused request can arrive at 99, the covered one at 100.
|
|
119
|
+
const allowance = parseTokenHarborAllowance({
|
|
120
|
+
...OFFICE_PASS,
|
|
121
|
+
plan_used_pct: 99,
|
|
122
|
+
plan_exhausted: true,
|
|
123
|
+
});
|
|
124
|
+
expect(allowance.planUsedPct).toBe(99);
|
|
125
|
+
expect(allowance.planExhausted).toBe(true);
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
test('model ids pass through exactly as sent, with no invented suffix', () => {
|
|
129
|
+
const allowance = parseTokenHarborAllowance({
|
|
130
|
+
...OFFICE_PASS,
|
|
131
|
+
// The live response spells them without `:free`, unlike the docs example.
|
|
132
|
+
models: ['deepseek-v4-flash', ' deepseek-v4.1-flash ', '', 42],
|
|
133
|
+
});
|
|
134
|
+
expect(allowance.freeModels).toEqual(['deepseek-v4-flash', 'deepseek-v4.1-flash']);
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
test('models_enabled is off only when the endpoint says so', () => {
|
|
138
|
+
expect(parseTokenHarborAllowance({ ...OFFICE_PASS, models_enabled: false }).modelsEnabled).toBe(false);
|
|
139
|
+
const { models_enabled: _omitted, ...withoutFlag } = OFFICE_PASS;
|
|
140
|
+
expect(parseTokenHarborAllowance(withoutFlag).modelsEnabled).toBe(true);
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
test('percentages clamp to 0-100 and tolerate the numeric strings a proxy sends', () => {
|
|
144
|
+
expect(parseTokenHarborAllowance({ ...OFFICE_PASS, plan_used_pct: 137 }).planUsedPct).toBe(100);
|
|
145
|
+
expect(parseTokenHarborAllowance({ ...OFFICE_PASS, used_pct: -4 }).usedPct).toBe(0);
|
|
146
|
+
expect(parseTokenHarborAllowance({ ...OFFICE_PASS, plan_used_pct: '37' }).planUsedPct).toBe(37);
|
|
147
|
+
expect(parseTokenHarborAllowance({ ...OFFICE_PASS, plan_used_pct: null }).planUsedPct).toBeNull();
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
test('a body that is not an object is a schema change, not an empty account', () => {
|
|
151
|
+
expect(() => parseTokenHarborAllowance(null)).toThrow();
|
|
152
|
+
expect(() => parseTokenHarborAllowance([])).toThrow();
|
|
153
|
+
expect(() => parseTokenHarborAllowance('ok')).toThrow();
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
describe('allowanceWindows', () => {
|
|
158
|
+
const allowance = parseTokenHarborAllowance(OFFICE_PASS);
|
|
159
|
+
|
|
160
|
+
test('a Pass and the free allowance become two percent windows', () => {
|
|
161
|
+
const windows = allowanceWindows(allowance);
|
|
162
|
+
expect(windows.map((row) => row.id)).toEqual(['tokenharbor:pass', 'tokenharbor:free']);
|
|
163
|
+
expect(windows[0]?.label).toBe('Office Pass');
|
|
164
|
+
expect(windows[1]?.label).toBe('Free allowance');
|
|
165
|
+
expect(windows[0]?.used).toBe(37);
|
|
166
|
+
expect(windows[0]?.usedFraction).toBeCloseTo(0.37, 6);
|
|
167
|
+
expect(windows[0]?.unit).toBe('percent');
|
|
168
|
+
expect(windows[0]?.status).toBe('ok');
|
|
169
|
+
expect(windows[0]?.resetsAt).toBe(Date.parse('2026-11-12T09:12:44.512+00:00'));
|
|
170
|
+
expect(windows[1]?.resetsAt).toBe(windows[0]?.resetsAt);
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
test('an account without a Pass draws no Pass window', () => {
|
|
174
|
+
const windows = allowanceWindows({ ...allowance, onPlan: false, planName: null });
|
|
175
|
+
expect(windows.map((row) => row.id)).toEqual(['tokenharbor:free']);
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
test('the spent flag is the status, and an unstarted window is unknown', () => {
|
|
179
|
+
expect(allowanceWindows({ ...allowance, planExhausted: true })[0]?.status).toBe('exhausted');
|
|
180
|
+
const unstarted = allowanceWindows({ ...allowance, activated: false, resetAt: null });
|
|
181
|
+
expect(unstarted.map((row) => row.status)).toEqual(['unknown', 'unknown']);
|
|
182
|
+
expect(unstarted[0]?.resetsAt).toBeUndefined();
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
test('free models that are switched off are stated by the card, not by a window note', () => {
|
|
186
|
+
// The rich card replaces the generic section for this provider, so a note
|
|
187
|
+
// here would never render; `modelsEnabled` is what the card reads.
|
|
188
|
+
const windows = allowanceWindows({ ...allowance, modelsEnabled: false });
|
|
189
|
+
expect(windows.every((row) => row.notes === undefined)).toBe(true);
|
|
190
|
+
});
|
|
191
|
+
});
|