evalution 1.0.4 → 1.0.6
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 +30 -6
- 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 +5328 -348
- package/dist/client/assets/DatasetView-BcYR5beY.css +1 -0
- package/dist/client/assets/DatasetView-CyX0mCj8.js +15 -0
- package/dist/client/assets/EvalRunView-5IZp_6Ob.js +2 -0
- package/dist/client/assets/EvalView-DBTK6rCe.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-CBtkQufd.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-DyudWmoO.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-aypgoZcG.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-CXHiTLsp.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 +3806 -894
- package/dist/index.js +3653 -578
- package/dist/instance-names-pVQxJbtw.js +12 -0
- package/dist/otlp-trace-ingestor-V8_bbpUG.js +12376 -0
- package/dist/runtime-DCNx7dHI.js +302 -0
- package/dist/trace-Dn6Pfcc5.d.ts +200 -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 +78 -14
- package/dist/client/assets/index-C4XXh0na.js +0 -144
- package/dist/client/assets/index-CHPZsnKo.css +0 -32
- package/dist/vercel-ai-sdk-B8ivuOzP.js +0 -853
|
@@ -0,0 +1,1925 @@
|
|
|
1
|
+
import { CalleeBinding, ExtractedProps, PropDefinition as PropDefinition$1, PropType, PropValue as PropValue$1, SourceSpan, ValueCatalog, ValueCatalogGroup, ValueCatalogPreset, ValueFactory as ValueFactory$1 } from "ts-proppy";
|
|
2
|
+
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
3
|
+
|
|
4
|
+
//#region src/trace/trace-types.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* A reference to a prompt.
|
|
7
|
+
*
|
|
8
|
+
* `id` is interpreted as a globally-unique prompt ID unless `providerId` is
|
|
9
|
+
* present, in which case `id` is scoped to that specific prompt provider. This
|
|
10
|
+
* mirrors the OpenTelemetry attributes `evalution.prompt.id` (always present)
|
|
11
|
+
* and `evalution.prompt.provider.id` (optional, scoping).
|
|
12
|
+
*/
|
|
13
|
+
interface PromptID {
|
|
14
|
+
/** The prompt ID — global unless {@link providerId} scopes it. */
|
|
15
|
+
id: string;
|
|
16
|
+
/** When set, {@link id} is scoped to this prompt provider. */
|
|
17
|
+
providerId?: string;
|
|
18
|
+
/** Positional arguments the prompt function was called with. */
|
|
19
|
+
functionParameters?: unknown[];
|
|
20
|
+
/**
|
|
21
|
+
* The unresolved inputs the run was launched with — the recipe, not the
|
|
22
|
+
* resolution.
|
|
23
|
+
*
|
|
24
|
+
* Replaying them is only exactly faithful for the `value` kind. A `resource`
|
|
25
|
+
* re-runs its `create()`, producing an *equivalent* value rather than the
|
|
26
|
+
* same one — a fresh handle, a newly seeded row — so a UI must present it as
|
|
27
|
+
* something that will be re-created, never as a restored value.
|
|
28
|
+
*/
|
|
29
|
+
functionInputs?: unknown[];
|
|
30
|
+
/** The unresolved execute-parameter inputs, keyed by parameter name. */
|
|
31
|
+
executeInputs?: Record<string, unknown>;
|
|
32
|
+
/**
|
|
33
|
+
* The run's named resource instances, by name, with the receipt each
|
|
34
|
+
* `create()` produced. See `specs/resource-instances.md` §F.
|
|
35
|
+
*/
|
|
36
|
+
resources?: Record<string, unknown>;
|
|
37
|
+
/**
|
|
38
|
+
* The prompt's parameter definitions as they stood when the run was
|
|
39
|
+
* launched, so a replay can diff them against today's signature rather than
|
|
40
|
+
* guess whether the recorded inputs still fit.
|
|
41
|
+
*/
|
|
42
|
+
parameterDefinitions?: unknown[];
|
|
43
|
+
/**
|
|
44
|
+
* The prompt's execute-parameter definitions as they stood when the run was
|
|
45
|
+
* launched — the types of {@link executeInputs}, as
|
|
46
|
+
* {@link parameterDefinitions} is for {@link functionInputs}.
|
|
47
|
+
*/
|
|
48
|
+
executeParameterDefinitions?: unknown[];
|
|
49
|
+
/** The version the run executed against. */
|
|
50
|
+
version?: string;
|
|
51
|
+
/** The variation applied on top of {@link version}, if any. */
|
|
52
|
+
variation?: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Classification of a {@link Span}. See also:
|
|
56
|
+
* - `lmnr.span.type` from https://laminar.sh/docs/tracing/otel
|
|
57
|
+
* - `mlflow.spanType` from https://mlflow.org/docs/latest/genai/tracing/opentelemetry/attribute-mapping/#translated-span-attributes
|
|
58
|
+
*
|
|
59
|
+
* Mapped from `gen_ai.operation.name`. `CHECK` is evalution's own: an eval
|
|
60
|
+
* check that traced something while judging the run — see
|
|
61
|
+
* {@link CHECK_ATTRIBUTE}.
|
|
62
|
+
*/
|
|
63
|
+
type SpanKind = "LLM" | "TOOL" | "AGENT" | "EMBEDDING" | "CHECK" | "DEFAULT";
|
|
64
|
+
/**
|
|
65
|
+
* Span attribute naming the eval check (by its id within the eval) that
|
|
66
|
+
* recorded the span while judging the trace — set on the check's `CHECK` span
|
|
67
|
+
* and on everything under it. Those spans aren't part of the run being
|
|
68
|
+
* judged, so the trace's rollups and chat view leave them out.
|
|
69
|
+
*/
|
|
70
|
+
declare const CHECK_ATTRIBUTE = "evalution.check";
|
|
71
|
+
/** Whether `span` was recorded by a check judging its trace, not by the run. */
|
|
72
|
+
declare function isCheckSpan(span: Pick<Span, "attributes">): boolean;
|
|
73
|
+
/** A text segment within a multi-part {@link SpanMessage} content. */
|
|
74
|
+
interface SpanTextPart {
|
|
75
|
+
type: "text";
|
|
76
|
+
text: string;
|
|
77
|
+
}
|
|
78
|
+
/** An image segment within a multi-part {@link SpanMessage} content. */
|
|
79
|
+
interface SpanImagePart {
|
|
80
|
+
type: "image";
|
|
81
|
+
/** A URL, or base64/data-URI image data. */
|
|
82
|
+
image: string;
|
|
83
|
+
/** MIME type (e.g. `image/png`), when known. */
|
|
84
|
+
mediaType?: string;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* A tool call the assistant made, within a multi-part {@link SpanMessage}
|
|
88
|
+
* content. Matched to its {@link SpanToolResultPart} by `toolCallId`.
|
|
89
|
+
*/
|
|
90
|
+
interface SpanToolCallPart {
|
|
91
|
+
type: "tool-call";
|
|
92
|
+
toolCallId: string;
|
|
93
|
+
toolName: string;
|
|
94
|
+
/** The arguments the model passed, as JSON. */
|
|
95
|
+
input: unknown;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* A tool's result fed back to the model, within a multi-part
|
|
99
|
+
* {@link SpanMessage} content (usually a `tool` message).
|
|
100
|
+
*/
|
|
101
|
+
interface SpanToolResultPart {
|
|
102
|
+
type: "tool-result";
|
|
103
|
+
toolCallId: string;
|
|
104
|
+
toolName: string;
|
|
105
|
+
/** What the tool returned, unwrapped from the SDK's output envelope. */
|
|
106
|
+
output: unknown;
|
|
107
|
+
/** Whether the result reports a failure (an error, or a denied call). */
|
|
108
|
+
isError?: boolean;
|
|
109
|
+
}
|
|
110
|
+
type SpanMessageRole = "user" | "assistant" | "system" | "tool" | (string & {});
|
|
111
|
+
/** One segment of a multi-part {@link SpanMessage} content. */
|
|
112
|
+
type SpanContentPart = SpanTextPart | SpanImagePart | SpanToolCallPart | SpanToolResultPart;
|
|
113
|
+
/**
|
|
114
|
+
* A single message within an LLM span's input/output.
|
|
115
|
+
*
|
|
116
|
+
* `content` is a plain string for the common text-only case. It is an array
|
|
117
|
+
* of {@link SpanContentPart} when the message carries non-text content (e.g.
|
|
118
|
+
* an image, or a tool call or result) — the `string` form stays in the union so existing consumers and
|
|
119
|
+
* already-stored rows keep working unchanged.
|
|
120
|
+
*/
|
|
121
|
+
interface SpanMessage {
|
|
122
|
+
role: SpanMessageRole;
|
|
123
|
+
content: string | SpanContentPart[];
|
|
124
|
+
}
|
|
125
|
+
/** LLM-specific attributes attached to `LLM` spans. */
|
|
126
|
+
interface LLMSpanDetails {
|
|
127
|
+
provider?: string;
|
|
128
|
+
model?: string;
|
|
129
|
+
/** Model parameters (temperature, max_tokens, …). */
|
|
130
|
+
modelParameters?: Record<string, unknown>;
|
|
131
|
+
/**
|
|
132
|
+
* Why the model stopped generating, as the provider or SDK reports it
|
|
133
|
+
* (`stop`, `length`, `tool-calls`, …). Not normalized across providers.
|
|
134
|
+
*/
|
|
135
|
+
finishReason?: string;
|
|
136
|
+
/**
|
|
137
|
+
* What the model was given: a message list for a chat model, or any JSON
|
|
138
|
+
* for a model that takes something else (a System One call records
|
|
139
|
+
* `{ state, questions }`). Array-ness is the discriminant — see
|
|
140
|
+
* {@link spanMessages}.
|
|
141
|
+
*/
|
|
142
|
+
input?: SpanMessage[] | {
|
|
143
|
+
[key: string]: unknown;
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* What it returned: text for a chat model, the assistant message of a turn
|
|
147
|
+
* that called tools (see `toolCallingOutput`), or JSON for structured
|
|
148
|
+
* output and for any model whose answer is data rather than prose.
|
|
149
|
+
*/
|
|
150
|
+
output?: unknown;
|
|
151
|
+
/** Input tokens, counting any read from or written to a prompt cache. */
|
|
152
|
+
promptTokens?: number;
|
|
153
|
+
completionTokens?: number;
|
|
154
|
+
totalTokens?: number;
|
|
155
|
+
/** How many of {@link promptTokens} were read from a prompt cache. */
|
|
156
|
+
cacheReadTokens?: number;
|
|
157
|
+
/** How many of {@link promptTokens} were written to a prompt cache. */
|
|
158
|
+
cacheWriteTokens?: number;
|
|
159
|
+
/**
|
|
160
|
+
* Dollar cost of the call, broken down by token type, if known. The total
|
|
161
|
+
* cost is `cost.prompt + cost.completion`; `cost.prompt` includes cache
|
|
162
|
+
* reads and writes, each at its own price.
|
|
163
|
+
*/
|
|
164
|
+
cost?: {
|
|
165
|
+
prompt: number;
|
|
166
|
+
completion: number; /** The part of `prompt` spent on {@link cacheReadTokens}. */
|
|
167
|
+
cacheRead?: number; /** The part of `prompt` spent on {@link cacheWriteTokens}. */
|
|
168
|
+
cacheWrite?: number;
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* The message list of a chat call, or `undefined` for any other input.
|
|
173
|
+
*
|
|
174
|
+
* A chat call's {@link LLMSpanDetails.input} is always a message list, and
|
|
175
|
+
* anything else is wrapped in an object, so being an array is what makes it
|
|
176
|
+
* one.
|
|
177
|
+
*/
|
|
178
|
+
declare function spanMessages(llm: LLMSpanDetails | undefined): SpanMessage[] | undefined;
|
|
179
|
+
interface ToolSpanDetails {
|
|
180
|
+
toolName: string;
|
|
181
|
+
/**
|
|
182
|
+
* The id the model gave this call, when the integration reports it — the
|
|
183
|
+
* same id as the {@link SpanToolCallPart} that requested it.
|
|
184
|
+
*/
|
|
185
|
+
toolCallId?: string;
|
|
186
|
+
input: unknown;
|
|
187
|
+
output?: unknown;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* A span in a {@link Trace}. Spans form a tree via {@link parentId}.
|
|
191
|
+
* Durations are derived from `startTime` and `endTime`; an in-progress span has
|
|
192
|
+
* no `endTime` yet.
|
|
193
|
+
*/
|
|
194
|
+
interface Span {
|
|
195
|
+
id: string;
|
|
196
|
+
traceId: string;
|
|
197
|
+
/** `undefined` for the root span of the trace. */
|
|
198
|
+
parentId?: string;
|
|
199
|
+
name: string;
|
|
200
|
+
kind: SpanKind;
|
|
201
|
+
/** Start timestamp in milliseconds since epoch. */
|
|
202
|
+
startTime: number;
|
|
203
|
+
/** End timestamp in milliseconds since epoch, or `undefined` while running. */
|
|
204
|
+
endTime?: number;
|
|
205
|
+
status?: "ok" | "error";
|
|
206
|
+
/** Error message if `status` is `'error'`. */
|
|
207
|
+
errorMessage?: string;
|
|
208
|
+
/** Free-form attributes to show in the span's details pane. */
|
|
209
|
+
attributes?: Record<string, unknown>;
|
|
210
|
+
/**
|
|
211
|
+
* The OpenTelemetry resource that produced the span: attributes describing
|
|
212
|
+
* the process or service it ran in rather than the span itself
|
|
213
|
+
* (`service.name`, `deployment.environment.name`, …).
|
|
214
|
+
*/
|
|
215
|
+
resource?: Record<string, unknown>;
|
|
216
|
+
/** LLM-specific details (present for `chat`/`completion`/`embedding` spans). */
|
|
217
|
+
llm?: LLMSpanDetails;
|
|
218
|
+
/**
|
|
219
|
+
* The prompt this span is attributed to, if any.
|
|
220
|
+
*
|
|
221
|
+
* Stored as emitted (`evalution.prompt.id` plus optional
|
|
222
|
+
* `evalution.prompt.provider.id`): a {@link PromptID} whose `id` is global
|
|
223
|
+
* unless `providerId` is set. The server resolves it against the prompt
|
|
224
|
+
* registry to a provider-scoped reference when a trace is served.
|
|
225
|
+
*/
|
|
226
|
+
prompt?: PromptID;
|
|
227
|
+
tool?: ToolSpanDetails;
|
|
228
|
+
}
|
|
229
|
+
interface TraceBase {
|
|
230
|
+
id: string;
|
|
231
|
+
providerId?: string;
|
|
232
|
+
name: string;
|
|
233
|
+
/** Start timestamp (ms). */
|
|
234
|
+
startTime: number;
|
|
235
|
+
/** End timestamp (ms), or `undefined` while the trace is still running. */
|
|
236
|
+
endTime?: number;
|
|
237
|
+
status: "running" | "ok" | "error";
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Top-level trace for a single invocation (e.g. one prompt execution).
|
|
241
|
+
*/
|
|
242
|
+
interface Trace extends TraceBase {
|
|
243
|
+
/** Free-form attributes (e.g. prompt ID, function params). */
|
|
244
|
+
attributes?: Record<string, unknown>;
|
|
245
|
+
}
|
|
246
|
+
/** Compact trace entry for listings (sidebar / `GET /api/traces`). */
|
|
247
|
+
interface TraceSummary extends TraceBase {
|
|
248
|
+
providerId: string;
|
|
249
|
+
/** Number of spans currently associated with the trace. */
|
|
250
|
+
spanCount: number;
|
|
251
|
+
/**
|
|
252
|
+
* Sum of every LLM span's token usage (`llm.totalTokens`, falling back to
|
|
253
|
+
* `promptTokens + completionTokens` per span the way `SpanDetails` does).
|
|
254
|
+
* `undefined` if no span in the trace reports any token usage.
|
|
255
|
+
*/
|
|
256
|
+
totalTokens?: number;
|
|
257
|
+
/** Sum of every LLM span's `llm.cost` (prompt + completion). `undefined` if no span reports a cost. */
|
|
258
|
+
cost?: number;
|
|
259
|
+
/** The model name, if every LLM span that reports one reports the same one. */
|
|
260
|
+
model?: string;
|
|
261
|
+
/** The prompt version the run executed against (`PromptID.version`). */
|
|
262
|
+
promptVersion?: string;
|
|
263
|
+
/** The prompt variation the run applied (`PromptID.variation`). */
|
|
264
|
+
promptVariation?: string;
|
|
265
|
+
/**
|
|
266
|
+
* The deployment environment the run happened in: its root span's
|
|
267
|
+
* resource's `deployment.environment.name` — `"playground"` for a run
|
|
268
|
+
* evalution itself made.
|
|
269
|
+
*/
|
|
270
|
+
environment?: string;
|
|
271
|
+
/** How many annotations of each kind are attached to the trace (trace-level or on any of its spans). */
|
|
272
|
+
annotationCounts: Record<AnnotationKind, number>;
|
|
273
|
+
/**
|
|
274
|
+
* The eval run that produced the trace, if any. Trace providers never set
|
|
275
|
+
* it — the server fills it in when listing, from the eval providers' results
|
|
276
|
+
* and the runs in flight.
|
|
277
|
+
*/
|
|
278
|
+
evalRun?: TraceEvalRun;
|
|
279
|
+
}
|
|
280
|
+
/** The eval run a trace came from — what the trace list groups by. */
|
|
281
|
+
interface TraceEvalRun {
|
|
282
|
+
/** The eval provider the run is recorded on. */
|
|
283
|
+
providerId: string;
|
|
284
|
+
evalId: string;
|
|
285
|
+
/** The eval's name. */
|
|
286
|
+
evalName: string;
|
|
287
|
+
runId: string;
|
|
288
|
+
/** When the run started (ms). */
|
|
289
|
+
startedAt: number;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* The OpenTelemetry semantic-convention resource attribute naming the
|
|
293
|
+
* service that produced a span.
|
|
294
|
+
*/
|
|
295
|
+
declare const SERVICE_NAME_ATTRIBUTE = "service.name";
|
|
296
|
+
/**
|
|
297
|
+
* The OpenTelemetry semantic-convention resource attribute naming the
|
|
298
|
+
* deployment environment a span was produced in.
|
|
299
|
+
*/
|
|
300
|
+
declare const DEPLOYMENT_ENVIRONMENT_ATTRIBUTE = "deployment.environment.name";
|
|
301
|
+
/** {@link DEPLOYMENT_ENVIRONMENT_ATTRIBUTE}'s value on a run evalution itself made. */
|
|
302
|
+
declare const PLAYGROUND_ENVIRONMENT = "playground";
|
|
303
|
+
/** A trace together with all of its spans. */
|
|
304
|
+
interface TraceWithSpans {
|
|
305
|
+
trace: Trace;
|
|
306
|
+
spans: Span[];
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Where an {@link Annotation} came from: the user, a coding agent we know by
|
|
310
|
+
* name, or any other agent (an MCP client that isn't Claude Code or Codex).
|
|
311
|
+
*/
|
|
312
|
+
type AnnotationSource = "user" | "claude-code" | "codex" | "agent";
|
|
313
|
+
/** What kind of note an {@link Annotation} records. */
|
|
314
|
+
type AnnotationKind = "issue" | "good" | "note";
|
|
315
|
+
/**
|
|
316
|
+
* A note attached to a trace, or to one specific span within it — e.g. a
|
|
317
|
+
* reviewer flagging a bad tool call, or an agent leaving a note about a run
|
|
318
|
+
* it just replayed.
|
|
319
|
+
*/
|
|
320
|
+
interface Annotation {
|
|
321
|
+
id: string;
|
|
322
|
+
traceId: string;
|
|
323
|
+
/** The span this annotation is attached to, or `undefined` for a trace-level annotation. */
|
|
324
|
+
spanId?: string;
|
|
325
|
+
kind: AnnotationKind;
|
|
326
|
+
note: string;
|
|
327
|
+
source: AnnotationSource;
|
|
328
|
+
/** Creation timestamp (ms). */
|
|
329
|
+
createdAt: number;
|
|
330
|
+
}
|
|
331
|
+
/** The fields of an {@link Annotation} that can be changed after it's made. */
|
|
332
|
+
type AnnotationChanges = Partial<Pick<Annotation, "kind" | "note">>;
|
|
333
|
+
/** The kind of change that occurred to a trace. */
|
|
334
|
+
type TraceChangeType = "add" | "update" | "remove";
|
|
335
|
+
/** Describes a single change emitted by `TraceProvider.watch`. */
|
|
336
|
+
interface TraceChangeEvent {
|
|
337
|
+
type: TraceChangeType;
|
|
338
|
+
traceId: string;
|
|
339
|
+
}
|
|
340
|
+
/** Real-time event pushed over the per-trace SSE subscription. */
|
|
341
|
+
type TraceStreamEvent = {
|
|
342
|
+
type: "span-start";
|
|
343
|
+
span: Span;
|
|
344
|
+
} | {
|
|
345
|
+
type: "span-end";
|
|
346
|
+
span: Span;
|
|
347
|
+
} | {
|
|
348
|
+
type: "span-update";
|
|
349
|
+
span: Span;
|
|
350
|
+
} | {
|
|
351
|
+
type: "trace-update";
|
|
352
|
+
trace: Trace;
|
|
353
|
+
} | {
|
|
354
|
+
type: "trace-end";
|
|
355
|
+
trace: Trace;
|
|
356
|
+
};
|
|
357
|
+
/** The change an annotation event describes. */
|
|
358
|
+
type AnnotationEventOp = "insert" | "update" | "delete";
|
|
359
|
+
/** The event a per-trace annotation subscription delivers. */
|
|
360
|
+
interface AnnotationEvent {
|
|
361
|
+
type: "annotation";
|
|
362
|
+
op: AnnotationEventOp;
|
|
363
|
+
annotation: Annotation;
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Real-time event pushed over the per-trace SSE subscription, broadened
|
|
367
|
+
* beyond span/trace lifecycle to also carry annotation changes — so a client
|
|
368
|
+
* holding one `EventSource` open on a trace sees both without a second
|
|
369
|
+
* connection. See `specs/trace-workshopping.md` §C.2.
|
|
370
|
+
*/
|
|
371
|
+
type TraceLiveEvent = TraceStreamEvent | AnnotationEvent;
|
|
372
|
+
/** Information about a registered trace provider, returned by `GET /api/trace-providers`. */
|
|
373
|
+
interface TraceProviderInfo {
|
|
374
|
+
id: string;
|
|
375
|
+
displayName?: string;
|
|
376
|
+
description?: string;
|
|
377
|
+
}
|
|
378
|
+
//#endregion
|
|
379
|
+
//#region src/eval/eval-types.d.ts
|
|
380
|
+
/** One check, as an eval uses it. See `specs/evals.md` §A. */
|
|
381
|
+
interface EvalCheck {
|
|
382
|
+
/** Stable within the eval; results are keyed by it. */
|
|
383
|
+
id: string;
|
|
384
|
+
/** The check's URI: `<module>#<export>`, or a built-in's `evalution/checks#<name>`. */
|
|
385
|
+
uri: string;
|
|
386
|
+
/** Overrides the check's own label in this eval. */
|
|
387
|
+
label?: string;
|
|
388
|
+
/** Values for the check's schema-valued inputs, by name. */
|
|
389
|
+
args: Record<string, ExecutionInput>;
|
|
390
|
+
/**
|
|
391
|
+
* For a check that returns a score: at or above this passes. Absent: the
|
|
392
|
+
* score is reported on its own.
|
|
393
|
+
*/
|
|
394
|
+
threshold?: number;
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* One binding per prompt slot, keyed by slot name, in the shape the execute
|
|
398
|
+
* panel persists. A binding may name a column (`dataset`), another slot
|
|
399
|
+
* (`input`), a resource instance (`instance`), a typed-in value, or an
|
|
400
|
+
* object mixing those.
|
|
401
|
+
*/
|
|
402
|
+
interface EvalInputs {
|
|
403
|
+
/** Function parameter name → binding. */
|
|
404
|
+
functionInputs: Record<string, ExecutionInput>;
|
|
405
|
+
/** Execute parameter name → binding. */
|
|
406
|
+
executeInputs: Record<string, ExecutionInput>;
|
|
407
|
+
/**
|
|
408
|
+
* Resource instances every row's run declares, merged with the row's own
|
|
409
|
+
* (`DatasetRow.resources`) — the row's win on a name both declare. See
|
|
410
|
+
* `specs/resource-instances.md` §E.
|
|
411
|
+
*/
|
|
412
|
+
resources?: RunResources;
|
|
413
|
+
}
|
|
414
|
+
/** A saved eval: data, stored by an `EvalProvider`. See `specs/evals.md` §A. */
|
|
415
|
+
interface EvalDefinition {
|
|
416
|
+
id: string;
|
|
417
|
+
name: string;
|
|
418
|
+
/** The prompt under test — its `globalId` when it has one, so moves and renames don't orphan it. */
|
|
419
|
+
prompt: PromptID;
|
|
420
|
+
/** The dataset whose rows are run. */
|
|
421
|
+
dataset: {
|
|
422
|
+
providerId: string;
|
|
423
|
+
id: string;
|
|
424
|
+
};
|
|
425
|
+
/** See {@link EvalInputs}. */
|
|
426
|
+
inputs: EvalInputs;
|
|
427
|
+
checks: EvalCheck[];
|
|
428
|
+
/** Creation timestamp (ms). */
|
|
429
|
+
createdAt: number;
|
|
430
|
+
/** Timestamp (ms) of the last change. */
|
|
431
|
+
updatedAt: number;
|
|
432
|
+
}
|
|
433
|
+
/** What `EvalProvider.createEval` takes. */
|
|
434
|
+
type NewEvalDefinition = Omit<EvalDefinition, "id" | "createdAt" | "updatedAt">;
|
|
435
|
+
/** What `EvalProvider.updateEval` takes: any of the definition's fields. */
|
|
436
|
+
type EvalDefinitionPatch = Partial<Omit<EvalDefinition, "id" | "createdAt" | "updatedAt">>;
|
|
437
|
+
/**
|
|
438
|
+
* Which prompt variant an arm runs. See `specs/evals.md` §C.
|
|
439
|
+
*
|
|
440
|
+
* - `head` — the working tree;
|
|
441
|
+
* - `wip` — the unsaved edits, frozen when the run starts;
|
|
442
|
+
* - `variation` — a named variation, rebased onto head when the run starts.
|
|
443
|
+
*/
|
|
444
|
+
type EvalArmSpec = {
|
|
445
|
+
kind: "head";
|
|
446
|
+
} | {
|
|
447
|
+
kind: "wip";
|
|
448
|
+
variation: VariationId;
|
|
449
|
+
} | {
|
|
450
|
+
kind: "variation";
|
|
451
|
+
variation: VariationId;
|
|
452
|
+
label?: string;
|
|
453
|
+
};
|
|
454
|
+
/** One arm of a run, as it was set up when the run started. */
|
|
455
|
+
interface EvalArm {
|
|
456
|
+
/** Stable within the run; results are keyed by it. */
|
|
457
|
+
id: string;
|
|
458
|
+
/** How the run view labels it: "Working tree", "Unsaved edits", a variation's name. */
|
|
459
|
+
label: string;
|
|
460
|
+
/** What was asked for. */
|
|
461
|
+
spec: EvalArmSpec;
|
|
462
|
+
/** What every row of this arm runs. Absent when {@link error} is set. */
|
|
463
|
+
ref?: PromptRef;
|
|
464
|
+
/** The frozen, rebased variation the arm's rows run, when it runs one. */
|
|
465
|
+
rebasedTo?: VariationId;
|
|
466
|
+
/** Why the arm didn't run — a rebase conflict, say. */
|
|
467
|
+
error?: string;
|
|
468
|
+
/** The conflicts, when {@link error} is a rebase conflict. */
|
|
469
|
+
conflicts?: VariationConflict[];
|
|
470
|
+
}
|
|
471
|
+
/** A run's lifecycle. */
|
|
472
|
+
type EvalRunStatus = "running" | "done" | "cancelled" | "error";
|
|
473
|
+
/** How a run's check results break down. */
|
|
474
|
+
interface EvalCounts {
|
|
475
|
+
pass: number;
|
|
476
|
+
fail: number;
|
|
477
|
+
error: number;
|
|
478
|
+
skipped: number;
|
|
479
|
+
/** Scores reported without a threshold, so neither pass nor fail. */
|
|
480
|
+
scored: number;
|
|
481
|
+
}
|
|
482
|
+
/** What `EvalProvider.createRun` takes. */
|
|
483
|
+
interface NewEvalRun {
|
|
484
|
+
/** The eval as it was when the run started — runs keep meaning what they measured. */
|
|
485
|
+
definition: EvalDefinition;
|
|
486
|
+
arms: EvalArm[];
|
|
487
|
+
/** The commit checked out at start, on a clean tree. */
|
|
488
|
+
startVersion?: VersionId;
|
|
489
|
+
/** Whether the working tree had uncommitted changes at start. */
|
|
490
|
+
dirty: boolean;
|
|
491
|
+
/** How many (arm, row) runs may be in flight at once. */
|
|
492
|
+
concurrency: number;
|
|
493
|
+
/** How many (arm, row) runs the run will make. */
|
|
494
|
+
total: number;
|
|
495
|
+
}
|
|
496
|
+
/** A run of an eval. */
|
|
497
|
+
interface EvalRun extends NewEvalRun {
|
|
498
|
+
id: string;
|
|
499
|
+
evalId: string;
|
|
500
|
+
status: EvalRunStatus;
|
|
501
|
+
/**
|
|
502
|
+
* Whether a row ran against a different version than the run started on —
|
|
503
|
+
* the working tree changed mid-run. See `specs/evals.md` §C.
|
|
504
|
+
*/
|
|
505
|
+
drifted: boolean;
|
|
506
|
+
/** Start timestamp (ms). */
|
|
507
|
+
startedAt: number;
|
|
508
|
+
/** End timestamp (ms), or `undefined` while running. */
|
|
509
|
+
endedAt?: number;
|
|
510
|
+
}
|
|
511
|
+
/** A run as listed: without its definition, with its counts. */
|
|
512
|
+
interface EvalRunSummary {
|
|
513
|
+
id: string;
|
|
514
|
+
evalId: string;
|
|
515
|
+
status: EvalRunStatus;
|
|
516
|
+
arms: Pick<EvalArm, "id" | "label" | "error">[];
|
|
517
|
+
startVersion?: VersionId;
|
|
518
|
+
dirty: boolean;
|
|
519
|
+
drifted: boolean;
|
|
520
|
+
startedAt: number;
|
|
521
|
+
endedAt?: number;
|
|
522
|
+
total: number;
|
|
523
|
+
/** How many (arm, row) runs have finished. */
|
|
524
|
+
done: number;
|
|
525
|
+
counts: EvalCounts;
|
|
526
|
+
}
|
|
527
|
+
/** Compact eval entry for listings (sidebar / `GET /api/evals`). */
|
|
528
|
+
interface EvalSummary {
|
|
529
|
+
providerId: string;
|
|
530
|
+
id: string;
|
|
531
|
+
name: string;
|
|
532
|
+
prompt: PromptID;
|
|
533
|
+
dataset: {
|
|
534
|
+
providerId: string;
|
|
535
|
+
id: string;
|
|
536
|
+
};
|
|
537
|
+
checkCount: number;
|
|
538
|
+
updatedAt: number;
|
|
539
|
+
/** The last run, when there's been one. */
|
|
540
|
+
lastRun?: Pick<EvalRunSummary, "id" | "status" | "startedAt" | "counts" | "total" | "done">;
|
|
541
|
+
}
|
|
542
|
+
/** How one (arm, row) run went. */
|
|
543
|
+
type EvalRowStatus = "ok" | "error" | "skipped";
|
|
544
|
+
/** One (arm, row) run's result. See `specs/evals.md` §E. */
|
|
545
|
+
interface EvalRowResult {
|
|
546
|
+
runId: string;
|
|
547
|
+
armId: string;
|
|
548
|
+
rowId: string;
|
|
549
|
+
/** Always 0 for now: the key is ready for running each row several times. */
|
|
550
|
+
sample: number;
|
|
551
|
+
/** The row's position in the dataset when the run started, from 0. */
|
|
552
|
+
rowIndex: number;
|
|
553
|
+
/** The row's cells as they were run — readable after the row is deleted. */
|
|
554
|
+
rowCells: Record<string, ExecutionInput>;
|
|
555
|
+
/**
|
|
556
|
+
* The row's own resource instances as they were run, receipts stripped —
|
|
557
|
+
* what `rowCells`' `instance` references named then, however the row has
|
|
558
|
+
* changed since. See `specs/resource-instances.md` §C.
|
|
559
|
+
*/
|
|
560
|
+
rowResources?: RunResources;
|
|
561
|
+
traceProviderId?: string;
|
|
562
|
+
traceId?: string;
|
|
563
|
+
/** The version the row ran against, on a clean tree. */
|
|
564
|
+
version?: VersionId;
|
|
565
|
+
/** The variation the row applied. */
|
|
566
|
+
variation?: VariationId;
|
|
567
|
+
status: EvalRowStatus;
|
|
568
|
+
/** Why the row errored or was skipped. */
|
|
569
|
+
error?: string;
|
|
570
|
+
/** Copied from the trace, so summaries needn't open it. */
|
|
571
|
+
costUsd?: number;
|
|
572
|
+
durationMs?: number;
|
|
573
|
+
/** The trace didn't finish arriving before the checks ran. */
|
|
574
|
+
traceIncomplete?: boolean;
|
|
575
|
+
}
|
|
576
|
+
/** How one check judged one (arm, row) run. See `specs/evals.md` §B.3. */
|
|
577
|
+
type EvalCheckOutcome = "pass" | "fail" | "error" | "skipped" | "scored";
|
|
578
|
+
/** One check's result for one (arm, row) run. */
|
|
579
|
+
interface EvalCheckResult {
|
|
580
|
+
runId: string;
|
|
581
|
+
armId: string;
|
|
582
|
+
rowId: string;
|
|
583
|
+
sample: number;
|
|
584
|
+
checkId: string;
|
|
585
|
+
outcome: EvalCheckOutcome;
|
|
586
|
+
score?: number;
|
|
587
|
+
message?: string;
|
|
588
|
+
details?: unknown;
|
|
589
|
+
durationMs?: number;
|
|
590
|
+
}
|
|
591
|
+
/** What `EvalProvider.listResults` returns. */
|
|
592
|
+
interface EvalResults {
|
|
593
|
+
rows: EvalRowResult[];
|
|
594
|
+
checks: EvalCheckResult[];
|
|
595
|
+
}
|
|
596
|
+
/** A check result, with enough of its run to say where it came from — for the trace view. */
|
|
597
|
+
interface TraceCheckResult extends EvalCheckResult {
|
|
598
|
+
evalId: string;
|
|
599
|
+
evalName: string;
|
|
600
|
+
/** The check's label as the run's definition had it. */
|
|
601
|
+
checkLabel: string;
|
|
602
|
+
armLabel: string;
|
|
603
|
+
}
|
|
604
|
+
/** A trace an eval run produced, with the run — see `EvalProvider.listTraceRuns`. */
|
|
605
|
+
interface EvalTraceRun extends Omit<TraceEvalRun, "providerId"> {
|
|
606
|
+
traceProviderId: string;
|
|
607
|
+
traceId: string;
|
|
608
|
+
}
|
|
609
|
+
/** The kind of change an {@link EvalChangeEvent} describes. */
|
|
610
|
+
type EvalChangeType = "add" | "update" | "remove";
|
|
611
|
+
/** Describes a single change emitted by `EvalProvider.watch`. */
|
|
612
|
+
interface EvalChangeEvent {
|
|
613
|
+
type: EvalChangeType;
|
|
614
|
+
evalId: string;
|
|
615
|
+
/** Set when the change was to a run of the eval. */
|
|
616
|
+
runId?: string;
|
|
617
|
+
}
|
|
618
|
+
/** Progress of a running eval, as the `eval-run` event carries it. See `specs/evals.md` §D.4. */
|
|
619
|
+
interface EvalRunProgress {
|
|
620
|
+
runId: string;
|
|
621
|
+
evalId: string;
|
|
622
|
+
providerId: string;
|
|
623
|
+
done: number;
|
|
624
|
+
total: number;
|
|
625
|
+
counts: EvalCounts;
|
|
626
|
+
status: EvalRunStatus;
|
|
627
|
+
}
|
|
628
|
+
/** Information about a registered eval provider. */
|
|
629
|
+
interface EvalProviderInfo {
|
|
630
|
+
id: string;
|
|
631
|
+
displayName?: string;
|
|
632
|
+
}
|
|
633
|
+
//#endregion
|
|
634
|
+
//#region src/shared/types.d.ts
|
|
635
|
+
/**
|
|
636
|
+
* Low-level prompt representation produced by a
|
|
637
|
+
* {@link PromptFileType}. It exposes the raw `extractedProps` from the parser
|
|
638
|
+
* and uses SDK-specific property names (e.g. `model`, `system`, `messages`).
|
|
639
|
+
*
|
|
640
|
+
* Not intended for public consumption — {@link PromptProvider} implementations
|
|
641
|
+
* convert this into a {@link NormalizedPrompt} via an {@link SDKAdapter} before
|
|
642
|
+
* returning it to callers.
|
|
643
|
+
*/
|
|
644
|
+
interface ParsedPrompt {
|
|
645
|
+
id: string;
|
|
646
|
+
providerId?: string;
|
|
647
|
+
/**
|
|
648
|
+
* Author-supplied stable alias for this prompt, globally unique across
|
|
649
|
+
* providers. Survives file moves/renames and is registered in the prompt
|
|
650
|
+
* registry so runtime traces can resolve back to this prompt.
|
|
651
|
+
*/
|
|
652
|
+
globalId?: string;
|
|
653
|
+
name: string;
|
|
654
|
+
functionParameters: PropDefinition$1[];
|
|
655
|
+
extractedProps: ExtractedProps;
|
|
656
|
+
metadata?: unknown;
|
|
657
|
+
treePath?: string[];
|
|
658
|
+
}
|
|
659
|
+
/**
|
|
660
|
+
* A single message in a conversation, in a form that is independent of any
|
|
661
|
+
* particular SDK's message shape.
|
|
662
|
+
*/
|
|
663
|
+
interface NormalizedMessage {
|
|
664
|
+
/** Role identifier (`'system'`, `'user'`, `'assistant'`, `'tool'`, …). */
|
|
665
|
+
role: string;
|
|
666
|
+
/** Message content. Typically a primitive or template string, but any
|
|
667
|
+
* {@link PropValue} is allowed so non-string content (e.g. structured
|
|
668
|
+
* content arrays) can round-trip through the editor. */
|
|
669
|
+
content: PropValue$1;
|
|
670
|
+
/** Optional tool calls attached to an assistant message. */
|
|
671
|
+
toolCalls?: NormalizedToolCall[];
|
|
672
|
+
}
|
|
673
|
+
/** A tool invocation emitted by an assistant message. */
|
|
674
|
+
interface NormalizedToolCall {
|
|
675
|
+
/** The name of the tool / function to invoke. */
|
|
676
|
+
toolName: string;
|
|
677
|
+
/** Arguments to the tool, as a JSON string. */
|
|
678
|
+
args: string;
|
|
679
|
+
}
|
|
680
|
+
/**
|
|
681
|
+
* A model parameter (`temperature`, `maxTokens`, …) attached to a prompt.
|
|
682
|
+
* Mirrors the `PropDefinition` + current value pair that the playground UI
|
|
683
|
+
* needs for rendering a parameter editor.
|
|
684
|
+
*/
|
|
685
|
+
interface NormalizedParameter {
|
|
686
|
+
/** Describes the parameter's name, type, and documentation. */
|
|
687
|
+
def: PropDefinition$1;
|
|
688
|
+
/** The parameter's current value, or `undefined` if not set on the prompt. */
|
|
689
|
+
value?: PropValue$1;
|
|
690
|
+
}
|
|
691
|
+
/**
|
|
692
|
+
* What every {@link NormalizedPrompt} has, whatever its {@link PromptStyle}.
|
|
693
|
+
*/
|
|
694
|
+
interface NormalizedPromptBase {
|
|
695
|
+
id: string;
|
|
696
|
+
providerId?: string;
|
|
697
|
+
/**
|
|
698
|
+
* Author-supplied stable alias for this prompt, globally unique across
|
|
699
|
+
* providers. Survives file moves/renames and is registered in the prompt
|
|
700
|
+
* registry so runtime traces can resolve back to this prompt.
|
|
701
|
+
*/
|
|
702
|
+
globalId?: string;
|
|
703
|
+
name: string;
|
|
704
|
+
functionParameters: PropDefinition$1[];
|
|
705
|
+
metadata?: unknown;
|
|
706
|
+
/**
|
|
707
|
+
* Controls where this prompt appears in the sidebar tree.
|
|
708
|
+
*
|
|
709
|
+
* Each element is a path segment. The last segment is treated as the leaf
|
|
710
|
+
* group label (analogous to a file name) and all preceding segments are
|
|
711
|
+
* rendered as collapsible directory nodes.
|
|
712
|
+
*
|
|
713
|
+
* Prompts that share the same `treePath` are grouped under the same leaf
|
|
714
|
+
* node. When omitted, the prompt is placed at the root level.
|
|
715
|
+
*
|
|
716
|
+
* @example ['src', 'prompts', 'greeting.prompt.ts']
|
|
717
|
+
*/
|
|
718
|
+
treePath?: string[];
|
|
719
|
+
/** The model reference (e.g. a provider call or gateway string). */
|
|
720
|
+
model?: PropValue$1;
|
|
721
|
+
/**
|
|
722
|
+
* Whether this SDK lets the model be chosen from the playground.
|
|
723
|
+
*
|
|
724
|
+
* A capability of the SDK, not a verdict on the current value: an editor
|
|
725
|
+
* also checks that the value itself has an editable shape (see
|
|
726
|
+
* `isEditable`), and renders read-only when either answer is no.
|
|
727
|
+
*/
|
|
728
|
+
modelEditable: boolean;
|
|
729
|
+
/**
|
|
730
|
+
* Model parameters currently set on the prompt (everything that isn't
|
|
731
|
+
* part of the style's own authored content).
|
|
732
|
+
*/
|
|
733
|
+
modelParameters: NormalizedParameter[];
|
|
734
|
+
/**
|
|
735
|
+
* False when the model parameters can't be changed here — a saved
|
|
736
|
+
* variation shown read-only, say. Absent means they can.
|
|
737
|
+
*/
|
|
738
|
+
modelParametersEditable?: boolean;
|
|
739
|
+
/**
|
|
740
|
+
* Named values the SDK needs to **execute** the config this prompt renders,
|
|
741
|
+
* supplied at run time rather than authored in the file.
|
|
742
|
+
*
|
|
743
|
+
* Distinct from {@link functionParameters}, which answers *what does this
|
|
744
|
+
* prompt take?* — this answers *what does running it require?*, which the
|
|
745
|
+
* function signature cannot express. The Vercel AI SDK's `toolsContext` is
|
|
746
|
+
* the motivating case: tools that declare a `contextSchema` need a context
|
|
747
|
+
* object the prompt function never sees.
|
|
748
|
+
*
|
|
749
|
+
* Absent when the prompt needs nothing beyond its arguments. Present with an
|
|
750
|
+
* unresolved type when the requirement is known but its shape is not — a
|
|
751
|
+
* usable state, and better than the silent failure at the first tool call
|
|
752
|
+
* that omitting it would produce.
|
|
753
|
+
*/
|
|
754
|
+
executeParameters?: PropDefinition$1[];
|
|
755
|
+
/**
|
|
756
|
+
* Non-authored sources that can fill this prompt's input slots — currently
|
|
757
|
+
* code-defined resources. Absent when the provider offers none.
|
|
758
|
+
*/
|
|
759
|
+
inputSources?: PromptInputSources;
|
|
760
|
+
/**
|
|
761
|
+
* Slot path → how to lay out a fan-out slot's fields in the execute panel.
|
|
762
|
+
* Any path not named here uses `"expanded"`.
|
|
763
|
+
*
|
|
764
|
+
* Set by an {@link SDKAdapter} whose own API shape is the reason a slot
|
|
765
|
+
* fans out — e.g. the Vercel AI SDK's `toolsContext`, which is keyed per
|
|
766
|
+
* tool because tools are resolved individually, not because prompt authors
|
|
767
|
+
* think in terms of separate contexts. Mirrors the `functionSlots` /
|
|
768
|
+
* `executeSlots` split on {@link PromptInputSources}, which exists for the
|
|
769
|
+
* same reason: a function parameter and an execute parameter may share a
|
|
770
|
+
* name.
|
|
771
|
+
*/
|
|
772
|
+
inputLayout?: {
|
|
773
|
+
functionSlots?: Record<string, InputLayout>;
|
|
774
|
+
executeSlots?: Record<string, InputLayout>;
|
|
775
|
+
};
|
|
776
|
+
/**
|
|
777
|
+
* Where this prompt was read from. Absent when the provider has no notion
|
|
778
|
+
* of versions, in which case the prompt is always head.
|
|
779
|
+
*/
|
|
780
|
+
ref?: PromptRef;
|
|
781
|
+
/** The base version, when {@link ref} is a version or a variation. */
|
|
782
|
+
version?: VersionInfo;
|
|
783
|
+
/** The variation, when {@link ref} names one. */
|
|
784
|
+
variation?: VariationInfo;
|
|
785
|
+
/**
|
|
786
|
+
* True when a WIP variation exists for this prompt at head — the dirty
|
|
787
|
+
* indicator. Reported on the head prompt, whatever ref is open.
|
|
788
|
+
*/
|
|
789
|
+
dirty?: boolean;
|
|
790
|
+
/** The id of the head WIP variation, when {@link dirty}. */
|
|
791
|
+
wipId?: VariationId;
|
|
792
|
+
/**
|
|
793
|
+
* True when this prompt's base is the working tree, so it can run. False
|
|
794
|
+
* for an old version, or a variation made against one.
|
|
795
|
+
*/
|
|
796
|
+
atHead?: boolean;
|
|
797
|
+
}
|
|
798
|
+
/**
|
|
799
|
+
* An opaque, immutable name for a state of the world — for a git project, a
|
|
800
|
+
* commit.
|
|
801
|
+
*/
|
|
802
|
+
type VersionId = string;
|
|
803
|
+
/** An opaque id for a {@link VariationInfo | variation}. */
|
|
804
|
+
type VariationId = string;
|
|
805
|
+
/**
|
|
806
|
+
* Which prompt, in which state.
|
|
807
|
+
*
|
|
808
|
+
* A variation already knows its base, so `{ variation }` is complete. There is
|
|
809
|
+
* deliberately no `{ version, variation }` pair: that is a rebase, which
|
|
810
|
+
* produces a new variation with its own id.
|
|
811
|
+
*/
|
|
812
|
+
type PromptRef = /** Head: the prompt as it is on disk now. */{
|
|
813
|
+
promptId: string;
|
|
814
|
+
version?: undefined;
|
|
815
|
+
variation?: undefined;
|
|
816
|
+
} /** The prompt as it was at a saved version. */ | {
|
|
817
|
+
promptId: string;
|
|
818
|
+
version: VersionId;
|
|
819
|
+
variation?: undefined;
|
|
820
|
+
} /** A variation, applied to its base commit (or the working tree, without one). */ | {
|
|
821
|
+
promptId: string;
|
|
822
|
+
variation: VariationId;
|
|
823
|
+
version?: undefined;
|
|
824
|
+
};
|
|
825
|
+
/** A saved state of the world: a commit. See {@link VersionId}. */
|
|
826
|
+
interface VersionInfo {
|
|
827
|
+
id: VersionId;
|
|
828
|
+
/** Commit subject. */
|
|
829
|
+
message?: string;
|
|
830
|
+
author?: string;
|
|
831
|
+
/** When the version was made (ms). */
|
|
832
|
+
time: number;
|
|
833
|
+
}
|
|
834
|
+
/**
|
|
835
|
+
* A prompt's field values, keyed like a variation's fields (`system`,
|
|
836
|
+
* `modelParameters.temperature`, …) — `null` for a field the prompt doesn't
|
|
837
|
+
* have.
|
|
838
|
+
*/
|
|
839
|
+
type FieldValues = Record<string, unknown>;
|
|
840
|
+
/**
|
|
841
|
+
* One field that could not be merged: both sides changed it, differently.
|
|
842
|
+
* `field` is `"system"`, `"modelParameters.temperature"`, or the pseudo-field
|
|
843
|
+
* `"prompt"` when the prompt itself no longer exists at the target.
|
|
844
|
+
*/
|
|
845
|
+
interface VariationConflict {
|
|
846
|
+
field: string;
|
|
847
|
+
/** The value both sides started from. */
|
|
848
|
+
base: unknown;
|
|
849
|
+
/** The value on the side being merged into (head, or the unsaved edits). */
|
|
850
|
+
target: unknown;
|
|
851
|
+
/** The value the variation wants. */
|
|
852
|
+
variation: unknown;
|
|
853
|
+
}
|
|
854
|
+
/**
|
|
855
|
+
* Conflicts a WIP variation is waiting on the user to resolve. While present,
|
|
856
|
+
* the WIP can neither run nor be saved.
|
|
857
|
+
*/
|
|
858
|
+
interface PendingConflicts {
|
|
859
|
+
/**
|
|
860
|
+
* The working tree's values for every field involved, as they were when
|
|
861
|
+
* the conflict arose: what the resolved WIP is based on.
|
|
862
|
+
*/
|
|
863
|
+
targetValues: FieldValues;
|
|
864
|
+
/** Every field that did merge, already applied. */
|
|
865
|
+
updates: NormalizedPromptUpdates;
|
|
866
|
+
conflicts: VariationConflict[];
|
|
867
|
+
/** How to label each side in the UI. */
|
|
868
|
+
labels: {
|
|
869
|
+
target: string;
|
|
870
|
+
variation: string;
|
|
871
|
+
};
|
|
872
|
+
}
|
|
873
|
+
/**
|
|
874
|
+
* An immutable set of {@link NormalizedPromptUpdates} for one prompt — or,
|
|
875
|
+
* when {@link wip}, the one mutable set of unsaved edits per (prompt, base).
|
|
876
|
+
* It applies to the working tree; its {@link base} commit, when it has one,
|
|
877
|
+
* is where it can also be shown (and one day run) as it was made.
|
|
878
|
+
*/
|
|
879
|
+
interface VariationInfo {
|
|
880
|
+
id: VariationId;
|
|
881
|
+
promptId: string;
|
|
882
|
+
/**
|
|
883
|
+
* The commit whose copy of the prompt's file the variation was made
|
|
884
|
+
* against. Absent when that file had uncommitted changes (or there's no
|
|
885
|
+
* git), and for a WIP of unsaved edits to the working tree.
|
|
886
|
+
*/
|
|
887
|
+
base?: VersionId;
|
|
888
|
+
updates: NormalizedPromptUpdates;
|
|
889
|
+
/** Whether this is a work-in-progress (unsaved, mutable) variation. */
|
|
890
|
+
wip: boolean;
|
|
891
|
+
/** For a WIP: whether it holds the unsaved edits to head. */
|
|
892
|
+
onHead?: boolean;
|
|
893
|
+
/** Names pointing at this variation. */
|
|
894
|
+
names: string[];
|
|
895
|
+
/** For a WIP opened from a named variation: that name. */
|
|
896
|
+
originName?: string;
|
|
897
|
+
/** For a WIP: conflicts awaiting resolution. */
|
|
898
|
+
pending?: PendingConflicts;
|
|
899
|
+
createdAt: number;
|
|
900
|
+
updatedAt: number;
|
|
901
|
+
}
|
|
902
|
+
/** What rebasing or merging a variation produced. */
|
|
903
|
+
type RebaseResult = {
|
|
904
|
+
ok: true;
|
|
905
|
+
variation: VariationInfo;
|
|
906
|
+
} | {
|
|
907
|
+
ok: false;
|
|
908
|
+
conflicts: VariationConflict[]; /** How to label each side of the conflicts in the UI. */
|
|
909
|
+
labels?: {
|
|
910
|
+
target: string;
|
|
911
|
+
variation: string;
|
|
912
|
+
};
|
|
913
|
+
};
|
|
914
|
+
/**
|
|
915
|
+
* How to resolve each of a WIP's {@link PendingConflicts}, keyed by field:
|
|
916
|
+
* keep the target's value, or the variation's.
|
|
917
|
+
*/
|
|
918
|
+
type ConflictChoices = Record<string, "target" | "variation">;
|
|
919
|
+
/**
|
|
920
|
+
* Which kind of editor a prompt is authored in. Chosen by the
|
|
921
|
+
* {@link SDKAdapter}, since it is the SDK's request shape that decides it.
|
|
922
|
+
*
|
|
923
|
+
* A closed set: the client is a prebuilt bundle, so an adapter picks among
|
|
924
|
+
* the editors it has rather than shipping its own.
|
|
925
|
+
*/
|
|
926
|
+
type PromptStyle = NormalizedPrompt["style"];
|
|
927
|
+
/** A model driven by a system message and a conversation. */
|
|
928
|
+
interface NormalizedChatPrompt extends NormalizedPromptBase {
|
|
929
|
+
style: "chat";
|
|
930
|
+
/** Top-level system prompt, if the SDK supports one. */
|
|
931
|
+
system?: PropValue$1;
|
|
932
|
+
/** Whether this SDK supports an arbitrary system message. */
|
|
933
|
+
systemEditable: boolean;
|
|
934
|
+
/** Conversation messages. */
|
|
935
|
+
messages: NormalizedMessage[];
|
|
936
|
+
/** Whether this SDK supports an arbitrary message list. */
|
|
937
|
+
messagesEditable: boolean;
|
|
938
|
+
}
|
|
939
|
+
/** A model that answers a set of named questions about a state. */
|
|
940
|
+
interface NormalizedQuestionsPrompt extends NormalizedPromptBase {
|
|
941
|
+
style: "questions";
|
|
942
|
+
/** What the questions are asked about. `def` is the SDK's state type. */
|
|
943
|
+
state: NormalizedParameter;
|
|
944
|
+
/** Whether this SDK supports an arbitrary state. */
|
|
945
|
+
stateEditable: boolean;
|
|
946
|
+
/**
|
|
947
|
+
* The questions, as one value: an object whose property names are question
|
|
948
|
+
* ids. `def` is the SDK's type for the whole collection — a `record` whose
|
|
949
|
+
* value definition carries a catalog of question factories.
|
|
950
|
+
*/
|
|
951
|
+
questions: NormalizedParameter;
|
|
952
|
+
/** Whether this SDK supports adding, removing and editing questions. */
|
|
953
|
+
questionsEditable: boolean;
|
|
954
|
+
}
|
|
955
|
+
/**
|
|
956
|
+
* Prompt representation used by {@link PromptProvider} public methods and by
|
|
957
|
+
* the playground UI. It hides SDK-specific property names behind a stable
|
|
958
|
+
* shape, discriminated by {@link PromptStyle}.
|
|
959
|
+
*
|
|
960
|
+
* {@link SDKAdapter.normalizePrompt} converts a {@link ParsedPrompt} produced
|
|
961
|
+
* by a {@link PromptFileType} into this form.
|
|
962
|
+
*/
|
|
963
|
+
type NormalizedPrompt = NormalizedChatPrompt | NormalizedQuestionsPrompt;
|
|
964
|
+
/** How a fan-out slot's fields are laid out in the execute panel. */
|
|
965
|
+
type InputLayout = "combined" | "expanded";
|
|
966
|
+
/** How long a resource's value lives, and how often `create()` runs. */
|
|
967
|
+
type ResourceScope = "run" | "server";
|
|
968
|
+
/**
|
|
969
|
+
* A code-defined resource offered as an input source, as the UI sees it.
|
|
970
|
+
*
|
|
971
|
+
* The resource's *value* never crosses the wire — the whole point is that only
|
|
972
|
+
* running code can produce it — so this is just enough to render a chip and
|
|
973
|
+
* send the choice back as an {@link ExecutionInput}.
|
|
974
|
+
*/
|
|
975
|
+
interface ResourceInfo {
|
|
976
|
+
/**
|
|
977
|
+
* Provider-interpreted reference to this resource, relative to the
|
|
978
|
+
* provider's root so it stays valid on another machine (e.g.
|
|
979
|
+
* `.evalution/playground/db.ts#db`).
|
|
980
|
+
*/
|
|
981
|
+
uri: string;
|
|
982
|
+
/** Human-readable label shown on the chip. */
|
|
983
|
+
label: string;
|
|
984
|
+
/** How long the created value lives. See {@link ResourceScope}. */
|
|
985
|
+
scope: ResourceScope;
|
|
986
|
+
/**
|
|
987
|
+
* Why this resource is unavailable, if it is — typically its module threw
|
|
988
|
+
* at import time. Surfaced in the panel rather than hidden, so a broken
|
|
989
|
+
* playground module is visible instead of silently absent.
|
|
990
|
+
*/
|
|
991
|
+
error?: string;
|
|
992
|
+
/**
|
|
993
|
+
* A snapshot of the resource's current value, so the panel can preview it
|
|
994
|
+
* instead of just naming it. Present only when the server already has an
|
|
995
|
+
* instance to peek at — a static `value` resource, or a `scope: 'server'`
|
|
996
|
+
* one it has already created — and that instance's value is plain JSON
|
|
997
|
+
* data. A run-scoped resource, or one whose value isn't plain data (a live
|
|
998
|
+
* handle), has nothing here; the chip is all there is to show.
|
|
999
|
+
*/
|
|
1000
|
+
value?: unknown;
|
|
1001
|
+
/**
|
|
1002
|
+
* Group path this source is displayed under, outermost first. Absent means
|
|
1003
|
+
* top level. Purely display metadata — never part of {@link uri} — so
|
|
1004
|
+
* renaming a group invalidates no saved selection. See
|
|
1005
|
+
* `specs/resource-hierarchy.md` §B.
|
|
1006
|
+
*/
|
|
1007
|
+
group?: string[];
|
|
1008
|
+
/**
|
|
1009
|
+
* For a value source (one read off another resource): the `uri` of the
|
|
1010
|
+
* resource it is read from. Absent for the resource itself.
|
|
1011
|
+
*/
|
|
1012
|
+
parent?: string;
|
|
1013
|
+
/**
|
|
1014
|
+
* For a value source: how many values that resource exposes in total,
|
|
1015
|
+
* before slot matching narrows them down for a particular slot. Only the
|
|
1016
|
+
* provider can supply this — after filtering, the panel cannot tell "this
|
|
1017
|
+
* resource exposes one value" from "it exposes five and four don't fit
|
|
1018
|
+
* here", and those read differently once a submenu collapses to its one
|
|
1019
|
+
* remaining entry.
|
|
1020
|
+
*/
|
|
1021
|
+
siblings?: number;
|
|
1022
|
+
/**
|
|
1023
|
+
* The resource's declared arguments, as slots for the panel to render —
|
|
1024
|
+
* one per schema-valued entry of its `inputs`, in declaration order.
|
|
1025
|
+
* Absent when the resource takes none. Present with an unresolved (generic
|
|
1026
|
+
* string) editor when the requirement is known but its shape is not —
|
|
1027
|
+
* the checker-less degradation, same idiom as
|
|
1028
|
+
* {@link NormalizedPrompt.executeParameters}.
|
|
1029
|
+
*
|
|
1030
|
+
* Only the resource itself carries this — a value source (`parent` set)
|
|
1031
|
+
* shares its root resource's arguments rather than repeating them. See
|
|
1032
|
+
* `specs/resource-arguments.md` §G.
|
|
1033
|
+
*/
|
|
1034
|
+
parameters?: PropDefinition$1[];
|
|
1035
|
+
/**
|
|
1036
|
+
* The resource's code-wired dependencies — its resource-valued `inputs`
|
|
1037
|
+
* entries — as input name → the dependency's {@link uri}. Only the
|
|
1038
|
+
* resource itself carries this, and only for dependencies discovery
|
|
1039
|
+
* registered. The panel lists them in its Resources section. See
|
|
1040
|
+
* `specs/resource-instances.md` §D.
|
|
1041
|
+
*/
|
|
1042
|
+
dependencies?: Record<string, string>;
|
|
1043
|
+
}
|
|
1044
|
+
/**
|
|
1045
|
+
* Which non-authored sources can fill which of a prompt's input slots.
|
|
1046
|
+
*
|
|
1047
|
+
* Matching runs provider-side, where the checker lives (see
|
|
1048
|
+
* `matchResourcesToSlots`), and ships as slot paths so the panel can offer a
|
|
1049
|
+
* source without re-deriving the rules.
|
|
1050
|
+
*/
|
|
1051
|
+
interface PromptInputSources {
|
|
1052
|
+
/** Every resource in scope for this prompt, identified by `uri`. */
|
|
1053
|
+
resources: ResourceInfo[];
|
|
1054
|
+
/**
|
|
1055
|
+
* Dotted slot path within {@link NormalizedPrompt.functionParameters}
|
|
1056
|
+
* (`taskId`, `ctx.db`) → URIs of the resources that can fill it.
|
|
1057
|
+
*/
|
|
1058
|
+
functionSlots: Record<string, string[]>;
|
|
1059
|
+
/**
|
|
1060
|
+
* Dotted slot path within {@link NormalizedPrompt.executeParameters}
|
|
1061
|
+
* (`toolsContext.list_tasks.db`) → URIs of the resources that can fill it.
|
|
1062
|
+
*/
|
|
1063
|
+
executeSlots: Record<string, string[]>;
|
|
1064
|
+
/**
|
|
1065
|
+
* Resource URI → (argument slot path → URIs of sources that can fill it).
|
|
1066
|
+
*
|
|
1067
|
+
* Separate from {@link functionSlots} / {@link executeSlots} and keyed by
|
|
1068
|
+
* URI rather than folded into the slot path, because an argument slot is a
|
|
1069
|
+
* property of the *resource*, not of the prompt: the same resource offers
|
|
1070
|
+
* the same arguments in every prompt that can see it. Absent when no
|
|
1071
|
+
* resource in scope declares arguments. See
|
|
1072
|
+
* `specs/resource-arguments.md` §G.
|
|
1073
|
+
*/
|
|
1074
|
+
resourceSlots?: Record<string, Record<string, string[]>>;
|
|
1075
|
+
}
|
|
1076
|
+
/**
|
|
1077
|
+
* One prompt input, *before* resolution — the recipe rather than the value.
|
|
1078
|
+
*
|
|
1079
|
+
* The panel sends these instead of concrete JSON because a resource reference
|
|
1080
|
+
* cannot survive a JSON round trip: its value doesn't exist until the run
|
|
1081
|
+
* creates it. Every variant is JSON-safe by construction, which is also what
|
|
1082
|
+
* lets a trace record what it ran with and replay it (see `PromptSpanInfo`).
|
|
1083
|
+
*/
|
|
1084
|
+
type ExecutionInput = /** A value typed into the panel. */{
|
|
1085
|
+
kind: "value";
|
|
1086
|
+
value: PropValue$1;
|
|
1087
|
+
}
|
|
1088
|
+
/**
|
|
1089
|
+
* An object assembled from per-property inputs, so a resource can fill one
|
|
1090
|
+
* field of an otherwise hand-edited object — `toolsContext`'s `db` beside
|
|
1091
|
+
* its typed-in ids. Only objects nest: an array of resources isn't a case
|
|
1092
|
+
* any slot has yet.
|
|
1093
|
+
*/
|
|
1094
|
+
| {
|
|
1095
|
+
kind: "object";
|
|
1096
|
+
properties: Record<string, ExecutionInput>;
|
|
1097
|
+
}
|
|
1098
|
+
/**
|
|
1099
|
+
* One of the run's named resource instances ({@link RunResources}), or one
|
|
1100
|
+
* of its outputs — created by the provider at run time, once per run
|
|
1101
|
+
* however many places name it. See `specs/resource-instances.md` §A.
|
|
1102
|
+
*/
|
|
1103
|
+
| {
|
|
1104
|
+
kind: "instance"; /** The instance's name in the run's {@link RunResources}. */
|
|
1105
|
+
name: string; /** A top-level output of its value (`taskId`). Absent for the value itself. */
|
|
1106
|
+
output?: string;
|
|
1107
|
+
}
|
|
1108
|
+
/**
|
|
1109
|
+
* A cell of the dataset row being run, by `DatasetField.id`. Only
|
|
1110
|
+
* meaningful in an eval run, where the row is implicit; anywhere else it
|
|
1111
|
+
* fails with a message that says so. The cell may itself hold a resource
|
|
1112
|
+
* or an object, and resolves recursively. See `specs/evals.md` §B.2.
|
|
1113
|
+
*/
|
|
1114
|
+
| {
|
|
1115
|
+
kind: "dataset";
|
|
1116
|
+
field: string;
|
|
1117
|
+
}
|
|
1118
|
+
/**
|
|
1119
|
+
* Whatever the same run bound to one of the prompt's own slots, resolved
|
|
1120
|
+
* in the run's lease — so a resource comes back as the same instance, and
|
|
1121
|
+
* two slots can say they hold the same id rather than repeat one recipe.
|
|
1122
|
+
* Works anywhere a run is assembled: the execute panel and an eval alike.
|
|
1123
|
+
* See `specs/evals.md` §B.2.
|
|
1124
|
+
*/
|
|
1125
|
+
| {
|
|
1126
|
+
kind: "input"; /** Which half of the prompt's slots `path` is in. */
|
|
1127
|
+
half: "function" | "execute"; /** The dotted slot path (`taskId`, `toolsContext.list_tasks.db`). */
|
|
1128
|
+
path: string;
|
|
1129
|
+
};
|
|
1130
|
+
/**
|
|
1131
|
+
* One code-defined resource instance a run creates, whether or not any slot
|
|
1132
|
+
* reads it — the run's resources are the instances it declares, by name. See
|
|
1133
|
+
* `specs/resource-instances.md` §A.
|
|
1134
|
+
*/
|
|
1135
|
+
interface ResourceInstanceInput {
|
|
1136
|
+
/** The resource's root {@link ResourceInfo.uri} — never an output's. */
|
|
1137
|
+
uri: string;
|
|
1138
|
+
/**
|
|
1139
|
+
* Values for the resource's declared arguments, by parameter name. Absent
|
|
1140
|
+
* when it takes none. Recursive — an argument may be a typed-in value, an
|
|
1141
|
+
* object, another instance's output, a dataset cell, or another slot.
|
|
1142
|
+
*/
|
|
1143
|
+
args?: Record<string, ExecutionInput>;
|
|
1144
|
+
/**
|
|
1145
|
+
* What this instance's `create()` produced. Recorded on every run (never
|
|
1146
|
+
* sent by the panel); sent back only by a replay, so `create` can
|
|
1147
|
+
* reconstruct rather than re-mint. See `specs/resource-arguments.md` §E.
|
|
1148
|
+
*/
|
|
1149
|
+
receipt?: unknown;
|
|
1150
|
+
}
|
|
1151
|
+
/**
|
|
1152
|
+
* A run's named resource instances, by name — `[A-Za-z_][A-Za-z0-9_-]*`.
|
|
1153
|
+
* Every one is created when the run starts, and {@link ExecutionInput}s of
|
|
1154
|
+
* kind `instance` refer to them by name.
|
|
1155
|
+
*/
|
|
1156
|
+
type RunResources = Record<string, ResourceInstanceInput>;
|
|
1157
|
+
/**
|
|
1158
|
+
* What the client knows about a check — a playground export made with
|
|
1159
|
+
* `check()`, or a built-in from `evalution/checks`. See `specs/evals.md`
|
|
1160
|
+
* §B.4.
|
|
1161
|
+
*/
|
|
1162
|
+
interface CheckInfo {
|
|
1163
|
+
/** `<module>#<export>`, or `evalution/checks#<name>` for a built-in. */
|
|
1164
|
+
uri: string;
|
|
1165
|
+
/** Human-readable label. Defaults to the export name. */
|
|
1166
|
+
label: string;
|
|
1167
|
+
/** Display group, `/`-separated for nesting. Built-ins are `Built-in`. */
|
|
1168
|
+
group?: string;
|
|
1169
|
+
description?: string;
|
|
1170
|
+
/**
|
|
1171
|
+
* The schema-valued inputs, as the probe resolved them, in declaration
|
|
1172
|
+
* order. Resource inputs are bound in code and not listed.
|
|
1173
|
+
*/
|
|
1174
|
+
parameters: PropDefinition$1[];
|
|
1175
|
+
/** Whether the check still runs when the prompt run itself errored. */
|
|
1176
|
+
runsOnError?: boolean;
|
|
1177
|
+
/** Set when the module failed to load or the definition is invalid. */
|
|
1178
|
+
error?: string;
|
|
1179
|
+
}
|
|
1180
|
+
/** Updates to a {@link NormalizedChatPrompt}. `null` removes a field. */
|
|
1181
|
+
interface ChatPromptUpdates {
|
|
1182
|
+
style: "chat";
|
|
1183
|
+
model?: PropValue$1 | null;
|
|
1184
|
+
system?: PropValue$1 | null;
|
|
1185
|
+
messages?: NormalizedMessage[] | null;
|
|
1186
|
+
/** Per-parameter updates, keyed by parameter name. `null` removes. */
|
|
1187
|
+
modelParameters?: Record<string, PropValue$1 | null>;
|
|
1188
|
+
}
|
|
1189
|
+
/** Updates to a {@link NormalizedQuestionsPrompt}. `null` removes a field. */
|
|
1190
|
+
interface QuestionsPromptUpdates {
|
|
1191
|
+
style: "questions";
|
|
1192
|
+
model?: PropValue$1 | null;
|
|
1193
|
+
state?: PropValue$1 | null;
|
|
1194
|
+
questions?: PropValue$1 | null;
|
|
1195
|
+
/** Per-parameter updates, keyed by parameter name. `null` removes. */
|
|
1196
|
+
modelParameters?: Record<string, PropValue$1 | null>;
|
|
1197
|
+
}
|
|
1198
|
+
/**
|
|
1199
|
+
* Updates that can be applied to a {@link NormalizedPrompt} via
|
|
1200
|
+
* {@link PromptProvider.updatePromptProperties}, in the vocabulary of the
|
|
1201
|
+
* prompt's {@link PromptStyle}. A value of `null` removes that field from the
|
|
1202
|
+
* underlying source.
|
|
1203
|
+
*/
|
|
1204
|
+
type NormalizedPromptUpdates = ChatPromptUpdates | QuestionsPromptUpdates;
|
|
1205
|
+
/** The kind of change that occurred to a prompt. */
|
|
1206
|
+
type ChangeEventType = "change" | "add" | "remove";
|
|
1207
|
+
/**
|
|
1208
|
+
* Describes a single change emitted by {@link PromptProvider.watch}.
|
|
1209
|
+
*/
|
|
1210
|
+
interface PromptChangeEvent {
|
|
1211
|
+
/** Whether the prompt was added, modified, or removed. */
|
|
1212
|
+
type: ChangeEventType;
|
|
1213
|
+
/** The ID of the affected prompt ({@link ParsedPrompt.id}) */
|
|
1214
|
+
promptId: string;
|
|
1215
|
+
/**
|
|
1216
|
+
* Which state of the prompt changed, when it was a variation rather than the
|
|
1217
|
+
* source — a WIP edit, or a WIP rebased after an external edit.
|
|
1218
|
+
*/
|
|
1219
|
+
ref?: PromptRef;
|
|
1220
|
+
}
|
|
1221
|
+
/** Describes a single form field rendered by the Add Prompt dialog. */
|
|
1222
|
+
interface AddPromptField {
|
|
1223
|
+
/** Key used to identify this field's value (e.g. `'name'`). */
|
|
1224
|
+
name: string;
|
|
1225
|
+
/** Human-readable label shown next to the input. */
|
|
1226
|
+
label: string;
|
|
1227
|
+
/** The kind of input control to render. */
|
|
1228
|
+
type: "text" | "select";
|
|
1229
|
+
/** Whether the field must be filled before submission. */
|
|
1230
|
+
required?: boolean;
|
|
1231
|
+
/** Pre-filled value. */
|
|
1232
|
+
defaultValue?: string;
|
|
1233
|
+
/** Placeholder text shown when the field is empty. */
|
|
1234
|
+
placeholder?: string;
|
|
1235
|
+
/** Available choices when `type` is `'select'`. */
|
|
1236
|
+
options?: {
|
|
1237
|
+
label: string;
|
|
1238
|
+
value: string;
|
|
1239
|
+
}[];
|
|
1240
|
+
}
|
|
1241
|
+
/**
|
|
1242
|
+
* Returned by {@link PromptProvider.addPrompt} when additional user input is
|
|
1243
|
+
* needed before the prompt can be created.
|
|
1244
|
+
*/
|
|
1245
|
+
interface AddPromptContext {
|
|
1246
|
+
/** The form fields the provider needs the user to fill in. */
|
|
1247
|
+
fields: AddPromptField[];
|
|
1248
|
+
}
|
|
1249
|
+
/** Information about a registered provider, returned by `GET /api/providers`. */
|
|
1250
|
+
interface PromptProviderInfo {
|
|
1251
|
+
id: string;
|
|
1252
|
+
displayName?: string;
|
|
1253
|
+
description?: string;
|
|
1254
|
+
icon?: string;
|
|
1255
|
+
hasAddPrompt: boolean;
|
|
1256
|
+
/** Whether the provider can name versions of its prompts. */
|
|
1257
|
+
hasVersions?: boolean;
|
|
1258
|
+
/** Whether the provider holds edits apart from the source (see `PromptProvider.variations`). */
|
|
1259
|
+
hasVariations?: boolean;
|
|
1260
|
+
}
|
|
1261
|
+
/**
|
|
1262
|
+
* Request body of `POST /api/prompts/:providerId/:id/execute`.
|
|
1263
|
+
*
|
|
1264
|
+
* Inputs arrive *unresolved*: the server resolves them (creating resources,
|
|
1265
|
+
* materializing values) immediately before calling
|
|
1266
|
+
* {@link PromptProvider.execute}. See {@link ExecutionInput}.
|
|
1267
|
+
*/
|
|
1268
|
+
interface ExecuteRequest {
|
|
1269
|
+
/** Positional, one per {@link NormalizedPrompt.functionParameters} entry. */
|
|
1270
|
+
functionInputs?: ExecutionInput[];
|
|
1271
|
+
/** By name, keyed on {@link NormalizedPrompt.executeParameters} entries. */
|
|
1272
|
+
executeInputs?: Record<string, ExecutionInput>;
|
|
1273
|
+
/** The run's named resource instances. See {@link RunResources}. */
|
|
1274
|
+
resources?: RunResources;
|
|
1275
|
+
}
|
|
1276
|
+
/**
|
|
1277
|
+
* Response body of `POST /api/prompts/:providerId/:id/execute`.
|
|
1278
|
+
*
|
|
1279
|
+
* The endpoint returns immediately after the trace has been registered; the
|
|
1280
|
+
* real output is streamed as span events via
|
|
1281
|
+
* `GET /api/traces/:tracerProviderId/:traceId/events`.
|
|
1282
|
+
*/
|
|
1283
|
+
interface ExecuteResponse {
|
|
1284
|
+
/** ID of the trace that tracks this execution. */
|
|
1285
|
+
traceId: string;
|
|
1286
|
+
/** ID of the trace provider that owns the trace. */
|
|
1287
|
+
tracerProviderId: string;
|
|
1288
|
+
/** Span ID of the root span for this execution. */
|
|
1289
|
+
rootSpanId: string;
|
|
1290
|
+
/** The version the run executed against, when the provider has versions. */
|
|
1291
|
+
version?: VersionId;
|
|
1292
|
+
/** The variation the run applied, if any. */
|
|
1293
|
+
variation?: VariationId;
|
|
1294
|
+
}
|
|
1295
|
+
/** Response body of `POST /api/prompts/:providerId/:id/update`. */
|
|
1296
|
+
interface UpdatePromptResponse {
|
|
1297
|
+
/** The prompt as the updates left it. */
|
|
1298
|
+
prompt: NormalizedPrompt;
|
|
1299
|
+
/** Where the updates landed — adopt it as the editor's ref. */
|
|
1300
|
+
ref: PromptRef;
|
|
1301
|
+
}
|
|
1302
|
+
//#endregion
|
|
1303
|
+
//#region src/shared/column-paths.d.ts
|
|
1304
|
+
/** Where a column reads from in a row. */
|
|
1305
|
+
interface ColumnPath {
|
|
1306
|
+
/** A field's cell, or one of the row's resource instances by name. */
|
|
1307
|
+
root: {
|
|
1308
|
+
field: string;
|
|
1309
|
+
} | {
|
|
1310
|
+
instance: string;
|
|
1311
|
+
};
|
|
1312
|
+
/** Steps inward, by name. Empty for the root itself. */
|
|
1313
|
+
keys: string[];
|
|
1314
|
+
}
|
|
1315
|
+
/**
|
|
1316
|
+
* One column of a dataset's layout (`Dataset.columns`), discriminated by `kind`. Kinds
|
|
1317
|
+
* this version doesn't know (a newer client's) are stored and served as they
|
|
1318
|
+
* were written — see {@link ForeignColumnSpec}.
|
|
1319
|
+
*/
|
|
1320
|
+
type DatasetColumnSpec = KnownColumnSpec | ForeignColumnSpec;
|
|
1321
|
+
/** A column of the layout whose `kind` this version knows. */
|
|
1322
|
+
type KnownColumnSpec = {
|
|
1323
|
+
kind: "path";
|
|
1324
|
+
path: ColumnPath; /** Shown instead of the path's last key. */
|
|
1325
|
+
title?: string;
|
|
1326
|
+
hidden?: true; /** Added from the picker, as opposed to derived from a field or one of its keys. */
|
|
1327
|
+
added?: true;
|
|
1328
|
+
} /** Where the row came from. Moved and hidden like any column, but never removed. */ | {
|
|
1329
|
+
kind: "source";
|
|
1330
|
+
hidden?: true;
|
|
1331
|
+
};
|
|
1332
|
+
/**
|
|
1333
|
+
* A column of a `kind` this version doesn't know, written by a newer one. Kept
|
|
1334
|
+
* in its place, and written back intact, so an older client arranging the
|
|
1335
|
+
* columns doesn't drop it.
|
|
1336
|
+
*/
|
|
1337
|
+
interface ForeignColumnSpec {
|
|
1338
|
+
kind: string;
|
|
1339
|
+
hidden?: true;
|
|
1340
|
+
[property: string]: unknown;
|
|
1341
|
+
}
|
|
1342
|
+
//#endregion
|
|
1343
|
+
//#region src/dataset/dataset-types.d.ts
|
|
1344
|
+
/**
|
|
1345
|
+
* One column of a {@link Dataset}.
|
|
1346
|
+
*
|
|
1347
|
+
* A field's type is never typed in as free-form syntax: a dataset belongs to
|
|
1348
|
+
* no file, so there is no checker to resolve a hand-written type against.
|
|
1349
|
+
* Most fields are derived — copied from a prompt parameter or from a trace's
|
|
1350
|
+
* recorded definition. A field added by hand (`DatasetProvider.addField`) is
|
|
1351
|
+
* either a `string`, `number`, or `boolean` primitive, whose syntax is its
|
|
1352
|
+
* structure, or a copy of a prompt parameter's definition that the server
|
|
1353
|
+
* looked up itself. See `specs/datasets.md` §B, §P.1.
|
|
1354
|
+
*/
|
|
1355
|
+
interface DatasetField {
|
|
1356
|
+
/**
|
|
1357
|
+
* Stable, short id — row cells are keyed by it, so renaming a field never
|
|
1358
|
+
* rewrites rows. Base-36 of a per-dataset counter (`0`–`9`, `a`–`z`, `10`,
|
|
1359
|
+
* …), minted by the provider and never reused.
|
|
1360
|
+
*/
|
|
1361
|
+
id: string;
|
|
1362
|
+
/** Name, type, description — the checker's view of the slot this field came from. */
|
|
1363
|
+
def: PropDefinition$1;
|
|
1364
|
+
/**
|
|
1365
|
+
* Set on a field added by hand (`DatasetProvider.addField`) rather than
|
|
1366
|
+
* derived when the dataset was created. Such a field never came from the
|
|
1367
|
+
* linked prompt, so it isn't flagged when it matches none of its
|
|
1368
|
+
* parameters.
|
|
1369
|
+
*/
|
|
1370
|
+
added?: true;
|
|
1371
|
+
}
|
|
1372
|
+
/**
|
|
1373
|
+
* A dataset's metadata and schema. Rows are fetched separately
|
|
1374
|
+
* ({@link DatasetProvider.listRows}), since they grow without bound.
|
|
1375
|
+
*/
|
|
1376
|
+
interface Dataset {
|
|
1377
|
+
/** Stable id; for a local dataset, also the basename of its file. */
|
|
1378
|
+
id: string;
|
|
1379
|
+
/** Display name. Renaming changes only this, never {@link id}. */
|
|
1380
|
+
name: string;
|
|
1381
|
+
/** The schema, in display order. */
|
|
1382
|
+
fields: DatasetField[];
|
|
1383
|
+
/**
|
|
1384
|
+
* The prompt this dataset was created from, if any — metadata, not a
|
|
1385
|
+
* constraint. Stores the prompt's `globalId` when it has one, so the link
|
|
1386
|
+
* survives moves and renames; the server resolves it on read.
|
|
1387
|
+
*/
|
|
1388
|
+
prompt?: PromptID;
|
|
1389
|
+
/**
|
|
1390
|
+
* The grid's columns, in order — a layout, not the schema, so a client
|
|
1391
|
+
* reconciles it with the fields and rows it actually has on read. Absent
|
|
1392
|
+
* until someone arranges the columns. See `specs/datasets.md` §Q.3.
|
|
1393
|
+
*/
|
|
1394
|
+
columns?: DatasetColumnSpec[];
|
|
1395
|
+
/** The path whose value names a row wherever a row is named. */
|
|
1396
|
+
rowLabel?: ColumnPath;
|
|
1397
|
+
/** Creation timestamp (ms). */
|
|
1398
|
+
createdAt: number;
|
|
1399
|
+
/** Timestamp (ms) of the last change to the dataset or its rows. */
|
|
1400
|
+
updatedAt: number;
|
|
1401
|
+
}
|
|
1402
|
+
/** One key one level inside a path, as `DatasetProvider.describePath` finds it. */
|
|
1403
|
+
interface DatasetPathChild {
|
|
1404
|
+
key: string;
|
|
1405
|
+
/** What the first row that has this key holds there. */
|
|
1406
|
+
sample?: ExecutionInput;
|
|
1407
|
+
}
|
|
1408
|
+
/** One of the rows' resource instances, summarized across rows by name. */
|
|
1409
|
+
interface DatasetInstanceShape {
|
|
1410
|
+
/** The resource it instantiates, in the first row that declares it. */
|
|
1411
|
+
uri: string;
|
|
1412
|
+
/** How many rows declare it. */
|
|
1413
|
+
rows: number;
|
|
1414
|
+
/** Its argument names, merged across rows in order of first appearance. */
|
|
1415
|
+
args: string[];
|
|
1416
|
+
}
|
|
1417
|
+
/** Where a {@link DatasetRow} came from, so the view can link back to it. */
|
|
1418
|
+
type DatasetRowSource = {
|
|
1419
|
+
kind: "playground";
|
|
1420
|
+
promptId: string;
|
|
1421
|
+
providerId: string;
|
|
1422
|
+
} | {
|
|
1423
|
+
kind: "trace";
|
|
1424
|
+
traceId: string;
|
|
1425
|
+
traceProviderId: string;
|
|
1426
|
+
};
|
|
1427
|
+
/**
|
|
1428
|
+
* One dataset row: a cell per field it has a value for, keyed by field id.
|
|
1429
|
+
*
|
|
1430
|
+
* A cell is the same {@link ExecutionInput} the execute panel stores and a
|
|
1431
|
+
* trace records — so a resource reference, arguments and all, survives the
|
|
1432
|
+
* trip into a dataset and back out into the panel. Rows are sparse: a field
|
|
1433
|
+
* with no value has no key.
|
|
1434
|
+
*/
|
|
1435
|
+
interface DatasetRow {
|
|
1436
|
+
id: string;
|
|
1437
|
+
/** Field id → the input for that field. */
|
|
1438
|
+
cells: Record<string, ExecutionInput>;
|
|
1439
|
+
/**
|
|
1440
|
+
* Resource instances this row's runs declare, by name — its cells (and an
|
|
1441
|
+
* eval's bindings) may name them with `instance` references. Never carries
|
|
1442
|
+
* a receipt. See `specs/resource-instances.md` §E.
|
|
1443
|
+
*/
|
|
1444
|
+
resources?: RunResources;
|
|
1445
|
+
/** Where the row came from. */
|
|
1446
|
+
source?: DatasetRowSource;
|
|
1447
|
+
/** Creation timestamp (ms). */
|
|
1448
|
+
createdAt: number;
|
|
1449
|
+
}
|
|
1450
|
+
/**
|
|
1451
|
+
* One row's changes in `DatasetProvider.updateRows`: field id → the cell to
|
|
1452
|
+
* set, or `null` to clear it. Fields not named are left as they are.
|
|
1453
|
+
*/
|
|
1454
|
+
interface DatasetRowUpdate {
|
|
1455
|
+
rowId: string;
|
|
1456
|
+
cells: Record<string, ExecutionInput | null>;
|
|
1457
|
+
/**
|
|
1458
|
+
* The row's resource instances to set, by name, or `null` to remove one.
|
|
1459
|
+
* Instances not named are left as they are.
|
|
1460
|
+
*/
|
|
1461
|
+
resources?: Record<string, ResourceInstanceInput | null>;
|
|
1462
|
+
}
|
|
1463
|
+
/**
|
|
1464
|
+
* What one field's cells hold, beyond a single value — found in the rows,
|
|
1465
|
+
* not the schema: a field's `def` is the slot's type, which says nothing
|
|
1466
|
+
* about the shape of the object a row typed in for it.
|
|
1467
|
+
*/
|
|
1468
|
+
interface DatasetFieldShape {
|
|
1469
|
+
/**
|
|
1470
|
+
* The keys one level inside the field's cells: an `object` cell's property
|
|
1471
|
+
* names, and the property names of a typed-in object value. Merged by name
|
|
1472
|
+
* across rows, roughly in the order they first appear.
|
|
1473
|
+
*/
|
|
1474
|
+
keys: string[];
|
|
1475
|
+
}
|
|
1476
|
+
/**
|
|
1477
|
+
* What a dataset's rows hold, summarized without fetching them — enough for a
|
|
1478
|
+
* table to lay out its columns before it pages any rows in.
|
|
1479
|
+
*/
|
|
1480
|
+
interface DatasetRowsOverview {
|
|
1481
|
+
/** How many rows the dataset has. */
|
|
1482
|
+
rowCount: number;
|
|
1483
|
+
/**
|
|
1484
|
+
* Field id → what its cells hold, for every field whose cells have keys to
|
|
1485
|
+
* show. A field whose cells are all plain values has no entry.
|
|
1486
|
+
*/
|
|
1487
|
+
fields: Record<string, DatasetFieldShape>;
|
|
1488
|
+
/** Instance name → its resource and argument names, merged across rows. */
|
|
1489
|
+
instances: Record<string, DatasetInstanceShape>;
|
|
1490
|
+
}
|
|
1491
|
+
/** Compact dataset entry for listings (sidebar / `GET /api/datasets`). */
|
|
1492
|
+
interface DatasetSummary {
|
|
1493
|
+
providerId: string;
|
|
1494
|
+
id: string;
|
|
1495
|
+
name: string;
|
|
1496
|
+
rowCount: number;
|
|
1497
|
+
/**
|
|
1498
|
+
* The schema — small, and what an "add to dataset" menu needs to say how
|
|
1499
|
+
* much of a set of inputs would land. Empty for a dataset with an `error`.
|
|
1500
|
+
*/
|
|
1501
|
+
fields: DatasetField[];
|
|
1502
|
+
/** See {@link Dataset.prompt}. Resolved to an openable reference when served. */
|
|
1503
|
+
prompt?: PromptID;
|
|
1504
|
+
/** Timestamp (ms) of the last change. */
|
|
1505
|
+
updatedAt: number;
|
|
1506
|
+
/**
|
|
1507
|
+
* Why this dataset can't be read, if it can't — a corrupt file, say. Listed
|
|
1508
|
+
* rather than hidden, so a broken dataset is visible instead of missing.
|
|
1509
|
+
*/
|
|
1510
|
+
error?: string;
|
|
1511
|
+
}
|
|
1512
|
+
/** The kind of change a {@link DatasetChangeEvent} describes. */
|
|
1513
|
+
type DatasetChangeType = "add" | "update" | "remove";
|
|
1514
|
+
/** Describes a single change emitted by `DatasetProvider.watch`. */
|
|
1515
|
+
interface DatasetChangeEvent {
|
|
1516
|
+
type: DatasetChangeType;
|
|
1517
|
+
datasetId: string;
|
|
1518
|
+
}
|
|
1519
|
+
/** Information about a registered dataset provider. */
|
|
1520
|
+
interface DatasetProviderInfo {
|
|
1521
|
+
id: string;
|
|
1522
|
+
displayName?: string;
|
|
1523
|
+
description?: string;
|
|
1524
|
+
}
|
|
1525
|
+
//#endregion
|
|
1526
|
+
//#region src/prompt/playground/resource.d.ts
|
|
1527
|
+
/**
|
|
1528
|
+
* Brand identifying a value produced by {@link resource}. The loader walks a
|
|
1529
|
+
* playground module's exports and collects anything carrying it, so adding a
|
|
1530
|
+
* new kind of playground export means teaching the loader one more tag rather
|
|
1531
|
+
* than changing discovery.
|
|
1532
|
+
*/
|
|
1533
|
+
declare const RESOURCE_TAG: unique symbol;
|
|
1534
|
+
/**
|
|
1535
|
+
* What a resource's `create()` hands back: the value itself, plus an optional
|
|
1536
|
+
* teardown to run when the value's scope ends.
|
|
1537
|
+
*
|
|
1538
|
+
* @typeParam T - The type of the created value.
|
|
1539
|
+
* @typeParam R - The type of {@link receipt}. See {@link DynamicResourceDefinition.create}.
|
|
1540
|
+
*/
|
|
1541
|
+
interface ResourceInstance<T, R = unknown> {
|
|
1542
|
+
/** The created value, passed to whatever slot selected this resource. */
|
|
1543
|
+
value: T;
|
|
1544
|
+
/**
|
|
1545
|
+
* Releases whatever `create()` acquired. Called once, when the run settles
|
|
1546
|
+
* (`scope: 'run'`) or at shutdown / on module change (`scope: 'server'`).
|
|
1547
|
+
*/
|
|
1548
|
+
dispose?: () => void | Promise<void>;
|
|
1549
|
+
/**
|
|
1550
|
+
* A serializable summary of what was produced (a seeded row's id, say), so a
|
|
1551
|
+
* trace can display the value a past run used even though replaying it mints
|
|
1552
|
+
* a new one. Handed back to `create()` on a replay — see
|
|
1553
|
+
* `specs/resource-arguments.md` §E — so a resource that wants replay to
|
|
1554
|
+
* reconstruct rather than re-mint should record here whatever it needs to do
|
|
1555
|
+
* that. Omit for values with no meaningful summary.
|
|
1556
|
+
*/
|
|
1557
|
+
receipt?: R;
|
|
1558
|
+
/**
|
|
1559
|
+
* Returns this instance to its between-runs state. Called on a
|
|
1560
|
+
* `scope: 'server'` instance before the first run within a lease that uses
|
|
1561
|
+
* it; never on a `scope: 'run'` one, since that is created fresh per run
|
|
1562
|
+
* already. See `specs/resource-arguments.md` §F.
|
|
1563
|
+
*/
|
|
1564
|
+
reset?: () => void | Promise<void>;
|
|
1565
|
+
}
|
|
1566
|
+
/**
|
|
1567
|
+
* One thing a resource takes: another resource, resolved by reference in
|
|
1568
|
+
* code, or a value validated by a
|
|
1569
|
+
* [Standard Schema](https://standardschema.dev), resolved per run from the
|
|
1570
|
+
* execute panel, a dataset column, or a recorded trace.
|
|
1571
|
+
*
|
|
1572
|
+
* Which kind an entry is decides *when* it is bound, not how `create()` reads
|
|
1573
|
+
* it — see {@link ResolvedResourceInputs} and `specs/resource-arguments.md`
|
|
1574
|
+
* §B.
|
|
1575
|
+
*/
|
|
1576
|
+
type ResourceInput = Resource<any> | StandardSchemaV1;
|
|
1577
|
+
/**
|
|
1578
|
+
* Everything a resource needs in order to be created, keyed by the name its
|
|
1579
|
+
* `create()` receives each entry under.
|
|
1580
|
+
*
|
|
1581
|
+
* A dependency (a {@link Resource}) is given as the resource *object* itself
|
|
1582
|
+
* rather than as a string key: the registry resolves it by identity, so
|
|
1583
|
+
* `create`'s argument is typed from the dependency and there is no
|
|
1584
|
+
* key-collision problem across the many files a `.evalution/playground/`
|
|
1585
|
+
* directory may hold. An argument (a `StandardSchemaV1`) is instead resolved
|
|
1586
|
+
* per run, and validated against its schema before `create` sees it. See
|
|
1587
|
+
* `specs/resource-arguments.md` §B.
|
|
1588
|
+
*/
|
|
1589
|
+
type ResourceInputs = Record<string, ResourceInput>;
|
|
1590
|
+
/**
|
|
1591
|
+
* One named output a resource exposes as its own entry in the picker, read
|
|
1592
|
+
* as a top-level property off whatever `create()` (or a static `value`)
|
|
1593
|
+
* produces.
|
|
1594
|
+
*
|
|
1595
|
+
* A resource exposing `outputs` still produces one value from one `create()`
|
|
1596
|
+
* — `ResourceRegistry.instantiate` memoizes by resource *object* (and, once a
|
|
1597
|
+
* resource takes arguments, by argument key too) within a lease, so picking
|
|
1598
|
+
* one output for one slot and another for a different slot creates the
|
|
1599
|
+
* underlying value once, not twice. Declaring a key here is opt-in: it is the
|
|
1600
|
+
* author saying which paths are worth offering on their own, the same
|
|
1601
|
+
* judgement {@link DynamicResourceDefinition.label} already is.
|
|
1602
|
+
* See `specs/resource-hierarchy.md` §A.
|
|
1603
|
+
*/
|
|
1604
|
+
interface ResourceOutputDefinition {
|
|
1605
|
+
/** Human-readable label, shown as the submenu entry. Defaults to the key. */
|
|
1606
|
+
label?: string;
|
|
1607
|
+
/**
|
|
1608
|
+
* Explicit slot(s) this output fills — same grammar and precedence as a
|
|
1609
|
+
* resource's own {@link DynamicResourceDefinition.for}.
|
|
1610
|
+
*/
|
|
1611
|
+
for?: string | readonly string[];
|
|
1612
|
+
}
|
|
1613
|
+
/**
|
|
1614
|
+
* The resolved values `create()` receives, one per entry in
|
|
1615
|
+
* {@link ResourceInputs} — a dependency's own produced type, or an
|
|
1616
|
+
* argument's validated output type.
|
|
1617
|
+
*/
|
|
1618
|
+
type ResolvedResourceInputs<N extends ResourceInputs> = { [K in keyof N]: N[K] extends Resource<infer T> ? T : N[K] extends StandardSchemaV1<unknown, infer O> ? O : never };
|
|
1619
|
+
/**
|
|
1620
|
+
* A resource whose value is produced by running code, resolved via
|
|
1621
|
+
* `create()`. See {@link resource} for the narrative.
|
|
1622
|
+
*/
|
|
1623
|
+
interface DynamicResourceDefinition<T, N extends ResourceInputs = Record<string, never>, R = unknown> {
|
|
1624
|
+
/** Human-readable label shown on the chip in the execute panel. */
|
|
1625
|
+
label?: string;
|
|
1626
|
+
/**
|
|
1627
|
+
* How long the created value lives.
|
|
1628
|
+
*
|
|
1629
|
+
* `'run'` (the default) creates a fresh value per execution and disposes it
|
|
1630
|
+
* when the run settles. `'server'` creates once and memoizes, disposing at
|
|
1631
|
+
* shutdown or when the defining module changes — the right choice when
|
|
1632
|
+
* `create()` is expensive (standing up a worker runtime, say).
|
|
1633
|
+
*
|
|
1634
|
+
* A `'run'`-scoped resource may depend on a `'server'`-scoped one, but not
|
|
1635
|
+
* the reverse: a long-lived value must not close over a per-run one. The
|
|
1636
|
+
* registry rejects that at load time. A `'server'`-scoped resource may not
|
|
1637
|
+
* declare arguments (a schema-valued entry in {@link inputs}) — see
|
|
1638
|
+
* `specs/resource-arguments.md` §D.
|
|
1639
|
+
*/
|
|
1640
|
+
scope?: ResourceScope;
|
|
1641
|
+
/**
|
|
1642
|
+
* Everything this resource needs, resolved first and passed to `create`.
|
|
1643
|
+
* See {@link ResourceInputs}.
|
|
1644
|
+
*/
|
|
1645
|
+
inputs?: N;
|
|
1646
|
+
/**
|
|
1647
|
+
* Explicit slot to fill, as a dotted path optionally prefixed by a prompt
|
|
1648
|
+
* name — `'orchestrate.taskId'`, `'toolsContext.list_tasks.db'`. An escape
|
|
1649
|
+
* hatch that always works, tried before type and name matching.
|
|
1650
|
+
*/
|
|
1651
|
+
for?: string | readonly string[];
|
|
1652
|
+
/**
|
|
1653
|
+
* Display path of the group this resource belongs to, `/`-separated for
|
|
1654
|
+
* nesting (`'Tasks'`, `'Tasks/Regressions'`). Purely how the picker's menu
|
|
1655
|
+
* is drawn — never part of the resource's URI, so renaming a group
|
|
1656
|
+
* invalidates no saved selection and no past trace. Absent means top
|
|
1657
|
+
* level. See `specs/resource-hierarchy.md` §B.
|
|
1658
|
+
*/
|
|
1659
|
+
group?: string;
|
|
1660
|
+
/**
|
|
1661
|
+
* Named outputs read off the produced value, each selectable on its own in
|
|
1662
|
+
* the picker alongside the resource itself. See
|
|
1663
|
+
* {@link ResourceOutputDefinition} and `specs/resource-hierarchy.md` §A.
|
|
1664
|
+
*/
|
|
1665
|
+
outputs?: Partial<Record<keyof T & string, string | ResourceOutputDefinition>>;
|
|
1666
|
+
/**
|
|
1667
|
+
* Produces the value.
|
|
1668
|
+
*
|
|
1669
|
+
* `receipt` is `undefined` on a fresh run and the recorded receipt of a
|
|
1670
|
+
* past run's `create()` on a replay. Honouring it — reusing the identity it
|
|
1671
|
+
* names rather than minting a new one — is what lets a replay be compared
|
|
1672
|
+
* against the run it replays; see `specs/resource-arguments.md` §E. It is
|
|
1673
|
+
* advisory: nothing enforces that it was honoured, and ignoring it is
|
|
1674
|
+
* simply today's behaviour.
|
|
1675
|
+
*
|
|
1676
|
+
* @param inputs - See {@link ResolvedResourceInputs}.
|
|
1677
|
+
* @param receipt - A past run's receipt, on a replay. See
|
|
1678
|
+
* {@link ResourceInstance.receipt}.
|
|
1679
|
+
*/
|
|
1680
|
+
create(inputs: ResolvedResourceInputs<N>, receipt?: R): ResourceInstance<T, R> | Promise<ResourceInstance<T, R>>;
|
|
1681
|
+
}
|
|
1682
|
+
/**
|
|
1683
|
+
* A resource whose value is already known — a literal rather than something
|
|
1684
|
+
* `create()` computes. Scoped as `'server'` always (see
|
|
1685
|
+
* {@link DynamicResourceDefinition.scope}): there is nothing to create per
|
|
1686
|
+
* run, so the same value is handed out for the life of the process. Since
|
|
1687
|
+
* there is no `create()`, a static resource has no `inputs` and therefore no
|
|
1688
|
+
* arguments.
|
|
1689
|
+
*/
|
|
1690
|
+
interface StaticResourceDefinition<T> {
|
|
1691
|
+
/** Human-readable label shown on the chip in the execute panel. */
|
|
1692
|
+
label?: string;
|
|
1693
|
+
scope?: undefined;
|
|
1694
|
+
/**
|
|
1695
|
+
* Explicit slot to fill, as a dotted path optionally prefixed by a prompt
|
|
1696
|
+
* name — `'orchestrate.taskId'`, `'toolsContext.list_tasks.db'`. An escape
|
|
1697
|
+
* hatch that always works, tried before type and name matching.
|
|
1698
|
+
*/
|
|
1699
|
+
for?: string | readonly string[];
|
|
1700
|
+
/**
|
|
1701
|
+
* Display path of the group this resource belongs to, `/`-separated for
|
|
1702
|
+
* nesting (`'Tasks'`, `'Tasks/Regressions'`). Purely how the picker's menu
|
|
1703
|
+
* is drawn — never part of the resource's URI. Absent means top level. See
|
|
1704
|
+
* `specs/resource-hierarchy.md` §B.
|
|
1705
|
+
*/
|
|
1706
|
+
group?: string;
|
|
1707
|
+
/**
|
|
1708
|
+
* Named outputs read off {@link value}, each selectable on its own in the
|
|
1709
|
+
* picker alongside the resource itself. See {@link ResourceOutputDefinition}
|
|
1710
|
+
* and `specs/resource-hierarchy.md` §A.
|
|
1711
|
+
*/
|
|
1712
|
+
outputs?: Partial<Record<keyof T & string, string | ResourceOutputDefinition>>;
|
|
1713
|
+
/** The value itself. */
|
|
1714
|
+
value: T;
|
|
1715
|
+
}
|
|
1716
|
+
/** What {@link resource} is given. See {@link resource} for the narrative. */
|
|
1717
|
+
type ResourceDefinition<T, N extends ResourceInputs = Record<string, never>, R = unknown> = DynamicResourceDefinition<T, N, R> | StaticResourceDefinition<T>;
|
|
1718
|
+
/**
|
|
1719
|
+
* A named value produced by code at run time, in-process, with a lifecycle.
|
|
1720
|
+
*
|
|
1721
|
+
* Returned by {@link resource}; see it for what a resource is and how one is
|
|
1722
|
+
* written.
|
|
1723
|
+
*
|
|
1724
|
+
* @typeParam T - The type of value this resource produces.
|
|
1725
|
+
*/
|
|
1726
|
+
type Resource<T> = ResourceDefinition<T, any, any> & {
|
|
1727
|
+
/** @internal Identifies this object to the playground-module loader. */readonly [RESOURCE_TAG]: true;
|
|
1728
|
+
};
|
|
1729
|
+
/**
|
|
1730
|
+
* Declares a value that only running code can produce, so the playground can
|
|
1731
|
+
* offer it as an input to a prompt.
|
|
1732
|
+
*
|
|
1733
|
+
* That — not "is it JSON-serializable" — is the defining property. A resource
|
|
1734
|
+
* may well resolve to a plain string (the id of a task it just inserted); what
|
|
1735
|
+
* makes it a resource is that no form could have produced it. A live database
|
|
1736
|
+
* handle is the limiting case: it cannot be typed in, and it cannot be sent
|
|
1737
|
+
* over the wire either, so the panel offers the *reference* and the value is
|
|
1738
|
+
* created server-side at run time.
|
|
1739
|
+
*
|
|
1740
|
+
* A resource may also declare **arguments** — schema-valued entries in
|
|
1741
|
+
* {@link ResourceInputs} — so that a `create()` which needs data (not just
|
|
1742
|
+
* other resources) can take it per run from the execute panel, a dataset
|
|
1743
|
+
* column, or another resource, instead of it being typed into the source
|
|
1744
|
+
* file. See `specs/resource-arguments.md` §B.
|
|
1745
|
+
*
|
|
1746
|
+
* Resources live in **playground modules** — `*.playground.ts` beside a prompt
|
|
1747
|
+
* file (in scope for prompts in that directory), or any `.ts` under
|
|
1748
|
+
* `.evalution/playground/` (in scope for the whole workspace). The export name
|
|
1749
|
+
* is the resource's key. Such code runs in the server process with full
|
|
1750
|
+
* filesystem and network access, which is the trust level the prompt file
|
|
1751
|
+
* already has.
|
|
1752
|
+
*
|
|
1753
|
+
* The resource's **type is inferred from what `create` returns** — there is no
|
|
1754
|
+
* type string to keep in sync with a rename. Pin it with a type argument when
|
|
1755
|
+
* inference widens past the named type a slot is declared with: `makeNanoId`
|
|
1756
|
+
* below returns `` `tsk_${string}` ``, which is the same type as `TaskId`
|
|
1757
|
+
* spelled differently.
|
|
1758
|
+
*
|
|
1759
|
+
* @example A live handle, created once per server because it is expensive.
|
|
1760
|
+
* ```ts
|
|
1761
|
+
* // .evalution/playground/db.ts
|
|
1762
|
+
* import { resource } from 'evalution';
|
|
1763
|
+
*
|
|
1764
|
+
* export const db = resource({
|
|
1765
|
+
* label: 'Local D1 (.wrangler state)',
|
|
1766
|
+
* scope: 'server',
|
|
1767
|
+
* async create() {
|
|
1768
|
+
* const mf = new Miniflare({ ... });
|
|
1769
|
+
* return { value: makeDb(await mf.getD1Database('APP_DB')), dispose: () => mf.dispose() };
|
|
1770
|
+
* },
|
|
1771
|
+
* });
|
|
1772
|
+
* ```
|
|
1773
|
+
*
|
|
1774
|
+
* @example A per-run value that depends on the handle above and takes arguments.
|
|
1775
|
+
* ```ts
|
|
1776
|
+
* // src/agents/odin/odin.playground.ts
|
|
1777
|
+
* import { resource } from 'evalution';
|
|
1778
|
+
* import { z } from 'zod';
|
|
1779
|
+
* import { db } from '../../../.evalution/playground/db.js';
|
|
1780
|
+
*
|
|
1781
|
+
* export const seededTask = resource({
|
|
1782
|
+
* label: 'Freshly seeded task',
|
|
1783
|
+
* inputs: { db, title: z.string(), status: z.enum(['triaged', 'open', 'done']).default('triaged') },
|
|
1784
|
+
* async create({ db, title, status }, receipt) {
|
|
1785
|
+
* const id = receipt?.taskId ?? makeNanoId('tsk_');
|
|
1786
|
+
* await db.insert(tasks).values({ id, title, status });
|
|
1787
|
+
* return { value: { taskId: id, title, status }, receipt: { taskId: id } };
|
|
1788
|
+
* },
|
|
1789
|
+
* });
|
|
1790
|
+
* ```
|
|
1791
|
+
*
|
|
1792
|
+
* @param definition - See {@link ResourceDefinition}.
|
|
1793
|
+
* @returns The resource, to be exported under the name it should be known by.
|
|
1794
|
+
*/
|
|
1795
|
+
declare function resource<T>(definition: StaticResourceDefinition<T>): StaticResourceDefinition<T> & {
|
|
1796
|
+
readonly [RESOURCE_TAG]: true;
|
|
1797
|
+
};
|
|
1798
|
+
declare function resource<T, const N extends ResourceInputs = Record<string, never>, R = unknown>(definition: DynamicResourceDefinition<T, N, R>): DynamicResourceDefinition<T, N, R> & {
|
|
1799
|
+
readonly [RESOURCE_TAG]: true;
|
|
1800
|
+
};
|
|
1801
|
+
/** Whether `value` was produced by {@link resource}. */
|
|
1802
|
+
declare function isResource(value: unknown): value is Resource<unknown>;
|
|
1803
|
+
/**
|
|
1804
|
+
* Whether `value` is a [Standard Schema](https://standardschema.dev) —
|
|
1805
|
+
* the other kind of {@link ResourceInput} entry, distinguished from a
|
|
1806
|
+
* {@link Resource} by carrying `~standard` rather than the internal resource tag.
|
|
1807
|
+
* No checker is involved: the two are structurally distinct at runtime, so
|
|
1808
|
+
* partitioning an `inputs` map needs nothing but this and {@link isResource}.
|
|
1809
|
+
*/
|
|
1810
|
+
declare function isStandardSchema(value: unknown): value is StandardSchemaV1;
|
|
1811
|
+
//#endregion
|
|
1812
|
+
//#region src/prompt/playground/check.d.ts
|
|
1813
|
+
/**
|
|
1814
|
+
* Brand identifying a value produced by {@link check} — a sibling of
|
|
1815
|
+
* `RESOURCE_TAG`, so the playground-module loader collects checks the same
|
|
1816
|
+
* way it collects resources. A registered symbol, so a check made by one copy
|
|
1817
|
+
* of evalution is still recognised by another.
|
|
1818
|
+
*/
|
|
1819
|
+
declare const CHECK_TAG: unique symbol;
|
|
1820
|
+
/** What a check is judging: one prompt run of one dataset row. */
|
|
1821
|
+
interface CheckRun {
|
|
1822
|
+
/** The run's trace, complete (`specs/evals.md` §D.3). */
|
|
1823
|
+
trace: TraceWithSpans;
|
|
1824
|
+
/** The dataset row, cells unresolved. */
|
|
1825
|
+
row: DatasetRow;
|
|
1826
|
+
/** Whether the prompt run itself succeeded. */
|
|
1827
|
+
status: "ok" | "error";
|
|
1828
|
+
/** The run's error, when {@link status} is `"error"`. */
|
|
1829
|
+
error?: string;
|
|
1830
|
+
/**
|
|
1831
|
+
* Set when the trace didn't finish arriving in time, so the checks ran on
|
|
1832
|
+
* whatever did. A check that reads the trace should report an error
|
|
1833
|
+
* rather than guess.
|
|
1834
|
+
*/
|
|
1835
|
+
traceIncomplete?: boolean;
|
|
1836
|
+
}
|
|
1837
|
+
/**
|
|
1838
|
+
* What a check's `run` may return. See `specs/evals.md` §B.3:
|
|
1839
|
+
*
|
|
1840
|
+
* - `undefined` or `true` passes, `false` fails;
|
|
1841
|
+
* - a number is a score, which passes or fails only against the eval's
|
|
1842
|
+
* threshold;
|
|
1843
|
+
* - an object gives its fields as-is.
|
|
1844
|
+
*
|
|
1845
|
+
* Throwing an error named `AssertionError` (`node:assert`, chai, Vitest's
|
|
1846
|
+
* `expect`) fails with its message; throwing anything else is an error.
|
|
1847
|
+
*/
|
|
1848
|
+
type CheckOutcome = void | undefined | boolean | number | {
|
|
1849
|
+
pass?: boolean;
|
|
1850
|
+
score?: number;
|
|
1851
|
+
message?: string;
|
|
1852
|
+
details?: unknown;
|
|
1853
|
+
};
|
|
1854
|
+
/** What {@link check} is given. */
|
|
1855
|
+
interface CheckDefinition<N extends ResourceInputs = ResourceInputs> {
|
|
1856
|
+
/** Human-readable label. Defaults to the export name. */
|
|
1857
|
+
label?: string;
|
|
1858
|
+
/** Display group in the check picker, `/`-separated for nesting. */
|
|
1859
|
+
group?: string;
|
|
1860
|
+
/** Shown beneath the label in the picker. */
|
|
1861
|
+
description?: string;
|
|
1862
|
+
/**
|
|
1863
|
+
* Exactly a resource's `inputs`: resources bound in code — resolved from
|
|
1864
|
+
* the run's own lease, so they're the instances the run used — and
|
|
1865
|
+
* Standard Schemas bound by the eval, from a column, a literal, another
|
|
1866
|
+
* slot, or a resource.
|
|
1867
|
+
*/
|
|
1868
|
+
inputs?: N;
|
|
1869
|
+
/** Whether the check still runs when the prompt run itself errored. */
|
|
1870
|
+
runsOnError?: boolean;
|
|
1871
|
+
/** How long `run` may take before it's an `error`. Default 30s. */
|
|
1872
|
+
timeoutMs?: number;
|
|
1873
|
+
/**
|
|
1874
|
+
* Judges the run. Read-only by contract: a row's checks run concurrently.
|
|
1875
|
+
*
|
|
1876
|
+
* @param inputs - See {@link ResolvedResourceInputs}.
|
|
1877
|
+
* @param run - What is being judged. See {@link CheckRun}.
|
|
1878
|
+
*/
|
|
1879
|
+
run(inputs: ResolvedResourceInputs<N>, run: CheckRun): CheckOutcome | Promise<CheckOutcome>;
|
|
1880
|
+
}
|
|
1881
|
+
/**
|
|
1882
|
+
* A check, as {@link check} returns it.
|
|
1883
|
+
*
|
|
1884
|
+
* @typeParam N - Its declared inputs.
|
|
1885
|
+
*/
|
|
1886
|
+
type Check<N extends ResourceInputs = ResourceInputs> = CheckDefinition<N> & {
|
|
1887
|
+
/** @internal Identifies this object to the playground-module loader. */readonly [CHECK_TAG]: true;
|
|
1888
|
+
};
|
|
1889
|
+
/**
|
|
1890
|
+
* Declares a check an eval can run against each row's prompt run — "did it
|
|
1891
|
+
* create a task called *Set up CI*?" — as a playground export, so it can use
|
|
1892
|
+
* the app's own schema and helpers.
|
|
1893
|
+
*
|
|
1894
|
+
* A check is a resource whose `create` is called once, after the run, and
|
|
1895
|
+
* returns a verdict instead of a value. Its `inputs` are a resource's: a
|
|
1896
|
+
* resource object is resolved from the run's own lease (the same database
|
|
1897
|
+
* the run's tools wrote to), and a Standard Schema is a parameter the eval
|
|
1898
|
+
* binds — often to a dataset column holding the expected value. See
|
|
1899
|
+
* `specs/evals.md` §B.
|
|
1900
|
+
*
|
|
1901
|
+
* @example
|
|
1902
|
+
* ```ts
|
|
1903
|
+
* // .evalution/playground/checks.ts
|
|
1904
|
+
* import { check } from 'evalution';
|
|
1905
|
+
* import { expect } from 'vitest';
|
|
1906
|
+
* import { db } from './db.ts';
|
|
1907
|
+
*
|
|
1908
|
+
* export const createsTask = check({
|
|
1909
|
+
* label: 'Creates a task with the expected title',
|
|
1910
|
+
* inputs: { db, rootTaskId: z.string(), title: z.string() },
|
|
1911
|
+
* async run({ db, rootTaskId, title }) {
|
|
1912
|
+
* const tasks = await listTasksUnder(db, rootTaskId);
|
|
1913
|
+
* expect(tasks.map(t => t.title)).toContain(title);
|
|
1914
|
+
* },
|
|
1915
|
+
* });
|
|
1916
|
+
* ```
|
|
1917
|
+
*
|
|
1918
|
+
* @param definition - See {@link CheckDefinition}.
|
|
1919
|
+
* @returns The check, to be exported under the name it should be known by.
|
|
1920
|
+
*/
|
|
1921
|
+
declare function check<const N extends ResourceInputs = Record<string, never>>(definition: CheckDefinition<N>): Check<N>;
|
|
1922
|
+
/** Whether `value` was produced by {@link check}. */
|
|
1923
|
+
declare function isCheck(value: unknown): value is Check;
|
|
1924
|
+
//#endregion
|
|
1925
|
+
export { NormalizedPromptBase as $, TraceCheckResult as $t, DatasetRowsOverview as A, TraceWithSpans as An, EvalArm as At, ChatPromptUpdates as B, EvalInputs as Bt, DatasetFieldShape as C, TraceChangeEvent as Cn, ValueCatalogPreset as Ct, DatasetRow as D, TraceProviderInfo as Dn, VariationInfo as Dt, DatasetProviderInfo as E, TraceLiveEvent as En, VariationId as Et, KnownColumnSpec as F, EvalCheckOutcome as Ft, ExecutionInput as G, EvalRun as Gt, ConflictChoices as H, EvalResults as Ht, AddPromptContext as I, EvalCheckResult as It, InputLayout as J, EvalRunSummary as Jt, ExtractedProps as K, EvalRunProgress as Kt, AddPromptField as L, EvalCounts as Lt, ColumnPath as M, spanMessages as Mn, EvalChangeEvent as Mt, DatasetColumnSpec as N, EvalChangeType as Nt, DatasetRowSource as O, TraceStreamEvent as On, VersionId as Ot, ForeignColumnSpec as P, EvalCheck as Pt, NormalizedPrompt as Q, NewEvalRun as Qt, CalleeBinding as R, EvalDefinition as Rt, DatasetField as S, Trace as Sn, ValueCatalogGroup as St, DatasetPathChild as T, TraceEvalRun as Tn, VariationConflict as Tt, ExecuteRequest as U, EvalRowResult as Ut, CheckInfo as V, EvalProviderInfo as Vt, ExecuteResponse as W, EvalRowStatus as Wt, NormalizedMessage as X, EvalTraceRun as Xt, NormalizedChatPrompt as Y, EvalSummary as Yt, NormalizedParameter as Z, NewEvalDefinition as Zt, isStandardSchema as _, SpanMessageRole as _n, ResourceScope as _t, check as a, AnnotationSource as an, PromptChangeEvent as at, DatasetChangeEvent as b, SpanToolResultPart as bn, UpdatePromptResponse as bt, ResolvedResourceInputs as c, LLMSpanDetails as cn, PromptRef as ct, ResourceInput as d, SERVICE_NAME_ATTRIBUTE as dn, PropType as dt, Annotation as en, NormalizedPromptUpdates as et, ResourceInputs as f, Span as fn, PropValue$1 as ft, isResource as g, SpanMessage as gn, ResourceInstanceInput as gt, StaticResourceDefinition as h, SpanKind as hn, ResourceInfo as ht, CheckRun as i, AnnotationKind as in, PendingConflicts as it, DatasetSummary as j, isCheckSpan as jn, EvalArmSpec as jt, DatasetRowUpdate as k, TraceSummary as kn, VersionInfo as kt, Resource as l, PLAYGROUND_ENVIRONMENT as ln, PromptStyle as lt, ResourceOutputDefinition as m, SpanImagePart as mn, RebaseResult as mt, CheckDefinition as n, AnnotationEvent as nn, NormalizedToolCall as nt, isCheck as o, CHECK_ATTRIBUTE as on, PromptInputSources as ot, ResourceInstance as p, SpanContentPart as pn, QuestionsPromptUpdates as pt, FieldValues as q, EvalRunStatus as qt, CheckOutcome as r, AnnotationEventOp as rn, ParsedPrompt as rt, DynamicResourceDefinition as s, DEPLOYMENT_ENVIRONMENT_ATTRIBUTE as sn, PromptProviderInfo as st, Check as t, AnnotationChanges as tn, NormalizedQuestionsPrompt as tt, ResourceDefinition as u, PromptID as un, PropDefinition$1 as ut, resource as v, SpanTextPart as vn, RunResources as vt, DatasetInstanceShape as w, TraceChangeType as wn, ValueFactory$1 as wt, DatasetChangeType as x, ToolSpanDetails as xn, ValueCatalog as xt, Dataset as y, SpanToolCallPart as yn, SourceSpan as yt, ChangeEventType as z, EvalDefinitionPatch as zt };
|