ai-agent-session-center 2.4.7 → 2.5.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.
@@ -1 +1 @@
1
- import{j as e,r as y,a as P}from"./index-BXcolqev.js";import{u}from"./useQuery-C3bdk-O1.js";import{m as n,R as j,B as b,C as v,X as S,Y as _,T as C,n as T,o as $}from"./Charts.module-Dcvmbd12.js";import"./with-selector-DGgNkBL1.js";function g(){const t=getComputedStyle(document.documentElement);return{cyan:t.getPropertyValue("--accent-cyan").trim()||"#00e5ff",green:t.getPropertyValue("--accent-green").trim()||"#00ff88",orange:t.getPropertyValue("--accent-orange").trim()||"#ff9100",textDim:t.getPropertyValue("--text-dim").trim()||"#8888aa",textPrimary:t.getPropertyValue("--text-primary").trim()||"#e0e0ff",bgCard:t.getPropertyValue("--bg-card").trim()||"#12122a",borderSubtle:t.getPropertyValue("--border-subtle").trim()||"rgba(255,255,255,0.04)",bgPrimary:t.getPropertyValue("--bg-primary").trim()||"#0a0a1a"}}const N=t=>{const a=new MutationObserver(t);return a.observe(document.body,{attributes:!0,attributeFilter:["data-theme"]}),()=>a.disconnect()};function x(){return y.useSyncExternalStore(N,g,g)}async function m(t){const a=await P(t);if(!a.ok)throw new Error(`API error: ${a.status}`);return a.json()}function l(t){return t>=1e6?(t/1e6).toFixed(1)+"M":t>=1e3?(t/1e3).toFixed(1)+"K":String(t)}function w(t,a,r,i){const o=a===0?0:Math.max(0,Math.min(1,t/a));return`color-mix(in srgb, ${i} ${Math.round(o*100)}%, ${r})`}const f=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];function q(){const{data:t}=u({queryKey:["analytics-summary"],queryFn:()=>m("/api/db/analytics/summary"),staleTime:3e4}),{data:a}=u({queryKey:["analytics-tools"],queryFn:()=>m("/api/db/analytics/tools"),staleTime:3e4}),{data:r}=u({queryKey:["analytics-projects"],queryFn:()=>m("/api/db/analytics/projects"),staleTime:3e4}),{data:i}=u({queryKey:["analytics-heatmap"],queryFn:()=>m("/api/db/analytics/heatmap"),staleTime:3e4});return e.jsxs("div",{className:n.analyticsView,"data-testid":"analytics-view",children:[e.jsx(A,{summary:t??null}),e.jsxs("div",{className:n.analyticsGrid,children:[e.jsxs("div",{className:n.analyticsCard,children:[e.jsx("h4",{children:"Tool Usage"}),e.jsx(k,{data:a??[]})]}),e.jsxs("div",{className:n.analyticsCard,children:[e.jsx("h4",{children:"Active Projects"}),e.jsx(D,{data:r??[]})]}),e.jsxs("div",{className:n.analyticsCard,style:{gridColumn:"1 / -1"},children:[e.jsx("h4",{children:"Activity Heatmap"}),e.jsx(M,{data:i??[]})]})]})]})}function A({summary:t}){const a=[{label:"Total Sessions",value:l(t?.total_sessions??0),detail:"all time"},{label:"Total Prompts",value:l(t?.total_prompts??0),detail:"all time"},{label:"Total Tool Calls",value:l(t?.total_tool_calls??0),detail:"all time"},{label:"Active Sessions",value:l(t?.active_sessions??0),detail:"currently running"},{label:"Most Used Tool",value:t?.most_used_tool?.tool_name??"N/A",detail:t?.most_used_tool?l(t.most_used_tool.count)+" calls":""},{label:"Busiest Project",value:t?.busiest_project?.name??"N/A",detail:t?.busiest_project?l(t.busiest_project.count)+" sessions":""}];return e.jsx("div",{className:n.analyticsSummary,children:a.map(r=>e.jsxs("div",{className:n.summaryStat,children:[e.jsx("div",{className:n.statLabel,children:r.label}),e.jsx("div",{className:n.statValue,children:r.value}),e.jsx("div",{className:n.statDetail,children:r.detail})]},r.label))})}function k({data:t}){const a=x(),r=t.slice(0,15);return r.length===0?e.jsx(p,{message:"No tool data"}):e.jsx(j,{width:"100%",height:Math.max(200,r.length*28),children:e.jsxs(b,{data:r,layout:"vertical",margin:{top:4,right:40,bottom:4,left:100},children:[e.jsx(v,{strokeDasharray:"3 3",stroke:a.borderSubtle}),e.jsx(S,{type:"number",tick:{fill:a.textDim,fontSize:10}}),e.jsx(_,{type:"category",dataKey:"tool_name",tick:{fill:a.textDim,fontSize:10},width:96}),e.jsx(C,{contentStyle:{background:a.bgCard,border:`1px solid ${a.cyan}`,borderRadius:4,fontSize:11,color:a.textPrimary},formatter:((i,o,s)=>[`${l(i)} (${s.payload.percentage}%)`,"Calls"])}),e.jsx(T,{dataKey:"count",radius:[0,4,4,0],children:r.map((i,o)=>e.jsx($,{fill:a.cyan,fillOpacity:.85},o))})]})})}function D({data:t}){const a=x(),r=y.useMemo(()=>[...t].sort((i,o)=>o.session_count-i.session_count).slice(0,15),[t]);return r.length===0?e.jsx(p,{message:"No project data"}):e.jsx(j,{width:"100%",height:Math.max(200,r.length*28),children:e.jsxs(b,{data:r,layout:"vertical",margin:{top:4,right:40,bottom:4,left:120},children:[e.jsx(v,{strokeDasharray:"3 3",stroke:a.borderSubtle}),e.jsx(S,{type:"number",tick:{fill:a.textDim,fontSize:10}}),e.jsx(_,{type:"category",dataKey:"project_name",tick:{fill:a.textDim,fontSize:10},width:116}),e.jsx(C,{contentStyle:{background:a.bgCard,border:`1px solid ${a.cyan}`,borderRadius:4,fontSize:11,color:a.textPrimary},formatter:(i=>[l(i)+" sessions","Sessions"])}),e.jsx(T,{dataKey:"session_count",radius:[0,4,4,0],children:r.map((i,o)=>e.jsx($,{fill:a.green,fillOpacity:.85},o))})]})})}function M({data:t}){const a=x(),{grid:r,maxVal:i}=y.useMemo(()=>{const o=new Map;let s=0;for(const c of t){const d=`${c.day_of_week}-${c.hour}`;o.set(d,c.count),c.count>s&&(s=c.count)}return{grid:o,maxVal:s}},[t]);return t.length===0?e.jsx(p,{message:"No heatmap data"}):e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"40px repeat(24, 14px)",gridTemplateRows:"14px repeat(7, 14px)",gap:"2px",alignItems:"center"},children:[e.jsx("div",{}),Array.from({length:24},(o,s)=>e.jsx("div",{style:{fontSize:"9px",color:a.textDim,textAlign:"center"},children:s},`h-${s}`)),Array.from({length:7},(o,s)=>e.jsxs(y.Fragment,{children:[e.jsx("div",{style:{fontSize:"10px",color:a.textDim,textAlign:"right",paddingRight:"4px"},children:f[s]}),Array.from({length:24},(c,d)=>{const h=r.get(`${s}-${d}`)??0;return e.jsx("div",{className:n.heatmapCell,title:`${f[s]} ${String(d).padStart(2,"0")}:00 - ${h} events`,style:{backgroundColor:w(h,i,a.bgPrimary,a.green)}},`${s}-${d}`)})]},`row-${s}`))]})}function p({message:t}){return e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",minHeight:"120px",color:"var(--text-dim, #555577)",fontSize:"0.85rem"},children:t})}export{q as default};
1
+ import{j as e,r as y,a as P}from"./index-DP88ubkt.js";import{u}from"./useQuery-c1wMNJ4i.js";import{m as n,R as j,B as b,C as v,X as S,Y as _,T as C,n as T,o as $}from"./Charts.module-CzhUhM6q.js";import"./with-selector-Cd7Xmf55.js";function g(){const t=getComputedStyle(document.documentElement);return{cyan:t.getPropertyValue("--accent-cyan").trim()||"#00e5ff",green:t.getPropertyValue("--accent-green").trim()||"#00ff88",orange:t.getPropertyValue("--accent-orange").trim()||"#ff9100",textDim:t.getPropertyValue("--text-dim").trim()||"#8888aa",textPrimary:t.getPropertyValue("--text-primary").trim()||"#e0e0ff",bgCard:t.getPropertyValue("--bg-card").trim()||"#12122a",borderSubtle:t.getPropertyValue("--border-subtle").trim()||"rgba(255,255,255,0.04)",bgPrimary:t.getPropertyValue("--bg-primary").trim()||"#0a0a1a"}}const N=t=>{const a=new MutationObserver(t);return a.observe(document.body,{attributes:!0,attributeFilter:["data-theme"]}),()=>a.disconnect()};function x(){return y.useSyncExternalStore(N,g,g)}async function m(t){const a=await P(t);if(!a.ok)throw new Error(`API error: ${a.status}`);return a.json()}function l(t){return t>=1e6?(t/1e6).toFixed(1)+"M":t>=1e3?(t/1e3).toFixed(1)+"K":String(t)}function w(t,a,r,i){const o=a===0?0:Math.max(0,Math.min(1,t/a));return`color-mix(in srgb, ${i} ${Math.round(o*100)}%, ${r})`}const f=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];function q(){const{data:t}=u({queryKey:["analytics-summary"],queryFn:()=>m("/api/db/analytics/summary"),staleTime:3e4}),{data:a}=u({queryKey:["analytics-tools"],queryFn:()=>m("/api/db/analytics/tools"),staleTime:3e4}),{data:r}=u({queryKey:["analytics-projects"],queryFn:()=>m("/api/db/analytics/projects"),staleTime:3e4}),{data:i}=u({queryKey:["analytics-heatmap"],queryFn:()=>m("/api/db/analytics/heatmap"),staleTime:3e4});return e.jsxs("div",{className:n.analyticsView,"data-testid":"analytics-view",children:[e.jsx(A,{summary:t??null}),e.jsxs("div",{className:n.analyticsGrid,children:[e.jsxs("div",{className:n.analyticsCard,children:[e.jsx("h4",{children:"Tool Usage"}),e.jsx(k,{data:a??[]})]}),e.jsxs("div",{className:n.analyticsCard,children:[e.jsx("h4",{children:"Active Projects"}),e.jsx(D,{data:r??[]})]}),e.jsxs("div",{className:n.analyticsCard,style:{gridColumn:"1 / -1"},children:[e.jsx("h4",{children:"Activity Heatmap"}),e.jsx(M,{data:i??[]})]})]})]})}function A({summary:t}){const a=[{label:"Total Sessions",value:l(t?.total_sessions??0),detail:"all time"},{label:"Total Prompts",value:l(t?.total_prompts??0),detail:"all time"},{label:"Total Tool Calls",value:l(t?.total_tool_calls??0),detail:"all time"},{label:"Active Sessions",value:l(t?.active_sessions??0),detail:"currently running"},{label:"Most Used Tool",value:t?.most_used_tool?.tool_name??"N/A",detail:t?.most_used_tool?l(t.most_used_tool.count)+" calls":""},{label:"Busiest Project",value:t?.busiest_project?.name??"N/A",detail:t?.busiest_project?l(t.busiest_project.count)+" sessions":""}];return e.jsx("div",{className:n.analyticsSummary,children:a.map(r=>e.jsxs("div",{className:n.summaryStat,children:[e.jsx("div",{className:n.statLabel,children:r.label}),e.jsx("div",{className:n.statValue,children:r.value}),e.jsx("div",{className:n.statDetail,children:r.detail})]},r.label))})}function k({data:t}){const a=x(),r=t.slice(0,15);return r.length===0?e.jsx(p,{message:"No tool data"}):e.jsx(j,{width:"100%",height:Math.max(200,r.length*28),children:e.jsxs(b,{data:r,layout:"vertical",margin:{top:4,right:40,bottom:4,left:100},children:[e.jsx(v,{strokeDasharray:"3 3",stroke:a.borderSubtle}),e.jsx(S,{type:"number",tick:{fill:a.textDim,fontSize:10}}),e.jsx(_,{type:"category",dataKey:"tool_name",tick:{fill:a.textDim,fontSize:10},width:96}),e.jsx(C,{contentStyle:{background:a.bgCard,border:`1px solid ${a.cyan}`,borderRadius:4,fontSize:11,color:a.textPrimary},formatter:((i,o,s)=>[`${l(i)} (${s.payload.percentage}%)`,"Calls"])}),e.jsx(T,{dataKey:"count",radius:[0,4,4,0],children:r.map((i,o)=>e.jsx($,{fill:a.cyan,fillOpacity:.85},o))})]})})}function D({data:t}){const a=x(),r=y.useMemo(()=>[...t].sort((i,o)=>o.session_count-i.session_count).slice(0,15),[t]);return r.length===0?e.jsx(p,{message:"No project data"}):e.jsx(j,{width:"100%",height:Math.max(200,r.length*28),children:e.jsxs(b,{data:r,layout:"vertical",margin:{top:4,right:40,bottom:4,left:120},children:[e.jsx(v,{strokeDasharray:"3 3",stroke:a.borderSubtle}),e.jsx(S,{type:"number",tick:{fill:a.textDim,fontSize:10}}),e.jsx(_,{type:"category",dataKey:"project_name",tick:{fill:a.textDim,fontSize:10},width:116}),e.jsx(C,{contentStyle:{background:a.bgCard,border:`1px solid ${a.cyan}`,borderRadius:4,fontSize:11,color:a.textPrimary},formatter:(i=>[l(i)+" sessions","Sessions"])}),e.jsx(T,{dataKey:"session_count",radius:[0,4,4,0],children:r.map((i,o)=>e.jsx($,{fill:a.green,fillOpacity:.85},o))})]})})}function M({data:t}){const a=x(),{grid:r,maxVal:i}=y.useMemo(()=>{const o=new Map;let s=0;for(const c of t){const d=`${c.day_of_week}-${c.hour}`;o.set(d,c.count),c.count>s&&(s=c.count)}return{grid:o,maxVal:s}},[t]);return t.length===0?e.jsx(p,{message:"No heatmap data"}):e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"40px repeat(24, 14px)",gridTemplateRows:"14px repeat(7, 14px)",gap:"2px",alignItems:"center"},children:[e.jsx("div",{}),Array.from({length:24},(o,s)=>e.jsx("div",{style:{fontSize:"9px",color:a.textDim,textAlign:"center"},children:s},`h-${s}`)),Array.from({length:7},(o,s)=>e.jsxs(y.Fragment,{children:[e.jsx("div",{style:{fontSize:"10px",color:a.textDim,textAlign:"right",paddingRight:"4px"},children:f[s]}),Array.from({length:24},(c,d)=>{const h=r.get(`${s}-${d}`)??0;return e.jsx("div",{className:n.heatmapCell,title:`${f[s]} ${String(d).padStart(2,"0")}:00 - ${h} events`,style:{backgroundColor:w(h,i,a.bgPrimary,a.green)}},`${s}-${d}`)})]},`row-${s}`))]})}function p({message:t}){return e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",minHeight:"120px",color:"var(--text-dim, #555577)",fontSize:"0.85rem"},children:t})}export{q as default};