@wangcansun/cc-config 1.2.2 → 1.3.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/cli.mjs +12 -2
- package/dashboard/dist/client/assets/activity-4TqyD_rE.js +1 -0
- package/dashboard/dist/client/assets/{commands-DhNv8XVR.js → commands-DEkiXZYl.js} +1 -1
- package/dashboard/dist/client/assets/dashboard-kD72rFaQ.js +1 -0
- package/dashboard/dist/client/assets/{detail-panel-C8SGLgm-.js → detail-panel-BIvsI61i.js} +1 -1
- package/dashboard/dist/client/assets/{header-CBzSNzdI.js → header-BTV9BL6u.js} +1 -1
- package/dashboard/dist/client/assets/{index-CaDf51H6.js → index-C8Brdl4F.js} +2 -2
- package/dashboard/dist/client/assets/{index-CFEz1CGb.js → index-CUdpRxTZ.js} +1 -1
- package/dashboard/dist/client/assets/{markdown-viewer-Bj8nSOSJ.js → markdown-viewer-Bcu9HM71.js} +3 -3
- package/dashboard/dist/client/assets/{mcp-BX69kbwu.js → mcp-DrHxDxfw.js} +1 -1
- package/dashboard/dist/client/assets/{plugins-BslRzmVr.js → plugins-husUl0t4.js} +1 -1
- package/dashboard/dist/client/assets/{profiles-CfOCpDPJ.js → profiles-tCUJYeeT.js} +1 -1
- package/dashboard/dist/client/assets/{recommended-BAj0agKu.js → recommended-Brh5GAZB.js} +1 -1
- package/dashboard/dist/client/assets/{search-box-CqaIZ9mR.js → search-box-CO7338GK.js} +1 -1
- package/dashboard/dist/client/assets/{select-BtWQJMup.js → select-BdEpCEBk.js} +1 -1
- package/dashboard/dist/client/assets/{settings-CicCcNf_.js → settings-DpddxKm5.js} +1 -1
- package/dashboard/dist/client/assets/{skills-DML4G4BP.js → skills-BvLEIHVX.js} +1 -1
- package/dashboard/dist/client/assets/{tag-Q3V7Jugn.js → tag-CkZkoVAp.js} +1 -1
- package/dashboard/dist/client/index.html +1 -1
- package/dashboard/dist/server.mjs +12 -2
- package/package.json +1 -1
- package/dashboard/dist/client/assets/activity-DS5YBWMm.js +0 -1
- package/dashboard/dist/client/assets/dashboard-DIyDYrl6.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as A,a as P,r as m,j as e,N as $}from"./index-CaDf51H6.js";import{H as B}from"./header-CBzSNzdI.js";import{S as M}from"./search-box-CqaIZ9mR.js";import{T as p}from"./tag-Q3V7Jugn.js";function S(t){if(!t)return"unknown";const r=Date.now()-t,n=Math.floor(r/1e3);if(n<30)return"just now";if(n<60)return`${n}s ago`;const c=Math.floor(n/60);if(c<60)return`${c}m ago`;const i=Math.floor(c/60);if(i<24)return`${i}h ago`;const o=Math.floor(i/24);if(o<30)return`${o}d ago`;const d=new Date(t);return`${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][d.getMonth()]} ${d.getDate()}`}function R(t,a=60){return t.length<=a?t:"..."+t.slice(t.length-a+3)}function T(t,a=120){if(!t)return"";const r=t.replace(/\n/g," ").trim();return r.length<=a?r:r.slice(0,a)+"..."}function k(t){return`claude --resume ${t}`}function L({sessionId:t,size:a="sm"}){const[r,n]=m.useState(!1),c=o=>{o.stopPropagation(),navigator.clipboard.writeText(k(t)),n(!0),window.setTimeout(()=>n(!1),1500)},i=a==="sm";return e.jsx("button",{onClick:c,className:"inline-flex items-center gap-1 rounded transition-colors hover:bg-bg-hover",style:{padding:i?"2px 6px":"4px 10px",fontSize:i?"11px":"12px",color:r?"var(--status-green)":"var(--text-muted)",border:"1px solid var(--card-border)"},title:r?"Copied!":`Copy: ${k(t)}`,children:r?e.jsxs(e.Fragment,{children:[e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),"Copied"]}):e.jsxs(e.Fragment,{children:[e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})}),"Resume"]})})}function C({icon:t,label:a,count:r,defaultOpen:n,labelColor:c,children:i}){const[o,d]=m.useState(n??!0);return e.jsxs("div",{className:"rounded-lg overflow-hidden",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:[e.jsxs("button",{className:"w-full flex items-center justify-between px-5 py-3 text-left transition-colors hover:bg-bg-hover",style:{borderBottom:o?"1px solid var(--border)":"none"},onClick:()=>d(!o),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-base",children:t}),e.jsx("span",{className:"text-sm font-medium",style:{color:c??"var(--text-muted)"},children:a}),e.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full",style:{backgroundColor:"var(--border)",color:"var(--text-secondary)"},children:r})]}),e.jsx("svg",{className:"w-4 h-4 transition-transform",style:{color:"var(--text-muted)",transform:o?"rotate(0deg)":"rotate(-90deg)"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),o&&e.jsx("div",{children:i})]})}function b({session:t,isLast:a,onClick:r}){var n,c,i;return e.jsxs("div",{className:"flex items-start gap-4 px-5 py-4 cursor-pointer transition-colors hover:bg-bg-hover",style:{borderBottom:a?"none":"1px solid var(--border)"},onClick:r,children:[e.jsx("span",{className:"inline-block w-2.5 h-2.5 rounded-full shrink-0 mt-1.5",style:{backgroundColor:t.alive?"var(--status-green)":"var(--text-muted)"}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[t.name?e.jsx("span",{className:"text-sm font-medium truncate max-w-full",style:{color:"var(--text-primary)"},title:t.name,children:t.name}):e.jsx("span",{className:"font-mono text-sm font-medium",style:{color:"var(--accent-light)"},children:t.sessionId}),t.pid>0&&e.jsx(p,{label:`PID ${t.pid}`,variant:"gray"}),t.ide&&e.jsx(p,{label:`${t.ide.name} (${t.ide.transport})`,variant:"purple"}),((n=t.projectConfig)==null?void 0:n.hasClaudeMd)&&e.jsx("span",{className:"text-xs",style:{color:"var(--text-secondary)"},title:"CLAUDE.md",children:"📄"}),((c=t.projectConfig)==null?void 0:c.hasMcpJson)&&e.jsx("span",{className:"text-xs",style:{color:"var(--text-secondary)"},title:".mcp.json",children:"🔌"}),((i=t.projectConfig)==null?void 0:i.hasProjectSettings)&&e.jsx("span",{className:"text-xs",style:{color:"var(--text-secondary)"},title:"Project Settings",children:"⚙️"}),e.jsx("span",{className:"ml-auto",children:e.jsx(L,{sessionId:t.sessionId})})]}),t.name&&e.jsx("p",{className:"font-mono text-xs truncate",style:{color:"var(--text-muted)"},children:t.sessionId}),e.jsx("p",{className:"font-mono text-xs truncate",style:{color:"var(--text-secondary)"},children:t.cwd}),e.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[e.jsx("span",{className:"text-xs shrink-0",style:{color:"var(--text-muted)"},children:S(t.startedAt)}),t.lastMessage&&e.jsxs("span",{className:"text-sm truncate",style:{color:"var(--text-secondary)"},children:["💬 ",T(t.lastMessage)]})]})]}),e.jsx("svg",{className:"w-4 h-4 shrink-0 mt-0.5",style:{color:"var(--text-muted)"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]})}function E({session:t,onClose:a}){const r=t!==null,n=m.useCallback(c=>{c.key==="Escape"&&a()},[a]);return m.useEffect(()=>{if(r)return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[r,n]),e.jsxs(e.Fragment,{children:[r&&e.jsx("div",{className:"fixed inset-0 z-40",style:{backgroundColor:"var(--overlay-bg)"},onClick:a}),e.jsx("div",{className:"fixed top-0 right-0 z-50 h-full flex flex-col",style:{width:"60%",minWidth:"480px",maxWidth:"900px",backgroundColor:"var(--bg-secondary)",borderLeft:"1px solid var(--card-border)",transform:r?"translateX(0)":"translateX(100%)",transition:"transform 0.25s ease-in-out",boxShadow:r?"-8px 0 32px rgba(0, 0, 0, 0.4)":"none"},children:t&&e.jsx(F,{session:t,onClose:a})})]})}function F({session:t,onClose:a}){const{data:r,isLoading:n}=$(t.historyFile??null),[c,i]=m.useState(""),o=m.useMemo(()=>{if(!r)return[];if(!c.trim())return r;const d=c.toLowerCase();return r.filter(u=>u.text.toLowerCase().includes(d))},[r,c]);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between px-6 py-4 shrink-0 gap-3",style:{borderBottom:"1px solid var(--border)"},children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[e.jsx("span",{className:"inline-block w-3 h-3 rounded-full shrink-0",style:{backgroundColor:t.alive?"var(--status-green)":"var(--text-muted)"}}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-base font-medium truncate",style:{color:"var(--text-primary)"},title:t.name??void 0,children:t.name??(t.pid>0?`PID ${t.pid}`:"Session")}),e.jsx(p,{label:t.alive?"Running":"Terminated",variant:t.alive?"green":"gray"}),t.ide&&e.jsx(p,{label:`${t.ide.name} (${t.ide.transport})`,variant:"purple"})]}),t.name&&t.pid>0&&e.jsxs("p",{className:"text-xs mt-0.5",style:{color:"var(--text-muted)"},children:["PID ",t.pid]})]})]}),e.jsx(L,{sessionId:t.sessionId,size:"md"}),e.jsx("button",{className:"w-8 h-8 rounded-lg flex items-center justify-center shrink-0 transition-colors hover:bg-bg-hover",style:{color:"var(--text-secondary)"},onClick:a,children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-5 space-y-6",children:[e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium uppercase tracking-wider mb-3",style:{color:"var(--text-muted)"},children:"Metadata"}),e.jsxs("div",{className:"rounded-lg p-4 space-y-3",style:{backgroundColor:"var(--bg-tertiary)",border:"1px solid var(--border)"},children:[e.jsx(j,{label:"Session ID",children:e.jsx("code",{className:"text-xs font-mono break-all",style:{color:"var(--accent-light)"},children:t.sessionId})}),t.pid>0&&e.jsx(j,{label:"PID",children:e.jsx("code",{className:"text-xs font-mono",style:{color:"var(--accent-light)"},children:t.pid})}),e.jsx(j,{label:"Working Directory",children:e.jsx("code",{className:"text-xs font-mono break-all",style:{color:"var(--text-secondary)"},children:t.cwd})}),t.projectDir&&t.projectDir!==t.cwd&&e.jsx(j,{label:"Project Directory",children:e.jsx("code",{className:"text-xs font-mono break-all",style:{color:"var(--text-secondary)"},children:t.projectDir})}),e.jsx(j,{label:"Started",children:e.jsx("span",{className:"text-xs",style:{color:"var(--text-secondary)"},children:t.startedAt?`${new Date(t.startedAt).toLocaleString()} (${S(t.startedAt)})`:"Unknown"})}),t.ide&&e.jsx(j,{label:"IDE",children:e.jsxs("span",{className:"text-xs",style:{color:"var(--text-secondary)"},children:[t.ide.name,e.jsx("span",{style:{color:"var(--text-muted)"},children:" via "}),t.ide.transport]})}),t.projectConfig&&e.jsx(j,{label:"Project Config",children:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.projectConfig.hasClaudeMd&&e.jsx(p,{label:"CLAUDE.md",variant:"blue"}),t.projectConfig.hasMcpJson&&e.jsx(p,{label:".mcp.json",variant:"purple"}),t.projectConfig.hasProjectSettings&&e.jsx(p,{label:"Project Settings",variant:"orange"}),!t.projectConfig.hasClaudeMd&&!t.projectConfig.hasMcpJson&&!t.projectConfig.hasProjectSettings&&e.jsx("span",{className:"text-xs",style:{color:"var(--text-muted)"},children:"None detected"})]})})]})]}),e.jsxs("section",{children:[e.jsx("h3",{className:"text-xs font-medium uppercase tracking-wider mb-3",style:{color:"var(--text-muted)"},children:"Instruction History"}),t.historyFile?n?e.jsxs("div",{className:"flex items-center gap-2 py-4",children:[e.jsx("span",{className:"inline-block w-4 h-4 rounded-full border-2 animate-spin",style:{borderColor:"var(--card-border)",borderTopColor:"var(--accent-light)"}}),e.jsx("span",{className:"text-xs",style:{color:"var(--text-secondary)"},children:"Loading history..."})]}):!r||r.length===0?e.jsx("p",{className:"text-xs",style:{color:"var(--text-muted)"},children:"No user messages found in session history."}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mb-3",children:e.jsx(M,{value:c,onChange:i,placeholder:"Filter instructions..."})}),e.jsxs("p",{className:"text-xs mb-3",style:{color:"var(--text-muted)"},children:[o.length," of ",r.length," message",r.length!==1?"s":""]}),e.jsx("div",{className:"space-y-2",children:o.length===0?e.jsx("p",{className:"text-xs py-4 text-center",style:{color:"var(--text-muted)"},children:"No messages match your filter."}):o.map((d,u)=>e.jsxs("div",{className:"rounded-lg p-3",style:{backgroundColor:"var(--bg-tertiary)",border:"1px solid var(--border)"},children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx(p,{label:d.role??"user",variant:"blue"}),d.timestamp&&e.jsx("span",{className:"text-xs",style:{color:"var(--text-muted)"},children:new Date(d.timestamp).toLocaleString()})]}),e.jsx("p",{className:"text-xs whitespace-pre-wrap break-words mt-2",style:{color:"var(--text-secondary)"},children:d.text.length>800?d.text.slice(0,800)+"...":d.text})]},u))})]}):e.jsx("p",{className:"text-xs",style:{color:"var(--text-muted)"},children:"No history file available for this session."})]})]})]})}function j({label:t,children:a}){return e.jsxs("div",{className:"flex items-start justify-between gap-6",children:[e.jsx("span",{className:"text-xs shrink-0",style:{color:"var(--text-muted)"},children:t}),e.jsx("div",{className:"text-right",children:a})]})}function U(){const{t}=A(),{data:a,isLoading:r}=P(),n=a??[],[c,i]=m.useState(null),[o,d]=m.useState(""),[u,N]=m.useState("all"),v=m.useMemo(()=>{if(!o.trim())return n;const s=o.toLowerCase();return n.filter(l=>l.cwd.toLowerCase().includes(s)||l.sessionId.toLowerCase().includes(s)||String(l.pid).includes(s)||(l.lastMessage??"").toLowerCase().includes(s)||(l.projectDir??"").toLowerCase().includes(s))},[n,o]),f=m.useMemo(()=>v.filter(s=>s.alive).sort((s,l)=>l.startedAt-s.startedAt),[v]),w=m.useMemo(()=>{const s=v.filter(x=>!x.alive).sort((x,h)=>h.startedAt-x.startedAt),l={};for(const x of s){const h=x.projectDir||x.cwd||"Unknown";l[h]||(l[h]=[]),l[h].push(x)}return Object.entries(l).sort(([,x],[,h])=>{const I=Math.max(...x.map(y=>y.startedAt||0));return Math.max(...h.map(y=>y.startedAt||0))-I})},[v]),g=m.useMemo(()=>[...v].sort((s,l)=>l.startedAt-s.startedAt).slice(0,10),[v]),D=n.length;return e.jsxs("div",{children:[e.jsxs("div",{className:"sticky top-0 z-10 bg-bg-primary",children:[e.jsx(B,{title:t("activity.title"),subtitle:r?"Loading sessions...":t("activity.subtitle",{running:f.length,total:D})}),e.jsxs("div",{className:"flex items-center gap-1 mb-4",children:[e.jsx("button",{className:"px-4 py-1.5 rounded-lg text-sm font-medium transition-colors",style:{backgroundColor:u==="recent"?"var(--accent)":"transparent",color:u==="recent"?"#fff":"var(--text-muted)"},onClick:()=>N("recent"),children:t("activity.recent",{count:10})}),e.jsx("button",{className:"px-4 py-1.5 rounded-lg text-sm font-medium transition-colors",style:{backgroundColor:u==="all"?"var(--accent)":"transparent",color:u==="all"?"#fff":"var(--text-muted)"},onClick:()=>N("all"),children:t("activity.allSessions")}),e.jsx("div",{className:"flex-1"}),e.jsx("div",{className:"w-72",children:e.jsx(M,{value:o,onChange:d,placeholder:t("activity.searchPlaceholder")})})]})]}),r?e.jsx("p",{style:{color:"var(--text-secondary)"},children:"Loading..."}):u==="recent"?g.length===0?e.jsx("div",{className:"rounded-lg p-8 text-center",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:e.jsx("p",{className:"text-sm",style:{color:"var(--text-muted)"},children:"No recent sessions."})}):e.jsx("div",{className:"rounded-lg overflow-hidden",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:g.map((s,l)=>e.jsx(b,{session:s,isLast:l===g.length-1,onClick:()=>i(s)},s.sessionId))}):v.length===0?e.jsxs("div",{className:"rounded-lg p-8 text-center",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:[e.jsx("p",{className:"text-lg mb-2",style:{color:"var(--text-muted)"},children:o?"No matching sessions":"No sessions found"}),e.jsx("p",{className:"text-sm",style:{color:"var(--text-faint)"},children:o?"Try a different search term.":"Sessions appear here when Claude Code instances are running or have conversation history."})]}):e.jsxs("div",{className:"space-y-6",children:[f.length>0&&e.jsx(C,{icon:"🟢",label:"Running",count:f.length,defaultOpen:!0,labelColor:"var(--status-green)",children:f.map((s,l)=>e.jsx(b,{session:s,isLast:l===f.length-1,onClick:()=>i(s)},s.sessionId))}),w.map(([s,l])=>e.jsx(C,{icon:"📁",label:R(s),count:l.length,defaultOpen:w.length<=3,children:l.map((x,h)=>e.jsx(b,{session:x,isLast:h===l.length-1,onClick:()=>i(x)},x.sessionId))},s))]}),e.jsx(E,{session:c,onClose:()=>i(null)})]})}export{U as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,u as g,a as k,b as N,c as M,d as j,e as C,r as b}from"./index-CaDf51H6.js";import{H as L}from"./header-CBzSNzdI.js";function h({title:r,value:n,subtitle:s}){return e.jsxs("div",{className:"rounded-lg p-5",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:[e.jsx("p",{className:"text-xs uppercase tracking-wider mb-2",style:{color:"var(--text-muted)",fontWeight:510},children:r}),e.jsx("p",{className:"text-3xl mb-1",style:{color:"var(--text-primary)",fontWeight:510},children:n}),s&&e.jsx("p",{className:"text-sm",style:{color:"var(--text-secondary)"},children:s})]})}function $(r){if(!r)return"";const n=Date.now()-r,s=Math.floor(n/1e3);if(s<30)return"just now";if(s<60)return`${s}s ago`;const a=Math.floor(s/60);if(a<60)return`${a}m ago`;const o=Math.floor(a/60);if(o<24)return`${o}h ago`;const l=Math.floor(o/24);if(l<30)return`${l}d ago`;const t=new Date(r);return`${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getMonth()]} ${t.getDate()}`}function p({title:r,entries:n,barColor:s,maxItems:a=8}){const o=n.slice(0,a),l=o.length>0?o[0].usageCount:0;return e.jsxs("div",{className:"rounded-lg overflow-hidden",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:[e.jsx("div",{className:"px-5 py-3",style:{borderBottom:"1px solid var(--border)"},children:e.jsx("h3",{className:"text-lg",style:{color:"var(--text-primary)",fontWeight:510},children:r})}),o.length===0?e.jsx("div",{className:"px-5 py-6 text-center",children:e.jsx("p",{className:"text-sm",style:{color:"var(--text-muted)"},children:"No data yet."})}):e.jsx("div",{className:"py-1",children:o.map(t=>{const c=l>0?t.usageCount/l*100:0,i=$(t.lastUsedAt);return e.jsxs("div",{className:"flex items-center gap-3 px-5 py-2.5 transition-colors",onMouseEnter:d=>{d.currentTarget.style.backgroundColor="var(--bg-hover)"},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent"},children:[e.jsx("span",{className:"font-mono text-xs shrink-0 truncate",style:{color:"var(--accent-light)",width:"180px"},title:t.name,children:t.name.length>26?t.name.slice(0,24)+"...":t.name}),e.jsx("div",{className:"flex-1 h-5 rounded overflow-hidden",style:{backgroundColor:"var(--border)"},children:e.jsx("div",{className:"h-full rounded",style:{width:`${Math.max(c,2)}%`,backgroundColor:s,opacity:.85,transition:"width 0.3s ease"}})}),e.jsx("span",{className:"text-xs shrink-0 text-right",style:{color:"var(--text-secondary)",width:"44px",fontWeight:510},children:t.usageCount}),i&&e.jsx("span",{className:"text-xs shrink-0 text-right",style:{color:"var(--text-faint)",width:"64px"},children:i})]},t.name)})})]})}function S(r){if(!r)return"";const n=Date.now()-r,s=Math.floor(n/1e3);if(s<30)return"just now";if(s<60)return`${s}s ago`;const a=Math.floor(s/60);if(a<60)return`${a}m ago`;const o=Math.floor(a/60);if(o<24)return`${o}h ago`;const l=Math.floor(o/24);if(l<30)return`${l}d ago`;const t=new Date(r);return`${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getMonth()]} ${t.getDate()}`}function B(r,n=48){return r?r.length<=n?r:"..."+r.slice(r.length-n+3):""}function W(r,n=80){if(!r)return"";const s=r.replace(/\n/g," ").trim();return s.length<=n?s:s.slice(0,n)+"..."}function D(){const{t:r}=g(),{data:n,isLoading:s}=k(),a=N(),o=(n??[]).slice().sort((l,t)=>t.startedAt-l.startedAt).slice(0,5);return e.jsxs("div",{className:"rounded-lg overflow-hidden",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:[e.jsxs("div",{className:"px-5 py-3 flex items-center justify-between",style:{borderBottom:"1px solid var(--border)"},children:[e.jsx("h3",{className:"text-lg",style:{color:"var(--text-primary)",fontWeight:510},children:r("overview.recentSessions")}),e.jsx("button",{className:"text-xs transition-colors",style:{color:"var(--text-muted)"},onClick:()=>a("/activity"),children:r("overview.viewAll")})]}),s?e.jsx("div",{className:"px-5 py-6",children:e.jsx("p",{className:"text-sm",style:{color:"var(--text-muted)"},children:"Loading..."})}):o.length===0?e.jsx("div",{className:"px-5 py-6 text-center",children:e.jsx("p",{className:"text-sm",style:{color:"var(--text-muted)"},children:"No sessions found."})}):e.jsx("div",{children:o.map((l,t)=>e.jsxs("div",{className:"flex items-start gap-3 px-5 py-3 cursor-pointer transition-colors",style:{borderBottom:t<o.length-1?"1px solid var(--border)":"none"},onClick:()=>a("/activity"),onMouseEnter:c=>{c.currentTarget.style.backgroundColor="var(--bg-hover)"},onMouseLeave:c=>{c.currentTarget.style.backgroundColor="transparent"},children:[e.jsx("span",{className:"inline-block w-2 h-2 rounded-full shrink-0 mt-1.5",style:{backgroundColor:l.alive?"var(--status-green)":"var(--text-muted)"}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[l.name&&e.jsx("p",{className:"text-sm font-medium truncate mb-0.5",style:{color:"var(--text-primary)"},title:l.name,children:l.name}),e.jsx("p",{className:"font-mono text-xs truncate mb-0.5",style:{color:"var(--text-secondary)"},title:l.projectDir??l.cwd,children:B(l.projectDir??l.cwd)}),e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"text-xs shrink-0",style:{color:"var(--text-faint)"},children:S(l.startedAt)}),l.lastMessage&&e.jsx("span",{className:"text-xs truncate",style:{color:"var(--text-faint)"},children:W(l.lastMessage)})]})]})]},l.sessionId))})]})}function v({icon:r,label:n,children:s}){return e.jsxs("div",{className:"flex items-center justify-between px-5 py-3 transition-colors",onMouseEnter:a=>{a.currentTarget.style.backgroundColor="var(--bg-hover)"},onMouseLeave:a=>{a.currentTarget.style.backgroundColor="transparent"},children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"shrink-0 w-5 h-5 flex items-center justify-center",style:{color:"var(--text-muted)"},children:r}),e.jsx("span",{className:"text-sm",style:{color:"var(--text-secondary)"},children:n})]}),e.jsx("div",{className:"flex items-center gap-2",children:s})]})}function x({label:r,color:n}){const a={green:{bg:"rgba(39, 166, 68, 0.15)",text:"var(--status-green)"},blue:{bg:"rgba(94, 106, 210, 0.15)",text:"var(--accent-light)"},yellow:{bg:"rgba(138, 143, 152, 0.15)",text:"var(--text-secondary)"},gray:{bg:"var(--border)",text:"var(--text-muted)"}}[n];return e.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full",style:{backgroundColor:a.bg,color:a.text,fontWeight:510},children:r})}function T(){return e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",style:{color:"var(--status-green)"},children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}function A(){return e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})}function H(){return e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 10h16M4 14h16M4 18h16"})})}function R(){return e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2"})})}function I(){return e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})})}function J(){return e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4"})})}function E(){const{t:r}=g(),{data:n,isLoading:s}=M(),{data:a,isLoading:o}=j(),l=s||o,t=n??{},c=a,i=t.model??"",d=t.hooks??{},u=Object.values(d).reduce((w,f)=>w+(Array.isArray(f)?f.length:0),0),y=t.env??{},m=Object.keys(y).length;return e.jsxs("div",{className:"rounded-lg overflow-hidden",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:[e.jsx("div",{className:"px-5 py-3",style:{borderBottom:"1px solid var(--border)"},children:e.jsx("h3",{className:"text-lg",style:{color:"var(--text-primary)",fontWeight:510},children:r("overview.environmentHealth")})}),l?e.jsx("div",{className:"px-5 py-6",children:e.jsx("p",{className:"text-sm",style:{color:"var(--text-muted)"},children:"Loading..."})}):e.jsxs("div",{children:[e.jsx(v,{icon:e.jsx(A,{}),label:"Model",children:i?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-sm font-mono",style:{color:"var(--accent-light)"},children:i.length>30?i.slice(0,28)+"...":i}),e.jsx(T,{})]}):e.jsx("span",{className:"text-sm",style:{color:"var(--text-muted)"},children:"Not configured"})}),e.jsx(v,{icon:e.jsx(H,{}),label:r("overview.plugins"),children:c&&c.plugins>0?e.jsx(x,{label:r("overview.active",{count:c.plugins}),color:"green"}):e.jsx(x,{label:r("overview.hooksNone"),color:"gray"})}),e.jsx(v,{icon:e.jsx(R,{}),label:r("overview.mcpServers"),children:c&&c.mcpServers>0?e.jsx(x,{label:r("overview.configured",{count:c.mcpServers}),color:"blue"}):e.jsx(x,{label:r("overview.hooksNone"),color:"gray"})}),e.jsx(v,{icon:e.jsx(I,{}),label:"Hooks",children:u>0?e.jsx(x,{label:`${u} hook${u!==1?"s":""}`,color:"yellow"}):e.jsx(x,{label:r("overview.hooksNone"),color:"gray"})}),e.jsx(v,{icon:e.jsx(J,{}),label:"Env Vars",children:m>0?e.jsx(x,{label:r("overview.envSet",{count:m}),color:"blue"}):e.jsx(x,{label:r("overview.hooksNone"),color:"gray"})})]})]})}function O(r){if(!r)return"";const n=Date.now()-r,s=Math.floor(n/1e3);if(s<30)return"just now";if(s<60)return`${s}s ago`;const a=Math.floor(s/60);if(a<60)return`${a}m ago`;const o=Math.floor(a/60);if(o<24)return`${o}h ago`;const l=Math.floor(o/24);if(l<30)return`${l}d ago`;const t=new Date(r);return`${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getMonth()]} ${t.getDate()}`}function U({entry:r,maxCount:n,barColor:s}){const a=n>0?r.usageCount/n*100:0,o=O(r.lastUsedAt);return e.jsxs("div",{className:"flex items-center gap-3 px-5 py-2.5 transition-colors hover:bg-bg-hover",children:[e.jsx("span",{className:"font-mono text-xs shrink-0",style:{color:"var(--accent-light)",width:"200px"},title:r.name,children:r.name.length>28?r.name.slice(0,26)+"...":r.name}),e.jsx("div",{className:"flex-1 h-5 rounded overflow-hidden",style:{backgroundColor:"var(--border)"},children:e.jsx("div",{className:"h-full rounded",style:{width:`${Math.max(a,2)}%`,backgroundColor:s,opacity:.85,transition:"width 0.3s ease"}})}),e.jsx("span",{className:"text-xs shrink-0 text-right",style:{color:"var(--text-secondary)",width:"44px",fontWeight:510},children:r.usageCount}),o&&e.jsx("span",{className:"text-xs shrink-0 text-right",style:{color:"var(--text-faint)",width:"64px"},children:o})]})}function V({server:r,tools:n,totalCalls:s,toolCount:a}){const[o,l]=b.useState(!1),t=n.length>0?n[0].usageCount:0;return e.jsxs("div",{className:"rounded-lg overflow-hidden",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:[e.jsxs("button",{className:"w-full flex items-center justify-between px-5 py-3 text-left transition-colors hover:bg-bg-hover",style:{borderBottom:o?"1px solid var(--border)":"none"},onClick:()=>l(!o),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"font-mono text-sm",style:{color:"var(--text-secondary)",fontWeight:510},children:r}),e.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full",style:{backgroundColor:"var(--border)",color:"var(--text-secondary)"},children:[s," calls"]}),e.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full",style:{backgroundColor:"var(--border)",color:"var(--text-muted)"},children:[a," tools"]})]}),e.jsx("svg",{className:"w-4 h-4 transition-transform",style:{color:"var(--text-faint)",transform:o?"rotate(0deg)":"rotate(-90deg)"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),o&&e.jsx("div",{className:"py-1",children:n.map(c=>e.jsx(U,{entry:c,maxCount:t,barColor:"var(--accent)"},c.name))})]})}function F({metrics:r,mcpToolsByServer:n}){const[s,a]=b.useState(!0);return r.mcpServerBreakdown.length===0?null:e.jsxs("div",{className:"rounded-lg overflow-hidden",style:{backgroundColor:"var(--card-bg)",border:"1px solid var(--card-border)"},children:[e.jsxs("button",{className:"w-full flex items-center justify-between px-5 py-3 text-left transition-colors hover:bg-bg-hover",style:{borderBottom:s?"1px solid var(--border)":"none"},onClick:()=>a(!s),children:[e.jsx("h2",{className:"text-lg",style:{color:"var(--text-primary)",fontWeight:510},children:"MCP Server Usage"}),e.jsx("svg",{className:"w-4 h-4 transition-transform",style:{color:"var(--text-faint)",transform:s?"rotate(0deg)":"rotate(-90deg)"},fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),s&&e.jsx("div",{className:"p-5 space-y-3",children:r.mcpServerBreakdown.map(o=>e.jsx(V,{server:o.server,tools:n[o.server]??[],totalCalls:o.totalCalls,toolCount:o.toolCount},o.server))})]})}function q(){const{t:r}=g(),{data:n,isLoading:s}=j(),{data:a,isLoading:o}=C(),l=s||o,t=n,c=a,i={};if(c!=null&&c.mcpTools)for(const d of c.mcpTools){const u=d.mcpServer??"unknown";i[u]||(i[u]=[]),i[u].push(d)}return e.jsxs("div",{children:[e.jsx(L,{title:r("overview.title")}),l?e.jsx("p",{style:{color:"var(--text-secondary)"},children:"Loading..."}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-5 gap-4",children:[e.jsx(h,{title:r("overview.plugins"),value:(t==null?void 0:t.plugins)??0,color:"purple"}),e.jsx(h,{title:r("overview.mcpServers"),value:(t==null?void 0:t.mcpServers)??0,color:"blue"}),e.jsx(h,{title:r("overview.skills"),value:(t==null?void 0:t.skills)??0,color:"green"}),e.jsx(h,{title:r("overview.profiles"),value:(t==null?void 0:t.profiles)??0,color:"orange"}),e.jsx(h,{title:r("overview.sessions"),value:(t==null?void 0:t.sessions)??0,color:"blue"})]}),c&&e.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[e.jsx(p,{title:r("overview.topSkills"),entries:c.topSkills,barColor:"var(--accent)",maxItems:8}),e.jsx(p,{title:r("overview.topTools"),entries:c.topTools,barColor:"var(--accent-light)",maxItems:8})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[e.jsx(D,{}),e.jsx(E,{})]}),c&&e.jsx(F,{metrics:c,mcpToolsByServer:i})]})]})}export{q as default};
|