evalution 1.0.5 → 1.0.7
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/LICENSING.md +16 -1
- package/README.md +1 -0
- package/dist/check-BTg6THHB.d.ts +1925 -0
- package/dist/checks/index.d.ts +71 -0
- package/dist/checks/index.js +2 -0
- package/dist/checks-Cq97JU-h.js +309 -0
- package/dist/cli/index.js +5341 -352
- package/dist/client/assets/DatasetView-BcYR5beY.css +1 -0
- package/dist/client/assets/DatasetView-CWw3B_XI.js +15 -0
- package/dist/client/assets/EvalRunView-DJNSAydj.js +2 -0
- package/dist/client/assets/EvalView-R0Nkikzs.js +1 -0
- package/dist/client/assets/abap-BdImnpbu.js +1 -0
- package/dist/client/assets/actionscript-3-CoDkCxhg.js +1 -0
- package/dist/client/assets/ada-bCR0ucgS.js +1 -0
- package/dist/client/assets/andromeeda-C4gqWexZ.js +1 -0
- package/dist/client/assets/angular-html-CU67Zn6k.js +1 -0
- package/dist/client/assets/angular-ts-BwZT4LLn.js +1 -0
- package/dist/client/assets/apache-Pmp26Uib.js +1 -0
- package/dist/client/assets/apex-D8_7TLub.js +1 -0
- package/dist/client/assets/apl-dKokRX4l.js +1 -0
- package/dist/client/assets/applescript-Co6uUVPk.js +1 -0
- package/dist/client/assets/ara-BRHolxvo.js +1 -0
- package/dist/client/assets/asciidoc-Ve4PFQV2.js +1 -0
- package/dist/client/assets/asm-D_Q5rh1f.js +1 -0
- package/dist/client/assets/astro-CbQHKStN.js +1 -0
- package/dist/client/assets/aurora-x-D-2ljcwZ.js +1 -0
- package/dist/client/assets/awk-DMzUqQB5.js +1 -0
- package/dist/client/assets/ayu-dark-DYE7WIF3.js +1 -0
- package/dist/client/assets/ayu-light-BA47KaF1.js +1 -0
- package/dist/client/assets/ayu-mirage-32ctXXKs.js +1 -0
- package/dist/client/assets/ballerina-BFfxhgS-.js +1 -0
- package/dist/client/assets/bat-BkioyH1T.js +1 -0
- package/dist/client/assets/beancount-k_qm7-4y.js +1 -0
- package/dist/client/assets/berry-uYugtg8r.js +1 -0
- package/dist/client/assets/bibtex-CHM0blh-.js +1 -0
- package/dist/client/assets/bicep-Bmn6On1c.js +1 -0
- package/dist/client/assets/bird2-DPOp833l.js +1 -0
- package/dist/client/assets/blade-D4QpJJKB.js +1 -0
- package/dist/client/assets/bsl-BO_Y6i37.js +1 -0
- package/dist/client/assets/c-BIGW1oBm.js +1 -0
- package/dist/client/assets/c3-eo99z4R2.js +1 -0
- package/dist/client/assets/cadence-Bv_4Rxtq.js +1 -0
- package/dist/client/assets/cairo-KRGpt6FW.js +1 -0
- package/dist/client/assets/catppuccin-frappe-DFWUc33u.js +1 -0
- package/dist/client/assets/catppuccin-latte-C9dUb6Cb.js +1 -0
- package/dist/client/assets/catppuccin-macchiato-DQyhUUbL.js +1 -0
- package/dist/client/assets/catppuccin-mocha-D87Tk5Gz.js +1 -0
- package/dist/client/assets/clarity-D53aC0YG.js +1 -0
- package/dist/client/assets/clojure-P80f7IUj.js +1 -0
- package/dist/client/assets/cmake-D1j8_8rp.js +1 -0
- package/dist/client/assets/cobol-nwyudZeR.js +1 -0
- package/dist/client/assets/codeowners-Bp6g37R7.js +1 -0
- package/dist/client/assets/codeql-DsOJ9woJ.js +1 -0
- package/dist/client/assets/coffee-Ch7k5sss.js +1 -0
- package/dist/client/assets/common-lisp-Cg-RD9OK.js +1 -0
- package/dist/client/assets/coq-DkFqJrB1.js +1 -0
- package/dist/client/assets/cpp-CofmeUqb.js +1 -0
- package/dist/client/assets/crystal-tKQVLTB8.js +1 -0
- package/dist/client/assets/csharp-COcwbKMJ.js +1 -0
- package/dist/client/assets/css-DPfMkruS.js +1 -0
- package/dist/client/assets/csv-fuZLfV_i.js +1 -0
- package/dist/client/assets/cue-D82EKSYY.js +1 -0
- package/dist/client/assets/cypher-COkxafJQ.js +1 -0
- package/dist/client/assets/d-85-TOEBH.js +1 -0
- package/dist/client/assets/dark-plus-C3mMm8J8.js +1 -0
- package/dist/client/assets/dart-CF10PKvl.js +1 -0
- package/dist/client/assets/data-grid-overlay-editor-CBVV2omk.js +1 -0
- package/dist/client/assets/dax-CEL-wOlO.js +1 -0
- package/dist/client/assets/desktop-BmXAJ9_W.js +1 -0
- package/dist/client/assets/diff-D97Zzqfu.js +1 -0
- package/dist/client/assets/docker-BcOcwvcX.js +1 -0
- package/dist/client/assets/dotenv-Da5cRb03.js +1 -0
- package/dist/client/assets/dracula-BzJJZx-M.js +1 -0
- package/dist/client/assets/dracula-soft-BXkSAIEj.js +1 -0
- package/dist/client/assets/dream-maker-BtqSS_iP.js +1 -0
- package/dist/client/assets/edge-BkV0erSs.js +1 -0
- package/dist/client/assets/elixir-CDX3lj18.js +1 -0
- package/dist/client/assets/elm-DbKCFpqz.js +1 -0
- package/dist/client/assets/emacs-lisp-C9XAeP06.js +1 -0
- package/dist/client/assets/erb-B12qg9BL.js +1 -0
- package/dist/client/assets/erlang-DsQrWhSR.js +1 -0
- package/dist/client/assets/everforest-dark-BgDCqdQA.js +1 -0
- package/dist/client/assets/everforest-light-C8M2exoo.js +1 -0
- package/dist/client/assets/fennel-BYunw83y.js +1 -0
- package/dist/client/assets/fish-BvzEVeQv.js +1 -0
- package/dist/client/assets/fluent-C4IJs8-o.js +1 -0
- package/dist/client/assets/fortran-fixed-form-CkoXwp7k.js +1 -0
- package/dist/client/assets/fortran-free-form-BxgE0vQu.js +1 -0
- package/dist/client/assets/fsharp-CXgrBDvD.js +1 -0
- package/dist/client/assets/gdresource-BOOCDP_w.js +1 -0
- package/dist/client/assets/gdscript-C5YyOfLZ.js +1 -0
- package/dist/client/assets/gdshader-DkwncUOv.js +1 -0
- package/dist/client/assets/genie-D0YGMca9.js +1 -0
- package/dist/client/assets/gherkin-DyxjwDmM.js +1 -0
- package/dist/client/assets/git-commit-F4YmCXRG.js +1 -0
- package/dist/client/assets/git-rebase-r7XF79zn.js +1 -0
- package/dist/client/assets/github-dark-DHJKELXO.js +1 -0
- package/dist/client/assets/github-dark-default-Cuk6v7N8.js +1 -0
- package/dist/client/assets/github-dark-dimmed-DH5Ifo-i.js +1 -0
- package/dist/client/assets/github-dark-high-contrast-E3gJ1_iC.js +1 -0
- package/dist/client/assets/github-light-DAi9KRSo.js +1 -0
- package/dist/client/assets/github-light-default-D7oLnXFd.js +1 -0
- package/dist/client/assets/github-light-high-contrast-BfjtVDDH.js +1 -0
- package/dist/client/assets/gleam-BspZqrRM.js +1 -0
- package/dist/client/assets/glimmer-js-Rg0-pVw9.js +1 -0
- package/dist/client/assets/glimmer-ts-U6CK756n.js +1 -0
- package/dist/client/assets/glsl-DplSGwfg.js +1 -0
- package/dist/client/assets/gn-n2N0HUVH.js +1 -0
- package/dist/client/assets/gnuplot-DdkO51Og.js +1 -0
- package/dist/client/assets/go-CxLEBnE3.js +1 -0
- package/dist/client/assets/graphql-ChdNCCLP.js +1 -0
- package/dist/client/assets/groovy-gcz8RCvz.js +1 -0
- package/dist/client/assets/gruvbox-dark-hard-CFHQjOhq.js +1 -0
- package/dist/client/assets/gruvbox-dark-medium-GsRaNv29.js +1 -0
- package/dist/client/assets/gruvbox-dark-soft-CVdnzihN.js +1 -0
- package/dist/client/assets/gruvbox-light-hard-CH1njM8p.js +1 -0
- package/dist/client/assets/gruvbox-light-medium-DRw_LuNl.js +1 -0
- package/dist/client/assets/gruvbox-light-soft-hJgmCMqR.js +1 -0
- package/dist/client/assets/hack-CaT9iCJl.js +1 -0
- package/dist/client/assets/haml-B8DHNrY2.js +1 -0
- package/dist/client/assets/handlebars-BL8al0AC.js +1 -0
- package/dist/client/assets/haskell-Df6bDoY_.js +1 -0
- package/dist/client/assets/haxe-CzTSHFRz.js +1 -0
- package/dist/client/assets/hcl-BWvSN4gD.js +1 -0
- package/dist/client/assets/highlighted-body-KPVGNVTW-BqsjUFPI.js +1 -0
- package/dist/client/assets/hjson-D5-asLiD.js +1 -0
- package/dist/client/assets/hlsl-D3lLCCz7.js +1 -0
- package/dist/client/assets/horizon-BUw7H-hv.js +1 -0
- package/dist/client/assets/horizon-bright-Cn-bp-IR.js +1 -0
- package/dist/client/assets/houston-DnULxvSX.js +1 -0
- package/dist/client/assets/html-GMplVEZG.js +1 -0
- package/dist/client/assets/html-derivative-BFtXZ54Q.js +1 -0
- package/dist/client/assets/http-jrhK8wxY.js +1 -0
- package/dist/client/assets/hurl-irOxFIW8.js +1 -0
- package/dist/client/assets/hxml-Bvhsp5Yf.js +1 -0
- package/dist/client/assets/hy-DFXneXwc.js +1 -0
- package/dist/client/assets/imba-DGztddWO.js +1 -0
- package/dist/client/assets/index-B7OFMd2c.css +32 -0
- package/dist/client/assets/index-DOmAST6D.js +701 -0
- package/dist/client/assets/ini-BEwlwnbL.js +1 -0
- package/dist/client/assets/java-CylS5w8V.js +1 -0
- package/dist/client/assets/javascript-wDzz0qaB.js +1 -0
- package/dist/client/assets/jinja-4LBKfQ-Z.js +1 -0
- package/dist/client/assets/jison-wvAkD_A8.js +1 -0
- package/dist/client/assets/json-Cp-IABpG.js +1 -0
- package/dist/client/assets/json5-C9tS-k6U.js +1 -0
- package/dist/client/assets/jsonc-Des-eS-w.js +1 -0
- package/dist/client/assets/jsonl-DcaNXYhu.js +1 -0
- package/dist/client/assets/jsonnet-DFQXde-d.js +1 -0
- package/dist/client/assets/jssm-C2t-YnRu.js +1 -0
- package/dist/client/assets/jsx-g9-lgVsj.js +1 -0
- package/dist/client/assets/julia-CxzCAyBv.js +1 -0
- package/dist/client/assets/just-Cw27pwNe.js +1 -0
- package/dist/client/assets/kanagawa-dragon-CkXjmgJE.js +1 -0
- package/dist/client/assets/kanagawa-lotus-CfQXZHmo.js +1 -0
- package/dist/client/assets/kanagawa-wave-DWedfzmr.js +1 -0
- package/dist/client/assets/kdl-DV7GczEv.js +1 -0
- package/dist/client/assets/kotlin-BdnUsdx6.js +1 -0
- package/dist/client/assets/kusto-DZf3V79B.js +1 -0
- package/dist/client/assets/laserwave-DUszq2jm.js +1 -0
- package/dist/client/assets/latex-CWtU0Tv5.js +1 -0
- package/dist/client/assets/lean-BZvkOJ9d.js +1 -0
- package/dist/client/assets/less-B1dDrJ26.js +1 -0
- package/dist/client/assets/light-plus-B7mTdjB0.js +1 -0
- package/dist/client/assets/liquid-DYVedYrR.js +1 -0
- package/dist/client/assets/llvm-DjAJT7YJ.js +1 -0
- package/dist/client/assets/log-2UxHyX5q.js +1 -0
- package/dist/client/assets/logo-BtOb2qkB.js +1 -0
- package/dist/client/assets/lua-BaeVxFsk.js +1 -0
- package/dist/client/assets/luau-C-HG3fhB.js +1 -0
- package/dist/client/assets/make-CHLpvVh8.js +1 -0
- package/dist/client/assets/markdown-Cvjx9yec.js +1 -0
- package/dist/client/assets/marko-CnJfTvn9.js +1 -0
- package/dist/client/assets/material-theme-D5KoaKCx.js +1 -0
- package/dist/client/assets/material-theme-darker-BfHTSMKl.js +1 -0
- package/dist/client/assets/material-theme-lighter-B0m2ddpp.js +1 -0
- package/dist/client/assets/material-theme-ocean-CyktbL80.js +1 -0
- package/dist/client/assets/material-theme-palenight-Csfq5Kiy.js +1 -0
- package/dist/client/assets/matlab-D7o27uSR.js +1 -0
- package/dist/client/assets/mdc-BMNejdWA.js +1 -0
- package/dist/client/assets/mdx-Cmh6b_Ma.js +1 -0
- package/dist/client/assets/mermaid-mWjccvbQ.js +1 -0
- package/dist/client/assets/min-dark-CafNBF8u.js +1 -0
- package/dist/client/assets/min-light-CTRr51gU.js +1 -0
- package/dist/client/assets/mipsasm-CKIfxQSi.js +1 -0
- package/dist/client/assets/mojo-rZm6bMo-.js +1 -0
- package/dist/client/assets/monokai-D4h5O-jR.js +1 -0
- package/dist/client/assets/moonbit-_H4v1dQx.js +1 -0
- package/dist/client/assets/move-IF9eRakj.js +1 -0
- package/dist/client/assets/narrat-DRg8JJMk.js +1 -0
- package/dist/client/assets/nextflow-Zz6hmt5N.js +1 -0
- package/dist/client/assets/nextflow-groovy-BeH2EWoN.js +1 -0
- package/dist/client/assets/nginx-BpAMiNFr.js +1 -0
- package/dist/client/assets/night-owl-C39BiMTA.js +1 -0
- package/dist/client/assets/night-owl-light-CMTm3GFP.js +1 -0
- package/dist/client/assets/nim-CVrawwO9.js +1 -0
- package/dist/client/assets/nix-CwoSXNpI.js +1 -0
- package/dist/client/assets/nord-Ddv68eIx.js +1 -0
- package/dist/client/assets/number-overlay-editor-DhCVhD05.js +9 -0
- package/dist/client/assets/nushell-Cz2AlsmD.js +1 -0
- package/dist/client/assets/objective-c-DXmwc3jG.js +1 -0
- package/dist/client/assets/objective-cpp-CLxacb5B.js +1 -0
- package/dist/client/assets/ocaml-C0hk2d4L.js +1 -0
- package/dist/client/assets/odin-BBf5iR-q.js +1 -0
- package/dist/client/assets/one-dark-pro-DVMEJ2y_.js +1 -0
- package/dist/client/assets/one-light-C3Wv6jpd.js +1 -0
- package/dist/client/assets/openscad-C4EeE6gA.js +1 -0
- package/dist/client/assets/pascal-D93ZcfNL.js +1 -0
- package/dist/client/assets/perl-C0TMdlhV.js +1 -0
- package/dist/client/assets/php-Dhbhpdrm.js +1 -0
- package/dist/client/assets/pkl-u5AG7uiY.js +1 -0
- package/dist/client/assets/plastic-3e1v2bzS.js +1 -0
- package/dist/client/assets/plsql-ChMvpjG-.js +1 -0
- package/dist/client/assets/po-BTJTHyun.js +1 -0
- package/dist/client/assets/poimandres-CS3Unz2-.js +1 -0
- package/dist/client/assets/polar-C0HS_06l.js +1 -0
- package/dist/client/assets/postcss-CXtECtnM.js +1 -0
- package/dist/client/assets/powerquery-CEu0bR-o.js +1 -0
- package/dist/client/assets/powershell-Dpen1YoG.js +1 -0
- package/dist/client/assets/prisma-Dd19v3D-.js +1 -0
- package/dist/client/assets/prolog-CbFg5uaA.js +1 -0
- package/dist/client/assets/proto-C7zT0LnQ.js +1 -0
- package/dist/client/assets/pug-CGlum2m_.js +1 -0
- package/dist/client/assets/puppet-BMWR74SV.js +1 -0
- package/dist/client/assets/purescript-CklMAg4u.js +1 -0
- package/dist/client/assets/python-B6aJPvgy.js +1 -0
- package/dist/client/assets/qml-3beO22l8.js +1 -0
- package/dist/client/assets/qmldir-C8lEn-DE.js +1 -0
- package/dist/client/assets/qss-IeuSbFQv.js +1 -0
- package/dist/client/assets/r-Dspwwk_N.js +1 -0
- package/dist/client/assets/racket-BqYA7rlc.js +1 -0
- package/dist/client/assets/raku-DXvB9xmW.js +1 -0
- package/dist/client/assets/razor-Uh8Bk_45.js +1 -0
- package/dist/client/assets/red-bN70gL4F.js +1 -0
- package/dist/client/assets/reg-C-SQnVFl.js +1 -0
- package/dist/client/assets/regexp-CDVJQ6XC.js +1 -0
- package/dist/client/assets/rel-C3B-1QV4.js +1 -0
- package/dist/client/assets/riscv-BM1_JUlF.js +1 -0
- package/dist/client/assets/ron-D8l8udqQ.js +1 -0
- package/dist/client/assets/rose-pine-dawn-DHQR4-dF.js +1 -0
- package/dist/client/assets/rose-pine-moon-D4_iv3hh.js +1 -0
- package/dist/client/assets/rose-pine-qdsjHGoJ.js +1 -0
- package/dist/client/assets/rosmsg-BJDFO7_C.js +1 -0
- package/dist/client/assets/rst-BrH8l1NY.js +1 -0
- package/dist/client/assets/ruby-Dw2BHqvy.js +1 -0
- package/dist/client/assets/rust-B1yitclQ.js +1 -0
- package/dist/client/assets/sas-cz2c8ADy.js +1 -0
- package/dist/client/assets/sass-Cj5Yp3dK.js +1 -0
- package/dist/client/assets/scala-C151Ov-r.js +1 -0
- package/dist/client/assets/scheme-C98Dy4si.js +1 -0
- package/dist/client/assets/scss-OYdSNvt2.js +1 -0
- package/dist/client/assets/sdbl-DVxCFoDh.js +1 -0
- package/dist/client/assets/shaderlab-Dg9Lc6iA.js +1 -0
- package/dist/client/assets/shellscript-Yzrsuije.js +1 -0
- package/dist/client/assets/shellsession-BADoaaVG.js +1 -0
- package/dist/client/assets/slack-dark-BthQWCQV.js +1 -0
- package/dist/client/assets/slack-ochin-DqwNpetd.js +1 -0
- package/dist/client/assets/smalltalk-BERRCDM3.js +1 -0
- package/dist/client/assets/snazzy-light-Bw305WKR.js +1 -0
- package/dist/client/assets/solarized-dark-DXbdFlpD.js +1 -0
- package/dist/client/assets/solarized-light-L9t79GZl.js +1 -0
- package/dist/client/assets/solidity-rGO070M0.js +1 -0
- package/dist/client/assets/soy-Brmx7dQM.js +1 -0
- package/dist/client/assets/sparql-rVzFXLq3.js +1 -0
- package/dist/client/assets/splunk-BtCnVYZw.js +1 -0
- package/dist/client/assets/sql-BLtJtn59.js +1 -0
- package/dist/client/assets/ssh-config-_ykCGR6B.js +1 -0
- package/dist/client/assets/stata-BH5u7GGu.js +1 -0
- package/dist/client/assets/stylus-BEDo0Tqx.js +1 -0
- package/dist/client/assets/surrealql-Bq5Q-fJD.js +1 -0
- package/dist/client/assets/svelte-C_ipcX3V.js +1 -0
- package/dist/client/assets/swift-D82vCrfD.js +1 -0
- package/dist/client/assets/synthwave-84-CbfX1IO0.js +1 -0
- package/dist/client/assets/system-verilog-CnnmHF94.js +1 -0
- package/dist/client/assets/systemd-4A_iFExJ.js +1 -0
- package/dist/client/assets/talonscript-CkByrt1z.js +1 -0
- package/dist/client/assets/tasl-QIJgUcNo.js +1 -0
- package/dist/client/assets/tcl-dwOrl1Do.js +1 -0
- package/dist/client/assets/templ-P3uqSqPl.js +1 -0
- package/dist/client/assets/terraform-BETggiCN.js +1 -0
- package/dist/client/assets/tex-idrVyKtj.js +1 -0
- package/dist/client/assets/tokyo-night-hegEt444.js +1 -0
- package/dist/client/assets/toml-vGWfd6FD.js +1 -0
- package/dist/client/assets/ts-tags-zn1MmPIZ.js +1 -0
- package/dist/client/assets/tsv-B_m7g4N7.js +1 -0
- package/dist/client/assets/tsx-COt5Ahok.js +1 -0
- package/dist/client/assets/turtle-BsS91CYL.js +1 -0
- package/dist/client/assets/twig-DNn4PbVi.js +1 -0
- package/dist/client/assets/typescript-BPQ3VLAy.js +1 -0
- package/dist/client/assets/typespec-BGHnOYBU.js +1 -0
- package/dist/client/assets/typst-DHCkPAjA.js +1 -0
- package/dist/client/assets/v-BcVCzyr7.js +1 -0
- package/dist/client/assets/vala-CsfeWuGM.js +1 -0
- package/dist/client/assets/vb-D17OF-Vu.js +1 -0
- package/dist/client/assets/verilog-BQ8w6xss.js +1 -0
- package/dist/client/assets/vesper-DU1UobuO.js +1 -0
- package/dist/client/assets/vhdl-CeAyd5Ju.js +1 -0
- package/dist/client/assets/viml-CJc9bBzg.js +1 -0
- package/dist/client/assets/vitesse-black-Bkuqu6BP.js +1 -0
- package/dist/client/assets/vitesse-dark-D0r3Knsf.js +1 -0
- package/dist/client/assets/vitesse-light-CVO1_9PV.js +1 -0
- package/dist/client/assets/vue-DN_0RTcg.js +1 -0
- package/dist/client/assets/vue-html-AaS7Mt5G.js +1 -0
- package/dist/client/assets/vue-vine-CQOfvN7w.js +1 -0
- package/dist/client/assets/vyper-CDx5xZoG.js +1 -0
- package/dist/client/assets/wasm-CG6Dc4jp.js +1 -0
- package/dist/client/assets/wasm-MzD3tlZU.js +1 -0
- package/dist/client/assets/wenyan-BV7otONQ.js +1 -0
- package/dist/client/assets/wgsl-Dx-B1_4e.js +1 -0
- package/dist/client/assets/wikitext-BhOHFoWU.js +1 -0
- package/dist/client/assets/wit-5i3qLPDT.js +1 -0
- package/dist/client/assets/wolfram-lXgVvXCa.js +1 -0
- package/dist/client/assets/xml-sdJ4AIDG.js +1 -0
- package/dist/client/assets/xsl-CtQFsRM5.js +1 -0
- package/dist/client/assets/yaml-Buea-lGh.js +1 -0
- package/dist/client/assets/zenscript-DVFEvuxE.js +1 -0
- package/dist/client/assets/zig-VOosw3JB.js +1 -0
- package/dist/client/index.html +2 -2
- package/dist/dataset-types-CSjbM_Vz.d.ts +564 -0
- package/dist/index.d.ts +3768 -936
- package/dist/index.js +3648 -604
- package/dist/instance-names-pVQxJbtw.js +12 -0
- package/dist/runtime-DCNx7dHI.js +302 -0
- package/dist/trace-Dn6Pfcc5.d.ts +200 -0
- package/dist/trace-event-ingestor-DI-HkA4Q.js +12759 -0
- package/dist/views/datasets/index.d.ts +68 -0
- package/dist/views/datasets/index.js +237 -0
- package/dist/views/index.d.ts +98 -0
- package/dist/views/index.js +156 -0
- package/dist/views/react/index.d.ts +55 -0
- package/dist/views/react/index.js +246 -0
- package/package.json +60 -9
- package/dist/client/assets/index-BAk2IWAg.js +0 -144
- package/dist/client/assets/index-CHPZsnKo.css +0 -32
- package/dist/vercel-ai-sdk-JhQ1efcg.js +0 -1236
|
@@ -1,1236 +0,0 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
3
|
-
import fs from "node:fs";
|
|
4
|
-
import { extractPropertiesFromDeclaration, findTypeDeclaration } from "ts-proppy";
|
|
5
|
-
import ts from "typescript";
|
|
6
|
-
//#region src/trace/span-merge.ts
|
|
7
|
-
/**
|
|
8
|
-
* Merges a later snapshot of a span into an earlier one.
|
|
9
|
-
*
|
|
10
|
-
* OpenTelemetry reports each span twice — at `onStart` (creation-time
|
|
11
|
-
* attributes only) and at `onEnd` (the full set) — and the two snapshots can
|
|
12
|
-
* carry complementary data. This unions their `attributes` and lets any
|
|
13
|
-
* *defined* field on `incoming` update `existing`, so nothing recorded at start
|
|
14
|
-
* is lost when the span ends, and end-only fields (status, timings, token
|
|
15
|
-
* usage, …) are filled in.
|
|
16
|
-
*/
|
|
17
|
-
function mergeSpans(existing, incoming) {
|
|
18
|
-
const merged = { ...existing };
|
|
19
|
-
for (const [key, value] of Object.entries(incoming)) if (value !== void 0) merged[key] = value;
|
|
20
|
-
const result = merged;
|
|
21
|
-
if (existing.attributes || incoming.attributes) result.attributes = {
|
|
22
|
-
...existing.attributes,
|
|
23
|
-
...incoming.attributes
|
|
24
|
-
};
|
|
25
|
-
return result;
|
|
26
|
-
}
|
|
27
|
-
//#endregion
|
|
28
|
-
//#region src/trace/trace-sink.ts
|
|
29
|
-
/**
|
|
30
|
-
* Source-agnostic base class for a {@link TraceProvider}. Owns storage
|
|
31
|
-
* delegation, subscriptions, watchers, and the generic trace lifecycle that
|
|
32
|
-
* every concrete provider shares, regardless of how spans are produced.
|
|
33
|
-
*
|
|
34
|
-
* Subclasses implement the abstract storage hooks; ingestion is handled by
|
|
35
|
-
* one or more {@link TraceIngestor}s that call {@link recordSpanStart} /
|
|
36
|
-
* {@link recordSpanEnd} / {@link failTrace} on this instance (via
|
|
37
|
-
* {@link TraceSink}).
|
|
38
|
-
*/
|
|
39
|
-
var BaseTraceProvider = class {
|
|
40
|
-
id;
|
|
41
|
-
displayName;
|
|
42
|
-
description;
|
|
43
|
-
subscribers = /* @__PURE__ */ new Map();
|
|
44
|
-
watchers = /* @__PURE__ */ new Set();
|
|
45
|
-
constructor(options) {
|
|
46
|
-
this.id = options.id;
|
|
47
|
-
this.displayName = options.displayName;
|
|
48
|
-
this.description = options.description;
|
|
49
|
-
}
|
|
50
|
-
async getTrace(traceId) {
|
|
51
|
-
const trace = await this.getTraceWithoutSpans(traceId);
|
|
52
|
-
if (!trace) return void 0;
|
|
53
|
-
return {
|
|
54
|
-
trace,
|
|
55
|
-
spans: await this.getTraceSpans(traceId)
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
subscribeTrace(traceId, callback) {
|
|
59
|
-
let set = this.subscribers.get(traceId);
|
|
60
|
-
if (!set) {
|
|
61
|
-
set = /* @__PURE__ */ new Set();
|
|
62
|
-
this.subscribers.set(traceId, set);
|
|
63
|
-
}
|
|
64
|
-
set.add(callback);
|
|
65
|
-
return () => {
|
|
66
|
-
set.delete(callback);
|
|
67
|
-
if (set.size === 0) this.subscribers.delete(traceId);
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
watch(callback) {
|
|
71
|
-
this.watchers.add(callback);
|
|
72
|
-
return () => {
|
|
73
|
-
this.watchers.delete(callback);
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
async recordSpanStart(span) {
|
|
77
|
-
if (!span.parentId && !await this.hasTrace(span.traceId)) {
|
|
78
|
-
const trace = {
|
|
79
|
-
id: span.traceId,
|
|
80
|
-
providerId: this.id,
|
|
81
|
-
name: span.name,
|
|
82
|
-
startTime: span.startTime,
|
|
83
|
-
status: "running",
|
|
84
|
-
attributes: { ...span.attributes }
|
|
85
|
-
};
|
|
86
|
-
await this.addOrUpdateTrace(trace);
|
|
87
|
-
this.emitChange({
|
|
88
|
-
type: "add",
|
|
89
|
-
traceId: span.traceId
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
const stored = await this.addOrUpdateSpan(span);
|
|
93
|
-
this.emitStream(span.traceId, {
|
|
94
|
-
type: "span-start",
|
|
95
|
-
span: stored
|
|
96
|
-
});
|
|
97
|
-
return stored;
|
|
98
|
-
}
|
|
99
|
-
async recordSpanEnd(span) {
|
|
100
|
-
const stored = await this.addOrUpdateSpan(span);
|
|
101
|
-
this.emitStream(span.traceId, {
|
|
102
|
-
type: "span-end",
|
|
103
|
-
span: stored
|
|
104
|
-
});
|
|
105
|
-
if (!stored.parentId) {
|
|
106
|
-
const existing = await this.getTraceWithoutSpans(span.traceId);
|
|
107
|
-
if (existing) {
|
|
108
|
-
const endedTrace = {
|
|
109
|
-
...existing,
|
|
110
|
-
endTime: stored.endTime,
|
|
111
|
-
status: stored.status === "error" ? "error" : "ok",
|
|
112
|
-
attributes: {
|
|
113
|
-
...existing.attributes,
|
|
114
|
-
...stored.attributes
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
await this.addOrUpdateTrace(endedTrace);
|
|
118
|
-
this.emitStream(span.traceId, {
|
|
119
|
-
type: "trace-end",
|
|
120
|
-
trace: endedTrace
|
|
121
|
-
});
|
|
122
|
-
this.emitChange({
|
|
123
|
-
type: "update",
|
|
124
|
-
traceId: span.traceId
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return stored;
|
|
129
|
-
}
|
|
130
|
-
async failTrace(traceId, errorMessage) {
|
|
131
|
-
const existing = await this.getTraceWithoutSpans(traceId);
|
|
132
|
-
if (!existing) return;
|
|
133
|
-
const failed = {
|
|
134
|
-
...existing,
|
|
135
|
-
endTime: Date.now(),
|
|
136
|
-
status: "error",
|
|
137
|
-
attributes: {
|
|
138
|
-
...existing.attributes,
|
|
139
|
-
errorMessage
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
await this.addOrUpdateTrace(failed);
|
|
143
|
-
this.emitStream(traceId, {
|
|
144
|
-
type: "trace-end",
|
|
145
|
-
trace: failed
|
|
146
|
-
});
|
|
147
|
-
this.emitChange({
|
|
148
|
-
type: "update",
|
|
149
|
-
traceId
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
emitStream(traceId, event) {
|
|
153
|
-
const set = this.subscribers.get(traceId);
|
|
154
|
-
if (!set) return;
|
|
155
|
-
for (const cb of set) try {
|
|
156
|
-
cb(event);
|
|
157
|
-
} catch (err) {
|
|
158
|
-
console.error("Trace subscriber threw:", err);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
emitChange(event) {
|
|
162
|
-
for (const cb of this.watchers) try {
|
|
163
|
-
cb(event);
|
|
164
|
-
} catch (err) {
|
|
165
|
-
console.error("Trace watcher threw:", err);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
|
-
//#endregion
|
|
170
|
-
//#region src/trace/memory-trace-provider.ts
|
|
171
|
-
/**
|
|
172
|
-
* In-memory {@link TraceProvider}, populated by one or more
|
|
173
|
-
* {@link TraceIngestor}s connected at construction time.
|
|
174
|
-
*/
|
|
175
|
-
var MemoryTraceProvider = class extends BaseTraceProvider {
|
|
176
|
-
traces = /* @__PURE__ */ new Map();
|
|
177
|
-
spansByTrace = /* @__PURE__ */ new Map();
|
|
178
|
-
constructor({ id = "memory", displayName = "In-Memory Traces", description = "Stores traces in memory for the current process.", ingestors = [] } = {}) {
|
|
179
|
-
super({
|
|
180
|
-
id,
|
|
181
|
-
displayName,
|
|
182
|
-
description
|
|
183
|
-
});
|
|
184
|
-
for (const ingestor of ingestors) ingestor.addSink(this);
|
|
185
|
-
}
|
|
186
|
-
async getAllTraces() {
|
|
187
|
-
const summaries = Array.from(this.traces.values()).map((t) => ({
|
|
188
|
-
id: t.id,
|
|
189
|
-
providerId: this.id,
|
|
190
|
-
name: t.name,
|
|
191
|
-
startTime: t.startTime,
|
|
192
|
-
endTime: t.endTime,
|
|
193
|
-
status: t.status,
|
|
194
|
-
spanCount: this.spansByTrace.get(t.id)?.length ?? 0
|
|
195
|
-
}));
|
|
196
|
-
summaries.sort((a, b) => b.startTime - a.startTime);
|
|
197
|
-
return summaries;
|
|
198
|
-
}
|
|
199
|
-
async hasTrace(traceId) {
|
|
200
|
-
return this.traces.has(traceId);
|
|
201
|
-
}
|
|
202
|
-
async getTraceWithoutSpans(traceId) {
|
|
203
|
-
return this.traces.get(traceId);
|
|
204
|
-
}
|
|
205
|
-
async getTraceSpans(traceId) {
|
|
206
|
-
return this.spansByTrace.get(traceId) ?? [];
|
|
207
|
-
}
|
|
208
|
-
async addOrUpdateTrace(trace) {
|
|
209
|
-
this.traces.set(trace.id, trace);
|
|
210
|
-
}
|
|
211
|
-
async addOrUpdateSpan(span) {
|
|
212
|
-
let list = this.spansByTrace.get(span.traceId);
|
|
213
|
-
if (!list) {
|
|
214
|
-
list = [];
|
|
215
|
-
this.spansByTrace.set(span.traceId, list);
|
|
216
|
-
}
|
|
217
|
-
const idx = list.findIndex((s) => s.id === span.id);
|
|
218
|
-
if (idx >= 0) {
|
|
219
|
-
const merged = mergeSpans(list[idx], span);
|
|
220
|
-
list[idx] = merged;
|
|
221
|
-
return merged;
|
|
222
|
-
}
|
|
223
|
-
list.push(span);
|
|
224
|
-
return span;
|
|
225
|
-
}
|
|
226
|
-
};
|
|
227
|
-
//#endregion
|
|
228
|
-
//#region src/shared/helpers.ts
|
|
229
|
-
function otelOperationToSpanKind(operationName) {
|
|
230
|
-
switch (operationName) {
|
|
231
|
-
case "chat":
|
|
232
|
-
case "response":
|
|
233
|
-
case "text_completion":
|
|
234
|
-
case "generate_content": return "LLM";
|
|
235
|
-
case "execute_tool": return "TOOL";
|
|
236
|
-
case "create_agent":
|
|
237
|
-
case "invoke_agent": return "AGENT";
|
|
238
|
-
case "embeddings": return "EMBEDDING";
|
|
239
|
-
default: return "DEFAULT";
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
/** Whether a property value can be edited in the UI. */
|
|
243
|
-
function isEditable(value) {
|
|
244
|
-
return value.kind !== "raw" && !(value.kind === "functionCall" && !value.binding);
|
|
245
|
-
}
|
|
246
|
-
//#endregion
|
|
247
|
-
//#region src/shared/setup-task.ts
|
|
248
|
-
/**
|
|
249
|
-
* Shared, dependency-free types describing the onboarding "setup tasks" a user
|
|
250
|
-
* can run to wire up an AI SDK.
|
|
251
|
-
*
|
|
252
|
-
* This module is imported by both the browser client (to render the
|
|
253
|
-
* manual-setup picker) and the server (to define and execute the tasks), so it
|
|
254
|
-
* must stay free of any Node- or DOM-specific imports.
|
|
255
|
-
*/
|
|
256
|
-
/** Path, relative to the project root, where evalution looks for its config. */
|
|
257
|
-
const CONFIG_FILE_RELATIVE_PATH = ".evalution/config.ts";
|
|
258
|
-
/**
|
|
259
|
-
* The shell command a run-style step executes. `install_package` steps map to
|
|
260
|
-
* `npm i <package>`; `run_command` steps carry their command verbatim.
|
|
261
|
-
*/
|
|
262
|
-
function setupStepCommand(step) {
|
|
263
|
-
return step.kind === "install_package" ? `npm i ${step.package}` : step.command;
|
|
264
|
-
}
|
|
265
|
-
//#endregion
|
|
266
|
-
//#region src/trace/prompt-tracer.ts
|
|
267
|
-
/**
|
|
268
|
-
* Attribute name a span can set to pick one of evalution's span-kind values
|
|
269
|
-
* (`'LLM'`, `'TOOL'`, `'AGENT'`, `'EMBEDDING'`, `'DEFAULT'`). Falls back to
|
|
270
|
-
* `'DEFAULT'` when absent or unrecognised.
|
|
271
|
-
*/
|
|
272
|
-
const SPAN_KIND_ATTRIBUTE = "evalution.span.type";
|
|
273
|
-
/**
|
|
274
|
-
* Attribute name a span can set to give a human-readable name to the prompt.
|
|
275
|
-
*/
|
|
276
|
-
const PROMPT_NAME_ATTRIBUTE = "gen_ai.prompt.name";
|
|
277
|
-
/**
|
|
278
|
-
* Attribute name a span can set to link itself to a specific prompt. The value
|
|
279
|
-
* is a globally-unique prompt ID unless {@link PROMPT_PROVIDER_ID_ATTRIBUTE} is
|
|
280
|
-
* also set, in which case it is scoped to that provider.
|
|
281
|
-
*/
|
|
282
|
-
const PROMPT_ID_ATTRIBUTE = "evalution.prompt.id";
|
|
283
|
-
/**
|
|
284
|
-
* Attribute name a span can set to scope its {@link PROMPT_ID_ATTRIBUTE} to a
|
|
285
|
-
* specific prompt provider. When absent, the prompt ID is treated as global.
|
|
286
|
-
*/
|
|
287
|
-
const PROMPT_PROVIDER_ID_ATTRIBUTE = "evalution.prompt.provider.id";
|
|
288
|
-
/**
|
|
289
|
-
* Attribute name a span can set to include an array of input parameters used
|
|
290
|
-
* to construct the final prompt.
|
|
291
|
-
*/
|
|
292
|
-
const PROMPT_INPUTS_ATTRIBUTE = "evalution.prompt.inputs";
|
|
293
|
-
function getPromptSpanAttributes(prompt, attributes = {}) {
|
|
294
|
-
return Object.fromEntries([
|
|
295
|
-
[SPAN_KIND_ATTRIBUTE, "LLM"],
|
|
296
|
-
[PROMPT_NAME_ATTRIBUTE, prompt.name],
|
|
297
|
-
[PROMPT_ID_ATTRIBUTE, prompt.id],
|
|
298
|
-
[PROMPT_INPUTS_ATTRIBUTE, prompt.functionParameters],
|
|
299
|
-
...Object.entries(attributes)
|
|
300
|
-
].filter(([, v]) => v !== void 0 && v !== null));
|
|
301
|
-
}
|
|
302
|
-
/**
|
|
303
|
-
* Wraps a {@link Tracer} so that every span it produces is tagged with the
|
|
304
|
-
* attributes that associate it with a prompt — the prompt's name
|
|
305
|
-
* ({@link PROMPT_NAME_ATTRIBUTE}), an optional global prompt ID
|
|
306
|
-
* ({@link PROMPT_ID_ATTRIBUTE}), and an `'LLM'` span kind
|
|
307
|
-
* ({@link SPAN_KIND_ATTRIBUTE}). Attributes set explicitly on an individual
|
|
308
|
-
* span take precedence over these defaults.
|
|
309
|
-
*
|
|
310
|
-
* This depends only on `@opentelemetry/api`, so it can be re-used by SDK
|
|
311
|
-
* adapter packages (e.g. `@evalution/vercel-ai-sdk`) without pulling in the
|
|
312
|
-
* rest of evalution.
|
|
313
|
-
*
|
|
314
|
-
* @param prompt - The prompt to attribute spans to. `name` is a human-readable
|
|
315
|
-
* name; the optional `id` is a globally-unique prompt ID used to resolve
|
|
316
|
-
* runtime traces back to the prompt.
|
|
317
|
-
* @param tracer - Tracer to wrap. Defaults to a tracer from the globally
|
|
318
|
-
* registered tracer provider.
|
|
319
|
-
* @returns A tracer that forwards to `tracer` while attaching the prompt
|
|
320
|
-
* attributes to each span it creates.
|
|
321
|
-
*/
|
|
322
|
-
function createTracerForPrompt(prompt, tracer) {
|
|
323
|
-
const inner = tracer ?? trace.getTracer("evalution");
|
|
324
|
-
const withPromptAttributes = (options) => ({
|
|
325
|
-
...options,
|
|
326
|
-
attributes: getPromptSpanAttributes(prompt, options?.attributes)
|
|
327
|
-
});
|
|
328
|
-
return {
|
|
329
|
-
startSpan(name, options, context) {
|
|
330
|
-
return inner.startSpan(name, withPromptAttributes(options), context);
|
|
331
|
-
},
|
|
332
|
-
startActiveSpan(name, ...rest) {
|
|
333
|
-
if (typeof rest[0] === "function") return inner.startActiveSpan(name, withPromptAttributes(), rest[0]);
|
|
334
|
-
if (typeof rest[1] === "function") return inner.startActiveSpan(name, withPromptAttributes(rest[0]), rest[1]);
|
|
335
|
-
return inner.startActiveSpan(name, withPromptAttributes(rest[0]), rest[1], rest[2]);
|
|
336
|
-
}
|
|
337
|
-
};
|
|
338
|
-
}
|
|
339
|
-
//#endregion
|
|
340
|
-
//#region src/trace/trace-ingestor.ts
|
|
341
|
-
/**
|
|
342
|
-
* Base class that holds the added sinks and fans each normalized record out
|
|
343
|
-
* to all of them. Concrete ingestors translate their source into
|
|
344
|
-
* {@link Span}/{@link Trace} records and call these protected helpers.
|
|
345
|
-
*/
|
|
346
|
-
var BaseTraceIngestor = class {
|
|
347
|
-
sinks = [];
|
|
348
|
-
addSink(sink) {
|
|
349
|
-
this.sinks.push(sink);
|
|
350
|
-
}
|
|
351
|
-
removeSink(sink) {
|
|
352
|
-
const prevSinks = this.sinks;
|
|
353
|
-
const newSinks = prevSinks.filter((s) => s !== sink);
|
|
354
|
-
this.sinks = newSinks;
|
|
355
|
-
return prevSinks.length > newSinks.length;
|
|
356
|
-
}
|
|
357
|
-
async recordSpanStart(span) {
|
|
358
|
-
await Promise.all(this.sinks.map((s) => s.recordSpanStart(span)));
|
|
359
|
-
}
|
|
360
|
-
async recordSpanEnd(span) {
|
|
361
|
-
await Promise.all(this.sinks.map((s) => s.recordSpanEnd(span)));
|
|
362
|
-
}
|
|
363
|
-
async failTrace(traceId, msg) {
|
|
364
|
-
await Promise.all(this.sinks.map((s) => s.failTrace(traceId, msg)));
|
|
365
|
-
}
|
|
366
|
-
};
|
|
367
|
-
//#endregion
|
|
368
|
-
//#region src/trace/otel-trace-ingestor.ts
|
|
369
|
-
const KNOWN_KINDS = [
|
|
370
|
-
"LLM",
|
|
371
|
-
"TOOL",
|
|
372
|
-
"AGENT",
|
|
373
|
-
"EMBEDDING",
|
|
374
|
-
"DEFAULT"
|
|
375
|
-
];
|
|
376
|
-
function hrTimeToMs(time) {
|
|
377
|
-
return time[0] * 1e3 + time[1] / 1e6;
|
|
378
|
-
}
|
|
379
|
-
function readKind(attributes) {
|
|
380
|
-
const raw = attributes["evalution.span.type"] ?? otelOperationToSpanKind(attributes["gen_ai.operation.name"]);
|
|
381
|
-
return typeof raw === "string" && KNOWN_KINDS.includes(raw) ? raw : "DEFAULT";
|
|
382
|
-
}
|
|
383
|
-
const PARAM_ATTRIBUTES = [
|
|
384
|
-
"gen_ai.request.temperature",
|
|
385
|
-
"gen_ai.request.max_tokens",
|
|
386
|
-
"gen_ai.request.top_k",
|
|
387
|
-
"gen_ai.request.top_p",
|
|
388
|
-
"gen_ai.request.frequency_penalty",
|
|
389
|
-
"gen_ai.request.presence_penalty",
|
|
390
|
-
"gen_ai.request.seed",
|
|
391
|
-
"gen_ai.request.stop_sequences",
|
|
392
|
-
"gen_ai.request.choice.count"
|
|
393
|
-
];
|
|
394
|
-
function str(v) {
|
|
395
|
-
return typeof v === "string" ? v : void 0;
|
|
396
|
-
}
|
|
397
|
-
function num(v) {
|
|
398
|
-
return typeof v === "number" ? v : void 0;
|
|
399
|
-
}
|
|
400
|
-
function parseMessages(v) {
|
|
401
|
-
if (typeof v !== "string") return void 0;
|
|
402
|
-
try {
|
|
403
|
-
const parsed = JSON.parse(v);
|
|
404
|
-
if (!Array.isArray(parsed)) return void 0;
|
|
405
|
-
return parsed.flatMap((msg) => {
|
|
406
|
-
if (!msg || typeof msg !== "object") return [];
|
|
407
|
-
const m = msg;
|
|
408
|
-
const role = str(m.role) ?? "unknown";
|
|
409
|
-
const content = m.content;
|
|
410
|
-
if (typeof content === "string") return [{
|
|
411
|
-
role,
|
|
412
|
-
content
|
|
413
|
-
}];
|
|
414
|
-
if (Array.isArray(content)) {
|
|
415
|
-
const text = content.filter((c) => !!c && typeof c === "object").filter((c) => c.type === "text").map((c) => str(c.text) ?? "").join("");
|
|
416
|
-
return text ? [{
|
|
417
|
-
role,
|
|
418
|
-
content: text
|
|
419
|
-
}] : [];
|
|
420
|
-
}
|
|
421
|
-
return [];
|
|
422
|
-
});
|
|
423
|
-
} catch {
|
|
424
|
-
return;
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
function parseOutput(v) {
|
|
428
|
-
if (typeof v !== "string") return void 0;
|
|
429
|
-
try {
|
|
430
|
-
const parsed = JSON.parse(v);
|
|
431
|
-
if (!Array.isArray(parsed)) return void 0;
|
|
432
|
-
return parsed.flatMap((msg) => {
|
|
433
|
-
if (!msg || typeof msg !== "object") return [];
|
|
434
|
-
const content = msg.content;
|
|
435
|
-
if (typeof content === "string") return [content];
|
|
436
|
-
if (Array.isArray(content)) return content.filter((c) => !!c && typeof c === "object").filter((c) => c.type === "text").map((c) => str(c.text) ?? "");
|
|
437
|
-
return [];
|
|
438
|
-
}).join("\n");
|
|
439
|
-
} catch {
|
|
440
|
-
return;
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
function readLLM(attributes) {
|
|
444
|
-
const provider = str(attributes["gen_ai.provider.name"]) ?? str(attributes["gen_ai.system"]);
|
|
445
|
-
const model = str(attributes["gen_ai.response.model"]) ?? str(attributes["gen_ai.request.model"]);
|
|
446
|
-
const promptTokens = num(attributes["gen_ai.usage.input_tokens"]) ?? num(attributes["ai.usage.promptTokens"]);
|
|
447
|
-
const completionTokens = num(attributes["gen_ai.usage.output_tokens"]) ?? num(attributes["ai.usage.completionTokens"]);
|
|
448
|
-
const messages = parseMessages(attributes["gen_ai.input.messages"] ?? attributes["ai.prompt.messages"]);
|
|
449
|
-
const output = parseOutput(attributes["gen_ai.output.messages"]) ?? str(attributes["ai.response.text"]);
|
|
450
|
-
const paramEntries = PARAM_ATTRIBUTES.map((key) => [key.replace("gen_ai.request.", ""), attributes[key]]).filter(([, v]) => v !== void 0);
|
|
451
|
-
const modelParameters = paramEntries.length > 0 ? Object.fromEntries(paramEntries) : void 0;
|
|
452
|
-
const totalTokens = promptTokens !== void 0 && completionTokens !== void 0 ? promptTokens + completionTokens : void 0;
|
|
453
|
-
if (!provider && !model && !promptTokens && !completionTokens && !messages && !output && !modelParameters) return;
|
|
454
|
-
return {
|
|
455
|
-
...provider && { provider },
|
|
456
|
-
...model && { model },
|
|
457
|
-
...messages && { messages },
|
|
458
|
-
...output && { output },
|
|
459
|
-
...promptTokens !== void 0 && { promptTokens },
|
|
460
|
-
...completionTokens !== void 0 && { completionTokens },
|
|
461
|
-
...totalTokens !== void 0 && { totalTokens },
|
|
462
|
-
...modelParameters && { modelParameters }
|
|
463
|
-
};
|
|
464
|
-
}
|
|
465
|
-
function llmAndPrompt(attributes) {
|
|
466
|
-
const llm = readLLM(attributes);
|
|
467
|
-
const id = str(attributes["evalution.prompt.id"]);
|
|
468
|
-
const providerId = str(attributes["evalution.prompt.provider.id"]);
|
|
469
|
-
const prompt = id ? {
|
|
470
|
-
id,
|
|
471
|
-
...providerId && { providerId }
|
|
472
|
-
} : void 0;
|
|
473
|
-
return {
|
|
474
|
-
...llm && { llm },
|
|
475
|
-
...prompt && { prompt }
|
|
476
|
-
};
|
|
477
|
-
}
|
|
478
|
-
function mapStatus(status) {
|
|
479
|
-
if (status.code === SpanStatusCode.ERROR) return "error";
|
|
480
|
-
if (status.code === SpanStatusCode.OK) return "ok";
|
|
481
|
-
}
|
|
482
|
-
/**
|
|
483
|
-
* {@link TraceIngestor} populated by OpenTelemetry spans. Register the
|
|
484
|
-
* processor returned by {@link getSpanProcessor} on a `BasicTracerProvider`
|
|
485
|
-
* (from `@opentelemetry/sdk-trace-base`).
|
|
486
|
-
*
|
|
487
|
-
* Because OpenTelemetry is a single process-global pipeline, at most one
|
|
488
|
-
* `OTelTraceIngestor` should be active per server — {@link isRedundant}
|
|
489
|
-
* reports any other instance redundant so server wiring can consolidate.
|
|
490
|
-
*/
|
|
491
|
-
var OTelTraceIngestor = class OTelTraceIngestor extends BaseTraceIngestor {
|
|
492
|
-
spanPromises = /* @__PURE__ */ new Map();
|
|
493
|
-
isRedundant(other) {
|
|
494
|
-
return other instanceof OTelTraceIngestor;
|
|
495
|
-
}
|
|
496
|
-
/**
|
|
497
|
-
* Returns a `SpanProcessor` that funnels every OpenTelemetry span the
|
|
498
|
-
* caller's tracer produces into this ingestor's sinks.
|
|
499
|
-
*/
|
|
500
|
-
getSpanProcessor() {
|
|
501
|
-
return {
|
|
502
|
-
onStart: (span) => {
|
|
503
|
-
const spanId = span.spanContext().spanId;
|
|
504
|
-
const p = this.handleStart(span).catch(console.error);
|
|
505
|
-
this.spanPromises.set(spanId, p);
|
|
506
|
-
p.finally(() => this.spanPromises.delete(spanId));
|
|
507
|
-
},
|
|
508
|
-
onEnd: (span) => {
|
|
509
|
-
const spanId = span.spanContext().spanId;
|
|
510
|
-
const p = (this.spanPromises.get(spanId) ?? Promise.resolve()).then(() => this.handleEnd(span)).catch(console.error);
|
|
511
|
-
this.spanPromises.set(spanId, p);
|
|
512
|
-
p.finally(() => this.spanPromises.delete(spanId));
|
|
513
|
-
},
|
|
514
|
-
forceFlush: async () => {},
|
|
515
|
-
shutdown: async () => {}
|
|
516
|
-
};
|
|
517
|
-
}
|
|
518
|
-
async handleStart(span) {
|
|
519
|
-
const ctx = span.spanContext();
|
|
520
|
-
const traceId = ctx.traceId;
|
|
521
|
-
const spanId = ctx.spanId;
|
|
522
|
-
const parentCtx = span.parentSpanContext;
|
|
523
|
-
const ourSpan = {
|
|
524
|
-
id: spanId,
|
|
525
|
-
traceId,
|
|
526
|
-
parentId: parentCtx && parentCtx.traceId === traceId ? parentCtx.spanId : void 0,
|
|
527
|
-
name: span.name,
|
|
528
|
-
kind: readKind(span.attributes),
|
|
529
|
-
startTime: hrTimeToMs(span.startTime),
|
|
530
|
-
attributes: { ...span.attributes },
|
|
531
|
-
...llmAndPrompt(span.attributes)
|
|
532
|
-
};
|
|
533
|
-
await this.recordSpanStart(ourSpan);
|
|
534
|
-
}
|
|
535
|
-
async handleEnd(span) {
|
|
536
|
-
const ctx = span.spanContext();
|
|
537
|
-
const traceId = ctx.traceId;
|
|
538
|
-
const ended = {
|
|
539
|
-
id: ctx.spanId,
|
|
540
|
-
traceId,
|
|
541
|
-
parentId: span.parentSpanContext && span.parentSpanContext.traceId === traceId ? span.parentSpanContext.spanId : void 0,
|
|
542
|
-
name: span.name,
|
|
543
|
-
kind: readKind(span.attributes),
|
|
544
|
-
startTime: hrTimeToMs(span.startTime),
|
|
545
|
-
endTime: hrTimeToMs(span.endTime),
|
|
546
|
-
status: mapStatus(span.status),
|
|
547
|
-
errorMessage: span.status.code === SpanStatusCode.ERROR ? span.status.message : void 0,
|
|
548
|
-
attributes: { ...span.attributes },
|
|
549
|
-
...llmAndPrompt(span.attributes)
|
|
550
|
-
};
|
|
551
|
-
await this.recordSpanEnd(ended);
|
|
552
|
-
}
|
|
553
|
-
/**
|
|
554
|
-
* Waits for every in-flight `onStart`/`onEnd` handler to settle. Used by
|
|
555
|
-
* tests to deterministically assert on the resulting trace store.
|
|
556
|
-
*/
|
|
557
|
-
async drainPendingHandlers() {
|
|
558
|
-
while (this.spanPromises.size > 0) await Promise.all([...this.spanPromises.values()]);
|
|
559
|
-
}
|
|
560
|
-
};
|
|
561
|
-
//#endregion
|
|
562
|
-
//#region src/sdk/sdk-adapter.ts
|
|
563
|
-
/**
|
|
564
|
-
* Walk up the directory tree from both `rootDir` and `process.cwd()` looking
|
|
565
|
-
* for `node_modules/<packageName>/<dtsRelPath>`.
|
|
566
|
-
*/
|
|
567
|
-
function findPackageDts(packageName, dtsRelPath, rootDir) {
|
|
568
|
-
const seen = /* @__PURE__ */ new Set();
|
|
569
|
-
for (const start of [rootDir, process.cwd()]) {
|
|
570
|
-
let dir = start;
|
|
571
|
-
while (!seen.has(dir)) {
|
|
572
|
-
seen.add(dir);
|
|
573
|
-
const candidate = path.join(dir, "node_modules", packageName, dtsRelPath);
|
|
574
|
-
try {
|
|
575
|
-
fs.accessSync(candidate);
|
|
576
|
-
return candidate;
|
|
577
|
-
} catch {}
|
|
578
|
-
const parent = path.dirname(dir);
|
|
579
|
-
if (parent === dir) break;
|
|
580
|
-
dir = parent;
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
return null;
|
|
584
|
-
}
|
|
585
|
-
//#endregion
|
|
586
|
-
//#region src/brand.ts
|
|
587
|
-
function makeBrand(sym) {
|
|
588
|
-
return {
|
|
589
|
-
brand: (value) => Object.defineProperty(value, sym, { value: true }),
|
|
590
|
-
isBranded: (value) => typeof value === "object" && value !== null && value[sym] === true
|
|
591
|
-
};
|
|
592
|
-
}
|
|
593
|
-
//#endregion
|
|
594
|
-
//#region src/sdk/vercel-ai-sdk/telemetry.ts
|
|
595
|
-
const { brand: brandPerPrompt, isBranded: isPerPromptTelemetry } = makeBrand(Symbol.for("evalution.VercelAISDKTelemetry.PerPromptTelemetry"));
|
|
596
|
-
const { brand: brandTelemetry, isBranded: isVercelAISDKTelemetry } = makeBrand(Symbol.for("evalution.VercelAISDKTelemetry"));
|
|
597
|
-
function toSpanMessages(messages) {
|
|
598
|
-
return messages.map((msg) => {
|
|
599
|
-
const role = msg.role;
|
|
600
|
-
const content = msg.content;
|
|
601
|
-
if (typeof content === "string") return {
|
|
602
|
-
role,
|
|
603
|
-
content
|
|
604
|
-
};
|
|
605
|
-
return {
|
|
606
|
-
role,
|
|
607
|
-
content: content.filter((c) => c.type === "text").map((c) => c.text).join("")
|
|
608
|
-
};
|
|
609
|
-
});
|
|
610
|
-
}
|
|
611
|
-
function toArray(v) {
|
|
612
|
-
return v === void 0 ? [] : Array.isArray(v) ? [...v] : [v];
|
|
613
|
-
}
|
|
614
|
-
/**
|
|
615
|
-
* Native v7 AI SDK `Telemetry` integration that records evalution traces
|
|
616
|
-
* without going through OpenTelemetry.
|
|
617
|
-
*
|
|
618
|
-
* When your app starts, register this globally via `registerTelemetry(new Evalution())` to capture
|
|
619
|
-
* every `generateText`/`streamText` call as a fallback (events are keyed by
|
|
620
|
-
* `callId`, so concurrent calls stay correctly separated, though the fallback
|
|
621
|
-
* lacks prompt identity). The `prompts()` helper additionally swaps in a
|
|
622
|
-
* per-call integration from {@link createTelemetryForPrompt} so
|
|
623
|
-
* helper-defined prompts are recorded with full identity.
|
|
624
|
-
*
|
|
625
|
-
* When an OpenTelemetry integration is also active, this class
|
|
626
|
-
* defers to it by default (see {@link VercelAISDKTelemetryOptions.nativeTelemetry}) rather
|
|
627
|
-
* than emitting a duplicate, parallel trace.
|
|
628
|
-
*/
|
|
629
|
-
var VercelAISDKTelemetry = class extends BaseTraceIngestor {
|
|
630
|
-
/**
|
|
631
|
-
* This instance's configured {@link VercelAISDKTelemetryOptions.nativeTelemetry}.
|
|
632
|
-
* Read by the `prompts()` helper to decide whether to defer to a sibling
|
|
633
|
-
* OpenTelemetry integration for a given call.
|
|
634
|
-
*/
|
|
635
|
-
nativeTelemetry;
|
|
636
|
-
runs = /* @__PURE__ */ new Map();
|
|
637
|
-
constructor(options = {}) {
|
|
638
|
-
super();
|
|
639
|
-
this.nativeTelemetry = options.nativeTelemetry ?? "auto";
|
|
640
|
-
brandTelemetry(this);
|
|
641
|
-
}
|
|
642
|
-
shouldDeferGlobally() {
|
|
643
|
-
if (this.nativeTelemetry === "always") return false;
|
|
644
|
-
if (this.nativeTelemetry === "never") return true;
|
|
645
|
-
this.nativeTelemetry;
|
|
646
|
-
return toArray(globalThis.AI_SDK_TELEMETRY_INTEGRATIONS).some((i) => i?.constructor?.name === "OpenTelemetry");
|
|
647
|
-
}
|
|
648
|
-
onStart = (event) => this.shouldDeferGlobally() ? void 0 : this.handleStart(event);
|
|
649
|
-
onStepStart = (event) => this.handleStepStart(event);
|
|
650
|
-
onToolExecutionStart = (event) => this.handleToolExecutionStart(event);
|
|
651
|
-
onToolExecutionEnd = (event) => this.handleToolExecutionEnd(event);
|
|
652
|
-
onStepEnd = (event) => this.handleStepEnd(event);
|
|
653
|
-
onEnd = (event) => this.handleEnd(event);
|
|
654
|
-
onAbort = (event) => this.handleAbort(event);
|
|
655
|
-
/**
|
|
656
|
-
* Mints a `PerPromptTelemetry` integration bound to the given prompt identity.
|
|
657
|
-
* Used by the `prompts()` helper so a helper-defined prompt is recorded with
|
|
658
|
-
* full identity. Called with no `identity` (e.g. by the playground for a raw,
|
|
659
|
-
* non-helper config) it still binds a trace id but records without prompt
|
|
660
|
-
* identity — the same data the global fallback would, just under a known id.
|
|
661
|
-
*/
|
|
662
|
-
createTelemetryForPrompt(identity) {
|
|
663
|
-
const perPromptTelemetry = brandPerPrompt({
|
|
664
|
-
onStart: (event) => this.handleStart(event, { identity }),
|
|
665
|
-
onStepStart: (event) => this.handleStepStart(event),
|
|
666
|
-
onToolExecutionStart: (event) => this.handleToolExecutionStart(event),
|
|
667
|
-
onToolExecutionEnd: (event) => this.handleToolExecutionEnd(event),
|
|
668
|
-
onStepEnd: (event) => this.handleStepEnd(event),
|
|
669
|
-
onEnd: (event) => this.handleEnd(event),
|
|
670
|
-
onAbort: (event) => this.handleAbort(event),
|
|
671
|
-
withTraceId: (traceId) => brandPerPrompt({
|
|
672
|
-
...perPromptTelemetry,
|
|
673
|
-
onStart: (event) => this.handleStart(event, {
|
|
674
|
-
identity,
|
|
675
|
-
traceId
|
|
676
|
-
}),
|
|
677
|
-
fail: (message) => this.handleFail(traceId, message)
|
|
678
|
-
})
|
|
679
|
-
});
|
|
680
|
-
return perPromptTelemetry;
|
|
681
|
-
}
|
|
682
|
-
async handleStart(event, { identity, traceId = crypto.randomUUID() } = {}) {
|
|
683
|
-
const startTime = Date.now();
|
|
684
|
-
const name = identity?.name ?? event.operationId ?? "generation";
|
|
685
|
-
const span = {
|
|
686
|
-
id: `${traceId}:root`,
|
|
687
|
-
traceId,
|
|
688
|
-
name,
|
|
689
|
-
kind: "AGENT",
|
|
690
|
-
startTime,
|
|
691
|
-
llm: {
|
|
692
|
-
provider: event.provider,
|
|
693
|
-
model: event.modelId
|
|
694
|
-
},
|
|
695
|
-
prompt: identity?.id ? {
|
|
696
|
-
id: identity.id,
|
|
697
|
-
functionParameters: identity.functionParameters
|
|
698
|
-
} : void 0
|
|
699
|
-
};
|
|
700
|
-
this.runs.set(event.callId, {
|
|
701
|
-
traceId,
|
|
702
|
-
root: span,
|
|
703
|
-
tools: /* @__PURE__ */ new Map()
|
|
704
|
-
});
|
|
705
|
-
await this.recordSpanStart(span);
|
|
706
|
-
}
|
|
707
|
-
async handleStepStart(event) {
|
|
708
|
-
const run = this.runs.get(event.callId);
|
|
709
|
-
if (!run) return;
|
|
710
|
-
const messages = toSpanMessages(event.messages);
|
|
711
|
-
const span = {
|
|
712
|
-
id: crypto.randomUUID(),
|
|
713
|
-
traceId: run.traceId,
|
|
714
|
-
parentId: run.root.id,
|
|
715
|
-
name: `step: ${event.stepNumber}`,
|
|
716
|
-
kind: "LLM",
|
|
717
|
-
startTime: Date.now(),
|
|
718
|
-
llm: {
|
|
719
|
-
provider: event.provider,
|
|
720
|
-
model: event.modelId,
|
|
721
|
-
messages
|
|
722
|
-
}
|
|
723
|
-
};
|
|
724
|
-
run.step = span;
|
|
725
|
-
await this.recordSpanStart(span);
|
|
726
|
-
}
|
|
727
|
-
async handleToolExecutionStart(event) {
|
|
728
|
-
const run = this.runs.get(event.callId);
|
|
729
|
-
if (!run) return;
|
|
730
|
-
const parentSpan = run.step ?? run.root;
|
|
731
|
-
const span = {
|
|
732
|
-
id: crypto.randomUUID(),
|
|
733
|
-
traceId: run.traceId,
|
|
734
|
-
parentId: parentSpan.id,
|
|
735
|
-
name: `tool: ${event.toolCall.toolName}`,
|
|
736
|
-
kind: "TOOL",
|
|
737
|
-
startTime: Date.now(),
|
|
738
|
-
tool: {
|
|
739
|
-
toolName: event.toolCall.toolName,
|
|
740
|
-
input: event.toolCall.input
|
|
741
|
-
}
|
|
742
|
-
};
|
|
743
|
-
run.tools.set(event.toolCall.toolCallId, span);
|
|
744
|
-
await this.recordSpanStart(span);
|
|
745
|
-
}
|
|
746
|
-
async handleToolExecutionEnd(event) {
|
|
747
|
-
const run = this.runs.get(event.callId);
|
|
748
|
-
if (!run) return;
|
|
749
|
-
const startSpan = run.tools.get(event.toolCall.toolCallId);
|
|
750
|
-
if (!startSpan) return;
|
|
751
|
-
run.tools.delete(event.toolCall.toolCallId);
|
|
752
|
-
const isError = event.toolOutput.type === "tool-error";
|
|
753
|
-
const span = {
|
|
754
|
-
...startSpan,
|
|
755
|
-
endTime: Date.now(),
|
|
756
|
-
status: isError ? "error" : "ok",
|
|
757
|
-
errorMessage: isError ? String(event.toolOutput.error) : void 0,
|
|
758
|
-
tool: {
|
|
759
|
-
toolName: event.toolCall.toolName,
|
|
760
|
-
input: event.toolCall.input,
|
|
761
|
-
output: isError ? void 0 : event.toolOutput?.output
|
|
762
|
-
}
|
|
763
|
-
};
|
|
764
|
-
await this.recordSpanEnd(span);
|
|
765
|
-
}
|
|
766
|
-
async handleStepEnd(event) {
|
|
767
|
-
const run = this.runs.get(event.callId);
|
|
768
|
-
if (!run?.step) return;
|
|
769
|
-
const startSpan = run.step;
|
|
770
|
-
run.step = void 0;
|
|
771
|
-
const span = {
|
|
772
|
-
...startSpan,
|
|
773
|
-
endTime: Date.now(),
|
|
774
|
-
status: event.finishReason === "error" ? "error" : "ok",
|
|
775
|
-
llm: {
|
|
776
|
-
...startSpan.llm ?? {},
|
|
777
|
-
provider: event.model.provider,
|
|
778
|
-
model: event.model.modelId,
|
|
779
|
-
output: event.text,
|
|
780
|
-
promptTokens: event.usage.inputTokens,
|
|
781
|
-
completionTokens: event.usage.outputTokens,
|
|
782
|
-
totalTokens: event.usage.totalTokens
|
|
783
|
-
}
|
|
784
|
-
};
|
|
785
|
-
await this.recordSpanEnd(span);
|
|
786
|
-
}
|
|
787
|
-
async handleEnd(event) {
|
|
788
|
-
const run = this.runs.get(event.callId);
|
|
789
|
-
if (!run) return;
|
|
790
|
-
this.runs.delete(event.callId);
|
|
791
|
-
if (run.step || run.tools.size > 0) console.warn("[VercelAISDKTelemetry] spans left over in onEnd!");
|
|
792
|
-
const span = {
|
|
793
|
-
...run.root,
|
|
794
|
-
endTime: Date.now(),
|
|
795
|
-
status: "ok"
|
|
796
|
-
};
|
|
797
|
-
await this.recordSpanEnd(span);
|
|
798
|
-
}
|
|
799
|
-
async handleAbort(event) {
|
|
800
|
-
const run = this.runs.get(event.callId);
|
|
801
|
-
if (!run) return;
|
|
802
|
-
this.runs.delete(event.callId);
|
|
803
|
-
await this.endOpenSpansAsError(run, String(event.reason));
|
|
804
|
-
}
|
|
805
|
-
/**
|
|
806
|
-
* Closes a run's still-open spans (tools, then step, then root) as `error`.
|
|
807
|
-
* Ending the root finalizes the trace as `error`. Used by both `onAbort` and
|
|
808
|
-
* the `fail()` path so a mid-flight rejection doesn't leave spans hanging in
|
|
809
|
-
* `running`.
|
|
810
|
-
*/
|
|
811
|
-
async endOpenSpansAsError(run, message) {
|
|
812
|
-
const open = [
|
|
813
|
-
...run.tools.values(),
|
|
814
|
-
...run.step ? [run.step] : [],
|
|
815
|
-
run.root
|
|
816
|
-
];
|
|
817
|
-
for (const startSpan of open) await this.recordSpanEnd({
|
|
818
|
-
...startSpan,
|
|
819
|
-
endTime: Date.now(),
|
|
820
|
-
status: "error",
|
|
821
|
-
errorMessage: message
|
|
822
|
-
});
|
|
823
|
-
}
|
|
824
|
-
async handleFail(traceId, message) {
|
|
825
|
-
const entry = [...this.runs].find(([, run]) => run.traceId === traceId);
|
|
826
|
-
if (entry) {
|
|
827
|
-
const [callId, run] = entry;
|
|
828
|
-
this.runs.delete(callId);
|
|
829
|
-
await this.endOpenSpansAsError(run, message);
|
|
830
|
-
} else await this.failTrace(traceId, message);
|
|
831
|
-
}
|
|
832
|
-
};
|
|
833
|
-
//#endregion
|
|
834
|
-
//#region src/sdk/vercel-ai-sdk/index.ts
|
|
835
|
-
const MODEL_KEY = "model";
|
|
836
|
-
const SYSTEM_KEY = "system";
|
|
837
|
-
const MESSAGES_KEY = "messages";
|
|
838
|
-
const RESERVED_KEYS = /* @__PURE__ */ new Set([
|
|
839
|
-
MODEL_KEY,
|
|
840
|
-
SYSTEM_KEY,
|
|
841
|
-
MESSAGES_KEY
|
|
842
|
-
]);
|
|
843
|
-
const FALLBACK_CALL_SETTINGS_PARAMS = [
|
|
844
|
-
{
|
|
845
|
-
name: "maxOutputTokens",
|
|
846
|
-
description: "Maximum number of tokens to generate.",
|
|
847
|
-
type: {
|
|
848
|
-
kind: "primitive",
|
|
849
|
-
syntax: "number"
|
|
850
|
-
},
|
|
851
|
-
optional: true
|
|
852
|
-
},
|
|
853
|
-
{
|
|
854
|
-
name: "temperature",
|
|
855
|
-
description: "Temperature setting. The value is passed through to the provider. The range depends on the provider and model.",
|
|
856
|
-
type: {
|
|
857
|
-
kind: "primitive",
|
|
858
|
-
syntax: "number"
|
|
859
|
-
},
|
|
860
|
-
optional: true
|
|
861
|
-
},
|
|
862
|
-
{
|
|
863
|
-
name: "topP",
|
|
864
|
-
description: "Nucleus sampling. The value is passed through to the provider. The range depends on the provider and model.",
|
|
865
|
-
type: {
|
|
866
|
-
kind: "primitive",
|
|
867
|
-
syntax: "number"
|
|
868
|
-
},
|
|
869
|
-
optional: true
|
|
870
|
-
},
|
|
871
|
-
{
|
|
872
|
-
name: "topK",
|
|
873
|
-
description: "Only sample from the top K options for each subsequent token.",
|
|
874
|
-
type: {
|
|
875
|
-
kind: "primitive",
|
|
876
|
-
syntax: "number"
|
|
877
|
-
},
|
|
878
|
-
optional: true
|
|
879
|
-
},
|
|
880
|
-
{
|
|
881
|
-
name: "presencePenalty",
|
|
882
|
-
description: "Presence penalty setting. It affects the likelihood of the model to repeat information that is already in the prompt.",
|
|
883
|
-
type: {
|
|
884
|
-
kind: "primitive",
|
|
885
|
-
syntax: "number"
|
|
886
|
-
},
|
|
887
|
-
optional: true
|
|
888
|
-
},
|
|
889
|
-
{
|
|
890
|
-
name: "frequencyPenalty",
|
|
891
|
-
description: "Frequency penalty setting. It affects the likelihood of the model to repeatedly use the same words or phrases.",
|
|
892
|
-
type: {
|
|
893
|
-
kind: "primitive",
|
|
894
|
-
syntax: "number"
|
|
895
|
-
},
|
|
896
|
-
optional: true
|
|
897
|
-
},
|
|
898
|
-
{
|
|
899
|
-
name: "stopSequences",
|
|
900
|
-
description: "Stop sequences. If set, the model will stop generating text.",
|
|
901
|
-
type: {
|
|
902
|
-
kind: "array",
|
|
903
|
-
syntax: "string[]",
|
|
904
|
-
elementType: {
|
|
905
|
-
kind: "primitive",
|
|
906
|
-
syntax: "string"
|
|
907
|
-
}
|
|
908
|
-
},
|
|
909
|
-
optional: true
|
|
910
|
-
},
|
|
911
|
-
{
|
|
912
|
-
name: "seed",
|
|
913
|
-
description: "The seed (integer) to use for random sampling.",
|
|
914
|
-
type: {
|
|
915
|
-
kind: "primitive",
|
|
916
|
-
syntax: "number"
|
|
917
|
-
},
|
|
918
|
-
optional: true
|
|
919
|
-
},
|
|
920
|
-
{
|
|
921
|
-
name: "maxRetries",
|
|
922
|
-
description: "Maximum number of retries. Set to 0 to disable retries.",
|
|
923
|
-
type: {
|
|
924
|
-
kind: "primitive",
|
|
925
|
-
syntax: "number"
|
|
926
|
-
},
|
|
927
|
-
optional: true
|
|
928
|
-
}
|
|
929
|
-
];
|
|
930
|
-
/** The `prompts()` factory from `@evalution/vercel-ai-sdk`. */
|
|
931
|
-
const PROMPTS_HELPER_CALL = {
|
|
932
|
-
callee: "prompts",
|
|
933
|
-
import: {
|
|
934
|
-
name: "prompts",
|
|
935
|
-
from: "@evalution/vercel-ai-sdk"
|
|
936
|
-
}
|
|
937
|
-
};
|
|
938
|
-
/** Build the binding-candidate array for a provider function call. */
|
|
939
|
-
function providerBinding(provider) {
|
|
940
|
-
return [{
|
|
941
|
-
kind: "parameter",
|
|
942
|
-
enclosingCall: PROMPTS_HELPER_CALL
|
|
943
|
-
}, {
|
|
944
|
-
kind: "import",
|
|
945
|
-
spec: {
|
|
946
|
-
name: provider,
|
|
947
|
-
from: `@ai-sdk/${provider}`
|
|
948
|
-
}
|
|
949
|
-
}];
|
|
950
|
-
}
|
|
951
|
-
/** Build a {@link ModelInfo} entry from group, label, provider, and model ID. */
|
|
952
|
-
function model(group, label, provider, modelId) {
|
|
953
|
-
const id = `${provider}/${modelId}`;
|
|
954
|
-
return {
|
|
955
|
-
id,
|
|
956
|
-
label,
|
|
957
|
-
group,
|
|
958
|
-
values: {
|
|
959
|
-
function: {
|
|
960
|
-
kind: "functionCall",
|
|
961
|
-
callee: provider,
|
|
962
|
-
args: [{
|
|
963
|
-
kind: "primitive",
|
|
964
|
-
value: modelId
|
|
965
|
-
}],
|
|
966
|
-
binding: providerBinding(provider)
|
|
967
|
-
},
|
|
968
|
-
string: {
|
|
969
|
-
kind: "primitive",
|
|
970
|
-
value: id
|
|
971
|
-
}
|
|
972
|
-
}
|
|
973
|
-
};
|
|
974
|
-
}
|
|
975
|
-
/** Build a custom-value template entry for a provider (used in `groups.{provider}.customValueTemplates.function`). */
|
|
976
|
-
function customValueTemplate(provider) {
|
|
977
|
-
return {
|
|
978
|
-
kind: "functionCall",
|
|
979
|
-
callee: provider,
|
|
980
|
-
args: [{
|
|
981
|
-
kind: "primitive",
|
|
982
|
-
value: "$input"
|
|
983
|
-
}],
|
|
984
|
-
binding: providerBinding(provider)
|
|
985
|
-
};
|
|
986
|
-
}
|
|
987
|
-
/** Starter contents of `.evalution/config.ts` for the Vercel AI SDK. */
|
|
988
|
-
const CONFIG_FILE_CONTENTS = `import type { EvalutionConfig } from 'evalution';
|
|
989
|
-
import { FilePromptProvider, VercelAISDK } from 'evalution';
|
|
990
|
-
|
|
991
|
-
export default {
|
|
992
|
-
promptProviders: [
|
|
993
|
-
new FilePromptProvider({
|
|
994
|
-
sdk: new VercelAISDK(),
|
|
995
|
-
}),
|
|
996
|
-
],
|
|
997
|
-
} satisfies EvalutionConfig;
|
|
998
|
-
`;
|
|
999
|
-
let globalIngestionSetup;
|
|
1000
|
-
/**
|
|
1001
|
-
* {@link SDKAdapter} implementation for the
|
|
1002
|
-
* [Vercel AI SDK](https://sdk.vercel.ai/).
|
|
1003
|
-
*
|
|
1004
|
-
* - `getModelParameters` reads `CallSettings` from the SDK's `.d.ts` bundle
|
|
1005
|
-
* and surfaces parameters with simple types that can be edited in the UI.
|
|
1006
|
-
* - `executeConfig` delegates to `generateText`.
|
|
1007
|
-
*/
|
|
1008
|
-
var VercelAISDK = class {
|
|
1009
|
-
promptsHelperImport = PROMPTS_HELPER_CALL.import.from;
|
|
1010
|
-
/**
|
|
1011
|
-
* Onboarding task: install the SDK package, then drop a starter config.
|
|
1012
|
-
* @internal
|
|
1013
|
-
*/
|
|
1014
|
-
static setupTask = {
|
|
1015
|
-
id: "vercel-ai-sdk",
|
|
1016
|
-
label: "AI SDK",
|
|
1017
|
-
icon: "vercel",
|
|
1018
|
-
steps: [
|
|
1019
|
-
{
|
|
1020
|
-
kind: "install_package",
|
|
1021
|
-
id: "install-ai",
|
|
1022
|
-
package: "ai"
|
|
1023
|
-
},
|
|
1024
|
-
{
|
|
1025
|
-
kind: "install_package",
|
|
1026
|
-
id: "install-evalution-vercel-ai-sdk",
|
|
1027
|
-
package: "@evalution/vercel-ai-sdk"
|
|
1028
|
-
},
|
|
1029
|
-
{
|
|
1030
|
-
kind: "create_config",
|
|
1031
|
-
id: "create-config",
|
|
1032
|
-
path: CONFIG_FILE_RELATIVE_PATH,
|
|
1033
|
-
contents: CONFIG_FILE_CONTENTS
|
|
1034
|
-
}
|
|
1035
|
-
]
|
|
1036
|
-
};
|
|
1037
|
-
getModelCatalog() {
|
|
1038
|
-
return Promise.resolve({
|
|
1039
|
-
modelValueTypes: {
|
|
1040
|
-
function: {
|
|
1041
|
-
label: "Provider",
|
|
1042
|
-
description: "Call provider function (e.g. openai(\"gpt-4o\"))"
|
|
1043
|
-
},
|
|
1044
|
-
string: {
|
|
1045
|
-
label: "Gateway",
|
|
1046
|
-
description: "Use a gateway model string (e.g. \"openai/gpt-4o\")"
|
|
1047
|
-
}
|
|
1048
|
-
},
|
|
1049
|
-
groups: {
|
|
1050
|
-
OpenAI: { customValueTemplates: { function: customValueTemplate("openai") } },
|
|
1051
|
-
Anthropic: { customValueTemplates: { function: customValueTemplate("anthropic") } },
|
|
1052
|
-
Google: { customValueTemplates: { function: customValueTemplate("google") } }
|
|
1053
|
-
},
|
|
1054
|
-
models: [
|
|
1055
|
-
model("OpenAI", "GPT-5.5 Pro", "openai", "gpt-5.5-pro"),
|
|
1056
|
-
model("OpenAI", "GPT-5.5", "openai", "gpt-5.5"),
|
|
1057
|
-
model("OpenAI", "GPT-5.4 Pro", "openai", "gpt-5.4-pro"),
|
|
1058
|
-
model("OpenAI", "GPT-5.4", "openai", "gpt-5.4"),
|
|
1059
|
-
model("OpenAI", "GPT-5.4 mini", "openai", "gpt-5.4-mini"),
|
|
1060
|
-
model("OpenAI", "GPT-5.4 nano", "openai", "gpt-5.4-nano"),
|
|
1061
|
-
model("Anthropic", "Claude Opus 4.8", "anthropic", "claude-opus-4-8"),
|
|
1062
|
-
model("Anthropic", "Claude Sonnet 4.6", "anthropic", "claude-sonnet-4-6"),
|
|
1063
|
-
model("Anthropic", "Claude Haiku 4.5", "anthropic", "claude-haiku-4-5"),
|
|
1064
|
-
model("Google", "Gemini 3.5 Flash", "google", "gemini-3.5-flash"),
|
|
1065
|
-
model("Google", "Gemini 3.1 Pro Preview", "google", "gemini-3.1-pro-preview"),
|
|
1066
|
-
model("Google", "Gemini 3.1 Flash-Lite", "google", "gemini-3.1-flash-lite")
|
|
1067
|
-
]
|
|
1068
|
-
});
|
|
1069
|
-
}
|
|
1070
|
-
getModelParameters(rootDir) {
|
|
1071
|
-
try {
|
|
1072
|
-
const dtsPath = findPackageDts("ai", "dist/index.d.ts", rootDir);
|
|
1073
|
-
if (dtsPath) {
|
|
1074
|
-
const sourceText = fs.readFileSync(dtsPath, "utf-8");
|
|
1075
|
-
const sourceFile = ts.createSourceFile(dtsPath, sourceText, ts.ScriptTarget.Latest, true);
|
|
1076
|
-
const decl = findTypeDeclaration(sourceFile, "CallSettings");
|
|
1077
|
-
if (decl) return extractPropertiesFromDeclaration(decl, sourceFile).definitions;
|
|
1078
|
-
}
|
|
1079
|
-
} catch {}
|
|
1080
|
-
return FALLBACK_CALL_SETTINGS_PARAMS;
|
|
1081
|
-
}
|
|
1082
|
-
async executeConfig(config, { traceId, identity } = {}) {
|
|
1083
|
-
const { generateText } = await import("ai");
|
|
1084
|
-
let integration;
|
|
1085
|
-
if (traceId) {
|
|
1086
|
-
const integrations = toArray(config?.telemetry?.integrations);
|
|
1087
|
-
const i = integrations.findIndex(isPerPromptTelemetry);
|
|
1088
|
-
if (i >= 0) {
|
|
1089
|
-
integration = integrations[i].withTraceId(traceId);
|
|
1090
|
-
config = {
|
|
1091
|
-
...config,
|
|
1092
|
-
telemetry: {
|
|
1093
|
-
...config.telemetry,
|
|
1094
|
-
integrations: integrations.with(i, integration)
|
|
1095
|
-
}
|
|
1096
|
-
};
|
|
1097
|
-
} else {
|
|
1098
|
-
const ingestor = await globalIngestionSetup;
|
|
1099
|
-
if (isVercelAISDKTelemetry(ingestor)) {
|
|
1100
|
-
integration = ingestor.createTelemetryForPrompt(identity).withTraceId(traceId);
|
|
1101
|
-
config = {
|
|
1102
|
-
...config,
|
|
1103
|
-
telemetry: {
|
|
1104
|
-
...config.telemetry,
|
|
1105
|
-
integrations: [...integrations.filter((t) => !isVercelAISDKTelemetry(t)), integration]
|
|
1106
|
-
}
|
|
1107
|
-
};
|
|
1108
|
-
}
|
|
1109
|
-
}
|
|
1110
|
-
}
|
|
1111
|
-
generateText(config).catch((err) => {
|
|
1112
|
-
integration?.fail(err?.message ?? String(err));
|
|
1113
|
-
console.error("prompt execution failed:", err);
|
|
1114
|
-
});
|
|
1115
|
-
}
|
|
1116
|
-
setupTraceIngestion() {
|
|
1117
|
-
globalIngestionSetup ??= this.doSetupTraceIngestion();
|
|
1118
|
-
return globalIngestionSetup;
|
|
1119
|
-
}
|
|
1120
|
-
async doSetupTraceIngestion() {
|
|
1121
|
-
const ai = await import("ai");
|
|
1122
|
-
if (typeof ai.registerTelemetry === "function") {
|
|
1123
|
-
const telemetry = new VercelAISDKTelemetry();
|
|
1124
|
-
ai.registerTelemetry(telemetry);
|
|
1125
|
-
return telemetry;
|
|
1126
|
-
}
|
|
1127
|
-
const { context, trace } = await import("@opentelemetry/api");
|
|
1128
|
-
const { AsyncLocalStorageContextManager } = await import("@opentelemetry/context-async-hooks");
|
|
1129
|
-
const { BasicTracerProvider } = await import("@opentelemetry/sdk-trace-base");
|
|
1130
|
-
const ingestor = new OTelTraceIngestor();
|
|
1131
|
-
const tracerProvider = new BasicTracerProvider({ spanProcessors: [ingestor.getSpanProcessor()] });
|
|
1132
|
-
trace.setGlobalTracerProvider(tracerProvider);
|
|
1133
|
-
const contextManager = new AsyncLocalStorageContextManager();
|
|
1134
|
-
contextManager.enable();
|
|
1135
|
-
context.setGlobalContextManager(contextManager);
|
|
1136
|
-
return ingestor;
|
|
1137
|
-
}
|
|
1138
|
-
normalizePrompt(prompt) {
|
|
1139
|
-
const { definitions, values } = prompt.extractedProps;
|
|
1140
|
-
const modelValue = values?.[MODEL_KEY];
|
|
1141
|
-
const systemValue = values?.[SYSTEM_KEY];
|
|
1142
|
-
const messagesValue = values?.[MESSAGES_KEY];
|
|
1143
|
-
const modelParameters = definitions.filter((d) => !RESERVED_KEYS.has(d.name)).map((def) => {
|
|
1144
|
-
const value = values?.[def.name];
|
|
1145
|
-
return {
|
|
1146
|
-
def,
|
|
1147
|
-
value,
|
|
1148
|
-
editable: value ? isEditable(value) : true
|
|
1149
|
-
};
|
|
1150
|
-
});
|
|
1151
|
-
return {
|
|
1152
|
-
id: prompt.id,
|
|
1153
|
-
providerId: prompt.providerId,
|
|
1154
|
-
globalId: prompt.globalId,
|
|
1155
|
-
name: prompt.name,
|
|
1156
|
-
functionParameters: prompt.functionParameters,
|
|
1157
|
-
metadata: prompt.metadata,
|
|
1158
|
-
treePath: prompt.treePath,
|
|
1159
|
-
model: modelValue,
|
|
1160
|
-
modelEditable: modelValue ? isEditable(modelValue) : true,
|
|
1161
|
-
system: systemValue,
|
|
1162
|
-
systemEditable: systemValue ? isEditable(systemValue) : true,
|
|
1163
|
-
messages: extractMessages(messagesValue),
|
|
1164
|
-
messagesEditable: messagesValue ? isEditable(messagesValue) : true,
|
|
1165
|
-
modelParameters
|
|
1166
|
-
};
|
|
1167
|
-
}
|
|
1168
|
-
denormalizeUpdates(updates, _currentValues) {
|
|
1169
|
-
const out = {};
|
|
1170
|
-
if (MODEL_KEY in updates) out[MODEL_KEY] = updates.model ?? null;
|
|
1171
|
-
if (SYSTEM_KEY in updates) out[SYSTEM_KEY] = updates.system ?? null;
|
|
1172
|
-
if (MESSAGES_KEY in updates) out[MESSAGES_KEY] = updates.messages === null || updates.messages === void 0 ? null : messagesToValue(updates.messages);
|
|
1173
|
-
if (updates.modelParameters) for (const [name, value] of Object.entries(updates.modelParameters)) out[name] = value;
|
|
1174
|
-
return out;
|
|
1175
|
-
}
|
|
1176
|
-
};
|
|
1177
|
-
function messagesToValue(msgs) {
|
|
1178
|
-
return {
|
|
1179
|
-
kind: "array",
|
|
1180
|
-
elements: msgs.map((msg) => ({
|
|
1181
|
-
kind: "object",
|
|
1182
|
-
properties: {
|
|
1183
|
-
role: {
|
|
1184
|
-
kind: "primitive",
|
|
1185
|
-
value: msg.role
|
|
1186
|
-
},
|
|
1187
|
-
content: msg.content
|
|
1188
|
-
}
|
|
1189
|
-
}))
|
|
1190
|
-
};
|
|
1191
|
-
}
|
|
1192
|
-
const EMPTY_CONTENT = {
|
|
1193
|
-
kind: "primitive",
|
|
1194
|
-
value: ""
|
|
1195
|
-
};
|
|
1196
|
-
function extractMessages(value) {
|
|
1197
|
-
if (!value) return [];
|
|
1198
|
-
if (value.kind !== "array") return [{
|
|
1199
|
-
role: "user",
|
|
1200
|
-
content: value
|
|
1201
|
-
}];
|
|
1202
|
-
return value.elements.map((el) => {
|
|
1203
|
-
if (el.kind !== "object") return {
|
|
1204
|
-
role: "user",
|
|
1205
|
-
content: el
|
|
1206
|
-
};
|
|
1207
|
-
const roleValue = el.properties.role;
|
|
1208
|
-
const role = roleValue?.kind === "primitive" ? String(roleValue.value) : "user";
|
|
1209
|
-
const content = el.properties.content ?? EMPTY_CONTENT;
|
|
1210
|
-
const toolCalls = extractToolCalls(el.properties.toolCalls);
|
|
1211
|
-
return toolCalls ? {
|
|
1212
|
-
role,
|
|
1213
|
-
content,
|
|
1214
|
-
toolCalls
|
|
1215
|
-
} : {
|
|
1216
|
-
role,
|
|
1217
|
-
content
|
|
1218
|
-
};
|
|
1219
|
-
});
|
|
1220
|
-
}
|
|
1221
|
-
function extractToolCalls(value) {
|
|
1222
|
-
if (value?.kind !== "array") return void 0;
|
|
1223
|
-
const out = [];
|
|
1224
|
-
for (const el of value.elements) {
|
|
1225
|
-
if (el.kind !== "object") continue;
|
|
1226
|
-
const name = el.properties.toolName;
|
|
1227
|
-
const args = el.properties.args;
|
|
1228
|
-
out.push({
|
|
1229
|
-
toolName: name?.kind === "primitive" ? String(name.value) : "",
|
|
1230
|
-
args: args?.kind === "primitive" ? String(args.value) : ""
|
|
1231
|
-
});
|
|
1232
|
-
}
|
|
1233
|
-
return out.length > 0 ? out : void 0;
|
|
1234
|
-
}
|
|
1235
|
-
//#endregion
|
|
1236
|
-
export { BaseTraceProvider as _, BaseTraceIngestor as a, PROMPT_NAME_ATTRIBUTE as c, createTracerForPrompt as d, getPromptSpanAttributes as f, MemoryTraceProvider as g, isEditable as h, OTelTraceIngestor as i, PROMPT_PROVIDER_ID_ATTRIBUTE as l, setupStepCommand as m, VercelAISDKTelemetry as n, PROMPT_ID_ATTRIBUTE as o, CONFIG_FILE_RELATIVE_PATH as p, findPackageDts as r, PROMPT_INPUTS_ATTRIBUTE as s, VercelAISDK as t, SPAN_KIND_ATTRIBUTE as u, mergeSpans as v };
|