palettecn 0.1.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/index.mjs +10 -0
- package/dist/web/nitro.json +17 -0
- package/dist/web/public/assets/abap-BdvmRIgS.js +1 -0
- package/dist/web/public/assets/actionscript-3-et0rQaqm.js +1 -0
- package/dist/web/public/assets/ada-DPgrustg.js +1 -0
- package/dist/web/public/assets/andromeeda-DJl1yeV_.js +1 -0
- package/dist/web/public/assets/angular-html-Dm7s7tSx.js +1 -0
- package/dist/web/public/assets/angular-ts-B_ywTULt.js +1 -0
- package/dist/web/public/assets/apache-CFpsYX8S.js +1 -0
- package/dist/web/public/assets/apex-CN5n6pbI.js +1 -0
- package/dist/web/public/assets/apl-Dm11wHHc.js +1 -0
- package/dist/web/public/assets/applescript-JrY23hsL.js +1 -0
- package/dist/web/public/assets/ara-DR83hn3A.js +1 -0
- package/dist/web/public/assets/asciidoc-Dpu9XLB1.js +1 -0
- package/dist/web/public/assets/asm-BYI3A31V.js +1 -0
- package/dist/web/public/assets/astro-DP1naDCT.js +1 -0
- package/dist/web/public/assets/aurora-x-Nav5jnoQ.js +1 -0
- package/dist/web/public/assets/awk-BIoTx_w6.js +1 -0
- package/dist/web/public/assets/ayu-dark-H5QV5J7K.js +1 -0
- package/dist/web/public/assets/ayu-light-BrwTNGnU.js +1 -0
- package/dist/web/public/assets/ayu-mirage-Bg6FpF5w.js +1 -0
- package/dist/web/public/assets/ballerina-BFvDNd4T.js +1 -0
- package/dist/web/public/assets/bat-DtQkx7Ny.js +1 -0
- package/dist/web/public/assets/beancount-BIjKALa1.js +1 -0
- package/dist/web/public/assets/berry-BPkDN_EZ.js +1 -0
- package/dist/web/public/assets/bibtex-Dur2CNW6.js +1 -0
- package/dist/web/public/assets/bicep-BMz1bZ7m.js +1 -0
- package/dist/web/public/assets/bird2-91rdr9s7.js +1 -0
- package/dist/web/public/assets/blade-DD5O596X.js +1 -0
- package/dist/web/public/assets/bsl-FmB7U2qd.js +1 -0
- package/dist/web/public/assets/bundle-mjs-Bso3xn9x.js +1 -0
- package/dist/web/public/assets/c-DqqBLLyl.js +1 -0
- package/dist/web/public/assets/c3-CJTbEooS.js +1 -0
- package/dist/web/public/assets/cadence-C0GI7BZZ.js +1 -0
- package/dist/web/public/assets/cairo-B5JMmIC0.js +1 -0
- package/dist/web/public/assets/catppuccin-frappe-D76-cUjK.js +1 -0
- package/dist/web/public/assets/catppuccin-latte-DUHNJ_6_.js +1 -0
- package/dist/web/public/assets/catppuccin-macchiato-CFhPH2wd.js +1 -0
- package/dist/web/public/assets/catppuccin-mocha-BRD0cvUW.js +1 -0
- package/dist/web/public/assets/chunk-FRKYWMV7-DUkk3w4h.js +122 -0
- package/dist/web/public/assets/clarity-KgUVrNfC.js +1 -0
- package/dist/web/public/assets/clojure-BhQuoGIG.js +1 -0
- package/dist/web/public/assets/cmake-CA59gUFQ.js +1 -0
- package/dist/web/public/assets/cobol-CCFShgGZ.js +1 -0
- package/dist/web/public/assets/codeowners-CD36YqjJ.js +1 -0
- package/dist/web/public/assets/codeql-CrMosKUt.js +1 -0
- package/dist/web/public/assets/coffee-C-Mn3tBT.js +1 -0
- package/dist/web/public/assets/common-lisp-DYnOjAFz.js +1 -0
- package/dist/web/public/assets/components-DiZ1dSl3.js +77 -0
- package/dist/web/public/assets/coq-BaHtq3Qt.js +1 -0
- package/dist/web/public/assets/cpp-D8Y73ItU.js +1 -0
- package/dist/web/public/assets/crystal-CnXWqbxx.js +1 -0
- package/dist/web/public/assets/csharp-D6sghVPa.js +1 -0
- package/dist/web/public/assets/css-CUGjdPw_.js +1 -0
- package/dist/web/public/assets/csv-DuxyxUAI.js +1 -0
- package/dist/web/public/assets/cue-D9NRAX0_.js +1 -0
- package/dist/web/public/assets/cypher-HJRdtilF.js +1 -0
- package/dist/web/public/assets/d-B4Ont7_X.js +1 -0
- package/dist/web/public/assets/dark-plus-DZSBycyp.js +1 -0
- package/dist/web/public/assets/dart-Dp4asavE.js +1 -0
- package/dist/web/public/assets/dax-DBUubp6S.js +1 -0
- package/dist/web/public/assets/desktop-DQ0n6zIQ.js +1 -0
- package/dist/web/public/assets/diff-CFHlrffC.js +1 -0
- package/dist/web/public/assets/docker-BuefmsF5.js +1 -0
- package/dist/web/public/assets/dotenv-BKTsUQ_r.js +1 -0
- package/dist/web/public/assets/dracula-MOn9qacs.js +1 -0
- package/dist/web/public/assets/dracula-soft-C4r_sC_D.js +1 -0
- package/dist/web/public/assets/dream-maker-BNdv5lLS.js +1 -0
- package/dist/web/public/assets/edge-C-Mi8Oda.js +1 -0
- package/dist/web/public/assets/elixir-CTS5wQtX.js +1 -0
- package/dist/web/public/assets/elm-rM310x8D.js +1 -0
- package/dist/web/public/assets/emacs-lisp-D9FIGRtM.js +1 -0
- package/dist/web/public/assets/erb-oaGjGVGO.js +1 -0
- package/dist/web/public/assets/erlang-q4Mkyw3m.js +1 -0
- package/dist/web/public/assets/everforest-dark-CNa2QFRn.js +1 -0
- package/dist/web/public/assets/everforest-light-DRbUDqJT.js +1 -0
- package/dist/web/public/assets/fennel-DpqQTaVZ.js +1 -0
- package/dist/web/public/assets/field-1-Ujza0S5j.js +1 -0
- package/dist/web/public/assets/fish-hyk5x6Q4.js +1 -0
- package/dist/web/public/assets/fluent-DMll-MGX.js +1 -0
- package/dist/web/public/assets/fortran-fixed-form-BmdfKovV.js +1 -0
- package/dist/web/public/assets/fortran-free-form-MCAifii4.js +1 -0
- package/dist/web/public/assets/fsharp-DLlBn9Nl.js +1 -0
- package/dist/web/public/assets/gdresource-BzFzBRli.js +1 -0
- package/dist/web/public/assets/gdscript-D3R4J0Cv.js +1 -0
- package/dist/web/public/assets/gdshader-BAubtqqN.js +1 -0
- package/dist/web/public/assets/genie-BnIIX2pC.js +1 -0
- package/dist/web/public/assets/gherkin-CL3NUuB1.js +1 -0
- package/dist/web/public/assets/git-commit-BYPE8h85.js +1 -0
- package/dist/web/public/assets/git-rebase-Bmmgf6eN.js +1 -0
- package/dist/web/public/assets/github-dark-default-C6I2oE4c.js +1 -0
- package/dist/web/public/assets/github-dark-dimmed-DEqwxg6D.js +1 -0
- package/dist/web/public/assets/github-dark-high-contrast-DDt3j0cs.js +1 -0
- package/dist/web/public/assets/github-dark-oLN6SDKl.js +1 -0
- package/dist/web/public/assets/github-light-DaN-N2Gj.js +1 -0
- package/dist/web/public/assets/github-light-default-B3EwMbS7.js +1 -0
- package/dist/web/public/assets/github-light-high-contrast-Cl9D0f_e.js +1 -0
- package/dist/web/public/assets/gleam-Cvj8QRtQ.js +1 -0
- package/dist/web/public/assets/glimmer-js-CahbROb1.js +1 -0
- package/dist/web/public/assets/glimmer-ts-JMFYNbot.js +1 -0
- package/dist/web/public/assets/global-XWAvxWcA.css +2 -0
- package/dist/web/public/assets/glsl-BCuCNM3V.js +1 -0
- package/dist/web/public/assets/gn-DxCHSEMl.js +1 -0
- package/dist/web/public/assets/gnuplot-CkGXHK7B.js +1 -0
- package/dist/web/public/assets/go-B_NLCuTj.js +1 -0
- package/dist/web/public/assets/graphql-RXOfHGfI.js +1 -0
- package/dist/web/public/assets/groovy-DVge8oRs.js +1 -0
- package/dist/web/public/assets/gruvbox-dark-hard-BwZz1yni.js +1 -0
- package/dist/web/public/assets/gruvbox-dark-medium-Bqy6jkuO.js +1 -0
- package/dist/web/public/assets/gruvbox-dark-soft-DjUvyUfH.js +1 -0
- package/dist/web/public/assets/gruvbox-light-hard-BTLmfPdm.js +1 -0
- package/dist/web/public/assets/gruvbox-light-medium-DeWqsWs6.js +1 -0
- package/dist/web/public/assets/gruvbox-light-soft-BL8ld-1F.js +1 -0
- package/dist/web/public/assets/hack-BBQpwyf_.js +1 -0
- package/dist/web/public/assets/haml-mWELc9kh.js +1 -0
- package/dist/web/public/assets/handlebars-COrUo8cC.js +1 -0
- package/dist/web/public/assets/haskell-DRmM8XlQ.js +1 -0
- package/dist/web/public/assets/haxe-BEhq8ZEr.js +1 -0
- package/dist/web/public/assets/hcl-B5ZIaGS0.js +1 -0
- package/dist/web/public/assets/highlighted-body-TPN3WLV5-YJgGFx4e.js +1 -0
- package/dist/web/public/assets/hjson-B9uRLqIO.js +1 -0
- package/dist/web/public/assets/hlsl-Hv1kKjrS.js +1 -0
- package/dist/web/public/assets/horizon-ClXGBjWw.js +1 -0
- package/dist/web/public/assets/horizon-bright-CvUCr3ux.js +1 -0
- package/dist/web/public/assets/houston-NqkqG60q.js +1 -0
- package/dist/web/public/assets/html-cmigv1ou.js +1 -0
- package/dist/web/public/assets/html-derivative-B3me0pSu.js +1 -0
- package/dist/web/public/assets/http-BojM9cyU.js +1 -0
- package/dist/web/public/assets/hurl-BxEmMiGP.js +1 -0
- package/dist/web/public/assets/hxml-CoBuVbfs.js +1 -0
- package/dist/web/public/assets/hy-CeISYGGU.js +1 -0
- package/dist/web/public/assets/imba-xjcDFXUW.js +1 -0
- package/dist/web/public/assets/ini-D0ZCSj6e.js +1 -0
- package/dist/web/public/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
- package/dist/web/public/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
- package/dist/web/public/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
- package/dist/web/public/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
- package/dist/web/public/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
- package/dist/web/public/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
- package/dist/web/public/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
- package/dist/web/public/assets/java-BvheClGI.js +1 -0
- package/dist/web/public/assets/javascript-DjlJORDg.js +1 -0
- package/dist/web/public/assets/jinja-Bi4sG72X.js +1 -0
- package/dist/web/public/assets/jison-BTz5Ik2Y.js +1 -0
- package/dist/web/public/assets/json-CiTd40Rg.js +1 -0
- package/dist/web/public/assets/json5-FR9EyF7a.js +1 -0
- package/dist/web/public/assets/jsonc-CHIeFfsD.js +1 -0
- package/dist/web/public/assets/jsonl-B4WQkwTf.js +1 -0
- package/dist/web/public/assets/jsonnet-vd-gzGkL.js +1 -0
- package/dist/web/public/assets/jssm-C_bj1LkZ.js +1 -0
- package/dist/web/public/assets/jsx-Bx-RZMFH.js +1 -0
- package/dist/web/public/assets/jsx-runtime-n8k0hwt8.js +1 -0
- package/dist/web/public/assets/julia-BKcIfSxk.js +1 -0
- package/dist/web/public/assets/just-IkZCagAs.js +1 -0
- package/dist/web/public/assets/kanagawa-dragon-B3Cz89vt.js +1 -0
- package/dist/web/public/assets/kanagawa-lotus-CRe_W5Ft.js +1 -0
- package/dist/web/public/assets/kanagawa-wave-BPqZ5XB7.js +1 -0
- package/dist/web/public/assets/kdl-BzL_Ak31.js +1 -0
- package/dist/web/public/assets/kotlin-BQQFk6ql.js +1 -0
- package/dist/web/public/assets/kusto-vWe6OLKV.js +1 -0
- package/dist/web/public/assets/laserwave-CwtvEUcj.js +1 -0
- package/dist/web/public/assets/latex-9N90_WFU.js +1 -0
- package/dist/web/public/assets/lean-CaqenOqv.js +1 -0
- package/dist/web/public/assets/less-CERnPzn6.js +1 -0
- package/dist/web/public/assets/light-plus-B9_M_OKq.js +1 -0
- package/dist/web/public/assets/liquid-CQLPDP7m.js +1 -0
- package/dist/web/public/assets/llvm-BylJXvm7.js +1 -0
- package/dist/web/public/assets/log-CBBcNcbO.js +1 -0
- package/dist/web/public/assets/logo-r-8Jc8Xk.js +1 -0
- package/dist/web/public/assets/lua-BBL6LXKd.js +1 -0
- package/dist/web/public/assets/luau-B2g7L-zP.js +1 -0
- package/dist/web/public/assets/main-0lKVDR64.css +2 -0
- package/dist/web/public/assets/main-CcNf0BOb.js +126 -0
- package/dist/web/public/assets/make-DK-HzJ2w.js +1 -0
- package/dist/web/public/assets/markdown-FgdsukgR.js +1 -0
- package/dist/web/public/assets/marko-CLZwt2N2.js +1 -0
- package/dist/web/public/assets/material-theme-DOJ9PS4O.js +1 -0
- package/dist/web/public/assets/material-theme-darker-DOurH5jT.js +1 -0
- package/dist/web/public/assets/material-theme-lighter-BfPWxCP6.js +1 -0
- package/dist/web/public/assets/material-theme-ocean-BcO5PKoq.js +1 -0
- package/dist/web/public/assets/material-theme-palenight-ClWQBDDd.js +1 -0
- package/dist/web/public/assets/matlab-DwyUVNXd.js +1 -0
- package/dist/web/public/assets/mdc-Bo8CRPg4.js +1 -0
- package/dist/web/public/assets/mdx-3EBShbsD.js +1 -0
- package/dist/web/public/assets/mermaid-ByG2-SLz.js +1 -0
- package/dist/web/public/assets/mermaid-O7DHMXV3-COAgR3aM.js +1 -0
- package/dist/web/public/assets/min-dark-ClJ2x5pc.js +1 -0
- package/dist/web/public/assets/min-light-BsOUz5iE.js +1 -0
- package/dist/web/public/assets/mipsasm-BKDtQCf3.js +1 -0
- package/dist/web/public/assets/mojo-DmEAK7iv.js +1 -0
- package/dist/web/public/assets/monokai-BKc3VADO.js +1 -0
- package/dist/web/public/assets/moonbit-Qm8v_cKN.js +1 -0
- package/dist/web/public/assets/move-CMectUPk.js +1 -0
- package/dist/web/public/assets/narrat-Bdm8NaK8.js +1 -0
- package/dist/web/public/assets/nextflow-BpSt05nC.js +1 -0
- package/dist/web/public/assets/nextflow-groovy-BZ-bqJ-u.js +1 -0
- package/dist/web/public/assets/nginx-ChZL5FWE.js +1 -0
- package/dist/web/public/assets/night-owl-CbFc5pXO.js +1 -0
- package/dist/web/public/assets/night-owl-light-zYbVCVuz.js +1 -0
- package/dist/web/public/assets/nim-5JnPAJWa.js +1 -0
- package/dist/web/public/assets/nix-P5P-2qHs.js +1 -0
- package/dist/web/public/assets/nord-C7hKGudV.js +1 -0
- package/dist/web/public/assets/nushell-DKPnC5RG.js +1 -0
- package/dist/web/public/assets/objective-c-BPwXtM0v.js +1 -0
- package/dist/web/public/assets/objective-cpp-CWYEdWNG.js +1 -0
- package/dist/web/public/assets/ocaml-CL7OJ02v.js +1 -0
- package/dist/web/public/assets/odin-Dtay25eA.js +1 -0
- package/dist/web/public/assets/one-dark-pro-CrdFNNwF.js +1 -0
- package/dist/web/public/assets/one-light-BUiz8X4B.js +1 -0
- package/dist/web/public/assets/openscad-WD4sXUUp.js +1 -0
- package/dist/web/public/assets/pascal-A6-MZnZ8.js +1 -0
- package/dist/web/public/assets/perl-Yq3AfnVV.js +1 -0
- package/dist/web/public/assets/php-CCj0foPx.js +1 -0
- package/dist/web/public/assets/pkl-cmPbg8fI.js +1 -0
- package/dist/web/public/assets/plastic-DtQ_LnDB.js +1 -0
- package/dist/web/public/assets/plsql-DwmuVd7q.js +1 -0
- package/dist/web/public/assets/po-CkVxkZaj.js +1 -0
- package/dist/web/public/assets/poimandres-Dt0xZuaa.js +1 -0
- package/dist/web/public/assets/polar-hStNz_W2.js +1 -0
- package/dist/web/public/assets/postcss-ZIk0AQ7M.js +1 -0
- package/dist/web/public/assets/powerquery-D0gqoHHD.js +1 -0
- package/dist/web/public/assets/powershell-DXB5HoVh.js +1 -0
- package/dist/web/public/assets/prisma-DmTrfxC0.js +1 -0
- package/dist/web/public/assets/prolog-CdoyriEj.js +1 -0
- package/dist/web/public/assets/proto-4MrN11dS.js +1 -0
- package/dist/web/public/assets/pug-svYJKDOQ.js +1 -0
- package/dist/web/public/assets/puppet-MEaLGpAP.js +1 -0
- package/dist/web/public/assets/purescript-CPxCorqB.js +1 -0
- package/dist/web/public/assets/python-f4fp5z0z.js +1 -0
- package/dist/web/public/assets/qml-BzEtWdqI.js +1 -0
- package/dist/web/public/assets/qmldir-DCjSceJ_.js +1 -0
- package/dist/web/public/assets/qss-BdM02NUc.js +1 -0
- package/dist/web/public/assets/r-luosIeJH.js +1 -0
- package/dist/web/public/assets/racket-D2tfa8Zc.js +1 -0
- package/dist/web/public/assets/raku-KeGPJVZg.js +1 -0
- package/dist/web/public/assets/razor-Bokxs4Qx.js +1 -0
- package/dist/web/public/assets/red-C0qZ-1lN.js +1 -0
- package/dist/web/public/assets/reg-DdnswvOj.js +1 -0
- package/dist/web/public/assets/regexp-CYC8h6V9.js +1 -0
- package/dist/web/public/assets/rel-RhzEfSRc.js +1 -0
- package/dist/web/public/assets/riscv-dS5TzX10.js +1 -0
- package/dist/web/public/assets/ron-CQjQSCVp.js +1 -0
- package/dist/web/public/assets/rose-pine-C89ViLdr.js +1 -0
- package/dist/web/public/assets/rose-pine-dawn-Dq2gf0yi.js +1 -0
- package/dist/web/public/assets/rose-pine-moon-CBDvXVs_.js +1 -0
- package/dist/web/public/assets/rosmsg-nvjuSIGu.js +1 -0
- package/dist/web/public/assets/routes-BXqJCOpL.js +542 -0
- package/dist/web/public/assets/rst-1xwvVGf7.js +1 -0
- package/dist/web/public/assets/ruby-Blad-eDx.js +1 -0
- package/dist/web/public/assets/rust-rV8q_xyI.js +1 -0
- package/dist/web/public/assets/sas-DUPWtptg.js +1 -0
- package/dist/web/public/assets/sass-CuxdoNN0.js +1 -0
- package/dist/web/public/assets/scala-Df4L7N3R.js +1 -0
- package/dist/web/public/assets/scheme-DalRmAPH.js +1 -0
- package/dist/web/public/assets/scss-CYQ8LEwP.js +1 -0
- package/dist/web/public/assets/sdbl-B_TmFnGf.js +1 -0
- package/dist/web/public/assets/shaderlab-DYEMDY3e.js +1 -0
- package/dist/web/public/assets/shellscript-DjKZ34ac.js +1 -0
- package/dist/web/public/assets/shellsession-C3kcnBnh.js +1 -0
- package/dist/web/public/assets/slack-dark-ak_jOeLl.js +1 -0
- package/dist/web/public/assets/slack-ochin-ByiYhLwu.js +1 -0
- package/dist/web/public/assets/smalltalk-DTTnjjZJ.js +1 -0
- package/dist/web/public/assets/snazzy-light-BBRYeY60.js +1 -0
- package/dist/web/public/assets/solarized-dark-BtoLnWkw.js +1 -0
- package/dist/web/public/assets/solarized-light-CtzUA7GI.js +1 -0
- package/dist/web/public/assets/solidity-CSIHEQ2t.js +1 -0
- package/dist/web/public/assets/soy-BN0uzUAI.js +1 -0
- package/dist/web/public/assets/sparql-B6k9tA6Q.js +1 -0
- package/dist/web/public/assets/splunk-DkRzN7V_.js +1 -0
- package/dist/web/public/assets/sql-Bx-WX28V.js +1 -0
- package/dist/web/public/assets/ssh-config-Bqp7ng33.js +1 -0
- package/dist/web/public/assets/stata-HAj7doU8.js +1 -0
- package/dist/web/public/assets/stylus-CdbCxDLX.js +1 -0
- package/dist/web/public/assets/surrealql-BkGf0I3k.js +1 -0
- package/dist/web/public/assets/svelte-DtWg6ssL.js +1 -0
- package/dist/web/public/assets/swift-yRu2dtgr.js +1 -0
- package/dist/web/public/assets/synthwave-84-2WIu6MHX.js +1 -0
- package/dist/web/public/assets/system-verilog-GUE_oP1V.js +1 -0
- package/dist/web/public/assets/systemd-FLIJAQZV.js +1 -0
- package/dist/web/public/assets/talonscript-DTR-8ILs.js +1 -0
- package/dist/web/public/assets/tasl-WHNWP-1F.js +1 -0
- package/dist/web/public/assets/tcl-BaBXNNp6.js +1 -0
- package/dist/web/public/assets/templ-Dc9vj00n.js +1 -0
- package/dist/web/public/assets/terraform-uJUFpr8t.js +1 -0
- package/dist/web/public/assets/tex-DA3dAz55.js +1 -0
- package/dist/web/public/assets/tokyo-night-BbogFqAr.js +1 -0
- package/dist/web/public/assets/toml-CyR4Gqq1.js +1 -0
- package/dist/web/public/assets/ts-tags-BD1j21LH.js +1 -0
- package/dist/web/public/assets/tsv-COLVYI6A.js +1 -0
- package/dist/web/public/assets/tsx-CFm2E6uK.js +1 -0
- package/dist/web/public/assets/turtle-PQwt4gkb.js +1 -0
- package/dist/web/public/assets/twig-DrUXy85s.js +1 -0
- package/dist/web/public/assets/typescript-Dy-5sXFx.js +1 -0
- package/dist/web/public/assets/typespec-Bb7qHV0g.js +1 -0
- package/dist/web/public/assets/typst-Bj_JElGz.js +1 -0
- package/dist/web/public/assets/v-BTkrtik4.js +1 -0
- package/dist/web/public/assets/vala-AXT1CI9v.js +1 -0
- package/dist/web/public/assets/vb-DzTKUgW8.js +1 -0
- package/dist/web/public/assets/verilog-aI3j5Xj8.js +1 -0
- package/dist/web/public/assets/vesper-BmnwIC_B.js +1 -0
- package/dist/web/public/assets/vhdl-4IgBB7vO.js +1 -0
- package/dist/web/public/assets/viml-D_XMKSR6.js +1 -0
- package/dist/web/public/assets/vitesse-black-DhmxIXiA.js +1 -0
- package/dist/web/public/assets/vitesse-dark-dvEH_9qt.js +1 -0
- package/dist/web/public/assets/vitesse-light-Ca0W2L1O.js +1 -0
- package/dist/web/public/assets/vue-DC_yTvy2.js +1 -0
- package/dist/web/public/assets/vue-html-Bp8x4gdt.js +1 -0
- package/dist/web/public/assets/vue-vine-ZcUkuUUp.js +1 -0
- package/dist/web/public/assets/vyper-Dz2f7-FK.js +1 -0
- package/dist/web/public/assets/wasm-CuXPCj65.js +1 -0
- package/dist/web/public/assets/wasm-DHkXUMsP.js +1 -0
- package/dist/web/public/assets/wenyan-BRAtM0Iv.js +1 -0
- package/dist/web/public/assets/wgsl-CMpn9jTa.js +1 -0
- package/dist/web/public/assets/wikitext-DRmBVmVA.js +1 -0
- package/dist/web/public/assets/wit-Drp_HLqJ.js +1 -0
- package/dist/web/public/assets/wolfram-C33umj7M.js +1 -0
- package/dist/web/public/assets/xml-BHoOtGbO.js +1 -0
- package/dist/web/public/assets/xsl-CN1PlFqm.js +1 -0
- package/dist/web/public/assets/yaml-DT0mpn8u.js +1 -0
- package/dist/web/public/assets/zenscript-BlYQ_Frf.js +1 -0
- package/dist/web/public/assets/zig-Buk7I0y-.js +1 -0
- package/dist/web/server/_chunks/ssr-renderer.mjs +15 -0
- package/dist/web/server/_libs/@ai-sdk/anthropic+[...].mjs +14021 -0
- package/dist/web/server/_libs/@ai-sdk/moonshotai+[...].mjs +898 -0
- package/dist/web/server/_libs/@ai-sdk/react+[...].mjs +8969 -0
- package/dist/web/server/_libs/@emotion/is-prop-valid+[...].mjs +34 -0
- package/dist/web/server/_libs/@floating-ui/core+[...].mjs +698 -0
- package/dist/web/server/_libs/@floating-ui/dom+[...].mjs +644 -0
- package/dist/web/server/_libs/@floating-ui/react-dom+[...].mjs +475 -0
- package/dist/web/server/_libs/@lobehub/icons+[...].mjs +3079 -0
- package/dist/web/server/_libs/@radix-ui/react-arrow+[...].mjs +184 -0
- package/dist/web/server/_libs/@radix-ui/react-collapsible+[...].mjs +374 -0
- package/dist/web/server/_libs/@radix-ui/react-dialog+[...].mjs +1503 -0
- package/dist/web/server/_libs/@radix-ui/react-menu+[...].mjs +1236 -0
- package/dist/web/server/_libs/@radix-ui/react-select+[...].mjs +1007 -0
- package/dist/web/server/_libs/@shikijs/core+[...].mjs +9017 -0
- package/dist/web/server/_libs/@shikijs/engine-javascript+[...].mjs +3159 -0
- package/dist/web/server/_libs/@streamdown/math+[...].mjs +37559 -0
- package/dist/web/server/_libs/@tanstack/react-router+[...].mjs +14074 -0
- package/dist/web/server/_libs/_.mjs +3 -0
- package/dist/web/server/_libs/_2.mjs +3 -0
- package/dist/web/server/_libs/_3.mjs +2 -0
- package/dist/web/server/_libs/_4.mjs +2 -0
- package/dist/web/server/_libs/ai-sdk__gateway+vercel__oidc.mjs +1255 -0
- package/dist/web/server/_libs/ai-sdk__google.mjs +1630 -0
- package/dist/web/server/_libs/ai-sdk__openai+zod.mjs +4951 -0
- package/dist/web/server/_libs/ai-sdk__provider-utils.mjs +411 -0
- package/dist/web/server/_libs/ai-sdk__provider.mjs +222 -0
- package/dist/web/server/_libs/bail.mjs +13 -0
- package/dist/web/server/_libs/character-entities.mjs +2135 -0
- package/dist/web/server/_libs/class-variance-authority+clsx.mjs +69 -0
- package/dist/web/server/_libs/color+[...].mjs +2185 -0
- package/dist/web/server/_libs/copy-text-to-clipboard.mjs +40 -0
- package/dist/web/server/_libs/d3-array.mjs +231 -0
- package/dist/web/server/_libs/d3-color.mjs +330 -0
- package/dist/web/server/_libs/d3-format.mjs +252 -0
- package/dist/web/server/_libs/d3-interpolate.mjs +207 -0
- package/dist/web/server/_libs/d3-path.mjs +77 -0
- package/dist/web/server/_libs/d3-scale+[...].mjs +1907 -0
- package/dist/web/server/_libs/d3-shape.mjs +818 -0
- package/dist/web/server/_libs/date-fns.mjs +3012 -0
- package/dist/web/server/_libs/date-fns__tz.mjs +249 -0
- package/dist/web/server/_libs/decimal.js-light.mjs +884 -0
- package/dist/web/server/_libs/decode-named-character-reference+[...].mjs +19 -0
- package/dist/web/server/_libs/dexie.mjs +3745 -0
- package/dist/web/server/_libs/escape-string-regexp.mjs +7 -0
- package/dist/web/server/_libs/estree-util-is-identifier-name.mjs +20 -0
- package/dist/web/server/_libs/eventemitter3.mjs +237 -0
- package/dist/web/server/_libs/extend.mjs +75 -0
- package/dist/web/server/_libs/fast-equals.mjs +423 -0
- package/dist/web/server/_libs/framer-motion+[...].mjs +9573 -0
- package/dist/web/server/_libs/fuzzysort.mjs +621 -0
- package/dist/web/server/_libs/h3+rou3+srvx.mjs +1158 -0
- package/dist/web/server/_libs/hast-util-raw+[...].mjs +800 -0
- package/dist/web/server/_libs/hast-util-sanitize.mjs +780 -0
- package/dist/web/server/_libs/hast-util-to-jsx-runtime+[...].mjs +853 -0
- package/dist/web/server/_libs/hookable.mjs +41 -0
- package/dist/web/server/_libs/html-url-attributes.mjs +44 -0
- package/dist/web/server/_libs/is-plain-obj.mjs +8 -0
- package/dist/web/server/_libs/lodash.mjs +4532 -0
- package/dist/web/server/_libs/lucide-react.mjs +605 -0
- package/dist/web/server/_libs/markdown-table.mjs +289 -0
- package/dist/web/server/_libs/marked.mjs +1511 -0
- package/dist/web/server/_libs/mdast-util-find-and-replace.mjs +198 -0
- package/dist/web/server/_libs/mdast-util-from-markdown+[...].mjs +8121 -0
- package/dist/web/server/_libs/mdast-util-gfm+[...].mjs +2060 -0
- package/dist/web/server/_libs/mdast-util-to-hast+[...].mjs +1770 -0
- package/dist/web/server/_libs/micromark-extension-gfm+[...].mjs +2235 -0
- package/dist/web/server/_libs/nanoid.mjs +26 -0
- package/dist/web/server/_libs/next-themes.mjs +124 -0
- package/dist/web/server/_libs/prop-types.mjs +69 -0
- package/dist/web/server/_libs/radix-ui__number.mjs +6 -0
- package/dist/web/server/_libs/radix-ui__primitive.mjs +9 -0
- package/dist/web/server/_libs/radix-ui__react-collection.mjs +80 -0
- package/dist/web/server/_libs/radix-ui__react-direction.mjs +11 -0
- package/dist/web/server/_libs/radix-ui__react-label.mjs +23 -0
- package/dist/web/server/_libs/radix-ui__react-menubar.mjs +400 -0
- package/dist/web/server/_libs/radix-ui__react-popover.mjs +251 -0
- package/dist/web/server/_libs/radix-ui__react-progress.mjs +81 -0
- package/dist/web/server/_libs/radix-ui__react-scroll-area.mjs +669 -0
- package/dist/web/server/_libs/radix-ui__react-separator.mjs +32 -0
- package/dist/web/server/_libs/radix-ui__react-slider.mjs +464 -0
- package/dist/web/server/_libs/radix-ui__react-switch.mjs +120 -0
- package/dist/web/server/_libs/radix-ui__react-tabs.mjs +145 -0
- package/dist/web/server/_libs/radix-ui__react-tooltip.mjs +494 -0
- package/dist/web/server/_libs/react-day-picker.mjs +3510 -0
- package/dist/web/server/_libs/react-is.mjs +48 -0
- package/dist/web/server/_libs/react-resizable-panels.mjs +1517 -0
- package/dist/web/server/_libs/react-smooth.mjs +1024 -0
- package/dist/web/server/_libs/recharts+[...].mjs +12998 -0
- package/dist/web/server/_libs/rehype-harden.mjs +210 -0
- package/dist/web/server/_libs/rehype-raw.mjs +37 -0
- package/dist/web/server/_libs/rehype-sanitize.mjs +27 -0
- package/dist/web/server/_libs/remark-gfm.mjs +34 -0
- package/dist/web/server/_libs/remark-parse.mjs +37 -0
- package/dist/web/server/_libs/remark-rehype.mjs +169 -0
- package/dist/web/server/_libs/remend.mjs +544 -0
- package/dist/web/server/_libs/scule.mjs +55 -0
- package/dist/web/server/_libs/shiki+streamdown__code.mjs +1748 -0
- package/dist/web/server/_libs/shiki.mjs +16 -0
- package/dist/web/server/_libs/shikijs__engine-oniguruma.mjs +387 -0
- package/dist/web/server/_libs/shikijs__langs.mjs +1357 -0
- package/dist/web/server/_libs/shikijs__themes.mjs +268 -0
- package/dist/web/server/_libs/sonner.mjs +909 -0
- package/dist/web/server/_libs/streamdown+[...].mjs +5842 -0
- package/dist/web/server/_libs/tanstack__history.mjs +342 -0
- package/dist/web/server/_libs/tanstack__query-core.mjs +2073 -0
- package/dist/web/server/_libs/tanstack__react-query.mjs +146 -0
- package/dist/web/server/_libs/tanstack__router-core.mjs +6 -0
- package/dist/web/server/_libs/tanstack__zod-adapter.mjs +16 -0
- package/dist/web/server/_libs/ufo.mjs +64 -0
- package/dist/web/server/_libs/ungap__structured-clone.mjs +197 -0
- package/dist/web/server/_libs/use-stick-to-bottom.mjs +410 -0
- package/dist/web/server/_libs/vercel__oidc.mjs +393 -0
- package/dist/web/server/_libs/zhipu-ai-provider.mjs +13483 -0
- package/dist/web/server/_libs/zustand.mjs +48 -0
- package/dist/web/server/_runtime.mjs +35 -0
- package/dist/web/server/_ssr/components-BzCiScpA.mjs +1452 -0
- package/dist/web/server/_ssr/dist-3Mu7PF0n.mjs +137 -0
- package/dist/web/server/_ssr/dist-BRaLXgxZ.mjs +17 -0
- package/dist/web/server/_ssr/field-1-agM60DBf.mjs +167 -0
- package/dist/web/server/_ssr/get-providers-BoYkp0Of.mjs +40 -0
- package/dist/web/server/_ssr/initialize-provider-B6W8V5Eg.mjs +19 -0
- package/dist/web/server/_ssr/model-list-CDFjdz2P.mjs +60 -0
- package/dist/web/server/_ssr/router-BmmOCtJZ.mjs +168 -0
- package/dist/web/server/_ssr/routes-CvlpZK4Q.mjs +2630 -0
- package/dist/web/server/_ssr/schemas-DsZ5O3zp.mjs +67 -0
- package/dist/web/server/_ssr/send-message-DUT1vRvx.mjs +135 -0
- package/dist/web/server/_ssr/ssr.mjs +5253 -0
- package/dist/web/server/_ssr/start-rewezkfD.mjs +4 -0
- package/dist/web/server/_ssr/submit-key-CcCv6-yy.mjs +62 -0
- package/dist/web/server/_ssr/suggestions-B0Uc3p7F.mjs +38 -0
- package/dist/web/server/_ssr/use-providers-Bwqg2U3N.mjs +1554 -0
- package/dist/web/server/_tanstack-start-manifest_v-BMIvh4y6.mjs +60 -0
- package/dist/web/server/index.mjs +2531 -0
- package/dist/web/server/node_modules/tslib/modules/index.js +70 -0
- package/dist/web/server/node_modules/tslib/modules/package.json +3 -0
- package/dist/web/server/node_modules/tslib/package.json +47 -0
- package/dist/web/server/node_modules/tslib/tslib.js +484 -0
- package/package.json +32 -0
|
@@ -0,0 +1,898 @@
|
|
|
1
|
+
import { $ as InvalidResponseDataError, Ct as union, I as parseProviderOptions, K as withUserAgentSuffix, O as isParsableJson, R as postJsonToApi, S as generateId, St as string, bt as record, c as convertToBase64, dt as boolean, et as NoSuchModelError, f as createEventSourceResponseHandler, gt as looseObject, h as createJsonResponseHandler, ht as literal, j as loadApiKey, lt as any, m as createJsonErrorResponseHandler, o as combineHeaders, ot as _enum, q as withoutTrailingSlash, rt as UnsupportedFunctionalityError, s as convertBase64ToUint8Array, ut as array, vt as number, yt as object } from "./anthropic+[...].mjs";
|
|
2
|
+
//#region ../../node_modules/.pnpm/@ai-sdk+openai-compatible@2.0.35_zod@4.3.6/node_modules/@ai-sdk/openai-compatible/dist/index.mjs
|
|
3
|
+
var defaultOpenAICompatibleErrorStructure = {
|
|
4
|
+
errorSchema: object({ error: object({
|
|
5
|
+
message: string(),
|
|
6
|
+
type: string().nullish(),
|
|
7
|
+
param: any().nullish(),
|
|
8
|
+
code: union([string(), number()]).nullish()
|
|
9
|
+
}) }),
|
|
10
|
+
errorToMessage: (data) => data.error.message
|
|
11
|
+
};
|
|
12
|
+
function convertOpenAICompatibleChatUsage(usage) {
|
|
13
|
+
var _a, _b, _c, _d, _e, _f;
|
|
14
|
+
if (usage == null) return {
|
|
15
|
+
inputTokens: {
|
|
16
|
+
total: void 0,
|
|
17
|
+
noCache: void 0,
|
|
18
|
+
cacheRead: void 0,
|
|
19
|
+
cacheWrite: void 0
|
|
20
|
+
},
|
|
21
|
+
outputTokens: {
|
|
22
|
+
total: void 0,
|
|
23
|
+
text: void 0,
|
|
24
|
+
reasoning: void 0
|
|
25
|
+
},
|
|
26
|
+
raw: void 0
|
|
27
|
+
};
|
|
28
|
+
const promptTokens = (_a = usage.prompt_tokens) != null ? _a : 0;
|
|
29
|
+
const completionTokens = (_b = usage.completion_tokens) != null ? _b : 0;
|
|
30
|
+
const cacheReadTokens = (_d = (_c = usage.prompt_tokens_details) == null ? void 0 : _c.cached_tokens) != null ? _d : 0;
|
|
31
|
+
const reasoningTokens = (_f = (_e = usage.completion_tokens_details) == null ? void 0 : _e.reasoning_tokens) != null ? _f : 0;
|
|
32
|
+
return {
|
|
33
|
+
inputTokens: {
|
|
34
|
+
total: promptTokens,
|
|
35
|
+
noCache: promptTokens - cacheReadTokens,
|
|
36
|
+
cacheRead: cacheReadTokens,
|
|
37
|
+
cacheWrite: void 0
|
|
38
|
+
},
|
|
39
|
+
outputTokens: {
|
|
40
|
+
total: completionTokens,
|
|
41
|
+
text: completionTokens - reasoningTokens,
|
|
42
|
+
reasoning: reasoningTokens
|
|
43
|
+
},
|
|
44
|
+
raw: usage
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function getOpenAIMetadata(message) {
|
|
48
|
+
var _a, _b;
|
|
49
|
+
return (_b = (_a = message == null ? void 0 : message.providerOptions) == null ? void 0 : _a.openaiCompatible) != null ? _b : {};
|
|
50
|
+
}
|
|
51
|
+
function getAudioFormat(mediaType) {
|
|
52
|
+
switch (mediaType) {
|
|
53
|
+
case "audio/wav": return "wav";
|
|
54
|
+
case "audio/mp3":
|
|
55
|
+
case "audio/mpeg": return "mp3";
|
|
56
|
+
default: return null;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function convertToOpenAICompatibleChatMessages(prompt) {
|
|
60
|
+
var _a, _b, _c;
|
|
61
|
+
const messages = [];
|
|
62
|
+
for (const { role, content, ...message } of prompt) {
|
|
63
|
+
const metadata = getOpenAIMetadata({ ...message });
|
|
64
|
+
switch (role) {
|
|
65
|
+
case "system":
|
|
66
|
+
messages.push({
|
|
67
|
+
role: "system",
|
|
68
|
+
content,
|
|
69
|
+
...metadata
|
|
70
|
+
});
|
|
71
|
+
break;
|
|
72
|
+
case "user":
|
|
73
|
+
if (content.length === 1 && content[0].type === "text") {
|
|
74
|
+
messages.push({
|
|
75
|
+
role: "user",
|
|
76
|
+
content: content[0].text,
|
|
77
|
+
...getOpenAIMetadata(content[0])
|
|
78
|
+
});
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
messages.push({
|
|
82
|
+
role: "user",
|
|
83
|
+
content: content.map((part) => {
|
|
84
|
+
var _a2;
|
|
85
|
+
const partMetadata = getOpenAIMetadata(part);
|
|
86
|
+
switch (part.type) {
|
|
87
|
+
case "text": return {
|
|
88
|
+
type: "text",
|
|
89
|
+
text: part.text,
|
|
90
|
+
...partMetadata
|
|
91
|
+
};
|
|
92
|
+
case "file":
|
|
93
|
+
if (part.mediaType.startsWith("image/")) {
|
|
94
|
+
const mediaType = part.mediaType === "image/*" ? "image/jpeg" : part.mediaType;
|
|
95
|
+
return {
|
|
96
|
+
type: "image_url",
|
|
97
|
+
image_url: { url: part.data instanceof URL ? part.data.toString() : `data:${mediaType};base64,${convertToBase64(part.data)}` },
|
|
98
|
+
...partMetadata
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
if (part.mediaType.startsWith("audio/")) {
|
|
102
|
+
if (part.data instanceof URL) throw new UnsupportedFunctionalityError({ functionality: "audio file parts with URLs" });
|
|
103
|
+
const format = getAudioFormat(part.mediaType);
|
|
104
|
+
if (format === null) throw new UnsupportedFunctionalityError({ functionality: `audio media type ${part.mediaType}` });
|
|
105
|
+
return {
|
|
106
|
+
type: "input_audio",
|
|
107
|
+
input_audio: {
|
|
108
|
+
data: convertToBase64(part.data),
|
|
109
|
+
format
|
|
110
|
+
},
|
|
111
|
+
...partMetadata
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
if (part.mediaType === "application/pdf") {
|
|
115
|
+
if (part.data instanceof URL) throw new UnsupportedFunctionalityError({ functionality: "PDF file parts with URLs" });
|
|
116
|
+
return {
|
|
117
|
+
type: "file",
|
|
118
|
+
file: {
|
|
119
|
+
filename: (_a2 = part.filename) != null ? _a2 : "document.pdf",
|
|
120
|
+
file_data: `data:application/pdf;base64,${convertToBase64(part.data)}`
|
|
121
|
+
},
|
|
122
|
+
...partMetadata
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
if (part.mediaType.startsWith("text/")) return {
|
|
126
|
+
type: "text",
|
|
127
|
+
text: part.data instanceof URL ? part.data.toString() : typeof part.data === "string" ? new TextDecoder().decode(convertBase64ToUint8Array(part.data)) : new TextDecoder().decode(part.data),
|
|
128
|
+
...partMetadata
|
|
129
|
+
};
|
|
130
|
+
throw new UnsupportedFunctionalityError({ functionality: `file part media type ${part.mediaType}` });
|
|
131
|
+
}
|
|
132
|
+
}),
|
|
133
|
+
...metadata
|
|
134
|
+
});
|
|
135
|
+
break;
|
|
136
|
+
case "assistant": {
|
|
137
|
+
let text = "";
|
|
138
|
+
let reasoning = "";
|
|
139
|
+
const toolCalls = [];
|
|
140
|
+
for (const part of content) {
|
|
141
|
+
const partMetadata = getOpenAIMetadata(part);
|
|
142
|
+
switch (part.type) {
|
|
143
|
+
case "text":
|
|
144
|
+
text += part.text;
|
|
145
|
+
break;
|
|
146
|
+
case "reasoning":
|
|
147
|
+
reasoning += part.text;
|
|
148
|
+
break;
|
|
149
|
+
case "tool-call": {
|
|
150
|
+
const thoughtSignature = (_b = (_a = part.providerOptions) == null ? void 0 : _a.google) == null ? void 0 : _b.thoughtSignature;
|
|
151
|
+
toolCalls.push({
|
|
152
|
+
id: part.toolCallId,
|
|
153
|
+
type: "function",
|
|
154
|
+
function: {
|
|
155
|
+
name: part.toolName,
|
|
156
|
+
arguments: JSON.stringify(part.input)
|
|
157
|
+
},
|
|
158
|
+
...partMetadata,
|
|
159
|
+
...thoughtSignature ? { extra_content: { google: { thought_signature: String(thoughtSignature) } } } : {}
|
|
160
|
+
});
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
messages.push({
|
|
166
|
+
role: "assistant",
|
|
167
|
+
content: text,
|
|
168
|
+
...reasoning.length > 0 ? { reasoning_content: reasoning } : {},
|
|
169
|
+
tool_calls: toolCalls.length > 0 ? toolCalls : void 0,
|
|
170
|
+
...metadata
|
|
171
|
+
});
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
case "tool":
|
|
175
|
+
for (const toolResponse of content) {
|
|
176
|
+
if (toolResponse.type === "tool-approval-response") continue;
|
|
177
|
+
const output = toolResponse.output;
|
|
178
|
+
let contentValue;
|
|
179
|
+
switch (output.type) {
|
|
180
|
+
case "text":
|
|
181
|
+
case "error-text":
|
|
182
|
+
contentValue = output.value;
|
|
183
|
+
break;
|
|
184
|
+
case "execution-denied":
|
|
185
|
+
contentValue = (_c = output.reason) != null ? _c : "Tool execution denied.";
|
|
186
|
+
break;
|
|
187
|
+
case "content":
|
|
188
|
+
case "json":
|
|
189
|
+
case "error-json":
|
|
190
|
+
contentValue = JSON.stringify(output.value);
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
193
|
+
const toolResponseMetadata = getOpenAIMetadata(toolResponse);
|
|
194
|
+
messages.push({
|
|
195
|
+
role: "tool",
|
|
196
|
+
tool_call_id: toolResponse.toolCallId,
|
|
197
|
+
content: contentValue,
|
|
198
|
+
...toolResponseMetadata
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
break;
|
|
202
|
+
default: {
|
|
203
|
+
const _exhaustiveCheck = role;
|
|
204
|
+
throw new Error(`Unsupported role: ${_exhaustiveCheck}`);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return messages;
|
|
209
|
+
}
|
|
210
|
+
function getResponseMetadata({ id, model, created }) {
|
|
211
|
+
return {
|
|
212
|
+
id: id != null ? id : void 0,
|
|
213
|
+
modelId: model != null ? model : void 0,
|
|
214
|
+
timestamp: created != null ? /* @__PURE__ */ new Date(created * 1e3) : void 0
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
function mapOpenAICompatibleFinishReason(finishReason) {
|
|
218
|
+
switch (finishReason) {
|
|
219
|
+
case "stop": return "stop";
|
|
220
|
+
case "length": return "length";
|
|
221
|
+
case "content_filter": return "content-filter";
|
|
222
|
+
case "function_call":
|
|
223
|
+
case "tool_calls": return "tool-calls";
|
|
224
|
+
default: return "other";
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
var openaiCompatibleLanguageModelChatOptions = object({
|
|
228
|
+
user: string().optional(),
|
|
229
|
+
reasoningEffort: string().optional(),
|
|
230
|
+
textVerbosity: string().optional(),
|
|
231
|
+
strictJsonSchema: boolean().optional()
|
|
232
|
+
});
|
|
233
|
+
function prepareTools({ tools, toolChoice }) {
|
|
234
|
+
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
235
|
+
const toolWarnings = [];
|
|
236
|
+
if (tools == null) return {
|
|
237
|
+
tools: void 0,
|
|
238
|
+
toolChoice: void 0,
|
|
239
|
+
toolWarnings
|
|
240
|
+
};
|
|
241
|
+
const openaiCompatTools = [];
|
|
242
|
+
for (const tool of tools) if (tool.type === "provider") toolWarnings.push({
|
|
243
|
+
type: "unsupported",
|
|
244
|
+
feature: `provider-defined tool ${tool.id}`
|
|
245
|
+
});
|
|
246
|
+
else openaiCompatTools.push({
|
|
247
|
+
type: "function",
|
|
248
|
+
function: {
|
|
249
|
+
name: tool.name,
|
|
250
|
+
description: tool.description,
|
|
251
|
+
parameters: tool.inputSchema,
|
|
252
|
+
...tool.strict != null ? { strict: tool.strict } : {}
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
if (toolChoice == null) return {
|
|
256
|
+
tools: openaiCompatTools,
|
|
257
|
+
toolChoice: void 0,
|
|
258
|
+
toolWarnings
|
|
259
|
+
};
|
|
260
|
+
const type = toolChoice.type;
|
|
261
|
+
switch (type) {
|
|
262
|
+
case "auto":
|
|
263
|
+
case "none":
|
|
264
|
+
case "required": return {
|
|
265
|
+
tools: openaiCompatTools,
|
|
266
|
+
toolChoice: type,
|
|
267
|
+
toolWarnings
|
|
268
|
+
};
|
|
269
|
+
case "tool": return {
|
|
270
|
+
tools: openaiCompatTools,
|
|
271
|
+
toolChoice: {
|
|
272
|
+
type: "function",
|
|
273
|
+
function: { name: toolChoice.toolName }
|
|
274
|
+
},
|
|
275
|
+
toolWarnings
|
|
276
|
+
};
|
|
277
|
+
default: throw new UnsupportedFunctionalityError({ functionality: `tool choice type: ${type}` });
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
var OpenAICompatibleChatLanguageModel = class {
|
|
281
|
+
constructor(modelId, config) {
|
|
282
|
+
this.specificationVersion = "v3";
|
|
283
|
+
var _a, _b;
|
|
284
|
+
this.modelId = modelId;
|
|
285
|
+
this.config = config;
|
|
286
|
+
const errorStructure = (_a = config.errorStructure) != null ? _a : defaultOpenAICompatibleErrorStructure;
|
|
287
|
+
this.chunkSchema = createOpenAICompatibleChatChunkSchema(errorStructure.errorSchema);
|
|
288
|
+
this.failedResponseHandler = createJsonErrorResponseHandler(errorStructure);
|
|
289
|
+
this.supportsStructuredOutputs = (_b = config.supportsStructuredOutputs) != null ? _b : false;
|
|
290
|
+
}
|
|
291
|
+
get provider() {
|
|
292
|
+
return this.config.provider;
|
|
293
|
+
}
|
|
294
|
+
get providerOptionsName() {
|
|
295
|
+
return this.config.provider.split(".")[0].trim();
|
|
296
|
+
}
|
|
297
|
+
get supportedUrls() {
|
|
298
|
+
var _a, _b, _c;
|
|
299
|
+
return (_c = (_b = (_a = this.config).supportedUrls) == null ? void 0 : _b.call(_a)) != null ? _c : {};
|
|
300
|
+
}
|
|
301
|
+
transformRequestBody(args) {
|
|
302
|
+
var _a, _b, _c;
|
|
303
|
+
return (_c = (_b = (_a = this.config).transformRequestBody) == null ? void 0 : _b.call(_a, args)) != null ? _c : args;
|
|
304
|
+
}
|
|
305
|
+
async getArgs({ prompt, maxOutputTokens, temperature, topP, topK, frequencyPenalty, presencePenalty, providerOptions, stopSequences, responseFormat, seed, toolChoice, tools }) {
|
|
306
|
+
var _a, _b, _c, _d, _e;
|
|
307
|
+
const warnings = [];
|
|
308
|
+
const deprecatedOptions = await parseProviderOptions({
|
|
309
|
+
provider: "openai-compatible",
|
|
310
|
+
providerOptions,
|
|
311
|
+
schema: openaiCompatibleLanguageModelChatOptions
|
|
312
|
+
});
|
|
313
|
+
if (deprecatedOptions != null) warnings.push({
|
|
314
|
+
type: "other",
|
|
315
|
+
message: `The 'openai-compatible' key in providerOptions is deprecated. Use 'openaiCompatible' instead.`
|
|
316
|
+
});
|
|
317
|
+
const compatibleOptions = Object.assign(deprecatedOptions != null ? deprecatedOptions : {}, (_a = await parseProviderOptions({
|
|
318
|
+
provider: "openaiCompatible",
|
|
319
|
+
providerOptions,
|
|
320
|
+
schema: openaiCompatibleLanguageModelChatOptions
|
|
321
|
+
})) != null ? _a : {}, (_b = await parseProviderOptions({
|
|
322
|
+
provider: this.providerOptionsName,
|
|
323
|
+
providerOptions,
|
|
324
|
+
schema: openaiCompatibleLanguageModelChatOptions
|
|
325
|
+
})) != null ? _b : {});
|
|
326
|
+
const strictJsonSchema = (_c = compatibleOptions == null ? void 0 : compatibleOptions.strictJsonSchema) != null ? _c : true;
|
|
327
|
+
if (topK != null) warnings.push({
|
|
328
|
+
type: "unsupported",
|
|
329
|
+
feature: "topK"
|
|
330
|
+
});
|
|
331
|
+
if ((responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !this.supportsStructuredOutputs) warnings.push({
|
|
332
|
+
type: "unsupported",
|
|
333
|
+
feature: "responseFormat",
|
|
334
|
+
details: "JSON response format schema is only supported with structuredOutputs"
|
|
335
|
+
});
|
|
336
|
+
const { tools: openaiTools, toolChoice: openaiToolChoice, toolWarnings } = prepareTools({
|
|
337
|
+
tools,
|
|
338
|
+
toolChoice
|
|
339
|
+
});
|
|
340
|
+
return {
|
|
341
|
+
args: {
|
|
342
|
+
model: this.modelId,
|
|
343
|
+
user: compatibleOptions.user,
|
|
344
|
+
max_tokens: maxOutputTokens,
|
|
345
|
+
temperature,
|
|
346
|
+
top_p: topP,
|
|
347
|
+
frequency_penalty: frequencyPenalty,
|
|
348
|
+
presence_penalty: presencePenalty,
|
|
349
|
+
response_format: (responseFormat == null ? void 0 : responseFormat.type) === "json" ? this.supportsStructuredOutputs === true && responseFormat.schema != null ? {
|
|
350
|
+
type: "json_schema",
|
|
351
|
+
json_schema: {
|
|
352
|
+
schema: responseFormat.schema,
|
|
353
|
+
strict: strictJsonSchema,
|
|
354
|
+
name: (_d = responseFormat.name) != null ? _d : "response",
|
|
355
|
+
description: responseFormat.description
|
|
356
|
+
}
|
|
357
|
+
} : { type: "json_object" } : void 0,
|
|
358
|
+
stop: stopSequences,
|
|
359
|
+
seed,
|
|
360
|
+
...Object.fromEntries(Object.entries((_e = providerOptions == null ? void 0 : providerOptions[this.providerOptionsName]) != null ? _e : {}).filter(([key]) => !Object.keys(openaiCompatibleLanguageModelChatOptions.shape).includes(key))),
|
|
361
|
+
reasoning_effort: compatibleOptions.reasoningEffort,
|
|
362
|
+
verbosity: compatibleOptions.textVerbosity,
|
|
363
|
+
messages: convertToOpenAICompatibleChatMessages(prompt),
|
|
364
|
+
tools: openaiTools,
|
|
365
|
+
tool_choice: openaiToolChoice
|
|
366
|
+
},
|
|
367
|
+
warnings: [...warnings, ...toolWarnings]
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
async doGenerate(options) {
|
|
371
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
372
|
+
const { args, warnings } = await this.getArgs({ ...options });
|
|
373
|
+
const transformedBody = this.transformRequestBody(args);
|
|
374
|
+
const body = JSON.stringify(transformedBody);
|
|
375
|
+
const { responseHeaders, value: responseBody, rawValue: rawResponse } = await postJsonToApi({
|
|
376
|
+
url: this.config.url({
|
|
377
|
+
path: "/chat/completions",
|
|
378
|
+
modelId: this.modelId
|
|
379
|
+
}),
|
|
380
|
+
headers: combineHeaders(this.config.headers(), options.headers),
|
|
381
|
+
body: transformedBody,
|
|
382
|
+
failedResponseHandler: this.failedResponseHandler,
|
|
383
|
+
successfulResponseHandler: createJsonResponseHandler(OpenAICompatibleChatResponseSchema),
|
|
384
|
+
abortSignal: options.abortSignal,
|
|
385
|
+
fetch: this.config.fetch
|
|
386
|
+
});
|
|
387
|
+
const choice = responseBody.choices[0];
|
|
388
|
+
const content = [];
|
|
389
|
+
const text = choice.message.content;
|
|
390
|
+
if (text != null && text.length > 0) content.push({
|
|
391
|
+
type: "text",
|
|
392
|
+
text
|
|
393
|
+
});
|
|
394
|
+
const reasoning = (_a = choice.message.reasoning_content) != null ? _a : choice.message.reasoning;
|
|
395
|
+
if (reasoning != null && reasoning.length > 0) content.push({
|
|
396
|
+
type: "reasoning",
|
|
397
|
+
text: reasoning
|
|
398
|
+
});
|
|
399
|
+
if (choice.message.tool_calls != null) for (const toolCall of choice.message.tool_calls) {
|
|
400
|
+
const thoughtSignature = (_c = (_b = toolCall.extra_content) == null ? void 0 : _b.google) == null ? void 0 : _c.thought_signature;
|
|
401
|
+
content.push({
|
|
402
|
+
type: "tool-call",
|
|
403
|
+
toolCallId: (_d = toolCall.id) != null ? _d : generateId(),
|
|
404
|
+
toolName: toolCall.function.name,
|
|
405
|
+
input: toolCall.function.arguments,
|
|
406
|
+
...thoughtSignature ? { providerMetadata: { [this.providerOptionsName]: { thoughtSignature } } } : {}
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
const providerMetadata = {
|
|
410
|
+
[this.providerOptionsName]: {},
|
|
411
|
+
...await ((_f = (_e = this.config.metadataExtractor) == null ? void 0 : _e.extractMetadata) == null ? void 0 : _f.call(_e, { parsedBody: rawResponse }))
|
|
412
|
+
};
|
|
413
|
+
const completionTokenDetails = (_g = responseBody.usage) == null ? void 0 : _g.completion_tokens_details;
|
|
414
|
+
if ((completionTokenDetails == null ? void 0 : completionTokenDetails.accepted_prediction_tokens) != null) providerMetadata[this.providerOptionsName].acceptedPredictionTokens = completionTokenDetails == null ? void 0 : completionTokenDetails.accepted_prediction_tokens;
|
|
415
|
+
if ((completionTokenDetails == null ? void 0 : completionTokenDetails.rejected_prediction_tokens) != null) providerMetadata[this.providerOptionsName].rejectedPredictionTokens = completionTokenDetails == null ? void 0 : completionTokenDetails.rejected_prediction_tokens;
|
|
416
|
+
return {
|
|
417
|
+
content,
|
|
418
|
+
finishReason: {
|
|
419
|
+
unified: mapOpenAICompatibleFinishReason(choice.finish_reason),
|
|
420
|
+
raw: (_h = choice.finish_reason) != null ? _h : void 0
|
|
421
|
+
},
|
|
422
|
+
usage: convertOpenAICompatibleChatUsage(responseBody.usage),
|
|
423
|
+
providerMetadata,
|
|
424
|
+
request: { body },
|
|
425
|
+
response: {
|
|
426
|
+
...getResponseMetadata(responseBody),
|
|
427
|
+
headers: responseHeaders,
|
|
428
|
+
body: rawResponse
|
|
429
|
+
},
|
|
430
|
+
warnings
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
async doStream(options) {
|
|
434
|
+
var _a;
|
|
435
|
+
const { args, warnings } = await this.getArgs({ ...options });
|
|
436
|
+
const body = this.transformRequestBody({
|
|
437
|
+
...args,
|
|
438
|
+
stream: true,
|
|
439
|
+
stream_options: this.config.includeUsage ? { include_usage: true } : void 0
|
|
440
|
+
});
|
|
441
|
+
const metadataExtractor = (_a = this.config.metadataExtractor) == null ? void 0 : _a.createStreamExtractor();
|
|
442
|
+
const { responseHeaders, value: response } = await postJsonToApi({
|
|
443
|
+
url: this.config.url({
|
|
444
|
+
path: "/chat/completions",
|
|
445
|
+
modelId: this.modelId
|
|
446
|
+
}),
|
|
447
|
+
headers: combineHeaders(this.config.headers(), options.headers),
|
|
448
|
+
body,
|
|
449
|
+
failedResponseHandler: this.failedResponseHandler,
|
|
450
|
+
successfulResponseHandler: createEventSourceResponseHandler(this.chunkSchema),
|
|
451
|
+
abortSignal: options.abortSignal,
|
|
452
|
+
fetch: this.config.fetch
|
|
453
|
+
});
|
|
454
|
+
const toolCalls = [];
|
|
455
|
+
let finishReason = {
|
|
456
|
+
unified: "other",
|
|
457
|
+
raw: void 0
|
|
458
|
+
};
|
|
459
|
+
let usage = void 0;
|
|
460
|
+
let isFirstChunk = true;
|
|
461
|
+
const providerOptionsName = this.providerOptionsName;
|
|
462
|
+
let isActiveReasoning = false;
|
|
463
|
+
let isActiveText = false;
|
|
464
|
+
return {
|
|
465
|
+
stream: response.pipeThrough(new TransformStream({
|
|
466
|
+
start(controller) {
|
|
467
|
+
controller.enqueue({
|
|
468
|
+
type: "stream-start",
|
|
469
|
+
warnings
|
|
470
|
+
});
|
|
471
|
+
},
|
|
472
|
+
transform(chunk, controller) {
|
|
473
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
474
|
+
if (options.includeRawChunks) controller.enqueue({
|
|
475
|
+
type: "raw",
|
|
476
|
+
rawValue: chunk.rawValue
|
|
477
|
+
});
|
|
478
|
+
if (!chunk.success) {
|
|
479
|
+
finishReason = {
|
|
480
|
+
unified: "error",
|
|
481
|
+
raw: void 0
|
|
482
|
+
};
|
|
483
|
+
controller.enqueue({
|
|
484
|
+
type: "error",
|
|
485
|
+
error: chunk.error
|
|
486
|
+
});
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
489
|
+
metadataExtractor?.processChunk(chunk.rawValue);
|
|
490
|
+
if ("error" in chunk.value) {
|
|
491
|
+
finishReason = {
|
|
492
|
+
unified: "error",
|
|
493
|
+
raw: void 0
|
|
494
|
+
};
|
|
495
|
+
controller.enqueue({
|
|
496
|
+
type: "error",
|
|
497
|
+
error: chunk.value.error.message
|
|
498
|
+
});
|
|
499
|
+
return;
|
|
500
|
+
}
|
|
501
|
+
const value = chunk.value;
|
|
502
|
+
if (isFirstChunk) {
|
|
503
|
+
isFirstChunk = false;
|
|
504
|
+
controller.enqueue({
|
|
505
|
+
type: "response-metadata",
|
|
506
|
+
...getResponseMetadata(value)
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
if (value.usage != null) usage = value.usage;
|
|
510
|
+
const choice = value.choices[0];
|
|
511
|
+
if ((choice == null ? void 0 : choice.finish_reason) != null) finishReason = {
|
|
512
|
+
unified: mapOpenAICompatibleFinishReason(choice.finish_reason),
|
|
513
|
+
raw: (_a2 = choice.finish_reason) != null ? _a2 : void 0
|
|
514
|
+
};
|
|
515
|
+
if ((choice == null ? void 0 : choice.delta) == null) return;
|
|
516
|
+
const delta = choice.delta;
|
|
517
|
+
const reasoningContent = (_b = delta.reasoning_content) != null ? _b : delta.reasoning;
|
|
518
|
+
if (reasoningContent) {
|
|
519
|
+
if (!isActiveReasoning) {
|
|
520
|
+
controller.enqueue({
|
|
521
|
+
type: "reasoning-start",
|
|
522
|
+
id: "reasoning-0"
|
|
523
|
+
});
|
|
524
|
+
isActiveReasoning = true;
|
|
525
|
+
}
|
|
526
|
+
controller.enqueue({
|
|
527
|
+
type: "reasoning-delta",
|
|
528
|
+
id: "reasoning-0",
|
|
529
|
+
delta: reasoningContent
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
if (delta.content) {
|
|
533
|
+
if (isActiveReasoning) {
|
|
534
|
+
controller.enqueue({
|
|
535
|
+
type: "reasoning-end",
|
|
536
|
+
id: "reasoning-0"
|
|
537
|
+
});
|
|
538
|
+
isActiveReasoning = false;
|
|
539
|
+
}
|
|
540
|
+
if (!isActiveText) {
|
|
541
|
+
controller.enqueue({
|
|
542
|
+
type: "text-start",
|
|
543
|
+
id: "txt-0"
|
|
544
|
+
});
|
|
545
|
+
isActiveText = true;
|
|
546
|
+
}
|
|
547
|
+
controller.enqueue({
|
|
548
|
+
type: "text-delta",
|
|
549
|
+
id: "txt-0",
|
|
550
|
+
delta: delta.content
|
|
551
|
+
});
|
|
552
|
+
}
|
|
553
|
+
if (delta.tool_calls != null) {
|
|
554
|
+
if (isActiveReasoning) {
|
|
555
|
+
controller.enqueue({
|
|
556
|
+
type: "reasoning-end",
|
|
557
|
+
id: "reasoning-0"
|
|
558
|
+
});
|
|
559
|
+
isActiveReasoning = false;
|
|
560
|
+
}
|
|
561
|
+
for (const toolCallDelta of delta.tool_calls) {
|
|
562
|
+
const index = (_c = toolCallDelta.index) != null ? _c : toolCalls.length;
|
|
563
|
+
if (toolCalls[index] == null) {
|
|
564
|
+
if (toolCallDelta.id == null) throw new InvalidResponseDataError({
|
|
565
|
+
data: toolCallDelta,
|
|
566
|
+
message: `Expected 'id' to be a string.`
|
|
567
|
+
});
|
|
568
|
+
if (((_d = toolCallDelta.function) == null ? void 0 : _d.name) == null) throw new InvalidResponseDataError({
|
|
569
|
+
data: toolCallDelta,
|
|
570
|
+
message: `Expected 'function.name' to be a string.`
|
|
571
|
+
});
|
|
572
|
+
controller.enqueue({
|
|
573
|
+
type: "tool-input-start",
|
|
574
|
+
id: toolCallDelta.id,
|
|
575
|
+
toolName: toolCallDelta.function.name
|
|
576
|
+
});
|
|
577
|
+
toolCalls[index] = {
|
|
578
|
+
id: toolCallDelta.id,
|
|
579
|
+
type: "function",
|
|
580
|
+
function: {
|
|
581
|
+
name: toolCallDelta.function.name,
|
|
582
|
+
arguments: (_e = toolCallDelta.function.arguments) != null ? _e : ""
|
|
583
|
+
},
|
|
584
|
+
hasFinished: false,
|
|
585
|
+
thoughtSignature: (_h = (_g = (_f = toolCallDelta.extra_content) == null ? void 0 : _f.google) == null ? void 0 : _g.thought_signature) != null ? _h : void 0
|
|
586
|
+
};
|
|
587
|
+
const toolCall2 = toolCalls[index];
|
|
588
|
+
if (((_i = toolCall2.function) == null ? void 0 : _i.name) != null && ((_j = toolCall2.function) == null ? void 0 : _j.arguments) != null) {
|
|
589
|
+
if (toolCall2.function.arguments.length > 0) controller.enqueue({
|
|
590
|
+
type: "tool-input-delta",
|
|
591
|
+
id: toolCall2.id,
|
|
592
|
+
delta: toolCall2.function.arguments
|
|
593
|
+
});
|
|
594
|
+
if (isParsableJson(toolCall2.function.arguments)) {
|
|
595
|
+
controller.enqueue({
|
|
596
|
+
type: "tool-input-end",
|
|
597
|
+
id: toolCall2.id
|
|
598
|
+
});
|
|
599
|
+
controller.enqueue({
|
|
600
|
+
type: "tool-call",
|
|
601
|
+
toolCallId: (_k = toolCall2.id) != null ? _k : generateId(),
|
|
602
|
+
toolName: toolCall2.function.name,
|
|
603
|
+
input: toolCall2.function.arguments,
|
|
604
|
+
...toolCall2.thoughtSignature ? { providerMetadata: { [providerOptionsName]: { thoughtSignature: toolCall2.thoughtSignature } } } : {}
|
|
605
|
+
});
|
|
606
|
+
toolCall2.hasFinished = true;
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
continue;
|
|
610
|
+
}
|
|
611
|
+
const toolCall = toolCalls[index];
|
|
612
|
+
if (toolCall.hasFinished) continue;
|
|
613
|
+
if (((_l = toolCallDelta.function) == null ? void 0 : _l.arguments) != null) toolCall.function.arguments += (_n = (_m = toolCallDelta.function) == null ? void 0 : _m.arguments) != null ? _n : "";
|
|
614
|
+
controller.enqueue({
|
|
615
|
+
type: "tool-input-delta",
|
|
616
|
+
id: toolCall.id,
|
|
617
|
+
delta: (_o = toolCallDelta.function.arguments) != null ? _o : ""
|
|
618
|
+
});
|
|
619
|
+
if (((_p = toolCall.function) == null ? void 0 : _p.name) != null && ((_q = toolCall.function) == null ? void 0 : _q.arguments) != null && isParsableJson(toolCall.function.arguments)) {
|
|
620
|
+
controller.enqueue({
|
|
621
|
+
type: "tool-input-end",
|
|
622
|
+
id: toolCall.id
|
|
623
|
+
});
|
|
624
|
+
controller.enqueue({
|
|
625
|
+
type: "tool-call",
|
|
626
|
+
toolCallId: (_r = toolCall.id) != null ? _r : generateId(),
|
|
627
|
+
toolName: toolCall.function.name,
|
|
628
|
+
input: toolCall.function.arguments,
|
|
629
|
+
...toolCall.thoughtSignature ? { providerMetadata: { [providerOptionsName]: { thoughtSignature: toolCall.thoughtSignature } } } : {}
|
|
630
|
+
});
|
|
631
|
+
toolCall.hasFinished = true;
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
},
|
|
636
|
+
flush(controller) {
|
|
637
|
+
var _a2, _b, _c, _d, _e;
|
|
638
|
+
if (isActiveReasoning) controller.enqueue({
|
|
639
|
+
type: "reasoning-end",
|
|
640
|
+
id: "reasoning-0"
|
|
641
|
+
});
|
|
642
|
+
if (isActiveText) controller.enqueue({
|
|
643
|
+
type: "text-end",
|
|
644
|
+
id: "txt-0"
|
|
645
|
+
});
|
|
646
|
+
for (const toolCall of toolCalls.filter((toolCall2) => !toolCall2.hasFinished)) {
|
|
647
|
+
controller.enqueue({
|
|
648
|
+
type: "tool-input-end",
|
|
649
|
+
id: toolCall.id
|
|
650
|
+
});
|
|
651
|
+
controller.enqueue({
|
|
652
|
+
type: "tool-call",
|
|
653
|
+
toolCallId: (_a2 = toolCall.id) != null ? _a2 : generateId(),
|
|
654
|
+
toolName: toolCall.function.name,
|
|
655
|
+
input: toolCall.function.arguments,
|
|
656
|
+
...toolCall.thoughtSignature ? { providerMetadata: { [providerOptionsName]: { thoughtSignature: toolCall.thoughtSignature } } } : {}
|
|
657
|
+
});
|
|
658
|
+
}
|
|
659
|
+
const providerMetadata = {
|
|
660
|
+
[providerOptionsName]: {},
|
|
661
|
+
...metadataExtractor == null ? void 0 : metadataExtractor.buildMetadata()
|
|
662
|
+
};
|
|
663
|
+
if (((_b = usage == null ? void 0 : usage.completion_tokens_details) == null ? void 0 : _b.accepted_prediction_tokens) != null) providerMetadata[providerOptionsName].acceptedPredictionTokens = (_c = usage == null ? void 0 : usage.completion_tokens_details) == null ? void 0 : _c.accepted_prediction_tokens;
|
|
664
|
+
if (((_d = usage == null ? void 0 : usage.completion_tokens_details) == null ? void 0 : _d.rejected_prediction_tokens) != null) providerMetadata[providerOptionsName].rejectedPredictionTokens = (_e = usage == null ? void 0 : usage.completion_tokens_details) == null ? void 0 : _e.rejected_prediction_tokens;
|
|
665
|
+
controller.enqueue({
|
|
666
|
+
type: "finish",
|
|
667
|
+
finishReason,
|
|
668
|
+
usage: convertOpenAICompatibleChatUsage(usage),
|
|
669
|
+
providerMetadata
|
|
670
|
+
});
|
|
671
|
+
}
|
|
672
|
+
})),
|
|
673
|
+
request: { body },
|
|
674
|
+
response: { headers: responseHeaders }
|
|
675
|
+
};
|
|
676
|
+
}
|
|
677
|
+
};
|
|
678
|
+
var openaiCompatibleTokenUsageSchema = looseObject({
|
|
679
|
+
prompt_tokens: number().nullish(),
|
|
680
|
+
completion_tokens: number().nullish(),
|
|
681
|
+
total_tokens: number().nullish(),
|
|
682
|
+
prompt_tokens_details: object({ cached_tokens: number().nullish() }).nullish(),
|
|
683
|
+
completion_tokens_details: object({
|
|
684
|
+
reasoning_tokens: number().nullish(),
|
|
685
|
+
accepted_prediction_tokens: number().nullish(),
|
|
686
|
+
rejected_prediction_tokens: number().nullish()
|
|
687
|
+
}).nullish()
|
|
688
|
+
}).nullish();
|
|
689
|
+
var OpenAICompatibleChatResponseSchema = looseObject({
|
|
690
|
+
id: string().nullish(),
|
|
691
|
+
created: number().nullish(),
|
|
692
|
+
model: string().nullish(),
|
|
693
|
+
choices: array(object({
|
|
694
|
+
message: object({
|
|
695
|
+
role: literal("assistant").nullish(),
|
|
696
|
+
content: string().nullish(),
|
|
697
|
+
reasoning_content: string().nullish(),
|
|
698
|
+
reasoning: string().nullish(),
|
|
699
|
+
tool_calls: array(object({
|
|
700
|
+
id: string().nullish(),
|
|
701
|
+
function: object({
|
|
702
|
+
name: string(),
|
|
703
|
+
arguments: string()
|
|
704
|
+
}),
|
|
705
|
+
extra_content: object({ google: object({ thought_signature: string().nullish() }).nullish() }).nullish()
|
|
706
|
+
})).nullish()
|
|
707
|
+
}),
|
|
708
|
+
finish_reason: string().nullish()
|
|
709
|
+
})),
|
|
710
|
+
usage: openaiCompatibleTokenUsageSchema
|
|
711
|
+
});
|
|
712
|
+
var chunkBaseSchema = looseObject({
|
|
713
|
+
id: string().nullish(),
|
|
714
|
+
created: number().nullish(),
|
|
715
|
+
model: string().nullish(),
|
|
716
|
+
choices: array(object({
|
|
717
|
+
delta: object({
|
|
718
|
+
role: _enum(["assistant"]).nullish(),
|
|
719
|
+
content: string().nullish(),
|
|
720
|
+
reasoning_content: string().nullish(),
|
|
721
|
+
reasoning: string().nullish(),
|
|
722
|
+
tool_calls: array(object({
|
|
723
|
+
index: number().nullish(),
|
|
724
|
+
id: string().nullish(),
|
|
725
|
+
function: object({
|
|
726
|
+
name: string().nullish(),
|
|
727
|
+
arguments: string().nullish()
|
|
728
|
+
}),
|
|
729
|
+
extra_content: object({ google: object({ thought_signature: string().nullish() }).nullish() }).nullish()
|
|
730
|
+
})).nullish()
|
|
731
|
+
}).nullish(),
|
|
732
|
+
finish_reason: string().nullish()
|
|
733
|
+
})),
|
|
734
|
+
usage: openaiCompatibleTokenUsageSchema
|
|
735
|
+
});
|
|
736
|
+
var createOpenAICompatibleChatChunkSchema = (errorSchema) => union([chunkBaseSchema, errorSchema]);
|
|
737
|
+
object({
|
|
738
|
+
echo: boolean().optional(),
|
|
739
|
+
logitBias: record(string(), number()).optional(),
|
|
740
|
+
suffix: string().optional(),
|
|
741
|
+
user: string().optional()
|
|
742
|
+
});
|
|
743
|
+
var usageSchema = object({
|
|
744
|
+
prompt_tokens: number(),
|
|
745
|
+
completion_tokens: number(),
|
|
746
|
+
total_tokens: number()
|
|
747
|
+
});
|
|
748
|
+
object({
|
|
749
|
+
id: string().nullish(),
|
|
750
|
+
created: number().nullish(),
|
|
751
|
+
model: string().nullish(),
|
|
752
|
+
choices: array(object({
|
|
753
|
+
text: string(),
|
|
754
|
+
finish_reason: string()
|
|
755
|
+
})),
|
|
756
|
+
usage: usageSchema.nullish()
|
|
757
|
+
});
|
|
758
|
+
object({
|
|
759
|
+
dimensions: number().optional(),
|
|
760
|
+
user: string().optional()
|
|
761
|
+
});
|
|
762
|
+
object({
|
|
763
|
+
data: array(object({ embedding: array(number()) })),
|
|
764
|
+
usage: object({ prompt_tokens: number() }).nullish(),
|
|
765
|
+
providerMetadata: record(string(), record(string(), any())).optional()
|
|
766
|
+
});
|
|
767
|
+
object({ data: array(object({ b64_json: string() })) });
|
|
768
|
+
//#endregion
|
|
769
|
+
//#region ../../node_modules/.pnpm/@ai-sdk+moonshotai@2.0.10_zod@4.3.6/node_modules/@ai-sdk/moonshotai/dist/index.mjs
|
|
770
|
+
function convertMoonshotAIChatUsage(usage) {
|
|
771
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
772
|
+
if (usage == null) return {
|
|
773
|
+
inputTokens: {
|
|
774
|
+
total: void 0,
|
|
775
|
+
noCache: void 0,
|
|
776
|
+
cacheRead: void 0,
|
|
777
|
+
cacheWrite: void 0
|
|
778
|
+
},
|
|
779
|
+
outputTokens: {
|
|
780
|
+
total: void 0,
|
|
781
|
+
text: void 0,
|
|
782
|
+
reasoning: void 0
|
|
783
|
+
},
|
|
784
|
+
raw: void 0
|
|
785
|
+
};
|
|
786
|
+
const promptTokens = (_a = usage.prompt_tokens) != null ? _a : 0;
|
|
787
|
+
const completionTokens = (_b = usage.completion_tokens) != null ? _b : 0;
|
|
788
|
+
const cacheReadTokens = (_e = (_d = usage.cached_tokens) != null ? _d : (_c = usage.prompt_tokens_details) == null ? void 0 : _c.cached_tokens) != null ? _e : 0;
|
|
789
|
+
const reasoningTokens = (_g = (_f = usage.completion_tokens_details) == null ? void 0 : _f.reasoning_tokens) != null ? _g : 0;
|
|
790
|
+
return {
|
|
791
|
+
inputTokens: {
|
|
792
|
+
total: promptTokens,
|
|
793
|
+
noCache: promptTokens - cacheReadTokens,
|
|
794
|
+
cacheRead: cacheReadTokens,
|
|
795
|
+
cacheWrite: void 0
|
|
796
|
+
},
|
|
797
|
+
outputTokens: {
|
|
798
|
+
total: completionTokens,
|
|
799
|
+
text: completionTokens - reasoningTokens,
|
|
800
|
+
reasoning: reasoningTokens
|
|
801
|
+
},
|
|
802
|
+
raw: usage
|
|
803
|
+
};
|
|
804
|
+
}
|
|
805
|
+
var MoonshotAIChatLanguageModel = class extends OpenAICompatibleChatLanguageModel {
|
|
806
|
+
constructor(modelId, config) {
|
|
807
|
+
super(modelId, config);
|
|
808
|
+
}
|
|
809
|
+
async doGenerate(options) {
|
|
810
|
+
var _a, _b;
|
|
811
|
+
const result = await super.doGenerate(options);
|
|
812
|
+
const usage = (_b = (_a = result.response) == null ? void 0 : _a.body) == null ? void 0 : _b.usage;
|
|
813
|
+
return {
|
|
814
|
+
...result,
|
|
815
|
+
usage: convertMoonshotAIChatUsage(usage)
|
|
816
|
+
};
|
|
817
|
+
}
|
|
818
|
+
async doStream(options) {
|
|
819
|
+
const result = await super.doStream(options);
|
|
820
|
+
return {
|
|
821
|
+
...result,
|
|
822
|
+
stream: result.stream.pipeThrough(new TransformStream({ transform(chunk, controller) {
|
|
823
|
+
if (chunk.type === "finish" && chunk.usage) controller.enqueue({
|
|
824
|
+
...chunk,
|
|
825
|
+
usage: convertMoonshotAIChatUsage(chunk.usage.raw)
|
|
826
|
+
});
|
|
827
|
+
else controller.enqueue(chunk);
|
|
828
|
+
} }))
|
|
829
|
+
};
|
|
830
|
+
}
|
|
831
|
+
};
|
|
832
|
+
var VERSION = "2.0.10";
|
|
833
|
+
var moonshotaiErrorStructure = {
|
|
834
|
+
errorSchema: object({ error: object({
|
|
835
|
+
message: string(),
|
|
836
|
+
type: string().nullish()
|
|
837
|
+
}) }),
|
|
838
|
+
errorToMessage: (data) => data.error.message
|
|
839
|
+
};
|
|
840
|
+
var defaultBaseURL = "https://api.moonshot.ai/v1";
|
|
841
|
+
function createMoonshotAI(options = {}) {
|
|
842
|
+
var _a;
|
|
843
|
+
const baseURL = withoutTrailingSlash((_a = options.baseURL) != null ? _a : defaultBaseURL);
|
|
844
|
+
const getHeaders = () => withUserAgentSuffix({
|
|
845
|
+
Authorization: `Bearer ${loadApiKey({
|
|
846
|
+
apiKey: options.apiKey,
|
|
847
|
+
environmentVariableName: "MOONSHOT_API_KEY",
|
|
848
|
+
description: "Moonshot API key"
|
|
849
|
+
})}`,
|
|
850
|
+
...options.headers
|
|
851
|
+
}, `ai-sdk/moonshotai/${VERSION}`);
|
|
852
|
+
const getCommonModelConfig = (modelType) => ({
|
|
853
|
+
provider: `moonshotai.${modelType}`,
|
|
854
|
+
url: ({ path }) => `${baseURL}${path}`,
|
|
855
|
+
headers: getHeaders,
|
|
856
|
+
fetch: options.fetch
|
|
857
|
+
});
|
|
858
|
+
const createChatModel = (modelId) => {
|
|
859
|
+
return new MoonshotAIChatLanguageModel(modelId, {
|
|
860
|
+
...getCommonModelConfig("chat"),
|
|
861
|
+
includeUsage: true,
|
|
862
|
+
errorStructure: moonshotaiErrorStructure,
|
|
863
|
+
transformRequestBody: (args) => {
|
|
864
|
+
const thinking = args.thinking;
|
|
865
|
+
const reasoningHistory = args.reasoningHistory;
|
|
866
|
+
const { thinking: _, reasoningHistory: __, ...rest } = args;
|
|
867
|
+
return {
|
|
868
|
+
...rest,
|
|
869
|
+
...thinking && { thinking: {
|
|
870
|
+
type: thinking.type,
|
|
871
|
+
...thinking.budgetTokens !== void 0 && { budget_tokens: thinking.budgetTokens }
|
|
872
|
+
} },
|
|
873
|
+
...reasoningHistory && { reasoning_history: reasoningHistory }
|
|
874
|
+
};
|
|
875
|
+
}
|
|
876
|
+
});
|
|
877
|
+
};
|
|
878
|
+
const provider = (modelId) => createChatModel(modelId);
|
|
879
|
+
provider.specificationVersion = "v3";
|
|
880
|
+
provider.chatModel = createChatModel;
|
|
881
|
+
provider.languageModel = createChatModel;
|
|
882
|
+
provider.embeddingModel = (modelId) => {
|
|
883
|
+
throw new NoSuchModelError({
|
|
884
|
+
modelId,
|
|
885
|
+
modelType: "embeddingModel"
|
|
886
|
+
});
|
|
887
|
+
};
|
|
888
|
+
provider.imageModel = (modelId) => {
|
|
889
|
+
throw new NoSuchModelError({
|
|
890
|
+
modelId,
|
|
891
|
+
modelType: "imageModel"
|
|
892
|
+
});
|
|
893
|
+
};
|
|
894
|
+
return provider;
|
|
895
|
+
}
|
|
896
|
+
createMoonshotAI();
|
|
897
|
+
//#endregion
|
|
898
|
+
export { createMoonshotAI as t };
|