evalution 2.0.4 → 2.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{check-BKU5_IhU.d.ts → check-BTQoueDx.d.ts} +10 -2
- package/dist/checks/index.d.ts +1 -1
- package/dist/cli/index.js +18 -6
- package/dist/client/assets/{DatasetView-B1KoSX7p.js → DatasetView-DGDsJxna.js} +12 -12
- package/dist/client/assets/{EvalRunView-By5RN8fo.js → EvalRunView-BN9V0ARc.js} +1 -1
- package/dist/client/assets/{EvalView-BW2qyhFj.js → EvalView-BQBrzhCH.js} +1 -1
- package/dist/client/assets/{data-grid-overlay-editor-CQsCX66k.js → data-grid-overlay-editor-5rXbIGLa.js} +1 -1
- package/dist/client/assets/{highlighted-body-KPVGNVTW-D7b_g0Y9.js → highlighted-body-KPVGNVTW-_PBSQg1b.js} +1 -1
- package/dist/client/assets/{index-BDqLFfPf.js → index-B5TkxPbo.js} +131 -131
- package/dist/client/assets/{number-overlay-editor-lGaIg9Iu.js → number-overlay-editor-DsFqIfVX.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/{cost-fetching-trace-sink-BEqbMdt1.js → cost-fetching-trace-sink-X0hvDGGH.js} +1 -1
- package/dist/{dataset-types-D-Fsbg8B.d.ts → dataset-types-0N5KYU1i.d.ts} +10 -2
- package/dist/index.d.ts +29 -7
- package/dist/index.js +11 -6
- package/dist/ingest.d.ts +1 -1
- package/dist/ingest.js +2 -2
- package/dist/{local-database-trace-provider-BHe2hLFA.js → local-database-trace-provider-Ygd0PVZQ.js} +96 -19
- package/dist/{trace-BLjFYF9G.d.ts → trace-BEwHfdpe.d.ts} +1 -1
- package/dist/{trace-event-ingestor-fjlL_FYB.js → trace-event-ingestor-Bu2FKHC4.js} +243 -148
- package/dist/{trace-event-ingestor-JNpe-OrX.d.ts → trace-event-ingestor-D2zmkQm1.d.ts} +1 -1
- package/dist/views/datasets/index.d.ts +1 -1
- package/dist/views/datasets/index.js +5 -0
- package/dist/views/index.d.ts +2 -2
- package/dist/views/react/index.d.ts +1 -1
- package/package.json +7 -7
package/dist/client/assets/{number-overlay-editor-lGaIg9Iu.js → number-overlay-editor-DsFqIfVX.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
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(`
|
|
1
|
+
import{ad as Y,r as O}from"./index-B5TkxPbo.js";import{s as Be}from"./DatasetView-DGDsJxna.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-B5TkxPbo.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`).
|
|
@@ -17,13 +17,21 @@ type ExecutionInput = /** A value typed into the panel. */{
|
|
|
17
17
|
/**
|
|
18
18
|
* An object assembled from per-property inputs, so a resource can fill one
|
|
19
19
|
* field of an otherwise hand-edited object — `toolsContext`'s `db` beside
|
|
20
|
-
* its typed-in ids.
|
|
21
|
-
* any slot has yet.
|
|
20
|
+
* its typed-in ids.
|
|
22
21
|
*/
|
|
23
22
|
| {
|
|
24
23
|
kind: "object";
|
|
25
24
|
properties: Record<string, ExecutionInput>;
|
|
26
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* An array assembled from per-element inputs, so a resource can fill one
|
|
28
|
+
* element of an otherwise hand-edited array — a seeded task's `taskId`
|
|
29
|
+
* beside typed-in ids.
|
|
30
|
+
*/
|
|
31
|
+
| {
|
|
32
|
+
kind: "array";
|
|
33
|
+
elements: ExecutionInput[];
|
|
34
|
+
}
|
|
27
35
|
/**
|
|
28
36
|
* One of the run's named resource instances ({@link RunResources}), or one
|
|
29
37
|
* of its outputs — created by the provider at run time, once per run
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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-
|
|
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-
|
|
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-BTQoueDx.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-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";
|
|
@@ -332,10 +332,11 @@ interface InputSlot {
|
|
|
332
332
|
}
|
|
333
333
|
/**
|
|
334
334
|
* Flatten `definitions` into every slot a source could be matched against —
|
|
335
|
-
* each parameter, plus the object properties nested inside it
|
|
335
|
+
* each parameter, plus the object properties nested inside it, plus one
|
|
336
|
+
* element slot (`ELEMENT_SLOT`) per array for all of its elements.
|
|
336
337
|
*
|
|
337
|
-
*
|
|
338
|
-
*
|
|
338
|
+
* Unions are not descended into: a union has no one shape for a path to
|
|
339
|
+
* name.
|
|
339
340
|
*
|
|
340
341
|
* @param definitions - The parameters to flatten.
|
|
341
342
|
* @param prefix - Path prefix, used when recursing.
|
|
@@ -3551,8 +3552,16 @@ interface CloudTraceProviderOptions {
|
|
|
3551
3552
|
limit?: number;
|
|
3552
3553
|
/** How far back to list traces, in ms. Defaults to a week. */
|
|
3553
3554
|
windowMs?: number;
|
|
3554
|
-
/**
|
|
3555
|
+
/**
|
|
3556
|
+
* How often to check for new and changed traces while watched, in ms.
|
|
3557
|
+
* Defaults to 15s.
|
|
3558
|
+
*/
|
|
3555
3559
|
pollIntervalMs?: number;
|
|
3560
|
+
/**
|
|
3561
|
+
* The longest to wait between checks, in ms: each check that finds nothing
|
|
3562
|
+
* new doubles the wait, up to this. Defaults to 5 minutes.
|
|
3563
|
+
*/
|
|
3564
|
+
maxPollIntervalMs?: number;
|
|
3556
3565
|
/** Where to report a cloud that can't be reached. Defaults to `console`. */
|
|
3557
3566
|
log?: Pick<Console, "warn">;
|
|
3558
3567
|
}
|
|
@@ -3560,7 +3569,8 @@ interface CloudTraceProviderOptions {
|
|
|
3560
3569
|
* The project's production traces, read from Evalution Cloud: what the apps
|
|
3561
3570
|
* you deployed sent with an ingest key. Read-only. There's no live stream of
|
|
3562
3571
|
* a trace's spans, and no annotations or SQL; {@link watch} polls the cloud
|
|
3563
|
-
* for new and changed traces instead
|
|
3572
|
+
* for new and changed traces instead, less often while nothing changes and
|
|
3573
|
+
* nobody lists the traces, since each poll is a query the cloud pays for.
|
|
3564
3574
|
*
|
|
3565
3575
|
* `evalution` adds one of these next to the configured trace providers when
|
|
3566
3576
|
* `EVALUTION_API_KEY` is a personal key and `.evalution/config.ts` links a
|
|
@@ -3582,9 +3592,16 @@ declare class CloudTraceProvider implements TraceProvider {
|
|
|
3582
3592
|
private readonly limit;
|
|
3583
3593
|
private readonly windowMs;
|
|
3584
3594
|
private readonly pollIntervalMs;
|
|
3595
|
+
private readonly maxPollIntervalMs;
|
|
3585
3596
|
private readonly log;
|
|
3586
3597
|
private watchers;
|
|
3587
3598
|
private timer;
|
|
3599
|
+
/** How long the next poll waits after the one before it, in ms. */
|
|
3600
|
+
private delayMs;
|
|
3601
|
+
/** When the next poll is due, in ms since the epoch. */
|
|
3602
|
+
private dueAt;
|
|
3603
|
+
/** Whether a poll is waiting on the cloud. */
|
|
3604
|
+
private polling;
|
|
3588
3605
|
/** What the last listing returned, by id, as {@link fingerprint}s. */
|
|
3589
3606
|
private known;
|
|
3590
3607
|
private lastListed;
|
|
@@ -3612,6 +3629,11 @@ declare class CloudTraceProvider implements TraceProvider {
|
|
|
3612
3629
|
*/
|
|
3613
3630
|
private list;
|
|
3614
3631
|
private noteChanges;
|
|
3632
|
+
/**
|
|
3633
|
+
* Someone is looking at the traces: polls at the shortest interval again,
|
|
3634
|
+
* bringing the next poll forward if it's further off than that.
|
|
3635
|
+
*/
|
|
3636
|
+
private hurry;
|
|
3615
3637
|
private schedule;
|
|
3616
3638
|
private emit;
|
|
3617
3639
|
}
|
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-Ygd0PVZQ.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";
|
|
@@ -1688,9 +1688,8 @@ const PRIMITIVE_FLAGS = ts.TypeFlags.StringLike | ts.TypeFlags.NumberLike | ts.T
|
|
|
1688
1688
|
* see {@link PRIMITIVE_FLAGS}), a function, or a type `isOpaqueType` calls
|
|
1689
1689
|
* unconstructible (a class-instance handle, an all-method interface) — the
|
|
1690
1690
|
* same {@link isOpaqueType} the `PropDefinition` side uses to decide `kind:
|
|
1691
|
-
* 'opaque'` rather than `'object'`.
|
|
1692
|
-
*
|
|
1693
|
-
* shape, so a saved selection could not name one reliably.
|
|
1691
|
+
* 'opaque'` rather than `'object'`. Unions are not descended into either;
|
|
1692
|
+
* an array gets one {@link ELEMENT_SLOT} for all its elements.
|
|
1694
1693
|
*/
|
|
1695
1694
|
function collectSlotTypes(roots, typeChecker, location) {
|
|
1696
1695
|
const slots = /* @__PURE__ */ new Map();
|
|
@@ -1698,7 +1697,13 @@ function collectSlotTypes(roots, typeChecker, location) {
|
|
|
1698
1697
|
if (slots.size >= MAX_SLOTS) return;
|
|
1699
1698
|
slots.set(prefix, type);
|
|
1700
1699
|
if (depth + 1 >= 4) return;
|
|
1701
|
-
|
|
1700
|
+
const array = typeChecker.getNonNullableType(type);
|
|
1701
|
+
if (typeChecker.isArrayType(array)) {
|
|
1702
|
+
const [element] = typeChecker.getTypeArguments(array);
|
|
1703
|
+
if (element) walk(`${prefix}.[]`, element, depth + 1);
|
|
1704
|
+
return;
|
|
1705
|
+
}
|
|
1706
|
+
if (type.isUnion()) return;
|
|
1702
1707
|
if (typeChecker.isTupleType(type)) return;
|
|
1703
1708
|
if (type.flags & PRIMITIVE_FLAGS) return;
|
|
1704
1709
|
if (type.isIntersection() && type.types.some((t) => t.flags & PRIMITIVE_FLAGS)) return;
|
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-BHe2hLFA.js → local-database-trace-provider-Ygd0PVZQ.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";
|
|
@@ -1217,11 +1217,20 @@ var ResourceRegistry = class {
|
|
|
1217
1217
|
}
|
|
1218
1218
|
};
|
|
1219
1219
|
/**
|
|
1220
|
+
* Whether slot `path` is (or is inside) an array's {@link ELEMENT_SLOT}: a
|
|
1221
|
+
* slot sources are matched against, but not one an `input` reference can
|
|
1222
|
+
* name, since it stands for no one element.
|
|
1223
|
+
*/
|
|
1224
|
+
function isElementSlot(path) {
|
|
1225
|
+
return path.split(".").includes("[]");
|
|
1226
|
+
}
|
|
1227
|
+
/**
|
|
1220
1228
|
* Flatten `definitions` into every slot a source could be matched against —
|
|
1221
|
-
* each parameter, plus the object properties nested inside it
|
|
1229
|
+
* each parameter, plus the object properties nested inside it, plus one
|
|
1230
|
+
* element slot (`ELEMENT_SLOT`) per array for all of its elements.
|
|
1222
1231
|
*
|
|
1223
|
-
*
|
|
1224
|
-
*
|
|
1232
|
+
* Unions are not descended into: a union has no one shape for a path to
|
|
1233
|
+
* name.
|
|
1225
1234
|
*
|
|
1226
1235
|
* @param definitions - The parameters to flatten.
|
|
1227
1236
|
* @param prefix - Path prefix, used when recursing.
|
|
@@ -1235,7 +1244,12 @@ function collectInputSlots(definitions, prefix = "", depth = 0) {
|
|
|
1235
1244
|
name: def.name,
|
|
1236
1245
|
type: def.type
|
|
1237
1246
|
});
|
|
1238
|
-
if (
|
|
1247
|
+
if (depth + 1 >= 4) continue;
|
|
1248
|
+
if (def.type.kind === "object") slots.push(...collectInputSlots(def.type.properties, path, depth + 1));
|
|
1249
|
+
else if (def.type.kind === "array") slots.push(...collectInputSlots([{
|
|
1250
|
+
...def.type.element,
|
|
1251
|
+
name: "[]"
|
|
1252
|
+
}], path, depth + 1));
|
|
1239
1253
|
}
|
|
1240
1254
|
return slots;
|
|
1241
1255
|
}
|
|
@@ -1271,6 +1285,7 @@ function locationKey(loc) {
|
|
|
1271
1285
|
const KNOWN_KINDS = new Set(Object.keys({
|
|
1272
1286
|
value: true,
|
|
1273
1287
|
object: true,
|
|
1288
|
+
array: true,
|
|
1274
1289
|
input: true,
|
|
1275
1290
|
instance: true,
|
|
1276
1291
|
dataset: true
|
|
@@ -1280,6 +1295,7 @@ function instanceNames(input) {
|
|
|
1280
1295
|
switch (input.kind) {
|
|
1281
1296
|
case "instance": return [input.name];
|
|
1282
1297
|
case "object": return Object.values(input.properties).flatMap(instanceNames);
|
|
1298
|
+
case "array": return input.elements.flatMap(instanceNames);
|
|
1283
1299
|
default: return [];
|
|
1284
1300
|
}
|
|
1285
1301
|
}
|
|
@@ -1298,6 +1314,14 @@ function findRefs(bindings, unsupported) {
|
|
|
1298
1314
|
path: `${at.path}.${k}`
|
|
1299
1315
|
});
|
|
1300
1316
|
break;
|
|
1317
|
+
case "array":
|
|
1318
|
+
node.elements.forEach((child, i) => {
|
|
1319
|
+
walk(child, "instance" in at ? at : {
|
|
1320
|
+
half: at.half,
|
|
1321
|
+
path: `${at.path}.${i}`
|
|
1322
|
+
});
|
|
1323
|
+
});
|
|
1324
|
+
break;
|
|
1301
1325
|
case "input":
|
|
1302
1326
|
found.push({
|
|
1303
1327
|
at,
|
|
@@ -1373,11 +1397,15 @@ function findInputCycle(bindings) {
|
|
|
1373
1397
|
if (cycle) return cycle;
|
|
1374
1398
|
}
|
|
1375
1399
|
}
|
|
1376
|
-
/**
|
|
1400
|
+
/**
|
|
1401
|
+
* Every slot path an `input` reference into `signature` can name, by half:
|
|
1402
|
+
* every slot but an array's {@link ELEMENT_SLOT}s.
|
|
1403
|
+
*/
|
|
1377
1404
|
function slotPaths(signature) {
|
|
1405
|
+
const referenceable = (params) => new Set(collectInputSlots(params).map((s) => s.path).filter((p) => !isElementSlot(p)));
|
|
1378
1406
|
return {
|
|
1379
|
-
function:
|
|
1380
|
-
execute:
|
|
1407
|
+
function: referenceable(signature.functionParameters),
|
|
1408
|
+
execute: referenceable(signature.executeParameters ?? [])
|
|
1381
1409
|
};
|
|
1382
1410
|
}
|
|
1383
1411
|
/**
|
|
@@ -1514,6 +1542,7 @@ async function resolveWithin(input, resolver, context, chain) {
|
|
|
1514
1542
|
const entries = await Promise.all(Object.entries(input.properties).map(async ([k, v]) => [k, await recurse(v)]));
|
|
1515
1543
|
return Object.fromEntries(entries);
|
|
1516
1544
|
}
|
|
1545
|
+
case "array": return Promise.all(input.elements.map((element) => recurse(element)));
|
|
1517
1546
|
case "instance":
|
|
1518
1547
|
if (!resolver) throw new Error(`Cannot resolve resource '${input.name}': this provider does not offer resources.`);
|
|
1519
1548
|
return resolver.acquire(input.name, input.output);
|
|
@@ -1815,6 +1844,12 @@ function parseInput(value, path, columns) {
|
|
|
1815
1844
|
kind: "object",
|
|
1816
1845
|
properties: Object.fromEntries(Object.entries(value.properties).map(([k, v]) => [k, recurse(v, `${path}.properties.${k}`)]))
|
|
1817
1846
|
};
|
|
1847
|
+
case "array":
|
|
1848
|
+
if (!Array.isArray(value.elements)) throw new InvalidCellError(`${path}.elements must be an array`);
|
|
1849
|
+
return {
|
|
1850
|
+
kind: "array",
|
|
1851
|
+
elements: value.elements.map((v, i) => recurse(v, `${path}.elements.${i}`))
|
|
1852
|
+
};
|
|
1818
1853
|
case "instance":
|
|
1819
1854
|
if (typeof value.name !== "string" || value.name === "") throw new InvalidCellError(`${path}.name must be a non-empty string`);
|
|
1820
1855
|
if (value.output !== void 0 && typeof value.output !== "string") throw new InvalidCellError(`${path}.output must be a string`);
|
|
@@ -1839,8 +1874,8 @@ function parseInput(value, path, columns) {
|
|
|
1839
1874
|
field: value.field
|
|
1840
1875
|
};
|
|
1841
1876
|
}
|
|
1842
|
-
throw new InvalidCellError(`${path} is a column reference; a dataset cell must hold a value, object, resource, or slot reference`);
|
|
1843
|
-
default: throw new InvalidCellError(`${path}.kind must be "value", "object", "instance", or "input"`);
|
|
1877
|
+
throw new InvalidCellError(`${path} is a column reference; a dataset cell must hold a value, object, array, resource, or slot reference`);
|
|
1878
|
+
default: throw new InvalidCellError(`${path}.kind must be "value", "object", "array", "instance", or "input"`);
|
|
1844
1879
|
}
|
|
1845
1880
|
}
|
|
1846
1881
|
/**
|
|
@@ -1899,6 +1934,7 @@ function columnRefs(input) {
|
|
|
1899
1934
|
switch (input.kind) {
|
|
1900
1935
|
case "dataset": return [input.field];
|
|
1901
1936
|
case "object": return Object.values(input.properties).flatMap(columnRefs);
|
|
1937
|
+
case "array": return input.elements.flatMap(columnRefs);
|
|
1902
1938
|
default: return [];
|
|
1903
1939
|
}
|
|
1904
1940
|
}
|
|
@@ -1907,6 +1943,7 @@ function slotRefs(input) {
|
|
|
1907
1943
|
switch (input.kind) {
|
|
1908
1944
|
case "input": return [input];
|
|
1909
1945
|
case "object": return Object.values(input.properties).flatMap(slotRefs);
|
|
1946
|
+
case "array": return input.elements.flatMap(slotRefs);
|
|
1910
1947
|
default: return [];
|
|
1911
1948
|
}
|
|
1912
1949
|
}
|
|
@@ -6297,6 +6334,8 @@ const DEFAULT_WINDOW_MS = 10080 * 60 * 1e3;
|
|
|
6297
6334
|
const DEFAULT_LIMIT = 200;
|
|
6298
6335
|
/** How often {@link CloudTraceProvider} checks for new traces while watched. */
|
|
6299
6336
|
const DEFAULT_POLL_INTERVAL_MS = 15e3;
|
|
6337
|
+
/** The least often {@link CloudTraceProvider} checks while nothing changes. */
|
|
6338
|
+
const DEFAULT_MAX_POLL_INTERVAL_MS = 5 * 6e4;
|
|
6300
6339
|
/** What the cloud's traces have: it keeps no annotations. */
|
|
6301
6340
|
const NO_ANNOTATIONS = {
|
|
6302
6341
|
issue: 0,
|
|
@@ -6317,7 +6356,8 @@ function fingerprint(trace) {
|
|
|
6317
6356
|
* The project's production traces, read from Evalution Cloud: what the apps
|
|
6318
6357
|
* you deployed sent with an ingest key. Read-only. There's no live stream of
|
|
6319
6358
|
* a trace's spans, and no annotations or SQL; {@link watch} polls the cloud
|
|
6320
|
-
* for new and changed traces instead
|
|
6359
|
+
* for new and changed traces instead, less often while nothing changes and
|
|
6360
|
+
* nobody lists the traces, since each poll is a query the cloud pays for.
|
|
6321
6361
|
*
|
|
6322
6362
|
* `evalution` adds one of these next to the configured trace providers when
|
|
6323
6363
|
* `EVALUTION_API_KEY` is a personal key and `.evalution/config.ts` links a
|
|
@@ -6339,9 +6379,16 @@ var CloudTraceProvider = class {
|
|
|
6339
6379
|
limit;
|
|
6340
6380
|
windowMs;
|
|
6341
6381
|
pollIntervalMs;
|
|
6382
|
+
maxPollIntervalMs;
|
|
6342
6383
|
log;
|
|
6343
6384
|
watchers = /* @__PURE__ */ new Set();
|
|
6344
6385
|
timer;
|
|
6386
|
+
/** How long the next poll waits after the one before it, in ms. */
|
|
6387
|
+
delayMs = 0;
|
|
6388
|
+
/** When the next poll is due, in ms since the epoch. */
|
|
6389
|
+
dueAt = 0;
|
|
6390
|
+
/** Whether a poll is waiting on the cloud. */
|
|
6391
|
+
polling = false;
|
|
6345
6392
|
/** What the last listing returned, by id, as {@link fingerprint}s. */
|
|
6346
6393
|
known;
|
|
6347
6394
|
lastListed = [];
|
|
@@ -6355,9 +6402,11 @@ var CloudTraceProvider = class {
|
|
|
6355
6402
|
this.limit = options.limit ?? DEFAULT_LIMIT;
|
|
6356
6403
|
this.windowMs = options.windowMs ?? DEFAULT_WINDOW_MS;
|
|
6357
6404
|
this.pollIntervalMs = options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
|
|
6405
|
+
this.maxPollIntervalMs = Math.max(this.pollIntervalMs, options.maxPollIntervalMs ?? DEFAULT_MAX_POLL_INTERVAL_MS);
|
|
6358
6406
|
this.log = options.log ?? console;
|
|
6359
6407
|
}
|
|
6360
6408
|
async getAllTraces(query) {
|
|
6409
|
+
this.hurry();
|
|
6361
6410
|
try {
|
|
6362
6411
|
return await this.list(query);
|
|
6363
6412
|
} catch {
|
|
@@ -6370,6 +6419,7 @@ var CloudTraceProvider = class {
|
|
|
6370
6419
|
* grouped instead.
|
|
6371
6420
|
*/
|
|
6372
6421
|
async groupTraces(query) {
|
|
6422
|
+
this.hurry();
|
|
6373
6423
|
try {
|
|
6374
6424
|
const groups = await this.client.listTraceGroups({
|
|
6375
6425
|
...this.window(),
|
|
@@ -6408,7 +6458,10 @@ var CloudTraceProvider = class {
|
|
|
6408
6458
|
*/
|
|
6409
6459
|
watch(callback) {
|
|
6410
6460
|
this.watchers.add(callback);
|
|
6411
|
-
if (this.watchers.size === 1)
|
|
6461
|
+
if (this.watchers.size === 1) {
|
|
6462
|
+
this.delayMs = this.pollIntervalMs;
|
|
6463
|
+
this.schedule(0);
|
|
6464
|
+
}
|
|
6412
6465
|
return () => {
|
|
6413
6466
|
this.watchers.delete(callback);
|
|
6414
6467
|
if (this.watchers.size === 0) {
|
|
@@ -6467,28 +6520,52 @@ var CloudTraceProvider = class {
|
|
|
6467
6520
|
const current = new Map(traces.map((t) => [t.id, fingerprint(t)]));
|
|
6468
6521
|
if (this.watchers.size > 0) this.known = current;
|
|
6469
6522
|
if (!previous || this.watchers.size === 0) return;
|
|
6523
|
+
const events = [];
|
|
6470
6524
|
for (const [traceId, print] of current) {
|
|
6471
6525
|
const before = previous.get(traceId);
|
|
6472
|
-
if (before === void 0)
|
|
6526
|
+
if (before === void 0) events.push({
|
|
6473
6527
|
type: "add",
|
|
6474
6528
|
traceId
|
|
6475
6529
|
});
|
|
6476
|
-
else if (before !== print)
|
|
6530
|
+
else if (before !== print) events.push({
|
|
6477
6531
|
type: "update",
|
|
6478
6532
|
traceId
|
|
6479
6533
|
});
|
|
6480
6534
|
}
|
|
6481
|
-
for (const traceId of previous.keys()) if (!current.has(traceId))
|
|
6535
|
+
for (const traceId of previous.keys()) if (!current.has(traceId)) events.push({
|
|
6482
6536
|
type: "remove",
|
|
6483
6537
|
traceId
|
|
6484
6538
|
});
|
|
6539
|
+
if (events.length > 0) this.delayMs = this.pollIntervalMs;
|
|
6540
|
+
for (const event of events) this.emit(event);
|
|
6541
|
+
}
|
|
6542
|
+
/**
|
|
6543
|
+
* Someone is looking at the traces: polls at the shortest interval again,
|
|
6544
|
+
* bringing the next poll forward if it's further off than that.
|
|
6545
|
+
*/
|
|
6546
|
+
hurry() {
|
|
6547
|
+
this.delayMs = this.pollIntervalMs;
|
|
6548
|
+
if (this.timer === void 0 || this.polling) return;
|
|
6549
|
+
if (this.dueAt - Date.now() <= this.pollIntervalMs) return;
|
|
6550
|
+
clearTimeout(this.timer);
|
|
6551
|
+
this.schedule(this.pollIntervalMs);
|
|
6485
6552
|
}
|
|
6486
6553
|
schedule(delayMs) {
|
|
6487
|
-
this.
|
|
6488
|
-
|
|
6489
|
-
|
|
6554
|
+
this.dueAt = Date.now() + delayMs;
|
|
6555
|
+
const timer = setTimeout(async () => {
|
|
6556
|
+
this.polling = true;
|
|
6557
|
+
try {
|
|
6558
|
+
await this.list().catch(() => {});
|
|
6559
|
+
} finally {
|
|
6560
|
+
this.polling = false;
|
|
6561
|
+
}
|
|
6562
|
+
if (this.timer !== timer || this.watchers.size === 0) return;
|
|
6563
|
+
const wait = this.delayMs;
|
|
6564
|
+
this.delayMs = Math.min(wait * 2, this.maxPollIntervalMs);
|
|
6565
|
+
this.schedule(wait);
|
|
6490
6566
|
}, delayMs);
|
|
6491
|
-
this.timer
|
|
6567
|
+
this.timer = timer;
|
|
6568
|
+
timer.unref?.();
|
|
6492
6569
|
}
|
|
6493
6570
|
emit(event) {
|
|
6494
6571
|
for (const watcher of this.watchers) try {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as DatasetRowsOverview, n as DatasetRow, r as DatasetRowUpdate, t as Dataset } from "./dataset-types-
|
|
1
|
+
import { i as DatasetRowsOverview, n as DatasetRow, r as DatasetRowUpdate, t as Dataset } from "./dataset-types-0N5KYU1i.js";
|
|
2
2
|
import { TraceWithSpans } from "@evalution/sdk";
|
|
3
3
|
|
|
4
4
|
//#region src/views/view.d.ts
|