llmtap 0.1.0
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/dashboard/assets/BarChart-N8X7TKRf.js +1 -0
- package/dist/dashboard/assets/Costs-BhWdS2kw.js +4 -0
- package/dist/dashboard/assets/Dashboard-DnHLwJsN.js +9 -0
- package/dist/dashboard/assets/Models-5jWcyfAk.js +1 -0
- package/dist/dashboard/assets/Sessions-IXJPYjKe.js +3 -0
- package/dist/dashboard/assets/Settings-kxBLuIHe.js +6 -0
- package/dist/dashboard/assets/TraceDetail-DdKFps7x.js +18 -0
- package/dist/dashboard/assets/Traces-Cv9L_xTe.js +2 -0
- package/dist/dashboard/assets/chevron-down-B0xosrpl.js +1 -0
- package/dist/dashboard/assets/clock-CSGov78l.js +1 -0
- package/dist/dashboard/assets/coins-RIVI5-1a.js +1 -0
- package/dist/dashboard/assets/download-PygxZ--5.js +1 -0
- package/dist/dashboard/assets/fira-code-400-CHoedHDv.woff2 +0 -0
- package/dist/dashboard/assets/fira-sans-300-B2LrTgQS.woff2 +0 -0
- package/dist/dashboard/assets/fira-sans-400-a0AnQzuD.woff2 +0 -0
- package/dist/dashboard/assets/fira-sans-500-Bvbxc8ch.woff2 +0 -0
- package/dist/dashboard/assets/fira-sans-600-CXKlxLG9.woff2 +0 -0
- package/dist/dashboard/assets/fira-sans-700-CRhwpWTq.woff2 +0 -0
- package/dist/dashboard/assets/format-BiBDo3KS.js +1 -0
- package/dist/dashboard/assets/gauge-BBNKtqFH.js +1 -0
- package/dist/dashboard/assets/generateCategoricalChart-CylgFInn.js +61 -0
- package/dist/dashboard/assets/index-BBr9_AHg.js +22 -0
- package/dist/dashboard/assets/index-CIGK6hiV.css +1 -0
- package/dist/dashboard/assets/layers--K2XRXAx.js +1 -0
- package/dist/dashboard/assets/message-square-DdcqfsnD.js +1 -0
- package/dist/dashboard/assets/orbit-2k6lSwt7.js +1 -0
- package/dist/dashboard/assets/search-BwbP84dP.js +1 -0
- package/dist/dashboard/assets/zap-Ccrxhk2Q.js +1 -0
- package/dist/dashboard/index.html +13 -0
- package/dist/index.js +487 -0
- package/dist/index.js.map +1 -0
- package/package.json +50 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as a,N as i,X as s,Y as t,o as e}from"./generateCategoricalChart-CylgFInn.js";var o=a({chartName:"BarChart",GraphicalChild:i,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:s},{axisType:"yAxis",AxisComp:t}],formatAxisMap:e});export{o as B};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{c as le,R as f,l as qe,r as be,j as s,m as D,b as it,f as st}from"./index-BBr9_AHg.js";import{u as ot,P as lt,b as I,a as ct,c as ut}from"./format-BiBDo3KS.js";import{C as dt}from"./coins-RIVI5-1a.js";import{Z as ft}from"./zap-Ccrxhk2Q.js";import{e as E,f as j,r as He,q as pt,s as We,t as mt,j as M,v as je,w as S,L as O,x as Ze,y as Ae,z as Ge,D as ht,C as vt,b as Z,k as V,S as xt,A as yt,B as gt,a as Oe,d as bt,i as q,g as jt,u as At,G as kt,E as ne,F as wt,H as Ue,I as Pt,J as re,K as Ne,n as Ot,M as Nt,R as _e,p as _t,X as St,Y as Tt,T as Se,N as Rt}from"./generateCategoricalChart-CylgFInn.js";import{B as Et}from"./BarChart-N8X7TKRf.js";import{O as Lt}from"./orbit-2k6lSwt7.js";import{L as It}from"./layers--K2XRXAx.js";const $t=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],Te=le("chart-column",$t);const Ct=[["path",{d:"M13 16H8",key:"wsln4y"}],["path",{d:"M14 8H8",key:"1l3xfs"}],["path",{d:"M16 12H8",key:"1fr5h0"}],["path",{d:"M4 3a1 1 0 0 1 1-1 1.3 1.3 0 0 1 .7.2l.933.6a1.3 1.3 0 0 0 1.4 0l.934-.6a1.3 1.3 0 0 1 1.4 0l.933.6a1.3 1.3 0 0 0 1.4 0l.933-.6a1.3 1.3 0 0 1 1.4 0l.934.6a1.3 1.3 0 0 0 1.4 0l.933-.6A1.3 1.3 0 0 1 19 2a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1 1.3 1.3 0 0 1-.7-.2l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.934.6a1.3 1.3 0 0 1-1.4 0l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-1.4 0l-.934-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-.7.2 1 1 0 0 1-1-1z",key:"ycz6yz"}]],Dt=le("receipt-text",Ct);const Mt=[["path",{d:"M10 2h4",key:"n1abiw"}],["path",{d:"M12 14v-4",key:"1evpnu"}],["path",{d:"M4 13a8 8 0 0 1 8-7 8 8 0 1 1-5.3 14L4 17.6",key:"1ts96g"}],["path",{d:"M9 17H4v5",key:"8t5av"}]],Bt=le("timer-reset",Mt);const Ft=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2",key:"4125el"}],["path",{d:"M3 11h3c.8 0 1.6.3 2.1.9l1.1.9c1.6 1.6 4.1 1.6 5.7 0l1.1-.9c.5-.5 1.3-.9 2.1-.9H21",key:"1dpki6"}]],Kt=le("wallet-cards",Ft);var zt=["points","className","baseLinePoints","connectNulls"];function H(){return H=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=n[t])}return r},H.apply(this,arguments)}function Vt(r,e){if(r==null)return{};var n=qt(r,e),t,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);for(a=0;a<o.length;a++)t=o[a],!(e.indexOf(t)>=0)&&Object.prototype.propertyIsEnumerable.call(r,t)&&(n[t]=r[t])}return n}function qt(r,e){if(r==null)return{};var n={};for(var t in r)if(Object.prototype.hasOwnProperty.call(r,t)){if(e.indexOf(t)>=0)continue;n[t]=r[t]}return n}function Re(r){return Gt(r)||Zt(r)||Wt(r)||Ht()}function Ht(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Wt(r,e){if(r){if(typeof r=="string")return ve(r,e);var n=Object.prototype.toString.call(r).slice(8,-1);if(n==="Object"&&r.constructor&&(n=r.constructor.name),n==="Map"||n==="Set")return Array.from(r);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ve(r,e)}}function Zt(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function Gt(r){if(Array.isArray(r))return ve(r)}function ve(r,e){(e==null||e>r.length)&&(e=r.length);for(var n=0,t=new Array(e);n<e;n++)t[n]=r[n];return t}var Ee=function(e){return e&&e.x===+e.x&&e.y===+e.y},Ut=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=[[]];return e.forEach(function(t){Ee(t)?n[n.length-1].push(t):n[n.length-1].length>0&&n.push([])}),Ee(e[0])&&n[n.length-1].push(e[0]),n[n.length-1].length<=0&&(n=n.slice(0,-1)),n},J=function(e,n){var t=Ut(e);n&&(t=[t.reduce(function(o,i){return[].concat(Re(o),Re(i))},[])]);var a=t.map(function(o){return o.reduce(function(i,l,d){return"".concat(i).concat(d===0?"M":"L").concat(l.x,",").concat(l.y)},"")}).join("");return t.length===1?"".concat(a,"Z"):a},Xt=function(e,n,t){var a=J(e,t);return"".concat(a.slice(-1)==="Z"?a.slice(0,-1):a,"L").concat(J(n.reverse(),t).slice(1))},Yt=function(e){var n=e.points,t=e.className,a=e.baseLinePoints,o=e.connectNulls,i=Vt(e,zt);if(!n||!n.length)return null;var l=E("recharts-polygon",t);if(a&&a.length){var d=i.stroke&&i.stroke!=="none",c=Xt(n,a,o);return f.createElement("g",{className:l},f.createElement("path",H({},j(i,!0),{fill:c.slice(-1)==="Z"?i.fill:"none",stroke:"none",d:c})),d?f.createElement("path",H({},j(i,!0),{fill:"none",d:J(n,o)})):null,d?f.createElement("path",H({},j(i,!0),{fill:"none",d:J(a,o)})):null)}var p=J(n,o);return f.createElement("path",H({},j(i,!0),{fill:p.slice(-1)==="Z"?i.fill:"none",className:l,d:p}))},pe,Le;function Jt(){if(Le)return pe;Le=1;var r=He(),e=pt(),n=We();function t(a,o){return a&&a.length?r(a,n(o,2),e):void 0}return pe=t,pe}var Qt=Jt();const er=qe(Qt);var me,Ie;function tr(){if(Ie)return me;Ie=1;var r=He(),e=We(),n=mt();function t(a,o){return a&&a.length?r(a,e(o,2),n):void 0}return me=t,me}var rr=tr();const nr=qe(rr);var ar=["cx","cy","angle","ticks","axisLine"],ir=["ticks","tick","angle","tickFormatter","stroke"];function G(r){"@babel/helpers - typeof";return G=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},G(r)}function Q(){return Q=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=n[t])}return r},Q.apply(this,arguments)}function $e(r,e){var n=Object.keys(r);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(r);e&&(t=t.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),n.push.apply(n,t)}return n}function $(r){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?$e(Object(n),!0).forEach(function(t){ce(r,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):$e(Object(n)).forEach(function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(n,t))})}return r}function Ce(r,e){if(r==null)return{};var n=sr(r,e),t,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);for(a=0;a<o.length;a++)t=o[a],!(e.indexOf(t)>=0)&&Object.prototype.propertyIsEnumerable.call(r,t)&&(n[t]=r[t])}return n}function sr(r,e){if(r==null)return{};var n={};for(var t in r)if(Object.prototype.hasOwnProperty.call(r,t)){if(e.indexOf(t)>=0)continue;n[t]=r[t]}return n}function or(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function De(r,e){for(var n=0;n<e.length;n++){var t=e[n];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(r,Ye(t.key),t)}}function lr(r,e,n){return e&&De(r.prototype,e),n&&De(r,n),Object.defineProperty(r,"prototype",{writable:!1}),r}function cr(r,e,n){return e=ie(e),ur(r,Xe()?Reflect.construct(e,n||[],ie(r).constructor):e.apply(r,n))}function ur(r,e){if(e&&(G(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return dr(r)}function dr(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function Xe(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Xe=function(){return!!r})()}function ie(r){return ie=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},ie(r)}function fr(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),e&&xe(r,e)}function xe(r,e){return xe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,a){return t.__proto__=a,t},xe(r,e)}function ce(r,e,n){return e=Ye(e),e in r?Object.defineProperty(r,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[e]=n,r}function Ye(r){var e=pr(r,"string");return G(e)=="symbol"?e:e+""}function pr(r,e){if(G(r)!="object"||!r)return r;var n=r[Symbol.toPrimitive];if(n!==void 0){var t=n.call(r,e);if(G(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var ue=(function(r){function e(){return or(this,e),cr(this,e,arguments)}return fr(e,r),lr(e,[{key:"getTickValueCoord",value:function(t){var a=t.coordinate,o=this.props,i=o.angle,l=o.cx,d=o.cy;return S(l,d,a,i)}},{key:"getTickTextAnchor",value:function(){var t=this.props.orientation,a;switch(t){case"left":a="end";break;case"right":a="start";break;default:a="middle";break}return a}},{key:"getViewBox",value:function(){var t=this.props,a=t.cx,o=t.cy,i=t.angle,l=t.ticks,d=er(l,function(p){return p.coordinate||0}),c=nr(l,function(p){return p.coordinate||0});return{cx:a,cy:o,startAngle:i,endAngle:i,innerRadius:c.coordinate||0,outerRadius:d.coordinate||0}}},{key:"renderAxisLine",value:function(){var t=this.props,a=t.cx,o=t.cy,i=t.angle,l=t.ticks,d=t.axisLine,c=Ce(t,ar),p=l.reduce(function(m,u){return[Math.min(m[0],u.coordinate),Math.max(m[1],u.coordinate)]},[1/0,-1/0]),h=S(a,o,p[0],i),y=S(a,o,p[1],i),A=$($($({},j(c,!1)),{},{fill:"none"},j(d,!1)),{},{x1:h.x,y1:h.y,x2:y.x,y2:y.y});return f.createElement("line",Q({className:"recharts-polar-radius-axis-line"},A))}},{key:"renderTicks",value:function(){var t=this,a=this.props,o=a.ticks,i=a.tick,l=a.angle,d=a.tickFormatter,c=a.stroke,p=Ce(a,ir),h=this.getTickTextAnchor(),y=j(p,!1),A=j(i,!1),m=o.map(function(u,x){var g=t.getTickValueCoord(u),b=$($($($({textAnchor:h,transform:"rotate(".concat(90-l,", ").concat(g.x,", ").concat(g.y,")")},y),{},{stroke:"none",fill:c},A),{},{index:x},g),{},{payload:u});return f.createElement(O,Q({className:E("recharts-polar-radius-axis-tick",Ze(i)),key:"tick-".concat(u.coordinate)},Ae(t.props,u,x)),e.renderTickItem(i,b,d?d(u.value,x):u.value))});return f.createElement(O,{className:"recharts-polar-radius-axis-ticks"},m)}},{key:"render",value:function(){var t=this.props,a=t.ticks,o=t.axisLine,i=t.tick;return!a||!a.length?null:f.createElement(O,{className:E("recharts-polar-radius-axis",this.props.className)},o&&this.renderAxisLine(),i&&this.renderTicks(),Ge.renderCallByParent(this.props,this.getViewBox()))}}],[{key:"renderTickItem",value:function(t,a,o){var i;return f.isValidElement(t)?i=f.cloneElement(t,a):M(t)?i=t(a):i=f.createElement(je,Q({},a,{className:"recharts-polar-radius-axis-tick-value"}),o),i}}])})(be.PureComponent);ce(ue,"displayName","PolarRadiusAxis");ce(ue,"axisType","radiusAxis");ce(ue,"defaultProps",{type:"number",radiusAxisId:0,cx:0,cy:0,angle:0,orientation:"right",stroke:"#ccc",axisLine:!0,tick:!0,tickCount:5,allowDataOverflow:!1,scale:"auto",allowDuplicatedCategory:!0});function U(r){"@babel/helpers - typeof";return U=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},U(r)}function B(){return B=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=n[t])}return r},B.apply(this,arguments)}function Me(r,e){var n=Object.keys(r);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(r);e&&(t=t.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),n.push.apply(n,t)}return n}function C(r){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Me(Object(n),!0).forEach(function(t){de(r,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):Me(Object(n)).forEach(function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(n,t))})}return r}function mr(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function Be(r,e){for(var n=0;n<e.length;n++){var t=e[n];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(r,Qe(t.key),t)}}function hr(r,e,n){return e&&Be(r.prototype,e),n&&Be(r,n),Object.defineProperty(r,"prototype",{writable:!1}),r}function vr(r,e,n){return e=se(e),xr(r,Je()?Reflect.construct(e,n||[],se(r).constructor):e.apply(r,n))}function xr(r,e){if(e&&(U(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return yr(r)}function yr(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function Je(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Je=function(){return!!r})()}function se(r){return se=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},se(r)}function gr(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),e&&ye(r,e)}function ye(r,e){return ye=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,a){return t.__proto__=a,t},ye(r,e)}function de(r,e,n){return e=Qe(e),e in r?Object.defineProperty(r,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[e]=n,r}function Qe(r){var e=br(r,"string");return U(e)=="symbol"?e:e+""}function br(r,e){if(U(r)!="object"||!r)return r;var n=r[Symbol.toPrimitive];if(n!==void 0){var t=n.call(r,e);if(U(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var jr=Math.PI/180,Fe=1e-5,fe=(function(r){function e(){return mr(this,e),vr(this,e,arguments)}return gr(e,r),hr(e,[{key:"getTickLineCoord",value:function(t){var a=this.props,o=a.cx,i=a.cy,l=a.radius,d=a.orientation,c=a.tickSize,p=c||8,h=S(o,i,l,t.coordinate),y=S(o,i,l+(d==="inner"?-1:1)*p,t.coordinate);return{x1:h.x,y1:h.y,x2:y.x,y2:y.y}}},{key:"getTickTextAnchor",value:function(t){var a=this.props.orientation,o=Math.cos(-t.coordinate*jr),i;return o>Fe?i=a==="outer"?"start":"end":o<-Fe?i=a==="outer"?"end":"start":i="middle",i}},{key:"renderAxisLine",value:function(){var t=this.props,a=t.cx,o=t.cy,i=t.radius,l=t.axisLine,d=t.axisLineType,c=C(C({},j(this.props,!1)),{},{fill:"none"},j(l,!1));if(d==="circle")return f.createElement(ht,B({className:"recharts-polar-angle-axis-line"},c,{cx:a,cy:o,r:i}));var p=this.props.ticks,h=p.map(function(y){return S(a,o,i,y.coordinate)});return f.createElement(Yt,B({className:"recharts-polar-angle-axis-line"},c,{points:h}))}},{key:"renderTicks",value:function(){var t=this,a=this.props,o=a.ticks,i=a.tick,l=a.tickLine,d=a.tickFormatter,c=a.stroke,p=j(this.props,!1),h=j(i,!1),y=C(C({},p),{},{fill:"none"},j(l,!1)),A=o.map(function(m,u){var x=t.getTickLineCoord(m),g=t.getTickTextAnchor(m),b=C(C(C({textAnchor:g},p),{},{stroke:"none",fill:c},h),{},{index:u,payload:m,x:x.x2,y:x.y2});return f.createElement(O,B({className:E("recharts-polar-angle-axis-tick",Ze(i)),key:"tick-".concat(m.coordinate)},Ae(t.props,m,u)),l&&f.createElement("line",B({className:"recharts-polar-angle-axis-tick-line"},y,x)),i&&e.renderTickItem(i,b,d?d(m.value,u):m.value))});return f.createElement(O,{className:"recharts-polar-angle-axis-ticks"},A)}},{key:"render",value:function(){var t=this.props,a=t.ticks,o=t.radius,i=t.axisLine;return o<=0||!a||!a.length?null:f.createElement(O,{className:E("recharts-polar-angle-axis",this.props.className)},i&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(t,a,o){var i;return f.isValidElement(t)?i=f.cloneElement(t,a):M(t)?i=t(a):i=f.createElement(je,B({},a,{className:"recharts-polar-angle-axis-tick-value"}),o),i}}])})(be.PureComponent);de(fe,"displayName","PolarAngleAxis");de(fe,"axisType","angleAxis");de(fe,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var ae;function X(r){"@babel/helpers - typeof";return X=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},X(r)}function W(){return W=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=n[t])}return r},W.apply(this,arguments)}function Ke(r,e){var n=Object.keys(r);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(r);e&&(t=t.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),n.push.apply(n,t)}return n}function v(r){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Ke(Object(n),!0).forEach(function(t){w(r,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):Ke(Object(n)).forEach(function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(n,t))})}return r}function Ar(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function ze(r,e){for(var n=0;n<e.length;n++){var t=e[n];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(r,tt(t.key),t)}}function kr(r,e,n){return e&&ze(r.prototype,e),n&&ze(r,n),Object.defineProperty(r,"prototype",{writable:!1}),r}function wr(r,e,n){return e=oe(e),Pr(r,et()?Reflect.construct(e,n||[],oe(r).constructor):e.apply(r,n))}function Pr(r,e){if(e&&(X(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Or(r)}function Or(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function et(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(et=function(){return!!r})()}function oe(r){return oe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},oe(r)}function Nr(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),e&&ge(r,e)}function ge(r,e){return ge=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,a){return t.__proto__=a,t},ge(r,e)}function w(r,e,n){return e=tt(e),e in r?Object.defineProperty(r,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[e]=n,r}function tt(r){var e=_r(r,"string");return X(e)=="symbol"?e:e+""}function _r(r,e){if(X(r)!="object"||!r)return r;var n=r[Symbol.toPrimitive];if(n!==void 0){var t=n.call(r,e);if(X(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}var T=(function(r){function e(n){var t;return Ar(this,e),t=wr(this,e,[n]),w(t,"pieRef",null),w(t,"sectorRefs",[]),w(t,"id",At("recharts-pie-")),w(t,"handleAnimationEnd",function(){var a=t.props.onAnimationEnd;t.setState({isAnimationFinished:!0}),M(a)&&a()}),w(t,"handleAnimationStart",function(){var a=t.props.onAnimationStart;t.setState({isAnimationFinished:!1}),M(a)&&a()}),t.state={isAnimationFinished:!n.isAnimationActive,prevIsAnimationActive:n.isAnimationActive,prevAnimationId:n.animationId,sectorToFocus:0},t}return Nr(e,r),kr(e,[{key:"isActiveIndex",value:function(t){var a=this.props.activeIndex;return Array.isArray(a)?a.indexOf(t)!==-1:t===a}},{key:"hasActiveIndex",value:function(){var t=this.props.activeIndex;return Array.isArray(t)?t.length!==0:t||t===0}},{key:"renderLabels",value:function(t){var a=this.props.isAnimationActive;if(a&&!this.state.isAnimationFinished)return null;var o=this.props,i=o.label,l=o.labelLine,d=o.dataKey,c=o.valueKey,p=j(this.props,!1),h=j(i,!1),y=j(l,!1),A=i&&i.offsetRadius||20,m=t.map(function(u,x){var g=(u.startAngle+u.endAngle)/2,b=S(u.cx,u.cy,u.outerRadius+A,g),P=v(v(v(v({},p),u),{},{stroke:"none"},h),{},{index:x,textAnchor:e.getTextAnchor(b.x,u.cx)},b),F=v(v(v(v({},p),u),{},{fill:"none",stroke:u.fill},y),{},{index:x,points:[S(u.cx,u.cy,u.outerRadius,g),b]}),N=d;return Z(d)&&Z(c)?N="value":Z(d)&&(N=c),f.createElement(O,{key:"label-".concat(u.startAngle,"-").concat(u.endAngle,"-").concat(u.midAngle,"-").concat(x)},l&&e.renderLabelLineItem(l,F,"line"),e.renderLabelItem(i,P,V(u,N)))});return f.createElement(O,{className:"recharts-pie-labels"},m)}},{key:"renderSectorsStatically",value:function(t){var a=this,o=this.props,i=o.activeShape,l=o.blendStroke,d=o.inactiveShape;return t.map(function(c,p){if(c?.startAngle===0&&c?.endAngle===0&&t.length!==1)return null;var h=a.isActiveIndex(p),y=d&&a.hasActiveIndex()?d:null,A=h?i:y,m=v(v({},c),{},{stroke:l?c.fill:c.stroke,tabIndex:-1});return f.createElement(O,W({ref:function(x){x&&!a.sectorRefs.includes(x)&&a.sectorRefs.push(x)},tabIndex:-1,className:"recharts-pie-sector"},Ae(a.props,c,p),{key:"sector-".concat(c?.startAngle,"-").concat(c?.endAngle,"-").concat(c.midAngle,"-").concat(p)}),f.createElement(xt,W({option:A,isActive:h,shapeType:"sector"},m)))})}},{key:"renderSectorsWithAnimation",value:function(){var t=this,a=this.props,o=a.sectors,i=a.isAnimationActive,l=a.animationBegin,d=a.animationDuration,c=a.animationEasing,p=a.animationId,h=this.state,y=h.prevSectors,A=h.prevIsAnimationActive;return f.createElement(yt,{begin:l,duration:d,isActive:i,easing:c,from:{t:0},to:{t:1},key:"pie-".concat(p,"-").concat(A),onAnimationStart:this.handleAnimationStart,onAnimationEnd:this.handleAnimationEnd},function(m){var u=m.t,x=[],g=o&&o[0],b=g.startAngle;return o.forEach(function(P,F){var N=y&&y[F],L=F>0?gt(P,"paddingAngle",0):0;if(N){var Y=Oe(N.endAngle-N.startAngle,P.endAngle-P.startAngle),k=v(v({},P),{},{startAngle:b+L,endAngle:b+Y(u)+L});x.push(k),b=k.endAngle}else{var K=P.endAngle,_=P.startAngle,ee=Oe(0,K-_),te=ee(u),R=v(v({},P),{},{startAngle:b+L,endAngle:b+te+L});x.push(R),b=R.endAngle}}),f.createElement(O,null,t.renderSectorsStatically(x))})}},{key:"attachKeyboardHandlers",value:function(t){var a=this;t.onkeydown=function(o){if(!o.altKey)switch(o.key){case"ArrowLeft":{var i=++a.state.sectorToFocus%a.sectorRefs.length;a.sectorRefs[i].focus(),a.setState({sectorToFocus:i});break}case"ArrowRight":{var l=--a.state.sectorToFocus<0?a.sectorRefs.length-1:a.state.sectorToFocus%a.sectorRefs.length;a.sectorRefs[l].focus(),a.setState({sectorToFocus:l});break}case"Escape":{a.sectorRefs[a.state.sectorToFocus].blur(),a.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var t=this.props,a=t.sectors,o=t.isAnimationActive,i=this.state.prevSectors;return o&&a&&a.length&&(!i||!bt(i,a))?this.renderSectorsWithAnimation():this.renderSectorsStatically(a)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var t=this,a=this.props,o=a.hide,i=a.sectors,l=a.className,d=a.label,c=a.cx,p=a.cy,h=a.innerRadius,y=a.outerRadius,A=a.isAnimationActive,m=this.state.isAnimationFinished;if(o||!i||!i.length||!q(c)||!q(p)||!q(h)||!q(y))return null;var u=E("recharts-pie",l);return f.createElement(O,{tabIndex:this.props.rootTabIndex,className:u,ref:function(g){t.pieRef=g}},this.renderSectors(),d&&this.renderLabels(i),Ge.renderCallByParent(this.props,null,!1),(!A||m)&&jt.renderCallByParent(this.props,i,!1))}}],[{key:"getDerivedStateFromProps",value:function(t,a){return a.prevIsAnimationActive!==t.isAnimationActive?{prevIsAnimationActive:t.isAnimationActive,prevAnimationId:t.animationId,curSectors:t.sectors,prevSectors:[],isAnimationFinished:!0}:t.isAnimationActive&&t.animationId!==a.prevAnimationId?{prevAnimationId:t.animationId,curSectors:t.sectors,prevSectors:a.curSectors,isAnimationFinished:!0}:t.sectors!==a.curSectors?{curSectors:t.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(t,a){return t>a?"start":t<a?"end":"middle"}},{key:"renderLabelLineItem",value:function(t,a,o){if(f.isValidElement(t))return f.cloneElement(t,a);if(M(t))return t(a);var i=E("recharts-pie-label-line",typeof t!="boolean"?t.className:"");return f.createElement(vt,W({},a,{key:o,type:"linear",className:i}))}},{key:"renderLabelItem",value:function(t,a,o){if(f.isValidElement(t))return f.cloneElement(t,a);var i=o;if(M(t)&&(i=t(a),f.isValidElement(i)))return i;var l=E("recharts-pie-label-text",typeof t!="boolean"&&!M(t)?t.className:"");return f.createElement(je,W({},a,{alignmentBaseline:"middle",className:l}),i)}}])})(be.PureComponent);ae=T;w(T,"displayName","Pie");w(T,"defaultProps",{stroke:"#fff",fill:"#808080",legendType:"rect",cx:"50%",cy:"50%",startAngle:0,endAngle:360,innerRadius:0,outerRadius:"80%",paddingAngle:0,labelLine:!0,hide:!1,minAngle:0,isAnimationActive:!kt.isSsr,animationBegin:400,animationDuration:1500,animationEasing:"ease",nameKey:"name",blendStroke:!1,rootTabIndex:0});w(T,"parseDeltaAngle",function(r,e){var n=ne(e-r),t=Math.min(Math.abs(e-r),360);return n*t});w(T,"getRealPieData",function(r){var e=r.data,n=r.children,t=j(r,!1),a=wt(n,Ue);return e&&e.length?e.map(function(o,i){return v(v(v({payload:o},t),o),a&&a[i]&&a[i].props)}):a&&a.length?a.map(function(o){return v(v({},t),o.props)}):[]});w(T,"parseCoordinateOfPie",function(r,e){var n=e.top,t=e.left,a=e.width,o=e.height,i=Pt(a,o),l=t+re(r.cx,a,a/2),d=n+re(r.cy,o,o/2),c=re(r.innerRadius,i,0),p=re(r.outerRadius,i,i*.8),h=r.maxRadius||Math.sqrt(a*a+o*o)/2;return{cx:l,cy:d,innerRadius:c,outerRadius:p,maxRadius:h}});w(T,"getComposedData",function(r){var e=r.item,n=r.offset,t=e.type.defaultProps!==void 0?v(v({},e.type.defaultProps),e.props):e.props,a=ae.getRealPieData(t);if(!a||!a.length)return null;var o=t.cornerRadius,i=t.startAngle,l=t.endAngle,d=t.paddingAngle,c=t.dataKey,p=t.nameKey,h=t.valueKey,y=t.tooltipType,A=Math.abs(t.minAngle),m=ae.parseCoordinateOfPie(t,n),u=ae.parseDeltaAngle(i,l),x=Math.abs(u),g=c;Z(c)&&Z(h)?(Ne(!1,`Use "dataKey" to specify the value of pie,
|
|
3
|
+
the props "valueKey" will be deprecated in 1.1.0`),g="value"):Z(c)&&(Ne(!1,`Use "dataKey" to specify the value of pie,
|
|
4
|
+
the props "valueKey" will be deprecated in 1.1.0`),g=h);var b=a.filter(function(k){return V(k,g,0)!==0}).length,P=(x>=360?b:b-1)*d,F=x-b*A-P,N=a.reduce(function(k,K){var _=V(K,g,0);return k+(q(_)?_:0)},0),L;if(N>0){var Y;L=a.map(function(k,K){var _=V(k,g,0),ee=V(k,p,K),te=(q(_)?_:0)/N,R;K?R=Y.endAngle+ne(u)*d*(_!==0?1:0):R=i;var ke=R+ne(u)*((_!==0?A:0)+te*F),we=(R+ke)/2,Pe=(m.innerRadius+m.outerRadius)/2,nt=[{name:ee,value:_,payload:k,dataKey:g,type:y}],at=S(m.cx,m.cy,Pe,we);return Y=v(v(v({percent:te,cornerRadius:o,name:ee,tooltipPayload:nt,midAngle:we,middleRadius:Pe,tooltipPosition:at},k),m),{},{value:V(k,g),startAngle:R,endAngle:ke,payload:k,paddingAngle:ne(u)*d}),Y})}return v(v({},m),{},{sectors:L,data:a})});var Sr=Ot({chartName:"PieChart",GraphicalChild:T,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:fe},{axisType:"radiusAxis",AxisComp:ue}],formatAxisMap:Nt,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}});const z=["#34d399","#38bdf8","#818cf8","#f59e0b","#f97316","#f472b6"],rt={container:{transition:{staggerChildren:.08}},item:{hidden:{opacity:0,y:20,scale:.97},show:{opacity:1,y:0,scale:1,transition:{duration:.4,ease:[.22,1,.36,1]}}}},Ve={backgroundColor:"rgba(8, 15, 28, 0.96)",border:"1px solid rgba(148, 163, 184, 0.14)",borderRadius:"18px",fontSize:12,boxShadow:"0 20px 60px rgba(0,0,0,0.45)",backdropFilter:"blur(12px)"};function he({label:r,value:e,sub:n,icon:t,gradient:a}){return s.jsxs(D.div,{variants:rt.item,className:"metric-card",children:[s.jsx("div",{className:`metric-orb ${a}`,children:t}),s.jsxs("div",{children:[s.jsx("div",{className:"hud-label",children:r}),s.jsx("div",{className:"mt-1 text-3xl font-semibold tracking-[-0.04em] text-white",children:e}),n&&s.jsx("div",{className:"mt-2 text-sm text-slate-400",children:n})]})]})}function Mr(){const{data:r,isLoading:e}=ot({queryKey:["stats"],queryFn:()=>st(24)}),n=r?.byModel??[],t=r?.byProvider??[],a=n.map(i=>({name:i.model.length>22?`${i.model.slice(0,20)}...`:i.model,cost:Number(i.totalCost.toFixed(6)),tokens:i.totalTokens,calls:i.spanCount})),o=t.map(i=>({name:i.provider,value:Number(i.totalCost.toFixed(6))}));return e?s.jsxs("div",{className:"mx-auto max-w-[1500px] space-y-8",children:[s.jsx("div",{className:"skeleton-panel h-44 rounded-[28px]"}),s.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[...Array(3)].map((i,l)=>s.jsxs("div",{className:"metric-card",children:[s.jsx("div",{className:"skeleton-panel h-12 w-12 rounded-2xl"}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"skeleton-panel h-3 w-20 rounded-full"}),s.jsx("div",{className:"skeleton-panel h-8 w-28 rounded-full"})]})]},l))})]}):s.jsxs(lt,{eyebrow:"Economic Layer",title:"Understand where every token is converting into spend.",description:"The economics view is now built like a cost cockpit. It surfaces burn concentration, provider mix, and the models that are consuming budget fastest.",aside:s.jsxs("div",{className:"insight-panel",children:[s.jsx(it,{}),s.jsxs("div",{className:"mt-4 space-y-3",children:[s.jsxs("div",{className:"rounded-2xl border border-white/8 bg-white/4 p-4",children:[s.jsx("div",{className:"hud-label",children:"Highest model spend"}),s.jsx("div",{className:"mt-2 text-base font-medium text-white",children:n[0]?.model??"Awaiting traffic"}),s.jsx("div",{className:"mt-1 text-sm text-slate-400",children:n[0]?`${I(n[0].totalCost)} across ${n[0].spanCount} calls`:"No model cost data yet"})]}),s.jsxs("div",{className:"rounded-2xl border border-white/8 bg-white/4 p-4",children:[s.jsx("div",{className:"hud-label",children:"Provider spread"}),s.jsxs("div",{className:"mt-2 text-base font-medium text-white",children:[t.length," active providers"]}),s.jsx("div",{className:"mt-1 text-sm text-slate-400",children:"Cost dominance becomes obvious here before it becomes expensive."})]})]})]}),children:[s.jsxs(D.div,{className:"grid grid-cols-1 gap-4 md:grid-cols-3",variants:rt.container,initial:"hidden",animate:"show",children:[s.jsx(he,{icon:s.jsx(dt,{className:"h-5 w-5"}),label:"Total Cost",value:I(r?.totalCost??0),sub:"Accumulated over the last 24 hours",gradient:"bg-[linear-gradient(135deg,rgba(250,204,21,0.18),rgba(249,115,22,0.18))] text-amber-200"}),s.jsx(he,{icon:s.jsx(ft,{className:"h-5 w-5"}),label:"Token Volume",value:ct(r?.totalTokens??0),sub:`${r?.totalSpans??0} model calls observed`,gradient:"bg-[linear-gradient(135deg,rgba(56,189,248,0.18),rgba(168,85,247,0.18))] text-sky-200"}),s.jsx(he,{icon:s.jsx(Kt,{className:"h-5 w-5"}),label:"Models in Rotation",value:String(n.length),sub:`${t.length} providers contributing to spend`,gradient:"bg-[linear-gradient(135deg,rgba(52,211,153,0.18),rgba(14,165,233,0.18))] text-emerald-200"})]}),s.jsxs("div",{className:"grid gap-5 xl:grid-cols-[minmax(0,1.1fr)_minmax(360px,0.9fr)]",children:[s.jsxs(D.div,{className:"dashboard-shell rounded-[26px] px-5 py-5",initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{delay:.15,duration:.35},children:[s.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("div",{className:"hud-label",children:"Model ranking"}),s.jsx("h2",{className:"mt-1 text-xl font-semibold tracking-[-0.04em] text-white",children:"Cost by model"})]}),s.jsxs("span",{className:"status-chip",children:[s.jsx(Dt,{className:"h-3.5 w-3.5 text-sky-300"}),s.jsx("span",{children:"Spend concentration"})]})]}),a.length>0?s.jsx("div",{className:"relative min-h-[320px]",children:s.jsx(_e,{width:"100%",height:Math.max(320,a.length*58),children:s.jsxs(Et,{data:a,layout:"vertical",children:[s.jsx(_t,{stroke:"rgba(148,163,184,0.08)",horizontal:!1}),s.jsx(St,{type:"number",tick:{fontSize:11,fill:"#94a3b8"},axisLine:!1,tickLine:!1,tickFormatter:i=>I(i)}),s.jsx(Tt,{type:"category",dataKey:"name",tick:{fontSize:11,fill:"#cbd5e1"},axisLine:!1,tickLine:!1,width:160}),s.jsx(Se,{contentStyle:Ve,formatter:i=>[I(i),"Cost"]}),s.jsx(Rt,{dataKey:"cost",fill:"#34d399",radius:[0,10,10,0]})]})})}):s.jsxs("div",{className:"empty-state h-[320px]",children:[s.jsx(Te,{className:"h-8 w-8 text-slate-500"}),s.jsx("div",{className:"text-base font-medium text-white",children:"No cost data yet"}),s.jsx("div",{className:"text-center text-sm text-slate-400",children:"Model spend will stack up here as soon as traffic hits the collector."})]})]}),s.jsxs(D.div,{className:"dashboard-shell rounded-[26px] px-5 py-5",initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{delay:.2,duration:.35},children:[s.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("div",{className:"hud-label",children:"Provider mix"}),s.jsx("h2",{className:"mt-1 text-xl font-semibold tracking-[-0.04em] text-white",children:"Who is taking the budget"})]}),s.jsx(Lt,{className:"h-4 w-4 text-sky-300"})]}),o.length>0?s.jsxs("div",{className:"flex flex-col gap-6 lg:flex-row lg:items-center",children:[s.jsx(_e,{width:"100%",height:260,className:"lg:max-w-[260px]",children:s.jsxs(Sr,{children:[s.jsx(T,{data:o,cx:"50%",cy:"50%",innerRadius:62,outerRadius:96,paddingAngle:3,dataKey:"value",strokeWidth:0,children:o.map((i,l)=>s.jsx(Ue,{fill:z[l%z.length]},`cell-${l}`))}),s.jsx(Se,{contentStyle:Ve,formatter:i=>[I(i),"Cost"]})]})}),s.jsx("div",{className:"flex-1 space-y-3",children:o.map((i,l)=>s.jsx("div",{className:"rounded-2xl border border-white/6 bg-white/4 p-3.5",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"h-3 w-3 shrink-0 rounded-sm",style:{backgroundColor:z[l%z.length],boxShadow:`0 0 10px ${z[l%z.length]}50`}}),s.jsx("span",{className:"flex-1 text-sm font-medium capitalize text-white",children:i.name}),s.jsx("span",{className:"font-mono text-xs text-slate-400",children:I(i.value)})]})},i.name))})]}):s.jsxs("div",{className:"empty-state h-[260px]",children:[s.jsx(It,{className:"h-8 w-8 text-slate-500"}),s.jsx("div",{className:"text-base font-medium text-white",children:"No providers yet"}),s.jsx("div",{className:"text-center text-sm text-slate-400",children:"Provider allocation appears here as soon as at least one model call is captured."})]})]})]}),n.length>0?s.jsxs(D.div,{className:"dashboard-shell overflow-hidden rounded-[26px] px-4 py-4 sm:px-5",initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{delay:.25,duration:.35},children:[s.jsxs("div",{className:"mb-3 flex items-center justify-between gap-3 px-1",children:[s.jsxs("div",{children:[s.jsx("div",{className:"hud-label",children:"Detailed ledger"}),s.jsx("h2",{className:"mt-1 text-xl font-semibold tracking-[-0.04em] text-white",children:"Breakdown by model"})]}),s.jsxs("span",{className:"status-chip",children:[s.jsx(Bt,{className:"h-3.5 w-3.5 text-sky-300"}),s.jsxs("span",{children:[n.length," models"]})]})]}),s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full border-separate border-spacing-y-2 text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"text-left text-[11px] uppercase tracking-[0.18em] text-slate-500",children:[s.jsx("th",{className:"px-4 py-2",children:"Model"}),s.jsx("th",{className:"px-4 py-2",children:"Provider"}),s.jsx("th",{className:"px-4 py-2 text-right",children:"Calls"}),s.jsx("th",{className:"px-4 py-2 text-right",children:"Tokens"}),s.jsx("th",{className:"px-4 py-2 text-right",children:"Cost"}),s.jsx("th",{className:"px-4 py-2 text-right",children:"Avg Duration"})]})}),s.jsx("tbody",{children:n.map((i,l)=>{const d={openai:"bg-emerald-400",anthropic:"bg-amber-300",google:"bg-sky-400"};return s.jsxs(D.tr,{className:"rounded-2xl border border-white/6 bg-white/4",initial:{opacity:0,x:-8},animate:{opacity:1,x:0},transition:{delay:.03*l,duration:.3},children:[s.jsx("td",{className:"rounded-l-2xl px-4 py-4 font-mono text-xs font-semibold text-slate-100",children:i.model}),s.jsx("td",{className:"px-4 py-4",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:`h-2.5 w-2.5 rounded-full ${d[i.provider]??"bg-purple-400"}`,style:{boxShadow:"0 0 10px currentColor"}}),s.jsx("span",{className:"text-xs font-medium capitalize text-slate-200",children:i.provider})]})}),s.jsx("td",{className:"px-4 py-4 text-right",children:s.jsx("span",{className:"inline-flex items-center justify-center rounded-md border border-white/8 bg-slate-950/70 px-2 py-0.5 font-mono text-xs text-slate-400",children:i.spanCount})}),s.jsx("td",{className:"px-4 py-4 text-right font-mono text-xs text-slate-300",children:i.totalTokens.toLocaleString()}),s.jsx("td",{className:"px-4 py-4 text-right font-mono text-xs font-semibold text-white",children:I(i.totalCost)}),s.jsx("td",{className:"rounded-r-2xl px-4 py-4 text-right font-mono text-xs text-slate-500",children:i.avgDuration?ut(i.avgDuration):"-"})]},`${i.provider}-${i.model}`)})})]})})]}):s.jsx(D.div,{className:"dashboard-shell rounded-[26px] p-16",initial:{opacity:0},animate:{opacity:1},children:s.jsxs("div",{className:"empty-state",children:[s.jsx(Te,{className:"h-8 w-8 text-slate-500"}),s.jsx("div",{className:"text-base font-medium text-white",children:"No cost data yet"}),s.jsx("div",{className:"max-w-sm text-center text-sm text-slate-400",children:"Start making traced model calls and the economic layer will fill in automatically."})]})})]})}export{Mr as default};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{c as le,R as v,r as V,u as _e,j as e,a as De,C as Le,m as Te,X as Ee,L as Re,T as ce,S as Ie,b as Me,f as $e,d as ze,e as Fe}from"./index-BBr9_AHg.js";import{u as ae,f as qe,P as Be,a as se,b as q,c as de,d as me}from"./format-BiBDo3KS.js";import{G as He}from"./gauge-BBNKtqFH.js";import{f as B,L as X,m as Q,i as W,C as re,A as Ve,a as H,b as he,c as We,d as ue,e as Ne,h as Ke,g as Ge,u as Xe,j as ie,G as Ue,k as xe,l as pe,D as Ye,n as Qe,X as Ae,Y as ke,o as Ze,R as Je,p as et,T as tt}from"./generateCategoricalChart-CylgFInn.js";import{S as at,A as fe,C as st,a as rt,b as be}from"./search-BwbP84dP.js";import{C as it,A as nt}from"./chevron-down-B0xosrpl.js";import{O as lt}from"./orbit-2k6lSwt7.js";const ot=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],ct=le("lightbulb",ot);const dt=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],ve=le("shield-alert",dt);const mt=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],Z=le("trending-up",mt);var ht=["layout","type","stroke","connectNulls","isRange","ref"],ut=["key"],Se;function K(t){"@babel/helpers - typeof";return K=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},K(t)}function Pe(t,a){if(t==null)return{};var i=xt(t,a),s,n;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)s=o[n],!(a.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(i[s]=t[s])}return i}function xt(t,a){if(t==null)return{};var i={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(a.indexOf(s)>=0)continue;i[s]=t[s]}return i}function F(){return F=Object.assign?Object.assign.bind():function(t){for(var a=1;a<arguments.length;a++){var i=arguments[a];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(t[s]=i[s])}return t},F.apply(this,arguments)}function ge(t,a){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);a&&(s=s.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),i.push.apply(i,s)}return i}function R(t){for(var a=1;a<arguments.length;a++){var i=arguments[a]!=null?arguments[a]:{};a%2?ge(Object(i),!0).forEach(function(s){D(t,s,i[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):ge(Object(i)).forEach(function(s){Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(i,s))})}return t}function pt(t,a){if(!(t instanceof a))throw new TypeError("Cannot call a class as a function")}function ye(t,a){for(var i=0;i<a.length;i++){var s=a[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,Ce(s.key),s)}}function ft(t,a,i){return a&&ye(t.prototype,a),i&&ye(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function bt(t,a,i){return a=ee(a),vt(t,Oe()?Reflect.construct(a,i||[],ee(t).constructor):a.apply(t,i))}function vt(t,a){if(a&&(K(a)==="object"||typeof a=="function"))return a;if(a!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return gt(t)}function gt(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Oe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Oe=function(){return!!t})()}function ee(t){return ee=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(i){return i.__proto__||Object.getPrototypeOf(i)},ee(t)}function yt(t,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(a&&a.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),a&&ne(t,a)}function ne(t,a){return ne=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,n){return s.__proto__=n,s},ne(t,a)}function D(t,a,i){return a=Ce(a),a in t?Object.defineProperty(t,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[a]=i,t}function Ce(t){var a=jt(t,"string");return K(a)=="symbol"?a:a+""}function jt(t,a){if(K(t)!="object"||!t)return t;var i=t[Symbol.toPrimitive];if(i!==void 0){var s=i.call(t,a);if(K(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var I=(function(t){function a(){var i;pt(this,a);for(var s=arguments.length,n=new Array(s),o=0;o<s;o++)n[o]=arguments[o];return i=bt(this,a,[].concat(n)),D(i,"state",{isAnimationFinished:!0}),D(i,"id",Xe("recharts-area-")),D(i,"handleAnimationEnd",function(){var l=i.props.onAnimationEnd;i.setState({isAnimationFinished:!0}),ie(l)&&l()}),D(i,"handleAnimationStart",function(){var l=i.props.onAnimationStart;i.setState({isAnimationFinished:!1}),ie(l)&&l()}),i}return yt(a,t),ft(a,[{key:"renderDots",value:function(s,n,o){var l=this.props.isAnimationActive,c=this.state.isAnimationFinished;if(l&&!c)return null;var m=this.props,d=m.dot,u=m.points,h=m.dataKey,p=B(this.props,!1),x=B(d,!0),w=u.map(function(y,P){var g=R(R(R({key:"dot-".concat(P),r:3},p),x),{},{index:P,cx:y.x,cy:y.y,dataKey:h,value:y.value,payload:y.payload,points:u});return a.renderDotItem(d,g)}),k={clipPath:s?"url(#clipPath-".concat(n?"":"dots-").concat(o,")"):null};return v.createElement(X,F({className:"recharts-area-dots"},k),w)}},{key:"renderHorizontalRect",value:function(s){var n=this.props,o=n.baseLine,l=n.points,c=n.strokeWidth,m=l[0].x,d=l[l.length-1].x,u=s*Math.abs(m-d),h=Q(l.map(function(p){return p.y||0}));return W(o)&&typeof o=="number"?h=Math.max(o,h):o&&Array.isArray(o)&&o.length&&(h=Math.max(Q(o.map(function(p){return p.y||0})),h)),W(h)?v.createElement("rect",{x:m<d?m:m-u,y:0,width:u,height:Math.floor(h+(c?parseInt("".concat(c),10):1))}):null}},{key:"renderVerticalRect",value:function(s){var n=this.props,o=n.baseLine,l=n.points,c=n.strokeWidth,m=l[0].y,d=l[l.length-1].y,u=s*Math.abs(m-d),h=Q(l.map(function(p){return p.x||0}));return W(o)&&typeof o=="number"?h=Math.max(o,h):o&&Array.isArray(o)&&o.length&&(h=Math.max(Q(o.map(function(p){return p.x||0})),h)),W(h)?v.createElement("rect",{x:0,y:m<d?m:m-u,width:h+(c?parseInt("".concat(c),10):1),height:Math.floor(u)}):null}},{key:"renderClipRect",value:function(s){var n=this.props.layout;return n==="vertical"?this.renderVerticalRect(s):this.renderHorizontalRect(s)}},{key:"renderAreaStatically",value:function(s,n,o,l){var c=this.props,m=c.layout,d=c.type,u=c.stroke,h=c.connectNulls,p=c.isRange;c.ref;var x=Pe(c,ht);return v.createElement(X,{clipPath:o?"url(#clipPath-".concat(l,")"):null},v.createElement(re,F({},B(x,!0),{points:s,connectNulls:h,type:d,baseLine:n,layout:m,stroke:"none",className:"recharts-area-area"})),u!=="none"&&v.createElement(re,F({},B(this.props,!1),{className:"recharts-area-curve",layout:m,type:d,connectNulls:h,fill:"none",points:s})),u!=="none"&&p&&v.createElement(re,F({},B(this.props,!1),{className:"recharts-area-curve",layout:m,type:d,connectNulls:h,fill:"none",points:n})))}},{key:"renderAreaWithAnimation",value:function(s,n){var o=this,l=this.props,c=l.points,m=l.baseLine,d=l.isAnimationActive,u=l.animationBegin,h=l.animationDuration,p=l.animationEasing,x=l.animationId,w=this.state,k=w.prevPoints,y=w.prevBaseLine;return v.createElement(Ve,{begin:u,duration:h,isActive:d,easing:p,from:{t:0},to:{t:1},key:"area-".concat(x),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(P){var g=P.t;if(k){var S=k.length/c.length,b=c.map(function(N,T){var C=Math.floor(T*S);if(k[C]){var A=k[C],_=H(A.x,N.x),M=H(A.y,N.y);return R(R({},N),{},{x:_(g),y:M(g)})}return N}),f;if(W(m)&&typeof m=="number"){var j=H(y,m);f=j(g)}else if(he(m)||We(m)){var O=H(y,0);f=O(g)}else f=m.map(function(N,T){var C=Math.floor(T*S);if(y[C]){var A=y[C],_=H(A.x,N.x),M=H(A.y,N.y);return R(R({},N),{},{x:_(g),y:M(g)})}return N});return o.renderAreaStatically(b,f,s,n)}return v.createElement(X,null,v.createElement("defs",null,v.createElement("clipPath",{id:"animationClipPath-".concat(n)},o.renderClipRect(g))),v.createElement(X,{clipPath:"url(#animationClipPath-".concat(n,")")},o.renderAreaStatically(c,m,s,n)))})}},{key:"renderArea",value:function(s,n){var o=this.props,l=o.points,c=o.baseLine,m=o.isAnimationActive,d=this.state,u=d.prevPoints,h=d.prevBaseLine,p=d.totalLength;return m&&l&&l.length&&(!u&&p>0||!ue(u,l)||!ue(h,c))?this.renderAreaWithAnimation(s,n):this.renderAreaStatically(l,c,s,n)}},{key:"render",value:function(){var s,n=this.props,o=n.hide,l=n.dot,c=n.points,m=n.className,d=n.top,u=n.left,h=n.xAxis,p=n.yAxis,x=n.width,w=n.height,k=n.isAnimationActive,y=n.id;if(o||!c||!c.length)return null;var P=this.state.isAnimationFinished,g=c.length===1,S=Ne("recharts-area",m),b=h&&h.allowDataOverflow,f=p&&p.allowDataOverflow,j=b||f,O=he(y)?this.id:y,N=(s=B(l,!1))!==null&&s!==void 0?s:{r:3,strokeWidth:2},T=N.r,C=T===void 0?3:T,A=N.strokeWidth,_=A===void 0?2:A,M=Ke(l)?l:{},G=M.clipDot,U=G===void 0?!0:G,$=C*2+_;return v.createElement(X,{className:S},b||f?v.createElement("defs",null,v.createElement("clipPath",{id:"clipPath-".concat(O)},v.createElement("rect",{x:b?u:u-x/2,y:f?d:d-w/2,width:b?x:x*2,height:f?w:w*2})),!U&&v.createElement("clipPath",{id:"clipPath-dots-".concat(O)},v.createElement("rect",{x:u-$/2,y:d-$/2,width:x+$,height:w+$}))):null,g?null:this.renderArea(j,O),(l||g)&&this.renderDots(j,U,O),(!k||P)&&Ge.renderCallByParent(this.props,c))}}],[{key:"getDerivedStateFromProps",value:function(s,n){return s.animationId!==n.prevAnimationId?{prevAnimationId:s.animationId,curPoints:s.points,curBaseLine:s.baseLine,prevPoints:n.curPoints,prevBaseLine:n.curBaseLine}:s.points!==n.curPoints||s.baseLine!==n.curBaseLine?{curPoints:s.points,curBaseLine:s.baseLine}:null}}])})(V.PureComponent);Se=I;D(I,"displayName","Area");D(I,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!Ue.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});D(I,"getBaseValue",function(t,a,i,s){var n=t.layout,o=t.baseValue,l=a.props.baseValue,c=l??o;if(W(c)&&typeof c=="number")return c;var m=n==="horizontal"?s:i,d=m.scale.domain();if(m.type==="number"){var u=Math.max(d[0],d[1]),h=Math.min(d[0],d[1]);return c==="dataMin"?h:c==="dataMax"||u<0?u:Math.max(Math.min(d[0],d[1]),0)}return c==="dataMin"?d[0]:c==="dataMax"?d[1]:d[0]});D(I,"getComposedData",function(t){var a=t.props,i=t.item,s=t.xAxis,n=t.yAxis,o=t.xAxisTicks,l=t.yAxisTicks,c=t.bandSize,m=t.dataKey,d=t.stackedData,u=t.dataStartIndex,h=t.displayedData,p=t.offset,x=a.layout,w=d&&d.length,k=Se.getBaseValue(a,i,s,n),y=x==="horizontal",P=!1,g=h.map(function(b,f){var j;w?j=d[u+f]:(j=xe(b,m),Array.isArray(j)?P=!0:j=[k,j]);var O=j[1]==null||w&&xe(b,m)==null;return y?{x:pe({axis:s,ticks:o,bandSize:c,entry:b,index:f}),y:O?null:n.scale(j[1]),value:j,payload:b}:{x:O?null:s.scale(j[1]),y:pe({axis:n,ticks:l,bandSize:c,entry:b,index:f}),value:j,payload:b}}),S;return w||P?S=g.map(function(b){var f=Array.isArray(b.value)?b.value[0]:null;return y?{x:b.x,y:f!=null&&b.y!=null?n.scale(f):null}:{x:f!=null?s.scale(f):null,y:b.y}}):S=y?n.scale(k):s.scale(k),R({points:g,baseLine:S,layout:x,isRange:P},p)});D(I,"renderDotItem",function(t,a){var i;if(v.isValidElement(t))i=v.cloneElement(t,a);else if(ie(t))i=t(a);else{var s=Ne("recharts-area-dot",typeof t!="boolean"?t.className:""),n=a.key,o=Pe(a,ut);i=v.createElement(Ye,F({},o,{key:n,className:s}))}return i});var wt=Qe({chartName:"AreaChart",GraphicalChild:I,axisComponents:[{axisType:"xAxis",AxisComp:Ae},{axisType:"yAxis",AxisComp:ke}],formatAxisMap:Ze});const je=[12,25,50,100],we=[{value:1,label:"1h"},{value:6,label:"6h"},{value:24,label:"24h"},{value:168,label:"7d"},{value:720,label:"30d"}],Nt={backgroundColor:"rgba(8, 15, 28, 0.96)",border:"1px solid rgba(148, 163, 184, 0.14)",borderRadius:"18px",fontSize:12,boxShadow:"0 20px 60px rgba(0,0,0,0.45)",backdropFilter:"blur(12px)"};function J({label:t,value:a,detail:i,accent:s,icon:n}){return e.jsxs("div",{className:"metric-card",children:[e.jsx("div",{className:`metric-orb ${s}`,children:n}),e.jsxs("div",{children:[e.jsx("div",{className:"hud-label",children:t}),e.jsx("div",{className:"mt-1 text-3xl font-semibold tracking-[-0.04em] text-white",children:a}),e.jsx("div",{className:"mt-1 text-sm text-slate-400",children:i})]})]})}function At({status:t}){const a=t==="error";return e.jsxs("span",{className:"relative flex h-3.5 w-3.5 items-center justify-center",children:[e.jsx("span",{className:`absolute inset-0 rounded-full ${a?"bg-rose-400/25":"bg-emerald-400/25"}`}),e.jsx("span",{className:`relative h-2 w-2 rounded-full ${a?"bg-rose-400":"bg-emerald-300"}`})]})}function Lt(){const[t,a]=_e(),i=t.get("q")??"",s=V.useDeferredValue(i),n=t.get("provider")??"",o=t.get("status"),l=o==="ok"||o==="error"?o:"",c=Number(t.get("periodHours")??"24"),m=Number(t.get("pageSize")??"12"),d=je.includes(m)?m:12,u=Math.max(1,Number(t.get("page")??"1")||1),h=(u-1)*d,p=V.useMemo(()=>({limit:d,offset:h,q:s.trim()||void 0,provider:n||void 0,status:l||void 0,periodHours:we.some(r=>r.value===c)?c:24}),[s,d,h,c,n,l]),{data:x}=ae({queryKey:["stats",p.periodHours],queryFn:()=>$e(p.periodHours??24)}),{data:w,isLoading:k}=ae({queryKey:["traces",p],queryFn:()=>ze(p)}),{data:y}=ae({queryKey:["insights"],queryFn:Fe,refetchInterval:6e4}),P=y?.insights??[],g=w?.traces??[],S=w?.total??0,b=Math.max(1,Math.ceil(S/d)),[f,j]=V.useState(null),[O,N]=V.useState("desc");function T(r){f===r?N(L=>L==="asc"?"desc":"asc"):(j(r),N("desc"))}const C=V.useMemo(()=>f?[...g].sort((r,L)=>{const Y=r[f]??0,z=L[f]??0;return O==="asc"?Y-z:z-Y}):g,[g,f,O]),A=x?.byProvider[0],_=C[0],M=[...new Set(x?.byProvider.map(r=>r.provider)??[])],G=x?.costOverTime.map(r=>({time:qe(r.timestamp),cost:r.cost}))??[],U=x&&x.totalSpans>0?x.totalCost/x.totalSpans:0,$=i.length>0||n.length>0||l.length>0||p.periodHours!==24;function E(r,L=!0){a(Y=>{const z=new URLSearchParams(Y);for(const[oe,te]of Object.entries(r))te===void 0||te===""?z.delete(oe):z.set(oe,String(te));return L&&z.delete("page"),z},{replace:!0})}return e.jsxs(Be,{eyebrow:"Flight Deck",title:"Read the behavior of every model call like a live system.",description:"The dashboard should act like an operator console. This version adds a real trace search surface, URL-synced filters, and paginated queue control.",aside:e.jsxs("div",{className:"insight-panel",children:[e.jsx(Me,{}),e.jsxs("div",{className:"mt-4 grid gap-3",children:[e.jsxs("div",{className:"rounded-2xl border border-white/8 bg-white/4 p-4",children:[e.jsx("div",{className:"hud-label",children:"Dominant provider"}),e.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[e.jsx("div",{className:"text-lg font-medium capitalize text-white",children:A?.provider??"Awaiting traffic"}),e.jsx(lt,{className:"h-4 w-4 text-sky-300"})]}),e.jsx("div",{className:"mt-1 text-sm text-slate-400",children:A?`${A.spanCount} calls, ${q(A.totalCost)} spend`:"No provider activity yet"})]}),e.jsxs("div",{className:"rounded-2xl border border-white/8 bg-white/4 p-4",children:[e.jsx("div",{className:"hud-label",children:"Latest trace"}),e.jsx("div",{className:"mt-2 text-base font-medium text-white",children:_?.name??"No recent traces"}),e.jsx("div",{className:"mt-1 text-sm text-slate-400",children:_?`${me(_.startTime)} / ${_.spanCount} spans`:"Start sending spans to populate the deck"})]})]})]}),children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-4",children:[e.jsx(J,{label:"Trace Volume",value:se(x?.totalTraces??0),detail:`${x?.totalSpans??0} spans in window`,icon:e.jsx(De,{className:"h-5 w-5"}),accent:"bg-[linear-gradient(135deg,rgba(52,211,153,0.18),rgba(14,165,233,0.18))] text-emerald-200"}),e.jsx(J,{label:"Token Throughput",value:se(x?.totalTokens??0),detail:"Token load across the active filter window",icon:e.jsx(Le,{className:"h-5 w-5"}),accent:"bg-[linear-gradient(135deg,rgba(56,189,248,0.18),rgba(168,85,247,0.18))] text-sky-200"}),e.jsx(J,{label:"Spend Velocity",value:q(x?.totalCost??0),detail:`${q(U)} average cost per call`,icon:e.jsx(Z,{className:"h-5 w-5"}),accent:"bg-[linear-gradient(135deg,rgba(251,191,36,0.18),rgba(249,115,22,0.18))] text-amber-200"}),e.jsx(J,{label:"Risk Surface",value:`${Math.round((x?.errorRate??0)*100)}%`,detail:`${x?.errorCount??0} failing calls`,icon:e.jsx(ve,{className:"h-5 w-5"}),accent:"bg-[linear-gradient(135deg,rgba(244,63,94,0.18),rgba(168,85,247,0.18))] text-rose-200"})]}),e.jsxs("div",{className:"grid gap-5 xl:grid-cols-[minmax(0,1.5fr)_minmax(320px,0.95fr)]",children:[e.jsxs("section",{className:"dashboard-shell rounded-[26px] px-5 py-5 sm:px-6",children:[e.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"hud-label",children:"Economic pulse"}),e.jsx("h2",{className:"mt-1 text-xl font-semibold tracking-[-0.04em] text-white",children:"Cost gradient"})]}),e.jsxs("div",{className:"status-chip",children:[e.jsx(He,{className:"h-3.5 w-3.5 text-sky-300"}),e.jsxs("span",{children:[p.periodHours,"h window"]})]})]}),G.length>0?e.jsx(Je,{width:"100%",height:320,children:e.jsxs(wt,{data:G,children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"dashboardCostFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#34d399",stopOpacity:.35}),e.jsx("stop",{offset:"100%",stopColor:"#38bdf8",stopOpacity:0})]})}),e.jsx(et,{stroke:"rgba(148,163,184,0.08)",vertical:!1}),e.jsx(Ae,{dataKey:"time",tick:{fontSize:11,fill:"#94a3b8"},axisLine:!1,tickLine:!1}),e.jsx(ke,{tick:{fontSize:11,fill:"#94a3b8"},axisLine:!1,tickLine:!1,width:54}),e.jsx(tt,{contentStyle:Nt,formatter:r=>[q(r),"Cost"]}),e.jsx(I,{type:"monotone",dataKey:"cost",stroke:"#34d399",fill:"url(#dashboardCostFill)",strokeWidth:2.6,dot:!1})]})}):e.jsxs("div",{className:"empty-state h-[320px]",children:[e.jsx(Z,{className:"h-8 w-8 text-slate-500"}),e.jsx("div",{className:"text-base font-medium text-white",children:"No cost movement yet"})]})]}),e.jsxs("section",{className:"dashboard-shell rounded-[26px] px-5 py-5 sm:px-6",children:[e.jsxs("div",{className:"mb-5",children:[e.jsx("div",{className:"hud-label",children:"Provider pressure"}),e.jsx("h2",{className:"mt-1 text-xl font-semibold tracking-[-0.04em] text-white",children:"Allocation by provider"})]}),e.jsx("div",{className:"space-y-4",children:(x?.byProvider??[]).map(r=>{const L=(x?.totalCost??0)>0?r.totalCost/(x?.totalCost??1)*100:0;return e.jsxs("div",{className:"rounded-2xl border border-white/6 bg-white/4 p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium capitalize text-white",children:r.provider}),e.jsxs("div",{className:"text-xs text-slate-400",children:[r.spanCount," calls / ",se(r.totalTokens)," tokens"]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("div",{className:"text-sm font-medium text-white",children:q(r.totalCost)}),e.jsx("div",{className:"text-xs text-slate-500",children:de(r.avgDuration)})]})]}),e.jsx("div",{className:"mt-3 h-2 overflow-hidden rounded-full bg-slate-900/80",children:e.jsx(Te.div,{className:"h-full rounded-full bg-[linear-gradient(90deg,#34d399,#38bdf8)]",initial:{width:0},animate:{width:`${Math.max(L,4)}%`}})})]},r.provider)})})]})]}),e.jsxs("div",{className:"grid gap-5 xl:grid-cols-[minmax(0,1.45fr)_minmax(320px,0.85fr)]",children:[e.jsxs("section",{className:"dashboard-shell rounded-[26px] px-4 py-4 sm:px-5 sm:py-5",children:[e.jsxs("div",{className:"mb-4 rounded-[24px] border border-white/8 bg-[linear-gradient(180deg,rgba(7,14,26,0.95),rgba(4,8,18,0.98))] p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"hud-label",children:"Search console"}),e.jsx("h2",{className:"mt-1 text-xl font-semibold tracking-[-0.04em] text-white",children:"Trace dispatch queue"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"status-chip",children:[S," matches"]}),e.jsxs("button",{type:"button",onClick:()=>E({q:void 0,provider:void 0,status:void 0,periodHours:void 0}),disabled:!$,className:"status-chip transition-colors hover:border-white/16 hover:bg-white/8 disabled:cursor-not-allowed disabled:opacity-50",children:[e.jsx(Ee,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"Clear"})]})]})]}),e.jsxs("div",{className:"mt-4 grid gap-3 xl:grid-cols-[minmax(0,1.7fr)_repeat(3,minmax(0,0.7fr))]",children:[e.jsxs("label",{className:"relative block",children:[e.jsx(at,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-500"}),e.jsx("input",{value:i,onChange:r=>E({q:r.target.value||void 0}),placeholder:"Search traces, models, providers, errors",className:"w-full rounded-2xl border border-white/8 bg-white/4 py-3 pl-10 pr-4 text-sm text-white placeholder:text-slate-500 focus:border-emerald-400/30 focus:bg-white/6 focus:outline-none"})]}),e.jsxs("select",{value:n,onChange:r=>E({provider:r.target.value||void 0}),className:"w-full rounded-2xl border border-white/8 bg-white/4 px-4 py-3 text-sm text-white focus:border-sky-400/30 focus:bg-white/6 focus:outline-none",children:[e.jsx("option",{value:"",children:"All providers"}),M.map(r=>e.jsx("option",{value:r,children:r},r))]}),e.jsxs("select",{value:l,onChange:r=>E({status:r.target.value||void 0}),className:"w-full rounded-2xl border border-white/8 bg-white/4 px-4 py-3 text-sm text-white focus:border-emerald-400/30 focus:bg-white/6 focus:outline-none",children:[e.jsx("option",{value:"",children:"All states"}),e.jsx("option",{value:"ok",children:"Healthy only"}),e.jsx("option",{value:"error",children:"Errors only"})]}),e.jsx("select",{value:String(p.periodHours??24),onChange:r=>E({periodHours:Number(r.target.value)===24?void 0:Number(r.target.value)}),className:"w-full rounded-2xl border border-white/8 bg-white/4 px-4 py-3 text-sm text-white focus:border-amber-400/30 focus:bg-white/6 focus:outline-none",children:we.map(r=>e.jsx("option",{value:r.value,children:r.label},r.value))})]})]}),k?e.jsx("div",{className:"empty-state h-[280px] text-slate-500",children:"Loading trace queue..."}):C.length===0&&!$?e.jsxs("div",{className:"rounded-2xl border border-white/8 bg-white/4 p-6 sm:p-8",children:[e.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[e.jsx(fe,{className:"h-10 w-10 text-amber-400/60"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-lg font-semibold text-white",children:"No traces recorded yet"}),e.jsx("p",{className:"mt-1 text-sm text-slate-400",children:"Get started in 3 steps — takes under a minute."})]})]}),e.jsxs("div",{className:"mx-auto mt-6 flex max-w-3xl flex-col gap-4",children:[e.jsxs("div",{className:"rounded-xl border border-white/6 bg-white/3 p-4",children:[e.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[e.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-amber-400/20 text-[10px] font-bold text-amber-400",children:"1"}),e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-amber-400",children:"Install the SDK"})]}),e.jsx("pre",{className:"overflow-x-auto rounded-lg bg-black/40 p-3 text-sm leading-relaxed text-green-400 select-all",children:"npm install @llmtap/sdk"})]}),e.jsxs("div",{className:"rounded-xl border border-white/6 bg-white/3 p-4",children:[e.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[e.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-amber-400/20 text-[10px] font-bold text-amber-400",children:"2"}),e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-amber-400",children:"Wrap your client & use normally"})]}),e.jsx("pre",{className:"overflow-x-auto rounded-lg bg-black/40 p-3 text-sm leading-relaxed text-green-400 select-all whitespace-pre",children:`import { wrap } from "@llmtap/sdk";
|
|
2
|
+
import OpenAI from "openai";
|
|
3
|
+
|
|
4
|
+
const client = wrap(new OpenAI());
|
|
5
|
+
|
|
6
|
+
const res = await client.chat.completions.create({
|
|
7
|
+
model: "gpt-4o-mini",
|
|
8
|
+
messages: [{ role: "user", content: "Hello!" }],
|
|
9
|
+
});`})]}),e.jsxs("div",{className:"rounded-xl border border-white/6 bg-white/3 p-4",children:[e.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[e.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-amber-400/20 text-[10px] font-bold text-amber-400",children:"3"}),e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-amber-400",children:"Start the collector"})]}),e.jsx("pre",{className:"overflow-x-auto rounded-lg bg-black/40 p-3 text-sm leading-relaxed text-green-400 select-all",children:"npx llmtap"}),e.jsx("p",{className:"mt-2 text-xs text-slate-500",children:"Run your app and traces will appear here automatically."})]})]}),e.jsx("div",{className:"mx-auto mt-4 max-w-3xl rounded-lg border border-white/4 bg-white/2 px-4 py-2.5",children:e.jsxs("p",{className:"text-center text-xs text-slate-500",children:["Works with ",e.jsx("span",{className:"text-slate-400",children:"OpenAI"}),", ",e.jsx("span",{className:"text-slate-400",children:"Anthropic"}),", ",e.jsx("span",{className:"text-slate-400",children:"Google Gemini"}),", ",e.jsx("span",{className:"text-slate-400",children:"DeepSeek"}),", ",e.jsx("span",{className:"text-slate-400",children:"Groq"}),", ",e.jsx("span",{className:"text-slate-400",children:"Together"}),", ",e.jsx("span",{className:"text-slate-400",children:"Fireworks"}),", ",e.jsx("span",{className:"text-slate-400",children:"OpenRouter"}),", and any OpenAI-compatible provider."]})})]}):C.length===0?e.jsxs("div",{className:"empty-state h-[280px]",children:[e.jsx(fe,{className:"h-8 w-8 text-slate-500"}),e.jsx("div",{className:"text-base font-medium text-white",children:"No traces match these filters"})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full border-separate border-spacing-y-2 text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-[11px] uppercase tracking-[0.18em] text-slate-500",children:[e.jsx("th",{className:"px-4 py-2",children:"State"}),e.jsx("th",{className:"px-4 py-2",children:"Trace"}),[["spanCount","Spans"],["totalTokens","Tokens"],["totalCost","Cost"],["startTime","When"]].map(([r,L])=>e.jsx("th",{className:"px-4 py-2 text-right",children:e.jsxs("button",{type:"button",onClick:()=>T(r),className:"inline-flex items-center gap-1 transition-colors hover:text-slate-300",children:[L,f===r?O==="asc"?e.jsx(st,{className:"h-3 w-3"}):e.jsx(it,{className:"h-3 w-3"}):e.jsx(rt,{className:"h-3 w-3 opacity-30"})]})},r))]})}),e.jsx("tbody",{children:C.map(r=>e.jsxs("tr",{className:"rounded-2xl border border-white/6 bg-white/4",children:[e.jsx("td",{className:"rounded-l-2xl px-4 py-4",children:e.jsx(At,{status:r.status})}),e.jsx("td",{className:"px-4 py-4",children:e.jsxs(Re,{to:`/trace/${r.traceId}`,className:"group inline-flex max-w-[380px] flex-col gap-1 text-sm font-medium text-white transition-colors hover:text-emerald-300",children:[e.jsxs("span",{className:"inline-flex items-center gap-2",children:[e.jsx("span",{className:"truncate",children:r.name}),e.jsx(be,{className:"h-3.5 w-3.5 opacity-0 transition-all group-hover:translate-x-0.5 group-hover:opacity-100"})]}),e.jsxs("span",{className:"font-mono text-[10px] uppercase tracking-[0.16em] text-slate-500",children:[r.traceId.slice(0,12),r.totalDuration?` / ${de(r.totalDuration)}`:""]})]})}),e.jsx("td",{className:"px-4 py-4 text-right font-mono text-xs text-slate-300",children:r.spanCount}),e.jsx("td",{className:"px-4 py-4 text-right font-mono text-xs text-slate-300",children:r.totalTokens.toLocaleString()}),e.jsx("td",{className:"px-4 py-4 text-right font-mono text-xs text-slate-300",children:q(r.totalCost)}),e.jsx("td",{className:"rounded-r-2xl px-4 py-4 text-right text-xs text-slate-500",children:me(r.startTime)})]},r.traceId))})]})}),e.jsxs("div",{className:"mt-4 flex items-center justify-between gap-3 px-1",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"text-xs text-slate-500",children:S>0?`Showing ${h+1}-${Math.min(h+C.length,S)} of ${S}`:"Awaiting traces"}),e.jsx("select",{value:String(d),onChange:r=>E({pageSize:Number(r.target.value)===12?void 0:Number(r.target.value)}),className:"rounded-xl border border-white/8 bg-white/4 px-2 py-1.5 text-xs text-slate-300 focus:border-emerald-400/30 focus:outline-none",children:je.map(r=>e.jsxs("option",{value:r,children:[r," / page"]},r))})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>E({page:u>2?u-1:void 0},!1),disabled:u<=1,className:"status-chip transition-colors hover:border-white/16 hover:bg-white/8 disabled:cursor-not-allowed disabled:opacity-50",children:[e.jsx(nt,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"Previous"})]}),e.jsxs("button",{type:"button",onClick:()=>E({page:u+1},!1),disabled:u>=b,className:"status-chip transition-colors hover:border-white/16 hover:bg-white/8 disabled:cursor-not-allowed disabled:opacity-50",children:[e.jsx("span",{children:"Next"}),e.jsx(be,{className:"h-3.5 w-3.5"})]})]})]})]})]}),e.jsxs("section",{className:"dashboard-shell rounded-[26px] px-5 py-5",children:[e.jsxs("div",{className:"mb-5",children:[e.jsx("div",{className:"hud-label",children:"Intelligence layer"}),e.jsx("h2",{className:"mt-1 text-xl font-semibold tracking-[-0.04em] text-white",children:"Insights"})]}),e.jsx("div",{className:"space-y-4",children:P.length>0?P.map(r=>e.jsxs("div",{className:`rounded-2xl border p-4 ${r.severity==="critical"?"border-rose-400/20 bg-rose-500/8":r.severity==="warning"?"border-amber-400/20 bg-amber-500/8":"border-white/6 bg-white/4"}`,children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-white",children:[r.type==="cost_anomaly"&&e.jsx(ce,{className:"h-4 w-4 text-amber-300"}),r.type==="error_pattern"&&e.jsx(ve,{className:"h-4 w-4 text-rose-300"}),r.type==="model_recommendation"&&e.jsx(ct,{className:"h-4 w-4 text-sky-300"}),r.type==="token_waste"&&e.jsx(Z,{className:"h-4 w-4 text-purple-300"}),r.title]}),r.metric&&e.jsx("span",{className:"shrink-0 rounded-full border border-white/10 bg-white/6 px-2 py-0.5 text-[10px] font-mono text-slate-400",children:r.metric})]}),e.jsx("p",{className:"text-sm leading-6 text-slate-400",children:r.description})]},r.id)):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"rounded-2xl border border-white/6 bg-white/4 p-4",children:[e.jsxs("div",{className:"mb-2 flex items-center gap-2 text-sm font-medium text-white",children:[e.jsx(Ie,{className:"h-4 w-4 text-sky-300"}),"Health read"]}),e.jsx("p",{className:"text-sm leading-6 text-slate-400",children:(x?.errorRate??0)>.05?"Error rate is elevated. Start with the most recent failed trace and inspect provider or tool payloads.":"Error pressure is currently low. Use this window to compare provider cost drift and latency patterns."})]}),e.jsxs("div",{className:"rounded-2xl border border-white/6 bg-white/4 p-4",children:[e.jsxs("div",{className:"mb-2 flex items-center gap-2 text-sm font-medium text-white",children:[e.jsx(Z,{className:"h-4 w-4 text-emerald-300"}),"Spend insight"]}),e.jsx("p",{className:"text-sm leading-6 text-slate-400",children:A?`${A.provider} currently leads cost share. If that is unexpected, inspect the filtered queue for bursty workflows.`:"Provider concentration will appear here once traces land."})]}),e.jsxs("div",{className:"rounded-2xl border border-white/6 bg-white/4 p-4",children:[e.jsxs("div",{className:"mb-2 flex items-center gap-2 text-sm font-medium text-white",children:[e.jsx(ce,{className:"h-4 w-4 text-amber-300"}),"Queue focus"]}),e.jsx("p",{className:"text-sm leading-6 text-slate-400",children:_?`Latest traffic is "${_.name}". Open it to inspect hierarchy, timing, and payload shape.`:"No active traces yet. Generate a request through an instrumented client to validate the pipeline."})]})]})})]})]})]})}export{Lt as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,m as a,C as g,b as N,f as v}from"./index-BBr9_AHg.js";import{u as k,P as w,a as d,b as i,c as l}from"./format-BiBDo3KS.js";import{L as C}from"./layers--K2XRXAx.js";import{C as L}from"./clock-CSGov78l.js";import{R as o,p as c,X as x,Y as m,T as h,N as p}from"./generateCategoricalChart-CylgFInn.js";import{B as y}from"./BarChart-N8X7TKRf.js";import{G as S}from"./gauge-BBNKtqFH.js";const j={backgroundColor:"rgba(8, 15, 28, 0.96)",border:"1px solid rgba(148, 163, 184, 0.14)",borderRadius:"18px",fontSize:12,boxShadow:"0 20px 60px rgba(0,0,0,0.45)",backdropFilter:"blur(12px)"},z={openai:"bg-emerald-400",anthropic:"bg-amber-300",google:"bg-sky-400",deepseek:"bg-cyan-400",groq:"bg-fuchsia-400",xai:"bg-rose-400"};function $(){const{data:u,isLoading:b}=k({queryKey:["stats",168],queryFn:()=>v(168)}),s=u?.byModel??[],r=s.map(t=>({name:t.model.length>20?`${t.model.slice(0,18)}...`:t.model,p50:t.avgDuration})),n=s.map(t=>({name:t.model.length>20?`${t.model.slice(0,18)}...`:t.model,tokens:t.totalTokens}));return b?e.jsxs("div",{className:"mx-auto max-w-[1500px] space-y-8",children:[e.jsx("div",{className:"skeleton-panel h-44 rounded-[28px]"}),e.jsx("div",{className:"skeleton-panel h-80 rounded-[24px]"})]}):e.jsx(w,{eyebrow:"Model Intelligence",title:"Every model. Every metric. One surface.",description:"Compare cost, token volume, latency, and call frequency across all models in your rotation. Identify the models consuming the most budget and the ones delivering the best performance.",aside:e.jsxs("div",{className:"insight-panel",children:[e.jsx(N,{}),e.jsxs("div",{className:"mt-4 space-y-3",children:[e.jsxs("div",{className:"rounded-2xl border border-white/8 bg-white/4 p-4",children:[e.jsx("div",{className:"hud-label",children:"Models active"}),e.jsx("div",{className:"mt-2 text-lg font-medium text-white",children:s.length}),e.jsxs("div",{className:"mt-1 text-sm text-slate-400",children:["Across ",new Set(s.map(t=>t.provider)).size," providers"]})]}),e.jsxs("div",{className:"rounded-2xl border border-white/8 bg-white/4 p-4",children:[e.jsx("div",{className:"hud-label",children:"Highest cost model"}),e.jsx("div",{className:"mt-2 text-base font-medium text-white",children:s[0]?.model??"No data"}),e.jsx("div",{className:"mt-1 text-sm text-slate-400",children:s[0]?i(s[0].totalCost):"-"})]})]})]}),children:s.length>0?e.jsxs(e.Fragment,{children:[e.jsxs(a.div,{className:"dashboard-shell overflow-hidden rounded-[26px] px-4 py-4 sm:px-5",initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.35},children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between gap-3 px-1",children:[e.jsxs("div",{children:[e.jsx("div",{className:"hud-label",children:"Model roster"}),e.jsx("h2",{className:"mt-1 text-xl font-semibold tracking-[-0.04em] text-white",children:"Performance by model"})]}),e.jsxs("span",{className:"status-chip",children:[e.jsx(C,{className:"h-3.5 w-3.5 text-sky-300"}),e.jsxs("span",{children:[s.length," models"]})]})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full border-separate border-spacing-y-2 text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-[11px] uppercase tracking-[0.18em] text-slate-500",children:[e.jsx("th",{className:"px-4 py-2",children:"Model"}),e.jsx("th",{className:"px-4 py-2",children:"Provider"}),e.jsx("th",{className:"px-4 py-2 text-right",children:"Calls"}),e.jsx("th",{className:"px-4 py-2 text-right",children:"Tokens"}),e.jsx("th",{className:"px-4 py-2 text-right",children:"Cost"}),e.jsx("th",{className:"px-4 py-2 text-right",children:"Avg Latency"}),e.jsx("th",{className:"px-4 py-2 text-right",children:"Cost/Call"})]})}),e.jsx("tbody",{children:s.map((t,f)=>e.jsxs(a.tr,{className:"rounded-2xl border border-white/6 bg-white/4",initial:{opacity:0,x:-8},animate:{opacity:1,x:0},transition:{delay:.03*f,duration:.3},children:[e.jsx("td",{className:"rounded-l-2xl px-4 py-4",children:e.jsx("div",{className:"font-mono text-xs font-semibold text-slate-100",children:t.model})}),e.jsx("td",{className:"px-4 py-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`h-2.5 w-2.5 rounded-full ${z[t.provider]??"bg-purple-400"}`,style:{boxShadow:"0 0 10px currentColor"}}),e.jsx("span",{className:"text-xs font-medium capitalize text-slate-200",children:t.provider})]})}),e.jsx("td",{className:"px-4 py-4 text-right",children:e.jsx("span",{className:"inline-flex items-center justify-center rounded-md border border-white/8 bg-slate-950/70 px-2 py-0.5 font-mono text-xs text-slate-400",children:t.spanCount})}),e.jsx("td",{className:"px-4 py-4 text-right font-mono text-xs text-slate-300",children:d(t.totalTokens)}),e.jsx("td",{className:"px-4 py-4 text-right font-mono text-xs font-semibold text-white",children:i(t.totalCost)}),e.jsx("td",{className:"px-4 py-4 text-right font-mono text-xs text-slate-400",children:t.avgDuration?l(t.avgDuration):"-"}),e.jsx("td",{className:"rounded-r-2xl px-4 py-4 text-right font-mono text-xs text-slate-500",children:t.spanCount>0?i(t.totalCost/t.spanCount):"-"})]},`${t.provider}-${t.model}`))})]})})]}),e.jsxs("div",{className:"grid gap-5 xl:grid-cols-2",children:[e.jsxs(a.div,{className:"dashboard-shell rounded-[26px] px-5 py-5",initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{delay:.1,duration:.35},children:[e.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"hud-label",children:"Latency profile"}),e.jsx("h2",{className:"mt-1 text-xl font-semibold tracking-[-0.04em] text-white",children:"Average latency by model"})]}),e.jsx(L,{className:"h-4 w-4 text-sky-300"})]}),e.jsx(o,{width:"100%",height:Math.max(280,r.length*52),children:e.jsxs(y,{data:r,layout:"vertical",children:[e.jsx(c,{stroke:"rgba(148,163,184,0.08)",horizontal:!1}),e.jsx(x,{type:"number",tick:{fontSize:11,fill:"#94a3b8"},axisLine:!1,tickLine:!1,tickFormatter:t=>l(t)}),e.jsx(m,{type:"category",dataKey:"name",tick:{fontSize:11,fill:"#cbd5e1"},axisLine:!1,tickLine:!1,width:150}),e.jsx(h,{contentStyle:j,formatter:t=>[l(t),"Avg latency"]}),e.jsx(p,{dataKey:"p50",fill:"#38bdf8",radius:[0,10,10,0]})]})})]}),e.jsxs(a.div,{className:"dashboard-shell rounded-[26px] px-5 py-5",initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{delay:.15,duration:.35},children:[e.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"hud-label",children:"Token distribution"}),e.jsx("h2",{className:"mt-1 text-xl font-semibold tracking-[-0.04em] text-white",children:"Token volume by model"})]}),e.jsx(g,{className:"h-4 w-4 text-emerald-300"})]}),e.jsx(o,{width:"100%",height:Math.max(280,n.length*52),children:e.jsxs(y,{data:n,layout:"vertical",children:[e.jsx(c,{stroke:"rgba(148,163,184,0.08)",horizontal:!1}),e.jsx(x,{type:"number",tick:{fontSize:11,fill:"#94a3b8"},axisLine:!1,tickLine:!1,tickFormatter:t=>d(t)}),e.jsx(m,{type:"category",dataKey:"name",tick:{fontSize:11,fill:"#cbd5e1"},axisLine:!1,tickLine:!1,width:150}),e.jsx(h,{contentStyle:j,formatter:t=>[t.toLocaleString(),"Tokens"]}),e.jsx(p,{dataKey:"tokens",fill:"#34d399",radius:[0,10,10,0]})]})})]})]})]}):e.jsx("div",{className:"dashboard-shell rounded-[26px] p-16",children:e.jsxs("div",{className:"empty-state",children:[e.jsx(S,{className:"h-8 w-8 text-slate-500"}),e.jsx("div",{className:"text-base font-medium text-white",children:"No models tracked yet"}),e.jsx("div",{className:"max-w-sm text-center text-sm text-slate-400",children:"Start sending traced API calls and model metrics will populate automatically."})]})})})}export{$ as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{c as h,j as e,m as l,M as n,T as p,b as j,o as u}from"./index-BBr9_AHg.js";import{u as N,P as y,a as g,b as o,d as x}from"./format-BiBDo3KS.js";const b=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],f=h("users",b);function k(){const{data:r,isLoading:d}=N({queryKey:["sessions"],queryFn:()=>u(168)}),a=r?.sessions??[],i=r?.total??0,c=a.reduce((s,t)=>s+t.totalCost,0),m=a.reduce((s,t)=>s+t.traceCount,0);return d?e.jsxs("div",{className:"mx-auto max-w-[1500px] space-y-8",children:[e.jsx("div",{className:"skeleton-panel h-44 rounded-[28px]"}),e.jsx("div",{className:"skeleton-panel h-80 rounded-[24px]"})]}):e.jsx(y,{eyebrow:"Session Fabric",title:"Multi-turn conversations, grouped and measured.",description:"Sessions collect related traces into logical units. Track total cost and token volume across entire user conversations, multi-step agent runs, or workflow pipelines.",aside:e.jsxs("div",{className:"insight-panel",children:[e.jsx(j,{}),e.jsxs("div",{className:"mt-4 space-y-3",children:[e.jsxs("div",{className:"rounded-2xl border border-white/8 bg-white/4 p-4",children:[e.jsx("div",{className:"hud-label",children:"Active sessions"}),e.jsx("div",{className:"mt-2 text-lg font-medium text-white",children:i}),e.jsxs("div",{className:"mt-1 text-sm text-slate-400",children:[m," traces across all sessions"]})]}),e.jsxs("div",{className:"rounded-2xl border border-white/8 bg-white/4 p-4",children:[e.jsx("div",{className:"hud-label",children:"Session spend"}),e.jsx("div",{className:"mt-2 text-base font-medium text-white",children:o(c)}),e.jsx("div",{className:"mt-1 text-sm text-slate-400",children:"Combined cost across visible sessions"})]})]})]}),children:a.length>0?e.jsxs(l.div,{className:"dashboard-shell overflow-hidden rounded-[26px] px-4 py-4 sm:px-5",initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.35},children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between gap-3 px-1",children:[e.jsxs("div",{children:[e.jsx("div",{className:"hud-label",children:"Session registry"}),e.jsx("h2",{className:"mt-1 text-xl font-semibold tracking-[-0.04em] text-white",children:"Tracked sessions"})]}),e.jsxs("span",{className:"status-chip",children:[e.jsx(f,{className:"h-3.5 w-3.5 text-sky-300"}),e.jsxs("span",{children:[i," sessions"]})]})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full border-separate border-spacing-y-2 text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-[11px] uppercase tracking-[0.18em] text-slate-500",children:[e.jsx("th",{className:"px-4 py-2",children:"Session ID"}),e.jsx("th",{className:"px-4 py-2 text-right",children:"Traces"}),e.jsx("th",{className:"px-4 py-2 text-right",children:"Spans"}),e.jsx("th",{className:"px-4 py-2 text-right",children:"Tokens"}),e.jsx("th",{className:"px-4 py-2 text-right",children:"Cost"}),e.jsx("th",{className:"px-4 py-2 text-right",children:"Errors"}),e.jsx("th",{className:"px-4 py-2 text-right",children:"First Seen"}),e.jsx("th",{className:"px-4 py-2 text-right",children:"Last Active"})]})}),e.jsx("tbody",{children:a.map((s,t)=>e.jsxs(l.tr,{className:"rounded-2xl border border-white/6 bg-white/4",initial:{opacity:0,x:-8},animate:{opacity:1,x:0},transition:{delay:.03*t,duration:.3},children:[e.jsx("td",{className:"rounded-l-2xl px-4 py-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(n,{className:"h-4 w-4 text-sky-300"}),e.jsx("span",{className:"font-mono text-xs font-semibold text-slate-100",children:s.sessionId.length>28?`${s.sessionId.slice(0,26)}...`:s.sessionId})]})}),e.jsx("td",{className:"px-4 py-4 text-right font-mono text-xs text-slate-300",children:s.traceCount}),e.jsx("td",{className:"px-4 py-4 text-right font-mono text-xs text-slate-300",children:s.spanCount}),e.jsx("td",{className:"px-4 py-4 text-right font-mono text-xs text-slate-300",children:g(s.totalTokens)}),e.jsx("td",{className:"px-4 py-4 text-right font-mono text-xs font-semibold text-white",children:o(s.totalCost)}),e.jsx("td",{className:"px-4 py-4 text-right",children:s.errorCount>0?e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-rose-400/20 bg-rose-400/10 px-2 py-0.5 text-[10px] font-bold text-rose-300",children:[e.jsx(p,{className:"h-3 w-3"}),s.errorCount]}):e.jsx("span",{className:"font-mono text-xs text-slate-500",children:"0"})}),e.jsx("td",{className:"px-4 py-4 text-right text-xs text-slate-500",children:x(s.firstSeen)}),e.jsx("td",{className:"rounded-r-2xl px-4 py-4 text-right text-xs text-slate-500",children:x(s.lastSeen)})]},s.sessionId))})]})})]}):e.jsx("div",{className:"dashboard-shell rounded-[26px] p-16",children:e.jsxs("div",{className:"empty-state",children:[e.jsx(n,{className:"h-8 w-8 text-slate-500"}),e.jsx("div",{className:"text-base font-medium text-white",children:"No sessions tracked yet"}),e.jsxs("div",{className:"max-w-md text-center text-sm text-slate-400",children:["Sessions appear when you pass a ",e.jsx("code",{className:"rounded bg-white/8 px-1.5 py-0.5 font-mono text-emerald-300",children:"sessionId"})," to the SDK. This groups related traces into logical conversations or workflows."]}),e.jsx("pre",{className:"mt-4 max-w-lg rounded-2xl border border-white/8 bg-white/4 p-4 text-left font-mono text-xs text-slate-300",children:`import { init } from "@llmtap/sdk";
|
|
2
|
+
|
|
3
|
+
init({ sessionId: "user-session-123" });`})]})})})}export{k as default};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{c as h,p as Y,r as a,j as e,m as x,q as Z,D as ee,X as B,s as te,t as se,v as ae,b as ne,w as le,x as re,y as oe}from"./index-BBr9_AHg.js";import{u as ie,P as de,d as U}from"./format-BiBDo3KS.js";import{C as f,a as ce,D as w}from"./download-PygxZ--5.js";const xe=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],pe=h("database",xe);const me=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],he=h("info",me);const ue=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],be=h("plus",ue);const ye=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],ge=h("send",ye);const je=[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]],fe=h("timer",je);const we=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],ve=h("trash-2",we);function q(o){if(o===0)return"0 B";const i=["B","KB","MB","GB"],d=Math.min(Math.floor(Math.log(o)/Math.log(1024)),i.length-1);return`${(o/Math.pow(1024,d)).toFixed(d===0?0:1)} ${i[d]}`}function u({label:o,value:i,mono:d}){return e.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-2xl border border-white/6 bg-white/4 px-4 py-3",children:[e.jsx("span",{className:"text-sm text-slate-400",children:o}),e.jsx("span",{className:`text-sm font-medium text-white ${d?"font-mono":""}`,children:i})]})}function Se(){const o=Y(),[i,d]=a.useState(!1),[z,M]=a.useState(!1),[b,P]=a.useState(!1),[J,$]=a.useState(null),[y,E]=a.useState([]),[K,v]=a.useState(!1),[l,p]=a.useState({provider:"",model:"",inputCostPer1M:"",outputCostPer1M:""}),[g,Q]=a.useState("30"),[V,D]=a.useState(!1),[N,O]=a.useState(null),[R,T]=a.useState(!1),[k,G]=a.useState(""),[C,H]=a.useState("llmtap"),[A,L]=a.useState(!1),[S,j]=a.useState(null),[I,_]=a.useState(!1),{data:n}=ie({queryKey:["db-info"],queryFn:oe});async function W(){if(confirm("Delete all trace data? This cannot be undone.")){d(!0);try{await le(),M(!0),o.invalidateQueries(),setTimeout(()=>M(!1),3e3)}catch(t){alert(`Reset failed: ${t instanceof Error?t.message:String(t)}`)}finally{d(!1)}}}async function F(t){P(!0);try{const s=await re(t),m=new Blob([s],{type:t==="json"?"application/json":"text/csv"}),r=URL.createObjectURL(m),c=document.createElement("a");c.href=r,c.download=`llmtap-traces-${new Date().toISOString().slice(0,10)}.${t}`,document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(r)}catch(s){alert(`Export failed: ${s instanceof Error?s.message:String(s)}`)}finally{P(!1)}}function X(t,s){navigator.clipboard.writeText(t).catch(()=>{}),$(s),setTimeout(()=>$(null),2e3)}return e.jsx(de,{eyebrow:"Control Panel",title:"Configure, export, and manage your local collector.",description:"Database status, data export, and maintenance controls. Everything runs locally on your machine — your data never leaves.",aside:e.jsxs("div",{className:"insight-panel",children:[e.jsx(ne,{}),e.jsx("div",{className:"mt-4 space-y-3",children:e.jsxs("div",{className:"rounded-2xl border border-white/8 bg-white/4 p-4",children:[e.jsx("div",{className:"hud-label",children:"Database"}),e.jsx("div",{className:"mt-2 text-lg font-medium text-white",children:n?q(n.sizeBytes):"..."}),e.jsxs("div",{className:"mt-1 text-sm text-slate-400",children:[n?.spanCount??0," spans stored"]})]})})]}),children:e.jsxs("div",{className:"grid gap-5 xl:grid-cols-2",children:[e.jsxs(x.div,{className:"dashboard-shell rounded-[26px] px-5 py-5",initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.35},children:[e.jsxs("div",{className:"mb-5 flex items-center gap-2",children:[e.jsx(pe,{className:"h-4 w-4 text-sky-300"}),e.jsx("h2",{className:"text-xl font-semibold tracking-[-0.04em] text-white",children:"Database status"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{label:"Size on disk",value:n?q(n.sizeBytes):"-"}),e.jsx(u,{label:"Total spans",value:String(n?.spanCount??0),mono:!0}),e.jsx(u,{label:"Total traces",value:String(n?.traceCount??0),mono:!0}),e.jsx(u,{label:"Journal mode",value:n?.walMode?.toUpperCase()??"-",mono:!0}),e.jsx(u,{label:"Data range",value:n?.oldestSpan&&n?.newestSpan?`${U(n.oldestSpan)} to ${U(n.newestSpan)}`:"No data"}),e.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-2xl border border-white/6 bg-white/4 px-4 py-3",children:[e.jsx("span",{className:"text-sm text-slate-400",children:"Storage path"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"max-w-[220px] truncate font-mono text-xs text-slate-300",children:n?.path??"-"}),n?.path&&e.jsx("button",{type:"button",onClick:()=>X(n.path,"path"),className:"rounded-lg border border-white/8 bg-white/4 p-1.5 text-slate-400 transition-colors hover:text-white",children:J==="path"?e.jsx(f,{className:"h-3 w-3 text-emerald-300"}):e.jsx(ce,{className:"h-3 w-3"})})]})]})]})]}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs(x.div,{className:"dashboard-shell rounded-[26px] px-5 py-5",initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{delay:.1,duration:.35},children:[e.jsxs("div",{className:"mb-5 flex items-center gap-2",children:[e.jsx(w,{className:"h-4 w-4 text-emerald-300"}),e.jsx("h2",{className:"text-xl font-semibold tracking-[-0.04em] text-white",children:"Export data"})]}),e.jsx("p",{className:"mb-4 text-sm text-slate-400",children:"Download all trace data for offline analysis, backup, or migration."}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("button",{type:"button",onClick:()=>F("json"),disabled:b,className:"status-chip transition-colors hover:border-white/16 hover:bg-white/8 disabled:cursor-not-allowed disabled:opacity-50",children:[e.jsx(w,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:b?"Exporting...":"Export JSON"})]}),e.jsxs("button",{type:"button",onClick:()=>F("csv"),disabled:b,className:"status-chip transition-colors hover:border-white/16 hover:bg-white/8 disabled:cursor-not-allowed disabled:opacity-50",children:[e.jsx(w,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:b?"Exporting...":"Export CSV"})]})]})]}),e.jsxs(x.div,{className:"dashboard-shell rounded-[26px] px-5 py-5",initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{delay:.15,duration:.35},children:[e.jsxs("div",{className:"mb-5 flex items-center gap-2",children:[e.jsx(ve,{className:"h-4 w-4 text-rose-300"}),e.jsx("h2",{className:"text-xl font-semibold tracking-[-0.04em] text-white",children:"Reset data"})]}),e.jsx("p",{className:"mb-4 text-sm text-slate-400",children:"Permanently delete all stored traces and spans. This action cannot be undone."}),e.jsx("button",{type:"button",onClick:W,disabled:i,className:"inline-flex items-center gap-2 rounded-full border border-rose-400/20 bg-rose-400/8 px-4 py-2.5 text-sm font-medium text-rose-200 transition-colors hover:border-rose-400/30 hover:bg-rose-400/14 disabled:cursor-not-allowed disabled:opacity-50",children:z?e.jsxs(e.Fragment,{children:[e.jsx(f,{className:"h-4 w-4 text-emerald-300"}),e.jsx("span",{children:"Data cleared"})]}):e.jsxs(e.Fragment,{children:[e.jsx(Z,{className:`h-4 w-4 ${i?"animate-spin":""}`}),e.jsx("span",{children:i?"Resetting...":"Reset all data"})]})})]}),e.jsxs(x.div,{className:"dashboard-shell rounded-[26px] px-5 py-5",initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{delay:.2,duration:.35},children:[e.jsxs("div",{className:"mb-5 flex items-center gap-2",children:[e.jsx(ee,{className:"h-4 w-4 text-amber-300"}),e.jsx("h2",{className:"text-xl font-semibold tracking-[-0.04em] text-white",children:"Pricing overrides"})]}),e.jsx("p",{className:"mb-4 text-sm text-slate-400",children:"Override built-in per-model pricing. Use this for custom or private models not in the default table."}),y.length>0&&e.jsx("div",{className:"mb-4 space-y-2",children:y.map((t,s)=>e.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-2xl border border-white/6 bg-white/4 px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"rounded-full border border-white/10 bg-white/6 px-2 py-0.5 text-[10px] font-bold uppercase tracking-[0.16em] text-slate-300",children:t.provider}),e.jsx("span",{className:"font-mono text-sm text-white",children:t.model})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"font-mono text-xs text-slate-400",children:["$",t.inputCostPer1M,"/M in"]}),e.jsxs("span",{className:"font-mono text-xs text-slate-400",children:["$",t.outputCostPer1M,"/M out"]}),e.jsx("button",{type:"button",onClick:()=>E(m=>m.filter((r,c)=>c!==s)),className:"rounded-lg border border-white/8 bg-white/4 p-1.5 text-slate-500 transition-colors hover:text-rose-300",children:e.jsx(B,{className:"h-3 w-3"})})]})]},`${t.provider}-${t.model}`))}),K?e.jsxs("div",{className:"rounded-2xl border border-white/8 bg-white/4 p-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[e.jsx("input",{value:l.provider,onChange:t=>p(s=>({...s,provider:t.target.value})),placeholder:"Provider",className:"rounded-xl border border-white/8 bg-white/4 px-3 py-2 text-sm text-white placeholder:text-slate-500 focus:border-emerald-400/30 focus:outline-none"}),e.jsx("input",{value:l.model,onChange:t=>p(s=>({...s,model:t.target.value})),placeholder:"Model name",className:"rounded-xl border border-white/8 bg-white/4 px-3 py-2 text-sm text-white placeholder:text-slate-500 focus:border-emerald-400/30 focus:outline-none"}),e.jsx("input",{value:l.inputCostPer1M,onChange:t=>p(s=>({...s,inputCostPer1M:t.target.value})),placeholder:"Input $/M",type:"number",step:"0.01",className:"rounded-xl border border-white/8 bg-white/4 px-3 py-2 text-sm text-white placeholder:text-slate-500 focus:border-emerald-400/30 focus:outline-none"}),e.jsx("input",{value:l.outputCostPer1M,onChange:t=>p(s=>({...s,outputCostPer1M:t.target.value})),placeholder:"Output $/M",type:"number",step:"0.01",className:"rounded-xl border border-white/8 bg-white/4 px-3 py-2 text-sm text-white placeholder:text-slate-500 focus:border-emerald-400/30 focus:outline-none"})]}),e.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>{l.provider&&l.model&&l.inputCostPer1M&&l.outputCostPer1M&&(E(t=>[...t,{...l}]),p({provider:"",model:"",inputCostPer1M:"",outputCostPer1M:""}),v(!1))},className:"status-chip transition-colors hover:border-white/16 hover:bg-white/8",children:[e.jsx(f,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"Add"})]}),e.jsxs("button",{type:"button",onClick:()=>{v(!1),p({provider:"",model:"",inputCostPer1M:"",outputCostPer1M:""})},className:"status-chip transition-colors hover:border-white/16 hover:bg-white/8",children:[e.jsx(B,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"Cancel"})]})]})]}):e.jsxs("button",{type:"button",onClick:()=>v(!0),className:"status-chip transition-colors hover:border-white/16 hover:bg-white/8",children:[e.jsx(be,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"Add pricing override"})]}),y.length>0&&e.jsxs("div",{className:"mt-4 rounded-2xl border border-white/8 bg-white/4 p-4",children:[e.jsx("div",{className:"mb-2 text-xs font-semibold uppercase tracking-[0.16em] text-slate-500",children:"SDK code to apply these overrides"}),e.jsx("pre",{className:"font-mono text-xs leading-relaxed text-slate-300",children:`import { setPricing } from "@llmtap/sdk";
|
|
2
|
+
${y.map(t=>`setPricing("${t.provider}", "${t.model}", ${t.inputCostPer1M}, ${t.outputCostPer1M});`).join(`
|
|
3
|
+
`)}`})]})]}),e.jsxs(x.div,{className:"dashboard-shell rounded-[26px] px-5 py-5",initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{delay:.25,duration:.35},children:[e.jsxs("div",{className:"mb-5 flex items-center gap-2",children:[e.jsx(fe,{className:"h-4 w-4 text-purple-300"}),e.jsx("h2",{className:"text-xl font-semibold tracking-[-0.04em] text-white",children:"Data retention"})]}),e.jsx("p",{className:"mb-4 text-sm text-slate-400",children:"Configure how long trace data is kept. Older traces will be automatically cleaned up."}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("select",{value:g,onChange:t=>Q(t.target.value),className:"rounded-2xl border border-white/8 bg-white/4 px-4 py-3 text-sm text-white focus:border-purple-400/30 focus:outline-none",children:[e.jsx("option",{value:"7",children:"7 days"}),e.jsx("option",{value:"14",children:"14 days"}),e.jsx("option",{value:"30",children:"30 days"}),e.jsx("option",{value:"90",children:"90 days"}),e.jsx("option",{value:"365",children:"1 year"}),e.jsx("option",{value:"0",children:"Keep forever"})]}),e.jsx("button",{type:"button",onClick:async()=>{const t=parseInt(g,10);if(!(t>0&&!confirm(`Delete all trace data older than ${g} days?`))){T(!0);try{const s=await te(t);O(s.deletedSpans),D(!0),o.invalidateQueries(),setTimeout(()=>{D(!1),O(null)},4e3)}catch(s){alert(`Retention failed: ${s instanceof Error?s.message:String(s)}`)}finally{T(!1)}}},disabled:R,className:"status-chip transition-colors hover:border-white/16 hover:bg-white/8 disabled:cursor-not-allowed disabled:opacity-50",children:V?e.jsxs(e.Fragment,{children:[e.jsx(f,{className:"h-3.5 w-3.5 text-emerald-300"}),e.jsx("span",{children:N!==null&&N>0?`Cleaned ${N} spans`:"Applied"})]}):e.jsx("span",{children:R?"Applying...":"Apply now"})})]}),e.jsxs("p",{className:"mt-3 text-xs text-slate-500",children:["This immediately deletes spans older than the selected period. For automatic enforcement on every startup, use ",e.jsxs("code",{className:"rounded bg-white/6 px-1.5 py-0.5 font-mono text-slate-400",children:["llmtap start --retention ",g]}),"."]})]}),e.jsxs(x.div,{className:"dashboard-shell rounded-[26px] px-5 py-5",initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{delay:.27,duration:.35},children:[e.jsxs("div",{className:"mb-5 flex items-center gap-2",children:[e.jsx(ge,{className:"h-4 w-4 text-cyan-300"}),e.jsx("h2",{className:"text-xl font-semibold tracking-[-0.04em] text-white",children:"OpenTelemetry Export"})]}),e.jsx("p",{className:"mb-4 text-sm text-slate-400",children:"Export spans in OTLP format for Datadog, Grafana Tempo, Jaeger, Honeycomb, or any OTLP-compatible backend."}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("button",{type:"button",disabled:I,onClick:async()=>{_(!0);try{const t=await se(1e3,C),s=new Blob([t],{type:"application/json"}),m=URL.createObjectURL(s),r=document.createElement("a");r.href=m,r.download="llmtap-export.otlp.json",document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(m)}catch(t){alert(`Export failed: ${t instanceof Error?t.message:String(t)}`)}finally{_(!1)}},className:"flex items-center gap-2 rounded-2xl border border-cyan-400/20 bg-cyan-400/10 px-4 py-2.5 text-sm font-medium text-cyan-300 transition-colors hover:bg-cyan-400/20",children:[e.jsx(w,{className:"h-3.5 w-3.5"}),I?"Exporting...":"Download OTLP JSON"]}),e.jsxs("div",{className:"rounded-2xl border border-white/8 bg-white/4 p-4",children:[e.jsx("div",{className:"mb-3 text-xs font-semibold uppercase tracking-[0.16em] text-slate-500",children:"Forward to OTLP endpoint"}),e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row",children:[e.jsx("input",{type:"text",value:k,onChange:t=>{G(t.target.value),j(null)},placeholder:"http://localhost:4318/v1/traces",className:"flex-1 rounded-xl border border-white/8 bg-white/4 px-3 py-2 text-sm text-white placeholder-slate-500 focus:border-cyan-400/30 focus:outline-none"}),e.jsx("input",{type:"text",value:C,onChange:t=>H(t.target.value),placeholder:"service name",className:"w-32 rounded-xl border border-white/8 bg-white/4 px-3 py-2 text-sm text-white placeholder-slate-500 focus:border-cyan-400/30 focus:outline-none"}),e.jsx("button",{type:"button",disabled:!k||A,onClick:async()=>{L(!0),j(null);try{const t=await ae(k,{service:C});j(`Forwarded ${t.spanCount} spans`)}catch(t){j(`Error: ${t instanceof Error?t.message:String(t)}`)}finally{L(!1)}},className:"rounded-xl border border-cyan-400/20 bg-cyan-400/10 px-4 py-2 text-sm font-medium text-cyan-300 transition-colors hover:bg-cyan-400/20 disabled:opacity-40",children:A?"Sending...":"Send"})]}),S&&e.jsx("p",{className:`mt-2 text-xs ${S.startsWith("Error")?"text-rose-400":"text-emerald-400"}`,children:S})]}),e.jsxs("p",{className:"text-xs text-slate-500",children:["CLI: ",e.jsx("code",{className:"rounded bg-white/6 px-1.5 py-0.5 font-mono text-slate-400",children:"llmtap export --format otlp --endpoint http://localhost:4318/v1/traces"})]})]})]}),e.jsxs(x.div,{className:"dashboard-shell rounded-[26px] px-5 py-5",initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{delay:.3,duration:.35},children:[e.jsxs("div",{className:"mb-5 flex items-center gap-2",children:[e.jsx(he,{className:"h-4 w-4 text-sky-300"}),e.jsx("h2",{className:"text-xl font-semibold tracking-[-0.04em] text-white",children:"Quick start"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"rounded-2xl border border-white/8 bg-white/4 p-4",children:[e.jsx("div",{className:"mb-2 text-xs font-semibold uppercase tracking-[0.16em] text-slate-500",children:"1. Install the SDK"}),e.jsx("pre",{className:"font-mono text-xs text-slate-300",children:"npm install @llmtap/sdk"})]}),e.jsxs("div",{className:"rounded-2xl border border-white/8 bg-white/4 p-4",children:[e.jsx("div",{className:"mb-2 text-xs font-semibold uppercase tracking-[0.16em] text-slate-500",children:"2. Wrap your client"}),e.jsx("pre",{className:"font-mono text-xs leading-relaxed text-slate-300",children:`import { wrap } from "@llmtap/sdk";
|
|
4
|
+
import OpenAI from "openai";
|
|
5
|
+
|
|
6
|
+
const openai = wrap(new OpenAI());`})]}),e.jsxs("div",{className:"rounded-2xl border border-white/8 bg-white/4 p-4",children:[e.jsx("div",{className:"mb-2 text-xs font-semibold uppercase tracking-[0.16em] text-slate-500",children:"3. That's it"}),e.jsx("p",{className:"text-xs leading-relaxed text-slate-400",children:"All API calls are now traced automatically. Open this dashboard to see real-time data."})]})]})]})]})]})})}export{Se as default};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import{c as f,h as ce,r as h,j as e,L as de,A as Y,m as M,i as pe,b as xe,k as me,g as he}from"./index-BBr9_AHg.js";import{u as ue,P as ge,b as w,c as g}from"./format-BiBDo3KS.js";import{A as be,C as L}from"./chevron-down-B0xosrpl.js";import{C as O,D as fe,a as je}from"./download-PygxZ--5.js";import{L as P}from"./layers--K2XRXAx.js";import{Z as ye}from"./zap-Ccrxhk2Q.js";import{C as Q}from"./coins-RIVI5-1a.js";import{C as E}from"./clock-CSGov78l.js";import{O as Ne}from"./orbit-2k6lSwt7.js";import{C as X,M as W}from"./message-square-DdcqfsnD.js";const ve=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],we=f("chevron-right",ve);const ke=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Ce=f("circle-check",ke);const $e=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],Te=f("code",$e);const Me=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Se=f("file-text",Me);const _e=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],Ie=f("hash",_e);const Re=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Le=f("image",Re);const Oe=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],G=f("play",Oe);const Pe=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Ee=f("terminal",Pe);const Ae=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],De=f("wrench",Ae);function He(t){const a=new Map,n=[];for(const l of t)a.set(l.spanId,{span:l,children:[]});for(const l of t){const i=a.get(l.spanId);i&&(l.parentSpanId&&a.has(l.parentSpanId)?a.get(l.parentSpanId)?.children.push(i):n.push(i))}const d=l=>{l.sort((i,s)=>i.span.startTime-s.span.startTime);for(const i of l)d(i.children)};return d(n),n}function A(t){return t.children.reduce((a,n)=>a+1+A(n),0)}function Fe(){const[t,a]=h.useState(null);function n(d,l){navigator.clipboard.writeText(d),a(l),setTimeout(()=>a(null),2e3)}return{copied:t,copy:n}}function v({text:t,label:a,copied:n,onCopy:d}){return e.jsx("button",{type:"button",onClick:l=>{l.stopPropagation(),d(t,a)},className:"rounded-lg border border-white/8 bg-white/4 p-1.5 text-slate-500 transition-colors hover:text-white",title:"Copy to clipboard",children:n===a?e.jsx(O,{className:"h-3 w-3 text-emerald-300"}):e.jsx(je,{className:"h-3 w-3"})})}function ze({provider:t}){const a={openai:"bg-emerald-400/12 text-emerald-200 border-emerald-400/20",anthropic:"bg-amber-300/12 text-amber-200 border-amber-300/20",google:"bg-sky-400/12 text-sky-200 border-sky-400/20",deepseek:"bg-cyan-400/12 text-cyan-200 border-cyan-400/20",groq:"bg-fuchsia-400/12 text-fuchsia-200 border-fuchsia-400/20"};return e.jsx("span",{className:`rounded-full border px-2.5 py-1 text-[10px] font-bold uppercase tracking-[0.18em] ${a[t]??"border-white/10 bg-white/8 text-slate-300"}`,children:t})}function b({icon:t,label:a,value:n}){return e.jsxs("div",{className:"rounded-2xl border border-white/8 bg-white/4 p-4",children:[e.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-[0.16em] text-slate-500",children:[e.jsx(t,{className:"h-3 w-3"}),a]}),e.jsx("div",{className:"font-mono text-sm font-semibold text-slate-100",children:n})]})}function Be({role:t,type:a}){const n={system:"bg-purple-400/10 text-purple-200 border-purple-400/16",user:"bg-sky-400/10 text-sky-200 border-sky-400/16",assistant:"bg-emerald-400/10 text-emerald-200 border-emerald-400/16",tool:"bg-amber-300/10 text-amber-200 border-amber-300/16",function:"bg-amber-300/10 text-amber-200 border-amber-300/16"},d=a==="input"?"bg-sky-400/10 text-sky-200 border-sky-400/16":"bg-emerald-400/10 text-emerald-200 border-emerald-400/16";return e.jsx("span",{className:`rounded-full border px-2.5 py-1 text-[10px] font-bold capitalize tracking-[0.16em] ${n[t]??d}`,children:t})}function k(t){return t?typeof t=="string"?t:t.filter(a=>a.type==="text"&&!!a.text).map(a=>a.text).join(`
|
|
2
|
+
`):""}function V(t){return!t||typeof t=="string"?!1:t.some(a=>a.type==="image_url"||a.type==="image")}function D(t){return t.map(a=>a.type==="image_url"&&a.image_url?.url?a.image_url.url:a.type==="image"&&a.source?.data?`data:${a.source.media_type||"image/png"};base64,${a.source.data}`:null).filter(a=>{if(!a)return!1;if(a.startsWith("data:image/"))return!0;try{const n=new URL(a);return n.protocol==="http:"||n.protocol==="https:"}catch{return!1}})}function qe(t){const a=k(t);let n=a?Math.ceil(a.length/4):0;if(t&&typeof t!="string"){const d=t.filter(l=>l.type==="image_url"||l.type==="image").length;n+=d*85}return n}function Z({message:t,type:a,copied:n,onCopy:d}){const l=t.content,i=k(l),s=l&&typeof l!="string"?D(l):[],c=a==="input"?"border-white/8":"border-emerald-400/10",o=`msg-${a}-${t.role}-${i.slice(0,20)}`;return e.jsxs("div",{className:`rounded-2xl border ${c} bg-white/4 p-4`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Be,{role:t.role,type:a}),t.name&&e.jsx("span",{className:"font-mono text-[10px] text-slate-500",children:t.name}),s.length>0&&e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-purple-400/16 bg-purple-400/10 px-2 py-0.5 text-[10px] font-bold uppercase tracking-[0.12em] text-purple-200",children:[e.jsx(Le,{className:"h-2.5 w-2.5"}),s.length," image",s.length>1?"s":""]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"font-mono text-[10px] text-slate-600",children:["~",qe(l)," tok"]}),i&&e.jsx(v,{text:i,label:o,copied:n,onCopy:d})]})]}),i&&e.jsx("pre",{className:"mt-2.5 whitespace-pre-wrap font-mono text-xs leading-relaxed text-slate-200",children:Ye(i)}),s.length>0&&e.jsx("div",{className:"mt-2.5 flex flex-wrap gap-2",children:s.map((p,j)=>e.jsxs("a",{href:p,target:"_blank",rel:"noopener noreferrer",className:"group relative overflow-hidden rounded-lg border border-white/10 bg-slate-950/60 transition-colors hover:border-white/20",children:[e.jsx("img",{src:p,alt:`Image ${j+1}`,className:"max-h-48 max-w-64 object-contain",loading:"lazy"}),e.jsx("span",{className:"absolute inset-0 flex items-center justify-center bg-black/50 opacity-0 transition-opacity group-hover:opacity-100",children:e.jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest text-white",children:"Open"})})]},j))})]})}function Ke({span:t,copied:a,onCopy:n}){const d=t.inputMessages?.length??0,l=t.outputMessages?.length??0,[i,s]=h.useState(d>3),[c,o]=h.useState(l>3);return e.jsx(M.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.2},className:"overflow-hidden",children:e.jsxs("div",{className:"mx-4 mb-4 space-y-5 rounded-[24px] border border-white/8 bg-[linear-gradient(180deg,rgba(8,15,28,0.96),rgba(4,8,18,0.98))] p-5 text-sm",children:[e.jsx("div",{className:"flex items-center justify-between gap-2",children:e.jsxs("div",{className:"grid flex-1 grid-cols-2 gap-3 md:grid-cols-4",children:[e.jsx(b,{icon:Ie,label:"Model",value:t.responseModel??t.requestModel??"-"}),e.jsx(b,{icon:P,label:"Tokens",value:`${t.inputTokens} in / ${t.outputTokens} out`}),e.jsx(b,{icon:Q,label:"Cost",value:w(t.totalCost)}),e.jsx(b,{icon:E,label:"Duration",value:t.duration?g(t.duration):"-"})]})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(v,{text:t.spanId,label:"spanId",copied:a,onCopy:n}),e.jsxs("span",{className:"font-mono text-[10px] text-slate-500",children:["span: ",t.spanId.slice(0,12),"..."]}),t.sessionId&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-slate-600",children:"|"}),e.jsxs("span",{className:"font-mono text-[10px] text-slate-500",children:["session: ",t.sessionId]})]}),t.temperature!==void 0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-slate-600",children:"|"}),e.jsxs("span",{className:"font-mono text-[10px] text-slate-500",children:["temp: ",t.temperature]})]}),t.topP!==void 0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-slate-600",children:"|"}),e.jsxs("span",{className:"font-mono text-[10px] text-slate-500",children:["top_p: ",t.topP]})]}),t.maxTokens!==void 0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-slate-600",children:"|"}),e.jsxs("span",{className:"font-mono text-[10px] text-slate-500",children:["max_tokens: ",t.maxTokens]})]})]}),t.status==="error"&&e.jsxs("div",{className:"rounded-2xl border border-rose-400/18 bg-rose-400/6 p-4",children:[e.jsxs("div",{className:"mb-1.5 flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-bold uppercase tracking-[0.16em] text-rose-300",children:[e.jsx(X,{className:"h-4 w-4"}),t.errorType??"error"]}),t.errorMessage&&e.jsx(v,{text:t.errorMessage,label:"error",copied:a,onCopy:n})]}),e.jsx("div",{className:"font-mono text-xs leading-relaxed text-rose-200/70",children:t.errorMessage})]}),t.inputMessages&&t.inputMessages.length>0&&e.jsxs("div",{children:[e.jsxs("button",{type:"button",onClick:()=>s(p=>!p),className:"mb-3 flex w-full items-center gap-1.5 text-[10px] font-bold uppercase tracking-[0.16em] text-slate-500 transition-colors hover:text-slate-300",children:[e.jsx(L,{className:`h-3.5 w-3.5 transition-transform ${i?"-rotate-90":""}`}),e.jsx(W,{className:"h-3.5 w-3.5"}),"Input messages (",t.inputMessages.length,")"]}),!i&&e.jsx("div",{className:"space-y-2",children:t.inputMessages.map((p,j)=>e.jsx(Z,{message:p,type:"input",copied:a,onCopy:n},`in-${p.role}-${j}`))})]}),t.outputMessages&&t.outputMessages.length>0&&e.jsxs("div",{children:[e.jsxs("button",{type:"button",onClick:()=>o(p=>!p),className:"mb-3 flex w-full items-center gap-1.5 text-[10px] font-bold uppercase tracking-[0.16em] text-slate-500 transition-colors hover:text-slate-300",children:[e.jsx(L,{className:`h-3.5 w-3.5 transition-transform ${c?"-rotate-90":""}`}),e.jsx(W,{className:"h-3.5 w-3.5"}),"Output messages (",t.outputMessages.length,")"]}),!c&&e.jsx("div",{className:"space-y-2",children:t.outputMessages.map((p,j)=>e.jsx(Z,{message:p,type:"output",copied:a,onCopy:n},`out-${p.role}-${j}`))})]}),t.toolCalls&&t.toolCalls.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"mb-3 flex items-center gap-1.5 text-[10px] font-bold uppercase tracking-[0.16em] text-slate-500",children:[e.jsx(De,{className:"h-3.5 w-3.5"}),"Tool calls (",t.toolCalls.length,")"]}),e.jsx("div",{className:"space-y-2",children:t.toolCalls.map(p=>e.jsxs("div",{className:"rounded-2xl border border-amber-300/10 bg-white/4 p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"rounded-full border border-amber-300/16 bg-amber-300/10 px-2.5 py-1 text-[10px] font-bold tracking-[0.16em] text-amber-200",children:p.name}),e.jsx(v,{text:p.arguments,label:`tool-${p.id}`,copied:a,onCopy:n})]}),e.jsx("pre",{className:"mt-2.5 overflow-x-auto font-mono text-xs leading-relaxed text-slate-200",children:ee(p.arguments)}),p.result&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"my-2 border-t border-white/6"}),e.jsx("div",{className:"mb-1 text-[10px] font-bold uppercase tracking-[0.16em] text-slate-600",children:"Result"}),e.jsx("pre",{className:"overflow-x-auto font-mono text-xs leading-relaxed text-slate-300",children:p.result})]})]},p.id))})]})]})})}function ee(t){try{return JSON.stringify(JSON.parse(t),null,2)}catch{return t}}function Je(t){const a=t.providerName?.toLowerCase()??"",n=t.requestModel??t.responseModel??"unknown",d=(t.inputMessages??[]).map(s=>({role:s.role,content:typeof s.content=="string"?s.content:s.content??""})),i=JSON.stringify({model:n,messages:d}).replace(/'/g,"'\\''");return a==="openai"?`curl https://api.openai.com/v1/chat/completions \\
|
|
3
|
+
-H "Authorization: Bearer $OPENAI_API_KEY" \\
|
|
4
|
+
-H "Content-Type: application/json" \\
|
|
5
|
+
-d '${i}'`:a==="anthropic"?`curl https://api.anthropic.com/v1/messages \\
|
|
6
|
+
-H "x-api-key: $ANTHROPIC_API_KEY" \\
|
|
7
|
+
-H "anthropic-version: 2023-06-01" \\
|
|
8
|
+
-H "Content-Type: application/json" \\
|
|
9
|
+
-d '${JSON.stringify({model:n,max_tokens:t.maxTokens??1024,messages:d.filter(o=>o.role!=="system"),...d.find(o=>o.role==="system")?{system:d.find(o=>o.role==="system").content}:{}}).replace(/'/g,"'\\''")}'`:a==="google"?`curl "https://generativelanguage.googleapis.com/v1beta/models/${n}:generateContent?key=$GOOGLE_API_KEY" \\
|
|
10
|
+
-H "Content-Type: application/json" \\
|
|
11
|
+
-d '${i}'`:`curl https://api.example.com/v1/chat/completions \\
|
|
12
|
+
-H "Authorization: Bearer $API_KEY" \\
|
|
13
|
+
-H "Content-Type: application/json" \\
|
|
14
|
+
-d '${i}'`}function Ue(t,a,n,d,l,i){const s=[];s.push("# Trace Report"),s.push(""),s.push(`**Trace ID:** \`${t}\``),s.push(`**Status:** ${i?"Error":"Stable"}`),s.push(`**Total Spans:** ${a.length}`),s.push(`**Total Tokens:** ${n.toLocaleString()}`),s.push(`**Total Cost:** ${w(d)}`),s.push(`**Duration:** ${g(l)}`),s.push(""),s.push("---"),s.push("");for(const c of a){if(s.push(`## Span: ${c.name}`),s.push(""),s.push("| Field | Value |"),s.push("|-------|-------|"),s.push(`| Span ID | \`${c.spanId}\` |`),s.push(`| Provider | ${c.providerName} |`),s.push(`| Model | ${c.responseModel??c.requestModel??"-"} |`),s.push(`| Operation | ${c.operationName} |`),s.push(`| Tokens | ${c.inputTokens} in / ${c.outputTokens} out |`),s.push(`| Cost | ${w(c.totalCost)} |`),s.push(`| Duration | ${c.duration?g(c.duration):"-"} |`),s.push(`| Status | ${c.status} |`),s.push(""),c.inputMessages&&c.inputMessages.length>0){s.push("### Input Messages"),s.push("");for(const o of c.inputMessages)s.push(`**[${o.role}]${o.name?` (${o.name})`:""}**`),s.push(""),s.push(k(o.content)||"_empty_"),V(o.content)&&s.push(`
|
|
15
|
+
_[${D(o.content).length} image(s) attached]_`),s.push("")}if(c.outputMessages&&c.outputMessages.length>0){s.push("### Output Messages"),s.push("");for(const o of c.outputMessages)s.push(`**[${o.role}]${o.name?` (${o.name})`:""}**`),s.push(""),s.push(k(o.content)||"_empty_"),V(o.content)&&s.push(`
|
|
16
|
+
_[${D(o.content).length} image(s) attached]_`),s.push("")}if(c.toolCalls&&c.toolCalls.length>0){s.push("### Tool Calls"),s.push("");for(const o of c.toolCalls)s.push(`**${o.name}** (\`${o.id}\`)`),s.push(""),s.push("```json"),s.push(ee(o.arguments)),s.push("```"),o.result&&(s.push(""),s.push("Result:"),s.push("```"),s.push(o.result),s.push("```")),s.push("")}s.push("---"),s.push("")}return s.join(`
|
|
17
|
+
`)}function Ye(t){const a=/```(\w*)\n?([\s\S]*?)```/g,n=[];let d=0,l,i=0;for(;(l=a.exec(t))!==null;){l.index>d&&n.push(e.jsx("span",{children:t.slice(d,l.index)},i++));const s=l[1]||"",c=l[2];n.push(e.jsxs("span",{className:"my-1.5 block rounded-lg border border-white/8 bg-slate-950/80 px-3 py-2",children:[s&&e.jsxs("span",{className:"mb-1 flex items-center gap-1 text-[10px] font-bold uppercase tracking-[0.16em] text-slate-500",children:[e.jsx(Te,{className:"h-3 w-3"}),s]}),e.jsx("span",{className:"block font-mono text-[11px] leading-relaxed text-emerald-200/80",children:c})]},i++)),d=l.index+l[0].length}return d<t.length&&n.push(e.jsx("span",{children:t.slice(d)},i++)),n.length===0?t:n}function nt(){const{traceId:t}=ce(),[a,n]=h.useState(null),[d,l]=h.useState({}),{copied:i,copy:s}=Fe(),[c,o]=h.useState(!1),[p,j]=h.useState(""),[H,F]=h.useState(!1),[y,C]=h.useState(null),[z,$]=h.useState(null),[S,te]=h.useState(null),{data:se,isLoading:ae}=ue({queryKey:["trace",t],queryFn:()=>he(t),enabled:!!t}),x=se?.spans??[],_=h.useMemo(()=>He(x),[x]),I=x.length>0?Math.min(...x.map(r=>r.startTime)):0,N=(x.length>0?Math.max(...x.map(r=>r.endTime??r.startTime)):0)-I||1,B=x.reduce((r,u)=>r+u.totalTokens,0),q=x.reduce((r,u)=>r+u.totalCost,0),R=x.some(r=>r.status==="error");function re(){const r=new Blob([JSON.stringify(x,null,2)],{type:"application/json"}),u=URL.createObjectURL(r),m=document.createElement("a");m.href=u,m.download=`trace-${t?.slice(0,12)}.json`,document.body.appendChild(m),m.click(),document.body.removeChild(m),URL.revokeObjectURL(u)}async function ne(){if(!(!S||!p.trim())){F(!0),$(null),C(null);try{const r=await me(S,p.trim());C(r)}catch(r){$(r instanceof Error?r.message:String(r))}finally{F(!1)}}}function le(r){te(r),o(!0),C(null),$(null)}const K=(r,u=0)=>{const m=r.span.spanId===a,J=r.children.length>0,U=d[r.span.spanId]??!1,oe=(r.span.startTime-I)/N*100,ie=Math.max(((r.span.endTime??r.span.startTime)-r.span.startTime)/N*100,1);return e.jsxs(h.Fragment,{children:[e.jsx("div",{className:"border-t border-white/6 first:border-t-0",children:e.jsxs("div",{className:"flex items-start gap-2 px-4 py-3 sm:px-5",children:[e.jsx("div",{className:"flex items-center",style:{paddingLeft:`${u*22}px`},children:J?e.jsx("button",{type:"button",onClick:()=>l(T=>({...T,[r.span.spanId]:!T[r.span.spanId]})),className:"flex h-8 w-8 items-center justify-center rounded-full border border-white/8 bg-white/4 text-slate-400 transition-colors hover:text-white",children:e.jsx(we,{className:`h-4 w-4 transition-transform ${U?"":"rotate-90"}`})}):e.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-full border border-white/8 bg-white/4 text-slate-500",children:e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-slate-500"})})}),e.jsxs("button",{type:"button",onClick:()=>n(m?null:r.span.spanId),className:`grid min-w-0 flex-1 gap-3 rounded-[22px] px-3 py-3 text-left transition-colors sm:grid-cols-[minmax(0,320px)_minmax(0,1fr)_88px] sm:items-center ${m?"bg-white/8":"hover:bg-white/4"}`,children:[e.jsx("div",{className:"min-w-0",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"relative flex h-3.5 w-3.5 items-center justify-center",children:[e.jsx("span",{className:`absolute inset-0 rounded-full ${r.span.status==="error"?"bg-rose-400/25":"bg-emerald-400/25"}`}),e.jsx("span",{className:`relative h-2 w-2 rounded-full ${r.span.status==="error"?"bg-rose-400":"bg-emerald-300"}`})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-medium text-white",children:r.span.name}),e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2.5",children:[e.jsx(ze,{provider:r.span.providerName}),e.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.16em] text-slate-500",children:r.span.operationName}),J?e.jsxs("span",{className:"font-mono text-[10px] uppercase tracking-[0.16em] text-slate-500",children:[A(r)," child",A(r)===1?"":"ren"]}):null]})]})]})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between text-[10px] uppercase tracking-[0.16em] text-slate-500",children:[e.jsxs("span",{children:[Math.round(r.span.startTime-I),"ms"]}),e.jsx("span",{children:r.span.duration?g(r.span.duration):"instant"})]}),e.jsx("div",{className:"relative h-8 overflow-hidden rounded-full bg-slate-950/90",children:e.jsx(M.div,{className:`absolute bottom-1 top-1 rounded-full ${r.span.status==="error"?"bg-[linear-gradient(90deg,#fb7185,#f97316)]":"bg-[linear-gradient(90deg,#34d399,#38bdf8)]"}`,style:{left:`${oe}%`,minWidth:"6px"},initial:{width:0},animate:{width:`${ie}%`}})})]}),e.jsxs("div",{className:"text-right font-mono text-[11px] text-slate-400",children:[e.jsx("div",{className:"text-slate-200",children:w(r.span.totalCost)}),e.jsxs("div",{children:[r.span.totalTokens.toLocaleString()," tok"]})]})]})]})}),e.jsx(Y,{children:m?e.jsx(Ke,{span:r.span,copied:i,onCopy:s}):null}),!U&&r.children.map(T=>K(T,u+1))]},r.span.spanId)};return ae?e.jsxs("div",{className:"mx-auto max-w-[1500px] space-y-6",children:[e.jsx("div",{className:"skeleton-panel h-44 rounded-[28px]"}),e.jsx("div",{className:"skeleton-panel h-28 rounded-[24px]"}),e.jsx("div",{className:"skeleton-panel h-72 rounded-[24px]"})]}):e.jsxs(ge,{eyebrow:"Trace Console",title:t?`Trace ${t.slice(0,12)}...`:"Trace detail",description:"Inspect the nested execution tree, timing offsets, token pressure, and payloads for a single trace without losing the operator surface.",aside:e.jsxs("div",{className:"insight-panel",children:[e.jsx(xe,{}),e.jsxs("div",{className:"mt-4 space-y-3",children:[e.jsxs("div",{className:"rounded-2xl border border-white/8 bg-white/4 p-4",children:[e.jsx("div",{className:"hud-label",children:"Current status"}),e.jsx("div",{className:"mt-2 flex items-center gap-2 text-base font-medium text-white",children:R?e.jsxs(e.Fragment,{children:[e.jsx(X,{className:"h-4 w-4 text-rose-300"}),"Error state"]}):e.jsxs(e.Fragment,{children:[e.jsx(Ce,{className:"h-4 w-4 text-emerald-300"}),"Stable"]})})]}),e.jsxs("div",{className:"rounded-2xl border border-white/8 bg-white/4 p-4",children:[e.jsx("div",{className:"hud-label",children:"Hierarchy"}),e.jsxs("div",{className:"mt-2 text-base font-medium text-white",children:[_.length," root spans"]}),e.jsxs("div",{className:"mt-1 text-sm text-slate-400",children:[g(N)," elapsed from first to last event"]})]})]})]}),children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(de,{to:"/",className:"status-chip transition-colors hover:text-white",children:[e.jsx(be,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"Back to overview"})]}),e.jsx("span",{className:"truncate font-mono text-xs text-slate-500",children:t}),e.jsx(v,{text:t??"",label:"traceId",copied:i,onCopy:s})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[x.length>0&&e.jsxs("button",{type:"button",onClick:()=>{const r=x[0];s(Je(r),"curl")},className:"status-chip transition-colors hover:border-white/16 hover:bg-white/8",children:[i==="curl"?e.jsx(O,{className:"h-3.5 w-3.5 text-emerald-300"}):e.jsx(Ee,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:i==="curl"?"Copied!":"Copy as cURL"})]}),x.length>0&&e.jsxs("button",{type:"button",onClick:()=>{s(Ue(t??"",x,B,q,N,R),"markdown")},className:"status-chip transition-colors hover:border-white/16 hover:bg-white/8",children:[i==="markdown"?e.jsx(O,{className:"h-3.5 w-3.5 text-emerald-300"}):e.jsx(Se,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:i==="markdown"?"Copied!":"Copy as Markdown"})]}),e.jsxs("button",{type:"button",onClick:re,className:"status-chip transition-colors hover:border-white/16 hover:bg-white/8",children:[e.jsx(fe,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"Export JSON"})]}),x.length>0&&e.jsxs("button",{type:"button",onClick:()=>le(x[0].spanId),className:"status-chip border-emerald-400/20 bg-emerald-400/8 transition-colors hover:border-emerald-400/30 hover:bg-emerald-400/14",children:[e.jsx(G,{className:"h-3.5 w-3.5 text-emerald-300"}),e.jsx("span",{children:"Replay"})]})]})]}),e.jsx("div",{className:"dashboard-shell rounded-[26px] px-5 py-5",children:e.jsxs("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-5",children:[e.jsx(b,{icon:P,label:"Spans",value:String(x.length)}),e.jsx(b,{icon:ye,label:"Tokens",value:B.toLocaleString()}),e.jsx(b,{icon:Q,label:"Cost",value:w(q)}),e.jsx(b,{icon:E,label:"Duration",value:x.length>0?g(N):"-"}),e.jsx(b,{icon:Ne,label:"Status",value:R?"Error":"Stable"})]})}),e.jsxs("div",{className:"dashboard-shell overflow-hidden rounded-[26px]",children:[e.jsxs("div",{className:"flex items-center gap-2.5 border-b border-white/6 px-5 py-4",children:[e.jsx(E,{className:"h-4 w-4 text-sky-300"}),e.jsx("h2",{className:"text-xl font-semibold tracking-[-0.04em] text-white",children:"Trace hierarchy"}),e.jsxs("span",{className:"ml-auto text-xs font-mono tracking-[0.18em] text-slate-500",children:[g(N)," total"]})]}),_.length>0?e.jsx("div",{className:"py-2",children:_.map(r=>K(r))}):e.jsxs("div",{className:"empty-state h-[280px]",children:[e.jsx(P,{className:"h-8 w-8 text-slate-500"}),e.jsx("div",{className:"text-base font-medium text-white",children:"No spans found for this trace"})]})]}),e.jsx(Y,{children:c&&e.jsxs(e.Fragment,{children:[e.jsx(M.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm",onClick:()=>o(!1)}),e.jsxs(M.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{type:"spring",bounce:.15,duration:.4},className:"fixed left-1/2 top-1/2 z-50 w-full max-w-2xl -translate-x-1/2 -translate-y-1/2 rounded-[24px] border border-white/10 bg-[linear-gradient(180deg,rgba(12,18,32,0.98),rgba(4,8,18,0.99))] p-6 shadow-[0_40px_100px_rgba(0,0,0,0.5)]",children:[e.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-2xl border border-emerald-400/20 bg-emerald-400/8",children:e.jsx(G,{className:"h-4.5 w-4.5 text-emerald-300"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-white",children:"Trace Replay"}),e.jsx("p",{className:"text-xs text-slate-500",children:"Re-send the same prompts and compare responses"})]})]}),e.jsx("button",{onClick:()=>o(!1),className:"flex h-8 w-8 items-center justify-center rounded-xl border border-white/8 bg-white/5 text-slate-400 transition-colors hover:text-white",children:e.jsx(L,{className:"h-4 w-4"})})]}),!y&&!H&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"rounded-xl border border-amber-400/20 bg-amber-500/8 p-3 text-xs text-amber-200/80",children:"Your API key is sent directly to the provider and is never stored by LLMTap."}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs font-medium text-slate-400",children:"Provider API Key"}),e.jsx("input",{type:"password",value:p,onChange:r=>j(r.target.value),placeholder:"sk-... or anthropic key",className:"w-full rounded-xl border border-white/10 bg-white/5 px-4 py-3 text-sm text-white placeholder:text-slate-600 focus:border-emerald-400/30 focus:outline-none"})]}),z&&e.jsx("div",{className:"rounded-xl border border-rose-400/20 bg-rose-500/8 p-3 text-sm text-rose-200",children:z}),e.jsx("button",{type:"button",disabled:!p.trim(),onClick:ne,className:"w-full rounded-xl bg-emerald-500 px-4 py-3 text-sm font-semibold text-white transition-colors hover:bg-emerald-400 disabled:cursor-not-allowed disabled:opacity-40",children:"Send Replay Request"})]}),H&&e.jsxs("div",{className:"flex flex-col items-center gap-3 py-12",children:[e.jsx(pe,{className:"h-8 w-8 animate-spin text-emerald-300"}),e.jsxs("p",{className:"text-sm text-slate-400",children:["Replaying against ",x[0]?.providerName," API..."]})]}),y&&(()=>{const r=x.find(m=>m.spanId===S)??x[0],u=r?.outputMessages?.map(m=>k(m.content)).join(`
|
|
18
|
+
`)??"";return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-3 text-center",children:[e.jsxs("div",{className:"rounded-xl border border-white/8 bg-white/4 p-3",children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-slate-500",children:"Tokens"}),e.jsxs("div",{className:"mt-1 font-mono text-sm text-white",children:[r.totalTokens," ",e.jsx("span",{className:"text-slate-500",children:"vs"})," ",y.totalTokens]})]}),e.jsxs("div",{className:"rounded-xl border border-white/8 bg-white/4 p-3",children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-slate-500",children:"Duration"}),e.jsxs("div",{className:"mt-1 font-mono text-sm text-white",children:[g(r.duration??0)," ",e.jsx("span",{className:"text-slate-500",children:"vs"})," ",g(y.duration)]})]}),e.jsxs("div",{className:"rounded-xl border border-white/8 bg-white/4 p-3",children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-slate-500",children:"Model"}),e.jsx("div",{className:"mt-1 truncate font-mono text-xs text-white",children:y.responseModel})]})]}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 text-xs font-semibold uppercase tracking-[0.16em] text-slate-500",children:"Original Response"}),e.jsx("div",{className:"max-h-[300px] overflow-y-auto rounded-xl border border-white/8 bg-white/4 p-3 text-sm leading-6 text-slate-300",children:u||e.jsx("span",{className:"text-slate-600",children:"No content captured"})})]}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 text-xs font-semibold uppercase tracking-[0.16em] text-emerald-400/80",children:"Replay Response"}),e.jsx("div",{className:"max-h-[300px] overflow-y-auto rounded-xl border border-emerald-400/12 bg-emerald-400/4 p-3 text-sm leading-6 text-slate-300",children:y.content||e.jsx("span",{className:"text-slate-600",children:"Empty response"})})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",onClick:()=>{C(null),$(null)},className:"flex-1 rounded-xl border border-white/10 bg-white/5 px-4 py-2.5 text-sm text-slate-300 transition-colors hover:bg-white/10",children:"Replay Again"}),e.jsx("button",{type:"button",onClick:()=>o(!1),className:"flex-1 rounded-xl bg-emerald-500 px-4 py-2.5 text-sm font-semibold text-white transition-colors hover:bg-emerald-400",children:"Done"})]})]})})()]})]})})]})}export{nt as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{c as Q,u as oe,r as i,j as e,A as O,m as I,X as U,C as de,D as ce,L as xe,g as A,d as me}from"./index-BBr9_AHg.js";import{u as he,P as pe,b as S,d as B,c as C,a as ee}from"./format-BiBDo3KS.js";import{C as ue,M as be}from"./message-square-DdcqfsnD.js";import{Z as je}from"./zap-Ccrxhk2Q.js";import{S as ge,A as G,C as fe,a as Ne,b as se}from"./search-BwbP84dP.js";import{C as ve,A as we}from"./chevron-down-B0xosrpl.js";import{C as ye}from"./clock-CSGov78l.js";import{L as ke}from"./layers--K2XRXAx.js";const Se=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],K=Q("columns-2",Se);const Ce=[["path",{d:"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",key:"2acyp4"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],R=Q("square-check-big",Ce);const Te=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],W=Q("square",Te),J=[25,50,100,200],Y=[{value:1,label:"1h"},{value:6,label:"6h"},{value:24,label:"24h"},{value:168,label:"7d"},{value:720,label:"30d"}];function P({status:s}){const a=s==="error";return e.jsxs("span",{className:"relative flex h-3.5 w-3.5 items-center justify-center",children:[e.jsx("span",{className:`absolute inset-0 rounded-full ${a?"bg-rose-400/25":"bg-emerald-400/25"}`}),e.jsx("span",{className:`relative h-2 w-2 rounded-full ${a?"bg-rose-400":"bg-emerald-300"}`})]})}function De({trace:s,onClose:a}){const h=s.totalDuration??(s.endTime?s.endTime-s.startTime:0);return e.jsxs(I.aside,{initial:{x:"100%",opacity:0},animate:{x:0,opacity:1},exit:{x:"100%",opacity:0},transition:{type:"spring",bounce:.12,duration:.45},className:"fixed inset-y-0 right-0 z-50 flex w-full max-w-md flex-col border-l border-white/8 bg-[rgba(6,10,22,0.97)] shadow-[−40px_0_80px_rgba(0,0,0,0.5)] backdrop-blur-xl",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-white/6 px-5 py-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"hud-label",children:"Quick preview"}),e.jsx("h3",{className:"mt-1 truncate text-lg font-semibold tracking-[-0.04em] text-white",children:s.name})]}),e.jsx("button",{type:"button",onClick:a,className:"flex h-9 w-9 items-center justify-center rounded-xl border border-white/8 bg-white/4 text-slate-400 transition-colors hover:bg-white/8 hover:text-white",children:e.jsx(U,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-5 py-5",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-2xl border border-white/6 bg-white/4 p-4",children:[e.jsx("div",{className:"hud-label",children:"Trace ID"}),e.jsx("div",{className:"mt-1 break-all font-mono text-sm text-slate-300",children:s.traceId})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"rounded-2xl border border-white/6 bg-white/4 p-4",children:[e.jsx("div",{className:"hud-label",children:"Status"}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[e.jsx(P,{status:s.status}),e.jsx("span",{className:`text-sm font-medium ${s.status==="error"?"text-rose-300":"text-emerald-300"}`,children:s.status==="error"?"Error":"Healthy"})]})]}),e.jsxs("div",{className:"rounded-2xl border border-white/6 bg-white/4 p-4",children:[e.jsx("div",{className:"hud-label",children:"Duration"}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[e.jsx(ye,{className:"h-4 w-4 text-sky-300"}),e.jsx("span",{className:"text-sm font-medium text-white",children:h>0?C(h):"N/A"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{className:"rounded-2xl border border-white/6 bg-white/4 p-4 text-center",children:[e.jsx("div",{className:"hud-label",children:"Spans"}),e.jsx("div",{className:"mt-2 text-xl font-semibold text-white",children:s.spanCount}),e.jsx(ke,{className:"mx-auto mt-1 h-4 w-4 text-emerald-300/60"})]}),e.jsxs("div",{className:"rounded-2xl border border-white/6 bg-white/4 p-4 text-center",children:[e.jsx("div",{className:"hud-label",children:"Tokens"}),e.jsx("div",{className:"mt-2 text-xl font-semibold text-white",children:ee(s.totalTokens)}),e.jsx(de,{className:"mx-auto mt-1 h-4 w-4 text-sky-300/60"})]}),e.jsxs("div",{className:"rounded-2xl border border-white/6 bg-white/4 p-4 text-center",children:[e.jsx("div",{className:"hud-label",children:"Cost"}),e.jsx("div",{className:"mt-2 text-xl font-semibold text-white",children:S(s.totalCost)}),e.jsx(ce,{className:"mx-auto mt-1 h-4 w-4 text-amber-300/60"})]})]}),e.jsxs("div",{className:"rounded-2xl border border-white/6 bg-white/4 p-4",children:[e.jsx("div",{className:"hud-label",children:"Started"}),e.jsxs("div",{className:"mt-1 text-sm text-slate-300",children:[new Date(s.startTime).toLocaleString()," (",B(s.startTime),")"]}),s.endTime&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hud-label mt-3",children:"Ended"}),e.jsx("div",{className:"mt-1 text-sm text-slate-300",children:new Date(s.endTime).toLocaleString()})]})]})]}),e.jsxs(xe,{to:`/trace/${s.traceId}`,className:"mt-5 flex w-full items-center justify-center gap-2 rounded-2xl border border-emerald-400/20 bg-[linear-gradient(135deg,rgba(16,185,129,0.12),rgba(14,165,233,0.08))] px-5 py-3 text-sm font-medium text-emerald-300 transition-colors hover:bg-[linear-gradient(135deg,rgba(16,185,129,0.22),rgba(14,165,233,0.14))]",children:["Open full trace detail",e.jsx(se,{className:"h-4 w-4"})]})]})]})}function Ie(s){return s?typeof s=="string"?s:s.filter(a=>a.type==="text"&&a.text).map(a=>a.text).join(`
|
|
2
|
+
`):""}function Pe({traceA:s,traceB:a}){const[h,g]=i.useState([]),[f,r]=i.useState([]),[n,N]=i.useState(!0);if(i.useEffect(()=>{let w=!1;return N(!0),Promise.all([A(s.traceId),A(a.traceId)]).then(([c,m])=>{w||(g(c.spans),r(m.spans),N(!1))}),()=>{w=!0}},[s.traceId,a.traceId]),n)return e.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-slate-500",children:"Loading responses..."});const l=w=>w.flatMap(c=>(c.outputMessages??[]).filter(m=>m.role==="assistant").map(m=>({spanName:c.name,model:c.responseModel??c.requestModel,content:Ie(m.content)}))),p=l(h),v=l(f),b=Math.max(p.length,v.length);return b===0?e.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-slate-500",children:"No assistant responses found in either trace."}):e.jsx("div",{className:"space-y-3",children:Array.from({length:b},(w,c)=>{const m=p[c],x=v[c];return e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx("div",{className:"rounded-2xl border border-emerald-400/10 bg-white/3 p-3",children:m?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-1.5 flex items-center gap-2",children:[e.jsx("span",{className:"rounded-full border border-emerald-400/16 bg-emerald-400/10 px-2 py-0.5 text-[10px] font-bold uppercase tracking-[0.12em] text-emerald-200",children:"assistant"}),e.jsx("span",{className:"font-mono text-[10px] text-slate-500",children:m.model})]}),e.jsx("pre",{className:"whitespace-pre-wrap font-mono text-xs leading-relaxed text-slate-200",children:m.content||e.jsx("span",{className:"text-slate-600 italic",children:"empty response"})})]}):e.jsx("div",{className:"text-xs italic text-slate-600",children:"No response"})}),e.jsx("div",{className:"rounded-2xl border border-sky-400/10 bg-white/3 p-3",children:x?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-1.5 flex items-center gap-2",children:[e.jsx("span",{className:"rounded-full border border-sky-400/16 bg-sky-400/10 px-2 py-0.5 text-[10px] font-bold uppercase tracking-[0.12em] text-sky-200",children:"assistant"}),e.jsx("span",{className:"font-mono text-[10px] text-slate-500",children:x.model})]}),e.jsx("pre",{className:"whitespace-pre-wrap font-mono text-xs leading-relaxed text-slate-200",children:x.content||e.jsx("span",{className:"text-slate-600 italic",children:"empty response"})})]}):e.jsx("div",{className:"text-xs italic text-slate-600",children:"No response"})})]},c)})})}function Me({traceA:s,traceB:a,onClose:h}){const[g,f]=i.useState("metrics"),r=s.totalDuration??(s.endTime?s.endTime-s.startTime:0),n=a.totalDuration??(a.endTime?a.endTime-a.startTime:0),N=[{label:"Status",a:s.status,b:a.status,better:s.status===a.status?"tie":s.status==="ok"?"a":"b"},{label:"Spans",a:String(s.spanCount),b:String(a.spanCount)},{label:"Tokens",a:s.totalTokens.toLocaleString(),b:a.totalTokens.toLocaleString(),diff:s.totalTokens!==a.totalTokens?`${a.totalTokens-s.totalTokens>0?"+":""}${(a.totalTokens-s.totalTokens).toLocaleString()}`:"same",better:s.totalTokens===a.totalTokens?"tie":s.totalTokens<a.totalTokens?"a":"b"},{label:"Cost",a:S(s.totalCost),b:S(a.totalCost),diff:s.totalCost!==a.totalCost?`${a.totalCost-s.totalCost>0?"+":""}${S(Math.abs(a.totalCost-s.totalCost))}`:"same",better:s.totalCost===a.totalCost?"tie":s.totalCost<a.totalCost?"a":"b"},{label:"Duration",a:r>0?C(r):"N/A",b:n>0?C(n):"N/A",diff:r>0&&n>0&&r!==n?`${n-r>0?"+":""}${C(Math.abs(n-r))}`:r===n?"same":void 0,better:r===n?"tie":r>0&&n>0&&r<n?"a":"b"}];return e.jsxs(I.div,{initial:{opacity:0,y:24},animate:{opacity:1,y:0},exit:{opacity:0,y:24},transition:{duration:.3,ease:[.22,1,.36,1]},className:"dashboard-shell rounded-[26px] px-5 py-5 sm:px-6",children:[e.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"hud-label",children:"Comparison mode"}),e.jsx("h2",{className:"mt-1 text-xl font-semibold tracking-[-0.04em] text-white",children:"Side-by-side analysis"})]}),e.jsxs("button",{type:"button",onClick:h,className:"status-chip transition-colors hover:border-white/16 hover:bg-white/8",children:[e.jsx(U,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"Close comparison"})]})]}),e.jsxs("div",{className:"mb-4 flex gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>f("metrics"),className:`inline-flex items-center gap-1.5 rounded-full border px-3.5 py-1.5 text-xs font-semibold transition-colors ${g==="metrics"?"border-emerald-400/20 bg-emerald-400/10 text-emerald-200":"border-white/8 bg-white/4 text-slate-400 hover:text-white"}`,children:[e.jsx(K,{className:"h-3 w-3"}),"Metrics"]}),e.jsxs("button",{type:"button",onClick:()=>f("responses"),className:`inline-flex items-center gap-1.5 rounded-full border px-3.5 py-1.5 text-xs font-semibold transition-colors ${g==="responses"?"border-emerald-400/20 bg-emerald-400/10 text-emerald-200":"border-white/8 bg-white/4 text-slate-400 hover:text-white"}`,children:[e.jsx(be,{className:"h-3 w-3"}),"Response diff"]})]}),g==="metrics"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-4 grid grid-cols-[140px_1fr_1fr_120px] gap-3",children:[e.jsx("div",{}),e.jsxs("div",{className:"rounded-2xl border border-emerald-400/15 bg-emerald-400/5 p-3",children:[e.jsx("div",{className:"hud-label",children:"Trace A"}),e.jsx("div",{className:"mt-1 truncate text-sm font-medium text-white",children:s.name}),e.jsx("div",{className:"mt-0.5 font-mono text-[10px] text-slate-500",children:s.traceId.slice(0,16)})]}),e.jsxs("div",{className:"rounded-2xl border border-sky-400/15 bg-sky-400/5 p-3",children:[e.jsx("div",{className:"hud-label",children:"Trace B"}),e.jsx("div",{className:"mt-1 truncate text-sm font-medium text-white",children:a.name}),e.jsx("div",{className:"mt-0.5 font-mono text-[10px] text-slate-500",children:a.traceId.slice(0,16)})]}),e.jsx("div",{className:"flex items-center justify-center text-[11px] uppercase tracking-[0.18em] text-slate-500",children:"Delta"})]}),e.jsx("div",{className:"space-y-2",children:N.map(l=>e.jsxs("div",{className:"grid grid-cols-[140px_1fr_1fr_120px] items-center gap-3 rounded-2xl border border-white/6 bg-white/4 px-4 py-3",children:[e.jsx("div",{className:"text-xs font-medium uppercase tracking-wider text-slate-400",children:l.label}),e.jsx("div",{className:`text-sm font-mono ${l.better==="a"?"text-emerald-300":(l.better==="tie","text-slate-300")}`,children:l.label==="Status"?e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(P,{status:s.status}),l.a]}):l.a}),e.jsx("div",{className:`text-sm font-mono ${l.better==="b"?"text-emerald-300":(l.better==="tie","text-slate-300")}`,children:l.label==="Status"?e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(P,{status:a.status}),l.b]}):l.b}),e.jsx("div",{className:"text-center text-xs font-mono text-slate-500",children:l.diff??"--"})]},l.label))})]}):e.jsx(Pe,{traceA:s,traceB:a})]})}function Oe(){const[s,a]=oe(),h=s.get("q")??"",g=i.useDeferredValue(h),f=s.get("status"),r=f==="ok"||f==="error"?f:"",n=Number(s.get("periodHours")??"24"),N=Number(s.get("pageSize")??"50"),l=J.includes(N)?N:50,p=Math.max(1,Number(s.get("page")??"1")||1),v=(p-1)*l,[b,w]=i.useState(null),[c,m]=i.useState("desc"),[x,M]=i.useState(new Set),[_,$]=i.useState(null),[te,L]=i.useState(!1),T=i.useMemo(()=>({limit:l,offset:v,q:g.trim()||void 0,status:r||void 0,periodHours:Y.some(t=>t.value===n)?n:24}),[g,l,v,n,r]),{data:V,isLoading:ae}=he({queryKey:["traces",T],queryFn:()=>me(T)}),q=V?.traces??[],k=V?.total??0,Z=Math.max(1,Math.ceil(k/l));function le(t){b===t?m(o=>o==="asc"?"desc":"asc"):(w(t),m("desc"))}const u=i.useMemo(()=>b?[...q].sort((t,o)=>{const d=t[b]??0,j=o[b]??0;return c==="asc"?d-j:j-d}):q,[q,b,c]),D=u.length>0&&u.every(t=>x.has(t.traceId)),re=i.useCallback(()=>{M(t=>{const o=new Set(t);if(D)for(const d of u)o.delete(d.traceId);else for(const d of u)o.add(d.traceId);return o})},[D,u]),ie=i.useCallback(t=>{M(o=>{const d=new Set(o);return d.has(t)?d.delete(t):d.add(t),d})},[]),ne=i.useCallback(()=>{M(new Set),L(!1)},[]),E=i.useMemo(()=>u.filter(t=>x.has(t.traceId)),[u,x]),z=x.size===2,F=h.length>0||r.length>0||T.periodHours!==24;function y(t,o=!0){a(d=>{const j=new URLSearchParams(d);for(const[X,H]of Object.entries(t))H===void 0||H===""?j.delete(X):j.set(X,String(H));return o&&j.delete("page"),j},{replace:!0})}return e.jsxs(e.Fragment,{children:[e.jsxs(pe,{eyebrow:"Trace Explorer",title:"Deep-dive into every trace flowing through the system.",description:"Explore, compare, and inspect individual traces with full visibility into span counts, token usage, cost, and execution timing.",aside:e.jsx("div",{className:"insight-panel",children:e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"rounded-2xl border border-white/8 bg-white/4 p-4",children:[e.jsx("div",{className:"hud-label",children:"Total traces"}),e.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[e.jsx("div",{className:"text-lg font-medium text-white",children:ee(k)}),e.jsx(G,{className:"h-4 w-4 text-emerald-300"})]}),e.jsx("div",{className:"mt-1 text-sm text-slate-400",children:"Matching current filters"})]}),x.size>0&&e.jsxs("div",{className:"rounded-2xl border border-sky-400/15 bg-sky-400/5 p-4",children:[e.jsx("div",{className:"hud-label",children:"Selected"}),e.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[e.jsxs("div",{className:"text-lg font-medium text-white",children:[x.size," trace",x.size!==1&&"s"]}),e.jsx(K,{className:"h-4 w-4 text-sky-300"})]}),e.jsx("div",{className:"mt-1 text-sm text-slate-400",children:z?"Ready to compare":"Select exactly 2 to compare"})]})]})}),children:[e.jsx(O,{children:x.size>0&&e.jsx(I.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"overflow-hidden",children:e.jsxs("div",{className:"dashboard-shell flex items-center justify-between gap-4 rounded-[24px] px-5 py-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"status-chip",children:[e.jsx(R,{className:"h-3.5 w-3.5 text-emerald-300"}),e.jsxs("span",{children:[x.size," selected"]})]}),e.jsxs("button",{type:"button",onClick:ne,className:"status-chip transition-colors hover:border-white/16 hover:bg-white/8",children:[e.jsx(ue,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"Clear"})]})]}),e.jsxs("button",{type:"button",disabled:!z,onClick:()=>L(!0),className:`inline-flex items-center gap-2 rounded-2xl border px-4 py-2 text-sm font-medium transition-all ${z?"border-emerald-400/20 bg-[linear-gradient(135deg,rgba(16,185,129,0.14),rgba(14,165,233,0.08))] text-emerald-300 hover:bg-[linear-gradient(135deg,rgba(16,185,129,0.24),rgba(14,165,233,0.14))]":"cursor-not-allowed border-white/6 bg-white/4 text-slate-500"}`,children:[e.jsx(K,{className:"h-4 w-4"}),"Compare traces"]})]})})}),e.jsx(O,{children:te&&E.length===2&&e.jsx(Me,{traceA:E[0],traceB:E[1],onClose:()=>L(!1)})}),e.jsxs("section",{className:"dashboard-shell rounded-[26px] px-4 py-4 sm:px-5 sm:py-5",children:[e.jsxs("div",{className:"mb-4 rounded-[24px] border border-white/8 bg-[linear-gradient(180deg,rgba(7,14,26,0.95),rgba(4,8,18,0.98))] p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"hud-label",children:"Search console"}),e.jsx("h2",{className:"mt-1 text-xl font-semibold tracking-[-0.04em] text-white",children:"Trace explorer"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"status-chip",children:[e.jsx(je,{className:"h-3.5 w-3.5 text-amber-300"}),e.jsxs("span",{children:[k," traces"]})]}),e.jsxs("button",{type:"button",onClick:()=>y({q:void 0,status:void 0,periodHours:void 0}),disabled:!F,className:"status-chip transition-colors hover:border-white/16 hover:bg-white/8 disabled:cursor-not-allowed disabled:opacity-50",children:[e.jsx(U,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"Clear"})]})]})]}),e.jsxs("div",{className:"mt-4 grid gap-3 md:grid-cols-[minmax(0,1.8fr)_minmax(0,0.6fr)_minmax(0,0.6fr)]",children:[e.jsxs("label",{className:"relative block",children:[e.jsx(ge,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-500"}),e.jsx("input",{value:h,onChange:t=>y({q:t.target.value||void 0}),placeholder:"Search by trace name, ID, or keyword...",className:"w-full rounded-2xl border border-white/8 bg-white/4 py-3 pl-10 pr-4 text-sm text-white placeholder:text-slate-500 focus:border-emerald-400/30 focus:bg-white/6 focus:outline-none"})]}),e.jsxs("select",{value:r,onChange:t=>y({status:t.target.value||void 0}),className:"w-full rounded-2xl border border-white/8 bg-white/4 px-4 py-3 text-sm text-white focus:border-emerald-400/30 focus:bg-white/6 focus:outline-none",children:[e.jsx("option",{value:"",children:"All states"}),e.jsx("option",{value:"ok",children:"Healthy only"}),e.jsx("option",{value:"error",children:"Errors only"})]}),e.jsx("select",{value:String(T.periodHours??24),onChange:t=>y({periodHours:Number(t.target.value)===24?void 0:Number(t.target.value)}),className:"w-full rounded-2xl border border-white/8 bg-white/4 px-4 py-3 text-sm text-white focus:border-amber-400/30 focus:bg-white/6 focus:outline-none",children:Y.map(t=>e.jsx("option",{value:t.value,children:t.label},t.value))})]})]}),ae?e.jsx("div",{className:"empty-state h-[400px] text-slate-500",children:"Loading traces..."}):u.length===0?e.jsxs("div",{className:"empty-state h-[400px]",children:[e.jsx(G,{className:"h-8 w-8 text-slate-500"}),e.jsx("div",{className:"text-base font-medium text-white",children:F?"No traces match these filters":"No traces recorded yet"}),e.jsx("div",{className:"mt-1 text-sm text-slate-500",children:F?"Try adjusting the search or time window":"Start sending spans to populate the explorer"})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full border-separate border-spacing-y-1.5 text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-[11px] uppercase tracking-[0.18em] text-slate-500",children:[e.jsx("th",{className:"px-3 py-2 text-center",children:e.jsx("button",{type:"button",onClick:re,className:"inline-flex items-center justify-center transition-colors hover:text-slate-300",title:D?"Deselect all":"Select all",children:D?e.jsx(R,{className:"h-4 w-4 text-emerald-300"}):e.jsx(W,{className:"h-4 w-4"})})}),e.jsx("th",{className:"px-3 py-2 w-10",children:"State"}),e.jsx("th",{className:"px-3 py-2",children:"Trace"}),e.jsx("th",{className:"px-3 py-2",children:"ID"}),[["spanCount","Spans"],["totalTokens","Tokens"],["totalCost","Cost"],["startTime","When"]].map(([t,o])=>e.jsx("th",{className:"px-3 py-2 text-right",children:e.jsxs("button",{type:"button",onClick:()=>le(t),className:"inline-flex items-center gap-1 transition-colors hover:text-slate-300",children:[o,b===t?c==="asc"?e.jsx(fe,{className:"h-3 w-3"}):e.jsx(ve,{className:"h-3 w-3"}):e.jsx(Ne,{className:"h-3 w-3 opacity-30"})]})},t)),e.jsx("th",{className:"px-3 py-2 text-right",children:"Duration"})]})}),e.jsx("tbody",{children:u.map(t=>{const o=x.has(t.traceId),d=t.totalDuration??(t.endTime?t.endTime-t.startTime:0);return e.jsxs("tr",{onClick:()=>$(t),className:`cursor-pointer rounded-2xl border transition-colors ${o?"border-emerald-400/20 bg-emerald-400/5":"border-white/6 bg-white/4 hover:bg-white/6"}`,children:[e.jsx("td",{className:"rounded-l-2xl px-3 py-3 text-center",onClick:j=>j.stopPropagation(),children:e.jsx("button",{type:"button",onClick:()=>ie(t.traceId),className:"inline-flex items-center justify-center transition-colors hover:text-emerald-300",children:o?e.jsx(R,{className:"h-4 w-4 text-emerald-300"}):e.jsx(W,{className:"h-4 w-4 text-slate-500"})})}),e.jsx("td",{className:"px-3 py-3",children:e.jsx(P,{status:t.status})}),e.jsx("td",{className:"px-3 py-3",children:e.jsx("span",{className:"inline-flex max-w-[280px] items-center gap-2 text-sm font-medium text-white",children:e.jsx("span",{className:"truncate",children:t.name})})}),e.jsx("td",{className:"px-3 py-3",children:e.jsx("span",{className:"font-mono text-[11px] uppercase tracking-[0.12em] text-slate-500",children:t.traceId.slice(0,12)})}),e.jsx("td",{className:"px-3 py-3 text-right font-mono text-xs text-slate-300",children:t.spanCount}),e.jsx("td",{className:"px-3 py-3 text-right font-mono text-xs text-slate-300",children:t.totalTokens.toLocaleString()}),e.jsx("td",{className:"px-3 py-3 text-right font-mono text-xs text-slate-300",children:S(t.totalCost)}),e.jsx("td",{className:"px-3 py-3 text-right text-xs text-slate-500",children:B(t.startTime)}),e.jsx("td",{className:"rounded-r-2xl px-3 py-3 text-right font-mono text-xs text-slate-400",children:d>0?C(d):"--"})]},t.traceId)})})]})}),e.jsxs("div",{className:"mt-4 flex items-center justify-between gap-3 px-1",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"text-xs text-slate-500",children:k>0?`Showing ${v+1}-${Math.min(v+u.length,k)} of ${k}`:"Awaiting traces"}),e.jsx("select",{value:String(l),onChange:t=>y({pageSize:Number(t.target.value)===50?void 0:Number(t.target.value)}),className:"rounded-xl border border-white/8 bg-white/4 px-2 py-1.5 text-xs text-slate-300 focus:border-emerald-400/30 focus:outline-none",children:J.map(t=>e.jsxs("option",{value:t,children:[t," / page"]},t))})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>y({page:p>2?p-1:void 0},!1),disabled:p<=1,className:"status-chip transition-colors hover:border-white/16 hover:bg-white/8 disabled:cursor-not-allowed disabled:opacity-50",children:[e.jsx(we,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"Previous"})]}),e.jsxs("span",{className:"text-xs text-slate-500",children:[p," / ",Z]}),e.jsxs("button",{type:"button",onClick:()=>y({page:p+1},!1),disabled:p>=Z,className:"status-chip transition-colors hover:border-white/16 hover:bg-white/8 disabled:cursor-not-allowed disabled:opacity-50",children:[e.jsx("span",{children:"Next"}),e.jsx(se,{className:"h-3.5 w-3.5"})]})]})]})]})]})]}),e.jsx(O,{children:_&&e.jsxs(e.Fragment,{children:[e.jsx(I.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>$(null),className:"fixed inset-0 z-40 bg-black/50 backdrop-blur-sm"},"overlay"),e.jsx(De,{trace:_,onClose:()=>$(null)},_.traceId)]})})]})}export{Oe as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as o}from"./index-BBr9_AHg.js";const e=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],c=o("arrow-left",e);const n=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],r=o("chevron-down",n);export{c as A,r as C};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c}from"./index-BBr9_AHg.js";const o=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],r=c("clock",o);export{r as C};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c}from"./index-BBr9_AHg.js";const e=[["path",{d:"M13.744 17.736a6 6 0 1 1-7.48-7.48",key:"bq4yh3"}],["path",{d:"M15 6h1v4",key:"11y1tn"}],["path",{d:"m6.134 14.768.866-.5 2 3.464",key:"17snzx"}],["circle",{cx:"16",cy:"8",r:"6",key:"14bfc9"}]],t=c("coins",e);export{t as C};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c}from"./index-BBr9_AHg.js";const o=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],n=c("check",o);const e=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],d=c("copy",e);const t=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],h=c("download",t);export{n as C,h as D,d as a};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z as G,B as L,E as u,F as _,G as x,H as M,I as Q,J as $,K as J,N as C,O as X,P as Y,Q as B,U as V,r as f,V as W,p as Z,j as d}from"./index-BBr9_AHg.js";var q=class extends G{constructor(t,e){super(),this.options=e,this.#s=t,this.#i=null,this.#r=L(),this.bindMethods(),this.setOptions(e)}#s;#t=void 0;#p=void 0;#e=void 0;#n;#l;#r;#i;#m;#u;#d;#o;#h;#a;#f=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),A(this.#t,this.options)?this.#c():this.updateResult(),this.#R())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return F(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return F(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#x(),this.#y(),this.#t.removeObserver(this)}setOptions(t){const e=this.options,s=this.#t;if(this.options=this.#s.defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof u(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#S(),this.#t.setOptions(this.options),e._defaulted&&!_(this.options,e)&&this.#s.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const r=this.hasListeners();r&&H(this.#t,s,this.options,e)&&this.#c(),this.updateResult(),r&&(this.#t!==s||u(this.options.enabled,this.#t)!==u(e.enabled,this.#t)||x(this.options.staleTime,this.#t)!==x(e.staleTime,this.#t))&&this.#g();const i=this.#b();r&&(this.#t!==s||u(this.options.enabled,this.#t)!==u(e.enabled,this.#t)||i!==this.#a)&&this.#v(i)}getOptimisticResult(t){const e=this.#s.getQueryCache().build(this.#s,t),s=this.createResult(e,t);return et(this,s)&&(this.#e=s,this.#l=this.options,this.#n=this.#t.state),s}getCurrentResult(){return this.#e}trackResult(t,e){return new Proxy(t,{get:(s,r)=>(this.trackProp(r),e?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#r.status==="pending"&&this.#r.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(s,r))})}trackProp(t){this.#f.add(t)}getCurrentQuery(){return this.#t}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const e=this.#s.defaultQueryOptions(t),s=this.#s.getQueryCache().build(this.#s,e);return s.fetch().then(()=>this.createResult(s,e))}fetch(t){return this.#c({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#e))}#c(t){this.#S();let e=this.#t.fetch(this.options,t);return t?.throwOnError||(e=e.catch(M)),e}#g(){this.#x();const t=x(this.options.staleTime,this.#t);if(Q||this.#e.isStale||!$(t))return;const s=J(this.#e.dataUpdatedAt,t)+1;this.#o=C.setTimeout(()=>{this.#e.isStale||this.updateResult()},s)}#b(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(t){this.#y(),this.#a=t,!(Q||u(this.options.enabled,this.#t)===!1||!$(this.#a)||this.#a===0)&&(this.#h=C.setInterval(()=>{(this.options.refetchIntervalInBackground||X.isFocused())&&this.#c()},this.#a))}#R(){this.#g(),this.#v(this.#b())}#x(){this.#o&&(C.clearTimeout(this.#o),this.#o=void 0)}#y(){this.#h&&(C.clearInterval(this.#h),this.#h=void 0)}createResult(t,e){const s=this.#t,r=this.options,i=this.#e,l=this.#n,n=this.#l,b=t!==s?t.state:this.#p,{state:h}=t;let a={...h},v=!1,o;if(e._optimisticResults){const c=this.hasListeners(),R=!c&&A(t,e),S=c&&H(t,s,e,r);(R||S)&&(a={...a,...Y(h.data,t.options)}),e._optimisticResults==="isRestoring"&&(a.fetchStatus="idle")}let{error:y,errorUpdatedAt:N,status:g}=a;o=a.data;let U=!1;if(e.placeholderData!==void 0&&o===void 0&&g==="pending"){let c;i?.isPlaceholderData&&e.placeholderData===n?.placeholderData?(c=i.data,U=!0):c=typeof e.placeholderData=="function"?e.placeholderData(this.#d?.state.data,this.#d):e.placeholderData,c!==void 0&&(g="success",o=B(i?.data,c,e),v=!0)}if(e.select&&o!==void 0&&!U)if(i&&o===l?.data&&e.select===this.#m)o=this.#u;else try{this.#m=e.select,o=e.select(o),o=B(i?.data,o,e),this.#u=o,this.#i=null}catch(c){this.#i=c}this.#i&&(y=this.#i,o=this.#u,N=Date.now(),g="error");const w=a.fetchStatus==="fetching",I=g==="pending",T=g==="error",D=I&&w,j=o!==void 0,m={status:g,fetchStatus:a.fetchStatus,isPending:I,isSuccess:g==="success",isError:T,isInitialLoading:D,isLoading:D,data:o,dataUpdatedAt:a.dataUpdatedAt,error:y,errorUpdatedAt:N,failureCount:a.fetchFailureCount,failureReason:a.fetchFailureReason,errorUpdateCount:a.errorUpdateCount,isFetched:a.dataUpdateCount>0||a.errorUpdateCount>0,isFetchedAfterMount:a.dataUpdateCount>b.dataUpdateCount||a.errorUpdateCount>b.errorUpdateCount,isFetching:w,isRefetching:w&&!I,isLoadingError:T&&!j,isPaused:a.fetchStatus==="paused",isPlaceholderData:v,isRefetchError:T&&j,isStale:P(t,e),refetch:this.refetch,promise:this.#r,isEnabled:u(e.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const c=m.data!==void 0,R=m.status==="error"&&!c,S=O=>{R?O.reject(m.error):c&&O.resolve(m.data)},k=()=>{const O=this.#r=m.promise=L();S(O)},E=this.#r;switch(E.status){case"pending":t.queryHash===s.queryHash&&S(E);break;case"fulfilled":(R||m.data!==E.value)&&k();break;case"rejected":(!R||m.error!==E.reason)&&k();break}}return m}updateResult(){const t=this.#e,e=this.createResult(this.#t,this.options);if(this.#n=this.#t.state,this.#l=this.options,this.#n.data!==void 0&&(this.#d=this.#t),_(e,t))return;this.#e=e;const s=()=>{if(!t)return!0;const{notifyOnChangeProps:r}=this.options,i=typeof r=="function"?r():r;if(i==="all"||!i&&!this.#f.size)return!0;const l=new Set(i??this.#f);return this.options.throwOnError&&l.add("error"),Object.keys(this.#e).some(n=>{const p=n;return this.#e[p]!==t[p]&&l.has(p)})};this.#E({listeners:s()})}#S(){const t=this.#s.getQueryCache().build(this.#s,this.options);if(t===this.#t)return;const e=this.#t;this.#t=t,this.#p=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#R()}#E(t){V.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(this.#e)}),this.#s.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function tt(t,e){return u(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function A(t,e){return tt(t,e)||t.state.data!==void 0&&F(t,e,e.refetchOnMount)}function F(t,e,s){if(u(e.enabled,t)!==!1&&x(e.staleTime,t)!=="static"){const r=typeof s=="function"?s(t):s;return r==="always"||r!==!1&&P(t,e)}return!1}function H(t,e,s,r){return(t!==e||u(r.enabled,t)===!1)&&(!s.suspense||t.state.status!=="error")&&P(t,s)}function P(t,e){return u(e.enabled,t)!==!1&&t.isStaleByTime(x(e.staleTime,t))}function et(t,e){return!_(t.getCurrentResult(),e)}var K=f.createContext(!1),st=()=>f.useContext(K);K.Provider;function rt(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var it=f.createContext(rt()),at=()=>f.useContext(it),nt=(t,e,s)=>{const r=s?.state.error&&typeof t.throwOnError=="function"?W(t.throwOnError,[s.state.error,s]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},ot=t=>{f.useEffect(()=>{t.clearReset()},[t])},ht=({result:t,errorResetBoundary:e,throwOnError:s,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||W(s,[t.error,r])),ct=t=>{if(t.suspense){const s=i=>i==="static"?i:Math.max(i??1e3,1e3),r=t.staleTime;t.staleTime=typeof r=="function"?(...i)=>s(r(...i)):s(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},lt=(t,e)=>t.isLoading&&t.isFetching&&!e,ut=(t,e)=>t?.suspense&&e.isPending,z=(t,e,s)=>e.fetchOptimistic(t).catch(()=>{s.clearReset()});function dt(t,e,s){const r=st(),i=at(),l=Z(),n=l.defaultQueryOptions(t);l.getDefaultOptions().queries?._experimental_beforeQuery?.(n);const p=l.getQueryCache().get(n.queryHash);n._optimisticResults=r?"isRestoring":"optimistic",ct(n),nt(n,i,p),ot(i);const b=!l.getQueryCache().get(n.queryHash),[h]=f.useState(()=>new e(l,n)),a=h.getOptimisticResult(n),v=!r&&t.subscribed!==!1;if(f.useSyncExternalStore(f.useCallback(o=>{const y=v?h.subscribe(V.batchCalls(o)):M;return h.updateResult(),y},[h,v]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),f.useEffect(()=>{h.setOptions(n)},[n,h]),ut(n,a))throw z(n,h,i);if(ht({result:a,errorResetBoundary:i,throwOnError:n.throwOnError,query:p,suspense:n.suspense}))throw a.error;return l.getDefaultOptions().queries?._experimental_afterQuery?.(n,a),n.experimental_prefetchInRender&&!Q&<(a,r)&&(b?z(n,h,i):p?.promise)?.catch(M).finally(()=>{h.updateResult()}),n.notifyOnChangeProps?a:h.trackResult(a)}function mt(t,e){return dt(t,q)}function gt({eyebrow:t,title:e,description:s,aside:r,children:i}){return d.jsxs("div",{className:"mx-auto flex w-full max-w-[1500px] flex-col gap-8",children:[d.jsxs("section",{className:"hero-panel overflow-hidden rounded-[28px] border border-white/8 px-5 py-6 sm:px-7 sm:py-8",children:[d.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 w-1/2 bg-[radial-gradient(circle_at_top_right,rgba(14,165,233,0.22),transparent_45%),radial-gradient(circle_at_60%_70%,rgba(34,197,94,0.18),transparent_42%)]"}),d.jsxs("div",{className:"relative grid gap-6 lg:grid-cols-[minmax(0,1fr)_320px]",children:[d.jsxs("div",{className:"space-y-4",children:[d.jsx("div",{className:"hud-label",children:t}),d.jsxs("div",{className:"max-w-3xl space-y-3",children:[d.jsx("h1",{className:"text-3xl font-semibold leading-none tracking-[-0.04em] text-white sm:text-5xl",children:e}),d.jsx("p",{className:"max-w-2xl text-sm leading-6 text-slate-300 sm:text-base",children:s})]})]}),r?d.jsx("div",{className:"relative",children:r}):null]})]}),i]})}function bt(t){const e=Math.abs(t),s=t<0?"-":"";return e<.01?`${s}$${e.toFixed(4)}`:`${s}$${e.toFixed(2)}`}function vt(t){return t<1e3?`${Math.round(t)}ms`:`${(t/1e3).toFixed(1)}s`}function Rt(t){return new Intl.NumberFormat("en-US",{notation:"compact",maximumFractionDigits:t>=1e3?1:0}).format(t)}function xt(t){return new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function yt(t){const e=Date.now()-t,s=Math.floor(e/6e4);if(s<1)return"just now";if(s<60)return`${s}m ago`;const r=Math.floor(s/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}export{gt as P,Rt as a,bt as b,vt as c,yt as d,xt as f,mt as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as a}from"./index-BBr9_AHg.js";const e=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],c=a("gauge",e);export{c as G};
|