evalution 2.0.2 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +90 -10
- package/dist/client/assets/{DatasetView-DZ2uLHKV.js → DatasetView-B1KoSX7p.js} +4 -4
- package/dist/client/assets/{EvalRunView-T610dLVw.js → EvalRunView-By5RN8fo.js} +1 -1
- package/dist/client/assets/{EvalView-Cae68vPB.js → EvalView-BW2qyhFj.js} +1 -1
- package/dist/client/assets/{data-grid-overlay-editor-PtH7A6E4.js → data-grid-overlay-editor-CQsCX66k.js} +1 -1
- package/dist/client/assets/{highlighted-body-KPVGNVTW-CPtwvSJb.js → highlighted-body-KPVGNVTW-D7b_g0Y9.js} +1 -1
- package/dist/client/assets/{index-BFH07Ynk.js → index-BDqLFfPf.js} +128 -128
- package/dist/client/assets/{number-overlay-editor-BbQhagHP.js → number-overlay-editor-lGaIg9Iu.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/{cost-fetching-trace-sink-Dz8gniQ6.js → cost-fetching-trace-sink-BEqbMdt1.js} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/ingest.js +2 -2
- package/dist/{local-database-trace-provider-87-WGqfS.js → local-database-trace-provider-BHe2hLFA.js} +20 -1
- package/dist/{trace-event-ingestor-B1DYEg2H.js → trace-event-ingestor-fjlL_FYB.js} +50 -9
- package/package.json +5 -5
package/dist/client/assets/{number-overlay-editor-BbQhagHP.js → number-overlay-editor-lGaIg9Iu.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{ad as Y,r as O}from"./index-BFH07Ynk.js";import{s as Be}from"./DatasetView-DZ2uLHKV.js";const Fe=Be("div")({name:"NumberOverlayEditorStyle",class:"gdg-n15fjm3e",propsAsIs:!1});function pe(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r}var ee;(function(e){e.event="event",e.props="prop"})(ee||(ee={}));function q(){}function _e(e){var t,r=void 0;return function(){for(var n=[],a=arguments.length;a--;)n[a]=arguments[a];return t&&n.length===t.length&&n.every(function(i,f){return i===t[f]})||(t=n,r=e.apply(void 0,n)),r}}function ae(e){return!!(e||"").match(/\d/)}function z(e){return e==null}function je(e){return typeof e=="number"&&isNaN(e)}function xe(e){return z(e)||je(e)||typeof e=="number"&&!isFinite(e)}function ye(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function Me(e){switch(e){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;case"thousand":default:return/(\d)(?=(\d{3})+(?!\d))/g}}function Le(e,t,r){var n=Me(r),a=e.search(/[1-9]/);return a=a===-1?e.length:a,e.substring(0,a)+e.substring(a,e.length).replace(n,"$1"+t)}function de(e){var t=O.useRef(e);t.current=e;var r=O.useRef(function(){for(var n=[],a=arguments.length;a--;)n[a]=arguments[a];return t.current.apply(t,n)});return r.current}function se(e,t){t===void 0&&(t=!0);var r=e[0]==="-",n=r&&t;e=e.replace("-","");var a=e.split("."),i=a[0],f=a[1]||"";return{beforeDecimal:i,afterDecimal:f,hasNegation:r,addNegation:n}}function ke(e){if(!e)return e;var t=e[0]==="-";t&&(e=e.substring(1,e.length));var r=e.split("."),n=r[0].replace(/^0+/,"")||"0",a=r[1]||"";return(t?"-":"")+n+(a?"."+a:"")}function be(e,t,r){for(var n="",a=r?"0":"",i=0;i<=t-1;i++)n+=e[i]||a;return n}function ge(e,t){return Array(t+1).join(e)}function Ve(e){var t=e+"",r=t[0]==="-"?"-":"";r&&(t=t.substring(1));var n=t.split(/[eE]/g),a=n[0],i=n[1];if(i=Number(i),!i)return r+a;a=a.replace(".","");var f=1+i,p=a.length;return f<0?a="0."+ge("0",Math.abs(f))+a:f>=p?a=a+ge("0",f-p):a=(a.substring(0,f)||"0")+"."+a.substring(f),r+a}function me(e,t,r){if(["","-"].indexOf(e)!==-1)return e;var n=(e.indexOf(".")!==-1||r)&&t,a=se(e),i=a.beforeDecimal,f=a.afterDecimal,p=a.hasNegation,m=parseFloat("0."+(f||"0")),x=f.length<=t?"0."+f:m.toFixed(t),h=x.split("."),s=i;i&&Number(h[0])&&(s=i.split("").reverse().reduce(function(I,C,g){return I.length>g?(Number(I[0])+Number(C)).toString()+I.substring(1,I.length):C+I},h[0]));var S=be(h[1]||"",t,r),y=p?"-":"",l=n?".":"";return""+y+s+l+S}function J(e,t){if(e.value=e.value,e!==null){if(e.createTextRange){var r=e.createTextRange();return r.move("character",t),r.select(),!0}return e.selectionStart||e.selectionStart===0?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}var Ne=_e(function(e,t){for(var r=0,n=0,a=e.length,i=t.length;e[r]===t[r]&&r<a;)r++;for(;e[a-1-n]===t[i-1-n]&&i-n>r&&a-n>r;)n++;return{from:{start:r,end:a-n},to:{start:r,end:i-n}}}),Pe=function(e,t){var r=Math.min(e.selectionStart,t);return{from:{start:r,end:e.selectionEnd},to:{start:r,end:t}}};function Ke(e,t,r){return Math.min(Math.max(e,t),r)}function ce(e){return Math.max(e.selectionStart,e.selectionEnd)}function We(){return typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function Ue(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function $e(e){var t=e.currentValue,r=e.formattedValue,n=e.currentValueIndex,a=e.formattedValueIndex;return t[n]===r[a]}function Ge(e,t,r,n,a,i,f){f===void 0&&(f=$e);var p=a.findIndex(function(k){return k}),m=e.slice(0,p);!t&&!r.startsWith(m)&&(t=m,r=m+r,n=n+m.length);for(var x=r.length,h=e.length,s={},S=new Array(x),y=0;y<x;y++){S[y]=-1;for(var l=0,I=h;l<I;l++){var C=f({currentValue:r,lastValue:t,formattedValue:e,currentValueIndex:y,formattedValueIndex:l});if(C&&s[l]!==!0){S[y]=l,s[l]=!0;break}}}for(var g=n;g<x&&(S[g]===-1||!i(r[g]));)g++;var B=g===x||S[g]===-1?h:S[g];for(g=n-1;g>0&&S[g]===-1;)g--;var F=g===-1||S[g]===-1?0:S[g]+1;return F>B?B:n-F<B-n?F:B}function he(e,t,r,n){var a=e.length;if(t=Ke(t,0,a),n==="left"){for(;t>=0&&!r[t];)t--;t===-1&&(t=r.indexOf(!0))}else{for(;t<=a&&!r[t];)t++;t>a&&(t=r.lastIndexOf(!0))}return t===-1&&(t=a),t}function Ze(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),r=0,n=t.length;r<n;r++)t[r]=!!(ae(e[r])||ae(e[r-1]));return t}function we(e,t,r,n,a,i){i===void 0&&(i=q);var f=de(function(l,I){var C,g;return xe(l)?(g="",C=""):typeof l=="number"||I?(g=typeof l=="number"?Ve(l):l,C=n(g)):(g=a(l,void 0),C=n(g)),{formattedValue:C,numAsString:g}}),p=O.useState(function(){return f(z(e)?t:e,r)}),m=p[0],x=p[1],h=de(function(l,I){l.formattedValue!==m.formattedValue&&x({formattedValue:l.formattedValue,numAsString:l.value}),i(l,I)}),s=e,S=r;z(e)&&(s=m.numAsString,S=!0);var y=f(s,S);return O.useMemo(function(){x(y)},[y.formattedValue]),O.useEffect(function(){if(!z(t)&&z(e)&&m.formattedValue!==""){var l=parseFloat(m.numAsString);h({formattedValue:m.formattedValue,value:m.numAsString,floatValue:isNaN(l)?void 0:l},{event:void 0,source:ee.props})}},[]),[m,h]}function qe(e){return e.replace(/[^0-9]/g,"")}function ze(e){return e}function He(e){var t=e.type;t===void 0&&(t="text");var r=e.displayType;r===void 0&&(r="input");var n=e.customInput,a=e.renderText,i=e.getInputRef,f=e.format;f===void 0&&(f=ze);var p=e.removeFormatting;p===void 0&&(p=qe);var m=e.defaultValue,x=e.valueIsNumericString,h=e.onValueChange,s=e.isAllowed,S=e.onChange;S===void 0&&(S=q);var y=e.onKeyDown;y===void 0&&(y=q);var l=e.onMouseUp;l===void 0&&(l=q);var I=e.onFocus;I===void 0&&(I=q);var C=e.onBlur;C===void 0&&(C=q);var g=e.value,B=e.getCaretBoundary;B===void 0&&(B=Ze);var F=e.isValidInputCharacter;F===void 0&&(F=ae);var k=e.isCharacterSame,j=pe(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),H=we(g,m,!!x,f,p,h),P=H[0],V=P.formattedValue,M=P.numAsString,W=H[1],L=O.useRef(),U=O.useRef({formattedValue:V,numAsString:M}),$=function(o,u){U.current={formattedValue:o.formattedValue,numAsString:o.value},W(o,u)},Q=O.useState(!1),te=Q[0],d=Q[1],c=O.useRef(null),N=O.useRef({setCaretTimeout:null,focusTimeout:null});O.useEffect(function(){return d(!0),function(){clearTimeout(N.current.setCaretTimeout),clearTimeout(N.current.focusTimeout)}},[]);var R=f,A=function(o,u){var v=parseFloat(u);return{formattedValue:o,value:u,floatValue:isNaN(v)?void 0:v}},E=function(o,u,v){o.selectionStart===0&&o.selectionEnd===o.value.length||(J(o,u),N.current.setCaretTimeout=setTimeout(function(){o.value===v&&o.selectionStart!==u&&J(o,u)},0))},T=function(o,u,v){return he(o,u,B(o),v)},X=function(o,u,v){var w=B(u),_=Ge(u,V,o,v,w,F,k);return _=he(u,_,w),_},oe=function(o){var u=o.formattedValue;u===void 0&&(u="");var v=o.input,w=o.source,_=o.event,D=o.numAsString,b;if(v){var K=o.inputValue||v.value,G=ce(v);v.value=u,b=X(K,u,G),b!==void 0&&E(v,b,u)}u!==V&&$(A(u,D),{event:_,source:w})};O.useEffect(function(){var o=U.current,u=o.formattedValue,v=o.numAsString;(V!==u||M!==v)&&$(A(V,M),{event:void 0,source:ee.props})},[V,M]);var re=c.current?ce(c.current):void 0,ne=typeof window<"u"?O.useLayoutEffect:O.useEffect;ne(function(){var o=c.current;if(V!==U.current.formattedValue&&o){var u=X(U.current.formattedValue,V,re);o.value=V,E(o,u,V)}},[V]);var ue=function(o,u,v){var w=u.target,_=L.current?Pe(L.current,w.selectionEnd):Ne(V,o),D=Object.assign(Object.assign({},_),{lastValue:V}),b=p(o,D),K=R(b);if(b=p(K,void 0),s&&!s(A(K,b))){var G=u.target,Z=ce(G),le=X(o,V,Z);return G.value=V,E(G,le,V),!1}return oe({formattedValue:K,numAsString:b,inputValue:o,event:u,source:v,input:u.target}),!0},fe=function(o,u){u===void 0&&(u=0);var v=o.selectionStart,w=o.selectionEnd;L.current={selectionStart:v,selectionEnd:w+u}},Ie=function(o){var u=o.target,v=u.value,w=ue(v,o,ee.event);w&&S(o),L.current=void 0},Ce=function(o){var u=o.target,v=o.key,w=u.selectionStart,_=u.selectionEnd,D=u.value;D===void 0&&(D="");var b;v==="ArrowLeft"||v==="Backspace"?b=Math.max(w-1,0):v==="ArrowRight"?b=Math.min(w+1,D.length):v==="Delete"&&(b=w);var K=0;v==="Delete"&&w===_&&(K=1);var G=v==="ArrowLeft"||v==="ArrowRight";if(b===void 0||w!==_&&!G){y(o),fe(u,K);return}var Z=b;if(G){var le=v==="ArrowLeft"?"left":"right";Z=T(D,b,le),Z!==b&&o.preventDefault()}else v==="Delete"&&!F(D[b])?Z=T(D,b,"right"):v==="Backspace"&&!F(D[b])&&(Z=T(D,b,"left"));Z!==b&&E(u,Z,D),y(o),fe(u,K)},Ee=function(o){var u=o.target,v=function(){var w=u.selectionStart,_=u.selectionEnd,D=u.value;if(D===void 0&&(D=""),w===_){var b=T(D,w);b!==w&&E(u,b,D)}};v(),requestAnimationFrame(function(){v()}),l(o),fe(u)},Re=function(o){o.persist&&o.persist();var u=o.target,v=o.currentTarget;c.current=u,N.current.focusTimeout=setTimeout(function(){var w=u.selectionStart,_=u.selectionEnd,D=u.value;D===void 0&&(D="");var b=T(D,w);b!==w&&!(w===0&&_===D.length)&&E(u,b,D),I(Object.assign(Object.assign({},o),{currentTarget:v}))},0)},Ae=function(o){c.current=null,clearTimeout(N.current.focusTimeout),clearTimeout(N.current.setCaretTimeout),C(o)},Oe=te&&We()?"numeric":void 0,ve=Object.assign({inputMode:Oe},j,{type:t,value:V,onChange:Ie,onKeyDown:Ce,onMouseUp:Ee,onFocus:Re,onBlur:Ae});if(r==="text")return a?Y.createElement(Y.Fragment,null,a(V,j)||null):Y.createElement("span",Object.assign({},j,{ref:i}),V);if(n){var Te=n;return Y.createElement(Te,Object.assign({},ve,{ref:i}))}return Y.createElement("input",Object.assign({},ve,{ref:i}))}function Se(e,t){var r=t.decimalScale,n=t.fixedDecimalScale,a=t.prefix;a===void 0&&(a="");var i=t.suffix;i===void 0&&(i="");var f=t.allowNegative,p=t.thousandsGroupStyle;if(p===void 0&&(p="thousand"),e===""||e==="-")return e;var m=ie(t),x=m.thousandSeparator,h=m.decimalSeparator,s=r!==0&&e.indexOf(".")!==-1||r&&n,S=se(e,f),y=S.beforeDecimal,l=S.afterDecimal,I=S.addNegation;return r!==void 0&&(l=be(l,r,!!n)),x&&(y=Le(y,x,p)),a&&(y=a+y),i&&(l=l+i),I&&(y="-"+y),e=y+(s&&h||"")+l,e}function ie(e){var t=e.decimalSeparator;t===void 0&&(t=".");var r=e.thousandSeparator,n=e.allowedDecimalSeparators;return r===!0&&(r=","),n||(n=[t,"."]),{decimalSeparator:t,thousandSeparator:r,allowedDecimalSeparators:n}}function Je(e,t){e===void 0&&(e="");var r=new RegExp("(-)"),n=new RegExp("(-)(.)*(-)"),a=r.test(e),i=n.test(e);return e=e.replace(/-/g,""),a&&!i&&t&&(e="-"+e),e}function Qe(e,t){return new RegExp("(^-)|[0-9]|"+ye(e),"g")}function Xe(e,t,r){return e===""?!0:!(t!=null&&t.match(/\d/))&&!(r!=null&&r.match(/\d/))&&typeof e=="string"&&!isNaN(Number(e))}function Ye(e,t,r){var n;t===void 0&&(t=Ue(e));var a=r.allowNegative,i=r.prefix;i===void 0&&(i="");var f=r.suffix;f===void 0&&(f="");var p=r.decimalScale,m=t.from,x=t.to,h=x.start,s=x.end,S=ie(r),y=S.allowedDecimalSeparators,l=S.decimalSeparator,I=e[s]===l;if(ae(e)&&(e===i||e===f)&&t.lastValue==="")return e;if(s-h===1&&y.indexOf(e[h])!==-1){var C=p===0?"":l;e=e.substring(0,h)+C+e.substring(h+1,e.length)}var g=function(c,N,R){var A=!1,E=!1;i.startsWith("-")?A=!1:c.startsWith("--")?(A=!1,E=!0):f.startsWith("-")&&c.length===f.length?A=!1:c[0]==="-"&&(A=!0);var T=A?1:0;return E&&(T=2),T&&(c=c.substring(T),N-=T,R-=T),{value:c,start:N,end:R,hasNegation:A}},B=g(e,h,s),F=B.hasNegation;n=B,e=n.value,h=n.start,s=n.end;var k=g(t.lastValue,m.start,m.end),j=k.start,H=k.end,P=k.value,V=e.substring(h,s);e.length&&P.length&&(j>P.length-f.length||H<i.length)&&!(V&&f.startsWith(V))&&(e=P);var M=0;e.startsWith(i)?M+=i.length:h<i.length&&(M=h),e=e.substring(M),s-=M;var W=e.length,L=e.length-f.length;e.endsWith(f)?W=L:(s>L||s>e.length-f.length)&&(W=s),e=e.substring(0,W),e=Je(F?"-"+e:e,a),e=(e.match(Qe(l))||[]).join("");var U=e.indexOf(l);e=e.replace(new RegExp(ye(l),"g"),function(c,N){return N===U?".":""});var $=se(e,a),Q=$.beforeDecimal,te=$.afterDecimal,d=$.addNegation;return x.end-x.start<m.end-m.start&&Q===""&&I&&!parseFloat(te)&&(e=d?"-":""),e}function et(e,t){var r=t.prefix;r===void 0&&(r="");var n=t.suffix;n===void 0&&(n="");var a=Array.from({length:e.length+1}).map(function(){return!0}),i=e[0]==="-";a.fill(!1,0,Math.min(r.length+(i?1:0),e.length));var f=e.length;return a.fill(!1,f-n.length+1,f+1),a}function tt(e){var t=ie(e),r=t.thousandSeparator,n=t.decimalSeparator,a=e.prefix;a===void 0&&(a="");var i=e.allowNegative;if(i===void 0&&(i=!0),r===n)throw new Error(`
|
|
1
|
+
import{ad as Y,r as O}from"./index-BDqLFfPf.js";import{s as Be}from"./DatasetView-B1KoSX7p.js";const Fe=Be("div")({name:"NumberOverlayEditorStyle",class:"gdg-n15fjm3e",propsAsIs:!1});function pe(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r}var ee;(function(e){e.event="event",e.props="prop"})(ee||(ee={}));function q(){}function _e(e){var t,r=void 0;return function(){for(var n=[],a=arguments.length;a--;)n[a]=arguments[a];return t&&n.length===t.length&&n.every(function(i,f){return i===t[f]})||(t=n,r=e.apply(void 0,n)),r}}function ae(e){return!!(e||"").match(/\d/)}function z(e){return e==null}function je(e){return typeof e=="number"&&isNaN(e)}function xe(e){return z(e)||je(e)||typeof e=="number"&&!isFinite(e)}function ye(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function Me(e){switch(e){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;case"thousand":default:return/(\d)(?=(\d{3})+(?!\d))/g}}function Le(e,t,r){var n=Me(r),a=e.search(/[1-9]/);return a=a===-1?e.length:a,e.substring(0,a)+e.substring(a,e.length).replace(n,"$1"+t)}function de(e){var t=O.useRef(e);t.current=e;var r=O.useRef(function(){for(var n=[],a=arguments.length;a--;)n[a]=arguments[a];return t.current.apply(t,n)});return r.current}function se(e,t){t===void 0&&(t=!0);var r=e[0]==="-",n=r&&t;e=e.replace("-","");var a=e.split("."),i=a[0],f=a[1]||"";return{beforeDecimal:i,afterDecimal:f,hasNegation:r,addNegation:n}}function ke(e){if(!e)return e;var t=e[0]==="-";t&&(e=e.substring(1,e.length));var r=e.split("."),n=r[0].replace(/^0+/,"")||"0",a=r[1]||"";return(t?"-":"")+n+(a?"."+a:"")}function be(e,t,r){for(var n="",a=r?"0":"",i=0;i<=t-1;i++)n+=e[i]||a;return n}function ge(e,t){return Array(t+1).join(e)}function Ve(e){var t=e+"",r=t[0]==="-"?"-":"";r&&(t=t.substring(1));var n=t.split(/[eE]/g),a=n[0],i=n[1];if(i=Number(i),!i)return r+a;a=a.replace(".","");var f=1+i,p=a.length;return f<0?a="0."+ge("0",Math.abs(f))+a:f>=p?a=a+ge("0",f-p):a=(a.substring(0,f)||"0")+"."+a.substring(f),r+a}function me(e,t,r){if(["","-"].indexOf(e)!==-1)return e;var n=(e.indexOf(".")!==-1||r)&&t,a=se(e),i=a.beforeDecimal,f=a.afterDecimal,p=a.hasNegation,m=parseFloat("0."+(f||"0")),x=f.length<=t?"0."+f:m.toFixed(t),h=x.split("."),s=i;i&&Number(h[0])&&(s=i.split("").reverse().reduce(function(I,C,g){return I.length>g?(Number(I[0])+Number(C)).toString()+I.substring(1,I.length):C+I},h[0]));var S=be(h[1]||"",t,r),y=p?"-":"",l=n?".":"";return""+y+s+l+S}function J(e,t){if(e.value=e.value,e!==null){if(e.createTextRange){var r=e.createTextRange();return r.move("character",t),r.select(),!0}return e.selectionStart||e.selectionStart===0?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}var Ne=_e(function(e,t){for(var r=0,n=0,a=e.length,i=t.length;e[r]===t[r]&&r<a;)r++;for(;e[a-1-n]===t[i-1-n]&&i-n>r&&a-n>r;)n++;return{from:{start:r,end:a-n},to:{start:r,end:i-n}}}),Pe=function(e,t){var r=Math.min(e.selectionStart,t);return{from:{start:r,end:e.selectionEnd},to:{start:r,end:t}}};function Ke(e,t,r){return Math.min(Math.max(e,t),r)}function ce(e){return Math.max(e.selectionStart,e.selectionEnd)}function We(){return typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function Ue(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function $e(e){var t=e.currentValue,r=e.formattedValue,n=e.currentValueIndex,a=e.formattedValueIndex;return t[n]===r[a]}function Ge(e,t,r,n,a,i,f){f===void 0&&(f=$e);var p=a.findIndex(function(k){return k}),m=e.slice(0,p);!t&&!r.startsWith(m)&&(t=m,r=m+r,n=n+m.length);for(var x=r.length,h=e.length,s={},S=new Array(x),y=0;y<x;y++){S[y]=-1;for(var l=0,I=h;l<I;l++){var C=f({currentValue:r,lastValue:t,formattedValue:e,currentValueIndex:y,formattedValueIndex:l});if(C&&s[l]!==!0){S[y]=l,s[l]=!0;break}}}for(var g=n;g<x&&(S[g]===-1||!i(r[g]));)g++;var B=g===x||S[g]===-1?h:S[g];for(g=n-1;g>0&&S[g]===-1;)g--;var F=g===-1||S[g]===-1?0:S[g]+1;return F>B?B:n-F<B-n?F:B}function he(e,t,r,n){var a=e.length;if(t=Ke(t,0,a),n==="left"){for(;t>=0&&!r[t];)t--;t===-1&&(t=r.indexOf(!0))}else{for(;t<=a&&!r[t];)t++;t>a&&(t=r.lastIndexOf(!0))}return t===-1&&(t=a),t}function Ze(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),r=0,n=t.length;r<n;r++)t[r]=!!(ae(e[r])||ae(e[r-1]));return t}function we(e,t,r,n,a,i){i===void 0&&(i=q);var f=de(function(l,I){var C,g;return xe(l)?(g="",C=""):typeof l=="number"||I?(g=typeof l=="number"?Ve(l):l,C=n(g)):(g=a(l,void 0),C=n(g)),{formattedValue:C,numAsString:g}}),p=O.useState(function(){return f(z(e)?t:e,r)}),m=p[0],x=p[1],h=de(function(l,I){l.formattedValue!==m.formattedValue&&x({formattedValue:l.formattedValue,numAsString:l.value}),i(l,I)}),s=e,S=r;z(e)&&(s=m.numAsString,S=!0);var y=f(s,S);return O.useMemo(function(){x(y)},[y.formattedValue]),O.useEffect(function(){if(!z(t)&&z(e)&&m.formattedValue!==""){var l=parseFloat(m.numAsString);h({formattedValue:m.formattedValue,value:m.numAsString,floatValue:isNaN(l)?void 0:l},{event:void 0,source:ee.props})}},[]),[m,h]}function qe(e){return e.replace(/[^0-9]/g,"")}function ze(e){return e}function He(e){var t=e.type;t===void 0&&(t="text");var r=e.displayType;r===void 0&&(r="input");var n=e.customInput,a=e.renderText,i=e.getInputRef,f=e.format;f===void 0&&(f=ze);var p=e.removeFormatting;p===void 0&&(p=qe);var m=e.defaultValue,x=e.valueIsNumericString,h=e.onValueChange,s=e.isAllowed,S=e.onChange;S===void 0&&(S=q);var y=e.onKeyDown;y===void 0&&(y=q);var l=e.onMouseUp;l===void 0&&(l=q);var I=e.onFocus;I===void 0&&(I=q);var C=e.onBlur;C===void 0&&(C=q);var g=e.value,B=e.getCaretBoundary;B===void 0&&(B=Ze);var F=e.isValidInputCharacter;F===void 0&&(F=ae);var k=e.isCharacterSame,j=pe(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),H=we(g,m,!!x,f,p,h),P=H[0],V=P.formattedValue,M=P.numAsString,W=H[1],L=O.useRef(),U=O.useRef({formattedValue:V,numAsString:M}),$=function(o,u){U.current={formattedValue:o.formattedValue,numAsString:o.value},W(o,u)},Q=O.useState(!1),te=Q[0],d=Q[1],c=O.useRef(null),N=O.useRef({setCaretTimeout:null,focusTimeout:null});O.useEffect(function(){return d(!0),function(){clearTimeout(N.current.setCaretTimeout),clearTimeout(N.current.focusTimeout)}},[]);var R=f,A=function(o,u){var v=parseFloat(u);return{formattedValue:o,value:u,floatValue:isNaN(v)?void 0:v}},E=function(o,u,v){o.selectionStart===0&&o.selectionEnd===o.value.length||(J(o,u),N.current.setCaretTimeout=setTimeout(function(){o.value===v&&o.selectionStart!==u&&J(o,u)},0))},T=function(o,u,v){return he(o,u,B(o),v)},X=function(o,u,v){var w=B(u),_=Ge(u,V,o,v,w,F,k);return _=he(u,_,w),_},oe=function(o){var u=o.formattedValue;u===void 0&&(u="");var v=o.input,w=o.source,_=o.event,D=o.numAsString,b;if(v){var K=o.inputValue||v.value,G=ce(v);v.value=u,b=X(K,u,G),b!==void 0&&E(v,b,u)}u!==V&&$(A(u,D),{event:_,source:w})};O.useEffect(function(){var o=U.current,u=o.formattedValue,v=o.numAsString;(V!==u||M!==v)&&$(A(V,M),{event:void 0,source:ee.props})},[V,M]);var re=c.current?ce(c.current):void 0,ne=typeof window<"u"?O.useLayoutEffect:O.useEffect;ne(function(){var o=c.current;if(V!==U.current.formattedValue&&o){var u=X(U.current.formattedValue,V,re);o.value=V,E(o,u,V)}},[V]);var ue=function(o,u,v){var w=u.target,_=L.current?Pe(L.current,w.selectionEnd):Ne(V,o),D=Object.assign(Object.assign({},_),{lastValue:V}),b=p(o,D),K=R(b);if(b=p(K,void 0),s&&!s(A(K,b))){var G=u.target,Z=ce(G),le=X(o,V,Z);return G.value=V,E(G,le,V),!1}return oe({formattedValue:K,numAsString:b,inputValue:o,event:u,source:v,input:u.target}),!0},fe=function(o,u){u===void 0&&(u=0);var v=o.selectionStart,w=o.selectionEnd;L.current={selectionStart:v,selectionEnd:w+u}},Ie=function(o){var u=o.target,v=u.value,w=ue(v,o,ee.event);w&&S(o),L.current=void 0},Ce=function(o){var u=o.target,v=o.key,w=u.selectionStart,_=u.selectionEnd,D=u.value;D===void 0&&(D="");var b;v==="ArrowLeft"||v==="Backspace"?b=Math.max(w-1,0):v==="ArrowRight"?b=Math.min(w+1,D.length):v==="Delete"&&(b=w);var K=0;v==="Delete"&&w===_&&(K=1);var G=v==="ArrowLeft"||v==="ArrowRight";if(b===void 0||w!==_&&!G){y(o),fe(u,K);return}var Z=b;if(G){var le=v==="ArrowLeft"?"left":"right";Z=T(D,b,le),Z!==b&&o.preventDefault()}else v==="Delete"&&!F(D[b])?Z=T(D,b,"right"):v==="Backspace"&&!F(D[b])&&(Z=T(D,b,"left"));Z!==b&&E(u,Z,D),y(o),fe(u,K)},Ee=function(o){var u=o.target,v=function(){var w=u.selectionStart,_=u.selectionEnd,D=u.value;if(D===void 0&&(D=""),w===_){var b=T(D,w);b!==w&&E(u,b,D)}};v(),requestAnimationFrame(function(){v()}),l(o),fe(u)},Re=function(o){o.persist&&o.persist();var u=o.target,v=o.currentTarget;c.current=u,N.current.focusTimeout=setTimeout(function(){var w=u.selectionStart,_=u.selectionEnd,D=u.value;D===void 0&&(D="");var b=T(D,w);b!==w&&!(w===0&&_===D.length)&&E(u,b,D),I(Object.assign(Object.assign({},o),{currentTarget:v}))},0)},Ae=function(o){c.current=null,clearTimeout(N.current.focusTimeout),clearTimeout(N.current.setCaretTimeout),C(o)},Oe=te&&We()?"numeric":void 0,ve=Object.assign({inputMode:Oe},j,{type:t,value:V,onChange:Ie,onKeyDown:Ce,onMouseUp:Ee,onFocus:Re,onBlur:Ae});if(r==="text")return a?Y.createElement(Y.Fragment,null,a(V,j)||null):Y.createElement("span",Object.assign({},j,{ref:i}),V);if(n){var Te=n;return Y.createElement(Te,Object.assign({},ve,{ref:i}))}return Y.createElement("input",Object.assign({},ve,{ref:i}))}function Se(e,t){var r=t.decimalScale,n=t.fixedDecimalScale,a=t.prefix;a===void 0&&(a="");var i=t.suffix;i===void 0&&(i="");var f=t.allowNegative,p=t.thousandsGroupStyle;if(p===void 0&&(p="thousand"),e===""||e==="-")return e;var m=ie(t),x=m.thousandSeparator,h=m.decimalSeparator,s=r!==0&&e.indexOf(".")!==-1||r&&n,S=se(e,f),y=S.beforeDecimal,l=S.afterDecimal,I=S.addNegation;return r!==void 0&&(l=be(l,r,!!n)),x&&(y=Le(y,x,p)),a&&(y=a+y),i&&(l=l+i),I&&(y="-"+y),e=y+(s&&h||"")+l,e}function ie(e){var t=e.decimalSeparator;t===void 0&&(t=".");var r=e.thousandSeparator,n=e.allowedDecimalSeparators;return r===!0&&(r=","),n||(n=[t,"."]),{decimalSeparator:t,thousandSeparator:r,allowedDecimalSeparators:n}}function Je(e,t){e===void 0&&(e="");var r=new RegExp("(-)"),n=new RegExp("(-)(.)*(-)"),a=r.test(e),i=n.test(e);return e=e.replace(/-/g,""),a&&!i&&t&&(e="-"+e),e}function Qe(e,t){return new RegExp("(^-)|[0-9]|"+ye(e),"g")}function Xe(e,t,r){return e===""?!0:!(t!=null&&t.match(/\d/))&&!(r!=null&&r.match(/\d/))&&typeof e=="string"&&!isNaN(Number(e))}function Ye(e,t,r){var n;t===void 0&&(t=Ue(e));var a=r.allowNegative,i=r.prefix;i===void 0&&(i="");var f=r.suffix;f===void 0&&(f="");var p=r.decimalScale,m=t.from,x=t.to,h=x.start,s=x.end,S=ie(r),y=S.allowedDecimalSeparators,l=S.decimalSeparator,I=e[s]===l;if(ae(e)&&(e===i||e===f)&&t.lastValue==="")return e;if(s-h===1&&y.indexOf(e[h])!==-1){var C=p===0?"":l;e=e.substring(0,h)+C+e.substring(h+1,e.length)}var g=function(c,N,R){var A=!1,E=!1;i.startsWith("-")?A=!1:c.startsWith("--")?(A=!1,E=!0):f.startsWith("-")&&c.length===f.length?A=!1:c[0]==="-"&&(A=!0);var T=A?1:0;return E&&(T=2),T&&(c=c.substring(T),N-=T,R-=T),{value:c,start:N,end:R,hasNegation:A}},B=g(e,h,s),F=B.hasNegation;n=B,e=n.value,h=n.start,s=n.end;var k=g(t.lastValue,m.start,m.end),j=k.start,H=k.end,P=k.value,V=e.substring(h,s);e.length&&P.length&&(j>P.length-f.length||H<i.length)&&!(V&&f.startsWith(V))&&(e=P);var M=0;e.startsWith(i)?M+=i.length:h<i.length&&(M=h),e=e.substring(M),s-=M;var W=e.length,L=e.length-f.length;e.endsWith(f)?W=L:(s>L||s>e.length-f.length)&&(W=s),e=e.substring(0,W),e=Je(F?"-"+e:e,a),e=(e.match(Qe(l))||[]).join("");var U=e.indexOf(l);e=e.replace(new RegExp(ye(l),"g"),function(c,N){return N===U?".":""});var $=se(e,a),Q=$.beforeDecimal,te=$.afterDecimal,d=$.addNegation;return x.end-x.start<m.end-m.start&&Q===""&&I&&!parseFloat(te)&&(e=d?"-":""),e}function et(e,t){var r=t.prefix;r===void 0&&(r="");var n=t.suffix;n===void 0&&(n="");var a=Array.from({length:e.length+1}).map(function(){return!0}),i=e[0]==="-";a.fill(!1,0,Math.min(r.length+(i?1:0),e.length));var f=e.length;return a.fill(!1,f-n.length+1,f+1),a}function tt(e){var t=ie(e),r=t.thousandSeparator,n=t.decimalSeparator,a=e.prefix;a===void 0&&(a="");var i=e.allowNegative;if(i===void 0&&(i=!0),r===n)throw new Error(`
|
|
2
2
|
Decimal separator can't be same as thousand separator.
|
|
3
3
|
thousandSeparator: `+r+` (thousandSeparator = {true} is same as thousandSeparator = ",")
|
|
4
4
|
decimalSeparator: `+n+` (default value for decimalSeparator is .)
|
package/dist/client/index.html
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
9
9
|
<title>Evalution</title>
|
|
10
10
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
|
|
11
|
-
<script type="module" crossorigin src="/assets/index-
|
|
11
|
+
<script type="module" crossorigin src="/assets/index-BDqLFfPf.js"></script>
|
|
12
12
|
<link rel="stylesheet" crossorigin href="/assets/index-KCv8AeiY.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as normalizeOtlpRequest, s as decodeOtlpProtobuf } from "./trace-event-ingestor-
|
|
1
|
+
import { c as normalizeOtlpRequest, s as decodeOtlpProtobuf } from "./trace-event-ingestor-fjlL_FYB.js";
|
|
2
2
|
//#region src/server/handlers/otlp-ingest.ts
|
|
3
3
|
/**
|
|
4
4
|
* Host-neutral handler for an OTLP trace export request (`POST /v1/traces`).
|
package/dist/index.d.ts
CHANGED
|
@@ -3676,7 +3676,7 @@ declare function createLocalTursoClient({
|
|
|
3676
3676
|
* server. A test checks every column of `./schema.ts` is described here.
|
|
3677
3677
|
*/
|
|
3678
3678
|
/** The trace database's tables, described for someone writing SQL against them. */
|
|
3679
|
-
declare const TRACE_QUERY_SCHEMA = "-- Trace database (SQLite). Timestamps are milliseconds since the Unix epoch.\n-- Columns marked JSON hold JSON text; read into them with json_extract(),\n-- e.g. json_extract(llm_parameters, '$.temperature').\n\n-- One row per trace: a single run, e.g. one prompt execution.\nCREATE TABLE traces (\n id TEXT PRIMARY KEY,\n provider_id TEXT, -- the trace provider that recorded it\n name TEXT NOT NULL, -- usually the prompt's name\n start_time REAL NOT NULL, -- ms since epoch\n end_time REAL, -- ms since epoch; NULL while running\n status TEXT NOT NULL, -- 'running' | 'ok' | 'error'\n attributes TEXT -- JSON object of free-form attributes\n);\n\n-- One row per span. Spans form a tree per trace via parent_id.\nCREATE TABLE spans (\n id TEXT PRIMARY KEY,\n trace_id TEXT NOT NULL, -- traces.id\n parent_id TEXT, -- spans.id; NULL for the root span\n name TEXT NOT NULL,\n kind TEXT NOT NULL, -- 'LLM' | 'TOOL' | 'AGENT' | 'EMBEDDING' | 'CHECK' | 'DEFAULT'\n start_time REAL NOT NULL, -- ms since epoch\n end_time REAL, -- ms since epoch; NULL while running\n status TEXT, -- 'ok' | 'error'; NULL while running\n error_message TEXT,\n llm_provider TEXT, -- e.g. 'openai', 'anthropic'\n llm_model TEXT, -- e.g. 'gpt-4o'\n llm_finish_reason TEXT, -- e.g. 'stop', 'length', 'tool-calls'\n llm_prompt_tokens INTEGER, -- includes cache reads and writes\n llm_completion_tokens INTEGER,\n llm_total_tokens INTEGER,\n llm_cache_read_tokens INTEGER, -- of llm_prompt_tokens, read from a prompt cache\n llm_cache_write_tokens INTEGER, -- of llm_prompt_tokens, written to a prompt cache\n llm_cost_prompt REAL, -- USD, cache reads and writes included\n llm_cost_completion REAL, -- USD\n llm_cost_cache_read REAL, -- USD, the part of llm_cost_prompt spent on cache reads\n llm_cost_cache_write REAL, -- USD, the part of llm_cost_prompt spent on cache writes\n llm_input TEXT, -- JSON: an array of messages {role, content}, or any JSON object\n llm_output TEXT, -- JSON: always encoded, so a text output is a JSON string\n llm_reasoning TEXT, -- the model's reasoning for this turn, as plain text\n llm_parameters TEXT, -- JSON object of model parameters (temperature, ...)\n attributes TEXT, -- JSON object of free-form attributes; \"evalution.check\" is set on spans an eval check recorded while judging the trace (its CHECK span and everything under it), which aren't part of the run\n resource TEXT, -- JSON object: the OTel resource that produced the span (\"service.name\", \"deployment.environment.name\" = 'playground' for runs evalution made, ...)\n prompt TEXT, -- JSON {id, providerId?, version?, variation?, functionInputs?, executeInputs?, ...}: the prompt this span ran\n tool TEXT -- JSON {toolName, input, output?} for TOOL spans\n);\n\n-- Notes left on a trace, or on one span of it.\nCREATE TABLE annotations (\n id TEXT PRIMARY KEY,\n trace_id TEXT NOT NULL, -- traces.id\n span_id TEXT, -- spans.id; NULL for a note on the whole trace\n kind TEXT NOT NULL, -- 'issue' | 'good' | 'note'\n note TEXT NOT NULL,\n source TEXT NOT NULL, -- 'user' | 'claude-code' | 'codex' | 'agent'\n created_at REAL NOT NULL -- ms since epoch\n);\n";
|
|
3679
|
+
declare const TRACE_QUERY_SCHEMA = "-- Trace database (SQLite). Timestamps are milliseconds since the Unix epoch.\n-- Columns marked JSON hold JSON text; read into them with json_extract(),\n-- e.g. json_extract(llm_parameters, '$.temperature').\n\n-- One row per trace: a single run, e.g. one prompt execution.\nCREATE TABLE traces (\n id TEXT PRIMARY KEY,\n provider_id TEXT, -- the trace provider that recorded it\n name TEXT NOT NULL, -- usually the prompt's name\n start_time REAL NOT NULL, -- ms since epoch\n end_time REAL, -- ms since epoch; NULL while running\n status TEXT NOT NULL, -- 'running' | 'ok' | 'error'\n attributes TEXT -- JSON object of free-form attributes\n);\n\n-- One row per span. Spans form a tree per trace via parent_id.\nCREATE TABLE spans (\n id TEXT PRIMARY KEY,\n trace_id TEXT NOT NULL, -- traces.id\n parent_id TEXT, -- spans.id; NULL for the root span\n name TEXT NOT NULL,\n kind TEXT NOT NULL, -- 'LLM' | 'TOOL' | 'AGENT' | 'EMBEDDING' | 'CHECK' | 'DEFAULT'\n start_time REAL NOT NULL, -- ms since epoch\n end_time REAL, -- ms since epoch; NULL while running\n status TEXT, -- 'ok' | 'error'; NULL while running\n error_message TEXT,\n llm_provider TEXT, -- e.g. 'openai', 'anthropic'\n llm_model TEXT, -- e.g. 'gpt-4o'\n llm_finish_reason TEXT, -- e.g. 'stop', 'length', 'tool-calls'\n llm_effort TEXT, -- e.g. 'low', 'medium', 'high'\n llm_prompt_tokens INTEGER, -- includes cache reads and writes\n llm_completion_tokens INTEGER,\n llm_total_tokens INTEGER,\n llm_cache_read_tokens INTEGER, -- of llm_prompt_tokens, read from a prompt cache\n llm_cache_write_tokens INTEGER, -- of llm_prompt_tokens, written to a prompt cache\n llm_cost_prompt REAL, -- USD, cache reads and writes included\n llm_cost_completion REAL, -- USD\n llm_cost_cache_read REAL, -- USD, the part of llm_cost_prompt spent on cache reads\n llm_cost_cache_write REAL, -- USD, the part of llm_cost_prompt spent on cache writes\n llm_input TEXT, -- JSON: an array of messages {role, content}, or any JSON object\n llm_output TEXT, -- JSON: always encoded, so a text output is a JSON string\n llm_reasoning TEXT, -- the model's reasoning for this turn, as plain text\n llm_parameters TEXT, -- JSON object of model parameters (temperature, ...)\n attributes TEXT, -- JSON object of free-form attributes; \"evalution.check\" is set on spans an eval check recorded while judging the trace (its CHECK span and everything under it), which aren't part of the run\n resource TEXT, -- JSON object: the OTel resource that produced the span (\"service.name\", \"deployment.environment.name\" = 'playground' for runs evalution made, ...)\n prompt TEXT, -- JSON {id, providerId?, version?, variation?, functionInputs?, executeInputs?, ...}: the prompt this span ran\n tool TEXT -- JSON {toolName, input, output?} for TOOL spans\n);\n\n-- Notes left on a trace, or on one span of it.\nCREATE TABLE annotations (\n id TEXT PRIMARY KEY,\n trace_id TEXT NOT NULL, -- traces.id\n span_id TEXT, -- spans.id; NULL for a note on the whole trace\n kind TEXT NOT NULL, -- 'issue' | 'good' | 'note'\n note TEXT NOT NULL,\n source TEXT NOT NULL, -- 'user' | 'claude-code' | 'codex' | 'agent'\n created_at REAL NOT NULL -- ms since epoch\n);\n";
|
|
3680
3680
|
//#endregion
|
|
3681
3681
|
//#region src/trace/local-database-trace-provider.d.ts
|
|
3682
3682
|
interface LocalDatabaseTraceProviderOptions {
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as promptIdOf, Ct as registerFreshImportHook, D as DEFAULT_QUERY_TIMEOUT_MS, E as DEFAULT_MAX_QUERY_ROWS, F as DatasetNotFoundError, I as DatasetValidationError, L as DEFAULT_EVAL_CONCURRENCY, O as SqlQueryError, R as EvalRunRefusedError, S as VariationConflictError, St as isFreshImportHookRegistered, T as EvalNotFoundError, _ as assertSqliteFile, _t as isStandardSchema, a as CloudTraceProvider, at as collectInputSlots, b as rollupSpans, bt as isVariationLoaderHookRegistered, c as LocalEvalProvider, d as runEvalMigrations, dt as DEFAULT_PLAYGROUND_INCLUDE_PATTERNS, f as LocalDirectoryDatasetProvider, ft as ResourceRegistry, g as runMigrations, gt as isResource, h as MIGRATIONS_TABLE, ht as isValidInstanceName, i as BaseTraceProvider, it as stampReceipts, l as openLocalEvalProvider, lt as namedBindings, m as runDatasetMigrations, mt as resourceParameterNames, n as TursoTraceProvider, nt as resolveExecutionInput, o as WorkspaceSync, ot as findInputCycle, p as TursoDatasetProvider, pt as parameterDetails, r as TRACE_QUERY_SCHEMA, rt as resolveExecutionInputs, s as DatabaseSync, st as inputReferenceProblems, t as LocalDatabaseTraceProvider, tt as matchSourcesToSlots, u as TursoEvalProvider, ut as DEFAULT_PLAYGROUND_IGNORE_PATTERNS, v as createLocalTursoClient, vt as resource, w as toPromptRef, xt as registerVariationLoaderHook, y as mkdirSelfIgnoring, yt as LocalFileProvider, z as EvalRunner } from "./local-database-trace-provider-
|
|
1
|
+
import { C as promptIdOf, Ct as registerFreshImportHook, D as DEFAULT_QUERY_TIMEOUT_MS, E as DEFAULT_MAX_QUERY_ROWS, F as DatasetNotFoundError, I as DatasetValidationError, L as DEFAULT_EVAL_CONCURRENCY, O as SqlQueryError, R as EvalRunRefusedError, S as VariationConflictError, St as isFreshImportHookRegistered, T as EvalNotFoundError, _ as assertSqliteFile, _t as isStandardSchema, a as CloudTraceProvider, at as collectInputSlots, b as rollupSpans, bt as isVariationLoaderHookRegistered, c as LocalEvalProvider, d as runEvalMigrations, dt as DEFAULT_PLAYGROUND_INCLUDE_PATTERNS, f as LocalDirectoryDatasetProvider, ft as ResourceRegistry, g as runMigrations, gt as isResource, h as MIGRATIONS_TABLE, ht as isValidInstanceName, i as BaseTraceProvider, it as stampReceipts, l as openLocalEvalProvider, lt as namedBindings, m as runDatasetMigrations, mt as resourceParameterNames, n as TursoTraceProvider, nt as resolveExecutionInput, o as WorkspaceSync, ot as findInputCycle, p as TursoDatasetProvider, pt as parameterDetails, r as TRACE_QUERY_SCHEMA, rt as resolveExecutionInputs, s as DatabaseSync, st as inputReferenceProblems, t as LocalDatabaseTraceProvider, tt as matchSourcesToSlots, u as TursoEvalProvider, ut as DEFAULT_PLAYGROUND_IGNORE_PATTERNS, v as createLocalTursoClient, vt as resource, w as toPromptRef, xt as registerVariationLoaderHook, y as mkdirSelfIgnoring, yt as LocalFileProvider, z as EvalRunner } from "./local-database-trace-provider-BHe2hLFA.js";
|
|
2
2
|
import { _ as isCheck, g as check, n as builtinCheck, r as builtinCheckInfos } from "./checks-Cq97JU-h.js";
|
|
3
|
-
import { a as readKind, c as normalizeOtlpRequest, f as shortId, i as mapStatus, l as isEditable, n as OtlpTraceIngestor, o as mergeSpans, r as llmAndPrompt, s as decodeOtlpProtobuf, t as TraceEventIngestor } from "./trace-event-ingestor-
|
|
3
|
+
import { a as readKind, c as normalizeOtlpRequest, f as shortId, i as mapStatus, l as isEditable, n as OtlpTraceIngestor, o as mergeSpans, r as llmAndPrompt, s as decodeOtlpProtobuf, t as TraceEventIngestor } from "./trace-event-ingestor-fjlL_FYB.js";
|
|
4
4
|
import "node:module";
|
|
5
5
|
import path, { dirname } from "node:path";
|
|
6
6
|
import { access, realpath } from "node:fs/promises";
|
package/dist/ingest.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { c as normalizeOtlpRequest, n as OtlpTraceIngestor, o as mergeSpans, s as decodeOtlpProtobuf, t as TraceEventIngestor } from "./trace-event-ingestor-
|
|
2
|
-
import { n as handleTraceEvents, r as handleOtlpTraces, t as CostFetchingTraceSink } from "./cost-fetching-trace-sink-
|
|
1
|
+
import { c as normalizeOtlpRequest, n as OtlpTraceIngestor, o as mergeSpans, s as decodeOtlpProtobuf, t as TraceEventIngestor } from "./trace-event-ingestor-fjlL_FYB.js";
|
|
2
|
+
import { n as handleTraceEvents, r as handleOtlpTraces, t as CostFetchingTraceSink } from "./cost-fetching-trace-sink-BEqbMdt1.js";
|
|
3
3
|
export { CostFetchingTraceSink, OtlpTraceIngestor, TraceEventIngestor, decodeOtlpProtobuf, handleOtlpTraces, handleTraceEvents, mergeSpans, normalizeOtlpRequest };
|
package/dist/{local-database-trace-provider-87-WGqfS.js → local-database-trace-provider-BHe2hLFA.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { _ as isCheck, m as traceDuration, n as builtinCheck, o as hasCost, p as totalCost, r as builtinCheckInfos } from "./checks-Cq97JU-h.js";
|
|
2
|
-
import { o as mergeSpans } from "./trace-event-ingestor-
|
|
2
|
+
import { o as mergeSpans } from "./trace-event-ingestor-fjlL_FYB.js";
|
|
3
3
|
import module, { createRequire } from "node:module";
|
|
4
4
|
import path, { dirname, join, resolve } from "node:path";
|
|
5
5
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
@@ -3143,12 +3143,15 @@ function rollupSpans(spans) {
|
|
|
3143
3143
|
const cost = costContributions.length > 0 ? costContributions.reduce((sum, c) => sum + c, 0) : void 0;
|
|
3144
3144
|
const models = new Set(runSpans.map((s) => s.llm?.model).filter((m) => !!m));
|
|
3145
3145
|
const model = models.size === 1 ? [...models][0] : void 0;
|
|
3146
|
+
const efforts = new Set(runSpans.map((s) => s.llm?.effort).filter((e) => !!e));
|
|
3147
|
+
const effort = efforts.size === 1 ? [...efforts][0] : void 0;
|
|
3146
3148
|
const prompt = runSpans.find((s) => s.prompt?.version || s.prompt?.variation)?.prompt;
|
|
3147
3149
|
const environment = spans.find((s) => !s.parentId)?.resource?.[DEPLOYMENT_ENVIRONMENT_ATTRIBUTE];
|
|
3148
3150
|
return {
|
|
3149
3151
|
totalTokens,
|
|
3150
3152
|
cost,
|
|
3151
3153
|
model,
|
|
3154
|
+
...effort && { effort },
|
|
3152
3155
|
...typeof environment === "string" && { environment },
|
|
3153
3156
|
...prompt?.version && { promptVersion: prompt.version },
|
|
3154
3157
|
...prompt?.variation && { promptVariation: prompt.variation }
|
|
@@ -3295,6 +3298,13 @@ const bundledMigrations$2 = [
|
|
|
3295
3298
|
"folderMillis": 1794006471e3,
|
|
3296
3299
|
"bps": true,
|
|
3297
3300
|
"sql": ["-- SPDX-License-Identifier: AGPL-3.0-only\n-- Copyright (c) 2026 Alexander Corrado\n\nALTER TABLE `spans` ADD `llm_reasoning` text;"]
|
|
3301
|
+
},
|
|
3302
|
+
{
|
|
3303
|
+
"name": "20261117095006_fine_eddie_brock",
|
|
3304
|
+
"hash": "a6c2b2b2f851201bf04fcab9b054dba333436138dbbf40f179df11ffc8f83dd4",
|
|
3305
|
+
"folderMillis": 1794909006e3,
|
|
3306
|
+
"bps": true,
|
|
3307
|
+
"sql": ["-- SPDX-License-Identifier: AGPL-3.0-only\n-- Copyright (c) 2026 Alexander Corrado\n\nALTER TABLE `spans` ADD `llm_effort` text;"]
|
|
3298
3308
|
}
|
|
3299
3309
|
];
|
|
3300
3310
|
//#endregion
|
|
@@ -6746,6 +6756,7 @@ CREATE TABLE spans (
|
|
|
6746
6756
|
llm_provider TEXT, -- e.g. 'openai', 'anthropic'
|
|
6747
6757
|
llm_model TEXT, -- e.g. 'gpt-4o'
|
|
6748
6758
|
llm_finish_reason TEXT, -- e.g. 'stop', 'length', 'tool-calls'
|
|
6759
|
+
llm_effort TEXT, -- e.g. 'low', 'medium', 'high'
|
|
6749
6760
|
llm_prompt_tokens INTEGER, -- includes cache reads and writes
|
|
6750
6761
|
llm_completion_tokens INTEGER,
|
|
6751
6762
|
llm_total_tokens INTEGER,
|
|
@@ -6836,6 +6847,7 @@ const spans = sqliteTable("spans", {
|
|
|
6836
6847
|
llmProvider: text("llm_provider"),
|
|
6837
6848
|
llmModel: text("llm_model"),
|
|
6838
6849
|
llmFinishReason: text("llm_finish_reason"),
|
|
6850
|
+
llmEffort: text("llm_effort"),
|
|
6839
6851
|
llmPromptTokens: integer("llm_prompt_tokens"),
|
|
6840
6852
|
llmCompletionTokens: integer("llm_completion_tokens"),
|
|
6841
6853
|
llmTotalTokens: integer("llm_total_tokens"),
|
|
@@ -6933,6 +6945,7 @@ function spanToRow(span) {
|
|
|
6933
6945
|
llmProvider: span.llm?.provider ?? null,
|
|
6934
6946
|
llmModel: span.llm?.model ?? null,
|
|
6935
6947
|
llmFinishReason: span.llm?.finishReason ?? null,
|
|
6948
|
+
llmEffort: span.llm?.effort ?? null,
|
|
6936
6949
|
llmPromptTokens: span.llm?.promptTokens ?? null,
|
|
6937
6950
|
llmCompletionTokens: span.llm?.completionTokens ?? null,
|
|
6938
6951
|
llmTotalTokens: span.llm?.totalTokens ?? null,
|
|
@@ -6957,6 +6970,7 @@ function rowToSpan(row) {
|
|
|
6957
6970
|
...row.llmProvider && { provider: row.llmProvider },
|
|
6958
6971
|
...row.llmModel && { model: row.llmModel },
|
|
6959
6972
|
...row.llmFinishReason && { finishReason: row.llmFinishReason },
|
|
6973
|
+
...row.llmEffort && { effort: row.llmEffort },
|
|
6960
6974
|
...row.llmPromptTokens != null && { promptTokens: row.llmPromptTokens },
|
|
6961
6975
|
...row.llmCompletionTokens != null && { completionTokens: row.llmCompletionTokens },
|
|
6962
6976
|
...row.llmTotalTokens != null && { totalTokens: row.llmTotalTokens },
|
|
@@ -7061,6 +7075,8 @@ var TursoTraceProvider = class extends BaseTraceProvider {
|
|
|
7061
7075
|
cost: sql`sum(${ofRun(sql`${spans.llmCostPrompt} + ${spans.llmCostCompletion}`)})`.as("cost"),
|
|
7062
7076
|
modelCount: sql`count(distinct ${ofRun(sql`${spans.llmModel}`)})`.as("modelCount"),
|
|
7063
7077
|
model: sql`min(${ofRun(sql`${spans.llmModel}`)})`.as("model"),
|
|
7078
|
+
effortCount: sql`count(distinct ${ofRun(sql`${spans.llmEffort}`)})`.as("effortCount"),
|
|
7079
|
+
effort: sql`min(${ofRun(sql`${spans.llmEffort}`)})`.as("effort"),
|
|
7064
7080
|
promptVersion: sql`min(${ofRun(sql`json_extract(${spans.prompt}, '$.version')`)})`.as("promptVersion"),
|
|
7065
7081
|
promptVariation: sql`min(${ofRun(sql`json_extract(${spans.prompt}, '$.variation')`)})`.as("promptVariation"),
|
|
7066
7082
|
environment: sql`max(case when ${spans.parentId} is null then json_extract(${spans.resource}, '$."deployment.environment.name"') end)`.as("environment")
|
|
@@ -7083,6 +7099,8 @@ var TursoTraceProvider = class extends BaseTraceProvider {
|
|
|
7083
7099
|
cost: sql`${spanRollups.cost}`,
|
|
7084
7100
|
modelCount: sql`coalesce(${spanRollups.modelCount}, 0)`,
|
|
7085
7101
|
model: sql`${spanRollups.model}`,
|
|
7102
|
+
effortCount: sql`coalesce(${spanRollups.effortCount}, 0)`,
|
|
7103
|
+
effort: sql`${spanRollups.effort}`,
|
|
7086
7104
|
promptVersion: sql`${spanRollups.promptVersion}`,
|
|
7087
7105
|
promptVariation: sql`${spanRollups.promptVariation}`,
|
|
7088
7106
|
environment: sql`${spanRollups.environment}`,
|
|
@@ -7100,6 +7118,7 @@ var TursoTraceProvider = class extends BaseTraceProvider {
|
|
|
7100
7118
|
...row.tokens != null && { totalTokens: Number(row.tokens) },
|
|
7101
7119
|
...row.cost != null && { cost: Number(row.cost) },
|
|
7102
7120
|
...Number(row.modelCount) === 1 && row.model != null && { model: row.model },
|
|
7121
|
+
...Number(row.effortCount) === 1 && row.effort != null && { effort: row.effort },
|
|
7103
7122
|
...row.promptVersion != null && { promptVersion: row.promptVersion },
|
|
7104
7123
|
...row.promptVariation != null && { promptVariation: row.promptVariation },
|
|
7105
7124
|
...row.environment != null && { environment: row.environment },
|
|
@@ -368,14 +368,52 @@ const KNOWN_KINDS = [
|
|
|
368
368
|
];
|
|
369
369
|
/**
|
|
370
370
|
* Reads a span's {@link SpanKind} from its attributes: the explicit
|
|
371
|
-
* `evalution.span.type` attribute if present,
|
|
372
|
-
*
|
|
371
|
+
* `evalution.span.type` attribute if present, then Claude Code's
|
|
372
|
+
* `span.type: llm_request`, otherwise a mapping from the OTel GenAI semconv
|
|
373
|
+
* `gen_ai.operation.name`. Falls back to `'DEFAULT'`.
|
|
373
374
|
*/
|
|
374
375
|
function readKind(attributes) {
|
|
375
376
|
attributes = liftTelemetryMetadata(attributes);
|
|
376
|
-
const raw = attributes[SPAN_KIND_ATTRIBUTE] ?? otelOperationToSpanKind(attributes["gen_ai.operation.name"]);
|
|
377
|
+
const raw = attributes[SPAN_KIND_ATTRIBUTE] ?? (isClaudeCodeLLMRequest(attributes) ? "LLM" : otelOperationToSpanKind(attributes["gen_ai.operation.name"]));
|
|
377
378
|
return typeof raw === "string" && KNOWN_KINDS.includes(raw) ? raw : "DEFAULT";
|
|
378
379
|
}
|
|
380
|
+
/**
|
|
381
|
+
* Whether a span is a Claude Code model call, which it marks with
|
|
382
|
+
* `span.type: llm_request` rather than a `gen_ai.operation.name`.
|
|
383
|
+
*/
|
|
384
|
+
function isClaudeCodeLLMRequest(attributes) {
|
|
385
|
+
return attributes["span.type"] === "llm_request";
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* A Claude Code model call's token usage, from its own attribute names.
|
|
389
|
+
* Anthropic counts `input_tokens` apart from the cache reads and writes, so
|
|
390
|
+
* they're added back in to make `promptTokens` every input token, as
|
|
391
|
+
* {@link LLMSpanDetails} counts it. Read only off an `llm_request` span, as
|
|
392
|
+
* the bare names could mean anything elsewhere.
|
|
393
|
+
*/
|
|
394
|
+
function readClaudeCodeUsage(attributes) {
|
|
395
|
+
if (!isClaudeCodeLLMRequest(attributes)) return {};
|
|
396
|
+
const input = num(attributes.input_tokens);
|
|
397
|
+
const cacheReadTokens = num(attributes.cache_read_tokens);
|
|
398
|
+
const cacheWriteTokens = num(attributes.cache_creation_tokens);
|
|
399
|
+
return {
|
|
400
|
+
...input !== void 0 && { promptTokens: input + (cacheReadTokens ?? 0) + (cacheWriteTokens ?? 0) },
|
|
401
|
+
completionTokens: num(attributes.output_tokens),
|
|
402
|
+
cacheReadTokens,
|
|
403
|
+
cacheWriteTokens
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* The prompt that started a Claude Code interaction, recorded (when
|
|
408
|
+
* `OTEL_LOG_USER_PROMPTS` is set) as `user_prompt` on its `interaction` span.
|
|
409
|
+
*/
|
|
410
|
+
function readClaudeCodeUserPrompt(attributes) {
|
|
411
|
+
const prompt = str(attributes.user_prompt);
|
|
412
|
+
return attributes["span.type"] === "interaction" && prompt ? [{
|
|
413
|
+
role: "user",
|
|
414
|
+
content: prompt
|
|
415
|
+
}] : void 0;
|
|
416
|
+
}
|
|
379
417
|
/** Where the Vercel AI SDK (≤ v6) records `experimental_telemetry.metadata`. */
|
|
380
418
|
const TELEMETRY_METADATA_PREFIX = "ai.telemetry.metadata.";
|
|
381
419
|
/** The attributes evalution itself defines, which may arrive as metadata. */
|
|
@@ -593,14 +631,16 @@ function readLLM(attributes) {
|
|
|
593
631
|
const provider = str(attributes["gen_ai.provider.name"]) ?? str(attributes["gen_ai.system"]);
|
|
594
632
|
const model = str(attributes["gen_ai.response.model"]) ?? str(attributes["gen_ai.request.model"]);
|
|
595
633
|
const finishReason = readFinishReason(attributes);
|
|
596
|
-
const
|
|
597
|
-
const
|
|
598
|
-
const
|
|
599
|
-
const
|
|
634
|
+
const effort = isClaudeCodeLLMRequest(attributes) ? str(attributes.effort) : void 0;
|
|
635
|
+
const claudeCode = readClaudeCodeUsage(attributes);
|
|
636
|
+
const promptTokens = num(attributes["gen_ai.usage.input_tokens"]) ?? num(attributes["gen_ai.usage.prompt_tokens"]) ?? num(attributes["ai.usage.promptTokens"]) ?? claudeCode.promptTokens;
|
|
637
|
+
const completionTokens = num(attributes["gen_ai.usage.output_tokens"]) ?? num(attributes["gen_ai.usage.completion_tokens"]) ?? num(attributes["ai.usage.completionTokens"]) ?? claudeCode.completionTokens;
|
|
638
|
+
const cacheReadTokens = num(attributes["gen_ai.usage.cache_read.input_tokens"]) ?? claudeCode.cacheReadTokens;
|
|
639
|
+
const cacheWriteTokens = num(attributes["gen_ai.usage.cache_creation.input_tokens"]) ?? claudeCode.cacheWriteTokens;
|
|
600
640
|
const jsonInput = parseJsonObject(attributes["evalution.llm.input"]);
|
|
601
641
|
const messages = parseMessages(attributes["gen_ai.input.messages"] ?? attributes["ai.prompt.messages"]);
|
|
602
642
|
const evaluation = readEvaluation(attributes);
|
|
603
|
-
const input = jsonInput ?? evaluation.input ?? messages;
|
|
643
|
+
const input = jsonInput ?? evaluation.input ?? messages ?? readClaudeCodeUserPrompt(attributes);
|
|
604
644
|
const jsonOutput = tryParseJson(attributes["evalution.llm.output"]) ?? evaluation.output;
|
|
605
645
|
const text = parseOutput(attributes["gen_ai.output.messages"]) ?? str(attributes["ai.response.text"]);
|
|
606
646
|
const toolCalls = readOutputToolCalls(attributes);
|
|
@@ -609,11 +649,12 @@ function readLLM(attributes) {
|
|
|
609
649
|
const paramEntries = PARAM_ATTRIBUTES.map((key) => [key.replace("gen_ai.request.", ""), attributes[key]]).filter(([, v]) => v !== void 0);
|
|
610
650
|
const modelParameters = paramEntries.length > 0 ? Object.fromEntries(paramEntries) : void 0;
|
|
611
651
|
const totalTokens = promptTokens !== void 0 && completionTokens !== void 0 ? promptTokens + completionTokens : void 0;
|
|
612
|
-
if (!provider && !model && !finishReason && !promptTokens && !completionTokens && !input && (output === void 0 || output === "") && !reasoning && !modelParameters) return;
|
|
652
|
+
if (!provider && !model && !finishReason && !effort && !promptTokens && !completionTokens && !input && (output === void 0 || output === "") && !reasoning && !modelParameters) return;
|
|
613
653
|
return {
|
|
614
654
|
...provider && { provider },
|
|
615
655
|
...model && { model },
|
|
616
656
|
...finishReason && { finishReason },
|
|
657
|
+
...effort && { effort },
|
|
617
658
|
...input && { input },
|
|
618
659
|
...output !== void 0 && output !== "" && { output },
|
|
619
660
|
...reasoning && { reasoning },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "evalution",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "TypeScript AI Prompt Playground - Edit and execute AI prompts with live preview",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"node": ">=22.18.0"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@evalution/sdk": "2.0.
|
|
46
|
+
"@evalution/sdk": "2.0.4",
|
|
47
47
|
"@hono/node-server": "^2.0.4",
|
|
48
48
|
"@lydell/node-pty": "^1.2.0-beta.12",
|
|
49
49
|
"@modelcontextprotocol/client": "^2.2.0",
|
|
@@ -98,9 +98,9 @@
|
|
|
98
98
|
"@ai-sdk/openai": "^4.0.73",
|
|
99
99
|
"@ai-sdk/typesafe-ai": "^3.0.5",
|
|
100
100
|
"@biomejs/biome": "^2.5.0",
|
|
101
|
-
"@evalution/gemini-interactions-sdk": "2.0.
|
|
102
|
-
"@evalution/typesafe-sdk": "2.0.
|
|
103
|
-
"@evalution/vercel-ai-sdk": "2.0.
|
|
101
|
+
"@evalution/gemini-interactions-sdk": "2.0.4",
|
|
102
|
+
"@evalution/typesafe-sdk": "2.0.4",
|
|
103
|
+
"@evalution/vercel-ai-sdk": "2.0.4",
|
|
104
104
|
"@glideapps/glide-data-grid": "6.0.4-alpha24",
|
|
105
105
|
"@google/genai": "^2.9.0",
|
|
106
106
|
"@playwright/experimental-ct-react": "^1.58.2",
|