ai-agent-session-center 2.4.0 → 2.4.3
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/README.md +2 -0
- package/dist/client/assets/AnalyticsView-B7ALjnxe.js +1 -0
- package/dist/client/assets/Charts-IyRNWsxy.css +1 -0
- package/dist/client/assets/{Charts.module-Dx9gJPQR.js → Charts.module-BVWDL-nq.js} +2 -2
- package/dist/client/assets/{CyberdromeScene-CxjA5JVV.js → CyberdromeScene-fsiugRCk.js} +1 -1
- package/dist/client/assets/HistoryView-2SToJwhm.js +1 -0
- package/dist/client/assets/HistoryView-khsGJftp.css +1 -0
- package/dist/client/assets/{ProjectBrowserView-5bUQLVrl.js → ProjectBrowserView-CC-VpOqU.js} +1 -1
- package/dist/client/assets/QueueView-BolJW5o0.js +1 -0
- package/dist/client/assets/TimelineView-B_Lk9xQG.js +4 -0
- package/dist/client/assets/index-B7h3JN01.js +153 -0
- package/dist/client/assets/index-y70PbO5W.css +1 -0
- package/dist/client/assets/{useQuery-C-SRwqqC.js → useQuery-D3equUmE.js} +1 -1
- package/dist/client/assets/{with-selector-C0N9xw7F.js → with-selector-bHDjn-jq.js} +1 -1
- package/dist/client/index.html +2 -2
- package/hooks/install-hooks-api.cjs +169 -0
- package/hooks/install-hooks-core.cjs +89 -0
- package/hooks/package.json +1 -0
- package/package.json +4 -4
- package/server/apiRouter.ts +3 -3
- package/server/serverConfig.ts +5 -1
- package/server/sessionMatcher.ts +13 -3
- package/dist/client/assets/AnalyticsView-CbZwTSY4.js +0 -1
- package/dist/client/assets/Charts-BN9-_lNy.css +0 -1
- package/dist/client/assets/HistoryView-Cu23DcIM.css +0 -1
- package/dist/client/assets/HistoryView-tXMsxMhN.js +0 -1
- package/dist/client/assets/QueueView-DM_X1lfF.js +0 -1
- package/dist/client/assets/TimelineView-DuOSFGCv.js +0 -4
- package/dist/client/assets/index-ClPKOKvN.css +0 -1
- package/dist/client/assets/index-DS3KKkg_.js +0 -169
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{U as _r,
|
|
1
|
+
import{U as _r,C as Sm,N as xr,D as ql,V as wn,E as Ot,F as Nf,M as ki,G as ft,H as xm,I as Yt,J as Vt,K as Lu,L as wl,W as Uu,O as Hr,Q as tn,T as fo,X as ci,Y as Sr,Z as dr,_ as mo,$ as xo,a0 as L_,a1 as Ta,a2 as Du,a3 as bm,a4 as br,a5 as va,a6 as Xt,a7 as Em,a8 as kt,a9 as si,aa as Mm,ab as _l,ac as Dr,ad as ma,ae as ba,af as go,ag as Bi,ah as ps,ai as U_,aj as Tm,ak as vo,al as Vn,am as Pl,an as pa,ao as hs,ap as ym,aq as Am,ar as co,as as Cm,at as Rm,au as wm,av as Pm,aw as Lm,ax as Um,ay as Dm,az as Im,aA as Nm,aB as Fm,aC as Om,aD as km,aE as Bm,aF as Gm,aG as zm,aH as Hm,aI as Vm,aJ as Sl,aK as os,aL as Wm,aM as Fi,aN as jm,aO as Xm,aP as Kl,aQ as Ym,aR as Zl,aS as qm,aT as Km,aU as Zm,aV as Ff,aW as Ut,aX as Of,aY as kf,aZ as ui,a_ as _a,a$ as po,b0 as ho,b1 as li,b2 as ga,b3 as oi,b4 as Bf,b5 as Qm,b6 as Gf,b7 as zf,b8 as Hf,b9 as ms,ba as Vf,bb as Wf,bc as jf,bd as bo,be as Jm,bf as $m,bg as eg,bh as tg,bi as Xf,bj as ng,bk as rg,bl as ig,bm as xl,bn as bl,bo as El,bp as Ml,bq as Iu,br as Nu,bs as Fu,bt as Ou,bu as ku,bv as Bu,bw as Gu,bx as zu,by as Hu,bz as Vu,bA as Wu,bB as ju,bC as Xu,bD as Yu,bE as qu,bF as Ku,bG as Zu,bH as Qu,bI as Ju,bJ as $u,bK as ef,bL as tf,bM as nf,bN as rf,bO as af,bP as of,bQ as sf,bR as lf,bS as cf,bT as uf,bU as ff,bV as df,bW as Ll,bX as Ul,bY as Dl,bZ as Il,b_ as Nl,b$ as Fl,c0 as Ol,c1 as ag,c2 as pf,c3 as og,c4 as cs,c5 as sg,c6 as hf,c7 as mf,c8 as kl,c9 as Bl,ca as Gl,cb as Yf,cc as qf,cd as Ss,ce as lg,cf as cg,cg as ug,ch as Kf,ci as fh,cj as Zf,ck as Qf,cl as Jf,cm as $f,cn as xs,co as ed,cp as td,cq as nd,cr as dh,cs as rd,ct as _o,cu as Ea,cv as id,cw as fg,cx as dg,cy as D_,cz as gf,cA as Kn,cB as zl,cC as pg,cD as hg,cE as I_,cF as mg,cG as gg,cH as vg,cI as ad,cJ as _g,cK as Sg,cL as N_,cM as F_,cN as O_,cO as k_,cP as B_,cQ as G_,cR as z_,cS as H_,cT as V_,cU as W_,cV as j_,cW as X_,cX as Y_,cY as q_,cZ as K_,c_ as Z_,c$ as Q_,d0 as J_,d1 as $_,d2 as xg,d3 as eS,d4 as tS,d5 as nS,d6 as rS,d7 as od,d8 as iS,d9 as aS,da as oS,db as sS,dc as lS,dd as cS,de as uS,df as fS,dg as dS,dh as pS,di as bg,dj as hS,dk as mS,dl as gS,dm as vS,dn as _S,dp as SS,dq as xS,dr as bS,ds as ES,dt as MS,du as TS,dv as yS,dw as AS,dx as CS,dy as RS,dz as wS,dA as PS,dB as LS,dC as US,dD as DS,dE as IS,dF as NS,dG as FS,dH as OS,dI as kS,dJ as BS,dK as GS,dL as zS,dM as HS,dN as VS,dO as ua,dP as WS,dQ as jS,dR as XS,dS as YS,dT as qS,dU as KS,dV as vf,dW as ZS,dX as QS,dY as JS,dZ as $S,d_ as ex,d$ as tx,e0 as nx,e1 as rx,e2 as ix,e3 as ax,e4 as ox,e5 as sx,e6 as lx,e7 as cx,e8 as ux,e9 as fx,ea as Eg,eb as Mg,ec as dx,ed as px,ee as hx,ef as mx,eg as gx,eh as vx,ei as _x,ej as Sx,ek as xx,el as bx,em as Ex,en as Mx,eo as Tx,ep as yx,eq as Ax,er as Cx,es as Rx,et as wx,eu as Px,ev as Lx,ew as Ux,ex as Dx,ey as Tg,ez as Ix,eA as Nx,eB as Fx,eC as Ox,eD as yg,eE as kx,eF as Bx,eG as Gx,eH as zx,eI as Hx,eJ as Vx,eK as Wx,eL as jx,eM as Xx,eN as Yx,eO as qx,eP as fa,eQ as Kx,eR as Zx,eS as _f,eT as Qx,eU as Jx,eV as $x,eW as eb,eX as tb,eY as nb,eZ as fr,e_ as rb,e$ as ib,f0 as ab,f1 as ob,f2 as sb,f3 as lb,f4 as cb,f5 as ub,f6 as fb,f7 as db,f8 as pb,f9 as hb,fa as mb,fb as gb,fc as vb,fd as _b,fe as Sb,ff as xb,fg as Ag,fh as bb,fi as Eb,fj as Mb,fk as Tb,fl as yb,fm as Ab,fn as Cb,fo as Hl,fp as Rb,fq as wb,fr as Cg,fs as Pb,ft as Lb,fu as Ub,fv as Rg,fw as wg,fx as Db,fy as Ib,fz as Nb,fA as Fb,fB as Ob,fC as Pg,fD as kb,fE as Bb,fF as Gb,fG as zb,fH as Hb,fI as Vb,fJ as Wb,fK as jb,fL as Xb,fM as Lg,fN as Yb,fO as Sf,fP as qb,fQ as Kb,fR as Zb,fS as Qb,fT as Jb,fU as $b,fV as eE,fW as tE,fX as nE,fY as rE,fZ as iE,f_ as aE,f$ as oE,g0 as sE,g1 as da,g2 as lE,g3 as cE,g4 as uE,g5 as fE,g6 as dE,g7 as pE,g8 as hE,g9 as mE,ga as gE,gb as vE,gc as _E,gd as SE,ge as xE,gf as bE,gg as EE,gh as ME,gi as TE,gj as yE,gk as AE,gl as CE,gm as RE,gn as wE,go as PE,gp as LE,gq as UE,gr as DE,gs as IE,gt as NE,gu as FE,gv as OE,gw as kE,gx as Ug,gy as BE,g as GE,r as oe,j as Q,gz as zE,gA as HE,gB as fi,gC as oa,gD as Dg,gE as VE,gF as sl,gG as ph,gH as WE,gI as jE,gJ as XE,gK as YE,gL as Ql,gM as ll,gN as Tl,gO as kn,gP as es,gQ as hh,gR as xf,gS as pu,gT as qE,gU as KE,gV as ZE,gW as QE,gX as Vl,x as mh,gY as JE,gZ as $E,g_ as e1,g$ as t1,h0 as n1,h1 as r1,h2 as i1,h3 as a1,h4 as o1}from"./index-B7h3JN01.js";import{u as s1}from"./with-selector-bHDjn-jq.js";function Ig(){let n=null,r=!1,s=null,l=null;function a(i,f){s(i,f),l=n.requestAnimationFrame(a)}return{start:function(){r!==!0&&s!==null&&(l=n.requestAnimationFrame(a),r=!0)},stop:function(){n.cancelAnimationFrame(l),r=!1},setAnimationLoop:function(i){s=i},setContext:function(i){n=i}}}function l1(n){const r=new WeakMap;function s(u,d){const p=u.array,h=u.usage,v=p.byteLength,S=n.createBuffer();n.bindBuffer(d,S),n.bufferData(d,p,h),u.onUploadCallback();let b;if(p instanceof Float32Array)b=n.FLOAT;else if(typeof Float16Array<"u"&&p instanceof Float16Array)b=n.HALF_FLOAT;else if(p instanceof Uint16Array)u.isFloat16BufferAttribute?b=n.HALF_FLOAT:b=n.UNSIGNED_SHORT;else if(p instanceof Int16Array)b=n.SHORT;else if(p instanceof Uint32Array)b=n.UNSIGNED_INT;else if(p instanceof Int32Array)b=n.INT;else if(p instanceof Int8Array)b=n.BYTE;else if(p instanceof Uint8Array)b=n.UNSIGNED_BYTE;else if(p instanceof Uint8ClampedArray)b=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+p);return{buffer:S,type:b,bytesPerElement:p.BYTES_PER_ELEMENT,version:u.version,size:v}}function l(u,d,p){const h=d.array,v=d.updateRanges;if(n.bindBuffer(p,u),v.length===0)n.bufferSubData(p,0,h);else{v.sort((b,A)=>b.start-A.start);let S=0;for(let b=1;b<v.length;b++){const A=v[S],P=v[b];P.start<=A.start+A.count+1?A.count=Math.max(A.count,P.start+P.count-A.start):(++S,v[S]=P)}v.length=S+1;for(let b=0,A=v.length;b<A;b++){const P=v[b];n.bufferSubData(p,P.start*h.BYTES_PER_ELEMENT,h,P.start,P.count)}d.clearUpdateRanges()}d.onUploadCallback()}function a(u){return u.isInterleavedBufferAttribute&&(u=u.data),r.get(u)}function i(u){u.isInterleavedBufferAttribute&&(u=u.data);const d=r.get(u);d&&(n.deleteBuffer(d.buffer),r.delete(u))}function f(u,d){if(u.isInterleavedBufferAttribute&&(u=u.data),u.isGLBufferAttribute){const h=r.get(u);(!h||h.version<u.version)&&r.set(u,{buffer:u.buffer,type:u.type,bytesPerElement:u.elementSize,version:u.version});return}const p=r.get(u);if(p===void 0)r.set(u,s(u,d));else if(p.version<u.version){if(p.size!==u.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");l(p.buffer,u,d),p.version=u.version}}return{get:a,remove:i,update:f}}var c1=`#ifdef USE_ALPHAHASH
|
|
2
2
|
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
|
|
3
3
|
#endif`,u1=`#ifdef USE_ALPHAHASH
|
|
4
4
|
const float ALPHA_HASH_SCALE = 0.05;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as _,j as t,u as B,a as x,S as f}from"./index-B7h3JN01.js";import{u as b}from"./useQuery-D3equUmE.js";function C({value:e,onChange:s,placeholder:l="Search...",debounceMs:c=300,className:r,inputClassName:u}){const[i,m]=_.useState(e??""),p=_.useRef(null);_.useEffect(()=>{e!==void 0&&m(e)},[e]);const d=_.useCallback(j=>{p.current&&clearTimeout(p.current),p.current=setTimeout(()=>s(j),c)},[s,c]);_.useEffect(()=>()=>{p.current&&clearTimeout(p.current)},[]);function v(j){const n=j.target.value;m(n),d(n)}function h(){m(""),p.current&&clearTimeout(p.current),s("")}return t.jsxs("div",{className:r,style:{position:"relative",display:"flex",alignItems:"center"},children:[t.jsx("input",{type:"text",value:i,onChange:v,placeholder:l,className:u,style:u?void 0:{width:"100%",padding:"8px 32px 8px 12px",background:"var(--bg-primary, #0a0a1a)",border:"1px solid var(--border-subtle, rgba(255,255,255,0.06))",borderRadius:"6px",color:"var(--text-primary, #e0e0ff)",fontSize:"0.85rem",fontFamily:"var(--font-mono, monospace)",outline:"none"}}),i&&t.jsx("button",{onClick:h,"aria-label":"Clear search",style:{position:"absolute",right:"8px",background:"none",border:"none",color:"var(--text-secondary, #8888aa)",cursor:"pointer",fontSize:"0.9rem",padding:"2px 4px",lineHeight:1},children:"x"})]})}function S({tabs:e,activeTab:s,onTabChange:l,containerClassName:c,panelClassName:r,tabListClassName:u,tabClassName:i,activeTabClassName:m}){return t.jsxs("div",{className:c,children:[t.jsx("div",{role:"tablist",className:u,style:u?void 0:{display:"flex",gap:"2px",borderBottom:"1px solid var(--border-subtle, rgba(255,255,255,0.06))",marginBottom:"12px"},children:e.map(p=>{const d=s===p.id,v=[i,d&&m].filter(Boolean).join(" ");return t.jsx("button",{role:"tab","aria-selected":d,onClick:()=>l(p.id),className:v||void 0,style:v?void 0:{padding:"8px 16px",background:d?"var(--bg-accent, rgba(0,229,255,0.1))":"transparent",border:"none",borderBottom:d?"2px solid var(--accent-cyan, #00e5ff)":"2px solid transparent",color:d?"var(--accent-cyan, #00e5ff)":"var(--text-secondary, #8888aa)",cursor:"pointer",fontSize:"0.85rem",fontFamily:"var(--font-mono, monospace)",transition:"color 0.15s, background 0.15s"},children:p.label},p.id)})}),t.jsx("div",{role:"tabpanel",className:r,children:e.find(p=>p.id===s)?.content})]})}const E="_container_1j3ds_5",D="_filters_1j3ds_15",k="_filterGroup_1j3ds_22",F="_filterLabel_1j3ds_28",$="_filterInput_1j3ds_36",P="_sortToggle_1j3ds_54",q="_results_1j3ds_72",L="_emptyState_1j3ds_80",M="_row_1j3ds_89",I="_rowTitle_1j3ds_107",R="_rowProject_1j3ds_115",A="_rowDate_1j3ds_123",H="_rowDuration_1j3ds_129",G="_rowStatus_1j3ds_135",U="_rowMeta_1j3ds_165",O="_deleteBtn_1j3ds_171",z="_pagination_1j3ds_189",K="_pageBtn_1j3ds_197",Q="_pageBtnActive_1j3ds_218",W="_pageEllipsis_1j3ds_224",Z="_detailOverlay_1j3ds_231",J="_detailCard_1j3ds_241",V="_detailTabs_1j3ds_255",X="_detailTabPanel_1j3ds_263",Y="_detailHeader_1j3ds_271",tt="_detailTitle_1j3ds_278",et="_detailMeta_1j3ds_284",at="_detailCloseBtn_1j3ds_291",st="_detailBody_1j3ds_304",ot="_convoEntry_1j3ds_309",nt="_convoEntryHeader_1j3ds_317",it="_copyBtn_1j3ds_324",rt="_convoPrompt_1j3ds_346",lt="_convoResponse_1j3ds_351",ct="_convoTime_1j3ds_356",dt="_convoText_1j3ds_362",pt="_activityEntry_1j3ds_369",ut="_activityTime_1j3ds_377",mt="_activityBadge_1j3ds_383",_t="_activityBadgeTool_1j3ds_392",vt="_activityBadgeEvent_1j3ds_397",jt="_activityDetail_1j3ds_402",a={container:E,filters:D,filterGroup:k,filterLabel:F,filterInput:$,sortToggle:P,results:q,emptyState:L,row:M,rowTitle:I,rowProject:R,rowDate:A,rowDuration:H,rowStatus:G,rowMeta:U,deleteBtn:O,pagination:z,pageBtn:K,pageBtnActive:Q,pageEllipsis:W,detailOverlay:Z,detailCard:J,detailTabs:V,detailTabPanel:X,detailHeader:Y,detailTitle:tt,detailMeta:et,detailCloseBtn:at,detailBody:st,convoEntry:ot,convoEntryHeader:nt,copyBtn:it,convoPrompt:rt,convoResponse:lt,convoTime:ct,convoText:dt,activityEntry:pt,activityTime:ut,activityBadge:mt,activityBadgeTool:_t,activityBadgeEvent:vt,activityDetail:jt},N=50;function g(e){if(e<1e3)return"<1s";const s=Math.floor(e/1e3);if(s<60)return`${s}s`;const l=Math.floor(s/60);return l<60?`${l}m ${s%60}s`:`${Math.floor(l/60)}h ${l%60}m`}function ht(e){return e?new Date(e).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}):"--"}function T(e){return new Date(e).toLocaleTimeString("en-US",{hour12:!1})}function yt(e){const s=new URLSearchParams;e.query&&s.set("query",e.query),e.project&&s.set("project",e.project),e.status==="archived"?s.set("archived","true"):e.status&&s.set("status",e.status),e.dateFrom&&s.set("dateFrom",String(new Date(e.dateFrom).getTime())),e.dateTo&&s.set("dateTo",String(new Date(e.dateTo+"T23:59:59").getTime()));const l={date:"started_at",duration:"last_activity_at",prompts:"started_at",tools:"started_at"};return s.set("sortBy",l[e.sortBy]||"started_at"),s.set("sortDir",e.sortDir),s.set("page",String(e.page)),s.set("pageSize",String(N)),s.toString()}function wt(){const e=B(),[s,l]=_.useState({query:"",project:"",status:"",dateFrom:"",dateTo:"",sortBy:"date",sortDir:"desc",page:1}),[c,r]=_.useState(null),{data:u}=b({queryKey:["db-projects"],queryFn:async()=>{const o=await x("/api/db/projects");if(!o.ok)throw new Error("Failed to load projects");return o.json()},staleTime:6e4}),{data:i,isLoading:m}=b({queryKey:["db-sessions",s],queryFn:async()=>{const o=await x(`/api/db/sessions?${yt(s)}`);if(!o.ok)throw new Error("Failed to load sessions");return o.json()}}),{data:p}=b({queryKey:["db-session-detail",c],queryFn:async()=>{if(!c)return null;const o=await x(`/api/db/sessions/${encodeURIComponent(c)}`);if(!o.ok)throw new Error("Failed to load session detail");return o.json()},enabled:!!c}),d=_.useCallback((o,y)=>{l(w=>({...w,[o]:y,page:o==="page"?y:1}))},[]),v=_.useCallback(async(o,y)=>{o.stopPropagation(),window.confirm("Delete this session from history? This cannot be undone.")&&(await x(`/api/db/sessions/${encodeURIComponent(y)}`,{method:"DELETE"}),e.invalidateQueries({queryKey:["db-sessions"]}))},[e]),h=i?.sessions??[],j=i?.total??0,n=Math.ceil(j/N);return t.jsxs("div",{className:a.container,"data-testid":"history-view",children:[t.jsxs("div",{className:a.filters,children:[t.jsx(C,{value:s.query,onChange:o=>d("query",o),placeholder:"Search prompts..."}),t.jsxs("div",{className:a.filterGroup,children:[t.jsx("span",{className:a.filterLabel,children:"Project"}),t.jsx(f,{value:s.project,onChange:o=>d("project",o),options:[{value:"",label:"All"},...u?.map(o=>({value:o.project_path,label:o.project_name}))??[]]})]}),t.jsxs("div",{className:a.filterGroup,children:[t.jsx("span",{className:a.filterLabel,children:"Status"}),t.jsx(f,{value:s.status,onChange:o=>d("status",o),options:[{value:"",label:"All"},{value:"idle",label:"Idle"},{value:"working",label:"Working"},{value:"waiting",label:"Waiting"},{value:"ended",label:"Ended"},{value:"archived",label:"Archived"}]})]}),t.jsxs("div",{className:a.filterGroup,children:[t.jsx("span",{className:a.filterLabel,children:"From"}),t.jsx("input",{type:"date",className:a.filterInput,value:s.dateFrom,onChange:o=>d("dateFrom",o.target.value)})]}),t.jsxs("div",{className:a.filterGroup,children:[t.jsx("span",{className:a.filterLabel,children:"To"}),t.jsx("input",{type:"date",className:a.filterInput,value:s.dateTo,onChange:o=>d("dateTo",o.target.value)})]}),t.jsxs("div",{className:a.filterGroup,children:[t.jsx("span",{className:a.filterLabel,children:"Sort"}),t.jsx(f,{value:s.sortBy,onChange:o=>d("sortBy",o),options:[{value:"date",label:"Date"},{value:"duration",label:"Activity"},{value:"prompts",label:"Prompts"},{value:"tools",label:"Tools"}]}),t.jsx("button",{className:a.sortToggle,onClick:()=>d("sortDir",s.sortDir==="desc"?"asc":"desc"),children:s.sortDir.toUpperCase()})]})]}),t.jsxs("div",{className:a.results,children:[m&&t.jsx("div",{className:a.emptyState,children:"Loading..."}),!m&&h.length===0&&t.jsx("div",{className:a.emptyState,children:"No sessions found"}),h.map(o=>t.jsx(xt,{session:o,onClick:()=>r(o.id),onDelete:y=>v(y,o.id)},o.id))]}),n>1&&t.jsx(gt,{currentPage:s.page,totalPages:n,onPageChange:o=>d("page",o)}),c&&p&&t.jsx(bt,{detail:p,onClose:()=>r(null)})]})}function xt({session:e,onClick:s,onDelete:l}){const c=e.ended_at&&e.started_at?g(e.ended_at-e.started_at):e.started_at?g(Date.now()-e.started_at):"--";return t.jsxs("div",{className:a.row,onClick:s,children:[t.jsx("span",{className:a.rowTitle,children:e.title||e.project_name||e.id}),t.jsx("span",{className:a.rowProject,children:e.project_name}),t.jsx("span",{className:a.rowDate,children:ht(e.started_at)}),t.jsx("span",{className:a.rowDuration,children:c}),t.jsx("span",{className:a.rowStatus,"data-status":e.status,children:e.status.toUpperCase()}),t.jsxs("span",{className:a.rowMeta,children:[e.total_prompts," prompts"]}),t.jsxs("span",{className:a.rowMeta,children:[e.total_tool_calls," tools"]}),t.jsx("button",{className:a.deleteBtn,onClick:l,title:"Delete session","aria-label":"Delete session",children:"x"})]})}function gt({currentPage:e,totalPages:s,onPageChange:l}){const c=[];for(let i=1;i<=s;i++)(i===1||i===s||i>=e-2&&i<=e+2)&&c.push(i);const r=[];let u=0;for(const i of c)typeof i=="number"&&(u&&i-u>1&&r.push("ellipsis"),r.push(i),u=i);return t.jsxs("div",{className:a.pagination,children:[t.jsx("button",{className:a.pageBtn,disabled:e<=1,onClick:()=>l(e-1),children:"Prev"}),r.map((i,m)=>i==="ellipsis"?t.jsx("span",{className:a.pageEllipsis,children:"..."},`e-${m}`):t.jsx("button",{className:`${a.pageBtn} ${i===e?a.pageBtnActive:""}`,onClick:()=>l(i),children:i},i)),t.jsx("button",{className:a.pageBtn,disabled:e>=s,onClick:()=>l(e+1),children:"Next"})]})}function ft({text:e}){const[s,l]=_.useState(!1),c=r=>{r.stopPropagation(),navigator.clipboard.writeText(e).then(()=>{l(!0),setTimeout(()=>l(!1),1500)})};return t.jsx("button",{className:a.copyBtn,onClick:c,"aria-label":"Copy to clipboard",title:"Copy to clipboard",children:s?"✓":"⎘"})}function bt({detail:e,onClose:s}){const[l,c]=_.useState("conversation"),{session:r,prompts:u,responses:i,tool_calls:m,events:p}=e,d=[...u.map(n=>({type:"prompt",timestamp:n.timestamp,text:n.text})),...i.map(n=>({type:"response",timestamp:n.timestamp,text:n.text_excerpt}))].sort((n,o)=>n.timestamp-o.timestamp),v=[...m.map(n=>({kind:"tool",label:n.tool_name,detail:n.tool_input_summary,timestamp:n.timestamp})),...p.map(n=>({kind:"event",label:n.event_type,detail:n.detail,timestamp:n.timestamp}))].sort((n,o)=>o.timestamp-n.timestamp),h=r.ended_at&&r.started_at?g(r.ended_at-r.started_at):r.started_at?g(Date.now()-r.started_at):"--",j=[{id:"conversation",label:`Conversation (${d.length})`,content:t.jsxs("div",{className:a.detailBody,children:[d.length===0&&t.jsx("div",{className:a.emptyState,children:"No conversation recorded"}),d.map((n,o)=>t.jsxs("div",{className:`${a.convoEntry} ${n.type==="prompt"?a.convoPrompt:a.convoResponse}`,children:[t.jsxs("div",{className:a.convoEntryHeader,children:[t.jsx("div",{className:a.convoTime,children:T(n.timestamp)}),t.jsx(ft,{text:n.text})]}),t.jsx("div",{className:a.convoText,children:n.text})]},o))]})},{id:"activity",label:`Activity (${v.length})`,content:t.jsxs("div",{className:a.detailBody,children:[v.length===0&&t.jsx("div",{className:a.emptyState,children:"No activity recorded"}),v.map((n,o)=>t.jsxs("div",{className:a.activityEntry,children:[t.jsx("span",{className:a.activityTime,children:T(n.timestamp)}),t.jsx("span",{className:`${a.activityBadge} ${n.kind==="tool"?a.activityBadgeTool:a.activityBadgeEvent}`,children:n.label}),t.jsx("span",{className:a.activityDetail,children:n.detail})]},o))]})}];return t.jsx("div",{className:a.detailOverlay,onClick:s,children:t.jsxs("div",{className:a.detailCard,onClick:n=>n.stopPropagation(),children:[t.jsxs("div",{className:a.detailHeader,children:[t.jsxs("div",{children:[t.jsx("h2",{className:a.detailTitle,children:r.project_name||r.id}),t.jsxs("div",{className:a.detailMeta,children:[t.jsxs("span",{children:["Status: ",r.status.toUpperCase()]}),t.jsxs("span",{children:["Model: ",r.model||"--"]}),t.jsxs("span",{children:["Duration: ",h]}),t.jsxs("span",{children:[r.total_prompts," prompts / ",r.total_tool_calls," tools"]})]})]}),t.jsx("button",{className:a.detailCloseBtn,onClick:s,"aria-label":"Close",children:"x"})]}),t.jsx(S,{tabs:j,activeTab:l,onTabChange:c,containerClassName:a.detailTabs,panelClassName:a.detailTabPanel})]})})}export{wt as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._container_1j3ds_5{display:flex;flex-direction:column;height:100%;padding:var(--layout-pad, 24px);gap:16px}._filters_1j3ds_15{display:flex;flex-wrap:wrap;gap:8px;align-items:center}._filterGroup_1j3ds_22{display:flex;align-items:center;gap:4px}._filterLabel_1j3ds_28{font-size:.7rem;color:var(--text-dim, #555577);text-transform:uppercase;letter-spacing:.04em}._filterSelect_1j3ds_35,._filterInput_1j3ds_36{padding:6px 10px;background:var(--bg-card, #12122a);border:1px solid var(--border-accent, rgba(0, 229, 255, .15));border-radius:4px;color:var(--text-primary, #e0e0ff);font-size:.8rem;font-family:var(--font-mono, monospace);outline:none;transition:border-color .2s,box-shadow .2s}._filterSelect_1j3ds_35:focus,._filterInput_1j3ds_36:focus{border-color:var(--accent-cyan, #00e5ff);box-shadow:0 0 8px #00e5ff4d}._sortToggle_1j3ds_54{padding:6px 10px;background:transparent;border:1px solid var(--border-subtle, rgba(255, 255, 255, .06));border-radius:4px;color:var(--text-secondary, #8888aa);font-size:.75rem;font-family:var(--font-mono, monospace);cursor:pointer}._sortToggle_1j3ds_54:hover{color:var(--accent-cyan, #00e5ff);border-color:var(--accent-cyan, #00e5ff)}._results_1j3ds_72{flex:1;overflow-y:auto;display:flex;flex-direction:column;gap:2px}._emptyState_1j3ds_80{display:flex;align-items:center;justify-content:center;padding:48px 16px;color:var(--text-dim, #555577);font-size:.9rem}._row_1j3ds_89{display:grid;grid-template-columns:1fr 120px 150px 80px 80px 70px 70px 32px;align-items:center;gap:8px;padding:10px 12px;background:var(--bg-card, #12122a);border:1px solid var(--border-subtle, rgba(255, 255, 255, .06));border-radius:6px;cursor:pointer;transition:border-color .15s,background .15s}._row_1j3ds_89:hover{border-color:var(--border-accent, rgba(0, 229, 255, .15));background:var(--bg-card-hover, #1a1a3a)}._rowTitle_1j3ds_107{font-size:.85rem;color:var(--text-primary, #e0e0ff);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._rowProject_1j3ds_115{font-size:.75rem;color:var(--accent-cyan, #00e5ff);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._rowDate_1j3ds_123,._rowDuration_1j3ds_129{font-size:.75rem;color:var(--text-secondary, #8888aa);white-space:nowrap}._rowStatus_1j3ds_135{font-size:.7rem;font-weight:600;text-transform:uppercase;padding:2px 6px;border-radius:3px;text-align:center}._rowStatus_1j3ds_135[data-status=idle]{color:var(--accent-green, #00ff88);background:#00ff881a}._rowStatus_1j3ds_135[data-status=working]{color:var(--accent-orange, #ff9100);background:#ff91001a}._rowStatus_1j3ds_135[data-status=ended]{color:var(--accent-red, #ff3355);background:#ff33551a}._rowStatus_1j3ds_135[data-status=waiting]{color:var(--accent-cyan, #00e5ff);background:#00e5ff1a}._rowStatus_1j3ds_135[data-status=approval]{color:#fc0;background:#ffcc001a}._rowMeta_1j3ds_165{font-size:.7rem;color:var(--text-dim, #555577);text-align:center}._deleteBtn_1j3ds_171{background:none;border:none;color:var(--text-dim, #555577);font-size:1rem;cursor:pointer;padding:2px 4px;border-radius:4px;line-height:1}._deleteBtn_1j3ds_171:hover{color:var(--accent-red, #ff3355);background:#ff33551a}._pagination_1j3ds_189{display:flex;align-items:center;justify-content:center;gap:4px;padding:8px 0}._pageBtn_1j3ds_197{padding:4px 10px;background:transparent;border:1px solid var(--border-subtle, rgba(255, 255, 255, .06));border-radius:4px;color:var(--text-secondary, #8888aa);font-size:.75rem;font-family:var(--font-mono, monospace);cursor:pointer}._pageBtn_1j3ds_197:hover:not(:disabled){border-color:var(--accent-cyan, #00e5ff);color:var(--accent-cyan, #00e5ff)}._pageBtn_1j3ds_197:disabled{opacity:.3;cursor:default}._pageBtnActive_1j3ds_218{background:var(--bg-accent, rgba(0, 229, 255, .1));border-color:var(--accent-cyan, #00e5ff);color:var(--accent-cyan, #00e5ff)}._pageEllipsis_1j3ds_224{color:var(--text-dim, #555577);padding:0 4px}._detailOverlay_1j3ds_231{position:fixed;inset:0;background:#000000b3;display:flex;align-items:center;justify-content:center;z-index:8000}._detailCard_1j3ds_241{background:var(--bg-card, #12122a);border:1px solid var(--border-accent, rgba(0, 229, 255, .15));border-radius:12px;padding:24px;max-width:900px;width:90%;max-height:80vh;display:flex;flex-direction:column;gap:16px;overflow:hidden}._detailTabs_1j3ds_255{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}._detailTabPanel_1j3ds_263{flex:1;min-height:0;overflow:hidden;display:flex;flex-direction:column}._detailHeader_1j3ds_271{display:flex;align-items:center;justify-content:space-between;gap:12px}._detailTitle_1j3ds_278{font-size:1.1rem;color:var(--accent-cyan, #00e5ff);margin:0}._detailMeta_1j3ds_284{display:flex;gap:16px;font-size:.75rem;color:var(--text-secondary, #8888aa)}._detailCloseBtn_1j3ds_291{background:none;border:none;color:var(--text-secondary, #8888aa);font-size:1.2rem;cursor:pointer;padding:4px 8px}._detailCloseBtn_1j3ds_291:hover{color:var(--text-primary, #e0e0ff)}._detailBody_1j3ds_304{flex:1;overflow-y:auto}._convoEntry_1j3ds_309{padding:8px 12px;border-left:3px solid transparent;margin-bottom:4px;border-radius:0 4px 4px 0;position:relative}._convoEntryHeader_1j3ds_317{display:flex;align-items:center;justify-content:space-between;gap:8px}._copyBtn_1j3ds_324{background:none;border:1px solid transparent;color:var(--text-dim, #555577);font-size:.8rem;cursor:pointer;padding:2px 6px;border-radius:4px;line-height:1;opacity:0;transition:opacity .15s,color .15s,border-color .15s}._convoEntry_1j3ds_309:hover ._copyBtn_1j3ds_324{opacity:1}._copyBtn_1j3ds_324:hover{color:var(--accent-cyan, #00e5ff);border-color:var(--accent-cyan, #00e5ff)}._convoPrompt_1j3ds_346{border-left-color:var(--accent-cyan, #00e5ff);background:#00e5ff08}._convoResponse_1j3ds_351{border-left-color:var(--accent-green, #00ff88);background:#00ff8808}._convoTime_1j3ds_356{font-size:.7rem;color:var(--text-dim, #555577);margin-bottom:2px}._convoText_1j3ds_362{font-size:.8rem;color:var(--text-primary, #e0e0ff);white-space:pre-wrap;word-break:break-word}._activityEntry_1j3ds_369{display:flex;gap:8px;padding:4px 0;font-size:.75rem;align-items:baseline}._activityTime_1j3ds_377{color:var(--text-dim, #555577);white-space:nowrap;flex-shrink:0}._activityBadge_1j3ds_383{padding:1px 6px;border-radius:3px;font-size:.7rem;font-weight:600;white-space:nowrap;flex-shrink:0}._activityBadgeTool_1j3ds_392{color:var(--accent-orange, #ff9100);background:#ff91001a}._activityBadgeEvent_1j3ds_397{color:var(--accent-purple, #aa66ff);background:#aa66ff1a}._activityDetail_1j3ds_402{color:var(--text-secondary, #8888aa);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}@media(max-width:768px){._row_1j3ds_89{grid-template-columns:1fr 80px 32px}._rowProject_1j3ds_115,._rowDate_1j3ds_123,._rowDuration_1j3ds_129,._rowMeta_1j3ds_165:nth-child(6),._rowMeta_1j3ds_165:nth-child(7){display:none}._filters_1j3ds_15{flex-direction:column;align-items:stretch}}
|
package/dist/client/assets/{ProjectBrowserView-5bUQLVrl.js → ProjectBrowserView-CC-VpOqU.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{A as o,j as s,B as e,P as r}from"./index-B7h3JN01.js";function l(){const[t]=o(),a=t.get("path");if(!a)return s.jsx("div",{className:e.standalone,children:s.jsxs("div",{className:e.standaloneEmpty,children:["No project path specified. Use ",s.jsx("code",{children:"?path=/your/project"})," to open a project."]})});const n=a.split("/").filter(Boolean).pop()||a;return s.jsxs("div",{className:e.standalone,children:[s.jsxs("div",{className:e.standaloneHeader,children:[s.jsx("span",{className:e.standaloneTitle,children:n}),s.jsx("span",{className:e.standalonePath,children:a})]}),s.jsx("div",{className:e.standaloneContent,children:s.jsx(r,{projectPath:a})})]})}export{l as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{w as x,x as $,r as d,y as S,j as e,z as a,S as D}from"./index-B7h3JN01.js";const B="_controls_uyjqd_6",E="_title_uyjqd_11",M="_stats_uyjqd_13",T="_statsSep_uyjqd_17",z="_content_uyjqd_19",H="_viewGroup_uyjqd_21",P="_groupHeader_uyjqd_22",G="_sessionName_uyjqd_23",R="_label_uyjqd_24",U="_sid_uyjqd_25",K="_itemCount_uyjqd_26",L="_table_uyjqd_28",O="_pos_uyjqd_34",Q="_text_uyjqd_36",V="_date_uyjqd_37",W="_deleteBtn_uyjqd_38",t={controls:B,title:E,stats:M,statsSep:T,content:z,viewGroup:H,groupHeader:P,sessionName:G,label:R,sid:U,itemCount:K,table:L,pos:O,text:Q,date:V,deleteBtn:W};let F=Date.now();function Y(){return F++}function J(o){return new Date(o).toLocaleTimeString("en-US",{hour12:!1})}function Z(){const o=x(s=>s.queues),v=x(s=>s.add),w=x(s=>s.remove),b=x(s=>s.moveToSession),h=$(s=>s.sessions),[l,A]=d.useState(""),[m,g]=d.useState(""),[i,f]=d.useState(null),p=Array.from(new Set([...o.keys(),...h.keys()])).filter(s=>{const n=o.get(s);return n&&n.length>0}),q=Array.from(o.values()).reduce((s,n)=>s+n.length,0),N=d.useCallback(()=>{const s=m.trim();if(!s||!l)return;const n=o.get(l)??[],c={id:Y(),sessionId:l,text:s,position:n.length,createdAt:Date.now()};v(l,c),g(""),S("Prompt added to queue","info",2e3)},[m,l,o,v]),C=d.useCallback(s=>{i&&(b([i.itemId],i.fromSessionId,s),f(null),S("Prompt moved","info",2e3))},[i,b]),j=Array.from(h.entries()),k=d.useMemo(()=>[{value:"",label:"Select session..."},...j.map(([s,n])=>({value:s,label:`${n.projectName||s.slice(0,8)}${n.title?` — ${n.title}`:""}`}))],[j]);return e.jsxs("div",{"data-testid":"queue-view",style:{height:"100%",overflow:"auto"},children:[e.jsx("div",{className:t.controls,children:e.jsx("h2",{className:t.title,children:"PROMPT QUEUE"})}),e.jsxs("div",{className:t.stats,children:[e.jsxs("span",{children:[q," queued prompt",q!==1?"s":""]}),e.jsx("span",{className:t.statsSep,children:"|"}),e.jsxs("span",{children:[p.length," session",p.length!==1?"s":""]})]}),e.jsx("div",{style:{padding:"0 24px 16px"},children:e.jsxs("div",{className:a.queueCompose,children:[e.jsx(D,{value:l,onChange:A,options:k,placeholder:"Select session...",style:{minWidth:"180px",fontSize:"11px"}}),e.jsx("textarea",{className:a.queueTextarea,placeholder:"Add a prompt to the queue...",rows:2,value:m,onChange:s=>g(s.target.value),onKeyDown:s=>{s.key==="Enter"&&(s.metaKey||s.ctrlKey)&&(s.preventDefault(),N())}}),e.jsx("button",{className:`${a.toolbarBtn} ${a.queueAddBtn}`,onClick:N,disabled:!m.trim()||!l,children:"ADD"})]})}),e.jsx("div",{className:t.content,children:p.length===0?e.jsx("div",{style:{textAlign:"center",padding:"40px 0",color:"var(--text-dim)",fontSize:"13px"},children:"No prompts in queue. Add prompts from session detail panels or above."}):p.map(s=>{const n=o.get(s)??[],c=h.get(s);return e.jsxs("div",{className:t.viewGroup,children:[e.jsxs("div",{className:t.groupHeader,children:[e.jsx("span",{className:t.sessionName,children:c?.projectName||"Unknown"}),c?.label&&e.jsx("span",{className:t.label,children:c.label}),e.jsx("span",{className:t.sid,children:s.slice(0,8)}),e.jsxs("span",{className:t.itemCount,children:[n.length," item",n.length!==1?"s":""]})]}),e.jsxs("table",{className:t.table,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:t.pos,children:"#"}),e.jsx("th",{children:"Prompt"}),e.jsx("th",{children:"Added"}),e.jsx("th",{children:"Actions"})]})}),e.jsx("tbody",{children:n.map((r,I)=>e.jsxs("tr",{children:[e.jsx("td",{className:t.pos,children:I+1}),e.jsx("td",{className:t.text,children:r.text}),e.jsx("td",{className:t.date,children:J(r.createdAt)}),e.jsxs("td",{children:[e.jsxs("div",{style:{display:"flex",gap:"4px"},children:[e.jsx("button",{className:`${a.queueActionBtn} ${a.queueMove}`,onClick:()=>f(i?.itemId===r.id?null:{itemId:r.id,fromSessionId:s}),children:"MOVE"}),e.jsx("button",{className:`${a.queueActionBtn} ${a.queueDelete} ${t.deleteBtn}`,onClick:()=>w(s,r.id),children:"DEL"})]}),i?.itemId===r.id&&e.jsx("div",{style:{position:"absolute",zIndex:10,background:"var(--surface-card, #12122a)",border:"1px solid var(--border-subtle, rgba(255,255,255,0.08))",borderRadius:"4px",padding:"4px",maxHeight:"160px",overflowY:"auto",minWidth:"180px"},children:j.filter(([u])=>u!==s).map(([u,_])=>e.jsxs("button",{onClick:()=>C(u),style:{display:"block",width:"100%",padding:"4px 8px",background:"transparent",border:"none",color:"var(--text-primary)",fontFamily:"var(--font-mono)",fontSize:"10px",textAlign:"left",cursor:"pointer",borderRadius:"3px"},onMouseEnter:y=>{y.target.style.background="rgba(0,229,255,0.1)"},onMouseLeave:y=>{y.target.style.background="transparent"},children:[_.projectName||u.slice(0,8),_.title?` — ${_.title}`:""]},u))})]})]},r.id))})]})]},s)})})]})}export{Z as default};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{r as l,b as _,j as d,S as O}from"./index-B7h3JN01.js";import{u as D}from"./useQuery-D3equUmE.js";import{r as z,c as M,a as F,S as I,b as B,u as W,s as K,d as V,e as q,f as H,g as R,h as $,i as N,j as U,k as E,l as J,m as x,R as G,B as X,C as Y,X as Q,Y as Z,T as ee,n as P}from"./Charts.module-BVWDL-nq.js";import"./with-selector-bHDjn-jq.js";function j(){return j=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},j.apply(null,arguments)}function k(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function te(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?k(Object(r),!0).forEach(function(n){re(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):k(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function re(e,t,r){return(t=ne(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ne(e){var t=ae(e,"string");return typeof t=="symbol"?t:t+""}function ae(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var h=32,oe={align:"center",iconSize:14,inactiveColor:"#ccc",layout:"horizontal",verticalAlign:"middle"};function ie(e){var{data:t,iconType:r,inactiveColor:n}=e,a=h/2,i=h/6,g=h/3,s=t.inactive?n:t.color,u=r??t.type;if(u==="none")return null;if(u==="plainline"){var f;return l.createElement("line",{strokeWidth:4,fill:"none",stroke:s,strokeDasharray:(f=t.payload)===null||f===void 0?void 0:f.strokeDasharray,x1:0,y1:a,x2:h,y2:a,className:"recharts-legend-icon"})}if(u==="line")return l.createElement("path",{strokeWidth:4,fill:"none",stroke:s,d:"M0,".concat(a,"h").concat(g,`
|
|
2
|
+
A`).concat(i,",").concat(i,",0,1,1,").concat(2*g,",").concat(a,`
|
|
3
|
+
H`).concat(h,"M").concat(2*g,",").concat(a,`
|
|
4
|
+
A`).concat(i,",").concat(i,",0,1,1,").concat(g,",").concat(a),className:"recharts-legend-icon"});if(u==="rect")return l.createElement("path",{stroke:"none",fill:s,d:"M0,".concat(h/8,"h").concat(h,"v").concat(h*3/4,"h").concat(-h,"z"),className:"recharts-legend-icon"});if(l.isValidElement(t.legendIcon)){var c=te({},t);return delete c.legendIcon,l.cloneElement(t.legendIcon,c)}return l.createElement(B,{fill:s,cx:a,cy:a,size:h,sizeType:"diameter",type:u})}function le(e){var{payload:t,iconSize:r,layout:n,formatter:a,inactiveColor:i,iconType:g}=e,s={x:0,y:0,width:h,height:h},u={display:n==="horizontal"?"inline-block":"block",marginRight:10},f={display:"inline-block",verticalAlign:"middle",marginRight:4};return t.map((c,m)=>{var v=c.formatter||a,p=M({"recharts-legend-item":!0,["legend-item-".concat(m)]:!0,inactive:c.inactive});if(c.type==="none")return null;var o=c.inactive?i:c.color,b=v?v(c.value,c,m):c.value;return l.createElement("li",j({className:p,style:u,key:"legend-item-".concat(m)},F(e,c,m)),l.createElement(I,{width:r,height:r,viewBox:s,style:f,"aria-label":"".concat(b," legend icon")},l.createElement(ie,{data:c,iconType:g,inactiveColor:i})),l.createElement("span",{className:"recharts-legend-item-text",style:{color:o}},b))})}var ce=e=>{var t=z(e,oe),{payload:r,layout:n,align:a}=t;if(!r||!r.length)return null;var i={padding:0,margin:0,textAlign:n==="horizontal"?a:"left"};return l.createElement("ul",{className:"recharts-default-legend",style:i},l.createElement(le,j({},t,{payload:r})))};function se(){return W(K)}var ue=["contextPayload"];function w(){return w=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},w.apply(null,arguments)}function T(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function y(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?T(Object(r),!0).forEach(function(n){de(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):T(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function de(e,t,r){return(t=fe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function fe(e){var t=ge(e,"string");return typeof t=="symbol"?t:t+""}function ge(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function me(e,t){if(e==null)return{};var r,n,a=he(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function he(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function pe(e){return e.value}function ve(e){var{contextPayload:t}=e,r=me(e,ue),n=J(t,e.payloadUniqBy,pe),a=y(y({},r),{},{payload:n});return l.isValidElement(e.content)?l.cloneElement(e.content,a):typeof e.content=="function"?l.createElement(e.content,a):l.createElement(ce,a)}function ye(e,t,r,n,a,i){var{layout:g,align:s,verticalAlign:u}=t,f,c;return(!e||(e.left===void 0||e.left===null)&&(e.right===void 0||e.right===null))&&(s==="center"&&g==="vertical"?f={left:((n||0)-i.width)/2}:f=s==="right"?{right:r&&r.right||0}:{left:r&&r.left||0}),(!e||(e.top===void 0||e.top===null)&&(e.bottom===void 0||e.bottom===null))&&(u==="middle"?c={top:((a||0)-i.height)/2}:c=u==="bottom"?{bottom:r&&r.bottom||0}:{top:r&&r.top||0}),y(y({},f),c)}function be(e){var t=N();return l.useEffect(()=>{t(U(e))},[t,e]),null}function je(e){var t=N();return l.useEffect(()=>(t(E(e)),()=>{t(E({width:0,height:0}))}),[t,e]),null}function xe(e,t,r,n){return e==="vertical"&&t!=null?{height:t}:e==="horizontal"?{width:r||n}:null}var Pe={align:"center",iconSize:14,inactiveColor:"#ccc",itemSorter:"value",layout:"horizontal",verticalAlign:"bottom"};function A(e){var t=z(e,Pe),r=se(),n=V(),a=q(),{width:i,height:g,wrapperStyle:s,portal:u}=t,[f,c]=H([r]),m=R(),v=$();if(m==null||v==null)return null;var p=m-(a?.left||0)-(a?.right||0),o=xe(t.layout,g,i,p),b=u?s:y(y({position:"absolute",width:o?.width||i||"auto",height:o?.height||g||"auto"},ye(s,t,a,m,v,f)),s),S=u??n;if(S==null||r==null)return null;var L=l.createElement("div",{className:"recharts-legend-wrapper",style:b,ref:c},l.createElement(be,{layout:t.layout,align:t.align,verticalAlign:t.verticalAlign,itemSorter:t.itemSorter}),!u&&l.createElement(je,{width:f.width,height:f.height}),l.createElement(ve,w({},t,o,{margin:a,chartWidth:m,chartHeight:v,contextPayload:r})));return _.createPortal(L,S)}A.displayName="Legend";function C(){const e=getComputedStyle(document.documentElement);return{cyan:e.getPropertyValue("--accent-cyan").trim()||"#00e5ff",green:e.getPropertyValue("--accent-green").trim()||"#00ff88",orange:e.getPropertyValue("--accent-orange").trim()||"#ff9800",textDim:e.getPropertyValue("--text-dim").trim()||"#8892b0"}}const we=e=>{const t=new MutationObserver(e);return t.observe(document.body,{attributes:!0,attributeFilter:["data-theme"]}),()=>t.disconnect()};function Se(){return l.useSyncExternalStore(we,C,C)}function Oe(){return new Date(Date.now()-2592e6).toISOString().split("T")[0]}function De(){return new Date().toISOString().split("T")[0]}function Ee(e,t){const r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];if(t==="week"){const a=e.match(/^(\d{4})-W(\d{1,2})$/);if(a){const i=parseInt(a[1],10),g=parseInt(a[2],10),s=new Date(i,0,1),u=(g-1)*7-s.getDay()+1,f=new Date(i,0,1+u);return r[f.getMonth()]+" "+f.getDate()}}if(t==="hour"){const a=e.match(/^(\d{4}-\d{2}-\d{2})\s+(\d{2}):(\d{2})$/);if(a){const i=new Date(a[1]+"T"+a[2]+":"+a[3]+":00");if(!isNaN(i.getTime()))return r[i.getMonth()]+" "+i.getDate()+" "+i.getHours().toString().padStart(2,"0")+":00"}}const n=new Date(e+(e.includes("T")?"":"T00:00:00"));return isNaN(n.getTime())?e:r[n.getMonth()]+" "+n.getDate()}function Ne(){const e=Se(),[t,r]=l.useState("day"),[n,a]=l.useState(""),[i,g]=l.useState(Oe),[s,u]=l.useState(De),{data:f}=D({queryKey:["timeline-projects"],queryFn:async()=>{const o=await fetch("/api/db/projects");return o.ok?o.json():[]}}),c=l.useMemo(()=>{const o=new URLSearchParams;return o.set("granularity",t),n&&o.set("project",n),i&&o.set("dateFrom",String(new Date(i).getTime())),s&&o.set("dateTo",String(new Date(s+"T23:59:59").getTime())),o.toString()},[t,n,i,s]),{data:m,isLoading:v}=D({queryKey:["timeline",c],queryFn:async()=>{const o=await fetch(`/api/db/analytics/timeline?${c}`);return o.ok?o.json():{buckets:[]}}}),p=l.useMemo(()=>m?.buckets?m.buckets.map(o=>({...o,label:Ee(o.period,t)})):[],[m,t]);return d.jsxs("div",{className:x.timelineView,"data-testid":"timeline-view",children:[d.jsxs("div",{className:x.timelineControls,children:[d.jsx(O,{value:t,onChange:o=>r(o),options:[{value:"hour",label:"Hourly"},{value:"day",label:"Daily"},{value:"week",label:"Weekly"}]}),d.jsx(O,{value:n,onChange:a,options:[{value:"",label:"All Projects"},...f?.map(o=>({value:o.project_path,label:o.project_name}))??[]]}),d.jsx("input",{type:"date",value:i,onChange:o=>g(o.target.value)}),d.jsx("input",{type:"date",value:s,onChange:o=>u(o.target.value)})]}),d.jsx("div",{className:x.timelineChart,children:v?d.jsx("div",{style:{color:"var(--text-dim)",padding:"40px",textAlign:"center"},children:"Loading..."}):p.length===0?d.jsx("div",{style:{color:"var(--text-dim)",padding:"40px",textAlign:"center"},children:"No data for this period"}):d.jsx(G,{width:"100%",height:350,children:d.jsxs(X,{data:p,margin:{top:10,right:10,left:0,bottom:20},children:[d.jsx(Y,{strokeDasharray:"3 3",stroke:"var(--border-subtle)"}),d.jsx(Q,{dataKey:"label",stroke:e.textDim,fontSize:9,interval:p.length>15?Math.ceil(p.length/15):0,angle:p.length>10||t==="hour"?-40:0,textAnchor:p.length>10||t==="hour"?"end":"middle",height:t==="hour"?60:40}),d.jsx(Z,{stroke:e.textDim,fontSize:10}),d.jsx(ee,{contentStyle:{background:"var(--bg-card, #12122a)",border:"1px solid var(--accent-cyan, #00e5ff)",borderRadius:"4px",fontSize:"11px",color:"var(--text-primary, #e0e0ff)"}}),d.jsx(A,{wrapperStyle:{fontSize:"10px",color:e.textDim}}),d.jsx(P,{dataKey:"session_count",name:"Sessions",fill:e.cyan,opacity:.85,radius:[2,2,0,0]}),d.jsx(P,{dataKey:"prompt_count",name:"Prompts",fill:e.green,opacity:.85,radius:[2,2,0,0]}),d.jsx(P,{dataKey:"tool_call_count",name:"Tool Calls",fill:e.orange,opacity:.85,radius:[2,2,0,0]})]})})})]})}export{Ne as default};
|