evalution 2.0.3 → 2.0.5
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 +59 -9
- package/dist/client/assets/{DatasetView-DZ2uLHKV.js → DatasetView-dWZOCEO1.js} +4 -4
- package/dist/client/assets/{EvalRunView-T610dLVw.js → EvalRunView-Cm1YhpbN.js} +1 -1
- package/dist/client/assets/{EvalView-Cae68vPB.js → EvalView-By5XAZnh.js} +1 -1
- package/dist/client/assets/{data-grid-overlay-editor-PtH7A6E4.js → data-grid-overlay-editor-BuUUbLjU.js} +1 -1
- package/dist/client/assets/{highlighted-body-KPVGNVTW-CPtwvSJb.js → highlighted-body-KPVGNVTW-B5z7-guY.js} +1 -1
- package/dist/client/assets/{index-BFH07Ynk.js → index-BK0ALIOn.js} +128 -128
- package/dist/client/assets/{number-overlay-editor-BbQhagHP.js → number-overlay-editor-DIsrCfnq.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/{cost-fetching-trace-sink-Dz8gniQ6.js → cost-fetching-trace-sink-X0hvDGGH.js} +1 -1
- package/dist/index.d.ts +25 -4
- package/dist/index.js +2 -2
- package/dist/ingest.d.ts +1 -1
- package/dist/ingest.js +2 -2
- package/dist/{local-database-trace-provider-87-WGqfS.js → local-database-trace-provider-Dy64Lll3.js} +69 -10
- package/dist/{trace-event-ingestor-B1DYEg2H.js → trace-event-ingestor-Bu2FKHC4.js} +293 -157
- package/dist/{trace-event-ingestor-JNpe-OrX.d.ts → trace-event-ingestor-D2zmkQm1.d.ts} +1 -1
- package/package.json +6 -6
package/dist/client/assets/{number-overlay-editor-BbQhagHP.js → number-overlay-editor-DIsrCfnq.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-BK0ALIOn.js";import{s as Be}from"./DatasetView-dWZOCEO1.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-BK0ALIOn.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-Bu2FKHC4.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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { $ as FieldValues, $t as ValueCatalogGroup, A as DatasetRowsOverview, An as TraceCheckResult, At as SpanImagePart, B as AnnotationEvent, Bt as TraceChangeEvent, C as DatasetFieldShape, Cn as EvalRunProgress, Ct as ResourceInfo, D as DatasetRow, Dn as EvalTraceRun, Dt as SourceSpan, E as DatasetProviderInfo, En as EvalSummary, Et as RunResources, F as KnownColumnSpec, Ft as SpanTextPart, G as ChangeEventType, Gt as TraceLiveEvent, H as AnnotationKind, Ht as TraceEvalRun, I as AddPromptContext, It as SpanToolCallPart, J as ConflictChoices, Jt as TraceStreamEvent, K as ChatPromptUpdates, Kt as TraceProviderInfo, L as AddPromptField, Lt as SpanToolResultPart, M as ColumnPath, Mt as SpanMessage, N as DatasetColumnSpec, Nt as SpanMessageRole, O as DatasetRowSource, On as NewEvalDefinition, Ot as Span, P as ForeignColumnSpec, Pt as SpanReasoningPart, Q as ExtractedProps, Qt as ValueCatalog, R as Annotation, Rt as ToolSpanDetails, S as DatasetField, Sn as EvalRun, St as RebaseResult, T as DatasetPathChild, Tn as EvalRunSummary, Tt as ResourceScope, U as AnnotationSource, Ut as TraceGroup$1, V as AnnotationEventOp, Vt as TraceChangeType, W as CalleeBinding, Wt as TraceGroupQuery$1, X as ExecuteResponse, Xt as TraceWithSpans, Y as ExecuteRequest, Yt as TraceSummary, Z as ExecutionInput, Zt as UpdatePromptResponse, _ as isStandardSchema, _n as EvalInputs, _t as PromptStyle, a as check, an as VersionId, at as NormalizedPrompt, b as DatasetChangeEvent, bn as EvalRowResult, bt as PropValue, c as ResolvedResourceInputs, cn as EvalArmSpec, ct as NormalizedQuestionsPrompt, d as ResourceInput, dn as EvalCheck, dt as PendingConflicts, en as ValueCatalogPreset, et as InputLayout, f as ResourceInputs, fn as EvalCheckOutcome, ft as PromptChangeEvent, g as isResource, gn as EvalDefinitionPatch, gt as PromptRef, h as StaticResourceDefinition, hn as EvalDefinition, ht as PromptProviderInfo, i as CheckRun, in as VariationInfo, it as NormalizedParameter, j as DatasetSummary, jt as SpanKind, k as DatasetRowUpdate, kn as NewEvalRun, kt as SpanContentPart, l as Resource, ln as EvalChangeEvent, lt as NormalizedToolCall, m as ResourceOutputDefinition, mn as EvalCounts, mt as PromptInputSources, n as CheckDefinition, nn as VariationConflict, nt as NormalizedChatPrompt, o as isCheck, on as VersionInfo, ot as NormalizedPromptBase, p as ResourceInstance, pn as EvalCheckResult, pt as PromptID, q as CheckInfo, qt as TraceQuery$1, r as CheckOutcome, rn as VariationId, rt as NormalizedMessage, s as DynamicResourceDefinition, sn as EvalArm, st as NormalizedPromptUpdates, t as Check, tn as ValueFactory, tt as LLMSpanDetails, u as ResourceDefinition, un as EvalChangeType, ut as ParsedPrompt, v as resource, vn as EvalProviderInfo, vt as PropDefinition, w as DatasetInstanceShape, wn as EvalRunStatus, wt as ResourceInstanceInput, x as DatasetChangeType, xn as EvalRowStatus, xt as QuestionsPromptUpdates, y as Dataset, yn as EvalResults, yt as PropType, z as AnnotationChanges, zt as Trace } from "./check-BKU5_IhU.js";
|
|
2
|
-
import { a as NormalizedOtlpEvent, i as decodeOtlpProtobuf, n as mergeSpans, o as NormalizedOtlpSpan, r as OtlpTraceIngestor, s as normalizeOtlpRequest, t as TraceEventIngestor } from "./trace-event-ingestor-
|
|
2
|
+
import { a as NormalizedOtlpEvent, i as decodeOtlpProtobuf, n as mergeSpans, o as NormalizedOtlpSpan, r as OtlpTraceIngestor, s as normalizeOtlpRequest, t as TraceEventIngestor } from "./trace-event-ingestor-D2zmkQm1.js";
|
|
3
3
|
import { Tracer } from "@opentelemetry/api";
|
|
4
4
|
import { PropDefinition as PropDefinition$1, PropValue as PropValue$1 } from "ts-proppy";
|
|
5
5
|
import { Annotation as Annotation$1, AnnotationChanges as AnnotationChanges$1, AnnotationEvent as AnnotationEvent$1, AnnotationEventOp as AnnotationEventOp$1, BaseTraceIngestor, BaseTraceIngestor as BaseTraceIngestor$1, CHECK_ATTRIBUTE, DEPLOYMENT_ENVIRONMENT_ATTRIBUTE, Evalution, Evalution as Evalution$1, EvalutionOptions, HttpTraceSink, HttpTraceSinkOptions, HttpTraceTarget, PLAYGROUND_ENVIRONMENT, PLAYGROUND_RESOURCE, PROMPT_ID_ATTRIBUTE, PROMPT_INPUTS_ATTRIBUTE, PROMPT_NAME_ATTRIBUTE, PROMPT_PROVIDER_ID_ATTRIBUTE, PROMPT_VARIATION_ATTRIBUTE, PROMPT_VERSION_ATTRIBUTE, PromptID as PromptID$1, PromptSpanInfo, PromptsFactory, PromptsHelper, PromptsHelperOptions, SERVICE_NAME_ATTRIBUTE, SPAN_KIND_ATTRIBUTE, Span as Span$1, SyncDatabaseCredentials, SyncDatabaseKey, TRACE_EVENTS_PATH, Trace as Trace$1, TraceChangeEvent as TraceChangeEvent$1, TraceEventsRequest, TraceGroup, TraceGroupQuery, TraceIngestor, TraceIngestor as TraceIngestor$1, TraceQuery, TraceSink, TraceSink as TraceSink$1, TraceSinkEvent, TraceStreamEvent as TraceStreamEvent$1, TraceSummary as TraceSummary$1, TraceWithSpans as TraceWithSpans$1, createTracerForPrompt, getPromptSpanAttributes, isCheckSpan, mergePromptIdentity, spanMessages } from "@evalution/sdk";
|
|
@@ -3551,8 +3551,16 @@ interface CloudTraceProviderOptions {
|
|
|
3551
3551
|
limit?: number;
|
|
3552
3552
|
/** How far back to list traces, in ms. Defaults to a week. */
|
|
3553
3553
|
windowMs?: number;
|
|
3554
|
-
/**
|
|
3554
|
+
/**
|
|
3555
|
+
* How often to check for new and changed traces while watched, in ms.
|
|
3556
|
+
* Defaults to 15s.
|
|
3557
|
+
*/
|
|
3555
3558
|
pollIntervalMs?: number;
|
|
3559
|
+
/**
|
|
3560
|
+
* The longest to wait between checks, in ms: each check that finds nothing
|
|
3561
|
+
* new doubles the wait, up to this. Defaults to 5 minutes.
|
|
3562
|
+
*/
|
|
3563
|
+
maxPollIntervalMs?: number;
|
|
3556
3564
|
/** Where to report a cloud that can't be reached. Defaults to `console`. */
|
|
3557
3565
|
log?: Pick<Console, "warn">;
|
|
3558
3566
|
}
|
|
@@ -3560,7 +3568,8 @@ interface CloudTraceProviderOptions {
|
|
|
3560
3568
|
* The project's production traces, read from Evalution Cloud: what the apps
|
|
3561
3569
|
* you deployed sent with an ingest key. Read-only. There's no live stream of
|
|
3562
3570
|
* a trace's spans, and no annotations or SQL; {@link watch} polls the cloud
|
|
3563
|
-
* for new and changed traces instead
|
|
3571
|
+
* for new and changed traces instead, less often while nothing changes and
|
|
3572
|
+
* nobody lists the traces, since each poll is a query the cloud pays for.
|
|
3564
3573
|
*
|
|
3565
3574
|
* `evalution` adds one of these next to the configured trace providers when
|
|
3566
3575
|
* `EVALUTION_API_KEY` is a personal key and `.evalution/config.ts` links a
|
|
@@ -3582,9 +3591,16 @@ declare class CloudTraceProvider implements TraceProvider {
|
|
|
3582
3591
|
private readonly limit;
|
|
3583
3592
|
private readonly windowMs;
|
|
3584
3593
|
private readonly pollIntervalMs;
|
|
3594
|
+
private readonly maxPollIntervalMs;
|
|
3585
3595
|
private readonly log;
|
|
3586
3596
|
private watchers;
|
|
3587
3597
|
private timer;
|
|
3598
|
+
/** How long the next poll waits after the one before it, in ms. */
|
|
3599
|
+
private delayMs;
|
|
3600
|
+
/** When the next poll is due, in ms since the epoch. */
|
|
3601
|
+
private dueAt;
|
|
3602
|
+
/** Whether a poll is waiting on the cloud. */
|
|
3603
|
+
private polling;
|
|
3588
3604
|
/** What the last listing returned, by id, as {@link fingerprint}s. */
|
|
3589
3605
|
private known;
|
|
3590
3606
|
private lastListed;
|
|
@@ -3612,6 +3628,11 @@ declare class CloudTraceProvider implements TraceProvider {
|
|
|
3612
3628
|
*/
|
|
3613
3629
|
private list;
|
|
3614
3630
|
private noteChanges;
|
|
3631
|
+
/**
|
|
3632
|
+
* Someone is looking at the traces: polls at the shortest interval again,
|
|
3633
|
+
* bringing the next poll forward if it's further off than that.
|
|
3634
|
+
*/
|
|
3635
|
+
private hurry;
|
|
3615
3636
|
private schedule;
|
|
3616
3637
|
private emit;
|
|
3617
3638
|
}
|
|
@@ -3676,7 +3697,7 @@ declare function createLocalTursoClient({
|
|
|
3676
3697
|
* server. A test checks every column of `./schema.ts` is described here.
|
|
3677
3698
|
*/
|
|
3678
3699
|
/** 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";
|
|
3700
|
+
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
3701
|
//#endregion
|
|
3681
3702
|
//#region src/trace/local-database-trace-provider.d.ts
|
|
3682
3703
|
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-Dy64Lll3.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-Bu2FKHC4.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.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as NormalizedOtlpEvent, i as decodeOtlpProtobuf, n as mergeSpans, o as NormalizedOtlpSpan, r as OtlpTraceIngestor, s as normalizeOtlpRequest, t as TraceEventIngestor } from "./trace-event-ingestor-
|
|
1
|
+
import { a as NormalizedOtlpEvent, i as decodeOtlpProtobuf, n as mergeSpans, o as NormalizedOtlpSpan, r as OtlpTraceIngestor, s as normalizeOtlpRequest, t as TraceEventIngestor } from "./trace-event-ingestor-D2zmkQm1.js";
|
|
2
2
|
import { Span, TraceSink } from "@evalution/sdk";
|
|
3
3
|
|
|
4
4
|
//#region src/server/handlers/otlp-ingest.d.ts
|
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-Bu2FKHC4.js";
|
|
2
|
+
import { n as handleTraceEvents, r as handleOtlpTraces, t as CostFetchingTraceSink } from "./cost-fetching-trace-sink-X0hvDGGH.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-Dy64Lll3.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-Bu2FKHC4.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
|
|
@@ -6287,6 +6297,8 @@ const DEFAULT_WINDOW_MS = 10080 * 60 * 1e3;
|
|
|
6287
6297
|
const DEFAULT_LIMIT = 200;
|
|
6288
6298
|
/** How often {@link CloudTraceProvider} checks for new traces while watched. */
|
|
6289
6299
|
const DEFAULT_POLL_INTERVAL_MS = 15e3;
|
|
6300
|
+
/** The least often {@link CloudTraceProvider} checks while nothing changes. */
|
|
6301
|
+
const DEFAULT_MAX_POLL_INTERVAL_MS = 5 * 6e4;
|
|
6290
6302
|
/** What the cloud's traces have: it keeps no annotations. */
|
|
6291
6303
|
const NO_ANNOTATIONS = {
|
|
6292
6304
|
issue: 0,
|
|
@@ -6307,7 +6319,8 @@ function fingerprint(trace) {
|
|
|
6307
6319
|
* The project's production traces, read from Evalution Cloud: what the apps
|
|
6308
6320
|
* you deployed sent with an ingest key. Read-only. There's no live stream of
|
|
6309
6321
|
* a trace's spans, and no annotations or SQL; {@link watch} polls the cloud
|
|
6310
|
-
* for new and changed traces instead
|
|
6322
|
+
* for new and changed traces instead, less often while nothing changes and
|
|
6323
|
+
* nobody lists the traces, since each poll is a query the cloud pays for.
|
|
6311
6324
|
*
|
|
6312
6325
|
* `evalution` adds one of these next to the configured trace providers when
|
|
6313
6326
|
* `EVALUTION_API_KEY` is a personal key and `.evalution/config.ts` links a
|
|
@@ -6329,9 +6342,16 @@ var CloudTraceProvider = class {
|
|
|
6329
6342
|
limit;
|
|
6330
6343
|
windowMs;
|
|
6331
6344
|
pollIntervalMs;
|
|
6345
|
+
maxPollIntervalMs;
|
|
6332
6346
|
log;
|
|
6333
6347
|
watchers = /* @__PURE__ */ new Set();
|
|
6334
6348
|
timer;
|
|
6349
|
+
/** How long the next poll waits after the one before it, in ms. */
|
|
6350
|
+
delayMs = 0;
|
|
6351
|
+
/** When the next poll is due, in ms since the epoch. */
|
|
6352
|
+
dueAt = 0;
|
|
6353
|
+
/** Whether a poll is waiting on the cloud. */
|
|
6354
|
+
polling = false;
|
|
6335
6355
|
/** What the last listing returned, by id, as {@link fingerprint}s. */
|
|
6336
6356
|
known;
|
|
6337
6357
|
lastListed = [];
|
|
@@ -6345,9 +6365,11 @@ var CloudTraceProvider = class {
|
|
|
6345
6365
|
this.limit = options.limit ?? DEFAULT_LIMIT;
|
|
6346
6366
|
this.windowMs = options.windowMs ?? DEFAULT_WINDOW_MS;
|
|
6347
6367
|
this.pollIntervalMs = options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
|
|
6368
|
+
this.maxPollIntervalMs = Math.max(this.pollIntervalMs, options.maxPollIntervalMs ?? DEFAULT_MAX_POLL_INTERVAL_MS);
|
|
6348
6369
|
this.log = options.log ?? console;
|
|
6349
6370
|
}
|
|
6350
6371
|
async getAllTraces(query) {
|
|
6372
|
+
this.hurry();
|
|
6351
6373
|
try {
|
|
6352
6374
|
return await this.list(query);
|
|
6353
6375
|
} catch {
|
|
@@ -6360,6 +6382,7 @@ var CloudTraceProvider = class {
|
|
|
6360
6382
|
* grouped instead.
|
|
6361
6383
|
*/
|
|
6362
6384
|
async groupTraces(query) {
|
|
6385
|
+
this.hurry();
|
|
6363
6386
|
try {
|
|
6364
6387
|
const groups = await this.client.listTraceGroups({
|
|
6365
6388
|
...this.window(),
|
|
@@ -6398,7 +6421,10 @@ var CloudTraceProvider = class {
|
|
|
6398
6421
|
*/
|
|
6399
6422
|
watch(callback) {
|
|
6400
6423
|
this.watchers.add(callback);
|
|
6401
|
-
if (this.watchers.size === 1)
|
|
6424
|
+
if (this.watchers.size === 1) {
|
|
6425
|
+
this.delayMs = this.pollIntervalMs;
|
|
6426
|
+
this.schedule(0);
|
|
6427
|
+
}
|
|
6402
6428
|
return () => {
|
|
6403
6429
|
this.watchers.delete(callback);
|
|
6404
6430
|
if (this.watchers.size === 0) {
|
|
@@ -6457,28 +6483,52 @@ var CloudTraceProvider = class {
|
|
|
6457
6483
|
const current = new Map(traces.map((t) => [t.id, fingerprint(t)]));
|
|
6458
6484
|
if (this.watchers.size > 0) this.known = current;
|
|
6459
6485
|
if (!previous || this.watchers.size === 0) return;
|
|
6486
|
+
const events = [];
|
|
6460
6487
|
for (const [traceId, print] of current) {
|
|
6461
6488
|
const before = previous.get(traceId);
|
|
6462
|
-
if (before === void 0)
|
|
6489
|
+
if (before === void 0) events.push({
|
|
6463
6490
|
type: "add",
|
|
6464
6491
|
traceId
|
|
6465
6492
|
});
|
|
6466
|
-
else if (before !== print)
|
|
6493
|
+
else if (before !== print) events.push({
|
|
6467
6494
|
type: "update",
|
|
6468
6495
|
traceId
|
|
6469
6496
|
});
|
|
6470
6497
|
}
|
|
6471
|
-
for (const traceId of previous.keys()) if (!current.has(traceId))
|
|
6498
|
+
for (const traceId of previous.keys()) if (!current.has(traceId)) events.push({
|
|
6472
6499
|
type: "remove",
|
|
6473
6500
|
traceId
|
|
6474
6501
|
});
|
|
6502
|
+
if (events.length > 0) this.delayMs = this.pollIntervalMs;
|
|
6503
|
+
for (const event of events) this.emit(event);
|
|
6504
|
+
}
|
|
6505
|
+
/**
|
|
6506
|
+
* Someone is looking at the traces: polls at the shortest interval again,
|
|
6507
|
+
* bringing the next poll forward if it's further off than that.
|
|
6508
|
+
*/
|
|
6509
|
+
hurry() {
|
|
6510
|
+
this.delayMs = this.pollIntervalMs;
|
|
6511
|
+
if (this.timer === void 0 || this.polling) return;
|
|
6512
|
+
if (this.dueAt - Date.now() <= this.pollIntervalMs) return;
|
|
6513
|
+
clearTimeout(this.timer);
|
|
6514
|
+
this.schedule(this.pollIntervalMs);
|
|
6475
6515
|
}
|
|
6476
6516
|
schedule(delayMs) {
|
|
6477
|
-
this.
|
|
6478
|
-
|
|
6479
|
-
|
|
6517
|
+
this.dueAt = Date.now() + delayMs;
|
|
6518
|
+
const timer = setTimeout(async () => {
|
|
6519
|
+
this.polling = true;
|
|
6520
|
+
try {
|
|
6521
|
+
await this.list().catch(() => {});
|
|
6522
|
+
} finally {
|
|
6523
|
+
this.polling = false;
|
|
6524
|
+
}
|
|
6525
|
+
if (this.timer !== timer || this.watchers.size === 0) return;
|
|
6526
|
+
const wait = this.delayMs;
|
|
6527
|
+
this.delayMs = Math.min(wait * 2, this.maxPollIntervalMs);
|
|
6528
|
+
this.schedule(wait);
|
|
6480
6529
|
}, delayMs);
|
|
6481
|
-
this.timer
|
|
6530
|
+
this.timer = timer;
|
|
6531
|
+
timer.unref?.();
|
|
6482
6532
|
}
|
|
6483
6533
|
emit(event) {
|
|
6484
6534
|
for (const watcher of this.watchers) try {
|
|
@@ -6746,6 +6796,7 @@ CREATE TABLE spans (
|
|
|
6746
6796
|
llm_provider TEXT, -- e.g. 'openai', 'anthropic'
|
|
6747
6797
|
llm_model TEXT, -- e.g. 'gpt-4o'
|
|
6748
6798
|
llm_finish_reason TEXT, -- e.g. 'stop', 'length', 'tool-calls'
|
|
6799
|
+
llm_effort TEXT, -- e.g. 'low', 'medium', 'high'
|
|
6749
6800
|
llm_prompt_tokens INTEGER, -- includes cache reads and writes
|
|
6750
6801
|
llm_completion_tokens INTEGER,
|
|
6751
6802
|
llm_total_tokens INTEGER,
|
|
@@ -6836,6 +6887,7 @@ const spans = sqliteTable("spans", {
|
|
|
6836
6887
|
llmProvider: text("llm_provider"),
|
|
6837
6888
|
llmModel: text("llm_model"),
|
|
6838
6889
|
llmFinishReason: text("llm_finish_reason"),
|
|
6890
|
+
llmEffort: text("llm_effort"),
|
|
6839
6891
|
llmPromptTokens: integer("llm_prompt_tokens"),
|
|
6840
6892
|
llmCompletionTokens: integer("llm_completion_tokens"),
|
|
6841
6893
|
llmTotalTokens: integer("llm_total_tokens"),
|
|
@@ -6933,6 +6985,7 @@ function spanToRow(span) {
|
|
|
6933
6985
|
llmProvider: span.llm?.provider ?? null,
|
|
6934
6986
|
llmModel: span.llm?.model ?? null,
|
|
6935
6987
|
llmFinishReason: span.llm?.finishReason ?? null,
|
|
6988
|
+
llmEffort: span.llm?.effort ?? null,
|
|
6936
6989
|
llmPromptTokens: span.llm?.promptTokens ?? null,
|
|
6937
6990
|
llmCompletionTokens: span.llm?.completionTokens ?? null,
|
|
6938
6991
|
llmTotalTokens: span.llm?.totalTokens ?? null,
|
|
@@ -6957,6 +7010,7 @@ function rowToSpan(row) {
|
|
|
6957
7010
|
...row.llmProvider && { provider: row.llmProvider },
|
|
6958
7011
|
...row.llmModel && { model: row.llmModel },
|
|
6959
7012
|
...row.llmFinishReason && { finishReason: row.llmFinishReason },
|
|
7013
|
+
...row.llmEffort && { effort: row.llmEffort },
|
|
6960
7014
|
...row.llmPromptTokens != null && { promptTokens: row.llmPromptTokens },
|
|
6961
7015
|
...row.llmCompletionTokens != null && { completionTokens: row.llmCompletionTokens },
|
|
6962
7016
|
...row.llmTotalTokens != null && { totalTokens: row.llmTotalTokens },
|
|
@@ -7061,6 +7115,8 @@ var TursoTraceProvider = class extends BaseTraceProvider {
|
|
|
7061
7115
|
cost: sql`sum(${ofRun(sql`${spans.llmCostPrompt} + ${spans.llmCostCompletion}`)})`.as("cost"),
|
|
7062
7116
|
modelCount: sql`count(distinct ${ofRun(sql`${spans.llmModel}`)})`.as("modelCount"),
|
|
7063
7117
|
model: sql`min(${ofRun(sql`${spans.llmModel}`)})`.as("model"),
|
|
7118
|
+
effortCount: sql`count(distinct ${ofRun(sql`${spans.llmEffort}`)})`.as("effortCount"),
|
|
7119
|
+
effort: sql`min(${ofRun(sql`${spans.llmEffort}`)})`.as("effort"),
|
|
7064
7120
|
promptVersion: sql`min(${ofRun(sql`json_extract(${spans.prompt}, '$.version')`)})`.as("promptVersion"),
|
|
7065
7121
|
promptVariation: sql`min(${ofRun(sql`json_extract(${spans.prompt}, '$.variation')`)})`.as("promptVariation"),
|
|
7066
7122
|
environment: sql`max(case when ${spans.parentId} is null then json_extract(${spans.resource}, '$."deployment.environment.name"') end)`.as("environment")
|
|
@@ -7083,6 +7139,8 @@ var TursoTraceProvider = class extends BaseTraceProvider {
|
|
|
7083
7139
|
cost: sql`${spanRollups.cost}`,
|
|
7084
7140
|
modelCount: sql`coalesce(${spanRollups.modelCount}, 0)`,
|
|
7085
7141
|
model: sql`${spanRollups.model}`,
|
|
7142
|
+
effortCount: sql`coalesce(${spanRollups.effortCount}, 0)`,
|
|
7143
|
+
effort: sql`${spanRollups.effort}`,
|
|
7086
7144
|
promptVersion: sql`${spanRollups.promptVersion}`,
|
|
7087
7145
|
promptVariation: sql`${spanRollups.promptVariation}`,
|
|
7088
7146
|
environment: sql`${spanRollups.environment}`,
|
|
@@ -7100,6 +7158,7 @@ var TursoTraceProvider = class extends BaseTraceProvider {
|
|
|
7100
7158
|
...row.tokens != null && { totalTokens: Number(row.tokens) },
|
|
7101
7159
|
...row.cost != null && { cost: Number(row.cost) },
|
|
7102
7160
|
...Number(row.modelCount) === 1 && row.model != null && { model: row.model },
|
|
7161
|
+
...Number(row.effortCount) === 1 && row.effort != null && { effort: row.effort },
|
|
7103
7162
|
...row.promptVersion != null && { promptVersion: row.promptVersion },
|
|
7104
7163
|
...row.promptVariation != null && { promptVariation: row.promptVariation },
|
|
7105
7164
|
...row.environment != null && { environment: row.environment },
|